From f59b16435137fbf99de4d09e56cb900bb46e95d6 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 27 Dec 2016 11:56:49 -0800 Subject: [PATCH] attempt to use the new buffer_copy_set API. It does currently crash or fails. Seems to me like an evas issue. --- src/bin/image_data_ycbcr601pl.c | 13 ++++++++----- src/bin/image_data_ycbcr601pl_wide_stride.c | 12 +++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/bin/image_data_ycbcr601pl.c b/src/bin/image_data_ycbcr601pl.c index c2ca581..0507b9a 100644 --- a/src/bin/image_data_ycbcr601pl.c +++ b/src/bin/image_data_ycbcr601pl.c @@ -23,8 +23,10 @@ static void _setup(void) { int i, y; FILE *f; - unsigned char *data, **lp; + unsigned char **lp; Evas_Object *o; + Eina_Slice slice; + for (i = 0; i < 1; i++) { o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); @@ -34,7 +36,8 @@ static void _setup(void) efl_gfx_fill_set(o, 0, 0, 640, 480); efl_gfx_size_set(o, 640, 480); efl_gfx_visible_set(o, EINA_TRUE); - data = malloc(sizeof (void*) * (480 + 240 + 240)); + slice.mem = malloc(sizeof (void*) * (480 + 240 + 240)); + slice.len = (480 + 240 + 240); yp = malloc(640 * 480); up = malloc(320 * 240); vp = malloc(320 * 240); @@ -46,7 +49,7 @@ static void _setup(void) fread(vp, 320 * 240, 1, f); fclose(f); } - lp = (unsigned char**) data; + lp = (unsigned char**) slice.bytes; for (y = 0; y < 480; y++) { @@ -63,8 +66,8 @@ static void _setup(void) *lp = vp + (y * 320); lp++; } - efl_gfx_buffer_copy_set(o_images[i], data, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); - free(data); + /* efl_gfx_buffer_copy_set(o_images[i], &slice, 640, 480, 640 * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); */ + free(slice.mem); // Not a real copy in fact... /* free(yp); */ /* free(up); */ diff --git a/src/bin/image_data_ycbcr601pl_wide_stride.c b/src/bin/image_data_ycbcr601pl_wide_stride.c index c9eeb14..b004a61 100644 --- a/src/bin/image_data_ycbcr601pl_wide_stride.c +++ b/src/bin/image_data_ycbcr601pl_wide_stride.c @@ -89,9 +89,10 @@ static void _loop(double t, int f) { int i; Evas_Coord x, y, w, h; + Eina_Slice slice; for (i = 0; i < 1; i++) { - unsigned char **data, **lp; + unsigned char **lp; w = 640; h = 480; @@ -107,8 +108,9 @@ static void _loop(double t, int f) w &= ~0x1; - data = malloc(sizeof (void*) * (480 + 240 + 240)); - lp = data; + slice.mem = malloc(sizeof (void*) * (480 + 240 + 240)); + slice.len = (480 + 240 + 240); + lp = slice.mem; for (y = 0; y < 480; y++) { *lp = yp + (y * 640); @@ -125,9 +127,9 @@ static void _loop(double t, int f) lp++; } - efl_gfx_buffer_copy_set(o_images[i], data, w, 480, w * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); + /* efl_gfx_buffer_copy_set(o_images[i], &slice, w, 480, w * sizeof (int), EVAS_COLORSPACE_YCBCR422P601_PL, 0); */ efl_gfx_buffer_update_add(o_images[i], 0, 0, w, 480); - free(data); + free(slice.mem); } FPS_STD(NAME); }