Opened 2 years ago

Last modified 6 days ago

#9740 new defect

Problem in geq filter if height=1

Reported by: Michael Koch Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The geq filter doesn't work correctly if the height of the frame is 1.

Make a 8x1 test image:

ffmpeg -f lavfi -i haldclutsrc=2 -vf crop=iw:1 -frames 1 -y test.png

Print the red values of all pixels in the console output:

ffmpeg -loglevel repeat -i test.png -vf geq=r='print(r(X,Y))' -threads 1 -f null NUL

The printed values are all zero, which is obviously wrong.
However if the height of the image is 2 or larger, then it works as expected.
I did already try to force the pixel format to rgb24, but that didn't help.

C:\Users\astro\Desktop\clut>ffmpeg -loglevel repeat -i test.png -vf geq=r='print(r(X,Y))' -threads 1 -f null NUL
ffmpeg version 2022-04-18-git-d5687236ab-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers

built with gcc 11.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 57. 24.101 / 57. 24.101
libavcodec 59. 26.100 / 59. 26.100
libavformat 59. 22.100 / 59. 22.100
libavdevice 59. 6.100 / 59. 6.100
libavfilter 8. 33.100 / 8. 33.100
libswscale 6. 6.100 / 6. 6.100
libswresample 4. 6.100 / 4. 6.100
libpostproc 56. 5.100 / 56. 5.100

Input #0, png_pipe, from 'test.png':

Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 8x1 [SAR 1:1 DAR 8:1], 25 fps, 25 tbr, 25 tbn

Stream mapping:

Stream #0:0 -> #0:0 (png (native) -> wrapped_avframe (native))

Press [q] to stop, ? for help
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
Output #0, null, to 'NUL':

Metadata:

encoder : Lavf59.22.100

Stream #0:0: Video: wrapped_avframe, gbrp(pc, gbr/unknown/unknown, progressive), 8x1 [SAR 1:1 DAR 8:1], q=2-31, 200 kb/s, 25 fps, 25 tbn

Metadata:

encoder : Lavc59.26.100 wrapped_avframe

frame= 1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=2.85x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown


Change History (4)

comment:1 by Michael Koch, 2 years ago

I've seen other cases where the printed values aren't zero, but random numbers. It seems the wrong memory is accessed.

comment:2 by Michael Koch, 7 days ago

Adding "filter_threads 1" or adding ":threads=1" as option to the geq filter doesn't fix the problem. All printed values are 0, which is obviously wrong. If the height of the image is changed to 2, then the printed values are correct.

ffmpeg -f lavfi -i haldclutsrc=2 -vf crop=iw:1 -frames 1 -y test.png
ffmpeg -loglevel repeat -i test.png -filter_threads 1 -vf geq=r='print(r(X,Y))' -f null NUL
ffmpeg -loglevel repeat -i test.png -vf geq=r='print(r(X,Y))':threads=1 -f null NUL

comment:3 by Michael Koch, 7 days ago

Same problem also if the width of the frame is 1.

comment:4 by MasterQuestionable, 6 days ago

͏    Seemingly related:
͏    "color" video source fails to handle "size=1x1"?
͏    https://trac.ffmpeg.org/ticket/10989

Note: See TracTickets for help on using tickets.