52 start = bytestream2_get_le16(gb);
53 count = bytestream2_get_le16(gb);
55 if (start + count > 256)
62 pal[start +
i] = (0xFF << 24
U) | bytestream2_get_be24u(gb);
79 for (
int y = 0; y < frame->
height; y += 2) {
80 for (
int x = 0; x < frame->
width; x += 2) {
81 int index = bytestream2_get_byteu(gb);
87 dst[x+l+1] = block[3];
114 for (
int y = 0; y < frame->
height; y += 2) {
115 for (
int x = 0; x < frame->
width; x += 2) {
120 codes = bytestream2_get_byteu(&sb);
125 index = bytestream2_get_byte(gb);
126 block = map + index * 4;
131 dst[x+l+1] = block[3];
148 const int w = frame->
width;
156 type = bytestream2_get_byte(gb);
162 dst = frame->
data[0];
163 for (
int y = 0; y <
h; y += 8) {
164 for (
int x = 0; x <
w; x += 8) {
165 int fill = bytestream2_get_byte(gb);
168 for (
int by = 0; by < 8; by++) {
169 memset(ddst, fill, 8);
179 int bsize = bytestream2_get_byte(gb);
186 count = bytestream2_get_be16(gb);
188 int mvx, mvy,
a,
b,
c, mx, my;
189 int bsize_w, bsize_h;
191 bsize_w = bsize_h = bsize;
194 mvx = bytestream2_get_byte(gb) * bsize;
195 mvy = bytestream2_get_byte(gb) * bsize;
196 a = bytestream2_get_byte(gb);
197 b = bytestream2_get_byte(gb);
198 c = ((a & 0x3F) << 8) +
b;
199 mx = mvx + (c & 0x7F) - 64;
200 my = mvy + (c >> 7) - 64;
202 if (mvy < 0 || mvy >= h)
205 if (mvx < 0 || mvx >= w)
208 if (my < 0 || my >= h)
211 if (mx < 0 || mx >= w)
214 dst = frame->
data[0] + mvx + l * mvy;
215 src = frame->
data[0] + mx + l * my;
217 bsize_w =
FFMIN3(bsize_w, w - mvx, w - mx);
218 bsize_h =
FFMIN3(bsize_h, h - mvy, h - my);
220 if (mvy >= my && (mvy != my || mvx >= mx)) {
221 src += (bsize_h - 1) * l;
222 dst += (bsize_h - 1) * l;
223 for (
int by = 0; by < bsize_h; by++) {
224 memmove(dst, src, bsize_w);
229 for (
int by = 0; by < bsize_h; by++) {
230 memmove(dst, src, bsize_w);
241 dst = frame->
data[0];
244 for (
int y = 0; y <
h; y++) {
250 dst = frame->
data[0];
251 for (
int y = 0; y <
h; y += 2) {
252 for (
int x = 0; x <
w; x += 2) {
253 int fill = bytestream2_get_byte(gb);
256 fill = (fill << 8) | fill;
257 for (
int by = 0; by < 2; by++) {
268 size = bytestream2_get_le16(gb);
270 int x = bytestream2_get_byte(gb) * 4;
271 int y = bytestream2_get_byte(gb) * 4;
272 int count = bytestream2_get_byte(gb);
273 int fill = bytestream2_get_byte(gb);
282 dst = frame->
data[0];
286 int count = bytestream2_get_byteu(gb);
287 int skip = count & 0x3F;
309 int bits = bytestream2_get_byte(gb);
311 for (
int i = 0;
i < 4;
i++) {
319 dst[
pos] = pos ? dst[pos - 1] : dst[-l + w - 1];
324 dst[
pos] = dst[pos - l];
327 dst[
pos] = bytestream2_get_byte(gb);
358 const int w = frame->
width;
360 const int l = frame->
linesize[0] / 4;
367 type = bytestream2_get_byte(gb);
373 dst = (uint32_t *)frame->
data[0];
374 for (
int y = 0; y + 12 <=
h; y += 12) {
375 for (
int x = 0; x + 12 <=
w; x += 12) {
376 int fill = bytestream2_get_be24(gb);
377 uint32_t *dstp = dst + x;
379 for (
int by = 0; by < 12; by++) {
380 for (
int bx = 0; bx < 12; bx++)
392 int bsize = bytestream2_get_byte(gb);
399 count = bytestream2_get_be16(gb);
401 int mvx, mvy,
a,
b,
c, mx, my;
402 int bsize_w, bsize_h;
404 bsize_w = bsize_h = bsize;
407 mvx = bytestream2_get_byte(gb) * bsize;
408 mvy = bytestream2_get_byte(gb) * bsize;
409 a = bytestream2_get_byte(gb);
410 b = bytestream2_get_byte(gb);
411 c = ((a & 0x3F) << 8) +
b;
412 mx = mvx + (c & 0x7F) - 64;
413 my = mvy + (c >> 7) - 64;
415 if (mvy < 0 || mvy >= h)
418 if (mvx < 0 || mvx >= w)
421 if (my < 0 || my >= h)
424 if (mx < 0 || mx >= w)
427 dst = (uint32_t *)frame->
data[0] + mvx + l * mvy;
428 src = (uint32_t *)frame->
data[0] + mx + l * my;
430 bsize_w =
FFMIN3(bsize_w, w - mvx, w - mx);
431 bsize_h =
FFMIN3(bsize_h, h - mvy, h - my);
433 if (mvy >= my && (mvy != my || mvx >= mx)) {
434 src += (bsize_h - 1) * l;
435 dst += (bsize_h - 1) * l;
436 for (
int by = 0; by < bsize_h; by++) {
437 memmove(dst, src, bsize_w * 4);
442 for (
int by = 0; by < bsize_h; by++) {
443 memmove(dst, src, bsize_w * 4);
454 osize = ((h + 3) / 4) * ((w + 3) / 4) + 7;
461 for (
int x = 0; x <
w; x += 4) {
462 for (
int y = 0; y <
h; y += 4) {
465 if (bits[di >> 3] & (1 << (di & 7))) {
466 int codes = bytestream2_get_byte(gb);
469 uint32_t *
src = (uint32_t *)frame->
data[0];
470 size_t src_size = l * (h - 1) + (w - 1);
471 int nv, v,
code = codes & 3;
475 dst = (uint32_t *)frame->
data[0] + pos + dy * l;
477 bcode = bytestream2_get_byte(gb);
479 for (
int j = 0; j < 4; j++) {
497 value = bytestream2_get_byte(gb);
501 dst[0] = src[av_clip(l * (dy + s->
mv1[nv][1]) + pos +
502 s->
mv1[nv][0], 0, src_size)];
515 for (
int j = 0; j < 4; j++) {
530 v = bytestream2_get_byte(gb);
532 dst[0] = src[av_clip(l * (dy + s->
mv0[v][1]) + pos +
533 s->
mv0[v][0], 0, src_size)];
535 dst[0] = ((v & 0x7F) << 17) | bytestream2_get_be16(gb);
566 const int w = frame->
width;
568 const int l = frame->
linesize[0] / 4;
573 int count = bytestream2_get_byte(gb);
574 int pixel = bytestream2_get_byte(gb);
586 dst[pos + y * l] =
pixel;
616 chunk = bytestream2_get_be32(gb);
618 case MKBETAG(
'P',
'A',
'L',
'8'):
619 for (
int y = 0; y < frame->
height; y++)
624 case MKBETAG(
'M',
'A',
'D',
'1'):
630 case MKBETAG(
'A',
'V',
'C',
'F'):
636 case MKBETAG(
'A',
'L',
'C',
'D'):
642 case MKBETAG(
'R',
'L',
'E',
'F'):
648 case MKBETAG(
'R',
'L',
'E',
'D'):
692 for (
int n = 0,
i = -4;
i < 4;
i++) {
693 for (
int j = -14; j < 2; j++) {
699 for (
int n = 0,
i = -5;
i <= 1;
i += 2) {
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int decode_mad1_24(AVCodecContext *avctx, AVFrame *frame)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
Memory handling functions.
static av_cold int init(AVCodecContext *avctx)
#define avpriv_request_sample(...)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
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)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
The exact code depends on how similar the blocks are and how related they are to the block
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
8 bits with AV_PIX_FMT_RGB32 palette
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
GLsizei GLboolean const GLfloat * value
static int decode_rle(AVCodecContext *avctx, AVFrame *frame)
static int decode_avcf(AVCodecContext *avctx, AVFrame *frame)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static av_cold int decode_close(AVCodecContext *avctx)
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
static int decode_alcd(AVCodecContext *avctx, AVFrame *frame)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * name
Name of the codec implementation.
common internal API header
static int decode_pal8(AVCodecContext *avctx, uint32_t *pal)
enum AVPictureType pict_type
Picture type of the frame.
static void decode_flush(AVCodecContext *avctx)
static av_cold int decode_init(AVCodecContext *avctx)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Libavcodec external API header.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
const VDPAUPixFmtMap * map
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
#define MKBETAG(a, b, c, d)
int key_frame
1 -> keyframe, 0-> not
static int decode_mad1(AVCodecContext *avctx, AVFrame *frame)
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.