FFmpeg
float_dsp_init.c
Go to the documentation of this file.
1 /*
2  * Copyright © 2022 Rémi Denis-Courmont.
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdint.h>
22 
23 #include "config.h"
24 #include "libavutil/attributes.h"
25 #include "libavutil/cpu.h"
26 #include "libavutil/float_dsp.h"
27 
28 void ff_vector_fmul_rvv(float *dst, const float *src0, const float *src1,
29  int len);
30 void ff_vector_fmac_scalar_rvv(float *dst, const float *src, float mul,
31  int len);
32 void ff_vector_fmul_scalar_rvv(float *dst, const float *src, float mul,
33  int len);
34 void ff_vector_fmul_window_rvv(float *dst, const float *src0,
35  const float *src1, const float *win, int len);
36 void ff_vector_fmul_add_rvv(float *dst, const float *src0, const float *src1,
37  const float *src2, int len);
38 void ff_vector_fmul_reverse_rvv(float *dst, const float *src0,
39  const float *src1, int len);
40 void ff_butterflies_float_rvv(float *v1, float *v2, int len);
41 float ff_scalarproduct_float_rvv(const float *v1, const float *v2, int len);
42 
43 void ff_vector_dmul_rvv(double *dst, const double *src0, const double *src1,
44  int len);
45 void ff_vector_dmac_scalar_rvv(double *dst, const double *src, double mul,
46  int len);
47 void ff_vector_dmul_scalar_rvv(double *dst, const double *src, double mul,
48  int len);
49 double ff_scalarproduct_double_rvv(const double *v1, const double *v2,
50  size_t len);
51 
53 {
54 #if HAVE_RVV
55  int flags = av_get_cpu_flags();
56 
57  if (flags & AV_CPU_FLAG_RVB) {
58  if (flags & AV_CPU_FLAG_RVV_F32) {
67  }
68 
69  if (flags & AV_CPU_FLAG_RVV_F64) {
74  }
75  }
76 #endif
77 }
ff_vector_fmul_add_rvv
void ff_vector_fmul_add_rvv(float *dst, const float *src0, const float *src1, const float *src2, int len)
AVFloatDSPContext::butterflies_float
void(* butterflies_float)(float *restrict v1, float *restrict v2, int len)
Calculate the sum and difference of two vectors of floats.
Definition: float_dsp.h:164
src1
const pixel * src1
Definition: h264pred_template.c:421
AVFloatDSPContext::vector_fmul_reverse
void(* vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len)
Calculate the entry wise product of two vectors of floats, and store the result in a vector of floats...
Definition: float_dsp.h:154
ff_vector_fmul_rvv
void ff_vector_fmul_rvv(float *dst, const float *src0, const float *src1, int len)
AVFloatDSPContext::vector_dmul
void(* vector_dmul)(double *dst, const double *src0, const double *src1, int len)
Calculate the entry wise product of two vectors of doubles and store the result in a vector of double...
Definition: float_dsp.h:190
ff_scalarproduct_double_rvv
double ff_scalarproduct_double_rvv(const double *v1, const double *v2, size_t len)
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:109
ff_vector_dmul_scalar_rvv
void ff_vector_dmul_scalar_rvv(double *dst, const double *src, double mul, int len)
AV_CPU_FLAG_RVV_F64
#define AV_CPU_FLAG_RVV_F64
Vectors of double's.
Definition: cpu.h:95
win
static float win(SuperEqualizerContext *s, float n, int N)
Definition: af_superequalizer.c:119
AV_CPU_FLAG_RVB
#define AV_CPU_FLAG_RVB
B (bit manipulations)
Definition: cpu.h:102
AV_CPU_FLAG_RVV_F32
#define AV_CPU_FLAG_RVV_F32
Vectors of float's *‍/.
Definition: cpu.h:93
av_cold
#define av_cold
Definition: attributes.h:90
ff_vector_fmul_scalar_rvv
void ff_vector_fmul_scalar_rvv(float *dst, const float *src, float mul, int len)
AVFloatDSPContext::scalarproduct_float
float(* scalarproduct_float)(const float *v1, const float *v2, int len)
Calculate the scalar product of two vectors of floats.
Definition: float_dsp.h:175
ff_vector_dmac_scalar_rvv
void ff_vector_dmac_scalar_rvv(double *dst, const double *src, double mul, int len)
AVFloatDSPContext::vector_fmul_scalar
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
Definition: float_dsp.h:85
AVFloatDSPContext::scalarproduct_double
double(* scalarproduct_double)(const double *v1, const double *v2, size_t len)
Calculate the scalar product of two vectors of doubles.
Definition: float_dsp.h:205
float_dsp.h
AVFloatDSPContext::vector_fmul
void(* vector_fmul)(float *dst, const float *src0, const float *src1, int len)
Calculate the entry wise product of two vectors of floats and store the result in a vector of floats.
Definition: float_dsp.h:38
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
cpu.h
AVFloatDSPContext
Definition: float_dsp.h:24
attributes.h
AVFloatDSPContext::vector_fmac_scalar
void(* vector_fmac_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float and add to destination vector.
Definition: float_dsp.h:54
src2
const pixel * src2
Definition: h264pred_template.c:422
AVFloatDSPContext::vector_fmul_add
void(* vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len)
Calculate the entry wise product of two vectors of floats, add a third vector of floats and store the...
Definition: float_dsp.h:137
ff_vector_fmul_window_rvv
void ff_vector_fmul_window_rvv(float *dst, const float *src0, const float *src1, const float *win, int len)
ff_butterflies_float_rvv
void ff_butterflies_float_rvv(float *v1, float *v2, int len)
ff_vector_dmul_rvv
void ff_vector_dmul_rvv(double *dst, const double *src0, const double *src1, int len)
len
int len
Definition: vorbis_enc_data.h:426
AVFloatDSPContext::vector_dmul_scalar
void(* vector_dmul_scalar)(double *dst, const double *src, double mul, int len)
Multiply a vector of double by a scalar double.
Definition: float_dsp.h:100
ff_vector_fmac_scalar_rvv
void ff_vector_fmac_scalar_rvv(float *dst, const float *src, float mul, int len)
ff_float_dsp_init_riscv
av_cold void ff_float_dsp_init_riscv(AVFloatDSPContext *fdsp)
Definition: float_dsp_init.c:52
ff_scalarproduct_float_rvv
float ff_scalarproduct_float_rvv(const float *v1, const float *v2, int len)
src0
const pixel *const src0
Definition: h264pred_template.c:420
AVFloatDSPContext::vector_fmul_window
void(* vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len)
Overlap/add with window function.
Definition: float_dsp.h:119
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
AVFloatDSPContext::vector_dmac_scalar
void(* vector_dmac_scalar)(double *dst, const double *src, double mul, int len)
Multiply a vector of doubles by a scalar double and add to destination vector.
Definition: float_dsp.h:70
src
#define src
Definition: vp8dsp.c:248
ff_vector_fmul_reverse_rvv
void ff_vector_fmul_reverse_rvv(float *dst, const float *src0, const float *src1, int len)