MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / seqvideo_decode

Function seqvideo_decode

libavcodec/tiertexseqv.c:165–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int data_size)
166{
167 const unsigned char *data_end = data + data_size;
168 GetBitContext gb;
169 int flags, i, j, x, y, op;
170 unsigned char c[3];
171 unsigned char *dst;
172 uint32_t *palette;
173
174 flags = *data++;
175
176 if (flags & 1) {
177 palette = (uint32_t *)seq->frame->data[1];
178 if (data_end - data < 256 * 3)
179 return AVERROR_INVALIDDATA;
180 for (i = 0; i < 256; i++) {
181 for (j = 0; j < 3; j++, data++)
182 c[j] = (*data << 2) | (*data >> 4);
183 palette[i] = 0xFFU << 24 | AV_RB24(c);
184 }
185 }
186
187 if (flags & 2) {
188 if (data_end - data < 128)
189 return AVERROR_INVALIDDATA;
190 init_get_bits(&gb, data, 128 * 8); data += 128;
191 for (y = 0; y < 128; y += 8)
192 for (x = 0; x < 256; x += 8) {
193 dst = &seq->frame->data[0][y * seq->frame->linesize[0] + x];
194 op = get_bits(&gb, 2);
195 switch (op) {
196 case 1:
197 data = seq_decode_op1(seq, data, data_end, dst);
198 break;
199 case 2:
200 data = seq_decode_op2(seq, data, data_end, dst);
201 break;
202 case 3:
203 data = seq_decode_op3(seq, data, data_end, dst);
204 break;
205 }
206 if (!data)
207 return AVERROR_INVALIDDATA;
208 }
209 }
210 return 0;
211}
212
213static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
214{

Callers 1

seqvideo_decode_frameFunction · 0.85

Calls 5

init_get_bitsFunction · 0.85
seq_decode_op1Function · 0.85
seq_decode_op2Function · 0.85
seq_decode_op3Function · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected