jsimd_mmi.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #define JPEG_INTERNALS
  27. #include "../../jinclude.h"
  28. #include "../../jpeglib.h"
  29. #include "../../jdct.h"
  30. #include "loongson-mmintrin.h"
  31. /* Common code */
  32. #define SIZEOF_MMWORD 8
  33. #define BYTE_BIT 8
  34. #define WORD_BIT 16
  35. #define SCALEBITS 16
  36. #define _uint64_set_pi8(a, b, c, d, e, f, g, h) \
  37. (((uint64_t)(uint8_t)a << 56) | \
  38. ((uint64_t)(uint8_t)b << 48) | \
  39. ((uint64_t)(uint8_t)c << 40) | \
  40. ((uint64_t)(uint8_t)d << 32) | \
  41. ((uint64_t)(uint8_t)e << 24) | \
  42. ((uint64_t)(uint8_t)f << 16) | \
  43. ((uint64_t)(uint8_t)g << 8) | \
  44. ((uint64_t)(uint8_t)h))
  45. #define _uint64_set_pi16(a, b, c, d) (((uint64_t)(uint16_t)a << 48) | \
  46. ((uint64_t)(uint16_t)b << 32) | \
  47. ((uint64_t)(uint16_t)c << 16) | \
  48. ((uint64_t)(uint16_t)d))
  49. #define _uint64_set_pi32(a, b) (((uint64_t)(uint32_t)a << 32) | \
  50. ((uint64_t)(uint32_t)b))
  51. #define get_const_value(index) (*(__m64 *)&const_value[index])