Loading lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ #define FIX_818_DOUBLE_PREC_KERNEL_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ #define FIX_822_REFACTOR_BIN_REVERB_OPEN /* Nokia: Addresses first step of issue 822 by refactoring ivas_binaural_reverb_open */ #define FIX_847_OUTPUT_PCM_BUFFER /* VA: issue 847: Allocate decoder output PCM buffer dynamically */ #define FIX_520_REMOVE_MEMMOVE_JBM /* VA: issue 520: Remove memmove() from JBM code */ /* #################### End BE switches ################################## */ Loading lib_dec/jbm_jb4_circularbuffer.c +18 −3 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ * @param[in,out] size size of elements buffer * @param[in] capacity maximum number of elements to buffer * @param[in] newElement element to insert in buffer if great enough */ static void JB4_CIRCULARBUFFER_calcPercentile( JB4_CIRCULARBUFFER_ELEMENT *elements, uint16_t *size, uint16_t capacity, JB4_CIRCULARBUFFER_ELEMENT newElement ); static void JB4_CIRCULARBUFFER_calcPercentile( JB4_CIRCULARBUFFER_ELEMENT *elements, uint16_t *size, const uint16_t capacity, JB4_CIRCULARBUFFER_ELEMENT newElement ); /** circular buffer (FIFO) with fixed capacity */ struct JB4_CIRCULARBUFFER Loading @@ -70,7 +70,8 @@ struct JB4_CIRCULARBUFFER /* Creates a circular buffer (FIFO) */ ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) { JB4_CIRCULARBUFFER_HANDLE h; Loading Loading @@ -433,7 +434,7 @@ void JB4_CIRCULARBUFFER_MinAndPercentile( static void JB4_CIRCULARBUFFER_calcPercentile( JB4_CIRCULARBUFFER_ELEMENT *elements, uint16_t *size, uint16_t capacity, const uint16_t capacity, JB4_CIRCULARBUFFER_ELEMENT newElement ) { uint16_t i; Loading @@ -446,7 +447,14 @@ static void JB4_CIRCULARBUFFER_calcPercentile( if ( newElement <= elements[i] ) { /* insert newElement at index i */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = ( *size - i ); j >= 0; j-- ) { elements[i + 1 + j] = elements[i + j]; } #else memmove( elements + i + 1, elements + i, ( *size - i ) * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ); /* IVAS_fmToDo: avoid use of memmove() */ #endif elements[i] = newElement; ++*size; return; Loading @@ -470,7 +478,14 @@ static void JB4_CIRCULARBUFFER_calcPercentile( if ( newElement >= elements[i] ) { /* insert newElement at index i */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = 0; j < i; j++ ) { elements[j] = elements[1 + j]; } #else memmove( elements, elements + 1, i * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ); #endif elements[i] = newElement; return; } Loading lib_dec/jbm_jb4_inputbuffer.c +17 −1 Original line number Diff line number Diff line Loading @@ -210,12 +210,14 @@ int16_t JB4_INPUTBUFFER_Enque( } } #ifdef DEBUGGING assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low ), &replace ) != 0 ); if ( low > 0 ) assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low - 1 ), &replace ) > 0 ); assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low ), &replace ) < 0 ); if ( (uint16_t) ( low + 1 ) < size ) assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low + 1 ), &replace ) < 0 ); #endif insertPos = ( h->readPos + low ) % h->capacity; if ( h->readPos < h->writePos ) Loading @@ -234,7 +236,14 @@ int16_t JB4_INPUTBUFFER_Enque( if ( canMoveRight ) { /* move higher elements to the right and insert at insertPos */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = h->writePos - insertPos; j >= 0; j-- ) { h->data[insertPos + 1 + j] = h->data[insertPos + j]; } #else memmove( h->data + insertPos + 1, h->data + insertPos, ( h->writePos - insertPos ) * sizeof( JB4_INPUTBUFFER_ELEMENT ) ); /* IVAS_fmToDo: avoid use of memmove() */ #endif h->data[insertPos] = element; ++h->writePos; if ( h->writePos == h->capacity ) Loading @@ -245,7 +254,14 @@ int16_t JB4_INPUTBUFFER_Enque( else { /* move lower elements to the left and insert before insertPos */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = 0; j < low; j++ ) { h->data[h->readPos - 1 + j] = h->data[h->readPos + j]; } #else memmove( h->data + h->readPos - 1, h->data + h->readPos, low * sizeof( JB4_INPUTBUFFER_ELEMENT ) ); /* IVAS_fmToDo: avoid use of memmove() */ #endif h->data[insertPos - 1] = element; --h->readPos; assert( (int16_t) h->readPos >= 0 ); Loading Loading
lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ #define FIX_818_DOUBLE_PREC_KERNEL_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ #define FIX_822_REFACTOR_BIN_REVERB_OPEN /* Nokia: Addresses first step of issue 822 by refactoring ivas_binaural_reverb_open */ #define FIX_847_OUTPUT_PCM_BUFFER /* VA: issue 847: Allocate decoder output PCM buffer dynamically */ #define FIX_520_REMOVE_MEMMOVE_JBM /* VA: issue 520: Remove memmove() from JBM code */ /* #################### End BE switches ################################## */ Loading
lib_dec/jbm_jb4_circularbuffer.c +18 −3 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ * @param[in,out] size size of elements buffer * @param[in] capacity maximum number of elements to buffer * @param[in] newElement element to insert in buffer if great enough */ static void JB4_CIRCULARBUFFER_calcPercentile( JB4_CIRCULARBUFFER_ELEMENT *elements, uint16_t *size, uint16_t capacity, JB4_CIRCULARBUFFER_ELEMENT newElement ); static void JB4_CIRCULARBUFFER_calcPercentile( JB4_CIRCULARBUFFER_ELEMENT *elements, uint16_t *size, const uint16_t capacity, JB4_CIRCULARBUFFER_ELEMENT newElement ); /** circular buffer (FIFO) with fixed capacity */ struct JB4_CIRCULARBUFFER Loading @@ -70,7 +70,8 @@ struct JB4_CIRCULARBUFFER /* Creates a circular buffer (FIFO) */ ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) { JB4_CIRCULARBUFFER_HANDLE h; Loading Loading @@ -433,7 +434,7 @@ void JB4_CIRCULARBUFFER_MinAndPercentile( static void JB4_CIRCULARBUFFER_calcPercentile( JB4_CIRCULARBUFFER_ELEMENT *elements, uint16_t *size, uint16_t capacity, const uint16_t capacity, JB4_CIRCULARBUFFER_ELEMENT newElement ) { uint16_t i; Loading @@ -446,7 +447,14 @@ static void JB4_CIRCULARBUFFER_calcPercentile( if ( newElement <= elements[i] ) { /* insert newElement at index i */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = ( *size - i ); j >= 0; j-- ) { elements[i + 1 + j] = elements[i + j]; } #else memmove( elements + i + 1, elements + i, ( *size - i ) * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ); /* IVAS_fmToDo: avoid use of memmove() */ #endif elements[i] = newElement; ++*size; return; Loading @@ -470,7 +478,14 @@ static void JB4_CIRCULARBUFFER_calcPercentile( if ( newElement >= elements[i] ) { /* insert newElement at index i */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = 0; j < i; j++ ) { elements[j] = elements[1 + j]; } #else memmove( elements, elements + 1, i * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ); #endif elements[i] = newElement; return; } Loading
lib_dec/jbm_jb4_inputbuffer.c +17 −1 Original line number Diff line number Diff line Loading @@ -210,12 +210,14 @@ int16_t JB4_INPUTBUFFER_Enque( } } #ifdef DEBUGGING assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low ), &replace ) != 0 ); if ( low > 0 ) assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low - 1 ), &replace ) > 0 ); assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low ), &replace ) < 0 ); if ( (uint16_t) ( low + 1 ) < size ) assert( h->compareFunction( element, JB4_INPUTBUFFER_Element( h, low + 1 ), &replace ) < 0 ); #endif insertPos = ( h->readPos + low ) % h->capacity; if ( h->readPos < h->writePos ) Loading @@ -234,7 +236,14 @@ int16_t JB4_INPUTBUFFER_Enque( if ( canMoveRight ) { /* move higher elements to the right and insert at insertPos */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = h->writePos - insertPos; j >= 0; j-- ) { h->data[insertPos + 1 + j] = h->data[insertPos + j]; } #else memmove( h->data + insertPos + 1, h->data + insertPos, ( h->writePos - insertPos ) * sizeof( JB4_INPUTBUFFER_ELEMENT ) ); /* IVAS_fmToDo: avoid use of memmove() */ #endif h->data[insertPos] = element; ++h->writePos; if ( h->writePos == h->capacity ) Loading @@ -245,7 +254,14 @@ int16_t JB4_INPUTBUFFER_Enque( else { /* move lower elements to the left and insert before insertPos */ #ifdef FIX_520_REMOVE_MEMMOVE_JBM for ( int16_t j = 0; j < low; j++ ) { h->data[h->readPos - 1 + j] = h->data[h->readPos + j]; } #else memmove( h->data + h->readPos - 1, h->data + h->readPos, low * sizeof( JB4_INPUTBUFFER_ELEMENT ) ); /* IVAS_fmToDo: avoid use of memmove() */ #endif h->data[insertPos - 1] = element; --h->readPos; assert( (int16_t) h->readPos >= 0 ); Loading