changeset 27520:740b5a4125c4

Prevent overflows during mpeg->jpeg yuv.
author michael
date Tue, 09 Sep 2008 03:35:07 +0000
parents 8e62ab83b282
children 09f068b67fc7
files libswscale/swscale_template.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale_template.c	Mon Sep 08 21:26:24 2008 +0000
+++ b/libswscale/swscale_template.c	Tue Sep 09 03:35:07 2008 +0000
@@ -2721,7 +2721,7 @@
                 dst[i]= (dst[i]*14071 + 33561947)>>14;
         }else{
             for (i=0; i<dstWidth; i++)
-                dst[i]= (dst[i]*19077 - 39057361)>>14;
+                dst[i]= (FFMIN(dst[i],30189)*19077 - 39057361)>>14;
         }
     }
 }
@@ -2986,8 +2986,8 @@
             }
         }else{
             for (i=0; i<dstWidth; i++){
-                dst[i     ]= (dst[i     ]*4663 - 9289992)>>12; //-264
-                dst[i+VOFW]= (dst[i+VOFW]*4663 - 9289992)>>12; //-264
+                dst[i     ]= (FFMIN(dst[i     ],30775)*4663 - 9289992)>>12; //-264
+                dst[i+VOFW]= (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; //-264
             }
         }
     }