summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-25 14:54:42 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:11 +0100
commit3791c226b7f3bebbb63a96b61db67b9dc97ff9b8 (patch)
tree63245b495dffcc7a2d31c5f6697d9932120ed4bc /video
parent8751a0e261c0c7150874f78b23c7f1d3539883b5 (diff)
downloadmpv-3791c226b7f3bebbb63a96b61db67b9dc97ff9b8.tar.bz2
mpv-3791c226b7f3bebbb63a96b61db67b9dc97ff9b8.tar.xz
draw_bmp: better way to find 444 format
Even though #ifdef ACCURATE is removed, the result should be about the same. The fallback is only used by packed YUV formats (YUYV, NV12), and doing 16 bit for them instead of 8 bit is not useful. A side effect is that Y8 (gray) is not converted drawing subs, and for alpha formats, the alpha plane is not removed. This means the number of planes after upsampling can be 1-4 (1: gray, 2: gray+alpha, 3: planar, 4: planar+alpha). The code has to be adjusted accordingly to work on the color planes only. Also remove the workaround for the chroma shift 31 hack.
Diffstat (limited to 'video')
-rw-r--r--video/img_format.c15
-rw-r--r--video/img_format.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/video/img_format.c b/video/img_format.c
index bf75ba8a18..4fd2897735 100644
--- a/video/img_format.c
+++ b/video/img_format.c
@@ -310,3 +310,18 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(unsigned int out_fmt)
}
return fmt;
}
+
+// Find a format that is MP_IMGFLAG_YUV_P with the following configuration.
+int mp_imgfmt_find_yuv_planar(int xs, int ys, int planes, int component_bits)
+{
+ for (int n = IMGFMT_START + 1; n < IMGFMT_END; n++) {
+ struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(n);
+ if (desc.id && (desc.flags & MP_IMGFLAG_YUV_P)) {
+ if (desc.num_planes == planes && desc.chroma_xs == xs &&
+ desc.chroma_ys == ys && desc.plane_bits == component_bits &&
+ (desc.flags & MP_IMGFLAG_NE))
+ return desc.id;
+ }
+ }
+ return 0;
+}
diff --git a/video/img_format.h b/video/img_format.h
index 1f617b573b..e75fe35831 100644
--- a/video/img_format.h
+++ b/video/img_format.h
@@ -298,4 +298,6 @@ const char *mp_imgfmt_to_name(unsigned int fmt);
#define vo_format_name mp_imgfmt_to_name
+int mp_imgfmt_find_yuv_planar(int xs, int ys, int planes, int component_bits);
+
#endif /* MPLAYER_IMG_FORMAT_H */