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

« back to all changes in this revision

Viewing changes to gst-libs/ext/libav/libavcodec/psymodel.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:
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
 
22
#include <string.h>
 
23
 
22
24
#include "avcodec.h"
23
25
#include "psymodel.h"
24
26
#include "iirfilter.h"
 
27
#include "libavutil/mem.h"
25
28
 
26
29
extern const FFPsyModel ff_aac_psy_model;
27
30
 
51
54
    }
52
55
 
53
56
    switch (ctx->avctx->codec_id) {
54
 
    case CODEC_ID_AAC:
 
57
    case AV_CODEC_ID_AAC:
55
58
        ctx->model = &ff_aac_psy_model;
56
59
        break;
57
60
    }
112
115
    return ctx;
113
116
}
114
117
 
115
 
void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx,
116
 
                       const int16_t *audio, int16_t *dest,
117
 
                       int tag, int channels)
 
118
void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int channels)
118
119
{
119
 
    int ch, i;
 
120
    int ch;
 
121
    int frame_size = ctx->avctx->frame_size;
 
122
 
120
123
    if (ctx->fstate) {
121
124
        for (ch = 0; ch < channels; ch++)
122
 
            ff_iir_filter(ctx->fcoeffs, ctx->fstate[tag+ch], ctx->avctx->frame_size,
123
 
                          audio + ch, ctx->avctx->channels,
124
 
                          dest  + ch, ctx->avctx->channels);
125
 
    } else {
126
 
        for (ch = 0; ch < channels; ch++)
127
 
            for (i = 0; i < ctx->avctx->frame_size; i++)
128
 
                dest[i*ctx->avctx->channels + ch] = audio[i*ctx->avctx->channels + ch];
 
125
            ff_iir_filter_flt(ctx->fcoeffs, ctx->fstate[ch], frame_size,
 
126
                              &audio[ch][frame_size], 1, &audio[ch][frame_size], 1);
129
127
    }
130
128
}
131
129
 
139
137
    av_freep(&ctx->fstate);
140
138
    av_free(ctx);
141
139
}
142