54 const uint8_t *buf_ptr,
int buf_size)
66 const uint8_t *buf_ptr,
int buf_size)
68 unsigned bitmask_size, mb_count;
75 bitmask_size = (mb_count + 7) >> 3;
76 if (bitmask_size > buf_size - 12) {
78 "MXM bitmask is not complete\n");
88 "MXM bitmask memory allocation error\n");
96 "Completion bitmask memory allocation error\n");
103 memcpy(s->
mxm_bitmask, buf_ptr + 12, bitmask_size);
107 uint8_t completion_check = 0xFF;
108 for (i = 0; i < bitmask_size; ++i) {
119 const uint8_t *buf_ptr,
int buf_size)
125 if (len > 14 && len <= buf_size && !strncmp(buf_ptr + 2,
"MXM", 3)) {
139 "Picture dimensions stored in SOF and MXM mismatch\n");
143 if (reference_ptr->
data[0]) {
149 "Dimensions of current and reference picture mismatch\n");
159 void *
data,
int *got_frame,
163 int buf_size = avpkt->
size;
166 const uint8_t *buf_end, *buf_ptr;
167 const uint8_t *unescaped_buf_ptr;
168 int unescaped_buf_size;
173 buf_end = buf + buf_size;
176 while (buf_ptr < buf_end) {
178 &unescaped_buf_ptr, &unescaped_buf_size);
184 if (start_code >=
APP0 && start_code <=
APP15) {
188 switch (start_code) {
199 "quantization table decode error\n");
207 "huffman table decode error\n");
222 "SOF data decode error\n");
227 "Interlaced mode not supported in MxPEG\n");
235 "Can not process SOS without SOF data, skipping\n");
241 "First picture has no SOF, skipping\n");
246 "Non-key frame has no MXM, skipping\n");
268 if (!reference_ptr->
data[0] &&
308 return buf_ptr -
buf;
320 for (i = 0; i < 2; ++i)