54 for (i = 0; i < 2; ++i)
80 const uint8_t *buf_ptr,
int buf_size)
92 const uint8_t *buf_ptr,
int buf_size)
94 unsigned bitmask_size, mb_count;
101 bitmask_size = (mb_count + 7) >> 3;
102 if (bitmask_size > buf_size - 12) {
104 "MXM bitmask is not complete\n");
114 "MXM bitmask memory allocation error\n");
122 "Completion bitmask memory allocation error\n");
129 memcpy(s->
mxm_bitmask, buf_ptr + 12, bitmask_size);
133 uint8_t completion_check = 0xFF;
134 for (i = 0; i < bitmask_size; ++i) {
145 const uint8_t *buf_ptr,
int buf_size)
151 if (len > 14 && len <= buf_size && !strncmp(buf_ptr + 2,
"MXM", 3)) {
165 "Picture dimensions stored in SOF and MXM mismatch\n");
169 if (reference_ptr->
data[0]) {
175 "Dimensions of current and reference picture mismatch\n");
185 void *
data,
int *got_frame,
189 int buf_size = avpkt->
size;
192 const uint8_t *buf_end, *buf_ptr;
193 const uint8_t *unescaped_buf_ptr;
194 int unescaped_buf_size;
199 buf_end = buf + buf_size;
202 while (buf_ptr < buf_end) {
204 &unescaped_buf_ptr, &unescaped_buf_size);
210 if (start_code >=
APP0 && start_code <=
APP15) {
214 switch (start_code) {
225 "quantization table decode error\n");
233 "huffman table decode error\n");
248 "SOF data decode error\n");
253 "Interlaced mode not supported in MxPEG\n");
261 "Can not process SOS without SOF data, skipping\n");
267 "First picture has no SOF, skipping\n");
272 "Non-key frame has no MXM, skipping\n");
294 if (!reference_ptr->
data[0] &&
334 return buf_ptr -
buf;