Commit Graph

98517 Commits

Author SHA1 Message Date
James Almer
d1c55fc460 avcodec/cbs_h265: set default VUI parameters when vui_parameters_present_flag is false
Based on cbs_h264 code.

Should fix ticket #8752.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-25 23:36:12 -03:00
Jun Zhao
60d79b1df9 lavc/aac_ac3_parser: improve the raw AAC file bit rate calculation
Now we just use one ADTS raw frame to calculate the bit rate, it's
lead to a larger error when get the duration from bit rate, the
improvement cumulate Nth ADTS frames to get the average bit rate.

e,g used the command get the duration like:
ffprobe -show_entries format=duration -i fate-suite/aac/foo.aac

before this improvement dump the duration=2.173935
after this improvement  dump the duration=1.979267

in fact, the real duration can be get by command like:
ffmpeg -i fate-suite/aac/foo.aac -f null /dev/null with time=00:00:01.97

Also update the fate-adtstoasc_ticket3715.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-06-26 09:53:36 +08:00
Michael Niedermayer
a8fb7612a9 avformat/microdvddec: skip malformed lines without frame number.
Fixes: signed integer overflow: 1 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 23490/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5133490093031424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-25 12:50:22 +02:00
exwm
32d6fe23b6 avfilter/zoompan: add in_time variable
Currently, the zoompan filter exposes a 'time' variable (missing from docs) for use in
the 'zoom', 'x', and 'y' expressions. This variable is perhaps better named
'out_time' as it represents the timestamp in seconds of each output frame
produced by zoompan. This patch adds aliases 'out_time' and 'ot' for 'time'.

This patch also adds an 'in_time' (alias 'it') variable that provides access
to the timestamp in seconds of each input frame to the zoompan filter.
This helps to design zoompan filters that depend on the input video timestamps.
For example, it makes it easy to zoom in instantly for only some portion of a video.
Both the 'out_time' and 'in_time' variables have been added in the documentation
for zoompan.

Example usage of 'in_time' in the zoompan filter to zoom in 2x for the
first second of the input video and 1x for the rest:
    zoompan=z='if(between(in_time,0,1),2,1):d=1'

V2: Fix zoompan filter documentation stating that the time variable
would be NAN if the input timestamp is unknown.

V3: Add 'it' alias for 'in_time. Add 'out_time' and 'ot' aliases for 'time'.
Minor corrections to zoompan docs.

Signed-off-by: exwm <thighsman@protonmail.com>
2020-06-25 10:27:07 +02:00
Levis Florian
bd6ae462f8 avformat/libamqp: add option delivery_mode
Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Levis Florian <levis.florian@gmail.com>
2020-06-24 23:15:52 -04:00
Ting Fu
24d1781cbd dnn-layer-math-unary-test: add unit test for atan
Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2020-06-25 08:41:50 +08:00
Ting Fu
13f5613e68 dnn_backend_native_layer_mathunary: add atan 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')
x1 = tf.atan(x)
x2 = tf.divide(x1, 3.1416/4) # pi/4
y = tf.identity(x2, name='dnn_out')

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>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2020-06-25 08:41:50 +08:00
Ting Fu
130c600144 dnn-layer-math-unary-test: add unit test for acos
Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2020-06-25 08:41:50 +08:00
Ting Fu
461485feac dnn_backend_native_layer_mathunary: add acos 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')
x1 = tf.acos(x)
x2 = tf.divide(x1, 3.1416/2) # pi/2
y = tf.identity(x2, name='dnn_out')

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>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2020-06-25 08:41:50 +08:00
Ting Fu
057f6ee7f4 dnn-layer-math-unary-test: add unit test for asin
Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2020-06-25 08:41:50 +08:00
Ting Fu
486c0c419d dnn_backend_native_layer_mathunary: add asin 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')
x1 = tf.asin(x)
x2 = tf.divide(x1, 3.1416/2) # pi/2
y = tf.identity(x2, name='dnn_out')

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>
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
2020-06-25 08:41:50 +08:00
Andreas Rheinhardt
6c777a6688 avformat/smoothstreaming: Forward errors from copying white/blacklists
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-24 16:07:38 +02:00
Andreas Rheinhardt
9fe30bd9a9 avcodec/cbs_av1: Simplify writing uvlc elements
There is no reason to special-case writing a value of zero as uvlc
element as the generic code is perfectly capable of doing so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-24 15:56:24 +02:00
Andreas Rheinhardt
6f06c17a55 avcodec/cbs_av1: Fix writing uvlc numbers >= INT_MAX
Fixes: assertion failure
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 23264/clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_METADATA_fuzzer-6308429248593920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-24 15:56:24 +02:00
Hendrik Leppkes
8ee6557c2e avcodec/hevc: export chroma sample location 2020-06-24 12:02:13 +02:00
Paul B Mahol
ce297b44d3 avfilter/vf_v360: do not ignore return value of allocate_plane() 2020-06-23 21:55:40 +02:00
Paul B Mahol
001748b326 avcodec/ccaption_dec: add support for background colors 2020-06-23 21:55:40 +02:00
Carl Eugen Hoyos
13db5061ff lavc: Lower MediaFoundation audio encoder priority.
The actual encoders may not be available.
Fixes ticket #8699.
2020-06-23 20:41:46 +02:00
Paul B Mahol
f719cacbd9 doc/general: mention BT20 decoder 2020-06-23 16:04:31 +02:00
Paul B Mahol
c949de2449 doc/general: merge dupe ProRes entries
While here add missing fourcc.
2020-06-23 16:00:02 +02:00
Paul B Mahol
eef0765236 doc/general: mention NotchLC 2020-06-23 16:00:02 +02:00
Paul B Mahol
00a5df71ad avfilter/vf_v360: add orthographic projection support 2020-06-23 16:00:02 +02:00
Paul B Mahol
44ce333f03 avfilters/vf_v360: add equisolid projection support 2020-06-22 14:41:36 +02:00
Andreas Rheinhardt
3f2be5372e avfilter/vf_showpalette: Don't pretend disp_palette can fail
It can't fail, yet it returns an int and other code checks whether it
failed; yet if it did fail, an AVFrame would leak. One could of course
add an av_frame_free for this (that compilers could optimize away), yet
it is easier to simply stop pretending that disp_palette could fail.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:52:01 +02:00
Andreas Rheinhardt
05475ad26b avformat/sccdec: Avoid variable that is always zero
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:17:02 +02:00
Andreas Rheinhardt
a7b82fe52b avformat/pjsdec: Avoid variable that is always zero
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:16:58 +02:00
Andreas Rheinhardt
dc4af87d2f avformat/mpl2dec: Avoid variable that is always zero
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:16:53 +02:00
Andreas Rheinhardt
7256c363a0 avformat/mov: Cosmetics
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:16:01 +02:00
Andreas Rheinhardt
9ce1eb5eb0 avformat/mov: Avoid allocation when reading ddts atom
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:14:52 +02:00
Andreas Rheinhardt
316a3e91be avformat/mov: Use ffio_read_size where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:13:48 +02:00
Andreas Rheinhardt
526f5f59df avformat/mov: Avoid allocation+copy when moving extradata
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:12:49 +02:00
Andreas Rheinhardt
88dc77e243 avformat/mov: Read attached pics directly into st->attached_pic
Given that av_get_packet returns a blank packet on error, the only
difference to the current approach (that uses intermediate AVPackets on
the stack) is that st->attached_pic will be properly initialized on error
(i.e. the timestamps are AV_NOPTS_VALUE) whereas right now st->attached_pic
is only zeroed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 13:10:58 +02:00
Andreas Rheinhardt
ddd6274944 avformat/mov: Check earlier whether reel_name string is empty
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 12:41:20 +02:00
Andreas Rheinhardt
c3cd6b765b avcodec, avformat: Remove unnecessary initializations of side data size
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 12:20:37 +02:00
Andreas Rheinhardt
b8c6aae575 avformat/avformat: Improve documentation of av_stream_get_side_data
Document that it also sets the size in case the desired side data is
absent (if the pointer has been supplied).

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 12:20:23 +02:00
Andreas Rheinhardt
45ddf06f54 avcodec/packet: Improve documentation of av_packet_get_side_data
Document that it also sets the size in case the desired side data is
absent (if the pointer has been supplied).

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 12:20:12 +02:00
Andreas Rheinhardt
b054a3a216 avformat/flvdec: Cosmetics
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 12:19:56 +02:00
Andreas Rheinhardt
55c7bb0665 avcodec/nellymoserdec: Don't use invalid AVPacketSideDataType
Commits 957a593cd9 and
11828b8885 made the flv demuxer export
a certain flag as side data to be used by the nellymoser decoder for
mid-stream sample rate changes. It used a custom side data type 'F' that
was never officially documented.

Yet since 2215c39e94 (merged in commit
52c522c720) this information is exported
via the properly documented AV_PKT_DATA_PARAM_CHANGE side data.
The merge commit therefore stopped exporting the 'F' sidedata; yet the
changes in the Nellymoser decoder (which are now dead code (and would
become dangerous if lots of new side data types were added)) have not
been removed. This commit does this.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 12:19:24 +02:00
Przemysław Sobala
82352f3c1a avformat/dashenc: Calculate average bitrate for adaptation sets in static manifest
If stream's bitrate is not specified:
- for static manifest: an average bitrate will be calculated and used,
- for dynamic manifest: first segment's bitrate will be calculated and used, as before,
for bandwidth setting in adaptation sets.
2020-06-22 10:32:44 +05:30
Przemysław Sobala
19726288d8 Revert "avformat/dashenc: use AVStream timebase when computing missing bitrate"
This reverts commit 2a9ffd89fc as duration is always in AV_TIME_BASE units
2020-06-22 10:32:10 +05:30
Paul B Mahol
fdac3c80ac avfilter/af_ladspa: check return value of getenv() 2020-06-21 21:35:40 +02:00
Paul B Mahol
683a1599d4 avfilter/af_ladspa: add latency compensation 2020-06-21 21:35:40 +02:00
Paul B Mahol
842bc312ad avfilter/af_ladspa: check another directory for plugins 2020-06-21 14:48:27 +02:00
summertriangle.dev@gmail.com
9a24610bf7 avcodec/hcadec: get intensity from correct channel
Fixes an issue with one output channel being slightly louder than
the other. The output now matches other public HCA decoders.

Signed-off-by: t <summertriangle.dev@gmail.com>
2020-06-21 11:13:29 +02:00
summertriangle.dev@gmail.com
bc2dcae897 avcodec/hcadec: fix decoding of hfr channels
I suspect this was originally broken by b7e5c8f , but even
then, it only worked because it read out of bounds from
intensity_ratio_table.

Signed-off-by: t <summertriangle.dev@gmail.com>
2020-06-21 11:13:29 +02:00
Andriy Gelman
536e5dfa73 avcodec/adpcmenc: remove forward declaration
Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-06-20 23:20:27 -04:00
Paul B Mahol
29ea4e1b3c avcodec/mpeg12dec: do not discard older a53 captions
Fixes #6105.
2020-06-20 15:09:30 +02:00
Paul B Mahol
00842b3a0d avcodec/ccaption_dec: use uint8_t type for prev_cmd array
Commands are unsigned so be consistent.
2020-06-20 15:07:26 +02:00
Paul B Mahol
bd1b78e91a avcodec/ccaption_dec: do not modify packet data in case of parity error
To dissallow similar errors in future, make pointers const.
2020-06-20 15:07:26 +02:00
Paul B Mahol
bbd0be04d0 avcodec/ccaption_dec: allow selection of second field captions 2020-06-20 15:07:26 +02:00