Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2021-12-23 12:49:27 +0300
committerrcombs <rcombs@rcombs.me>2022-01-05 04:39:22 +0300
commitf8e284be69d6eae480c6d7291763b840959b7bf1 (patch)
treea63c777b33ba068e96c63e73c55dc2c9cf290e95 /libswscale/swscale_internal.h
parentbb4f19f2a27ec2170dee852f7f307fcbc51faba9 (diff)
swscale: introduce isSwappedChroma
Diffstat (limited to 'libswscale/swscale_internal.h')
-rw-r--r--libswscale/swscale_internal.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index b4acaceebd..3a78d95ba6 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -911,6 +911,25 @@ static av_always_inline int isDataInHighBits(enum AVPixelFormat pix_fmt)
return 1;
}
+/*
+ * Identity formats where the chroma planes are swapped (CrCb order).
+ */
+static av_always_inline int isSwappedChroma(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ if (!isYUV(pix_fmt))
+ return 0;
+ if ((desc->flags & AV_PIX_FMT_FLAG_ALPHA) && desc->nb_components < 4)
+ return 0;
+ if (desc->nb_components < 3)
+ return 0;
+ if (!isPlanarYUV(pix_fmt) || isSemiPlanarYUV(pix_fmt))
+ return desc->comp[1].offset > desc->comp[2].offset;
+ else
+ return desc->comp[1].plane > desc->comp[2].plane;
+}
+
extern const uint64_t ff_dither4[2];
extern const uint64_t ff_dither8[2];