[FFmpeg-cvslog] avformat/mxfenc: Set horizontal chroma subsample value from pixel format if available

Michael Niedermayer git at videolan.org
Mon May 18 11:09:32 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat May 16 20:02:01 2015 +0200| [e32d832a82112a7cd4eb277001579c26993f29b8] | committer: Michael Niedermayer

avformat/mxfenc: Set horizontal chroma subsample value from pixel format if available

Reviewed-by: tim nicholson <nichot20 at yahoo.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e32d832a82112a7cd4eb277001579c26993f29b8
---

 libavformat/mxfenc.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 14449c9..659c34f 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -79,6 +79,7 @@ typedef struct MXFStreamContext {
     int interlaced;          ///< whether picture is interlaced
     int field_dominance;     ///< tff=1, bff=2
     int component_depth;
+    int h_chroma_sub_sample;
     int temporal_reordering;
     AVRational aspect_ratio; ///< display aspect ratio
     int closed_gop;          ///< gop is closed, used in mpeg-2 frame parsing
@@ -1027,7 +1028,7 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
 
     // horizontal subsampling
     mxf_write_local_tag(pb, 4, 0x3302);
-    avio_wb32(pb, 2);
+    avio_wb32(pb, sc->h_chroma_sub_sample);
 
     // frame layout
     mxf_write_local_tag(pb, 1, 0x320C);
@@ -2035,9 +2036,11 @@ static int mxf_write_header(AVFormatContext *s)
             AVRational rate, tbc = st->time_base;
             // Default component depth to 8
             sc->component_depth = 8;
+            sc->h_chroma_sub_sample = 2;
 
             if (pix_desc) {
-                sc->component_depth = pix_desc->comp[0].depth_minus1 + 1;
+                sc->component_depth     = pix_desc->comp[0].depth_minus1 + 1;
+                sc->h_chroma_sub_sample = 1 << pix_desc->log2_chroma_w;
             }
 
             mxf->timecode_base = (tbc.den + tbc.num/2) / tbc.num;



More information about the ffmpeg-cvslog mailing list