1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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
This commit is contained in:
Michael Niedermayer 2003-04-11 13:43:17 +00:00
parent 6696163608
commit 6afd3b92b4
5 changed files with 108 additions and 47 deletions

View File

@ -7,7 +7,8 @@ include ../config.mak
VPATH=$(SRC_PATH)/tests
CFLAGS=-O2 -Wall -g
REFFILE=$(SRC_PATH)/tests/ffmpeg.regression.ref
REFFILE1=$(SRC_PATH)/tests/ffmpeg.regression.ref
REFFILE2=$(SRC_PATH)/tests/rotozoom.regression.ref
SERVER_REFFILE=$(SRC_PATH)/tests/ffserver.regression.ref
@ -19,12 +20,13 @@ test-server: vsynth1/0.pgm asynth1.sw
@$(SRC_PATH)/tests/server-regression.sh $(SERVER_REFFILE)
# fast regression tests for all codecs
test mpeg4 mpeg: vsynth1/0.pgm asynth1.sw tiny_psnr
@$(SRC_PATH)/tests/regression.sh $@ $(REFFILE) || true
test mpeg4 mpeg: vsynth1/0.pgm vsynth2/0.pgm asynth1.sw tiny_psnr
@$(SRC_PATH)/tests/regression.sh $@ $(REFFILE1) vsynth1 || true
@$(SRC_PATH)/tests/regression.sh $@ $(REFFILE2) vsynth2 || true
# fast regression for libav formats
libavtest: vsynth1/0.pgm asynth1.sw
@$(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE)
@$(SRC_PATH)/tests/regression.sh $@ $(LIBAV_REFFILE) vsynth1
# video generation
@ -32,9 +34,16 @@ vsynth1/0.pgm: videogen
@mkdir -p vsynth1
./videogen 'vsynth1/'
vsynth2/0.pgm: rotozoom
@mkdir -p vsynth2
./rotozoom 'vsynth2/'
videogen: videogen.c
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
rotozoom: rotozoom.c
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
# audio generation
asynth1.sw: audiogen
@ -63,5 +72,5 @@ dsptest: dsptest.c $(DSPDEPS)
$(CC) -O4 -fomit-frame-pointer -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavcodec/i386 -I$(SRC_PATH)/libavcodec/ -o $@ $< -lm
clean:
rm -rf vsynth1 data
rm -rf vsynth1 vsynth2 data
rm -f asynth1.sw *~ audiogen videogen

BIN
tests/lena.pnm Normal file

Binary file not shown.

View File

@ -46,7 +46,7 @@ tiny_psnr="./tiny_psnr"
outfile="$datadir/a-"
reffile="$2"
benchfile="$datadir/ffmpeg.bench"
raw_src="vsynth1/%d.pgm"
raw_src="$3/%d.pgm"
raw_dst="$datadir/out.yuv"
raw_ref="$datadir/ref.yuv"
pcm_src="asynth1.sw"

View File

@ -5,7 +5,31 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <inttypes.h>
#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<h;j++) {
x = xprime + xi;
x = xprime + xi + FIXP*w/2;
xprime += s;
y = yprime + yi;
y = yprime + yi + FIXP*h/2;
yprime += c;
for ( i=0 ; i<w ; i++ ) {
x += c;
y -= s;
dep = ((x>>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<H;i++) {
fread(line,1,3*W,fichier);
for (j=0;j<W;j++) {
tab_r[W*i+j] = line[3*j ];
tab_g[W*i+j] = line[3*j + 1];
tab_b[W*i+j] = line[3*j + 2];
}
memcpy(tab_r + 257*128 + i*256, tab_r + i*256, 128);
memcpy(tab_g + 257*128 + i*256, tab_g + i*256, 128);
memcpy(tab_b + 257*128 + i*256, tab_b + i*256, 128);
}
fclose(fichier);
fichier = fopen("rotozoom-tux.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[128 + 256*i+j] = line[3*j ];
tab_g[128 + 256*i+j] = line[3*j + 1];
tab_b[128 + 256*i+j] = line[3*j + 2];
}
memcpy(tab_r + 256*128 + i*256, tab_r + 128 + i*256, 128);
memcpy(tab_g + 256*128 + i*256, tab_g + 128 + i*256, 128);
memcpy(tab_b + 256*128 + i*256, tab_b + 128 + i*256, 128);
}
fclose(fichier);
/* tables sin/cos */
for (i=0;i<360;i++) {
radian = 2*i*M_PI/360;
h = 2 + cos (radian);
h_cos[i] = 256 * ( h * cos (radian) );
h_sin[i] = 256 * ( h * sin (radian) );
radian = 2*i*MY_PI/360;
h = 2*FIXP + int_sin (radian);
h_cos[i] = ( h * int_sin (radian + MY_PI/2) )/2/FIXP;
h_sin[i] = ( h * int_sin (radian ) )/2/FIXP;
}
}
@ -248,7 +254,7 @@ int main(int argc, char **argv)
init_demo();
for(i=0;i<DEFAULT_NB_PICT;i++) {
snprintf(buf, sizeof(buf), "%s%03d.pgm", argv[1], i);
snprintf(buf, sizeof(buf), "%s%d.pgm", argv[1], i);
gen_image(i, w, h);
pgmyuv_save(buf, w, h, rgb_tab);
}

View File

@ -0,0 +1,46 @@
ffmpeg regression test
53ffeab95141e6a70f76a5da8d399502 *./data/a-mpeg1.mpg
5eb64d914bcfde923841775b59aa8824 *./data/out.yuv
stddev: 5.79 bytes:7299072
5010ba12d570da1b67cf8228cf57ae64 *./data/a-msmpeg4v2.avi
4e770952654358c3f433f62076a3699c *./data/out.yuv
stddev: 6.34 bytes:7602176
3d86f471d5ead1a28d16e872df9e925d *./data/a-msmpeg4.avi
eca94a909c3efb47d5ae17a3531415b5 *./data/out.yuv
stddev: 6.34 bytes:7602176
0a595c1cf463ed333da18fe8fa35c574 *./data/a-wmv1.avi
d5af5d26b85d04996a254bc0e0da16ab *./data/out.yuv
stddev: 6.33 bytes:7602176
ccf667747ae00dc3749186879b79a512 *./data/a-wmv2.avi
d5af5d26b85d04996a254bc0e0da16ab *./data/out.yuv
stddev: 6.33 bytes:7602176
06de9fb1fc7835586cc021766b01efe0 *./data/a-h263.avi
a5c270fa5eff8be3ba37c29a2ab23b3a *./data/out.yuv
stddev: 6.42 bytes:7602176
0a0e7bbe5f29bd62b6a78353b8af398c *./data/a-h263p.avi
90a76e3af35aa6353748b80a23d71682 *./data/out.yuv
stddev: 2.09 bytes:7602176
8f0b6b12b267a52d9387dea6c13c03a0 *./data/a-odivx.avi
54462ec0c0c490fcc9f241b4db316b72 *./data/out.yuv
stddev: 6.33 bytes:7602176
7098bda9d5040fb546c4f09c0c4b2c10 *./data/a-huffyuv.avi
fcf7324a82f7c8f82938e183fb3d9160 *./data/out.yuv
stddev: 0.00 bytes:7602176
2380e8af936ace954ae4f6f9b28834e4 *./data/a-mpeg4-rc.avi
c42afeb9a193ff621fe7817625b1ac26 *./data/out.yuv
stddev: 7.08 bytes:7145472
a903c3f843d46148c921753e0329c53a *./data/a-mpeg4-adv.avi
97c59508e0ff00a2c85a236816d27ac1 *./data/out.yuv
stddev: 5.93 bytes:7602176
4268e97a03ed85d23d4811a7801bcd34 *./data/a-mpeg1b.mpg
69a02eaf41614c89cc143346e17e9312 *./data/out.yuv
stddev: 4.87 bytes:6842368
68330608354aa4bade1dad5d78965f7c *./data/a-mjpeg.avi
5d8d78dda9b7fed66a9867c481790bee *./data/out.yuv
stddev: 5.77 bytes:7602176
8d05d59683f7803ae2ddf214b29f09b1 *./data/a-rv10.rm
b5654603df11d5a3ac77db9274d11e6f *./data/out.yuv
stddev: 13.18 bytes:7602176
21f8ff9f1daacd9133683bb4ea0f50a4 *./data/a-mp2.mp2
116d1290ba1b4eb98fdee52e423417b1 *./data/out.wav
048b9c3444c788bac6ce5cc3a8f4db00 *./data/a-ac3.rm