Commit 53f39000 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

Merge branch 'float-pc' into 1330_ref_split_rendering_porting

parents d2c1d749 6b6af96e
Loading
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+1 −0
Original line number Diff line number Diff line

 No newline at end of file
+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+118 −2
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -43,6 +43,19 @@
#endif
#include "wmc_auto.h"

#ifdef DEBUG_FORCE_DIR
/* Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do.
   We have to define _CRT_INTERNAL_NONSTDC_NAMES 1 before #including sys/stat.h
   in order for Microsoft's stat.h to define names like S_IFMT, S_IFREG, and S_IFDIR,
   rather than just defining  _S_IFMT, _S_IFREG, and _S_IFDIR as it normally does. */
#include <sys/stat.h>
#if !defined( S_ISREG ) && defined( S_IFMT ) && defined( S_IFREG )
#define S_ISREG( m ) ( ( (m) &S_IFMT ) == S_IFREG )
#endif
#if !defined( S_ISDIR ) && defined( S_IFMT ) && defined( S_IFDIR )
#define S_ISDIR( m ) ( ( (m) &S_IFMT ) == S_IFDIR )
#endif
#endif

#define WMC_TOOL_SKIP

@@ -134,6 +147,9 @@ typedef struct
#ifdef DEBUGGING
    IVAS_ENC_FORCED_MODE forcedMode;
    const char *forcedModeFile;
#ifdef DEBUG_FORCE_DIR
    const char *forcedModeDir;
#endif
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    IVAS_ENC_AGC agc;
#endif
@@ -719,7 +735,12 @@ int main(
        /* Force mode not set when configuring, set in first frame even if not reading from file */
        if ( f_forcedModeProfile || frame == 0 )
        {
            if ( ( error = IVAS_ENC_SetForcedMode( hIvasEnc, forcedMode ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_ENC_SetForcedMode( hIvasEnc, forcedMode
#ifdef DEBUG_FORCE_DIR
                                                   ,
                                                   arg.forcedModeDir
#endif
                                                   ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_ENC_SetForcedMode failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
@@ -908,6 +929,9 @@ static void initArgStruct( EncArguments *arg )
#ifdef DEBUGGING
    arg->forcedMode = IVAS_ENC_FORCE_UNFORCED;
    arg->forcedModeFile = NULL;
#ifdef DEBUG_FORCE_DIR
    arg->forcedModeDir = NULL;
#endif
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION
    arg->agc = IVAS_ENC_AGC_UNDEFINED;
#endif
@@ -1058,6 +1082,28 @@ static bool parseCmdlIVAS_enc(

            arg->forcedMode = parseForcedMode( stmp );

#ifdef DEBUG_FORCE_DIR
            if ( arg->forcedMode < IVAS_ENC_FORCE_FILE )
            {
                fprintf( stdout, "Forcing codec to:       %s\n", argv[i + 1] );
            }
            else if ( arg->forcedMode == IVAS_ENC_FORCE_FILE )
            {
                arg->forcedModeFile = argv[i + 1];
                fprintf( stdout, "Force switching file:   %s\n", argv[i + 1] );
            }
            else if ( arg->forcedMode == IVAS_ENC_FORCE_DIR )
            {
                arg->forcedModeDir = argv[i + 1];
                fprintf( stdout, "Forcing switching directory:       %s\n", argv[i + 1] );
            }
            else
            {
                fprintf( stderr, "\nError: The force switching profile file/dir %s does not exist or could not be opened!\n\n", argv[i + 1] );
                usage_enc();
                return false;
            }
#else
            if ( arg->forcedMode == IVAS_ENC_FORCE_UNDEFINED )
            {
                arg->forcedModeFile = argv[i + 1];
@@ -1084,6 +1130,7 @@ static bool parseCmdlIVAS_enc(
                fprintf( stdout, "Forcing codec to:       %s\n", argv[i + 1] );
#endif
            }
#endif

            i += 2;
        }
@@ -1923,6 +1970,9 @@ static void usage_enc( void )
#ifdef DEBUGGING
    fprintf( stdout, "-force T            : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" );
    fprintf( stdout, "                      alternatively, T can be a text file where each line contains \"nb_frames T\"\n" );
#ifdef DEBUG_FORCE_DIR
    fprintf( stdout, "                      or T can be a directory containing external binary files for modes/parameters enforcement\n" );
#endif
#ifdef DEBUG_SBA
    fprintf( stdout, "-tag                : Tag name for intermediate debug files\n" );
#endif
@@ -2040,8 +2090,73 @@ static bool readBitrate(
static IVAS_ENC_FORCED_MODE parseForcedMode(
    char *forcedModeChar )
{
#ifdef DEBUG_FORCE_DIR
    struct stat path_stat;
#endif

    to_upper( forcedModeChar );

#ifdef DEBUG_FORCE_DIR
    if ( ( strcmp( forcedModeChar, "SPEECH" ) == 0 ) || ( strcmp( forcedModeChar, "'SPEECH'" ) == 0 ) ||
         ( strcmp( forcedModeChar, "0" ) == 0 ) )
    {
        return IVAS_ENC_FORCE_SPEECH;
    }
    else if ( ( strcmp( forcedModeChar, "MUSIC" ) == 0 ) || ( strcmp( forcedModeChar, "'MUSIC'" ) == 0 ) || ( strcmp( forcedModeChar, "AUDIO" ) == 0 ) || ( strcmp( forcedModeChar, "'AUDIO'" ) == 0 ) || ( strcmp( forcedModeChar, "1" ) == 0 ) )
    {
        return IVAS_ENC_FORCE_MUSIC;
    }
    else if ( ( strcmp( forcedModeChar, "ACELP" ) == 0 ) || ( strcmp( forcedModeChar, "'ACELP'" ) == 0 ) )
    {
        return IVAS_ENC_FORCE_ACELP;
    }
    else if ( ( strcmp( forcedModeChar, "GSC" ) == 0 ) || ( strcmp( forcedModeChar, "'GSC'" ) == 0 ) )
    {
        return IVAS_ENC_FORCE_GSC;
    }
    if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 )
#ifdef SUPPORT_FORCE_TCX10_TCX20
         || ( strcmp( forcedModeChar, "TCX20" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX20'" ) == 0 )
#endif
    )
    {
#ifdef SUPPORT_FORCE_TCX10_TCX20
        return IVAS_ENC_FORCE_TCX20;
#else
        return IVAS_ENC_FORCE_TCX;
#endif
    }
#ifdef SUPPORT_FORCE_TCX10_TCX20
    if ( ( strcmp( forcedModeChar, "TCX10" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX10'" ) == 0 ) )
    {
        return IVAS_ENC_FORCE_TCX10;
    }
#endif
    else if ( ( strcmp( forcedModeChar, "HQ" ) == 0 ) || ( strcmp( forcedModeChar, "'HQ'" ) == 0 ) )
    {
        return IVAS_ENC_FORCE_HQ;
    }
    else
    {
        if ( stat( forcedModeChar, &path_stat ) != 0 )
        {
            return IVAS_ENC_FORCE_UNDEFINED;
        }

        /* check if the argument represents an existing file or directory */
        if ( S_ISDIR( path_stat.st_mode ) )
        {
            /* it's a directory */
            return IVAS_ENC_FORCE_DIR;
        }
        else
        {
            /* it's a file */
            return IVAS_ENC_FORCE_FILE;
        }
    }

#else
    if ( ( strcmp( forcedModeChar, "SPEECH" ) == 0 ) || ( strcmp( forcedModeChar, "'SPEECH'" ) == 0 ) ||
         ( strcmp( forcedModeChar, "0" ) == 0 ) )
    {
@@ -2083,6 +2198,7 @@ static IVAS_ENC_FORCED_MODE parseForcedMode(
    }

    return IVAS_ENC_FORCE_UNDEFINED;
#endif
}


+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
Loading