Commit d7125ade authored by lefort's avatar lefort
Browse files

Merge branch '744-fix-sofa-to-rom-tables-and-binaural-binary-files' of...

Merge branch '744-fix-sofa-to-rom-tables-and-binaural-binary-files' of https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec into 744-fix-sofa-to-rom-tables-and-binaural-binary-files
parents 7d578b52 ec3ff528
Loading
Loading
Loading
Loading
+83 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ variables:
    options:
      - 'default'
      - 'test-be-release'
      - 'test-long-self-test'


default:
@@ -46,6 +47,9 @@ workflow:
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-be-release'
      variables:
        IVAS_PIPELINE_NAME: 'Test BE to release pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test'
      variables:
        IVAS_PIPELINE_NAME: 'Test long self-test against main pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'trigger'

stages:
@@ -174,6 +178,8 @@ stages:
      when: never
    - if: $MANUAL_PIPELINE_TYPE == 'test-be-release' # Skip all the normal jobs when testing manually against release codec
      when: never
    - if: $MANUAL_PIPELINE_TYPE == 'test-long-self-test' # Skip all the normal jobs when testing manually against release codec
      when: never
    - when: on_success

.rules-merge-request:
@@ -385,6 +391,7 @@ codec-smoke-test:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - smoke_test_output.txt
      - smoke_test_output_plc.txt
@@ -409,6 +416,7 @@ codec-msan:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - scripts/ref/logs/
      - test_output.txt
@@ -431,6 +439,7 @@ codec-asan:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - scripts/ref/logs/
      - test_output.txt
@@ -454,6 +463,7 @@ codec-usan:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - scripts/ref/logs/
    expose_as: "usan selftest results"
@@ -859,7 +869,7 @@ clang-format-check:
    expire_in: 1 day
    paths:
      - tmp-formatting-fix/
    when: on_failure
    when: always
    name: "$ARTIFACT_BASE_NAME"
    expose_as: "formatting patch"

@@ -896,7 +906,7 @@ check-first-frame-is-sid:
  artifacts:
    paths:
      - out/logs
    when: on_failure
    when: always
    name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart"
    expose_as: "logs-sidstart"
    expire_in: "5 days"
@@ -1087,6 +1097,77 @@ test-be-to-release:
      - logs/
    expose_as: "test-be-to-release results"


test-long-self-test:
  tags:
    - ivas-linux-fast
  stage: compare
  resource_group: ivas-long-self-test-resource
  timeout: "50 minutes"
  rules:
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test'
  allow_failure:
    exit_codes:
      - 123
  script:
    - *print-common-info
    - *update-ltv-repo

    ### build branch binaries
    - cmake . -Bbuild-test
    - cmake --build build-test -- -j
    - mv build-test/IVAS_cod ./IVAS_cod
    - mv build-test/IVAS_dec ./IVAS_dec

    ### store the current commit hash
    - source_branch_commit_sha=$(git rev-parse HEAD)

    ### switch to main
    - git checkout main

    ### build main (ref) binaries
    - cmake . -Bbuild-ref
    - cmake --build build-ref -- -j
    - mv build-ref/IVAS_cod ./IVAS_cod_ref
    - mv build-ref/IVAS_dec ./IVAS_dec_ref

    ### Switch back to branch, this could probably be removed later
    - git checkout $source_branch_commit_sha

    ### prepare pytest

    # Copy test vectors from LTV to TESTV
    - cp "$LTV_DIR"/*.wav scripts/testv/
    - cp "$LTV_DIR"/*.met scripts/testv/
    - cp "$LTV_DIR"/*.csv scripts/testv/

    # create references
    - exit_code_ref=0
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_ltv.prm || exit_code_ref=$?

    ### run pytest self-test using long test vectors
    - exit_code=0
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_ltv.prm --html=report-ltv.html --self-contained-html --junit-xml=report-junit-ltv.xml || exit_code=$?
    - zero_errors=$(cat report-junit-ltv.xml | grep -c 'errors="0"') || true

    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi
    - exit 0


  artifacts:
    name: "test-long-self-test--sha-$CI_COMMIT_SHORT_SHA--results"
    when: always
    expire_in: 4 mos
    paths:
      - report-junit-ltv.xml
      - report-ltv.html
    expose_as: "test-long-self-test results"
    reports:
      junit:
        - report-junit-ltv.xml


# ---------------------------------------------------------------
# Scheduled jobs on main
# ---------------------------------------------------------------
+25 −0
Original line number Diff line number Diff line
<!--- Basic information that is useful -->
- Related issues:
- Requested reviewers: 

### Reason why this change is needed

* This may be a direct copy from the issue.

### Description of the change

* Describe what is done.

### Affected operating points

* Describe here as well as possible what operating points are affected and how
* In minimum, there should be a status for bitstream compatibility and output bit exactness
* For bitstream compatibility, the following levels are helpful for describing encoder
  1. Produced bitstream is BE compared to previous state.
  2. Produced bitstream is non-BE but it is fully backwards compatible for decoding. Decoded output may differ.
  3. Produced bitstream is non-BC. Old decoder cannot decode the produced bitstream correctly.
* For output difference, use BE or non-BE. Additionally, amount of difference can be presented.


<!--- By default, no labels are added as they often come from the issue. Add labels if there is no issue for this. -->
+57 −6
Original line number Diff line number Diff line
@@ -738,7 +738,11 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
#ifdef FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
#else
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#endif

        if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK )
        {
@@ -746,18 +750,41 @@ int main(
            goto cleanup;
        }

#ifdef FIX_BINARY_BINAURAL_READING
        if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            else
            {
                ivas_HRTF_binary_close( hHrtfTD );
            }
        }
#else
        if ( ( error = load_HRTF_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }
#endif

#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
        if ( ( error = load_reverb_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        if ( ( *hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_BINARY_BINAURAL_READING
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
#else
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
#endif
        }
#endif
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
        if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK )
@@ -768,9 +795,17 @@ int main(

        if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfFileName );
#ifdef FIX_BINARY_BINAURAL_READING
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
#else
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
#endif
        }

        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL;
        if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK )
@@ -781,8 +816,16 @@ int main(

        if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName );
#ifdef FIX_BINARY_BINAURAL_READING
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
#else
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
#endif
        }

        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL;
@@ -794,8 +837,16 @@ int main(

        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName );
#ifdef FIX_BINARY_BINAURAL_READING
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
#else
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
#endif
        }
    }

@@ -859,9 +910,9 @@ cleanup:

    if ( arg.hrtfReaderEnabled )
    {
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
        IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        dealloc_HRTF_binary( hHrtfTD );
        dealloc_HRTF_binary( *hHrtfTD );
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ typedef enum
    IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED,
#endif
    IVAS_ERR_INVALID_HRTF,
#ifdef FIX_BINARY_BINAURAL_READING
    IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA,
#endif
    IVAS_ERR_INVALID_INPUT_FORMAT,
    IVAS_ERR_INVALID_INDEX, /* ToDo: should be merged with IVAS_ERR_INDEX_OUT_OF_BOUNDS */
    IVAS_ERR_NOT_SUPPORTED_OPTION,
+22 −5
Original line number Diff line number Diff line
@@ -4522,8 +4522,11 @@ void ivas_spar_update_md_hist(
);

int16_t ivas_spar_chk_zero_coefs(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                     */
    Decoder_Struct *st_ivas                                    /* i/o: IVAS decoder handle                     */
#ifndef NONBE_FIX_698_SBA_MSAN
    ,
    const int16_t sba_order                                     /* i  : Ambisonic (SBA) order                   */
#endif
);

void ivas_spar_smooth_md_dtx(
@@ -4929,9 +4932,7 @@ void ivas_copy_band_coeffs_idx_to_arr(

void ivas_clear_band_coeffs( 
    ivas_band_coeffs_t *pband_coeffs,
    const uint16_t num_bands,
    const uint16_t num_ts

    const uint16_t num_bands
);

void ivas_clear_band_coeff_idx( 
@@ -5295,6 +5296,18 @@ void ivas_mc2sba(
    const float gain_lfe                                        /* i  : gain for LFE, 0=ignore LFE                      */
);

#ifdef NONBE_FIX_727_MC_PARAMUPMIX_HEADROTATION
void ivas_param_mc_mc2sba_cldfb(
    IVAS_OUTPUT_SETUP hTransSetup,                                                /* i  : transported MC Format                                       */
    float *hoa_encoder,                                                           /* i  : HOA3 encoder for the transported MC format                  */
    const int16_t slot_idx,                                                       /* i  : current slot in the subframe                                */
    float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */
    float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */
    const int16_t nBands,                                                         /* i  : number of synth CLDFB bands                                 */
    const float gain_lfe                                                          /* i  : gain applied to LFE                                        */
);
#endif

void ivas_ism2sba(
    float *buffer_td[],                                         /* i/o: TD signal buffers                               */
    ISM_RENDERER_HANDLE hIsmRendererData,                       /* i/o: renderer data                                   */
@@ -5651,6 +5664,10 @@ void ivas_osba_enc(
    const ISM_MODE ism_mode,                                    /* i  : ISM mode                                  */
    const int16_t sba_analysis_order,                           /* i  : SBA order evaluated in DirAC/SPAR encoder */
    const int32_t input_Fs                                      /* i  : input sampling rate                       */
#ifdef FIX_732_PLANAR_SBA_OSBA
    ,
    const int16_t sba_planar /* i : planar SBA flag*/
#endif
);

ivas_error ivas_masa_ism_data_open(
Loading