containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / image_data_ycbcr601pl.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_data_ycbcr601pl_start
7 #define NAME "Image Data YCbCr 601 Pointer List"
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    Evas_Coord x, y, w, h;
71    for (i = 0; i < 1; i++)
72      {
73         w = 640;
74         h = 480;
75         x = (win_w / 2) - (w / 2);
76         y = (win_h / 2) - (h / 2);
77         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
78         efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
79         efl_gfx_fill_set(o_images[i], EINA_RECT(0, 0, w, h));
80         efl_gfx_buffer_update_add(o_images[i], &EINA_RECT(0, 0, 640, 480));
81      }
82    FPS_STD(NAME);
83 }
84
85 /* prepend special key handlers if interactive (before STD) */
86 static void _key(const char *key)
87 {
88    KEY_STD;
89 }
90
91
92
93
94
95
96
97
98
99
100
101
102 /* template stuff - ignore */
103 # endif
104 #endif
105
106 #ifdef UI
107 _ui_menu_item_add(ICON, NAME, FNAME);
108 #endif
109
110 #ifdef PROTO
111 void FNAME(void);
112 #endif
113
114 #ifndef PROTO
115 # ifndef UI
116 void FNAME(void)
117 {
118    ui_func_set(_key, _loop, _setup);
119 }
120 # endif
121 #endif
122 #undef FNAME
123 #undef NAME
124 #undef ICON