OLD | NEW |
1 /* | 1 /* |
2 * jsimd_x86_64.c | 2 * jsimd_x86_64.c |
3 * | 3 * |
4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB | 4 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
5 * Copyright 2009 D. R. Commander | 5 * Copyright 2009-2011 D. R. Commander |
6 * | 6 * |
7 * Based on the x86 SIMD extension for IJG JPEG library, | 7 * Based on the x86 SIMD extension for IJG JPEG library, |
8 * Copyright (C) 1999-2006, MIYASAKA Masaru. | 8 * Copyright (C) 1999-2006, MIYASAKA Masaru. |
| 9 * For conditions of distribution and use, see copyright notice in jsimdext.inc |
9 * | 10 * |
10 * This file contains the interface between the "normal" portions | 11 * This file contains the interface between the "normal" portions |
11 * of the library and the SIMD implementations when running on a | 12 * of the library and the SIMD implementations when running on a |
12 * x86_64 architecture. | 13 * x86_64 architecture. |
13 */ | 14 */ |
14 | 15 |
15 #define JPEG_INTERNALS | 16 #define JPEG_INTERNALS |
16 #include "../jinclude.h" | 17 #include "../jinclude.h" |
17 #include "../jpeglib.h" | 18 #include "../jpeglib.h" |
18 #include "../jsimd.h" | 19 #include "../jsimd.h" |
(...skipping 20 matching lines...) Expand all Loading... |
39 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) | 40 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
40 return 0; | 41 return 0; |
41 | 42 |
42 if (!IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) | 43 if (!IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) |
43 return 0; | 44 return 0; |
44 | 45 |
45 return 1; | 46 return 1; |
46 } | 47 } |
47 | 48 |
48 GLOBAL(int) | 49 GLOBAL(int) |
| 50 jsimd_can_rgb_gray (void) |
| 51 { |
| 52 /* The code is optimised for these values only */ |
| 53 if (BITS_IN_JSAMPLE != 8) |
| 54 return 0; |
| 55 if (sizeof(JDIMENSION) != 4) |
| 56 return 0; |
| 57 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
| 58 return 0; |
| 59 |
| 60 if (!IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2)) |
| 61 return 0; |
| 62 |
| 63 return 1; |
| 64 } |
| 65 |
| 66 GLOBAL(int) |
49 jsimd_can_ycc_rgb (void) | 67 jsimd_can_ycc_rgb (void) |
50 { | 68 { |
51 /* The code is optimised for these values only */ | 69 /* The code is optimised for these values only */ |
52 if (BITS_IN_JSAMPLE != 8) | 70 if (BITS_IN_JSAMPLE != 8) |
53 return 0; | 71 return 0; |
54 if (sizeof(JDIMENSION) != 4) | 72 if (sizeof(JDIMENSION) != 4) |
55 return 0; | 73 return 0; |
56 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) | 74 if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) |
57 return 0; | 75 return 0; |
58 | 76 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 break; | 109 break; |
92 default: | 110 default: |
93 sse2fct=jsimd_rgb_ycc_convert_sse2; | 111 sse2fct=jsimd_rgb_ycc_convert_sse2; |
94 break; | 112 break; |
95 } | 113 } |
96 | 114 |
97 sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); | 115 sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); |
98 } | 116 } |
99 | 117 |
100 GLOBAL(void) | 118 GLOBAL(void) |
| 119 jsimd_rgb_gray_convert (j_compress_ptr cinfo, |
| 120 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
| 121 JDIMENSION output_row, int num_rows) |
| 122 { |
| 123 void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); |
| 124 |
| 125 switch(cinfo->in_color_space) |
| 126 { |
| 127 case JCS_EXT_RGB: |
| 128 sse2fct=jsimd_extrgb_gray_convert_sse2; |
| 129 break; |
| 130 case JCS_EXT_RGBX: |
| 131 sse2fct=jsimd_extrgbx_gray_convert_sse2; |
| 132 break; |
| 133 case JCS_EXT_BGR: |
| 134 sse2fct=jsimd_extbgr_gray_convert_sse2; |
| 135 break; |
| 136 case JCS_EXT_BGRX: |
| 137 sse2fct=jsimd_extbgrx_gray_convert_sse2; |
| 138 break; |
| 139 case JCS_EXT_XBGR: |
| 140 sse2fct=jsimd_extxbgr_gray_convert_sse2; |
| 141 break; |
| 142 case JCS_EXT_XRGB: |
| 143 sse2fct=jsimd_extxrgb_gray_convert_sse2; |
| 144 break; |
| 145 default: |
| 146 sse2fct=jsimd_rgb_gray_convert_sse2; |
| 147 break; |
| 148 } |
| 149 |
| 150 sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); |
| 151 } |
| 152 |
| 153 GLOBAL(void) |
101 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, | 154 jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, |
102 JSAMPIMAGE input_buf, JDIMENSION input_row, | 155 JSAMPIMAGE input_buf, JDIMENSION input_row, |
103 JSAMPARRAY output_buf, int num_rows) | 156 JSAMPARRAY output_buf, int num_rows) |
104 { | 157 { |
105 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); | 158 void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); |
106 | 159 |
107 switch(cinfo->out_color_space) | 160 switch(cinfo->out_color_space) |
108 { | 161 { |
109 case JCS_EXT_RGB: | 162 case JCS_EXT_RGB: |
110 sse2fct=jsimd_ycc_extrgb_convert_sse2; | 163 sse2fct=jsimd_ycc_extrgb_convert_sse2; |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 | 724 |
672 GLOBAL(void) | 725 GLOBAL(void) |
673 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 726 jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, |
674 JCOEFPTR coef_block, JSAMPARRAY output_buf, | 727 JCOEFPTR coef_block, JSAMPARRAY output_buf, |
675 JDIMENSION output_col) | 728 JDIMENSION output_col) |
676 { | 729 { |
677 jsimd_idct_float_sse2(compptr->dct_table, coef_block, | 730 jsimd_idct_float_sse2(compptr->dct_table, coef_block, |
678 output_buf, output_col); | 731 output_buf, output_col); |
679 } | 732 } |
680 | 733 |
OLD | NEW |