From 6afd3b92b43818443a193528bd4e909b96068c22 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 11 Apr 2003 13:43:17 +0000 Subject: finished integrating rotozoom test in ffmpeg replaced float by integer to avoid rounding differenes between platforms Originally committed as revision 1755 to svn://svn.ffmpeg.org/ffmpeg/trunk --- tests/rotozoom.c | 88 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 41 deletions(-) (limited to 'tests/rotozoom.c') diff --git a/tests/rotozoom.c b/tests/rotozoom.c index d275d0e136..71d369f9e5 100644 --- a/tests/rotozoom.c +++ b/tests/rotozoom.c @@ -5,7 +5,31 @@ */ #include #include -#include +#include + +#define FIXP (1<<16) +#define MY_PI 205887 //(M_PI*FIX) + +static int64_t int_pow(int64_t a, int p){ + int64_t v= FIXP; + + for(; p; p--){ + v*= a; + v/= FIXP; + } + + return v; +} + +static int64_t int_sin(int64_t a){ + if(a<0) a= MY_PI-a; // 0..inf + a %= 2*MY_PI; // 0..2PI + + if(a>=MY_PI*3/2) a -= 2*MY_PI; // -PI/2 .. 3PI/2 + if(a>=MY_PI/2 ) a = MY_PI - a; // -PI/2 .. PI/2 + + return a - int_pow(a, 3)/6 + int_pow(a, 5)/120 - int_pow(a, 7)/5040; +} #define SCALEBITS 8 #define ONE_HALF (1 << (SCALEBITS - 1)) @@ -78,7 +102,7 @@ static void rgb24_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr, /* cif format */ #define DEFAULT_WIDTH 352 #define DEFAULT_HEIGHT 288 -#define DEFAULT_NB_PICT 360 +#define DEFAULT_NB_PICT 50 void pgmyuv_save(const char *filename, int w, int h, unsigned char *rgb_tab) @@ -160,69 +184,51 @@ void gen_image(int num, int w, int h) for (j=0;j>8)&255) + (y&(255<<8)); + dep = ((x>>16)&255) + (((y>>16)&255)<<8); put_pixel(i, j, tab_r[dep], tab_g[dep], tab_b[dep]); } } teta = (teta+1) % 360; } +#define W 256 +#define H 256 + void init_demo() { int i,j; - double h; - double radian; - char line[3 * 128]; + int h; + int radian; + char line[3 * W]; FILE *fichier; - - fichier = fopen("rotozoom-ffmpeg.pnm","r"); + fichier = fopen("lena.pnm","r"); fread(line, 1, 15, fichier); - for (i=0;i<128;i++) { - fread(line,1,3*128,fichier); - for (j=0;j<128;j++) { - tab_r[256*i+j] = line[3*j ]; - tab_g[256*i+j] = line[3*j + 1]; - tab_b[256*i+j] = line[3*j + 2]; + for (i=0;i