[trunk] fixed indentation in opj_compress.c, renamed 2 internal

functions, added some comments
This commit is contained in:
Antonin Descampe 2014-01-16 14:21:14 +00:00
parent 7b14cf8558
commit c59124dfe2
1 changed files with 1692 additions and 1674 deletions

View File

@ -464,12 +464,14 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
return 2;
}
static void cinema_parameters(opj_cparameters_t *parameters){
static void set_cinema_parameters(opj_cparameters_t *parameters){
/* No tiling */
parameters->tile_size_on = OPJ_FALSE;
parameters->cp_tdx=1;
parameters->cp_tdy=1;
/*Tile part*/
/* One tile part for each component */
parameters->tp_flag = 'C';
parameters->tp_on = 1;
@ -482,6 +484,8 @@ static void cinema_parameters(opj_cparameters_t *parameters){
/* Codeblock size= 32*32 */
parameters->cblockw_init = 32;
parameters->cblockh_init = 32;
/* Use of precincts */
parameters->csty |= 0x01;
/* The progression order shall be CPRL */
@ -490,40 +494,53 @@ static void cinema_parameters(opj_cparameters_t *parameters){
/* No ROI */
parameters->roi_compno = -1;
parameters->subsampling_dx = 1; parameters->subsampling_dy = 1;
/* No subsampling */
parameters->subsampling_dx = 1;
parameters->subsampling_dy = 1;
/* 9-7 transform */
parameters->irreversible = 1;
}
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
static void setup_cinema_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
int i;
float temp_rate;
/* Size and resolution levels */
switch (parameters->cp_cinema){
case OPJ_CINEMA2K_24:
case OPJ_CINEMA2K_48:
if(parameters->numresolution > 6){
fprintf(stdout,"JPEG 2000 Profile-3 (2k dc profile) requires:\n"
"Number of decomposition levels <= 5\n"
"-> Number of decomposition levels forced to 5");
parameters->numresolution = 6;
}
if (!((image->comps[0].w == 2048) | (image->comps[0].h == 1080))){
fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
"(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n",
fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\n"
"JPEG 2000 Profile-3 (2k dc profile) requires:\n"
"at least one of coordinates match 2048 x 1080\n",
image->comps[0].w,image->comps[0].h);
parameters->cp_rsiz = OPJ_STD_RSIZ;
}
break;
case OPJ_CINEMA4K_24:
if(parameters->numresolution < 1){
fprintf(stdout,"JPEG 2000 Profile-4 (4k dc profile) requires:\n"
"Number of decomposition levels >= 1 && <= 6\n"
"-> Number of decomposition levels forced to 1");
parameters->numresolution = 1;
}else if(parameters->numresolution > 7){
fprintf(stdout,"JPEG 2000 Profile-4 (4k dc profile) requires:\n"
"Number of decomposition levels >= 1 && <= 6\n"
"-> Number of decomposition levels forced to 6");
parameters->numresolution = 7;
}
if (!((image->comps[0].w == 4096) | (image->comps[0].h == 2160))){
fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\n"
"JPEG 2000 Profile-4 (4k dc profile) requires:\n"
"at least one of coordinates match 4096 x 2160\n",
image->comps[0].w,image->comps[0].h);
parameters->cp_rsiz = OPJ_STD_RSIZ;
}
@ -533,6 +550,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
break;
}
/* Limited bit-rate */
switch (parameters->cp_cinema){
case OPJ_CINEMA2K_24:
case OPJ_CINEMA4K_24:
@ -1623,7 +1641,7 @@ int main(int argc, char **argv) {
for(i=0; i< parameters.tcp_numlayers; i++){
img_fol.rates[i] = parameters.tcp_rates[i];
}
cinema_parameters(&parameters);
set_cinema_parameters(&parameters);
}
/* Create comment for codestream */
@ -1784,7 +1802,7 @@ int main(int argc, char **argv) {
parameters.tcp_mct = image->numcomps == 3 ? 1 : 0;
if(parameters.cp_cinema){
cinema_setup_encoder(&parameters,image,&img_fol);
setup_cinema_encoder(&parameters,image,&img_fol);
}
/* encode the destination image */