[x265] [PATCH 04 of 24] optimize SAO statistics initialize
Min Chen
chenm003 at 163.com
Tue Dec 8 00:54:41 CET 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1449511557 21600
# Node ID 3542d3abd018491d6ad67a79b0e6d05b604d3818
# Parent 2c6a7879eca09d28a8bcc467c0186f40b387fdd6
optimize SAO statistics initialize
---
source/encoder/sao.cpp | 50 +++++++++++++++++++++++++----------------------
1 files changed, 27 insertions(+), 23 deletions(-)
diff -r 2c6a7879eca0 -r 3542d3abd018 source/encoder/sao.cpp
--- a/source/encoder/sao.cpp Mon Dec 07 12:05:55 2015 -0600
+++ b/source/encoder/sao.cpp Mon Dec 07 12:05:57 2015 -0600
@@ -1146,30 +1146,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]));
+ }
- saoParam->ctuParam[plane][addr].reset();
- if (saoParam->bSaoFlag[plane > 0])
- calcSaoStatsCu(addr, plane);
+ saoParam->ctuParam[0][addr].reset();
+ saoParam->ctuParam[1][addr].reset();
+ saoParam->ctuParam[2][addr].reset();
+
+ 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