summaryrefslogtreecommitdiff
path: root/src/bin/jp2
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2014-07-03 09:15:13 +0000
committerAntonin Descampe <antonin@gmail.com>2014-07-03 09:15:13 +0000
commit7d21871ed8124e8e3056e4d81618485596f952df (patch)
tree2920334cbaef19976eff1bc0e5311622978d58cf /src/bin/jp2
parenta38b97fae0c9f66ff5c7f152d9ce88f6ee73a5b4 (diff)
[trunk] fixes issue #357. MCT is automatically disabled when
subsamppling is detected.
Diffstat (limited to 'src/bin/jp2')
-rw-r--r--src/bin/jp2/convert.c2
-rw-r--r--src/bin/jp2/opj_compress.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index 1b2d3618..9ce3eb39 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -3018,7 +3018,7 @@ static opj_image_t* rawtoimage_common(const char *filename, opj_cparameters_t *p
{
unsigned char value = 0;
for(compno = 0; compno < numcomps; compno++) {
- int nloop = (w*h)/(raw_cp->rawComps[compno].dx*raw_cp->rawComps[compno].dx);
+ int nloop = (w*h)/(raw_cp->rawComps[compno].dx*raw_cp->rawComps[compno].dy);
for (i = 0; i < nloop; i++) {
if (!fread(&value, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c
index f2b3f2fb..8736f535 100644
--- a/src/bin/jp2/opj_compress.c
+++ b/src/bin/jp2/opj_compress.c
@@ -1500,6 +1500,16 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
}
}
+ /* If subsampled image is provided, automatically disable MCT */
+ if ( ((parameters->decod_format == RAW_DFMT)
+ || (parameters->decod_format == RAWL_DFMT))
+ && ((raw_cp->rawComps[1].dx > 1)
+ || (raw_cp->rawComps[1].dy > 1)
+ || (raw_cp->rawComps[2].dx > 1)
+ || (raw_cp->rawComps[2].dy > 1))) {
+ parameters->tcp_mct = 0;
+ }
+
return 0;
}