[FFmpeg-trac] #11182(swscale:closed): yuvtestsrc and yuv444p->rgba->yuv444p conversion result in huge difference
FFmpeg
trac at avcodec.org
Fri Sep 13 01:36:38 EEST 2024
#11182: yuvtestsrc and yuv444p->rgba->yuv444p conversion result in huge difference
-------------------------------------+-------------------------------------
Reporter: Andrew-R | Owner: (none)
Type: defect | Status: closed
Priority: normal | Component: swscale
Version: unspecified | Resolution: invalid
Keywords: colorspace | Blocked By:
color_primaries |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by Andrew-R):
ah, found this technical reference:
https://techpubs.jurassic.nl/library/manuals/3000/007-3513-001/sgi_html/ch08.html
```
Constant Hue
In addition to the standard color-space conversion model, the OCTANE
Digital Video color-space feature provides a constant-hue algorithm. This
algorithm allows illegal YUV values to survive a YUV-to-RGB-to-YUV
conversion. In normal conversion, YUV values that cannot be represented in
the RGB color space are clamped or otherwise forced into the legal RGB
range. **Because the YUV (YCrCb) color space is a superset of the RGB
color space, illegal RGB values can be generated when YUV is converted to
RGB.** If the constant-hue block is disabled, then the illegal RGB values
are clipped by the output LUT. The lost (clipped) information can result
in significantly degraded quality when the image is subsequently
transformed back to YUV for video output.
The constant-hue algorithm saves the normally lost information in a
correction factor that can be stored in the alpha channel. To restore the
original YUV image, this correction factor must be saved with the pixel
data.
If the constant-hue algorithm is enabled, the illegal RGB values are
converted into legal R'G'B' values. A constant-hue factor, used to restore
R'G'B' to the original YUV values, can optionally be stored in the alpha
channel. If the constant-hue factor is not saved, then the R'G'B' image
appears as if it were range-compressed. The VL_MGV_CSC_ALPHA_CORRECTION
control determines whether the alpha channel is replaced by the constant-
hue factors, or if the alpha from the color-space converter's input is
retained.
Note that because the correction factor computed by the algorithm is
directly related to the pixel value, the correction factor is invalidated
if the pixel value is recalculated (for example, during compositing).
```
Interesting technology, but probably not something ffmpeg can do (or
expose to external use). Honestly, until now I was under impression RGB
was superset of YUV, not other way around ... I was wrong!
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11182#comment:30>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list