Commit f85ff450 authored by vaclav's avatar vaclav
Browse files

fix

parent 3912e625
Loading
Loading
Loading
Loading
Loading
+76 −39
Original line number Diff line number Diff line
@@ -294,12 +294,14 @@ ivas_error IVAS_DEC_Open(
        move16();
        move16();
        move16();

        return IVAS_ERR_OK;
    }

    return IVAS_ERR_WRONG_PARAMS;
}


/*-------------------------------------------------------------------------*
 * isar_set_split_rend_setup()
 *
@@ -321,6 +323,14 @@ static ivas_error isar_set_split_rend_setup(
    splitRendBits->codec_frame_size_ms = 0;
    splitRendBits->isar_frame_size_ms = 0;
    splitRendBits->lc3plus_highres = 0;
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();

#ifndef TMP_FIX_SPLIT_REND
    IF( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL )
@@ -339,6 +349,7 @@ static ivas_error isar_set_split_rend_setup(
    return IVAS_ERR_OK;
}


/*---------------------------------------------------------------------*
 * init_decoder_config()
 *
@@ -747,17 +758,20 @@ ivas_error IVAS_DEC_SetRenderFramesize(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    hIvasDec->st_ivas->hDecoderConfig->render_framesize = render_framesize;
    move16();

    IF( hIvasDec->st_ivas->hExtOrientationData != NULL )
    {
        hIvasDec->st_ivas->hExtOrientationData->num_subframes = (Word16) render_framesize;
        move16();
    }

    IF( hIvasDec->st_ivas->hCombinedOrientationData != NULL )
    {
        hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (Word16) render_framesize;
    }

    hIvasDec->st_ivas->hDecoderConfig->render_framesize = render_framesize;
        move16();
    }

    return IVAS_ERR_OK;
}
@@ -818,10 +832,12 @@ static Word16 get_render_frame_size_samples(
    {
        tmp = 0;
    }

    return tmp;
}
#endif


/*---------------------------------------------------------------------*
 * IVAS_DEC_GetGetRenderFramesizeSamples( )
 *
@@ -871,6 +887,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples(
    return IVAS_ERR_OK;
}


/*---------------------------------------------------------------------*
 * IVAS_DEC_GetGetRenderFramesizeMs( )
 *
@@ -895,6 +912,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs(
    return IVAS_ERR_OK;
}


/*---------------------------------------------------------------------*
 * IVAS_DEC_GetGetReferencesUpdateFrequency( )
 *
@@ -1320,6 +1338,8 @@ static ivas_error isar_generate_metadata_and_bitstream(
        move16();
    }

    IF( cldfb_in_flag )
    {
        n_samples_in_cldfb_slot = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
        assert( nSamples % n_samples_in_cldfb_slot == 0 );
        num_cldfb_slots = int_div_s_x( nSamples, n_samples_in_cldfb_slot );
@@ -1327,8 +1347,6 @@ static ivas_error isar_generate_metadata_and_bitstream(
        num_poses = hSplitBinRend->splitrend.multiBinPoseData.num_poses;
        move16();

    IF( cldfb_in_flag )
    {
        FOR( i = 0; i < imult1616( BINAURAL_CHANNELS, num_poses ); ++i )
        {
            FOR( j = 0; j < num_cldfb_slots; ++j )
@@ -1348,8 +1366,12 @@ static ivas_error isar_generate_metadata_and_bitstream(
    ELSE
    {
        ivas_TD_RINGBUF_PopChannels( st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, nSamples );
    }

        num_cldfb_slots = 0; // just to avoid compilation warning
        num_poses = 0;       // just to avoid compilation warning
        move16();
        move16();
    }

    IF( st_ivas->hBinRendererTd != NULL )
    {
@@ -1470,7 +1492,7 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
{
    ivas_error error;
    UWord16 nSamplesRendered, nSamplesRendered_loop;
    UWord16 nOutChannels;
    UWord8 nOutChannels;
    Decoder_Struct *st_ivas;

    nSamplesRendered = 0;
@@ -1531,11 +1553,12 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
        move16();
        move16();
        move16();

        return IVAS_ERR_OK;
    }

    test();
    /* check if we are still at the beginning with bad frames, put out zeroes, keep track of subframes */
    test();
    IF( !hIvasDec->isInitialized && st_ivas->bfi )
    {
        hIvasDec->hasBeenFedFrame = false;
@@ -1681,7 +1704,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
            ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToOutput, st_ivas->BER_detect, Q11 );
        }

        ivas_syn_output_fx( p_head_pose_buf, Q11, numSamplesPerChannelToOutput, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out );
        ivas_syn_output_fx( p_head_pose_buf, Q11, numSamplesPerChannelToOutput, st_ivas->hDecoderConfig->nchan_out, pcmBuf_out );
    }
#else
    Decoder_Struct *st_ivas;
@@ -4387,6 +4410,7 @@ ivas_error IVAS_DEC_SetEditableParameters(
                move32();
                st_ivas->hParamIsmDec->edited_elevation_values_fx[obj] = hIvasEditableParameters.ism_metadata[obj].elevation_fx;
                move32();

                IF( st_ivas->hMasaIsmData != NULL )
                {
#ifdef FIX_GAIN_EDIT_LIMITS
@@ -4786,7 +4810,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples
            IF( hIvasDec->hasBeenFedFirstGoodFrame )
            {
                /* check if the TC buffer already exists, otherweise nothing is buffered anyway */

                IF( st_ivas->hTcBuffer != NULL )
                {
                    nSamplesBuffered = sub( st_ivas->hTcBuffer->n_samples_buffered, st_ivas->hTcBuffer->n_samples_rendered );
@@ -4956,6 +4979,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples
                    move16();
                    *parametersAvailableForEditing = true;
                    move16();

                    return IVAS_ERR_OK;
                }
            }
@@ -5028,7 +5052,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples
                ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect, Q11 );
            }

            ivas_syn_output_fx( p_head_pose_buf, Q11, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf );
            ivas_syn_output_fx( p_head_pose_buf, Q11, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, pcmBuf );
        }
    }
#endif
@@ -5104,6 +5128,7 @@ ivas_error IVAS_DEC_VoIP_GetSplitBinauralBitstream(
    Word32 *pp_head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES];
    ivas_error error = IVAS_ERR_UNKNOWN;
    Word16 nSamplesPerChannel = 0;
    move16();

    IF( NE_32( ( error = IVAS_DEC_GetRenderFramesizeSamples( hIvasDec, &nSamplesPerChannel ) ), IVAS_ERR_OK ) )
    {
@@ -5300,8 +5325,8 @@ static void ivas_destroy_handle_VoIP_fx(
    return;
}


#ifdef SUPPORT_JBM_TRACEFILE

/*---------------------------------------------------------------------*
 * store_JbmData()
 *
@@ -5378,7 +5403,6 @@ ivas_error IVAS_DEC_GetJbmData(

#endif


/*---------------------------------------------------------------------*
 * IVAS_DEC_GetErrorMessage( )
 *
@@ -5756,23 +5780,8 @@ static ivas_error evs_dec_main_fx(
    IF( st_ivas->hDecoderConfig->Opt_tsm )
#endif
    {
        /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */ // TODO: verify if it is still needed and if it works well for EVS stereo panning output
#ifdef JBM_MEMORY_OPT
        Word32 pcm_buf_local[CPE_CHANNELS * L_FRAME48k];
#else
        Word32 pcm_buf_local[L_FRAME48k];
#endif

        FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
        {
#ifdef JBM_MEMORY_OPT
            ivas_buffer_deinterleaved_to_interleaved_fx( &p_output_fx[ch], st_ivas->hDecoderConfig->nchan_out, nOutSamples, pcm_buf_local );
#else
            ivas_syn_output_f_fx( &p_output_fx[ch], nOutSamples, 1, pcm_buf_local );
#endif

            Copy32( pcm_buf_local, p_output_fx[ch], nOutSamples );
        }
        /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */
        /* not applicable in BASOP */
    }

    return IVAS_ERR_OK;
@@ -5824,6 +5833,7 @@ static ivas_error input_format_API_to_internal(

    move16();
    move16();

    return IVAS_ERR_OK;
}

@@ -5890,6 +5900,7 @@ static ivas_error apa_setup(

        move16();
        move16();

        test();
        test();
        test();
@@ -6068,6 +6079,7 @@ static ivas_error ivas_create_handle_isar(
#endif
    hSplitBinRend->hCldfbDataOut = NULL;
    hSplitBinRend->numTdSamplesPerChannelCached = 0;
    move16();

    *hSplitBinRend_out = hSplitBinRend;

@@ -6096,6 +6108,7 @@ static void ivas_destroy_handle_isar(
        {
            ivas_TD_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinTdData );
        }

        FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
        {
            IF( ( *hSplitBinRend )->hMultiBinCldfbData[i] != NULL )
@@ -6175,6 +6188,9 @@ static ivas_error ivas_dec_reconfig_split_rend(
    cldfb_in_flag = 0;
    move16();

    test();
    test();
    test();
    IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
        EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
@@ -6189,6 +6205,10 @@ static ivas_error ivas_dec_reconfig_split_rend(
    isCldfbNeeded = 0;
    move16();

    test();
    test();
    test();
    test();
    IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
        ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
    {
@@ -6220,6 +6240,7 @@ static ivas_error ivas_dec_reconfig_split_rend(
        move16();
    }

    test();
    test();
    IF( EQ_16( isCldfbNeeded, 1 ) && hSplitRendWrapper->hCldfbHandles == NULL )
    {
@@ -6228,7 +6249,7 @@ static ivas_error ivas_dec_reconfig_split_rend(
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) );
        }

        num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
        num_ch = MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS;
        move16();
        FOR( ch = 0; ch < num_ch; ch++ )
        {
@@ -6257,7 +6278,7 @@ static ivas_error ivas_dec_reconfig_split_rend(
    }
    ELSE IF( EQ_16( isCldfbNeeded, 0 ) && hSplitRendWrapper->hCldfbHandles != NULL )
    {
        num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
        num_ch = MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS;
        move16();
        FOR( ch = 0; ch < num_ch; ch++ )
        {
@@ -6284,6 +6305,11 @@ static ivas_error ivas_dec_reconfig_split_rend(
        move32();
    }

    test();
    test();
    test();
    test();
    test();
    IF( ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) &&
        ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) &&
        !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) /* td-rend not needed? */
@@ -6350,7 +6376,13 @@ static ivas_error ivas_dec_init_split_rend(
    ISAR_SPLIT_REND_ROT_AXIS head_rot_axis;
#endif

    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
    pcm_out_flag = 0;
    move16();
    if ( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        pcm_out_flag = 1;
        move16();
    }
    cldfb_in_flag = 0;
    move16();

@@ -6384,6 +6416,7 @@ static ivas_error ivas_dec_init_split_rend(
        head_rot_axis = st_ivas->hHeadTrackData->sr_pose_pred_axis;
        move32();
    }

    ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, head_rot_axis );

    num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
@@ -6423,6 +6456,10 @@ static ivas_error ivas_dec_init_split_rend(

    mixed_td_cldfb_flag = 0;
    move16();
    test();
    test();
    test();
    test();
    IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
        ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
    {