Skip to content

Commit

Permalink
Improve performance Operations::quantize_block
Browse files Browse the repository at this point in the history
Remove bound check and allow (partial) loop unrolling
  • Loading branch information
vstroebel committed Jul 30, 2024
1 parent fedf420 commit d6ee415
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ pub(crate) trait Operations {
#[inline(always)]
fn quantize_block(block: &[i16; 64], q_block: &mut [i16; 64], table: &QuantizationTable) {
for i in 0..64 {
let z = ZIGZAG[i] as usize;
let z = ZIGZAG[i] as usize & 0x3f;
q_block[i] = table.quantize(block[z], z);
}
}
Expand Down

0 comments on commit d6ee415

Please sign in to comment.