Commit 3a056bde authored by Adam Wieckowski's avatar Adam Wieckowski
Browse files

removed split parallelism

parent c363af84
......@@ -52,22 +52,6 @@ set_property( GLOBAL PROPERTY USE_FOLDERS ON )
# Include a utility module providing functions, macros, and settings
include( ${CMAKE_SOURCE_DIR}/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake )
# Enable multithreading
bb_multithreading()
find_package(OpenMP)
if( OpenMP_FOUND )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}" )
set( SET_ENABLE_SPLIT_PARALLELISM OFF CACHE BOOL "Set ENABLE_SPLIT_PARALLELISM as a compiler flag" )
set( ENABLE_SPLIT_PARALLELISM OFF CACHE BOOL "If SET_ENABLE_SPLIT_PARALLELISM is on, it will be set to this value" )
set( SET_ENABLE_WPP_PARALLELISM OFF CACHE BOOL "Set ENABLE_WPP_PARALLELISM as a compiler flag" )
set( ENABLE_WPP_PARALLELISM OFF CACHE BOOL "If SET_ENABLE_WPP_PARALLELISM is on, it will be set to this value" )
endif()
# Enable warnings for some generators and toolsets.
# bb_enable_warnings( gcc warnings-as-errors -Wno-sign-compare )
# bb_enable_warnings( gcc -Wno-unused-variable )
......@@ -75,6 +59,8 @@ endif()
# for gcc 8.2:
bb_enable_warnings( gcc warnings-as-errors -Wno-sign-compare -Wno-class-memaccess)
bb_multithreading()
if( XCODE )
bb_enable_warnings( clang warnings-as-errors
-Wno-deprecated-declarations
......
......@@ -33,26 +33,6 @@ if( SET_ENABLE_TRACING )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
......
......@@ -35,26 +35,6 @@ if( SET_ENABLE_TRACING )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
......
......@@ -33,26 +33,6 @@ if( SET_ENABLE_TRACING )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
......
......@@ -35,26 +35,6 @@ if( SET_ENABLE_TRACING )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
......
......@@ -1041,10 +1041,6 @@ void EncApp::xInitLibCfg()
m_cEncLib.setStopAfterFFtoPOC ( m_stopAfterFFtoPOC );
m_cEncLib.setBs2ModPOCAndType ( m_bs2ModPOCAndType );
m_cEncLib.setDebugCTU ( m_debugCTU );
#if ENABLE_SPLIT_PARALLELISM
m_cEncLib.setNumSplitThreads ( m_numSplitThreads );
m_cEncLib.setForceSingleSplitThread ( m_forceSplitSequential );
#endif
m_cEncLib.setUseALF ( m_alf );
#if JVET_U0081
m_cEncLib.setALFStrengthLuma (m_alfStrengthLuma);
......
......@@ -1392,12 +1392,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("StopAfterFFtoPOC", m_stopAfterFFtoPOC, false, "If using fast forward to POC, after the POC of interest has been hit, stop further encoding.")
("ForceDecodeBitstream1", m_forceDecodeBitstream1, false, "force decoding of bitstream 1 - use this only if you are realy sure about what you are doing ")
("DecodeBitstream2ModPOCAndType", m_bs2ModPOCAndType, false, "Modify POC and NALU-type of second input bitstream, to use second BS as closing I-slice")
("NumSplitThreads", m_numSplitThreads, 1, "Number of threads used to parallelize splitting")
("ForceSingleSplitThread", m_forceSplitSequential, false, "Force single thread execution even if taking the parallelized path")
("NumWppThreads", m_numWppThreads, 1, "Number of threads used to run WPP-style parallelization")
("NumWppExtraLines", m_numWppExtraLines, 0, "Number of additional wpp lines to switch when threads are blocked")
("DebugCTU", m_debugCTU, -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC-frame at CTUline containin debug CTU.")
("EnsureWppBitEqual", m_ensureWppBitEqual, false, "Ensure the results are equal to results with WPP-style parallelism, even if WPP is off")
( "ALF", m_alf, true, "Adaptive Loop Filter\n" )
#if JVET_U0081
("ALFStrengthLuma", m_alfStrengthLuma, 1.0, "Adaptive Loop Filter strength for luma. The parameter scales the magnitudes of the ALF filter coefficients for luma. Valid range is 0.0 <= ALFStrengthLuma <= 1.0")
......@@ -2588,16 +2584,6 @@ bool EncAppCfg::xCheckParameter()
xConfirmPara( m_wrapAroundOffset % minCUSize != 0, "Wrap-around offset must be an integer multiple of the specified minimum CU size" );
}
#if ENABLE_SPLIT_PARALLELISM
xConfirmPara( m_numSplitThreads < 1, "Number of used threads cannot be smaller than 1" );
xConfirmPara( m_numSplitThreads > PARL_SPLIT_MAX_NUM_THREADS, "Number of used threads cannot be higher than the number of actual jobs" );
#else
xConfirmPara( m_numSplitThreads != 1, "ENABLE_SPLIT_PARALLELISM is disabled, numSplitThreads has to be 1" );
#endif
xConfirmPara( m_numWppThreads != 1, "ENABLE_WPP_PARALLELISM is disabled, numWppThreads has to be 1" );
xConfirmPara( m_ensureWppBitEqual, "ENABLE_WPP_PARALLELISM is disabled, cannot ensure being WPP bit-equal" );
#if SHARP_LUMA_DELTA_QP && ENABLE_QPA
xConfirmPara( m_bUsePerceptQPA && m_lumaLevelToDeltaQPMapping.mode >= 2, "QPA and SharpDeltaQP mode 2 cannot be used together" );
......@@ -4123,14 +4109,6 @@ void EncAppCfg::xPrintParameter()
if( m_MIP ) msg(VERBOSE, "FastMIP:%d ", m_useFastMIP);
msg( VERBOSE, "FastLocalDualTree:%d ", m_fastLocalDualTreeMode );
msg( VERBOSE, "NumSplitThreads:%d ", m_numSplitThreads );
if( m_numSplitThreads > 1 )
{
msg( VERBOSE, "ForceSingleSplitThread:%d ", m_forceSplitSequential );
}
msg( VERBOSE, "NumWppThreads:%d+%d ", m_numWppThreads, m_numWppExtraLines );
msg( VERBOSE, "EnsureWppBitEqual:%d ", m_ensureWppBitEqual );
if (m_resChangeInClvsEnabled)
{
msg( VERBOSE, "RPR:(%1.2lfx, %1.2lfx)|%d ", m_scalingRatioHor, m_scalingRatioVer, m_switchPocPeriod );
......
......@@ -398,13 +398,6 @@ protected:
bool m_useFastMIP;
int m_fastLocalDualTreeMode;
int m_numSplitThreads;
bool m_forceSplitSequential;
int m_numWppThreads;
int m_numWppExtraLines;
bool m_ensureWppBitEqual;
int m_log2MaxTbSize;
// coding tools (bit-depth)
int m_inputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input file
......
......@@ -101,16 +101,6 @@ int main(int argc, char* argv[])
#endif
#if ENABLE_TRACING
fprintf( stdout, "[ENABLE_TRACING] " );
#endif
#if ENABLE_SPLIT_PARALLELISM
fprintf( stdout, "[SPLIT_PARALLEL (%d jobs)]", PARL_SPLIT_MAX_NUM_JOBS );
#endif
#if ENABLE_SPLIT_PARALLELISM
const char* waitPolicy = getenv( "OMP_WAIT_POLICY" );
const char* maxThLim = getenv( "OMP_THREAD_LIMIT" );
fprintf( stdout, waitPolicy ? "[OMP: WAIT_POLICY=%s," : "[OMP: WAIT_POLICY=,", waitPolicy );
fprintf( stdout, maxThLim ? "THREAD_LIMIT=%s" : "THREAD_LIMIT=", maxThLim );
fprintf( stdout, "]" );
#endif
fprintf( stdout, "\n" );
......
......@@ -33,26 +33,6 @@ if( SET_ENABLE_TRACING )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
......
......@@ -33,26 +33,6 @@ if( SET_ENABLE_TRACING )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
......
......@@ -33,26 +33,6 @@ if( SET_ENABLE_TRACING )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
......
......@@ -64,28 +64,6 @@ if( SET_ENABLE_TRACING )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_TRACING=0 )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
target_include_directories( ${LIB_NAME} PUBLIC ${OpenMP_CXX_INCLUDE_DIRS} )
target_link_libraries( ${LIB_NAME} ${OpenMP_CXX_LIBRARIES} )
else()
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
target_include_directories( ${LIB_NAME} PUBLIC ../CommonLib/. ../CommonLib/.. ../CommonLib/x86 ../libmd5 )
target_link_libraries( ${LIB_NAME} Threads::Threads )
......
......@@ -62,28 +62,6 @@ if( SET_ENABLE_TRACING )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_TRACING=0 )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
target_include_directories( ${LIB_NAME} PUBLIC ${OpenMP_CXX_INCLUDE_DIRS} )
target_link_libraries( ${LIB_NAME} ${OpenMP_CXX_LIBRARIES} )
else()
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${LIB_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
target_include_directories( ${LIB_NAME} PUBLIC . .. ./x86 ../libmd5 )
target_link_libraries( ${LIB_NAME} Threads::Threads )
......
......@@ -549,10 +549,6 @@ CodingUnit& CodingStructure::addCU( const UnitArea &unit, const ChannelType chTy
if( prevCU )
{
prevCU->next = cu;
#if ENABLE_SPLIT_PARALLELISM
CHECK( prevCU->cacheId != cu->cacheId, "Inconsintent cacheId between previous and current CU" );
#endif
}
cus.push_back( cu );
......@@ -593,21 +589,12 @@ PredictionUnit& CodingStructure::addPU( const UnitArea &unit, const ChannelType
pu->cs = this;
pu->cu = m_isTuEnc ? cus[0] : getCU( unit.blocks[chType].pos(), chType );
pu->chType = chType;
#if ENABLE_SPLIT_PARALLELISM
CHECK( pu->cacheId != pu->cu->cacheId, "Inconsintent cacheId between the PU and assigned CU" );
CHECK( pu->cu->firstPU != nullptr, "Without an RQT the firstPU should be null" );
#endif
PredictionUnit *prevPU = m_numPUs > 0 ? pus.back() : nullptr;
if( prevPU && prevPU->cu == pu->cu )
{
prevPU->next = pu;
#if ENABLE_SPLIT_PARALLELISM
CHECK( prevPU->cacheId != pu->cacheId, "Inconsintent cacheId between previous and current PU" );
#endif
}
pus.push_back( pu );
......@@ -654,14 +641,6 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c
tu->cs = this;
tu->cu = m_isTuEnc ? cus[0] : getCU( unit.blocks[chType].pos(), chType );
tu->chType = chType;
#if ENABLE_SPLIT_PARALLELISM
if( tu->cu )
{
CHECK(tu->cacheId != tu->cu->cacheId, "Inconsintent cacheId between the TU and assigned CU");
}
#endif
TransformUnit *prevTU = m_numTUs > 0 ? tus.back() : nullptr;
......@@ -669,10 +648,6 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c
{
prevTU->next = tu;
tu->prev = prevTU;
#if ENABLE_SPLIT_PARALLELISM
CHECK( prevTU->cacheId != tu->cacheId, "Inconsintent cacheId between previous and current TU" );
#endif
}
tus.push_back( tu );
......
......@@ -680,16 +680,6 @@ static inline int ceilLog2(uint32_t x)
#define _UNIT_AREA_AT(_a,_x,_y,_w,_h)
#endif
#if ENABLE_SPLIT_PARALLELISM
#include <omp.h>
#define PARL_PARAM(DEF) , DEF
#define PARL_PARAM0(DEF) DEF
#else
#define PARL_PARAM(DEF)
#define PARL_PARAM0(DEF)
#endif
static const uint32_t CCALF_CANDS_COEFF_NR = 8;
static const int CCALF_SMALL_TAB[CCALF_CANDS_COEFF_NR] = { 0, 1, 2, 4, 8, 16, 32, 64 };
......
......@@ -438,12 +438,6 @@ private:
CtxStore<BinProbModel_Std> m_CtxStore_Std;
protected:
unsigned m_GRAdaptStats[RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS];
#if ENABLE_SPLIT_PARALLELISM
public:
int64_t cacheId;
bool cacheUsed;
#endif
};
......
......@@ -40,130 +40,6 @@
#include "ChromaFormat.h"
#include "CommonLib/InterpolationFilter.h"
#if ENABLE_SPLIT_PARALLELISM
int g_wppThreadId( 0 );
#pragma omp threadprivate(g_wppThreadId)
#if ENABLE_SPLIT_PARALLELISM
int g_splitThreadId( 0 );
#pragma omp threadprivate(g_splitThreadId)
int g_splitJobId( 0 );
#pragma omp threadprivate(g_splitJobId)
#endif
Scheduler::Scheduler() :
#if ENABLE_SPLIT_PARALLELISM
m_numSplitThreads( 1 )
#endif
{
}
Scheduler::~Scheduler()
{
}
#if ENABLE_SPLIT_PARALLELISM
unsigned Scheduler::getSplitDataId( int jobId ) const
{
if( m_numSplitThreads > 1 && m_hasParallelBuffer )
{
int splitJobId = jobId == CURR_THREAD_ID ? g_splitJobId : jobId;
return ( g_wppThreadId * NUM_RESERVERD_SPLIT_JOBS ) + splitJobId;
}
else
{
return 0;
}
}
unsigned Scheduler::getSplitPicId( int tId /*= CURR_THREAD_ID */ ) const
{
if( m_numSplitThreads > 1 && m_hasParallelBuffer )
{
int threadId = tId == CURR_THREAD_ID ? g_splitThreadId : tId;
return ( g_wppThreadId * m_numSplitThreads ) + threadId;
}
else
{
return 0;
}
}
unsigned Scheduler::getSplitJobId() const
{
if( m_numSplitThreads > 1 )
{
return g_splitJobId;
}
else
{
return 0;
}
}
void Scheduler::setSplitJobId( const int jobId )
{
CHECK( g_splitJobId != 0 && jobId != 0, "Need to reset the jobId after usage!" );
g_splitJobId = jobId;
}
void Scheduler::startParallel()
{
m_hasParallelBuffer = true;
}
void Scheduler::finishParallel()
{
m_hasParallelBuffer = false;
}
void Scheduler::setSplitThreadId( const int tId )
{
g_splitThreadId = tId == CURR_THREAD_ID ? omp_get_thread_num() : tId;
}
#endif
unsigned Scheduler::getDataId() const
{
#if ENABLE_SPLIT_PARALLELISM
if( m_numSplitThreads > 1 )
{
return getSplitDataId();
}
#endif
return 0;
}
bool Scheduler::init( const int ctuYsize, const int ctuXsize, const int numWppThreadsRunning, const int numWppExtraLines, const int numSplitThreads )
{
#if ENABLE_SPLIT_PARALLELISM
m_numSplitThreads = numSplitThreads;
#endif
return true;
}
int Scheduler::getNumPicInstances() const
{
#if !ENABLE_SPLIT_PARALLELISM
return 1;
#else
return ( m_numSplitThreads > 1 ? m_numSplitThreads : 1 );
#endif
}
#endif
// ---------------------------------------------------------------------------
// picture methods
// ---------------------------------------------------------------------------
......@@ -225,39 +101,34 @@ void Picture::create( const ChromaFormat &_chromaFormat, const Size &size, const
void Picture::destroy()
{
#if ENABLE_SPLIT_PARALLELISM
for( int jId = 0; jId < PARL_SPLIT_MAX_NUM_THREADS; jId++ )
#endif
for (uint32_t t = 0; t < NUM_PIC_TYPES; t++)
{