[encoder] Added 1/8th pel MV refinement
[schroedinger/research-port.git] / testsuite / cache / wavelet_speed.c
blob7df1353968bec0c6daaedef2c9291ac5e8b21d88
2 #ifdef HAVE_CONFIG_H
3 #include "config.h"
4 #endif
6 #include <schroedinger/schro.h>
7 #include <schroedinger/schrowavelet.h>
8 #include <schroedinger/schrooil.h>
10 #define OIL_ENABLE_UNSTABLE_API
11 #include <liboil/liboil.h>
12 #include <liboil/liboilprofile.h>
14 #include <stdio.h>
15 #include <string.h>
16 #include <stdlib.h>
19 int16_t tmp[2048+100];
20 int16_t *data;
22 int oil_profile_get_min (OilProfile *prof)
24 int i;
25 int min;
26 min = prof->hist_time[0];
27 for(i=0;i<10;i++){
28 if (prof->hist_count[i] > 0) {
29 if (prof->hist_time[i] < min) {
30 min = prof->hist_time[i];
34 return min;
37 void
38 wavelet_speed (int filter, int width, int height)
40 OilProfile prof1;
41 OilProfile prof2;
42 double ave_fwd, ave_rev;
43 int i;
44 SchroFrameData fd;
46 fd.format = SCHRO_FRAME_FORMAT_S16_444;
47 fd.data = data;
48 fd.stride = width*2;
49 fd.width = width;
50 fd.height = height;
52 oil_profile_init (&prof1);
53 oil_profile_init (&prof2);
55 for(i=0;i<10;i++){
56 oil_profile_start (&prof1);
57 schro_wavelet_transform_2d (&fd, filter, tmp);
58 oil_profile_stop (&prof1);
60 oil_profile_start (&prof2);
61 schro_wavelet_inverse_transform_2d (&fd, filter, tmp);
62 oil_profile_stop (&prof2);
65 //oil_profile_get_ave_std (&prof1, &ave_fwd, &std);
66 //printf("fwd %g (%g)\n", ave, std);
68 //oil_profile_get_ave_std (&prof2, &ave_rev, &std);
69 //printf("rev %g (%g)\n", ave, std);
71 ave_fwd = oil_profile_get_min (&prof1);
72 ave_rev = oil_profile_get_min (&prof2);
73 printf("%d %d %g %g %g %g\n", width, height, ave_fwd, ave_rev,
74 ave_fwd/(width*height), ave_rev/(width*height));
78 int
79 main (int argc, char *argv[])
81 int i;
83 oil_init();
85 data = malloc(2048*512*2);
87 #if 0
88 for(i=0;i<8;i++){
89 printf("wavelet %d\n", i);
90 wavelet_speed (i, 256, 256);
92 #endif
93 for(i=16;i<=2048;i+=16){
94 wavelet_speed (1, i, 256);
97 free(data);
99 return 0;