Commit 3be70f72 authored by Joe Young's avatar Joe Young

[intra-edge] Use 5-tap filter

For intra edge filtering experiment, replace the 2x iteration
(5-6-5) filter with a 5-tap filter (2-4-4-4-2).

BDrate (1 key-frame) for this change:
cif:    +0.02%
midres: +0.04
720p:   -0.01
1080p:  -0.03
4k:     -0.01

BDrate (1 key-frame) for intra-edge experiment:
(05/31, disable rect-tx, ext-tx, delta-q, ext-delta-q)

          1 key-frame     60 frames
         PSNR   SSIM     PSNR  SSIM
cif:    -0.02   -0.01   -0.03  -0.01
midres: -0.02   -0.02   -0.05  -0.10
720p:   -0.36   -0.39   -0.05  -0.06
1080p:  -0.75   -0.88   -0.22  -0.27
4k:     -0.91   -1.12   -0.45  -0.54

Change-Id: I834037e662b4483d4d6bdceb1c1624d56ba293a4
parent 63927c43
......@@ -1887,24 +1887,23 @@ static int intra_edge_filter_strength(int bsz, int delta) {
static void filter_intra_edge(uint8_t *p, int sz, int strength) {
if (!strength) return;
const int kernel[2][3] = { { 4, 8, 4 }, { 5, 6, 5 } };
const int filt = (strength < 2) ? 0 : 1;
const int n_iter = (strength < 3) ? 1 : 2;
const int kernel[3][5] = {
{ 0, 4, 8, 4, 0 }, { 0, 5, 6, 5, 0 }, { 2, 4, 4, 4, 2 }
};
const int filt = strength - 1;
uint8_t edge[129];
for (int ii = 0; ii < n_iter; ii++) {
memcpy(edge, p, sz * sizeof(*p));
for (int i = 1; i < sz - 1; i++) {
int s = 0;
for (int j = 0; j < 3; j++) {
int k = i - 1 + j;
k = (k < 0) ? 0 : k;
k = (k > sz - 1) ? sz - 1 : k;
s += edge[k] * kernel[filt][j];
}
s = (s + 8) >> 4;
p[i] = s;
memcpy(edge, p, sz * sizeof(*p));
for (int i = 1; i < sz - 1; i++) {
int s = 0;
for (int j = 0; j < 5; j++) {
int k = i - 2 + j;
k = (k < 0) ? 0 : k;
k = (k > sz - 1) ? sz - 1 : k;
s += edge[k] * kernel[filt][j];
}
s = (s + 8) >> 4;
p[i] = s;
}
}
......@@ -1912,24 +1911,23 @@ static void filter_intra_edge(uint8_t *p, int sz, int strength) {
static void filter_intra_edge_high(uint16_t *p, int sz, int strength) {
if (!strength) return;
const int kernel[2][3] = { { 4, 8, 4 }, { 5, 6, 5 } };
const int filt = (strength < 2) ? 0 : 1;
const int n_iter = (strength < 3) ? 1 : 2;
const int kernel[3][5] = {
{ 0, 4, 8, 4, 0 }, { 0, 5, 6, 5, 0 }, { 2, 4, 4, 4, 2 }
};
const int filt = strength - 1;
uint16_t edge[129];
for (int ii = 0; ii < n_iter; ii++) {
memcpy(edge, p, sz * sizeof(*p));
for (int i = 1; i < sz - 1; i++) {
int s = 0;
for (int j = 0; j < 3; j++) {
int k = i - 1 + j;
k = (k < 0) ? 0 : k;
k = (k > sz - 1) ? sz - 1 : k;
s += edge[k] * kernel[filt][j];
}
s = (s + 8) >> 4;
p[i] = s;
memcpy(edge, p, sz * sizeof(*p));
for (int i = 1; i < sz - 1; i++) {
int s = 0;
for (int j = 0; j < 5; j++) {
int k = i - 2 + j;
k = (k < 0) ? 0 : k;
k = (k > sz - 1) ? sz - 1 : k;
s += edge[k] * kernel[filt][j];
}
s = (s + 8) >> 4;
p[i] = s;
}
}
#endif // CONFIG_INTRA_EDGE
......
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