Grok 10.0.5
mct.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2023 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 <vector>
24
25namespace grk
26{
28{
29 ShiftInfo(int32_t mn, int32_t mx, int32_t shift) : _min(mn), _max(mx), _shift(shift) {}
30 ShiftInfo() : ShiftInfo(0, 0, 0) {}
31 int32_t _min;
32 int32_t _max;
33 int32_t _shift;
34};
35
37{
38 ScheduleInfo(Tile* t, FlowComponent* flow, StripCache* stripCache, uint32_t linesPerTask)
39 : tile(t), compno(0), flow_(flow), linesPerTask_(linesPerTask), stripCache_(stripCache),
40 yBegin(0), yEnd(0)
41 {}
43 uint16_t compno;
44 std::vector<ShiftInfo> shiftInfo;
46 uint32_t linesPerTask_;
48 uint32_t yBegin;
49 uint32_t yEnd;
50};
51
52class mct
53{
54 public:
55 mct(Tile* tile, GrkImage* image, TileCodingParams* tcp, StripCache* stripCache);
56
65
74
78 void decompress_dc_shift_rev(FlowComponent* flow, uint16_t compno);
79
83 void decompress_dc_shift_irrev(FlowComponent* flow, uint16_t compno);
84
88 static const double* get_norms_rev(void);
89
93 static const double* get_norms_irrev(void);
94
104 static bool compress_custom(uint8_t* p_coding_data, uint64_t n, uint8_t** p_data,
105 uint16_t numComps, uint32_t is_signed);
115 static bool decompress_custom(uint8_t* pDecodingData, uint64_t n, uint8_t** pData,
116 uint16_t pNbComp, uint32_t isSigned);
123 static void calculate_norms(double* pNorms, uint16_t nb_comps, float* pMatrix);
124
125 private:
126 void genShift(uint16_t compno, int32_t sign, std::vector<ShiftInfo>& shiftInfo);
127 void genShift(int32_t sign, std::vector<ShiftInfo>& shiftInfo);
128
133};
134
135/* ----------------------------------------------------------------------- */
139
140} // namespace grk
Definition: FlowComponent.h:21
Definition: GrkImage.h:25
Definition: StripCache.h:110
Definition: mct.h:53
static bool decompress_custom(uint8_t *pDecodingData, uint64_t n, uint8_t **pData, uint16_t pNbComp, uint32_t isSigned)
Custom MCT decode.
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.
GrkImage * image_
Definition: mct.h:130
static const double * get_norms_irrev(void)
Get wavelet norms for irreversible transform.
void decompress_rev(FlowComponent *flow)
Apply a reversible multi-component inverse transform to an image.
static void calculate_norms(double *pNorms, uint16_t nb_comps, float *pMatrix)
Calculate norm of MCT transform.
void decompress_dc_shift_rev(FlowComponent *flow, uint16_t compno)
Apply a reversible inverse dc shift to an image.
TileCodingParams * tcp_
Definition: mct.h:131
void compress_irrev(FlowComponent *flow)
Apply an irreversible multi-component transform to an image.
static const double * get_norms_rev(void)
Get wavelet norms for reversible transform.
void genShift(int32_t sign, std::vector< ShiftInfo > &shiftInfo)
StripCache * stripCache_
Definition: mct.h:132
void decompress_irrev(FlowComponent *flow)
Apply an irreversible multi-component inverse transform to an image.
void genShift(uint16_t compno, int32_t sign, std::vector< ShiftInfo > &shiftInfo)
Tile * tile_
Definition: mct.h:129
void compress_rev(FlowComponent *flow)
Apply a reversible multi-component transform to an image.
mct(Tile *tile, GrkImage *image, TileCodingParams *tcp, StripCache *stripCache)
void decompress_dc_shift_irrev(FlowComponent *flow, uint16_t compno)
Apply an irreversible inverse dc shift to an image.
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition: ICacheable.h:20
const double shift
Definition: RateControl.cpp:165
Definition: mct.h:37
uint32_t linesPerTask_
Definition: mct.h:46
uint16_t compno
Definition: mct.h:43
uint32_t yBegin
Definition: mct.h:48
Tile * tile
Definition: mct.h:42
FlowComponent * flow_
Definition: mct.h:45
std::vector< ShiftInfo > shiftInfo
Definition: mct.h:44
ScheduleInfo(Tile *t, FlowComponent *flow, StripCache *stripCache, uint32_t linesPerTask)
Definition: mct.h:38
uint32_t yEnd
Definition: mct.h:49
StripCache * stripCache_
Definition: mct.h:47
Definition: mct.h:28
int32_t _shift
Definition: mct.h:33
ShiftInfo(int32_t mn, int32_t mx, int32_t shift)
Definition: mct.h:29
int32_t _min
Definition: mct.h:31
ShiftInfo()
Definition: mct.h:30
int32_t _max
Definition: mct.h:32
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition: CodingParams.h:122
Definition: TileProcessor.h:39