Grok  7.6.3
WaveletReverse.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2021 Grok Image Compression Inc.
3  *
4  * This source code is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License, version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This source code is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Affero General Public License for more details.
12  *
13  * You should have received a copy of the GNU Affero General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  * This source code incorporates work covered by the BSD 2-clause license.
18  * Please see the LICENSE file in the root directory for details.
19  *
20  */
21 
22 #pragma once
23 
24 #include <cstdint>
25 
26 namespace grk {
27 
28 
29 struct vec4f {
30  vec4f() : f{0}
31  {}
32  explicit vec4f(float m)
33  {
34  f[0]=m;
35  f[1]=m;
36  f[2]=m;
37  f[3]=m;
38 
39  }
40  float f[4];
41 };
42 
43 uint32_t max_resolution(Resolution *GRK_RESTRICT r, uint32_t i);
44 
45 template<class T> constexpr T getFilterWidth(bool lossless) {
46  return lossless ? 2 : 4;
47  }
48 
49 template<class T> constexpr T getHorizontalPassHeight(bool lossless){
50  return T(lossless ? (sizeof(int32_t)/sizeof(int32_t)) : (sizeof(vec4f) / sizeof(float)));
51 }
52 
54 
55 public:
56  bool decompress(TileProcessor *p_tcd,
57  TileComponent* tilec,
58  grk_rect_u32 window,
59  uint32_t numres,
60  uint8_t qmfbid);
61 
62 };
63 
64 }
grk::BAND_INDEX_LH
@ BAND_INDEX_LH
Definition: T1Structs.h:53
PLL_COLS_53
#define PLL_COLS_53
Number of columns that we can process in parallel in the vertical pass.
Definition: WaveletReverse.cpp:107
grk::TileComponent::resolutions
Resolution * resolutions
Definition: TileComponent.h:57
grk::decompress_job::strideHH
uint32_t strideHH
Definition: WaveletReverse.cpp:97
SS_
#define SS_(i)
grk::decompress_h_mt_53
static bool decompress_h_mt_53(uint32_t num_threads, size_t data_size, dwt_data< int32_t > &horiz, dwt_data< int32_t > &vert, uint32_t rh, int32_t *bandL, const uint32_t strideL, int32_t *bandH, const uint32_t strideH, int32_t *dest, const uint32_t strideDest)
Definition: WaveletReverse.cpp:685
grk::grk_aligned_free
void grk_aligned_free(void *ptr)
Definition: MemManager.cpp:123
CPUArch.h
grk::getFilterWidth
constexpr T getFilterWidth(bool lossless)
Definition: WaveletReverse.h:45
grk::SPLIT_NUM_ORIENTATIONS
@ SPLIT_NUM_ORIENTATIONS
Definition: T1Structs.h:32
grk::vec4f::vec4f
vec4f(float m)
Definition: WaveletReverse.h:32
grk::grk_rectangle< uint32_t >
grk::vec4f
Definition: WaveletReverse.h:29
grk::grk_rectangle::height
T height() const
Definition: util.h:172
grk::decompress_step_97
static void decompress_step_97(dwt_data< vec4f > *GRK_RESTRICT dwt)
Definition: WaveletReverse.cpp:1059
grk::WaveletReverse::decompress
bool decompress(TileProcessor *p_tcd, TileComponent *tilec, grk_rect_u32 window, uint32_t numres, uint8_t qmfbid)
Definition: WaveletReverse.cpp:2117
grk::decompress_job::min_j
uint32_t min_j
Definition: WaveletReverse.cpp:101
grk::ISparseBuffer
Definition: SparseBuffer.h:72
grk::dwt_data::alloc
bool alloc(size_t len)
Definition: WaveletReverse.cpp:135
grk::BAND_NUM_ORIENTATIONS
@ BAND_NUM_ORIENTATIONS
Definition: T1Structs.h:41
grk::TileProcessor
Tile compressor/decompressor.
Definition: TileProcessor.h:63
ThreadPool::get
static ThreadPool * get()
Definition: ThreadPool.hpp:51
grk::decompress_v_cas1_53
static void decompress_v_cas1_53(int32_t *buf, int32_t *bandL, const uint32_t hL, const uint32_t strideL, int32_t *bandH, const uint32_t hH, const uint32_t strideH, int32_t *dest, const uint32_t strideDest)
Vertical inverse 5x3 wavelet transform for one column, when top-most pixel is on odd coordinate.
Definition: WaveletReverse.cpp:525
grk::grk_rectangle::pan
grk_rectangle< T > pan(int64_t x, int64_t y) const
Definition: util.h:176
grk::CPUArch::SSE2
static bool SSE2()
Definition: CPUArch.cpp:363
grk::Partial53::decompress_h
void decompress_h(dwt_data< T > *horiz)
Definition: WaveletReverse.cpp:1537
grk::c13318
static const float c13318
Definition: WaveletReverse.cpp:198
grk::decompress_tile_97
static bool decompress_tile_97(TileComponent *GRK_RESTRICT tilec, uint32_t numres)
Definition: WaveletReverse.cpp:1354
grk::K
static const float K
Definition: WaveletReverse.cpp:197
grk::grk_rectangle::x1
T x1
Definition: util.h:77
grk::decompress_job::strideHL
uint32_t strideHL
Definition: WaveletReverse.cpp:93
grk::decompress_h_strip_97
static void decompress_h_strip_97(dwt_data< vec4f > *GRK_RESTRICT horiz, const uint32_t rh, float *GRK_RESTRICT bandL, const uint32_t strideL, float *GRK_RESTRICT bandH, const uint32_t strideH, float *dest, const size_t strideDest)
Definition: WaveletReverse.cpp:1126
SS_off_
#define SS_off_(i, off)
grk::decompress_job::dest
T *GRK_RESTRICT dest
Definition: WaveletReverse.cpp:98
S_off
#define S_off(i, off)
grk::Params97::absoluteStart
uint32_t absoluteStart
Definition: WaveletReverse.cpp:185
grk::TileComponent::getBuffer
TileComponentWindowBuffer< int32_t > * getBuffer() const
Definition: TileComponent.cpp:321
grk::WaveletReverse
Definition: WaveletReverse.h:53
grk::decompress_step1_97
static void decompress_step1_97(const Params97 &d, const float c)
Definition: WaveletReverse.cpp:950
grk::BAND_ORIENT_HL
@ BAND_ORIENT_HL
Definition: T1Structs.h:38
grk::dwt_delta
static const float dwt_delta
Definition: WaveletReverse.cpp:195
S
#define S(i)
grk::decompress_v_strip_53
static void decompress_v_strip_53(const dwt_data< int32_t > *vert, uint32_t wMin, uint32_t wMax, int32_t *bandL, const uint32_t strideL, int32_t *bandH, const uint32_t strideH, int32_t *dest, const uint32_t strideDest)
Definition: WaveletReverse.cpp:752
grk::CPUArch::AVX2
static bool AVX2()
Definition: CPUArch.cpp:351
DD_
#define DD_(i)
grk::dwt_data::memHigh
T * memHigh
Definition: WaveletReverse.cpp:166
grk::dwt_beta
static const float dwt_beta
Definition: WaveletReverse.cpp:193
grk::dwt_data::sn
uint32_t sn
Definition: WaveletReverse.cpp:168
grk::decompress_v_mt_97
static bool decompress_v_mt_97(uint32_t num_threads, size_t data_size, dwt_data< vec4f > &GRK_RESTRICT vert, const uint32_t rw, const uint32_t rh, float *GRK_RESTRICT bandL, const uint32_t strideL, float *GRK_RESTRICT bandH, const uint32_t strideH, float *GRK_RESTRICT dest, const uint32_t strideDest)
Definition: WaveletReverse.cpp:1279
grk::decompress_job::bandLH
T *GRK_RESTRICT bandLH
Definition: WaveletReverse.cpp:94
grk::dwt_data::dwt_data
dwt_data(const dwt_data &rhs)
Definition: WaveletReverse.cpp:122
DD_sgnd_off_
#define DD_sgnd_off_(i, off)
grk::BAND_ORIENT_LH
@ BAND_ORIENT_LH
Definition: T1Structs.h:39
grk::decompress_job::bandHH
T *GRK_RESTRICT bandHH
Definition: WaveletReverse.cpp:96
grk::dwt_data::win_l_0
uint32_t win_l_0
Definition: WaveletReverse.cpp:170
DD_off_
#define DD_off_(i, off)
D_off
#define D_off(i, off)
D_
#define D_(i)
grk::Partial53
Definition: WaveletReverse.cpp:1535
grk::dwt_gamma
static const float dwt_gamma
Definition: WaveletReverse.cpp:194
grk::grk_aligned_malloc
void * grk_aligned_malloc(size_t size)
Allocate memory aligned to a 16 byte boundary.
Definition: MemManager.cpp:119
grk::decompress_partial_tile
bool decompress_partial_tile(TileComponent *GRK_RESTRICT tilec, grk_rect_u32 bounds, uint32_t numres, ISparseBuffer *sa)
Definition: WaveletReverse.cpp:1855
grk::interleave_v_97
static void interleave_v_97(dwt_data< vec4f > *GRK_RESTRICT dwt, float *GRK_RESTRICT bandL, const uint32_t strideL, float *GRK_RESTRICT bandH, const uint32_t strideH, uint32_t nb_elts_read)
Definition: WaveletReverse.cpp:1225
ThreadPool::num_threads
size_t num_threads()
Definition: ThreadPool.hpp:49
grk::decompress_v_cas0_53
static void decompress_v_cas0_53(int32_t *buf, int32_t *bandL, const uint32_t hL, const uint32_t strideL, int32_t *bandH, const uint32_t hH, const uint32_t strideH, int32_t *dest, const uint32_t strideDest)
Vertical inverse 5x3 wavelet transform for one column, when top-most pixel is on even coordinate.
Definition: WaveletReverse.cpp:473
grk::Params97::len
uint32_t len
Definition: WaveletReverse.cpp:186
grk::Params97
Definition: WaveletReverse.cpp:176
D
#define D(i)
grk::decompress_h_cas1_53
static void decompress_h_cas1_53(int32_t *buf, int32_t *bandL, const uint32_t wL, int32_t *bandH, const uint32_t wH, int32_t *dest)
Definition: WaveletReverse.cpp:241
D_off_
#define D_off_(i, off)
grk::decompress_v_strip_97
static void decompress_v_strip_97(dwt_data< vec4f > *GRK_RESTRICT vert, const uint32_t rw, const uint32_t rh, float *GRK_RESTRICT bandL, const uint32_t strideL, float *GRK_RESTRICT bandH, const uint32_t strideH, float *GRK_RESTRICT dest, const uint32_t strideDest)
Definition: WaveletReverse.cpp:1245
grk::decompress_h_cas0_53
static void decompress_h_cas0_53(int32_t *buf, int32_t *bandL, const uint32_t wL, int32_t *bandH, const uint32_t wH, int32_t *dest)
Definition: WaveletReverse.cpp:200
grk::Partial97
Definition: WaveletReverse.cpp:1767
grk::grk_rectangle::width
T width() const
Definition: util.h:169
grk::decompress_job::data
S data
Definition: WaveletReverse.cpp:89
grk::Partial53::decompress_v
void decompress_v(dwt_data< T > *vert)
Definition: WaveletReverse.cpp:1622
grk::TileComponentWindowBuffer::getWindow
const grk_buffer_2d< T > * getWindow(uint8_t resno, eBandOrientation orientation) const
Get non-LL band window.
Definition: TileComponentWindowBuffer.h:385
grk::dwt_data
Definition: WaveletReverse.cpp:108
grk::decompress_v_53
static void decompress_v_53(const dwt_data< int32_t > *dwt, int32_t *bandL, const uint32_t strideL, int32_t *bandH, const uint32_t strideH, int32_t *dest, const uint32_t strideDest, uint32_t nb_cols)
Definition: WaveletReverse.cpp:607
grk::dwt_data::dwt_data
dwt_data()
Definition: WaveletReverse.cpp:109
grk::PartialInterleaver::interleave_h
void interleave_h(dwt_data< T > *dwt, ISparseBuffer *sa, uint32_t y_offset, uint32_t y_num_rows)
interleaved data is laid out in the dwt->mem buffer in increments of type T
Definition: WaveletReverse.cpp:1470
grk::SPLIT_L
@ SPLIT_L
Definition: T1Structs.h:30
grk::dwt_data::allocatedMem
T * allocatedMem
Definition: WaveletReverse.cpp:163
grk::dwt_data::release
void release()
Definition: WaveletReverse.cpp:156
grk::interleave_h_97
static void interleave_h_97(dwt_data< vec4f > *GRK_RESTRICT dwt, float *GRK_RESTRICT bandL, const uint32_t strideL, float *GRK_RESTRICT bandH, const uint32_t strideH, uint32_t remaining_height)
Definition: WaveletReverse.cpp:1074
grk::Params97::data
vec4f * data
Definition: WaveletReverse.cpp:184
grk::makeParams97
static Params97 makeParams97(dwt_data< vec4f > *dwt, bool low, bool step1)
Definition: WaveletReverse.cpp:1778
grk::getHorizontalPassHeight
constexpr T getHorizontalPassHeight(bool lossless)
Definition: WaveletReverse.h:49
S_off_
#define S_off_(i, off)
grk::ISparseBuffer::write
virtual 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)=0
Write the content of a rectangular window into the sparse array from a user buffer.
grk::dwt_data::win_h_1
uint32_t win_h_1
Definition: WaveletReverse.cpp:173
grk::ISparseBuffer::alloc
virtual bool alloc(grk_rect_u32 window)=0
Allocate all blocks for a rectangular window into the sparse array from a user buffer.
grk::dwt_data::mem
T * mem
Definition: WaveletReverse.cpp:164
S_
#define S_(i)
D_sgnd_off_
#define D_sgnd_off_(i, off)
grk
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::decompress_job::decompress_job
decompress_job(S data, uint32_t min_j, uint32_t max_j)
Definition: WaveletReverse.cpp:72
grk::TileComponent
Definition: TileComponent.h:31
grk::BAND_ORIENT_HH
@ BAND_ORIENT_HH
Definition: T1Structs.h:40
grk::decompress_job::strideLL
uint32_t strideLL
Definition: WaveletReverse.cpp:91
grk::decompress_h_53
static void decompress_h_53(const dwt_data< int32_t > *dwt, int32_t *bandL, int32_t *bandH, int32_t *dest)
Definition: WaveletReverse.cpp:576
grk_includes.h
grk::Params97::dataPrev
vec4f * dataPrev
Definition: WaveletReverse.cpp:183
grk::Params97::lenMax
uint32_t lenMax
Definition: WaveletReverse.cpp:187
grk::decompress_job::strideDest
uint32_t strideDest
Definition: WaveletReverse.cpp:99
grk::dwt_data::win_h_0
uint32_t win_h_0
Definition: WaveletReverse.cpp:172
grk::decompress_job
Definition: WaveletReverse.cpp:45
grk::PartialInterleaver::interleave_v
void interleave_v(dwt_data< T > *GRK_RESTRICT dwt, ISparseBuffer *sa, uint32_t x_offset, uint32_t x_num_elements)
Definition: WaveletReverse.cpp:1504
grk::decompress_v_mt_53
static bool decompress_v_mt_53(uint32_t num_threads, size_t data_size, dwt_data< int32_t > &horiz, dwt_data< int32_t > &vert, uint32_t rw, int32_t *bandL, const uint32_t strideL, int32_t *bandH, const uint32_t strideH, int32_t *dest, const uint32_t strideDest)
Definition: WaveletReverse.cpp:774
grk::Partial97::decompress_h
void decompress_h(dwt_data< T > *dwt)
Definition: WaveletReverse.cpp:1769
grk::dwt_data::dn
uint32_t dn
Definition: WaveletReverse.cpp:167
grk::decompress_tile_53
static bool decompress_tile_53(TileComponent *tilec, uint32_t numres)
Definition: WaveletReverse.cpp:847
grk::vec4f::f
float f[4]
Definition: WaveletReverse.h:40
grk::decompress_job::bandHL
T *GRK_RESTRICT bandHL
Definition: WaveletReverse.cpp:92
grk::dwt_data::alloc
bool alloc(size_t len, size_t padding)
Definition: WaveletReverse.cpp:139
VREG_INT_COUNT
#define VREG_INT_COUNT
Number of int32 values in an SSE2 register.
Definition: simd.h:44
grk::ISparseBuffer::read
virtual 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)=0
Read the content of a rectangular window of the sparse array into a user buffer.
grk::Resolution
Definition: T1Structs.h:231
grk::decompress_h_strip_53
static void decompress_h_strip_53(const dwt_data< int32_t > *horiz, uint32_t hMin, uint32_t hMax, int32_t *bandL, const uint32_t strideL, int32_t *bandH, const uint32_t strideH, int32_t *dest, const uint32_t strideDest)
Definition: WaveletReverse.cpp:668
grk::grk_rectangle::rectceildivpow2
grk_rectangle< T > rectceildivpow2(uint32_t power) const
Definition: util.h:126
grk::Params97::Params97
Params97()
Definition: WaveletReverse.cpp:177
GRK_RESTRICT
#define GRK_RESTRICT
Definition: grk_includes.h:101
GRK_UNUSED
#define GRK_UNUSED(x)
Definition: grk_includes.h:150
grk::BAND_INDEX_HL
@ BAND_INDEX_HL
Definition: T1Structs.h:54
grk::decompress_job::strideLH
uint32_t strideLH
Definition: WaveletReverse.cpp:95
grk::grk_rectangle::x0
T x0
Definition: util.h:77
grk::grk_rectangle::y1
T y1
Definition: util.h:77
grk::max_resolution
uint32_t max_resolution(Resolution *GRK_RESTRICT r, uint32_t i)
Definition: WaveletReverse.cpp:32
grk::dwt_data::win_l_1
uint32_t win_l_1
Definition: WaveletReverse.cpp:171
grk::vec4f::vec4f
vec4f()
Definition: WaveletReverse.h:30
grk::decompress_job::bandLL
T *GRK_RESTRICT bandLL
Definition: WaveletReverse.cpp:90
grk::dwt_data::memLow
T * memLow
Definition: WaveletReverse.cpp:165
grk::PartialInterleaver
Definition: WaveletReverse.cpp:1464
grk::TileComponentWindowBuffer::getSplitWindow
const grk_buffer_2d< T > * getSplitWindow(uint8_t resno, eSplitOrientation orientation) const
Definition: TileComponentWindowBuffer.h:400
grk::TileProcessor::wholeTileDecompress
bool wholeTileDecompress
Definition: TileProcessor.h:152
grk::decompress_job::max_j
uint32_t max_j
Definition: WaveletReverse.cpp:102
grk::Partial97::decompress_v
void decompress_v(dwt_data< T > *dwt)
Definition: WaveletReverse.cpp:1772
grk::MissingSparseBlockException
Definition: grk_exceptions.h:36
grk::SPLIT_H
@ SPLIT_H
Definition: T1Structs.h:31
grk::grk_rectangle::y0
T y0
Definition: util.h:77
grk::decompress_h_mt_97
static bool decompress_h_mt_97(uint32_t num_threads, size_t data_size, dwt_data< vec4f > &GRK_RESTRICT horiz, const uint32_t rh, float *GRK_RESTRICT bandL, const uint32_t strideL, float *GRK_RESTRICT bandH, const uint32_t strideH, float *GRK_RESTRICT dest, const uint32_t strideDest)
Definition: WaveletReverse.cpp:1165
grk::decompress_job::decompress_job
decompress_job(S data, T *GRK_RESTRICT LL, uint32_t sLL, T *GRK_RESTRICT HL, uint32_t sHL, T *GRK_RESTRICT LH, uint32_t sLH, T *GRK_RESTRICT HH, uint32_t sHH, T *GRK_RESTRICT destination, uint32_t strideDestination, uint32_t min_j, uint32_t max_j)
Definition: WaveletReverse.cpp:46
grk::decompress_step2_97
static void decompress_step2_97(const Params97 &d, float c)
Definition: WaveletReverse.cpp:1016
SIZE_MAX
#define SIZE_MAX
Definition: MemManager.cpp:33
grk::GRK_ERROR
void GRK_ERROR(const char *fmt,...)
Definition: logger.cpp:57
grk::BAND_ORIENT_LL
@ BAND_ORIENT_LL
Definition: T1Structs.h:37
grk::dwt_alpha
static const float dwt_alpha
Definition: WaveletReverse.cpp:192
grk::dwt_data::cas
uint32_t cas
Definition: WaveletReverse.cpp:169