BlockExec.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/>.
*
*/
#pragma once
#include "grk_includes.h"
namespace grk
{
struct BlockExec
{
BlockExec()
: tilec(nullptr), bandIndex(0), bandNumbps(0), bandOrientation(BAND_ORIENT_LL), stepsize(0),
cblk_sty(0), qmfbid(0), x(0), y(0), k_msbs(0), R_b(0)
{}
virtual bool open(T1Interface* t1) = 0;
virtual ~BlockExec() = default;
TileComponent* tilec;
uint8_t bandIndex;
uint8_t bandNumbps;
eBandOrientation bandOrientation;
float stepsize;
uint8_t cblk_sty;
uint8_t qmfbid;
/* code block offset in buffer coordinates*/
uint32_t x;
uint32_t y;
// missing bit planes for all blocks in band
uint8_t k_msbs;
uint8_t R_b;
};
struct DecompressBlockExec : public BlockExec
{
DecompressBlockExec() : cblk(nullptr), resno(0), roishift(0) {}
bool open(T1Interface* t1)
{
return t1->decompress(this);
}
void close(void) {}
DecompressCodeblock* cblk;
uint8_t resno;
uint8_t roishift;
};
struct CompressBlockExec : public BlockExec
{
CompressBlockExec()
: cblk(nullptr), tile(nullptr), doRateControl(false), distortion(0), tiledp(nullptr),
compno(0), resno(0), precinctIndex(0), cblkno(0), inv_step_ht(0), mct_norms(nullptr),
#ifdef DEBUG_LOSSLESS_T1
unencodedData(nullptr),
#endif
mct_numcomps(0)
{}
bool open(T1Interface* t1)
{
return t1->compress(this);
}
void close(void) {}
CompressCodeblock* cblk;
Tile* tile;
bool doRateControl;
double distortion;
int32_t* tiledp;
uint16_t compno;
uint8_t resno;
uint64_t precinctIndex;
uint64_t cblkno;
float inv_step_ht;
const double* mct_norms;
#ifdef DEBUG_LOSSLESS_T1
int32_t* unencodedData;
#endif
uint16_t mct_numcomps;
};
} // namespace grk
grk::T1Interface
Definition T1Interface.h:26
grk::T1Interface::decompress
virtual bool decompress(DecompressBlockExec *block)=0
grk::T1Interface::compress
virtual bool compress(CompressBlockExec *block)=0
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::eBandOrientation
eBandOrientation
Definition ResSimple.h:23
grk::BAND_ORIENT_LL
@ BAND_ORIENT_LL
Definition ResSimple.h:24
grk::BlockExec
Definition BlockExec.h:23
grk::BlockExec::y
uint32_t y
Definition BlockExec.h:39
grk::BlockExec::x
uint32_t x
Definition BlockExec.h:38
grk::BlockExec::bandNumbps
uint8_t bandNumbps
Definition BlockExec.h:32
grk::BlockExec::k_msbs
uint8_t k_msbs
Definition BlockExec.h:41
grk::BlockExec::qmfbid
uint8_t qmfbid
Definition BlockExec.h:36
grk::BlockExec::tilec
TileComponent * tilec
Definition BlockExec.h:30
grk::BlockExec::stepsize
float stepsize
Definition BlockExec.h:34
grk::BlockExec::open
virtual bool open(T1Interface *t1)=0
grk::BlockExec::BlockExec
BlockExec()
Definition BlockExec.h:24
grk::BlockExec::~BlockExec
virtual ~BlockExec()=default
grk::BlockExec::R_b
uint8_t R_b
Definition BlockExec.h:42
grk::BlockExec::cblk_sty
uint8_t cblk_sty
Definition BlockExec.h:35
grk::BlockExec::bandOrientation
eBandOrientation bandOrientation
Definition BlockExec.h:33
grk::BlockExec::bandIndex
uint8_t bandIndex
Definition BlockExec.h:31
grk::CompressBlockExec
Definition BlockExec.h:57
grk::CompressBlockExec::tile
Tile * tile
Definition BlockExec.h:72
grk::CompressBlockExec::open
bool open(T1Interface *t1)
Definition BlockExec.h:66
grk::CompressBlockExec::tiledp
int32_t * tiledp
Definition BlockExec.h:75
grk::CompressBlockExec::doRateControl
bool doRateControl
Definition BlockExec.h:73
grk::CompressBlockExec::close
void close(void)
Definition BlockExec.h:70
grk::CompressBlockExec::inv_step_ht
float inv_step_ht
Definition BlockExec.h:80
grk::CompressBlockExec::compno
uint16_t compno
Definition BlockExec.h:76
grk::CompressBlockExec::distortion
double distortion
Definition BlockExec.h:74
grk::CompressBlockExec::cblkno
uint64_t cblkno
Definition BlockExec.h:79
grk::CompressBlockExec::resno
uint8_t resno
Definition BlockExec.h:77
grk::CompressBlockExec::mct_numcomps
uint16_t mct_numcomps
Definition BlockExec.h:85
grk::CompressBlockExec::precinctIndex
uint64_t precinctIndex
Definition BlockExec.h:78
grk::CompressBlockExec::CompressBlockExec
CompressBlockExec()
Definition BlockExec.h:58
grk::CompressBlockExec::mct_norms
const double * mct_norms
Definition BlockExec.h:81
grk::CompressBlockExec::cblk
CompressCodeblock * cblk
Definition BlockExec.h:71
grk::CompressCodeblock
Definition Codeblock.h:142
grk::DecompressBlockExec
Definition BlockExec.h:45
grk::DecompressBlockExec::roishift
uint8_t roishift
Definition BlockExec.h:54
grk::DecompressBlockExec::resno
uint8_t resno
Definition BlockExec.h:53
grk::DecompressBlockExec::open
bool open(T1Interface *t1)
Definition BlockExec.h:47
grk::DecompressBlockExec::close
void close(void)
Definition BlockExec.h:51
grk::DecompressBlockExec::DecompressBlockExec
DecompressBlockExec()
Definition BlockExec.h:46
grk::DecompressBlockExec::cblk
DecompressCodeblock * cblk
Definition BlockExec.h:52
grk::DecompressCodeblock
Definition Codeblock.h:201
grk::TileComponent
Definition TileComponent.h:28
grk::Tile
Definition TileProcessor.h:39