1
2 #ifdef HAVE_CONFIG_H
3 #include "config.h"
4 #endif
5
6 #include <schroedinger/schro.h>
7 #include <schroedinger/schromotion.h>
8 #include <schroedinger/schrodebug.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12
13 #include <orc-test/orcprofile.h>
14
15 int
main(int argc,char * argv[])16 main (int argc, char *argv[])
17 {
18 SchroFrame *dest;
19 SchroFrame *ref;
20 SchroFrame *addframe;
21 SchroUpsampledFrame *uref;
22 SchroParams params;
23 SchroVideoFormat video_format;
24 SchroMotionVector *motion_vectors;
25 int i;
26 int j;
27 OrcProfile prof;
28 double ave, std;
29
30 schro_init();
31
32 memset (&video_format, 0, sizeof(video_format));
33 memset (¶ms, 0, sizeof(params));
34
35 schro_video_format_set_std_video_format (&video_format,
36 SCHRO_VIDEO_FORMAT_CUSTOM);
37 video_format.width = 720;
38 video_format.height = 480;
39 video_format.chroma_format = SCHRO_CHROMA_420;
40 schro_video_format_validate (&video_format);
41
42 params.video_format = &video_format;
43 params.xbsep_luma = 8;
44 params.ybsep_luma = 8;
45 params.xblen_luma = 12;
46 params.yblen_luma = 12;
47
48 schro_params_calculate_mc_sizes(¶ms);
49
50 dest = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_420,
51 video_format.width, video_format.height);
52 schro_frame_clear(dest);
53
54 ref = schro_frame_new_and_alloc_extended (NULL, SCHRO_FRAME_FORMAT_U8_420,
55 video_format.width, video_format.height, 32);
56 schro_frame_clear(ref);
57
58 addframe = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_420,
59 video_format.width, video_format.height);
60 schro_frame_clear(addframe);
61
62 uref = schro_upsampled_frame_new (ref);
63
64 schro_upsampled_frame_upsample (uref);
65
66 motion_vectors = malloc(sizeof(SchroMotionVector) *
67 params.x_num_blocks * params.y_num_blocks);
68 memset (motion_vectors, 0, sizeof(SchroMotionVector) *
69 params.x_num_blocks * params.y_num_blocks);
70
71 printf("sizeof(SchroMotionVector) = %lu\n",(unsigned long) sizeof(SchroMotionVector));
72 printf("num blocks %d x %d\n", params.x_num_blocks, params.y_num_blocks);
73 for(i=0;i<params.x_num_blocks*params.y_num_blocks;i++){
74 motion_vectors[i].u.vec.dx[0] = 0;
75 motion_vectors[i].u.vec.dy[0] = 0;
76 motion_vectors[i].pred_mode = 1;
77 motion_vectors[i].split = 2;
78 }
79
80 for(i=0;i<10;i++){
81 orc_profile_init (&prof);
82 for(j=0;j<10;j++){
83 SchroMotion *motion;
84 void *mv_save;
85
86 motion = schro_motion_new (¶ms, uref, NULL);
87 mv_save = motion->motion_vectors;
88 motion->motion_vectors = motion_vectors;
89 orc_profile_start(&prof);
90 schro_motion_render (motion, dest, addframe, FALSE, NULL);
91 orc_profile_stop(&prof);
92 motion->motion_vectors = mv_save;
93 schro_motion_free (motion);
94 }
95 orc_profile_get_ave_std (&prof, &ave, &std);
96 printf("cycles %g %g\n", ave, std);
97 }
98
99
100
101 schro_upsampled_frame_free (uref);
102 schro_frame_unref (dest);
103 free (motion_vectors);
104
105 return 0;
106 }
107
108