FFmpeg
swscale_loongarch.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Loongson Technology Corporation Limited
3  * Contributed by Hao Chen(chenhao@loongson.cn)
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 #ifndef SWSCALE_LOONGARCH_SWSCALE_LOONGARCH_H
23 #define SWSCALE_LOONGARCH_SWSCALE_LOONGARCH_H
24 
25 #include "libswscale/swscale.h"
27 #include "config.h"
28 
29 void ff_hscale_8_to_15_lsx(SwsContext *c, int16_t *dst, int dstW,
30  const uint8_t *src, const int16_t *filter,
31  const int32_t *filterPos, int filterSize);
32 
33 void ff_hscale_8_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW,
34  const uint8_t *src, const int16_t *filter,
35  const int32_t *filterPos, int filterSize);
36 
37 void ff_hscale_16_to_15_lsx(SwsContext *c, int16_t *_dst, int dstW,
38  const uint8_t *_src, const int16_t *filter,
39  const int32_t *filterPos, int filterSize);
40 
41 void ff_hscale_16_to_15_sub_lsx(SwsContext *c, int16_t *_dst, int dstW,
42  const uint8_t *_src, const int16_t *filter,
43  const int32_t *filterPos, int filterSize, int sh);
44 
45 void ff_hscale_16_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW,
46  const uint8_t *_src, const int16_t *filter,
47  const int32_t *filterPos, int filterSize);
48 
49 void ff_hscale_16_to_19_sub_lsx(SwsContext *c, int16_t *_dst, int dstW,
50  const uint8_t *_src, const int16_t *filter,
51  const int32_t *filterPos, int filterSize, int sh);
52 
53 void planar_rgb_to_uv_lsx(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4],
54  int width, int32_t *rgb2yuv, void *opq);
55 
56 void planar_rgb_to_y_lsx(uint8_t *_dst, const uint8_t *src[4], int width,
57  int32_t *rgb2yuv, void *opq);
58 
59 void ff_yuv2planeX_8_lsx(const int16_t *filter, int filterSize,
60  const int16_t **src, uint8_t *dest, int dstW,
61  const uint8_t *dither, int offset);
62 
64 
65 int yuv420_rgb24_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
66  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
67 
68 int yuv420_bgr24_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
69  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
70 
71 int yuv420_rgba32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
72  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
73 
74 int yuv420_bgra32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
75  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
76 
77 int yuv420_argb32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
78  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
79 
80 int yuv420_abgr32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
81  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
82 
83 #if HAVE_LASX
84 void ff_hscale_8_to_15_lasx(SwsContext *c, int16_t *dst, int dstW,
85  const uint8_t *src, const int16_t *filter,
86  const int32_t *filterPos, int filterSize);
87 
88 void ff_hscale_8_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW,
89  const uint8_t *src, const int16_t *filter,
90  const int32_t *filterPos, int filterSize);
91 
92 void ff_hscale_16_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW,
93  const uint8_t *_src, const int16_t *filter,
94  const int32_t *filterPos, int filterSize);
95 
96 void ff_hscale_16_to_15_lasx(SwsContext *c, int16_t *dst, int dstW,
97  const uint8_t *_src, const int16_t *filter,
98  const int32_t *filterPos, int filterSize);
99 
100 void planar_rgb_to_uv_lasx(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4],
101  int width, int32_t *rgb2yuv, void *opq);
102 
103 void planar_rgb_to_y_lasx(uint8_t *_dst, const uint8_t *src[4], int width,
104  int32_t *rgb2yuv, void *opq);
105 
106 int yuv420_rgb24_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
107  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
108 
109 int yuv420_bgr24_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
110  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
111 
112 int yuv420_rgba32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
113  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
114 
115 int yuv420_bgra32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
116  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
117 
118 int yuv420_argb32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
119  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
120 
121 int yuv420_abgr32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
122  int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
123 
124 void ff_interleave_bytes_lasx(const uint8_t *src1, const uint8_t *src2,
125  uint8_t *dest, int width, int height,
126  int src1Stride, int src2Stride, int dstStride);
127 
128 void ff_yuv2planeX_8_lasx(const int16_t *filter, int filterSize,
129  const int16_t **src, uint8_t *dest, int dstW,
130  const uint8_t *dither, int offset);
131 
133 #endif // #if HAVE_LASX
134 
135 #endif /* SWSCALE_LOONGARCH_SWSCALE_LOONGARCH_H */
ff_yuv2planeX_8_lasx
void ff_yuv2planeX_8_lasx(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Definition: output_lasx.c:25
yuv420_bgr24_lsx
int yuv420_bgr24_lsx(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
planar_rgb_to_uv_lsx
void planar_rgb_to_uv_lsx(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
src1
const pixel * src1
Definition: h264pred_template.c:421
yuv420_rgb24_lsx
int yuv420_rgb24_lsx(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
rgb2yuv
static const char rgb2yuv[]
Definition: vf_scale_vulkan.c:70
ff_sws_init_output_lasx
av_cold void ff_sws_init_output_lasx(SwsContext *c)
Definition: output_lasx.c:1778
filter
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:228
planar_rgb_to_y_lsx
void planar_rgb_to_y_lsx(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
ff_hscale_8_to_15_lsx
void ff_hscale_8_to_15_lsx(SwsContext *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
av_cold
#define av_cold
Definition: attributes.h:90
width
#define width
yuv420_abgr32_lsx
int yuv420_abgr32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
ff_hscale_8_to_19_lsx
void ff_hscale_8_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
ff_sws_init_output_lsx
av_cold void ff_sws_init_output_lsx(SwsContext *c)
Definition: output_lsx.c:1627
ff_hscale_16_to_15_lsx
void ff_hscale_16_to_15_lsx(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition: swscale_lsx.c:26
ff_hscale_16_to_15_sub_lsx
void ff_hscale_16_to_15_sub_lsx(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize, int sh)
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
yuv420_bgra32_lsx
int yuv420_bgra32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
ff_interleave_bytes_lasx
void ff_interleave_bytes_lasx(const uint8_t *src1, const uint8_t *src2, uint8_t *dest, int width, int height, int src1Stride, int src2Stride, int dstStride)
Definition: rgb2rgb_lasx.c:25
srcSliceH
return srcSliceH
Definition: yuv2rgb_template.c:87
height
#define height
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
ff_yuv2planeX_8_lsx
void ff_yuv2planeX_8_lsx(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
ff_hscale_16_to_19_sub_lsx
void ff_hscale_16_to_19_sub_lsx(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize, int sh)
src2
const pixel * src2
Definition: h264pred_template.c:422
swscale_internal.h
planar_rgb_to_uv_lasx
void planar_rgb_to_uv_lasx(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
Definition: input_lasx.c:25
ff_hscale_8_to_15_lasx
void ff_hscale_8_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition: swscale_lasx.c:314
ff_hscale_16_to_19_lasx
void ff_hscale_16_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition: swscale_lasx.c:823
yuv420_argb32_lsx
int yuv420_argb32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
ff_hscale_16_to_15_lasx
void ff_hscale_16_to_15_lasx(SwsContext *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition: swscale_lasx.c:676
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
int32_t
int32_t
Definition: audioconvert.c:56
yuv420_rgba32_lsx
int yuv420_rgba32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
planar_rgb_to_y_lasx
void planar_rgb_to_y_lasx(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
Definition: input_lasx.c:127
ff_hscale_8_to_19_lasx
void ff_hscale_8_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition: swscale_lasx.c:474
SwsContext
Definition: swscale_internal.h:299
ff_hscale_16_to_19_lsx
void ff_hscale_16_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition: swscale_lsx.c:42
swscale.h
dither
static const uint8_t dither[8][8]
Definition: vf_fspp.c:60