improve log2 test
- add check for native log2 to configure - use a common define (NOT_HAVE_LOG2) to enable use of local library version for non-autoconf platforms without their own version, currently msvc and android This uses a negative (NOT_HAVE_) to simplify the ifdef Change-Id: Id0610eed507f8bb9c5da338918112853d5c8127a
This commit is contained in:
parent
e852f83205
commit
992187a380
@ -38,7 +38,8 @@ LOCAL_SRC_FILES := \
|
|||||||
src/utils/tcoder.c \
|
src/utils/tcoder.c \
|
||||||
src/utils/thread.c \
|
src/utils/thread.c \
|
||||||
|
|
||||||
LOCAL_CFLAGS := -Wall -DANDROID -DHAVE_MALLOC_H -DHAVE_PTHREAD -DWEBP_USE_THREAD \
|
LOCAL_CFLAGS := -Wall -DANDROID -DHAVE_MALLOC_H -DHAVE_PTHREAD \
|
||||||
|
-DNOT_HAVE_LOG2 -DWEBP_USE_THREAD \
|
||||||
-finline-functions -frename-registers -ffast-math \
|
-finline-functions -frename-registers -ffast-math \
|
||||||
-s -fomit-frame-pointer -Isrc/webp
|
-s -fomit-frame-pointer -Isrc/webp
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ CCNODBG = cl.exe /nologo /O2 /DNDEBUG
|
|||||||
CCDEBUG = cl.exe /nologo /Od /Gm /Zi /D_DEBUG /RTC1
|
CCDEBUG = cl.exe /nologo /Od /Gm /Zi /D_DEBUG /RTC1
|
||||||
CFLAGS = /Isrc /nologo /W3 /EHsc /FD /c /GS
|
CFLAGS = /Isrc /nologo /W3 /EHsc /FD /c /GS
|
||||||
CFLAGS = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN
|
CFLAGS = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN
|
||||||
CFLAGS = $(CFLAGS) /DHAVE_WINCODEC_H /DWEBP_USE_THREAD
|
CFLAGS = $(CFLAGS) /DHAVE_WINCODEC_H /DWEBP_USE_THREAD /DNOT_HAVE_LOG2
|
||||||
LDFLAGS = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE
|
LDFLAGS = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE
|
||||||
LDFLAGS = $(LDFLAGS) $(PLATFORM_LDFLAGS)
|
LDFLAGS = $(LDFLAGS) $(PLATFORM_LDFLAGS)
|
||||||
LNKDLL = link.exe /DLL
|
LNKDLL = link.exe /DLL
|
||||||
|
@ -11,6 +11,11 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
|
|||||||
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
|
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
|
||||||
AC_SUBST([pkgconfigdir])
|
AC_SUBST([pkgconfigdir])
|
||||||
|
|
||||||
|
dnl === Check for native log2
|
||||||
|
AC_SEARCH_LIBS([log2], [m],,
|
||||||
|
[AC_DEFINE([NOT_HAVE_LOG2], [1],
|
||||||
|
[Undefine this if you have log2().])])
|
||||||
|
|
||||||
dnl === Check libz is present
|
dnl === Check libz is present
|
||||||
|
|
||||||
if test "$enable_experimental" = "yes"; then
|
if test "$enable_experimental" = "yes"; then
|
||||||
|
@ -78,6 +78,9 @@
|
|||||||
// Using this simple maintenance, we observed a typical 10-20% reduction
|
// Using this simple maintenance, we observed a typical 10-20% reduction
|
||||||
// in the number of calls to VP8PutBit(), leading to 3-5% speed gain.
|
// in the number of calls to VP8PutBit(), leading to 3-5% speed gain.
|
||||||
//
|
//
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "./tcoderi.h"
|
#include "./tcoderi.h"
|
||||||
|
|
||||||
@ -85,7 +88,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef NOT_HAVE_LOG2
|
||||||
static double log2(double d) {
|
static double log2(double d) {
|
||||||
const double kLog2Reciprocal = 1.442695040888963;
|
const double kLog2Reciprocal = 1.442695040888963;
|
||||||
return log(d) * kLog2Reciprocal;
|
return log(d) * kLog2Reciprocal;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user