[x265] [PATCH 1 of 3] Introduce structure needed for Intra refresh

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Thu Sep 24 05:30:00 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 98c0dcd5a10b8806aa1ceb775ff9342f7a7ae6c6
# Parent  975352b2c0223b9139aad233b43eaf2113ac8167
Introduce structure needed for Intra refresh

diff -r 975352b2c022 -r 98c0dcd5a10b source/common/framedata.h
--- a/source/common/framedata.h	Wed Sep 23 16:19:48 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 975352b2c022 -r 98c0dcd5a10b source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Sep 23 16:19:48 2015 +0530
+++ b/source/encoder/encoder.cpp	Wed Sep 09 14:52:35 2015 +0530
@@ -1514,6 +1514,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;
@@ -1604,6 +1605,24 @@
 
     if (p->totalFrames && p->totalFrames <= 2 * ((float)p->fpsNum) / p->fpsDenom && p->rc.bStrictCbr)
         p->lookaheadDepth = p->totalFrames;
+    if (p->bIntraRefresh && 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->bIntraRefresh)
+    {
+        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->bIntraRefresh && p->bOpenGOP)
+    {
+        x265_log(p,  X265_LOG_WARNING, "Open Gop disabled, Intra Refresh is not compatible with openGop\n");
+        p->bOpenGOP = 0;
+    }
+
 
     if (p->scalingLists && p->internalCsp == X265_CSP_I444)
     {
diff -r 975352b2c022 -r 98c0dcd5a10b source/x265.h
--- a/source/x265.h	Wed Sep 23 16:19:48 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