l_src += 2;
} /* b[i*x]=a[2*i+cas]; */
- l_dest = b + sn * x;
+ l_dest = b + (size_t)sn * (size_t)x;
l_src = a + 1 - cas;
i = dn;
bi += 2;
ai += x;
}
- ai = a + (v->sn * x);
+ ai = a + (v->sn * (size_t)x);
bi = v->mem + 1 - v->cas;
i = v->dn ;
while (i--) {
void opj_idwt53_v_final_memcpy(OPJ_INT32* tiledp_col,
const OPJ_INT32* tmp,
OPJ_INT32 len,
- OPJ_INT32 stride)
+ size_t stride)
{
OPJ_INT32 i;
for (i = 0; i < len; ++i) {
PARALLEL_COLS_53 * sizeof(OPJ_INT32))
would do but would be a tiny bit slower.
We can take here advantage of our knowledge of alignment */
- STOREU(&tiledp_col[i * stride + 0],
+ STOREU(&tiledp_col[(size_t)i * stride + 0],
LOAD(&tmp[PARALLEL_COLS_53 * i + 0]));
- STOREU(&tiledp_col[i * stride + VREG_INT_COUNT],
+ STOREU(&tiledp_col[(size_t)i * stride + VREG_INT_COUNT],
LOAD(&tmp[PARALLEL_COLS_53 * i + VREG_INT_COUNT]));
}
}
const OPJ_INT32 sn,
const OPJ_INT32 len,
OPJ_INT32* tiledp_col,
- const OPJ_INT32 stride)
+ const size_t stride)
{
const OPJ_INT32* in_even = &tiledp_col[0];
- const OPJ_INT32* in_odd = &tiledp_col[sn * stride];
+ const OPJ_INT32* in_odd = &tiledp_col[(size_t)sn * stride];
- OPJ_INT32 i, j;
+ OPJ_INT32 i;
+ size_t j;
VREG d1c_0, d1n_0, s1n_0, s0c_0, s0n_0;
VREG d1c_1, d1n_1, s1n_1, s0c_1, s0n_1;
const VREG two = LOAD_CST(2);
if (len & 1) {
VREG tmp_len_minus_1;
- s1n_0 = LOADU(in_even + ((len - 1) / 2) * stride);
+ s1n_0 = LOADU(in_even + (size_t)((len - 1) / 2) * stride);
/* tmp_len_minus_1 = s1n - ((d1n + 1) >> 1); */
tmp_len_minus_1 = SUB(s1n_0, SAR(ADD3(d1n_0, d1n_0, two), 2));
STORE(tmp + PARALLEL_COLS_53 * (len - 1), tmp_len_minus_1);
STORE(tmp + PARALLEL_COLS_53 * (len - 2),
ADD(d1n_0, SAR(ADD(s0n_0, tmp_len_minus_1), 1)));
- s1n_1 = LOADU(in_even + ((len - 1) / 2) * stride + VREG_INT_COUNT);
+ s1n_1 = LOADU(in_even + (size_t)((len - 1) / 2) * stride + VREG_INT_COUNT);
/* tmp_len_minus_1 = s1n - ((d1n + 1) >> 1); */
tmp_len_minus_1 = SUB(s1n_1, SAR(ADD3(d1n_1, d1n_1, two), 2));
STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT,
const OPJ_INT32 sn,
const OPJ_INT32 len,
OPJ_INT32* tiledp_col,
- const OPJ_INT32 stride)
+ const size_t stride)
{
- OPJ_INT32 i, j;
+ OPJ_INT32 i;
+ size_t j;
VREG s1_0, s2_0, dc_0, dn_0;
VREG s1_1, s2_1, dc_1, dn_1;
const VREG two = LOAD_CST(2);
- const OPJ_INT32* in_even = &tiledp_col[sn * stride];
+ const OPJ_INT32* in_even = &tiledp_col[(size_t)sn * stride];
const OPJ_INT32* in_odd = &tiledp_col[0];
assert(len > 2);
if (!(len & 1)) {
/*dn = in_odd[(len / 2 - 1) * stride] - ((s1 + 1) >> 1); */
- dn_0 = SUB(LOADU(in_odd + (len / 2 - 1) * stride),
+ dn_0 = SUB(LOADU(in_odd + (size_t)(len / 2 - 1) * stride),
SAR(ADD3(s1_0, s1_0, two), 2));
- dn_1 = SUB(LOADU(in_odd + (len / 2 - 1) * stride + VREG_INT_COUNT),
+ dn_1 = SUB(LOADU(in_odd + (size_t)(len / 2 - 1) * stride + VREG_INT_COUNT),
SAR(ADD3(s1_1, s1_1, two), 2));
/* tmp[len - 2] = s1 + ((dn + dc) >> 1); */
const OPJ_INT32 sn,
const OPJ_INT32 len,
OPJ_INT32* tiledp_col,
- const OPJ_INT32 stride)
+ const size_t stride)
{
OPJ_INT32 i, j;
OPJ_INT32 d1c, d1n, s1n, s0c, s0n;
/* accesses and explicit interleaving. */
s1n = tiledp_col[0];
- d1n = tiledp_col[sn * stride];
+ d1n = tiledp_col[(size_t)sn * stride];
s0n = s1n - ((d1n + 1) >> 1);
for (i = 0, j = 0; i < (len - 3); i += 2, j++) {
d1c = d1n;
s0c = s0n;
- s1n = tiledp_col[(j + 1) * stride];
- d1n = tiledp_col[(sn + j + 1) * stride];
+ s1n = tiledp_col[(size_t)(j + 1) * stride];
+ d1n = tiledp_col[(size_t)(sn + j + 1) * stride];
s0n = s1n - ((d1c + d1n + 2) >> 2);
if (len & 1) {
tmp[len - 1] =
- tiledp_col[((len - 1) / 2) * stride] -
+ tiledp_col[(size_t)((len - 1) / 2) * stride] -
((d1n + 1) >> 1);
tmp[len - 2] = d1n + ((s0n + tmp[len - 1]) >> 1);
} else {
}
for (i = 0; i < len; ++i) {
- tiledp_col[i * stride] = tmp[i];
+ tiledp_col[(size_t)i * stride] = tmp[i];
}
}
const OPJ_INT32 sn,
const OPJ_INT32 len,
OPJ_INT32* tiledp_col,
- const OPJ_INT32 stride)
+ const size_t stride)
{
OPJ_INT32 i, j;
OPJ_INT32 s1, s2, dc, dn;
- const OPJ_INT32* in_even = &tiledp_col[sn * stride];
+ const OPJ_INT32* in_even = &tiledp_col[(size_t)sn * stride];
const OPJ_INT32* in_odd = &tiledp_col[0];
assert(len > 2);
tmp[0] = in_even[0] + dc;
for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
- s2 = in_even[(j + 1) * stride];
+ s2 = in_even[(size_t)(j + 1) * stride];
- dn = in_odd[j * stride] - ((s1 + s2 + 2) >> 2);
+ dn = in_odd[(size_t)j * stride] - ((s1 + s2 + 2) >> 2);
tmp[i ] = dc;
tmp[i + 1] = s1 + ((dn + dc) >> 1);
}
tmp[i] = dc;
if (!(len & 1)) {
- dn = in_odd[(len / 2 - 1) * stride] - ((s1 + 1) >> 1);
+ dn = in_odd[(size_t)(len / 2 - 1) * stride] - ((s1 + 1) >> 1);
tmp[len - 2] = s1 + ((dn + dc) >> 1);
tmp[len - 1] = dn;
} else {
}
for (i = 0; i < len; ++i) {
- tiledp_col[i * stride] = tmp[i];
+ tiledp_col[(size_t)i * stride] = tmp[i];
}
}
#endif /* !defined(STANDARD_SLOW_VERSION) */
/* Performs interleave, inverse wavelet transform and copy back to buffer */
static void opj_idwt53_v(const opj_dwt_t *dwt,
OPJ_INT32* tiledp_col,
- OPJ_INT32 stride,
+ size_t stride,
OPJ_INT32 nb_cols)
{
#ifdef STANDARD_SLOW_VERSION
OPJ_INT32* out = dwt->mem;
for (c = 0; c < nb_cols; c++, tiledp_col++) {
OPJ_INT32 i;
- const OPJ_INT32* in_even = &tiledp_col[sn * stride];
+ const OPJ_INT32* in_even = &tiledp_col[(size_t)sn * stride];
const OPJ_INT32* in_odd = &tiledp_col[0];
out[1] = in_odd[0] - ((in_even[0] + 1) >> 1);
out[0] = in_even[0] + out[1];
for (i = 0; i < len; ++i) {
- tiledp_col[i * stride] = out[i];
+ tiledp_col[(size_t)i * stride] = out[i];
}
}
job = (opj_dwd_decode_v_job_t*)user_data;
for (j = job->min_j; j + PARALLEL_COLS_53 <= job->max_j;
j += PARALLEL_COLS_53) {
- opj_idwt53_v(&job->v, &job->tiledp[j], (OPJ_INT32)job->w,
+ opj_idwt53_v(&job->v, &job->tiledp[j], (size_t)job->w,
PARALLEL_COLS_53);
}
if (j < job->max_j)
- opj_idwt53_v(&job->v, &job->tiledp[j], (OPJ_INT32)job->w,
+ opj_idwt53_v(&job->v, &job->tiledp[j], (size_t)job->w,
(OPJ_INT32)(job->max_j - j));
opj_aligned_free(job->v.mem);
if (num_threads <= 1 || rh <= 1) {
for (j = 0; j < rh; ++j) {
- opj_idwt53_h(&h, &tiledp[j * w]);
+ opj_idwt53_h(&h, &tiledp[(size_t)j * w]);
}
} else {
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
if (num_threads <= 1 || rw <= 1) {
for (j = 0; j + PARALLEL_COLS_53 <= rw;
j += PARALLEL_COLS_53) {
- opj_idwt53_v(&v, &tiledp[j], (OPJ_INT32)w, PARALLEL_COLS_53);
+ opj_idwt53_v(&v, &tiledp[j], (size_t)w, PARALLEL_COLS_53);
}
if (j < rw) {
- opj_idwt53_v(&v, &tiledp[j], (OPJ_INT32)w, (OPJ_INT32)(rw - j));
+ opj_idwt53_v(&v, &tiledp[j], (size_t)w, (OPJ_INT32)(rw - j));
}
} else {
OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
OPJ_UINT32 i;
for (i = dwt->win_l_x0; i < dwt->win_l_x1; ++i) {
- memcpy(&bi[i * 2], &a[i * width], (size_t)nb_elts_read * sizeof(OPJ_FLOAT32));
+ memcpy(&bi[i * 2], &a[i * (size_t)width],
+ (size_t)nb_elts_read * sizeof(OPJ_FLOAT32));
}
- a += (OPJ_UINT32)dwt->sn * width;
+ a += (OPJ_UINT32)dwt->sn * (size_t)width;
bi = dwt->wavelet + 1 - dwt->cas;
for (i = dwt->win_h_x0; i < dwt->win_h_x1; ++i) {
- memcpy(&bi[i * 2], &a[i * width], (size_t)nb_elts_read * sizeof(OPJ_FLOAT32));
+ memcpy(&bi[i * 2], &a[i * (size_t)width],
+ (size_t)nb_elts_read * sizeof(OPJ_FLOAT32));
}
}
for (k = 0; k < rw; k++) {
aj[k ] = h.wavelet[k].f[0];
- aj[k + w ] = h.wavelet[k].f[1];
- aj[k + w * 2] = h.wavelet[k].f[2];
- aj[k + w * 3] = h.wavelet[k].f[3];
+ aj[k + (size_t)w ] = h.wavelet[k].f[1];
+ aj[k + (size_t)w * 2] = h.wavelet[k].f[2];
+ aj[k + (size_t)w * 3] = h.wavelet[k].f[3];
}
aj += w * 4;
for (k = 0; k < rw; k++) {
switch (rh - j) {
case 3:
- aj[k + w * 2] = h.wavelet[k].f[2];
+ aj[k + (size_t)w * 2] = h.wavelet[k].f[2];
/* FALLTHRU */
case 2:
- aj[k + w ] = h.wavelet[k].f[1];
+ aj[k + (size_t)w ] = h.wavelet[k].f[1];
/* FALLTHRU */
case 1:
aj[k] = h.wavelet[k].f[0];
opj_v4dwt_decode(&v);
for (k = 0; k < rh; ++k) {
- memcpy(&aj[k * w], &v.wavelet[k], 4 * sizeof(OPJ_FLOAT32));
+ memcpy(&aj[k * (size_t)w], &v.wavelet[k], 4 * sizeof(OPJ_FLOAT32));
}
aj += 4;
}
opj_v4dwt_decode(&v);
for (k = 0; k < rh; ++k) {
- memcpy(&aj[k * w], &v.wavelet[k], (size_t)j * sizeof(OPJ_FLOAT32));
+ memcpy(&aj[k * (size_t)w], &v.wavelet[k], (size_t)j * sizeof(OPJ_FLOAT32));
}
}
}
{
OPJ_UINT32 i, j;
OPJ_UINT32 l_nb_tiles;
- OPJ_UINT32 l_max_tile_size = 0, l_current_tile_size;
+ OPJ_SIZE_T l_max_tile_size = 0, l_current_tile_size;
OPJ_BYTE * l_current_data = 00;
OPJ_BOOL l_reuse_data = OPJ_FALSE;
opj_tcd_t* p_tcd = 00;
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
- OPJ_UINT32 n)
+ OPJ_SIZE_T n)
{
OPJ_SIZE_T i;
const OPJ_SIZE_T len = n;
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
- OPJ_UINT32 n)
+ OPJ_SIZE_T n)
{
OPJ_SIZE_T i;
const OPJ_SIZE_T len = n;
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
- OPJ_UINT32 n)
+ OPJ_SIZE_T n)
{
OPJ_SIZE_T i;
const OPJ_SIZE_T len = n;
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
- OPJ_UINT32 n)
+ OPJ_SIZE_T n)
{
OPJ_UINT32 i;
for (i = 0; i < n; ++i) {
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
- OPJ_UINT32 n)
+ OPJ_SIZE_T n)
{
OPJ_SIZE_T i;
const OPJ_SIZE_T len = n;
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
- OPJ_UINT32 n)
+ OPJ_SIZE_T n)
{
OPJ_UINT32 i;
for (i = 0; i < n; ++i) {
OPJ_FLOAT32* OPJ_RESTRICT c0,
OPJ_FLOAT32* OPJ_RESTRICT c1,
OPJ_FLOAT32* OPJ_RESTRICT c2,
- OPJ_UINT32 n)
+ OPJ_SIZE_T n)
{
OPJ_UINT32 i;
#ifdef __SSE__
OPJ_BOOL opj_mct_encode_custom(
OPJ_BYTE * pCodingdata,
- OPJ_UINT32 n,
+ OPJ_SIZE_T n,
OPJ_BYTE ** pData,
OPJ_UINT32 pNbComp,
OPJ_UINT32 isSigned)
{
OPJ_FLOAT32 * lMct = (OPJ_FLOAT32 *) pCodingdata;
- OPJ_UINT32 i;
+ OPJ_SIZE_T i;
OPJ_UINT32 j;
OPJ_UINT32 k;
OPJ_UINT32 lNbMatCoeff = pNbComp * pNbComp;
OPJ_BOOL opj_mct_decode_custom(
OPJ_BYTE * pDecodingData,
- OPJ_UINT32 n,
+ OPJ_SIZE_T n,
OPJ_BYTE ** pData,
OPJ_UINT32 pNbComp,
OPJ_UINT32 isSigned)
{
OPJ_FLOAT32 * lMct;
- OPJ_UINT32 i;
+ OPJ_SIZE_T i;
OPJ_UINT32 j;
OPJ_UINT32 k;
@param n Number of samples for each component
*/
void opj_mct_encode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1,
- OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
+ OPJ_INT32* OPJ_RESTRICT c2, OPJ_SIZE_T n);
/**
Apply a reversible multi-component inverse transform to an image
@param c0 Samples for luminance component
@param n Number of samples for each component
*/
void opj_mct_decode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1,
- OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
+ OPJ_INT32* OPJ_RESTRICT c2, OPJ_SIZE_T n);
/**
Get norm of the basis function used for the reversible multi-component transform
@param compno Number of the component (0->Y, 1->U, 2->V)
@param n Number of samples for each component
*/
void opj_mct_encode_real(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1,
- OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
+ OPJ_INT32* OPJ_RESTRICT c2, OPJ_SIZE_T n);
/**
Apply an irreversible multi-component inverse transform to an image
@param c0 Samples for luminance component
@param n Number of samples for each component
*/
void opj_mct_decode_real(OPJ_FLOAT32* OPJ_RESTRICT c0,
- OPJ_FLOAT32* OPJ_RESTRICT c1, OPJ_FLOAT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
+ OPJ_FLOAT32* OPJ_RESTRICT c1, OPJ_FLOAT32* OPJ_RESTRICT c2, OPJ_SIZE_T n);
/**
Get norm of the basis function used for the irreversible multi-component transform
@param compno Number of the component (0->Y, 1->U, 2->V)
*/
OPJ_BOOL opj_mct_encode_custom(
OPJ_BYTE * p_coding_data,
- OPJ_UINT32 n,
+ OPJ_SIZE_T n,
OPJ_BYTE ** p_data,
OPJ_UINT32 p_nb_comp,
OPJ_UINT32 is_signed);
*/
OPJ_BOOL opj_mct_decode_custom(
OPJ_BYTE * pDecodingData,
- OPJ_UINT32 n,
+ OPJ_SIZE_T n,
OPJ_BYTE ** pData,
OPJ_UINT32 pNbComp,
OPJ_UINT32 isSigned);
if (src_block == NULL) {
for (j = 0; j < y_incr; j++) {
if (buf_col_stride == 1) {
- memset(buf + (y - y0 + j) * buf_line_stride + (x - x0) * buf_col_stride,
+ memset(buf + (y - y0 + j) * (size_t)buf_line_stride + (x - x0) * buf_col_stride,
0,
sizeof(OPJ_INT32) * x_incr);
} else {
OPJ_UINT32 k;
for (k = 0; k < x_incr; k++) {
- *(buf + (y - y0 + j) * buf_line_stride + (x - x0 + k) * buf_col_stride) = 0;
+ *(buf + (y - y0 + j) * (size_t)buf_line_stride + (x - x0 + k) * buf_col_stride)
+ = 0;
}
}
}
} else {
for (j = 0; j < y_incr; j++) {
if (buf_col_stride == 1) {
- memcpy(buf + (y - y0 + j) * buf_line_stride + (x - x0) * buf_col_stride,
- src_block + (block_y_offset + j) * sa->block_width + block_x_offset,
+ memcpy(buf + (y - y0 + j) * (size_t)buf_line_stride + (x - x0) * buf_col_stride,
+ src_block + (block_y_offset + j) * (size_t)sa->block_width + block_x_offset,
sizeof(OPJ_INT32) * x_incr);
} else {
OPJ_UINT32 k;
for (k = 0; k < x_incr; k++) {
- *(buf + (y - y0 + j) * buf_line_stride + (x - x0 + k) * buf_col_stride) =
- *(src_block + (block_y_offset + j) * sa->block_width + block_x_offset + k);
+ *(buf + (y - y0 + j) * (size_t)buf_line_stride + (x - x0 + k) * buf_col_stride)
+ =
+ *(src_block + (block_y_offset + j) * (size_t)sa->block_width + block_x_offset +
+ k);
}
}
}
for (j = 0; j < y_incr; j++) {
if (buf_col_stride == 1) {
- memcpy(src_block + (block_y_offset + j) * sa->block_width + block_x_offset,
- buf + (y - y0 + j) * buf_line_stride + (x - x0) * buf_col_stride,
+ memcpy(src_block + (block_y_offset + j) * (size_t)sa->block_width +
+ block_x_offset,
+ buf + (y - y0 + j) * (size_t)buf_line_stride + (x - x0) * buf_col_stride,
sizeof(OPJ_INT32) * x_incr);
} else {
OPJ_UINT32 k;
for (k = 0; k < x_incr; k++) {
- *(src_block + (block_y_offset + j) * sa->block_width + block_x_offset + k) =
- *(buf + (y - y0 + j) * buf_line_stride + (x - x0 + k) * buf_col_stride);
+ *(src_block + (block_y_offset + j) * (size_t)sa->block_width + block_x_offset +
+ k) =
+ *(buf + (y - y0 + j) * (size_t)buf_line_stride + (x - x0 + k) * buf_col_stride);
}
}
}
}
}
} else if (tccp->qmfbid == 1) {
- OPJ_INT32* OPJ_RESTRICT tiledp = &tilec->data[(OPJ_UINT32)y * tile_w +
- (OPJ_UINT32)x];
+ OPJ_INT32* OPJ_RESTRICT tiledp = &tilec->data[(size_t)y * tile_w +
+ (size_t)x];
for (j = 0; j < cblk_h; ++j) {
i = 0;
for (; i < (cblk_w & ~(OPJ_UINT32)3U); i += 4U) {
OPJ_INT32 tmp1 = datap[(j * cblk_w) + i + 1U];
OPJ_INT32 tmp2 = datap[(j * cblk_w) + i + 2U];
OPJ_INT32 tmp3 = datap[(j * cblk_w) + i + 3U];
- ((OPJ_INT32*)tiledp)[(j * tile_w) + i + 0U] = tmp0 / 2;
- ((OPJ_INT32*)tiledp)[(j * tile_w) + i + 1U] = tmp1 / 2;
- ((OPJ_INT32*)tiledp)[(j * tile_w) + i + 2U] = tmp2 / 2;
- ((OPJ_INT32*)tiledp)[(j * tile_w) + i + 3U] = tmp3 / 2;
+ ((OPJ_INT32*)tiledp)[(j * (size_t)tile_w) + i + 0U] = tmp0 / 2;
+ ((OPJ_INT32*)tiledp)[(j * (size_t)tile_w) + i + 1U] = tmp1 / 2;
+ ((OPJ_INT32*)tiledp)[(j * (size_t)tile_w) + i + 2U] = tmp2 / 2;
+ ((OPJ_INT32*)tiledp)[(j * (size_t)tile_w) + i + 3U] = tmp3 / 2;
}
for (; i < cblk_w; ++i) {
OPJ_INT32 tmp = datap[(j * cblk_w) + i];
- ((OPJ_INT32*)tiledp)[(j * tile_w) + i] = tmp / 2;
+ ((OPJ_INT32*)tiledp)[(j * (size_t)tile_w) + i] = tmp / 2;
}
}
} else { /* if (tccp->qmfbid == 0) */
- OPJ_FLOAT32* OPJ_RESTRICT tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_UINT32)y *
- tile_w + (OPJ_UINT32)x];
+ OPJ_FLOAT32* OPJ_RESTRICT tiledp = (OPJ_FLOAT32*) &tilec->data[(size_t)y *
+ tile_w + (size_t)x];
for (j = 0; j < cblk_h; ++j) {
OPJ_FLOAT32* OPJ_RESTRICT tiledp2 = tiledp;
for (i = 0; i < cblk_w; ++i) {
OPJ_INT32* OPJ_RESTRICT tiledp;
OPJ_UINT32 cblk_w;
OPJ_UINT32 cblk_h;
- OPJ_UINT32 i, j, tileIndex = 0, tileLineAdvance;
+ OPJ_UINT32 i, j, tileLineAdvance;
+ size_t tileIndex = 0;
OPJ_INT32 x = cblk->x0 - band->x0;
OPJ_INT32 y = cblk->y0 - band->y0;
cblk_h = t1->h;
tileLineAdvance = tile_w - cblk_w;
- tiledp = &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x];
+ tiledp = &tilec->data[(size_t)y * tile_w + (size_t)x];
t1->data = tiledp;
t1->data_stride = tile_w;
if (tccp->qmfbid == 1) {
p_tcd->image->comps[1].resno_decoded;
opj_tcd_resolution_t* res_comp2 = l_tile->comps[2].resolutions +
p_tcd->image->comps[2].resno_decoded;
- OPJ_INT32 l_res_samples = (OPJ_INT32)(res_comp0->x1 - res_comp0->x0) *
- (res_comp0->y1 - res_comp0->y0);
+ size_t l_res_samples = (size_t)(res_comp0->x1 - res_comp0->x0) *
+ (size_t)(res_comp0->y1 - res_comp0->y0);
/* testcase 1336.pdf.asan.47.376 */
if (p_tcd->image->comps[0].resno_decoded !=
p_tcd->image->comps[1].resno_decoded ||
p_tcd->image->comps[0].resno_decoded !=
p_tcd->image->comps[2].resno_decoded ||
- (res_comp1->x1 - res_comp1->x0) * (res_comp1->y1 -
- res_comp1->y0) != l_res_samples ||
- (res_comp2->x1 - res_comp2->x0) * (res_comp2->y1 -
- res_comp2->y0) != l_res_samples) {
+ (size_t)(res_comp1->x1 - res_comp1->x0) *
+ (size_t)(res_comp1->y1 - res_comp1->y0) != l_res_samples ||
+ (size_t)(res_comp2->x1 - res_comp2->x0) *
+ (size_t)(res_comp2->y1 - res_comp2->y0) != l_res_samples) {
opj_event_msg(p_manager, EVT_ERROR,
"Tiles don't all have the same dimension. Skip the MCT step.\n");
return OPJ_FALSE;
}
}
-OPJ_UINT32 opj_tcd_get_encoded_tile_size(opj_tcd_t *p_tcd)
+OPJ_SIZE_T opj_tcd_get_encoded_tile_size(opj_tcd_t *p_tcd)
{
- OPJ_UINT32 i, l_data_size = 0;
+ OPJ_UINT32 i;
+ OPJ_SIZE_T l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_t * l_tilec = 00;
OPJ_UINT32 l_size_comp, l_remaining;
l_size_comp = 4;
}
- l_data_size += l_size_comp * (OPJ_UINT32)((l_tilec->x1 - l_tilec->x0) *
- (l_tilec->y1 - l_tilec->y0));
+ l_data_size += l_size_comp * ((OPJ_SIZE_T)(l_tilec->x1 - l_tilec->x0) *
+ (OPJ_SIZE_T)(l_tilec->y1 - l_tilec->y0));
++l_img_comp;
++l_tilec;
}
opj_tccp_t * l_tccp = 00;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tile_t * l_tile;
- OPJ_UINT32 l_nb_elem, i;
+ size_t l_nb_elem, i;
OPJ_INT32 * l_current_ptr;
l_tile = p_tcd->tcd_image->tiles;
for (compno = 0; compno < l_tile->numcomps; compno++) {
l_current_ptr = l_tile_comp->data;
- l_nb_elem = (OPJ_UINT32)((l_tile_comp->x1 - l_tile_comp->x0) *
- (l_tile_comp->y1 - l_tile_comp->y0));
+ l_nb_elem = (size_t)(l_tile_comp->x1 - l_tile_comp->x0) *
+ (size_t)(l_tile_comp->y1 - l_tile_comp->y0);
if (l_tccp->qmfbid == 1) {
for (i = 0; i < l_nb_elem; ++i) {
{
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_t * l_tile_comp = p_tcd->tcd_image->tiles->comps;
- OPJ_UINT32 samples = (OPJ_UINT32)((l_tile_comp->x1 - l_tile_comp->x0) *
- (l_tile_comp->y1 - l_tile_comp->y0));
+ size_t samples = (size_t)(l_tile_comp->x1 - l_tile_comp->x0) *
+ (size_t)(l_tile_comp->y1 - l_tile_comp->y0);
OPJ_UINT32 i;
OPJ_BYTE ** l_data = 00;
opj_tcp_t * l_tcp = p_tcd->tcp;
OPJ_BOOL opj_tcd_copy_tile_data(opj_tcd_t *p_tcd,
OPJ_BYTE * p_src,
- OPJ_UINT32 p_src_length)
+ OPJ_SIZE_T p_src_length)
{
- OPJ_UINT32 i, j, l_data_size = 0;
+ OPJ_UINT32 i;
+ OPJ_SIZE_T j;
+ OPJ_SIZE_T l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_t * l_tilec = 00;
OPJ_UINT32 l_size_comp, l_remaining;
- OPJ_UINT32 l_nb_elem;
+ OPJ_SIZE_T l_nb_elem;
l_data_size = opj_tcd_get_encoded_tile_size(p_tcd);
if (l_data_size != p_src_length) {
for (i = 0; i < p_tcd->image->numcomps; ++i) {
l_size_comp = l_img_comp->prec >> 3; /*(/ 8)*/
l_remaining = l_img_comp->prec & 7; /* (%8) */
- l_nb_elem = (OPJ_UINT32)((l_tilec->x1 - l_tilec->x0) * (l_tilec->y1 -
- l_tilec->y0));
+ l_nb_elem = (size_t)(l_tilec->x1 - l_tilec->x0) *
+ (size_t)(l_tilec->y1 - l_tilec->y0);
if (l_remaining) {
++l_size_comp;
/**
*
*/
-OPJ_UINT32 opj_tcd_get_encoded_tile_size(opj_tcd_t *p_tcd);
+OPJ_SIZE_T opj_tcd_get_encoded_tile_size(opj_tcd_t *p_tcd);
/**
* Initialize the tile coder and may reuse some meory.
*/
OPJ_BOOL opj_tcd_copy_tile_data(opj_tcd_t *p_tcd,
OPJ_BYTE * p_src,
- OPJ_UINT32 p_src_length);
+ OPJ_SIZE_T p_src_length);
/**
* Allocates tile component data