~ubuntu-branches/ubuntu/karmic/asterisk/karmic

« back to all changes in this revision

Viewing changes to codecs/lpc10/deemp.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2002-04-27 21:19:32 UTC
  • Revision ID: james.westby@ubuntu.com-20020427211932-kqaertc4bg7ss5mc
Tags: upstream-0.1.11
ImportĀ upstreamĀ versionĀ 0.1.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
$Log: deemp.c,v $
 
4
Revision 1.2  2000/01/05 08:20:39  markster
 
5
Some OSS fixes and a few lpc changes to make it actually work
 
6
 
 
7
 * Revision 1.2  1996/08/20  20:23:46  jaf
 
8
 * Removed all static local variables that were SAVE'd in the Fortran
 
9
 * code, and put them in struct lpc10_decoder_state that is passed as an
 
10
 * argument.
 
11
 *
 
12
 * Removed init function, since all initialization is now done in
 
13
 * init_lpc10_decoder_state().
 
14
 *
 
15
 * Revision 1.1  1996/08/19  22:32:34  jaf
 
16
 * Initial revision
 
17
 *
 
18
 
 
19
*/
 
20
 
 
21
#ifdef P_R_O_T_O_T_Y_P_E_S
 
22
extern int deemp_(real *x, integer *n, struct lpc10_decoder_state *st);
 
23
#endif
 
24
 
 
25
/*  -- translated by f2c (version 19951025).
 
26
   You must link the resulting object file with the libraries:
 
27
        -lf2c -lm   (in that order)
 
28
*/
 
29
 
 
30
#include "f2c.h"
 
31
 
 
32
/* ***************************************************************** */
 
33
 
 
34
/*      DEEMP Version 48 */
 
35
 
 
36
/* $Log: deemp.c,v $
 
37
/* Revision 1.2  2000/01/05 08:20:39  markster
 
38
/* Some OSS fixes and a few lpc changes to make it actually work
 
39
/*
 
40
 * Revision 1.2  1996/08/20  20:23:46  jaf
 
41
 * Removed all static local variables that were SAVE'd in the Fortran
 
42
 * code, and put them in struct lpc10_decoder_state that is passed as an
 
43
 * argument.
 
44
 *
 
45
 * Removed init function, since all initialization is now done in
 
46
 * init_lpc10_decoder_state().
 
47
 *
 
48
 * Revision 1.1  1996/08/19  22:32:34  jaf
 
49
 * Initial revision
 
50
 * */
 
51
/* Revision 1.3  1996/03/20  15:54:37  jaf */
 
52
/* Added comments about which indices of array arguments are read or */
 
53
/* written. */
 
54
 
 
55
/* Added entry INITDEEMP to reinitialize the local state variables, if */
 
56
/* desired. */
 
57
 
 
58
/* Revision 1.2  1996/03/14  22:11:13  jaf */
 
59
/* Comments added explaining which of the local variables of this */
 
60
/* subroutine need to be saved from one invocation to the next, and which */
 
61
/* do not. */
 
62
 
 
63
/* Revision 1.1  1996/02/07 14:44:53  jaf */
 
64
/* Initial revision */
 
65
 
 
66
 
 
67
/* ***************************************************************** */
 
68
 
 
69
/*  De-Emphasize output speech with   1 / ( 1 - .75z**-1 ) */
 
70
/*    cascaded with 200 Hz high pass filter */
 
71
/*    ( 1 - 1.9998z**-1 + z**-2 ) / ( 1 - 1.75z**-1 + .78z**-2 ) */
 
72
 
 
73
/*  WARNING!  The coefficients above may be out of date with the code */
 
74
/*  below.  Either that, or some kind of transformation was performed */
 
75
/*  on the coefficients above to create the code below. */
 
76
 
 
77
/* Input: */
 
78
/*  N  - Number of samples */
 
79
/* Input/Output: */
 
80
/*  X  - Speech */
 
81
/*       Indices 1 through N are read before being written. */
 
82
 
 
83
/* This subroutine maintains local state from one call to the next.  If */
 
84
/* you want to switch to using a new audio stream for this filter, or */
 
85
/* reinitialize its state for any other reason, call the ENTRY */
 
86
/* INITDEEMP. */
 
87
 
 
88
/* Subroutine */ int deemp_(real *x, integer *n, struct lpc10_decoder_state *st)
 
89
{
 
90
    /* Initialized data */
 
91
 
 
92
    real *dei1;
 
93
    real *dei2;
 
94
    real *deo1;
 
95
    real *deo2;
 
96
    real *deo3;
 
97
 
 
98
    /* System generated locals */
 
99
    integer i__1;
 
100
    real r__1;
 
101
 
 
102
    /* Local variables */
 
103
    integer k;
 
104
    real dei0;
 
105
 
 
106
/*       Arguments */
 
107
/*       Local variables that need not be saved */
 
108
/*       Local state */
 
109
/*       All of the locals saved below were not given explicit initial */
 
110
/*       values in the original code.  I think 0 is a safe choice. */
 
111
    /* Parameter adjustments */
 
112
    if (x) {
 
113
        --x;
 
114
        }
 
115
 
 
116
    /* Function Body */
 
117
 
 
118
    dei1 = &(st->dei1);
 
119
    dei2 = &(st->dei2);
 
120
    deo1 = &(st->deo1);
 
121
    deo2 = &(st->deo2);
 
122
    deo3 = &(st->deo3);
 
123
 
 
124
    i__1 = *n;
 
125
    for (k = 1; k <= i__1; ++k) {
 
126
        dei0 = x[k];
 
127
        r__1 = x[k] - *dei1 * 1.9998f + *dei2;
 
128
        x[k] = r__1 + *deo1 * 2.5f - *deo2 * 2.0925f + *deo3 * .585f;
 
129
        *dei2 = *dei1;
 
130
        *dei1 = dei0;
 
131
        *deo3 = *deo2;
 
132
        *deo2 = *deo1;
 
133
        *deo1 = x[k];
 
134
    }
 
135
    return 0;
 
136
} /* deemp_ */