Loading lib_dec/ivas_stat_dec.h +1 −0 Original line number Diff line number Diff line Loading @@ -849,6 +849,7 @@ typedef struct typedef struct { #ifdef FIX_1119_SPLIT_RENDERING_VOIP TD_RINGBUF_HANDLE hMultiBinTdData; CLDFB_RINGBUF_HANDLE hMultiBinCldfbData[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; #else ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE hMultiBinCldfbData; /*scratch buffer for frame by frame processing*/ Loading lib_dec/lib_dec.c +61 −22 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ static ivas_error ivas_dec_init_split_rend( Decoder_Struct *st_ivas ); static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out ); 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 FIX_1119_SPLIT_RENDERING_VOIP static int16_t get_render_frame_size_samples( Decoder_Struct *st_ivas ); static int16_t ivas_dec_split_rend_cldfb_in( Decoder_Struct* st_ivas ); #endif static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered ); Loading Loading @@ -637,6 +641,13 @@ ivas_error IVAS_DEC_GetRenderFramesize( return IVAS_ERR_OK; } #ifdef FIX_1119_SPLIT_RENDERING_VOIP static int16_t get_render_frame_size_samples( Decoder_Struct *st_ivas ) { return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * st_ivas->hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); } #endif /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesizeSamples( ) * Loading @@ -653,7 +664,11 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef FIX_1119_SPLIT_RENDERING_VOIP *render_framesize = get_render_frame_size_samples( hIvasDec->st_ivas ); #else *render_framesize = (int16_t) ( hIvasDec->st_ivas->hDecoderConfig->output_Fs * hIvasDec->st_ivas->hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif return IVAS_ERR_OK; } Loading Loading @@ -1866,14 +1881,12 @@ static int16_t isar_get_frame_size( static ivas_error isar_render_poses( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ float **p_head_pose_buf, int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ bool *needNewFrame /* o : indication that the decoder needs a new frame */ ) { Decoder_Struct *st_ivas; float pcmBuf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES * L_FRAME48k]; int16_t i, j; ivas_error error; ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; int16_t numPoses; Loading Loading @@ -1907,13 +1920,9 @@ static ivas_error isar_render_poses( return IVAS_ERR_OK; } /* change buffer layout */ for ( i = 0; i < *nOutSamples; ++i ) { for ( j = 0; j < BINAURAL_CHANNELS * numPoses; ++j ) if ( !ivas_dec_split_rend_cldfb_in( st_ivas ) ) { p_head_pose_buf[j][i] = pcmBuf[i * BINAURAL_CHANNELS * numPoses + j]; } ivas_TD_RINGBUF_PushInterleaved( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, pcmBuf, *nOutSamples ); } return error; Loading Loading @@ -2057,12 +2066,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; numSamplesPerChannelToOutput = isar_get_frame_size( st_ivas ); for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = head_pose_buf[i]; } error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, p_head_pose_buf, nOutSamples, needNewFrame ); error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, nOutSamples, needNewFrame ); if ( error != IVAS_ERR_OK ) { return error; Loading @@ -2072,6 +2076,16 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return IVAS_ERR_OK; } for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = head_pose_buf[i]; } if ( !ivas_dec_split_rend_cldfb_in( st_ivas ) ) { ivas_TD_RINGBUF_PopChannels( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, *nOutSamples ); } error = isar_generate_metadata_and_bitstream( hIvasDec, p_head_pose_buf, splitRendBits ); if ( error != IVAS_ERR_OK ) { Loading Loading @@ -3932,14 +3946,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* Move output pointers forward */ for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = &head_pose_buf[i][*nSamplesRendered]; } /* Render head poses from time-scaled transport channels */ if ( ( error = isar_render_poses( hIvasDec, nSamplesToRender, p_head_pose_buf, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) if ( ( error = isar_render_poses( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) { return error; } Loading @@ -3966,12 +3974,16 @@ ivas_error IVAS_DEC_VoIP_GetSamples ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { /* Set pointers to beginning of head pose buffers */ for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = head_pose_buf[i]; } if ( !ivas_dec_split_rend_cldfb_in( st_ivas ) ) { ivas_TD_RINGBUF_PopChannels( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, *nSamplesRendered ); } /* Analyse head poses over entire frame, generate ISAR metadata and maybe encode if split coded */ error = isar_generate_metadata_and_bitstream( hIvasDec, p_head_pose_buf, splitRendBits ); if ( error != IVAS_ERR_OK ) Loading Loading @@ -5186,6 +5198,7 @@ static ivas_error ivas_create_handle_isar( isar_init_split_rend_handles( &hSplitBinRend->splitrend ); #ifdef FIX_1119_SPLIT_RENDERING_VOIP hSplitBinRend->hMultiBinTdData = NULL; for ( i = 0; i < (int16_t) ( MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); ++i ) { hSplitBinRend->hMultiBinCldfbData[i] = NULL; Loading Loading @@ -5219,6 +5232,10 @@ static void ivas_destroy_handle_isar( if ( *hSplitBinRend != NULL ) { #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( ( *hSplitBinRend )->hMultiBinTdData != NULL ) { ivas_TD_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinTdData ); } for ( i = 0; i < (int16_t) ( MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); ++i ) { if ( ( *hSplitBinRend )->hMultiBinCldfbData[i] != NULL ) Loading Loading @@ -5403,6 +5420,16 @@ static ivas_error ivas_dec_reconfig_split_rend( return IVAS_ERR_OK; } #ifdef FIX_1119_SPLIT_RENDERING_VOIP static int16_t ivas_dec_split_rend_cldfb_in( Decoder_Struct* st_ivas ) { return st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM; } #endif /*-------------------------------------------------------------------* * ivas_dec_init_split_rend() Loading @@ -5424,6 +5451,9 @@ static ivas_error ivas_dec_init_split_rend( pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; cldfb_in_flag = 0; #ifdef FIX_1119_SPLIT_RENDERING_VOIP cldfb_in_flag = ivas_dec_split_rend_cldfb_in( st_ivas ); #else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || Loading @@ -5431,6 +5461,7 @@ static ivas_error ivas_dec_init_split_rend( { cldfb_in_flag = 1; } #endif #ifdef FIX_1119_SPLIT_RENDERING_VOIP ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS ); Loading @@ -5449,6 +5480,14 @@ static ivas_error ivas_dec_init_split_rend( } } } else { error = ivas_TD_RINGBUF_Open( &st_ivas->hSplitBinRend->hMultiBinTdData, get_render_frame_size_samples( st_ivas ), num_poses * BINAURAL_CHANNELS ); if ( error != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } } #else /* note: this is intra-frame heap memory */ if ( ( st_ivas->hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) Loading Loading
lib_dec/ivas_stat_dec.h +1 −0 Original line number Diff line number Diff line Loading @@ -849,6 +849,7 @@ typedef struct typedef struct { #ifdef FIX_1119_SPLIT_RENDERING_VOIP TD_RINGBUF_HANDLE hMultiBinTdData; CLDFB_RINGBUF_HANDLE hMultiBinCldfbData[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; #else ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE hMultiBinCldfbData; /*scratch buffer for frame by frame processing*/ Loading
lib_dec/lib_dec.c +61 −22 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ static ivas_error ivas_dec_init_split_rend( Decoder_Struct *st_ivas ); static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out ); 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 FIX_1119_SPLIT_RENDERING_VOIP static int16_t get_render_frame_size_samples( Decoder_Struct *st_ivas ); static int16_t ivas_dec_split_rend_cldfb_in( Decoder_Struct* st_ivas ); #endif static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered ); Loading Loading @@ -637,6 +641,13 @@ ivas_error IVAS_DEC_GetRenderFramesize( return IVAS_ERR_OK; } #ifdef FIX_1119_SPLIT_RENDERING_VOIP static int16_t get_render_frame_size_samples( Decoder_Struct *st_ivas ) { return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * st_ivas->hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); } #endif /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesizeSamples( ) * Loading @@ -653,7 +664,11 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef FIX_1119_SPLIT_RENDERING_VOIP *render_framesize = get_render_frame_size_samples( hIvasDec->st_ivas ); #else *render_framesize = (int16_t) ( hIvasDec->st_ivas->hDecoderConfig->output_Fs * hIvasDec->st_ivas->hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif return IVAS_ERR_OK; } Loading Loading @@ -1866,14 +1881,12 @@ static int16_t isar_get_frame_size( static ivas_error isar_render_poses( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ float **p_head_pose_buf, int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ bool *needNewFrame /* o : indication that the decoder needs a new frame */ ) { Decoder_Struct *st_ivas; float pcmBuf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES * L_FRAME48k]; int16_t i, j; ivas_error error; ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; int16_t numPoses; Loading Loading @@ -1907,13 +1920,9 @@ static ivas_error isar_render_poses( return IVAS_ERR_OK; } /* change buffer layout */ for ( i = 0; i < *nOutSamples; ++i ) { for ( j = 0; j < BINAURAL_CHANNELS * numPoses; ++j ) if ( !ivas_dec_split_rend_cldfb_in( st_ivas ) ) { p_head_pose_buf[j][i] = pcmBuf[i * BINAURAL_CHANNELS * numPoses + j]; } ivas_TD_RINGBUF_PushInterleaved( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, pcmBuf, *nOutSamples ); } return error; Loading Loading @@ -2057,12 +2066,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; numSamplesPerChannelToOutput = isar_get_frame_size( st_ivas ); for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = head_pose_buf[i]; } error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, p_head_pose_buf, nOutSamples, needNewFrame ); error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, nOutSamples, needNewFrame ); if ( error != IVAS_ERR_OK ) { return error; Loading @@ -2072,6 +2076,16 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return IVAS_ERR_OK; } for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = head_pose_buf[i]; } if ( !ivas_dec_split_rend_cldfb_in( st_ivas ) ) { ivas_TD_RINGBUF_PopChannels( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, *nOutSamples ); } error = isar_generate_metadata_and_bitstream( hIvasDec, p_head_pose_buf, splitRendBits ); if ( error != IVAS_ERR_OK ) { Loading Loading @@ -3932,14 +3946,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* Move output pointers forward */ for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = &head_pose_buf[i][*nSamplesRendered]; } /* Render head poses from time-scaled transport channels */ if ( ( error = isar_render_poses( hIvasDec, nSamplesToRender, p_head_pose_buf, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) if ( ( error = isar_render_poses( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) { return error; } Loading @@ -3966,12 +3974,16 @@ ivas_error IVAS_DEC_VoIP_GetSamples ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { /* Set pointers to beginning of head pose buffers */ for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { p_head_pose_buf[i] = head_pose_buf[i]; } if ( !ivas_dec_split_rend_cldfb_in( st_ivas ) ) { ivas_TD_RINGBUF_PopChannels( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, *nSamplesRendered ); } /* Analyse head poses over entire frame, generate ISAR metadata and maybe encode if split coded */ error = isar_generate_metadata_and_bitstream( hIvasDec, p_head_pose_buf, splitRendBits ); if ( error != IVAS_ERR_OK ) Loading Loading @@ -5186,6 +5198,7 @@ static ivas_error ivas_create_handle_isar( isar_init_split_rend_handles( &hSplitBinRend->splitrend ); #ifdef FIX_1119_SPLIT_RENDERING_VOIP hSplitBinRend->hMultiBinTdData = NULL; for ( i = 0; i < (int16_t) ( MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); ++i ) { hSplitBinRend->hMultiBinCldfbData[i] = NULL; Loading Loading @@ -5219,6 +5232,10 @@ static void ivas_destroy_handle_isar( if ( *hSplitBinRend != NULL ) { #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( ( *hSplitBinRend )->hMultiBinTdData != NULL ) { ivas_TD_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinTdData ); } for ( i = 0; i < (int16_t) ( MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); ++i ) { if ( ( *hSplitBinRend )->hMultiBinCldfbData[i] != NULL ) Loading Loading @@ -5403,6 +5420,16 @@ static ivas_error ivas_dec_reconfig_split_rend( return IVAS_ERR_OK; } #ifdef FIX_1119_SPLIT_RENDERING_VOIP static int16_t ivas_dec_split_rend_cldfb_in( Decoder_Struct* st_ivas ) { return st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM; } #endif /*-------------------------------------------------------------------* * ivas_dec_init_split_rend() Loading @@ -5424,6 +5451,9 @@ static ivas_error ivas_dec_init_split_rend( pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; cldfb_in_flag = 0; #ifdef FIX_1119_SPLIT_RENDERING_VOIP cldfb_in_flag = ivas_dec_split_rend_cldfb_in( st_ivas ); #else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || Loading @@ -5431,6 +5461,7 @@ static ivas_error ivas_dec_init_split_rend( { cldfb_in_flag = 1; } #endif #ifdef FIX_1119_SPLIT_RENDERING_VOIP ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS ); Loading @@ -5449,6 +5480,14 @@ static ivas_error ivas_dec_init_split_rend( } } } else { error = ivas_TD_RINGBUF_Open( &st_ivas->hSplitBinRend->hMultiBinTdData, get_render_frame_size_samples( st_ivas ), num_poses * BINAURAL_CHANNELS ); if ( error != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } } #else /* note: this is intra-frame heap memory */ if ( ( st_ivas->hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) Loading