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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2013-09-24 17:07:00 UTC
  • mfrom: (1.1.17) (7.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20130924170700-4dg62s3pwl0pdakz
Tags: 1.2.0-1
* New upstream stable release:
  + debian/control:
    - Build depend on GStreamer and gst-plugins-base >= 1.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
21
 */
22
22
 
 
23
#include "libavutil/common.h"
23
24
#include "libavutil/mathematics.h"
24
25
#include "avcodec.h"
25
26
#include "dsputil.h"
85
86
    if(erasure)
86
87
        quant_energy[0] = FFMAX(avg_gain >> log2_ma_pred_order, -10240) - 4096; // -10 and -4 in (5.10)
87
88
    else
88
 
        quant_energy[0] = (6165 * ((ff_log2(gain_corr_factor) >> 2) - (13 << 13))) >> 13;
 
89
        quant_energy[0] = (6165 * ((ff_log2_q15(gain_corr_factor) >> 2) - (13 << 13))) >> 13;
89
90
}
90
91
 
91
92
int16_t ff_acelp_decode_gain_code(
106
107
        mr_energy += quant_energy[i] * ma_prediction_coeff[i];
107
108
 
108
109
    mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) /
109
 
                sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0));
 
110
                sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size));
110
111
    return mr_energy >> 12;
111
112
}
112
113
 
119
120
    // Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)).
120
121
    float val = fixed_gain_factor *
121
122
        exp2f(M_LOG2_10 * 0.05 *
122
 
              (ff_dot_productf(pred_table, prediction_error, 4) +
 
123
              (ff_scalarproduct_float_c(pred_table, prediction_error, 4) +
123
124
               energy_mean)) /
124
125
        sqrtf(fixed_mean_energy);
125
126