Grok 20.3.2
CodeblockImpl.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
20namespace grk::t1
21{
22// note: block lives in canvas coordinates
24{
25 CodeblockImpl(uint16_t numLayers)
26 : numbps_(0), numlenbits_(0), signalledPassesByLayer_(nullptr), numLayers_(numLayers)
27 {}
29 {
30 compressedStream.dealloc();
32 }
33 uint8_t getNumPassesInLayer(uint16_t layno)
34 {
35 assert(layno < numLayers_);
36 return signalledPassesByLayer_[layno];
37 }
38 void setNumPassesInLayer(uint16_t layno, uint8_t passes)
39 {
40 assert(layno < numLayers_);
41 signalledPassesByLayer_[layno] = passes;
42 }
43 void incNumPassesInLayer(uint16_t layno, uint8_t delta)
44 {
45 assert(layno < numLayers_);
46 signalledPassesByLayer_[layno] += delta;
47 }
49 {
50 return &compressedStream;
51 }
52 uint8_t numbps(void)
53 {
54 return numbps_;
55 }
56 void setNumBps(uint8_t bps)
57 {
58 numbps_ = bps;
59 }
60 uint8_t numlenbits()
61 {
62 return numlenbits_;
63 }
64 void setNumLenBits(uint8_t bits)
65 {
66 numlenbits_ = bits;
67 }
68
69protected:
70 void init()
71 {
75 }
77 uint8_t numbps_;
78 uint8_t numlenbits_;
80 uint16_t numLayers_;
81
82private:
83 explicit CodeblockImpl(const CodeblockImpl& rhs) = default;
84 CodeblockImpl& operator=(const CodeblockImpl& rhs) = default;
85};
86
87} // namespace grk::t1
Definition SchedulerFreebyrd.h:36
Buffer< uint8_t, AllocatorVanilla > Buffer8
Definition buffer.h:257
uint8_t numbps(void)
Definition CodeblockImpl.h:52
uint16_t numLayers_
Definition CodeblockImpl.h:80
void incNumPassesInLayer(uint16_t layno, uint8_t delta)
Definition CodeblockImpl.h:43
uint8_t * signalledPassesByLayer_
Definition CodeblockImpl.h:79
CodeblockImpl(uint16_t numLayers)
Definition CodeblockImpl.h:25
void init()
Definition CodeblockImpl.h:70
Buffer8 compressedStream
Definition CodeblockImpl.h:76
void setNumBps(uint8_t bps)
Definition CodeblockImpl.h:56
uint8_t getNumPassesInLayer(uint16_t layno)
Definition CodeblockImpl.h:33
CodeblockImpl & operator=(const CodeblockImpl &rhs)=default
uint8_t numlenbits_
Definition CodeblockImpl.h:78
void setNumPassesInLayer(uint16_t layno, uint8_t passes)
Definition CodeblockImpl.h:38
void setNumLenBits(uint8_t bits)
Definition CodeblockImpl.h:64
uint8_t numbps_
Definition CodeblockImpl.h:77
CodeblockImpl(const CodeblockImpl &rhs)=default
~CodeblockImpl()
Definition CodeblockImpl.h:28
Buffer8 * getCompressedStream(void)
Definition CodeblockImpl.h:48
uint8_t numlenbits()
Definition CodeblockImpl.h:60