mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-06-19 19:03:00 +02:00
h264: fix decoding multiple fields per packet with slice threads
Since we only know whether a NAL unit corresponds to a new field after parsing the slice header, this requires reorganizing the calls to slice parsing, per-slice/field/frame init and actual decoding. In the previous code, the function for slice header decoding also immediately started a new field/frame as necessary, so any slices already queued for decoding would no longer be decodable. After this patch, we first parse the slice header, and if we determine that a new field needs to be started we decode all the queued slices.
This commit is contained in:
@@ -345,6 +345,7 @@ typedef struct H264Context {
|
||||
|
||||
H264SliceContext *slice_ctx;
|
||||
int nb_slice_ctx;
|
||||
int nb_slice_ctx_queued;
|
||||
|
||||
H2645Packet pkt;
|
||||
|
||||
@@ -793,9 +794,14 @@ int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl);
|
||||
|
||||
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height);
|
||||
|
||||
int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl,
|
||||
const H2645NAL *nal);
|
||||
int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count);
|
||||
/**
|
||||
* Submit a slice for decoding.
|
||||
*
|
||||
* Parse the slice header, starting a new field/frame if necessary. If any
|
||||
* slices are queued for the previous field, they are decoded.
|
||||
*/
|
||||
int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal);
|
||||
int ff_h264_execute_decode_slices(H264Context *h);
|
||||
int ff_h264_update_thread_context(AVCodecContext *dst,
|
||||
const AVCodecContext *src);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user