summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-03-21 19:32:32 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-05-08 23:02:58 +0200
commit2bee43b67dc5c35a853823c7c90d97f5cfec9559 (patch)
treec6e0851db3c2c3790a13c0e09676b60c29008855
parent77cbe698cd9124dc23c5c235ad52e5ce3973633a (diff)
avformat/mxfenc: Add vertical subsampling support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mxfenc.c11
-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, 22 insertions, 11 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 56ba8eebf3..ce2f0ede1e 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -88,6 +88,7 @@ typedef struct MXFStreamContext {
int color_siting;
int signal_standard;
int h_chroma_sub_sample;
+ int v_chroma_sub_sample;
int temporal_reordering;
AVRational aspect_ratio; ///< display aspect ratio
int closed_gop; ///< gop is closed, used in mpeg-2 frame parsing
@@ -490,6 +491,7 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
// CDCI Picture Essence Descriptor
{ 0x3301, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x03,0x0A,0x00,0x00,0x00}}, /* Component Depth */
{ 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 */
// Generic Sound Essence Descriptor
{ 0x3D02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x01,0x04,0x00,0x00,0x00}}, /* Locked/Unlocked */
@@ -1140,6 +1142,8 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
desc_size += 5;
if (sc->signal_standard)
desc_size += 5;
+ if (sc->v_chroma_sub_sample)
+ desc_size += 8;
mxf_write_generic_desc(s, st, key, desc_size);
@@ -1174,6 +1178,12 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
mxf_write_local_tag(pb, 4, 0x3302);
avio_wb32(pb, sc->h_chroma_sub_sample);
+ // vertical subsampling
+ if (sc->v_chroma_sub_sample) {
+ mxf_write_local_tag(pb, 4, 0x3308);
+ avio_wb32(pb, sc->v_chroma_sub_sample);
+ }
+
// color siting
mxf_write_local_tag(pb, 1, 0x3303);
avio_w8(pb, sc->color_siting);
@@ -2238,6 +2248,7 @@ static int mxf_write_header(AVFormatContext *s)
if (pix_desc) {
sc->component_depth = pix_desc->comp[0].depth;
sc->h_chroma_sub_sample = 1 << pix_desc->log2_chroma_w;
+ sc->v_chroma_sub_sample = 1 << pix_desc->log2_chroma_h;
}
switch (ff_choose_chroma_location(s, st)) {
case AVCHROMA_LOC_TOPLEFT: sc->color_siting = 0; break;
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index 0d8f09176f..d5889306bb 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@
-2bbcbc55eebf305aec776bce60d09f91 *tests/data/fate/copy-trac4914.mxf
+3d0c809bc8e9405663c9a5e610f9e8ef *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 b1a8840d7a..2b7ce6b0d8 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@
-581d38fa877b2db15615989f335e9eaf
+db983aa35ff8fb11eecc353e8dbede0c
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index 75ec4368a4..6975886004 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@
-0979b614a34f668eb47278448b254000
+cc250f19ecf194deeca1b7b22809d19b
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index a09c8e1bab..46c820f659 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-e3f486ec383f9df4e4e7063959c88dd5 *./tests/data/lavf/lavf.mxf
+6b19d9f36c84cbfce55b4345d07a4a50 *./tests/data/lavf/lavf.mxf
525881 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-4de1237dea5f8377eed4c8effe037ffb *./tests/data/lavf/lavf.mxf
+f74437af61c3b405ab3fc7629b6c0389 *./tests/data/lavf/lavf.mxf
561209 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-73dec65269c3f5ebe67e4e7fa6f2f6b7 *./tests/data/lavf/lavf.mxf
+90cefadb27b8df45e87c1066780dbf5d *./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 62b96b4ba6..7c9a4ebec7 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-ea6d7025d72df9aaf63bdbc2be8c82dc *./tests/data/lavf/lavf.mxf_d10
+6cef072ed3bc838e776334c665a0e4e0 *./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 323abc330b..46a5d427bb 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@
-2f8cb1656178419950a9a3505cae3f5b *./tests/data/lavf/lavf.mxf_dv25
+a1360106323c36ca5c0822ea9cbee3ea *./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 5e93737904..2b97b6e768 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@
-9377a3afbf431442e17c5d891b4e6252 *./tests/data/lavf/lavf.mxf_dvcpro50
+f7942565dab23159d6aa60d6a943757a *./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 c5aac167b5..fa449982e6 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@
-ebf818890f92bb9710798a3e2ab571fd *./tests/data/lavf/lavf.mxf_opatom
+deaf3a54743b718422248c318c935277 *./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 08cb7168dd..7df1801af4 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@
-b79b636502d47239def6e85ab8cc06b3 *./tests/data/lavf/lavf.mxf_opatom_audio
+ac49423bc7350dba64bde66768c26cc1 *./tests/data/lavf/lavf.mxf_opatom_audio
102457 ./tests/data/lavf/lavf.mxf_opatom_audio
./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff