Compare commits
200 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1047c286fa | ||
![]() |
bf6ba4a032 | ||
![]() |
c6f343d7c4 | ||
![]() |
c646ee3da7 | ||
![]() |
68c11b6654 | ||
![]() |
10429a5284 | ||
![]() |
f9f1c50b41 | ||
![]() |
84cc40cbe1 | ||
![]() |
43bfe0ada5 | ||
![]() |
25b56dfa5c | ||
![]() |
3126d6ee02 | ||
![]() |
35a0d4801f | ||
![]() |
e0ef1b8c0b | ||
![]() |
723d2b0c5b | ||
![]() |
5260ba3e16 | ||
![]() |
427cf443ab | ||
![]() |
d818b8338c | ||
![]() |
666295ebab | ||
![]() |
9ce3e804ff | ||
![]() |
f073ed6651 | ||
![]() |
b60895a13b | ||
![]() |
eac07625f9 | ||
![]() |
55ee305beb | ||
![]() |
0719b1849c | ||
![]() |
a593e8190f | ||
![]() |
41cb921512 | ||
![]() |
7969c0c6f1 | ||
![]() |
078ae8cbb7 | ||
![]() |
49664f160e | ||
![]() |
deefa1580a | ||
![]() |
b628942eef | ||
![]() |
91767369a7 | ||
![]() |
6e7f434ad2 | ||
![]() |
c55a6bac6c | ||
![]() |
fea9ed39e6 | ||
![]() |
62e4fe09ed | ||
![]() |
bdf67f3837 | ||
![]() |
85558c3da4 | ||
![]() |
a99169ea4a | ||
![]() |
748194b58b | ||
![]() |
5766f99f71 | ||
![]() |
6d7a0c37b1 | ||
![]() |
73ea11d721 | ||
![]() |
65b47dddcf | ||
![]() |
57b7a009c0 | ||
![]() |
f1b0d65237 | ||
![]() |
7bda5b378d | ||
![]() |
959423e8d7 | ||
![]() |
96de4bbf38 | ||
![]() |
de648a11d8 | ||
![]() |
f30ab69b38 | ||
![]() |
ce3bb01119 | ||
![]() |
3bd85e1f83 | ||
![]() |
7c4e3ddda1 | ||
![]() |
fbd9ab5967 | ||
![]() |
18e83992f2 | ||
![]() |
bec4b3c856 | ||
![]() |
c0ca9773a7 | ||
![]() |
9193fd9ddf | ||
![]() |
02fe112c7c | ||
![]() |
81941153ab | ||
![]() |
2c50cc497d | ||
![]() |
8c6bbc6728 | ||
![]() |
27a0dab914 | ||
![]() |
618c7a91ee | ||
![]() |
e75393c659 | ||
![]() |
17fd68e9d7 | ||
![]() |
f61ebd555d | ||
![]() |
8c8a9a20cf | ||
![]() |
796cc5a5eb | ||
![]() |
5b5002279d | ||
![]() |
b56de5859e | ||
![]() |
e03fa4b88d | ||
![]() |
6d3f0fe24d | ||
![]() |
a39a2978d5 | ||
![]() |
9f99f29f23 | ||
![]() |
b947ff8985 | ||
![]() |
936a5dd2c5 | ||
![]() |
236452f83e | ||
![]() |
b45f67b05a | ||
![]() |
179d850ded | ||
![]() |
7727877239 | ||
![]() |
0069d4597b | ||
![]() |
b50fa26885 | ||
![]() |
2c180cfc5d | ||
![]() |
3b69f245db | ||
![]() |
7064209096 | ||
![]() |
95cf5e83a7 | ||
![]() |
e4e64f2fea | ||
![]() |
4dc0fbb13c | ||
![]() |
93ceae749b | ||
![]() |
dcc8009249 | ||
![]() |
fb2d1b1b13 | ||
![]() |
91aa6d8a8b | ||
![]() |
1ab5f63941 | ||
![]() |
9005075f39 | ||
![]() |
9f4979b24c | ||
![]() |
df0003030a | ||
![]() |
95b42188d6 | ||
![]() |
63afe5b914 | ||
![]() |
2070149cbb | ||
![]() |
3cc8285439 | ||
![]() |
4e4708ad80 | ||
![]() |
8624b49276 | ||
![]() |
39cb08cdc2 | ||
![]() |
8f3787d068 | ||
![]() |
5b1befb074 | ||
![]() |
3d296c0ec1 | ||
![]() |
52242a387b | ||
![]() |
74b856e58b | ||
![]() |
d45eef0814 | ||
![]() |
efb28e3c51 | ||
![]() |
d5f2302aca | ||
![]() |
60d0d68a8d | ||
![]() |
b8d3c3ea86 | ||
![]() |
e6f17337cf | ||
![]() |
d7888ff644 | ||
![]() |
86be9cda97 | ||
![]() |
a7dedd8ea5 | ||
![]() |
d61022d55f | ||
![]() |
b37bfbfbe5 | ||
![]() |
5549f693d2 | ||
![]() |
1f64b018cb | ||
![]() |
0f50c53cfb | ||
![]() |
a55a706448 | ||
![]() |
21b21aed79 | ||
![]() |
cb5324200c | ||
![]() |
ac1660509e | ||
![]() |
386e80610d | ||
![]() |
744d813bcf | ||
![]() |
844201e35f | ||
![]() |
f77c9d7161 | ||
![]() |
4415d0f3bb | ||
![]() |
8ae4d4e117 | ||
![]() |
2af720fe5f | ||
![]() |
9f6c36d961 | ||
![]() |
78a3a4580c | ||
![]() |
7244cefd6e | ||
![]() |
09764c9909 | ||
![]() |
07256a7a6e | ||
![]() |
f28d3f98c5 | ||
![]() |
146648771c | ||
![]() |
843b860ad9 | ||
![]() |
97d7c8d584 | ||
![]() |
8d3a967635 | ||
![]() |
1cb470934a | ||
![]() |
4ba11b944e | ||
![]() |
8b86c2ed2e | ||
![]() |
378ee3bad5 | ||
![]() |
41a89cba60 | ||
![]() |
7b66cf5ce7 | ||
![]() |
97010c74cb | ||
![]() |
0d3a7dd264 | ||
![]() |
de7b74d254 | ||
![]() |
73af011c79 | ||
![]() |
f6dd6b4fd2 | ||
![]() |
dfe37f2be2 | ||
![]() |
b16a6c6709 | ||
![]() |
ee3d4e2b09 | ||
![]() |
9a9379ff7f | ||
![]() |
f7a6a6d591 | ||
![]() |
8b9cfdc927 | ||
![]() |
1deebf3b22 | ||
![]() |
7572cf7fdc | ||
![]() |
07a7f38421 | ||
![]() |
3fd66f7f45 | ||
![]() |
3bd7aa4660 | ||
![]() |
4c20249c86 | ||
![]() |
1a8b4158c5 | ||
![]() |
b28fab2ebe | ||
![]() |
6b1c8797f4 | ||
![]() |
6458ee5af8 | ||
![]() |
cfbfe6cd4d | ||
![]() |
d2ff2c9dd3 | ||
![]() |
65b257b21c | ||
![]() |
164ababc62 | ||
![]() |
115961acc1 | ||
![]() |
6a87a152e8 | ||
![]() |
72ddcb2459 | ||
![]() |
fd90005b46 | ||
![]() |
cf80856cbc | ||
![]() |
9c4b09c4bd | ||
![]() |
2adcdf5084 | ||
![]() |
4191e01e99 | ||
![]() |
e617d6f988 | ||
![]() |
155e0e9fd9 | ||
![]() |
7493c54ad0 | ||
![]() |
27993da8e7 | ||
![]() |
d7071efae4 | ||
![]() |
81e4b6f11a | ||
![]() |
8c832e3cc0 | ||
![]() |
0014b24373 | ||
![]() |
0b71cedfe8 | ||
![]() |
3e1c9da38b | ||
![]() |
3a5b4afd91 | ||
![]() |
4b817e2fff | ||
![]() |
5598d62a07 | ||
![]() |
4347cf9f0f | ||
![]() |
17b27a7cbe | ||
![]() |
420aa06a24 |
141
Changelog
141
Changelog
@@ -1,7 +1,146 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
version 2.4.10:
|
||||
- diracdec: check if reference could not be allocated
|
||||
- diracdec: avoid overflow of bytes*8 in decode_lowdelay
|
||||
- diracdec: prevent overflow in data_unit_size check
|
||||
- avformat/matroskadec: Use tracks[k]->stream instead of s->streams[k]
|
||||
- matroskadec: check s->streams[k] before using it
|
||||
- avcodec/ffv1dec: Check chroma shift parameters
|
||||
- matroskadec: use uint64_t instead of int for index_scale
|
||||
- avcodec/wavpack: Check L/R values before use to avoid harmless integer overflow and undefined behavior in fate
|
||||
- nutdec: fix illegal count check in decode_main_header
|
||||
- nutdec: check for negative frame rate in decode_info_header
|
||||
- ffmpeg: remove incorrect network deinit
|
||||
- OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c
|
||||
- apedec: set s->samples only when init_frame_decoder succeeded
|
||||
- OS/2:Makedef.cmd cleanup
|
||||
- avcodec/golomb: get_ur_golomb_jpegls: Fix reading huge k values
|
||||
- avformat/mov: Fix parsing short loci
|
||||
- avformat/mov: Print reason of loci parsing failure
|
||||
- avcodec/hevc: Fix typo in num_entry_point_offsets check
|
||||
- avcodec/libtheoraenc: Check for av_malloc failure
|
||||
- avcodec/dcadec: Check active_bands
|
||||
- avcodec/dcadec: Check scale table index
|
||||
- avcodec/sonic: More completely check sample_rate_index and channels
|
||||
- avcodec/sonic: check memory allocations
|
||||
- avcodec/smvjpegdec: check avcodec_decode_video2() return code
|
||||
- avcodec/shorten: More complete pred_order check
|
||||
- avcodec/shorten: Check skip_bytes()
|
||||
- png: Set the color range as full range
|
||||
- mpegts: Update the PSI/SI table only if the version change
|
||||
- rtsp: Make sure we don't write too many transport entries into a fixed-size array
|
||||
- rtpenc_jpeg: Handle case of picture dimensions not dividing by 8
|
||||
- libvpx: Fix mixed use of av_malloc() and av_reallocp()
|
||||
- aacpsy: correct calculation of minath in psy_3gpp_init
|
||||
- avcodec/shorten: Fix code depending on signed overflow behavior
|
||||
- avcodec/proresdec2: Reset slice_count on deallocation
|
||||
- ffmpeg_opt: Fix -timestamp parsing
|
||||
- avcodec/dcadec: Check subsubframes
|
||||
- avcodec/dcadec: Check nchans
|
||||
- hevc: make avcodec_decode_video2() fail if get_format() fails
|
||||
- avcodec/cavsdec: Check esc_code
|
||||
- avcodec/on2avc: Check run more carefully
|
||||
- avcodec/mpeg4audio: add some padding/alignment to MAX_PCE_SIZE
|
||||
- swr: fix alignment issue caused by 8ch sse functions
|
||||
- avcodec/mjpegdec: fix len computation in ff_mjpeg_decode_dqt()
|
||||
- avcodec/jpeg2000dec: fix boolean operator
|
||||
- avcodec/hevc_ps: Explicitly check num_tile_* for negative values
|
||||
- avcodec/hevc_ps: Check vps_num_hrd_parameters
|
||||
- avcodec/hevc_ps: More completely check vps_num_layer_sets
|
||||
- avcodec/hevc: Check num_entry_point_offsets
|
||||
- avcodec/hevc: Check offset_len
|
||||
- libswscale/x86/hscale_fast_bilinear_simd.c: Include BX in the clobber list on x86_64, because it isn't implicitly included when PIC is on.
|
||||
- avcodec/hevc_sei: Check num_sps_ids_minus1 value
|
||||
- avcodec/vqavideo: Check chunk size
|
||||
- aacdec: don't return frames without data
|
||||
- avformat/hevc: Check num_negative_pics and num_positive_pics
|
||||
- avformat/hevc: Check cpb_cnt_minus1
|
||||
- avformat/matroskadec: Cleanup error handling for bz2 & zlib
|
||||
- avformat/nutdec: Fix use of uinitialized value
|
||||
- avformat/rtpenc_jpeg: Check remaining buffer size for SOS
|
||||
- avformat/rtpdec_xiph: Check upper bound on len in xiph_handle_packet()
|
||||
- tools/graph2dot: use larger data types than int for array/string sizes
|
||||
- avformat/matroskaenc: Check ff_vorbiscomment_length in put_flac_codecpriv()
|
||||
- avformat/oggenc: Check ff_vorbiscomment_length in ogg_write_vorbiscomment()
|
||||
- avformat/flacenc: Check length in flac_write_block_comment()
|
||||
- avformat/subtitles: Use size_t for len
|
||||
- avformat/url: Use size_t for len from strlen()
|
||||
- avutil/avstring: Use size_t in av_strlcatf()
|
||||
- avformat/vorbiscomment: Check entry length in ff_vorbiscomment_write()
|
||||
- avutil/dict: Use size_t for appending strings
|
||||
- libavutil/mem: use size_t for the length in av_strdup()
|
||||
- aacsbr: break infinite loop in sbr_hf_calc_npatches
|
||||
- diracdec: check that block length is valid
|
||||
- ffmpeg_opt: Set the video VBV parameters only for the video stream from -target
|
||||
- avcodec/bitstream: Assert that there is enough space left in avpriv_copy_bits()
|
||||
- avcodec/put_bits: Assert that there is enough space left in skip_put_bytes()
|
||||
- avcodec/mpegvideo_enc: Update the buffer size as more slices are merged
|
||||
- avcodec/put_bits: Update size_in_bits in set_put_bits_buffer_size()
|
||||
- avformat/wavdec: Increase dts packet threshold to fix more misdetections
|
||||
- avformat/wavdec: Increase probe_packets limit
|
||||
- nutdec: abort if EOF is reached in decode_info_header/read_sm_data
|
||||
- nutdec: stop skipping bytes at EOF
|
||||
- nutdec: fix infinite resync loops
|
||||
- avformat/nutdec: Check X in 2nd branch of index reading
|
||||
- avformat/nutdec: Fix recovery when immedeately after seeking a failure happens
|
||||
- avformat/nutdec: Return error on EOF from get_str()
|
||||
- avcodec/x86/cavsdsp: remove unneeded tmp
|
||||
- nutdec: fix memleaks on error in nut_read_header
|
||||
- avformat/avidec: print a warning for negative sample_size
|
||||
- avidec: avoid infinite loop due to negative ast->sample_size
|
||||
- nutdec: check chapter creation in decode_info_header
|
||||
- apedec: prevent out of array writes in decode_array_0000
|
||||
- avformat/mpegts: Detect changes in packet through CRC instead of just the 5bit version
|
||||
- avformat/mpegts: reset last_ver on corrupted packets
|
||||
- avformat/mpegts: Factorize version checking code out
|
||||
- avformat/mpegts: Also parse the FMC descriptor if the codec has not been identified yet
|
||||
- avformat/mpegts: reset last_version on seeking
|
||||
- avformat/mp3dec: Check for avcodec_alloc_context3() failure
|
||||
- avformat/mp3dec: properly allocate dummy AVCodecContext
|
||||
- lavfi/fade: Do not overread input buffer.
|
||||
- tests: drop bc dependency
|
||||
- alsdec: limit avctx->bits_per_raw_sample to 32
|
||||
|
||||
|
||||
version 2.4.9:
|
||||
- alac: reject rice_limit 0 if compression is used
|
||||
- lavf: Reset global flag on deinit
|
||||
- bink: check vst->index_entries before using it
|
||||
- mpeg4videodec: only allow a positive length
|
||||
- alsdec: check sample pointer range in revert_channel_correlation
|
||||
- avcodec/h264_refs: Do not set reference to things which do not exist
|
||||
- avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading mode
|
||||
- h264: avoid unnecessary calls to get_format
|
||||
- avutil/pca: Check for av_malloc* failures
|
||||
- alsdec: validate time diff index
|
||||
- avcodec/alsdec: Use av_mallocz_array() for chan_data to ensure the arrays never contain random data
|
||||
- alsdec: ensure channel reordering is reversible
|
||||
- avcodec/atrac3plusdsp: fix on stack alignment
|
||||
- ac3: validate end in ff_ac3_bit_alloc_calc_mask
|
||||
- aacpsy: avoid psy_band->threshold becoming NaN
|
||||
- aasc: return correct buffer size from aasc_decode_frame
|
||||
- aacdec: consistently use avctx for logging in decode_eld_specific_config
|
||||
- msrledec: use signed pixel_ptr in msrle_decode_pal4
|
||||
- swresample/swresample-test: Randomly wipe out channel counts
|
||||
- swresample: Check channel layouts and channels against each other and print human readable error messages
|
||||
- swresample: Allow reinitialization without ever setting channel layouts
|
||||
- swresample: Allow reinitialization without ever setting channel counts
|
||||
- avcodec/h264: Do not fail with randomly truncated VUIs
|
||||
- avcodec/h264_ps: Move truncation check from VUI to SPS
|
||||
- avcodec/h264: Be more tolerant to changing pps id between slices
|
||||
- avcodec/aacdec: Fix storing state before PCE decode
|
||||
- avcodec/h264: reset the counts in the correct context
|
||||
- avcodec/h264_slice: Do not reset mb_aff_frame per slice
|
||||
- tests: Fix test name for pixfmts tests
|
||||
- avcodec/h264: finish previous slices before switching to single thread mode
|
||||
- avcodec/h264: Fix race between slices where one overwrites data from the next
|
||||
- avformat/utils: avoid discarded streams in av_find_default_stream_index()
|
||||
- avformat/utils: Ensure that AVFMT_FLAG_CUSTOM_IO is set before use
|
||||
- avformat/img2dec: do not rewind custom io buffers
|
||||
- fate: Include branch information in the payload header
|
||||
|
||||
|
||||
version 2.4.8:
|
||||
- avutil/cpu: add missing check for mmxext to av_force_cpu_flags
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "libavutil/time.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/opencl.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "cmdutils.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -238,7 +239,8 @@ int opt_opencl_bench(void *optctx, const char *opt, const char *arg)
|
||||
devices[count].platform_idx = i;
|
||||
devices[count].device_idx = j;
|
||||
devices[count].runtime = score;
|
||||
strcpy(devices[count].device_name, device_node->device_name);
|
||||
av_strlcpy(devices[count].device_name, device_node->device_name,
|
||||
sizeof(devices[count].device_name));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
3
configure
vendored
3
configure
vendored
@@ -4123,11 +4123,10 @@ case $target_os in
|
||||
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
|
||||
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
|
||||
SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
|
||||
echo PROTMODE >> $(SUBDIR)$(NAME).def; \
|
||||
echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
|
||||
echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
|
||||
echo EXPORTS >> $(SUBDIR)$(NAME).def; \
|
||||
emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
|
||||
emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
|
||||
SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
|
||||
emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
|
||||
SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
|
||||
|
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.4.8
|
||||
PROJECT_NUMBER = 2.4.10
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@@ -234,10 +234,14 @@ Possible flags for this option are:
|
||||
@item sse4.1
|
||||
@item sse4.2
|
||||
@item avx
|
||||
@item avx2
|
||||
@item xop
|
||||
@item fma3
|
||||
@item fma4
|
||||
@item 3dnow
|
||||
@item 3dnowext
|
||||
@item bmi1
|
||||
@item bmi2
|
||||
@item cmov
|
||||
@end table
|
||||
@item ARM
|
||||
@@ -248,6 +252,13 @@ Possible flags for this option are:
|
||||
@item vfp
|
||||
@item vfpv3
|
||||
@item neon
|
||||
@item setend
|
||||
@end table
|
||||
@item AArch64
|
||||
@table @samp
|
||||
@item armv8
|
||||
@item vfp
|
||||
@item neon
|
||||
@end table
|
||||
@item PowerPC
|
||||
@table @samp
|
||||
|
@@ -135,8 +135,6 @@ You will need the following prerequisites:
|
||||
(if using MSVC 2012 or earlier)
|
||||
@item @uref{http://www.mingw.org/, MSYS}
|
||||
@item @uref{http://yasm.tortall.net/, YASM}
|
||||
@item @uref{http://gnuwin32.sourceforge.net/packages/bc.htm, bc for Windows} if
|
||||
you want to run @uref{fate.html, FATE}.
|
||||
@end itemize
|
||||
|
||||
To set up a proper environment in MSYS, you need to run @code{msys.bat} from
|
||||
@@ -283,7 +281,7 @@ binutils, gcc4-core, make, git, mingw-runtime, texinfo
|
||||
|
||||
In order to run FATE you will also need the following "Utils" packages:
|
||||
@example
|
||||
bc, diffutils
|
||||
diffutils
|
||||
@end example
|
||||
|
||||
If you want to build FFmpeg with additional libraries, download Cygwin
|
||||
|
39
ffmpeg.c
39
ffmpeg.c
@@ -352,7 +352,6 @@ void term_init(void)
|
||||
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
|
||||
}
|
||||
#endif
|
||||
avformat_network_deinit();
|
||||
|
||||
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
|
||||
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
|
||||
@@ -587,7 +586,7 @@ static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream,
|
||||
static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
|
||||
{
|
||||
AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
|
||||
AVCodecContext *avctx = ost->st->codec;
|
||||
AVCodecContext *avctx = ost->encoding_needed ? ost->enc_ctx : ost->st->codec;
|
||||
int ret;
|
||||
|
||||
if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) {
|
||||
@@ -2513,7 +2512,7 @@ static int transcode_init(void)
|
||||
if (ost->attachment_filename)
|
||||
continue;
|
||||
|
||||
enc_ctx = ost->enc_ctx;
|
||||
enc_ctx = ost->stream_copy ? ost->st->codec : ost->enc_ctx;
|
||||
|
||||
if (ist) {
|
||||
dec_ctx = ist->dec_ctx;
|
||||
@@ -2560,11 +2559,13 @@ static int transcode_init(void)
|
||||
enc_ctx->rc_max_rate = dec_ctx->rc_max_rate;
|
||||
enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size;
|
||||
enc_ctx->field_order = dec_ctx->field_order;
|
||||
enc_ctx->extradata = av_mallocz(extra_size);
|
||||
if (!enc_ctx->extradata) {
|
||||
return AVERROR(ENOMEM);
|
||||
if (dec_ctx->extradata_size) {
|
||||
enc_ctx->extradata = av_mallocz(extra_size);
|
||||
if (!enc_ctx->extradata) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
|
||||
}
|
||||
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
|
||||
enc_ctx->extradata_size= dec_ctx->extradata_size;
|
||||
enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample;
|
||||
|
||||
@@ -2879,24 +2880,26 @@ static int transcode_init(void)
|
||||
if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000)
|
||||
av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."
|
||||
" It takes bits/s as argument, not kbits/s\n");
|
||||
|
||||
ret = avcodec_copy_context(ost->st->codec, ost->enc_ctx);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Error initializing the output stream codec context.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
// copy timebase while removing common factors
|
||||
ost->st->time_base = av_add_q(ost->enc_ctx->time_base, (AVRational){0, 1});
|
||||
ost->st->codec->codec= ost->enc_ctx->codec;
|
||||
} else {
|
||||
if (av_opt_set_dict(ost->enc_ctx, &ost->encoder_opts) < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Error setting up codec context options.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
// copy timebase while removing common factors
|
||||
ost->st->time_base = av_add_q(ost->st->codec->time_base, (AVRational){0, 1});
|
||||
}
|
||||
|
||||
ret = avcodec_copy_context(ost->st->codec, ost->enc_ctx);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Error initializing the output stream codec context.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
ost->st->codec->codec= ost->enc_ctx->codec;
|
||||
|
||||
// copy timebase while removing common factors
|
||||
ost->st->time_base = av_add_q(ost->enc_ctx->time_base, (AVRational){0, 1});
|
||||
}
|
||||
|
||||
/* init input streams */
|
||||
|
24
ffmpeg_opt.c
24
ffmpeg_opt.c
@@ -1977,8 +1977,8 @@ loop_end:
|
||||
ost->stream_copy = 0;
|
||||
ost->attachment_filename = o->attachments[i];
|
||||
ost->finished = 1;
|
||||
ost->enc_ctx->extradata = attachment;
|
||||
ost->enc_ctx->extradata_size = len;
|
||||
ost->st->codec->extradata = attachment;
|
||||
ost->st->codec->extradata_size = len;
|
||||
|
||||
p = strrchr(o->attachments[i], '/');
|
||||
av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE);
|
||||
@@ -2224,9 +2224,9 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
||||
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
||||
|
||||
opt_default(NULL, "b:v", "1150000");
|
||||
opt_default(NULL, "maxrate", "1150000");
|
||||
opt_default(NULL, "minrate", "1150000");
|
||||
opt_default(NULL, "bufsize", "327680"); // 40*1024*8;
|
||||
opt_default(NULL, "maxrate:v", "1150000");
|
||||
opt_default(NULL, "minrate:v", "1150000");
|
||||
opt_default(NULL, "bufsize:v", "327680"); // 40*1024*8;
|
||||
|
||||
opt_default(NULL, "b:a", "224000");
|
||||
parse_option(o, "ar", "44100", options);
|
||||
@@ -2253,9 +2253,9 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
||||
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
||||
|
||||
opt_default(NULL, "b:v", "2040000");
|
||||
opt_default(NULL, "maxrate", "2516000");
|
||||
opt_default(NULL, "minrate", "0"); // 1145000;
|
||||
opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
|
||||
opt_default(NULL, "maxrate:v", "2516000");
|
||||
opt_default(NULL, "minrate:v", "0"); // 1145000;
|
||||
opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
|
||||
opt_default(NULL, "scan_offset", "1");
|
||||
|
||||
opt_default(NULL, "b:a", "224000");
|
||||
@@ -2275,9 +2275,9 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
||||
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
||||
|
||||
opt_default(NULL, "b:v", "6000000");
|
||||
opt_default(NULL, "maxrate", "9000000");
|
||||
opt_default(NULL, "minrate", "0"); // 1500000;
|
||||
opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
|
||||
opt_default(NULL, "maxrate:v", "9000000");
|
||||
opt_default(NULL, "minrate:v", "0"); // 1500000;
|
||||
opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
|
||||
|
||||
opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
|
||||
opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
|
||||
@@ -2801,7 +2801,7 @@ const OptionDef options[] = {
|
||||
{ "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) },
|
||||
"set the input ts scale", "scale" },
|
||||
{ "timestamp", HAS_ARG | OPT_PERFILE, { .func_arg = opt_recording_timestamp },
|
||||
{ "timestamp", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_recording_timestamp },
|
||||
"set the recording timestamp ('now' to set the current time)", "time" },
|
||||
{ "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
|
||||
"add metadata", "string=string" },
|
||||
|
@@ -425,7 +425,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
* Save current output configuration if and only if it has been locked.
|
||||
*/
|
||||
static void push_output_configuration(AACContext *ac) {
|
||||
if (ac->oc[1].status == OC_LOCKED) {
|
||||
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
|
||||
ac->oc[0] = ac->oc[1];
|
||||
}
|
||||
ac->oc[1].status = OC_NONE;
|
||||
@@ -881,7 +881,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
|
||||
if (len == 15 + 255)
|
||||
len += get_bits(gb, 16);
|
||||
if (get_bits_left(gb) < len * 8 + 4) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
|
||||
av_log(avctx, AV_LOG_ERROR, overread_err);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
skip_bits_long(gb, 8 * len);
|
||||
@@ -3021,6 +3021,12 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
AV_WL32(side, 2*AV_RL32(side));
|
||||
}
|
||||
|
||||
if (!ac->frame->data[0] && samples) {
|
||||
av_log(avctx, AV_LOG_ERROR, "no frame data found\n");
|
||||
err = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*got_frame_ptr = !!samples;
|
||||
if (samples) {
|
||||
ac->frame->nb_samples = samples;
|
||||
|
@@ -313,7 +313,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
||||
ctx->bitres.size = 6144 - pctx->frame_bits;
|
||||
ctx->bitres.size -= ctx->bitres.size % 8;
|
||||
pctx->fill_level = ctx->bitres.size;
|
||||
minath = ath(3410, ATH_ADD);
|
||||
minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD);
|
||||
for (j = 0; j < 2; j++) {
|
||||
AacPsyCoeffs *coeffs = pctx->psy_coef[j];
|
||||
const uint8_t *band_sizes = ctx->bands[j];
|
||||
@@ -727,7 +727,10 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
|
||||
if (active_lines > 0.0f)
|
||||
band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction);
|
||||
pe += calc_pe_3gpp(band);
|
||||
band->norm_fac = band->active_lines / band->thr;
|
||||
if (band->thr > 0.0f)
|
||||
band->norm_fac = band->active_lines / band->thr;
|
||||
else
|
||||
band->norm_fac = 0.0f;
|
||||
norm_fac += band->norm_fac;
|
||||
}
|
||||
}
|
||||
|
@@ -514,7 +514,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
||||
/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
|
||||
static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
|
||||
{
|
||||
int i, k, sb = 0;
|
||||
int i, k, last_k = -1, last_msb = -1, sb = 0;
|
||||
int msb = sbr->k[0];
|
||||
int usb = sbr->kx[1];
|
||||
int goal_sb = ((1000 << 11) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
|
||||
@@ -528,6 +528,12 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
|
||||
|
||||
do {
|
||||
int odd = 0;
|
||||
if (k == last_k && msb == last_msb) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
last_k = k;
|
||||
last_msb = msb;
|
||||
for (i = k; i == k || sb > (sbr->k[0] - 1 + msb - odd); i--) {
|
||||
sb = sbr->f_master[i];
|
||||
odd = (sb + sbr->k[0]) & 1;
|
||||
|
@@ -137,7 +137,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
|
||||
/* report that the buffer was completely consumed */
|
||||
return buf_size;
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
static av_cold int aasc_decode_end(AVCodecContext *avctx)
|
||||
|
@@ -131,6 +131,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
|
||||
int band_start, band_end, begin, end1;
|
||||
int lowcomp, fastleak, slowleak;
|
||||
|
||||
if (end <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* excitation function */
|
||||
band_start = ff_ac3_bin_to_band_tab[start];
|
||||
band_end = ff_ac3_bin_to_band_tab[end-1] + 1;
|
||||
|
@@ -316,6 +316,12 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
|
||||
int lpc_quant[2];
|
||||
int rice_history_mult[2];
|
||||
|
||||
if (!alac->rice_limit) {
|
||||
avpriv_request_sample(alac->avctx,
|
||||
"Compression with rice limit 0");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
decorr_shift = get_bits(&alac->gb, 8);
|
||||
decorr_left_weight = get_bits(&alac->gb, 8);
|
||||
|
||||
|
@@ -357,11 +357,15 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
|
||||
ctx->cs_switch = 1;
|
||||
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
sconf->chan_pos[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
int idx;
|
||||
|
||||
idx = get_bits(&gb, chan_pos_bits);
|
||||
if (idx >= avctx->channels) {
|
||||
if (idx >= avctx->channels || sconf->chan_pos[idx] != -1) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
|
||||
ctx->cs_switch = 0;
|
||||
break;
|
||||
@@ -678,7 +682,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
|
||||
if (!sconf->rlslms) {
|
||||
if (sconf->adapt_order) {
|
||||
if (sconf->adapt_order && sconf->max_order) {
|
||||
int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,
|
||||
2, sconf->max_order + 1));
|
||||
*bd->opt_order = get_bits(gb, opt_order_length);
|
||||
@@ -1242,6 +1246,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
||||
ALSChannelData *ch = cd[c];
|
||||
unsigned int dep = 0;
|
||||
unsigned int channels = ctx->avctx->channels;
|
||||
unsigned int channel_size = ctx->sconf.frame_length + ctx->sconf.max_order;
|
||||
|
||||
if (reverted[c])
|
||||
return 0;
|
||||
@@ -1272,9 +1277,9 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
||||
bd->raw_samples = ctx->raw_samples[c] + offset;
|
||||
|
||||
for (dep = 0; !ch[dep].stop_flag; dep++) {
|
||||
unsigned int smp;
|
||||
unsigned int begin = 1;
|
||||
unsigned int end = bd->block_length - 1;
|
||||
ptrdiff_t smp;
|
||||
ptrdiff_t begin = 1;
|
||||
ptrdiff_t end = bd->block_length - 1;
|
||||
int64_t y;
|
||||
int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
|
||||
|
||||
@@ -1286,11 +1291,28 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
||||
|
||||
if (ch[dep].time_diff_sign) {
|
||||
t = -t;
|
||||
if (begin < t) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "begin %td smaller than time diff index %d.\n", begin, t);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
begin -= t;
|
||||
} else {
|
||||
if (end < t) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "end %td smaller than time diff index %d.\n", end, t);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
end -= t;
|
||||
}
|
||||
|
||||
if (FFMIN(begin - 1, begin - 1 + t) < ctx->raw_buffer - master ||
|
||||
FFMAX(end + 1, end + 1 + t) > ctx->raw_buffer + channels * channel_size - master) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n",
|
||||
master + FFMIN(begin - 1, begin - 1 + t), master + FFMAX(end + 1, end + 1 + t),
|
||||
ctx->raw_buffer, ctx->raw_buffer + channels * channel_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (smp = begin; smp < end; smp++) {
|
||||
y = (1 << 6) +
|
||||
MUL64(ch[dep].weighting[0], master[smp - 1 ]) +
|
||||
@@ -1303,6 +1325,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
||||
bd->raw_samples[smp] += y >> 7;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (begin - 1 < ctx->raw_buffer - master ||
|
||||
end + 1 > ctx->raw_buffer + channels * channel_size - master) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n",
|
||||
master + begin - 1, master + end + 1,
|
||||
ctx->raw_buffer, ctx->raw_buffer + channels * channel_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (smp = begin; smp < end; smp++) {
|
||||
y = (1 << 6) +
|
||||
MUL64(ch[dep].weighting[0], master[smp - 1]) +
|
||||
@@ -1665,6 +1697,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
avctx->sample_fmt = sconf->resolution > 1
|
||||
? AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S16;
|
||||
avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
|
||||
if (avctx->bits_per_raw_sample > 32) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Bits per raw sample %d larger than 32.\n",
|
||||
avctx->bits_per_raw_sample);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
// set maximum Rice parameter for progressive decoding based on resolution
|
||||
@@ -1727,9 +1765,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
// allocate and assign channel data buffer for mcc mode
|
||||
if (sconf->mc_coding) {
|
||||
ctx->chan_data_buffer = av_malloc(sizeof(*ctx->chan_data_buffer) *
|
||||
ctx->chan_data_buffer = av_mallocz(sizeof(*ctx->chan_data_buffer) *
|
||||
num_buffers * num_buffers);
|
||||
ctx->chan_data = av_malloc(sizeof(*ctx->chan_data) *
|
||||
ctx->chan_data = av_mallocz(sizeof(*ctx->chan_data) *
|
||||
num_buffers);
|
||||
ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
|
||||
num_buffers);
|
||||
|
@@ -601,14 +601,14 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
|
||||
int ksummax, ksummin;
|
||||
|
||||
rice->ksum = 0;
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (i = 0; i < FFMIN(blockstodecode, 5); i++) {
|
||||
out[i] = get_rice_ook(&ctx->gb, 10);
|
||||
rice->ksum += out[i];
|
||||
}
|
||||
rice->k = av_log2(rice->ksum / 10) + 1;
|
||||
if (rice->k >= 24)
|
||||
return;
|
||||
for (; i < 64; i++) {
|
||||
for (; i < FFMIN(blockstodecode, 64); i++) {
|
||||
out[i] = get_rice_ook(&ctx->gb, rice->k);
|
||||
rice->ksum += out[i];
|
||||
rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1;
|
||||
@@ -1476,13 +1476,13 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
nblocks);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->samples = nblocks;
|
||||
|
||||
/* Initialize the frame decoder */
|
||||
if (init_frame_decoder(s) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->samples = nblocks;
|
||||
}
|
||||
|
||||
if (!s->data) {
|
||||
|
@@ -599,8 +599,8 @@ void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist,
|
||||
const float *in, float *out)
|
||||
{
|
||||
int i, s, sb, t, pos_now, pos_next;
|
||||
DECLARE_ALIGNED(32, float, idct_in)[ATRAC3P_SUBBANDS];
|
||||
DECLARE_ALIGNED(32, float, idct_out)[ATRAC3P_SUBBANDS];
|
||||
LOCAL_ALIGNED(32, float, idct_in, [ATRAC3P_SUBBANDS]);
|
||||
LOCAL_ALIGNED(32, float, idct_out, [ATRAC3P_SUBBANDS]);
|
||||
|
||||
memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out));
|
||||
|
||||
|
@@ -69,6 +69,8 @@ void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
av_assert0(length <= put_bits_left(pb));
|
||||
|
||||
if (CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7) {
|
||||
for (i = 0; i < words; i++)
|
||||
put_bits(pb, 16, AV_RB16(src + 2 * i));
|
||||
|
@@ -563,6 +563,11 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
esc_code = get_ue_code(gb, esc_golomb_order);
|
||||
if (esc_code < 0 || esc_code > 32767) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "esc_code invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
|
||||
while (level > r->inc_limit)
|
||||
r++;
|
||||
|
@@ -583,6 +583,14 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel,
|
||||
}
|
||||
|
||||
nchans = get_bits(&s->gb, 3) + 1;
|
||||
if (xxch && nchans >= 3) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "nchans %d is too large\n", nchans);
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (nchans + base_channel > DCA_PRIM_CHANNELS_MAX) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "channel sum %d + %d is too large\n", nchans, base_channel);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->total_channels = nchans + base_channel;
|
||||
s->prim_channels = s->total_channels;
|
||||
|
||||
@@ -849,6 +857,10 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
||||
|
||||
if (!base_channel) {
|
||||
s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1;
|
||||
if (block_index + s->subsubframes[s->current_subframe] > s->sample_blocks/8) {
|
||||
s->subsubframes[s->current_subframe] = 1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3);
|
||||
}
|
||||
|
||||
@@ -1810,8 +1822,13 @@ static int dca_xbr_parse_frame(DCAContext *s)
|
||||
for(i = 0; i < num_chsets; i++) {
|
||||
n_xbr_ch[i] = get_bits(&s->gb, 3) + 1;
|
||||
k = get_bits(&s->gb, 2) + 5;
|
||||
for(j = 0; j < n_xbr_ch[i]; j++)
|
||||
for(j = 0; j < n_xbr_ch[i]; j++) {
|
||||
active_bands[i][j] = get_bits(&s->gb, k) + 1;
|
||||
if (active_bands[i][j] > DCA_SUBBANDS) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "too many active subbands (%d)\n", active_bands[i][j]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* skip to the end of the header */
|
||||
@@ -1853,23 +1870,34 @@ static int dca_xbr_parse_frame(DCAContext *s)
|
||||
for(i = 0; i < n_xbr_ch[chset]; i++) {
|
||||
const uint32_t *scale_table;
|
||||
int nbits;
|
||||
int scale_table_size;
|
||||
|
||||
if (s->scalefactor_huffman[chan_base+i] == 6) {
|
||||
scale_table = scale_factor_quant7;
|
||||
scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant7);
|
||||
} else {
|
||||
scale_table = scale_factor_quant6;
|
||||
scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant6);
|
||||
}
|
||||
|
||||
nbits = anctemp[i];
|
||||
|
||||
for(j = 0; j < active_bands[chset][i]; j++) {
|
||||
if(abits_high[i][j] > 0) {
|
||||
scale_table_high[i][j][0] =
|
||||
scale_table[get_bits(&s->gb, nbits)];
|
||||
int index = get_bits(&s->gb, nbits);
|
||||
if (index >= scale_table_size) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
scale_table_high[i][j][0] = scale_table[index];
|
||||
|
||||
if(xbr_tmode && s->transition_mode[i][j]) {
|
||||
scale_table_high[i][j][1] =
|
||||
scale_table[get_bits(&s->gb, nbits)];
|
||||
int index = get_bits(&s->gb, nbits);
|
||||
if (index >= scale_table_size) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
scale_table_high[i][j][1] = scale_table[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -799,7 +799,10 @@ static void decode_lowdelay(DiracContext *s)
|
||||
slice_num++;
|
||||
|
||||
buf += bytes;
|
||||
bufsize -= bytes*8;
|
||||
if (bufsize/8 >= bytes)
|
||||
bufsize -= bytes*8;
|
||||
else
|
||||
bufsize = 0;
|
||||
}
|
||||
|
||||
avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
|
||||
@@ -896,6 +899,14 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
||||
/*[DIRAC_STD] 11.2.4 motion_data_dimensions()
|
||||
Calculated in function dirac_unpack_block_motion_data */
|
||||
|
||||
if (s->plane[0].xblen % (1 << s->chroma_x_shift) != 0 ||
|
||||
s->plane[0].yblen % (1 << s->chroma_y_shift) != 0 ||
|
||||
!s->plane[0].xblen || !s->plane[0].yblen) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"invalid x/y block length (%d/%d) for x/y chroma shift (%d/%d)\n",
|
||||
s->plane[0].xblen, s->plane[0].yblen, s->chroma_x_shift, s->chroma_y_shift);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (!s->plane[0].xbsep || !s->plane[0].ybsep || s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n");
|
||||
return -1;
|
||||
@@ -1736,6 +1747,12 @@ static int dirac_decode_picture_header(DiracContext *s)
|
||||
get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!s->ref_pics[i]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Reference could not be allocated\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* retire the reference frames that are not used anymore */
|
||||
@@ -1931,8 +1948,8 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
break;
|
||||
|
||||
data_unit_size = AV_RB32(buf+buf_idx+5);
|
||||
if (buf_idx + data_unit_size > buf_size || !data_unit_size) {
|
||||
if(buf_idx + data_unit_size > buf_size)
|
||||
if (data_unit_size > buf_size - buf_idx || !data_unit_size) {
|
||||
if(data_unit_size > buf_size - buf_idx)
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Data unit with size %d is larger than input buffer, discarding\n",
|
||||
data_unit_size);
|
||||
|
@@ -546,6 +546,12 @@ static int read_extra_header(FFV1Context *f)
|
||||
f->num_h_slices = 1 + get_symbol(c, state, 0);
|
||||
f->num_v_slices = 1 + get_symbol(c, state, 0);
|
||||
|
||||
if (f->chroma_h_shift > 4U || f->chroma_v_shift > 4U) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
|
||||
f->chroma_h_shift, f->chroma_v_shift);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (f->num_h_slices > (unsigned)f->width || !f->num_h_slices ||
|
||||
f->num_v_slices > (unsigned)f->height || !f->num_v_slices
|
||||
) {
|
||||
@@ -651,6 +657,12 @@ static int read_header(FFV1Context *f)
|
||||
}
|
||||
}
|
||||
|
||||
if (chroma_h_shift > 4U || chroma_v_shift > 4U) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
|
||||
chroma_h_shift, chroma_v_shift);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
f->colorspace = colorspace;
|
||||
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
|
||||
f->chroma_planes = chroma_planes;
|
||||
|
@@ -346,8 +346,16 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
|
||||
|
||||
if (i < limit - 1) {
|
||||
if (k) {
|
||||
buf = SHOW_UBITS(re, gb, k);
|
||||
LAST_SKIP_BITS(re, gb, k);
|
||||
if (k > MIN_CACHE_BITS - 1) {
|
||||
buf = SHOW_UBITS(re, gb, 16) << (k-16);
|
||||
LAST_SKIP_BITS(re, gb, 16);
|
||||
UPDATE_CACHE(re, gb);
|
||||
buf |= SHOW_UBITS(re, gb, k-16);
|
||||
LAST_SKIP_BITS(re, gb, k-16);
|
||||
} else {
|
||||
buf = SHOW_UBITS(re, gb, k);
|
||||
LAST_SKIP_BITS(re, gb, k);
|
||||
}
|
||||
} else {
|
||||
buf = 0;
|
||||
}
|
||||
|
@@ -1516,9 +1516,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
|
||||
continue;
|
||||
|
||||
again:
|
||||
if ( (!(avctx->active_thread_type & FF_THREAD_FRAME) || nals_needed >= nal_index)
|
||||
&& !h->current_slice)
|
||||
h->au_pps_id = -1;
|
||||
/* Ignore per frame NAL unit type during extradata
|
||||
* parsing. Decoding slices is not possible in codec init
|
||||
* with frame-mt */
|
||||
@@ -1554,8 +1551,14 @@ again:
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
if(!idr_cleared)
|
||||
if(!idr_cleared) {
|
||||
if (h->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||
av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
idr(h); // FIXME ensure we don't lose some frames if there is reordering
|
||||
}
|
||||
idr_cleared = 1;
|
||||
h->has_recovery_point = 1;
|
||||
case NAL_SLICE:
|
||||
@@ -1564,6 +1567,10 @@ again:
|
||||
hx->inter_gb_ptr = &hx->gb;
|
||||
hx->data_partitioning = 0;
|
||||
|
||||
if ( nals_needed >= nal_index
|
||||
|| (!(avctx->active_thread_type & FF_THREAD_FRAME) && !context_count))
|
||||
h->au_pps_id = -1;
|
||||
|
||||
if ((err = ff_h264_decode_slice_header(hx, h)))
|
||||
break;
|
||||
|
||||
@@ -1685,7 +1692,9 @@ again:
|
||||
break;
|
||||
case NAL_SPS:
|
||||
init_get_bits(&h->gb, ptr, bit_length);
|
||||
if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? nalsize : 1)) {
|
||||
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
|
||||
break;
|
||||
if (h->is_avc ? nalsize : 1) {
|
||||
av_log(h->avctx, AV_LOG_DEBUG,
|
||||
"SPS decoding failure, trying again with the complete NAL\n");
|
||||
if (h->is_avc)
|
||||
@@ -1694,8 +1703,11 @@ again:
|
||||
break;
|
||||
init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
|
||||
8*(next_avc - buf_index + consumed - 1));
|
||||
ff_h264_decode_seq_parameter_set(h);
|
||||
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
|
||||
break;
|
||||
}
|
||||
init_get_bits(&h->gb, ptr, bit_length);
|
||||
ff_h264_decode_seq_parameter_set(h, 1);
|
||||
|
||||
break;
|
||||
case NAL_PPS:
|
||||
@@ -1728,8 +1740,14 @@ again:
|
||||
if (err < 0 || err == SLICE_SKIPED) {
|
||||
if (err < 0)
|
||||
av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
|
||||
h->ref_count[0] = h->ref_count[1] = h->list_count = 0;
|
||||
hx->ref_count[0] = hx->ref_count[1] = hx->list_count = 0;
|
||||
} else if (err == SLICE_SINGLETHREAD) {
|
||||
if (context_count > 1) {
|
||||
ret = ff_h264_execute_decode_slices(h, context_count - 1);
|
||||
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
|
||||
goto end;
|
||||
context_count = 0;
|
||||
}
|
||||
/* Slice could not be decoded in parallel mode, copy down
|
||||
* NAL unit stuff to context 0 and restart. Note that
|
||||
* rbsp_buffer is not transferred, but since we no longer
|
||||
|
@@ -539,6 +539,7 @@ typedef struct H264Context {
|
||||
int mb_x, mb_y;
|
||||
int resync_mb_x;
|
||||
int resync_mb_y;
|
||||
int mb_index_end;
|
||||
int mb_skip_run;
|
||||
int mb_height, mb_width;
|
||||
int mb_stride;
|
||||
@@ -778,7 +779,7 @@ int ff_h264_decode_sei(H264Context *h);
|
||||
/**
|
||||
* Decode SPS
|
||||
*/
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h);
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation);
|
||||
|
||||
/**
|
||||
* compute profile from sps
|
||||
|
@@ -271,7 +271,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
init_get_bits(&h->gb, ptr, 8 * dst_length);
|
||||
switch (h->nal_unit_type) {
|
||||
case NAL_SPS:
|
||||
ff_h264_decode_seq_parameter_set(h);
|
||||
ff_h264_decode_seq_parameter_set(h, 0);
|
||||
break;
|
||||
case NAL_PPS:
|
||||
ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits);
|
||||
|
@@ -261,12 +261,6 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
|
||||
}
|
||||
}
|
||||
|
||||
if (get_bits_left(&h->gb) < 0) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Overread VUI by %d bits\n", -get_bits_left(&h->gb));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -323,7 +317,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps,
|
||||
}
|
||||
}
|
||||
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h)
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation)
|
||||
{
|
||||
int profile_idc, level_idc, constraint_set_flags = 0;
|
||||
unsigned int sps_id;
|
||||
@@ -543,6 +537,13 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (get_bits_left(&h->gb) < 0) {
|
||||
av_log(h->avctx, ignore_truncation ? AV_LOG_WARNING : AV_LOG_ERROR,
|
||||
"Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(&h->gb));
|
||||
if (!ignore_truncation)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!sps->sar.den)
|
||||
sps->sar.den = 1;
|
||||
|
||||
|
@@ -707,7 +707,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
|
||||
*/
|
||||
if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) {
|
||||
/* Just mark the second field valid */
|
||||
h->cur_pic_ptr->reference = PICT_FRAME;
|
||||
h->cur_pic_ptr->reference |= h->picture_structure;
|
||||
} else if (h->cur_pic_ptr->long_ref) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference "
|
||||
"assignment for second field "
|
||||
|
@@ -1310,6 +1310,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
int field_pic_flag, bottom_field_flag;
|
||||
int first_slice = h == h0 && !h0->current_slice;
|
||||
int frame_num, picture_structure, droppable;
|
||||
int mb_aff_frame, last_mb_aff_frame;
|
||||
PPS *pps;
|
||||
|
||||
h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
|
||||
@@ -1437,7 +1438,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|| h->mb_width != h->sps.mb_width
|
||||
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
|
||||
));
|
||||
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
|
||||
if (h0->avctx->pix_fmt == AV_PIX_FMT_NONE
|
||||
|| (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0))))
|
||||
must_reinit = 1;
|
||||
|
||||
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
|
||||
@@ -1473,6 +1475,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|
||||
if (h->context_initialized &&
|
||||
(must_reinit || needs_reinit)) {
|
||||
h->context_initialized = 0;
|
||||
if (h != h0) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"changing width %d -> %d / height %d -> %d on "
|
||||
@@ -1533,7 +1536,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
}
|
||||
|
||||
h->mb_mbaff = 0;
|
||||
h->mb_aff_frame = 0;
|
||||
mb_aff_frame = 0;
|
||||
last_mb_aff_frame = h0->mb_aff_frame;
|
||||
last_pic_structure = h0->picture_structure;
|
||||
last_pic_droppable = h0->droppable;
|
||||
droppable = h->nal_ref_idc == 0;
|
||||
@@ -1551,12 +1555,13 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
picture_structure = PICT_TOP_FIELD + bottom_field_flag;
|
||||
} else {
|
||||
picture_structure = PICT_FRAME;
|
||||
h->mb_aff_frame = h->sps.mb_aff;
|
||||
mb_aff_frame = h->sps.mb_aff;
|
||||
}
|
||||
}
|
||||
if (h0->current_slice) {
|
||||
if (last_pic_structure != picture_structure ||
|
||||
last_pic_droppable != droppable) {
|
||||
last_pic_droppable != droppable ||
|
||||
last_mb_aff_frame != mb_aff_frame) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Changing field mode (%d -> %d) between slices is not allowed\n",
|
||||
last_pic_structure, h->picture_structure);
|
||||
@@ -1572,6 +1577,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h->picture_structure = picture_structure;
|
||||
h->droppable = droppable;
|
||||
h->frame_num = frame_num;
|
||||
h->mb_aff_frame = mb_aff_frame;
|
||||
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
|
||||
|
||||
if (h0->current_slice == 0) {
|
||||
@@ -2447,8 +2453,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
||||
|
||||
for (;;) {
|
||||
// START_TIMER
|
||||
int ret = ff_h264_decode_mb_cabac(h);
|
||||
int eos;
|
||||
int ret, eos;
|
||||
|
||||
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
|
||||
h->mb_index_end);
|
||||
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
|
||||
h->mb_y, ER_MB_ERROR);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ret = ff_h264_decode_mb_cabac(h);
|
||||
// STOP_TIMER("decode_mb_cabac")
|
||||
|
||||
if (ret >= 0)
|
||||
@@ -2510,7 +2525,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
int ret = ff_h264_decode_mb_cavlc(h);
|
||||
int ret;
|
||||
|
||||
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
|
||||
h->mb_index_end);
|
||||
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
|
||||
h->mb_y, ER_MB_ERROR);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ret = ff_h264_decode_mb_cavlc(h);
|
||||
|
||||
if (ret >= 0)
|
||||
ff_h264_hl_decode_mb(h);
|
||||
@@ -2598,19 +2623,33 @@ int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)
|
||||
|
||||
av_assert0(h->mb_y < h->mb_height);
|
||||
|
||||
h->mb_index_end = INT_MAX;
|
||||
|
||||
if (h->avctx->hwaccel ||
|
||||
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
|
||||
return 0;
|
||||
if (context_count == 1) {
|
||||
return decode_slice(avctx, &h);
|
||||
} else {
|
||||
int j, mb_index;
|
||||
av_assert0(context_count > 0);
|
||||
for (i = 1; i < context_count; i++) {
|
||||
for (i = 0; i < context_count; i++) {
|
||||
int mb_index_end = h->mb_width * h->mb_height;
|
||||
hx = h->thread_context[i];
|
||||
if (CONFIG_ERROR_RESILIENCE) {
|
||||
mb_index = hx->resync_mb_x + hx->resync_mb_y * h->mb_width;
|
||||
if (CONFIG_ERROR_RESILIENCE && i) {
|
||||
hx->er.error_count = 0;
|
||||
}
|
||||
hx->x264_build = h->x264_build;
|
||||
for (j = 0; j < context_count; j++) {
|
||||
H264Context *sl2 = h->thread_context[j];
|
||||
int mb_index2 = sl2->resync_mb_x + sl2->resync_mb_y * h->mb_width;
|
||||
|
||||
if (i==j || mb_index > mb_index2)
|
||||
continue;
|
||||
mb_index_end = FFMIN(mb_index_end, mb_index2);
|
||||
}
|
||||
hx->mb_index_end = mb_index_end;
|
||||
}
|
||||
|
||||
avctx->execute(avctx, decode_slice, h->thread_context,
|
||||
|
@@ -674,11 +674,25 @@ static int hls_slice_header(HEVCContext *s)
|
||||
|
||||
sh->num_entry_point_offsets = 0;
|
||||
if (s->pps->tiles_enabled_flag || s->pps->entropy_coding_sync_enabled_flag) {
|
||||
sh->num_entry_point_offsets = get_ue_golomb_long(gb);
|
||||
unsigned num_entry_point_offsets = get_ue_golomb_long(gb);
|
||||
// It would be possible to bound this tighter but this here is simpler
|
||||
if (num_entry_point_offsets > get_bits_left(gb)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "num_entry_point_offsets %d is invalid\n", num_entry_point_offsets);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
sh->num_entry_point_offsets = num_entry_point_offsets;
|
||||
if (sh->num_entry_point_offsets > 0) {
|
||||
int offset_len = get_ue_golomb_long(gb) + 1;
|
||||
int segments = offset_len >> 4;
|
||||
int rest = (offset_len & 15);
|
||||
|
||||
if (offset_len < 1 || offset_len > 32) {
|
||||
sh->num_entry_point_offsets = 0;
|
||||
av_log(s->avctx, AV_LOG_ERROR, "offset_len %d is invalid\n", offset_len);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_freep(&sh->entry_point_offset);
|
||||
av_freep(&sh->offset);
|
||||
av_freep(&sh->size);
|
||||
@@ -2947,7 +2961,6 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
|
||||
|
||||
/* parse the NAL units */
|
||||
for (i = 0; i < s->nb_nals; i++) {
|
||||
int ret;
|
||||
s->skipped_bytes = s->skipped_bytes_nal[i];
|
||||
s->skipped_bytes_pos = s->skipped_bytes_pos_nal[i];
|
||||
|
||||
|
@@ -424,7 +424,8 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
|
||||
vps->vps_max_layer_id = get_bits(gb, 6);
|
||||
vps->vps_num_layer_sets = get_ue_golomb_long(gb) + 1;
|
||||
if ((vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) {
|
||||
if (vps->vps_num_layer_sets < 1 || vps->vps_num_layer_sets > 1024 ||
|
||||
(vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n");
|
||||
goto err;
|
||||
}
|
||||
@@ -441,6 +442,11 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
if (vps->vps_poc_proportional_to_timing_flag)
|
||||
vps->vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1;
|
||||
vps->vps_num_hrd_parameters = get_ue_golomb_long(gb);
|
||||
if (vps->vps_num_hrd_parameters > (unsigned)vps->vps_num_layer_sets) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"vps_num_hrd_parameters %d is invalid\n", vps->vps_num_hrd_parameters);
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < vps->vps_num_hrd_parameters; i++) {
|
||||
int common_inf_present = 1;
|
||||
|
||||
@@ -1309,14 +1315,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
if (pps->tiles_enabled_flag) {
|
||||
pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
|
||||
pps->num_tile_rows = get_ue_golomb_long(gb) + 1;
|
||||
if (pps->num_tile_columns == 0 ||
|
||||
if (pps->num_tile_columns <= 0 ||
|
||||
pps->num_tile_columns >= sps->width) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
|
||||
pps->num_tile_columns - 1);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
if (pps->num_tile_rows == 0 ||
|
||||
if (pps->num_tile_rows <= 0 ||
|
||||
pps->num_tile_rows >= sps->height) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
|
||||
pps->num_tile_rows - 1);
|
||||
|
@@ -126,6 +126,11 @@ static int active_parameter_sets(HEVCContext *s)
|
||||
get_bits(gb, 1); // num_sps_ids_minus1
|
||||
num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1
|
||||
|
||||
if (num_sps_ids_minus1 < 0 || num_sps_ids_minus1 > 15) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "num_sps_ids_minus1 %d invalid\n", num_sps_ids_minus1);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
active_seq_parameter_set_id = get_ue_golomb_long(gb);
|
||||
if (active_seq_parameter_set_id >= MAX_SPS_COUNT) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "active_parameter_set_id %d invalid\n", active_seq_parameter_set_id);
|
||||
|
@@ -1606,7 +1606,7 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
|
||||
int cn = bytestream2_get_be16(&s->g);
|
||||
int av_unused typ = bytestream2_get_be16(&s->g);
|
||||
int asoc = bytestream2_get_be16(&s->g);
|
||||
if (cn < 4 || asoc < 4)
|
||||
if (cn < 4 && asoc < 4)
|
||||
s->cdef[cn] = asoc;
|
||||
}
|
||||
}
|
||||
|
@@ -164,6 +164,9 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
|
||||
|
||||
img = opj_image_create(numcomps, cmptparm, color_space);
|
||||
|
||||
if (!img)
|
||||
return NULL;
|
||||
|
||||
// x0, y0 is the top left corner of the image
|
||||
// x1, y1 is the width, height of the reference grid
|
||||
img->x0 = 0;
|
||||
|
@@ -108,6 +108,8 @@ static int get_stats(AVCodecContext *avctx, int eos)
|
||||
// libtheora generates a summary header at the end
|
||||
memcpy(h->stats, buf, bytes);
|
||||
avctx->stats_out = av_malloc(b64_size);
|
||||
if (!avctx->stats_out)
|
||||
return AVERROR(ENOMEM);
|
||||
av_base64_encode(avctx->stats_out, b64_size, h->stats, h->stats_offset);
|
||||
}
|
||||
return 0;
|
||||
|
@@ -376,7 +376,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
|
||||
if (enccfg.g_pass == VPX_RC_FIRST_PASS)
|
||||
enccfg.g_lag_in_frames = 0;
|
||||
else if (enccfg.g_pass == VPX_RC_LAST_PASS) {
|
||||
int decode_size;
|
||||
int decode_size, ret;
|
||||
|
||||
if (!avctx->stats_in) {
|
||||
av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n");
|
||||
@@ -384,12 +384,12 @@ static av_cold int vpx_init(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
ctx->twopass_stats.sz = strlen(avctx->stats_in) * 3 / 4;
|
||||
ctx->twopass_stats.buf = av_malloc(ctx->twopass_stats.sz);
|
||||
if (!ctx->twopass_stats.buf) {
|
||||
ret = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n",
|
||||
ctx->twopass_stats.sz);
|
||||
return AVERROR(ENOMEM);
|
||||
return ret;
|
||||
}
|
||||
decode_size = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in,
|
||||
ctx->twopass_stats.sz);
|
||||
|
@@ -182,7 +182,7 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
|
||||
s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "qscale[%d]: %d\n",
|
||||
index, s->qscale[index]);
|
||||
len -= 65;
|
||||
len -= 1 + 64 * (1+pr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -121,7 +121,10 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
|
||||
put_marker(p, APP0);
|
||||
put_bits(p, 16, 16);
|
||||
avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
|
||||
put_bits(p, 16, 0x0102); /* v 1.02 */
|
||||
/* The most significant byte is used for major revisions, the least
|
||||
* significant byte for minor revisions. Version 1.02 is the current
|
||||
* released revision. */
|
||||
put_bits(p, 16, 0x0102);
|
||||
put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
|
||||
put_bits(p, 16, avctx->sample_aspect_ratio.num);
|
||||
put_bits(p, 16, avctx->sample_aspect_ratio.den);
|
||||
|
@@ -101,7 +101,7 @@ enum AudioObjectType {
|
||||
AOT_USAC, ///< N Unified Speech and Audio Coding
|
||||
};
|
||||
|
||||
#define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE
|
||||
#define MAX_PCE_SIZE 320 ///<Maximum size of a PCE including the 3-bit ID_PCE
|
||||
///<marker and the comment
|
||||
|
||||
int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb);
|
||||
|
@@ -189,14 +189,14 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int x = 0, y = 0;
|
||||
|
||||
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
|
||||
if (length)
|
||||
if (length > 0)
|
||||
x = get_xbits(gb, length);
|
||||
|
||||
if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
|
||||
skip_bits1(gb); /* marker bit */
|
||||
|
||||
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
|
||||
if (length)
|
||||
if (length > 0)
|
||||
y = get_xbits(gb, length);
|
||||
|
||||
skip_bits1(gb); /* marker bit */
|
||||
|
@@ -3684,6 +3684,8 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
||||
}
|
||||
s->avctx->execute(s->avctx, encode_thread, &s->thread_context[0], NULL, context_count, sizeof(void*));
|
||||
for(i=1; i<context_count; i++){
|
||||
if (s->pb.buf_end == s->thread_context[i]->pb.buf)
|
||||
set_put_bits_buffer_size(&s->pb, FFMIN(s->thread_context[i]->pb.buf_end - s->pb.buf, INT_MAX/8-32));
|
||||
merge_context_after_encode(s, s->thread_context[i]);
|
||||
}
|
||||
emms_c();
|
||||
|
@@ -36,7 +36,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
||||
unsigned char rle_code;
|
||||
unsigned char extra_byte, odd_pixel;
|
||||
unsigned char stream_byte;
|
||||
unsigned int pixel_ptr = 0;
|
||||
int pixel_ptr = 0;
|
||||
int line = avctx->height - 1;
|
||||
int i;
|
||||
|
||||
|
@@ -119,12 +119,12 @@ static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)
|
||||
run_len = 1;
|
||||
do {
|
||||
run = get_bits(gb, bits_per_sect);
|
||||
if (run > num_bands - band - run_len) {
|
||||
av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
run_len += run;
|
||||
} while (run == esc_val);
|
||||
if (band + run_len > num_bands) {
|
||||
av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (i = band; i < band + run_len; i++) {
|
||||
c->band_type[i] = band_type;
|
||||
c->band_run_end[i] = band + run_len;
|
||||
|
@@ -918,6 +918,7 @@ static av_cold int png_dec_init(AVCodecContext *avctx)
|
||||
{
|
||||
PNGDecContext *s = avctx->priv_data;
|
||||
|
||||
avctx->color_range = AVCOL_RANGE_JPEG;
|
||||
s->avctx = avctx;
|
||||
s->last_picture.f = av_frame_alloc();
|
||||
s->picture.f = av_frame_alloc();
|
||||
|
@@ -183,6 +183,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
|
||||
|
||||
if (ctx->slice_count != slice_count || !ctx->slices) {
|
||||
av_freep(&ctx->slices);
|
||||
ctx->slice_count = 0;
|
||||
ctx->slices = av_mallocz_array(slice_count, sizeof(*ctx->slices));
|
||||
if (!ctx->slices)
|
||||
return AVERROR(ENOMEM);
|
||||
|
@@ -212,6 +212,7 @@ static inline void skip_put_bytes(PutBitContext *s, int n)
|
||||
{
|
||||
av_assert2((put_bits_count(s) & 7) == 0);
|
||||
av_assert2(s->bit_left == 32);
|
||||
av_assert0(n <= s->buf_end - s->buf_ptr);
|
||||
s->buf_ptr += n;
|
||||
}
|
||||
|
||||
@@ -235,6 +236,7 @@ static inline void skip_put_bits(PutBitContext *s, int n)
|
||||
static inline void set_put_bits_buffer_size(PutBitContext *s, int size)
|
||||
{
|
||||
s->buf_end = s->buf + size;
|
||||
s->size_in_bits = 8*size;
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_PUT_BITS_H */
|
||||
|
@@ -129,8 +129,7 @@ static int allocate_buffers(ShortenContext *s)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) ||
|
||||
s->blocksize + s->nwrap <= (unsigned)s->nwrap) {
|
||||
if (s->blocksize + (uint64_t)s->nwrap >= UINT_MAX / sizeof(int32_t)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"s->blocksize + s->nwrap too large\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -278,7 +277,7 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
|
||||
if (command == FN_QLPC) {
|
||||
/* read/validate prediction order */
|
||||
pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
|
||||
if (pred_order > s->nwrap) {
|
||||
if ((unsigned)pred_order > s->nwrap) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n",
|
||||
pred_order);
|
||||
return AVERROR(EINVAL);
|
||||
@@ -370,6 +369,11 @@ static int read_header(ShortenContext *s)
|
||||
s->nmean = get_uint(s, 0);
|
||||
|
||||
skip_bytes = get_uint(s, NSKIPSIZE);
|
||||
if ((unsigned)skip_bytes > get_bits_left(&s->gb)/8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid skip_bytes: %d\n", skip_bytes);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i = 0; i < skip_bytes; i++)
|
||||
skip_bits(&s->gb, 8);
|
||||
}
|
||||
|
@@ -137,6 +137,10 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
|
||||
if (!cur_frame) {
|
||||
av_frame_unref(mjpeg_data);
|
||||
ret = avcodec_decode_video2(s->avctx, mjpeg_data, &s->mjpeg_data_size, avpkt);
|
||||
if (ret < 0) {
|
||||
s->mjpeg_data_size = 0;
|
||||
return ret;
|
||||
}
|
||||
} else if (!s->mjpeg_data_size)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
|
@@ -497,12 +497,15 @@ static int predictor_calc_error(int *k, int *state, int order, int error)
|
||||
// copes better with quantization, and calculates the
|
||||
// actual whitened result as it goes.
|
||||
|
||||
static void modified_levinson_durbin(int *window, int window_entries,
|
||||
static int modified_levinson_durbin(int *window, int window_entries,
|
||||
int *out, int out_entries, int channels, int *tap_quant)
|
||||
{
|
||||
int i;
|
||||
int *state = av_calloc(window_entries, sizeof(*state));
|
||||
|
||||
if (!state)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
memcpy(state, window, 4* window_entries);
|
||||
|
||||
for (i = 0; i < out_entries; i++)
|
||||
@@ -567,6 +570,7 @@ static void modified_levinson_durbin(int *window, int window_entries,
|
||||
}
|
||||
|
||||
av_free(state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int code_samplerate(int samplerate)
|
||||
@@ -627,6 +631,9 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
|
||||
|
||||
// generate taps
|
||||
s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
|
||||
if (!s->tap_quant)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (i = 0; i < s->num_taps; i++)
|
||||
s->tap_quant[i] = ff_sqrt(i+1);
|
||||
|
||||
@@ -656,7 +663,7 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
|
||||
|
||||
s->window_size = ((2*s->tail_size)+s->frame_size);
|
||||
s->window = av_calloc(s->window_size, sizeof(*s->window));
|
||||
if (!s->window)
|
||||
if (!s->window || !s->int_samples)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
avctx->extradata = av_mallocz(16);
|
||||
@@ -769,8 +776,11 @@ static int sonic_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
s->tail[i] = s->int_samples[s->frame_size - s->tail_size + i];
|
||||
|
||||
// generate taps
|
||||
modified_levinson_durbin(s->window, s->window_size,
|
||||
ret = modified_levinson_durbin(s->window, s->window_size,
|
||||
s->predictor_k, s->num_taps, s->channels, s->tap_quant);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = intlist_write(&c, state, s->predictor_k, s->num_taps, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -873,13 +883,19 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
||||
|
||||
if (s->version >= 1)
|
||||
{
|
||||
int sample_rate_index;
|
||||
s->channels = get_bits(&gb, 2);
|
||||
s->samplerate = samplerate_table[get_bits(&gb, 4)];
|
||||
sample_rate_index = get_bits(&gb, 4);
|
||||
if (sample_rate_index >= FF_ARRAY_ELEMS(samplerate_table)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid sample_rate_index %d\n", sample_rate_index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->samplerate = samplerate_table[sample_rate_index];
|
||||
av_log(avctx, AV_LOG_INFO, "Sonicv2 chans: %d samprate: %d\n",
|
||||
s->channels, s->samplerate);
|
||||
}
|
||||
|
||||
if (s->channels > MAX_CHANNELS)
|
||||
if (s->channels > MAX_CHANNELS || s->channels < 1)
|
||||
{
|
||||
av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -913,6 +929,9 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
||||
|
||||
// generate taps
|
||||
s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
|
||||
if (!s->tap_quant)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (i = 0; i < s->num_taps; i++)
|
||||
s->tap_quant[i] = ff_sqrt(i+1);
|
||||
|
||||
@@ -932,6 +951,8 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
s->int_samples = av_calloc(s->frame_size, sizeof(*s->int_samples));
|
||||
if (!s->int_samples)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
return 0;
|
||||
|
@@ -231,6 +231,12 @@ static int decode_format80(VqaContext *s, int src_size,
|
||||
unsigned char color;
|
||||
int i;
|
||||
|
||||
if (src_size < 0 || src_size > bytestream2_get_bytes_left(&s->gb)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Chunk size %d is out of range\n",
|
||||
src_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
start = bytestream2_tell(&s->gb);
|
||||
while (bytestream2_tell(&s->gb) - start < src_size) {
|
||||
opcode = bytestream2_get_byte(&s->gb);
|
||||
|
@@ -472,6 +472,14 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
s->decorr[i].samplesB[0] = L;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == AV_SAMPLE_FMT_S16P) {
|
||||
if (FFABS(L) + FFABS(R) > (1<<19)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
pos = (pos + 1) & 7;
|
||||
if (s->joint)
|
||||
L += (R -= (L >> 1));
|
||||
|
@@ -142,9 +142,7 @@ static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
|
||||
DECLARE_ALIGNED(8, int16_t, b2)[64];
|
||||
|
||||
for(i=0; i<2; i++){
|
||||
DECLARE_ALIGNED(8, uint64_t, tmp);
|
||||
|
||||
cavs_idct8_1d(block+4*i, ff_pw_4.a);
|
||||
cavs_idct8_1d(block + 4 * i, ff_pw_4.a);
|
||||
|
||||
__asm__ volatile(
|
||||
"psraw $3, %%mm7 \n\t"
|
||||
@@ -155,20 +153,20 @@ static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
|
||||
"psraw $3, %%mm2 \n\t"
|
||||
"psraw $3, %%mm1 \n\t"
|
||||
"psraw $3, %%mm0 \n\t"
|
||||
"movq %%mm7, %0 \n\t"
|
||||
"movq %%mm7, (%0) \n\t"
|
||||
TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
|
||||
"movq %%mm0, 8(%1) \n\t"
|
||||
"movq %%mm6, 24(%1) \n\t"
|
||||
"movq %%mm7, 40(%1) \n\t"
|
||||
"movq %%mm4, 56(%1) \n\t"
|
||||
"movq %0, %%mm7 \n\t"
|
||||
"movq %%mm0, 8(%0) \n\t"
|
||||
"movq %%mm6, 24(%0) \n\t"
|
||||
"movq %%mm7, 40(%0) \n\t"
|
||||
"movq %%mm4, 56(%0) \n\t"
|
||||
"movq (%0), %%mm7 \n\t"
|
||||
TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
|
||||
"movq %%mm7, (%1) \n\t"
|
||||
"movq %%mm1, 16(%1) \n\t"
|
||||
"movq %%mm0, 32(%1) \n\t"
|
||||
"movq %%mm3, 48(%1) \n\t"
|
||||
: "=m"(tmp)
|
||||
: "r"(b2+32*i)
|
||||
"movq %%mm7, (%0) \n\t"
|
||||
"movq %%mm1, 16(%0) \n\t"
|
||||
"movq %%mm0, 32(%0) \n\t"
|
||||
"movq %%mm3, 48(%0) \n\t"
|
||||
:
|
||||
: "r"(b2 + 32 * i)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#define AVCODEC_X86_MATHOPS_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/x86/asm.h"
|
||||
|
||||
@@ -100,6 +101,7 @@ __asm__ volatile(\
|
||||
: "r" (y), "r" (b), "r" (d)\
|
||||
);
|
||||
#endif /* HAVE_6REGS */
|
||||
|
||||
#endif /* HAVE_I686 */
|
||||
|
||||
#define MASK_ABS(mask, level) \
|
||||
|
@@ -138,7 +138,9 @@ static int config_props(AVFilterLink *inlink)
|
||||
s->hsub = pixdesc->log2_chroma_w;
|
||||
s->vsub = pixdesc->log2_chroma_h;
|
||||
|
||||
s->bpp = av_get_bits_per_pixel(pixdesc) >> 3;
|
||||
s->bpp = pixdesc->flags & AV_PIX_FMT_FLAG_PLANAR ?
|
||||
1 :
|
||||
av_get_bits_per_pixel(pixdesc) >> 3;
|
||||
s->alpha &= !!(pixdesc->flags & AV_PIX_FMT_FLAG_ALPHA);
|
||||
s->is_packed_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0;
|
||||
|
||||
|
@@ -685,6 +685,23 @@ static int avi_read_header(AVFormatContext *s)
|
||||
default:
|
||||
av_log(s, AV_LOG_INFO, "unknown stream type %X\n", tag1);
|
||||
}
|
||||
|
||||
if (ast->sample_size < 0) {
|
||||
if (s->error_recognition & AV_EF_EXPLODE) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
"Invalid sample_size %d at stream %d\n",
|
||||
ast->sample_size,
|
||||
stream_index);
|
||||
goto fail;
|
||||
}
|
||||
av_log(s, AV_LOG_WARNING,
|
||||
"Invalid sample_size %d at stream %d "
|
||||
"setting it to 0\n",
|
||||
ast->sample_size,
|
||||
stream_index);
|
||||
ast->sample_size = 0;
|
||||
}
|
||||
|
||||
if (ast->sample_size == 0) {
|
||||
st->duration = st->nb_frames;
|
||||
if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) {
|
||||
|
@@ -194,7 +194,10 @@ static int read_header(AVFormatContext *s)
|
||||
return ret;
|
||||
}
|
||||
|
||||
avio_seek(pb, vst->index_entries[0].pos, SEEK_SET);
|
||||
if (vst->index_entries)
|
||||
avio_seek(pb, vst->index_entries[0].pos, SEEK_SET);
|
||||
else
|
||||
avio_skip(pb, 4);
|
||||
|
||||
bink->current_track = -1;
|
||||
return 0;
|
||||
|
@@ -50,12 +50,14 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m,
|
||||
int last_block, int bitexact)
|
||||
{
|
||||
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
|
||||
unsigned int len;
|
||||
int64_t len;
|
||||
uint8_t *p, *p0;
|
||||
|
||||
ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
|
||||
|
||||
len = ff_vorbiscomment_length(*m, vendor);
|
||||
if (len >= ((1<<24) - 4))
|
||||
return AVERROR(EINVAL);
|
||||
p0 = av_malloc(len+4);
|
||||
if (!p0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
@@ -189,7 +189,7 @@ static void skip_sub_layer_hrd_parameters(GetBitContext *gb,
|
||||
}
|
||||
}
|
||||
|
||||
static void skip_hrd_parameters(GetBitContext *gb, uint8_t cprms_present_flag,
|
||||
static int skip_hrd_parameters(GetBitContext *gb, uint8_t cprms_present_flag,
|
||||
unsigned int max_sub_layers_minus1)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -246,8 +246,11 @@ static void skip_hrd_parameters(GetBitContext *gb, uint8_t cprms_present_flag,
|
||||
else
|
||||
low_delay_hrd_flag = get_bits1(gb);
|
||||
|
||||
if (!low_delay_hrd_flag)
|
||||
if (!low_delay_hrd_flag) {
|
||||
cpb_cnt_minus1 = get_ue_golomb_long(gb);
|
||||
if (cpb_cnt_minus1 > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (nal_hrd_parameters_present_flag)
|
||||
skip_sub_layer_hrd_parameters(gb, cpb_cnt_minus1,
|
||||
@@ -257,6 +260,8 @@ static void skip_hrd_parameters(GetBitContext *gb, uint8_t cprms_present_flag,
|
||||
skip_sub_layer_hrd_parameters(gb, cpb_cnt_minus1,
|
||||
sub_pic_hrd_params_present_flag);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void skip_timing_info(GetBitContext *gb)
|
||||
@@ -457,6 +462,9 @@ static int parse_rps(GetBitContext *gb, unsigned int rps_idx,
|
||||
unsigned int num_negative_pics = get_ue_golomb_long(gb);
|
||||
unsigned int num_positive_pics = get_ue_golomb_long(gb);
|
||||
|
||||
if ((num_positive_pics + (uint64_t)num_negative_pics) * 2 > get_bits_left(gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
num_delta_pocs[rps_idx] = num_negative_pics + num_positive_pics;
|
||||
|
||||
for (i = 0; i < num_negative_pics; i++) {
|
||||
|
@@ -339,7 +339,10 @@ int ff_img_read_header(AVFormatContext *s1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
|
||||
if (s1->flags & AVFMT_FLAG_CUSTOM_IO) {
|
||||
avio_seek(s1->pb, 0, SEEK_SET);
|
||||
} else
|
||||
ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
|
||||
}
|
||||
if (st->codec->codec_id == AV_CODEC_ID_NONE)
|
||||
st->codec->codec_id = ff_guess_image2_codec(s->path);
|
||||
|
@@ -1216,15 +1216,13 @@ static int matroska_decode_buffer(uint8_t **buf, int *buf_size,
|
||||
newpktdata = av_realloc(pkt_data, pkt_size);
|
||||
if (!newpktdata) {
|
||||
inflateEnd(&zstream);
|
||||
result = AVERROR(ENOMEM);
|
||||
goto failed;
|
||||
}
|
||||
pkt_data = newpktdata;
|
||||
zstream.avail_out = pkt_size - zstream.total_out;
|
||||
zstream.next_out = pkt_data + zstream.total_out;
|
||||
if (pkt_data) {
|
||||
result = inflate(&zstream, Z_NO_FLUSH);
|
||||
} else
|
||||
result = Z_MEM_ERROR;
|
||||
result = inflate(&zstream, Z_NO_FLUSH);
|
||||
} while (result == Z_OK && pkt_size < 10000000);
|
||||
pkt_size = zstream.total_out;
|
||||
inflateEnd(&zstream);
|
||||
@@ -1251,15 +1249,13 @@ static int matroska_decode_buffer(uint8_t **buf, int *buf_size,
|
||||
newpktdata = av_realloc(pkt_data, pkt_size);
|
||||
if (!newpktdata) {
|
||||
BZ2_bzDecompressEnd(&bzstream);
|
||||
result = AVERROR(ENOMEM);
|
||||
goto failed;
|
||||
}
|
||||
pkt_data = newpktdata;
|
||||
bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
|
||||
bzstream.next_out = pkt_data + bzstream.total_out_lo32;
|
||||
if (pkt_data) {
|
||||
result = BZ2_bzDecompress(&bzstream);
|
||||
} else
|
||||
result = BZ_MEM_ERROR;
|
||||
result = BZ2_bzDecompress(&bzstream);
|
||||
} while (result == BZ_OK && pkt_size < 10000000);
|
||||
pkt_size = bzstream.total_out_lo32;
|
||||
BZ2_bzDecompressEnd(&bzstream);
|
||||
@@ -1445,7 +1441,7 @@ static void matroska_add_index_entries(MatroskaDemuxContext *matroska)
|
||||
{
|
||||
EbmlList *index_list;
|
||||
MatroskaIndex *index;
|
||||
int index_scale = 1;
|
||||
uint64_t index_scale = 1;
|
||||
int i, j;
|
||||
|
||||
index_list = &matroska->index;
|
||||
@@ -1946,8 +1942,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
||||
snprintf(buf, sizeof(buf), "%s_%d",
|
||||
ff_matroska_video_stereo_plane[planes[j].type], i);
|
||||
for (k=0; k < matroska->tracks.nb_elem; k++)
|
||||
if (planes[j].uid == tracks[k].uid) {
|
||||
av_dict_set(&s->streams[k]->metadata,
|
||||
if (planes[j].uid == tracks[k].uid && tracks[k].stream) {
|
||||
av_dict_set(&tracks[k].stream->metadata,
|
||||
"stereo_mode", buf, 0);
|
||||
break;
|
||||
}
|
||||
@@ -2013,12 +2009,15 @@ static int matroska_read_header(AVFormatContext *s)
|
||||
matroska->ctx = s;
|
||||
|
||||
/* First read the EBML header. */
|
||||
if (ebml_parse(matroska, ebml_syntax, &ebml) ||
|
||||
ebml.version > EBML_VERSION ||
|
||||
if (ebml_parse(matroska, ebml_syntax, &ebml) || !ebml.doctype) {
|
||||
av_log(matroska->ctx, AV_LOG_ERROR, "EBML header parsing failed\n");
|
||||
ebml_free(ebml_syntax, &ebml);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (ebml.version > EBML_VERSION ||
|
||||
ebml.max_size > sizeof(uint64_t) ||
|
||||
ebml.id_length > sizeof(uint32_t) ||
|
||||
ebml.doctype_version > 3 ||
|
||||
!ebml.doctype) {
|
||||
ebml.doctype_version > 3) {
|
||||
av_log(matroska->ctx, AV_LOG_ERROR,
|
||||
"EBML header using unsupported features\n"
|
||||
"(EBML version %"PRIu64", doctype %s, doc version %"PRIu64")\n",
|
||||
|
@@ -543,12 +543,15 @@ static int put_flac_codecpriv(AVFormatContext *s,
|
||||
"Lavf" : LIBAVFORMAT_IDENT;
|
||||
AVDictionary *dict = NULL;
|
||||
uint8_t buf[32], *data, *p;
|
||||
int len;
|
||||
int64_t len;
|
||||
|
||||
snprintf(buf, sizeof(buf), "0x%"PRIx64, codec->channel_layout);
|
||||
av_dict_set(&dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
|
||||
|
||||
len = ff_vorbiscomment_length(dict, vendor);
|
||||
if (len >= ((1<<24) - 4))
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
data = av_malloc(len + 4);
|
||||
if (!data) {
|
||||
av_dict_free(&dict);
|
||||
|
@@ -230,8 +230,10 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
|
||||
double longitude, latitude;
|
||||
const char *key = "location";
|
||||
|
||||
if (len < 4 + 2 + 1 + 1 + 4 + 4 + 4)
|
||||
if (len < 4 + 2 + 1 + 1 + 4 + 4 + 4) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "loci too short\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
avio_skip(pb, 4); // version+flags
|
||||
langcode = avio_rb16(pb);
|
||||
@@ -239,13 +241,17 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
|
||||
len -= 6;
|
||||
|
||||
len -= avio_get_str(pb, len, buf, sizeof(buf)); // place name
|
||||
if (len < 1)
|
||||
if (len < 1) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "place name too long\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avio_skip(pb, 1); // role
|
||||
len -= 1;
|
||||
|
||||
if (len < 14)
|
||||
if (len < 12) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "no space for coordinates left (%d)\n", len);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
longitude = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
|
||||
latitude = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
|
||||
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "id3v1.h"
|
||||
#include "replaygain.h"
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavcodec/mpegaudiodecheader.h"
|
||||
|
||||
#define XING_FLAG_FRAMES 0x01
|
||||
@@ -61,7 +62,10 @@ static int mp3_read_probe(AVProbeData *p)
|
||||
int fsize, frames, sample_rate;
|
||||
uint32_t header;
|
||||
const uint8_t *buf, *buf0, *buf2, *end;
|
||||
AVCodecContext avctx;
|
||||
AVCodecContext *avctx = avcodec_alloc_context3(NULL);
|
||||
|
||||
if (!avctx)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
buf0 = p->buf;
|
||||
end = p->buf + p->buf_size - sizeof(uint32_t);
|
||||
@@ -78,7 +82,8 @@ static int mp3_read_probe(AVProbeData *p)
|
||||
|
||||
for(frames = 0; buf2 < end; frames++) {
|
||||
header = AV_RB32(buf2);
|
||||
fsize = avpriv_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate);
|
||||
fsize = avpriv_mpa_decode_header(avctx, header,
|
||||
&sample_rate, &sample_rate, &sample_rate, &sample_rate);
|
||||
if(fsize < 0)
|
||||
break;
|
||||
buf2 += fsize;
|
||||
@@ -87,6 +92,7 @@ static int mp3_read_probe(AVProbeData *p)
|
||||
if(buf == buf0)
|
||||
first_frames= frames;
|
||||
}
|
||||
avcodec_free_context(&avctx);
|
||||
// keep this in sync with ac3 probe, both need to avoid
|
||||
// issues with MPEG-files!
|
||||
if (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1;
|
||||
|
@@ -75,6 +75,9 @@ typedef void SetServiceCallback (void *opaque, int ret);
|
||||
typedef struct MpegTSSectionFilter {
|
||||
int section_index;
|
||||
int section_h_size;
|
||||
int last_ver;
|
||||
unsigned crc;
|
||||
unsigned last_crc;
|
||||
uint8_t *section_buf;
|
||||
unsigned int check_crc : 1;
|
||||
unsigned int end_of_section_reached : 1;
|
||||
@@ -408,6 +411,9 @@ static void write_section_data(MpegTSContext *ts, MpegTSFilter *tss1,
|
||||
|
||||
if (tss->check_crc) {
|
||||
crc_valid = !av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1, tss->section_buf, tss->section_h_size);
|
||||
if (tss->section_h_size >= 4)
|
||||
tss->crc = AV_RB32(tss->section_buf + tss->section_h_size - 4);
|
||||
|
||||
if (crc_valid) {
|
||||
ts->crc_validity[ tss1->pid ] = 100;
|
||||
}else if (ts->crc_validity[ tss1->pid ] > -10) {
|
||||
@@ -415,8 +421,11 @@ static void write_section_data(MpegTSContext *ts, MpegTSFilter *tss1,
|
||||
}else
|
||||
crc_valid = 2;
|
||||
}
|
||||
if (crc_valid)
|
||||
if (crc_valid) {
|
||||
tss->section_cb(tss1, tss->section_buf, tss->section_h_size);
|
||||
if (crc_valid != 1)
|
||||
tss->last_ver = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,6 +468,8 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts,
|
||||
sec->opaque = opaque;
|
||||
sec->section_buf = av_malloc(MAX_SECTION_SIZE);
|
||||
sec->check_crc = check_crc;
|
||||
sec->last_ver = -1;
|
||||
|
||||
if (!sec->section_buf) {
|
||||
av_free(filter);
|
||||
return NULL;
|
||||
@@ -565,6 +576,17 @@ typedef struct SectionHeader {
|
||||
uint8_t last_sec_num;
|
||||
} SectionHeader;
|
||||
|
||||
static int skip_identical(const SectionHeader *h, MpegTSSectionFilter *tssf)
|
||||
{
|
||||
if (h->version == tssf->last_ver && tssf->last_crc == tssf->crc)
|
||||
return 1;
|
||||
|
||||
tssf->last_ver = h->version;
|
||||
tssf->last_crc = tssf->crc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int get8(const uint8_t **pp, const uint8_t *p_end)
|
||||
{
|
||||
const uint8_t *p;
|
||||
@@ -1437,6 +1459,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
|
||||
int section_len)
|
||||
{
|
||||
MpegTSContext *ts = filter->u.section_filter.opaque;
|
||||
MpegTSSectionFilter *tssf = &filter->u.section_filter;
|
||||
SectionHeader h;
|
||||
const uint8_t *p, *p_end;
|
||||
AVIOContext pb;
|
||||
@@ -1451,6 +1474,8 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
|
||||
return;
|
||||
if (h.tid != M4OD_TID)
|
||||
return;
|
||||
if (skip_identical(&h, tssf))
|
||||
return;
|
||||
|
||||
mp4_read_od(s, p, (unsigned) (p_end - p), mp4_descr, &mp4_descr_count,
|
||||
MAX_MP4_DESCR_COUNT);
|
||||
@@ -1548,7 +1573,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
|
||||
case 0x1F: /* FMC descriptor */
|
||||
get16(pp, desc_end);
|
||||
if (mp4_descr_count > 0 &&
|
||||
(st->codec->codec_id == AV_CODEC_ID_AAC_LATM || st->request_probe > 0) &&
|
||||
(st->codec->codec_id == AV_CODEC_ID_AAC_LATM ||
|
||||
(st->request_probe == 0 && st->codec->codec_id == AV_CODEC_ID_NONE) ||
|
||||
st->request_probe > 0) &&
|
||||
mp4_descr->dec_config_descr_len && mp4_descr->es_id == pid) {
|
||||
AVIOContext pb;
|
||||
ffio_init_context(&pb, mp4_descr->dec_config_descr,
|
||||
@@ -1720,6 +1747,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
|
||||
static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
|
||||
{
|
||||
MpegTSContext *ts = filter->u.section_filter.opaque;
|
||||
MpegTSSectionFilter *tssf = &filter->u.section_filter;
|
||||
SectionHeader h1, *h = &h1;
|
||||
PESContext *pes;
|
||||
AVStream *st;
|
||||
@@ -1739,6 +1767,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
p = section;
|
||||
if (parse_section_header(h, &p, p_end) < 0)
|
||||
return;
|
||||
if (skip_identical(h, tssf))
|
||||
return;
|
||||
|
||||
av_dlog(ts->stream, "sid=0x%x sec_num=%d/%d\n",
|
||||
h->id, h->sec_num, h->last_sec_num);
|
||||
@@ -1886,6 +1916,7 @@ out:
|
||||
static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
|
||||
{
|
||||
MpegTSContext *ts = filter->u.section_filter.opaque;
|
||||
MpegTSSectionFilter *tssf = &filter->u.section_filter;
|
||||
SectionHeader h1, *h = &h1;
|
||||
const uint8_t *p, *p_end;
|
||||
int sid, pmt_pid;
|
||||
@@ -1903,6 +1934,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
if (ts->skip_changes)
|
||||
return;
|
||||
|
||||
if (skip_identical(h, tssf))
|
||||
return;
|
||||
ts->stream->ts_id = h->id;
|
||||
|
||||
clear_programs(ts);
|
||||
@@ -1956,6 +1989,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
|
||||
{
|
||||
MpegTSContext *ts = filter->u.section_filter.opaque;
|
||||
MpegTSSectionFilter *tssf = &filter->u.section_filter;
|
||||
SectionHeader h1, *h = &h1;
|
||||
const uint8_t *p, *p_end, *desc_list_end, *desc_end;
|
||||
int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;
|
||||
@@ -1972,6 +2006,9 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
return;
|
||||
if (ts->skip_changes)
|
||||
return;
|
||||
if (skip_identical(h, tssf))
|
||||
return;
|
||||
|
||||
onid = get16(&p, p_end);
|
||||
if (onid < 0)
|
||||
return;
|
||||
@@ -2273,6 +2310,8 @@ static int handle_packets(MpegTSContext *ts, int64_t nb_packets)
|
||||
av_buffer_unref(&pes->buffer);
|
||||
pes->data_index = 0;
|
||||
pes->state = MPEGTS_SKIP; /* skip until pes header */
|
||||
} else if (ts->pids[i]->type == MPEGTS_SECTION) {
|
||||
ts->pids[i]->u.section_filter.last_ver = -1;
|
||||
}
|
||||
ts->pids[i]->last_cc = -1;
|
||||
ts->pids[i]->last_pcr = -1;
|
||||
|
@@ -102,6 +102,7 @@ typedef struct NUTContext {
|
||||
unsigned int max_distance;
|
||||
unsigned int time_base_count;
|
||||
int64_t last_syncpoint_pos;
|
||||
int64_t last_resync_pos;
|
||||
int header_count;
|
||||
AVRational *time_base;
|
||||
struct AVTreeNode *syncpoints;
|
||||
|
@@ -47,11 +47,15 @@ static int get_str(AVIOContext *bc, char *string, unsigned int maxlen)
|
||||
while (len > maxlen) {
|
||||
avio_r8(bc);
|
||||
len--;
|
||||
if (bc->eof_reached)
|
||||
len = maxlen;
|
||||
}
|
||||
|
||||
if (maxlen)
|
||||
string[FFMIN(len, maxlen - 1)] = 0;
|
||||
|
||||
if (bc->eof_reached)
|
||||
return AVERROR_EOF;
|
||||
if (maxlen == len)
|
||||
return -1;
|
||||
else
|
||||
@@ -211,8 +215,11 @@ static int skip_reserved(AVIOContext *bc, int64_t pos)
|
||||
avio_seek(bc, pos, SEEK_CUR);
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else {
|
||||
while (pos--)
|
||||
while (pos--) {
|
||||
if (bc->eof_reached)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_r8(bc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -291,10 +298,15 @@ static int decode_main_header(NUTContext *nut)
|
||||
if (tmp_fields > 7)
|
||||
tmp_head_idx = ffio_read_varlen(bc);
|
||||
|
||||
while (tmp_fields-- > 8)
|
||||
while (tmp_fields-- > 8) {
|
||||
if (bc->eof_reached) {
|
||||
av_log(s, AV_LOG_ERROR, "reached EOF while decoding main header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ffio_read_varlen(bc);
|
||||
}
|
||||
|
||||
if (count == 0 || i + count > 256) {
|
||||
if (count <= 0 || count > 256 - (i <= 'N') - i) {
|
||||
av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -480,7 +492,7 @@ static int decode_info_header(NUTContext *nut)
|
||||
AVIOContext *bc = s->pb;
|
||||
uint64_t tmp, chapter_start, chapter_len;
|
||||
unsigned int stream_id_plus1, count;
|
||||
int chapter_id, i;
|
||||
int chapter_id, i, ret;
|
||||
int64_t value, end;
|
||||
char name[256], str_value[1024], type_str[256];
|
||||
const char *type;
|
||||
@@ -505,6 +517,10 @@ static int decode_info_header(NUTContext *nut)
|
||||
nut->time_base[chapter_start %
|
||||
nut->time_base_count],
|
||||
start, start + chapter_len, NULL);
|
||||
if (!chapter) {
|
||||
av_log(s, AV_LOG_ERROR, "Could not create chapter.\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
metadata = &chapter->metadata;
|
||||
} else if (stream_id_plus1) {
|
||||
st = s->streams[stream_id_plus1 - 1];
|
||||
@@ -518,8 +534,14 @@ static int decode_info_header(NUTContext *nut)
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
get_str(bc, name, sizeof(name));
|
||||
ret = get_str(bc, name, sizeof(name));
|
||||
if (ret < 0) {
|
||||
av_log(s, AV_LOG_ERROR, "get_str failed while decoding info header\n");
|
||||
return ret;
|
||||
}
|
||||
value = get_s(bc);
|
||||
str_value[0] = 0;
|
||||
|
||||
if (value == -1) {
|
||||
type = "UTF-8";
|
||||
get_str(bc, str_value, sizeof(str_value));
|
||||
@@ -553,7 +575,8 @@ static int decode_info_header(NUTContext *nut)
|
||||
|
||||
if (stream_id_plus1 && !strcmp(name, "r_frame_rate")) {
|
||||
sscanf(str_value, "%d/%d", &st->r_frame_rate.num, &st->r_frame_rate.den);
|
||||
if (st->r_frame_rate.num >= 1000LL*st->r_frame_rate.den)
|
||||
if (st->r_frame_rate.num >= 1000LL*st->r_frame_rate.den ||
|
||||
st->r_frame_rate.num < 0 || st->r_frame_rate.num < 0)
|
||||
st->r_frame_rate.num = st->r_frame_rate.den = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -697,6 +720,10 @@ static int find_and_decode_index(NUTContext *nut)
|
||||
has_keyframe[n++] = flag;
|
||||
has_keyframe[n++] = !flag;
|
||||
} else {
|
||||
if (x <= 1) {
|
||||
av_log(s, AV_LOG_ERROR, "index: x %"PRIu64" is invalid\n", x);
|
||||
goto fail;
|
||||
}
|
||||
while (x != 1) {
|
||||
if (n >= syncpoint_count + 1) {
|
||||
av_log(s, AV_LOG_ERROR, "index overflow B\n");
|
||||
@@ -740,12 +767,26 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int nut_read_close(AVFormatContext *s)
|
||||
{
|
||||
NUTContext *nut = s->priv_data;
|
||||
int i;
|
||||
|
||||
av_freep(&nut->time_base);
|
||||
av_freep(&nut->stream);
|
||||
ff_nut_free_sp(nut);
|
||||
for (i = 1; i < nut->header_count; i++)
|
||||
av_freep(&nut->header[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nut_read_header(AVFormatContext *s)
|
||||
{
|
||||
NUTContext *nut = s->priv_data;
|
||||
AVIOContext *bc = s->pb;
|
||||
int64_t pos;
|
||||
int initialized_stream_count;
|
||||
int initialized_stream_count, ret = 0;
|
||||
|
||||
nut->avf = s;
|
||||
|
||||
@@ -755,7 +796,7 @@ static int nut_read_header(AVFormatContext *s)
|
||||
pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
|
||||
if (pos < 0 + 1) {
|
||||
av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
} while (decode_main_header(nut) < 0);
|
||||
|
||||
@@ -765,7 +806,7 @@ static int nut_read_header(AVFormatContext *s)
|
||||
pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1;
|
||||
if (pos < 0 + 1) {
|
||||
av_log(s, AV_LOG_ERROR, "Not all stream headers found.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
if (decode_stream_header(nut) >= 0)
|
||||
initialized_stream_count++;
|
||||
@@ -779,7 +820,7 @@ static int nut_read_header(AVFormatContext *s)
|
||||
|
||||
if (startcode == 0) {
|
||||
av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
} else if (startcode == SYNCPOINT_STARTCODE) {
|
||||
nut->next_startcode = startcode;
|
||||
break;
|
||||
@@ -801,7 +842,14 @@ static int nut_read_header(AVFormatContext *s)
|
||||
|
||||
ff_metadata_conv_ctx(s, NULL, ff_nut_metadata_conv);
|
||||
|
||||
return 0;
|
||||
end:
|
||||
if (ret < 0)
|
||||
nut_read_close(s);
|
||||
return FFMIN(ret, 0);
|
||||
fail:
|
||||
nut_read_close(s);
|
||||
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos)
|
||||
@@ -814,14 +862,18 @@ static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
|
||||
int sample_rate = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int i;
|
||||
int i, ret;
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
uint8_t name[256], str_value[256], type_str[256];
|
||||
int value;
|
||||
if (avio_tell(bc) >= maxpos)
|
||||
return AVERROR_INVALIDDATA;
|
||||
get_str(bc, name, sizeof(name));
|
||||
ret = get_str(bc, name, sizeof(name));
|
||||
if (ret < 0) {
|
||||
av_log(s, AV_LOG_ERROR, "get_str failed while reading sm data\n");
|
||||
return ret;
|
||||
}
|
||||
value = get_s(bc);
|
||||
|
||||
if (value == -1) {
|
||||
@@ -964,8 +1016,13 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id,
|
||||
*header_idx = ffio_read_varlen(bc);
|
||||
if (flags & FLAG_RESERVED)
|
||||
reserved_count = ffio_read_varlen(bc);
|
||||
for (i = 0; i < reserved_count; i++)
|
||||
for (i = 0; i < reserved_count; i++) {
|
||||
if (bc->eof_reached) {
|
||||
av_log(s, AV_LOG_ERROR, "reached EOF while decoding frame header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ffio_read_varlen(bc);
|
||||
}
|
||||
|
||||
if (*header_idx >= (unsigned)nut->header_count) {
|
||||
av_log(s, AV_LOG_ERROR, "header_idx invalid\n");
|
||||
@@ -1098,7 +1155,8 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
default:
|
||||
resync:
|
||||
av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", pos);
|
||||
tmp = find_any_startcode(bc, nut->last_syncpoint_pos + 1);
|
||||
tmp = find_any_startcode(bc, FFMAX(nut->last_syncpoint_pos, nut->last_resync_pos) + 1);
|
||||
nut->last_resync_pos = avio_tell(bc);
|
||||
if (tmp == 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(s, AV_LOG_DEBUG, "sync\n");
|
||||
@@ -1192,25 +1250,14 @@ static int read_seek(AVFormatContext *s, int stream_index,
|
||||
av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
|
||||
pos = find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
|
||||
avio_seek(s->pb, pos, SEEK_SET);
|
||||
nut->last_syncpoint_pos = pos;
|
||||
av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
|
||||
if (pos2 > pos || pos2 + 15 < pos)
|
||||
av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
|
||||
for (i = 0; i < s->nb_streams; i++)
|
||||
nut->stream[i].skip_until_key_frame = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nut_read_close(AVFormatContext *s)
|
||||
{
|
||||
NUTContext *nut = s->priv_data;
|
||||
int i;
|
||||
|
||||
av_freep(&nut->time_base);
|
||||
av_freep(&nut->stream);
|
||||
ff_nut_free_sp(nut);
|
||||
for (i = 1; i < nut->header_count; i++)
|
||||
av_freep(&nut->header[i]);
|
||||
nut->last_resync_pos = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -279,16 +279,18 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,
|
||||
static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact,
|
||||
int *header_len, AVDictionary **m, int framing_bit)
|
||||
{
|
||||
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
|
||||
int size;
|
||||
int64_t size;
|
||||
uint8_t *p, *p0;
|
||||
|
||||
ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
|
||||
|
||||
size = offset + ff_vorbiscomment_length(*m, vendor) + framing_bit;
|
||||
if (size > INT_MAX)
|
||||
return NULL;
|
||||
p = av_mallocz(size);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
@@ -112,7 +112,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||
return data->split_pkts > 0;
|
||||
}
|
||||
|
||||
if (len < 6) {
|
||||
if (len < 6 || len > INT_MAX/2) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Invalid %d byte packet\n", len);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@@ -40,8 +40,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
|
||||
s->timestamp = s->cur_timestamp;
|
||||
|
||||
/* convert video pixel dimensions from pixels to blocks */
|
||||
w = s1->streams[0]->codec->width >> 3;
|
||||
h = s1->streams[0]->codec->height >> 3;
|
||||
w = (s1->streams[0]->codec->width + 7) >> 3;
|
||||
h = (s1->streams[0]->codec->height + 7) >> 3;
|
||||
|
||||
/* get the pixel format type or fail */
|
||||
if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P ||
|
||||
@@ -84,6 +84,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
|
||||
} else if (buf[i + 1] == SOS) {
|
||||
/* SOS is last marker in the header */
|
||||
i += AV_RB16(&buf[i + 2]) + 2;
|
||||
if (i > size) {
|
||||
av_log(s1, AV_LOG_ERROR,
|
||||
"Insufficient data. Aborted!\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -931,6 +931,8 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
|
||||
p++;
|
||||
|
||||
reply->nb_transports++;
|
||||
if (reply->nb_transports >= RTSP_MAX_TRANSPORTS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -106,7 +106,7 @@ int ff_text_peek_r8(FFTextReader *r)
|
||||
}
|
||||
|
||||
AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
|
||||
const uint8_t *event, int len, int merge)
|
||||
const uint8_t *event, size_t len, int merge)
|
||||
{
|
||||
AVPacket *subs, *sub;
|
||||
|
||||
@@ -300,7 +300,7 @@ int ff_smil_extract_next_text_chunk(FFTextReader *tr, AVBPrint *buf, char *c)
|
||||
const char *ff_smil_get_attr_ptr(const char *s, const char *attr)
|
||||
{
|
||||
int in_quotes = 0;
|
||||
const int len = strlen(attr);
|
||||
const size_t len = strlen(attr);
|
||||
|
||||
while (*s) {
|
||||
while (*s) {
|
||||
|
@@ -114,7 +114,7 @@ typedef struct {
|
||||
* previous one instead of adding a new entry, 0 otherwise
|
||||
*/
|
||||
AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
|
||||
const uint8_t *event, int len, int merge);
|
||||
const uint8_t *event, size_t len, int merge);
|
||||
|
||||
/**
|
||||
* Set missing durations and sort subtitles by PTS, and then byte position.
|
||||
|
@@ -68,7 +68,7 @@ int ff_url_join(char *str, int size, const char *proto,
|
||||
av_strlcatf(str, size, ":%d", port);
|
||||
if (fmt) {
|
||||
va_list vl;
|
||||
int len = strlen(str);
|
||||
size_t len = strlen(str);
|
||||
|
||||
va_start(vl, fmt);
|
||||
vsnprintf(str + len, size > len ? size - len : 0, fmt, vl);
|
||||
|
@@ -399,6 +399,9 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
|
||||
if (options)
|
||||
av_dict_copy(&tmp, *options, 0);
|
||||
|
||||
if (s->pb) // must be before any goto fail
|
||||
s->flags |= AVFMT_FLAG_CUSTOM_IO;
|
||||
|
||||
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -1541,6 +1544,9 @@ int av_find_default_stream_index(AVFormatContext *s)
|
||||
score += 50;
|
||||
}
|
||||
|
||||
if (st->discard != AVDISCARD_ALL)
|
||||
score += 200;
|
||||
|
||||
if (score > best_score) {
|
||||
best_score = score;
|
||||
best_stream = i;
|
||||
@@ -4060,6 +4066,7 @@ int avformat_network_deinit(void)
|
||||
#if CONFIG_NETWORK
|
||||
ff_network_close();
|
||||
ff_tls_deinit();
|
||||
ff_network_inited_globally = 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@@ -61,8 +61,10 @@ int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m,
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
bytestream_put_le32(p, count);
|
||||
while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
||||
unsigned int len1 = strlen(tag->key);
|
||||
unsigned int len2 = strlen(tag->value);
|
||||
int64_t len1 = strlen(tag->key);
|
||||
int64_t len2 = strlen(tag->value);
|
||||
if (len1+1+len2 > UINT32_MAX)
|
||||
return AVERROR(EINVAL);
|
||||
bytestream_put_le32(p, len1+1+len2);
|
||||
bytestream_put_buffer(p, tag->key, len1);
|
||||
bytestream_put_byte(p, '=');
|
||||
|
@@ -114,7 +114,7 @@ static void handle_stream_probing(AVStream *st)
|
||||
{
|
||||
if (st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) {
|
||||
st->request_probe = AVPROBE_SCORE_EXTENSION;
|
||||
st->probe_packets = FFMIN(st->probe_packets, 14);
|
||||
st->probe_packets = FFMIN(st->probe_packets, 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -432,7 +432,9 @@ int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src)
|
||||
int bps = av_get_bytes_per_sample(c->avr->internal_sample_fmt);
|
||||
int i;
|
||||
|
||||
ret = ff_audio_data_realloc(c->buffer, in_samples + c->padding_size);
|
||||
ret = ff_audio_data_realloc(c->buffer,
|
||||
FFMAX(in_samples, in_leftover) +
|
||||
c->padding_size);
|
||||
if (ret < 0) {
|
||||
av_log(c->avr, AV_LOG_ERROR, "Error reallocating resampling buffer\n");
|
||||
return AVERROR(ENOMEM);
|
||||
|
@@ -100,7 +100,7 @@ size_t av_strlcat(char *dst, const char *src, size_t size)
|
||||
|
||||
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
|
||||
{
|
||||
int len = strlen(dst);
|
||||
size_t len = strlen(dst);
|
||||
va_list vl;
|
||||
|
||||
va_start(vl, fmt);
|
||||
|
@@ -102,7 +102,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value,
|
||||
if (flags & AV_DICT_DONT_STRDUP_VAL) {
|
||||
m->elems[m->count].value = (char*)(intptr_t)value;
|
||||
} else if (oldval && flags & AV_DICT_APPEND) {
|
||||
int len = strlen(oldval) + strlen(value) + 1;
|
||||
size_t len = strlen(oldval) + strlen(value) + 1;
|
||||
char *newval = av_mallocz(len);
|
||||
if (!newval)
|
||||
goto err_out;
|
||||
|
@@ -259,7 +259,7 @@ char *av_strdup(const char *s)
|
||||
{
|
||||
char *ptr = NULL;
|
||||
if (s) {
|
||||
int len = strlen(s) + 1;
|
||||
size_t len = strlen(s) + 1;
|
||||
ptr = av_realloc(NULL, len);
|
||||
if (ptr)
|
||||
memcpy(ptr, s, len);
|
||||
|
@@ -41,12 +41,20 @@ PCA *ff_pca_init(int n){
|
||||
return NULL;
|
||||
|
||||
pca= av_mallocz(sizeof(*pca));
|
||||
if (!pca)
|
||||
return NULL;
|
||||
|
||||
pca->n= n;
|
||||
pca->z = av_malloc_array(n, sizeof(*pca->z));
|
||||
pca->count=0;
|
||||
pca->covariance= av_calloc(n*n, sizeof(double));
|
||||
pca->mean= av_calloc(n, sizeof(double));
|
||||
|
||||
if (!pca->z || !pca->covariance || !pca->mean) {
|
||||
ff_pca_free(pca);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pca;
|
||||
}
|
||||
|
||||
|
@@ -35,12 +35,12 @@
|
||||
#define PARAM AV_OPT_FLAG_AUDIO_PARAM
|
||||
|
||||
static const AVOption options[]={
|
||||
{"ich" , "set input channel count" , OFFSET( in.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"in_channel_count" , "set input channel count" , OFFSET( in.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"och" , "set output channel count" , OFFSET(out.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"out_channel_count" , "set output channel count" , OFFSET(out.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"uch" , "set used channel count" , OFFSET(used_ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"used_channel_count" , "set used channel count" , OFFSET(used_ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"ich" , "set input channel count" , OFFSET(user_in_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"in_channel_count" , "set input channel count" , OFFSET(user_in_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"och" , "set output channel count" , OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"out_channel_count" , "set output channel count" , OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"uch" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"used_channel_count" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"isr" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
|
||||
{"in_sample_rate" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
|
||||
{"osr" , "set output sample rate" , OFFSET(out_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
|
||||
@@ -51,10 +51,10 @@ static const AVOption options[]={
|
||||
{"out_sample_fmt" , "set output sample format" , OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"tsf" , "set internal sample format" , OFFSET(int_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"internal_sample_fmt" , "set internal sample format" , OFFSET(int_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"icl" , "set input channel layout" , OFFSET( in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"in_channel_layout" , "set input channel layout" , OFFSET( in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"ocl" , "set output channel layout" , OFFSET(out_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"out_channel_layout" , "set output channel layout" , OFFSET(out_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"icl" , "set input channel layout" , OFFSET(user_in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"in_channel_layout" , "set input channel layout" , OFFSET(user_in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"ocl" , "set output channel layout" , OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"out_channel_layout" , "set output channel layout" , OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"clev" , "set center mix level" , OFFSET(clev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
|
||||
{"center_mix_level" , "set center mix level" , OFFSET(clev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
|
||||
{"slev" , "set surround mix level" , OFFSET(slev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
|
||||
|
@@ -65,8 +65,8 @@ int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
|
||||
if (!s || s->in_convert) // s needs to be allocated but not initialized
|
||||
return AVERROR(EINVAL);
|
||||
memset(s->matrix, 0, sizeof(s->matrix));
|
||||
nb_in = av_get_channel_layout_nb_channels(s->in_ch_layout);
|
||||
nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout);
|
||||
nb_in = av_get_channel_layout_nb_channels(s->user_in_ch_layout);
|
||||
nb_out = av_get_channel_layout_nb_channels(s->user_out_ch_layout);
|
||||
for (out = 0; out < nb_out; out++) {
|
||||
for (in = 0; in < nb_in; in++)
|
||||
s->matrix[out][in] = matrix[in];
|
||||
|
@@ -314,6 +314,11 @@ int main(int argc, char **argv){
|
||||
fprintf(stderr, "Failed to init backw_ctx\n");
|
||||
return 1;
|
||||
}
|
||||
if (uint_rand(rand_seed) % 3 == 0)
|
||||
av_opt_set_int(forw_ctx, "ich", 0, 0);
|
||||
if (uint_rand(rand_seed) % 3 == 0)
|
||||
av_opt_set_int(forw_ctx, "och", 0, 0);
|
||||
|
||||
if(swr_init( forw_ctx) < 0)
|
||||
fprintf(stderr, "swr_init(->) failed\n");
|
||||
if(swr_init(backw_ctx) < 0)
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "audioconvert.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/internal.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
@@ -86,10 +87,10 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
|
||||
if (av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> in_ch_layout), 0) < 0)
|
||||
if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> user_in_ch_layout), 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->out_ch_layout), 0) < 0)
|
||||
if (av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->user_out_ch_layout), 0) < 0)
|
||||
goto fail;
|
||||
|
||||
av_opt_set_int(s, "uch", 0, 0);
|
||||
@@ -152,6 +153,7 @@ av_cold void swr_close(SwrContext *s){
|
||||
|
||||
av_cold int swr_init(struct SwrContext *s){
|
||||
int ret;
|
||||
char l1[1024], l2[1024];
|
||||
|
||||
clear_context(s);
|
||||
|
||||
@@ -164,6 +166,13 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->out.ch_count = s-> user_out_ch_count;
|
||||
s-> in.ch_count = s-> user_in_ch_count;
|
||||
s->used_ch_count = s->user_used_ch_count;
|
||||
|
||||
s-> in_ch_layout = s-> user_in_ch_layout;
|
||||
s->out_ch_layout = s->user_out_ch_layout;
|
||||
|
||||
if(av_get_channel_layout_nb_channels(s-> in_ch_layout) > SWR_CH_MAX) {
|
||||
av_log(s, AV_LOG_WARNING, "Input channel layout 0x%"PRIx64" is invalid or unsupported.\n", s-> in_ch_layout);
|
||||
s->in_ch_layout = 0;
|
||||
@@ -246,6 +255,10 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
|
||||
if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){
|
||||
s->resample = s->resampler->init(s->resample, s->out_sample_rate, s->in_sample_rate, s->filter_size, s->phase_shift, s->linear_interp, s->cutoff, s->int_sample_fmt, s->filter_type, s->kaiser_beta, s->precision, s->cheby);
|
||||
if (!s->resample) {
|
||||
av_log(s, AV_LOG_ERROR, "Failed to initilaize resampler\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}else
|
||||
s->resampler->free(&s->resample);
|
||||
if( s->int_sample_fmt != AV_SAMPLE_FMT_S16P
|
||||
@@ -271,10 +284,18 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
return -1;
|
||||
}
|
||||
|
||||
av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout);
|
||||
av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout);
|
||||
if (s->out_ch_layout && s->out.ch_count != av_get_channel_layout_nb_channels(s->out_ch_layout)) {
|
||||
av_log(s, AV_LOG_ERROR, "Output channel layout %s mismatches specified channel count %d\n", l2, s->out.ch_count);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (s->in_ch_layout && s->used_ch_count != av_get_channel_layout_nb_channels(s->in_ch_layout)) {
|
||||
av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified channel count %d\n", l1, s->used_ch_count);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if ((!s->out_ch_layout || !s->in_ch_layout) && s->used_ch_count != s->out.ch_count && !s->rematrix_custom) {
|
||||
char l1[1024], l2[1024];
|
||||
av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout);
|
||||
av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout);
|
||||
av_log(s, AV_LOG_ERROR, "Rematrix is needed between %s and %s "
|
||||
"but there is not enough information to do it\n", l1, l2);
|
||||
return -1;
|
||||
@@ -642,8 +663,8 @@ int swr_is_initialized(struct SwrContext *s) {
|
||||
return !!s->in_buffer.ch_count;
|
||||
}
|
||||
|
||||
int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count,
|
||||
const uint8_t *in_arg [SWR_CH_MAX], int in_count){
|
||||
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count,
|
||||
const uint8_t *in_arg [SWR_CH_MAX], int in_count){
|
||||
AudioData * in= &s->in;
|
||||
AudioData *out= &s->out;
|
||||
|
||||
|
@@ -90,6 +90,12 @@ struct SwrContext {
|
||||
int used_ch_count; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
|
||||
enum SwrEngine engine;
|
||||
|
||||
int user_in_ch_count; ///< User set input channel count
|
||||
int user_out_ch_count; ///< User set output channel count
|
||||
int user_used_ch_count; ///< User set used channel count
|
||||
int64_t user_in_ch_layout; ///< User set input channel layout
|
||||
int64_t user_out_ch_layout; ///< User set output channel layout
|
||||
|
||||
struct DitherContext dither;
|
||||
|
||||
int filter_size; /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */
|
||||
|
@@ -277,7 +277,7 @@ void ff_hyscale_fast_mmxext(SwsContext *c, int16_t *dst,
|
||||
,"m"(retsave)
|
||||
#endif
|
||||
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
|
||||
#if !defined(PIC)
|
||||
#if ARCH_X86_64 || !defined(PIC)
|
||||
,"%"REG_b
|
||||
#endif
|
||||
);
|
||||
@@ -361,7 +361,7 @@ void ff_hcscale_fast_mmxext(SwsContext *c, int16_t *dst1, int16_t *dst2,
|
||||
,"m"(retsave)
|
||||
#endif
|
||||
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
|
||||
#if !defined(PIC)
|
||||
#if ARCH_X86_64 || !defined(PIC)
|
||||
,"%"REG_b
|
||||
#endif
|
||||
);
|
||||
|
@@ -38,11 +38,11 @@ target_path(){
|
||||
# $1=value1, $2=value2, $3=threshold
|
||||
# prints 0 if absolute difference between value1 and value2 is <= threshold
|
||||
compare(){
|
||||
echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
|
||||
awk "BEGIN { v = $1 - $2; printf ((v < 0 ? -v : v) > $3) }"
|
||||
}
|
||||
|
||||
do_tiny_psnr(){
|
||||
psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0)
|
||||
psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
|
||||
val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
|
||||
size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
|
||||
size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
|
||||
@@ -197,12 +197,14 @@ pixfmts(){
|
||||
$showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$in_fmts
|
||||
pix_fmts=$(comm -12 $scale_exclude_fmts $in_fmts)
|
||||
|
||||
outertest=$test
|
||||
for pix_fmt in $pix_fmts; do
|
||||
test=$pix_fmt
|
||||
video_filter "${prefilter_chain}format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
|
||||
done
|
||||
|
||||
rm $in_fmts $scale_in_fmts $scale_out_fmts $scale_exclude_fmts
|
||||
test=$outertest
|
||||
}
|
||||
|
||||
mkdir -p "$outdir"
|
||||
|
@@ -83,8 +83,7 @@ clean(){
|
||||
|
||||
report(){
|
||||
date=$(date -u +%Y%m%d%H%M%S)
|
||||
echo "fate:0:${date}:${slot}:${version}:$1:$2:${comment}" >report
|
||||
# echo "fate:1:${date}:${slot}:${version}:$1:$2:${branch}:${comment}" >report
|
||||
echo "fate:1:${date}:${slot}:${version}:$1:$2:${branch}:${comment}" >report
|
||||
cat ${build}/config.fate >>report
|
||||
cat ${build}/tests/data/fate/*.rep >>report || for i in ${build}/tests/data/fate/*.rep ; do cat "$i" >>report ; done
|
||||
test -n "$fate_recv" && $tar report *.log | gzip | $fate_recv
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#tb 0: 1/25
|
||||
0, 0, 0, 1, 49152, 0x93ce1cd5
|
||||
0, 0, 0, 1, 49152, 0x0801ce78
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#tb 0: 1/25
|
||||
0, 0, 0, 1, 49152, 0xed73bf03
|
||||
0, 0, 0, 1, 49152, 0x5a1481f8
|
||||
|
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* read from infile and put it in a buffer */
|
||||
{
|
||||
unsigned int count = 0;
|
||||
int64_t count = 0;
|
||||
struct line *line, *last_line, *first_line;
|
||||
char *p;
|
||||
last_line = first_line = av_malloc(sizeof(struct line));
|
||||
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
|
||||
graph_string = av_malloc(count + 1);
|
||||
p = graph_string;
|
||||
for (line = first_line; line->next; line = line->next) {
|
||||
unsigned int l = strlen(line->data);
|
||||
size_t l = strlen(line->data);
|
||||
memcpy(p, line->data, l);
|
||||
p += l;
|
||||
}
|
||||
|
Reference in New Issue
Block a user