diff options
Diffstat (limited to 'video/img_format.c')
-rw-r--r-- | video/img_format.c | 15 |
1 files changed, 15 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; +} |