Grok 20.3.2
SchedulerFreebyrd.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 <cstdint>
21#include <atomic>
22#include <memory>
23#include <vector>
24#include <functional>
25#include <cstdlib>
26#include <string>
27
28#include "StripDecompressor.h"
29
30namespace grk
31{
32
33struct ITileProcessor;
34
35namespace t1
36{
38}
39
48{
49public:
50 SchedulerFreebyrd(uint16_t numcomps, uint8_t prec);
52
53 // check for strip-based decompression mode via GRK_STRIP env var
54 static bool isStripMode()
55 {
56 const char* env = std::getenv("GRK_STRIP");
57 return env && std::string(env) == "1";
58 }
59
63 bool decompressTile(ITileProcessor* tileProcessor);
64
65 // set per-component strip output callback for streaming mode
66 // callback receives: (compno, row0, numRows, rowData, rowStride)
67 using CompStripCallback = std::function<void(uint16_t compno, uint32_t row0, uint32_t numRows,
68 const void* rowData, uint32_t rowStride)>;
70 {
71 stripOutputCallback_ = std::move(cb);
72 }
73 bool hasStripOutput() const
74 {
75 return !!stripOutputCallback_;
76 }
77
78 void release();
79
80private:
81 bool decodeBlocks(ITileProcessor* tileProcessor);
82 bool runDWT(ITileProcessor* tileProcessor);
83 bool runCascadeDWT97(ITileProcessor* tileProcessor, uint16_t compno);
84 bool runSeparateDWT53(ITileProcessor* tileProcessor, uint16_t compno);
85 bool runSeparateDWT16(ITileProcessor* tileProcessor, uint16_t compno);
86 bool postProcess(ITileProcessor* tileProcessor);
87
88 uint16_t numcomps_;
89 uint8_t prec_;
90 std::atomic_bool success_;
91
92 // Block list per component, per resolution
93 using BlockList = std::vector<std::shared_ptr<t1::DecompressBlockExec>>;
94 std::vector<std::vector<BlockList>> blocksByComp_; // [compno][resIdx] → blocks
95
97};
98
99} // namespace grk
void release()
Definition SchedulerFreebyrd.cpp:37
~SchedulerFreebyrd()
Definition SchedulerFreebyrd.cpp:32
bool decodeBlocks(ITileProcessor *tileProcessor)
Definition SchedulerFreebyrd.cpp:49
void setStripOutputCallback(CompStripCallback cb)
Definition SchedulerFreebyrd.h:69
std::vector< std::shared_ptr< t1::DecompressBlockExec > > BlockList
Definition SchedulerFreebyrd.h:93
uint16_t numcomps_
Definition SchedulerFreebyrd.h:88
SchedulerFreebyrd(uint16_t numcomps, uint8_t prec)
Definition SchedulerFreebyrd.cpp:28
uint8_t prec_
Definition SchedulerFreebyrd.h:89
bool runSeparateDWT16(ITileProcessor *tileProcessor, uint16_t compno)
Definition SchedulerFreebyrd.cpp:71
bool runCascadeDWT97(ITileProcessor *tileProcessor, uint16_t compno)
Definition SchedulerFreebyrd.cpp:59
bool postProcess(ITileProcessor *tileProcessor)
Definition SchedulerFreebyrd.cpp:77
bool runSeparateDWT53(ITileProcessor *tileProcessor, uint16_t compno)
Definition SchedulerFreebyrd.cpp:65
bool decompressTile(ITileProcessor *tileProcessor)
Stub — always returns false (freebyrd removed).
Definition SchedulerFreebyrd.cpp:42
bool runDWT(ITileProcessor *tileProcessor)
Definition SchedulerFreebyrd.cpp:54
static bool isStripMode()
Definition SchedulerFreebyrd.h:54
CompStripCallback stripOutputCallback_
Definition SchedulerFreebyrd.h:96
bool hasStripOutput() const
Definition SchedulerFreebyrd.h:73
std::atomic_bool success_
Definition SchedulerFreebyrd.h:90
std::function< void(uint16_t compno, uint32_t row0, uint32_t numRows, const void *rowData, uint32_t rowStride)> CompStripCallback
Definition SchedulerFreebyrd.h:67
std::vector< std::vector< BlockList > > blocksByComp_
Definition SchedulerFreebyrd.h:94
Definition SchedulerFreebyrd.h:36
ResWindow.
Definition CompressedChunkCache.h:36
Interface for managing tile compression/decompression.
Definition ITileProcessor.h:37
Definition BlockExec.h:64