diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-04-12 02:32:33 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-04-12 02:32:33 +0000 |
commit | 2add6b5db701cd090c38837f3cb504e18d35aa72 (patch) | |
tree | 781062272be2d659358588f05daaa9276c46bf7f /tests/rotozoom.c | |
parent | f0ef62405770cfa52124f4569a3deda206cccda9 (diff) | |
download | ffmpeg-2add6b5db701cd090c38837f3cb504e18d35aa72.tar.gz |
use bilinear interpolation for the rotozoom
Originally committed as revision 1759 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'tests/rotozoom.c')
-rw-r--r-- | tests/rotozoom.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/rotozoom.c b/tests/rotozoom.c index 71d369f9e5..f7c3b0c956 100644 --- a/tests/rotozoom.c +++ b/tests/rotozoom.c @@ -163,6 +163,21 @@ int teta = 0; int h_cos [360]; int h_sin [360]; +static int ipol(uint8_t *src, int x, int y){ + int int_x= x>>16; + int int_y= y>>16; + int frac_x= x&0xFFFF; + int frac_y= y&0xFFFF; + int s00= src[ ( int_x &255) + 256*( int_y &255) ]; + int s01= src[ ((int_x+1)&255) + 256*( int_y &255) ]; + int s10= src[ ( int_x &255) + 256*((int_y+1)&255) ]; + int s11= src[ ((int_x+1)&255) + 256*((int_y+1)&255) ]; + int s0= (((1<<16) - frac_x)*s00 + frac_x*s01)>>8; + int s1= (((1<<16) - frac_x)*s10 + frac_x*s11)>>8; + + return (((1<<16) - frac_y)*s0 + frac_y*s1)>>24; +} + void gen_image(int num, int w, int h) { const int c = h_cos [teta]; @@ -193,8 +208,12 @@ void gen_image(int num, int w, int h) for ( i=0 ; i<w ; i++ ) { x += c; y -= s; +#if 1 + put_pixel(i, j, ipol(tab_r, x, y), ipol(tab_g, x, y), ipol(tab_b, x, y)); +#else dep = ((x>>16)&255) + (((y>>16)&255)<<8); put_pixel(i, j, tab_r[dep], tab_g[dep], tab_b[dep]); +#endif } } teta = (teta+1) % 360; |