Compare commits
103 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fe01189b0a | |||
| db25eb352a | |||
| 69a6974116 | |||
| 5a020f8690 | |||
| ffbb1058b7 | |||
| 71274326b1 | |||
| 486e46719e | |||
| c32e89653a | |||
| 7acd31d09a | |||
| 23afb77b8e | |||
| 80ebfdb7ca | |||
| e134cf5798 | |||
| 3c61273c8f | |||
| fb358672d9 | |||
| e91a7c9ca6 | |||
| d2c9b04388 | |||
| 08d94cbe2b | |||
| af336762bd | |||
| 2f80158781 | |||
| 3a12fc4309 | |||
| 48118f2fae | |||
| 9e7278e832 | |||
| 1ca62c1718 | |||
| 43b8852feb | |||
| f5d8b82891 | |||
| 719ebc4adb | |||
| 34eb233f07 | |||
| dda63e60a0 | |||
| 72c82bbb9f | |||
| afc97bddb6 | |||
| a8ea6f8465 | |||
| ef2e5030a9 | |||
| 9762ef37a5 | |||
| efe13fd99c | |||
| 1c4667297c | |||
| a0ec70455c | |||
| 6ad3e87a87 | |||
| daa0d94cf9 | |||
| 421207a390 | |||
| 3ce439f5fe | |||
| 9fbcecf435 | |||
| d8778cbccd | |||
| ac8fda6566 | |||
| 33a45199aa | |||
| 503a3e4c38 | |||
| affeb1dde1 | |||
| 334d24b539 | |||
| b612d3634c | |||
| 6c14d8e338 | |||
| 9bef02015e | |||
| d1ea5ab824 | |||
| e958e49b31 | |||
| a24784d504 | |||
| 71885a72b6 | |||
| 736791b4e2 | |||
| c02c96b93d | |||
| 50a5c2f75d | |||
| 95b2b8393d | |||
| 3c005e89b2 | |||
| ab42cdfd0e | |||
| 8d3f10011d | |||
| a51d618e8b | |||
| 8bc1b2ee5d | |||
| 9912935062 | |||
| 795cec23b2 | |||
| f0442346e6 | |||
| dfdb353fff | |||
| d0a7da4874 | |||
| 5a6bfec33d | |||
| 4c9978124d | |||
| a0e85cda1d | |||
| c84b693703 | |||
| c5b3a3f969 | |||
| 985ee23665 | |||
| 9b7d4ad167 | |||
| a3431f279e | |||
| c9a2d48c2e | |||
| 4eceda7528 | |||
| 0e4eaa307f | |||
| e102dfd331 | |||
| e6a6343976 | |||
| cb57b8352d | |||
| 5b82c7c04c | |||
| a24f1e1f7a | |||
| 072d22d402 | |||
| 156ed79d28 | |||
| 418c7e221d | |||
| b583dd4e44 | |||
| aea5aadc20 | |||
| 3d9afae908 | |||
| 6cd0bdf3b0 | |||
| 131bd9436c | |||
| 69107495c5 | |||
| c5a083a50b | |||
| 4af46cabf6 | |||
| d67155005d | |||
| 9d64371b0e | |||
| 7c1337ccb0 | |||
| 610ca2cd52 | |||
| b2294bf784 | |||
| efb211a449 | |||
| b9a187b164 | |||
| 5ed2358b12 |
@@ -2,6 +2,111 @@ Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
|
||||
version 4.3.9:
|
||||
configure: update copyright year
|
||||
avformat/hls: Partially revert "reduce default max reload to 3"
|
||||
avformat/hls: Fix twitter
|
||||
libavformat/hls: Be more restrictive on mpegts extensions
|
||||
avformat/hls: .ts is always ok even if its a mov/mp4
|
||||
avformat/hls: Print input format in error message
|
||||
avformat/hls: Be more picky on extensions
|
||||
avformat: add ff_match_url_ext()
|
||||
avfilter/bwdif: account for chroma sub-sampling in min size calculation
|
||||
avformat/iff: Check that we have a stream in read_dst_frame()
|
||||
avformat/mlvdec: fix size checks
|
||||
avformat/mxfdec: Check edit unit for overflow in mxf_set_current_edit_unit()
|
||||
avcodec/h263dec: Check against previous dimensions instead of coded
|
||||
avformat/mxfdec: Check avio_read() success in mxf_decrypt_triplet()
|
||||
avcodec/huffyuvdec: Initialize whole output for decode_gray_bitstream()
|
||||
avformat/ipmovie: Check signature_buffer read
|
||||
avformat/wtvdec: Initialize buf
|
||||
avcodec/cbs_vp9: Initialize VP9RawSuperframeIndex
|
||||
avformat/vqf: Propagate errors from add_metadata()
|
||||
avformat/vqf: Check avio_read() in add_metadata()
|
||||
avformat/dashdec: Check whitelist
|
||||
avutil/avstring: dont mess with NULL pointers in av_match_list()
|
||||
avcodec/mpegvideo_enc: Check FLV1 resolution limits
|
||||
avcodec/ffv1enc: Fix handling of 32bit unsigned symbols
|
||||
avcodec/vc1dec: Clear block_index in vc1_decode_reset()
|
||||
avcodec/aacsbr_template: Clear n_q on error
|
||||
swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
|
||||
avfilter/af_pan: Fix sscanf() use
|
||||
avfilter/vf_addroi: Add missing NULL termination to addroi_var_names[]()
|
||||
avformat/rmdec: check that buf if completely filled
|
||||
avcodec/hapdec: Clear tex buffer
|
||||
avformat/mxfdec: Check that key was read sucessfull
|
||||
avformat/rpl: Fix check for negative values
|
||||
avformat/mlvdec: Check avio_read()
|
||||
avcodec/utils: Fix block align overflow for ADPCM_IMA_WAV
|
||||
avformat/matroskadec: Check pre_ns for overflow
|
||||
avcodec/webp: Check ref_x/y
|
||||
avcodec/ilbcdec: Initialize tempbuff2
|
||||
avformat/dxa: check bpc
|
||||
swscale/slice: clear allocated memory in alloc_lines()
|
||||
avformat/icodec: fix integer overflow with nb_pal
|
||||
doc/developer: Document relationship between git accounts and MAINTAINERS
|
||||
avformat/vividas: Check avio_read() for failure
|
||||
avformat/ilbc: Check avio_read() for failure
|
||||
avformat/nistspheredec: Clear buffer
|
||||
INSTALL: explain the circular dependency issue and solution
|
||||
avformat/mpegts: Initialize predefined_SLConfigDescriptor_seen
|
||||
avformat/mxfdec: Fix overflow in midpoint computation
|
||||
swscale/output: used unsigned for bit accumulation
|
||||
avcodec/rangecoder: only perform renorm check/loop for callers that need it
|
||||
avcodec/ffv1dec: Fix end computation with ec=2
|
||||
avcodec/ffv1enc: Prevent generation of files with broken slices
|
||||
avformat/matroskadec: Check desc_bytes so bits fit in 64bit
|
||||
avcodec/ffv1enc: Correct error message about unsupported version
|
||||
avcodec/ffv1enc: Slice combination is unsupported
|
||||
avcodec/ffv1enc: 2Pass mode is not possible with golomb coding
|
||||
avcodec/ffv1enc: Fix >8bit context size
|
||||
avcodec/xan: Add basic input size check
|
||||
avcodec/svq3: Check for minimum size input
|
||||
avcodec/eacmv: Check input size for intra frames
|
||||
avcodec/jfdctint_template: use unsigned z* in row_fdct()
|
||||
avformat/mxfdec: Check timecode for overflow
|
||||
avformat/mxfdec: More offset_temp checks
|
||||
swscale/output: Fix undefined integer overflow in yuv2rgba64_2_c_template()
|
||||
swscale/swscale: Use unsigned operation to avoid undefined behavior
|
||||
avcodec/vc2enc: basic sanity check on slice_max_bytes
|
||||
avformat/mvdec: Check if name was fully read
|
||||
avcodec/wmavoice: Do not use uninitialized pitch[0]
|
||||
avcodec/notchlc: Check bytes left before reading
|
||||
avcodec/vc1_block: propagate error codes
|
||||
avformat/apetag: Check APETAGEX
|
||||
avcodec/avcodec: Warn about data returned from get_buffer*()
|
||||
avcodec/aic: Clear slice_data
|
||||
avcodec/vc1dec: Clear mb_type_base and ttblk_base
|
||||
avcodec/shorten: clear padding
|
||||
avformat/mpeg: Check an avio_read() for failure
|
||||
avcodec/mvha: Clear remaining space after inflate()
|
||||
avformat/segafilm: Set keyframe
|
||||
avcodec/dxva2: initialize hr in ff_dxva2_common_end_frame()
|
||||
avcodec/dxva2: initialize validate
|
||||
avcodec/dxva2: Initialize ConfigBitstreamRaw
|
||||
avcodec/dxva2: Initialize dxva_size and check it
|
||||
avfilter/vf_xfade: Compute w2, h2 with float
|
||||
avfilter/vf_v360: Assert that vf was initialized
|
||||
avfilter/vf_tonemap_opencl: Dereference after NULL check
|
||||
avfilter/vf_xfade_opencl: Check ff_inlink_consume_frame() for failure
|
||||
avformat/lmlm4: Eliminate some AVERROR(EIO)
|
||||
avformat/wtvdec: Check length of read mpeg2_descriptor
|
||||
avformat/wtvdec: clear sectors
|
||||
vp9: recon: Use emulated edge to prevent buffer overflows
|
||||
arm: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
|
||||
aarch64: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
|
||||
avformat/libzmq: fix check for zmq protocol prefix
|
||||
configure: improve check for POSIX ioctl
|
||||
configure: restore autodetection of v4l2 and fbdev
|
||||
configure: use just the pkg-config for sndio
|
||||
configure: enable ffnvcodec, nvenc, nvdec for FreeBSD
|
||||
avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD
|
||||
avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detection
|
||||
lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's
|
||||
configure: use pkg-config for sndio
|
||||
libavcodec/arm/mlpdsp_armv5te: fix label format to work with binutils 2.43
|
||||
|
||||
|
||||
version 4.3.8:
|
||||
avcodec/parser: ensure input padding is zeroed
|
||||
avformat/img2dec: Clear padding data after EOF
|
||||
|
||||
@@ -15,3 +15,11 @@ NOTICE
|
||||
------
|
||||
|
||||
- Non system dependencies (e.g. libx264, libvpx) are disabled by default.
|
||||
|
||||
NOTICE for Package Maintainers
|
||||
------------------------------
|
||||
|
||||
- It is recommended to build FFmpeg twice, first with minimal external dependencies so
|
||||
that 3rd party packages, which depend on FFmpegs libavutil/libavfilter/libavcodec/libavformat
|
||||
can then be built. And last build FFmpeg with full dependancies (which may in turn depend on
|
||||
some of these 3rd party packages). This avoids circular dependencies during build.
|
||||
|
||||
@@ -2330,6 +2330,7 @@ HAVE_LIST="
|
||||
opencl_vaapi_intel_media
|
||||
perl
|
||||
pod2man
|
||||
posix_ioctl
|
||||
texi2html
|
||||
"
|
||||
|
||||
@@ -6541,11 +6542,13 @@ perl -v > /dev/null 2>&1 && enable perl || disable perl
|
||||
pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
|
||||
rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
|
||||
|
||||
check_headers linux/fb.h
|
||||
check_headers linux/videodev2.h
|
||||
test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
|
||||
test_code cc sys/ioctl.h "int ioctl(int, int, ...)" && enable posix_ioctl
|
||||
|
||||
# check V4L2 codecs available in the API
|
||||
if enabled v4l2_m2m; then
|
||||
check_headers linux/fb.h
|
||||
check_headers linux/videodev2.h
|
||||
test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
|
||||
check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
|
||||
check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
|
||||
check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
|
||||
@@ -6590,7 +6593,7 @@ enabled alsa && { check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimesta
|
||||
enabled libjack &&
|
||||
require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
|
||||
|
||||
enabled sndio && check_lib sndio sndio.h sio_open -lsndio
|
||||
enabled sndio && check_pkg_config sndio sndio sndio.h sio_open
|
||||
|
||||
if enabled libcdio; then
|
||||
check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
|
||||
@@ -6687,7 +6690,7 @@ enabled vulkan &&
|
||||
|
||||
if enabled x86; then
|
||||
case $target_os in
|
||||
mingw32*|mingw64*|win32|win64|linux|cygwin*)
|
||||
freebsd|mingw32*|mingw64*|win32|win64|linux|cygwin*)
|
||||
;;
|
||||
*)
|
||||
disable ffnvcodec cuvid nvdec nvenc
|
||||
@@ -7515,7 +7518,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2024
|
||||
#define CONFIG_THIS_YEAR 2025
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.3.8
|
||||
PROJECT_NUMBER = 4.3.9
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
@@ -327,6 +327,13 @@ segment index to start live streams at (negative values are from the end).
|
||||
@item allowed_extensions
|
||||
',' separated list of file extensions that hls is allowed to access.
|
||||
|
||||
@item extension_picky
|
||||
This blocks disallowed extensions from probing
|
||||
It also requires all available segments to have matching extensions to the format
|
||||
except mpegts, which is always allowed.
|
||||
It is recommended to set the whitelists correctly instead of depending on extensions
|
||||
Enabled by default.
|
||||
|
||||
@item max_reload
|
||||
Maximum number of times a insufficient list is attempted to be reloaded.
|
||||
Default value is 1000.
|
||||
|
||||
@@ -762,6 +762,25 @@ In case you need finer control over how valgrind is invoked, use the
|
||||
@code{--target-exec='valgrind <your_custom_valgrind_options>} option in
|
||||
your configure line instead.
|
||||
|
||||
@anchor{Maintenance}
|
||||
@chapter Maintenance process
|
||||
|
||||
@anchor{MAINTAINERS}
|
||||
@section MAINTAINERS
|
||||
|
||||
The developers maintaining each part of the codebase are listed in @file{MAINTAINERS}.
|
||||
Being listed in @file{MAINTAINERS}, gives one the right to have git write access to
|
||||
the specific repository.
|
||||
|
||||
@anchor{Becoming a maintainer}
|
||||
@section Becoming a maintainer
|
||||
|
||||
People add themselves to @file{MAINTAINERS} by sending a patch like any other code
|
||||
change. These get reviewed by the community like any other patch. It is expected
|
||||
that, if someone has an objection to a new maintainer, she is willing to object
|
||||
in public with her full name and is willing to take over maintainership for the area.
|
||||
|
||||
|
||||
@anchor{Release process}
|
||||
@chapter Release process
|
||||
|
||||
|
||||
@@ -592,6 +592,7 @@ static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
|
||||
|
||||
if (sbr->n_q > 5) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
|
||||
sbr->n_q = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,9 @@ function \type\()_8tap_\size\()h_\idx1\idx2
|
||||
// reduced dst stride
|
||||
.if \size >= 16
|
||||
sub x1, x1, x5
|
||||
.elseif \size == 4
|
||||
add x12, x2, #8
|
||||
add x13, x7, #8
|
||||
.endif
|
||||
// size >= 16 loads two qwords and increments x2,
|
||||
// for size 4/8 it's enough with one qword and no
|
||||
@@ -248,9 +251,14 @@ function \type\()_8tap_\size\()h_\idx1\idx2
|
||||
.if \size >= 16
|
||||
ld1 {v4.8b, v5.8b, v6.8b}, [x2], #24
|
||||
ld1 {v16.8b, v17.8b, v18.8b}, [x7], #24
|
||||
.else
|
||||
.elseif \size == 8
|
||||
ld1 {v4.8b, v5.8b}, [x2]
|
||||
ld1 {v16.8b, v17.8b}, [x7]
|
||||
.else // \size == 4
|
||||
ld1 {v4.8b}, [x2]
|
||||
ld1 {v16.8b}, [x7]
|
||||
ld1 {v5.s}[0], [x12], x3
|
||||
ld1 {v17.s}[0], [x13], x3
|
||||
.endif
|
||||
uxtl v4.8h, v4.8b
|
||||
uxtl v5.8h, v5.8b
|
||||
|
||||
+1
-2
@@ -470,8 +470,7 @@ static av_cold int aic_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
ctx->slice_data = av_malloc_array(ctx->slice_width, AIC_BAND_COEFFS
|
||||
* sizeof(*ctx->slice_data));
|
||||
ctx->slice_data = av_calloc(ctx->slice_width, AIC_BAND_COEFFS * sizeof(*ctx->slice_data));
|
||||
if (!ctx->slice_data) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error allocating slice buffer\n");
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ A .endif
|
||||
.endif
|
||||
|
||||
// Begin loop
|
||||
01:
|
||||
1:
|
||||
.if TOTAL_TAPS == 0
|
||||
// Things simplify a lot in this case
|
||||
// In fact this could be pipelined further if it's worth it...
|
||||
@@ -241,7 +241,7 @@ A .endif
|
||||
str ST0, [PST, #-4]!
|
||||
str ST0, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
|
||||
str ST0, [PSAMP], #4 * MAX_CHANNELS
|
||||
bne 01b
|
||||
bne 1b
|
||||
.else
|
||||
.if \fir_taps & 1
|
||||
.set LOAD_REG, 1
|
||||
@@ -333,7 +333,7 @@ T orr AC0, AC0, AC1
|
||||
str ST3, [PST, #-4]!
|
||||
str ST2, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
|
||||
str ST3, [PSAMP], #4 * MAX_CHANNELS
|
||||
bne 01b
|
||||
bne 1b
|
||||
.endif
|
||||
b 99f
|
||||
|
||||
|
||||
@@ -279,11 +279,13 @@ function \type\()_8tap_\size\()h_\idx1\idx2
|
||||
sub r1, r1, r5
|
||||
.endif
|
||||
@ size >= 16 loads two qwords and increments r2,
|
||||
@ for size 4/8 it's enough with one qword and no
|
||||
@ postincrement
|
||||
@ size 4 loads 1 d word, increments r2 and loads 1 32-bit lane
|
||||
@ for size 8 it's enough with one qword and no postincrement
|
||||
.if \size >= 16
|
||||
sub r3, r3, r5
|
||||
sub r3, r3, #8
|
||||
.elseif \size == 4
|
||||
sub r3, r3, #8
|
||||
.endif
|
||||
@ Load the filter vector
|
||||
vld1.16 {q0}, [r12,:128]
|
||||
@@ -295,9 +297,14 @@ function \type\()_8tap_\size\()h_\idx1\idx2
|
||||
.if \size >= 16
|
||||
vld1.8 {d18, d19, d20}, [r2]!
|
||||
vld1.8 {d24, d25, d26}, [r7]!
|
||||
.else
|
||||
.elseif \size == 8
|
||||
vld1.8 {q9}, [r2]
|
||||
vld1.8 {q12}, [r7]
|
||||
.else @ size == 4
|
||||
vld1.8 {d18}, [r2]!
|
||||
vld1.8 {d24}, [r7]!
|
||||
vld1.32 {d19[0]}, [r2]
|
||||
vld1.32 {d25[0]}, [r7]
|
||||
.endif
|
||||
vmovl.u8 q8, d18
|
||||
vmovl.u8 q9, d19
|
||||
|
||||
@@ -1294,6 +1294,10 @@ typedef struct AVCodecContext {
|
||||
* this callback and filled with the extra buffers if there are more
|
||||
* buffers than buf[] can hold. extended_buf will be freed in
|
||||
* av_frame_unref().
|
||||
* Decoders will generally initialize the whole buffer before it is output
|
||||
* but it can in rare error conditions happen that uninitialized data is passed
|
||||
* through. \important The buffers returned by get_buffer* should thus not contain sensitive
|
||||
* data.
|
||||
*
|
||||
* If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
|
||||
* avcodec_default_get_buffer2() instead of providing buffers allocated by
|
||||
|
||||
@@ -422,7 +422,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
|
||||
superframe_header = frag->data[frag->data_size - 1];
|
||||
|
||||
if ((superframe_header & 0xe0) == 0xc0) {
|
||||
VP9RawSuperframeIndex sfi;
|
||||
VP9RawSuperframeIndex sfi = {0};
|
||||
GetBitContext gbc;
|
||||
size_t index_size, pos;
|
||||
int i;
|
||||
|
||||
+5
-5
@@ -111,7 +111,7 @@ static int dxva_get_decoder_configuration(AVCodecContext *avctx,
|
||||
|
||||
for (i = 0; i < cfg_count; i++) {
|
||||
unsigned score;
|
||||
UINT ConfigBitstreamRaw;
|
||||
UINT ConfigBitstreamRaw = 0;
|
||||
GUID guidConfigBitstreamEncryption;
|
||||
|
||||
#if CONFIG_D3D11VA
|
||||
@@ -262,7 +262,7 @@ static int dxva_get_decoder_guid(AVCodecContext *avctx, void *service, void *sur
|
||||
*decoder_guid = ff_GUID_NULL;
|
||||
for (i = 0; dxva_modes[i].guid; i++) {
|
||||
const dxva_mode *mode = &dxva_modes[i];
|
||||
int validate;
|
||||
int validate = 0;
|
||||
if (!dxva_check_codec_compatibility(avctx, mode))
|
||||
continue;
|
||||
|
||||
@@ -794,7 +794,7 @@ int ff_dxva2_commit_buffer(AVCodecContext *avctx,
|
||||
unsigned type, const void *data, unsigned size,
|
||||
unsigned mb_count)
|
||||
{
|
||||
void *dxva_data;
|
||||
void *dxva_data = NULL;
|
||||
unsigned dxva_size;
|
||||
int result;
|
||||
HRESULT hr = 0;
|
||||
@@ -816,7 +816,7 @@ int ff_dxva2_commit_buffer(AVCodecContext *avctx,
|
||||
type, (unsigned)hr);
|
||||
return -1;
|
||||
}
|
||||
if (size <= dxva_size) {
|
||||
if (dxva_data && size <= dxva_size) {
|
||||
memcpy(dxva_data, data, size);
|
||||
|
||||
#if CONFIG_D3D11VA
|
||||
@@ -894,7 +894,7 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
#endif
|
||||
DECODER_BUFFER_DESC *buffer = NULL, *buffer_slice = NULL;
|
||||
int result, runs = 0;
|
||||
HRESULT hr;
|
||||
HRESULT hr = -1;
|
||||
unsigned type;
|
||||
FFDXVASharedContext *sctx = DXVA_SHARED_CONTEXT(avctx);
|
||||
|
||||
|
||||
+4
-1
@@ -198,12 +198,15 @@ static int cmv_decode_frame(AVCodecContext *avctx,
|
||||
if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
|
||||
return ret;
|
||||
|
||||
buf += EA_PREAMBLE_SIZE;
|
||||
if (!(buf[0]&1) && buf_end - buf < s->width * s->height * (int64_t)(100 - s->avctx->discard_damaged_percentage) / 100)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
return ret;
|
||||
|
||||
memcpy(frame->data[1], s->palette, AVPALETTE_SIZE);
|
||||
|
||||
buf += EA_PREAMBLE_SIZE;
|
||||
if ((buf[0]&1)) { // subtype
|
||||
cmv_decode_inter(s, frame, buf+2, buf_end);
|
||||
frame->key_frame = 0;
|
||||
|
||||
@@ -113,6 +113,13 @@ av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_need_new_slices(int width, int num_h_slices, int chroma_shift) {
|
||||
int mpw = 1<<chroma_shift;
|
||||
int i = width * (int64_t)(num_h_slices - 1) / num_h_slices;
|
||||
|
||||
return width % mpw && (width - i) % mpw == 0;
|
||||
}
|
||||
|
||||
av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
|
||||
{
|
||||
int i, max_slice_count = f->num_h_slices * f->num_v_slices;
|
||||
|
||||
@@ -146,6 +146,7 @@ int ff_ffv1_init_slice_contexts(FFV1Context *f);
|
||||
int ff_ffv1_allocate_initial_states(FFV1Context *f);
|
||||
void ff_ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs);
|
||||
int ff_ffv1_close(AVCodecContext *avctx);
|
||||
int ff_need_new_slices(int width, int num_h_slices, int chroma_shift);
|
||||
|
||||
static av_always_inline int fold(int diff, int bits)
|
||||
{
|
||||
|
||||
@@ -361,7 +361,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
|
||||
if (fs->ac != AC_GOLOMB_RICE && f->version > 2) {
|
||||
int v;
|
||||
get_rac(&fs->c, (uint8_t[]) { 129 });
|
||||
v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*f->ec;
|
||||
v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*!!f->ec;
|
||||
if (v) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v);
|
||||
fs->slice_damaged = 1;
|
||||
|
||||
+23
-12
@@ -199,7 +199,7 @@ static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c,
|
||||
} while (0)
|
||||
|
||||
if (v) {
|
||||
const int a = FFABS(v);
|
||||
const unsigned a = is_signed ? FFABS(v) : v;
|
||||
const int e = av_log2(a);
|
||||
put_rac(c, state + 0, 0);
|
||||
if (e <= 9) {
|
||||
@@ -526,6 +526,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
avctx->slices > 1)
|
||||
s->version = FFMAX(s->version, 2);
|
||||
|
||||
if ((avctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) && s->ac == AC_GOLOMB_RICE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "2 Pass mode is not possible with golomb coding\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
// Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability
|
||||
if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576)
|
||||
s->version = FFMAX(s->version, 2);
|
||||
@@ -550,7 +555,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
s->version = FFMAX(s->version, 3);
|
||||
|
||||
if ((s->version == 2 || s->version>3) && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Version 2 needed for requested features but version 2 is experimental and not enabled\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "Version 2 or 4 needed for requested features but version 2 or 4 is experimental and not enabled\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -735,19 +740,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
s->quant_tables[1][2][i]= 11*11*quant5 [i];
|
||||
s->quant_tables[1][3][i]= 5*11*11*quant5 [i];
|
||||
s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i];
|
||||
s->context_count[0] = (11 * 11 * 11 + 1) / 2;
|
||||
s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
|
||||
} else {
|
||||
s->quant_tables[0][0][i]= quant9_10bit[i];
|
||||
s->quant_tables[0][1][i]= 11*quant9_10bit[i];
|
||||
s->quant_tables[0][2][i]= 11*11*quant9_10bit[i];
|
||||
s->quant_tables[0][1][i]= 9*quant9_10bit[i];
|
||||
s->quant_tables[0][2][i]= 9*9*quant9_10bit[i];
|
||||
s->quant_tables[1][0][i]= quant9_10bit[i];
|
||||
s->quant_tables[1][1][i]= 11*quant9_10bit[i];
|
||||
s->quant_tables[1][2][i]= 11*11*quant5_10bit[i];
|
||||
s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i];
|
||||
s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
|
||||
s->quant_tables[1][1][i]= 9*quant9_10bit[i];
|
||||
s->quant_tables[1][2][i]= 9*9*quant5_10bit[i];
|
||||
s->quant_tables[1][3][i]= 5*9*9*quant5_10bit[i];
|
||||
s->quant_tables[1][4][i]= 5*5*9*9*quant5_10bit[i];
|
||||
s->context_count[0] = (9 * 9 * 9 + 1) / 2;
|
||||
s->context_count[1] = (9 * 9 * 5 * 5 * 5 + 1) / 2;
|
||||
}
|
||||
}
|
||||
s->context_count[0] = (11 * 11 * 11 + 1) / 2;
|
||||
s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
|
||||
memcpy(s->quant_table, s->quant_tables[s->context_model],
|
||||
sizeof(s->quant_table));
|
||||
|
||||
@@ -885,6 +892,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
continue;
|
||||
if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24)
|
||||
continue;
|
||||
if (s->version < 4)
|
||||
if ( ff_need_new_slices(avctx->width , s->num_h_slices, s->chroma_h_shift)
|
||||
||ff_need_new_slices(avctx->height, s->num_v_slices, s->chroma_v_shift))
|
||||
continue;
|
||||
if (avctx->slices == s->num_h_slices * s->num_v_slices && avctx->slices <= MAX_SLICES || !avctx->slices)
|
||||
goto slices_ok;
|
||||
}
|
||||
@@ -933,8 +944,8 @@ static void encode_slice_header(FFV1Context *f, FFV1Context *fs)
|
||||
|
||||
put_symbol(c, state, (fs->slice_x +1)*f->num_h_slices / f->width , 0);
|
||||
put_symbol(c, state, (fs->slice_y +1)*f->num_v_slices / f->height , 0);
|
||||
put_symbol(c, state, (fs->slice_width +1)*f->num_h_slices / f->width -1, 0);
|
||||
put_symbol(c, state, (fs->slice_height+1)*f->num_v_slices / f->height-1, 0);
|
||||
put_symbol(c, state, 0, 0);
|
||||
put_symbol(c, state, 0, 0);
|
||||
for (j=0; j<f->plane_count; j++) {
|
||||
put_symbol(c, state, f->plane[j].quant_table_index, 0);
|
||||
av_assert0(f->plane[j].quant_table_index == f->context_model);
|
||||
|
||||
+10
-4
@@ -426,7 +426,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
int slice_ret = 0;
|
||||
|
||||
AVFrame *pict = data;
|
||||
int bak_width, bak_height;
|
||||
|
||||
/* no supplementary picture */
|
||||
if (buf_size == 0) {
|
||||
@@ -490,6 +492,9 @@ retry:
|
||||
// we need the idct permutation for reading a custom matrix
|
||||
ff_mpv_idct_init(s);
|
||||
|
||||
bak_width = s->width;
|
||||
bak_height = s->height;
|
||||
|
||||
/* let's go :-) */
|
||||
if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
|
||||
ret = ff_wmv2_decode_picture_header(s);
|
||||
@@ -512,11 +517,12 @@ retry:
|
||||
}
|
||||
|
||||
if (ret < 0 || ret == FRAME_SKIPPED) {
|
||||
if ( s->width != avctx->coded_width
|
||||
|| s->height != avctx->coded_height) {
|
||||
if ( s->width != bak_width
|
||||
|| s->height != bak_height) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
|
||||
s->width = avctx->coded_width;
|
||||
s->height= avctx->coded_height;
|
||||
s->width = bak_width;
|
||||
s->height= bak_height;
|
||||
|
||||
}
|
||||
}
|
||||
if (ret == FRAME_SKIPPED)
|
||||
|
||||
@@ -372,6 +372,7 @@ static int hap_decode(AVCodecContext *avctx, void *data,
|
||||
ret = av_reallocp(&ctx->tex_buf, ctx->tex_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
memset(ctx->tex_buf, 0, ctx->tex_size);
|
||||
|
||||
avctx->execute2(avctx, decompress_chunks_thread, NULL,
|
||||
ctx->chunk_results, ctx->chunk_count);
|
||||
|
||||
@@ -738,6 +738,8 @@ static void decode_gray_bitstream(HYuvContext *s, int count)
|
||||
for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
|
||||
READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
|
||||
}
|
||||
for (; i < count; i++)
|
||||
s->temp[0][2 * i] = s->temp[0][2 * i + 1] = 0;
|
||||
} else {
|
||||
for (i = 0; i < count; i++) {
|
||||
READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
|
||||
|
||||
@@ -653,7 +653,7 @@ static void get_codebook(int16_t * cbvec, /* (o) Constructed codebook vector *
|
||||
int16_t k, base_size;
|
||||
int16_t lag;
|
||||
/* Stack based */
|
||||
int16_t tempbuff2[SUBL + 5];
|
||||
int16_t tempbuff2[SUBL + 5] = {0};
|
||||
|
||||
/* Determine size of codebook sections */
|
||||
base_size = lMem - cbveclen + 1;
|
||||
|
||||
@@ -183,7 +183,7 @@ static av_always_inline void FUNC(row_fdct)(int16_t *data)
|
||||
{
|
||||
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
|
||||
int tmp10, tmp11, tmp12, tmp13;
|
||||
int z1, z2, z3, z4, z5;
|
||||
unsigned z1, z2, z3, z4, z5;
|
||||
int16_t *dataptr;
|
||||
int ctr;
|
||||
|
||||
|
||||
@@ -562,6 +562,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
av_log(avctx, AV_LOG_ERROR, "H.263 does not support resolutions above 2048x1152\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (s->codec_id == AV_CODEC_ID_FLV1 &&
|
||||
(avctx->width > 65535 ||
|
||||
avctx->height > 65535 )) {
|
||||
av_log(avctx, AV_LOG_ERROR, "FLV does not support resolutions above 16bit\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if ((s->codec_id == AV_CODEC_ID_H263 ||
|
||||
s->codec_id == AV_CODEC_ID_H263P) &&
|
||||
((avctx->width &3) ||
|
||||
|
||||
@@ -187,6 +187,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", ret);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
if (s->zstream.avail_out > 0)
|
||||
memset(s->zstream.next_out, 0, s->zstream.avail_out);
|
||||
}
|
||||
}
|
||||
} else if (type == MKTAG('H','U','F','Y')) {
|
||||
|
||||
@@ -92,6 +92,9 @@ static int lz4_decompress(AVCodecContext *avctx,
|
||||
} while (current == 255);
|
||||
}
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < num_literals)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (pos + num_literals < HISTORY_SIZE) {
|
||||
bytestream2_get_buffer(gb, history + pos, num_literals);
|
||||
pos += num_literals;
|
||||
|
||||
@@ -71,7 +71,6 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p);
|
||||
static inline void renorm_encoder(RangeCoder *c)
|
||||
{
|
||||
// FIXME: optimize
|
||||
while (c->range < 0x100) {
|
||||
if (c->outstanding_byte < 0) {
|
||||
c->outstanding_byte = c->low >> 8;
|
||||
} else if (c->low <= 0xFF00) {
|
||||
@@ -90,7 +89,6 @@ static inline void renorm_encoder(RangeCoder *c)
|
||||
|
||||
c->low = (c->low & 0xFF) << 8;
|
||||
c->range <<= 8;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int get_rac_count(RangeCoder *c)
|
||||
@@ -117,7 +115,8 @@ static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit)
|
||||
*state = c->one_state[*state];
|
||||
}
|
||||
|
||||
renorm_encoder(c);
|
||||
while (c->range < 0x100)
|
||||
renorm_encoder(c);
|
||||
}
|
||||
|
||||
static inline void refill(RangeCoder *c)
|
||||
|
||||
@@ -558,6 +558,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
|
||||
buf = &s->bitstream[s->bitstream_index];
|
||||
buf_size += s->bitstream_size;
|
||||
s->bitstream_size = buf_size;
|
||||
memset(buf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
/* do not decode until buffer has at least max_framesize bytes or
|
||||
* the end of the file has been reached */
|
||||
|
||||
@@ -1439,6 +1439,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (svq3_decode_slice_header(avctx))
|
||||
return -1;
|
||||
|
||||
if (avpkt->size < s->mb_width * s->mb_height / 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->pict_type = s->slice_type;
|
||||
|
||||
if (s->pict_type != AV_PICTURE_TYPE_B)
|
||||
|
||||
+1
-1
@@ -1748,7 +1748,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||
case AV_CODEC_ID_ADPCM_IMA_WAV:
|
||||
if (bps < 2 || bps > 5)
|
||||
return 0;
|
||||
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
|
||||
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8LL);
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_IMA_DK3:
|
||||
tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
|
||||
|
||||
+40
-19
@@ -1313,6 +1313,7 @@ static int vc1_decode_p_mb(VC1Context *v)
|
||||
int dst_idx, off;
|
||||
int skipped, fourmv;
|
||||
int block_cbp = 0, pat, block_tt = 0, block_intra = 0;
|
||||
int ret;
|
||||
|
||||
mquant = v->pq; /* lossy initialization */
|
||||
|
||||
@@ -1371,8 +1372,10 @@ static int vc1_decode_p_mb(VC1Context *v)
|
||||
if (i == 1 || i == 3 || s->mb_x)
|
||||
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
|
||||
|
||||
vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
ret = vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
|
||||
continue;
|
||||
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
|
||||
@@ -1474,8 +1477,10 @@ static int vc1_decode_p_mb(VC1Context *v)
|
||||
if (i == 1 || i == 3 || s->mb_x)
|
||||
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
|
||||
|
||||
vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, is_coded[i], mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
ret = vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, is_coded[i], mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
|
||||
continue;
|
||||
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
|
||||
@@ -1546,6 +1551,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
|
||||
int block_cbp = 0, pat, block_tt = 0;
|
||||
int idx_mbmode = 0, mvbp;
|
||||
int fieldtx;
|
||||
int ret;
|
||||
|
||||
mquant = v->pq; /* Lossy initialization */
|
||||
|
||||
@@ -1618,8 +1624,10 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
|
||||
if (i == 1 || i == 3 || s->mb_x)
|
||||
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
|
||||
|
||||
vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
ret = vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
|
||||
continue;
|
||||
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
|
||||
@@ -1755,6 +1763,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
|
||||
int pred_flag = 0;
|
||||
int block_cbp = 0, pat, block_tt = 0;
|
||||
int idx_mbmode = 0;
|
||||
int ret;
|
||||
|
||||
mquant = v->pq; /* Lossy initialization */
|
||||
|
||||
@@ -1786,8 +1795,10 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
|
||||
if (i == 1 || i == 3 || s->mb_x)
|
||||
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
|
||||
|
||||
vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
ret = vc1_decode_intra_block(v, v->block[v->cur_blk_idx][block_map[i]], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
|
||||
continue;
|
||||
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
|
||||
@@ -1878,6 +1889,7 @@ static int vc1_decode_b_mb(VC1Context *v)
|
||||
int skipped, direct;
|
||||
int dmv_x[2], dmv_y[2];
|
||||
int bmvtype = BMV_TYPE_BACKWARD;
|
||||
int ret;
|
||||
|
||||
mquant = v->pq; /* lossy initialization */
|
||||
s->mb_intra = 0;
|
||||
@@ -1990,8 +2002,10 @@ static int vc1_decode_b_mb(VC1Context *v)
|
||||
if (i == 1 || i == 3 || s->mb_x)
|
||||
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
|
||||
|
||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
|
||||
continue;
|
||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
|
||||
@@ -2037,6 +2051,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v)
|
||||
int bmvtype = BMV_TYPE_BACKWARD;
|
||||
int block_cbp = 0, pat, block_tt = 0;
|
||||
int idx_mbmode;
|
||||
int ret;
|
||||
|
||||
mquant = v->pq; /* Lossy initialization */
|
||||
s->mb_intra = 0;
|
||||
@@ -2069,8 +2084,10 @@ static int vc1_decode_b_mb_intfi(VC1Context *v)
|
||||
if (i == 1 || i == 3 || s->mb_x)
|
||||
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
|
||||
|
||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
|
||||
continue;
|
||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
|
||||
@@ -2207,6 +2224,7 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
|
||||
int stride_y, fieldtx;
|
||||
int bmvtype = BMV_TYPE_BACKWARD;
|
||||
int dir, dir2;
|
||||
int ret;
|
||||
|
||||
mquant = v->pq; /* Lossy initialization */
|
||||
s->mb_intra = 0;
|
||||
@@ -2263,8 +2281,10 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
|
||||
if (i == 1 || i == 3 || s->mb_x)
|
||||
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
|
||||
|
||||
vc1_decode_intra_block(v, s->block[i], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
ret = vc1_decode_intra_block(v, s->block[i], i, val, mquant,
|
||||
(i & 4) ? v->codingset2 : v->codingset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (CONFIG_GRAY && i > 3 && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
|
||||
continue;
|
||||
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
|
||||
@@ -2808,6 +2828,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
|
||||
{
|
||||
MpegEncContext *s = &v->s;
|
||||
int apply_loop_filter;
|
||||
int ret;
|
||||
|
||||
/* select coding mode used for VLC tables selection */
|
||||
switch (v->c_ac_table_index) {
|
||||
@@ -2850,22 +2871,22 @@ static void vc1_decode_p_blocks(VC1Context *v)
|
||||
}
|
||||
|
||||
if (v->fcm == ILACE_FIELD) {
|
||||
vc1_decode_p_mb_intfi(v);
|
||||
ret = vc1_decode_p_mb_intfi(v);
|
||||
if (apply_loop_filter)
|
||||
ff_vc1_p_loop_filter(v);
|
||||
} else if (v->fcm == ILACE_FRAME) {
|
||||
vc1_decode_p_mb_intfr(v);
|
||||
ret = vc1_decode_p_mb_intfr(v);
|
||||
if (apply_loop_filter)
|
||||
ff_vc1_p_intfr_loop_filter(v);
|
||||
} else {
|
||||
vc1_decode_p_mb(v);
|
||||
ret = vc1_decode_p_mb(v);
|
||||
if (apply_loop_filter)
|
||||
ff_vc1_p_loop_filter(v);
|
||||
}
|
||||
if (get_bits_left(&s->gb) < 0 || get_bits_count(&s->gb) < 0) {
|
||||
if (ret < 0 || get_bits_left(&s->gb) < 0 || get_bits_count(&s->gb) < 0) {
|
||||
// TODO: may need modification to handle slice coding
|
||||
ff_er_add_slice(&s->er, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR);
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n",
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Error or Bits overconsumption: %i > %i at %ix%i\n",
|
||||
get_bits_count(&s->gb), s->gb.size_in_bits, s->mb_x, s->mb_y);
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-2
@@ -344,7 +344,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
|
||||
if (!v->block || !v->cbp_base)
|
||||
goto error;
|
||||
v->cbp = v->cbp_base + 2 * s->mb_stride;
|
||||
v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 3 * s->mb_stride);
|
||||
v->ttblk_base = av_mallocz(sizeof(v->ttblk_base[0]) * 3 * s->mb_stride);
|
||||
if (!v->ttblk_base)
|
||||
goto error;
|
||||
v->ttblk = v->ttblk_base + 2 * s->mb_stride;
|
||||
@@ -358,7 +358,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
|
||||
v->luma_mv = v->luma_mv_base + 2 * s->mb_stride;
|
||||
|
||||
/* allocate block type info in that way so it could be used with s->block_index[] */
|
||||
v->mb_type_base = av_malloc(s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2);
|
||||
v->mb_type_base = av_mallocz(s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2);
|
||||
if (!v->mb_type_base)
|
||||
goto error;
|
||||
v->mb_type[0] = v->mb_type_base + s->b8_stride + 1;
|
||||
@@ -608,6 +608,7 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx)
|
||||
av_freep(&v->hrd_rate);
|
||||
av_freep(&v->hrd_buffer);
|
||||
ff_mpv_common_end(&v->s);
|
||||
memset(v->s.block_index, 0, sizeof(v->s.block_index));
|
||||
av_freep(&v->mv_type_mb_plane);
|
||||
av_freep(&v->direct_mb_plane);
|
||||
av_freep(&v->forward_mb_plane);
|
||||
|
||||
+1
-1
@@ -986,7 +986,7 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
|
||||
s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f);
|
||||
if (s->slice_min_bytes < 0)
|
||||
if (s->slice_min_bytes < 0 || s->slice_max_bytes > INT_MAX >> 3)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
ret = encode_frame(s, avpkt, frame, aux_data, header_size, s->interlaced);
|
||||
|
||||
@@ -318,7 +318,11 @@ static av_always_inline void mc_luma_unscaled(VP9TileData *td, vp9_mc_func (*mc)
|
||||
// The arm/aarch64 _hv filters read one more row than what actually is
|
||||
// needed, so switch to emulated edge one pixel sooner vertically
|
||||
// (!!my * 5) than horizontally (!!mx * 4).
|
||||
// The arm/aarch64 _h filters read one more pixel than what actually is
|
||||
// needed, so switch to emulated edge if that would read beyond the bottom
|
||||
// right block.
|
||||
if (x < !!mx * 3 || y < !!my * 3 ||
|
||||
((ARCH_AARCH64 || ARCH_ARM) && (x + !!mx * 5 > w - bw) && (y + !!my * 5 + 1 > h - bh)) ||
|
||||
x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
|
||||
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
|
||||
ref - !!my * 3 * ref_stride - !!mx * 3 * bytesperpixel,
|
||||
@@ -357,7 +361,11 @@ static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*m
|
||||
// The arm/aarch64 _hv filters read one more row than what actually is
|
||||
// needed, so switch to emulated edge one pixel sooner vertically
|
||||
// (!!my * 5) than horizontally (!!mx * 4).
|
||||
// The arm/aarch64 _h filters read one more pixel than what actually is
|
||||
// needed, so switch to emulated edge if that would read beyond the bottom
|
||||
// right block.
|
||||
if (x < !!mx * 3 || y < !!my * 3 ||
|
||||
((ARCH_AARCH64 || ARCH_ARM) && (x + !!mx * 5 > w - bw) && (y + !!my * 5 + 1 > h - bh)) ||
|
||||
x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
|
||||
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
|
||||
ref_u - !!my * 3 * src_stride_u - !!mx * 3 * bytesperpixel,
|
||||
|
||||
@@ -739,6 +739,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role,
|
||||
ref_x = FFMAX(0, ref_x);
|
||||
ref_y = FFMAX(0, ref_y);
|
||||
|
||||
if (ref_y == y && ref_x >= x)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* copy pixels
|
||||
* source and dest regions can overlap and wrap lines, so just
|
||||
* copy per-pixel */
|
||||
|
||||
@@ -1491,6 +1491,8 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
|
||||
/* Parse frame type ("frame header"), see frame_descs */
|
||||
int bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)], block_nsamples;
|
||||
|
||||
pitch[0] = INT_MAX;
|
||||
|
||||
if (bd_idx < 0) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Invalid frame type VLC code, skipping\n");
|
||||
@@ -1608,6 +1610,9 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
|
||||
double i_lsps[MAX_LSPS];
|
||||
float lpcs[MAX_LSPS];
|
||||
|
||||
if(frame_descs[bd_idx].fcb_type >= FCB_TYPE_AW_PULSES && pitch[0] == INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (n = 0; n < s->lsps; n++) // LSF -> LSP
|
||||
i_lsps[n] = cos(0.5 * (prev_lsps[n] + lsps[n]));
|
||||
ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1);
|
||||
|
||||
@@ -614,6 +614,9 @@ static int xan_decode_frame(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (buf_size < 9)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
+3
-3
@@ -95,10 +95,10 @@ struct video_data {
|
||||
int (*open_f)(const char *file, int oflag, ...);
|
||||
int (*close_f)(int fd);
|
||||
int (*dup_f)(int fd);
|
||||
#ifdef __GLIBC__
|
||||
int (*ioctl_f)(int fd, unsigned long int request, ...);
|
||||
#else
|
||||
#if HAVE_POSIX_IOCTL
|
||||
int (*ioctl_f)(int fd, int request, ...);
|
||||
#else
|
||||
int (*ioctl_f)(int fd, unsigned long int request, ...);
|
||||
#endif
|
||||
ssize_t (*read_f)(int fd, void *buffer, size_t n);
|
||||
void *(*mmap_f)(void *start, size_t length, int prot, int flags, int fd, int64_t offset);
|
||||
|
||||
@@ -186,7 +186,7 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
sign = 1;
|
||||
while (1) {
|
||||
gain = 1;
|
||||
if (sscanf(arg, "%lf%n *%n", &gain, &len, &len))
|
||||
if (sscanf(arg, "%lf%n *%n", &gain, &len, &len) >= 1)
|
||||
arg += len;
|
||||
if (parse_channel_name(&arg, &in_ch_id, &named)){
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
|
||||
@@ -38,6 +38,7 @@ enum {
|
||||
static const char *const addroi_var_names[] = {
|
||||
"iw",
|
||||
"ih",
|
||||
NULL,
|
||||
};
|
||||
|
||||
typedef struct AddROIContext {
|
||||
|
||||
@@ -343,13 +343,14 @@ static int config_props(AVFilterLink *link)
|
||||
if(yadif->mode&1)
|
||||
link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
|
||||
|
||||
if (link->w < 3 || link->h < 4) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n");
|
||||
yadif->csp = av_pix_fmt_desc_get(link->format);
|
||||
yadif->filter = filter;
|
||||
|
||||
if (AV_CEIL_RSHIFT(link->w, yadif->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, yadif->csp->log2_chroma_h) < 4) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
yadif->csp = av_pix_fmt_desc_get(link->format);
|
||||
yadif->filter = filter;
|
||||
if (yadif->csp->comp[0].depth > 8) {
|
||||
s->filter_intra = filter_intra_16bit;
|
||||
s->filter_line = filter_line_c_16bit;
|
||||
|
||||
@@ -345,8 +345,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
|
||||
int err;
|
||||
double peak = ctx->peak;
|
||||
|
||||
AVHWFramesContext *input_frames_ctx =
|
||||
(AVHWFramesContext*)input->hw_frames_ctx->data;
|
||||
AVHWFramesContext *input_frames_ctx;
|
||||
|
||||
av_log(ctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
|
||||
av_get_pix_fmt_name(input->format),
|
||||
@@ -354,6 +353,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
|
||||
|
||||
if (!input->hw_frames_ctx)
|
||||
return AVERROR(EINVAL);
|
||||
input_frames_ctx = (AVHWFramesContext*)input->hw_frames_ctx->data;
|
||||
|
||||
output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
||||
if (!output) {
|
||||
|
||||
@@ -3392,6 +3392,8 @@ static int barrelsplit_to_xyz(const V360Context *s,
|
||||
l_y = 0.5f;
|
||||
l_z = (-0.5f + vf) / scaleh;
|
||||
break;
|
||||
default:
|
||||
av_assert0(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -899,7 +899,7 @@ static void vertopen##name##_transition(AVFilterContext *ctx,
|
||||
{ \
|
||||
XFadeContext *s = ctx->priv; \
|
||||
const int width = out->width; \
|
||||
const float w2 = out->width / 2; \
|
||||
const float w2 = out->width / 2.0; \
|
||||
\
|
||||
for (int y = slice_start; y < slice_end; y++) { \
|
||||
for (int x = 0; x < width; x++) { \
|
||||
@@ -926,7 +926,7 @@ static void vertclose##name##_transition(AVFilterContext *ctx,
|
||||
{ \
|
||||
XFadeContext *s = ctx->priv; \
|
||||
const int width = out->width; \
|
||||
const float w2 = out->width / 2; \
|
||||
const float w2 = out->width / 2.0; \
|
||||
\
|
||||
for (int y = slice_start; y < slice_end; y++) { \
|
||||
for (int x = 0; x < width; x++) { \
|
||||
@@ -953,7 +953,7 @@ static void horzopen##name##_transition(AVFilterContext *ctx,
|
||||
{ \
|
||||
XFadeContext *s = ctx->priv; \
|
||||
const int width = out->width; \
|
||||
const float h2 = out->height / 2; \
|
||||
const float h2 = out->height / 2.0; \
|
||||
\
|
||||
for (int y = slice_start; y < slice_end; y++) { \
|
||||
const float smooth = 2.f - fabsf((y - h2) / h2) - progress * 2.f; \
|
||||
@@ -980,7 +980,7 @@ static void horzclose##name##_transition(AVFilterContext *ctx,
|
||||
{ \
|
||||
XFadeContext *s = ctx->priv; \
|
||||
const int width = out->width; \
|
||||
const float h2 = out->height / 2; \
|
||||
const float h2 = out->height / 2.0; \
|
||||
\
|
||||
for (int y = slice_start; y < slice_end; y++) { \
|
||||
const float smooth = 1.f + fabsf((y - h2) / h2) - progress * 2.f; \
|
||||
|
||||
@@ -294,7 +294,9 @@ static int xfade_opencl_activate(AVFilterContext *avctx)
|
||||
if (ctx->first_pts + ctx->offset_pts > ctx->xf[0]->pts) {
|
||||
ctx->xf[0] = NULL;
|
||||
ctx->need_second = 0;
|
||||
ff_inlink_consume_frame(avctx->inputs[0], &in);
|
||||
ret = ff_inlink_consume_frame(avctx->inputs[0], &in);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return ff_filter_frame(outlink, in);
|
||||
}
|
||||
|
||||
@@ -303,8 +305,14 @@ static int xfade_opencl_activate(AVFilterContext *avctx)
|
||||
}
|
||||
|
||||
if (ctx->xf[0] && ff_inlink_queued_frames(avctx->inputs[1]) > 0) {
|
||||
ff_inlink_consume_frame(avctx->inputs[0], &ctx->xf[0]);
|
||||
ff_inlink_consume_frame(avctx->inputs[1], &ctx->xf[1]);
|
||||
ret = ff_inlink_consume_frame(avctx->inputs[0], &ctx->xf[0]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = ff_inlink_consume_frame(avctx->inputs[1], &ctx->xf[1]);
|
||||
if (ret < 0) {
|
||||
av_frame_free(&ctx->xf[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ctx->last_pts = ctx->xf[1]->pts;
|
||||
ctx->pts = ctx->xf[0]->pts;
|
||||
|
||||
@@ -129,7 +129,8 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
|
||||
|
||||
avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
|
||||
|
||||
avio_read(pb, buf, 8); /* APETAGEX */
|
||||
if(avio_read(pb, buf, 8) != 8) /* APETAGEX */
|
||||
return 0;
|
||||
if (strncmp(buf, APE_TAG_PREAMBLE, 8)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
|
||||
av_freep(pb);
|
||||
av_dict_copy(&tmp, *opts, 0);
|
||||
av_dict_copy(&tmp, opts2, 0);
|
||||
ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp);
|
||||
ret = ffio_open_whitelist(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp, s->protocol_whitelist, s->protocol_blacklist);
|
||||
if (ret >= 0) {
|
||||
// update cookies on http response with setcookies.
|
||||
char *new_cookies = NULL;
|
||||
@@ -1217,7 +1217,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
|
||||
close_in = 1;
|
||||
|
||||
av_dict_copy(&opts, c->avio_opts, 0);
|
||||
ret = avio_open2(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts);
|
||||
ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist);
|
||||
av_dict_free(&opts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -119,6 +119,8 @@ static int dxa_read_header(AVFormatContext *s)
|
||||
avio_skip(pb, fsize);
|
||||
}
|
||||
c->bpc = (fsize + (int64_t)c->frames - 1) / c->frames;
|
||||
if (c->bpc < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if(ast->codecpar->block_align) {
|
||||
if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -48,6 +48,31 @@ int av_match_ext(const char *filename, const char *extensions)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_match_url_ext(const char *url, const char *extensions)
|
||||
{
|
||||
const char *ext;
|
||||
URLComponents uc;
|
||||
int ret;
|
||||
char scratchpad[128];
|
||||
|
||||
if (!url)
|
||||
return 0;
|
||||
|
||||
ret = ff_url_decompose(&uc, url, NULL);
|
||||
if (ret < 0 || !URL_COMPONENT_HAVE(uc, scheme))
|
||||
return ret;
|
||||
for (ext = uc.query; *ext != '.' && ext > uc.path; ext--)
|
||||
;
|
||||
|
||||
if (*ext != '.')
|
||||
return 0;
|
||||
if (uc.query - ext > sizeof(scratchpad))
|
||||
return AVERROR(ENOMEM); //not enough memory in our scratchpad
|
||||
av_strlcpy(scratchpad, ext + 1, FFMIN(sizeof(scratchpad), uc.query - ext));
|
||||
|
||||
return av_match_name(scratchpad, extensions);
|
||||
}
|
||||
|
||||
ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
|
||||
const char *mime_type)
|
||||
{
|
||||
|
||||
+57
-1
@@ -208,6 +208,7 @@ typedef struct HLSContext {
|
||||
AVIOInterruptCB *interrupt_callback;
|
||||
AVDictionary *avio_opts;
|
||||
char *allowed_extensions;
|
||||
int extension_picky;
|
||||
int max_reload;
|
||||
int http_persistent;
|
||||
int http_multiple;
|
||||
@@ -712,6 +713,46 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int test_segment(AVFormatContext *s, const AVInputFormat *in_fmt, struct playlist *pls, struct segment *seg)
|
||||
{
|
||||
HLSContext *c = s->priv_data;
|
||||
int matchA = 3;
|
||||
int matchF = 0;
|
||||
|
||||
if (!c->extension_picky)
|
||||
return 0;
|
||||
|
||||
if (strcmp(c->allowed_extensions, "ALL"))
|
||||
matchA = av_match_ext (seg->url, c->allowed_extensions)
|
||||
+ 2*(ff_match_url_ext(seg->url, c->allowed_extensions) > 0);
|
||||
|
||||
if (!matchA) {
|
||||
av_log(s, AV_LOG_ERROR, "URL %s is not in allowed_extensions\n", seg->url);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (in_fmt) {
|
||||
if (in_fmt->extensions) {
|
||||
matchF = av_match_ext( seg->url, in_fmt->extensions)
|
||||
+ 2*(ff_match_url_ext(seg->url, in_fmt->extensions) > 0);
|
||||
if(av_match_name("mp4", in_fmt->name)) {
|
||||
matchF |= av_match_ext( seg->url, "ts,m2t,m2ts,mts,mpg,m4s,mpeg,mpegts")
|
||||
+ 2*(ff_match_url_ext(seg->url, "ts,m2t,m2ts,mts,mpg,m4s,mpeg,mpegts") > 0);
|
||||
}
|
||||
} else if (!strcmp(in_fmt->name, "mpegts")) {
|
||||
matchF = av_match_ext( seg->url, "ts,m2t,m2ts,mts,mpg,m4s,mpeg,mpegts")
|
||||
+ 2*(ff_match_url_ext(seg->url, "ts,m2t,m2ts,mts,mpg,m4s,mpeg,mpegts") > 0);
|
||||
}
|
||||
|
||||
if (!(matchA & matchF)) {
|
||||
av_log(s, AV_LOG_ERROR, "detected format %s extension %s mismatches allowed extensions in url %s\n", in_fmt->name, in_fmt->extensions ? in_fmt->extensions : "none", seg->url);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_playlist(HLSContext *c, const char *url,
|
||||
struct playlist *pls, AVIOContext *in)
|
||||
{
|
||||
@@ -944,6 +985,14 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = test_segment(c->ctx, pls->ctx ? pls->ctx->iformat : NULL, pls, seg);
|
||||
if (ret < 0) {
|
||||
av_free(seg->url);
|
||||
av_free(seg->key);
|
||||
av_free(seg);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (duration < 0.001 * AV_TIME_BASE) {
|
||||
av_log(c->ctx, AV_LOG_WARNING, "Cannot get correct #EXTINF value of segment %s,"
|
||||
" set to default value to 1ms.\n", seg->url);
|
||||
@@ -1981,6 +2030,11 @@ static int hls_read_header(AVFormatContext *s)
|
||||
pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE;
|
||||
url = av_strdup(pls->segments[0]->url);
|
||||
ret = av_probe_input_buffer(&pls->pb, &in_fmt, url, NULL, 0, 0);
|
||||
|
||||
for (int n = 0; n < pls->n_segments; n++)
|
||||
if (ret >= 0)
|
||||
ret = test_segment(s, in_fmt, pls, pls->segments[n]);
|
||||
|
||||
av_free(url);
|
||||
if (ret < 0) {
|
||||
/* Free the ctx - it isn't initialized properly at this point,
|
||||
@@ -2376,8 +2430,10 @@ static const AVOption hls_options[] = {
|
||||
OFFSET(allowed_extensions), AV_OPT_TYPE_STRING,
|
||||
{.str = "3gp,aac,avi,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
|
||||
INT_MIN, INT_MAX, FLAGS},
|
||||
{"extension_picky", "Be picky with all extensions matching",
|
||||
OFFSET(extension_picky), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS},
|
||||
{"max_reload", "Maximum number of times a insufficient list is attempted to be reloaded",
|
||||
OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 3}, 0, INT_MAX, FLAGS},
|
||||
OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 100}, 0, INT_MAX, FLAGS},
|
||||
{"m3u8_hold_counters", "The maximum number of times to load m3u8 when it refreshes without new segments",
|
||||
OFFSET(m3u8_hold_counters), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS},
|
||||
{"http_persistent", "Use persistent HTTP connections",
|
||||
|
||||
@@ -203,7 +203,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
AV_WL32(buf + 32, image->nb_pal);
|
||||
}
|
||||
|
||||
if (image->nb_pal > INT_MAX / 4 - 14 - 40)
|
||||
if (image->nb_pal > INT_MAX / 4 - 14 - 40U)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
|
||||
|
||||
@@ -359,6 +359,9 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt)
|
||||
uint64_t chunk_pos, data_pos, data_size;
|
||||
int ret = AVERROR_EOF;
|
||||
|
||||
if (s->nb_streams < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
while (!avio_feof(pb)) {
|
||||
chunk_pos = avio_tell(pb);
|
||||
if (chunk_pos >= iff->body_end)
|
||||
|
||||
+2
-1
@@ -68,7 +68,8 @@ static int ilbc_read_header(AVFormatContext *s)
|
||||
AVStream *st;
|
||||
uint8_t header[9];
|
||||
|
||||
avio_read(pb, header, 9);
|
||||
if (avio_read(pb, header, 9) != 9)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
st = avformat_new_stream(s, NULL);
|
||||
if (!st)
|
||||
|
||||
@@ -730,6 +730,15 @@ int ff_unlock_avformat(void);
|
||||
*/
|
||||
void ff_format_set_url(AVFormatContext *s, char *url);
|
||||
|
||||
/**
|
||||
* Return a positive value if the given url has one of the given
|
||||
* extensions, negative AVERROR on error, 0 otherwise.
|
||||
*
|
||||
* @param url url to check against the given extensions
|
||||
* @param extensions a comma-separated list of filename extensions
|
||||
*/
|
||||
int ff_match_url_ext(const char *url, const char *extensions);
|
||||
|
||||
#define FF_PACKETLIST_FLAG_REF_PACKET (1 << 0) /**< Create a new reference for the packet instead of
|
||||
transferring the ownership of the existing one to the
|
||||
list. */
|
||||
|
||||
@@ -639,7 +639,8 @@ static int ipmovie_read_header(AVFormatContext *s)
|
||||
|
||||
ipmovie->avf = s;
|
||||
|
||||
avio_read(pb, signature_buffer, sizeof(signature_buffer));
|
||||
if (avio_read(pb, signature_buffer, sizeof(signature_buffer)) != sizeof(signature_buffer))
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (memcmp(signature_buffer, signature, sizeof(signature))) {
|
||||
memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
|
||||
signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb);
|
||||
|
||||
@@ -94,7 +94,7 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags)
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
if (av_strstart(uri, "zmq:", &uri)) {
|
||||
if (!av_strstart(uri, "zmq:", &uri)) {
|
||||
av_log(h, AV_LOG_ERROR, "URL %s lacks prefix\n", uri);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
+3
-3
@@ -94,15 +94,15 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) {
|
||||
av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n");
|
||||
return AVERROR(EIO);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (packet_size > LMLM4_MAX_PACKET_SIZE || packet_size<=8) {
|
||||
av_log(s, AV_LOG_ERROR, "packet size %d is invalid\n", packet_size);
|
||||
return AVERROR(EIO);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
|
||||
return AVERROR(EIO);
|
||||
return ret < 0 ? ret : AVERROR(EIO);
|
||||
|
||||
avio_skip(pb, padding);
|
||||
|
||||
|
||||
@@ -4064,9 +4064,10 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
|
||||
// The prebuffer ends in the last Cue. Estimate how much data was
|
||||
// prebuffered.
|
||||
pre_bytes = desc_end.end_offset - desc_end.start_offset;
|
||||
pre_ns = desc_end.end_time_ns - desc_end.start_time_ns;
|
||||
if (pre_ns <= 0)
|
||||
if (desc_end.end_time_ns <= desc_end.start_time_ns ||
|
||||
desc_end.end_time_ns - (uint64_t)desc_end.start_time_ns > INT64_MAX)
|
||||
return -1;
|
||||
pre_ns = desc_end.end_time_ns - desc_end.start_time_ns;
|
||||
pre_sec = pre_ns / nano_seconds_per_second;
|
||||
prebuffer_bytes +=
|
||||
pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec);
|
||||
@@ -4079,7 +4080,7 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
|
||||
int64_t desc_bytes = desc_end.end_offset - desc_beg.start_offset;
|
||||
int64_t desc_ns = desc_end.end_time_ns - desc_beg.start_time_ns;
|
||||
double desc_sec, calc_bits_per_second, percent, mod_bits_per_second;
|
||||
if (desc_bytes <= 0)
|
||||
if (desc_bytes <= 0 || desc_bytes > INT64_MAX/8)
|
||||
return -1;
|
||||
|
||||
desc_sec = desc_ns / nano_seconds_per_second;
|
||||
|
||||
+14
-6
@@ -82,13 +82,15 @@ static int check_file_header(AVIOContext *pb, uint64_t guid)
|
||||
static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, unsigned size)
|
||||
{
|
||||
char * value = av_malloc(size + 1);
|
||||
int ret;
|
||||
|
||||
if (!value) {
|
||||
avio_skip(pb, size);
|
||||
return;
|
||||
}
|
||||
|
||||
avio_read(pb, value, size);
|
||||
if (!value[0]) {
|
||||
ret = avio_read(pb, value, size);
|
||||
if (ret != size || !value[0]) {
|
||||
av_free(value);
|
||||
return;
|
||||
}
|
||||
@@ -427,19 +429,25 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
|
||||
if (size < 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, 12); //timestamp, frameNumber
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
size -= 12;
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (size < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, 8); // cropPosX, cropPosY, panPosX, panPosY
|
||||
size -= 8;
|
||||
}
|
||||
space = avio_rl32(pb);
|
||||
if (size < space + 4LL)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, space);
|
||||
size -= space;
|
||||
|
||||
if ((mlv->class[st->id] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA))) {
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
ret = av_get_packet(pb, pkt, (st->codecpar->width * st->codecpar->height * st->codecpar->bits_per_coded_sample + 7) >> 3);
|
||||
} else { // AVMEDIA_TYPE_AUDIO
|
||||
if (space > UINT_MAX - 24 || size < (24 + space))
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = av_get_packet(pb, pkt, size - (24 + space));
|
||||
ret = av_get_packet(pb, pkt, size - 4);
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
|
||||
+3
-1
@@ -554,7 +554,9 @@ redo:
|
||||
static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
|
||||
unsigned char buf[8];
|
||||
|
||||
avio_read(s->pb, buf, 8);
|
||||
ret = avio_read(s->pb, buf, 8);
|
||||
if (ret != 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_seek(s->pb, -8, SEEK_CUR);
|
||||
if (!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
|
||||
codec_id = AV_CODEC_ID_CAVS;
|
||||
|
||||
@@ -1639,6 +1639,8 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,
|
||||
MP4DescrParseContext d;
|
||||
int ret;
|
||||
|
||||
d.predefined_SLConfigDescriptor_seen = 0;
|
||||
|
||||
ret = init_MP4DescrParseContext(&d, s, buf, size, descr, max_descr_count);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+2
-1
@@ -251,7 +251,8 @@ static int read_table(AVFormatContext *avctx, AVStream *st,
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_EOF;
|
||||
|
||||
avio_read(pb, name, 16);
|
||||
if (avio_read(pb, name, 16) != 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
name[sizeof(name) - 1] = 0;
|
||||
size = avio_rb32(pb);
|
||||
if (size < 0) {
|
||||
|
||||
+14
-4
@@ -612,7 +612,8 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
|
||||
if (size < 32 || size - 32 < orig_size || (int)orig_size != orig_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_read(pb, ivec, 16);
|
||||
avio_read(pb, tmpbuf, 16);
|
||||
if (avio_read(pb, tmpbuf, 16) != 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (mxf->aesc)
|
||||
av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1);
|
||||
if (memcmp(tmpbuf, checkv, 16))
|
||||
@@ -1289,7 +1290,8 @@ static int mxf_read_indirect_value(void *arg, AVIOContext *pb, int size)
|
||||
if (size <= 17)
|
||||
return 0;
|
||||
|
||||
avio_read(pb, key, 17);
|
||||
if (avio_read(pb, key, 17) != 17)
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* TODO: handle other types of of indirect values */
|
||||
if (memcmp(key, mxf_indirect_value_utf16le, 17) == 0) {
|
||||
return mxf_read_utf16le_string(pb, size - 17, &tagged_value->value);
|
||||
@@ -1632,6 +1634,11 @@ static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_t
|
||||
return mxf_absolute_bodysid_offset(mxf, index_table->body_sid, offset_temp, offset_out, partition_out);
|
||||
} else {
|
||||
/* EditUnitByteCount == 0 for VBR indexes, which is fine since they use explicit StreamOffsets */
|
||||
if (s->edit_unit_byte_count && (s->index_duration > INT64_MAX / s->edit_unit_byte_count ||
|
||||
s->edit_unit_byte_count * s->index_duration > INT64_MAX - offset_temp)
|
||||
)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
offset_temp += s->edit_unit_byte_count * s->index_duration;
|
||||
}
|
||||
}
|
||||
@@ -2128,6 +2135,9 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t
|
||||
physical_track->edit_rate,
|
||||
source_track->edit_rate);
|
||||
|
||||
if (av_sat_add64(start_position, mxf_tc->start_frame) != start_position + (uint64_t)mxf_tc->start_frame)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (av_timecode_init(&tc, mxf_tc->rate, flags, start_position + mxf_tc->start_frame, mxf->fc) == 0) {
|
||||
mxf_add_timecode_metadata(&st->metadata, "timecode", &tc);
|
||||
return 0;
|
||||
@@ -3328,7 +3338,7 @@ static int mxf_get_next_track_edit_unit(MXFContext *mxf, MXFTrack *track, int64_
|
||||
a = -1;
|
||||
b = track->original_duration;
|
||||
while (b - 1 > a) {
|
||||
m = (a + b) >> 1;
|
||||
m = (a + (uint64_t)b) >> 1;
|
||||
if (mxf_edit_unit_absolute_offset(mxf, t, m, track->edit_rate, NULL, &offset, NULL, 0) < 0)
|
||||
return -1;
|
||||
if (offset < current_offset)
|
||||
@@ -3381,7 +3391,7 @@ static int64_t mxf_set_current_edit_unit(MXFContext *mxf, AVStream *st, int64_t
|
||||
int64_t new_edit_unit;
|
||||
MXFIndexTable *t = mxf_find_index_table(mxf, track->index_sid);
|
||||
|
||||
if (!t || track->wrapping == UnknownWrapped)
|
||||
if (!t || track->wrapping == UnknownWrapped || edit_unit > INT64_MAX - track->edit_units_per_packet)
|
||||
return -1;
|
||||
|
||||
if (mxf_edit_unit_absolute_offset(mxf, t, edit_unit + track->edit_units_per_packet, track->edit_rate, NULL, &next_ofs, NULL, 0) < 0 &&
|
||||
|
||||
@@ -34,7 +34,7 @@ static int nist_probe(const AVProbeData *p)
|
||||
|
||||
static int nist_read_header(AVFormatContext *s)
|
||||
{
|
||||
char buffer[256], coding[32] = "pcm", format[32] = "01";
|
||||
char buffer[256]= {0}, coding[32] = "pcm", format[32] = "01";
|
||||
int bps = 0, be = 0;
|
||||
int32_t header_size = -1;
|
||||
AVStream *st;
|
||||
|
||||
+2
-1
@@ -189,7 +189,8 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
|
||||
st->codecpar->channels = avio_rb16(pb);
|
||||
if (version == 5) {
|
||||
ast->deint_id = avio_rl32(pb);
|
||||
avio_read(pb, buf, 4);
|
||||
if (avio_read(pb, buf, 4) != 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
buf[4] = 0;
|
||||
} else {
|
||||
AV_WL32(buf, 0);
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ static AVRational read_fps(const char* line, int* error)
|
||||
line++;
|
||||
for (; *line>='0' && *line<='9'; line++) {
|
||||
// Truncate any numerator too large to fit into an int64_t
|
||||
if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
|
||||
if (num > (INT64_MAX - 9) / 10ULL || den > INT64_MAX / 10ULL)
|
||||
break;
|
||||
num = 10 * num + (*line - '0');
|
||||
den *= 10;
|
||||
|
||||
@@ -239,6 +239,7 @@ static int film_read_header(AVFormatContext *s)
|
||||
else if (film->audio_type != AV_CODEC_ID_NONE)
|
||||
audio_frame_counter += (film->sample_table[i].sample_size /
|
||||
(film->audio_channels * film->audio_bits / 8));
|
||||
film->sample_table[i].keyframe = 1;
|
||||
} else {
|
||||
film->sample_table[i].stream = film->video_stream_index;
|
||||
film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
|
||||
|
||||
@@ -561,7 +561,8 @@ static int viv_read_header(AVFormatContext *s)
|
||||
v = avio_r8(pb);
|
||||
avio_seek(pb, v, SEEK_CUR);
|
||||
|
||||
avio_read(pb, keybuffer, 187);
|
||||
if (avio_read(pb, keybuffer, 187) != 187)
|
||||
return AVERROR_INVALIDDATA;
|
||||
key = decode_key(keybuffer);
|
||||
viv->sb_key = key;
|
||||
|
||||
|
||||
+14
-6
@@ -49,22 +49,28 @@ static int vqf_probe(const AVProbeData *probe_packet)
|
||||
return AVPROBE_SCORE_EXTENSION;
|
||||
}
|
||||
|
||||
static void add_metadata(AVFormatContext *s, uint32_t tag,
|
||||
static int add_metadata(AVFormatContext *s, uint32_t tag,
|
||||
unsigned int tag_len, unsigned int remaining)
|
||||
{
|
||||
int len = FFMIN(tag_len, remaining);
|
||||
char *buf, key[5] = {0};
|
||||
int ret;
|
||||
|
||||
if (len == UINT_MAX)
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
buf = av_malloc(len+1);
|
||||
if (!buf)
|
||||
return;
|
||||
avio_read(s->pb, buf, len);
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = avio_read(s->pb, buf, len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (len != ret)
|
||||
return AVERROR_INVALIDDATA;
|
||||
buf[len] = 0;
|
||||
AV_WL32(key, tag);
|
||||
av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
|
||||
return av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
|
||||
}
|
||||
|
||||
static const AVMetadataConv vqf_metadata_conv[] = {
|
||||
@@ -162,7 +168,9 @@ static int vqf_read_header(AVFormatContext *s)
|
||||
avio_skip(s->pb, FFMIN(len, header_size));
|
||||
break;
|
||||
default:
|
||||
add_metadata(s, chunk_tag, len, header_size);
|
||||
ret = add_metadata(s, chunk_tag, len, header_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ static AVIOContext * wtvfile_open_sector(unsigned first_sector, uint64_t length,
|
||||
int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4);
|
||||
int i;
|
||||
|
||||
wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS);
|
||||
wf->sectors = av_calloc(nb_sectors1, 1 << WTV_SECTOR_BITS);
|
||||
if (!wf->sectors) {
|
||||
av_free(wf);
|
||||
return NULL;
|
||||
@@ -849,7 +849,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
|
||||
int stream_index = ff_find_stream_index(s, sid);
|
||||
if (stream_index >= 0) {
|
||||
AVStream *st = s->streams[stream_index];
|
||||
uint8_t buf[258];
|
||||
uint8_t buf[258] = {0};
|
||||
const uint8_t *pbuf = buf;
|
||||
int buf_size;
|
||||
|
||||
@@ -862,7 +862,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
|
||||
}
|
||||
|
||||
buf_size = FFMIN(len - consumed, sizeof(buf));
|
||||
avio_read(pb, buf, buf_size);
|
||||
if (avio_read(pb, buf, buf_size) != buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
consumed += buf_size;
|
||||
ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, NULL, 0, 0, NULL);
|
||||
}
|
||||
|
||||
@@ -457,10 +457,12 @@ int av_match_list(const char *name, const char *list, char separator)
|
||||
if (k && (!p[k] || p[k] == separator))
|
||||
return 1;
|
||||
q = strchr(q, separator);
|
||||
q += !!q;
|
||||
if(q)
|
||||
q++;
|
||||
}
|
||||
p = strchr(p, separator);
|
||||
p += !!p;
|
||||
if (p)
|
||||
p++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+4
-4
@@ -27,8 +27,8 @@
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <sys/param.h>
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/cpu.h>
|
||||
#elif defined(__AMIGAOS4__)
|
||||
@@ -56,8 +56,8 @@ int ff_get_cpu_flags_ppc(void)
|
||||
if (result == VECTORTYPE_ALTIVEC)
|
||||
return AV_CPU_FLAG_ALTIVEC;
|
||||
return 0;
|
||||
#elif defined(__APPLE__) || defined(__OpenBSD__)
|
||||
#ifdef __OpenBSD__
|
||||
#elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
|
||||
#else
|
||||
int sels[2] = {CTL_HW, HW_VECTORUNIT};
|
||||
|
||||
+19
-18
@@ -609,7 +609,7 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],
|
||||
|
||||
if (c->dither == SWS_DITHER_ED) {
|
||||
int err = 0;
|
||||
int acc = 0;
|
||||
unsigned acc = 0;
|
||||
for (i = 0; i < dstW; i +=2) {
|
||||
int Y;
|
||||
|
||||
@@ -631,7 +631,8 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],
|
||||
c->dither_error[0][i] = err;
|
||||
} else {
|
||||
for (i = 0; i < dstW; i += 8) {
|
||||
int Y, acc = 0;
|
||||
int Y;
|
||||
unsigned acc = 0;
|
||||
|
||||
Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;
|
||||
accumulate_bit(acc, Y + d128[0]);
|
||||
@@ -666,7 +667,7 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0,
|
||||
|
||||
if (c->dither == SWS_DITHER_ED) {
|
||||
int err = 0;
|
||||
int acc = 0;
|
||||
unsigned acc = 0;
|
||||
for (i = 0; i < dstW; i +=2) {
|
||||
int Y;
|
||||
|
||||
@@ -688,7 +689,7 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0,
|
||||
c->dither_error[0][i] = err;
|
||||
} else {
|
||||
for (i = 0; i < dstW; i += 8) {
|
||||
int acc = 0;
|
||||
unsigned acc = 0;
|
||||
accumulate_bit(acc, ((buf0[i + 0] + 64) >> 7) + d128[0]);
|
||||
accumulate_bit(acc, ((buf0[i + 1] + 64) >> 7) + d128[1]);
|
||||
accumulate_bit(acc, ((buf0[i + 2] + 64) >> 7) + d128[2]);
|
||||
@@ -1090,8 +1091,8 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
|
||||
av_assert2(uvalpha <= 4096U);
|
||||
|
||||
for (i = 0; i < ((dstW + 1) >> 1); i++) {
|
||||
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
|
||||
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
|
||||
unsigned Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
|
||||
unsigned Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
|
||||
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;
|
||||
int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14;
|
||||
int R, G, B;
|
||||
@@ -1115,20 +1116,20 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
|
||||
A2 += 1 << 13;
|
||||
}
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
@@ -1289,9 +1290,9 @@ yuv2rgba64_full_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
// 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y)>>14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y)>>14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y)>>14) + (1<<15), 16));
|
||||
output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + (unsigned)Y)>>14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2(((int)( G + (unsigned)Y)>>14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + (unsigned)Y)>>14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
|
||||
dest += 4;
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ static int alloc_lines(SwsSlice *s, int size, int width)
|
||||
for (j = 0; j < n; ++j) {
|
||||
// chroma plane line U and V are expected to be contiguous in memory
|
||||
// by mmx vertical scaler code
|
||||
s->plane[i].line[j] = av_malloc(size * 2 + 32);
|
||||
s->plane[i].line[j] = av_mallocz(size * 2 + 32);
|
||||
if (!s->plane[i].line[j]) {
|
||||
free_lines(s);
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -225,7 +225,7 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
|
||||
int i;
|
||||
int32_t *dst = (int32_t *) _dst;
|
||||
for (i = 0; i < width; i++)
|
||||
dst[i] = (dst[i]*(14071/4) + (33561947<<4)/4)>>12;
|
||||
dst[i] = ((int)(dst[i]*(14071U/4) + (33561947<<4)/4)) >> 12;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user