Commit Graph

61 Commits

Author SHA1 Message Date
Vittorio Giovara dc971acf4a h264_parser: use enum values in h264_find_frame_end() 2014-02-15 18:29:49 +01:00
Vittorio Giovara 73e8fab31d h264: print values in case of error
Also make error style consistent and drop redundant information.
2014-02-14 05:05:35 +01:00
Yusuke Nakamura 103d073dd7 h264_parser: Use ff_h264_reset_sei()
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-22 10:55:22 +02:00
Michael Niedermayer 19f5384000 h264_parser: Fix order of operations
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-22 10:53:04 +02:00
Yusuke Nakamura 4baba6c813 h264_parser: Fix POC parsing for the case where MMCO_RESET is present.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-15 20:02:55 +02:00
Yusuke Nakamura b81dbd6cb7 h264_parser: Fix POC parsing for the case where MMCO_RESET is absent.
The prev_ values were not set after parsing POC.
Increase length of the buffer decoded to parse enough safely.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-15 20:02:47 +02:00
Ben Avison 218d6844b3 h264dsp: Factorize code into a new function, h264_find_start_code_candidate
This performs the start code search which was previously part of
h264_find_frame_end() - the most CPU intensive part of the function.

By itself, this results in a performance regression:
              Before          After
              Mean   StdDev   Mean   StdDev  Change
Overall time  2925.6 26.2     3068.5 31.7    -4.7%

but this can more than be made up for by platform-optimised
implementations of the function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-08 12:08:30 +03:00
Ben Avison 7a82022ee2 h264_parser: Initialize the h264dsp context in the parser as well
Each AVStream struct for an H.264 elementary stream actually has two
copies of the H264DSPContext struct (and in fact all the other members
of H264Context as well):

((H264Context *) ((AVStream *)st)->codec->priv_data)->h264dsp
((H264Context *) ((AVStream *)st)->parser->priv_data)->h264dsp

but only the first of these was actually being initialised. This
prevented the addition of platform-specific implementations of
parser-related functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-08 12:08:28 +03:00
Yusuke Nakamura a8b19271c3 avcodec: Add output_picture_number to AVCodecParserContext
Set output_picture_number in H.264 parser.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-08-02 20:59:45 +02:00
Luca Barbato f8a4d5e970 h264_parser: K&R formatting cosmetics 2013-06-07 16:54:55 +02:00
Yusuke Nakamura 3f1a7ceb2c h264_parser: Set field_order and picture_structure.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-05-24 08:45:05 +02:00
Diego Biurrun 6fee1b90ce avcodec: Add av_cold attributes to init functions missing them 2013-05-04 21:09:45 +02:00
Diego Biurrun 088f38a4f9 avcodec: Drop unnecessary ff_ name prefixes from static functions 2013-04-30 16:02:02 +02:00
Martin Storsjö f1e9398621 lavc: Rename avpriv_mpv_find_start_code after moving out from mpegvideo
Also move the declaration to internal.h, and add restrict qualifiers
to the declaration (as in the implementation).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-26 09:50:02 +02:00
Anton Khirnov 2c54155407 h264: deMpegEncContextize
Most of the changes are just trivial are just trivial replacements of
fields from MpegEncContext with equivalent fields in H264Context.
Everything in h264* other than h264.c are those trivial changes.

The nontrivial parts are:
1) extracting a simplified version of the frame management code from
   mpegvideo.c. We don't need last/next_picture anymore, since h264 uses
   its own more complex system already and those were set only to appease
   the mpegvideo parts.
2) some tables that need to be allocated/freed in appropriate places.
3) hwaccels -- mostly trivial replacements.
   for dxva, the draw_horiz_band() call is moved from
   ff_dxva2_common_end_frame() to per-codec end_frame() callbacks,
   because it's now different for h264 and MpegEncContext-based
   decoders.
4) svq3 -- it does not use h264 complex reference system, so I just
   added some very simplistic frame management instead and dropped the
   use of ff_h264_frame_start(). Because of this I also had to move some
   initialization code to svq3.

Additional fixes for chroma format and bit depth changes by
Janne Grunau <janne-libav@jannau.net>

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-02-15 16:35:16 +01:00
Diego Biurrun 9c6cf7f2c9 avcodec: Drop silly and/or broken printf debug output 2012-10-01 10:24:28 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Reinhard Tartler 790a367d9e Fix parser not to clobber has_b_frames when extradata is set.
Because in contrast to the decoder, the parser does not setup low_delay.
The code in parse_nal_units would always end up setting has_b_frames
to "1", except when stream is explicitly marked as low delay.
Since the parser itself would create 'extradata', simply reopening
the parser would cause this.

This happens for instance in estimate_timings_from_pts(), which causes the
parser to be reopened on the same stream.

This fixes Libav #22 and FFmpeg (trac) #360

CC: libav-stable@libav.org

Based on a patch by Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(commit 31ac0ac29b)

Comments and description adapted by Reinhard Tartler.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 15:50:59 +01:00
Janne Grunau f907615f08 parsers: initialize MpegEncContext.slice_context_count to 1
The mpeg4 video, H264 and VC-1 parser hold (directly or indirectly)
a MpegEncContext in their private context. Since they do not call the
common mpegvideo init function slice_context_count has explicitly set
to 1.
Prevents a null pointer dereference in the h264 parser and fixes
bug 193.
2012-01-06 01:47:45 +01:00
Janne Grunau 358ea75e9e Revert "h264: skip start code search if the size of the nal unit is known"
This reverts commit 87eebb3454.
2011-12-19 03:24:32 +01:00
Janne Grunau 87eebb3454 h264: skip start code search if the size of the nal unit is known
Start code emulation prevention is only required in Annex B bytestream
packed NAL units. For other coding formats the size is already known.
Looking for a start code prefix can result in false positives like in
http://streams.videolan.org/streams/mp4/Mr_MrsSmith-h264_aac.mp4
which has a false positive in the SPS.
2011-12-18 23:52:53 +01:00
Anton Khirnov 5511ad14fe lavc: use designated initialisers for parsers. 2011-11-02 10:03:43 +01:00
Anton Khirnov 773375c3d0 lavc: rename ff_find_start_code to avpriv_mpv_find_start_code
It's used in lavf.
2011-10-20 21:06:58 +02:00
Diego Biurrun adbfc605f6 doxygen: Consistently use '@' instead of '\' for Doxygen markup.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-06-24 00:37:49 +02:00
Philip Langdale 25f05ddb1a h264_parser: Fix whitespace after previous change.
Signed-off-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-06-13 20:51:58 +02:00
Philip Langdale a26ce1e2df h264_parser: Fix behaviour when PARSER_FLAG_COMPLETE_FRAMES is set.
Currently, the parser is buggy and only processes the stream extradata
when the flag is set. This fixes it to actually inspect the frames.

Whitespce will be fixed in a separate change.

Signed-off-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-06-13 20:51:42 +02:00
Stefano Sabatini 975a1447f7 Replace deprecated FF_*_TYPE symbols with AV_PICTURE_TYPE_*.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-02 12:18:44 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Janne Grunau fe9a3fbe42 h264: Add Intra and Constrained Baseline profiles to avctx.profile 2011-02-01 20:37:02 +01:00
Diego Elio Pettenò d36beb3f69 Add ff_ prefix to data symbols of encoders, decoders, hwaccel, parsers, bsf.
None of these symbols should be accessed directly, so declare them as
hidden.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-26 16:08:45 +00:00
Diego Elio Pettenò 13eb6b9097 Make ff_h264_find_frame_end static to h264.c; delete h264_parser.h
The header is empty after making the function static, so delete it and
drop its usage.

Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
2011-01-25 22:07:29 +01:00
Baptiste Coudurier 9479415e4e In h264 parser, return immediately if buf_size is 0, avoid printing
erroneous message for last frame.

Originally committed as revision 24450 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-23 00:34:09 +00:00
Howard Chu 82f1ffc7ba Cleanup prev commit, flag variable should start with 0
Originally committed as revision 23364 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-28 20:14:14 +00:00
Howard Chu 23584bec87 Parse avctx->extradata if available.
Fixes many "non-existing PPS referenced" error messages

Originally committed as revision 23363 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-28 18:50:39 +00:00
Alex Converse 74a6df59e3 Add an AVSTREAM_PARSE_FULL_ONCE parsing mode to parse headers and combine packets once and only once.
Originally committed as revision 23332 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-26 04:20:32 +00:00
Diego Biurrun ba87f0801d Remove explicit filename from Doxygen @file commands.
Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 14:45:34 +00:00
Rafaël Carré dd0cd3d273 Export H264 profile and level in AVCodecContext.
Patch by Rafaël Carré, rafael D carre A gmail

Originally committed as revision 21517 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-28 20:57:29 +00:00
Rafaël Carré e9ca315dd1 Initialize thread_context[0] with h264 parser context.
This allows freeing the parser memory in the thread_context freeing loop.

Patch by Rafaël Carré gmailify(rafael, carre)

Originally committed as revision 21508 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-28 13:04:25 +00:00
Baptiste Coudurier 8fa0ae060b Init state to -1 in h264 parser.
Fix:
==22063== Conditional jump or move depends on uninitialised value(s)
==22063==    at 0x811A4B7: ff_find_start_code (mpegvideo.c:99)
==22063==    by 0x82F5B74: parse_nal_units (h264_parser.c:132)
==22063==    by 0x82F5A68: h264_parse (h264_parser.c:261)
[...]
==22063==  Uninitialised value was created by a stack allocation
==22063==    at 0x82F5AF5: parse_nal_units (h264_parser.c:112)

Originally committed as revision 18479 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-13 03:29:19 +00:00
Reimar Döffinger 15861962a7 Add a ff_h264_free_context function and call it from the H.264 parser.
This ensures that the parser will no longer leak memory for all SPS/PPS it encounters.

Originally committed as revision 18406 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-10 07:01:55 +00:00
John Cox 9e85f9c526 Fix SEIs when splitting H264 input.
Patch by John Cox, jc A kynesim D co D uk

Originally committed as revision 18020 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-16 22:38:27 +00:00
Carl Eugen Hoyos 26aedb4ab3 Cosmetics: Fix indentation after last commit.
Originally committed as revision 17621 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-26 20:36:47 +00:00
Ivan Schreter 2c0c5e1249 Initialize H264 parser context correctly if the optional SEI messages
are not present.

Patch by Ivan Schreter, schreter gmx net

Originally committed as revision 17620 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-26 20:36:02 +00:00
Ivan Schreter c733922eec Export timestamp parameter from H.264.
Patch by Ivan Schreter, schreter gmx net

Originally committed as revision 17575 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-24 22:24:34 +00:00
Ivan Schreter fc9fe42833 Correct time_base of H.264 and repeat_pict.
Patch by Ivan Schreter, schreter gmx net

Originally committed as revision 17571 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-24 20:19:59 +00:00
Ivan Schreter 346db3ef7f Use context variable repeat_pict for frame duration computation and
document this new use.

Patch by Ivan Schreter, schreter gmx net

Originally committed as revision 17492 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-21 20:11:47 +00:00
Ivan Schreter 96c3da93e6 Set context variable picture_structure in H264 parser.
Patch by Ivan Schreter, schreter gmx net

Originally committed as revision 17490 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-21 20:03:05 +00:00
Ivan Schreter 0ed260c7a3 Set context variable key_frame in H264 parser.
Patch by Ivan Schreter, schreter gmx net

Originally committed as revision 17489 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-21 19:59:25 +00:00
Ivan Schreter ff6474dd15 Parse NAL units in H264 parser.
Patch by Ivan Schreter, schreter gmx net

Originally committed as revision 17488 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-21 19:56:50 +00:00
Ivan Schreter 4d8eb2e899 Fix a const related warning
Patch by Ivan Schreter ( schreter gmx net )

Originally committed as revision 17073 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-08 21:22:18 +00:00