summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-03-12 17:55:59 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-03-12 17:55:59 +0100
commit27efa296c217dcd9d55354395e4f41991b7cc131 (patch)
treeb9da73fee575598cccc7d486bdeabdb58e7f7971 /libavcodec
parent3efbbbb5094a146efeb1f0613918ea97d31d00d2 (diff)
parent0215006ab75be1f49fa8eacf2c6d3c1bd22edfc7 (diff)
Merge branch 'master' of git://git.ffmpeg.org/ffmpeg
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/Makefile7
-rw-r--r--libavcodec/avcodec.h5
-rw-r--r--libavcodec/vc1dec.c23
-rw-r--r--libavcodec/vp8.c7
-rw-r--r--libavcodec/vp8.h159
-rw-r--r--libavcodec/x86/Makefile6
6 files changed, 112 insertions, 95 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 2a2197d1fb..eefe60c772 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -26,6 +26,7 @@ OBJS = allcodecs.o \
# parts needed for many different codecs
OBJS-$(CONFIG_AANDCT) += aandcttab.o
+OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
OBJS-$(CONFIG_DCT) += dct.o
@@ -56,10 +57,8 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \
mpeg4audio.o
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o
-OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3tab.o ac3.o \
- ac3dsp.o
-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3.o \
- ac3dsp.o
+OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3tab.o ac3.o
+OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3.o
OBJS-$(CONFIG_ALAC_DECODER) += alac.o
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3e85567982..3ea1e76989 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2323,6 +2323,11 @@ typedef struct AVCodecContext {
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_CAVLC_444 44
+#define FF_PROFILE_VC1_SIMPLE 0
+#define FF_PROFILE_VC1_MAIN 1
+#define FF_PROFILE_VC1_COMPLEX 2
+#define FF_PROFILE_VC1_ADVANCED 3
+
/**
* level
* - encoding: Set by user.
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index b27b6d01c1..1a437a892a 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -3098,6 +3098,10 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
return -1;
}
}
+ avctx->profile = v->profile;
+ if (v->profile == PROFILE_ADVANCED)
+ avctx->level = v->level;
+
avctx->has_b_frames= !!(avctx->max_b_frames);
s->low_delay = !avctx->has_b_frames;
@@ -3345,6 +3349,13 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx)
return 0;
}
+static const AVProfile profiles[] = {
+ { FF_PROFILE_VC1_SIMPLE, "Simple" },
+ { FF_PROFILE_VC1_MAIN, "Main" },
+ { FF_PROFILE_VC1_COMPLEX, "Complex" },
+ { FF_PROFILE_VC1_ADVANCED, "Advanced" },
+ { FF_PROFILE_UNKNOWN },
+};
AVCodec ff_vc1_decoder = {
"vc1",
@@ -3358,7 +3369,8 @@ AVCodec ff_vc1_decoder = {
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
NULL,
.long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
- .pix_fmts = ff_hwaccel_pixfmt_list_420
+ .pix_fmts = ff_hwaccel_pixfmt_list_420,
+ .profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#if CONFIG_WMV3_DECODER
@@ -3374,7 +3386,8 @@ AVCodec ff_wmv3_decoder = {
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
NULL,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
- .pix_fmts = ff_hwaccel_pixfmt_list_420
+ .pix_fmts = ff_hwaccel_pixfmt_list_420,
+ .profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#endif
@@ -3391,7 +3404,8 @@ AVCodec ff_wmv3_vdpau_decoder = {
CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
NULL,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"),
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE}
+ .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE},
+ .profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#endif
@@ -3408,6 +3422,7 @@ AVCodec ff_vc1_vdpau_decoder = {
CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
NULL,
.long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"),
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE}
+ .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE},
+ .profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#endif
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index f71a7b7783..42f401d2b1 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -474,7 +474,7 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
enum { EDGE_TOP, EDGE_LEFT, EDGE_TOPLEFT };
int idx = CNT_ZERO;
int cur_sign_bias = s->sign_bias[mb->ref_frame];
- int *sign_bias = s->sign_bias;
+ int8_t *sign_bias = s->sign_bias;
VP56mv near_mv[4];
uint8_t cnt[4] = { 0 };
VP56RangeCoder *c = &s->c;
@@ -640,7 +640,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
* otherwise, the index of the last coeff decoded plus one
*/
static int decode_block_coeffs_internal(VP56RangeCoder *c, DCTELEM block[16],
- uint8_t probs[8][3][NUM_DCT_TOKENS-1],
+ uint8_t probs[16][3][NUM_DCT_TOKENS-1],
int i, uint8_t *token_prob, int16_t qmul[2])
{
goto skip_eob;
@@ -1282,7 +1282,7 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo
s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
nnz4 >>= 8;
if (!nnz4)
- break;
+ goto chroma_idct_end;
}
ch_dst += 4*s->uvlinesize;
}
@@ -1290,6 +1290,7 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo
s->vp8dsp.vp8_idct_dc_add4uv(ch_dst, s->block[4+ch], s->uvlinesize);
}
}
+chroma_idct_end: ;
}
}
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index d3b8705ea0..2db056f073 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -85,83 +85,24 @@ typedef struct {
typedef struct {
AVCodecContext *avctx;
- DSPContext dsp;
- VP8DSPContext vp8dsp;
- H264PredContext hpc;
- vp8_mc_func put_pixels_tab[3][3][3];
- AVFrame frames[4];
AVFrame *framep[4];
uint8_t *edge_emu_buffer;
- VP56RangeCoder c; ///< header context, includes mb modes and motion vectors
- int profile;
- int mb_width; /* number of horizontal MB */
- int mb_height; /* number of vertical MB */
+ uint16_t mb_width; /* number of horizontal MB */
+ uint16_t mb_height; /* number of vertical MB */
int linesize;
int uvlinesize;
- int keyframe;
- int invisible;
- int update_last; ///< update VP56_FRAME_PREVIOUS with the current one
- int update_golden; ///< VP56_FRAME_NONE if not updated, or which frame to copy if so
- int update_altref;
- int deblock_filter;
-
- /**
- * If this flag is not set, all the probability updates
- * are discarded after this frame is decoded.
- */
- int update_probabilities;
-
- /**
- * All coefficients are contained in separate arith coding contexts.
- * There can be 1, 2, 4, or 8 of these after the header context.
- */
- int num_coeff_partitions;
- VP56RangeCoder coeff_partition[8];
-
- VP8Macroblock *macroblocks;
- VP8Macroblock *macroblocks_base;
- VP8FilterStrength *filter_strength;
-
- uint8_t *intra4x4_pred_mode_top;
- uint8_t intra4x4_pred_mode_left[4];
- uint8_t *segmentation_map;
-
- /**
- * Cache of the top row needed for intra prediction
- * 16 for luma, 8 for each chroma plane
- */
- uint8_t (*top_border)[16+8+8];
-
- /**
- * For coeff decode, we need to know whether the above block had non-zero
- * coefficients. This means for each macroblock, we need data for 4 luma
- * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
- * per macroblock. We keep the last row in top_nnz.
- */
- uint8_t (*top_nnz)[9];
- DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
-
- /**
- * This is the index plus one of the last non-zero coeff
- * for each of the blocks in the current macroblock.
- * So, 0 -> no coeffs
- * 1 -> dc-only (special transform)
- * 2+-> full transform
- */
- DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
- DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
- DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
- uint8_t intra4x4_pred_mode_mb[16];
-
- int chroma_pred_mode; ///< 8x8c pred mode of the current macroblock
- int segment; ///< segment of the current macroblock
+ uint8_t keyframe;
+ uint8_t deblock_filter;
+ uint8_t mbskip_enabled;
+ uint8_t segment; ///< segment of the current macroblock
+ uint8_t chroma_pred_mode; ///< 8x8c pred mode of the current macroblock
+ uint8_t profile;
VP56mv mv_min;
VP56mv mv_max;
- int mbskip_enabled;
- int sign_bias[4]; ///< one state [0, 1] per ref frame type
+ int8_t sign_bias[4]; ///< one state [0, 1] per ref frame type
int ref_count[3];
/**
@@ -170,13 +111,26 @@ typedef struct {
* a frame, since the values persist between interframes.
*/
struct {
- int enabled;
- int absolute_vals;
- int update_map;
+ uint8_t enabled;
+ uint8_t absolute_vals;
+ uint8_t update_map;
int8_t base_quant[4];
int8_t filter_level[4]; ///< base loop filter level
} segmentation;
+ struct {
+ uint8_t simple;
+ uint8_t level;
+ uint8_t sharpness;
+ } filter;
+
+ VP8Macroblock *macroblocks;
+ VP8FilterStrength *filter_strength;
+
+ uint8_t *intra4x4_pred_mode_top;
+ uint8_t intra4x4_pred_mode_left[4];
+ uint8_t *segmentation_map;
+
/**
* Macroblocks can have one of 4 different quants in a frame when
* segmentation is enabled.
@@ -190,13 +144,7 @@ typedef struct {
} qmat[4];
struct {
- int simple;
- int level;
- int sharpness;
- } filter;
-
- struct {
- int enabled; ///< whether each mb can have a different strength based on mode/ref
+ uint8_t enabled; ///< whether each mb can have a different strength based on mode/ref
/**
* filter strength adjustment for the following macroblock modes:
@@ -220,6 +168,34 @@ typedef struct {
} lf_delta;
/**
+ * Cache of the top row needed for intra prediction
+ * 16 for luma, 8 for each chroma plane
+ */
+ uint8_t (*top_border)[16+8+8];
+
+ /**
+ * For coeff decode, we need to know whether the above block had non-zero
+ * coefficients. This means for each macroblock, we need data for 4 luma
+ * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
+ * per macroblock. We keep the last row in top_nnz.
+ */
+ uint8_t (*top_nnz)[9];
+ DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
+
+ /**
+ * This is the index plus one of the last non-zero coeff
+ * for each of the blocks in the current macroblock.
+ * So, 0 -> no coeffs
+ * 1 -> dc-only (special transform)
+ * 2+-> full transform
+ */
+ DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
+ VP56RangeCoder c; ///< header context, includes mb modes and motion vectors
+ DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
+ DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
+ uint8_t intra4x4_pred_mode_mb[16];
+
+ /**
* These are all of the updatable probabilities for binary decisions.
* They are only implictly reset on keyframes, making it quite likely
* for an interframe to desync if a prior frame's header was corrupt
@@ -233,10 +209,33 @@ typedef struct {
uint8_t golden;
uint8_t pred16x16[4];
uint8_t pred8x8c[3];
- /* Padded to allow overreads */
- uint8_t token[4][17][3][NUM_DCT_TOKENS-1];
+ uint8_t token[4][16][3][NUM_DCT_TOKENS-1];
uint8_t mvc[2][19];
} prob[2];
+
+ VP8Macroblock *macroblocks_base;
+ int invisible;
+ int update_last; ///< update VP56_FRAME_PREVIOUS with the current one
+ int update_golden; ///< VP56_FRAME_NONE if not updated, or which frame to copy if so
+ int update_altref;
+
+ /**
+ * If this flag is not set, all the probability updates
+ * are discarded after this frame is decoded.
+ */
+ int update_probabilities;
+
+ /**
+ * All coefficients are contained in separate arith coding contexts.
+ * There can be 1, 2, 4, or 8 of these after the header context.
+ */
+ int num_coeff_partitions;
+ VP56RangeCoder coeff_partition[8];
+ DSPContext dsp;
+ VP8DSPContext vp8dsp;
+ H264PredContext hpc;
+ vp8_mc_func put_pixels_tab[3][3][3];
+ AVFrame frames[4];
} VP8Context;
#endif
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 1b58fa121f..f8d456d3ea 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -17,10 +17,8 @@ MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o
-MMX-OBJS-$(CONFIG_AC3_ENCODER) += x86/ac3dsp_mmx.o
-MMX-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += x86/ac3dsp_mmx.o
-YASM-OBJS-$(CONFIG_AC3_ENCODER) += x86/ac3dsp.o
-YASM-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += x86/ac3dsp.o
+MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_mmx.o
+YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o
MMX-OBJS-$(CONFIG_MP1FLOAT_DECODER) += x86/mpegaudiodec_mmx.o
MMX-OBJS-$(CONFIG_MP2FLOAT_DECODER) += x86/mpegaudiodec_mmx.o