Refactor fast loop filter code to handle 444.
Change-Id: I921b1ebabdf617049f8fa26fbe462c3ff115c1ce
This commit is contained in:
parent
c77d4dcb35
commit
a1e20ec58f
@ -293,7 +293,7 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm, int default_filt_lvl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void filter_selectively_vert_row2(PLANE_TYPE plane_type,
|
static void filter_selectively_vert_row2(int subsampling_factor,
|
||||||
uint8_t *s, int pitch,
|
uint8_t *s, int pitch,
|
||||||
unsigned int mask_16x16_l,
|
unsigned int mask_16x16_l,
|
||||||
unsigned int mask_8x8_l,
|
unsigned int mask_8x8_l,
|
||||||
@ -301,9 +301,9 @@ static void filter_selectively_vert_row2(PLANE_TYPE plane_type,
|
|||||||
unsigned int mask_4x4_int_l,
|
unsigned int mask_4x4_int_l,
|
||||||
const loop_filter_info_n *lfi_n,
|
const loop_filter_info_n *lfi_n,
|
||||||
const uint8_t *lfl) {
|
const uint8_t *lfl) {
|
||||||
const int mask_shift = plane_type ? 4 : 8;
|
const int mask_shift = subsampling_factor ? 4 : 8;
|
||||||
const int mask_cutoff = plane_type ? 0xf : 0xff;
|
const int mask_cutoff = subsampling_factor ? 0xf : 0xff;
|
||||||
const int lfl_forward = plane_type ? 4 : 8;
|
const int lfl_forward = subsampling_factor ? 4 : 8;
|
||||||
|
|
||||||
unsigned int mask_16x16_0 = mask_16x16_l & mask_cutoff;
|
unsigned int mask_16x16_0 = mask_16x16_l & mask_cutoff;
|
||||||
unsigned int mask_8x8_0 = mask_8x8_l & mask_cutoff;
|
unsigned int mask_8x8_0 = mask_8x8_l & mask_cutoff;
|
||||||
@ -393,7 +393,7 @@ static void filter_selectively_vert_row2(PLANE_TYPE plane_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
static void highbd_filter_selectively_vert_row2(PLANE_TYPE plane_type,
|
static void highbd_filter_selectively_vert_row2(int subsampling_factor,
|
||||||
uint16_t *s, int pitch,
|
uint16_t *s, int pitch,
|
||||||
unsigned int mask_16x16_l,
|
unsigned int mask_16x16_l,
|
||||||
unsigned int mask_8x8_l,
|
unsigned int mask_8x8_l,
|
||||||
@ -401,9 +401,9 @@ static void highbd_filter_selectively_vert_row2(PLANE_TYPE plane_type,
|
|||||||
unsigned int mask_4x4_int_l,
|
unsigned int mask_4x4_int_l,
|
||||||
const loop_filter_info_n *lfi_n,
|
const loop_filter_info_n *lfi_n,
|
||||||
const uint8_t *lfl, int bd) {
|
const uint8_t *lfl, int bd) {
|
||||||
const int mask_shift = plane_type ? 4 : 8;
|
const int mask_shift = subsampling_factor ? 4 : 8;
|
||||||
const int mask_cutoff = plane_type ? 0xf : 0xff;
|
const int mask_cutoff = subsampling_factor ? 0xf : 0xff;
|
||||||
const int lfl_forward = plane_type ? 4 : 8;
|
const int lfl_forward = subsampling_factor ? 4 : 8;
|
||||||
|
|
||||||
unsigned int mask_16x16_0 = mask_16x16_l & mask_cutoff;
|
unsigned int mask_16x16_0 = mask_16x16_l & mask_cutoff;
|
||||||
unsigned int mask_8x8_0 = mask_8x8_l & mask_cutoff;
|
unsigned int mask_8x8_0 = mask_8x8_l & mask_cutoff;
|
||||||
@ -1326,248 +1326,203 @@ void vp9_filter_block_plane_non420(VP9_COMMON *cm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_filter_block_plane(VP9_COMMON *const cm,
|
void vp9_filter_block_plane_ss00(VP9_COMMON *const cm,
|
||||||
struct macroblockd_plane *const plane,
|
struct macroblockd_plane *const plane,
|
||||||
int mi_row,
|
int mi_row,
|
||||||
LOOP_FILTER_MASK *lfm) {
|
LOOP_FILTER_MASK *lfm) {
|
||||||
struct buf_2d *const dst = &plane->dst;
|
struct buf_2d *const dst = &plane->dst;
|
||||||
uint8_t* const dst0 = dst->buf;
|
uint8_t *const dst0 = dst->buf;
|
||||||
int r, c;
|
int r;
|
||||||
|
uint64_t mask_16x16 = lfm->left_y[TX_16X16];
|
||||||
|
uint64_t mask_8x8 = lfm->left_y[TX_8X8];
|
||||||
|
uint64_t mask_4x4 = lfm->left_y[TX_4X4];
|
||||||
|
uint64_t mask_4x4_int = lfm->int_4x4_y;
|
||||||
|
|
||||||
if (!plane->plane_type) {
|
assert(plane->subsampling_x == 0 && plane->subsampling_y == 0);
|
||||||
uint64_t mask_16x16 = lfm->left_y[TX_16X16];
|
|
||||||
uint64_t mask_8x8 = lfm->left_y[TX_8X8];
|
|
||||||
uint64_t mask_4x4 = lfm->left_y[TX_4X4];
|
|
||||||
uint64_t mask_4x4_int = lfm->int_4x4_y;
|
|
||||||
|
|
||||||
// Vertical pass: do 2 rows at one time
|
// Vertical pass: do 2 rows at one time
|
||||||
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
|
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
|
||||||
unsigned int mask_16x16_l = mask_16x16 & 0xffff;
|
unsigned int mask_16x16_l = mask_16x16 & 0xffff;
|
||||||
unsigned int mask_8x8_l = mask_8x8 & 0xffff;
|
unsigned int mask_8x8_l = mask_8x8 & 0xffff;
|
||||||
unsigned int mask_4x4_l = mask_4x4 & 0xffff;
|
unsigned int mask_4x4_l = mask_4x4 & 0xffff;
|
||||||
unsigned int mask_4x4_int_l = mask_4x4_int & 0xffff;
|
unsigned int mask_4x4_int_l = mask_4x4_int & 0xffff;
|
||||||
|
|
||||||
// Disable filtering on the leftmost column.
|
// Disable filtering on the leftmost column.
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
if (cm->use_highbitdepth) {
|
if (cm->use_highbitdepth) {
|
||||||
highbd_filter_selectively_vert_row2(plane->plane_type,
|
highbd_filter_selectively_vert_row2(
|
||||||
CONVERT_TO_SHORTPTR(dst->buf),
|
plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride,
|
||||||
dst->stride,
|
mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
|
||||||
mask_16x16_l,
|
&lfm->lfl_y[r << 3], (int)cm->bit_depth);
|
||||||
mask_8x8_l,
|
} else {
|
||||||
mask_4x4_l,
|
filter_selectively_vert_row2(
|
||||||
mask_4x4_int_l,
|
plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l,
|
||||||
&cm->lf_info, &lfm->lfl_y[r << 3],
|
mask_4x4_l, mask_4x4_int_l, &cm->lf_info, &lfm->lfl_y[r << 3]);
|
||||||
(int)cm->bit_depth);
|
}
|
||||||
} else {
|
|
||||||
filter_selectively_vert_row2(plane->plane_type,
|
|
||||||
dst->buf, dst->stride,
|
|
||||||
mask_16x16_l,
|
|
||||||
mask_8x8_l,
|
|
||||||
mask_4x4_l,
|
|
||||||
mask_4x4_int_l,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_y[r << 3]);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
filter_selectively_vert_row2(plane->plane_type,
|
filter_selectively_vert_row2(
|
||||||
dst->buf, dst->stride,
|
plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l,
|
||||||
mask_16x16_l,
|
mask_4x4_l, mask_4x4_int_l, &cm->lf_info, &lfm->lfl_y[r << 3]);
|
||||||
mask_8x8_l,
|
|
||||||
mask_4x4_l,
|
|
||||||
mask_4x4_int_l,
|
|
||||||
&cm->lf_info, &lfm->lfl_y[r << 3]);
|
|
||||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
dst->buf += 16 * dst->stride;
|
dst->buf += 16 * dst->stride;
|
||||||
mask_16x16 >>= 16;
|
mask_16x16 >>= 16;
|
||||||
mask_8x8 >>= 16;
|
mask_8x8 >>= 16;
|
||||||
mask_4x4 >>= 16;
|
mask_4x4 >>= 16;
|
||||||
mask_4x4_int >>= 16;
|
mask_4x4_int >>= 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Horizontal pass
|
||||||
|
dst->buf = dst0;
|
||||||
|
mask_16x16 = lfm->above_y[TX_16X16];
|
||||||
|
mask_8x8 = lfm->above_y[TX_8X8];
|
||||||
|
mask_4x4 = lfm->above_y[TX_4X4];
|
||||||
|
mask_4x4_int = lfm->int_4x4_y;
|
||||||
|
|
||||||
|
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r++) {
|
||||||
|
unsigned int mask_16x16_r;
|
||||||
|
unsigned int mask_8x8_r;
|
||||||
|
unsigned int mask_4x4_r;
|
||||||
|
|
||||||
|
if (mi_row + r == 0) {
|
||||||
|
mask_16x16_r = 0;
|
||||||
|
mask_8x8_r = 0;
|
||||||
|
mask_4x4_r = 0;
|
||||||
|
} else {
|
||||||
|
mask_16x16_r = mask_16x16 & 0xff;
|
||||||
|
mask_8x8_r = mask_8x8 & 0xff;
|
||||||
|
mask_4x4_r = mask_4x4 & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal pass
|
|
||||||
dst->buf = dst0;
|
|
||||||
mask_16x16 = lfm->above_y[TX_16X16];
|
|
||||||
mask_8x8 = lfm->above_y[TX_8X8];
|
|
||||||
mask_4x4 = lfm->above_y[TX_4X4];
|
|
||||||
mask_4x4_int = lfm->int_4x4_y;
|
|
||||||
|
|
||||||
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r++) {
|
|
||||||
unsigned int mask_16x16_r;
|
|
||||||
unsigned int mask_8x8_r;
|
|
||||||
unsigned int mask_4x4_r;
|
|
||||||
|
|
||||||
if (mi_row + r == 0) {
|
|
||||||
mask_16x16_r = 0;
|
|
||||||
mask_8x8_r = 0;
|
|
||||||
mask_4x4_r = 0;
|
|
||||||
} else {
|
|
||||||
mask_16x16_r = mask_16x16 & 0xff;
|
|
||||||
mask_8x8_r = mask_8x8 & 0xff;
|
|
||||||
mask_4x4_r = mask_4x4 & 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
if (cm->use_highbitdepth) {
|
if (cm->use_highbitdepth) {
|
||||||
highbd_filter_selectively_horiz(CONVERT_TO_SHORTPTR(dst->buf),
|
highbd_filter_selectively_horiz(
|
||||||
dst->stride,
|
CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_r, mask_8x8_r,
|
||||||
mask_16x16_r,
|
mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info, &lfm->lfl_y[r << 3],
|
||||||
mask_8x8_r,
|
(int)cm->bit_depth);
|
||||||
mask_4x4_r,
|
} else {
|
||||||
mask_4x4_int & 0xff,
|
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
|
||||||
&cm->lf_info,
|
mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info,
|
||||||
&lfm->lfl_y[r << 3],
|
|
||||||
(int)cm->bit_depth);
|
|
||||||
} else {
|
|
||||||
filter_selectively_horiz(dst->buf, dst->stride,
|
|
||||||
mask_16x16_r,
|
|
||||||
mask_8x8_r,
|
|
||||||
mask_4x4_r,
|
|
||||||
mask_4x4_int & 0xff,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_y[r << 3]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
filter_selectively_horiz(dst->buf, dst->stride,
|
|
||||||
mask_16x16_r,
|
|
||||||
mask_8x8_r,
|
|
||||||
mask_4x4_r,
|
|
||||||
mask_4x4_int & 0xff,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_y[r << 3]);
|
&lfm->lfl_y[r << 3]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
|
||||||
|
mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info,
|
||||||
|
&lfm->lfl_y[r << 3]);
|
||||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
|
||||||
dst->buf += 8 * dst->stride;
|
dst->buf += 8 * dst->stride;
|
||||||
|
mask_16x16 >>= 8;
|
||||||
|
mask_8x8 >>= 8;
|
||||||
|
mask_4x4 >>= 8;
|
||||||
|
mask_4x4_int >>= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void vp9_filter_block_plane_ss11(VP9_COMMON *const cm,
|
||||||
|
struct macroblockd_plane *const plane,
|
||||||
|
int mi_row,
|
||||||
|
LOOP_FILTER_MASK *lfm) {
|
||||||
|
struct buf_2d *const dst = &plane->dst;
|
||||||
|
uint8_t *const dst0 = dst->buf;
|
||||||
|
int r, c;
|
||||||
|
|
||||||
|
uint16_t mask_16x16 = lfm->left_uv[TX_16X16];
|
||||||
|
uint16_t mask_8x8 = lfm->left_uv[TX_8X8];
|
||||||
|
uint16_t mask_4x4 = lfm->left_uv[TX_4X4];
|
||||||
|
uint16_t mask_4x4_int = lfm->int_4x4_uv;
|
||||||
|
|
||||||
|
assert(plane->subsampling_x == 1 && plane->subsampling_y == 1);
|
||||||
|
|
||||||
|
// Vertical pass: do 2 rows at one time
|
||||||
|
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 4) {
|
||||||
|
if (plane->plane_type == 1) {
|
||||||
|
for (c = 0; c < (MI_BLOCK_SIZE >> 1); c++) {
|
||||||
|
lfm->lfl_uv[(r << 1) + c] = lfm->lfl_y[(r << 3) + (c << 1)];
|
||||||
|
lfm->lfl_uv[((r + 2) << 1) + c] = lfm->lfl_y[((r + 2) << 3) + (c << 1)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
unsigned int mask_16x16_l = mask_16x16 & 0xff;
|
||||||
|
unsigned int mask_8x8_l = mask_8x8 & 0xff;
|
||||||
|
unsigned int mask_4x4_l = mask_4x4 & 0xff;
|
||||||
|
unsigned int mask_4x4_int_l = mask_4x4_int & 0xff;
|
||||||
|
|
||||||
|
// Disable filtering on the leftmost column.
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
if (cm->use_highbitdepth) {
|
||||||
|
highbd_filter_selectively_vert_row2(
|
||||||
|
plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride,
|
||||||
|
mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
|
||||||
|
&lfm->lfl_uv[r << 1], (int)cm->bit_depth);
|
||||||
|
} else {
|
||||||
|
filter_selectively_vert_row2(
|
||||||
|
plane->subsampling_x, dst->buf, dst->stride,
|
||||||
|
mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
|
||||||
|
&lfm->lfl_uv[r << 1]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
filter_selectively_vert_row2(
|
||||||
|
plane->subsampling_x, dst->buf, dst->stride,
|
||||||
|
mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
|
||||||
|
&lfm->lfl_uv[r << 1]);
|
||||||
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
|
||||||
|
dst->buf += 16 * dst->stride;
|
||||||
mask_16x16 >>= 8;
|
mask_16x16 >>= 8;
|
||||||
mask_8x8 >>= 8;
|
mask_8x8 >>= 8;
|
||||||
mask_4x4 >>= 8;
|
mask_4x4 >>= 8;
|
||||||
mask_4x4_int >>= 8;
|
mask_4x4_int >>= 8;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
uint16_t mask_16x16 = lfm->left_uv[TX_16X16];
|
|
||||||
uint16_t mask_8x8 = lfm->left_uv[TX_8X8];
|
|
||||||
uint16_t mask_4x4 = lfm->left_uv[TX_4X4];
|
|
||||||
uint16_t mask_4x4_int = lfm->int_4x4_uv;
|
|
||||||
|
|
||||||
// Vertical pass: do 2 rows at one time
|
// Horizontal pass
|
||||||
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 4) {
|
dst->buf = dst0;
|
||||||
if (plane->plane_type == 1) {
|
mask_16x16 = lfm->above_uv[TX_16X16];
|
||||||
for (c = 0; c < (MI_BLOCK_SIZE >> 1); c++) {
|
mask_8x8 = lfm->above_uv[TX_8X8];
|
||||||
lfm->lfl_uv[(r << 1) + c] = lfm->lfl_y[(r << 3) + (c << 1)];
|
mask_4x4 = lfm->above_uv[TX_4X4];
|
||||||
lfm->lfl_uv[((r + 2) << 1) + c] = lfm->lfl_y[((r + 2) << 3) +
|
mask_4x4_int = lfm->int_4x4_uv;
|
||||||
(c << 1)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
|
||||||
unsigned int mask_16x16_l = mask_16x16 & 0xff;
|
const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
|
||||||
unsigned int mask_8x8_l = mask_8x8 & 0xff;
|
const unsigned int mask_4x4_int_r =
|
||||||
unsigned int mask_4x4_l = mask_4x4 & 0xff;
|
skip_border_4x4_r ? 0 : (mask_4x4_int & 0xf);
|
||||||
unsigned int mask_4x4_int_l = mask_4x4_int & 0xff;
|
unsigned int mask_16x16_r;
|
||||||
|
unsigned int mask_8x8_r;
|
||||||
|
unsigned int mask_4x4_r;
|
||||||
|
|
||||||
// Disable filtering on the leftmost column.
|
if (mi_row + r == 0) {
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
mask_16x16_r = 0;
|
||||||
if (cm->use_highbitdepth) {
|
mask_8x8_r = 0;
|
||||||
highbd_filter_selectively_vert_row2(plane->plane_type,
|
mask_4x4_r = 0;
|
||||||
CONVERT_TO_SHORTPTR(dst->buf),
|
} else {
|
||||||
dst->stride,
|
mask_16x16_r = mask_16x16 & 0xf;
|
||||||
mask_16x16_l,
|
mask_8x8_r = mask_8x8 & 0xf;
|
||||||
mask_8x8_l,
|
mask_4x4_r = mask_4x4 & 0xf;
|
||||||
mask_4x4_l,
|
|
||||||
mask_4x4_int_l,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_uv[r << 1],
|
|
||||||
(int)cm->bit_depth);
|
|
||||||
} else {
|
|
||||||
filter_selectively_vert_row2(plane->plane_type,
|
|
||||||
dst->buf, dst->stride,
|
|
||||||
mask_16x16_l,
|
|
||||||
mask_8x8_l,
|
|
||||||
mask_4x4_l,
|
|
||||||
mask_4x4_int_l,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_uv[r << 1]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
filter_selectively_vert_row2(plane->plane_type,
|
|
||||||
dst->buf, dst->stride,
|
|
||||||
mask_16x16_l,
|
|
||||||
mask_8x8_l,
|
|
||||||
mask_4x4_l,
|
|
||||||
mask_4x4_int_l,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_uv[r << 1]);
|
|
||||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
|
||||||
|
|
||||||
dst->buf += 16 * dst->stride;
|
|
||||||
mask_16x16 >>= 8;
|
|
||||||
mask_8x8 >>= 8;
|
|
||||||
mask_4x4 >>= 8;
|
|
||||||
mask_4x4_int >>= 8;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal pass
|
|
||||||
dst->buf = dst0;
|
|
||||||
mask_16x16 = lfm->above_uv[TX_16X16];
|
|
||||||
mask_8x8 = lfm->above_uv[TX_8X8];
|
|
||||||
mask_4x4 = lfm->above_uv[TX_4X4];
|
|
||||||
mask_4x4_int = lfm->int_4x4_uv;
|
|
||||||
|
|
||||||
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
|
|
||||||
const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
|
|
||||||
const unsigned int mask_4x4_int_r = skip_border_4x4_r ?
|
|
||||||
0 : (mask_4x4_int & 0xf);
|
|
||||||
unsigned int mask_16x16_r;
|
|
||||||
unsigned int mask_8x8_r;
|
|
||||||
unsigned int mask_4x4_r;
|
|
||||||
|
|
||||||
if (mi_row + r == 0) {
|
|
||||||
mask_16x16_r = 0;
|
|
||||||
mask_8x8_r = 0;
|
|
||||||
mask_4x4_r = 0;
|
|
||||||
} else {
|
|
||||||
mask_16x16_r = mask_16x16 & 0xf;
|
|
||||||
mask_8x8_r = mask_8x8 & 0xf;
|
|
||||||
mask_4x4_r = mask_4x4 & 0xf;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
if (cm->use_highbitdepth) {
|
if (cm->use_highbitdepth) {
|
||||||
highbd_filter_selectively_horiz(CONVERT_TO_SHORTPTR(dst->buf),
|
highbd_filter_selectively_horiz(CONVERT_TO_SHORTPTR(dst->buf),
|
||||||
dst->stride,
|
dst->stride, mask_16x16_r, mask_8x8_r,
|
||||||
mask_16x16_r,
|
mask_4x4_r, mask_4x4_int_r, &cm->lf_info,
|
||||||
mask_8x8_r,
|
&lfm->lfl_uv[r << 1], (int)cm->bit_depth);
|
||||||
mask_4x4_r,
|
} else {
|
||||||
mask_4x4_int_r,
|
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
|
||||||
&cm->lf_info,
|
mask_4x4_r, mask_4x4_int_r, &cm->lf_info,
|
||||||
&lfm->lfl_uv[r << 1],
|
|
||||||
(int)cm->bit_depth);
|
|
||||||
} else {
|
|
||||||
filter_selectively_horiz(dst->buf, dst->stride,
|
|
||||||
mask_16x16_r,
|
|
||||||
mask_8x8_r,
|
|
||||||
mask_4x4_r,
|
|
||||||
mask_4x4_int_r,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_uv[r << 1]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
filter_selectively_horiz(dst->buf, dst->stride,
|
|
||||||
mask_16x16_r,
|
|
||||||
mask_8x8_r,
|
|
||||||
mask_4x4_r,
|
|
||||||
mask_4x4_int_r,
|
|
||||||
&cm->lf_info,
|
|
||||||
&lfm->lfl_uv[r << 1]);
|
&lfm->lfl_uv[r << 1]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
|
||||||
|
mask_4x4_r, mask_4x4_int_r, &cm->lf_info,
|
||||||
|
&lfm->lfl_uv[r << 1]);
|
||||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
|
||||||
dst->buf += 8 * dst->stride;
|
dst->buf += 8 * dst->stride;
|
||||||
mask_16x16 >>= 4;
|
mask_16x16 >>= 4;
|
||||||
mask_8x8 >>= 4;
|
mask_8x8 >>= 4;
|
||||||
mask_4x4 >>= 4;
|
mask_4x4 >>= 4;
|
||||||
mask_4x4_int >>= 4;
|
mask_4x4_int >>= 4;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1576,11 +1531,19 @@ void vp9_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
|
|||||||
struct macroblockd_plane planes[MAX_MB_PLANE],
|
struct macroblockd_plane planes[MAX_MB_PLANE],
|
||||||
int start, int stop, int y_only) {
|
int start, int stop, int y_only) {
|
||||||
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
|
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
|
||||||
const int use_420 = y_only || (planes[1].subsampling_y == 1 &&
|
enum lf_path path;
|
||||||
planes[1].subsampling_x == 1);
|
|
||||||
LOOP_FILTER_MASK lfm;
|
LOOP_FILTER_MASK lfm;
|
||||||
int mi_row, mi_col;
|
int mi_row, mi_col;
|
||||||
|
|
||||||
|
if (y_only)
|
||||||
|
path = LF_PATH_444;
|
||||||
|
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
|
||||||
|
path = LF_PATH_420;
|
||||||
|
else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
|
||||||
|
path = LF_PATH_444;
|
||||||
|
else
|
||||||
|
path = LF_PATH_SLOW;
|
||||||
|
|
||||||
for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) {
|
for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) {
|
||||||
MODE_INFO *mi = cm->mi + mi_row * cm->mi_stride;
|
MODE_INFO *mi = cm->mi + mi_row * cm->mi_stride;
|
||||||
|
|
||||||
@ -1590,16 +1553,23 @@ void vp9_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
|
|||||||
vp9_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
|
vp9_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
|
||||||
|
|
||||||
// TODO(JBB): Make setup_mask work for non 420.
|
// TODO(JBB): Make setup_mask work for non 420.
|
||||||
if (use_420)
|
vp9_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride,
|
||||||
vp9_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride,
|
&lfm);
|
||||||
&lfm);
|
|
||||||
|
|
||||||
for (plane = 0; plane < num_planes; ++plane) {
|
vp9_filter_block_plane_ss00(cm, &planes[0], mi_row, &lfm);
|
||||||
if (use_420)
|
for (plane = 1; plane < num_planes; ++plane) {
|
||||||
vp9_filter_block_plane(cm, &planes[plane], mi_row, &lfm);
|
switch (path) {
|
||||||
else
|
case LF_PATH_420:
|
||||||
vp9_filter_block_plane_non420(cm, &planes[plane], mi + mi_col,
|
vp9_filter_block_plane_ss11(cm, &planes[plane], mi_row, &lfm);
|
||||||
mi_row, mi_col);
|
break;
|
||||||
|
case LF_PATH_444:
|
||||||
|
vp9_filter_block_plane_ss00(cm, &planes[plane], mi_row, &lfm);
|
||||||
|
break;
|
||||||
|
case LF_PATH_SLOW:
|
||||||
|
vp9_filter_block_plane_non420(cm, &planes[plane], mi + mi_col,
|
||||||
|
mi_row, mi_col);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,12 @@ extern "C" {
|
|||||||
#define MAX_REF_LF_DELTAS 4
|
#define MAX_REF_LF_DELTAS 4
|
||||||
#define MAX_MODE_LF_DELTAS 2
|
#define MAX_MODE_LF_DELTAS 2
|
||||||
|
|
||||||
|
enum lf_path {
|
||||||
|
LF_PATH_420,
|
||||||
|
LF_PATH_444,
|
||||||
|
LF_PATH_SLOW,
|
||||||
|
};
|
||||||
|
|
||||||
struct loopfilter {
|
struct loopfilter {
|
||||||
int filter_level;
|
int filter_level;
|
||||||
|
|
||||||
@ -92,10 +98,15 @@ void vp9_setup_mask(struct VP9Common *const cm,
|
|||||||
MODE_INFO *mi_8x8, const int mode_info_stride,
|
MODE_INFO *mi_8x8, const int mode_info_stride,
|
||||||
LOOP_FILTER_MASK *lfm);
|
LOOP_FILTER_MASK *lfm);
|
||||||
|
|
||||||
void vp9_filter_block_plane(struct VP9Common *const cm,
|
void vp9_filter_block_plane_ss00(struct VP9Common *const cm,
|
||||||
struct macroblockd_plane *const plane,
|
struct macroblockd_plane *const plane,
|
||||||
int mi_row,
|
int mi_row,
|
||||||
LOOP_FILTER_MASK *lfm);
|
LOOP_FILTER_MASK *lfm);
|
||||||
|
|
||||||
|
void vp9_filter_block_plane_ss11(struct VP9Common *const cm,
|
||||||
|
struct macroblockd_plane *const plane,
|
||||||
|
int mi_row,
|
||||||
|
LOOP_FILTER_MASK *lfm);
|
||||||
|
|
||||||
void vp9_filter_block_plane_non420(struct VP9Common *cm,
|
void vp9_filter_block_plane_non420(struct VP9Common *cm,
|
||||||
struct macroblockd_plane *plane,
|
struct macroblockd_plane *plane,
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "vp9/common/vp9_entropymode.h"
|
#include "vp9/common/vp9_entropymode.h"
|
||||||
#include "vp9/common/vp9_thread_common.h"
|
#include "vp9/common/vp9_thread_common.h"
|
||||||
#include "vp9/common/vp9_reconinter.h"
|
#include "vp9/common/vp9_reconinter.h"
|
||||||
|
#include "vp9/common/vp9_loopfilter.h"
|
||||||
|
|
||||||
#if CONFIG_MULTITHREAD
|
#if CONFIG_MULTITHREAD
|
||||||
static INLINE void mutex_lock(pthread_mutex_t *const mutex) {
|
static INLINE void mutex_lock(pthread_mutex_t *const mutex) {
|
||||||
@ -92,10 +93,17 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
|
|||||||
int start, int stop, int y_only,
|
int start, int stop, int y_only,
|
||||||
VP9LfSync *const lf_sync) {
|
VP9LfSync *const lf_sync) {
|
||||||
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
|
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
|
||||||
const int use_420 = y_only || (planes[1].subsampling_y == 1 &&
|
|
||||||
planes[1].subsampling_x == 1);
|
|
||||||
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
|
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
|
||||||
int mi_row, mi_col;
|
int mi_row, mi_col;
|
||||||
|
enum lf_path path;
|
||||||
|
if (y_only)
|
||||||
|
path = LF_PATH_444;
|
||||||
|
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
|
||||||
|
path = LF_PATH_420;
|
||||||
|
else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
|
||||||
|
path = LF_PATH_444;
|
||||||
|
else
|
||||||
|
path = LF_PATH_SLOW;
|
||||||
|
|
||||||
for (mi_row = start; mi_row < stop;
|
for (mi_row = start; mi_row < stop;
|
||||||
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) {
|
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) {
|
||||||
@ -112,16 +120,23 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
|
|||||||
vp9_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
|
vp9_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
|
||||||
|
|
||||||
// TODO(JBB): Make setup_mask work for non 420.
|
// TODO(JBB): Make setup_mask work for non 420.
|
||||||
if (use_420)
|
vp9_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride,
|
||||||
vp9_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride,
|
&lfm);
|
||||||
&lfm);
|
|
||||||
|
|
||||||
for (plane = 0; plane < num_planes; ++plane) {
|
vp9_filter_block_plane_ss00(cm, &planes[0], mi_row, &lfm);
|
||||||
if (use_420)
|
for (plane = 1; plane < num_planes; ++plane) {
|
||||||
vp9_filter_block_plane(cm, &planes[plane], mi_row, &lfm);
|
switch (path) {
|
||||||
else
|
case LF_PATH_420:
|
||||||
vp9_filter_block_plane_non420(cm, &planes[plane], mi + mi_col,
|
vp9_filter_block_plane_ss11(cm, &planes[plane], mi_row, &lfm);
|
||||||
mi_row, mi_col);
|
break;
|
||||||
|
case LF_PATH_444:
|
||||||
|
vp9_filter_block_plane_ss00(cm, &planes[plane], mi_row, &lfm);
|
||||||
|
break;
|
||||||
|
case LF_PATH_SLOW:
|
||||||
|
vp9_filter_block_plane_non420(cm, &planes[plane], mi + mi_col,
|
||||||
|
mi_row, mi_col);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_write(lf_sync, r, c, sb_cols);
|
sync_write(lf_sync, r, c, sb_cols);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user