Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typos exterminatus (#3619) #52

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Install buildifier
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install buildifier
brew install buildifier typos-cli
- name: lint
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
Expand Down
2 changes: 1 addition & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ run_benchmark() {
"${TOOLS_DIR}/benchmark_xl" "${benchmark_args[@]}" | \
tee "${output_dir}/results.txt"

# Check error code for benckmark_xl command. This will exit if not.
# Check error code for benchmark_xl command. This will exit if not.
return ${PIPESTATUS[0]}
)
}
Expand Down
2 changes: 1 addition & 1 deletion doc/fuzzing.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ adding asserts:

* `JXL_DASSERT()` is only enabled in Debug builds, which includes all the ASan,
MSan and UBSan builds. Performance of these checks is not an issue if kept
within reasonable limits (automated msan/asan test should finish withing 1
within reasonable limits (automated msan/asan test should finish within 1
hour for example). Fuzzing is more effective when the given input runs
faster, so keep that in mind when adding a complex DASSERT that runs multiple
times per output pixel.
Expand Down
2 changes: 1 addition & 1 deletion lib/cms/jxl_cms_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static Status CreateICCLutAtoBTagForHDR(JxlColorEncoding c,

// Some software (Apple Safari, Preview) requires this.
static Status CreateICCNoOpBToATag(std::vector<uint8_t>* tags) {
WriteICCTag("mBA ", tags->size(), tags);
WriteICCTag("mBA ", tags->size(), tags); // notypo
// 4 reserved bytes set to 0
WriteICCUint32(0, tags->size(), tags);
// number of input channels
Expand Down
24 changes: 14 additions & 10 deletions lib/extras/butteraugli_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@ void AddEdge(Image3F* img, float d, size_t x0, size_t y0) {
TEST(ButteraugliInPlaceTest, SinglePixel) {
Image3F rgb0 = SinglePixelImage(0.5f, 0.5f, 0.5f);
Image3F rgb1 = SinglePixelImage(0.5f, 0.49f, 0.5f);
ButteraugliParams ba;
ButteraugliParams butteraugli_params;
ImageF diffmap;
double diffval;
EXPECT_TRUE(ButteraugliInterface(rgb0, rgb1, ba, diffmap, diffval));
EXPECT_TRUE(
ButteraugliInterface(rgb0, rgb1, butteraugli_params, diffmap, diffval));
EXPECT_NEAR(diffval, 2.5, 0.5);
ImageF diffmap2;
double diffval2;
EXPECT_TRUE(ButteraugliInterfaceInPlace(std::move(rgb0), std::move(rgb1), ba,
diffmap2, diffval2));
EXPECT_TRUE(ButteraugliInterfaceInPlace(std::move(rgb0), std::move(rgb1),
butteraugli_params, diffmap2,
diffval2));
EXPECT_NEAR(diffval, diffval2, 1e-10);
}

Expand All @@ -91,18 +93,20 @@ TEST(ButteraugliInPlaceTest, LargeImage) {
CopyImageTo(rgb0, &rgb1);
AddUniformNoise(&rgb1, 0.02f, 7777);
AddEdge(&rgb1, 0.1f, xsize / 2, xsize / 2);
ButteraugliParams ba;
ButteraugliParams butteraugli_params;
ImageF diffmap;
double diffval;
EXPECT_TRUE(ButteraugliInterface(rgb0, rgb1, ba, diffmap, diffval));
double distp = ComputeDistanceP(diffmap, ba, 3.0);
EXPECT_TRUE(
ButteraugliInterface(rgb0, rgb1, butteraugli_params, diffmap, diffval));
double distp = ComputeDistanceP(diffmap, butteraugli_params, 3.0);
EXPECT_NEAR(diffval, 4.0, 0.5);
EXPECT_NEAR(distp, 1.5, 0.5);
ImageF diffmap2;
double diffval2;
EXPECT_TRUE(ButteraugliInterfaceInPlace(std::move(rgb0), std::move(rgb1), ba,
diffmap2, diffval2));
double distp2 = ComputeDistanceP(diffmap2, ba, 3.0);
EXPECT_TRUE(ButteraugliInterfaceInPlace(std::move(rgb0), std::move(rgb1),
butteraugli_params, diffmap2,
diffval2));
double distp2 = ComputeDistanceP(diffmap2, butteraugli_params, 3.0);
EXPECT_NEAR(diffval, diffval2, 5e-7);
EXPECT_NEAR(distp, distp2, 1e-7);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/extras/convolve-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Neighbors {
inline const int32_t* MirrorLanes(const size_t mod) {
const HWY_CAPPED(float, 16) d;
constexpr size_t kN = MaxLanes(d);

// typo:off
// For mod = `image width mod 16` 0..15:
// last full vec mirrored (mem order) loadedVec mirrorVec idxVec
// 0123456789abcdef| fedcba9876543210 fed..210 012..def 012..def
Expand All @@ -143,6 +143,7 @@ inline const int32_t* MirrorLanes(const size_t mod) {
// 0123456789abcdef|0123456789ABC CBA
// 0123456789abcdef|0123456789ABCD DC
// 0123456789abcdef|0123456789ABCDE E EDC..10f EED..210 ffe..321
// typo:on
#if HWY_CAP_GE512
HWY_ALIGN static constexpr int32_t idx_lanes[2 * kN - 1] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, //
Expand Down
2 changes: 1 addition & 1 deletion lib/extras/dec/gif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Status DecodeImageGIF(Span<const uint8_t> bytes, const ColorHints& color_hints,

if (gif->ImageCount > 1) {
ppf->info.have_animation = JXL_TRUE;
// Delays in GIF are specified in 100ths of a second.
// Delays in GIF are specified in censiseconds.
ppf->info.animation.tps_numerator = 100;
ppf->info.animation.tps_denominator = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/extras/time.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ double Now() {
if (timebase.denom == 0) {
(void)mach_timebase_info(&timebase);
}
return double(t) * timebase.numer / timebase.denom * 1E-9;
return double(t) * timebase.numer / timebase.denom * 1E-9; // notypo
#elif JXL_OS_HAIKU
return double(system_time_nsecs()) * 1E-9;
#else
Expand Down
8 changes: 4 additions & 4 deletions lib/jpegli/adaptive_quantization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,11 @@ void ComputePreErosion(const RowBuffer<float>& input, const size_t xsize,
}
if (iy % 4 == 3) {
size_t y_out = y0_out + iy / 4;
float* row_dout = pre_erosion->Row(y_out);
float* row_d_out = pre_erosion->Row(y_out);
for (size_t x = 0; x < xsize_out; x++) {
row_dout[x] = (row_out[x * 4] + row_out[x * 4 + 1] +
row_out[x * 4 + 2] + row_out[x * 4 + 3]) *
0.25f;
row_d_out[x] = (row_out[x * 4] + row_out[x * 4 + 1] +
row_out[x * 4 + 2] + row_out[x * 4 + 3]) *
0.25f;
}
pre_erosion->PadRow(y_out, xsize_out, border);
}
Expand Down
30 changes: 15 additions & 15 deletions lib/jpegli/dct-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ using D = HWY_FULL(float);
using DI = HWY_FULL(int32_t);

template <size_t N>
void AddReverse(const float* JXL_RESTRICT ain1, const float* JXL_RESTRICT ain2,
float* JXL_RESTRICT aout) {
void AddReverse(const float* JXL_RESTRICT a_in1,
const float* JXL_RESTRICT a_in2, float* JXL_RESTRICT a_out) {
HWY_CAPPED(float, 8) d8;
for (size_t i = 0; i < N; i++) {
auto in1 = Load(d8, ain1 + i * 8);
auto in2 = Load(d8, ain2 + (N - i - 1) * 8);
Store(Add(in1, in2), d8, aout + i * 8);
auto in1 = Load(d8, a_in1 + i * 8);
auto in2 = Load(d8, a_in2 + (N - i - 1) * 8);
Store(Add(in1, in2), d8, a_out + i * 8);
}
}

template <size_t N>
void SubReverse(const float* JXL_RESTRICT ain1, const float* JXL_RESTRICT ain2,
float* JXL_RESTRICT aout) {
void SubReverse(const float* JXL_RESTRICT a_in1,
const float* JXL_RESTRICT a_in2, float* JXL_RESTRICT a_out) {
HWY_CAPPED(float, 8) d8;
for (size_t i = 0; i < N; i++) {
auto in1 = Load(d8, ain1 + i * 8);
auto in2 = Load(d8, ain2 + (N - i - 1) * 8);
Store(Sub(in1, in2), d8, aout + i * 8);
auto in1 = Load(d8, a_in1 + i * 8);
auto in2 = Load(d8, a_in2 + (N - i - 1) * 8);
Store(Sub(in1, in2), d8, a_out + i * 8);
}
}

Expand All @@ -74,15 +74,15 @@ void B(float* JXL_RESTRICT coeff) {

// Ideally optimized away by compiler (except the multiply).
template <size_t N>
void InverseEvenOdd(const float* JXL_RESTRICT ain, float* JXL_RESTRICT aout) {
void InverseEvenOdd(const float* JXL_RESTRICT a_in, float* JXL_RESTRICT a_out) {
HWY_CAPPED(float, 8) d8;
for (size_t i = 0; i < N / 2; i++) {
auto in1 = Load(d8, ain + i * 8);
Store(in1, d8, aout + 2 * i * 8);
auto in1 = Load(d8, a_in + i * 8);
Store(in1, d8, a_out + 2 * i * 8);
}
for (size_t i = N / 2; i < N; i++) {
auto in1 = Load(d8, ain + i * 8);
Store(in1, d8, aout + (2 * (i - N / 2) + 1) * 8);
auto in1 = Load(d8, a_in + i * 8);
Store(in1, d8, a_out + (2 * (i - N / 2) + 1) * 8);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/jpegli/decode_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct jpeg_decomp_master {
int h_factor[jpegli::kMaxComponents];
int v_factor[jpegli::kMaxComponents];

// Initialized at strat of frame.
// Initialized at start of frame.
uint16_t scan_progression_[jpegli::kMaxComponents][DCTSIZE2];

//
Expand Down
9 changes: 5 additions & 4 deletions lib/jpegli/downsample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,14 @@ void DownsampleInputBuffer(j_compress_ptr cinfo) {
}
auto& input = *m->smooth_input[c];
auto& output = *m->raw_data[c];
const size_t yout0 = y0 / v_factor;
const size_t y_out0 = y0 / v_factor;
float* rows_in[MAX_SAMP_FACTOR];
for (size_t yin = y0, yout = yout0; yin < y1; yin += v_factor, ++yout) {
for (size_t y_in = y0, y_out = y_out0; y_in < y1;
y_in += v_factor, ++y_out) {
for (int iy = 0; iy < v_factor; ++iy) {
rows_in[iy] = input.Row(yin + iy);
rows_in[iy] = input.Row(y_in + iy);
}
float* row_out = output.Row(yout);
float* row_out = output.Row(y_out);
(*m->downsample_method[c])(rows_in, xsize_padded, row_out);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/jpegli/encode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,9 @@ void ZigZagShuffleBlocks(j_compress_ptr cinfo) {
for (int c = 0; c < cinfo->num_components; ++c) {
jpeg_component_info* comp = &cinfo->comp_info[c];
for (JDIMENSION by = 0; by < comp->height_in_blocks; ++by) {
JBLOCKARRAY ba = GetBlockRow(cinfo, c, by);
JBLOCKARRAY blocks = GetBlockRow(cinfo, c, by);
for (JDIMENSION bx = 0; bx < comp->width_in_blocks; ++bx) {
JCOEF* block = &ba[0][bx][0];
JCOEF* block = &blocks[0][bx][0];
for (int k = 0; k < DCTSIZE2; ++k) {
tmp[k] = block[kJPEGNaturalOrder[k]];
}
Expand Down
10 changes: 5 additions & 5 deletions lib/jpegli/encode_finish.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ float ComputePSNR(j_compress_ptr cinfo, int sampling) {
HWY_ALIGN float iqmc[64];
ComputeInverseWeights(qmc, iqmc);
for (JDIMENSION by = 0; by < comp->height_in_blocks; by += sampling) {
JBLOCKARRAY ba = GetBlockRow(cinfo, c, by);
JBLOCKARRAY blocks = GetBlockRow(cinfo, c, by);
const float* qf = m->quant_field.Row(by * v_factor);
for (JDIMENSION bx = 0; bx < comp->width_in_blocks; bx += sampling) {
error += BlockError(&ba[0][bx][0], qmc, iqmc, qf[bx * h_factor],
error += BlockError(&blocks[0][bx][0], qmc, iqmc, qf[bx * h_factor],
zero_bias_offset, zero_bias_mul);
num += DCTSIZE2;
}
Expand All @@ -123,11 +123,11 @@ void ReQuantizeCoeffs(j_compress_ptr cinfo) {
const float* zero_bias_offset = m->zero_bias_offset[c];
const float* zero_bias_mul = m->zero_bias_mul[c];
for (JDIMENSION by = 0; by < comp->height_in_blocks; ++by) {
JBLOCKARRAY ba = GetBlockRow(cinfo, c, by);
JBLOCKARRAY block = GetBlockRow(cinfo, c, by);
const float* qf = m->quant_field.Row(by * v_factor);
for (JDIMENSION bx = 0; bx < comp->width_in_blocks; ++bx) {
ReQuantizeBlock(&ba[0][bx][0], qmc, qf[bx * h_factor], zero_bias_offset,
zero_bias_mul);
ReQuantizeBlock(&block[0][bx][0], qmc, qf[bx * h_factor],
zero_bias_offset, zero_bias_mul);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/jpegli/encode_streaming.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ void ProcessiMCURow(j_compress_ptr cinfo) {
int32_t* nonzero_idx = m->block_tmp + 3 * DCTSIZE2;
coeff_t* JXL_RESTRICT last_dc_coeff = m->last_dc_coeff;
bool adaptive_quant = m->use_adaptive_quantization && m->psnr_target == 0;
JBLOCKARRAY ba[kMaxComponents];
JBLOCKARRAY blocks[kMaxComponents];
if (kMode == kStreamingModeCoefficients) {
for (int c = 0; c < cinfo->num_components; ++c) {
jpeg_component_info* comp = &cinfo->comp_info[c];
int by0 = mcu_y * comp->v_samp_factor;
int block_rows_left = comp->height_in_blocks - by0;
int max_block_rows = std::min(comp->v_samp_factor, block_rows_left);
ba[c] = (*cinfo->mem->access_virt_barray)(
blocks[c] = (*cinfo->mem->access_virt_barray)(
reinterpret_cast<j_common_ptr>(cinfo), m->coeff_buffers[c], by0,
max_block_rows, true);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ void ProcessiMCURow(j_compress_ptr cinfo) {
aq_strength, zero_bias_offset, zero_bias_mul,
m->dct_buffer, block);
if (kMode == kStreamingModeCoefficients) {
JCOEF* cblock = &ba[c][iy][bx][0];
JCOEF* cblock = &blocks[c][iy][bx][0];
for (int k = 0; k < DCTSIZE2; ++k) {
cblock[k] = block[kJPEGNaturalOrder[k]];
}
Expand Down
14 changes: 7 additions & 7 deletions lib/jpegli/entropy_coding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void TokenizeACProgressiveScan(j_compress_ptr cinfo, int scan_index,
eob_run = 0;
};
for (JDIMENSION by = 0; by < comp->height_in_blocks; ++by) {
JBLOCKARRAY ba = (*cinfo->mem->access_virt_barray)(
JBLOCKARRAY blocks = (*cinfo->mem->access_virt_barray)(
reinterpret_cast<j_common_ptr>(cinfo), m->coeff_buffers[comp_idx], by,
1, FALSE);
// Each coefficient can appear in at most one token, but we have to reserve
Expand All @@ -133,7 +133,7 @@ void TokenizeACProgressiveScan(j_compress_ptr cinfo, int scan_index,
sti->restarts[restart_idx++] = m->total_num_tokens + ta->num_tokens;
restarts_to_go = restart_interval;
}
const coeff_t* block = &ba[0][bx][0];
const coeff_t* block = &blocks[0][bx][0];
coeff_t temp2;
coeff_t temp;
int r = 0;
Expand Down Expand Up @@ -214,7 +214,7 @@ void TokenizeACRefinementScan(j_compress_ptr cinfo, int scan_index,
uint16_t* next_eobrun = sti->eobruns;
size_t restart_idx = 0;
for (JDIMENSION by = 0; by < comp->height_in_blocks; ++by) {
JBLOCKARRAY ba = (*cinfo->mem->access_virt_barray)(
JBLOCKARRAY blocks = (*cinfo->mem->access_virt_barray)(
reinterpret_cast<j_common_ptr>(cinfo), m->coeff_buffers[comp_idx], by,
1, FALSE);
for (JDIMENSION bx = 0; bx < comp->width_in_blocks; ++bx) {
Expand All @@ -224,7 +224,7 @@ void TokenizeACRefinementScan(j_compress_ptr cinfo, int scan_index,
next_eob_token = next_token;
eob_run = eob_refbits = 0;
}
const coeff_t* block = &ba[0][bx][0];
const coeff_t* block = &blocks[0][bx][0];
int num_eob_refinement_bits = 0;
int num_refinement_bits = 0;
int num_nzeros = 0;
Expand Down Expand Up @@ -348,7 +348,7 @@ void TokenizeScan(j_compress_ptr cinfo, size_t scan_index, int ac_ctx_offset,
}
}

JBLOCKARRAY ba[MAX_COMPS_IN_SCAN];
JBLOCKARRAY blocks[MAX_COMPS_IN_SCAN];
size_t block_idx = 0;
for (size_t mcu_y = 0; mcu_y < sti->MCU_rows_in_scan; ++mcu_y) {
for (int i = 0; i < scan_info->comps_in_scan; ++i) {
Expand All @@ -358,7 +358,7 @@ void TokenizeScan(j_compress_ptr cinfo, size_t scan_index, int ac_ctx_offset,
int by0 = mcu_y * n_blocks_y;
int block_rows_left = comp->height_in_blocks - by0;
int max_block_rows = std::min(n_blocks_y, block_rows_left);
ba[i] = (*cinfo->mem->access_virt_barray)(
blocks[i] = (*cinfo->mem->access_virt_barray)(
reinterpret_cast<j_common_ptr>(cinfo), m->coeff_buffers[comp_idx],
by0, max_block_rows, FALSE);
}
Expand Down Expand Up @@ -401,7 +401,7 @@ void TokenizeScan(j_compress_ptr cinfo, size_t scan_index, int ac_ctx_offset,
block_y >= comp->height_in_blocks) {
block = kSinkBlock;
} else {
block = &ba[i][iy][block_x][0];
block = &blocks[i][iy][block_x][0];
}
if (!is_progressive) {
HWY_DYNAMIC_DISPATCH(ComputeTokensSequential)
Expand Down
2 changes: 1 addition & 1 deletion lib/jpegli/error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const char* const kErrorMessageTable[] = {
bool FormatString(char* buffer, const char* format, ...) {
va_list args;
va_start(args, format);
vsnprintf(buffer, JMSG_STR_PARM_MAX, format, args);
vsnprintf(buffer, JMSG_STR_PARM_MAX, format, args); // notypo
va_end(args);
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/jpegli/error_handling_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ TEST(DecoderErrorHandlingTest, InvalidDQT) {
compressed[kDQTOffset + 3] += diff;
EXPECT_FALSE(ParseCompressed(compressed));
}
// inavlid table index / precision
// invalid table index / precision
for (int val : {0x20, 0x05}) {
std::vector<uint8_t> compressed(kCompressed0, kCompressed0 + kLen0);
compressed[kDQTOffset + 4] = val;
Expand Down Expand Up @@ -1243,7 +1243,7 @@ TEST(DecoderErrorHandlingTest, InvalidDHT) {
compressed[kDHTOffset + 2] += 17;
EXPECT_FALSE(ParseCompressed(compressed));
}
// inavlid table slot_id
// invalid table slot_id
for (int val : {0x05, 0x15, 0x20}) {
std::vector<uint8_t> compressed(kCompressed0, kCompressed0 + kLen0);
compressed[kDHTOffset + 4] = val;
Expand Down
12 changes: 6 additions & 6 deletions lib/jpegli/idct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ void DequantBlock(const int16_t* JXL_RESTRICT qblock,
}

template <size_t N>
void ForwardEvenOdd(const float* JXL_RESTRICT ain, size_t ain_stride,
float* JXL_RESTRICT aout) {
void ForwardEvenOdd(const float* JXL_RESTRICT a_in, size_t a_in_stride,
float* JXL_RESTRICT a_out) {
for (size_t i = 0; i < N / 2; i++) {
auto in1 = LoadU(d8, ain + 2 * i * ain_stride);
Store(in1, d8, aout + i * 8);
auto in1 = LoadU(d8, a_in + 2 * i * a_in_stride);
Store(in1, d8, a_out + i * 8);
}
for (size_t i = N / 2; i < N; i++) {
auto in1 = LoadU(d8, ain + (2 * (i - N / 2) + 1) * ain_stride);
Store(in1, d8, aout + i * 8);
auto in1 = LoadU(d8, a_in + (2 * (i - N / 2) + 1) * a_in_stride);
Store(in1, d8, a_out + i * 8);
}
}

Expand Down
Loading
Loading