Skip to content

Commit

Permalink
Use mxfVideoLineMap type and new video line map setters/getters
Browse files Browse the repository at this point in the history
  • Loading branch information
philipnbbc committed Aug 16, 2023
1 parent 1a2b7a7 commit 83b0962
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 96 deletions.
2 changes: 1 addition & 1 deletion deps/libMXF
2 changes: 1 addition & 1 deletion deps/libMXFpp
2 changes: 1 addition & 1 deletion include/bmx/mxf_helper/UncCDCIMXFDescriptorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class UncCDCIMXFDescriptorHelper : public PictureMXFDescriptorHelper
uint32_t mSampledHeight;
int32_t mSampledXOffset;
int32_t mSampledYOffset;
int32_t mVideoLineMap[2];
mxfVideoLineMap mVideoLineMap;
bool mVideoLineMapSet;
};

Expand Down
2 changes: 1 addition & 1 deletion include/bmx/mxf_helper/UncRGBAMXFDescriptorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class UncRGBAMXFDescriptorHelper : public PictureMXFDescriptorHelper
uint32_t mSampledHeight;
int32_t mSampledXOffset;
int32_t mSampledYOffset;
int32_t mVideoLineMap[2];
mxfVideoLineMap mVideoLineMap;
bool mVideoLineMapSet;
};

Expand Down
9 changes: 3 additions & 6 deletions src/mxf_helper/AVCIMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@ void AVCIMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(544);
else
cdci_descriptor->setStoredHeight(540);
cdci_descriptor->appendVideoLineMap(21);
cdci_descriptor->appendVideoLineMap(584);
cdci_descriptor->setVideoLineMap(21, 584);
break;
case AVCI200_1080P:
case AVCI100_1080P:
Expand All @@ -393,16 +392,14 @@ void AVCIMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(1088);
else
cdci_descriptor->setStoredHeight(1080);
cdci_descriptor->appendVideoLineMap(42);
cdci_descriptor->appendVideoLineMap(0);
cdci_descriptor->setVideoLineMap(42, 0);
break;
case AVCI200_720P:
case AVCI100_720P:
case AVCI50_720P:
cdci_descriptor->setStoredWidth(1280);
cdci_descriptor->setStoredHeight(720);
cdci_descriptor->appendVideoLineMap(26);
cdci_descriptor->appendVideoLineMap(0);
cdci_descriptor->setVideoLineMap(26, 0);
break;
default:
BMX_ASSERT(false);
Expand Down
5 changes: 2 additions & 3 deletions src/mxf_helper/D10MXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef struct
uint32_t stored_width;
uint32_t stored_height;
int32_t display_y_offset;
int32_t video_line_map[2];
mxfVideoLineMap video_line_map;
} SupportedEssence;

static const SupportedEssence SUPPORTED_ESSENCE[] =
Expand Down Expand Up @@ -239,8 +239,7 @@ void D10MXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setDisplayHeight(cdci_descriptor->getStoredHeight() - SUPPORTED_ESSENCE[mEssenceIndex].display_y_offset);
cdci_descriptor->setDisplayXOffset(0);
cdci_descriptor->setDisplayYOffset(SUPPORTED_ESSENCE[mEssenceIndex].display_y_offset);
cdci_descriptor->appendVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[0]);
cdci_descriptor->appendVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[1]);
cdci_descriptor->setVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map);
cdci_descriptor->setStoredF2Offset(0);
cdci_descriptor->setSampledXOffset(0);
cdci_descriptor->setSampledYOffset(0);
Expand Down
5 changes: 2 additions & 3 deletions src/mxf_helper/DVMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef struct
uint32_t stored_width;
uint32_t stored_height;
uint32_t avid_stored_width;
int32_t video_line_map[2];
mxfVideoLineMap video_line_map;
uint8_t color_siting;
uint8_t frame_layout;
uint8_t signal_standard;
Expand Down Expand Up @@ -265,8 +265,7 @@ void DVMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setColorRange(225);
cdci_descriptor->setSignalStandard(SUPPORTED_ESSENCE[mEssenceIndex].signal_standard);
SetCodingEquationsMod(SUPPORTED_ESSENCE[mEssenceIndex].coding_eq);
cdci_descriptor->appendVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[0]);
cdci_descriptor->appendVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[1]);
cdci_descriptor->setVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map);
if ((mFlavour & MXFDESC_AVID_FLAVOUR))
cdci_descriptor->setStoredWidth(SUPPORTED_ESSENCE[mEssenceIndex].avid_stored_width);
else
Expand Down
6 changes: 2 additions & 4 deletions src/mxf_helper/JPEG2000MXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,9 @@ void JPEG2000MXFDescriptorHelper::UpdateFileDescriptor(J2CEssenceParser *essence
}
if (!pict_descriptor->haveVideoLineMap()) {
if (pict_descriptor->getFrameLayout() == MXF_FULL_FRAME) {
pict_descriptor->appendVideoLineMap(1);
pict_descriptor->appendVideoLineMap(0);
pict_descriptor->setVideoLineMap(1, 0);
} else {
pict_descriptor->appendVideoLineMap(1);
pict_descriptor->appendVideoLineMap(pict_descriptor->getDisplayHeight() / 2 + 1);
pict_descriptor->setVideoLineMap(1, pict_descriptor->getDisplayHeight() / 2 + 1);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/mxf_helper/MJPEGMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ void MJPEGMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->appendVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[0]);
if (SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[1])
cdci_descriptor->appendVideoLineMap(SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[1]);
// Note: else this doesn't comply with ST 377-1:2019 which defines VideoLineMap to always have 2 elements
cdci_descriptor->setHorizontalSubsampling(2);
cdci_descriptor->setVerticalSubsampling(1);
}
Expand Down
18 changes: 6 additions & 12 deletions src/mxf_helper/MPEG2LGMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ void MPEG2LGMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(288);
cdci_descriptor->setDisplayWidth(720);
cdci_descriptor->setDisplayHeight(288);
cdci_descriptor->appendVideoLineMap(23);
cdci_descriptor->appendVideoLineMap(336);
cdci_descriptor->setVideoLineMap(23, 336);
break;
case MPEG2LG_422P_HL_1080I:
case MPEG2LG_MP_HL_1920_1080I:
Expand All @@ -290,8 +289,7 @@ void MPEG2LGMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(544);
cdci_descriptor->setDisplayWidth(1920);
cdci_descriptor->setDisplayHeight(540);
cdci_descriptor->appendVideoLineMap(21);
cdci_descriptor->appendVideoLineMap(584);
cdci_descriptor->setVideoLineMap(21, 584);
break;
case MPEG2LG_422P_HL_1080P:
case MPEG2LG_MP_HL_1920_1080P:
Expand All @@ -301,8 +299,7 @@ void MPEG2LGMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(1088);
cdci_descriptor->setDisplayWidth(1920);
cdci_descriptor->setDisplayHeight(1080);
cdci_descriptor->appendVideoLineMap(42);
cdci_descriptor->appendVideoLineMap(0);
cdci_descriptor->setVideoLineMap(42, 0);
break;
case MPEG2LG_422P_HL_720P:
case MPEG2LG_MP_HL_720P:
Expand All @@ -312,8 +309,7 @@ void MPEG2LGMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(720);
cdci_descriptor->setDisplayWidth(1280);
cdci_descriptor->setDisplayHeight(720);
cdci_descriptor->appendVideoLineMap(26);
cdci_descriptor->appendVideoLineMap(0);
cdci_descriptor->setVideoLineMap(26, 0);
break;
case MPEG2LG_MP_HL_1440_1080I:
case MPEG2LG_MP_H14_1080I:
Expand All @@ -323,8 +319,7 @@ void MPEG2LGMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(544);
cdci_descriptor->setDisplayWidth(1440);
cdci_descriptor->setDisplayHeight(540);
cdci_descriptor->appendVideoLineMap(21);
cdci_descriptor->appendVideoLineMap(584);
cdci_descriptor->setVideoLineMap(21, 584);
break;
case MPEG2LG_MP_HL_1440_1080P:
case MPEG2LG_MP_H14_1080P:
Expand All @@ -334,8 +329,7 @@ void MPEG2LGMXFDescriptorHelper::UpdateFileDescriptor()
cdci_descriptor->setStoredHeight(1088);
cdci_descriptor->setDisplayWidth(1440);
cdci_descriptor->setDisplayHeight(1080);
cdci_descriptor->appendVideoLineMap(42);
cdci_descriptor->appendVideoLineMap(0);
cdci_descriptor->setVideoLineMap(42, 0);
break;
default:
BMX_ASSERT(false);
Expand Down
11 changes: 4 additions & 7 deletions src/mxf_helper/RDD36MXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef struct
// guesses
uint8_t signal_standard;
Rational aspect_ratio;
int32_t video_line_map[2];
mxfVideoLineMap video_line_map;
uint8_t color_siting;
} DefaultParameterMatch;

Expand Down Expand Up @@ -369,8 +369,7 @@ void RDD36MXFDescriptorHelper::UpdateFileDescriptor(RDD36EssenceParser *essence_
if (!cdci_descriptor->haveAspectRatio())
cdci_descriptor->setAspectRatio(DEFAULT_PARAM_MATCHES[i].aspect_ratio);
if (!cdci_descriptor->haveVideoLineMap()) {
cdci_descriptor->appendVideoLineMap(DEFAULT_PARAM_MATCHES[i].video_line_map[0]);
cdci_descriptor->appendVideoLineMap(DEFAULT_PARAM_MATCHES[i].video_line_map[1]);
cdci_descriptor->setVideoLineMap(DEFAULT_PARAM_MATCHES[i].video_line_map);
}
if (!cdci_descriptor->haveColorSiting())
SetColorSitingMod(DEFAULT_PARAM_MATCHES[i].color_siting);
Expand All @@ -387,11 +386,9 @@ void RDD36MXFDescriptorHelper::UpdateFileDescriptor(RDD36EssenceParser *essence_
}
if (!cdci_descriptor->haveVideoLineMap()) {
if (cdci_descriptor->getFrameLayout() == MXF_FULL_FRAME) {
cdci_descriptor->appendVideoLineMap(1);
cdci_descriptor->appendVideoLineMap(0);
cdci_descriptor->setVideoLineMap(1, 0);
} else {
cdci_descriptor->appendVideoLineMap(1);
cdci_descriptor->appendVideoLineMap(essence_parser->GetHeight() / 2 + 1);
cdci_descriptor->setVideoLineMap(1, essence_parser->GetHeight() / 2 + 1);
}
}
}
Expand Down
33 changes: 12 additions & 21 deletions src/mxf_helper/UncCDCIMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef struct
uint32_t display_width;
uint32_t display_height;
int32_t avid_display_y_offset;
int32_t video_line_map[2];
mxfVideoLineMap video_line_map;
uint8_t frame_layout;
uint8_t signal_standard;
mxfUL coding_eq;
Expand Down Expand Up @@ -206,8 +206,7 @@ UncCDCIMXFDescriptorHelper::UncCDCIMXFDescriptorHelper()
mStoredDimensionsSet = false;
mDisplayDimensionsSet = false;
mSampledDimensionsSet = false;
mVideoLineMap[0] = SUPPORTED_ESSENCE[0].video_line_map[0];
mVideoLineMap[1] = SUPPORTED_ESSENCE[0].video_line_map[1];
mVideoLineMap = SUPPORTED_ESSENCE[0].video_line_map;
mVideoLineMapSet = false;

SetDefaultDimensions();
Expand Down Expand Up @@ -291,15 +290,9 @@ void UncCDCIMXFDescriptorHelper::Initialize(FileDescriptor *file_descriptor, uin
mSampledYOffset = 0;
mSampledDimensionsSet = true;

mVideoLineMap[0] = 0;
mVideoLineMap[1] = 0;
if (cdci_descriptor->haveVideoLineMap()) {
vector<int32_t> video_line_map = cdci_descriptor->getVideoLineMap();
if (video_line_map.size() > 0)
mVideoLineMap[0] = video_line_map[0];
if (video_line_map.size() > 1)
mVideoLineMap[1] = video_line_map[1];
}
mVideoLineMap = g_Null_Video_Line_Map;
if (cdci_descriptor->haveVideoLineMap())
mVideoLineMap = cdci_descriptor->getVideoLineMapStruct();
}

void UncCDCIMXFDescriptorHelper::SetComponentDepth(uint32_t depth)
Expand Down Expand Up @@ -340,8 +333,8 @@ void UncCDCIMXFDescriptorHelper::SetSampledDimensions(uint32_t width, uint32_t h

void UncCDCIMXFDescriptorHelper::SetVideoLineMap(int32_t field1, int32_t field2)
{
mVideoLineMap[0] = field1;
mVideoLineMap[1] = field2;
mVideoLineMap.first = field1;
mVideoLineMap.second = field2;
mVideoLineMapSet = true;
}

Expand Down Expand Up @@ -429,8 +422,7 @@ void UncCDCIMXFDescriptorHelper::UpdateFileDescriptor()
}
if (!(mFlavour & MXFDESC_AVID_FLAVOUR))
cdci_descriptor->setSignalStandard(SUPPORTED_ESSENCE[mEssenceIndex].signal_standard);
cdci_descriptor->appendVideoLineMap(mVideoLineMap[0]);
cdci_descriptor->appendVideoLineMap(mVideoLineMap[1]);
cdci_descriptor->setVideoLineMap(mVideoLineMap);
cdci_descriptor->setStoredWidth(mStoredWidth);
cdci_descriptor->setStoredHeight(mStoredHeight);
cdci_descriptor->setDisplayWidth(mDisplayWidth);
Expand Down Expand Up @@ -562,14 +554,13 @@ void UncCDCIMXFDescriptorHelper::SetDefaultDimensions()
}

if (!mVideoLineMapSet) {
mVideoLineMap[0] = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[0];
mVideoLineMap[1] = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[1];
mVideoLineMap = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map;
if ((mFlavour & MXFDESC_AVID_FLAVOUR)) {
if (SUPPORTED_ESSENCE[mEssenceIndex].frame_layout == MXF_MIXED_FIELDS) {
mVideoLineMap[0] -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
mVideoLineMap[1] -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
mVideoLineMap.first -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
mVideoLineMap.second -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
} else {
mVideoLineMap[0] -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset;
mVideoLineMap.first -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset;
}
}
}
Expand Down
33 changes: 12 additions & 21 deletions src/mxf_helper/UncRGBAMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef struct
uint32_t display_width;
uint32_t display_height;
int32_t avid_display_y_offset;
int32_t video_line_map[2];
mxfVideoLineMap video_line_map;
uint8_t frame_layout;
mxfRGBALayout pixel_layout;
} SupportedEssence;
Expand Down Expand Up @@ -156,8 +156,7 @@ UncRGBAMXFDescriptorHelper::UncRGBAMXFDescriptorHelper()
mStoredDimensionsSet = false;
mDisplayDimensionsSet = false;
mSampledDimensionsSet = false;
mVideoLineMap[0] = SUPPORTED_ESSENCE[0].video_line_map[0];
mVideoLineMap[1] = SUPPORTED_ESSENCE[0].video_line_map[1];
mVideoLineMap = SUPPORTED_ESSENCE[0].video_line_map;
mVideoLineMapSet = false;

SetDefaultDimensions();
Expand Down Expand Up @@ -230,15 +229,9 @@ void UncRGBAMXFDescriptorHelper::Initialize(FileDescriptor *file_descriptor, uin
mSampledYOffset = 0;
mSampledDimensionsSet = true;

mVideoLineMap[0] = 0;
mVideoLineMap[1] = 0;
if (rgba_descriptor->haveVideoLineMap()) {
vector<int32_t> video_line_map = rgba_descriptor->getVideoLineMap();
if (video_line_map.size() > 0)
mVideoLineMap[0] = video_line_map[0];
if (video_line_map.size() > 1)
mVideoLineMap[1] = video_line_map[1];
}
mVideoLineMap = g_Null_Video_Line_Map;
if (rgba_descriptor->haveVideoLineMap())
mVideoLineMap = rgba_descriptor->getVideoLineMapStruct();
}

void UncRGBAMXFDescriptorHelper::SetStoredDimensions(uint32_t width, uint32_t height)
Expand Down Expand Up @@ -271,8 +264,8 @@ void UncRGBAMXFDescriptorHelper::SetSampledDimensions(uint32_t width, uint32_t h

void UncRGBAMXFDescriptorHelper::SetVideoLineMap(int32_t field1, int32_t field2)
{
mVideoLineMap[0] = field1;
mVideoLineMap[1] = field2;
mVideoLineMap.first = field1;
mVideoLineMap.second = field2;
mVideoLineMapSet = true;
}

Expand Down Expand Up @@ -325,8 +318,7 @@ void UncRGBAMXFDescriptorHelper::UpdateFileDescriptor()
rgba_descriptor->setSampledXOffset(mSampledXOffset);
if (mSampledYOffset != 0 || (mFlavour & MXFDESC_AVID_FLAVOUR))
rgba_descriptor->setSampledYOffset(mSampledYOffset);
rgba_descriptor->appendVideoLineMap(mVideoLineMap[0]);
rgba_descriptor->appendVideoLineMap(mVideoLineMap[1]);
rgba_descriptor->setVideoLineMap(mVideoLineMap);
rgba_descriptor->setPixelLayout(SUPPORTED_ESSENCE[mEssenceIndex].pixel_layout);
}

Expand Down Expand Up @@ -439,14 +431,13 @@ void UncRGBAMXFDescriptorHelper::SetDefaultDimensions()
}

if (!mVideoLineMapSet) {
mVideoLineMap[0] = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[0];
mVideoLineMap[1] = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map[1];
mVideoLineMap = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map;
if ((mFlavour & MXFDESC_AVID_FLAVOUR)) {
if (SUPPORTED_ESSENCE[mEssenceIndex].frame_layout == MXF_MIXED_FIELDS) {
mVideoLineMap[0] -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
mVideoLineMap[1] -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
mVideoLineMap.first -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
mVideoLineMap.second -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset / 2;
} else {
mVideoLineMap[0] -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset;
mVideoLineMap.first -= SUPPORTED_ESSENCE[mEssenceIndex].avid_display_y_offset;
}
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/mxf_helper/VC2MXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef struct
VC2EssenceParser::VideoParameters params;
uint8_t signal_standard;
Rational aspect_ratio;
int32_t video_line_map[2];
mxfVideoLineMap video_line_map;
uint8_t color_siting;
} DefaultParameterMatch;

Expand Down Expand Up @@ -283,8 +283,7 @@ void VC2MXFDescriptorHelper::SetSequenceHeader(const VC2EssenceParser::SequenceH
cdci_descriptor->setAspectRatio(DEFAULT_PARAM_MATCHES[i].aspect_ratio);
if (cdci_descriptor->haveVideoLineMap())
cdci_descriptor->removeItem(&MXF_ITEM_K(GenericPictureEssenceDescriptor, VideoLineMap));
cdci_descriptor->appendVideoLineMap(DEFAULT_PARAM_MATCHES[i].video_line_map[0]);
cdci_descriptor->appendVideoLineMap(DEFAULT_PARAM_MATCHES[i].video_line_map[1]);
cdci_descriptor->setVideoLineMap(DEFAULT_PARAM_MATCHES[i].video_line_map);
SetColorSitingMod(DEFAULT_PARAM_MATCHES[i].color_siting);
break;
}
Expand All @@ -301,13 +300,11 @@ void VC2MXFDescriptorHelper::SetSequenceHeader(const VC2EssenceParser::SequenceH
sequence_header->picture_coding_mode == 0)
{
// MXF_FULL_FRAME
cdci_descriptor->appendVideoLineMap(1);
cdci_descriptor->appendVideoLineMap(0);
cdci_descriptor->setVideoLineMap(1, 0);
}
else
{
cdci_descriptor->appendVideoLineMap(1);
cdci_descriptor->appendVideoLineMap((int32_t)((sequence_header->source_params.frame_height / 2) + 1));
cdci_descriptor->setVideoLineMap(1, (int32_t)((sequence_header->source_params.frame_height / 2) + 1));
}
}
}
Expand Down
Loading

0 comments on commit 83b0962

Please sign in to comment.