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 v2 4/4] vvcdec: reuse h26x/h2656_deblock_template.c
Date: Sat,  6 Jan 2024 18:51:32 +0800
Message-ID: <TYSPR06MB64330000902A81F27C1F7537AA652@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20240106105132.31509-1-nuomi2021@gmail.com>

---
 libavcodec/vvc/vvc_filter_template.c | 82 +---------------------------
 1 file changed, 3 insertions(+), 79 deletions(-)

diff --git a/libavcodec/vvc/vvc_filter_template.c b/libavcodec/vvc/vvc_filter_template.c
index 9418980c33..671ed7de4e 100644
--- a/libavcodec/vvc/vvc_filter_template.c
+++ b/libavcodec/vvc/vvc_filter_template.c
@@ -461,6 +461,8 @@ static void FUNC(alf_recon_coeff_and_clip)(int16_t *coeff, int16_t *clip,
 #define FQ2 pix[2  * xstride + 1 * ystride]
 #define FQ3 pix[3  * xstride + 1 * ystride]
 
+#include "libavcodec/h26x/h2656_deblock_template.c"
+
 static void FUNC(loop_filter_luma_large)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, const int32_t tc,
     const uint8_t no_p, const uint8_t no_q, const uint8_t max_len_p, const uint8_t max_len_q)
 {
@@ -541,66 +543,6 @@ static void FUNC(loop_filter_luma_large)(pixel *pix, const ptrdiff_t xstride, co
     }
 }
 
-static void FUNC(loop_filter_luma_strong)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, const int32_t tc,
-    const uint8_t no_p, const uint8_t no_q)
-{
-    const int tc2 = tc << 1;
-    const int tc3 = tc * 3;
-    for (int d = 0; d < 4; d++) {
-        const int p3 = P3;
-        const int p2 = P2;
-        const int p1 = P1;
-        const int p0 = P0;
-        const int q0 = Q0;
-        const int q1 = Q1;
-        const int q2 = Q2;
-        const int q3 = Q3;
-        if (!no_p) {
-            P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc3, tc3);
-            P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2);
-            P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc, tc);
-        }
-        if (!no_q) {
-            Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc3, tc3);
-            Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2);
-            Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc, tc);
-        }
-        pix += ystride;
-    }
-}
-
-static void FUNC(loop_filter_luma_weak)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride,
-    const int32_t tc, const int32_t beta, const uint8_t no_p, const uint8_t no_q, const int nd_p, const int nd_q)
-{
-    const int tc_2 = tc >> 1;
-    for (int d = 0; d < 4; d++) {
-        const int p2 = P2;
-        const int p1 = P1;
-        const int p0 = P0;
-        const int q0 = Q0;
-        const int q1 = Q1;
-        const int q2 = Q2;
-        int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4;
-        if (abs(delta0) < 10 * tc) {
-            delta0 = av_clip(delta0, -tc, tc);
-            if (!no_p)
-                P0 = av_clip_pixel(p0 + delta0);
-            if (!no_q)
-                Q0 = av_clip_pixel(q0 - delta0);
-            if (!no_p && nd_p > 1) {
-                const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2);
-                P1 = av_clip_pixel(p1 + deltap1);
-            }
-            if (!no_q && nd_q > 1) {
-                const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2);
-                Q1 = av_clip_pixel(q1 + deltaq1);
-            }
-        }
-        pix += ystride;
-    }
-
-}
-
 static void FUNC(vvc_loop_filter_luma)(uint8_t* _pix, ptrdiff_t _xstride, ptrdiff_t _ystride,
     const int32_t *_beta, const int32_t *_tc, const uint8_t *_no_p, const uint8_t *_no_q,
     const uint8_t *_max_len_p, const uint8_t *_max_len_q, int hor_ctu_edge)
@@ -673,7 +615,7 @@ static void FUNC(vvc_loop_filter_luma)(uint8_t* _pix, ptrdiff_t _xstride, ptrdif
                 abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 &&
                 abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 &&
                 (d0 << 1) < beta_2 && (d3 << 1) < beta_2) {
-                FUNC(loop_filter_luma_strong)(pix, xstride, ystride, tc, no_p, no_q);
+                FUNC(loop_filter_luma_strong)(pix, xstride, ystride, tc, tc << 1, tc * 3, no_p, no_q);
             } else { // weak filtering
                 int nd_p = 1;
                 int nd_q = 1;
@@ -737,24 +679,6 @@ static void FUNC(loop_filter_chroma_strong_one_side)(pixel *pix, const ptrdiff_t
     }
 }
 
-static void FUNC(loop_filter_chroma_weak)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride,
-    const int size, const int32_t tc, const uint8_t no_p, const uint8_t no_q)
-{
-    for (int d = 0; d < size; d++) {
-        int delta0;
-        const int p1 = P1;
-        const int p0 = P0;
-        const int q0 = Q0;
-        const int q1 = Q1;
-        delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc);
-        if (!no_p)
-            P0 = av_clip_pixel(p0 + delta0);
-        if (!no_q)
-            Q0 = av_clip_pixel(q0 - delta0);
-        pix += ystride;
-    }
-}
-
 static void FUNC(vvc_loop_filter_chroma)(uint8_t *_pix, const ptrdiff_t  _xstride, const ptrdiff_t _ystride,
     const int32_t *_beta, const int32_t *_tc, const uint8_t *_no_p, const uint8_t *_no_q,
     const uint8_t *_max_len_p, const uint8_t *_max_len_q, const int shift)
-- 
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-01-06 10:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240103153238.18678-1-nuomi2021@gmail.com>
2024-01-03 15:32 ` [FFmpeg-devel] [PATCH 1/4] hevcdec: move sao template to xvc_sao_template.c Nuo Mi
2024-01-06 10:51   ` [FFmpeg-devel] [PATCH v2 1/4] hevcdec: move sao template to h26x/h2656_sao_template.c Nuo Mi
     [not found]   ` <20240106105132.31509-1-nuomi2021@gmail.com>
2024-01-06 10:51     ` [FFmpeg-devel] [PATCH v2 2/4] vvcdec: reuse h26x/h2656_sao_template.c Nuo Mi
2024-01-06 10:51     ` [FFmpeg-devel] [PATCH v2 3/4] hevcdec: move deblock template to h26x/h2656_deblock_template.c Nuo Mi
2024-01-06 10:51     ` Nuo Mi [this message]
2024-01-09  1:02       ` [FFmpeg-devel] [PATCH v2 4/4] vvcdec: reuse h26x/h2656_deblock_template.c Nuo Mi
2024-01-09  1:22         ` Ronald S. Bultje
2024-01-09  3:05           ` Nuo Mi
2024-01-09 12:50             ` Ronald S. Bultje
2024-01-11 15:05               ` Nuo Mi
2024-01-03 15:32 ` [FFmpeg-devel] [PATCH 2/4] vvcdec: reuse xvc_sao_template.c Nuo Mi
2024-01-03 15:32 ` [FFmpeg-devel] [PATCH 3/4] hevcdec: move deblock template to xvc_deblock_template.c Nuo Mi
2024-01-03 15:32 ` [FFmpeg-devel] [PATCH 4/4] vvcdec: reuse xvc_deblock_template.c 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=TYSPR06MB64330000902A81F27C1F7537AA652@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