void weight_init(void) { double temp[64]; int i, z, x; #if USE_MMX_ASM const double dv_weight_bias_factor = (double)(1UL << DV_WEIGHT_BIAS); #endif W[0] = 1.0; W[1] = CS(4) / (4.0 * CS(7) * CS(2)); W[2] = CS(4) / (2.0 * CS(6)); W[3] = 1.0 / (2 * CS(5)); W[4] = 7.0 / 8.0; W[5] = CS(4) / CS(3); W[6] = CS(4) / CS(2); W[7] = CS(4) / CS(1); for (i=0;i<64;i++) temp[i] = 1.0; weight_88_inverse_float(temp); for (i=0;i<64;i++) { #if !USE_MMX_ASM dv_weight_inverse_88_matrix[i] = (dv_coeff_t)rint(temp[i]); #else /* If we're using MMX assembler, fold weights into the iDCT prescale */ preSC[i] *= temp[i] * (16.0 / dv_weight_bias_factor); #endif } for (z=0;z<4;z++) { for (x=0;x<8;x++) { dv_weight_inverse_248_matrix[z*8+x] = 1.0 / (W[x] * W[2*z] / 2); dv_weight_inverse_248_matrix[(z+4)*8+x] = 1.0 / (W[x] * W[2*z] / 2); } } dv_weight_inverse_248_matrix[0] = 4.0; }
void _dv_weight_init(void) { double temp[64]; double temp_postsc[64]; int i, z, x; #if ARCH_X86 || ARCH_X86_64 const double dv_weight_bias_factor = (double)(1UL << DV_WEIGHT_BIAS); #endif W[0] = 1.0; W[1] = CS(4) / (4.0 * CS(7) * CS(2)); W[2] = CS(4) / (2.0 * CS(6)); W[3] = 1.0 / (2 * CS(5)); W[4] = 7.0 / 8.0; W[5] = CS(4) / CS(3); W[6] = CS(4) / CS(2); W[7] = CS(4) / CS(1); for (i = 0; i < 64; i++) { temp[i] = 1.0; } weight_88_inverse_float(temp); for (i=0;i<64;i++) { #if (!ARCH_X86) && (!ARCH_X86_64) dv_weight_inverse_88_matrix[i] = (dv_coeff_t)rint(temp[i]); #else /* If we're using MMX assembler, fold weights into the iDCT prescale */ preSC[i] *= temp[i] * (16.0 / dv_weight_bias_factor); #endif } postscale88_init(temp_postsc); for (i = 0; i < 64; i++) { temp[i] = 1.0; } weight_88_float(temp); for (i=0;i<64;i++) { #if BRUTE_FORCE_DCT_88 dv_weight_88_matrix[i] = temp[i]; #else /* If we're not using brute force(tm), fold weights into the DCT postscale */ postSC88[i]= int_val(temp_postsc[i] * temp[i] * 32768.0 * 2.0); #endif } postSC88[63] = temp[63] * 32768 * 2.0; postscale248_init(temp_postsc); for (i = 0; i < 64; i++) { temp[i] = 1.0; } weight_248_float(temp); for (i=0;i<64;i++) { #if BRUTE_FORCE_DCT_248 dv_weight_248_matrix[i] = temp[i]; #else /* If we're not using brute force(tm), fold weights into the DCT postscale */ postSC248[i]= int_val(temp_postsc[i]* temp[i] * 32768.0 * 2.0); #endif } for (z=0;z<4;z++) { for (x=0;x<8;x++) { dv_weight_inverse_248_matrix[z*8+x] = 2.0 / (W[x] * W[2*z]); dv_weight_inverse_248_matrix[(z+4)*8+x] = 2.0 / (W[x] * W[2*z]); } } dv_weight_inverse_248_matrix[0] = 4.0; }