Loading lib_dec/lib_dec.c +16 −0 Original line number Diff line number Diff line Loading @@ -1742,6 +1742,10 @@ ivas_error IVAS_DEC_PrepareRenderer( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ) { #ifdef FIX_1419_MONO_STEREO_UMX ivas_error error; #endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; Loading @@ -1751,6 +1755,18 @@ ivas_error IVAS_DEC_PrepareRenderer( { ivas_dec_prepare_renderer( hIvasDec->st_ivas ); } #ifdef FIX_1419_MONO_STEREO_UMX if ( hIvasDec->st_ivas->hRenderConfig != NULL ) { if ( ( error = ms_upmix_validate_config( &hIvasDec->st_ivas->hRenderConfig->mono_stereo_upmix_config, hIvasDec->st_ivas->ivas_format, hIvasDec->st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) { return error; } } #endif hIvasDec->hasBeenPreparedRendering = true; Loading lib_rend/ivas_output_init.c +34 −27 Original line number Diff line number Diff line Loading @@ -479,81 +479,88 @@ ivas_error ms_upmix_validate_config( { int16_t i; float azi_abs[2]; // float ele_abs[2]; (void) ivasFormat; float ele_abs[2]; /* check custom positions */ for ( i = 0; i < 2; i++ ) if ( pMsUpmixConfig == NULL ) { azi_abs[i] = fabsf( pMsUpmixConfig->azi[i] ); // ele_abs[i] = fabsf( pMsUpmixConfig->ele[i] ); return IVAS_ERR_UNEXPECTED_NULL_POINTER; } if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) /* skip validation if non spatial; values aren't used */ if ( !pMsUpmixConfig->spatialEnabled ) { if ( azi_abs[0] == 90 && azi_abs[1] == 90 ) return IVAS_ERR_OK; } /* validate radius */ if ( pMsUpmixConfig->radius < 0.f || pMsUpmixConfig->radius > 1.f ) { pMsUpmixConfig->stereoLR = TRUE; return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Radius must be between 0 and 1" ); } /* obtain absolute values */ for ( i = 0; i < 2; i++ ) { azi_abs[i] = fabsf( pMsUpmixConfig->azi[i] ); ele_abs[i] = fabsf( pMsUpmixConfig->ele[i] ); } #if 0 if ( false /* TODO no way to know if we have mono */ ) /* validate speaker positions */ if ( ivasFormat == MONO_FORMAT ) { if ( azi_abs[0] != 0 ) { fprintf( stderr, "Warning: panning mono to nonzero azimuth" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Mono cannot be panned" ); } if ( ele_abs[0] != 0 ) { fprintf( stderr, "Warning: panning mono to nonzero elevation" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Mono cannot be panned" ); } } if ( false /* TODO no way to know if we have stereo */ ) else if ( ivasFormat == STEREO_FORMAT ) { if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { /* validate provided positions match BRIR */ if ( ( azi_abs[0] != 30 && azi_abs[0] != 90 ) || ( azi_abs[1] != 30 && azi_abs[1] != 90 ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "BINAURAL_ROOM_IR only supports ±30 and ±90 degree azimuth" ); } // TODO we could allow {±30,35} front height speakers? if ( ele_abs[0] != 0 || ele_abs[1] != 0 ) { fprintf( stderr, "Warning: elevation must be zero for BINAURAL_ROOM_IR" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "BINAURAL_ROOM_IR does not allow nonzero elevation" ); } /* flag to select ±90 azi loudspeakers */ if ( azi_abs[0] == 90 && azi_abs[1] == 90 ) { pMsUpmixConfig->stereoLR = TRUE; } } else /* HRIR based formats and split rendering */ { /* enforce symmetry */ if ( pMsUpmixConfig->azi[0] != -pMsUpmixConfig->azi[1] ) { fprintf( stderr, "Warning: azimuth for stereo pair must be symmetric" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair with asymmetric azimuth is not allowed" ); } if ( pMsUpmixConfig->ele[0] != pMsUpmixConfig->ele[1] ) { fprintf( stderr, "Warning: elevations for stereo pair must match" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair with differring elevation is not allowed" ); } if ( ( azi_abs[0] > 90 ) || ( azi_abs[1] > 90 ) ) /* restrict values */ if ( ( azi_abs[0] > 90 ) || ( azi_abs[1] > 90 ) ) { fprintf( stderr, "Warning: panning stereo pair beyond 90deg azimuth" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair beyond |90| degrees azimuth is not allowed" ); } if ( ( ele_abs[0] > 45 ) || ( ele_abs[1] > 45 ) ) if ( ( ele_abs[0] > 45 ) || ( ele_abs[1] > 45 ) ) { fprintf( stderr, "Warning: panning stereo pair beyond 45deg elevation" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair beyond |45| degrees of elevation is not allowed" ); } } } #endif return IVAS_ERR_OK; } Loading Loading
lib_dec/lib_dec.c +16 −0 Original line number Diff line number Diff line Loading @@ -1742,6 +1742,10 @@ ivas_error IVAS_DEC_PrepareRenderer( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ) { #ifdef FIX_1419_MONO_STEREO_UMX ivas_error error; #endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; Loading @@ -1751,6 +1755,18 @@ ivas_error IVAS_DEC_PrepareRenderer( { ivas_dec_prepare_renderer( hIvasDec->st_ivas ); } #ifdef FIX_1419_MONO_STEREO_UMX if ( hIvasDec->st_ivas->hRenderConfig != NULL ) { if ( ( error = ms_upmix_validate_config( &hIvasDec->st_ivas->hRenderConfig->mono_stereo_upmix_config, hIvasDec->st_ivas->ivas_format, hIvasDec->st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) { return error; } } #endif hIvasDec->hasBeenPreparedRendering = true; Loading
lib_rend/ivas_output_init.c +34 −27 Original line number Diff line number Diff line Loading @@ -479,81 +479,88 @@ ivas_error ms_upmix_validate_config( { int16_t i; float azi_abs[2]; // float ele_abs[2]; (void) ivasFormat; float ele_abs[2]; /* check custom positions */ for ( i = 0; i < 2; i++ ) if ( pMsUpmixConfig == NULL ) { azi_abs[i] = fabsf( pMsUpmixConfig->azi[i] ); // ele_abs[i] = fabsf( pMsUpmixConfig->ele[i] ); return IVAS_ERR_UNEXPECTED_NULL_POINTER; } if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) /* skip validation if non spatial; values aren't used */ if ( !pMsUpmixConfig->spatialEnabled ) { if ( azi_abs[0] == 90 && azi_abs[1] == 90 ) return IVAS_ERR_OK; } /* validate radius */ if ( pMsUpmixConfig->radius < 0.f || pMsUpmixConfig->radius > 1.f ) { pMsUpmixConfig->stereoLR = TRUE; return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Radius must be between 0 and 1" ); } /* obtain absolute values */ for ( i = 0; i < 2; i++ ) { azi_abs[i] = fabsf( pMsUpmixConfig->azi[i] ); ele_abs[i] = fabsf( pMsUpmixConfig->ele[i] ); } #if 0 if ( false /* TODO no way to know if we have mono */ ) /* validate speaker positions */ if ( ivasFormat == MONO_FORMAT ) { if ( azi_abs[0] != 0 ) { fprintf( stderr, "Warning: panning mono to nonzero azimuth" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Mono cannot be panned" ); } if ( ele_abs[0] != 0 ) { fprintf( stderr, "Warning: panning mono to nonzero elevation" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Mono cannot be panned" ); } } if ( false /* TODO no way to know if we have stereo */ ) else if ( ivasFormat == STEREO_FORMAT ) { if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { /* validate provided positions match BRIR */ if ( ( azi_abs[0] != 30 && azi_abs[0] != 90 ) || ( azi_abs[1] != 30 && azi_abs[1] != 90 ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "BINAURAL_ROOM_IR only supports ±30 and ±90 degree azimuth" ); } // TODO we could allow {±30,35} front height speakers? if ( ele_abs[0] != 0 || ele_abs[1] != 0 ) { fprintf( stderr, "Warning: elevation must be zero for BINAURAL_ROOM_IR" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "BINAURAL_ROOM_IR does not allow nonzero elevation" ); } /* flag to select ±90 azi loudspeakers */ if ( azi_abs[0] == 90 && azi_abs[1] == 90 ) { pMsUpmixConfig->stereoLR = TRUE; } } else /* HRIR based formats and split rendering */ { /* enforce symmetry */ if ( pMsUpmixConfig->azi[0] != -pMsUpmixConfig->azi[1] ) { fprintf( stderr, "Warning: azimuth for stereo pair must be symmetric" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair with asymmetric azimuth is not allowed" ); } if ( pMsUpmixConfig->ele[0] != pMsUpmixConfig->ele[1] ) { fprintf( stderr, "Warning: elevations for stereo pair must match" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair with differring elevation is not allowed" ); } if ( ( azi_abs[0] > 90 ) || ( azi_abs[1] > 90 ) ) /* restrict values */ if ( ( azi_abs[0] > 90 ) || ( azi_abs[1] > 90 ) ) { fprintf( stderr, "Warning: panning stereo pair beyond 90deg azimuth" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair beyond |90| degrees azimuth is not allowed" ); } if ( ( ele_abs[0] > 45 ) || ( ele_abs[1] > 45 ) ) if ( ( ele_abs[0] > 45 ) || ( ele_abs[1] > 45 ) ) { fprintf( stderr, "Warning: panning stereo pair beyond 45deg elevation" ); return IVAS_ERROR( IVAS_ERR_INVALID_RENDER_CONFIG, "Panning stereo pair beyond |45| degrees of elevation is not allowed" ); } } } #endif return IVAS_ERR_OK; } Loading