@@ -1836,7 +1836,7 @@ void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,
const ThreadFrame *ref, const VP8mv *mv,
int x_off, int y_off, int block_w, int block_h,
int width, int height, ptrdiff_t linesize,
- vp8_mc_func mc_func[3][3])
+ vp8_mc_func mc_func[3][3], int is_vp7)
{
uint8_t *src = ref->f->data[0];
@@ -1850,7 +1850,8 @@ void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,
y_off += mv->y >> 2;
// edge emulation
- ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 4, 0);
+ if (!is_vp7)
+ ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 4, 0);
src += y_off * linesize + x_off;
if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] ||
y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {
@@ -1866,7 +1867,8 @@ void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,
}
mc_func[my_idx][mx_idx](dst, linesize, src, src_linesize, block_h, mx, my);
} else {
- ff_thread_await_progress(ref, (3 + y_off + block_h) >> 4, 0);
+ if (!is_vp7)
+ ff_thread_await_progress(ref, (3 + y_off + block_h) >> 4, 0);
mc_func[0][0](dst, linesize, src + y_off * linesize + x_off,
linesize, block_h, 0, 0);
}
@@ -1894,7 +1896,7 @@ void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1,
uint8_t *dst2, const ThreadFrame *ref, const VP8mv *mv,
int x_off, int y_off, int block_w, int block_h,
int width, int height, ptrdiff_t linesize,
- vp8_mc_func mc_func[3][3])
+ vp8_mc_func mc_func[3][3], int is_vp7)
{
uint8_t *src1 = ref->f->data[1], *src2 = ref->f->data[2];
@@ -1908,7 +1910,8 @@ void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1,
// edge emulation
src1 += y_off * linesize + x_off;
src2 += y_off * linesize + x_off;
- ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 3, 0);
+ if (!is_vp7)
+ ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 3, 0);
if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] ||
y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
@@ -1933,7 +1936,8 @@ void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1,
mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);
}
} else {
- ff_thread_await_progress(ref, (3 + y_off + block_h) >> 3, 0);
+ if (!is_vp7)
+ ff_thread_await_progress(ref, (3 + y_off + block_h) >> 3, 0);
mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0);
mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0);
}
@@ -1943,7 +1947,7 @@ static av_always_inline
void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
ThreadFrame *ref_frame, int x_off, int y_off,
int bx_off, int by_off, int block_w, int block_h,
- int width, int height, VP8mv *mv)
+ int width, int height, VP8mv *mv, int is_vp7)
{
VP8mv uvmv = *mv;
@@ -1951,7 +1955,7 @@ void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
vp8_mc_luma(s, td, dst[0] + by_off * s->linesize + bx_off,
ref_frame, mv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->linesize,
- s->put_pixels_tab[block_w == 8]);
+ s->put_pixels_tab[block_w == 8], is_vp7);
/* U/V */
if (s->profile == 3) {
@@ -1972,7 +1976,7 @@ void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
dst[2] + by_off * s->uvlinesize + bx_off, ref_frame,
&uvmv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->uvlinesize,
- s->put_pixels_tab[1 + (block_w == 4)]);
+ s->put_pixels_tab[1 + (block_w == 4)], is_vp7);
}
/* Fetch pixels for estimated mv 4 macroblocks ahead.
@@ -2002,7 +2006,7 @@ void prefetch_motion(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
*/
static av_always_inline
void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
- VP8Macroblock *mb, int mb_x, int mb_y)
+ VP8Macroblock *mb, int mb_x, int mb_y, int is_vp7)
{
int x_off = mb_x << 4, y_off = mb_y << 4;
int width = 16 * s->mb_width, height = 16 * s->mb_height;
@@ -2012,7 +2016,7 @@ void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
switch (mb->partitioning) {
case VP8_SPLITMVMODE_NONE:
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 0, 0, 16, 16, width, height, &mb->mv);
+ 0, 0, 16, 16, width, height, &mb->mv, is_vp7);
break;
case VP8_SPLITMVMODE_4x4: {
int x, y;
@@ -2025,7 +2029,7 @@ void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
ref, &bmv[4 * y + x],
4 * x + x_off, 4 * y + y_off, 4, 4,
width, height, s->linesize,
- s->put_pixels_tab[2]);
+ s->put_pixels_tab[2], is_vp7);
}
}
@@ -2054,32 +2058,32 @@ void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
dst[2] + 4 * y * s->uvlinesize + x * 4, ref,
&uvmv, 4 * x + x_off, 4 * y + y_off, 4, 4,
width, height, s->uvlinesize,
- s->put_pixels_tab[2]);
+ s->put_pixels_tab[2], is_vp7);
}
}
break;
}
case VP8_SPLITMVMODE_16x8:
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 0, 0, 16, 8, width, height, &bmv[0]);
+ 0, 0, 16, 8, width, height, &bmv[0], is_vp7);
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 0, 8, 16, 8, width, height, &bmv[1]);
+ 0, 8, 16, 8, width, height, &bmv[1], is_vp7);
break;
case VP8_SPLITMVMODE_8x16:
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 0, 0, 8, 16, width, height, &bmv[0]);
+ 0, 0, 8, 16, width, height, &bmv[0], is_vp7);
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 8, 0, 8, 16, width, height, &bmv[1]);
+ 8, 0, 8, 16, width, height, &bmv[1], is_vp7);
break;
case VP8_SPLITMVMODE_8x8:
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 0, 0, 8, 8, width, height, &bmv[0]);
+ 0, 0, 8, 8, width, height, &bmv[0], is_vp7);
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 8, 0, 8, 8, width, height, &bmv[1]);
+ 8, 0, 8, 8, width, height, &bmv[1], is_vp7);
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 0, 8, 8, 8, width, height, &bmv[2]);
+ 0, 8, 8, 8, width, height, &bmv[2], is_vp7);
vp8_mc_part(s, td, dst, ref, x_off, y_off,
- 8, 8, 8, 8, width, height, &bmv[3]);
+ 8, 8, 8, 8, width, height, &bmv[3], is_vp7);
break;
}
}
@@ -2470,7 +2474,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
if (mb->mode <= MODE_I4x4)
intra_predict(s, td, dst, mb, mb_x, mb_y, is_vp7);
else
- inter_predict(s, td, dst, mb, mb_x, mb_y);
+ inter_predict(s, td, dst, mb, mb_x, mb_y, is_vp7);
prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP8_FRAME_GOLDEN);
@@ -2629,7 +2633,7 @@ int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr,
td->mv_bounds.mv_min.y -= 64 * num_jobs;
td->mv_bounds.mv_max.y -= 64 * num_jobs;
- if (avctx->active_thread_type == FF_THREAD_FRAME)
+ if (!is_vp7 && avctx->active_thread_type == FF_THREAD_FRAME)
ff_thread_report_progress(&curframe->tf, mb_y, 0);
}
@@ -2746,7 +2750,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame,
s->next_framep[VP8_FRAME_CURRENT] = curframe;
- if (ffcodec(avctx->codec)->update_thread_context)
+ if (!is_vp7 && ffcodec(avctx->codec)->update_thread_context)
ff_thread_finish_setup(avctx);
if (avctx->hwaccel) {
@@ -2815,7 +2819,8 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame,
}
}
- ff_thread_report_progress(&curframe->tf, INT_MAX, 0);
+ if (!is_vp7)
+ ff_thread_report_progress(&curframe->tf, INT_MAX, 0);
memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4);
skip_decode:
The VP7 decoder does not support frame threading. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/vp8.c | 55 ++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 25 deletions(-)