1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
Commit Graph

211 Commits

Author SHA1 Message Date
Mark Thompson
2594f6a362 lavc: Rename hwaccel.h to hwconfig.h
This already applied to decoders as well as hwaccels, and adding encoder
support was going to make the name even more inaccurate.
2020-04-26 18:38:25 +01:00
Nicolas Gaullier
1ec86be79b avcodec/mpeg12dec: Add CPB coded side data
This fixes mpeg2video stream copies to mpeg muxer like this:
  ffmpeg -i xdcamhd.mxf -c:v copy output.mpg

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-03-20 09:16:05 +01:00
Nicolas Gaullier
eb88ccb92e avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-03-20 09:16:05 +01:00
Michael Niedermayer
c40df2166c avcodec/mpeg12dec: Fix invalid shift in mpeg2_fast_decode_block_intra()
Fixes: left shift of negative value -695
Fixes: 19232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-5702856963522560
Fixes: 19555/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-5741218147598336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-11 23:51:36 +01:00
Zhong Li
12c4d00c10 avcodec/mpeg12dec: always submit the first field to hwaccel
Though this patch to fix ticket #6668, I belive it
is unnecessary to set SLICE_FLAG_ALLOW_FIELD flag to other
hwaccels(dxva, vdpau, etc). Please also refer the orginal comment
of 9cb150c9ab

Should also fix ticket #8442.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-01-02 13:29:46 +01:00
Andreas Rheinhardt
093b6894bf avcodec/mpeg12dec: Sanitize start codes earlier
The MPEG-1/2 decoder uses avpriv_find_start_code to search for start
codes and worked with the resulting start code before checking that it
is really a start code of a slice. In particular, if the picture is so
big that a slice_vertical_position_extension is present, it added the
slice_vertical_position_extension as if it had a slice. Then a left
shift is performed, without making sure that the value to be shifted is
nonnegative.
Afterwards the end result is checked, but even if a start code of a
non-slice has been found, it might pass these checks: If
slice_vertical_position_extension is present a start code <
SLICE_MIN_START_CODE can lead to a macroblock-row index that appears
valid. Furthermore, the left shift might make an invalid start code
appear valid by discarding the highest bit.
This has been fixed by checking directly after avpriv_find_start_code
has returned.

Fixes ticket #8162 (which is about the undefined left shifts).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-26 14:09:14 +02:00
Michael Niedermayer
d217691eec libavcodec/mpeg12dec: Check input for minimal frame size
Fixes: Timeout (35sec -> 6sec)
Fixes: 16901/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-5729024726269952
Fixes: 16901/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-5642388592132096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Kieran Kunhya
f9d3841ae6 mpeg4video: Add support for MPEG-4 Simple Studio Profile.
This is a profile supporting > 8-bit video and has a higher quality DCT
2018-04-02 13:06:23 +01:00
Nekopanda
8b154cb3e9 avcodec/mpeg2dec: Fix field selection for skipped macroblocks
For B field pictures, the spec says,

> The prediction shall be made from the field of the same parity as the field being predicted.

I did it.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-11 02:16:40 +01:00
James Almer
388a0f7869 avcodec/mpeg12dec: fix preprocessor check for mpeg1_nvdec hwaccel
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-21 22:57:41 -03: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
Philip Langdale
8bca292c30 avcodec: Implement mpeg1 nvdec hwaccel
Once I remembered that there's a separate decoder type for mpeg1,
even though params struct is shared with mpeg2, everything worked.
2017-11-20 07:03:26 -08:00
Philip Langdale
7c9f739d86 avcodec: Implement mpeg2 nvdec hwaccel
This is mostly straight-forward. The weird part is that it should
just work for mpeg1, but I see corruption in my test cases, so I'm
going to try and fix that separately.
2017-11-18 08:13:50 -08:00
Aman Gupta
ff8f40a630 avcodec/mpeg12dec: ensure a53_caption_size is reset on malloc failures
Signed-off-by: Aman Gupta <aman@tmm1.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-15 18:14:40 -08:00
Aman Gupta
3f1a540204 avcodec/mpeg12dec: parse A53 caption data embedded in SCTE-20 user data
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-15 18:14:39 -08:00
James Almer
b773a8d8c1 Merge commit 'dd343fd986459f467a2d1d70c26101dff1d47d68'
* commit 'dd343fd986459f467a2d1d70c26101dff1d47d68':
  lavu: Drop deprecated VDPAU pixel formats

Merged-by: James Almer <jamrial@gmail.com>
2017-10-23 18:15:49 -03:00
James Almer
2ccd00dabd Merge commit '5182a28b5de060c51c21b36053ab205bfbbbbe31'
* commit '5182a28b5de060c51c21b36053ab205bfbbbbe31':
  lavc: Drop deprecated global afd field

Merged-by: James Almer <jamrial@gmail.com>
2017-10-23 16:31:50 -03:00
James Almer
b46613dd9b Merge commit 'dcc39ee10e82833ce24aa57926c00ffeb1948198'
* commit 'dcc39ee10e82833ce24aa57926c00ffeb1948198':
  lavc: Remove deprecated XvMC support hacks

Merged-by: James Almer <jamrial@gmail.com>
2017-10-23 15:20:49 -03:00
Ivan Kalvachev
9054439bad Fix visual glitch with XvMC, caused by wrong idct permutation.
In the past XvMC forced simple_idct since
it was using FF_IDCT_PERM_NONE.
However now we have SIMD variants of simple_idct that
are using FF_IDCT_PERM_TRANSPOSE and if they are selected
XvMC would get coefficients in the wrong order.

The patch creates new FF_IDCT_NONE that
is used only for this kind of hardware decoding
and that fallbacks to the old C only simple idct.

Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-12 01:27:52 +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
f670c13f13 avcodec: Rename ff_mpv_decode_mb() to ff_mpv_reconstruct_mb
The new name more accuratly describes what the function does

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-19 17:54:40 +02:00
Michael Niedermayer
c0ece1f4ad avcodec/mpeg12dec: Fixes runtime error: division by zero
Fixes: 1464/clusterfuzz-testcase-minimized-4925445571084288

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-11 00:50:03 +02:00
Vittorio Giovara
5182a28b5d lavc: Drop deprecated global afd field
Deprecated in 08/2014.
2017-03-23 10:09:16 +01:00
Diego Biurrun
dcc39ee10e lavc: Remove deprecated XvMC support hacks
Deprecated in 11/2013.
2017-03-23 10:09:14 +01:00
Michael Niedermayer
a720b854b0 avcodec/mpeg12dec: Fix runtime error: left shift of negative value -1
Fixes: 764/clusterfuzz-testcase-6273034652483584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-13 04:48:43 +01:00
Michael Niedermayer
d757ddbaab avcodec/mpeg12dec: Fix runtime error: left shift of negative value -13
Fixes: 709/clusterfuzz-testcase-4789836449841152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-04 17:48:04 +01:00
Michael Niedermayer
aff8cf18cb avcodec/mpeg12dec: Fix runtime error: left shift of negative value -2
671/clusterfuzz-testcase-4990381827555328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-26 17:16:22 +01:00
Michael Niedermayer
706757d26d avcodec/mpeg12dec: Fix runtime error: left shift of negative value
Fixes: 608/clusterfuzz-testcase-603978286392934

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 19:48:57 +01:00
Michael Niedermayer
3f28caf720 avcodec/mpeg12dec: Provide debug level log on skiped P/B frames
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 02:07:12 +01:00
Anton Khirnov
c2fa6bb0e8 mpeg12dec: move setting first_field to mpeg_field_start()
For field picture, the first_field is set based on its previous value.
Before this commit, first_field is set when reading the picture
coding extension. However, in corrupted files there may be multiple
picture coding extension headers, so the final value of first_field that
is actually used during decoding can be wrong. That can lead to various
undefined behaviour, like predicting from a non-existing field.

Fix this problem, by setting first_field in mpeg_field_start(), which
should be called exactly once per field.

CC: libav-stable@libav.org
Bug-ID: 999
2016-12-19 08:15:49 +01:00
Anton Khirnov
e807491fc6 mpeg12dec: avoid signed overflow in bitrate calculation
CC: libav-stable@libav.org
Bug-Id: 981
Found-By: Agostino Sarubbo
2016-12-19 08:15:42 +01:00
Michael Niedermayer
5b73ba9887 avcodec/mpeg12dec: Add FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
This decreases the amount of computations and memory needed for analysing mpeg1/2 streams

the properties update is moved from code that is skiped if skip_frame is set
to code that is not skiped so the change doesnt loose that
from being executed

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-10 04:58:52 +01:00
Andreas Cadhalpun
a92f8edf0c mpeg12dec: unref discarded picture from extradata
Otherwise another frame gets referenced into picture, triggering an assert
(from commit 13aae8) in av_frame_ref.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-21 19:41:29 +02:00
Moritz Barsnick
3305f71025 lavc: fix typos
Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-09 20:09:00 +02:00
Jonathan Campbell
c19da0cfd8 avcodec/mpeg12dec: add comments documenting the format of the DVD CC user-data packet.
this is to aid development and maintenance of that code.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-13 04:53:28 +02:00
Clément Bœsch
6c98398b0b lavc/get_bits: add a logging context to check_marker()
Based on d338abb664
2016-06-22 20:07:49 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Michael Niedermayer
cb84c12fa2 avcodec/mpeg12dec: Print position in end mismatch error
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-01 01:43:06 +02:00
Michael Niedermayer
390703fcf5 avcodec/mpeg12dec: Do not choke on extra m704 alpha data
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-01 01:43:06 +02:00
Mark Thompson
d264c720f7 lavu: deprecate AV_PIX_FMT_VAAPI_*, replace with AV_PIX_FMT_VAAPI
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-03-19 15:40:22 +01:00
Michael Niedermayer
10fa50c156 avcodec/mpeg12dec: Fix missing slice handling without padding
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-24 03:22:31 +01:00
Michael Niedermayer
2e8ad2d65a avcodec/mpeg12: Remove duplicate block_last_index setting code
Based on 7c25ffe070 and 58dd885f9a

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-16 21:47:56 +01:00
Derek Buitenhuis
58dd885f9a Merge commit '7c25ffe070c286874a8c3513f7504b90e1626b0c'
* commit '7c25ffe070c286874a8c3513f7504b90e1626b0c':
  mpeg1: Make intra-block decoding independent of MpegEncContext

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-16 19:25:17 +00:00
Derek Buitenhuis
8e2105297d Merge commit '249827f736db4c94dfcb24a3883aa4c04f9b119b'
* commit '249827f736db4c94dfcb24a3883aa4c04f9b119b':
  mpeg12dec: Refactor mpeg1_decode_block_intra()

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-16 19:05:26 +00:00
Derek Buitenhuis
2ec66ff83d Merge commit 'cdbaa436042ba59c3b2bd7e9652e9a14136fd604'
* commit 'cdbaa436042ba59c3b2bd7e9652e9a14136fd604':
  mpeg12dec: Always close reader on error

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-16 19:01:05 +00:00
Vittorio Giovara
7c25ffe070 mpeg1: Make intra-block decoding independent of MpegEncContext
This allows untangling the eatqi decoder from the MPEG-1 decoder.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-02-09 20:04:59 +01:00
Diego Biurrun
249827f736 mpeg12dec: Refactor mpeg1_decode_block_intra()
Reduce variable scope, improve variable name, drop pointless ff_dlog(),
merge variable declaration and initialization, whitespace cosmetics.
2016-02-09 20:04:58 +01:00
Vittorio Giovara
cdbaa43604 mpeg12dec: Always close reader on error
A reader left open may lead to hangs.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-02-09 20:04:58 +01:00
Derek Buitenhuis
792a5cefbe mpeg12dec: Export GOP timecodes as side data
The codec context field was rightly deprecated, and the data
may change per-frame.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-01 18:19:24 +00:00