Commit d2d0dd70 authored by Karl Sharman's avatar Karl Sharman
Browse files

Replaced floating-point QP with optional QPIncrementFrame option (relates to JVET_E0059)

parent 98a20bb9
......@@ -1229,8 +1229,13 @@ Enabling this parameter can reduce the visibility of CU boundaries in the coded
\begin{OptionTableNoShorthand}{Quantization parameters}{tab:quantization}
\Option{QP (-q)} &
%\ShortOption{-q} &
\Default{30.0} &
Specifies the base value of the quantization parameter. If it is non-integer, the QP is switched once during encoding.
\Default{30} &
Specifies the base value of the quantization parameter.
\\
\Option{QPIncrementFrame (-qpif)} &
\Default{\NotSet} &
If a source file frame number is specified, the internal QP will be incremented for all POCs associated with source frames beyond and including that frame. If empty, do not increment.
\\
\Option{IntraQPOffset} &
......
......@@ -520,6 +520,24 @@ istream& SMultiValueInput<T>::readValues(std::istream &in)
return in;
}
#if JVET_E0059_FLOATING_POINT_QP_FIX
template <class T>
static inline istream& operator >> (std::istream &in, TAppEncCfg::OptionalValue<T> &value)
{
in >> std::ws;
if (in.eof())
{
value.bPresent=false;
}
else
{
in >> value.value;
value.bPresent=true;
}
return in;
}
#endif
static Void
automaticallySelectRExtProfile(const Bool bUsingGeneralRExtTools,
const Bool bUsingChromaQPAdjustment,
......@@ -784,7 +802,12 @@ Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
("IQPFactor,-IQF", m_dIntraQpFactor, -1.0, "Intra QP Factor for Lambda Computation. If negative, the default will scale lambda based on GOP size (unless LambdaFromQpEnable then IntraQPOffset is used instead)")
/* Quantization parameters */
#if JVET_E0059_FLOATING_POINT_QP_FIX
("QP,q", m_iQP, 30, "Qp value")
("QPIncrementFrame,-qpif", m_qpIncrementAtSourceFrame, OptionalValue<UInt>(), "If a source file frame number is specified, the internal QP will be incremented for all POCs associated with source frames >= frame number. If empty, do not increment.")
#else
("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding")
#endif
#if X0038_LAMBDA_FROM_QP_CAPABILITY
("IntraQPOffset", m_intraQPOffset, 0, "Qp offset value for intra slice, typically determined based on GOP size")
("LambdaFromQpEnable", m_lambdaFromQPEnable, false, "Enable flag for derivation of lambda from QP")
......@@ -1415,6 +1438,23 @@ Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
#if JVET_E0059_FLOATING_POINT_QP_FIX
if (m_qpIncrementAtSourceFrame.bPresent)
{
UInt switchingPOC=0;
if (m_qpIncrementAtSourceFrame.value > m_FrameSkip)
{
// if switch source frame (ssf) = 10, and frame skip (fs)=2 and temporal subsample ratio (tsr) =1, then
// for this simulation switch at POC 8 (=10-2).
// if ssf=10, fs=2, tsr=2, then for this simulation, switch at POC 4 (=(10-2)/2): POC0=Src2, POC1=Src4, POC2=Src6, POC3=Src8, POC4=Src10
switchingPOC = (m_qpIncrementAtSourceFrame.value - m_FrameSkip) / m_temporalSubsampleRatio;
}
for(UInt i=switchingPOC; i<( m_framesToBeEncoded + m_iGOPSize + 1 ); i++)
{
m_aidQP[i]=1;
}
}
#else
// handling of floating-point QP values
// if QP is not integer, sequence is split into two sections having QP and QP+1
m_iQP = (Int)( m_fQP );
......@@ -1428,6 +1468,7 @@ Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
m_aidQP[i] = 1;
}
}
#endif
for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
{
......@@ -2473,7 +2514,18 @@ Void TAppEncCfg::xPrintParameter()
printf("Motion search range : %d\n", m_iSearchRange );
printf("Intra period : %d\n", m_iIntraPeriod );
printf("Decoding refresh type : %d\n", m_iDecodingRefreshType );
#if JVET_E0059_FLOATING_POINT_QP_FIX
if (m_qpIncrementAtSourceFrame.bPresent)
{
printf("QP : %d (incrementing internal QP at source frame %d)\n", m_iQP, m_qpIncrementAtSourceFrame.value );
}
else
{
printf("QP : %d\n", m_iQP );
}
#else
printf("QP : %5.2f\n", m_fQP );
#endif
printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth);
printf("Cb QP Offset : %d\n", m_cbQpOffset );
......
......@@ -56,6 +56,17 @@
/// encoder configuration class
class TAppEncCfg
{
#if JVET_E0059_FLOATING_POINT_QP_FIX
public:
template <class T>
struct OptionalValue
{
Bool bPresent;
T value;
OptionalValue() : bPresent(false), value() { }
};
#endif
protected:
// file I/O
std::string m_inputFileName; ///< source file name
......@@ -142,7 +153,11 @@ protected:
Bool m_cabacBypassAlignmentEnabledFlag;
// coding quality
#if JVET_E0059_FLOATING_POINT_QP_FIX
OptionalValue<UInt> m_qpIncrementAtSourceFrame; ///< Optional source frame number at which all subsequent frames are to use an increased internal QP.
#else
Double m_fQP; ///< QP value of key-picture (floating point)
#endif
Int m_iQP; ///< QP value of key-picture (integer)
#if X0038_LAMBDA_FROM_QP_CAPABILITY
Int m_intraQPOffset; ///< QP offset for intra slice (integer)
......
......@@ -84,6 +84,8 @@
// To use this capability enable config parameter LambdaFromQpEnable
#define JCTVC_Y0038_PARAMS 1
#define JVET_E0059_FLOATING_POINT_QP_FIX 1 ///< Replace floating point QP with a source-file frame number.
#ifndef EXTENSION_360_VIDEO
#define EXTENSION_360_VIDEO 0 ///< extension for 360/spherical video coding support; this macro should be controlled by makefile, as it would be used to control whether the library is built and linked
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment