Commit 4ae0039f authored by emerit's avatar emerit
Browse files

bug fix

parent 173755ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ ivas_path = ['..' filesep '..' filesep];
%% Set input files
if generateCustomBinaryFile
    output_bin_name = 'ivas_binaural_auditorium2';
    brir_file_name = 'BRIR_Auditorium_S2_R1_CICP19.sofa';
    brir_file_name = 'BRIR_Auditorium_S2_R1_All.sofa';
else 
    output_bin_name = 'ivas_binaural';
    brir_file_name = 'IIS_BRIR_officialMPEG_Combined.sofa';
+9 −1
Original line number Diff line number Diff line
@@ -866,6 +866,8 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
    long sofa_sample_rate = 0;
    double a[3] = { 0 };
    double t[3] = { 0 };
    double ac[3] = { 0 };
    double tc[3] = { 0 };
    long nearest;

    sofa_file_path = (char *) malloc( sizeof( char ) * ( strlen( file_path ) + 1 ) );
@@ -1065,6 +1067,9 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
            }
            t[1] = lscfg.ele[i];        /* elevation in deg */
            t[2] = sofa_src_pos_val[2]; /* radius in m */
            tc[0] = t[2] * cosf( t[0] * M_PI / 180. ) * cosf( t[1] * M_PI / 180. );
            tc[1] = t[2] * sinf( t[0] * M_PI / 180. ) * cosf( t[1] * M_PI / 180. );
            tc[2] = t[2] * sinf( t[1] * M_PI / 180. );
            nearest = find_pos_spheric( sofa_src_pos_cart_val, sofa_M, t );
            if ( ( nearest >= 0 ) && ( nearest < sofa_M ) )
            {
@@ -1075,9 +1080,12 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
                }
                a[1] = sofa_src_pos_val[nearest * 3 + 1] * 180. / M_PI;
                a[2] = sofa_src_pos_val[nearest * 3 + 2];
                ac[0] = sofa_src_pos_cart_val[nearest * 3];
                ac[1] = sofa_src_pos_cart_val[nearest * 3 + 1];
                ac[2] = sofa_src_pos_cart_val[nearest * 3 + 2];
            }

            float prodScal = ( t[0] * a[0] + t[1] * a[1] + t[2] * a[2] ) / ( sqrtf( ( t[0] * t[0] + t[1] * t[1] + t[2] * t[2] ) ) * sqrtf( ( a[0] * a[0] + a[1] * a[1] + a[2] * a[2] ) ) );
            float prodScal = ( tc[0] * ac[0] + tc[1] * ac[1] + tc[2] * ac[2] ) / ( sqrtf( ( tc[0] * tc[0] + tc[1] * tc[1] + tc[2] * tc[2] ) ) * sqrtf( ( ac[0] * ac[0] + ac[1] * ac[1] + ac[2] * ac[2] ) ) );
            float cosAngleMin = cosf( PI_OVER_180 * MAX_DIFF_ANGLE );
            if ( prodScal < cosAngleMin )
            {
+1 −2
Original line number Diff line number Diff line
@@ -90,8 +90,7 @@ if isfile(Lib_Name)
                    assert( any(strcmpi(Sofa.Units{3}, {'metre','meter','inch'})), 'Unknown units');
                    if strcmpi(Sofa.Units{3},'inch'  ), Sofa.Pos(3,:)=Sofa.Pos(3,:)*0.0254; end
                    Sofa.PosSpherical = Sofa.Pos;
                    Sofa.Pos = Sofa.Pos(3,:) .* ...
                      [cos(Sofa.Pos(2,:)).*[cos(Sofa.Pos(1,:));sin(Sofa.Pos(1,:))];sin(Sofa.Pos(2,:))];
                    [Sofa.Pos(1,:),Sofa.Pos(2,:),Sofa.Pos(3,:)] = sph2cart(Sofa.PosSpherical(1,:),Sofa.PosSpherical(2,:),Sofa.PosSpherical(3,:));
                elseif strcmpi(Sofa.Type, 'cartesian')
                    assert( any(strcmpi(Sofa.Units{1}, {'metre','meter','inch'})), 'Unknown units');
                    if strcmpi(Sofa.Units{1},'inch'  ), Sofa.Pos(3,:)=Sofa.Pos(3,:)*0.0254; end