Mercurial > libavcodec.hg
annotate nellymoser.h @ 12494:94eaea836bf4 libavcodec
Check avctx width/height more thoroughly (e.g. all values 0 except width would
have been accepted before).
Also do not fail if they are invalid but instead override them to 0.
This allows decoding e.g. MPEG video when only the container values are corrupted.
For encoding a value of 0,0 of course makes no sense, but was allowed
through before and will be caught by an extra check in the encode function.
author | reimar |
---|---|
date | Wed, 15 Sep 2010 04:46:55 +0000 |
parents | 7dd2a45249a9 |
children |
rev | line source |
---|---|
7030
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
1 /* |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
2 * Common code between Nellymoser encoder and decoder |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
3 * Copyright (c) 2007 a840bda5870ba11f19698ff6eb9581dfb0f95fa5, |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
4 * 539459aeb7d425140b62a3ec7dbf6dc8e408a306, and |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
5 * 520e17cd55896441042b14df2566a6eb610ed444 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
6 * Copyright (c) 2007 Loic Minier <lool at dooz.org> |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
7 * Benjamin Larsson |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
8 * |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
9 * Permission is hereby granted, free of charge, to any person obtaining a |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
10 * copy of this software and associated documentation files (the "Software"), |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
11 * to deal in the Software without restriction, including without limitation |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
13 * and/or sell copies of the Software, and to permit persons to whom the |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
14 * Software is furnished to do so, subject to the following conditions: |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
15 * |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
16 * The above copyright notice and this permission notice shall be included in |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
17 * all copies or substantial portions of the Software. |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
18 * |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
25 * DEALINGS IN THE SOFTWARE. |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
26 */ |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
27 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
28 /** |
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
8718
diff
changeset
|
29 * @file |
7030
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
30 * The 3 alphanumeric copyright notices are md5summed they are from the original |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
31 * implementors. The original code is available from http://code.google.com/p/nelly2pcm/ |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
32 */ |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
33 |
7760 | 34 #ifndef AVCODEC_NELLYMOSER_H |
35 #define AVCODEC_NELLYMOSER_H | |
7030
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
36 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
37 #include "avcodec.h" |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
38 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
39 #define NELLY_BANDS 23 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
40 #define NELLY_BLOCK_LEN 64 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
41 #define NELLY_HEADER_BITS 116 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
42 #define NELLY_DETAIL_BITS 198 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
43 #define NELLY_BUF_LEN 128 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
44 #define NELLY_FILL_LEN 124 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
45 #define NELLY_BIT_CAP 6 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
46 #define NELLY_BASE_OFF 4228 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
47 #define NELLY_BASE_SHIFT 19 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
48 #define NELLY_SAMPLES (2 * NELLY_BUF_LEN) |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
49 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
50 extern const float ff_nelly_dequantization_table[127]; |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
51 extern const uint8_t ff_nelly_band_sizes_table[NELLY_BANDS]; |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
52 extern const uint16_t ff_nelly_init_table[64]; |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
53 extern const int16_t ff_nelly_delta_table[32]; |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
54 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
55 void ff_nelly_get_sample_bits(const float *buf, int *bits); |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
56 |
40f18ff994f9
Separating from nellymoserdec.c parts required by encoder
bwolowiec
parents:
diff
changeset
|
57 #endif |