This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/9.0
in repository ffmpeg.

commit 3257728c6179b41689642b841ce45c42fa5054ce
Author:     Kenan Alghythee <[email protected]>
AuthorDate: Sat Jul 11 16:53:41 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Aug 2 02:47:29 2026 +0200

    avfilter/vf_xpsnr: avoid a zero block size on small frames
    
    Fixes: division by zero
    Fixes: SUcVEyk7r3Gc
    Found-by: Kenan Alghythee <[email protected]>
    (cherry picked from commit 06fd4fd0e787e819fd697dc687efe7f7eae798c8)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavfilter/vf_xpsnr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_xpsnr.c b/libavfilter/vf_xpsnr.c
index 34c875456e..89f4f279ba 100644
--- a/libavfilter/vf_xpsnr.c
+++ b/libavfilter/vf_xpsnr.c
@@ -273,7 +273,7 @@ static int get_wsse(AVFilterContext *ctx, int16_t **org, 
int16_t *org_m1,
     const uint32_t       w = s->plane_width [0]; /* luma image width in pixels 
*/
     const uint32_t       h = s->plane_height[0];/* luma image height in pixels 
*/
     const double         r = (double)(w * h) / (3840.0 * 2160.0); /* UHD ratio 
*/
-    const uint32_t       b = FFMAX(0, 4 * (int32_t) (32.0 * sqrt(r) +
+    const uint32_t       b = FFMAX(1, 4 * (int32_t) (32.0 * sqrt(r) +
                                                      0.5)); /* block size, 
integer multiple of 4 for SIMD */
     const uint32_t   w_blk = (w + b - 1) / b; /* luma width in units of blocks 
*/
     const double   avg_act = sqrt(16.0 * (double) (1 << (2 * s->depth - 9)) / 
sqrt(FFMAX(0.00001,
@@ -399,7 +399,7 @@ static int do_xpsnr(FFFrameSync *fs)
     XPSNRContext *const s = ctx->priv;
     const uint32_t      w = s->plane_width [0];  /* luma image width in pixels 
*/
     const uint32_t      h = s->plane_height[0]; /* luma image height in pixels 
*/
-    const uint32_t      b = FFMAX(0, 4 * (int32_t) (32.0 * sqrt((double) (w * 
h) / (3840.0 * 2160.0)) + 0.5)); /* block size */
+    const uint32_t      b = FFMAX(1, 4 * (int32_t) (32.0 * sqrt((double) (w * 
h) / (3840.0 * 2160.0)) + 0.5)); /* block size */
     const uint32_t  w_blk = (w + b - 1) / b;  /* luma width in units of blocks 
*/
     const uint32_t  h_blk = (h + b - 1) / b; /* luma height in units of blocks 
*/
     AVFrame *master, *ref = NULL;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to