Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions apps/bmxtranswrap/bmxtranswrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include <bmx/essence_parser/SoundConversion.h>
#include <bmx/essence_parser/MPEG2AspectRatioFilter.h>
#include <bmx/mxf_helper/RDD36MXFDescriptorHelper.h>
#include <bmx/mxf_helper/VC3MXFDescriptorHelper.h>
#include <bmx/clip_writer/ClipWriter.h>
#include <bmx/as02/AS02PictureTrack.h>
#include <bmx/wave/WaveFileIO.h>
Expand Down Expand Up @@ -4325,6 +4326,15 @@ int main(int argc, const char** argv)
if (afd)
clip_track->SetAFD(afd);
break;
case VC3_DNXHR_444:
case VC3_DNXHR_HQX:
case VC3_DNXHR_HQ:
case VC3_DNXHR_SQ:
case VC3_DNXHR_LB:
if (afd)
clip_track->SetAFD(afd);
clip_track->SetComponentDepth(input_picture_info->component_depth);
break;
case WAVE_PCM:
clip_track->SetSamplingRate(output_sound_info->sampling_rate);
clip_track->SetQuantizationBits(output_sound_info->bits_per_sample);
Expand Down Expand Up @@ -4460,6 +4470,14 @@ int main(int argc, const char** argv)
if (BMX_OPT_PROP_IS_SET(user_rdd36_opaque))
rdd36_helper->SetIsOpaque(user_rdd36_opaque);
}

VC3MXFDescriptorHelper *vc3_helper = dynamic_cast<VC3MXFDescriptorHelper*>(pict_helper);
if (vc3_helper) {
if (input_picture_info->display_width > 0)
vc3_helper->SetFrameWidth(input_picture_info->display_width);
if (input_picture_info->display_height > 0)
vc3_helper->SetFrameHeight(input_picture_info->display_height);
}
} else if (sound_helper) {
if (BMX_OPT_PROP_IS_SET(user_ref_image_edit_rate))
sound_helper->SetReferenceImageEditRate(user_ref_image_edit_rate);
Expand Down
140 changes: 140 additions & 0 deletions apps/raw2bmx/raw2bmx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include <bmx/essence_parser/D10RawEssenceReader.h>
#include <bmx/essence_parser/MPEG2AspectRatioFilter.h>
#include <bmx/mxf_helper/RDD36MXFDescriptorHelper.h>
#include <bmx/mxf_helper/VC3MXFDescriptorHelper.h>
#include <bmx/wave/WaveFileIO.h>
#include <bmx/wave/WaveFileChunk.h>
#include <bmx/wave/WaveReader.h>
Expand Down Expand Up @@ -175,6 +176,7 @@ struct RawInput
BMX_OPT_PROP_DECL(uint8_t, afd);
BMX_OPT_PROP_DECL(uint32_t, component_depth);
uint32_t input_height;
uint32_t input_width;
bool have_avci_header;
bool d10_fixed_frame_size;
BMX_OPT_PROP_DECL(MXFSignalStandard, signal_standard);
Expand Down Expand Up @@ -853,6 +855,11 @@ static void usage(const char *cmd)
printf(" --vc3_720p_1258 <name> Raw VC3/DNxHD 1280x720p 45 Mbps input file\n");
printf(" --vc3_1080p_1259 <name> Raw VC3/DNxHD 1920x1080p 85 Mbps input file\n");
printf(" --vc3_1080i_1260 <name> Raw VC3/DNxHD 1920x1080i 85 Mbps input file\n");
printf(" --vc3_dnxhr_444 <name> Raw VC3/DNxHR 4:4:4 12-bit input file\n");
printf(" --vc3_dnxhr_hqx <name> Raw VC3/DNxHR High Quality 12-bit input file\n");
printf(" --vc3_dnxhr_hq <name> Raw VC3/DNxHR High Quality input file\n");
printf(" --vc3_dnxhr_sq <name> Raw VC3/DNxHR Standard Quality input file\n");
printf(" --vc3_dnxhr_lb <name> Raw VC3/DNxHR Low Bandwidth input file\n");
printf(" --pcm <name> Raw PCM audio input file\n");
printf(" --wave <name> Wave PCM audio input file\n");
printf(" --anc <name> Raw ST 436 Ancillary data. Requires the --anc-const option or frame wrapped in KLV and the --klv option\n");
Expand Down Expand Up @@ -2095,6 +2102,23 @@ int main(int argc, const char** argv)
cmdln_index++;
continue; // skip input reset at the end
}
else if (strcmp(argv[cmdln_index], "--width") == 0)
{
if (cmdln_index + 1 >= argc)
{
usage_ref(argv[0]);
fprintf(stderr, "Missing argument for Option '%s'\n", argv[cmdln_index]);
return 1;
}
if (!parse_int(argv[cmdln_index + 1], &value) || value == 0) {
usage_ref(argv[0]);
fprintf(stderr, "Invalid value '%s' for Option '%s'\n", argv[cmdln_index + 1], argv[cmdln_index]);
return 1;
}
input.input_width = value;
cmdln_index++;
continue; // skip input reset at the end
}
else if (strcmp(argv[cmdln_index], "--height") == 0)
{
if (cmdln_index + 1 >= argc)
Expand Down Expand Up @@ -4035,6 +4059,71 @@ int main(int argc, const char** argv)
inputs.push_back(input);
cmdln_index++;
}
else if (strcmp(argv[cmdln_index], "--vc3_dnxhr_444") == 0)
{
if (cmdln_index + 1 >= argc)
{
usage_ref(argv[0]);
fprintf(stderr, "Missing argument for input '%s'\n", argv[cmdln_index]);
return 1;
}
input.essence_type = VC3_DNXHR_444;
input.filename = argv[cmdln_index + 1];
inputs.push_back(input);
cmdln_index++;
}
else if (strcmp(argv[cmdln_index], "--vc3_dnxhr_hqx") == 0)
{
if (cmdln_index + 1 >= argc)
{
usage_ref(argv[0]);
fprintf(stderr, "Missing argument for input '%s'\n", argv[cmdln_index]);
return 1;
}
input.essence_type = VC3_DNXHR_HQX;
input.filename = argv[cmdln_index + 1];
inputs.push_back(input);
cmdln_index++;
}
else if (strcmp(argv[cmdln_index], "--vc3_dnxhr_hq") == 0)
{
if (cmdln_index + 1 >= argc)
{
usage_ref(argv[0]);
fprintf(stderr, "Missing argument for input '%s'\n", argv[cmdln_index]);
return 1;
}
input.essence_type = VC3_DNXHR_HQ;
input.filename = argv[cmdln_index + 1];
inputs.push_back(input);
cmdln_index++;
}
else if (strcmp(argv[cmdln_index], "--vc3_dnxhr_sq") == 0)
{
if (cmdln_index + 1 >= argc)
{
usage_ref(argv[0]);
fprintf(stderr, "Missing argument for input '%s'\n", argv[cmdln_index]);
return 1;
}
input.essence_type = VC3_DNXHR_SQ;
input.filename = argv[cmdln_index + 1];
inputs.push_back(input);
cmdln_index++;
}
else if (strcmp(argv[cmdln_index], "--vc3_dnxhr_lb") == 0)
{
if (cmdln_index + 1 >= argc)
{
usage_ref(argv[0]);
fprintf(stderr, "Missing argument for input '%s'\n", argv[cmdln_index]);
return 1;
}
input.essence_type = VC3_DNXHR_LB;
input.filename = argv[cmdln_index + 1];
inputs.push_back(input);
cmdln_index++;
}
else if (strcmp(argv[cmdln_index], "--pcm") == 0)
{
if (cmdln_index + 1 >= argc)
Expand Down Expand Up @@ -4274,6 +4363,16 @@ int main(int argc, const char** argv)
}
}

// change default component depth for VC-3/DNxHR 12-bit
for (i = 0; i < inputs.size(); i++) {
RawInput *input = &inputs[i];
if ((input->essence_type == VC3_DNXHR_444 ||
input->essence_type == VC3_DNXHR_HQX) &&
!BMX_OPT_PROP_IS_SET(input->component_depth))
{
BMX_OPT_PROP_SET(input->component_depth, 12);
}
}

// extract essence info
for (i = 0; i < inputs.size(); i++) {
Expand Down Expand Up @@ -4426,6 +4525,13 @@ int main(int argc, const char** argv)
} else {
vc3_parser->ParseFrameInfo(input->raw_reader->GetSampleData(), input->raw_reader->GetSampleDataSize());

if (input->input_width == 0)
input->input_width = vc3_parser->GetFrameWidth();
if (input->input_height == 0)
input->input_height = vc3_parser->GetFrameHeight();

input->raw_reader->SetFixedSampleSize(vc3_parser->GetFrameSize());

switch (vc3_parser->GetCompressionId())
{
case 1235:
Expand Down Expand Up @@ -4470,6 +4576,22 @@ int main(int argc, const char** argv)
case 1260:
input->essence_type = VC3_1080I_1260;
break;
// DNxHR
case 1270:
input->essence_type = VC3_DNXHR_444;
break;
case 1271:
input->essence_type = VC3_DNXHR_HQX;
break;
case 1272:
input->essence_type = VC3_DNXHR_HQ;
break;
case 1273:
input->essence_type = VC3_DNXHR_SQ;
break;
case 1274:
input->essence_type = VC3_DNXHR_LB;
break;
default:
log_error("Unknown VC3 essence type\n");
throw false;
Expand Down Expand Up @@ -5609,6 +5731,11 @@ int main(int argc, const char** argv)
case VC3_720P_1258:
case VC3_1080P_1259:
case VC3_1080I_1260:
case VC3_DNXHR_444:
case VC3_DNXHR_HQX:
case VC3_DNXHR_HQ:
case VC3_DNXHR_SQ:
case VC3_DNXHR_LB:
if (BMX_OPT_PROP_IS_SET(input->afd))
clip_track->SetAFD(input->afd);
break;
Expand Down Expand Up @@ -5712,6 +5839,14 @@ int main(int argc, const char** argv)
if (BMX_OPT_PROP_IS_SET(input->rdd36_opaque))
rdd36_helper->SetIsOpaque(input->rdd36_opaque);
}

VC3MXFDescriptorHelper *vc3_helper = dynamic_cast<VC3MXFDescriptorHelper*>(pict_helper);
if (vc3_helper) {
if (input->input_width > 0)
vc3_helper->SetFrameWidth(input->input_width);
if (input->input_height > 0)
vc3_helper->SetFrameHeight(input->input_height);
}
} else if (sound_helper) {
if (BMX_OPT_PROP_IS_SET(output_sound_info->ref_image_edit_rate))
sound_helper->SetReferenceImageEditRate(output_sound_info->ref_image_edit_rate);
Expand Down Expand Up @@ -5762,6 +5897,11 @@ int main(int argc, const char** argv)
case VC3_720P_1258:
case VC3_1080P_1259:
case VC3_1080I_1260:
case VC3_DNXHR_444:
case VC3_DNXHR_HQX:
case VC3_DNXHR_HQ:
case VC3_DNXHR_SQ:
case VC3_DNXHR_LB:
case UNC_SD:
case UNC_HD_1080I:
case UNC_HD_1080P:
Expand Down
6 changes: 6 additions & 0 deletions include/bmx/EssenceType.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ typedef enum
VC3_720P_1258,
VC3_1080P_1259,
VC3_1080I_1260,
// VC-3, DNxHR
VC3_DNXHR_444, // 1270, RGB 4:4:4, 12-bit
VC3_DNXHR_HQX, // 1271, YCbCr 4:2:2, 12-bit
VC3_DNXHR_HQ, // 1272, YCbCr 4:2:2, 8-bit
VC3_DNXHR_SQ, // 1273, YCbCr 4:2:2, 8-bit
VC3_DNXHR_LB, // 1274, YCbCr 4:2:2, 8-bit
// Avid MJPEG
MJPEG_2_1,
MJPEG_3_1,
Expand Down
3 changes: 0 additions & 3 deletions include/bmx/essence_parser/VC3EssenceParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
#include <bmx/essence_parser/EssenceParser.h>


#define VC3_PARSER_MIN_DATA_SIZE 44



namespace bmx
{
Expand Down
4 changes: 4 additions & 0 deletions include/bmx/mxf_helper/VC3MXFDescriptorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class VC3MXFDescriptorHelper : public PictureMXFDescriptorHelper
public:
// configure and create new descriptor
virtual void SetEssenceType(EssenceType essence_type);
virtual void SetFrameWidth(uint32_t frame_width);
virtual void SetFrameHeight(uint32_t frame_height);

virtual mxfpp::FileDescriptor* CreateFileDescriptor(mxfpp::HeaderMetadata *header_metadata);
virtual void UpdateFileDescriptor();
Expand All @@ -73,6 +75,8 @@ class VC3MXFDescriptorHelper : public PictureMXFDescriptorHelper

private:
size_t mEssenceIndex;
BMX_OPT_PROP_DECL(uint32_t, mFrameWidth);
BMX_OPT_PROP_DECL(uint32_t, mFrameHeight);
};


Expand Down
10 changes: 10 additions & 0 deletions src/avid_mxf/AvidTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ static const AvidSampleRateSupport AVID_SAMPLE_RATE_SUPPORT[] =
{VC3_720P_1258, {{-1, -1}, {0, 0}}},
{VC3_1080P_1259, {{-1, -1}, {0, 0}}},
{VC3_1080I_1260, {{-1, -1}, {0, 0}}},
{VC3_DNXHR_444, {{-1, -1}, {0, 0}}},
{VC3_DNXHR_HQX, {{-1, -1}, {0, 0}}},
{VC3_DNXHR_HQ, {{-1, -1}, {0, 0}}},
{VC3_DNXHR_SQ, {{-1, -1}, {0, 0}}},
{VC3_DNXHR_LB, {{-1, -1}, {0, 0}}},
{UNC_SD, {{25, 1}, {30000, 1001}, {0, 0}}},
{UNC_HD_1080I, {{25, 1}, {30000, 1001}, {0, 0}}},
{UNC_HD_1080P, {{25, 1}, {30000, 1001}, {30, 1}, {50, 1}, {60000, 1001}, {60, 1}, {0, 0}}},
Expand Down Expand Up @@ -253,6 +258,11 @@ AvidTrack* AvidTrack::OpenNew(AvidClip *clip, File *file, uint32_t track_index,
case VC3_720P_1258:
case VC3_1080P_1259:
case VC3_1080I_1260:
case VC3_DNXHR_444:
case VC3_DNXHR_HQX:
case VC3_DNXHR_HQ:
case VC3_DNXHR_SQ:
case VC3_DNXHR_LB:
return new AvidVC3Track(clip, track_index, essence_type, file);
case UNC_SD:
case UNC_HD_1080I:
Expand Down
5 changes: 5 additions & 0 deletions src/common/EssenceType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ static const EssenceTypeInfo ESSENCE_TYPE_INFO[] =
{VC3_720P_1258, PICTURE_ESSENCE, "VC3 720p 1258", "VC3_720p_1258"},
{VC3_1080P_1259, PICTURE_ESSENCE, "VC3 1080p 1259", "VC3_1080p_1259"},
{VC3_1080I_1260, PICTURE_ESSENCE, "VC3 1080i 1260", "VC3_1080i_1260"},
{VC3_DNXHR_444, PICTURE_ESSENCE, "VC3 DNxHR 444", "VC3_DNXHR_444"},
{VC3_DNXHR_HQX, PICTURE_ESSENCE, "VC3 DNxHR HQX", "VC3_DNXHR_HQX"},
{VC3_DNXHR_HQ, PICTURE_ESSENCE, "VC3 DNxHR HQ", "VC3_DNXHR_HQ"},
{VC3_DNXHR_SQ, PICTURE_ESSENCE, "VC3 DNxHR SQ", "VC3_DNXHR_SQ"},
{VC3_DNXHR_LB, PICTURE_ESSENCE, "VC3 DNxHR LB", "VC3_DNXHR_LB"},
{MJPEG_2_1, PICTURE_ESSENCE, "MJPEG 2:1", "MJPEG_2_1"},
{MJPEG_3_1, PICTURE_ESSENCE, "MJPEG 3:1", "MJPEG_3_1"},
{MJPEG_10_1, PICTURE_ESSENCE, "MJPEG 10:1", "MJPEG_10_1"},
Expand Down
Loading