From 5830d639b8d58b0911510db1ccb5de296adfcb4b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 24 Dec 2012 01:10:57 +0100 Subject: video: remove img_format compat hacks Remove the strange things the old mp_image_setfmt() code did to the image format parameters. This includes setting chroma shift to 31 for gray (Y8) formats and more. Y8 + vo_opengl_old didn't actually work for unknown reasons (regression in this branch). Fix this. The difference is that Y8 is now interpreted as gray RGB (LUMINANCE texture) instead of involving YUV (and levels) conversion. Get rid of distinguishing RGB and BGR. There wasn't really any good reason for this. Remove mp_get_chroma_shift() and IMGFMT_IS_YUVP16*(). mp_imgfmt_desc gives the same information and more. --- video/mp_image.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'video/mp_image.c') diff --git a/video/mp_image.c b/video/mp_image.c index 751949a3d4..4df4d2e17f 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -368,17 +368,13 @@ void mp_image_clear(struct mp_image *mpi, int x0, int y0, int w, int h) #define CLEAR_PACKEDYUV_PATTERN 0x80008000 #define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x00800080 #endif - if (mpi->flags & MP_IMGFLAG_SWAPPED) { - for (i = 0; i < size - 3; i += 4) - p[i] = p[i + 1] = p[i + 2] = p[i + 3] = CLEAR_PACKEDYUV_PATTERN_SWAPPED; - for (; i < size; i++) - p[i] = CLEAR_PACKEDYUV_PATTERN_SWAPPED; - } else { - for (i = 0; i < size - 3; i += 4) - p[i] = p[i + 1] = p[i + 2] = p[i + 3] = CLEAR_PACKEDYUV_PATTERN; - for (; i < size; i++) - p[i] = CLEAR_PACKEDYUV_PATTERN; - } + int clear = CLEAR_PACKEDYUV_PATTERN; + if (mpi->imgfmt == IMGFMT_UYVY) + clear = CLEAR_PACKEDYUV_PATTERN_SWAPPED; + for (i = 0; i < size - 3; i += 4) + p[i] = p[i + 1] = p[i + 2] = p[i + 3] = clear; + for (; i < size; i++) + p[i] = clear; } else memset(dst, 0, (mpi->bpp >> 3) * w); } -- cgit v1.2.3