Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Revert "Revert "JPEG decoding arm64 optimization""
Browse files Browse the repository at this point in the history
And fix clang build break on
.arch armv8-a+fp+simd

This reverts commit 0e087c4.

Change-Id: I1447da5403c55a0079e46f052b18005b9bc5a438
  • Loading branch information
ek9852 committed Nov 4, 2015
1 parent 458bfbf commit ec5f14e
Show file tree
Hide file tree
Showing 7 changed files with 1,954 additions and 13 deletions.
4 changes: 4 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ ifeq ($(TARGET_ARCH),x86)
LOCAL_SRC_FILES += jidctintelsse.c
endif

LOCAL_SRC_FILES_arm64 += \
jsimd_arm64_neon.S \
jsimd_neon.c

ifeq ($(strip $(TARGET_ARCH)),arm)
ifeq ($(ARCH_ARM_HAVE_NEON),true)
#use NEON accelerations
Expand Down
21 changes: 16 additions & 5 deletions jdcolor.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#ifdef NV_ARM_NEON
#if defined(NV_ARM_NEON) || defined(__aarch64__)
#include "jsimd_neon.h"
#endif

Expand Down Expand Up @@ -804,8 +804,17 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
case JCS_RGB:
cinfo->out_color_components = RGB_PIXELSIZE;
if (cinfo->jpeg_color_space == JCS_YCbCr) {
#if defined(__aarch64__)
if (cap_neon_ycc_rgb()) {
cconvert->pub.color_convert = jsimd_ycc_rgb_convert;
} else {
cconvert->pub.color_convert = ycc_rgb_convert;
build_ycc_rgb_table(cinfo);
}
#else
cconvert->pub.color_convert = ycc_rgb_convert;
build_ycc_rgb_table(cinfo);
#endif
} else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
cconvert->pub.color_convert = gray_rgb_convert;
} else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) {
Expand All @@ -818,16 +827,17 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
case JCS_RGBA_8888:
cinfo->out_color_components = 4;
if (cinfo->jpeg_color_space == JCS_YCbCr) {
#if defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)
#if (defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)) || defined(__aarch64__)
if (cap_neon_ycc_rgb()) {
cconvert->pub.color_convert = jsimd_ycc_rgba8888_convert;
} else {
cconvert->pub.color_convert = ycc_rgba_8888_convert;
build_ycc_rgb_table(cinfo);
}
#else
cconvert->pub.color_convert = ycc_rgba_8888_convert;
#endif
build_ycc_rgb_table(cinfo);
#endif
} else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
cconvert->pub.color_convert = gray_rgba_8888_convert;
} else if (cinfo->jpeg_color_space == JCS_RGB) {
Expand All @@ -840,16 +850,17 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
cinfo->out_color_components = RGB_PIXELSIZE;
if (cinfo->dither_mode == JDITHER_NONE) {
if (cinfo->jpeg_color_space == JCS_YCbCr) {
#if defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)
#if (defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)) || defined(__aarch64__)
if (cap_neon_ycc_rgb()) {
cconvert->pub.color_convert = jsimd_ycc_rgb565_convert;
} else {
cconvert->pub.color_convert = ycc_rgb_565_convert;
build_ycc_rgb_table(cinfo);
}
#else
cconvert->pub.color_convert = ycc_rgb_565_convert;
#endif
build_ycc_rgb_table(cinfo);
#endif
} else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
cconvert->pub.color_convert = gray_rgb_565_convert;
} else if (cinfo->jpeg_color_space == JCS_RGB) {
Expand Down
13 changes: 9 additions & 4 deletions jddctmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "jpeglib.h"
#include "jdct.h" /* Private declarations for DCT subsystem */

#ifdef NV_ARM_NEON
#if defined(NV_ARM_NEON) || defined(__aarch64__)
#include "jsimd_neon.h"
#endif

Expand Down Expand Up @@ -137,7 +137,7 @@ start_pass (j_decompress_ptr cinfo)
method = JDCT_ISLOW; /* jidctred uses islow-style table */
break;
case 2:
#if defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)
#if (defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)) || defined(__aarch64__)
if (cap_neon_idct_2x2()) {
method_ptr = jsimd_idct_2x2;
} else {
Expand All @@ -149,7 +149,7 @@ start_pass (j_decompress_ptr cinfo)
method = JDCT_ISLOW; /* jidctred uses islow-style table */
break;
case 4:
#if defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)
#if (defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)) || defined(__aarch64__)
if (cap_neon_idct_4x4()) {
method_ptr = jsimd_idct_4x4;
} else {
Expand Down Expand Up @@ -186,13 +186,18 @@ start_pass (j_decompress_ptr cinfo)
#else /* ANDROID_MIPS_IDCT */
#ifdef DCT_ISLOW_SUPPORTED
case JDCT_ISLOW:
#if defined(__aarch64__)
if (cap_neon_idct_islow())
method_ptr = jsimd_idct_islow;
else
#endif
method_ptr = jpeg_idct_islow;
method = JDCT_ISLOW;
break;
#endif
#ifdef DCT_IFAST_SUPPORTED
case JDCT_IFAST:
#if defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)
#if (defined(NV_ARM_NEON) && defined(__ARM_HAVE_NEON)) || defined(__aarch64__)
if (cap_neon_idct_ifast()) {
method_ptr = jsimd_idct_ifast;
} else {
Expand Down
2 changes: 1 addition & 1 deletion jmorecfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ typedef int boolean;
#define MULTIPLIER short
#elif ANDROID_MIPS_IDCT
#define MULTIPLIER short
#elif NV_ARM_NEON
#elif defined(NV_ARM_NEON) || defined(__aarch64__)
#define MULTIPLIER short
#else
#define MULTIPLIER int /* type for fastest integer multiply */
Expand Down
Loading

0 comments on commit ec5f14e

Please sign in to comment.