1 ; 2 ; jcgray.asm - grayscale colorspace conversion (SSE2) 3 ; 4 ; Copyright (C) 2011, D. R. Commander. 5 ; 6 ; Based on the x86 SIMD extension for IJG JPEG library 7 ; Copyright (C) 1999-2006, MIYASAKA Masaru. 8 ; For conditions of distribution and use, see copyright notice in jsimdext.inc 9 ; 10 ; This file should be assembled with NASM (Netwide Assembler), 11 ; can *not* be assembled with Microsoft's MASM or any compatible 12 ; assembler (including Borland's Turbo Assembler). 13 ; NASM is available from http://nasm.sourceforge.net/ or 14 ; http://sourceforge.net/project/showfiles.php?group_id=6208 15 ; 16 ; [TAB8] 17 18 %include "jsimdext.inc" 19 20 ; -------------------------------------------------------------------------- 21 22 %define SCALEBITS 16 23 24 F_0_114 equ 7471 ; FIX(0.11400) 25 F_0_250 equ 16384 ; FIX(0.25000) 26 F_0_299 equ 19595 ; FIX(0.29900) 27 F_0_587 equ 38470 ; FIX(0.58700) 28 F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) 29 30 ; -------------------------------------------------------------------------- 31 SECTION SEG_CONST 32 33 alignz 16 34 global EXTN(jconst_rgb_gray_convert_sse2) 35 36 EXTN(jconst_rgb_gray_convert_sse2): 37 38 PW_F0299_F0337 times 4 dw F_0_299, F_0_337 39 PW_F0114_F0250 times 4 dw F_0_114, F_0_250 40 PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) 41 42 alignz 16 43 44 ; -------------------------------------------------------------------------- 45 SECTION SEG_TEXT 46 BITS 32 47 48 %include "jcgryext-sse2.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_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2 59 %include "jcgryext-sse2.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_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2 70 %include "jcgryext-sse2.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_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2 81 %include "jcgryext-sse2.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_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2 92 %include "jcgryext-sse2.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_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2 103 %include "jcgryext-sse2.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_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2 114 %include "jcgryext-sse2.asm" 115