Home | History | Annotate | Download | only in libopenjpeg20

Lines Matching refs:sa

7  * Copyright (c) 2017, IntoPix SA <contact@intopix.com>
50 opj_sparse_array_int32_t* sa;
59 sa = (opj_sparse_array_int32_t*) opj_calloc(1,
61 sa->width = width;
62 sa->height = height;
63 sa->block_width = block_width;
64 sa->block_height = block_height;
65 sa->block_count_hor = opj_uint_ceildiv(width, block_width);
66 sa->block_count_ver = opj_uint_ceildiv(height, block_height);
67 if (sa->block_count_hor > ((OPJ_UINT32)~0U) / sa->block_count_ver) {
68 opj_free(sa);
71 sa->data_blocks = (OPJ_INT32**) opj_calloc(sizeof(OPJ_INT32*),
72 sa->block_count_hor * sa->block_count_ver);
73 if (sa->data_blocks == NULL) {
74 opj_free(sa);
78 return sa;
81 void opj_sparse_array_int32_free(opj_sparse_array_int32_t* sa)
83 if (sa) {
85 for (i = 0; i < sa->block_count_hor * sa->block_count_ver; i++) {
86 if (sa->data_blocks[i]) {
87 opj_free(sa->data_blocks[i]);
90 opj_free(sa->data_blocks);
91 opj_free(sa);
95 OPJ_BOOL opj_sparse_array_is_region_valid(const opj_sparse_array_int32_t* sa,
101 return !(x0 >= sa->width || x1 <= x0 || x1 > sa->width ||
102 y0 >= sa->height || y1 <= y0 || y1 > sa->height);
106 const opj_sparse_array_int32_t* sa,
119 const OPJ_UINT32 block_width = sa->block_width;
121 if (!opj_sparse_array_is_region_valid(sa, x0, y0, x1, y1)) {
125 block_y = y0 / sa->block_height;
130 y_incr = (y == y0) ? sa->block_height - (y0 % sa->block_height) :
131 sa->block_height;
132 block_y_offset = sa->block_height - y_incr;
142 src_block = sa->data_blocks[block_y * sa->block_count_hor + block_x];
238 sa->block_width * sa->block_height * sizeof(OPJ_INT32));
242 sa->data_blocks[block_y * sa->block_count_hor + block_x] = src_block;
311 OPJ_BOOL opj_sparse_array_int32_read(const opj_sparse_array_int32_t* sa,
322 (opj_sparse_array_int32_t*)sa, x0, y0, x1, y1,
330 OPJ_BOOL opj_sparse_array_int32_write(opj_sparse_array_int32_t* sa,
340 return opj_sparse_array_int32_read_or_write(sa, x0, y0, x1, y1,