[x265] [PATCH] Introduce structure needed for Intra refresh
santhoshini at multicorewareinc.com
santhoshini at multicorewareinc.com
Wed Oct 7 13:09:50 CEST 2015
# HG changeset patch
# User Santhoshini Sekar<santhoshini at multicorewareinc.com>
# Date 1441790555 -19800
# Wed Sep 09 14:52:35 2015 +0530
# Node ID 7f24990073bb86ef6c632e5e2254c794daf3de3a
# Parent f8b8ebdc54578e6735216d8b9abce5ba80c05bd8
Introduce structure needed for Intra refresh
diff -r f8b8ebdc5457 -r 7f24990073bb source/CMakeLists.txt
--- a/source/CMakeLists.txt Mon Sep 28 14:34:41 2015 +0530
+++ b/source/CMakeLists.txt Wed Sep 09 14:52:35 2015 +0530
@@ -30,7 +30,7 @@
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 75)
+set(X265_BUILD 76)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r f8b8ebdc5457 -r 7f24990073bb source/common/framedata.h
--- a/source/common/framedata.h Mon Sep 28 14:34:41 2015 +0530
+++ b/source/common/framedata.h Wed Sep 09 14:52:35 2015 +0530
@@ -134,7 +134,16 @@
RCStatCU* m_cuStat;
RCStatRow* m_rowStat;
FrameStats m_frameStats; // stats of current frame for multi-pass encodes
+ /* data needed for periodic intra refresh */
+ struct PeriodicIR
+ {
+ double position;
+ uint32_t pirStartCol;
+ uint32_t pirEndCol;
+ int framesSinceLastPir;
+ };
+ PeriodicIR m_pir;
double m_avgQpRc; /* avg QP as decided by rate-control */
double m_avgQpAq; /* avg QP as decided by AQ in addition to rate-control */
double m_rateFactor; /* calculated based on the Frame QP */
diff -r f8b8ebdc5457 -r 7f24990073bb source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Mon Sep 28 14:34:41 2015 +0530
+++ b/source/encoder/encoder.cpp Wed Sep 09 14:52:35 2015 +0530
@@ -1515,6 +1515,7 @@
p->rc.cuTree = 0;
p->bEnableWeightedPred = 0;
p->bEnableWeightedBiPred = 0;
+ p->bIntraRefresh = 0;
/* SPSs shall have sps_max_dec_pic_buffering_minus1[ sps_max_sub_layers_minus1 ] equal to 0 only */
p->maxNumReferences = 1;
@@ -1605,6 +1606,34 @@
if (p->totalFrames && p->totalFrames <= 2 * ((float)p->fpsNum) / p->fpsDenom && p->rc.bStrictCbr)
p->lookaheadDepth = p->totalFrames;
+ if (p->bIntraRefresh)
+ {
+ int numCuInWidth = (m_param->sourceWidth + g_maxCUSize - 1) / g_maxCUSize;
+ if (p->maxNumReferences > 1)
+ {
+ x265_log(p, X265_LOG_WARNING, "Max References > 1 + intra-refresh is not supported , setting max num references = 1\n");
+ p->maxNumReferences = 1;
+ }
+
+ if (p->bBPyramid && p->bframes)
+ x265_log(p, X265_LOG_WARNING, "B pyramid cannot be enabled when max references is 1, Disabling B pyramid\n");
+ p->bBPyramid = 0;
+
+
+ if (p->bOpenGOP)
+ {
+ x265_log(p, X265_LOG_WARNING, "Open Gop disabled, Intra Refresh is not compatible with openGop\n");
+ p->bOpenGOP = 0;
+ }
+
+ x265_log(p, X265_LOG_WARNING, "Scenecut is disabled when Intra Refresh is enabled\n");
+
+ if (((float)numCuInWidth - 1) / m_param->keyframeMax > 1)
+ x265_log(p, X265_LOG_WARNING, "Keyint value is very low.It leads to frequent intra refreshes, can be almost every frame."
+ "Prefered use case would be high keyint value or an API call to refresh when necessary\n");
+
+ }
+
if (p->scalingLists && p->internalCsp == X265_CSP_I444)
{
diff -r f8b8ebdc5457 -r 7f24990073bb source/x265.h
--- a/source/x265.h Mon Sep 28 14:34:41 2015 +0530
+++ b/source/x265.h Wed Sep 09 14:52:35 2015 +0530
@@ -703,6 +703,11 @@
* should detect scene cuts. The default (40) is recommended. */
int scenecutThreshold;
+ /* Replace keyframes by using a column of intra blocks that move across the video
+ * from one side to the other, thereby "refreshing" the image. In effect, instead of a
+ * big keyframe, the keyframe is "spread" over many frames. */
+ int bIntraRefresh;
+
/*== Coding Unit (CU) definitions ==*/
/* Maximum CU width and height in pixels. The size must be 64, 32, or 16.
More information about the x265-devel
mailing list