T1.h
Go to the documentation of this file.
/*
* Copyright (C) 2016-2023 Grok Image Compression Inc.
*
* This source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This source code incorporates work covered by the BSD 2-clause license.
* Please see the LICENSE file in the root directory for details.
*
*/
#pragma once
#include "grk_includes.h"
namespace grk
{
typedef uint32_t grk_flag;
struct DecompressCodeblock;
struct T1
{
T1(bool isCompressor, uint32_t maxCblkW, uint32_t maxCblkH);
~T1();
bool decompress_cblk(DecompressCodeblock* cblk, uint8_t* compressedData, uint8_t orientation,
uint32_t cblksty);
void code_block_enc_deallocate(cblk_enc* p_code_block);
bool alloc(uint32_t w, uint32_t h);
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);
mqcoder coder;
int32_t* getUncompressedData(void);
void attachUncompressedData(int32_t* data, uint32_t w, uint32_t h);
void allocCompressedData(size_t len);
uint8_t* getCompressedDataBuffer(void);
static double getnorm(uint32_t level, uint8_t orientation, bool reversible);
private:
bool allocUncompressedData(size_t len);
void deallocUncompressedData(void);
int32_t* uncompressedData;
size_t uncompressedDataLen;
bool ownsUncompressedData;
uint32_t w;
uint32_t h;
uint32_t uncompressedDataStride;
// decompress only
uint8_t* compressedData; /* Temporary buffer to concatenate all chunks of a codebock */
size_t compressedDataLen; /* Maximum size available in compressedData */
grk_flag* flags;
uint32_t flagssize;
bool compressor;
template<uint32_t w, uint32_t h, bool vsc>
void dec_clnpass(int32_t bpno);
void dec_clnpass(int32_t bpno, int32_t cblksty);
void dec_clnpass_check_segsym(int32_t cblksty);
void dec_sigpass_raw(int32_t bpno, int32_t cblksty);
void dec_refpass_raw(int32_t bpno);
void dec_sigpass_mqc(int32_t bpno, int32_t cblksty);
void dec_refpass_mqc(int32_t bpno);
inline void dec_refpass_step_raw(grk_flag* flagsp, int32_t* datap, int32_t poshalf,
uint32_t ci);
inline void dec_sigpass_step_raw(grk_flag* flagsp, int32_t* datap, int32_t oneplushalf,
uint32_t vsc, uint32_t ci);
void enc_clnpass(int32_t bpno, int32_t* nmsedec, uint32_t cblksty);
void enc_sigpass(int32_t bpno, int32_t* nmsedec, uint8_t type, uint32_t cblksty);
void enc_refpass(int32_t bpno, int32_t* nmsedec, uint8_t type);
int enc_is_term_pass(cblk_enc* cblk, uint32_t cblksty, int32_t bpno, uint32_t passtype);
bool code_block_enc_allocate(cblk_enc* p_code_block);
double getnorm_53(uint32_t level, uint8_t orientation);
double getnorm_97(uint32_t level, uint8_t orientation);
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);
};
} // namespace grk
grk_includes.h
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::grk_read
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
grk::grk_flag
uint32_t grk_flag
Flags for 4 consecutive rows of a column.
Definition T1.h:28
grk::DecompressCodeblock
Definition Codeblock.h:201
grk::T1
Definition T1.h:32
grk::T1::alloc
bool alloc(uint32_t w, uint32_t h)
Definition T1.cpp:332
grk::T1::allocUncompressedData
bool allocUncompressedData(size_t len)
Definition T1.cpp:298
grk::T1::dec_clnpass
void dec_clnpass(int32_t bpno)
Definition T1.cpp:1028
grk::T1::getCompressedDataBuffer
uint8_t * getCompressedDataBuffer(void)
Definition T1.cpp:282
grk::T1::dec_sigpass_mqc
void dec_sigpass_mqc(int32_t bpno, int32_t cblksty)
Definition T1.cpp:1158
grk::T1::uncompressedData
int32_t * uncompressedData
Definition T1.h:54
grk::T1::decompress_cblk
bool decompress_cblk(DecompressCodeblock *cblk, uint8_t *compressedData, uint8_t orientation, uint32_t cblksty)
Definition T1.cpp:1255
grk::T1::attachUncompressedData
void attachUncompressedData(int32_t *data, uint32_t w, uint32_t h)
Definition T1.cpp:326
grk::T1::enc_clnpass
void enc_clnpass(int32_t bpno, int32_t *nmsedec, uint32_t cblksty)
Definition T1.cpp:601
grk::T1::code_block_enc_allocate
bool code_block_enc_allocate(cblk_enc *p_code_block)
Definition T1.cpp:403
grk::T1::dec_refpass_mqc
void dec_refpass_mqc(int32_t bpno)
Definition T1.cpp:1250
grk::T1::uncompressedDataLen
size_t uncompressedDataLen
Definition T1.h:55
grk::T1::~T1
~T1()
Definition T1.cpp:252
grk::T1::allocCompressedData
void allocCompressedData(size_t len)
Definition T1.cpp:286
grk::T1::enc_refpass
void enc_refpass(int32_t bpno, int32_t *nmsedec, uint8_t type)
Definition T1.cpp:550
grk::T1::dec_sigpass_step_raw
void dec_sigpass_step_raw(grk_flag *flagsp, int32_t *datap, int32_t oneplushalf, uint32_t vsc, uint32_t ci)
Definition T1.cpp:1047
grk::T1::compressedData
uint8_t * compressedData
Definition T1.h:63
grk::T1::coder
mqcoder coder
Definition T1.h:43
grk::T1::enc_is_term_pass
int enc_is_term_pass(cblk_enc *cblk, uint32_t cblksty, int32_t bpno, uint32_t passtype)
Definition T1.cpp:432
grk::T1::getUncompressedData
int32_t * getUncompressedData(void)
Definition T1.cpp:294
grk::T1::deallocUncompressedData
void deallocUncompressedData(void)
Definition T1.cpp:319
grk::T1::compress_cblk
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:755
grk::T1::h
uint32_t h
Definition T1.h:58
grk::T1::getnorm_53
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:271
grk::T1::uncompressedDataStride
uint32_t uncompressedDataStride
Definition T1.h:59
grk::T1::dec_clnpass_check_segsym
void dec_clnpass_check_segsym(int32_t cblksty)
Definition T1.cpp:1009
grk::T1::flags
grk_flag * flags
Flags used by decompressor and compressor.
Definition T1.h:72
grk::T1::code_block_enc_deallocate
void code_block_enc_deallocate(cblk_enc *p_code_block)
ENCODE ////////////////////////////////////////////////////.
Definition T1.cpp:398
grk::T1::enc_sigpass
void enc_sigpass(int32_t bpno, int32_t *nmsedec, uint8_t type, uint32_t cblksty)
Definition T1.cpp:482
grk::T1::compressedDataLen
size_t compressedDataLen
Definition T1.h:64
grk::T1::w
uint32_t w
Definition T1.h:57
grk::T1::flagssize
uint32_t flagssize
Definition T1.h:73
grk::T1::dec_sigpass_raw
void dec_sigpass_raw(int32_t bpno, int32_t cblksty)
Definition T1.cpp:1089
grk::T1::ownsUncompressedData
bool ownsUncompressedData
Definition T1.h:56
grk::T1::dec_refpass_step_raw
void dec_refpass_step_raw(grk_flag *flagsp, int32_t *datap, int32_t poshalf, uint32_t ci)
Definition T1.cpp:1165
grk::T1::getnorm
static double getnorm(uint32_t level, uint8_t orientation, bool reversible)
Definition T1.cpp:258
grk::T1::dec_refpass_raw
void dec_refpass_raw(int32_t bpno)
Definition T1.cpp:1189
grk::T1::getnorm_97
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:278
grk::T1::getwmsedec
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:413
grk::T1::compressor
bool compressor
Definition T1.h:74
grk::cblk_enc
Definition t1_common.h:72
grk::mqcoder
Definition mqc.h:44