|
Grok 20.3.2
|
Cached geometric state of a tile component's resolution, relative to its precinct grid. More...
#include <PacketIter.h>
Public Member Functions | |
| ResPrecinctInfo () | |
| bool | init (uint8_t resno, uint8_t decompLevel, Rect32 tileBounds, uint32_t dx, uint32_t dy, bool windowed, Rect32 tileWindow) |
| Initializes resolution precinct info for a specific resolution level. | |
| void | print (void) |
| Prints resolution precinct info for debugging. | |
Public Attributes | |
| uint8_t | precWidthExp |
| log2 precinct width in resolution space (0-15, from codestream SPcoc) | |
| uint8_t | precHeightExp |
| log2 precinct height in resolution space | |
| uint8_t | precWidthExpPRJ |
| log2 precinct width in projected space: precWidthExp + decompLevel | |
| uint8_t | precHeightExpPRJ |
| log2 precinct height in projected space: precHeightExp + decompLevel | |
| uint32_t | resOffsetX0PRJ |
| horizontal offset of resolution origin relative to projected precinct grid (zero when tile origin is (0,0)) | |
| uint32_t | resOffsetY0PRJ |
| vertical offset of resolution origin relative to projected precinct grid | |
| uint64_t | precWidthPRJ |
| precinct width in projected space: compDx << precWidthExpPRJ | |
| uint64_t | precWidthPRJMinusOne |
| precWidthPRJ - 1 (cached for bitwise alignment checks) | |
| uint64_t | precHeightPRJ |
| precinct height in projected space: compDy << precHeightExpPRJ | |
| uint64_t | precHeightPRJMinusOne |
| precHeightPRJ - 1 (cached for bitwise alignment checks) | |
| uint64_t | numPrecincts_ |
| total number of precincts in this resolution (= tileBoundsPrecGrid.area()) | |
| uint64_t | dxPRJ |
| component subsampling projected to resolution: compDx << decompLevel | |
| uint64_t | dyPRJ |
| component subsampling projected to resolution: compDy << decompLevel | |
| uint32_t | resInPrecGridX0 |
| floor(res.x0 / 2^precWidthExp): resolution origin in precinct grid coords | |
| uint32_t | resInPrecGridY0 |
| floor(res.y0 / 2^precHeightExp): resolution origin in precinct grid coords | |
| uint8_t | resno_ |
| resolution number (0 = lowest) | |
| uint8_t | decompLevel_ |
| decomposition level (numresolutions - 1 - resno) | |
| Rect< uint64_t > | tileBoundsPrecPRJ |
| tile bounds snapped to precinct boundaries, in projected space | |
| Rect32 | tileBoundsPrecGrid |
| tile bounds mapped to precinct grid (resolution space) | |
| Rect< uint64_t > | winPrecPRJ |
| decode window bounds snapped to precinct boundaries, in projected space | |
| Rect32 | winPrecGrid |
| decode window bounds mapped to precinct grid (resolution space) | |
| uint64_t | innerPrecincts_ |
| cached packet count: comp_e * lay_e (for RPCL skip optimization) | |
| uint64_t | winPrecinctsLeft_ |
| packets in precinct columns to the left of the decode window | |
| uint64_t | winPrecinctsRight_ |
| packets in precinct columns to the right of the decode window | |
| uint64_t | winPrecinctsTop_ |
| packets in precinct rows above the decode window | |
| uint64_t | winPrecinctsBottom_ |
| packets in precinct rows below the decode window | |
| bool | valid |
| true if init() completed successfully | |
Cached geometric state of a tile component's resolution, relative to its precinct grid.
In JPEG 2000, each resolution level has its own precinct grid. When iterating packets across resolutions (e.g. RPCL, CPRL, PCRL progression orders), lower-resolution precincts must be projected onto the highest-resolution coordinate system so all resolutions share a common iteration grid. Fields suffixed with "PRJ" represent values in this projected (highest-resolution) coordinate space.
init() returns false if projected precinct dimensions exceed UINT32_MAX, since Rect32::scale() operates on uint32_t coordinates. This prevents silent truncation that could produce degenerate tile bounds and infinite iteration loops.
When decoding a spatial sub-region (window), winPrecGrid and winPrecPRJ describe the precinct bounds that intersect the decode window. The winPrecincts{Left,Right,Top,Bottom} fields cache packet counts for precincts outside the window, enabling efficient skipping via PLT markers.
| grk::ResPrecinctInfo::ResPrecinctInfo | ( | ) |
References decompLevel_, dxPRJ, dyPRJ, innerPrecincts_, numPrecincts_, precHeightExp, precHeightExpPRJ, precHeightPRJ, precHeightPRJMinusOne, precWidthExp, precWidthExpPRJ, precWidthPRJ, precWidthPRJMinusOne, resInPrecGridX0, resInPrecGridY0, resno_, resOffsetX0PRJ, resOffsetY0PRJ, valid, winPrecinctsBottom_, winPrecinctsLeft_, winPrecinctsRight_, and winPrecinctsTop_.
| bool grk::ResPrecinctInfo::init | ( | uint8_t | resno, |
| uint8_t | decompLevel, | ||
| Rect32 | tileBounds, | ||
| uint32_t | dx, | ||
| uint32_t | dy, | ||
| bool | windowed, | ||
| Rect32 | tileWindow ) |
Initializes resolution precinct info for a specific resolution level.
Computes precinct grid dimensions, projected coordinates, and windowed decode bounds. Returns false if the resolution has zero extent, or if projected precinct dimensions would overflow uint32_t (preventing Rect32::scale() truncation bugs).
| resno | resolution number (0 = lowest) |
| decompLevel | decomposition level (numresolutions - 1 - resno) |
| tileBounds | tile bounds in image coordinates |
| dx | component horizontal subsampling factor |
| dy | component vertical subsampling factor |
| windowed | true if decoding a sub-region |
| tileWindow | decode window in unreduced tile coordinates (used only if windowed) |
References grk::Rect< T >::clip_IN_PLACE(), decompLevel_, dxPRJ, dyPRJ, grk::floordivpow2(), grk::Rect< T >::grow_IN_PLACE(), numPrecincts_, precHeightExp, precHeightExpPRJ, precHeightPRJ, precHeightPRJMinusOne, precWidthExp, precWidthExpPRJ, precWidthPRJ, precWidthPRJMinusOne, resInPrecGridX0, resInPrecGridY0, resno_, resOffsetX0PRJ, resOffsetY0PRJ, grk::Rect< T >::scaleDownCeil(), tileBoundsPrecGrid, tileBoundsPrecPRJ, valid, winPrecGrid, and winPrecPRJ.
Referenced by grk::PacketIter::genPrecinctInfo(), and grk::PacketIter::validatePrecinct().
| void grk::ResPrecinctInfo::print | ( | void | ) |
Prints resolution precinct info for debugging.
References dxPRJ, dyPRJ, grk::grklog, numPrecincts_, precHeightExp, precHeightPRJ, precWidthExp, precWidthPRJ, resno_, tileBoundsPrecGrid, tileBoundsPrecPRJ, winPrecGrid, and winPrecPRJ.
| uint8_t grk::ResPrecinctInfo::decompLevel_ |
decomposition level (numresolutions - 1 - resno)
Referenced by grk::PacketIter::genPrecinctX0GridPCRL_OPT(), grk::PacketIter::genPrecinctX0GridRPCL_OPT(), grk::PacketIter::genPrecinctY0GridPCRL_OPT(), grk::PacketIter::genPrecinctY0GridRPCL_OPT(), init(), and ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::dxPRJ |
component subsampling projected to resolution: compDx << decompLevel
Referenced by grk::PacketIter::genPrecinctX0Grid(), init(), print(), and ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::dyPRJ |
component subsampling projected to resolution: compDy << decompLevel
Referenced by grk::PacketIter::genPrecinctY0Grid(), init(), print(), and ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::innerPrecincts_ |
cached packet count: comp_e * lay_e (for RPCL skip optimization)
Referenced by ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::numPrecincts_ |
total number of precincts in this resolution (= tileBoundsPrecGrid.area())
Referenced by init(), print(), and ResPrecinctInfo().
| uint8_t grk::ResPrecinctInfo::precHeightExp |
log2 precinct height in resolution space
Referenced by grk::PacketIter::genPrecinctInfo(), grk::PacketIter::genPrecinctY0Grid(), grk::PacketIter::genPrecinctY0GridPCRL_OPT(), grk::PacketIter::genPrecinctY0GridRPCL_OPT(), init(), print(), ResPrecinctInfo(), and grk::PacketIter::validatePrecinct().
| uint8_t grk::ResPrecinctInfo::precHeightExpPRJ |
log2 precinct height in projected space: precHeightExp + decompLevel
Referenced by init(), and ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::precHeightPRJ |
precinct height in projected space: compDy << precHeightExpPRJ
Referenced by grk::PacketIter::genPrecinctY0Grid(), init(), print(), and ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::precHeightPRJMinusOne |
precHeightPRJ - 1 (cached for bitwise alignment checks)
Referenced by grk::PacketIter::genPrecinctY0GridPCRL_OPT(), init(), and ResPrecinctInfo().
| uint8_t grk::ResPrecinctInfo::precWidthExp |
log2 precinct width in resolution space (0-15, from codestream SPcoc)
Referenced by grk::PacketIter::genPrecinctInfo(), grk::PacketIter::genPrecinctX0Grid(), grk::PacketIter::genPrecinctX0GridPCRL_OPT(), grk::PacketIter::genPrecinctX0GridRPCL_OPT(), init(), print(), ResPrecinctInfo(), and grk::PacketIter::validatePrecinct().
| uint8_t grk::ResPrecinctInfo::precWidthExpPRJ |
log2 precinct width in projected space: precWidthExp + decompLevel
Referenced by init(), and ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::precWidthPRJ |
precinct width in projected space: compDx << precWidthExpPRJ
Referenced by grk::PacketIter::genPrecinctX0Grid(), init(), print(), and ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::precWidthPRJMinusOne |
precWidthPRJ - 1 (cached for bitwise alignment checks)
Referenced by grk::PacketIter::genPrecinctX0GridPCRL_OPT(), init(), and ResPrecinctInfo().
| uint32_t grk::ResPrecinctInfo::resInPrecGridX0 |
floor(res.x0 / 2^precWidthExp): resolution origin in precinct grid coords
Referenced by grk::PacketIter::genPrecinctX0Grid(), grk::PacketIter::genPrecinctX0GridPCRL_OPT(), grk::PacketIter::genPrecinctX0GridRPCL_OPT(), init(), and ResPrecinctInfo().
| uint32_t grk::ResPrecinctInfo::resInPrecGridY0 |
floor(res.y0 / 2^precHeightExp): resolution origin in precinct grid coords
Referenced by grk::PacketIter::genPrecinctY0Grid(), grk::PacketIter::genPrecinctY0GridPCRL_OPT(), grk::PacketIter::genPrecinctY0GridRPCL_OPT(), init(), and ResPrecinctInfo().
| uint8_t grk::ResPrecinctInfo::resno_ |
resolution number (0 = lowest)
Referenced by init(), print(), and ResPrecinctInfo().
| uint32_t grk::ResPrecinctInfo::resOffsetX0PRJ |
horizontal offset of resolution origin relative to projected precinct grid (zero when tile origin is (0,0))
Referenced by grk::PacketIter::genPrecinctX0Grid(), init(), and ResPrecinctInfo().
| uint32_t grk::ResPrecinctInfo::resOffsetY0PRJ |
vertical offset of resolution origin relative to projected precinct grid
Referenced by grk::PacketIter::genPrecinctY0Grid(), init(), and ResPrecinctInfo().
| Rect32 grk::ResPrecinctInfo::tileBoundsPrecGrid |
| Rect<uint64_t> grk::ResPrecinctInfo::tileBoundsPrecPRJ |
| bool grk::ResPrecinctInfo::valid |
true if init() completed successfully
Referenced by init(), grk::PacketIter::precInfoCheck(), and ResPrecinctInfo().
| Rect32 grk::ResPrecinctInfo::winPrecGrid |
| uint64_t grk::ResPrecinctInfo::winPrecinctsBottom_ |
packets in precinct rows below the decode window
Referenced by ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::winPrecinctsLeft_ |
packets in precinct columns to the left of the decode window
Referenced by ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::winPrecinctsRight_ |
packets in precinct columns to the right of the decode window
Referenced by ResPrecinctInfo().
| uint64_t grk::ResPrecinctInfo::winPrecinctsTop_ |
packets in precinct rows above the decode window
Referenced by ResPrecinctInfo().
| Rect<uint64_t> grk::ResPrecinctInfo::winPrecPRJ |