FFmpeg
Loading...
Searching...
No Matches
swscale.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "config.h"
21#include "libavutil/riscv/cpu.h"
23
24void ff_range_lum_to_jpeg_16_rvv(int16_t *, int);
25void ff_range_chr_to_jpeg_16_rvv(int16_t *, int16_t *, int);
26void ff_range_lum_from_jpeg_16_rvv(int16_t *, int);
27void ff_range_chr_from_jpeg_16_rvv(int16_t *, int16_t *, int);
28
30{
31 /* This code is currently disabled because of changes in the base
32 * implementation of these functions. This code should be enabled
33 * again once those changes are ported to this architecture. */
34#if 0
35#if HAVE_RVV
36 int flags = av_get_cpu_flags();
37
38 static const struct {
39 void (*lum)(int16_t *, int);
40 void (*chr)(int16_t *, int16_t *, int);
41 } convs[2] = {
44 };
45
46 if (c->dstBpc <= 14 &&
48 bool from = c->opts.src_range != 0;
49
50 c->lumConvertRange = convs[from].lum;
51 c->chrConvertRange = convs[from].chr;
52 }
53#endif
54#endif
55}
56
57#define RVV_INPUT(name) \
58void ff_##name##ToY_rvv(uint8_t *dst, const uint8_t *src, const uint8_t *, \
59 const uint8_t *, int w, uint32_t *coeffs, void *); \
60void ff_##name##ToUV_rvv(uint8_t *, uint8_t *, const uint8_t *, \
61 const uint8_t *, const uint8_t *, int w, \
62 uint32_t *coeffs, void *); \
63void ff_##name##ToUV_half_rvv(uint8_t *, uint8_t *, const uint8_t *, \
64 const uint8_t *, const uint8_t *, int w, \
65 uint32_t *coeffs, void *)
66
67RVV_INPUT(abgr32);
68RVV_INPUT(argb32);
69RVV_INPUT(bgr24);
70RVV_INPUT(bgra32);
71RVV_INPUT(rgb24);
72RVV_INPUT(rgba32);
73
75{
76#if HAVE_RVV
77 int flags = av_get_cpu_flags();
78
80 switch (c->opts.src_format) {
81 case AV_PIX_FMT_ABGR:
82 c->lumToYV12 = ff_abgr32ToY_rvv;
83 if (c->chrSrcHSubSample)
84 c->chrToYV12 = ff_abgr32ToUV_half_rvv;
85 else
86 c->chrToYV12 = ff_abgr32ToUV_rvv;
87 break;
88
89 case AV_PIX_FMT_ARGB:
90 c->lumToYV12 = ff_argb32ToY_rvv;
91 if (c->chrSrcHSubSample)
92 c->chrToYV12 = ff_argb32ToUV_half_rvv;
93 else
94 c->chrToYV12 = ff_argb32ToUV_rvv;
95 break;
96
98 c->lumToYV12 = ff_bgr24ToY_rvv;
99 if (c->chrSrcHSubSample)
100 c->chrToYV12 = ff_bgr24ToUV_half_rvv;
101 else
102 c->chrToYV12 = ff_bgr24ToUV_rvv;
103 break;
104
105 case AV_PIX_FMT_BGRA:
106 c->lumToYV12 = ff_bgra32ToY_rvv;
107 if (c->chrSrcHSubSample)
108 c->chrToYV12 = ff_bgra32ToUV_half_rvv;
109 else
110 c->chrToYV12 = ff_bgra32ToUV_rvv;
111 break;
112
113 case AV_PIX_FMT_RGB24:
114 c->lumToYV12 = ff_rgb24ToY_rvv;
115 if (c->chrSrcHSubSample)
116 c->chrToYV12 = ff_rgb24ToUV_half_rvv;
117 else
118 c->chrToYV12 = ff_rgb24ToUV_rvv;
119 break;
120
121 case AV_PIX_FMT_RGBA:
122 c->lumToYV12 = ff_rgba32ToY_rvv;
123 if (c->chrSrcHSubSample)
124 c->chrToYV12 = ff_rgba32ToUV_half_rvv;
125 else
126 c->chrToYV12 = ff_rgba32ToUV_rvv;
127 break;
128 }
129 }
130#endif
131}
#define flags(name, subs,...)
Definition cbs_h264.c:74
const char * from
Definition jacosubdec.c:64
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_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
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition pixfmt.h:99
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition pixfmt.h:102
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition pixfmt.h:101
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition pixfmt.h:100
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c)
Definition swscale.c:29
av_cold void ff_sws_init_swscale_riscv(SwsInternal *c)
Definition swscale.c:74
void ff_range_lum_from_jpeg_16_rvv(int16_t *, int)
void ff_range_lum_to_jpeg_16_rvv(int16_t *, int)
void ff_range_chr_from_jpeg_16_rvv(int16_t *, int16_t *, int)
void ff_range_chr_to_jpeg_16_rvv(int16_t *, int16_t *, int)
#define RVV_INPUT(name)
Definition swscale.c:57
static double lum(void *priv, double x, double y, int plane)
Definition vf_fftfilt.c:107
static double c[64]