[x265] [PATCH] Introduce structure needed for Intra-refresh

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Wed Sep 9 12:08:36 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 f6892dcc7f4e74af58d7f39e085aed44afba919c
# Parent  365f7ed4d89628d49cd6af8d81d4edc01f73ffad
Introduce structure needed for Intra-refresh

diff -r 365f7ed4d896 -r f6892dcc7f4e source/common/framedata.h
--- a/source/common/framedata.h	Tue Sep 08 16:38:01 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   pirStartPelX;
+        uint32_t   pirEndPelX;
+        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 365f7ed4d896 -r f6892dcc7f4e source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Sep 08 16:38:01 2015 +0530
+++ b/source/encoder/encoder.cpp	Wed Sep 09 14:52:35 2015 +0530
@@ -1513,6 +1513,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;
@@ -1603,6 +1604,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 365f7ed4d896 -r f6892dcc7f4e source/x265.h
--- a/source/x265.h	Tue Sep 08 16:38:01 2015 +0530
+++ b/source/x265.h	Wed Sep 09 14:52:35 2015 +0530
@@ -702,6 +702,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