You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
9.6 KiB
128 lines
9.6 KiB
;* ======================================================================== *;
|
|
;* TEXAS INSTRUMENTS, INC. *;
|
|
;* *;
|
|
;* DSPLIB DSP Signal Processing Library *;
|
|
;* *;
|
|
;* Release: Revision 1.04b *;
|
|
;* CVS Revision: 1.7 Sun Sep 29 03:32:22 2002 (UTC) *;
|
|
;* Snapshot date: 23-Oct-2003 *;
|
|
;* *;
|
|
;* This library contains proprietary intellectual property of Texas *;
|
|
;* Instruments, Inc. The library and its source code are protected by *;
|
|
;* various copyrights, and portions may also be protected by patents or *;
|
|
;* other legal protections. *;
|
|
;* *;
|
|
;* This software is licensed for use with Texas Instruments TMS320 *;
|
|
;* family DSPs. This license was provided to you prior to installing *;
|
|
;* the software. You may review this license by consulting the file *;
|
|
;* TI_license.PDF which accompanies the files in this library. *;
|
|
;* ------------------------------------------------------------------------ *;
|
|
;* Copyright (C) 2003 Texas Instruments, Incorporated. *;
|
|
;* All Rights Reserved. *;
|
|
;* ======================================================================== *;
|
|
;* ======================================================================== *;
|
|
;* Assembler compatibility shim for assembling 4.30 and later code on *;
|
|
;* tools prior to 4.30. *;
|
|
;* ======================================================================== *;
|
|
;* ======================================================================== *;
|
|
;* End of assembler compatibility shim. *;
|
|
;* ======================================================================== *;
|
|
* ========================================================================= *
|
|
* TEXAS INSTRUMENTS, INC. *
|
|
* *
|
|
* NAME *
|
|
* DSP_fir_sym -- Symmetric FIR *
|
|
* *
|
|
* REVISION DATE *
|
|
* 11-Mar-2002 *
|
|
* *
|
|
* USAGE *
|
|
* This function is C callable, and may be called as follows: *
|
|
* *
|
|
* void DSP_fir_sym *
|
|
* ( *
|
|
* const short * x, /* Input samples */ *
|
|
* const short * h , /* Filter taps */ *
|
|
* short * restrict r, /* Output samples */ *
|
|
* int nh, /* Number of symmetric filter taps */ *
|
|
* int nr, /* Number of output samples */ *
|
|
* int s /* Final output shift. */ *
|
|
* ); *
|
|
* *
|
|
* DESCRIPTION *
|
|
* This function applies a symmetric filter to the input samples. *
|
|
* The filter tap array h[] provides 'nh + 1' total filter taps. *
|
|
* The filter tap at h[nh] forms the center point of the filter. *
|
|
* The taps at h[nh - 1] through h[0] form a symmetric filter *
|
|
* about this central tap. The effective filter length is thus *
|
|
* 2*nh + 1 taps. *
|
|
* *
|
|
* The filter is performed on 16-bit data with 16-bit coefficients, *
|
|
* accumulating intermediate results to 40-bit precision. The *
|
|
* accumulator is rounded and truncated according to the value *
|
|
* provided in 's'. This allows a variety of Q-points to be used. *
|
|
* *
|
|
* Note that samples are added together before multiplication, and *
|
|
* so overflow *may* result for large-scale values, despite the *
|
|
* 40-bit accumulation. *
|
|
* *
|
|
* C CODE *
|
|
* Below is a C code implementation without restrictions. The *
|
|
* optimized implementations have restrictions, as noted under *
|
|
* "ASSUMPTIONS" and "MEMORY NOTE" below. *
|
|
* *
|
|
* void DSP_fir_sym *
|
|
* ( *
|
|
* const short * x, /* Input samples */ *
|
|
* const short * h , /* Filter taps */ *
|
|
* short * restrict r, /* Output samples */ *
|
|
* int nh, /* Number of symmetric filter taps */ *
|
|
* int nr, /* Number of output samples */ *
|
|
* int s /* Final output shift. */ *
|
|
* ) *
|
|
* { *
|
|
* int i, j; *
|
|
* long y0, round = (long) 1 << (s - 1); *
|
|
* *
|
|
* for (j = 0; j < nr; j++) *
|
|
* { *
|
|
* y0 = round; *
|
|
* *
|
|
* for (i = 0; i < nh; i++) *
|
|
* y0 += ((short) (x[j + i] + x[j + 2 * nh - i])) * h[i]; *
|
|
* *
|
|
* y0 += x[j + nh] * h[nh]; *
|
|
* *
|
|
* r[j] = (int) (y0 >> s); *
|
|
* } *
|
|
* } *
|
|
* *
|
|
* ASSUMPTIONS *
|
|
* The optimized versions of this kernel may assume that nr is *
|
|
* a multiple of 4 and nh is a multiple of 8. *
|
|
* *
|
|
* MEMORY NOTE. *
|
|
* The code assumes that 'x' and 'h' are double-word aligned, and *
|
|
* that 'r' is word alignend. *
|
|
* *
|
|
* The code expects the device to be in LITTLE ENDIAN mode. *
|
|
* *
|
|
* CYCLES *
|
|
* cycles = (10 * nh/8 + 15) * nr/4 + 26 *
|
|
* *
|
|
* CODESIZE *
|
|
* 664 bytes *
|
|
* *
|
|
* ------------------------------------------------------------------------- *
|
|
* Copyright (c) 2003 Texas Instruments, Incorporated. *
|
|
* All Rights Reserved. *
|
|
* ========================================================================= *
|
|
|
|
.global _DSP_fir_sym
|
|
|
|
* ========================================================================= *
|
|
* End of file: dsp_fir_sym.h64 *
|
|
* ------------------------------------------------------------------------- *
|
|
* Copyright (c) 2003 Texas Instruments, Incorporated. *
|
|
* All Rights Reserved. *
|
|
* ========================================================================= *
|
|
|