FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pixblockdsp_mmi.c
Go to the documentation of this file.
1 /*
2  * Loongson SIMD optimized pixblockdsp
3  *
4  * Copyright (c) 2015 Loongson Technology Corporation Limited
5  * Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong@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 "pixblockdsp_mips.h"
25 
26 void ff_get_pixels_8_mmi(int16_t *av_restrict block, const uint8_t *pixels,
27  ptrdiff_t line_size)
28 {
29  __asm__ volatile (
30  "move $8, $0 \n\t"
31  "xor $f0, $f0, $f0 \n\t"
32  "1: \n\t"
33  "gsldlc1 $f2, 7(%1) \n\t"
34  "gsldrc1 $f2, 0(%1) \n\t"
35  "punpcklbh $f4, $f2, $f0 \n\t"
36  "punpckhbh $f6, $f2, $f0 \n\t"
37  "gssdxc1 $f4, 0(%0, $8) \n\t"
38  "gssdxc1 $f6, 8(%0, $8) \n\t"
39  "daddiu $8, $8, 16 \n\t"
40  "daddu %1, %1, %2 \n\t"
41  "daddi %3, %3, -1 \n\t"
42  "bnez %3, 1b \n\t"
43  ::"r"((uint8_t *)block),"r"(pixels),"r"(line_size),"r"(8)
44  : "$8","memory"
45  );
46 }
47 
48 void ff_diff_pixels_mmi(int16_t *av_restrict block, const uint8_t *src1,
49  const uint8_t *src2, int stride)
50 {
51  __asm__ volatile (
52  "dli $2, 8 \n\t"
53  "xor $f14, $f14, $f14 \n\t"
54  "1: \n\t"
55  "gsldlc1 $f0, 7(%1) \n\t"
56  "gsldrc1 $f0, 0(%1) \n\t"
57  "or $f2, $f0, $f0 \n\t"
58  "gsldlc1 $f4, 7(%2) \n\t"
59  "gsldrc1 $f4, 0(%2) \n\t"
60  "or $f6, $f4, $f4 \n\t"
61  "punpcklbh $f0, $f0, $f14 \n\t"
62  "punpckhbh $f2, $f2, $f14 \n\t"
63  "punpcklbh $f4, $f4, $f14 \n\t"
64  "punpckhbh $f6, $f6, $f14 \n\t"
65  "psubh $f0, $f0, $f4 \n\t"
66  "psubh $f2, $f2, $f6 \n\t"
67  "gssdlc1 $f0, 7(%0) \n\t"
68  "gssdrc1 $f0, 0(%0) \n\t"
69  "gssdlc1 $f2, 15(%0) \n\t"
70  "gssdrc1 $f2, 8(%0) \n\t"
71  "daddi %0, %0, 16 \n\t"
72  "daddu %1, %1, %3 \n\t"
73  "daddu %2, %2, %3 \n\t"
74  "daddi $2, $2, -1 \n\t"
75  "bgtz $2, 1b \n\t"
76  ::"r"(block),"r"(src1),"r"(src2),"r"(stride)
77  : "$2","memory"
78  );
79 }
uint8_t
#define src1
Definition: h264pred.c:139
void ff_get_pixels_8_mmi(int16_t *av_restrict block, const uint8_t *pixels, ptrdiff_t line_size)
GLint GLenum GLboolean GLsizei stride
Definition: opengl_enc.c:105
int pixels
Definition: avisynth_c.h:298
void ff_diff_pixels_mmi(int16_t *av_restrict block, const uint8_t *src1, const uint8_t *src2, int stride)
static int16_t block[64]
Definition: dct-test.c:110