diff mbox series

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

Message ID 20231211190908.1882569-5-u@pkh.me
State New
Headers show
Series [FFmpeg-devel,1/5] avcodec/proresenc_anatoliy: use a compatible bitstream version | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Clément Bœsch Dec. 11, 2023, 7:06 p.m. UTC
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 mbox series

Patch

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 */