Grok 13.0.2
mct.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2024 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, uint32_t linesPerTask)
39 : tile(t), compno(0), flow_(flow), linesPerTask_(linesPerTask), yBegin(0), yEnd(0)
40 {}
42 uint16_t compno;
43 std::vector<ShiftInfo> shiftInfo;
45 uint32_t linesPerTask_;
46 uint32_t yBegin;
47 uint32_t yEnd;
48};
49
50class mct
51{
52 public:
53 mct(Tile* tile, GrkImage* image, TileCodingParams* tcp);
54
63
72
76 void decompress_dc_shift_rev(FlowComponent* flow, uint16_t compno);
77
81 void decompress_dc_shift_irrev(FlowComponent* flow, uint16_t compno);
82
86 static const double* get_norms_rev(void);
87
91 static const double* get_norms_irrev(void);
92
102 static bool compress_custom(uint8_t* p_coding_data, uint64_t n, uint8_t** p_data,
103 uint16_t numComps, uint32_t is_signed);
113 static bool decompress_custom(uint8_t* pDecodingData, uint64_t n, uint8_t** pData,
114 uint16_t pNbComp, uint32_t isSigned);
121 static void calculate_norms(double* pNorms, uint16_t nb_comps, float* pMatrix);
122
123 private:
124 void genShift(uint16_t compno, int32_t sign, std::vector<ShiftInfo>& shiftInfo);
125 void genShift(int32_t sign, std::vector<ShiftInfo>& shiftInfo);
126
130};
131
132/* ----------------------------------------------------------------------- */
136
137} // namespace grk
Definition FlowComponent.h:21
Definition GrkImage.h:24
Definition mct.h:51
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:128
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:129
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)
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)
mct(Tile *tile, GrkImage *image, TileCodingParams *tcp)
Tile * tile_
Definition mct.h:127
void compress_rev(FlowComponent *flow)
Apply a reversible multi-component transform to an image.
void decompress_dc_shift_irrev(FlowComponent *flow, uint16_t compno)
Apply an irreversible inverse dc shift to an image.
Copyright (C) 2016-2024 Grok Image Compression Inc.
Definition ICacheable.h:20
Definition mct.h:37
uint32_t linesPerTask_
Definition mct.h:45
uint16_t compno
Definition mct.h:42
ScheduleInfo(Tile *t, FlowComponent *flow, uint32_t linesPerTask)
Definition mct.h:38
uint32_t yBegin
Definition mct.h:46
Tile * tile
Definition mct.h:41
FlowComponent * flow_
Definition mct.h:44
std::vector< ShiftInfo > shiftInfo
Definition mct.h:43
uint32_t yEnd
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