aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264dec.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-06-12 14:22:50 +0200
committerAnton Khirnov <anton@khirnov.net>2016-07-15 15:33:54 +0200
commit4a9bab3db0d9ec449ebc8b5e823374d1d1df7761 (patch)
tree496394aa8226d1b340b40104f34ff8bb57f1d715 /libavcodec/h264dec.h
parentf450cc7bc595155bacdb9f5d2414a076ccf81b4a (diff)
downloadffmpeg-4a9bab3db0d9ec449ebc8b5e823374d1d1df7761.tar.gz
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.
Diffstat (limited to 'libavcodec/h264dec.h')
-rw-r--r--libavcodec/h264dec.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 6f5ab41f52..f934fc40b8 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -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);