Skip to content

Commit 39d9e35

Browse files
committed
Added Loseless mode, fix SRGB eotf, fix alpha encoding, fix 100% quality
1 parent 4ecca92 commit 39d9e35

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

avif-coder/src/main/cpp/algo/fast_math-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Exp2f(const DF df, V x) {
8989
}
9090

9191
template<class D, HWY_IF_U16_D(D)>
92-
HWY_INLINE Vec<D> DivBy255(D d, Vec<D> x) {
92+
HWY_FAST_MATH_INLINE Vec<D> DivBy255(D d, Vec<D> x) {
9393
const auto rounding = Set(d, 1 << 7);
9494
x = Add(x, rounding);
9595
const auto multiplier = Set(d, 0x8080);

avif-coder/src/main/cpp/imagebits/RGBAlpha.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ RearrangeVecAlpha(Vec<FixedTag<uint16_t, 8>> vec, Vec<FixedTag<uint16_t, 8>> alp
7474
void UnpremultiplyRGBA_HWY(const uint8_t *src, int srcStride,
7575
uint8_t *dst, int dstStride, int width,
7676
int height) {
77-
concurrency::parallel_for(2, height, [&](int y) {
77+
for (uint32_t y = 0; y < height; ++y) {
7878
const FixedTag<uint8_t, 16> du8x16;
7979
const FixedTag<uint16_t, 8> du16x8;
8080
const FixedTag<uint8_t, 8> du8x8;
@@ -147,7 +147,7 @@ void UnpremultiplyRGBA_HWY(const uint8_t *src, int srcStride,
147147
mSrc += 4;
148148
mDst += 4;
149149
}
150-
});
150+
}
151151
}
152152

153153
void PremultiplyRGBA_HWY(const uint8_t *src, int srcStride,

avif-coder/src/main/cpp/imagebits/Rgb1010102.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ Rgba8ToRGBA1010102HWYRow(const uint8_t *HWY_RESTRICT data, uint32_t *HWY_RESTRIC
310310

311311
if (attenuateAlpha) {
312312
r = (static_cast<uint16_t>(r) * static_cast<uint16_t>(alpha)) / static_cast<uint16_t >(255);
313-
g = (static_cast<uint16_t>(r) * static_cast<uint16_t>(alpha)) / static_cast<uint16_t >(255);
314-
b = (static_cast<uint16_t>(r) * static_cast<uint16_t>(alpha)) / static_cast<uint16_t >(255);
313+
g = (static_cast<uint16_t>(g) * static_cast<uint16_t>(alpha)) / static_cast<uint16_t >(255);
314+
b = (static_cast<uint16_t>(b) * static_cast<uint16_t>(alpha)) / static_cast<uint16_t >(255);
315315
}
316316

317317
auto A16 = ((uint32_t) alpha * 3 + 127) >> 8;

0 commit comments

Comments
 (0)