aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-10 02:13:26 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-10 02:16:33 +0100
commit529d3e002642a9901ae463dea0263768dc843173 (patch)
treee022885e2b9c1cee95c30aa2ed53a2ab56831f01 /libavcodec
parenta93369845783a5a63e713c143cab2c550a6ccd82 (diff)
parent2dd95bd7cfd1acbbac8844739572667f40314b79 (diff)
downloadffmpeg-529d3e002642a9901ae463dea0263768dc843173.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: dsputil: remove unused macro WRAPPER8_16 configure: fix automatic processing of _extralibs in check_deps libvpxenc: Support forcing keyframes ac3dec: decode directly into output buffers Conflicts: libavcodec/ac3dec.c libavcodec/libvpxenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ac3dec.c27
-rw-r--r--libavcodec/dsputil.h6
-rw-r--r--libavcodec/libvpxenc.c5
3 files changed, 23 insertions, 15 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 8e27cf7348..50e980bad7 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));
}
@@ -1385,19 +1384,33 @@ 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;
+ }
}
s->frame.decode_error_flags = err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0;
+ /* 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;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 1fef07e6ed..4c900a023e 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -638,12 +638,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;\
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 320f5f81bd..0de11b5448 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -527,8 +527,8 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
VP8Context *ctx = avctx->priv_data;
struct vpx_image *rawimg = NULL;
int64_t timestamp = 0;
- long flags = 0;
int res, coded_size;
+ vpx_enc_frame_flags_t flags = 0;
if (frame) {
rawimg = &ctx->rawimg;
@@ -539,7 +539,8 @@ 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;
- flags = frame->pict_type == AV_PICTURE_TYPE_I ? VPX_EFLAG_FORCE_KF : 0;
+ if (frame->pict_type == AV_PICTURE_TYPE_I)
+ flags |= VPX_EFLAG_FORCE_KF;
}
res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,