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

98811 Commits

Author SHA1 Message Date
Zane van Iperen
6afc2797d2
fate: add adpcm_argo test
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:14:28 +10:00
Zane van Iperen
0549daa71b
avformat: add argo_asf muxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-07 23:14:28 +10:00
Zane van Iperen
62da99e1d0
avcodec: add adpcm_argo encoder
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:28 +10:00
Zane van Iperen
5d1e1dd6bd
avcodec/adpcm_argo: add ff_adpcm_argo_expand_nibble() and cleanup parameters
Replaces adpcm_argo_expand_nibble(). Preparation for the encoder.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:25 +10:00
Zane van Iperen
b0b87f28c3
avformat/argo_asf: check sample count in demuxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-07 23:04:15 +10:00
Michael Niedermayer
be090da25f avcodec/tiff: Check bpp/bppcount for 0
Fixes: division by zero
Fixes: 24253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6250318007107584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-07 14:01:00 +02:00
Michael Niedermayer
d51d569cf6 avcodec/snowdec: Sanity check hcoeff
Fixes: signed integer overflow: -2147483648 * -1 cannot be represented in type 'int'
Fixes: 24011/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5486376610168832

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-07 14:01:00 +02:00
Mingyu Yin
fab00b0ae0 dnn_backend_native_layer_mathunary: add floor support
It can be tested with the model generated with below python script:

import tensorflow as tf
import os
import numpy as np
import imageio
from tensorflow.python.framework import graph_util
name = 'floor'

pb_file_path = os.getcwd()
if not os.path.exists(pb_file_path+'/{}_savemodel/'.format(name)):
    os.mkdir(pb_file_path+'/{}_savemodel/'.format(name))

with tf.Session(graph=tf.Graph()) as sess:
    in_img = imageio.imread('detection.jpg')
    in_img = in_img.astype(np.float32)
    in_data = in_img[np.newaxis, :]
    input_x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
    y_ = tf.math.floor(input_x*255)/255
    y = tf.identity(y_, name='dnn_out')
    sess.run(tf.global_variables_initializer())
    constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])

    with tf.gfile.FastGFile(pb_file_path+'/{}_savemodel/model.pb'.format(name), mode='wb') as f:
        f.write(constant_graph.SerializeToString())

    print("model.pb generated, please in ffmpeg path use\n \n \
    python tools/python/convert.py {}_savemodel/model.pb --outdir={}_savemodel/ \n \nto generate model.model\n".format(name,name))

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

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow -f framemd5 {}_savemodel/tensorflow_out.md5\n  \
    or\n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow {}_savemodel/out_tensorflow.jpg\n \nto generate output result of tensorflow model\n".format(name, name, name, name))

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native -f framemd5 {}_savemodel/native_out.md5\n  \
    or \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model={}_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native {}_savemodel/out_native.jpg\n \nto generate output result of native model\n".format(name, name, name, name))

Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
2020-08-07 10:34:22 +08:00
Harry Mallon
7031a7beae avformat/mxfdec: Read color metadata from MXF
Reads color_primaries, color_trc and color_space from mxf
headers. ULs are from https://registry.smpte-ra.org/ site.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
2020-08-06 12:52:34 +02:00
Takio Yamaoka
cc6c56f5d9 avcodec/libx264: fix chroma quantizer offset usage
The default for the chromaoffset field in AVCodecContext
is zero, which until now always ended up overriding the
AVOption-set value, thus leading to the AVOption not working.

Additionally, the previous usage prevented the usage of
negative values, while both the variable as well as x264's
API would successfully handle such.

Thus, the default value of the AVOption is changed to match
the default of x264 (and what is currently the default for
the AVCodecContext chromaoffset field), and the checks are
changed to check for nonzero values.

This way:
1. the library default is still utilized if the value is zero.
2. both negative and positive values are correctly passed to
   x264.

For historical context, this was initially similarly
implemented in 5764d38173, and
then b340bd8a58 broke the
value.

Partially reverts commit b340bd8a58.

Signed-off-by: Takio Yamaoka <y.takio@gmail.com>
2020-08-06 13:09:23 +03:00
Michael Niedermayer
2c35797e18 avcodec/mpegaudiodec_template: Fix some whitespace issues
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-06 00:38:09 +02:00
Michael Niedermayer
5036d7b20c avcodec/jpeg2000dec: Handle reducedresno of 32
Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 24566/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6033783737024512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-06 00:38:09 +02:00
Gautam Ramakrishnan
5508e7bf8a libavcodec/j2kenc: Allow Encoder to use SOP and EPH markers
This patch allows the encoder to use SOP and EPH
markers. This would be useful as these markers
provide better error detection mechanisms.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-06 00:38:09 +02:00
Andreas Rheinhardt
1fbfa42432 avformat/dv: Avoid allocation for reading timecode
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-06 00:02:19 +02:00
Andreas Rheinhardt
8b0bba864b avformat/dv: Avoid alloction of DVDemuxContext
This commit avoids allocating a DVDemuxContext when demuxing raw DV by
making it part of the demuxer's context. This also allows to remove
dv_read_close().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-06 00:02:19 +02:00
Andreas Rheinhardt
edcd7c735c avformat/3dostr: Return directly after having read packet
Avoids an avio_skip(s->pb, 0).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-05 23:14:39 +02:00
Jun Zhao
becfdaaa09 lavc/libopenh264enc: use framerate if available
Respecting the framerate in the libopenh264enc codec context.

Both the libx264 and libx265 encoders already contain similar logic
to first check the framerate before falling back to the timebase.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-08-05 17:32:16 +08:00
Michael Niedermayer
ffa6072fc7 avformat/mov: Check comp_brand_size
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 24457/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5760093644390400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-04 18:27:51 +02:00
Michael Niedermayer
fd0064f75b avcodec/mpegaudiodec_template: Check CRCs for layer1 and layer2
This differs from the MPEG specification as the actual real world
files do compute their CRC over variable areas and not the fixed
ones listed in the specification. This is also the reason for
the complexity of this code and the need to perform the CRC
check for layer2 in the middle of layer2 decoding.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-04 18:27:51 +02:00
Mingyu Yin
9fbdd5454b dnn_backend_native_layer_mathunary: add ceil support
It can be tested with the model generated with below python script:

import tensorflow as tf
import os
import numpy as np
import imageio
from tensorflow.python.framework import graph_util
name = 'ceil'

pb_file_path = os.getcwd()
if not os.path.exists(pb_file_path+'/{}_savemodel/'.format(name)):
    os.mkdir(pb_file_path+'/{}_savemodel/'.format(name))

with tf.Session(graph=tf.Graph()) as sess:
    in_img = imageio.imread('detection.jpg')
    in_img = in_img.astype(np.float32)
    in_data = in_img[np.newaxis, :]
    input_x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
    y = tf.math.ceil( input_x, name='dnn_out')
    sess.run(tf.global_variables_initializer())
    constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])

    with tf.gfile.FastGFile(pb_file_path+'/{}_savemodel/model.pb'.format(name), mode='wb') as f:
        f.write(constant_graph.SerializeToString())

    print("model.pb generated, please in ffmpeg path use\n \n \
    python tools/python/convert.py ceil_savemodel/model.pb --outdir=ceil_savemodel/ \n \n \
    to generate model.model\n")

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

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model=ceil_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow -f framemd5 ceil_savemodel/tensorflow_out.md5\n \n \
    to generate output result of tensorflow model\n")

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model=ceil_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native -f framemd5 ceil_savemodel/native_out.md5\n \n \
    to generate output result of native model\n")

Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2020-08-04 19:56:54 +08:00
Zane van Iperen
fa7ad81dab
avcodec/adpcm_argo: fix incorrect documentation
Flag bit was in the wrong place.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-08-04 18:01:00 +10:00
Paul B Mahol
6ce4338943 avcodec/cfhd: fix overflow in multiplication in LUT calculation 2020-08-04 08:22:51 +02:00
Jan Ekström
9c0beaf0d3 avcodec/aacdec_template: add support for 22.2 / channel_config 13 2020-08-04 00:17:56 +03:00
Jan Ekström
3fcfe6ba40 avcodec/aacdec_template: mark second LFE element as LFE2
We now have the capability to do this.
2020-08-04 00:17:56 +03:00
Jan Ekström
93a2913ac8 avcodec/aacdectab: add mapping for 22.2
Utilizes the newly added 22.2 channel layout for channel_layout 13.
2020-08-04 00:17:56 +03:00
Jan Ekström
79b057f1b7 avcodec/mpeg4audio: add newer channel_coding mappings
Additionally, add comments regarding their definitions. Based on
ARIB STD-B32, which bases on 14496-3:2009 and 14496-3:2009/AMD4.
2020-08-04 00:17:56 +03:00
Jan Ekström
f5390a9f86 swresample/rematrix: treat 22.2 as 5.1 (back) when mixing
Only this sub-set of channels actually follows the bit mask order
in the official 22.2 channel mapping. Additionally, the 5.1 channels
are there for backwards compatibility with the previous system.

This enables the utilization of 22.2 content until a proper down/up
matrix is added into swresample.
2020-08-04 00:17:56 +03:00
Jan Ekström
2fd8add1ba swresample/matrix: switch internal clean_layout function to not drop high bits
These bits are utilized by channel layouts such as 22.2. If those
are dropped, the returned channel layout is no longer a match
against the AV_CH_LAYOUT define when returned from this function.
2020-08-04 00:17:56 +03:00
Jan Ekström
34de0abbe7 avutil/channel_layout: add 22.2 layout
Requires some extraneous top side and bottom front channels to be
defined.

According to STD-B59v2, the defined channel layout is:
- FL
- FR
- FC
- LFE1
- BL
- BR
- FLc
- FRc
- BC
- LFE2
- SiL
- SiR
- TpFL
- TpFR
- TpFC
- TpC
- TpBL
- TpBR
- TpSiL
- TpSiR
- TpBC
- BtFC
- BtFL
- BtFR
2020-08-04 00:17:56 +03:00
Martin Storsjö
4ad868497f test: hlsenc: Use unique init/segment file names for the fmp4_ac3 test
Previously, the hls-fmp4 and hls-fmp4_ac3 tests used the same file
names for init and segment files, which occasionally could cause
corruption and failed tests, if the input files for both tests are
generated in parallel, as they could overwrite each other.

This happened to work some of the time, as the fmp4_ac3 test actually
only checked the init segment file (which the fmp4 test case never
wrote, due to using the incorrect hls_segment_type option) and the
fmp4 test case always regenerated the input files due to mismatched
target and file names.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-08-03 23:52:16 +03:00
Martin Storsjö
59c4cf0509 test: hlsenc: Make the hls_fmp4 sample file name match the target
Previously, with the file name not matching the target, the files
were regenerated every time fate is rerun - contrary to the other
test targets in the same file. (While regenerating it every time
might be desireable, as that's what the test is about, the file
at least has a dependency on the ffmpeg executable, making them
regenerated every time the executable is updated - and this change
at least makes it consistent with the rest.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-08-03 23:52:13 +03:00
Paul B Mahol
acaed62ad1 avcodec/cfhd: correct 71 tag usage
It stores input format and never codebook.
2020-08-03 22:45:17 +02:00
Paul B Mahol
d2b9cb1132 avcodec/cfhdenc: fix setting default compression level 2020-08-03 22:22:08 +02:00
Paul B Mahol
65516b2cd0 avcodec/cfhdenc: extend quantization table
Should give better quality.
2020-08-03 22:22:08 +02:00
Paul B Mahol
05e58ce4e2 avcodec/cfhd: use LUT for 9 and 18 codebook decompanding
Also fix codebook 9 decompanding, fixing artifact with codebook 9
samples. Reused Gagandeep Singh patch.
2020-08-03 22:22:07 +02:00
Paul B Mahol
b4ae780693 avcodec/cfhdenc: fix PrescaleTable for YUV422P10 2020-08-03 19:34:23 +02:00
James Almer
08f60a35b4 avcodec/mpegaudiodec_template: disable CRC checking for layers 1 and 2
Layers 1 and 2 use lengths in bits which are not a multiple of 8,
and our CRC works on a per-byte basis.

Based on b48397e7b8

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-03 11:09:47 -03:00
James Almer
9afd1f6ff2 Revert "mpegaudiodec_template: disable CRC checking for layers 1 and 2"
This reverts commit b48397e7b8.

The change did not disable crc checks for layer 1 & 2, it removed reading
the CRC field.

Fixes decoding some mp2 samples and FATE test failures.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-03 10:37:49 -03:00
James Almer
b068cfccdd fate/aac: add missing bitexact flag to some encoder tests
Will prevet FATE from breaking once LIBAVCODEC_VERSION_MINOR is bumped to 100.

Reported-by: zane
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-03 09:50:17 -03:00
Lynne
b48397e7b8
mpegaudiodec_template: disable CRC checking for layers 1 and 2
Layers 1 and 2 use lengths in bits which are not a multiple of 8,
and our CRC works on a per-byte basis.
2020-08-02 22:51:55 +02:00
Lynne
fe3ea13131
hwcontext_vulkan: remove plane size alignment checks when host importing
The process space is guaranteed to be aligned to the page size, hence we're
never going to map outside of our address space.
There are more optimizations to do with respect to chroma plane alignment and
buffer offsets, but that can be done later.
2020-08-02 22:48:51 +02:00
Andriy Gelman
9d2ba8980b avcodec/v4l2_m2m: reindent after last commit
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-08-02 14:36:15 -04:00
Andriy Gelman
7c32e9cf93 avcodec/v4l2_m2m: adapt to call close() on init fail
This fixes several mem leaks when init of encoder/decoder failed.

Fixes ticket #8285

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-08-02 14:31:22 -04:00
Paul B Mahol
533d6030ca avcodec/cfhd: set correct bits_per_raw_sample 2020-08-02 09:33:24 +02:00
Paul B Mahol
e2b455f933 avcodec/cfhd: add more tag names 2020-08-02 09:33:24 +02:00
Paul B Mahol
4e27817629 avcodec: add CFHD encoder 2020-08-02 09:33:24 +02:00
Paul B Mahol
131d2a3e1c avcodec/cfhd: improve decompanding quality with reference implementation 2020-08-02 09:31:54 +02:00
Paul B Mahol
f7e35c8163 avcodec/cfhd: fix non-aligned to 8 height decoding 2020-08-02 09:31:54 +02:00
Paul B Mahol
fabbb680d4 avcodec/cfhd: move if/else out of loop in inverse transform 2020-08-02 09:31:54 +02:00
Jun Zhao
21e86a12e6 lavc/libkvazaar: fix framerate setting
fix framerate setting.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-08-02 11:24:45 +08:00