[FFmpeg-devel] [PATCH 07/13] avformat/mxfenc: Add vertical subsampling support

Michael Niedermayer michael at niedermayer.cc
Mon May 7 13:38:11 EEST 2018


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/mxfenc.c            | 11 +++++++++++
 tests/ref/fate/copy-trac4914    |  2 +-
 tests/ref/fate/mxf-reel_name    |  2 +-
 tests/ref/fate/time_base        |  2 +-
 tests/ref/lavf/mxf              |  6 +++---
 tests/ref/lavf/mxf_d10          |  2 +-
 tests/ref/lavf/mxf_dv25         |  2 +-
 tests/ref/lavf/mxf_dvcpro50     |  2 +-
 tests/ref/lavf/mxf_opatom       |  2 +-
 tests/ref/lavf/mxf_opatom_audio |  2 +-
 10 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index e79e1ec7e6..8039be846a 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
@@ -497,6 +498,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 */
@@ -1149,6 +1151,8 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
         desc_size += 5;
     if (sc->interlaced)
         desc_size += 8;
+    if (sc->v_chroma_sub_sample)
+        desc_size += 8;
 
     mxf_write_generic_desc(s, st, key, desc_size);
 
@@ -1209,6 +1213,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);
@@ -2273,6 +2283,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 8f060eec38..a50a7ecd86 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@
-07932de23a28c175e259a8eb1cbfa052 *tests/data/fate/copy-trac4914.mxf
+16e212762efcb66302386c196af2a361 *tests/data/fate/copy-trac4914.mxf
 561721 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 7d64903b72..7a9ff7cf58 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@
-acccd2f4898bcea3e0f68d8ca132e6ff
+a6dfa4a37d4d5681ef04a88e9a6b6e6c
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index 44db02ee59..23b36b98c1 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@
-939abc1a1671fbbdab249ba944fe5b85
+f7e24ab873f0b524f327b1003991dd83
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 600c976cc2..8b1599578b 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-64e49d7e44904049efb1085f0c8ebd51 *./tests/data/lavf/lavf.mxf
+24083dc0939d1d45e4bf27e738816a6f *./tests/data/lavf/lavf.mxf
 526393 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-1bc3cd75f2e3a7e1b4586544fa015db1 *./tests/data/lavf/lavf.mxf
+ed1ef4bd833c30ff37cf7b83d6ef1439 *./tests/data/lavf/lavf.mxf
 561721 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-0d805c05a9b0078727b3e8797dcaea95 *./tests/data/lavf/lavf.mxf
+a56f5638b1f9c0ffaa74cb1cee6c3455 *./tests/data/lavf/lavf.mxf
 526393 ./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 ae29dcbc58..07b7c24667 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-5074cc111fe19d9442e2a962dcf9e72d *./tests/data/lavf/lavf.mxf_d10
+ad23b67a8eea7f0f0c67c4b059d3c516 *./tests/data/lavf/lavf.mxf_d10
 5332013 ./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 97b6807c93..11fbbb7526 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@
-9376aa790712ef9cfba1ec9e9bacbad9 *./tests/data/lavf/lavf.mxf_dv25
+1b1187ed4191e011e3ddf17c057c3d89 *./tests/data/lavf/lavf.mxf_dv25
 3834413 ./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 17870c87e3..31c5d288e6 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@
-5170950bbd38d1b9868dbcea1fbf1e01 *./tests/data/lavf/lavf.mxf_dvcpro50
+a734fc5c0dccb1d77b96a716a139ceef *./tests/data/lavf/lavf.mxf_dvcpro50
 7431213 ./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 b04ef93111..173d7db69d 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@
-8965bbb1801e9c299510592cfe575e44 *./tests/data/lavf/lavf.mxf_opatom
+76299119fc99df9e43fb88ac0ad661b5 *./tests/data/lavf/lavf.mxf_opatom
 4717625 ./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 69b52963df..d6464261f8 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@
-72c84169d102d91095bdfaf374e1b0f3 *./tests/data/lavf/lavf.mxf_opatom_audio
+4741df53f58557e57f409a0ab52d4717 *./tests/data/lavf/lavf.mxf_opatom_audio
 102969 ./tests/data/lavf/lavf.mxf_opatom_audio
 ./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff
-- 
2.17.0



More information about the ffmpeg-devel mailing list