Replaced the range decoder optimization that used arithmetic
right shift with as fast version that doesn't need arithmetic right shift. Removed the related check from configure.ac.
This commit is contained in:
parent
ad999efd27
commit
641998c3e1
|
@ -407,7 +407,6 @@ AC_CHECK_HEADERS([assert.h errno.h byteswap.h sys/param.h sys/sysctl.h],
|
||||||
|
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
AC_C_RESTRICT
|
AC_C_RESTRICT
|
||||||
AX_C_ARITHMETIC_RSHIFT
|
|
||||||
|
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
##### http://autoconf-archive.cryp.to/ax_c_arithmetic_rshift.html
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_C_ARITHMETIC_RSHIFT
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Checks if the right shift operation is arithmetic.
|
|
||||||
#
|
|
||||||
# This macro uses compile-time detection and so is cross-compile
|
|
||||||
# ready.
|
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2006-12-12
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without
|
|
||||||
# modification, are permitted in any medium without royalty provided
|
|
||||||
# the copyright notice and this notice are preserved.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_C_ARITHMETIC_RSHIFT], [
|
|
||||||
AC_CACHE_CHECK([whether right shift operation is arithmetic],
|
|
||||||
[ax_cv_c_arithmetic_rshift],
|
|
||||||
[AC_COMPILE_IFELSE([[int dummy[((-1 >> 1) < 0) ? 1 : -1];]],
|
|
||||||
[ax_cv_c_arithmetic_rshift=yes],
|
|
||||||
[ax_cv_c_arithmetic_rshift=no])])
|
|
||||||
if test "x$ax_cv_c_arithmetic_rshift" = xyes; then
|
|
||||||
AC_DEFINE([HAVE_ARITHMETIC_RSHIFT], [1],
|
|
||||||
[Define to 1 if the right shift operation is arithmetic.])
|
|
||||||
fi
|
|
||||||
])
|
|
|
@ -121,26 +121,15 @@ do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ARITHMETIC_RSHIFT
|
|
||||||
#define rc_decode_direct(dest, count) \
|
#define rc_decode_direct(dest, count) \
|
||||||
do { \
|
do { \
|
||||||
rc_normalize(); \
|
rc_normalize(); \
|
||||||
rc.range >>= 1; \
|
rc.range >>= 1; \
|
||||||
rc.code -= rc.range; \
|
rc.code -= rc.range; \
|
||||||
rc_bound = (uint32_t)((int32_t)(rc.code) >> 31); \
|
rc_bound = UINT32_C(0) - (rc.code >> 31); \
|
||||||
dest = (dest << 1) + (rc_bound + 1); \
|
|
||||||
rc.code += rc.range & rc_bound; \
|
rc.code += rc.range & rc_bound; \
|
||||||
|
dest = (dest << 1) + (rc_bound + 1); \
|
||||||
} while (--count > 0)
|
} while (--count > 0)
|
||||||
#else
|
|
||||||
# define rc_decode_direct(dest, count) \
|
|
||||||
do { \
|
|
||||||
rc_normalize(); \
|
|
||||||
rc.range >>= 1; \
|
|
||||||
rc_bound = (rc.code - rc.range) >> 31; \
|
|
||||||
rc.code -= rc.range & (rc_bound - 1); \
|
|
||||||
dest = ((dest) << 1) | (1 - rc_bound);\
|
|
||||||
} while (--count > 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Dummy versions don't update prob or dest.
|
// Dummy versions don't update prob or dest.
|
||||||
|
@ -155,23 +144,13 @@ do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ARITHMETIC_RSHIFT
|
|
||||||
#define rc_decode_direct_dummy(count) \
|
#define rc_decode_direct_dummy(count) \
|
||||||
do { \
|
do { \
|
||||||
rc_normalize(); \
|
rc_normalize(); \
|
||||||
rc.range >>= 1; \
|
rc.range >>= 1; \
|
||||||
rc.code -= rc.range; \
|
rc.code -= rc.range; \
|
||||||
rc.code += rc.range & ((uint32_t)((int32_t)(rc.code) >> 31)); \
|
rc.code += rc.range & (UINT32_C(0) - (rc.code >> 31)); \
|
||||||
} while (--count > 0)
|
} while (--count > 0)
|
||||||
#else
|
|
||||||
# define rc_decode_direct_dummy(count) \
|
|
||||||
do { \
|
|
||||||
rc_normalize(); \
|
|
||||||
rc.range >>= 1; \
|
|
||||||
rc_bound = (rc.code - rc.range) >> 31; \
|
|
||||||
rc.code -= rc.range & (rc_bound - 1); \
|
|
||||||
} while (--count > 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
|
Loading…
Reference in New Issue