Loading lib_enc/lib_enc.c +58 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); #ifdef ISM_BITRATE_SWITCHING static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ); #endif static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); Loading Loading @@ -761,6 +764,12 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { #ifdef ISM_BITRATE_SWITCHING if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) { return error; } #else if ( hEncoderConfig->ivas_total_brate > IVAS_256k ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); Loading @@ -777,6 +786,7 @@ static ivas_error configureEncoder( { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } #endif } else if ( hEncoderConfig->ivas_format == SBA_FORMAT ) { Loading Loading @@ -1625,6 +1635,9 @@ static ivas_error setBitrate( { Encoder_Struct *st_ivas; ENCODER_CONFIG_HANDLE hEncoderConfig; #ifdef ISM_BITRATE_SWITCHING ivas_error error; #endif st_ivas = hIvasEnc->st_ivas; hEncoderConfig = st_ivas->hEncoderConfig; Loading Loading @@ -1671,6 +1684,16 @@ static ivas_error setBitrate( } } #ifdef ISM_BITRATE_SWITCHING if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) { return error; } } #endif st_ivas->codec_mode = MODE1; if ( hEncoderConfig->element_mode_init == EVS_MONO ) Loading Loading @@ -1897,6 +1920,41 @@ static ivas_error sanitizeBandwidth( } #ifdef ISM_BITRATE_SWITCHING /*---------------------------------------------------------------------* * sanitizeBitrateISM() * * *---------------------------------------------------------------------*/ static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ) { if ( hEncoderConfig->ivas_total_brate > IVAS_256k ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_16k4 && hEncoderConfig->nchan_inp == 2 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 2 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 3 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 3 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 4 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * setBandwidth() * Loading Loading
lib_enc/lib_enc.c +58 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); #ifdef ISM_BITRATE_SWITCHING static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ); #endif static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); Loading Loading @@ -761,6 +764,12 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { #ifdef ISM_BITRATE_SWITCHING if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) { return error; } #else if ( hEncoderConfig->ivas_total_brate > IVAS_256k ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); Loading @@ -777,6 +786,7 @@ static ivas_error configureEncoder( { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } #endif } else if ( hEncoderConfig->ivas_format == SBA_FORMAT ) { Loading Loading @@ -1625,6 +1635,9 @@ static ivas_error setBitrate( { Encoder_Struct *st_ivas; ENCODER_CONFIG_HANDLE hEncoderConfig; #ifdef ISM_BITRATE_SWITCHING ivas_error error; #endif st_ivas = hIvasEnc->st_ivas; hEncoderConfig = st_ivas->hEncoderConfig; Loading Loading @@ -1671,6 +1684,16 @@ static ivas_error setBitrate( } } #ifdef ISM_BITRATE_SWITCHING if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) { return error; } } #endif st_ivas->codec_mode = MODE1; if ( hEncoderConfig->element_mode_init == EVS_MONO ) Loading Loading @@ -1897,6 +1920,41 @@ static ivas_error sanitizeBandwidth( } #ifdef ISM_BITRATE_SWITCHING /*---------------------------------------------------------------------* * sanitizeBitrateISM() * * *---------------------------------------------------------------------*/ static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ) { if ( hEncoderConfig->ivas_total_brate > IVAS_256k ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_16k4 && hEncoderConfig->nchan_inp == 2 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 2 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 3 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 3 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 4 ) { return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * setBandwidth() * Loading