diff mbox series

[FFmpeg-devel,1/5] avcodec/proresenc_anatoliy: use a compatible bitstream version

Message ID 20240107181647.3049578-1-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_anatoliy.c             | 2 +-
 tests/ref/vsynth/vsynth1-prores_444         | 2 +-
 tests/ref/vsynth/vsynth1-prores_444_int     | 2 +-
 tests/ref/vsynth/vsynth2-prores_444         | 2 +-
 tests/ref/vsynth/vsynth2-prores_444_int     | 2 +-
 tests/ref/vsynth/vsynth3-prores_444         | 2 +-
 tests/ref/vsynth/vsynth3-prores_444_int     | 2 +-
 tests/ref/vsynth/vsynth_lena-prores_444     | 2 +-
 tests/ref/vsynth/vsynth_lena-prores_444_int | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

Comments

Stefano Sabatini Jan. 8, 2024, 7:54 p.m. UTC | #1
On date Sunday 2024-01-07 19:16:43 +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_anatoliy.c             | 2 +-
>  tests/ref/vsynth/vsynth1-prores_444         | 2 +-
>  tests/ref/vsynth/vsynth1-prores_444_int     | 2 +-
>  tests/ref/vsynth/vsynth2-prores_444         | 2 +-
>  tests/ref/vsynth/vsynth2-prores_444_int     | 2 +-
>  tests/ref/vsynth/vsynth3-prores_444         | 2 +-
>  tests/ref/vsynth/vsynth3-prores_444_int     | 2 +-
>  tests/ref/vsynth/vsynth_lena-prores_444     | 2 +-
>  tests/ref/vsynth/vsynth_lena-prores_444_int | 2 +-
>  9 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
> index 9b9ffa03be..2223721aa0 100644
> --- a/libavcodec/proresenc_anatoliy.c
> +++ b/libavcodec/proresenc_anatoliy.c
> @@ -765,7 +765,7 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>      bytestream_put_buffer(&buf, "icpf", 4);
>  
>      bytestream_put_be16(&buf, header_size);
> -    bytestream_put_be16(&buf, 0); /* version */
> +    bytestream_put_be16(&buf, avctx->pix_fmt != AV_PIX_FMT_YUV422P10 || ctx->need_alpha ? 1 : 0); /* version */

LGTM, thanks.
diff mbox series

Patch

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 9b9ffa03be..2223721aa0 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -765,7 +765,7 @@  static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     bytestream_put_buffer(&buf, "icpf", 4);
 
     bytestream_put_be16(&buf, header_size);
-    bytestream_put_be16(&buf, 0); /* version */
+    bytestream_put_be16(&buf, avctx->pix_fmt != AV_PIX_FMT_YUV422P10 || ctx->need_alpha ? 1 : 0); /* version */
     bytestream_put_buffer(&buf, ctx->vendor, 4);
     bytestream_put_be16(&buf, avctx->width);
     bytestream_put_be16(&buf, avctx->height);
diff --git a/tests/ref/vsynth/vsynth1-prores_444 b/tests/ref/vsynth/vsynth1-prores_444
index f7f8e9033d..54a63348ad 100644
--- a/tests/ref/vsynth/vsynth1-prores_444
+++ b/tests/ref/vsynth/vsynth1-prores_444
@@ -1,4 +1,4 @@ 
-509e0407dff118c775dcaa4f509a4aae *tests/data/fate/vsynth1-prores_444.mov
+17c5652215ee8213319f58bc6bbcc505 *tests/data/fate/vsynth1-prores_444.mov
 7778954 tests/data/fate/vsynth1-prores_444.mov
 e0da52b5d58171294d1b299539801ae0 *tests/data/fate/vsynth1-prores_444.out.rawvideo
 stddev:    2.80 PSNR: 39.17 MAXDIFF:   44 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-prores_444_int b/tests/ref/vsynth/vsynth1-prores_444_int
index 9515887212..9268099c7b 100644
--- a/tests/ref/vsynth/vsynth1-prores_444_int
+++ b/tests/ref/vsynth/vsynth1-prores_444_int
@@ -1,4 +1,4 @@ 
-1d5e484fa8ca08781ef2ed8428963d12 *tests/data/fate/vsynth1-prores_444_int.mov
+41cc25faabf5545b84983d43cc46aded *tests/data/fate/vsynth1-prores_444_int.mov
 9940947 tests/data/fate/vsynth1-prores_444_int.mov
 732ceeb6887524e0aee98762fe50578b *tests/data/fate/vsynth1-prores_444_int.out.rawvideo
 stddev:    2.83 PSNR: 39.08 MAXDIFF:   45 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-prores_444 b/tests/ref/vsynth/vsynth2-prores_444
index c6084f5908..c1e8109cc8 100644
--- a/tests/ref/vsynth/vsynth2-prores_444
+++ b/tests/ref/vsynth/vsynth2-prores_444
@@ -1,4 +1,4 @@ 
-21f973c4c6076ea21f82d5fe486c0c98 *tests/data/fate/vsynth2-prores_444.mov
+9b2e73b60b1809754390f3d6bcd65218 *tests/data/fate/vsynth2-prores_444.mov
 5219722 tests/data/fate/vsynth2-prores_444.mov
 e425b6af7afa51b5e64fc529528b3691 *tests/data/fate/vsynth2-prores_444.out.rawvideo
 stddev:    0.88 PSNR: 49.18 MAXDIFF:   14 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-prores_444_int b/tests/ref/vsynth/vsynth2-prores_444_int
index a727bb2d23..968a4ed7e1 100644
--- a/tests/ref/vsynth/vsynth2-prores_444_int
+++ b/tests/ref/vsynth/vsynth2-prores_444_int
@@ -1,4 +1,4 @@ 
-500a8249bc63ec6bb79f816bce5b6db1 *tests/data/fate/vsynth2-prores_444_int.mov
+dbb3038d8fc88d7261a7aad315196600 *tests/data/fate/vsynth2-prores_444_int.mov
 6420787 tests/data/fate/vsynth2-prores_444_int.mov
 33a5db4f0423168d4ae4f1db3610928e *tests/data/fate/vsynth2-prores_444_int.out.rawvideo
 stddev:    0.93 PSNR: 48.73 MAXDIFF:   14 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth3-prores_444 b/tests/ref/vsynth/vsynth3-prores_444
index f05894b33e..5a1614ef5a 100644
--- a/tests/ref/vsynth/vsynth3-prores_444
+++ b/tests/ref/vsynth/vsynth3-prores_444
@@ -1,4 +1,4 @@ 
-3070da65c30c1a9905ee31c7ede1cf57 *tests/data/fate/vsynth3-prores_444.mov
+07d2ba443bd0a2ae090dd85cc8d9423e *tests/data/fate/vsynth3-prores_444.mov
 159127 tests/data/fate/vsynth3-prores_444.mov
 025b48feb3d9a9652983ef71e6cb7e7c *tests/data/fate/vsynth3-prores_444.out.rawvideo
 stddev:    3.21 PSNR: 37.98 MAXDIFF:   41 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-prores_444_int b/tests/ref/vsynth/vsynth3-prores_444_int
index f6ba6bc282..d9127ffd17 100644
--- a/tests/ref/vsynth/vsynth3-prores_444_int
+++ b/tests/ref/vsynth/vsynth3-prores_444_int
@@ -1,4 +1,4 @@ 
-c6279e0584575ffa1e2e13047cc7ecec *tests/data/fate/vsynth3-prores_444_int.mov
+a97bdacf54af3f81610861f2ba613bc7 *tests/data/fate/vsynth3-prores_444_int.mov
 184397 tests/data/fate/vsynth3-prores_444_int.mov
 a8852aa2841c2ce5f2aa86176ceda4ef *tests/data/fate/vsynth3-prores_444_int.out.rawvideo
 stddev:    3.24 PSNR: 37.91 MAXDIFF:   41 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth_lena-prores_444 b/tests/ref/vsynth/vsynth_lena-prores_444
index 29141239c5..0c6323bdb9 100644
--- a/tests/ref/vsynth/vsynth_lena-prores_444
+++ b/tests/ref/vsynth/vsynth_lena-prores_444
@@ -1,4 +1,4 @@ 
-b8677f9e1da7be861e8b7207028b3a9e *tests/data/fate/vsynth_lena-prores_444.mov
+e14c1dbd26cebe70feda70acb18962c0 *tests/data/fate/vsynth_lena-prores_444.mov
 4734395 tests/data/fate/vsynth_lena-prores_444.mov
 a704e05e3e0a451edef7515b25a76bb8 *tests/data/fate/vsynth_lena-prores_444.out.rawvideo
 stddev:    0.81 PSNR: 49.88 MAXDIFF:    8 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-prores_444_int b/tests/ref/vsynth/vsynth_lena-prores_444_int
index 005ab68ccf..f8840973a0 100644
--- a/tests/ref/vsynth/vsynth_lena-prores_444_int
+++ b/tests/ref/vsynth/vsynth_lena-prores_444_int
@@ -1,4 +1,4 @@ 
-38195b0437f6ae1c910ba108e7a799d1 *tests/data/fate/vsynth_lena-prores_444_int.mov
+7a1aa9e220dffde91c3a9a0595261461 *tests/data/fate/vsynth_lena-prores_444_int.mov
 5696258 tests/data/fate/vsynth_lena-prores_444_int.mov
 466380156e4d2b811f4ffb9c5a8bca72 *tests/data/fate/vsynth_lena-prores_444_int.out.rawvideo
 stddev:    0.88 PSNR: 49.23 MAXDIFF:    9 bytes:  7603200/  7603200