1 #include "gstsparrow.h"
9 //#include "jpeg_src.c"
11 static const int INSIZE
= 100000;
12 static const int OUTSIZE
= 800 * 600 * 4;
13 static const char *FN_IN
= "test.jpg";
14 static const char *FN_OUT
= "test.ppm";
15 static const int cycles
= 100;
17 int main(int argc
, char **argv
)
19 guint8
* inbuffer
= malloc_aligned_or_die(INSIZE
);
20 guint8
* outbuffer
= malloc_aligned_or_die(OUTSIZE
);
22 FILE *in
= fopen(FN_IN
, "r");
23 int size
= fread(inbuffer
, INSIZE
, 1, in
);
25 struct timeval tv1
, tv2
;
30 init_jpeg_src(&sparrow
);
32 gettimeofday(&tv1
, NULL
);
34 for (int i
= 0; i
< cycles
; i
++){
35 decompress_buffer(sparrow
.cinfo
, inbuffer
, size
, outbuffer
,
39 gettimeofday(&tv2
, NULL
);
40 t
= ((tv2
.tv_sec
- tv1
.tv_sec
) * 1000000 +
41 tv2
.tv_usec
- tv1
.tv_usec
);
42 printf("average of %d took %u microseconds (%0.5f of a frame)\n",
43 cycles
, t
/ cycles
, (double)t
* (25.0 / 1000000.0 / cycles
));
51 ppm_dump(&rgb
, outbuffer
, width
, height
, FN_OUT
);
53 finalise_jpeg_src(&sparrow
);