Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nuo Mi <nuomi2021@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Nuo Mi <nuomi2021@gmail.com>
Subject: [FFmpeg-devel] [PATCH 09/14] avcodec/vvcdec: refact, movie the lc->sc assignment to task_run_stage to simplify the code
Date: Mon, 18 Mar 2024 22:16:21 +0800
Message-ID: <TYSPR06MB6433AC2FFC0A9B057E69F28BAA2D2@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20240318141626.3375-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".

  parent reply	other threads:[~2024-03-18 14:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240318141626.3375-1-nuomi2021@gmail.com>
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 01/14] avcodec/vvcdec: NoBackwardPredFlag, only check active pictures Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 02/14] avcodec/cbs_h266: fix sh_collocated_from_l0_flag and sh_collocated_ref_idx infer Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 03/14] avcodec/vvcdec: support rectangular single-slice subpics Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 04/14] avcodec/vvcdec: derive subpic postion for PPS Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 05/14] avcodec/vvcdec: ff_vvc_decode_neighbour, support subpicture Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 06/14] avcodec/vvcdec: misc, rename x_ctb, y_ctb, ctu_x, ctu_y to rx, ry to avoid misleading Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 07/14] avcodec/vvcdec: refact out deblock_is_boundary Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 08/14] avcodec/vvcdec: deblock, support subpicture Nuo Mi
2024-03-18 14:16 ` Nuo Mi [this message]
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 10/14] avcodec/vvcdec: sao, refact out tile_edge arrays Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 11/14] avcodec/vvcdec: sao, support subpicture Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 12/14] avcodec/vvcdec: alf, " Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 13/14] avcodec/vvcdec: mvs, " Nuo Mi
2024-03-18 14:16 ` [FFmpeg-devel] [PATCH 14/14] 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=TYSPR06MB6433AC2FFC0A9B057E69F28BAA2D2@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