[CLAM] There may be a bug in "audio.cxx"
Xavier Amatriain
xamat at iua.upf.edu
Wed Jul 19 02:50:27 PDT 2006
Hi Gu,
Nice way to introduce yourself to the list, with a bug in the guts of
CLAM :)
This code is rather obscure, I have problems guessing it myself, but as
far as I can
tell there is no such bug.
The issue is that the last index is non-inclusive. So if you have
beginIndex=0 and endIndex=10
it means that you want to copy from 0 to 9, but not 10 (I know we should
look for a better name
for the argument).
You say that in your code you have:
nBytesToCopy=(endIndex-beginIndex+1)*sizeof(double);
but in my local file I see:
nBytesToCopy=(endIndex-beginIndex)*sizeof(double);
Maybe you have a different version of CLAM?
In any case, thanks for the feedback and we will look further into it.
Neediss Gu wrote:
> line 163:
> //////////////////////////
> if(endIndex>=GetSize())
> {
> TSize ending=endIndex-GetSize();
> memset(chunk.GetBuffer().GetPtr()+GetSize()-beginIndex
> ,0,ending*sizeof(TData));
> endIndex=GetSize();
> }
>
> nBytesToCopy=(endIndex-beginIndex+1)*sizeof(double);
> //////////////////////////
> Maybe it should be changed to the following
>
> if(endIndex>=GetSize())
> {
> TSize ending=endIndex-GetSize()+1;
> memset(chunk.GetBuffer().GetPtr()+GetSize()-beginIndex
> +offset,0,ending*sizeof(TData));
> endIndex=GetSize();
> }
>
> and : size=endIndex-beginIndex; -> size=endIndex-beginIndex+1.
>
> --
> Gu Renmin (Charles Neediss)
> Image, Graph, Video, Speech, Audio, ...
> CS Dept. of Tongji University, Shanghai, China
> Cell: +(86) 13816064123
> Work hard, work smart!!!
>
More information about the clam-users
mailing list