summaryrefslogtreecommitdiff
path: root/libavcodec/rv34.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-01-11 20:10:23 +0100
committerJanne Grunau <janne-libav@jannau.net>2012-01-12 18:38:08 +0100
commit3547f8e8f8418af0c578eba0de62ecba08e460c2 (patch)
tree2fe53d0cad2efb65fb3d4d4d43aae916de13071e /libavcodec/rv34.c
parente1e369049e3d2f88eed6ed38eb3dd704681c7f1a (diff)
rv34: fix and optimise frame dependency checking
The sporadic threading errors during fate-rv30 were caused by calling ff_thread_await_progress with mb row -1 as argument. That returns immediately since progress is initialized to -1. Not yet computed motion vectors from the reference could be used for the first macroblocks.
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r--libavcodec/rv34.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 6cfefa0e1b..48b5193f38 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -685,7 +685,8 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) {
/* wait for the referenced mb row to be finished */
- int mb_row = FFMIN(s->mb_height - 1, s->mb_y + ((yoff + my + 21) >> 4));
+ int mb_row = FFMIN(s->mb_height - 1,
+ s->mb_y + ((yoff + my + 5 + 8 * height) >> 4));
AVFrame *f = dir ? &s->next_picture_ptr->f : &s->last_picture_ptr->f;
ff_thread_await_progress(f, mb_row, 0);
}
@@ -847,7 +848,7 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
//surprisingly, it uses motion scheme from next reference frame
/* wait for the current mb row to be finished */
if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
- ff_thread_await_progress(&s->next_picture_ptr->f, s->mb_y - 1, 0);
+ ff_thread_await_progress(&s->next_picture_ptr->f, FFMAX(0, s->mb_y-1), 0);
next_bt = s->next_picture_ptr->f.mb_type[s->mb_x + s->mb_y * s->mb_stride];
if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){