Mercurial > libavcodec.hg
annotate dv_tablegen.h @ 12530:63edd10ad4bc libavcodec tip
Try to fix crashes introduced by r25218
r25218 made assumptions about the existence of past reference frames that
weren't necessarily true.
author | darkshikari |
---|---|
date | Tue, 28 Sep 2010 09:06:22 +0000 |
parents | 59f399926c12 |
children |
rev | line source |
---|---|
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
1 /* |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
2 * Header file for hardcoded DV tables |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
3 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
4 * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger@gmx.de> |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
5 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
6 * This file is part of FFmpeg. |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
7 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
12 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
17 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
21 */ |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
22 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
23 #ifndef DV_TABLEGEN_H |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
24 #define DV_TABLEGEN_H |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
25 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
26 #include <stdint.h> |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
27 #include "dv_vlc_data.h" |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
28 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
29 #if CONFIG_SMALL |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
30 #define DV_VLC_MAP_RUN_SIZE 15 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
31 #define DV_VLC_MAP_LEV_SIZE 23 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
32 #else |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
33 #define DV_VLC_MAP_RUN_SIZE 64 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
34 #define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
35 #endif |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
36 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
37 /* VLC encoding lookup table */ |
11979
59f399926c12
tableprint: use the type name as-is for the functions' names.
flameeyes
parents:
11523
diff
changeset
|
38 typedef struct dv_vlc_pair { |
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
39 uint32_t vlc; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
40 uint32_t size; |
11979
59f399926c12
tableprint: use the type name as-is for the functions' names.
flameeyes
parents:
11523
diff
changeset
|
41 } dv_vlc_pair; |
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
42 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
43 #if CONFIG_HARDCODED_TABLES |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
44 #define dv_vlc_map_tableinit() |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
45 #include "libavcodec/dv_tables.h" |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
46 #else |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
47 static struct dv_vlc_pair dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE]; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
48 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
49 static void dv_vlc_map_tableinit(void) |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
50 { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
51 int i, j; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
52 for (i = 0; i < NB_DV_VLC - 1; i++) { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
53 if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE) |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
54 continue; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
55 #if CONFIG_SMALL |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
56 if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE) |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
57 continue; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
58 #endif |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
59 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
60 if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0) |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
61 continue; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
62 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
63 dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc = |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
64 dv_vlc_bits[i] << (!!dv_vlc_level[i]); |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
65 dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size = |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
66 dv_vlc_len[i] + (!!dv_vlc_level[i]); |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
67 } |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
68 for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
69 #if CONFIG_SMALL |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
70 for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
71 if (dv_vlc_map[i][j].size == 0) { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
72 dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc | |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
73 (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size)); |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
74 dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
75 dv_vlc_map[0][j].size; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
76 } |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
77 } |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
78 #else |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
79 for (j = 1; j < DV_VLC_MAP_LEV_SIZE/2; j++) { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
80 if (dv_vlc_map[i][j].size == 0) { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
81 dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc | |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
82 (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size)); |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
83 dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
84 dv_vlc_map[0][j].size; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
85 } |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
86 dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc = |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
87 dv_vlc_map[i][j].vlc | 1; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
88 dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size = |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
89 dv_vlc_map[i][j].size; |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
90 } |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
91 #endif |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
92 } |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
93 } |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
94 #endif /* CONFIG_HARDCODED_TABLES */ |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
95 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
96 #endif /* DV_TABLEGEN_H */ |