aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvektor <devnull@localhost>2002-10-09 17:36:28 +0000
committervektor <devnull@localhost>2002-10-09 17:36:28 +0000
commit40f2c738cac9b69b464dce2d51822fc743bc4abd (patch)
tree0e1ce449f5e7dcb2b7296edd226ee3d4ee8024fc
parent91b1149f78f43c26654d9ae02bc6a61bcaeec7d5 (diff)
Added a simple app so I can test the speed of the deinterlacing routine
reasonably objectively.
-rw-r--r--.cvsignore1
-rw-r--r--Makefile3
-rw-r--r--timingtest.c65
3 files changed, 69 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore
index 9152c7b..acb247d 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,4 +1,5 @@
*.o
tvtime
+timingtest
*.swp
diff --git a/Makefile b/Makefile
index 14c7451..db30da0 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,9 @@ tvtime: $(OBJS) tvtime.o
osdtest: $(OSDOBJS)
+timingtest: $(OBJS) timingtest.o
+ gcc $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
clean:
rm -f *.o *.png tvtime
diff --git a/timingtest.c b/timingtest.c
new file mode 100644
index 0000000..b39ebe9
--- /dev/null
+++ b/timingtest.c
@@ -0,0 +1,65 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <sys/time.h>
+#include "videotools.h"
+
+static inline void get_time( int64_t *const ptime )
+{
+ asm volatile ("rdtsc" : "=A" (*ptime));
+}
+
+static int timediff( struct timeval *large, struct timeval *small )
+{
+ return ( ( ( large->tv_sec * 1000 * 1000 ) + large->tv_usec )
+ - ( ( small->tv_sec * 1000 * 1000 ) + small->tv_usec ) );
+}
+
+int main( int argc, char **argv )
+{
+ unsigned char *source422planar;
+ unsigned char *dest422packed;
+ int width, height;
+ int i = 0;
+ int64_t before;
+ int64_t after;
+ video_correction_t *vc = video_correction_new();
+
+ width = 720;
+ height = 480;
+
+ source422planar = (unsigned char *) malloc( width * height * 2 );
+ dest422packed = (unsigned char *) malloc( width * height * 2 );
+
+ for( i = 0; i < width*height*2; i++ ) {
+ source422planar[ i ] = i % 256;
+ }
+ usleep( 10000 );
+ for( i = 0; i < 100; i++ ) {
+ struct timeval time_before;
+ struct timeval time_after;
+ gettimeofday( &time_before, 0 );
+ get_time( &before );
+ video_correction_planar422_field_to_packed422_frame( vc, dest422packed,
+ source422planar, source422planar + (width*height),
+ source422planar + (width*height) + (width/2 * height), 0, width*2, width, width, height );
+ get_time( &after );
+ gettimeofday( &time_after, 0 );
+ fprintf( stderr, "top: %10d\n", timediff( &time_after, &time_before ) );
+ gettimeofday( &time_before, 0 );
+ get_time( &before );
+ video_correction_planar422_field_to_packed422_frame( vc, dest422packed,
+ source422planar + width, source422planar + (width*height) + (width/2),
+ source422planar + (width*height) + (width/2 * height) + (width/2), 1, width*2, width, width, height );
+ get_time( &after );
+ gettimeofday( &time_after, 0 );
+ fprintf( stderr, "bot: %10d\n", timediff( &time_after, &time_before ) );
+ }
+
+ free( source422planar );
+ free( dest422packed );
+ return 0;
+}
+

Privacy Policy