ffmpeg.git
4 months agoavutil/hwcontext_vdpau: Correctly initialise pixfmts
Philip Langdale [Sun, 12 Jul 2020 03:23:03 +0000 (20:23 -0700)]
avutil/hwcontext_vdpau: Correctly initialise pixfmts

The number of declared vdpau formats can vary depending on which
version of libvdpau we build against, so the number of pix fmts
can vary too. Let's make sure we keep those numbers in sync.

4 months agoavformat/mov: fix missing line break in messages
Moritz Barsnick [Thu, 25 Jun 2020 10:40:45 +0000 (12:40 +0200)]
avformat/mov: fix missing line break in messages

One of them can be triggered by https://samples.ffmpeg.org/F4V/H263_NM_f.mp4.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
4 months agocheckasm/vf_blend: use the correct depth parameters to initialize the blend modes
James Almer [Sat, 11 Jul 2020 23:55:32 +0000 (20:55 -0300)]
checkasm/vf_blend: use the correct depth parameters to initialize the blend modes

This effectively enables the tests that until now were just running
the C version alone.

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agox86/vf_blend: fix warnings about trailing empty parameters
James Almer [Sat, 11 Jul 2020 13:04:23 +0000 (10:04 -0300)]
x86/vf_blend: fix warnings about trailing empty parameters

Finishes fixing ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agox86/h264_deblock: fix warning about trailing empty parameter
James Almer [Thu, 9 Jul 2020 14:48:12 +0000 (11:48 -0300)]
x86/h264_deblock: fix warning about trailing empty parameter

Fixes part of ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agoavutil/x86inc: fix warnings when assembling with Nasm 2.15
Henrik Gramner [Thu, 9 Jul 2020 14:47:35 +0000 (11:47 -0300)]
avutil/x86inc: fix warnings when assembling with Nasm 2.15

Some new warnings regarding use of empty macro parameters has
been added, so adjust some x86inc code to silence those.

Fixes part of ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agolavf/udp: fix the comments for default UDP socket recvbuf size
Jun Zhao [Sat, 11 Jul 2020 11:09:36 +0000 (19:09 +0800)]
lavf/udp: fix the comments for default UDP socket recvbuf size

15d160cc0b2 increased the UDP socket receiving buffer size
(64K ->384K), but missed to update this comments.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 months agolavfi/setpts: fix setpts/asetpts option dump error
Jun Zhao [Sat, 13 Jun 2020 06:26:39 +0000 (14:26 +0800)]
lavfi/setpts: fix setpts/asetpts option dump error

fix the command ffmpeg -h filter=setpts/asetpts both dump the expr
option with "FVA" flags.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 months agolibavfilter/glslang: Remove unused header
Ben Clayton [Fri, 10 Jul 2020 15:53:12 +0000 (16:53 +0100)]
libavfilter/glslang: Remove unused header

The <glslang/Include/revision.h> include was not used, and revision.h has
been removed from glslang master.
See: https://github.com/KhronosGroup/glslang/pull/2277

4 months agoavfilter/vf_chromanr: move thres calculation to filter_frame()
Paul B Mahol [Fri, 10 Jul 2020 21:04:49 +0000 (23:04 +0200)]
avfilter/vf_chromanr: move thres calculation to filter_frame()

4 months agoavformat/sdp: Fix potential write beyond end of buffer
Andreas Rheinhardt [Tue, 7 Jul 2020 19:50:33 +0000 (21:50 +0200)]
avformat/sdp: Fix potential write beyond end of buffer

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/mm: Check for existence of audio stream
Andreas Rheinhardt [Thu, 9 Jul 2020 10:07:28 +0000 (12:07 +0200)]
avformat/mm: Check for existence of audio stream

No audio stream is created unconditionally and if none has been created,
no packet with stream_index 1 may be returned. This fixes an assert in
ff_read_packet() in libavformat/utils reported in ticket #8782.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavcodec/tiff: Check input space in dng_decode_jpeg()
Michael Niedermayer [Fri, 10 Jul 2020 15:14:43 +0000 (17:14 +0200)]
avcodec/tiff: Check input space in dng_decode_jpeg()

Fixes: out of array read
Fixes: 24034/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5111884337119232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/mjpeg_parser: Adjust size rejection threshold
Michael Niedermayer [Thu, 9 Jul 2020 22:31:16 +0000 (00:31 +0200)]
avcodec/mjpeg_parser: Adjust size rejection threshold

Fixes: 86987846-429c8d80-c197-11ea-916b-bb4738e09687.jpg
Fixes: Regression since ec3d8a0e6945fe015d16cd98a1e7dbb4be815c15

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/cbs_jpeg: Fix uninitialized end index in cbs_jpeg_split_fragment()
Michael Niedermayer [Fri, 10 Jul 2020 17:37:57 +0000 (19:37 +0200)]
avcodec/cbs_jpeg: Fix uninitialized end index in cbs_jpeg_split_fragment()

Fixes: Out of array read
Fixes: 24043/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5084566275751936.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/hevcdec: Add VDPAU to list of supported formats
ManojGuptaBonda [Sat, 27 Jun 2020 13:34:22 +0000 (19:04 +0530)]
avcodec/hevcdec: Add VDPAU to list of supported formats

Added VDPAU to list of supported formats for HEVC10 and 12 bit formats
also added 42010 bit to surface_parameters and new VDP chroma formats to
VDPAUPixFmtMaps

Add HEVC 420 10/12 Bit  and 444 10/12 Bit support for VDPAU

YUV444P10 is defined as the 444 surface with 10bit valid data in LSBs
but H/w returns Data in MSBs Hence if we map output as YUV444p16 it
is filtering out the LSB to convert to p10 format.

Signed-off-by: Philip Langdale <philipl@overt.org>
4 months agolavc/vdpau_hevc: add function to find exact vdp_profile for REXT
ManojGuptaBonda [Sat, 27 Jun 2020 13:34:21 +0000 (19:04 +0530)]
lavc/vdpau_hevc: add function to find exact vdp_profile for REXT

Add vdpau_parse_rext_profile and use profile constraint flags to
determine the exact vdp_profile for HEVC_REXT.

If profile mismatch is allowed, select Main profile by default.

Add build object in Makefile for h265_profile_level dependency.

Signed-off-by: Philip Langdale <philipl@overt.org>
4 months agoavcodec/mpeg12dec: add timecode metadata
Limin Wang [Sat, 20 Jun 2020 15:09:09 +0000 (23:09 +0800)]
avcodec/mpeg12dec: add timecode metadata

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavcodec/h264_slice: add timecode metadata
Limin Wang [Sat, 20 Jun 2020 13:09:09 +0000 (21:09 +0800)]
avcodec/h264_slice: add timecode metadata

Please test with below command:
./ffplay -vf drawtext="fontfile=/Library/Fonts/Arial.ttf:text=\\'%{metadata\\:timecode}\\'" \
                       ../fate-suite/h264/crew_cif_timecode-2.h264

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavcodec/h264_slice: replace cur->f with out for better readability
Limin Wang [Sat, 20 Jun 2020 12:08:06 +0000 (20:08 +0800)]
avcodec/h264_slice: replace cur->f with out for better readability

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavcodec/hevcdec: add timecode metadata
Limin Wang [Sat, 20 Jun 2020 11:34:47 +0000 (19:34 +0800)]
avcodec/hevcdec: add timecode metadata

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoswscale/tests: check return value of sws_scale
Lynne [Tue, 7 Jul 2020 21:19:14 +0000 (22:19 +0100)]
swscale/tests: check return value of sws_scale

4 months agoaarch64/yuv2rgb_neon: fix return value
Lynne [Tue, 7 Jul 2020 15:01:58 +0000 (16:01 +0100)]
aarch64/yuv2rgb_neon: fix return value

We return 0 for this particular architecture but should instead be
returning the number of lines.
Fixes users who check the return value matches what they expect.

4 months agolibavformat/dashenc.c: Support mpd update period
Siyuan Huang [Tue, 30 Jun 2020 05:41:46 +0000 (13:41 +0800)]
libavformat/dashenc.c: Support mpd update period

According ISO 23009-1, in live cases, mpd refresh period should be configurable

Signed-off-by: Siyuan Huang <saber.huang@samsung.com>
4 months agotests/dnn/mathunary: fix the issue of NAN
Ting Fu [Wed, 8 Jul 2020 06:09:51 +0000 (14:09 +0800)]
tests/dnn/mathunary: fix the issue of NAN

When one of output[i] & expected_output is NAN, the unit test will always pass.

Signed-off-by: Ting Fu <ting.fu@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
4 months agoavcodec/libaomenc: fix build w/libaom v1.0.0
James Zern [Thu, 2 Jul 2020 02:53:54 +0000 (19:53 -0700)]
avcodec/libaomenc: fix build w/libaom v1.0.0

broken since:
aa5c6f382b avcodec/libaomenc: Add command-line options to control the use of partition tools

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
4 months agoavfilter/vf_showinfo: add dump_s12m_timecode() helper function
Limin Wang [Sat, 4 Jul 2020 12:32:59 +0000 (20:32 +0800)]
avfilter/vf_showinfo: add dump_s12m_timecode() helper function

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavfilter/vf_showinfo: check sd->size before reference the sd->data
Limin Wang [Sat, 4 Jul 2020 12:32:58 +0000 (20:32 +0800)]
avfilter/vf_showinfo: check sd->size before reference the sd->data

Or it'll cause null pointer dereference if size < sizeof(uint32_t), also
in case tc[0] > 3, the code will report error directly.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/gifdec: -1 -> AV_BPRINT_SIZE_UNLIMITED
Limin Wang [Fri, 26 Jun 2020 00:47:26 +0000 (08:47 +0800)]
avformat/gifdec: -1 -> AV_BPRINT_SIZE_UNLIMITED

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavcodec/dvbsubdec: Cosmetics
Limin Wang [Fri, 26 Jun 2020 13:33:37 +0000 (21:33 +0800)]
avcodec/dvbsubdec: Cosmetics

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavcodec/dvbsubdec: prefer to use variable instead of type for sizeof
Limin Wang [Fri, 26 Jun 2020 00:47:22 +0000 (08:47 +0800)]
avcodec/dvbsubdec: prefer to use variable instead of type for sizeof

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavcodec/dvbsubdec: simplify code by using OFFSET() macro
Limin Wang [Fri, 26 Jun 2020 00:47:21 +0000 (08:47 +0800)]
avcodec/dvbsubdec: simplify code by using OFFSET() macro

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavfilter: add chromanr video filter
Paul B Mahol [Fri, 16 Nov 2018 09:13:41 +0000 (10:13 +0100)]
avfilter: add chromanr video filter

4 months agoavformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default
Zhao Zhili [Sat, 4 Jul 2020 16:51:53 +0000 (00:51 +0800)]
avformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/apedec: Fix undefined integer overflow with 24bit
Michael Niedermayer [Tue, 30 Jun 2020 20:01:22 +0000 (22:01 +0200)]
avcodec/apedec: Fix undefined integer overflow with 24bit

Fixes: signed integer overflow: 8683744 * 256 cannot be represented in type 'int'
Fixes: 23527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5679885932822528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/loco: Fix integer overflow with large values from loco_get_rice()
Michael Niedermayer [Tue, 30 Jun 2020 19:11:25 +0000 (21:11 +0200)]
avcodec/loco: Fix integer overflow with large values from loco_get_rice()

Fixes: signed integer overflow: 155 + 2147483647 cannot be represented in type 'int'
Fixes: 23421/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5652849097965568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/smjpegdec: Check the existence of referred streams
Michael Niedermayer [Mon, 6 Jul 2020 18:18:42 +0000 (20:18 +0200)]
avformat/smjpegdec: Check the existence of referred streams

Fixes: Assertion failure
Fixes: 23758/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5160954605338624.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agopthread_frame: change the criterium for updating thread contexts
Anton Khirnov [Tue, 9 Jun 2020 11:08:49 +0000 (13:08 +0200)]
pthread_frame: change the criterium for updating thread contexts

Currently the next thread's context is updated from the previous one's
if the codec descriptor is not marked as intra-only. That is not
entirely correct, since that property does not necessarily imply
anything about how a specific decoder implementation behaves.

Instead, use the presence of the update_thread_context() callback to
decide whether an update should be performed. Fixes races in CFHD,
should cause no behaviour change in any other decoders.

4 months agocodec_desc: drop the INTRA_ONLY property from TAK
Anton Khirnov [Tue, 9 Jun 2020 10:41:09 +0000 (12:41 +0200)]
codec_desc: drop the INTRA_ONLY property from TAK

It has key frames and non-key frames, so it is not intra-only.

4 months agotests/fate/hlsenc: add testcase of ac3 surround sound input in hlsenc
Steven Liu [Mon, 15 Jun 2020 12:37:41 +0000 (20:37 +0800)]
tests/fate/hlsenc: add testcase of ac3 surround sound input in hlsenc

add probeaudiostream for get audio stream's codec_name,codec_time_base,
sample_fmt,channels and channel_layout.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 months agoavformat/hlsenc: check fragment size plus start_pos large than hls_segment_size
Steven Liu [Mon, 15 Jun 2020 12:37:40 +0000 (20:37 +0800)]
avformat/hlsenc: check fragment size plus start_pos large than hls_segment_size

if vs->size + vs->start_pos > hls->max_seg_size, should split segment.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 months agoavfilter/vf_edgedetect: properly implement double_threshold()
Valery Kot [Mon, 22 Jun 2020 15:29:21 +0000 (17:29 +0200)]
avfilter/vf_edgedetect: properly implement double_threshold()

Important part of this algorithm is the double threshold step: pixels
above "high" threshold being kept, pixels below "low" threshold dropped,
pixels in between (weak edges) are kept if they are neighboring "high"
pixels.

The weak edge check uses a neighboring context and should not be applied
on the plane's border. The condition was incorrect and has been fixed in
the commit.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
4 months agoavcodec/h26[45]_metadata_bsf: Use separate contexts for reading/writing
Andreas Rheinhardt [Sun, 5 Jul 2020 22:46:40 +0000 (00:46 +0200)]
avcodec/h26[45]_metadata_bsf: Use separate contexts for reading/writing

Currently, both bsfs used the same CodedBitstreamContext for reading and
writing; as a consequence, the state of the writer's context at the
beginning of writing a fragment is exactly the state of the reader after
having read the fragment; in particular, the writer might not have
encountered one of its active parameter sets yet.

This is not nice and may lead to invalid output even when the input
is completely spec-compliant: Think of an access unit containing
a primary coded picture referencing a PPS with id id (that is known from
an earlier access unit/from extradata), then a new version of the PPS
with id id and then a redundant coded picture that is also referencing
the PPS with id id. This is spec-compliant, as the standard allows to
overwrite a PPS with a different PPS in between coded pictures and not
only at the beginning of an access unit. In this scenario, the reader
would read the primary coded picture with the old PPS and the redundant
coded picture with the new PPS (as it should); yet the writer would
write both with the new PPS as extradata which might lead to errors or
to invalid data being output without any error (e.g. if the two PPS
differed in redundant_pic_cnt_present_flag).

The above scenario does not directly translate to HEVC as long as one
restricts oneself to input with nuh_layer_id == 0 only (as cbs_h265
does: it currently strips away any NAL unit with nuh_layer_id > 0 when
decomposing); if one doesn't the same issue as above can happen.

If one also allowed input packets to contain more than one access unit,
issues like the above can happen even without redundant coded
pictures/multiple layers.

Therefore this commit uses separate contexts for reader and writer.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavcodec/cbs: Remove unused function parameters
Andreas Rheinhardt [Sun, 5 Jul 2020 22:34:25 +0000 (00:34 +0200)]
avcodec/cbs: Remove unused function parameters

Several cbs-functions had an unused CodedBitstreamContext parameter.
This commit removes these.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoSpeedhq: Decode field 2 correctly
Jean-Baptiste Kempf [Sun, 10 May 2020 16:09:51 +0000 (18:09 +0200)]
Speedhq: Decode field 2 correctly

This is similar to field 1 (effd2e72)

4 months agoavcodec/h264: support sps/pps AV_PKT_DATA_NEW_EXTRADATA
Oliver Woodman [Fri, 8 May 2020 02:09:29 +0000 (03:09 +0100)]
avcodec/h264: support sps/pps AV_PKT_DATA_NEW_EXTRADATA

Commit 601c238854 added support for AV_PKT_DATA_NEW_EXTRADATA, but
only for avcC extradata.
This commit adds support for sps/pps extradata as well. This makes
support consistent for passing new extradata consistent with the
types of extradata that can be passed when initializing the decoder.

Signed-off-by: Oliver Woodman <ollywoodman@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 months agodnn_backend_native: Add overflow check for length calculation.
Reimar Döffinger [Mon, 6 Jul 2020 07:32:17 +0000 (09:32 +0200)]
dnn_backend_native: Add overflow check for length calculation.

We should not silently allocate an incorrect sized buffer.
Fixes trac issue #8718.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
4 months agolibavformat/hlsenc: Remove duplicate close of the output stream.
Andrey Semashev [Wed, 1 Jul 2020 14:59:01 +0000 (17:59 +0300)]
libavformat/hlsenc: Remove duplicate close of the output stream.

The result of the first close attempt is ignored and may be lost. By removing
it we ensure the close result code is properly analyzed.

4 months agodnn-layer-math-unary-test: add unit test for atanh
Ting Fu [Mon, 29 Jun 2020 14:54:11 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for atanh

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn_backend_native_layer_mathunary: add atanh support
Ting Fu [Mon, 29 Jun 2020 14:54:10 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add atanh support

It can be tested with the model generated with below python script:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')

please uncomment the part you want to test

x_sinh_1 = tf.sinh(x)
x_out = tf.divide(x_sinh_1, 1.176) # sinh(1.0)

x_cosh_1 = tf.cosh(x)
x_out = tf.divide(x_cosh_1, 1.55) # cosh(1.0)

x_tanh_1 = tf.tanh(x)
x__out = tf.divide(x_tanh_1, 0.77) # tanh(1.0)

x_asinh_1 = tf.asinh(x)
x_out = tf.divide(x_asinh_1, 0.89) # asinh(1.0/1.1)

x_acosh_1 = tf.add(x, 1.1)
x_acosh_2 = tf.acosh(x_acosh_1) # accept (1, inf)
x_out = tf.divide(x_acosh_2, 1.4) # acosh(2.1)

x_atanh_1 = tf.divide(x, 1.1)
x_atanh_2 = tf.atanh(x_atanh_1) # accept (-1, 1)
x_out = tf.divide(x_atanh_2, 1.55) # atanhh(1.0/1.1)

y = tf.identity(x_out, name='dnn_out') #please only preserve the x_out you want to test

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn-layer-math-unary-test: add unit test for acosh
Ting Fu [Mon, 29 Jun 2020 14:54:09 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for acosh

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn_backend_native_layer_mathunary: add acosh support
Ting Fu [Mon, 29 Jun 2020 14:54:08 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add acosh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn-layer-math-unary-test: add unit test for asinh
Ting Fu [Mon, 29 Jun 2020 14:54:07 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for asinh

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn_backend_native_layer_mathunary: add asinh support
Ting Fu [Mon, 29 Jun 2020 14:54:06 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add asinh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn-layer-math-unary-test: add unit test for tanh
Ting Fu [Mon, 29 Jun 2020 14:54:05 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for tanh

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn_backend_native_layer_mathunary: add tanh support
Ting Fu [Mon, 29 Jun 2020 14:54:04 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add tanh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn-layer-math-unary-test: add unit test for cosh
Ting Fu [Mon, 29 Jun 2020 14:54:03 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for cosh

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn_backend_native_layer_mathunary: add cosh support
Ting Fu [Mon, 29 Jun 2020 14:54:02 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add cosh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn-layer-math-unary-test: add unit test for sinh
Ting Fu [Mon, 29 Jun 2020 14:54:01 +0000 (22:54 +0800)]
dnn-layer-math-unary-test: add unit test for sinh

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agodnn_backend_native_layer_mathunary: add sinh support
Ting Fu [Mon, 29 Jun 2020 14:54:00 +0000 (22:54 +0800)]
dnn_backend_native_layer_mathunary: add sinh support

Signed-off-by: Ting Fu <ting.fu@intel.com>
4 months agolibavcodec/jpeg2000dec.c: Enable image offsets
Gautam Ramakrishnan [Sat, 4 Jul 2020 19:03:09 +0000 (00:33 +0530)]
libavcodec/jpeg2000dec.c: Enable image offsets

This patch enables support for image offsets.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agolibavcodec/jpeg2000dec: Enhance pix fmt selection
Gautam Ramakrishnan [Sat, 4 Jul 2020 19:03:08 +0000 (00:33 +0530)]
libavcodec/jpeg2000dec: Enhance pix fmt selection

This patch assigns default pix format values when
a match does not take place.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/tiff: Check frame parameters before blit for DNG
Michael Niedermayer [Sat, 4 Jul 2020 12:17:05 +0000 (14:17 +0200)]
avcodec/tiff: Check frame parameters before blit for DNG

Fixes: out of array access
Fixes: 23888/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6021365974171648.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/mjpegdec: Limit bayer to single plane outputting format
Michael Niedermayer [Sat, 4 Jul 2020 12:15:01 +0000 (14:15 +0200)]
avcodec/mjpegdec: Limit bayer to single plane outputting format

This reduces the number of paths reachable with DNG and should
improve security

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/pnmdec: Fix misaligned reads
Michael Niedermayer [Fri, 3 Jul 2020 21:55:50 +0000 (23:55 +0200)]
avcodec/pnmdec: Fix misaligned reads

Found-by: "Steinar H. Gunderson" <steinar+ffmpeg@gunderson.no>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agolavc/qsvenc_hevc: add qmax/qmin support for HEVC encoding
Linjie Fu [Wed, 11 Mar 2020 10:39:28 +0000 (18:39 +0800)]
lavc/qsvenc_hevc: add qmax/qmin support for HEVC encoding

Add qmax/qmin support for HEVC software bitrate control(SWBRC).

Limitations:
    - RateControlMethod != MFX_RATECONTROL_CQP
    - with EXTBRC ON

Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
4 months agoavcodec/h264_metadata_bsf: Fix invalid av_freep
Andreas Rheinhardt [Sat, 4 Jul 2020 18:57:56 +0000 (20:57 +0200)]
avcodec/h264_metadata_bsf: Fix invalid av_freep

This bug was introduced in 3c8a2a1180f03ca6b299ebc27eef21ae86635ca0.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Cosmetics
Andreas Rheinhardt [Wed, 24 Jun 2020 11:53:10 +0000 (13:53 +0200)]
avformat/smacker: Cosmetics

Mainly reindentation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Use st->priv_data to store array
Andreas Rheinhardt [Mon, 22 Jun 2020 02:48:49 +0000 (04:48 +0200)]
avformat/smacker: Use st->priv_data to store array

It simplifies freeing and allows to completely remove smacker_read_close.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Don't read only one byte at a time
Andreas Rheinhardt [Mon, 22 Jun 2020 02:25:22 +0000 (04:25 +0200)]
avformat/smacker: Don't read only one byte at a time

Instead use ffio_read_size to read data into a buffer. Also check that
the desired size was actually successfully read and combine the check
with the check for reading the extradata.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Don't allocate arrays separately
Andreas Rheinhardt [Mon, 22 Jun 2020 02:06:37 +0000 (04:06 +0200)]
avformat/smacker: Don't allocate arrays separately

Allocating two arrays with the same number of elements together
simplifies freeing them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Improve timestamps
Andreas Rheinhardt [Wed, 24 Jun 2020 10:17:46 +0000 (12:17 +0200)]
avformat/smacker: Improve timestamps

A Smacker file can contain up to seven audio tracks. Up until now,
the pts for the i. audio packet contained in a Smacker frame was
simply the end timestamp of the last i. audio packet contained in
an earlier Smacker frame.

The problem with this is that a Smacker stream need not contain data in
every Smacker frame and so the current i. audio packet present may come
from a different underlying stream than the last i. audio packet
contained in an earlier frame.

The sample hypnotix.smk* exhibits this. It has three audio tracks and
the first of the three has a longer first packet, so that the audio for
the first track is contained in only 235 packets contained in the first
235 Smacker frames; the end timestamp of this track is 166696 (about 7.56s
at a timebase of 1/22050); the other two audio tracks both have 253 packets
contained in the first 253 Smacker frames. Up until now, the 236th
packet of the second track being the first audio packet in the 236th
Smacker frame would get the end timestamp of the last first audio packet
from the last Smacker frame containing a first audio packet and said
last audio packet is the first audio packet from the 235th Smacker frame
from the first audio track, so that the timestamp is 166696. In contrast,
the 236th packet from the third track (whose packets contain the same number
of samples as the packets from the second track) has a timestamp of
156116 (because its timestamp is derived from the end timestamp of the
235th packet of the second audio track). In the end, the second track
ended up being 177360/22050 s = 8.044s long; in contrast, the third
track was 166780/22050 s = 7.56s long which also coincided with the
video.

This commit fixes this by not using timestamps from other tracks for
a packet's pts.

*: https://samples.ffmpeg.org/game-formats/smacker/wetlands/hypnotix.smk

Reviewed-by: Timotej Lazar <timotej.lazar@araneo.si>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Stop caching and copying audio frames
Andreas Rheinhardt [Tue, 23 Jun 2020 15:23:57 +0000 (17:23 +0200)]
avformat/smacker: Stop caching and copying audio frames

The layout of a Smacker frame is as follows: For some frames, the
beginning of the frame contained a palette for the video stream; then
there are potentially several audio frames, followed by the data for the
video stream.

The Smacker demuxer used to read the palette, then cache every audio frame
into a buffer (that gets reallocated to the desired size every time a
frame is read into this buffer), then read and return the video frame
(together with the palette). The cached audio frames are then returned
by copying the data into freshly allocated buffers; if there are none
left, the next frame is read.

This commit changes this: At the beginning of a frame, the palette is
read and cached as now. But audio frames are no longer cached at all;
they are returned immediately. This gets rid of copying and also allows
to remove the code for the buffer-to-AVStream correspondence.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Check audio frame size
Andreas Rheinhardt [Tue, 23 Jun 2020 12:05:17 +0000 (14:05 +0200)]
avformat/smacker: Check audio frame size

The first four bytes of smacker audio are supposed to contain the number
of samples, so treat audio frames smaller than that as invalid.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Avoid potential inifinite loop on error
Andreas Rheinhardt [Tue, 23 Jun 2020 11:34:02 +0000 (13:34 +0200)]
avformat/smacker: Avoid potential inifinite loop on error

When reading a new frame, the Smacker demuxer seeks to the next frame
position where it excepts the next frame; then it (potentially) reads
the palette, the audio packets associated with the frame and finally the
actual video frame. It is only at the end that the frame counter as well
as the position where the next frame is expected get updated.

This has a downside: If e.g. invalid data is encountered when reading
the palette, the demuxer returns immediately (with an error) and if the
caller calls av_read_frame again, the demuxer seeks to the position where
it already was, reads the very same palette data again and therefore will
return an error again. If the caller calls av_read_frame repeatedly
(say, until a packet is received or until EOF), this meight become an
infinite loop.

This could also happen if e.g. the size of one of the audio frames was
invalid or if the frame size was gigantic.

This commit changes this by skipping a frame if it turns out to be
invalid or an error happens otherwise. This ensures that EOF will be
returned eventually in the above scenario.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavformat/smacker: Don't increase packet counter prematurely
Andreas Rheinhardt [Mon, 30 Mar 2020 01:35:40 +0000 (03:35 +0200)]
avformat/smacker: Don't increase packet counter prematurely

The Smacker demuxer buffers audio packets before it outputs them, but it
increments the counter of buffered packets prematurely: If allocating
the audio buffer fails, an error (most likely AVERROR(ENOMEM)) is returned.
If the caller decides to call av_read_frame() again, the next call will
take the codepath for returning already buffered audio packets and it
will fail (because the buffer that ought to be allocated isn't) without
decrementing the number of supposedly buffered audio packets (it doesn't
matter whether there would be enough memory available in subsequent calls).
Depending on the caller's behaviour this is potentially an infinite loop.

This commit fixes this by only incrementing the number of buffered audio
packets after having successfully read them and unconditionally reducing
said number when outputting one of them. It also changes the semantics
of the curstream variable: It is now the number of currently buffered
audio packets whereas it used to be the index of the last audio stream
to be read. (Index refers to the index in the array of buffers, not to
the stream index.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavcodec/dvdsub_parser: Remove empty init function
Andreas Rheinhardt [Mon, 29 Jun 2020 15:21:06 +0000 (17:21 +0200)]
avcodec/dvdsub_parser: Remove empty init function

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agoavcodec/dvbsub_parser: Don't allocate buffer separately
Andreas Rheinhardt [Mon, 29 Jun 2020 15:11:48 +0000 (17:11 +0200)]
avcodec/dvbsub_parser: Don't allocate buffer separately

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 months agocfhd: Add tag names
Kieran Kunhya [Sat, 27 Jun 2020 22:07:12 +0000 (23:07 +0100)]
cfhd: Add tag names

4 months agolibavformat/img2dec: Added pgx demuxer
Gautam Ramakrishnan [Thu, 2 Jul 2020 19:19:39 +0000 (00:49 +0530)]
libavformat/img2dec: Added pgx demuxer

This patch adds support to demux pgx file
format.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agolibavcodec/pgxdec: Add PGX decoder
Gautam Ramakrishnan [Thu, 2 Jul 2020 19:19:38 +0000 (00:49 +0530)]
libavcodec/pgxdec: Add PGX decoder

This patch adds a pgx decoder.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/amfenc_hevc: set default gops_per_idr 1
Lu Jiao [Tue, 16 Jun 2020 14:10:10 +0000 (22:10 +0800)]
avcodec/amfenc_hevc: set default gops_per_idr 1

Previously gops_per_idr default 60 would make amd gpu encoding hevc
has erratic seek bar behaviour as descripted in this ticket:
https://trac.ffmpeg.org/ticket/7272

This bad default is already fixed in newer AMF headers:
https://github.com/GPUOpen-LibrariesAndSDKs/AMF/blob/master/amf/public/include/components/VideoEncoderHEVC.h

Fixes ticket #7272.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 months agoavdevice/decklink_dec: add support for extracting and outputing klv from vanc
Milos Zivkovic [Mon, 8 Jun 2020 09:56:37 +0000 (11:56 +0200)]
avdevice/decklink_dec: add support for extracting and outputing klv from vanc

Signed-off-by: Milos Zivkovic <zivkovic@teralogics.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
4 months agoconfigure: remove libvmaf from EXTERNAL_LIBRARY_VERSION3_LIST
Kyle Swanson [Mon, 29 Jun 2020 16:58:50 +0000 (09:58 -0700)]
configure: remove libvmaf from EXTERNAL_LIBRARY_VERSION3_LIST

since libvmaf v1.5.1, libvmaf has been relicensed as BSD+Patent

Signed-off-by: Kyle Swanson <k@ylo.ph>
4 months agoffprobe: Allow unknown format private AVOptions
Derek Buitenhuis [Fri, 26 Jun 2020 13:08:37 +0000 (14:08 +0100)]
ffprobe: Allow unknown format private AVOptions

This useful, because by ffprobe's very nature, you use it to probe
a file and find out what it is. Requiring every format private option
to be known to the demuxer forces one to run ffprobe twice, if one
wants to use ffprobe in a generic way.

For example, say one wants to probe all user-uploaded files, while
also ignoring edit lists for any MP4s that are uploaded. Currently,
you'd have to run ffprobe twice: once to identify the format, and
once again to actually probe the metadata you want. After this
patch, you could set -ignore_editlist 1 on every call and only
probe once.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 months agoavcodec/mv30: Fix integer overflows in idct2_1d()
Michael Niedermayer [Thu, 18 Jun 2020 09:52:47 +0000 (11:52 +0200)]
avcodec/mv30: Fix integer overflows in idct2_1d()

Fixes: signed integer overflow: 6500736 * 473 cannot be represented in type 'int'
Fixes: 23259/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5179394271477760

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/hcadec: Check total_band_count against imdct_in size
Michael Niedermayer [Tue, 30 Jun 2020 19:32:53 +0000 (21:32 +0200)]
avcodec/hcadec: Check total_band_count against imdct_in size

Fixes: index 128 out of bounds for type 'float [128]'
Fixes: 23465/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5089866596745216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/scpr3: Fix out of array access with dectab
Michael Niedermayer [Wed, 1 Jul 2020 21:31:47 +0000 (23:31 +0200)]
avcodec/scpr3: Fix out of array access with dectab

Fixes: 23721/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5914074721550336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/tiff: Do not overrun the array ends in dng_blit()
Michael Niedermayer [Wed, 1 Jul 2020 21:05:22 +0000 (23:05 +0200)]
avcodec/tiff: Do not overrun the array ends in dng_blit()

Fixes: out of array access
Fixes: 23589/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5110559589793792.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/dstdec: Replace AC overread check by sample rate check
Michael Niedermayer [Wed, 1 Jul 2020 19:27:23 +0000 (21:27 +0200)]
avcodec/dstdec: Replace AC overread check by sample rate check

Real files do skip coding 0 bits at the end, thus this kind of check
does not work reliable.

Fixes: Ticket 8770
Fixes: dst-256fs44-6ch-refdstencoder.dff

The samplerate is specified in ISO/IEC 14496-3:2005(E) as one of 3 fixed
values, this also can be used to limit the duration and avoid the timeout

This reverts commit f6df99dba1ae64b05d08fba8160d13eb9795042f.

4 months agoavformat/icecast: Add option to use TLS connection
Marvin Scholz [Sat, 13 Jun 2020 22:52:44 +0000 (00:52 +0200)]
avformat/icecast: Add option to use TLS connection

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/hlsenc: simplify code to pass s directly
Limin Wang [Wed, 24 Jun 2020 16:14:55 +0000 (00:14 +0800)]
avformat/hlsenc: simplify code to pass s directly

Suggested-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/hlsenc: fix av_bprint_finalize() usage
Limin Wang [Mon, 22 Jun 2020 14:04:36 +0000 (22:04 +0800)]
avformat/hlsenc: fix av_bprint_finalize() usage

Don't need to do double check by the description of the API.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/hlsenc: use proper error codes
Limin Wang [Mon, 22 Jun 2020 13:58:47 +0000 (21:58 +0800)]
avformat/hlsenc: use proper error codes

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/au: check return value of au_read_annotation()
Limin Wang [Mon, 22 Jun 2020 23:14:51 +0000 (07:14 +0800)]
avformat/au: check return value of au_read_annotation()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/au: check return value of av_bprint_finalize()
Limin Wang [Mon, 22 Jun 2020 13:49:30 +0000 (21:49 +0800)]
avformat/au: check return value of av_bprint_finalize()

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavutil/opt: check return value of av_bprint_finalize()
Limin Wang [Mon, 22 Jun 2020 13:39:30 +0000 (21:39 +0800)]
avutil/opt: check return value of av_bprint_finalize()

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/dump: add a \n for end of ERROR log
Limin Wang [Wed, 1 Jul 2020 13:51:03 +0000 (21:51 +0800)]
avformat/dump: add a \n for end of ERROR log

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoFATE: fix colorbalance fate test failed on x86_32
Limin Wang [Wed, 1 Jul 2020 12:57:58 +0000 (20:57 +0800)]
FATE: fix colorbalance fate test failed on x86_32

floating point precision will cause rgb*max generate different value on
x86_32 and x86_64. have pass fate test on x86_32 and x86_64 by using
lrintf to get the nearest integral value for rgb * max before av_clip.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoReplace 'FontName' with 'Fontname' in the documentation.
Joe Ratterman [Thu, 28 May 2020 17:31:48 +0000 (10:31 -0700)]
Replace 'FontName' with 'Fontname' in the documentation.

This is the only use of 'FontName' with that capitalization, as both
source-code and tests use 'Fontname'. Having consistent capitalization
makes it easier to find the relevant source from the docs.

See these examples for other uses:
    libavcodec/ass_split.c:68
    tests/ref/fate/sub-cc:9