summaryrefslogtreecommitdiff
path: root/src/bin/jp2
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-10-21 12:43:50 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-10-21 14:13:58 +0200
commit0b5d62684fe360e098e3bccaef02ee3e9781cec4 (patch)
tree0fa0b5ec1b13612115b847bdc3d1da4fba40ae67 /src/bin/jp2
parent3835f37084c762dc7a14b3e995bc005cf584de7c (diff)
API: deprecate 'bpp' member in favor of 'prec'
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
Diffstat (limited to 'src/bin/jp2')
-rw-r--r--src/bin/jp2/convert.c8
-rw-r--r--src/bin/jp2/convertbmp.c9
-rw-r--r--src/bin/jp2/convertpng.c3
-rw-r--r--src/bin/jp2/converttif.c1
-rw-r--r--src/bin/jp2/opj_decompress.c4
5 files changed, 2 insertions, 23 deletions
diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index 7610e245..7205ccf9 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -117,7 +117,6 @@ static void scale_component_up(opj_image_comp_t* component,
}
}
component->prec = precision;
- component->bpp = precision;
}
void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision)
{
@@ -144,7 +143,6 @@ void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision)
l_data[i] >>= shift;
}
}
- component->bpp = precision;
component->prec = precision;
}
@@ -838,7 +836,6 @@ opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters)
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;
@@ -1269,7 +1266,6 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)
}
cmptparm.prec = (OPJ_UINT32)prec;
- cmptparm.bpp = (OPJ_UINT32)prec;
cmptparm.dx = (OPJ_UINT32)parameters->subsampling_dx;
cmptparm.dy = (OPJ_UINT32)parameters->subsampling_dy;
@@ -1327,7 +1323,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)
comp->data[i] = v;
}
fclose(f);
- comp->bpp = (OPJ_UINT32)int_floorlog2(max) + 1;
+ comp->prec = (OPJ_UINT32)int_floorlog2(max) + 1;
return image;
}
@@ -1875,7 +1871,6 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters)
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;
@@ -2366,7 +2361,6 @@ static opj_image_t* rawtoimage_common(const char *filename,
/* 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);
diff --git a/src/bin/jp2/convertbmp.c b/src/bin/jp2/convertbmp.c
index 2fc4e9bc..eb4d420c 100644
--- a/src/bin/jp2/convertbmp.c
+++ b/src/bin/jp2/convertbmp.c
@@ -198,14 +198,10 @@ static void bmpmask32toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride,
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;
}
@@ -260,14 +256,10 @@ static void bmpmask16toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride,
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;
}
@@ -838,7 +830,6 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
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;
diff --git a/src/bin/jp2/convertpng.c b/src/bin/jp2/convertpng.c
index cd074001..b8378d35 100644
--- a/src/bin/jp2/convertpng.c
+++ b/src/bin/jp2/convertpng.c
@@ -193,9 +193,8 @@ static opj_image_t * pngtoimage_internal(opj_cparameters_t * params,
/* 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;
diff --git a/src/bin/jp2/converttif.c b/src/bin/jp2/converttif.c
index efd5a4e7..61b295bd 100644
--- a/src/bin/jp2/converttif.c
+++ b/src/bin/jp2/converttif.c
@@ -1389,7 +1389,6 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
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;
diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c
index 0ef48767..2ce2783a 100644
--- a/src/bin/jp2/opj_decompress.c
+++ b/src/bin/jp2/opj_decompress.c
@@ -1086,8 +1086,6 @@ static opj_image_t* convert_gray_to_rgb(opj_image_t* original)
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 =
@@ -1106,7 +1104,6 @@ static opj_image_t* convert_gray_to_rgb(opj_image_t* original)
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;
@@ -1196,7 +1193,6 @@ static opj_image_t* upsample_image_components(opj_image_t* original)
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;