41 void *
data,
int *got_frame,
45 int buf_size = avpkt->
size;
47 const uint8_t *buf_end, *buf_ptr;
49 uint32_t dqt_offs, dht_offs, sof_offs, sos_offs, second_field_offs;
50 uint32_t field_size, sod_offs;
54 buf_end = buf + buf_size;
62 if (buf_end - buf_ptr >= 1 << 28)
78 second_field_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"second_field_offs is %d and size is %d\n");
81 dqt_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"dqt is %d and size is %d\n");
85 init_get_bits(&s->
gb, buf_ptr+dqt_offs, (buf_end - (buf_ptr+dqt_offs))*8);
92 dht_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"dht is %d and size is %d\n");
96 init_get_bits(&s->
gb, buf_ptr+dht_offs, (buf_end - (buf_ptr+dht_offs))*8);
101 sof_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"sof is %d and size is %d\n");
105 init_get_bits(&s->
gb, buf_ptr+sof_offs, (buf_end - (buf_ptr+sof_offs))*8);
111 sos_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"sos is %d and size is %d\n");
113 sod_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"sof is %d and size is %d\n");
118 8 *
FFMIN(field_size, buf_end - buf_ptr - sos_offs));
131 buf_ptr = buf + second_field_offs;
132 second_field_offs = 0;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
int qscale[4]
quantizer scale calculated from quant_matrixes
int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
MJPEG encoder and decoder.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
AVCodec ff_mjpegb_decoder
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.
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. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static int read_header(FFV1Context *f)
static int mjpegb_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Libavcodec external API header.
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.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, const AVFrame *reference)
static av_cold int init(AVCodecParserContext *s)
#define MKBETAG(a, b, c, d)
static uint32_t read_offs(AVCodecContext *avctx, GetBitContext *gb, uint32_t size, const char *err_msg)
This structure stores compressed data.