Skip to content

Commit 70f27fa

Browse files
author
Grok Compression
committed
IOpenable: add close method to interface
1 parent 795009a commit 70f27fa

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/lib/core/scheduling/excalibur/DecompressSchedulerExcalibur.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ bool DecompressSchedulerExcalibur::scheduleT1(ITileProcessor* tileProcessor)
148148
continue;
149149

150150
auto cblk = precinct->getDecompressBlock(cblkno);
151-
auto block = new t1::DecompressBlockExec(cacheAll);
151+
auto block = std::make_shared<t1::DecompressBlockExec>(cacheAll);
152152
block->x = cblk->x0();
153153
block->y = cblk->y0();
154154
// block->postProcessor_ =

src/lib/core/scheduling/excalibur/IOpenable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct IOpenable
2424
{
2525
virtual ~IOpenable() = default;
2626
virtual void open() = 0;
27+
virtual void close() = 0;
2728
};
2829

2930
} // namespace exc

src/lib/core/t1/BlockExec.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ struct DecompressBlockExec : public BlockExec
7676
if(open_)
7777
open_();
7878
}
79+
void close(void) override
80+
{
81+
delete cachedCoder_;
82+
cachedCoder_ = nullptr;
83+
if(cblk)
84+
cblk->release();
85+
}
7986
bool open(ICoder* coder) override
8087
{
8188
auto activeCoder = cachedCoder_ ? cachedCoder_ : coder;
@@ -120,18 +127,17 @@ struct DecompressBlockExec : public BlockExec
120127
};
121128
struct CompressBlockExec : public BlockExec
122129
{
123-
using IOpenable::open;
124-
125130
CompressBlockExec() = default;
126131
~CompressBlockExec() override = default;
127132

128133
void open(void) override {}
134+
void close(void) override {}
129135

130136
bool open(ICoder* coder) override
131137
{
132138
return coder->compress(this);
133139
}
134-
void close(void) {}
140+
135141
CodeblockCompress* cblk = nullptr;
136142
uint32_t tile_width = 0;
137143
bool doRateControl = false;

0 commit comments

Comments
 (0)