Go to the documentation of this file.
46 const uint8_t *buf = avpkt->
data;
47 int buf_size = avpkt->
size;
49 const uint8_t *buf_end, *buf_ptr;
51 uint32_t dqt_offs, dht_offs, sof_offs, sos_offs, second_field_offs;
52 uint32_t field_size, sod_offs;
56 buf_end = buf + buf_size;
58 s->adobe_transform = -1;
59 s->buf_size = buf_size;
63 s->restart_interval = 0;
65 s->mjpb_skiptosod = 0;
80 second_field_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"second_field_offs is %d and size is %d\n");
84 dqt_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"dqt is %d and size is %d\n");
87 init_get_bits(&
s->gb, buf_ptr+dqt_offs, (buf_end - (buf_ptr+dqt_offs))*8);
94 dht_offs =
read_offs(avctx, &hgb, buf_end - buf_ptr,
"dht is %d and size is %d\n");
97 init_get_bits(&
s->gb, buf_ptr+dht_offs, (buf_end - (buf_ptr+dht_offs))*8);
102 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);
106 s->start_code =
SOF0;
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");
117 8 *
FFMIN(field_size, buf_end - buf_ptr - sos_offs));
118 s->mjpb_skiptosod = (sod_offs - sos_offs -
show_bits(&
s->gb, 16));
130 s->bottom_field ^= 1;
132 if (
s->bottom_field !=
s->interlace_polarity && second_field_offs) {
133 buf_ptr = buf + second_field_offs;
140 if(!
s->got_picture) {
152 FFMAX3(
s->qscale[0],
s->qscale[1],
s->qscale[2]));
173 .
p.
name =
"media100",
184 .bsfs =
"media100_to_mjpegb",
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_EF_EXPLODE
abort decoding on minor error detection
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_left(GetBitContext *gb)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
This structure describes decoded (raw) audio or video data.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void skip_bits(GetBitContext *s, int n)
int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
AVCodec p
The public AVCodec.
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
enum AVDiscard skip_frame
Skip decoding for selected frames.
const FFCodec ff_media100_decoder
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
const FFCodec ff_mjpegb_decoder
#define FF_CODEC_DECODE_CB(func)
int(* init)(AVBSFContext *ctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
#define CODEC_LONG_NAME(str)
@ AVDISCARD_ALL
discard all
static int read_header(FFV1Context *f)
static uint32_t read_offs(AVCodecContext *avctx, GetBitContext *gb, uint32_t size, const char *err_msg)
int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
static int mjpegb_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, int mb_bitmask_size, const AVFrame *reference)
#define MKBETAG(a, b, c, d)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
const char * name
Name of the codec implementation.
main external API structure.
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
This structure stores compressed data.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.