From patchwork Thu Jul 25 20:25:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50735 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a830:0:b0:482:c625:d099 with SMTP id z16csp79773vqo; Thu, 25 Jul 2024 13:25:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQb07dkJq2f98VxQiuVOmlISJzukInQ15GIfRf9zk1pYlpPjx/zV+MYJ//EiKy4sw152XGMJDFf6YawGqLCav7A2KSdjF49Ruicw== X-Google-Smtp-Source: AGHT+IGKs14x/SztpoJKxmrBMek4Tlwnxq5k3kkQX/HOHw/9V4KPGt163KjDTQ2ubqYlQtq0wZVN X-Received: by 2002:a05:6512:2245:b0:52c:deae:b8fa with SMTP id 2adb3069b0e04-52fd3ef20b4mr3409471e87.3.1721939145659; Thu, 25 Jul 2024 13:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721939145; cv=none; d=google.com; s=arc-20160816; b=pZz8vF8q20uvu7CDFZMGxkb6npOZy2i6+9ZpkHku2n2aBzejIn3T8HKgmcUV9hzV3g 6wCxxBi009BzIAS6w1XP0m7UKG4Rs/+W3ZiRLwm2guZCrE5DLDfy8eo3FTZqz7p1scIF qKQcBKZE3dsGdzlmfeufFjZPuwNLmLw4lACsXdjIl9SyxpGrGRXgwugynJHyNLQP8TAu dHOh6xo6J/HEtepljBZ8hmKw3/Rjv1bvw3HfRRrZhXEZUtzCpd5gVl8tm/GoKIWbBPQz X2Nnoqj2PPvzubT8/SoYExjZ9untlVDAGNTTFAf0wuV58Ea04M4eO14Pn20xf4LTR/+r EU5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=LsDqbIpn/6Cbytn4J8KRBRxnAUMvGtVDXyArIPvAZi0=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=DuyY/OlJDVoPgFOIYRwrjR1QSYTXNWPXE4iGIXKzo5fZRYZ0Tmz/2sF5EgE/v1uX10 aNZyEP7jn5utJNJkEh1tr4Cg0H93O8dSQrA7hTmXYJzu85WfyuqkoO1imiC2R9X5Lr3U bJTHqzjJicA7jZr0+1eZA/g66GdkTsFVePBaUpLMRzeCaYEagnUMHuV0JdF5+KXUMTLW BhJT/rnqp59VXsySB1av5XAp3Mz35DWaeDEe8ZwUQjOeKHM2UdGAh0aJa3D0W37Jm729 /+Is4HPIdgQaiwpoMyzK9BDktSf7Tl6F2XU5UqI587m6NP5Rin46fk71IKogtcMR20WF +wxw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5ac65e47563si1407490a12.518.2024.07.25.13.25.44; Thu, 25 Jul 2024 13:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CA24368D7A0; Thu, 25 Jul 2024 23:25:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8510568D682 for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id D797BC013B for ; Thu, 25 Jul 2024 23:25:22 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 23:25:15 +0300 Message-ID: <20240725202522.276182-1-remi@remlab.net> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] lavu/riscv: implement floating point clips 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: TwfPQi+5DAEk Unlike x86, fmin/fmax are single instructions, not function calls. They are much much faster than doing a comparison, then branching based on its results. With this, audiodsp.vector_clipf gets almost twice as fast, and a properly unrollled version of it gets 4-5x faster, on SiFive-U74. This is only the low-hanging fruit: FFMIN and FFMAX are presumably affected as well. This likely applies to other instruction sets with native IEEE floats, especially those lacking a conditional select instruction. --- libavutil/riscv/intmath.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libavutil/riscv/intmath.h b/libavutil/riscv/intmath.h index 3e7ab864c5..24f165eef1 100644 --- a/libavutil/riscv/intmath.h +++ b/libavutil/riscv/intmath.h @@ -22,6 +22,7 @@ #define AVUTIL_RISCV_INTMATH_H #include +#include #include "config.h" #include "libavutil/attributes.h" @@ -72,6 +73,24 @@ static av_always_inline av_const int av_clip_intp2_rvi(int a, int p) return b; } +#if defined (__riscv_f) || defined (__riscv_zfinx) +#define av_clipf av_clipf_rvf +static av_always_inline av_const float av_clipf_rvf(float a, float min, + float max) +{ + return fminf(fmaxf(a, min), max); +} +#endif + +#if defined (__riscv_d) || defined (__riscv_zdinx) +#define av_clipd av_clipd_rvd +static av_always_inline av_const float av_clipd_rvd(double a, double min, + double max) +{ + return fmin(fmax(a, min), max); +} +#endif + #if defined (__GNUC__) || defined (__clang__) static inline av_const int ff_ctz_rv(int x) { From patchwork Thu Jul 25 20:25:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50737 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a830:0:b0:482:c625:d099 with SMTP id z16csp79844vqo; Thu, 25 Jul 2024 13:25:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZifpTWj+N7a3/QEmxBzhpoaSACjCqV05yaqj1m/iXlKWLq4DrXLuZ6VpmZ4/a9rf/4LX0BRgWw7QktXapBaZRduG3QPIuDrMBug== X-Google-Smtp-Source: AGHT+IH4ARxT/EFgMmOidTEuxaE7bMZqxuz6Eswj0GSq6O7+cx3VYBCnPIg7JgoQ23EmvHhtOJBE X-Received: by 2002:a05:6402:3511:b0:58c:36e:51bf with SMTP id 4fb4d7f45d1cf-5ac123a7ac3mr4453903a12.3.1721939158120; Thu, 25 Jul 2024 13:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721939158; cv=none; d=google.com; s=arc-20160816; b=mu69oMRZHd4PH3nktRw4TFsof6ZXa8rq5HZxFzTiITFXCfzIZSH9apDNaq3mvQeQA6 dWpPkbkcMVk0Xhed7kQLh+enxLhnrXB+rRZm3OCUfYP945CZ1JkgjonXwKpH2IR9SpX0 RauVFH7B4KN2Xz6JGkuhku/LiQaqetOSR825b4bLu6CD7OBIEpWBcsUuHwFAn9OP2/g5 e/ZusAnDzX4TG4VMnXB67PAlxd+CQX8dKnsihiYJRh31JT/ZMlHm+EsfEhHFPfyOT1yF KxHeeyEzbnlGWs/nJQpKWgdrerrhXKdFT1LMZBqa4NvwrGmidGgKLr2XnqZIdYgMQ6rO jCzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=JClJAbgGuqiOGAt2/LMkZytnm38bx4vVEnUy/Ywcki8=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=iRVClG1taP/otTzcqpHmw/vW5oCnqOvEhl+auC2QIHe1EF4w1sTPgm+zdUEEUeBIyR r6Z5LhgjkFcDfIhQyfxBurchNZEKVfzEVUZUwTCbwqkQEXt27Oj38eThzBF0YDRuRYod H5SBv5aaHqOcmU20O97wj1wU0QzkFE84qTeMcNqsslgpEHyJrgKdX8nsOFilNwo13cLp CQyvLJGmd7X41IxqfStz7jCbgxf8oqgnx6kuO27heubLhT7JyR76ezYUwqjO6jxvWliq Iuhc6K0iZew13aLZJfMEGHfz5BLnnUypr1emqs4rjUrZqBf3WkLD0XEjvgGlyAYOlg6+ MP9Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5ac64eb87b4si1528617a12.325.2024.07.25.13.25.33; Thu, 25 Jul 2024 13:25:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8DE9268D793; Thu, 25 Jul 2024 23:25:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7C51068D42D for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 1A3C5C013D for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 23:25:16 +0300 Message-ID: <20240725202522.276182-2-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240725202522.276182-1-remi@remlab.net> References: <20240725202522.276182-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] lavc/audiodsp: properly unroll vector_clipf 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6br165L/Ifg0 Given that source and destination can alias, the compiler was forced to perform each read-modify-write sequentially. We cannot use the `restrict` qualifier to avoid this here because the AC-3 encoder uses the function in-place. Instead this commit provides an explicit guarantee to the compiler that batches of 8 elements will not overlap, so that it can interleave calculations. In practice contemporary optimising compilers are able to unroll and keep the temporary array in FPU registers (without spilling). On SiFive-U74, this speeds the same signs branch by 4x, and the opposite signs branch 1.5x. --- libavcodec/audiodsp.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/libavcodec/audiodsp.c b/libavcodec/audiodsp.c index c5427d3535..9e83f06aaa 100644 --- a/libavcodec/audiodsp.c +++ b/libavcodec/audiodsp.c @@ -38,41 +38,35 @@ static inline float clipf_c_one(float a, uint32_t mini, static void vector_clipf_c_opposite_sign(float *dst, const float *src, float min, float max, int len) { - int i; uint32_t mini = av_float2int(min); uint32_t maxi = av_float2int(max); uint32_t maxisign = maxi ^ (1U << 31); - for (i = 0; i < len; i += 8) { - dst[i + 0] = clipf_c_one(src[i + 0], mini, maxi, maxisign); - dst[i + 1] = clipf_c_one(src[i + 1], mini, maxi, maxisign); - dst[i + 2] = clipf_c_one(src[i + 2], mini, maxi, maxisign); - dst[i + 3] = clipf_c_one(src[i + 3], mini, maxi, maxisign); - dst[i + 4] = clipf_c_one(src[i + 4], mini, maxi, maxisign); - dst[i + 5] = clipf_c_one(src[i + 5], mini, maxi, maxisign); - dst[i + 6] = clipf_c_one(src[i + 6], mini, maxi, maxisign); - dst[i + 7] = clipf_c_one(src[i + 7], mini, maxi, maxisign); + for (int i = 0; i < len; i += 8) { + float tmp[8]; + + for (int j = 0; j < 8; j++) + tmp[j]= clipf_c_one(src[i + j], mini, maxi, maxisign); + for (int j = 0; j < 8; j++) + dst[i + j] = tmp[j]; } } static void vector_clipf_c(float *dst, const float *src, int len, float min, float max) { - int i; - if (min < 0 && max > 0) { vector_clipf_c_opposite_sign(dst, src, min, max, len); - } else { - for (i = 0; i < len; i += 8) { - dst[i] = av_clipf(src[i], min, max); - dst[i + 1] = av_clipf(src[i + 1], min, max); - dst[i + 2] = av_clipf(src[i + 2], min, max); - dst[i + 3] = av_clipf(src[i + 3], min, max); - dst[i + 4] = av_clipf(src[i + 4], min, max); - dst[i + 5] = av_clipf(src[i + 5], min, max); - dst[i + 6] = av_clipf(src[i + 6], min, max); - dst[i + 7] = av_clipf(src[i + 7], min, max); - } + return; + } + + for (int i = 0; i < len; i += 8) { + float tmp[8]; + + for (int j = 0; j < 8; j++) + tmp[j]= av_clipf(src[i + j], min, max); + for (int j = 0; j < 8; j++) + dst[i + j] = tmp[j]; } } From patchwork Thu Jul 25 20:25:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50736 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a830:0:b0:482:c625:d099 with SMTP id z16csp79841vqo; Thu, 25 Jul 2024 13:25:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXPwZW9iTnw5r4nQYgHmvtbcwkkLiZ0s8eji2DwQWxMVkcnyGeUht/OYKJQwZoIT/eLoIWDvzndqzaPxrOHOA0nzm529tlxII+AGQ== X-Google-Smtp-Source: AGHT+IEh5yR6KS1ohIOXcCzat/9N/SUhsGfu/rDmo/XS7vSIWHt3tM6UtSEVJNpx99xQ4O9eSxEs X-Received: by 2002:a2e:8748:0:b0:2ef:2cbc:9074 with SMTP id 38308e7fff4ca-2f03dba545fmr19983541fa.21.1721939156634; Thu, 25 Jul 2024 13:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721939156; cv=none; d=google.com; s=arc-20160816; b=lH64zFON60tXGdqwaqx8JKcwPjmXa6oIOYmGGxMZL3XL5rHVstonaUOHhHhjx6XaEh wf+N/uuW3xAjvK91dX7ltdzB7jfNnaxq/OnbPGW8gl0qO8IS3eY7hzWGgX05CD2jO0lY TTBugICRBpnTa5kcmb0WArH3zFdsPkGusqx6aoazcjbsKsCxMQwQ5I2mJ5v16fBIai4H TE/WFQYbUDMeBmHawoFHBcJ5u7GheI9IY0aZINU2MHYdXQVEa86bnsckiZPB809UF+5b DJN0fw62KBjbwkxi/Y/0PiI+EqSatrooHoVMojqHApHW8tqVTEvfLjML0D6TRjelWMXI wanQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=bCb9xo2APw+0hwKXRQEAaXFhAUQ3flmHss7CZeIt2oI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jOQevWZdrAP86+AH5gjOtDTl80a49/dkorVvfaSJk+S+/DifxT9mGqI1234NlZ0Y4D jVI6BonTpkIdZBSMs7K5Gj0R12qApkYjFljDr6yvMIqQRfZthJYbXPhcCSIhjfvE/RZt Z6cRwxoQ6DzI4QJUnB4FNbq1xv8aLIHppp2zaCRwSDFMpNk7rEcJT7oWI4q+ClKGH1C8 p55f4GwCh4RhYcnMWewNZXx19r/ZRuTRuu5SjHozWNENbpn0vaa3/LBhGLW5pTA9ILTL HWCiqCIDsjlU/mnophxv7x9/Ad2B4SXq7PnyPe7opEIbS4iRcG+28iBjsP+YAk9Y47vF 17Tg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2f03d13e827si5865471fa.309.2024.07.25.13.25.55; Thu, 25 Jul 2024 13:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D25CC68D7AF; Thu, 25 Jul 2024 23:25:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC85268D762 for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 4AE4EC01F0 for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 23:25:17 +0300 Message-ID: <20240725202522.276182-3-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240725202522.276182-1-remi@remlab.net> References: <20240725202522.276182-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] lavc/audiodsp: drop opposite sign optimisation 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 9oAxhkYbWYhx This was added along side the original SSE(one) DSP function in 0a68cd876e14f76a00df7bb8edbfeb350f8ef617 without rationale. This was presumably faster on x87, which is no longer relevant since we pretty much assume SSE2 or later on x86. Meanwhile this function is ~2.5x slower than the normal floating point one on SiFive-U74. --- libavcodec/audiodsp.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/libavcodec/audiodsp.c b/libavcodec/audiodsp.c index 9e83f06aaa..fd6a00345f 100644 --- a/libavcodec/audiodsp.c +++ b/libavcodec/audiodsp.c @@ -22,44 +22,9 @@ #include "libavutil/common.h" #include "audiodsp.h" -static inline float clipf_c_one(float a, uint32_t mini, - uint32_t maxi, uint32_t maxisign) -{ - uint32_t ai = av_float2int(a); - - if (ai > mini) - return av_int2float(mini); - else if ((ai ^ (1U << 31)) > maxisign) - return av_int2float(maxi); - else - return a; -} - -static void vector_clipf_c_opposite_sign(float *dst, const float *src, - float min, float max, int len) -{ - uint32_t mini = av_float2int(min); - uint32_t maxi = av_float2int(max); - uint32_t maxisign = maxi ^ (1U << 31); - - for (int i = 0; i < len; i += 8) { - float tmp[8]; - - for (int j = 0; j < 8; j++) - tmp[j]= clipf_c_one(src[i + j], mini, maxi, maxisign); - for (int j = 0; j < 8; j++) - dst[i + j] = tmp[j]; - } -} - static void vector_clipf_c(float *dst, const float *src, int len, float min, float max) { - if (min < 0 && max > 0) { - vector_clipf_c_opposite_sign(dst, src, min, max, len); - return; - } - for (int i = 0; i < len; i += 8) { float tmp[8]; From patchwork Thu Jul 25 20:25:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50738 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a830:0:b0:482:c625:d099 with SMTP id z16csp79911vqo; Thu, 25 Jul 2024 13:26:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW0vrNBYrU3oCUFVTyX8PVLB4irVFp0dLUkXIl9/eT9ubv27Nq7jQk/2iuoXkh2E69gq61lU6p2zzG/v54spvOrOOVy6RXzfGTmlA== X-Google-Smtp-Source: AGHT+IEyjF1NMNcO3CeGdUgyqjJt3efds2jiz9qPeSxTcv0nkHrVLHlSBPw1zTcdFE6J+rEOiha2 X-Received: by 2002:ac2:4e03:0:b0:52e:74f5:d13 with SMTP id 2adb3069b0e04-52fd3f1d3dbmr2867142e87.30.1721939167072; Thu, 25 Jul 2024 13:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721939167; cv=none; d=google.com; s=arc-20160816; b=wCukWaSbEoUEjBpOYZiqcr3xiuZJL4Zj7DPC5ugzmFKtY+tpuYSYUvjiCRV+z92N4m 6BXqFuCCC+BXIz+SM8mY846NWlNOathnzYCFGf2rKwrMAohYDtlSG58NCiVs/0aEkvdJ 0lV2rpjShvz7ICPA/lDbd6ApmL9K66mwsjKpW6h9tUmZdKEmPcfqZcxxMyaHqCjquHGa kUoykLjdVN2A+Gt4TxyyZ8L6+W8VDOgsyVxQAWKg8ymGJlQHrVWrSZcO4QaxMJjbPRAB qCPhcyweHua8vf+tXRQkT1oGJ1qfqaU/f/e0y04GV9PEnJEs4t0c6UWid43cRgcVXx1w dhWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=CN+COfAtbVw+m7sACwbXEwkYKGzgHCf2OxHDhrwards=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=IFns/tADIN4swl1B7S/iSkHulZ+tEQLIkZ1hfrYjIkENSQ8BkgE+D50Ot+35Ns4lNv OGD0WKe0nPovkfqiGwRvq6MBWQrPlvSeyZKvDRs1f8Sx8iMxLetgfNfr5zs9YIRSMPJz w1O1h9kJZtWDp9m9+XNeMuW8Njd/f2EWyssZ8t7Q9sg6MWN5FJEQW5/F/Qnr5l4XSLev HowV7Xfqn+Tp/GcXwKKByxCncue2KHrk7+Fau3Ijgij9Pxsok9oJR4q4MZ6me1JwzFVb 8Yl0qUhexKWNkRwiP3uVVUapgu6kB3oeKRf+3jPyIi3qjc2JHFZVGMT5dTekqMUPMoKj A0qQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52fd5b9dba3si634013e87.172.2024.07.25.13.26.06; Thu, 25 Jul 2024 13:26:07 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EBD8C68D7C8; Thu, 25 Jul 2024 23:25:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E7CF968D2F7 for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 7ABABC0233 for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 23:25:18 +0300 Message-ID: <20240725202522.276182-4-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240725202522.276182-1-remi@remlab.net> References: <20240725202522.276182-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] lavc/audiodsp: drop R-V F vector_clipf 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: RghLHlevi0UM This is now firmly slower than C. SiFive-U74 (cycles): audiodsp.vector_clipf_c: 31.2 audiodsp.vector_clipf_rvf: 39.5 --- libavcodec/riscv/Makefile | 1 - libavcodec/riscv/audiodsp_init.c | 8 +---- libavcodec/riscv/audiodsp_rvf.S | 50 -------------------------------- 3 files changed, 1 insertion(+), 58 deletions(-) delete mode 100644 libavcodec/riscv/audiodsp_rvf.S diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index 0bbdd38116..621c099a5b 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -9,7 +9,6 @@ RVVB-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvvb.o OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o -RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_init.o RVV-OBJS-$(CONFIG_BLOCKDSP) += riscv/blockdsp_rvv.o diff --git a/libavcodec/riscv/audiodsp_init.c b/libavcodec/riscv/audiodsp_init.c index f606406429..5750d4d8a7 100644 --- a/libavcodec/riscv/audiodsp_init.c +++ b/libavcodec/riscv/audiodsp_init.c @@ -24,8 +24,6 @@ #include "libavutil/cpu.h" #include "libavcodec/audiodsp.h" -void ff_vector_clipf_rvf(float *dst, const float *src, int len, float min, float max); - int32_t ff_scalarproduct_int16_rvv(const int16_t *v1, const int16_t *v2, int len); void ff_vector_clip_int32_rvv(int32_t *dst, const int32_t *src, int32_t min, int32_t max, unsigned int len); @@ -33,12 +31,9 @@ void ff_vector_clipf_rvv(float *dst, const float *src, int len, float min, float av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) { -#if HAVE_RV +#if HAVE_RVV int flags = av_get_cpu_flags(); - if (flags & AV_CPU_FLAG_RVF) - c->vector_clipf = ff_vector_clipf_rvf; -#if HAVE_RVV if (flags & AV_CPU_FLAG_RVB_ADDR) { if (flags & AV_CPU_FLAG_RVV_I32) { c->scalarproduct_int16 = ff_scalarproduct_int16_rvv; @@ -48,5 +43,4 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) c->vector_clipf = ff_vector_clipf_rvv; } #endif -#endif } diff --git a/libavcodec/riscv/audiodsp_rvf.S b/libavcodec/riscv/audiodsp_rvf.S deleted file mode 100644 index 97aa930ab5..0000000000 --- a/libavcodec/riscv/audiodsp_rvf.S +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright © 2022 Rémi Denis-Courmont. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/riscv/asm.S" - -func ff_vector_clipf_rvf, f - lpad 0 -NOHWF fmv.w.x fa0, a3 -NOHWF fmv.w.x fa1, a4 -1: - flw ft0, (a1) - flw ft1, 4(a1) - fmax.s ft0, ft0, fa0 - flw ft2, 8(a1) - fmax.s ft1, ft1, fa0 - flw ft3, 12(a1) - fmax.s ft2, ft2, fa0 - addi a2, a2, -4 - fmax.s ft3, ft3, fa0 - addi a1, a1, 16 - fmin.s ft0, ft0, fa1 - fmin.s ft1, ft1, fa1 - fsw ft0, (a0) - fmin.s ft2, ft2, fa1 - fsw ft1, 4(a0) - fmin.s ft3, ft3, fa1 - fsw ft2, 8(a0) - fsw ft3, 12(a0) - addi a0, a0, 16 - bnez a2, 1b - - ret -endfunc From patchwork Thu Jul 25 20:25:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50739 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a830:0:b0:482:c625:d099 with SMTP id z16csp79976vqo; Thu, 25 Jul 2024 13:26:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWub7PUgRqBcDq9seKI8tJJw1Rgmt2O7wbSTNhtz7SV5+ckBEzkDpmOuveT8xJRao5GtmvwwtM8oU3sIolxajFUEdd2CvVm4gT2dQ== X-Google-Smtp-Source: AGHT+IGQR8h2Y1ikpthlEy5Jt2a3ZlOzGyTH9hV2WUvCmZR0gftq/KdL0DFVv7+j37pH43K9kw+B X-Received: by 2002:a2e:94ca:0:b0:2ee:d8dc:490c with SMTP id 38308e7fff4ca-2f03dbf1210mr20724081fa.41.1721939175898; Thu, 25 Jul 2024 13:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721939175; cv=none; d=google.com; s=arc-20160816; b=v+/+kyDMBmMIt242MzvA6u9GFpfj2uFAaVBsMWHeHdUIYvKVHmcgGSAysObAdnwpmx WjDoBSNFOwsKoaYO6k9PcJQHz5utxdIGWnK7Lphgrr1+Ok1MsvKA8o7LO+HmjPS7Wgic +IPWciKo4MM1B6pdVzrlqOSarrDhmZK/H7WT+S0tqbOE0hE5mA/+n5U5gScUTM1qsDnh c41ZWyhsa0AYMicmqbEMSSOp+Xau/PZobvYo/Kk0pQ103Mq+bCo+lcz7YNAlPjqHzWdP pF7hRcNSu9YI2NQBkP/WcqZvycZxZxumwE3BeGLVLU34WAXvpc4pi3ZKruiDdtBftzaB x1cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=RWxvE16uoFwd2+AQNtjhPc7l/0uFMGbZE/aoXHsDym4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=MjCuXkUlpNpGEoTnNV0XSB7KToQKl9hBh+xvKUBm21TYj1oWz+KZ19YBsOQDTwa6vN sNL+tj/MHdshL7GOTk/l4bKQi8RQ/iJhrwME0Es5yBJLRHbdLOlR/Sf4wnVQkGl01WLF uTKeQC31f0GtNKyezuphLKVAAud2CcYuHnLYe7LC2BZIFjFyNchTx1QkiMYPA6pRO9Kg wB8WvFRjIS9K3xpeEEUQkp/XWBfXZqolVmkgjJZC/Gzzlq95Nk4JhErgJsvEOPGlIZLG gLA5YZFGtWpQSEFQOPeKaKtV6V7Vz/mvgrcgzyo7sbWzYjRBztsYYsaLfHjwausuAdSF w0TA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5ac65d52359si1424233a12.516.2024.07.25.13.26.15; Thu, 25 Jul 2024 13:26:15 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0751B68D7CC; Thu, 25 Jul 2024 23:25:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1500368D67A for ; Thu, 25 Jul 2024 23:25:24 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id AB0C3C0236 for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 23:25:19 +0300 Message-ID: <20240725202522.276182-5-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240725202522.276182-1-remi@remlab.net> References: <20240725202522.276182-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] lavc/riscv: drop probing for F & D extensions 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: B++nJbTFuexH F and D extensions are included in all RISC-V application profiles ever made (so starting from RV64GC a.k.a. RVA20). Realistically they need to be selected at compilation time. Currently, there are no consumers for these two flags. If there is ever a need to reintroduce F- or D-specific optimisations, we can always use __riscv_f or __riscv_d compiler predefined macros respectively. --- libavutil/cpu.c | 2 -- libavutil/riscv/cpu.c | 12 ------------ libavutil/tests/cpu.c | 2 -- tests/checkasm/checkasm.c | 2 -- 4 files changed, 18 deletions(-) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 17afe8858a..6c26182b78 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -184,8 +184,6 @@ int av_parse_cpu_caps(unsigned *flags, const char *s) { "lasx", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_LASX }, .unit = "flags" }, #elif ARCH_RISCV { "rvi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI }, .unit = "flags" }, - { "rvf", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVF }, .unit = "flags" }, - { "rvd", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD }, .unit = "flags" }, { "rvb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB }, .unit = "flags" }, { "zve32x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, { "zve32f", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags" }, diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c index e035f4b024..6537e91965 100644 --- a/libavutil/riscv/cpu.c +++ b/libavutil/riscv/cpu.c @@ -58,8 +58,6 @@ int ff_get_cpu_flags_riscv(void) if (__riscv_hwprobe(pairs, FF_ARRAY_ELEMS(pairs), 0, NULL, 0) == 0) { if (pairs[0].value & RISCV_HWPROBE_BASE_BEHAVIOR_IMA) ret |= AV_CPU_FLAG_RVI; - if (pairs[1].value & RISCV_HWPROBE_IMA_FD) - ret |= AV_CPU_FLAG_RVF | AV_CPU_FLAG_RVD; #ifdef RISCV_HWPROBE_IMA_V if (pairs[1].value & RISCV_HWPROBE_IMA_V) ret |= AV_CPU_FLAG_RVV_I32 | AV_CPU_FLAG_RVV_I64 @@ -96,10 +94,6 @@ int ff_get_cpu_flags_riscv(void) if (hwcap & HWCAP_RV('I')) ret |= AV_CPU_FLAG_RVI; - if (hwcap & HWCAP_RV('F')) - ret |= AV_CPU_FLAG_RVF; - if (hwcap & HWCAP_RV('D')) - ret |= AV_CPU_FLAG_RVD; if (hwcap & HWCAP_RV('B')) ret |= AV_CPU_FLAG_RVB_ADDR | AV_CPU_FLAG_RVB_BASIC | AV_CPU_FLAG_RVB; @@ -114,12 +108,6 @@ int ff_get_cpu_flags_riscv(void) #ifdef __riscv_i ret |= AV_CPU_FLAG_RVI; #endif -#if defined (__riscv_flen) && (__riscv_flen >= 32) - ret |= AV_CPU_FLAG_RVF; -#if (__riscv_flen >= 64) - ret |= AV_CPU_FLAG_RVD; -#endif -#endif #ifdef __riscv_zba ret |= AV_CPU_FLAG_RVB_ADDR; diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index b4b11775d8..e03fbf94eb 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -86,8 +86,6 @@ static const struct { { AV_CPU_FLAG_LASX, "lasx" }, #elif ARCH_RISCV { AV_CPU_FLAG_RVI, "rvi" }, - { AV_CPU_FLAG_RVF, "rvf" }, - { AV_CPU_FLAG_RVD, "rvd" }, { AV_CPU_FLAG_RVB_ADDR, "zba" }, { AV_CPU_FLAG_RVB_BASIC, "zbb" }, { AV_CPU_FLAG_RVB, "rvb" }, diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 016f2329b0..49b47f8615 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -291,8 +291,6 @@ static const struct { #elif ARCH_RISCV { "RVI", "rvi", AV_CPU_FLAG_RVI }, { "misaligned", "misaligned", AV_CPU_FLAG_RV_MISALIGNED }, - { "RVF", "rvf", AV_CPU_FLAG_RVF }, - { "RVD", "rvd", AV_CPU_FLAG_RVD }, { "RVBaddr", "rvb_a", AV_CPU_FLAG_RVB_ADDR }, { "RVBbasic", "rvb_b", AV_CPU_FLAG_RVB_BASIC }, { "RVB", "rvb", AV_CPU_FLAG_RVB }, From patchwork Thu Jul 25 20:25:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50740 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a830:0:b0:482:c625:d099 with SMTP id z16csp80059vqo; Thu, 25 Jul 2024 13:26:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW+ghekWNGrit2affKsm+OS7F/K+Dpu9XQxEdLYOZcGomuGD1/yc2LXAwJLnpw0ds8ZAVlNeuCtAG4C3xYgVPrHXtwo8z/40BwVZw== X-Google-Smtp-Source: AGHT+IHXEANWvRNronQlqh5kttKnKQbJa0g9SEnVWmA1SGlvKxWHxGrJBOD+sZo7XGkWBZvYckj7 X-Received: by 2002:a05:6512:1082:b0:52f:36a:f929 with SMTP id 2adb3069b0e04-52fcf8a2585mr1962631e87.4.1721939185599; Thu, 25 Jul 2024 13:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721939185; cv=none; d=google.com; s=arc-20160816; b=UXRvbwRrVlQmm3yyLlPNXGgmJ3V5Q3GZB8l28CElaWsrXNsOAdxe/1zu+6JxbV7Hup tvsISgMJH5gg7pQ7Hn/53Mlb1X9b7/NLYfWiCgh8pwiABNohYhSOMguCf9S48p26hT7m IpDdBMpDrH5aa/uSy45h+Z0kA298nErX+zQBGhDIdmMJG1EdslBkgZxp1j7I3+4Av9SS FXDacQg+iM9Ed2YaHFdxSmLDjuof7fnspA+DfzxBCpH7OaT8OHZVq9PEgHFPgE6veBgf HFX9T7F8Lft8hMyqTNVwyLq5OOO/85dGwTS854GYVqy754wnsm526YGc7UEWjZD9wieI sg7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=sAt3/4jvj2sjJw5NlmWHcL9PM0BS2vsBItwRHwM/8qs=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=YQ8iD/E9DNwUvwVuMF7i/dLByv2Vi0swbI1BkM4EeMvCmqA97OVseX8PHXb0/pBUPc mcT0EwGP75grzEv/P1LT5nroqh3axlx8WmmQ7vQ5Y9exBPm49m/fMZLt7vlpIkd/NiWD Mi1nbc6XjpH8hswJSzqR2xWN69JA68W8o9AmZOd9ND4AbyjQ6c8Z9q0MUDMsuFf8U8Xw LSCUFKcakk7sTLBcoiHE6LuWDbsvcnCSUSAtQRfmYZi+H9kjNKwXMjsA2T2iRrCsUDR8 0ErDD/hvmIHYnn0hYwLRbLshBzOpftG3DxH3aQoIPYF3mlyHNaoCFgmqmKrzrKrAtEN2 D7Vw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52fd5bfbd45si672411e87.398.2024.07.25.13.26.25; Thu, 25 Jul 2024 13:26:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0C6B668D7EA; Thu, 25 Jul 2024 23:25:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CD6AE68D7CC for ; Thu, 25 Jul 2024 23:25:28 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id DA707C023D for ; Thu, 25 Jul 2024 23:25:23 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 23:25:20 +0300 Message-ID: <20240725202522.276182-6-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240725202522.276182-1-remi@remlab.net> References: <20240725202522.276182-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] lavu/cpu: deprecate AV_CPU_FLAG_RV{F, D} 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: lz2R4N1BGVaC --- doc/APIchanges | 3 +++ libavutil/cpu.h | 3 +++ libavutil/version.h | 1 + 3 files changed, 7 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index fb54c3fbc9..16993d310e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-07-28 - xxxxxxxxx - lavu 59.30.101 - cpu.h + Deprecate AV_CPU_FLAG_RVF and AV_CPU_FLAG_RVD without replacement. + 2024-07-25 - xxxxxxxxx - lavu 59.29.100 - cpu.h Add AV_CPU_FLAG_RVB. diff --git a/libavutil/cpu.h b/libavutil/cpu.h index 9f419aae02..8af1233e6f 100644 --- a/libavutil/cpu.h +++ b/libavutil/cpu.h @@ -22,6 +22,7 @@ #define AVUTIL_CPU_H #include +#include #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ @@ -82,8 +83,10 @@ // RISC-V extensions #define AV_CPU_FLAG_RVI (1 << 0) ///< I (full GPR bank) +#if FF_API_RISCV_FD #define AV_CPU_FLAG_RVF (1 << 1) ///< F (single precision FP) #define AV_CPU_FLAG_RVD (1 << 2) ///< D (double precision FP) +#endif #define AV_CPU_FLAG_RVV_I32 (1 << 3) ///< Vectors of 8/16/32-bit int's */ #define AV_CPU_FLAG_RVV_F32 (1 << 4) ///< Vectors of float's */ #define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int's */ diff --git a/libavutil/version.h b/libavutil/version.h index 852eeef1d6..df43dcc321 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -113,6 +113,7 @@ #define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60) #define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60) #define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 60) +#define FF_API_RISCV_FD (LIBAVUTIL_VERSION_MAJOR < 60) /** * @}