[x265] [PATCH 3 of 6] cleanup: remove reduce m_sad since we are single thread now
Min Chen
chenm003 at 163.com
Tue Aug 20 08:18:41 CEST 2013
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1376979248 -28800
# Node ID c7a4e84650b1c6827453f11ac405529995a9fac3
# Parent 3f9e6edef9a5e662646904002f3dc860bd5a988c
cleanup: remove reduce m_sad since we are single thread now
diff -r 3f9e6edef9a5 -r c7a4e84650b1 source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h Tue Aug 20 14:13:50 2013 +0800
+++ b/source/encoder/frameencoder.h Tue Aug 20 14:14:08 2013 +0800
@@ -138,7 +138,7 @@
/* Frame singletons, last the life of the encoder */
TEncSbac* getSingletonSbac() { return &m_sbacCoder; }
- TEncSampleAdaptiveOffset* getSAO() { return &m_frameFilter.m_sao[0]; }
+ TEncSampleAdaptiveOffset* getSAO() { return &m_frameFilter.m_sao; }
TEncCavlc* getCavlcCoder() { return &m_cavlcCoder; }
diff -r 3f9e6edef9a5 -r c7a4e84650b1 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp Tue Aug 20 14:13:50 2013 +0800
+++ b/source/encoder/framefilter.cpp Tue Aug 20 14:14:08 2013 +0800
@@ -36,7 +36,6 @@
: JobProvider(pool)
, m_cfg(NULL)
, m_pic(NULL)
- , m_sao(NULL)
{}
void FrameFilter::destroy()
@@ -47,14 +46,10 @@
{
assert(m_cfg->param.bEnableSAO);
m_loopFilter.destroy();
- for (int i = 0; i < m_numRows; ++i)
- {
- // NOTE: I don't check sao flag since loopfilter and sao have same control status
- m_sao[i].destroy();
- m_sao[i].destroyEncBuffer();
- }
- delete[] m_sao;
+ // NOTE: I don't check sao flag since loopfilter and sao have same control status
+ m_sao.destroy();
+ m_sao.destroyEncBuffer();
}
}
@@ -80,16 +75,12 @@
if (top->param.bEnableLoopFilter)
{
- m_sao = new TEncSampleAdaptiveOffset[numRows];
m_loopFilter.create(g_maxCUDepth);
- for (int i = 0; i < m_numRows; ++i)
- {
- m_sao[i].setSaoLcuBoundary(top->param.saoLcuBoundary);
- m_sao[i].setSaoLcuBasedOptimization(top->param.saoLcuBasedOptimization);
- m_sao[i].setMaxNumOffsetsPerPic(top->getMaxNumOffsetsPerPic());
- m_sao[i].create(top->param.sourceWidth, top->param.sourceHeight, g_maxCUWidth, g_maxCUHeight);
- m_sao[i].createEncBuffer();
- }
+ m_sao.setSaoLcuBoundary(top->param.saoLcuBoundary);
+ m_sao.setSaoLcuBasedOptimization(top->param.saoLcuBasedOptimization);
+ m_sao.setMaxNumOffsetsPerPic(top->getMaxNumOffsetsPerPic());
+ m_sao.create(top->param.sourceWidth, top->param.sourceHeight, g_maxCUWidth, g_maxCUHeight);
+ m_sao.createEncBuffer();
}
}
@@ -100,14 +91,11 @@
m_loopFilter.setCfg(pic->getSlice()->getPPS()->getLoopFilterAcrossTilesEnabledFlag());
row_ready = -1;
row_done = -1;
- for (int i = 0; i < m_numRows; i++)
+ if (m_cfg->param.bEnableLoopFilter)
{
- if (m_cfg->param.bEnableLoopFilter)
- {
- if (m_cfg->param.saoLcuBasedOptimization && m_cfg->param.saoLcuBoundary)
- m_sao[i].resetStats();
- m_sao[i].createPicSaoInfo(pic);
- }
+ if (m_cfg->param.saoLcuBasedOptimization && m_cfg->param.saoLcuBoundary)
+ m_sao.resetStats();
+ m_sao.createPicSaoInfo(pic);
}
if (m_cfg->param.bEnableLoopFilter && m_pool && m_cfg->param.bEnableWavefront)
@@ -127,10 +115,7 @@
{
if (m_cfg->param.bEnableLoopFilter)
{
- for (int i = 0; i < m_numRows; i++)
- {
- m_sao[i].destroyPicSaoInfo();
- }
+ m_sao.destroyPicSaoInfo();
}
}
@@ -157,7 +142,7 @@
for (UInt col = 0; col < numCols; col++)
{
const uint32_t cuAddr = lineStartCUAddr + col;
- m_sao[row].calcSaoStatsLCu_BeforeDblk(m_pic, cuAddr);
+ m_sao.calcSaoStatsLCu_BeforeDblk(m_pic, cuAddr);
}
}
diff -r 3f9e6edef9a5 -r c7a4e84650b1 source/encoder/framefilter.h
--- a/source/encoder/framefilter.h Tue Aug 20 14:13:50 2013 +0800
+++ b/source/encoder/framefilter.h Tue Aug 20 14:14:08 2013 +0800
@@ -71,7 +71,7 @@
public:
TComLoopFilter m_loopFilter;
- TEncSampleAdaptiveOffset* m_sao;
+ TEncSampleAdaptiveOffset m_sao;
int m_numRows;
// TODO: if you want thread priority logic, add col here
More information about the x265-devel
mailing list