Opened 5 years ago

Closed 2 years ago

#7613 closed defect (fixed)

Change in bayer dithering output in paletteuse

Reported by: llogan Owned by:
Priority: important Component: avfilter
Version: git-master Keywords: paletteuse regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

aba926e7d654b6dfab680130c92e571ee9a956f0 changed the output when using dither=bayer:bayer_scale=0. Other bayer_scale values and dithering modes appear not to be affected.

Create palette:

$ ffmpeg -i ../fate-suite/h264/lossless.h264 -filter_complex palettegen palette.png
ffmpeg version N-92681-g0e833f615b Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181127
  configuration: 
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 42.100 / 58. 42.100
  libavformat    58. 24.100 / 58. 24.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
Input #0, h264, from '../fate-suite/h264/lossless.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv420p(progressive), 640x480, 60 fps, 60 tbr, 1200k tbn, 120 tbc
Stream mapping:
  Stream #0:0 (h264) -> palettegen
  palettegen -> Stream #0:0 (png)
Press [q] to stop, [?] for help
Output #0, image2, to 'palette.png':
  Metadata:
    encoder         : Lavf58.24.100
    Stream #0:0: Video: png, rgba, 16x16 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.42.100 png
[Parsed_palettegen_0 @ 0x557cb7bab3c0] 255(+1) colors generated out of 75404 colors; ratio=0.003382
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.01 bitrate=N/A speed=0.127x    
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Create GIF:

ffmpeg -i ../fate-suite/h264/lossless.h264 -i palette.png -filter_complex paletteuse=dither=bayer:bayer_scale=0 output.gif
ffmpeg version N-92681-g0e833f615b Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181127
  configuration: 
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 42.100 / 58. 42.100
  libavformat    58. 24.100 / 58. 24.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
Input #0, h264, from '../fate-suite/h264/lossless.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv420p(progressive), 640x480, 60 fps, 60 tbr, 1200k tbn, 120 tbc
Input #1, png_pipe, from 'palette.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (h264) -> paletteuse:default
  Stream #1:0 (png) -> paletteuse:palette
  paletteuse -> Stream #0:0 (gif)
Press [q] to stop, [?] for help
Output #0, gif, to 'output.gif':
  Metadata:
    encoder         : Lavf58.24.100
    Stream #0:0: Video: gif, pal8, 640x480, q=2-31, 200 kb/s, 60 fps, 100 tbn, 60 tbc (default)
    Metadata:
      encoder         : Lavc58.42.100 gif
frame=   10 fps=0.0 q=-0.0 Lsize=    1120kB time=00:00:00.18 bitrate=50983.6kbits/s speed=0.542x    
video:1119kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.076859%

Compare hashes:

$ ./ffmpeg -v error -i output-master.gif -f hash -hash md5 -
MD5=ab06399b69365047f68745fb6dc22a94

$ ./ffmpeg -v error -i output-8518294.gif -f hash -hash md5 -
MD5=52047bc0e9a4a6961127832844f925cc

Change is visually obvious. Reported by user Mithgol.

Change History (2)

comment:1 by Carl Eugen Hoyos, 5 years ago

Keywords: regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen

Safe to say that the output did not improve.

comment:2 by Elon Musk, 2 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.