From: "Rémi Denis-Courmont" <remi@remlab.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 3/4] WIP: lavc/h264dsp: take over looking up TC values
Date: Mon, 1 Jul 2024 20:08:06 +0300
Message-ID: <20240701170807.107018-3-remi@remlab.net> (raw)
In-Reply-To: <20240701170807.107018-1-remi@remlab.net>
This moves the look-up of TC values from bS from the generic C loop
filter code to the DSP functions. This (potentially) eliminates a
round-trip to the stack for the looked-up values.
This is work-in-progress. 8 functions need to be updated and this
only updates one of them. Also updating the platform-specific
optimisations is left as an exercise for a future version, as is
updating checkasm.
---
libavcodec/h264_loopfilter.c | 8 ++------
libavcodec/h264dsp.h | 4 +++-
libavcodec/h264dsp_template.c | 9 +++++++--
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index 96f572c1d2..8fca08811c 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -108,12 +108,8 @@ static av_always_inline void filter_mb_edgev(uint8_t *pix, int stride,
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 || !intra ) {
- int8_t tc[4];
- tc[0] = ff_h264_tc0_table[index_a][bS[0]];
- tc[1] = ff_h264_tc0_table[index_a][bS[1]];
- tc[2] = ff_h264_tc0_table[index_a][bS[2]];
- tc[3] = ff_h264_tc0_table[index_a][bS[3]];
- h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc);
+ const int8_t *tc = ff_h264_tc0_table[index_a];
+ h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc, bS);
} else {
h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta);
}
diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
index 13371c59ea..f37ff5414c 100644
--- a/libavcodec/h264dsp.h
+++ b/libavcodec/h264dsp.h
@@ -48,7 +48,9 @@ typedef struct H264DSPContext {
void (*h264_v_loop_filter_luma)(uint8_t *pix /*align 16*/, ptrdiff_t stride,
int alpha, int beta, int8_t *tc0);
void (*h264_h_loop_filter_luma)(uint8_t *pix /*align 4 */, ptrdiff_t stride,
- int alpha, int beta, int8_t *tc0);
+ int alpha, int beta,
+ const int8_t tc0[4] /*align 4*/,
+ const int16_t bs[4] /*align 8*/);
void (*h264_h_loop_filter_luma_mbaff)(uint8_t *pix /*align 16*/, ptrdiff_t stride,
int alpha, int beta, int8_t *tc0);
/* v/h_loop_filter_luma_intra: align 16 */
diff --git a/libavcodec/h264dsp_template.c b/libavcodec/h264dsp_template.c
index fe23a2cff1..4d4e34cf81 100644
--- a/libavcodec/h264dsp_template.c
+++ b/libavcodec/h264dsp_template.c
@@ -153,9 +153,14 @@ static void FUNCC(h264_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, int a
{
FUNCC(h264_loop_filter_luma)(pix, stride, sizeof(pixel), 4, alpha, beta, tc0);
}
-static void FUNCC(h264_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
+static void FUNCC(h264_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, const int8_t tc0[4], const int16_t bS[4])
{
- FUNCC(h264_loop_filter_luma)(pix, sizeof(pixel), stride, 4, alpha, beta, tc0);
+ int8_t tc[4];
+
+ for (size_t i = 0; i < 4; i++)
+ tc[i] = tc0[bS[i]];
+
+ FUNCC(h264_loop_filter_luma)(pix, sizeof(pixel), stride, 4, alpha, beta, tc);
}
static void FUNCC(h264_h_loop_filter_luma_mbaff)(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
{
--
2.45.2
_______________________________________________
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-07-01 17:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 17:08 [FFmpeg-devel] [RFC] [PATCH 1/4] lavc/h264_loopfilter: expose tc0_table (for checkasm) Rémi Denis-Courmont
2024-07-01 17:08 ` [FFmpeg-devel] [PATCH 2/4] lavc/h264_loopfilter: align TC and bS tables Rémi Denis-Courmont
2024-07-01 17:08 ` Rémi Denis-Courmont [this message]
2024-07-01 17:08 ` [FFmpeg-devel] [PATCH 4/4] lavc/h264dsp: update R-V V intra luma loop filter Rémi Denis-Courmont
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=20240701170807.107018-3-remi@remlab.net \
--to=remi@remlab.net \
--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