Commit 0c459414 authored by Urvang Joshi's avatar Urvang Joshi Committed by James Zern

Revert "highpass_filter: Refactor the highbd and lowbd versions."

This reverts commit c92c6e9d.

Reason for revert:

The lowbd version of the function is called even with CONFIG_HIGHBITDEPTH
on, when bit depth == 8. And that particular case will not work as
before with this change.

BUG=aomedia:442

Change-Id: I50c0a1238c93d2c729ab878cf04ca417fee3b202
parent 7ee540dc
......@@ -750,14 +750,8 @@ void av1_selfguided_restoration_c(uint8_t *dgd, int width, int height,
tmpbuf);
}
static void highpass_filter_c_helper(void *dgd_void, int width, int height,
int stride, int32_t *dst, int dst_stride,
int corner, int edge) {
#if CONFIG_HIGHBITDEPTH
uint16_t *dgd = (uint16_t *)dgd_void;
#else
uint8_t *dgd = (uint8_t *)dgd_void;
#endif
void av1_highpass_filter_c(uint8_t *dgd, int width, int height, int stride,
int32_t *dst, int dst_stride, int corner, int edge) {
int i, j;
const int center = (1 << SGRPROJ_RST_BITS) - 4 * (corner + edge);
......@@ -846,12 +840,6 @@ static void highpass_filter_c_helper(void *dgd_void, int width, int height,
}
}
void av1_highpass_filter_c(uint8_t *dgd, int width, int height, int stride,
int32_t *dst, int dst_stride, int corner, int edge) {
highpass_filter_c_helper(dgd, width, height, stride, dst, dst_stride, corner,
edge);
}
void apply_selfguided_restoration_c(uint8_t *dat, int width, int height,
int stride, int eps, int *xqd, uint8_t *dst,
int dst_stride, int32_t *tmpbuf) {
......@@ -1042,8 +1030,92 @@ void av1_selfguided_restoration_highbd_c(uint16_t *dgd, int width, int height,
void av1_highpass_filter_highbd_c(uint16_t *dgd, int width, int height,
int stride, int32_t *dst, int dst_stride,
int corner, int edge) {
highpass_filter_c_helper(dgd, width, height, stride, dst, dst_stride, corner,
edge);
int i, j;
const int center = (1 << SGRPROJ_RST_BITS) - 4 * (corner + edge);
i = 0;
j = 0;
{
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] =
center * dgd[k] + edge * (dgd[k + 1] + dgd[k + stride] + dgd[k] * 2) +
corner * (dgd[k + stride + 1] + dgd[k + 1] + dgd[k + stride] + dgd[k]);
}
i = 0;
j = width - 1;
{
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] =
center * dgd[k] + edge * (dgd[k - 1] + dgd[k + stride] + dgd[k] * 2) +
corner * (dgd[k + stride - 1] + dgd[k - 1] + dgd[k + stride] + dgd[k]);
}
i = height - 1;
j = 0;
{
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] =
center * dgd[k] + edge * (dgd[k + 1] + dgd[k - stride] + dgd[k] * 2) +
corner * (dgd[k - stride + 1] + dgd[k + 1] + dgd[k - stride] + dgd[k]);
}
i = height - 1;
j = width - 1;
{
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] =
center * dgd[k] + edge * (dgd[k - 1] + dgd[k - stride] + dgd[k] * 2) +
corner * (dgd[k - stride - 1] + dgd[k - 1] + dgd[k - stride] + dgd[k]);
}
i = 0;
for (j = 1; j < width - 1; ++j) {
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] = center * dgd[k] +
edge * (dgd[k - 1] + dgd[k + stride] + dgd[k + 1] + dgd[k]) +
corner * (dgd[k + stride - 1] + dgd[k + stride + 1] + dgd[k - 1] +
dgd[k + 1]);
}
i = height - 1;
for (j = 1; j < width - 1; ++j) {
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] = center * dgd[k] +
edge * (dgd[k - 1] + dgd[k - stride] + dgd[k + 1] + dgd[k]) +
corner * (dgd[k - stride - 1] + dgd[k - stride + 1] + dgd[k - 1] +
dgd[k + 1]);
}
j = 0;
for (i = 1; i < height - 1; ++i) {
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] = center * dgd[k] +
edge * (dgd[k - stride] + dgd[k + 1] + dgd[k + stride] + dgd[k]) +
corner * (dgd[k + stride + 1] + dgd[k - stride + 1] +
dgd[k - stride] + dgd[k + stride]);
}
j = width - 1;
for (i = 1; i < height - 1; ++i) {
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] = center * dgd[k] +
edge * (dgd[k - stride] + dgd[k - 1] + dgd[k + stride] + dgd[k]) +
corner * (dgd[k + stride - 1] + dgd[k - stride - 1] +
dgd[k - stride] + dgd[k + stride]);
}
for (i = 1; i < height - 1; ++i) {
for (j = 1; j < width - 1; ++j) {
const int k = i * stride + j;
const int l = i * dst_stride + j;
dst[l] =
center * dgd[k] +
edge * (dgd[k - stride] + dgd[k - 1] + dgd[k + stride] + dgd[k + 1]) +
corner * (dgd[k + stride - 1] + dgd[k - stride - 1] +
dgd[k - stride + 1] + dgd[k + stride + 1]);
}
}
}
void apply_selfguided_restoration_highbd_c(uint16_t *dat, int width, int height,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment