[x265] [PATCH 1 of 3] sao: created new primitive for saoCuStatsE1
dnyaneshwar at multicorewareinc.com
dnyaneshwar at multicorewareinc.com
Thu Jul 2 14:01:23 CEST 2015
# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1435749564 -19800
# Wed Jul 01 16:49:24 2015 +0530
# Node ID 18151ada638dd19843551e2a6d5d8b2cc9bd28be
# Parent 76a314f91799c2dce6878c389503d2fe9007dbe8
sao: created new primitive for saoCuStatsE1
diff -r 76a314f91799 -r 18151ada638d source/common/primitives.h
--- a/source/common/primitives.h Wed Jul 01 17:05:52 2015 -0700
+++ b/source/common/primitives.h Wed Jul 01 16:49:24 2015 +0530
@@ -174,6 +174,7 @@
typedef void (*saoCuOrgE3_t)(pixel* rec, int8_t* upBuff1, int8_t* m_offsetEo, intptr_t stride, int startX, int endX);
typedef void (*saoCuOrgB0_t)(pixel* rec, const int8_t* offsetBo, int ctuWidth, int ctuHeight, intptr_t stride);
+typedef void (*saoCuStatsE1_t)(const pixel *fenc, const pixel *rec, intptr_t stride, int8_t *upBuff1, int endX, int endY, int32_t *stats, int32_t *count);
typedef void (*saoCuStatsE2_t)(const pixel *fenc, const pixel *rec, intptr_t stride, int8_t *upBuff1, int8_t *upBuff, int endX, int endY, int32_t *stats, int32_t *count);
typedef void (*saoCuStatsE3_t)(const pixel *fenc, const pixel *rec, intptr_t stride, int8_t *upBuff1, int endX, int endY, int32_t *stats, int32_t *count);
@@ -297,6 +298,7 @@
saoCuOrgE3_t saoCuOrgE3[2];
saoCuOrgB0_t saoCuOrgB0;
+ saoCuStatsE1_t saoCuStatsE1;
saoCuStatsE2_t saoCuStatsE2;
saoCuStatsE3_t saoCuStatsE3;
diff -r 76a314f91799 -r 18151ada638d source/encoder/sao.cpp
--- a/source/encoder/sao.cpp Wed Jul 01 17:05:52 2015 -0700
+++ b/source/encoder/sao.cpp Wed Jul 01 16:49:24 2015 +0530
@@ -811,33 +811,7 @@
primitives.sign(upBuff1, rec, &rec[- stride], ctuWidth);
- memset(tmp_stats, 0, sizeof(tmp_stats));
- memset(tmp_count, 0, sizeof(tmp_count));
-
- for (y = startY; y < endY; y++)
- {
- for (x = 0; x < endX; x++)
- {
- int signDown = signOf2(rec[x], rec[x + stride]);
- X265_CHECK(signDown == signOf(rec[x] - rec[x + stride]), "signDown check failure\n");
- uint32_t edgeType = signDown + upBuff1[x] + 2;
- upBuff1[x] = (int8_t)(-signDown);
-
- tmp_stats[edgeType] += (fenc[x] - rec[x]);
- tmp_count[edgeType]++;
- }
-
- fenc += stride;
- rec += stride;
- }
-
- stats = m_offsetOrg[plane][SAO_EO_1];
- count = m_count[plane][SAO_EO_1];
- for (x = 0; x < NUM_EDGETYPE; x++)
- {
- stats[s_eoTable[x]] += tmp_stats[x];
- count[s_eoTable[x]] += tmp_count[x];
- }
+ primitives.saoCuStatsE1(fenc0 + startY * stride, rec0 + startY * stride, stride, upBuff1, endX, endY - startY, m_offsetOrg[plane][SAO_EO_1], m_count[plane][SAO_EO_1]);
}
// SAO_EO_2: // dir: 135
@@ -1614,6 +1588,41 @@
}
// NOTE: must put in namespace X265_NS since we need class SAO
+void saoCuStatsE1_c(const pixel *fenc, const pixel *rec, intptr_t stride, int8_t *upBuff1, int endX, int endY, int32_t *stats, int32_t *count)
+{
+ X265_CHECK(endX <= MAX_CU_SIZE, "endX check failure\n");
+ X265_CHECK(endY <= MAX_CU_SIZE, "endY check failure\n");
+
+ int x, y;
+ int32_t tmp_stats[SAO::NUM_EDGETYPE];
+ int32_t tmp_count[SAO::NUM_EDGETYPE];
+
+ memset(tmp_stats, 0, sizeof(tmp_stats));
+ memset(tmp_count, 0, sizeof(tmp_count));
+
+ for (y = 0; y < endY; y++)
+ {
+ for (x = 0; x < endX; x++)
+ {
+ int signDown = signOf2(rec[x], rec[x + stride]);
+ X265_CHECK(signDown == signOf(rec[x] - rec[x + stride]), "signDown check failure\n");
+ uint32_t edgeType = signDown + upBuff1[x] + 2;
+ upBuff1[x] = (int8_t)(-signDown);
+
+ tmp_stats[edgeType] += (fenc[x] - rec[x]);
+ tmp_count[edgeType]++;
+ }
+ fenc += stride;
+ rec += stride;
+ }
+
+ for (x = 0; x < SAO::NUM_EDGETYPE; x++)
+ {
+ stats[SAO::s_eoTable[x]] += tmp_stats[x];
+ count[SAO::s_eoTable[x]] += tmp_count[x];
+ }
+}
+
void saoCuStatsE2_c(const pixel *fenc, const pixel *rec, intptr_t stride, int8_t *upBuff1, int8_t *upBufft, int endX, int endY, int32_t *stats, int32_t *count)
{
X265_CHECK(endX < MAX_CU_SIZE, "endX check failure\n");
@@ -1694,6 +1703,7 @@
void setupSaoPrimitives_c(EncoderPrimitives &p)
{
// TODO: move other sao functions to here
+ p.saoCuStatsE1 = saoCuStatsE1_c;
p.saoCuStatsE2 = saoCuStatsE2_c;
p.saoCuStatsE3 = saoCuStatsE3_c;
}
More information about the x265-devel
mailing list