2 * Loongson SIMD optimized pixblockdsp
4 * Copyright (c) 2015 Loongson Technology Corporation Limited
5 * Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
7 * This file is part of FFmpeg.
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.
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.
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
24 #include "pixblockdsp_mips.h"
26 void ff_get_pixels_8_mmi(int16_t *av_restrict block, const uint8_t *pixels,
31 "xor $f0, $f0, $f0 \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"
43 ::"r"((uint8_t *)block),"r"(pixels),"r"(line_size),"r"(8)
48 void ff_diff_pixels_mmi(int16_t *av_restrict block, const uint8_t *src1,
49 const uint8_t *src2, int stride)
53 "xor $f14, $f14, $f14 \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"
76 ::"r"(block),"r"(src1),"r"(src2),"r"(stride)