Ejemplo n.º 1
0
/**************************************************************************************
 * Function:    DCT4
 *
 * Description: type-IV DCT
 *
 * Inputs:      table index (for transform size)
 *              buffer of nmdct samples
 *              number of guard bits in the input buffer
 *
 * Outputs:     processed samples in same buffer
 *
 * Return:      none
 *
 * Notes:       operates in-place
 *              if number of guard bits in input is < GBITS_IN_DCT4, the input is 
 *                scaled (>>) before the DCT4 and rescaled (<<, with clipping) after
 *                the DCT4 (rare)
 *              the output has FBITS_LOST_DCT4 fewer fraction bits than the input
 *              the output will always have at least 1 guard bit (GBITS_IN_DCT4 >= 4)
 *              int bits gained per stage (PreMul + FFT + PostMul)
 *                 short blocks = (-5 + 4 + 2) = 1 total
 *                 long blocks =  (-8 + 7 + 2) = 1 total
 **************************************************************************************/
void DCT4(int tabidx, int *coef, int gb)
{
	int es;

	/* fast in-place DCT-IV - adds guard bits if necessary */
	if (gb < GBITS_IN_DCT4) {
		es = GBITS_IN_DCT4 - gb;
		PreMultiplyRescale(tabidx, coef, es);
		R4FFT(tabidx, coef);
		PostMultiplyRescale(tabidx, coef, es);
	} else {
		PreMultiply(tabidx, coef);
		R4FFT(tabidx, coef);
		PostMultiply(tabidx, coef);
	}
}
Ejemplo n.º 2
0
/**************************************************************************************
 * Function:    IMLTNoWindow
 *
 * Description: inverse MLT without window or overlap-add
 *
 * Inputs:      table index (for transform size)
 *              buffer of nmlt samples
 *              number of guard bits in the input buffer
 *
 * Outputs:     processed samples in same buffer
 *
 * Return:      none
 *
 * Notes:       operates in-place, and generates nmlt output samples from nmlt input
 *                samples (doesn't do synthesis window which expands to 2*nmlt samples)
 *              if number of guard bits in input is < GBITS_IN_IMLT, the input is 
 *                scaled (>>) before the IMLT and rescaled (<<, with clipping) after
 *                the IMLT (rare)
 *              the output has FBITS_LOST_IMLT fewer fraction bits than the input
 *              the output will always have at least 1 guard bit
 **************************************************************************************/
void IMLTNoWindow(int tabidx, int *mlt, int gb)
{
	int es;

	/* fast in-place DCT-IV - adds guard bits if necessary */
	if (gb < GBITS_IN_IMLT) {
		es = GBITS_IN_IMLT - gb;
		PreMultiplyRescale(tabidx, mlt, es);
		R4FFT(tabidx, mlt);
		PostMultiplyRescale(tabidx, mlt, es);
	} else {
		PreMultiply(tabidx, mlt);
		R4FFT(tabidx, mlt);
		PostMultiply(tabidx, mlt);
	}

	return;
}