1 /*
2 * Copyright (c) 2024 J. Dekker <jdek@itanimul.li>
3 * Copyright © 2024 Rémi Denis-Courmont.
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "config.h"
23
24 #include <stdint.h>
25 #include <string.h>
26
31
32 extern const struct {
36
38 int alpha,
int beta, int8_t *tc0);
40 int alpha,
int beta, int8_t *tc0);
42 int alpha,
int beta, int8_t *tc0);
50 int alpha,
int beta, int8_t *tc0);
52 int alpha,
int beta, int8_t *tc0);
55 int8_t *tc0);
63
64 #define IDCT_DEPTH(depth) \
65 void ff_h264_idct_add_##depth##_rvv(uint8_t *d, int16_t *s, int stride); \
66 void ff_h264_idct8_add_##depth##_rvv(uint8_t *d, int16_t *s, int stride); \
67 void ff_h264_idct4_dc_add_##depth##_rvv(uint8_t *, int16_t *, int); \
68 void ff_h264_idct8_dc_add_##depth##_rvv(uint8_t *, int16_t *, int); \
69 void ff_h264_idct_add16_##depth##_rvv(uint8_t *d, const int *soffset, \
70 int16_t *s, int stride, \
71 const uint8_t nnzc[5 * 8]); \
72 void ff_h264_idct_add16intra_##depth##_rvv(uint8_t *d, const int *soffset, \
73 int16_t *s, int stride, \
74 const uint8_t nnzc[5 * 8]); \
75 void ff_h264_idct8_add4_##depth##_rvv(uint8_t *d, const int *soffset, \
76 int16_t *s, int stride, \
77 const uint8_t nnzc[5 * 8]); \
78 void ff_h264_idct4_add8_##depth##_rvv(uint8_t **d, const int *soffset, \
79 int16_t *s, int stride, \
80 const uint8_t nnzc[5 * 8]); \
81 void ff_h264_idct4_add8_422_##depth##_rvv(uint8_t **d, const int *soffset, \
82 int16_t *s, int stride, \
83 const uint8_t nnzc[5 * 8]);
84
90 #undef IDCT_DEPTH
91
96
99
101 const int chroma_format_idc)
102 {
103 #if HAVE_RV
105
108 # if HAVE_RVV
110 const bool zvl128b = ff_rv_vlen_least(128);
111
113 if (zvl128b) {
119 }
125 }
134 }
135
151
152 if (chroma_format_idc <= 1) {
161 }
162
169 # if __riscv_xlen == 64
171 if (chroma_format_idc <= 1)
173 else
175 # endif
176 }
181 }
183 }
184
185 #define IDCT_DEPTH(depth) \
186 if (bit_depth == depth) { \
187 if (zvl128b) \
188 dsp->h264_idct_add = ff_h264_idct_add_##depth##_rvv; \
189 if (flags & AV_CPU_FLAG_RVB) \
190 dsp->h264_idct8_add = ff_h264_idct8_add_##depth##_rvv; \
191 if (zvl128b && (flags & AV_CPU_FLAG_RVB)) { \
192 dsp->h264_idct_dc_add = ff_h264_idct4_dc_add_##depth##_rvv; \
193 dsp->h264_idct8_dc_add = ff_h264_idct8_dc_add_##depth##_rvv; \
194 dsp->h264_idct_add16 = ff_h264_idct_add16_##depth##_rvv; \
195 dsp->h264_idct_add16intra = \
196 ff_h264_idct_add16intra_##depth##_rvv; \
197 if (__riscv_xlen == 64) { \
198 if (chroma_format_idc <= 1) \
199 dsp->h264_idct_add8 = \
200 ff_h264_idct4_add8_##depth##_rvv; \
201 else \
202 dsp->h264_idct_add8 = \
203 ff_h264_idct4_add8_422_##depth##_rvv; \
204 } \
205 } \
206 if (__riscv_xlen == 64 && (flags & AV_CPU_FLAG_RVB)) \
207 dsp->h264_idct8_add4 = ff_h264_idct8_add4_##depth##_rvv; \
208 }
209
214
219 }
220
222 }
223 # endif
224 #endif
225 }