Skip to content

Commit

Permalink
Many fixes, 8-bit enc. fixes, RC and capping improvements, proper con…
Browse files Browse the repository at this point in the history
…formance window setting, minor improvements (#312)
  • Loading branch information
adamjw24 authored Aug 31, 2023
1 parent 4773e34 commit 19efe30
Show file tree
Hide file tree
Showing 37 changed files with 850 additions and 607 deletions.
48 changes: 23 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# VVCEnc/Makefile
# VVenC/Makefile
#
# How to build a single target:
# make <project>-r => build variant=release
Expand Down Expand Up @@ -163,22 +163,22 @@ DEFAULT_BUILD_TARGETS_SHARED := $(foreach t,$(DEFAULT_BUILD_TARGETS_STATIC),$(t)
DEFAULT_BUILD_TARGETS := $(DEFAULT_BUILD_TARGETS_STATIC) $(DEFAULT_BUILD_TARGETS_SHARED)


release: $(BUILD_DIR-release)
release: $(BUILD_DIR-release)/CMakeCache.txt
cmake $(BUILD_OPTIONS-$@) $(BUILD_JOBS) $(BUILD_TOOL_OPTIONS)

debug: $(BUILD_DIR-debug)
debug: $(BUILD_DIR-debug)/CMakeCache.txt
cmake $(BUILD_OPTIONS-$@) $(BUILD_JOBS) $(BUILD_TOOL_OPTIONS)

relwithdebinfo: $(BUILD_DIR-relwithdebinfo)
relwithdebinfo: $(BUILD_DIR-relwithdebinfo)/CMakeCache.txt
cmake $(BUILD_OPTIONS-$@) $(BUILD_JOBS) $(BUILD_TOOL_OPTIONS)

release-shared: $(BUILD_DIR-release-shared)
release-shared: $(BUILD_DIR-release-shared)/CMakeCache.txt
cmake $(BUILD_OPTIONS-$@) $(BUILD_JOBS) $(BUILD_TOOL_OPTIONS)

debug-shared: $(BUILD_DIR-debug-shared)
debug-shared: $(BUILD_DIR-debug-shared)/CMakeCache.txt
cmake $(BUILD_OPTIONS-$@) $(BUILD_JOBS) $(BUILD_TOOL_OPTIONS)

relwithdebinfo-shared: $(BUILD_DIR-relwithdebinfo-shared)
relwithdebinfo-shared: $(BUILD_DIR-relwithdebinfo-shared)/CMakeCache.txt
cmake $(BUILD_OPTIONS-$@) $(BUILD_JOBS) $(BUILD_TOOL_OPTIONS)

$(foreach t,$(DEFAULT_BUILD_TARGETS),clean-$(t)):
Expand All @@ -204,37 +204,37 @@ install-relwithdebinfo-shared: relwithdebinfo-shared


ifeq ($(CMAKE_MCONFIG),)
$(BUILD_DIR-release) configure-release:
$(BUILD_DIR-release)/CMakeCache.txt configure-release:
cmake -S . -B $(BUILD_DIR-release) $(CONFIG_OPTIONS) -DCMAKE_BUILD_TYPE=Release

$(BUILD_DIR-debug) configure-debug:
$(BUILD_DIR-debug)/CMakeCache.txt configure-debug:
cmake -S . -B $(BUILD_DIR-debug) $(CONFIG_OPTIONS) -DCMAKE_BUILD_TYPE=Debug

$(BUILD_DIR-relwithdebinfo) configure-relwithdebinfo:
$(BUILD_DIR-relwithdebinfo)/CMakeCache.txt configure-relwithdebinfo:
cmake -S . -B $(BUILD_DIR-relwithdebinfo) $(CONFIG_OPTIONS) -DCMAKE_BUILD_TYPE=RelWithDebInfo

$(BUILD_DIR-release-shared) configure-release-shared:
$(BUILD_DIR-release-shared)/CMakeCache.txt configure-release-shared:
cmake -S . -B $(BUILD_DIR-release-shared) $(CONFIG_OPTIONS) -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1

$(BUILD_DIR-debug-shared) configure-debug-shared:
$(BUILD_DIR-debug-shared)/CMakeCache.txt configure-debug-shared:
cmake -S . -B $(BUILD_DIR-debug-shared) $(CONFIG_OPTIONS) -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=1

$(BUILD_DIR-relwithdebinfo-shared) configure-relwithdebinfo-shared:
$(BUILD_DIR-relwithdebinfo-shared)/CMakeCache.txt configure-relwithdebinfo-shared:
cmake -S . -B $(BUILD_DIR-relwithdebinfo-shared) $(CONFIG_OPTIONS) -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=1

configure-static: $(foreach t,$(DEFAULT_BUILD_TARGETS_STATIC),configure-$(t))
configure-shared: $(foreach t,$(DEFAULT_BUILD_TARGETS_SHARED),configure-$(t))

else
$(BUILD_DIR_STATIC) configure-static $(foreach t,$(DEFAULT_BUILD_TARGETS_STATIC),configure-$(t)):
$(BUILD_DIR_STATIC)/CMakeCache.txt configure-static $(foreach t,$(DEFAULT_BUILD_TARGETS_STATIC),configure-$(t)):
cmake -S . -B $(BUILD_DIR_STATIC) $(CONFIG_OPTIONS)

$(BUILD_DIR_SHARED) configure-shared $(foreach t,$(DEFAULT_BUILD_TARGETS_SHARED),configure-$(t)):
$(BUILD_DIR_SHARED)/CMakeCache.txt configure-shared $(foreach t,$(DEFAULT_BUILD_TARGETS_SHARED),configure-$(t)):
cmake -S . -B $(BUILD_DIR_SHARED) $(CONFIG_OPTIONS) -DBUILD_SHARED_LIBS=1
endif

static: $(DEFAULT_BUILD_TARGETS_STATIC)
shared: $(DEFAULT_BUILD_TARGETS_SHARED)
shared: $(DEFAULT_BUILD_TARGETS_SHARED)

all: static shared

Expand Down Expand Up @@ -303,26 +303,24 @@ TARGETS_RELEASE_CLEAN_FIRST := $(foreach t,$(TARGETS),$(t)-cr)
TARGETS_DEBUG_CLEAN_FIRST := $(foreach t,$(TARGETS),$(t)-cd)
TARGETS_RELWITHDEBINFO_CLEAN_FIRST := $(foreach t,$(TARGETS),$(t)-cp)

$(TARGETS_RELEASE): $(BUILD_DIR-release)
$(TARGETS_RELEASE): $(BUILD_DIR-release)/CMakeCache.txt
cmake $(BUILD_OPTIONS-release) $(BUILD_JOBS) --target $(patsubst %-r,%,$@) $(BUILD_TOOL_OPTIONS)

$(TARGETS_RELEASE_CLEAN_FIRST): $(BUILD_DIR-release)
$(TARGETS_RELEASE_CLEAN_FIRST): $(BUILD_DIR-release)/CMakeCache.txt
cmake $(BUILD_OPTIONS-release) $(BUILD_JOBS) --clean-first --target $(patsubst %-cr,%,$@) $(BUILD_TOOL_OPTIONS)

$(TARGETS_DEBUG): $(BUILD_DIR-debug)
$(TARGETS_DEBUG): $(BUILD_DIR-debug)/CMakeCache.txt
cmake $(BUILD_OPTIONS-debug) $(BUILD_JOBS) --target $(patsubst %-d,%,$@) $(BUILD_TOOL_OPTIONS)

$(TARGETS_DEBUG_CLEAN_FIRST): $(BUILD_DIR-debug)
$(TARGETS_DEBUG_CLEAN_FIRST): $(BUILD_DIR-debug)/CMakeCache.txt
cmake $(BUILD_OPTIONS-debug) $(BUILD_JOBS) --clean-first --target $(patsubst %-cd,%,$@) $(BUILD_TOOL_OPTIONS)

$(TARGETS_RELWITHDEBINFO): $(BUILD_DIR-relwithdebinfo)
$(TARGETS_RELWITHDEBINFO): $(BUILD_DIR-relwithdebinfo)/CMakeCache.txt
cmake $(BUILD_OPTIONS-relwithdebinfo) $(BUILD_JOBS) --target $(patsubst %-p,%,$@) $(BUILD_TOOL_OPTIONS)

$(TARGETS_RELWITHDEBINFO_CLEAN_FIRST): $(BUILD_DIR-relwithdebinfo)
$(TARGETS_RELWITHDEBINFO_CLEAN_FIRST): $(BUILD_DIR-relwithdebinfo)/CMakeCache.txt
cmake $(BUILD_OPTIONS-relwithdebinfo) $(BUILD_JOBS) --clean-first --target $(patsubst %-cp,%,$@) $(BUILD_TOOL_OPTIONS)

.PHONY: install
.PHONY: install clean realclean distclean

ifeq ($(OS),Windows_NT)
.NOTPARALLEL:
endif
4 changes: 2 additions & 2 deletions include/vvenc/vvencCfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ typedef struct vvenc_config
int m_cfgUnused4[ 7 ]; // TODO: remove unused memory from configuration
int m_cfgUnused5[ 7 ];
int m_cfgUnused6;
int m_cfgUnused7;
int m_cfgUnused8;
int m_maxPicWidth;
int m_maxPicHeight;

bool m_useSameChromaQPTables;
vvencChromaQpMappingTableParams m_chromaQpMappingTableParams;
Expand Down
1 change: 1 addition & 0 deletions source/App/vvencFFapp/EncApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ int EncApp::encode()

apputils::Stats cStats;
int64_t frameCount = apputils::VVEncAppCfg::getFrameCount( appCfg.m_inputFileName, vvencCfg.m_SourceWidth, vvencCfg.m_SourceHeight, vvencCfg.m_inputBitDepth[0], appCfg.m_packedYUVInput );
frameCount = std::max<int64_t>( 0, frameCount-appCfg.m_FrameSkip );
int64_t framesToEncode = (vvencCfg.m_framesToBeEncoded == 0 || vvencCfg.m_framesToBeEncoded >= frameCount) ? frameCount : vvencCfg.m_framesToBeEncoded;
cStats.init( vvencCfg.m_FrameRate, vvencCfg.m_FrameScale, (int)framesToEncode, "vvenc [info]: " );
bool statsInfoReady = false;
Expand Down
1 change: 1 addition & 0 deletions source/App/vvencapp/vvencapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ int main( int argc, char* argv[] )
}

int64_t frameCount = apputils::VVEncAppCfg::getFrameCount( vvencappCfg.m_inputFileName, vvenccfg.m_SourceWidth, vvenccfg.m_SourceHeight, vvenccfg.m_inputBitDepth[0], vvencappCfg.m_packedYUVInput );
frameCount = std::max<int64_t>( 0, frameCount-vvencappCfg.m_FrameSkip );
int64_t framesToEncode = (vvenccfg.m_framesToBeEncoded == 0 || vvenccfg.m_framesToBeEncoded >= frameCount) ? frameCount : vvenccfg.m_framesToBeEncoded;

apputils::Stats cStats;
Expand Down
12 changes: 7 additions & 5 deletions source/Lib/CommonLib/AffineGradientSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ namespace vvenc {
AffineGradientSearch::AffineGradientSearch()
{
m_HorizontalSobelFilter = xHorizontalSobelFilter;
m_VerticalSobelFilter = xVerticalSobelFilter;
m_EqualCoeffComputer = xEqualCoeffComputer;
m_VerticalSobelFilter = xVerticalSobelFilter;
m_EqualCoeffComputer[0] = xEqualCoeffComputer<false>;
m_EqualCoeffComputer[1] = xEqualCoeffComputer<true>;

#if ENABLE_SIMD_OPT_AFFINE_ME
#ifdef TARGET_SIMD_X86
Expand All @@ -74,7 +75,7 @@ namespace vvenc {
#endif
}

void AffineGradientSearch::xHorizontalSobelFilter(Pel* const pPred, const int predStride, int *const pDerivate, const int derivateBufStride, const int width, const int height)
void AffineGradientSearch::xHorizontalSobelFilter(Pel* const pPred, const int predStride, Pel *const pDerivate, const int derivateBufStride, const int width, const int height)
{
for (int j = 1; j < height - 1; j++)
{
Expand Down Expand Up @@ -106,7 +107,7 @@ namespace vvenc {
}
}

void AffineGradientSearch::xVerticalSobelFilter(Pel* const pPred, const int predStride, int *const pDerivate, const int derivateBufStride, const int width, const int height)
void AffineGradientSearch::xVerticalSobelFilter(Pel* const pPred, const int predStride, Pel *const pDerivate, const int derivateBufStride, const int width, const int height)
{
for (int k = 1; k < width - 1; k++)
{
Expand Down Expand Up @@ -139,7 +140,8 @@ namespace vvenc {
}
}

void AffineGradientSearch::xEqualCoeffComputer(Pel* pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t(*pEqualCoeff)[7], int width, int height, bool b6Param)
template<bool b6Param>
void AffineGradientSearch::xEqualCoeffComputer(Pel* const pResidue, const int residueStride, Pel **const ppDerivate, const int derivateBufStride, const int width, const int height, int64_t(*pEqualCoeff)[7])
{
int affineParamNum = b6Param ? 6 : 4;

Expand Down
15 changes: 8 additions & 7 deletions source/Lib/CommonLib/AffineGradientSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ namespace vvenc {
class AffineGradientSearch
{
public:
void (*m_HorizontalSobelFilter) (Pel* const pPred, const int predStride, int *const pDerivate, const int derivateBufStride, const int width, const int height);
void (*m_VerticalSobelFilter) (Pel* const pPred, const int predStride, int *const pDerivate, const int derivateBufStride, const int width, const int height);
void (*m_EqualCoeffComputer) (Pel* pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t(*pEqualCoeff)[7], int width, int height, bool b6Param);

static void xHorizontalSobelFilter( Pel* const pPred, const int predStride, int *const pDerivate, const int derivateBufStride, const int width, const int height);
static void xVerticalSobelFilter ( Pel* const pPred, const int predStride, int *const pDerivate, const int derivateBufStride, const int width, const int height);
static void xEqualCoeffComputer ( Pel* pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t(*pEqualCoeff)[7], int width, int height, bool b6Param);
void (*m_HorizontalSobelFilter) (Pel* const pPred, const int predStride, Pel *const pDerivate, const int derivateBufStride, const int width, const int height);
void (*m_VerticalSobelFilter) (Pel* const pPred, const int predStride, Pel *const pDerivate, const int derivateBufStride, const int width, const int height);
void (*m_EqualCoeffComputer[2]) (Pel* const pResi, const int resiStride, Pel **const ppDerivate, const int derivateBufStride, const int width, const int height, int64_t(*pEqualCoeff)[7]);

static void xHorizontalSobelFilter( Pel* const pPred, const int predStride, Pel *const pDerivate, const int derivateBufStride, const int width, const int height);
static void xVerticalSobelFilter ( Pel* const pPred, const int predStride, Pel *const pDerivate, const int derivateBufStride, const int width, const int height);
template<bool b6Param>
static void xEqualCoeffComputer ( Pel* const pResi, const int resiStride, Pel **const ppDerivate, const int derivateBufStride, const int width, const int height, int64_t(*pEqualCoeff)[7]);

AffineGradientSearch();
~AffineGradientSearch() {}
Expand Down
2 changes: 1 addition & 1 deletion source/Lib/CommonLib/DepQuant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ DepQuant::~DepQuant()

void DepQuant::quant( TransformUnit& tu, const ComponentID compID, const CCoeffBuf& pSrc, TCoeff& uiAbsSum, const QpParam& cQP, const Ctx& ctx )
{
if( tu.cs->picture->useScSelectiveRdoq && !xNeedRDOQ( tu, compID, pSrc, cQP ) )
if( tu.cs->picture->useSelectiveRdoq && !xNeedRDOQ( tu, compID, pSrc, cQP ) )
{
tu.lastPos[compID] = -1;
uiAbsSum = 0;
Expand Down
Loading

0 comments on commit 19efe30

Please sign in to comment.