#
src/.deps
src/.libs
+/build
+
+###
+# some tool dirs
+#
+
+/.vscode
###
# autotools output
ASDCP::MXF::InterchangeObject_list_t::iterator i;
for ( i = essence_sub_descriptor_list.begin(); i != essence_sub_descriptor_list.end(); ++i )
{
- if ( ( (*i)->GetUL() != UL(m_Dict->ul(MDD_ACESPictureSubDescriptor)) ) && ( (*i)->GetUL() != UL(m_Dict->ul(MDD_TargetFrameSubDescriptor)) ) )
+ if ( ( (*i)->GetUL() != UL(m_Dict->ul(MDD_ACESPictureSubDescriptor)) )
+ && ( (*i)->GetUL() != UL(m_Dict->ul(MDD_TargetFrameSubDescriptor)) )
+ && ( (*i)->GetUL() != UL(m_Dict->ul(MDD_ContainerConstraintsSubDescriptor)) )
+ )
{
DefaultLogSink().Error("Essence sub-descriptor is not an ACESPictureSubDescriptor or a TargetFrameSubDescriptor.\n");
(*i)->Dump();
const ui32_t MaxComponents = 3;
const ui32_t MaxPrecincts = 32; // ISO 15444-1 Annex A.6.1
const ui32_t MaxDefaults = 256; // made up
+ const ui8_t MaxCapabilities = 32;
+ const ui16_t MaxPRFN = 4;
+ const ui16_t MaxCPFN = 4;
+ const i8_t NoExtendedCapabilitiesSignaled = -1;
+ const ui16_t NoPRFSignaled = 0;
+ const ui16_t NoCPFSignaled = 0;
#pragma pack(1)
struct ImageComponent_t // ISO 15444-1 Annex A.5.1
ui8_t SPqcd[MaxDefaults];
ui8_t SPqcdLength;
};
+
+ struct ExtendedCapabilities_t // ISO 15444-1 Annex A.5.2
+ {
+ ui32_t Pcap; // Pcap = 0 means that no extended capabilities are required
+ i8_t N; // Number of Ccap elements, or NoExtendedCapabilitiesSignaled if no Extended Capabilities are signaled
+ ui16_t Ccap[MaxCapabilities];
+ };
+
+ struct Profile_t // ISO 15444-1
+ {
+ ui16_t N; // N = NoPRFSignaled means that Profile is signaled through Rsiz exclusively
+ ui16_t Pprf[MaxPRFN]; // Pprf^i in ISO/IEC 15444-1 corresponds to Pprf[i -1]
+ };
+
+ struct CorrespondingProfile_t // ISO 15444-1
+ {
+ ui16_t N; // N = NoCPFSignaled means that no corresponding profile is signaled
+ ui16_t Pcpf[MaxCPFN]; // Pcpf^i in ISO/IEC 15444-1 corresponds to Pcpf[i -1]
+ };
+
#pragma pack()
struct PictureDescriptor
ImageComponent_t ImageComponents[MaxComponents];
CodingStyleDefault_t CodingStyleDefault;
QuantizationDefault_t QuantizationDefault;
+ ExtendedCapabilities_t ExtendedCapabilities;
+ Profile_t Profile;
+ CorrespondingProfile_t CorrespondingProfile;
};
// Print debugging information to std::ostream
#include "AS_DCP_internal.h"
#include <iostream>
#include <iomanip>
+#include <algorithm>
using namespace ASDCP::JP2K;
using Kumu::GenRandomValue;
strm << " SPqcd: " << Kumu::bin2hex(PDesc.QuantizationDefault.SPqcd, PDesc.QuantizationDefault.SPqcdLength, tmp_buf, MaxDefaults*2)
<< std::endl;
+ if (PDesc.Profile.N != 0) {
+ strm << "Profile:" << std::endl;
+
+ for (ui16_t i = 0; i < PDesc.Profile.N; i++) {
+ strm << " Pprf(" << (i + 1) << "): "
+ << std::hex << std::showbase << PDesc.Profile.Pprf[i] << std::dec << std::noshowbase
+ << std::endl;
+ }
+ }
+
+ if (PDesc.CorrespondingProfile.N != 0) {
+ strm << "Corresponding Profile:" << std::endl;
+
+ for (ui16_t i = 0; i < PDesc.CorrespondingProfile.N; i++) {
+
+ strm << " Pcpf(" << (i + 1) << "): "
+ << std::hex << std::showbase << PDesc.CorrespondingProfile.Pcpf[i] << std::dec << std::noshowbase
+ << std::endl;
+ }
+ }
+
+ if (PDesc.ExtendedCapabilities.N != JP2K::NoExtendedCapabilitiesSignaled && PDesc.ExtendedCapabilities.Pcap != 0) {
+
+ strm << "Extended Capabilities:" << std::endl;
+
+
+ strm << " Pcap:" << PDesc.ExtendedCapabilities.Pcap << std::endl;
+
+ for (i32_t b = 0, i = 0; b < JP2K::MaxCapabilities; b++) {
+
+ if ((PDesc.ExtendedCapabilities.Pcap >> b) & 0x1) {
+
+ strm << " Ccap(" << (JP2K::MaxCapabilities - b) << "): " <<
+ std::hex << std::showbase << PDesc.ExtendedCapabilities.Ccap[i++] << std::dec << std::noshowbase
+ << std::endl;
+
+ }
+ }
+ }
+
return strm;
}
Kumu::bin2hex(PDesc.QuantizationDefault.SPqcd, PDesc.QuantizationDefault.SPqcdLength,
tmp_buf, MaxDefaults*2)
);
+
+
+ if (PDesc.Profile.N != 0) {
+ fprintf(stream, " Profile:\n");
+
+ for (ui16_t i = 0; i < PDesc.Profile.N; i++) {
+
+ fprintf(stream, " Pprf(%d): %hx\n", i + 1, PDesc.Profile.Pprf[i]);
+
+ }
+ }
+
+ if (PDesc.CorrespondingProfile.N != 0) {
+ fprintf(stream, "Corresponding Profile:\n");
+
+ for (ui16_t i = 0; i < PDesc.CorrespondingProfile.N; i++) {
+ fprintf(stream, " Pcpf(%d): %hx\n", i + 1, PDesc.CorrespondingProfile.Pcpf[i]);
+
+ }
+ }
+
+ if (PDesc.ExtendedCapabilities.N != JP2K::NoExtendedCapabilitiesSignaled) {
+
+ fprintf(stream, "Extended Capabilities: %x\n", PDesc.ExtendedCapabilities.Pcap);
+
+ for (i32_t b = 0, i = 0; b < JP2K::MaxCapabilities && i < PDesc.ExtendedCapabilities.N; b++) {
+
+ if ((PDesc.ExtendedCapabilities.Pcap >> (JP2K::MaxCapabilities - b - 1)) & 0x1) {
+
+ fprintf(stream, " Ccap(%d): %hx\n", b + 1, PDesc.ExtendedCapabilities.Ccap[i++]);
+
+ }
+ }
+
+ }
+
}
EssenceSubDescriptor.QuantizationDefault.get().Length(qdflt_size);
EssenceSubDescriptor.QuantizationDefault.set_has_value();
+ // Profile
+
+ if (PDesc.Profile.N == 0) {
+ EssenceSubDescriptor.J2KProfile.set_has_value(false);
+ } else {
+ EssenceSubDescriptor.J2KProfile.get().resize(PDesc.Profile.N);
+
+ std::copy(PDesc.Profile.Pprf,
+ PDesc.Profile.Pprf + PDesc.Profile.N,
+ EssenceSubDescriptor.J2KProfile.get().begin());
+
+ EssenceSubDescriptor.J2KProfile.set_has_value();
+ }
+
+ // Corresponding profile
+
+ if (PDesc.CorrespondingProfile.N == 0) {
+
+ EssenceSubDescriptor.J2KCorrespondingProfile.set_has_value(false);
+
+ } else {
+ EssenceSubDescriptor.J2KCorrespondingProfile.get().resize(PDesc.CorrespondingProfile.N);
+
+ std::copy(PDesc.CorrespondingProfile.Pcpf,
+ PDesc.CorrespondingProfile.Pcpf + PDesc.CorrespondingProfile.N,
+ EssenceSubDescriptor.J2KCorrespondingProfile.get().begin());
+
+ EssenceSubDescriptor.J2KCorrespondingProfile.set_has_value();
+ }
+
+ // Extended capabilities
+
+ if (PDesc.ExtendedCapabilities.N == JP2K::NoExtendedCapabilitiesSignaled) {
+
+ /* No extended capabilities are signaled */
+
+ EssenceSubDescriptor.J2KExtendedCapabilities.set_has_value(false);
+
+ } else {
+
+ EssenceSubDescriptor.J2KExtendedCapabilities.get().Pcap = PDesc.ExtendedCapabilities.Pcap;
+
+ EssenceSubDescriptor.J2KExtendedCapabilities.get().Ccap.resize(PDesc.ExtendedCapabilities.N);
+
+ std::copy(PDesc.ExtendedCapabilities.Ccap,
+ PDesc.ExtendedCapabilities.Ccap + PDesc.ExtendedCapabilities.N,
+ EssenceSubDescriptor.J2KExtendedCapabilities.get().Ccap.begin());
+
+ EssenceSubDescriptor.J2KExtendedCapabilities.set_has_value(true);
+
+ }
+
return RESULT_OK;
}
EssenceSubDescriptor.QuantizationDefault.const_get().Length());
PDesc.QuantizationDefault.SPqcdLength = EssenceSubDescriptor.QuantizationDefault.const_get().Length() - 1;
+
+ // Profile
+
+ std::fill(PDesc.Profile.Pprf, PDesc.Profile.Pprf + JP2K::MaxPRFN, 0);
+
+ if (EssenceSubDescriptor.J2KProfile.empty() ||
+ EssenceSubDescriptor.J2KProfile.const_get().size() == 0) {
+
+ PDesc.Profile.N = 0;
+
+ } else {
+
+ PDesc.Profile.N = EssenceSubDescriptor.J2KProfile.const_get().size();
+
+ std::copy(EssenceSubDescriptor.J2KProfile.const_get().begin(),
+ EssenceSubDescriptor.J2KProfile.const_get().end(),
+ PDesc.Profile.Pprf);
+
+ }
+
+ // Corresponding profile
+
+ std::fill(PDesc.CorrespondingProfile.Pcpf, PDesc.CorrespondingProfile.Pcpf + JP2K::MaxCPFN, 0);
+
+ if (EssenceSubDescriptor.J2KCorrespondingProfile.empty() ||
+ EssenceSubDescriptor.J2KCorrespondingProfile.const_get().size() == 0) {
+
+ PDesc.CorrespondingProfile.N = 0;
+
+ }
+ else {
+
+ PDesc.CorrespondingProfile.N = EssenceSubDescriptor.J2KCorrespondingProfile.const_get().size();
+
+ std::copy(EssenceSubDescriptor.J2KCorrespondingProfile.const_get().begin(),
+ EssenceSubDescriptor.J2KCorrespondingProfile.const_get().end(),
+ PDesc.CorrespondingProfile.Pcpf);
+
+ }
+
+ // Extended capabilities
+
+ std::fill(PDesc.ExtendedCapabilities.Ccap, PDesc.ExtendedCapabilities.Ccap + JP2K::MaxCapabilities, 0);
+
+ if (EssenceSubDescriptor.J2KExtendedCapabilities.empty()) {
+
+ PDesc.ExtendedCapabilities.Pcap = 0;
+ PDesc.ExtendedCapabilities.N = JP2K::NoExtendedCapabilitiesSignaled;
+
+ }
+ else {
+
+ PDesc.ExtendedCapabilities.Pcap = EssenceSubDescriptor.J2KExtendedCapabilities.const_get().Pcap;
+ PDesc.ExtendedCapabilities.N = EssenceSubDescriptor.J2KExtendedCapabilities.const_get().Ccap.size();
+
+ std::copy(EssenceSubDescriptor.J2KExtendedCapabilities.const_get().Ccap.begin(),
+ EssenceSubDescriptor.J2KExtendedCapabilities.const_get().Ccap.end(),
+ PDesc.ExtendedCapabilities.Ccap);
+
+ }
+
return RESULT_OK;
}
memcpy(TDesc.AssetID, TDescObj->ResourceID.Value(), UUIDlen);
TDesc.NamespaceName = TDescObj->NamespaceURI;
TDesc.EncodingName = TDescObj->UCSEncoding;
+ TDesc.ResourceList.clear();
Array<UUID>::const_iterator sdi = TDescObj->SubDescriptors.begin();
TimedTextResourceSubDescriptor* DescObject = 0;
using Kumu::DefaultLogSink;
-// when indexed with the second byte of a marker code, this table will procuce one of
-// two values:
-// 0 - the marker is a standalone marker
-// 1 - the marker designates a marker segment
-//
-const byte_t MarkerSegmentMap[] =
- {
- /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
- /* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0
- /* 1 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1
- /* 2 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2
- /* 3 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3
- /* 4 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 4
- /* 5 */ 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, // 5
- /* 6 */ 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
- /* 7 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
- /* 8 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8
- /* 9 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9
- /* a */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // a
- /* b */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // b
- /* c */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // c
- /* d */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // d
- /* e */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // e
- /* f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // f
- /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
- };
-
-
//
ASDCP::Result_t
ASDCP::JP2K::GetNextMarker(const byte_t** buf, JP2K::Marker& Marker)
{
assert((buf != 0) && (*buf != 0 ));
- if ( **buf != 0xff )
+ if (*(*buf)++ != 0xff )
return ASDCP::RESULT_FAIL;
- Marker.m_IsSegment = (MarkerSegmentMap[*(++(*buf))] == 1);
Marker.m_Type = (Marker_t)(0xff00 | *(*buf)++);
+ Marker.m_IsSegment = Marker.m_Type != MRK_SOC && Marker.m_Type != MRK_SOD && Marker.m_Type != MRK_EOC;
if ( Marker.m_IsSegment )
{
*buf += Marker.m_DataSize;
}
-
+ /* TODO: why is this here?
if ( Marker.m_DataSize != 0 && Marker.m_DataSize < 3 )
{
DefaultLogSink().Error("Illegal data size: %u\n", Marker.m_DataSize);
return ASDCP::RESULT_FAIL;
}
-
+ */
return ASDCP::RESULT_OK;
}
}
}
+//
+void
+ASDCP::JP2K::Accessor::PRF::Dump(FILE* stream) const
+{
+ if ( stream == 0 )
+ stream = stderr;
+
+ fprintf(stream, "PRF: \n");
+
+ if (N() == 0) {
+
+ fprintf(stream, " N/A");
+
+ } else {
+
+ for (ui16_t i = 1; i <= N(); i++) {
+ fprintf(stream, "pprf(%d): %d\n", i, pprf(i));
+ }
+
+ }
+}
+
+//
+void
+ASDCP::JP2K::Accessor::CPF::Dump(FILE* stream) const
+{
+ if ( stream == 0 )
+ stream = stderr;
+
+ fprintf(stream, "CPF: \n");
+
+ if (N() == 0) {
+
+ fprintf(stream, " N/A");
+
+ } else {
+
+ for (ui16_t i = 1; i <= N(); i++) {
+ fprintf(stream, "pcpf(%d): %d\n", i, pcpf(i));
+ }
+
+ }
+}
+
+
+//
+void
+ASDCP::JP2K::Accessor::CAP::Dump(FILE* stream) const
+{
+ if ( stream == 0 )
+ stream = stderr;
+
+ fprintf(stream, "CAP: \n");
+
+ ui32_t pcap = this->pcap();
+
+ if (pcap == 0) {
+
+ fprintf(stream, " None");
+
+ } else {
+
+ for (i32_t b = 32, i = 1; b > 0; b--) {
+
+ if ((pcap >> (32 - b)) & 0x1) {
+
+ fprintf(stream, " ccap(%d): %d\n", b, this->ccap(i++));
+
+ }
+ }
+ }
+}
//-------------------------------------------------------------------------------------------------------
//
case MRK_EPH: return "EPH: End of packet header"; break;
case MRK_CRG: return "CRG: Component registration"; break;
case MRK_COM: return "COM: Comment"; break;
+ case MRK_CPF: return "CPF: Corresponding profile"; break;
+ case MRK_CAP: return "CAP: Capabilities"; break;
+ case MRK_PRF: return "PRF: Profile"; break;
}
return "Unknown marker code";
MRK_SOT = 0xff90, // Start of tile-part
MRK_SOD = 0xff93, // Start of data
MRK_EOC = 0xffd9, // End of codestream
+ MRK_CAP = 0xff50, // Extended capabilities
MRK_SIZ = 0xff51, // Image and tile size
MRK_COD = 0xff52, // Coding style default
MRK_COC = 0xff53, // Coding style component
+ MRK_PRF = 0xff56, // Profile
+ MRK_CPF = 0xff59, // Corresponding profile
MRK_RGN = 0xff5e, // Region of interest
MRK_QCD = 0xff5c, // Quantization default
MRK_QCC = 0xff5d, // Quantization component
inline ui32_t CommentSize() const { return m_DataSize; }
void Dump(FILE* stream = 0) const;
};
+
+ // Corresponding Profile
+ class CPF {
+
+ const ui16_t* m_Data;
+ ui16_t m_N;
+
+ KM_NO_COPY_CONSTRUCT(CPF);
+ CPF();
+
+ public:
+ CPF(const Marker& M) {
+ assert(M.m_Type == MRK_CPF);
+
+ m_Data = (ui16_t*) M.m_Data;
+ m_N = M.m_DataSize >> 1;
+ }
+
+ ~CPF() {}
+
+ inline ui16_t N() const { return m_N; }
+
+ inline ui16_t pcpf(ui16_t i) const { return KM_i16_BE(m_Data[2 * (i - 1)]); }
+
+ void Dump(FILE* stream = 0) const;
+ };
+
+ // Profile
+ class PRF {
+
+ const ui16_t* m_Data;
+ ui16_t m_N;
+
+ KM_NO_COPY_CONSTRUCT(PRF);
+ PRF();
+
+ public:
+ PRF(const Marker& M) {
+ assert(M.m_Type == MRK_PRF);
+
+ m_Data = (ui16_t*) M.m_Data;
+ m_N = M.m_DataSize >> 1;
+ }
+
+ ~PRF() {}
+
+ inline ui16_t N() const { return m_N; }
+
+ inline ui16_t pprf(ui16_t i) const { return KM_i16_BE(m_Data[2 * (i - 1)]); }
+
+ void Dump(FILE* stream = 0) const;
+ };
+
+ // Extended capabilities
+ class CAP {
+
+ const ui16_t* m_Data;
+
+ ui32_t m_Pcap;
+
+ i8_t m_N;
+
+ KM_NO_COPY_CONSTRUCT(CAP);
+ CAP();
+
+ public:
+ CAP(const Marker& M) {
+ assert(M.m_Type == MRK_CAP);
+
+ m_Data = (ui16_t *) (M.m_Data + 4);
+ m_Pcap = KM_i32_BE(*(ui32_t*)(M.m_Data));
+ m_N = (M.m_DataSize - 4) >> 1;
+ }
+
+ ~CAP() {}
+
+ inline ui32_t pcap() const { return m_Pcap; }
+
+ inline i8_t N() const { return m_N; }
+
+ inline ui16_t ccap(ui16_t i) const { return KM_i16_BE(m_Data[2 * (i - 1)]); }
+
+ void Dump(FILE* stream = 0) const;
+ };
} // namespace Accessor
} // namespace JP2K
} // namespace ASDCP
const byte_t* p = FB.RoData();
const byte_t* end_p = p + FB.Size();
+ /* initialize optional items */
+
+ PDesc.ExtendedCapabilities.N = JP2K::NoExtendedCapabilitiesSignaled;
+ PDesc.Profile.N = 0;
+ PDesc.CorrespondingProfile.N = 0;
+
while ( p < end_p && ASDCP_SUCCESS(result) )
{
result = GetNextMarker(&p, NextMarker);
memcpy(&PDesc.QuantizationDefault, NextMarker.m_Data, NextMarker.m_DataSize);
PDesc.QuantizationDefault.SPqcdLength = NextMarker.m_DataSize - 1;
break;
+
+ case MRK_CAP:
+ {
+ Accessor::CAP CAP_(NextMarker);
+
+ PDesc.ExtendedCapabilities.Pcap = CAP_.pcap();
+
+ PDesc.ExtendedCapabilities.N = CAP_.N();
+
+ for (i32_t i = 0; i < CAP_.N(); i++) {
+
+ PDesc.ExtendedCapabilities.Ccap[i] = CAP_.ccap(i);
+
+ }
+
+ }
+ break;
+
+ case MRK_PRF:
+ {
+ Accessor::PRF PRF_(NextMarker);
+
+ ui16_t n = PRF_.N();
+
+ if ( n > MaxPRFN )
+ {
+ DefaultLogSink().Error("Number (%d) of Pprf^i exceeds maximum supported\n", n);
+ return RESULT_RAW_FORMAT;
+ }
+
+ PDesc.Profile.N = n;
+
+ for(i32_t i = 0; i < n ; i++) {
+
+ PDesc.Profile.Pprf[i] = PRF_.pprf(i+1);
+ }
+ }
+ break;
+
+ case MRK_CPF:
+ {
+ Accessor::CPF CPF_(NextMarker);
+
+ ui16_t n = CPF_.N();
+
+ if ( n > MaxCPFN )
+ {
+ DefaultLogSink().Error("Number (%d) of Pcpf^i exceeds maximum supported\n", n);
+ return RESULT_RAW_FORMAT;
+ }
+
+ PDesc.CorrespondingProfile.N = n;
+
+ for(i32_t i = 0; i < n; i++) {
+
+ PDesc.CorrespondingProfile.Pcpf[i] = CPF_.pcpf(i+1);
+ }
+ }
+ break;
+
}
}
for ( ui32_t i = 0; i < sizeof(ui16_t); i++ )
{
- if ( lhs.SGcod.NumberOfLayers[i] != lhs.SGcod.NumberOfLayers[i] )
+ if ( lhs.SGcod.NumberOfLayers[i] != rhs.SGcod.NumberOfLayers[i] )
return false;
}
return true;
}
+//
+bool
+operator==(const ASDCP::JP2K::ExtendedCapabilities_t& lhs, const ASDCP::JP2K::ExtendedCapabilities_t& rhs)
+{
+ if (lhs.N != rhs.N) return false;
+
+ if (lhs.N != JP2K::NoExtendedCapabilitiesSignaled) {
+
+ if (lhs.Pcap != rhs.Pcap) return false;
+
+ for (ui32_t i = 0; i < lhs.N; i++)
+ {
+ if (lhs.Ccap[i] != rhs.Ccap[i])
+ return false;
+ }
+
+ }
+
+ return true;
+}
+
+//
+bool
+operator==(const ASDCP::JP2K::CorrespondingProfile_t& lhs, const ASDCP::JP2K::CorrespondingProfile_t& rhs)
+{
+ if (lhs.N != rhs.N) return false;
+
+ for (ui32_t i = 0; i < lhs.N; i++)
+ {
+ if (lhs.Pcpf[i] != rhs.Pcpf[i])
+ return false;
+ }
+
+ return true;
+}
+
+//
+bool
+operator==(const ASDCP::JP2K::Profile_t& lhs, const ASDCP::JP2K::Profile_t& rhs)
+{
+ if (lhs.N != rhs.N) return false;
+
+ for (ui32_t i = 0; i < lhs.N; i++)
+ {
+ if (lhs.Pprf[i] != rhs.Pprf[i])
+ return false;
+ }
+
+ return true;
+}
+
//
bool
operator==(const ASDCP::JP2K::PictureDescriptor& lhs, const ASDCP::JP2K::PictureDescriptor& rhs)
if ( lhs.Csize != rhs.Csize ) return false;
if ( ! ( lhs.CodingStyleDefault == rhs.CodingStyleDefault ) ) return false;
if ( ! ( lhs.QuantizationDefault == rhs.QuantizationDefault ) ) return false;
+ if (!(lhs.Profile == rhs.Profile)) return false;
+ if (!(lhs.CorrespondingProfile == rhs.CorrespondingProfile)) return false;
+ if (!(lhs.ExtendedCapabilities == rhs.ExtendedCapabilities)) return false;
for ( ui32_t i = 0; i < JP2K::MaxComponents; i++ )
{
}
};
+ //
+ class ArchivableUi16 : public Kumu::IArchive
+ {
+ public:
+ ui16_t value;
+
+ ArchivableUi16() : value(0) {}
+ ArchivableUi16(const ui16_t& val) : value(val) {}
+ virtual ~ArchivableUi16() {}
+
+ bool HasValue() const { return true; }
+ ui32_t ArchiveLength() const { return sizeof(ui16_t); }
+
+ operator ui16_t() const { return value; }
+
+ bool Archive(MemIOWriter* Writer) const {
+ if ( Writer == 0 ) return false;
+ return Writer->WriteUi16BE(value);
+ }
+
+ bool Unarchive(MemIOReader* Reader) {
+ if ( Reader == 0 ) return false;
+ return Reader->ReadUi16BE(&value);
+ }
+
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const {
+ snprintf(str_buf, buf_len, "%hu", value);
+ return str_buf;
+ }
+ };
+
//
typedef Kumu::ArchivableList<ArchivableString> StringList;
return false;
}
+ inline bool operator>(const Identifier& rhs) const {
+ ui32_t test_size = xmin(rhs.Size(), SIZE);
+
+ for ( ui32_t i = 0; i < test_size; i++ )
+ {
+ if ( m_Value[i] != rhs.m_Value[i] )
+ return m_Value[i] > rhs.m_Value[i];
+ }
+
+ return false;
+ }
+
inline bool operator==(const Identifier& rhs) const {
if ( rhs.Size() != SIZE ) return false;
return ( memcmp(m_Value, rhs.m_Value, SIZE) == 0 );
{0}, false, "DBOXMotionCodeSecondaryStream" },
// 379-2, Sec. 7: Encoders that conform to this specification shall add a
- // ContainerConstraintSubDescriptor to the GenericDescriptor::SubDescriptors
+ // ContainerConstraintsSubDescriptor to the GenericDescriptor::SubDescriptors
// property of the top-most File Descriptor that describes the essence
// container.
{ { 0x06, 0x0e, 0x2b, 0x34, 0x02, 0x53, 0x01, 0x01, // 373
0x0d, 0x01, 0x01, 0x01, 0x01, 0x01, 0x67, 0x00 },
- {0}, false, "ContainerConstraintSubDescriptor" },
+ {0}, false, "ContainerConstraintsSubDescriptor" },
// protype for high dynamic range, values recorded in Dolby registry
{ { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x05, // 374
{0}, false, "ACESFrameWrappedEssence" },
{ { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x0d, // 518
0x03, 0x02, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00 },
- {0}, false, "DCAudioChannel_FSKSyncSignalChannel" },
+ {0}, false, "DCAudioChannel_FSKSyncSignalChannel" },
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x0e,
+ 0x04, 0x01, 0x06, 0x03, 0x0f, 0x00, 0x00, 0x00 },
+ {0}, false, "JPEG2000PictureSubDescriptor_J2KExtendedCapabilities" }, // 519
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x0e,
+ 0x04, 0x01, 0x06, 0x03, 0x10, 0x00, 0x00, 0x00 },
+ {0}, false, "JPEG2000PictureSubDescriptor_J2KProfile" }, // 520
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x0e,
+ 0x04, 0x01, 0x06, 0x03, 0x11, 0x00, 0x00, 0x00 },
+ {0}, false, "JPEG2000PictureSubDescriptor_J2KCorrespondingProfile" }, // 521
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x04, 0x01, 0x01,
+ 0x03, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ {0}, false, "J2KExtendedCapabilities" }, // 522
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x0D,
+ 0x04, 0x01, 0x02, 0x02, 0x03, 0x01, 0x08, 0x00 },
+ {0}, false, "HTJ2KPictureCodingScheme" }, // 523
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x0D,
+ 0x04, 0x01, 0x02, 0x02, 0x03, 0x01, 0x08, 0x01 },
+ {0}, false, "HTJ2KPictureCodingSchemeGeneric" }, // 524
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x0d, // 525
+ 0x0d, 0x0f, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00 },
+ {0}, false, "AudioChannelSLVS" },
{ {0}, {0}, false, 0 },
};
MDD_WAVWrappingClip, // 370
MDD_DBOXMotionCodePrimaryStream, // 371
MDD_DBOXMotionCodeSecondaryStream, // 372
- MDD_ContainerConstraintSubDescriptor, // 373
+ MDD_ContainerConstraintsSubDescriptor, // 373
MDD_PHDRImageMetadataWrappingFrame, // 374
MDD_PHDRImageMetadataItem, // 375
MDD_PHDRMetadataTrackSubDescriptor, // 376
MDD_ACESUncompressedMonoscopicWithAlpha, // 516
MDD_ACESFrameWrappedEssence, // 517
MDD_DCAudioChannel_FSKSyncSignalChannel, // 518
+ MDD_JPEG2000PictureSubDescriptor_J2KExtendedCapabilities, // 519
+ MDD_JPEG2000PictureSubDescriptor_J2KProfile, // 520
+ MDD_JPEG2000PictureSubDescriptor_J2KCorrespondingProfile, // 521
+ MDD_J2KExtendedCapabilities, // 522
+ MDD_HTJ2KPictureCodingScheme, // 523
+ MDD_HTJ2KPictureCodingSchemeGeneric, // 524
+ MDD_AudioChannelSLVS, // 525
MDD_Max
}; // enum MDD_t
m_LabelMap.insert(pair("FSKSync", label_traits("FSK Sync" , true, m_Dict->ul(MDD_DCAudioChannel_FSKSyncSignalChannel))));
m_LabelMap.insert(pair("DBOX", label_traits("D-BOX Motion Code Primary Stream" , false, m_Dict->ul(MDD_DBOXMotionCodePrimaryStream))));
m_LabelMap.insert(pair("DBOX2", label_traits("D-BOX Motion Code Secondary Stream", false, m_Dict->ul(MDD_DBOXMotionCodeSecondaryStream))));
+ m_LabelMap.insert(pair("SLVS", label_traits("Sign Language Video Stream" , false, m_Dict->ul(MDD_AudioChannelSLVS))));
}
//
// std::list<ui32_t> SliceOffset;
// Array<Rational> PosTable;
- IndexEntry() : TemporalOffset(0), KeyFrameOffset(0), Flags(0), StreamOffset(0) {}
+ IndexEntry() : TemporalOffset(0), KeyFrameOffset(0), Flags(0x80), StreamOffset(0) {}
IndexEntry(i8_t t_ofst, i8_t k_ofst, ui8_t flags, ui64_t s_ofst) :
TemporalOffset(t_ofst), KeyFrameOffset(k_ofst), Flags(flags), StreamOffset(s_ofst) {}
inline bool HasValue() const { return true; }
/*
-Copyright (c) 2005-2016, John Hurst
+Copyright (c) 2005-2019, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
return str_buf;
}
+
+//
+bool
+ASDCP::MXF::J2KExtendedCapabilities::Archive(Kumu::MemIOWriter* Writer) const {
+ if ( ! Writer->WriteUi32BE(Pcap) )
+ {
+ return false;
+ }
+
+ if ( ! Ccap.Archive(Writer) )
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//
+bool
+ASDCP::MXF::J2KExtendedCapabilities::Unarchive(Kumu::MemIOReader* Reader) {
+ if ( ! Reader->ReadUi32BE(&Pcap) )
+ {
+ return false;
+ }
+
+ if ( ! Ccap.Unarchive(Reader) )
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//
+const char*
+ASDCP::MXF::J2KExtendedCapabilities::EncodeString(char* str_buf, ui32_t buf_len) const
+{
+ const int str_len = ( sizeof(ui16_t) + 1 ) * JP2K::MaxCapabilities;
+
+ if ( Pcap != 0 && buf_len > str_len )
+ {
+ for ( int i = 0; i < Ccap.size(); ++i )
+ {
+ snprintf(str_buf+(i*3), 4, "%02hx.", Ccap[i]);
+ }
+
+ str_buf[str_len-1] = 0;
+ }
+ else
+ {
+ str_buf[0] = 0;
+ }
+
+ return str_buf;
+}
+
+
//
// end MXFTypes.cpp
//
/*
-Copyright (c) 2005-2016, John Hurst
+Copyright (c) 2005-2019, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
#define _MXFTYPES_H_
#include "KLV.h"
+#include "AS_DCP.h"
#include <list>
#include <vector>
#include <set>
const char* EncodeString(char* str_buf, ui32_t buf_len) const;
};
+ //
+ class J2KExtendedCapabilities : public Kumu::IArchive
+ {
+ public:
+ ui32_t Pcap;
+ Array<Kumu::ArchivableUi16> Ccap;
+
+ bool HasValue() const { return true; }
+ ui32_t ArchiveLength() const { return 0; }
+
+ bool Archive(Kumu::MemIOWriter* Writer) const;
+ bool Unarchive(Kumu::MemIOReader* Reader);
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ };
+
} // namespace MXF
} // namespace ASDCP
static InterchangeObject* TimedTextDescriptor_Factory(const Dictionary*& Dict) { return new TimedTextDescriptor(Dict); }
static InterchangeObject* TimedTextResourceSubDescriptor_Factory(const Dictionary*& Dict) { return new TimedTextResourceSubDescriptor(Dict); }
static InterchangeObject* StereoscopicPictureSubDescriptor_Factory(const Dictionary*& Dict) { return new StereoscopicPictureSubDescriptor(Dict); }
-static InterchangeObject* ContainerConstraintSubDescriptor_Factory(const Dictionary*& Dict) { return new ContainerConstraintSubDescriptor(Dict); }
+static InterchangeObject* ContainerConstraintsSubDescriptor_Factory(const Dictionary*& Dict) { return new ContainerConstraintsSubDescriptor(Dict); }
static InterchangeObject* NetworkLocator_Factory(const Dictionary*& Dict) { return new NetworkLocator(Dict); }
static InterchangeObject* MCALabelSubDescriptor_Factory(const Dictionary*& Dict) { return new MCALabelSubDescriptor(Dict); }
static InterchangeObject* AudioChannelLabelSubDescriptor_Factory(const Dictionary*& Dict) { return new AudioChannelLabelSubDescriptor(Dict); }
SetObjectFactory(Dict->ul(MDD_TimedTextDescriptor), TimedTextDescriptor_Factory);
SetObjectFactory(Dict->ul(MDD_TimedTextResourceSubDescriptor), TimedTextResourceSubDescriptor_Factory);
SetObjectFactory(Dict->ul(MDD_StereoscopicPictureSubDescriptor), StereoscopicPictureSubDescriptor_Factory);
- SetObjectFactory(Dict->ul(MDD_ContainerConstraintSubDescriptor), ContainerConstraintSubDescriptor_Factory);
+ SetObjectFactory(Dict->ul(MDD_ContainerConstraintsSubDescriptor), ContainerConstraintsSubDescriptor_Factory);
SetObjectFactory(Dict->ul(MDD_NetworkLocator), NetworkLocator_Factory);
SetObjectFactory(Dict->ul(MDD_MCALabelSubDescriptor), MCALabelSubDescriptor_Factory);
SetObjectFactory(Dict->ul(MDD_AudioChannelLabelSubDescriptor), AudioChannelLabelSubDescriptor_Factory);
result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(JPEG2000PictureSubDescriptor, J2CLayout));
J2CLayout.set_has_value( result == RESULT_OK );
}
+ if ( ASDCP_SUCCESS(result) ) {
+ result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(JPEG2000PictureSubDescriptor, J2KExtendedCapabilities));
+ J2KExtendedCapabilities.set_has_value( result == RESULT_OK );
+ }
+ if ( ASDCP_SUCCESS(result) ) {
+ result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(JPEG2000PictureSubDescriptor, J2KProfile));
+ J2KProfile.set_has_value( result == RESULT_OK );
+ }
+ if ( ASDCP_SUCCESS(result) ) {
+ result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(JPEG2000PictureSubDescriptor, J2KCorrespondingProfile));
+ J2KCorrespondingProfile.set_has_value( result == RESULT_OK );
+ }
return result;
}
if ( ASDCP_SUCCESS(result) && ! CodingStyleDefault.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, CodingStyleDefault));
if ( ASDCP_SUCCESS(result) && ! QuantizationDefault.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, QuantizationDefault));
if ( ASDCP_SUCCESS(result) && ! J2CLayout.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, J2CLayout));
+ if ( ASDCP_SUCCESS(result) && ! J2KExtendedCapabilities.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, J2KExtendedCapabilities));
+ if ( ASDCP_SUCCESS(result) && ! J2KProfile.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, J2KProfile));
+ if ( ASDCP_SUCCESS(result) && ! J2KCorrespondingProfile.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(JPEG2000PictureSubDescriptor, J2KCorrespondingProfile));
return result;
}
CodingStyleDefault = rhs.CodingStyleDefault;
QuantizationDefault = rhs.QuantizationDefault;
J2CLayout = rhs.J2CLayout;
+ J2KExtendedCapabilities = rhs.J2KExtendedCapabilities;
+ J2KProfile = rhs.J2KProfile;
+ J2KCorrespondingProfile = rhs.J2KCorrespondingProfile;
}
//
if ( ! J2CLayout.empty() ) {
fprintf(stream, " %22s = %s\n", "J2CLayout", J2CLayout.get().EncodeString(identbuf, IdentBufferLen));
}
+ if ( ! J2KExtendedCapabilities.empty() ) {
+ fprintf(stream, " %22s = %s\n", "J2KExtendedCapabilities", J2KExtendedCapabilities.get().EncodeString(identbuf, IdentBufferLen));
+ }
+ if ( ! J2KProfile.empty() ) {
+ fprintf(stream, " %22s:\n", "J2KProfile");
+ J2KProfile.get().Dump(stream);
+ }
+ if ( ! J2KCorrespondingProfile.empty() ) {
+ fprintf(stream, " %22s:\n", "J2KCorrespondingProfile");
+ J2KCorrespondingProfile.get().Dump(stream);
+ }
}
//
}
//------------------------------------------------------------------------------------------
-// ContainerConstraintSubDescriptor
+// ContainerConstraintsSubDescriptor
//
-ContainerConstraintSubDescriptor::ContainerConstraintSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
+ContainerConstraintsSubDescriptor::ContainerConstraintsSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
{
assert(m_Dict);
- m_UL = m_Dict->ul(MDD_ContainerConstraintSubDescriptor);
+ m_UL = m_Dict->ul(MDD_ContainerConstraintsSubDescriptor);
}
-ContainerConstraintSubDescriptor::ContainerConstraintSubDescriptor(const ContainerConstraintSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+ContainerConstraintsSubDescriptor::ContainerConstraintsSubDescriptor(const ContainerConstraintsSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
{
assert(m_Dict);
- m_UL = m_Dict->ul(MDD_ContainerConstraintSubDescriptor);
+ m_UL = m_Dict->ul(MDD_ContainerConstraintsSubDescriptor);
Copy(rhs);
}
//
ASDCP::Result_t
-ContainerConstraintSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
+ContainerConstraintsSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
{
assert(m_Dict);
Result_t result = InterchangeObject::InitFromTLVSet(TLVSet);
//
ASDCP::Result_t
-ContainerConstraintSubDescriptor::WriteToTLVSet(TLVWriter& TLVSet)
+ContainerConstraintsSubDescriptor::WriteToTLVSet(TLVWriter& TLVSet)
{
assert(m_Dict);
Result_t result = InterchangeObject::WriteToTLVSet(TLVSet);
//
void
-ContainerConstraintSubDescriptor::Copy(const ContainerConstraintSubDescriptor& rhs)
+ContainerConstraintsSubDescriptor::Copy(const ContainerConstraintsSubDescriptor& rhs)
{
InterchangeObject::Copy(rhs);
}
//
void
-ContainerConstraintSubDescriptor::Dump(FILE* stream)
+ContainerConstraintsSubDescriptor::Dump(FILE* stream)
{
char identbuf[IdentBufferLen];
*identbuf = 0;
//
ASDCP::Result_t
-ContainerConstraintSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
+ContainerConstraintsSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
return InterchangeObject::InitFromBuffer(p, l);
}
//
ASDCP::Result_t
-ContainerConstraintSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
+ContainerConstraintsSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
return InterchangeObject::WriteToBuffer(Buffer);
}
optional_property<Raw > CodingStyleDefault;
optional_property<Raw > QuantizationDefault;
optional_property<RGBALayout > J2CLayout;
+ optional_property<J2KExtendedCapabilities > J2KExtendedCapabilities;
+ optional_property<Array<Kumu::ArchivableUi16> > J2KProfile;
+ optional_property<Array<Kumu::ArchivableUi16> > J2KCorrespondingProfile;
JPEG2000PictureSubDescriptor(const Dictionary*& d);
JPEG2000PictureSubDescriptor(const JPEG2000PictureSubDescriptor& rhs);
virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
};
- //
- class ContainerConstraintSubDescriptor : public InterchangeObject
+ // A ContainerConstraintsSubDescriptor is required to be present in the top level File Descriptor for the Constrained Generic Container per ST 379-2
+ class ContainerConstraintsSubDescriptor : public InterchangeObject
{
- ContainerConstraintSubDescriptor();
+ ContainerConstraintsSubDescriptor();
public:
const Dictionary*& m_Dict;
- ContainerConstraintSubDescriptor(const Dictionary*& d);
- ContainerConstraintSubDescriptor(const ContainerConstraintSubDescriptor& rhs);
- virtual ~ContainerConstraintSubDescriptor() {}
+ ContainerConstraintsSubDescriptor(const Dictionary*& d);
+ ContainerConstraintsSubDescriptor(const ContainerConstraintsSubDescriptor& rhs);
+ virtual ~ContainerConstraintsSubDescriptor() {}
- const ContainerConstraintSubDescriptor& operator=(const ContainerConstraintSubDescriptor& rhs) { Copy(rhs); return *this; }
- virtual void Copy(const ContainerConstraintSubDescriptor& rhs);
- virtual const char* HasName() { return "ContainerConstraintSubDescriptor"; }
+ const ContainerConstraintsSubDescriptor& operator=(const ContainerConstraintsSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const ContainerConstraintsSubDescriptor& rhs);
+ virtual const char* HasName() { return "ContainerConstraintsSubDescriptor"; }
virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
virtual void Dump(FILE* = 0);
ASDCP::MXF::ACESPictureSubDescriptor* aces_picture_subdescriptor = new ASDCP::MXF::ACESPictureSubDescriptor(g_dict);
Kumu::GenRandomValue(aces_picture_subdescriptor->InstanceUID);
result = AS_02::ACES::ACES_PDesc_to_MD(PDesc, *g_dict, *tmp_dscr);
+ ASDCP::MXF::ContainerConstraintsSubDescriptor* gc_subdescriptor = new ASDCP::MXF::ContainerConstraintsSubDescriptor(g_dict);
+ Kumu::GenRandomValue(gc_subdescriptor->InstanceUID);
+ essence_sub_descriptors.push_back(gc_subdescriptor);
if (ASDCP_SUCCESS(result))
{
{
has_tlm = true;
}
+ else if ( current_marker.m_Type == MRK_CAP )
+ {
+ Accessor::CAP CAP_(current_marker);
+ CAP_.Dump(stdout);
+ }
+ else if ( current_marker.m_Type == MRK_PRF )
+ {
+ Accessor::PRF PRF_(current_marker);
+ PRF_.Dump(stdout);
+ }
+ else if ( current_marker.m_Type == MRK_CPF )
+ {
+ Accessor::CPF CPF_(current_marker);
+ CPF_.Dump(stdout);
+ }
else
{
fprintf(stderr, "Unprocessed marker - %s\n", GetMarkerString(current_marker.m_Type));