/* * Write the JP2H box * * JP2 Header box * */ void jp2_write_jp2h(jp2_struct_t * jp2_struct) { jp2_box_t box; box.init_pos = cio_tell(); cio_skip(4);; cio_write(JP2_JP2H, 4); /* JP2H */ jp2_write_ihdr(jp2_struct); if (jp2_struct->bpc == 255) jp2_write_bpcc(jp2_struct); jp2_write_colr(jp2_struct); box.length = cio_tell() - box.init_pos; cio_seek(box.init_pos); cio_write(box.length, 4); /* L */ cio_seek(box.init_pos + box.length); }
void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio) { opj_jp2_box_t box; box.init_pos = cio_tell(cio); cio_skip(cio, 4); cio_write(cio, JP2_JP2H, 4); /* JP2H */ jp2_write_ihdr(jp2, cio); if (jp2->bpc == 255) { jp2_write_bpcc(jp2, cio); } jp2_write_colr(jp2, cio); box.length = cio_tell(cio) - box.init_pos; cio_seek(cio, box.init_pos); cio_write(cio, box.length, 4); /* L */ cio_seek(cio, box.init_pos + box.length); }