DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 1 | /* |
DRC | bf8a5fe | 2014-12-22 01:10:11 +0000 | [diff] [blame^] | 2 | * jsimd_powerpc.c |
DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
| 5 | * Copyright 2009-2011, 2014 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 contains the interface between the "normal" portions |
| 12 | * of the library and the SIMD implementations when running on a |
| 13 | * 64-bit x86 architecture. |
| 14 | */ |
| 15 | |
| 16 | #define JPEG_INTERNALS |
| 17 | #include "../jinclude.h" |
| 18 | #include "../jpeglib.h" |
| 19 | #include "../jsimd.h" |
| 20 | #include "../jdct.h" |
| 21 | #include "../jsimddct.h" |
| 22 | #include "jsimd.h" |
| 23 | |
| 24 | static unsigned int simd_support = ~0; |
| 25 | |
| 26 | LOCAL(void) |
| 27 | init_simd (void) |
| 28 | { |
| 29 | char *env = NULL; |
| 30 | |
| 31 | if (simd_support != ~0U) |
| 32 | return; |
| 33 | |
| 34 | simd_support = JSIMD_ALTIVEC; |
| 35 | |
| 36 | /* Force different settings through environment variables */ |
| 37 | env = getenv("JSIMD_FORCENONE"); |
| 38 | if ((env != NULL) && (strcmp(env, "1") == 0)) |
| 39 | simd_support = 0; |
| 40 | } |
| 41 | |
| 42 | GLOBAL(int) |
| 43 | jsimd_can_rgb_ycc (void) |
| 44 | { |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | GLOBAL(int) |
| 49 | jsimd_can_rgb_gray (void) |
| 50 | { |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | GLOBAL(int) |
| 55 | jsimd_can_ycc_rgb (void) |
| 56 | { |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | GLOBAL(int) |
| 61 | jsimd_can_ycc_rgb565 (void) |
| 62 | { |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | GLOBAL(void) |
| 67 | jsimd_rgb_ycc_convert (j_compress_ptr cinfo, |
| 68 | JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
| 69 | JDIMENSION output_row, int num_rows) |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | GLOBAL(void) |
| 74 | jsimd_rgb_gray_convert (j_compress_ptr cinfo, |
| 75 | JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
| 76 | JDIMENSION output_row, int num_rows) |
| 77 | { |
| 78 | } |
| 79 | |
| 80 | GLOBAL(void) |
| 81 | jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, |
| 82 | JSAMPIMAGE input_buf, JDIMENSION input_row, |
| 83 | JSAMPARRAY output_buf, int num_rows) |
| 84 | { |
| 85 | } |
| 86 | |
| 87 | GLOBAL(void) |
| 88 | jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, |
| 89 | JSAMPIMAGE input_buf, JDIMENSION input_row, |
| 90 | JSAMPARRAY output_buf, int num_rows) |
| 91 | { |
| 92 | } |
| 93 | |
| 94 | GLOBAL(int) |
| 95 | jsimd_can_h2v2_downsample (void) |
| 96 | { |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | GLOBAL(int) |
| 101 | jsimd_can_h2v1_downsample (void) |
| 102 | { |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | GLOBAL(void) |
| 107 | jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
| 108 | JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 109 | { |
| 110 | } |
| 111 | |
| 112 | GLOBAL(void) |
| 113 | jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
| 114 | JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 115 | { |
| 116 | } |
| 117 | |
| 118 | GLOBAL(int) |
| 119 | jsimd_can_h2v2_upsample (void) |
| 120 | { |
| 121 | return 0; |
| 122 | } |
| 123 | |
| 124 | GLOBAL(int) |
| 125 | jsimd_can_h2v1_upsample (void) |
| 126 | { |
| 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | GLOBAL(void) |
| 131 | jsimd_h2v2_upsample (j_decompress_ptr cinfo, |
| 132 | jpeg_component_info * compptr, |
| 133 | JSAMPARRAY input_data, |
| 134 | JSAMPARRAY * output_data_ptr) |
| 135 | { |
| 136 | } |
| 137 | |
| 138 | GLOBAL(void) |
| 139 | jsimd_h2v1_upsample (j_decompress_ptr cinfo, |
| 140 | jpeg_component_info * compptr, |
| 141 | JSAMPARRAY input_data, |
| 142 | JSAMPARRAY * output_data_ptr) |
| 143 | { |
| 144 | } |
| 145 | |
| 146 | GLOBAL(int) |
| 147 | jsimd_can_h2v2_fancy_upsample (void) |
| 148 | { |
| 149 | return 0; |
| 150 | } |
| 151 | |
| 152 | GLOBAL(int) |
| 153 | jsimd_can_h2v1_fancy_upsample (void) |
| 154 | { |
| 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | GLOBAL(void) |
| 159 | jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, |
| 160 | jpeg_component_info * compptr, |
| 161 | JSAMPARRAY input_data, |
| 162 | JSAMPARRAY * output_data_ptr) |
| 163 | { |
| 164 | } |
| 165 | |
| 166 | GLOBAL(void) |
| 167 | jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, |
| 168 | jpeg_component_info * compptr, |
| 169 | JSAMPARRAY input_data, |
| 170 | JSAMPARRAY * output_data_ptr) |
| 171 | { |
| 172 | } |
| 173 | |
| 174 | GLOBAL(int) |
| 175 | jsimd_can_h2v2_merged_upsample (void) |
| 176 | { |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | GLOBAL(int) |
| 181 | jsimd_can_h2v1_merged_upsample (void) |
| 182 | { |
| 183 | return 0; |
| 184 | } |
| 185 | |
| 186 | GLOBAL(void) |
| 187 | jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, |
| 188 | JSAMPIMAGE input_buf, |
| 189 | JDIMENSION in_row_group_ctr, |
| 190 | JSAMPARRAY output_buf) |
| 191 | { |
| 192 | } |
| 193 | |
| 194 | GLOBAL(void) |
| 195 | jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, |
| 196 | JSAMPIMAGE input_buf, |
| 197 | JDIMENSION in_row_group_ctr, |
| 198 | JSAMPARRAY output_buf) |
| 199 | { |
| 200 | } |
| 201 | |
| 202 | GLOBAL(int) |
| 203 | jsimd_can_convsamp (void) |
| 204 | { |
| 205 | return 0; |
| 206 | } |
| 207 | |
| 208 | GLOBAL(int) |
| 209 | jsimd_can_convsamp_float (void) |
| 210 | { |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | GLOBAL(void) |
| 215 | jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, |
| 216 | DCTELEM * workspace) |
| 217 | { |
| 218 | } |
| 219 | |
| 220 | GLOBAL(void) |
| 221 | jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, |
| 222 | FAST_FLOAT * workspace) |
| 223 | { |
| 224 | } |
| 225 | |
| 226 | GLOBAL(int) |
| 227 | jsimd_can_fdct_islow (void) |
| 228 | { |
DRC | fb0c394 | 2014-12-17 08:04:39 +0000 | [diff] [blame] | 229 | init_simd(); |
| 230 | |
| 231 | /* The code is optimised for these values only */ |
| 232 | if (DCTSIZE != 8) |
| 233 | return 0; |
| 234 | if (sizeof(DCTELEM) != 2) |
| 235 | return 0; |
| 236 | |
| 237 | if (simd_support & JSIMD_ALTIVEC) |
| 238 | return 1; |
| 239 | |
DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | GLOBAL(int) |
| 244 | jsimd_can_fdct_ifast (void) |
| 245 | { |
| 246 | init_simd(); |
| 247 | |
| 248 | /* The code is optimised for these values only */ |
| 249 | if (DCTSIZE != 8) |
| 250 | return 0; |
| 251 | if (sizeof(DCTELEM) != 2) |
| 252 | return 0; |
| 253 | |
| 254 | if (simd_support & JSIMD_ALTIVEC) |
| 255 | return 1; |
| 256 | |
| 257 | return 0; |
| 258 | } |
| 259 | |
| 260 | GLOBAL(int) |
| 261 | jsimd_can_fdct_float (void) |
| 262 | { |
| 263 | return 0; |
| 264 | } |
| 265 | |
| 266 | GLOBAL(void) |
| 267 | jsimd_fdct_islow (DCTELEM * data) |
| 268 | { |
DRC | fb0c394 | 2014-12-17 08:04:39 +0000 | [diff] [blame] | 269 | jsimd_fdct_islow_altivec(data); |
DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | GLOBAL(void) |
| 273 | jsimd_fdct_ifast (DCTELEM * data) |
| 274 | { |
| 275 | jsimd_fdct_ifast_altivec(data); |
| 276 | } |
| 277 | |
| 278 | GLOBAL(void) |
| 279 | jsimd_fdct_float (FAST_FLOAT * data) |
| 280 | { |
| 281 | } |
| 282 | |
| 283 | GLOBAL(int) |
| 284 | jsimd_can_quantize (void) |
| 285 | { |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | GLOBAL(int) |
| 290 | jsimd_can_quantize_float (void) |
| 291 | { |
| 292 | return 0; |
| 293 | } |
| 294 | |
| 295 | GLOBAL(void) |
| 296 | jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, |
| 297 | DCTELEM * workspace) |
| 298 | { |
| 299 | } |
| 300 | |
| 301 | GLOBAL(void) |
| 302 | jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, |
| 303 | FAST_FLOAT * workspace) |
| 304 | { |
| 305 | } |
| 306 | |
| 307 | GLOBAL(int) |
| 308 | jsimd_can_idct_2x2 (void) |
| 309 | { |
| 310 | return 0; |
| 311 | } |
| 312 | |
| 313 | GLOBAL(int) |
| 314 | jsimd_can_idct_4x4 (void) |
| 315 | { |
| 316 | return 0; |
| 317 | } |
| 318 | |
| 319 | GLOBAL(void) |
| 320 | jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
| 321 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
| 322 | JDIMENSION output_col) |
| 323 | { |
| 324 | } |
| 325 | |
| 326 | GLOBAL(void) |
| 327 | jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
| 328 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
| 329 | JDIMENSION output_col) |
| 330 | { |
| 331 | } |
| 332 | |
| 333 | GLOBAL(int) |
| 334 | jsimd_can_idct_islow (void) |
| 335 | { |
DRC | 0691162 | 2014-12-20 01:17:39 +0000 | [diff] [blame] | 336 | init_simd(); |
| 337 | |
| 338 | /* The code is optimised for these values only */ |
| 339 | if (DCTSIZE != 8) |
| 340 | return 0; |
DRC | bf8a5fe | 2014-12-22 01:10:11 +0000 | [diff] [blame^] | 341 | if (sizeof(JCOEF) != 2) |
DRC | 0691162 | 2014-12-20 01:17:39 +0000 | [diff] [blame] | 342 | return 0; |
| 343 | |
| 344 | if (simd_support & JSIMD_ALTIVEC) |
| 345 | return 1; |
| 346 | |
DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 347 | return 0; |
| 348 | } |
| 349 | |
| 350 | GLOBAL(int) |
| 351 | jsimd_can_idct_ifast (void) |
| 352 | { |
DRC | 6cb7f40 | 2014-12-18 10:12:29 +0000 | [diff] [blame] | 353 | init_simd(); |
| 354 | |
| 355 | /* The code is optimised for these values only */ |
| 356 | if (DCTSIZE != 8) |
| 357 | return 0; |
DRC | bf8a5fe | 2014-12-22 01:10:11 +0000 | [diff] [blame^] | 358 | if (sizeof(JCOEF) != 2) |
DRC | 6cb7f40 | 2014-12-18 10:12:29 +0000 | [diff] [blame] | 359 | return 0; |
| 360 | |
| 361 | if (simd_support & JSIMD_ALTIVEC) |
| 362 | return 1; |
| 363 | |
DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 364 | return 0; |
| 365 | } |
| 366 | |
| 367 | GLOBAL(int) |
| 368 | jsimd_can_idct_float (void) |
| 369 | { |
| 370 | return 0; |
| 371 | } |
| 372 | |
| 373 | GLOBAL(void) |
| 374 | jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
| 375 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
| 376 | JDIMENSION output_col) |
| 377 | { |
DRC | 0691162 | 2014-12-20 01:17:39 +0000 | [diff] [blame] | 378 | jsimd_idct_islow_altivec(compptr->dct_table, coef_block, output_buf, |
| 379 | output_col); |
DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | GLOBAL(void) |
| 383 | jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
| 384 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
| 385 | JDIMENSION output_col) |
| 386 | { |
DRC | 6cb7f40 | 2014-12-18 10:12:29 +0000 | [diff] [blame] | 387 | jsimd_idct_ifast_altivec(compptr->dct_table, coef_block, output_buf, |
| 388 | output_col); |
DRC | cd2d8e1 | 2014-09-05 06:33:42 +0000 | [diff] [blame] | 389 | } |
| 390 | |
| 391 | GLOBAL(void) |
| 392 | jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
| 393 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
| 394 | JDIMENSION output_col) |
| 395 | { |
| 396 | } |