Commit cbffa05d authored by sagnowski's avatar sagnowski
Browse files

Add documentation to cldfb_ring_buffer.h

parent 6f1bb9ec
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
@@ -40,20 +40,70 @@

typedef struct CldfbRingBuf *CLDFB_RINGBUF_HANDLE;

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_Open( )
 *
 * Allocate a ring buffer for CLDFB data with the given capacity of CLDFB columns.
 * Each column is expected to contain at most CLDFB_NO_CHANNELS_MAX frequency bands.
 *
 * May return IVAS_ERR_FAILED_ALLOC on failed allocation, or IVAS_ERR_OK otherwise.
 *---------------------------------------------------------------------*/
ivas_error CLDFB_RINGBUF_Open( CLDFB_RINGBUF_HANDLE *ph, int16_t capacity_columns );

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_Close( )
 *
 * Dellocate CLDFB ring buffer. The given handle will be set to NULL.
 *---------------------------------------------------------------------*/
void CLDFB_RINGBUF_Close( CLDFB_RINGBUF_HANDLE *ph );

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_Push( )
 *
 * Push a single column onto the back of the CLDFB ring buffer from real and imag arrays.
 *---------------------------------------------------------------------*/
void CLDFB_RINGBUF_Push( CLDFB_RINGBUF_HANDLE h, const float *real, const float *imag, uint16_t num_bands );

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_Pop( )
 *
 * Pop a single column from the front of the CLDFB ring buffer into real and imag arrays.
 *---------------------------------------------------------------------*/
void CLDFB_RINGBUF_Pop( CLDFB_RINGBUF_HANDLE h, float *real, float *imag, uint16_t num_bands );

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_GetByIdx( )
 *
 * Get pointers into a specific column in the CLDFB ring buffer based on given index.
 * Non-negative indices access from the front of the ring buffer, negative indexes access
 * from the back, similar to Python arrays. For example:
 *
 * - index 0 accesses the front of the buffer, i.e. the oldest CLDFB column in the queue.
 * - index -1 accesses the back of the buffer, i.e. the newest (last pushed) CLDFB column in the queue.
 *
 * Returns -1 if given an invalid index (p_real and p_imag will be set to NULL in that case), or 0 otherwise.
 *---------------------------------------------------------------------*/
int16_t CLDFB_RINGBUF_GetByIdx( CLDFB_RINGBUF_HANDLE h, float **p_real, float **p_imag, int16_t idx );

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_IsEmpty( )
 *
 * Returns 1 if the ring buffer is empty, or 0 otherwise.
 *---------------------------------------------------------------------*/
int16_t CLDFB_RINGBUF_IsEmpty( CLDFB_RINGBUF_HANDLE h );

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_IsFull( )
 *
 * Returns 1 if the ring buffer is full, or 0 otherwise.
 *---------------------------------------------------------------------*/
int16_t CLDFB_RINGBUF_IsFull( CLDFB_RINGBUF_HANDLE h );

/*---------------------------------------------------------------------*
 * CLDFB_RINGBUF_Size( )
 *
 * Returns the number of CLDFB columns currently stored in the ring buffer.
 *---------------------------------------------------------------------*/
uint16_t CLDFB_RINGBUF_Size( CLDFB_RINGBUF_HANDLE h );

#endif /* FIX_1119_SPLIT_RENDERING_VOIP */