src/audio/eq_fir/eq_fir_hifi3.c
/* FIR for any number of frames */
FIR for any number of frames
FIR for any number of frames
void eq_fir_s32(struct fir_state_32x16 fir[], const struct audio_stream *source,
		struct audio_stream *sink, int frames, int nch)
{
	struct fir_state_32x16 *f;
	ae_int32x2 in = 0;
	ae_int32 out;
	ae_int32 *x;
	ae_int32 *y;
	ae_int32 *src = (ae_int32 *)source->r_ptr;
	ae_int32 *snk = (ae_int32 *)sink->w_ptr;
	int ch;
	int i;
	int rshift;
	int lshift;
	int shift;
	int inc = nch * sizeof(int32_t);
	for (ch = 0; ch < nch; ch++) {
		f = &fir[ch];
		fir_get_lrshifts(f, &lshift, &rshift);
		shift = lshift - rshift;
		fir_comp_setup_circular(source);
		x = src;
		AE_L32_XC(in, src, sizeof(int32_t));
		fir_comp_setup_circular(sink);
		y = snk;
		AE_L32_XC(in, snk, sizeof(int32_t));
		for (i = 0; i < frames; i++) {
			fir_comp_setup_circular(source);
			AE_L32_XC(in, x, inc);
			fir_core_setup_circular(f);
			fir_32x16_hifi3(f, in, &out, shift);
			fir_comp_setup_circular(sink);
			AE_S32_L_XC((ae_int32x2)out, y, inc);
		}
	}
}
void eq_fir_s32 ( struct fir_state_32x16 fir [ ] , const struct audio_stream * source , struct audio_stream * sink , int frames , int nch ) { struct fir_state_32x16 * f ; ae_int32x2 in = 0 ; ae_int32 out ; ae_int32 * x ; ae_int32 * y ; ae_int32 * src = ( ae_int32 * ) source -> r_ptr ; ae_int32 * snk = ( ae_int32 * ) sink -> w_ptr ; int ch ; int i ; int rshift ; int lshift ; int shift ; int inc = nch * sizeof ( int32_t ) ; for ( ch = 0 ; ch < nch ; ch ++ ) { f = & fir [ ch ] ; fir_get_lrshifts ( f , & lshift , & rshift ) ; shift = lshift - rshift ; fir_comp_setup_circular ( source ) ; x = src ; AE_L32_XC ( in , src , sizeof ( int32_t ) ) ; fir_comp_setup_circular ( sink ) ; y = snk ; AE_L32_XC ( in , snk , sizeof ( int32_t ) ) ; for ( i = 0 ; i < frames ; i ++ ) { fir_comp_setup_circular ( source ) ; AE_L32_XC ( in , x , inc ) ; fir_core_setup_circular ( f ) ; fir_32x16_hifi3 ( f , in , & out , shift ) ; fir_comp_setup_circular ( sink ) ; AE_S32_L_XC ( ( ae_int32x2 ) out , y , inc ) ; } } }
FIR for any number of frames
FIR for any number of frames
/* Get FIR instance and get shifts to e.g. apply mute
		 * without overhead.
		 */ /* Copy src to x and advance src to next channel with
		 * dummy load.
		 */ /* Copy snk to y and advance snk to next channel with
		 * dummy load.
		 */ /* Load input sample */ /* Compute FIR */ /* Store output sample */