Hi c6x,I have a problem. In my thesis there's a function that operate on matrices, so I created two different version of this part of my code; In the first version (OLD) I've implemented independently my code, and in the second version (NEW) I use the dsplib library of C6701. The two different version of the code works fine, but when I use the dsplib I need an enormous stack.In effect I monitoring the stack pointer I have the following results: SP inside the function calling NEW 80009720h SP inside the function NEW 80008300h ________________________________________________________________________________\ __ SP inside the function calling OLD 80009720h SP inside the function OLD 80008300h ________________________________________________________________________________\ __ What can I do? I need to use "NEW" because this routine is faster than mine, but I don't know what to do. Can you help me? I have a similar problem using the functions inside fastrts67x.h. In the file Stack_problem.c there's the file that generate this problem. You can see that the parameter that I use to call the function int ZYuvImage_ConvRGB_YUV(ZBmpImage* source,struct ZYuvImage * Image) and int ZYuvImage_ConvRGB_YUV_old(ZBmpImage* source,struct ZYuvImage * Image) are identical. Thank you to everybody. P.S. I've a question about "netiquette": when a member of C6x helps me, can I send him a mail of greatings or this is considered a trouble? _________________________________________________________________ Comunica in un altra dimensione con MSN Extra Storage! http://www.msn.it/msnservizi/es/?xAPIDS4&DI44&SU=http://hotmail.it/&HL=HMTA\ GTX_Comunica |
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <dspf_sp_w_vec.h> #include "ZYuvImage.h" #include "ZImage.h" #include "ZBmpImage.h" int ZYuvImage_ConvRGB_YUV_old(ZBmpImage* source,struct ZYuvImage * Image) { long int i,j; float Red,Green,Blue; float y,u,v; for ( j=0;j<ALT_IMAGE;j++) { for (i=0;i<(LARG_IMAGE);i++) { Red = (float)source->Bitmap[j][3*i+0]; Green= (float)source->Bitmap[j][3*i+1]; Blue = (float)source->Bitmap[j][3*i+2]; y= .299*Red + .587*Green + .114*Blue; y= Clip(y); Image->bmy[j][i]=_dpint(y); u= (-.1687*Red + (-.3313*Green) + .5*Blue) + 128.; u= Clip(u); Image->bmu[j][i]=_dpint(u); v= (.5*Red + (-.4187*Green) + (-.0813*Blue)) + 128.; v= Clip(v); Image->bmv[j][i]= _dpint(v); } } puts("ZYuvImage_ConvRGB_YUV"); return 1; } /****************************************************************************/ /*************** Conversione dalla copia locale RGB alla YUV ***************/ /****************************************************************************/ int ZYuvImage_ConvRGB_YUV_new(ZBmpImage* source,struct ZYuvImage * Image) { long int i,j; float Red[LARG_IMAGE],Green[LARG_IMAGE],Blue[LARG_IMAGE]; float temp1[LARG_IMAGE],temp2[LARG_IMAGE]; #pragma DATA_MEM_BANK (Red,0) #pragma DATA_MEM_BANK (Green,0) #pragma DATA_MEM_BANK (Blue,0) #pragma DATA_MEM_BANK (temp1,0) #pragma DATA_MEM_BANK (temp2,0) for ( j=0;j<ALT_IMAGE;j++) { _nassert( ((int)Red % 8) == 0 ); _nassert( ((int)Green % 8) == 0 ); _nassert( ((int)Blue % 8) == 0 ); for (i=0;i<(LARG_IMAGE);i++) { Red[i] =(float)source->Bitmap[j][3*i+0]; Green[i]=(float)source->Bitmap[j][3*i+1]; Blue[i] =(float)source->Bitmap[j][3*i+2]; } /****************************************************************************/ /* Calcolo componente Y della terna YUV */ /****************************************************************************/ DSPF_sp_w_vec(Red,Green,0.299,temp1,LARG_IMAGE); DSPF_sp_w_vec(Green,temp1,(-1+0.587),temp2,LARG_IMAGE); DSPF_sp_w_vec(Blue,temp2,0.114,temp1,LARG_IMAGE); _nassert( ((int)temp1 % 8) == 0 ); _nassert( ((int)temp2 % 8) == 0 ); for (i=0;i<(LARG_IMAGE);i++) { temp2[i]=Clip(temp1[i]); Image->bmy[j][i]=_dpint(temp2[i]); } /****************************************************************************/ /* Calcolo componente U della terna YUV */ /****************************************************************************/ DSPF_sp_w_vec(Red,Green,-0.1687,temp1,LARG_IMAGE); DSPF_sp_w_vec(Green,temp1,(-1.3313),temp2,LARG_IMAGE); DSPF_sp_w_vec(Blue,temp2,0.5,temp1,LARG_IMAGE); _nassert( ((int)temp1 % 8) == 0 ); _nassert( ((int)temp2 % 8) == 0 ); for (i=0;i<(LARG_IMAGE);i++) { temp1[i]+8.0; temp2[i]=Clip(temp1[i]); Image->bmu[j][i]=_dpint(temp2[i]); } /****************************************************************************/ /* Calcolo componente V della terna YUV */ /****************************************************************************/ DSPF_sp_w_vec(Red,Green,0.5,temp1,LARG_IMAGE); DSPF_sp_w_vec(Green,temp1,(-1.4187),temp2,LARG_IMAGE); DSPF_sp_w_vec(Blue,temp2,-0.0813,temp1,LARG_IMAGE); _nassert( ((int)temp1 % 8) == 0 ); _nassert( ((int)temp2 % 8) == 0 ); for (i=0;i<(LARG_IMAGE);i++) { temp1[i]+8.0; temp2[i]=Clip(temp1[i]); Image->bmv[j][i]=_dpint(temp2[i]); } } puts("ZYuvImage_ConvRGB_YUV"); return 1; } |
Problem with stack
Started by ●September 7, 2003