[trunk] refactoring of rsiz, profiles, and extensions management
[openjpeg.git] / src / bin / jp2 / convert.c
index a59c3c76edf86e153c9a5ed8c5e44eb0e693d974..1b2d3618ef8debf5977147b97b3b29ae1d542d73 100644 (file)
@@ -1,9 +1,15 @@
 /*
- * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
- * Copyright (c) 2002-2007, Professor Benoit Macq
+ * The copyright in this software is being made available under the 2-clauses 
+ * BSD License, included below. This software may be subject to other third 
+ * party and contributor rights, including patent rights, and no such rights
+ * are granted under this license.
+ *
+ * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
+ * Copyright (c) 2002-2014, Professor Benoit Macq
  * Copyright (c) 2001-2003, David Janssens
  * Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux 
+ * Copyright (c) 2003-2014, Antonin Descampe
  * Copyright (c) 2005, Herve Drolon, FreeImage Team
  * Copyright (c) 2006-2007, Parvatha Elangovan
  * All rights reserved.
@@ -2591,6 +2597,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
     int has_alpha = 0;
     unsigned short tiBps, tiPhoto, tiSf, tiSpp, tiPC;
     unsigned int tiWidth, tiHeight;
+    OPJ_BOOL is_cinema = OPJ_IS_CINEMA(parameters->rsiz);
 
     tif = TIFFOpen(filename, "r");
 
@@ -2663,7 +2670,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
 */ 
     memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
 
-    if ((tiPhoto == PHOTOMETRIC_RGB) && (parameters->cp_cinema)) {
+    if ((tiPhoto == PHOTOMETRIC_RGB) && (is_cinema)) {
         fprintf(stdout,"WARNING:\n"
                 "Input image bitdepth is %d bits\n"
                 "TIF conversion has automatically rescaled to 12-bits\n"
@@ -2679,7 +2686,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
         /*#define USETILEMODE*/
         for(j = 0; j < numcomps; j++)
         {
-            if(parameters->cp_cinema)
+            if(is_cinema)
             {
                 cmptparm[j].prec = 12;
                 cmptparm[j].bpp = 12;
@@ -2748,7 +2755,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
                         if(has_alpha)
                             image->comps[3].data[index] = ( dat8[i+7] << 8 ) | dat8[i+6];
 
-                        if(parameters->cp_cinema)
+                        if(is_cinema)
                         {
                             /* Rounding 16 to 12 bits
 */
@@ -2785,7 +2792,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
                                 image->comps[3].data[index] = dat8[i+3];
 #endif
 
-                            if(parameters->cp_cinema)
+                            if(is_cinema)
                             {
                                 /* Rounding 8 to 12 bits
 */