diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2013-02-17 17:01:26 -0800 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-18 15:18:56 +0100 |
commit | 51513b98d62de2514d657acc95cb69f2e92aa212 (patch) | |
tree | 085e7822bf9e8408dd80c96cdb80641fa2cae5b1 /libavcodec/svq3.c | |
parent | f894246304b372326ffa92cf06ebf9d15a7f0d9c (diff) | |
download | ffmpeg-51513b98d62de2514d657acc95cb69f2e92aa212.tar.gz |
h264/svq3: stop using draw_edges.
Instead, only extend edges on-demand when the motion vector actually
crosses the visible decoded area using ff_emulated_edge_mc(). This
changes decoding time for cathedral from 8.722sec to 8.706sec, i.e.
0.2% faster overall. More generally (VP8 uses this also), low-motion
content gets significant speed improvements, whereas high-motion content
tends to decode in approximately the same time.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/svq3.c')
-rw-r--r-- | libavcodec/svq3.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index d8ea902cab..10ee1094b4 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -295,9 +295,7 @@ static inline void svq3_mc_dir_part(SVQ3Context *s, if (mx < 0 || mx >= s->h_edge_pos - width - 1 || my < 0 || my >= s->v_edge_pos - height - 1) { - if ((h->flags & CODEC_FLAG_EMU_EDGE)) - emu = 1; - + emu = 1; mx = av_clip(mx, -16, s->h_edge_pos - width + 15); my = av_clip(my, -16, s->v_edge_pos - height + 15); } @@ -1055,6 +1053,11 @@ static int get_buffer(AVCodecContext *avctx, Picture *pic) pic->f.reference = !(h->pict_type == AV_PICTURE_TYPE_B); ret = ff_get_buffer(avctx, &pic->f); + if (!h->edge_emu_buffer) { + h->edge_emu_buffer = av_mallocz(pic->f.linesize[0] * 17); + if (!h->edge_emu_buffer) + return AVERROR(ENOMEM); + } h->linesize = pic->f.linesize[0]; h->uvlinesize = pic->f.linesize[1]; @@ -1242,8 +1245,8 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data, (h->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1; } - ff_draw_horiz_band(avctx, &h->dsp, s->cur_pic, s->last_pic->f.data[0] ? s->last_pic : NULL, - 16 * h->mb_y, 16, h->picture_structure, 0, 1, + ff_draw_horiz_band(avctx, NULL, s->cur_pic, s->last_pic->f.data[0] ? s->last_pic : NULL, + 16 * h->mb_y, 16, h->picture_structure, 0, 0, h->low_delay, h->mb_height * 16, h->mb_width * 16); } @@ -1302,6 +1305,7 @@ static int svq3_decode_end(AVCodecContext *avctx) av_freep(&s->buf); s->buf_size = 0; + av_freep(&h->edge_emu_buffer); return 0; } |