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

Function seq_decode_op1

libavcodec/tiertexseqv.c:78–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static const unsigned char *seq_decode_op1(SeqVideoContext *seq,
79 const unsigned char *src,
80 const unsigned char *src_end,
81 unsigned char *dst)
82{
83 const unsigned char *color_table;
84 int b, i, len, bits;
85 GetBitContext gb;
86 unsigned char block[8 * 8];
87
88 if (src_end - src < 1)
89 return NULL;
90 len = *src++;
91 if (len & 0x80) {
92 switch (len & 3) {
93 case 1:
94 src = seq_unpack_rle_block(src, src_end, block, sizeof(block));
95 for (b = 0; b < 8; b++) {
96 memcpy(dst, &block[b * 8], 8);
97 dst += seq->frame->linesize[0];
98 }
99 break;
100 case 2:
101 src = seq_unpack_rle_block(src, src_end, block, sizeof(block));
102 for (i = 0; i < 8; i++) {
103 for (b = 0; b < 8; b++)
104 dst[b * seq->frame->linesize[0]] = block[i * 8 + b];
105 ++dst;
106 }
107 break;
108 }
109 } else {
110 if (len <= 0)
111 return NULL;
112 bits = ff_log2_tab[len - 1] + 1;
113 if (src_end - src < len + 8 * bits)
114 return NULL;
115 color_table = src;
116 src += len;
117 init_get_bits(&gb, src, bits * 8 * 8); src += bits * 8;
118 for (b = 0; b < 8; b++) {
119 for (i = 0; i < 8; i++)
120 dst[i] = color_table[get_bits(&gb, bits)];
121 dst += seq->frame->linesize[0];
122 }
123 }
124
125 return src;
126}
127
128static const unsigned char *seq_decode_op2(SeqVideoContext *seq,
129 const unsigned char *src,

Callers 1

seqvideo_decodeFunction · 0.85

Calls 3

seq_unpack_rle_blockFunction · 0.85
init_get_bitsFunction · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected