jdcolor-avx2.asm (3341B)
1 ; 2 ; jdcolor.asm - colorspace conversion (64-bit AVX2) 3 ; 4 ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB 5 ; Copyright (C) 2009, 2016, 2024, D. R. Commander. 6 ; Copyright (C) 2015, Intel Corporation. 7 ; 8 ; Based on the x86 SIMD extension for IJG JPEG library 9 ; Copyright (C) 1999-2006, MIYASAKA Masaru. 10 ; For conditions of distribution and use, see copyright notice in jsimdext.inc 11 ; 12 ; This file should be assembled with NASM (Netwide Assembler) or Yasm. 13 14 %include "jsimdext.inc" 15 16 ; -------------------------------------------------------------------------- 17 18 %define SCALEBITS 16 19 20 F_0_344 equ 22554 ; FIX(0.34414) 21 F_0_714 equ 46802 ; FIX(0.71414) 22 F_1_402 equ 91881 ; FIX(1.40200) 23 F_1_772 equ 116130 ; FIX(1.77200) 24 F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) 25 F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) 26 F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) 27 28 ; -------------------------------------------------------------------------- 29 SECTION SEG_CONST 30 31 ALIGNZ 32 32 GLOBAL_DATA(jconst_ycc_rgb_convert_avx2) 33 34 EXTN(jconst_ycc_rgb_convert_avx2): 35 36 PW_F0402 times 16 dw F_0_402 37 PW_MF0228 times 16 dw -F_0_228 38 PW_MF0344_F0285 times 8 dw -F_0_344, F_0_285 39 PW_ONE times 16 dw 1 40 PD_ONEHALF times 8 dd 1 << (SCALEBITS - 1) 41 42 ALIGNZ 32 43 44 ; -------------------------------------------------------------------------- 45 SECTION SEG_TEXT 46 BITS 64 47 48 %include "jdcolext-avx2.asm" 49 50 %undef RGB_RED 51 %undef RGB_GREEN 52 %undef RGB_BLUE 53 %undef RGB_PIXELSIZE 54 %define RGB_RED EXT_RGB_RED 55 %define RGB_GREEN EXT_RGB_GREEN 56 %define RGB_BLUE EXT_RGB_BLUE 57 %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE 58 %define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extrgb_convert_avx2 59 %include "jdcolext-avx2.asm" 60 61 %undef RGB_RED 62 %undef RGB_GREEN 63 %undef RGB_BLUE 64 %undef RGB_PIXELSIZE 65 %define RGB_RED EXT_RGBX_RED 66 %define RGB_GREEN EXT_RGBX_GREEN 67 %define RGB_BLUE EXT_RGBX_BLUE 68 %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE 69 %define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extrgbx_convert_avx2 70 %include "jdcolext-avx2.asm" 71 72 %undef RGB_RED 73 %undef RGB_GREEN 74 %undef RGB_BLUE 75 %undef RGB_PIXELSIZE 76 %define RGB_RED EXT_BGR_RED 77 %define RGB_GREEN EXT_BGR_GREEN 78 %define RGB_BLUE EXT_BGR_BLUE 79 %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE 80 %define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extbgr_convert_avx2 81 %include "jdcolext-avx2.asm" 82 83 %undef RGB_RED 84 %undef RGB_GREEN 85 %undef RGB_BLUE 86 %undef RGB_PIXELSIZE 87 %define RGB_RED EXT_BGRX_RED 88 %define RGB_GREEN EXT_BGRX_GREEN 89 %define RGB_BLUE EXT_BGRX_BLUE 90 %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE 91 %define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extbgrx_convert_avx2 92 %include "jdcolext-avx2.asm" 93 94 %undef RGB_RED 95 %undef RGB_GREEN 96 %undef RGB_BLUE 97 %undef RGB_PIXELSIZE 98 %define RGB_RED EXT_XBGR_RED 99 %define RGB_GREEN EXT_XBGR_GREEN 100 %define RGB_BLUE EXT_XBGR_BLUE 101 %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE 102 %define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extxbgr_convert_avx2 103 %include "jdcolext-avx2.asm" 104 105 %undef RGB_RED 106 %undef RGB_GREEN 107 %undef RGB_BLUE 108 %undef RGB_PIXELSIZE 109 %define RGB_RED EXT_XRGB_RED 110 %define RGB_GREEN EXT_XRGB_GREEN 111 %define RGB_BLUE EXT_XRGB_BLUE 112 %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE 113 %define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extxrgb_convert_avx2 114 %include "jdcolext-avx2.asm"