Loading lib_dec/cldfb_ring_buffer.c +16 −7 Original line number Diff line number Diff line Loading @@ -153,10 +153,7 @@ void CLDFB_RINGBUF_Pop( CLDFB_RINGBUF_HANDLE h, float *real, float *imag, uint16 h->read_pos = 0; } if ( h->is_full ) { h->is_full = 0; } return; } Loading @@ -181,17 +178,29 @@ void CLDFB_RINGBUF_GetByIdx( CLDFB_RINGBUF_HANDLE h, float **p_real, float **p_i { int32_t idx = col_idx * CLDFB_NO_CHANNELS_MAX; int32_t num_floats = (int32_t) total_size( h ); uint32_t offset; uint32_t offset, uidx; assert( -num_floats <= idx && idx <= num_floats ); if ( idx >= 0 ) { offset = ( h->read_pos + idx ) % h->capacity; offset = h->read_pos + idx; if ( h->capacity <= offset ) { offset -= h->capacity; } } else { offset = ( h->write_pos + h->capacity + idx ) % h->capacity; uidx = (uint32_t) -idx; if ( uidx <= h->write_pos ) { offset = h->write_pos - uidx; } else { offset = h->write_pos + h->capacity - uidx; } } *p_real = &h->real[offset]; Loading Loading
lib_dec/cldfb_ring_buffer.c +16 −7 Original line number Diff line number Diff line Loading @@ -153,10 +153,7 @@ void CLDFB_RINGBUF_Pop( CLDFB_RINGBUF_HANDLE h, float *real, float *imag, uint16 h->read_pos = 0; } if ( h->is_full ) { h->is_full = 0; } return; } Loading @@ -181,17 +178,29 @@ void CLDFB_RINGBUF_GetByIdx( CLDFB_RINGBUF_HANDLE h, float **p_real, float **p_i { int32_t idx = col_idx * CLDFB_NO_CHANNELS_MAX; int32_t num_floats = (int32_t) total_size( h ); uint32_t offset; uint32_t offset, uidx; assert( -num_floats <= idx && idx <= num_floats ); if ( idx >= 0 ) { offset = ( h->read_pos + idx ) % h->capacity; offset = h->read_pos + idx; if ( h->capacity <= offset ) { offset -= h->capacity; } } else { offset = ( h->write_pos + h->capacity + idx ) % h->capacity; uidx = (uint32_t) -idx; if ( uidx <= h->write_pos ) { offset = h->write_pos - uidx; } else { offset = h->write_pos + h->capacity - uidx; } } *p_real = &h->real[offset]; Loading