media/libjpeg/simd/jsimd_x86_64.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * jsimd_x86_64.c
michael@0 3 *
michael@0 4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
michael@0 5 * Copyright 2009-2011 D. R. Commander
michael@0 6 *
michael@0 7 * Based on the x86 SIMD extension for IJG JPEG library,
michael@0 8 * Copyright (C) 1999-2006, MIYASAKA Masaru.
michael@0 9 * For conditions of distribution and use, see copyright notice in jsimdext.inc
michael@0 10 *
michael@0 11 * This file contains the interface between the "normal" portions
michael@0 12 * of the library and the SIMD implementations when running on a
michael@0 13 * x86_64 architecture.
michael@0 14 */
michael@0 15
michael@0 16 #define JPEG_INTERNALS
michael@0 17 #include "../jinclude.h"
michael@0 18 #include "../jpeglib.h"
michael@0 19 #include "../jsimd.h"
michael@0 20 #include "../jdct.h"
michael@0 21 #include "../jsimddct.h"
michael@0 22 #include "jsimd.h"
michael@0 23
michael@0 24 /*
michael@0 25 * In the PIC cases, we have no guarantee that constants will keep
michael@0 26 * their alignment. This macro allows us to verify it at runtime.
michael@0 27 */
michael@0 28 #define IS_ALIGNED(ptr, order) (((size_t)ptr & ((1 << order) - 1)) == 0)
michael@0 29
michael@0 30 #define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
michael@0 31
michael@0 32 GLOBAL(int)
michael@0 33 jsimd_can_rgb_ycc (void)
michael@0 34 {
michael@0 35 /* The code is optimised for these values only */
michael@0 36 if (BITS_IN_JSAMPLE != 8)
michael@0 37 return 0;
michael@0 38 if (sizeof(JDIMENSION) != 4)
michael@0 39 return 0;
michael@0 40 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
michael@0 41 return 0;
michael@0 42
michael@0 43 if (!IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
michael@0 44 return 0;
michael@0 45
michael@0 46 return 1;
michael@0 47 }
michael@0 48
michael@0 49 GLOBAL(int)
michael@0 50 jsimd_can_rgb_gray (void)
michael@0 51 {
michael@0 52 /* The code is optimised for these values only */
michael@0 53 if (BITS_IN_JSAMPLE != 8)
michael@0 54 return 0;
michael@0 55 if (sizeof(JDIMENSION) != 4)
michael@0 56 return 0;
michael@0 57 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
michael@0 58 return 0;
michael@0 59
michael@0 60 if (!IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2))
michael@0 61 return 0;
michael@0 62
michael@0 63 return 1;
michael@0 64 }
michael@0 65
michael@0 66 GLOBAL(int)
michael@0 67 jsimd_can_ycc_rgb (void)
michael@0 68 {
michael@0 69 /* The code is optimised for these values only */
michael@0 70 if (BITS_IN_JSAMPLE != 8)
michael@0 71 return 0;
michael@0 72 if (sizeof(JDIMENSION) != 4)
michael@0 73 return 0;
michael@0 74 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
michael@0 75 return 0;
michael@0 76
michael@0 77 if (!IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
michael@0 78 return 0;
michael@0 79
michael@0 80 return 1;
michael@0 81 }
michael@0 82
michael@0 83 GLOBAL(void)
michael@0 84 jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
michael@0 85 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
michael@0 86 JDIMENSION output_row, int num_rows)
michael@0 87 {
michael@0 88 void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
michael@0 89
michael@0 90 switch(cinfo->in_color_space)
michael@0 91 {
michael@0 92 case JCS_EXT_RGB:
michael@0 93 sse2fct=jsimd_extrgb_ycc_convert_sse2;
michael@0 94 break;
michael@0 95 case JCS_EXT_RGBX:
michael@0 96 case JCS_EXT_RGBA:
michael@0 97 sse2fct=jsimd_extrgbx_ycc_convert_sse2;
michael@0 98 break;
michael@0 99 case JCS_EXT_BGR:
michael@0 100 sse2fct=jsimd_extbgr_ycc_convert_sse2;
michael@0 101 break;
michael@0 102 case JCS_EXT_BGRX:
michael@0 103 case JCS_EXT_BGRA:
michael@0 104 sse2fct=jsimd_extbgrx_ycc_convert_sse2;
michael@0 105 break;
michael@0 106 case JCS_EXT_XBGR:
michael@0 107 case JCS_EXT_ABGR:
michael@0 108 sse2fct=jsimd_extxbgr_ycc_convert_sse2;
michael@0 109 break;
michael@0 110 case JCS_EXT_XRGB:
michael@0 111 case JCS_EXT_ARGB:
michael@0 112 sse2fct=jsimd_extxrgb_ycc_convert_sse2;
michael@0 113 break;
michael@0 114 default:
michael@0 115 sse2fct=jsimd_rgb_ycc_convert_sse2;
michael@0 116 break;
michael@0 117 }
michael@0 118
michael@0 119 sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
michael@0 120 }
michael@0 121
michael@0 122 GLOBAL(void)
michael@0 123 jsimd_rgb_gray_convert (j_compress_ptr cinfo,
michael@0 124 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
michael@0 125 JDIMENSION output_row, int num_rows)
michael@0 126 {
michael@0 127 void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
michael@0 128
michael@0 129 switch(cinfo->in_color_space)
michael@0 130 {
michael@0 131 case JCS_EXT_RGB:
michael@0 132 sse2fct=jsimd_extrgb_gray_convert_sse2;
michael@0 133 break;
michael@0 134 case JCS_EXT_RGBX:
michael@0 135 case JCS_EXT_RGBA:
michael@0 136 sse2fct=jsimd_extrgbx_gray_convert_sse2;
michael@0 137 break;
michael@0 138 case JCS_EXT_BGR:
michael@0 139 sse2fct=jsimd_extbgr_gray_convert_sse2;
michael@0 140 break;
michael@0 141 case JCS_EXT_BGRX:
michael@0 142 case JCS_EXT_BGRA:
michael@0 143 sse2fct=jsimd_extbgrx_gray_convert_sse2;
michael@0 144 break;
michael@0 145 case JCS_EXT_XBGR:
michael@0 146 case JCS_EXT_ABGR:
michael@0 147 sse2fct=jsimd_extxbgr_gray_convert_sse2;
michael@0 148 break;
michael@0 149 case JCS_EXT_XRGB:
michael@0 150 case JCS_EXT_ARGB:
michael@0 151 sse2fct=jsimd_extxrgb_gray_convert_sse2;
michael@0 152 break;
michael@0 153 default:
michael@0 154 sse2fct=jsimd_rgb_gray_convert_sse2;
michael@0 155 break;
michael@0 156 }
michael@0 157
michael@0 158 sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
michael@0 159 }
michael@0 160
michael@0 161 GLOBAL(void)
michael@0 162 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
michael@0 163 JSAMPIMAGE input_buf, JDIMENSION input_row,
michael@0 164 JSAMPARRAY output_buf, int num_rows)
michael@0 165 {
michael@0 166 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
michael@0 167
michael@0 168 switch(cinfo->out_color_space)
michael@0 169 {
michael@0 170 case JCS_EXT_RGB:
michael@0 171 sse2fct=jsimd_ycc_extrgb_convert_sse2;
michael@0 172 break;
michael@0 173 case JCS_EXT_RGBX:
michael@0 174 case JCS_EXT_RGBA:
michael@0 175 sse2fct=jsimd_ycc_extrgbx_convert_sse2;
michael@0 176 break;
michael@0 177 case JCS_EXT_BGR:
michael@0 178 sse2fct=jsimd_ycc_extbgr_convert_sse2;
michael@0 179 break;
michael@0 180 case JCS_EXT_BGRX:
michael@0 181 case JCS_EXT_BGRA:
michael@0 182 sse2fct=jsimd_ycc_extbgrx_convert_sse2;
michael@0 183 break;
michael@0 184 case JCS_EXT_XBGR:
michael@0 185 case JCS_EXT_ABGR:
michael@0 186 sse2fct=jsimd_ycc_extxbgr_convert_sse2;
michael@0 187 break;
michael@0 188 case JCS_EXT_XRGB:
michael@0 189 case JCS_EXT_ARGB:
michael@0 190 sse2fct=jsimd_ycc_extxrgb_convert_sse2;
michael@0 191 break;
michael@0 192 default:
michael@0 193 sse2fct=jsimd_ycc_rgb_convert_sse2;
michael@0 194 break;
michael@0 195 }
michael@0 196
michael@0 197 sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
michael@0 198 }
michael@0 199
michael@0 200 GLOBAL(int)
michael@0 201 jsimd_can_h2v2_downsample (void)
michael@0 202 {
michael@0 203 /* The code is optimised for these values only */
michael@0 204 if (BITS_IN_JSAMPLE != 8)
michael@0 205 return 0;
michael@0 206 if (sizeof(JDIMENSION) != 4)
michael@0 207 return 0;
michael@0 208
michael@0 209 return 1;
michael@0 210 }
michael@0 211
michael@0 212 GLOBAL(int)
michael@0 213 jsimd_can_h2v1_downsample (void)
michael@0 214 {
michael@0 215 /* The code is optimised for these values only */
michael@0 216 if (BITS_IN_JSAMPLE != 8)
michael@0 217 return 0;
michael@0 218 if (sizeof(JDIMENSION) != 4)
michael@0 219 return 0;
michael@0 220
michael@0 221 return 1;
michael@0 222 }
michael@0 223
michael@0 224 GLOBAL(void)
michael@0 225 jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
michael@0 226 JSAMPARRAY input_data, JSAMPARRAY output_data)
michael@0 227 {
michael@0 228 jsimd_h2v2_downsample_sse2(cinfo->image_width,
michael@0 229 cinfo->max_v_samp_factor,
michael@0 230 compptr->v_samp_factor,
michael@0 231 compptr->width_in_blocks,
michael@0 232 input_data, output_data);
michael@0 233 }
michael@0 234
michael@0 235 GLOBAL(void)
michael@0 236 jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
michael@0 237 JSAMPARRAY input_data, JSAMPARRAY output_data)
michael@0 238 {
michael@0 239 jsimd_h2v1_downsample_sse2(cinfo->image_width,
michael@0 240 cinfo->max_v_samp_factor,
michael@0 241 compptr->v_samp_factor,
michael@0 242 compptr->width_in_blocks,
michael@0 243 input_data, output_data);
michael@0 244 }
michael@0 245
michael@0 246 GLOBAL(int)
michael@0 247 jsimd_can_h2v2_upsample (void)
michael@0 248 {
michael@0 249 /* The code is optimised for these values only */
michael@0 250 if (BITS_IN_JSAMPLE != 8)
michael@0 251 return 0;
michael@0 252 if (sizeof(JDIMENSION) != 4)
michael@0 253 return 0;
michael@0 254
michael@0 255 return 1;
michael@0 256 }
michael@0 257
michael@0 258 GLOBAL(int)
michael@0 259 jsimd_can_h2v1_upsample (void)
michael@0 260 {
michael@0 261 /* The code is optimised for these values only */
michael@0 262 if (BITS_IN_JSAMPLE != 8)
michael@0 263 return 0;
michael@0 264 if (sizeof(JDIMENSION) != 4)
michael@0 265 return 0;
michael@0 266
michael@0 267 return 1;
michael@0 268 }
michael@0 269
michael@0 270 GLOBAL(void)
michael@0 271 jsimd_h2v2_upsample (j_decompress_ptr cinfo,
michael@0 272 jpeg_component_info * compptr,
michael@0 273 JSAMPARRAY input_data,
michael@0 274 JSAMPARRAY * output_data_ptr)
michael@0 275 {
michael@0 276 jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor,
michael@0 277 cinfo->output_width,
michael@0 278 input_data, output_data_ptr);
michael@0 279 }
michael@0 280
michael@0 281 GLOBAL(void)
michael@0 282 jsimd_h2v1_upsample (j_decompress_ptr cinfo,
michael@0 283 jpeg_component_info * compptr,
michael@0 284 JSAMPARRAY input_data,
michael@0 285 JSAMPARRAY * output_data_ptr)
michael@0 286 {
michael@0 287 jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor,
michael@0 288 cinfo->output_width,
michael@0 289 input_data, output_data_ptr);
michael@0 290 }
michael@0 291
michael@0 292 GLOBAL(int)
michael@0 293 jsimd_can_h2v2_fancy_upsample (void)
michael@0 294 {
michael@0 295 /* The code is optimised for these values only */
michael@0 296 if (BITS_IN_JSAMPLE != 8)
michael@0 297 return 0;
michael@0 298 if (sizeof(JDIMENSION) != 4)
michael@0 299 return 0;
michael@0 300
michael@0 301 if (!IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
michael@0 302 return 0;
michael@0 303
michael@0 304 return 1;
michael@0 305 }
michael@0 306
michael@0 307 GLOBAL(int)
michael@0 308 jsimd_can_h2v1_fancy_upsample (void)
michael@0 309 {
michael@0 310 /* The code is optimised for these values only */
michael@0 311 if (BITS_IN_JSAMPLE != 8)
michael@0 312 return 0;
michael@0 313 if (sizeof(JDIMENSION) != 4)
michael@0 314 return 0;
michael@0 315
michael@0 316 if (!IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
michael@0 317 return 0;
michael@0 318
michael@0 319 return 1;
michael@0 320 }
michael@0 321
michael@0 322 GLOBAL(void)
michael@0 323 jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
michael@0 324 jpeg_component_info * compptr,
michael@0 325 JSAMPARRAY input_data,
michael@0 326 JSAMPARRAY * output_data_ptr)
michael@0 327 {
michael@0 328 jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor,
michael@0 329 compptr->downsampled_width,
michael@0 330 input_data, output_data_ptr);
michael@0 331 }
michael@0 332
michael@0 333 GLOBAL(void)
michael@0 334 jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
michael@0 335 jpeg_component_info * compptr,
michael@0 336 JSAMPARRAY input_data,
michael@0 337 JSAMPARRAY * output_data_ptr)
michael@0 338 {
michael@0 339 jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
michael@0 340 compptr->downsampled_width,
michael@0 341 input_data, output_data_ptr);
michael@0 342 }
michael@0 343
michael@0 344 GLOBAL(int)
michael@0 345 jsimd_can_h2v2_merged_upsample (void)
michael@0 346 {
michael@0 347 /* The code is optimised for these values only */
michael@0 348 if (BITS_IN_JSAMPLE != 8)
michael@0 349 return 0;
michael@0 350 if (sizeof(JDIMENSION) != 4)
michael@0 351 return 0;
michael@0 352
michael@0 353 if (!IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
michael@0 354 return 0;
michael@0 355
michael@0 356 return 1;
michael@0 357 }
michael@0 358
michael@0 359 GLOBAL(int)
michael@0 360 jsimd_can_h2v1_merged_upsample (void)
michael@0 361 {
michael@0 362 /* The code is optimised for these values only */
michael@0 363 if (BITS_IN_JSAMPLE != 8)
michael@0 364 return 0;
michael@0 365 if (sizeof(JDIMENSION) != 4)
michael@0 366 return 0;
michael@0 367
michael@0 368 if (!IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
michael@0 369 return 0;
michael@0 370
michael@0 371 return 1;
michael@0 372 }
michael@0 373
michael@0 374 GLOBAL(void)
michael@0 375 jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
michael@0 376 JSAMPIMAGE input_buf,
michael@0 377 JDIMENSION in_row_group_ctr,
michael@0 378 JSAMPARRAY output_buf)
michael@0 379 {
michael@0 380 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
michael@0 381
michael@0 382 switch(cinfo->out_color_space)
michael@0 383 {
michael@0 384 case JCS_EXT_RGB:
michael@0 385 sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2;
michael@0 386 break;
michael@0 387 case JCS_EXT_RGBX:
michael@0 388 case JCS_EXT_RGBA:
michael@0 389 sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2;
michael@0 390 break;
michael@0 391 case JCS_EXT_BGR:
michael@0 392 sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2;
michael@0 393 break;
michael@0 394 case JCS_EXT_BGRX:
michael@0 395 case JCS_EXT_BGRA:
michael@0 396 sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2;
michael@0 397 break;
michael@0 398 case JCS_EXT_XBGR:
michael@0 399 case JCS_EXT_ABGR:
michael@0 400 sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2;
michael@0 401 break;
michael@0 402 case JCS_EXT_XRGB:
michael@0 403 case JCS_EXT_ARGB:
michael@0 404 sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2;
michael@0 405 break;
michael@0 406 default:
michael@0 407 sse2fct=jsimd_h2v2_merged_upsample_sse2;
michael@0 408 break;
michael@0 409 }
michael@0 410
michael@0 411 sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
michael@0 412 }
michael@0 413
michael@0 414 GLOBAL(void)
michael@0 415 jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
michael@0 416 JSAMPIMAGE input_buf,
michael@0 417 JDIMENSION in_row_group_ctr,
michael@0 418 JSAMPARRAY output_buf)
michael@0 419 {
michael@0 420 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
michael@0 421
michael@0 422 switch(cinfo->out_color_space)
michael@0 423 {
michael@0 424 case JCS_EXT_RGB:
michael@0 425 sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2;
michael@0 426 break;
michael@0 427 case JCS_EXT_RGBX:
michael@0 428 case JCS_EXT_RGBA:
michael@0 429 sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2;
michael@0 430 break;
michael@0 431 case JCS_EXT_BGR:
michael@0 432 sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2;
michael@0 433 break;
michael@0 434 case JCS_EXT_BGRX:
michael@0 435 case JCS_EXT_BGRA:
michael@0 436 sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2;
michael@0 437 break;
michael@0 438 case JCS_EXT_XBGR:
michael@0 439 case JCS_EXT_ABGR:
michael@0 440 sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2;
michael@0 441 break;
michael@0 442 case JCS_EXT_XRGB:
michael@0 443 case JCS_EXT_ARGB:
michael@0 444 sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2;
michael@0 445 break;
michael@0 446 default:
michael@0 447 sse2fct=jsimd_h2v1_merged_upsample_sse2;
michael@0 448 break;
michael@0 449 }
michael@0 450
michael@0 451 sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
michael@0 452 }
michael@0 453
michael@0 454 GLOBAL(int)
michael@0 455 jsimd_can_convsamp (void)
michael@0 456 {
michael@0 457 /* The code is optimised for these values only */
michael@0 458 if (DCTSIZE != 8)
michael@0 459 return 0;
michael@0 460 if (BITS_IN_JSAMPLE != 8)
michael@0 461 return 0;
michael@0 462 if (sizeof(JDIMENSION) != 4)
michael@0 463 return 0;
michael@0 464 if (sizeof(DCTELEM) != 2)
michael@0 465 return 0;
michael@0 466
michael@0 467 return 1;
michael@0 468 }
michael@0 469
michael@0 470 GLOBAL(int)
michael@0 471 jsimd_can_convsamp_float (void)
michael@0 472 {
michael@0 473 /* The code is optimised for these values only */
michael@0 474 if (DCTSIZE != 8)
michael@0 475 return 0;
michael@0 476 if (BITS_IN_JSAMPLE != 8)
michael@0 477 return 0;
michael@0 478 if (sizeof(JDIMENSION) != 4)
michael@0 479 return 0;
michael@0 480 if (sizeof(FAST_FLOAT) != 4)
michael@0 481 return 0;
michael@0 482
michael@0 483 return 1;
michael@0 484 }
michael@0 485
michael@0 486 GLOBAL(void)
michael@0 487 jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
michael@0 488 DCTELEM * workspace)
michael@0 489 {
michael@0 490 jsimd_convsamp_sse2(sample_data, start_col, workspace);
michael@0 491 }
michael@0 492
michael@0 493 GLOBAL(void)
michael@0 494 jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
michael@0 495 FAST_FLOAT * workspace)
michael@0 496 {
michael@0 497 jsimd_convsamp_float_sse2(sample_data, start_col, workspace);
michael@0 498 }
michael@0 499
michael@0 500 GLOBAL(int)
michael@0 501 jsimd_can_fdct_islow (void)
michael@0 502 {
michael@0 503 /* The code is optimised for these values only */
michael@0 504 if (DCTSIZE != 8)
michael@0 505 return 0;
michael@0 506 if (sizeof(DCTELEM) != 2)
michael@0 507 return 0;
michael@0 508
michael@0 509 if (!IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
michael@0 510 return 0;
michael@0 511
michael@0 512 return 1;
michael@0 513 }
michael@0 514
michael@0 515 GLOBAL(int)
michael@0 516 jsimd_can_fdct_ifast (void)
michael@0 517 {
michael@0 518 /* The code is optimised for these values only */
michael@0 519 if (DCTSIZE != 8)
michael@0 520 return 0;
michael@0 521 if (sizeof(DCTELEM) != 2)
michael@0 522 return 0;
michael@0 523
michael@0 524 if (!IS_ALIGNED_SSE(jconst_fdct_ifast_sse2))
michael@0 525 return 0;
michael@0 526
michael@0 527 return 1;
michael@0 528 }
michael@0 529
michael@0 530 GLOBAL(int)
michael@0 531 jsimd_can_fdct_float (void)
michael@0 532 {
michael@0 533 /* The code is optimised for these values only */
michael@0 534 if (DCTSIZE != 8)
michael@0 535 return 0;
michael@0 536 if (sizeof(FAST_FLOAT) != 4)
michael@0 537 return 0;
michael@0 538
michael@0 539 if (!IS_ALIGNED_SSE(jconst_fdct_float_sse))
michael@0 540 return 0;
michael@0 541
michael@0 542 return 1;
michael@0 543 }
michael@0 544
michael@0 545 GLOBAL(void)
michael@0 546 jsimd_fdct_islow (DCTELEM * data)
michael@0 547 {
michael@0 548 jsimd_fdct_islow_sse2(data);
michael@0 549 }
michael@0 550
michael@0 551 GLOBAL(void)
michael@0 552 jsimd_fdct_ifast (DCTELEM * data)
michael@0 553 {
michael@0 554 jsimd_fdct_ifast_sse2(data);
michael@0 555 }
michael@0 556
michael@0 557 GLOBAL(void)
michael@0 558 jsimd_fdct_float (FAST_FLOAT * data)
michael@0 559 {
michael@0 560 jsimd_fdct_float_sse(data);
michael@0 561 }
michael@0 562
michael@0 563 GLOBAL(int)
michael@0 564 jsimd_can_quantize (void)
michael@0 565 {
michael@0 566 /* The code is optimised for these values only */
michael@0 567 if (DCTSIZE != 8)
michael@0 568 return 0;
michael@0 569 if (sizeof(JCOEF) != 2)
michael@0 570 return 0;
michael@0 571 if (sizeof(DCTELEM) != 2)
michael@0 572 return 0;
michael@0 573
michael@0 574 return 1;
michael@0 575 }
michael@0 576
michael@0 577 GLOBAL(int)
michael@0 578 jsimd_can_quantize_float (void)
michael@0 579 {
michael@0 580 /* The code is optimised for these values only */
michael@0 581 if (DCTSIZE != 8)
michael@0 582 return 0;
michael@0 583 if (sizeof(JCOEF) != 2)
michael@0 584 return 0;
michael@0 585 if (sizeof(FAST_FLOAT) != 4)
michael@0 586 return 0;
michael@0 587
michael@0 588 return 1;
michael@0 589 }
michael@0 590
michael@0 591 GLOBAL(void)
michael@0 592 jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
michael@0 593 DCTELEM * workspace)
michael@0 594 {
michael@0 595 jsimd_quantize_sse2(coef_block, divisors, workspace);
michael@0 596 }
michael@0 597
michael@0 598 GLOBAL(void)
michael@0 599 jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
michael@0 600 FAST_FLOAT * workspace)
michael@0 601 {
michael@0 602 jsimd_quantize_float_sse2(coef_block, divisors, workspace);
michael@0 603 }
michael@0 604
michael@0 605 GLOBAL(int)
michael@0 606 jsimd_can_idct_2x2 (void)
michael@0 607 {
michael@0 608 /* The code is optimised for these values only */
michael@0 609 if (DCTSIZE != 8)
michael@0 610 return 0;
michael@0 611 if (sizeof(JCOEF) != 2)
michael@0 612 return 0;
michael@0 613 if (BITS_IN_JSAMPLE != 8)
michael@0 614 return 0;
michael@0 615 if (sizeof(JDIMENSION) != 4)
michael@0 616 return 0;
michael@0 617 if (sizeof(ISLOW_MULT_TYPE) != 2)
michael@0 618 return 0;
michael@0 619
michael@0 620 if (!IS_ALIGNED_SSE(jconst_idct_red_sse2))
michael@0 621 return 0;
michael@0 622
michael@0 623 return 1;
michael@0 624 }
michael@0 625
michael@0 626 GLOBAL(int)
michael@0 627 jsimd_can_idct_4x4 (void)
michael@0 628 {
michael@0 629 /* The code is optimised for these values only */
michael@0 630 if (DCTSIZE != 8)
michael@0 631 return 0;
michael@0 632 if (sizeof(JCOEF) != 2)
michael@0 633 return 0;
michael@0 634 if (BITS_IN_JSAMPLE != 8)
michael@0 635 return 0;
michael@0 636 if (sizeof(JDIMENSION) != 4)
michael@0 637 return 0;
michael@0 638 if (sizeof(ISLOW_MULT_TYPE) != 2)
michael@0 639 return 0;
michael@0 640
michael@0 641 if (!IS_ALIGNED_SSE(jconst_idct_red_sse2))
michael@0 642 return 0;
michael@0 643
michael@0 644 return 1;
michael@0 645 }
michael@0 646
michael@0 647 GLOBAL(void)
michael@0 648 jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
michael@0 649 JCOEFPTR coef_block, JSAMPARRAY output_buf,
michael@0 650 JDIMENSION output_col)
michael@0 651 {
michael@0 652 jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col);
michael@0 653 }
michael@0 654
michael@0 655 GLOBAL(void)
michael@0 656 jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
michael@0 657 JCOEFPTR coef_block, JSAMPARRAY output_buf,
michael@0 658 JDIMENSION output_col)
michael@0 659 {
michael@0 660 jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col);
michael@0 661 }
michael@0 662
michael@0 663 GLOBAL(int)
michael@0 664 jsimd_can_idct_islow (void)
michael@0 665 {
michael@0 666 /* The code is optimised for these values only */
michael@0 667 if (DCTSIZE != 8)
michael@0 668 return 0;
michael@0 669 if (sizeof(JCOEF) != 2)
michael@0 670 return 0;
michael@0 671 if (BITS_IN_JSAMPLE != 8)
michael@0 672 return 0;
michael@0 673 if (sizeof(JDIMENSION) != 4)
michael@0 674 return 0;
michael@0 675 if (sizeof(ISLOW_MULT_TYPE) != 2)
michael@0 676 return 0;
michael@0 677
michael@0 678 if (!IS_ALIGNED_SSE(jconst_idct_islow_sse2))
michael@0 679 return 0;
michael@0 680
michael@0 681 return 1;
michael@0 682 }
michael@0 683
michael@0 684 GLOBAL(int)
michael@0 685 jsimd_can_idct_ifast (void)
michael@0 686 {
michael@0 687 /* The code is optimised for these values only */
michael@0 688 if (DCTSIZE != 8)
michael@0 689 return 0;
michael@0 690 if (sizeof(JCOEF) != 2)
michael@0 691 return 0;
michael@0 692 if (BITS_IN_JSAMPLE != 8)
michael@0 693 return 0;
michael@0 694 if (sizeof(JDIMENSION) != 4)
michael@0 695 return 0;
michael@0 696 if (sizeof(IFAST_MULT_TYPE) != 2)
michael@0 697 return 0;
michael@0 698 if (IFAST_SCALE_BITS != 2)
michael@0 699 return 0;
michael@0 700
michael@0 701 if (!IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
michael@0 702 return 0;
michael@0 703
michael@0 704 return 1;
michael@0 705 }
michael@0 706
michael@0 707 GLOBAL(int)
michael@0 708 jsimd_can_idct_float (void)
michael@0 709 {
michael@0 710 if (DCTSIZE != 8)
michael@0 711 return 0;
michael@0 712 if (sizeof(JCOEF) != 2)
michael@0 713 return 0;
michael@0 714 if (BITS_IN_JSAMPLE != 8)
michael@0 715 return 0;
michael@0 716 if (sizeof(JDIMENSION) != 4)
michael@0 717 return 0;
michael@0 718 if (sizeof(FAST_FLOAT) != 4)
michael@0 719 return 0;
michael@0 720 if (sizeof(FLOAT_MULT_TYPE) != 4)
michael@0 721 return 0;
michael@0 722
michael@0 723 if (!IS_ALIGNED_SSE(jconst_idct_float_sse2))
michael@0 724 return 0;
michael@0 725
michael@0 726 return 1;
michael@0 727 }
michael@0 728
michael@0 729 GLOBAL(void)
michael@0 730 jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
michael@0 731 JCOEFPTR coef_block, JSAMPARRAY output_buf,
michael@0 732 JDIMENSION output_col)
michael@0 733 {
michael@0 734 jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col);
michael@0 735 }
michael@0 736
michael@0 737 GLOBAL(void)
michael@0 738 jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
michael@0 739 JCOEFPTR coef_block, JSAMPARRAY output_buf,
michael@0 740 JDIMENSION output_col)
michael@0 741 {
michael@0 742 jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col);
michael@0 743 }
michael@0 744
michael@0 745 GLOBAL(void)
michael@0 746 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
michael@0 747 JCOEFPTR coef_block, JSAMPARRAY output_buf,
michael@0 748 JDIMENSION output_col)
michael@0 749 {
michael@0 750 jsimd_idct_float_sse2(compptr->dct_table, coef_block,
michael@0 751 output_buf, output_col);
michael@0 752 }
michael@0 753

mercurial