Go to the documentation of this file.
51 start = bytestream2_get_le16(gb);
52 count = bytestream2_get_le16(gb);
54 if (start + count > 256)
60 for (
int i = 0;
i < count;
i++)
61 pal[start +
i] = (0xFFU << 24) | bytestream2_get_be24u(gb);
70 const int l =
frame->linesize[0];
72 uint8_t *dst =
frame->data[0];
78 for (
int y = 0; y <
frame->height; y += 2) {
79 for (
int x = 0; x <
frame->width; x += 2) {
80 int index = bytestream2_get_byteu(gb);
86 dst[x+l+1] =
block[3];
89 dst +=
frame->linesize[0] * 2;
100 const int l =
frame->linesize[0];
102 uint8_t *dst =
frame->data[0];
113 for (
int y = 0; y <
frame->height; y += 2) {
114 for (
int x = 0; x <
frame->width; x += 2) {
115 const uint8_t *
block;
119 codes = bytestream2_get_byteu(&sb);
124 index = bytestream2_get_byte(gb);
130 dst[x+l+1] =
block[3];
137 dst +=
frame->linesize[0] * 2;
147 const int w =
frame->width;
148 const int h =
frame->height;
149 const int l =
frame->linesize[0];
155 type = bytestream2_get_byte(gb);
161 dst =
frame->data[0];
162 for (
int y = 0; y <
h; y += 8) {
163 for (
int x = 0; x <
w; x += 8) {
164 int fill = bytestream2_get_byte(gb);
165 uint8_t *ddst = dst + x;
167 for (
int by = 0; by < 8; by++) {
168 memset(ddst, fill, 8);
178 int bsize = bytestream2_get_byte(gb);
185 count = bytestream2_get_be16(gb);
187 int mvx, mvy,
a,
b,
c, mx, my;
188 int bsize_w, bsize_h;
190 bsize_w = bsize_h = bsize;
193 mvx = bytestream2_get_byte(gb) * bsize;
194 mvy = bytestream2_get_byte(gb) * bsize;
195 a = bytestream2_get_byte(gb);
196 b = bytestream2_get_byte(gb);
197 c = ((
a & 0x3F) << 8) +
b;
198 mx = mvx + (
c & 0x7F) - 64;
199 my = mvy + (
c >> 7) - 64;
201 if (mvy < 0 || mvy >=
h)
204 if (mvx < 0 || mvx >=
w)
207 if (my < 0 || my >=
h)
210 if (mx < 0 || mx >=
w)
213 dst =
frame->data[0] + mvx + l * mvy;
216 bsize_w =
FFMIN3(bsize_w,
w - mvx,
w - mx);
217 bsize_h =
FFMIN3(bsize_h,
h - mvy,
h - my);
219 if (mvy >= my && (mvy != my || mvx >= mx)) {
220 src += (bsize_h - 1) * l;
221 dst += (bsize_h - 1) * l;
222 for (
int by = 0; by < bsize_h; by++) {
223 memmove(dst,
src, bsize_w);
228 for (
int by = 0; by < bsize_h; by++) {
229 memmove(dst,
src, bsize_w);
240 dst =
frame->data[0];
243 for (
int y = 0; y <
h; y++) {
249 dst =
frame->data[0];
250 for (
int y = 0; y <
h; y += 2) {
251 for (
int x = 0; x <
w; x += 2) {
252 int fill = bytestream2_get_byte(gb);
253 uint8_t *ddst = dst + x;
255 fill = (fill << 8) | fill;
256 for (
int by = 0; by < 2; by++) {
267 size = bytestream2_get_le16(gb);
269 int x = bytestream2_get_byte(gb) * 4;
270 int y = bytestream2_get_byte(gb) * 4;
271 int count = bytestream2_get_byte(gb);
272 int fill = bytestream2_get_byte(gb);
275 for (
int i = 0;
i < count;
i++)
281 dst =
frame->data[0];
285 int count = bytestream2_get_byteu(gb);
286 int skip = count & 0x3F;
308 int bits = bytestream2_get_byte(gb);
310 for (
int i = 0;
i < 4;
i++) {
318 dst[
pos] =
pos ? dst[
pos - 1] : dst[-l +
w - 1];
326 dst[
pos] = bytestream2_get_byte(gb);
357 const int w =
frame->width;
358 const int h =
frame->height;
359 const int l =
frame->linesize[0] / 4;
366 type = bytestream2_get_byte(gb);
372 dst = (uint32_t *)
frame->data[0];
373 for (
int y = 0; y + 12 <=
h; y += 12) {
374 for (
int x = 0; x + 12 <=
w; x += 12) {
375 int fill = bytestream2_get_be24(gb);
376 uint32_t *dstp = dst + x;
378 for (
int by = 0; by < 12; by++) {
379 for (
int bx = 0; bx < 12; bx++)
391 int bsize = bytestream2_get_byte(gb);
398 count = bytestream2_get_be16(gb);
400 int mvx, mvy,
a,
b,
c, mx, my;
401 int bsize_w, bsize_h;
403 bsize_w = bsize_h = bsize;
406 mvx = bytestream2_get_byte(gb) * bsize;
407 mvy = bytestream2_get_byte(gb) * bsize;
408 a = bytestream2_get_byte(gb);
409 b = bytestream2_get_byte(gb);
410 c = ((
a & 0x3F) << 8) +
b;
411 mx = mvx + (
c & 0x7F) - 64;
412 my = mvy + (
c >> 7) - 64;
414 if (mvy < 0 || mvy >=
h)
417 if (mvx < 0 || mvx >=
w)
420 if (my < 0 || my >=
h)
423 if (mx < 0 || mx >=
w)
426 dst = (uint32_t *)
frame->data[0] + mvx + l * mvy;
427 src = (uint32_t *)
frame->data[0] + mx + l * my;
429 bsize_w =
FFMIN3(bsize_w,
w - mvx,
w - mx);
430 bsize_h =
FFMIN3(bsize_h,
h - mvy,
h - my);
432 if (mvy >= my && (mvy != my || mvx >= mx)) {
433 src += (bsize_h - 1) * l;
434 dst += (bsize_h - 1) * l;
435 for (
int by = 0; by < bsize_h; by++) {
436 memmove(dst,
src, bsize_w * 4);
441 for (
int by = 0; by < bsize_h; by++) {
442 memmove(dst,
src, bsize_w * 4);
453 osize = ((
h + 3) / 4) * ((
w + 3) / 4) + 7;
460 for (
int x = 0; x <
w; x += 4) {
461 for (
int y = 0; y <
h; y += 4) {
464 if (
bits[di >> 3] & (1 << (di & 7))) {
465 int codes = bytestream2_get_byte(gb);
467 for (
int count = 0; count < 4; count++) {
468 uint32_t *
src = (uint32_t *)
frame->data[0];
469 size_t src_size = l * (
h - 1) + (
w - 1);
470 int nv, v,
code = codes & 3;
474 dst = (uint32_t *)
frame->data[0] +
pos + dy * l;
476 bcode = bytestream2_get_byte(gb);
478 for (
int j = 0; j < 4; j++) {
496 value = bytestream2_get_byte(gb);
501 s->mv1[nv][0], 0, src_size)];
514 for (
int j = 0; j < 4; j++) {
529 v = bytestream2_get_byte(gb);
532 s->mv0[v][0], 0, src_size)];
534 dst[0] = ((v & 0x7F) << 17) | bytestream2_get_be16(gb);
565 const int w =
frame->width;
566 const int h =
frame->height;
567 const int l =
frame->linesize[0];
568 uint8_t *dst =
frame->data[0];
572 int count = bytestream2_get_byte(gb);
573 int pixel = bytestream2_get_byte(gb);
618 chunk = bytestream2_get_be32(gb);
620 case MKBETAG(
'P',
'A',
'L',
'8'):
621 for (
int y = 0; y <
frame->height; y++)
626 case MKBETAG(
'M',
'A',
'D',
'1'):
632 case MKBETAG(
'A',
'V',
'C',
'F'):
638 case MKBETAG(
'A',
'L',
'C',
'D'):
644 case MKBETAG(
'R',
'L',
'E',
'F'):
650 case MKBETAG(
'R',
'L',
'E',
'D'):
671 frame->key_frame =
s->key;
699 for (
int n = 0,
i = -4;
i < 4;
i++) {
700 for (
int j = -14; j < 2; j++) {
706 for (
int n = 0,
i = -5;
i <= 1;
i += 2) {
static av_cold int decode_close(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...
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
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static void decode_flush(AVCodecContext *avctx)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
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 type
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int decode_avcf(AVCodecContext *avctx, AVFrame *frame)
static void flush(AVCodecContext *avctx)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int decode_rle(AVCodecContext *avctx, AVFrame *frame)
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
static int decode_mad1(AVCodecContext *avctx, AVFrame *frame)
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
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define MKBETAG(a, b, c, d)
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
static int decode_alcd(AVCodecContext *avctx, AVFrame *frame)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define i(width, name, range_min, range_max)
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
#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_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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 default value
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int decode_pal8(AVCodecContext *avctx, uint32_t *pal)
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
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.
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
main external API structure.
static int decode_mad1_24(AVCodecContext *avctx, AVFrame *frame)
@ AV_PICTURE_TYPE_P
Predicted.
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
#define avpriv_request_sample(...)
const VDPAUPixFmtMap * map
This structure stores compressed data.
const AVCodec ff_argo_decoder
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static av_cold int decode_init(AVCodecContext *avctx)