diff options
author | Jingning Han <jingning@google.com> | 2013-06-26 11:50:14 -0700 |
---|---|---|
committer | Jingning Han <jingning@google.com> | 2013-06-26 17:05:51 -0700 |
commit | 92479d9526b903ea87131e435084a5b2ae6ef2d3 (patch) | |
tree | c896f052dcd81d3e6f12f3b0ae1efcf7abf59314 /vp9/common/vp9_blockd.h | |
parent | 49dee1687934fd218aedd4db261337cdb7940691 (diff) | |
download | libvpx-92479d9526b903ea87131e435084a5b2ae6ef2d3.tar libvpx-92479d9526b903ea87131e435084a5b2ae6ef2d3.tar.gz libvpx-92479d9526b903ea87131e435084a5b2ae6ef2d3.tar.bz2 libvpx-92479d9526b903ea87131e435084a5b2ae6ef2d3.zip |
Make update_partition_context faster
Use vpx_memset for updating the partition contexts. Thanks to Noah
for pointing out the need of refactoring in this part.
Change-Id: I67fb78429d632298f1cd8a0be346cc76f79392a6
Diffstat (limited to 'vp9/common/vp9_blockd.h')
-rw-r--r-- | vp9/common/vp9_blockd.h | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index a09f33ed9..c24428fe7 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -404,34 +404,15 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int bwl = b_width_log2(sb_type); int bhl = b_height_log2(sb_type); int boffset = b_width_log2(BLOCK_SIZE_SB64X64) - bsl; - int i; + char pcvalue[2] = {~(0xe << boffset), ~(0xf <<boffset)}; + + assert(MAX(bwl, bhl) <= bsl); // update the partition context at the end notes. set partition bits // of block sizes larger than the current one to be one, and partition // bits of smaller block sizes to be zero. - if ((bwl == bsl) && (bhl == bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xf << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xf << boffset); - } else if ((bwl == bsl) && (bhl < bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xe << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xf << boffset); - } else if ((bwl < bsl) && (bhl == bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xf << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xe << boffset); - } else if ((bwl < bsl) && (bhl < bsl)) { - for (i = 0; i < bs; i++) - xd->left_seg_context[i] = ~(0xe << boffset); - for (i = 0; i < bs; i++) - xd->above_seg_context[i] = ~(0xe << boffset); - } else { - assert(0); - } + vpx_memset(xd->above_seg_context, pcvalue[bwl == bsl], bs); + vpx_memset(xd->left_seg_context, pcvalue[bhl == bsl], bs); } static INLINE int partition_plane_context(MACROBLOCKD *xd, |