/*M*
//
//               INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//        Copyright (c) 1995 Intel Corporation. All Rights Reserved.
//
//  RCS:
//      $Source: d:/rcs/nsp20/include/nspcorr.h $
//      $Revision: 1.3 $
//      $Date: 1995/08/07 10:57:46 $
//
//  Purpose: NSP Correlation
*M*/

/*===========================================================================*/

#if !defined (_NSPCORR_H) || defined _NSP_BLDPCS
# define _NSPCORR_H

/* --------------------------------------------------------------------------*/
/*        AutoCorralation                                                    */
/*                                                                           */

/*
  Normal:
  ~~~~~~~
  dst[n] = S ~src[k] * src[k+n],  0 <= n < nLags
                                  0 <= k < len

  Biased:
  ~~~~~~~
  dst[n] = K* S ~src[k] * src[k+n],  0 <= n < nLags
                                     0 <= k < len
                                     K = 1/len
  UnBiased:
  ~~~~~~~~~
  dst[n] = K* S ~src[k] * src[k+n],  0 <= n < nLags
                                     0 <= k < len
                                     K = 1/(len-n)

                                             | src[k], 0<=k<len
                                   src(k) = <
                                             | 0, otherwise

*/

#ifndef _NSP_BLDPCS

typedef enum _NSPAutoCorrType 
   {NSP_Normal, NSP_Biased, NSP_UnBias} NSPAutoCorrType;

#endif

NSPAPI(void, nspsAutoCorr,(const float*  src, int len, float*  dst, int nLags,
                                 NSPAutoCorrType  corrType));
NSPAPI(void, nspcAutoCorr,(const SCplx*  src, int len, SCplx*  dst, int nLags,
                                 NSPAutoCorrType  corrType));
NSPAPI(void, nspdAutoCorr,(const double* src, int len, double* dst, int nLags,
                                 NSPAutoCorrType  corrType));
NSPAPI(void, nspzAutoCorr,(const DCplx*  src, int len, DCplx*  dst, int nLags,
                                 NSPAutoCorrType  corrType));

/* --------------------------------------------------------------------------*/
/*        CrossCorralation                                                   */
/*
  dst[n] = S ~srcA[k] * srcB[k+n+loLag],  0 <= n <= hiLag-loLag
                                          0 <= k < lenA

                                                 | srcB[k], 0<=k<lenB
                                       srcB(k) = <
                                                 | 0, otherwise

  Number of result elements is hiLag-loLag+1.
  Estimate at lag of loLag in dst[0].
  Estimate at lag of hiLag in dst[hiLag-loLag].
*/

NSPAPI(void, nspsCrossCorr, (const float*  srcA,  int lenA,
                             const float*  srcB,  int lenB, float*  dst,
                                   int     loLag, int hiLag));
NSPAPI(void, nspcCrossCorr, (const SCplx*  srcA,  int lenA,
                             const SCplx*  srcB,  int lenB, SCplx*  dst,
                                   int     loLag, int hiLag));
NSPAPI(void, nspscCrossCorr,(const float*  srcA,  int lenA,
                             const SCplx*  srcB,  int lenB, SCplx*  dst,
                                   int     loLag, int hiLag));
NSPAPI(void, nspcsCrossCorr,(const SCplx*  srcA,  int lenA,
                             const float*  srcB,  int lenB, SCplx*  dst,
                                   int     loLag, int hiLag));

NSPAPI(void,  nspdCrossCorr,(const double* srcA,  int lenA,
                             const double* srcB,  int lenB, double* dst,
                                   int     loLag, int hiLag));
NSPAPI(void,  nspzCrossCorr,(const DCplx*  srcA,  int lenA,
                             const DCplx*  srcB,  int lenB, DCplx*  dst,
                                   int     loLag, int hiLag));
NSPAPI(void, nspdzCrossCorr,(const double* srcA,  int lenA,
                             const DCplx*  srcB,  int lenB, DCplx*  dst,
                                   int     loLag, int hiLag));
NSPAPI(void, nspzdCrossCorr,(const DCplx*  srcA,  int lenA,
                             const double* srcB,  int lenB, DCplx*  dst,
                                   int     loLag, int hiLag));

#endif                                  /* _NSPCORR_H                      */
