From: Attila Nagy Date: Mon, 23 Apr 2012 12:20:07 +0000 (+0300) Subject: Optimizes precalculated decoder block ptrs&offs X-Git-Tag: v1.2.0~220 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=175495fe738f9bf9b83a412716fade4a2a1898e5;p=libvpx Optimizes precalculated decoder block ptrs&offs The block pointers and offset do not need to be calculated for every frame. Block internal predictors can be update once when decoder is allocated. Destination and previous buffer offsets have to be updated just when frame size is changing. Change-Id: I92ca8df0e6aaac4cc35ab890751d446760bf82e2 --- diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index f2d58bd0d..4d9a0a342 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -737,6 +737,8 @@ int vp8_decode_frame(VP8D_COMP *pbi) int corrupt_tokens = 0; int prev_independent_partitions = pbi->independent_partitions; + int frame_size_change = 0; + /* start with no corruption of current frame */ xd->corrupted = 0; pc->yv12_fb[pc->new_fb_idx].corrupted = 0; @@ -840,6 +842,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) if (pbi->b_multithreaded_rd) vp8mt_alloc_temp_buffers(pbi, pc->Width, prev_mb_rows); #endif + frame_size_change = 1; } } } @@ -1103,9 +1106,17 @@ int vp8_decode_frame(VP8D_COMP *pbi) #endif vp8_setup_intra_recon(&pc->yv12_fb[pc->new_fb_idx]); - vp8_setup_block_dptrs(xd); - - vp8_build_block_doffsets(xd); + if(frame_size_change) + { +#if CONFIG_MULTITHREAD + for (i = 0; i < pbi->allocated_decoding_thread_count; i++) + { + pbi->mb_row_di[i].mbd.dst = pc->yv12_fb[pc->new_fb_idx]; + vp8_build_block_doffsets(&pbi->mb_row_di[i].mbd); + } +#endif + vp8_build_block_doffsets(&pbi->mb); + } /* clear out the coeff buffer */ vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff)); diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c index c59ce259f..d83595360 100644 --- a/vp8/decoder/onyxd_if.c +++ b/vp8/decoder/onyxd_if.c @@ -99,6 +99,8 @@ struct VP8D_COMP * vp8dx_create_decompressor(VP8D_CONFIG *oxcf) */ pbi->independent_partitions = 0; + vp8_setup_block_dptrs(&pbi->mb); + return pbi; } diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c index 845228bb5..befdbdeaa 100644 --- a/vp8/decoder/threading.c +++ b/vp8/decoder/threading.c @@ -50,8 +50,6 @@ static void setup_decoding_thread_data(VP8D_COMP *pbi, MACROBLOCKD *xd, MB_ROW_D mbd->pre = pc->yv12_fb[pc->lst_fb_idx]; mbd->dst = pc->yv12_fb[pc->new_fb_idx]; - vp8_setup_block_dptrs(mbd); - vp8_build_block_doffsets(mbd); mbd->segmentation_enabled = xd->segmentation_enabled; mbd->mb_segement_abs_delta = xd->mb_segement_abs_delta; vpx_memcpy(mbd->segment_feature_data, xd->segment_feature_data, sizeof(xd->segment_feature_data)); @@ -694,6 +692,8 @@ void vp8_decoder_create_threads(VP8D_COMP *pbi) { sem_init(&pbi->h_event_start_decoding[ithread], 0, 0); + vp8_setup_block_dptrs(&pbi->mb_row_di[ithread].mbd); + pbi->de_thread_data[ithread].ithread = ithread; pbi->de_thread_data[ithread].ptr1 = (void *)pbi; pbi->de_thread_data[ithread].ptr2 = (void *) &pbi->mb_row_di[ithread];