]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ep-processor-libraries/dsplib.git/blob - ti/dsplib/src/DSP_dotp_sqr/c66/DSP_dotp_sqr.h
DSPLIB: optimized signal processing functions for TI DSPs
[ep-processor-libraries/dsplib.git] / ti / dsplib / src / DSP_dotp_sqr / c66 / DSP_dotp_sqr.h
1 /* ======================================================================= */
2 /* DSP_dotp_sqr.h --  Vector Dot Product and Square implementation         */
3 /*                    Intrinsic C Implementation                           */
4 /*                                                                         */
5 /* Rev 0.0.1                                                               */
6 /*                                                                         */
7 /* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  */ 
8 /*                                                                         */
9 /*                                                                         */
10 /*  Redistribution and use in source and binary forms, with or without     */
11 /*  modification, are permitted provided that the following conditions     */
12 /*  are met:                                                               */
13 /*                                                                         */
14 /*    Redistributions of source code must retain the above copyright       */
15 /*    notice, this list of conditions and the following disclaimer.        */
16 /*                                                                         */
17 /*    Redistributions in binary form must reproduce the above copyright    */
18 /*    notice, this list of conditions and the following disclaimer in the  */
19 /*    documentation and/or other materials provided with the               */
20 /*    distribution.                                                        */
21 /*                                                                         */
22 /*    Neither the name of Texas Instruments Incorporated nor the names of  */
23 /*    its contributors may be used to endorse or promote products derived  */
24 /*    from this software without specific prior written permission.        */
25 /*                                                                         */
26 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS    */
27 /*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT      */
28 /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  */
29 /*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT   */
30 /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  */
31 /*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT       */
32 /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  */
33 /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  */
34 /*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT    */
35 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  */
36 /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   */
37 /*                                                                         */
38 /* ======================================================================= */
40 #ifndef DSP_DOTP_SQR_H_
41 #define DSP_DOTP_SQR_H_
43 #ifndef __TI_COMPILER_VERSION__           // for non TI compiler
44 #include "assert.h"                       // intrinsics prototypes
45 #include "C6xSimulator.h"                 // intrinsics prototypes
46 #include "C6xSimulator_type_modifiers.h"  // define/undefine typing keywords
47 #endif
49 /** @ingroup MATH */
50 /* @{ */
52 /** @defgroup DSP_dotp_sqr */
53 /** @ingroup DSP_dotp_sqr */
54 /* @{ */
56 /**
57  *     This routine performs an nx element dot product of x[ ] and y[ ] 
58  *     and stores it in r. It also squares each element of y[ ] and 
59  *     accumulates it in G. This computation of G is used in the VSELP coder.
60  *  
61  *      @param G = Calculated value of G (used in the VSELP coder)
62  *      @param x = First vector array
63  *      @param y = Second vector array
64  *      @param r = Result of vector dot product of x and y
65  *      @param nx = Number of elements
66  * 
67  * @par Algorithm:
68  * DSP_dotp_sqr_cn.c is the natural C equivalent of the optimized intrinsic 
69  * C code without restrictions note that the intrinsic C code is optimized 
70  * and restrictions may apply.
71  *
72  * @par Assumptions: 
73  *     nx must be a multiple of 4 and greater than or equal to 12. <BR>
74  *
75  * @par Implementation notes:
76  * @b Endian Support: The code supports both big and little endian modes. <BR> 
77  * @b Interruptibility: The code is interruptible. <BR>
78  *  
79  */
80  
81  /* }@ */ /* ingroup */
82  /* }@ */ /* ingroup */
84 int DSP_dotp_sqr (
85     int G,            /* Sum-of-y-squared initial value */
86     const short  *x,  /* First input array              */
87     const short  *y,  /* Second input array.            */
88     int *restrict r,  /* Accumulation of x[] * y[].     */
89     int nx            /* Length of the input vector.    */
90 );
92 #endif /* DSP_DOTP_SQR_H_ */
94 /* ======================================================================== */
95 /*  End of file:  DSP_dotp_sqr.h                                            */
96 /* ------------------------------------------------------------------------ */
97 /*            Copyright (c) 2011 Texas Instruments, Incorporated.           */
98 /*                           All Rights Reserved.                           */
99 /* ======================================================================== */