2014-09-20 00:43:28 -07:00
|
|
|
|
2014-09-22 23:46:16 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Eo.h"
|
|
|
|
#include "Evas.h"
|
|
|
|
|
|
|
|
#include "Eo.hh"
|
|
|
|
#include "Eina.hh"
|
|
|
|
#include "Evas.hh"
|
2014-09-20 00:43:28 -07:00
|
|
|
|
2014-09-22 23:46:16 -07:00
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
#define EXPEDITE_CXX_TEST_IMPL
|
2014-09-23 17:30:43 -07:00
|
|
|
#include "image_data_ycbcr601pl_wide_stride_capi.h"
|
2014-09-20 00:43:28 -07:00
|
|
|
|
|
|
|
/* standard var */
|
|
|
|
static int done = 0;
|
|
|
|
|
|
|
|
/* private data */
|
2014-09-23 00:16:23 -07:00
|
|
|
static efl::eina::list<evas::image> images;
|
2014-09-20 00:43:28 -07:00
|
|
|
static unsigned char *yp = NULL, *up = NULL, *vp = NULL;
|
|
|
|
|
|
|
|
/* setup */
|
|
|
|
static void _setup(void)
|
|
|
|
{
|
2014-09-23 17:47:37 -07:00
|
|
|
evas::canvas canvas(::eo_ref(G_evas));
|
2014-09-23 20:41:41 -07:00
|
|
|
for (int i = 0; i < 1; i++)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
2014-09-23 17:47:37 -07:00
|
|
|
evas::image o(efl::eo::parent = canvas);
|
|
|
|
images.push_back(o);
|
2014-09-23 20:41:41 -07:00
|
|
|
o.content_hint_set(EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
|
|
|
|
o.colorspace_set(EVAS_COLORSPACE_YCBCR422P601_PL);
|
|
|
|
o.size_set(320, 480);
|
|
|
|
o.alpha_set(0);
|
|
|
|
o.fill_set(0, 0, 640, 480);
|
|
|
|
o.evas::object::size_set(640, 480);
|
|
|
|
o.evas::object::visibility_set(true);
|
2014-09-24 00:13:41 -07:00
|
|
|
yp = static_cast<unsigned char*>(malloc(640 * 480));
|
|
|
|
up = static_cast<unsigned char*>(malloc(320 * 240));
|
|
|
|
vp = static_cast<unsigned char*>(malloc(320 * 240));
|
2014-09-23 20:41:41 -07:00
|
|
|
FILE *f = fopen(build_path("tp.yuv"), "rb");
|
2014-09-20 00:43:28 -07:00
|
|
|
if (f)
|
|
|
|
{
|
|
|
|
fread(yp, 640 * 480, 1, f);
|
|
|
|
fread(up, 320 * 240, 1, f);
|
|
|
|
fread(vp, 320 * 240, 1, f);
|
|
|
|
fclose(f);
|
|
|
|
}
|
2014-09-24 00:13:41 -07:00
|
|
|
unsigned char **data = static_cast<unsigned char**>(o.data_get(1));
|
2014-09-20 00:43:28 -07:00
|
|
|
if (data)
|
|
|
|
{
|
2014-09-24 00:13:41 -07:00
|
|
|
unsigned char **lp = data;
|
2014-09-23 20:41:41 -07:00
|
|
|
for (int y = 0; y < 480; y++)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
|
|
|
*lp = yp + (y * 640);
|
|
|
|
lp++;
|
|
|
|
}
|
2014-09-23 20:41:41 -07:00
|
|
|
for (int y = 0; y < 240; y++)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
|
|
|
*lp = up + (y * 320);
|
|
|
|
lp++;
|
|
|
|
}
|
2014-09-23 20:41:41 -07:00
|
|
|
for (int y = 0; y < 240; y++)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
|
|
|
*lp = vp + (y * 320);
|
|
|
|
lp++;
|
|
|
|
}
|
2014-09-23 20:41:41 -07:00
|
|
|
o.data_set(data);
|
|
|
|
o.data_update_add( 0, 0, 320, 480);
|
2014-09-20 00:43:28 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
done = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
static void _cleanup(void)
|
|
|
|
{
|
2014-10-02 09:24:54 -07:00
|
|
|
for (evas::image& i : images)
|
|
|
|
i.parent_set(efl::eo::base(nullptr));
|
2014-09-23 20:41:41 -07:00
|
|
|
images.clear();
|
2014-09-20 00:43:28 -07:00
|
|
|
free(yp);
|
|
|
|
free(up);
|
|
|
|
free(vp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* loop - do things */
|
|
|
|
static void _loop(double t, int f)
|
|
|
|
{
|
2014-10-02 13:34:55 -07:00
|
|
|
for (evas::image& img : images)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
2014-09-23 20:41:41 -07:00
|
|
|
Evas_Coord w = 640;
|
|
|
|
Evas_Coord h = 480;
|
|
|
|
Evas_Coord x = (win_w / 2) - (w / 2);
|
|
|
|
Evas_Coord y = (win_h / 2) - (h / 2);
|
2014-10-02 13:34:55 -07:00
|
|
|
img.evas::object::position_set(x, y);
|
|
|
|
img.evas::object::size_set(w, h);
|
|
|
|
img.fill_set(0, 0, w, h);
|
2014-09-20 00:43:28 -07:00
|
|
|
|
|
|
|
w = 320 - 16 + f;
|
|
|
|
if (w < 1) w = 1;
|
|
|
|
else if (w > 640) w = 640;
|
|
|
|
|
|
|
|
w &= ~0x1;
|
|
|
|
|
2014-10-02 13:34:55 -07:00
|
|
|
img.size_set(w, 480);
|
|
|
|
unsigned char **data = static_cast<unsigned char**>(img.data_get(1));
|
2014-09-20 00:43:28 -07:00
|
|
|
if (data)
|
|
|
|
{
|
2014-09-23 20:41:41 -07:00
|
|
|
unsigned char **lp = data;
|
|
|
|
for (int y = 0; y < 480; y++)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
|
|
|
*lp = yp + (y * 640);
|
|
|
|
lp++;
|
|
|
|
}
|
2014-09-23 20:41:41 -07:00
|
|
|
for (int y = 0; y < 240; y++)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
|
|
|
*lp = up + (y * 320);
|
|
|
|
lp++;
|
|
|
|
}
|
2014-09-23 20:41:41 -07:00
|
|
|
for (int y = 0; y < 240; y++)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
|
|
|
*lp = vp + (y * 320);
|
|
|
|
lp++;
|
|
|
|
}
|
2014-10-02 13:34:55 -07:00
|
|
|
img.data_set(data);
|
|
|
|
img.data_update_add(0, 0, w, 480);
|
2014-09-20 00:43:28 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FPS_STD(NAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* prepend special key handlers if interactive (before STD) */
|
|
|
|
static void _key(char *key)
|
|
|
|
{
|
|
|
|
KEY_STD;
|
|
|
|
}
|
|
|
|
|
2014-09-22 23:46:16 -07:00
|
|
|
extern "C" void FNAME(void)
|
2014-09-20 00:43:28 -07:00
|
|
|
{
|
|
|
|
ui_func_set(_key, _loop);
|
|
|
|
_setup();
|
|
|
|
}
|