#include <sparse_array.h>
|
| | sparse_array (uint32_t width, uint32_t height, uint32_t block_width, uint32_t block_height) |
| | Creates a new sparse array. More...
|
| |
| | ~sparse_array () |
| | Frees a sparse array. More...
|
| |
| bool | read (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, int32_t *dest, const uint32_t dest_col_stride, const uint32_t dest_line_stride, bool forgiving) |
| | Read the content of a rectangular region of the sparse array into a user buffer. More...
|
| |
| bool | read (grk_rect_u32 region, int32_t *dest, const uint32_t dest_col_stride, const uint32_t dest_line_stride, bool forgiving) |
| | Read the content of a rectangular region of the sparse array into a user buffer. More...
|
| |
| bool | write (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, const int32_t *src, const uint32_t src_col_stride, const uint32_t src_line_stride, bool forgiving) |
| | Write the content of a rectangular region into the sparse array from a user buffer. More...
|
| |
| bool | alloc (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1) |
| | Allocate all blocks for a rectangular region into the sparse array from a user buffer. More...
|
| |
|
| bool | is_region_valid (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1) |
| | Returns whether region bounds are valid (non empty and within array bounds) More...
|
| |
| bool | read_or_write (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, int32_t *buf, const uint32_t buf_col_stride, const uint32_t buf_line_stride, bool forgiving, bool is_read_op) |
| |
◆ sparse_array()
| grk::sparse_array::sparse_array |
( |
uint32_t |
width, |
|
|
uint32_t |
height, |
|
|
uint32_t |
block_width, |
|
|
uint32_t |
block_height |
|
) |
| |
Creates a new sparse array.
- Parameters
-
| width | total width of the array. |
| height | total height of the array |
| block_width | width of a block. |
| block_height | height of a block. |
- Returns
- a new sparse array instance, or NULL in case of failure.
◆ ~sparse_array()
| grk::sparse_array::~sparse_array |
( |
| ) |
|
◆ alloc()
| bool grk::sparse_array::alloc |
( |
uint32_t |
x0, |
|
|
uint32_t |
y0, |
|
|
uint32_t |
x1, |
|
|
uint32_t |
y1 |
|
) |
| |
Allocate all blocks for a rectangular region into the sparse array from a user buffer.
Blocks intersecting the region are allocated
- Parameters
-
| x0 | left x coordinate of the region to write into the sparse array. |
| y0 | top x coordinate of the region to write into the sparse array. |
| x1 | right x coordinate (not included) of the region to write into the sparse array. Must be greater than x0. |
| y1 | bottom y coordinate (not included) of the region to write into the sparse array. Must be greater than y0. |
- Returns
- true in case of success.
◆ is_region_valid()
| bool grk::sparse_array::is_region_valid |
( |
uint32_t |
x0, |
|
|
uint32_t |
y0, |
|
|
uint32_t |
x1, |
|
|
uint32_t |
y1 |
|
) |
| |
|
private |
Returns whether region bounds are valid (non empty and within array bounds)
- Parameters
-
| x0 | left x coordinate of the region. |
| y0 | top x coordinate of the region. |
| x1 | right x coordinate (not included) of the region. Must be greater than x0. |
| y1 | bottom y coordinate (not included) of the region. Must be greater than y0. |
- Returns
- true or false.
◆ read() [1/2]
| bool grk::sparse_array::read |
( |
grk_rect_u32 |
region, |
|
|
int32_t * |
dest, |
|
|
const uint32_t |
dest_col_stride, |
|
|
const uint32_t |
dest_line_stride, |
|
|
bool |
forgiving |
|
) |
| |
Read the content of a rectangular region of the sparse array into a user buffer.
Regions not written with write() are read as 0.
- Parameters
-
| region | region to read in the sparse array. |
| dest | user buffer to fill. Must be at least sizeof(int32) * ( (y1 - y0 - 1) * dest_line_stride + (x1 - x0 - 1) * dest_col_stride + 1) bytes large. |
| dest_col_stride | spacing (in elements, not in bytes) in x dimension between consecutive elements of the user buffer. |
| dest_line_stride | spacing (in elements, not in bytes) in y dimension between consecutive elements of the user buffer. |
| forgiving | if set to TRUE and the region is invalid, true will still be returned. |
- Returns
- true in case of success.
◆ read() [2/2]
| bool grk::sparse_array::read |
( |
uint32_t |
x0, |
|
|
uint32_t |
y0, |
|
|
uint32_t |
x1, |
|
|
uint32_t |
y1, |
|
|
int32_t * |
dest, |
|
|
const uint32_t |
dest_col_stride, |
|
|
const uint32_t |
dest_line_stride, |
|
|
bool |
forgiving |
|
) |
| |
Read the content of a rectangular region of the sparse array into a user buffer.
Regions not written with write() are read as 0.
- Parameters
-
| x0 | left x coordinate of the region to read in the sparse array. |
| y0 | top x coordinate of the region to read in the sparse array. |
| x1 | right x coordinate (not included) of the region to read in the sparse array. Must be greater than x0. |
| y1 | bottom y coordinate (not included) of the region to read in the sparse array. Must be greater than y0. |
| dest | user buffer to fill. Must be at least sizeof(int32) * ( (y1 - y0 - 1) * dest_line_stride + (x1 - x0 - 1) * dest_col_stride + 1) bytes large. |
| dest_col_stride | spacing (in elements, not in bytes) in x dimension between consecutive elements of the user buffer. |
| dest_line_stride | spacing (in elements, not in bytes) in y dimension between consecutive elements of the user buffer. |
| forgiving | if set to TRUE and the region is invalid, true will still be returned. |
- Returns
- true in case of success.
◆ read_or_write()
| bool grk::sparse_array::read_or_write |
( |
uint32_t |
x0, |
|
|
uint32_t |
y0, |
|
|
uint32_t |
x1, |
|
|
uint32_t |
y1, |
|
|
int32_t * |
buf, |
|
|
const uint32_t |
buf_col_stride, |
|
|
const uint32_t |
buf_line_stride, |
|
|
bool |
forgiving, |
|
|
bool |
is_read_op |
|
) |
| |
|
private |
◆ write()
| bool grk::sparse_array::write |
( |
uint32_t |
x0, |
|
|
uint32_t |
y0, |
|
|
uint32_t |
x1, |
|
|
uint32_t |
y1, |
|
|
const int32_t * |
src, |
|
|
const uint32_t |
src_col_stride, |
|
|
const uint32_t |
src_line_stride, |
|
|
bool |
forgiving |
|
) |
| |
Write the content of a rectangular region into the sparse array from a user buffer.
Blocks intersecting the region are allocated, if not already done.
- Parameters
-
| x0 | left x coordinate of the region to write into the sparse array. |
| y0 | top x coordinate of the region to write into the sparse array. |
| x1 | right x coordinate (not included) of the region to write into the sparse array. Must be greater than x0. |
| y1 | bottom y coordinate (not included) of the region to write into the sparse array. Must be greater than y0. |
| src | user buffer to fill. Must be at least sizeof(int32) * ( (y1 - y0 - 1) * src_line_stride + (x1 - x0 - 1) * src_col_stride + 1) bytes large. |
| src_col_stride | spacing (in elements, not in bytes) in x dimension between consecutive elements of the user buffer. |
| src_line_stride | spacing (in elements, not in bytes) in y dimension between consecutive elements of the user buffer. |
| forgiving | if set to TRUE and the region is invalid, true will still be returned. |
- Returns
- true in case of success.
◆ block_count_hor
| uint32_t grk::sparse_array::block_count_hor |
|
private |
◆ block_count_ver
| uint32_t grk::sparse_array::block_count_ver |
|
private |
◆ block_height
| uint32_t grk::sparse_array::block_height |
|
private |
◆ block_width
| uint32_t grk::sparse_array::block_width |
|
private |
◆ data_blocks
| int32_t** grk::sparse_array::data_blocks |
|
private |
◆ height
| uint32_t grk::sparse_array::height |
|
private |
◆ width
| uint32_t grk::sparse_array::width |
|
private |
The documentation for this class was generated from the following file: