From e5c6e9a6f2d0c3de8f5e0c66de793bc20ea3c56c Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 10 Oct 2012 22:59:37 +0100 Subject: [PATCH 1/7] build: remove single-use variable THIS_LIB Replace the single use of THIS_LIB with its value. Signed-off-by: Mans Rullgard --- library.mak | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library.mak b/library.mak index 7f26984cd0..f715f4a9a8 100644 --- a/library.mak +++ b/library.mak @@ -5,7 +5,6 @@ include $(SRC_PATH)/common.mak LIBVERSION := $(lib$(NAME)_VERSION) LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR) INCINSTDIR := $(INCDIR)/lib$(NAME) -THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME) all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) @@ -92,7 +91,7 @@ endef $(eval $(RULES)) -$(EXAMPLES) $(TOOLS): $(THIS_LIB) $(DEP_LIBS) +$(EXAMPLES) $(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME) $(TESTPROGS): $(SUBDIR)$(LIBNAME) $(DEP_LIBS) examples: $(EXAMPLES) From 1c7428e6554a4cf4cd0bcf6d0d27fd669383e199 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 10 Oct 2012 23:00:00 +0100 Subject: [PATCH 2/7] build: whitespace cosmetics Signed-off-by: Mans Rullgard --- library.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.mak b/library.mak index f715f4a9a8..64b5f2b2d5 100644 --- a/library.mak +++ b/library.mak @@ -92,7 +92,7 @@ endef $(eval $(RULES)) $(EXAMPLES) $(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME) -$(TESTPROGS): $(SUBDIR)$(LIBNAME) $(DEP_LIBS) +$(TESTPROGS): $(DEP_LIBS) $(SUBDIR)$(LIBNAME) examples: $(EXAMPLES) testprogs: $(TESTPROGS) From effe443877c589a6a466093ed0ac9704b165b90a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 10 Oct 2012 23:02:57 +0100 Subject: [PATCH 3/7] build: do not use LIB as variable name The Microsoft linker uses the LIB environment variable which clashes with a make variable of the same name. Signed-off-by: Mans Rullgard --- library.mak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library.mak b/library.mak index 64b5f2b2d5..b36593504c 100644 --- a/library.mak +++ b/library.mak @@ -33,11 +33,11 @@ install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared define RULES -$(EXAMPLES) $(TOOLS): LIB = $(FULLNAME:%=$(LD_LIB)) -$(TESTPROGS): LIB = $(SUBDIR)$(LIBNAME) +$(EXAMPLES) $(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB)) +$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME) $(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o - $$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(LIB) $(FFEXTRALIBS) $$(ELIBS) + $$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS) $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME) From 1a2c7880aa1ca5893b860e81dd3f0a4c2696de18 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Wed, 10 Oct 2012 22:25:51 +0200 Subject: [PATCH 4/7] averror: make error values proper negative values Fixes stupid mistake in 25227c3a78fefd74bc6ea34032cd49ec8c8d9d85. --- libavutil/error.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libavutil/error.h b/libavutil/error.h index 38f9824a5b..61d5fb9085 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -45,21 +45,21 @@ #define AVUNERROR(e) (e) #endif -#define AVERROR_BSF_NOT_FOUND 0xb9acbd08 ///< Bitstream filter not found -#define AVERROR_DECODER_NOT_FOUND 0xbcbabb08 ///< Decoder not found -#define AVERROR_DEMUXER_NOT_FOUND 0xb2babb08 ///< Demuxer not found -#define AVERROR_ENCODER_NOT_FOUND 0xbcb1ba08 ///< Encoder not found -#define AVERROR_EOF 0xdfb9b0bb ///< End of file -#define AVERROR_EXIT 0xabb6a7bb ///< Immediate exit was requested; the called function should not be restarted -#define AVERROR_FILTER_NOT_FOUND 0xb3b6b908 ///< Filter not found -#define AVERROR_INVALIDDATA 0xbebbb1b7 ///< Invalid data found when processing input -#define AVERROR_MUXER_NOT_FOUND 0xa7aab208 ///< Muxer not found -#define AVERROR_OPTION_NOT_FOUND 0xabafb008 ///< Option not found -#define AVERROR_PATCHWELCOME 0xbaa8beb0 ///< Not yet implemented in Libav, patches welcome -#define AVERROR_PROTOCOL_NOT_FOUND 0xb0adaf08 ///< Protocol not found -#define AVERROR_STREAM_NOT_FOUND 0xadabac08 ///< Stream not found -#define AVERROR_BUG 0xdfb8aabe ///< Bug detected, please report the issue -#define AVERROR_UNKNOWN 0xb1b4b1ab ///< Unknown error, typically from an external library +#define AVERROR_BSF_NOT_FOUND (-0x39acbd08) ///< Bitstream filter not found +#define AVERROR_DECODER_NOT_FOUND (-0x3cbabb08) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-0x32babb08) ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND (-0x3cb1ba08) ///< Encoder not found +#define AVERROR_EOF (-0x5fb9b0bb) ///< End of file +#define AVERROR_EXIT (-0x2bb6a7bb) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-0x33b6b908) ///< Filter not found +#define AVERROR_INVALIDDATA (-0x3ebbb1b7) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-0x27aab208) ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND (-0x2bafb008) ///< Option not found +#define AVERROR_PATCHWELCOME (-0x3aa8beb0) ///< Not yet implemented in Libav, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND (-0x30adaf08) ///< Protocol not found +#define AVERROR_STREAM_NOT_FOUND (-0x2dabac08) ///< Stream not found +#define AVERROR_BUG (-0x5fb8aabe) ///< Bug detected, please report the issue +#define AVERROR_UNKNOWN (-0x31b4b1ab) ///< Unknown error, typically from an external library /** * Put a description of the AVERROR code errnum in errbuf. From 25dc79bc1433f2689b69aa1293e311ed69a95a8a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 11 Oct 2012 02:08:24 +0100 Subject: [PATCH 5/7] sh4: add required #include, fix build Signed-off-by: Mans Rullgard --- libavcodec/sh4/qpel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/sh4/qpel.c b/libavcodec/sh4/qpel.c index 3242872e47..cb6cdf0db5 100644 --- a/libavcodec/sh4/qpel.c +++ b/libavcodec/sh4/qpel.c @@ -21,6 +21,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/common.h" + #define PIXOP2(OPNAME, OP) \ \ static inline void OPNAME ## _pixels4_l2_aligned(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \ From 2d6caade22334f5c0e999ebfe5f0f20c1b18aafc Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 11 Oct 2012 02:01:41 +0200 Subject: [PATCH 6/7] dsputil: split out mlp dsp function --- libavcodec/dsputil.c | 4 ---- libavcodec/dsputil.h | 8 -------- libavcodec/mlpdec.c | 6 +++--- libavcodec/mlpdsp.c | 7 ++++--- libavcodec/x86/mlpdsp.c | 4 ++-- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 5c705ea169..cdd4b731f1 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -2793,10 +2793,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) #undef dspfunc -#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER - ff_mlp_init(c, avctx); -#endif - c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c; c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 6ce41df006..da3e7586e2 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -479,12 +479,6 @@ typedef struct DSPContext { void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); - /* mlp/truehd functions */ - void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff, - int firorder, int iirorder, - unsigned int filter_shift, int32_t mask, int blocksize, - int32_t *sample_buffer); - /** * Calculate scalar product of two vectors. * @param len length of vectors, should be multiple of 16 @@ -612,8 +606,6 @@ void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_dwt(DSPContext *c); -void ff_mlp_init(DSPContext* c, AVCodecContext *avctx); -void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); #if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMI || HAVE_MMX # define STRIDE_ALIGN 16 diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index afd8f887ec..cae5136efb 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -27,12 +27,12 @@ #include #include "avcodec.h" -#include "dsputil.h" #include "libavutil/intreadwrite.h" #include "get_bits.h" #include "libavutil/crc.h" #include "parser.h" #include "mlp_parser.h" +#include "mlpdsp.h" #include "mlp.h" /** number of bits used for VLC lookup - longest Huffman code is 9 */ @@ -142,7 +142,7 @@ typedef struct MLPDecodeContext { int8_t bypassed_lsbs[MAX_BLOCKSIZE][MAX_CHANNELS]; int32_t sample_buffer[MAX_BLOCKSIZE][MAX_CHANNELS]; - DSPContext dsp; + MLPDSPContext dsp; } MLPDecodeContext; static VLC huff_vlc[3]; @@ -232,7 +232,7 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx) m->avctx = avctx; for (substr = 0; substr < MAX_SUBSTREAMS; substr++) m->substream[substr].lossless_check_data = 0xffffffff; - ff_dsputil_init(&m->dsp, avctx); + ff_mlpdsp_init(&m->dsp); avcodec_get_frame_defaults(&m->frame); avctx->coded_frame = &m->frame; diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c index 7d01c7586d..2944ce8432 100644 --- a/libavcodec/mlpdsp.c +++ b/libavcodec/mlpdsp.c @@ -19,7 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "dsputil.h" +#include "config.h" +#include "mlpdsp.h" #include "mlp.h" static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff, @@ -55,9 +56,9 @@ static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff, } } -void ff_mlp_init(DSPContext* c, AVCodecContext *avctx) +void ff_mlpdsp_init(MLPDSPContext *c) { c->mlp_filter_channel = ff_mlp_filter_channel; if (ARCH_X86) - ff_mlp_init_x86(c, avctx); + ff_mlpdsp_init_x86(c); } diff --git a/libavcodec/x86/mlpdsp.c b/libavcodec/x86/mlpdsp.c index 8f886aacbf..a18e9fa67b 100644 --- a/libavcodec/x86/mlpdsp.c +++ b/libavcodec/x86/mlpdsp.c @@ -21,7 +21,7 @@ #include "libavutil/internal.h" #include "libavutil/x86/asm.h" -#include "libavcodec/dsputil.h" +#include "libavcodec/mlpdsp.h" #include "libavcodec/mlp.h" #if HAVE_7REGS && HAVE_INLINE_ASM @@ -174,7 +174,7 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff, #endif /* HAVE_7REGS && HAVE_INLINE_ASM */ -void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx) +void ff_mlpdsp_init_x86(MLPDSPContext *c) { #if HAVE_7REGS && HAVE_INLINE_ASM c->mlp_filter_channel = mlp_filter_channel_x86; From 1ec629308652b382a409ffa61e049c074ee5e695 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 11 Oct 2012 12:34:36 +0200 Subject: [PATCH 7/7] mlpdsp: adding missing file --- libavcodec/mlpdsp.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 libavcodec/mlpdsp.h diff --git a/libavcodec/mlpdsp.h b/libavcodec/mlpdsp.h new file mode 100644 index 0000000000..995f72a00b --- /dev/null +++ b/libavcodec/mlpdsp.h @@ -0,0 +1,37 @@ +/* + * MLP codec common header file + * Copyright (c) 2007-2008 Ian Caulfield + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_MLPDSP_H +#define AVCODEC_MLPDSP_H + +#include + +typedef struct MLPDSPContext { + void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff, + int firorder, int iirorder, + unsigned int filter_shift, int32_t mask, + int blocksize, int32_t *sample_buffer); +} MLPDSPContext; + +void ff_mlpdsp_init(MLPDSPContext *c); +void ff_mlpdsp_init_x86(MLPDSPContext *c); + +#endif /* AVCODEC_MLPDSP_H */