diff mbox series

[FFmpeg-devel,2/5] avcodec/proresenc_kostya: use a compatible bitstream version

Message ID 20240107181647.3049578-2-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
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Clément Bœsch Jan. 7, 2024, 6:16 p.m. UTC
Quoting SMPTE RDD 36:2015:
  A decoder shall abort if it encounters a bitstream with an unsupported
  bitstream_version value. If 0, the value of the chroma_format syntax
  element shall be 2 (4:2:2 sampling) and the value of the
  alpha_channel_type element shall be 0 (no encoded alpha); if 1, any
  permissible value may be used for those syntax elements.

So if we're not in 4:2:2 or if there is alpha, we are not allowed to use
version 0.
---
 libavcodec/proresenc_kostya.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Sabatini Jan. 8, 2024, 7:57 p.m. UTC | #1
On date Sunday 2024-01-07 19:16:44 +0100, Clément Bœsch wrote:
> Quoting SMPTE RDD 36:2015:
>   A decoder shall abort if it encounters a bitstream with an unsupported
>   bitstream_version value. If 0, the value of the chroma_format syntax
>   element shall be 2 (4:2:2 sampling) and the value of the
>   alpha_channel_type element shall be 0 (no encoded alpha); if 1, any
>   permissible value may be used for those syntax elements.
> 
> So if we're not in 4:2:2 or if there is alpha, we are not allowed to use
> version 0.
> ---
>  libavcodec/proresenc_kostya.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
> index 8d45e42d1a..de63127192 100644
> --- a/libavcodec/proresenc_kostya.c
> +++ b/libavcodec/proresenc_kostya.c
> @@ -1037,7 +1037,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>      // frame header
>      tmp = buf;
>      buf += 2;                                   // frame header size will be stored here
> -    bytestream_put_be16  (&buf, 0);             // version 1
> +    bytestream_put_be16  (&buf, ctx->chroma_factor != CFACTOR_Y422 || ctx->alpha_bits ? 1 : 0);

LGTM, thanks.
diff mbox series

Patch

diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 8d45e42d1a..de63127192 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -1037,7 +1037,7 @@  static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     // frame header
     tmp = buf;
     buf += 2;                                   // frame header size will be stored here
-    bytestream_put_be16  (&buf, 0);             // version 1
+    bytestream_put_be16  (&buf, ctx->chroma_factor != CFACTOR_Y422 || ctx->alpha_bits ? 1 : 0);
     bytestream_put_buffer(&buf, ctx->vendor, 4);
     bytestream_put_be16  (&buf, avctx->width);
     bytestream_put_be16  (&buf, avctx->height);