Commit 0463d891 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Port float MR 2105 to BASOP.

parent 924b04b3
Loading
Loading
Loading
Loading
Loading
+56 −0
Original line number Diff line number Diff line
@@ -129,6 +129,9 @@ typedef struct
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
    bool objEditEnabled;
    char *objEditFileName;
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    IVAS_ROOM_SIZE_T roomSize;
#endif

} DecArguments;

@@ -410,9 +413,15 @@ int main(
    asked_frame_size = arg.renderFramesize;
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;

#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled,
                                       arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.roomSize, arg.non_diegetic_pan_enabled,
                                       arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled,
                                       arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled,
                                       arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -886,6 +895,10 @@ static bool parseCmdlIVAS_dec(
    arg->objEditEnabled = false;
    arg->objEditFileName = NULL;

#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    arg->roomSize = IVAS_ROOM_SIZE_AUTO;
#endif

    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -1360,6 +1373,45 @@ static bool parseCmdlIVAS_dec(
            }
            i++;
        }
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
        else if ( strcmp( argv_to_upper, "-ROOM_SIZE" ) == 0 )
        {
            i++;
            if ( argc - i <= 3 || argv[i][0] == '-' )
            {
                fprintf( stderr, "Error: Room size selector not specified!\n\n" );
                usage_dec();
                return false;
            }

            if ( strlen( argv[i] ) != 1 )
            {
                fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", argv[i] );
                usage_dec();
                return false;
            }
            switch ( argv[i][0] )
            {
                case 'S':
                case 's':
                    arg->roomSize = IVAS_ROOM_SIZE_SMALL;
                    break;
                case 'M':
                case 'm':
                    arg->roomSize = IVAS_ROOM_SIZE_MEDIUM;
                    break;
                case 'L':
                case 'l':
                    arg->roomSize = IVAS_ROOM_SIZE_LARGE;
                    break;
                default:
                    fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", argv[i] );
                    usage_dec();
                    return false;
            }
            i++;
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1565,6 +1617,10 @@ static void usage_dec( void )

    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    fprintf( stdout, "-room_size (S|M|L)  : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" );
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration,\n" );
#endif
    fprintf( stdout, "-q                  : Quiet mode, no frame counter\n" );
    fprintf( stdout, "                      default is deactivated\n" );
    fprintf( stdout, "\n" );
+10 −0
Original line number Diff line number Diff line
@@ -189,6 +189,16 @@ typedef enum

} IVAS_RENDER_FRAMESIZE;

#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
typedef enum
{
    IVAS_ROOM_SIZE_AUTO = -1,
    IVAS_ROOM_SIZE_SMALL,
    IVAS_ROOM_SIZE_MEDIUM,
    IVAS_ROOM_SIZE_LARGE
} IVAS_ROOM_SIZE_T;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE;

+15 −0
Original line number Diff line number Diff line
@@ -1648,11 +1648,26 @@ typedef enum
#define RV_LENGTH_NR_FC                         ( RV_FILTER_MAX_FFT_SIZE / 2 ) + 1

#define RV_LENGTH_NR_FC_16KHZ                   ( RV_FILTER_MAX_FFT_SIZE / 4 ) + 1
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
#define IVAS_REVERB_DEFAULT_L_N_BANDS           31
#define IVAS_REVERB_DEFAULT_M_N_BANDS           31
#define IVAS_REVERB_DEFAULT_S_N_BANDS           60
#else
#define IVAS_REVERB_DEFAULT_N_BANDS             31
#endif

#define LR_IAC_LENGTH_NR_FC                     ( RV_LENGTH_NR_FC )
#define LR_IAC_LENGTH_NR_FC_16KHZ               ( RV_LENGTH_NR_FC_16KHZ )

#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
typedef enum
{
    DEFAULT_REVERB_SMALL,
    DEFAULT_REVERB_MEDIUM,
    DEFAULT_REVERB_LARGE
} IVAS_DefaultReverbSize;
#endif


/*----------------------------------------------------------------------------------*
 * FB mixer constants
+1 −0
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@
#define NONBE_MDCT_ST_DTX_FIX_SUBOPT_SPATIAL_CNG       /* FhG: Fix MDCT-Stereo comfort noise for certain noise types */
#define NONBE_1344_REND_MASA_LOW_FS                     /* Nokia: Issue 1344: Fix sanitizer errors when using IVAS_rend to render MASA with lower sampling rates */
#define NONBE_1412_AVOID_ROUNDING_AZ_ELEV               /* FhG:  Avoid rounding when passing azimuth and elevation to efap_determine_gains() */
#define FIX_1318_ROOM_SIZE_CMD_LINE                     /* Philips/Nokia: Default room sizes support */

// object-editing feature porting
#define TMP_FIX_SPLIT_REND                              // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions)
+67 −0
Original line number Diff line number Diff line
@@ -1665,16 +1665,83 @@ ivas_error ivas_init_decoder_fx(
        }
    }

#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    /*--------------------------------------------------------------------------*
      * Allocate and initialize HRTF Statistics handle, get default reverb values
      *--------------------------------------------------------------------------*/
#else
    /*--------------------------------------------------------------------*
     * Allocate and initialize HRTF Statistics handle
     *--------------------------------------------------------------------*/
#endif

    IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    {
        /* Init HRTF statistics */
        IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) )
        {
            return error;
        }

        #ifdef FIX_1318_ROOM_SIZE_CMD_LINE
        /* Get default reverb values based on format, if custom values were not given */
        IF( EQ_16(st_ivas->hDecoderConfig->Opt_RendConfigCustom, 0) )
        {
            IVAS_DefaultReverbSize defaultReverbSize;
            SWITCH( st_ivas->hDecoderConfig->Opt_RoomSize )
            {
                case IVAS_ROOM_SIZE_AUTO:
                    SWITCH( st_ivas->ivas_format )
                    {
                        case ISM_FORMAT:
                            defaultReverbSize = DEFAULT_REVERB_LARGE;
                            move32();
                            BREAK;
                        case SBA_FORMAT:
                            defaultReverbSize = DEFAULT_REVERB_SMALL;
                            move32();
                            BREAK;
                        case MASA_FORMAT:
                            defaultReverbSize = DEFAULT_REVERB_SMALL;
                            move32();
                            BREAK;
                        case MC_FORMAT:
                            defaultReverbSize = DEFAULT_REVERB_MEDIUM;
                            move32();
                            BREAK;
                        case MASA_ISM_FORMAT:
                            defaultReverbSize = DEFAULT_REVERB_MEDIUM;
                            move32();
                            BREAK;
                        case SBA_ISM_FORMAT:
                            defaultReverbSize = DEFAULT_REVERB_MEDIUM;
                            move32();
                            BREAK;
                        default:
                            defaultReverbSize = DEFAULT_REVERB_LARGE;
                            move32();
                    }
                    BREAK;
                case IVAS_ROOM_SIZE_SMALL:
                    defaultReverbSize = DEFAULT_REVERB_SMALL;
                    move32();
                    BREAK;
                case IVAS_ROOM_SIZE_MEDIUM:
                    defaultReverbSize = DEFAULT_REVERB_MEDIUM;
                    move32();
                    BREAK;
                case IVAS_ROOM_SIZE_LARGE:
                default:
                    defaultReverbSize = DEFAULT_REVERB_LARGE;
                    move32();
                    BREAK;
            }
            if ( NE_32( error = ivas_render_config_change_defaults( st_ivas->hRenderConfig, defaultReverbSize ), IVAS_ERR_OK ) )
            {
                return error;
            }
        }
#endif
    }

    /*-----------------------------------------------------------------*
Loading