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

98503 Commits

Author SHA1 Message Date
Limin Wang
61880e1ad0 avcodec/mpeg12dec: add timecode metadata
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-09 22:18:42 +08:00
Limin Wang
10c7745ae9 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>
2020-07-09 22:18:42 +08:00
Limin Wang
b531216e6a avcodec/h264_slice: replace cur->f with out for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-09 22:18:42 +08:00
Limin Wang
dcf9235a87 avcodec/hevcdec: add timecode metadata
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-09 22:18:42 +08:00
Lynne
3adffab073
swscale/tests: check return value of sws_scale 2020-07-09 10:33:19 +01:00
Lynne
3e098cca6e
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.
2020-07-09 10:33:14 +01:00
Siyuan Huang
05feb7a26b 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>
2020-07-09 11:17:32 +05:30
Ting Fu
dbf66b9e0e 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>
2020-07-09 09:34:44 +08:00
James Zern
d294716c22 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>
2020-07-08 10:12:27 -07:00
Limin Wang
f9277cd796 avfilter/vf_showinfo: add dump_s12m_timecode() helper function
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-08 23:14:04 +08:00
Limin Wang
3ede8acba6 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>
2020-07-08 23:12:48 +08:00
Limin Wang
1dee8bf909 avformat/gifdec: -1 -> AV_BPRINT_SIZE_UNLIMITED
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-08 23:09:29 +08:00
Limin Wang
9cfed6d84a avcodec/dvbsubdec: Cosmetics
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-08 23:09:29 +08:00
Limin Wang
c32114e0a5 avcodec/dvbsubdec: prefer to use variable instead of type for sizeof
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-08 23:09:29 +08:00
Limin Wang
e72e4b6967 avcodec/dvbsubdec: simplify code by using OFFSET() macro
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-08 23:09:29 +08:00
Paul B Mahol
6cdddb773f avfilter: add chromanr video filter 2020-07-08 15:23:43 +02:00
Zhao Zhili
806a4d5187 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>
2020-07-07 19:25:19 +02:00
Michael Niedermayer
9f7b252cdf 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>
2020-07-07 18:20:39 +02:00
Michael Niedermayer
3ddc5e1f3c 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>
2020-07-07 18:20:34 +02:00
Michael Niedermayer
321ea59dac 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>
2020-07-07 15:15:34 +02:00
Anton Khirnov
f1feb3bd9d 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.
2020-07-07 11:03:09 +02:00
Anton Khirnov
7321614a1b codec_desc: drop the INTRA_ONLY property from TAK
It has key frames and non-key frames, so it is not intra-only.
2020-07-07 11:03:02 +02:00
Steven Liu
9ee010e734 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>
2020-07-07 14:32:07 +08:00
Steven Liu
73fe0cbb94 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>
2020-07-07 14:32:00 +08:00
Valery Kot
855d51bf48 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>
2020-07-06 23:20:53 -04:00
Andreas Rheinhardt
235a5734e0 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>
2020-07-07 05:07:15 +02:00
Andreas Rheinhardt
1bdbc50bf4 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>
2020-07-07 04:46:51 +02:00
Jean-Baptiste Kempf
fc3f5cd149 Speedhq: Decode field 2 correctly
This is similar to field 1 (effd2e72)
2020-07-06 18:23:50 +01:00
Oliver Woodman
73757577cb 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>
2020-07-06 13:52:34 -03:00
Reimar Döffinger
584f396132 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>
2020-07-06 20:22:30 +08:00
Andrey Semashev
93a435dd4b 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.
2020-07-06 15:16:45 +08:00
Ting Fu
57ea0483af dnn-layer-math-unary-test: add unit test for atanh
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
c0cdeea0ee 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>
2020-07-06 12:45:14 +08:00
Ting Fu
52d2e16665 dnn-layer-math-unary-test: add unit test for acosh
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
cd2e3a864d dnn_backend_native_layer_mathunary: add acosh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
33374bdbd8 dnn-layer-math-unary-test: add unit test for asinh
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
9d14b38d9d dnn_backend_native_layer_mathunary: add asinh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
0de5043060 dnn-layer-math-unary-test: add unit test for tanh
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
ea71e731f4 dnn_backend_native_layer_mathunary: add tanh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
c5de77e33c dnn-layer-math-unary-test: add unit test for cosh
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
62fc7e3035 dnn_backend_native_layer_mathunary: add cosh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
85c0608c6b dnn-layer-math-unary-test: add unit test for sinh
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Ting Fu
91b4037101 dnn_backend_native_layer_mathunary: add sinh support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-07-06 12:45:14 +08:00
Gautam Ramakrishnan
2c21955f52 libavcodec/jpeg2000dec.c: Enable image offsets
This patch enables support for image offsets.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-06 00:32:16 +02:00
Gautam Ramakrishnan
69522e0400 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>
2020-07-06 00:32:16 +02:00
Michael Niedermayer
4091f4f780 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>
2020-07-05 19:59:49 +02:00
Michael Niedermayer
865a34970e 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>
2020-07-05 19:59:49 +02:00
Michael Niedermayer
ea28ce9bc1 avcodec/pnmdec: Fix misaligned reads
Found-by: "Steinar H. Gunderson" <steinar+ffmpeg@gunderson.no>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-05 19:59:49 +02:00
Linjie Fu
c2d000ec27 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>
2020-07-05 23:43:45 +08:00
Andreas Rheinhardt
04e06beb0a avcodec/h264_metadata_bsf: Fix invalid av_freep
This bug was introduced in 3c8a2a1180.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-04 21:46:30 +02:00