mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 12:44:07 +00:00
Perform deblocking on 4x4 grid instead of 8x8
This commit is contained in:
parent
1aaa95601c
commit
e521a59cd5
22
src/filter.c
22
src/filter.c
|
@ -1131,8 +1131,8 @@ static void filter_deblock_unit(encoder_state_t * const state,
|
|||
|
||||
if (rightmost_8px_of_lcu && !rightmost_8px_of_frame) {
|
||||
// The last 8 pixels will be deblocked when processing the next LCU.
|
||||
length = width - 8;
|
||||
length_c = (width >> 1) - 4;
|
||||
length = width - 4;
|
||||
length_c = (width >> 1) - 2;
|
||||
if (length == 0) return;
|
||||
|
||||
} else {
|
||||
|
@ -1175,11 +1175,11 @@ static void filter_deblock_lcu_inside(encoder_state_t * const state,
|
|||
const int end_x = MIN(x + LCU_WIDTH, state->tile->frame->width);
|
||||
const int end_y = MIN(y + LCU_WIDTH, state->tile->frame->height);
|
||||
|
||||
for (int edge_y = y; edge_y < end_y; edge_y += 8) {
|
||||
for (int edge_x = x; edge_x < end_x; edge_x += 8) {
|
||||
for (int edge_y = y; edge_y < end_y; edge_y += 4) {
|
||||
for (int edge_x = x; edge_x < end_x; edge_x += 4) {
|
||||
bool tu_boundary = is_tu_boundary(state, edge_x, edge_y, dir);
|
||||
if (tu_boundary || is_pu_boundary(state, edge_x, edge_y, dir)) {
|
||||
filter_deblock_unit(state, edge_x, edge_y, 8, 8, dir, tu_boundary);
|
||||
filter_deblock_unit(state, edge_x, edge_y, 4, 4, dir, tu_boundary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1198,14 +1198,14 @@ static void filter_deblock_lcu_rightmost(encoder_state_t * const state,
|
|||
int32_t y_px)
|
||||
{
|
||||
// Luma
|
||||
const int x = x_px - 8;
|
||||
const int x = x_px - 4;
|
||||
const int end = MIN(y_px + LCU_WIDTH, state->tile->frame->height);
|
||||
for (int y = y_px; y < end; y += 8) {
|
||||
for (int y = y_px; y < end; y += 4) {
|
||||
// The top edge of the whole frame is not filtered.
|
||||
bool tu_boundary = is_tu_boundary(state, x, y, EDGE_HOR);
|
||||
bool pu_boundary = is_pu_boundary(state, x, y, EDGE_HOR);
|
||||
if (y > 0 && (tu_boundary || pu_boundary)) {
|
||||
filter_deblock_edge_luma(state, x, y, 8, EDGE_HOR, tu_boundary);
|
||||
filter_deblock_edge_luma(state, x, y, 4, EDGE_HOR, tu_boundary);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1213,14 +1213,14 @@ static void filter_deblock_lcu_rightmost(encoder_state_t * const state,
|
|||
if (state->encoder_control->chroma_format != KVZ_CSP_400) {
|
||||
const int x_px_c = x_px >> 1;
|
||||
const int y_px_c = y_px >> 1;
|
||||
const int x_c = x_px_c - 4;
|
||||
const int x_c = x_px_c - 2;
|
||||
const int end_c = MIN(y_px_c + LCU_WIDTH_C, state->tile->frame->height >> 1);
|
||||
for (int y_c = y_px_c; y_c < end_c; y_c += 8) {
|
||||
for (int y_c = y_px_c; y_c < end_c; y_c += 4) {
|
||||
// The top edge of the whole frame is not filtered.
|
||||
bool tu_boundary = is_tu_boundary(state, x_c << 1, y_c << 1, EDGE_HOR);
|
||||
bool pu_boundary = is_pu_boundary(state, x_c << 1, y_c << 1, EDGE_HOR);
|
||||
if (y_c > 0 && (tu_boundary || pu_boundary)) {
|
||||
filter_deblock_edge_chroma(state, x_c, y_c, 4, EDGE_HOR, tu_boundary);
|
||||
filter_deblock_edge_chroma(state, x_c, y_c, 2, EDGE_HOR, tu_boundary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue