[FFmpeg-user] remap filter, unmapped pixels

Paul B Mahol onemda at gmail.com
Thu Feb 20 14:17:19 EET 2020


On 2/20/20, Michael Koch <astroelectronic at t-online.de> wrote:
> Am 20.02.2020 um 12:49 schrieb Paul B Mahol:
>> On 2/20/20, Michael Koch <astroelectronic at t-online.de> wrote:
>>> Am 20.02.2020 um 11:07 schrieb Paul B Mahol:
>>>> On 2/20/20, Michael Koch <astroelectronic at t-online.de> wrote:
>>>>> I'd like to understand how the new "fill" option in the remap filter
>>>>> works.
>>>>> What is an "unmapped pixel"? How is it possible that pixels are
>>>>> unmapped, if the xmap and ymap files have the same size as the output
>>>>> image? Is a pixel "unmapped" if it has invalid coordinates (negative or
>>>>> too big) in the xmap or ymap files?
>>>> Previously all unmapped pixels were set to black for rgba or dark
>>>> green for y420p.
>>>> It is very obvious to understand even for every little kid in the block.
>>> Finally I got it working. A pixel can be declared as "unmapped" by
>>> setting the values to 65535 in the xmap and ymap files. However using a
>>> negative value (for example -1) doesn't work. In this case the pixel is
>>> mapped to the top left pixel of the input image.
>>> This behaviour might be obvious for little kids, but not for me. Should
>>> be added to documentation.
>> Nope. Documentation does not need trivial information.
>> Obviously by having even limited programming experience one would
>> found out that remaps are unsigned short, thus can not be negative.
>> You never showed your map files. so I assume everything is wrong on
>> your end.
>
> This is an example that produces a crash abort in the third command
> line. All pixels are mapped to themselves, except pixel (1,1) which is
> mapped to (65535,65535)
>
> c:\ffmpeg\ffmpeg -f lavfi -i nullsrc=size=20x20 -vf
> format=pix_fmts=gray16le,geq='if(bitand(eq(X,1),eq(Y,1)),65535,X)'
> -frames 1 -y xmap.pgm
> c:\ffmpeg\ffmpeg -f lavfi -i nullsrc=size=20x20 -vf
> format=pix_fmts=gray16le,geq='if(bitand(eq(X,1),eq(Y,1)),65535,Y)'
> -frames 1 -y ymap.pgm
> c:\ffmpeg\ffmpeg -f lavfi -i color=blue:size=20x20 -i xmap.pgm -i
> ymap.pgm -lavfi "format=pix_fmts=rgb24,remap=fill=red" -frames 1 -y out.png
>
> Console output for third command line:
>
> F:\Wormhole_2020>c:\ffmpeg\ffmpeg -f lavfi -i color=blue:size=20x20 -i
> xmap.pgm
> -i ymap.pgm -lavfi "format=pix_fmts=rgb24,remap=fill=red" -frames 1 -y
> out.png
> ffmpeg version git-2020-02-18-ebee808 Copyright (c) 2000-2020 the FFmpeg
> develop
> ers
>    built with gcc 9.2.1 (GCC) 20200122
>    configuration: --enable-gpl --enable-version3 --enable-sdl2
> --enable-fontconfi
> g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d
> --enable-libb
> luray --enable-libfreetype --enable-libmp3lame
> --enable-libopencore-amrnb --enab
> le-libopencore-amrwb --enable-libopenjpeg --enable-libopus
> --enable-libshine --e
> nable-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 --enab
> le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
> --enable-libmysofa --en
> able-libspeex --enable-libxvid --enable-libaom --enable-libmfx
> --enable-ffnvcode
> c --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec
> --enable-dxva2 -
> -enable-avisynth --enable-libopenmpt --enable-amf
>    libavutil      56. 41.100 / 56. 41.100
>    libavcodec     58. 70.100 / 58. 70.100
>    libavformat    58. 38.101 / 58. 38.101
>    libavdevice    58.  9.103 / 58.  9.103
>    libavfilter     7. 76.100 /  7. 76.100
>    libswscale      5.  6.100 /  5.  6.100
>    libswresample   3.  6.100 /  3.  6.100
>    libpostproc    55.  6.100 / 55.  6.100
> Input #0, lavfi, from 'color=blue:size=20x20':
>    Duration: N/A, start: 0.000000, bitrate: N/A
>      Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 20x20
> [SAR 1:1 DA
> R 1:1], 25 tbr, 25 tbn, 25 tbc
> Input #1, pgm_pipe, from 'xmap.pgm':
>    Duration: N/A, bitrate: N/A
>      Stream #1:0: Video: pgm, gray16le, 20x20, 25 tbr, 25 tbn, 25 tbc
> Input #2, pgm_pipe, from 'ymap.pgm':
>    Duration: N/A, bitrate: N/A
>      Stream #2:0: Video: pgm, gray16le, 20x20, 25 tbr, 25 tbn, 25 tbc
> Stream mapping:
>    Stream #0:0 (rawvideo) -> format
>    Stream #1:0 (pgm) -> remap:xmap
>    Stream #2:0 (pgm) -> remap:ymap
>    remap -> Stream #0:0 (png)
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

==5391== Process terminating with default action of signal 11 (SIGSEGV)
==5391==  General Protection Fault
==5391==    at 0x7F95723: ??? (libswscale/x86/yuv_2_rgb.asm:376)
==5391==    by 0x7F938A6: yuv420_rgb24_ssse3 (yuv2rgb_template.c:177)
==5391==    by 0x7F48565: sws_scale (swscale.c:978)
==5391==    by 0x52FD417: scale_slice (vf_scale.c:646)
==5391==    by 0x52FD417: scale_frame (vf_scale.c:808)
==5391==    by 0x52FD417: filter_frame (vf_scale.c:822)
==5391==    by 0x51A3A50: ff_filter_frame_framed (avfilter.c:1066)
==5391==    by 0x51A3A50: ff_filter_frame_to_filter (avfilter.c:1214)
==5391==    by 0x51A3A50: ff_filter_activate_default (avfilter.c:1263)
==5391==    by 0x51A3A50: ff_filter_activate (avfilter.c:1425)
==5391==    by 0x51A7FFA: ff_filter_graph_run_once (avfiltergraph.c:1456)
==5391==    by 0x51AA417: push_frame (buffersrc.c:184)
==5391==    by 0x51AA417: av_buffersrc_add_frame_internal (buffersrc.c:247)
==5391==    by 0x51A9E7D: av_buffersrc_add_frame_flags (buffersrc.c:167)
==5391==    by 0x1373F6: ifilter_send_frame (ffmpeg.c:2188)
==5391==    by 0x1373F6: send_frame_to_filters (ffmpeg.c:2262)
==5391==    by 0x131666: decode_video (ffmpeg.c:2461)
==5391==    by 0x131666: process_input_packet (ffmpeg.c:2615)
==5391==    by 0x12DCB5: process_input (ffmpeg.c:4509)
==5391==    by 0x12DCB5: transcode_step (ffmpeg.c:4629)
==5391==    by 0x12DCB5: transcode (ffmpeg.c:4683)
==5391==    by 0x129982: main (ffmpeg.c:4885)
==5391==

This is caused by recently added ssse3 path for rgb24 conversion in swscale.

Can you take a look?


More information about the ffmpeg-user mailing list