• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Loongson MMI optimizations for libjpeg-turbo
3  *
4  * Copyright (C) 2016-2017, Loongson Technology Corporation Limited, BeiJing.
5  *                          All Rights Reserved.
6  * Authors:  ZhuChen     <zhuchen@loongson.cn>
7  *           CaiWanwei   <caiwanwei@loongson.cn>
8  *           SunZhangzhi <sunzhangzhi-cq@loongson.cn>
9  *
10  * This software is provided 'as-is', without any express or implied
11  * warranty.  In no event will the authors be held liable for any damages
12  * arising from the use of this software.
13  *
14  * Permission is granted to anyone to use this software for any purpose,
15  * including commercial applications, and to alter it and redistribute it
16  * freely, subject to the following restrictions:
17  *
18  * 1. The origin of this software must not be misrepresented; you must not
19  *    claim that you wrote the original software. If you use this software
20  *    in a product, an acknowledgment in the product documentation would be
21  *    appreciated but is not required.
22  * 2. Altered source versions must be plainly marked as such, and must not be
23  *    misrepresented as being the original software.
24  * 3. This notice may not be removed or altered from any source distribution.
25  */
26 
27 #define JPEG_INTERNALS
28 #include "../../jinclude.h"
29 #include "../../jpeglib.h"
30 #include "../../jdct.h"
31 #include "loongson-mmintrin.h"
32 
33 
34 /* Common code */
35 
36 #define SIZEOF_MMWORD  8
37 #define BYTE_BIT  8
38 #define WORD_BIT  16
39 #define SCALEBITS  16
40 
41 #define _uint64_set_pi8(a, b, c, d, e, f, g, h) \
42   (((uint64_t)(uint8_t)a << 56) | \
43    ((uint64_t)(uint8_t)b << 48) | \
44    ((uint64_t)(uint8_t)c << 40) | \
45    ((uint64_t)(uint8_t)d << 32) | \
46    ((uint64_t)(uint8_t)e << 24) | \
47    ((uint64_t)(uint8_t)f << 16) | \
48    ((uint64_t)(uint8_t)g << 8)  | \
49    ((uint64_t)(uint8_t)h))
50 #define _uint64_set_pi16(a, b, c, d)  (((uint64_t)(uint16_t)a << 48) | \
51                                        ((uint64_t)(uint16_t)b << 32) | \
52                                        ((uint64_t)(uint16_t)c << 16) | \
53                                        ((uint64_t)(uint16_t)d))
54 #define _uint64_set_pi32(a, b)  (((uint64_t)(uint32_t)a << 32) | \
55                                  ((uint64_t)(uint32_t)b))
56 
57 #define get_const_value(index)  (*(__m64 *)&const_value[index])
58