[FFmpeg-devel] [PATCH 4/5] avcodec/proresenc_anatoliy: do not write into alpha reserved bitfields

Clément Bœsch u at pkh.me
Mon Dec 11 21:06:54 EET 2023


This byte represents 4 reserved bits followed by 4 alpha_channel_type bits.

alpha_channel_type currently has 3 differents defined values: 0 (no
alpha), 1 (8b alpha), and 2 (16b alpha), all the other values are
reserved. The 4 initial reserved bits are expected to be 0.
---
 libavcodec/proresenc_anatoliy.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 6925dfe4bc..727199ed3b 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -776,15 +776,8 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                                       pict->color_trc, valid_trc, 0);
     *buf++ = int_from_list_or_default(avctx, "frame colorspace",
                                       pict->colorspace, valid_colorspace, 0);
-    if (avctx->profile >= AV_PROFILE_PRORES_4444) {
-        if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10) {
-            *buf++ = 0xA0;/* src b64a and no alpha */
-        } else {
-            *buf++ = 0xA2;/* src b64a and 16b alpha */
-        }
-    } else {
-        *buf++ = 32;/* src v210 and no alpha */
-    }
+    if (ctx->need_alpha)
+        *buf++ = 0x2; /* 16-bit alpha */
     *buf++ = 0; /* reserved */
     *buf++ = 3; /* luma and chroma matrix present */
 
-- 
2.43.0



More information about the ffmpeg-devel mailing list