Commit b95ed688 authored by Yaowu Xu's avatar Yaowu Xu

a minor change to a portion of loop filtering

The loop filtering used for MB edge or internal edge of a MB using 8x8
tranform was reading 5 pixel each side and writting 3 pixel each side.
With suggestion from Aki and Scott on hardware&software performance,
this commit changed to read 4 pixel each side and write 3 pixel each
side.

Change-Id: I584393906c4f5f948a581d6590959522572743bb
parent 9bf73f46
...@@ -253,19 +253,19 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -253,19 +253,19 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
tx_size >= TX_32X32)) tx_size >= TX_32X32))
) { ) {
if (tx_size >= TX_16X16) if (tx_size >= TX_16X16)
vp9_lpf_mbv_w(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_lpf_mbv_w_c(y_ptr, u_ptr, v_ptr, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
else else
vp9_loop_filter_mbv(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_loop_filter_mbv_c(y_ptr, u_ptr, v_ptr, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
} }
if (!skip_lf) { if (!skip_lf) {
if (tx_size >= TX_8X8) { if (tx_size >= TX_8X8) {
if (tx_size == TX_8X8 && (mode == I8X8_PRED || mode == SPLITMV)) if (tx_size == TX_8X8 && (mode == I8X8_PRED || mode == SPLITMV))
vp9_loop_filter_bv8x8(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_loop_filter_bv8x8_c(y_ptr, u_ptr, v_ptr, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
else else
vp9_loop_filter_bv8x8(y_ptr, NULL, NULL, post->y_stride, vp9_loop_filter_bv8x8_c(y_ptr, NULL, NULL, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
} else { } else {
vp9_loop_filter_bv(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_loop_filter_bv(y_ptr, u_ptr, v_ptr, post->y_stride,
...@@ -280,19 +280,19 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -280,19 +280,19 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
tx_size >= TX_32X32)) tx_size >= TX_32X32))
) { ) {
if (tx_size >= TX_16X16) if (tx_size >= TX_16X16)
vp9_lpf_mbh_w(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_lpf_mbh_w_c(y_ptr, u_ptr, v_ptr, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
else else
vp9_loop_filter_mbh(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_loop_filter_mbh_c(y_ptr, u_ptr, v_ptr, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
} }
if (!skip_lf) { if (!skip_lf) {
if (tx_size >= TX_8X8) { if (tx_size >= TX_8X8) {
if (tx_size == TX_8X8 && (mode == I8X8_PRED || mode == SPLITMV)) if (tx_size == TX_8X8 && (mode == I8X8_PRED || mode == SPLITMV))
vp9_loop_filter_bh8x8(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_loop_filter_bh8x8_c(y_ptr, u_ptr, v_ptr, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
else else
vp9_loop_filter_bh8x8(y_ptr, NULL, NULL, post->y_stride, vp9_loop_filter_bh8x8_c(y_ptr, NULL, NULL, post->y_stride,
post->uv_stride, &lfi); post->uv_stride, &lfi);
} else { } else {
vp9_loop_filter_bh(y_ptr, u_ptr, v_ptr, post->y_stride, vp9_loop_filter_bh(y_ptr, u_ptr, v_ptr, post->y_stride,
......
...@@ -143,11 +143,11 @@ void vp9_loop_filter_vertical_edge_c(uint8_t *s, ...@@ -143,11 +143,11 @@ void vp9_loop_filter_vertical_edge_c(uint8_t *s,
s += p; s += p;
} while (++i < count * 8); } while (++i < count * 8);
} }
static __inline signed char flatmask(uint8_t thresh, static __inline signed char flatmask4(uint8_t thresh,
uint8_t p4, uint8_t p3, uint8_t p2, uint8_t p3, uint8_t p2,
uint8_t p1, uint8_t p0, uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1, uint8_t q2, uint8_t q0, uint8_t q1,
uint8_t q3, uint8_t q4) { uint8_t q2, uint8_t q3) {
int8_t flat = 0; int8_t flat = 0;
flat |= (abs(p1 - p0) > thresh) * -1; flat |= (abs(p1 - p0) > thresh) * -1;
flat |= (abs(q1 - q0) > thresh) * -1; flat |= (abs(q1 - q0) > thresh) * -1;
...@@ -155,26 +155,34 @@ static __inline signed char flatmask(uint8_t thresh, ...@@ -155,26 +155,34 @@ static __inline signed char flatmask(uint8_t thresh,
flat |= (abs(q0 - q2) > thresh) * -1; flat |= (abs(q0 - q2) > thresh) * -1;
flat |= (abs(p3 - p0) > thresh) * -1; flat |= (abs(p3 - p0) > thresh) * -1;
flat |= (abs(q3 - q0) > thresh) * -1; flat |= (abs(q3 - q0) > thresh) * -1;
flat = ~flat;
return flat;
}
static __inline signed char flatmask5(uint8_t thresh,
uint8_t p4, uint8_t p3, uint8_t p2,
uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1, uint8_t q2,
uint8_t q3, uint8_t q4) {
int8_t flat = 0;
flat |= (abs(p4 - p0) > thresh) * -1; flat |= (abs(p4 - p0) > thresh) * -1;
flat |= (abs(q4 - q0) > thresh) * -1; flat |= (abs(q4 - q0) > thresh) * -1;
flat = ~flat; flat = ~flat;
return flat; return flat & flatmask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3);
} }
static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat, static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
uint8_t *op4, uint8_t *op3, uint8_t *op2, uint8_t *op3, uint8_t *op2,
uint8_t *op1, uint8_t *op0, uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1, uint8_t *oq2, uint8_t *oq0, uint8_t *oq1,
uint8_t *oq3, uint8_t *oq4) { uint8_t *oq2, uint8_t *oq3) {
/* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */ /* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
if (flat && mask) { if (flat && mask) {
uint8_t p0, q0; uint8_t p0, q0;
uint8_t p1, q1; uint8_t p1, q1;
uint8_t p2, q2; uint8_t p2, q2;
uint8_t p3, q3; uint8_t p3, q3;
uint8_t p4, q4;
p4 = *op4;
p3 = *op3; p3 = *op3;
p2 = *op2; p2 = *op2;
p1 = *op1; p1 = *op1;
...@@ -183,14 +191,13 @@ static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat, ...@@ -183,14 +191,13 @@ static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
q1 = *oq1; q1 = *oq1;
q2 = *oq2; q2 = *oq2;
q3 = *oq3; q3 = *oq3;
q4 = *oq4;
*op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3; *op2 = (p3 + p3 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
*op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3; *op1 = (p3 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
*op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3; *op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3;
*oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3; *oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3;
*oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4) >> 3; *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3 + 4) >> 3;
*oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3; *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3 + 4) >> 3;
} else { } else {
int8_t ps0, qs0; int8_t ps0, qs0;
int8_t ps1, qs1; int8_t ps1, qs1;
...@@ -254,12 +261,11 @@ void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, ...@@ -254,12 +261,11 @@ void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s,
hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]); hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
flat = flatmask(1, flat = flatmask4(1, s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p], s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]);
mbfilter(mask, hev, flat, mbfilter(mask, hev, flat,
s - 5 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
s, s + 1 * p, s + 2 * p, s + 3 * p, s + 4 * p); s, s + 1 * p, s + 2 * p, s + 3 * p);
++s; ++s;
} while (++i < count * 8); } while (++i < count * 8);
...@@ -283,12 +289,12 @@ void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, ...@@ -283,12 +289,12 @@ void vp9_mbloop_filter_vertical_edge_c(uint8_t *s,
s[0], s[1], s[2], s[3]); s[0], s[1], s[2], s[3]);
hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]); hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
flat = flatmask(1, flat = flatmask4(1,
s[-5], s[-4], s[-3], s[-2], s[-1], s[-4], s[-3], s[-2], s[-1],
s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]); s[ 0], s[ 1], s[ 2], s[ 3]);
mbfilter(mask, hev, flat, mbfilter(mask, hev, flat,
s - 5, s - 4, s - 3, s - 2, s - 1, s - 4, s - 3, s - 2, s - 1,
s, s + 1, s + 2, s + 3, s + 4); s, s + 1, s + 2, s + 3);
s += p; s += p;
} while (++i < count * 8); } while (++i < count * 8);
...@@ -550,9 +556,7 @@ static __inline void wide_mbfilter(int8_t mask, uint8_t hev, ...@@ -550,9 +556,7 @@ static __inline void wide_mbfilter(int8_t mask, uint8_t hev,
unsigned char p1, q1; unsigned char p1, q1;
unsigned char p2, q2; unsigned char p2, q2;
unsigned char p3, q3; unsigned char p3, q3;
unsigned char p4, q4;
p4 = *op4;
p3 = *op3; p3 = *op3;
p2 = *op2; p2 = *op2;
p1 = *op1; p1 = *op1;
...@@ -561,14 +565,13 @@ static __inline void wide_mbfilter(int8_t mask, uint8_t hev, ...@@ -561,14 +565,13 @@ static __inline void wide_mbfilter(int8_t mask, uint8_t hev,
q1 = *oq1; q1 = *oq1;
q2 = *oq2; q2 = *oq2;
q3 = *oq3; q3 = *oq3;
q4 = *oq4;
*op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3; *op2 = (p3 + p3 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
*op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3; *op1 = (p3 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
*op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3; *op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3;
*oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3; *oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3;
*oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4) >> 3; *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3 + 4) >> 3;
*oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3; *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3 + 4) >> 3;
} else { } else {
signed char ps0, qs0; signed char ps0, qs0;
signed char ps1, qs1; signed char ps1, qs1;
...@@ -636,19 +639,19 @@ void vp9_mb_lpf_horizontal_edge_w ...@@ -636,19 +639,19 @@ void vp9_mb_lpf_horizontal_edge_w
hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]); hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
flat = flatmask(1, flat = flatmask4(1,
s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]); s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
flat2 = flatmask(1, flat2 = flatmask5(1,
s[-8 * p], s[-7 * p], s[-6 * p], s[-5 * p], s[-1 * p], s[-8 * p], s[-7 * p], s[-6 * p], s[-5 * p], s[-1 * p],
s[ 0 * p], s[ 4 * p], s[ 5 * p], s[ 6 * p], s[ 7 * p]); s[ 0 * p], s[ 4 * p], s[ 5 * p], s[ 6 * p], s[ 7 * p]);
wide_mbfilter(mask, hev, flat, flat2, wide_mbfilter(mask, hev, flat, flat2,
s - 8 * p, s - 7 * p, s - 6 * p, s - 5 * p, s - 8 * p, s - 7 * p, s - 6 * p, s - 5 * p,
s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
s, s + 1 * p, s + 2 * p, s + 3 * p, s, s + 1 * p, s + 2 * p, s + 3 * p,
s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p); s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
++s; ++s;
} while (++i < count * 8); } while (++i < count * 8);
...@@ -674,18 +677,18 @@ void vp9_mb_lpf_vertical_edge_w ...@@ -674,18 +677,18 @@ void vp9_mb_lpf_vertical_edge_w
s[0], s[1], s[2], s[3]); s[0], s[1], s[2], s[3]);
hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]); hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
flat = flatmask(1, flat = flatmask4(1,
s[-5], s[-4], s[-3], s[-2], s[-1], s[-4], s[-3], s[-2], s[-1],
s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]); s[ 0], s[ 1], s[ 2], s[ 3]);
flat2 = flatmask(1, flat2 = flatmask5(1,
s[-8], s[-7], s[-6], s[-5], s[-1], s[-8], s[-7], s[-6], s[-5], s[-1],
s[ 0], s[ 4], s[ 5], s[ 6], s[ 7]); s[ 0], s[ 4], s[ 5], s[ 6], s[ 7]);
wide_mbfilter(mask, hev, flat, flat2, wide_mbfilter(mask, hev, flat, flat2,
s - 8, s - 7, s - 6, s - 5, s - 8, s - 7, s - 6, s - 5,
s - 4, s - 3, s - 2, s - 1, s - 4, s - 3, s - 2, s - 1,
s, s + 1, s + 2, s + 3, s, s + 1, s + 2, s + 3,
s + 4, s + 5, s + 6, s + 7); s + 4, s + 5, s + 6, s + 7);
s += p; s += p;
} while (++i < count * 8); } while (++i < count * 8);
} }
......
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