Grok 20.3.2
CodecScheduler.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
20#include "grk_taskflow.h"
21
22namespace grk
23{
24
25struct ITileProcessor;
26struct TileComponent;
28{
29public:
30 ResolutionChecker(uint16_t numComponents, TileComponent* comps, bool cacheAll);
31
32 // Check if a specific component contains a given resolution
33 bool contains(uint16_t compno, uint8_t resolution) const;
34
35 std::pair<uint8_t, uint8_t> getResBounds(uint16_t compno);
36
37private:
38 // Pair of <resBegin, resUpperBound> for each component
39 std::vector<std::pair<uint8_t, uint8_t>> componentResolutions_;
40};
41
61
72{
73public:
78 explicit CodecScheduler(uint16_t numComps);
79
83 virtual ~CodecScheduler();
84
91 virtual bool scheduleT1(ITileProcessor* proc) = 0;
92
96 void run(void);
97
103 bool wait(void);
104
109 virtual void release(void) = 0;
110
111protected:
112 void releaseCoders(void);
113
117 std::atomic_bool success_;
118
122 uint16_t numcomps_;
123
128 std::vector<t1::ICoder*> coders_;
129
134 tf::Future<void> runFuture_;
135};
136
137} // namespace grk
A collection of tasks which can be scheduled as a single task.
Definition FlowComponent.h:28
std::atomic_bool success_
atomic tracking of compress/decompress success
Definition CodecScheduler.h:117
virtual bool scheduleT1(ITileProcessor *proc)=0
Schedules all T1 tasks for a ITileProcessor.
CodecScheduler(uint16_t numComps)
Contructs a CodecScheduler.
Definition CodecScheduler.cpp:98
void run(void)
Runs tf::Executor.
Definition CodecScheduler.cpp:112
std::vector< t1::ICoder * > coders_
pool of ICoder
Definition CodecScheduler.h:128
bool wait(void)
Waits for tf::Executor to complete.
Definition CodecScheduler.cpp:117
virtual void release(void)=0
Releases Taskflow resources.
virtual ~CodecScheduler()
Destroys a CodecScheduler.
Definition CodecScheduler.cpp:100
tf::Future< void > runFuture_
tf::Future<void> resulting from running scheduler
Definition CodecScheduler.h:134
void releaseCoders(void)
Definition CodecScheduler.cpp:105
uint16_t numcomps_
number of components
Definition CodecScheduler.h:122
bool contains(uint16_t compno, uint8_t resolution) const
Definition CodecScheduler.cpp:81
std::vector< std::pair< uint8_t, uint8_t > > componentResolutions_
Definition CodecScheduler.h:39
ResolutionChecker(uint16_t numComponents, TileComponent *comps, bool cacheAll)
Definition CodecScheduler.cpp:68
std::pair< uint8_t, uint8_t > getResBounds(uint16_t compno)
Definition CodecScheduler.cpp:91
ResWindow.
Definition CompressedChunkCache.h:36
DifferentialInfo(void)
Construct a new Differential Info object.
Definition CodecScheduler.h:53
uint16_t layersDecompressed_
number of layers decompressed
Definition CodecScheduler.h:59
Interface for managing tile compression/decompression.
Definition ITileProcessor.h:37
Stores sub-sampled, unreduced tile component dimensions, along with reduction information.
Definition TileComponent.h:37