Commit 6711b564 authored by vaclav's avatar vaclav
Browse files

- introduce OMASA_BRATE_FIX_ALT

parent c9f90ac8
Loading
Loading
Loading
Loading
+42 −2
Original line number Diff line number Diff line
@@ -741,9 +741,47 @@ int32_t ivas_interformat_brate(
/*---------------------------------------------------------------
 * ivas_combined_format_brate_sanity()
 *
 * 
 * Sanity check in combined format coding
 * ---------------------------------------------------------------*/

#ifdef OMASA_BRATE_FIX_ALT
void ivas_combined_format_brate_sanity(
    const int32_t element_brate, /* i  : element bitrate                */
    const int16_t core,          /* i  : core                           */
    int32_t *core_brate,         /* i/o: core bitrate                   */
    int16_t *diff_nBits          /* o  : number of differential bits    */
)
{
    int16_t limit_high, nBits;

    /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by
    low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget
    for ACELP core-coding @12.8 kHz is too high */

    if ( element_brate < ACELP_12k8_HIGH_LIMIT )
    {
        limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC;
        nBits = (int16_t) ( *core_brate / FRAMES_PER_SEC );

        *diff_nBits = nBits - limit_high;
        if ( *diff_nBits > 0 )
        {
            if ( core == TCX_20_CORE || core == TCX_10_CORE )
            {
                *diff_nBits = 0;
            }
            else /* ACELP core */
            {
                *core_brate -= ( *diff_nBits * FRAMES_PER_SEC );
            }
        }
    }

    return;
}

#else

void ivas_combined_format_brate_sanity(
    const int32_t element_brate, /* i  : element bitrate               */
    const int32_t brate_surplus, /* i  : surplus bitrate               */
@@ -762,7 +800,8 @@ void ivas_combined_format_brate_sanity(
    nBits_CPE += (int16_t) ( brate_surplus / FRAMES_PER_SEC );
    nBits_CPE -= ( WB_TBE_0k35 / FRAMES_PER_SEC );
    nBits_CPE -= nb_bits_metadata[1];
    nBits_CPE -= 14;
    nBits_CPE -= ( IVAS_FORMAT_SIGNALING_NBITS_SBA + 1 );
    nBits_CPE -= 10;

    *diff_nBits = 0;
    if ( nchan_ism == 1 && element_brate < ACELP_12k8_HIGH_LIMIT )
@@ -780,3 +819,4 @@ void ivas_combined_format_brate_sanity(
}
#endif
#endif
#endif
+9 −0
Original line number Diff line number Diff line
@@ -5179,6 +5179,14 @@ int32_t ivas_interformat_brate(
);

#ifdef OMASA_BRATE_FIX
#ifdef OMASA_BRATE_FIX_ALT
void ivas_combined_format_brate_sanity(
    const int32_t element_brate,                                /* i  : element bitrate                         */
    const int16_t core,                                         /* i  : core                                    */
    int32_t *core_brate,                                        /* i/o: core bitrate                            */
    int16_t *diff_nBits                                         /* o  : number of differential bits             */
);
#else
void ivas_combined_format_brate_sanity(
    const int32_t element_brate,                                /* i  : element bitrate                         */
    const int32_t brate_surplus,                                /* i  : surplus bitrate                         */
@@ -5188,6 +5196,7 @@ void ivas_combined_format_brate_sanity(
);
#endif
#endif
#endif

ISM_MODE ivas_omasa_ism_mode_select(
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
+2 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@

#ifdef DEBUGGING

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#define DEBUG_MODE_INFO                     /* output most important parameters to the subdirectory "res/" */
#ifdef DEBUG_MODE_INFO
/*#define DEBUG_MODE_ACELP*/                    /* output most important ACELP core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_TCX*/                      /* output most important TCX core parameters to the subdirectory "res/" */
@@ -164,6 +164,7 @@
#define MASA_AND_OBJECTS_VE // VA: improve codec print-outs
#define OMASA_BRATE /* VA: combined format bit-budget distribution */
#define OMASA_BRATE_FIX // fix at lowest bitrates and 1 inactive ISM - more verification/tuning needed
#define OMASA_BRATE_FIX_ALT
#define DEBUG_VA // output 'res/brate_ism' and 'res_brate_masa' bit-rates debugging files

#endif
+12 −0
Original line number Diff line number Diff line
@@ -265,6 +265,18 @@ ivas_error ivas_core_dec(
        }
    }


#ifdef OMASA_BRATE_FIX_ALT
    /*------------------------------------------------------------------*
     * Sanity check in combined format coding
     *-----------------------------------------------------------------*/

    if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT && hCPE->brate_surplus > 0 )
    {
        ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, &( sts[0]->core_brate ), &tmps );
    }
#endif

    /*------------------------------------------------------------------*
     * Core Decoding
     *-----------------------------------------------------------------*/
+2 −0
Original line number Diff line number Diff line
@@ -598,8 +598,10 @@ ivas_error ivas_dec(

        st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] );
#endif
#ifndef OMASA_BRATE_FIX_ALT
#ifdef OMASA_BRATE_FIX
        ivas_combined_format_brate_sanity( st_ivas->hCPE[0]->element_brate, st_ivas->hCPE[0]->brate_surplus, nb_bits_metadata, st_ivas->nchan_ism, &n /* temp */ );
#endif
#endif

        /* Audio signal decoding */
Loading