77 #include "jasper/jas_types.h"    83 #define JP2_SPTOBPC(s, p) \    84         ((((p) - 1) & 0x7f) | (((s) & 1) << 7))    90 #define JP2_BOX_HDRLEN(ext) ((ext) ? 16 : 8)    93 #define JP2_BOX_JP              0x6a502020          94 #define JP2_BOX_FTYP    0x66747970          95 #define JP2_BOX_JP2H    0x6a703268          96 #define JP2_BOX_IHDR    0x69686472          97 #define JP2_BOX_BPCC    0x62706363          98 #define JP2_BOX_COLR    0x636f6c72          99 #define JP2_BOX_PCLR    0x70636c72         100 #define JP2_BOX_CMAP    0x636d6170         101 #define JP2_BOX_CDEF    0x63646566         102 #define JP2_BOX_RES             0x72657320         103 #define JP2_BOX_RESC    0x72657363         104 #define JP2_BOX_RESD    0x72657364         105 #define JP2_BOX_JP2C    0x6a703263         106 #define JP2_BOX_JP2I    0x6a703269         107 #define JP2_BOX_XML             0x786d6c20         108 #define JP2_BOX_UUID    0x75756964         109 #define JP2_BOX_UINF    0x75696e66         110 #define JP2_BOX_ULST    0x75637374         111 #define JP2_BOX_URL             0x75726c20         113 #define JP2_BOX_SUPER   0x01   114 #define JP2_BOX_NODATA  0x02   118 #define JP2_JP_MAGIC    0x0d0a870a   119 #define JP2_JP_LEN              12   127 #define JP2_FTYP_MAXCOMPATCODES 32   128 #define JP2_FTYP_MAJVER         0x6a703220   129 #define JP2_FTYP_MINVER         0   130 #define JP2_FTYP_COMPATCODE             JP2_FTYP_MAJVER   133         uint_fast32_t majver;
   134         uint_fast32_t minver;
   135         uint_fast32_t numcompatcodes;
   136         uint_fast32_t compatcodes[JP2_FTYP_MAXCOMPATCODES];
   141 #define JP2_IHDR_COMPTYPE       7   142 #define JP2_IHDR_BPCNULL        255   146         uint_fast32_t height;
   147         uint_fast16_t numcmpts;
   149         uint_fast8_t comptype;
   157         uint_fast16_t numcmpts;
   163 #define JP2_COLR_ENUM   1   164 #define JP2_COLR_ICC    2   165 #define JP2_COLR_PRI    0   167 #define JP2_COLR_SRGB   16   168 #define JP2_COLR_SGRAY  17   169 #define JP2_COLR_SYCC   18   184         uint_fast16_t numlutents;
   185         uint_fast8_t numchans;
   186         int_fast32_t *lutdata;
   192 #define JP2_CDEF_RGB_R  1   193 #define JP2_CDEF_RGB_G  2   194 #define JP2_CDEF_RGB_B  3   196 #define JP2_CDEF_YCBCR_Y        1   197 #define JP2_CDEF_YCBCR_CB       2   198 #define JP2_CDEF_YCBCR_CR       3   200 #define JP2_CDEF_GRAY_Y 1   202 #define JP2_CDEF_TYPE_COLOR     0   203 #define JP2_CDEF_TYPE_OPACITY   1   204 #define JP2_CDEF_TYPE_UNSPEC    65535   205 #define JP2_CDEF_ASOC_ALL       0   206 #define JP2_CDEF_ASOC_NONE      65535   209         uint_fast16_t channo;
   217         uint_fast16_t numchans;
   218         jp2_cdefchan_t *ents;
   222         uint_fast16_t cmptno;
   228         uint_fast16_t numchans;
   232 #define JP2_CMAP_DIRECT         0   233 #define JP2_CMAP_PALETTE        1   240         struct jp2_boxops_s *ops;
   241         struct jp2_boxinfo_s *info;
   249         uint_fast32_t datalen;
   264 typedef struct jp2_boxops_s {
   265         void (*init)(jp2_box_t *box);
   266         void (*destroy)(jp2_box_t *box);
   267         int (*getdata)(jp2_box_t *box, jas_stream_t *in);
   268         int (*putdata)(jp2_box_t *box, jas_stream_t *out);
   269         void (*dumpdata)(jp2_box_t *box, FILE *out);
   276 typedef struct jp2_boxinfo_s {
   287 jp2_box_t *jp2_box_create(
int type);
   288 void jp2_box_destroy(jp2_box_t *box);
   289 jp2_box_t *jp2_box_get(jas_stream_t *in);
   290 int jp2_box_put(jp2_box_t *box, jas_stream_t *out);
   292 #define JP2_DTYPETOBPC(dtype) \   293   ((JAS_IMAGE_CDT_GETSGND(dtype) << 7) | (JAS_IMAGE_CDT_GETPREC(dtype) - 1))   294 #define JP2_BPCTODTYPE(bpc) \   295   (JAS_IMAGE_CDT_SETSGND(bpc >> 7) | JAS_IMAGE_CDT_SETPREC((bpc & 0x7f) + 1))   297 #define ICC_CS_RGB      0x52474220   298 #define ICC_CS_YCBCR    0x59436272   299 #define ICC_CS_GRAY     0x47524159   301 jp2_cdefchan_t *jp2_cdef_lookup(jp2_cdef_t *cdef, 
int channo);