[FFmpeg-cvslog] H264: Only wait before triggering ff_thread_setup_complete() until the next slice that contains a start-of-field/frame macroblock

Michael Niedermayer git at videolan.org
Mon Mar 19 05:30:21 CET 2012


ffmpeg | branch: release/0.8 | Michael Niedermayer <michaelni at gmx.at> | Tue Oct  4 00:14:48 2011 +0200| [c6bb93dcd96ae1ece3c2a505f296f2f4a28134a8] | committer: Reinhard Tartler

H264: Only wait before triggering ff_thread_setup_complete() until the next slice that contains a start-of-field/frame macroblock

This allows concurrent decoding of the last field/frame, rather than
only the last slice, of data packets with multiple NAL units packed
together.

This will fix the slowdown reported in e.g. bug 52.

Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit 14c21c1ff509eac97f6437aeb51202b15af3a700)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6bb93dcd96ae1ece3c2a505f296f2f4a28134a8
---

 libavcodec/h264.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f2fa9aa..9d40100 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3724,9 +3724,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
             switch (hx->nal_unit_type) {
                 case NAL_SPS:
                 case NAL_PPS:
+                    nals_needed = nal_index;
+                    break;
                 case NAL_IDR_SLICE:
                 case NAL_SLICE:
-                    nals_needed = nal_index;
+                    init_get_bits(&hx->s.gb, ptr, bit_length);
+                    if (!get_ue_golomb(&hx->s.gb))
+                        nals_needed = nal_index;
             }
             continue;
         }



More information about the ffmpeg-cvslog mailing list