[FFmpeg-trac] #8529(avfilter:new): the ssim_c1 has bug in vf_ssim.c

FFmpeg trac at avcodec.org
Mon Feb 17 03:41:30 EET 2020


#8529: the ssim_c1 has bug in vf_ssim.c
-------------------------------------+-------------------------------------
             Reporter:  wangwei1237  |                     Type:  defect
               Status:  new          |                 Priority:  important
            Component:  avfilter     |                  Version:  git-
                                     |  master
             Keywords:  ssim_c1      |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 I'm learning the SSIM, and I find FFMpeg provides this capability in the
 vf_ssim.c and tiny_ssim.c. I analyzed the code of the tiny_ssim.c and find
 a bug for the define of the '''ssim_c1''' variable in the
 ssim_end1() function.

 I recalculate the mathematical formula of SSIM according to the algorithm
 of tiny_ssim, and get the following formula:

 SSIM(x,y)=((2*s1*s2+64*64*C1)(2*(64*s12-s1*s2)+64*63*C2))/((s1*s1+s2*s2+64*64*C1)(64*ss-s1*s1-s2*s2+64*63*C2))

 Thus the ssim_c1 shoule be (.01*.01*PIXEL_MAX*PIXEL_MAX*64'''*64''' + .5)
 instead of ssim_c1 = (int)(.01*.01*PIXEL_MAX*PIXEL_MAX*64 + .5).

 How to reproduce:
 {{{
 static const int ssim_c1 = (int)(.01*.01*PIXEL_MAX*PIXEL_MAX*64*64 + .5);
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8529>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list