From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 15/18] avcodec/vp8: Disable frame-threading code for VP7 Date: Sat, 10 Sep 2022 03:07:26 +0200 Message-ID: <AS8P250MB074494019D0BD43C9022AFFC8F429@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB0744923C03A16E5BF7BE11B28F429@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> 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(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index baf9820ce6..91f3238245 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -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: -- 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-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-09-10 1:09 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-10 0:19 [FFmpeg-devel] [PATCH 01/18] avcodec/vp8: Disable segmentation " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 02/18] avcodec/vp8: Disable lf_delta " Andreas Rheinhardt 2022-09-11 4:29 ` Peter Ross 2022-09-11 4:38 ` Andreas Rheinhardt 2022-09-11 14:41 ` Ronald S. Bultje 2022-09-11 15:09 ` Ronald S. Bultje 2022-09-11 22:41 ` Peter Ross 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 03/18] avcodec/vp8: Remove unused macros Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 04/18] avcodec/vp8: Inline mb_layout for VP7 Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 05/18] avcodec/vp8: Inline inner_filter " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 06/18] avcodec/vp8: Inline mbskip_enabled " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 07/18] avcodec/vp8: Pass mb_y explicitly Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 08/18] avcodec/vp8: Inline num_coeff_partitions for VP7 Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 09/18] avcodec/vp8: Disable slice-thread synchronization code " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 10/18] avcodec/vp8: Inline num_jobs " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 11/18] avcodec/vp8: Inline jobnr, threadnr " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 12/18] avcodec/vp8: Inline update_last " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 13/18] avcodec/vp8: Don't use avctx->execute2 " Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 14/18] avcodec/vp8: Move fade_present from context to stack Andreas Rheinhardt 2022-09-10 1:07 ` Andreas Rheinhardt [this message] 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 16/18] avcodec/vp8dsp: Remove declarations of inexistent functions Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 17/18] avcodec/vp8dsp: Constify src in vp8_mc_func Andreas Rheinhardt 2022-09-10 1:07 ` [FFmpeg-devel] [PATCH 18/18] avcodec/vp8: Add const where appropriate Andreas Rheinhardt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=AS8P250MB074494019D0BD43C9022AFFC8F429@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git