Commit 46bd7a90 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge remote-tracking branch 'origin/main' into 1793-fix-decoder-mc-to-mono-output-scaling

# Conflicts:
#	lib_com/options.h
parents a5befdfc 6b98c8e2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -130,6 +130,9 @@ typedef enum
    IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT,
    IVAS_ERR_NO_FILE_OPEN,
    IVAS_ERR_SAMPLING_RATE_UNKNOWN,
#ifdef FIX_1370_EXTERNAL_ORIENTATION_CHECK
    IVAS_ERR_EXTERNAL_ORIENTATION_INVALID_FORMAT,
#endif

    /*----------------------------------------*
     *    renderer (lib_rend only)            *
@@ -269,6 +272,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code )
            return "Invalid input format";
        case IVAS_ERR_INVALID_INDEX:
            return "Invalid index";
#ifdef FIX_1370_EXTERNAL_ORIENTATION_CHECK
        case IVAS_ERR_EXTERNAL_ORIENTATION_INVALID_FORMAT:
            return "Euler angles were detected in the input but only Quaternions are supported";
#endif
        default:
            break;
    }
+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@
#define FIX_2092_ASSERT_IN_OMASA_RENDER                      /* FhG, Nokia: Fix LTV crash due to overflow in OMASA EXT output */
#define FIX_2084_FLOATING_POINT_LEFTOVERS                    /* FhG: convert floating-point leftovers in IVAS_ENC_FeedObjectMetadata() */
#define FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING          /* FhG: Replace L_shl with L_shl_sat to prevent overflow when calculating scale factors for very small numbers in the logarithmic domain */
#define FIX_APA_EXECS_SCALING                                /* VA: fix scaling of JBM APA buffer */

#define FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE                /* FhG: Use dynamic Q factor for synth_fx and synthFB_fx to prevent overflow */
/* ################### End FIXES switches ########################### */

@@ -114,6 +116,8 @@
#define UNIFIED_DECODING_PATHS_LEFTOVERS                /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */
#define FIX_NCHAN_BUFFERS                               /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */
#define FIX_RENDERER_STACK                              /* VA: issue 1322: reduction of renderers' buffers size */
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define NONBE_FIX_1197_OMASA_META_BUFFER                /* Nokia: OMASA ISM_MASA_MODE_PARAM_ONE_OBJ history zero in rateswitching - port 251 */

// object-editing feature porting
#define TMP_FIX_SPLIT_REND                              // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions)
+19 −0
Original line number Diff line number Diff line
@@ -662,6 +662,25 @@ ivas_error ivas_omasa_dec_config_fx(
            ivas_omasa_separate_object_renderer_close( st_ivas );
        }

#ifdef NONBE_FIX_1197_OMASA_META_BUFFER
        test();
        IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) && st_ivas->hMasaIsmData != NULL ) /* this structure is in use only in ISM_MASA_MODE_PARAM_ONE_OBJ */
        {
            MASA_ISM_DATA_HANDLE hMasaIsmData = st_ivas->hMasaIsmData;
            FOR( Word16 obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ )
            {
                set_s( hMasaIsmData->azimuth_ism_fx[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
                set_s( hMasaIsmData->elevation_ism_fx[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
                FOR( int16_t sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ )
                {
                    set_l( hMasaIsmData->energy_ratio_ism_fx[obj_idx][sf], 0, CLDFB_NO_CHANNELS_MAX );
                }
            }
            set_s( hMasaIsmData->azimuth_separated_ism_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
            set_s( hMasaIsmData->elevation_separated_ism_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
        }
#endif

        IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) )
        {
            IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
+16 −0
Original line number Diff line number Diff line
@@ -904,7 +904,11 @@ UWord8 apa_exec_ivas_fx(
    Word16 Q_a_out;
    Word16 Q_a_out_init_old;

#ifdef FIX_APA_EXECS_SCALING
    Q_a_out = add( getScaleFactor32_copy( a_in, l_in ), Q11 - Q16 - Q1 );
#else
    Q_a_out = add( getScaleFactor32_copy( a_in, L_mult0( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 - Q1 );
#endif
    Q_a_out_init_old = Q_a_out; /* store the possible scaling of a_in, to be re-used in the next frame */
    move16();
    statsResetThreshold = 1637;
@@ -981,7 +985,11 @@ UWord8 apa_exec_ivas_fx(
        Scale_sig( ps->buf_out_fx, ps->buf_out_capacity, sub( Q_a_out, ps->Q_buf_out ) ); // Q_buf_out -> Q_a_out
        IF( EQ_32( ps->scale, 100 ) )
        {
#ifdef FIX_APA_EXECS_SCALING
            FOR( i = 0; i < ps->l_frm; i++ )
#else
            FOR( i = 0; i < ps->num_channels * APA_BUF_PER_CHANNEL; i++ )
#endif
            {
                a_out[i] = a_in[i]; // Q11
                move32();
@@ -993,7 +1001,11 @@ UWord8 apa_exec_ivas_fx(
        {
            Word16 *frm_in_ptr = &( frm_in[ps->l_frm] );

#ifdef FIX_APA_EXECS_SCALING
            FOR( i = 0; i < ps->l_frm; i++ )
#else
            FOR( i = 0; i < ps->num_channels * APA_BUF_PER_CHANNEL; i++ )
#endif
            {
                a_tmp[i] = extract_h( L_shl( a_in[i], add( Q_a_out, Q5 ) ) ); // Q_a_out
                move16();
@@ -1043,7 +1055,11 @@ UWord8 apa_exec_ivas_fx(
                }
            }

#ifdef FIX_APA_EXECS_SCALING
            FOR( i = 0; i < l_frm_out; i++ )
#else
            FOR( i = 0; i < ps->num_channels * APA_BUF_PER_CHANNEL; i++ )
#endif
            {
                a_out[i] = L_shl( a_tmp[i], sub( Q11, Q_a_out ) ); // Q0 -> Q11
                move32();
+8 −0
Original line number Diff line number Diff line
@@ -193,6 +193,14 @@ ivas_error ExternalOrientationFileReading(
    }

    ( externalOrientationReader->frameCounter )++;
#ifdef FIX_1370_EXTERNAL_ORIENTATION_CHECK

    /* Only Quaternion orientations are supported, raise an error if Euler angles are detected in the input */
    if ( w == -3.0f )
    {
        return IVAS_ERR_EXTERNAL_ORIENTATION_INVALID_FORMAT;
    }
#endif

    pQuaternion->w_fx = float_to_fix( w, Q29 );
    pQuaternion->x_fx = float_to_fix( x, Q29 );