Commit Graph

1329 Commits

Author SHA1 Message Date
Michael Niedermayer
ec203cd69b Merge commit 'e671d3ad6cd7fe1d02e9b35b889a25d8c059fce9'
* commit 'e671d3ad6cd7fe1d02e9b35b889a25d8c059fce9':
  h264: do not copy ref count/ref2frm when updating per-frame context
  flvdec: Check the return value of a malloc

Conflicts:
	libavformat/flvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-02 11:41:31 +01:00
Anton Khirnov
e671d3ad6c h264: do not copy ref count/ref2frm when updating per-frame context
They are filled in decode_slice_header() anyway.
2013-03-02 10:26:50 +01:00
Michael Niedermayer
c10c2aed47 h264: Silence warning: comparison of distinct pointer types lacks a cast
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-23 14:09:04 +01:00
Michael Niedermayer
04220b473e h264: ensure that get_format() is called when changing format but not otherwise.
Fixes Ticket2288

Tested-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-21 22:36:33 +01:00
Michael Niedermayer
8036ba299d h264: move next/last picture init to decode_slice_header
This is a regression introduced from the h264/mpegvideo split
Fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-21 20:24:31 +01:00
Michael Niedermayer
da7672b20a h264: Fix handling of changing reference counts between slices
Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-20 19:53:54 +01:00
Michael Niedermayer
039f55c803 h264: call alloc_scratch_buffers() only once linesize is known
Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-20 19:53:54 +01:00
Michael Niedermayer
088f20a332 Merge commit '2ed008204d5467be03a0a3af1e293b2f7038d0a0'
* commit '2ed008204d5467be03a0a3af1e293b2f7038d0a0':
  h264: Add add_pixels4/8() to h264dsp, and remove add_pixels4 from dsputil

Conflicts:
	libavcodec/dsputil.c
	libavcodec/h264.c
	libavcodec/h264_mb_template.c
	libavcodec/h264addpx_template.c
	libavcodec/h264dsp.c
	libavcodec/h264dsp.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-20 11:17:32 +01:00
Ronald S. Bultje
fae6fd5b87 h264/svq3: Stop using draw_edges
Instead, only extend edges on-demand when the motion vector actually
crosses the visible decoded area using ff_emulated_edge_mc(). This
changes decoding time for cathedral from 8.722sec to 8.706sec, i.e.
0.2% faster overall. More generally (VP8 uses this also), low-motion
content gets significant speed improvements, whereas high-motion content
tends to decode in approximately the same time.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-19 22:34:33 +02:00
Ronald S. Bultje
2ed008204d h264: Add add_pixels4/8() to h264dsp, and remove add_pixels4 from dsputil
These functions are mostly H264-specific (the only other user I can
spot is bink), and this allows us to special-case some functionality
for H264. Also remove the 16-bit-coeff with >8bpp versions (unused)
and merge the duplicate 32-bit-coeff for >8bpp (identical).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-19 22:33:29 +02:00
Ronald S. Bultje
1acd7d594c h264: integrate clear_blocks calls with IDCT.
The non-intra-pcm branch in hl_decode_mb (simple, 8bpp) goes from 700
to 672 cycles, and the complete loop of decode_mb_cabac and hl_decode_mb
(in the decode_slice loop) goes from 1759 to 1733 cycles on the clip
tested (cathedral), i.e. almost 30 cycles per mb faster.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-19 16:25:50 +01:00
Michael Niedermayer
d41efc1f26 h264: put visualization and debug support back
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-19 02:56:31 +01:00
Ronald S. Bultje
e2789d3e33 split out ff_hwaccel_pixfmt_list_420[] over individual codecs.
Not all hwaccels implement all codecs, so using one single list for
multiple such codecs means some codecs will be represented in the list,
even though they don't actually handle that codec. Copying specific
lists in each codec fixes that.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-18 21:44:22 +01:00
Ronald S. Bultje
51513b98d6 h264/svq3: stop using draw_edges.
Instead, only extend edges on-demand when the motion vector actually
crosses the visible decoded area using ff_emulated_edge_mc(). This
changes decoding time for cathedral from 8.722sec to 8.706sec, i.e.
0.2% faster overall. More generally (VP8 uses this also), low-motion
content gets significant speed improvements, whereas high-motion content
tends to decode in approximately the same time.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-18 15:18:56 +01:00
Ronald S. Bultje
c63f9fb37a h264: don't store intra pcm samples in h->mb.
Instead, keep them in the bitstream buffer until we read them verbatim,
this saves a memcpy() and a subsequent clearing of the target buffer.
decode_cabac+decode_mb for a sample file (CAPM3_Sony_D.jsv) goes from
6121.4 to 6095.5 cycles, i.e. 26 cycles faster.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-18 01:21:23 +01:00
Carl Eugen Hoyos
259603b917 h264: don't initialize missing pictures when using VDPAU.
This fixes an assertion failure when running mplayer -vc ffh264vdpau.

Reported by irc user ioni.
2013-02-17 22:33:40 +01:00
Michael Niedermayer
dece584a63 h264: avoid calling get_format() multiple times
Some applications do not like that.
Fixes VDA
Reduces noise for VDPAU

Tested-by: Guillaume POIRIER <poirierg@gmail.com>
Tested-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-17 22:26:33 +01:00
Hendrik Leppkes
1d6f6ff4d9 h264: don't initialize missing pictures when using a hwaccel
Writing into uninitialized hw surfaces is not supported and triggers an assert inside avpriv_color_frame

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-17 00:28:42 +01:00
Michael Niedermayer
b7fe35c9e5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264: deMpegEncContextize

Conflicts:
	libavcodec/dxva2_h264.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb_template.c
	libavcodec/h264_parser.c
	libavcodec/h264_ps.c
	libavcodec/h264_refs.c
	libavcodec/h264_sei.c
	libavcodec/svq3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 23:30:09 +01:00
Michael Niedermayer
ddbbfd95be Merge commit '1d0feb5d1ac04d187b335f0e8d411c9f40b3a885'
* commit '1d0feb5d1ac04d187b335f0e8d411c9f40b3a885':
  mpegvideo: split ff_draw_horiz_band().

Conflicts:
	libavcodec/vc1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 19:00:39 +01:00
Michael Niedermayer
1fad547cef Merge commit '54974c62982ae827becdbdb9b620b7ba75d079a0'
* commit '54974c62982ae827becdbdb9b620b7ba75d079a0':
  error_resilience: decouple ER from MpegEncContext

Conflicts:
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/h264.c
	libavcodec/mpegvideo.c
	libavcodec/vc1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 18:54:56 +01:00
Michael Niedermayer
8b7568cc34 Merge commit 'd9ebb00dcbaac3812b8b1fbc3d6e027506c11cbc'
* commit 'd9ebb00dcbaac3812b8b1fbc3d6e027506c11cbc':
  svq3: remove a pointless if()
  h264: remove a pointless if()

Conflicts:
	libavcodec/h264.c
	libavcodec/svq3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 14:30:21 +01:00
Michael Niedermayer
131b9c924d Merge commit '68f930d2188aba5b32624887dcbf688c23482834'
* commit '68f930d2188aba5b32624887dcbf688c23482834':
  h264: simplify calls to ff_er_add_slice().

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 14:13:20 +01:00
Michael Niedermayer
1c5b8b916d h264: color frames gray
This prevents a regression from the removial of the buffer
initialization

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 13:13:18 +01: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
Anton Khirnov
1d0feb5d1a mpegvideo: split ff_draw_horiz_band().
Split out dependency on MpegEncContext.
2013-02-15 16:10:19 +01:00
Anton Khirnov
54974c6298 error_resilience: decouple ER from MpegEncContext 2013-02-15 16:10:11 +01:00
Anton Khirnov
2491f9ee29 h264: remove a pointless if()
!encoding is always true, we do not have a H.264 encoder
2013-02-15 16:09:45 +01:00
Anton Khirnov
68f930d218 h264: simplify calls to ff_er_add_slice().
partitioned_frame is never set for h264 (as easily seen from git grep).
2013-02-15 16:09:37 +01:00
Michael Niedermayer
701e9b8254 h264: Use mb itself as memcpy anchor and assert the other anchors position
This makes the code more robust against reordering or fields.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 00:42:20 +01:00
Ronald S. Bultje
faf8eca08d h264: remove clear_blocks call in threading init.
Init code in that if statement goes down from 26716 cycles to 26047
cycles, i.e. the removal of the clear_blocks and smaller memcpy()
together save around 670 cycles.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 00:15:02 +01:00
Michael Niedermayer
c230af9bcc h264: Reset last_pocs in case of reference or frame number inconsistencies
This prevents faulty increasing of has_b_frames
Should fix Ticket 2062

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-13 23:19:51 +01:00
Michael Niedermayer
fe54f6cb45 Merge commit '4c51fe48ba6dde059360b7451db7f6bbf2f11db3'
* commit '4c51fe48ba6dde059360b7451db7f6bbf2f11db3':
  h264: Copy h264chroma dsp context to slice thread copies
  swscale: Disallow conversion to GBRP16

Conflicts:
	libswscale/utils.c
	tests/ref/lavfi/pixdesc
	tests/ref/lavfi/pixfmts_copy
	tests/ref/lavfi/pixfmts_null
	tests/ref/lavfi/pixfmts_scale
	tests/ref/lavfi/pixfmts_vflip

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-12 13:18:28 +01:00
Ronald S. Bultje
7ff1a4b10f Add add_pixels4/8() to h264dsp, and remove add_pixels4 from dsputil.
These functions are mostly H264-specific (the only other user I can
spot is bink), and this allows us to special-case some functionality
for H264. Also remove the 16-bit-coeff with >8bpp versions (unused)
and merge the duplicate 32-bit-coeff for >8bpp (identical).

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-12 02:14:16 +01:00
Martin Storsjö
4c51fe48ba h264: Copy h264chroma dsp context to slice thread copies
This fixes slice threading which seems to have been broken since
79dad2a93.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-11 21:12:21 +02:00
Michael Niedermayer
ffbe19fc84 Merge commit '35685a3c2a1ec09f3c62dcfc4368fe9e92bcddf6'
* commit '35685a3c2a1ec09f3c62dcfc4368fe9e92bcddf6':
  dsputil: Move ff_shrink* function declarations to separate header
  dsputil: Move ff_svq3 function declarations to a separate header

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-09 13:46:03 +01:00
Diego Biurrun
75d5156ac1 dsputil: Move ff_svq3 function declarations to a separate header 2013-02-07 22:08:19 +01:00
Michael Niedermayer
c4e394e460 Merge commit '79dad2a932534d1155079f937649e099f9e5cc27'
* commit '79dad2a932534d1155079f937649e099f9e5cc27':
  dsputil: Separate h264chroma

Conflicts:
	libavcodec/dsputil_template.c
	libavcodec/ppc/dsputil_ppc.c
	libavcodec/vc1dec.c
	libavcodec/vc1dsp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-07 13:09:35 +01:00
Diego Biurrun
79dad2a932 dsputil: Separate h264chroma 2013-02-06 11:30:53 +01:00
Michael Niedermayer
695af8eed6 h264: skip error concealment when SPS and slices are mismatching
Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-02 21:13:25 +01:00
Michael Niedermayer
cdc48860a8 h264: silence warning about array index being out of bounds
The index is not out of bounds, adding an assert makes gcc
realize this.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-02 16:20:19 +01:00
Michael Niedermayer
d1bbd304bf Merge commit 'f81c37e40fe3236d54da12aef9cdba48ba70ec31'
* commit 'f81c37e40fe3236d54da12aef9cdba48ba70ec31':
  vf_delogo: fix an uninitialized read.
  h264: remove obsolete comment.
  mpegvideo: remove some unused variables from Picture.
  utvideoenc/v410enc: do not set AVFrame.reference.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-29 14:25:24 +01:00
Anton Khirnov
76e74e4831 h264: remove obsolete comment. 2013-01-29 07:32:47 +01:00
Michael Niedermayer
11c99c78ba h264: check the pixel format directly and force a reinit on mismatches.
The existing checks are insufficient to detect a pixel format
changes in case of some damaged streams.
Fixes inconsistency and later out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-29 04:40:04 +01:00
Michael Niedermayer
f5c0b9aa6f Merge commit '96753bd00d6d4046db6818c0aadc21bf2a11d77b'
* commit '96753bd00d6d4046db6818c0aadc21bf2a11d77b':
  dsputil: x86: Correct the number of registers used in put_no_rnd_pixels16_l2
  dsputil: add missing HAVE_YASM guard
  hwaccel: do not offer unsupported pixel formats
  vdpau: add missing pixel format for H.264

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-27 16:30:01 +01:00
Rémi Denis-Courmont
78bc4d69eb hwaccel: do not offer unsupported pixel formats
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-27 07:03:22 +01:00
Rémi Denis-Courmont
ec0e92002b vdpau: add missing pixel format for H.264
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-27 07:03:22 +01:00
Janne Grunau
6bdb841b46 h264: copy h264qpel dsp context to slice thread copies 2013-01-24 17:06:52 +01:00
Michael Niedermayer
fc13a89654 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dsputil: Separate h264 qpel

Conflicts:
	libavcodec/dsputil_template.c
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-24 15:47:47 +01:00
Mans Rullgard
e9d817351b dsputil: Separate h264 qpel
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>
2013-01-24 10:44:43 +01:00