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 (AVCodecContext *avctx, ThreadFrame *f)
 Unref a ThreadFrame. More...
 
int ff_thread_ref_frame (ThreadFrame *dst, const ThreadFrame *src)
 
int ff_thread_can_start_frame (AVCodecContext *avctx)
 

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 624 of file pthread_frame.c.

Referenced by decode(), decode_finish_row(), decode_frame(), decode_frame_common(), decode_nal_units(), decode_slice(), decode_tiles(), ff_h264_field_end(), ff_h264_queue_decode_slice(), ff_hevc_hls_filter(), ff_mpv_frame_end(), ff_mpv_frame_start(), ff_mpv_report_decode_progress(), ff_rv34_decode_frame(), finish_frame(), generate_missing_ref(), h264_field_start(), mimic_decode_frame(), rv34_decode_slice(), vp3_draw_horiz_band(), vp78_decode_frame(), vp78_decode_mb_row_sliced(), vp9_decode_frame(), and wavpack_decode_frame().

◆ 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 647 of file pthread_frame.c.

◆ 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 1080 of file pthread_frame.c.

Referenced by alloc_frame(), alloc_frame_buffer(), alloc_picture(), decode_frame(), decode_idat_chunk(), mimic_decode_frame(), vp8_alloc_frame(), vp9_frame_alloc(), and wavpack_decode_block().

◆ ff_thread_release_ext_buffer()

void ff_thread_release_ext_buffer ( AVCodecContext avctx,
ThreadFrame f 
)

◆ ff_thread_ref_frame()

int ff_thread_ref_frame ( ThreadFrame dst,
const ThreadFrame src 
)

◆ ff_thread_can_start_frame()

int ff_thread_can_start_frame ( AVCodecContext avctx)

Definition at line 971 of file pthread_frame.c.

Referenced by ff_mpv_frame_start(), and h264_frame_start().