Blame thirdparty/libjpeg-turbo/libjpeg-turbo-2.0.6/simd/loongson/jsimd_mmi.h

shun-iwasawa 82a8f5
/*
shun-iwasawa 82a8f5
 * Loongson MMI optimizations for libjpeg-turbo
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * Copyright (C) 2016-2017, Loongson Technology Corporation Limited, BeiJing.
shun-iwasawa 82a8f5
 *                          All Rights Reserved.
shun-iwasawa 82a8f5
 * Authors:  ZhuChen     <zhuchen@loongson.cn></zhuchen@loongson.cn>
shun-iwasawa 82a8f5
 *           CaiWanwei   <caiwanwei@loongson.cn></caiwanwei@loongson.cn>
shun-iwasawa 82a8f5
 *           SunZhangzhi <sunzhangzhi-cq@loongson.cn></sunzhangzhi-cq@loongson.cn>
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * This software is provided 'as-is', without any express or implied
shun-iwasawa 82a8f5
 * warranty.  In no event will the authors be held liable for any damages
shun-iwasawa 82a8f5
 * arising from the use of this software.
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * Permission is granted to anyone to use this software for any purpose,
shun-iwasawa 82a8f5
 * including commercial applications, and to alter it and redistribute it
shun-iwasawa 82a8f5
 * freely, subject to the following restrictions:
shun-iwasawa 82a8f5
 *
shun-iwasawa 82a8f5
 * 1. The origin of this software must not be misrepresented; you must not
shun-iwasawa 82a8f5
 *    claim that you wrote the original software. If you use this software
shun-iwasawa 82a8f5
 *    in a product, an acknowledgment in the product documentation would be
shun-iwasawa 82a8f5
 *    appreciated but is not required.
shun-iwasawa 82a8f5
 * 2. Altered source versions must be plainly marked as such, and must not be
shun-iwasawa 82a8f5
 *    misrepresented as being the original software.
shun-iwasawa 82a8f5
 * 3. This notice may not be removed or altered from any source distribution.
shun-iwasawa 82a8f5
 */
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#define JPEG_INTERNALS
shun-iwasawa 82a8f5
#include "../../jinclude.h"
shun-iwasawa 82a8f5
#include "../../jpeglib.h"
shun-iwasawa 82a8f5
#include "../../jdct.h"
shun-iwasawa 82a8f5
#include "loongson-mmintrin.h"
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
/* Common code */
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#define SIZEOF_MMWORD  8
shun-iwasawa 82a8f5
#define BYTE_BIT  8
shun-iwasawa 82a8f5
#define WORD_BIT  16
shun-iwasawa 82a8f5
#define SCALEBITS  16
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#define _uint64_set_pi8(a, b, c, d, e, f, g, h) \
shun-iwasawa 82a8f5
  (((uint64_t)(uint8_t)a << 56) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint8_t)b << 48) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint8_t)c << 40) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint8_t)d << 32) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint8_t)e << 24) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint8_t)f << 16) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint8_t)g << 8)  | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint8_t)h))
shun-iwasawa 82a8f5
#define _uint64_set_pi16(a, b, c, d) \
shun-iwasawa 82a8f5
  (((uint64_t)(uint16_t)a << 48) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint16_t)b << 32) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint16_t)c << 16) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint16_t)d))
shun-iwasawa 82a8f5
#define _uint64_set_pi32(a, b) \
shun-iwasawa 82a8f5
  (((uint64_t)(uint32_t)a << 32) | \
shun-iwasawa 82a8f5
   ((uint64_t)(uint32_t)b))
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
#define get_const_value(index)  (*(__m64 *)&const_value[index])