[FFmpeg-trac] #7825(avfilter:closed): Malfunctioning `ssim` filter?..

FFmpeg trac at avcodec.org
Thu Jan 30 18:55:45 EET 2020


#7825: Malfunctioning `ssim` filter?..
------------------------------------+------------------------------------
             Reporter:  gdgsdg123   |                    Owner:
                 Type:  defect      |                   Status:  closed
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:  invalid
             Keywords:  ssim        |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by pdr0):

 Could it be a rounding issue?  decimal places / precision ? If the value
 in parenthesis is the dB representation of All value, and values are
 rounded to 6 decimal could that be the issue ?


 Repeating the tests at different resolutions eg. 1280x720, 1920x1080,
 etc...  all with 1 pixel @0,0 as RGB [1,0,0]

 At some point, between 1280x800 and 1200x1000 ffmpeg ssim does not detect
 the difference (inf). It calculates 1280x720 and 1280x800 versions as the
 same values, where PSNR determines them as different

 -----
 ffmpeg -i "1280x720_1.png" -i "1280x720_0.png" -lavfi "ssim;[0][1]psnr" -f
 null -

 [Parsed_ssim_0 @ 0000006362f0f900] SSIM R:1.000000 (72.247199) G:1.000000
 (inf)
 B:1.000000 (inf) All:1.000000 (inf)
 [Parsed_psnr_1 @ 0000006362f16ac0] PSNR r:107.776228 g:inf b:inf
 average:112.547
 441 min:112.547441 max:112.547441

 -----
 ffmpeg -i "1280x800_1.png" -i "1280x800_0.png" -lavfi "ssim;[0][1]psnr" -f
 null -

 [Parsed_ssim_0 @ 0000004e6a813700] SSIM R:1.000000 (72.247199) G:1.000000
 (inf)
 B:1.000000 (inf) All:1.000000 (inf)
 [Parsed_psnr_1 @ 0000004e6a83e780] PSNR r:108.233803 g:inf b:inf
 average:113.005
 016 min:113.005016 max:113.005016

 -----
 ffmpeg -i "1200x1000_1.png" -i "1200x1000_0.png" -lavfi "ssim;[0][1]psnr"
 -f null -

 [Parsed_ssim_0 @ 00000076083dc340] SSIM R:1.000000 (inf) G:1.000000 (inf)
 B:1.00
 0000 (inf) All:1.000000 (inf)
 [Parsed_psnr_1 @ 00000076083dcfc0] PSNR r:108.922616 g:inf b:inf
 average:113.693
 829 min:113.693829 max:113.693829

 -----
 ffmpeg -i "1440x1080_1.png" -i "1440x1080_0.png" -lavfi "ssim;[0][1]psnr"
 -f null -

 [Parsed_ssim_0 @ 000000930607e6c0] SSIM R:1.000000 (inf) G:1.000000 (inf)
 B:1.00
 0000 (inf) All:1.000000 (inf)
 [Parsed_psnr_1 @ 0000009306071340] PSNR r:110.048666 g:inf b:inf
 average:114.819
 879 min:114.819879 max:114.819879

 -----
 ffmpeg -i "1920x1080_1.png" -i "1920x1080_0.png" -lavfi "ssim;[0][1]psnr"
 -f null -

 [Parsed_ssim_0 @ 0000003f50d34e80] SSIM R:1.000000 (inf) G:1.000000 (inf)
 B:1.00
 0000 (inf) All:1.000000 (inf)
 [Parsed_psnr_1 @ 0000003f50d3cd80] PSNR r:111.298053 g:inf b:inf
 average:116.069
 266 min:116.069266 max:116.069266
 -----



 vapoursynth ssim can detect the differences, but it carries more decimal
 places

 vapoursynth ssim (no downsample, but enable downsample also detects the
 difference)
 3840x2160
 0.9999999975397562135270845828927122056484222412109375

 1920x1080
 0.99999999015902474308603586905519478023052215576171875

 1280x720
 0.99999997785780581072145878351875580847263336181640625

 self test @ 1920x1080 (to check validity)
 1





 There are different variations of SSIM calculations - some use different
 window sizes, some downsample (as suggested in original ssim paper), some
 apply gaussian filter (slower), some a box blur (faster)

 https://github.com/FFmpeg/FFmpeg/blob/master/libavfilter/vf_ssim.c

 {{{

  * To improve speed, this implementation uses the standard approximation
 of
  * overlapped 8x8 block sums, rather than the original gaussian weights.
 }}}



 Could this "speed" implementation be contributing to the issue?

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7825#comment:10>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list