[FFmpeg-devel] [PATCH V2 2/2] lavfi/opencl: add nlmeans_opencl filter

Mark Thompson sw at jkqxz.net
Wed Apr 17 00:28:12 EEST 2019


On 12/04/2019 16:09, Ruiling Song wrote:
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>

I can't work out where the problem is, but there is something really weirdly nondeterministic going on here.

E.g.

$ ./ffmpeg_g -y -init_hw_device opencl:0.0 -i ~/video/test/jellyfish-120-mbps-4k-uhd-hevc-10bit.mkv -an -filter_hw_device opencl0 -vf format=yuv420p,hwupload,nlmeans_opencl,hwdownload,format=yuv420p -frames:v 10 -f framemd5 -
...
0,          0,          0,        1, 12441600, 8b8805818076b23ae6f80ec2b5a349d4
0,          1,          1,        1, 12441600, 7a7fdaa083dc337cfb6af31b643f30a3
0,          2,          2,        1, 12441600, b10ef2a1e5125cc67e262e086f8040b5
0,          3,          3,        1, 12441600, c06b53ad90e0357e537df41b63d5b1dc
0,          4,          4,        1, 12441600, 5aa2da07703859a3dee080847dd17d46
0,          5,          5,        1, 12441600, 733364c6be6af825057e905a6092937d
0,          6,          6,        1, 12441600, 47edae2dec956a582b04babb745d26b0
0,          7,          7,        1, 12441600, 4e45fe8268df4298d06a17ab8e46c3e9
0,          8,          8,        1, 12441600, 960d722a3f8787c9191299a114c04174
0,          9,          9,        1, 12441600, e759c07ee4834a9cf94bfcb4128e7612
$ ./ffmpeg_g -y -init_hw_device opencl:0.0 -i ~/video/test/jellyfish-120-mbps-4k-uhd-hevc-10bit.mkv -an -filter_hw_device opencl0 -vf format=yuv420p,hwupload,nlmeans_opencl,hwdownload,format=yuv420p -frames:v 10 -f framemd5 -
0,          0,          0,        1, 12441600, 8b8805818076b23ae6f80ec2b5a349d4
[Parsed_nlmeans_opencl_2 @ 0x5557ae580d00] integral image overflow 2157538
0,          1,          1,        1, 12441600, bce72e10a9f1118940c5a8392ad78ec3
0,          2,          2,        1, 12441600, b10ef2a1e5125cc67e262e086f8040b5
0,          3,          3,        1, 12441600, c06b53ad90e0357e537df41b63d5b1dc
0,          4,          4,        1, 12441600, 5aa2da07703859a3dee080847dd17d46
0,          5,          5,        1, 12441600, 733364c6be6af825057e905a6092937d
0,          6,          6,        1, 12441600, 47edae2dec956a582b04babb745d26b0
0,          7,          7,        1, 12441600, 4e45fe8268df4298d06a17ab8e46c3e9
0,          8,          8,        1, 12441600, 960d722a3f8787c9191299a114c04174
0,          9,          9,        1, 12441600, e759c07ee4834a9cf94bfcb4128e7612
$ ./ffmpeg_g -y -init_hw_device opencl:0.0 -i ~/video/test/jellyfish-120-mbps-4k-uhd-hevc-10bit.mkv -an -filter_hw_device opencl0 -vf format=yuv420p,hwupload,nlmeans_opencl,hwdownload,format=yuv420p -frames:v 10 -f framemd5 -
0,          0,          0,        1, 12441600, 8b8805818076b23ae6f80ec2b5a349d4
0,          1,          1,        1, 12441600, 7a7fdaa083dc337cfb6af31b643f30a3
[Parsed_nlmeans_opencl_2 @ 0x557c51fbfe80] integral image overflow 2098545
0,          2,          2,        1, 12441600, 68b390535adc5cfa0f8a7942c42a47ca
0,          3,          3,        1, 12441600, c06b53ad90e0357e537df41b63d5b1dc
0,          4,          4,        1, 12441600, 5aa2da07703859a3dee080847dd17d46
0,          5,          5,        1, 12441600, 733364c6be6af825057e905a6092937d
0,          6,          6,        1, 12441600, 47edae2dec956a582b04babb745d26b0
0,          7,          7,        1, 12441600, 4e45fe8268df4298d06a17ab8e46c3e9
0,          8,          8,        1, 12441600, 960d722a3f8787c9191299a114c04174
0,          9,          9,        1, 12441600, e759c07ee4834a9cf94bfcb4128e7612

Frame 1 gave an overflow on the second run, and gets a different answer, then frame 2 in the same way on the third run?  I can't characterise when this happens, it seems to be pretty random with low probability.

(Input here is a 4K file from <http://jell.yfish.us/>, but I don't think it matters - I saw it with others sometimes as well.)

>  configure                       |   1 +
>  doc/filters.texi                |   4 +
>  libavfilter/Makefile            |   1 +
>  libavfilter/allfilters.c        |   1 +
>  libavfilter/opencl/nlmeans.cl   | 115 +++++++++
>  libavfilter/opencl_source.h     |   1 +
>  libavfilter/vf_nlmeans_opencl.c | 442 ++++++++++++++++++++++++++++++++
>  7 files changed, 565 insertions(+)
>  create mode 100644 libavfilter/opencl/nlmeans.cl
>  create mode 100644 libavfilter/vf_nlmeans_opencl.c

Code all looks fine, as far as I can tell.

Thanks,

- Mark


More information about the ffmpeg-devel mailing list