FFmpeg
Loading...
Searching...
No Matches
dvdata.c
Go to the documentation of this file.
1/*
2 * Constants for DV codec
3 * Copyright (c) 2002 Fabrice Bellard
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * Constants for DV codec.
25 */
26
27#include <stdint.h>
28
29#include "dvdata.h"
30
31/* Specific zigzag scan for 248 idct. NOTE that unlike the
32 * specification, we interleave the fields */
33const uint8_t ff_dv_zigzag248_direct[64] = {
34 0, 8, 1, 9, 16, 24, 2, 10,
35 17, 25, 32, 40, 48, 56, 33, 41,
36 18, 26, 3, 11, 4, 12, 19, 27,
37 34, 42, 49, 57, 50, 58, 35, 43,
38 20, 28, 5, 13, 6, 14, 21, 29,
39 36, 44, 51, 59, 52, 60, 37, 45,
40 22, 30, 7, 15, 23, 31, 38, 46,
41 53, 61, 54, 62, 39, 47, 55, 63,
42};
43
44/* unquant tables (not used directly) */
45const uint8_t ff_dv_quant_shifts[22][4] = {
46 { 3, 3, 4, 4 },
47 { 3, 3, 4, 4 },
48 { 2, 3, 3, 4 },
49 { 2, 3, 3, 4 },
50 { 2, 2, 3, 3 },
51 { 2, 2, 3, 3 },
52 { 1, 2, 2, 3 },
53 { 1, 2, 2, 3 },
54 { 1, 1, 2, 2 },
55 { 1, 1, 2, 2 },
56 { 0, 1, 1, 2 },
57 { 0, 1, 1, 2 },
58 { 0, 0, 1, 1 },
59 { 0, 0, 1, 1 },
60 { 0, 0, 0, 1 },
61 { 0, 0, 0, 0 },
62 { 0, 0, 0, 0 },
63 { 0, 0, 0, 0 },
64 { 0, 0, 0, 0 },
65 { 0, 0, 0, 0 },
66 { 0, 0, 0, 0 },
67 { 0, 0, 0, 0 },
68};
69
70const uint8_t ff_dv_quant_offset[4] = { 6, 3, 0, 1 };
71
72/*
73 * There's a catch about the following three tables: the mapping they establish
74 * between (run, level) and vlc is not 1-1. So you have to watch out for that
75 * when building misc. tables. E.g. (1, 0) can be either 0x7cf or 0x1f82.
76 */
77const uint8_t ff_dv_vlc_len[NB_DV_VLC] = {
78 2, 3, 4, 4, 4, 4, 5, 5, 5,
79 5, 6, 6, 6, 6, 7, 7, 7,
80 7, 7, 7, 7, 7, 8, 8, 8,
81 8, 8, 8, 8, 8, 8, 8, 8,
82 8, 8, 8, 8, 8, 9, 9, 9,
83 9, 9, 9, 9, 9, 9, 9, 9,
84 9, 9, 9, 9, 9, 10, 10, 10,
85 10, 10, 10, 10, 11, 11, 11, 11,
86 11, 11, 11, 11, 12, 12, 12, 12,
87 12, 12, 12, 12, 12, 12, 12, 12,
88 12, 12, 12, 12, 12, 12, 12, 12,
89 13, 13, 13, 13, 13, 13, 13, 13,
90 13, 13, 13, 13, 13, 13, 13, 13,
91 13, 13, 13, 13, 13, 13, 13, 13,
92 13, 13, 13, 13, 13, 13, 13, 13,
93 13, 13, 13, 13, 13, 13, 13, 13,
94 13, 13, 13, 13, 13, 13, 13, 13,
95 13, 13, 13, 13, 13, 13, 13, 13,
96 13, 13, 13, 13, 13, 13, 13, 13,
97 15, 15, 15, 15, 15, 15, 15, 15,
98 15, 15, 15, 15, 15, 15, 15, 15,
99 15, 15, 15, 15, 15, 15, 15, 15,
100 15, 15, 15, 15, 15, 15, 15, 15,
101 15, 15, 15, 15, 15, 15, 15, 15,
102 15, 15, 15, 15, 15, 15, 15, 15,
103 15, 15, 15, 15, 15, 15, 15, 15,
104 15, 15, 15, 15, 15, 15, 15, 15,
105 15, 15, 15, 15, 15, 15, 15, 15,
106 15, 15, 15, 15, 15, 15, 15, 15,
107 15, 15, 15, 15, 15, 15, 15, 15,
108 15, 15, 15, 15, 15, 15, 15, 15,
109 15, 15, 15, 15, 15, 15, 15, 15,
110 15, 15, 15, 15, 15, 15, 15, 15,
111 15, 15, 15, 15, 15, 15, 15, 15,
112 15, 15, 15, 15, 15, 15, 15, 15,
113 15, 15, 15, 15, 15, 15, 15, 15,
114 15, 15, 15, 15, 15, 15, 15, 15,
115 15, 15, 15, 15, 15, 15, 15, 15,
116 15, 15, 15, 15, 15, 15, 15, 15,
117 15, 15, 15, 15, 15, 15, 15, 15,
118 15, 15, 15, 15, 15, 15, 15, 15,
119 15, 15, 15, 15, 15, 15, 15, 15,
120 15, 15, 15, 15, 15, 15, 15, 15,
121 15, 15, 15, 15, 15, 15, 15, 15,
122 15, 15, 15, 15, 15, 15, 15, 15,
123 15, 15, 15, 15, 15, 15, 15, 15,
124 15, 15, 15, 15, 15, 15, 15, 15,
125 15, 15, 15, 15, 15, 15, 15, 15,
126 15, 15, 15, 15, 15, 15, 15, 15,
127 15, 15, 15, 15, 15, 15, 15, 15,
128 15, 15, 15, 15, 15, 15, 15, 15,
129};
130
131const uint8_t ff_dv_vlc_run[NB_DV_VLC] = {
132 0, 0, 127, 1, 0, 0, 2, 1, 0,
133 0, 3, 4, 0, 0, 5, 6, 2,
134 1, 1, 0, 0, 0, 7, 8, 9,
135 10, 3, 4, 2, 1, 1, 1, 0,
136 0, 0, 0, 0, 0, 11, 12, 13,
137 14, 5, 6, 3, 4, 2, 2, 1,
138 0, 0, 0, 0, 0, 5, 3, 3,
139 2, 1, 1, 1, 0, 1, 6, 4,
140 3, 1, 1, 1, 2, 3, 4, 5,
141 7, 8, 9, 10, 7, 8, 4, 3,
142 2, 2, 2, 2, 2, 1, 1, 1,
143 0, 1, 2, 3, 4, 5, 6, 7,
144 8, 9, 10, 11, 12, 13, 14, 15,
145 16, 17, 18, 19, 20, 21, 22, 23,
146 24, 25, 26, 27, 28, 29, 30, 31,
147 32, 33, 34, 35, 36, 37, 38, 39,
148 40, 41, 42, 43, 44, 45, 46, 47,
149 48, 49, 50, 51, 52, 53, 54, 55,
150 56, 57, 58, 59, 60, 61, 62, 63,
151 0, 0, 0, 0, 0, 0, 0, 0,
152 0, 0, 0, 0, 0, 0, 0, 0,
153 0, 0, 0, 0, 0, 0, 0, 0,
154 0, 0, 0, 0, 0, 0, 0, 0,
155 0, 0, 0, 0, 0, 0, 0, 0,
156 0, 0, 0, 0, 0, 0, 0, 0,
157 0, 0, 0, 0, 0, 0, 0, 0,
158 0, 0, 0, 0, 0, 0, 0, 0,
159 0, 0, 0, 0, 0, 0, 0, 0,
160 0, 0, 0, 0, 0, 0, 0, 0,
161 0, 0, 0, 0, 0, 0, 0, 0,
162 0, 0, 0, 0, 0, 0, 0, 0,
163 0, 0, 0, 0, 0, 0, 0, 0,
164 0, 0, 0, 0, 0, 0, 0, 0,
165 0, 0, 0, 0, 0, 0, 0, 0,
166 0, 0, 0, 0, 0, 0, 0, 0,
167 0, 0, 0, 0, 0, 0, 0, 0,
168 0, 0, 0, 0, 0, 0, 0, 0,
169 0, 0, 0, 0, 0, 0, 0, 0,
170 0, 0, 0, 0, 0, 0, 0, 0,
171 0, 0, 0, 0, 0, 0, 0, 0,
172 0, 0, 0, 0, 0, 0, 0, 0,
173 0, 0, 0, 0, 0, 0, 0, 0,
174 0, 0, 0, 0, 0, 0, 0, 0,
175 0, 0, 0, 0, 0, 0, 0, 0,
176 0, 0, 0, 0, 0, 0, 0, 0,
177 0, 0, 0, 0, 0, 0, 0, 0,
178 0, 0, 0, 0, 0, 0, 0, 0,
179 0, 0, 0, 0, 0, 0, 0, 0,
180 0, 0, 0, 0, 0, 0, 0, 0,
181 0, 0, 0, 0, 0, 0, 0, 0,
182 0, 0, 0, 0, 0, 0, 0, 0,
183};
184
185const uint8_t ff_dv_vlc_level[NB_DV_VLC] = {
186 1, 2, 0, 1, 3, 4, 1, 2, 5,
187 6, 1, 1, 7, 8, 1, 1, 2,
188 3, 4, 9, 10, 11, 1, 1, 1,
189 1, 2, 2, 3, 5, 6, 7, 12,
190 13, 14, 15, 16, 17, 1, 1, 1,
191 1, 2, 2, 3, 3, 4, 5, 8,
192 18, 19, 20, 21, 22, 3, 4, 5,
193 6, 9, 10, 11, 0, 0, 3, 4,
194 6, 12, 13, 14, 0, 0, 0, 0,
195 2, 2, 2, 2, 3, 3, 5, 7,
196 7, 8, 9, 10, 11, 15, 16, 17,
197 0, 0, 0, 0, 0, 0, 0, 0,
198 0, 0, 0, 0, 0, 0, 0, 0,
199 0, 0, 0, 0, 0, 0, 0, 0,
200 0, 0, 0, 0, 0, 0, 0, 0,
201 0, 0, 0, 0, 0, 0, 0, 0,
202 0, 0, 0, 0, 0, 0, 0, 0,
203 0, 0, 0, 0, 0, 0, 0, 0,
204 0, 0, 0, 0, 0, 0, 0, 0,
205 0, 1, 2, 3, 4, 5, 6, 7,
206 8, 9, 10, 11, 12, 13, 14, 15,
207 16, 17, 18, 19, 20, 21, 22, 23,
208 24, 25, 26, 27, 28, 29, 30, 31,
209 32, 33, 34, 35, 36, 37, 38, 39,
210 40, 41, 42, 43, 44, 45, 46, 47,
211 48, 49, 50, 51, 52, 53, 54, 55,
212 56, 57, 58, 59, 60, 61, 62, 63,
213 64, 65, 66, 67, 68, 69, 70, 71,
214 72, 73, 74, 75, 76, 77, 78, 79,
215 80, 81, 82, 83, 84, 85, 86, 87,
216 88, 89, 90, 91, 92, 93, 94, 95,
217 96, 97, 98, 99, 100, 101, 102, 103,
218 104, 105, 106, 107, 108, 109, 110, 111,
219 112, 113, 114, 115, 116, 117, 118, 119,
220 120, 121, 122, 123, 124, 125, 126, 127,
221 128, 129, 130, 131, 132, 133, 134, 135,
222 136, 137, 138, 139, 140, 141, 142, 143,
223 144, 145, 146, 147, 148, 149, 150, 151,
224 152, 153, 154, 155, 156, 157, 158, 159,
225 160, 161, 162, 163, 164, 165, 166, 167,
226 168, 169, 170, 171, 172, 173, 174, 175,
227 176, 177, 178, 179, 180, 181, 182, 183,
228 184, 185, 186, 187, 188, 189, 190, 191,
229 192, 193, 194, 195, 196, 197, 198, 199,
230 200, 201, 202, 203, 204, 205, 206, 207,
231 208, 209, 210, 211, 212, 213, 214, 215,
232 216, 217, 218, 219, 220, 221, 222, 223,
233 224, 225, 226, 227, 228, 229, 230, 231,
234 232, 233, 234, 235, 236, 237, 238, 239,
235 240, 241, 242, 243, 244, 245, 246, 247,
236 248, 249, 250, 251, 252, 253, 254, 255,
237};
const uint8_t ff_dv_quant_offset[4]
Definition dvdata.c:70
const uint8_t ff_dv_zigzag248_direct[64]
Definition dvdata.c:33
const uint8_t ff_dv_vlc_len[NB_DV_VLC]
Definition dvdata.c:77
const uint8_t ff_dv_quant_shifts[22][4]
Definition dvdata.c:45
const uint8_t ff_dv_vlc_run[NB_DV_VLC]
Definition dvdata.c:131
const uint8_t ff_dv_vlc_level[NB_DV_VLC]
Definition dvdata.c:185
#define NB_DV_VLC
Definition dvdata.h:29