[x265] [PATCH 2 of 6] optimize SAO statistics initialize
Min Chen
chenm003 at 163.com
Wed Nov 18 18:14:05 CET 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1447865926 21600
# Node ID 600706db4e14bd95a5d933418186f86403e897f4
# Parent e160de7083971f21802517691f9a3a0934765952
optimize SAO statistics initialize
---
source/encoder/sao.cpp | 52 ++++++++++++++++++++++++-----------------------
1 files changed, 27 insertions(+), 25 deletions(-)
diff -r e160de708397 -r 600706db4e14 source/encoder/sao.cpp
--- a/source/encoder/sao.cpp Wed Nov 18 10:58:43 2015 -0600
+++ b/source/encoder/sao.cpp Wed Nov 18 10:58:46 2015 -0600
@@ -1156,32 +1156,34 @@
if (allowMerge[1])
m_entropyCoder.codeSaoMerge(0);
m_entropyCoder.store(m_rdContexts.temp);
+
// reset stats Y, Cb, Cr
- for (int plane = 0; plane < 3; plane++)
+ X265_CHECK(sizeof(PerPlane) == (sizeof(int32_t) * (NUM_PLANE * MAX_NUM_SAO_TYPE * MAX_NUM_SAO_CLASS)), "Found Padding space in struct PerPlane");
+
+ // TODO: Confirm the address space is continuous
+ memset(m_count, 0, 3 * sizeof(m_count[0]));
+ if (m_param->bSaoNonDeblocked)
{
- for (int j = 0; j < MAX_NUM_SAO_TYPE; j++)
- {
- for (int k = 0; k < MAX_NUM_SAO_CLASS; k++)
- {
- m_offset[plane][j][k] = 0;
- if (m_param->bSaoNonDeblocked)
- {
- m_count[plane][j][k] = m_countPreDblk[addr][plane][j][k];
- m_offsetOrg[plane][j][k] = m_offsetOrgPreDblk[addr][plane][j][k];
- }
- else
- {
- m_count[plane][j][k] = 0;
- m_offsetOrg[plane][j][k] = 0;
- }
- }
- }
+ memcpy(m_count, m_countPreDblk[addr], 3 * sizeof(m_count[0]));
+ memcpy(m_offsetOrg, m_offsetOrgPreDblk[addr], 3 * sizeof(m_offsetOrg[0]));
+ }
+ else
+ {
+ memset(m_count, 0, 3 * sizeof(m_count[0]));
+ memset(m_offsetOrg, 0, 3 * sizeof(m_offsetOrg[0]));
+ }
+ const struct SaoCtuParam dummy_initSaoParam = { SAO_MERGE_NONE, -1, 0, {0, 0, 0, 0} };
+ saoParam->ctuParam[0][addr] = dummy_initSaoParam;
+ saoParam->ctuParam[1][addr] = dummy_initSaoParam;
+ saoParam->ctuParam[2][addr] = dummy_initSaoParam;
- saoParam->ctuParam[plane][addr].mergeMode = SAO_MERGE_NONE;
- saoParam->ctuParam[plane][addr].typeIdx = -1;
- saoParam->ctuParam[plane][addr].bandPos = 0;
- if (saoParam->bSaoFlag[plane > 0])
- calcSaoStatsCu(addr, plane);
+ if (saoParam->bSaoFlag[0])
+ calcSaoStatsCu(addr, 0);
+
+ if (saoParam->bSaoFlag[1])
+ {
+ calcSaoStatsCu(addr, 1);
+ calcSaoStatsCu(addr, 2);
}
saoComponentParamDist(saoParam, addr, addrUp, addrLeft, &mergeSaoParam[0][0], mergeDist);
More information about the x265-devel
mailing list