Loading apps/encoder.c +17 −0 Original line number Diff line number Diff line Loading @@ -467,6 +467,15 @@ int main( goto cleanup; } #ifdef MEM_ALLOC_APP_NONBE /* Initialize IVAS encoder handles and allocate the memory */ if ( ( error = IVAS_ENC_Initialize( hIvasEnc ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_Initialize failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } #endif if ( ( error = IVAS_ENC_PrintConfig( hIvasEnc, caConfig.channelAwareModeEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\n IVAS_ENC_PrintConfig failed %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); Loading Loading @@ -778,6 +787,14 @@ int main( } } #ifdef MEM_ALLOC_APP_NONBE /* Reconfigure IVAS encoder handles and reallocate the memory if IVAS total bitrate has changed */ if ( ( error = IVAS_ENC_Reconfigure( hIvasEnc ) ) != IVAS_ERR_OK ) { return error; } #endif /* *** Encode one frame *** */ if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits ) ) != IVAS_ERR_OK ) { Loading lib_com/ivas_prot.h +6 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,12 @@ void ivas_destroy_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); #ifdef MEM_ALLOC_APP ivas_error ivas_reconfig_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); #endif ivas_error ivas_init_decoder_front( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); Loading lib_com/options.h +3 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,9 @@ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ #define MEM_ALLOC_APP /* VA: call memory allocate/reallocation from the application */ #define MEM_ALLOC_APP_NONBE /* ################## End BE DEVELOPMENT switches ######################### */ /* #################### Start NON-BE CR switches ########################## */ Loading lib_enc/ivas_enc.c +27 −6 Original line number Diff line number Diff line Loading @@ -148,6 +148,15 @@ ivas_error ivas_enc( } #endif #ifndef MEM_ALLOC_APP_NONBE #ifdef MEM_ALLOC_APP if ( ( error = ivas_reconfig_enc( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif #endif /*----------------------------------------------------------------* * write IVAS format signaling *----------------------------------------------------------------*/ Loading @@ -168,12 +177,13 @@ ivas_error ivas_enc( } else if ( ivas_format == ISM_FORMAT ) { #ifndef MEM_ALLOC_APP /* select ISM format mode; reconfigure the ISM format encoder */ if ( ( error = ivas_ism_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_param_ism_enc( st_ivas, data_f, input_frame ); Loading Loading @@ -203,11 +213,12 @@ ivas_error ivas_enc( /* SBA/MASA configuration */ if ( ivas_format == SBA_FORMAT ) { #ifndef MEM_ALLOC_APP if ( ( error = ivas_sba_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; /* Write SBA planar flag */ Loading @@ -216,10 +227,12 @@ ivas_error ivas_enc( /* Write SBA order */ push_indice( st->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); } #ifndef MEM_ALLOC_APP else { ivas_masa_enc_reconfigure( st_ivas ); } #endif /* SBA/MASA metadata encoding and SBA/MASA metadata bitstream writing */ hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; Loading @@ -228,10 +241,12 @@ ivas_error ivas_enc( { ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ #ifndef MEM_ALLOC_APP if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 ) ) != IVAS_ERR_OK ) Loading Loading @@ -293,11 +308,12 @@ ivas_error ivas_enc( /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); #ifndef MEM_ALLOC_APP if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); idx_separated_object = 0; data_separated_object = data_f[hEncoderConfig->nchan_ism + CPE_CHANNELS]; Loading Loading @@ -368,9 +384,9 @@ ivas_error ivas_enc( } else if ( ivas_format == SBA_ISM_FORMAT ) { #ifndef MEM_ALLOC_APP ivas_osba_enc_reconfig( st_ivas ); #endif /* Analyze objects and determine needed audio signals */ ivas_osba_enc( st_ivas->hOSba, st_ivas->hIsmMetaData, data_f, input_frame, hEncoderConfig->nchan_ism, st_ivas->ism_mode, st_ivas->sba_analysis_order, hEncoderConfig->input_Fs ); Loading Loading @@ -493,12 +509,17 @@ ivas_error ivas_enc( } else if ( ivas_format == MC_FORMAT ) { #ifdef MEM_ALLOC_APP /* write MC LS setup */ st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->mc_input_setup, MC_LS_SETUP_BITS ); #else /* select MC format mode; write MC LS setup; reconfigure the MC format encoder */ if ( ( error = ivas_mc_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; /* LFE low pass filter */ Loading lib_enc/ivas_init_enc.c +64 −0 Original line number Diff line number Diff line Loading @@ -1222,3 +1222,67 @@ void ivas_destroy_enc( return; } #ifdef MEM_ALLOC_APP /*------------------------------------------------------------------------- * ivas_reconfig_enc() * * Reconfigure IVAS encoder handles and reallocate the memory based on * changes of 'hEncoderConfig' parameters, typically ivas_total_brate *-------------------------------------------------------------------------*/ ivas_error ivas_reconfig_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { ivas_error error; IVAS_FORMAT ivas_format; ivas_format = st_ivas->hEncoderConfig->ivas_format; if ( ivas_format == STEREO_FORMAT ) { /* stereo_memory_enc() is called from ivas_cpe_enc() */ return IVAS_ERR_OK; } else if ( ivas_format == ISM_FORMAT ) { /* select ISM format mode; reconfigure the ISM format encoder */ error = ivas_ism_enc_config( st_ivas ); } else if ( ivas_format == SBA_FORMAT ) { /* reconfigure the SBA format encoder */ error = ivas_sba_enc_reconfigure( st_ivas ); } else if ( ivas_format == MASA_FORMAT ) { ivas_masa_enc_reconfigure( st_ivas ); /* reconfigure the SBA format encoder */ error = ivas_masa_enc_config( st_ivas ); } else if ( ivas_format == SBA_ISM_FORMAT ) { /* select ISM format mode; reconfigure the OSBA format encoder */ error = ivas_osba_enc_reconfig( st_ivas ); } else if ( ivas_format == MASA_ISM_FORMAT ) { /* select ISM format mode; reconfigure the OMASA format encoder */ error = ivas_omasa_enc_config( st_ivas ); } else if ( ivas_format == MC_FORMAT ) { /* select MC format mode; reconfigure the MC format encoder */ error = ivas_mc_enc_config( st_ivas ); } else { return IVAS_ERROR( IVAS_ERR_INVALID_INPUT_FORMAT, "Error: unsupported input audio format" ); } return error; } #endif Loading
apps/encoder.c +17 −0 Original line number Diff line number Diff line Loading @@ -467,6 +467,15 @@ int main( goto cleanup; } #ifdef MEM_ALLOC_APP_NONBE /* Initialize IVAS encoder handles and allocate the memory */ if ( ( error = IVAS_ENC_Initialize( hIvasEnc ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_Initialize failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } #endif if ( ( error = IVAS_ENC_PrintConfig( hIvasEnc, caConfig.channelAwareModeEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\n IVAS_ENC_PrintConfig failed %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); Loading Loading @@ -778,6 +787,14 @@ int main( } } #ifdef MEM_ALLOC_APP_NONBE /* Reconfigure IVAS encoder handles and reallocate the memory if IVAS total bitrate has changed */ if ( ( error = IVAS_ENC_Reconfigure( hIvasEnc ) ) != IVAS_ERR_OK ) { return error; } #endif /* *** Encode one frame *** */ if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits ) ) != IVAS_ERR_OK ) { Loading
lib_com/ivas_prot.h +6 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,12 @@ void ivas_destroy_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); #ifdef MEM_ALLOC_APP ivas_error ivas_reconfig_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); #endif ivas_error ivas_init_decoder_front( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); Loading
lib_com/options.h +3 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,9 @@ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ #define MEM_ALLOC_APP /* VA: call memory allocate/reallocation from the application */ #define MEM_ALLOC_APP_NONBE /* ################## End BE DEVELOPMENT switches ######################### */ /* #################### Start NON-BE CR switches ########################## */ Loading
lib_enc/ivas_enc.c +27 −6 Original line number Diff line number Diff line Loading @@ -148,6 +148,15 @@ ivas_error ivas_enc( } #endif #ifndef MEM_ALLOC_APP_NONBE #ifdef MEM_ALLOC_APP if ( ( error = ivas_reconfig_enc( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif #endif /*----------------------------------------------------------------* * write IVAS format signaling *----------------------------------------------------------------*/ Loading @@ -168,12 +177,13 @@ ivas_error ivas_enc( } else if ( ivas_format == ISM_FORMAT ) { #ifndef MEM_ALLOC_APP /* select ISM format mode; reconfigure the ISM format encoder */ if ( ( error = ivas_ism_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_param_ism_enc( st_ivas, data_f, input_frame ); Loading Loading @@ -203,11 +213,12 @@ ivas_error ivas_enc( /* SBA/MASA configuration */ if ( ivas_format == SBA_FORMAT ) { #ifndef MEM_ALLOC_APP if ( ( error = ivas_sba_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; /* Write SBA planar flag */ Loading @@ -216,10 +227,12 @@ ivas_error ivas_enc( /* Write SBA order */ push_indice( st->hBstr, IND_SMODE, hEncoderConfig->sba_order, SBA_ORDER_BITS ); } #ifndef MEM_ALLOC_APP else { ivas_masa_enc_reconfigure( st_ivas ); } #endif /* SBA/MASA metadata encoding and SBA/MASA metadata bitstream writing */ hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; Loading @@ -228,10 +241,12 @@ ivas_error ivas_enc( { ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ #ifndef MEM_ALLOC_APP if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1, ISM_MODE_NONE, -1, NULL, -1, NULL, 0, 0 ) ) != IVAS_ERR_OK ) Loading Loading @@ -293,11 +308,12 @@ ivas_error ivas_enc( /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); #ifndef MEM_ALLOC_APP if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); idx_separated_object = 0; data_separated_object = data_f[hEncoderConfig->nchan_ism + CPE_CHANNELS]; Loading Loading @@ -368,9 +384,9 @@ ivas_error ivas_enc( } else if ( ivas_format == SBA_ISM_FORMAT ) { #ifndef MEM_ALLOC_APP ivas_osba_enc_reconfig( st_ivas ); #endif /* Analyze objects and determine needed audio signals */ ivas_osba_enc( st_ivas->hOSba, st_ivas->hIsmMetaData, data_f, input_frame, hEncoderConfig->nchan_ism, st_ivas->ism_mode, st_ivas->sba_analysis_order, hEncoderConfig->input_Fs ); Loading Loading @@ -493,12 +509,17 @@ ivas_error ivas_enc( } else if ( ivas_format == MC_FORMAT ) { #ifdef MEM_ALLOC_APP /* write MC LS setup */ st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->mc_input_setup, MC_LS_SETUP_BITS ); #else /* select MC format mode; write MC LS setup; reconfigure the MC format encoder */ if ( ( error = ivas_mc_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } #endif hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; /* LFE low pass filter */ Loading
lib_enc/ivas_init_enc.c +64 −0 Original line number Diff line number Diff line Loading @@ -1222,3 +1222,67 @@ void ivas_destroy_enc( return; } #ifdef MEM_ALLOC_APP /*------------------------------------------------------------------------- * ivas_reconfig_enc() * * Reconfigure IVAS encoder handles and reallocate the memory based on * changes of 'hEncoderConfig' parameters, typically ivas_total_brate *-------------------------------------------------------------------------*/ ivas_error ivas_reconfig_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { ivas_error error; IVAS_FORMAT ivas_format; ivas_format = st_ivas->hEncoderConfig->ivas_format; if ( ivas_format == STEREO_FORMAT ) { /* stereo_memory_enc() is called from ivas_cpe_enc() */ return IVAS_ERR_OK; } else if ( ivas_format == ISM_FORMAT ) { /* select ISM format mode; reconfigure the ISM format encoder */ error = ivas_ism_enc_config( st_ivas ); } else if ( ivas_format == SBA_FORMAT ) { /* reconfigure the SBA format encoder */ error = ivas_sba_enc_reconfigure( st_ivas ); } else if ( ivas_format == MASA_FORMAT ) { ivas_masa_enc_reconfigure( st_ivas ); /* reconfigure the SBA format encoder */ error = ivas_masa_enc_config( st_ivas ); } else if ( ivas_format == SBA_ISM_FORMAT ) { /* select ISM format mode; reconfigure the OSBA format encoder */ error = ivas_osba_enc_reconfig( st_ivas ); } else if ( ivas_format == MASA_ISM_FORMAT ) { /* select ISM format mode; reconfigure the OMASA format encoder */ error = ivas_omasa_enc_config( st_ivas ); } else if ( ivas_format == MC_FORMAT ) { /* select MC format mode; reconfigure the MC format encoder */ error = ivas_mc_enc_config( st_ivas ); } else { return IVAS_ERROR( IVAS_ERR_INVALID_INPUT_FORMAT, "Error: unsupported input audio format" ); } return error; } #endif