Commit Graph

1415 Commits

Author SHA1 Message Date
Michael Niedermayer
5a9e376049 h264: check mb_width/height
Fixes inconsistency that leads to out of array accesses with threads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-06 01:58:10 +02:00
Michael Niedermayer
edabbfbaf2 ff_h264_decode_seq_parameter_set: dont set h->sps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-06 00:37:47 +02:00
Michael Niedermayer
fbaf75b166 h264: Use the correct croping values.
This fixes returning pictures with corrupted data pointers.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-01 00:06:26 +02:00
Michael Niedermayer
5299ee54a7 h264: assert that croping values at slice level are consistent
These values where checked before already.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-30 23:49:56 +02:00
Michael Niedermayer
8ebfd7c49e h264: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-20 02:22:32 +02:00
Michael Niedermayer
f4b05cd841 Merge commit '5e83d9aced2fc2b2e1360452794c58aba55d497c'
* commit '5e83d9aced2fc2b2e1360452794c58aba55d497c':
  h264: fully support cropping.

Conflicts:
	doc/APIchanges
	libavcodec/h264.c
	libavcodec/h264_ps.c
	libavcodec/options_table.h
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-19 22:46:51 +02:00
Anton Khirnov
5e83d9aced h264: fully support cropping.
Based on a patch by Vittorio Giovara <vittorio.giovara@gmail.com>

Fixes Bug 378.
2013-04-19 09:28:08 +02:00
Reimar Döffinger
c10d498bfd Add thread-safe wrapper for get_format().
Just like get_buffer, get_format should not be called from a different
thread if thread_safe_callbacks is not set.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-04-15 09:04:07 +02:00
Michael Niedermayer
65120f628c Merge commit '85deb51a01f1ecc5ac5faa52ad8ea141c384e23a'
* commit '85deb51a01f1ecc5ac5faa52ad8ea141c384e23a':
  h264: Only initialize dsputil if error resilience is enabled

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-11 12:00:05 +02:00
Michael Niedermayer
944ad46182 Merge commit 'e8cafd2773bc56455c8816593cbd9368f2d69a80'
* commit 'e8cafd2773bc56455c8816593cbd9368f2d69a80':
  h264: Clear the mb members via memset instead of using dsputil

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-11 11:40:05 +02:00
Ronald S. Bultje
85deb51a01 h264: Only initialize dsputil if error resilience is enabled
It is only used for error resilience. This allows building the
h264 decoder without dsputil, if error resilience is disabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-10 11:03:53 +03:00
Ronald S. Bultje
62844c3fd6 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: Martin Storsjö <martin@martin.st>
2013-04-10 11:03:06 +03:00
Martin Storsjö
e8cafd2773 h264: Clear the mb members via memset instead of using dsputil
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-10 11:01:21 +03:00
Michael Niedermayer
62a1181015 h264: wait for missing slices only on frames
The EC code does not support fields currently thus it makes no
sense to wait for these cases (which also the check doesnt handle
correctly)

Fixes Ticket 2454

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-09 23:12:24 +02:00
Michael Niedermayer
285c5f6838 h264: move last_slice_type reset into decode_slice_header
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-30 20:57:31 +01:00
Michael Niedermayer
11c3381ce3 h264: move the default_ref_list_done check down after its inputs have been written
Fixes out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-30 20:28:00 +01:00
Michael Niedermayer
746016598d h264: Move slice_table clean out of frame_start
Fixes inconsistency ultimately leading to an out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-30 20:28:00 +01:00
Michael Niedermayer
ace0cfea60 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hwaccel: fix use with frame based multithreading

Conflicts:
	libavcodec/h263dec.c
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-27 11:51:33 +01:00
Janne Grunau
05fa79b844 hwaccel: fix use with frame based multithreading
Allows use of AVHWAccel based decoders with frame based multithreading.
The decoders will be forced into an non-concurrent mode by delaying
ff_thread_finish_setup() calls after decoding of the current frame
is finished.

This wastes memory by unnecessarily using multiple threads and thus
copies of the decoder context but allows seamless switching between
hardware accelerated and frame threaded software decoding when the
hardware decoder does not support the stream.
2013-03-26 19:44:50 +01:00
Michael Niedermayer
7b3ca7ae8b mpegvideo/h264: drop period_since_free
This should not be needed anymore

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-26 19:27:32 +01:00
Michael Niedermayer
365ad0042a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264: Make it possible to compile without error_resilience

Conflicts:
	configure
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-26 14:36:00 +01:00
Ronald S. Bultje
0b499c9b06 h264: Make it possible to compile without error_resilience
Error resilience is enabled by the h264 decoder, unless explicitly
disabled. --disable-everything --enable-decoder=h264 will produce
a h264 decoder with error resilience enabled, while
--disable-everything --enable-decoder=h264 --disable-error-resilience
will produce a h264 decoder with error resilience disabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-26 09:55:05 +02:00
Martin Storsjö
ccd349e555 h264: Remove an unused variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-25 15:00:05 +02:00
Michael Niedermayer
e2b30194bb h264/field_end move progress report code after error concealment.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-24 22:34:17 +01:00
Michael Niedermayer
644092c8e8 h264: dont report rows as finished after a missing slice
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-23 21:07:57 +01:00
Michael Niedermayer
f3980b75f8 h264: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 13:17:55 +01:00
Michael Niedermayer
881050d229 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264: remove redundant freeing of DPB in h264_decode_end

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 13:10:57 +01:00
Michael Niedermayer
86d9d349cc Merge commit '23e85be58fc64b2e804e68b0034a08a6d257e523'
* commit '23e85be58fc64b2e804e68b0034a08a6d257e523':
  h264: add a parameter to the CHROMA444 macro.
  h264: add a parameter to the CHROMA422 macro.

Conflicts:
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 13:06:14 +01:00
Michael Niedermayer
92656787cf Merge commit '6d2b6f21eb45ffbda1103c772060303648714832'
* commit '6d2b6f21eb45ffbda1103c772060303648714832':
  h264: add a parameter to the CABAC macro.
  h264: add a parameter to the FIELD_OR_MBAFF_PICTURE macro.

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 12:58:00 +01:00
Michael Niedermayer
bf4d0f8328 Merge commit '7fa00653a550c0d24b3951c0f9fed6350ecf5ce4'
* commit '7fa00653a550c0d24b3951c0f9fed6350ecf5ce4':
  h264: add a parameter to the FIELD_PICTURE macro.
  h264: add a parameter to the FRAME_MBAFF macro.

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_refs.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 12:50:18 +01:00
Michael Niedermayer
e168b50816 Merge commit 'da6be8fcec16a94d8084bda8bb8a0a411a96bcf7'
* commit 'da6be8fcec16a94d8084bda8bb8a0a411a96bcf7':
  h264: add a parameter to the MB_FIELD macro.
  h264: add a parameter to the MB_MBAFF macro.

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 12:43:32 +01:00
Michael Niedermayer
137df692fc Merge commit '48d0fd2d62a476e1db9298163f1fc0abae26cc67'
* commit '48d0fd2d62a476e1db9298163f1fc0abae26cc67':
  h264: merge common_init() into ff_h264_decode_init.

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 12:34:59 +01:00
Michael Niedermayer
bbc0f6f978 Merge commit '25408b2a0660c1e6c8555559c4ed71dff2ede31e'
* commit '25408b2a0660c1e6c8555559c4ed71dff2ede31e':
  h264: make ff_h264_frame_start static.

Conflicts:
	libavcodec/h264.c
	libavcodec/h264.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 12:05:13 +01:00
Michael Niedermayer
6c8ac2d782 Merge commit '1c4073efd24164ac6eaa52c544f5cdb0e5f6aee5'
* commit '1c4073efd24164ac6eaa52c544f5cdb0e5f6aee5':
  fate: add tests for h264 decoder reinit
  h264: fix bit depth changes with frame threading

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 11:56:29 +01:00
Michael Niedermayer
82f95d7fd7 h264: drop special case for 9bit chroma422
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-21 11:51:26 +01:00
Anton Khirnov
fcf75022d7 h264: remove redundant freeing of DPB in h264_decode_end
free_tables() frees it already.
2013-03-21 10:21:11 +01:00
Anton Khirnov
23e85be58f h264: add a parameter to the CHROMA444 macro.
This way it does not look like a constant.
2013-03-21 10:21:02 +01:00
Anton Khirnov
e962bd08ee h264: add a parameter to the CHROMA422 macro.
This way it does not look like a constant.
2013-03-21 10:20:58 +01:00
Anton Khirnov
6d2b6f21eb h264: add a parameter to the CABAC macro.
This way it does not look like a constant.
2013-03-21 10:20:52 +01:00
Anton Khirnov
a6931d8ece h264: add a parameter to the FIELD_OR_MBAFF_PICTURE macro.
This way it does not look like a constant.
2013-03-21 10:20:48 +01:00
Anton Khirnov
7fa00653a5 h264: add a parameter to the FIELD_PICTURE macro.
This way it does not look like a constant.
2013-03-21 10:20:44 +01:00
Anton Khirnov
7bece9b22f h264: add a parameter to the FRAME_MBAFF macro.
This way it does not look like a constant.
2013-03-21 10:20:39 +01:00
Anton Khirnov
da6be8fcec h264: add a parameter to the MB_FIELD macro.
This way it does not look like a constant.
2013-03-21 10:20:35 +01:00
Anton Khirnov
82313eaa34 h264: add a parameter to the MB_MBAFF macro.
This way it does not look like a constant.
2013-03-21 10:20:30 +01:00
Anton Khirnov
48d0fd2d62 h264: merge common_init() into ff_h264_decode_init.
There is no point in keeping those separate.
2013-03-21 10:20:10 +01:00
Anton Khirnov
25408b2a06 h264: make ff_h264_frame_start static.
It is not called from outside h264.c
2013-03-21 10:19:54 +01:00
Janne Grunau
a157c7f2b8 h264: fix bit depth changes with frame threading
AVCodecContext.bits_per_raw_sample is updated from the previous thread
in the generic update function before the codec specific update_thread
function is called. The check for reinitialization of dsp functions uses
bits_per_raw_sample. When called from update_thread_context it will be
already at the current value and the dsp functions aren't updated if
only the bit depth changes.
2013-03-20 13:12:10 +01:00
Michael Niedermayer
f7fee8f700 Merge commit 'c3ebfcd6e1327ca7bbcaee822e593c2da6cfd352'
* commit 'c3ebfcd6e1327ca7bbcaee822e593c2da6cfd352':
  mpegvideo: allocate hwaccel privdata after the frame buffer
  h264: allocate hwaccel privdata after the frame buffer

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-20 11:57:28 +01:00
Hendrik Leppkes
9c9ede44f3 h264: allocate hwaccel privdata after the frame buffer
This ensures the hwaccel privdata does not leak when a frame buffer could
not be allocated (and toggle the assert when the frame is re-used).
Having no frame buffer available is quite common when using the DXVA2
hwaccel in situations where the DXVA2 renderer is being re-allocated, for
example when moving between displays.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-03-19 11:20:00 +01:00
Ronald S. Bultje
4a88d81c9e dsputil: remove duplicate or unused functions.
dct_bits is never set except in h264, where it is never used, thus
remove it. Then, remove all functions that were set based on non-zero
(32) values for dct_bits. Lastly, merge 9-14 bpp functions for get_pixels
and draw_edge, which only care about pixel storage unit size, not actual
bits used (i.e. they don't clip).

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 14:56:48 +01:00