[CELT-dev] Porting CELt to the C5505

Cave, Tony t-cave at ti.com
Tue Dec 29 12:33:13 PST 2009


Jean-Marc,

          Sorry I have not got back to you, I had a lot to finish off on the run up to Xmas vacations. I suspect I have introduced a memory leak. If I increase the heap then it increases the number of iteration of encode before the crash.



I suspect it is because the modification I made below in stack_alloc.h. I made this because I had no alloca function.



#elif defined(USE_ALLOCA)



#define VARDECL(type, var) type *var

#define ALLOC(var, size, type) var = ((type*)malloc/*alloca*/(sizeof(type)*(size))); memset(var,0,sizeof(type)*(size))

#define SAVE_STACK

#define RESTORE_STACK

#define ALLOC_STACK



#else



(I attached the file for reference).



I am almost convinced this is the issue as the alloc a would be coming out of the heap and not the stack. Can you suggest a better way of implementing this? Or a way to make the de-alloc come from the heap (i.e. free the malloc)?



Regards,

Tony.



Texas Instruments Limited, 800 Pavilion Drive, Northampton, NN4 7YL. Registered in England & Wales under company number 00574102



-----Original Message-----

From: Jean-Marc Valin [mailto:Jean-Marc.Valin at USherbrooke.ca]
Sent: 17 December 2009 16:34
To: Cave, Tony
Cc: celt-dev at xiph.org
Subject: RE: [CELT-dev] Porting CELt to the C5505



Quoting "Cave, Tony" <t-cave at ti.com>:



> Jean-Marc,

>         I have the codec and testcelt.c building and running, but after 5

> encode/decode (or 10 enc only) cycles I see something that looks like it

> popped the stack. What are the stack size requirements?



If it doesn't overflow the stack on the first call, I don't see how it would do

so later. What probably happens is that for some reason the stack is never

restored back to its normal value. But just in case, try increasing it a bit.

What frame size/number of channels are you using?



   Jean-Marc



> Regards,

> Tony.

>

>

> Texas Instruments Limited, 800 Pavilion Drive, Northampton, NN4 7YL.

> Registered in England & Wales under company number 00574102

>

> -----Original Message-----

>

> From: Jean-Marc Valin [mailto:jean-marc.valin at usherbrooke.ca]

> Sent: 17 December 2009 12:03

> To: Cave, Tony

> Cc: celt-dev at xiph.org; Peake, Greg

> Subject: Re: [CELT-dev] Porting CELt to the C5505

>

> Hi Tony,

>

> What do you mean by "create an alloca.h" doesn't the compiler have one?

> If not, then you might as well create a definition for the VARDECL() and

> ALLOC() macros (see stack_alloc.h). I would be interested in merging bac

> the changes. The best way to do that is to send a patch. Ideally, the

> arch-dependent changes should be clearly separated from the

> arch-dependent code (within #ifdef or separate file).

>

> Cheers,

>

>         Jean-Marc

>

>

> On 17/12/09 03:14, Cave, Tony wrote:

> > Jean-Marc, Thank you for the tips. I think I have solved the stack

> > issue (I noticed the C99 array issue and avoided this). I will

> > probably create an alloca.h (I think this is the correct thing to

> > do). I am happy to feed back any work I do, if you want me to do this

> > what is the process?

> >

> > Tony.

> >

> >

> > Texas Instruments Limited, 800 Pavilion Drive, Northampton, NN4 7YL.

> > Registered in England&  Wales under company number 00574102

> >

> > ----- Original Message -----

> >

> > From: Jean-Marc Valin<jean-marc.valin at usherbrooke.ca> To: Cave, Tony

> > Cc: celt-dev at xiph.org<celt-dev at xiph.org> Sent: Thu Dec 17 03:18:43

> > 2009Subject: Re: [CELT-dev] Porting CELt to the C5505

> >

> > Hi,

> >

> > There's are already some C55-specific optimisations in the code. You

> > can enable them by defining CONFIG_TI_C55X and ENABLE_TI_DSPLIB. As

> > for the stack allocation, it's just a fallback for compilers that

> > don't support C99 arrays and have a broken alloca() -- it's always

> > best not to use it. Still, can you tell me what problem you are

> > seeing with it?

> >

> > Cheers,

> >

> > Jean-Marc

> >

> > On 16/12/09 05:38, Cave, Tony wrote:

> >> Hi,

> >>

> >> I am an applications engineer for Texas Instruments in the UK. I

> >> am trying to port the CELT codec to the C5505, this has HW

> >> accelerated FFT engine

> >> (http://focus.ti.com/docs/prod/folders/print/tms320vc5505.html).

> >>

> >> I am having problems with the stack allocation. Do you have any

> >> reference code that compiles for the C55x under CCS (code composer

> >> studio)?

> >>

> >> *******************************

> >>

> >> Tony Cave

> >>

> >> Senior Embedded Processor FAE

> >>

> >> Texas Instruments Limited

> >>

> >> 3000 Aviator way

> >>

> >> Manchester

> >>

> >> M22 5TG

> >>

> >> Mb: +44-7917-183293

> >>

> >> *******************************

> >>

> >> Texas Instruments Limited, 800 Pavilion Drive, Northampton, NN4

> >> 7YL. Registered in England&  Wales under company number 00574102

> >>

> >>

> >>

> >> _______________________________________________ celt-dev mailing

> >> list celt-dev at xiph.org

> >> http://lists.xiph.org/mailman/listinfo/celt-dev

> >

> >

> >

>

>

>






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/opus/attachments/20091229/679bdbba/attachment-0002.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stack_alloc.h
Url: http://lists.xiph.org/pipermail/opus/attachments/20091229/679bdbba/attachment-0002.txt 


More information about the celt-dev mailing list