summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-09-05 02:58:51 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-09-05 02:58:51 +0000
commit11a0377961200bc586d22c2c71453bc3b08eae42 (patch)
tree31af3815125c1aa330f4866e03b8918f89531281
parent9572d6f406315dda6d34dac73f62bbf83f0a225c (diff)
add tests for yuv rotated map thing. :)
SVN revision: 51894
-rw-r--r--src/bin/Makefile.am2
-rw-r--r--src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c149
-rw-r--r--src/bin/image_data_ycbcr601pl_map_solid_rotate.c147
-rw-r--r--src/bin/tests.h2
-rw-r--r--src/bin/ui.c10
5 files changed, 308 insertions, 2 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 4611b51..ec1299c 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -80,6 +80,8 @@ image_data_argb.c \
80image_data_argb_alpha.c \ 80image_data_argb_alpha.c \
81image_data_ycbcr601pl.c \ 81image_data_ycbcr601pl.c \
82image_data_ycbcr601pl_wide_stride.c \ 82image_data_ycbcr601pl_wide_stride.c \
83image_data_ycbcr601pl_map_solid_rotate.c \
84image_data_ycbcr601pl_map_nearest_solid_rotate.c \
83image_crossfade.c \ 85image_crossfade.c \
84text_basic.c \ 86text_basic.c \
85text_styles.c \ 87text_styles.c \
diff --git a/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
new file mode 100644
index 0000000..6587715
--- /dev/null
+++ b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
@@ -0,0 +1,149 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME image_data_ycbcr601pl_map_nearest_solid_rotate_start
7#define NAME "Image Data YCbCr 601 Pointer List Map Nearest Solid Rotate"
8#define ICON "data.png"
9
10#ifndef PROTO
11# ifndef UI
12# include "main.h"
13
14/* standard var */
15static int done = 0;
16
17/* private data */
18static Evas_Object *o_images[1];
19static unsigned char *yp = NULL, *up = NULL, *vp = NULL;
20
21/* setup */
22static void _setup(void)
23{
24 int i, y;
25 FILE *f;
26 unsigned char **data, **lp;
27 Evas_Object *o;
28 for (i = 0; i < 1; i++)
29 {
30 o = evas_object_image_add(evas);
31 o_images[i] = o;
32 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
33 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL);
34 evas_object_image_size_set(o, 640, 480);
35 evas_object_image_alpha_set(o, 0);
36 evas_object_image_fill_set(o, 0, 0, 640, 480);
37 evas_object_resize(o, 640, 480);
38 evas_object_image_smooth_scale_set(o, 0);
39 evas_object_show(o);
40 yp = malloc(640 * 480);
41 up = malloc(320 * 240);
42 vp = malloc(320 * 240);
43 f = fopen(build_path("tp.yuv"), "rb");
44 if (f)
45 {
46 fread(yp, 640 * 480, 1, f);
47 fread(up, 320 * 240, 1, f);
48 fread(vp, 320 * 240, 1, f);
49 fclose(f);
50 }
51 data = evas_object_image_data_get(o_images[i], 1);
52 lp = data;
53 for (y = 0; y < 480; y++)
54 {
55 *lp = yp + (y * 640);
56 lp++;
57 }
58 for (y = 0; y < 240; y++)
59 {
60 *lp = up + (y * 320);
61 lp++;
62 }
63 for (y = 0; y < 240; y++)
64 {
65 *lp = vp + (y * 320);
66 lp++;
67 }
68 evas_object_image_data_set(o_images[i], data);
69 }
70 done = 0;
71}
72
73/* cleanup */
74static void _cleanup(void)
75{
76 int i;
77 for (i = 0; i < 1; i++) evas_object_del(o_images[i]);
78 free(yp);
79 free(up);
80 free(vp);
81}
82
83/* loop - do things */
84static void _loop(double t, int f)
85{
86 int i;
87 Evas_Map *m;
88 Evas_Coord x, y, w, h;
89 m = evas_map_new(4);
90 evas_map_smooth_set(m, 0);
91 for (i = 0; i < 1; i++)
92 {
93 w = 640;
94 h = 480;
95 x = (win_w / 2) - (w / 2);
96 y = (win_h / 2) - (h / 2);
97
98 evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);
99
100 evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2));
101
102 evas_object_map_enable_set(o_images[i], 1);
103 evas_object_map_set(o_images[i], m);
104 }
105 evas_map_free(m);
106 FPS_STD(NAME);
107}
108
109/* prepend special key handlers if interactive (before STD) */
110static void _key(char *key)
111{
112 KEY_STD;
113}
114
115
116
117
118
119
120
121
122
123
124
125
126/* template stuff - ignore */
127# endif
128#endif
129
130#ifdef UI
131_ui_menu_item_add(ICON, NAME, FNAME);
132#endif
133
134#ifdef PROTO
135void FNAME(void);
136#endif
137
138#ifndef PROTO
139# ifndef UI
140void FNAME(void)
141{
142 ui_func_set(_key, _loop);
143 _setup();
144}
145# endif
146#endif
147#undef FNAME
148#undef NAME
149#undef ICON
diff --git a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
new file mode 100644
index 0000000..6054946
--- /dev/null
+++ b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
@@ -0,0 +1,147 @@
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 */
15static int done = 0;
16
17/* private data */
18static Evas_Object *o_images[1];
19static unsigned char *yp = NULL, *up = NULL, *vp = NULL;
20
21/* setup */
22static void _setup(void)
23{
24 int i, y;
25 FILE *f;
26 unsigned char **data, **lp;
27 Evas_Object *o;
28 for (i = 0; i < 1; i++)
29 {
30 o = evas_object_image_add(evas);
31 o_images[i] = o;
32 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
33 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_YCBCR422P601_PL);
34 evas_object_image_size_set(o, 640, 480);
35 evas_object_image_alpha_set(o, 0);
36 evas_object_image_fill_set(o, 0, 0, 640, 480);
37 evas_object_resize(o, 640, 480);
38 evas_object_show(o);
39 yp = malloc(640 * 480);
40 up = malloc(320 * 240);
41 vp = malloc(320 * 240);
42 f = fopen(build_path("tp.yuv"), "rb");
43 if (f)
44 {
45 fread(yp, 640 * 480, 1, f);
46 fread(up, 320 * 240, 1, f);
47 fread(vp, 320 * 240, 1, f);
48 fclose(f);
49 }
50 data = evas_object_image_data_get(o_images[i], 1);
51 lp = data;
52 for (y = 0; y < 480; y++)
53 {
54 *lp = yp + (y * 640);
55 lp++;
56 }
57 for (y = 0; y < 240; y++)
58 {
59 *lp = up + (y * 320);
60 lp++;
61 }
62 for (y = 0; y < 240; y++)
63 {
64 *lp = vp + (y * 320);
65 lp++;
66 }
67 evas_object_image_data_set(o_images[i], data);
68 }
69 done = 0;
70}
71
72/* cleanup */
73static void _cleanup(void)
74{
75 int i;
76 for (i = 0; i < 1; i++) evas_object_del(o_images[i]);
77 free(yp);
78 free(up);
79 free(vp);
80}
81
82/* loop - do things */
83static void _loop(double t, int f)
84{
85 int i;
86 Evas_Map *m;
87 Evas_Coord x, y, w, h;
88 m = evas_map_new(4);
89 for (i = 0; i < 1; i++)
90 {
91 w = 640;
92 h = 480;
93 x = (win_w / 2) - (w / 2);
94 y = (win_h / 2) - (h / 2);
95
96 evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);
97
98 evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2));
99
100 evas_object_map_enable_set(o_images[i], 1);
101 evas_object_map_set(o_images[i], m);
102 }
103 evas_map_free(m);
104 FPS_STD(NAME);
105}
106
107/* prepend special key handlers if interactive (before STD) */
108static void _key(char *key)
109{
110 KEY_STD;
111}
112
113
114
115
116
117
118
119
120
121
122
123
124/* template stuff - ignore */
125# endif
126#endif
127
128#ifdef UI
129_ui_menu_item_add(ICON, NAME, FNAME);
130#endif
131
132#ifdef PROTO
133void FNAME(void);
134#endif
135
136#ifndef PROTO
137# ifndef UI
138void FNAME(void)
139{
140 ui_func_set(_key, _loop);
141 _setup();
142}
143# endif
144#endif
145#undef FNAME
146#undef NAME
147#undef ICON
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 66e48b0..79ca9db 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -56,6 +56,8 @@
56#include "image_data_argb_alpha.c" 56#include "image_data_argb_alpha.c"
57#include "image_data_ycbcr601pl.c" 57#include "image_data_ycbcr601pl.c"
58#include "image_data_ycbcr601pl_wide_stride.c" 58#include "image_data_ycbcr601pl_wide_stride.c"
59#include "image_data_ycbcr601pl_map_solid_rotate.c"
60#include "image_data_ycbcr601pl_map_nearest_solid_rotate.c"
59#include "image_crossfade.c" 61#include "image_crossfade.c"
60#include "text_basic.c" 62#include "text_basic.c"
61#include "text_styles.c" 63#include "text_styles.c"
diff --git a/src/bin/ui.c b/src/bin/ui.c
index 98c44e1..30f2b9f 100644
--- a/src/bin/ui.c
+++ b/src/bin/ui.c
@@ -110,6 +110,8 @@ static double weights[] =
110 23.4462, 110 23.4462,
111 14.7573, 111 14.7573,
112 36.5261, 112 36.5261,
113 5.0000,
114 5.0000,
113 24.3482, 115 24.3482,
114 10.4611, 116 10.4611,
115 86.0290, 117 86.0290,
@@ -136,8 +138,12 @@ static double weights[] =
136 22.0342, 138 22.0342,
137 38.2952, 139 38.2952,
138 5.5560, 140 5.5560,
139 141 0.5000,
140 0.0 // no final test - add a 0 at the end anyway to pad 142
143 0.0, // no final test - add a 0 at the end anyway to pad
144 0.0,
145 0.0,
146 0.0
141}; 147};
142 148
143static void 149static void