summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-01-11 10:52:33 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-01-11 11:10:41 +0900
commit0529ce56b6fb01e9651e76461e9608e15a040fb3 (patch)
treeb3b3e895f40bf910eaf41a6c0e8c67b5bb0aa174
parentf59b16435137fbf99de4d09e56cb900bb46e95d6 (diff)
images: Fix YUV and other image data tests
-rw-r--r--src/bin/image_data_argb.c60
-rw-r--r--src/bin/image_data_argb_alpha.c47
-rw-r--r--src/bin/image_data_ycbcr601pl.c70
-rw-r--r--src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c67
-rw-r--r--src/bin/image_data_ycbcr601pl_map_solid_rotate.c66
-rw-r--r--src/bin/image_data_ycbcr601pl_wide_stride.c122
6 files changed, 174 insertions, 258 deletions
diff --git a/src/bin/image_data_argb.c b/src/bin/image_data_argb.c
index 5707f36..d5889ce 100644
--- a/src/bin/image_data_argb.c
+++ b/src/bin/image_data_argb.c
@@ -20,13 +20,12 @@ static Evas_Object *o_images[1];
20/* setup */ 20/* setup */
21static void _setup(void) 21static void _setup(void)
22{ 22{
23 int i;
24 Evas_Object *o; 23 Evas_Object *o;
25 void *pixels; 24 Eina_Slice sl;
26 Eina_Slice slice;
27 25
28 pixels = malloc(sizeof (int) * 640 * 480); 26 sl.len = 640 * 480 * 4;
29 for (i = 0; i < 1; i++) 27 sl.mem = malloc(sl.len);
28 for (int i = 0; i < 1; i++)
30 { 29 {
31 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); 30 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
32 o_images[i] = o; 31 o_images[i] = o;
@@ -35,50 +34,53 @@ static void _setup(void)
35 efl_gfx_fill_set(o, 0, 0, 640, 480); 34 efl_gfx_fill_set(o, 0, 0, 640, 480);
36 efl_gfx_size_set(o, 640, 480); 35 efl_gfx_size_set(o, 640, 480);
37 efl_gfx_visible_set(o, EINA_TRUE); 36 efl_gfx_visible_set(o, EINA_TRUE);
38 slice = (Eina_Slice)EINA_SLICE_STR(pixels); 37 efl_gfx_buffer_managed_set(o, &sl, 640, 480, 0, EFL_GFX_COLORSPACE_ARGB8888, 0);
39 efl_gfx_buffer_copy_set(o_images[i], &slice, 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB8888, 0);
40 } 38 }
41 free(pixels);
42 done = 0; 39 done = 0;
43} 40}
44 41
45/* cleanup */ 42/* cleanup */
46static void _cleanup(void) 43static void _cleanup(void)
47{ 44{
48 int i; 45 for (int i = 0; i < 1; i++)
49 for (i = 0; i < 1; i++) efl_del(o_images[i]); 46 {
47 Evas_Object *o = o_images[i];
48 Eina_Slice sl = {};
49
50 efl_gfx_buffer_managed_get(o, &sl, 0);
51 free((void *) sl.mem);
52 efl_del(o);
53 }
50} 54}
51 55
52/* loop - do things */ 56/* loop - do things */
53static void _loop(double t, int f) 57static void _loop(double t, int f)
54{ 58{
55 int i, st; 59 for (int i = 0; i < 1; i++)
56 Evas_Coord x, y, w, h;
57 Eina_Rw_Slice rw_slice;
58
59 for (i = 0; i < 1; i++)
60 { 60 {
61 unsigned int result, *p; 61 Evas_Object *o = o_images[i];
62 int length; 62 unsigned int *data, *p;
63 Evas_Coord x, y, w, h;
64 Eina_Rw_Slice sl = {};
65 int st;
63 66
64 w = 640; 67 w = 640;
65 h = 480; 68 h = 480;
66 x = (win_w / 2) - (w / 2); 69 x = (win_w / 2) - (w / 2);
67 y = (win_h / 2) - (h / 2); 70 y = (win_h / 2) - (h / 2);
68 efl_gfx_position_set(o_images[i], x, y); 71 efl_gfx_position_set(o, x, y);
69 efl_gfx_size_set(o_images[i], w, h); 72 efl_gfx_size_set(o, w, h);
70 efl_gfx_fill_set(o_images[i], 0, 0, w, h); 73 efl_gfx_fill_set(o, 0, 0, w, h);
71 result = efl_gfx_buffer_map(o_images[i], &rw_slice, 74 efl_gfx_buffer_map(o, &sl, EFL_GFX_BUFFER_ACCESS_MODE_WRITE,
72 EFL_GFX_BUFFER_ACCESS_MODE_WRITE, 75 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, 0, &st);
73 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, 0, 76 data = sl.mem;
74 &st); 77 if (!data)
75 if (!result)
76 { 78 {
77 fprintf(stderr, "ERROR: Failed to map image!\n"); 79 fprintf(stderr, "ERROR: Failed to map image!\n");
78 continue; 80 continue;
79 } 81 }
80 st = st >> 2; 82 st = st >> 2;
81 p = rw_slice.mem; 83 p = sl.mem;
82 for (y = 0; y < h; y++) 84 for (y = 0; y < h; y++)
83 { 85 {
84 for (x = 0; x < w; x++) 86 for (x = 0; x < w; x++)
@@ -88,8 +90,8 @@ static void _loop(double t, int f)
88 } 90 }
89 p += (st - w); 91 p += (st - w);
90 } 92 }
91 efl_gfx_buffer_unmap(o_images[i], &rw_slice); 93 efl_gfx_buffer_unmap(o, &sl);
92 efl_gfx_buffer_update_add(o_images[i], 0, 0, w, h); 94 efl_gfx_buffer_update_add(o, 0, 0, w, h);
93 } 95 }
94 FPS_STD(NAME); 96 FPS_STD(NAME);
95} 97}
diff --git a/src/bin/image_data_argb_alpha.c b/src/bin/image_data_argb_alpha.c
index a4cdabe..79f4c54 100644
--- a/src/bin/image_data_argb_alpha.c
+++ b/src/bin/image_data_argb_alpha.c
@@ -20,12 +20,12 @@ static Evas_Object *o_images[1];
20/* setup */ 20/* setup */
21static void _setup(void) 21static void _setup(void)
22{ 22{
23 int i;
24 Evas_Object *o; 23 Evas_Object *o;
25 void *pixels; 24 Eina_Slice sl;
26 25
27 pixels = malloc(sizeof (int) * 640 * 480); 26 sl.len = 640 * 480 * 4;
28 for (i = 0; i < 1; i++) 27 sl.mem = malloc(sl.len);
28 for (int i = 0; i < 1; i++)
29 { 29 {
30 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); 30 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
31 o_images[i] = o; 31 o_images[i] = o;
@@ -34,17 +34,23 @@ static void _setup(void)
34 efl_gfx_fill_set(o, 0, 0, 640, 480); 34 efl_gfx_fill_set(o, 0, 0, 640, 480);
35 efl_gfx_size_set(o, 640, 480); 35 efl_gfx_size_set(o, 640, 480);
36 efl_gfx_visible_set(o, EINA_TRUE); 36 efl_gfx_visible_set(o, EINA_TRUE);
37 efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB8888, 0); 37 efl_gfx_buffer_managed_set(o, &sl, 640, 480, 0, EFL_GFX_COLORSPACE_ARGB8888, 0);
38 } 38 }
39 free(pixels);
40 done = 0; 39 done = 0;
41} 40}
42 41
43/* cleanup */ 42/* cleanup */
44static void _cleanup(void) 43static void _cleanup(void)
45{ 44{
46 int i; 45 for (int i = 0; i < 1; i++)
47 for (i = 0; i < 1; i++) efl_del(o_images[i]); 46 {
47 Evas_Object *o = o_images[i];
48 Eina_Slice sl = {};
49
50 efl_gfx_buffer_managed_get(o, &sl, 0);
51 free((void *) sl.mem);
52 efl_del(o);
53 }
48} 54}
49 55
50/* loop - do things */ 56/* loop - do things */
@@ -52,31 +58,30 @@ static void _loop(double t, int f)
52{ 58{
53 int i, st; 59 int i, st;
54 Evas_Coord x, y, w, h; 60 Evas_Coord x, y, w, h;
55 Eina_Rw_Slice rw_slice;
56 61
57 for (i = 0; i < 1; i++) 62 for (i = 0; i < 1; i++)
58 { 63 {
59 unsigned int result, *p; 64 Evas_Object *o = o_images[i];
65 unsigned int *p;
66 Eina_Rw_Slice sl = {};
60 int a, r, g, b; 67 int a, r, g, b;
61 68
62 w = 640; 69 w = 640;
63 h = 480; 70 h = 480;
64 x = (win_w / 2) - (w / 2); 71 x = (win_w / 2) - (w / 2);
65 y = (win_h / 2) - (h / 2); 72 y = (win_h / 2) - (h / 2);
66 efl_gfx_position_set(o_images[i], x, y); 73 efl_gfx_position_set(o, x, y);
67 efl_gfx_size_set(o_images[i], w, h); 74 efl_gfx_size_set(o, w, h);
68 efl_gfx_fill_set(o_images[i], 0, 0, w, h); 75 efl_gfx_fill_set(o, 0, 0, w, h);
69 result = efl_gfx_buffer_map(o_images[i], &rw_slice, 76 efl_gfx_buffer_map(o, &sl, EFL_GFX_BUFFER_ACCESS_MODE_WRITE,
70 EFL_GFX_BUFFER_ACCESS_MODE_WRITE, 77 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, 0, &st);
71 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB8888, 0, 78 if (!sl.mem)
72 &st);
73 if (!result)
74 { 79 {
75 fprintf(stderr, "ERROR: Failed to map image!\n"); 80 fprintf(stderr, "ERROR: Failed to map image!\n");
76 continue; 81 continue;
77 } 82 }
78 st = st >> 2; 83 st = st >> 2;
79 p = rw_slice.mem; 84 p = sl.mem;
80 for (y = 0; y < h; y++) 85 for (y = 0; y < h; y++)
81 { 86 {
82 for (x = 0; x < w; x++) 87 for (x = 0; x < w; x++)
@@ -97,8 +102,8 @@ static void _loop(double t, int f)
97 } 102 }
98 p += (st - w); 103 p += (st - w);
99 } 104 }
100 efl_gfx_buffer_unmap(o_images[i], &rw_slice); 105 efl_gfx_buffer_unmap(o, &sl);
101 efl_gfx_buffer_update_add(o_images[i], 0, 0, w, h); 106 efl_gfx_buffer_update_add(o, 0, 0, w, h);
102 } 107 }
103 FPS_STD(NAME); 108 FPS_STD(NAME);
104} 109}
diff --git a/src/bin/image_data_ycbcr601pl.c b/src/bin/image_data_ycbcr601pl.c
index 0507b9a..032d5b3 100644
--- a/src/bin/image_data_ycbcr601pl.c
+++ b/src/bin/image_data_ycbcr601pl.c
@@ -16,62 +16,34 @@ static int done = 0;
16 16
17/* private data */ 17/* private data */
18static Evas_Object *o_images[1]; 18static Evas_Object *o_images[1];
19static unsigned char *yp = NULL, *up = NULL, *vp = NULL; 19static Eina_Slice slice[3];
20 20
21/* setup */ 21/* setup */
22static void _setup(void) 22static void _setup(void)
23{ 23{
24 int i, y;
25 FILE *f; 24 FILE *f;
26 unsigned char **lp; 25 for (int i = 0; i < 1; i++)
27 Evas_Object *o;
28 Eina_Slice slice;
29
30 for (i = 0; i < 1; i++)
31 { 26 {
32 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); 27 Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
33 o_images[i] = o; 28 o_images[i] = o;
34 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); 29 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
35 efl_gfx_buffer_alpha_set(o, 0); 30 efl_gfx_buffer_alpha_set(o, 0);
36 efl_gfx_fill_set(o, 0, 0, 640, 480); 31 efl_gfx_fill_set(o, 0, 0, 640, 480);
37 efl_gfx_size_set(o, 640, 480); 32 efl_gfx_size_set(o, 640, 480);
38 efl_gfx_visible_set(o, EINA_TRUE); 33 efl_gfx_visible_set(o, EINA_TRUE);
39 slice.mem = malloc(sizeof (void*) * (480 + 240 + 240));
40 slice.len = (480 + 240 + 240);
41 yp = malloc(640 * 480);
42 up = malloc(320 * 240);
43 vp = malloc(320 * 240);
44 f = fopen(build_path("tp.yuv"), "rb");
45 if (f)
46 {
47 fread(yp, 640 * 480, 1, f);
48 fread(up, 320 * 240, 1, f);
49 fread(vp, 320 * 240, 1, f);
50 fclose(f);
51 }
52 lp = (unsigned char**) slice.bytes;
53 34
54 for (y = 0; y < 480; y++) 35 slice[0].len = 640 * 480;
55 { 36 slice[1].len = 320 * 240;
56 *lp = yp + (y * 640); 37 slice[2].len = 320 * 240;
57 lp++; 38 f = fopen(build_path("tp.yuv"), "rb");
58 } 39 if (!f) continue;
59 for (y = 0; y < 240; y++) 40 for (int p = 0; p < 3; p++)
60 {
61 *lp = up + (y * 320);
62 lp++;
63 }
64 for (y = 0; y < 240; y++)
65 { 41 {
66 *lp = vp + (y * 320); 42 slice[p].mem = malloc(slice[p].len);
67 lp++; 43 fread((void *) slice[p].mem, slice[p].len, 1, f);
44 efl_gfx_buffer_managed_set(o, &slice[p], 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
68 } 45 }
69 /* efl_gfx_buffer_copy_set(o_images[i], &slice, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); */ 46 fclose(f);
70 free(slice.mem);
71 // Not a real copy in fact...
72 /* free(yp); */
73 /* free(up); */
74 /* free(vp); */
75 } 47 }
76 done = 0; 48 done = 0;
77} 49}
@@ -79,12 +51,16 @@ static void _setup(void)
79/* cleanup */ 51/* cleanup */
80static void _cleanup(void) 52static void _cleanup(void)
81{ 53{
82 int i; 54 for (int i = 0; i < 1; i++)
83 for (i = 0; i < 1; i++) efl_del(o_images[i]); 55 {
84 // FIXME: the object is not destroyed anymore so we can't free the data 56 Evas_Object *o = o_images[i];
85 /* free(yp); */ 57 for (int p = 0; p < 3; p++)
86 /* free(up); */ 58 {
87 /* free(vp); */ 59 efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
60 free((void *) slice[p].mem);
61 }
62 efl_del(o);
63 }
88} 64}
89 65
90/* loop - do things */ 66/* loop - do things */
diff --git a/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
index 7413d9f..0a5bcf4 100644
--- a/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
+++ b/src/bin/image_data_ycbcr601pl_map_nearest_solid_rotate.c
@@ -16,60 +16,34 @@ static int done = 0;
16 16
17/* private data */ 17/* private data */
18static Evas_Object *o_images[1]; 18static Evas_Object *o_images[1];
19static unsigned char *yp = NULL, *up = NULL, *vp = NULL; 19static Eina_Slice slice[3];
20 20
21/* setup */ 21/* setup */
22static void _setup(void) 22static void _setup(void)
23{ 23{
24 int i, y;
25 FILE *f; 24 FILE *f;
26 unsigned char **data, **lp; 25 for (int i = 0; i < 1; i++)
27 Evas_Object *o;
28 Eina_Slice slice;
29
30 for (i = 0; i < 1; i++)
31 { 26 {
32 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); 27 Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
33 o_images[i] = o; 28 o_images[i] = o;
34 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); 29 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
35 efl_gfx_buffer_alpha_set(o, 0); 30 efl_gfx_buffer_alpha_set(o, 0);
36 efl_gfx_fill_set(o, 0, 0, 640, 480); 31 efl_gfx_fill_set(o, 0, 0, 640, 480);
37 efl_gfx_size_set(o, 640, 480); 32 efl_gfx_size_set(o, 640, 480);
38 efl_image_smooth_scale_set(o, 0);
39 efl_gfx_visible_set(o, EINA_TRUE); 33 efl_gfx_visible_set(o, EINA_TRUE);
40 data = malloc(sizeof (void*) * (480 + 240 + 240)); 34
41 yp = malloc(640 * 480); 35 slice[0].len = 640 * 480;
42 up = malloc(320 * 240); 36 slice[1].len = 320 * 240;
43 vp = malloc(320 * 240); 37 slice[2].len = 320 * 240;
44 f = fopen(build_path("tp.yuv"), "rb"); 38 f = fopen(build_path("tp.yuv"), "rb");
45 if (f) 39 if (!f) continue;
46 { 40 for (int p = 0; p < 3; p++)
47 fread(yp, 640 * 480, 1, f);
48 fread(up, 320 * 240, 1, f);
49 fread(vp, 320 * 240, 1, f);
50 fclose(f);
51 }
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 { 41 {
60 *lp = up + (y * 320); 42 slice[p].mem = malloc(slice[p].len);
61 lp++; 43 fread((void *) slice[p].mem, slice[p].len, 1, f);
44 efl_gfx_buffer_managed_set(o, &slice[p], 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
62 } 45 }
63 for (y = 0; y < 240; y++) 46 fclose(f);
64 {
65 *lp = vp + (y * 320);
66 lp++;
67 }
68 slice = (Eina_Slice)EINA_SLICE_STR(*data);
69 efl_gfx_buffer_managed_set(o_images[i], &slice, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, 0);
70 free(yp);
71 free(up);
72 free(vp);
73 } 47 }
74 done = 0; 48 done = 0;
75} 49}
@@ -77,11 +51,16 @@ static void _setup(void)
77/* cleanup */ 51/* cleanup */
78static void _cleanup(void) 52static void _cleanup(void)
79{ 53{
80 int i; 54 for (int i = 0; i < 1; i++)
81 for (i = 0; i < 1; i++) efl_del(o_images[i]); 55 {
82 /* free(yp); */ 56 Evas_Object *o = o_images[i];
83 /* free(up); */ 57 for (int p = 0; p < 3; p++)
84 /* free(vp); */ 58 {
59 efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
60 free((void *) slice[p].mem);
61 }
62 efl_del(o);
63 }
85} 64}
86 65
87/* loop - do things */ 66/* loop - do things */
diff --git a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
index af45b33..355293f 100644
--- a/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
+++ b/src/bin/image_data_ycbcr601pl_map_solid_rotate.c
@@ -16,59 +16,34 @@ static int done = 0;
16 16
17/* private data */ 17/* private data */
18static Evas_Object *o_images[1]; 18static Evas_Object *o_images[1];
19static unsigned char *yp = NULL, *up = NULL, *vp = NULL; 19static Eina_Slice slice[3];
20 20
21/* setup */ 21/* setup */
22static void _setup(void) 22static void _setup(void)
23{ 23{
24 int i, y;
25 FILE *f; 24 FILE *f;
26 unsigned char **data, **lp; 25 for (int i = 0; i < 1; i++)
27 Evas_Object *o;
28 Eina_Slice slice;
29
30 for (i = 0; i < 1; i++)
31 { 26 {
32 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); 27 Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
33 o_images[i] = o; 28 o_images[i] = o;
34 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); 29 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
35 efl_gfx_buffer_alpha_set(o, 0); 30 efl_gfx_buffer_alpha_set(o, 0);
36 efl_gfx_fill_set(o, 0, 0, 640, 480); 31 efl_gfx_fill_set(o, 0, 0, 640, 480);
37 efl_gfx_size_set(o, 640, 480); 32 efl_gfx_size_set(o, 640, 480);
38 efl_gfx_visible_set(o, EINA_TRUE); 33 efl_gfx_visible_set(o, EINA_TRUE);
39 data = malloc(sizeof (void*) * (480 + 240 + 240)); 34
40 yp = malloc(640 * 480); 35 slice[0].len = 640 * 480;
41 up = malloc(320 * 240); 36 slice[1].len = 320 * 240;
42 vp = malloc(320 * 240); 37 slice[2].len = 320 * 240;
43 f = fopen(build_path("tp.yuv"), "rb"); 38 f = fopen(build_path("tp.yuv"), "rb");
44 if (f) 39 if (!f) continue;
45 { 40 for (int p = 0; p < 3; p++)
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 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 { 41 {
59 *lp = up + (y * 320); 42 slice[p].mem = malloc(slice[p].len);
60 lp++; 43 fread((void *) slice[p].mem, slice[p].len, 1, f);
44 efl_gfx_buffer_managed_set(o, &slice[p], 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
61 } 45 }
62 for (y = 0; y < 240; y++) 46 fclose(f);
63 {
64 *lp = vp + (y * 320);
65 lp++;
66 }
67 slice = (Eina_Slice)EINA_SLICE_STR(*data);
68 efl_gfx_buffer_managed_set(o_images[i], &slice, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, 0);
69 free(yp);
70 free(up);
71 free(vp);
72 } 47 }
73 done = 0; 48 done = 0;
74} 49}
@@ -76,11 +51,16 @@ static void _setup(void)
76/* cleanup */ 51/* cleanup */
77static void _cleanup(void) 52static void _cleanup(void)
78{ 53{
79 int i; 54 for (int i = 0; i < 1; i++)
80 for (i = 0; i < 1; i++) efl_del(o_images[i]); 55 {
81 /* free(yp); */ 56 Evas_Object *o = o_images[i];
82 /* free(up); */ 57 for (int p = 0; p < 3; p++)
83 /* free(vp); */ 58 {
59 efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
60 free((void *) slice[p].mem);
61 }
62 efl_del(o);
63 }
84} 64}
85 65
86/* loop - do things */ 66/* loop - do things */
diff --git a/src/bin/image_data_ycbcr601pl_wide_stride.c b/src/bin/image_data_ycbcr601pl_wide_stride.c
index b004a61..d4e8fa2 100644
--- a/src/bin/image_data_ycbcr601pl_wide_stride.c
+++ b/src/bin/image_data_ycbcr601pl_wide_stride.c
@@ -16,60 +16,40 @@ static int done = 0;
16 16
17/* private data */ 17/* private data */
18static Evas_Object *o_images[1]; 18static Evas_Object *o_images[1];
19static unsigned char *yp = NULL, *up = NULL, *vp = NULL; 19static Eina_Slice slice[3];
20 20
21/* setup */ 21/* setup */
22static void _setup(void) 22static void _setup(void)
23{ 23{
24 int i, y; 24 int stride;
25 FILE *f; 25 FILE *f;
26 unsigned char **data, **lp; 26 int w = 320 - 16;
27 Evas_Object *o; 27 for (int i = 0; i < 1; i++)
28 Eina_Slice slice;
29
30 for (i = 0; i < 1; i++)
31 { 28 {
32 o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); 29 Evas_Object *o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
33 o_images[i] = o; 30 o_images[i] = o;
34 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); 31 efl_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
35 efl_gfx_buffer_alpha_set(o, 0); 32 efl_gfx_buffer_alpha_set(o, 0);
36 efl_gfx_fill_set(o, 0, 0, 640, 480); 33 efl_gfx_fill_set(o, 0, 0, 640, 480);
37 efl_gfx_size_set(o, 640, 480); 34 efl_gfx_size_set(o, 640, 480);
38 efl_gfx_visible_set(o, EINA_TRUE); 35 efl_gfx_visible_set(o, EINA_TRUE);
39 data = malloc(sizeof (unsigned char*) * (480 + 240 + 240)); 36
40 yp = malloc(640 * 480); 37 // in this test, the stride is 640 but the width changes
41 up = malloc(320 * 240); 38 slice[0].len = 640 * 480;
42 vp = malloc(320 * 240); 39 slice[1].len = 320 * 240;
40 slice[2].len = 320 * 240;
43 f = fopen(build_path("tp.yuv"), "rb"); 41 f = fopen(build_path("tp.yuv"), "rb");
44 if (f) 42 if (!f) continue;
43 stride = 640;
44 for (int p = 0; p < 3; p++)
45 { 45 {
46 fread(yp, 640 * 480, 1, f); 46 slice[p].mem = malloc(slice[p].len);
47 fread(up, 320 * 240, 1, f); 47 fread((void *) slice[p].mem, slice[p].len, 1, f);
48 fread(vp, 320 * 240, 1, f); 48 efl_gfx_buffer_managed_set(o, &slice[p], w, 480, stride,
49 fclose(f); 49 EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
50 stride = 320;
50 } 51 }
51 lp = data; 52 fclose(f);
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 slice = (Eina_Slice)EINA_SLICE_STR(*data);
68 efl_gfx_buffer_managed_set(o_images[i], &slice, 640, 480, 0, EFL_GFX_COLORSPACE_YCBCR422P601_PL, 0);
69 efl_gfx_buffer_update_add(o_images[i], 0, 0, 320, 480);
70 free(yp);
71 free(up);
72 free(vp);
73 } 53 }
74 done = 0; 54 done = 0;
75} 55}
@@ -77,11 +57,17 @@ static void _setup(void)
77/* cleanup */ 57/* cleanup */
78static void _cleanup(void) 58static void _cleanup(void)
79{ 59{
80 int i; 60 for (int i = 0; i < 1; i++)
81 for (i = 0; i < 1; i++) efl_del(o_images[i]); 61 {
82 /* free(yp); */ 62 Evas_Object *o = o_images[i];
83 /* free(up); */ 63 for (int p = 0; p < 3; p++)
84 /* free(vp); */ 64 {
65 efl_gfx_buffer_managed_set(o, NULL, 640, 480, 0,
66 EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
67 free((void *) slice[p].mem);
68 }
69 efl_del(o);
70 }
85} 71}
86 72
87/* loop - do things */ 73/* loop - do things */
@@ -89,47 +75,35 @@ static void _loop(double t, int f)
89{ 75{
90 int i; 76 int i;
91 Evas_Coord x, y, w, h; 77 Evas_Coord x, y, w, h;
92 Eina_Slice slice;
93 for (i = 0; i < 1; i++) 78 for (i = 0; i < 1; i++)
94 { 79 {
95 unsigned char **lp; 80 Evas_Object *o = o_images[i];
81 Eina_Slice sl[3];
82 int stride;
83
84 for (int p = 0; p < 3; p++)
85 efl_gfx_buffer_managed_get(o, &sl[p], p);
96 86
97 w = 640; 87 w = 640;
98 h = 480; 88 h = 480;
99 x = (win_w / 2) - (w / 2); 89 x = (win_w / 2) - (w / 2);
100 y = (win_h / 2) - (h / 2); 90 y = (win_h / 2) - (h / 2);
101 efl_gfx_position_set(o_images[i], x, y); 91 efl_gfx_position_set(o, x, y);
102 efl_gfx_size_set(o_images[i], w, h); 92 efl_gfx_size_set(o, w, h);
103 efl_gfx_fill_set(o_images[i], 0, 0, w, h); 93 efl_gfx_fill_set(o, 0, 0, w, h);
104
105 w = 320 - 16 + f;
106 if (w < 1) w = 1;
107 else if (w > 640) w = 640;
108 94
109 w &= ~0x1; 95 // logic here differs a bit from old expedite
96 w = 320 - 16 + (f * 2) % 336;
97 if (w > 640) w = 320;
110 98
111 slice.mem = malloc(sizeof (void*) * (480 + 240 + 240)); 99 stride = 640;
112 slice.len = (480 + 240 + 240); 100 for (int p = 0; p < 3; p++)
113 lp = slice.mem;
114 for (y = 0; y < 480; y++)
115 { 101 {
116 *lp = yp + (y * 640); 102 efl_gfx_buffer_managed_set(o, &sl[p], w, 480, stride,
117 lp++; 103 EFL_GFX_COLORSPACE_YCBCR422P601_PL, p);
104 stride = 320;
118 } 105 }
119 for (y = 0; y < 240; y++) 106 efl_gfx_buffer_update_add(o, 0, 0, w, 480);
120 {
121 *lp = up + (y * 320);
122 lp++;
123 }
124 for (y = 0; y < 240; y++)
125 {
126 *lp = vp + (y * 320);
127 lp++;
128 }
129
130 /* efl_gfx_buffer_copy_set(o_images[i], &slice, w, 480, w * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); */
131 efl_gfx_buffer_update_add(o_images[i], 0, 0, w, 480);
132 free(slice.mem);
133 } 107 }
134 FPS_STD(NAME); 108 FPS_STD(NAME);
135} 109}