6 #include <schroedinger/schro.h>
7 #include <schroedinger/schromotion.h>
8 #include <schroedinger/schrodebug.h>
13 #define OIL_ENABLE_UNSTABLE_API
14 #include <liboil/liboilprofile.h>
17 schro_frame_clear (SchroFrame
*frame
)
19 memset(frame
->components
[0].data
, 0, frame
->components
[0].length
);
20 memset(frame
->components
[1].data
, 0, frame
->components
[1].length
);
21 memset(frame
->components
[2].data
, 0, frame
->components
[2].length
);
25 main (int argc
, char *argv
[])
29 SchroUpsampledFrame
*uref
;
31 SchroVideoFormat video_format
;
32 SchroMotionVector
*motion_vectors
;
40 video_format
.width
= 720;
41 video_format
.height
= 480;
42 video_format
.chroma_format
= SCHRO_CHROMA_420
;
43 schro_video_format_validate (&video_format
);
45 params
.video_format
= &video_format
;
46 params
.xbsep_luma
= 8;
47 params
.ybsep_luma
= 8;
48 params
.xblen_luma
= 12;
49 params
.yblen_luma
= 12;
51 schro_params_calculate_mc_sizes(¶ms
);
53 dest
= schro_frame_new_and_alloc (NULL
, SCHRO_FRAME_FORMAT_S16_420
,
54 video_format
.width
, video_format
.height
);
55 schro_frame_clear(dest
);
57 ref
= schro_frame_new_and_alloc (NULL
, SCHRO_FRAME_FORMAT_U8_420
,
58 video_format
.width
, video_format
.height
);
59 schro_frame_clear(ref
);
61 uref
= schro_upsampled_frame_new (ref
);
63 schro_upsampled_frame_upsample (uref
);
65 motion_vectors
= malloc(sizeof(SchroMotionVector
) *
66 params
.x_num_blocks
* params
.y_num_blocks
);
67 memset (motion_vectors
, 0, sizeof(SchroMotionVector
) *
68 params
.x_num_blocks
* params
.y_num_blocks
);
70 printf("sizeof(SchroMotionVector) = %lu\n",(unsigned long) sizeof(SchroMotionVector
));
71 printf("num blocks %d x %d\n", params
.x_num_blocks
, params
.y_num_blocks
);
72 for(i
=0;i
<params
.x_num_blocks
*params
.y_num_blocks
;i
++){
73 motion_vectors
[i
].dx
[0] = 0;
74 motion_vectors
[i
].dy
[0] = 0;
75 motion_vectors
[i
].pred_mode
= 1;
76 motion_vectors
[i
].split
= 2;
80 oil_profile_init (&prof
);
86 motion
.motion_vectors
= motion_vectors
;
87 motion
.params
= ¶ms
;
88 oil_profile_start(&prof
);
89 schro_motion_render (&motion
, dest
);
90 oil_profile_stop(&prof
);
92 oil_profile_get_ave_std (&prof
, &ave
, &std
);
93 printf("cycles %g %g\n", ave
, std
);
98 schro_upsampled_frame_free (uref
);
99 schro_frame_unref (dest
);
100 free (motion_vectors
);