[FFmpeg-devel] [PATCH] VP8: optimized mv prediction and decoding Merge find_near_mvs and mv bitstream decoding: don't do prediction steps until absolutely necessary.

Ronald S. Bultje rsbultje
Thu Feb 10 23:54:40 CET 2011


Hi,

On Thu, Feb 10, 2011 at 1:44 AM, Jason Garrett-Glaser <jason at x264.com> wrote:
> ---
> ?libavcodec/vp8.c ? ? ?| ?182 ++++++++++++++++++++++++------------------------
> ?libavutil/x86/timer.h | ? ?6 ++-
> ?2 files changed, 96 insertions(+), 92 deletions(-)

Interesting optimization. Timings:

after
1230 dezicycles in decode_mv, 8385837 runs, 2771 skips
1224 dezicycles in decode_mv, 8387467 runs, 1141 skips
1222 dezicycles in decode_mv, 8387144 runs, 1464 skips
1229 dezicycles in decode_mv, 8386779 runs, 1829 skips

before
1389 dezicycles in find_near_mv_plus_rest, 8388119 runs, 489 skips
1390 dezicycles in find_near_mv_plus_rest, 8388083 runs, 525 skips
1386 dezicycles in find_near_mv_plus_rest, 8388157 runs, 451 skips
1394 dezicycles in find_near_mv_plus_rest, 8387941 runs, 667 skips

So looks good to me.

> diff --git a/libavutil/x86/timer.h b/libavutil/x86/timer.h
> index 62a111f..8f81293 100644
> --- a/libavutil/x86/timer.h
> +++ b/libavutil/x86/timer.h
> @@ -25,7 +25,11 @@
>
> ?#define AV_READ_TIME read_time
>
> -static inline uint64_t read_time(void)
> +#ifndef av_always_inline
> +#define av_always_inline inline
> +#endif
> +
> +static av_always_inline uint64_t read_time(void)
> ?{
> ? ? uint32_t a, d;
> ? ? __asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
> --
> 1.7.3.2.451.g1c2ab.dirty

Without this part of course.

Ronald



More information about the ffmpeg-devel mailing list