~ubuntu-branches/ubuntu/trusty/libav/trusty-proposed

« back to all changes in this revision

Viewing changes to libavcodec/lpc.h

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2013-10-22 23:24:08 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131022232408-b8tvvn4pyzri9mi3
Tags: 6:9.10-1ubuntu1
* Build all -extra flavors from this source package, as libav got demoted
  from main to universe, cf LP: #1243235
* Simplify debian/rules to follow exactly the code that debian executes
* New upstream (LP: #1180288) fixes lots of security issues (LP: #1242802)
* Merge from unstable, remaining changes:
  - build-depend on libtiff5-dev rather than libtiff4-dev,
    avoids FTBFS caused by imlib
  - follow the regular debian codepaths

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
 
1
/*
2
2
 * LPC utility code
3
3
 * Copyright (c) 2006  Justin Ruggles <justin.ruggles@gmail.com>
4
4
 *
51
51
    int blocksize;
52
52
    int max_order;
53
53
    enum FFLPCType lpc_type;
 
54
    double *windowed_buffer;
54
55
    double *windowed_samples;
55
56
 
56
57
    /**
91
92
                      enum FFLPCType lpc_type, int lpc_passes,
92
93
                      int omethod, int max_shift, int zero_shift);
93
94
 
 
95
int ff_lpc_calc_ref_coefs(LPCContext *s,
 
96
                          const int32_t *samples, int order, double *ref);
 
97
 
94
98
/**
95
99
 * Initialize LPCContext.
96
100
 */
110
114
#endif
111
115
 
112
116
/**
 
117
 * Schur recursion.
 
118
 * Produces reflection coefficients from autocorrelation data.
 
119
 */
 
120
static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order,
 
121
                                     LPC_TYPE *ref, LPC_TYPE *error)
 
122
{
 
123
    int i, j;
 
124
    LPC_TYPE err;
 
125
    LPC_TYPE gen0[MAX_LPC_ORDER], gen1[MAX_LPC_ORDER];
 
126
 
 
127
    for (i = 0; i < max_order; i++)
 
128
        gen0[i] = gen1[i] = autoc[i + 1];
 
129
 
 
130
    err    = autoc[0];
 
131
    ref[0] = -gen1[0] / err;
 
132
    err   +=  gen1[0] * ref[0];
 
133
    if (error)
 
134
        error[0] = err;
 
135
    for (i = 1; i < max_order; i++) {
 
136
        for (j = 0; j < max_order - i; j++) {
 
137
            gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j];
 
138
            gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j];
 
139
        }
 
140
        ref[i] = -gen1[0] / err;
 
141
        err   +=  gen1[0] * ref[i];
 
142
        if (error)
 
143
            error[i] = err;
 
144
    }
 
145
}
 
146
 
 
147
/**
113
148
 * Levinson-Durbin recursion.
114
149
 * Produce LPC coefficients from autocorrelation data.
115
150
 */