History

avcodec/la: add LSX optimization for h264 idct.

loongson_asm.S is LoongArch asm optimization helper. Add functions: ff_h264_idct_add_8_lsx ff_h264_idct8_add_8_lsx ff_h264_idct_dc_add_8_lsx ff_h264_idct8_dc_add_8_lsx ff_h264_idct_add16_8_lsx ff_h264_idct8_add4_8_lsx ff_h264_idct_add8_8_lsx ff_h264_idct_add8_422_8_lsx ff_h264_idct_add16_intra_8_lsx ff_h264_luma_dc_dequant_idct_8_lsx Replaced function(LSX is sufficient for these functions): ff_h264_idct_add_lasx ff_h264_idct4x4_addblk_dc_lasx ff_h264_idct_add16_lasx ff_h264_idct8_add4_lasx ff_h264_idct_add8_lasx ff_h264_idct_add8_422_lasx ff_h264_idct_add16_intra_lasx ff_h264_deq_idct_luma_dc_lasx Renamed functions: ff_h264_idct8_addblk_lasx ==> ff_h264_idct8_add_8_lasx ff_h264_idct8_dc_addblk_lasx ==> ff_h264_idct8_dc_add_8_lasx ./configure --disable-lasx ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -y /dev/null -an before: 155fps after: 161fps

Shiyou Yin committed 3 years ago

Commit e1b6ecd1 parent 90fba279 files · +1848 −543Browse files

Showing the changes to libavcodec (9 of 9 files). Show all

Unified · Split

9 files
  1. libavcodec/loongarch/Makefile +2 −1
  2. libavcodec/loongarch/h264_deblock_lasx.c +1 −1
  3. libavcodec/loongarch/h264dsp_init_loongarch.c +24 −15
  4. libavcodec/loongarch/h264dsp_lasx.c +1 −1
  5. libavcodec/loongarch/h264dsp_loongarch.h +33 −27
  6. libavcodec/loongarch/h264idct.S +658 −0
  7. libavcodec/loongarch/h264idct_lasx.c +0 −498
  8. libavcodec/loongarch/h264idct_loongarch.c +184 −0
  9. libavcodec/loongarch/loongson_asm.S +945 −0
libavcodec/loongarch/Makefile+2−1
@@ -12,7 +12,6 @@ OBJS-$(CONFIG_HEVC_DECODER) += loongarch/hevcdsp_init_loongarch.o · 11 unmodified lines
12LASX-OBJS-$(CONFIG_H264CHROMA) += loongarch/h264chroma_lasx.o12LASX-OBJS-$(CONFIG_H264CHROMA) += loongarch/h264chroma_lasx.o
13LASX-OBJS-$(CONFIG_H264QPEL) += loongarch/h264qpel_lasx.o13LASX-OBJS-$(CONFIG_H264QPEL) += loongarch/h264qpel_lasx.o
14LASX-OBJS-$(CONFIG_H264DSP) += loongarch/h264dsp_lasx.o \14LASX-OBJS-$(CONFIG_H264DSP) += loongarch/h264dsp_lasx.o \
15 loongarch/h264idct_lasx.o \
16 loongarch/h264_deblock_lasx.o15 loongarch/h264_deblock_lasx.o
17LASX-OBJS-$(CONFIG_H264PRED) += loongarch/h264_intrapred_lasx.o16LASX-OBJS-$(CONFIG_H264PRED) += loongarch/h264_intrapred_lasx.o
18LASX-OBJS-$(CONFIG_VC1_DECODER) += loongarch/vc1dsp_lasx.o17LASX-OBJS-$(CONFIG_VC1_DECODER) += loongarch/vc1dsp_lasx.o
@@ -31,3 +30,5 @@ LSX-OBJS-$(CONFIG_HEVC_DECODER) += loongarch/hevcdsp_lsx.o \ · 12 unmodified lines
31 loongarch/hevc_mc_bi_lsx.o \30 loongarch/hevc_mc_bi_lsx.o \
32 loongarch/hevc_mc_uni_lsx.o \31 loongarch/hevc_mc_uni_lsx.o \
33 loongarch/hevc_mc_uniw_lsx.o32 loongarch/hevc_mc_uniw_lsx.o
33LSX-OBJS-$(CONFIG_H264DSP) += loongarch/h264idct.o \
34 loongarch/h264idct_loongarch.o
libavcodec/loongarch/h264_deblock_lasx.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 */20 */
21 21
22#include "libavcodec/bit_depth_template.c"22#include "libavcodec/bit_depth_template.c"
23#include "h264dsp_lasx.h"23#include "h264dsp_loongarch.h"
24#include "libavutil/loongarch/loongson_intrinsics.h"24#include "libavutil/loongarch/loongson_intrinsics.h"
25 25
26#define H264_LOOP_FILTER_STRENGTH_ITERATION_LASX(edges, step, mask_mv, dir, \26#define H264_LOOP_FILTER_STRENGTH_ITERATION_LASX(edges, step, mask_mv, dir, \
libavcodec/loongarch/h264dsp_init_loongarch.c+24−15
@@ -21,13 +21,32 @@ · 20 unmodified lines
21 */21 */
22 22
23#include "libavutil/loongarch/cpu.h"23#include "libavutil/loongarch/cpu.h"
24#include "h264dsp_lasx.h"24#include "h264dsp_loongarch.h"
25 25
26av_cold void ff_h264dsp_init_loongarch(H264DSPContext *c, const int bit_depth,26av_cold void ff_h264dsp_init_loongarch(H264DSPContext *c, const int bit_depth,
27 const int chroma_format_idc)27 const int chroma_format_idc)
28{28{
29 int cpu_flags = av_get_cpu_flags();29 int cpu_flags = av_get_cpu_flags();
30 30
31 if (have_lsx(cpu_flags)) {
32 if (bit_depth == 8) {
33 c->h264_idct_add = ff_h264_idct_add_8_lsx;
34 c->h264_idct8_add = ff_h264_idct8_add_8_lsx;
35 c->h264_idct_dc_add = ff_h264_idct_dc_add_8_lsx;
36 c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_lsx;
37
38 if (chroma_format_idc <= 1)
39 c->h264_idct_add8 = ff_h264_idct_add8_8_lsx;
40 else
41 c->h264_idct_add8 = ff_h264_idct_add8_422_8_lsx;
42
43 c->h264_idct_add16 = ff_h264_idct_add16_8_lsx;
44 c->h264_idct8_add4 = ff_h264_idct8_add4_8_lsx;
45 c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_8_lsx;
46 c->h264_idct_add16intra = ff_h264_idct_add16_intra_8_lsx;
47 }
48 }
49#if HAVE_LASX
31 if (have_lasx(cpu_flags)) {50 if (have_lasx(cpu_flags)) {
32 if (chroma_format_idc <= 1)51 if (chroma_format_idc <= 1)
33 c->h264_loop_filter_strength = ff_h264_loop_filter_strength_lasx;52 c->h264_loop_filter_strength = ff_h264_loop_filter_strength_lasx;
@@ -56,20 +75,10 @@ av_cold void ff_h264dsp_init_loongarch(H264DSPContext *c, const int bit_depth, · 22 unmodified lines
56 c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_8_lasx;75 c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_8_lasx;
57 c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels4_8_lasx;76 c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels4_8_lasx;
58 77
59 c->h264_idct_add = ff_h264_idct_add_lasx;78 c->h264_idct8_add = ff_h264_idct8_add_8_lasx;
60 c->h264_idct8_add = ff_h264_idct8_addblk_lasx;79 c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_lasx;
61 c->h264_idct_dc_add = ff_h264_idct4x4_addblk_dc_lasx;80 c->h264_idct8_add4 = ff_h264_idct8_add4_8_lasx;
62 c->h264_idct8_dc_add = ff_h264_idct8_dc_addblk_lasx;
63 c->h264_idct_add16 = ff_h264_idct_add16_lasx;
64 c->h264_idct8_add4 = ff_h264_idct8_add4_lasx;
65
66 if (chroma_format_idc <= 1)
67 c->h264_idct_add8 = ff_h264_idct_add8_lasx;
68 else
69 c->h264_idct_add8 = ff_h264_idct_add8_422_lasx;
70
71 c->h264_idct_add16intra = ff_h264_idct_add16_intra_lasx;
72 c->h264_luma_dc_dequant_idct = ff_h264_deq_idct_luma_dc_lasx;
73 }81 }
74 }82 }
83#endif // #if HAVE_LASX
75}84}
libavcodec/loongarch/h264dsp_lasx.c+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
23 */23 */
24 24
25#include "libavutil/loongarch/loongson_intrinsics.h"25#include "libavutil/loongarch/loongson_intrinsics.h"
26#include "h264dsp_lasx.h"26#include "h264dsp_loongarch.h"
27 27
28#define AVC_LPF_P1_OR_Q1(p0_or_q0_org_in, q0_or_p0_org_in, \28#define AVC_LPF_P1_OR_Q1(p0_or_q0_org_in, q0_or_p0_org_in, \
29 p1_or_q1_org_in, p2_or_q2_org_in, \29 p1_or_q1_org_in, p2_or_q2_org_in, \
libavcodec/loongarch/h264dsp_loongarch.hrenamed from libavcodec/loongarch/h264dsp_lasx.h+33−27
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (c) 2021 Loongson Technology Corporation Limited2 * Copyright (c) 2023 Loongson Technology Corporation Limited
3 * Contributed by Shiyou Yin <yinshiyou-hf@loongson.cn>3 * Contributed by Shiyou Yin <yinshiyou-hf@loongson.cn>
4 * Xiwei Gu <guxiwei-hf@loongson.cn>4 * Xiwei Gu <guxiwei-hf@loongson.cn>
5 *5 *
@@ -20,11 +20,34 @@ · 14 unmodified lines
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */21 */
22 22
23#ifndef AVCODEC_LOONGARCH_H264DSP_LASX_H23#ifndef AVCODEC_LOONGARCH_H264DSP_LOONGARCH_H
24#define AVCODEC_LOONGARCH_H264DSP_LASX_H24#define AVCODEC_LOONGARCH_H264DSP_LOONGARCH_H
25 25
26#include "libavcodec/h264dec.h"26#include "libavcodec/h264dec.h"
27#include "config.h"
27 28
29void ff_h264_idct_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
30void ff_h264_idct8_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
31void ff_h264_idct_dc_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
32void ff_h264_idct8_dc_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
33void ff_h264_luma_dc_dequant_idct_8_lsx(int16_t *_output, int16_t *_input, int qmul);
34void ff_h264_idct_add16_8_lsx(uint8_t *dst, const int32_t *blk_offset,
35 int16_t *block, int32_t dst_stride,
36 const uint8_t nzc[15 * 8]);
37void ff_h264_idct8_add4_8_lsx(uint8_t *dst, const int32_t *blk_offset,
38 int16_t *block, int32_t dst_stride,
39 const uint8_t nzc[15 * 8]);
40void ff_h264_idct_add8_8_lsx(uint8_t **dst, const int32_t *blk_offset,
41 int16_t *block, int32_t dst_stride,
42 const uint8_t nzc[15 * 8]);
43void ff_h264_idct_add8_422_8_lsx(uint8_t **dst, const int32_t *blk_offset,
44 int16_t *block, int32_t dst_stride,
45 const uint8_t nzc[15 * 8]);
46void ff_h264_idct_add16_intra_8_lsx(uint8_t *dst, const int32_t *blk_offset,
47 int16_t *block, int32_t dst_stride,
48 const uint8_t nzc[15 * 8]);
49
50#if HAVE_LASX
28void ff_h264_h_lpf_luma_8_lasx(uint8_t *src, ptrdiff_t stride,51void ff_h264_h_lpf_luma_8_lasx(uint8_t *src, ptrdiff_t stride,
29 int alpha, int beta, int8_t *tc0);52 int alpha, int beta, int8_t *tc0);
30void ff_h264_v_lpf_luma_8_lasx(uint8_t *src, ptrdiff_t stride,53void ff_h264_v_lpf_luma_8_lasx(uint8_t *src, ptrdiff_t stride,
@@ -65,33 +88,16 @@ void ff_weight_h264_pixels4_8_lasx(uint8_t *src, ptrdiff_t stride, · 34 unmodified lines
65void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, int stride);88void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, int stride);
66 89
67void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, int stride);90void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, int stride);
68void ff_h264_idct_add_lasx(uint8_t *dst, int16_t *src, int32_t dst_stride);91void ff_h264_idct8_add_8_lasx(uint8_t *dst, int16_t *src, int32_t dst_stride);
69void ff_h264_idct8_addblk_lasx(uint8_t *dst, int16_t *src, int32_t dst_stride);92void ff_h264_idct8_dc_add_8_lasx(uint8_t *dst, int16_t *src,
70void ff_h264_idct4x4_addblk_dc_lasx(uint8_t *dst, int16_t *src,
71 int32_t dst_stride);
72void ff_h264_idct8_dc_addblk_lasx(uint8_t *dst, int16_t *src,
73 int32_t dst_stride);93 int32_t dst_stride);
74void ff_h264_idct_add16_lasx(uint8_t *dst, const int32_t *blk_offset,94void ff_h264_idct8_add4_8_lasx(uint8_t *dst, const int32_t *blk_offset,
75 int16_t *block, int32_t dst_stride,95 int16_t *block, int32_t dst_stride,
76 const uint8_t nzc[15 * 8]);96 const uint8_t nzc[15 * 8]);
77void ff_h264_idct8_add4_lasx(uint8_t *dst, const int32_t *blk_offset,
78 int16_t *block, int32_t dst_stride,
79 const uint8_t nzc[15 * 8]);
80void ff_h264_idct_add8_lasx(uint8_t **dst, const int32_t *blk_offset,
81 int16_t *block, int32_t dst_stride,
82 const uint8_t nzc[15 * 8]);
83void ff_h264_idct_add8_422_lasx(uint8_t **dst, const int32_t *blk_offset,
84 int16_t *block, int32_t dst_stride,
85 const uint8_t nzc[15 * 8]);
86void ff_h264_idct_add16_intra_lasx(uint8_t *dst, const int32_t *blk_offset,
87 int16_t *block, int32_t dst_stride,
88 const uint8_t nzc[15 * 8]);
89void ff_h264_deq_idct_luma_dc_lasx(int16_t *dst, int16_t *src,
90 int32_t de_qval);
91
92void ff_h264_loop_filter_strength_lasx(int16_t bS[2][4][4], uint8_t nnz[40],97void ff_h264_loop_filter_strength_lasx(int16_t bS[2][4][4], uint8_t nnz[40],
93 int8_t ref[2][40], int16_t mv[2][40][2],98 int8_t ref[2][40], int16_t mv[2][40][2],
94 int bidir, int edges, int step,99 int bidir, int edges, int step,
95 int mask_mv0, int mask_mv1, int field);100 int mask_mv0, int mask_mv1, int field);
101#endif // #if HAVE_LASX
96 102
97#endif // #ifndef AVCODEC_LOONGARCH_H264DSP_LASX_H103#endif // #ifndef AVCODEC_LOONGARCH_H264DSP_LOONGARCH_H
libavcodec/loongarch/h264idct.S+658−0
@@ -0,0 +1,658 @@
1/*
2 * Loongson LASX optimized h264idct
3 *
4 * Copyright (c) 2023 Loongson Technology Corporation Limited
5 * Contributed by Shiyou Yin <yinshiyou-hf@loongson.cn>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include "loongson_asm.S"
25
26/*
27 * #define FUNC2(a, b, c) FUNC3(a, b, c)
28 * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
29 * void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride)
30 * LSX optimization is enough for this function.
31 */
32function ff_h264_idct_add_8_lsx
33 fld.d f0, a1, 0
34 fld.d f1, a1, 8
35 fld.d f2, a1, 16
36 fld.d f3, a1, 24
37 vxor.v vr7, vr7, vr7
38 add.d t2, a2, a2
39 add.d t3, t2, a2
40 vst vr7, a1, 0
41 vst vr7, a1, 16
42
43 vadd.h vr4, vr0, vr2
44 vsub.h vr5, vr0, vr2
45 vsrai.h vr6, vr1, 1
46 vsrai.h vr7, vr3, 1
47 vsub.h vr6, vr6, vr3
48 vadd.h vr7, vr1, vr7
49 LSX_BUTTERFLY_4_H vr4, vr5, vr6, vr7, vr0, vr1, vr2, vr3
50 LSX_TRANSPOSE4x4_H vr0, vr1, vr2, vr3, vr0, vr1, vr2, vr3, vr4, vr5
51 vadd.h vr4, vr0, vr2
52 vsub.h vr5, vr0, vr2
53 vsrai.h vr6, vr1, 1
54 vsrai.h vr7, vr3, 1
55 vsub.h vr6, vr6, vr3
56 vadd.h vr7, vr1, vr7
57 LSX_BUTTERFLY_4_H vr4, vr5, vr6, vr7, vr0, vr1, vr2, vr3
58
59 fld.s f4, a0, 0
60 fldx.s f5, a0, a2
61 fldx.s f6, a0, t2
62 fldx.s f7, a0, t3
63
64 vsrari.h vr0, vr0, 6
65 vsrari.h vr1, vr1, 6
66 vsrari.h vr2, vr2, 6
67 vsrari.h vr3, vr3, 6
68
69 vsllwil.hu.bu vr4, vr4, 0
70 vsllwil.hu.bu vr5, vr5, 0
71 vsllwil.hu.bu vr6, vr6, 0
72 vsllwil.hu.bu vr7, vr7, 0
73 vadd.h vr0, vr0, vr4
74 vadd.h vr1, vr1, vr5
75 vadd.h vr2, vr2, vr6
76 vadd.h vr3, vr3, vr7
77 vssrarni.bu.h vr1, vr0, 0
78 vssrarni.bu.h vr3, vr2, 0
79
80 vbsrl.v vr0, vr1, 8
81 vbsrl.v vr2, vr3, 8
82 fst.s f1, a0, 0
83 fstx.s f0, a0, a2
84 fstx.s f3, a0, t2
85 fstx.s f2, a0, t3
86endfunc
87
88/*
89 * #define FUNC2(a, b, c) FUNC3(a, b, c)
90 * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
91 * void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride)
92 */
93function ff_h264_idct8_add_8_lsx
94 ld.h t0, a1, 0
95 add.d t2, a2, a2
96 add.d t3, t2, a2
97 add.d t4, t3, a2
98 add.d t5, t4, a2
99 add.d t6, t5, a2
100 add.d t7, t6, a2
101 addi.w t0, t0, 32
102 st.h t0, a1, 0
103
104 vld vr0, a1, 0
105 vld vr1, a1, 16
106 vld vr2, a1, 32
107 vld vr3, a1, 48
108 vld vr4, a1, 64
109 vld vr5, a1, 80
110 vld vr6, a1, 96
111 vld vr7, a1, 112
112 vxor.v vr8, vr8, vr8
113 vst vr8, a1, 0
114 vst vr8, a1, 16
115 vst vr8, a1, 32
116 vst vr8, a1, 48
117 vst vr8, a1, 64
118 vst vr8, a1, 80
119 vst vr8, a1, 96
120 vst vr8, a1, 112
121
122 vadd.h vr18, vr0, vr4
123 vsub.h vr19, vr0, vr4
124 vsrai.h vr20, vr2, 1
125 vsrai.h vr21, vr6, 1
126 vsub.h vr20, vr20, vr6
127 vadd.h vr21, vr21, vr2
128 LSX_BUTTERFLY_4_H vr18, vr19, vr20, vr21, vr10, vr12, vr14, vr16
129 vsrai.h vr11, vr7, 1
130 vsrai.h vr13, vr3, 1
131 vsrai.h vr15, vr5, 1
132 vsrai.h vr17, vr1, 1
133 vsub.h vr11, vr5, vr11
134 vsub.h vr13, vr7, vr13
135 vadd.h vr15, vr7, vr15
136 vadd.h vr17, vr5, vr17
137 vsub.h vr11, vr11, vr7
138 vsub.h vr13, vr13, vr3
139 vadd.h vr15, vr15, vr5
140 vadd.h vr17, vr17, vr1
141 vsub.h vr11, vr11, vr3
142 vadd.h vr13, vr13, vr1
143 vsub.h vr15, vr15, vr1
144 vadd.h vr17, vr17, vr3
145 vsrai.h vr18, vr11, 2
146 vsrai.h vr19, vr13, 2
147 vsrai.h vr20, vr15, 2
148 vsrai.h vr21, vr17, 2
149 vadd.h vr11, vr11, vr21
150 vadd.h vr13, vr13, vr20
151 vsub.h vr15, vr19, vr15
152 vsub.h vr17, vr17, vr18
153 LSX_BUTTERFLY_8_H vr10, vr16, vr12, vr14, vr13, vr15, vr11, vr17, \
154 vr0, vr3, vr1, vr2, vr5, vr6, vr4, vr7
155
156 LSX_TRANSPOSE8x8_H vr0, vr1, vr2, vr3, vr4, vr5, vr6, vr7, \
157 vr0, vr1, vr2, vr3, vr4, vr5, vr6, vr7, \
158 vr10, vr11, vr12, vr13, vr14, vr15, vr16, vr17
159 vexth.w.h vr20, vr0
160 vexth.w.h vr21, vr1
161 vexth.w.h vr22, vr2
162 vexth.w.h vr23, vr3
163 vexth.w.h vr8, vr4
164 vexth.w.h vr9, vr5
165 vexth.w.h vr18, vr6
166 vexth.w.h vr19, vr7
167 vsllwil.w.h vr0, vr0, 0
168 vsllwil.w.h vr1, vr1, 0
169 vsllwil.w.h vr2, vr2, 0
170 vsllwil.w.h vr3, vr3, 0
171 vsllwil.w.h vr4, vr4, 0
172 vsllwil.w.h vr5, vr5, 0
173 vsllwil.w.h vr6, vr6, 0
174 vsllwil.w.h vr7, vr7, 0
175
176 vadd.w vr11, vr0, vr4
177 vsub.w vr13, vr0, vr4
178 vsrai.w vr15, vr2, 1
179 vsrai.w vr17, vr6, 1
180 vsub.w vr15, vr15, vr6
181 vadd.w vr17, vr17, vr2
182 LSX_BUTTERFLY_4_W vr11, vr13, vr15, vr17, vr10, vr12, vr14, vr16
183 vsrai.w vr11, vr7, 1
184 vsrai.w vr13, vr3, 1
185 vsrai.w vr15, vr5, 1
186 vsrai.w vr17, vr1, 1
187 vsub.w vr11, vr5, vr11
188 vsub.w vr13, vr7, vr13
189 vadd.w vr15, vr7, vr15
190 vadd.w vr17, vr5, vr17
191 vsub.w vr11, vr11, vr7
192 vsub.w vr13, vr13, vr3
193 vadd.w vr15, vr15, vr5
194 vadd.w vr17, vr17, vr1
195 vsub.w vr11, vr11, vr3
196 vadd.w vr13, vr13, vr1
197 vsub.w vr15, vr15, vr1
198 vadd.w vr17, vr17, vr3
199 vsrai.w vr0, vr11, 2
200 vsrai.w vr1, vr13, 2
201 vsrai.w vr2, vr15, 2
202 vsrai.w vr3, vr17, 2
203 vadd.w vr11, vr11, vr3
204 vadd.w vr13, vr13, vr2
205 vsub.w vr15, vr1, vr15
206 vsub.w vr17, vr17, vr0
207 LSX_BUTTERFLY_8_W vr10, vr12, vr14, vr16, vr11, vr13, vr15, vr17, \
208 vr0, vr1, vr2, vr3, vr4, vr5, vr6, vr7
209
210 vadd.w vr11, vr20, vr8
211 vsub.w vr13, vr20, vr8
212 vsrai.w vr15, vr22, 1
213 vsrai.w vr17, vr18, 1
214 vsub.w vr15, vr15, vr18
215 vadd.w vr17, vr17, vr22
216 LSX_BUTTERFLY_4_W vr11, vr13, vr15, vr17, vr10, vr12, vr14, vr16
217 vsrai.w vr11, vr19, 1
218 vsrai.w vr13, vr23, 1
219 vsrai.w vr15, vr9, 1
220 vsrai.w vr17, vr21, 1
221 vsub.w vr11, vr9, vr11
222 vsub.w vr13, vr19, vr13
223 vadd.w vr15, vr19, vr15
224 vadd.w vr17, vr9, vr17
225 vsub.w vr11, vr11, vr19
226 vsub.w vr13, vr13, vr23
227 vadd.w vr15, vr15, vr9
228 vadd.w vr17, vr17, vr21
229 vsub.w vr11, vr11, vr23
230 vadd.w vr13, vr13, vr21
231 vsub.w vr15, vr15, vr21
232 vadd.w vr17, vr17, vr23
233 vsrai.w vr20, vr11, 2
234 vsrai.w vr21, vr13, 2
235 vsrai.w vr22, vr15, 2
236 vsrai.w vr23, vr17, 2
237 vadd.w vr11, vr11, vr23
238 vadd.w vr13, vr13, vr22
239 vsub.w vr15, vr21, vr15
240 vsub.w vr17, vr17, vr20
241 LSX_BUTTERFLY_8_W vr10, vr12, vr14, vr16, vr11, vr13, vr15, vr17, \
242 vr20, vr21, vr22, vr23, vr8, vr9, vr18, vr19
243
244 vld vr10, a0, 0
245 vldx vr11, a0, a2
246 vldx vr12, a0, t2
247 vldx vr13, a0, t3
248 vldx vr14, a0, t4
249 vldx vr15, a0, t5
250 vldx vr16, a0, t6
251 vldx vr17, a0, t7
252 vsrani.h.w vr20, vr0, 6
253 vsrani.h.w vr21, vr1, 6
254 vsrani.h.w vr22, vr2, 6
255 vsrani.h.w vr23, vr3, 6
256 vsrani.h.w vr8, vr4, 6
257 vsrani.h.w vr9, vr5, 6
258 vsrani.h.w vr18, vr6, 6
259 vsrani.h.w vr19, vr7, 6
260 vsllwil.hu.bu vr10, vr10, 0
261 vsllwil.hu.bu vr11, vr11, 0
262 vsllwil.hu.bu vr12, vr12, 0
263 vsllwil.hu.bu vr13, vr13, 0
264 vsllwil.hu.bu vr14, vr14, 0
265 vsllwil.hu.bu vr15, vr15, 0
266 vsllwil.hu.bu vr16, vr16, 0
267 vsllwil.hu.bu vr17, vr17, 0
268
269 vadd.h vr0, vr20, vr10
270 vadd.h vr1, vr21, vr11
271 vadd.h vr2, vr22, vr12
272 vadd.h vr3, vr23, vr13
273 vadd.h vr4, vr8, vr14
274 vadd.h vr5, vr9, vr15
275 vadd.h vr6, vr18, vr16
276 vadd.h vr7, vr19, vr17
277 vssrarni.bu.h vr1, vr0, 0
278 vssrarni.bu.h vr3, vr2, 0
279 vssrarni.bu.h vr5, vr4, 0
280 vssrarni.bu.h vr7, vr6, 0
281 vbsrl.v vr0, vr1, 8
282 vbsrl.v vr2, vr3, 8
283 vbsrl.v vr4, vr5, 8
284 vbsrl.v vr6, vr7, 8
285 fst.d f1, a0, 0
286 fstx.d f0, a0, a2
287 fstx.d f3, a0, t2
288 fstx.d f2, a0, t3
289 fstx.d f5, a0, t4
290 fstx.d f4, a0, t5
291 fstx.d f7, a0, t6
292 fstx.d f6, a0, t7
293endfunc
294
295/*
296 * #define FUNC2(a, b, c) FUNC3(a, b, c)
297 * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
298 * void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride)
299 */
300function ff_h264_idct8_add_8_lasx
301 ld.h t0, a1, 0
302 add.d t2, a2, a2
303 add.d t3, t2, a2
304 add.d t4, t3, a2
305 add.d t5, t4, a2
306 add.d t6, t5, a2
307 add.d t7, t6, a2
308 addi.w t0, t0, 32
309 st.h t0, a1, 0
310
311 vld vr0, a1, 0
312 vld vr1, a1, 16
313 vld vr2, a1, 32
314 vld vr3, a1, 48
315 vld vr4, a1, 64
316 vld vr5, a1, 80
317 vld vr6, a1, 96
318 vld vr7, a1, 112
319 xvxor.v xr8, xr8, xr8
320 xvst xr8, a1, 0
321 xvst xr8, a1, 32
322 xvst xr8, a1, 64
323 xvst xr8, a1, 96
324
325 vadd.h vr18, vr0, vr4
326 vsub.h vr19, vr0, vr4
327 vsrai.h vr20, vr2, 1
328 vsrai.h vr21, vr6, 1
329 vsub.h vr20, vr20, vr6
330 vadd.h vr21, vr21, vr2
331 LSX_BUTTERFLY_4_H vr18, vr19, vr20, vr21, vr10, vr12, vr14, vr16
332 vsrai.h vr11, vr7, 1
333 vsrai.h vr13, vr3, 1
334 vsrai.h vr15, vr5, 1
335 vsrai.h vr17, vr1, 1
336 vsub.h vr11, vr5, vr11
337 vsub.h vr13, vr7, vr13
338 vadd.h vr15, vr7, vr15
339 vadd.h vr17, vr5, vr17
340 vsub.h vr11, vr11, vr7
341 vsub.h vr13, vr13, vr3
342 vadd.h vr15, vr15, vr5
343 vadd.h vr17, vr17, vr1
344 vsub.h vr11, vr11, vr3
345 vadd.h vr13, vr13, vr1
346 vsub.h vr15, vr15, vr1
347 vadd.h vr17, vr17, vr3
348 vsrai.h vr18, vr11, 2
349 vsrai.h vr19, vr13, 2
350 vsrai.h vr20, vr15, 2
351 vsrai.h vr21, vr17, 2
352 vadd.h vr11, vr11, vr21
353 vadd.h vr13, vr13, vr20
354 vsub.h vr15, vr19, vr15
355 vsub.h vr17, vr17, vr18
356 LSX_BUTTERFLY_8_H vr10, vr16, vr12, vr14, vr13, vr15, vr11, vr17, \
357 vr0, vr3, vr1, vr2, vr5, vr6, vr4, vr7
358
359 LSX_TRANSPOSE8x8_H vr0, vr1, vr2, vr3, vr4, vr5, vr6, vr7, \
360 vr0, vr1, vr2, vr3, vr4, vr5, vr6, vr7, \
361 vr10, vr11, vr12, vr13, vr14, vr15, vr16, vr17
362 vext2xv.w.h xr0, xr0
363 vext2xv.w.h xr1, xr1
364 vext2xv.w.h xr2, xr2
365 vext2xv.w.h xr3, xr3
366 vext2xv.w.h xr4, xr4
367 vext2xv.w.h xr5, xr5
368 vext2xv.w.h xr6, xr6
369 vext2xv.w.h xr7, xr7
370
371 xvadd.w xr11, xr0, xr4
372 xvsub.w xr13, xr0, xr4
373 xvsrai.w xr15, xr2, 1
374 xvsrai.w xr17, xr6, 1
375 xvsub.w xr15, xr15, xr6
376 xvadd.w xr17, xr17, xr2
377 LASX_BUTTERFLY_4_W xr11, xr13, xr15, xr17, xr10, xr12, xr14, xr16
378 xvsrai.w xr11, xr7, 1
379 xvsrai.w xr13, xr3, 1
380 xvsrai.w xr15, xr5, 1
381 xvsrai.w xr17, xr1, 1
382 xvsub.w xr11, xr5, xr11
383 xvsub.w xr13, xr7, xr13
384 xvadd.w xr15, xr7, xr15
385 xvadd.w xr17, xr5, xr17
386 xvsub.w xr11, xr11, xr7
387 xvsub.w xr13, xr13, xr3
388 xvadd.w xr15, xr15, xr5
389 xvadd.w xr17, xr17, xr1
390 xvsub.w xr11, xr11, xr3
391 xvadd.w xr13, xr13, xr1
392 xvsub.w xr15, xr15, xr1
393 xvadd.w xr17, xr17, xr3
394 xvsrai.w xr0, xr11, 2
395 xvsrai.w xr1, xr13, 2
396 xvsrai.w xr2, xr15, 2
397 xvsrai.w xr3, xr17, 2
398 xvadd.w xr11, xr11, xr3
399 xvadd.w xr13, xr13, xr2
400 xvsub.w xr15, xr1, xr15
401 xvsub.w xr17, xr17, xr0
402 LASX_BUTTERFLY_8_W xr10, xr12, xr14, xr16, xr11, xr13, xr15, xr17, \
403 xr0, xr1, xr2, xr3, xr4, xr5, xr6, xr7
404
405 vld vr10, a0, 0
406 vldx vr11, a0, a2
407 vldx vr12, a0, t2
408 vldx vr13, a0, t3
409 vldx vr14, a0, t4
410 vldx vr15, a0, t5
411 vldx vr16, a0, t6
412 vldx vr17, a0, t7
413 xvldi xr8, 0x806 //"xvldi.w xr8 6"
414 xvsran.h.w xr0, xr0, xr8
415 xvsran.h.w xr1, xr1, xr8
416 xvsran.h.w xr2, xr2, xr8
417 xvsran.h.w xr3, xr3, xr8
418 xvsran.h.w xr4, xr4, xr8
419 xvsran.h.w xr5, xr5, xr8
420 xvsran.h.w xr6, xr6, xr8
421 xvsran.h.w xr7, xr7, xr8
422 xvpermi.d xr0, xr0, 0x08
423 xvpermi.d xr1, xr1, 0x08
424 xvpermi.d xr2, xr2, 0x08
425 xvpermi.d xr3, xr3, 0x08
426 xvpermi.d xr4, xr4, 0x08
427 xvpermi.d xr5, xr5, 0x08
428 xvpermi.d xr6, xr6, 0x08
429 xvpermi.d xr7, xr7, 0x08
430
431 vsllwil.hu.bu vr10, vr10, 0
432 vsllwil.hu.bu vr11, vr11, 0
433 vsllwil.hu.bu vr12, vr12, 0
434 vsllwil.hu.bu vr13, vr13, 0
435 vsllwil.hu.bu vr14, vr14, 0
436 vsllwil.hu.bu vr15, vr15, 0
437 vsllwil.hu.bu vr16, vr16, 0
438 vsllwil.hu.bu vr17, vr17, 0
439
440 vadd.h vr0, vr0, vr10
441 vadd.h vr1, vr1, vr11
442 vadd.h vr2, vr2, vr12
443 vadd.h vr3, vr3, vr13
444 vadd.h vr4, vr4, vr14
445 vadd.h vr5, vr5, vr15
446 vadd.h vr6, vr6, vr16
447 vadd.h vr7, vr7, vr17
448 vssrarni.bu.h vr1, vr0, 0
449 vssrarni.bu.h vr3, vr2, 0
450 vssrarni.bu.h vr5, vr4, 0
451 vssrarni.bu.h vr7, vr6, 0
452 vbsrl.v vr0, vr1, 8
453 vbsrl.v vr2, vr3, 8
454 vbsrl.v vr4, vr5, 8
455 vbsrl.v vr6, vr7, 8
456 fst.d f1, a0, 0
457 fstx.d f0, a0, a2
458 fstx.d f3, a0, t2
459 fstx.d f2, a0, t3
460 fstx.d f5, a0, t4
461 fstx.d f4, a0, t5
462 fstx.d f7, a0, t6
463 fstx.d f6, a0, t7
464endfunc
465
466/*
467 * #define FUNC2(a, b, c) FUNC3(a, b, c)
468 * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
469 * void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *_block, int stride)
470 * LSX optimization is enough for this function.
471 */
472function ff_h264_idct_dc_add_8_lsx
473 vldrepl.h vr4, a1, 0
474 add.d t2, a2, a2
475 add.d t3, t2, a2
476 fld.s f0, a0, 0
477 fldx.s f1, a0, a2
478 fldx.s f2, a0, t2
479 fldx.s f3, a0, t3
480 st.h zero, a1, 0
481
482 vsrari.h vr4, vr4, 6
483 vilvl.w vr0, vr1, vr0
484 vilvl.w vr1, vr3, vr2
485 vsllwil.hu.bu vr0, vr0, 0
486 vsllwil.hu.bu vr1, vr1, 0
487 vadd.h vr0, vr0, vr4
488 vadd.h vr1, vr1, vr4
489 vssrarni.bu.h vr1, vr0, 0
490
491 vbsrl.v vr2, vr1, 4
492 vbsrl.v vr3, vr1, 8
493 vbsrl.v vr4, vr1, 12
494 fst.s f1, a0, 0
495 fstx.s f2, a0, a2
496 fstx.s f3, a0, t2
497 fstx.s f4, a0, t3
498endfunc
499
500/*
501 * #define FUNC2(a, b, c) FUNC3(a, b, c)
502 * #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)
503 * void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block, int stride)
504 */
505function ff_h264_idct8_dc_add_8_lsx
506 vldrepl.h vr8, a1, 0
507 add.d t2, a2, a2
508 add.d t3, t2, a2
509 add.d t4, t3, a2
510 add.d t5, t4, a2
511 add.d t6, t5, a2
512 add.d t7, t6, a2
513
514 fld.d f0, a0, 0
515 fldx.d f1, a0, a2
516 fldx.d f2, a0, t2
517 fldx.d f3, a0, t3
518 fldx.d f4, a0, t4
519 fldx.d f5, a0, t5
520 fldx.d f6, a0, t6
521 fldx.d f7, a0, t7
522 st.h zero, a1, 0
523
524 vsrari.h vr8, vr8, 6
525 vsllwil.hu.bu vr0, vr0, 0
526 vsllwil.hu.bu vr1, vr1, 0
527 vsllwil.hu.bu vr2, vr2, 0
528 vsllwil.hu.bu vr3, vr3, 0
529 vsllwil.hu.bu vr4, vr4, 0
530 vsllwil.hu.bu vr5, vr5, 0
531 vsllwil.hu.bu vr6, vr6, 0
532 vsllwil.hu.bu vr7, vr7, 0
533 vadd.h vr0, vr0, vr8
534 vadd.h vr1, vr1, vr8
535 vadd.h vr2, vr2, vr8
536 vadd.h vr3, vr3, vr8
537 vadd.h vr4, vr4, vr8
538 vadd.h vr5, vr5, vr8
539 vadd.h vr6, vr6, vr8
540 vadd.h vr7, vr7, vr8
541 vssrarni.bu.h vr1, vr0, 0
542 vssrarni.bu.h vr3, vr2, 0
543 vssrarni.bu.h vr5, vr4, 0
544 vssrarni.bu.h vr7, vr6, 0
545
546 vbsrl.v vr0, vr1, 8
547 vbsrl.v vr2, vr3, 8
548 vbsrl.v vr4, vr5, 8
549 vbsrl.v vr6, vr7, 8
550 fst.d f1, a0, 0
551 fstx.d f0, a0, a2
552 fstx.d f3, a0, t2
553 fstx.d f2, a0, t3
554 fstx.d f5, a0, t4
555 fstx.d f4, a0, t5
556 fstx.d f7, a0, t6
557 fstx.d f6, a0, t7
558endfunc
559function ff_h264_idct8_dc_add_8_lasx
560 xvldrepl.h xr8, a1, 0
561 add.d t2, a2, a2
562 add.d t3, t2, a2
563 add.d t4, t3, a2
564 add.d t5, t4, a2
565 add.d t6, t5, a2
566 add.d t7, t6, a2
567
568 fld.d f0, a0, 0
569 fldx.d f1, a0, a2
570 fldx.d f2, a0, t2
571 fldx.d f3, a0, t3
572 fldx.d f4, a0, t4
573 fldx.d f5, a0, t5
574 fldx.d f6, a0, t6
575 fldx.d f7, a0, t7
576 st.h zero, a1, 0
577
578 xvsrari.h xr8, xr8, 6
579 xvpermi.q xr1, xr0, 0x20
580 xvpermi.q xr3, xr2, 0x20
581 xvpermi.q xr5, xr4, 0x20
582 xvpermi.q xr7, xr6, 0x20
583 xvsllwil.hu.bu xr1, xr1, 0
584 xvsllwil.hu.bu xr3, xr3, 0
585 xvsllwil.hu.bu xr5, xr5, 0
586 xvsllwil.hu.bu xr7, xr7, 0
587 xvadd.h xr1, xr1, xr8
588 xvadd.h xr3, xr3, xr8
589 xvadd.h xr5, xr5, xr8
590 xvadd.h xr7, xr7, xr8
591
592 xvssrarni.bu.h xr3, xr1, 0
593 xvssrarni.bu.h xr7, xr5, 0
594
595 xvpermi.q xr1, xr3, 0x11
596 xvpermi.q xr5, xr7, 0x11
597 xvbsrl.v xr0, xr1, 8
598 xvbsrl.v xr2, xr3, 8
599 xvbsrl.v xr4, xr5, 8
600 xvbsrl.v xr6, xr7, 8
601
602 fst.d f3, a0, 0
603 fstx.d f1, a0, a2
604 fstx.d f2, a0, t2
605 fstx.d f0, a0, t3
606 fstx.d f7, a0, t4
607 fstx.d f5, a0, t5
608 fstx.d f6, a0, t6
609 fstx.d f4, a0, t7
610endfunc
611
612/**
613 * IDCT transforms the 16 dc values and dequantizes them.
614 * @param qmul quantization parameter
615 * void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int qmul){
616 * LSX optimization is enough for this function.
617 */
618function ff_h264_luma_dc_dequant_idct_8_lsx
619 vld vr0, a1, 0
620 vld vr1, a1, 8
621 vld vr2, a1, 16
622 vld vr3, a1, 24
623 vreplgr2vr.w vr8, a2
624 LSX_TRANSPOSE4x4_H vr0, vr1, vr2, vr3, vr4, vr5, vr6, vr7, vr9, vr10
625 LSX_BUTTERFLY_4_H vr4, vr6, vr7, vr5, vr0, vr3, vr2, vr1
626 LSX_BUTTERFLY_4_H vr0, vr1, vr2, vr3, vr4, vr7, vr6, vr5
627 LSX_TRANSPOSE4x4_H vr4, vr5, vr6, vr7, vr0, vr1, vr2, vr3, vr9, vr10
628 LSX_BUTTERFLY_4_H vr0, vr1, vr3, vr2, vr4, vr7, vr6, vr5
629 LSX_BUTTERFLY_4_H vr4, vr5, vr6, vr7, vr0, vr1, vr2, vr3
630 vsllwil.w.h vr0, vr0, 0
631 vsllwil.w.h vr1, vr1, 0
632 vsllwil.w.h vr2, vr2, 0
633 vsllwil.w.h vr3, vr3, 0
634 vmul.w vr0, vr0, vr8
635 vmul.w vr1, vr1, vr8
636 vmul.w vr2, vr2, vr8
637 vmul.w vr3, vr3, vr8
638 vsrarni.h.w vr1, vr0, 8
639 vsrarni.h.w vr3, vr2, 8
640
641 vstelm.h vr1, a0, 0, 0
642 vstelm.h vr1, a0, 32, 4
643 vstelm.h vr1, a0, 64, 1
644 vstelm.h vr1, a0, 96, 5
645 vstelm.h vr3, a0, 128, 0
646 vstelm.h vr3, a0, 160, 4
647 vstelm.h vr3, a0, 192, 1
648 vstelm.h vr3, a0, 224, 5
649 addi.d a0, a0, 256
650 vstelm.h vr1, a0, 0, 2
651 vstelm.h vr1, a0, 32, 6
652 vstelm.h vr1, a0, 64, 3
653 vstelm.h vr1, a0, 96, 7
654 vstelm.h vr3, a0, 128, 2
655 vstelm.h vr3, a0, 160, 6
656 vstelm.h vr3, a0, 192, 3
657 vstelm.h vr3, a0, 224, 7
658endfunc
libavcodec/loongarch/h264idct_lasx.c+0−498
@@ -1,498 +0,0 @@
1/*
2 * Loongson LASX optimized h264dsp
3 *
4 * Copyright (c) 2021 Loongson Technology Corporation Limited
5 * Contributed by Shiyou Yin <yinshiyou-hf@loongson.cn>
6 * Xiwei Gu <guxiwei-hf@loongson.cn>
7 *
8 * This file is part of FFmpeg.
9 *
10 * FFmpeg is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * FFmpeg is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with FFmpeg; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#include "libavutil/loongarch/loongson_intrinsics.h"
26#include "h264dsp_lasx.h"
27#include "libavcodec/bit_depth_template.c"
28
29#define AVC_ITRANS_H(in0, in1, in2, in3, out0, out1, out2, out3) \
30{ \
31 __m256i tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
32 \
33 tmp0_m = __lasx_xvadd_h(in0, in2); \
34 tmp1_m = __lasx_xvsub_h(in0, in2); \
35 tmp2_m = __lasx_xvsrai_h(in1, 1); \
36 tmp2_m = __lasx_xvsub_h(tmp2_m, in3); \
37 tmp3_m = __lasx_xvsrai_h(in3, 1); \
38 tmp3_m = __lasx_xvadd_h(in1, tmp3_m); \
39 \
40 LASX_BUTTERFLY_4_H(tmp0_m, tmp1_m, tmp2_m, tmp3_m, \
41 out0, out1, out2, out3); \
42}
43
44void ff_h264_idct_add_lasx(uint8_t *dst, int16_t *src, int32_t dst_stride)
45{
46 __m256i src0_m, src1_m, src2_m, src3_m;
47 __m256i dst0_m, dst1_m;
48 __m256i hres0, hres1, hres2, hres3, vres0, vres1, vres2, vres3;
49 __m256i inp0_m, inp1_m, res0_m, src1, src3;
50 __m256i src0 = __lasx_xvld(src, 0);
51 __m256i src2 = __lasx_xvld(src, 16);
52 __m256i zero = __lasx_xvldi(0);
53 int32_t dst_stride_2x = dst_stride << 1;
54 int32_t dst_stride_3x = dst_stride_2x + dst_stride;
55
56 __lasx_xvst(zero, src, 0);
57 DUP2_ARG2(__lasx_xvilvh_d, src0, src0, src2, src2, src1, src3);
58 AVC_ITRANS_H(src0, src1, src2, src3, hres0, hres1, hres2, hres3);
59 LASX_TRANSPOSE4x4_H(hres0, hres1, hres2, hres3, hres0, hres1, hres2, hres3);
60 AVC_ITRANS_H(hres0, hres1, hres2, hres3, vres0, vres1, vres2, vres3);
61 DUP4_ARG2(__lasx_xvldx, dst, 0, dst, dst_stride, dst, dst_stride_2x,
62 dst, dst_stride_3x, src0_m, src1_m, src2_m, src3_m);
63 DUP4_ARG2(__lasx_xvld, dst, 0, dst + dst_stride, 0, dst + dst_stride_2x,
64 0, dst + dst_stride_3x, 0, src0_m, src1_m, src2_m, src3_m);
65 DUP2_ARG2(__lasx_xvilvl_d, vres1, vres0, vres3, vres2, inp0_m, inp1_m);
66 inp0_m = __lasx_xvpermi_q(inp1_m, inp0_m, 0x20);
67 inp0_m = __lasx_xvsrari_h(inp0_m, 6);
68 DUP2_ARG2(__lasx_xvilvl_w, src1_m, src0_m, src3_m, src2_m, dst0_m, dst1_m);
69 dst0_m = __lasx_xvilvl_d(dst1_m, dst0_m);
70 res0_m = __lasx_vext2xv_hu_bu(dst0_m);
71 res0_m = __lasx_xvadd_h(res0_m, inp0_m);
72 res0_m = __lasx_xvclip255_h(res0_m);
73 dst0_m = __lasx_xvpickev_b(res0_m, res0_m);
74 __lasx_xvstelm_w(dst0_m, dst, 0, 0);
75 __lasx_xvstelm_w(dst0_m, dst + dst_stride, 0, 1);
76 __lasx_xvstelm_w(dst0_m, dst + dst_stride_2x, 0, 4);
77 __lasx_xvstelm_w(dst0_m, dst + dst_stride_3x, 0, 5);
78}
79
80void ff_h264_idct8_addblk_lasx(uint8_t *dst, int16_t *src,
81 int32_t dst_stride)
82{
83 __m256i src0, src1, src2, src3, src4, src5, src6, src7;
84 __m256i vec0, vec1, vec2, vec3;
85 __m256i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
86 __m256i res0, res1, res2, res3, res4, res5, res6, res7;
87 __m256i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
88 __m256i zero = __lasx_xvldi(0);
89 int32_t dst_stride_2x = dst_stride << 1;
90 int32_t dst_stride_4x = dst_stride << 2;
91 int32_t dst_stride_3x = dst_stride_2x + dst_stride;
92
93 src[0] += 32;
94 DUP4_ARG2(__lasx_xvld, src, 0, src, 16, src, 32, src, 48,
95 src0, src1, src2, src3);
96 DUP4_ARG2(__lasx_xvld, src, 64, src, 80, src, 96, src, 112,
97 src4, src5, src6, src7);
98 __lasx_xvst(zero, src, 0);
99 __lasx_xvst(zero, src, 32);
100 __lasx_xvst(zero, src, 64);
101 __lasx_xvst(zero, src, 96);
102
103 vec0 = __lasx_xvadd_h(src0, src4);
104 vec1 = __lasx_xvsub_h(src0, src4);
105 vec2 = __lasx_xvsrai_h(src2, 1);
106 vec2 = __lasx_xvsub_h(vec2, src6);
107 vec3 = __lasx_xvsrai_h(src6, 1);
108 vec3 = __lasx_xvadd_h(src2, vec3);
109
110 LASX_BUTTERFLY_4_H(vec0, vec1, vec2, vec3, tmp0, tmp1, tmp2, tmp3);
111
112 vec0 = __lasx_xvsrai_h(src7, 1);
113 vec0 = __lasx_xvsub_h(src5, vec0);
114 vec0 = __lasx_xvsub_h(vec0, src3);
115 vec0 = __lasx_xvsub_h(vec0, src7);
116
117 vec1 = __lasx_xvsrai_h(src3, 1);
118 vec1 = __lasx_xvsub_h(src1, vec1);
119 vec1 = __lasx_xvadd_h(vec1, src7);
120 vec1 = __lasx_xvsub_h(vec1, src3);
121
122 vec2 = __lasx_xvsrai_h(src5, 1);
123 vec2 = __lasx_xvsub_h(vec2, src1);
124 vec2 = __lasx_xvadd_h(vec2, src7);
125 vec2 = __lasx_xvadd_h(vec2, src5);
126
127 vec3 = __lasx_xvsrai_h(src1, 1);
128 vec3 = __lasx_xvadd_h(src3, vec3);
129 vec3 = __lasx_xvadd_h(vec3, src5);
130 vec3 = __lasx_xvadd_h(vec3, src1);
131
132 tmp4 = __lasx_xvsrai_h(vec3, 2);
133 tmp4 = __lasx_xvadd_h(tmp4, vec0);
134 tmp5 = __lasx_xvsrai_h(vec2, 2);
135 tmp5 = __lasx_xvadd_h(tmp5, vec1);
136 tmp6 = __lasx_xvsrai_h(vec1, 2);
137 tmp6 = __lasx_xvsub_h(tmp6, vec2);
138 tmp7 = __lasx_xvsrai_h(vec0, 2);
139 tmp7 = __lasx_xvsub_h(vec3, tmp7);
140
141 LASX_BUTTERFLY_8_H(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7,
142 res0, res1, res2, res3, res4, res5, res6, res7);
143 LASX_TRANSPOSE8x8_H(res0, res1, res2, res3, res4, res5, res6, res7,
144 res0, res1, res2, res3, res4, res5, res6, res7);
145
146 DUP4_ARG1(__lasx_vext2xv_w_h, res0, res1, res2, res3,
147 tmp0, tmp1, tmp2, tmp3);
148 DUP4_ARG1(__lasx_vext2xv_w_h, res4, res5, res6, res7,
149 tmp4, tmp5, tmp6, tmp7);
150 vec0 = __lasx_xvadd_w(tmp0, tmp4);
151 vec1 = __lasx_xvsub_w(tmp0, tmp4);
152
153 vec2 = __lasx_xvsrai_w(tmp2, 1);
154 vec2 = __lasx_xvsub_w(vec2, tmp6);
155 vec3 = __lasx_xvsrai_w(tmp6, 1);
156 vec3 = __lasx_xvadd_w(vec3, tmp2);
157
158 tmp0 = __lasx_xvadd_w(vec0, vec3);
159 tmp2 = __lasx_xvadd_w(vec1, vec2);
160 tmp4 = __lasx_xvsub_w(vec1, vec2);
161 tmp6 = __lasx_xvsub_w(vec0, vec3);
162
163 vec0 = __lasx_xvsrai_w(tmp7, 1);
164 vec0 = __lasx_xvsub_w(tmp5, vec0);
165 vec0 = __lasx_xvsub_w(vec0, tmp3);
166 vec0 = __lasx_xvsub_w(vec0, tmp7);
167
168 vec1 = __lasx_xvsrai_w(tmp3, 1);
169 vec1 = __lasx_xvsub_w(tmp1, vec1);
170 vec1 = __lasx_xvadd_w(vec1, tmp7);
171 vec1 = __lasx_xvsub_w(vec1, tmp3);
172
173 vec2 = __lasx_xvsrai_w(tmp5, 1);
174 vec2 = __lasx_xvsub_w(vec2, tmp1);
175 vec2 = __lasx_xvadd_w(vec2, tmp7);
176 vec2 = __lasx_xvadd_w(vec2, tmp5);
177
178 vec3 = __lasx_xvsrai_w(tmp1, 1);
179 vec3 = __lasx_xvadd_w(tmp3, vec3);
180 vec3 = __lasx_xvadd_w(vec3, tmp5);
181 vec3 = __lasx_xvadd_w(vec3, tmp1);
182
183 tmp1 = __lasx_xvsrai_w(vec3, 2);
184 tmp1 = __lasx_xvadd_w(tmp1, vec0);
185 tmp3 = __lasx_xvsrai_w(vec2, 2);
186 tmp3 = __lasx_xvadd_w(tmp3, vec1);
187 tmp5 = __lasx_xvsrai_w(vec1, 2);
188 tmp5 = __lasx_xvsub_w(tmp5, vec2);
189 tmp7 = __lasx_xvsrai_w(vec0, 2);
190 tmp7 = __lasx_xvsub_w(vec3, tmp7);
191
192 LASX_BUTTERFLY_4_W(tmp0, tmp2, tmp5, tmp7, res0, res1, res6, res7);
193 LASX_BUTTERFLY_4_W(tmp4, tmp6, tmp1, tmp3, res2, res3, res4, res5);
194
195 DUP4_ARG2(__lasx_xvsrai_w, res0, 6, res1, 6, res2, 6, res3, 6,
196 res0, res1, res2, res3);
197 DUP4_ARG2(__lasx_xvsrai_w, res4, 6, res5, 6, res6, 6, res7, 6,
198 res4, res5, res6, res7);
199 DUP4_ARG2(__lasx_xvpickev_h, res1, res0, res3, res2, res5, res4, res7,
200 res6, res0, res1, res2, res3);
201 DUP4_ARG2(__lasx_xvpermi_d, res0, 0xd8, res1, 0xd8, res2, 0xd8, res3, 0xd8,
202 res0, res1, res2, res3);
203
204 DUP4_ARG2(__lasx_xvldx, dst, 0, dst, dst_stride, dst, dst_stride_2x,
205 dst, dst_stride_3x, dst0, dst1, dst2, dst3);
206 dst += dst_stride_4x;
207 DUP4_ARG2(__lasx_xvldx, dst, 0, dst, dst_stride, dst, dst_stride_2x,
208 dst, dst_stride_3x, dst4, dst5, dst6, dst7);
209 dst -= dst_stride_4x;
210 DUP4_ARG2(__lasx_xvilvl_b, zero, dst0, zero, dst1, zero, dst2, zero, dst3,
211 dst0, dst1, dst2, dst3);
212 DUP4_ARG2(__lasx_xvilvl_b, zero, dst4, zero, dst5, zero, dst6, zero, dst7,
213 dst4, dst5, dst6, dst7);
214 DUP4_ARG3(__lasx_xvpermi_q, dst1, dst0, 0x20, dst3, dst2, 0x20, dst5,
215 dst4, 0x20, dst7, dst6, 0x20, dst0, dst1, dst2, dst3);
216 res0 = __lasx_xvadd_h(res0, dst0);
217 res1 = __lasx_xvadd_h(res1, dst1);
218 res2 = __lasx_xvadd_h(res2, dst2);
219 res3 = __lasx_xvadd_h(res3, dst3);
220 DUP4_ARG1(__lasx_xvclip255_h, res0, res1, res2, res3, res0, res1,
221 res2, res3);
222 DUP2_ARG2(__lasx_xvpickev_b, res1, res0, res3, res2, res0, res1);
223 __lasx_xvstelm_d(res0, dst, 0, 0);
224 __lasx_xvstelm_d(res0, dst + dst_stride, 0, 2);
225 __lasx_xvstelm_d(res0, dst + dst_stride_2x, 0, 1);
226 __lasx_xvstelm_d(res0, dst + dst_stride_3x, 0, 3);
227 dst += dst_stride_4x;
228 __lasx_xvstelm_d(res1, dst, 0, 0);
229 __lasx_xvstelm_d(res1, dst + dst_stride, 0, 2);
230 __lasx_xvstelm_d(res1, dst + dst_stride_2x, 0, 1);
231 __lasx_xvstelm_d(res1, dst + dst_stride_3x, 0, 3);
232}
233
234void ff_h264_idct4x4_addblk_dc_lasx(uint8_t *dst, int16_t *src,
235 int32_t dst_stride)
236{
237 const int16_t dc = (src[0] + 32) >> 6;
238 int32_t dst_stride_2x = dst_stride << 1;
239 int32_t dst_stride_3x = dst_stride_2x + dst_stride;
240 __m256i pred, out;
241 __m256i src0, src1, src2, src3;
242 __m256i input_dc = __lasx_xvreplgr2vr_h(dc);
243
244 src[0] = 0;
245 DUP4_ARG2(__lasx_xvldx, dst, 0, dst, dst_stride, dst, dst_stride_2x,
246 dst, dst_stride_3x, src0, src1, src2, src3);
247 DUP2_ARG2(__lasx_xvilvl_w, src1, src0, src3, src2, src0, src1);
248
249 pred = __lasx_xvpermi_q(src0, src1, 0x02);
250 pred = __lasx_xvaddw_h_h_bu(input_dc, pred);
251 pred = __lasx_xvclip255_h(pred);
252 out = __lasx_xvpickev_b(pred, pred);
253 __lasx_xvstelm_w(out, dst, 0, 0);
254 __lasx_xvstelm_w(out, dst + dst_stride, 0, 1);
255 __lasx_xvstelm_w(out, dst + dst_stride_2x, 0, 4);
256 __lasx_xvstelm_w(out, dst + dst_stride_3x, 0, 5);
257}
258
259void ff_h264_idct8_dc_addblk_lasx(uint8_t *dst, int16_t *src,
260 int32_t dst_stride)
261{
262 int32_t dc_val;
263 int32_t dst_stride_2x = dst_stride << 1;
264 int32_t dst_stride_4x = dst_stride << 2;
265 int32_t dst_stride_3x = dst_stride_2x + dst_stride;
266 __m256i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
267 __m256i dc;
268
269 dc_val = (src[0] + 32) >> 6;
270 dc = __lasx_xvreplgr2vr_h(dc_val);
271
272 src[0] = 0;
273
274 DUP4_ARG2(__lasx_xvldx, dst, 0, dst, dst_stride, dst, dst_stride_2x,
275 dst, dst_stride_3x, dst0, dst1, dst2, dst3);
276 dst += dst_stride_4x;
277 DUP4_ARG2(__lasx_xvldx, dst, 0, dst, dst_stride, dst, dst_stride_2x,
278 dst, dst_stride_3x, dst4, dst5, dst6, dst7);
279 dst -= dst_stride_4x;
280 DUP4_ARG1(__lasx_vext2xv_hu_bu, dst0, dst1, dst2, dst3,
281 dst0, dst1, dst2, dst3);
282 DUP4_ARG1(__lasx_vext2xv_hu_bu, dst4, dst5, dst6, dst7,
283 dst4, dst5, dst6, dst7);
284 DUP4_ARG3(__lasx_xvpermi_q, dst1, dst0, 0x20, dst3, dst2, 0x20, dst5,
285 dst4, 0x20, dst7, dst6, 0x20, dst0, dst1, dst2, dst3);
286 dst0 = __lasx_xvadd_h(dst0, dc);
287 dst1 = __lasx_xvadd_h(dst1, dc);
288 dst2 = __lasx_xvadd_h(dst2, dc);
289 dst3 = __lasx_xvadd_h(dst3, dc);
290 DUP4_ARG1(__lasx_xvclip255_h, dst0, dst1, dst2, dst3,
291 dst0, dst1, dst2, dst3);
292 DUP2_ARG2(__lasx_xvpickev_b, dst1, dst0, dst3, dst2, dst0, dst1);
293 __lasx_xvstelm_d(dst0, dst, 0, 0);
294 __lasx_xvstelm_d(dst0, dst + dst_stride, 0, 2);
295 __lasx_xvstelm_d(dst0, dst + dst_stride_2x, 0, 1);
296 __lasx_xvstelm_d(dst0, dst + dst_stride_3x, 0, 3);
297 dst += dst_stride_4x;
298 __lasx_xvstelm_d(dst1, dst, 0, 0);
299 __lasx_xvstelm_d(dst1, dst + dst_stride, 0, 2);
300 __lasx_xvstelm_d(dst1, dst + dst_stride_2x, 0, 1);
301 __lasx_xvstelm_d(dst1, dst + dst_stride_3x, 0, 3);
302}
303
304void ff_h264_idct_add16_lasx(uint8_t *dst,
305 const int32_t *blk_offset,
306 int16_t *block, int32_t dst_stride,
307 const uint8_t nzc[15 * 8])
308{
309 int32_t i;
310
311 for (i = 0; i < 16; i++) {
312 int32_t nnz = nzc[scan8[i]];
313
314 if (nnz) {
315 if (nnz == 1 && ((dctcoef *) block)[i * 16])
316 ff_h264_idct4x4_addblk_dc_lasx(dst + blk_offset[i],
317 block + i * 16 * sizeof(pixel),
318 dst_stride);
319 else
320 ff_h264_idct_add_lasx(dst + blk_offset[i],
321 block + i * 16 * sizeof(pixel),
322 dst_stride);
323 }
324 }
325}
326
327void ff_h264_idct8_add4_lasx(uint8_t *dst, const int32_t *blk_offset,
328 int16_t *block, int32_t dst_stride,
329 const uint8_t nzc[15 * 8])
330{
331 int32_t cnt;
332
333 for (cnt = 0; cnt < 16; cnt += 4) {
334 int32_t nnz = nzc[scan8[cnt]];
335
336 if (nnz) {
337 if (nnz == 1 && ((dctcoef *) block)[cnt * 16])
338 ff_h264_idct8_dc_addblk_lasx(dst + blk_offset[cnt],
339 block + cnt * 16 * sizeof(pixel),
340 dst_stride);
341 else
342 ff_h264_idct8_addblk_lasx(dst + blk_offset[cnt],
343 block + cnt * 16 * sizeof(pixel),
344 dst_stride);
345 }
346 }
347}
348
349
350void ff_h264_idct_add8_lasx(uint8_t **dst,
351 const int32_t *blk_offset,
352 int16_t *block, int32_t dst_stride,
353 const uint8_t nzc[15 * 8])
354{
355 int32_t i;
356
357 for (i = 16; i < 20; i++) {
358 if (nzc[scan8[i]])
359 ff_h264_idct_add_lasx(dst[0] + blk_offset[i],
360 block + i * 16 * sizeof(pixel),
361 dst_stride);
362 else if (((dctcoef *) block)[i * 16])
363 ff_h264_idct4x4_addblk_dc_lasx(dst[0] + blk_offset[i],
364 block + i * 16 * sizeof(pixel),
365 dst_stride);
366 }
367 for (i = 32; i < 36; i++) {
368 if (nzc[scan8[i]])
369 ff_h264_idct_add_lasx(dst[1] + blk_offset[i],
370 block + i * 16 * sizeof(pixel),
371 dst_stride);
372 else if (((dctcoef *) block)[i * 16])
373 ff_h264_idct4x4_addblk_dc_lasx(dst[1] + blk_offset[i],
374 block + i * 16 * sizeof(pixel),
375 dst_stride);
376 }
377}
378
379void ff_h264_idct_add8_422_lasx(uint8_t **dst,
380 const int32_t *blk_offset,
381 int16_t *block, int32_t dst_stride,
382 const uint8_t nzc[15 * 8])
383{
384 int32_t i;
385
386 for (i = 16; i < 20; i++) {
387 if (nzc[scan8[i]])
388 ff_h264_idct_add_lasx(dst[0] + blk_offset[i],
389 block + i * 16 * sizeof(pixel),
390 dst_stride);
391 else if (((dctcoef *) block)[i * 16])
392 ff_h264_idct4x4_addblk_dc_lasx(dst[0] + blk_offset[i],
393 block + i * 16 * sizeof(pixel),
394 dst_stride);
395 }
396 for (i = 32; i < 36; i++) {
397 if (nzc[scan8[i]])
398 ff_h264_idct_add_lasx(dst[1] + blk_offset[i],
399 block + i * 16 * sizeof(pixel),
400 dst_stride);
401 else if (((dctcoef *) block)[i * 16])
402 ff_h264_idct4x4_addblk_dc_lasx(dst[1] + blk_offset[i],
403 block + i * 16 * sizeof(pixel),
404 dst_stride);
405 }
406 for (i = 20; i < 24; i++) {
407 if (nzc[scan8[i + 4]])
408 ff_h264_idct_add_lasx(dst[0] + blk_offset[i + 4],
409 block + i * 16 * sizeof(pixel),
410 dst_stride);
411 else if (((dctcoef *) block)[i * 16])
412 ff_h264_idct4x4_addblk_dc_lasx(dst[0] + blk_offset[i + 4],
413 block + i * 16 * sizeof(pixel),
414 dst_stride);
415 }
416 for (i = 36; i < 40; i++) {
417 if (nzc[scan8[i + 4]])
418 ff_h264_idct_add_lasx(dst[1] + blk_offset[i + 4],
419 block + i * 16 * sizeof(pixel),
420 dst_stride);
421 else if (((dctcoef *) block)[i * 16])
422 ff_h264_idct4x4_addblk_dc_lasx(dst[1] + blk_offset[i + 4],
423 block + i * 16 * sizeof(pixel),
424 dst_stride);
425 }
426}
427
428void ff_h264_idct_add16_intra_lasx(uint8_t *dst,
429 const int32_t *blk_offset,
430 int16_t *block,
431 int32_t dst_stride,
432 const uint8_t nzc[15 * 8])
433{
434 int32_t i;
435
436 for (i = 0; i < 16; i++) {
437 if (nzc[scan8[i]])
438 ff_h264_idct_add_lasx(dst + blk_offset[i],
439 block + i * 16 * sizeof(pixel), dst_stride);
440 else if (((dctcoef *) block)[i * 16])
441 ff_h264_idct4x4_addblk_dc_lasx(dst + blk_offset[i],
442 block + i * 16 * sizeof(pixel),
443 dst_stride);
444 }
445}
446
447void ff_h264_deq_idct_luma_dc_lasx(int16_t *dst, int16_t *src,
448 int32_t de_qval)
449{
450#define DC_DEST_STRIDE 16
451
452 __m256i src0, src1, src2, src3;
453 __m256i vec0, vec1, vec2, vec3;
454 __m256i tmp0, tmp1, tmp2, tmp3;
455 __m256i hres0, hres1, hres2, hres3;
456 __m256i vres0, vres1, vres2, vres3;
457 __m256i de_q_vec = __lasx_xvreplgr2vr_w(de_qval);
458
459 DUP4_ARG2(__lasx_xvld, src, 0, src, 8, src, 16, src, 24,
460 src0, src1, src2, src3);
461 LASX_TRANSPOSE4x4_H(src0, src1, src2, src3, tmp0, tmp1, tmp2, tmp3);
462 LASX_BUTTERFLY_4_H(tmp0, tmp2, tmp3, tmp1, vec0, vec3, vec2, vec1);
463 LASX_BUTTERFLY_4_H(vec0, vec1, vec2, vec3, hres0, hres3, hres2, hres1);
464 LASX_TRANSPOSE4x4_H(hres0, hres1, hres2, hres3,
465 hres0, hres1, hres2, hres3);
466 LASX_BUTTERFLY_4_H(hres0, hres1, hres3, hres2, vec0, vec3, vec2, vec1);
467 LASX_BUTTERFLY_4_H(vec0, vec1, vec2, vec3, vres0, vres1, vres2, vres3);
468 DUP4_ARG1(__lasx_vext2xv_w_h, vres0, vres1, vres2, vres3,
469 vres0, vres1, vres2, vres3);
470 DUP2_ARG3(__lasx_xvpermi_q, vres1, vres0, 0x20, vres3, vres2, 0x20,
471 vres0, vres1);
472
473 vres0 = __lasx_xvmul_w(vres0, de_q_vec);
474 vres1 = __lasx_xvmul_w(vres1, de_q_vec);
475
476 vres0 = __lasx_xvsrari_w(vres0, 8);
477 vres1 = __lasx_xvsrari_w(vres1, 8);
478 vec0 = __lasx_xvpickev_h(vres1, vres0);
479 vec0 = __lasx_xvpermi_d(vec0, 0xd8);
480 __lasx_xvstelm_h(vec0, dst + 0 * DC_DEST_STRIDE, 0, 0);
481 __lasx_xvstelm_h(vec0, dst + 2 * DC_DEST_STRIDE, 0, 1);
482 __lasx_xvstelm_h(vec0, dst + 8 * DC_DEST_STRIDE, 0, 2);
483 __lasx_xvstelm_h(vec0, dst + 10 * DC_DEST_STRIDE, 0, 3);
484 __lasx_xvstelm_h(vec0, dst + 1 * DC_DEST_STRIDE, 0, 4);
485 __lasx_xvstelm_h(vec0, dst + 3 * DC_DEST_STRIDE, 0, 5);
486 __lasx_xvstelm_h(vec0, dst + 9 * DC_DEST_STRIDE, 0, 6);
487 __lasx_xvstelm_h(vec0, dst + 11 * DC_DEST_STRIDE, 0, 7);
488 __lasx_xvstelm_h(vec0, dst + 4 * DC_DEST_STRIDE, 0, 8);
489 __lasx_xvstelm_h(vec0, dst + 6 * DC_DEST_STRIDE, 0, 9);
490 __lasx_xvstelm_h(vec0, dst + 12 * DC_DEST_STRIDE, 0, 10);
491 __lasx_xvstelm_h(vec0, dst + 14 * DC_DEST_STRIDE, 0, 11);
492 __lasx_xvstelm_h(vec0, dst + 5 * DC_DEST_STRIDE, 0, 12);
493 __lasx_xvstelm_h(vec0, dst + 7 * DC_DEST_STRIDE, 0, 13);
494 __lasx_xvstelm_h(vec0, dst + 13 * DC_DEST_STRIDE, 0, 14);
495 __lasx_xvstelm_h(vec0, dst + 15 * DC_DEST_STRIDE, 0, 15);
496
497#undef DC_DEST_STRIDE
498}
libavcodec/loongarch/h264idct_loongarch.c+184−0
@@ -0,0 +1,184 @@
1/*
2 * Loongson LSX/LASX optimized h264idct
3 *
4 * Copyright (c) 2023 Loongson Technology Corporation Limited
5 * Contributed by Shiyou Yin <yinshiyou-hf@loongson.cn>
6 * Xiwei Gu <guxiwei-hf@loongson.cn>
7 *
8 * This file is part of FFmpeg.
9 *
10 * FFmpeg is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * FFmpeg is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with FFmpeg; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#include "h264dsp_loongarch.h"
26#include "libavcodec/bit_depth_template.c"
27
28void ff_h264_idct_add16_8_lsx(uint8_t *dst, const int32_t *blk_offset,
29 int16_t *block, int32_t dst_stride,
30 const uint8_t nzc[15 * 8])
31{
32 int32_t i;
33
34 for (i = 0; i < 16; i++) {
35 int32_t nnz = nzc[scan8[i]];
36
37 if (nnz == 1 && ((dctcoef *) block)[i * 16]) {
38 ff_h264_idct_dc_add_8_lsx(dst + blk_offset[i],
39 block + i * 16 * sizeof(pixel),
40 dst_stride);
41 } else if (nnz) {
42 ff_h264_idct_add_8_lsx(dst + blk_offset[i],
43 block + i * 16 * sizeof(pixel),
44 dst_stride);
45 }
46 }
47}
48
49void ff_h264_idct8_add4_8_lsx(uint8_t *dst, const int32_t *blk_offset,
50 int16_t *block, int32_t dst_stride,
51 const uint8_t nzc[15 * 8])
52{
53 int32_t cnt;
54
55 for (cnt = 0; cnt < 16; cnt += 4) {
56 int32_t nnz = nzc[scan8[cnt]];
57
58 if (nnz == 1 && ((dctcoef *) block)[cnt * 16]) {
59 ff_h264_idct8_dc_add_8_lsx(dst + blk_offset[cnt],
60 block + cnt * 16 * sizeof(pixel),
61 dst_stride);
62 } else if (nnz) {
63 ff_h264_idct8_add_8_lsx(dst + blk_offset[cnt],
64 block + cnt * 16 * sizeof(pixel),
65 dst_stride);
66 }
67 }
68}
69
70#if HAVE_LASX
71void ff_h264_idct8_add4_8_lasx(uint8_t *dst, const int32_t *blk_offset,
72 int16_t *block, int32_t dst_stride,
73 const uint8_t nzc[15 * 8])
74{
75 int32_t cnt;
76
77 for (cnt = 0; cnt < 16; cnt += 4) {
78 int32_t nnz = nzc[scan8[cnt]];
79
80 if (nnz == 1 && ((dctcoef *) block)[cnt * 16]) {
81 ff_h264_idct8_dc_add_8_lasx(dst + blk_offset[cnt],
82 block + cnt * 16 * sizeof(pixel),
83 dst_stride);
84 } else if (nnz) {
85 ff_h264_idct8_add_8_lasx(dst + blk_offset[cnt],
86 block + cnt * 16 * sizeof(pixel),
87 dst_stride);
88 }
89 }
90}
91#endif // #if HAVE_LASX
92
93void ff_h264_idct_add8_8_lsx(uint8_t **dst, const int32_t *blk_offset,
94 int16_t *block, int32_t dst_stride,
95 const uint8_t nzc[15 * 8])
96{
97 int32_t i;
98
99 for (i = 16; i < 20; i++) {
100 if (nzc[scan8[i]])
101 ff_h264_idct_add_8_lsx(dst[0] + blk_offset[i],
102 block + i * 16 * sizeof(pixel),
103 dst_stride);
104 else if (((dctcoef *) block)[i * 16])
105 ff_h264_idct_dc_add_8_lsx(dst[0] + blk_offset[i],
106 block + i * 16 * sizeof(pixel),
107 dst_stride);
108 }
109 for (i = 32; i < 36; i++) {
110 if (nzc[scan8[i]])
111 ff_h264_idct_add_8_lsx(dst[1] + blk_offset[i],
112 block + i * 16 * sizeof(pixel),
113 dst_stride);
114 else if (((dctcoef *) block)[i * 16])
115 ff_h264_idct_dc_add_8_lsx(dst[1] + blk_offset[i],
116 block + i * 16 * sizeof(pixel),
117 dst_stride);
118 }
119}
120
121void ff_h264_idct_add8_422_8_lsx(uint8_t **dst, const int32_t *blk_offset,
122 int16_t *block, int32_t dst_stride,
123 const uint8_t nzc[15 * 8])
124{
125 int32_t i;
126
127 for (i = 16; i < 20; i++) {
128 if (nzc[scan8[i]])
129 ff_h264_idct_add_8_lsx(dst[0] + blk_offset[i],
130 block + i * 16 * sizeof(pixel),
131 dst_stride);
132 else if (((dctcoef *) block)[i * 16])
133 ff_h264_idct_dc_add_8_lsx(dst[0] + blk_offset[i],
134 block + i * 16 * sizeof(pixel),
135 dst_stride);
136 }
137 for (i = 20; i < 24; i++) {
138 if (nzc[scan8[i + 4]])
139 ff_h264_idct_add_8_lsx(dst[0] + blk_offset[i + 4],
140 block + i * 16 * sizeof(pixel),
141 dst_stride);
142 else if (((dctcoef *) block)[i * 16])
143 ff_h264_idct_dc_add_8_lsx(dst[0] + blk_offset[i + 4],
144 block + i * 16 * sizeof(pixel),
145 dst_stride);
146 }
147 for (i = 32; i < 36; i++) {
148 if (nzc[scan8[i]])
149 ff_h264_idct_add_8_lsx(dst[1] + blk_offset[i],
150 block + i * 16 * sizeof(pixel),
151 dst_stride);
152 else if (((dctcoef *) block)[i * 16])
153 ff_h264_idct_dc_add_8_lsx(dst[1] + blk_offset[i],
154 block + i * 16 * sizeof(pixel),
155 dst_stride);
156 }
157 for (i = 36; i < 40; i++) {
158 if (nzc[scan8[i + 4]])
159 ff_h264_idct_add_8_lsx(dst[1] + blk_offset[i + 4],
160 block + i * 16 * sizeof(pixel),
161 dst_stride);
162 else if (((dctcoef *) block)[i * 16])
163 ff_h264_idct_dc_add_8_lsx(dst[1] + blk_offset[i + 4],
164 block + i * 16 * sizeof(pixel),
165 dst_stride);
166 }
167}
168
169void ff_h264_idct_add16_intra_8_lsx(uint8_t *dst, const int32_t *blk_offset,
170 int16_t *block, int32_t dst_stride,
171 const uint8_t nzc[15 * 8])
172{
173 int32_t i;
174
175 for (i = 0; i < 16; i++) {
176 if (nzc[scan8[i]])
177 ff_h264_idct_add_8_lsx(dst + blk_offset[i],
178 block + i * 16 * sizeof(pixel), dst_stride);
179 else if (((dctcoef *) block)[i * 16])
180 ff_h264_idct_dc_add_8_lsx(dst + blk_offset[i],
181 block + i * 16 * sizeof(pixel),
182 dst_stride);
183 }
184}
libavcodec/loongarch/loongson_asm.S+945−0
@@ -0,0 +1,945 @@
1/*
2 * Loongson asm helper.
3 *
4 * Copyright (c) 2022 Loongson Technology Corporation Limited
5 * Contributed by Gu Xiwei(guxiwei-hf@loongson.cn)
6 * Shiyou Yin(yinshiyou-hf@loongson.cn)
7 *
8 * This file is part of FFmpeg.
9 *
10 * FFmpeg is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * FFmpeg is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with FFmpeg; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25/**
26 * MAJOR version: Macro usage changes.
27 * MINOR version: Add new functions, or bug fixes.
28 * MICRO version: Comment changes or implementation changes.
29 */
30#define LML_VERSION_MAJOR 0
31#define LML_VERSION_MINOR 2
32#define LML_VERSION_MICRO 0
33
34/*
35 *============================================================================
36 * macros for specific projetc, set them as needed.
37 * Following LoongML macros for your reference.
38 *============================================================================
39 */
40#define ASM_PREF
41#define DEFAULT_ALIGN 5
42
43.macro function name, align=DEFAULT_ALIGN
44.macro endfunc
45 jirl $r0, $r1, 0x0
46 .size ASM_PREF\name, . - ASM_PREF\name
47 .purgem endfunc
48.endm
49.text ;
50.align \align ;
51.globl ASM_PREF\name ;
52.type ASM_PREF\name, @function ;
53ASM_PREF\name: ;
54.endm
55
56/**
57 * Attention: If align is not zero, the macro will use
58 * t7 until the end of function
59 */
60.macro alloc_stack size, align=0
61.if \align
62 .macro clean_stack
63 add.d sp, sp, t7
64 .endm
65 addi.d sp, sp, - \size
66 andi.d t7, sp, \align - 1
67 sub.d sp, sp, t7
68 addi.d t7, t7, \size
69.else
70 .macro clean_stack
71 addi.d sp, sp, \size
72 .endm
73 addi.d sp, sp, - \size
74.endif
75.endm
76
77.macro const name, align=DEFAULT_ALIGN
78 .macro endconst
79 .size \name, . - \name
80 .purgem endconst
81 .endm
82.section .rodata
83.align \align
84\name:
85.endm
86
87/*
88 *============================================================================
89 * LoongArch register alias
90 *============================================================================
91 */
92
93#define a0 $a0
94#define a1 $a1
95#define a2 $a2
96#define a3 $a3
97#define a4 $a4
98#define a5 $a5
99#define a6 $a6
100#define a7 $a7
101
102#define t0 $t0
103#define t1 $t1
104#define t2 $t2
105#define t3 $t3
106#define t4 $t4
107#define t5 $t5
108#define t6 $t6
109#define t7 $t7
110#define t8 $t8
111
112#define s0 $s0
113#define s1 $s1
114#define s2 $s2
115#define s3 $s3
116#define s4 $s4
117#define s5 $s5
118#define s6 $s6
119#define s7 $s7
120#define s8 $s8
121
122#define zero $zero
123#define sp $sp
124#define ra $ra
125
126#define f0 $f0
127#define f1 $f1
128#define f2 $f2
129#define f3 $f3
130#define f4 $f4
131#define f5 $f5
132#define f6 $f6
133#define f7 $f7
134#define f8 $f8
135#define f9 $f9
136#define f10 $f10
137#define f11 $f11
138#define f12 $f12
139#define f13 $f13
140#define f14 $f14
141#define f15 $f15
142#define f16 $f16
143#define f17 $f17
144#define f18 $f18
145#define f19 $f19
146#define f20 $f20
147#define f21 $f21
148#define f22 $f22
149#define f23 $f23
150#define f24 $f24
151#define f25 $f25
152#define f26 $f26
153#define f27 $f27
154#define f28 $f28
155#define f29 $f29
156#define f30 $f30
157#define f31 $f31
158
159#define vr0 $vr0
160#define vr1 $vr1
161#define vr2 $vr2
162#define vr3 $vr3
163#define vr4 $vr4
164#define vr5 $vr5
165#define vr6 $vr6
166#define vr7 $vr7
167#define vr8 $vr8
168#define vr9 $vr9
169#define vr10 $vr10
170#define vr11 $vr11
171#define vr12 $vr12
172#define vr13 $vr13
173#define vr14 $vr14
174#define vr15 $vr15
175#define vr16 $vr16
176#define vr17 $vr17
177#define vr18 $vr18
178#define vr19 $vr19
179#define vr20 $vr20
180#define vr21 $vr21
181#define vr22 $vr22
182#define vr23 $vr23
183#define vr24 $vr24
184#define vr25 $vr25
185#define vr26 $vr26
186#define vr27 $vr27
187#define vr28 $vr28
188#define vr29 $vr29
189#define vr30 $vr30
190#define vr31 $vr31
191
192#define xr0 $xr0
193#define xr1 $xr1
194#define xr2 $xr2
195#define xr3 $xr3
196#define xr4 $xr4
197#define xr5 $xr5
198#define xr6 $xr6
199#define xr7 $xr7
200#define xr8 $xr8
201#define xr9 $xr9
202#define xr10 $xr10
203#define xr11 $xr11
204#define xr12 $xr12
205#define xr13 $xr13
206#define xr14 $xr14
207#define xr15 $xr15
208#define xr16 $xr16
209#define xr17 $xr17
210#define xr18 $xr18
211#define xr19 $xr19
212#define xr20 $xr20
213#define xr21 $xr21
214#define xr22 $xr22
215#define xr23 $xr23
216#define xr24 $xr24
217#define xr25 $xr25
218#define xr26 $xr26
219#define xr27 $xr27
220#define xr28 $xr28
221#define xr29 $xr29
222#define xr30 $xr30
223#define xr31 $xr31
224
225/*
226 *============================================================================
227 * LSX/LASX synthesize instructions
228 *============================================================================
229 */
230
231/*
232 * Description : Dot product of byte vector elements
233 * Arguments : Inputs - vj, vk
234 * Outputs - vd
235 * Return Type - halfword
236 */
237.macro vdp2.h.bu vd, vj, vk
238 vmulwev.h.bu \vd, \vj, \vk
239 vmaddwod.h.bu \vd, \vj, \vk
240.endm
241
242.macro vdp2.h.bu.b vd, vj, vk
243 vmulwev.h.bu.b \vd, \vj, \vk
244 vmaddwod.h.bu.b \vd, \vj, \vk
245.endm
246
247.macro vdp2.w.h vd, vj, vk
248 vmulwev.w.h \vd, \vj, \vk
249 vmaddwod.w.h \vd, \vj, \vk
250.endm
251
252.macro xvdp2.h.bu xd, xj, xk
253 xvmulwev.h.bu \xd, \xj, \xk
254 xvmaddwod.h.bu \xd, \xj, \xk
255.endm
256
257.macro xvdp2.h.bu.b xd, xj, xk
258 xvmulwev.h.bu.b \xd, \xj, \xk
259 xvmaddwod.h.bu.b \xd, \xj, \xk
260.endm
261
262.macro xvdp2.w.h xd, xj, xk
263 xvmulwev.w.h \xd, \xj, \xk
264 xvmaddwod.w.h \xd, \xj, \xk
265.endm
266
267/*
268 * Description : Dot product & addition of halfword vector elements
269 * Arguments : Inputs - vj, vk
270 * Outputs - vd
271 * Return Type - twice size of input
272 */
273.macro vdp2add.h.bu vd, vj, vk
274 vmaddwev.h.bu \vd, \vj, \vk
275 vmaddwod.h.bu \vd, \vj, \vk
276.endm
277
278.macro vdp2add.h.bu.b vd, vj, vk
279 vmaddwev.h.bu.b \vd, \vj, \vk
280 vmaddwod.h.bu.b \vd, \vj, \vk
281.endm
282
283.macro vdp2add.w.h vd, vj, vk
284 vmaddwev.w.h \vd, \vj, \vk
285 vmaddwod.w.h \vd, \vj, \vk
286.endm
287
288.macro xvdp2add.h.bu.b xd, xj, xk
289 xvmaddwev.h.bu.b \xd, \xj, \xk
290 xvmaddwod.h.bu.b \xd, \xj, \xk
291.endm
292
293.macro xvdp2add.w.h xd, xj, xk
294 xvmaddwev.w.h \xd, \xj, \xk
295 xvmaddwod.w.h \xd, \xj, \xk
296.endm
297
298/*
299 * Description : Range each element of vector
300 * clip: vj > vk ? vj : vk && vj < va ? vj : va
301 * clip255: vj < 255 ? vj : 255 && vj > 0 ? vj : 0
302 */
303.macro vclip.h vd, vj, vk, va
304 vmax.h \vd, \vj, \vk
305 vmin.h \vd, \vd, \va
306.endm
307
308.macro vclip255.w vd, vj
309 vmaxi.w \vd, \vj, 0
310 vsat.wu \vd, \vd, 7
311.endm
312
313.macro vclip255.h vd, vj
314 vmaxi.h \vd, \vj, 0
315 vsat.hu \vd, \vd, 7
316.endm
317
318.macro xvclip.h xd, xj, xk, xa
319 xvmax.h \xd, \xj, \xk
320 xvmin.h \xd, \xd, \xa
321.endm
322
323.macro xvclip255.h xd, xj
324 xvmaxi.h \xd, \xj, 0
325 xvsat.hu \xd, \xd, 7
326.endm
327
328.macro xvclip255.w xd, xj
329 xvmaxi.w \xd, \xj, 0
330 xvsat.wu \xd, \xd, 7
331.endm
332
333/*
334 * Description : Store elements of vector
335 * vd : Data vector to be stroed
336 * rk : Address of data storage
337 * ra : Offset of address
338 * si : Index of data in vd
339 */
340.macro vstelmx.b vd, rk, ra, si
341 add.d \rk, \rk, \ra
342 vstelm.b \vd, \rk, 0, \si
343.endm
344
345.macro vstelmx.h vd, rk, ra, si
346 add.d \rk, \rk, \ra
347 vstelm.h \vd, \rk, 0, \si
348.endm
349
350.macro vstelmx.w vd, rk, ra, si
351 add.d \rk, \rk, \ra
352 vstelm.w \vd, \rk, 0, \si
353.endm
354
355.macro vstelmx.d vd, rk, ra, si
356 add.d \rk, \rk, \ra
357 vstelm.d \vd, \rk, 0, \si
358.endm
359
360.macro vmov xd, xj
361 vor.v \xd, \xj, \xj
362.endm
363
364.macro xmov xd, xj
365 xvor.v \xd, \xj, \xj
366.endm
367
368.macro xvstelmx.d xd, rk, ra, si
369 add.d \rk, \rk, \ra
370 xvstelm.d \xd, \rk, 0, \si
371.endm
372
373/*
374 *============================================================================
375 * LSX/LASX custom macros
376 *============================================================================
377 */
378
379/*
380 * Load 4 float, double, V128, v256 elements with stride.
381 */
382.macro FLDS_LOADX_4 src, stride, stride2, stride3, out0, out1, out2, out3
383 fld.s \out0, \src, 0
384 fldx.s \out1, \src, \stride
385 fldx.s \out2, \src, \stride2
386 fldx.s \out3, \src, \stride3
387.endm
388
389.macro FLDD_LOADX_4 src, stride, stride2, stride3, out0, out1, out2, out3
390 fld.d \out0, \src, 0
391 fldx.d \out1, \src, \stride
392 fldx.d \out2, \src, \stride2
393 fldx.d \out3, \src, \stride3
394.endm
395
396.macro LSX_LOADX_4 src, stride, stride2, stride3, out0, out1, out2, out3
397 vld \out0, \src, 0
398 vldx \out1, \src, \stride
399 vldx \out2, \src, \stride2
400 vldx \out3, \src, \stride3
401.endm
402
403.macro LASX_LOADX_4 src, stride, stride2, stride3, out0, out1, out2, out3
404 xvld \out0, \src, 0
405 xvldx \out1, \src, \stride
406 xvldx \out2, \src, \stride2
407 xvldx \out3, \src, \stride3
408.endm
409
410/*
411 * Description : Transpose 4x4 block with half-word elements in vectors
412 * Arguments : Inputs - in0, in1, in2, in3
413 * Outputs - out0, out1, out2, out3
414 */
415.macro LSX_TRANSPOSE4x4_H in0, in1, in2, in3, out0, out1, out2, out3, \
416 tmp0, tmp1
417 vilvl.h \tmp0, \in1, \in0
418 vilvl.h \tmp1, \in3, \in2
419 vilvl.w \out0, \tmp1, \tmp0
420 vilvh.w \out2, \tmp1, \tmp0
421 vilvh.d \out1, \out0, \out0
422 vilvh.d \out3, \out0, \out2
423.endm
424
425/*
426 * Description : Transpose 4x4 block with word elements in vectors
427 * Arguments : Inputs - in0, in1, in2, in3
428 * Outputs - out0, out1, out2, out3
429 * Details :
430 * Example :
431 * 1, 2, 3, 4 1, 5, 9,13
432 * 5, 6, 7, 8 to 2, 6,10,14
433 * 9,10,11,12 =====> 3, 7,11,15
434 * 13,14,15,16 4, 8,12,16
435 */
436.macro LSX_TRANSPOSE4x4_W _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3, \
437 _tmp0, _tmp1
438
439 vilvl.w \_tmp0, \_in1, \_in0
440 vilvh.w \_out1, \_in1, \_in0
441 vilvl.w \_tmp1, \_in3, \_in2
442 vilvh.w \_out3, \_in3, \_in2
443
444 vilvl.d \_out0, \_tmp1, \_tmp0
445 vilvl.d \_out2, \_out3, \_out1
446 vilvh.d \_out3, \_out3, \_out1
447 vilvh.d \_out1, \_tmp1, \_tmp0
448.endm
449
450/*
451 * Description : Transpose 8x8 block with half-word elements in vectors
452 * Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
453 * Outputs - out0, out1, out2, out3, out4, out5, out6, out7
454 */
455.macro LSX_TRANSPOSE8x8_H in0, in1, in2, in3, in4, in5, in6, in7, out0, out1, \
456 out2, out3, out4, out5, out6, out7, tmp0, tmp1, tmp2, \
457 tmp3, tmp4, tmp5, tmp6, tmp7
458 vilvl.h \tmp0, \in6, \in4
459 vilvl.h \tmp1, \in7, \in5
460 vilvl.h \tmp2, \in2, \in0
461 vilvl.h \tmp3, \in3, \in1
462
463 vilvl.h \tmp4, \tmp1, \tmp0
464 vilvh.h \tmp5, \tmp1, \tmp0
465 vilvl.h \tmp6, \tmp3, \tmp2
466 vilvh.h \tmp7, \tmp3, \tmp2
467
468 vilvh.h \tmp0, \in6, \in4
469 vilvh.h \tmp1, \in7, \in5
470 vilvh.h \tmp2, \in2, \in0
471 vilvh.h \tmp3, \in3, \in1
472
473 vpickev.d \out0, \tmp4, \tmp6
474 vpickod.d \out1, \tmp4, \tmp6
475 vpickev.d \out2, \tmp5, \tmp7
476 vpickod.d \out3, \tmp5, \tmp7
477
478 vilvl.h \tmp4, \tmp1, \tmp0
479 vilvh.h \tmp5, \tmp1, \tmp0
480 vilvl.h \tmp6, \tmp3, \tmp2
481 vilvh.h \tmp7, \tmp3, \tmp2
482
483 vpickev.d \out4, \tmp4, \tmp6
484 vpickod.d \out5, \tmp4, \tmp6
485 vpickev.d \out6, \tmp5, \tmp7
486 vpickod.d \out7, \tmp5, \tmp7
487.endm
488
489/*
490 * Description : Transpose 16x8 block with byte elements in vectors
491 * Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
492 * Outputs - out0, out1, out2, out3, out4, out5, out6, out7
493 */
494.macro LASX_TRANSPOSE16X8_B in0, in1, in2, in3, in4, in5, in6, in7, \
495 in8, in9, in10, in11, in12, in13, in14, in15, \
496 out0, out1, out2, out3, out4, out5, out6, out7,\
497 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7
498 xvilvl.b \tmp0, \in2, \in0
499 xvilvl.b \tmp1, \in3, \in1
500 xvilvl.b \tmp2, \in6, \in4
501 xvilvl.b \tmp3, \in7, \in5
502 xvilvl.b \tmp4, \in10, \in8
503 xvilvl.b \tmp5, \in11, \in9
504 xvilvl.b \tmp6, \in14, \in12
505 xvilvl.b \tmp7, \in15, \in13
506 xvilvl.b \out0, \tmp1, \tmp0
507 xvilvh.b \out1, \tmp1, \tmp0
508 xvilvl.b \out2, \tmp3, \tmp2
509 xvilvh.b \out3, \tmp3, \tmp2
510 xvilvl.b \out4, \tmp5, \tmp4
511 xvilvh.b \out5, \tmp5, \tmp4
512 xvilvl.b \out6, \tmp7, \tmp6
513 xvilvh.b \out7, \tmp7, \tmp6
514 xvilvl.w \tmp0, \out2, \out0
515 xvilvh.w \tmp2, \out2, \out0
516 xvilvl.w \tmp4, \out3, \out1
517 xvilvh.w \tmp6, \out3, \out1
518 xvilvl.w \tmp1, \out6, \out4
519 xvilvh.w \tmp3, \out6, \out4
520 xvilvl.w \tmp5, \out7, \out5
521 xvilvh.w \tmp7, \out7, \out5
522 xvilvl.d \out0, \tmp1, \tmp0
523 xvilvh.d \out1, \tmp1, \tmp0
524 xvilvl.d \out2, \tmp3, \tmp2
525 xvilvh.d \out3, \tmp3, \tmp2
526 xvilvl.d \out4, \tmp5, \tmp4
527 xvilvh.d \out5, \tmp5, \tmp4
528 xvilvl.d \out6, \tmp7, \tmp6
529 xvilvh.d \out7, \tmp7, \tmp6
530.endm
531
532/*
533 * Description : Transpose 16x8 block with byte elements in vectors
534 * Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
535 * Outputs - out0, out1, out2, out3, out4, out5, out6, out7
536 */
537.macro LSX_TRANSPOSE16X8_B in0, in1, in2, in3, in4, in5, in6, in7, \
538 in8, in9, in10, in11, in12, in13, in14, in15, \
539 out0, out1, out2, out3, out4, out5, out6, out7,\
540 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7
541 vilvl.b \tmp0, \in2, \in0
542 vilvl.b \tmp1, \in3, \in1
543 vilvl.b \tmp2, \in6, \in4
544 vilvl.b \tmp3, \in7, \in5
545 vilvl.b \tmp4, \in10, \in8
546 vilvl.b \tmp5, \in11, \in9
547 vilvl.b \tmp6, \in14, \in12
548 vilvl.b \tmp7, \in15, \in13
549
550 vilvl.b \out0, \tmp1, \tmp0
551 vilvh.b \out1, \tmp1, \tmp0
552 vilvl.b \out2, \tmp3, \tmp2
553 vilvh.b \out3, \tmp3, \tmp2
554 vilvl.b \out4, \tmp5, \tmp4
555 vilvh.b \out5, \tmp5, \tmp4
556 vilvl.b \out6, \tmp7, \tmp6
557 vilvh.b \out7, \tmp7, \tmp6
558 vilvl.w \tmp0, \out2, \out0
559 vilvh.w \tmp2, \out2, \out0
560 vilvl.w \tmp4, \out3, \out1
561 vilvh.w \tmp6, \out3, \out1
562 vilvl.w \tmp1, \out6, \out4
563 vilvh.w \tmp3, \out6, \out4
564 vilvl.w \tmp5, \out7, \out5
565 vilvh.w \tmp7, \out7, \out5
566 vilvl.d \out0, \tmp1, \tmp0
567 vilvh.d \out1, \tmp1, \tmp0
568 vilvl.d \out2, \tmp3, \tmp2
569 vilvh.d \out3, \tmp3, \tmp2
570 vilvl.d \out4, \tmp5, \tmp4
571 vilvh.d \out5, \tmp5, \tmp4
572 vilvl.d \out6, \tmp7, \tmp6
573 vilvh.d \out7, \tmp7, \tmp6
574.endm
575
576/*
577 * Description : Transpose 4x4 block with half-word elements in vectors
578 * Arguments : Inputs - in0, in1, in2, in3
579 * Outputs - out0, out1, out2, out3
580 */
581.macro LASX_TRANSPOSE4x4_H in0, in1, in2, in3, out0, out1, out2, out3, \
582 tmp0, tmp1
583 xvilvl.h \tmp0, \in1, \in0
584 xvilvl.h \tmp1, \in3, \in2
585 xvilvl.w \out0, \tmp1, \tmp0
586 xvilvh.w \out2, \tmp1, \tmp0
587 xvilvh.d \out1, \out0, \out0
588 xvilvh.d \out3, \out0, \out2
589.endm
590
591/*
592 * Description : Transpose 4x8 block with half-word elements in vectors
593 * Arguments : Inputs - in0, in1, in2, in3
594 * Outputs - out0, out1, out2, out3
595 */
596.macro LASX_TRANSPOSE4x8_H in0, in1, in2, in3, out0, out1, out2, out3, \
597 tmp0, tmp1
598 xvilvl.h \tmp0, \in2, \in0
599 xvilvl.h \tmp1, \in3, \in1
600 xvilvl.h \out2, \tmp1, \tmp0
601 xvilvh.h \out3, \tmp1, \tmp0
602
603 xvilvl.d \out0, \out2, \out2
604 xvilvh.d \out1, \out2, \out2
605 xvilvl.d \out2, \out3, \out3
606 xvilvh.d \out3, \out3, \out3
607.endm
608
609/*
610 * Description : Transpose 8x8 block with half-word elements in vectors
611 * Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
612 * Outputs - out0, out1, out2, out3, out4, out5, out6, out7
613 */
614.macro LASX_TRANSPOSE8x8_H in0, in1, in2, in3, in4, in5, in6, in7, \
615 out0, out1, out2, out3, out4, out5, out6, out7, \
616 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7
617 xvilvl.h \tmp0, \in6, \in4
618 xvilvl.h \tmp1, \in7, \in5
619 xvilvl.h \tmp2, \in2, \in0
620 xvilvl.h \tmp3, \in3, \in1
621
622 xvilvl.h \tmp4, \tmp1, \tmp0
623 xvilvh.h \tmp5, \tmp1, \tmp0
624 xvilvl.h \tmp6, \tmp3, \tmp2
625 xvilvh.h \tmp7, \tmp3, \tmp2
626
627 xvilvh.h \tmp0, \in6, \in4
628 xvilvh.h \tmp1, \in7, \in5
629 xvilvh.h \tmp2, \in2, \in0
630 xvilvh.h \tmp3, \in3, \in1
631
632 xvpickev.d \out0, \tmp4, \tmp6
633 xvpickod.d \out1, \tmp4, \tmp6
634 xvpickev.d \out2, \tmp5, \tmp7
635 xvpickod.d \out3, \tmp5, \tmp7
636
637 xvilvl.h \tmp4, \tmp1, \tmp0
638 xvilvh.h \tmp5, \tmp1, \tmp0
639 xvilvl.h \tmp6, \tmp3, \tmp2
640 xvilvh.h \tmp7, \tmp3, \tmp2
641
642 xvpickev.d \out4, \tmp4, \tmp6
643 xvpickod.d \out5, \tmp4, \tmp6
644 xvpickev.d \out6, \tmp5, \tmp7
645 xvpickod.d \out7, \tmp5, \tmp7
646.endm
647
648/*
649 * Description : Transpose 2x4x4 block with half-word elements in vectors
650 * Arguments : Inputs - in0, in1, in2, in3
651 * Outputs - out0, out1, out2, out3
652 */
653.macro LASX_TRANSPOSE2x4x4_H in0, in1, in2, in3, out0, out1, out2, out3, \
654 tmp0, tmp1, tmp2
655 xvilvh.h \tmp1, \in0, \in1
656 xvilvl.h \out1, \in0, \in1
657 xvilvh.h \tmp0, \in2, \in3
658 xvilvl.h \out3, \in2, \in3
659
660 xvilvh.w \tmp2, \out3, \out1
661 xvilvl.w \out3, \out3, \out1
662
663 xvilvl.w \out2, \tmp0, \tmp1
664 xvilvh.w \tmp1, \tmp0, \tmp1
665
666 xvilvh.d \out0, \out2, \out3
667 xvilvl.d \out2, \out2, \out3
668 xvilvh.d \out1, \tmp1, \tmp2
669 xvilvl.d \out3, \tmp1, \tmp2
670.endm
671
672/*
673 * Description : Transpose 4x4 block with word elements in vectors
674 * Arguments : Inputs - in0, in1, in2, in3
675 * Outputs - out0, out1, out2, out3
676 * Details :
677 * Example :
678 * 1, 2, 3, 4, 1, 2, 3, 4 1,5, 9,13, 1,5, 9,13
679 * 5, 6, 7, 8, 5, 6, 7, 8 to 2,6,10,14, 2,6,10,14
680 * 9,10,11,12, 9,10,11,12 =====> 3,7,11,15, 3,7,11,15
681 * 13,14,15,16, 13,14,15,16 4,8,12,16, 4,8,12,16
682 */
683.macro LASX_TRANSPOSE4x4_W _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3, \
684 _tmp0, _tmp1
685
686 xvilvl.w \_tmp0, \_in1, \_in0
687 xvilvh.w \_out1, \_in1, \_in0
688 xvilvl.w \_tmp1, \_in3, \_in2
689 xvilvh.w \_out3, \_in3, \_in2
690
691 xvilvl.d \_out0, \_tmp1, \_tmp0
692 xvilvl.d \_out2, \_out3, \_out1
693 xvilvh.d \_out3, \_out3, \_out1
694 xvilvh.d \_out1, \_tmp1, \_tmp0
695.endm
696
697/*
698 * Description : Transpose 8x8 block with word elements in vectors
699 * Arguments : Inputs - _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7
700 * Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6,
701 * _out7
702 * Example : LASX_TRANSPOSE8x8_W
703 * _in0 : 1,2,3,4,5,6,7,8
704 * _in1 : 2,2,3,4,5,6,7,8
705 * _in2 : 3,2,3,4,5,6,7,8
706 * _in3 : 4,2,3,4,5,6,7,8
707 * _in4 : 5,2,3,4,5,6,7,8
708 * _in5 : 6,2,3,4,5,6,7,8
709 * _in6 : 7,2,3,4,5,6,7,8
710 * _in7 : 8,2,3,4,5,6,7,8
711 *
712 * _out0 : 1,2,3,4,5,6,7,8
713 * _out1 : 2,2,2,2,2,2,2,2
714 * _out2 : 3,3,3,3,3,3,3,3
715 * _out3 : 4,4,4,4,4,4,4,4
716 * _out4 : 5,5,5,5,5,5,5,5
717 * _out5 : 6,6,6,6,6,6,6,6
718 * _out6 : 7,7,7,7,7,7,7,7
719 * _out7 : 8,8,8,8,8,8,8,8
720 */
721.macro LASX_TRANSPOSE8x8_W _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7,\
722 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7,\
723 _tmp0, _tmp1, _tmp2, _tmp3
724 xvilvl.w \_tmp0, \_in2, \_in0
725 xvilvl.w \_tmp1, \_in3, \_in1
726 xvilvh.w \_tmp2, \_in2, \_in0
727 xvilvh.w \_tmp3, \_in3, \_in1
728 xvilvl.w \_out0, \_tmp1, \_tmp0
729 xvilvh.w \_out1, \_tmp1, \_tmp0
730 xvilvl.w \_out2, \_tmp3, \_tmp2
731 xvilvh.w \_out3, \_tmp3, \_tmp2
732
733 xvilvl.w \_tmp0, \_in6, \_in4
734 xvilvl.w \_tmp1, \_in7, \_in5
735 xvilvh.w \_tmp2, \_in6, \_in4
736 xvilvh.w \_tmp3, \_in7, \_in5
737 xvilvl.w \_out4, \_tmp1, \_tmp0
738 xvilvh.w \_out5, \_tmp1, \_tmp0
739 xvilvl.w \_out6, \_tmp3, \_tmp2
740 xvilvh.w \_out7, \_tmp3, \_tmp2
741
742 xmov \_tmp0, \_out0
743 xmov \_tmp1, \_out1
744 xmov \_tmp2, \_out2
745 xmov \_tmp3, \_out3
746 xvpermi.q \_out0, \_out4, 0x02
747 xvpermi.q \_out1, \_out5, 0x02
748 xvpermi.q \_out2, \_out6, 0x02
749 xvpermi.q \_out3, \_out7, 0x02
750 xvpermi.q \_out4, \_tmp0, 0x31
751 xvpermi.q \_out5, \_tmp1, 0x31
752 xvpermi.q \_out6, \_tmp2, 0x31
753 xvpermi.q \_out7, \_tmp3, 0x31
754.endm
755
756/*
757 * Description : Transpose 4x4 block with double-word elements in vectors
758 * Arguments : Inputs - _in0, _in1, _in2, _in3
759 * Outputs - _out0, _out1, _out2, _out3
760 * Example : LASX_TRANSPOSE4x4_D
761 * _in0 : 1,2,3,4
762 * _in1 : 1,2,3,4
763 * _in2 : 1,2,3,4
764 * _in3 : 1,2,3,4
765 *
766 * _out0 : 1,1,1,1
767 * _out1 : 2,2,2,2
768 * _out2 : 3,3,3,3
769 * _out3 : 4,4,4,4
770 */
771.macro LASX_TRANSPOSE4x4_D _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3, \
772 _tmp0, _tmp1
773 xvilvl.d \_tmp0, \_in1, \_in0
774 xvilvh.d \_out1, \_in1, \_in0
775 xvilvh.d \_tmp1, \_in3, \_in2
776 xvilvl.d \_out2, \_in3, \_in2
777
778 xvor.v \_out0, \_tmp0, \_tmp0
779 xvor.v \_out3, \_tmp1, \_tmp1
780
781 xvpermi.q \_out0, \_out2, 0x02
782 xvpermi.q \_out2, \_tmp0, 0x31
783 xvpermi.q \_out3, \_out1, 0x31
784 xvpermi.q \_out1, \_tmp1, 0x02
785.endm
786
787/*
788 * Description : Butterfly of 4 input vectors
789 * Arguments : Inputs - _in0, _in1, _in2, _in3
790 * Outputs - _out0, _out1, _out2, _out3
791 * Details : Butterfly operation
792 * Example : LSX_BUTTERFLY_4
793 * _out0 = _in0 + _in3;
794 * _out1 = _in1 + _in2;
795 * _out2 = _in1 - _in2;
796 * _out3 = _in0 - _in3;
797 */
798.macro LSX_BUTTERFLY_4_B _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
799 vadd.b \_out0, \_in0, \_in3
800 vadd.b \_out1, \_in1, \_in2
801 vsub.b \_out2, \_in1, \_in2
802 vsub.b \_out3, \_in0, \_in3
803.endm
804.macro LSX_BUTTERFLY_4_H _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
805 vadd.h \_out0, \_in0, \_in3
806 vadd.h \_out1, \_in1, \_in2
807 vsub.h \_out2, \_in1, \_in2
808 vsub.h \_out3, \_in0, \_in3
809.endm
810.macro LSX_BUTTERFLY_4_W _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
811 vadd.w \_out0, \_in0, \_in3
812 vadd.w \_out1, \_in1, \_in2
813 vsub.w \_out2, \_in1, \_in2
814 vsub.w \_out3, \_in0, \_in3
815.endm
816.macro LSX_BUTTERFLY_4_D _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
817 vadd.d \_out0, \_in0, \_in3
818 vadd.d \_out1, \_in1, \_in2
819 vsub.d \_out2, \_in1, \_in2
820 vsub.d \_out3, \_in0, \_in3
821.endm
822
823.macro LASX_BUTTERFLY_4_B _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
824 xvadd.b \_out0, \_in0, \_in3
825 xvadd.b \_out1, \_in1, \_in2
826 xvsub.b \_out2, \_in1, \_in2
827 xvsub.b \_out3, \_in0, \_in3
828.endm
829.macro LASX_BUTTERFLY_4_H _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
830 xvadd.h \_out0, \_in0, \_in3
831 xvadd.h \_out1, \_in1, \_in2
832 xvsub.h \_out2, \_in1, \_in2
833 xvsub.h \_out3, \_in0, \_in3
834.endm
835.macro LASX_BUTTERFLY_4_W _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
836 xvadd.w \_out0, \_in0, \_in3
837 xvadd.w \_out1, \_in1, \_in2
838 xvsub.w \_out2, \_in1, \_in2
839 xvsub.w \_out3, \_in0, \_in3
840.endm
841.macro LASX_BUTTERFLY_4_D _in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3
842 xvadd.d \_out0, \_in0, \_in3
843 xvadd.d \_out1, \_in1, \_in2
844 xvsub.d \_out2, \_in1, \_in2
845 xvsub.d \_out3, \_in0, \_in3
846.endm
847
848/*
849 * Description : Butterfly of 8 input vectors
850 * Arguments : Inputs - _in0, _in1, _in2, _in3, ~
851 * Outputs - _out0, _out1, _out2, _out3, ~
852 * Details : Butterfly operation
853 * Example : LASX_BUTTERFLY_8
854 * _out0 = _in0 + _in7;
855 * _out1 = _in1 + _in6;
856 * _out2 = _in2 + _in5;
857 * _out3 = _in3 + _in4;
858 * _out4 = _in3 - _in4;
859 * _out5 = _in2 - _in5;
860 * _out6 = _in1 - _in6;
861 * _out7 = _in0 - _in7;
862 */
863.macro LSX_BUTTERFLY_8_B _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
864 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
865 vadd.b \_out0, \_in0, \_in7
866 vadd.b \_out1, \_in1, \_in6
867 vadd.b \_out2, \_in2, \_in5
868 vadd.b \_out3, \_in3, \_in4
869 vsub.b \_out4, \_in3, \_in4
870 vsub.b \_out5, \_in2, \_in5
871 vsub.b \_out6, \_in1, \_in6
872 vsub.b \_out7, \_in0, \_in7
873.endm
874
875.macro LSX_BUTTERFLY_8_H _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
876 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
877 vadd.h \_out0, \_in0, \_in7
878 vadd.h \_out1, \_in1, \_in6
879 vadd.h \_out2, \_in2, \_in5
880 vadd.h \_out3, \_in3, \_in4
881 vsub.h \_out4, \_in3, \_in4
882 vsub.h \_out5, \_in2, \_in5
883 vsub.h \_out6, \_in1, \_in6
884 vsub.h \_out7, \_in0, \_in7
885.endm
886
887.macro LSX_BUTTERFLY_8_W _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
888 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
889 vadd.w \_out0, \_in0, \_in7
890 vadd.w \_out1, \_in1, \_in6
891 vadd.w \_out2, \_in2, \_in5
892 vadd.w \_out3, \_in3, \_in4
893 vsub.w \_out4, \_in3, \_in4
894 vsub.w \_out5, \_in2, \_in5
895 vsub.w \_out6, \_in1, \_in6
896 vsub.w \_out7, \_in0, \_in7
897.endm
898
899.macro LSX_BUTTERFLY_8_D _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
900 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
901 vadd.d \_out0, \_in0, \_in7
902 vadd.d \_out1, \_in1, \_in6
903 vadd.d \_out2, \_in2, \_in5
904 vadd.d \_out3, \_in3, \_in4
905 vsub.d \_out4, \_in3, \_in4
906 vsub.d \_out5, \_in2, \_in5
907 vsub.d \_out6, \_in1, \_in6
908 vsub.d \_out7, \_in0, \_in7
909.endm
910
911.macro LASX_BUTTERFLY_8_B _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
912 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
913 xvadd.b \_out0, \_in0, \_in7
914 xvadd.b \_out1, \_in1, \_in6
915 xvadd.b \_out2, \_in2, \_in5
916 xvadd.b \_out3, \_in3, \_in4
917 xvsub.b \_out4, \_in3, \_in4
918 xvsub.b \_out5, \_in2, \_in5
919 xvsub.b \_out6, \_in1, \_in6
920 xvsub.b \_out7, \_in0, \_in7
921.endm
922
923.macro LASX_BUTTERFLY_8_H _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
924 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
925 xvadd.h \_out0, \_in0, \_in7
926 xvadd.h \_out1, \_in1, \_in6
927 xvadd.h \_out2, \_in2, \_in5
928 xvadd.h \_out3, \_in3, \_in4
929 xvsub.h \_out4, \_in3, \_in4
930 xvsub.h \_out5, \_in2, \_in5
931 xvsub.h \_out6, \_in1, \_in6
932 xvsub.h \_out7, \_in0, \_in7
933.endm
934
935.macro LASX_BUTTERFLY_8_W _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
936 _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
937 xvadd.w \_out0, \_in0, \_in7
938 xvadd.w \_out1, \_in1, \_in6
939 xvadd.w \_out2, \_in2, \_in5
940 xvadd.w \_out3, \_in3, \_in4
941 xvsub.w \_out4, \_in3, \_in4
942 xvsub.w \_out5, \_in2, \_in5
943 xvsub.w \_out6, \_in1, \_in6
944 xvsub.w \_out7, \_in0, \_in7
945.endm

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t