mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
vo_opengl: move minor helper to common code
The generic image format code should cary most of the "knowledge" about image formats.
This commit is contained in:
@@ -249,6 +249,9 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt)
|
|||||||
desc.plane_bits = 8; // usually restricted to 8 bit; may change
|
desc.plane_bits = 8; // usually restricted to 8 bit; may change
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (desc.chroma_xs || desc.chroma_ys)
|
||||||
|
desc.flags |= MP_IMGFLAG_SUBSAMPLED;
|
||||||
|
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,8 @@
|
|||||||
#define MP_IMGFLAG_PAL 0x8000
|
#define MP_IMGFLAG_PAL 0x8000
|
||||||
// planes don't contain real data; planes[3] contains an API-specific pointer
|
// planes don't contain real data; planes[3] contains an API-specific pointer
|
||||||
#define MP_IMGFLAG_HWACCEL 0x10000
|
#define MP_IMGFLAG_HWACCEL 0x10000
|
||||||
|
// Set if the chroma resolution is lower than luma resolution. Unset for non-YUV.
|
||||||
|
#define MP_IMGFLAG_SUBSAMPLED 0x20000
|
||||||
|
|
||||||
// Exactly one of these bits is set in mp_imgfmt_desc.flags
|
// Exactly one of these bits is set in mp_imgfmt_desc.flags
|
||||||
#define MP_IMGFLAG_COLOR_CLASS_MASK \
|
#define MP_IMGFLAG_COLOR_CLASS_MASK \
|
||||||
|
|||||||
@@ -880,15 +880,6 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return false if RGB or 4:4:4 YUV
|
|
||||||
static bool input_is_subsampled(struct gl_video *p)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < p->plane_count; i++)
|
|
||||||
if (p->image_desc.xs[i] || p->image_desc.ys[i])
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void compile_shaders(struct gl_video *p)
|
static void compile_shaders(struct gl_video *p)
|
||||||
{
|
{
|
||||||
GL *gl = p->gl;
|
GL *gl = p->gl;
|
||||||
@@ -1092,7 +1083,7 @@ static void compile_shaders(struct gl_video *p)
|
|||||||
if (p->plane_count > 1 && !trivial_scaling)
|
if (p->plane_count > 1 && !trivial_scaling)
|
||||||
use_indirect = true;
|
use_indirect = true;
|
||||||
|
|
||||||
if (input_is_subsampled(p)) {
|
if (p->image_desc.flags & MP_IMGFLAG_SUBSAMPLED) {
|
||||||
shader_setup_scaler(&header_conv, &p->scalers[1], -1);
|
shader_setup_scaler(&header_conv, &p->scalers[1], -1);
|
||||||
} else {
|
} else {
|
||||||
// Force using the normal scaler on chroma. If the "indirect" stage is
|
// Force using the normal scaler on chroma. If the "indirect" stage is
|
||||||
|
|||||||
Reference in New Issue
Block a user