[x265] [PATCH 1/2] Add entropy coder support for tile header generation

Nicolas Morey-Chaisemartin nmorey at kalray.eu
Tue Nov 4 09:28:17 CET 2014


# HG changeset patch
# User Nicolas Morey-Chaisemartin <nmorey at kalray.eu>
# Date 1414077144 -7200
#      Thu Oct 23 16:12:24 2014 +0200

Add entropy coder support for tile header generation

---
  source/common/slice.h      | 11 +++++++++++
  source/encoder/encoder.cpp |  3 +++
  source/encoder/entropy.cpp | 24 ++++++++++++++++++++++--
  3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/source/common/slice.h b/source/common/slice.h
index bd0ba63..ea72d5b 100644
--- a/source/common/slice.h
+++ b/source/common/slice.h
@@ -259,6 +259,17 @@ struct PPS
      bool     bPicDisableDeblockingFilter;
      int      deblockingFilterBetaOffsetDiv2;
      int      deblockingFilterTcOffsetDiv2;
+
+    // Tile specific data
+    // Note that although tile compliant header can be generated, there is no
+    // official support for tiles yet.
+    bool     bTilesEnabledFlag;
+    uint32_t numTileColumns;
+    uint32_t numTileRows;
+    bool     bUniformSpacingFlag;
+    uint32_t*columnWidth;
+    uint32_t*rowHeight;
+    bool     bLoopFilterAcrossTilesEnabledFlag;
  };
  
  struct WeightParam
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index 44e82af..002ebab 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -1298,6 +1298,9 @@ void Encoder::initPPS(PPS *pps)
      pps->deblockingFilterBetaOffsetDiv2 = 0;
      pps->deblockingFilterTcOffsetDiv2 = 0;
  
+    pps->bTilesEnabledFlag = false;
+    pps->bLoopFilterAcrossTilesEnabledFlag = false;
+
      pps->bEntropyCodingSyncEnabled = m_param->bEnableWavefront;
  }
  
diff --git a/source/encoder/entropy.cpp b/source/encoder/entropy.cpp
index 13eaf57..e881f00 100644
--- a/source/encoder/entropy.cpp
+++ b/source/encoder/entropy.cpp
@@ -161,10 +161,30 @@ void Entropy::codePPS(const PPS& pps)
      WRITE_FLAG(pps.bUseWeightPred,            "weighted_pred_flag");
      WRITE_FLAG(pps.bUseWeightedBiPred,        "weighted_bipred_flag");
      WRITE_FLAG(pps.bTransquantBypassEnabled,  "transquant_bypass_enable_flag");
-    WRITE_FLAG(0,                             "tiles_enabled_flag");
+    WRITE_FLAG(pps.bTilesEnabledFlag,         "tiles_enabled_flag");
      WRITE_FLAG(pps.bEntropyCodingSyncEnabled, "entropy_coding_sync_enabled_flag");
-    WRITE_FLAG(1,                             "loop_filter_across_slices_enabled_flag");
  
+    if (pps.bTilesEnabledFlag)
+    {
+        WRITE_UVLC(pps.numTileColumns - 1,        "num_tile_columns_minus1");
+        WRITE_UVLC(pps.numTileRows    - 1,        "num_tile_rows_minus1");
+        WRITE_FLAG(pps.bUniformSpacingFlag ? 1 : 0,"uniform_spacing_flag");
+        if (!pps.bUniformSpacingFlag){
+            uint32_t * columns = pps.columnWidth;
+            for (uint32_t column = 0; column < pps.numTileColumns - 1; ++column)
+            {
+                WRITE_UVLC(columns[column] - 1,        "column_width_minus1");
+            }
+            uint32_t * rows = pps.rowHeight;
+            for (uint32_t row = 0; row < pps.numTileRows - 1; ++row)
+            {
+                WRITE_UVLC(rows[row] - 1,        "row_height_minus1");
+            }
+        }
+        WRITE_FLAG(pps.bLoopFilterAcrossTilesEnabledFlag ? 1 : 0, "loop_filter_across_tiles_enabled_flag");
+    }
+
+    WRITE_FLAG(1,                             "loop_filter_across_slices_enabled_flag");
      WRITE_FLAG(pps.bDeblockingFilterControlPresent, "deblocking_filter_control_present_flag");
      if (pps.bDeblockingFilterControlPresent)
      {


More information about the x265-devel mailing list