[trunk] fixes issue #357. MCT is automatically disabled when
subsamppling is detected.
This commit is contained in:
parent
a38b97fae0
commit
7d21871ed8
|
@ -3018,7 +3018,7 @@ static opj_image_t* rawtoimage_common(const char *filename, opj_cparameters_t *p
|
||||||
{
|
{
|
||||||
unsigned char value = 0;
|
unsigned char value = 0;
|
||||||
for(compno = 0; compno < numcomps; compno++) {
|
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++) {
|
for (i = 0; i < nloop; i++) {
|
||||||
if (!fread(&value, 1, 1, f)) {
|
if (!fread(&value, 1, 1, f)) {
|
||||||
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
||||||
|
|
|
@ -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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6453,6 +6453,15 @@ void opj_j2k_setup_encoder( opj_j2k_t *p_j2k,
|
||||||
opj_j2k_setup_mct_encoding(tcp,image);
|
opj_j2k_setup_mct_encoding(tcp,image);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(tcp->mct==1 && image->numcomps == 3) { // RGB->YCC MCT is enabled
|
||||||
|
if ((image->comps[0].dx != image->comps[1].dx) ||
|
||||||
|
(image->comps[0].dx != image->comps[2].dx) ||
|
||||||
|
(image->comps[0].dy != image->comps[1].dy) ||
|
||||||
|
(image->comps[0].dy != image->comps[2].dy)) {
|
||||||
|
opj_event_msg(p_manager, EVT_WARNING, "Cannot perform MCT on components with different sizes. Disabling MCT.\n");
|
||||||
|
tcp->mct = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (i = 0; i < image->numcomps; i++) {
|
for (i = 0; i < image->numcomps; i++) {
|
||||||
opj_tccp_t *tccp = &tcp->tccps[i];
|
opj_tccp_t *tccp = &tcp->tccps[i];
|
||||||
opj_image_comp_t * l_comp = &(image->comps[i]);
|
opj_image_comp_t * l_comp = &(image->comps[i]);
|
||||||
|
|
Loading…
Reference in New Issue