FFmpeg
Loading...
Searching...
No Matches
pixblockdsp_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"
25#include "libavutil/cpu.h"
26#include "libavutil/riscv/cpu.h"
28
29void ff_get_pixels_8_rvi(int16_t *restrict block, const uint8_t *pixels,
30 ptrdiff_t stride);
31void ff_get_pixels_16_rvi(int16_t *restrict block, const uint8_t *pixels,
32 ptrdiff_t stride);
33
34void ff_get_pixels_8_rvv(int16_t *restrict block, const uint8_t *pixels,
35 ptrdiff_t stride);
36void ff_get_pixels_unaligned_8_rvv(int16_t *restrict block, const uint8_t *pixels,
37 ptrdiff_t stride);
38void ff_diff_pixels_rvv(int16_t *restrict block, const uint8_t *s1,
39 const uint8_t *s2, ptrdiff_t stride);
40void ff_diff_pixels_unaligned_rvv(int16_t *restrict block, const uint8_t *s1,
41 const uint8_t *s2, ptrdiff_t stride);
42
44 unsigned high_bit_depth)
45{
46#if HAVE_RV
48
49#if __riscv_xlen >= 64
51 if (high_bit_depth)
52 c->get_pixels = ff_get_pixels_16_rvi;
53 else
54 c->get_pixels = ff_get_pixels_8_rvi;
55 }
56
58 if (high_bit_depth)
59 c->get_pixels_unaligned = ff_get_pixels_16_rvi;
60 else
61 c->get_pixels_unaligned = ff_get_pixels_8_rvi;
62 }
63#endif
64#if HAVE_RVV
65 if ((cpu_flags & AV_CPU_FLAG_RVV_I32) && ff_rv_vlen_least(128)) {
66 c->diff_pixels = ff_diff_pixels_unaligned_rvv;
67 c->diff_pixels_unaligned = ff_diff_pixels_unaligned_rvv;
68
69 if (!high_bit_depth) {
70 c->get_pixels = ff_get_pixels_unaligned_8_rvv;
71 c->get_pixels_unaligned = ff_get_pixels_unaligned_8_rvv;
72 }
73
75 if (!high_bit_depth)
76 c->get_pixels = ff_get_pixels_8_rvv;
77
78 c->diff_pixels = ff_diff_pixels_rvv;
79 }
80 }
81#endif
82#endif
83}
static int16_t block[64]
Definition dct.c:125
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
static atomic_int cpu_flags
Definition cpu.c:56
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_RVI
I (full GPR bank)
Definition cpu.h:96
#define AV_CPU_FLAG_RVV_I32
Vectors of 8/16/32-bit int's *‍/.
Definition cpu.h:97
#define AV_CPU_FLAG_RV_MISALIGNED
Fast misaligned accesses.
Definition cpu.h:103
void ff_diff_pixels_rvv(int16_t *restrict block, const uint8_t *s1, const uint8_t *s2, ptrdiff_t stride)
av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c, unsigned high_bit_depth)
void ff_get_pixels_8_rvv(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t stride)
void ff_diff_pixels_unaligned_rvv(int16_t *restrict block, const uint8_t *s1, const uint8_t *s2, ptrdiff_t stride)
void ff_get_pixels_16_rvi(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t stride)
void ff_get_pixels_8_rvi(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t stride)
void ff_get_pixels_unaligned_8_rvv(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t stride)
#define stride
static double c[64]