|
From: Oliver Z. <oz...@co...> - 2006-09-08 10:41:10
|
Hi there!
I'm trying to do a benchmark for decoding DV data on an ARM machine
(arm920t core, 180MHz, 64MB SDRAM).
Here's the code:
--------------------------------------------------------
// decode.c
#include <stdio.h>
#include <sys/time.h>
#include <fcntl.h>
#include <libdv/dv.h>
#define READ_SIZE 120000 // PAL 144000
int main(int argc,char *argv[])
{
dv_decoder_t *decoder = NULL;
int fd, dec, count;
unsigned char *pixels[3];
int pitches[3];
unsigned char video_buffer[720 * 576 * 3];
unsigned char dv_buffer[READ_SIZE];
struct timeval tv[3];
double time = 0.0;
if ((fd = open(argv[1],O_RDONLY)) < 0)
printf("could not open file %s\n\n",argv[1]);
else
printf("opened file %s\n\n", argv[1]);
pitches[0] = 720 * 3;
pixels[0] = video_buffer;
decoder = dv_decoder_new(TRUE, FALSE, FALSE);
dec = count = 1;
if (!decoder)
printf("decoder new failed\n");
if (READ_SIZE != read(fd, dv_buffer, READ_SIZE))
printf("read failed\n");
if (dv_parse_header(decoder, dv_buffer) < 0)
printf("header parse error\n");
printf("decoding...\n\n");
gettimeofday(tv+0, NULL);
dv_decode_full_frame(decoder, dv_buffer, e_dv_color_rgb, pixels,
pitches);
while (dec) {
if (READ_SIZE == read(fd, dv_buffer, READ_SIZE))
{
dv_decode_full_frame(decoder, dv_buffer, e_dv_color_rgb,
pixels, pitches);
count++;
//printf("frame no.: %d\n\n", count);
} else dec = 0;
} // while
gettimeofday(tv+1, NULL);
timersub(tv+1, tv+0, tv+2);
time = tv[2].tv_sec + (tv[2].tv_usec / 1000000.0);
printf("seconds: %f\n", time);
printf("number of frames: %d\n", count);
printf("resulting in %f fps\n", (double)count / time);
close(fd);
dv_decoder_free(decoder);
return 0;
} // main
--------------------------------------------------
I configured libdv for arm:
./configure --disable-gtk --host=arm-linux --target=arm-linux
Cross-compiled with arm-linux-gcc (2.95.3) on my x86:
arm-linux-gcc -o arm-decode -ldv -O -O2 decode.c
Works so far but the performance is terrible. Decoding just one frame
takes several minutes (file pond.dv).
So my question is: is there any possiblity to improve speed?
Thank you!
Oliver
|