int jp2_encode(jp2_struct_t * jp2_struct, j2k_cp_t * cp, char *output, char *index) { int len; jp2_write_jp(); jp2_write_ftyp(jp2_struct); jp2_write_jp2h(jp2_struct); len = jp2_write_jp2c(jp2_struct->image, cp, output, index); return cio_tell(); }
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) { int pos_iptr, pos_cidx, pos_jp2c, len_jp2c, len_cidx, end_pos, pos_fidx, len_fidx; pos_jp2c = pos_iptr = -1; /* remove a warning */ /* JP2 encoding */ /* JPEG 2000 Signature box */ jp2_write_jp(cio); /* File Type box */ jp2_write_ftyp(jp2, cio); /* JP2 Header box */ jp2_write_jp2h(jp2, cio); #if 0 if( jp2->jpip_on){ pos_iptr = cio_tell( cio); cio_skip( cio, 24); /* IPTR further ! */ pos_jp2c = cio_tell( cio); } #endif /* J2K encoding */ if(!(len_jp2c = jp2_write_jp2c( jp2, cio, image, cstr_info))){ opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n"); return OPJ_FALSE; } #if 0 if( jp2->jpip_on){ pos_cidx = cio_tell( cio); len_cidx = write_cidx( pos_jp2c+8, cio, image, *cstr_info, len_jp2c-8); pos_fidx = cio_tell( cio); len_fidx = write_fidx( pos_jp2c, len_jp2c, pos_cidx, len_cidx, cio); end_pos = cio_tell( cio); cio_seek( cio, pos_iptr); write_iptr( pos_fidx, len_fidx, cio); cio_seek( cio, end_pos); } #endif return OPJ_TRUE; }
bool jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) { /* JP2 encoding */ /* JPEG 2000 Signature box */ jp2_write_jp(cio); /* File Type box */ jp2_write_ftyp(jp2, cio); /* JP2 Header box */ jp2_write_jp2h(jp2, cio); /* J2K encoding */ if(!jp2_write_jp2c(jp2, cio, image, cstr_info)) { opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n"); return false; } return true; }
opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) { int pos_iptr, pos_jp2c, len_jp2c; pos_jp2c = pos_iptr = -1; /* remove a warning */ /* JP2 encoding */ /* JPEG 2000 Signature box */ jp2_write_jp(cio); /* File Type box */ jp2_write_ftyp(jp2, cio); /* JP2 Header box */ jp2_write_jp2h(jp2, cio); /* J2K encoding */ if(!(len_jp2c = jp2_write_jp2c( jp2, cio, image, cstr_info))){ opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n"); return OPJ_FALSE; } return OPJ_TRUE; }