Commit c535a205 authored by kinuthia's avatar kinuthia
Browse files

Merge branch 'main' into 821-update-usage-description-for-dpid-command-line-option

parents fe7a3dd7 d34b52f8
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1476,7 +1476,7 @@ coverage-test-on-main-scheduled:
  rules:
    # only run in scheduled pipeline that passes this env vars
    - if: $COVERAGE_TEST
  timeout: 2 hours
  timeout: 4 hours
  script:
    - *print-common-info
    - *update-ltv-repo
+1 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@
    <ClCompile Include="..\lib_com\ivas_fb_mixer.c" />
    <ClCompile Include="..\lib_com\ivas_filters.c" />
    <ClCompile Include="..\lib_com\ivas_ism_com.c" />
    <ClCompile Include="..\lib_com\ivas_lfe_com.c" />
    <ClCompile Include="..\lib_com\ivas_mcmasa_com.c" />
    <ClCompile Include="..\lib_com\ivas_dirac_com.c" />
    <ClCompile Include="..\lib_com\ivas_masa_com.c" />
+3 −0
Original line number Diff line number Diff line
@@ -469,6 +469,9 @@
    <ClCompile Include="..\lib_com\ivas_omasa_com.c">
      <Filter>common_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\ivas_lfe_com.c">
      <Filter>common_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_com\basop_proto_func.h">

lib_com/ivas_lfe_com.c

0 → 100644
+142 −0
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository. All Rights Reserved.

   This software is protected by copyright law and by international treaties.
   The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository retain full ownership rights in their respective contributions in
   the software. This notice grants no license of any kind, including but not limited to patent
   license, nor is any license granted by implication, estoppel or otherwise.

   Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

   Any dispute, controversy or claim arising under or in relation to providing this software shall be
   submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

#include <stdint.h>
#include "math.h"
#include "options.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "ivas_stat_com.h"
#include "prot.h"
#include "ivas_prot.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
#include "cnst.h"
#include <assert.h>
#include "wmc_auto.h"


/*-----------------------------------------------------------------------------------------*
 * Function ivas_lfe_lpf_select_filt_coeff()
 *
 * Selects LFE filter coeff based on config.
 *-----------------------------------------------------------------------------------------*/

void ivas_lfe_lpf_select_filt_coeff(
    const int32_t sampling_rate, /* i  : sampling rate          */
    const int16_t order,         /* i  : filter order           */
    const float **ppFilt_coeff   /* o  : filter coefficients    */
)
{
    switch ( order )
    {
        case IVAS_FILTER_ORDER_2:
            switch ( sampling_rate )
            {
                case 16000:
                    *ppFilt_coeff = ivas_lpf_2_butter_16k;
                    break;
                case 32000:
                    *ppFilt_coeff = ivas_lpf_2_butter_32k;
                    break;
                case 48000:
                    *ppFilt_coeff = ivas_lpf_2_butter_48k;
                    break;
                default:
                    break;
            }
            break;
        case IVAS_FILTER_ORDER_4:
            switch ( sampling_rate )
            {
                case 16000:
                    *ppFilt_coeff = ivas_lpf_4_butter_16k_sos;
                    break;
                case 32000:
                    *ppFilt_coeff = ivas_lpf_4_butter_32k_sos;
                    break;
                case 48000:
                    *ppFilt_coeff = ivas_lpf_4_butter_48k_sos;
                    break;
                default:
                    break;
            }
            break;
        default:
            assert( !"Unsupported LFE Filter order" );
    }

    return;
}


/*-----------------------------------------------------------------------------------------*
 * Function ivas_lfe_window_init()
 *
 * Initialize LFE window
 *-----------------------------------------------------------------------------------------*/

void ivas_lfe_window_init(
    LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle           */
    const int32_t sampling_rate,  /* i  : sampling rate               */
    const int16_t frame_len       /* i  : frame length in samples     */
)
{
    /* Set window coefficients */
    if ( sampling_rate == 48000 )
    {
        hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k;
    }
    else if ( sampling_rate == 32000 )
    {
        hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k;
    }
    else if ( sampling_rate == 16000 )
    {
        hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k;
    }
    else
    {
        assert( !"8kHz LFE Window not supported" );
    }

    /* 10ms stride, MDCT will be done in two iterations */
    hLFEWindow->dct_len = frame_len >> 1;

    /* 8ms of latency */
    hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS );
    hLFEWindow->zero_pad_len = (int16_t) ( IVAS_ZERO_PAD_LEN_MULT_FAC * ( hLFEWindow->dct_len - hLFEWindow->fade_len ) );
    hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len;

    return;
}
+84 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "options.h"
#include "prot.h"
#include "ivas_prot.h"
#include "ivas_rom_com.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
@@ -45,6 +46,10 @@
 * Local constants
 *------------------------------------------------------------------------------------------*/

#define IVAS_MDCT_SCALING_GAIN_48k 1.9699011974118126e-06f
#define IVAS_MDCT_SCALING_GAIN_32k 2.9548517961177197e-06f
#define IVAS_MDCT_SCALING_GAIN_16k 5.909703592235439e-06f

#define IVAS_IMDCT_SCALING_GAIN 2115.165304808f


@@ -296,3 +301,82 @@ void ivas_imdct(

    return;
}


/*-----------------------------------------------------------------------------------------*
 * Function ivas_get_twid_factors()
 *
 * Sets/Maps the fft twiddle tables based on fft length
 *-----------------------------------------------------------------------------------------*/

void ivas_get_twid_factors(
    const int16_t length,
    const float **pTwid_re,
    const float **pTwid_im )
{
    if ( length == 480 )
    {
        *pTwid_re = &ivas_cos_twiddle_480[0];
        *pTwid_im = &ivas_sin_twiddle_480[0];
    }
    else if ( length == 320 )
    {
        *pTwid_re = &ivas_cos_twiddle_320[0];
        *pTwid_im = &ivas_sin_twiddle_320[0];
    }
    else if ( length == 160 )
    {
        *pTwid_re = &ivas_cos_twiddle_160[0];
        *pTwid_im = &ivas_sin_twiddle_160[0];
    }
    else if ( length == 80 )
    {
        *pTwid_re = &ivas_cos_twiddle_80[0];
        *pTwid_im = &ivas_sin_twiddle_80[0];
    }
    else
    {
        assert( !"Not supported FFT length!" );
    }

    return;
}


/*-----------------------------------------------------------------------------------------*
 * Function ivas_get_mdct_scaling_gain()
 *
 * Get scaling gain for MDCT functions
 *-----------------------------------------------------------------------------------------*/

float ivas_get_mdct_scaling_gain(
    const int16_t dct_len_by_2 )
{
    float gain = 0.0f;

    switch ( dct_len_by_2 )
    {
        case L_FRAME48k >> 2:
        {
            gain = IVAS_MDCT_SCALING_GAIN_48k;
            break;
        }
        case L_FRAME32k >> 2:
        {
            gain = IVAS_MDCT_SCALING_GAIN_32k;
            break;
        }
        case L_FRAME16k >> 2:
        {
            gain = IVAS_MDCT_SCALING_GAIN_16k;
            break;
        }
        default:
        {
            assert( !"Unsupported frame length!" );
            break;
        }
    }

    return gain;
}
Loading