- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll forward this to our engineering group for clarification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - samsmile
typedef struct _WaveFormat {
Ipp16s nFormatTag;
Ipp16s nChannels;
Ipp32s nSamplesPerSec;
Ipp32s nAvgBytesPerSec;
Ipp16s nBlockAlign;
Ipp16s nBitPerSample;
Ipp32s cbSize;
}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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page