[FFmpeg-trac] #979(swscale:open): Unexpected Color Conversion (bgr->yuv vs rgb->yuv); first is bad, bmp affected (was: Unexpected Color Conversion (bgr->yuv vs rgb->yuv))
FFmpeg
trac at avcodec.org
Thu Apr 8 18:32:23 EEST 2021
#979: Unexpected Color Conversion (bgr->yuv vs rgb->yuv); first is bad, bmp
affected
------------------------------------+-----------------------------------
Reporter: natt | Owner:
Type: defect | Status: open
Priority: normal | Component: swscale
Version: git-master | Resolution:
Keywords: bmp | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+-----------------------------------
Changes (by Balling):
* keywords: => bmp
Comment:
This is fixed by -vf scale=flags=accurate_rnd (https://ffmpeg.org/ffmpeg-
all.html#Scaler-Options), or more accurately accurate_rnd+whatever
algorithm you want. WRONG documentation, BTW, you can use them together.
255, 255, 255 BGR value is converted to (as can be checked by ffplay -i
file -vf extractplanes=y) YCbCr values 234, 127, 127 (instead of good 235,
128, 128). So it is just an off-by-one somewhere. And no, it is not out-
of-gamut. I suppose the bug is indeed somewhere in second line about
special "unscaled" converter, whatever that means (you can print those
with +print_info):
{{{
[swscaler @ 00000275e7aa00c0] bicubic scaler, from bgr24 to yuv420p using
MMXEXT
[swscaler @ 00000275e7aa00c0] using unscaled bgr24 -> yuv420p special
converter
}}}
as there is no this second line with print_info+accurate_rnd.
What I am concerned with are JPEGs: they are also affected (?), need to
check RGB one.
Also see duplicate #8056: bmp is affected too, since it uses BGR.
I also clarified what is the bad one: bgr, not rgb.
P.S. -vf scale=out_range=pc is not affected.
P.P.S. If accurate_rnd is bit perfect, we just need to switch as default
for '''only''' bgr formats. Simple as that.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/979#comment:12>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list