From 220a6f401dfe404ae43743935b529c84c4790d0e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 16 May 2005 21:49:18 +0000 Subject: [PATCH] some benchmarking code Originally committed as revision 4250 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/vp3.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index a4ecbe9d44..fc850bb40a 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2318,7 +2318,7 @@ static void apply_loop_filter(Vp3DecodeContext *s) for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { - +START_TIMER /* do not perform left edge filter for left columns frags */ if ((x > 0) && (s->all_fragments[fragment].coding_method != MODE_COPY)) { @@ -2358,6 +2358,7 @@ static void apply_loop_filter(Vp3DecodeContext *s) } fragment++; +STOP_TIMER("loop filter") } } } @@ -2716,7 +2717,9 @@ static int vp3_decode_frame(AVCodecContext *avctx, s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame s->current_frame.qstride= 0; + {START_TIMER init_frame(s, &gb); + STOP_TIMER("init_frame")} #if KEYFRAMES_ONLY if (!s->keyframe) { @@ -2731,17 +2734,37 @@ if (!s->keyframe) { } else { #endif - if (unpack_superblocks(s, &gb) || - unpack_modes(s, &gb) || - unpack_vectors(s, &gb) || - unpack_dct_coeffs(s, &gb)) { - - av_log(s->avctx, AV_LOG_ERROR, " vp3: could not decode frame\n"); + {START_TIMER + if (unpack_superblocks(s, &gb)){ + av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); + return -1; + } + STOP_TIMER("unpack_superblocks")} + {START_TIMER + if (unpack_modes(s, &gb)){ + av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); + return -1; + } + STOP_TIMER("unpack_modes")} + {START_TIMER + if (unpack_vectors(s, &gb)){ + av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); + return -1; + } + STOP_TIMER("unpack_vectors")} + {START_TIMER + if (unpack_dct_coeffs(s, &gb)){ + av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); return -1; } + STOP_TIMER("unpack_dct_coeffs")} + {START_TIMER reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height); + STOP_TIMER("reverse_dc_prediction")} + {START_TIMER render_fragments(s, 0, s->width, s->height, 0); + STOP_TIMER("render_fragments")} if ((avctx->flags & CODEC_FLAG_GRAY) == 0) { reverse_dc_prediction(s, s->u_fragment_start, @@ -2755,7 +2778,9 @@ if (!s->keyframe) { memset(s->current_frame.data[2], 0x80, s->width * s->height / 4); } + {START_TIMER apply_loop_filter(s); + STOP_TIMER("apply_loop_filter")} #if KEYFRAMES_ONLY } #endif