27 #include "libavutil/intreadwrite.h"
49 if (width != avctx->
width || height != avctx->
height)
69 mask = bytestream2_get_be16u(gb);
70 v[0] = bytestream2_get_be16u(gb);
71 v[1] = bytestream2_get_be16u(gb);
72 if ((v[0] & 0x8000)) {
77 for (i = 2; i < 8; i++)
78 v[i] = bytestream2_get_be16u(gb);
80 v[2] = v[4] = v[6] = v[0];
81 v[3] = v[5] = v[7] = v[1];
84 #define PIX16(target, true, false) \
85 i = (mask & target) ? true : false; \
86 AV_WN16A(dst, (v[i] & 0x7C00) | (v[i] & 0x3E0) | (v[i] & 0x1F)); \
89 #define ROW16(row, a1, a0, b1, b0) \
90 dst = dst_start + (y + row) * linesize + x * 2; \
91 PIX16(1 << (row * 4), a1, a0) \
92 PIX16(1 << (row * 4 + 1), a1, a0) \
93 PIX16(1 << (row * 4 + 2), b1, b0) \
94 PIX16(1 << (row * 4 + 3), b1, b0)
116 for (j = 0; j < 4; j++)
117 for (i = 0; i < 4; i++)
118 AV_WN32A(dst + j * linesize + i * 4, pixel);
121 #define PIX32(target, true, false) \
122 AV_WN32A(dst, (mask & target) ? v[true] : v[false]); \
125 #define ROW32(row, a1, a0, b1, b0) \
126 dst = dst_start + (y + row) * linesize + x * 4; \
127 PIX32(1 << (row * 4), a1, a0) \
128 PIX32(1 << (row * 4 + 1), a1, a0) \
129 PIX32(1 << (row * 4 + 2), b1, b0) \
130 PIX32(1 << (row * 4 + 3), b1, b0)
133 ROW32(0, 1, 0, 3, 2); \
134 ROW32(1, 1, 0, 3, 2); \
135 ROW32(2, 5, 4, 7, 6); \
136 ROW32(3, 5, 4, 7, 6);
141 uint32_t
color[128],
v[8];
142 int w, h, nb_colors, i, x,
y, p0, p1,
mask;
147 w = bytestream2_get_be16u(gb);
148 h = bytestream2_get_be16u(gb);
149 if ((w & ~3) != width || (h & ~3) != height)
152 if (bytestream2_get_byteu(gb)) {
157 nb_colors = bytestream2_get_byteu(gb);
160 for (i = 0; i <
FFMIN(nb_colors, 128); i++)
161 color[i] = 0xFF000000 | bytestream2_get_be24u(gb);
166 dst_start += (height - 1) * linesize;
167 linesize = -linesize;
171 p0 = bytestream2_get_byteu(gb);
175 p0 = (p0 << 2) | (p0 >> 4);
176 set_4x4_block(dst_start + y * linesize + x * 4, linesize, 0xFF000000 | (p0 << 16) | (p0 << 8) | p0);
180 p0 = (p0 << 2) | (p0 >> 4);
183 g = bytestream2_get_byteu(gb);
184 r = bytestream2_get_byteu(gb);
185 set_4x4_block(dst_start + y * linesize + x * 4, linesize, 0xFF000000 | (r << 16) | (g << 8) | p0);
190 p1 = bytestream2_get_byteu(gb);
192 if ((p0 & 0x7F) == (p1 & 0x7F)) {
193 set_4x4_block(dst_start + y * linesize + x * 4, linesize, color[p0 & 0x7F]);
197 v[0] = v[2] = v[4] = v[6] = color[p0 & 0x7F];
198 v[1] = v[3] = v[5] = v[7] = color[p1 & 0x7F];
199 mask = bytestream2_get_le16u(gb);
205 v[0] = color[p0 & 0x7F];
206 v[1] = color[p1 & 0x7F];
207 for (i = 2; i < 8; i++)
208 v[i] = color[bytestream2_get_byteu(gb) & 0x7F];
209 mask = bytestream2_get_le16u(gb);
226 void *
data,
int *got_frame,
260 #if CONFIG_MVC1_DECODER
274 #if CONFIG_MVC2_DECODER
#define AVERROR_PATCHWELCOME
This structure describes decoded (raw) audio or video data.
static void set_4x4_block(uint8_t *dst, int linesize, uint32_t pixel)
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_cold int init(AVCodecContext *avctx)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define AV_PIX_FMT_RGB555
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
#define ROW16(row, a1, a0, b1, b0)
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.
static int mvc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const uint16_t mask[17]
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. ...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static av_cold int mvc_decode_init(AVCodecContext *avctx)
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
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...
int width
picture width / height.
static int decode_mvc2(AVCodecContext *avctx, GetByteContext *gb, uint8_t *dst_start, int width, int height, int linesize, int vflip)
static av_cold int mvc_decode_end(AVCodecContext *avctx)
main external API structure.
static void close(AVCodecParserContext *s)
BYTE int const BYTE int int int height
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
common internal api header.
static int decode_mvc1(AVCodecContext *avctx, GetByteContext *gb, uint8_t *dst_start, int width, int height, int linesize)
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
#define AVERROR_INVALIDDATA
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.