mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Add work_tree_copy_up.
This commit is contained in:
parent
1450d0edf8
commit
9faecd375a
38
src/search.c
38
src/search.c
|
@ -318,13 +318,49 @@ static void search_inter(encoder_control *encoder, uint16_t x_ctb,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SUB_SCU_BIT_MASK (64 - 1)
|
||||||
|
#define SUB_SCU(xy) (xy & SUB_SCU_BIT_MASK)
|
||||||
|
#define LCU_CU_WIDTH 8
|
||||||
|
#define LCU_T_CU_WIDTH 9
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy all non-reference CU data from depth+1 to depth.
|
* Copy all non-reference CU data from depth+1 to depth.
|
||||||
*/
|
*/
|
||||||
static void work_tree_copy_up(int x, int y, int depth, lcu_t work_tree[MAX_PU_DEPTH])
|
static void work_tree_copy_up(int x_px, int y_px, int depth, lcu_t work_tree[MAX_PU_DEPTH])
|
||||||
{
|
{
|
||||||
|
// Copy non-reference CUs.
|
||||||
|
{
|
||||||
|
const int x_cu = SUB_SCU(x_px) >> MAX_DEPTH;
|
||||||
|
const int y_cu = SUB_SCU(y_px) >> MAX_DEPTH;
|
||||||
|
const int width_cu = LCU_WIDTH >> MAX_DEPTH >> depth;
|
||||||
|
int x, y;
|
||||||
|
for (y = y_cu; y < y_cu + width_cu; ++y) {
|
||||||
|
for (x = x_cu; x < x_cu + width_cu; ++x) {
|
||||||
|
const cu_info *from_cu = &work_tree[depth + 1].cu[x + y * LCU_T_CU_WIDTH];
|
||||||
|
cu_info *to_cu = &work_tree[depth].cu[x + y * LCU_T_CU_WIDTH];
|
||||||
|
memcpy(to_cu, from_cu, sizeof(*to_cu));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy reconstructed pixels.
|
||||||
|
{
|
||||||
|
const int x = SUB_SCU(x_px);
|
||||||
|
const int y = SUB_SCU(y_px);
|
||||||
|
const int width_px = LCU_WIDTH >> depth;
|
||||||
|
const int luma_index = x + y * LCU_WIDTH;
|
||||||
|
const int chroma_index = (x / 2) + (y / 2) * (LCU_WIDTH / 2);
|
||||||
|
|
||||||
|
lcu_yuv_t *from = &work_tree[depth + 1].rec;
|
||||||
|
lcu_yuv_t *to = &work_tree[depth].rec;
|
||||||
|
|
||||||
|
picture_blit_pixels(&from->y[luma_index], &to->y[luma_index],
|
||||||
|
width_px, width_px, LCU_WIDTH, LCU_WIDTH);
|
||||||
|
picture_blit_pixels(&from->u[chroma_index], &to->u[chroma_index],
|
||||||
|
width_px / 2, width_px / 2, LCU_WIDTH / 2, LCU_WIDTH / 2);
|
||||||
|
picture_blit_pixels(&from->v[chroma_index], &to->v[chroma_index],
|
||||||
|
width_px / 2, width_px / 2, LCU_WIDTH / 2, LCU_WIDTH / 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue