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");
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;
174 buf_end = buf + buf_size;
177 while (buf_ptr < buf_end) {
179 &unescaped_buf_ptr, &unescaped_buf_size);
185 if (start_code >=
APP0 && start_code <=
APP15) {
189 switch (start_code) {
200 "quantization table decode error\n");
208 "huffman table decode error\n");
223 "SOF data decode error\n");
228 "Interlaced mode not supported in MxPEG\n");
236 "Can not process SOS without SOF data, skipping\n");
242 "First picture has no SOF, skipping\n");
247 "Non-key frame has no MXM, skipping\n");
271 if (!reference_ptr->
data[0] &&
309 return buf_ptr - buf;
321 for (i = 0; i < 2; ++i) {
uint8_t * completion_bitmask
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
This structure describes decoded (raw) audio or video data.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
static int mxpeg_check_dimensions(MXpegDecodeContext *s, MJpegDecodeContext *jpg, AVFrame *reference_ptr)
int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
MJPEG encoder and decoder.
static int mxpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static int get_bits_count(const GetBitContext *s)
static int init(AVCodecParserContext *s)
static int mxpeg_decode_mxm(MXpegDecodeContext *s, const uint8_t *buf_ptr, int buf_size)
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
static av_cold int mxpeg_decode_init(AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int mxpeg_decode_com(MXpegDecodeContext *s, const uint8_t *buf_ptr, int buf_size)
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, const AVFrame *reference)
common internal api header.
static av_cold int mxpeg_decode_end(AVCodecContext *avctx)
static int mxpeg_decode_app(MXpegDecodeContext *s, const uint8_t *buf_ptr, int buf_size)
int got_picture
we found a SOF and picture is valid, too.
int key_frame
1 -> keyframe, 0-> not
int ff_mjpeg_find_marker(MJpegDecodeContext *s, const uint8_t **buf_ptr, const uint8_t *buf_end, const uint8_t **unescaped_buf_ptr, int *unescaped_buf_size)
struct MXpegDecodeContext MXpegDecodeContext
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...