From 4b4e4b56909a07f1738d75c0f3fc1739990adfc9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 21 Oct 2012 17:08:54 +0200 Subject: draw_bmp: fix for yuy2 format mp_get_chroma_shift() modifies its argument even if it fails, so we have to restore that. mp_image didn't set chroma shifts for yuy2. --- libmpcodecs/mp_image.c | 3 +++ sub/draw_bmp.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c index 1ba9e8e753..f01e416b01 100644 --- a/libmpcodecs/mp_image.c +++ b/libmpcodecs/mp_image.c @@ -196,6 +196,9 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ mpi->flags|=MP_IMGFLAG_SWAPPED; case IMGFMT_YUY2: mpi->chroma_x_shift = 1; + mpi->chroma_y_shift = 1; + mpi->chroma_width=(mpi->width>>1); + mpi->chroma_height=(mpi->height>>1); mpi->bpp=16; mpi->num_planes=1; return; diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index 9945a8fc89..5adc446ba6 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -511,7 +511,8 @@ void mp_draw_sub_bitmaps(struct mp_draw_sub_cache **cache, struct mp_image *dst, bits = 16; break; } - } + } else + bits = 16; } #else int format = IMGFMT_444P; -- cgit v1.2.3