Go to the documentation of this file.
44 for (
int i = 0;
i < 2;
i++) {
70 int ret, init_progress = (uintptr_t)opaque.
nc;
94 (
void*)(uintptr_t)init_progress,
101 memset(pic, 0,
sizeof(*pic));
114 for (
int i = 0;
i < 2;
i++) {
132 memset(wpic, 0,
sizeof(*wpic));
141 # define EMU_EDGE_HEIGHT (4 * 70)
142 int linesizeabs =
FFABS(linesize);
143 int alloc_size =
FFALIGN(linesizeabs + 64, 32);
145 if (linesizeabs <= sc->linesize)
151 if (linesizeabs < 24) {
182 ptrdiff_t *linesizep, ptrdiff_t *uvlinesizep)
184 ptrdiff_t linesize = *linesizep, uvlinesize = *uvlinesizep;
186 if ((linesize && linesize !=
f->linesize[0]) ||
187 (uvlinesize && uvlinesize !=
f->linesize[1])) {
190 linesize,
f->linesize[0],
191 uvlinesize,
f->linesize[1]);
196 f->linesize[1] !=
f->linesize[2]) {
200 *linesizep =
f->linesize[0];
201 *uvlinesizep =
f->linesize[1];
209 #define GET_BUFFER(name, buf_suffix, idx_suffix) do { \
210 pic->name ## buf_suffix idx_suffix = ff_refstruct_pool_get(pools->name ## _pool); \
211 if (!pic->name ## buf_suffix idx_suffix) \
212 return AVERROR(ENOMEM); \
219 for (
int i = 0;
i < 2;
i++) {
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem)
ptrdiff_t linesize[MPV_MAX_PLANES]
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
uint8_t * obmc_scratchpad
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
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 set_workpic_from_pic(MPVWorkPicture *wpic, const MPVPicture *pic)
RefStruct is an API for creating reference-counted objects with minimal overhead.
uint32_t * mb_type
types and macros are defined in mpegutils.h
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int16_t(*[2] motion_val)[2]
static void av_cold mpv_pic_free(FFRefStructOpaque unused, void *obj)
int16_t(*[2] motion_val_base)[2]
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
uint32_t * mb_type
types and macros are defined in mpegutils.h
int16_t(*[2] motion_val)[2]
int alloc_mb_stride
mb_stride used to allocate tables
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 GET_BUFFER(name, buf_suffix, idx_suffix)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define FF_REFSTRUCT_POOL_FLAG_FREE_ON_INIT_ERROR
If this flag is set and both init_cb and free_entry_cb callbacks are provided, then free_cb will be c...
int dummy
Picture is a dummy and should not be output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_mpv_framesize_alloc(AVCodecContext *avctx, ScratchpadContext *sc, int linesize)
MPVPicture * ptr
RefStruct reference.
struct FFRefStructPool * motion_val_pool
int64_t max_pixels
The number of pixels per image to maximally accept.
FFRefStructPool is an API for a thread-safe pool of objects managed via the RefStruct API.
struct FFRefStructPool * mbskip_table_pool
int8_t * qscale_table_base
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
void ff_mpv_unref_picture(MPVWorkPicture *pic)
av_cold FFRefStructPool * ff_mpv_alloc_pic_pool(int init_progress)
Allocate a pool of MPVPictures.
#define PTRDIFF_SPECIFIER
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
uint8_t * data[MPV_MAX_PLANES]
int field_picture
whether or not the picture was encoded in separate fields
int linesize
linesize that the buffers in this context have been allocated for
int display_picture_number
int mb_stride
mb_stride of the tables
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static void mpv_pic_reset(FFRefStructOpaque unused, void *obj)
uint8_t * scratchpad_buf
the other *_scratchpad point into this buffer
int mb_width
mb_width of the tables
void * hwaccel_picture_private
RefStruct reference for hardware accelerator private data.
#define i(width, name, range_min, range_max)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
av_cold int ff_thread_progress_init(ThreadProgress *pro, int init_mode)
Initialize a ThreadProgress.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int mb_height
mb_height of the tables
void ff_mpv_workpic_from_pic(MPVWorkPicture *wpic, MPVPicture *pic)
void ff_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
av_cold void ff_thread_progress_destroy(ThreadProgress *pro)
Destroy a ThreadProgress.
main external API structure.
uint8_t * edge_emu_buffer
temporary buffer for if MVs point to out-of-frame data
static FFRefStructPool * ff_refstruct_pool_alloc_ext(size_t size, unsigned flags, void *opaque, int(*init_cb)(FFRefStructOpaque opaque, void *obj), void(*reset_cb)(FFRefStructOpaque opaque, void *obj), void(*free_entry_cb)(FFRefStructOpaque opaque, void *obj), void(*free_cb)(FFRefStructOpaque opaque))
A wrapper around ff_refstruct_pool_alloc_ext_c() for the common case of a non-const qualified opaque.
int ff_mpv_pic_check_linesize(void *logctx, const AVFrame *f, ptrdiff_t *linesizep, ptrdiff_t *uvlinesizep)
static void ff_thread_progress_reset(ThreadProgress *pro)
Reset the ThreadProgress.progress counter; must only be called if the ThreadProgress is not in use in...
void ff_mpv_replace_picture(MPVWorkPicture *dst, const MPVWorkPicture *src)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
static int av_cold mpv_pic_init(FFRefStructOpaque opaque, void *obj)
int alloc_mb_width
mb_width used to allocate tables
int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *wpic, ScratchpadContext *sc, BufferPoolContext *pools, int mb_height)
Allocate an MPVPicture's accessories (but not the AVFrame's buffer itself) and set the MPVWorkPicture...
void ff_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static int alloc_picture_tables(BufferPoolContext *pools, MPVPicture *pic, int mb_height)