Skip to content
......@@ -59,9 +59,7 @@ struct IVAS_DEC_VOIP
uint16_t lastDecodedWasActive;
JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */
uint16_t *bs_conversion_buf; /* Buffer for bitstream conversion from packed to serial */
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
int16_t nSamplesRendered20ms; /* how many samples have been rendered since the last 20ms render border*/
#endif
#ifdef SUPPORT_JBM_TRACEFILE
IVAS_JBM_TRACE_DATA JbmTraceData;
#endif
......@@ -83,9 +81,7 @@ struct IVAS_DEC
bool Opt_VOIP; /* flag indicating VOIP mode with JBM */
int16_t tsm_scale; /* scale for TSM operation */
int16_t tsm_max_scaling;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
int16_t timeScalingDone; /* have we done already one TSM in a 20ms frame? */
#endif
float tsm_quality;
float *apaExecBuffer; /* Buffer for APA scaling */
PCMDSP_APA_HANDLE hTimeScaler;
......@@ -128,9 +124,7 @@ static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
static ivas_error ivas_dec_init_split_rend( Decoder_Struct *st_ivas );
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static int16_t get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize );
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered );
#endif
/*---------------------------------------------------------------------*
* IVAS_DEC_Open()
......@@ -167,9 +161,7 @@ ivas_error IVAS_DEC_Open(
hIvasDec->tsm_scale = 100;
hIvasDec->tsm_max_scaling = 0;
hIvasDec->tsm_quality = 1.0f;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
hIvasDec->timeScalingDone = 0;
#endif
hIvasDec->needNewFrame = false;
hIvasDec->nTransportChannelsOld = 0;
hIvasDec->nSamplesAvailableNext = 0;
......@@ -760,9 +752,7 @@ ivas_error IVAS_DEC_EnableVoIP(
hIvasDec->hVoIP->lastDecodedWasActive = 0;
hIvasDec->hVoIP->hCurrentDataUnit = NULL;
hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC );
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
hIvasDec->hVoIP->nSamplesRendered20ms = 0;
#endif
#define WMC_TOOL_SKIP
/* Bitstream conversion is not counted towards complexity and memory usage */
......@@ -1008,9 +998,7 @@ ivas_error IVAS_DEC_GetSamples(
assert( nTimeScalerOutSamples <= APA_BUF );
nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
hIvasDec->timeScalingDone = 1;
#endif
}
else
{
......@@ -1475,9 +1463,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples(
if ( hIvasDec->st_ivas->hTcBuffer != NULL )
{
*nSamplesBuffered = hIvasDec->st_ivas->hTcBuffer->n_samples_buffered - hIvasDec->st_ivas->hTcBuffer->n_samples_rendered;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
*nSamplesBuffered += hIvasDec->hVoIP->nSamplesRendered20ms;
#endif
}
return IVAS_ERR_OK;
......@@ -2598,9 +2584,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
uint32_t extBufferedTime_ms, scale, maxScaling;
JB4_DATAUNIT_HANDLE dataUnit;
uint16_t extBufferedSamples;
#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
int16_t timeScalingDone;
#endif
int16_t result;
ivas_error error;
int16_t nSamplesRendered;
......@@ -2609,9 +2592,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
st_ivas = hIvasDec->st_ivas;
hDecoderConfig = st_ivas->hDecoderConfig;
hVoIP = hIvasDec->hVoIP;
#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
timeScalingDone = 0;
#endif
nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out;
nSamplesRendered = 0;
......@@ -2635,11 +2615,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
}
}
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
extBufferedSamples = nSamplesBuffered;
#else
extBufferedSamples = nSamplesRendered + nSamplesBuffered;
#endif
extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs;
dataUnit = NULL;
......@@ -2662,20 +2638,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
/* avoid time scaling multiple times in one sound card slot */
if ( scale != 100U )
{
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
if ( hIvasDec->timeScalingDone )
#else
if ( timeScalingDone )
#endif
{
scale = 100;
}
#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
else
{
timeScalingDone = 1;
}
#endif
}
/* limit scale to range supported by time scaler */
......@@ -2760,9 +2726,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
nSamplesRendered += nSamplesToZero;
hIvasDec->nSamplesRendered += nSamplesToZero;
hIvasDec->nSamplesAvailableNext -= nSamplesToZero;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
update_voip_rendered20ms( hIvasDec, nSamplesToZero );
#endif
}
else
{
......@@ -2777,16 +2741,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
}
nSamplesRendered += nSamplesRendered_loop;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
update_voip_rendered20ms( hIvasDec, nSamplesRendered_loop );
#endif
}
}
return IVAS_ERR_OK;
}
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
/*---------------------------------------------------------------------*
* update_voip_rendered20ms( )
*
......@@ -2807,7 +2768,6 @@ static void update_voip_rendered20ms(
hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame;
}
#endif
/*---------------------------------------------------------------------*
* IVAS_DEC_VoIP_Flush( )
......@@ -2832,19 +2792,15 @@ ivas_error IVAS_DEC_Flush(
nSamplesToRender = (uint16_t) *nSamplesFlushed;
/* render IVAS frames */
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
error = IVAS_ERR_OK;
if ( nSamplesToRender > 0 && hIvasDec->st_ivas->ivas_format != MONO_FORMAT )
{
#endif
error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf );
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
}
else
{
*nSamplesFlushed = 0;
}
#endif
return error;
}
......
......@@ -183,7 +183,12 @@ void ivas_decision_matrix_enc(
st->core = ACELP_CORE;
}
#ifdef NONBE_1240_FIX_CORE_SELECTION_ISM_SW
/* sanity check: highest bitrates in ISM */
if ( st->is_ism_format && st->tcxonly && st->total_brate > MAX_ACELP_BRATE_ISM )
#else
if ( st->is_ism_format && st->tcxonly )
#endif
{
st->core = TCX_20_CORE;
}
......
......@@ -197,13 +197,27 @@ void ivas_mct_core_enc(
int16_t i, cpe_id, n, nAvailBits;
int16_t nCPE;
float *orig_spectrum[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */
#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC
float powerSpecMsInv_long_cpe0[CPE_CHANNELS][L_FRAME_PLUS];
float inv_spectrum_long_cpe0[CPE_CHANNELS][L_FRAME_PLUS];
float powerSpec_long_cpe0[CPE_CHANNELS][L_FRAME_PLUS];
float powerSpec_long[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k];
float inv_spectrum_long[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */
float powerSpecMsInv_long[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */
#else
float powerSpec[MCT_MAX_CHANNELS][L_FRAME48k];
float powerSpecMsInv_long[MCT_MAX_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */
#endif
#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC
float *powerSpec[MCT_MAX_CHANNELS];
#endif
float *powerSpecMsInv[MCT_MAX_CHANNELS][2];
float *inv_mdst_spectrum[MCT_MAX_CHANNELS][2];
float *inv_spectrum[MCT_MAX_CHANNELS][2];
float *mdst_spectrum[MCT_MAX_CHANNELS][2];
#ifndef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC
float inv_spectrum_long[MCT_MAX_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */
#endif
int16_t total_side_bits;
int16_t chBitRatios[MCT_MAX_CHANNELS];
Encoder_State *sts[MCT_MAX_CHANNELS];
......@@ -238,12 +252,34 @@ void ivas_mct_core_enc(
nCPE++;
}
#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC
/* point first CPE channels to longer buffers where switching from ACELP to TCX may occur in SBA with DTX (total memory saving)*/
for ( ch = 0; ch < CPE_CHANNELS; ch++ )
{
inv_mdst_spectrum[ch][0] = powerSpecMsInv[ch][0] = powerSpecMsInv_long_cpe0[ch];
inv_mdst_spectrum[ch][1] = powerSpecMsInv[ch][1] = powerSpecMsInv_long_cpe0[ch] + N_TCX10_MAX;
inv_spectrum[ch][0] = inv_spectrum_long_cpe0[ch];
inv_spectrum[ch][1] = inv_spectrum_long_cpe0[ch] + N_TCX10_MAX;
powerSpec[ch] = powerSpec_long_cpe0[ch];
}
for ( ch = CPE_CHANNELS; ch < nChannels; ch++ )
#else
for ( ch = 0; ch < nChannels; ch++ )
#endif
{
#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC
inv_mdst_spectrum[ch][0] = powerSpecMsInv[ch][0] = powerSpecMsInv_long[ch - CPE_CHANNELS];
inv_mdst_spectrum[ch][1] = powerSpecMsInv[ch][1] = powerSpecMsInv_long[ch - CPE_CHANNELS] + N_TCX10_MAX;
inv_spectrum[ch][0] = inv_spectrum_long[ch - CPE_CHANNELS];
inv_spectrum[ch][1] = inv_spectrum_long[ch - CPE_CHANNELS] + N_TCX10_MAX;
powerSpec[ch] = powerSpec_long[ch - CPE_CHANNELS];
#else
inv_mdst_spectrum[ch][0] = powerSpecMsInv[ch][0] = powerSpecMsInv_long[ch];
inv_mdst_spectrum[ch][1] = powerSpecMsInv[ch][1] = powerSpecMsInv_long[ch] + N_TCX10_MAX;
inv_spectrum[ch][0] = inv_spectrum_long[ch];
inv_spectrum[ch][1] = inv_spectrum_long[ch] + N_TCX10_MAX;
#endif
}
for ( cpe_id = 0, i = 0; cpe_id < nCPE; cpe_id++ )
......
......@@ -817,7 +817,11 @@ void mctStereoIGF_enc(
MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
Encoder_State **sts, /* i/o: encoder state structure */
float *orig_spectrum[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */
#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC
float *powerSpec[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate*/
#else
float powerSpec[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate*/
#endif
float *powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : same as above but for inverse spect.*/
float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */
const int16_t sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */
......
......@@ -473,9 +473,6 @@ static void ivas_osba_render_ism_to_sba(
int16_t azimuth, elevation;
float gains[MAX_INPUT_CHANNELS];
float g1, g2;
#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS
float output_gain;
#endif
int16_t nchan_sba;
......
......@@ -801,6 +801,10 @@ void stereo_switching_enc(
mvr2r( sts[0]->lsf_old1, sts[1]->lsf_old1, M );
mvr2r( sts[0]->lsp_old1, sts[1]->lsp_old1, M );
#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING
sts[1]->last_core_brate = sts[0]->last_core_brate;
#endif
sts[1]->GSC_noisy_speech = 0;
if ( hCPE->element_mode == IVAS_CPE_MDCT )
{
......
......@@ -442,7 +442,11 @@ void swb_pre_proc(
if ( st->last_extl != SWB_BWE && st->last_extl != FB_BWE )
{
/* resample 48 kHz to 32kHz */
#ifdef NONBE_1244_FIX_SWB_BWE_MEMORY
if ( ( st->last_bwidth == FB && st->element_mode == EVS_MONO ) || ( st->bwidth == FB && st->element_mode > EVS_MONO ) ) // note: once EVS i CR fixed, the condition will simplify to "if ( st->bwidth == FB )" only
#else
if ( st->last_bwidth == FB )
#endif
{
inner_frame = L_FRAME48k;
inner_Fs = 48000;
......
......@@ -1069,7 +1069,9 @@ void ivas_create_masa_out_meta(
float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : Estimated surround coherence */
)
{
#ifndef FIX_1121_MASA_DESCRIPTOR
const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */
#endif
int16_t i, sf, band;
uint8_t numFrequencyBands;
uint8_t numDirections;
......
......@@ -396,7 +396,11 @@ ivas_error ivas_td_binaural_renderer_unwrap(
}
/* Render subframe */
#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ) ) != IVAS_ERR_OK )
#else
if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx, ism_md_subframe_update ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......@@ -437,8 +441,12 @@ ivas_error TDREND_GetMix(
BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */
float *output[], /* i/o: ISM object synth / rendered output in 0,1 */
const int16_t subframe_length, /* i/o: subframe length */
#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */
#else
const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */
const int16_t ism_md_subframe_update /* i : Number of subframes to delay ism metadata to sync with audio */
#endif
)
{
int16_t i;
......@@ -450,10 +458,12 @@ ivas_error TDREND_GetMix(
float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH];
float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH];
int16_t intp_count;
#ifndef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
int16_t subframe_update_flag;
subframe_update_flag = subframe_idx == ism_md_subframe_update;
#endif
error = IVAS_ERR_OK;
/* Clear the output buffer to accumulate rendered sources */
......@@ -476,8 +486,13 @@ ivas_error TDREND_GetMix(
/* Update rendering params if needed */
if ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) )
{
#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev,
Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p );
#else
TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev,
Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_update_flag );
#endif
}
/* Render source if needed */
......
......@@ -261,8 +261,13 @@ void TDREND_firfilt(
/* Handle memory */
p_signal = buffer + filterlength - 1;
mvr2r( mem, buffer, filterlength - 1 ); /* Insert memory */
#ifdef NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR
mvr2r( signal, p_signal, subframe_length ); /* Insert current frame */
mvr2r( p_signal + subframe_length - filterlength + 1, mem, filterlength - 1 ); /* Update memory for next frame */
#else
mvr2r( signal, buffer + filterlength - 1, subframe_length ); /* Insert current frame */
mvr2r( signal + subframe_length - filterlength + 1, mem, filterlength - 1 ); /* Update memory for next frame */
#endif
/* Convolution */
for ( i = 0; i < subframe_length; i++ )
......
......@@ -289,8 +289,13 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
int16_t *filterlength, /* o : Length of filters */
int16_t *itd, /* o : ITD value */
float *Gain, /* o : Gain value */
#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
TDREND_SRC_t *Src_p /* i/o: Source pointer */
)
#else
TDREND_SRC_t *Src_p, /* i/o: Source pointer */
const int16_t subframe_update_flag )
#endif
{
TDREND_MIX_Listener_t *Listener_p;
TDREND_HRFILT_FiltSet_t *HrFiltSet_p;
......@@ -381,7 +386,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
Src_p->azim_prev = 360.0f; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */
}
#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
if ( ( *intp_count > 0 ) )
#else
if ( ( *intp_count > 0 ) && subframe_update_flag )
#endif
{
/* Set deltas for interpolation */
v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength );
......
......@@ -658,8 +658,12 @@ ivas_error TDREND_GetMix(
BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */
float *output[], /* i/o: ISM object synth/rendered output in 0,1 */
const int16_t subframe_length, /* i/o: subframe length */
#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */
#else
const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */
const int16_t ism_md_subframe_update /* i : Number of subframes to delay metadata to sync with audio */
#endif
);
ivas_error TDREND_Update_listener_orientation(
......@@ -750,8 +754,12 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
int16_t *filterlength, /* o : Length of filters */
int16_t *itd, /* o : ITD value */
float *Gain, /* o : Gain value */
#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION
TDREND_SRC_t *Src_p /* i/o: Source pointer */
#else
TDREND_SRC_t *Src_p,
const int16_t subframe_update_flag /* i : Flag to determine update subframe idx */
#endif
);
ivas_error TDREND_SRC_Alloc(
......
......@@ -35,6 +35,9 @@
#include "ivas_stat_com.h"
#include <stdlib.h>
#include <math.h>
#ifdef FIX_1121_MASA_DESCRIPTOR
#include "ivas_rom_com.h" /* load 'ivasmasaFormatDescriptor[8]' */
#endif
struct MasaFileReader
......@@ -111,7 +114,9 @@ ivas_error MasaFileReader_readNextFrame(
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
#ifndef FIX_1121_MASA_DESCRIPTOR
const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */
#endif
uint16_t twoByteBuffer = 0;
int16_t i, j, b;
IVAS_MASA_METADATA_HANDLE hMeta;
......
......@@ -3052,7 +3052,11 @@ ivas_error RenderConfigReader_getDirectivity(
}
}
/* case when -dpid is not specified, select first directivity pattern from config file */
#ifdef NONBE_1229_FIX_ISM1_DPID
if ( last_specified_id == 65535 )
#else
if ( n == 0 )
#endif
{
last_specified_id = (uint16_t) pRenderConfigReader->pDP[0].id;
}
......