~ubuntu-branches/ubuntu/saucy/gst-libav1.0/saucy-proposed

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavcodec/sipr.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-07-30 09:00:15 UTC
  • mfrom: (1.1.16) (7.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20130730090015-sc1ou2yssu7q5w4e
Tags: 1.1.3-1
* New upstream development snapshot:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.1.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <stdint.h>
26
26
#include <string.h>
27
27
 
 
28
#include "libavutil/channel_layout.h"
28
29
#include "libavutil/mathematics.h"
29
30
#include "avcodec.h"
30
31
#define BITSTREAM_READER_LE
31
32
#include "get_bits.h"
32
33
#include "dsputil.h"
 
34
#include "internal.h"
33
35
 
34
36
#include "lsp.h"
35
 
#include "celp_math.h"
36
37
#include "acelp_vectors.h"
37
38
#include "acelp_pitch_delay.h"
38
39
#include "acelp_filters.h"
411
412
                              SUBFR_SIZE);
412
413
 
413
414
        avg_energy =
414
 
            (0.01 + ff_dot_productf(fixed_vector, fixed_vector, SUBFR_SIZE))/
 
415
            (0.01 + ff_scalarproduct_float_c(fixed_vector, fixed_vector, SUBFR_SIZE)) /
415
416
                SUBFR_SIZE;
416
417
 
417
418
        ctx->past_pitch_gain = pitch_gain = gain_cb[params->gc_index[i]][0];
453
454
 
454
455
    if (ctx->mode == MODE_5k0) {
455
456
        for (i = 0; i < subframe_count; i++) {
456
 
            float energy = ff_dot_productf(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
457
 
                                           ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
458
 
                                           SUBFR_SIZE);
 
457
            float energy = ff_scalarproduct_float_c(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
 
458
                                                    ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
 
459
                                                    SUBFR_SIZE);
459
460
            ff_adaptive_gain_control(&synth[i * SUBFR_SIZE],
460
461
                                     &synth[i * SUBFR_SIZE], energy,
461
462
                                     SUBFR_SIZE, 0.9, &ctx->postfilter_agc);
510
511
    for (i = 0; i < 4; i++)
511
512
        ctx->energy_history[i] = -14;
512
513
 
513
 
    avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
 
514
    avctx->channels       = 1;
 
515
    avctx->channel_layout = AV_CH_LAYOUT_MONO;
 
516
    avctx->sample_fmt     = AV_SAMPLE_FMT_FLT;
514
517
 
515
518
    avcodec_get_frame_defaults(&ctx->frame);
516
519
    avctx->coded_frame = &ctx->frame;
541
544
    /* get output buffer */
542
545
    ctx->frame.nb_samples = mode_par->frames_per_packet * subframe_size *
543
546
                            mode_par->subframe_count;
544
 
    if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
 
547
    if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
545
548
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
546
549
        return ret;
547
550
    }
566
569
AVCodec ff_sipr_decoder = {
567
570
    .name           = "sipr",
568
571
    .type           = AVMEDIA_TYPE_AUDIO,
569
 
    .id             = CODEC_ID_SIPR,
 
572
    .id             = AV_CODEC_ID_SIPR,
570
573
    .priv_data_size = sizeof(SiprContext),
571
574
    .init           = sipr_decoder_init,
572
575
    .decode         = sipr_decode_frame,
573
576
    .capabilities   = CODEC_CAP_DR1,
574
 
    .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
 
577
    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
575
578
};