From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 30FD24B189 for ; Mon, 1 Jul 2024 17:08:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 926E968D814; Mon, 1 Jul 2024 20:08:16 +0300 (EEST) Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 479C868D787 for ; Mon, 1 Jul 2024 20:08:08 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id F41E5C02F8 for ; Mon, 1 Jul 2024 20:08:07 +0300 (EEST) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jul 2024 20:08:06 +0300 Message-ID: <20240701170807.107018-3-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240701170807.107018-1-remi@remlab.net> References: <20240701170807.107018-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] WIP: lavc/h264dsp: take over looking up TC values X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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".