summaryrefslogtreecommitdiff
path: root/libswscale/swscale_internal.h
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2018-03-02 09:09:05 -0800
committerPhilip Langdale <philipl@overt.org>2018-03-03 15:20:19 -0800
commitdd3f1e3a1186ac2cd3d4ce71944626a2c3f200f1 (patch)
tree051f19362cacb6adc8b2dff6919eb280ac426705 /libswscale/swscale_internal.h
parent1c7f1f38c533382710361ef7e765f1de4f7dfa78 (diff)
swscale: Introduce a helper to identify semi-planar formats
This cleans up the ever-more-unreadable list of semi-planar exclusions for selecting the planar copy wrapper.
Diffstat (limited to 'libswscale/swscale_internal.h')
-rw-r--r--libswscale/swscale_internal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 0f51df95d7..c9120d8f5f 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -676,6 +676,17 @@ static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
return ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && isYUV(pix_fmt));
}
+/*
+ * Identity semi-planar YUV formats. Specifically, those are YUV formats
+ * where the second and third components (U & V) are on the same plane.
+ */
+static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return (isPlanarYUV(pix_fmt) && desc->comp[1].plane == desc->comp[2].plane);
+}
+
static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);