summaryrefslogtreecommitdiff
path: root/libavcodec/amrnbdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:36:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-13 11:39:05 +0100
commitd13f434dbb55348b3ed761e4f4c2ff9c7be4ea4b (patch)
tree6591e3d29559c2dacdea43049b128790993be84c /libavcodec/amrnbdec.c
parent4789955ec4260f9e8f99b8d774ada2ad679d5630 (diff)
parente3db34291f4401a16f6ac92721617a9f33cd4c31 (diff)
downloadffmpeg-d13f434dbb55348b3ed761e4f4c2ff9c7be4ea4b.tar.gz
Merge commit 'e3db34291f4401a16f6ac92721617a9f33cd4c31'
* commit 'e3db34291f4401a16f6ac92721617a9f33cd4c31': amrnb: decode directly to the user-provided AVFrame als: decode directly to the user-provided AVFrame alac: decode directly to the user-provided AVFrame adxenc: alloc/free coded_frame instead of keeping it in the ADXContext adx: decode directly to the user-provided AVFrame Conflicts: libavcodec/alsdec.c libavcodec/amrnbdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/amrnbdec.c')
-rw-r--r--libavcodec/amrnbdec.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
index 7399c9ffa4..6e14a60843 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -98,7 +98,6 @@
#define AMR_AGC_ALPHA 0.9
typedef struct AMRContext {
- AVFrame avframe; ///< AVFrame for decoded samples
AMRNBFrame frame; ///< decoded AMR parameters (lsf coefficients, codebook indexes, etc)
uint8_t bad_frame_indicator; ///< bad frame ? 1 : 0
enum Mode cur_frame_mode;
@@ -185,9 +184,6 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx)
for (i = 0; i < 4; i++)
p->prediction_error[i] = MIN_ENERGY;
- avcodec_get_frame_defaults(&p->avframe);
- avctx->coded_frame = &p->avframe;
-
ff_acelp_filter_init(&p->acelpf_ctx);
ff_acelp_vectors_init(&p->acelpv_ctx);
ff_celp_filter_init(&p->celpf_ctx);
@@ -954,6 +950,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
{
AMRContext *p = avctx->priv_data; // pointer to private data
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
float *buf_out; // pointer to the output data buffer
@@ -965,12 +962,12 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
const float *synth_fixed_vector; // pointer to the fixed vector that synthesis should use
/* get output buffer */
- p->avframe.nb_samples = AMR_BLOCK_SIZE;
- if ((ret = ff_get_buffer(avctx, &p->avframe)) < 0) {
+ frame->nb_samples = AMR_BLOCK_SIZE;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- buf_out = (float *)p->avframe.data[0];
+ buf_out = (float *)frame->data[0];
p->cur_frame_mode = unpack_bitstream(p, buf, buf_size);
if (p->cur_frame_mode == NO_DATA) {
@@ -1078,8 +1075,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
p->acelpv_ctx.weighted_vector_sumf(p->lsf_avg, p->lsf_avg, p->lsf_q[3],
0.84, 0.16, LP_FILTER_ORDER);
- *got_frame_ptr = 1;
- *(AVFrame *)data = p->avframe;
+ *got_frame_ptr = 1;
/* return the amount of bytes consumed if everything was OK */
return frame_sizes_nb[p->cur_frame_mode] + 1; // +7 for rounding and +8 for TOC