Go to the documentation of this file.
44 for (
int i = 0;
i < 2;
i++) {
66 #define MAKE_WRITABLE(table) \
68 int ret = make_table_writable(&pic->table); \
78 for (
int i = 0;
i < 2;
i++) {
90 # define EMU_EDGE_HEIGHT (4 * 70)
116 me->temp =
me->scratchpad;
129 int linesize,
int uvlinesize)
133 if ((linesize && linesize != pic->
f->
linesize[0]) ||
134 (uvlinesize && uvlinesize != pic->
f->
linesize[1])) {
136 "get_buffer() failed (stride changed: linesize=%d/%d uvlinesize=%d/%d)\n",
146 "get_buffer() failed (uv stride mismatch)\n");
155 "get_buffer() failed to allocate context scratch buffers.\n");
164 int mb_stride,
int mb_width,
int mb_height,
int b8_stride)
166 const int big_mb_num = mb_stride * (mb_height + 1) + 1;
167 const int mb_array_size = mb_stride * mb_height;
168 const int b8_array_size = b8_stride * mb_height * 2;
179 if (out_format ==
FMT_H263 || encoding ||
181 int mv_size = 2 * (b8_array_size + 4) *
sizeof(int16_t);
182 int ref_index_size = 4 * mb_array_size;
184 for (
i = 0; mv_size &&
i < 2;
i++) {
205 int mb_stride,
int mb_width,
int mb_height,
int b8_stride,
206 ptrdiff_t *linesize, ptrdiff_t *uvlinesize)
216 *linesize, *uvlinesize) < 0)
224 mb_stride, mb_width, mb_height, b8_stride);
235 for (
i = 0;
i < 2;
i++) {
279 for (
i = 0;
i < 2;
i++) {
292 for (
i = 0;
i < 2;
i++) {
322 src->hwaccel_picture_private);
353 if (!picture[
i].
f->buf[0])
364 "Internal error, picture buffer overflow\n");
385 if (picture[
ret].needs_realloc) {
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem)
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
AVBufferRef * ref_index_buf[2]
uint8_t * obmc_scratchpad
int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me, ScratchpadContext *sc, int linesize)
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 void av_noinline free_picture_tables(Picture *pic)
uint8_t * data
The data buffer.
uint8_t * rd_scratchpad
scratchpad for rate distortion mb decision
Motion estimation context.
int alloc_mb_width
mb_width used to allocate tables
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int field_picture
whether or not the picture was encoded in separate fields
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
static int make_tables_writable(Picture *pic)
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
int needs_realloc
Picture needs to be reallocated (eg due to a frame size change)
void ff_mpeg_unref_picture(Picture *pic)
Deallocate a picture; frees the picture tables in case they need to be reallocated anyway.
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)
#define MAX_PICTURE_COUNT
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void av_cold ff_mpv_picture_free(Picture *pic)
int64_t max_pixels
The number of pixels per image to maximally accept.
void * hwaccel_picture_private
RefStruct reference for hardware accelerator private data.
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AVBufferRef * mb_type_buf
int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
int ff_mpeg_ref_picture(Picture *dst, Picture *src)
int ff_update_picture_tables(Picture *dst, const Picture *src)
AVBufferRef * motion_val_buf[2]
void ff_thread_release_ext_buffer(ThreadFrame *f)
Unref a ThreadFrame.
int display_picture_number
AVBufferRef * qscale_table_buf
int alloc_mb_height
mb_height used to allocate tables
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
int16_t(*[2] motion_val)[2]
size_t size
Size of data in bytes.
#define i(width, name, range_min, range_max)
#define MAKE_WRITABLE(table)
int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ScratchpadContext *sc, int encoding, int out_format, int mb_stride, int mb_width, int mb_height, int b8_stride, ptrdiff_t *linesize, ptrdiff_t *uvlinesize)
Allocate a Picture.
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
int av_buffer_is_writable(const AVBufferRef *buf)
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
static int pic_is_unused(Picture *pic)
void ff_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
main external API structure.
uint8_t * edge_emu_buffer
temporary buffer for if MVs point to out-of-frame data
uint32_t * mb_type
types and macros are defined in mpegutils.h
static int handle_pic_linesizes(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ScratchpadContext *sc, int linesize, int uvlinesize)
Check the pic's linesize and allocate linesize dependent scratch buffers.
static int ref[MAX_W *MAX_W]
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
static int find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared)
A reference to a data buffer.
#define AV_CODEC_EXPORT_DATA_MVS
Export motion vectors through frame side data.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
AVBufferRef * mbskip_table_buf
uint8_t * b_scratchpad
scratchpad used for writing into write only buffers
void ff_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
int alloc_mb_stride
mb_stride used to allocate tables
static int make_table_writable(AVBufferRef **ref)