mct.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 <vector>
namespace grk
{
struct ShiftInfo
{
ShiftInfo(int32_t mn, int32_t mx, int32_t shift) : _min(mn), _max(mx), _shift(shift) {}
ShiftInfo() : ShiftInfo(0, 0, 0) {}
int32_t _min;
int32_t _max;
int32_t _shift;
};
struct ScheduleInfo
{
ScheduleInfo(Tile* t, FlowComponent* flow, StripCache* stripCache, uint32_t linesPerTask)
: tile(t), compno(0), flow_(flow), linesPerTask_(linesPerTask), stripCache_(stripCache),
yBegin(0), yEnd(0)
{}
Tile* tile;
uint16_t compno;
std::vector<ShiftInfo> shiftInfo;
FlowComponent* flow_;
uint32_t linesPerTask_;
StripCache* stripCache_;
uint32_t yBegin;
uint32_t yEnd;
};
class mct
{
public:
mct(Tile* tile, GrkImage* image, TileCodingParams* tcp, StripCache* stripCache);
void compress_rev(FlowComponent* flow);
void decompress_rev(FlowComponent* flow);
void compress_irrev(FlowComponent* flow);
void decompress_irrev(FlowComponent* flow);
void decompress_dc_shift_rev(FlowComponent* flow, uint16_t compno);
void decompress_dc_shift_irrev(FlowComponent* flow, uint16_t compno);
static const double* get_norms_rev(void);
static const double* get_norms_irrev(void);
static bool compress_custom(uint8_t* p_coding_data, uint64_t n, uint8_t** p_data,
uint16_t numComps, uint32_t is_signed);
static bool decompress_custom(uint8_t* pDecodingData, uint64_t n, uint8_t** pData,
uint16_t pNbComp, uint32_t isSigned);
static void calculate_norms(double* pNorms, uint16_t nb_comps, float* pMatrix);
private:
void genShift(uint16_t compno, int32_t sign, std::vector<ShiftInfo>& shiftInfo);
void genShift(int32_t sign, std::vector<ShiftInfo>& shiftInfo);
Tile* tile_;
GrkImage* image_;
TileCodingParams* tcp_;
StripCache* stripCache_;
};
/* ----------------------------------------------------------------------- */
} // namespace grk
FlowComponent
Definition FlowComponent.h:21
grk::GrkImage
Definition GrkImage.h:25
grk::StripCache
Definition StripCache.h:110
grk::mct
Definition mct.h:53
grk::mct::decompress_custom
static bool decompress_custom(uint8_t *pDecodingData, uint64_t n, uint8_t **pData, uint16_t pNbComp, uint32_t isSigned)
Custom MCT decode.
grk::mct::compress_custom
static bool compress_custom(uint8_t *p_coding_data, uint64_t n, uint8_t **p_data, uint16_t numComps, uint32_t is_signed)
Custom MCT transform.
grk::mct::image_
GrkImage * image_
Definition mct.h:130
grk::mct::get_norms_irrev
static const double * get_norms_irrev(void)
Get wavelet norms for irreversible transform.
grk::mct::decompress_rev
void decompress_rev(FlowComponent *flow)
Apply a reversible multi-component inverse transform to an image.
grk::mct::calculate_norms
static void calculate_norms(double *pNorms, uint16_t nb_comps, float *pMatrix)
Calculate norm of MCT transform.
grk::mct::decompress_dc_shift_rev
void decompress_dc_shift_rev(FlowComponent *flow, uint16_t compno)
Apply a reversible inverse dc shift to an image.
grk::mct::tcp_
TileCodingParams * tcp_
Definition mct.h:131
grk::mct::compress_irrev
void compress_irrev(FlowComponent *flow)
Apply an irreversible multi-component transform to an image.
grk::mct::get_norms_rev
static const double * get_norms_rev(void)
Get wavelet norms for reversible transform.
grk::mct::genShift
void genShift(int32_t sign, std::vector< ShiftInfo > &shiftInfo)
grk::mct::stripCache_
StripCache * stripCache_
Definition mct.h:132
grk::mct::decompress_irrev
void decompress_irrev(FlowComponent *flow)
Apply an irreversible multi-component inverse transform to an image.
grk::mct::genShift
void genShift(uint16_t compno, int32_t sign, std::vector< ShiftInfo > &shiftInfo)
grk::mct::tile_
Tile * tile_
Definition mct.h:129
grk::mct::compress_rev
void compress_rev(FlowComponent *flow)
Apply a reversible multi-component transform to an image.
grk::mct::mct
mct(Tile *tile, GrkImage *image, TileCodingParams *tcp, StripCache *stripCache)
grk::mct::decompress_dc_shift_irrev
void decompress_dc_shift_irrev(FlowComponent *flow, uint16_t compno)
Apply an irreversible inverse dc shift to an image.
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::shift
const double shift
Definition RateControl.cpp:165
grk::ScheduleInfo
Definition mct.h:37
grk::ScheduleInfo::linesPerTask_
uint32_t linesPerTask_
Definition mct.h:46
grk::ScheduleInfo::compno
uint16_t compno
Definition mct.h:43
grk::ScheduleInfo::yBegin
uint32_t yBegin
Definition mct.h:48
grk::ScheduleInfo::tile
Tile * tile
Definition mct.h:42
grk::ScheduleInfo::flow_
FlowComponent * flow_
Definition mct.h:45
grk::ScheduleInfo::shiftInfo
std::vector< ShiftInfo > shiftInfo
Definition mct.h:44
grk::ScheduleInfo::ScheduleInfo
ScheduleInfo(Tile *t, FlowComponent *flow, StripCache *stripCache, uint32_t linesPerTask)
Definition mct.h:38
grk::ScheduleInfo::yEnd
uint32_t yEnd
Definition mct.h:49
grk::ScheduleInfo::stripCache_
StripCache * stripCache_
Definition mct.h:47
grk::ShiftInfo
Definition mct.h:28
grk::ShiftInfo::_shift
int32_t _shift
Definition mct.h:33
grk::ShiftInfo::ShiftInfo
ShiftInfo(int32_t mn, int32_t mx, int32_t shift)
Definition mct.h:29
grk::ShiftInfo::_min
int32_t _min
Definition mct.h:31
grk::ShiftInfo::ShiftInfo
ShiftInfo()
Definition mct.h:30
grk::ShiftInfo::_max
int32_t _max
Definition mct.h:32
grk::TileCodingParams
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition CodingParams.h:122
grk::Tile
Definition TileProcessor.h:39