[FFmpeg-trac] #3345(swscale:closed): Bias in planar YUV to YUV bit depth conversion
FFmpeg
trac at avcodec.org
Tue Dec 17 16:15:59 EET 2024
#3345: Bias in planar YUV to YUV bit depth conversion
------------------------------------+--------------------------------------
Reporter: abc123 | Owner: (none)
Type: defect | Status: closed
Priority: normal | Component: swscale
Version: git-master | Resolution: worksforme
Keywords: bounty | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+--------------------------------------
Changes (by Niklas Haas):
* resolution: => worksforme
* status: open => closed
Comment:
I double-checked this using synthetic data and can confirm that FFmpeg is
rounding accurately as of the latest version, in all dithering modes
(except "none"). Command line for verification:
$ ffmpeg -f lavfi -i color=color=black:size=128x128 -vf
"format=yuv420p10,geq=lum=842,format=yuv420p,extractplanes=y" -frames:v 1
-y luma.png && identify -verbose luma.png
...
Channel statistics:
Pixels: 16384
Gray:
min: 210 (0.823529)
max: 211 (0.827451)
mean: 210.5 (0.82549)
median: 210 (0.823529)
standard deviation: 0.500015 (0.00196084)
kurtosis: -2.00012
skewness: -1.20334e-21
entropy: 1
Colors: 2
Histogram:
8192: (210,210,210) #D2D2D2 gray(210)
8192: (211,211,211) #D3D3D3 gray(211)
...
This is exactly the result we would expect. Similar can be observed for
different values, e.g. 841 gives an exact average of 210.25. One thing to
note is that sizes which are not a multiple of 8x8 give a slight deviation
on account of the dithering pattern being cut off prematurely, but this
effect is miniscule and isolated to the edges.
Tentatively closing this one as working correctly.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/3345#comment:16>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list