libjpeg-turbo-rs 0.3.0

Pure Rust reimplementation of libjpeg-turbo with NEON/AVX2 SIMD acceleration
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::common::quant_table::{QuantTable, NATURAL_ORDER};

/// Dequantize a block of DCT coefficients.
///
/// Input: 64 coefficients in zigzag order (as decoded from entropy data).
/// Output: 64 coefficients in natural (row-major) order, multiplied by
/// quantization table values.
pub fn dequantize_block(zigzag_coeffs: &[i16; 64], table: &QuantTable) -> [i16; 64] {
    let mut natural = [0i16; 64];
    let mut i = 0;
    while i < 64 {
        let zz = NATURAL_ORDER[i];
        natural[i] = zigzag_coeffs[zz] * table.values[i] as i16;
        i += 1;
    }
    natural
}