From patchwork Tue Jan 16 16:15:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: flow gg X-Patchwork-Id: 45615 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:8199:b0:199:de12:6fa6 with SMTP id pd25csp2091006pzb; Tue, 16 Jan 2024 08:16:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7yNMSC1567JgFEHW7EDCFDVZcKP5+E6F+mCN5hDQ5B1oaEtiHQsT+aX6JVE8EwraPwnGf X-Received: by 2002:a17:906:1641:b0:a2c:7175:edd1 with SMTP id n1-20020a170906164100b00a2c7175edd1mr7962883ejd.1.1705421764425; Tue, 16 Jan 2024 08:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705421764; cv=none; d=google.com; s=arc-20160816; b=xyAEutrfDHlcG9Ktg0ydiVwpde4xFNkkoSyirUASD4N563zyBWKuElo8I78ywxxcNl jrOaksd9ot3J6YvtJTutUMAQ8ZdAun92RS/GtYkRmzDsWsFVAhQXqq4JnE5n+d9cW+2R cOzjcJFxQNGsxH7loP+PeQC4ji8OSRCb2HANH9aiK4qraNsKvuj+BmG0eLUwMo24Uv5J 8SgY9ccJMKT6eI30F3na0k7RYSVXKK4Mv/T/2JomEMgjTMI463hPwKQdE7bcctqjSejp Owa++8iLl0Vi2ssg6WeOBQuJ/G5ElxVSrhbEPEaLLGfvd2CwSLg1jWR1NsQ+7F6TVH+I 6F4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=fFs1Xrg99ofaYf9pHLsLmVQrlHDOJcCCOWidkN5bYeE=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=fmjPY8UHA1O4Yo52Vo7g751jq4VCCux566uyis46tuEggP9Axjiz+PWeIRLau/hEej FRs+p7/FbLJIWw4g3fK2iUUhXj4YBJZzxw5/iLBKIKRFPvozZ8+v+pUDy/7QdUhG7rOk bKUugVBHAxoZ56YQPmEFZZDnW2HKP2Rnd5jXCGc30IXG8AWnL//P0oClD3vXAflIc2QX ZvGx2PSlN4CuEHg925mFJq2mRkm1kZpl7K2Z+0lSQKSRDv900s/p/Mp3661vH0D3TPtK DnHxWMvFBMFSUIMMEkMjEEVbYuGJna2IfECluZsQxlaBLDO9rHYfvDtTW+t/i8Pzn7GU Wg4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=cN6oTtt6; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g25-20020a1709061c9900b00a2cb992e9f9si3879538ejh.1025.2024.01.16.08.16.04; Tue, 16 Jan 2024 08:16:04 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=cN6oTtt6; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6063B68C6BB; Tue, 16 Jan 2024 18:16:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9748168C6BB for ; Tue, 16 Jan 2024 18:15:53 +0200 (EET) Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6813c12c1b8so37090446d6.3 for ; Tue, 16 Jan 2024 08:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705421752; x=1706026552; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=dlFuhDo2cdvmAfgoRe5aCRvcx51KDvRUmsUMP8Kpviw=; b=cN6oTtt6yv5tlyq80nFY+nkMDVyJMWZgFvwgzzyDDrPdRend5YYJ/KnXjmwZGdKgkJ GTw97txXelRkrrFBkwKaLbNAhHJ6XSsHErP3TOvm5mOINB8gi+w/SN74Enb6VRmQpUco gttTkgg1OfTbAavQUYOA7OIv0FqvcmiGjJdEZmWGiNnz/KaESVVgY8lS62ROKxqgJttP T3QZc2JC4Qo75ZR0SV96psBVcM/kK6dC8MddGGpZgX7cIuEwQuSzHzSFoNohCKI6vlLz f2XQOrWMzHvbbnwen7hQFaGZxO0laMpsdtQ9C0laDRJg2c1My5RE0PPq82n9S0dd2jPY GZug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705421752; x=1706026552; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dlFuhDo2cdvmAfgoRe5aCRvcx51KDvRUmsUMP8Kpviw=; b=qwvlHRxLDAeNYqU8HjimZ/RQuKFfTAdAF26l6JP4u82uVRrDW7qfslYa3jdrtCngwk N+a7K6ZU65Z7DKANOUF0zzNLw33iRJlOV3qfEU4xNw1ZoxD8bRAlUleJys4MUGx/vhL9 /G5AuOjKN8zSBYIEItTdNiMMlQIuIm1JtxwZ0Aj3Tj+HHiniLLGMWPoZB5hQ1Z8qhgeX 9bEQQfqPI6Danaquy7UVQittqPqHHZDafWpUgHzRw2PxR7lPJ/F+OqXZHWk1va03Z+K4 u6irn31zXy0sLbXd0gPpcHJws7HgBZjEsVUPC6WGbKu7DddzL1UGm90tmg9FUJZxR/qF uOTg== X-Gm-Message-State: AOJu0YyoECMwjvW3GPz8GEAFtal4jSrRh0/LnksvLxaB4F4XtaF3sI1o Gm+QlITv5XpoX1hbK2iGuCLXekfrIsem5gq1+dkLNHeD X-Received: by 2002:a05:6214:c47:b0:67f:bd18:2eba with SMTP id r7-20020a0562140c4700b0067fbd182ebamr10050533qvj.129.1705421751788; Tue, 16 Jan 2024 08:15:51 -0800 (PST) MIME-Version: 1.0 From: flow gg Date: Wed, 17 Jan 2024 00:15:40 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH 1/3] lavc/h264pred: R-V V pred16x16_vertical_8 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: DpIoAYKkKFN4 From eaac50d41b3398ef39d1026a7d84480860a1c41e Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Tue, 16 Jan 2024 23:55:33 +0800 Subject: [PATCH 1/3] lavc/h264pred: R-V V pred16x16_vertical_8 C908 pred16x16_vertical_8_c: 1.5 pred16x16_vertical_8_rvv_i32: 1.0 --- libavcodec/h264pred.c | 2 ++ libavcodec/h264pred.h | 2 ++ libavcodec/riscv/Makefile | 2 ++ libavcodec/riscv/h264pred_init.c | 42 ++++++++++++++++++++++++++++++++ libavcodec/riscv/h264pred_rvv.S | 35 ++++++++++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 libavcodec/riscv/h264pred_init.c create mode 100644 libavcodec/riscv/h264pred_rvv.S diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c index 25f9995a0b..bd45da2fde 100644 --- a/libavcodec/h264pred.c +++ b/libavcodec/h264pred.c @@ -592,6 +592,8 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, ff_h264_pred_init_aarch64(h, codec_id, bit_depth, chroma_format_idc); #elif ARCH_ARM ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); +#elif ARCH_RISCV + ff_h264_pred_init_riscv(h, codec_id, bit_depth, chroma_format_idc); #elif ARCH_X86 ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); #elif ARCH_MIPS diff --git a/libavcodec/h264pred.h b/libavcodec/h264pred.h index cb008548fc..44dc1637c5 100644 --- a/libavcodec/h264pred.h +++ b/libavcodec/h264pred.h @@ -120,6 +120,8 @@ void ff_h264_pred_init_aarch64(H264PredContext *h, int codec_id, const int chroma_format_idc); void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc); +void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, + const int bit_depth, const int chroma_format_idc); void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc); void ff_h264_pred_init_mips(H264PredContext *h, int codec_id, diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index aa758eba1c..3232b16b97 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -22,6 +22,8 @@ RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_init.o RVV-OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_rvv.o OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_init.o +RVV-OBJS-$(CONFIG_H264PRED) += riscv/h264pred_rvv.o +OBJS-$(CONFIG_H264PRED) += riscv/h264pred_init.o RVV-OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_rvv.o OBJS-$(CONFIG_H264CHROMA) += riscv/h264_chroma_init_riscv.o RVV-OBJS-$(CONFIG_H264CHROMA) += riscv/h264_mc_chroma.o diff --git a/libavcodec/riscv/h264pred_init.c b/libavcodec/riscv/h264pred_init.c new file mode 100644 index 0000000000..179bd8c8a5 --- /dev/null +++ b/libavcodec/riscv/h264pred_init.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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 "config.h" + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavcodec/h264pred.h" + +void ff_pred16x16_vertical_8_rvv(uint8_t *src, ptrdiff_t stride); + +av_cold void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, + const int bit_depth, + const int chroma_format_idc) +{ + if (bit_depth == 8) { + #if HAVE_RVV + int flags = av_get_cpu_flags(); + + if (flags & AV_CPU_FLAG_RVV_I32) { + h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_8_rvv; + } + #endif + } +} diff --git a/libavcodec/riscv/h264pred_rvv.S b/libavcodec/riscv/h264pred_rvv.S new file mode 100644 index 0000000000..0e48662922 --- /dev/null +++ b/libavcodec/riscv/h264pred_rvv.S @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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_pred16x16_vertical_8_rvv, zve32x + vsetivli zero, 4, e8, mf4, ta, ma + sub a0, a0, a1 + vle32.v v0, (a0) + li t1, 16 +1: + add a0, a0, a1 + addi t1, t1, -1 + vse32.v v0, (a0) + bnez t1, 1b + + ret +endfunc -- 2.43.0 From patchwork Tue Jan 16 16:15:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: flow gg X-Patchwork-Id: 45616 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:8199:b0:199:de12:6fa6 with SMTP id pd25csp2091208pzb; Tue, 16 Jan 2024 08:16:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/prtTuOCo2qsJ7y8EOGNDpa+W2cr9RQ9KtLd30y10cWOUM3ycrqOPiqXeHskNZTMsdk2b X-Received: by 2002:a17:906:1e94:b0:a28:e03f:29db with SMTP id e20-20020a1709061e9400b00a28e03f29dbmr3248047ejj.66.1705421780503; Tue, 16 Jan 2024 08:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705421780; cv=none; d=google.com; s=arc-20160816; b=u4Q/3qTIvFDrwwCfaof54aA5OKxKrAlAa6Bf50bJGZBKcyMduYIMt/7TVCN3tJ3JJb wSKHg1io3aoKkH7VSsL+jARwbHgXpHlR9urK9Da7gk8v+S/u6csJ4e+5ncOxuDrv5G9C To8n+h5Q/Gnig5DItOVi8g74Y5mcFXYVdKfoBYT9EPmrFXWeQTF3N+TlyFSsQZBm31S4 jkL3/3lWxjWrcf0HxKDe/v1b4sFPXrACTZU+ULmF2qKa/HzmZVk9DoOC4h1q8+zB0jvF UgiDy9cs6CFo8ugby/LxM6kRoLhG8LAkvOKDrfiYsCwY9PuSKRgdlLyNHDVT+/oX/fGO zy1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=Y7IZc8YMC+2ps8t4H8M/p1VnDoIv7ON15MVEbMHsRXw=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=PoYQdkFOq//Vba9XtmY0a5ZEkZ0lPxBf5+DCAV3DATzPj9t4zXG2MaOtflXkKIR21W 9Tn0mReD2G7WwEMim5FiXXaxU5QESh+R96MYPiujZpkkMO2n20VyeBbfWC7VXfw1P3Ld Jj64B5QZC6IHoA9PA24wkfVHjYpmUFBeth9x4d+m3rixoaBNVkzQPB1uGVbLbHXGnaEN +nXdN5gdV8DPy6B1gBV/GUyAVWFqgOP6JzdegZYyhVquM0zdgReYMt7fMO2T4WomeHSr 3ShPmbvI5NiU6kHmQWi89O/BrUSm69oYXwmMeJkHYZNPgE4Su6TzWoAPkWqUUpSrTIjz QFsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=amayV8oo; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l13-20020a17090612cd00b00a26ac591e55si4859517ejb.129.2024.01.16.08.16.20; Tue, 16 Jan 2024 08:16:20 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=amayV8oo; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA8AA68D04C; Tue, 16 Jan 2024 18:16:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CF10D68D044 for ; Tue, 16 Jan 2024 18:16:10 +0200 (EET) Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-7833a51a1aaso569022485a.0 for ; Tue, 16 Jan 2024 08:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705421769; x=1706026569; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=rcacPlxshmYiWmWIXPVNQj5PTCz/3GAABxIjXQEwciE=; b=amayV8ooq6M14y+atmkRzHG2Vb049OE6LDfjB0Ju4J0JV1iHsq8wbTbQ274cFOAZ6/ l7TPmJiXS8YmFfS16Y41xDEviTj1/3eTUSPV2GVqEIwht2mAQKN8IkinP6UAKjtLMri6 XSJ70cUGhIkK3DnyZkF3UlsmIjHmd2pE4en2Ha2uONjY22nPxAaq7RtwISiE/es7JaaM jkrPOnZheZMJ8jX9kj0FfchRaWH6P1GXDISpZImiot7e45CqxhmhdGVT96+/uF8NzMbp fjxy1NI2MEIxF7H0xyDTayaMm3IuA25EdZanODawh+SAPr909DCLQQXWVREfvggKLJB5 9iLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705421769; x=1706026569; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=rcacPlxshmYiWmWIXPVNQj5PTCz/3GAABxIjXQEwciE=; b=OMlDfV+wdN7OtGRWLrb2m9g21A4DBDYWbF9nWMlyAe0tRnxuQ7ny2Z+rdYr9OfkhHE gO40GiX+xdTtNj2k2gGqZGTuPDFiPIcibayM+gOvHVQHvfhGVOHxvdU2uI6mF/Pb1mVc bG3JrrobbKDvfgNld6ctPi4oL8ydpxs0Vyz/Dgwu2BD3MLghruBld6pTmMcOXYLtRc8D s+lFcQ2O/2fxAvY7/gOc5M13XTW8rX/1DlgS49CTTdgnEEpFV5sliQLZocG4uzec1Ilu 5kpo2AMlls8NohaEz5Rutxa5TOEY771BUeYLL/WB3GqbG/MXeXQU1JDsPi23AI6bVLWd YUdw== X-Gm-Message-State: AOJu0Yyky/yzQYGaQ3zo76VmsmkLWmFn4ejZqD4LUVFgT65HQOjRAh+n K3wsGE8sHKgiwmvzDjcqB4oHV7vxiDn8uY4sU7L35jml X-Received: by 2002:a05:6214:2687:b0:681:3b95:cec4 with SMTP id gm7-20020a056214268700b006813b95cec4mr9258333qvb.75.1705421769314; Tue, 16 Jan 2024 08:16:09 -0800 (PST) MIME-Version: 1.0 From: flow gg Date: Wed, 17 Jan 2024 00:15:58 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH 2/3] lavc/h264pred: R-V V pred16x16_horizontal_8 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: c3dnnvZN7fYA From 806f84ea5557c4652e48451decc4c679c9485472 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Tue, 16 Jan 2024 23:56:33 +0800 Subject: [PATCH 2/3] lavc/h264pred: R-V V pred16x16_horizontal_8 C908 pred16x16_horizontal_8_c: 3.0 pred16x16_horizontal_8_rvv_i32: 2.5 --- libavcodec/riscv/h264pred_init.c | 2 ++ libavcodec/riscv/h264pred_rvv.S | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libavcodec/riscv/h264pred_init.c b/libavcodec/riscv/h264pred_init.c index 179bd8c8a5..8665bc729e 100644 --- a/libavcodec/riscv/h264pred_init.c +++ b/libavcodec/riscv/h264pred_init.c @@ -25,6 +25,7 @@ #include "libavcodec/h264pred.h" void ff_pred16x16_vertical_8_rvv(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_horizontal_8_rvv(uint8_t *src, ptrdiff_t stride); av_cold void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, const int bit_depth, @@ -36,6 +37,7 @@ av_cold void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, if (flags & AV_CPU_FLAG_RVV_I32) { h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_8_rvv; + h->pred16x16[HOR_PRED8x8] = ff_pred16x16_horizontal_8_rvv; } #endif } diff --git a/libavcodec/riscv/h264pred_rvv.S b/libavcodec/riscv/h264pred_rvv.S index 0e48662922..ba1e9045e1 100644 --- a/libavcodec/riscv/h264pred_rvv.S +++ b/libavcodec/riscv/h264pred_rvv.S @@ -33,3 +33,18 @@ func ff_pred16x16_vertical_8_rvv, zve32x ret endfunc + +func ff_pred16x16_horizontal_8_rvv, zve32x + li t0, 16 +1: + lbu t1, -1(a0) + vsetivli zero, 16, e8, m1, ta, ma + vmv.v.x v0, t1 + vsetivli zero, 4, e8, mf4, ta, ma + addi t0, t0, -1 + vse32.v v0, (a0) + add a0, a0, a1 + bnez t0, 1b + + ret +endfunc -- 2.43.0 From patchwork Tue Jan 16 16:16:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: flow gg X-Patchwork-Id: 45617 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:8199:b0:199:de12:6fa6 with SMTP id pd25csp2091561pzb; Tue, 16 Jan 2024 08:16:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjALvqII9Dt3f3ZI7vZfornNd/1pmSvBAv6mJHZRzCbi4nz8+6n0L2U1Gr8ni06bTdtzMT X-Received: by 2002:a17:907:2089:b0:a29:906e:b8f4 with SMTP id pv9-20020a170907208900b00a29906eb8f4mr2187243ejb.46.1705421807408; Tue, 16 Jan 2024 08:16:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705421807; cv=none; d=google.com; s=arc-20160816; b=c35H8x/llic8/eGysZinLlQkenjgOBpApvxEiOI2Z5rbEHf1ISPDjTcXVIWGrQqjmN v/M9ojGewCcS6O1UGm01kFE8kbcZ92+9bFkc1lHGCXk/uvG4viRm9HTS9dRt3aX9RyVK gJ+GsS/RyQxe8+f45NizHrn7UnKcopTcbYW54sdWUi3jmonHZ2u934GBpW4lpaFOlFlV MZwaZ+TyJz9ayzUtHkLEltme8Q1qcP5JlCgti0PDYOKtyjcIM9h1NB3B8dZZKu7wmwi2 Ty8ogXGuZCc2cpx5UV0uNPV6qWMCGfchukkXXp313wX4jQ8R6mho7I0aTwrOzOH3pCAt Z8Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=q3kfTUNN7nWAFRp5z3/mDZ0sqIAFUiolINF4yroesIg=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=hAZzBQR4t9/zSPsbqMBRqgSOLokYjfVpt4bLmpZzOwj5urKMh7LTSYeTlWZHUC5EeQ daQA1Qy2qA2mI8mHgNY2KFSLZEsx2vpY6nVF1R9GfwyXxfiY3wWF24f+oA8+0n26mf/h 6KoEzoJurbRzxaQSFJV7bE3OxGzZBxUnh9vC89JdlcK/ecKj4j2KjIsmuSG/OjoTRCbt suVoSXGK2p6mu1zwrXHx6tIXYLl6/t/ABF4y10IyZKL+I+VQjJhq6ggPscT7AAgURdVD 3QyFpauUfBXM6xDqzX02gUw0GnTaIfg27BrFPS82hkhQQ7GFvAgs8Zpu/lZOONg4g03p 5Jig== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=JTAvLhru; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a8-20020a170906684800b00a2c3d26de57si4890014ejs.50.2024.01.16.08.16.34; Tue, 16 Jan 2024 08:16:47 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=JTAvLhru; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 05D4168D057; Tue, 16 Jan 2024 18:16:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 91D2968D023 for ; Tue, 16 Jan 2024 18:16:24 +0200 (EET) Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-67f5c0be04cso67806766d6.0 for ; Tue, 16 Jan 2024 08:16:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705421783; x=1706026583; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=m7+/WdAgwH/Lcqt2TYM9GOOIAPEgfOu26FHF2LigT8I=; b=JTAvLhruf1Shsz0jK/Ny65+4WCK0KKA/95ZhmTfDF+uw1OSPYDwlvWdeUhUEwl1rFC 4EJe+jJs9QPynH5OhE8f0Rpp/v6GE/17s2zMVuMxtbLrGhYt6BS45qKK6Y4XC/v3HCUu rVcLic35ZEV4/o+0CwqCwwDXKf7p0mBrCFEoASMkn8lYUxsMNlBuOHq4btsCfbFk0FXO Ntb4rTlnvXLlNUWL5vapgVaY3SkjXbxC9xxsXGqmJzz4nvPi7XZth8hKint1kwk0klew F7IycdF2aRDICdOnmLQ/SXqlpQWh4dPzzyQN4ndncjJT21QYrbJmRiipDg0yIXyyCQ5b 6HLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705421783; x=1706026583; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=m7+/WdAgwH/Lcqt2TYM9GOOIAPEgfOu26FHF2LigT8I=; b=k7+SHi83pAjsMJsJERR8pv8fpUp4y+MWlNsuI8JORJrQvsUBwLQSLerrgJ+i2KO60F abjgvY1RoiV4OYyA6JlqDfb3Fr0HkFSC8LG5rN9Y5yb24eT7QvQIQtAFGEguBcJcvyJe 85SWUAKNPQQ6YSV1GdMUIdI1NJMqO3OmJnVfKJFVU2Q45wFP5qwlPMHIpne+9tyfS0xV k0P6UsCrQVLj8dZFkZCnUTrg3tBO3EjFqZaN6fs7dfl/qmPA+AkWIH690qjLJteQjzTd iZB+6Alna+NRGO2GNw3Q0LfYwHp8LCFT6wzyUuJxdpPeKK+yb/V+aktMPpEtgXHJDFgA s0aA== X-Gm-Message-State: AOJu0Yz0P9hFBrVMGJ9lhUZtL9AUxbcdcmmLrHxlurDRXxqeQ0bk/RL3 PBXxaXwrRYGOJTFf2+jWImQDEPHf1kTyPZdMfeGvpXGB X-Received: by 2002:a05:6214:2689:b0:681:5959:ed3d with SMTP id gm9-20020a056214268900b006815959ed3dmr4712536qvb.41.1705421783304; Tue, 16 Jan 2024 08:16:23 -0800 (PST) MIME-Version: 1.0 From: flow gg Date: Wed, 17 Jan 2024 00:16:12 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH 3/3] lavc/h264pred: R-V V pred16x16_dc_8 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: Zo7UpEhDTLQj From 8c5fdbfea42e9ad6ba6e1df5e4ea3c583d59537a Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Tue, 16 Jan 2024 23:57:53 +0800 Subject: [PATCH 3/3] lavc/h264pred: R-V V pred16x16_dc_8 C908 pred16x16_dc_8_c: 2.5 pred16x16_dc_8_rvv_i32: 1.7 --- libavcodec/riscv/h264pred_init.c | 2 ++ libavcodec/riscv/h264pred_rvv.S | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/libavcodec/riscv/h264pred_init.c b/libavcodec/riscv/h264pred_init.c index 8665bc729e..e8d5b7dd8f 100644 --- a/libavcodec/riscv/h264pred_init.c +++ b/libavcodec/riscv/h264pred_init.c @@ -26,6 +26,7 @@ void ff_pred16x16_vertical_8_rvv(uint8_t *src, ptrdiff_t stride); void ff_pred16x16_horizontal_8_rvv(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_dc_8_rvv(uint8_t *src, ptrdiff_t stride); av_cold void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, const int bit_depth, @@ -38,6 +39,7 @@ av_cold void ff_h264_pred_init_riscv(H264PredContext *h, int codec_id, if (flags & AV_CPU_FLAG_RVV_I32) { h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_8_rvv; h->pred16x16[HOR_PRED8x8] = ff_pred16x16_horizontal_8_rvv; + h->pred16x16[DC_PRED8x8] = ff_pred16x16_dc_8_rvv; } #endif } diff --git a/libavcodec/riscv/h264pred_rvv.S b/libavcodec/riscv/h264pred_rvv.S index ba1e9045e1..1492991ef4 100644 --- a/libavcodec/riscv/h264pred_rvv.S +++ b/libavcodec/riscv/h264pred_rvv.S @@ -48,3 +48,31 @@ func ff_pred16x16_horizontal_8_rvv, zve32x ret endfunc + +func ff_pred16x16_dc_8_rvv, zve32x + vsetivli zero, 1, e16, m1, ta, ma + vmv.v.x v16, zero + + vsetivli zero, 16, e8, m1, ta, ma + sub t2, a0, a1 + vle8.v v8, (t2) + vwredsumu.vs v16, v8, v16 + addi t2, a0, -1 + vlse8.v v8, (t2), a1 + vwredsumu.vs v16, v8, v16 + vsetivli zero, 1, e16, m1, ta, ma + vmv.x.s t1, v16 + addi t1, t1, 16 + srai t1, t1, 5 + vsetivli zero, 16, e8, m1, ta, ma + vmv.v.x v0, t1 + vsetivli zero, 4, e8, mf4, ta, ma + li t0, 16 +1: + vse32.v v0, (a0) + addi t0, t0, -1 + add a0, a0, a1 + bnez t0, 1b + + ret +endfunc -- 2.43.0