in opj_image_comp and opj_image_comptparm structures.
bpp was redundant with prec, and almost never set by the library, except
by opj_image_create(). This change should hopefully not impact existing,
working, users of the API, which should already have used prec to get
things working.
Fixes #1379
}
}
component->prec = precision;
- component->bpp = precision;
}
void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision)
{
l_data[i] >>= shift;
}
}
- component->bpp = precision;
component->prec = precision;
}
for (i = 0; i < numcomps; i++) {
cmptparm[i].prec = 8;
- cmptparm[i].bpp = 8;
cmptparm[i].sgnd = 0;
cmptparm[i].dx = (OPJ_UINT32)subsampling_dx;
cmptparm[i].dy = (OPJ_UINT32)subsampling_dy;
}
cmptparm.prec = (OPJ_UINT32)prec;
- cmptparm.bpp = (OPJ_UINT32)prec;
cmptparm.dx = (OPJ_UINT32)parameters->subsampling_dx;
cmptparm.dy = (OPJ_UINT32)parameters->subsampling_dy;
comp->data[i] = v;
}
fclose(f);
- comp->bpp = (OPJ_UINT32)int_floorlog2(max) + 1;
+ comp->prec = (OPJ_UINT32)int_floorlog2(max) + 1;
return image;
}
for (i = 0; i < numcomps; i++) {
cmptparm[i].prec = (OPJ_UINT32)prec;
- cmptparm[i].bpp = (OPJ_UINT32)prec;
cmptparm[i].sgnd = 0;
cmptparm[i].dx = (OPJ_UINT32)subsampling_dx;
cmptparm[i].dy = (OPJ_UINT32)subsampling_dy;
/* initialize image components */
for (i = 0; i < numcomps; i++) {
cmptparm[i].prec = (OPJ_UINT32)raw_cp->rawBitDepth;
- cmptparm[i].bpp = (OPJ_UINT32)raw_cp->rawBitDepth;
cmptparm[i].sgnd = (OPJ_UINT32)raw_cp->rawSigned;
cmptparm[i].dx = (OPJ_UINT32)(subsampling_dx * raw_cp->rawComps[i].dx);
cmptparm[i].dy = (OPJ_UINT32)(subsampling_dy * raw_cp->rawComps[i].dy);
bmp_mask_get_shift_and_prec(blueMask, &blueShift, &bluePrec);
bmp_mask_get_shift_and_prec(alphaMask, &alphaShift, &alphaPrec);
- image->comps[0].bpp = redPrec;
image->comps[0].prec = redPrec;
- image->comps[1].bpp = greenPrec;
image->comps[1].prec = greenPrec;
- image->comps[2].bpp = bluePrec;
image->comps[2].prec = bluePrec;
if (hasAlpha) {
- image->comps[3].bpp = alphaPrec;
image->comps[3].prec = alphaPrec;
}
bmp_mask_get_shift_and_prec(blueMask, &blueShift, &bluePrec);
bmp_mask_get_shift_and_prec(alphaMask, &alphaShift, &alphaPrec);
- image->comps[0].bpp = redPrec;
image->comps[0].prec = redPrec;
- image->comps[1].bpp = greenPrec;
image->comps[1].prec = greenPrec;
- image->comps[2].bpp = bluePrec;
image->comps[2].prec = bluePrec;
if (hasAlpha) {
- image->comps[3].bpp = alphaPrec;
image->comps[3].prec = alphaPrec;
}
memset(&cmptparm[0], 0, sizeof(cmptparm));
for (i = 0; i < 4U; i++) {
cmptparm[i].prec = 8;
- cmptparm[i].bpp = 8;
cmptparm[i].sgnd = 0;
cmptparm[i].dx = (OPJ_UINT32)parameters->subsampling_dx;
cmptparm[i].dy = (OPJ_UINT32)parameters->subsampling_dy;
/* Create image */
memset(cmptparm, 0, sizeof(cmptparm));
for (i = 0; i < nr_comp; ++i) {
- cmptparm[i].prec = (OPJ_UINT32)bit_depth;
/* bits_per_pixel: 8 or 16 */
- cmptparm[i].bpp = (OPJ_UINT32)bit_depth;
+ cmptparm[i].prec = (OPJ_UINT32)bit_depth;
cmptparm[i].sgnd = 0;
cmptparm[i].dx = (OPJ_UINT32)params->subsampling_dx;
cmptparm[i].dy = (OPJ_UINT32)params->subsampling_dy;
for (j = 0; j < numcomps; j++) {
cmptparm[j].prec = tiBps;
- cmptparm[j].bpp = tiBps;
cmptparm[j].dx = (OPJ_UINT32)subsampling_dx;
cmptparm[j].dy = (OPJ_UINT32)subsampling_dy;
cmptparm[j].w = (OPJ_UINT32)w;
return NULL;
}
- l_new_components[0].bpp = l_new_components[1].bpp = l_new_components[2].bpp =
- original->comps[0].bpp;
l_new_components[0].dx = l_new_components[1].dx = l_new_components[2].dx =
original->comps[0].dx;
l_new_components[0].dy = l_new_components[1].dy = l_new_components[2].dy =
original->comps[0].y0;
for (compno = 1U; compno < original->numcomps; ++compno) {
- l_new_components[compno + 2U].bpp = original->comps[compno].bpp;
l_new_components[compno + 2U].dx = original->comps[compno].dx;
l_new_components[compno + 2U].dy = original->comps[compno].dy;
l_new_components[compno + 2U].h = original->comps[compno].h;
opj_image_cmptparm_t* l_new_cmp = &(l_new_components[compno]);
opj_image_comp_t* l_org_cmp = &(original->comps[compno]);
- l_new_cmp->bpp = l_org_cmp->bpp;
l_new_cmp->prec = l_org_cmp->prec;
l_new_cmp->sgnd = l_org_cmp->sgnd;
l_new_cmp->x0 = original->x0;
comp->x0 = cmptparms[compno].x0;
comp->y0 = cmptparms[compno].y0;
comp->prec = cmptparms[compno].prec;
- comp->bpp = cmptparms[compno].bpp;
comp->sgnd = cmptparms[compno].sgnd;
if (comp->h != 0 &&
(OPJ_SIZE_T)comp->w > SIZE_MAX / comp->h / sizeof(OPJ_INT32)) {
/* Bitdepth */
for (i = 0; i < image->numcomps; i++) {
- if ((image->comps[i].bpp != 12) | (image->comps[i].sgnd)) {
+ if ((image->comps[i].prec != 12) | (image->comps[i].sgnd)) {
char signed_str[] = "signed";
char unsigned_str[] = "unsigned";
char *tmp_str = image->comps[i].sgnd ? signed_str : unsigned_str;
"Precision of each component shall be 12 bits unsigned"
"-> At least component %d of input image (%d bits, %s) is not compliant\n"
"-> Non-profile-3 codestream will be generated\n",
- i, image->comps[i].bpp, tmp_str);
+ i, image->comps[i].prec, tmp_str);
return OPJ_FALSE;
}
}
/* Bitdepth */
for (i = 0; i < image->numcomps; i++) {
- if (!(image->comps[i].bpp >= 8 && image->comps[i].bpp <= 16) ||
+ if (!(image->comps[i].prec >= 8 && image->comps[i].prec <= 16) ||
(image->comps[i].sgnd)) {
char signed_str[] = "signed";
char unsigned_str[] = "unsigned";
"IMF profiles require precision of each component to b in [8-16] bits unsigned"
"-> At least component %d of input image (%d bits, %s) is not compliant\n"
"-> Non-IMF codestream will be generated\n",
- i, image->comps[i].bpp, tmp_str);
+ i, image->comps[i].prec, tmp_str);
ret = OPJ_FALSE;
}
}
#define OPJ_DEPRECATED(func) func
#endif
+#if defined(__GNUC__) && __GNUC__ >= 6
+#define OPJ_DEPRECATED_STRUCT_MEMBER(memb, msg) __attribute__ ((deprecated(msg))) memb
+#else
+#define OPJ_DEPRECATED_STRUCT_MEMBER(memb, msg) memb
+#endif
+
#if defined(OPJ_STATIC) || !defined(_WIN32)
/* http://gcc.gnu.org/wiki/Visibility */
# if !defined(_WIN32) && __GNUC__ >= 4
OPJ_UINT32 x0;
/** y component offset compared to the whole image */
OPJ_UINT32 y0;
- /** precision */
+ /** precision: number of bits per component per pixel */
OPJ_UINT32 prec;
- /** image depth in bits */
- OPJ_UINT32 bpp;
+ /** obsolete: use prec instead */
+ OPJ_DEPRECATED_STRUCT_MEMBER(OPJ_UINT32 bpp, "Use prec instead");
/** signed (1) / unsigned (0) */
OPJ_UINT32 sgnd;
/** number of decoded resolution */
OPJ_UINT32 x0;
/** y component offset compared to the whole image */
OPJ_UINT32 y0;
- /** precision */
+ /** precision: number of bits per component per pixel */
OPJ_UINT32 prec;
- /** image depth in bits */
- OPJ_UINT32 bpp;
+ /** obsolete: use prec instead */
+ OPJ_DEPRECATED_STRUCT_MEMBER(OPJ_UINT32 bpp, "Use prec instead");
/** signed (1) / unsigned (0) */
OPJ_UINT32 sgnd;
} opj_image_cmptparm_t;
param_image_read[it_file].dy = 0;
param_image_read[it_file].h = image_read->comps->h;
param_image_read[it_file].w = image_read->comps->w;
- param_image_read[it_file].bpp = image_read->comps->bpp;
param_image_read[it_file].prec = image_read->comps->prec;
param_image_read[it_file].sgnd = image_read->comps->sgnd;
param_image_read[it_file].dy = 0;
param_image_read[it_file].h = image_read->comps->h;
param_image_read[it_file].w = image_read->comps->w;
- param_image_read[it_file].bpp = image_read->comps->bpp;
param_image_read[it_file].prec = image_read->comps->prec;
param_image_read[it_file].sgnd = image_read->comps->sgnd;
param_image_write.dy = 0;
param_image_write.h = image->comps[num_comp_select].h;
param_image_write.w = image->comps[num_comp_select].w;
- param_image_write.bpp = image->comps[num_comp_select].bpp;
param_image_write.prec = image->comps[num_comp_select].prec;
param_image_write.sgnd = image->comps[num_comp_select].sgnd;
param_image_diff[it_comp].dy = 0;
param_image_diff[it_comp].sgnd = 0;
param_image_diff[it_comp].prec = 8;
- param_image_diff[it_comp].bpp = 1;
param_image_diff[it_comp].h = imageBase->comps[it_comp].h;
param_image_diff[it_comp].w = imageBase->comps[it_comp].w;
goto cleanup;
}
- if (((imageBase->comps)[it_comp]).bpp != ((imageTest->comps)[it_comp]).bpp &&
- !inParam.ignore_prec) {
- printf("ERROR: bit per pixel mismatch [comp %d] (%d><%d)\n", it_comp,
- ((imageBase->comps)[it_comp]).bpp, ((imageTest->comps)[it_comp]).bpp);
- goto cleanup;
- }
-
if (((imageBase->comps)[it_comp]).h != ((imageTest->comps)[it_comp]).h) {
printf("ERROR: height mismatch [comp %d] (%d><%d)\n", it_comp,
((imageBase->comps)[it_comp]).h, ((imageTest->comps)[it_comp]).h);
double MSE = 0;
unsigned right_shift_input = 0;
unsigned right_shift_output = 0;
- if (((imageBase->comps)[it_comp]).bpp > ((imageTest->comps)[it_comp]).bpp) {
- right_shift_input = ((imageBase->comps)[it_comp]).bpp - ((
- imageTest->comps)[it_comp]).bpp;
+ if (((imageBase->comps)[it_comp]).prec > ((imageTest->comps)[it_comp]).prec) {
+ right_shift_input = ((imageBase->comps)[it_comp]).prec - ((
+ imageTest->comps)[it_comp]).prec;
} else {
- right_shift_output = ((imageTest->comps)[it_comp]).bpp - ((
- imageBase->comps)[it_comp]).bpp;
+ right_shift_output = ((imageTest->comps)[it_comp]).prec - ((
+ imageBase->comps)[it_comp]).prec;
}
for (itpxl = 0;
itpxl < ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h;
parameters.cod_format = J2K_CFMT;
puts(v);
cmptparm.prec = 8;
- cmptparm.bpp = 8;
cmptparm.sgnd = 0;
cmptparm.dx = subsampling_dx;
cmptparm.dy = subsampling_dy;
subsampling_dx = (unsigned int)parameters.subsampling_dx;
subsampling_dy = (unsigned int)parameters.subsampling_dy;
cmptparm.prec = 8;
- cmptparm.bpp = 8;
cmptparm.sgnd = 0;
cmptparm.dx = subsampling_dx;
cmptparm.dy = subsampling_dy;