summaryrefslogtreecommitdiff
path: root/libavcodec/vc1_parser.c
Commit message (Collapse)AuthorAge
* avcodec: Don't anonymously typedef structsDiego Biurrun2015-02-14
|
* vc1: Initialize start_code_found to 0Luca Barbato2014-08-27
| | | | Leftover of a4d3c20035946cbc1509aec2dc28d51c2a2f9a8e.
* vc1: Fix the skip conditionLuca Barbato2014-08-26
| | | | | As written in the comment above, skip must be added only if a start code is found.
* vc-1: Optimise parser (with special attention to ARM)Ben Avison2014-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation of the parser made four passes over each input buffer (reduced to two if the container format already guaranteed the input buffer corresponded to frames, such as with MKV). But these buffers are often 200K in size, certainly enough to flush the data out of L1 cache, and for many CPUs, all the way out to main memory. The passes were: 1) locate frame boundaries (not needed for MKV etc) 2) copy the data into a contiguous block (not needed for MKV etc) 3) locate the start codes within each frame 4) unescape the data between start codes After this, the unescaped data was parsed to extract certain header fields, but because the unescape operation was so large, this was usually also effectively operating on uncached memory. Most of the unescaped data was simply thrown away and never processed further. Only step 2 - because it used memcpy - was using prefetch, making things even worse. This patch reorganises these steps so that, aside from the copying, the operations are performed in parallel, maximising cache utilisation. No more than the worst-case number of bytes needed for header parsing is unescaped. Most of the data is, in practice, only read in order to search for a start code, for which optimised implementations already existed in the H264 codec (notably the ARM version uses prefetch, so we end up doing both remaining passes at maximum speed). For MKV files, we know when we've found the last start code of interest in a given frame, so we are able to avoid doing even that one remaining pass for most of the buffer. In some use-cases (such as the Raspberry Pi) video decode is handled by the GPU, but the entire elementary stream is still fed through the parser to pick out certain elements of the header which are necessary to manage the decode process. As you might expect, in these cases, the performance of the parser is significant. To measure parser performance, I used the same VC-1 elementary stream in either an MPEG-2 transport stream or a MKV file, and fed it through avconv with -c:v copy -c:a copy -f null. These are the gperftools counts for those streams, both filtered to only include vc1_parse() and its callees, and unfiltered (to include the whole binary). Lower numbers are better: Before After File Filtered Mean StdDev Mean StdDev Confidence Change M2TS No 861.7 8.2 650.5 8.1 100.0% +32.5% MKV No 868.9 7.4 731.7 9.0 100.0% +18.8% M2TS Yes 250.0 11.2 27.2 3.4 100.0% +817.9% MKV Yes 149.0 12.8 1.7 0.8 100.0% +8526.3% Yes, that last case shows vc1_parse() running 86 times faster! The M2TS case does show a larger absolute improvement though, since it was worse to begin with. This patch has been tested with the FATE suite (albeit on x86 for speed). Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* avcodec: Add av_cold attributes to init functions missing themDiego Biurrun2013-05-04
|
* vc1_parser: Set field_order.Masaki Tanaka2013-05-03
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* Replace all CODEC_ID_* with AV_CODEC_ID_*Anton Khirnov2012-08-07
|
* vc1parse: call vc1_init_common().Ronald S. Bultje2012-02-18
| | | | | | | | The parser uses VLC tables initialized in vc1_common_init(), therefore we should call this function on parser init also. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
* vc1: Add ff_ prefix to nonstatic symbolsMartin Storsjö2012-02-15
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* vc1: use ff_parse_closeRafaël Carré2012-02-10
| | | | | | It works as long as ParseContext is the first member of the private struct Signed-off-by: Diego Biurrun <diego@biurrun.de>
* parsers: initialize MpegEncContext.slice_context_count to 1Janne Grunau2012-01-06
| | | | | | | | | 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.
* doxygen: misc consistency, spelling and wording fixesDiego Biurrun2011-12-12
|
* lavc: use designated initialisers for parsers.Anton Khirnov2011-11-02
|
* vc1: fix VC-1 Pulldown handling.John Stebbins2011-08-25
| | | | | | | | | | | | Pulldown flags are being set incorrectly and AVFrame->repeat_pict is not being set. Also, skipped frames exit header parsing too early and do not set pulldown flags appropriately. Ticks_per_frame needs to be set and time_base adjusted so player can extend frame duration by a field time. This fixes problems encountered when attempting to transcode HD-DVD EVOB files with HandBrake. Also makes these files play smoothly in avplay. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* Replace deprecated FF_*_TYPE symbols with AV_PICTURE_TYPE_*.Stefano Sabatini2011-05-02
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* Replace FFmpeg with Libav in licence headersMans Rullgard2011-03-19
| | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* Add ff_ prefix to data symbols of encoders, decoders, hwaccel, parsers, bsf.Diego Elio Pettenò2011-01-26
| | | | | | | None of these symbols should be accessed directly, so declare them as hidden. Signed-off-by: Mans Rullgard <mans@mansr.com>
* Remove explicit filename from Doxygen @file commands.Diego Biurrun2010-04-20
| | | | | | | | 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
* set pict_type in VC-1 parser, fix some timestamps problemsBaptiste Coudurier2009-05-30
| | | | Originally committed as revision 18987 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Fix vc1 split().Michael Niedermayer2009-02-22
| | | | | | Fixes Subtitle-sample.evo, issue52. Originally committed as revision 17533 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Use full internal pathname in doxygen @file directives.Diego Biurrun2009-02-01
| | | | | | | Otherwise doxygen complains about ambiguous filenames when files exist under the same name in different subdirectories. Originally committed as revision 16912 to svn://svn.ffmpeg.org/ffmpeg/trunk
* make some parser parameters const to avoid casting const to non-constAurelien Jacobs2007-05-07
| | | | Originally committed as revision 8921 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Make vc1_parser.c compilable without special definesKostya Shishkov2007-05-06
| | | | Originally committed as revision 8914 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Remove superfluous #includes, parser.h now includes its prerequisites.Diego Biurrun2007-05-05
| | | | Originally committed as revision 8905 to svn://svn.ffmpeg.org/ffmpeg/trunk
* 100l to myself. Do not include stuff unneeded by parserKostya Shishkov2007-05-04
| | | | Originally committed as revision 8886 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Move VC1 parser to its own file.Diego Biurrun2007-05-04
Originally committed as revision 8882 to svn://svn.ffmpeg.org/ffmpeg/trunk