summaryrefslogtreecommitdiff
path: root/src/as-02-wrap.cpp
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2021-09-12 13:55:51 -0700
committerjhurst <jhurst@cinecert.com>2021-09-12 13:55:51 -0700
commit8db9009293e6ace2ed05a8ca7bd734236a035c06 (patch)
tree74a389e6cd8a034a30a5409cedc15cb4016a2eee /src/as-02-wrap.cpp
parent2cefda0dc78b4e8a1347dcd2ce281fcf6cfeef7a (diff)
parent24c1a213b74792f7ab4a9b3241c303403b558f55 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/as-02-wrap.cpp')
-rwxr-xr-xsrc/as-02-wrap.cpp70
1 files changed, 66 insertions, 4 deletions
diff --git a/src/as-02-wrap.cpp b/src/as-02-wrap.cpp
index 98126bf..8dba4ce 100755
--- a/src/as-02-wrap.cpp
+++ b/src/as-02-wrap.cpp
@@ -139,11 +139,11 @@ Options:\n\
Defaults to 4,194,304 (4MB)\n\
-c <num> - Select the IMF color system to be signaled:\n\
Application 2 (2067-20): 1, 2, or 3\n\
- Application 2e (2067-21): 4 or 5\n\
+ Application 2e (2067-21): 4, 5, or 7\n\
All color system values assume YCbCr; also use -R for RGB\n\
-C <ul> - Set ChannelAssignment UL value\n\
-d <duration> - Number of frames to process, default all\n\
- -D <depth> - Component depth for YCbCr images (default: 10)\n\
+ -D <depth> - Component depth for YCbCr or RGB images (default: 10)\n\
-e - Encrypt JP2K headers (default)\n\
-E - Do not encrypt JP2K headers\n\
-F (0|1) - Set field dominance for interlaced image (default: 0)\n\
@@ -155,6 +155,7 @@ Options:\n\
Stream. May be issued multiple times.\n\
-i - Indicates input essence is interlaced fields (forces -Y)\n\
-j <key-id-str> - Write key ID instead of creating a random value\n\
+ -J - Write J2CLayout\n\
-k <key-string> - Use key for ciphertext operations\n\
-l <first>,<second>\n\
- Integer values that set the VideoLineMap\n\
@@ -273,6 +274,7 @@ public:
bool help_flag; // true if the help display option was selected
ui32_t duration; // number of frames to be processed
bool j2c_pedantic; // passed to JP2K::SequenceParser::OpenRead
+ bool write_j2clayout; // true if a J2CLayout field should be written
bool use_cdci_descriptor; //
Rational edit_rate; // edit rate of JP2K sequence
ui32_t fb_size; // size of picture frame buffer
@@ -459,8 +461,15 @@ public:
use_cdci_descriptor = true;
break;
+ case '7':
+ coding_equations = g_dict->ul(MDD_CodingEquations_Rec2020);
+ transfer_characteristic = g_dict->ul(MDD_TransferCharacteristic_SMPTEST2084);
+ color_primaries = g_dict->ul(MDD_ColorPrimaries_ITU2020);
+ use_cdci_descriptor = true;
+ break;
+
default:
- fprintf(stderr, "Unrecognized color system number, expecting one of 1-5.\n");
+ fprintf(stderr, "Unrecognized color system number, expecting one of 1-5 or 7.\n");
return false;
}
@@ -505,7 +514,7 @@ public:
error_flag(true), key_flag(false), key_id_flag(false), asset_id_flag(false),
encrypt_header_flag(true), write_hmac(true), verbose_flag(false), fb_dump_size(0),
no_write_flag(false), version_flag(false), help_flag(false),
- duration(0xffffffff), j2c_pedantic(true), use_cdci_descriptor(false),
+ duration(0xffffffff), j2c_pedantic(true), write_j2clayout(false), use_cdci_descriptor(false),
edit_rate(24,1), fb_size(FRAME_BUFFER_SIZE),
show_ul_values_flag(false), index_strategy(AS_02::IS_FOLLOW), partition_space(60),
mca_config(g_dict), rgba_MaxRef(1023), rgba_MinRef(0),
@@ -727,6 +736,8 @@ public:
}
break;
+ case 'J': write_j2clayout = true; break;
+
case 'k': key_flag = true;
TEST_EXTRA_ARG(i, 'k');
{
@@ -988,6 +999,7 @@ write_JP2K_file(CommandOptions& Options)
JP2K::SequenceParser Parser;
ASDCP::MXF::FileDescriptor *essence_descriptor = 0;
ASDCP::MXF::InterchangeObject_list_t essence_sub_descriptors;
+ ASDCP::MXF::JPEG2000PictureSubDescriptor *jp2k_sub_descriptor = NULL;
// set up essence parser
Result_t result = Parser.OpenRead(Options.filenames.front().c_str(), Options.j2c_pedantic);
@@ -1046,6 +1058,31 @@ write_JP2K_file(CommandOptions& Options)
}
essence_descriptor = static_cast<ASDCP::MXF::FileDescriptor*>(tmp_dscr);
+
+ if (Options.write_j2clayout)
+ {
+ jp2k_sub_descriptor = static_cast<ASDCP::MXF::JPEG2000PictureSubDescriptor*>(essence_sub_descriptors.back());
+ if (Options.component_depth == 16)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_YUV_16);
+ }
+ else if (Options.component_depth == 12)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_YUV_12);
+ }
+ else if (Options.component_depth == 10)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_YUV_10);
+ }
+ else if (Options.component_depth == 8)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_YUV_8);
+ }
+ else
+ {
+ fprintf(stderr, "Warning: could not determine J2CLayout to write.\n");
+ }
+ }
}
}
else
@@ -1081,6 +1118,31 @@ write_JP2K_file(CommandOptions& Options)
}
essence_descriptor = static_cast<ASDCP::MXF::FileDescriptor*>(tmp_dscr);
+
+ if (Options.write_j2clayout)
+ {
+ jp2k_sub_descriptor = static_cast<ASDCP::MXF::JPEG2000PictureSubDescriptor*>(essence_sub_descriptors.back());
+ if (Options.component_depth == 16)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_RGB_16);
+ }
+ else if (Options.component_depth == 12)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_RGB_12);
+ }
+ else if (Options.component_depth == 10)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_RGB_10);
+ }
+ else if (Options.component_depth == 8)
+ {
+ jp2k_sub_descriptor->J2CLayout = ASDCP::MXF::RGBALayout(ASDCP::MXF::RGBAValue_RGB_8);
+ }
+ else
+ {
+ fprintf(stderr, "Warning: could not determine J2CLayout to write.\n");
+ }
+ }
}
}
}