FFmpeg
|
Multithreading support functions. More...
Go to the source code of this file.
Data Structures | |
struct | ThreadFrame |
Typedefs | |
typedef struct ThreadFrame | ThreadFrame |
Functions | |
void | ff_thread_flush (AVCodecContext *avctx) |
Wait for decoding threads to finish and reset internal state. More... | |
int | ff_thread_decode_frame (AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) |
Submit a new frame to a decoding thread. More... | |
void | ff_thread_finish_setup (AVCodecContext *avctx) |
If the codec defines update_thread_context(), call this when they are ready for the next thread to start decoding the next frame. More... | |
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 (ThreadFrame *f, int progress, int field) |
Wait for earlier decoding threads to finish reference pictures. More... | |
enum AVPixelFormat | ff_thread_get_format (AVCodecContext *avctx, const enum AVPixelFormat *fmt) |
Wrapper around get_format() for frame-multithreaded codecs. More... | |
int | ff_thread_get_buffer (AVCodecContext *avctx, ThreadFrame *f, int flags) |
Wrapper around get_buffer() for frame-multithreaded codecs. More... | |
void | ff_thread_release_buffer (AVCodecContext *avctx, ThreadFrame *f) |
Wrapper around release_buffer() frame-for multithreaded codecs. More... | |
int | ff_thread_ref_frame (ThreadFrame *dst, ThreadFrame *src) |
int | ff_thread_init (AVCodecContext *s) |
void | ff_thread_free (AVCodecContext *s) |
Detailed Description
Multithreading support functions.
Definition in file thread.h.
Typedef Documentation
typedef struct ThreadFrame ThreadFrame |
Function Documentation
void ff_thread_await_progress | ( | 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
-
f The picture being referenced. progress Value, in arbitrary units, to wait for. field The field being referenced, for field-picture codecs. 0 for top field or frame pictures, 1 for bottom field.
int ff_thread_decode_frame | ( | AVCodecContext * | avctx, |
AVFrame * | picture, | ||
int * | got_picture_ptr, | ||
AVPacket * | avpkt | ||
) |
Submit a new frame to a decoding thread.
Returns the next available frame in picture. *got_picture_ptr will be 0 if none is available. The return value on success is the size of the consumed packet for compatibility with avcodec_decode_video2(). This means the decoder has to consume the full packet.
Parameters are the same as avcodec_decode_video2().
Definition at line 632 of file pthread.c.
Referenced by avcodec_decode_video2().
void ff_thread_finish_setup | ( | AVCodecContext * | avctx | ) |
If the codec defines update_thread_context(), call this when they are ready for the next thread to start decoding the next frame.
After calling it, do not change any variables read by the update_thread_context() method, or call ff_thread_get_buffer().
- Parameters
-
avctx The context.
Definition at line 741 of file pthread.c.
Referenced by frame_worker_thread(), and thread_get_buffer_internal().
void ff_thread_flush | ( | AVCodecContext * | avctx | ) |
Wait for decoding threads to finish and reset internal state.
Called by avcodec_flush_buffers().
- Parameters
-
avctx The context.
Definition at line 931 of file pthread.c.
Referenced by avcodec_flush_buffers().
void ff_thread_free | ( | AVCodecContext * | s | ) |
Definition at line 1178 of file pthread.c.
Referenced by avcodec_close(), and thread_init().
int ff_thread_get_buffer | ( | AVCodecContext * | avctx, |
ThreadFrame * | f, | ||
int | flags | ||
) |
Wrapper around get_buffer() for frame-multithreaded codecs.
Call this function instead of ff_get_buffer(f). Cannot be called after the codec has called ff_thread_finish_setup().
- Parameters
-
avctx The current context. f The frame to write into.
Definition at line 1066 of file pthread.c.
Referenced by alloc_frame_buffer(), alloc_picture(), decode_frame(), dnxhd_decode_frame(), lag_decode_frame(), libopenjpeg_decode_frame(), mimic_decode_frame(), vp3_decode_frame(), and vp8_alloc_frame().
enum AVPixelFormat ff_thread_get_format | ( | AVCodecContext * | avctx, |
const enum AVPixelFormat * | fmt | ||
) |
Wrapper around get_format() for frame-multithreaded codecs.
Call this function instead of avctx->get_format(). Cannot be called after the codec has called ff_thread_finish_setup().
- Parameters
-
avctx The current context. fmt The list of available formats.
Definition at line 1040 of file pthread.c.
Referenced by get_pixel_format(), and mpeg_get_pixelformat().
int ff_thread_init | ( | AVCodecContext * | s | ) |
Definition at line 1155 of file pthread.c.
Referenced by avcodec_open2().
int ff_thread_ref_frame | ( | ThreadFrame * | dst, |
ThreadFrame * | src | ||
) |
Definition at line 3026 of file libavcodec/utils.c.
Referenced by ff_mpeg_ref_picture(), mimic_decode_update_thread_context(), ref_frame(), ref_picture(), update_frames(), vp3_decode_frame(), and vp8_ref_frame().
void ff_thread_release_buffer | ( | AVCodecContext * | avctx, |
ThreadFrame * | f | ||
) |
Wrapper around release_buffer() frame-for multithreaded codecs.
Call this function instead of avctx->release_buffer(f). The AVFrame will be copied and the actual release_buffer() call will be performed later. The contents of data pointed to by the AVFrame should not be changed until ff_thread_get_buffer() is called on it.
- Parameters
-
avctx The current context. f The picture being released.
Definition at line 1074 of file pthread.c.
Referenced by ff_thread_ref_frame().
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
-
f The picture being decoded. progress Value, in arbitrary units, of how much of the picture has decoded. field The field being decoded, for field-picture codecs. 0 for top field or frame pictures, 1 for bottom field.
Definition at line 705 of file pthread.c.
Referenced by decode(), decode_finish_row(), decode_nal_units(), decode_slice_header(), ff_MPV_frame_end(), ff_MPV_frame_start(), ff_MPV_report_decode_progress(), ff_rv34_decode_frame(), field_end(), finish_frame(), mimic_decode_frame(), rv34_decode_slice(), vp3_decode_frame(), vp3_draw_horiz_band(), vp8_decode_frame(), and vp8_decode_mb_row_sliced().
Generated on Fri Dec 20 2024 06:56:16 for FFmpeg by 1.8.11