Commit be22dbc0 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Merge branch 'add-ivas-rtpdump-support' into 'add-ivas-rtpdump-support-apply-acoustic-env'

parents de277821 f80356f4
Loading
Loading
Loading
Loading
Loading
+107 −0
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ typedef struct
#ifdef FIX_1419_MONO_STEREO_UMX
    bool evsMode;
#endif
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    IVAS_ROOM_SIZE_T roomSize;
#endif

} DecArguments;

@@ -438,9 +441,15 @@ int main(
    arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM;
#endif

#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_fx, 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;
@@ -982,6 +991,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
     *-----------------------------------------------------------------*/
@@ -1488,6 +1501,45 @@ static bool parseCmdlIVAS_dec(
            i++;
        }
#endif
#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
@@ -1719,6 +1771,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" );
@@ -3908,6 +3964,57 @@ static void do_object_editing_fx(
#endif
                    }
                }
#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA
                /* object direction editing only for diegetic objects */
                if ( readInfo->obj_yaw_edited[obj_idx] )
                {
                    if ( readInfo->obj_yaw_relative[obj_idx] )
                    {
                        /* yaw: apply relative edit + wrap */
                        editableParameters->ism_metadata[obj_idx].yaw_fx = ( ( editableParameters->ism_metadata[obj_idx].yaw_fx + (Word32) ( readInfo->obj_yaw[obj_idx] * 4194304 ) + 2264924160 ) % 1509949440 ) - 754974720; /* Q22 */
                    }
                    else
                    {
                        editableParameters->ism_metadata[obj_idx].yaw_fx = (Word32) ( readInfo->obj_yaw[obj_idx] * 4194304 ); /* Q22 */
                    }
                }
                if ( readInfo->obj_pitch_edited[obj_idx] )
                {
                    if ( readInfo->obj_pitch_relative[obj_idx] )
                    {
                        /* pitch: apply relative edit + saturation */
                        editableParameters->ism_metadata[obj_idx].pitch_fx = L_max( L_min( editableParameters->ism_metadata[obj_idx].pitch_fx + (Word32) ( readInfo->obj_pitch[obj_idx] * 4194304 ), 377487360 ), -377487360 ); /* Q22 */
                    }
                    else
                    {
                        editableParameters->ism_metadata[obj_idx].pitch_fx = (Word32) ( readInfo->obj_pitch[obj_idx] * 4194304 ); /* Q22 */
                    }
                }
                /* radius editing only for diegetic objects */
                if ( readInfo->obj_radius_edited[obj_idx] )
                {
                    if ( readInfo->obj_radius_relative[obj_idx] )
                    {
/* radius: apply relative edit + saturation */
#define SQ 9

#define SHIFT_DUE_TO_SQxSQ ( SQ - ( SQ + SQ + 1 - 16 ) ) /*  ^shift by 6  == mult by 2^6 = 64.0 */

                        Word32 L_tmp1 = L_mult( editableParameters->ism_metadata[obj_idx].radius_fx, (Word16) ( readInfo->obj_radius[obj_idx] * ( 1L << ( SQ ) ) ) ); /*SQ*SQ*/
                        Word32 L_tmp2 = L_shl_sat( L_tmp1, SHIFT_DUE_TO_SQxSQ );                                                                                      /*shift back to Q(9+16)*/
                        Word16 temp_radius = round_fx( L_tmp2 );                                                                                                      /* Q25 -> Q9 */
                        temp_radius = s_max( s_min( temp_radius, OBJ_EDIT_RADIUS_MAX_FX ), 0 );

                        /*  L_tmp2  is in S31Q25  stored in a signed Word32
                            temp_radius is in  S15Q9    stored in a signed Word16
                           */
                    }
                    else
                    {
                        editableParameters->ism_metadata[obj_idx].radius_fx = (Word16) ( readInfo->obj_radius[obj_idx] * 512 ); /* Q9 */
                    }
                }
#endif
            }

            /* gain editing for all objects */
+76 −0
Original line number Diff line number Diff line
@@ -200,6 +200,9 @@ typedef struct
    IVAS_RENDER_FRAMESIZE render_framesize;
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    AcousticEnvironmentSequence aeSequence;
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    IVAS_ROOM_SIZE_T reverbRoomSize;
#endif
} CmdlnArgs;

typedef enum
@@ -230,7 +233,12 @@ typedef enum
    CmdLnOptionId_framing,
    CmdLnOptionId_syncMdDelay,
    CmdLnOptionId_directivityPatternId,
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    CmdLnOptionId_acousticEnvironmentId,
    CmdLnOptionId_roomSize,
#else
    CmdLnOptionId_acousticEnvironmentId
#endif
} CmdLnOptionId;

static const CmdLnParser_Option cliOptions[] = {
@@ -400,6 +408,14 @@ static const CmdLnParser_Option cliOptions[] = {
        .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.",
#endif
    },
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    {
        .id = CmdLnOptionId_roomSize,
        .match = "room_size",
        .matchShort = "rsz",
        .description = "Selects default reverb based on a room size (S - small | M - medium | L - large)",
    }
#endif
};


@@ -1252,6 +1268,19 @@ int main(
        goto cleanup;
    }

#ifdef FIX_1318_ROOM_SIZE_CMD_LINE

    /* Set reverb room size if specified */
    if ( args.reverbRoomSize != IVAS_ROOM_SIZE_AUTO )
    {
        if ( ( IVAS_REND_SetReverbRoomSize( hIvasRend, args.reverbRoomSize ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError setting reverb room size\n" );
            goto cleanup;
        }
    }
#endif

    /* Set up output custom layout configuration */
    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM )
    {
@@ -2760,6 +2789,39 @@ static bool parseAcousticEnvironmentIds(

    return true;
}
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE


static bool parseReverbRoomSize(
    char *value,
    IVAS_ROOM_SIZE_T *reverbRoomSize )
{
    if ( strlen( value ) != 1 )
    {
        fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", value );
        return false;
    }

    to_upper( value );
    switch ( value[0] )
    {
        case 'S':
            *reverbRoomSize = IVAS_ROOM_SIZE_SMALL;
            break;
        case 'M':
            *reverbRoomSize = IVAS_ROOM_SIZE_MEDIUM;
            break;
        case 'L':
            *reverbRoomSize = IVAS_ROOM_SIZE_LARGE;
            break;
        default:
            fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", value );
            return false;
    }

    return true;
}
#endif


static bool checkRequiredArgs(
@@ -2881,6 +2943,10 @@ static CmdlnArgs defaultArgs(
    args.aeSequence.pValidity = NULL;
    args.aeSequence.selected = 0;
    args.aeSequence.frameCounter = 0;
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE

    args.reverbRoomSize = IVAS_ROOM_SIZE_AUTO;
#endif

    return args;
}
@@ -3062,6 +3128,16 @@ static void parseOption(
            /* Metadata Delay to sync with audio delay in ms */
            args->syncMdDelay = (int16_t) strtol( optionValues[0], NULL, 10 );
            break;
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
        case CmdLnOptionId_roomSize:
            assert( numOptionValues == 1 );
            if ( !parseReverbRoomSize( optionValues[0], &args->reverbRoomSize ) )
            {
                fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", optionValues[0] );
                exit( -1 );
            }
            break;
#endif
        default:
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
            break;
+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;

+16 −0
Original line number Diff line number Diff line
@@ -1661,7 +1661,13 @@ 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
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
#define IVAS_DEFAULT_AEID                       ( 65535 )
#endif
@@ -1669,6 +1675,16 @@ typedef enum
#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_UNSET = -1,
    DEFAULT_REVERB_SMALL,
    DEFAULT_REVERB_MEDIUM,
    DEFAULT_REVERB_LARGE
} IVAS_DefaultReverbSize;
#endif


/*----------------------------------------------------------------------------------*
 * FB mixer constants
+5 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@
#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 FIX_1437_LC3PLUS_EXTREND_HIRES                  /* FhG: fix external renderer split bitstream header writing causing a crash for LC3plus High-res mode */
#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/FhG: 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)
@@ -157,12 +158,16 @@
#define FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES        /* Nokia: Issue 2140, fixes three different sanitizer issues persisting in object editing code. */
#define NONBE_FIX_1172_OBJ_EDIT_JBM                     /* VA: issue 1172: fix OMASA object editing in JBM */
#define FIX_2193_ISM_GAINS_WITH_OE                      /* FhG: fix issue 2193: use edited angles in ISM gain calculation */
#define FIX_2192_OBJ_EDITING_EXT_METADATA               /* Eri: Add support for extended metadata in object editing */

// RTPDUMP porting
#define RTP_S4_251135_CR26253_0016_REV1                /* RTP Pack/Unpack API corresponding to CR 26253 */
#define IVAS_RTPDUMP                                   /* RTPDUMP writing and reading for IVAS payloads */
#define FIXED_RTP_SEQUENCE_NUM                         /* Remove random sequence number initialization */
#define IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT              /* RTPDUMP acoustic environment */
#define ISM_PI_DATA                                    /* Add reading and packing/unpacking of ISM PI data */
#define REVERSE_ISM_PI_DATA                            /* Add reading and packing/unpacking of reverse ISM PI data */
#define PI_LATENCY                                     /* Support for PI latency */

/* #################### End BASOP porting switches ############################ */

Loading