1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-27 20:01:50 +02:00
Commit Graph

67 Commits

Author SHA1 Message Date
Philip Langdale
e990713ff9 avcodec/hevcdec: Declare that nvdec supports 12bit decoding 2018-03-02 14:28:13 -08:00
Michael Niedermayer
f82dd4c09b avcodec/hevcdec: Check luma/chroma_log2_weight_denom
Fixes: signed integer overflow: 3 + 2147483647 cannot be represented in type 'int'
Fixes: 5888/clusterfuzz-testcase-minimized-5634701067812864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-18 23:27:02 +01:00
James Almer
1f0cf1b2f4 avcodec/hevcdec: use ff_hevc_uninit_parameter_sets()
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-21 00:09:29 -03:00
sfan5
05c1c79d37 libavcodec/hevcdec: implement skip_frame
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-20 22:26:31 +01:00
James Almer
d268094f88 Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'
* commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa':
  stereo3d: Support view type for frame sequence type

Merged-by: James Almer <jamrial@gmail.com>
2017-11-29 21:06:49 -03:00
Vittorio Giovara
99e9697e3a stereo3d: Support view type for frame sequence type
Implement detection in h264 and hevc and insertion in framepack filter.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-11-28 14:56:51 -05:00
Mark Thompson
758fbc54fe lavc: Add hardware config metadata for decoders supporting hardware output
This includes a pointer to the associated hwaccel for decoders using
hwaccels - these will be used later to implement the hwaccel setup
without needing a global list.

Also added is a new file listing all hwaccels as external declarations -
this will be used later to generate the hwaccel list at configure time.
2017-11-26 21:35:53 +00:00
Aman Gupta
3a91b3ae74 avcodec/hevc: implement new decode_params callback for VideoToolbox
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-11-13 14:32:48 -08:00
James Almer
1178babaca Merge commit 'b90fdb2c7199cc8b0e8d994fafba1fb4dc181d88'
* commit 'b90fdb2c7199cc8b0e8d994fafba1fb4dc181d88':
  hevcdec: add a CUVID hwaccel

Adapted for ffmpeg by Timo Rothenpieler.

Merged-by: James Almer <jamrial@gmail.com>
2017-11-10 20:43:15 -03:00
James Almer
7762942045 Merge commit '00fd914d4912322212e924c15f325cebf2fde8d3'
* commit '00fd914d4912322212e924c15f325cebf2fde8d3':
  hevcdec: set the active SPS before calling get_format()

Merged-by: James Almer <jamrial@gmail.com>
2017-11-10 20:31:55 -03:00
James Almer
b1ab02895b Merge commit 'c3f0357bdf7d3c542aad2c58b94184b9f56edc41'
* commit 'c3f0357bdf7d3c542aad2c58b94184b9f56edc41':
  hevcdec: move the MD5 context out of HEVCSEIPictureHash back into HEVCContext

Merged-by: James Almer <jamrial@gmail.com>
2017-10-31 12:48:36 -03:00
Aman Gupta
3d4f8b9184 avcodec/videotoolbox: add hevc support
Signed-off-by: Aman Gupta <aman@tmm1.net>
2017-09-28 16:47:47 -07:00
Anton Khirnov
b90fdb2c71 hevcdec: add a CUVID hwaccel 2017-07-28 14:12:56 +02:00
Anton Khirnov
00fd914d49 hevcdec: set the active SPS before calling get_format()
This way the SPS is available to the hwaccel init code.
2017-07-28 14:12:30 +02:00
Vittorio Giovara
ce1a99d870 hevc: Make sure to update the current frame transfer characteristic
Otherwise the first decoded frame will still be tagged with the
original transfer instead of the alternative one.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-07-21 20:44:05 +02:00
Vittorio Giovara
dc9735eb67 hevc: Make sure to update the current frame transfer characteristic
Otherwise the first decoded frame will still be tagged with the
original transfer instead of the alternative one.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-07-21 20:07:40 +02:00
Wan-Teh Chang
b77e26b285 avcodec/hevcdec: hevc_await_progress: declare |y| only if used.
hevc_await_progress() uses the variable |y| only inside the "if" block.
So |y| only needs to be declared and initialized in that block.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-21 02:08:33 +02:00
Michael Niedermayer
c8cfbc6629 avcodec/hevcdec: do not let updated extradata corrupt state
Fixes: out of array access
Fixes: 2451/clusterfuzz-testcase-minimized-4781613957251072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-05 04:37:57 +02:00
wm4
ff2d21a58c hevcdec: properly export some side data with frame threading
I noticed this with mastering display data. If frame threading is
enabled, this side data is exported only for some frames. It turns out
it's not properly propagated to the worker threads.

I didn't touch A53 captions, because that involves memory allocation and
freeing the data as side data is exported.

Micro bump so that API users can detect the bug fix.
2017-06-30 19:18:11 +02:00
Vittorio Giovara
969f215957 hevc: Add support for alternative transfer characterics SEI
The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-28 09:44:09 -04:00
Vittorio Giovara
3426832ac3 hevc: Add support for alternative transfer characterics SEI
The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-28 09:42:24 -04:00
Michael Niedermayer
2c874548d6 avcodec/hevcdec: do basic validity check on delta_chroma_weight and offset
Fixes: runtime error: signed integer overflow: 2147483520 + 128 cannot be represented in type 'int'
Fixes: 2385/clusterfuzz-testcase-minimized-6594333576790016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-27 23:21:12 +02:00
wm4
70143a3954 dxva: add support for new dxva2 and d3d11 hwaccel APIs
This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Merges Libav commit f9e7a2f95a.
Also adds untested VP9 support.
The check for DXVA2 COBJs is removed. Just update your MinGW to
something newer than a 5 year old release.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-27 18:05:02 +02:00
Michael Niedermayer
89f8bff798 avcodec/hevcdec: Do not check the first ff_init_cabac_decoder() call in hls_decode_entry_wpp() for failure
The result of the call is not used in any testcase but breaks some cases if
its failure is considered.

Fixes regression found by jamrial

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-25 04:25:56 +02:00
Michael Niedermayer
2476067680 avcodec/hevcdec: Use error path if init_get_bits8() fails
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Michael Niedermayer
933aa91e31 avcodec/hevcdec: check ff_init_cabac_decoder() for failure
Fixes: runtime error: left shift of 1965559808 by 4 places cannot be represented in type 'int'
Fixes: 2333/clusterfuzz-testcase-minimized-5223935677300736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-24 22:17:15 +02:00
Michael Niedermayer
fdfbcbdd14 avcodec/hevcdec: Check beta and tc offset in hls_slice_header()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-21 02:25:23 +02:00
Michael Niedermayer
1edbf5e20c avcodec/hevcdec: Fix signed integer overflow in decode_lt_rps()
Fixes: runtime error: signed integer overflow: 2147483647 + 6 cannot be represented in type 'int'
Fixes: 2263/clusterfuzz-testcase-minimized-4800359627227136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-17 00:34:48 +02:00
Michael Niedermayer
bc40674462 avcodec/hevcdec: Check nb_sps
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-15 03:09:40 +02:00
wm4
f9e7a2f95a dxva: add support for new dxva2 and d3d11 hwaccel APIs
This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-08 21:20:18 +02:00
James Almer
000fb61a71 avcodec/hevcdec: export cropping information instead of handling it internally
This merges commit a02ae1c683 from libav,
originally written by Anton Khirnov and skipped in
fc63d5ceb3.

 libavcodec/hevc_parser.c |  6 ++++--
 libavcodec/hevc_ps.c     | 31 ++++++++++++-------------------
 libavcodec/hevc_ps.h     |  2 --
 libavcodec/hevc_refs.c   | 18 +++++-------------
 libavcodec/hevcdec.c     |  7 ++++---
 libavcodec/hevcdec.h     |  2 --
 6 files changed, 25 insertions(+), 41 deletions(-)

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-26 11:15:45 -03:00
Ronald S. Bultje
ca2209d67a hevc: fix race condition in max_ra/seq_decode.
These variables are shared between frame threads, but they are updated
post-setup_finished() if a EOB/EOS slice type occurs. Moving the EOB/EOS
slices to the next frame thread instance (by parsing them leading into
the next picture instead of trailing behind the last picture) effectively
prevents this race condition.

This fixes tsan failures on hevc-conformance-NoOutPrior_A_Qualcomm_1.
2017-05-25 10:29:07 -04:00
Anton Khirnov
c3f0357bdf hevcdec: move the MD5 context out of HEVCSEIPictureHash back into HEVCContext
HEVCSEIPictureHash should store only the information extracted from the
bitstream and exported to the higher layer (the decoder or the parser).
The MD5 context is allocated, used and freed by this higher layer, so it
makes more sense for it to also be stored there.
2017-05-20 09:41:30 +02:00
James Almer
648a0b4503 hevcdec: remove HEVCContext usage from hevc_sei
Based on the H264 SEI implementation.

This will be mainly useful once support for SEI messages that can be
used by the hevc parser are implemented, like Picture Timing.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-05-09 13:42:20 +02:00
James Almer
6a72578cc2 avcodec/hevc_parse: decode SEI message NALUs in extradata
They may be available in hvcc style extradata.

Based on a patch by Hendrik Leppkes.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-05 17:30:38 -03:00
James Almer
1d53b8e907 avcodec/hevcdec: remove HEVCContext usage from ff_hevc_compute_poc()
Move it to hevc_ps as well. This is in preparation for a following patch.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-05 17:30:36 -03:00
James Almer
c4b08c8a4e avcodec/hevcdec: remove HEVCContext usage from hevc_sei
Based on the H264 SEI implementation.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-05 17:30:35 -03:00
Clément Bœsch
78a5fc4579 lavc/hevcdec: fix invalid use of ff_get_format()
Regression since 76cc100afb.

Spotted-by: James Almer <jamrial@gmail.com>
2017-04-26 17:35:28 +02:00
Clément Bœsch
84a368f6fe Merge commit '373fd76b4dbd9aa03ed28e502f33f2ca8c1ce19a'
* commit '373fd76b4dbd9aa03ed28e502f33f2ca8c1ce19a':
  hevcdec: do not set decoder-global SPS prematurely

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-26 17:25:54 +02:00
Clément Bœsch
76cc100afb Merge commit '86157e6db2c7a9222f77fa7e7f50fb9aebc3aa81'
* commit '86157e6db2c7a9222f77fa7e7f50fb9aebc3aa81':
  hevc: decouple calling get_format() from exporting the SPS parameters

See 786032cad8 (which has been reverted
and replaced with Anton's version to reduce diffs between the two
projects).

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-26 14:32:09 +02:00
James Almer
4588063f3e avcodec/hevcdec: remove duplicate extradata parsing function
Use ff_hevc_decode_extradata() instead, which correctly only tries
to decode parameter set NAL units and not any other NAL that may be
present in extradata.

Reviewed-by: nevcairiel
Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-09 14:09:05 -03:00
Steve Lhomme
157e57a181 lavc: Add Content Light Level side metadata found in HEVC
These data are necessary when transmitting HDR over HDMI.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-06 11:38:15 -03:00
Ronald S. Bultje
1f50baa2b2 hevc: only write to max_ra and pocTid0 in the first slice.
Values from subsequent values are guaranteed to be identical (since
poc and nal_unit_type are checked to be the same between slices), so
this doesn't affect output in any way, but does resolve the remaining
reported race conditions (by tsan) in fate-hevc.

In practice, this fixes tsan warnings like this:

WARNING: ThreadSanitizer: data race (pid=25334)
  Read of size 4 at 0x7d9c0001adcc by main thread (mutexes: write M1386):
    #0 hevc_update_thread_context src/libavcodec/hevcdec.c:3310 (ffmpeg+0x000000b41c7c)
[..]
  Previous write of size 4 at 0x7d9c0001adcc by thread T1 (mutexes: write M1383):
    #0 hls_slice_header src/libavcodec/hevcdec.c:596 (ffmpeg+0x000000b43a22)
2017-04-03 09:51:10 -04:00
Martin Storsjö
e788ca05a7 hevcdec: Use LOCAL_ALIGNED_* for declaring local variables with alignment
Not all compilers can do alignment larger than the normal stack alignment
for variables on the stack. In these cases, the LOCAL_ALIGNED_* macros
produce the workaround alignment wrapper consisting of a padded array
and a pointer variable.

This fixes the hevc fate tests on RVCT/ARMCC after adding IDCT assembly
that actually assumes/relies on this alignment.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-29 09:08:31 +03:00
Ronald S. Bultje
bddabfaab6 hevc: initialize no_rasl_output_flag in hevc_frame_start().
This prevents a race condition in files with multiple slices per frame.
2017-03-28 18:04:27 -04:00
James Almer
dc39ccdc3b Merge commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f'
* commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f':
  hevc: move the SliceType enum to hevc.h

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 20:02:11 -03:00
James Almer
4a5810b659 Merge commit 'f6e2f8a9ffda2247bffba991450990d075ea68e3'
* commit 'f6e2f8a9ffda2247bffba991450990d075ea68e3':
  hevcdec: move parameter set parsing into a separate header

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 15:53:00 -03:00
James Almer
b29c8c995f Merge commit '150c896a9e46b23b97debb0a5f66fbaeaa32f153'
* commit '150c896a9e46b23b97debb0a5f66fbaeaa32f153':
  hevcdec: split ff_hevc_diag_scan* declarations into a separate header

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 15:14:06 -03:00
James Almer
6397815be0 Merge commit 'c359d624d3efc3fd1d83210d78c4152bd329b765'
* commit 'c359d624d3efc3fd1d83210d78c4152bd329b765':
  hevcdec: move decoder-independent declarations into a separate header

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 14:27:48 -03:00
Clément Bœsch
038e6aef7a Merge commit '4abe3b049d987420eb891f74a35af2cebbf52144'
* commit '4abe3b049d987420eb891f74a35af2cebbf52144':
  hevc: rename hevc.[ch] to hevcdec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-23 16:48:41 +01:00