40 #define EA_PREAMBLE_SIZE 8
41 #define MADk_TAG MKTAG('M', 'A', 'D', 'k')
42 #define MADm_TAG MKTAG('M', 'A', 'D', 'm')
43 #define MADe_TAG MKTAG('M', 'A', 'D', 'e')
54 static void bswap16_buf(uint16_t *dst,
const uint16_t *src,
int count)
57 for (i=0; i<count; i++)
75 static inline void comp(
unsigned char *dst,
int dst_stride,
76 unsigned char *src,
int src_stride,
int add)
81 dst[j*dst_stride + i] = av_clip_uint8(src[j*src_stride + i] + add);
85 int j,
int mv_x,
int mv_y,
int add)
125 block[0] = (128 +
get_sbits(&s->
gb, 8)) * quant_matrix[0];
139 }
else if (level != 0) {
143 "ac-tex damaged at %d %d\n", s->
mb_x, s->
mb_y);
147 level = (level*quant_matrix[j]) >> 4;
162 "ac-tex damaged at %d %d\n", s->
mb_x, s->
mb_y);
168 level = (level*quant_matrix[j]) >> 4;
172 level = (level*quant_matrix[j]) >> 4;
212 for (j=0; j<6; j++) {
213 if (mv_map & (1<<j)) {
241 void *
data,
int *data_size,
244 const uint8_t *buf = avpkt->
data;
245 int buf_size = avpkt->
size;
254 chunk_type = bytestream2_get_le32(&gb);
259 bytestream2_get_le16(&gb), 1000, 1<<30);
261 s->
width = bytestream2_get_le16(&gb);
262 s->
height = bytestream2_get_le16(&gb);
static void decode_block_intra(MadContext *t, DCTELEM *block)
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const uint8_t ff_zigzag_direct[64]
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
av_cold void ff_mpeg12_init_vlcs(void)
#define DECLARE_ALIGNED(n, t, v)
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static void decode_mb(MadContext *t, int inter)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
static int get_sbits(GetBitContext *s, int n)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
struct MadContext MadContext
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void idct_put(MadContext *t, DCTELEM *block, int mb_x, int mb_y, int j)
bitstream reader API header.
uint8_t idct_permutation[64]
idct input permutation.
av_cold void dsputil_init(DSPContext *c, AVCodecContext *avctx)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
static int init(AVCodecParserContext *s)
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
const uint16_t ff_mpeg1_default_intra_matrix[64]
#define UPDATE_CACHE(name, gb)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
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.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
void(* idct_put)(uint8_t *dest, int line_size, DCTELEM *block)
block -> idct -> clip to unsigned 8 bit -> dest.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static av_cold int decode_end(AVCodecContext *avctx)
#define CLOSE_READER(name, gb)
void(* clear_block)(DCTELEM *block)
#define SKIP_BITS(name, gb, num)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int width
picture width / height.
struct AVFrame AVFrame
Audio Video Frame.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
static void bswap16_buf(uint16_t *dst, const uint16_t *src, int count)
#define LAST_SKIP_BITS(name, gb, num)
RL_VLC_ELEM * rl_vlc[32]
decoding only
#define SHOW_UBITS(name, gb, num)
static int decode210(GetBitContext *gb)
static av_always_inline int bytestream2_tell(GetByteContext *g)
static void comp_block(MadContext *t, int mb_x, int mb_y, int j, int mv_x, int mv_y, int add)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
const uint16_t ff_inv_aanscales[64]
main external API structure.
static void close(AVCodecParserContext *s)
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define OPEN_READER(name, gb)
static int decode_motion(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
DSPContext dsp
pointers for accelerated dsp functions
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
AAN (Arai Agui Nakajima) (I)DCT tables.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
struct AVCodecContext * avctx
#define SHOW_SBITS(name, gb, num)
static void calc_intra_matrix(MadContext *t, int qscale)
void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
#define FFSWAP(type, a, b)
unsigned int bitstream_buf_size
static av_cold int decode_init(AVCodecContext *avctx)