Grok 10.0.5
T1.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2023 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#include "grk_includes.h"
24
25namespace grk
26{
28typedef uint32_t grk_flag;
29struct DecompressCodeblock;
30
31struct T1
32{
33 T1(bool isCompressor, uint32_t maxCblkW, uint32_t maxCblkH);
34 ~T1();
35
36 bool decompress_cblk(DecompressCodeblock* cblk, uint8_t* compressedData, uint8_t orientation,
37 uint32_t cblksty);
38 void code_block_enc_deallocate(cblk_enc* p_code_block);
39 bool alloc(uint32_t w, uint32_t h);
40 double compress_cblk(cblk_enc* cblk, uint32_t max, uint8_t orientation, uint16_t compno,
41 uint8_t level, uint8_t qmfbid, double stepsize, uint32_t cblksty,
42 const double* mct_norms, uint16_t mct_numcomps, bool doRateControl);
43 mqcoder coder;
44
45 int32_t* getUncompressedData(void);
46 void attachUncompressedData(int32_t* data, uint32_t w, uint32_t h);
47 void allocCompressedData(size_t len);
48 uint8_t* getCompressedDataBuffer(void);
49 static double getnorm(uint32_t level, uint8_t orientation, bool reversible);
50
51 private:
52 bool allocUncompressedData(size_t len);
53 void deallocUncompressedData(void);
57 uint32_t w;
58 uint32_t h;
60
62 // decompress only
63 uint8_t* compressedData; /* Temporary buffer to concatenate all chunks of a codebock */
64 size_t compressedDataLen; /* Maximum size available in compressedData */
66
72 grk_flag* flags;
73 uint32_t flagssize;
75
76 template<uint32_t w, uint32_t h, bool vsc>
77 void dec_clnpass(int32_t bpno);
78 void dec_clnpass(int32_t bpno, int32_t cblksty);
79 void dec_clnpass_check_segsym(int32_t cblksty);
80 void dec_sigpass_raw(int32_t bpno, int32_t cblksty);
81 void dec_refpass_raw(int32_t bpno);
82 void dec_sigpass_mqc(int32_t bpno, int32_t cblksty);
83 void dec_refpass_mqc(int32_t bpno);
84 inline void dec_refpass_step_raw(grk_flag* flagsp, int32_t* datap, int32_t poshalf,
85 uint32_t ci);
86 inline void dec_sigpass_step_raw(grk_flag* flagsp, int32_t* datap, int32_t oneplushalf,
87 uint32_t vsc, uint32_t ci);
88 void enc_clnpass(int32_t bpno, int32_t* nmsedec, uint32_t cblksty);
89 void enc_sigpass(int32_t bpno, int32_t* nmsedec, uint8_t type, uint32_t cblksty);
90 void enc_refpass(int32_t bpno, int32_t* nmsedec, uint8_t type);
91 int enc_is_term_pass(cblk_enc* cblk, uint32_t cblksty, int32_t bpno, uint32_t passtype);
92 bool code_block_enc_allocate(cblk_enc* p_code_block);
100 double getnorm_53(uint32_t level, uint8_t orientation);
108 double getnorm_97(uint32_t level, uint8_t orientation);
109
110 double getwmsedec(int32_t nmsedec, uint16_t compno, uint32_t level, uint8_t orientation,
111 int32_t bpno, uint32_t qmfbid, double stepsize, const double* mct_norms,
112 uint32_t mct_numcomps);
113};
114
115} // namespace grk
bool doRateControl
Definition BlockExec.h:73
float stepsize
Definition BlockExec.h:34
uint16_t mct_numcomps
Definition BlockExec.h:85
DecompressCodeblock * cblk
Definition BlockExec.h:52
uint32_t len
Definition Codeblock.h:38
uint8_t * data
Definition Codeblock.h:61
double * mct_norms
compressing norms
Definition CodingParams.h:179
uint8_t qmfbid
discrete wavelet transform identifier
Definition CodingParams.h:66
uint32_t h
Definition FileFormat.h:147
uint32_t w
Definition FileFormat.h:145
uint32_t type
Definition FileFormat.h:83
size_t compressedDataLen
Definition T1.h:64
size_t uncompressedDataLen
Definition T1.h:55
mqcoder coder
Definition T1.h:43
bool compressor
Definition T1.h:74
grk_flag * flags
Flags used by decompressor and compressor.
Definition T1.h:72
uint32_t uncompressedDataStride
Definition T1.h:59
uint8_t * compressedData
Definition T1.h:63
int32_t * uncompressedData
Definition T1.h:54
bool ownsUncompressedData
Definition T1.h:56
uint32_t flagssize
Definition T1.h:73
uint32_t grk_flag
Flags for 4 consecutive rows of a column.
Definition TileCache.h:29
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
uint16_t compno
Definition plugin_interface.h:43
uint32_t level
Definition plugin_interface.h:44
uint8_t orientation
Definition plugin_interface.h:42