Table 3. Adpcm_Decode Function - ST STM32F103 Series Application Note

Implementing the adpcm algorithm in high-density microcontrollers
Hide thumbs Also See for STM32F103 Series:
Table of Contents

Advertisement

AN2931
Table 3.
Function name
Prototype
Behavior description
Input parameter
Output parameter
Return parameter
The input of the ADPCM_Decode function is a byte that contains the 4-bit ADPCM sample.
The software has to extract the 4-bit ADPCM data and store them into a byte before calling
the ADPCM_Decode function.
Example:
//Input: adpcm_byte; two 4-bit ADPCM samples stored into one byte.
//Output: pcm_sample1 and pcm_sample2; two 16-bit PCM samples.
uint8_t code;
/* Extract the first ADPCM 4-bit sample */
code = (adpcm_byte & 0x0F);
/* Decode the first ADPCM sample */
pcm_sample1 = ADPCM_Decode(code);
/* Extract the second ADPCM sample */
code = (adpcm_byte >> 4);
/* Decode the second ADPCM sample */
pcm_sample2 = ADPCM_Decode(code);
ADPCM_Decode function
int16_t ADPCM_Decode(uint8_t code);
Decodes a 4-bit ADPCM sample into a 16-bit PCM sample
Code: an 8-bit data item whose 4 LSBs contain the encoded ADPCM
sample
None
A 16-bit PCM sample
Doc ID 15349 Rev 2
ADPCM algorithm
ADPCM_Decode
7/15

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F103 Series and is the answer not in the manual?

Questions and answers

Table of Contents