fix YUV 4:2:0 redering

This commit is contained in:
Vincent Torri 2023-07-01 12:14:46 +02:00
parent 6ac46273bb
commit ee02a1ce91
1 changed files with 7 additions and 21 deletions

28
main.c
View File

@ -41,7 +41,6 @@ display_frame_cb(void *data)
FF_Video *v;
ff_ctx->current_frame++;
printf("NEW : %d\n", ff_ctx->current_frame);
while (av_read_frame(ff_ctx->ff->format_ctx, ff_ctx->packet) >= 0)
{
@ -66,18 +65,6 @@ display_frame_cb(void *data)
if (response >= 0)
{
printf("fame %d: size %d x %d ptr %p %p %p stride: %d %d %d\n",
ff_ctx->ff->codec_ctx->frame_number,
ff_ctx->frame->width,
ff_ctx->frame->height,
ff_ctx->frame->data[0],
ff_ctx->frame->data[1],
ff_ctx->frame->data[2],
ff_ctx->frame->linesize[0],
ff_ctx->frame->linesize[1],
ff_ctx->frame->linesize[2]);
evas_object_image_size_set(ff_ctx->img, ff_ctx->frame->width, ff_ctx->frame->height);
evas_object_resize(ff_ctx->img, ff_ctx->frame->width, ff_ctx->frame->height);
if (ff_ctx->frame->format != AV_PIX_FMT_YUV420P)
{
printf("NOOOOOO !");
@ -87,7 +74,6 @@ display_frame_cb(void *data)
evas_object_image_alpha_set(ff_ctx->img, 0);
evas_object_image_colorspace_set(ff_ctx->img, EVAS_COLORSPACE_YCBCR422P601_PL);
evas_object_image_size_set(ff_ctx->img, ff_ctx->frame->width, ff_ctx->frame->height);
evas_object_resize(ff_ctx->img, ff_ctx->frame->width, ff_ctx->frame->height);
unsigned char *iter_src;
unsigned char **data;
unsigned char **iter_dst;
@ -100,12 +86,10 @@ display_frame_cb(void *data)
iter_dst = data;
for (i = 0; i < ff_ctx->frame->height; i++)
{
printf(" i == %d\n", i);
*iter_dst = NULL;
*iter_dst = iter_src;
iter_dst++;
iter_src += ff_ctx->frame->linesize[0];
printf(" **** %d\n", (int)(iter_src - ff_ctx->frame->data[0]));
}
iter_src = ff_ctx->frame->data[1];
@ -218,7 +202,7 @@ int main(int argc, char *argv[])
ecore_evas_init();
ee = ecore_evas_new("software_gdi", 1, 1, 0, 0, NULL);
ee = ecore_evas_new(NULL, 1, 1, 0, 0, NULL);
if (!ee)
{
ecore_evas_shutdown();
@ -229,10 +213,6 @@ int main(int argc, char *argv[])
evas = ecore_evas_get(ee);
o = evas_object_image_filled_add(evas);
evas_object_move(o, 0, 0);
evas_object_show(o);
ff = ff_new();
if (!ff)
{
@ -249,6 +229,8 @@ int main(int argc, char *argv[])
ff_size_get(ff, &w, &h);
print_info(ff, w, h);
o = evas_object_image_filled_add(evas);
FF_Ctx ff_ctx;
ff_ctx.current_frame = 0;
@ -277,6 +259,10 @@ int main(int argc, char *argv[])
return 0;
}
evas_object_move(o, 0, 0);
evas_object_resize(o, w, h);
evas_object_show(o);
ecore_animator_frametime_set(1.0 / ff_fps_get(ff));
anim = ecore_animator_add(display_frame_cb, &ff_ctx);
if (!anim)