summaryrefslogtreecommitdiff
path: root/android/jni
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2011-10-07 12:46:20 +0100
committerRobin Watts <robin@ghostscript.com>2011-11-14 15:52:20 +0000
commite806b23e27d873516ba2c232c7d5f6c3bbfad370 (patch)
treea3a6880f2aa25a4ce6a020b8e7f3c212e7f47f50 /android/jni
parent97d00440c043b712a2d16134e3b52850c7b36d47 (diff)
downloadmupdf-e806b23e27d873516ba2c232c7d5f6c3bbfad370.tar.xz
ARM opts in draw_scale.c; updated android build opts.
Kammerer reports 90%+ of CPU time is spent in the image scaling code for his documents on Android. In this commit we provide ARM optimised cores for the common scaling routines (1/2/4 components). Tests indicate this doubles the speed of rendering for a bitmap heavy PDF file on an HTC desire. This code is included if ARCH_ARM is defined. If ARCH_THUMB is defined then extra instructions are added to ensure correct interworking. We also update the Android jni makefiles to set these defines. We update the ReadMe.txt with more explicit instructions and update with more modern ndk/sdk versions. We update build.xml in line with new sdk releases.
Diffstat (limited to 'android/jni')
-rw-r--r--android/jni/Core.mk3
-rw-r--r--android/jni/mupdf.c18
2 files changed, 20 insertions, 1 deletions
diff --git a/android/jni/Core.mk b/android/jni/Core.mk
index 4c3e75b5..7f145c60 100644
--- a/android/jni/Core.mk
+++ b/android/jni/Core.mk
@@ -4,6 +4,8 @@ include $(CLEAR_VARS)
MY_ROOT := ../..
+LOCAL_CFLAGS += -DARCH_ARM -DARCH_THUMB
+
LOCAL_C_INCLUDES := \
../thirdparty/jbig2dec \
../thirdparty/openjpeg-1.4/libopenjpeg \
@@ -53,7 +55,6 @@ LOCAL_SRC_FILES := \
$(MY_ROOT)/fitz/stm_buffer.c \
$(MY_ROOT)/fitz/stm_open.c \
$(MY_ROOT)/fitz/stm_read.c \
- $(MY_ROOT)/draw/arch_arm.c \
$(MY_ROOT)/draw/arch_port.c \
$(MY_ROOT)/draw/draw_affine.c \
$(MY_ROOT)/draw/draw_blend.c \
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c
index 463899af..a3d45d8d 100644
--- a/android/jni/mupdf.c
+++ b/android/jni/mupdf.c
@@ -17,6 +17,9 @@
/* Set to 1 to enable debug log traces. */
#define DEBUG 0
+/* Enable to log rendering times (render each frame 100 times and time) */
+#undef TIME_DISPLAY_LIST
+
/* Globals */
fz_colorspace *colorspace;
fz_glyph_cache *glyphcache;
@@ -190,7 +193,22 @@ Java_com_artifex_mupdf_MuPDFCore_drawPage(JNIEnv *env, jobject thiz, jobject bit
ctm = fz_concat(ctm, fz_scale(xscale, yscale));
bbox = fz_round_rect(fz_transform_rect(ctm,currentMediabox));
dev = fz_new_draw_device(glyphcache, pix);
+#ifdef TIME_DISPLAY_LIST
+ {
+ clock_t time;
+ int i;
+
+ LOGE("Executing display list");
+ time = clock();
+ for (i=0; i<100;i++) {
+#endif
fz_execute_display_list(currentPageList, dev, ctm, bbox);
+#ifdef TIME_DISPLAY_LIST
+ }
+ time = clock() - time;
+ LOGE("100 renders in %d (%d per sec)", time, CLOCKS_PER_SEC);
+ }
+#endif
fz_free_device(dev);
fz_drop_pixmap(pix);
LOGE("Rendered");