[x265] [PATCH 2 of 5] lowres: change int keyframe to bool bKeyframe

Steve Borho steve at borho.org
Thu Sep 19 04:04:26 CEST 2013


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1379551428 18000
#      Wed Sep 18 19:43:48 2013 -0500
# Node ID 26c1e061968785bf46740b80f6fb3a7232712454
# Parent  254e366afaed7a7bf3e0f7dbd6bd80a4e420eea2
lowres: change int keyframe to bool bKeyframe

diff -r 254e366afaed -r 26c1e0619687 source/common/lowres.cpp
--- a/source/common/lowres.cpp	Wed Sep 18 19:38:11 2013 -0500
+++ b/source/common/lowres.cpp	Wed Sep 18 19:43:48 2013 -0500
@@ -110,9 +110,9 @@
 {
     bScenecut = true;
     bIntraCalculated = false;
+    bKeyframe = false; // Not a keyframe unless identified by lookahead
+    sliceType = X265_TYPE_AUTO;
     memset(costEst, -1, sizeof(costEst));
-    sliceType = X265_TYPE_AUTO;
-    keyframe = 0; //Not a keyframe unless identified by lookahead
     for (int y = 0; y < bframes + 2; y++)
     {
         for (int x = 0; x < bframes + 2; x++)
diff -r 254e366afaed -r 26c1e0619687 source/common/lowres.h
--- a/source/common/lowres.h	Wed Sep 18 19:38:11 2013 -0500
+++ b/source/common/lowres.h	Wed Sep 18 19:43:48 2013 -0500
@@ -51,7 +51,7 @@
     bool   bScenecut; // Set to false if the frame cannot possibly be part of a real scenecut. 
 
     int    sliceType; // Slice type decided by lookahead
-    int    keyframe;
+    bool   bKeyframe;
 
     /* lookahead output data */
     int       costEst[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
diff -r 254e366afaed -r 26c1e0619687 source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp	Wed Sep 18 19:38:11 2013 -0500
+++ b/source/encoder/dpb.cpp	Wed Sep 18 19:43:48 2013 -0500
@@ -374,7 +374,7 @@
     {
         return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
     }
-    if (pic->m_lowres.keyframe)
+    if (pic->m_lowres.bKeyframe)
     {
         if (m_cfg->param.decodingRefreshType == 1)
         {
diff -r 254e366afaed -r 26c1e0619687 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Wed Sep 18 19:38:11 2013 -0500
+++ b/source/encoder/slicetype.cpp	Wed Sep 18 19:43:48 2013 -0500
@@ -125,7 +125,7 @@
         outputQueue.pushBack(pic);
         numDecided++;
         lastKeyframe = 0;
-        pic->m_lowres.keyframe = 1;
+        pic->m_lowres.bKeyframe = true;
         frames[0] = &(pic->m_lowres);
         return;
     }
@@ -141,7 +141,7 @@
         {
             if (frames[dframes + 1]->sliceType == X265_TYPE_I)
             {
-                frames[dframes + 1]->keyframe = 1;
+                frames[dframes + 1]->bKeyframe = true;
                 lastKeyframe = frames[dframes]->frameNum;
                 if (cfg->param.decodingRefreshType == 2 && dframes > 0) //If an IDR frame following a B
                 {
@@ -182,7 +182,7 @@
         TComPic *pic = inputQueue.popFront();
 
         pic->m_lowres.sliceType = X265_TYPE_I;
-        pic->m_lowres.keyframe = 1;
+        pic->m_lowres.bKeyframe = true;
         outputQueue.pushBack(pic);
         numDecided++;
     }
@@ -192,7 +192,7 @@
 
         bool forceIntra = (pic->getPOC() % cfg->param.keyframeMax) == 0;
         pic->m_lowres.sliceType = forceIntra ? X265_TYPE_I : X265_TYPE_P;
-        pic->m_lowres.keyframe = forceIntra ? 1 : 0;
+        pic->m_lowres.bKeyframe = forceIntra;
         outputQueue.pushBack(pic);
         numDecided++;
     }
@@ -205,12 +205,12 @@
         if (forceIntra)
         {
             picB->m_lowres.sliceType = (picB->getPOC() % cfg->param.keyframeMax) ? X265_TYPE_P : X265_TYPE_I;
-            picB->m_lowres.keyframe = (picB->getPOC() % cfg->param.keyframeMax) ? 0 : 1;
+            picB->m_lowres.bKeyframe = !(picB->getPOC() % cfg->param.keyframeMax);
             outputQueue.pushBack(picB);
             numDecided++;
 
             picP->m_lowres.sliceType = (picP->getPOC() % cfg->param.keyframeMax) ? X265_TYPE_P : X265_TYPE_I;
-            picP->m_lowres.keyframe = (picP->getPOC() % cfg->param.keyframeMax) ? 0 : 1;
+            picP->m_lowres.bKeyframe = !(picP->getPOC() % cfg->param.keyframeMax);
             outputQueue.pushBack(picP);
             numDecided++;
         }
@@ -636,7 +636,7 @@
             frames[j]->sliceType = X265_TYPE_P;
         }
 
-        reset_start = !bKeyframe + 1;
+        reset_start = bKeyframe ? 1 : 2;
         num_bframes = 0;
     }
 


More information about the x265-devel mailing list