Grok  9.5.0
mct.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2021 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 
25 namespace grk
26 {
27 struct ShiftInfo
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 
36 class mct
37 {
38  public:
45  static void compress_rev(Tile* tile, GrkImage* image, TileComponentCodingParams* tccps);
52  static void decompress_rev(Tile* tile, GrkImage* image, TileComponentCodingParams* tccps);
53 
57  static const double* get_norms_rev(void);
58 
65  static void compress_irrev(Tile* tile, GrkImage* image, TileComponentCodingParams* tccps);
72  static void decompress_irrev(Tile* tile, GrkImage* image, TileComponentCodingParams* tccps);
73 
77  static const double* get_norms_irrev(void);
78 
88  static bool compress_custom(uint8_t* p_coding_data, uint64_t n, uint8_t** p_data,
89  uint16_t numComps, uint32_t is_signed);
99  static bool decompress_custom(uint8_t* pDecodingData, uint64_t n, uint8_t** pData,
100  uint16_t pNbComp, uint32_t isSigned);
107  static void calculate_norms(double* pNorms, uint16_t nb_comps, float* pMatrix);
108 
115  static void decompress_dc_shift_rev(Tile* tile, GrkImage* image,
116  TileComponentCodingParams* tccps, uint16_t compno);
117 
124  static void decompress_dc_shift_irrev(Tile* tile, GrkImage* image,
125  TileComponentCodingParams* tccps, uint16_t compno);
126 
127  private:
128  static void genShift(uint16_t compno, GrkImage* image, TileComponentCodingParams* tccps,
129  int32_t sign, std::vector<ShiftInfo>& shiftInfo);
130  static void genShift(GrkImage* image, TileComponentCodingParams* tccps, int32_t sign,
131  std::vector<ShiftInfo>& shiftInfo);
132 };
133 
134 /* ----------------------------------------------------------------------- */
138 
139 } // namespace grk
Definition: GrkImage.h:19
Definition: mct.h:37
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.
static void compress_irrev(Tile *tile, GrkImage *image, TileComponentCodingParams *tccps)
Apply an irreversible multi-component transform to an image.
static void calculate_norms(double *pNorms, uint16_t nb_comps, float *pMatrix)
Calculate norm of MCT transform.
static void genShift(GrkImage *image, TileComponentCodingParams *tccps, int32_t sign, std::vector< ShiftInfo > &shiftInfo)
static void decompress_irrev(Tile *tile, GrkImage *image, TileComponentCodingParams *tccps)
Apply an irreversible multi-component inverse transform to an image.
static void decompress_rev(Tile *tile, GrkImage *image, TileComponentCodingParams *tccps)
Apply a reversible multi-component inverse transform to an image.
static void compress_rev(Tile *tile, GrkImage *image, TileComponentCodingParams *tccps)
Apply a reversible multi-component transform to an image.
static void decompress_dc_shift_rev(Tile *tile, GrkImage *image, TileComponentCodingParams *tccps, uint16_t compno)
Apply a reversible inverse dc shift to an image.
static const double * get_norms_irrev(void)
Get wavelet norms for irreversible transform.
static void decompress_dc_shift_irrev(Tile *tile, GrkImage *image, TileComponentCodingParams *tccps, uint16_t compno)
Apply an irreversible inverse dc shift to an image.
static const double * get_norms_rev(void)
Get wavelet norms for reversible transform.
static void genShift(uint16_t compno, GrkImage *image, TileComponentCodingParams *tccps, int32_t sign, std::vector< ShiftInfo > &shiftInfo)
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: ICacheable.h:20
const double shift
Definition: RateControl.cpp:165
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-component coding parameters.
Definition: CodingParams.h:53
Definition: TileProcessor.h:39