Commit afad5e2e authored by Jouni Paulus's avatar Jouni Paulus
Browse files

fix issue 373: MSAN error in decoding MASA to EXT. issue caused by missing...

fix issue 373: MSAN error in decoding MASA to EXT. issue caused by missing init at lower sampling rates
parent 98baa369
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -942,6 +942,9 @@ typedef enum

#ifdef FIX_350_MASA_DELAY_COMP
#define DELAY_MASA_PARAM_DEC_SFR                2                           /* Delay to be compensation for MASA parameters in the decoder (subframes) */
#ifdef FIX_373_MASA_DELAY_COMP_MSAN
#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 )                        /* Spherical index corresponding to front direction for setting as default value */
#endif
#endif

#define DIRAC_SLOT_NS                           1250000L                    /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */
+26 −0
Original line number Diff line number Diff line
@@ -314,6 +314,10 @@ void masa_sample_rate_band_correction(
    int16_t *band_mapping,            /* i/o: Band mapping used and modified        */
    IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification  */
    const int32_t sampling_rate       /* i  : Sampling rate                         */
#ifdef FIX_373_MASA_DELAY_COMP_MSAN
    ,
    MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */
#endif
)
{
    uint8_t band, sf;
@@ -386,6 +390,28 @@ void masa_sample_rate_band_correction(
            hQMetaData->twoDirBands[band] = 0;
        }
    }
#ifdef FIX_373_MASA_DELAY_COMP_MSAN
    if ( hExtOutMeta != NULL )
    {
        /* in decoder, zero the EXT out MASA meta buffer */
        for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
        {
            for ( band = config->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ )
            {
                hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT;
                hExtOutMeta->directToTotalRatio[0][sf][band] = 0u;
                hExtOutMeta->spreadCoherence[0][sf][band] = 0u;

                hExtOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT;
                hExtOutMeta->directToTotalRatio[1][sf][band] = 0u;
                hExtOutMeta->spreadCoherence[1][sf][band] = 0u;

                hExtOutMeta->surroundCoherence[sf][band] = 0u;
                hExtOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX;
            }
        }
    }
#endif

    return;
}
+3 −0
Original line number Diff line number Diff line
@@ -4534,6 +4534,9 @@ void masa_sample_rate_band_correction(
    int16_t *band_mapping,                                      /* i/o: Band mapping used and modified                  */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: QMetadata structure for modification            */
    const int32_t sampling_rate                                 /* i  : sampling rate                                   */
#ifdef FIX_373_MASA_DELAY_COMP_MSAN
    , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta             /* i/o: MASA decoder metadata ext out buffer             */
#endif
);

void invdct4_transform(
+1 −0
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@
#define TD5                                             /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */
#define TD5_FIX_INVALID_MEMORY_ACCESS                   /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */
#define FIX_371_DELAY_REPORT                            /* Issue 371: div. by zero with -no_delay_cmp */
#define FIX_373_MASA_DELAY_COMP_MSAN                    /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */

#ifdef FIX_I109_ORIENTATION_TRACKING
#define OTR_REFERENCE_VECTOR_TRACKING                 /* FhG: enables the reference position orientation tracking mode */
+12 −0
Original line number Diff line number Diff line
@@ -492,7 +492,19 @@ static ivas_error ivas_masa_dec_config(

    ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format );

#ifdef FIX_373_MASA_DELAY_COMP_MSAN
    if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL )
    {
        /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */
        masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, hMasa->data.extOutMeta );
    }
    else
    {
        masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, NULL );
    }
#else
    masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs );
#endif

    return error;
}
Loading