Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * jsimd_arm.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 |
michael@0 | 13 | * ARM architecture. |
michael@0 | 14 | * |
michael@0 | 15 | * Based on the stubs from 'jsimd_none.c' |
michael@0 | 16 | */ |
michael@0 | 17 | |
michael@0 | 18 | #define JPEG_INTERNALS |
michael@0 | 19 | #include "../jinclude.h" |
michael@0 | 20 | #include "../jpeglib.h" |
michael@0 | 21 | #include "../jsimd.h" |
michael@0 | 22 | #include "../jdct.h" |
michael@0 | 23 | #include "../jsimddct.h" |
michael@0 | 24 | #include "jsimd.h" |
michael@0 | 25 | |
michael@0 | 26 | #include <stdio.h> |
michael@0 | 27 | #include <string.h> |
michael@0 | 28 | #include <ctype.h> |
michael@0 | 29 | |
michael@0 | 30 | static unsigned int simd_support = ~0; |
michael@0 | 31 | |
michael@0 | 32 | #if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) |
michael@0 | 33 | |
michael@0 | 34 | #define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024) |
michael@0 | 35 | |
michael@0 | 36 | LOCAL(int) |
michael@0 | 37 | check_feature (char *buffer, char *feature) |
michael@0 | 38 | { |
michael@0 | 39 | char *p; |
michael@0 | 40 | if (*feature == 0) |
michael@0 | 41 | return 0; |
michael@0 | 42 | if (strncmp(buffer, "Features", 8) != 0) |
michael@0 | 43 | return 0; |
michael@0 | 44 | buffer += 8; |
michael@0 | 45 | while (isspace(*buffer)) |
michael@0 | 46 | buffer++; |
michael@0 | 47 | |
michael@0 | 48 | /* Check if 'feature' is present in the buffer as a separate word */ |
michael@0 | 49 | while ((p = strstr(buffer, feature))) { |
michael@0 | 50 | if (p > buffer && !isspace(*(p - 1))) { |
michael@0 | 51 | buffer++; |
michael@0 | 52 | continue; |
michael@0 | 53 | } |
michael@0 | 54 | p += strlen(feature); |
michael@0 | 55 | if (*p != 0 && !isspace(*p)) { |
michael@0 | 56 | buffer++; |
michael@0 | 57 | continue; |
michael@0 | 58 | } |
michael@0 | 59 | return 1; |
michael@0 | 60 | } |
michael@0 | 61 | return 0; |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | LOCAL(int) |
michael@0 | 65 | parse_proc_cpuinfo (int bufsize) |
michael@0 | 66 | { |
michael@0 | 67 | char *buffer = (char *)malloc(bufsize); |
michael@0 | 68 | FILE *fd; |
michael@0 | 69 | simd_support = 0; |
michael@0 | 70 | |
michael@0 | 71 | if (!buffer) |
michael@0 | 72 | return 0; |
michael@0 | 73 | |
michael@0 | 74 | fd = fopen("/proc/cpuinfo", "r"); |
michael@0 | 75 | if (fd) { |
michael@0 | 76 | while (fgets(buffer, bufsize, fd)) { |
michael@0 | 77 | if (!strchr(buffer, '\n') && !feof(fd)) { |
michael@0 | 78 | /* "impossible" happened - insufficient size of the buffer! */ |
michael@0 | 79 | fclose(fd); |
michael@0 | 80 | free(buffer); |
michael@0 | 81 | return 0; |
michael@0 | 82 | } |
michael@0 | 83 | if (check_feature(buffer, "neon")) |
michael@0 | 84 | simd_support |= JSIMD_ARM_NEON; |
michael@0 | 85 | } |
michael@0 | 86 | fclose(fd); |
michael@0 | 87 | } |
michael@0 | 88 | free(buffer); |
michael@0 | 89 | return 1; |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | #endif |
michael@0 | 93 | |
michael@0 | 94 | /* |
michael@0 | 95 | * Check what SIMD accelerations are supported. |
michael@0 | 96 | * |
michael@0 | 97 | * FIXME: This code is racy under a multi-threaded environment. |
michael@0 | 98 | */ |
michael@0 | 99 | LOCAL(void) |
michael@0 | 100 | init_simd (void) |
michael@0 | 101 | { |
michael@0 | 102 | char *env = NULL; |
michael@0 | 103 | #if !defined(__ARM_NEON__) && defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) |
michael@0 | 104 | int bufsize = 1024; /* an initial guess for the line buffer size limit */ |
michael@0 | 105 | #endif |
michael@0 | 106 | |
michael@0 | 107 | if (simd_support != ~0U) |
michael@0 | 108 | return; |
michael@0 | 109 | |
michael@0 | 110 | simd_support = 0; |
michael@0 | 111 | |
michael@0 | 112 | #if defined(__ARM_NEON__) |
michael@0 | 113 | simd_support |= JSIMD_ARM_NEON; |
michael@0 | 114 | #elif defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) |
michael@0 | 115 | /* We still have a chance to use NEON regardless of globally used |
michael@0 | 116 | * -mcpu/-mfpu options passed to gcc by performing runtime detection via |
michael@0 | 117 | * /proc/cpuinfo parsing on linux/android */ |
michael@0 | 118 | while (!parse_proc_cpuinfo(bufsize)) { |
michael@0 | 119 | bufsize *= 2; |
michael@0 | 120 | if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT) |
michael@0 | 121 | break; |
michael@0 | 122 | } |
michael@0 | 123 | #endif |
michael@0 | 124 | |
michael@0 | 125 | /* Force different settings through environment variables */ |
michael@0 | 126 | env = getenv("JSIMD_FORCE_ARM_NEON"); |
michael@0 | 127 | if ((env != NULL) && (strcmp(env, "1") == 0)) |
michael@0 | 128 | simd_support &= JSIMD_ARM_NEON; |
michael@0 | 129 | env = getenv("JSIMD_FORCE_NO_SIMD"); |
michael@0 | 130 | if ((env != NULL) && (strcmp(env, "1") == 0)) |
michael@0 | 131 | simd_support = 0; |
michael@0 | 132 | } |
michael@0 | 133 | |
michael@0 | 134 | GLOBAL(int) |
michael@0 | 135 | jsimd_can_rgb_ycc (void) |
michael@0 | 136 | { |
michael@0 | 137 | init_simd(); |
michael@0 | 138 | |
michael@0 | 139 | /* The code is optimised for these values only */ |
michael@0 | 140 | if (BITS_IN_JSAMPLE != 8) |
michael@0 | 141 | return 0; |
michael@0 | 142 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 143 | return 0; |
michael@0 | 144 | if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
michael@0 | 145 | return 0; |
michael@0 | 146 | |
michael@0 | 147 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 148 | return 1; |
michael@0 | 149 | |
michael@0 | 150 | return 0; |
michael@0 | 151 | } |
michael@0 | 152 | |
michael@0 | 153 | GLOBAL(int) |
michael@0 | 154 | jsimd_can_rgb_gray (void) |
michael@0 | 155 | { |
michael@0 | 156 | init_simd(); |
michael@0 | 157 | |
michael@0 | 158 | return 0; |
michael@0 | 159 | } |
michael@0 | 160 | |
michael@0 | 161 | GLOBAL(int) |
michael@0 | 162 | jsimd_can_ycc_rgb (void) |
michael@0 | 163 | { |
michael@0 | 164 | init_simd(); |
michael@0 | 165 | |
michael@0 | 166 | /* The code is optimised for these values only */ |
michael@0 | 167 | if (BITS_IN_JSAMPLE != 8) |
michael@0 | 168 | return 0; |
michael@0 | 169 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 170 | return 0; |
michael@0 | 171 | if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
michael@0 | 172 | return 0; |
michael@0 | 173 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 174 | return 1; |
michael@0 | 175 | |
michael@0 | 176 | return 0; |
michael@0 | 177 | } |
michael@0 | 178 | |
michael@0 | 179 | GLOBAL(void) |
michael@0 | 180 | jsimd_rgb_ycc_convert (j_compress_ptr cinfo, |
michael@0 | 181 | JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
michael@0 | 182 | JDIMENSION output_row, int num_rows) |
michael@0 | 183 | { |
michael@0 | 184 | void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); |
michael@0 | 185 | |
michael@0 | 186 | switch(cinfo->in_color_space) |
michael@0 | 187 | { |
michael@0 | 188 | case JCS_EXT_RGB: |
michael@0 | 189 | neonfct=jsimd_extrgb_ycc_convert_neon; |
michael@0 | 190 | break; |
michael@0 | 191 | case JCS_EXT_RGBX: |
michael@0 | 192 | case JCS_EXT_RGBA: |
michael@0 | 193 | neonfct=jsimd_extrgbx_ycc_convert_neon; |
michael@0 | 194 | break; |
michael@0 | 195 | case JCS_EXT_BGR: |
michael@0 | 196 | neonfct=jsimd_extbgr_ycc_convert_neon; |
michael@0 | 197 | break; |
michael@0 | 198 | case JCS_EXT_BGRX: |
michael@0 | 199 | case JCS_EXT_BGRA: |
michael@0 | 200 | neonfct=jsimd_extbgrx_ycc_convert_neon; |
michael@0 | 201 | break; |
michael@0 | 202 | case JCS_EXT_XBGR: |
michael@0 | 203 | case JCS_EXT_ABGR: |
michael@0 | 204 | neonfct=jsimd_extxbgr_ycc_convert_neon; |
michael@0 | 205 | break; |
michael@0 | 206 | case JCS_EXT_XRGB: |
michael@0 | 207 | case JCS_EXT_ARGB: |
michael@0 | 208 | neonfct=jsimd_extxrgb_ycc_convert_neon; |
michael@0 | 209 | break; |
michael@0 | 210 | default: |
michael@0 | 211 | neonfct=jsimd_extrgb_ycc_convert_neon; |
michael@0 | 212 | break; |
michael@0 | 213 | } |
michael@0 | 214 | |
michael@0 | 215 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 216 | neonfct(cinfo->image_width, input_buf, |
michael@0 | 217 | output_buf, output_row, num_rows); |
michael@0 | 218 | } |
michael@0 | 219 | |
michael@0 | 220 | GLOBAL(void) |
michael@0 | 221 | jsimd_rgb_gray_convert (j_compress_ptr cinfo, |
michael@0 | 222 | JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
michael@0 | 223 | JDIMENSION output_row, int num_rows) |
michael@0 | 224 | { |
michael@0 | 225 | } |
michael@0 | 226 | |
michael@0 | 227 | GLOBAL(void) |
michael@0 | 228 | jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, |
michael@0 | 229 | JSAMPIMAGE input_buf, JDIMENSION input_row, |
michael@0 | 230 | JSAMPARRAY output_buf, int num_rows) |
michael@0 | 231 | { |
michael@0 | 232 | void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); |
michael@0 | 233 | |
michael@0 | 234 | switch(cinfo->out_color_space) |
michael@0 | 235 | { |
michael@0 | 236 | case JCS_EXT_RGB: |
michael@0 | 237 | neonfct=jsimd_ycc_extrgb_convert_neon; |
michael@0 | 238 | break; |
michael@0 | 239 | case JCS_EXT_RGBX: |
michael@0 | 240 | case JCS_EXT_RGBA: |
michael@0 | 241 | neonfct=jsimd_ycc_extrgbx_convert_neon; |
michael@0 | 242 | break; |
michael@0 | 243 | case JCS_EXT_BGR: |
michael@0 | 244 | neonfct=jsimd_ycc_extbgr_convert_neon; |
michael@0 | 245 | break; |
michael@0 | 246 | case JCS_EXT_BGRX: |
michael@0 | 247 | case JCS_EXT_BGRA: |
michael@0 | 248 | neonfct=jsimd_ycc_extbgrx_convert_neon; |
michael@0 | 249 | break; |
michael@0 | 250 | case JCS_EXT_XBGR: |
michael@0 | 251 | case JCS_EXT_ABGR: |
michael@0 | 252 | neonfct=jsimd_ycc_extxbgr_convert_neon; |
michael@0 | 253 | break; |
michael@0 | 254 | case JCS_EXT_XRGB: |
michael@0 | 255 | case JCS_EXT_ARGB: |
michael@0 | 256 | neonfct=jsimd_ycc_extxrgb_convert_neon; |
michael@0 | 257 | break; |
michael@0 | 258 | default: |
michael@0 | 259 | neonfct=jsimd_ycc_extrgb_convert_neon; |
michael@0 | 260 | break; |
michael@0 | 261 | } |
michael@0 | 262 | |
michael@0 | 263 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 264 | neonfct(cinfo->output_width, input_buf, |
michael@0 | 265 | input_row, output_buf, num_rows); |
michael@0 | 266 | } |
michael@0 | 267 | |
michael@0 | 268 | GLOBAL(int) |
michael@0 | 269 | jsimd_can_h2v2_downsample (void) |
michael@0 | 270 | { |
michael@0 | 271 | init_simd(); |
michael@0 | 272 | |
michael@0 | 273 | return 0; |
michael@0 | 274 | } |
michael@0 | 275 | |
michael@0 | 276 | GLOBAL(int) |
michael@0 | 277 | jsimd_can_h2v1_downsample (void) |
michael@0 | 278 | { |
michael@0 | 279 | init_simd(); |
michael@0 | 280 | |
michael@0 | 281 | return 0; |
michael@0 | 282 | } |
michael@0 | 283 | |
michael@0 | 284 | GLOBAL(void) |
michael@0 | 285 | jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
michael@0 | 286 | JSAMPARRAY input_data, JSAMPARRAY output_data) |
michael@0 | 287 | { |
michael@0 | 288 | } |
michael@0 | 289 | |
michael@0 | 290 | GLOBAL(void) |
michael@0 | 291 | jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
michael@0 | 292 | JSAMPARRAY input_data, JSAMPARRAY output_data) |
michael@0 | 293 | { |
michael@0 | 294 | } |
michael@0 | 295 | |
michael@0 | 296 | GLOBAL(int) |
michael@0 | 297 | jsimd_can_h2v2_upsample (void) |
michael@0 | 298 | { |
michael@0 | 299 | init_simd(); |
michael@0 | 300 | |
michael@0 | 301 | return 0; |
michael@0 | 302 | } |
michael@0 | 303 | |
michael@0 | 304 | GLOBAL(int) |
michael@0 | 305 | jsimd_can_h2v1_upsample (void) |
michael@0 | 306 | { |
michael@0 | 307 | init_simd(); |
michael@0 | 308 | |
michael@0 | 309 | return 0; |
michael@0 | 310 | } |
michael@0 | 311 | |
michael@0 | 312 | GLOBAL(void) |
michael@0 | 313 | jsimd_h2v2_upsample (j_decompress_ptr cinfo, |
michael@0 | 314 | jpeg_component_info * compptr, |
michael@0 | 315 | JSAMPARRAY input_data, |
michael@0 | 316 | JSAMPARRAY * output_data_ptr) |
michael@0 | 317 | { |
michael@0 | 318 | } |
michael@0 | 319 | |
michael@0 | 320 | GLOBAL(void) |
michael@0 | 321 | jsimd_h2v1_upsample (j_decompress_ptr cinfo, |
michael@0 | 322 | jpeg_component_info * compptr, |
michael@0 | 323 | JSAMPARRAY input_data, |
michael@0 | 324 | JSAMPARRAY * output_data_ptr) |
michael@0 | 325 | { |
michael@0 | 326 | } |
michael@0 | 327 | |
michael@0 | 328 | GLOBAL(int) |
michael@0 | 329 | jsimd_can_h2v2_fancy_upsample (void) |
michael@0 | 330 | { |
michael@0 | 331 | init_simd(); |
michael@0 | 332 | |
michael@0 | 333 | return 0; |
michael@0 | 334 | } |
michael@0 | 335 | |
michael@0 | 336 | GLOBAL(int) |
michael@0 | 337 | jsimd_can_h2v1_fancy_upsample (void) |
michael@0 | 338 | { |
michael@0 | 339 | init_simd(); |
michael@0 | 340 | |
michael@0 | 341 | /* The code is optimised for these values only */ |
michael@0 | 342 | if (BITS_IN_JSAMPLE != 8) |
michael@0 | 343 | return 0; |
michael@0 | 344 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 345 | return 0; |
michael@0 | 346 | |
michael@0 | 347 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 348 | return 1; |
michael@0 | 349 | |
michael@0 | 350 | return 0; |
michael@0 | 351 | } |
michael@0 | 352 | |
michael@0 | 353 | GLOBAL(void) |
michael@0 | 354 | jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, |
michael@0 | 355 | jpeg_component_info * compptr, |
michael@0 | 356 | JSAMPARRAY input_data, |
michael@0 | 357 | JSAMPARRAY * output_data_ptr) |
michael@0 | 358 | { |
michael@0 | 359 | } |
michael@0 | 360 | |
michael@0 | 361 | GLOBAL(void) |
michael@0 | 362 | jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, |
michael@0 | 363 | jpeg_component_info * compptr, |
michael@0 | 364 | JSAMPARRAY input_data, |
michael@0 | 365 | JSAMPARRAY * output_data_ptr) |
michael@0 | 366 | { |
michael@0 | 367 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 368 | jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor, |
michael@0 | 369 | compptr->downsampled_width, input_data, output_data_ptr); |
michael@0 | 370 | } |
michael@0 | 371 | |
michael@0 | 372 | GLOBAL(int) |
michael@0 | 373 | jsimd_can_h2v2_merged_upsample (void) |
michael@0 | 374 | { |
michael@0 | 375 | init_simd(); |
michael@0 | 376 | |
michael@0 | 377 | return 0; |
michael@0 | 378 | } |
michael@0 | 379 | |
michael@0 | 380 | GLOBAL(int) |
michael@0 | 381 | jsimd_can_h2v1_merged_upsample (void) |
michael@0 | 382 | { |
michael@0 | 383 | init_simd(); |
michael@0 | 384 | |
michael@0 | 385 | return 0; |
michael@0 | 386 | } |
michael@0 | 387 | |
michael@0 | 388 | GLOBAL(void) |
michael@0 | 389 | jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, |
michael@0 | 390 | JSAMPIMAGE input_buf, |
michael@0 | 391 | JDIMENSION in_row_group_ctr, |
michael@0 | 392 | JSAMPARRAY output_buf) |
michael@0 | 393 | { |
michael@0 | 394 | } |
michael@0 | 395 | |
michael@0 | 396 | GLOBAL(void) |
michael@0 | 397 | jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, |
michael@0 | 398 | JSAMPIMAGE input_buf, |
michael@0 | 399 | JDIMENSION in_row_group_ctr, |
michael@0 | 400 | JSAMPARRAY output_buf) |
michael@0 | 401 | { |
michael@0 | 402 | } |
michael@0 | 403 | |
michael@0 | 404 | GLOBAL(int) |
michael@0 | 405 | jsimd_can_convsamp (void) |
michael@0 | 406 | { |
michael@0 | 407 | init_simd(); |
michael@0 | 408 | |
michael@0 | 409 | /* The code is optimised for these values only */ |
michael@0 | 410 | if (DCTSIZE != 8) |
michael@0 | 411 | return 0; |
michael@0 | 412 | if (BITS_IN_JSAMPLE != 8) |
michael@0 | 413 | return 0; |
michael@0 | 414 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 415 | return 0; |
michael@0 | 416 | if (sizeof(DCTELEM) != 2) |
michael@0 | 417 | return 0; |
michael@0 | 418 | |
michael@0 | 419 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 420 | return 1; |
michael@0 | 421 | |
michael@0 | 422 | return 0; |
michael@0 | 423 | } |
michael@0 | 424 | |
michael@0 | 425 | GLOBAL(int) |
michael@0 | 426 | jsimd_can_convsamp_float (void) |
michael@0 | 427 | { |
michael@0 | 428 | init_simd(); |
michael@0 | 429 | |
michael@0 | 430 | return 0; |
michael@0 | 431 | } |
michael@0 | 432 | |
michael@0 | 433 | GLOBAL(void) |
michael@0 | 434 | jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, |
michael@0 | 435 | DCTELEM * workspace) |
michael@0 | 436 | { |
michael@0 | 437 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 438 | jsimd_convsamp_neon(sample_data, start_col, workspace); |
michael@0 | 439 | } |
michael@0 | 440 | |
michael@0 | 441 | GLOBAL(void) |
michael@0 | 442 | jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, |
michael@0 | 443 | FAST_FLOAT * workspace) |
michael@0 | 444 | { |
michael@0 | 445 | } |
michael@0 | 446 | |
michael@0 | 447 | GLOBAL(int) |
michael@0 | 448 | jsimd_can_fdct_islow (void) |
michael@0 | 449 | { |
michael@0 | 450 | init_simd(); |
michael@0 | 451 | |
michael@0 | 452 | return 0; |
michael@0 | 453 | } |
michael@0 | 454 | |
michael@0 | 455 | GLOBAL(int) |
michael@0 | 456 | jsimd_can_fdct_ifast (void) |
michael@0 | 457 | { |
michael@0 | 458 | init_simd(); |
michael@0 | 459 | |
michael@0 | 460 | /* The code is optimised for these values only */ |
michael@0 | 461 | if (DCTSIZE != 8) |
michael@0 | 462 | return 0; |
michael@0 | 463 | if (sizeof(DCTELEM) != 2) |
michael@0 | 464 | return 0; |
michael@0 | 465 | |
michael@0 | 466 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 467 | return 1; |
michael@0 | 468 | |
michael@0 | 469 | return 0; |
michael@0 | 470 | } |
michael@0 | 471 | |
michael@0 | 472 | GLOBAL(int) |
michael@0 | 473 | jsimd_can_fdct_float (void) |
michael@0 | 474 | { |
michael@0 | 475 | init_simd(); |
michael@0 | 476 | |
michael@0 | 477 | return 0; |
michael@0 | 478 | } |
michael@0 | 479 | |
michael@0 | 480 | GLOBAL(void) |
michael@0 | 481 | jsimd_fdct_islow (DCTELEM * data) |
michael@0 | 482 | { |
michael@0 | 483 | } |
michael@0 | 484 | |
michael@0 | 485 | GLOBAL(void) |
michael@0 | 486 | jsimd_fdct_ifast (DCTELEM * data) |
michael@0 | 487 | { |
michael@0 | 488 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 489 | jsimd_fdct_ifast_neon(data); |
michael@0 | 490 | } |
michael@0 | 491 | |
michael@0 | 492 | GLOBAL(void) |
michael@0 | 493 | jsimd_fdct_float (FAST_FLOAT * data) |
michael@0 | 494 | { |
michael@0 | 495 | } |
michael@0 | 496 | |
michael@0 | 497 | GLOBAL(int) |
michael@0 | 498 | jsimd_can_quantize (void) |
michael@0 | 499 | { |
michael@0 | 500 | init_simd(); |
michael@0 | 501 | |
michael@0 | 502 | /* The code is optimised for these values only */ |
michael@0 | 503 | if (DCTSIZE != 8) |
michael@0 | 504 | return 0; |
michael@0 | 505 | if (sizeof(JCOEF) != 2) |
michael@0 | 506 | return 0; |
michael@0 | 507 | if (sizeof(DCTELEM) != 2) |
michael@0 | 508 | return 0; |
michael@0 | 509 | |
michael@0 | 510 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 511 | return 1; |
michael@0 | 512 | |
michael@0 | 513 | return 0; |
michael@0 | 514 | } |
michael@0 | 515 | |
michael@0 | 516 | GLOBAL(int) |
michael@0 | 517 | jsimd_can_quantize_float (void) |
michael@0 | 518 | { |
michael@0 | 519 | init_simd(); |
michael@0 | 520 | |
michael@0 | 521 | return 0; |
michael@0 | 522 | } |
michael@0 | 523 | |
michael@0 | 524 | GLOBAL(void) |
michael@0 | 525 | jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, |
michael@0 | 526 | DCTELEM * workspace) |
michael@0 | 527 | { |
michael@0 | 528 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 529 | jsimd_quantize_neon(coef_block, divisors, workspace); |
michael@0 | 530 | } |
michael@0 | 531 | |
michael@0 | 532 | GLOBAL(void) |
michael@0 | 533 | jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, |
michael@0 | 534 | FAST_FLOAT * workspace) |
michael@0 | 535 | { |
michael@0 | 536 | } |
michael@0 | 537 | |
michael@0 | 538 | GLOBAL(int) |
michael@0 | 539 | jsimd_can_idct_2x2 (void) |
michael@0 | 540 | { |
michael@0 | 541 | init_simd(); |
michael@0 | 542 | |
michael@0 | 543 | /* The code is optimised for these values only */ |
michael@0 | 544 | if (DCTSIZE != 8) |
michael@0 | 545 | return 0; |
michael@0 | 546 | if (sizeof(JCOEF) != 2) |
michael@0 | 547 | return 0; |
michael@0 | 548 | if (BITS_IN_JSAMPLE != 8) |
michael@0 | 549 | return 0; |
michael@0 | 550 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 551 | return 0; |
michael@0 | 552 | if (sizeof(ISLOW_MULT_TYPE) != 2) |
michael@0 | 553 | return 0; |
michael@0 | 554 | |
michael@0 | 555 | if ((simd_support & JSIMD_ARM_NEON)) |
michael@0 | 556 | return 1; |
michael@0 | 557 | |
michael@0 | 558 | return 0; |
michael@0 | 559 | } |
michael@0 | 560 | |
michael@0 | 561 | GLOBAL(int) |
michael@0 | 562 | jsimd_can_idct_4x4 (void) |
michael@0 | 563 | { |
michael@0 | 564 | init_simd(); |
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 (BITS_IN_JSAMPLE != 8) |
michael@0 | 572 | return 0; |
michael@0 | 573 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 574 | return 0; |
michael@0 | 575 | if (sizeof(ISLOW_MULT_TYPE) != 2) |
michael@0 | 576 | return 0; |
michael@0 | 577 | |
michael@0 | 578 | if ((simd_support & JSIMD_ARM_NEON)) |
michael@0 | 579 | return 1; |
michael@0 | 580 | |
michael@0 | 581 | return 0; |
michael@0 | 582 | } |
michael@0 | 583 | |
michael@0 | 584 | GLOBAL(void) |
michael@0 | 585 | jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
michael@0 | 586 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
michael@0 | 587 | JDIMENSION output_col) |
michael@0 | 588 | { |
michael@0 | 589 | if ((simd_support & JSIMD_ARM_NEON)) |
michael@0 | 590 | jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col); |
michael@0 | 591 | } |
michael@0 | 592 | |
michael@0 | 593 | GLOBAL(void) |
michael@0 | 594 | jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
michael@0 | 595 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
michael@0 | 596 | JDIMENSION output_col) |
michael@0 | 597 | { |
michael@0 | 598 | if ((simd_support & JSIMD_ARM_NEON)) |
michael@0 | 599 | jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col); |
michael@0 | 600 | } |
michael@0 | 601 | |
michael@0 | 602 | GLOBAL(int) |
michael@0 | 603 | jsimd_can_idct_islow (void) |
michael@0 | 604 | { |
michael@0 | 605 | init_simd(); |
michael@0 | 606 | |
michael@0 | 607 | /* The code is optimised for these values only */ |
michael@0 | 608 | if (DCTSIZE != 8) |
michael@0 | 609 | return 0; |
michael@0 | 610 | if (sizeof(JCOEF) != 2) |
michael@0 | 611 | return 0; |
michael@0 | 612 | if (BITS_IN_JSAMPLE != 8) |
michael@0 | 613 | return 0; |
michael@0 | 614 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 615 | return 0; |
michael@0 | 616 | if (sizeof(ISLOW_MULT_TYPE) != 2) |
michael@0 | 617 | return 0; |
michael@0 | 618 | |
michael@0 | 619 | if (simd_support & JSIMD_ARM_NEON) |
michael@0 | 620 | return 1; |
michael@0 | 621 | |
michael@0 | 622 | return 0; |
michael@0 | 623 | } |
michael@0 | 624 | |
michael@0 | 625 | GLOBAL(int) |
michael@0 | 626 | jsimd_can_idct_ifast (void) |
michael@0 | 627 | { |
michael@0 | 628 | init_simd(); |
michael@0 | 629 | |
michael@0 | 630 | /* The code is optimised for these values only */ |
michael@0 | 631 | if (DCTSIZE != 8) |
michael@0 | 632 | return 0; |
michael@0 | 633 | if (sizeof(JCOEF) != 2) |
michael@0 | 634 | return 0; |
michael@0 | 635 | if (BITS_IN_JSAMPLE != 8) |
michael@0 | 636 | return 0; |
michael@0 | 637 | if (sizeof(JDIMENSION) != 4) |
michael@0 | 638 | return 0; |
michael@0 | 639 | if (sizeof(IFAST_MULT_TYPE) != 2) |
michael@0 | 640 | return 0; |
michael@0 | 641 | if (IFAST_SCALE_BITS != 2) |
michael@0 | 642 | return 0; |
michael@0 | 643 | |
michael@0 | 644 | if ((simd_support & JSIMD_ARM_NEON)) |
michael@0 | 645 | return 1; |
michael@0 | 646 | |
michael@0 | 647 | return 0; |
michael@0 | 648 | } |
michael@0 | 649 | |
michael@0 | 650 | GLOBAL(int) |
michael@0 | 651 | jsimd_can_idct_float (void) |
michael@0 | 652 | { |
michael@0 | 653 | init_simd(); |
michael@0 | 654 | |
michael@0 | 655 | return 0; |
michael@0 | 656 | } |
michael@0 | 657 | |
michael@0 | 658 | GLOBAL(void) |
michael@0 | 659 | jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
michael@0 | 660 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
michael@0 | 661 | JDIMENSION output_col) |
michael@0 | 662 | { |
michael@0 | 663 | if ((simd_support & JSIMD_ARM_NEON)) |
michael@0 | 664 | jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col); |
michael@0 | 665 | } |
michael@0 | 666 | |
michael@0 | 667 | GLOBAL(void) |
michael@0 | 668 | jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
michael@0 | 669 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
michael@0 | 670 | JDIMENSION output_col) |
michael@0 | 671 | { |
michael@0 | 672 | if ((simd_support & JSIMD_ARM_NEON)) |
michael@0 | 673 | jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col); |
michael@0 | 674 | } |
michael@0 | 675 | |
michael@0 | 676 | GLOBAL(void) |
michael@0 | 677 | jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
michael@0 | 678 | JCOEFPTR coef_block, JSAMPARRAY output_buf, |
michael@0 | 679 | JDIMENSION output_col) |
michael@0 | 680 | { |
michael@0 | 681 | } |
michael@0 | 682 |