diff options
author | Yartrebo <yartrebo@earthlink.net> | 2005-04-17 09:27:53 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-04-17 09:27:53 +0000 |
commit | 8c2515bbb9800a3cdcc28aa19133302ba5f2da45 (patch) | |
tree | b0ec39fb99aa696aac180cd286e1fa47229fd713 /libavcodec/snow.c | |
parent | b44985ba12d927d643a7bc03b0db98b83bf4fc9e (diff) | |
download | ffmpeg-8c2515bbb9800a3cdcc28aa19133302ba5f2da45.tar.gz |
fix overflow in mc_block() patch by (Yartrebo )yartrebo earthlink net
Originally committed as revision 4132 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r-- | libavcodec/snow.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 7020b39ba0..9cfddfa951 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -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; |