Mercurial > libavcodec.hg
annotate vorbis.h @ 3803:7ffa21b125a6 libavcodec
100l, broke ffmpeg compilation, ABS() and uint* types not defined in vorbis_data.c
author | ods15 |
---|---|
date | Sun, 01 Oct 2006 13:45:17 +0000 |
parents | 094fe185d054 |
children | f472f55953bb |
rev | line source |
---|---|
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
1 /* |
3798 | 2 * copyright (c) 2006 Oded Shimon <ods15@ods15.dyndns.org> |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
3 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
4 * This library is free software; you can redistribute it and/or |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
5 * modify it under the terms of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
6 * License as published by the Free Software Foundation; either |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
7 * version 2 of the License, or (at your option) any later version. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
8 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
9 * This library is distributed in the hope that it will be useful, |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
12 * Lesser General Public License for more details. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
13 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
14 * You should have received a copy of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
15 * License along with this library; if not, write to the Free Software |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
17 */ |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3571
diff
changeset
|
18 |
3798 | 19 #ifndef VORBIS_H |
20 #define VORBIS_H | |
2697
4fe1c19fc7a3
Vorbis decoder by (Balatoni Denes | dbalatoni programozo hu)
michael
parents:
diff
changeset
|
21 |
3803
7ffa21b125a6
100l, broke ffmpeg compilation, ABS() and uint* types not defined in vorbis_data.c
ods15
parents:
3802
diff
changeset
|
22 #include "avcodec.h" |
7ffa21b125a6
100l, broke ffmpeg compilation, ABS() and uint* types not defined in vorbis_data.c
ods15
parents:
3802
diff
changeset
|
23 |
3798 | 24 extern const float ff_vorbis_floor1_inverse_db_table[256]; |
25 extern const float * ff_vorbis_vwin[8]; | |
2697
4fe1c19fc7a3
Vorbis decoder by (Balatoni Denes | dbalatoni programozo hu)
michael
parents:
diff
changeset
|
26 |
3801 | 27 typedef struct { |
28 uint_fast16_t x; | |
29 uint_fast16_t sort; | |
30 uint_fast16_t low; | |
31 uint_fast16_t high; | |
32 } floor1_entry_t; | |
33 | |
34 void ff_vorbis_ready_floor1_list(floor1_entry_t * list, int values); | |
3802
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
35 unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n) |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
36 int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num); |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
37 |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
38 static void render_line(int x0, int y0, int x1, int y1, float * buf, int n) { |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
39 int dy = y1 - y0; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
40 int adx = x1 - x0; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
41 int ady = ABS(dy); |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
42 int base = dy / adx; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
43 int x = x0; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
44 int y = y0; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
45 int err = 0; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
46 int sy; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
47 if (dy < 0) sy = base - 1; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
48 else sy = base + 1; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
49 ady = ady - ABS(base) * adx; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
50 if (x >= n) return; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
51 buf[x] = ff_vorbis_floor1_inverse_db_table[y]; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
52 for (x = x0 + 1; x < x1; x++) { |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
53 if (x >= n) return; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
54 err += ady; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
55 if (err >= adx) { |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
56 err -= adx; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
57 y += sy; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
58 } else { |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
59 y += base; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
60 } |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
61 buf[x] = ff_vorbis_floor1_inverse_db_table[y]; |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
62 } |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
63 } |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
64 |
094fe185d054
make some more functions global so they can be shared with vorbis_enc.c
ods15
parents:
3801
diff
changeset
|
65 #define ilog(i) av_log2(2*(i)) |
3801 | 66 |
3798 | 67 #endif |