Possibility to choose to apply MCT (multiple component transform) enabled, and new decoding_limit: DECODE_ALL_BUT_PACKETS

This commit is contained in:
Francois-Olivier Devaux 2007-05-10 14:13:30 +00:00
parent 7c9dc11e33
commit f3170bf64e
2 changed files with 22 additions and 17 deletions

View File

@ -1542,6 +1542,8 @@ int main(int argc, char **argv) {
} }
break; break;
} }
/* Decide if MCT should be used */
parameters.tcp_mct = image->numcomps == 3 ? 1 : 0;
if(parameters.cp_cinema){ if(parameters.cp_cinema){
cinema_setup_encoder(&parameters,image); cinema_setup_encoder(&parameters,image);

View File

@ -1474,24 +1474,27 @@ static void j2k_write_eoc(opj_j2k_t *j2k) {
static void j2k_read_eoc(opj_j2k_t *j2k) { static void j2k_read_eoc(opj_j2k_t *j2k) {
int i, tileno; int i, tileno;
#ifndef NO_PACKETS_DECODING /* if packets should be decoded */
opj_tcd_t *tcd = tcd_create(j2k->cinfo); if (j2k->cp->limit_decoding != DECODE_ALL_BUT_PACKETS) {
tcd_malloc_decode(tcd, j2k->image, j2k->cp); opj_tcd_t *tcd = tcd_create(j2k->cinfo);
for (i = 0; i < j2k->cp->tileno_size; i++) { tcd_malloc_decode(tcd, j2k->image, j2k->cp);
tileno = j2k->cp->tileno[i]; for (i = 0; i < j2k->cp->tileno_size; i++) {
tcd_decode_tile(tcd, j2k->tile_data[tileno], j2k->tile_len[tileno], tileno); tileno = j2k->cp->tileno[i];
opj_free(j2k->tile_data[tileno]); tcd_decode_tile(tcd, j2k->tile_data[tileno], j2k->tile_len[tileno], tileno);
j2k->tile_data[tileno] = NULL; opj_free(j2k->tile_data[tileno]);
j2k->tile_data[tileno] = NULL;
}
tcd_free_decode(tcd);
tcd_destroy(tcd);
} }
tcd_free_decode(tcd); /* if packets should not be decoded */
tcd_destroy(tcd); else {
#else for (i = 0; i < j2k->cp->tileno_size; i++) {
for (i = 0; i < j2k->cp->tileno_size; i++) { tileno = j2k->cp->tileno[i];
tileno = j2k->cp->tileno[i]; opj_free(j2k->tile_data[tileno]);
opj_free(j2k->tile_data[tileno]); j2k->tile_data[tileno] = NULL;
j2k->tile_data[tileno] = NULL; }
} }
#endif
j2k->state = J2K_STATE_MT; j2k->state = J2K_STATE_MT;
} }
@ -2083,7 +2086,7 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_
} }
tcp->csty = parameters->csty; tcp->csty = parameters->csty;
tcp->prg = parameters->prog_order; tcp->prg = parameters->prog_order;
tcp->mct = image->numcomps == 3 ? 1 : 0; tcp->mct = parameters->tcp_mct;
numpocs_tile = 0; numpocs_tile = 0;
tcp->POC = 0; tcp->POC = 0;