[x265] [RFC] Add support for tile header generation

Nicolas Morey-Chaisemartin nmorey at kalray.eu
Tue Oct 28 09:38:00 CET 2014


Hi,

I don't know if this makes sense for the mainstream but we use x265 to generate a bitstream with tiles.
This is a patch that simply add the capabilities to generate tile compliant headers although there is absolutely no support for encoding using tiles.

------

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

Add support for tile header generation

---
  source/common/slice.h      |  8 ++++++++
  source/encoder/encoder.cpp |  3 +++
  source/encoder/entropy.cpp | 22 ++++++++++++++++++++--
  3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/source/common/slice.h b/source/common/slice.h
index bd0ba63..dda341f 100644
--- a/source/common/slice.h
+++ b/source/common/slice.h
@@ -259,6 +259,14 @@ struct PPS
      bool     bPicDisableDeblockingFilter;
      int      deblockingFilterBetaOffsetDiv2;
      int      deblockingFilterTcOffsetDiv2;
+
+    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 fee457e..00dd5ae 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 7aba9b7..2edaf99 100644
--- a/source/encoder/entropy.cpp
+++ b/source/encoder/entropy.cpp
@@ -161,10 +161,28 @@ 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