]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.h
Update PAF commit Id in readme_demo.txt
[processor-sdk/performance-audio-sr.git] / procsdk_audio_x_xx_xx_xx / common / paf_decOpCircBuf.h
1 #ifndef _DEC_OP_CIRC_BUF_H_
2 #define _DEC_OP_CIRC_BUF_H_
4 #include <xdc/std.h>
5 #include "paftyp.h"
7 #define PAF_DECOP_CB_SOK                    (  0 )  // ok
8 #define PAF_DECOP_CB_INIT_INV_SOURCE_SEL    ( -1 )  // error: invalid source selection on init
9 #define PAF_DECOP_CB_WRITE_OVERFLOW         ( -2 )  // error: write overflow
10 #define PAF_DECOP_CB_READ_UNDERFLOW         ( -3 )  // error: read underflow
12 #define PAF_DECOP_CB_MAX_NUM_AF         ( 4 )       // decoder output circular buffer maximum number audio frames
13 #define PAF_DECOP_CB_MAX_NUM_PCM_CH     ( 16 )      // decoder output circular buffer maximum number audio PCM channels
14 #define PAF_DECOP_CB_MAX_NUM_PCM_FRAMES ( 2 )       // decoder output circular buffer maximum number PCM frames
15 #define PAF_DECOP_CB_MAX_PCM_FRAME_LEN  ( 6*256 )   // decoder output circular buffer maximum PCM frame length
16 #define PAF_DECOP_CB_PCM_BUF_SZ         ( PAF_DECOP_CB_MAX_NUM_PCM_CH * PAF_DECOP_CB_MAX_NUM_PCM_FRAMES * PAF_DECOP_CB_MAX_PCM_FRAME_LEN )
18 // Decoder output circular buffer
19 typedef struct PAF_DecodeOpCircBuf {
20         PAF_AudioFrame *afCb;   // audio frame circular buffer
21         PAF_AudioData *pcmBuf;  // PCM buffer, contains PCM data associated with audio frames
22         Int8 afRdIdx;           // audio frame circular buffer read index
23         Int8 afWrtIdx;          // audio frame circular buffer write index
24         Int pcmRdIdx;           // pcm buffer read index
25         Int8 numAfCb;           // current number frames in circular buffer 
26         Int8 maxNumAfCb;        // maximum number of audio frames in circular buffer
27         Int decOpFrameLen;      // selected decoder output frame length (input transaction size)
28         Int pafFrameLen;        // PAF frame length (output transaction size)
29         Int cbWriteInit;        // indicates whether CB write has been initialized
30 } PAF_DecodeOpCircBuf;
32 // Initialize circular buffer
33 Int cbInit(
34     Int8 sourceSelect,          // source select (PCM, DDP, etc.)
35     Int decOpFrameLen,          // decoder output frame length
36     Int pafFrameLen,            // PAF frame length
37     PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
38 );
40 // Read audio frame from circular buffer
41 Int cbReadAf(
42     PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
43     PAF_AudioFrame *pAfRd       // audio frame into which to read
44 );
46 // Write audio frame to circular buffer
47 Int cbWriteAf(
48     PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
49     PAF_AudioFrame *pAfWrt      // audio frame from which to write
50 );
52 // Get next audio frame to write in circular buffer
53 Int cbGetNextWriteAf(
54     PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
55     PAF_AudioFrame **ppAfWrt    // audio frame next to be written
56 );
58 Int cbLog(
59     PAF_DecodeOpCircBuf *pCb,
60     Int fullLog
61 );
63 #endif /* _DEC_OP_CIRC_BUF_H_ */