Loading lib_rend/lib_rend.c +46 −6 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ #include <assert.h> #include <math.h> #include <stdbool.h> #include <string.h> #include "wmc_auto.h" Loading Loading @@ -4640,7 +4641,8 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } if ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) if ( ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { /* Head rotation can be set only with binaural output */ return IVAS_ERR_INVALID_OUTPUT_FORMAT; Loading Loading @@ -6668,23 +6670,61 @@ static void renderSbaToMc( } static void renderSbaToSba( const input_sba *sbaInput, static ivas_error renderSbaToSba( input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) { int16_t i; IVAS_REND_AudioBuffer inAudio; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; int8_t combinedOrientationEnabled; int16_t subframe_idx; push_wmops( "renderSbaToSba" ); inAudio = sbaInput->base.inputBuffer; hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; break; } } } /* apply rotation */ if ( combinedOrientationEnabled ) { tmpRotBuffer = inAudio; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); /* copy input for in-place rotation */ mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev[0], tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } memcpy(inAudio.data, tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); free( tmpRotBuffer.data); } for ( i = 0; i < inAudio.config.numChannels; ++i ) { renderBufferChannel( inAudio, i, sbaInput->hoaDecMtx[i], outAudio ); } pop_wmops(); return; return IVAS_ERR_OK; } #ifdef SPLIT_REND_WITH_HEAD_ROT Loading Loading @@ -7108,7 +7148,7 @@ static ivas_error renderInputSba( renderSbaToMc( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: renderSbaToSba( sbaInput, outAudio ); error = renderSbaToSba( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) Loading Loading
lib_rend/lib_rend.c +46 −6 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ #include <assert.h> #include <math.h> #include <stdbool.h> #include <string.h> #include "wmc_auto.h" Loading Loading @@ -4640,7 +4641,8 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } if ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) if ( ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { /* Head rotation can be set only with binaural output */ return IVAS_ERR_INVALID_OUTPUT_FORMAT; Loading Loading @@ -6668,23 +6670,61 @@ static void renderSbaToMc( } static void renderSbaToSba( const input_sba *sbaInput, static ivas_error renderSbaToSba( input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) { int16_t i; IVAS_REND_AudioBuffer inAudio; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; int8_t combinedOrientationEnabled; int16_t subframe_idx; push_wmops( "renderSbaToSba" ); inAudio = sbaInput->base.inputBuffer; hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; break; } } } /* apply rotation */ if ( combinedOrientationEnabled ) { tmpRotBuffer = inAudio; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); /* copy input for in-place rotation */ mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev[0], tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; } memcpy(inAudio.data, tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); free( tmpRotBuffer.data); } for ( i = 0; i < inAudio.config.numChannels; ++i ) { renderBufferChannel( inAudio, i, sbaInput->hoaDecMtx[i], outAudio ); } pop_wmops(); return; return IVAS_ERR_OK; } #ifdef SPLIT_REND_WITH_HEAD_ROT Loading Loading @@ -7108,7 +7148,7 @@ static ivas_error renderInputSba( renderSbaToMc( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: renderSbaToSba( sbaInput, outAudio ); error = renderSbaToSba( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) Loading