Grok 20.3.2
mct.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2026 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
18#pragma once
19
20#include <vector>
21
22namespace grk
23{
25{
26 ShiftInfo(int32_t mn, int32_t mx, int32_t shift) : _min(mn), _max(mx), _shift(shift) {}
27 ShiftInfo() : ShiftInfo(0, 0, 0) {}
28 int32_t _min;
29 int32_t _max;
30 int32_t _shift;
31};
32
34{
35 ScheduleInfo(Tile* t, FlowComponent* flow, uint32_t linesPerTask)
36 : tile(t), compno(0), flow_(flow), linesPerTask_(linesPerTask), yBegin(0), yEnd(0)
37 {}
39 uint16_t compno;
40 std::vector<ShiftInfo> shiftInfo;
42 uint32_t linesPerTask_;
43 uint32_t yBegin;
44 uint32_t yEnd;
45};
46
47class Mct
48{
49public:
50 Mct(Tile* tile, GrkImage* image, TileCodingParams* tcp);
51
55 void compress_rev(FlowComponent* flow, bool applyDcShift = false);
59 void schedule_decompress_rev(FlowComponent* flow, bool applyDcShift = false);
60
64 void compress_irrev(FlowComponent* flow, bool applyDcShift = false);
68 void schedule_decompress_irrev(FlowComponent* flow, bool applyDcShift = false);
69
73 void schedule_decompress_dc_shift_rev(FlowComponent* flow, uint16_t compno);
74
79
83 static const double* get_norms_rev(void);
84
88 static const double* get_norms_irrev(void);
89
99 static bool compress_custom(uint8_t* p_coding_data, uint64_t n, uint8_t** p_data,
100 uint16_t numComps, uint32_t is_signed);
110 static bool schedule_decompress_custom(uint8_t* pDecodingData, uint64_t n, uint8_t** pData,
111 uint16_t pNbComp, uint32_t isSigned);
118 static void calculate_norms(double* pNorms, uint16_t nb_comps, float* pMatrix);
119
120private:
121 void genShift(uint16_t compno, int32_t sign, std::vector<ShiftInfo>& shiftInfo);
122 void genShift(int32_t sign, std::vector<ShiftInfo>& shiftInfo);
123
127};
128
129/* ----------------------------------------------------------------------- */
131
133
134} // namespace grk
A collection of tasks which can be scheduled as a single task.
Definition FlowComponent.h:28
Stores header and data for an image.
Definition GrkImage.h:54
void compress_irrev(FlowComponent *flow, bool applyDcShift=false)
Apply an irreversible multi-component transform to an image.
Mct(Tile *tile, GrkImage *image, TileCodingParams *tcp)
Tile * tile_
Definition mct.h:124
void genShift(uint16_t compno, int32_t sign, std::vector< ShiftInfo > &shiftInfo)
void schedule_decompress_dc_shift_rev(FlowComponent *flow, uint16_t compno)
Apply a reversible inverse dc shift to an image.
void schedule_decompress_dc_shift_irrev(FlowComponent *flow, uint16_t compno)
Apply an irreversible inverse dc shift to an image.
static bool schedule_decompress_custom(uint8_t *pDecodingData, uint64_t n, uint8_t **pData, uint16_t pNbComp, uint32_t isSigned)
Custom MCT decode.
static void calculate_norms(double *pNorms, uint16_t nb_comps, float *pMatrix)
Calculate norm of MCT transform.
static const double * get_norms_rev(void)
Get wavelet norms for reversible transform.
void schedule_decompress_rev(FlowComponent *flow, bool applyDcShift=false)
Apply a reversible multi-component inverse transform to an image.
TileCodingParams * tcp_
Definition mct.h:126
GrkImage * image_
Definition mct.h:125
void genShift(int32_t sign, std::vector< ShiftInfo > &shiftInfo)
static const double * get_norms_irrev(void)
Get wavelet norms for irreversible transform.
void schedule_decompress_irrev(FlowComponent *flow, bool applyDcShift=false)
Apply an irreversible multi-component inverse transform to an image.
void compress_rev(FlowComponent *flow, bool applyDcShift=false)
Apply a reversible multi-component transform to an image.
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.
ResWindow.
Definition CompressedChunkCache.h:36
const double shift
Definition RateControl.cpp:169
uint32_t linesPerTask_
Definition mct.h:42
uint16_t compno
Definition mct.h:39
ScheduleInfo(Tile *t, FlowComponent *flow, uint32_t linesPerTask)
Definition mct.h:35
uint32_t yBegin
Definition mct.h:43
Tile * tile
Definition mct.h:38
FlowComponent * flow_
Definition mct.h:41
std::vector< ShiftInfo > shiftInfo
Definition mct.h:40
uint32_t yEnd
Definition mct.h:44
int32_t _shift
Definition mct.h:30
ShiftInfo(int32_t mn, int32_t mx, int32_t shift)
Definition mct.h:26
int32_t _min
Definition mct.h:28
ShiftInfo()
Definition mct.h:27
int32_t _max
Definition mct.h:29
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition CodingParams.h:124
Definition Tile.h:39