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,7 +1474,8 @@ 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 */
if (j2k->cp->limit_decoding != DECODE_ALL_BUT_PACKETS) {
opj_tcd_t *tcd = tcd_create(j2k->cinfo); opj_tcd_t *tcd = tcd_create(j2k->cinfo);
tcd_malloc_decode(tcd, j2k->image, j2k->cp); tcd_malloc_decode(tcd, j2k->image, j2k->cp);
for (i = 0; i < j2k->cp->tileno_size; i++) { for (i = 0; i < j2k->cp->tileno_size; i++) {
@ -1485,13 +1486,15 @@ static void j2k_read_eoc(opj_j2k_t *j2k) {
} }
tcd_free_decode(tcd); tcd_free_decode(tcd);
tcd_destroy(tcd); tcd_destroy(tcd);
#else }
/* if packets should not be decoded */
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;