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

36646 Commits

Author SHA1 Message Date
Paul B Mahol
d56c7830c0 avcodec/raw: add gray10 support in nut
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-11-29 11:23:20 +01:00
Daniel Verkamp
e856ac2373 avcodec/msrledec: implement vertical offset in 4-bit RLE
The delta escape (2) is supposed to work the same in 4-bit RLE as in
8-bit RLE.  This is documented in the MSDN Bitmap Compression page:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd183383(v=vs.85).aspx

The unchecked modification of line is safe, since the loop condition
(line >= 0) will check it before any pixel data is written.

Fixes ticket #5153 (output now matches ImageMagick for the provided sample).

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
2016-11-29 10:57:49 +01:00
Alex Converse
8899057d91 libvpxenc: Report encoded VP9 level
Report the actual level of the encoded output if a level is
targeted or the level is passively tracked with a target of 0.
2016-11-28 12:02:43 -08:00
Andreas Cadhalpun
801b5c18c7 pngdec: check if previous frame exists instead of trusting sequence_number
This fixes a segmentation fault caused by calling memcpy with NULL as
second argument in handle_p_frame_apng.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-27 23:46:30 +01:00
Michael Niedermayer
d9883ded34 avcodec/me_cmp: Fix median_sad size
Fixes out of array read
Fixes: COV1396255

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-27 14:34:57 +01:00
Hendrik Leppkes
99ee8ee093 dxva2_vc1: support multiple slices 2016-11-26 13:11:36 +01:00
Hendrik Leppkes
36e27c87e7 vc1dec: support multiple slices in frame coded images with hwaccel
Based on a patch by Jun Zhao <mypopydev@gmail.com>
2016-11-26 13:11:32 +01:00
James Almer
6e1902bab4 avcodec/aac_adtstoasc_bsf: validate and forward extradata if the stream is already ASC
Fixes ticket #5973

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-25 18:24:56 -03:00
Andreas Cadhalpun
2566ad98b0 mss2: only use error correction for matching block counts
This fixes a heap-buffer-overflow in ff_er_frame_end when decoding mss2
with coded_width/coded_height larger than width/height.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-25 21:05:03 +01:00
Philip Langdale
829db8effd avcodec/nvenc: Remove aspect-ratio decompensation logic
This dubious behaviour in nvenc was finally removed by nvidia, and
as we refuse to run on anything older than 7.0, we don't need to
keep it around for old versions.
2016-11-25 10:13:58 -08:00
James Almer
50b1453915 avcodec/mpeg4audio: correctly propagate meaningful error values
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-25 10:40:59 -03:00
Martin Vignali
5099c541bb libavcodec/exr: add support for uint32 channel decoding with pxr24
Doesn't decode the uint32 layer, but decodes the half part of the file.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-25 00:57:38 +01:00
Andreas Cadhalpun
8c8f543b81 libopusdec: default to stereo for invalid number of channels
This fixes an out-of-bounds read if avc->channels is 0.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-25 00:36:36 +01:00
Andreas Cadhalpun
995512328e pgssubdec: only set w/h/linesize when allocating data
Rects with positive w/h/linesize but no data are invalid.

Reviewed-by: Petri Hintukainen <phintuka@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-24 01:48:43 +01:00
Jun Zhao
584eea5bf3 lavc/vaapi_hevc: fix scaling list duplicate transfer issue.
scaling list is already transfered to raster scan during head parsing,
so no need to transfer it again.

And after this fix, FATE test SLIST_A_Sony_4/SLIST_B_Sony_8/
SLIST_C_Sony_3/SLIST_D_Sony_9 will pass in i965/Skylake.

Signed-off-by: Wang, Yi A <yi.a.wamg@intel.com>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2016-11-23 21:38:10 +00:00
Philip Langdale
dd10e7253a avcodec/cuvid: Restore initialization of pixel format in init()
I moved this into the handle_video_sequence callback because that's
the earliest time you can make an accurate decision as to what the
format should be.

However, transcoding requires that the decision between using
the accelerated PIX_FMT_CUDA vs a normal pix format happen at init()
time. There is enough information available to make that decision
and things work out with the underlying format only being discovered
in the sequence callback.
2016-11-23 13:23:34 -08:00
Michael Niedermayer
69f7dd3524 avcodec/options_table: make channel_layouts uint64
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-23 02:01:05 +01:00
Andreas Cadhalpun
946ecd19ea smacker: limit recursion depth of smacker_decode_bigtree
This fixes segmentation faults due to stack-overflow caused by too deep
recursion.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-23 00:57:10 +01:00
Alex Converse
3ee59939a1 libvpxenc: Support targeting a VP9 level
Levels are specified at https://www.webmproject.org/vp9/levels/
2016-11-22 11:31:48 -08:00
Philip Langdale
81147b5596 avcodec/cuvid: Add support for P010/P016 as an output surface format
The nvidia 375.xx driver introduces support for P016 output surfaces,
for 10bit and 12bit HEVC content (it's also the first driver to support
hardware decoding of 12bit content).

The cuvid api, as far as I can tell, only declares one output format
that they appear to refer to as P016 in the driver strings. Of course,
10bit content in P016 is identical to P010, and it is useful for
compatibility purposes to declare the format to be P010 to work with
other components that only know how to consume P010 (and to avoid
triggering swscale conversions that are lossy when they shouldn't be).

For simplicity, this change does not maintain the previous ability
to output dithered NV12 for 10/12 bit input video - the user will need
to update their driver to decode such videos.
2016-11-22 10:09:30 -08:00
Timo Rothenpieler
5ea8f70623 avcodec/libx264: fix forced_idr logic
Currently, it forces IDR frames for both true and false.
Not entirely sure what the original idea behind the tri-state bool
option is.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-11-22 16:35:08 +01:00
Miroslav Slugen
10db40f374 avcodec/cuvid: allow setting number of used surfaces
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2016-11-22 10:34:27 +01:00
Miroslav Slugeň
de2faec2fa avcodec/nvenc: better surface allocation alghoritm, fix rc_lookahead
User selectable surfaces are not working correctly, if you set number of
surfaces on cmdline, it will always use minimum 32 or 48 depends on
selected resolution, but in nvenc it is not necessary to use so many
surfaces.

So from now you can define as low as 1 surface and nvenc will still
work, it will ofcourse lower GPU memory usage by 95% and async_delay to zero

That was the easy part, now littlebit more...

Next part of this patch is to always prefer rc_lookahead to be more
important for number of surfaces, than user defined surfaces value.
Maximum rc_lookahead from nvidia documentation is 32, but could increase
in future generations so there is no limit for this yet. Value
async_depth is still accepted and prefered over rc_lookahead.

There were also bug when you request more than rc_lookahead > 31, it
will always set maximum 31, because surface numbers recalculation was
after setting lookahead, which is now fixed.

Results:
If you set -rc_lookahead 32 and -bf 3 it will now use only 40 surfaces
and lower GPU memory usage by 20%, also it will now increase PSNR by 0.012dB

Two more comments:

1. from my internal test, i don't understand addition of 4 more surfaces
when lookahead is calculated, i didn't used this and everything works as
with those 4 more extra surfaces, does anybody know what is going on
there? I looks like it was used for B frames which are calculated
separately, because B frames maximum is 4.

2. rc_lookahead is defined default to -1, but in test condition if
(ctx->rc_lookahead) which sets lookahead it will be always true, i don't
know if this is intended behavior, so in default behavior is lookahead
always on!

This is default condition when rc_lokkahead is -1 (not defined on
cmdline), whis is maybe something that is not intended:
ctx->encode_config.rcParams.enableLookahead = 1;
ctx->encode_config.rcParams.lookaheadDepth  = 0;
ctx->encode_config.rcParams.disableIadapt   = 0;
ctx->encode_config.rcParams.disableBadapt   = 0;

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2016-11-22 10:34:27 +01:00
Miroslav Slugeň
c4aca65a42 avcodec/nvenc: maximum usable surfaces are limited to maximum registered frames
Maximum usable surfaces is limited to MAX_REGISTERED_FRAMES constant in
nvenc.h

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2016-11-22 10:34:27 +01:00
Timo Rothenpieler
a66835bcb1 avcodec/nvenc: use dynamically loaded CUDA 2016-11-22 10:34:27 +01:00
Timo Rothenpieler
d9ad18f3b4 avcodec/cuvid: use dynamically loaded CUDA/CUVID
And remove the now obsolete compat headers.
2016-11-22 10:34:27 +01:00
Mark Thompson
f242e0a0ff vaapi_encode: Fix format specifier for bitrate logging
Same as e0df56f25d.  This was accidentally
reintroduced while merging c8241e730f.
2016-11-21 22:59:58 +00:00
Jun Zhao
e72662e131 lavc/vaapi_encode_h264: fix poc incorrect issue after meeting idr frame.
when meeting IDR frame, vaapi_encode_h264 poc number don't reset, now fix
this issue based on h264 spec. Some decoder don't care this case, but this
fix will enhance the encoder action. Before this fix, poc number is
negative in some case.

Reviewed-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2016-11-21 22:37:02 +00:00
Mark Thompson
30ebabca7c vaapi_h265: Fix buffering parameters
A decoder may need this to be set correctly to output frames in the
right order.

(cherry picked from commit b8cac1e830)
2016-11-21 22:13:41 +00:00
Mark Thompson
ae0230cc3e vaapi_h265: Fix slice header writing
This was not observed earlier because the only syntax element which
it normally misses with the current setup is slice_qp_delta, but that
is always going to be zero (in IDR frames QP isn't varied on the
slice) which will always exp-golomb code as a single 1 bit.  The
immediately following part is the byte alignment, which is always a 1
bit followed by 0s which are ignored, so as long as the bitstream is
never aligned at that point we will never notice because the only
difference is that an ignored bit is a 1 instead of a 0.

(cherry picked from commit fc30a90898)
2016-11-21 22:13:41 +00:00
Mark Thompson
6796e6ea84 vaapi_h264: Write bitstream restriction fields
(cherry picked from commit ec17ab381e)
2016-11-21 22:13:41 +00:00
Mark Thompson
658c5afaa0 vaapi_h264: Fix CFR mode with frame_rate set in AVCodecContext
(cherry picked from commit 17a0f9481c)
2016-11-21 22:13:41 +00:00
Mark Thompson
ded1859df1 vaapi_encode: Decide on GOP setup before initialising sequence parameters
This was always too late; several fields related to it have been incorrectly
zero since the encoder was added.

(cherry picked from commit 314b421dd8)
2016-11-21 22:13:41 +00:00
Mark Thompson
ee1d04f970 vaapi_h264: Set max_num_ref_frames to 1 when not using B frames
(cherry picked from commit 956a54129d)
2016-11-21 22:13:41 +00:00
Mark Thompson
94f446c628 vaapi_encode: Sync to input surface rather than output
While outwardly bizarre, this change makes the behaviour consistent
with other VAAPI encoders which sync to the encode /input/ picture in
order to wait for /output/ from the encoder.  It is not harmful on
i965 (because synchronisation already happens in vaRenderPicture(),
so it has no effect there), and it allows the encoder to work on
mesa/gallium which assumes this behaviour.

(cherry picked from commit 086e4b58b5)
2016-11-21 22:13:41 +00:00
Mark Thompson
478a4b7e6d vaapi_encode: Check packed header capabilities
This improves behaviour with drivers which do not support packed
headers, such as AMD VCE on mesa/gallium.

(cherry picked from commit 892bbbcdc1)
2016-11-21 22:13:41 +00:00
Mark Thompson
c8241e730f vaapi_encode: Refactor initialisation
This allows better checking of capabilities and will make it easier
to add more functionality later.

It also commonises some duplicated code around rate control setup
and adds more comments explaining the internals.

(cherry picked from commit 80a5d05108)
2016-11-21 22:13:41 +00:00
Mark Thompson
06d73d002e vaapi_h264: Fix HRD bit_rate/cpb_size scaling
There should be an extra offset of 6 on bit_rate_scale and of 4 on
cpb_size_scale which were not accounted for here.

(cherry picked from commit 3a9662af6c)
2016-11-21 22:13:41 +00:00
Carl Eugen Hoyos
322568c079 lavc/ffv1: Support YUV4xxP12 and GRAY12. 2016-11-20 22:23:01 +01:00
James Almer
574929d8b6 avcodec/avpacket: fix leak on realloc in av_packet_add_side_data()
If realloc fails, the pointer is overwritten and the previously allocated
buffer is leaked, which goes against the expected behavior of keeping the
packet unchanged in case of error.

Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-19 20:23:25 -03:00
Andreas Cadhalpun
7289aa2d71 options_table: limit codec parameters to sane values
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-18 22:40:42 +01:00
James Almer
2de1c79b61 x86/vp9itxfm: add missing AVX2 guards
Fixes compilation with Yasm 1.1.0 and older.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 17:01:11 -03:00
Michael Niedermayer
d1d18de6ad avcodec/ffv1dec: Set packed_at_lsb for 16bit YUV
This avoids unneeded computations

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-18 18:04:28 +01:00
Michael Niedermayer
d7a3bb2088 avcodec/ffv1dec: Support gray 10/12/16 explicitly avoid shifts
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-18 18:04:28 +01:00
James Almer
16c429166d Revert "apngdec: use side data to pass extradata to the decoder"
This reverts commit e0c6b32046.

Said commit changed the behavior of the demuxer and decoder in a non
backwards compatible way.
Demuxers should make extradata available at init if possible, and send
new extradata as side data within a packet if needed.

A better fix for the remuxing crash will follow.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 12:24:28 -03:00
Hendrik Leppkes
07502e473f Merge commit '7a76371437f9562c3414f985523f883489e3936a'
* commit '7a76371437f9562c3414f985523f883489e3936a':
  libopenh264enc: Simplify init by setting FF_CODEC_CAP_INIT_CLEANUP

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-18 10:47:08 +01:00
Hendrik Leppkes
7e9474ca47 Merge commit '2d097c16b833c532ac974a7f1fd05c0a1f3b7675'
* commit '2d097c16b833c532ac974a7f1fd05c0a1f3b7675':
  libopenh264enc: Return a more sensible error code in some init failure paths

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-18 10:46:02 +01:00
Hendrik Leppkes
0bd76401d1 Merge commit '36b380dcd52ef47d7ba0559ed51192c88d82a9bd'
* commit '36b380dcd52ef47d7ba0559ed51192c88d82a9bd':
  libopenh264dec: Simplify the init thanks to FF_CODEC_CAP_INIT_CLEANUP being set

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-18 10:45:08 +01:00
Michael Niedermayer
ae514b1254 avcodec/ass_split: Change order of operations in ass_split_section()
This matches the other branch
Fixes out of array read
Fixes: 4d142ca76d39fe685effcf5017098723/asan_heap-oob_31ae824_8611_348fdb64f9009b63c8a8eae9a0e497c5.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-17 18:05:18 +01:00
Hendrik Leppkes
2f1a539d4b Merge commit '61bd0ed781b56eea1e8e851aab34a2ee3b59fbac'
* commit '61bd0ed781b56eea1e8e851aab34a2ee3b59fbac':
  h264: Log more information about invalid NALu size

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-17 15:24:25 +01:00