From f86765c290802797e7a65f756ed726383618972e Mon Sep 17 00:00:00 2001
From: Martin Vignali <martin.vignali@gmail.com>
Date: Sat, 16 Mar 2019 13:01:47 +0100
Subject: [PATCH 1/2] avcodec/proresenc_aw : use correct bitstream version in 
 frame header

version 0 is only for 422
version 1 for 444 with or without alpha

Suggested by : Vincent Lai
---
 libavcodec/proresenc_anatoliy.c             | 6 +++++-
 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, 13 insertions(+), 9 deletions(-)

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 0fc79fc1de..9fda3309c9 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -735,7 +735,11 @@ 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 */
+    if (avctx->profile < FF_PROFILE_PRORES_4444) {
+        bytestream_put_be16(&buf, 0); /* bitstream version for 422 */
+    } else {
+        bytestream_put_be16(&buf, 1); /* bitstream version for 444 with or without alpha */
+    }
     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 2f064d624d..a9ea398539 100644
--- a/tests/ref/vsynth/vsynth1-prores_444
+++ b/tests/ref/vsynth/vsynth1-prores_444
@@ -1,4 +1,4 @@
-48b30df581b35bf3ce1bc335327323a6 *tests/data/fate/vsynth1-prores_444.mov
+21d1d13b5d5b148f6663d5cbde03176f *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 db0d42f7cd..78a59217ea 100644
--- a/tests/ref/vsynth/vsynth1-prores_444_int
+++ b/tests/ref/vsynth/vsynth1-prores_444_int
@@ -1,4 +1,4 @@
-4fc38d6a1c3171f23713c24b1342a592 *tests/data/fate/vsynth1-prores_444_int.mov
+cd82c9a0a11d345f074a110c16b84ff7 *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 513caaacc2..2e36f0fa7b 100644
--- a/tests/ref/vsynth/vsynth2-prores_444
+++ b/tests/ref/vsynth/vsynth2-prores_444
@@ -1,4 +1,4 @@
-cdea76066b82eed873462c2da908a8a0 *tests/data/fate/vsynth2-prores_444.mov
+789a3f845df6dd34baeab71c0b348f01 *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 bce8277b3c..0eceaa552d 100644
--- a/tests/ref/vsynth/vsynth2-prores_444_int
+++ b/tests/ref/vsynth/vsynth2-prores_444_int
@@ -1,4 +1,4 @@
-4043270721dafd28c1cfa176a1c6916a *tests/data/fate/vsynth2-prores_444_int.mov
+7438315ca58cd0983f98e503b0f911e6 *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 78ca0dd68a..cbdea89b1b 100644
--- a/tests/ref/vsynth/vsynth3-prores_444
+++ b/tests/ref/vsynth/vsynth3-prores_444
@@ -1,4 +1,4 @@
-3319da492e560964bf92440a0d8612b3 *tests/data/fate/vsynth3-prores_444.mov
+4c6addaad1573039679889eb5475efe0 *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 36760adf9a..e4c2c25e8a 100644
--- a/tests/ref/vsynth/vsynth3-prores_444_int
+++ b/tests/ref/vsynth/vsynth3-prores_444_int
@@ -1,4 +1,4 @@
-270045a731d4cb6ba253880021c87a63 *tests/data/fate/vsynth3-prores_444_int.mov
+b8d1fefddf4ac59885f68f877f383e49 *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 2aac93f4fb..1065e03551 100644
--- a/tests/ref/vsynth/vsynth_lena-prores_444
+++ b/tests/ref/vsynth/vsynth_lena-prores_444
@@ -1,4 +1,4 @@
-9df5b55d8545ff162414499530749808 *tests/data/fate/vsynth_lena-prores_444.mov
+acd6e6906dddaeb5d7dca854ccea4723 *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 378b57d04d..2aa711aa62 100644
--- a/tests/ref/vsynth/vsynth_lena-prores_444_int
+++ b/tests/ref/vsynth/vsynth_lena-prores_444_int
@@ -1,4 +1,4 @@
-02400504ef9b76cc58e8d964b9dd40a3 *tests/data/fate/vsynth_lena-prores_444_int.mov
+b142d5bf9f5732df2d3382e2c1922e47 *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
-- 
2.17.2 (Apple Git-113)

