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{
27struct 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
36struct ScheduleInfo
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 {}
42 Tile* tile;
43 uint16_t compno;
44 std::vector<ShiftInfo> shiftInfo;
46 uint32_t linesPerTask_;
47 StripCache* stripCache_;
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
60 void compress_rev(FlowComponent* flow);
64 void decompress_rev(FlowComponent* flow);
65
69 void compress_irrev(FlowComponent* flow);
73 void decompress_irrev(FlowComponent* flow);
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
129 Tile* tile_;
130 GrkImage* image_;
131 TileCodingParams* tcp_;
132 StripCache* stripCache_;
133};
134
135/* ----------------------------------------------------------------------- */
139
140} // namespace grk
StripCache stripCache_
Definition CodeStreamDecompress.h:330
uint8_t mct
multi-component transform identifier
Definition CodingParams.h:141
Definition FlowComponent.h:21
FlowComponent * flow_
Definition mct.h:45
Tile * tile_
Definition mct.h:129
GrkImage * image_
Definition mct.h:130
std::vector< ShiftInfo > shiftInfo
Definition mct.h:44
int32_t _max
Definition mct.h:32
int32_t _min
Definition mct.h:31
TileCodingParams * tcp_
Definition mct.h:131
int32_t _shift
Definition mct.h:33
uint32_t yEnd
Definition mct.h:49
uint32_t linesPerTask_
Definition mct.h:46
uint32_t yBegin
Definition mct.h:48
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
const double shift
Definition RateControl.cpp:165
grk_plugin_tile * tile
Definition plugin_interface.h:64
grk_image * image
Definition plugin_interface.h:63
uint16_t compno
Definition plugin_interface.h:43