Opened 7 years ago

Closed 7 weeks ago

#1261 closed defect (fixed)

yellowish color with resize and -pix_fmt pal8

Reported by: ami_stuff Owned by:
Priority: normal Component: swscale
Version: git-master Keywords: pal8
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

not reproducible with -pix_fmt bgr24

C:\>ffmpeg -i 1023.bmp -s 1024x767 -pix_fmt pal8 out.bmp
ffmpeg version N-40172-g28c5775 Copyright (c) 2000-2012 the FFmpeg developers
  built on Apr 28 2012 02:21:26 with gcc 4.5.0 20100414 (Fedora MinGW 4.5.0-1.fc
14)
  configuration: --prefix=/var/www/users/research/ffmpeg/snapshots/build --arch=
x86 --target-os=mingw32 --cross-prefix=i686-pc-mingw32- --cc='ccache i686-pc-min
gw32-gcc' --enable-w32threads --enable-memalign-hack --enable-runtime-cpudetect
--enable-cross-compile --enable-static --disable-shared --extra-libs='-lws2_32 -
lwinmm' --extra-cflags='--static -I/var/www/users/research/ffmpeg/snapshots/buil
d/include' --extra-ldflags='-static -L/var/www/users/research/ffmpeg/snapshots/b
uild/lib' --enable-bzlib --enable-zlib --enable-gpl --enable-version3 --enable-n
onfree --enable-libx264 --enable-libspeex --enable-libtheora --enable-libvorbis
--enable-libfaac --enable-libxvid --enable-libopencore-amrnb --enable-libopencor
e-amrwb --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx
  libavutil      51. 48.100 / 51. 48.100
  libavcodec     54. 16.100 / 54. 16.100
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.100 /  2. 72.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, image2, from '1023.bmp':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: bmp, pal8, 1023x767, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x1dc1fc0] w:1023 h:767 pixfmt:pal8 tb:1/1000000 sar:0/1 sws_param:fla
gs=2
[scale @ 0x1dc2180] w:1023 h:767 fmt:pal8 sar:0/1 -> w:1024 h:767 fmt:pal8 sar:0
/1 flags:0x4
Output #0, image2, to 'out.bmp':
  Metadata:
    encoder         : Lavf54.3.100
    Stream #0:0: Video: bmp, pal8, 1024x767, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (bmp -> bmp)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.04 bitrate=   0.0kbits/
s
video:768kB audio:0kB global headers:0kB muxing overhead -100.000000%

Attachments (2)

1023.bmp (95.9 KB) - added by ami_stuff 7 years ago.
ffmpeg-20190401-103841.7z (5.7 KB) - added by gdgsdg123 7 weeks ago.

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by ami_stuff

comment:1 Changed 6 years ago by cehoyos

The md5sum for out.bmp is identical for 0.11, 1.0 and current git head: 9f7c293e0940a372c6d897d769b110d4

ffplay out.bmp -fs shows no yellowish colour, several other display methods (gimp, xv, ImageMagick?, ffplay without -fs) show some distortion.

comment:2 follow-up: Changed 6 years ago by richardpl

  • Component changed from undetermined to swscale
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from unspecified to git-master

Input palette is black and white only, while output rgb24 pam/bmp is not any more black and white only.

comment:3 in reply to: ↑ 2 Changed 6 years ago by cehoyos

Replying to richardpl:

Input palette is black and white only, while output rgb24 pam/bmp is not any more black and white only.

Could you elaborate? The sample command line only produces pal8 output.

comment:4 Changed 6 years ago by richardpl

Sorry, it also happens when going from pal8->pal8. Just add logs to dump palette entries to lavc/bmp.c

comment:5 Changed 7 weeks ago by gdgsdg123

  • Keywords swscale pal8 added

Encountered similar situation when performing a different task...

Build from: https://ffmpeg.zeranoe.com/builds/win64/static/win64/static/ffmpeg-20190330-52d8f35-win64-static.zip

ffmpeg started on 2019-04-01 at 10:38:41
Report written to "ffmpeg-20190401-103841.log"
Command line:
ffmpeg -report -i "C:\\Image-before-scaling.png" -pix_fmt pal8 -sws_flags bicubic+accurate_rnd -vf "scale=iw*2:ih*2" bicubic_text.png
ffmpeg version N-93488-g52d8f35b14 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.106 / 58. 47.106
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument 'C:\Image-before-scaling.png'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'pal8'.
Reading option '-sws_flags' ... matched as AVOption 'sws_flags' with argument 'bicubic+accurate_rnd'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=iw*2:ih*2'.
Reading option 'bicubic_text.png' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:\Image-before-scaling.png.
Successfully parsed a group of options.
Opening an input file: C:\Image-before-scaling.png.
[NULL @ 00000000004f1a80] Opening 'C:\Image-before-scaling.png' for reading
[file @ 00000000004f3480] Setting default whitelist 'file,crypto'
[png_pipe @ 00000000004f1a80] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 00000000004f1a80] Before avformat_find_stream_info() pos: 0 bytes read:716 seeks:0 nb_streams:1
[png_pipe @ 00000000004f1a80] After avformat_find_stream_info() pos: 716 bytes read:716 seeks:0 frames:1
Input #0, png_pipe, from 'C:\Image-before-scaling.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: png, pal8(pc), 109x40, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output url bicubic_text.png.
Applying option pix_fmt (set pixel format) with argument pal8.
Applying option vf (set video filters) with argument scale=iw*2:ih*2.
Successfully parsed a group of options.
Opening an output file: bicubic_text.png.
Successfully opened the file.
detected 16 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> png (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[Parsed_scale_0 @ 000000000296f000] Setting 'w' to value 'iw*2'
[Parsed_scale_0 @ 000000000296f000] Setting 'h' to value 'ih*2'
[Parsed_scale_0 @ 000000000296f000] Setting 'flags' to value 'bicubic'
[Parsed_scale_0 @ 000000000296f000] Setting 'sws_flags' to value 'bicubic+accurate_rnd'
[Parsed_scale_0 @ 000000000296f000] w:iw*2 h:ih*2 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0000000002970300] Setting 'video_size' to value '109x40'
[graph 0 input from stream 0:0 @ 0000000002970300] Setting 'pix_fmt' to value '11'
[graph 0 input from stream 0:0 @ 0000000002970300] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 0000000002970300] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0000000002970300] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0000000002970300] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0000000002970300] w:109 h:40 pixfmt:pal8 tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[format @ 000000000297a340] Setting 'pix_fmts' to value 'pal8'
[AVFilterGraph @ 000000000296e9c0] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[swscaler @ 000000000297a840] Forcing full internal H chroma due to input having non subsampled chroma
[Parsed_scale_0 @ 000000000296f000] w:109 h:40 fmt:pal8 sar:0/1 -> w:218 h:80 fmt:pal8 sar:0/1 flags:0x4
Output #0, image2, to 'bicubic_text.png':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0, 0, 1/25: Video: png, pal8, 218x80, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.47.106 png
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[out_0_0 @ 000000000297a180] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
[image2 @ 00000000004f35c0] Opening 'bicubic_text.png' for writing
[file @ 000000000299dc00] Setting default whitelist 'file,crypto'
[AVIOContext @ 000000000a500780] Statistics: 0 seeks, 1 writeouts
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed= 2.5x
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (C:\Image-before-scaling.png):
  Input stream #0:0 (video): 1 packets read (716 bytes); 1 frames decoded;
  Total: 1 packets (716 bytes) demuxed
Output file #0 (bicubic_text.png):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (3380 bytes);
  Total: 1 packets (3380 bytes) muxed
1 frames successfully decoded, 0 decoding errors
[AVIOContext @ 00000000004fb700] Statistics: 716 bytes read, 0 seeks

Files attached.

Reference group from: https://en.wikipedia.org/wiki/Comparison_gallery_of_image_scaling_algorithms

Changed 7 weeks ago by gdgsdg123

comment:6 Changed 7 weeks ago by cehoyos

  • Keywords swscale removed
  • Resolution set to fixed
  • Status changed from open to closed

The original issue was fixed by Michael in a830915b78e2d96f08dc93b2d1c4330448b83ffd, see ticket #3028, work-around was to force full_chroma_int.

comment:7 Changed 7 weeks ago by gdgsdg123

  • Resolution fixed deleted
  • Status changed from closed to reopened

Build from: https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20190331-27c94c5-win64-static.zip

ffmpeg -report -i "C:\Image-before-scaling.png" -pix_fmt pal8 -sws_flags bicubic+accurate_rnd+full_chroma_int -vf scale=iw*2:ih*2 bicubic_text.png

gives bitexact result... (bitexact as previous)



Previous command:

ffmpeg -report -i "C:\Image-before-scaling.png" -pix_fmt pal8 -sws_flags bicubic+accurate_rnd -vf scale=iw*2:ih*2 bicubic_text.png






Log:

ffmpeg started on 2019-04-02 at 04:40:24
Report written to "ffmpeg-20190402-044024.log"
Command line:
ffmpeg -report -i "C:\\Image-before-scaling.png" -pix_fmt pal8 -sws_flags bicubic+accurate_rnd+full_chroma_int -vf "scale=iw*2:ih*2" bicubic_text.png
ffmpeg version N-93506-g27c94c57dc Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.100 / 58. 48.100
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument 'C:\Image-before-scaling.png'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'pal8'.
Reading option '-sws_flags' ... matched as AVOption 'sws_flags' with argument 'bicubic+accurate_rnd+full_chroma_int'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=iw*2:ih*2'.
Reading option 'bicubic_text.png' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:\Image-before-scaling.png.
Successfully parsed a group of options.
Opening an input file: C:\Image-before-scaling.png.
[NULL @ 0000000000501a00] Opening 'C:\Image-before-scaling.png' for reading
[file @ 00000000005033c0] Setting default whitelist 'file,crypto'
[png_pipe @ 0000000000501a00] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0000000000501a00] Before avformat_find_stream_info() pos: 0 bytes read:716 seeks:0 nb_streams:1
[png_pipe @ 0000000000501a00] After avformat_find_stream_info() pos: 716 bytes read:716 seeks:0 frames:1
Input #0, png_pipe, from 'C:\Image-before-scaling.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: png, pal8(pc), 109x40, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output url bicubic_text.png.
Applying option pix_fmt (set pixel format) with argument pal8.
Applying option vf (set video filters) with argument scale=iw*2:ih*2.
Successfully parsed a group of options.
Opening an output file: bicubic_text.png.
Successfully opened the file.
detected 16 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> png (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[Parsed_scale_0 @ 0000000002a4dcc0] Setting 'w' to value 'iw*2'
[Parsed_scale_0 @ 0000000002a4dcc0] Setting 'h' to value 'ih*2'
[Parsed_scale_0 @ 0000000002a4dcc0] Setting 'flags' to value 'bicubic'
[Parsed_scale_0 @ 0000000002a4dcc0] Setting 'sws_flags' to value 'bicubic+accurate_rnd+full_chroma_int'
[Parsed_scale_0 @ 0000000002a4dcc0] w:iw*2 h:ih*2 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0000000002a4efc0] Setting 'video_size' to value '109x40'
[graph 0 input from stream 0:0 @ 0000000002a4efc0] Setting 'pix_fmt' to value '11'
[graph 0 input from stream 0:0 @ 0000000002a4efc0] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 0000000002a4efc0] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0000000002a4efc0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0000000002a4efc0] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0000000002a4efc0] w:109 h:40 pixfmt:pal8 tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[format @ 0000000002a59440] Setting 'pix_fmts' to value 'pal8'
[AVFilterGraph @ 0000000002a4d600] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[Parsed_scale_0 @ 0000000002a4dcc0] w:109 h:40 fmt:pal8 sar:0/1 -> w:218 h:80 fmt:pal8 sar:0/1 flags:0x4
Output #0, image2, to 'bicubic_text.png':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0, 0, 1/25: Video: png, pal8, 218x80, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.48.100 png
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[out_0_0 @ 0000000002a59280] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
[image2 @ 0000000000503500] Opening 'bicubic_text.png' for writing
[file @ 0000000002a80bc0] Setting default whitelist 'file,crypto'
[AVIOContext @ 000000000a329900] Statistics: 0 seeks, 1 writeouts
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=4.44x    
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (C:\Image-before-scaling.png):
  Input stream #0:0 (video): 1 packets read (716 bytes); 1 frames decoded; 
  Total: 1 packets (716 bytes) demuxed
Output file #0 (bicubic_text.png):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (3380 bytes); 
  Total: 1 packets (3380 bytes) muxed
1 frames successfully decoded, 0 decoding errors
[AVIOContext @ 000000000050b640] Statistics: 716 bytes read, 0 seeks



Highlight:

[swscaler @ 000000000297a840] Forcing full internal H chroma due to input having non subsampled chroma

is missing. (comparing to previous log)


Which implied full_chroma_int are set in both operations.





Off-topic:
What's the difference between full_chroma_int and full_chroma_inp?..
And their relationship? (dependencies, etc...)

comment:8 follow-up: Changed 7 weeks ago by cehoyos

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:9 in reply to: ↑ 8 Changed 7 weeks ago by gdgsdg123

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to cehoyos:

Build from: https://zeranoe.com/builds/win64/static/ffmpeg-20190402-6aeaac3-win64-static.zip


Not fixed.

Check carefully (zoom 800%), comparing to the reference group from: https://en.wikipedia.org/wiki/Comparison_gallery_of_image_scaling_algorithms

Or change the -pix_fmt pal8 from the above command to -pix_fmt rgb24 then render one, compare them.

comment:10 Changed 7 weeks ago by cehoyos

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.