34 #include "libavutil/intreadwrite.h"
39 #define MM_PREAMBLE_SIZE 6
41 #define MM_TYPE_INTER 0x5
42 #define MM_TYPE_INTRA 0x8
43 #define MM_TYPE_INTRA_HH 0xc
44 #define MM_TYPE_INTER_HH 0xd
45 #define MM_TYPE_INTRA_HHV 0xe
46 #define MM_TYPE_INTER_HHV 0xf
47 #define MM_TYPE_PALETTE 0x31
74 for (i = 0; i < 128; i++) {
75 s->
palette[i] = 0xFF
U << 24 | bytestream2_get_be24(&s->
gb);
91 int run_length,
color;
96 color = bytestream2_get_byte(&s->
gb);
100 run_length = (color & 0x7f) + 2;
101 color = bytestream2_get_byte(&s->
gb);
132 int data_off = bytestream2_get_le16(&s->
gb),
y = 0;
141 int length = bytestream2_get_byte(&s->
gb);
142 int x = bytestream2_get_byte(&s->
gb) + ((length & 0x80) << 1);
154 int replace_array = bytestream2_get_byte(&s->
gb);
156 int replace = (replace_array >> (7-j)) & 1;
160 int color = bytestream2_get_byte(&data_ptr);
181 void *
data,
int *got_frame,
185 int buf_size = avpkt->
size;
static int mm_decode_pal(MmContext *s)
This structure describes decoded (raw) audio or video data.
static int mm_decode_intra(MmContext *s, int half_horiz, int half_vert)
static av_cold int init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
static int mm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
const char * name
Name of the codec implementation.
int av_frame_ref(AVFrame *dst, AVFrame *src)
Setup a new reference to the data described by a given frame.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int palette[AVPALETTE_COUNT]
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#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)
static av_cold int mm_decode_end(AVCodecContext *avctx)
Libavcodec external API header.
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
Identical in function to av_frame_make_writable(), except it uses ff_get_buffer() to allocate the buf...
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int width
picture width / height.
#define MM_TYPE_INTRA_HHV
AVCodec ff_mmvideo_decoder
static int mm_decode_inter(MmContext *s, int half_horiz, int half_vert)
main external API structure.
static void close(AVCodecParserContext *s)
static av_cold int mm_decode_init(AVCodecContext *avctx)
const uint8_t * buffer_start
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define MM_TYPE_INTER_HHV
common internal api header.
#define AVERROR_INVALIDDATA
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
8 bit with PIX_FMT_RGB32 palette
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.