Skip to content

Commit

Permalink
Move VideoLineMap opt property to PictureMXFDescriptorHelper
Browse files Browse the repository at this point in the history
Was factored out of UncCDCIMXFDescriptorHelper and
UncRGBAMXFDescriptorHelper. This allows VideoLineMap to be initialised
from input file descriptors in other descriptor helpers.
  • Loading branch information
philipnbbc committed Aug 16, 2023
1 parent 8f7c10e commit 8e75a6c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 34 deletions.
2 changes: 2 additions & 0 deletions include/bmx/mxf_helper/PictureMXFDescriptorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class PictureMXFDescriptorHelper : public MXFDescriptorHelper
void SetSignalStandard(MXFSignalStandard signal_standard);
void SetFrameLayout(MXFFrameLayout frame_layout);
void SetFieldDominance(uint8_t field_num);
void SetVideoLineMap(int32_t first, int32_t second);
void SetTransferCharacteristic(mxfUL label);
void SetCodingEquations(mxfUL label);
void SetColorPrimaries(mxfUL label);
Expand Down Expand Up @@ -140,6 +141,7 @@ class PictureMXFDescriptorHelper : public MXFDescriptorHelper
BMX_OPT_PROP_DECL(MXFSignalStandard, mSignalStandard);
BMX_OPT_PROP_DECL(MXFFrameLayout, mFrameLayout);
BMX_OPT_PROP_DECL(uint8_t, mFieldDominance);
BMX_OPT_PROP_DECL(mxfVideoLineMap, mVideoLineMap);
BMX_OPT_PROP_DECL(mxfUL, mTransferCh);
BMX_OPT_PROP_DECL(mxfUL, mCodingEquations);
BMX_OPT_PROP_DECL(mxfUL, mColorPrimaries);
Expand Down
3 changes: 0 additions & 3 deletions include/bmx/mxf_helper/UncCDCIMXFDescriptorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class UncCDCIMXFDescriptorHelper : public PictureMXFDescriptorHelper
void SetStoredDimensions(uint32_t width, uint32_t height);
void SetDisplayDimensions(uint32_t width, uint32_t height, int32_t x_offset, int32_t y_offset);
void SetSampledDimensions(uint32_t width, uint32_t height, int32_t x_offset, int32_t y_offset);
void SetVideoLineMap(int32_t field1, int32_t field2);
virtual void SetEssenceType(EssenceType essence_type);
virtual void SetSampleRate(mxfRational sample_rate);
virtual void SetFrameWrapped(bool frame_wrapped);
Expand Down Expand Up @@ -102,8 +101,6 @@ class UncCDCIMXFDescriptorHelper : public PictureMXFDescriptorHelper
uint32_t mSampledHeight;
int32_t mSampledXOffset;
int32_t mSampledYOffset;
mxfVideoLineMap mVideoLineMap;
bool mVideoLineMapSet;
};


Expand Down
3 changes: 0 additions & 3 deletions include/bmx/mxf_helper/UncRGBAMXFDescriptorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class UncRGBAMXFDescriptorHelper : public PictureMXFDescriptorHelper
void SetStoredDimensions(uint32_t width, uint32_t height);
void SetDisplayDimensions(uint32_t width, uint32_t height, int32_t x_offset, int32_t y_offset);
void SetSampledDimensions(uint32_t width, uint32_t height, int32_t x_offset, int32_t y_offset);
void SetVideoLineMap(int32_t field1, int32_t field2);
virtual void SetEssenceType(EssenceType essence_type);
virtual void SetSampleRate(mxfRational sample_rate);

Expand Down Expand Up @@ -99,8 +98,6 @@ class UncRGBAMXFDescriptorHelper : public PictureMXFDescriptorHelper
uint32_t mSampledHeight;
int32_t mSampledXOffset;
int32_t mSampledYOffset;
mxfVideoLineMap mVideoLineMap;
bool mVideoLineMapSet;
};


Expand Down
11 changes: 11 additions & 0 deletions src/mxf_helper/PictureMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ PictureMXFDescriptorHelper::PictureMXFDescriptorHelper()
BMX_OPT_PROP_DEFAULT(mFrameLayout, MXF_FULL_FRAME);
BMX_OPT_PROP_DEFAULT(mColorSiting, MXF_COLOR_SITING_UNKNOWN);
BMX_OPT_PROP_DEFAULT(mFieldDominance, 1);
BMX_OPT_PROP_DEFAULT(mVideoLineMap, g_Null_Video_Line_Map);
BMX_OPT_PROP_DEFAULT(mBlackRefLevel, 0);
BMX_OPT_PROP_DEFAULT(mWhiteRefLevel, 0);
BMX_OPT_PROP_DEFAULT(mColorRange, 0);
Expand Down Expand Up @@ -268,6 +269,8 @@ void PictureMXFDescriptorHelper::Initialize(FileDescriptor *file_descriptor, uin
BMX_OPT_PROP_SET(mFrameLayout, picture_descriptor->getFrameLayout());
if (picture_descriptor->haveFieldDominance())
BMX_OPT_PROP_SET(mFieldDominance, picture_descriptor->getFieldDominance());
if (picture_descriptor->haveVideoLineMap())
BMX_OPT_PROP_SET(mVideoLineMap, picture_descriptor->getVideoLineMapStruct());
if (picture_descriptor->haveCaptureGamma())
BMX_OPT_PROP_SET(mTransferCh, picture_descriptor->getCaptureGamma());
if (picture_descriptor->haveCodingEquations())
Expand Down Expand Up @@ -349,6 +352,12 @@ void PictureMXFDescriptorHelper::SetFieldDominance(uint8_t field_num)
BMX_OPT_PROP_SET(mFieldDominance, field_num);
}

void PictureMXFDescriptorHelper::SetVideoLineMap(int32_t first, int32_t second)
{
mxfVideoLineMap value = {first, second};
BMX_OPT_PROP_SET(mVideoLineMap, value);
}

void PictureMXFDescriptorHelper::SetTransferCharacteristic(mxfUL label)
{
BMX_OPT_PROP_SET(mTransferCh, label);
Expand Down Expand Up @@ -477,6 +486,8 @@ void PictureMXFDescriptorHelper::UpdateFileDescriptor()
picture_descriptor->setFrameLayout(mFrameLayout);
if (BMX_OPT_PROP_IS_SET(mFieldDominance))
picture_descriptor->setFieldDominance(mFieldDominance);
if (BMX_OPT_PROP_IS_SET(mVideoLineMap))
picture_descriptor->setVideoLineMap(mVideoLineMap);
if (BMX_OPT_PROP_IS_SET(mTransferCh))
picture_descriptor->setCaptureGamma(mTransferCh);
if (BMX_OPT_PROP_IS_SET(mCodingEquations))
Expand Down
18 changes: 4 additions & 14 deletions src/mxf_helper/UncCDCIMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ UncCDCIMXFDescriptorHelper::UncCDCIMXFDescriptorHelper()
mStoredDimensionsSet = false;
mDisplayDimensionsSet = false;
mSampledDimensionsSet = false;
mVideoLineMap = SUPPORTED_ESSENCE[0].video_line_map;
mVideoLineMapSet = false;
BMX_OPT_PROP_DEFAULT(mVideoLineMap, SUPPORTED_ESSENCE[0].video_line_map);

SetDefaultDimensions();
}
Expand Down Expand Up @@ -289,10 +288,6 @@ void UncCDCIMXFDescriptorHelper::Initialize(FileDescriptor *file_descriptor, uin
else
mSampledYOffset = 0;
mSampledDimensionsSet = true;

mVideoLineMap = g_Null_Video_Line_Map;
if (cdci_descriptor->haveVideoLineMap())
mVideoLineMap = cdci_descriptor->getVideoLineMapStruct();
}

void UncCDCIMXFDescriptorHelper::SetComponentDepth(uint32_t depth)
Expand Down Expand Up @@ -331,13 +326,6 @@ void UncCDCIMXFDescriptorHelper::SetSampledDimensions(uint32_t width, uint32_t h
SetDefaultDimensions();
}

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

void UncCDCIMXFDescriptorHelper::SetEssenceType(EssenceType essence_type)
{
BMX_ASSERT(!mFileDescriptor);
Expand Down Expand Up @@ -422,6 +410,8 @@ void UncCDCIMXFDescriptorHelper::UpdateFileDescriptor()
}
if (!(mFlavour & MXFDESC_AVID_FLAVOUR))
cdci_descriptor->setSignalStandard(SUPPORTED_ESSENCE[mEssenceIndex].signal_standard);
// PictureMXFDescriptorHelper::UpdateFileDescriptor() above would have written VideoLineMap
// if it was set. This line ensures that the default value gets written if it was not set.
cdci_descriptor->setVideoLineMap(mVideoLineMap);
cdci_descriptor->setStoredWidth(mStoredWidth);
cdci_descriptor->setStoredHeight(mStoredHeight);
Expand Down Expand Up @@ -553,7 +543,7 @@ void UncCDCIMXFDescriptorHelper::SetDefaultDimensions()
}
}

if (!mVideoLineMapSet) {
if (!BMX_OPT_PROP_IS_SET(mVideoLineMap)) {
mVideoLineMap = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map;
if ((mFlavour & MXFDESC_AVID_FLAVOUR)) {
if (SUPPORTED_ESSENCE[mEssenceIndex].frame_layout == MXF_MIXED_FIELDS) {
Expand Down
18 changes: 4 additions & 14 deletions src/mxf_helper/UncRGBAMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ UncRGBAMXFDescriptorHelper::UncRGBAMXFDescriptorHelper()
mStoredDimensionsSet = false;
mDisplayDimensionsSet = false;
mSampledDimensionsSet = false;
mVideoLineMap = SUPPORTED_ESSENCE[0].video_line_map;
mVideoLineMapSet = false;
BMX_OPT_PROP_DEFAULT(mVideoLineMap, SUPPORTED_ESSENCE[0].video_line_map);

SetDefaultDimensions();
}
Expand Down Expand Up @@ -228,10 +227,6 @@ void UncRGBAMXFDescriptorHelper::Initialize(FileDescriptor *file_descriptor, uin
else
mSampledYOffset = 0;
mSampledDimensionsSet = true;

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 @@ -262,13 +257,6 @@ void UncRGBAMXFDescriptorHelper::SetSampledDimensions(uint32_t width, uint32_t h
SetDefaultDimensions();
}

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

void UncRGBAMXFDescriptorHelper::SetEssenceType(EssenceType essence_type)
{
BMX_ASSERT(!mFileDescriptor);
Expand Down Expand Up @@ -318,6 +306,8 @@ void UncRGBAMXFDescriptorHelper::UpdateFileDescriptor()
rgba_descriptor->setSampledXOffset(mSampledXOffset);
if (mSampledYOffset != 0 || (mFlavour & MXFDESC_AVID_FLAVOUR))
rgba_descriptor->setSampledYOffset(mSampledYOffset);
// PictureMXFDescriptorHelper::UpdateFileDescriptor() above would have written VideoLineMap
// if it was set. This line ensures that the default value gets written if it was not set.
rgba_descriptor->setVideoLineMap(mVideoLineMap);
rgba_descriptor->setPixelLayout(SUPPORTED_ESSENCE[mEssenceIndex].pixel_layout);
}
Expand Down Expand Up @@ -430,7 +420,7 @@ void UncRGBAMXFDescriptorHelper::SetDefaultDimensions()
}
}

if (!mVideoLineMapSet) {
if (!BMX_OPT_PROP_IS_SET(mVideoLineMap)) {
mVideoLineMap = SUPPORTED_ESSENCE[mEssenceIndex].video_line_map;
if ((mFlavour & MXFDESC_AVID_FLAVOUR)) {
if (SUPPORTED_ESSENCE[mEssenceIndex].frame_layout == MXF_MIXED_FIELDS) {
Expand Down

0 comments on commit 8e75a6c

Please sign in to comment.