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