FFmpeg
Macros | Functions
mpegpicture.c File Reference
#include <stdint.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "motion_est.h"
#include "mpegpicture.h"
#include "mpegutils.h"

Go to the source code of this file.

Macros

#define MAKE_WRITABLE(table)
 
#define EMU_EDGE_HEIGHT   (4 * 70)
 
#define UPDATE_TABLE(table)
 

Functions

static int make_tables_writable (Picture *pic)
 
int ff_mpeg_framesize_alloc (AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize)
 
static int alloc_frame_buffer (AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ScratchpadContext *sc, int chroma_x_shift, int chroma_y_shift, int linesize, int uvlinesize)
 Allocate a frame buffer. More...
 
static int alloc_picture_tables (AVCodecContext *avctx, Picture *pic, int encoding, int out_format, int mb_stride, int mb_width, int mb_height, int b8_stride)
 
int ff_alloc_picture (AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ScratchpadContext *sc, int shared, int encoding, int chroma_x_shift, int chroma_y_shift, int out_format, int mb_stride, int mb_width, int mb_height, int b8_stride, ptrdiff_t *linesize, ptrdiff_t *uvlinesize)
 Allocate a Picture. More...
 
void ff_mpeg_unref_picture (AVCodecContext *avctx, Picture *pic)
 Deallocate a picture. More...
 
int ff_update_picture_tables (Picture *dst, Picture *src)
 
int ff_mpeg_ref_picture (AVCodecContext *avctx, Picture *dst, Picture *src)
 
static int pic_is_unused (Picture *pic)
 
static int find_unused_picture (AVCodecContext *avctx, Picture *picture, int shared)
 
int ff_find_unused_picture (AVCodecContext *avctx, Picture *picture, int shared)
 
void ff_free_picture_tables (Picture *pic)
 

Macro Definition Documentation

#define MAKE_WRITABLE (   table)
Value:
do {\
if (pic->table &&\
(ret = av_buffer_make_writable(&pic->table)) < 0)\
} while (0)
int av_buffer_make_writable(AVBufferRef **pbuf)
Create a writable reference from a given buffer reference, avoiding data copy if possible.
Definition: buffer.c:151
if(ret)
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 it should return

Referenced by make_tables_writable().

#define EMU_EDGE_HEIGHT   (4 * 70)

Referenced by ff_mpeg_framesize_alloc().

#define UPDATE_TABLE (   table)
Value:
do { \
if (src->table && \
(!dst->table || dst->table->buffer != src->table->buffer)) { \
av_buffer_unref(&dst->table); \
dst->table = av_buffer_ref(src->table); \
if (!dst->table) { \
return AVERROR(ENOMEM); \
} \
} \
} while (0)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
Definition: buffer.c:125
#define src
Definition: vp8dsp.c:254
void ff_free_picture_tables(Picture *pic)
Definition: mpegpicture.c:465
if(ret)
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:93
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 it should return
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

Referenced by ff_update_picture_tables().

Function Documentation

static int make_tables_writable ( Picture pic)
static

Definition at line 33 of file mpegpicture.c.

Referenced by ff_alloc_picture().

int ff_mpeg_framesize_alloc ( AVCodecContext avctx,
MotionEstContext me,
ScratchpadContext sc,
int  linesize 
)
static int alloc_frame_buffer ( AVCodecContext avctx,
Picture pic,
MotionEstContext me,
ScratchpadContext sc,
int  chroma_x_shift,
int  chroma_y_shift,
int  linesize,
int  uvlinesize 
)
static

Allocate a frame buffer.

Definition at line 100 of file mpegpicture.c.

Referenced by ff_alloc_picture().

static int alloc_picture_tables ( AVCodecContext avctx,
Picture pic,
int  encoding,
int  out_format,
int  mb_stride,
int  mb_width,
int  mb_height,
int  b8_stride 
)
static

Definition at line 186 of file mpegpicture.c.

Referenced by ff_alloc_picture().

int ff_alloc_picture ( AVCodecContext avctx,
Picture pic,
MotionEstContext me,
ScratchpadContext sc,
int  shared,
int  encoding,
int  chroma_x_shift,
int  chroma_y_shift,
int  out_format,
int  mb_stride,
int  mb_width,
int  mb_height,
int  b8_stride,
ptrdiff_t *  linesize,
ptrdiff_t *  uvlinesize 
)

Allocate a Picture.

The pixels are allocated/set by calling get_buffer() if shared = 0

Definition at line 236 of file mpegpicture.c.

Referenced by alloc_picture().

void ff_mpeg_unref_picture ( AVCodecContext avctx,
Picture pic 
)
int ff_update_picture_tables ( Picture dst,
Picture src 
)

Definition at line 321 of file mpegpicture.c.

Referenced by ff_mpeg_ref_picture().

int ff_mpeg_ref_picture ( AVCodecContext avctx,
Picture dst,
Picture src 
)
static int pic_is_unused ( Picture pic)
inlinestatic

Definition at line 409 of file mpegpicture.c.

Referenced by find_unused_picture().

static int find_unused_picture ( AVCodecContext avctx,
Picture picture,
int  shared 
)
static

Definition at line 418 of file mpegpicture.c.

Referenced by ff_find_unused_picture().

int ff_find_unused_picture ( AVCodecContext avctx,
Picture picture,
int  shared 
)
void ff_free_picture_tables ( Picture pic)