Clean up code formatting in the SIMD interface functions

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1305 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2014-05-15 19:45:11 +00:00
parent 1b3fd7eead
commit 1419852c42
6 changed files with 242 additions and 231 deletions

View File

@@ -343,22 +343,22 @@ jsimd_can_idct_float (void)
GLOBAL(void) GLOBAL(void)
jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
} }

View File

@@ -9,10 +9,8 @@
* For conditions of distribution and use, see copyright notice in jsimdext.inc * For conditions of distribution and use, see copyright notice in jsimdext.inc
* *
* This file contains the interface between the "normal" portions * This file contains the interface between the "normal" portions
* of the library and the SIMD implementations when running on * of the library and the SIMD implementations when running on a
* ARM architecture. * 32-bit ARM architecture.
*
* Based on the stubs from 'jsimd_none.c'
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -170,6 +168,7 @@ jsimd_can_ycc_rgb (void)
return 0; return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0; return 0;
if (simd_support & JSIMD_ARM_NEON) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
@@ -183,8 +182,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
{ {
void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space) switch(cinfo->in_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
neonfct=jsimd_extrgb_ycc_convert_neon; neonfct=jsimd_extrgb_ycc_convert_neon;
break; break;
@@ -213,8 +211,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
} }
if (simd_support & JSIMD_ARM_NEON) if (simd_support & JSIMD_ARM_NEON)
neonfct(cinfo->image_width, input_buf, neonfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
output_buf, output_row, num_rows);
} }
GLOBAL(void) GLOBAL(void)
@@ -231,8 +228,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
{ {
void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
neonfct=jsimd_ycc_extrgb_convert_neon; neonfct=jsimd_ycc_extrgb_convert_neon;
break; break;
@@ -261,8 +257,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
} }
if (simd_support & JSIMD_ARM_NEON) if (simd_support & JSIMD_ARM_NEON)
neonfct(cinfo->output_width, input_buf, neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
input_row, output_buf, num_rows);
} }
GLOBAL(int) GLOBAL(int)
@@ -366,7 +361,8 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
{ {
if (simd_support & JSIMD_ARM_NEON) if (simd_support & JSIMD_ARM_NEON)
jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor, jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, output_data_ptr); compptr->downsampled_width, input_data,
output_data_ptr);
} }
GLOBAL(int) GLOBAL(int)
@@ -552,7 +548,7 @@ jsimd_can_idct_2x2 (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
return 0; return 0;
@@ -575,7 +571,7 @@ jsimd_can_idct_4x4 (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
return 0; return 0;
@@ -586,8 +582,9 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
@@ -595,8 +592,9 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(int) GLOBAL(int)
@@ -641,7 +639,7 @@ jsimd_can_idct_ifast (void)
if (IFAST_SCALE_BITS != 2) if (IFAST_SCALE_BITS != 2)
return 0; return 0;
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
return 0; return 0;
@@ -657,26 +655,27 @@ jsimd_can_idct_float (void)
GLOBAL(void) GLOBAL(void)
jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
} }

View File

@@ -9,10 +9,8 @@
* For conditions of distribution and use, see copyright notice in jsimdext.inc * For conditions of distribution and use, see copyright notice in jsimdext.inc
* *
* This file contains the interface between the "normal" portions * This file contains the interface between the "normal" portions
* of the library and the SIMD implementations when running on * of the library and the SIMD implementations when running on a
* ARM architecture. * 64-bit ARM architecture.
*
* Based on the stubs from 'jsimd_none.c'
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -159,6 +157,7 @@ jsimd_can_ycc_rgb (void)
return 0; return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0; return 0;
if (simd_support & JSIMD_ARM_NEON) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
@@ -186,8 +185,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
{ {
void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
neonfct=jsimd_ycc_extrgb_convert_neon; neonfct=jsimd_ycc_extrgb_convert_neon;
break; break;
@@ -216,8 +214,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
} }
if (simd_support & JSIMD_ARM_NEON) if (simd_support & JSIMD_ARM_NEON)
neonfct(cinfo->output_width, input_buf, neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
input_row, output_buf, num_rows);
} }
GLOBAL(int) GLOBAL(int)
@@ -456,7 +453,7 @@ jsimd_can_idct_2x2 (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
return 0; return 0;
@@ -479,7 +476,7 @@ jsimd_can_idct_4x4 (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
return 0; return 0;
@@ -490,8 +487,9 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
@@ -499,8 +497,9 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(int) GLOBAL(int)
@@ -545,7 +544,7 @@ jsimd_can_idct_ifast (void)
if (IFAST_SCALE_BITS != 2) if (IFAST_SCALE_BITS != 2)
return 0; return 0;
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
return 1; return 1;
return 0; return 0;
@@ -561,26 +560,27 @@ jsimd_can_idct_float (void)
GLOBAL(void) GLOBAL(void)
jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_ARM_NEON)) if (simd_support & JSIMD_ARM_NEON)
jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
} }

View File

@@ -138,8 +138,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space) switch(cinfo->in_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_extrgb_ycc_convert_sse2; sse2fct=jsimd_extrgb_ycc_convert_sse2;
mmxfct=jsimd_extrgb_ycc_convert_mmx; mmxfct=jsimd_extrgb_ycc_convert_mmx;
@@ -176,11 +175,9 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
if ((simd_support & JSIMD_SSE2) && if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
sse2fct(cinfo->image_width, input_buf, sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
output_buf, output_row, num_rows);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->image_width, input_buf, mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
output_buf, output_row, num_rows);
} }
GLOBAL(void) GLOBAL(void)
@@ -191,8 +188,7 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo,
void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space) switch(cinfo->in_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_extrgb_gray_convert_sse2; sse2fct=jsimd_extrgb_gray_convert_sse2;
mmxfct=jsimd_extrgb_gray_convert_mmx; mmxfct=jsimd_extrgb_gray_convert_mmx;
@@ -229,11 +225,9 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo,
if ((simd_support & JSIMD_SSE2) && if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2)) IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2))
sse2fct(cinfo->image_width, input_buf, sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
output_buf, output_row, num_rows);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->image_width, input_buf, mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
output_buf, output_row, num_rows);
} }
GLOBAL(void) GLOBAL(void)
@@ -244,8 +238,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_ycc_extrgb_convert_sse2; sse2fct=jsimd_ycc_extrgb_convert_sse2;
mmxfct=jsimd_ycc_extrgb_convert_mmx; mmxfct=jsimd_ycc_extrgb_convert_mmx;
@@ -282,11 +275,9 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
if ((simd_support & JSIMD_SSE2) && if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
sse2fct(cinfo->output_width, input_buf, sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
input_row, output_buf, num_rows);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->output_width, input_buf, mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
input_row, output_buf, num_rows);
} }
GLOBAL(int) GLOBAL(int)
@@ -333,12 +324,13 @@ jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
{ {
if (simd_support & JSIMD_SSE2) if (simd_support & JSIMD_SSE2)
jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor, compptr->width_in_blocks, compptr->v_samp_factor,
input_data, output_data); compptr->width_in_blocks, input_data,
output_data);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor, compptr->width_in_blocks, compptr->v_samp_factor, compptr->width_in_blocks,
input_data, output_data); input_data, output_data);
} }
GLOBAL(void) GLOBAL(void)
@@ -347,12 +339,13 @@ jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
{ {
if (simd_support & JSIMD_SSE2) if (simd_support & JSIMD_SSE2)
jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor, compptr->width_in_blocks, compptr->v_samp_factor,
input_data, output_data); compptr->width_in_blocks, input_data,
output_data);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor, compptr->width_in_blocks, compptr->v_samp_factor, compptr->width_in_blocks,
input_data, output_data); input_data, output_data);
} }
GLOBAL(int) GLOBAL(int)
@@ -400,11 +393,11 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo,
JSAMPARRAY * output_data_ptr) JSAMPARRAY * output_data_ptr)
{ {
if (simd_support & JSIMD_SSE2) if (simd_support & JSIMD_SSE2)
jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
cinfo->output_width, input_data, output_data_ptr); input_data, output_data_ptr);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width,
cinfo->output_width, input_data, output_data_ptr); input_data, output_data_ptr);
} }
GLOBAL(void) GLOBAL(void)
@@ -414,11 +407,11 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo,
JSAMPARRAY * output_data_ptr) JSAMPARRAY * output_data_ptr)
{ {
if (simd_support & JSIMD_SSE2) if (simd_support & JSIMD_SSE2)
jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
cinfo->output_width, input_data, output_data_ptr); input_data, output_data_ptr);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width,
cinfo->output_width, input_data, output_data_ptr); input_data, output_data_ptr);
} }
GLOBAL(int) GLOBAL(int)
@@ -470,10 +463,12 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
if ((simd_support & JSIMD_SSE2) && if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, output_data_ptr); compptr->downsampled_width, input_data,
output_data_ptr);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor, jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, output_data_ptr); compptr->downsampled_width, input_data,
output_data_ptr);
} }
GLOBAL(void) GLOBAL(void)
@@ -485,10 +480,12 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
if ((simd_support & JSIMD_SSE2) && if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, output_data_ptr); compptr->downsampled_width, input_data,
output_data_ptr);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor, jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, output_data_ptr); compptr->downsampled_width, input_data,
output_data_ptr);
} }
GLOBAL(int) GLOBAL(int)
@@ -540,8 +537,7 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2;
mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx; mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx;
@@ -578,11 +574,9 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
if ((simd_support & JSIMD_SSE2) && if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
sse2fct(cinfo->output_width, input_buf, sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
in_row_group_ctr, output_buf);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->output_width, input_buf, mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
in_row_group_ctr, output_buf);
} }
GLOBAL(void) GLOBAL(void)
@@ -594,8 +588,7 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2;
mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx; mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx;
@@ -632,11 +625,9 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
if ((simd_support & JSIMD_SSE2) && if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
sse2fct(cinfo->output_width, input_buf, sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
in_row_group_ctr, output_buf);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->output_width, input_buf, mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
in_row_group_ctr, output_buf);
} }
GLOBAL(int) GLOBAL(int)
@@ -915,7 +906,8 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col);
} }
@@ -926,7 +918,8 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col);
} }
@@ -1013,39 +1006,43 @@ jsimd_can_idct_float (void)
GLOBAL(void) GLOBAL(void)
jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX) else if (simd_support & JSIMD_MMX)
jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
jsimd_idct_float_sse2(compptr->dct_table, coef_block, jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf,
output_buf, output_col); output_col);
else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse))
jsimd_idct_float_sse(compptr->dct_table, coef_block, jsimd_idct_float_sse(compptr->dct_table, coef_block, output_buf,
output_buf, output_col); output_col);
else if (simd_support & JSIMD_3DNOW) else if (simd_support & JSIMD_3DNOW)
jsimd_idct_float_3dnow(compptr->dct_table, coef_block, jsimd_idct_float_3dnow(compptr->dct_table, coef_block, output_buf,
output_buf, output_col); output_col);
} }

View File

@@ -10,10 +10,8 @@
* For conditions of distribution and use, see copyright notice in jsimdext.inc * For conditions of distribution and use, see copyright notice in jsimdext.inc
* *
* This file contains the interface between the "normal" portions * This file contains the interface between the "normal" portions
* of the library and the SIMD implementations when running on * of the library and the SIMD implementations when running on a
* MIPS architecture. * MIPS architecture.
*
* Based on the stubs from 'jsimd_none.c'
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -53,6 +51,7 @@ parse_proc_cpuinfo(const char* search_string)
/* Did not find string in the proc file, or not Linux ELF. */ /* Did not find string in the proc file, or not Linux ELF. */
return 0; return 0;
} }
#endif #endif
/* /*
@@ -78,6 +77,7 @@ init_simd (void)
return; return;
#endif #endif
} }
static const int mips_idct_ifast_coefs[4] = { static const int mips_idct_ifast_coefs[4] = {
0x45404540, // FIX( 1.082392200 / 2) = 17734 = 0x4546 0x45404540, // FIX( 1.082392200 / 2) = 17734 = 0x4546
0x5A805A80, // FIX( 1.414213562 / 2) = 23170 = 0x5A82 0x5A805A80, // FIX( 1.414213562 / 2) = 23170 = 0x5A82
@@ -97,6 +97,7 @@ jsimd_can_rgb_ycc (void)
return 0; return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -115,6 +116,7 @@ jsimd_can_rgb_gray (void)
return 0; return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -133,6 +135,7 @@ jsimd_can_ycc_rgb (void)
return 0; return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -149,6 +152,7 @@ jsimd_c_can_null_convert (void)
return 0; return 0;
if (sizeof(JDIMENSION) != 4) if (sizeof(JDIMENSION) != 4)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -161,8 +165,8 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
JDIMENSION output_row, int num_rows) JDIMENSION output_row, int num_rows)
{ {
void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space)
{ switch(cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
mipsdspr2fct=jsimd_extrgb_ycc_convert_mips_dspr2; mipsdspr2fct=jsimd_extrgb_ycc_convert_mips_dspr2;
break; break;
@@ -192,8 +196,8 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
} }
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
mipsdspr2fct(cinfo->image_width, input_buf, mipsdspr2fct(cinfo->image_width, input_buf, output_buf, output_row,
output_buf, output_row, num_rows); num_rows);
} }
GLOBAL(void) GLOBAL(void)
@@ -202,8 +206,8 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo,
JDIMENSION output_row, int num_rows) JDIMENSION output_row, int num_rows)
{ {
void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space)
{ switch(cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
mipsdspr2fct=jsimd_extrgb_gray_convert_mips_dspr2; mipsdspr2fct=jsimd_extrgb_gray_convert_mips_dspr2;
break; break;
@@ -232,9 +236,8 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo,
} }
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
mipsdspr2fct(cinfo->image_width, input_buf, mipsdspr2fct(cinfo->image_width, input_buf, output_buf, output_row,
output_buf, output_row, num_rows); num_rows);
} }
GLOBAL(void) GLOBAL(void)
@@ -244,8 +247,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
{ {
void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
mipsdspr2fct=jsimd_ycc_extrgb_convert_mips_dspr2; mipsdspr2fct=jsimd_ycc_extrgb_convert_mips_dspr2;
break; break;
@@ -274,8 +276,8 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
} }
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
mipsdspr2fct(cinfo->output_width, input_buf, mipsdspr2fct(cinfo->output_width, input_buf, input_row, output_buf,
input_row, output_buf, num_rows); num_rows);
} }
GLOBAL(void) GLOBAL(void)
@@ -284,8 +286,9 @@ jsimd_c_null_convert (j_compress_ptr cinfo,
JDIMENSION output_row, int num_rows) JDIMENSION output_row, int num_rows)
{ {
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_null_convert_compr_mips_dspr2 (cinfo->image_width, input_buf, jsimd_null_convert_compr_mips_dspr2(cinfo->image_width, input_buf,
output_buf, output_row, num_rows, cinfo->num_components); output_buf, output_row, num_rows,
cinfo->num_components);
} }
GLOBAL(int) GLOBAL(int)
@@ -298,6 +301,7 @@ jsimd_can_h2v2_downsample (void)
return 0; return 0;
if (sizeof(JDIMENSION) != 4) if (sizeof(JDIMENSION) != 4)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -316,6 +320,7 @@ jsimd_can_h2v2_smooth_downsample (void)
return 0; return 0;
if(DCTSIZE != 8) if(DCTSIZE != 8)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -332,6 +337,7 @@ jsimd_can_h2v1_downsample (void)
return 0; return 0;
if (sizeof(JDIMENSION) != 4) if (sizeof(JDIMENSION) != 4)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -344,18 +350,23 @@ jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
{ {
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_h2v2_downsample_mips_dspr2(cinfo->image_width, jsimd_h2v2_downsample_mips_dspr2(cinfo->image_width,
cinfo->max_v_samp_factor, compptr->v_samp_factor, cinfo->max_v_samp_factor,
compptr->width_in_blocks, input_data, output_data); compptr->v_samp_factor,
compptr->width_in_blocks, input_data,
output_data);
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo,
jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data) JSAMPARRAY input_data, JSAMPARRAY output_data)
{ {
jsimd_h2v2_smooth_downsample_mips_dspr2(input_data, output_data, jsimd_h2v2_smooth_downsample_mips_dspr2(input_data, output_data,
compptr->v_samp_factor, cinfo->max_v_samp_factor, compptr->v_samp_factor,
cinfo->smoothing_factor, compptr->width_in_blocks, cinfo->max_v_samp_factor,
cinfo->image_width); cinfo->smoothing_factor,
compptr->width_in_blocks,
cinfo->image_width);
} }
GLOBAL(void) GLOBAL(void)
@@ -364,8 +375,10 @@ jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
{ {
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_h2v1_downsample_mips_dspr2(cinfo->image_width, jsimd_h2v1_downsample_mips_dspr2(cinfo->image_width,
cinfo->max_v_samp_factor, compptr->v_samp_factor, cinfo->max_v_samp_factor,
compptr->width_in_blocks, input_data, output_data); compptr->v_samp_factor,
compptr->width_in_blocks,
input_data, output_data);
} }
GLOBAL(int) GLOBAL(int)
@@ -378,6 +391,7 @@ jsimd_can_h2v2_upsample (void)
return 0; return 0;
if (sizeof(JDIMENSION) != 4) if (sizeof(JDIMENSION) != 4)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -394,6 +408,7 @@ jsimd_can_h2v1_upsample (void)
return 0; return 0;
if (sizeof(JDIMENSION) != 4) if (sizeof(JDIMENSION) != 4)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -408,7 +423,8 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo,
{ {
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_h2v2_upsample_mips_dspr2(cinfo->max_v_samp_factor, jsimd_h2v2_upsample_mips_dspr2(cinfo->max_v_samp_factor,
cinfo->output_width, input_data, output_data_ptr); cinfo->output_width, input_data,
output_data_ptr);
} }
GLOBAL(void) GLOBAL(void)
@@ -419,7 +435,8 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo,
{ {
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_h2v1_upsample_mips_dspr2(cinfo->max_v_samp_factor, jsimd_h2v1_upsample_mips_dspr2(cinfo->max_v_samp_factor,
cinfo->output_width, input_data, output_data_ptr); cinfo->output_width, input_data,
output_data_ptr);
} }
GLOBAL(int) GLOBAL(int)
@@ -432,6 +449,7 @@ jsimd_can_h2v2_fancy_upsample (void)
return 0; return 0;
if (sizeof(JDIMENSION) != 4) if (sizeof(JDIMENSION) != 4)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -448,6 +466,7 @@ jsimd_can_h2v1_fancy_upsample (void)
return 0; return 0;
if (sizeof(JDIMENSION) != 4) if (sizeof(JDIMENSION) != 4)
return 0; return 0;
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
@@ -462,7 +481,8 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
{ {
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_h2v2_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor, jsimd_h2v2_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, output_data_ptr); compptr->downsampled_width,
input_data, output_data_ptr);
} }
GLOBAL(void) GLOBAL(void)
@@ -473,7 +493,8 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
{ {
if (simd_support & JSIMD_MIPS_DSPR2) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_h2v1_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor, jsimd_h2v1_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data, output_data_ptr); compptr->downsampled_width,
input_data, output_data_ptr);
} }
GLOBAL(int) GLOBAL(int)
@@ -510,10 +531,10 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *); void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY,
JSAMPLE *);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
mipsdspr2fct=jsimd_h2v2_extrgb_merged_upsample_mips_dspr2; mipsdspr2fct=jsimd_h2v2_extrgb_merged_upsample_mips_dspr2;
break; break;
@@ -541,8 +562,8 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
break; break;
} }
mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf,
output_buf, cinfo->sample_range_limit); cinfo->sample_range_limit);
} }
GLOBAL(void) GLOBAL(void)
@@ -551,10 +572,10 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *); void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY,
JSAMPLE *);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
mipsdspr2fct=jsimd_h2v1_extrgb_merged_upsample_mips_dspr2; mipsdspr2fct=jsimd_h2v1_extrgb_merged_upsample_mips_dspr2;
break; break;
@@ -582,8 +603,8 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
break; break;
} }
mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf,
output_buf, cinfo->sample_range_limit); cinfo->sample_range_limit);
} }
GLOBAL(int) GLOBAL(int)
@@ -624,7 +645,7 @@ jsimd_can_convsamp_float (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
return 0; return 0;
@@ -683,6 +704,8 @@ jsimd_can_fdct_ifast (void)
GLOBAL(int) GLOBAL(int)
jsimd_can_fdct_float (void) jsimd_can_fdct_float (void)
{ {
init_simd();
return 0; return 0;
} }
@@ -741,7 +764,7 @@ jsimd_can_quantize_float (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
return 0; return 0;
@@ -759,7 +782,7 @@ GLOBAL(void)
jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
FAST_FLOAT * workspace) FAST_FLOAT * workspace)
{ {
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_quantize_float_mips_dspr2(coef_block, divisors, workspace); jsimd_quantize_float_mips_dspr2(coef_block, divisors, workspace);
} }
@@ -780,7 +803,7 @@ jsimd_can_idct_2x2 (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
return 0; return 0;
@@ -803,7 +826,7 @@ jsimd_can_idct_4x4 (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
return 0; return 0;
@@ -826,7 +849,7 @@ jsimd_can_idct_6x6 (void)
if (sizeof(ISLOW_MULT_TYPE) != 2) if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0; return 0;
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
return 0; return 0;
@@ -859,9 +882,9 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_idct_2x2_mips_dspr2(compptr->dct_table, coef_block, jsimd_idct_2x2_mips_dspr2(compptr->dct_table, coef_block, output_buf,
output_buf, output_col); output_col);
} }
GLOBAL(void) GLOBAL(void)
@@ -869,11 +892,10 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2) {
{
int workspace[DCTSIZE*4]; /* buffers data between passes */ int workspace[DCTSIZE*4]; /* buffers data between passes */
jsimd_idct_4x4_mips_dspr2(compptr->dct_table, coef_block, jsimd_idct_4x4_mips_dspr2(compptr->dct_table, coef_block, output_buf,
output_buf, output_col, workspace); output_col, workspace);
} }
} }
@@ -882,9 +904,9 @@ jsimd_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
jsimd_idct_6x6_mips_dspr2(compptr->dct_table, coef_block, jsimd_idct_6x6_mips_dspr2(compptr->dct_table, coef_block, output_buf,
output_buf, output_col); output_col);
} }
GLOBAL(void) GLOBAL(void)
@@ -908,8 +930,8 @@ jsimd_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
(int)(output_buf[10] + output_col), (int)(output_buf[10] + output_col),
(int)(output_buf[11] + output_col), (int)(output_buf[11] + output_col),
}; };
jsimd_idct_12x12_pass1_mips_dspr2(coef_block, jsimd_idct_12x12_pass1_mips_dspr2(coef_block, compptr->dct_table,
compptr->dct_table, workspace); workspace);
jsimd_idct_12x12_pass2_mips_dspr2(workspace, output); jsimd_idct_12x12_pass2_mips_dspr2(workspace, output);
} }
} }
@@ -956,7 +978,7 @@ jsimd_can_idct_ifast (void)
if (IFAST_SCALE_BITS != 2) if (IFAST_SCALE_BITS != 2)
return 0; return 0;
if ((simd_support & JSIMD_MIPS_DSPR2)) if (simd_support & JSIMD_MIPS_DSPR2)
return 1; return 1;
return 0; return 0;
@@ -965,13 +987,15 @@ jsimd_can_idct_ifast (void)
GLOBAL(int) GLOBAL(int)
jsimd_can_idct_float (void) jsimd_can_idct_float (void)
{ {
init_simd();
return 0; return 0;
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
if (simd_support & JSIMD_MIPS_DSPR2) { if (simd_support & JSIMD_MIPS_DSPR2) {
int output[8] = { int output[8] = {
@@ -1019,7 +1043,7 @@ jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
GLOBAL(void) GLOBAL(void)
jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
} }

View File

@@ -10,7 +10,7 @@
* *
* This file contains the interface between the "normal" portions * This file contains the interface between the "normal" portions
* of the library and the SIMD implementations when running on a * of the library and the SIMD implementations when running on a
* x86_64 architecture. * 64-bit x86 architecture.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -87,8 +87,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
{ {
void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space) switch(cinfo->in_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_extrgb_ycc_convert_sse2; sse2fct=jsimd_extrgb_ycc_convert_sse2;
break; break;
@@ -126,8 +125,7 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo,
{ {
void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space) switch(cinfo->in_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_extrgb_gray_convert_sse2; sse2fct=jsimd_extrgb_gray_convert_sse2;
break; break;
@@ -165,8 +163,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
{ {
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_ycc_extrgb_convert_sse2; sse2fct=jsimd_ycc_extrgb_convert_sse2;
break; break;
@@ -225,10 +222,8 @@ GLOBAL(void)
jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data) JSAMPARRAY input_data, JSAMPARRAY output_data)
{ {
jsimd_h2v2_downsample_sse2(cinfo->image_width, jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks,
compptr->v_samp_factor,
compptr->width_in_blocks,
input_data, output_data); input_data, output_data);
} }
@@ -236,10 +231,8 @@ GLOBAL(void)
jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data) JSAMPARRAY input_data, JSAMPARRAY output_data)
{ {
jsimd_h2v1_downsample_sse2(cinfo->image_width, jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks,
compptr->v_samp_factor,
compptr->width_in_blocks,
input_data, output_data); input_data, output_data);
} }
@@ -273,8 +266,7 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo,
JSAMPARRAY input_data, JSAMPARRAY input_data,
JSAMPARRAY * output_data_ptr) JSAMPARRAY * output_data_ptr)
{ {
jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
cinfo->output_width,
input_data, output_data_ptr); input_data, output_data_ptr);
} }
@@ -284,8 +276,7 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo,
JSAMPARRAY input_data, JSAMPARRAY input_data,
JSAMPARRAY * output_data_ptr) JSAMPARRAY * output_data_ptr)
{ {
jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
cinfo->output_width,
input_data, output_data_ptr); input_data, output_data_ptr);
} }
@@ -326,8 +317,8 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
JSAMPARRAY * output_data_ptr) JSAMPARRAY * output_data_ptr)
{ {
jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor,
compptr->downsampled_width, compptr->downsampled_width, input_data,
input_data, output_data_ptr); output_data_ptr);
} }
GLOBAL(void) GLOBAL(void)
@@ -337,8 +328,8 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
JSAMPARRAY * output_data_ptr) JSAMPARRAY * output_data_ptr)
{ {
jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
compptr->downsampled_width, compptr->downsampled_width, input_data,
input_data, output_data_ptr); output_data_ptr);
} }
GLOBAL(int) GLOBAL(int)
@@ -379,8 +370,7 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
{ {
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2;
break; break;
@@ -419,8 +409,7 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
{ {
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
switch(cinfo->out_color_space) switch(cinfo->out_color_space) {
{
case JCS_EXT_RGB: case JCS_EXT_RGB:
sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2;
break; break;
@@ -728,26 +717,28 @@ jsimd_can_idct_float (void)
GLOBAL(void) GLOBAL(void)
jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
} }
GLOBAL(void) GLOBAL(void)
jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
jsimd_idct_float_sse2(compptr->dct_table, coef_block, jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf,
output_buf, output_col); output_col);
} }