#include <SparseBuffer.h>
|
| SparseBuffer (grk_rect_u32 bds) |
| Creates a new sparse buffer. More...
|
|
| SparseBuffer (uint32_t width, uint32_t height) |
| Creates a new sparse buffer. More...
|
|
| ~SparseBuffer () |
| Frees a sparse buffer. 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 window of the sparse buffer into a user buffer. More...
|
|
bool | read (grk_rect_u32 window, int32_t *dest, const uint32_t dest_col_stride, const uint32_t dest_line_stride, bool forgiving) |
| Read the content of a rectangular window of the sparse buffer 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 window into the sparse buffer from a user buffer. More...
|
|
bool | alloc (grk_rect_u32 window) |
| Allocate all blocks for a rectangular window into the sparse buffer from a user buffer. More...
|
|
virtual | ~ISparseBuffer () |
|
|
bool | alloc (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1) |
|
SparseBlock * | getBlock (uint32_t block_x, uint32_t block_y) |
|
bool | is_window_valid (uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1) |
| Returns whether window 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) |
|
◆ SparseBuffer() [1/2]
template<uint32_t LBW, uint32_t LBH>
Creates a new sparse buffer.
- Parameters
-
- Returns
- a new sparse buffer instance, or NULL in case of failure.
References grk::grk_rectangle< T >::area(), grk::SparseBuffer< LBW, LBH >::bounds, grk::SparseBuffer< LBW, LBH >::data_blocks, grk::SparseBuffer< LBW, LBH >::grid_bounds, grk::grk_rectangle< T >::height(), grk::uint_floordivpow2(), grk::grk_rectangle< T >::width(), grk::grk_rectangle< T >::x0, and grk::grk_rectangle< T >::y0.
◆ SparseBuffer() [2/2]
template<uint32_t LBW, uint32_t LBH>
Creates a new sparse buffer.
- Parameters
-
width | total width of the array. |
height | total height of the array |
- Returns
- a new sparse buffer instance, or NULL in case of failure.
◆ ~SparseBuffer()
template<uint32_t LBW, uint32_t LBH>
◆ alloc() [1/2]
template<uint32_t LBW, uint32_t LBH>
◆ alloc() [2/2]
template<uint32_t LBW, uint32_t LBH>
bool grk::SparseBuffer< LBW, LBH >::alloc |
( |
uint32_t |
x0, |
|
|
uint32_t |
y0, |
|
|
uint32_t |
x1, |
|
|
uint32_t |
y1 |
|
) |
| |
|
inlineprivate |
References grk::SparseBuffer< LBW, LBH >::block_height, grk::SparseBuffer< LBW, LBH >::block_width, grk::grk_rectangle< T >::contains(), grk::SparseBuffer< LBW, LBH >::data_blocks, grk::SparseBuffer< LBW, LBH >::getBlock(), grk::SparseBuffer< LBW, LBH >::grid_bounds, grk::GRK_ERROR(), grk::SparseBuffer< LBW, LBH >::is_window_valid(), grk::grk_rectangle< T >::width(), grk::grk_rectangle< T >::x0, and grk::grk_rectangle< T >::y0.
◆ getBlock()
template<uint32_t LBW, uint32_t LBH>
◆ is_window_valid()
template<uint32_t LBW, uint32_t LBH>
bool grk::SparseBuffer< LBW, LBH >::is_window_valid |
( |
uint32_t |
x0, |
|
|
uint32_t |
y0, |
|
|
uint32_t |
x1, |
|
|
uint32_t |
y1 |
|
) |
| |
|
inlineprivate |
◆ read() [1/2]
template<uint32_t LBW, uint32_t LBH>
bool grk::SparseBuffer< LBW, LBH >::read |
( |
grk_rect_u32 |
window, |
|
|
int32_t * |
dest, |
|
|
const uint32_t |
dest_col_stride, |
|
|
const uint32_t |
dest_line_stride, |
|
|
bool |
forgiving |
|
) |
| |
|
inlinevirtual |
Read the content of a rectangular window of the sparse buffer into a user buffer.
Windows not written with write() are read as 0.
- Parameters
-
window | window to read in the sparse buffer. |
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 window is invalid, true will still be returned. |
- Returns
- true in case of success.
Implements grk::ISparseBuffer.
References grk::SparseBuffer< LBW, LBH >::read(), grk::grk_rectangle< T >::x0, grk::grk_rectangle< T >::x1, grk::grk_rectangle< T >::y0, and grk::grk_rectangle< T >::y1.
◆ read() [2/2]
template<uint32_t LBW, uint32_t LBH>
bool grk::SparseBuffer< LBW, LBH >::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 |
|
) |
| |
|
inlinevirtual |
Read the content of a rectangular window of the sparse buffer into a user buffer.
Windows not written with write() are read as 0.
- Parameters
-
x0 | left x coordinate of the window to read in the sparse buffer. |
y0 | top x coordinate of the window to read in the sparse buffer. |
x1 | right x coordinate (not included) of the window to read in the sparse buffer. Must be greater than x0. |
y1 | bottom y coordinate (not included) of the window to read in the sparse buffer. 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 window is invalid, true will still be returned. |
- Returns
- true in case of success.
Implements grk::ISparseBuffer.
References grk::SparseBuffer< LBW, LBH >::read_or_write().
Referenced by grk::SparseBuffer< LBW, LBH >::read().
◆ read_or_write()
template<uint32_t LBW, uint32_t LBH>
bool grk::SparseBuffer< LBW, LBH >::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 |
|
) |
| |
|
inlineprivate |
References grk::SparseBuffer< LBW, LBH >::block_height, grk::SparseBuffer< LBW, LBH >::block_width, grk::grk_rectangle< T >::contains(), grk::SparseBuffer< LBW, LBH >::getBlock(), grk::SparseBuffer< LBW, LBH >::grid_bounds, grk::GRK_ERROR(), GRK_RESTRICT, grk::GRK_WARN(), and grk::SparseBuffer< LBW, LBH >::is_window_valid().
Referenced by grk::SparseBuffer< LBW, LBH >::read(), and grk::SparseBuffer< LBW, LBH >::write().
◆ write()
template<uint32_t LBW, uint32_t LBH>
bool grk::SparseBuffer< LBW, LBH >::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 |
|
) |
| |
|
inlinevirtual |
Write the content of a rectangular window into the sparse buffer from a user buffer.
Blocks intersecting the window are allocated, if not already done.
- Parameters
-
x0 | left x coordinate of the window to write into the sparse buffer. |
y0 | top x coordinate of the window to write into the sparse buffer. |
x1 | right x coordinate (not included) of the window to write into the sparse buffer. Must be greater than x0. |
y1 | bottom y coordinate (not included) of the window to write into the sparse buffer. 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 window is invalid, true will still be returned. |
- Returns
- true in case of success.
Implements grk::ISparseBuffer.
References grk::SparseBuffer< LBW, LBH >::read_or_write().
◆ block_height
template<uint32_t LBW, uint32_t LBH>
◆ block_width
template<uint32_t LBW, uint32_t LBH>
◆ bounds
template<uint32_t LBW, uint32_t LBH>
◆ data_blocks
template<uint32_t LBW, uint32_t LBH>
◆ grid_bounds
template<uint32_t LBW, uint32_t LBH>
The documentation for this class was generated from the following file: