NU-Tech Forum Index Back to NU-Tech Web Site
NU-Tech Forum
 
 Forum FAQForum FAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Internal frame size different from NU-Tech frame size

 
Post new topic   Reply to topic    NU-Tech Forum Index -> NUTS Development Kit FAQs
View previous topic :: View next topic  
Author Message
admin
Site Admin


Joined: 28 Jun 2005
Posts: 66

PostPosted: Fri Jan 30, 2009 3:09 pm    Post subject: Internal frame size different from NU-Tech frame size Reply with quote

Q:
How can I work with internal frame size different from NU-Tech frame size?


A:
WORK_BUFFESIZE is internal frame size.
The entire structure has a latency of WORK_BUFFESIZE samples.

C code:
Code:

double InputBuffer[WORK_BUFFESIZE];
double OutputBuffer[WORK_BUFFESIZE];

// vectors for OLS example
double WorkBuffer[2*WORK_BUFFESIZE];
double InputBufferOld[WORK_BUFFESIZE];
....

int __stdcall PlugIn::LEPlugin_Process(PinType **Input,PinType **Output,LPVOID ExtraInfo)
{

   int nSample;

   while(index_i < Input[0]->DataLen)
   {
      nSample = min( WORK_BUFFESIZE - index_j, Input[0]->DataLen-index_i );
      memcpy( &InputBuffer[index_j], &((double*)Input[0]->DataBuffer)[index_i], nSample*sizeof(double) );
      memcpy( &((double*)Output[0]->DataBuffer)[index_i], &OutputBuffer[index_j], nSample*sizeof(double) );

      index_i += nSample;
      index_j += nSample;         

      if(index_j == WORK_BUFFESIZE)
      {
         index_j = 0;

         ....

         // EXAMPLE with 50% OVERLAP-and-SAVE STRUCTURE and FREQUENCY FILTERING
         memcpy( WorkBuffer, InputBufferOld, WORK_BUFFESIZE*sizeof(double));
         memcpy( &WorkBuffer[WORK_BUFFESIZE], InputBuffer, WORK_BUFFESIZE*sizeof(double));
         memcpy( InputBufferOld, InputBuffer, WORK_BUFFESIZE*sizeof(double));         

         // FFT
         ....
         // FREQUENCY FILTERING
         ....
         // IFFT
         ....

         memcpy( OutputBuffer, &WorkBuffer[WORK_BUFFESIZE], WORK_BUFFESIZE*sizeof(double));

      }
   }

   index_i=0;

   return COMPLETED;
}

void __stdcall PlugIn::LEPlugin_Init()
{
   ....
   index_j = 0;
   index_i = 0;
   ...
}

_________________
The NU-Tech Team
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    NU-Tech Forum Index -> NUTS Development Kit FAQs All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group