From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 4DE754D39F for ; Tue, 18 Nov 2025 07:29:40 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'gjmBbGqFivffoJMZMLUB0/cbAVe5/PJsImsSHD5l58w=', expected b'B+giBVPf1V84Wox9tLv9eFOkAow0hc7jaZo8zGJG4Xg=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1763450961; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=gjmBbGqFivffoJMZMLUB0/cbAVe5/PJsImsSHD5l58w=; b=TQXPTO70dvNjjqUxHh206+hcpOsodZGDek061rfwJpBrbrsAUrlUs9+rGOeHltjnt0QgZ WLOrzUMzL0xyZDA+HR9IAmyQ1rTjzVoeMScXhhBcvSNy7eHHiC1fJaI6GINen2rE7olyE9w JNcTEJ4hJbmHVeZDj9vab5lut/4Hj8KloR7zTKSk6RFsBVT7m/NFD9ReK6pi0dN96ZxpHZe bRkRiSyWr4cHPkJb0/UHRUCCfndVIxcoT6huzBfNCuGDaNJIDJ11EN5N2+6kyUfkeA4Q9dd A98KOrL2E+kasHUDRCpanL4/pV4TqNgU3uJTUEP9ZMVIkIEbs4qp2XXuRodg== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id B1EA468FF01; Tue, 18 Nov 2025 09:29:21 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1763450941; b=e0RbGIn/Z48MGmhHU1+RBq0z94cEs4buF09jjCyYyNRFb4wMGPGXEHS/DLKWDcJxo+xrh P+lAYIv1Iic+f793qNDFfCgd++qyrnMm4YAhwRzSuC3kqYQfe9FMpJBUH2+HSZ/tJb3sgtZ wniRbmIlWa3ru36qrLSd1Hpxj0OuJxFs91xHQSDQ29vY96fpUYF9XUSdrgUKqyK4IqnNZ5T s+ynN9X9gbudb12c+/VBe2sDtH4aTy9xp6HkPwyWSqNkBv6BV95zMozX/u0ZJAAMBFRUAF7 iB35BHHLsu9qA5GOIzpkMdt4bgsTbQJMrvA5UF8oleWtozGiPG3FELrwX1dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1763450941; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=h971wUJBvPVn1raHtxeghrVar+Myy4OYM752+bHk1Oo=; b=ZCvcxnh36zToIXgkbCQUksg2qe5H8yhF1DxVrUxIoP73khiUouZnV1H7qQ3Q+nFJM/gtc zhTxnjX5eqBBe+IDpQN2Syq+GnMtDuCDEZHBR5ud1WvkrZBnjFxldXkZBxKyYcj7Y7PFOyD 22XWxAvWLUGYuT2iWjKWejSJMxHja03BE3OFhZtEHFajGxmbZuV+w05vkW7ywke85REyz0K a0IFKdBHzEkUPp3SLp2krZDWyMu3GPVa2GPl85YtKSLMHxlLYXdKSrCM7Pfr6YOQ0sfdI+B JY4AT160J6Fhlja0Bpmb39FhTX7FkEBstd/ulr3Kch4KtZLv7NHvCfyxSGuw== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1763450932; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=B+giBVPf1V84Wox9tLv9eFOkAow0hc7jaZo8zGJG4Xg=; b=kzeotX18+rVfHi3C+uGQJGZlZ3t4V4nqHRNdSPsOUdIqDbhnaiBN34cq/UHGHwNDQ9wDP MsBReLCibh9oScsUkfcb0+9DL08utAjm4AZhr4I9z3x53RPy2jUCxdiD7DyBwWUveW4+62W HW4Jc9X2bdwxle89QtJi32aBpfuLtIqcFJJs0mavZyp7na9mBtnQ0UGJGb166GSJtlnPjdn 72+bbo0G+jQt+3YI1p8OHzZw8XukOifSXGL+f+HmcZKLwIObDNDpll0fi8KPeuRVKtdmUmv +4yrtblIqUmdmxXa9bVQTEIDE5bJn8bMARGDTENzrx7NCAvrhKqgdeYfPv9A== Received: from 188d6d40ca7a (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id B14CC68FD0F for ; Tue, 18 Nov 2025 09:28:52 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Nov 2025 07:28:52 -0000 Message-ID: <176345093291.25.12707410790096734733@2cb04c0e5124> Message-ID-Hash: TVNTE2AHGLDE4LCTC6EE3YLEOST3WMFH X-Message-ID-Hash: TVNTE2AHGLDE4LCTC6EE3YLEOST3WMFH X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avcodec: fix checkasm-hpeldsp failed on LA (PR #20951) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: HecaiYuan via ffmpeg-devel Cc: HecaiYuan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20951 opened by HecaiYuan URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20951 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20951.patch This wrapper performs runtime dispatch to SIMD-optimized functions and falls back to a C implementation for unsupported block heights. >>From 3d5177ecfb1fe88ecfcb0dc66db68c1dd8d2977c Mon Sep 17 00:00:00 2001 From: yuanhecai Date: Mon, 17 Nov 2025 17:32:53 +0800 Subject: [PATCH] avcodec: fix checkasm-hpeldsp failed on LA This wrapper performs runtime dispatch to SIMD-optimized functions and falls back to a C implementation for unsupported block heights. --- libavcodec/loongarch/hpeldsp_init_loongarch.c | 108 ++++++++++++++++-- 1 file changed, 101 insertions(+), 7 deletions(-) diff --git a/libavcodec/loongarch/hpeldsp_init_loongarch.c b/libavcodec/loongarch/hpeldsp_init_loongarch.c index 1690be5438..681e11a70a 100644 --- a/libavcodec/loongarch/hpeldsp_init_loongarch.c +++ b/libavcodec/loongarch/hpeldsp_init_loongarch.c @@ -23,28 +23,122 @@ #include "libavcodec/hpeldsp.h" #include "libavcodec/loongarch/hpeldsp_lasx.h" +static op_pixels_func put_pixels16_xy2_8_c_fallback = NULL; +static op_pixels_func put_no_rnd_pixels16_y2_8_c_fallback = NULL; +static op_pixels_func put_no_rnd_pixels16_xy2_8_c_fallback = NULL; +static op_pixels_func put_no_rnd_pixels8_y2_8_c_fallback = NULL; +static op_pixels_func put_no_rnd_pixels8_xy2_8_c_fallback = NULL; +static op_pixels_func put_no_rnd_pixels16_x2_8_c_fallback = NULL; +static op_pixels_func put_no_rnd_pixels8_x2_8_c_fallback = NULL; + +static inline void put_no_rnd_pix16_y2_8_lasx_wrap(uint8_t *block, + const uint8_t *pixels, + ptrdiff_t line_size, int h) +{ + if (h == 16 || h == 8) { + ff_put_no_rnd_pixels16_y2_8_lasx(block, pixels, line_size, h); + } else { + put_no_rnd_pixels16_y2_8_c_fallback(block, pixels, line_size, h); + } +} + +static inline void put_no_rnd_pix16_xy2_8_lasx_wrap(uint8_t *block, + const uint8_t *pixels, + ptrdiff_t line_size, int h) +{ + if (h == 16 || h == 8) { + ff_put_no_rnd_pixels16_xy2_8_lasx(block, pixels, line_size, h); + } else { + put_no_rnd_pixels16_xy2_8_c_fallback(block, pixels, line_size, h); + } +} + +static inline void put_no_rnd_pix8_y2_8_lasx_wrap(uint8_t *block, + const uint8_t *pixels, + ptrdiff_t line_size, int h) +{ + if (h == 8 || h == 4) { + ff_put_no_rnd_pixels8_y2_8_lasx(block, pixels, line_size, h); + } else { + put_no_rnd_pixels8_y2_8_c_fallback(block, pixels, line_size, h); + } +} + +static inline void put_no_rnd_pix8_xy2_8_lasx_wrap(uint8_t *block, + const uint8_t *pixels, + ptrdiff_t line_size, int h) +{ + if (h == 8 || h == 4) { + ff_put_no_rnd_pixels8_xy2_8_lasx(block, pixels, line_size, h); + } else { + put_no_rnd_pixels8_xy2_8_c_fallback(block, pixels, line_size, h); + } +} + +static inline void put_pix16_xy2_8_lasx_wrap(uint8_t *block, + const uint8_t *pixels, + ptrdiff_t line_size, int h) +{ + if (h == 16) { + ff_put_pixels16_xy2_8_lasx(block, pixels, line_size, h); + } else { + put_pixels16_xy2_8_c_fallback(block, pixels, line_size, h); + } +} + +static inline void put_no_rnd_pix16_x2_8_lasx_wrap(uint8_t *block, + const uint8_t *pixels, + ptrdiff_t line_size, int h) +{ + if (h == 16 || h == 8) { + ff_put_no_rnd_pixels16_x2_8_lasx(block, pixels, line_size, h); + } else { + put_no_rnd_pixels16_x2_8_c_fallback(block, pixels, line_size, h); + } +} + +static inline void put_no_rnd_pix8_x2_8_lasx_wrap(uint8_t *block, + const uint8_t *pixels, + ptrdiff_t line_size, int h) +{ + if (h == 8 || h == 4) { + ff_put_no_rnd_pixels8_x2_8_lasx(block, pixels, line_size, h); + } else { + put_no_rnd_pixels8_x2_8_c_fallback(block, pixels, line_size, h); + } +} + void ff_hpeldsp_init_loongarch(HpelDSPContext *c, int flags) { int cpu_flags = av_get_cpu_flags(); if (have_lasx(cpu_flags)) { + + put_pixels16_xy2_8_c_fallback = c->put_pixels_tab[0][3]; + put_no_rnd_pixels16_y2_8_c_fallback = c->put_no_rnd_pixels_tab[0][2]; + put_no_rnd_pixels16_xy2_8_c_fallback = c->put_no_rnd_pixels_tab[0][3]; + put_no_rnd_pixels8_y2_8_c_fallback = c->put_no_rnd_pixels_tab[1][2]; + put_no_rnd_pixels8_xy2_8_c_fallback = c->put_no_rnd_pixels_tab[1][3]; + put_no_rnd_pixels16_x2_8_c_fallback = c->put_no_rnd_pixels_tab[0][1]; + put_no_rnd_pixels8_x2_8_c_fallback = c->put_no_rnd_pixels_tab[1][1]; + c->put_pixels_tab[0][0] = ff_put_pixels16_8_lsx; c->put_pixels_tab[0][1] = ff_put_pixels16_x2_8_lasx; c->put_pixels_tab[0][2] = ff_put_pixels16_y2_8_lasx; - c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_8_lasx; + c->put_pixels_tab[0][3] = put_pix16_xy2_8_lasx_wrap; c->put_pixels_tab[1][0] = ff_put_pixels8_8_lasx; c->put_pixels_tab[1][1] = ff_put_pixels8_x2_8_lasx; c->put_pixels_tab[1][2] = ff_put_pixels8_y2_8_lasx; c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_8_lasx; c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_8_lsx; - c->put_no_rnd_pixels_tab[0][1] = ff_put_no_rnd_pixels16_x2_8_lasx; - c->put_no_rnd_pixels_tab[0][2] = ff_put_no_rnd_pixels16_y2_8_lasx; - c->put_no_rnd_pixels_tab[0][3] = ff_put_no_rnd_pixels16_xy2_8_lasx; + c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pix16_x2_8_lasx_wrap; + c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pix16_y2_8_lasx_wrap; + c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pix16_xy2_8_lasx_wrap; c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_8_lasx; - c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_8_lasx; - c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_8_lasx; - c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_8_lasx; + c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pix8_x2_8_lasx_wrap; + c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pix8_y2_8_lasx_wrap; + c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pix8_xy2_8_lasx_wrap; } } -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org