From 648cfcb4375f23a6bec67b84d3677c0db728bae6 Mon Sep 17 00:00:00 2001 From: Scott LaVarnway Date: Thu, 13 Sep 2012 11:51:27 -0700 Subject: [PATCH] Changed setup intra recon to be row based Initialize the top line at the beginning of each frame and the left column at the beginning of each row. Change-Id: I5412f7ea49ffc490215cf65a62715a6c5e3a5a29 --- vp8/common/setupintrarecon.c | 7 +++++++ vp8/common/setupintrarecon.h | 20 ++++++++++++++++++++ vp8/decoder/decodframe.c | 14 ++++++-------- vp8/decoder/threading.c | 13 ++++++++++--- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/vp8/common/setupintrarecon.c b/vp8/common/setupintrarecon.c index 7976e252b..60afe519f 100644 --- a/vp8/common/setupintrarecon.c +++ b/vp8/common/setupintrarecon.c @@ -30,3 +30,10 @@ void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf) ybf->v_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129; } + +void vp8_setup_intra_recon_top_line(YV12_BUFFER_CONFIG *ybf) +{ + vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5); + vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5); + vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5); +} diff --git a/vp8/common/setupintrarecon.h b/vp8/common/setupintrarecon.h index 5264fd04b..e515c3a00 100644 --- a/vp8/common/setupintrarecon.h +++ b/vp8/common/setupintrarecon.h @@ -11,3 +11,23 @@ #include "vpx_scale/yv12config.h" extern void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf); +extern void vp8_setup_intra_recon_top_line(YV12_BUFFER_CONFIG *ybf); + +static +void setup_intra_recon_left(unsigned char *y_buffer, + unsigned char *u_buffer, + unsigned char *v_buffer, + int y_stride, + int uv_stride) +{ + int i; + + for (i = 0; i < 16; i++) + y_buffer[y_stride *i] = (unsigned char) 129; + + for (i = 0; i < 8; i++) + u_buffer[uv_stride *i] = (unsigned char) 129; + + for (i = 0; i < 8; i++) + v_buffer[uv_stride *i] = (unsigned char) 129; +} diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index ea8798f47..03a6759ac 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -553,6 +553,8 @@ static void decode_mb_rows(VP8D_COMP *pbi) if(pc->filter_level) vp8_loop_filter_frame_init(pc, xd, pc->filter_level); + vp8_setup_intra_recon_top_line(&pc->yv12_fb[dst_fb_idx]); + /* Decode the individual macro block */ for (mb_row = 0; mb_row < pc->mb_rows; mb_row++) { @@ -593,6 +595,10 @@ static void decode_mb_rows(VP8D_COMP *pbi) xd->recon_left_stride[0] = xd->dst.y_stride; xd->recon_left_stride[1] = xd->dst.uv_stride; + setup_intra_recon_left(xd->recon_left[0], xd->recon_left[1], + xd->recon_left[2], xd->dst.y_stride, + xd->dst.uv_stride); + for (mb_col = 0; mb_col < pc->mb_cols; mb_col++) { /* Distance of Mb to the various image edges. @@ -1383,14 +1389,6 @@ int vp8_decode_frame(VP8D_COMP *pbi) } } - - /* set up frame new frame for intra coded blocks */ -#if CONFIG_MULTITHREAD - if (!(pbi->b_multithreaded_rd) || pc->multi_token_partition == ONE_PARTITION || !(pc->filter_level)) -#endif - vp8_setup_intra_recon(&pc->yv12_fb[pc->new_fb_idx]); - - /* clear out the coeff buffer */ vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff)); diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c index dce1e4cd6..de14789cb 100644 --- a/vp8/decoder/threading.c +++ b/vp8/decoder/threading.c @@ -24,6 +24,7 @@ #include "detokenize.h" #include "vp8/common/reconintra4x4.h" #include "vp8/common/reconinter.h" +#include "vp8/common/setupintrarecon.h" #if CONFIG_ERROR_CONCEALMENT #include "error_concealment.h" #endif @@ -399,6 +400,10 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd, int start_mb_row) /* TODO: move to outside row loop */ xd->recon_left_stride[0] = xd->dst.y_stride; xd->recon_left_stride[1] = xd->dst.uv_stride; + + setup_intra_recon_left(xd->recon_left[0], xd->recon_left[1], + xd->recon_left[2], xd->dst.y_stride, + xd->dst.uv_stride); } for (mb_col = 0; mb_col < pc->mb_cols; mb_col++) @@ -873,9 +878,9 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd) if (filter_level) { /* Set above_row buffer to 127 for decoding first MB row */ - vpx_memset(pbi->mt_yabove_row[0] + VP8BORDERINPIXELS-1, 127, pc->yv12_fb[pc->lst_fb_idx].y_width + 5); - vpx_memset(pbi->mt_uabove_row[0] + (VP8BORDERINPIXELS>>1)-1, 127, (pc->yv12_fb[pc->lst_fb_idx].y_width>>1) +5); - vpx_memset(pbi->mt_vabove_row[0] + (VP8BORDERINPIXELS>>1)-1, 127, (pc->yv12_fb[pc->lst_fb_idx].y_width>>1) +5); + vpx_memset(pbi->mt_yabove_row[0] + VP8BORDERINPIXELS-1, 127, pc->yv12_fb[pc->new_fb_idx].y_width + 5); + vpx_memset(pbi->mt_uabove_row[0] + (VP8BORDERINPIXELS>>1)-1, 127, (pc->yv12_fb[pc->new_fb_idx].y_width>>1) +5); + vpx_memset(pbi->mt_vabove_row[0] + (VP8BORDERINPIXELS>>1)-1, 127, (pc->yv12_fb[pc->new_fb_idx].y_width>>1) +5); for (j=1; jmb_rows; j++) { @@ -895,6 +900,8 @@ void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd) /* Initialize the loop filter for this frame. */ vp8_loop_filter_frame_init(pc, &pbi->mb, filter_level); } + else + vp8_setup_intra_recon_top_line(&pc->yv12_fb[pc->new_fb_idx]); setup_decoding_thread_data(pbi, xd, pbi->mb_row_di, pbi->decoding_thread_count);