mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Move deblocking code to filter module.
This commit is contained in:
parent
4d34377c42
commit
746eaa3671
|
@ -515,23 +515,7 @@ void encode_one_frame(encoder_control* encoder)
|
||||||
1, lcu_dim.y / 2, size.x / 2, 1);
|
1, lcu_dim.y / 2, size.x / 2, 1);
|
||||||
|
|
||||||
if (encoder->deblock_enable) {
|
if (encoder->deblock_enable) {
|
||||||
filter_deblock_cu(encoder, lcu.x << MAX_DEPTH, lcu.y << MAX_DEPTH, 0, EDGE_VER);
|
filter_deblock_lcu(encoder, px.x, px.y);
|
||||||
|
|
||||||
// Filter rightmost 4 pixels from last LCU now that they have been
|
|
||||||
// finally deblocked vertically.
|
|
||||||
if (lcu.x > 0) {
|
|
||||||
int y;
|
|
||||||
for (y = 0; y < 64; y += 8) {
|
|
||||||
if (lcu.y + y == 0) continue;
|
|
||||||
filter_deblock_edge_luma(encoder, lcu.x * 64 - 4, lcu.y * 64 + y, 4, EDGE_HOR);
|
|
||||||
}
|
|
||||||
for (y = 0; y < 32; y += 8) {
|
|
||||||
if (lcu.y + y == 0) continue;
|
|
||||||
filter_deblock_edge_chroma(encoder, lcu.x * 32 - 4, lcu.y * 32 + y, 4, EDGE_HOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filter_deblock_cu(encoder, lcu.x << MAX_DEPTH, lcu.y << MAX_DEPTH, 0, EDGE_HOR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
34
src/filter.c
34
src/filter.c
|
@ -450,6 +450,40 @@ void filter_deblock(encoder_control* encoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Deblock a single LCU without using data from right or down.
|
||||||
|
*
|
||||||
|
* Filter all the following edges:
|
||||||
|
* - All edges within the LCU, except for the last 4 pixels on the right when
|
||||||
|
* using horizontal filtering.
|
||||||
|
* - Left edge and top edge.
|
||||||
|
* - After vertical filtering the left edge, filter the last 4 pixels of
|
||||||
|
* horizontal edges in the LCU to the left.
|
||||||
|
*/
|
||||||
|
void filter_deblock_lcu(encoder_control *encoder, int x_px, int y_px)
|
||||||
|
{
|
||||||
|
const vector2d lcu = { x_px / LCU_WIDTH, y_px / LCU_WIDTH };
|
||||||
|
|
||||||
|
filter_deblock_cu(encoder, lcu.x << MAX_DEPTH, lcu.y << MAX_DEPTH, 0, EDGE_VER);
|
||||||
|
|
||||||
|
// Filter rightmost 4 pixels from last LCU now that they have been
|
||||||
|
// finally deblocked vertically.
|
||||||
|
if (lcu.x > 0) {
|
||||||
|
int y;
|
||||||
|
for (y = 0; y < 64; y += 8) {
|
||||||
|
if (lcu.y + y == 0) continue;
|
||||||
|
filter_deblock_edge_luma(encoder, lcu.x * 64 - 4, lcu.y * 64 + y, 4, EDGE_HOR);
|
||||||
|
}
|
||||||
|
for (y = 0; y < 32; y += 8) {
|
||||||
|
if (lcu.y + y == 0) continue;
|
||||||
|
filter_deblock_edge_chroma(encoder, lcu.x * 32 - 4, lcu.y * 32 + y, 4, EDGE_HOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filter_deblock_cu(encoder, lcu.x << MAX_DEPTH, lcu.y << MAX_DEPTH, 0, EDGE_HOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Interpolation for chroma half-pixel
|
* \brief Interpolation for chroma half-pixel
|
||||||
* \param src source image in integer pels (-2..width+3, -2..height+3)
|
* \param src source image in integer pels (-2..width+3, -2..height+3)
|
||||||
|
|
|
@ -41,6 +41,7 @@ void filter_deblock_edge_chroma(encoder_control *encoder,
|
||||||
int32_t xpos, int32_t ypos,
|
int32_t xpos, int32_t ypos,
|
||||||
int8_t depth, int8_t dir);
|
int8_t depth, int8_t dir);
|
||||||
void filter_deblock(encoder_control *encoder);
|
void filter_deblock(encoder_control *encoder);
|
||||||
|
void filter_deblock_lcu(encoder_control *encoder, int x_px, int y_px);
|
||||||
void filter_deblock_luma(pixel *src, int32_t offset, int32_t tc , int8_t sw,
|
void filter_deblock_luma(pixel *src, int32_t offset, int32_t tc , int8_t sw,
|
||||||
int8_t part_p_nofilter, int8_t part_q_nofilter,
|
int8_t part_p_nofilter, int8_t part_q_nofilter,
|
||||||
int32_t thr_cut,
|
int32_t thr_cut,
|
||||||
|
|
Loading…
Reference in a new issue