Merge "Consistent naming for loop-filter filters."
This commit is contained in:
commit
65762849d1
@ -34,17 +34,44 @@ static INLINE int8_t filter_mask(uint8_t limit, uint8_t blimit,
|
||||
return ~mask;
|
||||
}
|
||||
|
||||
static INLINE int8_t flat_mask4(uint8_t thresh,
|
||||
uint8_t p3, uint8_t p2,
|
||||
uint8_t p1, uint8_t p0,
|
||||
uint8_t q0, uint8_t q1,
|
||||
uint8_t q2, uint8_t q3) {
|
||||
int8_t flat = 0;
|
||||
flat |= (abs(p1 - p0) > thresh) * -1;
|
||||
flat |= (abs(q1 - q0) > thresh) * -1;
|
||||
flat |= (abs(p2 - p0) > thresh) * -1;
|
||||
flat |= (abs(q2 - q0) > thresh) * -1;
|
||||
flat |= (abs(p3 - p0) > thresh) * -1;
|
||||
flat |= (abs(q3 - q0) > thresh) * -1;
|
||||
return ~flat;
|
||||
}
|
||||
|
||||
static INLINE int8_t flat_mask5(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 = ~flat_mask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
flat |= (abs(p4 - p0) > thresh) * -1;
|
||||
flat |= (abs(q4 - q0) > thresh) * -1;
|
||||
return ~flat;
|
||||
}
|
||||
|
||||
// is there high edge variance internal edge: 11111111 yes, 00000000 no
|
||||
static INLINE int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
|
||||
uint8_t q0, uint8_t q1) {
|
||||
static INLINE int8_t hev_mask(uint8_t thresh, uint8_t p1, uint8_t p0,
|
||||
uint8_t q0, uint8_t q1) {
|
||||
int8_t hev = 0;
|
||||
hev |= (abs(p1 - p0) > thresh) * -1;
|
||||
hev |= (abs(q1 - q0) > thresh) * -1;
|
||||
return hev;
|
||||
}
|
||||
|
||||
static INLINE void filter(int8_t mask, uint8_t hev, uint8_t *op1,
|
||||
uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
|
||||
static INLINE void filter4(int8_t mask, uint8_t hev, uint8_t *op1,
|
||||
uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
|
||||
int8_t filter1, filter2;
|
||||
|
||||
const int8_t ps1 = (int8_t) *op1 ^ 0x80;
|
||||
@ -88,8 +115,8 @@ void vp9_loop_filter_horizontal_edge_c(uint8_t *s, int p /* pitch */,
|
||||
const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
|
||||
const int8_t mask = filter_mask(*limit, *blimit,
|
||||
p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
|
||||
filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
|
||||
const int8_t hev = hev_mask(*thresh, p1, p0, q0, q1);
|
||||
filter4(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
|
||||
++s;
|
||||
}
|
||||
}
|
||||
@ -108,45 +135,18 @@ void vp9_loop_filter_vertical_edge_c(uint8_t *s, int pitch,
|
||||
const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
|
||||
const int8_t mask = filter_mask(*limit, *blimit,
|
||||
p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
|
||||
filter(mask, hev, s - 2, s - 1, s, s + 1);
|
||||
const int8_t hev = hev_mask(*thresh, p1, p0, q0, q1);
|
||||
filter4(mask, hev, s - 2, s - 1, s, s + 1);
|
||||
s += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int8_t flatmask4(uint8_t thresh,
|
||||
uint8_t p3, uint8_t p2,
|
||||
uint8_t p1, uint8_t p0,
|
||||
uint8_t q0, uint8_t q1,
|
||||
uint8_t q2, uint8_t q3) {
|
||||
int8_t flat = 0;
|
||||
flat |= (abs(p1 - p0) > thresh) * -1;
|
||||
flat |= (abs(q1 - q0) > thresh) * -1;
|
||||
flat |= (abs(p0 - p2) > thresh) * -1;
|
||||
flat |= (abs(q0 - q2) > thresh) * -1;
|
||||
flat |= (abs(p3 - p0) > thresh) * -1;
|
||||
flat |= (abs(q3 - q0) > thresh) * -1;
|
||||
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(q4 - q0) > thresh) * -1;
|
||||
flat = ~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,
|
||||
uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0,
|
||||
uint8_t *oq0, uint8_t *oq1,
|
||||
uint8_t *oq2, uint8_t *oq3) {
|
||||
// use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line
|
||||
static INLINE void filter8(int8_t mask, uint8_t hev, uint8_t flat,
|
||||
uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0,
|
||||
uint8_t *oq0, uint8_t *oq1,
|
||||
uint8_t *oq2, uint8_t *oq3) {
|
||||
// 7-tap filter [1, 1, 1, 2, 1, 1, 1]
|
||||
if (flat && mask) {
|
||||
const uint8_t p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
|
||||
const uint8_t q0 = *oq0, q1 = *oq1, q2 = *oq2, q3 = *oq3;
|
||||
@ -158,7 +158,7 @@ static INLINE void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
|
||||
*oq1 = ROUND_POWER_OF_TWO(p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3, 3);
|
||||
*oq2 = ROUND_POWER_OF_TWO(p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3, 3);
|
||||
} else {
|
||||
filter(mask, hev, op1, op0, oq0, oq1);
|
||||
filter4(mask, hev, op1, op0, oq0, oq1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,11 +177,10 @@ void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, int p,
|
||||
|
||||
const int8_t mask = filter_mask(*limit, *blimit,
|
||||
p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
|
||||
const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
mbfilter(mask, hev, flat,
|
||||
s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
|
||||
s, s + 1 * p, s + 2 * p, s + 3 * p);
|
||||
const int8_t hev = hev_mask(*thresh, p1, p0, q0, q1);
|
||||
const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
filter8(mask, hev, flat, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
|
||||
s, s + 1 * p, s + 2 * p, s + 3 * p);
|
||||
++s;
|
||||
}
|
||||
}
|
||||
@ -198,23 +197,25 @@ void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, int pitch,
|
||||
const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
|
||||
const int8_t mask = filter_mask(*limit, *blimit,
|
||||
p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t hev = hevmask(thresh[0], p1, p0, q0, q1);
|
||||
const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
mbfilter(mask, hev, flat, s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3);
|
||||
const int8_t hev = hev_mask(thresh[0], p1, p0, q0, q1);
|
||||
const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
filter8(mask, hev, flat, s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3);
|
||||
s += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void wide_mbfilter(int8_t mask, uint8_t hev,
|
||||
uint8_t flat, uint8_t flat2,
|
||||
uint8_t *op7, uint8_t *op6, uint8_t *op5,
|
||||
uint8_t *op4, uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0, uint8_t *oq0,
|
||||
uint8_t *oq1, uint8_t *oq2, uint8_t *oq3,
|
||||
uint8_t *oq4, uint8_t *oq5, uint8_t *oq6,
|
||||
uint8_t *oq7) {
|
||||
// use a 15 tap filter [1,1,1,1,1,1,1,2,1,1,1,1,1,1,1] for flat line
|
||||
static INLINE void filter16(int8_t mask, uint8_t hev,
|
||||
uint8_t flat, uint8_t flat2,
|
||||
uint8_t *op7, uint8_t *op6,
|
||||
uint8_t *op5, uint8_t *op4,
|
||||
uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0,
|
||||
uint8_t *oq0, uint8_t *oq1,
|
||||
uint8_t *oq2, uint8_t *oq3,
|
||||
uint8_t *oq4, uint8_t *oq5,
|
||||
uint8_t *oq6, uint8_t *oq7) {
|
||||
// 15-tap filter [1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1]
|
||||
if (flat2 && flat && mask) {
|
||||
const uint8_t p7 = *op7, p6 = *op6, p5 = *op5, p4 = *op4,
|
||||
p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
|
||||
@ -251,7 +252,7 @@ static INLINE void wide_mbfilter(int8_t mask, uint8_t hev,
|
||||
*oq6 = ROUND_POWER_OF_TWO(p0 +
|
||||
q0 + q1 + q2 + q3 + q4 + q5 + q6 * 2 + q7 * 7, 4);
|
||||
} else {
|
||||
mbfilter(mask, hev, flat, op3, op2, op1, op0, oq0, oq1, oq2, oq3);
|
||||
filter8(mask, hev, flat, op3, op2, op1, op0, oq0, oq1, oq2, oq3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,18 +270,17 @@ void vp9_mb_lpf_horizontal_edge_w_c(uint8_t *s, int p,
|
||||
const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
|
||||
const int8_t mask = filter_mask(*limit, *blimit,
|
||||
p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
|
||||
const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t flat2 = flatmask5(1,
|
||||
const int8_t hev = hev_mask(*thresh, p1, p0, q0, q1);
|
||||
const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t flat2 = flat_mask5(1,
|
||||
s[-8 * p], s[-7 * p], s[-6 * p], s[-5 * p], p0,
|
||||
q0, s[4 * p], s[5 * p], s[6 * p], s[7 * p]);
|
||||
|
||||
wide_mbfilter(mask, hev, flat, flat2,
|
||||
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, s + 1 * p, s + 2 * p, s + 3 * p,
|
||||
s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
|
||||
|
||||
filter16(mask, hev, flat, flat2,
|
||||
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, s + 1 * p, s + 2 * p, s + 3 * p,
|
||||
s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
|
||||
++s;
|
||||
}
|
||||
}
|
||||
@ -296,14 +296,14 @@ void vp9_mb_lpf_vertical_edge_w_c(uint8_t *s, int p,
|
||||
const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
|
||||
const int8_t mask = filter_mask(*limit, *blimit,
|
||||
p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
|
||||
const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t flat2 = flatmask5(1, s[-8], s[-7], s[-6], s[-5], p0,
|
||||
const int8_t hev = hev_mask(*thresh, p1, p0, q0, q1);
|
||||
const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
const int8_t flat2 = flat_mask5(1, s[-8], s[-7], s[-6], s[-5], p0,
|
||||
q0, s[4], s[5], s[6], s[7]);
|
||||
|
||||
wide_mbfilter(mask, hev, flat, flat2,
|
||||
s - 8, s - 7, s - 6, s - 5, s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3, s + 4, s + 5, s + 6, s + 7);
|
||||
filter16(mask, hev, flat, flat2,
|
||||
s - 8, s - 7, s - 6, s - 5, s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3, s + 4, s + 5, s + 6, s + 7);
|
||||
s += p;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user