Commit Graph

90997 Commits

Author SHA1 Message Date
Michael Niedermayer
de841fbea7 avcodec/h263dec: Check slice_ret in mspeg4 slice loop
Fixes infinite loop
Fixes: 6858/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_MSMPEG4V3_fuzzer-4681563766784000
Fixes: 6890/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_WMV1_fuzzer-4756103142309888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-25 23:09:47 +02:00
Michael Niedermayer
7562567f41 avcodec/h2645_parse: Replace RNXYA by RNXY in ff_h2645_extract_rbsp()
Fixes misaligned accesses
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-25 23:09:47 +02:00
Michael Niedermayer
0bd0401336 avcodec/elsdec: Fix memleaks
Fixes: 6798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5135899701542912

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-25 23:09:47 +02:00
Jerome Borsboom
144ce364cd avcodec/vc1: more corrections for AC inverse quantization scaling
HALFQP should only be added to the inverse quantizer when the block is
coded with PQUANT. When PQUANT is equal to ALTPQUANT, the original test
for the addition of HALFQP fails. A negative value for mquant indicates
that the value was derived from VOPDQUANT.

Fixes #4372

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
9ae2845b1c avcodec/vc1: correct forgotten v->blocks_off
correct forgotten v->blocks_off

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
797c1536a4 avcodec/vc1: correct AC inverse quantization scaling
HALFQP should only be added to the inverse quantizer when the block is
coded with PQUANT. See 8.1.3.8 in VC-1 spec.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
a1dc0bdaf4 avcodec/vc1: correct mspel for field-interlace B frames
mspel indicates the use of bicubic interpolation. The check wrongly included
MVMODE MV_PMODE_1MV_HPEL as using bilinear interpolation.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
7a70879624 avcodec/vc1: remove unused overlap smooting and loop filter
remove unused overlap smooting and loop filter

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
cc5deeb74a avcodec/vc1: add overlap smooting and loop filter for frame/field-interlace
Add previously omitted overlap smooting and loop filtering for
frame/field-interlace pictures. For progressive pictures switch to the
re-implemented versions of overlap smooting and loop filtering.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
e60e14ef92 avcodec/vc1: re-implement vc1_put_signed_blocks_clamped
The existing implementation only used vc1_put_signed_blocks_clamped for I and
BI frames. This rewritten version is also applicable to P frame both
progressive and frame/field-interlace.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
362ce2db4b avcodec/vc1: implement interlaced out-of-bounds reference pixel replication
The existing implementation did out-of-bounds reference pixel replication for
progressive reference frames. In interlaced reference frames both the even and
odd line on the horizontal edges need to be replicated.

Fixes #3262.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
b43f1c5225 avcodec/vc1: correct ff_vc1_dqscale
According to VC-1 spec table 74, the last value in ff_vc1_dqscale should be
0x1041 instead of 0x1000.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
dd1e717f5b avcodec/vc1: correct ff_vc1_mbmode_intfrp
According to VC-1 spec 10.7.3.4, FIELDTX shall be set to the same type as the
motion vector for zero-coded blocks.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
79f8074cc4 avcodec/vc1: store color-difference reference field type
The loop filter for P interlace field pictures needs the reference field type.
For luma, the reference field type was already available. Store the reference
field type for color-difference as well.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
c5f74b1e23 avcodec/vc1: store additional bitstream elements during MB decoding
The new loop filter needs additional MB properties to make its filtering
decisions.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
ded52f6e36 avcodec/vc1: re-implement and expand VC-1 loop filtering
The existing implementation did loop filtering for progressive
frames only. This rewritten version implements loop filtering for
all applicable frame types for both progessive and
frame/field-interlace.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
20de893b3b avcodec/vc1: change to using v->block instead of s->block for P frames
The new overlap smooting filter smoothes image pixels stored in v->block.
Switch to v->block instead of s->block for storing decoded image pixels for P
frames. Additionally, we must take incrementing *_blk_idx out of the
vc1_put_signed_blocks_clamped function.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
Jerome Borsboom
5e5c9f1804 avcodec/vc1: re-implement and expand VC-1 overlap smoothing
The existing implementation did overlap smoothing for progressive
frames only. This rewritten version implements overlap smoothing
for all applicable frame types for both progessive and
frame/field-interlace.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-25 22:07:20 +02:00
James Almer
0161d91db0 avcodec/cbs_mpeg2: use memcpy when assembling fragments
before:
419022 decicycles in assemble_fragment,    2047 runs,      1 skips

after:
104621 decicycles in assemble_fragment,    2045 runs,      3 skips

Benched with a 2 minutes long 720x480 DVD mpeg2 sample.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-25 16:45:43 -03:00
James Almer
bd90a2ec04 avcodec/mpeg4_unpack_bframes: cache input packets directly
Avoids unnecessary allocs+copies and makes the code slightly simpler.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-25 16:34:00 -03:00
Aman Gupta
d8e92a89ed avcodec/mediacodecdec: refactor pts handling
Also fixes a bug where EOS buffer was sent with incorrect
pts when not using surface generation.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-04-25 10:53:54 -07:00
Aman Gupta
7a4639b1eb avcodec/mediacodecdec: use AV_TIME_BASE_Q
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-04-25 10:53:54 -07:00
Aman Gupta
6a7a84b2d1 avcodec/mediacodecdec: clarify delay_flush specific code
As of 2a0eb8685, ff_mediacodec_dec_is_flushing() only returns
true in delay_flush mode. Make this more obvious by adding
delay_flush to the if statement.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-04-25 10:53:52 -07:00
Paul B Mahol
b2570afde3 avformat/yuv4mpegdec: fix seeking backwards
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-25 18:30:46 +02:00
Paul B Mahol
a12899ad9b avfiler/vf_mix: fix crash with >8 bit depth
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-25 14:08:21 +02:00
Paul B Mahol
0b360cae1c make swresample optional for ffmpeg
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-25 12:38:03 +02:00
Michael Niedermayer
d06b01fc2d avcodec/vc1_block: simplify ac_val computation
also fixes: runtime error: index 1456 out of bounds for type 'int16_t [16]'

Found-by: durandal_1707
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-24 19:58:04 +02:00
Paul B Mahol
f09fdf2d9c avcodec/clearvideo: display warning if decoder overreads input
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-24 17:20:26 +02:00
Paul B Mahol
e34751cb8a avcodec/clearvideo: do not try to return frame when it is same as previous one
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-24 17:10:26 +02:00
Michael Niedermayer
d9706f79c1 avcodec/ffv1enc: Check that the crc + version combination is supported
The crc flag is only stored since version 3 thus before this crcs do not
work. We increase the version as needed same as we do with pix_fmts

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-24 01:29:17 +02:00
Jerome Borsboom
8132d362fa avcodec/vaapi: do not parse MVMODE for VC-1 interlaced frame pictures
Interlaced frame pictures do not contain the MVMODE or MVMODE2 bitstream
element. Trying to parse this element and passing a nonzero value to the
hardware decoder results in small inaccuracies in the decoded picture.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-23 23:11:29 +01:00
Paul B Mahol
daba369471 avcodec/vc1: check return value of bitplane_decoding()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-23 23:49:56 +02:00
Vasile Toncu
9c01cdb94e avfilter/vf_interlace: remove duplicate code with same funcionality 2018-04-23 23:48:30 +02:00
Rostislav Pehlivanov
4ac0ff8ec2 Revert "libavformat: add mbedTLS based TLS"
This reverts commit 62f5c9d68b,
which was pushed a bit prematurely.
2018-04-23 20:29:02 +01:00
Thomas Volkert
62f5c9d68b libavformat: add mbedTLS based TLS 2018-04-23 20:48:11 +02:00
Carl Eugen Hoyos
2442cf3615 lavf/os_support: Only compile inet_aton() if getaddrinfo() is needed.
Silences a warning:
libavformat/os_support.c:49:12: warning: 'inet_aton' defined but not used

Reported-by: Reino Wijnsma
2018-04-23 13:39:29 +02:00
James Almer
153e920892 avformat/vpcc: add ff_isom_get_vpcc_features()
Should be useful for muxers that require values as defined in the
vpcc atom but don't need to write the atom itself.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-22 16:24:48 -03:00
Martin Vignali
07a566e7d6 swscale/swscale_unscaled : add X86_64 (SSE2 and AVX) for uyvyto422
and checkasm test
2018-04-22 19:15:32 +02:00
Martin Vignali
e6e4625862 avcodec/prores_ks : use official quant_matrix (for proxy and xq codec luma and chroma quant matrix is not the same)
disable the use of the official luma xq matrix for now (output
appear to be desaturate)
2018-04-22 18:49:44 +02:00
Paul B Mahol
00099ef0d0 avformat/dsfdec: fix calculation of size of data chunk
Ignore extra 12 bytes that belong to tag and size.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-22 13:14:26 +02:00
Paul B Mahol
5d3efe9e1f avformat/dsfdec: properly handle padded last packet
Fixes #5489.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-22 12:00:43 +02:00
Jun Zhao
f97fa89925 doc/examples/filtering_audio: Remove setting deprecated refcounted_frames
When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-22 15:39:22 +08:00
Jun Zhao
0c28a5cf0f doc/examples/filtering_video: Remove setting deprecated refcounted_frames
When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-22 15:38:40 +08:00
Jun Zhao
c6d8492cff doc/examples/hw_decode: Remove setting deprecated refcounted_frames
When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-04-22 15:37:25 +08:00
Gyan Doshi
9f9f56e679 avformat/segafilm - revert keyframe detection
Keyframe detection was inverted in cfe1a9d311 in order to fix keyframe
flags set for the sample attached to trac #7091. However, that sample is
errantly muxed.

As noted at
https://web.archive.org/web/20020803104640/http://www.pcisys.net:80/~melanson/codecs/film-format.txt,
the original keyframe detection logic is correct, and this patch
restores it.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-22 00:32:49 -03:00
Jerome Borsboom
c0f154bba5 avcodec/vc1_pred: set ref_field_type earlier
scaleforsame_y references ref_field_type. Therefore, it needs to be set
before scaleforsame is called.

Fixes #2557.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
2018-04-21 23:59:48 +02:00
Carl Eugen Hoyos
8592ae1a1e lavf/dashdec: Do not use memcpy() to copy a struct.
Fixes a warning:
libavformat/dashdec.c:1900:65: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'struct fragment *' as the destination; expected 'struct fragment' or an explicit length
2018-04-21 22:59:34 +02:00
Ruiling Song
d865783b6c lavf/qsv: clone the frame which may be managed by framework
For filters based on framesync, the input frame was managed
by framesync, so we should not directly keep and destroy it,
instead we make a clone of it here, or else double-free will occur.
But for other filters not based on framesync, we still need to
free the input frame inside filter_frame.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-04-21 19:00:43 +01:00
Ruiling Song
f3341a0452 lavf: make overlay_qsv work based on framesync
The existing version which was cherry-picked from Libav does not work
with FFmpeg framework, because ff_request_frame() was totally
different between Libav (recursive) and FFmpeg (non-recursive).
The existing overlay_qsv implementation depends on the recursive version
of ff_request_frame to trigger immediate call to request_frame() on input pad.
But this has been removed in FFmpeg since "lavfi: make request_frame() non-recursive."
Now that we have handy framesync support in FFmpeg, so I make it work
based on framesync. Some other fixing which is also needed to make
overlay_qsv work are put in a separate patch.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-04-21 19:00:43 +01:00
Paul B Mahol
21da248b5f avfilter: add deblock filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-21 11:34:49 +02:00