FFmpeg
rgb2rgb_lasx.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 Loongson Technology Corporation Limited
3  * Contributed by Hao Chen(chenhao@loongson.cn)
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "swscale_loongarch.h"
24 
25 void ff_interleave_bytes_lasx(const uint8_t *src1, const uint8_t *src2,
26  uint8_t *dest, int width, int height,
27  int src1Stride, int src2Stride, int dstStride)
28 {
29  int h;
30  int len = width & (0xFFFFFFF0);
31 
32  for (h = 0; h < height; h++) {
33  int w, index = 0;
34  __m256i src_1, src_2, dst;
35 
36  for (w = 0; w < len; w += 16) {
37  DUP2_ARG2(__lasx_xvld, src1 + w, 0, src2 + w, 0, src_1, src_2);
38  src_1 = __lasx_xvpermi_d(src_1, 0xD8);
39  src_2 = __lasx_xvpermi_d(src_2, 0xD8);
40  dst = __lasx_xvilvl_b(src_2, src_1);
41  __lasx_xvst(dst, dest + index, 0);
42  index += 32;
43  }
44  for (; w < width; w++) {
45  dest[(w << 1) + 0] = src1[w];
46  dest[(w << 1) + 1] = src2[w];
47  }
48  dest += dstStride;
49  src1 += src1Stride;
50  src2 += src2Stride;
51  }
52 }
src1
const pixel * src1
Definition: h264pred_template.c:421
w
uint8_t w
Definition: llviddspenc.c:38
DUP2_ARG2
#define DUP2_ARG2(_INS, _IN0, _IN1, _IN2, _IN3, _OUT0, _OUT1)
Definition: loongson_intrinsics.h:58
swscale_loongarch.h
index
int index
Definition: gxfenc.c:90
height
#define height
Definition: dsp.h:85
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
ff_interleave_bytes_lasx
void ff_interleave_bytes_lasx(const uint8_t *src1, const uint8_t *src2, uint8_t *dest, int width, int height, int src1Stride, int src2Stride, int dstStride)
Definition: rgb2rgb_lasx.c:25
src2
const pixel * src2
Definition: h264pred_template.c:422
len
int len
Definition: vorbis_enc_data.h:426
loongson_intrinsics.h
h
h
Definition: vp9dsp_template.c:2070
width
#define width
Definition: dsp.h:85