Commit f48039bf authored by Jan Kiene's avatar Jan Kiene
Browse files

fix limiter switch and activate

parent b817a783
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
#include "options.h"
#include <math.h>
#include "prot.h"
#include "ivas_prot_rend.h"
#include "ivas_prot.h"
#include "wmc_auto.h"
#include <assert.h>

+32 −0
Original line number Diff line number Diff line
@@ -5922,6 +5922,38 @@ int16_t ivas_get_num_bands_from_bw_idx(
    const int16_t bwidth                                        /* i  : audio bandwidth                             */
);

#ifdef NONBE_FIX_1165_APPLY_LIMITER_ON_ENCODER_DMX
/*----------------------------------------------------------------------------------*
 * Limiter prototypes
 *----------------------------------------------------------------------------------*/

ivas_error ivas_limiter_open(
    IVAS_LIMITER_HANDLE *hLimiter_out,                          /* o  : limiter struct handle                   */
    const int16_t num_channels,                                 /* i  : number of I/O channels                  */
    const int32_t sampling_rate                                 /* i  : sampling rate for processing            */
);

void ivas_limiter_close(
    IVAS_LIMITER_HANDLE* phLimiter                              /* i/o: pointer to limiter handle, can be NULL  */
);

void ivas_limiter_apply
(
    IVAS_LIMITER_HANDLE hLimiter,                               /* i/o: limiter struct handle                                           */
    float *output[MAX_OUTPUT_CHANNELS],                         /* i/o: input/output buffer                                             */
    const int16_t num_channels,                                 /* i  : number of channels to be processed                              */
    const int16_t output_frame,                                 /* i  : number of samples per channel in the buffer                     */
    const int16_t BER_detect                                    /* i  : BER detect flag                                                 */
);

void limiter_process(
    IVAS_LIMITER_HANDLE hLimiter,                               /* i/o: limiter struct handle                                           */
    const int16_t output_frame,                                 /* i  : number of samples to be processed per channel in the I/O buffer */
    const float threshold,                                      /* i  : signal amplitude above which limiting starts to be applied      */
    const int16_t BER_detect,                                   /* i  : BER detect flag                                                 */
    int16_t *strong_saturation_cnt                              /* i/o: counter of strong saturations (can be NULL)                     */
);
#endif

/* clang-format on */

+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@
#define NONBE_FIX_1165_STATIC_SCAL_OSBA_PREREND         /* FhG: static scaling factor for pre-rendered OSBA modes */

#define NONBE_FIX_1165_STATIC_SCAL_PARAMMC              /* FhG: add static scaling to ParamMC DMX */
/*#define NONBE_FIX_1165_APPLY_LIMITER_ON_ENCODER_DMX*/     /* FhG: apply the limiter before the core encoder for formats with downmixing where the signal could exceed the 16-bit value range */
#define NONBE_FIX_1165_APPLY_LIMITER_ON_ENCODER_DMX     /* FhG: apply the limiter before the core encoder for formats with downmixing where the signal could exceed the 16-bit value range */

/* #################### End FIXES switches ############################ */

+2 −1
Original line number Diff line number Diff line
@@ -76,12 +76,12 @@ int16_t ivas_get_nchan_buffers_dec(
    const int16_t sba_analysis_order,                           /* i  : SBA order evaluated in SBA decoder              */
    const int32_t ivas_total_brate                              /* i  : total IVAS bitrate                              */
);
#ifndef NONBE_FIX_1165_APPLY_LIMITER_ON_ENCODER_DMX

/*----------------------------------------------------------------------------------*
 * Limiter prototypes
 *----------------------------------------------------------------------------------*/


ivas_error ivas_limiter_open(
    IVAS_LIMITER_HANDLE *hLimiter_out,                          /* o  : limiter struct handle                   */
    const int16_t num_channels,                                 /* i  : number of I/O channels                  */
@@ -108,6 +108,7 @@ void limiter_process(
    const int16_t BER_detect,                                   /* i  : BER detect flag                                                 */
    int16_t *strong_saturation_cnt                              /* i/o: counter of strong saturations (can be NULL)                     */
);
#endif

/*----------------------------------------------------------------------------------*
 * TD decorr. function prototypes