📄 ceintratile.c
字号:
/* ============================================================================
Property of Freescale
Freescale Confidential Proprietary
Freescale Copyright (C) 2006 All rights reserved
----------------------------------------------------------------------------
$RCSfile: CEIntraTile.c.rca $
Tag $Name: $
$Revision: 1.2 $
$Date: Fri Oct 27 18:01:46 2006 $
Target Processor: Matlab
============================================================================ */
//#include "StarCoreMath.h"
#include <stdlib.h>
#include <math.h>
#include "Math_Funcs.c"
#include "mex.h"
#include "SBX_FPULSPK_CEIntraTile.c"
#include "prototype.c"
// Input Arguments (not all might be used)
#define X1_IN prhs[0]
#define X2_IN prhs[1]
#define X3_IN prhs[2]
// Output Arguments (not all might be used)
#define Y1_OUT plhs[0]
/*
extern long Mult32(
signed long liX1,
signed long liX2);
*/
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
/* Matlab input interface (not all might be used) */
double *xr,*xi,*yr,*yi,*zr,*zi;
//Matlab output interface (not all might be used)
double *Y1r,*Y1i;
// Others
short int tempyr,tempyi,tempzr,tempzi;
short int *pPS1;
short int *pPS3;
long int *pliChanEst;
double *pCE;
unsigned long int uliTileNum;
int i,j;
double *temp;
double x;
int scalefactor = 65536; // scaling factor : 2^16
/* Matlab input dimensions (not all might be used) */
unsigned long mx1,nx1;
unsigned long mx2,nx2;
unsigned long mx3,nx3;
/* Matlab output dimensions (not all might be used) */
unsigned long my1,ny1;
/* Check for proper number of arguments */
if (nlhs != 1)
{
mexErrMsgTxt("Error: 1 output argument required.");
}
if (nrhs != 3)
{
mexErrMsgTxt("Error: 3 input arguments required.");
}
/* Check the input format */
if ( !mxIsDouble(X1_IN) )
{
mexErrMsgTxt("Error: Input 1 data must be of class 'double'.");
}
if ( mxIsComplex(X1_IN) )
{
mexErrMsgTxt("Error: Input 1 data must not be complex.");
}
//mexPrintf("test1 \n");
if ( (!mxIsDouble(X2_IN) || !mxIsComplex(X2_IN)))
{
mexErrMsgTxt("Error: Input 2 data must be complex of class 'double'.");
}
if ( (!mxIsDouble(X3_IN) || !mxIsComplex(X3_IN)))
{
mexErrMsgTxt("Error: Input 3 data must be complex of class 'double'.");
}
/* get input dimensions (not all might be used) */
mx1=mxGetM(X1_IN); nx1=mxGetN(X1_IN);
mx2=mxGetM(X2_IN); nx2=mxGetN(X2_IN);
mx3=mxGetM(X3_IN); nx3=mxGetN(X3_IN);
// Check you have a col vector
if ( mx2!=1 )
{
mexErrMsgTxt("Error: Input 2 data must be a col vector.");
}
if ( mx3!=1 )
{
mexErrMsgTxt("Error: Input 3 data must be a col vector.");
}
// Get Data
xr = mxGetPr(X1_IN);
x = mxGetScalar(X1_IN);
yr = mxGetPr(X2_IN);
yi = mxGetPi(X2_IN);
zr = mxGetPr(X3_IN);
zi = mxGetPi(X3_IN);
uliTileNum = (unsigned long int) *xr;
pPS1 = mxMalloc(sizeof(short int*)*nx2*2);
pPS3 = mxMalloc(sizeof(short int*)*nx3*2);
for (i=0;i<12;i++){
tempyr = (short int)*(yr+i);
tempyi = (short int)*(yi+i);
*(pPS1+2*i) = tempyr;
*(pPS1+2*i+1) = tempyi;
}
for (j=0;j<12;j++){
tempzr = (short int) *(zr+j);
tempzi = (short int) *(zi+j);
*(pPS3+2*j) = tempzr;
*(pPS3+2*j+1) = tempzi;
}
// Find output dimensions
pliChanEst = mxMalloc(sizeof(long int)*(nx2*4+nx3*4));
pCE = mxMalloc(sizeof(double)*(nx2*4+nx3*4));
//Calling the main function
SBX_FPULSPK_CEIntraTile(pPS1,pPS3,pliChanEst,uliTileNum);
for (i=0;i<nx2*4+nx3*4;i++){
*(pCE+i) = (double)*(pliChanEst+i);
}
Y1_OUT = mxCreateNumericMatrix(1, 48, mxDOUBLE_CLASS, mxCOMPLEX);
Y1r = (double*)mxGetPr(Y1_OUT); Y1i = (double*)mxGetPi(Y1_OUT);
// populating : copy and reformat output data
for(i=0;i<nx2*4;i++)
{
Y1r[i] = pCE[i*2];
Y1i[i] = pCE[i*2+1];
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -