FFmpeg
Loading...
Searching...
No Matches
flacdsp_init.c
Go to the documentation of this file.
1/*
2 * Copyright © 2023 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 "config.h"
22
24#include "libavutil/cpu.h"
25#include "libavutil/riscv/cpu.h"
26#include "libavcodec/flacdsp.h"
27
28void ff_flac_lpc16_rvv(int32_t *decoded, const int coeffs[32],
29 int pred_order, int qlevel, int len);
30void ff_flac_lpc32_rvv(int32_t *decoded, const int coeffs[32],
31 int pred_order, int qlevel, int len);
32void ff_flac_lpc32_rvv_simple(int32_t *decoded, const int coeffs[32],
33 int pred_order, int qlevel, int len);
34void ff_flac_lpc33_rvv(int64_t *, const int32_t *, const int coeffs[32],
35 int pred_order, int qlevel, int len);
37void ff_flac_wasted33_rvv(int64_t *, const int32_t *, int shift, int len);
39 int channels, int len, int shift);
41 int channels, int len, int shift);
43 int channels, int len, int shift);
45 int channels, int len, int shift);
47 int channels, int len, int shift);
49 int channels, int len, int shift);
51 int channels, int len, int shift);
53 int channels, int len, int shift);
55 int channels, int len, int shift);
57 int channels, int len, int shift);
59 int channels, int len, int shift);
61 int channels, int len, int shift);
63 int channels, int len, int shift);
65 int channels, int len, int shift);
66
68 int channels)
69{
70#if HAVE_RVV
71 int flags = av_get_cpu_flags();
72
74 int vlenb = ff_get_rv_vlenb();
75
76 if (vlenb >= 16) {
77 c->lpc16 = ff_flac_lpc16_rvv;
78
79# if (__riscv_xlen >= 64)
81 if (vlenb > 16) {
83 c->lpc33 = ff_flac_lpc33_rvv;
84 } else
85 c->lpc32 = ff_flac_lpc32_rvv;
86 }
87# endif
88 }
89
90 c->wasted32 = ff_flac_wasted32_rvv;
91
93 c->wasted33 = ff_flac_wasted33_rvv;
94
95# if (__riscv_xlen >= 64)
96 switch (fmt) {
98 switch (channels) {
99 case 2:
100 c->decorrelate[0] = ff_flac_decorrelate_indep2_16_rvv;
101 break;
102 case 4:
103 c->decorrelate[0] = ff_flac_decorrelate_indep4_16_rvv;
104 break;
105 case 6:
106 c->decorrelate[0] = ff_flac_decorrelate_indep6_16_rvv;
107 break;
108 case 8:
109 c->decorrelate[0] = ff_flac_decorrelate_indep8_16_rvv;
110 break;
111 }
112 c->decorrelate[1] = ff_flac_decorrelate_ls_16_rvv;
113 c->decorrelate[2] = ff_flac_decorrelate_rs_16_rvv;
114 c->decorrelate[3] = ff_flac_decorrelate_ms_16_rvv;
115 break;
117 switch (channels) {
118 case 2:
119 c->decorrelate[0] = ff_flac_decorrelate_indep2_32_rvv;
120 break;
121 case 4:
122 c->decorrelate[0] = ff_flac_decorrelate_indep4_32_rvv;
123 break;
124 case 6:
125 c->decorrelate[0] = ff_flac_decorrelate_indep6_32_rvv;
126 break;
127 case 8:
128 c->decorrelate[0] = ff_flac_decorrelate_indep8_32_rvv;
129 break;
130 }
131 c->decorrelate[1] = ff_flac_decorrelate_ls_32_rvv;
132 c->decorrelate[2] = ff_flac_decorrelate_rs_32_rvv;
133 c->decorrelate[3] = ff_flac_decorrelate_ms_32_rvv;
134 break;
135 }
136# endif
137 }
138#endif
139}
channels
Definition aptx.h:31
int32_t
#define flags(name, subs,...)
Definition cbs_h264.c:74
long long int64_t
Definition coverity.c:34
AVSampleFormat
Audio sample formats.
Definition samplefmt.h:55
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition samplefmt.h:59
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition samplefmt.h:58
static int shift(int a, int b)
Definition bonk.c:261
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition cpu.c:109
#define AV_CPU_FLAG_RVV_I64
Vectors of 64-bit int's *‍/.
Definition cpu.h:99
#define AV_CPU_FLAG_RVB
B (bit manipulations)
Definition cpu.h:104
#define AV_CPU_FLAG_RVV_I32
Vectors of 8/16/32-bit int's *‍/.
Definition cpu.h:97
void ff_flac_lpc32_rvv(int32_t *decoded, const int coeffs[32], int pred_order, int qlevel, int len)
void ff_flac_wasted32_rvv(int32_t *, int shift, int len)
void ff_flac_wasted33_rvv(int64_t *, const int32_t *, int shift, int len)
void ff_flac_decorrelate_indep6_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_indep8_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_lpc33_rvv(int64_t *, const int32_t *, const int coeffs[32], int pred_order, int qlevel, int len)
void ff_flac_decorrelate_ls_32_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_lpc16_rvv(int32_t *decoded, const int coeffs[32], int pred_order, int qlevel, int len)
void ff_flac_decorrelate_indep6_32_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_indep4_32_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_rs_32_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_indep8_32_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_ms_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_rs_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_ls_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_indep2_32_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
void ff_flac_decorrelate_indep4_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_indep2_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_decorrelate_ms_32_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift)
void ff_flac_lpc32_rvv_simple(int32_t *decoded, const int coeffs[32], int pred_order, int qlevel, int len)
static FILE * out
Definition movenc.c:55
int len
static double c[64]