Commit 8fd6570e authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

some optimizations for encoder thought up mostly by Joerg

parent 7b90370f
CC = gcc
#CFLAGS = -g -Wall -DPROFILE
CFLAGS = -g -Wall
#CFLAGS = -g -pg -lc -O2 -Wall -fprofile-arcs -ftest-coverage -DPROFILE
CFLAGS = -g -pg -lc -O2 -Wall -fprofile-arcs -ftest-coverage -DUNROLL_BLOCK_8
#CFLAGS = -g -O3 -Wall -DUNROLL_BLOCK_8
OBJS = aee.o aed.o sz_compat.o
.PHONY : all clean test test_sz
.PHONY : all clean check
all: libae.a
test_encode: test_encode.o libae.a
$(CC) $(CFLAGS) -o test_encode test_encode.o -L. -lae
$(CC) $(CFLAGS) -o $@ $< -L. -lae
test_decode: test_decode.o libae.a
$(CC) $(CFLAGS) -o test_decode test_decode.o -L. -lae
$(CC) $(CFLAGS) -o $@ $< -L. -lae
test_szcomp: test_szcomp.o libae.a
$(CC) $(CFLAGS) -o test_szcomp test_szcomp.o -L. -lae
$(CC) $(CFLAGS) -o $@ $< -L. -lae
libae.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
......@@ -25,6 +26,7 @@ aed.o: libae.h
aee.o: libae.h
install: libae.a
mkdir -p ../lib ../include
ln -sfT ../src/szlib.h ../include/szlib.h
ln -sfT ../src/libae.h ../include/libae.h
ln -sfT ../src/libae.a ../lib/libsz.a
......@@ -33,17 +35,16 @@ clean:
rm -f $(OBJS) test_encode.o test_decode.o \
test_encode test_decode libae.a \
test_szcomp test_szcomp.o \
../data/test.ae ../data/test
../data/test.ae ../data/test \
*.gcno *.gcda *.gcov gmon.out
test: test_encode test_decode
check: test_encode test_decode test_szcomp
./test_encode 1 1 < ../data/example_data > ../data/test.ae
./test_decode 1 1 < ../data/test.ae > ../data/test
diff ../data/test ../data/example_data
./test_encode 99 99 < ../data/example_data > ../data/test.ae
./test_decode 101 101 < ../data/test.ae > ../data/test
diff ../data/test ../data/example_data
test_sz: test_szcomp
./test_szcomp 65536 < ../data/example_data_16 > ../data/test
diff ../data/test ../data/example_data_16
......@@ -9,6 +9,8 @@
#include "libae.h"
#define MIN(a, b) (((a) < (b))? (a): (b))
#define SAFE (strm->avail_in >= state->in_blklen \
&& strm->avail_out >= strm->block_size)
......@@ -118,15 +120,7 @@ static inline void u_put(ae_streamp strm, int64_t sample)
{
d = sample;
x = state->last_out;
if ((x - state->xmin) < (state->xmax - x))
{
th = x - state->xmin;
}
else
{
th = state->xmax - x;
}
th = MIN(x - state->xmin, state->xmax - x);
if (d <= 2*th)
{
......@@ -195,14 +189,10 @@ static inline void fast_split(ae_streamp strm)
k = state->id - 1;
if (state->ref)
{
u_put(strm, u_get(strm, strm->bit_per_sample));
}
for (i = state->ref; i < strm->block_size; i++)
{
state->block[i] = u_get_fs(strm) << k;
}
for (i = state->ref; i < strm->block_size; i++)
{
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment