diff --git a/apps/decoder.c b/apps/decoder.c index 792bc268a46551ffca5e793a929d61c49f898eb9..79c825809ea3149a19ea74e7db2f2f902c9f66a6 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -202,7 +202,11 @@ static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM +static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, const int16_t num_subframes, ObjectEditFileReader *objectEditFileReader ); +#else static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); +#endif #else static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters ); #endif @@ -2471,7 +2475,11 @@ static ivas_error decodeG192( /* Do object metadata editing here ... */ #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM + do_object_editing( &editableParameters, num_subframes, objectEditFileReader ); +#else do_object_editing( &editableParameters, objectEditFileReader ); +#endif #else do_object_editing( &editableParameters ); #endif @@ -3048,7 +3056,7 @@ static ivas_error decodeVoIP( bool bitstreamReadDone = false; - bool parameterAvailableForEditing = false; + bool parametersAvailableForEditing = false; uint16_t nSamplesRendered = 0; vec_pos_update = 0; @@ -3282,11 +3290,18 @@ static ivas_error decodeVoIP( #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( arg.objEditEnabled && ( arg.objEditFileName != NULL ) ) { - if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM + if ( frame * num_subframes % IVAS_MAX_PARAM_SPATIAL_SUBFRAMES == 0 ) { - fprintf( stderr, "\nError: could not read object editing instructions from file: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - return error; +#endif + if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: could not read object editing instructions from file: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + return error; + } +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM } +#endif } #endif @@ -3344,7 +3359,7 @@ static ivas_error decodeVoIP( while ( nSamplesRendered < nOutSamples ) { #ifdef SUPPORT_JBM_TRACEFILE - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶metersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #endif @@ -3378,7 +3393,7 @@ static ivas_error decodeVoIP( } /* Object metadata editing */ - if ( arg.objEditEnabled && parameterAvailableForEditing == true ) + if ( arg.objEditEnabled && parametersAvailableForEditing == true ) { IVAS_EDITABLE_PARAMETERS editableParameters; @@ -3391,7 +3406,11 @@ static ivas_error decodeVoIP( /* Do object metadata editing here ... */ #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM + do_object_editing( &editableParameters, num_subframes, objectEditFileReader ); +#else do_object_editing( &editableParameters, objectEditFileReader ); +#endif #else do_object_editing( &editableParameters ); #endif @@ -3696,6 +3715,9 @@ cleanup: static void do_object_editing( #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE IVAS_EDITABLE_PARAMETERS *editableParameters, +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM + const int16_t num_subframes, +#endif ObjectEditFileReader *objectEditFileReader ) #else IVAS_EDITABLE_PARAMETERS *editableParameters ) @@ -3794,7 +3816,12 @@ static void do_object_editing( /* breakover object gains */ for ( obj_idx = 0; obj_idx < editableParameters->num_obj; obj_idx++ ) { - editableParameters->ism_metadata[obj_idx].gain = 0.5f + (float) ( ( frame + obj_idx * 50 ) % 250 ) / 250.0f; +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM + editableParameters->ism_metadata[obj_idx].gain = 0.5f + (float) ( ( ( frame * num_subframes / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) + obj_idx * 50 ) % 250 ) / 250.0f; + +#else + editableParameters->ism_metadata[obj_idx].gain = 0.5f + (float) ( ( frame + obj_idx * 50 ) % 250 ) / 250.0f; +#endif } editableParameters->gain_bed = 0.5f; diff --git a/lib_com/options.h b/lib_com/options.h index a068276baaadde409880d586cbe2639e1bd456df..f6aaeba759675fcca726323c94a1e41ea93b48da 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,8 @@ #define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ #define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */ +#define NONBE_FIX_1255_OBJ_EDIT_JBM /* VA: issue 1255: restore object editing in JBM */ + /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 65d2044a52f0292678047be39e6ef5a71863fd8c..d4e4f91430bed50d2f1a45ee7154cbe172b44434 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3627,12 +3627,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; hIvasDec->nSamplesRendered = 0; } - +#ifndef NONBE_FIX_1255_OBJ_EDIT_JBM if ( hIvasDec->hasBeenFedFirstGoodFrame ) { *parametersAvailableForEditing = true; return IVAS_ERR_OK; } +#endif } /* decode */ @@ -3668,6 +3669,12 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hIvasDec->nSamplesFlushed = nSamplesFlushed_ref; *bitstreamReadDone = false; +#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM + *parametersAvailableForEditing = true; + return IVAS_ERR_OK; +#else + +#endif } }