Commit 28d2ca67 authored by Jouni Paulus's avatar Jouni Paulus
Browse files

add renderer reconfiguration in MASA bitrate switching. changes are under flag...

add renderer reconfiguration in MASA bitrate switching. changes are under flag FIX_425_MASA_BRSW_RENDERER. requires the changes under FIX_417_TD_DECORR_BRATE_SW to be included in the underlying code for proper operation.
parent c180b501
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@
#define FIX_416_ISM_BR_SWITCHING                        /* FhG: add missing CLDFB reconfig to ISM BR switching */
#define FIX_SP2A                                        /* VA: Issue 412: Adjust threshold for the S_p2a feature in the tonal detector */

#define FIX_425_MASA_BRSW_RENDERER                      /* Nokia: Issue 425: renderer not reconfigure in MASA bitrate switching */


/* ################## End DEVELOPMENT switches ######################### */
+48 −0
Original line number Diff line number Diff line
@@ -1077,6 +1077,9 @@ ivas_error ivas_masa_dec_reconfigure(
    uint16_t *bit_stream;
    Decoder_State **sts;
    int32_t ivas_total_brate, last_ivas_total_brate;
#ifdef FIX_425_MASA_BRSW_RENDERER
    int16_t numCldfbAnalyses_old, numCldfbSyntheses_old;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
@@ -1084,6 +1087,37 @@ ivas_error ivas_masa_dec_reconfigure(
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
    last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;

#ifdef FIX_425_MASA_BRSW_RENDERER
    ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );

    /* renderer might have changed, reselect */
    ivas_renderer_select( st_ivas );

    if ( st_ivas->renderer_type != RENDERER_DISABLE )
    {
        if ( st_ivas->hDirAC != NULL )
        {
            /* reconfigure existing DirAC dec */
            if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        else
        {
            /* init a new DirAC dec */
            if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }
    else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL )
    {
        ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
    }
#endif

    /*-----------------------------------------------------------------*
     * Allocate and initialize SCE/CPE and other handles
     *-----------------------------------------------------------------*/
@@ -1141,6 +1175,20 @@ ivas_error ivas_masa_dec_reconfigure(
        }
    }

#ifdef FIX_425_MASA_BRSW_RENDERER
    /*-----------------------------------------------------------------*
     * CLDFB instances
     *-----------------------------------------------------------------*/

    if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /*-----------------------------------------------------------------*
     * Set-up MASA coding elements and bitrates
     *-----------------------------------------------------------------*/
#endif
    ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp );

    return error;