FFmpeg
h264qpel_init_loongarch.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Loongson Technology Corporation Limited
3  * Contributed by Shiyou Yin <yinshiyou-hf@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 #include "h264qpel_lasx.h"
23 #include "libavutil/attributes.h"
25 #include "libavcodec/h264qpel.h"
26 
28 {
30  if (have_lasx(cpu_flags)) {
31  if (8 == bit_depth) {
32  c->put_h264_qpel_pixels_tab[0][0] = ff_put_h264_qpel16_mc00_lasx;
33  c->put_h264_qpel_pixels_tab[0][1] = ff_put_h264_qpel16_mc10_lasx;
34  c->put_h264_qpel_pixels_tab[0][2] = ff_put_h264_qpel16_mc20_lasx;
35  c->put_h264_qpel_pixels_tab[0][3] = ff_put_h264_qpel16_mc30_lasx;
36  c->put_h264_qpel_pixels_tab[0][4] = ff_put_h264_qpel16_mc01_lasx;
37  c->put_h264_qpel_pixels_tab[0][5] = ff_put_h264_qpel16_mc11_lasx;
38 
39  c->put_h264_qpel_pixels_tab[0][6] = ff_put_h264_qpel16_mc21_lasx;
40  c->put_h264_qpel_pixels_tab[0][7] = ff_put_h264_qpel16_mc31_lasx;
41  c->put_h264_qpel_pixels_tab[0][8] = ff_put_h264_qpel16_mc02_lasx;
42  c->put_h264_qpel_pixels_tab[0][9] = ff_put_h264_qpel16_mc12_lasx;
43  c->put_h264_qpel_pixels_tab[0][10] = ff_put_h264_qpel16_mc22_lasx;
44  c->put_h264_qpel_pixels_tab[0][11] = ff_put_h264_qpel16_mc32_lasx;
45  c->put_h264_qpel_pixels_tab[0][12] = ff_put_h264_qpel16_mc03_lasx;
46  c->put_h264_qpel_pixels_tab[0][13] = ff_put_h264_qpel16_mc13_lasx;
47  c->put_h264_qpel_pixels_tab[0][14] = ff_put_h264_qpel16_mc23_lasx;
48  c->put_h264_qpel_pixels_tab[0][15] = ff_put_h264_qpel16_mc33_lasx;
49  c->avg_h264_qpel_pixels_tab[0][0] = ff_avg_h264_qpel16_mc00_lasx;
50  c->avg_h264_qpel_pixels_tab[0][1] = ff_avg_h264_qpel16_mc10_lasx;
51  c->avg_h264_qpel_pixels_tab[0][2] = ff_avg_h264_qpel16_mc20_lasx;
52  c->avg_h264_qpel_pixels_tab[0][3] = ff_avg_h264_qpel16_mc30_lasx;
53  c->avg_h264_qpel_pixels_tab[0][4] = ff_avg_h264_qpel16_mc01_lasx;
54  c->avg_h264_qpel_pixels_tab[0][5] = ff_avg_h264_qpel16_mc11_lasx;
55  c->avg_h264_qpel_pixels_tab[0][6] = ff_avg_h264_qpel16_mc21_lasx;
56  c->avg_h264_qpel_pixels_tab[0][7] = ff_avg_h264_qpel16_mc31_lasx;
57  c->avg_h264_qpel_pixels_tab[0][8] = ff_avg_h264_qpel16_mc02_lasx;
58  c->avg_h264_qpel_pixels_tab[0][9] = ff_avg_h264_qpel16_mc12_lasx;
59  c->avg_h264_qpel_pixels_tab[0][10] = ff_avg_h264_qpel16_mc22_lasx;
60  c->avg_h264_qpel_pixels_tab[0][11] = ff_avg_h264_qpel16_mc32_lasx;
61  c->avg_h264_qpel_pixels_tab[0][12] = ff_avg_h264_qpel16_mc03_lasx;
62  c->avg_h264_qpel_pixels_tab[0][13] = ff_avg_h264_qpel16_mc13_lasx;
63  c->avg_h264_qpel_pixels_tab[0][14] = ff_avg_h264_qpel16_mc23_lasx;
64  c->avg_h264_qpel_pixels_tab[0][15] = ff_avg_h264_qpel16_mc33_lasx;
65 
66  c->put_h264_qpel_pixels_tab[1][0] = ff_put_h264_qpel8_mc00_lasx;
67  c->put_h264_qpel_pixels_tab[1][1] = ff_put_h264_qpel8_mc10_lasx;
68  c->put_h264_qpel_pixels_tab[1][2] = ff_put_h264_qpel8_mc20_lasx;
69  c->put_h264_qpel_pixels_tab[1][3] = ff_put_h264_qpel8_mc30_lasx;
70  c->put_h264_qpel_pixels_tab[1][4] = ff_put_h264_qpel8_mc01_lasx;
71  c->put_h264_qpel_pixels_tab[1][5] = ff_put_h264_qpel8_mc11_lasx;
72  c->put_h264_qpel_pixels_tab[1][6] = ff_put_h264_qpel8_mc21_lasx;
73  c->put_h264_qpel_pixels_tab[1][7] = ff_put_h264_qpel8_mc31_lasx;
74  c->put_h264_qpel_pixels_tab[1][8] = ff_put_h264_qpel8_mc02_lasx;
75  c->put_h264_qpel_pixels_tab[1][9] = ff_put_h264_qpel8_mc12_lasx;
76  c->put_h264_qpel_pixels_tab[1][10] = ff_put_h264_qpel8_mc22_lasx;
77  c->put_h264_qpel_pixels_tab[1][11] = ff_put_h264_qpel8_mc32_lasx;
78  c->put_h264_qpel_pixels_tab[1][12] = ff_put_h264_qpel8_mc03_lasx;
79  c->put_h264_qpel_pixels_tab[1][13] = ff_put_h264_qpel8_mc13_lasx;
80  c->put_h264_qpel_pixels_tab[1][14] = ff_put_h264_qpel8_mc23_lasx;
81  c->put_h264_qpel_pixels_tab[1][15] = ff_put_h264_qpel8_mc33_lasx;
82  c->avg_h264_qpel_pixels_tab[1][0] = ff_avg_h264_qpel8_mc00_lasx;
83  c->avg_h264_qpel_pixels_tab[1][1] = ff_avg_h264_qpel8_mc10_lasx;
84  c->avg_h264_qpel_pixels_tab[1][2] = ff_avg_h264_qpel8_mc20_lasx;
85  c->avg_h264_qpel_pixels_tab[1][3] = ff_avg_h264_qpel8_mc30_lasx;
86  c->avg_h264_qpel_pixels_tab[1][5] = ff_avg_h264_qpel8_mc11_lasx;
87  c->avg_h264_qpel_pixels_tab[1][6] = ff_avg_h264_qpel8_mc21_lasx;
88  c->avg_h264_qpel_pixels_tab[1][7] = ff_avg_h264_qpel8_mc31_lasx;
89  c->avg_h264_qpel_pixels_tab[1][8] = ff_avg_h264_qpel8_mc02_lasx;
90  c->avg_h264_qpel_pixels_tab[1][9] = ff_avg_h264_qpel8_mc12_lasx;
91  c->avg_h264_qpel_pixels_tab[1][10] = ff_avg_h264_qpel8_mc22_lasx;
92  c->avg_h264_qpel_pixels_tab[1][11] = ff_avg_h264_qpel8_mc32_lasx;
93  c->avg_h264_qpel_pixels_tab[1][13] = ff_avg_h264_qpel8_mc13_lasx;
94  c->avg_h264_qpel_pixels_tab[1][14] = ff_avg_h264_qpel8_mc23_lasx;
95  c->avg_h264_qpel_pixels_tab[1][15] = ff_avg_h264_qpel8_mc33_lasx;
96  }
97  }
98 }
ff_avg_h264_qpel8_mc22_lasx
void ff_avg_h264_qpel8_mc22_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1708
bit_depth
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
Definition: af_astats.c:226
ff_avg_h264_qpel8_mc33_lasx
void ff_avg_h264_qpel8_mc33_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1749
ff_put_h264_qpel8_mc01_lasx
void ff_put_h264_qpel8_mc01_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1502
ff_put_h264_qpel16_mc21_lasx
void ff_put_h264_qpel16_mc21_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1808
have_lasx
#define have_lasx(flags)
Definition: cpu.h:29
ff_avg_h264_qpel16_mc10_lasx
void ff_avg_h264_qpel16_mc10_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1906
ff_put_h264_qpel8_mc23_lasx
void ff_put_h264_qpel8_mc23_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1601
ff_avg_h264_qpel16_mc01_lasx
void ff_avg_h264_qpel16_mc01_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1930
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:98
ff_put_h264_qpel16_mc00_lasx
void ff_put_h264_qpel16_mc00_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1760
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:50
ff_avg_h264_qpel16_mc13_lasx
void ff_avg_h264_qpel16_mc13_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:2012
h264qpel.h
ff_put_h264_qpel16_mc12_lasx
void ff_put_h264_qpel16_mc12_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1833
ff_avg_h264_qpel16_mc30_lasx
void ff_avg_h264_qpel16_mc30_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1921
ff_put_h264_qpel8_mc30_lasx
void ff_put_h264_qpel8_mc30_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1493
ff_put_h264_qpel8_mc10_lasx
void ff_put_h264_qpel8_mc10_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1477
ff_avg_h264_qpel16_mc32_lasx
void ff_avg_h264_qpel16_mc32_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1991
av_cold
#define av_cold
Definition: attributes.h:90
ff_put_h264_qpel8_mc20_lasx
void ff_put_h264_qpel8_mc20_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1487
ff_avg_h264_qpel16_mc23_lasx
void ff_avg_h264_qpel16_mc23_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:2020
ff_put_h264_qpel16_mc20_lasx
void ff_put_h264_qpel16_mc20_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1777
ff_avg_h264_qpel8_mc30_lasx
void ff_avg_h264_qpel8_mc30_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1647
ff_put_h264_qpel16_mc02_lasx
void ff_put_h264_qpel16_mc02_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1827
ff_put_h264_qpel8_mc11_lasx
void ff_put_h264_qpel8_mc11_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1511
ff_put_h264_qpel8_mc22_lasx
void ff_put_h264_qpel8_mc22_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1563
ff_put_h264_qpel8_mc00_lasx
void ff_put_h264_qpel8_mc00_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1469
ff_avg_h264_qpel8_mc02_lasx
void ff_avg_h264_qpel8_mc02_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1690
ff_avg_h264_qpel8_mc00_lasx
void ff_avg_h264_qpel8_mc00_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1624
ff_avg_h264_qpel16_mc31_lasx
void ff_avg_h264_qpel16_mc31_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1959
h264qpel_lasx.h
ff_avg_h264_qpel8_mc23_lasx
void ff_avg_h264_qpel8_mc23_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1737
ff_put_h264_qpel16_mc23_lasx
void ff_put_h264_qpel16_mc23_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1879
ff_avg_h264_qpel16_mc33_lasx
void ff_avg_h264_qpel16_mc33_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:2032
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
ff_avg_h264_qpel8_mc32_lasx
void ff_avg_h264_qpel8_mc32_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1714
ff_put_h264_qpel16_mc13_lasx
void ff_put_h264_qpel16_mc13_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1872
ff_avg_h264_qpel16_mc00_lasx
void ff_avg_h264_qpel16_mc00_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1898
ff_avg_h264_qpel16_mc02_lasx
void ff_avg_h264_qpel16_mc02_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1967
ff_put_h264_qpel16_mc11_lasx
void ff_put_h264_qpel16_mc11_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1801
ff_put_h264_qpel8_mc31_lasx
void ff_put_h264_qpel8_mc31_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1534
ff_put_h264_qpel16_mc22_lasx
void ff_put_h264_qpel16_mc22_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1845
ff_put_h264_qpel8_mc02_lasx
void ff_put_h264_qpel8_mc02_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1545
attributes.h
ff_avg_h264_qpel8_mc21_lasx
void ff_avg_h264_qpel8_mc21_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1667
ff_put_h264_qpel16_mc03_lasx
void ff_put_h264_qpel16_mc03_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1863
ff_avg_h264_qpel16_mc12_lasx
void ff_avg_h264_qpel16_mc12_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1973
ff_put_h264_qpel16_mc01_lasx
void ff_put_h264_qpel16_mc01_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1792
H264QpelContext
Definition: h264qpel.h:27
ff_avg_h264_qpel8_mc20_lasx
void ff_avg_h264_qpel8_mc20_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1641
ff_avg_h264_qpel16_mc11_lasx
void ff_avg_h264_qpel16_mc11_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1939
ff_avg_h264_qpel8_mc12_lasx
void ff_avg_h264_qpel8_mc12_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1696
ff_put_h264_qpel16_mc33_lasx
void ff_put_h264_qpel16_mc33_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1891
ff_put_h264_qpel8_mc12_lasx
void ff_put_h264_qpel8_mc12_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1551
ff_put_h264_qpel8_mc21_lasx
void ff_put_h264_qpel8_mc21_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1522
ff_avg_h264_qpel8_mc10_lasx
void ff_avg_h264_qpel8_mc10_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1632
ff_put_h264_qpel16_mc31_lasx
void ff_put_h264_qpel16_mc31_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1820
ff_avg_h264_qpel8_mc11_lasx
void ff_avg_h264_qpel8_mc11_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1656
ff_put_h264_qpel16_mc32_lasx
void ff_put_h264_qpel16_mc32_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1851
ff_put_h264_qpel8_mc13_lasx
void ff_put_h264_qpel8_mc13_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1590
ff_h264qpel_init_loongarch
av_cold void ff_h264qpel_init_loongarch(H264QpelContext *c, int bit_depth)
Definition: h264qpel_init_loongarch.c:27
ff_put_h264_qpel8_mc03_lasx
void ff_put_h264_qpel8_mc03_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1581
ff_avg_h264_qpel16_mc20_lasx
void ff_avg_h264_qpel16_mc20_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1915
ff_avg_h264_qpel16_mc21_lasx
void ff_avg_h264_qpel16_mc21_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1947
ff_put_h264_qpel8_mc32_lasx
void ff_put_h264_qpel8_mc32_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1569
ff_put_h264_qpel16_mc30_lasx
void ff_put_h264_qpel16_mc30_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1783
ff_avg_h264_qpel16_mc03_lasx
void ff_avg_h264_qpel16_mc03_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:2003
ff_avg_h264_qpel8_mc31_lasx
void ff_avg_h264_qpel8_mc31_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1679
ff_avg_h264_qpel8_mc13_lasx
void ff_avg_h264_qpel8_mc13_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1726
cpu.h
ff_put_h264_qpel16_mc10_lasx
void ff_put_h264_qpel16_mc10_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1768
ff_avg_h264_qpel16_mc22_lasx
void ff_avg_h264_qpel16_mc22_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1985
ff_put_h264_qpel8_mc33_lasx
void ff_put_h264_qpel8_mc33_lasx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: h264qpel_lasx.c:1613