diff --git a/CMakeLists.txt b/CMakeLists.txt index f3460683632fce3255de2d3df602e85d1fc5f5eb..62dbf8b08286d07fba6b5a21a368035016f57bbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ endif() bb_enable_warnings( msvc warnings-as-errors "/wd4996" ) # enable sse4.1 build for all source files for gcc and clang -if( UNIX OR MINGW ) +if( (UNIX OR MINGW) AND NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") ) add_compile_options( "-msse4.1" ) endif() diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake index 07532ba3ef188edb7a1f52d08434ff82341b0eab..82a7f51ba4c2dbb2e94eeb025d1562a29620373e 100644 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake +++ b/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake @@ -873,6 +873,9 @@ function( _bb_query_system_info system_info_ ) endif() elseif( CMAKE_HOST_APPLE ) set( _system_info "macosx" ) + if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm64" ) + set( _os_arch "arm64" ) + endif() if( NOT CMAKE_VERSION VERSION_LESS 3.10.0 ) # sw_vers -productVersion cmake_host_system_information( RESULT _lsb_distro_version QUERY OS_RELEASE ) @@ -973,7 +976,9 @@ function( _bb_get_platform_dir platform_dir_ ) set( _platform_dir "${CMAKE_SYSTEM_PROCESSOR}" ) endif() else() - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm64" ) + set( _platform_dir "arm64" ) + elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set( _platform_dir "x86_64" ) else() set( _platform_dir "x86" ) diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp index 675111d5c081e51255e62d9ca3ae7e11a31f1dc4..70bdf08df259abf8a016b567061267a749e228d9 100644 --- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp +++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp @@ -505,7 +505,6 @@ uint32_t BitstreamExtractorApp::decode() bitstreamFileIn.clear(); bitstreamFileIn.seekg( 0, std::ios::beg ); - int unitCnt = 0; bool lastSliceWritten= false; // stores status of previous slice for associated filler data NAL units VPS *vpsIdZero = new VPS(); @@ -802,7 +801,6 @@ uint32_t BitstreamExtractorApp::decode() writeInpuNalUnitToStream = lastSliceWritten; } } - unitCnt++; if( writeInpuNalUnitToStream ) { diff --git a/source/App/CabacTraining/io.h b/source/App/CabacTraining/io.h index b67403b19682f15e5431f7ab68169209b4a7c025..c1fda6f6ff9a6eae7c4a35f7e44e5e81c8e282c7 100644 --- a/source/App/CabacTraining/io.h +++ b/source/App/CabacTraining/io.h @@ -40,7 +40,6 @@ static std::array<ModelParameters, 3> readModelParameters( std::istream &in ) static DataDb addDataFrame( istream &in, DataDb &db ) { - int64_t tot = 0; char c = ( char ) in.peek(); while( in&&c == 'c' ) @@ -139,7 +138,6 @@ static DataDb addDataFrame( istream &in, DataDb &db ) std::string s; in >> s; d.bins.resize( s.size() ); - tot += s.size(); for( int k = 0; k < ( int ) s.size(); ++k ) { d.bins[k] = (s[k] == '1'); diff --git a/source/App/CabacTraining/optimization.h b/source/App/CabacTraining/optimization.h index cdac99db0c03f6cbe6af11dfbe5f5b97db077f55..b00cf087ae550a45239be61efbad88a0fb465d71 100644 --- a/source/App/CabacTraining/optimization.h +++ b/source/App/CabacTraining/optimization.h @@ -56,7 +56,6 @@ inline std::array<int,2> getBestGreedyDrate(const DataDb &db,const std::array<bo constexpr int kMaxRate = 12; // theoritcal is PROB_BITS=15 int bestdrate[4] = { 7,7,7,7 }; double bestc = std::numeric_limits<double>::max(); - int loopDrate = 0; for( int drate00 = drateStartIdx; drate00 <= drateEndIdx; drate00++ ) { @@ -135,8 +134,6 @@ inline std::array<int,2> getBestGreedyDrate(const DataDb &db,const std::array<bo bestdrate[2] = drate10; bestdrate[3] = drate11; } - - loopDrate++; } } } diff --git a/source/Lib/CommonAnalyserLib/CMakeLists.txt b/source/Lib/CommonAnalyserLib/CMakeLists.txt index 912ce1e914e31f4abce8f1b6be532183efceca73..3b8197ffc89e12ede9cabf1826ddaf1f376aad44 100644 --- a/source/Lib/CommonAnalyserLib/CMakeLists.txt +++ b/source/Lib/CommonAnalyserLib/CMakeLists.txt @@ -6,29 +6,31 @@ if( MSVC ) file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" ) endif() -# get source files -file( GLOB BASE_SRC_FILES "../CommonLib/*.cpp" ) +if (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") ) + # get source files + file( GLOB BASE_SRC_FILES "../CommonLib/*.cpp" ) -# get include files -file( GLOB BASE_INC_FILES "../CommonLib/*.h" ) + # get include files + file( GLOB BASE_INC_FILES "../CommonLib/*.h" ) -# get x86 source files -file( GLOB X86_SRC_FILES "../CommonLib/x86/*.cpp" ) + # get x86 source files + file( GLOB X86_SRC_FILES "../CommonLib/x86/*.cpp" ) -# get x86 include files -file( GLOB X86_INC_FILES "../CommonLib/x86/*.h" ) + # get x86 include files + file( GLOB X86_INC_FILES "../CommonLib/x86/*.h" ) -# get avx source files -file( GLOB AVX_SRC_FILES "../CommonLib/x86/avx/*.cpp" ) + # get avx source files + file( GLOB AVX_SRC_FILES "../CommonLib/x86/avx/*.cpp" ) -# get avx2 source files -file( GLOB AVX2_SRC_FILES "../CommonLib/x86/avx2/*.cpp" ) + # get avx2 source files + file( GLOB AVX2_SRC_FILES "../CommonLib/x86/avx2/*.cpp" ) -# get sse4.1 source files -file( GLOB SSE41_SRC_FILES "../CommonLib/x86/sse41/*.cpp" ) + # get sse4.1 source files + file( GLOB SSE41_SRC_FILES "../CommonLib/x86/sse41/*.cpp" ) -# get sse4.2 source files -file( GLOB SSE42_SRC_FILES "../CommonLib/x86/sse42/*.cpp" ) + # get sse4.2 source files + file( GLOB SSE42_SRC_FILES "../CommonLib/x86/sse42/*.cpp" ) +endif() # get libmd5 source files file( GLOB MD5_SRC_FILES "../libmd5/*.cpp" ) @@ -76,23 +78,24 @@ endif() target_include_directories( ${LIB_NAME} PUBLIC ../CommonLib/. ../CommonLib/.. ../CommonLib/x86 ../libmd5 ) target_link_libraries( ${LIB_NAME} ) -# set needed compile definitions -set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE41 ) -set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE42 ) -set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX ) -set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX2 ) -# set needed compile flags -if( MSVC ) - set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX" ) - set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) -elseif( UNIX OR MINGW ) - set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" ) - set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.2" ) - set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx" ) - set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx2" ) +if (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") ) + # set needed compile definitions + set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE41 ) + set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE42 ) + set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX ) + set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX2 ) + # set needed compile flags + if( MSVC ) + set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX" ) + set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) + elseif( UNIX OR MINGW ) + set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" ) + set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.2" ) + set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx" ) + set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx2" ) + endif() endif() - # example: place header files in different folders source_group( "Natvis Files" FILES ${NATVIS_FILES} ) diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp index cfe39d579c0a507d4ae5f65016b9731b1cefe011..caf2b3059444325101fb984f20db88ca447a3c8d 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp @@ -406,8 +406,6 @@ void AdaptiveLoopFilter::applyCcAlfFilter(CodingStructure &cs, ComponentID compI PelUnitBuf tmpYuvResi = m_tempBufResi.getBuf(UnitArea(CHROMA_400, Area(cs.area.blocks[COMPONENT_Y]))); #endif - int ctuIdx = 0; - const int chromaScaleX = getComponentScaleX( compID, m_chromaFormat ); const int chromaScaleY = getComponentScaleY( compID, m_chromaFormat ); @@ -529,7 +527,6 @@ void AdaptiveLoopFilter::applyCcAlfFilter(CodingStructure &cs, ComponentID compI #endif } } - ctuIdx++; } } } diff --git a/source/Lib/CommonLib/CMakeLists.txt b/source/Lib/CommonLib/CMakeLists.txt index b0d48a54c902cb1e997f2cccff2ba0827aa84422..e0bc9a1e49f0296006a30683d1d1a3e1ffd2101d 100644 --- a/source/Lib/CommonLib/CMakeLists.txt +++ b/source/Lib/CommonLib/CMakeLists.txt @@ -13,23 +13,25 @@ file( GLOB BASE_SRC_FILES "*.cpp" ) file( GLOB BASE_INC_FILES "*.h" ) file( GLOB BASE_INL_FILES "*.inl" ) -# get x86 source files -file( GLOB X86_SRC_FILES "x86/*.cpp" ) +if (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") ) + # get x86 source files + file( GLOB X86_SRC_FILES "x86/*.cpp" ) -# get x86 include files -file( GLOB X86_INC_FILES "x86/*.h" ) + # get x86 include files + file( GLOB X86_INC_FILES "x86/*.h" ) -# get avx source files -file( GLOB AVX_SRC_FILES "x86/avx/*.cpp" ) + # get avx source files + file( GLOB AVX_SRC_FILES "x86/avx/*.cpp" ) -# get avx2 source files -file( GLOB AVX2_SRC_FILES "x86/avx2/*.cpp" ) + # get avx2 source files + file( GLOB AVX2_SRC_FILES "x86/avx2/*.cpp" ) -# get sse4.2 source files -file( GLOB SSE42_SRC_FILES "x86/sse42/*.cpp" ) + # get sse4.2 source files + file( GLOB SSE42_SRC_FILES "x86/sse42/*.cpp" ) -# get sse4.1 source files -file( GLOB SSE41_SRC_FILES "x86/sse41/*.cpp" ) + # get sse4.1 source files + file( GLOB SSE41_SRC_FILES "x86/sse41/*.cpp" ) +endif() # get libmd5 source files file( GLOB MD5_SRC_FILES "../libmd5/*.cpp" ) @@ -75,23 +77,24 @@ endif() target_include_directories( ${LIB_NAME} PUBLIC . .. ./x86 ../libmd5 ) target_link_libraries( ${LIB_NAME} ) -# set needed compile definitions -set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE41 ) -set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE42 ) -set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX ) -set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX2 ) -# set needed compile flags -if( MSVC ) - set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX" ) - set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) -elseif( UNIX OR MINGW ) - set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" ) - set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.2" ) - set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx" ) - set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx2" ) +if (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") ) + # set needed compile definitions + set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE41 ) + set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_SSE42 ) + set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX ) + set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_AVX2 ) + # set needed compile flags + if( MSVC ) + set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX" ) + set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) + elseif( UNIX OR MINGW ) + set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" ) + set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.2" ) + set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx" ) + set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx2" ) + endif() endif() - # example: place header files in different folders source_group( "Natvis Files" FILES ${NATVIS_FILES} ) diff --git a/source/Lib/CommonLib/Common.h b/source/Lib/CommonLib/Common.h index 17ea3c597f968251e938c24038671f9664118a86..bb2ce93fca9009f2d326c8abe006d84a6964d50c 100644 --- a/source/Lib/CommonLib/Common.h +++ b/source/Lib/CommonLib/Common.h @@ -314,9 +314,9 @@ enum CCPType struct CCPModelCandidate { - int64_t params[2][NUM_CCP_PARAMS] = { 0 }; + int64_t params[2][NUM_CCP_PARAMS] = { { 0 } }; #if MMLM - int64_t params2[2][NUM_CCP_PARAMS] = { 0 }; + int64_t params2[2][NUM_CCP_PARAMS] = { { 0 } }; int shift2[2] = { 0 }; int yThres = 0; #endif diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 8bb5359d6c1fea14b506d70b6e39fad67595e47b..e0eace014cceff87a65ec2af7177bf389a89f519 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -910,7 +910,6 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC, cons #if JVET_AG0061_INTER_LFNST_NSPT int InterPrediction::deriveInterDimdMode(const CodingUnit cu, CPelBuf predBuf) { - int sigcnt = 0; const Pel *pPred = predBuf.buf; const int iStride = predBuf.stride; int height = predBuf.height; @@ -919,7 +918,7 @@ int InterPrediction::deriveInterDimdMode(const CodingUnit cu, CPelBuf predBuf) int piHistogramClean[NUM_LUMA_MODE] = { 0 }; pPred = pPred + iStride + 1; - sigcnt += buildHistogram(pPred, iStride, height - 2, width - 2, piHistogramClean, 0, width - 2, height - 2); + buildHistogram(pPred, iStride, height - 2, width - 2, piHistogramClean, 0, width - 2, height - 2); int firstAmp = 0, curAmp = 0; int firstMode = 0, curMode = 0; @@ -34712,7 +34711,7 @@ std::vector<Mv> InterPrediction::deriveMVDFromMVSDIdxAffineSI(PredictionUnit& pu CandCheckEnv checkEnv(cMvdDerived, cMvPred, pu, picWidth, picHeight, lcuWidth, tplCtrl, aMvCostVec); int idxOffset = 0; //typedef void (CandCheckEnv::* RangeCheckFxn)(bool , bool , int , int , int ); - auto checkRange = [&step, &checkEnv, &idxOffset, iHorRange, iVerRange](int idxRight, int rangeLen) + auto checkRange = [&step, &checkEnv, &idxOffset](int idxRight, int rangeLen) { switch (step) { diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index fecab8aa4af40222f81f065bc429fb1e81df83a1..c2855198a177d405c65c72f14c84c0c8e4327478 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -8272,7 +8272,6 @@ void IntraPrediction::ibcCiipBlending(Pel *pDst, int strideDst, const Pel *pSrc0 #if JVET_AC0115_INTRA_TMP_DIMD_MTS_LFNST int IntraPrediction::deriveDimdIntraTmpModePred(const CodingUnit cu, CPelBuf predBuf) { - int sigcnt = 0; const Pel* pPred = predBuf.buf; const int iStride = predBuf.stride; int height = predBuf.height; @@ -8281,7 +8280,7 @@ int IntraPrediction::deriveDimdIntraTmpModePred(const CodingUnit cu, CPelBuf pre int piHistogramClean[NUM_LUMA_MODE] = { 0 }; pPred = pPred + iStride + 1; - sigcnt += buildHistogram(pPred, iStride, height - 2, width - 2, piHistogramClean, 0, width - 2, height - 2); + buildHistogram(pPred, iStride, height - 2, width - 2, piHistogramClean, 0, width - 2, height - 2); int firstAmp = 0, curAmp = 0; int firstMode = 0, curMode = 0; @@ -15275,7 +15274,7 @@ void IntraPrediction::xGlmApplyModelOffset(const PredictionUnit &pu, const Compo void IntraPrediction::xCccmApplyModelOffset(const PredictionUnit &pu, const ComponentID compId, CccmModel& cccmModel, int modelId, int modelThr, - PelBuf &piPred, int lumaOffset, int chromaOffset[], int type, int refSizeX, int refSizeY) + PelBuf &piPred, int lumaOffset, int chromaOffset[2], int type, int refSizeX, int refSizeY) { const ClpRng &clpRng(pu.cu->cs->slice->clpRng(compId)); Pel* samples = m_samples; diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index eb783dc3e5937b8d0f6525d697ddfa84c3e859b8..02cb86f3510ea810552e99d698c5ebf126f1cf52 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -3195,10 +3195,6 @@ private: bool m_picColFromL0Flag2nd; //!< syntax element collocated_from_l0_flag uint32_t m_colRefIdx2nd; #endif -#if JVET_AG0098_AMVP_WITH_SBTMVP - uint8_t m_amvpSbTmvpNumOffset; - uint8_t m_amvpSbTmvpNumDir; -#endif #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC uint32_t m_costForARMC; //!< Cost for diversity criterion #endif diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 23d7055fbd9c52c07733d36376600ae6e953f8f2..90593c330c3cbb360872587f8b3be77002cf9ca8 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -7006,7 +7006,6 @@ void CABACReader::mvd_coding( Mv &rMvd, MvdSuffixInfo* const pSi unsigned CABACReader::xReadMvdPrefix( int param ) { - unsigned symbol = 0; unsigned bit = 1; unsigned uiIdx = 0; @@ -7014,7 +7013,6 @@ unsigned CABACReader::xReadMvdPrefix( int param ) { bit = m_BinDecoder.decodeBinEP(); uiIdx++; - symbol += bit << param++; } --uiIdx; @@ -7226,7 +7224,6 @@ void CABACReader::mvd_coding( Mv &rMvd #if JVET_AC0104_IBC_BVD_PREDICTION unsigned CABACReader::xReadBvdContextPrefix(unsigned ctxT, int offset, int param ) { - unsigned symbol = 0; unsigned bit = 1; unsigned uiIdx = 0; @@ -7242,7 +7239,6 @@ unsigned CABACReader::xReadBvdContextPrefix(unsigned ctxT, int offset, int param } uiIdx++; - symbol += bit << param++; } --uiIdx; diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 18fd8ebf4f567cdb6355ae3eaa01f95f6c938761..5187e816cf4b28a761cdbbb96e9d346db3d40198 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -560,7 +560,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) { pcPPS->setSingleSlicePerSubPicFlag(0); } - if (pcPPS->getRectSliceFlag() & !(pcPPS->getSingleSlicePerSubPicFlag())) + if (pcPPS->getRectSliceFlag() && !(pcPPS->getSingleSlicePerSubPicFlag())) { int32_t tileIdx = 0; diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 8747031e9d8a494e8840383a53a804b66a2ffdf9..9a6f3ba3066d0e8ae234bdc45ea1d9cea6af90c0 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -6653,30 +6653,24 @@ unsigned CABACWriter::xWriteMvdPrefix( unsigned uiSymbol, int param ) numBins++; unsigned temp = 0; - unsigned bitCount = 0; for (int i = numBins - 1; i >= 0; i--) { temp = bins >> i; m_BinEncoder.encodeBinEP(temp); bins -= (temp << i); - bitCount++; } return numBins - 1; // less by 1 as compared to what xReadBvdContextPrefix() returns } void CABACWriter::xWriteMvdContextSuffix(unsigned uiSymbol, int param, int paramUpdated, int numSkipMSB ) { - unsigned bins = 0; unsigned numBins = 0; while (uiSymbol >= (unsigned) (1 << param)) { - bins <<= 1; - bins++; numBins++; uiSymbol -= 1 << param; param++; } - bins <<= 1; numBins++; paramUpdated++; @@ -6907,17 +6901,13 @@ unsigned CABACWriter::xWriteBvdContextPrefix(unsigned uiSymbol, unsigned ctxT, i } void CABACWriter::xWriteBvdContextSuffix(unsigned uiSymbol, int param, int paramUpdated, int numSkipMSB ) { - unsigned bins = 0; unsigned numBins = 0; while (uiSymbol >= (unsigned) (1 << param)) { - bins <<= 1; - bins++; numBins++; uiSymbol -= 1 << param; param++; } - bins <<= 1; numBins++; paramUpdated++; diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 0fe9d8866dac3732bedae120f131474277184b0a..51a4a5a21a3b18575ac5d3ef0b5bab605fa35739 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -4045,7 +4045,7 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner } #if MMLM - bool isCccmModeEnabledInRdo[2][MMLM_T_IDX + 1] = { false }; + bool isCccmModeEnabledInRdo[2][MMLM_T_IDX + 1] = { { false } }; #if !JVET_AD0202_CCCM_MDF isCccmModeEnabledInRdo[0][satdCccmModeList[0][0]] = true; #endif @@ -4060,7 +4060,7 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner #endif #endif #if JVET_AD0202_CCCM_MDF - bool isCccmWithMulDownSamplingEnabledInRdo[MMLM_T_IDX + 1][CCCM_NUM_PRED_FILTER] = { false }; + bool isCccmWithMulDownSamplingEnabledInRdo[MMLM_T_IDX + 1][CCCM_NUM_PRED_FILTER] = { { false } }; isCccmWithMulDownSamplingEnabledInRdo[satdCccmModeList[0][0]][satdCccmFilterIndex[0]] = true; for (int i = 1; i < 7; i++) #else @@ -10810,7 +10810,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti piReco.reconstruct(piPred, piResi, cs.slice->clpRng(compID)); if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcEncCfg->getLmcs() - & slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) + && slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) { const CPelBuf orgLuma = csFull->getOrgBuf(csFull->area.blocks[COMPONENT_Y]); if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled())) @@ -10924,7 +10924,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti #endif piReco.reconstruct(piPred, piResi, cs.slice->clpRng(compID)); if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() - || (m_pcEncCfg->getLmcs() & slice.getLmcsEnabledFlag() + || (m_pcEncCfg->getLmcs() && slice.getLmcsEnabledFlag() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD())))) { const CPelBuf orgLuma = csFull->getOrgBuf(csFull->area.blocks[COMPONENT_Y]); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 635cf0d24e5a37f3bf6511a48947cc0f7fa96346..5d4de4d4dcb8bf8db0a8b8524b0a83ca64705bea 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -349,7 +349,7 @@ void HLSWriter::codePPS( const PPS* pcPPS ) { WRITE_FLAG(pcPPS->getSingleSlicePerSubPicFlag( ) ? 1 : 0, "single_slice_per_subpic_flag"); } - if (pcPPS->getRectSliceFlag() & !(pcPPS->getSingleSlicePerSubPicFlag())) + if (pcPPS->getRectSliceFlag() && !(pcPPS->getSingleSlicePerSubPicFlag())) { WRITE_UVLC( pcPPS->getNumSlicesInPic( ) - 1, "num_slices_in_pic_minus1" ); if ((pcPPS->getNumSlicesInPic() - 1) > 1) diff --git a/source/Lib/Utilities/program_options_lite.h b/source/Lib/Utilities/program_options_lite.h index b276c2bd3dcdbd6da0ae21adb796104c720baf45..962f1f75527bf6a83feae980366d0ffaee48b95e 100644 --- a/source/Lib/Utilities/program_options_lite.h +++ b/source/Lib/Utilities/program_options_lite.h @@ -239,15 +239,15 @@ namespace df std::string cNameBuffer; std::string cDescriptionBuffer; - for (unsigned int uiK = 0; uiK < uiMaxNum; uiK++) + for (unsigned int k = 0; k < uiMaxNum; k++) { // it needs to be reset when extra digit is added, e.g. number 10 and above cNameBuffer.resize(name.size() + 10); cDescriptionBuffer.resize(desc.size() + 10); // isn't there are sprintf function for string?? - sprintf((char*)cNameBuffer.c_str(), name.c_str(), uiK, uiK); - sprintf((char*)cDescriptionBuffer.c_str(), desc.c_str(), uiK, uiK); + snprintf((char*) cNameBuffer.c_str(), cNameBuffer.size(), name.c_str(), k, k); + snprintf((char*) cDescriptionBuffer.c_str(), cDescriptionBuffer.size(), desc.c_str(), k, k); size_t pos = cNameBuffer.find_first_of('\0'); if (pos != std::string::npos) @@ -255,7 +255,7 @@ namespace df cNameBuffer.resize(pos); } - parent.addOption(new Option<T>(cNameBuffer, (storage[uiK]), default_val, cDescriptionBuffer)); + parent.addOption(new Option<T>(cNameBuffer, (storage[k]), default_val, cDescriptionBuffer)); } return *this; @@ -268,21 +268,21 @@ namespace df std::string cNameBuffer; std::string cDescriptionBuffer; - for (unsigned int uiK = 0; uiK < uiMaxNum; uiK++) + for (unsigned int k = 0; k < uiMaxNum; k++) { // it needs to be reset when extra digit is added, e.g. number 10 and above cNameBuffer.resize(name.size() + 10); cDescriptionBuffer.resize(desc.size() + 10); // isn't there are sprintf function for string?? - sprintf((char*)cNameBuffer.c_str(), name.c_str(), uiK, uiK); - sprintf((char*)cDescriptionBuffer.c_str(), desc.c_str(), uiK, uiK); + snprintf((char*) cNameBuffer.c_str(), cNameBuffer.size(), name.c_str(), k, k); + snprintf((char*) cDescriptionBuffer.c_str(), cDescriptionBuffer.size(), desc.c_str(), k, k); size_t pos = cNameBuffer.find_first_of('\0'); if (pos != std::string::npos) cNameBuffer.resize(pos); - parent.addOption(new Option<T>(cNameBuffer, *(storage[uiK]), default_val, cDescriptionBuffer)); + parent.addOption(new Option<T>(cNameBuffer, *(storage[k]), default_val, cDescriptionBuffer)); } return *this;