summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/dec_frame.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/dec_frame.h')
-rw-r--r--third_party/jpeg-xl/lib/jxl/dec_frame.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/dec_frame.h b/third_party/jpeg-xl/lib/jxl/dec_frame.h
index 09bdbc9675..663f1a8b33 100644
--- a/third_party/jpeg-xl/lib/jxl/dec_frame.h
+++ b/third_party/jpeg-xl/lib/jxl/dec_frame.h
@@ -242,14 +242,14 @@ class FrameDecoder {
private:
Status ProcessDCGlobal(BitReader* br);
Status ProcessDCGroup(size_t dc_group_id, BitReader* br);
- void FinalizeDC();
+ Status FinalizeDC();
Status AllocateOutput();
Status ProcessACGlobal(BitReader* br);
Status ProcessACGroup(size_t ac_group_id, BitReader* JXL_RESTRICT* br,
size_t num_passes, size_t thread, bool force_draw,
bool dc_only);
void MarkSections(const SectionInfo* sections, size_t num,
- SectionStatus* section_status);
+ const SectionStatus* section_status);
// Allocates storage for parallel decoding using up to `num_threads` threads
// of up to `num_tasks` tasks. The value of `thread` passed to
@@ -262,9 +262,10 @@ class FrameDecoder {
group_dec_caches_.resize(storage_size);
}
use_task_id_ = num_threads > num_tasks;
- bool use_group_ids = (modular_frame_decoder_.UsesFullImage() &&
- (frame_header_.encoding == FrameEncoding::kVarDCT ||
- (frame_header_.flags & FrameHeader::kNoise)));
+ bool use_noise = (frame_header_.flags & FrameHeader::kNoise) != 0;
+ bool use_group_ids =
+ (modular_frame_decoder_.UsesFullImage() &&
+ (frame_header_.encoding == FrameEncoding::kVarDCT || use_noise));
if (dec_state_->render_pipeline) {
JXL_RETURN_IF_ERROR(dec_state_->render_pipeline->PrepareForThreads(
storage_size, use_group_ids));
@@ -272,7 +273,7 @@ class FrameDecoder {
return true;
}
- size_t GetStorageLocation(size_t thread, size_t task) {
+ size_t GetStorageLocation(size_t thread, size_t task) const {
if (use_task_id_) return task;
return thread;
}
@@ -292,6 +293,11 @@ class FrameDecoder {
return stride;
}
+ bool HasDcGroupToDecode() const {
+ return std::any_of(decoded_dc_groups_.cbegin(), decoded_dc_groups_.cend(),
+ [](uint8_t ready) { return ready == 0; });
+ }
+
PassesDecoderState* dec_state_;
ThreadPool* pool_;
std::vector<TocEntry> toc_;