1;
2; jcgray.asm - grayscale colorspace conversion (MMX)
3;
4; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
5; Copyright (C) 2011, D. R. Commander.
6;
7; Based on the x86 SIMD extension for IJG JPEG library
8; Copyright (C) 1999-2006, MIYASAKA Masaru.
9; For conditions of distribution and use, see copyright notice in jsimdext.inc
10;
11; This file should be assembled with NASM (Netwide Assembler),
12; can *not* be assembled with Microsoft's MASM or any compatible
13; assembler (including Borland's Turbo Assembler).
14; NASM is available from http://nasm.sourceforge.net/ or
15; http://sourceforge.net/project/showfiles.php?group_id=6208
16;
17; [TAB8]
18
19%include "jsimdext.inc"
20
21; --------------------------------------------------------------------------
22
23%define SCALEBITS       16
24
25F_0_114 equ      7471                   ; FIX(0.11400)
26F_0_250 equ     16384                   ; FIX(0.25000)
27F_0_299 equ     19595                   ; FIX(0.29900)
28F_0_587 equ     38470                   ; FIX(0.58700)
29F_0_337 equ     (F_0_587 - F_0_250)     ; FIX(0.58700) - FIX(0.25000)
30
31; --------------------------------------------------------------------------
32        SECTION SEG_CONST
33
34        alignz  16
35        global  EXTN(jconst_rgb_gray_convert_mmx)
36
37EXTN(jconst_rgb_gray_convert_mmx):
38
39PW_F0299_F0337  times 2 dw  F_0_299, F_0_337
40PW_F0114_F0250  times 2 dw  F_0_114, F_0_250
41PD_ONEHALF      times 2 dd  (1 << (SCALEBITS-1))
42
43        alignz  16
44
45; --------------------------------------------------------------------------
46        SECTION SEG_TEXT
47        BITS    32
48
49%include "jcgryext-mmx.asm"
50
51%undef RGB_RED
52%undef RGB_GREEN
53%undef RGB_BLUE
54%undef RGB_PIXELSIZE
55%define RGB_RED EXT_RGB_RED
56%define RGB_GREEN EXT_RGB_GREEN
57%define RGB_BLUE EXT_RGB_BLUE
58%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
59%define jsimd_rgb_gray_convert_mmx jsimd_extrgb_gray_convert_mmx
60%include "jcgryext-mmx.asm"
61
62%undef RGB_RED
63%undef RGB_GREEN
64%undef RGB_BLUE
65%undef RGB_PIXELSIZE
66%define RGB_RED EXT_RGBX_RED
67%define RGB_GREEN EXT_RGBX_GREEN
68%define RGB_BLUE EXT_RGBX_BLUE
69%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
70%define jsimd_rgb_gray_convert_mmx jsimd_extrgbx_gray_convert_mmx
71%include "jcgryext-mmx.asm"
72
73%undef RGB_RED
74%undef RGB_GREEN
75%undef RGB_BLUE
76%undef RGB_PIXELSIZE
77%define RGB_RED EXT_BGR_RED
78%define RGB_GREEN EXT_BGR_GREEN
79%define RGB_BLUE EXT_BGR_BLUE
80%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
81%define jsimd_rgb_gray_convert_mmx jsimd_extbgr_gray_convert_mmx
82%include "jcgryext-mmx.asm"
83
84%undef RGB_RED
85%undef RGB_GREEN
86%undef RGB_BLUE
87%undef RGB_PIXELSIZE
88%define RGB_RED EXT_BGRX_RED
89%define RGB_GREEN EXT_BGRX_GREEN
90%define RGB_BLUE EXT_BGRX_BLUE
91%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
92%define jsimd_rgb_gray_convert_mmx jsimd_extbgrx_gray_convert_mmx
93%include "jcgryext-mmx.asm"
94
95%undef RGB_RED
96%undef RGB_GREEN
97%undef RGB_BLUE
98%undef RGB_PIXELSIZE
99%define RGB_RED EXT_XBGR_RED
100%define RGB_GREEN EXT_XBGR_GREEN
101%define RGB_BLUE EXT_XBGR_BLUE
102%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
103%define jsimd_rgb_gray_convert_mmx jsimd_extxbgr_gray_convert_mmx
104%include "jcgryext-mmx.asm"
105
106%undef RGB_RED
107%undef RGB_GREEN
108%undef RGB_BLUE
109%undef RGB_PIXELSIZE
110%define RGB_RED EXT_XRGB_RED
111%define RGB_GREEN EXT_XRGB_GREEN
112%define RGB_BLUE EXT_XRGB_BLUE
113%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
114%define jsimd_rgb_gray_convert_mmx jsimd_extxrgb_gray_convert_mmx
115%include "jcgryext-mmx.asm"
116