39 #define BITSTREAM_READER_LE
43 #define SMKTREE_BITS 9
44 #define SMK_NODE 0x80000000
80 1, 2, 3, 4, 5, 6, 7, 8,
81 9, 10, 11, 12, 13, 14, 15, 16,
82 17, 18, 19, 20, 21, 22, 23, 24,
83 25, 26, 27, 28, 29, 30, 31, 32,
84 33, 34, 35, 36, 37, 38, 39, 40,
85 41, 42, 43, 44, 45, 46, 47, 48,
86 49, 50, 51, 52, 53, 54, 55, 56,
87 57, 58, 59, 128, 256, 512, 1024, 2048 };
144 if (i1 < 0 || i2 < 0)
150 }
else if(val == ctx->
escapes[1]) {
153 }
else if(val == ctx->
escapes[2]) {
184 VLC vlc[2] = { { 0 } };
189 if(size >= UINT_MAX>>4){
222 tmp1.
lengths,
sizeof(
int),
sizeof(
int),
243 tmp2.
lengths,
sizeof(
int),
sizeof(
int),
260 last[0] = last[1] = last[2] = -1;
271 huff.
length = ((size + 3) >> 2) + 4;
312 int mmap_size, mclr_size, full_size, type_size,
ret;
374 recode[last[0]] = recode[last[1]] = recode[last[2]] = 0;
379 register int *
table = recode;
384 table += (*table) & (~SMK_NODE);
389 if(v != recode[last[0]]) {
390 recode[last[2]] = recode[last[1]];
391 recode[last[1]] = recode[last[0]];
405 int blocks,
blk, bw, bh;
410 if (avpkt->
size <= 769)
417 pal = (uint32_t*)smk->
pic->
data[1];
419 flags = bytestream2_get_byteu(&gb2);
427 for(i = 0; i < 256; i++)
428 *pal++ = 0xFFU << 24 | bytestream2_get_be24u(&gb2);
438 bw = avctx->
width >> 2;
443 while(blk < blocks) {
451 while(run-- && blk < blocks){
456 out = smk->
pic->
data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
459 for(i = 0; i < 4; i++) {
460 if(map & 1) out[0] = hi;
else out[0] = lo;
461 if(map & 2) out[1] = hi;
else out[1] = lo;
462 if(map & 4) out[2] = hi;
else out[2] = lo;
463 if(map & 8) out[3] = hi;
else out[3] = lo;
476 while(run-- && blk < blocks){
477 out = smk->
pic->
data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
480 for(i = 0; i < 4; i++) {
490 out[0] = out[1] = pix & 0xFF;
491 out[2] = out[3] = pix >> 8;
493 out[0] = out[1] = pix & 0xFF;
494 out[2] = out[3] = pix >> 8;
497 out[0] = out[1] = pix & 0xFF;
498 out[2] = out[3] = pix >> 8;
500 out[0] = out[1] = pix & 0xFF;
501 out[2] = out[3] = pix >> 8;
505 for(i = 0; i < 2; i++) {
522 while(run-- && blk < blocks)
527 while(run-- && blk < blocks){
529 out = smk->
pic->
data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
530 col = mode * 0x01010101;
531 for(i = 0; i < 4; i++) {
532 *((uint32_t*)out) = col;
623 int *got_frame_ptr,
AVPacket *avpkt)
627 int buf_size = avpkt->
size;
630 VLC vlc[4] = { { 0 } };
637 int pred[2] = {0, 0};
646 if (unp_size > (1
U<<24)) {
661 if (stereo ^ (avctx->
channels != 1)) {
674 samples = (int16_t *)frame->
data[0];
675 samples8 = frame->
data[0];
678 for(i = 0; i < (1 << (bits + stereo)); i++) {
685 if (!h[i].bits || !h[i].lengths || !h[i].values) {
695 if(h[i].current > 1) {
697 h[i].lengths,
sizeof(
int),
sizeof(
int),
698 h[i].bits,
sizeof(uint32_t),
sizeof(uint32_t),
INIT_VLC_LE);
708 for(i = stereo; i >= 0; i--)
710 for(i = 0; i <= stereo; i++)
711 *samples++ = pred[i];
712 for(; i < unp_size / 2; i++) {
733 val |= h[3].
values[res] << 8;
735 *samples++ = pred[1];
754 val |= h[1].
values[res] << 8;
756 *samples++ = pred[0];
760 for(i = stereo; i >= 0; i--)
762 for(i = 0; i <= stereo; i++)
763 *samples8++ = pred[i];
764 for(; i < unp_size; i++) {
777 *samples8++ = pred[1];
788 *samples8++ = pred[0];
797 for(i = 0; i < 4; i++) {