Commit 3fa634af authored by bayers's avatar bayers
Browse files

Merge remote-tracking branch 'remotes/origin/main' into...

Merge remote-tracking branch 'remotes/origin/main' into 551-orientation-tracking-first-frame-has-always-head_orient_trk_none-as-type
parents 8419b0ed f80e08d7
Loading
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -121,6 +121,11 @@ stages:
  - git pull
  - cd -

.enable-split-rendering: &enable-split-rendering
# automatically enable #define SPLIT_REND_WITH_HEAD_ROT in options.h, handling both /**/-comment and //-comment
  - sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*SPLIT_REND_WITH_HEAD_ROT\)[[:space:]]*\*\//\1/g" ./lib_com/options.h
  - sed -i.bak -e "s/\/\/[[:space:]]*\(#define[[:space:]]*SPLIT_REND_WITH_HEAD_ROT\)/\1/g"        ./lib_com/options.h

# ---------------------------------------------------------------
# Job templates
# ---------------------------------------------------------------
@@ -309,6 +314,7 @@ build-codec-windows-msbuild:
  script:
    - *print-common-info-windows
    - $winoutdata = $null
    - py .\scripts\strip_split_rendering.py
    - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug | tee -variable winoutdata
    - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8
    - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'") | Invoke-Expression
@@ -569,7 +575,8 @@ split-rendering-smoke-test:
  needs: ["build-codec-linux-make"]
  stage: test
  script:
    - make -j
    - *enable-split-rendering
    - make -j INCLUDE_SPLIT=1
    - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/split_rendering/test_split_rendering.py
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results"
@@ -609,15 +616,18 @@ split-rendering-pytest-on-merge-request:
    - git checkout $target_commit

    # build reference binaries
    - make -j
    - *enable-split-rendering
    - make -j INCLUDE_SPLIT=1
    - mv IVAS_cod IVAS_cod_ref
    - mv IVAS_dec IVAS_dec_ref
    - mv IVAS_rend IVAS_rend_ref

    # back to source branch
    - git restore lib_com/options.h # Revert changes back before checking out another branch to avoid conflicts
    - git checkout $source_branch_commit_sha
    - make clean
    - make -j
    - *enable-split-rendering
    - make -j INCLUDE_SPLIT=1

    # run test
    - exit_code=0
+64 −21
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@
#        # or build on command line, e.g.:
#        cmake --build . --config Debug
#        cmake --build . --config Release

#
# INCLUDE_SPLIT is not set by default. If split rendering is used, then add -D INCLUDE_SPLIT=1 to the build command

cmake_minimum_required(VERSION 3.1)

@@ -130,7 +131,10 @@ add_library(lib_com ${libComSrcs} ${libComHeaders})
if(UNIX)
  target_link_libraries(lib_com PRIVATE m)
endif()
target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug lc3plus)
target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug)
if(INCLUDE_SPLIT)
  target_include_directories(lib_com PRIVATE lc3plus)
endif()

file(GLOB libDebugSrcs "lib_debug/*.c")
file(GLOB libDebugHeaders "lib_debug/*.h")
@@ -142,8 +146,12 @@ file(GLOB libEncSrcs "lib_enc/*.c")
file(GLOB libEncHeaders "lib_enc/*.h")
add_library(lib_enc ${libEncSrcs} ${libEncHeaders})
target_link_libraries(lib_enc lib_com lib_debug)
target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend lc3plus)
target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend)
if(INCLUDE_SPLIT)
  target_include_directories(lib_enc PRIVATE lc3plus)
endif()

if(INCLUDE_SPLIT)
  file(GLOB libLC3plusSrcs "lc3plus/*.c")
  file(GLOB libLC3plusHeaders "lc3plus/*.h")
  add_library(lc3plus ${libLC3plusSrcs} ${libLC3plusHeaders})
@@ -152,13 +160,38 @@ target_link_libraries(lc3plus lib_com) # For including options.h, which is neede
  if(WMOPS)
    target_link_libraries(lc3plus lib_debug)
  endif()
endif()

if(INCLUDE_SPLIT)
  file(GLOB libCldfbTransCodecSrcs "lib_rend/ivas_cldfb_trans_codec/*.c")
  file(GLOB libCldfbTransCodecHeaders "lib_rend/ivas_cldfb_trans_codec/*.h")
endif()
file(GLOB libRendSrcs "lib_rend/*.c")
file(GLOB libRendHeaders "lib_rend/*.h")
if(NOT INCLUDE_SPLIT)
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*lc3plus.*\.c$")
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_cldfb_codec.*\.c$")
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*splitRend.*\.c$")
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_CQMF.*\.c$")
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_Pred.*\.c$")
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_RMSEnv.*\.c$")
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_PerceptualModel.*\.c$")
  list(FILTER libRendSrcs EXCLUDE REGEX ".*lib_rend\/.*ivas_lcld_tables.*\.c$")
  list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*lc3plus.*\.h$")
  list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*splitRend.*\.h$")
  list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*ivas_cldfb_codec.*\.h$")
  list(FILTER libRendHeaders EXCLUDE REGEX ".*lib_rend\/.*ivas_lcld_tables.*\.h$")
endif()

if(INCLUDE_SPLIT)
  add_library(lib_rend ${libRendSrcs} ${libCldfbTransCodecSrcs} ${libRendHeaders}  ${libCldfbTransCodecHeaders})
target_link_libraries(lib_rend lib_dec lib_com lib_debug lc3plus) # Todo refactor: This dependency on lib_dec should be removed.
else()
  add_library(lib_rend ${libRendSrcs} ${libRendHeaders})
endif()
target_link_libraries(lib_rend lib_dec lib_com lib_debug) # Todo refactor: This dependency on lib_dec should be removed.
if(INCLUDE_SPLIT)
  target_link_libraries(lib_rend lc3plus)
endif()
target_include_directories(lib_rend PUBLIC lib_rend PRIVATE lib_enc)


@@ -170,14 +203,22 @@ target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc)

file(GLOB libUtilSrcs "lib_util/*.c")
file(GLOB libUtilHeaders "lib_util/*.h")
if(NOT INCLUDE_SPLIT)
  list(FILTER libUtilSrcs EXCLUDE REGEX ".*lib_util\/.*split_rend.*\.c$")
endif()
add_library(lib_util ${libUtilSrcs} ${libUtilHeaders})
target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug lc3plus)
target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug)
if(INCLUDE_SPLIT)
  target_include_directories(lib_util PRIVATE lc3plus)
endif()

if(INCLUDE_SPLIT)
  if(NOT WMOPS)
    file(GLOB unitTestIvasLc3plusSrcs "scripts/split_rendering/lc3plus/*.c")
    add_executable(ivas_lc3plus_unit_test ${unitTestIvasLc3plusSrcs})
    target_link_libraries(ivas_lc3plus_unit_test lib_rend lib_dec lib_util lib_com lib_debug)
  endif()
endif()

add_executable(IVAS_cod apps/encoder.c)
target_link_libraries(IVAS_cod lib_enc lib_util)
@@ -200,10 +241,12 @@ if(COPY_EXECUTABLES_FROM_BUILD_DIR)
  add_custom_command(TARGET IVAS_cod POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_cod>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET IVAS_dec POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_dec>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET IVAS_rend POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_rend>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  if(INCLUDE_SPLIT)
    if (NOT WMOPS)
      add_custom_command(TARGET ivas_lc3plus_unit_test POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:ivas_lc3plus_unit_test>" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/split_rendering/lc3plus")
    endif()
  endif()
endif()

# Allow creating packages for CMake install
install(TARGETS lib_enc lib_dec lib_rend lib_com lib_util ARCHIVE DESTINATION lib)
+15 −1
Original line number Diff line number Diff line
@@ -117,6 +117,15 @@ CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR))
# Source file search paths
VPATH     = $(SRC_DIRS)

# Split rendering files
SRCS_SPLIT_REND = ivas_CQMFDecoder.c ivas_CQMFEncoder.c ivas_PerceptualModel.c ivas_PredDecoder.c \
                  ivas_PredEncoder.c ivas_RMSEnvGrouping.c ivas_MSPred.c ivas_NoiseGen.c \
                  ivas_cldfb_codec_bitstream.c ivas_splitRend_lcld_dec.c ivas_splitRend_lcld_enc.c \
                  ivas_splitRendererPLC.c ivas_splitRendererPost.c ivas_splitRendererPre.c \
                  ivas_splitRenderer_utils.c split_rend_bfi_file_reader.c split_render_file_read_write.c \
                  ivas_lcld_tables.c

     
###############################################################################

SRCS_LIBCOM   = $(foreach DIR,$(SRC_LIBCOM),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
@@ -124,8 +133,13 @@ SRCS_LIBDEBUG = $(foreach DIR,$(SRC_LIBDEBUG),$(patsubst $(DIR)/%,%,$(wildcard $
SRCS_LIBDEC   = $(foreach DIR,$(SRC_LIBDEC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBENC   = $(foreach DIR,$(SRC_LIBENC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBREND  = $(foreach DIR,$(SRC_LIBREND),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LC3PLUS  = $(foreach DIR,$(SRC_LC3PLUS),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBUTIL  = $(foreach DIR,$(SRC_LIBUTIL),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
ifeq "$(INCLUDE_SPLIT)" "1"
SRCS_LC3PLUS  = $(foreach DIR,$(SRC_LC3PLUS),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
else
SRCS_LIBREND := $(filter-out $(SRCS_SPLIT_REND),$(SRCS_LIBREND))
SRCS_LIBUTIL := $(filter-out $(SRCS_SPLIT_REND),$(SRCS_LIBUTIL))
endif

OBJS_LIBCOM      = $(addprefix $(OBJDIR)/,$(SRCS_LIBCOM:.c=.o))
OBJS_LIBDEBUG    = $(addprefix $(OBJDIR)/,$(SRCS_LIBDEBUG:.c=.o))
+35 −4
Original line number Diff line number Diff line
@@ -747,6 +747,9 @@ int main(
    int16_t delayNumSamples = -1;
    int16_t delayNumSamples_orig = 0;
    int16_t zeroPad = 0;
#ifdef FIX_LARGE_RENDERER_DELAY_COMP
    int16_t zeroPadToWrite = 0;
#endif
    int32_t delayTimeScale = 0;
    int16_t i, numChannels;
    ivas_error error = IVAS_ERR_OK;
@@ -1764,7 +1767,11 @@ int main(
        if ( audioWriter != NULL )
        {
#endif
#ifdef FIX_LARGE_RENDERER_DELAY_COMP
            if ( delayNumSamples * num_out_channels < outBufferSize )
#else
        if ( delayNumSamples < outBufferSize )
#endif
            {
                if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK )
                {
@@ -1775,7 +1782,11 @@ int main(
            }
            else
            {
#ifdef FIX_LARGE_RENDERER_DELAY_COMP
                delayNumSamples -= (int16_t) ( outBufferSize / num_out_channels );
#else
            delayNumSamples -= (int16_t) outBufferSize;
#endif
            }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        }
@@ -1875,12 +1886,32 @@ int main(
    if ( audioWriter != NULL )
    {
#endif
#ifdef FIX_LARGE_RENDERER_DELAY_COMP
        for ( zeroPadToWrite = zeroPad; zeroPadToWrite > frameSize_smpls; zeroPadToWrite -= frameSize_smpls )
        {
            memset( outInt16Buffer, 0, outBufferSize * sizeof( int16_t ) );
            if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nOutput audio file writer error\n" );
                exit( -1 );
            }
        }

        memset( outInt16Buffer, 0, zeroPadToWrite * outBuffer.config.numChannels * sizeof( int16_t ) );
        if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nOutput audio file writer error\n" );
            exit( -1 );
        }
        zeroPadToWrite = 0;
#else
    memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nOutput audio file writer error\n" );
        exit( -1 );
    }
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    }
#endif
+0 −176
Original line number Diff line number Diff line
@@ -576,182 +576,6 @@ int16_t get_ivas_max_num_indices(
    return 2450;
}

/*-----------------------------------------------------------------------*
 * get_core_max_num_indices()
 *
 * Get the maximum allowed number of indices in the core coder
 *-----------------------------------------------------------------------*/

/*! r: maximum number of indices */
int16_t get_core_max_num_indices(
    const int16_t core,       /* i  : core                      */
    const int32_t total_brate /* i  : total bitrate             */
)
{

    /* set the maximum number of indices in the core coder */
    if ( core == ACELP_CORE || core == AMR_WB_CORE )
    {
        if ( total_brate <= 9600 )
        {
            return 60;
        }
        else if ( total_brate <= IVAS_13k2 )
        {
            return 70;
        }
        else if ( total_brate <= IVAS_16k4 )
        {
            return 80;
        }
        else if ( total_brate <= IVAS_24k4 )
        {
            return 100;
        }
        else if ( total_brate <= IVAS_32k )
        {
            return 180;
        }
        else if ( total_brate <= IVAS_48k )
        {
            return 340;
        }
        else if ( total_brate <= IVAS_80k )
        {
            return 450;
        }
        else if ( total_brate <= IVAS_96k )
        {
            return 500;
        }
        else if ( total_brate <= IVAS_128k )
        {
            return 550;
        }
        else if ( total_brate <= IVAS_160k )
        {
            return 600;
        }
        else if ( total_brate <= IVAS_192k )
        {
            return 650;
        }
        else if ( total_brate <= IVAS_256k )
        {
            return 700;
        }
        else
        {
            return 800;
        }
    }
    else if ( core == TCX_20_CORE || core == TCX_10_CORE )
    {
        if ( total_brate <= 9600 )
        {
            return 100;
        }
        else if ( total_brate <= IVAS_13k2 )
        {
            return 150;
        }
        else if ( total_brate <= IVAS_16k4 )
        {
            return 200;
        }
        else if ( total_brate <= IVAS_24k4 )
        {
            return 310;
        }
        else if ( total_brate <= IVAS_32k )
        {
            return 330;
        }
        else if ( total_brate <= IVAS_48k )
        {
            return 340;
        }
        else if ( total_brate <= IVAS_80k )
        {
            return 380;
        }
        else if ( total_brate <= IVAS_96k )
        {
            return 400;
        }
        else if ( total_brate <= IVAS_128k )
        {
            return 460;
        }
        else if ( total_brate <= IVAS_160k )
        {
            return 470;
        }
        else if ( total_brate <= IVAS_192k )
        {
            return 570;
        }
        else if ( total_brate <= IVAS_256k )
        {
            return 680;
        }
        else
        {
            return 800;
        }
    }
    else if ( core == HQ_CORE )
    {
        if ( total_brate <= 9600 )
        {
            return 100;
        }
        else if ( total_brate <= IVAS_16k4 )
        {
            return 200;
        }
        else if ( total_brate <= IVAS_24k4 )
        {
            return 240;
        }
        else if ( total_brate <= IVAS_32k )
        {
            return 300;
        }
        else if ( total_brate <= IVAS_48k )
        {
            return 380;
        }
        else if ( total_brate <= IVAS_96k )
        {
            return 400;
        }
        else if ( total_brate <= IVAS_128k )
        {
            return 450;
        }
        else if ( total_brate <= IVAS_160k )
        {
            return 550;
        }
        else if ( total_brate <= IVAS_192k )
        {
            return 600;
        }
        else if ( total_brate <= IVAS_256k )
        {
            return 700;
        }
        else
        {
            return 800;
        }
    }
    else
    {
        return 50;
    }
}

/*-----------------------------------------------------------------------*
 * get_BWE_max_num_indices()
Loading