From edaf1ae2763ce1a23dec70e730ba2bb8ee476dfd Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 7 Mar 2011 02:49:55 +0000 Subject: [PATCH 01/10] configure: allow checking multiple functions in check_func_headers() This makes it possible to pass a space-separated list of functions to check_func_headers and check_lib2. If any function is missing, none are enabled as available, so this should only be used for all-or-nothing sets, i.e. groups in which none will be used if any one is missing. Signed-off-by: Mans Rullgard --- configure | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 04f6e13211..ebeea1853d 100755 --- a/configure +++ b/configure @@ -699,20 +699,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 "$@" <" + 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(){ @@ -739,9 +736,9 @@ 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_exec(){ From 3f8040db3e13c3dbdf07c74d92ca34817a69f733 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 6 Mar 2011 13:48:30 +0000 Subject: [PATCH 02/10] configure: improve pkg-config support This adds helper functions for checking packages with pkg-config and managing the associated flags. Note that pkg-config use is still discouraged due to widespread poor practices resulting in broken flags in many situations. A few badly designed packages require flags only obtainable using pkg-config, and these functions are intended for those cases. Signed-off-by: Mans Rullgard --- configure | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/configure b/configure index ebeea1853d..72b57cdf7f 100755 --- a/configure +++ b/configure @@ -356,6 +356,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} @@ -741,6 +751,20 @@ check_lib2(){ 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(){ check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } } @@ -822,6 +846,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 @@ -1144,6 +1175,7 @@ CMDLINE_SET=" logfile malloc_prefix nm + pkg_config samples source_path strip @@ -1571,6 +1603,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" @@ -1780,12 +1813,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 From 4fa18c5666de24316710df670e44d4850e0796a7 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 6 Mar 2011 13:50:21 +0000 Subject: [PATCH 03/10] configure: use pkg-config helpers This makes existing pkg-config uses as well as the libsdl checks use the new pkg-config helper functions, which should be more robust against broken systems. Signed-off-by: Mans Rullgard --- configure | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 72b57cdf7f..58610bf45c 100755 --- a/configure +++ b/configure @@ -2849,22 +2849,19 @@ 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 libgsm && require libgsm gsm/gsm.h gsm_create -lgsm enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame 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 @@ -2889,11 +2886,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 From a5444fee06e9d14637396b4237d0204187a076e0 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 11 Mar 2011 23:37:00 +0000 Subject: [PATCH 04/10] Add CONFIG_AC3DSP symbol to simplify makefiles Signed-off-by: Mans Rullgard --- configure | 4 +++- libavcodec/Makefile | 7 +++---- libavcodec/x86/Makefile | 6 ++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 58610bf45c..4d308d2abd 100755 --- a/configure +++ b/configure @@ -899,6 +899,7 @@ COMPONENT_LIST=" CONFIG_LIST=" $COMPONENT_LIST aandct + ac3dsp avcodec avdevice avfilter @@ -1237,7 +1238,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" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 930affbb7a..e116a7d01c 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_ENCODERS) += faandct.o jfdctfst.o jfdctint.o OBJS-$(CONFIG_DCT) += dct.o OBJS-$(CONFIG_DWT) += dwt.o @@ -55,10 +56,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/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 From 628b48db85dae7ad212a63dafcd6a3bf8d8e93f3 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 9 Mar 2011 13:46:23 -0800 Subject: [PATCH 05/10] VP8: use a goto to break out of two loops A break statement was supposed to break out of two loops, but only broke out of one. Didn't affect output, just could have been marginally slower. --- libavcodec/vp8.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index f71a7b7783..14d3df528b 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -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: ; } } From b1d2f812c9c581d38fe7c93a4ea24430fedc89f1 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 9 Mar 2011 19:54:05 -0800 Subject: [PATCH 06/10] VP8: token probs doesn't need padding prob[0] is the only prob array ever accessed, so prob[1] can serve as padding for prob[0]. --- libavcodec/vp8.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h index d3b8705ea0..b94d453bef 100644 --- a/libavcodec/vp8.h +++ b/libavcodec/vp8.h @@ -233,8 +233,7 @@ 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]; } VP8Context; From 3efbe137396d39e225315a9d1e4bf82d1a9c92e5 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 9 Mar 2011 19:53:52 -0800 Subject: [PATCH 07/10] VP8: fix function declaration --- libavcodec/vp8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 14d3df528b..de077c8886 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.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; From 1eeca88691ad0fd232f110f3a389ebb494c0a6dc Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Fri, 11 Mar 2011 13:43:10 -0800 Subject: [PATCH 08/10] VP8: optimize VP8Context struct ordering Shaves at least 3KB off code size on x86, should improve cache utilization. This would probably be useful to do for other decoders/encoders as well. --- libavcodec/vp8.c | 2 +- libavcodec/vp8.h | 178 +++++++++++++++++++++++------------------------ 2 files changed, 90 insertions(+), 90 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index de077c8886..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; diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h index b94d453bef..2db056f073 100644 --- a/libavcodec/vp8.h +++ b/libavcodec/vp8.h @@ -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 @@ -236,6 +212,30 @@ typedef struct { 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 From 5dbe78bf91112b61ee6948c275d6bcf87b68251f Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 12 Mar 2011 11:17:52 +0000 Subject: [PATCH 09/10] ffmpeg: remove unused variable in ffmpeg_exit() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the warning: ffmpeg.c: In function ‘ffmpeg_exit’: ffmpeg.c:509: warning: unused variable ‘j’ Signed-off-by: Mans Rullgard --- ffmpeg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 7f909563cd..cb81368209 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -506,7 +506,6 @@ static int ffmpeg_exit(int ret) /* close files */ for(i=0;ioformat->flags & AVFMT_NOFILE) && s->pb) avio_close(s->pb); avformat_free_context(s); From 0215006ab75be1f49fa8eacf2c6d3c1bd22edfc7 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 11 Mar 2011 23:12:04 +0100 Subject: [PATCH 10/10] VC1: Export profile/level Signed-off-by: Mans Rullgard --- libavcodec/avcodec.h | 5 +++++ libavcodec/vc1dec.c | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index d323e6635e..12cca6ff97 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2314,6 +2314,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