FFmpeg
Loading...
Searching...
No Matches
mpegvideoencdsp_init.c
Go to the documentation of this file.
1/*
2 * Copyright © 2024 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 "libavutil/cpu.h"
25
26int ff_try_8x8basis_rvv(const int16_t rem[64], const int16_t weight[64],
27 const int16_t basis[16], int scale);
28void ff_add_8x8basis_rvv(int16_t rem[64], const int16_t basis[16], int scale);
29int ff_pix_sum_rvv(const uint8_t *pix, ptrdiff_t line_size);
30int ff_pix_norm1_rvv(const uint8_t *pix, ptrdiff_t line_size);
31
33 AVCodecContext *avctx)
34{
35#if HAVE_RVV
36 int flags = av_get_cpu_flags();
37
39 if (flags & AV_CPU_FLAG_RVB) {
40 c->try_8x8basis = ff_try_8x8basis_rvv;
41 c->add_8x8basis = ff_add_8x8basis_rvv;
42 }
43
45 if ((flags & AV_CPU_FLAG_RVB) && ff_rv_vlen_least(128))
46 c->pix_sum = ff_pix_sum_rvv;
47 c->pix_norm1 = ff_pix_norm1_rvv;
48 }
49 }
50#endif
51}
#define flags(name, subs,...)
Definition cbs_h264.c:74
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition intra.c:278
#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
static int16_t basis[64][64]
enum AVPixelFormat pix
Definition ohcodec.c:55
const h264_weight_func weight
int ff_pix_sum_rvv(const uint8_t *pix, ptrdiff_t line_size)
int ff_pix_norm1_rvv(const uint8_t *pix, ptrdiff_t line_size)
int ff_try_8x8basis_rvv(const int16_t rem[64], const int16_t weight[64], const int16_t basis[16], int scale)
av_cold void ff_mpegvideoencdsp_init_riscv(MpegvideoEncDSPContext *c, AVCodecContext *avctx)
void ff_add_8x8basis_rvv(int16_t rem[64], const int16_t basis[16], int scale)
main external API structure.
Definition avcodec.h:443
static double c[64]