diff options
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r-- | video/out/gl_video.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 4c901965fa..57dec29759 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -170,7 +170,7 @@ struct gl_video { struct mp_imgfmt_desc image_desc; - bool is_yuv, is_rgb; + bool is_yuv, is_rgb, is_packed_yuv; bool is_linear_rgb; bool has_alpha; char color_swizzle[5]; @@ -238,6 +238,12 @@ static const struct fmt_entry gl_byte_formats[] = { {0, GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // 4 x 16 }; +static const struct fmt_entry gl_apple_formats[] = { + {IMGFMT_UYVY, GL_RGB, GL_RGB_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE}, + {IMGFMT_YUYV, GL_RGB, GL_RGB_422_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE}, + {0} +}; + struct packed_fmt_entry { int fmt; int8_t component_size; @@ -872,7 +878,8 @@ static void compile_shaders(struct gl_video *p) if (p->color_swizzle[0]) shader_def(&header_conv, "USE_COLOR_SWIZZLE", p->color_swizzle); shader_def_opt(&header_conv, "USE_SWAP_UV", p->image_format == IMGFMT_NV21); - shader_def_opt(&header_conv, "USE_YGRAY", p->is_yuv && p->plane_count == 1); + shader_def_opt(&header_conv, "USE_YGRAY", p->is_yuv && !p->is_packed_yuv + && p->plane_count == 1); shader_def_opt(&header_conv, "USE_INPUT_GAMMA", convert_input_gamma); shader_def_opt(&header_conv, "USE_COLORMATRIX", !p->is_rgb); shader_def_opt(&header_conv, "USE_CONV_GAMMA", convert_input_to_linear); @@ -2058,6 +2065,20 @@ static bool init_format(int fmt, struct gl_video *init) } } + // Packed YUV Apple formats + if (init->gl->mpgl_caps & MPGL_CAP_APPLE_RGB_422) { + for (const struct fmt_entry *e = gl_apple_formats; e->mp_format; e++) { + if (e->mp_format == fmt) { + init->is_packed_yuv = true; + supported = true; + snprintf(init->color_swizzle, sizeof(init->color_swizzle), + "gbra"); + plane_format[0] = e; + break; + } + } + } + if (!supported) return false; |