From 2add6b5db701cd090c38837f3cb504e18d35aa72 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 12 Apr 2003 02:32:33 +0000 Subject: use bilinear interpolation for the rotozoom Originally committed as revision 1759 to svn://svn.ffmpeg.org/ffmpeg/trunk --- tests/rotozoom.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/rotozoom.c') 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>16)&255) + (((y>>16)&255)<<8); put_pixel(i, j, tab_r[dep], tab_g[dep], tab_b[dep]); +#endif } } teta = (teta+1) % 360; -- cgit v1.2.3