[FFmpeg-devel] [PATCH] fix libswscale crash with contrast 0

Reimar Döffinger Reimar.Doeffinger
Sun Jan 31 00:57:08 CET 2010


Hello,
with contrast 0 (or only if lower?) there is a division by 0
Here's a quick hack, no idea if it's correct, but I suspect
it might be more correct even ignoring the crash.
Index: yuv2rgb.c
===================================================================
--- yuv2rgb.c	(revision 30453)
+++ yuv2rgb.c	(working copy)
@@ -629,10 +629,12 @@
     oy -= 256*brightness;
 
     //scale coefficients by cy
+    cy++;
     crv = ((crv << 16) + 0x8000) / cy;
     cbu = ((cbu << 16) + 0x8000) / cy;
     cgu = ((cgu << 16) + 0x8000) / cy;
     cgv = ((cgv << 16) + 0x8000) / cy;
+    cy--;
 
     av_free(c->yuvTable);
 




More information about the ffmpeg-devel mailing list