tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

jdcolor-mmi.c (4402B)


      1 /*
      2 * Loongson MMI optimizations for libjpeg-turbo
      3 *
      4 * Copyright (C) 2011, 2015, D. R. Commander.  All Rights Reserved.
      5 * Copyright (C) 2016-2017, Loongson Technology Corporation Limited, BeiJing.
      6 *                          All Rights Reserved.
      7 * Authors:  ZhuChen     <zhuchen@loongson.cn>
      8 *           CaiWanwei   <caiwanwei@loongson.cn>
      9 *           SunZhangzhi <sunzhangzhi-cq@loongson.cn>
     10 *
     11 * This software is provided 'as-is', without any express or implied
     12 * warranty.  In no event will the authors be held liable for any damages
     13 * arising from the use of this software.
     14 *
     15 * Permission is granted to anyone to use this software for any purpose,
     16 * including commercial applications, and to alter it and redistribute it
     17 * freely, subject to the following restrictions:
     18 *
     19 * 1. The origin of this software must not be misrepresented; you must not
     20 *    claim that you wrote the original software. If you use this software
     21 *    in a product, an acknowledgment in the product documentation would be
     22 *    appreciated but is not required.
     23 * 2. Altered source versions must be plainly marked as such, and must not be
     24 *    misrepresented as being the original software.
     25 * 3. This notice may not be removed or altered from any source distribution.
     26 */
     27 
     28 /* YCC --> RGB CONVERSION */
     29 
     30 #include "jsimd_mmi.h"
     31 
     32 
     33 #define F_0_344  ((short)22554)  /* FIX(0.34414) */
     34 #define F_0_402  ((short)26345)  /* FIX(1.40200) - FIX(1) */
     35 #define F_0_285  ((short)18734)  /* FIX(1) - FIX(0.71414) */
     36 #define F_0_228  ((short)14942)  /* FIX(2) - FIX(1.77200) */
     37 
     38 enum const_index {
     39  index_PW_ONE,
     40  index_PW_F0402,
     41  index_PW_MF0228,
     42  index_PW_MF0344_F0285,
     43  index_PD_ONEHALF
     44 };
     45 
     46 static uint64_t const_value[] = {
     47  _uint64_set_pi16(1, 1, 1, 1),
     48  _uint64_set_pi16(F_0_402, F_0_402, F_0_402, F_0_402),
     49  _uint64_set_pi16(-F_0_228, -F_0_228, -F_0_228, -F_0_228),
     50  _uint64_set_pi16(F_0_285, -F_0_344, F_0_285, -F_0_344),
     51  _uint64_set_pi32((int)(1 << (SCALEBITS - 1)), (int)(1 << (SCALEBITS - 1)))
     52 };
     53 
     54 #define PW_ONE           get_const_value(index_PW_ONE)
     55 #define PW_F0402         get_const_value(index_PW_F0402)
     56 #define PW_MF0228        get_const_value(index_PW_MF0228)
     57 #define PW_MF0344_F0285  get_const_value(index_PW_MF0344_F0285)
     58 #define PD_ONEHALF       get_const_value(index_PD_ONEHALF)
     59 
     60 #define RGBX_FILLER_0XFF  1
     61 
     62 
     63 #include "jdcolext-mmi.c"
     64 #undef RGB_RED
     65 #undef RGB_GREEN
     66 #undef RGB_BLUE
     67 #undef RGB_PIXELSIZE
     68 
     69 #define RGB_RED  EXT_RGB_RED
     70 #define RGB_GREEN  EXT_RGB_GREEN
     71 #define RGB_BLUE  EXT_RGB_BLUE
     72 #define RGB_PIXELSIZE  EXT_RGB_PIXELSIZE
     73 #define jsimd_ycc_rgb_convert_mmi  jsimd_ycc_extrgb_convert_mmi
     74 #include "jdcolext-mmi.c"
     75 #undef RGB_RED
     76 #undef RGB_GREEN
     77 #undef RGB_BLUE
     78 #undef RGB_PIXELSIZE
     79 #undef jsimd_ycc_rgb_convert_mmi
     80 
     81 #define RGB_RED  EXT_RGBX_RED
     82 #define RGB_GREEN  EXT_RGBX_GREEN
     83 #define RGB_BLUE  EXT_RGBX_BLUE
     84 #define RGB_PIXELSIZE  EXT_RGBX_PIXELSIZE
     85 #define jsimd_ycc_rgb_convert_mmi  jsimd_ycc_extrgbx_convert_mmi
     86 #include "jdcolext-mmi.c"
     87 #undef RGB_RED
     88 #undef RGB_GREEN
     89 #undef RGB_BLUE
     90 #undef RGB_PIXELSIZE
     91 #undef jsimd_ycc_rgb_convert_mmi
     92 
     93 #define RGB_RED  EXT_BGR_RED
     94 #define RGB_GREEN  EXT_BGR_GREEN
     95 #define RGB_BLUE  EXT_BGR_BLUE
     96 #define RGB_PIXELSIZE  EXT_BGR_PIXELSIZE
     97 #define jsimd_ycc_rgb_convert_mmi  jsimd_ycc_extbgr_convert_mmi
     98 #include "jdcolext-mmi.c"
     99 #undef RGB_RED
    100 #undef RGB_GREEN
    101 #undef RGB_BLUE
    102 #undef RGB_PIXELSIZE
    103 #undef jsimd_ycc_rgb_convert_mmi
    104 
    105 #define RGB_RED  EXT_BGRX_RED
    106 #define RGB_GREEN  EXT_BGRX_GREEN
    107 #define RGB_BLUE  EXT_BGRX_BLUE
    108 #define RGB_PIXELSIZE  EXT_BGRX_PIXELSIZE
    109 #define jsimd_ycc_rgb_convert_mmi  jsimd_ycc_extbgrx_convert_mmi
    110 #include "jdcolext-mmi.c"
    111 #undef RGB_RED
    112 #undef RGB_GREEN
    113 #undef RGB_BLUE
    114 #undef RGB_PIXELSIZE
    115 #undef jsimd_ycc_rgb_convert_mmi
    116 
    117 #define RGB_RED  EXT_XBGR_RED
    118 #define RGB_GREEN  EXT_XBGR_GREEN
    119 #define RGB_BLUE  EXT_XBGR_BLUE
    120 #define RGB_PIXELSIZE  EXT_XBGR_PIXELSIZE
    121 #define jsimd_ycc_rgb_convert_mmi  jsimd_ycc_extxbgr_convert_mmi
    122 #include "jdcolext-mmi.c"
    123 #undef RGB_RED
    124 #undef RGB_GREEN
    125 #undef RGB_BLUE
    126 #undef RGB_PIXELSIZE
    127 #undef jsimd_ycc_rgb_convert_mmi
    128 
    129 #define RGB_RED  EXT_XRGB_RED
    130 #define RGB_GREEN  EXT_XRGB_GREEN
    131 #define RGB_BLUE  EXT_XRGB_BLUE
    132 #define RGB_PIXELSIZE  EXT_XRGB_PIXELSIZE
    133 #define jsimd_ycc_rgb_convert_mmi  jsimd_ycc_extxrgb_convert_mmi
    134 #include "jdcolext-mmi.c"
    135 #undef RGB_RED
    136 #undef RGB_GREEN
    137 #undef RGB_BLUE
    138 #undef RGB_PIXELSIZE
    139 #undef jsimd_ycc_rgb_convert_mmi