summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
Commit message (Collapse)AuthorAge
...
* h264: deMpegEncContextizeAnton Khirnov2013-02-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* mpegvideo: split ff_draw_horiz_band().Anton Khirnov2013-02-15
| | | | Split out dependency on MpegEncContext.
* error_resilience: decouple ER from MpegEncContextAnton Khirnov2013-02-15
|
* h264: remove a pointless if()Anton Khirnov2013-02-15
| | | | !encoding is always true, we do not have a H.264 encoder
* h264: simplify calls to ff_er_add_slice().Anton Khirnov2013-02-15
| | | | partitioned_frame is never set for h264 (as easily seen from git grep).
* h264: Copy h264chroma dsp context to slice thread copiesMartin Storsjö2013-02-11
| | | | | | | This fixes slice threading which seems to have been broken since 79dad2a93. Signed-off-by: Martin Storsjö <martin@martin.st>
* dsputil: Move ff_svq3 function declarations to a separate headerDiego Biurrun2013-02-07
|
* dsputil: Separate h264chromaDiego Biurrun2013-02-06
|
* h264: remove obsolete comment.Anton Khirnov2013-01-29
|
* hwaccel: do not offer unsupported pixel formatsRémi Denis-Courmont2013-01-27
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* vdpau: add missing pixel format for H.264Rémi Denis-Courmont2013-01-27
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* h264: copy h264qpel dsp context to slice thread copiesJanne Grunau2013-01-24
|
* dsputil: Separate h264 qpelMans Rullgard2013-01-24
| | | | | | | | | | The sh4 optimizations are removed, because the code is 100% identical to the C code, so it is unlikely to provide any real practical benefit. Signed-off-by: Diego Biurrun <diego@biurrun.de> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* Drop DCTELEM typedefDiego Biurrun2013-01-22
| | | | | | It does not help as an abstraction and adds dsputil dependencies. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* dsputil: drop non-compliant "fast" qpel mc functionsMans Rullgard2013-01-20
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* h264: avoid pointless copying of ref listsAnton Khirnov2013-01-18
| | | | | | | | ref_list is constructed from other fields per slice when needed, so do not copy it for both frame and slice threading. default_ref_list is constructed per frame and still needs to be copied to per-slice contexts for slice threading, but a copy is not needed for frame threading.
* h264: add 3 pixels below for subpixel filter wait positionRonald S. Bultje2013-01-15
| | | | | | | | | | | | | | | | | | | If the motion vector is at a subpixel position, we need 3 pixels below the motion vector's wholepel position available, not 2, since the MC filter is a sixtap filter for the hpel position, and then a bilin filter for the qpel position. This patch fixes highly irreproducible (0.1%) fate failures in frame 2 and 4 of h264-conformance-cama2_vtc_b (e.g. first P-frame, first field, last line of MB x=40,y=2 and second field and last lines of MBs x=39-40, y=3). These used pre-loopfilter instead of post-loopfilter data because the await_progress() waited for one line too little in that field, and the motion vector of these particular MBs happened to align exactly to a position where that demonstrates the bug. CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* h264: fix ff_generate_sliding_window_mmcos() prototype.Anton Khirnov2013-01-14
| | | | | | | It's been returning an error value since bad446e251405dc250c3cbee199072e083a1e4b9 Also check for the errors it returns.
* h264: don't clobber mmco opcode tables for non-first slice headers.Ronald S. Bultje2013-01-14
| | | | | | | | | | | | | | | | | | | | | Clobbering these tables will temporarily clobber the template used as a basis for other threads to start decoding from. If the other decoding thread updates from the template right at that moment, subsequent threads will get invalid (or, usually, none at all) mmco tables. This leads to invalid reference lists and subsequent decode failures. Therefore, instead, decode the mmco tables only for the first slice in a field or frame. For other slices, decode the bits and ensure they are identical to the mmco tables in the first slice, but don't ever clobber the context state. This prevents other threads from using a clobbered/invalid template as starting point for decoding, and thus fixes decoding in these cases. This fixes occasional (~1%) failures of h264-conformance-mr1_bt_a with frame-multithreading enabled. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* h264: Fix assignments in if()Michael Niedermayer2013-01-14
| | | | | | | | Fixes null pointer dereference later, since if this function failed, a positive return value was returned to the caller. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Martin Storsjö <martin@martin.st>
* h264: check SPS entries directly to detect pixel format changesJanne Grunau2013-01-03
| | | | | | | Comparing AVCodecContext.pix_fmt against the get_pixel_format() return value has the side effect of calling the get_format() callback on each slice. Users of the callback will probably handle hardware accelerator initialization in the callback.
* Return proper error code after av_log_ask_for_sample()Diego Biurrun2012-12-23
|
* lavc: introduce VideoDSPContextRonald S. Bultje2012-12-20
| | | | | | | | Move some functions from dsputil. The idea is that videodsp contains functions that are useful for a large and varied set of video decoders. Currently, it contains emulated_edge_mc() and prefetch(). Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* h264: support frame parameter changes during frame-mtJanne Grunau2012-12-18
| | | | Fixes CVE-2012-2782.
* mpegvideo: allocate scratch buffers after linesize is knownJanne Grunau2012-12-18
| | | | | | | | | | | Since we can't know which stride a custom get_buffer() implementation is going to use we have to allocate this scratch buffers after the linesize is known. It was pretty safe for 8 bit per pixel pixel formats since we always allocated memory for up to 16 bits per pixel. It broke hoever with cmdutis.c's alloc_buffer() and high pixel bit depth since it allocated larger edges than mpegvideo expected. Fixes fuzzed sample nasa-8s2.ts_s244342.
* h264: prevent decoding of slice NALs in extradataJanne Grunau2012-12-18
| | | | | | | | It is not posible to call get_buffer during frame-mt codec initialization. Libavformat might pass huge amounts of data as extradata after parsing broken files. The 'extradata' for the fuzzed sample sample_varPAR_s5374_r001-02.avi is 2.8M large and contains multiple slices.
* h264-mt: handle NAL_DPAs before calling ff_thread_finish_setupJanne Grunau2012-12-15
| | | | | Since a NAL_DPA can start a new frame it has to be handled before ff_thread_finish_setup is called.
* h264: initialize frame-mt context copies properlyJanne Grunau2012-12-13
|
* h264: set parameters from SPS whenever it changesJanne Grunau2012-12-13
| | | | | Fixes a crash in the fuzzed sample sample_varPAR.avi_s26638 with alternating bit depths.
* cosmetics: Fix dropable --> droppable typoDiego Biurrun2012-12-09
|
* h264: add a pointer for weighted prediction temporary bufferJanne Grunau2012-12-07
| | | | | Reusing MpegEncContext's obmc_scratchpad for this becomes a mess with adaptive frame-mt.
* h264: slice-mt: check master context for valid current_picture_ptrJanne Grunau2012-12-05
| | | | | | Fixes errors in slice based multithreading introduced in 0b300daad2f5. CC: libav-stable@libav.org
* h264: slice-mt: get last_pic_dropable from master contextJanne Grunau2012-12-05
| | | | | | | Fixes fate-h264-conformance-cvnlfi2_sony_h and smllwebdl.mkv from https://github.com/OpenELEC/OpenELEC.tv/issues/1557 . CC: libav-stable@libav.org
* lavc: fix decode_frame() third parameter semantics for video decodersAnton Khirnov2012-12-04
| | | | It's got_frame, not data size
* h264: error out on unset current_picture_ptr for h->current_slice > 0Janne Grunau2012-12-02
| | | | | | Fixes a segfault with fuzzed sample sample_varPAR_s11622_r001-02.avi. CC: libav-stable@libav.org
* h264: check context state before decoding slice data partitionsJanne Grunau2012-11-29
| | | | | | | Fixes mov_h264_aac__Demo_FlagOfOurFathers.mov.SIGSEGV.4e9.656. Found-by: Mateusz "j00ru" Jurczyk CC: libav-stable@libav.org
* h264: set Picture.owner2 to the current threadJanne Grunau2012-11-27
| | | | | | | | This does not seem to have an effect currently. Fate-h264 passes with THREADS=1..16 and both threading types as before. It fixes however a segfault during error resilience with my adaptive-frame-mt patchset. A picture in use during error resilience gets realloced in another thread in the fuzzed sample sample_varPAR.avi_s226019.
* h264: check ref_count validity for num_ref_idx_active_override_flagJanne Grunau2012-11-27
| | | | | | Fixes segfault in the fuzzed sample bipbop234.ts_s226407. CC: libav-stable@libav.org
* h264: add missing new line to log messageJanne Grunau2012-11-27
|
* h264: enable low delay only if no delayed frames were seenJanne Grunau2012-11-26
| | | | | | | | | | | Dropping frames is undesirable but that is the only way by which the decoder could return to low delay mode. Instead emit a warning and continue with delayed frames. Fixes a crash in fuzzed sample nasa-8s2.ts_s20033 caused by a larger than expected has_b_frames value. Low delay keeps getting re-enabled from a presumely broken SPS. CC: libav-stable@libav.org
* h264: Fix parameters to ff_er_add_slice() callJanne Grunau2012-11-16
| | | | | | | | | s->mb_x is reset to zero a couple of lines above. It does not make sense to call ff_er_add_slice() with 0 as endx when the end of the macroblock row was reached. Fixes unnecessary and counterproductive error resilience in https://bugzilla.libav.org/show_bug.cgi?id=394. CC: libav-stable@libav.org
* h264: always check ref_count for validityJanne Grunau2012-11-16
| | | | Fixes a crash with zuffed files.
* Restructure av_log_missing_feature messageDiego Biurrun2012-10-09
| | | | | | | | Some invocations include a verb in the log message, others do not. Yet av_log_missing_feature expects callers to provide a verb. Change the function to include a verb instead and update the callers accordingly. The result is a more natural function API and correct English in the function invocations.
* Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormatAnton Khirnov2012-10-08
|
* avcodec: Drop silly and/or broken printf debug outputDiego Biurrun2012-10-01
|
* h264: avoid stuck buffer pointer in decode_nal_unitsJindřich Makovička2012-09-29
| | | | | | | | | | | | | | | | | | When decode_nal_units() previously encountered a NAL_END_SEQUENCE, and there are some junk bytes left in the input buffer, but no start codes, buf_index gets stuck 3 bytes before the end of the buffer. This can trigger an infinite loop in the caller code, eg. in try_decode_trame(), as avcodec_decode_video() then keeps returning zeroes, with 3 bytes of the input packet still available. With this change, the remaining bytes are skipped so the whole packet gets consumed. CC:libav-stable@libav.org Signed-off-by: Jindřich Makovička <makovick@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* h264: Remove an assert on current_picture_ptr being nullMichael Niedermayer2012-09-05
| | | | | | | | | It is possible in various error paths as well as gap handling that this has already been allocated. It is not clear why that would be a problem with the current code, thus disable the assert to avoid a common assert failure when asserts are enabled. Signed-off-by: Martin Storsjö <martin@martin.st>
* h264: Check that the codec isn't null before accessing itMartin Storsjö2012-08-28
| | | | | | | This fixes crashes introduced by 2e8f3cbcda5, the codec can be null when called from parsers. Signed-off-by: Martin Storsjö <martin@martin.st>
* h264: vdpau: fix crash with unsupported colorspaceUoti Urpala2012-08-17
| | | | | | | | The h264_vdpau decoder crashed if output colorspace was not 8-bit 420. Add a check to error out instead (current hardware does not support other colorspaces, so successful decoding is not possible). Signed-off-by: Martin Storsjö <martin@martin.st>
* Replace all CODEC_ID_* with AV_CODEC_ID_*Anton Khirnov2012-08-07
|