Skip to content

Commit

Permalink
Preparing v1.13.0-rc1 (#486)
Browse files Browse the repository at this point in the history
* Preparing v1.13.0-rc1, improvements fixes

* Bump version
  • Loading branch information
adamjw24 authored Dec 6, 2024
1 parent 19d671e commit 632e4b1
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 170 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ jobs:
generators: "Visual Studio 17 2022",
msvc_arch: Win32
}
- {
name: "Windows MSVC arm64",
os: windows-2022,
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
generators: "Visual Studio 17 2022",
msvc_arch: arm64,
}
- {
name: "Windows MinGW",
os: windows-2022,
Expand Down
8 changes: 8 additions & 0 deletions .gitlab-ci-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@ test_vc193x:
tags:
- vc193x

test_vc193x_arm64:
extends: .build_test_msvc_template
variables:
MSVC_ARCH: arm64
CONFIG_OPTIONS: "-DVVENC_OVERRIDE_COMPILER_CHECK=1"
tags:
- vc193x-arm

test_macos-x86_64:
extends: .build_test_macos_template
variables:
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ if( NOT CMAKE_VERSION VERSION_LESS 3.13.0 )
endif()

# project name
project( vvenc VERSION 1.12.1 )
project( vvenc VERSION 1.13.0 )

# set alternative version numbering for release candidates
#set( PROJECT_VERSION_RC rc1 )
set( PROJECT_VERSION_RC rc1 )
if( PROJECT_VERSION_RC )
set( PROJECT_VERSION "${PROJECT_VERSION}-${PROJECT_VERSION_RC}" )
endif()
Expand Down
4 changes: 2 additions & 2 deletions source/Lib/CommonLib/RdCost.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class RdCost
template <X86_VEXT vext>
static void xGetSADX5_8xN_SIMD ( const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos );
template <X86_VEXT vext>
static void xGetSADX5_16xN_SIMD ( const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos );
static void xGetSADX5_16xN_SIMD_X86 ( const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos );

template<X86_VEXT vext, bool fastHad>
static Distortion xGetHADs_SIMD ( const DistParam& pcDtParam );
Expand All @@ -268,7 +268,7 @@ class RdCost

#ifdef TARGET_SIMD_ARM
template <ARM_VEXT vext>
static void xGetSADX5_16xN_SIMD ( const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos );
static void xGetSADX5_16xN_SIMD_ARM ( const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos );

template <ARM_VEXT vext>
static Distortion xGetHAD2SADs_ARMSIMD( const DistParam &rcDtParam );
Expand Down
267 changes: 137 additions & 130 deletions source/Lib/CommonLib/arm/BufferARM.h

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions source/Lib/CommonLib/arm/InterPredARM.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ static inline void calcBIOSums_Neon(const Pel* srcY0Tmp, const Pel* srcY1Tmp, co
int16x8_t sumAbsGYTmp = vdupq_n_s16(0);
int16x8_t sumDIYTmp = vdupq_n_s16(0);
int16x8_t sumSignGyGxTmp = vdupq_n_s16(0);
int16x8_t x = {1, 1, 1, 1, 1, 1, 0, 0};
int16_t vals[8] = {1, 1, 1, 1, 1, 1, 0, 0};
int16x8_t x = vld1q_s16(vals);

for (int y = 0; y < 3; y++)
{
Expand All @@ -93,9 +94,9 @@ static inline void calcBIOSums_Neon(const Pel* srcY0Tmp, const Pel* srcY1Tmp, co
int16x8_t packTempY = vshrq_n_s16( vaddq_s16(loadGradY0, loadGradY1), 1 );
int16x8_t gX = vabsq_s16(packTempX);
int16x8_t gY = vabsq_s16(packTempY);
int16x8_t dIX = vmulq_s16(subTemp1,vreinterpretq_s16_u16(vcleq_s16(packTempX, vdupq_n_s16(0))-vcgeq_s16(packTempX,vdupq_n_s16(0))));
int16x8_t dIY = vmulq_s16(subTemp1,vreinterpretq_s16_u16(vcleq_s16(packTempY, vdupq_n_s16(0))-vcgeq_s16(packTempY,vdupq_n_s16(0))));
int16x8_t signGY_GX = vmulq_s16(packTempX,vreinterpretq_s16_u16(vcleq_s16(packTempY, vdupq_n_s16(0))-vcgeq_s16(packTempY,vdupq_n_s16(0))));
int16x8_t dIX = vmulq_s16(subTemp1,vreinterpretq_s16_u16( vsubq_u16( vcleq_s16(packTempX, vdupq_n_s16(0)), vcgeq_s16(packTempX,vdupq_n_s16(0)) )));
int16x8_t dIY = vmulq_s16(subTemp1,vreinterpretq_s16_u16( vsubq_u16( vcleq_s16(packTempY, vdupq_n_s16(0)), vcgeq_s16(packTempY,vdupq_n_s16(0)) )));
int16x8_t signGY_GX = vmulq_s16(packTempX,vreinterpretq_s16_u16( vsubq_u16( vcleq_s16(packTempY, vdupq_n_s16(0)), vcgeq_s16(packTempY,vdupq_n_s16(0)) )));

sumAbsGXTmp = vaddq_s16(sumAbsGXTmp, gX);
sumAbsGYTmp = vaddq_s16(sumAbsGYTmp, gY);
Expand Down Expand Up @@ -124,9 +125,9 @@ static inline void calcBIOSums_Neon(const Pel* srcY0Tmp, const Pel* srcY1Tmp, co
gX = vabsq_s16(packTempX);
gY = vabsq_s16(packTempY);

dIX = vmulq_s16(subTemp1,vreinterpretq_s16_u16(vcleq_s16(packTempX, vdupq_n_s16(0))-vcgeq_s16(packTempX,vdupq_n_s16(0))));
dIY = vmulq_s16(subTemp1,vreinterpretq_s16_u16(vcleq_s16(packTempY, vdupq_n_s16(0))-vcgeq_s16(packTempY,vdupq_n_s16(0))));
signGY_GX = vmulq_s16(packTempX,vreinterpretq_s16_u16(vcleq_s16(packTempY, vdupq_n_s16(0))-vcgeq_s16(packTempY,vdupq_n_s16(0))));
dIX = vmulq_s16(subTemp1,vreinterpretq_s16_u16( vsubq_u16( vcleq_s16(packTempX, vdupq_n_s16(0)), vcgeq_s16(packTempX,vdupq_n_s16(0)) )));
dIY = vmulq_s16(subTemp1,vreinterpretq_s16_u16( vsubq_u16( vcleq_s16(packTempY, vdupq_n_s16(0)), vcgeq_s16(packTempY,vdupq_n_s16(0)) )));
signGY_GX = vmulq_s16(packTempX,vreinterpretq_s16_u16( vsubq_u16( vcleq_s16(packTempY, vdupq_n_s16(0)), vcgeq_s16(packTempY,vdupq_n_s16(0)) )));

sumAbsGXTmp = vaddq_s16(sumAbsGXTmp, gX);
sumAbsGYTmp = vaddq_s16(sumAbsGYTmp, gY);
Expand Down
10 changes: 5 additions & 5 deletions source/Lib/CommonLib/arm/RdCostARM.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ Distortion RdCost::xGetHAD2SADs_ARMSIMD( const DistParam &rcDtParam )
#endif // defined( TARGET_SIMD_X86 )

template<ARM_VEXT vext, bool isCalCentrePos>
void xGetSADX5_16xN_SIMDImp( const DistParam& rcDtParam, Distortion* cost )
void xGetSADX5_16xN_SIMDImp_ARM( const DistParam& rcDtParam, Distortion* cost )
{
int i, j;
const Pel* piOrg = rcDtParam.org.buf;
Expand Down Expand Up @@ -990,7 +990,7 @@ void xGetSADX5_16xN_SIMDImp( const DistParam& rcDtParam, Distortion* cost )
}

template <ARM_VEXT vext>
void RdCost::xGetSADX5_16xN_SIMD(const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos)
void RdCost::xGetSADX5_16xN_SIMD_ARM(const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos)
{
if( rcDtParam.bitDepth > 10 )
{
Expand All @@ -999,9 +999,9 @@ void RdCost::xGetSADX5_16xN_SIMD(const DistParam& rcDtParam, Distortion* cost, b
}

if( isCalCentrePos )
xGetSADX5_16xN_SIMDImp<vext, true>( rcDtParam, cost );
xGetSADX5_16xN_SIMDImp_ARM<vext, true>( rcDtParam, cost );
else
xGetSADX5_16xN_SIMDImp<vext, false>( rcDtParam, cost );
xGetSADX5_16xN_SIMDImp_ARM<vext, false>( rcDtParam, cost );
}

template< int iWidth, ARM_VEXT vext >
Expand Down Expand Up @@ -1169,7 +1169,7 @@ Distortion RdCost::xGetSADwMask_ARMSIMD( const DistParam& rcDtParam )
template<ARM_VEXT vext>
void RdCost::_initRdCostARM()
{
m_afpDistortFuncX5[1] = xGetSADX5_16xN_SIMD<vext>;
m_afpDistortFuncX5[1] = xGetSADX5_16xN_SIMD_ARM<vext>;

#if defined( TARGET_SIMD_X86 )
m_afpDistortFunc[0][DF_HAD_2SAD ] = RdCost::xGetHAD2SADs_ARMSIMD<vext>;
Expand Down
7 changes: 4 additions & 3 deletions source/Lib/CommonLib/arm/neon/InterpolationFilter_neon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ static int16x8_t filter8xX_N8_neon( Pel const* src, int16x8_t ch, int32x4_t voff

static int16x8x2_t filter16xX_N8_neon( Pel const* src, int16x8_t ch, int32x4_t voffset1, int32x4_t invshift1st )
{
int16x8_t a = filter8xX_N8_neon( src + 0, ch, voffset1, invshift1st );
int16x8_t b = filter8xX_N8_neon( src + 8, ch, voffset1, invshift1st );
return ( int16x8x2_t ){ a, b };
int16x8x2_t result;
result.val[0] = filter8xX_N8_neon( src + 0, ch, voffset1, invshift1st );
result.val[1] = filter8xX_N8_neon( src + 8, ch, voffset1, invshift1st );
return result; // explicit return since MSVC for arm64 does not support direct return with typecast
}

template<bool isLast>
Expand Down
2 changes: 1 addition & 1 deletion source/Lib/CommonLib/arm/neon/Trafo_neon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace vvenc

static inline int64_t shift_and_round( int64_t x, int shift )
{
return ( x + ( 1 << ( shift - 1 ) ) ) >> shift;
return ( x + ( static_cast<int64_t>(1) << ( shift - 1 ) ) ) >> shift;
}

template<unsigned trSize>
Expand Down
10 changes: 5 additions & 5 deletions source/Lib/CommonLib/x86/RdCostX86.h
Original file line number Diff line number Diff line change
Expand Up @@ -3250,7 +3250,7 @@ void RdCost::xGetSADX5_8xN_SIMD(const DistParam& rcDtParam, Distortion* cost, bo
}

template <X86_VEXT vext, bool isCalCentrePos>
void xGetSADX5_16xN_SIMDImp(const DistParam& rcDtParam, Distortion* cost) {
void xGetSADX5_16xN_SIMDImp_X86(const DistParam& rcDtParam, Distortion* cost) {
int i, j;
const Pel* piOrg = rcDtParam.org.buf;
const Pel* piCur = rcDtParam.cur.buf - 4;
Expand Down Expand Up @@ -3549,16 +3549,16 @@ void xGetSADX5_16xN_SIMDImp(const DistParam& rcDtParam, Distortion* cost) {
}

template <X86_VEXT vext>
void RdCost::xGetSADX5_16xN_SIMD(const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos) {
void RdCost::xGetSADX5_16xN_SIMD_X86(const DistParam& rcDtParam, Distortion* cost, bool isCalCentrePos) {
if( rcDtParam.bitDepth > 10 ){
RdCost::xGetSAD16X5( rcDtParam, cost, isCalCentrePos );
return;
}

if (isCalCentrePos)
xGetSADX5_16xN_SIMDImp<vext, true>(rcDtParam, cost);
xGetSADX5_16xN_SIMDImp_X86<vext, true>(rcDtParam, cost);
else
xGetSADX5_16xN_SIMDImp<vext, false>(rcDtParam, cost);
xGetSADX5_16xN_SIMDImp_X86<vext, false>(rcDtParam, cost);
}

template <X86_VEXT vext>
Expand Down Expand Up @@ -3611,7 +3611,7 @@ void RdCost::_initRdCostX86()
m_fxdWtdPredPtr = fixWeightedSSE_SIMD <vext>;

m_afpDistortFuncX5[0] = xGetSADX5_8xN_SIMD <vext>;
m_afpDistortFuncX5[1] = xGetSADX5_16xN_SIMD<vext>;
m_afpDistortFuncX5[1] = xGetSADX5_16xN_SIMD_X86<vext>;
}

template void RdCost::_initRdCostX86<SIMDX86>();
Expand Down
12 changes: 6 additions & 6 deletions source/Lib/EncoderLib/BitAllocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ int BitAllocation::applyQPAdaptationSlice (const Slice* slice, const VVEncCfg* e
const uint32_t hpFrameRate = (pic->force2ndOrder ? 32 : encCfg->m_FrameRate / encCfg->m_FrameScale);
const int bitDepth = slice->sps->bitDepths[CH_L];
double hpEnerPicNorm = 1.0 / getAveragePictureActivity (encCfg->m_SourceWidth, encCfg->m_SourceHeight, (encCfg->m_RCNumPasses == 2 ? 0 : ctuPumpRedQP.back()),
(encCfg->m_usePerceptQPATempFiltISlice || !slice->isIntra()), bitDepth);
(encCfg->m_internalUsePerceptQPATempFiltISlice || !slice->isIntra()), bitDepth);
const PreCalcValues& pcv = *pic->cs->pcv;

pic->picInitialQP = sliceQP; // modified below and used in applyQPAdaptationSubCtu
Expand Down Expand Up @@ -600,7 +600,7 @@ int BitAllocation::applyQPAdaptationSlice (const Slice* slice, const VVEncCfg* e

pic->picVA.spatAct[ CH_L ] = ClipBD (uint16_t ((picSpVisAct + (nCtu >> 1)) / nCtu), 12);
}
if (encCfg->m_usePerceptQPATempFiltISlice && slice->isIntra() && pic->getOrigBuf (compID).buf != pic->getOrigBufPrev (compID, PREV_FRAME_1).buf && zeroMinActCTUs * 2 > ctuBoundingAddr - ctuStartAddr)
if (encCfg->m_internalUsePerceptQPATempFiltISlice && slice->isIntra() && pic->getOrigBuf (compID).buf != pic->getOrigBufPrev (compID, PREV_FRAME_1).buf && zeroMinActCTUs * 2 > ctuBoundingAddr - ctuStartAddr)
{
hpEnerPicNorm *= sqrt (zeroMinActCTUs * 2.0 / float (ctuBoundingAddr - ctuStartAddr)); // frozen-image mode
}
Expand Down Expand Up @@ -659,7 +659,7 @@ int BitAllocation::applyQPAdaptationSlice (const Slice* slice, const VVEncCfg* e
}
}

if (encCfg->m_RCNumPasses == 2 && (encCfg->m_RCTargetBitrate > 0) && (ctuRCQPMemory != nullptr) && slice->pps->useDQP && (encCfg->m_usePerceptQPATempFiltISlice == 2) && slice->isIntra())
if (encCfg->m_RCNumPasses == 2 && (encCfg->m_RCTargetBitrate > 0) && (ctuRCQPMemory != nullptr) && slice->pps->useDQP && (encCfg->m_internalUsePerceptQPATempFiltISlice == 2) && slice->isIntra())
{
const int nCtu = int (ctuBoundingAddr - ctuStartAddr);
const int offs = (slice->poc / encCfg->m_IntraPeriod) * ((nCtu + 1) >> 1);
Expand Down Expand Up @@ -700,7 +700,7 @@ int BitAllocation::applyQPAdaptationSlice (const Slice* slice, const VVEncCfg* e
const double hpEnerCTU = pic->ctuQpaLambda[ctuRsAddr];
int adaptedLumaQP = Clip3 (0, MAX_QP, sliceQP + apprI3Log2 (hpEnerCTU * hpEnerPicNorm, isSccStrongRC));

if ((encCfg->m_usePerceptQPATempFiltISlice == 2) && slice->isIntra() && (ctuPumpRedQP.size() > ctuRsAddr))
if ((encCfg->m_internalUsePerceptQPATempFiltISlice == 2) && slice->isIntra() && (ctuPumpRedQP.size() > ctuRsAddr))
{
if (rcIsFirstPassOf2) // backup 1st-pass I-frame QP for 2nd rate control pass
{
Expand All @@ -716,7 +716,7 @@ int BitAllocation::applyQPAdaptationSlice (const Slice* slice, const VVEncCfg* e

ctuPumpRedQP[ctuRsAddr] = 0; // reset QP memory for temporal pumping analysis
}
if ((encCfg->m_usePerceptQPATempFiltISlice == 2) && !slice->isIntra() && (slice->TLayer == 0) && rcIsFirstPassOf2 && (adaptedLumaQP < MAX_QP))
if ((encCfg->m_internalUsePerceptQPATempFiltISlice == 2) && !slice->isIntra() && (slice->TLayer == 0) && rcIsFirstPassOf2 && (adaptedLumaQP < MAX_QP))
{
adaptedLumaQP++; // this is a first-pass tuning to stabilize the rate control
}
Expand Down Expand Up @@ -839,7 +839,7 @@ int BitAllocation::applyQPAdaptationSubCtu (const Slice* slice, const VVEncCfg*
picPrv1.buf, picPrv1.stride, picPrv2.buf, picPrv2.stride, hpFrameRate,
bitDepth, isHighResolution);
const double hpEnerPicNorm = 1.0 / getAveragePictureActivity (encCfg->m_SourceWidth, encCfg->m_SourceHeight, 0,
(encCfg->m_usePerceptQPATempFiltISlice || !slice->isIntra()), bitDepth);
(encCfg->m_internalUsePerceptQPATempFiltISlice || !slice->isIntra()), bitDepth);
int adaptedSubCtuQP = Clip3 (0, MAX_QP, pic->picInitialQP + apprI3Log2 (hpEnerSubCTU * hpEnerPicNorm, isSccStrongRC));

if (isChromaEnabled (pic->chromaFormat) && (adaptedSubCtuQP < MAX_QP))
Expand Down
11 changes: 11 additions & 0 deletions source/Lib/EncoderLib/EncCfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ void VVEncCfg::xInitCfgMembers()
m_fg.m_fgcSEINumModelValuesMinus1[1] = 0;
m_fg.m_fgcSEINumModelValuesMinus1[2] = 0;
}

if( m_usePerceptQPATempFiltISlice > 2 )
{
m_internalUsePerceptQPATempFiltISlice = m_usePerceptQPATempFiltISlice - 2;
m_disableForce2ndOderFilter = true;
}
else
{
m_internalUsePerceptQPATempFiltISlice = m_usePerceptQPATempFiltISlice;
m_disableForce2ndOderFilter = false;
}
}

}
Expand Down
2 changes: 2 additions & 0 deletions source/Lib/EncoderLib/EncCfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ struct VVEncCfg : public vvenc_config
bool m_reuseCuResults;
int m_splitCostThrParamId;
vvencFG m_fg;
int m_internalUsePerceptQPATempFiltISlice;
bool m_disableForce2ndOderFilter;

private:
void xInitCfgMembers();
Expand Down
10 changes: 5 additions & 5 deletions source/Lib/EncoderLib/EncCu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ const MergeIdxPair EncCu::m_GeoModeTest[GEO_MAX_NUM_CANDS] = { MergeIdxPair{0, 1

const double EncCu::coefSquareCUs[2][5][2][2][2] = {
{{{{-1.00000000, -1.00000000, }, {-1.00000000, -1.00000000, }, }, {{-1.00000000, -1.00000000, }, {-1.00000000, -1.00000000, }, }, },
{{{-1.00000000, -1.00000000, }, {0.06213828, 0.00611228, }, }, {{-1.00000000, -1.00000000, }, {0.06943756, 0.00320762, }, }, },
{{{-1.00000000, -1.00000000, }, {-1.00000000, -1.00000000, }, }, {{-1.00000000, -1.00000000, }, {-1.00000000, -1.00000000, }, }, },
{{{-1.00000000, -1.00000000, }, {0.07848505, 0.00225808, }, }, {{-1.00000000, -1.00000000, }, {0.07509575, 0.00204789, }, }, },
{{{-1.00000000, -1.00000000, }, {0.10833051, 0.00053144, }, }, {{-1.00000000, -1.00000000, }, {0.08304352, 0.00142876, }, }, },
{{{-1.00000000, -1.00000000, }, {-1.00000000, -1.00000000, }, }, {{-1.00000000, -1.00000000, }, {-1.00000000, -1.00000000, }, }, },
},
Expand Down Expand Up @@ -603,7 +603,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
{
if (m_pcEncCfg->m_usePerceptQPA)
{
if (m_pcEncCfg->m_usePerceptQPATempFiltISlice == 2)
if (m_pcEncCfg->m_internalUsePerceptQPATempFiltISlice == 2)
{
m_tempQpDiff = pic->ctuAdaptedQP[ctuRsAddr] - BitAllocation::applyQPAdaptationSubCtu (&slice, m_pcEncCfg, lumaArea, m_pcRateCtrl->getMinNoiseLevels());
}
Expand All @@ -622,7 +622,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
tempCS->currQP[partitioner.chType] = tempCS->baseQP =
bestCS->currQP[partitioner.chType] = bestCS->baseQP = std::min (std::min (adQPTL, adQPTR), std::min (adQPBL, adQPBR));

if (m_pcEncCfg->m_usePerceptQPATempFiltISlice == 2)
if (m_pcEncCfg->m_internalUsePerceptQPATempFiltISlice == 2)
{
if ((m_globalCtuQpVector->size() > ctuRsAddr) && (slice.TLayer == 0) && // last CTU row of non-Intra key-frame
(m_pcEncCfg->m_IntraPeriod == 2 * m_pcEncCfg->m_GOPSize) && (ctuRsAddr >= pcv.widthInCtus) && (uiTPelY + pcv.maxCUSize > m_pcEncCfg->m_PadSourceHeight))
Expand Down Expand Up @@ -668,7 +668,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
CHECK ((partitioner.currArea().lwidth() >= pcv.maxCUSize) || (partitioner.currArea().lheight() >= pcv.maxCUSize), "sub-CTU delta-QP error");
tempCS->currQP[partitioner.chType] = tempCS->baseQP = BitAllocation::applyQPAdaptationSubCtu (&slice, m_pcEncCfg, lumaArea, m_pcRateCtrl->getMinNoiseLevels());

if (m_pcEncCfg->m_usePerceptQPATempFiltISlice == 2)
if (m_pcEncCfg->m_internalUsePerceptQPATempFiltISlice == 2)
{
tempCS->currQP[partitioner.chType] = tempCS->baseQP = Clip3 (0, MAX_QP, tempCS->baseQP + m_tempQpDiff);
}
Expand Down Expand Up @@ -1748,7 +1748,7 @@ void EncCu::xCheckRDCostUnifiedMerge( CodingStructure *&tempCS, CodingStructure
addGpmCandsToPruningList( gpmMergeCtx, localUnitArea, sqrtLambdaForFirstPass, ctxStart, comboList, geoBuffer, distParam, *cu );
}

if( m_pcEncCfg->m_usePerceptQPATempFiltISlice == 2 && m_uiSadBestForQPA < MAX_DISTORTION && slice.TLayer == 0 // non-Intra key-frame
if( m_pcEncCfg->m_internalUsePerceptQPATempFiltISlice == 2 && m_uiSadBestForQPA < MAX_DISTORTION && slice.TLayer == 0 // non-Intra key-frame
&& m_pcEncCfg->m_salienceBasedOpt
&& m_pcEncCfg->m_usePerceptQPA && partitioner.currQgEnable() && partitioner.currSubdiv == 0 ) // CTU-level luma quantization group
{
Expand Down
8 changes: 6 additions & 2 deletions source/Lib/EncoderLib/EncGOP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void EncGOP::init( const VVEncCfg& encCfg, const GOPCfg* gopCfg, RateCtrl& rateC

if (encCfg.m_usePerceptQPA)
{
m_globalCtuQpVector.resize( pps0.useDQP && (encCfg.m_usePerceptQPATempFiltISlice == 2) && encCfg.m_salienceBasedOpt ? pps0.picWidthInCtu * pps0.picHeightInCtu + 1 : 1 );
m_globalCtuQpVector.resize( pps0.useDQP && (encCfg.m_internalUsePerceptQPATempFiltISlice == 2) && encCfg.m_salienceBasedOpt ? pps0.picWidthInCtu * pps0.picHeightInCtu + 1 : 1 );
}

if( m_pcEncCfg->m_FrameRate && m_pcEncCfg->m_TicksPerSecond > 0 )
Expand Down Expand Up @@ -1810,7 +1810,7 @@ void EncGOP::xInitGopQpCascade( Picture& keyPic, PicList::const_iterator picList
const int bDepth = m_pcEncCfg->m_internalBitDepth[CH_L];
const int intraP = Clip3(m_pcEncCfg->m_GOPSize, 4 * VVENC_MAX_GOP, m_pcEncCfg->m_IntraPeriod);
const int visAct = std::max(uint16_t(spVisActTL0[CH_L] >> (12 - bDepth)), keyPic.picVA.visAct); // when vaY=0
const double apa = sqrt((m_pcEncCfg->m_usePerceptQPATempFiltISlice ? 32.0 : 16.0) * double(1 << (2 * bDepth - 10)) / sqrt(resRatio4K)); // average picture activity
const double apa = sqrt((m_pcEncCfg->m_internalUsePerceptQPATempFiltISlice ? 32.0 : 16.0) * double(1 << (2 * bDepth - 10)) / sqrt(resRatio4K)); // average picture activity
const int auxOff = (m_pcEncCfg->m_blockImportanceMapping && !keyPic.m_picShared->m_ctuBimQpOffset.empty() ? keyPic.m_picShared->m_picAuxQpOffset : 0) + dQP;
const int iFrmQP = std::min(MAX_QP, m_pcEncCfg->m_QP + m_pcEncCfg->m_intraQPOffset + auxOff + int(floor(3.0 * log(visAct / apa) / log(2.0) + 0.5)));
const int qp32BC = int(16384.0 + 7.21875 * pow((double)spVisActTL0[CH_L], 4.0 / 3.0) + 1.46875 * pow((double)spVisActTL0[CH_C], 4.0 / 3.0)) * (isHighRes ? 96 : 24); // TODO hlm
Expand Down Expand Up @@ -1861,6 +1861,10 @@ void EncGOP::xInitGopQpCascade( Picture& keyPic, PicList::const_iterator picList

keyPic.gopAdaptedQP = dQP; // TODO: add any additional key-frame offset here
keyPic.force2ndOrder = f2O;
if( m_pcEncCfg->m_disableForce2ndOderFilter )
{
keyPic.force2ndOrder = false;
}

if(m_pcEncCfg->m_rateCap)
{
Expand Down
Loading

0 comments on commit 632e4b1

Please sign in to comment.