mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Add a function for copying CU data from LCUs.
Adds function kvz_cu_array_copy_from_lcu which CU info data from an lcu_t structure to a cu_array_t structure.
This commit is contained in:
parent
2c85a00a55
commit
57a3d9b4b9
25
src/cu.c
25
src/cu.c
|
@ -200,3 +200,28 @@ void kvz_cu_array_copy(cu_array_t* dst, int dst_x, int dst_y,
|
|||
dst_ptr += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Copy an lcu to a cu array.
|
||||
*
|
||||
* All values are in luma pixels.
|
||||
*
|
||||
* \param dst destination array
|
||||
* \param dst_x x-coordinate of the left edge of the copied area in dst
|
||||
* \param dst_y y-coordinate of the top edge of the copied area in dst
|
||||
* \param src source lcu
|
||||
*/
|
||||
void kvz_cu_array_copy_from_lcu(cu_array_t* dst, int dst_x, int dst_y, const lcu_t *src)
|
||||
{
|
||||
// Convert values from pixel coordinates to array indices.
|
||||
const int dst_x_scu = dst_x >> 3;
|
||||
const int dst_y_scu = dst_y >> 3;
|
||||
const int dst_stride = dst->width >> 3;
|
||||
for (int y = 0; y < LCU_CU_WIDTH; ++y) {
|
||||
for (int x = 0; x < LCU_CU_WIDTH; ++x) {
|
||||
const cu_info_t *from_cu = LCU_GET_CU(src, x, y);
|
||||
cu_info_t *to_cu = &dst->data[dst_x_scu + x + (dst_y_scu + y) * dst_stride];
|
||||
memcpy(to_cu, from_cu, sizeof(*to_cu));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
src/cu.h
2
src/cu.h
|
@ -268,6 +268,8 @@ typedef struct {
|
|||
cu_info_t cu[9*9+1];
|
||||
} lcu_t;
|
||||
|
||||
void kvz_cu_array_copy_from_lcu(cu_array_t* dst, int dst_x, int dst_y, const lcu_t *src);
|
||||
|
||||
/**
|
||||
* \brief Return pointer to a given CU.
|
||||
*
|
||||
|
|
15
src/search.c
15
src/search.c
|
@ -883,20 +883,7 @@ static void init_lcu_t(const encoder_state_t * const state, const int x, const i
|
|||
static void copy_lcu_to_cu_data(const encoder_state_t * const state, int x_px, int y_px, const lcu_t *lcu)
|
||||
{
|
||||
// Copy non-reference CUs to picture.
|
||||
{
|
||||
const int x_cu = x_px >> MAX_DEPTH;
|
||||
const int y_cu = y_px >> MAX_DEPTH;
|
||||
videoframe_t * const frame = state->tile->frame;
|
||||
|
||||
int x, y;
|
||||
for (y = 0; y < LCU_CU_WIDTH; ++y) {
|
||||
for (x = 0; x < LCU_CU_WIDTH; ++x) {
|
||||
const cu_info_t *from_cu = LCU_GET_CU(lcu, x, y);
|
||||
cu_info_t *to_cu = kvz_videoframe_get_cu(frame, x_cu + x, y_cu + y);
|
||||
memcpy(to_cu, from_cu, sizeof(*to_cu));
|
||||
}
|
||||
}
|
||||
}
|
||||
kvz_cu_array_copy_from_lcu(state->tile->frame->cu_array, x_px, y_px, lcu);
|
||||
|
||||
// Copy pixels to picture.
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue