Commit e27e6160 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Implements first version of proper EXT out for MASA in JBM operation.

parent ba33ff88
Loading
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1562,7 +1562,11 @@ static ivas_error initOnFirstGoodFrame(

            /* Duplicate good first frame metadata to fill the beginning of stream. */
            MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
#ifdef FIX_470_MASA_JBM_EXT
            if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
@@ -1830,7 +1834,11 @@ static ivas_error decodeG192(
            else if ( bsFormat == IVAS_DEC_BS_MASA )
            {
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef FIX_470_MASA_JBM_EXT
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
@@ -2378,7 +2386,11 @@ static ivas_error decodeVoIP(
                else if ( bsFormat == IVAS_DEC_BS_MASA )
                {
                    MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef FIX_470_MASA_JBM_EXT
                    if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                    {
                        fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
@@ -2761,7 +2773,11 @@ static ivas_error decodeVariableSpeed(
            else if ( bsFormat == IVAS_DEC_BS_MASA )
            {
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef FIX_470_MASA_JBM_EXT
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
@@ -2903,7 +2919,11 @@ static ivas_error decodeVariableSpeed(
            else if ( bsFormat == IVAS_DEC_BS_MASA )
            {
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef FIX_470_MASA_JBM_EXT
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
+3 −0
Original line number Diff line number Diff line
@@ -213,6 +213,9 @@ typedef enum
#define MAX_JBM_L_FRAME_NS                      40000000L
#define MAX_SPAR_INTERNAL_CHANNELS              IVAS_SPAR_MAX_CH
#define MAX_CLDFB_DIGEST_CHANNELS               4
#ifdef FIX_470_MASA_JBM_EXT
#define MASA_JBM_RINGBUFFER_FRAMES              3
#endif

typedef enum
{
+22 −1
Original line number Diff line number Diff line
@@ -826,6 +826,17 @@ int16_t ivas_jbm_dec_get_num_tc_channels(
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder handle                                         */
);

#ifdef FIX_470_MASA_JBM_EXT
void ivas_jbm_dec_get_md_map_even_spacing(
    const int16_t default_len,  /* i  : default frame length in metadata slots         */
    const int16_t len,          /* i  : length of the modfied frames in metadata slots */
    const int16_t subframe_len, /* i  : default length of a subframe                   */
    const int16_t offset,       /* i  : current read offset into the md buffer         */
    const int16_t buf_len,      /* i  : length of the metadata buffer                  */
    int16_t *map                /* o  : metadata index map                             */
);
#endif

TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( 
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder handle                                         */
);
@@ -862,6 +873,16 @@ void ivas_jbm_dec_td_renderers_adapt_subframes(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                                      */
);

#ifdef FIX_470_MASA_JBM_EXT
ivas_error ivas_jbm_dec_metadata_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                                      */
);

void ivas_jbm_masa_sf_to_sf_map(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                                      */
);
#endif


/*----------------------------------------------------------------------------------*
 * ISM prototypes
+1 −0
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@
#define FIX_506                                         /* FhG: Compiler warnings */
#define FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH            /* Nokia: Issue 511, significant optimization of parametric binauralizer gain fetching. */
#define FIX_531_BWS_ISM_BFI                             /* VA: issue 531: fix MemorySanitizer: use-of-uninitialized-value in ISM2 rate switching with frame errors */
#define FIX_470_MASA_JBM_EXT                            /* Nokia: Issue 470, fix MASA EXT output with JBM */


/* ################## End DEVELOPMENT switches ######################### */
+8 −0
Original line number Diff line number Diff line
@@ -2305,7 +2305,15 @@ void ivas_dirac_dec_set_md_map(

    set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME );

#ifdef FIX_470_MASA_JBM_EXT
    if ( st_ivas->ivas_format == MASA_FORMAT )
    {
        ivas_jbm_dec_get_md_map_even_spacing( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map );
    }
    else if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
#else
    if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 )
#endif
    {
        ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map );
    }
Loading