summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-04-05 22:53:22 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-05-08 23:02:58 +0200
commit6d0339096e10f6753049f2a5cbfd7ba69e5f8bcd (patch)
treeece703dfb3967274adccd65e95cf700ebccbfa46
parent2bee43b67dc5c35a853823c7c90d97f5cfec9559 (diff)
avformat/mxfenc: add white/black ref /color range
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mxfenc.c22
-rw-r--r--tests/ref/fate/copy-trac49142
-rw-r--r--tests/ref/fate/mxf-reel_name2
-rw-r--r--tests/ref/fate/time_base2
-rw-r--r--tests/ref/lavf/mxf6
-rw-r--r--tests/ref/lavf/mxf_d102
-rw-r--r--tests/ref/lavf/mxf_dv252
-rw-r--r--tests/ref/lavf/mxf_dvcpro502
-rw-r--r--tests/ref/lavf/mxf_opatom2
-rw-r--r--tests/ref/lavf/mxf_opatom_audio2
10 files changed, 33 insertions, 11 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index ce2f0ede1e..37121b97f8 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -493,6 +493,9 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
{ 0x3302, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x05,0x00,0x00,0x00}}, /* Horizontal Subsampling */
{ 0x3308, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x01,0x10,0x00,0x00,0x00}}, /* Vertical Subsampling */
{ 0x3303, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x06,0x00,0x00,0x00}}, /* Color Siting */
+ { 0x3304, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x03,0x03,0x00,0x00,0x00}}, /* Black Ref level */
+ { 0x3305, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x03,0x04,0x00,0x00,0x00}}, /* White Ref level */
+ { 0x3306, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x03,0x05,0x00,0x00,0x00}}, /* Color Range */
// Generic Sound Essence Descriptor
{ 0x3D02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x01,0x04,0x00,0x00,0x00}}, /* Locked/Unlocked */
{ 0x3D03, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x01,0x01,0x01,0x00,0x00}}, /* Audio sampling rate */
@@ -1144,6 +1147,8 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
desc_size += 5;
if (sc->v_chroma_sub_sample)
desc_size += 8;
+ if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED)
+ desc_size += 8 * 3;
mxf_write_generic_desc(s, st, key, desc_size);
@@ -1188,6 +1193,23 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
mxf_write_local_tag(pb, 1, 0x3303);
avio_w8(pb, sc->color_siting);
+ if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED) {
+ int black = 0,
+ white = (1<<sc->component_depth) - 1,
+ color = (1<<sc->component_depth) - 1;
+ if (st->codecpar->color_range == AVCOL_RANGE_MPEG) {
+ black = 1 << (sc->component_depth - 4);
+ white = 235 << (sc->component_depth - 8);
+ color = (14 << (sc->component_depth - 4)) + 1;
+ }
+ mxf_write_local_tag(pb, 4, 0x3304);
+ avio_wb32(pb, black);
+ mxf_write_local_tag(pb, 4, 0x3305);
+ avio_wb32(pb, white);
+ mxf_write_local_tag(pb, 4, 0x3306);
+ avio_wb32(pb, color);
+ }
+
if (sc->signal_standard) {
mxf_write_local_tag(pb, 1, 0x3215);
avio_w8(pb, sc->signal_standard);
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index d5889306bb..82f0e201bf 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@
-3d0c809bc8e9405663c9a5e610f9e8ef *tests/data/fate/copy-trac4914.mxf
+413822e81bf2e8e15253c5f454dd4f89 *tests/data/fate/copy-trac4914.mxf
561209 tests/data/fate/copy-trac4914.mxf
#tb 0: 1001/30000
#media_type 0: video
diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
index 2b7ce6b0d8..06eed08f49 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@
-db983aa35ff8fb11eecc353e8dbede0c
+af45493a137fefc30012b622e87655fb
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index 6975886004..ab73dc9f8d 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@
-cc250f19ecf194deeca1b7b22809d19b
+a2af9615e99800d1a8d9d4beb52fde17
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 46c820f659..c2326023e8 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-6b19d9f36c84cbfce55b4345d07a4a50 *./tests/data/lavf/lavf.mxf
+b88e19419e438822ce844f2126ead987 *./tests/data/lavf/lavf.mxf
525881 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-f74437af61c3b405ab3fc7629b6c0389 *./tests/data/lavf/lavf.mxf
+518a71066087fef4f24b0e1b3c1c31f0 *./tests/data/lavf/lavf.mxf
561209 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-90cefadb27b8df45e87c1066780dbf5d *./tests/data/lavf/lavf.mxf
+cf62629801992052a4c6bfc4793ce489 *./tests/data/lavf/lavf.mxf
525881 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10
index 7c9a4ebec7..e34f57e4b0 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-6cef072ed3bc838e776334c665a0e4e0 *./tests/data/lavf/lavf.mxf_d10
+4e54e7d5be04c5b7db145b2315d23771 *./tests/data/lavf/lavf.mxf_d10
5331501 ./tests/data/lavf/lavf.mxf_d10
./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
diff --git a/tests/ref/lavf/mxf_dv25 b/tests/ref/lavf/mxf_dv25
index 46a5d427bb..7ba1003138 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@
-a1360106323c36ca5c0822ea9cbee3ea *./tests/data/lavf/lavf.mxf_dv25
+eb9eff93337cc2273cd01fa0e5416555 *./tests/data/lavf/lavf.mxf_dv25
3833901 ./tests/data/lavf/lavf.mxf_dv25
./tests/data/lavf/lavf.mxf_dv25 CRC=0xbdaf7f52
diff --git a/tests/ref/lavf/mxf_dvcpro50 b/tests/ref/lavf/mxf_dvcpro50
index 2b97b6e768..3760830f0e 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@
-f7942565dab23159d6aa60d6a943757a *./tests/data/lavf/lavf.mxf_dvcpro50
+1665f75a926581a3bc94723e95c16d08 *./tests/data/lavf/lavf.mxf_dvcpro50
7430701 ./tests/data/lavf/lavf.mxf_dvcpro50
./tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xe3bbe4b4
diff --git a/tests/ref/lavf/mxf_opatom b/tests/ref/lavf/mxf_opatom
index fa449982e6..da7596e778 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@
-deaf3a54743b718422248c318c935277 *./tests/data/lavf/lavf.mxf_opatom
+69f093d69ba6bd61b3904c259e6f3817 *./tests/data/lavf/lavf.mxf_opatom
4717113 ./tests/data/lavf/lavf.mxf_opatom
./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a
diff --git a/tests/ref/lavf/mxf_opatom_audio b/tests/ref/lavf/mxf_opatom_audio
index 7df1801af4..ad591f1022 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@
-ac49423bc7350dba64bde66768c26cc1 *./tests/data/lavf/lavf.mxf_opatom_audio
+2adc59eeb7f4ce094b735527cfd13bfb *./tests/data/lavf/lavf.mxf_opatom_audio
102457 ./tests/data/lavf/lavf.mxf_opatom_audio
./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff