containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / image_data_ycbcr601pl_map_solid_rotate.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_data_ycbcr601pl_map_solid_rotate_start
7 #define NAME "Image Data YCbCr 601 Pointer List Map Solid Rotate"
8 #define ICON "data.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16
17 /* private data */
18 static Evas_Object *o_images[1];
19 static Eina_Slice slice[3];
20
21 /* setup */
22 static void _setup(void)
23 {
24    FILE *f;
25    for (int i = 0; i < 1; i++)
26      {
27         Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
28         o_images[i] = o;
29         efl_gfx_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
30         efl_gfx_buffer_alpha_set(o, 0);
31         efl_gfx_fill_set(o, EINA_RECT(0, 0, 640, 480));
32         efl_gfx_entity_size_set(o, EINA_SIZE2D(640, 480));
33         efl_gfx_entity_visible_set(o, EINA_TRUE);
34
35         slice[0].len = 640 * 480;
36         slice[1].len = 320 * 240;
37         slice[2].len = 320 * 240;
38         f = fopen(build_path("tp.yuv"), "rb");
39         if (!f) continue;
40         for (int p = 0; p < 3; p++)
41           {
42              slice[p].mem = malloc(slice[p].len);
43              fread((void *) slice[p].mem, slice[p].len, 1, f);
44              efl_gfx_buffer_managed_set(o, &slice[p], EINA_SIZE2D(640, 480), 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
45           }
46         fclose(f);
47      }
48    done = 0;
49 }
50
51 /* cleanup */
52 static void _cleanup(void)
53 {
54    for (int i = 0; i < 1; i++)
55      {
56         Evas_Object *o = o_images[i];
57         for (int p = 0; p < 3; p++)
58           {
59              efl_gfx_buffer_managed_set(o, NULL, EINA_SIZE2D(640, 480), 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
60              free((void *) slice[p].mem);
61           }
62         efl_del(o);
63      }
64 }
65
66 /* loop - do things */
67 static void _loop(double t, int f)
68 {
69    int i;
70    static Evas_Map *m = NULL;
71    Evas_Coord x, y, w, h;
72    if (!m) m = evas_map_new(4);
73    for (i = 0; i < 1; i++)
74      {
75         w = 640;
76         h = 480;
77         x = (win_w / 2) - (w / 2);
78         y = (win_h / 2) - (h / 2);
79
80         evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);
81
82         evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2));
83
84         evas_object_map_enable_set(o_images[i], 1);
85         evas_object_map_set(o_images[i], m);
86      }
87    FPS_STD(NAME);
88 }
89
90 /* prepend special key handlers if interactive (before STD) */
91 static void _key(const char *key)
92 {
93    KEY_STD;
94 }
95
96
97
98
99
100
101
102
103
104
105
106
107 /* template stuff - ignore */
108 # endif
109 #endif
110
111 #ifdef UI
112 _ui_menu_item_add(ICON, NAME, FNAME);
113 #endif
114
115 #ifdef PROTO
116 void FNAME(void);
117 #endif
118
119 #ifndef PROTO
120 # ifndef UI
121 void FNAME(void)
122 {
123    ui_func_set(_key, _loop, _setup);
124 }
125 # endif
126 #endif
127 #undef FNAME
128 #undef NAME
129 #undef ICON