iOS/buildlibs/armv7/allegro-4.4.2/addons/jpgalleg/src/encode.c
/* apply_fdct:
 *  Applies the forward discrete cosine transform to the given input block,
 *  in the form of a vector of 64 coefficients.
 *  This uses integer fixed point math and is based on code by the IJG.
 */
Applies the forward discrete cosine transform to the given input block,
in the form of a vector of 64 coefficients.
This uses integer fixed point math and is based on code by the IJG.
Applies the forward discrete cosine transform to the given input block in the form of a vector of 64 coefficients . This uses integer fixed point math and is based on code by the IJG .
static void
apply_fdct(short *data)
{
	int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
	int tmp10, tmp11, tmp12, tmp13;
	int z1, z2, z3, z4, z5;
	short *dataptr = data;
	int i;
	for (i = 8; i; i--) {
		tmp0 = dataptr[0] + dataptr[7];
		tmp7 = dataptr[0] - dataptr[7];
		tmp1 = dataptr[1] + dataptr[6];
		tmp6 = dataptr[1] - dataptr[6];
		tmp2 = dataptr[2] + dataptr[5];
		tmp5 = dataptr[2] - dataptr[5];
		tmp3 = dataptr[3] + dataptr[4];
		tmp4 = dataptr[3] - dataptr[4];
		tmp10 = tmp0 + tmp3;
		tmp13 = tmp0 - tmp3;
		tmp11 = tmp1 + tmp2;
		tmp12 = tmp1 - tmp2;
		dataptr[0] = (tmp10 + tmp11) << 2;
		dataptr[4] = (tmp10 - tmp11) << 2;
		z1 = (tmp12 + tmp13) * FIX_0_541196100;
		dataptr[2] = (z1 + (tmp13 * FIX_0_765366865)) >> 11;
		dataptr[6] = (z1 + (tmp12 * -FIX_1_847759065)) >> 11;
		z1 = tmp4 + tmp7;
		z2 = tmp5 + tmp6;
		z3 = tmp4 + tmp6;
		z4 = tmp5 + tmp7;
		z5 = (z3 + z4) * FIX_1_175875602;
		tmp4 *= FIX_0_298631336;
		tmp5 *= FIX_2_053119869;
		tmp6 *= FIX_3_072711026;
		tmp7 *= FIX_1_501321110;
		z1 *= -FIX_0_899976223;
		z2 *= -FIX_2_562915447;
		z3 *= -FIX_1_961570560;
		z4 *= -FIX_0_390180644;
		z3 += z5;
		z4 += z5;
		dataptr[7] = (tmp4 + z1 + z3) >> 11;
		dataptr[5] = (tmp5 + z2 + z4) >> 11;
		dataptr[3] = (tmp6 + z2 + z3) >> 11;
		dataptr[1] = (tmp7 + z1 + z4) >> 11;
		dataptr += 8;
	}
	dataptr = data;
	for (i = 8; i; i--) {
		tmp0 = dataptr[0] + dataptr[56];
		tmp7 = dataptr[0] - dataptr[56];
		tmp1 = dataptr[8] + dataptr[48];
		tmp6 = dataptr[8] - dataptr[48];
		tmp2 = dataptr[16] + dataptr[40];
		tmp5 = dataptr[16] - dataptr[40];
		tmp3 = dataptr[24] + dataptr[32];
		tmp4 = dataptr[24] - dataptr[32];
		tmp10 = tmp0 + tmp3;
		tmp13 = tmp0 - tmp3;
		tmp11 = tmp1 + tmp2;
		tmp12 = tmp1 - tmp2;
		dataptr[0] = (tmp10 + tmp11) >> 2;
		dataptr[32] = (tmp10 - tmp11) >> 2;
		z1 = (tmp12 + tmp13) * FIX_0_541196100;
		dataptr[16] = (z1 + (tmp13 * FIX_0_765366865)) >> 15;
		dataptr[48] = (z1 + (tmp12 * -FIX_1_847759065)) >> 15;
		z1 = tmp4 + tmp7;
		z2 = tmp5 + tmp6;
		z3 = tmp4 + tmp6;
		z4 = tmp5 + tmp7;
		z5 = (z3 + z4) * FIX_1_175875602;
		tmp4 *= FIX_0_298631336;
		tmp5 *= FIX_2_053119869;
		tmp6 *= FIX_3_072711026;
		tmp7 *= FIX_1_501321110;
		z1 *= -FIX_0_899976223;
		z2 *= -FIX_2_562915447;
		z3 *= -FIX_1_961570560;
		z4 *= -FIX_0_390180644;
		z3 += z5;
		z4 += z5;
		dataptr[56] = (tmp4 + z1 + z3) >> 15;
		dataptr[40] = (tmp5 + z2 + z4) >> 15;
		dataptr[24] = (tmp6 + z2 + z3) >> 15;
		dataptr[8] = (tmp7 + z1 + z4) >> 15;
		dataptr++;
	}
}
static void apply_fdct ( short * data ) { int tmp0 , tmp1 , tmp2 , tmp3 , tmp4 , tmp5 , tmp6 , tmp7 ; int tmp10 , tmp11 , tmp12 , tmp13 ; int z1 , z2 , z3 , z4 , z5 ; short * dataptr = data ; int i ; for ( i = 8 ; i ; i -- ) { tmp0 = dataptr [ 0 ] + dataptr [ 7 ] ; tmp7 = dataptr [ 0 ] - dataptr [ 7 ] ; tmp1 = dataptr [ 1 ] + dataptr [ 6 ] ; tmp6 = dataptr [ 1 ] - dataptr [ 6 ] ; tmp2 = dataptr [ 2 ] + dataptr [ 5 ] ; tmp5 = dataptr [ 2 ] - dataptr [ 5 ] ; tmp3 = dataptr [ 3 ] + dataptr [ 4 ] ; tmp4 = dataptr [ 3 ] - dataptr [ 4 ] ; tmp10 = tmp0 + tmp3 ; tmp13 = tmp0 - tmp3 ; tmp11 = tmp1 + tmp2 ; tmp12 = tmp1 - tmp2 ; dataptr [ 0 ] = ( tmp10 + tmp11 ) << 2 ; dataptr [ 4 ] = ( tmp10 - tmp11 ) << 2 ; z1 = ( tmp12 + tmp13 ) * FIX_0_541196100 ; dataptr [ 2 ] = ( z1 + ( tmp13 * FIX_0_765366865 ) ) >> 11 ; dataptr [ 6 ] = ( z1 + ( tmp12 * - FIX_1_847759065 ) ) >> 11 ; z1 = tmp4 + tmp7 ; z2 = tmp5 + tmp6 ; z3 = tmp4 + tmp6 ; z4 = tmp5 + tmp7 ; z5 = ( z3 + z4 ) * FIX_1_175875602 ; tmp4 *= FIX_0_298631336 ; tmp5 *= FIX_2_053119869 ; tmp6 *= FIX_3_072711026 ; tmp7 *= FIX_1_501321110 ; z1 *= - FIX_0_899976223 ; z2 *= - FIX_2_562915447 ; z3 *= - FIX_1_961570560 ; z4 *= - FIX_0_390180644 ; z3 += z5 ; z4 += z5 ; dataptr [ 7 ] = ( tmp4 + z1 + z3 ) >> 11 ; dataptr [ 5 ] = ( tmp5 + z2 + z4 ) >> 11 ; dataptr [ 3 ] = ( tmp6 + z2 + z3 ) >> 11 ; dataptr [ 1 ] = ( tmp7 + z1 + z4 ) >> 11 ; dataptr += 8 ; } dataptr = data ; for ( i = 8 ; i ; i -- ) { tmp0 = dataptr [ 0 ] + dataptr [ 56 ] ; tmp7 = dataptr [ 0 ] - dataptr [ 56 ] ; tmp1 = dataptr [ 8 ] + dataptr [ 48 ] ; tmp6 = dataptr [ 8 ] - dataptr [ 48 ] ; tmp2 = dataptr [ 16 ] + dataptr [ 40 ] ; tmp5 = dataptr [ 16 ] - dataptr [ 40 ] ; tmp3 = dataptr [ 24 ] + dataptr [ 32 ] ; tmp4 = dataptr [ 24 ] - dataptr [ 32 ] ; tmp10 = tmp0 + tmp3 ; tmp13 = tmp0 - tmp3 ; tmp11 = tmp1 + tmp2 ; tmp12 = tmp1 - tmp2 ; dataptr [ 0 ] = ( tmp10 + tmp11 ) >> 2 ; dataptr [ 32 ] = ( tmp10 - tmp11 ) >> 2 ; z1 = ( tmp12 + tmp13 ) * FIX_0_541196100 ; dataptr [ 16 ] = ( z1 + ( tmp13 * FIX_0_765366865 ) ) >> 15 ; dataptr [ 48 ] = ( z1 + ( tmp12 * - FIX_1_847759065 ) ) >> 15 ; z1 = tmp4 + tmp7 ; z2 = tmp5 + tmp6 ; z3 = tmp4 + tmp6 ; z4 = tmp5 + tmp7 ; z5 = ( z3 + z4 ) * FIX_1_175875602 ; tmp4 *= FIX_0_298631336 ; tmp5 *= FIX_2_053119869 ; tmp6 *= FIX_3_072711026 ; tmp7 *= FIX_1_501321110 ; z1 *= - FIX_0_899976223 ; z2 *= - FIX_2_562915447 ; z3 *= - FIX_1_961570560 ; z4 *= - FIX_0_390180644 ; z3 += z5 ; z4 += z5 ; dataptr [ 56 ] = ( tmp4 + z1 + z3 ) >> 15 ; dataptr [ 40 ] = ( tmp5 + z2 + z4 ) >> 15 ; dataptr [ 24 ] = ( tmp6 + z2 + z3 ) >> 15 ; dataptr [ 8 ] = ( tmp7 + z1 + z4 ) >> 15 ; dataptr ++ ; } }
apply_fdct:
  Applies the forward discrete cosine transform to the given input block,
  in the form of a vector of 64 coefficients.
apply_fdct : Applies the forward discrete cosine transform to the given input block in the form of a vector of 64 coefficients .