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

Git pushed a commit to branch master
in repository ffmpeg.

commit d373dfe1572a476f701506cd8fe25e59315856df
Author:     Marton Balint <[email protected]>
AuthorDate: Sat Feb 7 00:58:37 2026 +0100
Commit:     Marton Balint <[email protected]>
CommitDate: Sun Feb 15 20:28:31 2026 +0100

    avcodec/libvpxdec: add support for decoding pixel formats other than YUV420 
with alpha
    
    Signed-off-by: Marton Balint <[email protected]>
---
 libavcodec/libvpxdec.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 1257a3607c..317725bf31 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -140,23 +140,28 @@ static int set_pix_fmt(AVCodecContext *avctx, struct 
vpx_image *img,
 #if CONFIG_LIBVPX_VP9_DECODER
     case VPX_IMG_FMT_I422:
         avctx->profile = AV_PROFILE_VP9_1;
-        avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+        avctx->pix_fmt =
+            has_alpha_channel ? AV_PIX_FMT_YUVA422P : AV_PIX_FMT_YUV422P;
         return 0;
     case VPX_IMG_FMT_I440:
+        //TODO: Add alpha support once the pixel format becomes available
         avctx->profile = AV_PROFILE_VP9_1;
         avctx->pix_fmt = AV_PIX_FMT_YUV440P;
         return 0;
     case VPX_IMG_FMT_I444:
         avctx->profile = AV_PROFILE_VP9_1;
         avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
-                         AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
+                         (has_alpha_channel ? AV_PIX_FMT_GBRAP : 
AV_PIX_FMT_GBRP) :
+                         (has_alpha_channel ? AV_PIX_FMT_YUVA444P : 
AV_PIX_FMT_YUV444P);
         return 0;
     case VPX_IMG_FMT_I42016:
         avctx->profile = AV_PROFILE_VP9_2;
         if (img->bit_depth == 10) {
-            avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
+            avctx->pix_fmt =
+                has_alpha_channel ? AV_PIX_FMT_YUVA420P10 : 
AV_PIX_FMT_YUV420P10;
             return 0;
         } else if (img->bit_depth == 12) {
+            //TODO: Add alpha support once the pixel format becomes available
             avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
             return 0;
         } else {
@@ -165,15 +170,18 @@ static int set_pix_fmt(AVCodecContext *avctx, struct 
vpx_image *img,
     case VPX_IMG_FMT_I42216:
         avctx->profile = AV_PROFILE_VP9_3;
         if (img->bit_depth == 10) {
-            avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+            avctx->pix_fmt =
+                has_alpha_channel ? AV_PIX_FMT_YUVA422P10 : 
AV_PIX_FMT_YUV422P10;
             return 0;
         } else if (img->bit_depth == 12) {
+            //TODO: Add alpha support once the pixel format becomes available
             avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
             return 0;
         } else {
             return AVERROR_INVALIDDATA;
         }
     case VPX_IMG_FMT_I44016:
+        //TODO: Add alpha support once the pixel format becomes available
         avctx->profile = AV_PROFILE_VP9_3;
         if (img->bit_depth == 10) {
             avctx->pix_fmt = AV_PIX_FMT_YUV440P10;
@@ -188,11 +196,13 @@ static int set_pix_fmt(AVCodecContext *avctx, struct 
vpx_image *img,
         avctx->profile = AV_PROFILE_VP9_3;
         if (img->bit_depth == 10) {
             avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
-                             AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
+                             (has_alpha_channel ? AV_PIX_FMT_GBRAP10 : 
AV_PIX_FMT_GBRP10) :
+                             (has_alpha_channel ? AV_PIX_FMT_YUVA444P10 : 
AV_PIX_FMT_YUV444P10);
             return 0;
         } else if (img->bit_depth == 12) {
             avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
-                             AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
+                             (has_alpha_channel ? AV_PIX_FMT_GBRAP12 : 
AV_PIX_FMT_GBRP12) :
+                             (has_alpha_channel ? AV_PIX_FMT_YUVA444P12 : 
AV_PIX_FMT_YUV444P12);
             return 0;
         } else {
             return AVERROR_INVALIDDATA;

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

Reply via email to