From: Nuo Mi <nuomi2021@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Nuo Mi <nuomi2021@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 11/16] avcodec/vvcdec: refact, movie the lc->sc assignment to task_run_stage to simplify the code Date: Wed, 27 Mar 2024 21:01:07 +0800 Message-ID: <TYSPR06MB6433487DBC94B96469A24AD1AA342@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw) In-Reply-To: <20240327130112.6111-1-nuomi2021@gmail.com> This change also make the lc->sc assigned for run_sao --- libavcodec/vvc/vvc_thread.c | 66 ++++++++++--------------------------- 1 file changed, 17 insertions(+), 49 deletions(-) diff --git a/libavcodec/vvc/vvc_thread.c b/libavcodec/vvc/vvc_thread.c index 5d2e8c67b9..8f23b8138b 100644 --- a/libavcodec/vvc/vvc_thread.c +++ b/libavcodec/vvc/vvc_thread.c @@ -416,7 +416,6 @@ static int run_parse(VVCContext *s, VVCLocalContext *lc, VVCTask *t) const int rs = t->rs; const CTU *ctu = fc->tab.ctus + rs; - lc->sc = t->sc; lc->ep = t->ep; ret = ff_vvc_coding_tree_unit(lc, t->ctu_idx, rs, t->rx, t->ry); @@ -432,15 +431,9 @@ static int run_parse(VVCContext *s, VVCLocalContext *lc, VVCTask *t) static int run_inter(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { VVCFrameContext *fc = lc->fc; - VVCFrameThread *ft = fc->ft; - const int rs = t->ry * ft->ctu_width + t->rx; - const CTU *ctu = fc->tab.ctus + rs; - const int slice_idx = fc->tab.slice_idx[rs]; + const CTU *ctu = fc->tab.ctus + t->rs; - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_predict_inter(lc, rs); - } + ff_vvc_predict_inter(lc, t->rs); if (ctu->has_dmvr) report_frame_progress(fc, t->ry, VVC_PROGRESS_MV); @@ -450,14 +443,7 @@ static int run_inter(VVCContext *s, VVCLocalContext *lc, VVCTask *t) static int run_recon(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { - VVCFrameContext *fc = lc->fc; - const int rs = t->rs; - const int slice_idx = fc->tab.slice_idx[rs]; - - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_reconstruct(lc, rs, t->rx, t->ry); - } + ff_vvc_reconstruct(lc, t->rs, t->rx, t->ry); return 0; } @@ -469,13 +455,8 @@ static int run_lmcs(VVCContext *s, VVCLocalContext *lc, VVCTask *t) const int ctu_size = ft->ctu_size; const int x0 = t->rx * ctu_size; const int y0 = t->ry * ctu_size; - const int rs = t->ry * ft->ctu_width + t->rx; - const int slice_idx = fc->tab.slice_idx[rs]; - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_lmcs_filter(lc, x0, y0); - } + ff_vvc_lmcs_filter(lc, x0, y0); return 0; } @@ -484,18 +465,13 @@ static int run_deblock_v(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { VVCFrameContext *fc = lc->fc; VVCFrameThread *ft = fc->ft; - const int rs = t->ry * ft->ctu_width + t->rx; const int ctb_size = ft->ctu_size; const int x0 = t->rx * ctb_size; const int y0 = t->ry * ctb_size; - const int slice_idx = fc->tab.slice_idx[rs]; - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) { - ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs); - ff_vvc_deblock_vertical(lc, x0, y0, rs); - } + if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) { + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); + ff_vvc_deblock_vertical(lc, x0, y0, t->rs); } return 0; @@ -506,20 +482,15 @@ static int run_deblock_h(VVCContext *s, VVCLocalContext *lc, VVCTask *t) VVCFrameContext *fc = lc->fc; VVCFrameThread *ft = fc->ft; const int ctb_size = ft->ctu_size; - const int rs = t->ry * ft->ctu_width + t->rx; const int x0 = t->rx * ctb_size; const int y0 = t->ry * ctb_size; - const int slice_idx = fc->tab.slice_idx[rs]; - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) { - ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs); - ff_vvc_deblock_horizontal(lc, x0, y0, rs); - } - if (fc->ps.sps->r->sps_sao_enabled_flag) - ff_vvc_sao_copy_ctb_to_hv(lc, t->rx, t->ry, t->ry == ft->ctu_height - 1); + if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) { + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); + ff_vvc_deblock_horizontal(lc, x0, y0, t->rs); } + if (fc->ps.sps->r->sps_sao_enabled_flag) + ff_vvc_sao_copy_ctb_to_hv(lc, t->rx, t->ry, t->ry == ft->ctu_height - 1); return 0; } @@ -528,13 +499,12 @@ static int run_sao(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { VVCFrameContext *fc = lc->fc; VVCFrameThread *ft = fc->ft; - const int rs = t->ry * fc->ps.pps->ctb_width + t->rx; const int ctb_size = ft->ctu_size; const int x0 = t->rx * ctb_size; const int y0 = t->ry * ctb_size; if (fc->ps.sps->r->sps_sao_enabled_flag) { - ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs); + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); ff_vvc_sao_filter(lc, x0, y0); } @@ -553,12 +523,8 @@ static int run_alf(VVCContext *s, VVCLocalContext *lc, VVCTask *t) const int y0 = t->ry * ctu_size; if (fc->ps.sps->r->sps_alf_enabled_flag) { - const int slice_idx = CTB(fc->tab.slice_idx, t->rx, t->ry); - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); - ff_vvc_alf_filter(lc, x0, y0); - } + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); + ff_vvc_alf_filter(lc, x0, y0); } report_frame_progress(fc, t->ry, VVC_PROGRESS_PIXEL); @@ -602,6 +568,8 @@ static void task_run_stage(VVCTask *t, VVCContext *s, VVCLocalContext *lc) av_log(s->avctx, AV_LOG_DEBUG, "frame %5d, %s(%3d, %3d)\r\n", (int)t->fc->decode_order, task_name[stage], t->rx, t->ry); #endif + lc->sc = t->sc; + if (!atomic_load(&ft->ret)) { if ((ret = run[stage](s, lc, t)) < 0) { #ifdef COMPAT_ATOMICS_WIN32_STDATOMIC_H -- 2.25.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:[~2024-03-27 13:04 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20240327130112.6111-1-nuomi2021@gmail.com> 2024-03-27 13:00 ` [FFmpeg-devel] [PATCH v2 01/16] avcodec/vvcdec: NoBackwardPredFlag, only check active pictures Nuo Mi 2024-03-27 13:00 ` [FFmpeg-devel] [PATCH v2 02/16] avcodec/cbs_h266: fix sh_collocated_from_l0_flag and sh_collocated_ref_idx infer Nuo Mi 2024-03-27 13:00 ` [FFmpeg-devel] [PATCH v2 03/16] avcodec/vvcdec: misc, add specification name for pps members Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 04/16] avcodec/vvcdec: fix uninitialized last element of xxx_bd and ctb_to_xxx_bd arrays Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 05/16] avcodec/vvcdec: support rectangular single-slice subpics Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 06/16] avcodec/vvcdec: derive subpic postion for PPS Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 07/16] avcodec/vvcdec: ff_vvc_decode_neighbour, support subpicture Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 08/16] avcodec/vvcdec: misc, rename x_ctb, y_ctb, ctu_x, ctu_y to rx, ry to avoid misleading Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 09/16] avcodec/vvcdec: refact out deblock_is_boundary Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 10/16] avcodec/vvcdec: deblock, support subpicture Nuo Mi 2024-03-27 13:01 ` Nuo Mi [this message] 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 12/16] avcodec/vvcdec: sao, refact out tile_edge arrays Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 13/16] avcodec/vvcdec: sao, support subpicture Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 14/16] avcodec/vvcdec: alf, " Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 15/16] avcodec/vvcdec: mvs, " Nuo Mi 2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 16/16] avcodec/vvcdec: inter prediction, " Nuo Mi
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=TYSPR06MB6433487DBC94B96469A24AD1AA342@TYSPR06MB6433.apcprd06.prod.outlook.com \ --to=nuomi2021@gmail.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