Skip to content

Commit

Permalink
Merge pull request #151 from fraunhoferhhi/prepare_v211
Browse files Browse the repository at this point in the history
Prepare for v2.1.1
  • Loading branch information
adamjw24 authored Aug 10, 2023
2 parents 5b31cd4 + 486fc43 commit b306b5a
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 377 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake_minimum_required( VERSION 3.12.0 FATAL_ERROR )
cmake_policy( VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} )

# project name
project( vvdec VERSION 2.1.0 )
project( vvdec VERSION 2.1.1 )
# set alternative version numbering for release candidates
#set( PROJECT_VERSION_RC rc1 )
if( PROJECT_VERSION_RC )
Expand Down Expand Up @@ -64,7 +64,7 @@ if( VVDEC_ENABLE_X86_SIMD OR VVDEC_ENABLE_ARM_SIMD )
if( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "armv7|arm.*eabi"
OR "${CMAKE_CXX_COMPILER}" MATCHES "armv7|arm.*eabi"
OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "armv7" )
message( WARNING "You are building for armv7 which is knnow to be broken. As a workaround, disable SIMD at runtime or build with VVDEC_ENABLE_X86_SIMD=0 and VVDEC_ENABLE_ARM_SIMD=0." )
message( WARNING "You are building for armv7 which is known to be broken. As a workaround, disable SIMD at runtime or build with VVDEC_ENABLE_X86_SIMD=0 and VVDEC_ENABLE_ARM_SIMD=0." )
endif()
endif()

Expand Down
49 changes: 23 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# make <project>-cp => clean + build variant=relwithdebinfo
#

TARGETS := vvdec vvdecapp
TARGETS := vvdec vvdecapp


ifneq ($(g),)
Expand Down Expand Up @@ -172,22 +172,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 @@ -213,37 +213,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 @@ -310,27 +310,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

2 changes: 1 addition & 1 deletion include/vvdec/vvdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ typedef struct vvdecPicAttributes
vvdecSliceType sliceType; // slice type (I/P/B) */
bool isRefPic; // reference picture
uint32_t temporalLayer; // temporal layer
uint64_t poc; // picture order count
int64_t poc; // picture order count
uint32_t bits; // bits of the compr. image packet
vvdecVui *vui; // if available, pointer to VUI (Video Usability Information)
vvdecHrd *hrd; // if available, pointer to HRD (Hypothetical Reference Decoder)
Expand Down
135 changes: 45 additions & 90 deletions source/Lib/CommonLib/InterPrediction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2065,119 +2065,74 @@ void InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,
{
const bool rndRes = !bi;

int shiftHor = MV_FRACTIONAL_BITS_INTERNAL + getComponentScaleX( compID, chFmt );
int shiftVer = MV_FRACTIONAL_BITS_INTERNAL + getComponentScaleY( compID, chFmt );
const int csx = getComponentScaleX( compID, chFmt );
const int csy = getComponentScaleY( compID, chFmt );

int width = dstWidth;
int height = dstHeight;
CPelBuf refBuf;
int shiftHor = MV_FRACTIONAL_BITS_INTERNAL + csx;
int shiftVer = MV_FRACTIONAL_BITS_INTERNAL + csy;

int width = dstWidth;
int height = dstHeight;

CPelBuf refBuf;
const Pel* refPtr;
ptrdiff_t refStride;

int row, col;

int refPicWidth = refPic->lwidth();
int refPicWidth = refPic->lwidth();
int refPicHeight = refPic->lheight();

int xFilter = filterIndex;
int yFilter = filterIndex;
const int rprThreshold1 = ( 1 << SCALE_RATIO_BITS ) * 5 / 4;
const int rprThreshold2 = ( 1 << SCALE_RATIO_BITS ) * 7 / 4;
if( filterIndex == 0 )
{
if( scalingRatio.first > rprThreshold2 )
{
xFilter = 4;
}
else if( scalingRatio.first > rprThreshold1 )
{
xFilter = 3;
}

if( scalingRatio.second > rprThreshold2 )
{
yFilter = 4;
}
else if( scalingRatio.second > rprThreshold1 )
{
yFilter = 3;
}
}
if (filterIndex == 2)
{
if (isLuma(compID))
{
if (scalingRatio.first > rprThreshold2)
{
xFilter = 6;
}
else if (scalingRatio.first > rprThreshold1)
{
xFilter = 5;
}
static constexpr int rprThreshold1 = ( 1 << SCALE_RATIO_BITS ) * 5 / 4;
static constexpr int rprThreshold2 = ( 1 << SCALE_RATIO_BITS ) * 7 / 4;

if (scalingRatio.second > rprThreshold2)
{
yFilter = 6;
}
else if (scalingRatio.second > rprThreshold1)
{
yFilter = 5;
}
}
else
{
if (scalingRatio.first > rprThreshold2)
{
xFilter = 4;
}
else if (scalingRatio.first > rprThreshold1)
{
xFilter = 3;
}
if ( scalingRatio.first > rprThreshold2 ) xFilter = 4;
else if( scalingRatio.first > rprThreshold1 ) xFilter = 3;

if (scalingRatio.second > rprThreshold2)
{
yFilter = 4;
}
else if (scalingRatio.second > rprThreshold1)
{
yFilter = 3;
}
}
if ( scalingRatio.second > rprThreshold2 ) yFilter = 4;
else if( scalingRatio.second > rprThreshold1 ) yFilter = 3;

if( isLuma( compID ) && filterIndex == 2 )
{
if( scalingRatio.first > rprThreshold1 ) xFilter += 2;
if( scalingRatio.second > rprThreshold1 ) yFilter += 2;
}

const int posShift = SCALE_RATIO_BITS - 4;
int stepX = ( scalingRatio.first + 8 ) >> 4;
int stepY = ( scalingRatio.second + 8 ) >> 4;
const int stepX = ( scalingRatio.first + 8 ) >> 4;
const int stepY = ( scalingRatio.second + 8 ) >> 4;
const int offX = 1 << ( posShift - shiftHor - 1 );
const int offY = 1 << ( posShift - shiftVer - 1 );

int64_t x0Int;
int64_t y0Int;
int offX = 1 << ( posShift - shiftHor - 1 );
int offY = 1 << ( posShift - shiftVer - 1 );

const int64_t posX = ( ( blkPos.x << getComponentScaleX( compID, chFmt ) ) - ( pps.getScalingWindow().getWindowLeftOffset() * SPS::getWinUnitX( chFmt ) ) ) >> getComponentScaleX( compID, chFmt );
const int64_t posY = ( ( blkPos.y << getComponentScaleY( compID, chFmt ) ) - ( pps.getScalingWindow().getWindowTopOffset() * SPS::getWinUnitY( chFmt ) ) ) >> getComponentScaleY( compID, chFmt );
const int64_t posX = ( ( blkPos.x << csx ) - ( pps.getScalingWindow().getWindowLeftOffset() * SPS::getWinUnitX( chFmt ) ) ) >> csx;
const int64_t posY = ( ( blkPos.y << csy ) - ( pps.getScalingWindow().getWindowTopOffset() * SPS::getWinUnitY( chFmt ) ) ) >> csy;

int addX = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getHorCollocatedChromaFlag() ) * 8 * ( scalingRatio.first - SCALE_1X.first );
int addY = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getVerCollocatedChromaFlag() ) * 8 * ( scalingRatio.second - SCALE_1X.second );
const int addX = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getHorCollocatedChromaFlag() ) * 8 * ( scalingRatio.first - SCALE_1X.first );
const int addY = isLuma( compID ) ? 0 : int( 1 - refPic->cs->sps->getVerCollocatedChromaFlag() ) * 8 * ( scalingRatio.second - SCALE_1X.second );

x0Int = ( ( posX << ( 4 + getComponentScaleX( compID, chFmt ) ) ) + mv.getHor() ) * (int64_t)scalingRatio.first + addX;
x0Int = SIGN( x0Int ) * ( ( llabs( x0Int ) + ( (long long)1 << ( 7 + getComponentScaleX( compID, chFmt ) ) ) ) >> ( 8 + getComponentScaleX( compID, chFmt ) ) ) + ( ( refPic->slices[0]->getPPS()->getScalingWindow().getWindowLeftOffset() * SPS::getWinUnitX( chFmt ) ) << ( ( posShift - getComponentScaleX( compID, chFmt ) ) ) );
x0Int = ( ( posX << ( 4 + csx ) ) + mv.getHor() ) * ( int64_t ) scalingRatio.first + addX;
x0Int = SIGN( x0Int ) * ( ( llabs( x0Int ) + ( ( long long ) 1 << ( 7 + csx ) ) ) >> ( 8 + csx ) ) + ( ( refPic->slices[ 0 ]->getPPS()->getScalingWindow().getWindowLeftOffset() * SPS::getWinUnitX( chFmt ) ) << ( ( posShift - csx ) ) );

y0Int = ( ( posY << ( 4 + getComponentScaleY( compID, chFmt ) ) ) + mv.getVer() ) * (int64_t)scalingRatio.second + addY;
y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( (long long)1 << ( 7 + getComponentScaleY( compID, chFmt ) ) ) ) >> ( 8 + getComponentScaleY( compID, chFmt ) ) ) + ( ( refPic->slices[0]->getPPS()->getScalingWindow().getWindowTopOffset() * SPS::getWinUnitY( chFmt ) ) << ( ( posShift - getComponentScaleY( compID, chFmt ) ) ) );
y0Int = ( ( posY << ( 4 + csy ) ) + mv.getVer() ) * ( int64_t ) scalingRatio.second + addY;
y0Int = SIGN( y0Int ) * ( ( llabs( y0Int ) + ( ( long long ) 1 << ( 7 + csy ) ) ) >> ( 8 + csy ) ) + ( ( refPic->slices[ 0 ]->getPPS()->getScalingWindow().getWindowTopOffset() * SPS::getWinUnitY( chFmt ) ) << ( ( posShift - csy ) ) );

const int extSize = isLuma( compID ) ? 1 : 2;

int vFilterSize = isLuma( compID ) ? NTAPS_LUMA : NTAPS_CHROMA;

int yInt0 = ( (int32_t)y0Int + offY ) >> posShift;
yInt0 = std::min( std::max( -(NTAPS_LUMA / 2), yInt0 ), ( refPicHeight >> getComponentScaleY( compID, chFmt ) ) + (NTAPS_LUMA / 2) );
int yInt0 = ( ( int32_t ) y0Int + offY ) >> posShift;
yInt0 = Clip3( -( NTAPS_LUMA / 2 ), ( refPicHeight >> csy ) + ( NTAPS_LUMA / 2 ), yInt0 );

int xInt0 = ( (int32_t)x0Int + offX ) >> posShift;
xInt0 = std::min( std::max( -(NTAPS_LUMA / 2), xInt0 ), ( refPicWidth >> getComponentScaleX( compID, chFmt ) ) + (NTAPS_LUMA / 2) );
int xInt0 = ( ( int32_t ) x0Int + offX ) >> posShift;
xInt0 = Clip3( -( NTAPS_LUMA / 2 ), ( refPicWidth >> csx ) + ( NTAPS_LUMA / 2 ), xInt0 );

int refHeight = ((((int32_t)y0Int + (height-1) * stepY) + offY ) >> posShift) - ((((int32_t)y0Int + 0 * stepY) + offY ) >> posShift) + 1;
int refHeight = ( ( ( ( int32_t ) y0Int + ( height - 1 ) * stepY ) + offY ) >> posShift ) - ( ( ( ( int32_t ) y0Int + 0 * stepY ) + offY ) >> posShift ) + 1;
refHeight = std::max<int>( 1, refHeight );

CHECK_RECOVERABLE( MAX_CU_SIZE * MAX_SCALING_RATIO < refHeight + vFilterSize - 1 + extSize, "Buffer size is not enough, increase MAX_SCALING_RATIO" );
Expand All @@ -2191,9 +2146,9 @@ void InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,

for( col = 0; col < width; col++ )
{
int posX = (int32_t)x0Int + col * stepX;
xInt = ( posX + offX ) >> posShift;
xInt = std::min( std::max( -(NTAPS_LUMA / 2), xInt ), ( refPicWidth >> getComponentScaleX( compID, chFmt ) ) + (NTAPS_LUMA / 2) );
int posX = ( int32_t ) x0Int + col * stepX;
xInt = ( posX + offX ) >> posShift;
xInt = Clip3( -( NTAPS_LUMA / 2 ), ( refPicWidth >> csx ) + ( NTAPS_LUMA / 2 ), xInt );
int xFrac = ( ( posX + offX ) >> ( posShift - shiftHor ) ) & ( ( 1 << shiftHor ) - 1 );

CHECK_RECOVERABLE( xInt0 > xInt, "Wrong horizontal starting point" );
Expand All @@ -2206,9 +2161,9 @@ void InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,

for( row = 0; row < height; row++ )
{
int posY = (int32_t)y0Int + row * stepY;
yInt = ( posY + offY ) >> posShift;
yInt = std::min( std::max( -(NTAPS_LUMA / 2), yInt ), ( refPicHeight >> getComponentScaleY( compID, chFmt ) ) + (NTAPS_LUMA / 2) );
int posY = ( int32_t ) y0Int + row * stepY;
yInt = ( posY + offY ) >> posShift;
yInt = Clip3( -( NTAPS_LUMA / 2 ), ( refPicHeight >> csy ) + ( NTAPS_LUMA / 2 ), yInt );
int yFrac = ( ( posY + offY ) >> ( posShift - shiftVer ) ) & ( ( 1 << shiftVer ) - 1 );

CHECK_RECOVERABLE( yInt0 > yInt, "Wrong vertical starting point" );
Expand Down
Loading

0 comments on commit b306b5a

Please sign in to comment.