split quant_levels.c into decoder and encoder version
-> split libraries further into decoder / encoder -> add libwebpdecoder.a in Makefile.unix -> make dwebp link against libwebpdecoder.a in Makefile.unix also: in makefile.unix, pass EXTRA_FLAGS to LDFLAGS too (otherwise, -m32 wouldn't work, e.g.) Change-Id: Ief3da02a729dd86bbaf949ed048836716941657f
This commit is contained in:
parent
e5d3ffe275
commit
5cf7792e40
@ -46,6 +46,7 @@ LOCAL_SRC_FILES := \
|
|||||||
src/utils/huffman.c \
|
src/utils/huffman.c \
|
||||||
src/utils/huffman_encode.c \
|
src/utils/huffman_encode.c \
|
||||||
src/utils/quant_levels.c \
|
src/utils/quant_levels.c \
|
||||||
|
src/utils/quant_levels_dec.c \
|
||||||
src/utils/rescaler.c \
|
src/utils/rescaler.c \
|
||||||
src/utils/thread.c \
|
src/utils/thread.c \
|
||||||
src/utils/utils.c \
|
src/utils/utils.c \
|
||||||
|
@ -213,6 +213,7 @@ UTILS_OBJS = \
|
|||||||
$(DIROBJ)\utils\huffman.obj \
|
$(DIROBJ)\utils\huffman.obj \
|
||||||
$(DIROBJ)\utils\huffman_encode.obj \
|
$(DIROBJ)\utils\huffman_encode.obj \
|
||||||
$(DIROBJ)\utils\quant_levels.obj \
|
$(DIROBJ)\utils\quant_levels.obj \
|
||||||
|
$(DIROBJ)\utils\quant_levels_dec.obj \
|
||||||
$(DIROBJ)\utils\rescaler.obj \
|
$(DIROBJ)\utils\rescaler.obj \
|
||||||
$(DIROBJ)\utils\thread.obj \
|
$(DIROBJ)\utils\thread.obj \
|
||||||
$(DIROBJ)\utils\utils.obj \
|
$(DIROBJ)\utils\utils.obj \
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# system, for simple local building of the libraries and tools.
|
# system, for simple local building of the libraries and tools.
|
||||||
# It will not install the libraries system-wide, but just create the 'cwebp'
|
# It will not install the libraries system-wide, but just create the 'cwebp'
|
||||||
# and 'dwebp' tools in the examples/ directory, along with the static
|
# and 'dwebp' tools in the examples/ directory, along with the static
|
||||||
# libraries 'src/libwebp.a', 'src/mux/libwebpmux.a' and
|
# libraries 'src/libwebp.a', 'src/libwebpdecoder.a', 'src/mux/libwebpmux.a' and
|
||||||
# 'src/demux/libwebpdemux.a'.
|
# 'src/demux/libwebpdemux.a'.
|
||||||
#
|
#
|
||||||
# To build the library and examples, use:
|
# To build the library and examples, use:
|
||||||
@ -78,7 +78,7 @@ CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS)
|
|||||||
INSTALL = install
|
INSTALL = install
|
||||||
GROFF = /usr/bin/groff
|
GROFF = /usr/bin/groff
|
||||||
COL = /usr/bin/col
|
COL = /usr/bin/col
|
||||||
LDFLAGS = $(EXTRA_LIBS) -lm
|
LDFLAGS = $(EXTRA_LIBS) $(EXTRA_FLAGS) -lm
|
||||||
|
|
||||||
DEC_OBJS = \
|
DEC_OBJS = \
|
||||||
src/dec/alpha.o \
|
src/dec/alpha.o \
|
||||||
@ -96,20 +96,22 @@ DEC_OBJS = \
|
|||||||
DEMUX_OBJS = \
|
DEMUX_OBJS = \
|
||||||
src/demux/demux.o \
|
src/demux/demux.o \
|
||||||
|
|
||||||
DSP_OBJS = \
|
DSP_DEC_OBJS = \
|
||||||
src/dsp/cpu.o \
|
src/dsp/cpu.o \
|
||||||
src/dsp/dec.o \
|
src/dsp/dec.o \
|
||||||
src/dsp/dec_neon.o \
|
src/dsp/dec_neon.o \
|
||||||
src/dsp/dec_sse2.o \
|
src/dsp/dec_sse2.o \
|
||||||
src/dsp/enc.o \
|
|
||||||
src/dsp/enc_neon.o \
|
|
||||||
src/dsp/enc_sse2.o \
|
|
||||||
src/dsp/lossless.o \
|
src/dsp/lossless.o \
|
||||||
src/dsp/upsampling.o \
|
src/dsp/upsampling.o \
|
||||||
src/dsp/upsampling_neon.o \
|
src/dsp/upsampling_neon.o \
|
||||||
src/dsp/upsampling_sse2.o \
|
src/dsp/upsampling_sse2.o \
|
||||||
src/dsp/yuv.o \
|
src/dsp/yuv.o \
|
||||||
|
|
||||||
|
DSP_ENC_OBJS = \
|
||||||
|
src/dsp/enc.o \
|
||||||
|
src/dsp/enc_neon.o \
|
||||||
|
src/dsp/enc_sse2.o \
|
||||||
|
|
||||||
ENC_OBJS = \
|
ENC_OBJS = \
|
||||||
src/enc/alpha.o \
|
src/enc/alpha.o \
|
||||||
src/enc/analysis.o \
|
src/enc/analysis.o \
|
||||||
@ -143,19 +145,24 @@ MUX_OBJS = \
|
|||||||
src/mux/muxinternal.o \
|
src/mux/muxinternal.o \
|
||||||
src/mux/muxread.o \
|
src/mux/muxread.o \
|
||||||
|
|
||||||
UTILS_OBJS = \
|
UTILS_DEC_OBJS = \
|
||||||
src/utils/bit_reader.o \
|
src/utils/bit_reader.o \
|
||||||
src/utils/bit_writer.o \
|
|
||||||
src/utils/color_cache.o \
|
src/utils/color_cache.o \
|
||||||
src/utils/filters.o \
|
src/utils/filters.o \
|
||||||
src/utils/huffman.o \
|
src/utils/huffman.o \
|
||||||
src/utils/huffman_encode.o \
|
src/utils/quant_levels_dec.o \
|
||||||
src/utils/quant_levels.o \
|
|
||||||
src/utils/rescaler.o \
|
src/utils/rescaler.o \
|
||||||
src/utils/thread.o \
|
src/utils/thread.o \
|
||||||
src/utils/utils.o \
|
src/utils/utils.o \
|
||||||
|
|
||||||
LIBWEBP_OBJS = $(DEC_OBJS) $(DSP_OBJS) $(ENC_OBJS) $(UTILS_OBJS)
|
UTILS_ENC_OBJS = \
|
||||||
|
src/utils/bit_writer.o \
|
||||||
|
src/utils/huffman_encode.o \
|
||||||
|
src/utils/quant_levels.o \
|
||||||
|
|
||||||
|
LIBWEBPDECODER_OBJS = $(DEC_OBJS) $(DSP_DEC_OBJS) $(UTILS_DEC_OBJS)
|
||||||
|
LIBWEBP_OBJS = $(LIBWEBPDECODER_OBJS) $(ENC_OBJS) $(DSP_ENC_OBJS) \
|
||||||
|
$(UTILS_ENC_OBJS)
|
||||||
LIBWEBPMUX_OBJS = $(MUX_OBJS)
|
LIBWEBPMUX_OBJS = $(MUX_OBJS)
|
||||||
LIBWEBPDEMUX_OBJS = $(DEMUX_OBJS)
|
LIBWEBPDEMUX_OBJS = $(DEMUX_OBJS)
|
||||||
|
|
||||||
@ -181,6 +188,7 @@ HDRS = \
|
|||||||
src/utils/huffman.h \
|
src/utils/huffman.h \
|
||||||
src/utils/huffman_encode.h \
|
src/utils/huffman_encode.h \
|
||||||
src/utils/quant_levels.h \
|
src/utils/quant_levels.h \
|
||||||
|
src/utils/quant_levels_dec.h \
|
||||||
src/utils/rescaler.h \
|
src/utils/rescaler.h \
|
||||||
src/utils/thread.h \
|
src/utils/thread.h \
|
||||||
src/webp/demux.h \
|
src/webp/demux.h \
|
||||||
@ -189,7 +197,7 @@ HDRS = \
|
|||||||
src/webp/mux_types.h \
|
src/webp/mux_types.h \
|
||||||
$(HDRS_INSTALLED) \
|
$(HDRS_INSTALLED) \
|
||||||
|
|
||||||
OUT_LIBS = examples/libexample_util.a src/libwebp.a
|
OUT_LIBS = examples/libexample_util.a src/libwebpdecoder.a src/libwebp.a
|
||||||
OUT_EXAMPLES = examples/cwebp examples/dwebp
|
OUT_EXAMPLES = examples/cwebp examples/dwebp
|
||||||
|
|
||||||
OUTPUT = $(OUT_LIBS) $(OUT_EXAMPLES)
|
OUTPUT = $(OUT_LIBS) $(OUT_EXAMPLES)
|
||||||
@ -206,6 +214,7 @@ $(EX_FORMAT_DEC_OBJS): %.o: %.h
|
|||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
examples/libexample_util.a: $(EX_UTIL_OBJS)
|
examples/libexample_util.a: $(EX_UTIL_OBJS)
|
||||||
|
src/libwebpdecoder.a: $(LIBWEBPDECODER_OBJS)
|
||||||
src/libwebp.a: $(LIBWEBP_OBJS)
|
src/libwebp.a: $(LIBWEBP_OBJS)
|
||||||
src/mux/libwebpmux.a: $(LIBWEBPMUX_OBJS)
|
src/mux/libwebpmux.a: $(LIBWEBPMUX_OBJS)
|
||||||
src/demux/libwebpdemux.a: $(LIBWEBPDEMUX_OBJS)
|
src/demux/libwebpdemux.a: $(LIBWEBPDEMUX_OBJS)
|
||||||
@ -223,14 +232,15 @@ examples/webpmux: examples/webpmux.o
|
|||||||
|
|
||||||
examples/cwebp: src/libwebp.a
|
examples/cwebp: src/libwebp.a
|
||||||
examples/cwebp: EXTRA_LIBS += $(CWEBP_LIBS)
|
examples/cwebp: EXTRA_LIBS += $(CWEBP_LIBS)
|
||||||
examples/dwebp: examples/libexample_util.a src/libwebp.a
|
examples/dwebp: examples/libexample_util.a src/libwebpdecoder.a
|
||||||
examples/dwebp: EXTRA_LIBS += $(DWEBP_LIBS)
|
examples/dwebp: EXTRA_LIBS += $(DWEBP_LIBS)
|
||||||
examples/gif2webp: examples/libexample_util.a src/mux/libwebpmux.a src/libwebp.a
|
examples/gif2webp: examples/libexample_util.a src/mux/libwebpmux.a src/libwebp.a
|
||||||
examples/gif2webp: EXTRA_LIBS += $(GIF_LIBS)
|
examples/gif2webp: EXTRA_LIBS += $(GIF_LIBS)
|
||||||
examples/vwebp: examples/libexample_util.a src/demux/libwebpdemux.a
|
examples/vwebp: examples/libexample_util.a src/demux/libwebpdemux.a
|
||||||
examples/vwebp: src/libwebp.a
|
examples/vwebp: src/libwebp.a
|
||||||
examples/vwebp: EXTRA_LIBS += $(GL_LIBS)
|
examples/vwebp: EXTRA_LIBS += $(GL_LIBS)
|
||||||
examples/webpmux: examples/libexample_util.a src/mux/libwebpmux.a src/libwebp.a
|
examples/webpmux: examples/libexample_util.a src/mux/libwebpmux.a
|
||||||
|
examples/webpmux: src/libwebpdecoder.a
|
||||||
|
|
||||||
$(OUT_EXAMPLES) examples/gif2webp examples/vwebp examples/webpmux:
|
$(OUT_EXAMPLES) examples/gif2webp examples/vwebp examples/webpmux:
|
||||||
$(CC) -o $@ $^ $(LDFLAGS)
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
@ -271,7 +281,8 @@ superclean: clean
|
|||||||
$(RM) Makefile */Makefile */*/Makefile
|
$(RM) Makefile */Makefile */*/Makefile
|
||||||
$(RM) Makefile.in */Makefile.in */*/Makefile.in
|
$(RM) Makefile.in */Makefile.in */*/Makefile.in
|
||||||
$(RM) config.log autom4te.cache libtool config.h stamp-h1
|
$(RM) config.log autom4te.cache libtool config.h stamp-h1
|
||||||
$(RM) aclocal.m4 compile config.guess config.h.in config.sub config.status
|
$(RM) aclocal.m4 compile
|
||||||
|
$(RM) config.guess config.h.in config.sub config.status
|
||||||
$(RM) configure depcomp install-sh ltmain.sh missing src/libwebp.pc
|
$(RM) configure depcomp install-sh ltmain.sh missing src/libwebp.pc
|
||||||
$(RM) m4/*
|
$(RM) m4/*
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "./vp8i.h"
|
#include "./vp8i.h"
|
||||||
#include "./vp8li.h"
|
#include "./vp8li.h"
|
||||||
#include "../utils/filters.h"
|
#include "../utils/filters.h"
|
||||||
#include "../utils/quant_levels.h"
|
#include "../utils/quant_levels_dec.h"
|
||||||
#include "../webp/format_constants.h"
|
#include "../webp/format_constants.h"
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
@ -14,8 +14,8 @@ COMMON_SOURCES += filters.c
|
|||||||
COMMON_SOURCES += filters.h
|
COMMON_SOURCES += filters.h
|
||||||
COMMON_SOURCES += huffman.c
|
COMMON_SOURCES += huffman.c
|
||||||
COMMON_SOURCES += huffman.h
|
COMMON_SOURCES += huffman.h
|
||||||
COMMON_SOURCES += quant_levels.c
|
COMMON_SOURCES += quant_levels_dec.c
|
||||||
COMMON_SOURCES += quant_levels.h
|
COMMON_SOURCES += quant_levels_dec.h
|
||||||
COMMON_SOURCES += rescaler.c
|
COMMON_SOURCES += rescaler.c
|
||||||
COMMON_SOURCES += rescaler.h
|
COMMON_SOURCES += rescaler.h
|
||||||
COMMON_SOURCES += thread.c
|
COMMON_SOURCES += thread.c
|
||||||
@ -28,6 +28,8 @@ ENC_SOURCES += bit_writer.c
|
|||||||
ENC_SOURCES += bit_writer.h
|
ENC_SOURCES += bit_writer.h
|
||||||
ENC_SOURCES += huffman_encode.c
|
ENC_SOURCES += huffman_encode.c
|
||||||
ENC_SOURCES += huffman_encode.h
|
ENC_SOURCES += huffman_encode.h
|
||||||
|
ENC_SOURCES += quant_levels.c
|
||||||
|
ENC_SOURCES += quant_levels.h
|
||||||
|
|
||||||
|
|
||||||
libwebputils_la_SOURCES = $(COMMON_SOURCES) $(ENC_SOURCES)
|
libwebputils_la_SOURCES = $(COMMON_SOURCES) $(ENC_SOURCES)
|
||||||
|
@ -140,15 +140,6 @@ int QuantizeLevels(uint8_t* const data, int width, int height,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DequantizeLevels(uint8_t* const data, int width, int height) {
|
|
||||||
if (data == NULL || width <= 0 || height <= 0) return 0;
|
|
||||||
// TODO(skal): implement gradient smoothing.
|
|
||||||
(void)data;
|
|
||||||
(void)width;
|
|
||||||
(void)height;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,11 +27,6 @@ extern "C" {
|
|||||||
int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels,
|
int QuantizeLevels(uint8_t* const data, int width, int height, int num_levels,
|
||||||
uint64_t* const sse);
|
uint64_t* const sse);
|
||||||
|
|
||||||
// Apply post-processing to input 'data' of size 'width'x'height' assuming
|
|
||||||
// that the source was quantized to a reduced number of levels.
|
|
||||||
// Returns false in case of error (data is NULL, invalid parameters, ...).
|
|
||||||
int DequantizeLevels(uint8_t* const data, int width, int height);
|
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
28
src/utils/quant_levels_dec.c
Normal file
28
src/utils/quant_levels_dec.c
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the same terms as WebM:
|
||||||
|
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||||
|
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// TODO(skal): implement gradient smoothing.
|
||||||
|
//
|
||||||
|
// Author: Skal (pascal.massimino@gmail.com)
|
||||||
|
|
||||||
|
#include "./quant_levels_dec.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int DequantizeLevels(uint8_t* const data, int width, int height) {
|
||||||
|
if (data == NULL || width <= 0 || height <= 0) return 0;
|
||||||
|
(void)data;
|
||||||
|
(void)width;
|
||||||
|
(void)height;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
30
src/utils/quant_levels_dec.h
Normal file
30
src/utils/quant_levels_dec.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the same terms as WebM:
|
||||||
|
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||||
|
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Alpha plane de-quantization utility
|
||||||
|
//
|
||||||
|
// Author: Vikas Arora (vikasa@google.com)
|
||||||
|
|
||||||
|
#ifndef WEBP_UTILS_QUANT_LEVELS_DEC_H_
|
||||||
|
#define WEBP_UTILS_QUANT_LEVELS_DEC_H_
|
||||||
|
|
||||||
|
#include "../webp/types.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Apply post-processing to input 'data' of size 'width'x'height' assuming
|
||||||
|
// that the source was quantized to a reduced number of levels.
|
||||||
|
// Returns false in case of error (data is NULL, invalid parameters, ...).
|
||||||
|
int DequantizeLevels(uint8_t* const data, int width, int height);
|
||||||
|
|
||||||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* WEBP_UTILS_QUANT_LEVELS_DEC_H_ */
|
Loading…
Reference in New Issue
Block a user