diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-05-02 21:04:21 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-05-02 21:04:21 +0400 |
commit | b909f331c4de7c8e826c76517652b1986781f29a (patch) | |
tree | f3bf98d4482a3c80898c814bdb227f03ba89818c /src | |
parent | 2adb832f6f28d4e6a608041d2ca972ae26f40ae6 (diff) |
updated ffmpeg
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1831 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src')
14 files changed, 181 insertions, 72 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/Makefile b/src/filters/transform/MPCVideoDec/ffmpeg/Makefile index e9ed87e2f..58b9d2770 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/Makefile +++ b/src/filters/transform/MPCVideoDec/ffmpeg/Makefile @@ -96,6 +96,7 @@ SRCS_C=\ $(LAVC_DIR)/vp5.c \
$(LAVC_DIR)/vp56.c \
$(LAVC_DIR)/vp56data.c \
+ $(LAVC_DIR)/vp56dsp.c \
$(LAVC_DIR)/vp6.c \
$(LAVC_DIR)/vp6dsp.c \
$(LAVC_DIR)/w32thread.c \
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec.vcproj b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec.vcproj index a9bdfef0d..61b6dadf7 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec.vcproj +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec.vcproj @@ -1117,6 +1117,14 @@ >
</File>
<File
+ RelativePath=".\libavcodec\vp56dsp.c"
+ >
+ </File>
+ <File
+ RelativePath=".\libavcodec\vp56dsp.h"
+ >
+ </File>
+ <File
RelativePath=".\libavcodec\vp5data.h"
>
</File>
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c index 40e2a0535..0bd09f1c1 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/bitstream.c @@ -316,9 +316,11 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size)\
else\
buf[j].symbol = i;\
- j++;\
+ j++;\
+ // MPC custom code (begin)
if(j >= nb_codes)\
break;\
+ // MPC custom code (end)
}
COPY(buf[j].bits > nb_bits);
// qsort is the slowest part of init_vlc, and could probably be improved or avoided
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c index b8b7f9718..0c04ffdf9 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c @@ -1,5 +1,5 @@ /** - * @file libavcodec/vp5.c + * @file * VP5 compatible video decoder * * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> @@ -69,23 +69,6 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, return 1; } -/* Gives very similar result than the vp6 version except in a few cases */ -static int vp5_adjust(int v, int t) -{ - int s2, s1 = v >> 31; - v ^= s1; - v -= s1; - v *= v < 2*t; - v -= t; - s2 = v >> 31; - v ^= s2; - v -= s2; - v = t - v; - v += s1; - v ^= s1; - return v; -} - static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect) { VP56RangeCoder *c = &s->c; @@ -274,7 +257,6 @@ static av_cold int vp5_decode_init(AVCodecContext *avctx) vp56_init(avctx, 1, 0); s->vp56_coord_div = vp5_coord_div; s->parse_vector_adjustment = vp5_parse_vector_adjustment; - s->adjust = vp5_adjust; s->parse_coeff = vp5_parse_coeff; s->default_models_init = vp5_default_models_init; s->parse_vector_models = vp5_parse_vector_models; diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c index bf2e05bc9..188bfcfbf 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.c @@ -1,5 +1,5 @@ /** - * @file libavcodec/vp56.c + * @file * VP5 and VP6 compatible video decoder (common features) * * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> @@ -300,27 +300,12 @@ static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame) } } -static void vp56_edge_filter(VP56Context *s, uint8_t *yuv, - int pix_inc, int line_inc, int t) -{ - int pix2_inc = 2 * pix_inc; - int i, v; - - for (i=0; i<12; i++) { - v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4) >>3; - v = s->adjust(v, t); - yuv[-pix_inc] = av_clip_uint8(yuv[-pix_inc] + v); - yuv[0] = av_clip_uint8(yuv[0] - v); - yuv += line_inc; - } -} - static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv, int stride, int dx, int dy) { int t = vp56_filter_threshold[s->quantizer]; - if (dx) vp56_edge_filter(s, yuv + 10-dx , 1, stride, t); - if (dy) vp56_edge_filter(s, yuv + stride*(10-dy), stride, 1, t); + if (dx) s->vp56dsp.edge_filter_hor(yuv + 10-dx , stride, t); + if (dy) s->vp56dsp.edge_filter_ver(yuv + stride*(10-dy), stride, t); } static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, @@ -664,6 +649,7 @@ av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha) /* always use the VP3 IDCT */ avctx->idct_algo = FF_IDCT_VP3; dsputil_init(&s->dsp, avctx); + ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id); ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct); for (i=0; i<4; i++) diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h index 1a0ee2a2f..280c66fc1 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56.h @@ -1,5 +1,5 @@ /** - * @file libavcodec/vp56.h + * @file * VP5 and VP6 compatible video decoder (common features) * * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> @@ -28,14 +28,13 @@ #include "dsputil.h" #include "get_bits.h" #include "bytestream.h" - +#include "vp56dsp.h" typedef struct vp56_context VP56Context; typedef struct vp56_mv VP56mv; typedef void (*VP56ParseVectorAdjustment)(VP56Context *s, VP56mv *vect); -typedef int (*VP56Adjust)(int v, int t); typedef void (*VP56Filter)(VP56Context *s, uint8_t *dst, uint8_t *src, int offset1, int offset2, int stride, VP56mv mv, int mask, int select, int luma); @@ -90,6 +89,7 @@ typedef struct { struct vp56_context { AVCodecContext *avctx; DSPContext dsp; + VP56DSPContext vp56dsp; ScanTable scantable; AVFrame frames[4]; AVFrame *framep[6]; @@ -149,7 +149,6 @@ struct vp56_context { const uint8_t *vp56_coord_div; VP56ParseVectorAdjustment parse_vector_adjustment; - VP56Adjust adjust; VP56Filter filter; VP56ParseCoeff parse_coeff; VP56DefaultModelsInit default_models_init; diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56dsp.c new file mode 100644 index 000000000..f9da3d78d --- /dev/null +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56dsp.c @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2006 Aurelien Jacobs <aurel@gnuage.org> + * Copyright (c) 2010 Mans Rullgard <mans@mansr.com> + * + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <stdint.h> +#include "avcodec.h" +#include "vp56dsp.h" + +/* Gives very similar result than the vp6 version except in a few cases */ +static int vp5_adjust(int v, int t) +{ + int s2, s1 = v >> 31; + v ^= s1; + v -= s1; + v *= v < 2*t; + v -= t; + s2 = v >> 31; + v ^= s2; + v -= s2; + v = t - v; + v += s1; + v ^= s1; + return v; +} + +static int vp6_adjust(int v, int t) +{ + int V = v, s = v >> 31; + V ^= s; + V -= s; + if (V-t-1 >= (unsigned)(t-1)) + return v; + V = 2*t - V; + V += s; + V ^= s; + return V; +} + + +#define VP56_EDGE_FILTER(pfx, suf, pix_inc, line_inc) \ +static void pfx##_edge_filter_##suf(uint8_t *yuv, int stride, int t) \ +{ \ + int pix2_inc = 2 * pix_inc; \ + int i, v; \ + \ + for (i=0; i<12; i++) { \ + v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4)>>3;\ + v = pfx##_adjust(v, t); \ + yuv[-pix_inc] = av_clip_uint8(yuv[-pix_inc] + v); \ + yuv[0] = av_clip_uint8(yuv[0] - v); \ + yuv += line_inc; \ + } \ +} + +VP56_EDGE_FILTER(vp5, hor, 1, stride) +VP56_EDGE_FILTER(vp5, ver, stride, 1) +VP56_EDGE_FILTER(vp6, hor, 1, stride) +VP56_EDGE_FILTER(vp6, ver, stride, 1) + +void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec) +{ + if (codec == CODEC_ID_VP5) { + s->edge_filter_hor = vp5_edge_filter_hor; + s->edge_filter_ver = vp5_edge_filter_ver; + } else { + s->edge_filter_hor = vp6_edge_filter_hor; + s->edge_filter_ver = vp6_edge_filter_ver; + } +} diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56dsp.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56dsp.h new file mode 100644 index 000000000..2d6941fa2 --- /dev/null +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp56dsp.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010 Mans Rullgard <mans@mansr.com> + * + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VP56DSP_H +#define AVCODEC_VP56DSP_H + +#include <stdint.h> + +typedef struct VP56DSPContext { + void (*edge_filter_hor)(uint8_t *yuv, int stride, int t); + void (*edge_filter_ver)(uint8_t *yuv, int stride, int t); +} VP56DSPContext; + +void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec); +void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec); + +#endif /* AVCODEC_VP56DSP_H */ diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c index 5a2c07f45..1917e4c0b 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp6.c @@ -1,5 +1,5 @@ /** - * @file libavcodec/vp6.c + * @file * VP6 compatible video decoder * * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> @@ -488,19 +488,6 @@ static void vp6_parse_coeff(VP56Context *s) } } -static int vp6_adjust(int v, int t) -{ - int V = v, s = v >> 31; - V ^= s; - V -= s; - if (V-t-1 >= (unsigned)(t-1)) - return v; - V = 2*t - V; - V += s; - V ^= s; - return V; -} - static int vp6_block_variance(uint8_t *src, int stride) { int sum = 0, square_sum = 0; @@ -599,7 +586,6 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx) avctx->codec->id == CODEC_ID_VP6A); s->vp56_coord_div = vp6_coord_div; s->parse_vector_adjustment = vp6_parse_vector_adjustment; - s->adjust = vp6_adjust; s->filter = vp6_filter; s->default_models_init = vp6_default_models_init; s->parse_vector_models = vp6_parse_vector_models; diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/avutil.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/avutil.h index b2833333b..e149fa89c 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/avutil.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/avutil.h @@ -22,7 +22,7 @@ #define AVUTIL_AVUTIL_H
/**
- * @file libavutil/avutil.h
+ * @file
* external API header
*/
@@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 14
+#define LIBAVUTIL_VERSION_MINOR 15
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -67,6 +67,7 @@ enum AVMediaType { #include "error.h"
#include "mathematics.h"
#include "rational.h"
+#include "intfloat_readwrite.h"
#include "log.h"
#include "pixfmt.h"
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h index fbfc6e3a2..33f271c79 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/bswap.h @@ -19,7 +19,7 @@ */
/**
- * @file libavutil/bswap.h
+ * @file
* byte swapping routines
*/
@@ -35,6 +35,12 @@ # include "x86/bswap.h"
#endif
+#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff))
+#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C(x >> 16))
+#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C(x >> 32))
+
+#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x)
+
#ifndef bswap_16
static av_always_inline av_const uint16_t bswap_16(uint16_t x)
{
@@ -82,6 +88,8 @@ static inline uint64_t av_const bswap_64(uint64_t x) #define le2me_16(x) bswap_16(x)
#define le2me_32(x) bswap_32(x)
#define le2me_64(x) bswap_64(x)
+#define AV_BE2MEC(s, x) (x)
+#define AV_LE2MEC(s, x) AV_BSWAPC(s, x)
#else
#define be2me_16(x) bswap_16(x)
#define be2me_32(x) bswap_32(x)
@@ -89,6 +97,15 @@ static inline uint64_t av_const bswap_64(uint64_t x) #define le2me_16(x) (x)
#define le2me_32(x) (x)
#define le2me_64(x) (x)
+#define AV_BE2MEC(s, x) AV_BSWAPC(s, x)
+#define AV_LE2MEC(s, x) (x)
#endif
+#define AV_BE2ME16C(x) AV_BE2MEC(16, x)
+#define AV_BE2ME32C(x) AV_BE2MEC(32, x)
+#define AV_BE2ME64C(x) AV_BE2MEC(64, x)
+#define AV_LE2ME16C(x) AV_LE2MEC(16, x)
+#define AV_LE2ME32C(x) AV_LE2MEC(32, x)
+#define AV_LE2ME64C(x) AV_LE2MEC(64, x)
+
#endif /* AVUTIL_BSWAP_H */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h index 128c69907..3de7dcfb1 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h @@ -124,8 +124,8 @@ static inline av_const int av_clip(int a, int amin, int amax) */
static inline av_const uint8_t av_clip_uint8(int a)
{
- if (a&(~255)) return (-a)>>31;
- else return a;
+ if (a&(~0xFF)) return (-a)>>31;
+ else return a;
}
/**
@@ -135,8 +135,8 @@ static inline av_const uint8_t av_clip_uint8(int a) */
static inline av_const uint16_t av_clip_uint16(int a)
{
- if (a&(~65535)) return (-a)>>31;
- else return a;
+ if (a&(~0xFFFF)) return (-a)>>31;
+ else return a;
}
/**
@@ -146,8 +146,8 @@ static inline av_const uint16_t av_clip_uint16(int a) */
static inline av_const int16_t av_clip_int16(int a)
{
- if ((a+32768) & ~65535) return (a>>31) ^ 32767;
- else return a;
+ if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
+ else return a;
}
/**
@@ -158,7 +158,7 @@ static inline av_const int16_t av_clip_int16(int a) static inline av_const int32_t av_clipl_int32(int64_t a)
{
if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
- else return a;
+ else return a;
}
/**
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/error.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/error.h index 3096baa9a..eac0fb6ba 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/error.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/error.h @@ -17,7 +17,7 @@ */ /** - * @file libavutil/error.h + * @file * error code definitions */ @@ -43,12 +43,12 @@ #define AVERROR_NOENT AVERROR(ENOENT) ///< No such file or directory #define AVERROR_NOFMT AVERROR(EILSEQ) ///< Unknown format #define AVERROR_NOMEM AVERROR(ENOMEM) ///< Not enough memory +#define AVERROR_NOTSUPP AVERROR(ENOSYS) ///< Operation not supported #define AVERROR_NUMEXPECTED AVERROR(EDOM) ///< Number syntax expected in filename #define AVERROR_UNKNOWN AVERROR(EINVAL) ///< Unknown error #endif #define AVERROR_EOF AVERROR(EPIPE) ///< End of file -#define AVERROR_NOTSUPP AVERROR(ENOSYS) ///< Operation not supported #define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h index 720264ef0..7defd3e18 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/log.h @@ -29,8 +29,7 @@ * arbitrary struct of which the first field is a pointer to an * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). */ -typedef struct AVCLASS AVClass; -struct AVCLASS { +typedef struct { /** * The name of the class; usually it is the same name as the * context structure type to which the AVClass is associated. @@ -49,7 +48,15 @@ struct AVCLASS { * @see av_set_default_options() */ const struct AVOption *option; -}; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added without requiring major + * version bumps everywhere. + */ + + int version; +} AVClass; /* av_log API */ |