⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsp_bexp.h64

📁 dm642函数库
💻 H64
字号:
;* ======================================================================== *;
;*  TEXAS INSTRUMENTS, INC.                                                 *;
;*                                                                          *;
;*  DSPLIB  DSP Signal Processing Library                                   *;
;*                                                                          *;
;*      Release:        Revision 1.04b                                      *;
;*      CVS Revision:   1.8     Sun Sep 29 03:32:17 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.                                    *;
;* ======================================================================== *;
* ========================================================================= *
*   NAME                                                                    *
*       DSP_bexp -- Block exponent of a vector                              *
*                                                                           *
*   REVISION DATE                                                           *
*       12-Jul-2001                                                         *
*                                                                           *
*   USAGE                                                                   *
*       This routine has the following C prototype:                         *
*                                                                           *
*           int DSP_bexp                                                    *
*           (                                                               *
*               const int *x,     /* Input Data         */                  *
*               unsigned   nx     /* Number of elements */                  *
*           );                                                              *
*                                                                           *
*       The DSP_bexp routine accepts a list of 'num' input points and       *
*       performs the determination of the block exponent.  It returns       *
*       the minimum number of "redundant sign bits" observed on the         *
*       block of data.                                                      *
*                                                                           *
*   DESCRIPTION                                                             *
*       The DSP_bexp function, performs a determination of the block        *
*       exponent of the vector of elements and returns the maximum          *
*       exponent.  This information can then be used to re-normalize        *
*       the vector.  This operation is useful when auto-scaling is          *
*       required as in a FFT.  The DSP_bexp operation returns the minimum   *
*       norm of the vector.  The minimum norm corresponds to the            *
*       maximum exponent.                                                   *
*                                                                           *
*   C CODE                                                                  *
*       The following is a general C code description of the algorithm      *
*       without restrictions.  This implementation may have restrictions    *
*       as noted under 'ASSUMPTIONS' below.                                 *
*                                                                           *
*       int DSP_bexp(const int *x, short nx)                                *
*       {                                                                   *
*           int i;                                                          *
*           int mask, mag;                                                  *
*                                                                           *
*           mask = 0;                                                       *
*                                                                           *
*           /* ---------------------------------------------------- */      *
*           /*  Merge the absolute values of all the elements       */      *
*           /*  together.  The leftmost bit-change on this mask     */      *
*           /*  gives us the magnitude we desire.                   */      *
*           /* ---------------------------------------------------- */      *
*           for (i = 0; i < nx; i++)                                        *
*               mask |= x[i] ^ (x[i] >> 31);                                *
*                                                                           *
*           /* ---------------------------------------------------- */      *
*           /*  Find the magnitude of the mask.                     */      *
*           /* ---------------------------------------------------- */      *
*           for (mag = 0; (1 << mag) < mask; mag++)                         *
*               ;                                                           *
*                                                                           *
*           return 31 - mag;                                                *
*       }                                                                   *
*                                                                           *
*   ASSUMPTIONS                                                             *
*       nx >= 8.                                                            *
*       nx % 8 == 0.                                                        *
*                                                                           *
*       The array 'x' is double-word aligned.                               *
*                                                                           *
*   NOTES                                                                   *
*       This code is interrupt tolerant, but not interruptible.  It masks   *
*       interrupts for its entire duration with branch delay slots.         *
*                                                                           *
*       This code is ENDIAN NEUTRAL.                                        *
*                                                                           *
*   SOURCE                                                                  *
*       DSPLIB.                                                             *
*                                                                           *
*   CYCLES                                                                  *
*       cycles = nx/2 + 21, including 6 cycle function call overhead.       *
*       For nx = 32, cycles = 37.                                           *
*                                                                           *
*   CODESIZE                                                                *
*       236 bytes.                                                          *
*                                                                           *
* ------------------------------------------------------------------------- *
*             Copyright (c) 2003 Texas Instruments, Incorporated.           *
*                            All Rights Reserved.                           *
* ========================================================================= *

        .global _DSP_bexp

* ========================================================================= *
*   End of file:  dsp_bexp.h64                                              *
* ------------------------------------------------------------------------- *
*             Copyright (c) 2003 Texas Instruments, Incorporated.           *
*                            All Rights Reserved.                           *
* ========================================================================= *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -