comparison tiertexseqv.c @ 7207:655f242bb525 libavcodec

Remove context fields which can be used as simple local variables. patch by Gregory Montoir, cyx users sourceforge net
author diego
date Sun, 06 Jul 2008 10:01:54 +0000
parents 3092ae791531
children e9d9d946f213
comparison
equal deleted inserted replaced
7206:3092ae791531 7207:655f242bb525
30 30
31 31
32 typedef struct SeqVideoContext { 32 typedef struct SeqVideoContext {
33 AVCodecContext *avctx; 33 AVCodecContext *avctx;
34 AVFrame frame; 34 AVFrame frame;
35 unsigned int palette[256];
36 unsigned char block[8 * 8];
37 } SeqVideoContext; 35 } SeqVideoContext;
38 36
39 37
40 static const unsigned char *seq_unpack_rle_block(const unsigned char *src, unsigned char *dst, int dst_size) 38 static const unsigned char *seq_unpack_rle_block(const unsigned char *src, unsigned char *dst, int dst_size)
41 { 39 {
70 static const unsigned char *seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst) 68 static const unsigned char *seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)
71 { 69 {
72 const unsigned char *color_table; 70 const unsigned char *color_table;
73 int b, i, len, bits; 71 int b, i, len, bits;
74 GetBitContext gb; 72 GetBitContext gb;
73 unsigned char block[8 * 8];
75 74
76 len = *src++; 75 len = *src++;
77 if (len & 0x80) { 76 if (len & 0x80) {
78 switch (len & 3) { 77 switch (len & 3) {
79 case 1: 78 case 1:
80 src = seq_unpack_rle_block(src, seq->block, sizeof(seq->block)); 79 src = seq_unpack_rle_block(src, block, sizeof(block));
81 for (b = 0; b < 8; b++) { 80 for (b = 0; b < 8; b++) {
82 memcpy(dst, &seq->block[b * 8], 8); 81 memcpy(dst, &block[b * 8], 8);
83 dst += seq->frame.linesize[0]; 82 dst += seq->frame.linesize[0];
84 } 83 }
85 break; 84 break;
86 case 2: 85 case 2:
87 src = seq_unpack_rle_block(src, seq->block, sizeof(seq->block)); 86 src = seq_unpack_rle_block(src, block, sizeof(block));
88 for (i = 0; i < 8; i++) { 87 for (i = 0; i < 8; i++) {
89 for (b = 0; b < 8; b++) 88 for (b = 0; b < 8; b++)
90 dst[b * seq->frame.linesize[0]] = seq->block[i * 8 + b]; 89 dst[b * seq->frame.linesize[0]] = block[i * 8 + b];
91 ++dst; 90 ++dst;
92 } 91 }
93 break; 92 break;
94 } 93 }
95 } else { 94 } else {
137 { 136 {
138 GetBitContext gb; 137 GetBitContext gb;
139 int flags, i, j, x, y, op; 138 int flags, i, j, x, y, op;
140 unsigned char c[3]; 139 unsigned char c[3];
141 unsigned char *dst; 140 unsigned char *dst;
141 uint32_t *palette;
142 142
143 flags = *data++; 143 flags = *data++;
144 144
145 if (flags & 1) { 145 if (flags & 1) {
146 palette = (uint32_t *)seq->frame.data[1];
146 for (i = 0; i < 256; i++) { 147 for (i = 0; i < 256; i++) {
147 for (j = 0; j < 3; j++, data++) 148 for (j = 0; j < 3; j++, data++)
148 c[j] = (*data << 2) | (*data >> 4); 149 c[j] = (*data << 2) | (*data >> 4);
149 seq->palette[i] = AV_RB24(c); 150 palette[i] = AV_RB24(c);
150 } 151 }
151 memcpy(seq->frame.data[1], seq->palette, sizeof(seq->palette));
152 seq->frame.palette_has_changed = 1; 152 seq->frame.palette_has_changed = 1;
153 } 153 }
154 154
155 if (flags & 2) { 155 if (flags & 2) {
156 init_get_bits(&gb, data, 128 * 8); data += 128; 156 init_get_bits(&gb, data, 128 * 8); data += 128;