mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
No-copy works with --no-sao --no-deblock
This commit is contained in:
parent
0dbfa62698
commit
6b408b5904
|
@ -142,15 +142,15 @@ static void encoder_state_recdata_to_bufs(encoder_state * const encoder_state, c
|
|||
const int by = lcu->position.y;
|
||||
|
||||
//Copy the bottom row of this LCU to the horizontal buffer
|
||||
pixels_blit(&frame->rec->y[rdpy * frame->width + rdpx],
|
||||
pixels_blit(&frame->rec->y[rdpy * frame->rec->stride + rdpx],
|
||||
&hor_buf->y[lcu->position_px.x + by * frame->width],
|
||||
lcu->size.x, 1, frame->width, frame->width);
|
||||
pixels_blit(&frame->rec->u[(rdpy/2) * frame->width/2 + (rdpx/2)],
|
||||
lcu->size.x, 1, frame->rec->stride, frame->width);
|
||||
pixels_blit(&frame->rec->u[(rdpy/2) * frame->rec->stride/2 + (rdpx/2)],
|
||||
&hor_buf->u[lcu->position_px.x / 2 + by * frame->width / 2],
|
||||
lcu->size.x / 2, 1, frame->width / 2, frame->width / 2);
|
||||
pixels_blit(&frame->rec->v[(rdpy/2) * frame->width/2 + (rdpx/2)],
|
||||
lcu->size.x / 2, 1, frame->rec->stride / 2, frame->width / 2);
|
||||
pixels_blit(&frame->rec->v[(rdpy/2) * frame->rec->stride/2 + (rdpx/2)],
|
||||
&hor_buf->v[lcu->position_px.x / 2 + by * frame->width / 2],
|
||||
lcu->size.x / 2, 1, frame->width / 2, frame->width / 2);
|
||||
lcu->size.x / 2, 1, frame->rec->stride / 2, frame->width / 2);
|
||||
}
|
||||
|
||||
if (ver_buf) {
|
||||
|
@ -160,15 +160,15 @@ static void encoder_state_recdata_to_bufs(encoder_state * const encoder_state, c
|
|||
|
||||
|
||||
//Copy the right row of this LCU to the vertical buffer.
|
||||
pixels_blit(&frame->rec->y[rdpy * frame->width + rdpx],
|
||||
pixels_blit(&frame->rec->y[rdpy * frame->rec->stride + rdpx],
|
||||
&ver_buf->y[lcu->position_px.y + bx * frame->height],
|
||||
1, lcu->size.y, frame->width, 1);
|
||||
pixels_blit(&frame->rec->u[(rdpy/2) * frame->width/2 + (rdpx/2)],
|
||||
1, lcu->size.y, frame->rec->stride, 1);
|
||||
pixels_blit(&frame->rec->u[(rdpy/2) * frame->rec->stride/2 + (rdpx/2)],
|
||||
&ver_buf->u[lcu->position_px.y / 2 + bx * frame->height / 2],
|
||||
1, lcu->size.y / 2, frame->width / 2, 1);
|
||||
pixels_blit(&frame->rec->v[(rdpy/2) * frame->width/2 + (rdpx/2)],
|
||||
1, lcu->size.y / 2, frame->rec->stride / 2, 1);
|
||||
pixels_blit(&frame->rec->v[(rdpy/2) * frame->rec->stride/2 + (rdpx/2)],
|
||||
&ver_buf->v[lcu->position_px.y / 2 + bx * frame->height / 2],
|
||||
1, lcu->size.y / 2, frame->width / 2, 1);
|
||||
1, lcu->size.y / 2, frame->rec->stride / 2, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef int16_t coefficient;
|
|||
|
||||
#define LOG2_LCU_WIDTH 6
|
||||
// CU_TO_PIXEL = y * lcu_width * pic_width + x * lcu_width
|
||||
#define CU_TO_PIXEL(x, y, depth, width) (((y) << (LOG2_LCU_WIDTH - (depth))) * (width) \
|
||||
#define CU_TO_PIXEL(x, y, depth, stride) (((y) << (LOG2_LCU_WIDTH - (depth))) * (stride) \
|
||||
+ ((x) << (LOG2_LCU_WIDTH - (depth))))
|
||||
//#define SIGN3(x) ((x) > 0) ? +1 : ((x) == 0 ? 0 : -1)
|
||||
#define SIGN3(x) (((x) > 0) - ((x) < 0))
|
||||
|
|
10
src/sao.c
10
src/sao.c
|
@ -549,7 +549,7 @@ void sao_reconstruct(const encoder_control * const encoder, videoframe * frame,
|
|||
const sao_info *sao, color_index color_i)
|
||||
{
|
||||
const int is_chroma = (color_i != COLOR_Y ? 1 : 0);
|
||||
const int pic_stride = frame->width >> is_chroma;
|
||||
const int pic_stride = frame->rec->stride >> is_chroma;
|
||||
const int lcu_stride = LCU_WIDTH >> is_chroma;
|
||||
const int buf_stride = lcu_stride + 2;
|
||||
|
||||
|
@ -845,8 +845,8 @@ void sao_search_luma(const encoder_state * const encoder_state, const videoframe
|
|||
pixel rec[LCU_LUMA_SIZE];
|
||||
const pixel * orig_list[1] = { NULL };
|
||||
const pixel * rec_list[1] = { NULL };
|
||||
pixel *data = &frame->source->y[CU_TO_PIXEL(x_ctb, y_ctb, 0, frame->width)];
|
||||
pixel *recdata = &frame->rec->y[CU_TO_PIXEL(x_ctb, y_ctb, 0, frame->width)];
|
||||
pixel *data = &frame->source->y[CU_TO_PIXEL(x_ctb, y_ctb, 0, frame->source->stride)];
|
||||
pixel *recdata = &frame->rec->y[CU_TO_PIXEL(x_ctb, y_ctb, 0, frame->rec->stride)];
|
||||
int block_width = LCU_WIDTH;
|
||||
int block_height = LCU_WIDTH;
|
||||
|
||||
|
@ -861,8 +861,8 @@ void sao_search_luma(const encoder_state * const encoder_state, const videoframe
|
|||
sao->type = SAO_TYPE_EDGE;
|
||||
|
||||
// Fill temporary buffers with picture data.
|
||||
pixels_blit(data, orig, block_width, block_height, frame->width, block_width);
|
||||
pixels_blit(recdata, rec, block_width, block_height, frame->width, block_width);
|
||||
pixels_blit(data, orig, block_width, block_height, frame->source->stride, block_width);
|
||||
pixels_blit(recdata, rec, block_width, block_height, frame->rec->stride, block_width);
|
||||
|
||||
orig_list[0] = orig;
|
||||
rec_list[0] = rec;
|
||||
|
|
28
src/search.c
28
src/search.c
|
@ -1205,22 +1205,20 @@ static void init_lcu_t(const encoder_state * const encoder_state, const int x, c
|
|||
// Copy LCU pixels.
|
||||
{
|
||||
const videoframe * const frame = encoder_state->tile->frame;
|
||||
int pic_width = frame->width;
|
||||
int x_max = MIN(x + LCU_WIDTH, pic_width) - x;
|
||||
int x_max = MIN(x + LCU_WIDTH, frame->width) - x;
|
||||
int y_max = MIN(y + LCU_WIDTH, frame->height) - y;
|
||||
|
||||
int x_c = x / 2;
|
||||
int y_c = y / 2;
|
||||
int pic_width_c = pic_width / 2;
|
||||
int x_max_c = x_max / 2;
|
||||
int y_max_c = y_max / 2;
|
||||
|
||||
pixels_blit(&frame->source->y[x + y * pic_width], lcu->ref.y,
|
||||
x_max, y_max, pic_width, LCU_WIDTH);
|
||||
pixels_blit(&frame->source->u[x_c + y_c * pic_width_c], lcu->ref.u,
|
||||
x_max_c, y_max_c, pic_width_c, LCU_WIDTH / 2);
|
||||
pixels_blit(&frame->source->v[x_c + y_c * pic_width_c], lcu->ref.v,
|
||||
x_max_c, y_max_c, pic_width_c, LCU_WIDTH / 2);
|
||||
pixels_blit(&frame->source->y[x + y * frame->source->stride], lcu->ref.y,
|
||||
x_max, y_max, frame->source->stride, LCU_WIDTH);
|
||||
pixels_blit(&frame->source->u[x_c + y_c * frame->source->stride/2], lcu->ref.u,
|
||||
x_max_c, y_max_c, frame->source->stride/2, LCU_WIDTH / 2);
|
||||
pixels_blit(&frame->source->v[x_c + y_c * frame->source->stride/2], lcu->ref.v,
|
||||
x_max_c, y_max_c, frame->source->stride/2, LCU_WIDTH / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1259,15 +1257,15 @@ static void copy_lcu_to_cu_data(const encoder_state * const encoder_state, int x
|
|||
const int luma_index = x_px + y_px * pic_width;
|
||||
const int chroma_index = (x_px / 2) + (y_px / 2) * (pic_width / 2);
|
||||
|
||||
pixels_blit(lcu->rec.y, &pic->rec->y[luma_index],
|
||||
x_max, y_max, LCU_WIDTH, pic_width);
|
||||
pixels_blit(lcu->rec.y, &pic->rec->y[x_px + y_px * pic->rec->stride],
|
||||
x_max, y_max, LCU_WIDTH, pic->rec->stride);
|
||||
coefficients_blit(lcu->coeff.y, &pic->coeff_y[luma_index],
|
||||
x_max, y_max, LCU_WIDTH, pic_width);
|
||||
|
||||
pixels_blit(lcu->rec.u, &pic->rec->u[chroma_index],
|
||||
x_max / 2, y_max / 2, LCU_WIDTH / 2, pic_width / 2);
|
||||
pixels_blit(lcu->rec.v, &pic->rec->v[chroma_index],
|
||||
x_max / 2, y_max / 2, LCU_WIDTH / 2, pic_width / 2);
|
||||
pixels_blit(lcu->rec.u, &pic->rec->u[(x_px / 2) + (y_px / 2) * (pic->rec->stride / 2)],
|
||||
x_max / 2, y_max / 2, LCU_WIDTH / 2, pic->rec->stride / 2);
|
||||
pixels_blit(lcu->rec.v, &pic->rec->v[(x_px / 2) + (y_px / 2) * (pic->rec->stride / 2)],
|
||||
x_max / 2, y_max / 2, LCU_WIDTH / 2, pic->rec->stride / 2);
|
||||
coefficients_blit(lcu->coeff.u, &pic->coeff_u[chroma_index],
|
||||
x_max / 2, y_max / 2, LCU_WIDTH / 2, pic_width / 2);
|
||||
coefficients_blit(lcu->coeff.v, &pic->coeff_v[chroma_index],
|
||||
|
|
Loading…
Reference in a new issue