The VP7 decoder is not slice-threaded; by its design, VP7 only allows at most two slice threads per frame and if it were ever implemented, it would likely need custom synchronization code anyway, so disable the current code for it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/vp8.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index f5c05cd84f..dd3d38d342 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2440,7 +2440,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void if (vpx_rac_is_end(c)) return AVERROR_INVALIDDATA; // Wait for previous thread to read mb_x+2, and reach mb_y-1. - if (prev_td != td) { + if (!is_vp7 && prev_td != td) { if (threadnr != 0) { check_thread_pos(td, prev_td, mb_x + (is_vp7 ? 2 : 1), @@ -2508,11 +2508,9 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void td->mv_bounds.mv_min.x -= 64; td->mv_bounds.mv_max.x -= 64; - if (mb_x == s->mb_width + 1) { - update_pos(td, mb_y, s->mb_width + 3); - } else { - update_pos(td, mb_y, mb_x); - } + if (!is_vp7) + update_pos(td, mb_y, mb_x == s->mb_width + 1 ? + s->mb_width + 3 : mb_x); } return 0; } @@ -2561,10 +2559,10 @@ static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata, for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb++) { VP8FilterStrength *f = &td->filter_strength[mb_x]; - if (prev_td != td) + if (!is_vp7 && prev_td != td) check_thread_pos(td, prev_td, (mb_x + 1) + (s->mb_width + 3), mb_y - 1); - if (next_td != td) + if (!is_vp7 && next_td != td) if (next_td != &s->thread_data[0]) check_thread_pos(td, next_td, mb_x + 1, mb_y + 1); @@ -2585,7 +2583,8 @@ static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata, dst[1] += 8; dst[2] += 8; - update_pos(td, mb_y, (s->mb_width + 3) + mb_x); + if (!is_vp7) + update_pos(td, mb_y, (s->mb_width + 3) + mb_x); } } @@ -2618,12 +2617,14 @@ int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) { ret = s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, mb_y); if (ret < 0) { - update_pos(td, s->mb_height, INT_MAX & 0xFFFF); + if (!is_vp7) + update_pos(td, s->mb_height, INT_MAX & 0xFFFF); return ret; } if (s->deblock_filter) s->filter_mb_row(avctx, tdata, jobnr, threadnr, mb_y); - update_pos(td, mb_y, INT_MAX & 0xFFFF); + if (!is_vp7) + update_pos(td, mb_y, INT_MAX & 0xFFFF); td->mv_bounds.mv_min.y -= 64 * num_jobs; td->mv_bounds.mv_max.y -= 64 * num_jobs; @@ -2802,17 +2803,18 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, s->prev_frame = prev_frame; s->mv_bounds.mv_min.y = -MARGIN; s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; - for (i = 0; i < MAX_THREADS; i++) { - VP8ThreadData *td = &s->thread_data[i]; - atomic_init(&td->thread_mb_pos, 0); - atomic_init(&td->wait_mb_pos, INT_MAX); - } - if (is_vp7) + if (is_vp7) { avctx->execute2(avctx, vp7_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); - else + } else { + for (unsigned i = 0; i < MAX_THREADS; i++) { + VP8ThreadData *td = &s->thread_data[i]; + atomic_init(&td->thread_mb_pos, 0); + atomic_init(&td->wait_mb_pos, INT_MAX); + } avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); + } } ff_thread_report_progress(&curframe->tf, INT_MAX, 0); -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".