On Apr 13, 2011, at 11:35 AM, Ronald Bultje wrote:
> Hi,
>
> Tested on a Mac Pro, 2 CPUs, 2 cores each, OSX 10.6.6:
>
> time ./ffmpeg -v 0 -vsync 0 -threads [1234] -i \
> ~/Downloads/sintel_trailer_1080p_vp8_vorbis.webm \
> -f null -vcodec rawvideo -an -
> 1: 0m14.630s (89.9 fps)
> 2: 0m8.056s (163.2 fps)
> 3: 0m5.882s (223.6 fps)
> 4: 0m4.952s (265.6 fps)
>
> time ./ffmpeg -v 0 -vsync 0 -threads [1234] -i \
> ~/Downloads/Elephants_Dream-720p-Stereo.webm \
> -f null -vcodec rawvideo -an -
> 1: 1m12.962s (215.1 fps)
> 2: 0m44.682s (351.2 fps)
> 3: 0m31.183s (503.2 fps)
> 4: 0m25.284s (620.6 fps)
>
> Ronald
> --- a/libavcodec/pthread.c
> +++ b/libavcodec/pthread.c
> @@ -646,6 +646,8 @@ static void frame_thread_free(AVCodecContext *avctx, int
> thread_count)
> pthread_mutex_unlock(&p->mutex);
>
> pthread_join(p->thread, NULL);
> + if (i)
> + update_context_from_thread(p->avctx, fctx->threads[i-1].avctx,
> 0);
>
> if (codec->close)
> codec->close(p->avctx);
I'm not sure other codecs are prepared to have update_context called after
they're closed. Let me think about it.
> @@ -55,12 +56,15 @@ static void vp8_decode_flush(AVCodecContext *avctx)
>
> static int update_dimensions(VP8Context *s, int width, int height)
> {
> - if (av_image_check_size(width, height, 0, s->avctx))
> - return AVERROR_INVALIDDATA;
> + if (width != s->avctx->width ||
> + height != s->avctx->height) {
> + if (av_image_check_size(width, height, 0, s->avctx))
> + return AVERROR_INVALIDDATA;
>
> - vp8_decode_flush(s->avctx);
> + vp8_decode_flush(s->avctx);
>
> - avcodec_set_dimensions(s->avctx, width, height);
> + avcodec_set_dimensions(s->avctx, width, height);
> + }
Size changes should be rejected with frame threads on as it really won't work
(yet). This can be done in pthread.c though.
> -void vp8_mc_luma(VP8Context *s, uint8_t *dst, uint8_t *src, const VP56mv *mv,
> +void vp8_mc_luma(VP8Context *s, uint8_t *dst, AVFrame *ref,
> + uint8_t *src, const VP56mv *mv,
Since one of the parameters is ref->data[0] I think you can get rid of that one.
> @@ -1151,6 +1163,7 @@ static av_always_inline void prefetch_motion(VP8Context
> *s, VP8Macroblock *mb, i
> int my = (mb->mv.y>>2) + y_off;
> uint8_t **src= s->framep[ref]->data;
> int off= mx + (my + (mb_x&3)*4)*s->linesize + 64;
> + // FIXME does this need a ff_thread_await_progress()?
> s->dsp.prefetch(src[0]+off, s->linesize, 4);
> off= (mx>>1) + ((my>>1) + (mb_x&7))*s->uvlinesize + 64;
> s->dsp.prefetch(src[1]+off, src[2]-src[1], 2);
Yes (if the reference thread is in another CPU). So you might want to follow
the h264 pattern.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel