Commit Graph

83451 Commits

Author SHA1 Message Date
Mark Thompson ceb28c3cc4 vaapi_encode: Support VBR mode
This includes a backward-compatibility hack to choose CBR anyway on
old drivers which have no CBR support, so that existing programs will
continue to work their options now map to VBR.

(cherry picked from commit f033ba470f)
2017-02-08 19:14:05 +00:00
Mark Thompson 3b95c7c17d vaapi_encode: Add MPEG-2 support
(cherry picked from commit ca6ae3b77a)
2017-02-08 19:14:05 +00:00
Mark Thompson eefa4b76ee vaapi_h264: Scale log2_max_pic_order_cnt_lsb with max_b_frames
Before this change, it was possible to overflow pic_order_cnt_lsb and
generate a stream with invalid POC numbering.  This makes sure that
the field is large enough that a single IDR B* P sequence uses fewer
than half the available POC lsb values.

(cherry picked from commit 89725a8512)
2017-02-08 19:14:05 +00:00
Mark Thompson c667c0979c vaapi_encode: Support forcing IDR frames via AVFrame.pict_type
(cherry picked from commit a3c3a5eac2)
2017-02-08 19:14:04 +00:00
Mark Thompson 760f1a7727 vaapi_encode: Fix GOP sizing
This change makes the configured GOP size be respected exactly -
previously the value could be exceeded slightly due to flaws in the
frame type selection logic.

(cherry picked from commit 37fab0661a)
2017-02-08 19:14:04 +00:00
Mark Thompson 37de9ce713 vaapi_h265: Fix CFR mode with framerate set in AVCodecContext
Same issue as 17a0f9481c.

(cherry picked from commit 7d81698b89)
2017-02-08 19:14:04 +00:00
Mark Thompson b9514756ba vaapi_h265: Add main 10 encode support
(cherry picked from commit 5a5df90d9c)
(cherry picked from commit d08e02d929)
2017-02-08 19:14:04 +00:00
Michael Niedermayer c03029a835 avcodec/h264_slice: Clear ref_counts on redundant slices
Fixes reading freed memory
Fixes: 568/clusterfuzz-testcase-6107186067406848

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-08 18:31:04 +01:00
Ricardo Constantino dac51d2bbd doc/encoders: fix broken build with 884506dfe2 2017-02-08 15:55:40 +00:00
Jerry Jiang 884506dfe2 Implement optimal huffman encoding for (M)JPEG.
> seems to break
> make fate-vsynth1-mjpeg-444

Fixed.
2017-02-08 13:59:53 +00:00
Matt Wolenetz 2d453188c2 lavf/mov.c: Avoid heap allocation wrap in mov_read_uuid
Core of patch is from paul@paulmehta.com
Reference https://crbug.com/643951

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Check value reduced as the code does not support values beyond INT_MAX
Also the check is moved to a more common place and before integer truncation
2017-02-08 03:57:10 +01:00
Matt Wolenetz fd30e4d57f lavf/mov.c: Avoid heap allocation wrap in mov_read_hdlr
Core of patch is from paul@paulmehta.com
Reference https://crbug.com/643950

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Check value reduced as the code does not support larger lengths
2017-02-08 03:31:01 +01:00
Rl 1835ed19bb libavcodec/cinepak.c: fix a wrong (inverted) misleading comment
Make the comment message understandable and correct.
2017-02-07 23:31:25 +01:00
Derek Buitenhuis 91ed4e7196 avcodec: Mark some codecs with threadsafe init as such
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-07 23:31:25 +01:00
Maksym Veremeyenko 8efb7f5a26 avfilter/vf_scale: Fix chroma positioning for 4:2:0 pixel format
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-07 21:32:26 +01:00
Michael Niedermayer 8c2ea3030a avcodec/pictordec: Fix logic error
Fixes: 559/clusterfuzz-testcase-6424225917173760

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-07 21:32:08 +01:00
Petri Hintukainen dface53497 matroska: demux BluRay text subtitles
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-07 21:32:08 +01:00
Paul B Mahol e87a4a85c1 doc/filters: extend midequalizer description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-07 10:09:18 +01:00
Aman Gupta 606eac7b07 avformat/hlsenc: add hls_flag option to write segments to temporary file until complete
Adds a `-hls_flags +temp_file` which will write segment data to
filename.tmp, and then rename to filename when the segment is complete.

This patch is similar in spirit to one used in Plex's ffmpeg fork, and
allows a transcoding webserver to ensure incomplete segment files are
never served up accidentally.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Bodecs Bela <bodecsb@vivanet.hu>
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-02-07 11:58:43 +08:00
Hendrik Leppkes a6cee50fa2 configure: use dashes instead of slashes in lib.exe invocation
This avoids issues with wrong parameter translation by msys on some systems,
and the Windows SDK tools accept both forms equally.
2017-02-06 19:47:20 +01:00
Michael Niedermayer e248522d1b avcodec/movtextdec: Fix decode_styl() cleanup
Fixes: null pointer dereference
Fixes: 555/clusterfuzz-testcase-5986646595993600

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-06 11:19:05 +01:00
Michael Niedermayer 4fcdc9f359 avfilter/vf_midequalizer: Remove duplicate include
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-06 10:45:01 +01:00
Chris Cunningham ac25840ee3 lavf/matroskadec: fix is_keyframe for early Blocks
Blocks are marked as key frames whenever the "reference" field is
zero. This breaks for non-keyframe Blocks with a reference timestamp
of zero.

The likelihood of reference timestamp being zero is increased by a
longstanding bug in muxing that encodes reference timestamp as the
absolute time of the referenced frame (rather than relative to the
current Block timestamp, as described in MKV spec).

Now using INT64_MIN to denote "no reference".

Reported to chromium at http://crbug.com/497889 (contains sample)
2017-02-06 09:33:28 +01:00
Michael Niedermayer dfc6e30cd4 ffmpeg: Remove redundant null check
Fixes CID1396245

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-06 01:01:33 +01:00
Michael Niedermayer 1e5cfad57e avcodec/pthread_frame: Check av_packet_ref() for failure
Fixes CID1396242
2017-02-06 01:01:33 +01:00
Marton Balint e57fd926b0 avfilter/af_pan: fix null pointer dereference on empty token
Fixes Coverity CID 1396254.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-05 22:49:04 +01:00
Mark Thompson 326b1ed93e vf_scale_vaapi: Add missing return value checks
Fixes CID 1374119.
2017-02-05 15:13:16 +00:00
Mark Thompson 55a7e7e398 ffmpeg_vaapi: Always set hwaccel_ctx, so it gets properly cleaned up on error
Fixes CID 1398954.
2017-02-05 15:13:15 +00:00
Mark Thompson 3420b34a8a Revert "avutil/hwcontext_vaapi: fix SEGV in vaTerminate when vaInitialize fails"
The original code is correctly following the API - vaTerminate() must
be called to free the resources of a VADisplay after it is created by
any of the vaGetDisplay*() calls; it is not necessary to have
successfully called vaInitialize() on it.  The segfaults which
prompted this change must therefore be bugs in libva or the driver it
loads.

This reverts commit 3606602f11.
2017-02-05 15:13:15 +00:00
Mark Thompson df3b17eba4 ffmpeg_vaapi: Unreference global device before setting it
This currently leaks if multiple device options are specified on the
command line.
2017-02-05 15:13:15 +00:00
Marton Balint fd57f70c97 avfilter/ebur128: fix relative threshold calculation for multiple contexts
This reworks the code a bit and also disallows NULL contexts.

Fixes Coverity CID 1396273, 1396279.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-04 23:54:18 +01:00
Marton Balint a91cedf79a avfilter/ebur128: do not allow null ebur128 context in ff_ebur128_relative_threshold
The user should supply a proper context.

Fixes Coverity CID 1396246.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-04 23:54:17 +01:00
Marton Balint 1687fa2131 doc/muxers: remove confusing example for segment muxer option clocktime_wrap_duration
Detecting a leap second depends on a lot of things, segment time, segment
offset, system leap second implementation, the removed part is a huge
simplification which can be misleading, so it is best to remove it.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-04 23:36:46 +01:00
Marton Balint 85169a75e1 avformat/segment: remove last_cut check when detecting a new segment
Not starting a new segment if the elapsed microsecs since the start of the day
equals the the elapsed microsecs since the start of the day at the time of the
last cut seems plain wrong to me, Deti do you remember the original reason
behind this check?

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-04 23:36:45 +01:00
Marton Balint af621b6d6e ffplay: fix borderless mode on Windows
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-04 21:33:55 +01:00
Paul B Mahol 012dd8c99a avfilter: add midequalizer filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-04 14:47:33 +01:00
Michael Niedermayer e477f09d0b avcodec/pngdec: Check trns more completely
Fixes out of array access
Fixes: 546/clusterfuzz-testcase-4809433909559296

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-04 13:22:29 +01:00
Rostislav Pehlivanov 084f3addda opus_rc: rename total_bits_used to total_bits and #define some constants
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-04 12:07:52 +00:00
Hendrik Leppkes 8b80feb9a7 configure: instruct MSVC 2015 to properly process UTF-8 string literals
Without the /UTF-8 switch, the MSVC compiler treats all files as in the
system codepage, instead of in UTF-8, which causes UTF-8 string literals
to be interpreted wrong.

This switch was only introduced in VS2015 Update 2, and any earlier
versions do not have an equivalent solution.

Fixes fate-sub-scc on MSVC 2015+
2017-02-04 11:21:35 +01:00
Hendrik Leppkes 647af1a0dd configure: add nologo switch to invocation of lib.exe
This suppresses the startup banner, which is consistent with all other calls
to the Windows SDK binaries.
2017-02-04 11:21:33 +01:00
Michael Niedermayer b1e2192007 avcodec/interplayvideo: Move parameter change check up
Fixes out of array read
Fixes: 544/clusterfuzz-testcase-5936536407244800.f8bd9b24_8ba77916_70c2c7be_3df6a2ea_96cd9f14

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-04 02:45:46 +01:00
Michael Niedermayer 831274fba4 avcodec/flacdsp: Avoid undefined operations in non debug builds
This fixes ubsan warnings in non debug builds by using unsigned operations

in debug builds the correct signed operations are retained so that overflows
(which should not occur in valid files and may indicate problems in the DSP code
or decoder) can be detected.

Alternatively they can be changed to unsigned unconditionally, then its
not possible though to detect overflows easily if someone wants to test
the DSP code for overflows.

The 2nd alternative would be to leave the code as it is and accept that
there are undefined operations in the DSP code and that ubsan output is
full of them in some cases.

Similar changes would be needed in some other DSP routines

Suggested-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-04 02:27:53 +01:00
Michael Niedermayer fd00203554 avcodec/flacdec: Check for invalid vlcs
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-04 02:26:37 +01:00
Werner Robitza 8addd56554 doc: clarify option on looping infinitely in movie filter
Clarify that setting loop=0 is required to make the stream loop infinitely, rather than saying that a value "less than 1" is needed.

Signed-off-by: Lou Logan <lou@lrcd.com>
2017-02-03 13:08:58 -09:00
Michael Niedermayer c347b28699 avfilter/vf_unsharp: Free out AVFrame on error
Fixes memleak
Fixes part of CID1197065

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-03 21:52:22 +01:00
Michael Niedermayer 19f567208c avfilter/vf_perspective: Free out AVFrame on error
Fixes memleak
Fixes part of CID1197065

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-03 21:52:22 +01:00
Michael Niedermayer 21a07ac191 avfilter/vf_fieldhint: Free out AVFrame on error
Fixes memleak
Fixes part of CID1197065

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-03 21:52:22 +01:00
Michael Niedermayer 15b2c37d5e avfilter/vf_deshake: Free out AVFrame on error
Fixes memleak
Fixes part of CID1197065

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-03 21:52:22 +01:00
Michael Niedermayer 3edbc2408b avfilter/vf_ciescope: Free out AVFrame on error
Fixes memleak
Fixes part of CID1197065

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-03 21:52:22 +01:00
Paul B Mahol c331be21c4 avcodec/ivi: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-03 20:36:23 +01:00