avformat/mxfenc: Add vertical subsampling support
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 21 Mar 2018 18:32:32 +0000 (19:32 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 8 May 2018 21:02:58 +0000 (23:02 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mxfenc.c
tests/ref/fate/copy-trac4914
tests/ref/fate/mxf-reel_name
tests/ref/fate/time_base
tests/ref/lavf/mxf
tests/ref/lavf/mxf_d10
tests/ref/lavf/mxf_dv25
tests/ref/lavf/mxf_dvcpro50
tests/ref/lavf/mxf_opatom
tests/ref/lavf/mxf_opatom_audio

index 56ba8ee..ce2f0ed 100644 (file)
@@ -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;
index 0d8f091..d588930 100644 (file)
@@ -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
index b1a8840..2b7ce6b 100644 (file)
@@ -1 +1 @@
-581d38fa877b2db15615989f335e9eaf
+db983aa35ff8fb11eecc353e8dbede0c
index 75ec436..6975886 100644 (file)
@@ -1 +1 @@
-0979b614a34f668eb47278448b254000
+cc250f19ecf194deeca1b7b22809d19b
index a09c8e1..46c820f 100644 (file)
@@ -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
index 62b96b4..7c9a4eb 100644 (file)
@@ -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
index 323abc3..46a5d42 100644 (file)
@@ -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
index 5e93737..2b97b6e 100644 (file)
@@ -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
index c5aac16..fa44998 100644 (file)
@@ -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
index 08cb716..7df1801 100644 (file)
@@ -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