aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vp8.c
diff options
context:
space:
mode:
authorDavid Conrad <lessen42@gmail.com>2010-07-23 21:46:25 +0000
committerDavid Conrad <lessen42@gmail.com>2010-07-23 21:46:25 +0000
commitca18a478e3bfadff7084938e4eae83053910e38c (patch)
treefafa78d04cfea90534fbea4fbf14b20a4a8c3432 /libavcodec/vp8.c
parent7697cdcf95d1f1936ac86aea78e22f3d3b6efb34 (diff)
downloadffmpeg-ca18a478e3bfadff7084938e4eae83053910e38c.tar.gz
VP8: Inline traversing vp8_small_mvtree
Much faster read_mv_component, slightly faster overall Originally committed as revision 24470 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp8.c')
-rw-r--r--libavcodec/vp8.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index bb9876f424..4fc5a4de91 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -599,7 +599,7 @@ void find_near_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
*/
static int read_mv_component(VP56RangeCoder *c, const uint8_t *p)
{
- int x = 0;
+ int bit, x = 0;
if (vp56_rac_get_prob_branchy(c, p[0])) {
int i;
@@ -610,8 +610,17 @@ static int read_mv_component(VP56RangeCoder *c, const uint8_t *p)
x += vp56_rac_get_prob(c, p[9 + i]) << i;
if (!(x & 0xFFF0) || vp56_rac_get_prob(c, p[12]))
x += 8;
- } else
- x = vp8_rac_get_tree(c, vp8_small_mvtree, &p[2]);
+ } else {
+ // small_mvtree
+ const uint8_t *ps = p+2;
+ bit = vp56_rac_get_prob(c, *ps);
+ ps += 1 + 3*bit;
+ x += 4*bit;
+ bit = vp56_rac_get_prob(c, *ps);
+ ps += 1 + bit;
+ x += 2*bit;
+ x += vp56_rac_get_prob(c, *ps);
+ }
return (x && vp56_rac_get_prob(c, p[1])) ? -x : x;
}