[x265] [PATCH] SEI: fix bus error, cleanup m_decodingUnitInfoSEIEnabled

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Wed Jun 4 14:31:21 CEST 2014


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1401884784 -19800
#      Wed Jun 04 17:56:24 2014 +0530
# Node ID e4417a4096c8f647e703f732130bbd8a4bab1019
# Parent  61a02a9c78eb0ec2a1cdaf05562a77b37355432d
SEI: fix bus error, cleanup m_decodingUnitInfoSEIEnabled

Remove setHrdPaarameters function as all the necessary HRD parameters are
already computed and set in the initHrd function.

diff -r 61a02a9c78eb -r e4417a4096c8 source/Lib/TLibCommon/SEI.h
--- a/source/Lib/TLibCommon/SEI.h	Wed Jun 04 15:37:37 2014 +0530
+++ b/source/Lib/TLibCommon/SEI.h	Wed Jun 04 17:56:24 2014 +0530
@@ -187,11 +187,7 @@
 
     SEIPictureTiming() {}
 
-    virtual ~SEIPictureTiming()
-    {
-        delete m_numNalusInDuMinus1;
-        delete m_duCpbRemovalDelayMinus1;
-    }
+    virtual ~SEIPictureTiming() {}
 
     uint32_t  m_picStruct;
     uint32_t  m_sourceScanType;
diff -r 61a02a9c78eb -r e4417a4096c8 source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp	Wed Jun 04 15:37:37 2014 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp	Wed Jun 04 17:56:24 2014 +0530
@@ -524,87 +524,6 @@
     m_RPSList.create(numRPS);
 }
 
-void TComSPS::setHrdParameters(uint32_t fpsNum, uint32_t fpsDenom, uint32_t numDU, uint32_t bitRate, bool randomAccess)
-{
-    if (!getVuiParametersPresentFlag())
-    {
-        return;
-    }
-
-    TComVUI *vui = getVuiParameters();
-    TComHRD *hrd = vui->getHrdParameters();
-
-    TimingInfo *timingInfo = vui->getTimingInfo();
-    timingInfo->setTimingInfoPresentFlag(true);
-    timingInfo->setNumUnitsInTick(fpsDenom);
-    timingInfo->setTimeScale(fpsNum);
-
-    bool rateCnt = (bitRate > 0);
-    hrd->setVclHrdParametersPresentFlag(rateCnt);
-
-    if (hrd->getSubPicHrdParamsPresentFlag())
-    {
-        hrd->setTickDivisorMinus2(100 - 2);
-        hrd->setDuCpbRemovalDelayLengthMinus1(7);                  // 8-bit precision ( plus 1 for last DU in AU )
-        hrd->setSubPicCpbParamsInPicTimingSEIFlag(true);
-        hrd->setDpbOutputDelayDuLengthMinus1(5 + 7);               // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay
-    }
-    else
-    {
-        hrd->setSubPicCpbParamsInPicTimingSEIFlag(false);
-    }
-
-    hrd->setBitRateScale(4);                                       // in units of 2~( 6 + 4 ) = 1,024 bps
-    hrd->setCpbSizeScale(6);                                       // in units of 2~( 4 + 4 ) = 1,024 bit
-    hrd->setDuCpbSizeScale(6);                                     // in units of 2~( 4 + 4 ) = 1,024 bit
-
-    hrd->setInitialCpbRemovalDelayLengthMinus1(15);                // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit
-    if (randomAccess)
-    {
-        hrd->setCpbRemovalDelayLengthMinus1(5);                    // 32 = 2^5 (plus 1)
-        hrd->setDpbOutputDelayLengthMinus1(5);                     // 32 + 3 = 2^6
-    }
-    else
-    {
-        hrd->setCpbRemovalDelayLengthMinus1(9);                    // max. 2^10
-        hrd->setDpbOutputDelayLengthMinus1(9);                     // max. 2^10
-    }
-
-/*
-   Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported.
-*/
-    int i, j;
-    uint32_t birateValue, cpbSizeValue;
-    uint32_t ducpbSizeValue;
-    uint32_t duBitRateValue = 0;
-
-    for (i = 0; i < MAX_TLAYER; i++)
-    {
-        hrd->setFixedPicRateFlag(i, 1);
-        hrd->setPicDurationInTcMinus1(i, 0);
-        hrd->setLowDelayHrdFlag(i, 0);
-        hrd->setCpbCntMinus1(i, 0);
-
-        birateValue  = bitRate;
-        cpbSizeValue = bitRate;                                 // 1 second
-        ducpbSizeValue = bitRate / numDU;
-        duBitRateValue = bitRate;
-        for (j = 0; j < (hrd->getCpbCntMinus1(i) + 1); j++)
-        {
-            hrd->setBitRateValueMinus1(i, j, 0, (birateValue  - 1));
-            hrd->setCpbSizeValueMinus1(i, j, 0, (cpbSizeValue - 1));
-            hrd->setDuCpbSizeValueMinus1(i, j, 0, (ducpbSizeValue - 1));
-            hrd->setCbrFlag(i, j, 0, (j == 0));
-
-            hrd->setBitRateValueMinus1(i, j, 1, (birateValue  - 1));
-            hrd->setCpbSizeValueMinus1(i, j, 1, (cpbSizeValue - 1));
-            hrd->setDuCpbSizeValueMinus1(i, j, 1, (ducpbSizeValue - 1));
-            hrd->setDuBitRateValueMinus1(i, j, 1, (duBitRateValue - 1));
-            hrd->setCbrFlag(i, j, 1, (j == 0));
-        }
-    }
-}
-
 TComPPS::TComPPS()
     : m_PPSId(0)
     , m_SPSId(0)
diff -r 61a02a9c78eb -r e4417a4096c8 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Jun 04 15:37:37 2014 +0530
+++ b/source/encoder/encoder.cpp	Wed Jun 04 17:56:24 2014 +0530
@@ -1443,7 +1443,6 @@
     m_frameOnlyConstraintFlag = false;
     m_displayOrientationSEIAngle = 0;
     m_gradualDecodingRefreshInfoEnabled = 0;
-    m_decodingUnitInfoSEIEnabled = 0;
     m_useScalingListId = 0;
     m_minSpatialSegmentationIdc = 0;
     m_neutralChromaIndicationFlag = false;
diff -r 61a02a9c78eb -r e4417a4096c8 source/encoder/encoder.h
--- a/source/encoder/encoder.h	Wed Jun 04 15:37:37 2014 +0530
+++ b/source/encoder/encoder.h	Wed Jun 04 17:56:24 2014 +0530
@@ -160,7 +160,6 @@
     int                m_lastBPSEI;
     int                m_displayOrientationSEIAngle;
     int                m_gradualDecodingRefreshInfoEnabled;
-    int                m_decodingUnitInfoSEIEnabled;
 
     uint32_t           m_log2ParallelMergeLevelMinus2; ///< Parallel merge estimation region
 
diff -r 61a02a9c78eb -r e4417a4096c8 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Jun 04 15:37:37 2014 +0530
+++ b/source/encoder/frameencoder.cpp	Wed Jun 04 17:56:24 2014 +0530
@@ -139,14 +139,6 @@
     top->initPPS(&m_pps);
 
     m_sps.setNumLongTermRefPicSPS(0);
-    if (m_cfg->m_decodingUnitInfoSEIEnabled)
-    {
-        m_sps.setHrdParameters(m_cfg->param->fpsNum, m_cfg->param->fpsDenom, 0, m_cfg->param->rc.bitrate, m_cfg->param->bframes > 0);
-    }
-    if (m_cfg->param->bEmitHRDSEI || m_cfg->m_decodingUnitInfoSEIEnabled)
-    {
-        m_sps.getVuiParameters()->setHrdParametersPresentFlag(true);
-    }
 
     // initialize HRD parameters of SPS
     if (m_cfg->param->bEmitHRDSEI)
diff -r 61a02a9c78eb -r e4417a4096c8 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Wed Jun 04 15:37:37 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Jun 04 17:56:24 2014 +0530
@@ -440,6 +440,8 @@
     hrd->setLowDelayHrdFlag(0, false);
     hrd->setFixedPicRateFlag(0, 1);
     hrd->setPicDurationInTcMinus1(0, 0);
+    bool isCbr = param->rc.rateControlMode == X265_RC_ABR && param->rc.vbvMaxBitrate <= param->rc.bitrate;
+    hrd->setCbrFlag(0, 0, 0, isCbr);
 
     // normalize HRD size and rate to the value / scale notation
     hrd->setBitRateScale(Clip3(0, 15, calcScale(vbvMaxBitrate) - BR_SHIFT));


More information about the x265-devel mailing list