From 7e9941941c0dc3921ae76759b21a0a9120842af1 Mon Sep 17 00:00:00 2001 From: Jani Lainema <jani.lainema@nokia.com> Date: Mon, 24 Jan 2022 17:17:21 +0000 Subject: [PATCH] Enable compilation in ARM environment --- CMakeLists.txt | 3 ++- .../BitstreamExtractorApp/bitstreamextractormain.cpp | 2 +- source/App/DecoderApp/DecAppCfg.cpp | 4 ++-- source/App/DecoderApp/decmain.cpp | 2 +- source/App/EncoderApp/EncAppCfg.cpp | 4 ++-- source/App/EncoderApp/encmain.cpp | 2 +- source/App/SEIRemovalApp/seiremovalmain.cpp | 2 +- source/Lib/CommonLib/BilateralFilter.cpp | 2 ++ source/Lib/CommonLib/BilateralFilter.h | 7 +++++++ source/Lib/CommonLib/Buffer.cpp | 4 ++-- source/Lib/CommonLib/Buffer.h | 10 +++++----- source/Lib/CommonLib/InterPrediction.cpp | 8 ++++---- source/Lib/CommonLib/InterpolationFilter.cpp | 2 +- source/Lib/CommonLib/InterpolationFilter.h | 2 +- source/Lib/CommonLib/x86/CommonDefX86.h | 4 ++++ source/Lib/DecoderLib/DecLib.cpp | 2 +- source/Lib/EncoderLib/EncLib.cpp | 2 +- 17 files changed, 38 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 587322d56..5e806bc77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,8 @@ if( XCODE ) -Wno-deprecated-register -Wno-pessimizing-move -Wno-absolute-value - -Wno-unused-const-variable ) + -Wno-unused-const-variable + -Wno-unused-command-line-argument ) else() bb_enable_warnings( clang warnings-as-errors -Wno-unknown-attributes diff --git a/source/App/BitstreamExtractorApp/bitstreamextractormain.cpp b/source/App/BitstreamExtractorApp/bitstreamextractormain.cpp index 3e7b381a6..2650a9c38 100644 --- a/source/App/BitstreamExtractorApp/bitstreamextractormain.cpp +++ b/source/App/BitstreamExtractorApp/bitstreamextractormain.cpp @@ -52,7 +52,7 @@ int main(int argc, char* argv[]) fprintf( stdout, NVM_ONOS ); fprintf( stdout, NVM_COMPILEDBY ); fprintf( stdout, NVM_BITS ); -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) std::string SIMD; df::program_options_lite::Options optsSimd; optsSimd.addOptions()( "SIMD", SIMD, std::string( "" ), "" ); diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index 45ac8301a..2217703ad 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -67,7 +67,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) string sTracingFile; bool bTracingChannelsList = false; #endif -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) std::string ignore; #endif po::Options opts; @@ -79,7 +79,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) ("OplFile,-opl", m_oplFilename , string(""), "opl-file name without extension for conformance testing\n") -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) ("SIMD", ignore, string(""), "SIMD extension to use (SCALAR, SSE41, SSE42, AVX, AVX2, AVX512), default: the highest supported extension\n") #endif diff --git a/source/App/DecoderApp/decmain.cpp b/source/App/DecoderApp/decmain.cpp index 072686c25..b01f9e3ae 100644 --- a/source/App/DecoderApp/decmain.cpp +++ b/source/App/DecoderApp/decmain.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) fprintf( stdout, NVM_ONOS ); fprintf( stdout, NVM_COMPILEDBY ); fprintf( stdout, NVM_BITS ); -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) std::string SIMD; df::program_options_lite::Options optsSimd; optsSimd.addOptions()( "SIMD", SIMD, string( "" ), "" ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index b0e1889da..890bad6f8 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -715,7 +715,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) string sTracingFile; bool bTracingChannelsList = false; #endif -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) std::string ignore; #endif @@ -728,7 +728,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("c", po::parseConfigFile, "configuration file name") ("WarnUnknowParameter,w", warnUnknowParameter, 0, "warn for unknown configuration parameters instead of failing") ("isSDR", sdr, false, "compatibility") -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) ("SIMD", ignore, string(""), "SIMD extension to use (SCALAR, SSE41, SSE42, AVX, AVX2, AVX512), default: the highest supported extension\n") #endif // File, I/O and source parameters diff --git a/source/App/EncoderApp/encmain.cpp b/source/App/EncoderApp/encmain.cpp index fffaeb3f2..38afca522 100644 --- a/source/App/EncoderApp/encmain.cpp +++ b/source/App/EncoderApp/encmain.cpp @@ -89,7 +89,7 @@ int main(int argc, char* argv[]) fprintf( stdout, NVM_ONOS ); fprintf( stdout, NVM_COMPILEDBY ); fprintf( stdout, NVM_BITS ); -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) std::string SIMD; df::program_options_lite::Options opts; opts.addOptions() diff --git a/source/App/SEIRemovalApp/seiremovalmain.cpp b/source/App/SEIRemovalApp/seiremovalmain.cpp index 309bb72c3..e96aca4e2 100644 --- a/source/App/SEIRemovalApp/seiremovalmain.cpp +++ b/source/App/SEIRemovalApp/seiremovalmain.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) fprintf( stdout, NVM_ONOS ); fprintf( stdout, NVM_COMPILEDBY ); fprintf( stdout, NVM_BITS ); -#if ENABLE_SIMD_OPT +#if ENABLE_SIMD_OPT && defined(TARGET_SIMD_X86) std::string SIMD; df::program_options_lite::Options optsSimd; optsSimd.addOptions()( "SIMD", SIMD, string( "" ), "" ); diff --git a/source/Lib/CommonLib/BilateralFilter.cpp b/source/Lib/CommonLib/BilateralFilter.cpp index f36751c88..c767bd235 100755 --- a/source/Lib/CommonLib/BilateralFilter.cpp +++ b/source/Lib/CommonLib/BilateralFilter.cpp @@ -38,9 +38,11 @@ #endif #if JVET_V0094_BILATERAL_FILTER || JVET_X0071_CHROMA_BILATERAL_FILTER +#ifdef TARGET_SIMD_X86 #include <tmmintrin.h> #include <smmintrin.h> #include <immintrin.h> +#endif #include <stdio.h> #include <math.h> #include <string.h> diff --git a/source/Lib/CommonLib/BilateralFilter.h b/source/Lib/CommonLib/BilateralFilter.h index 66b4ceb29..16ee6606d 100755 --- a/source/Lib/CommonLib/BilateralFilter.h +++ b/source/Lib/CommonLib/BilateralFilter.h @@ -39,9 +39,11 @@ #include "Unit.h" #include "Buffer.h" +#ifdef TARGET_SIMD_X86 #include <tmmintrin.h> #include <smmintrin.h> #include <immintrin.h> +#endif #if JVET_V0094_BILATERAL_FILTER class BIFCabacEst { @@ -62,8 +64,13 @@ public: class BilateralFilter { private: +#ifdef TARGET_SIMD_X86 __m128i tempblockSIMD[2320]; __m128i tempblockFilteredSIMD[2320]; +#else + int64_t tempblockSIMD[2 * 2320]; + int64_t tempblockFilteredSIMD[2 * 2320]; +#endif short *tempblock = (short *) tempblockSIMD; short *tempblockFilteredTemp = (short *) (&tempblockFilteredSIMD[1]); // SIMD method writes to tempblockFiltered + 4 so that address diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp index 61456467d..c4b1e71f9 100644 --- a/source/Lib/CommonLib/Buffer.cpp +++ b/source/Lib/CommonLib/Buffer.cpp @@ -518,7 +518,7 @@ void calcBlkGradientCore(int sx, int sy, int *arraysGx2, int *arraysGxGy } } -#if ENABLE_SIMD_OPT_BCW +#if ENABLE_SIMD_OPT_BCW && defined(TARGET_SIMD_X86) void removeWeightHighFreq(int16_t* dst, int dstStride, const int16_t* src, int srcStride, int width, int height, int shift, int bcwWeight) { int normalizer = ((1 << 16) + (bcwWeight > 0 ? (bcwWeight >> 1) : -(bcwWeight >> 1))) / bcwWeight; @@ -615,7 +615,7 @@ PelBufferOps::PelBufferOps() copyBuffer = copyBufferCore; padding = paddingCore; -#if ENABLE_SIMD_OPT_BCW +#if ENABLE_SIMD_OPT_BCW && defined(TARGET_SIMD_X86) removeWeightHighFreq8 = removeWeightHighFreq; removeWeightHighFreq4 = removeWeightHighFreq; removeHighFreq8 = removeHighFreq; diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index cef44b3d2..8e5fd82a7 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -86,7 +86,7 @@ struct PelBufferOps void(*calcBlkGradient)(int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); void(*copyBuffer)(Pel *src, int srcStride, Pel *dst, int dstStride, int width, int height); void(*padding)(Pel *dst, int stride, int width, int height, int padSize); -#if ENABLE_SIMD_OPT_BCW +#if ENABLE_SIMD_OPT_BCW && defined(TARGET_SIMD_X86) void ( *removeWeightHighFreq8) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height, int shift, int bcwWeight); void ( *removeWeightHighFreq4) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height, int shift, int bcwWeight); void ( *removeHighFreq8) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height); @@ -486,7 +486,7 @@ void AreaBuf<T>::removeWeightHighFreq(const AreaBuf<T>& other, const bool bClip, Pel* dst = buf; const int dstStride = stride; -#if ENABLE_SIMD_OPT_BCW +#if ENABLE_SIMD_OPT_BCW && defined(TARGET_SIMD_X86) if(!bClip) { if(!(width & 7)) @@ -535,7 +535,7 @@ void AreaBuf<T>::removeWeightHighFreq(const AreaBuf<T>& other, const bool bClip, #undef REM_HF_INC #undef REM_HF_OP #undef REM_HF_OP_CLIP -#if ENABLE_SIMD_OPT_BCW +#if ENABLE_SIMD_OPT_BCW && defined(TARGET_SIMD_X86) } #endif } @@ -549,7 +549,7 @@ void AreaBuf<T>::removeHighFreq( const AreaBuf<T>& other, const bool bClip, cons T* dst = buf; const int dstStride = stride; -#if ENABLE_SIMD_OPT_BCW +#if ENABLE_SIMD_OPT_BCW && defined(TARGET_SIMD_X86) if (!bClip) { if(!(width & 7)) @@ -583,7 +583,7 @@ void AreaBuf<T>::removeHighFreq( const AreaBuf<T>& other, const bool bClip, cons #undef REM_HF_OP #undef REM_HF_OP_CLIP -#if ENABLE_SIMD_OPT_BCW +#if ENABLE_SIMD_OPT_BCW && defined(TARGET_SIMD_X86) } #endif } diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index e4873b7a5..c32634be8 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -1702,7 +1702,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio } else { -#if SIMD_4x4_12 +#if SIMD_4x4_12 && defined(TARGET_SIMD_X86) //use 4x4 if possible if( compID == COMPONENT_Y && backupWidth == 4 @@ -1748,7 +1748,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio JVET_J0090_SET_CACHE_ENABLE( false ); m_if.filterVer( compID, ( Pel* ) tmpBuf.buf + ( ( vFilterSize >> 1 ) - 1 ) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, chFmt, clpRng, bilinearMC, bilinearMC, useAltHpelIf); #endif -#if SIMD_4x4_12 +#if SIMD_4x4_12 && defined(TARGET_SIMD_X86) } #endif } @@ -2362,7 +2362,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction } else { -#if SIMD_4x4_12 +#if SIMD_4x4_12 && defined(TARGET_SIMD_X86) #if AFFINE_RM_CONSTRAINTS_AND_OPT if (compID == COMPONENT_Y && bw == 4 && bh == 4) #else @@ -2377,7 +2377,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction m_if.filterVer(compID, tmpBuf.buf + ((vFilterSize >> 1) - 1)*tmpBuf.stride, tmpBuf.stride, dst, dstStride, bw, bh, yFrac, false, isLast, chFmt, clpRng , 0, false, false); JVET_J0090_SET_CACHE_ENABLE(true); -#if SIMD_4x4_12 +#if SIMD_4x4_12 && defined(TARGET_SIMD_X86) } #endif } diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp index 4ca24bb83..b8ff7c4ec 100644 --- a/source/Lib/CommonLib/InterpolationFilter.cpp +++ b/source/Lib/CommonLib/InterpolationFilter.cpp @@ -1140,7 +1140,7 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int } } -#if SIMD_4x4_12 +#if SIMD_4x4_12 && defined(TARGET_SIMD_X86) void InterpolationFilter::filter4x4( const ClpRng& clpRng, Pel const *src, int srcStride, Pel *dst, int dstStride, int xFrac, int yFrac, bool isLast) { const TFilterCoeff* coeffH = m_lumaFilter12[xFrac]; diff --git a/source/Lib/CommonLib/InterpolationFilter.h b/source/Lib/CommonLib/InterpolationFilter.h index b2789acce..8d4240a16 100644 --- a/source/Lib/CommonLib/InterpolationFilter.h +++ b/source/Lib/CommonLib/InterpolationFilter.h @@ -136,7 +136,7 @@ public: InterpolationFilter(); ~InterpolationFilter() {} #if IF_12TAP -#if SIMD_4x4_12 +#if SIMD_4x4_12 && defined(TARGET_SIMD_X86) void(*m_filter4x4[2])(const int16_t* src, int srcStride, int16_t *dst, int dstStride, int shiftH, int offsetH, int shiftV, int offsetV, int16_t const *coeffH, int16_t const *coeffV, int ibdimin, int ibdimax); //kolya #endif diff --git a/source/Lib/CommonLib/x86/CommonDefX86.h b/source/Lib/CommonLib/x86/CommonDefX86.h index b00469dbd..0dba247d4 100644 --- a/source/Lib/CommonLib/x86/CommonDefX86.h +++ b/source/Lib/CommonLib/x86/CommonDefX86.h @@ -43,6 +43,8 @@ //! \ingroup CommonLib //! \{ +#ifdef TARGET_SIMD_X86 + #include <immintrin.h> #ifdef USE_AVX512 @@ -358,6 +360,8 @@ static void _printReg( const R var, const char* varname, uint8_t count = sizeof( #define PREG( var, t, cnt ) #endif +#endif // TARGET_SIMD_X86 + #endif // __COMMONDEFX86__ diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 1cb97cdb7..5cf5b145b 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -503,7 +503,7 @@ DecLib::DecLib() , m_dci(NULL) , m_apsMapEnc( nullptr ) { -#if ENABLE_SIMD_OPT_BUFFER +#if ENABLE_SIMD_OPT_BUFFER && defined(TARGET_SIMD_X86) g_pelBufOP.initPelBufOpsX86(); #endif #if JVET_S0155_EOS_NALU_CHECK diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 737a7f908..4009f0fa3 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -77,7 +77,7 @@ EncLib::EncLib( EncLibCommon* encLibCommon ) m_iMaxRefPicNum = 0; -#if ENABLE_SIMD_OPT_BUFFER +#if ENABLE_SIMD_OPT_BUFFER && defined(TARGET_SIMD_X86) g_pelBufOP.initPelBufOpsX86(); #endif -- GitLab