[FFmpeg-devel] [PATCH 04/16] swscale/output: use isDataInHighBits for 10-bit case

rcombs rcombs at rcombs.me
Fri Dec 24 05:08:52 EET 2021


This code will need fleshing-out (probably templating) if we ever add
e.g. a P012 format.
---
 libswscale/output.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index e43eb7835e..7cedb145aa 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2597,9 +2597,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
     enum AVPixelFormat dstFormat = c->dstFormat;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
 
-    if (dstFormat == AV_PIX_FMT_P010LE || dstFormat == AV_PIX_FMT_P010BE ||
-        dstFormat == AV_PIX_FMT_P210LE || dstFormat == AV_PIX_FMT_P210BE ||
-        dstFormat == AV_PIX_FMT_P410LE || dstFormat == AV_PIX_FMT_P410BE) {
+    if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
+        av_assert0(desc->comp[0].depth == 10);
         *yuv2plane1 = isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
         *yuv2planeX = isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
         *yuv2nv12cX = isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
-- 
2.33.1



More information about the ffmpeg-devel mailing list