mirror of https://github.com/mpv-player/mpv
gl_video: support NV21 too
This commit is contained in:
parent
120d6bf57c
commit
4221417875
|
@ -690,13 +690,14 @@ static void compile_shaders(struct gl_video *p)
|
||||||
bool convert_input_to_linear = !p->is_linear_rgb &&
|
bool convert_input_to_linear = !p->is_linear_rgb &&
|
||||||
(p->opts.srgb || p->use_lut_3d);
|
(p->opts.srgb || p->use_lut_3d);
|
||||||
|
|
||||||
if (p->image_format == IMGFMT_NV12) {
|
if (p->image_format == IMGFMT_NV12 || p->image_format == IMGFMT_NV21) {
|
||||||
shader_def(&header_conv, "USE_CONV", "CONV_NV12");
|
shader_def(&header_conv, "USE_CONV", "CONV_NV12");
|
||||||
} else if (p->plane_count > 1) {
|
} else if (p->plane_count > 1) {
|
||||||
shader_def(&header_conv, "USE_CONV", "CONV_PLANAR");
|
shader_def(&header_conv, "USE_CONV", "CONV_PLANAR");
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_def_opt(&header_conv, "USE_GBRP", p->image_format == IMGFMT_GBRP);
|
shader_def_opt(&header_conv, "USE_GBRP", p->image_format == IMGFMT_GBRP);
|
||||||
|
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->plane_count == 1);
|
||||||
shader_def_opt(&header_conv, "USE_COLORMATRIX", p->is_yuv);
|
shader_def_opt(&header_conv, "USE_COLORMATRIX", p->is_yuv);
|
||||||
shader_def_opt(&header_conv, "USE_LINEAR_CONV", convert_input_to_linear);
|
shader_def_opt(&header_conv, "USE_LINEAR_CONV", convert_input_to_linear);
|
||||||
|
@ -1609,7 +1610,7 @@ static bool init_format(int fmt, struct gl_video *init)
|
||||||
}
|
}
|
||||||
|
|
||||||
// YUV/half-packed
|
// YUV/half-packed
|
||||||
if (!supported && fmt == IMGFMT_NV12) {
|
if (!supported && (fmt == IMGFMT_NV12 || fmt == IMGFMT_NV21)) {
|
||||||
supported = true;
|
supported = true;
|
||||||
plane_format[0] = IMGFMT_Y8;
|
plane_format[0] = IMGFMT_Y8;
|
||||||
plane_format[1] = IMGFMT_YA8;
|
plane_format[1] = IMGFMT_YA8;
|
||||||
|
|
|
@ -332,6 +332,9 @@ void main() {
|
||||||
#ifdef USE_GBRP
|
#ifdef USE_GBRP
|
||||||
color.gbr = color;
|
color.gbr = color;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_SWAP_UV
|
||||||
|
color.rbg = color;
|
||||||
|
#endif
|
||||||
#ifdef USE_YGRAY
|
#ifdef USE_YGRAY
|
||||||
// NOTE: actually slightly wrong for 16 bit input video, and completely
|
// NOTE: actually slightly wrong for 16 bit input video, and completely
|
||||||
// wrong for 9/10 bit input
|
// wrong for 9/10 bit input
|
||||||
|
|
Loading…
Reference in New Issue