avformat/mxfenc: Add vertical subsampling support

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2018-03-21 19:32:32 +01:00
parent 77cbe698cd
commit 2bee43b67d
10 changed files with 22 additions and 11 deletions

View 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;