Commit Graph

236 Commits

Author SHA1 Message Date
Anton Khirnov
77ef9fd1e9 hevc: eliminate unnecessary cbf_c{b,r} arrays
- They are be replaced by passing additional parameters to the transform
functions.
- Adaptation to 4:2:2

Signed-off-by: Mickaël Raulet <mraulet@insa-rennes.fr>
cherry picked from commit f518bb22531c648f1c37f978b0c7ad2e71e04c25
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-28 00:55:44 +02:00
Mickaël Raulet
772f7f4edd hevc: fix skip_flag
cherry picked from commit 509ae456551005b9bf9b4d9730b6247c97fdd990

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-28 00:47:28 +02:00
Mickaël Raulet
3b777db132 hevc: remove non necessary parameters to ff_hevc_set_qpy
cherry picked from commit 6f58c111ad9920d983bb18eacf901193bac5d937

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-28 00:39:13 +02:00
Mickaël Raulet
23480da0aa hevc: add support for bumping process
cherry picked from commit 8aa2fb7df3cffc67a3fd03a3a7eb49dbed4094c7

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 15:40:34 +02:00
Mickaël Raulet
f6e218a02d hevc: fix RAP_B_Bossen
cherry picked from commit 903236292f066bc321080e3e2192b64f8943d960

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-26 02:01:04 +02:00
Timothy Gu
c508adb223 hevc: propagate error code from set_sps()
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 16:25:55 +02:00
Mickaël Raulet
fa0506e413 hevc/rext: update boundary strength for chroma deblocking filter
cherry picked from commit 7d05c95ac5a63d7675bf645e74b4cf1fffff4796

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 13:00:14 +02:00
Mickaël Raulet
950a4f8326 hevc: fix offset for sao temporary frame
fixes fate on alpha

cherry picked from commit 0a8ce1cbdaff7cd026bcf95ee3787bc7b4c063ee

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-20 02:48:53 +02:00
Christophe Gisquet
7a4a5515b0 hevc: use intreadwrite
When dealing with MVs, both components may be processed at a time.

On Win64, 560 to 539 cycles for derive_spatial_merge_candidates.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-19 15:27:08 +02:00
Michael Niedermayer
ffa0b510cd avcodec/hevc: fix pict_type
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-18 22:59:03 +02:00
Mickaël Raulet
d249e6828e hevc/sao: optimze sao implementation
- adding one extra pixel all around the frame
- do not copy when SAO is not applied

5% improvement

cherry picked from commit 10fc29fc19a12c4d8168fbe1a954b76386db12d0
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-18 22:46:50 +02:00
Michael Niedermayer
cf92cc8751 avcodec/hevc: clear HEVClcList[i] on allocation
Fixes fate failure with --enable-memory-poisoning && make THREAD_TYPE=slice THREADS=7  fate-hevc-conformance-ENTP_C_Qualcomm_1

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-16 01:34:57 +02:00
Michael Niedermayer
880dbe43ca avcodec/hevc: treat current_sps like sps_list
This simplifies the management of current_sps
Fixes Ticket3458

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 21:49:56 +02:00
Mickaël Raulet
453f8eaee2 hevc/rext: add support for Range extension tools
SPS features/flags:
- transform_skip_rotation_enabled_flag
- transform_skip_context_enabled_flag
- implicit_rdpcm_enabled_flag
- explicit_rdpcm_enabled_flag
- intra_smoothing_disabled_flag
- persistent_rice_adaptation_enabled_flag

PPS features/flags:
- log2_max_transform_skip_block_size
- cross_component_prediction_enabled_flag
- chroma_qp_offset_list_enabled_flag
- diff_cu_chroma_qp_offset_depth
- chroma_qp_offset_list_len_minus1
- cb_qp_offset_list
- cr_qp_offset_list
- log2_sao_offset_scale_luma
- log2_sao_offset_scale_chroma
(cherry picked from commit 005294c5b939a23099871c6130c8a7cc331f73ee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 14:08:20 +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
Mickaël Raulet
255086a7e0 hevc: use local variable for split_cu_flag
(cherry picked from commit ee71e9e9c12fc47856c452efb278f9f593a923ee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 13:31:40 +02:00
Mickaël Raulet
f5beda3bfd hevc: move restore_tqb where it should be.
(cherry picked from commit 8fafc96a9805d11bfe32537c8f78a294a5844065)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 13:25:55 +02:00
Mickaël Raulet
1241eb8870 hevc: simplify SAO computation, delay from one row its computation
(cherry picked from commit f2c5f647cec786df26f442a85e6d685a131a50c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-15 13:11:33 +02:00
Michael Niedermayer
1db641cbd2 avcodec/hevc: more clearing to avoid stale pointers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-12 21:31:37 +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
5d88e40093 avcodec/hevc: check slice_header_extension data length
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-12 07:46:07 +02:00
Michael Niedermayer
c79acacd2e avcodec/hevc: fix nb_sh / nb_sps check
fixes integer overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-12 04:39:01 +02:00
Michael Niedermayer
e1f4397e74 Merge commit '458e7c94830d1522997e33a0b5e87bd709e8a349'
* commit '458e7c94830d1522997e33a0b5e87bd709e8a349':
  hevc: implement pic_output_flag handling

Conflicts:
	libavcodec/hevc.c
	libavcodec/hevc_refs.c

See: 2eddf3a6ef
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-11 12:21:41 +02:00
Michael Niedermayer
aa56c37c8a Merge commit 'f43789b76e661acd93c21664678f140e53cfa1fa'
* commit 'f43789b76e661acd93c21664678f140e53cfa1fa':
  hevc: set the keyframe flag on output frames

See: e2760de605
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-11 12:16:24 +02:00
Gildas Cocherel
458e7c9483 hevc: implement pic_output_flag handling
Sample-Id: OPFLAG_B_Qualcomm_1.bit, OPFLAG_C_Qualcomm_1.bit
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-07-11 08:52:54 +00:00
Mickaël Raulet
f43789b76e hevc: set the keyframe flag on output frames
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-07-11 08:43:01 +00:00
Mickaël Raulet
1493b237bd hevc: Replace nal type chek with equivalent IS_IRAP macro
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-07-11 08:41:32 +00:00
Christophe Gisquet
eca1957c4c hevc: reorder loops
iterate over memory in a more continuous order

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-10 14:46:49 +02:00
Michael Niedermayer
efc66d69bf Merge commit '0569a7e0bd2006d9a5248d17a1f4bf3ca654ae50'
* commit '0569a7e0bd2006d9a5248d17a1f4bf3ca654ae50':
  hevc: parse display orientation SEI message

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-10 00:19:43 +02:00
Vittorio Giovara
0569a7e0bd hevc: parse display orientation SEI message
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-07-09 10:18:06 -04:00
Michael Niedermayer
982920cfaa Merge commit 'df949b645b12d62bb4da56d629a887c81f67f2e5'
* commit 'df949b645b12d62bb4da56d629a887c81f67f2e5':
  hevc: Use the local context variable when needed

Conflicts:
	libavcodec/hevc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-03 13:19:34 +02:00
Luca Barbato
df949b645b hevc: Use the local context variable when needed 2014-07-02 23:30:49 -04:00
Michael Niedermayer
7faa7d3d42 avcodec/hevc: Use av_malloc(z)_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-01 03:50:17 +02:00
Michael Niedermayer
35bb74900b Merge commit 'c67b449bebbe0b35c73b203683e77a0a649bc765'
* commit 'c67b449bebbe0b35c73b203683e77a0a649bc765':
  dsputil: Split bswap*_buf() off into a separate context

Conflicts:
	configure
	libavcodec/4xm.c
	libavcodec/ac3dec.c
	libavcodec/ac3dec.h
	libavcodec/apedec.c
	libavcodec/eamad.c
	libavcodec/flacenc.c
	libavcodec/fraps.c
	libavcodec/huffyuv.c
	libavcodec/huffyuvdec.c
	libavcodec/motionpixels.c
	libavcodec/truemotion2.c
	libavcodec/x86/Makefile
	libavcodec/x86/dsputil_init.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 13:31:26 +02:00
Diego Biurrun
c67b449beb dsputil: Split bswap*_buf() off into a separate context 2014-06-22 18:22:31 -07:00
Michael Niedermayer
0dceefc5fa Merge commit '9e500efdbe0deeff1602500ebc229a0a6b6bb1a2'
* commit '9e500efdbe0deeff1602500ebc229a0a6b6bb1a2':
  Add av_image_check_sar() and use it to validate SAR

Conflicts:
	libavcodec/dpx.c
	libavcodec/dvdec.c
	libavcodec/ffv1dec.c
	libavcodec/utils.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-20 22:20:28 +02:00
Justin Ruggles
9e500efdbe Add av_image_check_sar() and use it to validate SAR 2014-06-20 10:39:33 -04:00
Michael Niedermayer
8447658550 Merge commit 'a1c2b48018b09d2613f075ec0748c95bd520ac00'
* commit 'a1c2b48018b09d2613f075ec0748c95bd520ac00':
  hevc: templatize intra_pred

Conflicts:
	libavcodec/hevc.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-19 14:10:13 +02:00
Anton Khirnov
a1c2b48018 hevc: templatize intra_pred 2014-05-19 07:10:03 +02:00
Mickaël Raulet
e2760de605 hevc: fix key_frame as an IRAP
it was always 1 before with ISOBMFF(cherry picked from commit fb1402b1ec78d80acd6ced76bf78d65560965c4c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-17 01:14:51 +02:00
Michael Niedermayer
2201d1a0f8 avcodec/hevc: Fix undefined shifts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-09 13:34:12 +02:00
Michael Niedermayer
84655bdaed avcodec/hevc: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-07 02:07:12 +02:00
Mickaël Raulet
83976e40e8 hevc: C code update for new motion compensation
pretty print C

Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-06 18:22:34 +02:00
gcocherel
2eddf3a6ef avcodec/hevc: fix no output of prior pics and pic output flags(cherry picked from commit e99b96dff1d76d74cb5633aa9702828d863050e2)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-29 22:43:25 +02:00
Michael Niedermayer
6795dcfa65 avcodec/hevc: Export picture type
This only uses the first slice, improvement here is welcome
analyzing all slices the trivial way would interfere with threads

Fixes Ticket3185

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 04:20:52 +01:00
Michael Niedermayer
06219db935 Merge commit 'ed06e5d92b4c67b49068d538461fbbe0a53a8c5e'
* commit 'ed06e5d92b4c67b49068d538461fbbe0a53a8c5e':
  hevc: Do not turn 32bit timebases into negative numbers

Conflicts:
	libavcodec/hevc.c

See: bf2ce19e51
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 21:16:33 +01:00
Michael Niedermayer
ed06e5d92b hevc: Do not turn 32bit timebases into negative numbers
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-03-09 17:22:53 +01:00
Michael Niedermayer
6cc94e9719 hevc: use av_mallocz() for allocating tab_ipm
Fixes use of uninitialized memory and out of stack array read.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-03-09 17:08:11 +01:00
Michael Niedermayer
ca9f7e1832 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hevc: Always consider VLC NALU type mismatch fatal

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-19 22:34:41 +01:00
Luca Barbato
521726ff57 hevc: Always consider VLC NALU type mismatch fatal
Sample-Id: 00001667-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2014-02-19 16:59:40 +01:00
Michael Niedermayer
bf2ce19e51 avcodec/hevc: Dont turn 32bit timebases into negative numbers
Fixes assertion failure
Fixes: 499f6ecaeae8e3f79a115a72c61ffd15-asan_static-oob_124a175_2792_cov_1782273879_RPLM_A_qualcomm_4.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-15 23:17:53 +01:00
Michael Niedermayer
3b6655ebff avcodec/hevc: remove FFUMOD() in slice qp_y init
This has become redundant

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 12:27:00 +01:00
Michael Niedermayer
1e263133cc avcodec/hevc: remove unused variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 12:27:00 +01:00
Michael Niedermayer
64278039e5 avcodec/hevc: Simplify get_qPy_pred()
Fixes use of uninitialized memory
Fixes: 93728afd9aa074ba14a09bfd93a632fd-asan_static-oob_124a17d_1445_cov_1021181966_DBLK_D_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 00:22:49 +01:00
Michael Niedermayer
1a3ed056c5 avcodec/hevc: make check for previous slice segment tighter
This ensures the previous one is matching the curent and not just any

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 00:22:49 +01:00
Michael Niedermayer
6ef57f4d9a avcodec/hevc: hls_decode_entry: check that the previous slice segment is available before decoding the next
Fixes use of uninitialized memory
Fixes out of array read
Fixes assertion failure
Fixes part of cb307d24befbd109c6f054008d6777b5/asan_static-oob_124a175_1445_cov_2355279992_DBLK_D_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-07 04:40:37 +01:00
Michael Niedermayer
a18f111582 avcodec/hevc: clear tab_slice_address of ctb on error.
This allows us to detect which areas have failed to decode

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-07 04:30:31 +01:00
Michael Niedermayer
56985d26d7 avcodec/hevc: clear tab_slice_address in hevc_frame_start()
Fixes inconsistencies
Fixes use of uninitilaized memory
Fixes part of  cb307d24befbd109c6f054008d6777b5/asan_static-oob_124a175_1445_cov_2355279992_DBLK_D_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-07 03:47:49 +01:00
Michael Niedermayer
a0d5204cd9 Merge commit 'b25e84b7399bd91605596b67d761d3464dbe8a6e'
* commit 'b25e84b7399bd91605596b67d761d3464dbe8a6e':
  hevc: check that the VCL NAL types are the same for all slice segments of a frame

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-04 13:44:39 +01:00
Anton Khirnov
b25e84b739 hevc: check that the VCL NAL types are the same for all slice segments of a frame
Fixes possible invalid memory access for mismatching skipped/non-skipped
slice segments.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Sample-Id: 00001533-google
2014-02-04 10:39:07 +01:00
Michael Niedermayer
d9bb7fc3cb Merge commit '816e5b997028c8215c804b1e58b2388592ed612b'
* commit '816e5b997028c8215c804b1e58b2388592ed612b':
  hevc: Reject impossible slice segment

Conflicts:
	libavcodec/hevc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-02 05:40:30 +01:00
Michael Niedermayer
96c4ba2392 avcodec/hevc: propagate error code from hls_coding_quadtree()
Fixes use of uninitialized memory
Fixes out of array read
Fixes: asan_static-oob_123cee5_2630_cov_1869071233_PICSIZE_A_Bossen_1.bin
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-02 02:35:11 +01:00
Luca Barbato
816e5b9970 hevc: Reject impossible slice segment
A dependent slice cannot have address 0.
Prevent an out of array bound load in ff_hevc_cabac_init().

Sample-Id: 00001406-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2014-02-01 17:04:49 +01:00
Michael Niedermayer
a69dd1163b Merge commit 'e22ebd04bcab7f86548794556c28ecca46d9c2ac'
* commit 'e22ebd04bcab7f86548794556c28ecca46d9c2ac':
  hevc: Bound check cu_qp_delta

Conflicts:
	libavcodec/hevc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-21 15:42:51 +01:00
Michael Niedermayer
58f437c3f6 Merge commit '0d999333f96a34903448579bf13a3209deaee9da'
* commit '0d999333f96a34903448579bf13a3209deaee9da':
  hevc: Bound check slice_qp

Conflicts:
	libavcodec/hevc.c

See: aead772b58
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-21 15:38:29 +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
Luca Barbato
e22ebd04bc hevc: Bound check cu_qp_delta
The T-REC-H.265-2013044 page 91 states it has to be in the range
[-(26 + s->sps->qp_bd_offset / 2), (25 + s->sps->qp_bd_offset / 2)].
2014-01-21 11:59:54 +01:00
Luca Barbato
0d999333f9 hevc: Bound check slice_qp
The T-REC-H.265-2013044 page 79 states it has to be in the range
[-s->sps->qp_bd_offset, 51].

Sample-Id: 00001386-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2014-01-21 11:59:30 +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
Michael Niedermayer
d5c15ebeaf hevc: Fix modulo operations
Keep qp fields within the range.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-21 11:57:43 +01:00
Michael Niedermayer
22bfb4be28 avcodec/hevc: Check entry point arrays for malloc failure
Fixes null pointer dereference
Fixes: signal_sigsegv_e1d3b6_2192_DBLK_F_VIXS_2.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-13 05:04:13 +01:00
Luca Barbato
aead772b58 hevc: Bound check slice_qp
The T-REC-H.265-2013044 page 79 states they have to be into the range
[-s->sps->qp_bd_offset, 51].

Fixes: asan_stack-oob_eae8e3_9522_WP_MAIN10_B_Toshiba_3.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-13 05:04:13 +01:00
Luca Barbato
48a5b15543 hevc: Reject impossible dependent tile
The tile 0 cannot depend on a previous one.
Prevent an out of array bound load in ff_hevc_cabac_init().

Fixes: asan_heap-oob_e3a924_1630_DBLK_A_MAIN10_VIXS_2.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

Reviewed-by: Guillaume Martres <smarter@ubuntu.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-13 02:51:53 +01:00
Michael Niedermayer
0999f1613b avcodec/hevc: use av_mallocz() for allocating tab_ipm
Fixes use of uninitialized memory and out of stack array read
Fixes: signal_sigsegv_ecc526_7846_WPP_C_ericsson_MAIN_2.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-11 20:30:22 +01:00
Michael Niedermayer
c1362ca047 Merge commit 'e588615d938f8581f0d6f3771662d08cadfc00de'
* commit 'e588615d938f8581f0d6f3771662d08cadfc00de':
  hevc: fix decoding of one PU wide files

Conflicts:
	libavcodec/hevc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-09 15:30:50 +01:00
Guillaume Martres
e588615d93 hevc: fix decoding of one PU wide files
For those the block size may be larger than the source linesize (if the
edges are not allocated).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-01-09 09:46:13 +01:00
Michael Niedermayer
4ced5d7780 avcodec/hevc: Fix modulo operations
Fixes qp fields becoming out of range
Fixes: asan_static-oob_e393a3_6998_WPP_A_ericsson_MAIN10_2.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-06 04:32:37 +01:00
Michael Niedermayer
21a2fb7e05 avcodec/hevc: clear HEVClc when its deallocated in hevc_decode_free()
Fixes reading freed memory
Fixes: asan_heap-uaf_1abf8ef_3987_NUT_A_ericsson_4.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-31 15:19:59 +01:00
Michael Niedermayer
d6b7ea06f1 Merge commit '2a41826bea3833895dc06939831b7f35ca1f597e'
* commit '2a41826bea3833895dc06939831b7f35ca1f597e':
  lavc: add HEVC profiles names

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

See: fb7d70c1cd
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-21 00:24:43 +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
Gildas Cocherel
321cb8b048 hevc: store profile and level in AVCodecContext
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-20 19:36:24 +01:00
Gildas Cocherel
2a41826bea lavc: add HEVC profiles names
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-20 19:35:27 +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
17a10d51b8 hevc: set time_base when possible
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-11 20:39:54 +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
Michael Niedermayer
b769cf4b44 hevc: do not dereference pointer before NULL check in verify_md5()
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
Michael Niedermayer
31a52a60c9 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hevc: parse frame packing arrangement SEI messages and save relevant stereo3d information

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-09 22:25:38 +01:00
Vittorio Giovara
acb77dff6a hevc: parse frame packing arrangement SEI messages and save relevant stereo3d information 2013-12-09 16:02:43 +01:00
Michael Niedermayer
f1783c05f1 Revert "avcodec/hevc: calculate checksum only if AV_EF_EXPLODE is set"
This reverts commit 758b6d39f6.

Requested-by: smarter
"now that http://git.videolan.org/?p=ffmpeg.git;a=commit;h=97de206b44a48da726807cc3e7b9448a8112760b
 has been merged, http://git.videolan.org/?p=ffmpeg.git;a=commit;h=758b6d39f685a510f48ff9e4c05fffa859d23c42
 could be reverted, this would reduce the delta with libav
 (and it makes sense)"
2013-12-04 11:46:31 +01:00
gcocherel
fb7d70c1cd hevc : add hevc profile
(cherry picked from commit 0c8dfd8ad6400b33da55a9f4d9aa8d3f5c9d209f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 01:29:02 +01:00
gcocherel
36658c978f hevc : update hevc_ps.c
(cherry picked from commit 088f2eb1ae42bffc63c2cee4e7eba8f47056043b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 01:29:02 +01:00
gcocherel
81d0252dac hevc : update hls_decode_neighbour(cherry picked from commit 14341c6d9a6885657ba365807223e96a67d6c0ed)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-21 22:51:51 +01:00
gcocherel
0afa254d4e hevc : fix pcm(cherry picked from commit 12bbfdba1899d11044d2bd8457159fc8b4b52a76)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-21 22:51:51 +01:00
Michael Niedermayer
91e00c4a78 Merge commit '458446acfa1441d283dacf9e6e545beb083b8bb0'
* commit '458446acfa1441d283dacf9e6e545beb083b8bb0':
  lavc: Edge emulation with dst/src linesize

Conflicts:
	libavcodec/cavs.c
	libavcodec/h264.c
	libavcodec/hevc.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/rv34.c
	libavcodec/svq3.c
	libavcodec/vc1dec.c
	libavcodec/videodsp.h
	libavcodec/videodsp_template.c
	libavcodec/vp3.c
	libavcodec/vp8.c
	libavcodec/wmv2.c
	libavcodec/x86/videodsp.asm
	libavcodec/x86/videodsp_init.c

Changes to the asm are not merged, they are left for volunteers or
in their absence for later.
The changes this merge introduces are reordering of the function
arguments

See: face578d56
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-15 15:07:10 +01:00
Ronald S. Bultje
458446acfa lavc: Edge emulation with dst/src linesize
Allow supporting files for which the image stride is smaller than
the maximum block size + number of subpel mc taps, e.g. a 64x64 VP9
file or a 16x16 VP8 file with -fflags +emu_edge.
2013-11-15 10:16:27 +01:00
Michael Niedermayer
b906d04881 Merge commit '885ec9242554ad25922258a595ec5e317922a412'
* commit '885ec9242554ad25922258a595ec5e317922a412':
  hevc: Use parsed VUI colorimetry in avcodec

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 21:37:34 +01:00
Jan Ekström
885ec92425 hevc: Use parsed VUI colorimetry in avcodec
Also limit the parsed VUI values to known valid ones.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2013-11-04 16:03:11 +01:00
Michael Niedermayer
a805e2e653 avcodec/hevc: add "apply_defdispwin" alias for compatibilty with 064698d381
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 18:24:24 +01:00
Michael Niedermayer
35594c48ca libavcodec/hevc: random cosmetics to reduce diff to 064698d381
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 17:28:44 +01:00
Michael Niedermayer
e877455ff9 libavcodec/hevcdsp_template: whitespaces to reduce diff to 064698d381
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 15:11:41 +01:00
Michael Niedermayer
b23692b3a8 libavcodec/hevc: reduce whitespace differences to 064698d381
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 14:10:21 +01:00
Michael Niedermayer
1a6948fa70 libavcodec/hevc: reduce bracket differences to 064698d381
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 13:09:31 +01:00
Michael Niedermayer
ce7f1c76bd avcodec/hevc: more whitespaces to reduce difference to 064698d381
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 12:33:54 +01:00
Michael Niedermayer
f578e5d937 avcodec/hevc: Adjust white-spaces to reduce difference to 064698d381
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 00:44:54 +01:00
Mickaël Raulet
38612379bf hevc: fix temporal_id(cherry picked from commit 5eac0df49d33bef7f3ffc5efde19839dddb554e8)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-02 00:44:54 +01:00
Michael Niedermayer
5eb1704d5f Merge commit '064698d381e1e7790f21b0199a8930ea04e2e942'
* commit '064698d381e1e7790f21b0199a8930ea04e2e942':
  Add HEVC decoder

Conflicts:
	Changelog
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/hevc.c
	libavcodec/hevc.h
	libavcodec/hevc_cabac.c
	libavcodec/hevc_filter.c
	libavcodec/hevc_mvs.c
	libavcodec/hevc_parser.c
	libavcodec/hevc_ps.c
	libavcodec/hevc_refs.c
	libavcodec/hevc_sei.c
	libavcodec/hevcdsp.c
	libavcodec/hevcdsp_template.c
	libavcodec/hevcpred.c
	libavcodec/hevcpred_template.c
	libavcodec/version.h

cosmetics from hevc.h & hevc_ps.c mostly merged, other files left as they where in ffmpeg.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-01 17:13:00 +01:00
Guillaume Martres
064698d381 Add HEVC decoder
Initially written by Guillaume Martres <smarter@ubuntu.com> as a GSoC
project. Further contributions by the OpenHEVC project and other
developers, namely:

Mickaël Raulet <mraulet@insa-rennes.fr>
Seppo Tomperi <seppo.tomperi@vtt.fi>
Gildas Cocherel <gildas.cocherel@laposte.net>
Khaled Jerbi <khaled_jerbi@yahoo.fr>
Wassim Hamidouche <wassim.hamidouche@insa-rennes.fr>
Vittorio Giovara <vittorio.giovara@gmail.com>
Jan Ekström <jeebjp@gmail.com>
Anton Khirnov <anton@khirnov.net>
Martin Storsjö <martin@martin.st>
Luca Barbato <lu_zero@gentoo.org>
Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>
Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diego Biurrun <diego@biurrun.de>

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-31 20:19:59 +01:00
Carl Eugen Hoyos
5ab1efb9d0 Fix a crash on oom when decoding hevc. 2013-10-31 20:17:18 +01:00
Mickaël Raulet
7c8b65f688 hevc: add partial support for interlaced(cherry picked from commit 44b592ae6d323445c076ef3ec966ebf9daa8bccf)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-31 10:00:22 +01:00
Anton Khirnov
cb148e56dc hevc: refactor pic_arrays and set_sps
(cherry picked from commit a6686c6d83b50c0962269f2c487f4f0c57e0df79)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-28 10:37:10 +01:00
Anton Khirnov
4db81f0817 hevc: add irap checks
(cherry picked from commit 3d3bbe35541a308937d0fe72b20a1c29d1c4100d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-28 10:37:09 +01:00
Anton Khirnov
2f77894ccc hevc: better mt implementation
Signed-off-by: Mickaël Raulet <mraulet@insa-rennes.fr>
(cherry picked from commit 93afb8c519deca85b3c97804927de5b016dd32d1)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 23:49:50 +01:00
Mickaël Raulet
2707cca78f hevc: cosmetic change(cherry picked from commit 3b57513b3f39c04337801fb9d159c7ca8dfa9deb)
Decreases the difference to Anton Khirnovs patch v5

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 23:48:11 +01:00
Mickaël Raulet
3106cbd321 hevc: more cosmetic(cherry picked from commit 9697abe41daa234602915f85bf6b1c0ca0252cff)
Decreases the difference to Anton Khirnovs patch v5

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 23:46:54 +01:00
Mickaël Raulet
3c3ece24ea hevc : cosmetic changes(cherry picked from commit 7308c0ccf13f18cebe4851e6dcd6b5c0b09be1dd)
Decreases the difference to Anton Khirnovs patch v5

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 23:45:34 +01:00
Michael Niedermayer
758b6d39f6 avcodec/hevc: calculate checksum only if AV_EF_EXPLODE is set
This avoids a slowdown with the default of enabled CRC checks

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 22:31:04 +01:00
Michael Niedermayer
10386710fd Merge commit 'afa93d198aaf2cc661c4df6d4095cd030265d30a'
* commit 'afa93d198aaf2cc661c4df6d4095cd030265d30a':
  hevc_parser: Set pict_type, key_frame and output_picture_number.
  hevc: Search start code in decode_nal_units().

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 11:29:37 +01:00
Yusuke Nakamura
afa93d198a hevc_parser: Set pict_type, key_frame and output_picture_number.
Conflicts:
	libavcodec/hevc.c
2013-10-27 11:07:43 +01:00
Yusuke Nakamura
f7f8801839 hevc: Search start code in decode_nal_units().
User may cut off a weird position and send a packet from there.
This avoids returning as invalid data immediately.
2013-10-27 10:43:14 +01:00
Michael Niedermayer
92f649b411 avcodec/hevc: remove CODEC_CAP_EXPERIMENTAL
Approved-by: mraulet
Approved-by: smarter
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-23 20:00:11 +02:00
Michael Niedermayer
610a8b1537 avcodec/hevc/extract_rbsp: fix error return type
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-22 20:31:49 +02:00
Mickaël Raulet
0c8aba3842 hevc: add wavefront parallel processing
cherry picked from commit b971f2c8fdc60f8bab605a6e8060492eb548a53a
cherry picked from commit e57b0a2c915ce6b8a9d57b8292f6581f0680842e

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-22 20:20:40 +02:00
Mickaël Raulet
1c8de4dd94 hevc: pretty print(cherry picked from commit 6332b3afe298b9e1060e8549aea3aa2771b43f5d)
Conflicts:

	libavcodec/hevc.h
	libavcodec/hevc_filter.c
	libavcodec/hevc_refs.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-22 08:41:14 +02:00
Mickaël Raulet
a8fafa8978 hevc: cleaning disable field in deblocking filter(cherry picked from commit 7dd7a27ae850a51b3c9cd07046c422677398f6d5)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-22 08:41:14 +02:00
Mickaël Raulet
1912842045 hevc: remove disable_au option(cherry picked from commit e90b3f6753d645fec076e951a0597a5dc2d2fe31)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-22 08:41:14 +02:00
Mickaël Raulet
09ba986cae avcodec/hevc: fix duplicate/wrong nal unit check and difference to openhevc_upstream
NAL_BLA_W_RADL instead of NAL_BLA_N_LP

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-21 10:48:24 +02:00
Michael Niedermayer
f2eca8d060 avcodec/hevc: do not dereference pointer before null check in verify_md5()
Fixes: CID1108607

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-20 00:35:18 +02:00
Mickaël Raulet
b5d197a38b hevc: inline cabac in hls_mvd_coding(cherry picked from commit ad387195ad04e8a005a1bfd509e9e4f827e68fa9)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-20 00:31:33 +02:00
Mickaël Raulet
92a97d1168 hevc: inline cabac in residual coding(cherry picked from commit 17d7a880445b72feb36d684ae1f0597195811e97)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-20 00:31:25 +02:00
Michael Niedermayer
4c67ed8705 avcodec/hevc: fix EOB/EOS check
Fixes: CID1108575
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-20 00:23:48 +02:00
Mickaël Raulet
a7e300649a hevc: fix pcm with different chroma luma bit widths(cherry picked from commit 6a444516f338424d062c0ef2806714036283603b)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-17 02:42:11 +02:00
Mickaël Raulet
b494894390 hevc: optimize residual coding(cherry picked from commit 70692a44708157b4dfa50e402e446bfa2b27f55e)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-17 02:41:51 +02:00
Michael Niedermayer
f2dd45d06c lavc/hevc: mark decoder as experimental
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-15 22:13:02 +02:00
Guillaume Martres
c8dd048ab8 lavc: add a HEVC decoder.
Initially written by Guillaume Martres <smarter@ubuntu.com> as a GSoC
project. Further contributions by the OpenHEVC project and other
developers, namely:

Mickaël Raulet <mraulet@insa-rennes.fr>
Seppo Tomperi <seppo.tomperi@vtt.fi>
Gildas Cocherel <gildas.cocherel@laposte.net>
Khaled Jerbi <khaled_jerbi@yahoo.fr>
Wassim Hamidouche <wassim.hamidouche@insa-rennes.fr>
Vittorio Giovara <vittorio.giovara@gmail.com>
Jan Ekström <jeebjp@gmail.com>
Anton Khirnov <anton@khirnov.net>
Martin Storsjö <martin@martin.st>
Luca Barbato <lu_zero@gentoo.org>
Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>

Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-15 22:13:02 +02:00