summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-24 01:10:57 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:11 +0100
commit5830d639b8d58b0911510db1ccb5de296adfcb4b (patch)
tree750496d0c09dc293a2ba7a8589a7679535edfc35 /video/mp_image.c
parent3791c226b7f3bebbb63a96b61db67b9dc97ff9b8 (diff)
downloadmpv-5830d639b8d58b0911510db1ccb5de296adfcb4b.tar.bz2
mpv-5830d639b8d58b0911510db1ccb5de296adfcb4b.tar.xz
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.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c18
1 files changed, 7 insertions, 11 deletions
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);
}