Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
17 Views

I think the definition of WaveFormat maybe a little wrong!

Jump to solution

Hi,

I was studing speech codec recently. And I find that in the sample code, the definition of the WaveFormat maybe wrong.

typedef struct _WaveFormat {
Ipp16s nFormatTag;
Ipp16s nChannels;
Ipp32s nSamplesPerSec;
Ipp32s nAvgBytesPerSec;
Ipp16s nBlockAlign;
Ipp16s nBitPerSample;
Ipp32s cbSize;
}WaveFormat;

The last domain cbSize should be Ipp16s, in my opinion. And I have check this out on the http://en.wikipedia.org/wiki/Wav#Description and many other sites. The cbSize is an option which should only be 2 bytes or none.

Please have a check!


BR
Sam

0 Kudos

Accepted Solutions
Highlighted
New Contributor II
17 Views
Quoting - samsmile

Hi Paul:
I think in this case WORD means two bytes, DWORD means four bytes, is that right? Please have a check, I have try to read many other wave files, they are all 2 bytes length for of the cdSize.


BR
Sam

Hi Sam

you are right, cbSize must betwo byte long, according to Microsoft SDKs MMStypes.h. This typowill be corrected in the nearest IPP Speech Coding sample release, THANK YOU very much for your valuable attention toIPP speech coding samples.
Furtunately, this typo until nownot affected thespeech codec sample. First of all, because Intel's machines are all little endiansoMSB of cbSize were zeroed due toits wrong length (4 instead of 2 bytes).In fact,extra two bites located just after cbSizebefore "data"in WAVheaderrarely are not zero. After fix they will be zeroed with no cbSize involved.
Vyacheslav, IPP speech coding domain.

View solution in original post

0 Kudos
4 Replies
Highlighted
17 Views
I'll forward this to our engineering group for clarification.

0 Kudos
Highlighted
17 Views
Quoting - samsmile
typedef struct _WaveFormat {
Ipp16s nFormatTag;
Ipp16s nChannels;
Ipp32s nSamplesPerSec;
Ipp32s nAvgBytesPerSec;
Ipp16s nBlockAlign;
Ipp16s nBitPerSample;
Ipp32s cbSize;
}WaveFormat;

Hello Sam,

If you check this reference:

http://msdn.microsoft.com/en-us/library/bb669161(VS.85).aspx

you will find a definition for the structure that on which the above structure appears to be based:

typedef struct tWAVEFORMATEX {
    WORD wFormatTag;
    WORD nChannels;
    DWORD nSamplesPerSec;
    DWORD nAvgBytesPerSec;
    WORD nBlockAlign;
    WORD wBitsPerSample;
    WORD cbSize;
} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX;
In this case the cbSize member is four bytes in length.

Paul
0 Kudos
Highlighted
Beginner
17 Views
Quoting - Paul F (Intel)

Hello Sam,

If you check this reference:

http://msdn.microsoft.com/en-us/library/bb669161(VS.85).aspx

you will find a definition for the structure that on which the above structure appears to be based:

typedef struct tWAVEFORMATEX {
    WORD wFormatTag;
    WORD nChannels;
    DWORD nSamplesPerSec;
    DWORD nAvgBytesPerSec;
    WORD nBlockAlign;
    WORD wBitsPerSample;
    WORD cbSize;
} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX;
In this case the cbSize member is four bytes in length.

Paul

Hi Paul:
I think in this case WORD means two bytes, DWORD means four bytes, is that right? Please have a check, I have try to read many other wave files, they are all 2 bytes length for of the cdSize.


BR
Sam
0 Kudos
Highlighted
New Contributor II
18 Views
Quoting - samsmile

Hi Paul:
I think in this case WORD means two bytes, DWORD means four bytes, is that right? Please have a check, I have try to read many other wave files, they are all 2 bytes length for of the cdSize.


BR
Sam

Hi Sam

you are right, cbSize must betwo byte long, according to Microsoft SDKs MMStypes.h. This typowill be corrected in the nearest IPP Speech Coding sample release, THANK YOU very much for your valuable attention toIPP speech coding samples.
Furtunately, this typo until nownot affected thespeech codec sample. First of all, because Intel's machines are all little endiansoMSB of cbSize were zeroed due toits wrong length (4 instead of 2 bytes).In fact,extra two bites located just after cbSizebefore "data"in WAVheaderrarely are not zero. After fix they will be zeroed with no cbSize involved.
Vyacheslav, IPP speech coding domain.

View solution in original post

0 Kudos