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

42076 Commits

Author SHA1 Message Date
Andreas Rheinhardt
54e1efda6d avcodec/g723_1dec: Fix invalid shift
Fixes the FATE-tests g723_1-dec-1, g723_1-dec-2 and g723_1-dec-4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-20 23:26:34 +02:00
Andreas Rheinhardt
86bef10e7a avcodec/tdsc: Fix undefined shifts
Fixes the tdsc FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-20 23:26:34 +02:00
elliottk
ea673a0edb Delete unused branch in libaomenc
this branch is leftover from libvpxenc+vp8

Signed-off-by: James Zern <jzern@google.com>
2019-09-19 23:56:03 -07:00
Guo, Yejun
ecd026a48d avcodec/libvpxenc: add ROI-based encoding support for VP8/VP9
example command line to verify it:
./ffmpeg -i input.stream -vf addroi=0:0:iw/3:ih/3:-0.8 -c:v libvpx -b:v 2M tmp.webm

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: James Zern <jzern@google.com>
2019-09-19 23:49:28 -07:00
Carl Eugen Hoyos
f9f9d5943f lavc/cook: Remove an incorrect comment.
Multichannel cook was implemented in 67da3182.
2019-09-20 01:36:13 +02:00
Anthony Delannoy
81bb71761a avcodec: add EPG codec ID
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-09-19 21:30:54 +02:00
Limin Wang
c2ab998ff3 avcodec/v210enc: move v210_enc_8/10 function to template file
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-18 22:53:00 +02:00
Limin Wang
5c0f80d26d avcodec/v210enc: make 8bit and 10bit process consistent
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-18 22:53:00 +02:00
Limin Wang
216dd9fd5c avcodec/v210enc: add depth parameter for WRITE_PIXELS and CLIP
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-18 22:53:00 +02:00
Andreas Rheinhardt
e12a2a2d73 avcodec/avpacket: Improve allocating packets
av_mallocz + av_init_packet leads to the same result as av_mallocz +
av_packet_unref, but faster.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-18 22:53:00 +02:00
Andreas Rheinhardt
9442b0de1b avcodec/mjpegdec: Unify switch statements
This has been forgotten in d5a3a20d.

Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-18 22:53:00 +02:00
Michael Niedermayer
ef50cf7b32 avcodec/hevcdec: Fix memleak of a53_caption
Fixes: 15295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5675655187922944

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-16 22:51:26 +02:00
Andreas Rheinhardt
3ab488a540 avcodec/ttaenc: Fix undefined shift
ttaenc contained (1 << unary) - 1 as an argument for a function
expecting an unsigned int. unary can be as big as 31 in this case.
The type of the shift and the whole expression is int, because 1 fits
into an integer, so that the behaviour is undefined if unary == 31
as the result of the shift can't be represented in an int §. Subtraction
by 1 (which makes the result of the whole expression representable in
an int) doesn't change that this is undefined (it usually leads to
signed integer overflow which is undefined, too).

The solution is simple: Make 1 unsigned to change the type of the
whole expression to unsigned int (as the function expects anyway).

Fixes ticket #8153.

§: This of course presupposes the common int range of -2^31..2^31-1

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-16 21:30:19 +02:00
Carl Eugen Hoyos
551fcbbccb lavc/g729dec: Support decoding Sipro ACELP.KELVIN.
Fixes ticket #4799.
Analyzed-by: Aleksandr Ustinov
2019-09-16 20:57:53 +02:00
James Almer
dc0806dd25 avcodec/allcodecs: make libdav1d the preferred AV1 decoder
It's considerably faster than libaom in most systems.

Reviewed-by: BBB
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-16 15:26:46 -03:00
Rick Kern
1db6e47e85 avcodec/videotoolboxenc: warn user when output will use a different profile/level than requested.
Signed-off-by: Rick Kern <kernrj@gmail.com>
2019-09-16 09:02:59 -04:00
Limin Wang
57951f3019 avcodec/videotoolboxenc: add H264 Extended profile and level
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2019-09-16 09:00:39 -04:00
sharpbai
6966548c1b avcodec/videotoolboxenc: fix encoding frame crash on iOS 11
On iOS 11, encoding a frame may return error with log
"Error encoding frame 0", which means vtenc_output_callback
is called with status=0 and sample_buffer=NULL. Then the
encoding session will be crashed on next callback wether or not
closing the codec context.

Let us look through the link below introducing VTCompressionOutputCallback,

https://developer.apple.com/documentation/videotoolbox/vtcompressionoutputcallback?language=objc

"status=0" (noErr) means compression was successful.
"sampleBuffer=NULL" means the frame was dropped when compression
was successful (status=0) or compression was not successful (status!=0).

So we should not set AVERROR_EXTERNAL on "status=0" and "sample_buffer=NULL"
as it is not a error.

The fix is that we only set AVERROR_EXTERNAL with status value non zero.
When sample_buffer is NULL and status value is zero, we simply return
with no other operation.

This crash often occurs on iOS 11 for example encoding 720p@25fps.

Signed-off-by: sharpbai <sharpbai@gmail.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2019-09-16 08:58:10 -04:00
Michael Niedermayer
9fac243744 avcodec/cfhd: Check that cropped size is smaller than full
Fixes: signed integer overflow: 57342 * 120830 cannot be represented in type 'int'
Fixes: 16426/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5758744817827840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
2019-09-16 00:53:18 +02:00
Michael Niedermayer
d2d8e797cc avcodec/hevcdec: repeat character in skiped
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-16 00:04:18 +02:00
Michael Niedermayer
fccc37ca85 repeat an even number of characters in occured
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-16 00:04:18 +02:00
Michael Niedermayer
a9fae76370 avcodec/gdv: Replace assert() checking bitstream by if()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-16 00:04:18 +02:00
Michael Niedermayer
61b055bed0 libavcodec/utils: Free threads on init failure
Fixes: Multiple memleaks
Fixes: ffmpeg-memory-leak

Found-by: Francis Provencher <francis@protekresearchlab.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-16 00:04:18 +02:00
gxw
92fc0bfa54 avutil/mips: refactor msa SLDI_Bn_0 and SLDI_Bn macros.
Changing details as following:
1. The previous order of parameters are irregular and difficult to
   understand. Adjust the order of the parameters according to the
   rule: (RTYPE, input registers, input mask/input index/..., output registers).
   Most of the existing msa macros follow the rule.
2. Remove the redundant macro SLDI_Bn_0 and use SLDI_Bn instead.

Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-16 00:04:18 +02:00
Rodger Combs
77937a42e7 lavc/videotoolboxdec: fix crop handling when multithreaded
This was partially fixed by 233cd89, but it made changes to AVFrame fields
from within end_frame, which doesn't work consistently when multithreading
is enabled. This is what the post_process function is for.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-15 11:13:29 -07:00
Aman Gupta
81abf90aea avcodec/v4l2: fix compile with older videodev2.h
Some of these symbols are only defined in newer kernel releases.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-15 11:10:09 -07:00
James Almer
6c0167f6f6 avcodec/libdav1d: use the library default for the filmgrain option
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-15 11:09:39 -03:00
Michael Niedermayer
3b5ce76b1a avcodec/mjpegdec: Restore non bayer checks in ljpeg_decode_rgb_scan()
Fixes: out of array write
Fixes: 17088/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-5654877765632000

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>
2019-09-13 21:53:27 +02:00
Michael Niedermayer
2006e5ccb6 avcodec/mjpegdec: Only allow 0x11110000 pix_fmt_id for bayer mode
Fixes: NULL pointer dereference
Fixes: assertion failure
Fixes: 17003/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5696929253556224
Fixes: 17039/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5651008134316032

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>
2019-09-13 21:53:27 +02:00
James Almer
1faedb9a11 x85/opusdsp: enable the functions on all FMA3 CPUs
It's not using ymm registers, so limiting it to CPUs with fast AVX
is not necessary.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-11 20:50:45 -03:00
James Almer
80444e23ac x86/opusdps: clear the high bits from some gprs
Fixes checkasm on systems like win64.

Reviewed-by: Lynne
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-11 20:42:31 -03:00
Michael Niedermayer
b94cf549e2 avcodec/htmlsubtitles: Avoid locale dependant isdigit()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:43:14 +02:00
Michael Niedermayer
39ff027fd8 avcodec/mpeg12enc: Add FF_CODEC_CAP_INIT_CLEANUP
Fixes: Multiple memleaks
Fixes: ffmpeg-memory-leak

Found-by: Francis Provencher <francis@protekresearchlab.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:43:14 +02:00
Michael Niedermayer
e125578994 avcodec/alsdec: Check k from being outside what our implementation can handle
The specification does not seem to list what the maximum valid
value is

Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 16268/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5638164544225280

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-11 22:43:14 +02:00
Michael Niedermayer
f119273649 avcodec/takdec: Fix integer overflow in decorrelate()
Fixes: signed integer overflow: -2424832 - 2145653689 cannot be represented in type 'int'
Fixes: 16138/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5643451346976768

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-11 22:43:14 +02:00
Michael Niedermayer
ec749ed222 avcodec/aacps: Fix integer overflows in hybrid_synthesis()
Fixes: signed integer overflow: -822667928 + -1399761199 cannot be represented in type 'int'
Fixes: 15756/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5645182051024896

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-11 22:43:14 +02:00
Michael Niedermayer
0e4a0e962c avcodec/mpeg4videodec: Fix integer overflow in mpeg4_decode_studio_block()
Fixes: signed integer overflow: 24023040 * 112 cannot be represented in type 'int'
Fixes: 16570/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5173275211071488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:42:19 +02:00
Michael Niedermayer
b6b9ac5698 avcodec/vp56rac: delay signaling an error on truncated input
A threshold of 1 is sufficient for simple_dump_cut.webm, 10 is used
just to be sure the next truncated file doesnt cause the same issue

Obvious alternative fixes are to simply accept that the file is broken or to
write some advanced error concealment or to
simply accept that the decoder wont stop at the end of input.

Fixes: Ticket 8069 (artifacts not the differing md5 which was there before 1afd246960)
Fixes: simple_dump_cut.webm
Fixes: regression of 1afd246960

fate-vp5 changes because the last frame is truncated and now handled
differently.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:36:33 +02:00
Maxime Jourdan
b81a1c5bea avcodec/v4l2_context: set frame SAR using VIDIOC_CROPCAP
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 13:07:42 -07:00
Aman Gupta
0085c4d478 avcodec/v4l2_buffers: use correct timebase for encoder/decoder
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 13:07:42 -07:00
Aman Gupta
80c9237b2f avcodec/v4l2_m2m_dec: fix compile
internal.h header required for FF_CODEC_CAP_SETS_PKT_DTS

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 11:29:48 -07:00
Maxime Jourdan
584ac1ad0b avcodec/v4l2_m2m_dec: fix dropped packets while decoding
* FFmpeg retrieves a packet from the bitstream
* It attempts to get an input buffer (from its own list or by dequeuing one from the driver)
* If no input buffer is found, the bitstream packet is dropped instead of scheduled for trying again later

It's an issue that showed especially at high speeds (like using `-f null -` as output parameters).

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:31:21 -07:00
Aman Gupta
fac834b2ae avcodec/v4l2_context: expose timeout for dequeue_frame
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:31:18 -07:00
Aman Gupta
3475758a37 avcodec/v4l2_m2m_dec: set pkt_dts on decoded frames to NOPTS
Without this ffmpeg will attempt to copy the dts from the
most recently enqueued packet into the most recently dequeued
frame, which does not account for the buffering inside v4l2
and is not accurate.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:28:56 -07:00
Aman Gupta
8dc973dc89 avcodec/v4l2_buffers: read height/width from the proper context
Frames are generally dequeued into capture buffers, so using
the output properties here was incorrect. It happened to work
fine for decoding, since the output/capture buffers have the same
dimensions.

For the v4l2 scaler, the dimensions can be different between output
and capture. Using the buffer's associated context makes this code
work correctly regardless of where the frame is coming from.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-11 10:28:56 -07:00
Andriy Gelman
78b86c30d3 avcodec/h2645_parse: simplify memset call
Removed (new_size - pkt->nals_allocated) because this value is always 1
during the call.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-11 10:23:26 -03:00
Lynne
6b22e28f4c opusdsp: adjust and optimize C function to match assembly
The C and asm versions behaved differently _outside_ of the codec.

The C version returned pre-multiplied 'state' for the next execution
to use right away, while the assembly version outputted non-multiplied
'state' for the next execution to multiply to save instructions.
Since the initial state when initialized or seeking is always 0,
and since C and asm versions were never mixed, there was no issue.

However, comparing outputs directly in checkasm doesn't work without
dividing the initial state by CELT_EMPH_COEFF and multiplying the
returned state by CELT_EMPH_COEFF for the assembly function.

Since its actually faster to do this in C as well, copy the behavior the
asm versions use. As a reminder, the initial state 0 is divided by
CELT_EMPH_COEFF on seek and init (just in case in the future this is
changed, its technically more correct to init with CELT_EMPH_COEFF than 0,
however when seeking this will result in more audiable pops, unlike with 0
where the output gets in sync over a few samples).
2019-09-11 03:28:22 +01:00
Lukas Rusak
40a433e34b avcodec/v4l2_buffers: split out v4l2_buf_increase_ref helper
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:12:47 -07:00
Aman Gupta
d620b1f9de avcodec/v4l2_buffers: split out V4L2Buffer generation into helper method
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:12:47 -07:00
Aman Gupta
2b21bb4a87 avcodec/v4l2_buffers: split out AVFrame generation into helper method
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-10 19:12:47 -07:00