Skip to content

Conversation

w0utert
Copy link
Contributor

@w0utert w0utert commented Oct 10, 2022

Description

On linux hosts with Nvidia GPU and CUDA support enabled, a CUDA kernel is used to convert captured RGBA frames to NV12 before encoding. This kernel contained a bug affecting image quality, in particular when rendering high-contrast colored text and sharp lines. See [1] for more information.

This commit fixes the format conversion kernel by taking 2x2 RGBA blocks to generate 4 luma (Y) values and 1 chroma (UV) pair, ie: 12 bits per pixel YUV420 (NV12). Previous code incorrectly generated 1 UV pair for every 2 pixels.

[1] #154

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@ReenigneArcher
Copy link
Member

Does this completely fix 154? Or partially?

@w0utert
Copy link
Contributor Author

w0utert commented Oct 10, 2022

Yes, it completely fixes #154

w0utert and others added 4 commits October 10, 2022 21:39
On linux hosts with Nvidia GPU and CUDA support enabled, a CUDA kernel
is used to convert captured RGBA frames to NV12 before encoding. This
kernel contained a bug affecting image quality, in particular when
rendering high-contrast colored text and sharp lines. See [1] for more
information.

This commit fixes the format conversion kernel by taking 2x2 RGBA blocks
to generate 4 luma (Y) values and 1 chroma (UV) pair, ie: 12 bits per
pixel YUV420 (NV12). Previous code incorrectly generated 1 UV pair for
every 2 pixels.

[1] #154
@ReenigneArcher ReenigneArcher merged commit 4428054 into LizardByte:nightly Oct 30, 2022
@ReenigneArcher ReenigneArcher mentioned this pull request Oct 30, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants