Commit 67a9f4cf authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 847-pcm-buffer-allocation-at-the-decoder

parents 5ce04862 6e82962a
Loading
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ typedef struct
    uint16_t numObjects;
    IsmFileReader *ismReaders[RENDERER_MAX_ISM_INPUTS];
    uint32_t numPositions[RENDERER_MAX_ISM_INPUTS];
    IVAS_REND_AudioObjectPosition *positions[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */
    IVAS_ISM_METADATA *positions[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */
    uint16_t *positionDurations[RENDERER_MAX_ISM_INPUTS];  /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */
    uint32_t currentPositionIdxs[RENDERER_MAX_ISM_INPUTS]; /* Index of current position as listed in the metadata file */
    uint16_t durationCounters[RENDERER_MAX_ISM_INPUTS];    /* Number of frames spent at current position */
@@ -123,7 +123,7 @@ typedef struct

typedef struct
{
    IVAS_REND_AudioObjectPosition positions[RENDERER_MAX_ISM_INPUTS];
    IVAS_ISM_METADATA positions[RENDERER_MAX_ISM_INPUTS];
    int16_t numObjects;
} ObjectPositionBuffer;

@@ -437,7 +437,7 @@ static int8_t parseUint32( const char *line, uint32_t *ret );

static int8_t parseInt32( const char *line, int32_t *ret );

static void parseObjectPosition( char *line, IVAS_REND_AudioObjectPosition *position, uint16_t *positionDuration );
static void parseObjectPosition( char *line, IVAS_ISM_METADATA *position, uint16_t *positionDuration );

static void parseMetadata( char *metadataString, char *inDir, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs );

@@ -3291,7 +3291,7 @@ static void parseOptionalInputValues(

static void parseObjectPosition(
    char *line,
    IVAS_REND_AudioObjectPosition *position,
    IVAS_ISM_METADATA *position,
    uint16_t *positionDuration )
{
    char *endptr;
@@ -3340,7 +3340,7 @@ static void parseIsm(
    if ( parseUint32( line, &numberOfObjectPositionsToRead ) == 0 )
    {
        positionProvider->numPositions[idx] = numberOfObjectPositionsToRead;
        positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) );
        positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_ISM_METADATA ) );
        positionProvider->positionDurations[idx] = malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) );

        for ( i = 0; i < numberOfObjectPositionsToRead; ++i )
+106 −102
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
#define IVAS_MAX_FRAME_SIZE     ( 48000 / IVAS_NUM_FRAMES_PER_SEC )

#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC )

#define IVAS_MAX_NUM_OBJECTS        4
#define IVAS_MAX_INPUT_CHANNELS     16
#define IVAS_MAX_OUTPUT_CHANNELS    16
@@ -55,14 +56,9 @@
#define IVAS_CLDFB_NO_CHANNELS_MAX  60
#define IVAS_MAX_INPUT_LFE_CHANNELS 4


#define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4

#define IVAS_ROOM_ABS_COEFF 6
#ifdef SPLIT_REND_WITH_HEAD_ROT
#define IVAS_MAX_SPLIT_REND_BITRATE                   768000
#define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 )
#endif

/*----------------------------------------------------------------------------------*
 * Common API enum for output audio configurations
@@ -100,7 +96,7 @@ typedef enum _IVAS_AUDIO_CONFIG


/*----------------------------------------------------------------------------------*
 * Common API structures
 * Common API structures and enums
 *----------------------------------------------------------------------------------*/

typedef enum _IVAS_ENC_FEC_INDICATOR
@@ -108,6 +104,7 @@ typedef enum _IVAS_ENC_FEC_INDICATOR
    IVAS_ENC_FEC_LO,
    IVAS_ENC_FEC_HI,
    IVAS_ENC_FEC_UNDEFINED = 0xffff

} IVAS_ENC_FEC_INDICATOR;

typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG
@@ -115,6 +112,7 @@ typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG
    int16_t channelAwareModeEnabled;
    IVAS_ENC_FEC_INDICATOR fec_indicator;
    int16_t fec_offset;

} IVAS_ENC_CHANNEL_AWARE_CONFIG;

typedef struct _IVAS_ISM_METADATA
@@ -127,6 +125,7 @@ typedef struct _IVAS_ISM_METADATA
    float yaw;
    float pitch;
    int16_t non_diegetic_flag;

} IVAS_ISM_METADATA;

typedef struct
@@ -135,7 +134,69 @@ typedef struct

} IVAS_QUATERNION;

typedef struct
{
    float x, y, z;

} IVAS_VECTOR3;

typedef enum
{
    IVAS_HEAD_ORIENT_TRK_NONE,
    IVAS_HEAD_ORIENT_TRK_REF,
    IVAS_HEAD_ORIENT_TRK_AVG,
    IVAS_HEAD_ORIENT_TRK_REF_VEC,
    IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV

} IVAS_HEAD_ORIENT_TRK_T;

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE;

typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE;
typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE;
typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE;
typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE;

typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE;
typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT;

typedef struct _IVAS_LS_CUSTOM_LAYOUT
{
    int16_t num_spk;
    float azimuth[IVAS_MAX_OUTPUT_CHANNELS];
    float elevation[IVAS_MAX_OUTPUT_CHANNELS];
    int16_t num_lfe;
    int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS];

} IVAS_CUSTOM_LS_DATA;

typedef struct _IVAS_JBM_TRACE_DATA
{
    uint32_t systemTimestamp_ms;
    uint16_t extBufferedSamples;
    uint16_t lastDecodedWasActive;
    int32_t output_Fs;
    int16_t dataUnit_flag;
    uint16_t sequenceNumber;
    uint32_t timeStamp;
    uint32_t rcvTime;

    int16_t partial_frame;
    int16_t partialCopyOffset;

} IVAS_JBM_TRACE_DATA;


#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------------------*
 * Split rendering API constants, structures, and enums
 *----------------------------------------------------------------------------------*/

#define IVAS_MAX_SPLIT_REND_BITRATE                   768000
#define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 )

typedef enum
{
    DEFAULT_AXIS,
@@ -145,12 +206,14 @@ typedef enum
    YAW_PITCH,
    YAW_ROLL,
    PITCH_ROLL

} IVAS_SPLIT_REND_ROT_AXIS;

typedef enum
{
    IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE,
    IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB,

} IVAS_SPLIT_REND_POSE_CORRECTION_MODE;

typedef enum
@@ -159,6 +222,7 @@ typedef enum
    IVAS_SPLIT_REND_CODEC_LC3PLUS,
    IVAS_SPLIT_REND_CODEC_DEFAULT, /* Will use LCLD for CLDFB rendering paths and LC3plus for TD rendering paths */
    IVAS_SPLIT_REND_CODEC_NONE

} IVAS_SPLIT_REND_CODEC;

typedef enum
@@ -168,6 +232,7 @@ typedef enum
    IVAS_SPLIT_REND_RENDERER_SELECTION_PARAMBIN,
    IVAS_SPLIT_REND_RENDERER_SELECTION_TDREND,
    IVAS_SPLIT_REND_RENDERER_SELECTION_DEFAULT,

} IVAS_SPLIT_REND_RENDERER_SELECTION;

typedef struct ivas_split_rend_bits_t
@@ -179,33 +244,32 @@ typedef struct ivas_split_rend_bits_t
    int16_t codec_frame_size_ms;
    IVAS_SPLIT_REND_CODEC codec;
    IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction;
} ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE;
#endif

typedef struct
{
    float x, y, z;
} IVAS_VECTOR3;
} ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE;

typedef enum
typedef struct _IVAS_SPLIT_REND_CONFIG
{
    IVAS_HEAD_ORIENT_TRK_NONE,
    IVAS_HEAD_ORIENT_TRK_REF,
    IVAS_HEAD_ORIENT_TRK_AVG,
    IVAS_HEAD_ORIENT_TRK_REF_VEC,
    IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV

} IVAS_HEAD_ORIENT_TRK_T;

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE;
    int32_t splitRendBitRate;    /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */
    int16_t hq_mode;             /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */
    int16_t dof;                 /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/
                                 /*The axis can be set dynamically per frame based on a file input */
                                 /*possible values:
                                 1 - (1dof correction. By default YAW correction)
                                 2 - (2dof correction. By default YAW and PITCH correction)
                                 3 - (3dof correction. By default YAW, PITCH and ROLL correction)
                                 */
    int16_t codec_delay_ms;      /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/
    int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */
    IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
    IVAS_SPLIT_REND_CODEC codec;
    IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection;

typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE;
typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE;
typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE;
} IVAS_SPLIT_REND_CONFIG_DATA;
#endif

typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE;
/*----------------------------------------------------------------------------------*
 * Renderer API structures and enums
 *----------------------------------------------------------------------------------*/

#ifdef DEBUGGING
typedef enum
@@ -213,20 +277,10 @@ typedef enum
    IVAS_RENDER_TYPE_OVERRIDE_NONE,
    IVAS_RENDER_TYPE_OVERRIDE_CREND,
    IVAS_RENDER_TYPE_OVERRIDE_FASTCONV

} IVAS_RENDER_TYPE_OVERRIDE;
#endif

typedef struct
{
    float azimuth;
    float elevation;
    float radius;
    float yaw;
    float pitch;
    int16_t non_diegetic_flag;

} IVAS_REND_AudioObjectPosition;

typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
{
    int16_t override;
@@ -246,27 +300,6 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG

} IVAS_ROOM_ACOUSTICS_CONFIG_DATA;

#ifdef SPLIT_REND_WITH_HEAD_ROT

typedef struct _IVAS_SPLIT_REND_CONFIG
{
    int32_t splitRendBitRate;    /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */
    int16_t hq_mode;             /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */
    int16_t dof;                 /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/
                                 /*The axis can be set dynamically per frame based on a file input */
                                 /*possible values:
                                 1 - (1dof correction. By default YAW correction)
                                 2 - (2dof correction. By default YAW and PITCH correction)
                                 3 - (3dof correction. By default YAW, PITCH and ROLL correction)
                                 */
    int16_t codec_delay_ms;      /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/
    int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */
    IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
    IVAS_SPLIT_REND_CODEC codec;
    IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection;
} IVAS_SPLIT_REND_CONFIG_DATA;
#endif

typedef struct _IVAS_RENDER_CONFIG
{
#ifdef DEBUGGING
@@ -277,36 +310,7 @@ typedef struct _IVAS_RENDER_CONFIG
    IVAS_SPLIT_REND_CONFIG_DATA split_rend_config;
#endif
    float directivity[IVAS_MAX_NUM_OBJECTS * 3];
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

typedef struct _IVAS_LS_CUSTOM_LAYOUT
{
    int16_t num_spk;
    float azimuth[IVAS_MAX_OUTPUT_CHANNELS];
    float elevation[IVAS_MAX_OUTPUT_CHANNELS];
    int16_t num_lfe;
    int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS];

} IVAS_CUSTOM_LS_DATA;

typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE;
typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT;


typedef struct _IVAS_JBM_TRACE_DATA
{
    uint32_t systemTimestamp_ms;
    uint16_t extBufferedSamples;
    uint16_t lastDecodedWasActive;
    int32_t output_Fs;
    int16_t dataUnit_flag;
    uint16_t sequenceNumber;
    uint32_t timeStamp;
    uint32_t rcvTime;

    int16_t partial_frame;
    int16_t partialCopyOffset;

} IVAS_JBM_TRACE_DATA;
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

#endif /* COMMON_API_TYPES_H */
+3 −4
Original line number Diff line number Diff line
@@ -30,14 +30,13 @@

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

/* options.h needed for debugging/development features
 * It should be stripped for delivery along with debugging switches */
#include "options.h"

#include "ivas_error.h"
#include <assert.h>
#include <stdarg.h>
#include <stdint.h>

#include "ivas_error.h"

#ifdef DEBUGGING
#include <stdio.h>
#endif
+4 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@
#define NONBE_FIX_809_EXTERNAL_TARGET_INTERPOLATION           /* FhG: issue 809: unify external target interpolation inter and intra frame behaviour */
#define NONBE_FIX_775_OSBA_BR_SWITCHING_CRASH                 /* FhG: issue 775: fix crash in OSBA with bitrate switching and output order lower than input order */
#define NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS             /* FhG: issue #827: Resolve "JBM Crend early reflections are wrong" */
#define NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS                   /* Fhg: issue #833: Resolve "JBM OSBA: the gains for the discrete objects are not computed" */
#define JBM_FOR_OSBA                                          /* FhG: implement OSBA format in the JBM path */
#ifdef JBM_FOR_OSBA
#define OSBA_ROOM_IR
@@ -190,6 +191,9 @@
#define NONBE_FIX_825_SBA_JBM_MONO_STEREO_OUTPUT              /* FhG: issue #825: Resolve "JBM SBA: AGC and PCA run twice for MONO and STEREO output"   */
#define NONBE_FIX_808_JBM_PARAMUPMIX_RS                       /* FhG: Issue 808: fix JBM MC rate switching */
#define NONBE_FIX_846_JBM_MASA_SIDSTART                       /* FhG: Issue #846: fix JBM for MASA DTX when the first frame is a SID frame */
#define NONBE_FIX_841_MC_RS_TDOBJ_RENDERER                    /* FhG: Issue #841: [Non-BE] Resolve "MC RS HRFT handle not set to NULL" */
#define NONBE_FIX_840_PARAMMC_RS                              /* FhG: Issue #840: Resolve "MC RS ParamMC hoa encoder wrongly set to zero" */
#define NONBE_FIX_826_JBM_MASA_CNA_CNG                        /* FhG: issue #826:  Resolve "JBM MASA: CNA and CNG not in sync with non-JBM decoding" */

/* ##################### End NON-BE switches ########################### */

+20 −3
Original line number Diff line number Diff line
@@ -996,6 +996,11 @@ void ivas_ism_dec_digest_tc(
         st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ||
         st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ||
         st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
#ifdef NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS
         st_ivas->renderer_type == RENDERER_OSBA_AMBI ||
         st_ivas->renderer_type == RENDERER_OSBA_LS ||
         st_ivas->renderer_type == RENDERER_OSBA_STEREO ||
#endif
         ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->hDecoderConfig->Opt_Headrotation == 0 ) )
    {
        int16_t i, num_objects;
@@ -1006,7 +1011,11 @@ void ivas_ism_dec_digest_tc(
        if ( ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) == st_ivas->hTcBuffer->n_samples_available )
        {
            int16_t interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
            if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
            if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ||
#ifdef NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS
                 st_ivas->renderer_type == RENDERER_OSBA_AMBI ||
#endif
                 st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
            {
                st_ivas->hIsmRendererData->interpolator[0] = 0.0f;
                for ( i = 1; i < interpolator_length; i++ )
@@ -1043,7 +1052,11 @@ void ivas_ism_dec_digest_tc(
                azimuth = (int16_t) floorf( st_ivas->hIsmMetaData[i]->azimuth + 0.5f );
                elevation = (int16_t) floorf( st_ivas->hIsmMetaData[i]->elevation + 0.5f );

                if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) &&
                if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING ||
#ifdef NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS
                       st_ivas->renderer_type == RENDERER_OSBA_LS ||
#endif
                       st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) &&
                     st_ivas->hCombinedOrientationData == NULL )
                {
                    if ( st_ivas->hIntSetup.is_planar_setup )
@@ -1057,7 +1070,11 @@ void ivas_ism_dec_digest_tc(
                        efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], azimuth, elevation, EFAP_MODE_EFAP );
                    }
                }
                else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
                else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ||
#ifdef NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS
                          st_ivas->renderer_type == RENDERER_OSBA_AMBI ||
#endif
                          st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
                {
                    /*get HOA gets for direction (ACN/SN3D)*/
                    ivas_dirac_dec_get_response( azimuth, elevation, st_ivas->hIsmRendererData->gains[i], st_ivas->hIntSetup.ambisonics_order );
Loading