Commit beea05b2 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/va/omasa_updt' into...

Merge remote-tracking branch 'remotes/origin/va/omasa_updt' into nokia/contribution-omasa-combined-format
parents 3b64b06c 5afac642
Loading
Loading
Loading
Loading
Loading
+86 −0
Original line number Diff line number Diff line
@@ -462,6 +462,47 @@ int16_t get_ivas_max_num_indices( /* o : maximum
            return 1650;
        }
    }
#ifdef MASA_AND_OBJECTS
    else if ( ivas_format == MASA_ISM_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_16k4 )
        {
            return 300;
        }
        else if ( ivas_total_brate <= IVAS_32k )
        {
            return 400;
        }
        else if ( ivas_total_brate <= IVAS_48k )
        {
            return 650;
        }
        else if ( ivas_total_brate <= IVAS_80k )
        {
            return 750;
        }
        else if ( ivas_total_brate <= IVAS_160k )
        {
            return 850;
        }
        else if ( ivas_total_brate <= IVAS_192k )
        {
            return 950;
        }
        else if ( ivas_total_brate <= IVAS_256k )
        {
            return 1150;
        }
        else if ( ivas_total_brate <= IVAS_384k )
        {
            return 1450;
        }
        else
        {
            return 1650;
        }
    }
#endif
    else if ( ivas_format == MC_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_16k4 )
@@ -862,6 +903,51 @@ int16_t get_ivas_max_num_indices_metadata( /* o
#endif
        }
    }
#ifdef MASA_AND_OBJECTS
    else if ( ivas_format == MASA_ISM_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_16k4 )
        {
            return 80;
        }
        else if ( ivas_total_brate <= IVAS_32k )
        {
            return 125 + 100;
        }
        else if ( ivas_total_brate <= IVAS_48k )
        {
            return 205 + 100;
        }
        else if ( ivas_total_brate <= IVAS_96k )
        {
            return 240 + 100;
        }
        else if ( ivas_total_brate <= IVAS_128k )
        {
            return 305 + 30;
        }
        else if ( ivas_total_brate <= IVAS_160k )
        {
            return 425 + 30;
        }
        else if ( ivas_total_brate <= IVAS_192k )
        {
            return 630 + 30;
        }
        else if ( ivas_total_brate <= IVAS_256k )
        {
            return 850 + 30;
        }
        else if ( ivas_total_brate <= IVAS_384k )
        {
            return 1000 + 30;
        }
        else
        {
            return 1750 + 30;
        }
    }
#endif
    else if ( ivas_format == MC_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_13k2 )
+2 −2
Original line number Diff line number Diff line
@@ -134,8 +134,8 @@
/* ################# Start DEVELOPMENT switches ######################## */

#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */
/* Todo OMASA: This needs to be implemented for OMASA */
/*#define IND_LIST_DYN */                                    /* VA: Issue 18: Dynamic allocation of ind_list[] and ind_list_metadata[] based on # of transport channels */

#define IND_LIST_DYN                                    /* VA: Issue 18: Dynamic allocation of ind_list[] and ind_list_metadata[] based on # of transport channels */

#ifndef IND_LIST_DYN
#define BITSTREAM_INDICES_MEMORY                        /* Don't count memory for bitstream Indice at the encoder - it is a temporary solution for development only */
+13 −0
Original line number Diff line number Diff line
@@ -319,7 +319,9 @@ ivas_error ivas_enc(
            return error;
        }

#ifndef IND_LIST_DYN
        hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData;
#endif

        /* Stereo transport is used also with monoMASA, duplicate mono if monoMASA */
        if ( ( st_ivas->hEncoderConfig->nchan_inp - hEncoderConfig->nchan_ism ) == 1 )
@@ -407,6 +409,17 @@ ivas_error ivas_enc(
            n = st_ivas->hEncoderConfig->nchan_ism;
        }

#ifdef IND_LIST_DYN
        hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData;

        if ( st_ivas->nSCE > 0 )
        {
            /* update pointer to the buffer of indices (ISM indices were alredy written) */
            hMetaData->ind_list = st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData->ind_list + st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData->nb_ind_tot;
            st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->ind_list = st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0]->hBstr->ind_list + st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0]->hBstr->nb_ind_tot;
        }
#endif

        /* Encode MASA parameters and write MASA metadata bitstream */
        if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, nb_bits_metadata, st_ivas->nchan_transport, ivas_format, ivas_total_brate, st_ivas->hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1,
                                         st_ivas->ism_mode, hEncoderConfig->nchan_ism, st_ivas->hIsmMetaData, idx_separated_object, st_ivas->hOMasa, st_ivas->hIsmMetaData[0]->ism_imp
+4 −1
Original line number Diff line number Diff line
@@ -661,12 +661,14 @@ ivas_error ivas_init_encoder(
                return error;
            }

#ifndef IND_LIST_DYN
            /* prepare bitstream buffers */
            st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list[sce_id];
            reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES );

            st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata[sce_id];
            reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA );
#endif
        }

        if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK )
@@ -706,7 +708,7 @@ ivas_error ivas_init_encoder(
            return error;
        }


#ifndef IND_LIST_DYN
        /* prepare bitstream buffers */
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
@@ -716,6 +718,7 @@ ivas_error ivas_init_encoder(

        st_ivas->hCPE[0]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE];
        reset_indices_enc( st_ivas->hCPE[0]->hMetaData, MAX_BITS_METADATA );
#endif
    }
#endif
    else if ( ivas_format == MC_FORMAT )
+14 −2
Original line number Diff line number Diff line
@@ -253,11 +253,23 @@ ivas_error ivas_omasa_enc_config(
        /* re-write IVAS format signalling - actual 'ism_mode' was not known before */
        if ( st_ivas->nSCE > 0 )
        {
            reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->next_ind );
            reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr,
#ifdef IND_LIST_DYN
                               st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot
#else
                               st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->next_ind
#endif
            );
        }
        else
        {
            reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->next_ind );
            reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr,
#ifdef IND_LIST_DYN
                               st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot
#else
                               st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->next_ind
#endif
            );
        }

        ivas_write_format( st_ivas );