Commit 5c5a0b62 authored by emerit's avatar emerit
Browse files

initial version

parent 7c54e695
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@
#define FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE            /* Eri: issue #1002, usan-value-out-of-range-for-int16, kept BE for PLC-conditions   */
#define FIX_960_SYN_OUTPUT                              /* VA: issue 960: unused function syn_output() is removed */
#define FIX_1027_GSC_INT_OVERFLOW                       /* VA: issue 2207: overflow in GSC */
#define FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT            /* Orange issue 1031 : fix point hrtf binary file format */

/* #################### End BE switches ################################## */

+49 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "ivas_rom_binauralRenderer.h"
#include "ivas_rom_binaural_crend_head.h"
@@ -1858,7 +1859,11 @@ int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptr
        return 0;
    }

#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
    hrtf_data_size += sizeof( Word32 ); // latency_s
#else
    hrtf_data_size += sizeof( float ); // latency_s
#endif
    hrtf_data_size += sizeof( uint16_t );                                                                                         // max_num_ir
    hrtf_data_size += sizeof( uint16_t );                                                                                         // BINAURAL_CHANNELS
    hrtf_data_size += sizeof( int16_t );                                                                                          // max_num_iterations
@@ -1877,7 +1882,11 @@ int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptr
    }

    hrtf_data_size += sizeof( uint16_t ); // index_frequency_max_diffuse
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
    hrtf_data_size += hrtf_table_dims->max_num_ir * BINAURAL_CHANNELS * sizeof( Word16 ); // inv_diffuse_weight
#else
    hrtf_data_size += hrtf_table_dims->max_num_ir * BINAURAL_CHANNELS * sizeof( float ); // inv_diffuse_weight
#endif
    hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration
    // coeff_re & coeff_im : The size depends on pIndex_frequency_max
    for ( iIR = 0, iIndex = 0; iIR < hrtf_table_dims->max_num_ir; iIR++ )
@@ -1886,7 +1895,11 @@ int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptr
        {
            for ( iIter = 0; iIter < hrtf_table_ptrs->num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ )
            {
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
                hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max[iIndex++] * sizeof( Word32 ); // 2* : re & im
#else
                hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max[iIndex++] * sizeof( float ); // 2* : re & im
#endif
            }
        }
    }
@@ -1899,7 +1912,11 @@ int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptr
        {
            for ( iIter = 0; iIter < hrtf_table_ptrs->num_iterations_diffuse[iChan]; iIter++ )
            {
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
                hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max_diffuse[iIndex++] * sizeof( Word32 ); // 2* : re & im
#else
                hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max_diffuse[iIndex++] * sizeof( float ); // 2* : re & im
#endif
            }
        }
    }
@@ -2074,12 +2091,20 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
    hrtf_data_in_rptr = hrtf_data_in;

// latency_s
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
    if ( ( *( tabs_ptrs.latency_s ) - ( *( (Word32 *) ( hrtf_data_in_rptr ) ) ) * powf( 2.f, -31.f ) ) > 1e-9f )
#else
    if ( ( *( tabs_ptrs.latency_s ) - *( (float *) ( hrtf_data_in_rptr ) ) ) > 1e-9f )
#endif
    {
        fprintf( stderr, "check_hrtf_data of binary file failed: bad latency_s!\n\n" );
        return -1;
    }
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
    hrtf_data_in_rptr += sizeof( Word32 );
#else
    hrtf_data_in_rptr += sizeof( float );
#endif

    // max_num_ir
    if ( tabs_dims.max_num_ir != *( (uint16_t *) ( hrtf_data_in_rptr ) ) )
@@ -2164,7 +2189,11 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
    hrtf_data_in_rptr += sizeof( uint16_t );

    // inv_diffuse_weight
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
    ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( Word16 );
#else
    ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( float );
#endif
    if ( memcmp( tabs_ptrs.inv_diffuse_weight, hrtf_data_in_rptr, ctrl_size ) != 0 )
    {
        fprintf( stderr, "check_hrtf_data of binary file failed: bad inv_diffuse_weight!\n\n" );
@@ -2196,7 +2225,11 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
            coeff_rptr = tabs_ptrs.coeff_re + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration;
            for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ )
            {
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
                ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( Word32 );
#else
                ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float );
#endif
                if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
                {
                    fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_re!\n\n" );
@@ -2225,7 +2258,11 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
            coeff_rptr = tabs_ptrs.coeff_im + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration;
            for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ )
            {
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
                ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( Word32 );
#else
                ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float );
#endif
                if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
                {
                    fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_re!\n\n" );
@@ -2261,7 +2298,11 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
            coeff_rptr = tabs_ptrs.coeff_diffuse_re + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff;
            for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ )
            {
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
                ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( Word32 );
#else
                ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float );
#endif
                if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
                {
                    fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_diffuse_re!\n\n" );
@@ -2286,7 +2327,11 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
            coeff_rptr = tabs_ptrs.coeff_diffuse_im + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff;
            for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ )
            {
#ifdef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT
                ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( Word32 );
#else
                ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float );
#endif
                if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
                {
                    fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_diffuse_im!\n\n" );
Loading