55 const uint8_t *buf_ptr,
int buf_size)
67 const uint8_t *buf_ptr,
int buf_size)
69 unsigned bitmask_size, mb_count;
76 bitmask_size = (mb_count + 7) >> 3;
77 if (bitmask_size > buf_size - 12) {
79 "MXM bitmask is not complete\n");
89 "MXM bitmask memory allocation error\n");
97 "Completion bitmask memory allocation error\n");
104 memcpy(s->
mxm_bitmask, buf_ptr + 12, bitmask_size);
108 uint8_t completion_check = 0xFF;
109 for (i = 0; i < bitmask_size; ++i) {
120 const uint8_t *buf_ptr,
int buf_size)
126 if (len > 14 && len <= buf_size && !strncmp(buf_ptr + 2,
"MXM", 3)) {
140 "Picture dimensions stored in SOF and MXM mismatch\n");
144 if (reference_ptr->
data[0]) {
150 "Dimensions of current and reference picture mismatch\n");
160 void *
data,
int *got_frame,
164 int buf_size = avpkt->
size;
167 const uint8_t *buf_end, *buf_ptr;
168 const uint8_t *unescaped_buf_ptr;
169 int unescaped_buf_size;
175 buf_end = buf + buf_size;
178 while (buf_ptr < buf_end) {
180 &unescaped_buf_ptr, &unescaped_buf_size);
186 if (start_code >=
APP0 && start_code <=
APP15) {
190 switch (start_code) {
201 "quantization table decode error\n");
209 "huffman table decode error\n");
224 "SOF data decode error\n");
229 "Interlaced mode not supported in MxPEG\n");
237 "Can not process SOS without SOF data, skipping\n");
243 "First picture has no SOF, skipping\n");
248 "Non-key frame has no MXM, skipping\n");
272 if (!reference_ptr->
data[0] &&
310 return buf_ptr - buf;
322 for (i = 0; i < 2; ++i) {