Commit 3d72a4bd authored by Lauros Pajunen's avatar Lauros Pajunen
Browse files

Apply diegetic PI data in rendering

parent 75b97ed5
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -534,6 +534,15 @@ static ivas_error IVAS_RTP_ApplyPiData( IVAS_RTP *rtp, IVAS_DEC_HANDLE hIvasDec,
                }
                break;

#ifdef RTP_S4_251135_CR26253_0016_REV1
                case IVAS_PI_DIEGETIC_TYPE:
                {
                    DEBUG_PRINT( stdout, "PI_DIEGETIC_TYPE : %d, %d, %d, %d, %d\n", piData->data.digeticIndicator.isDiegetic[0], piData->data.digeticIndicator.isDiegetic[1], piData->data.digeticIndicator.isDiegetic[2], piData->data.digeticIndicator.isDiegetic[3], piData->data.digeticIndicator.isDiegetic[4] );
                    IVAS_DEC_setDiegeticInputPI( hIvasDec, piData->data.digeticIndicator.isDiegetic );
                }
                break;

#endif
                default:
                {
                    fprintf( stderr, "Unhandled PI data of type : %s\n", PiDataNames[piDataType] );
+12 −0
Original line number Diff line number Diff line
@@ -206,14 +206,26 @@ ivas_error ivas_td_binaural_renderer_sf(
                    hIsmMetaData[nS] = &ismMetaData[nS];
                }

#ifdef RTP_S4_251135_CR26253_0016_REV1
                if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, hIsmMetaData,
                                                               ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPI : NULL,
                                                               ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK )
#else
                if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
            }
            else
            {
#ifdef RTP_S4_251135_CR26253_0016_REV1
                if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData,
                                                               ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPI : NULL,
                                                               ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK )
#else
                if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
+25 −0
Original line number Diff line number Diff line
@@ -3827,6 +3827,31 @@ void IVAS_DEC_resetExternalOrientations(
}


#endif
#ifdef RTP_S4_251135_CR26253_0016_REV1
/*---------------------------------------------------------------------*
 * IVAS_DEC_setDiegeticInput( )
 *
 * Set isDiegeticInput flag for combined orientation handle based on PI data.
 *---------------------------------------------------------------------*/

void IVAS_DEC_setDiegeticInputPI(
    IVAS_DEC_HANDLE hIvasDec,                   /* i/o: IVAS decoder handle                                                     */
    const bool *diegeticPIValues                /* i  : diegetic values for the input stream                                    */
)
{
    if ( hIvasDec->st_ivas->hCombinedOrientationData != NULL )
    {
        int8_t i;
        for ( i = 0; i < 4; i++ )
        {
            hIvasDec->st_ivas->hCombinedOrientationData->isDiegeticInputPI[i] = diegeticPIValues[i];
        }
        hIvasDec->st_ivas->hCombinedOrientationData->isDiegeticInputPISet = true;
    }
}


#endif
/*---------------------------------------------------------------------*
 * IVAS_DEC_VoIP_IsEmpty( )
+7 −0
Original line number Diff line number Diff line
@@ -349,6 +349,13 @@ void IVAS_DEC_resetExternalOrientations(
    IVAS_DEC_HANDLE hIvasDec                    /* i/o: IVAS decoder handle                                                     */
);

#endif
#ifdef RTP_S4_251135_CR26253_0016_REV1
void IVAS_DEC_setDiegeticInputPI(
    IVAS_DEC_HANDLE hIvasDec,                   /* i/o: IVAS decoder handle                                                     */
    const bool *diegeticPIValues                /* i  : diegetic values for the input stream                                    */
);

#endif
/* Setter functions - apply changes to decoder configuration */

+27 −0
Original line number Diff line number Diff line
@@ -363,7 +363,13 @@ ivas_error ivas_td_binaural_renderer_unwrap(
        if ( subframe_idx == ism_md_subframe_update )
        {
            /* Update object position(s) */
#ifdef RTP_S4_251135_CR26253_0016_REV1
            if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData,
                                                           ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->isDiegeticInputPI : NULL,
                                                           ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK )
#else
            if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -531,7 +537,13 @@ ivas_error TDREND_Update_object_positions(
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle               */
    const int16_t num_src,                             /* i  : number of sources to render      */
    const IVAS_FORMAT in_format,                       /* i  : Format of input sources          */
#ifdef RTP_S4_251135_CR26253_0016_REV1
    const ISM_METADATA_HANDLE *hIsmMetaData,           /* i  : Input metadata for ISM objects   */
    const bool *isDiegeticInputPI,                     /* i  : diegetic values for the input streams from the PI data */
    const bool isDiegeticInputPISet                    /* i  : is diegetic values obtained from PI data */
#else
    const ISM_METADATA_HANDLE *hIsmMetaData            /* i  : Input metadata for ISM objects   */
#endif
)
{
#ifndef NONBE_1377_REND_DIRATT_CONF
@@ -544,6 +556,9 @@ ivas_error TDREND_Update_object_positions(
#ifndef NONBE_1377_REND_DIRATT_CONF
    DirAtten_p = hBinRendererTd->DirAtten_p;
#endif
#ifdef RTP_S4_251135_CR26253_0016_REV1
    bool isDiegeticSrcPI;
#endif

    /* For each source, write the frame data to the source object*/
    for ( nS = 0; nS < num_src; nS++ )
@@ -571,7 +586,19 @@ ivas_error TDREND_Update_object_positions(
                return error;
            }

#ifdef RTP_S4_251135_CR26253_0016_REV1
            isDiegeticSrcPI = false;
            if ( isDiegeticInputPISet && isDiegeticInputPI != NULL )
            {
                if ( isDiegeticInputPI[nS] )
                {
                    isDiegeticSrcPI = true;
                }
            }
            if ( hIsmMetaData[nS]->non_diegetic_flag || !isDiegeticSrcPI )
#else
            if ( hIsmMetaData[nS]->non_diegetic_flag )
#endif
            {
                Pos[0] = 0;
                Pos[1] = hIsmMetaData[nS]->azimuth / 90.f;
Loading