Commit bc93ab5e authored by emerit's avatar emerit
Browse files

Complete clean up

parent 178e2732
Loading
Loading
Loading
Loading
+23 −259
Original line number Diff line number Diff line
@@ -116,36 +116,6 @@ if dataSpec.genRomFile
        ' * TD Binaural rendering related ROM tables'
        ' *------------------------------------------------------------------------*/'
        '/* TD renderer default HRIR model */'
        '#ifdef FIX_1123_TDREN_16BIT_ROM'
        'extern const int16_t defaultHRIR_rom_latency_s_Q;'
        'extern const int32_t defaultHRIR_rom_latency_s;'
        'extern const int16_t defaultHRIR_rom_model_configuration[6];'
        ['extern const int16_t defaultHRIR_rom_azimDim3[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
        ['extern const int16_t defaultHRIR_rom_azim_start_idx[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
        'extern const int16_t defaultHRIR_rom_azimSegSamples[1];'
        ['extern const int16_t defaultHRIR_rom_azimShapeIdx[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
        ['extern const int16_t defaultHRIR_rom_azimShapeSampFactor[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
        'extern const int16_t defaultHRIR_rom_elevKSeq_Q;'
        ['extern const int16_t defaultHRIR_rom_elevKSeq[' int2str(length(mod_hrf_org.elevKSeq{1})) '];']
        'extern const int16_t defaultHRIR_rom_Alpha48_Q;'
        ['extern const int16_t defaultHRIR_rom_AlphaL48[' int2str(size(mod_hrf_org.WL{1}, 1)) ' * ' int2str(size(mod_hrf_org.WL{1}, 2)) '];']
        ['extern const int16_t defaultHRIR_rom_AlphaR48[' int2str(size(mod_hrf_org.WR{1}, 1)) ' * ' int2str(size(mod_hrf_org.WR{1}, 2)) '];']
        'extern const int16_t defaultHRIR_rom_Alpha32_Q;'
        ['extern const int16_t defaultHRIR_rom_AlphaL32[' int2str(size(mod_hrf_org.WL{1}, 1)) ' * ' int2str(ceil(32*size(mod_hrf_org.WL{1}, 2)/48)) '];']
        ['extern const int16_t defaultHRIR_rom_AlphaR32[' int2str(size(mod_hrf_org.WR{1}, 1)) ' * ' int2str(ceil(32*size(mod_hrf_org.WR{1}, 2)/48)) '];']
        'extern const int16_t defaultHRIR_rom_Alpha16_Q;'
        ['extern const int16_t defaultHRIR_rom_AlphaL16[' int2str(size(mod_hrf_org.WL{1}, 1)) ' * ' int2str(ceil(16*size(mod_hrf_org.WL{1}, 2)/48)) '];']
        ['extern const int16_t defaultHRIR_rom_AlphaR16[' int2str(size(mod_hrf_org.WR{1}, 1)) ' * ' int2str(ceil(16*size(mod_hrf_org.WR{1}, 2)/48)) '];']
        'extern const int16_t defaultHRIR_rom_E48_Q;'
        ['extern const int32_t defaultHRIR_rom_EL48[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WL{1}, 1)) '];']
        ['extern const int32_t defaultHRIR_rom_ER48[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WR{1}, 1)) '];']
        'extern const int16_t defaultHRIR_rom_E32_Q;'
        ['extern const int32_t defaultHRIR_rom_EL32[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WL{1}, 1)) '];']
        ['extern const int32_t defaultHRIR_rom_ER32[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WR{1}, 1)) '];']
        'extern const int16_t defaultHRIR_rom_E16_Q;'
        ['extern const int32_t defaultHRIR_rom_EL16[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WL{1}, 1)) '];']
        ['extern const int32_t defaultHRIR_rom_ER16[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WR{1}, 1)) '];']
        '#else'
        'extern const float defaultHRIR_rom_latency_s;'
        'extern const int16_t defaultHRIR_rom_model_configuration[6];'
        ['extern const int16_t defaultHRIR_rom_azimDim3[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
@@ -166,7 +136,6 @@ if dataSpec.genRomFile
        ['extern const uint32_t defaultHRIR_rom_ER32[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WR{1}, 1)) '];']
        ['extern const uint32_t defaultHRIR_rom_EL16[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WL{1}, 1)) '];']
        ['extern const uint32_t defaultHRIR_rom_ER16[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf_org.WR{1}, 1)) '];']
        '#endif'...
        }, newline));
    fprintf(fileID_h,'%s', h_file_content);
    
@@ -215,12 +184,7 @@ if dataSpec.genRomFile
    fileID_c = fopen(c_file_name,'at');
    
    c_file_content = string(join({
        '#ifdef FIX_1123_TDREN_16BIT_ROM'
        ['const int16_t defaultHRIR_rom_latency_s_Q = ' num2str(Q_latency) ';']
        ['const int32_t defaultHRIR_rom_latency_s = ' num2str(integer_latency) ';']
        '#else'
        ['const float defaultHRIR_rom_latency_s = ' num2str(single(mod.dat.hrf.hrf_latency),'%.9f') 'f;']
        '#endif'
        ''
        }, newline));
    fprintf(fileID_c,'%s', c_file_content);
@@ -577,16 +541,9 @@ for fs = [48000 32000 16000]
        arr_str_fx = replace(arr_str_fx,' ', ', ');
        
        c_file_content = ...
            ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
            'const int16_t defaultHRIR_rom_elevKSeq_Q = ' num2str( Q_elevKSeq) ';' newline ...
            'const int16_t defaultHRIR_rom_elevKSeq[' num2str(length(mod_hrf.elevKSeq{1})) '] = {' newline ...
            arr_str_fx ...
            newline '};' newline ...
            '#else' newline ...
            'const float defaultHRIR_rom_elevKSeq[' num2str(length(mod_hrf.elevKSeq{1})) '] = {' newline ...
            ['const float defaultHRIR_rom_elevKSeq[' num2str(length(mod_hrf.elevKSeq{1})) '] = {' newline ...
            arr_str ...
            newline '};' newline ...
            '#endif' newline ...
            ];
        
        fprintf(fileID_c,'%s', c_file_content);
@@ -638,17 +595,10 @@ for fs = [48000 32000 16000]
        arr_str_fx = arr_str_fx(2:end);
        arr_str_fx(end) = ';';
        arr_str_fx = replace(arr_str_fx, ";",', ');
        c_file_content = ...
            ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
            'const int16_t defaultHRIR_rom_elevBsShape_Q = ' num2str( Q_elevSplineShape_all) ';' newline ...
            'const int16_t defaultHRIR_rom_elevBsShape[' num2str(length(elevSplineShape_all)) '] = {' newline ...
            arr_str_fx ...
            newline '};' newline ...
            '#else' newline ...
        c_file_content = [...
            'const uint32_t defaultHRIR_rom_elevBsShape[' num2str(length(elevSplineShape_all)) '] = {' newline ...
            arr_str ...
            newline '};' newline ...
            '#endif' newline ...
            ];
        fprintf(fileID_c,'%s', c_file_content);
        
@@ -665,17 +615,10 @@ for fs = [48000 32000 16000]
        arr_str_fx = arr_str_fx(2:end);
        arr_str_fx(end) = ';';
        arr_str_fx = replace(arr_str_fx, ";",', ');
        c_file_content = ...
            ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
            'const int16_t defaultHRIR_rom_azimBsShape_Q = ' num2str( Q_azimSplineShape{n}) ';' newline ...
            'const int16_t defaultHRIR_rom_azimBsShape[' num2str(length(azimSplineShape{n})) '] = {' newline ...
            arr_str_fx ...
            newline '};' newline ...
            '#else' newline ...
        c_file_content = [...
            'const uint32_t defaultHRIR_rom_azimBsShape[' num2str(length(azimSplineShape{n})) '] = {' newline ...
            arr_str ...
            newline '};' newline ...
            '#endif' newline ...
            ];
        fprintf(fileID_c,'%s', c_file_content);
        fclose(fileID_c);
@@ -696,27 +639,7 @@ for fs = [48000 32000 16000]
        numIter = floor(size(mod_hrf.WL{1},1)*size(mod_hrf.WL{1},2)/numCol);
        numRemain = size(mod_hrf.WL{1},1)*size(mod_hrf.WL{1},2) - numCol * numIter;
        c_file_content = ...
            ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
            'const int16_t defaultHRIR_rom_Alpha' num2str(fs/1000) '_Q = ' num2str( Q_WL) ';' newline ...
            'const int16_t defaultHRIR_rom_AlphaL' num2str(fs/1000) '[' int2str(size(mod_hrf.WL{1}, 1)) ' * ' int2str(size(mod_hrf.WL{1}, 2)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
            arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : )));
            arr_str = arr_str(2:end);
            arr_str(end) = ';';
            arr_str = replace(arr_str, ";",', ');
            c_file_content = [ arr_str newline];
            fprintf(fileID_c,'%s', c_file_content);
        end
        arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : )));
        arr_str = arr_str(2:end);
        arr_str(end) = ';';
        arr_str = replace(arr_str, ";",', ');
        c_file_content = [ arr_str newline '};' newline];
        fprintf(fileID_c,'%s', c_file_content);
        c_file_content = ...
            ['#else' newline ...
            'const uint32_t defaultHRIR_rom_AlphaL' num2str(fs/1000) '[' int2str(size(mod_hrf.WL{1}, 1)) ' * ' int2str(size(mod_hrf.WL{1}, 2)) '] = {' newline ];
            ['const uint32_t defaultHRIR_rom_AlphaL' num2str(fs/1000) '[' int2str(size(mod_hrf.WL{1}, 1)) ' * ' int2str(size(mod_hrf.WL{1}, 2)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
            arr_str = join(mat2str(arr_str_all((ind-1) * numCol + 1 :ind * numCol, : )));
@@ -732,8 +655,7 @@ for fs = [48000 32000 16000]
        arr_str(end) = ';';
        arr_str = replace(arr_str, "';",',');
        arr_str = replace(arr_str, "'",'0x');
        c_file_content = [ arr_str newline '};' newline ...
            '#endif' newline];
        c_file_content = [ arr_str newline '};' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        
        
@@ -747,25 +669,7 @@ for fs = [48000 32000 16000]
        numIter = floor(size(mod_hrf.WR{1},1)*size(mod_hrf.WR{1},2)/numCol);
        numRemain = size(mod_hrf.WR{1},1)*size(mod_hrf.WR{1},2) - numCol * numIter;
        c_file_content = ...
            ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
            'const int16_t defaultHRIR_rom_AlphaR' num2str(fs/1000) '[' int2str(size(mod_hrf.WR{1}, 1)) ' * ' int2str(size(mod_hrf.WR{1}, 2)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
            arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : )));
            arr_str = arr_str(2:end);
            arr_str(end) = ';';
            arr_str = replace(arr_str, ";",', ');
            c_file_content = [ arr_str newline];
            fprintf(fileID_c,'%s', c_file_content);
        end
        arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : )));
        arr_str = arr_str(2:end);
        arr_str(end) = ';';
        arr_str = replace(arr_str, ";",', ');
        c_file_content = [ arr_str newline '};' newline];
        fprintf(fileID_c,'%s', c_file_content);
        c_file_content = ...
            ['#else' newline ...
            [ ...
            'const uint32_t defaultHRIR_rom_AlphaR' num2str(fs/1000) '[' int2str(size(mod_hrf.WR{1}, 1)) ' * ' int2str(size(mod_hrf.WR{1}, 2)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
@@ -782,8 +686,7 @@ for fs = [48000 32000 16000]
        arr_str(end) = ';';
        arr_str = replace(arr_str, "';",',');
        arr_str = replace(arr_str, "'",'0x');
        c_file_content = [ arr_str newline '};' newline ...
            '#endif' newline];
        c_file_content = [ arr_str newline '};' newline];
        fprintf(fileID_c,'%s', c_file_content);
        
        fclose(fileID_c);
@@ -855,27 +758,7 @@ for fs = [48000 32000 16000]
        numCol = 25;
        numIter = floor(HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1)/numCol);
        numRemain = HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1) - numCol * numIter;
        c_file_content = ...
            ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
            'const int16_t defaultHRIR_rom_E' num2str(fs/1000) '_Q = ' num2str( Q_EL) ';' newline ...
            'const int32_t defaultHRIR_rom_EL' num2str(fs/1000) '[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
            arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : )));
            arr_str = arr_str(2:end);
            arr_str(end) = ';';
            arr_str = replace(arr_str, ";",', ');
            c_file_content = [ arr_str newline];
            fprintf(fileID_c,'%s', c_file_content);
        end
        arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : )));
        arr_str = arr_str(2:end);
        arr_str(end) = ';';
        arr_str = replace(arr_str, ";",', ');
        c_file_content = [ arr_str newline '};' newline];
        fprintf(fileID_c,'%s', c_file_content);
        c_file_content = ...
            ['#else' newline ...
        c_file_content = [...
            'const uint32_t defaultHRIR_rom_EL' num2str(fs/1000) '[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
@@ -892,7 +775,7 @@ for fs = [48000 32000 16000]
        arr_str(end) = ';';
        arr_str = replace(arr_str, "';",',');
        arr_str = replace(arr_str, "'",'0x');
        c_file_content = [ arr_str newline '};' newline '#endif' newline];
        c_file_content = [ arr_str newline '};'];
        fprintf(fileID_c,'%s', c_file_content);
        
        if dataSpec.makeFxFltBE
@@ -905,27 +788,8 @@ for fs = [48000 32000 16000]
        numIter = floor(HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1)/numCol);
        numRemain = HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1) - numCol * numIter;
        
        c_file_content = ...
            ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
            'const int32_t defaultHRIR_rom_ER' num2str(fs/1000) '[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
            arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : )));
            arr_str = arr_str(2:end);
            arr_str(end) = ';';
            arr_str = replace(arr_str, ";",', ');
            c_file_content = [ arr_str newline];
            fprintf(fileID_c,'%s', c_file_content);
        end
        arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : )));
        arr_str = arr_str(2:end);
        arr_str(end) = ';';
        arr_str = replace(arr_str, ";",', ');
        c_file_content = [ arr_str newline '};' newline];
        fprintf(fileID_c,'%s', c_file_content);
        c_file_content = ...
            ['#else' newline ...
            'const uint32_t defaultHRIR_rom_ER' num2str(fs/1000) '[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ];
        c_file_content = [...
            newline 'const uint32_t defaultHRIR_rom_ER' num2str(fs/1000) '[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        for ind = 1: numIter
            arr_str = join(mat2str(arr_str_all((ind-1) * numCol + 1 :ind * numCol, : )));
@@ -941,7 +805,7 @@ for fs = [48000 32000 16000]
        arr_str(end) = ';';
        arr_str = replace(arr_str, "';",',');
        arr_str = replace(arr_str, "'",'0x');
        c_file_content = [ arr_str newline '};' newline '#endif' newline];
        c_file_content = [ arr_str newline '};' newline ];
        fprintf(fileID_c,'%s', c_file_content);
        
        fclose(fileID_c);
@@ -1003,28 +867,7 @@ for fs = [48000 32000 16000]
            numCol = 25;
            numIter = floor(length(mod_itd.W)/numCol);
            numRemain = length(mod_itd.W) - numCol * numIter;
            c_file_content = ...
                ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
                'const int16_t defaultHRIR_rom_ITD_W_Q = ' num2str(Q_itd_W) ';' newline ...
                'const int16_t defaultHRIR_rom_ITD_W[' num2str(length(mod_itd.W)) '] = {' newline ];
            fprintf(fileID_c,'%s', c_file_content);
            for ind = 1: numIter
                arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : )));
                arr_str = arr_str(2:end);
                arr_str(end) = ';';
                arr_str = replace(arr_str, ";",',');
                c_file_content = [ arr_str newline];
                fprintf(fileID_c,'%s', c_file_content);
            end
            arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : )));
            arr_str = arr_str(2:end);
            arr_str(end) = ';';
            arr_str = replace(arr_str, ";",',');
            c_file_content = [ arr_str newline '};' newline];
            fprintf(fileID_c,'%s', c_file_content);
            
            c_file_content = ...
                ['#else' newline ...
            c_file_content = [...
                'const uint32_t defaultHRIR_rom_ITD_W[' num2str(length(mod_itd.W)) '] = {' newline ];
            fprintf(fileID_c,'%s', c_file_content);
            for ind = 1: numIter
@@ -1041,7 +884,7 @@ for fs = [48000 32000 16000]
            arr_str(end) = ';';
            arr_str = replace(arr_str, "';",',');
            arr_str = replace(arr_str, "'",'0x');
            c_file_content = [ arr_str newline '};' newline '#endif' newline];
            c_file_content = [ arr_str newline '};' newline];
            fprintf(fileID_c,'%s', c_file_content);
            
            c_file_content = ...
@@ -1115,28 +958,7 @@ for fs = [48000 32000 16000]
            numCol = 25;
            numIter = floor(length(azimSplineShapeITD_all)/numCol);
            numRemain = length(azimSplineShapeITD_all) - numCol * numIter;
            c_file_content = ...
                ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
                'const int16_t defaultHRIR_rom_ITD_azimBsShape_Q = ' num2str(Q_azimSplineShapeITD_all) ';' newline ...
                'const int16_t defaultHRIR_rom_ITD_azimBsShape[' num2str(length(azimSplineShapeITD_all)) '] = {' newline ];
            fprintf(fileID_c,'%s', c_file_content);
            for ind = 1: numIter
                arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : )));
                arr_str = arr_str(2:end);
                arr_str(end) = ';';
                arr_str = replace(arr_str, ";",',');
                c_file_content = [ arr_str newline];
                fprintf(fileID_c,'%s', c_file_content);
            end
            arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : )));
            arr_str = arr_str(2:end);
            arr_str(end) = ';';
            arr_str = replace(arr_str, ";",',');
            c_file_content = [ arr_str newline '};' newline];
            fprintf(fileID_c,'%s', c_file_content);
            
            c_file_content = ...
                ['#else' newline ...
            c_file_content = [...
                'const uint32_t defaultHRIR_rom_ITD_azimBsShape[' num2str(length(azimSplineShapeITD_all)) '] = {' newline ];
            fprintf(fileID_c,'%s', c_file_content);
            for ind = 1: numIter
@@ -1153,7 +975,7 @@ for fs = [48000 32000 16000]
            arr_str(end) = ';';
            arr_str = replace(arr_str, "';",',');
            arr_str = replace(arr_str, "'",'0x');
            c_file_content = [ arr_str newline '};' newline '#endif' newline];
            c_file_content = [ arr_str newline '};' newline];
            fprintf(fileID_c,'%s', c_file_content);
            
            if dataSpec.makeFxFltBE
@@ -1169,16 +991,9 @@ for fs = [48000 32000 16000]
            arr_str_fx(end) = ' ';
            arr_str_fx = replace(arr_str_fx,' ', ', ');
            c_file_content = ...
                ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
                'const int16_t defaultHRIR_rom_ITD_azimKSeq_Q = ' num2str(Q_itd_azimKSeq) ';' newline ...
                'const int16_t defaultHRIR_rom_ITD_azimKSeq[' num2str(length(mod_itd.azimKSeq{2})) '] = {' newline ...
                arr_str_fx ...
                newline '};' newline ...
                '#else' newline ...
                'const float defaultHRIR_rom_ITD_azimKSeq[' num2str(length(mod_itd.azimKSeq{2})) '] = {' newline ...
                ['const float defaultHRIR_rom_ITD_azimKSeq[' num2str(length(mod_itd.azimKSeq{2})) '] = {' newline ...
                arr_str ...
                newline '};' newline '#endif' newline ...
                ];
                newline '};' newline];
            fprintf(fileID_c,'%s', c_file_content);
            
            if dataSpec.makeFxFltBE
@@ -1190,29 +1005,8 @@ for fs = [48000 32000 16000]
            numCol = 25;
            numIter = floor(length(elevSplineShapeITD_all)/numCol);
            numRemain = length(elevSplineShapeITD_all) - numCol * numIter;
            c_file_content = ...
                ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
                'const int16_t defaultHRIR_rom_ITD_elevBsShape_Q = ' num2str(Q_elevSplineShapeITD_all) ';' newline ...
                'const int16_t defaultHRIR_rom_ITD_elevBsShape[' num2str(length(elevSplineShapeITD_all)) '] = {' newline ];
            fprintf(fileID_c,'%s', c_file_content);
            for ind = 1: numIter
                arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : )));
                arr_str = arr_str(2:end);
                arr_str(end) = ';';
                arr_str = replace(arr_str, ";",',');
                c_file_content = [ arr_str newline];
                fprintf(fileID_c,'%s', c_file_content);
            end
            arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : )));
            arr_str = arr_str(2:end);
            arr_str(end) = ';';
            arr_str = replace(arr_str, ";",',');
            c_file_content = [ arr_str newline '};' newline];
            fprintf(fileID_c,'%s', c_file_content);

            c_file_content = ...
                ['#else' newline ...
                'const uint32_t defaultHRIR_rom_ITD_elevBsShape[' num2str(length(elevSplineShapeITD_all)) '] = {' newline ];
            c_file_content = ['const uint32_t defaultHRIR_rom_ITD_elevBsShape[' num2str(length(elevSplineShapeITD_all)) '] = {' newline ];
            fprintf(fileID_c,'%s', c_file_content);
            for ind = 1: numIter
                arr_str = join(mat2str(arr_str_all((ind-1) * numCol + 1 :ind * numCol, : )));
@@ -1228,7 +1022,7 @@ for fs = [48000 32000 16000]
            arr_str(end) = ';';
            arr_str = replace(arr_str, "';",',');
            arr_str = replace(arr_str, "'",'0x');
            c_file_content = [ arr_str newline '};' newline '#endif' newline];
            c_file_content = [ arr_str newline '};' newline];
            fprintf(fileID_c,'%s', c_file_content);
            
            if dataSpec.makeFxFltBE
@@ -1244,15 +1038,9 @@ for fs = [48000 32000 16000]
            arr_str_fx(end) = ' ';
            arr_str_fx = replace(arr_str_fx,' ', ', ');
            c_file_content = ...
                ['#ifdef FIX_1123_TDREN_16BIT_ROM' newline ...
                'const int16_t defaultHRIR_rom_ITD_elevKSeq_Q = ' num2str(Q_elevKSeq_itd) ';' newline ...
                'const int16_t defaultHRIR_rom_ITD_elevKSeq[' num2str(length(mod_itd.elevKSeq)) '] = {' newline ...
                arr_str_fx ...
                newline '};' newline ...
                '#else' newline ...
                'const float defaultHRIR_rom_ITD_elevKSeq[' num2str(length(mod_itd.elevKSeq)) '] = {' newline ...
                ['const float defaultHRIR_rom_ITD_elevKSeq[' num2str(length(mod_itd.elevKSeq)) '] = {' newline ...
                arr_str ...
                newline '};' newline '#endif' newline ...
                newline '};' newline ...
                ];
            fprintf(fileID_c,'%s', c_file_content);
            
@@ -1273,29 +1061,6 @@ end % fs loop

if dataSpec.genRomFile
    h_file_content = string(join({''
        '#ifdef FIX_1123_TDREN_16BIT_ROM'
        ['extern const int16_t defaultHRIR_rom_elevBsLen[' int2str(length(len_e)) '];']
        ['extern const int16_t defaultHRIR_rom_elevBsStart[' int2str(length(start_e)) '];']
        'extern const int16_t defaultHRIR_rom_elevBsShape_Q;'
        ['extern const int16_t defaultHRIR_rom_elevBsShape[' int2str(length(elevSplineShape_all)) '];']
        'extern const int16_t defaultHRIR_rom_azimBsShape_Q;'
        ['extern const int16_t defaultHRIR_rom_azimBsShape[' int2str(length(azimSplineShape{1})) '];']
        'extern const int16_t defaultHRIR_rom_ITD_W_Q;'
        ['extern const int16_t defaultHRIR_rom_ITD_W[' int2str(mod_itd.angleBfNum) '];']
        'extern const int16_t defaultHRIR_rom_ITD_azimBsShape_Q;'
        ['extern const int16_t defaultHRIR_rom_ITD_azimBsShape[' int2str(length(azimSplineShapeITD_all)) '];']
        'extern const int16_t defaultHRIR_rom_ITD_azimKSeq_Q;'
        ['extern const int16_t defaultHRIR_rom_ITD_azimKSeq[19];']
        'extern const int16_t defaultHRIR_rom_ITD_elevBsShape_Q;'
        ['extern const int16_t defaultHRIR_rom_ITD_elevBsShape[' int2str(length(elevSplineShapeITD_all)) '];']
        'extern const int16_t defaultHRIR_rom_ITD_elevKSeq_Q;'
        ['extern const int16_t defaultHRIR_rom_ITD_elevKSeq[16];']
        'extern const int16_t defaultHRIR_rom_ITD_model_configuration[4];'
        ['extern const int16_t defaultHRIR_rom_ITD_elevBsLen[' int2str(length(len_e_ITD)) '];']
        ['extern const int16_t defaultHRIR_rom_ITD_elevBsStart[' int2str(length(start_e_ITD)) '];']
        ['extern const int16_t defaultHRIR_rom_ITD_azimBsLen[' int2str(length(len_a_ITD)) '];']
        ['extern const int16_t defaultHRIR_rom_ITD_azimBsStart[' int2str(length(start_a_ITD))  '];']
        '#else'
        ['extern const int16_t defaultHRIR_rom_elevBsLen[' int2str(length(len_e)) '];']
        ['extern const int16_t defaultHRIR_rom_elevBsStart[' int2str(length(start_e)) '];']
        ['extern const uint32_t defaultHRIR_rom_elevBsShape[' int2str(length(elevSplineShape_all)) '];']
@@ -1311,7 +1076,6 @@ if dataSpec.genRomFile
        ['extern const int16_t defaultHRIR_rom_ITD_azimBsLen[' int2str(length(len_a_ITD)) '];']
        ['extern const int16_t defaultHRIR_rom_ITD_azimBsStart[' int2str(length(start_a_ITD))  '];']
        '#endif'
        '#endif'
        ''
        }, newline));