Skip to content

Commit

Permalink
Merge pull request #7 from neutrinolabs/devel
Browse files Browse the repository at this point in the history
Merge devel branch (for 0.9.1 version)
  • Loading branch information
speidy committed Dec 20, 2016
2 parents 3f137a6 + bc30b7a commit 03a3689
Show file tree
Hide file tree
Showing 55 changed files with 8,316 additions and 548 deletions.
32 changes: 32 additions & 0 deletions .gitignore
@@ -0,0 +1,32 @@
*~
aclocal.m4
AUTHORS
autom4te.cache/
ChangeLog
config_ac.h
config_ac-h.in
config.c
config.guess
config.log
config.status
config.sub
configure
compile
depcomp
.deps/
install-sh
*.la
.libs
libtool
*.lo
ltmain.sh
Makefile
Makefile.in
missing
NEWS
*.o
*.pc
README
stamp-h1
rfxcodectest
.dirstamp
12 changes: 0 additions & 12 deletions Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions Makefile.am
@@ -0,0 +1,14 @@
ACLOCAL_AMFLAGS = -I m4

pkgconfig_DATA = rfxcodec.pc

EXTRA_DIST = bootstrap readme.txt

SUBDIRS = \
src \
tests

include_HEADERS = \
include/rfxcodec_encode.h \
include/rfxcodec_decode.h \
include/rfxcodec_common.h
137 changes: 137 additions & 0 deletions acinclude.m4
@@ -0,0 +1,137 @@
# AC_PROG_NASM
# --------------------------
# Check that NASM exists and determine flags
AC_DEFUN([AC_PROG_NASM],[
AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found])
AC_MSG_CHECKING([for object file format of host system])
case "$host_os" in
cygwin* | mingw* | pw32* | interix*)
case "$host_cpu" in
x86_64)
objfmt='Win64-COFF'
;;
*)
objfmt='Win32-COFF'
;;
esac
;;
msdosdjgpp* | go32*)
objfmt='COFF'
;;
os2-emx*) # not tested
objfmt='MSOMF' # obj
;;
linux*coff* | linux*oldld*)
objfmt='COFF' # ???
;;
linux*aout*)
objfmt='a.out'
;;
linux*)
case "$host_cpu" in
x86_64)
objfmt='ELF64'
;;
*)
objfmt='ELF'
;;
esac
;;
freebsd* | netbsd* | openbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
objfmt='BSD-a.out'
else
case "$host_cpu" in
x86_64 | amd64)
objfmt='ELF64'
;;
*)
objfmt='ELF'
;;
esac
fi
;;
solaris* | sunos* | sysv* | sco*)
case "$host_cpu" in
x86_64)
objfmt='ELF64'
;;
*)
objfmt='ELF'
;;
esac
;;
darwin* | rhapsody* | nextstep* | openstep* | macos*)
case "$host_cpu" in
x86_64)
objfmt='Mach-O64'
;;
*)
objfmt='Mach-O'
;;
esac
;;
*)
objfmt='ELF ?'
;;
esac
AC_MSG_RESULT([$objfmt])
if test "$objfmt" = 'ELF ?'; then
objfmt='ELF'
AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
fi
AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
case "$objfmt" in
MSOMF) NAFLAGS='-fobj -DOBJ32';;
Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
COFF) NAFLAGS='-fcoff -DCOFF';;
a.out) NAFLAGS='-faout -DAOUT';;
BSD-a.out) NAFLAGS='-faoutb -DAOUT';;
ELF) NAFLAGS='-felf -DELF';;
ELF64) NAFLAGS='-felf64 -DELF -D__x86_64__';;
RDF) NAFLAGS='-frdf -DRDF';;
Mach-O) NAFLAGS='-fmacho -DMACHO';;
Mach-O64) NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
esac
AC_MSG_RESULT([$NAFLAGS])
AC_SUBST([NAFLAGS])
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
ret
]EOF
try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
AC_MSG_RESULT(yes)
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.asm >&AC_FD_CC
rm -rf conftest*
AC_MSG_RESULT(no)
AC_MSG_ERROR([installation or configuration problem: assembler cannot create object files.])
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)
AC_MSG_ERROR([configuration problem: maybe object file format mismatch.])
fi
])

32 changes: 32 additions & 0 deletions bootstrap
@@ -0,0 +1,32 @@
#!/bin/sh

which autoconf
if ! test $? -eq 0
then
echo "error, install autoconf"
exit 1
fi

which automake
if ! test $? -eq 0
then
echo "error, install automake"
exit 1
fi

which libtool || which libtoolize
if ! test $? -eq 0
then
echo "error, install libtool"
exit 1
fi

which pkg-config
if ! test $? -eq 0
then
echo "error, install pkg-config"
exit 1
fi

touch configure.ac
autoreconf -fvi
53 changes: 53 additions & 0 deletions configure.ac
@@ -0,0 +1,53 @@
# 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_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
AM_INIT_AUTOMAKE([1.6 foreign])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_PROG_CC
AC_C_CONST
AC_PROG_LIBTOOL
PKG_INSTALLDIR

# SIMD is optional
AC_ARG_WITH([simd],
AC_HELP_STRING([--without-simd],[Omit SIMD extensions.]))
if test "x${with_simd}" != "xno"; then
# Check if we're on a supported CPU
AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
case "$host_cpu" in
x86_64 | amd64)
AC_MSG_RESULT([yes (x86_64)])
AC_PROG_NASM
simd_arch=x86_64
;;
i*86 | x86 | ia32)
AC_MSG_RESULT([yes (i386)])
AC_PROG_NASM
simd_arch=i386
;;
*)
AC_MSG_RESULT([no ("$host_cpu")])
AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
with_simd=no;
;;
esac
if test "x${with_simd}" != "xno"; then
AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
fi
fi

AM_CONDITIONAL(WITH_SIMD_AMD64, [test x$simd_arch = xx86_64])
AM_CONDITIONAL(WITH_SIMD_X86, [test x$simd_arch = xi386])

AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile
rfxcodec.pc
rfxcodec-uninstalled.pc
])

AC_OUTPUT

40 changes: 40 additions & 0 deletions include/rfxcodec_common.h
@@ -0,0 +1,40 @@
/**
* RFX codec
*
* Copyright 2015 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.
*/

#ifndef __RFXCODEC_COMMON_H
#define __RFXCODEC_COMMON_H

#define RFX_FORMAT_BGRA 0
#define RFX_FORMAT_RGBA 1
#define RFX_FORMAT_BGR 2
#define RFX_FORMAT_RGB 3
#define RFX_FORMAT_YUV 4 /* YUV444 linear tiled mode */

#define RFX_FLAGS_NONE 0 /* default RFX_FLAGS_RLGR3 and RFX_FLAGS_SAFE */

#define RFX_FLAGS_SAFE 0 /* default */
#define RFX_FLAGS_OPT1 (1 << 3)
#define RFX_FLAGS_OPT2 (1 << 4)
#define RFX_FLAGS_NOACCEL (1 << 6)

#define RFX_FLAGS_RLGR3 0 /* default */
#define RFX_FLAGS_RLGR1 1

#define RFX_FLAGS_ALPHAV1 1 /* used in flags for rfxcodec_encode */

#endif
33 changes: 33 additions & 0 deletions include/rfxcodec_decode.h
@@ -0,0 +1,33 @@
/**
* RFX codec decoder
*
* Copyright 2014-2015 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.
*/

#ifndef __RFXCODEC_DECODE_H
#define __RFXCODEC_DECODE_H

#include <rfxcodec_common.h>

int
rfxcodec_decode_create(int width, int height, int format, int flags,
void **handle);
int
rfxcodec_decode_destroy(void *handle);
int
rfxcodec_decode(void *handle, char *cdata, int cdata_bytes,
char *data, int width, int height, int stride_bytes);

#endif

0 comments on commit 03a3689

Please sign in to comment.