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

Stefano Sabatini stefasab at gmail.com
Mon Jan 8 22:10:09 EET 2024


On date Sunday 2024-01-07 19:16:45 +0100, Clément Bœsch wrote:
> 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. This part is correctly written (alpha_bits>>3 does the correct
> thing), but the 4 initial bits are reserved.
> ---
>  libavcodec/proresenc_kostya.c          | 2 +-
>  tests/ref/vsynth/vsynth1-prores_ks     | 2 +-
>  tests/ref/vsynth/vsynth2-prores_ks     | 2 +-
>  tests/ref/vsynth/vsynth3-prores_ks     | 2 +-
>  tests/ref/vsynth/vsynth_lena-prores_ks | 2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
> index de63127192..f6c71c2b86 100644
> --- a/libavcodec/proresenc_kostya.c
> +++ b/libavcodec/proresenc_kostya.c
> @@ -1051,7 +1051,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>      bytestream_put_byte  (&buf, pic->color_primaries);
>      bytestream_put_byte  (&buf, pic->color_trc);
>      bytestream_put_byte  (&buf, pic->colorspace);
> -    bytestream_put_byte  (&buf, 0x40 | (ctx->alpha_bits >> 3));
> +    bytestream_put_byte  (&buf, ctx->alpha_bits >> 3);

Shall be good, I wonder why it was done that way (probably there was
no open specification at the time?).


More information about the ffmpeg-devel mailing list