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));
414 frame->
key_frame = !!bytestream2_get_le16(gb);
422 type = bytestream2_get_le16(gb);
423 size = bytestream2_get_le16(gb);
430 }
else if (type == 2){
440 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];
520 memcpy(ddst, ssrc, avctx->
width * s->
bpp);
582 for (i = 0; i < s->
yb; i++) {
583 for (j = 0; j < s->
xb; j++) {
584 if (i != (s->
yb - 1) || j != (s->
xb - 1)) {
585 if (i == s->
yb - 1) {
589 }
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...
The exact code depends on how similar the blocks are and how related they are to the block
static av_cold int decode_close(AVCodecContext *avctx)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
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 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...
const char * name
Name of the codec implementation.
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
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)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.