summaryrefslogtreecommitdiff
path: root/src/JP2K.h
diff options
context:
space:
mode:
authorPierre-Anthony Lemieux <pal@palemieux.com>2019-11-28 10:58:15 -0800
committerPierre-Anthony Lemieux <pal@palemieux.com>2019-11-28 10:58:15 -0800
commit2a1a0da4f67debb7dcfd01b885dad35279f27663 (patch)
treea9d63ba3ca95aa0b7837310b61685312b3d12824 /src/JP2K.h
parent20c2f749a4593c418259bcf8b5f6f0775b70d910 (diff)
Added support for CAP, PRF and CPF markers
Improved Marker vs Marker Segment discrimination
Diffstat (limited to 'src/JP2K.h')
-rwxr-xr-xsrc/JP2K.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/JP2K.h b/src/JP2K.h
index b043dfc..5599b2b 100755
--- a/src/JP2K.h
+++ b/src/JP2K.h
@@ -54,9 +54,12 @@ namespace JP2K
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
@@ -219,6 +222,85 @@ namespace JP2K
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_CPF);
+
+ 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;
+
+ 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));
+ }
+
+ ~CAP() {}
+
+ inline ui32_t pcap() const { return m_Pcap; }
+
+ 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