Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 52 additions & 10 deletions src/jni/jpeg/Android.mk
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,37 +1,79 @@
LOCAL_PATH:= $(call my-dir)
LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)

LOCAL_ARM_MODE := arm

# Set ANDROID_JPEG_USE_VENUM to true to enable VeNum optimizations
ANDROID_JPEG_USE_VENUM := true

# Disable VeNum optimizations if they are not supported on the build target
ifneq ($(ARCH_ARM_HAVE_VFP),true)
ANDROID_JPEG_USE_VENUM := false
else
ifneq ($(ARCH_ARM_HAVE_NEON),true)
ANDROID_JPEG_USE_VENUM := false
endif
endif

LOCAL_SRC_FILES := \
de_mjpegsample_NativeJpegLib.c \
jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
jfdctint.c jidctflt.c jidctred.c jquant1.c \
jfdctint.c jidctflt.c jquant1.c \
jquant2.c jutils.c jmemmgr.c \

# use ashmem as libjpeg decoder's backing store
#LOCAL_CFLAGS += -DUSE_ANDROID_ASHMEM
#LOCAL_SRC_FILES += \
jmem-ashmem.c

# the original android memory manager.
# use sdcard as libjpeg decoder's backing store
LOCAL_SRC_FILES += \
jmem-android.c


# the assembler is only for the ARM version, don't break the Linux sim
ifneq ($(TARGET_ARCH),arm)
ANDROID_JPEG_NO_ASSEMBLER := true
endif

# temp fix until we understand why this broke cnn.com
#ANDROID_JPEG_NO_ASSEMBLER := true

ifeq ($(strip $(ANDROID_JPEG_NO_ASSEMBLER)),true)
LOCAL_SRC_FILES += jidctint.c jidctfst.c
LOCAL_SRC_FILES += jidctint.c jidctfst.c jidctred.c
else
LOCAL_SRC_FILES += jidctint.c jidctfst.S
ifeq ($(ANDROID_JPEG_USE_VENUM),true)
LOCAL_SRC_FILES += jidctvenum.c
LOCAL_SRC_FILES += asm/armv7/jdcolor-armv7.S
LOCAL_SRC_FILES += asm/armv7/jdcolor-android-armv7.S
LOCAL_SRC_FILES += asm/armv7/jdidct-armv7.S
LOCAL_CFLAGS += -DANDROID_JPEG_USE_VENUM
else # ANDROID_JPEG_USE_VENUM, false
LOCAL_SRC_FILES += jidctint.c jidctred.c jidctfst.c armv6_idct.S
LOCAL_CFLAGS += -DANDROID_ARMV6_IDCT
endif # ANDROID_JPEG_USE_VENUM
endif

LOCAL_CFLAGS += -DAVOID_TABLES
LOCAL_CFLAGS += -DAVOID_TABLES
LOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays
#LOCAL_CFLAGS += -march=armv6j

# enable tile based decode
LOCAL_CFLAGS += -DANDROID_TILE_BASED_DECODE

ifdef NEEDS_ARM_ERRATA_754319_754320
asm_flags := \
--defsym NEEDS_ARM_ERRATA_754319_754320_ASM=1

LOCAL_CFLAGS+= \
$(foreach f,$(asm_flags),-Wa,"$(f)")
endif

LOCAL_MODULE:= jpeg

include $(BUILD_STATIC_LIBRARY)
LOCAL_SHARED_LIBRARIES := \
libcutils

include $(BUILD_SHARED_LIBRARY)
49 changes: 49 additions & 0 deletions src/jni/jpeg/CleanSpec.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)

# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
20 changes: 20 additions & 0 deletions src/jni/jpeg/README-VeNum
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
README-VeNum
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
=================================================================

Consumers are increasingly browsing Web based photo galleries incorporating
high-resolution JPEG images with their mobile devices. These images are
decoded by the mobile device, and typically also scaled down to fit the user's
zoom selection on the device's browser.

In order to improve both decode and download times, Qualcomm Innovation Center
has optimized the JPEG library found on many common OS platforms such as Web
OS, Android, and Chrome OS. Our team re-implemented several routines to utilize the
DSP-like SIMD capabilities of the ARM NEON instruction set. These were then
tuned and tested on Qualcomm's Snapdragon platform which implements the VeNum
implementation of these same instructions.

The specific areas of focus cover VeNum/NEON acceleration of Inverse Discrete
Cosine Transform (iDCT) for 8x8, 4x4, 2x2, and 1x1 block sizes and YUV to RGB
color space conversion. This resulted in a range of 18-32% improvement in JPEG
decode and downscale times for images greater than 2Mpixels.
9 changes: 9 additions & 0 deletions src/jni/jpeg/ThirdPartyProject.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2010 Google Inc. All Rights Reserved.
#Fri Jul 16 10:03:09 PDT 2010
currentVersion=8a
version=6b
isNative=true
name=jpeg
keywords=jpeg
onDevice=true
homepage=http\://www.ijg.org/
Loading