fix overflow in mc_block() patch by (Yartrebo )yartrebo earthlink net

Originally committed as revision 4132 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Yartrebo 2005-04-17 09:27:53 +00:00 committed by Michael Niedermayer
parent b44985ba12
commit 8c2515bbb9
2 changed files with 18 additions and 10 deletions

View File

@ -2359,8 +2359,13 @@ START_TIMER
// if(b_w==16) am= 8*(a1+a2);
if(dx<8) tmp[x]= (32*a2*( 8-dx) + am* dx + 128)>>8;
else tmp[x]= ( am*(16-dx) + 32*a3*(dx-8) + 128)>>8;
if(dx<8) am = (32*a2*( 8-dx) + am* dx + 128)>>8;
else am = ( am*(16-dx) + 32*a3*(dx-8) + 128)>>8;
/* FIXME Try increasing tmp buffer to 16 bits and not clipping here. Should give marginally better results. - Robert*/
if(am&(~255)) am= ~(am>>31);
tmp[x] = am;
/* if (dx< 4) tmp[x + y*stride]= (16*a1*( 4-dx) + aL* dx + 32)>>6;
else if(dx< 8) tmp[x + y*stride]= ( aL*( 8-dx) + am*(dx- 4) + 32)>>6;
@ -2387,9 +2392,12 @@ START_TIMER
// if(b_w==16) am= 8*(a1+a2);
if(dy<8) dst[x]= (32*a2*( 8-dy) + am* dy + 128)>>8;
else dst[x]= ( am*(16-dy) + 32*a3*(dy-8) + 128)>>8;
if(dy<8) am = (32*a2*( 8-dy) + am* dy + 128)>>8;
else am = ( am*(16-dy) + 32*a3*(dy-8) + 128)>>8;
if(am&(~255)) am= ~(am>>31);
dst[x] = am;
/* if (dy< 4) tmp[x + y*stride]= (16*a1*( 4-dy) + aL* dy + 32)>>6;
else if(dy< 8) tmp[x + y*stride]= ( aL*( 8-dy) + am*(dy- 4) + 32)>>6;
else if(dy<12) tmp[x + y*stride]= ( am*(12-dy) + aR*(dy- 8) + 32)>>6;

View File

@ -119,12 +119,12 @@ a7ef4746f27be309138c188e327d3ebe *./data/a-ffv1.avi
2653642 ./data/a-ffv1.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
24c1fcbcdb08052359679700056ef4e5 *./data/a-snow.avi
1267526 ./data/a-snow.avi
575fdd879119902a8289c825c2389dca *./data/out.yuv
stddev: 2.96 PSNR:38.67 bytes:7602176
0c570833b736a8d4c8c428bf6e82272f *./data/a-snow53.avi
3537490 ./data/a-snow53.avi
0c447fd23c33ef06b09ecae5e1959185 *./data/a-snow.avi
1263028 ./data/a-snow.avi
d2d86a95325f5c166fc07e5670b2adb6 *./data/out.yuv
stddev: 2.97 PSNR:38.67 bytes:7602176
de8eac1454746a37eae0b1ff88c0f849 *./data/a-snow53.avi
3535414 ./data/a-snow53.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
b5b6275f58f012de73644bbaa9080097 *./data/a-svq1.mov