Commit 14007ad4 authored by emerit's avatar emerit
Browse files

fix generateBE=true

parent 702d2dfa
Loading
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ if generateCustomBinaryFile == true
end

%% compute scaling factor and set floating point precision to int16_t
if generate_BE == false

FastConv_SHD_IR_FOA = FastConv_SHD_IR_FOA_float;
FastConv_SHD_IR_HOA2 = FastConv_SHD_IR_HOA2_float;
FastConv_SHD_IR_HOA3 = FastConv_SHD_IR_HOA3_float;
@@ -128,6 +128,8 @@ if generate_BE == false
[FastConv_SD_BRIR.IR, FastConv_SD_BRIR.factorQ] = make_be_with_fx(FastConv_SD_BRIR_float.IR,15);
[FastConv_SD_BRIR.rev_param.rt60, FastConv_SD_BRIR.rev_param.factorQ_rt60] = make_be_with_fx(FastConv_SD_BRIR_float.rev_param.rt60,15);
[FastConv_SD_BRIR.rev_param.nrgLr, FastConv_SD_BRIR.rev_param.factorQ_nrgLr] = make_be_with_fx(FastConv_SD_BRIR_float.rev_param.nrgLr,15);

if generate_BE == false
    if writeRomFileOutput
        write_fastconv_rom_table(rom_file, FastConv_SHD_IR_FOA, FastConv_SHD_IR_HOA2, FastConv_SHD_IR_HOA3, FastConv_SD_IR, FastConv_SD_BRIR);
    end
@@ -143,3 +145,4 @@ if writeBinaryOutput
        write_fastconv_binary_data_fx(ivas_path, bin_file, FastConv_SHD_IR_FOA, FastConv_SHD_IR_HOA2, FastConv_SHD_IR_HOA3, FastConv_SD_IR, FastConv_SD_BRIR);
    end
end
+16 −20
Original line number Diff line number Diff line
@@ -97,15 +97,13 @@ disp('Processing HRIR for parametric renderer...');
SHhrtf_float = generate_HRIR_in_SHD_CLDFB_PARAMETRIC(hrir_file, true);

%% compute scaling factor and set floating point precision to int16_t
if generate_BE == false
[SHhrtf, factorQ_SHhrtf] = make_be_with_fx(SHhrtf_float,15);
SHhrtf_fx = SHhrtf .* (2.^double(factorQ_SHhrtf));
end

if writeRomFileOutput
    if generate_BE
        writeData3L(fid, 'const float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]','%+ff', real(SHhrtf));
        writeData3L(fid, 'const float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]','%+ff', imag(SHhrtf));
        writeData3L(fid, 'const float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]','%+ff', real(SHhrtf_float));
        writeData3L(fid, 'const float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]','%+ff', imag(SHhrtf_float));
    else
        fprintf(fid, 'const int16_t hrtfShCoeffs_factorQ = %d;\n', factorQ_SHhrtf);
        writeData3L(fid, 'const int16_t hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]', '%d', real(SHhrtf_fx));
@@ -123,14 +121,12 @@ if generateCustomBinaryFile == true
end

%% compute scaling factor and ste floating point precision to int32_t
if generate_BE == false
[T60, factorQ_T60] = make_be_with_fx(T60_float,15);
[lateEnes, factorQ_lateEnes] = make_be_with_fx(lateEnes_float,15);
[earlyEnes, factorQ_earlyEnes] = make_be_with_fx(earlyEnes_float,15);
T60_fx = T60 .* (2.^double(factorQ_T60));
lateEnes_fx = lateEnes .* (2.^double(factorQ_lateEnes));
earlyEnes_fx = earlyEnes .* (2.^double(factorQ_earlyEnes));
end

if writeRomFileOutput
    % Write BRIR parameters to file
@@ -146,13 +142,13 @@ if writeRomFileOutput
        end
        if k < 60
            if generate_BE
                fprintf(fid, '%+ff,', T60(k));
                fprintf(fid, '%+ff,', T60_float(k));
            else
                fprintf(fid, '%d,', T60_fx(k));
            end
        else
            if generate_BE
                fprintf(fid, '%+ff\n};', T60(k));
                fprintf(fid, '%+ff\n};', T60_float(k));
            else
                fprintf(fid, '%d\n};', T60_fx(k));
            end
@@ -176,13 +172,13 @@ if writeRomFileOutput
        end
        if k < 60
            if generate_BE
                fprintf(fid, '%+ff,', lateEnes(k));
                fprintf(fid, '%+ff,', lateEnes_float(k));
            else
                fprintf(fid, '%d,', lateEnes_fx(k));
            end
        else
            if generate_BE
                fprintf(fid, '%+ff\n};', lateEnes(k));
                fprintf(fid, '%+ff\n};', lateEnes_float(k));
            else
                fprintf(fid, '%d\n};', lateEnes_fx(k));
            end
@@ -206,13 +202,13 @@ if writeRomFileOutput
        end
        if k < 60
            if generate_BE
                fprintf(fid, '%+ff,', earlyEnes(k));
                fprintf(fid, '%+ff,', earlyEnes_float(k));
            else
                fprintf(fid, '%d,', earlyEnes_fx(k));
            end
        else
            if generate_BE
                fprintf(fid, '%+ff\n};', earlyEnes(k));
                fprintf(fid, '%+ff\n};', earlyEnes_float(k));
            else
                fprintf(fid, '%d\n};', earlyEnes_fx(k));
            end