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