31 #define BLOCK_HEIGHT 112u
32 #define BLOCK_WIDTH 84u
56 unsigned repeat = 0, first = 1, opcode = 0;
65 if (bytestream2_peek_byte(gb) > 17) {
66 len = bytestream2_get_byte(gb) - 17;
69 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
72 opcode = bytestream2_peek_byte(gb);
76 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
79 opcode = bytestream2_peek_byte(gb);
82 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
87 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
88 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
89 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
95 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
98 opcode = bytestream2_peek_byte(gb);
109 opcode = bytestream2_peek_byte(gb);
113 if (!bytestream2_peek_byte(gb)) {
119 opcode += bytestream2_get_byte(gb) + 15;
121 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
122 for (i = opcode - 1; i > 0; --i)
123 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
124 opcode = bytestream2_peek_byte(gb);
127 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
132 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
133 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
134 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
140 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
143 opcode = bytestream2_peek_byte(gb);
150 if (opcode >= 0x40) {
152 pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb);
153 len = (opcode >> 5) - 1;
158 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
159 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
161 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
171 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
174 opcode = bytestream2_peek_byte(gb);
177 }
else if (opcode < 0x20) {
183 if (!bytestream2_peek_byte(gb)) {
189 len += bytestream2_get_byte(gb) + 31;
191 i = bytestream2_get_le16(gb);
192 pos = - (i >> 2) - 1;
198 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
199 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
201 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
205 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
206 for (len = len - 2;
len; --
len)
207 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
214 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
217 opcode = bytestream2_peek_byte(gb);
222 pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb);
227 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
228 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
234 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
237 opcode = bytestream2_peek_byte(gb);
243 if (!bytestream2_peek_byte(gb)) {
249 len += bytestream2_get_byte(gb) + 7;
251 i = bytestream2_get_le16(gb);
253 pos = pos - (i >> 2);
262 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
263 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
265 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
269 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
270 for (len = len - 2;
len; --
len)
271 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
279 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
282 opcode = bytestream2_peek_byte(gb);
291 unsigned opcode = 0,
len;
300 opcode = bytestream2_get_byte(gb);
301 high = opcode >= 0x20;
306 opcode = bytestream2_get_byte(gb);
322 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
323 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
330 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
337 opcode = bytestream2_get_byte(gb);
342 pos = -(opcode | 32 * bytestream2_get_byte(gb)) - 1;
344 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
345 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
346 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
347 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
354 pos = (-((opcode & 0x1F) | 32 * bytestream2_get_byte(gb)) - 1);
356 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
357 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
358 len = (opcode >> 5) - 1;
360 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
366 if (!bytestream2_peek_byte(gb)) {
372 len += bytestream2_get_byte(gb) + 31;
374 pos = -bytestream2_get_byte(gb);
380 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
381 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
382 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
384 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
388 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
411 frame->
key_frame = !!bytestream2_get_le16(gb);
419 type = bytestream2_get_le16(gb);
420 size = bytestream2_get_le16(gb);
427 }
else if (type == 2){
437 memcpy(dst, src, avctx->
width * s->
bpp);
442 unsigned block, nb_blocks;
448 for (block = 0; block < s->
nb_blocks; block++)
451 nb_blocks = bytestream2_get_le16(gb);
457 type = bytestream2_get_le16(gb);
458 for (block = 0; block < nb_blocks; block++) {
462 offset = bytestream2_get_le16(gb);
466 size = bytestream2_get_le16(gb);
473 }
else if (type == 2){
486 src = (
const uint32_t *)s->
pbuffer;
487 dst = (uint32_t *)s->
buffer;
489 for (block = 0, y = 0; y < s->
yb; y++) {
491 uint32_t *
rect = dst;
493 for (x = 0; x < s->
xb; x++) {
499 for (k = 0; k < block_h; k++) {
500 uint32_t *column = dst;
501 for (l = 0; l < block_w; l++)
509 dst = &rect[block_h * s->
stride];
515 memcpy(ddst, ssrc, avctx->
width * s->
bpp);
577 for (i = 0; i < s->
yb; i++) {
578 for (j = 0; j < s->
xb; j++) {
579 if (i != (s->
yb - 1) || j != (s->
xb - 1)) {
580 if (i == s->
yb - 1) {
584 }
else if (j == s->
xb - 1) {
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static av_cold int init(AVCodecContext *avctx)
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
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)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
static av_cold int decode_init(AVCodecContext *avctx)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
static av_cold int decode_close(AVCodecContext *avctx)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int decode_type2(GetByteContext *gb, PutByteContext *pb)
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. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
const char * name
Name of the codec implementation.
static const uint8_t offset[127][2]
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
packed RGB 8:8:8, 24bpp, BGRBGR...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_always_inline int bytestream2_tell(GetByteContext *g)
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static int decode_type1(GetByteContext *gb, PutByteContext *pb)
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
int key_frame
1 -> keyframe, 0-> not
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.