54 for (i = 0; i < 2; ++i)
79 const uint8_t *buf_ptr,
int buf_size)
91 const uint8_t *buf_ptr,
int buf_size)
93 unsigned bitmask_size, mb_count;
100 bitmask_size = (mb_count + 7) >> 3;
101 if (bitmask_size > buf_size - 12) {
103 "MXM bitmask is not complete\n");
112 "MXM bitmask memory allocation error\n");
120 "Completion bitmask memory allocation error\n");
127 memcpy(s->
mxm_bitmask, buf_ptr + 12, bitmask_size);
131 uint8_t completion_check = 0xFF;
132 for (i = 0; i < bitmask_size; ++i) {
143 const uint8_t *buf_ptr,
int buf_size)
149 if (len > 14 && len <= buf_size && !strncmp(buf_ptr + 2,
"MXM", 3)) {
163 "Picture dimensions stored in SOF and MXM mismatch\n");
167 if (reference_ptr->
data[0]) {
173 "Dimensions of current and reference picture mismatch\n");
183 void *
data,
int *got_frame,
187 int buf_size = avpkt->
size;
190 const uint8_t *buf_end, *buf_ptr;
191 const uint8_t *unescaped_buf_ptr;
192 int unescaped_buf_size;
197 buf_end = buf + buf_size;
200 while (buf_ptr < buf_end) {
202 &unescaped_buf_ptr, &unescaped_buf_size);
208 if (start_code >=
APP0 && start_code <=
APP15) {
212 switch (start_code) {
223 "quantization table decode error\n");
231 "huffman table decode error\n");
246 "SOF data decode error\n");
251 "Interlaced mode not supported in MxPEG\n");
259 "Can not process SOS without SOF data, skipping\n");
265 "First picture has no SOF, skipping\n");
270 "Non-key frame has no MXM, skipping\n");
294 if (!reference_ptr->
data[0] &&
336 return buf_ptr - buf;
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.
#define AV_LOG_WARNING
Something somehow does not look correct.
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)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int get_bits_count(const GetBitContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int mxpeg_decode_mxm(MXpegDecodeContext *s, const uint8_t *buf_ptr, int buf_size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
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.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static av_cold int mxpeg_decode_init(AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
static void close(AVCodecParserContext *s)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
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 av_cold int init(AVCodecParserContext *s)
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)
This structure stores compressed data.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...