1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
FFmpeg/tests
Rudolf Polzer dcc9454ab9 vf_paletteuse: fix color cache lookup for Bayer dithering mode.
To trigger this bug, use `paletteuse=dither=bayer:bayer_scale=0`; you will see
that adjacent pixel lines will use the same dither pattern, instead of being
shifted from each other by 32 units (0x20).

One way to demostrate the bug is:

$ convert -size 64x256 gradient:black-white -rotate 270 grad.png
$ echo 'P2 2 1 255 0 255' > bw.pnm
$ ffmpeg -i grad.png -filter_complex 'movie=bw.pnm,scale=256x1[bw]; [0:v][bw]paletteuse=dither=bayer:bayer_scale=0' gradbw.png

Previously: https://www.rm.cloudns.org/img/uploaded/0bd152c11b9cd99e5945115534b1bdde.png
Now:        https://www.rm.cloudns.org/img/uploaded/89caaa5e36c38bc2c01755b30811f969.png

This was caused by passing inconsistent color vs (a,r,g,b) parameters to
color_get(), and NBITS being 5 meaning actually hitting the same cache node
does happen in this case, but ONLY if bayer_scale is zero.

The fix is passing the correct color value to color_get().

Also added a previous-failing FATE test; image comparison of the first frame:

Previously: https://www.rm.cloudns.org/img/uploaded/d0ff9db8d8a7d8a3b8b88bbe92bf5fed.png
Now:        https://www.rm.cloudns.org/img/uploaded/a72389707e719b5cd1c58916a9e79ca8.png

(on this less synthetic test image, the bug basically causes noise from cache
 hits vs misses)

Tested: FATE passes, which exercises this filter but at the default bayer_scale.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
2022-01-17 01:31:06 +05:30
..
api Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
checkasm swscale/x86/input.asm: add x86-optimized planer rgb2yuv functions 2022-01-11 16:34:33 -03:00
fate vf_paletteuse: fix color cache lookup for Bayer dithering mode. 2022-01-17 01:31:06 +05:30
filtergraphs
ref vf_paletteuse: fix color cache lookup for Bayer dithering mode. 2022-01-17 01:31:06 +05:30
.gitignore
audiogen.c
audiomatch.c tests/audiomatch: add free to make static analysis tools happy 2020-12-10 19:38:32 +08:00
base64.c
copycooker.sh
extended.ffconcat lavf/concat: deprecate file_packet_metadata 2021-09-16 10:17:59 +02:00
fate-run.sh tests/fate-run: Use DEC_OPTS for additional input, too 2021-10-08 12:06:00 +02:00
fate-valgrind.supp
fate.sh libavresample: Remove deprecated library 2021-04-27 10:43:13 -03:00
Makefile FATE: always pass -nostdin to ffmpeg 2021-12-22 18:38:40 -06:00
md5.sh
refcmp-metadata.awk
reference.pnm
rotozoom.c
simple1.ffconcat lavf/concat: deprecate file_packet_metadata 2021-09-16 10:17:59 +02:00
simple2.ffconcat tests/concat-demuxer: add stream_meta test 2021-09-16 10:17:59 +02:00
test.ffmeta
tiny_psnr.c
tiny_ssim.c
utils.c
videogen.c