This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 748855b227441210a564f2d6861cdd2b81c44168
Author:     Niklas Haas <[email protected]>
AuthorDate: Fri Dec 5 18:49:54 2025 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Tue Dec 9 09:47:48 2025 +0000

    swscale/format: derive fmt_shift() from AVPixFmtDescriptor
    
    XV36 is the odd one out, being a byte-shifted packed format whose components
    don't actually cross any byte boundaries.
---
 libswscale/format.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/libswscale/format.c b/libswscale/format.c
index 7be3685c6c..076990d48d 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -742,36 +742,19 @@ static SwsSwizzleOp swizzle_inv(SwsSwizzleOp swiz) {
 /* Shift factor for MSB aligned formats */
 static int fmt_shift(enum AVPixelFormat fmt)
 {
+    if (is_regular_fmt(fmt)) {
+        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
+        return desc->comp[0].shift;
+    }
+
     switch (fmt) {
-    case AV_PIX_FMT_P010BE:
-    case AV_PIX_FMT_P010LE:
-    case AV_PIX_FMT_P210BE:
-    case AV_PIX_FMT_P210LE:
-    case AV_PIX_FMT_Y210BE:
-    case AV_PIX_FMT_Y210LE:
-    case AV_PIX_FMT_YUV444P10MSBBE:
-    case AV_PIX_FMT_YUV444P10MSBLE:
-    case AV_PIX_FMT_GBRP10MSBBE:
-    case AV_PIX_FMT_GBRP10MSBLE:
-        return 6;
-    case AV_PIX_FMT_P012BE:
-    case AV_PIX_FMT_P012LE:
-    case AV_PIX_FMT_P212BE:
-    case AV_PIX_FMT_P212LE:
-    case AV_PIX_FMT_P412BE:
-    case AV_PIX_FMT_P412LE:
     case AV_PIX_FMT_XV36BE:
     case AV_PIX_FMT_XV36LE:
-    case AV_PIX_FMT_XYZ12BE:
-    case AV_PIX_FMT_XYZ12LE:
-    case AV_PIX_FMT_YUV444P12MSBBE:
-    case AV_PIX_FMT_YUV444P12MSBLE:
-    case AV_PIX_FMT_GBRP12MSBBE:
-    case AV_PIX_FMT_GBRP12MSBLE:
         return 4;
+    default:
+        /* Sub-byte irregular formats are always handled by SWS_OP_(UN)PACK */
+        return 0;
     }
-
-    return 0;
 }
 
 /**

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to