1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Merge branch 'master' of git://git.ffmpeg.org/ffmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-03-12 17:55:59 +01:00
commit 27efa296c2
8 changed files with 180 additions and 138 deletions

88
configure vendored
View File

@ -357,6 +357,16 @@ set_weak(){
done
}
set_safe(){
var=$1
shift
eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
}
get_safe(){
eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
}
pushvar(){
for var in $*; do
eval level=\${${var}_level:=0}
@ -700,20 +710,17 @@ EOF
check_func_headers(){
log check_func_headers "$@"
headers=$1
func=$2
funcs=$2
shift 2
disable $func
incs=""
for hdr in $headers; do
incs="$incs
#include <$hdr>"
done
check_ld "$@" <<EOF && enable $func && enable_safe $headers
$incs
int main(int argc, char **argv){
return (long) $func;
}
EOF
{
for hdr in $headers; do
echo "#include <$hdr>"
done
for func in $funcs; do
echo "long check_$func(void) { return (long) $func; }"
done
echo "int main(void) { return 0; }"
} | check_ld "$@" && enable $funcs && enable_safe $headers
}
check_cpp_condition(){
@ -740,9 +747,23 @@ check_lib(){
check_lib2(){
log check_lib2 "$@"
headers="$1"
func="$2"
funcs="$2"
shift 2
check_func_headers "$headers" $func "$@" && add_extralibs "$@"
check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
}
check_pkg_config(){
log check_pkg_config "$@"
pkg="$1"
headers="$2"
funcs="$3"
shift 3
$pkg_config --exists $pkg || return
pkg_cflags=$($pkg_config --cflags $pkg)
pkg_libs=$($pkg_config --libs $pkg)
check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
set_safe ${pkg}_cflags $pkg_cflags &&
set_safe ${pkg}_libs $pkg_libs
}
check_exec(){
@ -826,6 +847,13 @@ require2(){
check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
}
require_pkg_config(){
pkg="$1"
check_pkg_config "$@" || die "ERROR: $pkg not found"
add_cflags $(get_safe ${pkg}_cflags)
add_extralibs $(get_safe ${pkg}_libs)
}
check_host_cc(){
log check_host_cc "$@"
cat > $TMPC
@ -872,6 +900,7 @@ COMPONENT_LIST="
CONFIG_LIST="
$COMPONENT_LIST
aandct
ac3dsp
avcodec
avdevice
avfilter
@ -1151,6 +1180,7 @@ CMDLINE_SET="
logfile
malloc_prefix
nm
pkg_config
samples
source_path
strip
@ -1212,7 +1242,8 @@ aac_decoder_select="mdct rdft"
aac_encoder_select="mdct"
aac_latm_decoder_select="aac_decoder aac_latm_parser"
ac3_decoder_select="mdct ac3_parser"
ac3_encoder_select="mdct"
ac3_encoder_select="mdct ac3dsp"
ac3_fixed_encoder_select="ac3dsp"
alac_encoder_select="lpc"
amrnb_decoder_select="lsp"
amrwb_decoder_select="lsp"
@ -1588,6 +1619,7 @@ host_cc_default="gcc"
ln_s="ln -sf"
nm_default="nm"
objformat="elf"
pkg_config_default=pkg-config
ranlib="ranlib"
strip_default="strip"
yasmexe="yasm"
@ -1797,12 +1829,13 @@ set_default arch target_os
ar_default="${cross_prefix}${ar_default}"
cc_default="${cross_prefix}${cc_default}"
nm_default="${cross_prefix}${nm_default}"
pkg_config_default="${cross_prefix}${pkg_config_default}"
ranlib="${cross_prefix}${ranlib}"
strip_default="${cross_prefix}${strip_default}"
sysinclude_default="${sysroot}/usr/include"
set_default cc nm strip sysinclude
set_default cc nm pkg_config strip sysinclude
enabled cross_compile || host_cc_default=$cc
set_default host_cc
@ -2835,9 +2868,9 @@ check_mathfunc truncf
# these are off by default, so fail if requested and not available
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
enabled libdirac && require_pkg_config dirac \
"libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
"dirac_decoder_init dirac_encoder_init"
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
enabled libfreetype && add_cflags $(pkg-config --cflags freetype2) && require libfreetype ft2build.h FT_Init_FreeType -lfreetype
enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
@ -2845,13 +2878,10 @@ enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_q
enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
enabled libopencv && { check_lib opencv/cv.h cvCreateImageHeader $(pkg-config --libs opencv) ||
die "ERROR: libopencv not found"; }
enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; }
enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
@ -2876,11 +2906,7 @@ if enabled libdc1394; then
die "ERROR: No version of libdc1394 found "
fi
SDL_CONFIG="${cross_prefix}sdl-config"
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
sdl_cflags=$("${SDL_CONFIG}" --cflags)
sdl_libs=$("${SDL_CONFIG}" --libs)
check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
if check_pkg_config sdl SDL.h SDL_Init; then
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
enable sdl &&
check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size

View File

@ -520,7 +520,6 @@ static int ffmpeg_exit(int ret)
/* close files */
for(i=0;i<nb_output_files;i++) {
AVFormatContext *s = output_files[i];
int j;
if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
avio_close(s->pb);
avformat_free_context(s);

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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: ;
}
}

View File

@ -85,49 +85,88 @@ 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;
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;
int8_t sign_bias[4]; ///< one state [0, 1] per ref frame type
int ref_count[3];
/**
* If this flag is not set, all the probability updates
* are discarded after this frame is decoded.
* Base parameters for segmentation, i.e. per-macroblock parameters.
* These must be kept unchanged even if segmentation is not used for
* a frame, since the values persist between interframes.
*/
int update_probabilities;
struct {
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;
/**
* 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];
struct {
uint8_t simple;
uint8_t level;
uint8_t sharpness;
} filter;
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;
/**
* Macroblocks can have one of 4 different quants in a frame when
* segmentation is enabled.
* If segmentation is disabled, only the first segment's values are used.
*/
struct {
// [0] - DC qmul [1] - AC qmul
int16_t luma_qmul[2];
int16_t luma_dc_qmul[2]; ///< luma dc-only block quant
int16_t chroma_qmul[2];
} qmat[4];
struct {
uint8_t enabled; ///< whether each mb can have a different strength based on mode/ref
/**
* filter strength adjustment for the following macroblock modes:
* [0-3] - i16x16 (always zero)
* [4] - i4x4
* [5] - zero mv
* [6] - inter modes except for zero or split mv
* [7] - split mv
* i16x16 modes never have any adjustment
*/
int8_t mode[VP8_MVMODE_SPLIT+1];
/**
* filter strength adjustment for macroblocks that reference:
* [0] - intra / VP56_FRAME_CURRENT
* [1] - VP56_FRAME_PREVIOUS
* [2] - VP56_FRAME_GOLDEN
* [3] - altref / VP56_FRAME_GOLDEN2
*/
int8_t ref[4];
} lf_delta;
/**
* Cache of the top row needed for intra prediction
* 16 for luma, 8 for each chroma plane
@ -151,74 +190,11 @@ typedef struct {
* 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];
int chroma_pred_mode; ///< 8x8c pred mode of the current macroblock
int segment; ///< segment of the current macroblock
VP56mv mv_min;
VP56mv mv_max;
int mbskip_enabled;
int sign_bias[4]; ///< one state [0, 1] per ref frame type
int ref_count[3];
/**
* Base parameters for segmentation, i.e. per-macroblock parameters.
* These must be kept unchanged even if segmentation is not used for
* a frame, since the values persist between interframes.
*/
struct {
int enabled;
int absolute_vals;
int update_map;
int8_t base_quant[4];
int8_t filter_level[4]; ///< base loop filter level
} segmentation;
/**
* Macroblocks can have one of 4 different quants in a frame when
* segmentation is enabled.
* If segmentation is disabled, only the first segment's values are used.
*/
struct {
// [0] - DC qmul [1] - AC qmul
int16_t luma_qmul[2];
int16_t luma_dc_qmul[2]; ///< luma dc-only block quant
int16_t chroma_qmul[2];
} 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
/**
* filter strength adjustment for the following macroblock modes:
* [0-3] - i16x16 (always zero)
* [4] - i4x4
* [5] - zero mv
* [6] - inter modes except for zero or split mv
* [7] - split mv
* i16x16 modes never have any adjustment
*/
int8_t mode[VP8_MVMODE_SPLIT+1];
/**
* filter strength adjustment for macroblocks that reference:
* [0] - intra / VP56_FRAME_CURRENT
* [1] - VP56_FRAME_PREVIOUS
* [2] - VP56_FRAME_GOLDEN
* [3] - altref / VP56_FRAME_GOLDEN2
*/
int8_t ref[4];
} lf_delta;
/**
* These are all of the updatable probabilities for binary decisions.
* They are only implictly reset on keyframes, making it quite likely
@ -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

View File

@ -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