Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/librfxcodec.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormirabilos <thorsten.glaser@teckids.org>2017-03-25 22:58:00 +0300
committermirabilos <thorsten.glaser@teckids.org>2017-03-25 22:58:00 +0300
commitcd03880ac7aa8c009ee18d8cb33d12600c5ea1b3 (patch)
treecebfbd0db65437a7c7b241f43afda728c515649a
parent7e628bb3542289898b5788d495acff4d246d29c8 (diff)
parentb051aba3ed52c5cb1b4a747d73aa063b5f8d9f1b (diff)
Merge remote-tracking branch 'upstream/devel' into asm-elf-pie
-rw-r--r--.travis.yml9
-rw-r--r--configure.ac5
-rw-r--r--include/rfxcodec_encode.h4
-rw-r--r--m4/ax_append_compile_flags.m467
-rw-r--r--m4/ax_append_flag.m471
-rw-r--r--m4/ax_cflags_warn_all.m4122
-rw-r--r--m4/ax_check_compile_flag.m474
-rw-r--r--m4/ax_require_defined.m437
-rw-r--r--m4/nasm.m431
-rw-r--r--src/Makefile.am9
-rw-r--r--src/amd64/Makefile.am7
-rw-r--r--src/amd64/cpuid_amd64.asm16
-rw-r--r--src/amd64/funcs_amd64.h26
-rw-r--r--src/amd64/rfxcodec_encode_diff_rlgr1_amd64_sse2.asm36
-rw-r--r--src/amd64/rfxcodec_encode_diff_rlgr3_amd64_sse2.asm31
-rw-r--r--src/amd64/rfxcodec_encode_dwt_shift_amd64_sse2.asm14
-rw-r--r--src/amd64/rfxcodec_encode_dwt_shift_amd64_sse41.asm14
-rw-r--r--src/amd64/rfxencode_tile_amd64.c50
-rw-r--r--src/common.asm51
-rw-r--r--src/rfxcommon.h33
-rw-r--r--src/rfxcompose.c21
-rw-r--r--src/rfxcompose.h5
-rw-r--r--src/rfxencode.c6
-rw-r--r--src/rfxencode.h4
-rw-r--r--src/rfxencode_alpha.c12
-rw-r--r--src/rfxencode_alpha.h2
-rw-r--r--src/rfxencode_diff_rlgr1.c252
-rw-r--r--src/rfxencode_diff_rlgr1.h29
-rw-r--r--src/rfxencode_diff_rlgr3.c288
-rw-r--r--src/rfxencode_diff_rlgr3.h29
-rw-r--r--src/rfxencode_dwt.c8
-rw-r--r--src/rfxencode_dwt.h4
-rw-r--r--src/rfxencode_quantization.c2
-rw-r--r--src/rfxencode_tile.c48
-rw-r--r--src/rfxencode_tile.h30
-rw-r--r--src/x86/Makefile.am5
-rw-r--r--src/x86/cpuid_x86.asm16
-rw-r--r--src/x86/funcs_x86.h27
-rw-r--r--src/x86/rfxcodec_encode_diff_rlgr1_x86_sse2.asm35
-rw-r--r--src/x86/rfxcodec_encode_diff_rlgr3_x86_sse2.asm35
-rw-r--r--src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm13
-rw-r--r--src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm13
-rw-r--r--src/x86/rfxencode_tile_x86.c46
-rw-r--r--tests/rfxcodectest.c2
-rw-r--r--tests/rfxencode.c4
45 files changed, 1218 insertions, 425 deletions
diff --git a/.travis.yml b/.travis.yml
index 33b1a80..9d7d9c0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,13 +13,16 @@ addons:
apt:
packages:
- nasm
+ - gcc-multilib
+ - g++-multilib
env:
- - CONF_FLAGS=""
+ - CONF_FLAGS="" DISTCHECK=1
- CONF_FLAGS="--without-simd"
+ - CONF_FLAGS="--host=i686-linux" CFLAGS=-m32
script:
- ./bootstrap
- ./configure $CONF_FLAGS
- - make CFLAGS="-O2 -Wall -Wwrite-strings -Werror"
- - make distcheck
+ - make CFLAGS="$CFLAGS -O2 -Wall -Wwrite-strings -Werror"
+ - test -z "$DISTCHECK" || make distcheck
diff --git a/configure.ac b/configure.ac
index 8ff62c6..4d85b01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script
AC_PREREQ(2.59)
-AC_INIT([rfxcodec], [0.1.0], [jay.sorg@gmail.com])
+AC_INIT([rfxcodec], [0.1.0], [xrdp-devel@googlegroups.com])
AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
AM_INIT_AUTOMAKE([1.6 foreign])
AC_CONFIG_MACRO_DIR([m4])
@@ -11,6 +11,9 @@ AC_C_CONST
AC_PROG_LIBTOOL
PKG_INSTALLDIR
+AX_CFLAGS_WARN_ALL
+AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
+
# SIMD is optional
AC_ARG_WITH([simd],
AC_HELP_STRING([--without-simd],[Omit SIMD extensions.]))
diff --git a/include/rfxcodec_encode.h b/include/rfxcodec_encode.h
index 04112b0..1f9082d 100644
--- a/include/rfxcodec_encode.h
+++ b/include/rfxcodec_encode.h
@@ -62,13 +62,13 @@ rfxcodec_encode_destroy(void *handle);
* 9 - HH1 */
int
rfxcodec_encode(void *handle, char *cdata, int *cdata_bytes,
- char *buf, int width, int height, int stride_bytes,
+ const char *buf, int width, int height, int stride_bytes,
const struct rfx_rect *region, int num_region,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants);
int
rfxcodec_encode_ex(void *handle, char *cdata, int *cdata_bytes,
- char *buf, int width, int height, int stride_bytes,
+ const char *buf, int width, int height, int stride_bytes,
const struct rfx_rect *region, int num_region,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants, int flags);
diff --git a/m4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4
new file mode 100644
index 0000000..5b6f1af
--- /dev/null
+++ b/m4/ax_append_compile_flags.m4
@@ -0,0 +1,67 @@
+# ============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+# For every FLAG1, FLAG2 it is checked whether the compiler works with the
+# flag. If it does, the flag is added FLAGS-VARIABLE
+#
+# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+# CFLAGS) is used. During the check the flag is always added to the
+# current language's flags.
+#
+# If EXTRA-FLAGS is defined, it is added to the current language's default
+# flags (e.g. CFLAGS) when the check is done. The check is thus made with
+# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
+# force the compiler to issue an error when a bad flag is given.
+#
+# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+# NOTE: This macro depends on the AX_APPEND_FLAG and
+# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
+# AX_APPEND_LINK_FLAGS.
+#
+# LICENSE
+#
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 6
+
+AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
+[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+for flag in $1; do
+ AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
+done
+])dnl AX_APPEND_COMPILE_FLAGS
diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4
new file mode 100644
index 0000000..e8c5312
--- /dev/null
+++ b/m4/ax_append_flag.m4
@@ -0,0 +1,71 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
+#
+# DESCRIPTION
+#
+# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
+# added in between.
+#
+# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
+# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
+# FLAG.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 7
+
+AC_DEFUN([AX_APPEND_FLAG],
+[dnl
+AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
+AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
+AS_VAR_SET_IF(FLAGS,[
+ AS_CASE([" AS_VAR_GET(FLAGS) "],
+ [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
+ [
+ AS_VAR_APPEND(FLAGS,[" $1"])
+ AC_RUN_LOG([: FLAGS="$FLAGS"])
+ ])
+ ],
+ [
+ AS_VAR_SET(FLAGS,[$1])
+ AC_RUN_LOG([: FLAGS="$FLAGS"])
+ ])
+AS_VAR_POPDEF([FLAGS])dnl
+])dnl AX_APPEND_FLAG
diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4
new file mode 100644
index 0000000..094577e
--- /dev/null
+++ b/m4/ax_cflags_warn_all.m4
@@ -0,0 +1,122 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+#
+# DESCRIPTION
+#
+# Try to find a compiler option that enables most reasonable warnings.
+#
+# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
+# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
+#
+# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX,
+# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and
+# Intel compilers. For a given compiler, the Fortran flags are much more
+# experimental than their C equivalents.
+#
+# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS
+# - $2 add-value-if-not-found : nothing
+# - $3 action-if-found : add value to shellvariable
+# - $4 action-if-not-found : nothing
+#
+# NOTE: These macros depend on AX_APPEND_FLAG.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 16
+
+AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
+AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
+VAR,[VAR="no, unknown"
+ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-warn all % -warn all" dnl Intel
+ "-pedantic % -Wall" dnl GCC
+ "-xstrconst % -v" dnl Solaris C
+ "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
+ "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
+ "-ansi -ansiE % -fullwarn" dnl IRIX
+ "+ESlit % +w1" dnl HP-UX C
+ "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
+ "-h conform % -h msglevel 2" dnl Cray C (Unicos)
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+FLAGS="$ac_save_[]FLAGS"
+])
+AS_VAR_POPDEF([FLAGS])dnl
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
+ *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+])dnl AX_FLAGS_WARN_ALL
+dnl implementation tactics:
+dnl the for-argument contains a list of options. The first part of
+dnl these does only exist to detect the compiler - usually it is
+dnl a global option to enable -ansi or -extrawarnings. All other
+dnl compilers will fail about it. That was needed since a lot of
+dnl compilers will give false positives for some option-syntax
+dnl like -Woption or -Xoption as they think of it is a pass-through
+dnl to later compile stages or something. The "%" is used as a
+dnl delimiter. A non-option comment can be given after "%%" marks
+dnl which will be shown but not added to the respective C/CXXFLAGS.
+
+AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([C])
+AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([C])
+])
+
+AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([C++])
+AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([C++])
+])
+
+AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([Fortran])
+AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([Fortran])
+])
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
new file mode 100644
index 0000000..dcabb92
--- /dev/null
+++ b/m4/ax_check_compile_flag.m4
@@ -0,0 +1,74 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+# Check whether the given FLAG works with the current language's compiler
+# or gives an error. (Warnings, however, are ignored)
+#
+# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+# success/failure.
+#
+# If EXTRA-FLAGS is defined, it is added to the current language's default
+# flags (e.g. CFLAGS) when the check is done. The check is thus made with
+# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
+# force the compiler to issue an error when a bad flag is given.
+#
+# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_CHECK_COMPILE_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+ AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+ [AS_VAR_SET(CACHEVAR,[yes])],
+ [AS_VAR_SET(CACHEVAR,[no])])
+ _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+ [m4_default([$2], :)],
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS
diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4
new file mode 100644
index 0000000..17c3eab
--- /dev/null
+++ b/m4/ax_require_defined.m4
@@ -0,0 +1,37 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_REQUIRE_DEFINED(MACRO)
+#
+# DESCRIPTION
+#
+# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
+# been defined and thus are available for use. This avoids random issues
+# where a macro isn't expanded. Instead the configure script emits a
+# non-fatal:
+#
+# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
+#
+# It's like AC_REQUIRE except it doesn't expand the required macro.
+#
+# Here's an example:
+#
+# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+#
+# LICENSE
+#
+# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
+#
+# 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. This file is offered as-is, without any
+# warranty.
+
+#serial 2
+
+AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
+ m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
+])dnl AX_REQUIRE_DEFINED
diff --git a/m4/nasm.m4 b/m4/nasm.m4
index a8816cc..9911684 100644
--- a/m4/nasm.m4
+++ b/m4/nasm.m4
@@ -106,13 +106,14 @@ AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
cat > conftest.asm <<EOF
[%line __oline__ "configure"
section .text
- global _main,main
-_main:
-main: xor eax,eax
+ global _nasmfunc, nasmfunc
+_nasmfunc:
+nasmfunc:
+ xor eax, eax
ret
]EOF
-try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
-if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
+try_nasm='$NASM $NAFLAGS -o conftest-nasm.o conftest.asm'
+if AC_TRY_EVAL(try_nasm) && test -s conftest-nasm.o; then
AC_MSG_RESULT(yes)
else
echo "configure: failed program was:" >&AC_FD_CC
@@ -123,13 +124,19 @@ else
fi
AC_MSG_CHECKING([whether the linker accepts assembler output])
-try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&AC_FD_CC'
-if AC_TRY_EVAL(try_nasm) && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- AC_MSG_RESULT(yes)
-else
- rm -rf conftest*
- AC_MSG_RESULT(no)
+nasm_save_LIBS="$LIBS"
+LIBS="conftest-nasm.o $LIBS"
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+ void nasmfunc(void);
+ ]], [[nasmfunc();]])], [nasm_link_ok=yes], [nasm_link_ok=no])
+LIBS="$nasm_save_LIBS"
+AC_MSG_RESULT([$nasm_link_ok])
+
+if test "x$nasm_link_ok" = "xno"; then
AC_MSG_ERROR([configuration problem: maybe object file format mismatch.])
fi
diff --git a/src/Makefile.am b/src/Makefile.am
index 3449dd7..4e20371 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = nasm_lt.sh
+EXTRA_DIST = common.asm nasm_lt.sh
SUBDIRS =
@@ -29,11 +29,14 @@ noinst_HEADERS = \
rfxencode_quantization.h \
rfxencode_rlgr1.h \
rfxencode_rlgr3.h \
- rfxencode_tile.h
+ rfxencode_tile.h \
+ rfxencode_diff_rlgr1.h \
+ rfxencode_diff_rlgr3.h
lib_LTLIBRARIES = librfxencode.la
librfxencode_la_SOURCES = $(noinst_HEADERS) rfxencode.c \
rfxcompose.c rfxencode_tile.c rfxencode_dwt.c \
rfxencode_quantization.c rfxencode_differential.c \
- rfxencode_rlgr1.c rfxencode_rlgr3.c rfxencode_alpha.c
+ rfxencode_rlgr1.c rfxencode_rlgr3.c rfxencode_alpha.c \
+ rfxencode_diff_rlgr1.c rfxencode_diff_rlgr3.c
diff --git a/src/amd64/Makefile.am b/src/amd64/Makefile.am
index 575212e..07aae69 100644
--- a/src/amd64/Makefile.am
+++ b/src/amd64/Makefile.am
@@ -1,7 +1,5 @@
AMD64_ASM = \
cpuid_amd64.asm \
- rfxcodec_encode_diff_rlgr1_amd64_sse2.asm \
- rfxcodec_encode_diff_rlgr3_amd64_sse2.asm \
rfxcodec_encode_dwt_shift_amd64_sse2.asm \
rfxcodec_encode_dwt_shift_amd64_sse41.asm
@@ -14,7 +12,7 @@ noinst_LTLIBRARIES = librfxencode-amd64.la
librfxencode_amd64_la_SOURCES = \
funcs_amd64.h \
rfxencode_tile_amd64.c \
- $(AMD64_ASM)
+ $(AMD64_ASM)
nasm_verbose = $(nasm_verbose_@AM_V@)
nasm_verbose_ = $(nasm_verbose_@AM_DEFAULT_V@)
@@ -22,4 +20,5 @@ nasm_verbose_0 = @echo " NASM $@";
.asm.lo:
$(nasm_verbose)$(LIBTOOL) $(AM_V_lt) --mode=compile \
- $(top_srcdir)/src/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@
+ $(top_srcdir)/src/nasm_lt.sh $(NASM) $(NAFLAGS) \
+ -I$(top_srcdir)/src $< -o $@
diff --git a/src/amd64/cpuid_amd64.asm b/src/amd64/cpuid_amd64.asm
index e561b2d..acc738e 100644
--- a/src/amd64/cpuid_amd64.asm
+++ b/src/amd64/cpuid_amd64.asm
@@ -1,14 +1,6 @@
-%ifidn __OUTPUT_FORMAT__,elf64
-SECTION .note.GNU-stack noalloc noexec nowrite progbits
-%endif
+%include "common.asm"
-SECTION .text
-
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
+section .text
;The first six integer or pointer arguments are passed in registers
;RDI, RSI, RDX, RCX, R8, and R9
@@ -16,11 +8,7 @@ SECTION .text
;int
;cpuid_amd64(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx)
-%ifidn __OUTPUT_FORMAT__,elf64
PROC cpuid_amd64
-%else
-PROC _cpuid_amd64
-%endif
; save registers
push rbx
diff --git a/src/amd64/funcs_amd64.h b/src/amd64/funcs_amd64.h
index 124f838..d93e40b 100644
--- a/src/amd64/funcs_amd64.h
+++ b/src/amd64/funcs_amd64.h
@@ -33,36 +33,14 @@ cpuid_amd64(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx);
int
rfxcodec_encode_dwt_shift_amd64_sse2(const char *qtable,
- unsigned char *data,
+ const unsigned char *data,
short *dwt_buffer1,
short *dwt_buffer);
int
rfxcodec_encode_dwt_shift_amd64_sse41(const char *qtable,
- unsigned char *data,
+ const unsigned char *data,
short *dwt_buffer1,
short *dwt_buffer);
-int
-rfxcodec_encode_diff_rlgr1_amd64_sse2(short *co,
- void *dst, int dst_bytes);
-int
-rfxcodec_encode_diff_rlgr3_amd64_sse2(short *co,
- void *dst, int dst_bytes);
-
-int
-rfxcodec_decode_rlgr1_diff_amd64_sse2(void *data, int data_bytes,
- short *out_data);
-int
-rfxcodec_decode_rlgr3_diff_amd64_sse2(void *data, int data_bytes,
- short *out_data);
-int
-rfxcodec_decode_shift_idwt_amd64_sse2(char *qtable, short *src, short *dst);
-int
-rfxcodec_decode_yuv2rgb_amd64_sse2(short *ydata, short *udata, short *vdata,
- unsigned int *rgbdata, int stride);
-int
-rfxcodec_decode_yuva2argb_amd64_sse2(short *ydata, short *udata,
- short *vdata, char *adata,
- unsigned int *rgbdata, int stride);
#ifdef __cplusplus
}
diff --git a/src/amd64/rfxcodec_encode_diff_rlgr1_amd64_sse2.asm b/src/amd64/rfxcodec_encode_diff_rlgr1_amd64_sse2.asm
deleted file mode 100644
index b2de84f..0000000
--- a/src/amd64/rfxcodec_encode_diff_rlgr1_amd64_sse2.asm
+++ /dev/null
@@ -1,36 +0,0 @@
-%ifidn __OUTPUT_FORMAT__,elf64
-section .note.GNU-stack noalloc noexec nowrite progbits
-%endif
-
-section .data
- const1 times 8 dw 1
-
-section .text
-
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
-;The first six integer or pointer arguments are passed in registers
-;RDI, RSI, RDX, RCX, R8, and R9
-
-;int
-;rfxcodec_encode_diff_rlgr1_amd64_sse2(short *co,
-; void *dst, int dst_bytes);
-
-%ifidn __OUTPUT_FORMAT__,elf64
-PROC rfxcodec_encode_diff_rlgr1_amd64_sse2
-%else
-PROC _rfxcodec_encode_diff_rlgr1_amd64_sse2
-%endif
- ; save registers
- push rbx
-
- mov rax, 0
- ; restore registers
- pop rbx
- ret
- align 16
-
diff --git a/src/amd64/rfxcodec_encode_diff_rlgr3_amd64_sse2.asm b/src/amd64/rfxcodec_encode_diff_rlgr3_amd64_sse2.asm
deleted file mode 100644
index f5712be..0000000
--- a/src/amd64/rfxcodec_encode_diff_rlgr3_amd64_sse2.asm
+++ /dev/null
@@ -1,31 +0,0 @@
-%ifidn __OUTPUT_FORMAT__,elf64
-section .note.GNU-stack noalloc noexec nowrite progbits
-%endif
-
-section .data
- const1 times 8 dw 1
-
-section .text
-
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
-;int
-;rfxcodec_encode_diff_rlgr3_amd64_sse2(short *co,
-; void *dst, int dst_bytes);
-
-%ifidn __OUTPUT_FORMAT__,elf64
-PROC rfxcodec_encode_diff_rlgr3_amd64_sse2
-%else
-PROC _rfxcodec_encode_diff_rlgr3_amd64_sse2
-%endif
- ; save registers
- push rbx
- mov rax, 0
- pop rbx
- ret
- align 16
-
diff --git a/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse2.asm b/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse2.asm
index ee97588..69ccf07 100644
--- a/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse2.asm
+++ b/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse2.asm
@@ -19,9 +19,7 @@
;
;amd64 asm dwt
-%ifidn __OUTPUT_FORMAT__,elf64
-section .note.GNU-stack noalloc noexec nowrite progbits
-%endif
+%include "common.asm"
section .data
align 16
@@ -47,12 +45,6 @@ section .data
section .text
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
;******************************************************************************
; source 16 bit signed, 16 pixel width
rfx_dwt_2d_encode_block_horiz_16_16:
@@ -1346,11 +1338,7 @@ set_quants_lo:
; short *work_buffer);
;******************************************************************************
-%ifidn __OUTPUT_FORMAT__,elf64
PROC rfxcodec_encode_dwt_shift_amd64_sse2
-%else
-PROC _rfxcodec_encode_dwt_shift_amd64_sse2
-%endif
; save registers
push rbx
push rdx
diff --git a/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse41.asm b/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse41.asm
index ab52808..2b19f81 100644
--- a/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse41.asm
+++ b/src/amd64/rfxcodec_encode_dwt_shift_amd64_sse41.asm
@@ -19,9 +19,7 @@
;
;amd64 asm dwt
-%ifidn __OUTPUT_FORMAT__,elf64
-section .note.GNU-stack noalloc noexec nowrite progbits
-%endif
+%include "common.asm"
section .data
align 16
@@ -47,12 +45,6 @@ section .data
section .text
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
;******************************************************************************
; source 16 bit signed, 16 pixel width
rfx_dwt_2d_encode_block_horiz_16_16:
@@ -1214,11 +1206,7 @@ set_quants_lo:
; short *work_buffer);
;******************************************************************************
-%ifidn __OUTPUT_FORMAT__,elf64
PROC rfxcodec_encode_dwt_shift_amd64_sse41
-%else
-PROC _rfxcodec_encode_dwt_shift_amd64_sse41
-%endif
; save registers
push rbx
push rdx
diff --git a/src/amd64/rfxencode_tile_amd64.c b/src/amd64/rfxencode_tile_amd64.c
index 431b3d2..1619752 100644
--- a/src/amd64/rfxencode_tile_amd64.c
+++ b/src/amd64/rfxencode_tile_amd64.c
@@ -18,6 +18,10 @@
* limitations under the License.
*/
+#if defined(HAVE_CONFIG_H)
+#include <config_ac.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -28,6 +32,8 @@
#include "rfxencode_rlgr1.h"
#include "rfxencode_rlgr3.h"
#include "rfxencode_alpha.h"
+#include "rfxencode_diff_rlgr1.h"
+#include "rfxencode_diff_rlgr3.h"
#include "amd64/funcs_amd64.h"
@@ -38,7 +44,7 @@
/******************************************************************************/
int
rfx_encode_component_rlgr1_amd64_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr1_amd64_sse2:"));
@@ -47,20 +53,14 @@ rfx_encode_component_rlgr1_amd64_sse2(struct rfxencode *enc, const char *qtable,
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr1_amd64_sse2(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr1_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr1(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
/******************************************************************************/
int
rfx_encode_component_rlgr3_amd64_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr3_amd64_sse2:"));
@@ -69,56 +69,38 @@ rfx_encode_component_rlgr3_amd64_sse2(struct rfxencode *enc, const char *qtable,
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr3_amd64_sse2(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr3_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr3(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
/******************************************************************************/
int
rfx_encode_component_rlgr1_amd64_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
- LLOGLN(10, ("rfx_encode_component_rlgr1_amd64_sse2:"));
+ LLOGLN(10, ("rfx_encode_component_rlgr1_amd64_sse41:"));
if (rfxcodec_encode_dwt_shift_amd64_sse41(qtable, data, enc->dwt_buffer1,
enc->dwt_buffer) != 0)
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr1_amd64_sse2(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr1_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr1(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
/******************************************************************************/
int
rfx_encode_component_rlgr3_amd64_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
- LLOGLN(10, ("rfx_encode_component_rlgr3_amd64_sse2:"));
+ LLOGLN(10, ("rfx_encode_component_rlgr3_amd64_sse41:"));
if (rfxcodec_encode_dwt_shift_amd64_sse41(qtable, data, enc->dwt_buffer1,
enc->dwt_buffer) != 0)
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr3_amd64_sse2(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr3_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr3(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
diff --git a/src/common.asm b/src/common.asm
new file mode 100644
index 0000000..7e2b84b
--- /dev/null
+++ b/src/common.asm
@@ -0,0 +1,51 @@
+;
+;Copyright 2017 Pavel Roskin
+;
+;Permission to use, copy, modify, distribute, and sell this software and its
+;documentation for any purpose is hereby granted without fee, provided that
+;the above copyright notice appear in all copies and that both that
+;copyright notice and this permission notice appear in supporting
+;documentation.
+;
+;The above copyright notice and this permission notice shall be included in
+;all copies or substantial portions of the Software.
+;
+;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+;OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+;AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+;
+;Common nasm code
+;
+
+; Detect ELF formats
+%ifidn __OUTPUT_FORMAT__,elf
+%define is_elf 1
+%endif
+
+%ifidn __OUTPUT_FORMAT__,elf32
+%define is_elf 1
+%endif
+
+%ifidn __OUTPUT_FORMAT__,elf64
+%define is_elf 1
+%endif
+
+; Mark stack non-executable
+%ifdef is_elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
+
+; Global function header
+%macro PROC 1
+ align 16
+%ifdef is_elf
+ global %1:function
+ %1:
+%else
+ global _%1
+ _%1:
+%endif
+%endmacro
diff --git a/src/rfxcommon.h b/src/rfxcommon.h
index c7970ad..dad376c 100644
--- a/src/rfxcommon.h
+++ b/src/rfxcommon.h
@@ -1,7 +1,7 @@
/**
* RFX codec
*
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,4 +96,35 @@ typedef struct _STREAM STREAM;
#define xnew(_type) (_type *) calloc(1, sizeof(_type))
+/*
+ GCC has __builtin_clz that translates to BSR on x86/x64, CLZ on ARM, etc.
+ and emulates the instruction if the hardware does not implement it.
+ Visual C++ 2005 and up has _BitScanReverse
+
+ LZCNT = BSR ^ 31
+
+*/
+#if defined(__GNUC__)
+#define GBSR(_in, _r) do { \
+ _r = __builtin_clz(_in) ^ 31; \
+} while (0)
+#elif defined(_MSC_VER) && (_MSC_VER > 1000)
+#define GBSR(_in, _r) do { \
+ unsigned long rv = 0; \
+ _BitScanReverse(&rv, _in); \
+ _r = rv; \
+} while (0)
+#else
+#define GBSR(_in, _r) do { \
+ int rv = -1; \
+ int x = _in; \
+ while (x != 0) \
+ { \
+ rv++; \
+ x = x >> 1; \
+ } \
+ _r = rv; \
+} while (0)
+#endif
+
#endif
diff --git a/src/rfxcompose.c b/src/rfxcompose.c
index 81b36a2..3c0f87a 100644
--- a/src/rfxcompose.c
+++ b/src/rfxcompose.c
@@ -3,7 +3,7 @@
* RemoteFX Codec Library
*
* Copyright 2011 Vic Lee
- * Copyright 2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2015-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -208,7 +208,8 @@ rfx_compose_message_region(struct rfxencode *enc, STREAM *s,
/******************************************************************************/
static int
rfx_compose_message_tile_yuv(struct rfxencode *enc, STREAM *s,
- char *tile_data, int tile_width, int tile_height,
+ const char *tile_data,
+ int tile_width, int tile_height,
int stride_bytes, const char *quantVals,
int quantIdxY, int quantIdxCb, int quantIdxCr,
int xIdx, int yIdx)
@@ -251,7 +252,8 @@ rfx_compose_message_tile_yuv(struct rfxencode *enc, STREAM *s,
/******************************************************************************/
static int
rfx_compose_message_tile_yuva(struct rfxencode *enc, STREAM *s,
- char *tile_data, int tile_width, int tile_height,
+ const char *tile_data,
+ int tile_width, int tile_height,
int stride_bytes, const char *quantVals,
int quantIdxY, int quantIdxCb, int quantIdxCr,
int xIdx, int yIdx)
@@ -296,7 +298,8 @@ rfx_compose_message_tile_yuva(struct rfxencode *enc, STREAM *s,
/******************************************************************************/
static int
rfx_compose_message_tile_rgb(struct rfxencode *enc, STREAM *s,
- char *tile_data, int tile_width, int tile_height,
+ const char *tile_data,
+ int tile_width, int tile_height,
int stride_bytes, const char *quantVals,
int quantIdxY, int quantIdxCb, int quantIdxCr,
int xIdx, int yIdx)
@@ -339,7 +342,8 @@ rfx_compose_message_tile_rgb(struct rfxencode *enc, STREAM *s,
/******************************************************************************/
static int
rfx_compose_message_tile_argb(struct rfxencode *enc, STREAM *s,
- char *tile_data, int tile_width, int tile_height,
+ const char *tile_data,
+ int tile_width, int tile_height,
int stride_bytes, const char *quantVals,
int quantIdxY, int quantIdxCb, int quantIdxCr,
int xIdx, int yIdx)
@@ -386,7 +390,7 @@ rfx_compose_message_tile_argb(struct rfxencode *enc, STREAM *s,
/******************************************************************************/
static int
rfx_compose_message_tileset(struct rfxencode *enc, STREAM *s,
- char *buf, int width, int height,
+ const char *buf, int width, int height,
int stride_bytes,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants,
@@ -407,7 +411,7 @@ rfx_compose_message_tileset(struct rfxencode *enc, STREAM *s,
int y;
int cx;
int cy;
- char *tile_data;
+ const char *tile_data;
LLOGLN(10, ("rfx_compose_message_tileset:"));
if (quants == 0)
@@ -569,7 +573,8 @@ rfx_compose_message_frame_end(struct rfxencode *enc, STREAM *s)
int
rfx_compose_message_data(struct rfxencode *enc, STREAM *s,
const struct rfx_rect *regions, int num_regions,
- char *buf, int width, int height, int stride_bytes,
+ const char *buf, int width, int height,
+ int stride_bytes,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants, int flags)
{
diff --git a/src/rfxcompose.h b/src/rfxcompose.h
index 7a3ff3a..6fde0f3 100644
--- a/src/rfxcompose.h
+++ b/src/rfxcompose.h
@@ -1,7 +1,7 @@
/**
* RFX codec encoder
*
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,8 @@ rfx_compose_message_header(struct rfxencode *enc, STREAM *s);
int
rfx_compose_message_data(struct rfxencode *enc, STREAM *s,
const struct rfx_rect *regions, int num_regions,
- char *buf, int width, int height, int stride_bytes,
+ const char *buf, int width, int height,
+ int stride_bytes,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants, int flags);
diff --git a/src/rfxencode.c b/src/rfxencode.c
index e4b67aa..315c6e9 100644
--- a/src/rfxencode.c
+++ b/src/rfxencode.c
@@ -1,7 +1,7 @@
/**
* RFX codec encoder
*
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -298,7 +298,7 @@ rfxcodec_encode_destroy(void *handle)
/******************************************************************************/
int
rfxcodec_encode_ex(void *handle, char *cdata, int *cdata_bytes,
- char *buf, int width, int height, int stride_bytes,
+ const char *buf, int width, int height, int stride_bytes,
const struct rfx_rect *regions, int num_regions,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants, int flags)
@@ -334,7 +334,7 @@ rfxcodec_encode_ex(void *handle, char *cdata, int *cdata_bytes,
/******************************************************************************/
int
rfxcodec_encode(void *handle, char *cdata, int *cdata_bytes,
- char *buf, int width, int height, int stride_bytes,
+ const char *buf, int width, int height, int stride_bytes,
const struct rfx_rect *regions, int num_regions,
const struct rfx_tile *tiles, int num_tiles,
const char *quants, int num_quants)
diff --git a/src/rfxencode.h b/src/rfxencode.h
index 827acec..55147de 100644
--- a/src/rfxencode.h
+++ b/src/rfxencode.h
@@ -22,8 +22,8 @@
struct rfxencode;
typedef int (*rfx_encode_proc)(struct rfxencode *enc, const char *qtable,
- uint8 *data, uint8 *buffer,
- int buffer_size, int *size);
+ const uint8 *data,
+ uint8 *buffer, int buffer_size, int *size);
struct rfxencode
{
diff --git a/src/rfxencode_alpha.c b/src/rfxencode_alpha.c
index 637788b..2b04923 100644
--- a/src/rfxencode_alpha.c
+++ b/src/rfxencode_alpha.c
@@ -2,7 +2,7 @@
* librfxcodec: A Remote Desktop Protocol client.
* RemoteFX Codec Library
*
- * Copyright 2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2015-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,10 +39,10 @@
#if 1
/*****************************************************************************/
static int
-fdelta(char *in_plane, char *out_plane, int cx, int cy)
+fdelta(const char *in_plane, char *out_plane, int cx, int cy)
{
char delta;
- char *src8;
+ const char *src8;
char *dst8;
int index;
int jndex;
@@ -251,15 +251,15 @@ fpack(char *plane, int cx, int cy, STREAM *s)
/*****************************************************************************/
int
-rfx_encode_plane(struct rfxencode *enc, uint8 *plane, int cx, int cy,
+rfx_encode_plane(struct rfxencode *enc, const uint8 *plane, int cx, int cy,
STREAM *s)
{
- char *org_plane;
+ const char *org_plane;
char *delta_plane;
int bytes;
uint8 *holdp;
- org_plane = (char *) plane;
+ org_plane = (const char *) plane;
delta_plane = (char *) (enc->dwt_buffer1);
fdelta(org_plane, delta_plane, cx, cy);
holdp = s->p;
diff --git a/src/rfxencode_alpha.h b/src/rfxencode_alpha.h
index 3f01218..c5d1d1d 100644
--- a/src/rfxencode_alpha.h
+++ b/src/rfxencode_alpha.h
@@ -21,7 +21,7 @@
#define __RFXCODEC_ENCODE_ALPHA_H
int
-rfx_encode_plane(struct rfxencode *enc, uint8 *plane, int cx, int cy,
+rfx_encode_plane(struct rfxencode *enc, const uint8 *plane, int cx, int cy,
STREAM *s);
#endif
diff --git a/src/rfxencode_diff_rlgr1.c b/src/rfxencode_diff_rlgr1.c
new file mode 100644
index 0000000..cd09f18
--- /dev/null
+++ b/src/rfxencode_diff_rlgr1.c
@@ -0,0 +1,252 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol client.
+ * RemoteFX Codec Library - RLGR
+ *
+ * Copyright 2011 Vic Lee
+ * Copyright 2016-2017 Jay Sorg <jay.sorg@gmail.com>
+ *
+ * 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.
+ */
+
+/**
+ * This implementation of RLGR refers to
+ * [MS-RDPRFX] 3.1.8.1.7.3 RLGR1/RLGR3 Pseudocode
+ */
+
+#if defined(HAVE_CONFIG_H)
+#include <config_ac.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "rfxcommon.h"
+
+#define PIXELS_IN_TILE 4096
+
+/* Constants used within the RLGR1/RLGR3 algorithm */
+#define KPMAX (80) /* max value for kp or krp */
+#define LSGR (3) /* shift count to convert kp to k */
+#define UP_GR (4) /* increase in kp after a zero run in RL mode */
+#define DN_GR (6) /* decrease in kp after a nonzero symbol in RL mode */
+#define UQ_GR (3) /* increase in kp after nonzero symbol in GR mode */
+#define DQ_GR (3) /* decrease in kp after zero symbol in GR mode */
+
+#define GetNextInput do { \
+ input = *coef; \
+ coef++; \
+ coef_size--; \
+} while (0)
+
+#define CheckWrite do { \
+ while (bit_count >= 8) \
+ { \
+ bit_count -= 8; \
+ *cdata = bits >> bit_count; \
+ cdata++; \
+ } \
+} while (0)
+
+/* output GR code for (mag - 1) */
+#define CodeGR(_krp, _lmag) do { \
+ int lkr = _krp >> LSGR; \
+ /* unary part of GR code */ \
+ int lvk = _lmag >> lkr; \
+ int llvk = lvk; \
+ while (llvk >= 8) \
+ { \
+ bits <<= 8; \
+ bits |= 0xFF; \
+ llvk -= 8; \
+ *cdata = bits >> bit_count; \
+ cdata++; \
+ } \
+ bits <<= llvk; \
+ bits |= (1 << llvk) - 1; \
+ bit_count += llvk; \
+ bits <<= 1; \
+ bit_count++; \
+ CheckWrite; \
+ /* remainder part of GR code, if needed */ \
+ if (lkr) \
+ { \
+ bits <<= lkr; \
+ bits |= _lmag & ((1 << lkr) - 1); \
+ bit_count += lkr; \
+ } \
+ /* update _krp, only if it is not equal to 1 */ \
+ if (lvk == 0) \
+ { \
+ _krp = MAX(0, _krp - 2); \
+ } \
+ else if (lvk > 1) \
+ { \
+ _krp = MIN(KPMAX, _krp + lvk); \
+ } \
+} while (0)
+
+int
+rfx_encode_diff_rlgr1(sint16 *coef, uint8 *cdata, int cdata_size)
+{
+ int k;
+ int kp;
+ int krp;
+
+ int input;
+ int numZeros;
+ int runmax;
+ int mag;
+ int sign;
+ int processed_size;
+ int lmag;
+ int coef_size;
+ int y;
+
+ int bit_count;
+ unsigned int bits;
+ uint8 *cdata_org;
+
+ uint32 twoMs;
+
+ /* the last 64 bytes are diff */
+ for (k = PIXELS_IN_TILE - 1; k > PIXELS_IN_TILE - 64; k--)
+ {
+ coef[k] -= coef[k - 1];
+ }
+
+ /* initialize the parameters */
+ k = 1;
+ kp = 1 << LSGR;
+ krp = 1 << LSGR;
+
+ bit_count = 0;
+ bits = 0;
+ cdata_org = cdata;
+
+ /* process all the input coefficients */
+ coef_size = PIXELS_IN_TILE;
+ while (coef_size > 0)
+ {
+ if (k)
+ {
+
+ /* RUN-LENGTH MODE */
+
+ /* collect the run of zeros in the input stream */
+ numZeros = 0;
+
+ GetNextInput;
+ while (input == 0 && coef_size > 0)
+ {
+ numZeros++;
+ GetNextInput;
+ }
+
+ /* emit output zeros */
+ runmax = 1 << k;
+ while (numZeros >= runmax)
+ {
+
+ bits <<= 1;
+ bit_count++;
+
+ CheckWrite;
+
+ numZeros -= runmax;
+
+ kp = MIN(KPMAX, kp + UP_GR);
+ k = kp >> LSGR;
+
+ runmax = 1 << k;
+ }
+
+ /* output a 1 to terminate runs */
+ bits <<= 1;
+ bits |= 1;
+ bit_count++;
+
+ /* output the remaining run length using k bits */
+ bits <<= k;
+ bits |= numZeros;
+ bit_count += k;
+
+ CheckWrite;
+
+ /* encode the nonzero value using GR coding */
+ if (input < 0)
+ {
+ mag = -input;
+ sign = 1;
+ }
+ else
+ {
+ mag = input;
+ sign = 0;
+ }
+
+ bits <<= 1;
+ bits |= sign;
+ bit_count++;
+
+ lmag = mag ? mag - 1 : 0;
+
+ CodeGR(krp, lmag); /* output GR code for (mag - 1) */
+ CheckWrite;
+
+ kp = MAX(0, kp - DN_GR);
+ k = kp >> LSGR;
+
+ }
+ else
+ {
+
+ /* GOLOMB-RICE MODE */
+
+ /* RLGR1 variant */
+
+ /* convert input to (2*magnitude - sign), encode using GR code */
+ GetNextInput;
+ y = input >> 15;
+ twoMs = (((input ^ y) - y) << 1) + y;
+ CodeGR(krp, twoMs);
+ CheckWrite;
+
+ /* update k, kp */
+ if (twoMs)
+ {
+ kp = MAX(0, kp - DQ_GR);
+ k = kp >> LSGR;
+ }
+ else
+ {
+ kp = MIN(KPMAX, kp + UQ_GR);
+ k = kp >> LSGR;
+ }
+
+ }
+ }
+
+ if (bit_count > 0)
+ {
+ bits <<= 8 - bit_count;
+ *cdata = bits;
+ cdata++;
+ bit_count = 0;
+ }
+
+ processed_size = cdata - cdata_org;
+
+ return processed_size;
+}
+
diff --git a/src/rfxencode_diff_rlgr1.h b/src/rfxencode_diff_rlgr1.h
new file mode 100644
index 0000000..796f8f2
--- /dev/null
+++ b/src/rfxencode_diff_rlgr1.h
@@ -0,0 +1,29 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol client.
+ * RemoteFX Codec Library - RLGR
+ *
+ * Copyright 2011 Vic Lee
+ *
+ * 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.
+ */
+
+#ifndef __RFX_DIFF_RLGR1_H
+#define __RFX_DIFF_RLGR1_H
+
+#include "rfxcommon.h"
+
+int
+rfx_encode_diff_rlgr1(sint16 *coef, uint8 *cdata, int cdata_size);
+
+#endif /* __RFX_DIFF_RLGR1_H */
+
diff --git a/src/rfxencode_diff_rlgr3.c b/src/rfxencode_diff_rlgr3.c
new file mode 100644
index 0000000..0b68db3
--- /dev/null
+++ b/src/rfxencode_diff_rlgr3.c
@@ -0,0 +1,288 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol client.
+ * RemoteFX Codec Library - RLGR
+ *
+ * Copyright 2011 Vic Lee
+ * Copyright 2016-2017 Jay Sorg <jay.sorg@gmail.com>
+ *
+ * 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.
+ */
+
+/**
+ * This implementation of RLGR refers to
+ * [MS-RDPRFX] 3.1.8.1.7.3 RLGR1/RLGR3 Pseudocode
+ */
+
+#if defined(HAVE_CONFIG_H)
+#include <config_ac.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "rfxcommon.h"
+
+#define PIXELS_IN_TILE 4096
+
+/* Constants used within the RLGR1/RLGR3 algorithm */
+#define KPMAX (80) /* max value for kp or krp */
+#define LSGR (3) /* shift count to convert kp to k */
+#define UP_GR (4) /* increase in kp after a zero run in RL mode */
+#define DN_GR (6) /* decrease in kp after a nonzero symbol in RL mode */
+#define UQ_GR (3) /* increase in kp after nonzero symbol in GR mode */
+#define DQ_GR (3) /* decrease in kp after zero symbol in GR mode */
+
+#define GetNextInput do { \
+ input = *coef; \
+ coef++; \
+ coef_size--; \
+} while (0)
+
+#define CheckWrite do { \
+ while (bit_count >= 8) \
+ { \
+ bit_count -= 8; \
+ *cdata = bits >> bit_count; \
+ cdata++; \
+ } \
+} while (0)
+
+/* output GR code for (mag - 1) */
+#define CodeGR(_krp, _lmag) do { \
+ int lkr = _krp >> LSGR; \
+ /* unary part of GR code */ \
+ int lvk = _lmag >> lkr; \
+ int llvk = lvk; \
+ while (llvk >= 8) \
+ { \
+ bits <<= 8; \
+ bits |= 0xFF; \
+ llvk -= 8; \
+ *cdata = bits >> bit_count; \
+ cdata++; \
+ } \
+ bits <<= llvk; \
+ bits |= (1 << llvk) - 1; \
+ bit_count += llvk; \
+ bits <<= 1; \
+ bit_count++; \
+ CheckWrite; \
+ /* remainder part of GR code, if needed */ \
+ if (lkr) \
+ { \
+ bits <<= lkr; \
+ bits |= _lmag & ((1 << lkr) - 1); \
+ bit_count += lkr; \
+ } \
+ /* update _krp, only if it is not equal to 1 */ \
+ if (lvk == 0) \
+ { \
+ _krp = MAX(0, _krp - 2); \
+ } \
+ else if (lvk > 1) \
+ { \
+ _krp = MIN(KPMAX, _krp + lvk); \
+ } \
+} while (0)
+
+int
+rfx_encode_diff_rlgr3(sint16 *coef, uint8 *cdata, int cdata_size)
+{
+ int k;
+ int kp;
+ int krp;
+
+ int input;
+ int numZeros;
+ int runmax;
+ int mag;
+ int sign;
+ int processed_size;
+ int lmag;
+ int coef_size;
+ int y;
+
+ int bit_count;
+ unsigned int bits;
+ uint8 *cdata_org;
+
+ uint32 twoMs1;
+ uint32 twoMs2;
+ uint32 sum2Ms;
+ uint32 nIdx;
+
+ /* the last 64 bytes are diff */
+ for (k = PIXELS_IN_TILE - 1; k > PIXELS_IN_TILE - 64; k--)
+ {
+ coef[k] -= coef[k - 1];
+ }
+
+ /* initialize the parameters */
+ k = 1;
+ kp = 1 << LSGR;
+ krp = 1 << LSGR;
+
+ bit_count = 0;
+ bits = 0;
+ cdata_org = cdata;
+
+ /* process all the input coefficients */
+ coef_size = PIXELS_IN_TILE;
+ while (coef_size > 0)
+ {
+ if (k)
+ {
+
+ /* RUN-LENGTH MODE */
+
+ /* collect the run of zeros in the input stream */
+ numZeros = 0;
+
+ GetNextInput;
+ while (input == 0 && coef_size > 0)
+ {
+ numZeros++;
+ GetNextInput;
+ }
+
+ /* emit output zeros */
+ runmax = 1 << k;
+ while (numZeros >= runmax)
+ {
+
+ bits <<= 1;
+ bit_count++;
+
+ CheckWrite;
+
+ numZeros -= runmax;
+
+ kp = MIN(KPMAX, kp + UP_GR);
+ k = kp >> LSGR;
+
+ runmax = 1 << k;
+ }
+
+ /* output a 1 to terminate runs */
+ bits <<= 1;
+ bits |= 1;
+ bit_count++;
+
+ /* output the remaining run length using k bits */
+ bits <<= k;
+ bits |= numZeros;
+ bit_count += k;
+
+ CheckWrite;
+
+ /* encode the nonzero value using GR coding */
+ if (input < 0)
+ {
+ mag = -input;
+ sign = 1;
+ }
+ else
+ {
+ mag = input;
+ sign = 0;
+ }
+
+ bits <<= 1;
+ bits |= sign;
+ bit_count++;
+
+ lmag = mag ? mag - 1 : 0;
+
+ CodeGR(krp, lmag); /* output GR code for (mag - 1) */
+ CheckWrite;
+
+ kp = MAX(0, kp - DN_GR);
+ k = kp >> LSGR;
+
+ }
+ else
+ {
+
+ /* GOLOMB-RICE MODE */
+
+ /* RLGR3 variant */
+
+ /* convert the next two input values to (2*magnitude - sign) and */
+ /* encode their sum using GR code */
+
+ GetNextInput;
+
+ y = input >> 15;
+ twoMs1 = (((input ^ y) - y) << 1) + y;
+
+ GetNextInput;
+
+ y = input >> 15;
+ twoMs2 = (((input ^ y) - y) << 1) + y;
+
+ sum2Ms = twoMs1 + twoMs2;
+
+ CodeGR(krp, sum2Ms);
+
+ CheckWrite;
+
+ /* encode binary representation of the first input (twoMs1). */
+ if (sum2Ms != 0)
+ {
+ GBSR(sum2Ms, nIdx);
+ nIdx++;
+ }
+ else
+ {
+ nIdx = 0;
+ }
+
+ bits <<= nIdx;
+ bits |= twoMs1;
+ bit_count += nIdx;
+
+ CheckWrite;
+
+ /* update k,kp for the two input values */
+ if (twoMs1 != 0)
+ {
+ if (twoMs2 != 0)
+ {
+ kp = MAX(0, kp - (2 * DQ_GR));
+ k = kp >> LSGR;
+ }
+ }
+ else
+ {
+ if (twoMs2 == 0)
+ {
+ kp = MIN(KPMAX, kp + (2 * UQ_GR));
+ k = kp >> LSGR;
+ }
+ }
+ }
+ }
+
+ if (bit_count > 0)
+ {
+ bits <<= 8 - bit_count;
+ *cdata = bits;
+ cdata++;
+ bit_count = 0;
+ }
+
+ processed_size = cdata - cdata_org;
+
+ return processed_size;
+}
diff --git a/src/rfxencode_diff_rlgr3.h b/src/rfxencode_diff_rlgr3.h
new file mode 100644
index 0000000..dd61309
--- /dev/null
+++ b/src/rfxencode_diff_rlgr3.h
@@ -0,0 +1,29 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol client.
+ * RemoteFX Codec Library - RLGR
+ *
+ * Copyright 2011 Vic Lee
+ *
+ * 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.
+ */
+
+#ifndef __RFX_DIFF_RLGR3_H
+#define __RFX_DIFF_RLGR3_H
+
+#include "rfxcommon.h"
+
+int
+rfx_encode_diff_rlgr3(sint16 *coef, uint8 *cdata, int cdata_size);
+
+#endif /* __RFX_DIFF_RLGR3_H */
+
diff --git a/src/rfxencode_dwt.c b/src/rfxencode_dwt.c
index 3c649fa..5d82044 100644
--- a/src/rfxencode_dwt.c
+++ b/src/rfxencode_dwt.c
@@ -3,7 +3,7 @@
* RemoteFX Codec Library - DWT
*
* Copyright 2011 Vic Lee
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -150,10 +150,10 @@ rfx_dwt_2d_encode_block(sint16 *buffer, sint16 *dwt, int subband_width)
/******************************************************************************/
static int
-rfx_dwt_2d_encode_block8(uint8 *in_buffer,
+rfx_dwt_2d_encode_block8(const uint8 *in_buffer,
sint16 *buffer, sint16 *dwt, int subband_width)
{
- uint8 *src;
+ const uint8 *src;
sint16 *l, *h;
sint16 s1, s2, s3;
int total_width;
@@ -213,7 +213,7 @@ rfx_dwt_2d_encode_block8(uint8 *in_buffer,
/******************************************************************************/
int
-rfx_dwt_2d_encode(uint8 *in_buffer, sint16 *buffer, sint16 *dwt_buffer)
+rfx_dwt_2d_encode(const uint8 *in_buffer, sint16 *buffer, sint16 *dwt_buffer)
{
rfx_dwt_2d_encode_block8(in_buffer, buffer, dwt_buffer, 32);
rfx_dwt_2d_encode_block(buffer + 3072, dwt_buffer, 16);
diff --git a/src/rfxencode_dwt.h b/src/rfxencode_dwt.h
index 36a62ed..2d91176 100644
--- a/src/rfxencode_dwt.h
+++ b/src/rfxencode_dwt.h
@@ -1,7 +1,7 @@
/**
* RFX codec encoder
*
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,6 @@
#define __RFXENCODE_RFX_H
int
-rfx_dwt_2d_encode(uint8 *in_buffer, sint16 *buffer, sint16 *dwt_buffer);
+rfx_dwt_2d_encode(const uint8 *in_buffer, sint16 *buffer, sint16 *dwt_buffer);
#endif
diff --git a/src/rfxencode_quantization.c b/src/rfxencode_quantization.c
index e36c6a8..b10a70e 100644
--- a/src/rfxencode_quantization.c
+++ b/src/rfxencode_quantization.c
@@ -3,7 +3,7 @@
* RemoteFX Codec Library - Quantization
*
* Copyright 2011 Vic Lee
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/rfxencode_tile.c b/src/rfxencode_tile.c
index 5279169..3f87241 100644
--- a/src/rfxencode_tile.c
+++ b/src/rfxencode_tile.c
@@ -3,7 +3,7 @@
* RemoteFX Codec Library - Encode
*
* Copyright 2011 Vic Lee
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@
/******************************************************************************/
static int
-rfx_encode_format_rgb(char *rgb_data, int width, int height,
+rfx_encode_format_rgb(const char *rgb_data, int width, int height,
int stride_bytes, int pixel_format,
uint8 *r_buf, uint8 *g_buf, uint8 *b_buf)
{
@@ -221,7 +221,7 @@ rfx_encode_format_rgb(char *rgb_data, int width, int height,
/******************************************************************************/
static int
-rfx_encode_format_argb(char *argb_data, int width, int height,
+rfx_encode_format_argb(const char *argb_data, int width, int height,
int stride_bytes, int pixel_format,
uint8 *a_buf, uint8 *r_buf, uint8 *g_buf, uint8 *b_buf)
{
@@ -439,7 +439,8 @@ rfx_encode_rgb_to_yuv(uint8 *y_r_buf, uint8 *u_g_buf, uint8 *v_b_buf)
/******************************************************************************/
int
rfx_encode_component_rlgr1(struct rfxencode *enc, const char *qtable,
- uint8 *data, uint8 *buffer, int buffer_size, int *size)
+ const uint8 *data,
+ uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr1:"));
if (rfx_dwt_2d_encode(data, enc->dwt_buffer1, enc->dwt_buffer) != 0)
@@ -461,7 +462,8 @@ rfx_encode_component_rlgr1(struct rfxencode *enc, const char *qtable,
/******************************************************************************/
int
rfx_encode_component_rlgr3(struct rfxencode *enc, const char *qtable,
- uint8 *data, uint8 *buffer, int buffer_size, int *size)
+ const uint8 *data,
+ uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr3:"));
if (rfx_dwt_2d_encode(data, enc->dwt_buffer1, enc->dwt_buffer) != 0)
@@ -482,7 +484,7 @@ rfx_encode_component_rlgr3(struct rfxencode *enc, const char *qtable,
/******************************************************************************/
int
-rfx_encode_rgb(struct rfxencode *enc, char *rgb_data,
+rfx_encode_rgb(struct rfxencode *enc, const char *rgb_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
@@ -537,7 +539,7 @@ rfx_encode_rgb(struct rfxencode *enc, char *rgb_data,
/******************************************************************************/
int
-rfx_encode_argb(struct rfxencode *enc, char *rgb_data,
+rfx_encode_argb(struct rfxencode *enc, const char *rgb_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
@@ -598,19 +600,19 @@ rfx_encode_argb(struct rfxencode *enc, char *rgb_data,
/******************************************************************************/
int
-rfx_encode_yuv(struct rfxencode *enc, char *yuv_data,
+rfx_encode_yuv(struct rfxencode *enc, const char *yuv_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
STREAM *data_out, int *y_size, int *u_size, int *v_size)
{
- uint8 *y_buffer;
- uint8 *u_buffer;
- uint8 *v_buffer;
+ const uint8 *y_buffer;
+ const uint8 *u_buffer;
+ const uint8 *v_buffer;
- y_buffer = (uint8 *) yuv_data;
- u_buffer = (uint8 *) (yuv_data + RFX_YUV_BTES);
- v_buffer = (uint8 *) (yuv_data + RFX_YUV_BTES * 2);
+ y_buffer = (const uint8 *) yuv_data;
+ u_buffer = (const uint8 *) (yuv_data + RFX_YUV_BTES);
+ v_buffer = (const uint8 *) (yuv_data + RFX_YUV_BTES * 2);
if (enc->rfx_encode(enc, y_quants, y_buffer,
stream_get_tail(data_out),
stream_get_left(data_out),
@@ -640,22 +642,22 @@ rfx_encode_yuv(struct rfxencode *enc, char *yuv_data,
/******************************************************************************/
int
-rfx_encode_yuva(struct rfxencode *enc, char *yuva_data,
+rfx_encode_yuva(struct rfxencode *enc, const char *yuva_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
STREAM *data_out, int *y_size, int *u_size,
int *v_size, int *a_size)
{
- uint8 *y_buffer;
- uint8 *u_buffer;
- uint8 *v_buffer;
- uint8 *a_buffer;
+ const uint8 *y_buffer;
+ const uint8 *u_buffer;
+ const uint8 *v_buffer;
+ const uint8 *a_buffer;
- y_buffer = (uint8 *) yuva_data;
- u_buffer = (uint8 *) (yuva_data + RFX_YUV_BTES);
- v_buffer = (uint8 *) (yuva_data + RFX_YUV_BTES * 2);
- a_buffer = (uint8 *) (yuva_data + RFX_YUV_BTES * 3);
+ y_buffer = (const uint8 *) yuva_data;
+ u_buffer = (const uint8 *) (yuva_data + RFX_YUV_BTES);
+ v_buffer = (const uint8 *) (yuva_data + RFX_YUV_BTES * 2);
+ a_buffer = (const uint8 *) (yuva_data + RFX_YUV_BTES * 3);
if (enc->rfx_encode(enc, y_quants, y_buffer,
stream_get_tail(data_out),
stream_get_left(data_out),
diff --git a/src/rfxencode_tile.h b/src/rfxencode_tile.h
index 6195d8d..74667a4 100644
--- a/src/rfxencode_tile.h
+++ b/src/rfxencode_tile.h
@@ -3,7 +3,7 @@
* RemoteFX Codec Library - Encode
*
* Copyright 2011 Vic Lee
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,33 +28,33 @@
int
rfx_encode_component_rlgr1(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr3(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
-rfx_encode_rgb(struct rfxencode *enc, char *rgb_data,
+rfx_encode_rgb(struct rfxencode *enc, const char *rgb_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
STREAM *data_out, int *y_size, int *cb_size, int *cr_size);
int
-rfx_encode_argb(struct rfxencode *enc, char *argb_data,
+rfx_encode_argb(struct rfxencode *enc, const char *argb_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *cb_quants,
const char *cr_quants,
STREAM *data_out, int *y_size, int *u_size,
int *v_size, int *a_size);
int
-rfx_encode_yuv(struct rfxencode *enc, char *yuv_data,
+rfx_encode_yuv(struct rfxencode *enc, const char *yuv_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
STREAM *data_out, int *y_size, int *u_size, int *v_size);
int
-rfx_encode_yuva(struct rfxencode *enc, char *yuv_data,
+rfx_encode_yuva(struct rfxencode *enc, const char *yuv_data,
int width, int height, int stride_bytes,
const char *y_quants, const char *u_quants,
const char *v_quants,
@@ -63,35 +63,35 @@ rfx_encode_yuva(struct rfxencode *enc, char *yuv_data,
int
rfx_encode_component_rlgr1_x86_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr3_x86_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr1_x86_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr3_x86_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr1_amd64_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr3_amd64_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr1_amd64_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
int
rfx_encode_component_rlgr3_amd64_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size);
#endif
diff --git a/src/x86/Makefile.am b/src/x86/Makefile.am
index 969fc0e..2d099e5 100644
--- a/src/x86/Makefile.am
+++ b/src/x86/Makefile.am
@@ -1,7 +1,5 @@
X86_ASM = \
cpuid_x86.asm \
- rfxcodec_encode_diff_rlgr1_x86_sse2.asm \
- rfxcodec_encode_diff_rlgr3_x86_sse2.asm \
rfxcodec_encode_dwt_shift_x86_sse2.asm \
rfxcodec_encode_dwt_shift_x86_sse41.asm
@@ -22,4 +20,5 @@ nasm_verbose_0 = @echo " NASM $@";
.asm.lo:
$(nasm_verbose)$(LIBTOOL) $(AM_V_lt) --mode=compile \
- $(top_srcdir)/src/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@
+ $(top_srcdir)/src/nasm_lt.sh $(NASM) $(NAFLAGS) \
+ -I$(top_srcdir)/src $< -o $@
diff --git a/src/x86/cpuid_x86.asm b/src/x86/cpuid_x86.asm
index fe19a90..4ddb8a2 100644
--- a/src/x86/cpuid_x86.asm
+++ b/src/x86/cpuid_x86.asm
@@ -1,23 +1,11 @@
-%ifidn __OUTPUT_FORMAT__,elf
-SECTION .note.GNU-stack noalloc noexec nowrite progbits
-%endif
+%include "common.asm"
-SECTION .text
-
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
+section .text
;int
;cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx)
-%ifidn __OUTPUT_FORMAT__,elf
PROC cpuid_x86
-%else
-PROC _cpuid_x86
-%endif
; save registers
push ebx
push ecx
diff --git a/src/x86/funcs_x86.h b/src/x86/funcs_x86.h
index 858bc5c..4f56f27 100644
--- a/src/x86/funcs_x86.h
+++ b/src/x86/funcs_x86.h
@@ -33,38 +33,15 @@ cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx);
int
rfxcodec_encode_dwt_shift_x86_sse2(const char *qtable,
- unsigned char *data,
+ const unsigned char *data,
short *dwt_buffer1,
short *dwt_buffer);
int
rfxcodec_encode_dwt_shift_x86_sse41(const char *qtable,
- unsigned char *data,
+ const unsigned char *data,
short *dwt_buffer1,
short *dwt_buffer);
-int
-rfxcodec_encode_diff_rlgr1_x86_sse2(short *co,
- void *dst, int dst_bytes);
-int
-rfxcodec_encode_diff_rlgr3_x86_sse2(short *co,
- void *dst, int dst_bytes);
-
-int
-rfxcodec_decode_rlgr1_diff_x86_sse2(void *data, int data_bytes,
- short *out_data);
-int
-rfxcodec_decode_rlgr3_diff_x86_sse2(void *data, int data_bytes,
- short *out_data);
-int
-rfxcodec_decode_shift_idwt_x86_sse2(const char *qtable, short *src, short *dst);
-int
-rfxcodec_decode_yuv2rgb_x86_sse2(short *ydata, short *udata, short *vdata,
- unsigned int *rgbdata, int stride);
-int
-rfxcodec_decode_yuva2argb_x86_sse2(short *ydata, short *udata,
- short *vdata, char *adata,
- unsigned int *rgbdata, int stride);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/x86/rfxcodec_encode_diff_rlgr1_x86_sse2.asm b/src/x86/rfxcodec_encode_diff_rlgr1_x86_sse2.asm
deleted file mode 100644
index 13d10e9..0000000
--- a/src/x86/rfxcodec_encode_diff_rlgr1_x86_sse2.asm
+++ /dev/null
@@ -1,35 +0,0 @@
-%ifidn __OUTPUT_FORMAT__,elf
-section .note.GNU-stack noalloc noexec nowrite progbits
-%endif
-
-section .data
- const1 times 8 dw 1
-
-section .text
-
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
-;int
-;rfxcodec_encode_diff_rlgr1_x86_sse2(short *co,
-; void *dst, int dst_bytes);
-
-%ifidn __OUTPUT_FORMAT__,elf
-PROC rfxcodec_encode_diff_rlgr1_x86_sse2
-%else
-PROC _rfxcodec_encode_diff_rlgr1_x86_sse2
-%endif
- push ebx
- push esi
- push edi
-
- mov eax, 0
- pop edi
- pop esi
- pop ebx
- ret
- align 16
-
diff --git a/src/x86/rfxcodec_encode_diff_rlgr3_x86_sse2.asm b/src/x86/rfxcodec_encode_diff_rlgr3_x86_sse2.asm
deleted file mode 100644
index a8588f2..0000000
--- a/src/x86/rfxcodec_encode_diff_rlgr3_x86_sse2.asm
+++ /dev/null
@@ -1,35 +0,0 @@
-%ifidn __OUTPUT_FORMAT__,elf
-section .note.GNU-stack noalloc noexec nowrite progbits
-%endif
-
-section .data
- const1 times 8 dw 1
-
-section .text
-
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
-;int
-;rfxcodec_encode_diff_rlgr3_x86_sse2(short *co,
-; void *dst, int dst_bytes);
-
-%ifidn __OUTPUT_FORMAT__,elf
-PROC rfxcodec_encode_diff_rlgr3_x86_sse2
-%else
-PROC _rfxcodec_encode_diff_rlgr3_x86_sse2
-%endif
- push ebx
- push esi
- push edi
-
- mov eax, 0
- pop edi
- pop esi
- pop ebx
- ret
- align 16
-
diff --git a/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm b/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
index 0b7e122..fb8dd56 100644
--- a/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
+++ b/src/x86/rfxcodec_encode_dwt_shift_x86_sse2.asm
@@ -20,8 +20,9 @@
;
;x86 asm dwt
+%include "common.asm"
+
%ifidn __OUTPUT_FORMAT__,elf
-section .note.GNU-stack noalloc noexec nowrite progbits
%ifdef PIC
section .text
extern _GLOBAL_OFFSET_TABLE_
@@ -71,12 +72,6 @@ section .data
section .text
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
%define LHI_ADD [esp + 1 * 16 + 4]
%define LHI_SFT [esp + 2 * 16 + 4]
%define LLO_ADD [esp + 3 * 16 + 4]
@@ -1381,11 +1376,7 @@ set_quants_lo:
; short *work_buffer);
;******************************************************************************
-%ifidn __OUTPUT_FORMAT__,elf
PROC rfxcodec_encode_dwt_shift_x86_sse2
-%else
-PROC _rfxcodec_encode_dwt_shift_x86_sse2
-%endif
; align stack
mov eax, esp
sub eax, 0x10
diff --git a/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm b/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm
index 4bb5d68..915e6ee 100644
--- a/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm
+++ b/src/x86/rfxcodec_encode_dwt_shift_x86_sse41.asm
@@ -20,8 +20,9 @@
;
;x86 asm dwt
+%include "common.asm"
+
%ifidn __OUTPUT_FORMAT__,elf
-section .note.GNU-stack noalloc noexec nowrite progbits
%ifdef PIC
section .text
extern _GLOBAL_OFFSET_TABLE_
@@ -71,12 +72,6 @@ section .data
section .text
-%macro PROC 1
- align 16
- global %1
- %1:
-%endmacro
-
%define LHI_ADD [esp + 1 * 16 + 4]
%define LHI_SFT [esp + 2 * 16 + 4]
%define LLO_ADD [esp + 3 * 16 + 4]
@@ -1249,11 +1244,7 @@ set_quants_lo:
; short *work_buffer);
;******************************************************************************
-%ifidn __OUTPUT_FORMAT__,elf
PROC rfxcodec_encode_dwt_shift_x86_sse41
-%else
-PROC _rfxcodec_encode_dwt_shift_x86_sse41
-%endif
; align stack
mov eax, esp
sub eax, 0x10
diff --git a/src/x86/rfxencode_tile_x86.c b/src/x86/rfxencode_tile_x86.c
index 3418b69..a84305e 100644
--- a/src/x86/rfxencode_tile_x86.c
+++ b/src/x86/rfxencode_tile_x86.c
@@ -18,6 +18,10 @@
* limitations under the License.
*/
+#if defined(HAVE_CONFIG_H)
+#include <config_ac.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -28,6 +32,8 @@
#include "rfxencode_rlgr1.h"
#include "rfxencode_rlgr3.h"
#include "rfxencode_alpha.h"
+#include "rfxencode_diff_rlgr1.h"
+#include "rfxencode_diff_rlgr3.h"
#include "x86/funcs_x86.h"
@@ -38,7 +44,7 @@
/******************************************************************************/
int
rfx_encode_component_rlgr1_x86_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr1_x86_sse2:"));
@@ -47,20 +53,14 @@ rfx_encode_component_rlgr1_x86_sse2(struct rfxencode *enc, const char *qtable,
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr1_x86_sse2(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr1_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr1(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
/******************************************************************************/
int
rfx_encode_component_rlgr3_x86_sse2(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr3_x86_sse2:"));
@@ -69,20 +69,14 @@ rfx_encode_component_rlgr3_x86_sse2(struct rfxencode *enc, const char *qtable,
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr3_x86_sse2(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr3_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr3(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
/******************************************************************************/
int
rfx_encode_component_rlgr1_x86_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr1_x86_sse41:"));
@@ -91,20 +85,14 @@ rfx_encode_component_rlgr1_x86_sse41(struct rfxencode *enc, const char *qtable,
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr1_x86_sse2(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr1_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr1(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
/******************************************************************************/
int
rfx_encode_component_rlgr3_x86_sse41(struct rfxencode *enc, const char *qtable,
- uint8 *data,
+ const uint8 *data,
uint8 *buffer, int buffer_size, int *size)
{
LLOGLN(10, ("rfx_encode_component_rlgr3_x86_sse41:"));
@@ -113,12 +101,6 @@ rfx_encode_component_rlgr3_x86_sse41(struct rfxencode *enc, const char *qtable,
{
return 1;
}
- //*size = rfxcodec_encode_diff_rlgr3_x86_sse(enc->dwt_buffer1,
- // buffer, buffer_size);
- if (rfx_differential_encode(enc->dwt_buffer1 + 4032, 64) != 0)
- {
- return 1;
- }
- *size = rfx_rlgr3_encode(enc->dwt_buffer1, buffer, buffer_size);
+ *size = rfx_encode_diff_rlgr3(enc->dwt_buffer1, buffer, buffer_size);
return 0;
}
diff --git a/tests/rfxcodectest.c b/tests/rfxcodectest.c
index 4d20be2..3b22dc7 100644
--- a/tests/rfxcodectest.c
+++ b/tests/rfxcodectest.c
@@ -1,7 +1,7 @@
/**
* RFX codec encoder test
*
- * Copyright 2014-2015 Jay Sorg <jay.sorg@gmail.com>
+ * Copyright 2014-2017 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/tests/rfxencode.c b/tests/rfxencode.c
index 66fb173..d8d1dfc 100644
--- a/tests/rfxencode.c
+++ b/tests/rfxencode.c
@@ -16,6 +16,10 @@
* limitations under the License.
*/
+#if defined(HAVE_CONFIG_H)
+#include <config_ac.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>