summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-09 17:58:55 +0200
committerwm4 <wm4@nowhere>2020-05-09 18:02:57 +0200
commit56dbbc38479bd84905ac4478b1b853e907a583dd (patch)
treeacba46ed960fbd2fe0053985e34ac4c5fe11cfde /video/mp_image.c
parent9e480850432c05e20bcb4c6d296bb08e5c757d18 (diff)
downloadmpv-56dbbc38479bd84905ac4478b1b853e907a583dd.tar.bz2
mpv-56dbbc38479bd84905ac4478b1b853e907a583dd.tar.xz
video: add yuv float formats
Adding all these so I can use them for obscure processing purposes (see later draw_bmp commit). There isn't really a reason why they should exist. On the other hand, they're just labels for formats that can be handled in a generic way, and this commit adds support for them in the zimg wrapper and vo_gpu just by making the formats exist. (Well, vo_gpu had to be fixed in the previous commit.)
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index cd0fe17713..cc581013da 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -563,24 +563,27 @@ void mp_image_clear(struct mp_image *img, int x0, int y0, int x1, int y1)
struct mp_image area = *img;
mp_image_crop(&area, x0, y0, x1, y1);
+ enum mp_component_type ctype = mp_imgfmt_get_component_type(img->imgfmt);
uint32_t plane_clear[MP_MAX_PLANES] = {0};
- if (area.imgfmt == IMGFMT_UYVY) {
- plane_clear[0] = av_le2ne16(0x0080);
- } else if (area.fmt.flags & MP_IMGFLAG_YUV_NV) {
- plane_clear[1] = 0x8080;
- } else if (area.fmt.flags & MP_IMGFLAG_YUV_P) {
- uint16_t chroma_clear = (1 << area.fmt.plane_bits) / 2;
- if (!(area.fmt.flags & MP_IMGFLAG_NE))
- chroma_clear = av_bswap16(chroma_clear);
- if (area.num_planes > 2)
- plane_clear[1] = plane_clear[2] = chroma_clear;
+ if (ctype != MP_COMPONENT_TYPE_FLOAT) {
+ if (area.imgfmt == IMGFMT_UYVY) {
+ plane_clear[0] = av_le2ne16(0x0080);
+ } else if (area.fmt.flags & MP_IMGFLAG_YUV_NV) {
+ plane_clear[1] = 0x8080;
+ } else if (area.fmt.flags & MP_IMGFLAG_YUV_P) {
+ uint16_t chroma_clear = (1 << area.fmt.plane_bits) / 2;
+ if (!(area.fmt.flags & MP_IMGFLAG_NE))
+ chroma_clear = av_bswap16(chroma_clear);
+ if (area.num_planes > 2)
+ plane_clear[1] = plane_clear[2] = chroma_clear;
+ }
}
for (int p = 0; p < area.num_planes; p++) {
int bpp = area.fmt.bpp[p];
int bytes = (mp_image_plane_w(&area, p) * bpp + 7) / 8;
- if (bpp <= 8) {
+ if (bpp <= 8 || bpp > 16) {
memset_pic(area.planes[p], plane_clear[p], bytes,
mp_image_plane_h(&area, p), area.stride[p]);
} else {