yuv pixel import api (well arbitary pixel format import api) for doing media

sreams (video) via image objects


SVN revision: 8068
This commit is contained in:
Carsten Haitzler 2003-12-10 01:12:13 +00:00
parent 2bd12227d7
commit 58d0647f41
9 changed files with 232 additions and 7 deletions

View File

@ -51,6 +51,7 @@
#undef BUILD_CONVERT_32_RGB_ROT0
#undef BUILD_CONVERT_32_RGB_ROT270
#undef BUILD_CONVERT_32_RGB_ROT90
#undef BUILD_CONVERT_YUV
#undef BUILD_SCALE_SAMPLE
#undef BUILD_SCALE_SMOOTH
#undef BUILD_SCALE_TRILINEAR

View File

@ -33,4 +33,5 @@ rm config.cache
--enable-convert-32-rgb-rot-0 \
--enable-convert-32-rgb-rot-90 \
--enable-convert-32-rgb-rot-270 \
--enable-convert-yuv \
$@

View File

@ -737,6 +737,19 @@ AC_ARG_ENABLE(convert-32-rgb-rot-90,
], AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(whether to build yuv converter code)
AC_ARG_ENABLE(convert-yuv,
[ --enable-convert-yuv enable yuv converter code], [
if [ test "$enableval" = "yes" ]; then
AC_MSG_RESULT(yes)
AC_DEFINE(BUILD_CONVERT_YUV)
else
AC_MSG_RESULT(no)
fi
], AC_MSG_RESULT(no)
)
AC_SUBST(freetype_cflags)

View File

@ -92,6 +92,7 @@ struct _Evas_Smart_Class /** a smart object class */
#endif
#endif
typedef struct _Evas_Pixel_Import_Source Evas_Pixel_Import_Source; /**< A source description of pixels for importing pixels */
typedef struct _Evas_Engine_Info Evas_Engine_Info; /**< A generic Evas Engine information structure */
typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down; /**< Event structure for #EVAS_CALLBACK_MOUSE_DOWN event callbacks */
typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up; /**< Event structure for #EVAS_CALLBACK_MOUSE_UP event callbacks */
@ -114,6 +115,17 @@ typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; /**< Event structure fo
#define EVAS_ALLOC_ERROR_FATAL 1 /**< Allocation failed despite attempts to free up memory */
#define EVAS_ALLOC_ERROR_RECOVERED 2 /**< Allocation succeeded, but extra memory had to be found by freeing up speculative resources */
struct _Evas_Pixel_Import_Source
{
int format; /**< pixel format type ie ARGB32, YUV420P_601 etc. */
int w, h; /**< width and height of source in pixels */
void **rows; /**< an array of pointers (size depends on format) pointing to left edge of each scanline */
};
#define EVAS_PIXEL_FORMAT_NONE 0 /**< No pixel format */
#define EVAS_PIXEL_FORMAT_ARGB32 1 /**< ARGB 32bit pixel format with A in the high byte per 32bit pixel word */
#define EVAS_PIXEL_FORMAT_YUV420P_601 2 /**< YUV 420 Planar format with CCIR 601 color encoding wuth contiguous planes in the order Y, U and V */
struct _Evas_Engine_Info /** Generic engine information. Generic info is useless */
{
int magic; /**< Magic number */
@ -334,6 +346,10 @@ extern "C" {
void evas_object_image_smooth_scale_set(Evas_Object *obj, Evas_Bool smooth_scale);
Evas_Bool evas_object_image_smooth_scale_get(Evas_Object *obj);
void evas_object_image_reload (Evas_Object *obj);
Evas_Bool evas_object_image_pixels_import (Evas_Object *obj, Evas_Pixel_Import_Source *pixels);
void evas_object_image_pixels_get_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *o), void *data);
void evas_object_image_pixels_dirty_set (Evas_Object *obj, Evas_Bool dirty);
Evas_Bool evas_object_image_pixels_dirty_get (Evas_Object *obj);
void evas_image_cache_flush (Evas *e);
void evas_image_cache_reload (Evas *e);

View File

@ -31,10 +31,16 @@ struct _Evas_Object_Image
} cur, prev;
char changed : 1;
char dirty_pixels : 1;
int load_error;
Evas_List *pixel_updates;
struct {
void (*get_pixels) (void *data, Evas_Object *o);
void *get_pixels_data;
} func;
void *engine_data;
};
@ -654,8 +660,166 @@ evas_object_image_reload(Evas_Object *obj)
o->changed = 1;
evas_object_change(obj);
}
/**
* To be documented.
*
* FIXME: To be fixed.
*
*/
Evas_Bool
evas_object_image_pixels_import(Evas_Object *obj, Evas_Pixel_Import_Source *pixels)
{
Evas_Object_Image *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return 0;
MAGIC_CHECK_END();
o = (Evas_Object_Image *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return 0;
MAGIC_CHECK_END();
if ((pixels->w != o->cur.image.w) || (pixels->h != o->cur.image.h)) return 0;
switch (pixels->format)
{
#if 0
case EVAS_PIXEL_FORMAT_ARGB32:
{
if (o->engine_data)
{
DATA32 *image_pixels = NULL;
o->engine_data =
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
o->engine_data,
1,
&image_pixels);
/* FIXME: need to actualyl support this */
/* memcpy(image_pixels, pixels->rows, o->cur.image.w * o->cur.image.h * 4);*/
if (o->engine_data)
o->engine_data =
obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
o->engine_data,
image_pixels);
if (o->engine_data)
o->engine_data =
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
o->engine_data,
o->cur.has_alpha);
o->changed = 1;
evas_object_change(obj);
}
}
break;
#endif
#ifdef BUILD_CONVERT_YUV
case EVAS_PIXEL_FORMAT_YUV420P_601:
{
if (o->engine_data)
{
DATA32 *image_pixels = NULL;
o->engine_data =
obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
o->engine_data,
1,
&image_pixels);
if (image_pixels)
evas_common_convert_yuv_420p_601_rgba(pixels->rows,
image_pixels,
o->cur.image.w,
o->cur.image.h);
if (o->engine_data)
o->engine_data =
obj->layer->evas->engine.func->image_data_put(obj->layer->evas->engine.data.output,
o->engine_data,
image_pixels);
if (o->engine_data)
o->engine_data =
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
o->engine_data,
o->cur.has_alpha);
o->changed = 1;
evas_object_change(obj);
}
}
break;
#endif
default:
return 0;
break;
}
return 1;
}
/**
* To be documented.
*
* FIXME: To be fixed.
*
*/
void
evas_object_image_pixels_get_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *o), void *data)
{
Evas_Object_Image *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Image *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return;
MAGIC_CHECK_END();
o->func.get_pixels = func;
o->func.get_pixels_data = data;
}
/**
* To be documented.
*
* FIXME: To be fixed.
*
*/
void
evas_object_image_pixels_dirty_set(Evas_Object *obj, Evas_Bool dirty)
{
Evas_Object_Image *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
o = (Evas_Object_Image *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return;
MAGIC_CHECK_END();
if (dirty) o->dirty_pixels = 1;
else o->dirty_pixels = 0;
o->changed = 1;
evas_object_change(obj);
}
/**
* To be documented.
*
* FIXME: To be fixed.
*
*/
Evas_Bool
evas_object_image_pixels_dirty_get(Evas_Object *obj)
{
Evas_Object_Image *o;
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return 0;
MAGIC_CHECK_END();
o = (Evas_Object_Image *)(obj->object_data);
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return 0;
MAGIC_CHECK_END();
if (o->dirty_pixels) return 1;
return 0;
}
/**
* To be documented.
@ -964,7 +1128,13 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
{
Evas_Coord idw, idh, idx, idy;
int ix, iy, iw, ih;
if (o->dirty_pixels)
{
if (o->func.get_pixels)
o->func.get_pixels(o->func.get_pixels_data, obj);
o->dirty_pixels = 0;
}
idx = evas_object_image_figure_x_fill(obj, o->cur.fill.x, o->cur.fill.w, &idw);
idy = evas_object_image_figure_y_fill(obj, o->cur.fill.y, o->cur.fill.h, &idh);
if (idw < 1.0) idw = 1.0;
@ -1186,6 +1356,11 @@ evas_object_image_render_pre(Evas_Object *obj)
updates = evas_object_render_pre_prev_cur_add(updates, obj);
goto done;
}
if (o->dirty_pixels)
{
updates = evas_object_render_pre_prev_cur_add(updates, obj);
goto done;
}
}
/* if it changed geometry - and obviously not visibility or color */
/* caluclate differences since we have a constant color fill */

View File

@ -31,6 +31,7 @@ evas_convert_rgb_16.c \
evas_convert_rgb_24.c \
evas_convert_rgb_32.c \
evas_convert_rgb_8.c \
evas_convert_yuv.c \
evas_cpu.c \
evas_draw_main.c \
evas_font_draw.c \

View File

@ -15,7 +15,12 @@ evas_common_cpu_catch_ill(int sig)
longjmp(detect_buf, 1);
}
#ifdef __i386__
#if ( \
defined __i386__ || \
defined __386__ || \
defined __X86__ || \
defined _M_IX86 || \
defined i386)
void
evas_common_cpu_mmx_test(void)
{
@ -93,7 +98,12 @@ evas_common_cpu_init(void)
if (called) return;
called = 1;
#ifdef __i386__
#if ( \
defined __i386__ || \
defined __386__ || \
defined __X86__ || \
defined _M_IX86 || \
defined i386)
#ifdef BUILD_MMX
cpu_feature_mask |= CPU_FEATURE_MMX *
evas_common_cpu_feature_test(evas_common_cpu_mmx_test);

View File

@ -7,7 +7,13 @@
#include "evas_options.h"
#ifndef __i386__
#if ( \
defined __i386__ || \
defined __386__ || \
defined __X86__ || \
defined _M_IX86 || \
defined i386)
#else
# undef BUILD_MMX
# undef BUILD_SSE
# ifndef BUILD_C
@ -705,6 +711,8 @@ void evas_common_convert_rgba_to_4bpp_gry_1_dith (DATA32 *src, DAT
void evas_common_convert_rgba_to_1bpp_gry_1_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal);
void evas_common_convert_yuv_420p_601_rgba (DATA8 **src, DATA8 *dst, int w, int h);
/****/
void evas_common_scale_init (void);

View File

@ -91,7 +91,7 @@ typedef union {
char b[8]; /* 8 Byte (8-bit) values */
unsigned char ub[8]; /* 8 Unsigned Byte */
float s[2]; /* Single-precision (32-bit) value */
} mmx_t;
} __attribute__ ((aligned (8))) mmx_t;
/* Helper functions for the instruction macros that follow...
(note that memory-to-register, m2r, instructions are nearly
@ -128,7 +128,6 @@ typedef union {
: "=X" (memd) \
: "X" (mems))
/* 1x64 MOVe Quadword
(this is both a load and a store...
in fact, it is the only way to store)
@ -141,6 +140,7 @@ typedef union {
"movq %%mm0, %0" \
: "=X" (vard) \
: "X" (vars))
#define movntq_r2m(reg, var) mmx_r2m(movntq, reg, var)
/* 1x32 MOVe Doubleword