Fix handling of incomplete LCU's in SAO reconstruction.

This commit is contained in:
Ari Koivula 2013-11-06 18:08:24 +02:00
parent 7a20e797be
commit f9061d322a
2 changed files with 9 additions and 16 deletions

View file

@ -882,20 +882,10 @@ void encode_slice_data(encoder_control* encoder)
init_sao_info(sao_luma); init_sao_info(sao_luma);
init_sao_info(sao_chroma); init_sao_info(sao_chroma);
// Temporary guards against non-LCU size coding units at the edges, sao_search_luma(encoder->in.cur_pic, x_ctb, y_ctb, sao_luma);
// because they aren't handled yet. // sao_do_merge(encoder, x_ctb, y_ctb, sao_luma, sao_chroma);
if (encoder->in.width_in_lcu * LCU_WIDTH != encoder->in.cur_pic->width // sao_do_rdo(encoder, x_ctb, y_ctb, sao_luma, sao_chroma);
&& x_ctb == encoder->in.width_in_lcu - 1) { sao_reconstruct(encoder->in.cur_pic, new_y_data, x_ctb, y_ctb, sao_luma, sao_chroma);
} else if (encoder->in.height_in_lcu * LCU_WIDTH != encoder->in.cur_pic->height
&& y_ctb == encoder->in.height_in_lcu - 1) {
} else {
sao_search_luma(encoder->in.cur_pic, x_ctb, y_ctb, sao_luma);
// sao_do_merge(encoder, x_ctb, y_ctb, sao_luma, sao_chroma);
// sao_do_rdo(encoder, x_ctb, y_ctb, sao_luma, sao_chroma);
sao_reconstruct(encoder->in.cur_pic, new_y_data, x_ctb, y_ctb, sao_luma, sao_chroma);
}
} }
} }
} }

View file

@ -199,7 +199,7 @@ void sao_reconstruct(picture *pic, pixel *new_y_data, unsigned x_ctb, unsigned y
//picture_blit_pixels(y_recdata, new_rec_y, LCU_WIDTH, LCU_WIDTH, pic->width, LCU_WIDTH); //picture_blit_pixels(y_recdata, new_rec_y, LCU_WIDTH, LCU_WIDTH, pic->width, LCU_WIDTH);
sao_reconstruct_color(&rec_y[tl.y * (LCU_WIDTH + 2) + tl.x], sao_reconstruct_color(&rec_y[tl.y * (LCU_WIDTH + 2) + tl.x],
&new_rec_y[(tl.y + rec.y - y) * (LCU_WIDTH) + (tl.x + rec.x - x)], &new_rec_y,
sao_luma, sao_luma,
LCU_WIDTH + 2, LCU_WIDTH, LCU_WIDTH + 2, LCU_WIDTH,
block.x, block.y); block.x, block.y);
@ -207,7 +207,10 @@ void sao_reconstruct(picture *pic, pixel *new_y_data, unsigned x_ctb, unsigned y
//sao_reconstruct_color(rec_v, sao_chroma, COLOR_V); //sao_reconstruct_color(rec_v, sao_chroma, COLOR_V);
// Copy reconstructed block from tmp buffer to rec image. // Copy reconstructed block from tmp buffer to rec image.
picture_blit_pixels(new_rec_y, new_y_recdata, LCU_WIDTH, LCU_WIDTH, LCU_WIDTH, pic->width); //
picture_blit_pixels(new_rec_y,
&new_y_recdata[(tl.y + rec.y - y) * (LCU_WIDTH) + (tl.x + rec.x - x)],
block.x, block.y, LCU_WIDTH, pic->width);
} }