From ec5da7aee277e3e5265a632cd4e932e3d5487de7 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 13 Sep 2012 19:40:03 +0100 Subject: [PATCH 1/4] ac3dec: decode directly into output buffers Signed-off-by: Mans Rullgard --- libavcodec/ac3dec.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index fe709defa9..acefe41644 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -188,7 +188,6 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) avctx->coded_frame = &s->frame; for (i = 0; i < AC3_MAX_CHANNELS; i++) { - s->outptr[i] = s->output[i]; s->xcfptr[i] = s->transform_coeffs[i]; s->dlyptr[i] = s->delay[i]; } @@ -607,14 +606,14 @@ static inline void do_imdct(AC3DecodeContext *s, int channels) for (i = 0; i < 128; i++) x[i] = s->transform_coeffs[ch][2 * i]; s->imdct_256.imdct_half(&s->imdct_256, s->tmp_output, x); - s->dsp.vector_fmul_window(s->output[ch - 1], s->delay[ch - 1], + s->dsp.vector_fmul_window(s->outptr[ch - 1], s->delay[ch - 1], s->tmp_output, s->window, 128); for (i = 0; i < 128; i++) x[i] = s->transform_coeffs[ch][2 * i + 1]; s->imdct_256.imdct_half(&s->imdct_256, s->delay[ch - 1], x); } else { s->imdct_512.imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]); - s->dsp.vector_fmul_window(s->output[ch - 1], s->delay[ch - 1], + s->dsp.vector_fmul_window(s->outptr[ch - 1], s->delay[ch - 1], s->tmp_output, s->window, 128); memcpy(s->delay[ch - 1], s->tmp_output + 128, 128 * sizeof(float)); } @@ -1377,17 +1376,31 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, /* decode the audio blocks */ channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; - for (ch = 0; ch < s->out_channels; ch++) - output[ch] = s->output[channel_map[ch]]; + for (ch = 0; ch < s->channels; ch++) { + if (ch < s->out_channels) + s->outptr[channel_map[ch]] = (float *)s->frame.data[ch]; + else + s->outptr[ch] = s->output[ch]; + output[ch] = s->output[ch]; + } for (blk = 0; blk < s->num_blocks; blk++) { if (!err && decode_audio_block(s, blk)) { av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); err = 1; } - for (ch = 0; ch < s->out_channels; ch++) - memcpy(s->frame.data[ch] + blk * 1024, output[ch], 1024); + if (err) + for (ch = 0; ch < s->out_channels; ch++) + memcpy(s->outptr[channel_map[ch]], output[ch], 1024); + for (ch = 0; ch < s->out_channels; ch++) { + output[ch] = s->outptr[channel_map[ch]]; + s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE; + } } + /* keep last block for error concealment in next frame */ + for (ch = 0; ch < s->out_channels; ch++) + memcpy(s->output[ch], output[ch], 1024); + *got_frame_ptr = 1; *(AVFrame *)data = s->frame; From 774e6fc9edecc00eab7a47dacfc9a7b9845b1286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 5 Dec 2012 17:17:20 +0200 Subject: [PATCH 2/4] libvpxenc: Support forcing keyframes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libvpxenc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 9774d5aec4..17b9800f25 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -495,6 +495,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt, struct vpx_image *rawimg = NULL; int64_t timestamp = 0; int res, coded_size; + vpx_enc_frame_flags_t flags = 0; if (frame) { rawimg = &ctx->rawimg; @@ -505,10 +506,12 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt, rawimg->stride[VPX_PLANE_U] = frame->linesize[1]; rawimg->stride[VPX_PLANE_V] = frame->linesize[2]; timestamp = frame->pts; + if (frame->pict_type == AV_PICTURE_TYPE_I) + flags |= VPX_EFLAG_FORCE_KF; } res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp, - avctx->ticks_per_frame, 0, ctx->deadline); + avctx->ticks_per_frame, flags, ctx->deadline); if (res != VPX_CODEC_OK) { log_encoder_error(avctx, "Error encoding frame"); return AVERROR_INVALIDDATA; From d4f8cecc86ea36021b716c3f8ce76a54d7944fc7 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Dec 2012 17:34:14 +0000 Subject: [PATCH 3/4] configure: fix automatic processing of _extralibs in check_deps This fixes the automatic use of $foo_extralibs when feature foo is enabled indirectly through a _select or _suggest. Signed-off-by: Mans Rullgard --- configure | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 3e7356e3c3..882f43c462 100755 --- a/configure +++ b/configure @@ -535,12 +535,13 @@ is_in(){ return 1 } -check_deps(){ +do_check_deps(){ for cfg; do cfg="${cfg#!}" enabled ${cfg}_checking && die "Circular dependency for $cfg." disabled ${cfg}_checking && continue enable ${cfg}_checking + append allopts $cfg eval dep_all="\$${cfg}_deps" eval dep_any="\$${cfg}_deps_any" @@ -550,7 +551,7 @@ check_deps(){ eval dep_ifn="\$${cfg}_if_any" pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn - check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn + do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; } @@ -560,8 +561,6 @@ check_deps(){ disabled_any $dep_sel && disable $cfg if enabled $cfg; then - eval dep_extralibs="\$${cfg}_extralibs" - test -n "$dep_extralibs" && add_extralibs $dep_extralibs enable_deep $dep_sel enable_deep_weak $dep_sgs fi @@ -570,6 +569,18 @@ check_deps(){ done } +check_deps(){ + unset allopts + + do_check_deps "$@" + + for cfg in $allopts; do + enabled $cfg || continue + eval dep_extralibs="\$${cfg}_extralibs" + test -n "$dep_extralibs" && add_extralibs $dep_extralibs + done +} + print_config(){ pfx=$1 files=$2 From 2dd95bd7cfd1acbbac8844739572667f40314b79 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Dec 2012 13:28:44 +0000 Subject: [PATCH 4/4] dsputil: remove unused macro WRAPPER8_16 This macro has never been used. Signed-off-by: Mans Rullgard --- libavcodec/dsputil.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 5640f3abea..f9c89069d5 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -626,12 +626,6 @@ void ff_dsputil_init_dwt(DSPContext *c); # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__) #endif -#define WRAPPER8_16(name8, name16)\ -static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\ - return name8(s, dst , src , stride, h)\ - +name8(s, dst+8 , src+8 , stride, h);\ -} - #define WRAPPER8_16_SQ(name8, name16)\ static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\ int score=0;\