Commit 48014e7d authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/main' into 2162_basop_port_mr_2244_headrotdata_sanitizer_rend

parents 7fb90c85 6a0839c7
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ target_link_libraries(ISAR_post_rend lib_basop lib_isar lib_util lib_com)
target_include_directories(ISAR_post_rend PRIVATE lib_basop lib_isar)

add_executable(ambi_converter apps/ambi_converter.c)
target_link_libraries(ambi_converter lib_util lib_com lib_basop)
target_link_libraries(ambi_converter lib_util lib_com lib_basop lib_debug)
if(UNIX)
  target_link_libraries(ambi_converter m)
endif()
+16 −129

File changed.

Preview size limit exceeded, changes collapsed.

+0 −18
Original line number Diff line number Diff line
@@ -992,9 +992,7 @@ int main(

    while ( 1 )
    {
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        int16_t bfi = 0;
#endif
        int16_t num_in_channels;
        num_in_channels = inBuffer.config.numChannels;

@@ -1003,11 +1001,7 @@ int main(
        {
            ivas_error error_tmp;
            numSamplesRead = (int16_t) inBufferSize;
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi );
#else
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten );
#endif
            if ( error_tmp != IVAS_ERR_OK )
            {
                if ( error_tmp == IVAS_ERR_END_OF_FILE )
@@ -1074,24 +1068,13 @@ int main(
        /* Read from split renderer bfi file if specified */
        if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame )
        {
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            int16_t bfi;
#endif
            if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
#endif
        }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        if ( splitBinNeedsNewFrame )
        {
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
@@ -1100,7 +1083,6 @@ int main(
                goto cleanup;
            }
        }
#endif

        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
+26 −0
Original line number Diff line number Diff line
@@ -74,6 +74,11 @@
#define IVAS_MIN16B_FLT ( -32768.0f )
#define IVAS_MAX16B_FX  32767
#define IVAS_MIN16B_FX  ( -32768 )

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
#define OMASA_TDREND_MATCHING_GAIN_DB ( -2.0f )
#endif

#if !defined( DEBUGGING ) && !defined( WMOPS )
static
#endif
@@ -1262,20 +1267,41 @@ int main(
        }
    }

#ifndef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
    /* Set the total number of objects */
#endif
    if ( args.inConfig.numAudioObjects > 0 )
    {
#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the total number of objects */
#endif
        if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the metadata delay for objects */
#endif
        Word32 var1 = (Word32) ( args.syncMdDelay );
        IF( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, var1 ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS

        /* For OMASA input and BINAURAL output, apply a gain to objects to match the loudness with MASA part */
        if ( args.inConfig.numMasaBuses > 0 && args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL )
        {
            for ( i = 0; i < args.inConfig.numAudioObjects; ++i )
            {
                args.inConfig.audioObjects[i].gain_dB += OMASA_TDREND_MATCHING_GAIN_DB;
            }
        }
#endif
    }

    IVAS_REND_LfePanMtx lfePanMatrix;
+65 −2
Original line number Diff line number Diff line
@@ -2563,7 +2563,71 @@ Word16 BASOP_Util_Cmp_Mant32Exp /*!< o: flag: result of comparison */
     headroom is introduced into acc
*/

#ifdef OPT_2146_BASOP_UTIL_ADD_MANT32EXP
Word32 BASOP_Util_Add_Mant32Exp /* o  : normalized result mantissa */
    ( Word32 a_m,               /* i  : Mantissa of 1st operand a  */
      Word16 a_e,               /* i  : Exponent of 1st operand a  */
      Word32 b_m,               /* i  : Mantissa of 2nd operand b  */
      Word16 b_e,               /* i  : Exponent of 2nd operand b  */
      Word16 *ptr_e )           /* o  : exponent of result         */
{
    Word16 shift;
    /* Compare exponents: the difference is limited to +/- 31
       The Word32 mantissa of the operand with lower exponent is shifted right by the exponent difference.
       Then, the unshifted mantissa of the operand with the higher exponent is added. The addition result
       is normalized and the result represents the mantissa to return. The returned exponent takes into
       account all shift operations.
    */

    if ( !a_m )
    {
        a_e = b_e;
        move16();
    }

    if ( !b_m )
    {
        b_e = a_e;
        move16();
    }

    shift = sub( a_e, b_e );

    if ( shift > 0 )
        shift = s_min( shift, 31 );
    if ( shift < 0 )
        shift = s_max( shift, -31 );

    /* shift > 0 exponent of a is greater than exponent of b */
    if ( shift > 0 )
        b_m = L_shr( b_m, shift );
    /* shift < 0 exponent of b is greater than exponent of a */
    if ( shift < 0 )
        a_m = L_shl( a_m, shift );

    a_m = L_add( L_shr( a_m, 1 ), L_shr( b_m, 1 ) );

    if ( shift >= 0 )
        a_e = add( a_e, 1 );
    if ( shift < 0 )
        a_e = add( b_e, 1 );

    shift = norm_l( a_m );
    if ( shift )
        a_m = L_shl( a_m, shift );
    if ( !a_m )
    {
        a_e = 0;
        move16();
    }
    if ( a_m )
        a_e = sub( a_e, shift );

    *ptr_e = a_e;

    return ( a_m );
}
#else
Word32 BASOP_Util_Add_Mant32Exp /* o  : normalized result mantissa */
    ( Word32 a_m,               /* i  : Mantissa of 1st operand a  */
      Word16 a_e,               /* i  : Exponent of 1st operand a  */
@@ -2580,7 +2644,6 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */
       is normalized and the result represents the mantissa to return. The returned exponent takes into
       account all shift operations.
    */

    if ( !a_m )
    {
        a_e = b_e;
@@ -2622,7 +2685,7 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */

    return ( L_tmp );
}

#endif

static const Word16 shift_lc[] = { 9, 10 };

Loading