[x265] [PATCH] entropy: fix bug in coding HRD parameters based on the temporal layers

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Tue Feb 10 09:22:57 CET 2015


# HG changeset patch
# User Aarthi Thirumalai
# Date 1423556473 -19800
#      Tue Feb 10 13:51:13 2015 +0530
# Node ID 494200c9cbf5cc597b37688e254a8f93db475963
# Parent  da3302cc67fb06c62726d175593fdfda0db2fd54
entropy: fix bug in coding HRD parameters based on the temporal layers.

diff -r da3302cc67fb -r 494200c9cbf5 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Mon Feb 09 16:45:31 2015 -0600
+++ b/source/encoder/entropy.cpp	Tue Feb 10 13:51:13 2015 +0530
@@ -136,7 +136,7 @@
     WRITE_FLAG(sps.bUseStrongIntraSmoothing, "sps_strong_intra_smoothing_enable_flag");
 
     WRITE_FLAG(1, "vui_parameters_present_flag");
-    codeVUI(sps.vuiParameters);
+    codeVUI(sps.vuiParameters, sps.maxTempSubLayers - 1);
 
     WRITE_FLAG(0, "sps_extension_flag");
 }
@@ -239,7 +239,7 @@
     }
 }
 
-void Entropy::codeVUI(const VUI& vui)
+void Entropy::codeVUI(const VUI& vui, int maxSubTLayersMinusOne)
 {
     WRITE_FLAG(vui.aspectRatioInfoPresentFlag,  "aspect_ratio_info_present_flag");
     if (vui.aspectRatioInfoPresentFlag)
@@ -297,7 +297,7 @@
 
     WRITE_FLAG(vui.hrdParametersPresentFlag,  "vui_hrd_parameters_present_flag");
     if (vui.hrdParametersPresentFlag)
-        codeHrdParameters(vui.hrdParameters);
+        codeHrdParameters(vui.hrdParameters, maxSubTLayersMinusOne);
 
     WRITE_FLAG(0, "bitstream_restriction_flag");
 }
@@ -344,10 +344,8 @@
     }
 }
 
-void Entropy::codeHrdParameters(const HRDInfo& hrd)
+void Entropy::codeHrdParameters(const HRDInfo& hrd, int maxSubTLayersMinusOne)
 {
-    for (int i = 0; i <= 1; i++)
-    {
         WRITE_FLAG(1, "nal_hrd_parameters_present_flag");
         WRITE_FLAG(0, "vcl_hrd_parameters_present_flag");
         WRITE_FLAG(0, "sub_pic_hrd_params_present_flag");
@@ -358,15 +356,16 @@
         WRITE_CODE(hrd.initialCpbRemovalDelayLength - 1, 5, "initial_cpb_removal_delay_length_minus1");
         WRITE_CODE(hrd.cpbRemovalDelayLength - 1,        5, "au_cpb_removal_delay_length_minus1");
         WRITE_CODE(hrd.dpbOutputDelayLength - 1,         5, "dpb_output_delay_length_minus1");
+        for (int i = 0; i <= maxSubTLayersMinusOne; i++)
+        {
+            WRITE_FLAG(1, "fixed_pic_rate_general_flag");
+            WRITE_UVLC(0, "elemental_duration_in_tc_minus1");
+            WRITE_UVLC(0, "cpb_cnt_minus1");
 
-        WRITE_FLAG(1, "fixed_pic_rate_general_flag");
-        WRITE_UVLC(0, "elemental_duration_in_tc_minus1");
-        WRITE_UVLC(0, "cpb_cnt_minus1");
-
-        WRITE_UVLC(hrd.bitRateValue - 1, "bit_rate_value_minus1");
-        WRITE_UVLC(hrd.cpbSizeValue - 1, "cpb_size_value_minus1");
-        WRITE_FLAG(hrd.cbrFlag, "cbr_flag");
-    }
+            WRITE_UVLC(hrd.bitRateValue - 1, "bit_rate_value_minus1");
+            WRITE_UVLC(hrd.cpbSizeValue - 1, "cpb_size_value_minus1");
+            WRITE_FLAG(hrd.cbrFlag, "cbr_flag");
+        }
 }
 
 void Entropy::codeAUD(const Slice& slice)
diff -r da3302cc67fb -r 494200c9cbf5 source/encoder/entropy.h
--- a/source/encoder/entropy.h	Mon Feb 09 16:45:31 2015 -0600
+++ b/source/encoder/entropy.h	Tue Feb 10 13:51:13 2015 +0530
@@ -142,9 +142,9 @@
     void codeVPS(const VPS& vps);
     void codeSPS(const SPS& sps, const ScalingList& scalingList, const ProfileTierLevel& ptl);
     void codePPS(const PPS& pps);
-    void codeVUI(const VUI& vui);
+    void codeVUI(const VUI& vui, int maxSubTLayersMinusOne);
     void codeAUD(const Slice& slice);
-    void codeHrdParameters(const HRDInfo& hrd);
+    void codeHrdParameters(const HRDInfo& hrd, int maxSubTLayersMinusOne);
 
     void codeSliceHeader(const Slice& slice, FrameData& encData);
     void codeSliceHeaderWPPEntryPoints(const Slice& slice, const uint32_t *substreamSizes, uint32_t maxOffset);


More information about the x265-devel mailing list