Hash :
a2e6a9dd
Author :
Date :
2006-02-04T00:00:00
IJG R6b with x86SIMD V1.02 Independent JPEG Group's JPEG software release 6b with x86 SIMD extension for IJG JPEG library version 1.02
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
;
; jfdctflt.asm - floating-point FDCT (non-SIMD)
;
; x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; This file contains a floating-point implementation of the forward DCT
; (Discrete Cosine Transform). The following code is based directly on
; the IJG's original jfdctflt.c; see the jfdctflt.c for more details.
;
; Last Modified : October 17, 2004
;
; [TAB8]
%include "jsimdext.inc"
%include "jdct.inc"
%ifdef DCT_FLOAT_SUPPORTED
; This module is specialized to the case DCTSIZE = 8.
;
%if DCTSIZE != 8
%error "Sorry, this code only copes with 8x8 DCTs."
%endif
; --------------------------------------------------------------------------
SECTION SEG_CONST
%define ROTATOR_TYPE FP32 ; float
alignz 16
global EXTN(jconst_fdct_float)
EXTN(jconst_fdct_float):
F_0_382 dd 0.382683432365089771728460 ; cos(PI*3/8)
F_0_707 dd 0.707106781186547524400844 ; cos(PI*1/4)
F_0_541 dd 0.541196100146196984399723 ; cos(PI*1/8)-cos(PI*3/8)
F_1_306 dd 1.306562964876376527856643 ; cos(PI*1/8)+cos(PI*3/8)
alignz 16
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 32
;
; Perform the forward DCT on one block of samples.
;
; GLOBAL(void)
; jpeg_fdct_float (FAST_FLOAT * data)
;
%define data(b) (b)+8 ; FAST_FLOAT * data
align 16
global EXTN(jpeg_fdct_float)
EXTN(jpeg_fdct_float):
push ebp
mov ebp,esp
pushpic ebx
; push ecx ; need not be preserved
; push edx ; need not be preserved
; push esi ; unused
; push edi ; unused
get_GOT ebx ; get GOT address
; ---- Pass 1: process rows.
mov edx, POINTER [data(ebp)] ; (FAST_FLOAT *)
mov ecx, DCTSIZE
alignx 16,7
.rowloop:
fld FAST_FLOAT [ROW(1,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [ROW(6,edx,SIZEOF_FAST_FLOAT)]
fld FAST_FLOAT [ROW(0,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [ROW(7,edx,SIZEOF_FAST_FLOAT)]
fld FAST_FLOAT [ROW(3,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [ROW(4,edx,SIZEOF_FAST_FLOAT)]
fld FAST_FLOAT [ROW(2,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [ROW(5,edx,SIZEOF_FAST_FLOAT)]
; -- Even part
fld st2 ; st2 = st2 + st1, st1 = st2 - st1
fsub st0,st2
fxch st0,st2
faddp st3,st0
fld st3 ; st3 = st3 + st0, st0 = st3 - st0
fsub st0,st1
fxch st0,st1
faddp st4,st0
fadd st0,st1
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_707)]
fld st2 ; st3 = st2 + st3, st2 = st2 - st3
fsub st0,st4
fxch st0,st3
faddp st4,st0
fld st1 ; st0 = st1 + st0, st1 = st1 - st0
fsub st0,st1
fxch st0,st2
faddp st1,st0
fld FAST_FLOAT [ROW(0,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [ROW(7,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fld FAST_FLOAT [ROW(3,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [ROW(4,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fld FAST_FLOAT [ROW(1,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [ROW(6,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fld FAST_FLOAT [ROW(2,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [ROW(5,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fstp FAST_FLOAT [ROW(2,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [ROW(6,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [ROW(4,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [ROW(0,edx,SIZEOF_FAST_FLOAT)]
; -- Odd part
fadd st2,st0
fadd st0,st1
fxch st0,st3
fadd st1,st0
fxch st0,st3
fld st2
fxch st0,st1
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_707)]
fxch st0,st1
fsub st0,st2
fxch st0,st3
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_541)]
fxch st0,st3
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_382)]
fxch st0,st2
fmul ROTATOR_TYPE [GOTOFF(ebx,F_1_306)]
fxch st0,st2
fadd st3,st0
faddp st2,st0
fld st3 ; st3 = st3 + st0, st0 = st3 - st0
fsub st0,st1
fxch st0,st1
faddp st4,st0
fld st2 ; st0 = st0 + st2, st2 = st0 - st2
fsubr st0,st1
fxch st0,st3
faddp st1,st0
fld st1 ; st3 = st3 + st1, st1 = st3 - st1
fsubr st0,st4
fxch st0,st2
faddp st4,st0
fstp FAST_FLOAT [ROW(5,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [ROW(7,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [ROW(3,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [ROW(1,edx,SIZEOF_FAST_FLOAT)]
add edx, byte DCTSIZE*SIZEOF_FAST_FLOAT
dec ecx ; advance pointer to next row
jnz near .rowloop
; ---- Pass 2: process columns.
mov edx, POINTER [data(ebp)] ; (FAST_FLOAT *)
mov ecx, DCTSIZE
alignx 16,7
.columnloop:
fld FAST_FLOAT [COL(1,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [COL(6,edx,SIZEOF_FAST_FLOAT)]
fld FAST_FLOAT [COL(0,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [COL(7,edx,SIZEOF_FAST_FLOAT)]
fld FAST_FLOAT [COL(3,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [COL(4,edx,SIZEOF_FAST_FLOAT)]
fld FAST_FLOAT [COL(2,edx,SIZEOF_FAST_FLOAT)]
fadd FAST_FLOAT [COL(5,edx,SIZEOF_FAST_FLOAT)]
; -- Even part
fld st2 ; st2 = st2 + st1, st1 = st2 - st1
fsub st0,st2
fxch st0,st2
faddp st3,st0
fld st3 ; st3 = st3 + st0, st0 = st3 - st0
fsub st0,st1
fxch st0,st1
faddp st4,st0
fadd st0,st1
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_707)]
fld st2 ; st3 = st2 + st3, st2 = st2 - st3
fsub st0,st4
fxch st0,st3
faddp st4,st0
fld st1 ; st0 = st1 + st0, st1 = st1 - st0
fsub st0,st1
fxch st0,st2
faddp st1,st0
fld FAST_FLOAT [COL(0,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [COL(7,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fld FAST_FLOAT [COL(3,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [COL(4,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fld FAST_FLOAT [COL(1,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [COL(6,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fld FAST_FLOAT [COL(2,edx,SIZEOF_FAST_FLOAT)]
fsub FAST_FLOAT [COL(5,edx,SIZEOF_FAST_FLOAT)]
fxch st0,st4
fstp FAST_FLOAT [COL(2,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [COL(6,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [COL(4,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [COL(0,edx,SIZEOF_FAST_FLOAT)]
; -- Odd part
fadd st2,st0
fadd st0,st1
fxch st0,st3
fadd st1,st0
fxch st0,st3
fld st2
fxch st0,st1
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_707)]
fxch st0,st1
fsub st0,st2
fxch st0,st3
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_541)]
fxch st0,st3
fmul ROTATOR_TYPE [GOTOFF(ebx,F_0_382)]
fxch st0,st2
fmul ROTATOR_TYPE [GOTOFF(ebx,F_1_306)]
fxch st0,st2
fadd st3,st0
faddp st2,st0
fld st3 ; st3 = st3 + st0, st0 = st3 - st0
fsub st0,st1
fxch st0,st1
faddp st4,st0
fld st2 ; st0 = st0 + st2, st2 = st0 - st2
fsubr st0,st1
fxch st0,st3
faddp st1,st0
fld st1 ; st3 = st3 + st1, st1 = st3 - st1
fsubr st0,st4
fxch st0,st2
faddp st4,st0
fstp FAST_FLOAT [COL(5,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [COL(7,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [COL(3,edx,SIZEOF_FAST_FLOAT)]
fstp FAST_FLOAT [COL(1,edx,SIZEOF_FAST_FLOAT)]
add edx, byte SIZEOF_FAST_FLOAT ; advance pointer to next column
dec ecx
jnz near .columnloop
; pop edi ; unused
; pop esi ; unused
; pop edx ; need not be preserved
; pop ecx ; need not be preserved
poppic ebx
pop ebp
ret
%endif ; DCT_FLOAT_SUPPORTED