summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/modular/encoding
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /third_party/jpeg-xl/lib/jxl/modular/encoding
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/modular/encoding')
-rw-r--r--third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h4
-rw-r--r--third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc8
-rw-r--r--third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc12
3 files changed, 12 insertions, 12 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h b/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h
index 7bec5128fc..df54a9425e 100644
--- a/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h
+++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h
@@ -63,7 +63,7 @@ struct State {
pixel_type_w pred = 0; // *before* removing the added bits.
std::vector<uint32_t> pred_errors[kNumPredictors];
std::vector<int32_t> error;
- const Header header;
+ const Header &header;
// Allows to approximate division by a number from 1 to 64.
// for (int i = 0; i < 64; i++) divlookup[i] = (1 << 24) / (i + 1);
@@ -82,7 +82,7 @@ struct State {
return static_cast<uint64_t>(x) << kPredExtraBits;
}
- State(Header header, size_t xsize, size_t ysize) : header(header) {
+ State(const Header &header, size_t xsize, size_t ysize) : header(header) {
// Extra margin to avoid out-of-bounds writes.
// All have space for two rows of data.
for (auto &pred_error : pred_errors) {
diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc
index de629ad038..23100bba8b 100644
--- a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc
+++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc
@@ -197,7 +197,7 @@ void FindBestSplit(TreeSamples &tree_samples, float threshold,
float rcost = std::numeric_limits<float>::max();
Predictor lpred = Predictor::Zero;
Predictor rpred = Predictor::Zero;
- float Cost() { return lcost + rcost; }
+ float Cost() const { return lcost + rcost; }
};
SplitInfo best_split_static_constant;
@@ -242,14 +242,14 @@ void FindBestSplit(TreeSamples &tree_samples, float threshold,
// The multiplier ranges cut halfway through the current ranges of static
// properties. We do this even if the current node is not a leaf, to
// minimize the number of nodes in the resulting tree.
- for (size_t i = 0; i < mul_info.size(); i++) {
+ for (const auto &mmi : mul_info) {
uint32_t axis;
uint32_t val;
IntersectionType t =
- BoxIntersects(static_prop_range, mul_info[i].range, axis, val);
+ BoxIntersects(static_prop_range, mmi.range, axis, val);
if (t == IntersectionType::kNone) continue;
if (t == IntersectionType::kInside) {
- (*tree)[pos].multiplier = mul_info[i].multiplier;
+ (*tree)[pos].multiplier = mmi.multiplier;
break;
}
if (t == IntersectionType::kPartial) {
diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc b/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc
index bb690b74ba..7e7aa019e3 100644
--- a/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc
+++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc
@@ -113,7 +113,7 @@ FlatTree FilterTree(const Tree &global_tree,
}
}
- for (size_t j = 0; j < 2; j++) mark_property(flat.properties[j]);
+ for (int16_t property : flat.properties) mark_property(property);
mark_property(flat.property0);
output.push_back(flat);
}
@@ -159,9 +159,9 @@ Status DecodeModularChannelMAANS(BitReader *br, ANSSymbolReader *reader,
// From here on, tree lookup returns a *clustered* context ID.
// This avoids an extra memory lookup after tree traversal.
- for (size_t i = 0; i < tree.size(); i++) {
- if (tree[i].property0 == -1) {
- tree[i].childID = context_map[tree[i].childID];
+ for (auto &node : tree) {
+ if (node.property0 == -1) {
+ node.childID = context_map[node.childID];
}
}
@@ -538,8 +538,8 @@ Status ModularDecode(BitReader *br, Image &image, GroupHeader &header,
// Don't do/undo transforms if header is incomplete.
header.transforms.clear();
image.transform = header.transforms;
- for (size_t c = 0; c < image.channel.size(); c++) {
- ZeroFillImage(&image.channel[c].plane);
+ for (auto &ch : image.channel) {
+ ZeroFillImage(&ch.plane);
}
return Status(StatusCode::kNotEnoughBytes);
}