Grok 14.0.0
T1.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2024 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;
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* compressed_data, 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);
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* compressed_data; /* Temporary buffer to concatenate all chunks of a codebock */
64 size_t compressedDataLen; /* Maximum size available in compressed_data */
66
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, uint32_t ci);
85 inline void dec_sigpass_step_raw(grk_flag* flagsp, int32_t* datap, int32_t oneplushalf,
86 uint32_t vsc, uint32_t ci);
87 void enc_clnpass(int32_t bpno, int32_t* nmsedec, uint32_t cblksty);
88 void enc_sigpass(int32_t bpno, int32_t* nmsedec, uint8_t type, uint32_t cblksty);
89 void enc_refpass(int32_t bpno, int32_t* nmsedec, uint8_t type);
90 int enc_is_term_pass(cblk_enc* cblk, uint32_t cblksty, int32_t bpno, uint32_t passtype);
91 void code_block_enc_allocate(cblk_enc* p_code_block);
99 double getnorm_53(uint32_t level, uint8_t orientation);
107 double getnorm_97(uint32_t level, uint8_t orientation);
108
109 double getwmsedec(int32_t nmsedec, uint16_t compno, uint32_t level, uint8_t orientation,
110 int32_t bpno, uint32_t qmfbid, double stepsize, const double* mct_norms,
111 uint32_t mct_numcomps);
112};
113
114} // namespace grk
Copyright (C) 2016-2024 Grok Image Compression Inc.
Definition ICacheable.h:20
uint32_t grk_flag
Flags for 4 consecutive rows of a column.
Definition T1.h:28
Definition Codeblock.h:178
Definition T1.h:32
bool alloc(uint32_t w, uint32_t h)
Definition T1.cpp:393
bool allocUncompressedData(size_t len)
Definition T1.cpp:359
void dec_clnpass(int32_t bpno)
Definition T1.cpp:1093
uint8_t * getCompressedDataBuffer(void)
Definition T1.cpp:343
void dec_sigpass_mqc(int32_t bpno, int32_t cblksty)
Definition T1.cpp:1219
void code_block_enc_allocate(cblk_enc *p_code_block)
Definition T1.cpp:465
T1(bool isCompressor, uint32_t maxCblkW, uint32_t maxCblkH)
Definition T1.cpp:308
int32_t * uncompressedData
Definition T1.h:54
void attachUncompressedData(int32_t *data, uint32_t w, uint32_t h)
Definition T1.cpp:387
void enc_clnpass(int32_t bpno, int32_t *nmsedec, uint32_t cblksty)
Definition T1.cpp:656
void dec_refpass_mqc(int32_t bpno)
Definition T1.cpp:1310
size_t uncompressedDataLen
Definition T1.h:55
~T1()
Definition T1.cpp:317
void allocCompressedData(size_t len)
Definition T1.cpp:347
void enc_refpass(int32_t bpno, int32_t *nmsedec, uint8_t type)
Definition T1.cpp:606
bool decompress_cblk(DecompressCodeblock *cblk, uint8_t *compressed_data, uint8_t orientation, uint32_t cblksty)
Definition T1.cpp:1315
void dec_sigpass_step_raw(grk_flag *flagsp, int32_t *datap, int32_t oneplushalf, uint32_t vsc, uint32_t ci)
Definition T1.cpp:1112
mqcoder coder
Definition T1.h:43
int enc_is_term_pass(cblk_enc *cblk, uint32_t cblksty, int32_t bpno, uint32_t passtype)
Definition T1.cpp:489
int32_t * getUncompressedData(void)
Definition T1.cpp:355
void deallocUncompressedData(void)
Definition T1.cpp:380
double compress_cblk(cblk_enc *cblk, uint32_t max, uint8_t orientation, uint16_t compno, uint8_t level, uint8_t qmfbid, double stepsize, uint32_t cblksty, const double *mct_norms, uint16_t mct_numcomps, bool doRateControl)
Definition T1.cpp:808
uint32_t h
Definition T1.h:58
double getnorm_53(uint32_t level, uint8_t orientation)
Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.
Definition T1.cpp:332
uint32_t uncompressedDataStride
Definition T1.h:59
void dec_clnpass_check_segsym(int32_t cblksty)
Definition T1.cpp:1074
grk_flag * flags
Flags used by decompressor and compressor.
Definition T1.h:72
void code_block_enc_deallocate(cblk_enc *p_code_block)
ENCODE ////////////////////////////////////////////////////.
Definition T1.cpp:460
void enc_sigpass(int32_t bpno, int32_t *nmsedec, uint8_t type, uint32_t cblksty)
Definition T1.cpp:538
size_t compressedDataLen
Definition T1.h:64
uint32_t w
Definition T1.h:57
uint32_t flagssize
Definition T1.h:73
void dec_sigpass_raw(int32_t bpno, int32_t cblksty)
Definition T1.cpp:1152
bool ownsUncompressedData
Definition T1.h:56
void dec_refpass_step_raw(grk_flag *flagsp, int32_t *datap, int32_t poshalf, uint32_t ci)
Definition T1.cpp:1226
static double getnorm(uint32_t level, uint8_t orientation, bool reversible)
Definition T1.cpp:323
void dec_refpass_raw(int32_t bpno)
Definition T1.cpp:1250
double getnorm_97(uint32_t level, uint8_t orientation)
Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT.
Definition T1.cpp:339
double getwmsedec(int32_t nmsedec, uint16_t compno, uint32_t level, uint8_t orientation, int32_t bpno, uint32_t qmfbid, double stepsize, const double *mct_norms, uint32_t mct_numcomps)
Definition T1.cpp:470
uint8_t * compressed_data
Definition T1.h:63
bool compressor
Definition T1.h:74
Definition t1_common.h:72
Definition mqc.h:50