Commit d3d11bb8 authored by vaclav's avatar vaclav
Browse files

- Define time-scaler constants at one common place

- Remove initArgStruct() from the encoder and move the init to parseCmdlIVAS_enc() to follow the decoder structure
- Correct IVAS_MAX_OUTPUT_CHANNELS from 16 to 20
- avoid IVAS library includes in lib_util files
parent 53d119f9
Loading
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -943,6 +943,10 @@ static bool parseCmdlIVAS_dec(
    int16_t i;
    char argv_to_upper[FILENAME_MAX];

    /*-----------------------------------------------------------------*
     * Set default values
     *-----------------------------------------------------------------*/

#ifdef DEBUGGING
    float ftmp;

@@ -951,7 +955,7 @@ static bool parseCmdlIVAS_dec(
    arg->agcBitstream = NULL;
#endif
#endif
    arg->output_Fs = 48000;
    arg->output_Fs = IVAS_MAX_SAMPLING_RATE;
    arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
    arg->decMode = IVAS_DEC_MODE_IVAS;
    arg->quietModeEnabled = false;
@@ -1161,9 +1165,9 @@ static bool parseCmdlIVAS_dec(
                }
                arg->tsmScale = (uint16_t) tmp;

                if ( arg->tsmScale < 50 || arg->tsmScale > 150 )
                if ( arg->tsmScale < IVAS_TIME_SCALE_MIN || arg->tsmScale > IVAS_TIME_SCALE_MAX )
                {
                    fprintf( stderr, "Error: Scaling factor value must be 50 <= fac <= 150!\n\n" );
                    fprintf( stderr, "Error: Scaling factor value must be IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX!\n\n" );
                    usage_dec();
                    return false;
                }
@@ -1645,7 +1649,7 @@ static void usage_dec( void )
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
    fprintf( stdout, "-VS fac             : Variable Speed mode: change speed of playout fac as integer in percent.\n" );
    fprintf( stdout, "                      50 <= fac <= 150; fac<100 faster, fac>100 slower\n" );
    fprintf( stdout, "                      IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX; fac<100 faster, fac>100 slower\n" );
#endif
#endif
    fprintf( stdout, "-fr L               : render frame size in ms L=(5,10,20), default is 20)\n" );
+22 −26
Original line number Diff line number Diff line
@@ -154,7 +154,6 @@ typedef struct
 * Local functions prototypes
 *------------------------------------------------------------------------------------------*/

static void initArgStruct( EncArguments *arg );
static bool parseCmdlIVAS_enc( int16_t argc, char *argv[], EncArguments *arg );
static void usage_enc( void );
static bool readBandwidth( FILE *file, IVAS_ENC_BANDWIDTH *bandwidth, int32_t *bandwidthFrameCounter );
@@ -207,8 +206,6 @@ int main(
    reset_mem( USE_BYTES );
#endif

    initArgStruct( &arg );

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
     *------------------------------------------------------------------------------------------*/
@@ -878,14 +875,29 @@ cleanup:
 * Local functions
 *-------------------------------------------------------------------*/

#define IVAS_DEFAULT_AGC ( 0 )
/*---------------------------------------------------------------------*
 * parseCmdlIVAS_enc()
 *
 * Encoder command-line parsing
 *---------------------------------------------------------------------*/

static void initArgStruct( EncArguments *arg )
static bool parseCmdlIVAS_enc(
    int16_t argc,
    char *argv[],
    EncArguments *arg )
{
    /* Set default values here */
    int16_t i, j;
    char argv_to_upper[FILENAME_MAX];
    char stmp[FILENAME_MAX];
    int32_t tmp;

    /*-----------------------------------------------------------------*
     * Set default values
     *-----------------------------------------------------------------*/

    arg->inputWavFilename = NULL;
    arg->outputBitstreamFilename = NULL;
    arg->inputFs = 0;
    arg->inputFs = IVAS_MAX_SAMPLING_RATE;
    arg->inputFormat = IVAS_ENC_INPUT_MONO;
    arg->is_binaural = false;
    arg->inputFormatConfig.stereoToMonoDownmix = false;
@@ -919,25 +931,9 @@ static void initArgStruct( EncArguments *arg )
#endif
    arg->pca = false;

    return;
}


/*---------------------------------------------------------------------*
 * parseCmdlIVAS_enc()
 *
 * Encoder command-line parsing
 *---------------------------------------------------------------------*/

static bool parseCmdlIVAS_enc(
    int16_t argc,
    char *argv[],
    EncArguments *arg )
{
    int16_t i, j;
    char argv_to_upper[FILENAME_MAX];
    char stmp[FILENAME_MAX];
    int32_t tmp;
    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/

    if ( argc < 5 )
    {
+12 −4
Original line number Diff line number Diff line
@@ -45,17 +45,25 @@
 *----------------------------------------------------------------------------------*/

#define IVAS_NUM_FRAMES_PER_SEC 50                                                   /* number of frames per second */
#define IVAS_MAX_FRAME_SIZE     ( 48000 / IVAS_NUM_FRAMES_PER_SEC )  /* maximum frame buffer length (per channel) in samples; corresponds to maximum sampling rate of 48 kHz */
#define IVAS_MAX_SAMPLING_RATE  48000                                                /* maximum supported sampling rate in Hz */
#define IVAS_MAX_FRAME_SIZE     ( IVAS_MAX_SAMPLING_RATE / IVAS_NUM_FRAMES_PER_SEC ) /* maximum frame buffer length (per channel) in samples */
#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC )                 /* maximum bits per frame; corresponds to maximum bitrate of 512 kbps */

#define IVAS_MAX_NUM_OBJECTS       4
#define IVAS_MAX_INPUT_CHANNELS    16
#define IVAS_MAX_OUTPUT_CHANNELS   16
#define IVAS_MAX_OUTPUT_CHANNELS   20
#define IVAS_CLDFB_NO_COL_MAX      16
#define IVAS_CLDFB_NO_CHANNELS_MAX 60

/* Renderer constants */
#define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4
#define IVAS_ROOM_ABS_COEFF              6
#define IVAS_REVERB_PREDELAY_MAX         20 /* Max input delay for reverb module */
#define IVAS_ER_LIST_HEIGHT              1.6f

/* JBM constants for adaptive-playout */
#define IVAS_TIME_SCALE_MIN 50  /* min. time-scaling [%] */
#define IVAS_TIME_SCALE_MAX 150 /* max. time-scaling [%] */


/*----------------------------------------------------------------------------------*
+2 −5
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ typedef enum
#define MAX_INTERN_CHANNELS                     16                          /* Maximum number of intern channels (HOA 3rd order) */
#define HEAD_ROTATION_HOA_ORDER                 3                           /* HOA 3rd order */
#define MAX_CICP_CHANNELS                       16                          /* max channels for loudspeaker layouts (16 for custom layouts)*/
#define MAX_OUTPUT_CHANNELS                     16                          /* Maximum number of output channels (HOA 3rd order), == IVAS_MAX_OUTPUT_CHANNELS */
#define MAX_OUTPUT_CHANNELS                     16                          /* Maximum number of output channels (HOA 3rd order) without separate objects in combined formats */
#define MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN     2                           /* Maximum number of output channels with non diegetic panning */

#define BINAURAL_CHANNELS                       2                           /* number of channels for binaural output configuration */
@@ -1490,7 +1490,6 @@ typedef enum
#define HRTF_SH_CHANNELS                        HOA3_CHANNELS
#define HRTF_LS_CHANNELS                        15
#define HRTF_NUM_BINS                           60
#define REVERB_PREDELAY_MAX                     20                          /* Max input delay for reverb module */
#define GAIN_LFE                                1.88364911f                 /* Gain applied to LFE during renderering */
#define LOW_BIT_RATE_BINAURAL_EQ_BINS           17                          /* Number of bins in an EQ applied at low bit rates in binauralization */
#define LOW_BIT_RATE_BINAURAL_EQ_OFFSET         14                          /* Offset of bins where the low-bit-rate EQ starts*/
@@ -1722,9 +1721,7 @@ typedef enum
 *----------------------------------------------------------------------------------*/

#define ER_RADIUS                               (1.0f)
#define ER_LIST_ORIGIN_X                        (0.0f)
#define ER_LIST_ORIGIN_Y                        (0.0f)
#define ER_LIST_HEIGHT                          (1.6f)
#define ER_LIST_HEIGHT                          IVAS_ER_LIST_HEIGHT


/*----------------------------------------------------------------------------------*
+6 −6
Original line number Diff line number Diff line
@@ -39,9 +39,9 @@
#ifndef JBM_PCMDSP_APA_H
#define JBM_PCMDSP_APA_H JBM_PCMDSP_APA_H

#include "common_api_types.h"
#include <stdbool.h>
#include <stdint.h>
#include "options.h"


/*
********************************************************************************
@@ -50,17 +50,17 @@
*/

/* size of IO buffers (a_in[], a_out[]) for apa_exec() */
#define APA_BUF_PER_CHANNEL  ( 960 * 3 )
#define APA_BUF_PER_CHANNEL  ( IVAS_MAX_FRAME_SIZE * 3 )
#define APA_MAX_NUM_CHANNELS 16
#define APA_BUF              ( APA_BUF_PER_CHANNEL * APA_MAX_NUM_CHANNELS )

/* min/max sampling rate [Hz] */
#define APA_MIN_RATE 1000
#define APA_MAX_RATE 48000
#define APA_MAX_RATE IVAS_MAX_SAMPLING_RATE

/* min/max  scaling [%] */
#define APA_MIN_SCALE 50
#define APA_MAX_SCALE 150
#define APA_MIN_SCALE IVAS_TIME_SCALE_MIN
#define APA_MAX_SCALE IVAS_TIME_SCALE_MAX

#define APA_SM_SURROUND       1
#define APA_SM_LOGARITHMIC    2
Loading