Commit Graph

70 Commits

Author SHA1 Message Date
Michael Niedermayer
852aaead1f avcodec/hevc_ps: Check default display window bitstream and skip if invalid
Fixes Ticket4035

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-27 14:03:09 +01:00
Michael Niedermayer
cbb277988a avcodec/hevc_ps: Always initialize backup in decode_vui()
Fixes CID1237283

Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-06 21:36:56 +02:00
Michael Niedermayer
aaaf7261b7 avcodec/hevc_ps: fix 1 vs. 0 typo
Found-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-22 23:00:41 +02:00
Christophe Gisquet
0625a38066 hevc_ps: check overflow and test alternate syntax
Some streams were found to have what appeared to be truncated SPS.
Their syntax seem to be valid at least until the end of the VUI, so
try that syntax if the parsing would overflow the SPS in the
conforming syntax.

Fixes ticket #3872.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-21 22:04:43 +02:00
Michael Niedermayer
7caacc50ae avcodec/hevc_ps: do cleanup in case of unsupported bit depth
Fixes memleak
Fixes CID1231989

Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Reviewed-by: Mickaël Raulet <mraulet@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-20 15:14:53 +02:00
Christophe Gisquet
5ec85c9750 hevc: do generic validation of bitstream
After finishing parsing VPS/SPS/PPS/slice header, check remaining bits,
and if an overconsumption occurred, report invalid data.

Liked-by: BBB
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 02:47:05 +02:00
Christophe Gisquet
0d0d24af01 hevc_ps: verify P/T/L information
This makes the SPS parsing a little, but barely, safer.

Reviewed-by: Mickaël Raulet <mraulet@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 18:05:33 +02:00
Mickaël Raulet
37822a566f hevc/rext: remove warning for cross component prediction
cherry picked from commit fb595102593c94179502bb1967f978a1d99cc7cb

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 13:59:00 +02:00
Mickaël Raulet
627c044f50 hevc/rext: fixing rdpcm and scaling list for Range Extension
-new rext bitstreams:
PERSIST_RPARAM_A_RExt_Sony_1.bit           ok    =
QMATRIX_A_RExt_Sony_1.bit                  ok    =
SAO_A_RExt_MediaTek_1.bit                  ok    =

(cherry picked from commit cdea029d452c521f8e5bcbe589f44b13a4011604)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 13:07:54 +02:00
Michael Niedermayer
d13a731fc1 avcodec/hevc_ps: Check abs_delta_rps
Fixes integer overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-19 17:30:44 +02:00
Michael Niedermayer
ba80b8d29b avcodec/hevc: check nb_cpb
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-19 16:51:05 +02:00
Mickaël Raulet
fdb20db642 hevc/rext: put a warning log message instead of an error log message
cherry picked from commit 243cb99cff727d6a14c32cdff2748f6c255dbaf4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-18 23:47:06 +02:00
Michael Niedermayer
0fc2045d5f avcodec/hevc_ps: prevent stale pointer in malloc failure case
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 21:49:56 +02:00
Mickaël Raulet
5a41999d81 hevc/rext: basic infrastructure for supporting range extension
- support for 4:2:2 and 4:4:4 up to 12 bits
- add a new profile for range extension
(cherry picked from commit d3c067fa65bbc871758d28aa07f54123430ca346)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 13:47:35 +02:00
Michael Niedermayer
ccd6911c18 avcodec/hevc_ps: do not loose all reference to pointers still in use
Fixes leaving a pointer to unreferenced memory
Fixes Ticket 3115

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-12 21:03:09 +02:00
Michael Niedermayer
66558fe715 avcodec/hevc_ps: Check layer_id_included_flags count
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-12 07:46:08 +02:00
Michael Niedermayer
6935ae22ed avcodec/hevc_ps: more complete check for vps_max_dec_pic_buffering
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-12 07:46:08 +02:00
Michael Niedermayer
acc7cf70dc Merge commit '9b60d9197970658e91daf4b586397f450de9af69'
* commit '9b60d9197970658e91daf4b586397f450de9af69':
  hevc: Allow out of bound values for num_reorder_pics

Conflicts:
	libavcodec/hevc_ps.c

See: bc21260e64
See: ab296c7a9f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-26 19:58:25 +02:00
Kieran Kunhya
9b60d91979 hevc: Allow out of bound values for num_reorder_pics
This fixes decoding for a sample that cannot be shared

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-06-26 07:14:57 +02:00
gcocherel
ba70563d55 hevc/pps: optimized size of min_tb_addr_zs
reduce computation too
(cherry picked from commit 39c4d45c7788081c45c7fae51b7c5d0bcbaece9d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 13:11:40 +02:00
gcocherel
f7f1f4c7ce avcodec/hevc_ps: remove min_cb_addr_zs
(cherry picked from commit ff7926d5092f9d4158108963e977e8c992322ba4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 13:06:42 +02:00
Kieran
bc21260e64 hevc: Fix 4K sample video
Reviewed-by: smarter
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-15 23:24:11 +02:00
Michael Niedermayer
eaaa5801ef Merge commit '4d33873c2990b8d6096f60fef384f0efc4482b55'
* commit '4d33873c2990b8d6096f60fef384f0efc4482b55':
  hevc: make pps/sps ids unsigned where necessary

Conflicts:
	libavcodec/hevc.h
	libavcodec/hevc_ps.c

See: d1e6602665
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 21:44:40 +01:00
Vittorio Giovara
4d33873c29 hevc: make pps/sps ids unsigned where necessary
Fixes integer overflow and out of array accesses.
Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
2014-03-09 17:23:08 +01:00
Michael Niedermayer
920c01adce hevc: Use get_bits_long() in decode_vui()
Fix assertion failure.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-03-09 08:25:39 +01:00
Michael Niedermayer
ef08d554e0 Merge commit '175e5063320f585118a5461f15dbacf2ce17e97d'
* commit '175e5063320f585118a5461f15dbacf2ce17e97d':
  hevc: Mention the missing SPS in the error message

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-19 22:10:27 +01:00
Luca Barbato
175e506332 hevc: Mention the missing SPS in the error message 2014-02-19 16:59:40 +01:00
Michael Niedermayer
b818637b84 avcodec/hevc_ps: Use get_bits_long() in decode_vui()
Fix assertion failure
Fixes: a225222ef88a0f5b1e93e1d0432debc3-asan_static-oob_124a17d_1448_cov_77608227_DBLK_E_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-15 22:30:40 +01:00
Michael Niedermayer
5b93b2722d Merge commit '838740e6420538ad45982da6b1d3aa3ae91307f5'
* commit '838740e6420538ad45982da6b1d3aa3ae91307f5':
  hevc: Prevent some integer overflows

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-21 15:31:04 +01:00
Michael Niedermayer
29ba1cff2b Merge commit 'b37e796082b2d787aff3cd5631bb89c4fd374708'
* commit 'b37e796082b2d787aff3cd5631bb89c4fd374708':
  hevc: Use uint64 to check for tile dimensions

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-21 15:19:39 +01:00
Michael Niedermayer
42a29015e1 Merge commit 'a7a07cc98ac548297b5b0628cb81280e11952e3f'
* commit 'a7a07cc98ac548297b5b0628cb81280e11952e3f':
  hevc: check that VPS referenced from SPS exists

Conflicts:
	libavcodec/hevc_ps.c

See: d66bab0a69
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-21 15:04:24 +01:00
Luca Barbato
838740e642 hevc: Prevent some integer overflows
get_ue_golomb_long() returns an unsigned.

Sample-Id: 00001541-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2014-01-21 11:59:18 +01:00
Luca Barbato
b37e796082 hevc: Use uint64 to check for tile dimensions
And use unsigned datatypes.

Otherwise it would overflow.

Sample-Id: 00001315-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2014-01-21 11:57:51 +01:00
Michael Niedermayer
a7a07cc98a hevc: check that VPS referenced from SPS exists
This matches how its done for SPS/PPS.
Fixes null pointer dereference.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-21 11:57:36 +01:00
Michael Niedermayer
ab296c7a9f avcodec/hevc_ps: Override max_dec_pic_buffering when its inconsistent with num_reorder_pics
Fixes Ticket3304

Alternatively max_dec_pic_buffering could be removed completely as its not used.

Based on a patch by Jose Santiago <santiago@haivision.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-15 04:45:42 +01:00
Michael Niedermayer
d66bab0a69 avcodec/hevc_ps: check that VPS referenced from SPS exists
This matches how its done for SPS/PPS.
An alternative to this is to check it when its used.

Fixes null pointer dereference
Fixes: signal_sigsegv_e30a43_1437_CIP_A_Panasonic_3.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-06 04:30:04 +01:00
Michael Niedermayer
9567162237 Merge commit '78d0b7f36e39bb4745613e312024ddd508e2f0fb'
* commit '78d0b7f36e39bb4745613e312024ddd508e2f0fb':
  hevc: warn when an unknown profile is used

See: a21839149c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-21 00:54:15 +01:00
Michael Niedermayer
e00281b6f5 Merge commit '2d18aaa14bc2233b0647d2c5abb72e0bc828c2a8'
* commit '2d18aaa14bc2233b0647d2c5abb72e0bc828c2a8':
  hevc: refactor Profile Tier Level
  hevc: don't check for errors in PTL code

Conflicts:
	libavcodec/hevc_ps.c

See: 36658c978f
See: dddc9b7a8e
See: ecb21d2437
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-21 00:44:44 +01:00
Mickaël Raulet
5c3fa74b94 hevc: support luma bit depth != chroma bit depth for PCM coding units
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-20 19:39:53 +01:00
Guillaume Martres
78d0b7f36e hevc: warn when an unknown profile is used
Bitstreams conforming to the spec should not use profiles not defined
in it.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-20 19:39:38 +01:00
Gildas Cocherel
259cddb137 hevc_ps: fix indentation
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-20 19:39:10 +01:00
Gildas Cocherel
2d18aaa14b hevc: refactor Profile Tier Level
Also store a few PTL flags which were skipped before

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-20 19:38:59 +01:00
Guillaume Martres
67bbaed5c4 hevc: don't check for errors in PTL code
According to the spec, the value of XXX_reserved_zero_44bits should be
ignored, so don't report an error when it's not zero.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-20 19:36:44 +01:00
Guillaume Martres
ecb21d2437 hevc: rename ptl structs and variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-14 03:01:56 +01:00
Guillaume Martres
dddc9b7a8e hevc: don't check for errors in PTL code
The value of XXX_reserved_zero_44bits should be ignored, no need to
report an error when it's not zero.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-14 03:01:35 +01:00
Guillaume Martres
c6afd0aacc hevc: fix PTL parsing
This was broken in commit 36658c978f

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-14 03:01:22 +01:00
Michael Niedermayer
12a4042445 Merge commit '33452aede6acab78f726cd1924824585f00765cc'
* commit '33452aede6acab78f726cd1924824585f00765cc':
  hevc: store the VPS list as an AVBufferRef, just like the others *PS

Conflicts:
	libavcodec/hevc.c
	libavcodec/hevc_ps.c

See: 36658c978f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-11 23:08:45 +01:00
Gildas Cocherel
33452aede6 hevc: store the VPS list as an AVBufferRef, just like the others *PS
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-11 20:39:54 +01:00
Guillaume Martres
f90281ca97 hevc: Correctly set time_base
- Try reading the time_base information from the VPS too, not just the VUI
- Only set time_base when an SPS is activated, not when it's decoded.
- Reduce the fraction before setting it.
- Don't set anything if the fraction is invalid (because the VUI is not
  present or because the encoded value is invalid).

Conflicts:
	libavcodec/hevc_ps.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-10 16:20:53 +01:00
Guillaume Martres
679a6377e4 hevc: avoid some unnecessary differences with libav
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-10 16:20:48 +01:00