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 71E4249CD7 for ; Sun, 7 Jul 2024 18:21:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2C5ED68DA86; Sun, 7 Jul 2024 21:21:37 +0300 (EEST) 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 7C19F68D98D for ; Sun, 7 Jul 2024 21:21:31 +0300 (EEST) Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-79efb877760so105922985a.3 for ; Sun, 07 Jul 2024 11:21:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720376489; x=1720981289; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0pWpx4U1QwDwW8hDCfk55mFQvAdCpYdc0g0pdlW9WNE=; b=ZrC71+iPemU1uWGRChvdii4sTtzg7n+ZpyLz1xj2T6PhKWFymAEcoEyLCTJVehAMEm MGPNysS2LbPkfQSSHK6sVD3z7oFULneEqp2D5mG7az+4LBKZ5zBwhgqAFewv3CyZ7Pk2 Z+mjml92O3htiZTedJwnAHXz+mLawqQqLDolOsD2ccjCj/sLDbaVUMwUz464PCeQXDwf ycPNf2HMG3yTgmGPy6OiQHYhA8dQ4pXgfOBE4KKcEOariVU0o1sfFqk083N5kkzuG0Yf HL7AQ5BR9mSlIJsZumMf2dCmz2zH9Rf+SVY2HBW5pVRhOKN+CfUvj73KF7AlkyMSVB++ Nibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720376489; x=1720981289; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0pWpx4U1QwDwW8hDCfk55mFQvAdCpYdc0g0pdlW9WNE=; b=iK7ux0+/dKNUjDD8hvJFkavzHcFuHCH0rRGF1v3KlLgxDtpGXpjRWdDvHNxzIwZFia Z/9Q3iKm/jGnQZfTp63UQi273jnjSXUVpifzpC3u1nB7kG+wbxlyZnj+img4FMlQ+lZC tR/dlsFGRAMgpGqwt2CRYWIp+RVmcOyRLHBwM08OLEotcHFsOtLqb6R2wvcLg/HXHivU bAQ7B1yZSyHvpE+7Y1/FSnKZiBc1qrcXi4s/wMMS3t/sw4ye9xXsWRXWm/Nag1o24tJ5 XZ7lvDAnA2Q+T28B3bqoj0iQL0KYQk6r/ObNXUsEsfbUnr/GzePrIDcv+uo4N5or7HaH MyQg== X-Gm-Message-State: AOJu0Yw3onjyxfQLdTx2BaWeQhoHPaiZXv159J71Utf3aVhrX6gSjDRU 6okkLIdfOyB/xA+J3TTH7VAO+ej/vfkGrRLysMwRmuBSdCa2CCHBUyuCDQ== X-Google-Smtp-Source: AGHT+IE0pwqKHl6O2OJW+NcSV0ikLjZ772FnJsn8z/QbYZ9A/Ev9hwmu7SBWjMpaqjxDdWeOCw9tlw== X-Received: by 2002:a05:620a:4489:b0:79d:76e5:be6f with SMTP id af79cd13be357-79eee1f1bcbmr1315529985a.20.1720376488735; Sun, 07 Jul 2024 11:21:28 -0700 (PDT) Received: from elysia.seanmcgovern.ca ([2607:f2c0:929e:a300:a6c5:6b5f:489c:391e]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79d692ed6d8sm995413685a.78.2024.07.07.11.21.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jul 2024 11:21:28 -0700 (PDT) From: Sean McGovern To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Jul 2024 14:21:26 -0400 Message-Id: <20240707182126.768613-1-gseanmcg@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240704012330.2046242-2-gseanmcg@gmail.com> References: <20240704012330.2046242-2-gseanmcg@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/flacdsp: implement wasted32 DSP function for VSX on POWER 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: RaptorCS POWER9 (8c4t) @ 2.2GHz: flac_wasted_32_c: 50.1 flac_wasted_32_vsx: 14.1 --- libavcodec/flacdsp.c | 2 ++ libavcodec/flacdsp.h | 1 + libavcodec/ppc/Makefile | 2 ++ libavcodec/ppc/flacdsp_init.c | 38 +++++++++++++++++++++++++ libavcodec/ppc/flacdsp_vsx.c | 53 +++++++++++++++++++++++++++++++++++ 5 files changed, 96 insertions(+) create mode 100644 libavcodec/ppc/flacdsp_init.c create mode 100644 libavcodec/ppc/flacdsp_vsx.c diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c index f5362bf66f..b63d55ddcd 100644 --- a/libavcodec/flacdsp.c +++ b/libavcodec/flacdsp.c @@ -156,5 +156,7 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int cha ff_flacdsp_init_riscv(c, fmt, channels); #elif ARCH_X86 ff_flacdsp_init_x86(c, fmt, channels); +#elif ARCH_PPC + ff_flacdsp_init_ppc(c, fmt, channels); #endif } diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h index 3b7b35a112..941536ef16 100644 --- a/libavcodec/flacdsp.h +++ b/libavcodec/flacdsp.h @@ -45,5 +45,6 @@ void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels); void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels); void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, int channels); void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels); +void ff_flacdsp_init_ppc(FLACDSPContext *c, enum AVSampleFormat fmt, int channels); #endif /* AVCODEC_FLACDSP_H */ diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index 10b9ca60da..7f81a8aa34 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -2,6 +2,8 @@ OBJS-$(CONFIG_AUDIODSP) += ppc/audiodsp.o OBJS-$(CONFIG_BLOCKDSP) += ppc/blockdsp.o OBJS-$(CONFIG_FDCTDSP) += ppc/fdctdsp.o +OBJS-$(CONFIG_FLAC_DECODER) += ppc/flacdsp_init.o +VSX-OBJS-$(CONFIG_FLAC_DECODER) += ppc/flacdsp_vsx.o OBJS-$(CONFIG_FMTCONVERT) += ppc/fmtconvert_altivec.o OBJS-$(CONFIG_H264CHROMA) += ppc/h264chroma_init.o OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o ppc/hpeldsp_altivec.o diff --git a/libavcodec/ppc/flacdsp_init.c b/libavcodec/ppc/flacdsp_init.c new file mode 100644 index 0000000000..526bddddbf --- /dev/null +++ b/libavcodec/ppc/flacdsp_init.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Sean McGovern + * + * 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 "libavutil/ppc/cpu.h" +#include "libavcodec/flacdsp.h" + +void ff_flac_wasted32_vsx(int32_t *, int wasted, int len); + +av_cold void ff_flacdsp_init_ppc(FLACDSPContext *c, enum AVSampleFormat fmt, int channels) +{ +#if HAVE_VSX + if (!PPC_VSX(av_get_cpu_flags())) + return; + + c->wasted32 = ff_flac_wasted32_vsx; +#endif +} diff --git a/libavcodec/ppc/flacdsp_vsx.c b/libavcodec/ppc/flacdsp_vsx.c new file mode 100644 index 0000000000..7464108c45 --- /dev/null +++ b/libavcodec/ppc/flacdsp_vsx.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Sean McGovern + * + * 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 "libavutil/ppc/cpu.h" +#include "libavutil/ppc/util_altivec.h" +#include "libavcodec/flacdsp.h" + +void ff_flac_wasted32_vsx(int32_t *, int wasted, int len); + +#if HAVE_VSX + +void ff_flac_wasted32_vsx(int32_t *decoded, int wasted, int len) +{ + register vec_s32 vec1, vec2; + const register vec_u32 vwasted = vec_splats((unsigned)wasted); + + for (int i = 0; i < len; i+=8 /* increment is by # elements, not bytes */) { + /* that said, we have some extra bandwidth so let's unroll it slightly */ + vec1 = vec_xl(0, decoded); + vec2 = vec_xl(16, decoded); + + vec1 = vec_sl(vec1, vwasted); + vec2 = vec_sl(vec2, vwasted); + + vec_xst(vec1, 0, decoded); + vec_xst(vec2, 16, decoded); + + decoded += 8; + } +} + +#endif /* HAVE_VSX */ -- 2.39.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".