| 6 |
| * This software is provided 'as-is', without any express or implied |
| 7 | * warranty. In no event will the authors be held liable for any damages |
| 8 | * arising from the use of this software. |
| 9 | * |
| 10 | * Permission is granted to anyone to use this software for any purpose, |
| 11 | * including commercial applications, and to alter it and redistribute it |
| 12 | * freely, subject to the following restrictions: |
| 13 | * |
| 14 | * 1. The origin of this software must not be misrepresented; you must not |
| 15 | * claim that you wrote the original software. If you use this software |
| 16 | * in a product, an acknowledgment in the product documentation would be |
| 17 | * appreciated but is not required. |
| 18 | * 2. Altered source versions must be plainly marked as such, and must not be |
| 19 | * misrepresented as being the original software. |
| 20 | * 3. This notice may not be removed or altered from any source distribution. |
| 21 | */ |
| 22 |
| 23 | /* MERGED YCC --> RGB CONVERSION AND UPSAMPLING */ |
| 24 |
| 25 | #include "jsimd_altivec.h" |
| 26 |
| 27 |
| 28 | #define F_0_344 22554 /* FIX(0.34414) */ |
| 29 | #define F_0_714 46802 /* FIX(0.71414) */ |
| 30 | #define F_1_402 91881 /* FIX(1.40200) */ |
| 31 | #define F_1_772 116130 /* FIX(1.77200) */ |
| 32 | #define F_0_402 (F_1_402 - 65536) /* FIX(1.40200) - FIX(1) */ |
| 33 | #define F_0_285 (65536 - F_0_714) /* FIX(1) - FIX(0.71414) */ |
| 34 | #define F_0_228 (131072 - F_1_772) /* FIX(2) - FIX(1.77200) */ |
| 35 |
| 36 | #define SCALEBITS 16 |
| 37 | #define ONE_HALF (1 << (SCALEBITS - 1)) |
| 38 |
| 39 | #define RGB_INDEX0 \ |
| 40 | { 0, 1, 8, 2, 3, 10, 4, 5, 12, 6, 7, 14, 16, 17, 24, 18 } |
| 41 | #define RGB_INDEX1 \ |
| 42 | { 3, 10, 4, 5, 12, 6, 7, 14, 16, 17, 24, 18, 19, 26, 20, 21 } |
| 43 | #define RGB_INDEX2 \ |
| 44 | { 12, 6, 7, 14, 16, 17, 24, 18, 19, 26, 20, 21, 28, 22, 23, 30 } |
| 45 | #include "jdmrgext-altivec.c" |
| 46 | #undef RGB_PIXELSIZE |
| 47 |
| 48 | #define RGB_PIXELSIZE EXT_RGB_PIXELSIZE |
| 49 | #define jsimd_h2v1_merged_upsample_altivec \ |
| 50 | jsimd_h2v1_extrgb_merged_upsample_altivec |
| 51 | #define jsimd_h2v2_merged_upsample_altivec \ |
| 52 | jsimd_h2v2_extrgb_merged_upsample_altivec |
| 53 | #include "jdmrgext-altivec.c" |
| 54 | #undef RGB_PIXELSIZE |
| 55 | #undef RGB_INDEX0 |
| 56 | #undef RGB_INDEX1 |
| 57 | #undef RGB_INDEX2 |
| 58 | #undef jsimd_h2v1_merged_upsample_altivec |
| 59 | #undef jsimd_h2v2_merged_upsample_altivec |
| 60 |
| 61 | #define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE |
| 62 | #define RGB_INDEX \ |
| 63 | { 0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15 } |
| 64 | #define jsimd_h2v1_merged_upsample_altivec \ |
| 65 | jsimd_h2v1_extrgbx_merged_upsample_altivec |
| 66 | #define jsimd_h2v2_merged_upsample_altivec \ |
| 67 | jsimd_h2v2_extrgbx_merged_upsample_altivec |
| 68 | #include "jdmrgext-altivec.c" |
| 69 | #undef RGB_PIXELSIZE |
| 70 | #undef RGB_INDEX |
| 71 | #undef jsimd_h2v1_merged_upsample_altivec |
| 72 | #undef jsimd_h2v2_merged_upsample_altivec |
| 73 |
| 74 | #define RGB_PIXELSIZE EXT_BGR_PIXELSIZE |
| 75 | #define RGB_INDEX0 \ |
| 76 | { 8, 1, 0, 10, 3, 2, 12, 5, 4, 14, 7, 6, 24, 17, 16, 26 } |
| 77 | #define RGB_INDEX1 \ |
| 78 | { 3, 2, 12, 5, 4, 14, 7, 6, 24, 17, 16, 26, 19, 18, 28, 21 } |
| 79 | #define RGB_INDEX2 \ |
| 80 | { 4, 14, 7, 6, 24, 17, 16, 26, 19, 18, 28, 21, 20, 30, 23, 22 } |
| 81 | #define jsimd_h2v1_merged_upsample_altivec \ |
| 82 | jsimd_h2v1_extbgr_merged_upsample_altivec |
| 83 | #define jsimd_h2v2_merged_upsample_altivec \ |
| 84 | jsimd_h2v2_extbgr_merged_upsample_altivec |
| 85 | #include "jdmrgext-altivec.c" |
| 86 | #undef RGB_PIXELSIZE |
| 87 | #undef RGB_INDEX0 |
| 88 | #undef RGB_INDEX1 |
| 89 | #undef RGB_INDEX2 |
| 90 | #undef jsimd_h2v1_merged_upsample_altivec |
| 91 | #undef jsimd_h2v2_merged_upsample_altivec |
| 92 |
| 93 | #define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE |
| 94 | #define RGB_INDEX \ |
| 95 | { 8, 1, 0, 9, 10, 3, 2, 11, 12, 5, 4, 13, 14, 7, 6, 15 } |
| 96 | #define jsimd_h2v1_merged_upsample_altivec \ |
| 97 | jsimd_h2v1_extbgrx_merged_upsample_altivec |
| 98 | #define jsimd_h2v2_merged_upsample_altivec \ |
| 99 | jsimd_h2v2_extbgrx_merged_upsample_altivec |
| 100 | #include "jdmrgext-altivec.c" |
| 101 | #undef RGB_PIXELSIZE |
| 102 | #undef RGB_INDEX |
| 103 | #undef jsimd_h2v1_merged_upsample_altivec |
| 104 | #undef jsimd_h2v2_merged_upsample_altivec |
| 105 |
| 106 | #define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE |
| 107 | #define RGB_INDEX \ |
| 108 | { 9, 8, 1, 0, 11, 10, 3, 2, 13, 12, 5, 4, 15, 14, 7, 6 } |
| 109 | #define jsimd_h2v1_merged_upsample_altivec \ |
| 110 | jsimd_h2v1_extxbgr_merged_upsample_altivec |
| 111 | #define jsimd_h2v2_merged_upsample_altivec \ |
| 112 | jsimd_h2v2_extxbgr_merged_upsample_altivec |
| 113 | #include "jdmrgext-altivec.c" |
| 114 | #undef RGB_PIXELSIZE |
| 115 | #undef RGB_INDEX |
| 116 | #undef jsimd_h2v1_merged_upsample_altivec |
| 117 | #undef jsimd_h2v2_merged_upsample_altivec |
| 118 |
| 119 | #define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE |
| 120 | #define RGB_INDEX \ |
| 121 | { 9, 0, 1, 8, 11, 2, 3, 10, 13, 4, 5, 12, 15, 6, 7, 14 } |
| 122 | #define jsimd_h2v1_merged_upsample_altivec \ |
| 123 | jsimd_h2v1_extxrgb_merged_upsample_altivec |
| 124 | #define jsimd_h2v2_merged_upsample_altivec \ |
| 125 | jsimd_h2v2_extxrgb_merged_upsample_altivec |
| 126 | #include "jdmrgext-altivec.c" |
| 127 | #undef RGB_PIXELSIZE |
| 128 | #undef RGB_INDEX |
| 129 | #undef jsimd_h2v1_merged_upsample_altivec |
| 130 | #undef jsimd_h2v2_merged_upsample_altivec |
| 131 |