Commit 5808c9ae authored by TYAGIRIS's avatar TYAGIRIS
Browse files

Merge branch '400-disabling-agc-debugging-option' into 'main'

Resolve "Disabling AGC debugging option"

See merge request !639
parents 5b6f3912 35194e01
Loading
Loading
Loading
Loading
Loading

lib_com/options.h

100644 → 100755
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@
#endif
/*#define SPAR_HOA_DBG*/                        /* SPAR HOA debug statements */
/*#define DEBUG_BINAURAL_FILTER_DESIGN*/        /* debugging of Crend binaural filter design */
#define DEBUG_AGC_ENCODER_CMD_OPTION            /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */
//#define DEBUG_AGC_ENCODER_CMD_OPTION            /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */
#define DEBUG_JBM_CMD_OPTION                    /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */

#endif
+0 −4
Original line number Diff line number Diff line
@@ -196,7 +196,6 @@ class EncoderFrontend:
        sba_order: Optional[str] = None,
        dtx_mode: Optional[bool] = False,
        max_band: Optional[str] = None,
        agc_op: Optional[int] = None,
        bypass_mode: Optional[int] = None,
        quiet_mode: Optional[bool] = True,
        add_option_list: Optional[list] = None,
@@ -213,9 +212,6 @@ class EncoderFrontend:
        if max_band is not None:
            command.extend(["-max_band", max_band])

        if agc_op is not None:
            command.extend(["-agc", str(agc_op)])

        if bypass_mode is not None:
            command.extend(["-bypass", str(bypass_mode)])

+11 −9
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ plc_patterns = ['PLperc12mblen5', 'PLperc40mblen50', 'PLperc42mblen2']
dtx_set = ['0', '1']
ivas_br_list = ['13200','16400','32000', '64000', '96000', '256000']
sampling_rate_list = ['48', '32', '16']
agc_list = [-1, 0, 1]
gain_list = [0, 1]

AbsTol = '0'

@@ -73,7 +73,7 @@ def check_and_makedir(dir_path):
@pytest.mark.parametrize("tag", tag_list)
@pytest.mark.parametrize("plc_pattern", plc_patterns)
@pytest.mark.parametrize("fs", sampling_rate_list)
@pytest.mark.parametrize("agc", agc_list)
@pytest.mark.parametrize("gain_flag", gain_list)
def test_sba_plc_system(
    dut_decoder_frontend: DecoderFrontend,
    test_vector_path,
@@ -87,17 +87,19 @@ def test_sba_plc_system(
    tag,
    plc_pattern,
    fs,
    agc
    gain_flag
):
    SID = 0
    if dtx == '1' and ivas_br not in ['13200','16400','32000', '64000']:
    if dtx == '1' and ivas_br not in ['13200','16400','24400','32000', '64000']:
        # skip high bitrates for DTX until DTX issue is resolved
        pytest.skip()
    if ivas_br == '13200' or ivas_br == '16400':
        if dtx == '1' and agc == 0 and fs != '16':
        if dtx == '1' and gain_flag == 0 and fs != '16':
            SID = 1
        else:
            pytest.skip()
    if gain_flag == 1 and ivas_br not in ['13200','16400','24400','32000']:
        pytest.skip()
    tag = tag + fs + 'c'

    # dec
@@ -114,7 +116,7 @@ def test_sba_plc_system(
        SID,
        plc_pattern,
        update_ref,
        agc,
        gain_flag,
        keep_files,
    )

@@ -134,15 +136,15 @@ def sba_dec_plc(
    SID,
    plc_pattern,
    update_ref,
    agc,
    gain_flag,
    keep_files,
):

    # ------------  run cmd  ------------

    tag_out = f"{tag}_ivasbr{ivas_br[:-3]}k_DTX{dtx}"
    if agc != -1:
        tag_out += f'_AGC{agc}'
    if gain_flag == 1:
        tag_out += f'_Gain{gain_flag}'
    plc_tag_out = f"{tag_out}_{plc_pattern}"

    dut_out_dir = f"{dut_base_path}/sba_bs/raw"
+37 −35
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ ivas_br_HOA3 = ['256000', '384000', '512000']

sample_rate_list = ['48', '32', '16']
bypass_list = [1, 2]
agc_list = [-1, 0, 1]
gain_list = [0, 1]

sample_rate_bw_idx_list = [('48', 'SWB'), ('48', 'WB'), ('32', 'WB')]

@@ -101,7 +101,7 @@ def test_bypass_enc(
    ivas_br = '256000'
    dtx = '0'
    max_bw = "FB"
    agc = -1
    gain_flag = -1
    sba_order = "+1"
    output_config = "FOA"

@@ -120,9 +120,9 @@ def test_bypass_enc(
        None,
        max_bw,
        bypass,
        agc,
        sba_order,
        update_ref,
        gain_flag,
        cut_testv=True
    )

@@ -139,9 +139,9 @@ def test_bypass_enc(
        None,
        max_bw,
        bypass,
        agc,
        output_config,
        update_ref,
        gain_flag,
        keep_files,
    )

@@ -151,7 +151,7 @@ def test_bypass_enc(
@pytest.mark.parametrize("dtx", dtx_set)
@pytest.mark.parametrize("tag", tag_list)
@pytest.mark.parametrize("fs", sample_rate_list)
@pytest.mark.parametrize("agc", agc_list)
@pytest.mark.parametrize("gain_flag", gain_list)
def test_sba_enc_system(
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
@@ -167,25 +167,27 @@ def test_sba_enc_system(
    dtx,
    tag,
    fs,
    agc,
    gain_flag,
):
    SID = 0
    if dtx == '1' and ivas_br not in ['13200','16400','32000','64000']:
    if dtx == '1' and ivas_br not in ['13200','16400','24400','32000','64000']:
        # skip high bitrates for DTX until DTX issue is resolved
        pytest.skip()
    if ivas_br == 'sw_24k4_256k.bin' and agc != 1:
    if ivas_br == 'sw_24k4_256k.bin' and gain_flag != 1:
        pytest.skip()
    if ivas_br == '13200' or ivas_br == '16400':
        if dtx == '1' and agc == 0 and fs != '16':
        if dtx == '1' and gain_flag == 0 and fs != '16':
            SID = 1
        else:
            pytest.skip()
    if gain_flag == 1 and ivas_br not in ['13200','16400','24400','32000']:
        pytest.skip()
    tag = tag + fs + 'c'
    max_bw = "FB"
    bypass = -1
    sba_order = "+1"
    output_config = "FOA"
    if agc == 1:
    if gain_flag == 1:
        cut_gain = "16.0"
    elif dtx == '1':
        cut_gain = ".004"
@@ -206,9 +208,9 @@ def test_sba_enc_system(
        SID,
        max_bw,
        bypass,
        agc,
        sba_order,
        update_ref,
        gain_flag,
        cut_gain=cut_gain,
        create_dutenc=True,
        cut_testv=True
@@ -227,9 +229,9 @@ def test_sba_enc_system(
        SID,
        max_bw,
        bypass,
        agc,
        output_config,
        update_ref,
        gain_flag,
        keep_files,
    )

@@ -252,7 +254,7 @@ def test_spar_hoa2_enc_system(
):
    fs = '48'
    dtx = '0'
    agc = -1
    gain_flag = -1

    tag = tag + fs + 'c'
    max_bw = "FB"
@@ -275,9 +277,9 @@ def test_spar_hoa2_enc_system(
        None,
        max_bw,
        bypass,
        agc,
        sba_order,
        update_ref,
        gain_flag,
    )

    # dec
@@ -293,9 +295,9 @@ def test_spar_hoa2_enc_system(
        None,
        max_bw,
        bypass,
        agc,
        output_config,
        update_ref,
        gain_flag,
        keep_files,
    )

@@ -318,7 +320,7 @@ def test_spar_hoa3_enc_system(
):
    fs = '48'
    dtx = '0'
    agc = -1
    gain_flag = -1

    tag = tag + fs + 'c'
    max_bw = "FB"
@@ -341,9 +343,9 @@ def test_spar_hoa3_enc_system(
        None,
        max_bw,
        bypass,
        agc,
        sba_order,
        update_ref,
        gain_flag,
    )

    # dec
@@ -359,9 +361,9 @@ def test_spar_hoa3_enc_system(
        None,
        max_bw,
        bypass,
        agc,
        output_config,
        update_ref,
        gain_flag,
        keep_files,
    )

@@ -397,7 +399,7 @@ def test_sba_enc_BWforce_system(
    bw = sample_rate_bw_idx[1]
    tag = tag + fs + 'c'
    bypass = -1
    agc = -1
    gain_flag = -1
    sba_order = "+1"
    output_config = "FOA"

@@ -416,9 +418,9 @@ def test_sba_enc_BWforce_system(
        None,
        bw,
        bypass,
        agc,
        sba_order,
        update_ref,
        gain_flag,
        cut_testv=True
    )

@@ -435,9 +437,9 @@ def test_sba_enc_BWforce_system(
        None,
        bw,
        bypass,
        agc,
        output_config,
        update_ref,
        gain_flag,
        keep_files,
    )

@@ -458,9 +460,9 @@ def sba_enc(
    SID,
    ivas_max_bw,
    bypass,
    agc,
    sba_order,
    update_ref,
    gain_flag,
    cut_gain='1.0',
    create_dutenc=False,
    cut_testv=False
@@ -485,16 +487,18 @@ def sba_enc(
    if ivas_br == 'sw_24k4_256k.bin':
        ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin"   
    short_tag_ext = ""
    if agc != -1:
        short_tag_ext += f'_AGC{agc}'
    if gain_flag == 1:
        short_tag_ext += f'_Gain{gain_flag}'
    if SID == 1:
        short_tag_ext += f'_SID'
    # we update only bypass = 0/2 (bypass 1 is the same as the baseline)
    if bypass in [0, 2]:
        short_tag_ext += f"_pca{bypass}"
    # to avoid conflicting names in case of parallel test execution, differentiate all cases
    long_tag_ext = f"_AGC{agc}" if agc != -1 else "_AGC-unspecified"
    long_tag_ext += f"_pca{bypass}"
    if gain_flag == 1:
        long_tag_ext = f"_Gain{gain_flag}"
    else:
        long_tag_ext = f"_pca{bypass}"
    if SID == 1:
        long_tag_ext += f"_SID"
    dut_pkt_file = f"{dut_out_dir}/{tag_out}{long_tag_ext}.pkt"
@@ -505,7 +509,6 @@ def sba_enc(
        ref_pkt_file_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_cut.pkt"
        ref_pkt_file_dutenc_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc_cut.pkt"
    input_path = f"{test_vector_path}/{tag_in}{in_extension}"
    agc_op = agc if agc != -1 else None
    bypass_mode = bypass if bypass >= 0 else None
    dtx_mode = dtx == '1'

@@ -533,7 +536,6 @@ def sba_enc(
            ref_pkt_file,
            sba_order=sba_order,
            max_band=ivas_max_bw,
            agc_op=agc_op,
            bypass_mode=bypass_mode,
            dtx_mode=dtx_mode,
        )
@@ -546,7 +548,6 @@ def sba_enc(
                ref_pkt_file_dutenc,
                sba_order=sba_order,
                max_band=ivas_max_bw,
                agc_op=agc_op,
                bypass_mode=bypass_mode,
                dtx_mode=dtx_mode,
            )
@@ -560,7 +561,6 @@ def sba_enc(
            dut_pkt_file,
            sba_order=sba_order,
            max_band=ivas_max_bw,
            agc_op=agc_op,
            bypass_mode=bypass_mode,
            dtx_mode=dtx_mode,
        )
@@ -592,9 +592,9 @@ def sba_dec(
    SID,
    ivas_max_bw,
    bypass,
    agc,
    output_config,
    update_ref,
    gain_flag,
    keep_files,
):

@@ -607,16 +607,18 @@ def sba_dec(
    tag_out = f"{tag}_ivasbr{ivas_br[:-3]}k_DTX{dtx}"

    short_tag_ext = ""
    if agc != -1:
        short_tag_ext += f'_AGC{agc}'
    if gain_flag == 1:
        short_tag_ext += f'_Gain{gain_flag}'
    # we update only bypass = 0/2 (bypass 1 is the same as the baseline)
    if bypass in [0, 2]:
        short_tag_ext += f"_pca{bypass}"
    if SID == 1:
       short_tag_ext += f'_SID_cut'
    # to avoid conflicting names in case of parallel test execution, differentiate all cases
    long_tag_ext = f"_AGC{agc}" if agc != -1 else "_AGC-unspecified"
    long_tag_ext += f"_pca{bypass}"
    if gain_flag == 1:
        long_tag_ext = f"_Gain{gain_flag}"
    else:
        long_tag_ext = f"_pca{bypass}"
    if SID == 1:
        long_tag_ext += f"_SID_cut"
    dut_out_dir = f"{dut_base_path}/sba_bs/raw"