23 #define YLC_VLC_BITS 10
60 Node *nodes,
int node,
61 uint32_t pfx,
int pl,
int *
pos)
69 xlat[*
pos] =
s + (pl == 0);
88 int cur_node,
i, j,
pos = 0;
92 for (
i = 0;
i < 256;
i++) {
104 int first_node = cur_node;
105 int second_node = cur_node;
108 nodes[cur_node].
count = -1;
112 if (
val && (
val < nodes[first_node].count)) {
113 if (
val >= nodes[second_node].count) {
114 first_node = new_node;
116 first_node = second_node;
117 second_node = new_node;
121 }
while (new_node != cur_node);
123 if (first_node == cur_node)
126 nd = nodes[second_node].
count;
127 st = nodes[first_node].
count;
128 nodes[second_node].
count = 0;
129 nodes[first_node].
count = 0;
130 if (nd >= UINT32_MAX - st) {
134 nodes[cur_node].
count = nd + st;
135 nodes[cur_node].
sym = -1;
136 nodes[cur_node].
l = first_node;
137 nodes[cur_node].
r = second_node;
141 }
while (cur_node - 256 == j);
146 bits, 4, 4, xlat, 1, 1, 0);
150 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
151 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
152 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
153 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
154 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
155 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
156 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
157 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
158 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
159 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
160 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
161 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
167 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
168 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
169 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
170 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
171 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
172 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
173 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
174 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
175 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
176 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
177 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
182 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
183 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
186 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
187 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0xFF,
188 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
189 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
191 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
192 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
193 0x01, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
194 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
195 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
197 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
198 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF,
199 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
200 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
203 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
204 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0xFF, 0xFF,
205 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
206 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
209 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
214 0xFC, 0xFC, 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE,
215 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFC,
216 0xFC, 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE,
217 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFC, 0xFC,
218 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFF,
219 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFD, 0xFD, 0xFD,
220 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
221 0x00, 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFE,
222 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
223 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE,
224 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01,
225 0x01, 0x01, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
226 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02,
227 0x02, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00,
228 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
229 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
230 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0xFF,
231 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
232 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0xFF, 0xFF,
233 0xFF, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
234 0x02, 0x02, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0xFF,
235 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02,
236 0x02, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01,
237 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03,
238 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01,
239 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04,
240 0x04, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
241 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04,
246 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
247 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
248 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
249 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
250 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
251 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
252 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
253 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
254 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
255 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
256 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
257 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
258 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
259 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
260 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
261 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
262 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
263 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
264 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
265 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
266 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
267 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
268 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
269 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
270 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
271 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
272 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
273 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
280 int TL[4] = { 128, 128, 128, 128 };
281 int L[4] = { 128, 128, 128, 128 };
283 const uint8_t *buf = avpkt->
data;
284 int ret, x, y, toffset, boffset;
288 if (avpkt->
size <= 16)
296 if (toffset < 16 || toffset >= avpkt->
size)
300 if (toffset >= boffset || boffset >= avpkt->
size)
307 FFMAX(boffset - toffset, avpkt->
size - boffset)
312 memcpy(
s->buffer, avpkt->
data + toffset, boffset - toffset);
314 s->bdsp.bswap_buf((uint32_t *)
s->buffer,
315 (uint32_t *)
s->buffer,
316 (boffset - toffset + 3) >> 2);
320 for (
int i = 0;
i < 4;
i++) {
321 for (x = 0; x < 256; x++) {
333 memcpy(
s->buffer, avpkt->
data + boffset, avpkt->
size - boffset);
335 s->bdsp.bswap_buf((uint32_t *)
s->buffer,
336 (uint32_t *)
s->buffer,
337 (avpkt->
size - boffset) >> 2);
342 for (y = 0; y < avctx->
height; y++) {
343 memset(dst, 0, avctx->
width * 2);
348 for (y = 0; y < avctx->
height; y++) {
349 for (x = 0; x < avctx->
width * 2 && y < avctx->
height;) {
357 }
else if (
val < 0xE1) {
364 int incr = (
val - 0xDF) * 4;
365 if (x + incr >= avctx->
width * 2) {
366 int iy = ((x + incr) / (avctx->
width * 2));
367 x = (x + incr) % (avctx->
width * 2);
381 if (y1 < 0 || y2 < 0 ||
u < 0 || v < 0)
385 dst[x + 2] = y1 + y2;
394 for (x = 0; x < avctx->
width * 2; x += 4) {
395 dst[x ] = dst[x ] +
L[0];
396 dst[x + 2] =
L[0] = dst[x + 2] +
L[0];
397 L[1] = dst[x + 1] +
L[1];
399 L[2] = dst[x + 3] +
L[2];
404 for (y = 1; y < avctx->
height; y++) {
406 dst[x ] = dst[x ] +
L[0] + dst[x + 0 - p->
linesize[0]] - TL[0];
407 dst[x + 2] =
L[0] = dst[x + 2] +
L[0] + dst[x + 2 - p->
linesize[0]] - TL[0];
408 TL[0] = dst[x + 2 - p->
linesize[0]];
409 L[1] = dst[x + 1] +
L[1] + dst[x + 1 - p->
linesize[0]] - TL[1];
411 TL[1] = dst[x + 1 - p->
linesize[0]];
412 L[2] = dst[x + 3] +
L[2] + dst[x + 3 - p->
linesize[0]] - TL[2];
414 TL[2] = dst[x + 3 - p->
linesize[0]];
415 for (x = 4; x < avctx->
width * 2; x += 4) {
416 dst[x ] = dst[x ] +
L[0] + dst[x + 0 - p->
linesize[0]] - TL[0];
417 dst[x + 2] =
L[0] = dst[x + 2] +
L[0] + dst[x + 2 - p->
linesize[0]] - TL[0];
418 TL[0] = dst[x + 2 - p->
linesize[0]];
419 L[1] = dst[x + 1] +
L[1] + dst[x + 1 - p->
linesize[0]] - TL[1];
421 TL[1] = dst[x + 1 - p->
linesize[0]];
422 L[2] = dst[x + 3] +
L[2] + dst[x + 3 - p->
linesize[0]] - TL[2];
424 TL[2] = dst[x + 3 - p->
linesize[0]];