On 2013-02-13 19:51:16 +0100, Anton Khirnov wrote:
> ---
> libavcodec/mpeg4videodec.c | 22 ++++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
> index 53da86f..ed889bd 100644
> --- a/libavcodec/mpeg4videodec.c
> +++ b/libavcodec/mpeg4videodec.c
> @@ -20,6 +20,7 @@
> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> */
>
> +#include "internal.h"
> #include "mpegvideo.h"
> #include "mpeg4video.h"
> #include "h263.h"
> @@ -377,8 +378,10 @@ int ff_mpeg4_decode_video_packet_header(MpegEncContext
> *s)
> int mb_x = 0, mb_y = 0;
>
> while (s->next_picture.mbskip_table[s->mb_index2xy[mb_num]]) {
> - if (!mb_x)
> - ff_thread_await_progress(&s->next_picture_ptr->f, mb_y++, 0);
> + if (!mb_x) {
> + s->next_picture_ptr->tf.f = &s->next_picture_ptr->f;
> + ff_thread_await_progress(&s->next_picture_ptr->tf, mb_y++,
> 0);
> + }
> mb_num++;
> if (++mb_x == s->mb_width) mb_x = 0;
> }
> @@ -1289,7 +1292,8 @@ static int mpeg4_decode_mb(MpegEncContext *s,
> s->last_mv[i][1][1]= 0;
> }
>
> - ff_thread_await_progress(&s->next_picture_ptr->f, s->mb_y, 0);
> + s->next_picture_ptr->tf.f = &s->next_picture_ptr->f;
> + ff_thread_await_progress(&s->next_picture_ptr->tf, s->mb_y, 0);
> }
>
> /* if we skipped it in the future P Frame than skip it now too */
> @@ -1471,7 +1475,8 @@ end:
> const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
>
> if (s->pict_type == AV_PICTURE_TYPE_B &&
> s->next_picture.mbskip_table[xy + delta]) {
> - ff_thread_await_progress(&s->next_picture_ptr->f,
> + s->next_picture_ptr->tf.f = &s->next_picture_ptr->f;
> + ff_thread_await_progress(&s->next_picture_ptr->tf,
> (s->mb_x + delta >= s->mb_width) ?
> FFMIN(s->mb_y+1, s->mb_height-1) : s->mb_y, 0);
> }
>
> @@ -2235,6 +2240,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
> s->time_increment_bits = 4; /* default value for broken headers */
> avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
>
> + avctx->internal->allocate_progress = 1;
> +
> + return 0;
> +}
> +
> +static av_cold int init_thread_copy(AVCodecContext *avctx)
> +{
> + avctx->internal->allocate_progress = 1;
unecessary, frame_thread_init takes care of that
> return 0;
> }
>
> @@ -2273,6 +2286,7 @@ AVCodec ff_mpeg4_decoder = {
> .pix_fmts = ff_hwaccel_pixfmt_list_420,
> .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
> .update_thread_context =
> ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context),
> + .init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
see above
otherwise ok
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel