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);
108 opcode = bytestream2_peek_byte(gb);
112 if (!bytestream2_peek_byte(gb)) {
118 opcode += bytestream2_get_byte(gb) + 15;
120 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
121 for (i = opcode - 1; i > 0; --
i)
122 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
123 opcode = bytestream2_peek_byte(gb);
126 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
131 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
132 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
133 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
139 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
142 opcode = bytestream2_peek_byte(gb);
149 if (opcode >= 0x40) {
151 pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb);
152 len = (opcode >> 5) - 1;
157 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
158 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
160 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
170 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
173 opcode = bytestream2_peek_byte(gb);
176 }
else if (opcode < 0x20) {
182 if (!bytestream2_peek_byte(gb)) {
188 len += bytestream2_get_byte(gb) + 31;
190 i = bytestream2_get_le16(gb);
191 pos = - (i >> 2) - 1;
197 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
198 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
200 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
204 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
205 for (len = len - 2;
len; --
len)
206 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
213 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
216 opcode = bytestream2_peek_byte(gb);
221 pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb);
226 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
227 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
233 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
236 opcode = bytestream2_peek_byte(gb);
242 if (!bytestream2_peek_byte(gb)) {
248 len += bytestream2_get_byte(gb) + 7;
250 i = bytestream2_get_le16(gb);
252 pos = pos - (i >> 2);
261 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
262 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
264 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
268 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
269 for (len = len - 2;
len; --
len)
270 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
278 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
281 opcode = bytestream2_peek_byte(gb);
290 unsigned opcode = 0,
len;
299 opcode = bytestream2_get_byte(gb);
300 high = opcode >= 0x20;
305 opcode = bytestream2_get_byte(gb);
321 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
322 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
329 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
336 opcode = bytestream2_get_byte(gb);
341 pos = -(opcode | 32 * bytestream2_get_byte(gb)) - 1;
343 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
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(gb));
353 pos = (-((opcode & 0x1F) | 32 * bytestream2_get_byte(gb)) - 1);
355 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
356 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
357 len = (opcode >> 5) - 1;
359 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
365 if (!bytestream2_peek_byte(gb)) {
371 len += bytestream2_get_byte(gb) + 31;
373 pos = -bytestream2_get_byte(gb);
379 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
380 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
381 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
383 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
387 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
411 key_frame = !!bytestream2_get_le16(gb);
418 type = bytestream2_get_le16(gb);
419 size = bytestream2_get_le16(gb);
426 }
else if (type == 2){
442 memcpy(dst, src, avctx->
width * s->
bpp);
447 unsigned block, nb_blocks;
453 for (block = 0; block < s->
nb_blocks; block++)
456 nb_blocks = bytestream2_get_le16(gb);
462 type = bytestream2_get_le16(gb);
463 for (block = 0; block < nb_blocks; block++) {
467 offset = bytestream2_get_le16(gb);
471 size = bytestream2_get_le16(gb);
478 }
else if (type == 2){
491 src = (
const uint32_t *)s->
pbuffer;
492 dst = (uint32_t *)s->
buffer;
494 for (block = 0, y = 0; y < s->
yb; y++) {
496 uint32_t *
rect = dst;
498 for (x = 0; x < s->
xb; x++) {
504 for (k = 0; k < block_h; k++) {
505 uint32_t *column = dst;
506 for (l = 0; l < block_w; l++)
514 dst = &rect[block_h * s->
stride];
526 memcpy(ddst, ssrc, avctx->
width * s->
bpp);
588 for (i = 0; i < s->
yb; i++) {
589 for (j = 0; j < s->
xb; j++) {
590 if (i != (s->
yb - 1) || j != (s->
xb - 1)) {
591 if (i == s->
yb - 1) {
595 }
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.
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)
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).
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
#define i(width, name, range_min, range_max)
#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...
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
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.