FFmpeg
Data Structures | Functions
threadframe.h File Reference
#include "libavutil/frame.h"
#include "avcodec.h"

Go to the source code of this file.

Data Structures

struct  ThreadFrame
 

Functions

void ff_thread_report_progress (ThreadFrame *f, int progress, int field)
 Notify later decoding threads when part of their reference picture is ready. More...
 
void ff_thread_await_progress (const ThreadFrame *f, int progress, int field)
 Wait for earlier decoding threads to finish reference pictures. More...
 
int ff_thread_get_ext_buffer (AVCodecContext *avctx, ThreadFrame *f, int flags)
 Wrapper around ff_get_buffer() for frame-multithreaded codecs. More...
 
void ff_thread_release_ext_buffer (ThreadFrame *f)
 Unref a ThreadFrame. More...
 
int ff_thread_ref_frame (ThreadFrame *dst, const ThreadFrame *src)
 
int ff_thread_replace_frame (ThreadFrame *dst, const ThreadFrame *src)
 

Function Documentation

◆ ff_thread_report_progress()

void ff_thread_report_progress ( ThreadFrame f,
int  progress,
int  field 
)

Notify later decoding threads when part of their reference picture is ready.

Call this when some part of the picture is finished decoding. Later calls with lower values of progress have no effect.

Parameters
fThe picture being decoded.
progressValue, in arbitrary units, of how much of the picture has decoded.
fieldThe field being decoded, for field-picture codecs. 0 for top field or frame pictures, 1 for bottom field.

Definition at line 627 of file pthread_frame.c.

Referenced by decode_finish_row(), decode_nal_units(), ff_h264_field_end(), ff_h264_queue_decode_slice(), and h264_field_start().

◆ ff_thread_await_progress()

void ff_thread_await_progress ( const ThreadFrame f,
int  progress,
int  field 
)

Wait for earlier decoding threads to finish reference pictures.

Call this before accessing some part of a picture, with a given value for progress, and it will return after the responsible decoding thread calls ff_thread_report_progress() with the same or higher value for progress.

Parameters
fThe picture being referenced.
progressValue, in arbitrary units, to wait for.
fieldThe field being referenced, for field-picture codecs. 0 for top field or frame pictures, 1 for bottom field.

Definition at line 650 of file pthread_frame.c.

Referenced by await_reference_mb_row(), await_references(), guess_mv(), and h264_field_start().

◆ ff_thread_get_ext_buffer()

int ff_thread_get_ext_buffer ( AVCodecContext avctx,
ThreadFrame f,
int  flags 
)

Wrapper around ff_get_buffer() for frame-multithreaded codecs.

Call this function instead of ff_get_buffer() if you might need to wait for progress on this frame. Cannot be called after the codec has called ff_thread_finish_setup().

Parameters
avctxThe current context.
fThe frame to write into.
Note
: It is fine to call this with codecs that do not support frame threading.

Definition at line 1057 of file pthread_frame.c.

Referenced by alloc_picture().

◆ ff_thread_release_ext_buffer()

void ff_thread_release_ext_buffer ( ThreadFrame f)

Unref a ThreadFrame.

This is basically a wrapper around av_frame_unref() and should be called instead of it.

Parameters
avctxThe current context.
fThe picture being released.

Definition at line 1078 of file pthread_frame.c.

Referenced by ff_h264_unref_picture(), and h264_field_start().

◆ ff_thread_ref_frame()

int ff_thread_ref_frame ( ThreadFrame dst,
const ThreadFrame src 
)

Definition at line 851 of file utils.c.

Referenced by ff_h264_ref_picture(), and h264_field_start().

◆ ff_thread_replace_frame()

int ff_thread_replace_frame ( ThreadFrame dst,
const ThreadFrame src 
)

Definition at line 870 of file utils.c.

Referenced by ff_h264_replace_picture().