Skip to content

Commit

Permalink
Merge pull request #57 from adamjw24/develop_112
Browse files Browse the repository at this point in the history
Preparing 1.1.2
  • Loading branch information
K-os committed Jul 7, 2021
2 parents 5b09b77 + c9d3dbf commit 0c076a1
Show file tree
Hide file tree
Showing 31 changed files with 560 additions and 615 deletions.
27 changes: 14 additions & 13 deletions CMakeLists.txt
Expand Up @@ -10,7 +10,7 @@ if( NOT CMAKE_VERSION VERSION_LESS 3.12.0 )
endif()

# project name
project( vvdec VERSION 1.1.1 )
project( vvdec VERSION 1.1.2 )

set( VVDEC_ENABLE_X86_SIMD TRUE )
set( VVDEC_ENABLE_ARM_SIMD FALSE )
Expand Down Expand Up @@ -137,7 +137,7 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_SOURCE_DIR}/bin/mins
#if( CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" )
# set( VVDEC_ENABLE_ITT ON CACHE BOOL "Enable Intel Runtime Support for Profiling" )
#else()
# set( VVDEC_ENABLE_ITT OFF CACHE BOOL "Enable Intel Runtime Support for Profiling" )
set( VVDEC_ENABLE_ITT OFF CACHE BOOL "Enable Intel Runtime Support for Profiling" )
#endif()

# set default CMAKE_BUILD_TYPE to Release if not set
Expand Down Expand Up @@ -206,36 +206,37 @@ if( CCACHE_FOUND )
endif()

if( VVDEC_ENABLE_ITT )
# search for Intel VTune
if( MSVC )
set( ITT_PATH "c:/Program Files (x86)/IntelSWTools/VTune Amplifier/" CACHE STRING "Path to the installation directory of Intel VTunes" )
set( VVDEC_ITT_PATH "c:/Program Files (x86)/IntelSWTools/VTune Amplifier/" CACHE STRING "Path to the installation directory of Intel VTunes" )
elseif( APPLE )
message( WARNING "Not yet supported on Mac OS X" )
elseif( UNIX OR MINGW )
if( EXISTS "/opt/intel/vtune_profiler" )
set( ITT_PATH "/opt/intel/vtune_profiler" CACHE STRING "Path to the installation directory of Intel VTunes" )
set( VVDEC_ITT_PATH "/opt/intel/vtune_profiler" CACHE STRING "Path to the installation directory of Intel VTunes" )
else()
set( ITT_PATH "/opt/intel/vtune_amplifier" CACHE STRING "Path to the installation directory of Intel VTunes" )
set( VVDEC_ITT_PATH "/opt/intel/vtune_amplifier" CACHE STRING "Path to the installation directory of Intel VTunes" )
endif()
endif()

if( EXISTS ${ITT_PATH} )
set( LIB_NAME INTEL_ITT )
add_library( ${LIB_NAME} STATIC IMPORTED GLOBAL )
if( EXISTS ${VVDEC_ITT_PATH}/lib64 AND EXISTS ${VVDEC_ITT_PATH}/include )
set( INTEL_ITT_LINK_TARGET INTEL_ITT )
add_library( ${INTEL_ITT_LINK_TARGET} STATIC IMPORTED GLOBAL )
if( MSVC )
set_target_properties( ${LIB_NAME} PROPERTIES IMPORTED_LOCATION ${ITT_PATH}/lib64/libittnotify.lib )
set_target_properties( ${INTEL_ITT_LINK_TARGET} PROPERTIES IMPORTED_LOCATION ${VVDEC_ITT_PATH}/lib64/libittnotify.lib )
elseif( APPLE )
# not supported
elseif( UNIX OR MINGW )
set_target_properties( ${LIB_NAME} PROPERTIES IMPORTED_LOCATION ${ITT_PATH}/lib64/libittnotify.a )
set_target_properties( ${LIB_NAME} PROPERTIES INTERFACE_LINK_LIBRARIES dl )
set_target_properties( ${INTEL_ITT_LINK_TARGET} PROPERTIES IMPORTED_LOCATION ${VVDEC_ITT_PATH}/lib64/libittnotify.a )
set_target_properties( ${INTEL_ITT_LINK_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES dl )
endif()

# set include directory. relative paths do not work.
set_target_properties( ${LIB_NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${ITT_PATH}/include )
set_target_properties( ${INTEL_ITT_LINK_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${VVDEC_ITT_PATH}/include )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTRACE_ENABLE_ITT" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRACE_ENABLE_ITT" )
else()
message( WARNING "ITT_PATH ${ITT_PATH} not found, ignoring option VVCLib_ENABLE_ITT" )
message( WARNING "VVDEC_ITT_PATH ${VVDEC_ITT_PATH} not found, ignoring option VVDEC_ENABLE_ITT" )
endif()
endif()

Expand Down
12 changes: 12 additions & 0 deletions source/App/vvdecapp/CmdLineParser.h
Expand Up @@ -92,6 +92,7 @@ class CmdLineParser
"\n"
"\t\t [--loops,-L <int> ] : number of decoder loops (default: 0, -1 endless)\n"
"\t\t [--verbosity,-v <int> ] : verbosity level (0: silent, 1: error, 2: warning, 3: info, 4: notice: 5, verbose, 6: debug) (default: " << (int)rcParams.logLevel << ")\n"
"\t\t [--version ] : show version\n"
"\t\t [--help,-h ] : show help\n"
"\n" ;
std::cout << std::endl;
Expand Down Expand Up @@ -140,6 +141,12 @@ class CmdLineParser
iRet = 2;
return iRet;
}
else if( !strcmp( (const char*)argv[i_arg], "--version" ) )
{
i_arg++;
iRet = 3;
return iRet;
}
else
{
i_arg++;
Expand Down Expand Up @@ -263,6 +270,11 @@ class CmdLineParser
// already processed
i_arg++;
}
else if( !strcmp( (const char*)argv[i_arg], "--version" ) )
{
// already processed
i_arg++;
}
else if( !strcmp( ( const char* ) argv[i_arg], "--simd" ) )
{
if( i_arg == argc-1 ){ fprintf( stderr, " - missing argument for: %s \n", argv[i_arg] ); return -1; }
Expand Down
5 changes: 5 additions & 0 deletions source/App/vvdecapp/vvdecapp.cpp
Expand Up @@ -119,6 +119,11 @@ int main( int argc, char* argv[] )
vvdecoderapp::CmdLineParser::print_usage( cAppname, params);
return 0;
}
else if( iRet == 3 )
{
std::cout << cAppname << " version " << vvdec_get_version()<< std::endl;
return 0;
}

std::cerr << "vvdecapp [error]: cannot parse command line. run vvdecapp --help to see available options" << std::endl;
return -1;
Expand Down
8 changes: 4 additions & 4 deletions source/Lib/CommonLib/Buffer.cpp
Expand Up @@ -706,8 +706,8 @@ void PelStorage::create( const ChromaFormat _chromaFormat, const Size& _size, co
}

#endif
unsigned totalWidth = scaledWidth + 2 * xmargin;
unsigned totalHeight = scaledHeight +2 * ymargin;
SizeType totalWidth = scaledWidth + 2 * xmargin;
SizeType totalHeight = scaledHeight +2 * ymargin;

if( _alignment )
{
Expand Down Expand Up @@ -784,7 +784,7 @@ const CPelBuf PelStorage::getBuf( const ComponentID CompID ) const

PelBuf PelStorage::getBuf( const CompArea &blk )
{
const PelBuf& r = bufs[blk.compID];
const PelBuf& r = bufs[blk.compID()];

CHECKD( rsAddr( blk.bottomRight(), r.stride ) >= ( ( r.height - 1 ) * r.stride + r.width ), "Trying to access a buf outside of bound!" );

Expand All @@ -793,7 +793,7 @@ PelBuf PelStorage::getBuf( const CompArea &blk )

const CPelBuf PelStorage::getBuf( const CompArea &blk ) const
{
const PelBuf& r = bufs[blk.compID];
const PelBuf& r = bufs[blk.compID()];
return CPelBuf( r.buf + rsAddr( blk, r.stride ), r.stride, blk );
}

Expand Down
71 changes: 38 additions & 33 deletions source/Lib/CommonLib/CodingStructure.cpp
Expand Up @@ -78,6 +78,7 @@ CodingStructure::CodingStructure(std::shared_ptr<CUCache> cuCache, std::shared_p
, picture ( nullptr )
, m_ctuData ( nullptr )
, m_ctuDataSize( 0 )
, m_predBufSize ( 0 )
, m_dmvrMvCache ( nullptr )
, m_dmvrMvCacheSize( 0 )
, m_cuCache ( cuCache )
Expand Down Expand Up @@ -113,6 +114,12 @@ void CodingStructure::destroy()
m_ctuData = nullptr;
m_ctuDataSize = 0;
}

if( m_predBuf )
{
m_predBuf.reset();
m_predBufSize = 0;
}
}

CodingUnit& CodingStructure::addCU( const UnitArea &unit, const ChannelType chType, const TreeType treeType, const ModeType modeType, const CodingUnit *cuLeft, const CodingUnit *cuAbove )
Expand Down Expand Up @@ -146,6 +153,8 @@ CodingUnit& CodingStructure::addCU( const UnitArea &unit, const ChannelType chTy
CtuData& ctuData = getCtuData( currRsAddr );
cu->ctuData = &ctuData;

cu->predBuf = m_predBuf.get() + m_predBufOffset;

for( uint32_t i = 0; i < numCh; i++ )
{
if( !cu->blocks[i].valid() )
Expand All @@ -157,15 +166,11 @@ CodingUnit& CodingStructure::addCU( const UnitArea &unit, const ChannelType chTy

if( i )
{
cu->predBuf[1] = m_predBuf[1];
m_predBuf [1] += cuArea;
cu->predBuf[2] = m_predBuf[2];
m_predBuf [2] += cuArea;
m_predBufOffset += ( cuArea << 1 );
}
else
{
cu->predBuf[0] = m_predBuf[0];
m_predBuf [0] += cuArea;
m_predBufOffset += cuArea;
}

const ptrdiff_t stride = ptrdiff_t( 1 ) << m_ctuWidthLog2[i];
Expand Down Expand Up @@ -218,7 +223,7 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c

tu->idx = ++m_numTUs;
tu->cu = &cu;
tu->chType = chType;
tu->setChType ( chType );
tu->UnitArea::operator=( unit );

return *tu;
Expand Down Expand Up @@ -299,6 +304,13 @@ void CodingStructure::createInternals( const UnitArea& _unit )
m_dmvrMvCacheSize = _maxNumDmvrMvs;
m_dmvrMvCache = ( Mv* ) malloc( sizeof( Mv ) * _maxNumDmvrMvs );
}

size_t predBufSize = area.Y().area() + ( isChromaEnabled( _unit.chromaFormat ) ? ( area.Cb().area() + area.Cr().area() ) : 0 );
if( predBufSize != m_predBufSize )
{
m_predBuf.reset( (Pel*) xMalloc( Pel, predBufSize ) );
m_predBufSize = predBufSize;
}
}


Expand All @@ -308,8 +320,6 @@ void CodingStructure::rebindPicBufs()
else m_reco.destroy();
if( !picture->m_bufs[PIC_RECON_WRAP ].bufs.empty() ) m_rec_wrap.createFromBuf( picture->m_bufs[PIC_RECON_WRAP] );
else m_rec_wrap.destroy();
if( !picture->m_bufs[PIC_PREDICTION ].bufs.empty() ) m_pred.createFromBuf( picture->m_bufs[PIC_PREDICTION] );
else m_pred.destroy();
}

void CodingStructure::initStructData()
Expand Down Expand Up @@ -344,12 +354,7 @@ void CodingStructure::initStructData()

m_dmvrMvCacheOffset = 0;

m_predBuf[0] = m_pred.bufs[0].buf;
if( isChromaEnabled( area.chromaFormat ) )
{
m_predBuf[1] = m_pred.bufs[1].buf;
m_predBuf[2] = m_pred.bufs[2].buf;
}
m_predBufOffset = 0;
}

MotionBuf CodingStructure::getMotionBuf( const Area& _area )
Expand Down Expand Up @@ -380,28 +385,28 @@ PelUnitBuf CodingStructure::getPredBuf(const CodingUnit &unit)

if( unit.Y().valid() )
{
ret.bufs[0].buf = unit.predBuf[0];
ret.bufs[0].stride = unit.blocks [0].width;
ret.bufs[0].width = unit.blocks [0].width;
ret.bufs[0].height = unit.blocks [0].height;
ret.bufs[0].buf = unit.predBuf;
ret.bufs[0].stride = unit.blocks[0].width;
ret.bufs[0].width = unit.blocks[0].width;
ret.bufs[0].height = unit.blocks[0].height;
}

if( isChromaEnabled( unit.chromaFormat ) )
{
if( unit.Cb().valid() )
{
ret.bufs[1].buf = unit.predBuf[1];
ret.bufs[1].stride = unit.blocks [1].width;
ret.bufs[1].width = unit.blocks [1].width;
ret.bufs[1].height = unit.blocks [1].height;
ret.bufs[1].buf = unit.predBuf + unit.Y().area();
ret.bufs[1].stride = unit.blocks[1].width;
ret.bufs[1].width = unit.blocks[1].width;
ret.bufs[1].height = unit.blocks[1].height;
}

if( unit.Cr().valid() )
{
ret.bufs[2].buf = unit.predBuf[2];
ret.bufs[2].stride = unit.blocks [2].width;
ret.bufs[2].width = unit.blocks [2].width;
ret.bufs[2].height = unit.blocks [2].height;
ret.bufs[2].buf = unit.predBuf + unit.Y().area() + unit.Cb().area();
ret.bufs[2].stride = unit.blocks[2].width;
ret.bufs[2].width = unit.blocks[2].width;
ret.bufs[2].height = unit.blocks[2].height;
}
}

Expand All @@ -416,23 +421,23 @@ const CPelUnitBuf CodingStructure::getPredBuf(const CodingUnit &unit) const

if( unit.Y().valid() )
{
ret.bufs[0].buf = unit.predBuf[0];
ret.bufs[0].buf = unit.predBuf;
ret.bufs[0].stride = unit.blocks[0].width;
ret.bufs[0].width = unit.blocks[0].width;
ret.bufs[0].height = unit.blocks[0].height;
}

if( unit.Cb().valid() )
{
ret.bufs[1].buf = unit.predBuf[1];
ret.bufs[1].buf = unit.predBuf + unit.Y().area();
ret.bufs[1].stride = unit.blocks[1].width;
ret.bufs[1].width = unit.blocks[1].width;
ret.bufs[1].height = unit.blocks[1].height;
}

if( unit.Cr().valid() )
{
ret.bufs[2].buf = unit.predBuf[2];
ret.bufs[2].buf = unit.predBuf + unit.Y().area() + unit.Cb().area();
ret.bufs[2].stride = unit.blocks[2].width;
ret.bufs[2].width = unit.blocks[2].width;
ret.bufs[2].height = unit.blocks[2].height;
Expand Down Expand Up @@ -527,12 +532,12 @@ void CodingStructure::fillIBCbuffer( CodingUnit &cu, int lineIdx )
continue;

const unsigned int lcuWidth = sps->getMaxCUWidth();
const int shiftSampleHor = getComponentScaleX(area.compID, cu.chromaFormat);
const int shiftSampleVer = getComponentScaleY(area.compID, cu.chromaFormat);
const int shiftSampleHor = getComponentScaleX(area.compID(), cu.chromaFormat);
const int shiftSampleVer = getComponentScaleY(area.compID(), cu.chromaFormat);
const int ctuSizeVerLog2 = getLog2(lcuWidth) - shiftSampleVer;
const int pux = area.x & ((m_IBCBufferWidth >> shiftSampleHor) - 1);
const int puy = area.y & (( 1 << ctuSizeVerLog2 ) - 1);
const CompArea dstArea = CompArea(area.compID, Position(pux, puy), Size(area.width, area.height));
const CompArea dstArea = CompArea(area.compID(), Position(pux, puy), Size(area.width, area.height));
CPelBuf srcBuf = getRecoBuf(area);
PelBuf dstBuf = m_virtualIBCbuf[lineIdx].getBuf(dstArea);

Expand Down
10 changes: 5 additions & 5 deletions source/Lib/CommonLib/CodingStructure.h
Expand Up @@ -67,7 +67,6 @@ enum PictureType
{
PIC_RECONSTRUCTION,
PIC_RECON_WRAP,
PIC_PREDICTION,
NUM_PIC_TYPES
};

Expand Down Expand Up @@ -169,8 +168,9 @@ class CodingStructure
void createInternals(const UnitArea& _unit);

private:

Pel* m_predBuf [MAX_NUM_COMPONENT];
std::unique_ptr<Pel[], AlignedDeleter<Pel>> m_predBuf;
ptrdiff_t m_predBufOffset;
ptrdiff_t m_predBufSize;

Mv* m_dmvrMvCache;
size_t m_dmvrMvCacheSize;
Expand Down Expand Up @@ -234,8 +234,8 @@ class CodingStructure

public:

PelBuf getRecoBuf(const CompArea &blk) { return m_reco.bufs[blk.compID].subBuf( blk ); }
const CPelBuf getRecoBuf(const CompArea &blk) const { return m_reco.bufs[blk.compID].subBuf( blk ); }
PelBuf getRecoBuf(const CompArea &blk) { return m_reco.bufs[blk.compID()].subBuf( blk ); }
const CPelBuf getRecoBuf(const CompArea &blk) const { return m_reco.bufs[blk.compID()].subBuf( blk ); }
PelUnitBuf getRecoBuf(const UnitArea &unit) { return m_reco.subBuf( unit ); }
const CPelUnitBuf getRecoBuf(const UnitArea &unit) const { return m_reco.subBuf( unit ); }

Expand Down

0 comments on commit 0c076a1

Please sign in to comment.