Commit 970d9969 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Text configuration format update for both C and Python

parent be1926c7
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2015,7 +2015,7 @@ ivas_error RenderConfigReader_read(
                        fgHasMethod = TRUE;
                    }
                    /* Read number of bands for individual frequency, start-hop-amount mode */
                    else if ( strcmp( item, "NBANDS" ) == 0 )
                    else if ( strcmp( item, "NRBANDS" ) == 0 )
                    {
                        if ( fgMode != FREQ_GRID_MODE_INDIVIDUAL_FREQUENCIES && fgMode != FREQ_GRID_MODE_START_HOP_AMOUNT )
                        {
+8 −1
Original line number Diff line number Diff line
@@ -204,7 +204,14 @@ def get_frequency_code(frequency):
    return code


def get_frequency_hop_code(index):
def get_frequency_hop_code(value):
    index = -1
    tolerance = 1e-5
    hop_sizes = [2 ** (1/12), 2 ** (1/6), 2 ** (1/4), 2 ** (1/3), 2 ** (1/2), 2 ** (1), 2 ** (2)]
    for idx, hop in enumerate(hop_sizes):
        if math.isclose(value, hop, rel_tol = tolerance):
            index = idx
            break
    assert 0 <= index <= 6
    return [
        '0010',       # 2^(1/12)
+7 −7
Original line number Diff line number Diff line
@@ -108,8 +108,8 @@ def parse_reverb_text_configuration_and_generate_binary_payload(file):
            data += bitarray(
                  fgdMethod.Start_Hop_Amount.value                                  # fgdMethod
                + get_count_or_index_code(eval_option(fg['nrBands']))               # fgdNrBands
                + get_frequency_code(eval_option(fg['centerFrequency']))            # fgdCenterFreq
                + get_frequency_hop_code(eval_option(fg['hop'])))                   # frequencyHop
                + get_frequency_code(eval_option(fg['startFrequency']))             # fgdCenterFreq
                + get_frequency_hop_code(eval_option(fg['frequencyHop'])))          # frequencyHop
        elif method == 'defaultBanding':
            data += bitarray(
                  fgdMethod.Default_Banding.value                                   # fgdMethod
@@ -134,11 +134,10 @@ def parse_reverb_text_configuration_and_generate_binary_payload(file):
            + concatenate(get_dsr_code, eval_option(ae['dsr']))                     # revDSR
            + get_bool_code('earlyReflectionsSize' in ae))                          # hasEarlyReflections
        if 'earlyReflectionsSize' in ae:
            assert len(eval_option(ae['absorptionCoefficients'])) == 6, 'wrong number of absorption coefficients'
            assert len(eval_option(ae['absorptionCoeffs'])) == 6, 'wrong number of absorption coefficients'
            data += bitarray(
                  concatenate(lambda d : get_distance_code(d, True), eval_option(ae['earlyReflectionsSize']))  # erSize
                + get_count_or_index_code(eval_option(ae['earlyReflectionsfrequencyGridIndex']))               # erFreqGridIdx
                + concatenate(get_absorption_code, eval_option(ae['absorptionCoefficients']))                  # erAbsCoeff
                + concatenate(get_absorption_code, eval_option(ae['absorptionCoeffs']))                        # erAbsCoeff
                + get_bool_code('listenerOrigin' in ae))                                                       # hasListenerOrigin
            if 'listenerOrigin' in ae:
                xyz = eval_option(ae['listenerOrigin'])
@@ -148,7 +147,8 @@ def parse_reverb_text_configuration_and_generate_binary_payload(file):
                      get_bool_code(xyz[0] >= 0)                                                               # isPositiveX
                    + get_bool_code(xyz[1] >= 0)                                                               # isPositiveY
                    + concatenate(lambda d : get_distance_code(d, True), [abs(v) for v in xyz]))               # erListenerOrigin
            data += bitarray(get_bool_code(bool(eval_option(ae['lowComplexity']))))                            # lowComplexity
            lowComplexity = bool(eval_option(ae['lowComplexity'])) if 'lowComplexity' in ae else False
            data += bitarray(get_bool_code(lowComplexity))                                                     # lowComplexity


    # parse directivity