Commit ada2ff18 authored by sagnowski's avatar sagnowski
Browse files

Fix missing bits of porting

parent 18bfc9c9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2466,7 +2466,7 @@ ivas_error ivas_jbm_dec_render_fx(
        nchan_out_syn_output = BINAURAL_CHANNELS * st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;

        /* Save TD signals for pose correction if they are to be used */
        if ( st_ivas->hSplitBinRend->hMultiBinTdData != NULL )
        IF ( st_ivas->hSplitBinRend->hMultiBinTdData != NULL )
        {
            FOR( i = 0; i < nchan_out_syn_output; i++ )
            {
@@ -2476,7 +2476,7 @@ ivas_error ivas_jbm_dec_render_fx(
        }

#ifdef TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR // TODO(sgi): verify if this is needed in BASOP
        if ( st_ivas->flushing )
        IF ( st_ivas->flushing )
        {
            nchan_out_syn_output = BINAURAL_CHANNELS;
        }
+22 −15
Original line number Diff line number Diff line
@@ -1183,14 +1183,16 @@ static Word16 isar_get_frame_size(

    output_Fs = st_ivas->hDecoderConfig->output_Fs;

    if ( st_ivas->hDecoderConfig->render_framesize != IVAS_RENDER_FRAMESIZE_20MS &&
    test();
    test();
    IF ( st_ivas->hDecoderConfig->render_framesize != IVAS_RENDER_FRAMESIZE_20MS &&
         ( st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
           st_ivas->hRenderConfig->split_rend_config.dof == 0 ) )
    {
        nSamplesPerChannel = extract_l( ar_div( output_Fs, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) );
        nSamplesPerChannel = imult1616( nSamplesPerChannel, st_ivas->hDecoderConfig->render_framesize );
    }
    else
    ELSE
    {
        nSamplesPerChannel = extract_l( ar_div( output_Fs, FRAMES_PER_SEC ) );
    }
@@ -1221,7 +1223,7 @@ static ivas_error isar_render_poses(
    ivas_error error;
    Word16 numPoses;

    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    IF ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }
@@ -1233,7 +1235,7 @@ static ivas_error isar_render_poses(
    numPoses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;

    /* init flush buffer for rate switch if not already initizalized */
    if ( hIvasDec->flushbuffer == NULL )
    IF ( hIvasDec->flushbuffer == NULL )
    {
        hIvasDec->flushbuffer = (void *) malloc( sizeof( Word16 ) * numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
        set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
@@ -1562,7 +1564,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
    bool *needNewFrame                        /* o  : indication that the decoder needs a new frame                           */
)
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP // TODO(sgi): this function still needs to be ported to BASOP
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    Decoder_Struct *st_ivas;
    ivas_error error;
    Word32 head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES][L_FRAME48k];
@@ -1573,49 +1575,51 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
    Word16 Q_out[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS];

    test();
    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    IF ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    st_ivas = hIvasDec->st_ivas;

    if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 )
    IF ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
    move16();
    numSamplesPerChannelToOutput = isar_get_frame_size( st_ivas );
    move16();

    if ( ( error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK )
    IF ( ( error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    if ( !hIvasDec->hasBeenFedFirstGoodFrame )
    IF ( !hIvasDec->hasBeenFedFirstGoodFrame )
    {
        return IVAS_ERR_OK;
    }

    for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
    FOR ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
    {
        p_head_pose_buf[i] = head_pose_buf[i];
    }

    if ( ( error = isar_generate_metadata_and_bitstream( st_ivas, p_head_pose_buf, *nOutSamples, splitRendBits, Q_out ) ) != IVAS_ERR_OK )
    IF ( ( error = isar_generate_metadata_and_bitstream( st_ivas, p_head_pose_buf, *nOutSamples, splitRendBits, Q_out ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /* convert to int16 with limiting for BINAURAL_SPLIT_PCM */
    if ( pcm_out_flag )
    IF ( pcm_out_flag )
    {
        FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
        {
            scale_sig32( p_head_pose_buf[i], numSamplesPerChannelToOutput, sub( Q11, Q_out[i] ) ); // Q11
        }
        if ( st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS )
        IF ( st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS )
        {
#ifndef DISABLE_LIMITER
            ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToOutput, st_ivas->BER_detect, Q11 );
@@ -6112,14 +6116,17 @@ static Word16 ivas_dec_split_rend_cldfb_in(
    const RENDERER_TYPE renderer_type /* i  : renderer type     */
)
{
    if ( renderer_type == RENDERER_BINAURAL_FASTCONV ||
    test();
    test();
    test();
    IF ( renderer_type == RENDERER_BINAURAL_FASTCONV ||
         renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
         renderer_type == RENDERER_BINAURAL_PARAMETRIC ||
         renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
    {
        return 1;
    }
    else
    ELSE
    {
        return 0;
    }
+2 −2
Original line number Diff line number Diff line
@@ -2929,9 +2929,9 @@ ivas_error isar_renderMultiTDBinToSplitBinaural(
    useLc3plus = hSplitBin->hLc3plusEnc != NULL;

#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
    FOR ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
    {
        for ( j = 0; j < CLDFB_NO_COL_MAX; ++j )
        FOR ( j = 0; j < CLDFB_NO_COL_MAX; ++j )
        {
            p_Cldfb_In_BinReal[i][j] = Cldfb_In_BinReal_fx[i][j];
            p_Cldfb_In_BinImag[i][j] = Cldfb_In_BinImag_fx[i][j];
+3 −3
Original line number Diff line number Diff line
@@ -181,13 +181,13 @@ void ivas_CLDFB_RINGBUF_Push(

    h->write_pos = add( h->write_pos, CLDFB_NO_CHANNELS_MAX );
    move16();
    if ( EQ_16( h->write_pos, h->capacity ) )
    IF ( EQ_16( h->write_pos, h->capacity ) )
    {
        h->write_pos = 0;
        move16();
    }

    if ( EQ_16( h->read_pos, h->write_pos ) )
    IF ( EQ_16( h->read_pos, h->write_pos ) )
    {
        h->is_full = 1;
        move16();
@@ -289,7 +289,7 @@ void ivas_CLDFB_RINGBUF_GetByIdx(
    {
        offset = add( h->read_pos, idx );
        move16();
        if ( LE_16( h->capacity, offset ) )
        IF ( LE_16( h->capacity, offset ) )
        {
            offset = sub( offset, h->capacity );
            move16();
+13 −13
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static Word16 ivas_td_ringbuf_has_space_for_num_samples(
    TD_RINGBUF_HANDLE h,
    const Word32 num_samples )
{
    if ( LE_32( L_add( ivas_td_ringbuf_total_size( h ), num_samples ), h->capacity ) )
    IF ( LE_32( L_add( ivas_td_ringbuf_total_size( h ), num_samples ), h->capacity ) )
    {
        return 1;
    }
@@ -101,7 +101,7 @@ static void ivas_td_ringbuf_push_interleaved(
        move32();
        ++h->write_pos;

        if ( EQ_32( h->write_pos, h->capacity ) )
        IF ( EQ_32( h->write_pos, h->capacity ) )
        {
            h->write_pos = 0;
        }
@@ -109,7 +109,7 @@ static void ivas_td_ringbuf_push_interleaved(
        move32();
    }

    if ( EQ_32( h->read_pos, h->write_pos ) )
    IF ( EQ_32( h->read_pos, h->write_pos ) )
    {
        h->is_full = 1;
        move16();
@@ -163,7 +163,7 @@ ivas_error ivas_TD_RINGBUF_Open(
    *ph = h;

    h->data = malloc( capacity * sizeof( Word32 ) );
    if ( h->data == NULL )
    IF ( h->data == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to allocate memory for TD ring buffer\n" );
    }
@@ -261,7 +261,7 @@ void ivas_TD_RINGBUF_Push(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    assert( h != NULL );
    assert( p_channels != NULL );
    for ( c = 0; c < h->num_channels; ++c ) /* Not using BASOP FOR because this loops only does assertions */
    FOR ( c = 0; c < h->num_channels; ++c ) /* Not using BASOP FOR because this loops only does assertions */
    {
        assert( p_channels[c] != NULL );
    }
@@ -281,7 +281,7 @@ void ivas_TD_RINGBUF_Push(
#endif
            ++h->write_pos;

            if ( EQ_32( h->write_pos, h->capacity ) )
            IF ( EQ_32( h->write_pos, h->capacity ) )
            {
                h->write_pos = 0;
                move32();
@@ -289,7 +289,7 @@ void ivas_TD_RINGBUF_Push(
        }
    }

    if ( EQ_32( h->read_pos, h->write_pos ) )
    IF ( EQ_32( h->read_pos, h->write_pos ) )
    {
        h->is_full = 1;
        move16();
@@ -332,7 +332,7 @@ void ivas_TD_RINGBUF_PushZeros(
    Word16 c;

    assert( ivas_td_ringbuf_has_space_for_num_samples( h, num_samples_per_channel * h->num_channels ) );
    if ( !num_samples_per_channel )
    IF ( !num_samples_per_channel )
    {
        return;
    }
@@ -345,7 +345,7 @@ void ivas_TD_RINGBUF_PushZeros(
            move32();
            ++h->write_pos;

            if ( EQ_32( h->write_pos == h->capacity ) )
            IF ( EQ_32( h->write_pos == h->capacity ) )
            {
                h->write_pos = 0;
                move32();
@@ -353,7 +353,7 @@ void ivas_TD_RINGBUF_PushZeros(
        }
    }

    if ( EQ_32( h->read_pos == h->write_pos ) )
    IF ( EQ_32( h->read_pos == h->write_pos ) )
    {
        h->is_full = 1;
        move16();
@@ -396,7 +396,7 @@ void ivas_TD_RINGBUF_Pop(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    assert( h != NULL );
    assert( p_channels != NULL );
    for ( c = 0; c < h->num_channels; ++c ) /* Not using BASOP FOR because this loops only does assertions */
    FOR ( c = 0; c < h->num_channels; ++c ) /* Not using BASOP FOR because this loops only does assertions */
    {
        assert( p_channels[c] != NULL );
    }
@@ -425,13 +425,13 @@ void ivas_TD_RINGBUF_Pop(
    }

#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    if ( NE_16( num_samples_per_channel, 0 ) )
    IF ( NE_16( num_samples_per_channel, 0 ) )
    {
        h->is_full = 0;
        move16();
    }
#else
    if ( h->is_full )
    IF ( h->is_full )
    {
        h->is_full = 0;
        move16();
Loading