New upstream version 7.1.4

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
nyanmisaka
2026-05-25 19:01:52 +08:00
parent 613dc1a1c2
commit 6b4a8b2a2f
229 changed files with 2165 additions and 698 deletions
+23
View File
@@ -0,0 +1,23 @@
exclude: ^tests/ref/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-shebang-scripts-are-executable
- id: check-yaml
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: local
hooks:
- id: aarch64-asm-indent
name: fix aarch64 assembly indentation
files: ^.*/aarch64/.*\.S$
language: script
entry: ./tools/check_arm_indent.sh --apply
pass_filenames: false
+29
View File
@@ -0,0 +1,29 @@
name: Lint
on:
push:
branches:
- release/7.1
pull_request:
jobs:
lint:
name: Pre-Commit
runs-on: utilities
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pre-commit CI
id: install
run: |
python3 -m venv ~/pre-commit
~/pre-commit/bin/pip install --upgrade pip setuptools
~/pre-commit/bin/pip install pre-commit
echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
- name: Cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ steps.install.outputs.envhash }}
- name: Run pre-commit CI
run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
+80
View File
@@ -0,0 +1,80 @@
name: Test
on:
push:
branches:
- release/7.1
pull_request:
jobs:
run_fate:
name: Fate (${{ matrix.runner }}, ${{ matrix.shared }}, ${{ matrix.bits }} bit)
strategy:
fail-fast: false
matrix:
runner: [linux-aarch64]
shared: ['static']
bits: ['64']
include:
- runner: linux-amd64
shared: 'static'
bits: '32'
- runner: linux-amd64
shared: 'shared'
bits: '64'
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure
run: |
./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
$([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
$([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
|| CFGRES=$? && CFGRES=$?
cat ffbuild/config.log
exit $CFGRES
- name: Build
run: make -j$(nproc)
- name: Restore Cached Fate-Suite
id: cache
uses: actions/cache/restore@v4
with:
path: fate-suite
key: fate-suite
restore-keys: |
fate-suite-
- name: Sync Fate-Suite
id: fate
run: |
make fate-rsync SAMPLES=$PWD/fate-suite
echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
- name: Cache Fate-Suite
uses: actions/cache/save@v4
if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }}
with:
path: fate-suite
key: fate-suite-${{ steps.fate.outputs.hash }}
- name: Run Fate
run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
compile_only:
name: Fate (Win64, Build-Only)
strategy:
fail-fast: false
matrix:
image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl-7.1:latest"]
runs-on: linux-amd64
container: ${{ matrix.image }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure
run: |
./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
--cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
--extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
--extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
- name: Build
run: make -j$(nproc)
- name: Run Fate
run: make -j$(nproc) fate-build
+9 -9
View File
@@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
@@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -158,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@@ -267,7 +267,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
@@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
+242
View File
@@ -1,6 +1,248 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version 7.1.4:
avcodec/dfpwmdec: Check nb_samples
avcodec/alsdec: do not set nbits invalidly
swscale/swscale_unscaled: adjust last line copy
avformat/avidec: check LIST size in avi_load_index()
avformat/avidec: validate INFO list size before parsing
avformat/matroskadec: Check audio.sub_packet_h * audio.frame_size
libavformat/xwma: fix overflow in seek position
avformat/pcm: Use 64bit for byte_rate
avcodec/hevc/ps: validate rep_format dimensions in multi-layer SPS
avfilter/vf_kerndeint: Check for minimum height
avcodec/ralf: Add the missing return statement after the error log
avfilter/vf_codecview: Clamp block to the visible frame region
avcodec/zmbv: reject XOR data that overruns the decompression buffer
avcodec/rasc: fix heap use-after-free in decode_move()
avformat/rtpdec_mpeg4: reject zero-length AU header sections
avcodec/hevc/refs: Check multiplication in alloc_frame()
fftools/ffmpeg_opt: validate stream index in negative map handling
avformat/rtmpproto: prevent integer overflow accumulating FLV buffer size
avformat/rtmpproto: validate compressed SWF header length
avformat/rtsp: Fix out-of-bounds read in SDP parser when control_url is empty
avformat/rtpdec_latm: avoid integer overflow in LATM length parsing
avcodec/h264: recompute per-slice direct mode state for every slice
avcodec/h264_refs: Clear stale pointers from ref_list
avcodec/pdvdec: Check input space before buffer allocation
avformat/concat: guard total_size overflow
avformat/iamf_parse.c: Fix potential integer overflow in opus_decoder_config()
avcodec/wmaenc: Fix missing padding in extradata
avformat: Fix various extradata padding issues
avcodec/tdsc: remove double stride adjustment
avformat/cafdec: fix negative index use in read_seek
avcodec/notchlc: Check 255 loops
avformat/rtpdec_jpeg: check qtable_len
avformat/vividas: use-of-uninitialized-value in keybuffer
avcodec/tdsc: Check jpeg size
avcodec/tdsc: Better input size check
avcodec/tdsc: Check tile_size
avcodec/decode: Better documentation for ff_set_dimensions()
avformat/mov: Limit maximum box size for mov_read_lhvc()
avformat/mov: reject dimg references with zero entries
avformat/mov: check extradata in mov_read_dops()
avformat/mov: Check read size for opus extradata
avformat/rtspdec: reject non-positive ANNOUNCE Content-Length
avformat/wavdec: Fix use-of-uninitialized-value in find_guid()
lavfi: vf_drawtext: check memory allocation
avcodec/svq1dec: Check input space for minimum
avcodec/vp9: Rollback dimensions when format is rejected
avformat/rtpdec_qdm2: Check block_size
avfilter/vf_ssim360: fix integer overflow in tape_length allocation
avcodec/escape130: Initialize old_y_avg
avutil/samplefmt: Dont claim that av_get_sample_fmt_string checks sample_fmt
avformat: check avio_read() return values in dss/dtshd/mlv
avcodec/aac/aacdec_usac: Implement missing bits of otts_bands_phase and residual_bands computation
avcodec/alsdec: preserve full float value in zero-truncated samples
avcodec/alsdec: propagate read_diff_float_data() errors in read_frame_data()
avcodec/alsdec: fix mantissa unpacking in compressed Part A path
avfilter/vf_drawtext: fix newline rendered as .notdef glyph
libavfilter/vf_v360: fix operator precedence in stereo loop condition
avcodec/alsdec: fix abs(INT_MIN) UB in read_diff_float_data()
avformat/rsd: reject short ADPCM_THP extradata reads
avformat/mov: Handle integer overflow in MOV parser
avcodec/dvdsub_parser: Fix buf_size check
avfilter/af_pan: fix sscanf() return value checks in parse_channel_name
avutil/bswap: fix implicit conversion warning in av_bswap64
avcodec/h2645_sei: don't use provider_code uninitialized
avformat/mpegts: fix descriptor accounting across multiple IOD descriptors
avcodec/xxan: zero-initialize y_buffer
avcodec/exr: Check input space before reverse_lut()
avcodec/cbs_h266_syntax_template: Check tile_y
avcodec/h264_slice: reject slice_num >= 0xFFFF
lavfi/bwdif: fix heap-buffer-overflow with small height videos
avcodec/cbs_h266_syntax_template: Fix w/h typo
aacdec_usac: skip FD-specific decoding for LPD channels
avutil/timecode: Check for integer overflow in av_timecode_init_from_components()
avcodec/cbs_h266_syntax_template: Fix rows vs columns
avformat/mov: do not allocate out-of-range buffers
avfilter/af_lv2: call lilv_instance_activate before lilv_instance_run
avformat/rtmpproto: fix listen_timeout conversion for special negative values
avcodec/aom_film_grain: Remove impossible check
avcodec/aom_film_grain: avoid duplicate indexes in ff_aom_parse_film_grain_sets()
swscale/output: fix integer overflows in chroma in yuv2rgba64_X_c_template()
avcodec/lcldec: Fixes uqvq overflow
fftools/ffmpeg_demux: Check metadata provided filename
avcodec/av1dec: sync frame header and tile group behavior with CBS
avformat/mlvdec: avoid uninitialized read in read_string()
avcodec/magicyuv: fix small median images
swscale/output: Fix integer overflow in alpha in yuv2rgba64_1_c_template()
swscale/utils: Check *Inc
avfilter/vf_scale: Fix integer overflow in config_props()
swscale/output: Fixes integer overflow in yuv2planeX_8_c
swscale/utils: initialize chroma when luma switched to cascade
avcodec/utils: fix duration computation based on frame_bytes
avcodec/cbs_h266_syntax_template: bound slice width/height by remaining tiles
avformat/rtsp: Pass blacklist
avformat/rtsp: Explicitly check protocol
avfilter/vf_convolution: Use avpriv_mirror
avfilter/vf_convolution: Handle corner cases with small frames
avcodec/pnmdec: Check input size against width*height assuming at least 1bit per pixel
avformat/mov: Fix multiple issues related to mov_read_iref_dimg()
avcodec/snowenc: avoid NULL ptr arithmetic
avformat/mov: use 64bit in CENC subsample bounds checks
avutil/eval: Check depth of AVExpr
avformat/vividas: Reset n_audio_subpackets on error
avformat/matroskadec: Check that end_time_ns >= start_time_ns
avcodec/vp3: Sanity check cropping
avformat/dhav: Check avio_seek() return
avformat/segafilm: dont read uninitialized value
avcodec/mpegvideo_enc: Restructure ff_h263_encode_gob_header() relation to update_mb_info()
avcodec/exr: check tile_attr.x/ySize
avformat/demux: Fix integer overflows in select_from_pts_buffer()
avcodec/golomb: Fix get_ur_golomb_jpegls() with esclen = 0
swresample/resample_template: add casts to avoid undefined overflows
avcodec/h264_parser: Check pts for overflow
avformat/rtpenc: use unsigned type for ssrc option
avformat/wtvdec: Check that language is fully read
avcodec/imm5: Dont pass EAGAIN on as is
avcodec/interplayacm: Check input for fill_block()
avcodec/hdrdec: Check input size before buffer allocation
avcodec/tmv: Move space check before buffer allocation
avcodec/flashsv: Check for input space before (re)allocating frame
avcodec/mdec: Check input space vs minimal block size
avcodec/h264_parser: Check remaining input length in loop in scan_mmco_reset()
avcodec/exr: fix AVERROR typo
avcodec/jpeg2000htdec: Check Lcup and Lref
avcodec/cfhd: Check transform type before continuing
avcodec/cfhd: Add CFHDSegment enum and named identifiers
avcodec/hevc/ps: Check bit_depth_cm in/out relation
avformat/icodec: Check size
avformat/lrcdec: Check ss for finiteness
avformat/http: Also count redirects from the cache
avformat/http: allow adjusting the redirect limit
fftools/ffmpeg_opt: limit recursion of presets
swscale/rgb2rgb_template: fix signed shift into sign bit
swresample: Check ch layouts in swr_alloc_set_opts2()
swresample: Check user chlayout in swr_set_matrix()
avcodec/bmp: fix indention
avcodec/exr: Handle axmax like bxmin in 04d7a6d3db56ea1a93908ff2d3d312e3fc40a58c
avformat/flvdec: Check *size in cts parsing
avformat/cafdec: Check nb_entries in read_info_chunk()
avcodec/vp9: Reallocate on resolution change which does not change tile_cols
avformat/img2dec: Check avio_size() for failure
avformat/mpegtsenc: Check remaining space in SDT
avformat/img2enc: Check split planes packet size
avformat/yuv4mpegen: Sanity check input packet frame dimensions
avformat/iff: Error out with 0 channel loudspeaker configuration
Fix overflow in STSD parser
avcodec/adpcm: Check input buffer size
avformat/scd: Use ffio_read_size()
avcodec/hevc/sei: Use get_bits64() in decode_nal_sei_3d_reference_displays_info()
avformat/hls: Check for integer overflow with #EXTINF:
avcodec/dca_xll: Clear padding in ff_dca_xll_parse()
vfilter/vf_find_rect: Clamp x/y min/max to valid values
avcodec/lzf: Remove size messing from ff_lzf_uncompress()
avcodec/dxv: Clear tex_data padding on reallocation
avcodec/dca_xll: Check get_rice_array()
avutil/dovi_meta: Document valid range for index of av_dovi_get_ext()
avformat/mpegts: Check program_info_length
avformat/mpegts: Check IOD_DESCRIPTOR len
avcodec/qdm2: fix heap-use-after-free in qdm2_decode_frame
avcodec/jpeg2000dec: Print bpno level when erroring out
avcodec/jpeg2000dec: allow M_b == 31
avcodec/jpeg2000dec: Print M_b value when asking for a sample
avformat/dashdec: check value valid after read value from mpd xml
swscale/utils: zero init filter memory as before
libavfilter/showcwt: fix OOB write for DU/RL position init
lavc/j2kdec: Do not ignore colour association for packed formats
swscale/utils: Sanity check sizeFactor
swscale/utils: Avoid FF_ALLOC_TYPED_ARRAY() and use av_malloc_array() directly
avcodec/mjpegdec: fix segfault on extern_huff and no extradata
avcodec/exr: use av_realloc_array()
avcodec/omx: Check extradata size and nFilledLen
lavc/aacdec_usac: fix CPE channel index in ff_aac_usac_reset_state()
avfilter/scale_eval: Use 64bit for factor_w/h
avfilter/scale_eval: Avoid undefined behavior with double to int cast
avformat/http: Check that the protocol of redirects is http or https
doc/mailing-list-faq.texi: Fix typo in link anchor
avfilter/vf_find_rect: Fix handling odd sized images
avcodec/notchlc: zero-initialize history buffer
avfilter/vf_stack: add checks for the final canvas dimensions
lavc/vvc: Prevent OOB write to slice_top_left_ctu_x in PPS CBS
avcodec/mjpegdec: only test the size bound in sequential mjpeg
avcodec/jpeg2000htdec: Check pLSB
avformat/hls: fix double space
avformat/hls: Check seg size and offset for overflow
avcodec/jpeg2000dec: Make M_b check broader
swscale/output: Use 64bit in addition in yuv2gbrp16_full_X_c() for RGB + Y
avformat/flac_picture: Correct check
avformat/demux: ensure avformat_find_stream_info updates internal stream contexts
avfilter/vf_neighbor_opencl: add error condition when filter name doesn't match
avfilter/vf_libopencv: make sure there is space for null-terminator in shape_str
avcodec/aacdec: Fix heap-use-after-free in USAC decoding
avdevice/gdigrab: suppress int to pointer cast warning
avutil/hwcontext_d3d12va: use hwdev context for logging
fate: add missing options in config template
avformat/hls_sample_encryption: add missing padding for audio setup buffer
(fforge/pr/22824) lavc/videotoolbox_vp9: fix vpcC flags offset
lavc/videotoolboxenc: return SEI parse errors
(fforge/pr/22407) aarch64/hpeldsp_neon: fix out-of-bounds read
(fforge/pr/22406, fforge/pr/22313) avformat/mov: fix cases where we discard iamf packets from enabled streams
avformat/mov: fix setting iamf stream id offsets
(fforge/pr/21698) avcodec/tableprint_vlc: Unbreak hardcoded tables
tests: Fix fate-run.sh to handle busybox-w32 absolute paths
configure: Recognize uname "Windows_NT" as using an .exe suffix
avformat/tests/movenc: Make objects static
(fforge/pr/21626) avcodec/libsvtav1: rename aq_mode for v4.0.0
(fforge/pr/21563) avformat/mov: add an offset to IAMF streams
(fforge/pr/21443) avfilter/vf_lcevc: attach a reference to the source frame to each passed in base picture
avfilter/vf_lcevc: support LCEVCdec version 4
avcodec/lcevc: attach a reference to the source frame to each passed in base picture
avcodec/lcevcdec: free pictures on error
avcodec/lcevcdec: fix input dimensions for the base picture
avcodec/lcevcdec: avoid copying the input frame
avcodec/decode: Optimize lcevc away if disabled
avcodec/decode: Put lcevc fields into structure of their own
avcodec/decode: Don't allocate LCEVC context for non-video
avcodec/lcevcdec: support LCEVCdec version 4
forgejo: backport CI job names
(fforge/pr/21337) avformat/img2dec: reject input images too big to fit into a single packet
(fforge/pr/21331) avformat/iamf_writer: check that stream count is consistent for ambisonic Audio Elements
avformat/iamf_writer: fix writting some ambisonics fields in Audio Elements
avformat/iamf_parse: fix setting denominator in AVIAMFLayer.demixing_matrix
(fforge/pr/21219) fate/ffmpeg: remove comparison against ref from fix_sub_duration_heartbeat
(fforge/pr/21146) configure: Lower libdvdnav and libdvdread minimum versions for EL9
(fforge/pr/20943) avformat/rtsp: fix leading space in RTSP reason
avformat/rtsp: do not log invalid values
avformat/http: Handle IPv6 Zone ID in hostname
avfilter/af_amerge: fix possible crash with custom layouts
avfilter/stack_internal: fix checkheaders test
all: apply linter fixes
forgejo: apply needed CI changes for 7.1
forgejo: backport CI to release/7.1
(fforge/pr/21089) avcodec/vp3: Sync VLCs once during init, fix crash
configure: unbreak glslang build
avformat/iamf_parse: fix compilation error
avfilter/vf_scale: don't attempt to rescale AV_NOPTS_VALUE
avfilter/framesync: don't attempt to rescale AV_NOPTS_VALUE
avformat/iamf_parse: ensure the stream count in a scalable channel representation is equal to the audio element's stream count
avformat/iamf_parse: ensure each layout in an scalable channel representation has an increasing number of channels
fftools/ffmpeg_filter: close all no-longer needed inputs
avfilter/buffersrc: add av_buffersrc_get_status()
version 7.1.3:
avutil/common: cast GET_BYTE/GET_16BIT returned value
avfilter/vf_drawtext: fix call GET_UTF8 with invalid argument
+1 -1
View File
@@ -1 +1 @@
7.1.3
7.1.4
+1 -1
View File
@@ -1 +1 @@
7.1.3
7.1.4
Vendored
+11 -7
View File
@@ -4734,7 +4734,7 @@ fi
exesuf() {
case $1 in
mingw32*|mingw64*|msys*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
mingw32*|mingw64*|msys*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian|windows_nt) echo .exe ;;
esac
}
@@ -6905,8 +6905,8 @@ enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d
enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdrm && check_pkg_config libdrm libdrm xf86drm.h drmGetVersion
enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" dvdnav/dvdnav.h dvdnav_open2
enabled libdvdread && require_pkg_config libdvdread "dvdread >= 6.1.2" dvdread/dvd_reader.h DVDOpen2
enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.0" dvdnav/dvdnav.h dvdnav_open2
enabled libdvdread && require_pkg_config libdvdread "dvdread >= 6.1.1" dvdread/dvd_reader.h DVDOpen2
enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
{ require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
warn "using libfdk without pkg-config"; } }
@@ -6917,12 +6917,16 @@ enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontco
enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
enabled libharfbuzz && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
if enabled libglslang; then
spvremap="-lSPVRemapper"
require_headers "glslang/build_info.h" && { test_cpp_condition glslang/build_info.h "GLSLANG_VERSION_MAJOR >= 16" && spvremap="" ; }
check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lMachineIndependent -lGenericCodeGen \
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ; }
${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ;
fi
enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
@@ -8213,7 +8217,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 2025
#define CONFIG_THIS_YEAR 2026
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
+3
View File
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
2025-09-xx - xxxxxxxxxx - lavfi 10.5.100 - buffersrc.h
Add av_buffersrc_get_status().
2024-09-23 - 6940a6de2f0 - lavu 59.38.100 - frame.h
Add AV_FRAME_DATA_VIEW_ID.
+1 -1
View File
@@ -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 = 7.1.3
PROJECT_NUMBER = 7.1.4
# 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
-1
View File
@@ -63,4 +63,3 @@ make -j<num>
make -k
Continue build in case of errors, this is useful for the regression tests
sometimes but note that it will still not run all reg tests.
+5
View File
@@ -11,16 +11,21 @@ ignore_tests=
# the following are optional and map to configure options
arch=
cpu=
toolchain=
cross_prefix=
as=
cc=
cxx=
ld=
nm=
target_os=
sysroot=
target_exec=
target_path=
target_samples=
extra_cflags=
extra_cxxflags=
extra_objcflags=
extra_ldflags=
extra_libs=
extra_conf= # extra configure options not covered above
-1
View File
@@ -96,4 +96,3 @@ IRC:
~~~~
irc channels are at https://libera.chat/
irc channel archives are at https://libera.irclog.whitequark.org
+1 -1
View File
@@ -341,7 +341,7 @@ recommended.
Avoid sending the same message to multiple mailing lists.
@item
Please follow our @url{https://ffmpeg.org/community.html#Code-of-conduct, Code of Conduct}.
Please follow our @url{https://ffmpeg.org/community.html#Code-of-Conduct, Code of Conduct}.
@end itemize
@chapter Help
-1
View File
@@ -157,4 +157,3 @@ PFD[32] would for example be signed 32 bit little-endian IEEE float
@item XVID @tab non-compliant MPEG-4 generated by old Xvid
@item XVIX @tab non-compliant MPEG-4 generated by old Xvid with interlacing bug
@end multitable
Regular → Executable
View File
Regular → Executable
View File
-1
View File
@@ -44,4 +44,3 @@ a+b*c;
here the reader knows that a,b,c are meant to be signed integers but for C
standard compliance / to avoid undefined behavior they are stored in unsigned
ints.
+2
View File
@@ -254,6 +254,8 @@ typedef struct OptionsContext {
SpecifierOptList enc_stats_pre_fmt;
SpecifierOptList enc_stats_post_fmt;
SpecifierOptList mux_stats_fmt;
int depth;
} OptionsContext;
enum IFilterFlags {
+56 -1
View File
@@ -1560,6 +1560,56 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st, AVDictiona
return 0;
}
static int is_windows_reserved_device_name(const char *f)
{
#if HAVE_DOS_PATHS
for (const char *p = f; p && *p; ) {
char stem[6], *s;
av_strlcpy(stem, p, sizeof(stem));
if ((s = strchr(stem, '.')))
*s = 0;
if ((s = strpbrk(stem, "123456789")))
*s = '1';
if( !av_strcasecmp(stem, "AUX") ||
!av_strcasecmp(stem, "CON") ||
!av_strcasecmp(stem, "NUL") ||
!av_strcasecmp(stem, "PRN") ||
!av_strcasecmp(stem, "COM1") ||
!av_strcasecmp(stem, "LPT1")
)
return 1;
p = strchr(p, '/');
if (p)
p++;
}
#endif
return 0;
}
static int safe_filename(const char *f, int allow_subdir)
{
const char *start = f;
if (!*f || is_windows_reserved_device_name(f))
return 0;
for (; *f; f++) {
/* A-Za-z0-9_- */
if (!((unsigned)((*f | 32) - 'a') < 26 ||
(unsigned)(*f - '0') < 10 || *f == '_' || *f == '-')) {
if (f == start)
return 0;
else if (allow_subdir && *f == '/')
start = f + 1;
else if (*f != '.')
return 0;
}
}
return 1;
}
static int dump_attachment(InputStream *ist, const char *filename)
{
AVStream *st = ist->st;
@@ -1571,8 +1621,13 @@ static int dump_attachment(InputStream *ist, const char *filename)
av_log(ist, AV_LOG_WARNING, "No extradata to dump.\n");
return 0;
}
if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0)))
if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0))) {
filename = e->value;
if (!safe_filename(filename, 0)) {
av_log(ist, AV_LOG_ERROR, "Filename %s is unsafe\n", filename);
return AVERROR(EINVAL);
}
}
if (!*filename) {
av_log(ist, AV_LOG_FATAL, "No filename specified and no 'filename' tag");
return AVERROR(EINVAL);
+20 -1
View File
@@ -2365,6 +2365,18 @@ finish:
fps->dropped_keyframe |= fps->last_dropped && (frame->flags & AV_FRAME_FLAG_KEY);
}
static void close_input(FilterGraph *fg, int input_idx)
{
InputFilterPriv *ifp = ifp_from_ifilter(fg->inputs[input_idx]);
FilterGraphPriv *fgp = fgp_from_fg(ifp->ifilter.graph);
if (!ifp->eof) {
sch_filter_receive_finish(fgp->sch, fgp->sch_idx, input_idx);
ifp->eof = 1;
}
}
static int close_output(OutputFilterPriv *ofp, FilterGraphThread *fgt)
{
FilterGraphPriv *fgp = fgp_from_fg(ofp->ofilter.graph);
@@ -3035,7 +3047,7 @@ static int filter_thread(void *arg)
if (ret == AVERROR_EOF) {
av_log(fg, AV_LOG_VERBOSE, "Input %u no longer accepts new data\n",
input_idx);
sch_filter_receive_finish(fgp->sch, fgp->sch_idx, input_idx);
close_input(fg, input_idx);
continue;
}
if (ret < 0)
@@ -3052,6 +3064,13 @@ read_frames:
av_err2str(ret));
goto finish;
}
// ensure all inputs no longer accepting data are closed
for (int i = 0; fgt.graph && i < fg->nb_inputs; i++) {
InputFilterPriv *ifp = ifp_from_ifilter(fg->inputs[i]);
if (av_buffersrc_get_status(ifp->filter))
close_input(fg, i);
}
}
for (unsigned i = 0; i < fg->nb_outputs; i++) {
+10
View File
@@ -545,6 +545,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
for (i = 0; i < o->nb_stream_maps; i++) {
m = &o->stream_maps[i];
if (file_idx == m->file_index &&
m->stream_index >= 0 &&
m->stream_index < input_files[m->file_index]->nb_streams &&
stream_specifier_match(&ss,
input_files[m->file_index]->ctx,
input_files[m->file_index]->ctx->streams[m->stream_index],
@@ -1008,6 +1010,12 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
char filename[1000], line[1000], tmp_line[1000];
const char *codec_name = NULL;
int ret = 0;
int depth = o->depth;
if (depth > 2) {
av_log(NULL, AV_LOG_ERROR, "too deep recursion\n");
return AVERROR(EINVAL);
}
codec_name = opt_match_per_type_str(&o->codec_names, *opt);
@@ -1019,6 +1027,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
return AVERROR(ENOENT);
}
o->depth ++;
while (fgets(line, sizeof(line), f)) {
char *key = tmp_line, *value, *endptr;
@@ -1046,6 +1055,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
}
fail:
o->depth = depth;
fclose(f);
return ret;
+1 -1
View File
@@ -46,7 +46,6 @@ OBJS = ac3_parser.o \
get_buffer.o \
imgconvert.o \
jni.o \
lcevcdec.o \
mathtables.o \
mediacodec.o \
mpeg12framerate.o \
@@ -124,6 +123,7 @@ OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o
OBJS-$(CONFIG_JNI) += ffjni.o jni.o
OBJS-$(CONFIG_JPEGTABLES) += jpegtables.o
OBJS-$(CONFIG_LCMS2) += fflcms2.o
OBJS-$(CONFIG_LIBLCEVC_DEC) += lcevcdec.o
OBJS-$(CONFIG_LLAUDDSP) += lossless_audiodsp.o
OBJS-$(CONFIG_LLVIDDSP) += lossless_videodsp.o
OBJS-$(CONFIG_LLVIDENCDSP) += lossless_videoencdsp.o
+6
View File
@@ -164,6 +164,12 @@ static av_cold int che_configure(AACDecContext *ac,
}
} else {
if (ac->che[type][id]) {
for (int i = 0; i < FF_ARRAY_ELEMS(ac->tag_che_map); i++) {
for (int j = 0; j < MAX_ELEM_ID; j++) {
if (ac->tag_che_map[i][j] == ac->che[type][id])
ac->tag_che_map[i][j] = NULL;
}
}
ac->proc.sbr_ctx_close(ac->che[type][id]);
}
av_freep(&ac->che[type][id]);
+24 -7
View File
@@ -213,18 +213,33 @@ static int decode_usac_element_pair(AACDecContext *ac,
if (e->stereo_config_index) {
e->mps.freq_res = get_bits(gb, 3); /* bsFreqRes */
if (!e->mps.freq_res)
return AVERROR_INVALIDDATA; /* value 0 is reserved */
int numBands = ((int[]){0,28,20,14,10,7,5,4})[e->mps.freq_res]; // ISO/IEC 23003-1:2007, 5.2, Table 39
e->mps.fixed_gain = get_bits(gb, 3); /* bsFixedGainDMX */
e->mps.temp_shape_config = get_bits(gb, 2); /* bsTempShapeConfig */
e->mps.decorr_config = get_bits(gb, 2); /* bsDecorrConfig */
e->mps.high_rate_mode = get_bits1(gb); /* bsHighRateMode */
e->mps.phase_coding = get_bits1(gb); /* bsPhaseCoding */
if (get_bits1(gb)) /* bsOttBandsPhasePresent */
e->mps.otts_bands_phase = get_bits(gb, 5); /* bsOttBandsPhase */
int otts_bands_phase = ((int[]){0,10,10,7,5,3,2,2})[e->mps.freq_res]; // Table 109 — Default value of bsOttBandsPhase
if (get_bits1(gb)) { /* bsOttBandsPhasePresent */
otts_bands_phase = get_bits(gb, 5); /* bsOttBandsPhase */
if (otts_bands_phase > numBands)
return AVERROR_INVALIDDATA;
}
e->mps.otts_bands_phase = otts_bands_phase;
e->mps.residual_coding = e->stereo_config_index >= 2; /* bsResidualCoding */
if (e->mps.residual_coding) {
e->mps.residual_bands = get_bits(gb, 5); /* bsResidualBands */
int residual_bands = get_bits(gb, 5); /* bsResidualBands */
if (residual_bands > numBands)
return AVERROR_INVALIDDATA;
e->mps.residual_bands = residual_bands;
e->mps.otts_bands_phase = FFMAX(e->mps.otts_bands_phase,
e->mps.residual_bands);
e->mps.pseudo_lr = get_bits1(gb); /* bsPseudoLr */
}
if (e->mps.temp_shape_config == 2)
@@ -315,7 +330,7 @@ int ff_aac_usac_reset_state(AACDecContext *ac, OutputConfiguration *oc)
ff_aac_sbr_config_usac(ac, che, e);
for (int j = 0; j < ch; j++) {
SingleChannelElement *sce = &che->ch[ch];
SingleChannelElement *sce = &che->ch[j];
AACUsacElemData *ue = &sce->ue;
memset(ue, 0, sizeof(*ue));
@@ -1288,7 +1303,8 @@ static void spectrum_decode(AACDecContext *ac, AACUSACConfig *usac,
SingleChannelElement *sce = &cpe->ch[ch];
AACUsacElemData *ue = &sce->ue;
spectrum_scale(ac, sce, ue);
if (!ue->core_mode)
spectrum_scale(ac, sce, ue);
}
if (nb_channels > 1 && us->common_window) {
@@ -1338,8 +1354,9 @@ static void spectrum_decode(AACDecContext *ac, AACUSACConfig *usac,
if (sce->tns.present && ((nb_channels == 1) || (us->tns_on_lr)))
ac->dsp.apply_tns(sce->coeffs, &sce->tns, &sce->ics, 1);
ac->oc[1].m4ac.frame_length_short ? ac->dsp.imdct_and_windowing_768(ac, sce) :
ac->dsp.imdct_and_windowing(ac, sce);
if (!sce->ue.core_mode)
ac->oc[1].m4ac.frame_length_short ? ac->dsp.imdct_and_windowing_768(ac, sce) :
ac->dsp.imdct_and_windowing(ac, sce);
}
}
+30 -28
View File
@@ -50,12 +50,13 @@
.endm
.macro pixels16_x2 rnd=1, avg=0
1: ld1 {v0.16b, v1.16b}, [x1], x2
ld1 {v2.16b, v3.16b}, [x1], x2
1:
ldur q1, [x1, #1]
ld1 {v0.16b}, [x1], x2
subs w3, w3, #2
ext v1.16b, v0.16b, v1.16b, #1
ldur q3, [x1, #1]
ld1 {v2.16b}, [x1], x2
avg v0.16b, v0.16b, v1.16b
ext v3.16b, v2.16b, v3.16b, #1
avg v2.16b, v2.16b, v3.16b
.if \avg
ld1 {v1.16b}, [x0], x2
@@ -108,20 +109,20 @@
.macro pixels16_xy2 rnd=1, avg=0
sub w3, w3, #2
ld1 {v0.16b, v1.16b}, [x1], x2
ld1 {v4.16b, v5.16b}, [x1], x2
ldur q1, [x1, #1]
ld1 {v0.16b}, [x1], x2
NRND movi v26.8H, #1
ext v1.16b, v0.16b, v1.16b, #1
ext v5.16b, v4.16b, v5.16b, #1
ldur q5, [x1, #1]
ld1 {v4.16b}, [x1], x2
uaddl v16.8h, v0.8b, v1.8b
uaddl2 v20.8h, v0.16b, v1.16b
uaddl v18.8h, v4.8b, v5.8b
uaddl2 v22.8h, v4.16b, v5.16b
1: subs w3, w3, #2
ld1 {v0.16b, v1.16b}, [x1], x2
ldur q30, [x1, #1]
ld1 {v0.16b}, [x1], x2
add v24.8h, v16.8h, v18.8h
NRND add v24.8H, v24.8H, v26.8H
ext v30.16b, v0.16b, v1.16b, #1
add v1.8h, v20.8h, v22.8h
mshrn v28.8b, v24.8h, #2
NRND add v1.8H, v1.8H, v26.8H
@@ -131,12 +132,12 @@ NRND add v1.8H, v1.8H, v26.8H
urhadd v28.16b, v28.16b, v16.16b
.endif
uaddl v16.8h, v0.8b, v30.8b
ld1 {v2.16b, v3.16b}, [x1], x2
ldur q3, [x1, #1]
ld1 {v2.16b}, [x1], x2
uaddl2 v20.8h, v0.16b, v30.16b
st1 {v28.16b}, [x0], x2
add v24.8h, v16.8h, v18.8h
NRND add v24.8H, v24.8H, v26.8H
ext v3.16b, v2.16b, v3.16b, #1
add v0.8h, v20.8h, v22.8h
mshrn v30.8b, v24.8h, #2
NRND add v0.8H, v0.8H, v26.8H
@@ -150,10 +151,10 @@ NRND add v0.8H, v0.8H, v26.8H
st1 {v30.16b}, [x0], x2
b.gt 1b
ld1 {v0.16b, v1.16b}, [x1], x2
ldur q30, [x1, #1]
ld1 {v0.16b}, [x1], x2
add v24.8h, v16.8h, v18.8h
NRND add v24.8H, v24.8H, v26.8H
ext v30.16b, v0.16b, v1.16b, #1
add v1.8h, v20.8h, v22.8h
mshrn v28.8b, v24.8h, #2
NRND add v1.8H, v1.8H, v26.8H
@@ -206,10 +207,11 @@ NRND add v0.8H, v0.8H, v26.8H
.endm
.macro pixels8_x2 rnd=1, avg=0
1: ld1 {v0.8b, v1.8b}, [x1], x2
ext v1.8b, v0.8b, v1.8b, #1
ld1 {v2.8b, v3.8b}, [x1], x2
ext v3.8b, v2.8b, v3.8b, #1
1:
ldur d1, [x1, #1]
ld1 {v0.8b}, [x1], x2
ldur d3, [x1, #1]
ld1 {v2.8b}, [x1], x2
subs w3, w3, #2
avg v0.8b, v0.8b, v1.8b
avg v2.8b, v2.8b, v3.8b
@@ -263,22 +265,23 @@ NRND add v0.8H, v0.8H, v26.8H
.endm
.macro pixels8_xy2 rnd=1, avg=0
ldur d4, [x1, #1]
sub w3, w3, #2
ld1 {v0.16b}, [x1], x2
ld1 {v1.16b}, [x1], x2
ld1 {v0.8b}, [x1], x2
NRND movi v19.8H, #1
ext v4.16b, v0.16b, v4.16b, #1
ext v6.16b, v1.16b, v6.16b, #1
ldur d6, [x1, #1]
ld1 {v1.8b}, [x1], x2
uaddl v16.8h, v0.8b, v4.8b
uaddl v17.8h, v1.8b, v6.8b
1: subs w3, w3, #2
ld1 {v0.16b}, [x1], x2
ldur d4, [x1, #1]
ld1 {v0.8b}, [x1], x2
add v18.8h, v16.8h, v17.8h
ext v4.16b, v0.16b, v4.16b, #1
NRND add v18.8H, v18.8H, v19.8H
uaddl v16.8h, v0.8b, v4.8b
mshrn v5.8b, v18.8h, #2
ld1 {v1.16b}, [x1], x2
ldur d6, [x1, #1]
ld1 {v1.8b}, [x1], x2
add v18.8h, v16.8h, v17.8h
.if \avg
ld1 {v7.8b}, [x0]
@@ -291,14 +294,13 @@ NRND add v18.8H, v18.8H, v19.8H
ld1 {v5.8b}, [x0]
urhadd v7.8b, v7.8b, v5.8b
.endif
ext v6.16b, v1.16b, v6.16b, #1
uaddl v17.8h, v1.8b, v6.8b
st1 {v7.8b}, [x0], x2
b.gt 1b
ld1 {v0.16b}, [x1], x2
ldur d4, [x1, #1]
ld1 {v0.8b}, [x1], x2
add v18.8h, v16.8h, v17.8h
ext v4.16b, v0.16b, v4.16b, #1
NRND add v18.8H, v18.8H, v19.8H
uaddl v16.8h, v0.8b, v4.8b
mshrn v5.8b, v18.8h, #2
+2
View File
@@ -857,6 +857,8 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
if(ch <= 0)
return 0;
if (buf_size > INT_MAX / 2)
return 0;
switch (avctx->codec->id) {
/* constant, only check buf_size */
+13 -4
View File
@@ -1540,8 +1540,12 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
return AVERROR_INVALIDDATA;
}
j = 0;
for (i = 0; i < frame_length; ++i) {
ctx->raw_mantissa[c][i] = AV_RB32(larray);
if (ctx->raw_samples[c][i] == 0) {
ctx->raw_mantissa[c][i] = AV_RB32(larray + j);
j += 4;
}
}
}
}
@@ -1552,7 +1556,10 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
if (ctx->raw_samples[c][i] != 0) {
//The following logic is taken from Tabel 14.45 and 14.46 from the ISO spec
if (av_cmp_sf_ieee754(acf[c], FLOAT_1)) {
nbits[i] = 23 - av_log2(abs(ctx->raw_samples[c][i]));
int nbit = av_log2(FFABSU(ctx->raw_samples[c][i]));
if (nbit > 23)
return AVERROR_INVALIDDATA;
nbits[i] = 23 - nbit;
} else {
nbits[i] = 23;
}
@@ -1626,7 +1633,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
tmp_32 = (sign << 31) | ((e + EXP_BIAS) << 23) | (mantissa);
ctx->raw_samples[c][i] = tmp_32;
} else {
ctx->raw_samples[c][i] = raw_mantissa[c][i] & 0x007fffffUL;
ctx->raw_samples[c][i] = raw_mantissa[c][i];
}
}
align_get_bits(gb);
@@ -1782,7 +1789,9 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
}
if (sconf->floating) {
read_diff_float_data(ctx, ra_frame);
ret = read_diff_float_data(ctx, ra_frame);
if (ret < 0)
return ret;
}
if (get_bits_left(gb) < 0) {
+3 -2
View File
@@ -152,8 +152,9 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
payload_4byte = get_bits1(gb);
payload_size = get_bits(gb, payload_4byte ? 2 : 8);
set_idx = get_bits(gb, 3);
fgp = av_film_grain_params_alloc(&fgp_size);
if (!fgp)
if (!fgp || s->sets[set_idx])
goto error;
aom = &fgp->codec.aom;
@@ -212,7 +213,7 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
}
predict_scaling = get_bits1(gb);
if (predict_scaling && (!ref || ref == fgp))
if (predict_scaling && !ref)
goto error; // prediction must be from valid, different set
predict_y_scaling = predict_scaling ? get_bits1(gb) : 0;
-1
View File
@@ -48,4 +48,3 @@ function ff_scalarproduct_int16_neon, export=1
vmov.32 r0, d3[0]
bx lr
endfunc
+12 -4
View File
@@ -98,12 +98,11 @@ static int32_t decode_signed_subexp_with_ref(uint32_t sub_exp, int low,
static void read_global_param(AV1DecContext *s, int type, int ref, int idx)
{
uint8_t primary_frame, prev_frame;
int primary_frame;
uint32_t abs_bits, prec_bits, round, prec_diff, sub, mx;
int32_t r, prev_gm_param;
primary_frame = s->raw_frame_header->primary_ref_frame;
prev_frame = s->raw_frame_header->ref_frame_idx[primary_frame];
abs_bits = AV1_GM_ABS_ALPHA_BITS;
prec_bits = AV1_GM_ALPHA_PREC_BITS;
@@ -113,8 +112,10 @@ static void read_global_param(AV1DecContext *s, int type, int ref, int idx)
*/
if (s->raw_frame_header->primary_ref_frame == AV1_PRIMARY_REF_NONE)
prev_gm_param = s->cur_frame.gm_params[ref][idx];
else
else {
int prev_frame = s->raw_frame_header->ref_frame_idx[primary_frame];
prev_gm_param = s->ref[prev_frame].gm_params[ref][idx];
}
if (idx < 2) {
if (type == AV1_WARP_MODEL_TRANSLATION) {
@@ -1300,6 +1301,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
ff_refstruct_replace(&s->seq_ref, unit->content_ref);
s->raw_seq = &obu->obu.sequence_header;
s->raw_frame_header = NULL;
raw_tile_group = NULL;
ret = set_context_with_sequence(avctx, s->raw_seq);
if (ret < 0) {
@@ -1327,6 +1330,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
ff_refstruct_replace(&s->header_ref, unit->content_ref);
raw_tile_group = NULL;
if (unit->type == AV1_OBU_FRAME)
s->raw_frame_header = &obu->obu.frame.header;
else
@@ -1398,8 +1403,11 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
}
}
break;
case AV1_OBU_TILE_LIST:
case AV1_OBU_TEMPORAL_DELIMITER:
s->raw_frame_header = NULL;
raw_tile_group = NULL;
// fall-through
case AV1_OBU_TILE_LIST:
case AV1_OBU_PADDING:
break;
case AV1_OBU_METADATA:
+1 -1
View File
@@ -129,7 +129,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
rgb[1] = bytestream_get_le32(&buf);
rgb[2] = bytestream_get_le32(&buf);
if (ihsize > 40)
alpha = bytestream_get_le32(&buf);
alpha = bytestream_get_le32(&buf);
}
ret = ff_set_dimensions(avctx, width, height > 0 ? height : -(unsigned)height);
+19 -4
View File
@@ -1218,7 +1218,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
int num_subpic_cols = tmp_width_val /
(current->sps_subpic_width_minus1[0] + 1);
if (tmp_width_val % (current->sps_subpic_width_minus1[0] + 1) ||
tmp_height_val % (current->sps_subpic_width_minus1[0] + 1) ||
tmp_height_val % (current->sps_subpic_height_minus1[0] + 1) ||
current->sps_num_subpics_minus1 !=
(num_subpic_cols * tmp_height_val /
(current->sps_subpic_height_minus1[0] + 1) - 1))
@@ -1972,16 +1972,18 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
for (i = 0; i < current->pps_num_slices_in_pic_minus1; i++) {
tile_x = tile_idx % current->num_tile_columns;
tile_y = tile_idx / current->num_tile_columns;
if (tile_y >= current->num_tile_rows)
return AVERROR_INVALIDDATA;
if (tile_x != current->num_tile_columns - 1) {
ues(pps_slice_width_in_tiles_minus1[i],
0, current->num_tile_columns - 1, 1, i);
0, current->num_tile_columns - 1 - tile_x, 1, i);
} else {
infer(pps_slice_width_in_tiles_minus1[i], 0);
}
if (tile_y != current->num_tile_rows - 1 &&
(current->pps_tile_idx_delta_present_flag || tile_x == 0)) {
ues(pps_slice_height_in_tiles_minus1[i],
0, current->num_tile_rows - 1, 1, i);
0, current->num_tile_rows - 1 - tile_y, 1, i);
} else {
if (tile_y == current->num_tile_rows - 1)
infer(pps_slice_height_in_tiles_minus1[i], 0);
@@ -2013,6 +2015,12 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
slice_top_left_ctu_y[i] = ctu_y;
} else {
uint16_t slice_height_in_ctus;
int num_uniform_slices;
if (i + current->pps_num_exp_slices_in_tile[i] >
current->pps_num_slices_in_pic_minus1 + 1)
return AVERROR_INVALIDDATA;
for (j = 0; j < current->pps_num_exp_slices_in_tile[i];
j++) {
ues(pps_exp_slice_height_in_ctus_minus1[i][j], 0,
@@ -2033,6 +2041,13 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
uniform_slice_height = 1 +
(j == 0 ? current->row_height_val[tile_y] - 1:
current->pps_exp_slice_height_in_ctus_minus1[i][j-1]);
num_uniform_slices = (remaining_height_in_ctbs_y + uniform_slice_height - 1)
/ uniform_slice_height;
if (i + current->pps_num_exp_slices_in_tile[i] + num_uniform_slices >
current->pps_num_slices_in_pic_minus1 + 1)
return AVERROR_INVALIDDATA;
while (remaining_height_in_ctbs_y > uniform_slice_height) {
current->slice_height_in_ctus[i + j] =
uniform_slice_height;
@@ -3441,7 +3456,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
tile_idx <=
current->sh_slice_address +
current->sh_num_tiles_in_slice_minus1; tile_idx++) {
tile_y = tile_idx / pps->num_tile_rows;
tile_y = tile_idx / pps->num_tile_columns;
height = pps->row_height_val[tile_y];
current->num_entry_points += (entropy_sync ? height : 1);
}
+7 -2
View File
@@ -639,7 +639,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
} else
av_log(avctx, AV_LOG_DEBUG, "Unknown tag %i data %x\n", tag, data);
if (tag == BitstreamMarker && data == 0xf0f &&
if (tag == BitstreamMarker && data == CoefficientSegment &&
s->coded_format != AV_PIX_FMT_NONE) {
int lowpass_height = s->plane[s->channel_num].band[0][0].height;
int lowpass_width = s->plane[s->channel_num].band[0][0].width;
@@ -706,10 +706,15 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
if (s->subband_num_actual == 255)
goto finish;
if (tag == BitstreamMarker && data == CoefficientSegment || tag == BandHeader || tag == BandSecondPass || s->peak.level)
if (s->transform_type != s->a_transform_type)
return AVERROR_PATCHWELCOME;
coeff_data = s->plane[s->channel_num].subband[s->subband_num_actual];
/* Lowpass coefficients */
if (tag == BitstreamMarker && data == 0xf0f) {
if (tag == BitstreamMarker && data == CoefficientSegment) {
int lowpass_height, lowpass_width, lowpass_a_height, lowpass_a_width;
if (!s->a_width || !s->a_height) {
+9
View File
@@ -92,6 +92,15 @@ enum CFHDParam {
ChannelHeight = 105,
};
enum CFHDSegment {
LowPassSegment = 0x1a4a,
LowPassEndSegment = 0x1b4b,
HighPassSegment = 0x0d0d,
BandSegment = 0x0e0e,
HighPassEndSegment = 0x0c0c,
CoefficientSegment = 0x0f0f,
};
#define VLC_BITS 9
#define SUBBAND_COUNT 10
#define SUBBAND_COUNT_3D 17
+6 -6
View File
@@ -627,7 +627,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x1a4a);
bytestream2_put_be16(pby, LowPassSegment);
pos = bytestream2_tell_p(pby);
@@ -653,7 +653,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
bytestream2_put_be16(pby, 16);
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0f0f);
bytestream2_put_be16(pby, CoefficientSegment);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++)
@@ -662,7 +662,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x1b4b);
bytestream2_put_be16(pby, LowPassEndSegment);
for (int l = 0; l < 3; l++) {
for (int i = 0; i < 3; i++) {
@@ -677,7 +677,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int height = s->plane[p].band[l][0].height;
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0d0d);
bytestream2_put_be16(pby, HighPassSegment);
bytestream2_put_be16(pby, WaveletType);
bytestream2_put_be16(pby, 3 + 2 * (l == 2));
@@ -714,7 +714,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int count = 0, padd = 0;
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0e0e);
bytestream2_put_be16(pby, BandSegment);
bytestream2_put_be16(pby, SubbandNumber);
bytestream2_put_be16(pby, i + 1);
@@ -783,7 +783,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
bytestream2_put_be16(pby, BitstreamMarker);
bytestream2_put_be16(pby, 0x0c0c);
bytestream2_put_be16(pby, HighPassEndSegment);
}
s->plane[p].size = bytestream2_tell_p(pby) - pos;
-1
View File
@@ -88,4 +88,3 @@ const FFCodec ff_cljr_decoder = {
FF_CODEC_DECODE_CB(decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1,
};
+15 -5
View File
@@ -64,12 +64,16 @@ static void get_linear_array(GetBitContext *gb, int32_t *array, int size, int n)
array[i] = get_linear(gb, n);
}
static void get_rice_array(GetBitContext *gb, int32_t *array, int size, int k)
static int get_rice_array(GetBitContext *gb, int32_t *array, int size, int k)
{
int i;
for (i = 0; i < size; i++)
for (i = 0; i < size && get_bits_left(gb) > k; i++)
array[i] = get_rice(gb, k);
if (i < size)
return AVERROR_INVALIDDATA;
return 0;
}
static int parse_dmix_coeffs(DCAXllDecoder *s, DCAXllChSet *c)
@@ -529,8 +533,10 @@ static int chs_parse_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int s
} else {
// Rice codes
// Unpack all residuals of part A of segment 0
get_rice_array(&s->gb, part_a, c->nsamples_part_a[k],
c->bitalloc_part_a[k]);
int ret = get_rice_array(&s->gb, part_a, c->nsamples_part_a[k],
c->bitalloc_part_a[k]);
if (ret < 0)
return ret;
if (c->bitalloc_hybrid_linear[k]) {
// Hybrid Rice codes
@@ -560,7 +566,9 @@ static int chs_parse_band_data(DCAXllDecoder *s, DCAXllChSet *c, int band, int s
} else {
// Rice codes
// Unpack all residuals of part B of segment 0 and others
get_rice_array(&s->gb, part_b, nsamples_part_b, c->bitalloc_part_b[k]);
ret = get_rice_array(&s->gb, part_b, nsamples_part_b, c->bitalloc_part_b[k]);
if (ret < 0)
return ret;
}
}
}
@@ -1094,6 +1102,7 @@ static int copy_to_pbr(DCAXllDecoder *s, const uint8_t *data, int size, int dela
return AVERROR(ENOMEM);
memcpy(s->pbr_buffer, data, size);
memset(s->pbr_buffer + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
s->pbr_length = size;
s->pbr_delay = delay;
return 0;
@@ -1148,6 +1157,7 @@ static int parse_frame_pbr(DCAXllDecoder *s, const uint8_t *data, int size, DCAE
memcpy(s->pbr_buffer + s->pbr_length, data, size);
s->pbr_length += size;
memset(s->pbr_buffer + s->pbr_length, 0, AV_INPUT_BUFFER_PADDING_SIZE);
// Respect decoding delay after synchronization error
if (s->pbr_delay > 0 && --s->pbr_delay)
+34 -18
View File
@@ -92,10 +92,14 @@ typedef struct DecodeContext {
*/
uint64_t side_data_pref_mask;
FFLCEVCContext *lcevc;
int lcevc_frame;
int width;
int height;
#if CONFIG_LIBLCEVC_DEC
struct {
FFLCEVCContext *ctx;
int frame;
int width;
int height;
} lcevc;
#endif
} DecodeContext;
static DecodeContext *decode_ctx(AVCodecInternal *avci)
@@ -1657,26 +1661,29 @@ int ff_attach_decode_data(AVFrame *frame)
static void update_frame_props(AVCodecContext *avctx, AVFrame *frame)
{
#if CONFIG_LIBLCEVC_DEC
AVCodecInternal *avci = avctx->internal;
DecodeContext *dc = decode_ctx(avci);
dc->lcevc_frame = dc->lcevc && avctx->codec_type == AVMEDIA_TYPE_VIDEO &&
dc->lcevc.frame = dc->lcevc.ctx && avctx->codec_type == AVMEDIA_TYPE_VIDEO &&
av_frame_get_side_data(frame, AV_FRAME_DATA_LCEVC);
if (dc->lcevc_frame) {
dc->width = frame->width;
dc->height = frame->height;
if (dc->lcevc.frame) {
dc->lcevc.width = frame->width;
dc->lcevc.height = frame->height;
frame->width = frame->width * 2 / FFMAX(frame->sample_aspect_ratio.den, 1);
frame->height = frame->height * 2 / FFMAX(frame->sample_aspect_ratio.num, 1);
}
#endif
}
static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
{
#if CONFIG_LIBLCEVC_DEC
AVCodecInternal *avci = avctx->internal;
DecodeContext *dc = decode_ctx(avci);
if (dc->lcevc_frame) {
if (dc->lcevc.frame) {
FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data;
FFLCEVCFrame *frame_ctx;
int ret;
@@ -1691,13 +1698,13 @@ static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
return AVERROR(ENOMEM);
}
frame_ctx->lcevc = ff_refstruct_ref(dc->lcevc);
frame_ctx->lcevc = ff_refstruct_ref(dc->lcevc.ctx);
frame_ctx->frame->width = frame->width;
frame_ctx->frame->height = frame->height;
frame_ctx->frame->format = frame->format;
frame->width = dc->width;
frame->height = dc->height;
frame->width = dc->lcevc.width;
frame->height = dc->lcevc.height;
ret = avctx->get_buffer2(avctx, frame_ctx->frame, 0);
if (ret < 0) {
@@ -1711,7 +1718,8 @@ static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
fdd->post_process_opaque_free = ff_lcevc_unref;
fdd->post_process = ff_lcevc_process;
}
dc->lcevc_frame = 0;
dc->lcevc.frame = 0;
#endif
return 0;
}
@@ -2084,9 +2092,13 @@ int ff_decode_preinit(AVCodecContext *avctx)
return ret;
if (!(avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS)) {
ret = ff_lcevc_alloc(&dc->lcevc);
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return ret;
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
#if CONFIG_LIBLCEVC_DEC
ret = ff_lcevc_alloc(&dc->lcevc.ctx);
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return ret;
#endif
}
}
#if FF_API_DROPCHANGED
@@ -2331,13 +2343,17 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src)
dst_dc->initial_pict_type = src_dc->initial_pict_type;
dst_dc->intra_only_flag = src_dc->intra_only_flag;
ff_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);
#if CONFIG_LIBLCEVC_DEC
ff_refstruct_replace(&dst_dc->lcevc.ctx, src_dc->lcevc.ctx);
#endif
}
void ff_decode_internal_uninit(AVCodecContext *avctx)
{
#if CONFIG_LIBLCEVC_DEC
AVCodecInternal *avci = avctx->internal;
DecodeContext *dc = decode_ctx(avci);
ff_refstruct_unref(&dc->lcevc);
ff_refstruct_unref(&dc->lcevc.ctx);
#endif
}
+7 -3
View File
@@ -93,9 +93,13 @@ int ff_attach_decode_data(AVFrame *frame);
*/
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx);
/**
* Check that the provided frame dimensions are valid and set them on the codec
* context.
/*
* Validate and set video frame dimensions on AVCodecContext.
*
* Dimensions accepted here satisfy FFmpeg's generic image-size validation
* (see av_image_check_size2()). Decoder code normally should not duplicate
* generic width/height overflow checks before ff_get_buffer(); add local
* checks only for codec-specific derived sizes or complexity bounds.
*/
int ff_set_dimensions(AVCodecContext *s, int width, int height);
+3 -2
View File
@@ -101,15 +101,16 @@ static int dfpwm_dec_frame(struct AVCodecContext *ctx, AVFrame *frame,
{
DFPWMState *state = ctx->priv_data;
int ret;
uint64_t nb_samples = packet->size * 8LL / ctx->ch_layout.nb_channels;
if (packet->size * 8LL % ctx->ch_layout.nb_channels)
return AVERROR_PATCHWELCOME;
frame->nb_samples = packet->size * 8LL / ctx->ch_layout.nb_channels;
if (frame->nb_samples <= 0) {
if (nb_samples > INT_MAX || !nb_samples) {
av_log(ctx, AV_LOG_ERROR, "invalid number of samples in packet\n");
return AVERROR_INVALIDDATA;
}
frame->nb_samples = nb_samples;
if ((ret = ff_get_buffer(ctx, frame, 0)) < 0)
return ret;
-1
View File
@@ -337,4 +337,3 @@ const AVDVProfile *av_dv_codec_profile2(int width, int height,
return p;
}
+1 -1
View File
@@ -59,7 +59,7 @@ static int dvdsub_parse(AVCodecParserContext *s,
pc->packet = av_malloc(pc->packet_len + AV_INPUT_BUFFER_PADDING_SIZE);
}
if (pc->packet) {
if (pc->packet_index + buf_size <= pc->packet_len) {
if (buf_size <= pc->packet_len - pc->packet_index) {
memcpy(pc->packet + pc->packet_index, buf, buf_size);
pc->packet_index += buf_size;
if (pc->packet_index >= pc->packet_len) {
+6 -1
View File
@@ -828,7 +828,12 @@ static int dxv_decompress_dxt5(AVCodecContext *avctx)
static int dxv_decompress_lzf(AVCodecContext *avctx)
{
DXVContext *ctx = avctx->priv_data;
return ff_lzf_uncompress(&ctx->gbc, &ctx->tex_data, &ctx->tex_size, &ctx->tex_data_size);
unsigned old_size = ctx->tex_data_size;
int ret = ff_lzf_uncompress(&ctx->gbc, &ctx->tex_data, &ctx->tex_size, &ctx->tex_data_size);
old_size = FFMAX(old_size, ctx->tex_size);
if (ctx->tex_data_size > old_size)
memset(ctx->tex_data + old_size, 0, ctx->tex_data_size - old_size);
return ret;
}
static int dxv_decompress_raw(AVCodecContext *avctx)
+1 -1
View File
@@ -125,7 +125,7 @@ static av_cold int escape130_decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
s->old_y_avg = av_malloc(avctx->width * avctx->height / 4);
s->old_y_avg = av_mallocz(avctx->width * avctx->height / 4);
s->buf1 = av_malloc(avctx->width * avctx->height * 3 / 2);
s->buf2 = av_malloc(avctx->width * avctx->height * 3 / 2);
if (!s->old_y_avg || !s->buf1 || !s->buf2) {
+16 -5
View File
@@ -632,6 +632,9 @@ static int piz_uncompress(const EXRContext *s, const uint8_t *src, int ssize,
max_non_zero - min_non_zero + 1);
memset(td->bitmap + max_non_zero + 1, 0, BITMAP_SIZE - max_non_zero - 1);
if (bytestream2_get_bytes_left(&gb) < 4)
return AVERROR_INVALIDDATA;
maxval = reverse_lut(td->bitmap, td->lut);
bytestream2_skip(&gb, 4);
@@ -1458,7 +1461,8 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
}
// Zero out the end if xmax+1 is not w
memset(ptr_x, 0, axmax);
if (s->desc->flags & AV_PIX_FMT_FLAG_PLANAR || !c)
memset(ptr_x, 0, axmax);
channel_buffer[c] += td->channel_line_size;
}
}
@@ -1780,12 +1784,17 @@ static int decode_header(EXRContext *s, AVFrame *frame)
}
}
s->channels = av_realloc(s->channels,
++s->nb_channels * sizeof(EXRChannel));
if (!s->channels) {
av_assert0(s->nb_channels < INT_MAX); // Impossible due to size of the bitstream
EXRChannel *new_channels = av_realloc_array(s->channels,
s->nb_channels + 1,
sizeof(EXRChannel));
if (!new_channels) {
ret = AVERROR(ENOMEM);
goto fail;
}
s->nb_channels ++;
s->channels = new_channels;
channel = &s->channels[s->nb_channels - 1];
channel->pixel_type = current_pixel_type;
channel->xsub = xsub;
@@ -1808,7 +1817,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
s->is_luma = 1;
} else {
avpriv_request_sample(s->avctx, "Uncommon channel combination");
ret = AVERROR(AVERROR_PATCHWELCOME);
ret = AVERROR_PATCHWELCOME;
goto fail;
}
@@ -2207,6 +2216,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
}
if (s->is_tile) {
if (s->tile_attr.ySize <= 0 || s->tile_attr.xSize <= 0)
return AVERROR_INVALIDDATA;
nb_blocks = ((s->xdelta + s->tile_attr.xSize - 1) / s->tile_attr.xSize) *
((s->ydelta + s->tile_attr.ySize - 1) / s->tile_attr.ySize);
} else { /* scanline */
-1
View File
@@ -50,4 +50,3 @@ static inline int RENAME(get_context)(const int16_t quant_table[MAX_CONTEXT_INPU
quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] +
quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK];
}
-1
View File
@@ -208,4 +208,3 @@ static int RENAME(encode_rgb_frame)(FFV1Context *f, FFV1SliceContext *sc,
}
return 0;
}
+3
View File
@@ -314,6 +314,9 @@ static int flashsv_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
v_blocks = s->image_height / s->block_height;
v_part = s->image_height % s->block_height;
if (h_blocks * v_blocks * 16 > get_bits_left(&gb))
return AVERROR_INVALIDDATA;
/* the block size could change between frames, make sure the buffer
* is large enough, if not, get a larger one */
if (s->block_size < s->block_width * s->block_height) {
+2 -2
View File
@@ -455,7 +455,7 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
buf = get_bits_long(gb, k);
return buf + (i << k);
} else if (i == limit - 1) {
} else if (esc_len && i == limit - 1) {
buf = get_bits_long(gb, esc_len);
return buf + 1;
@@ -512,7 +512,7 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
}
buf += ((SUINT)i << k);
} else if (i == limit - 1) {
} else if (esc_len && i == limit - 1) {
buf = SHOW_UBITS(re, gb, esc_len);
LAST_SKIP_BITS(re, gb, esc_len);
+1 -1
View File
@@ -144,7 +144,7 @@ static int decode_registered_user_data_closed_caption(H2645SEIA53Caption *h,
static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
enum AVCodecID codec_id, void *logctx)
{
int country_code, provider_code;
int country_code, provider_code = -1;
if (bytestream2_get_bytes_left(gb) < 3)
return AVERROR_INVALIDDATA;
+19 -15
View File
@@ -121,26 +121,30 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
{
H264Ref *const ref1 = &sl->ref_list[1][0];
H264Picture *const cur = h->cur_pic_ptr;
int list, j, field;
int list, field;
int sidx = (h->picture_structure & 1) ^ 1;
int ref1sidx = (ref1->reference & 1) ^ 1;
for (list = 0; list < sl->list_count; list++) {
cur->ref_count[sidx][list] = sl->ref_count[list];
for (j = 0; j < sl->ref_count[list]; j++)
cur->ref_poc[sidx][list][j] = 4 * sl->ref_list[list][j].parent->frame_num +
(sl->ref_list[list][j].reference & 3);
}
/* Updates to cur_pic are not safe once ff_thread_finish_setup() has been
* called (other threads may already be reading these fields). */
if (!h->setup_finished) {
for (list = 0; list < sl->list_count; list++) {
cur->ref_count[sidx][list] = sl->ref_count[list];
for (int j = 0; j < sl->ref_count[list]; j++)
cur->ref_poc[sidx][list][j] = 4 * sl->ref_list[list][j].parent->frame_num +
(sl->ref_list[list][j].reference & 3);
}
if (h->picture_structure == PICT_FRAME) {
memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0]));
memcpy(cur->ref_poc[1], cur->ref_poc[0], sizeof(cur->ref_poc[0]));
}
if (h->picture_structure == PICT_FRAME) {
memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0]));
memcpy(cur->ref_poc[1], cur->ref_poc[0], sizeof(cur->ref_poc[0]));
}
if (h->current_slice == 0) {
cur->mbaff = FRAME_MBAFF(h);
} else {
av_assert0(cur->mbaff == FRAME_MBAFF(h));
if (h->current_slice == 0) {
cur->mbaff = FRAME_MBAFF(h);
} else {
av_assert0(cur->mbaff == FRAME_MBAFF(h));
}
}
sl->col_fieldoff = 0;
-1
View File
@@ -162,4 +162,3 @@ static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl,
if (USES_LIST(mb_type, 1))
prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC);
}
+9 -2
View File
@@ -223,6 +223,9 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
int i;
for (i = 0; i < H264_MAX_MMCO_COUNT; i++) {
if (get_bits_left(gb) < 1)
return AVERROR_INVALIDDATA;
MMCOOpcode opcode = get_ue_golomb_31(gb);
if (opcode > (unsigned) MMCO_LONG) {
av_log(logctx, AV_LOG_ERROR,
@@ -647,8 +650,12 @@ static int h264_parse(AVCodecParserContext *s,
s->dts = av_sat_add64(p->reference_dts, av_rescale(s->dts_ref_dts_delta, num, den));
}
if (p->reference_dts != AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE)
s->pts = s->dts + av_rescale(s->pts_dts_delta, num, den);
if (p->reference_dts != AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE) {
int64_t pts_dts_delta = av_rescale(s->pts_dts_delta, num, den);
uint64_t pts = (uint64_t)s->dts + pts_dts_delta;
if (pts == av_sat_add64(s->dts, pts_dts_delta))
s->pts = pts;
}
if (s->dts_sync_point > 0)
p->reference_dts = s->dts; // new reference
+2 -4
View File
@@ -156,8 +156,7 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
h->long_ref, 16, 1, h->picture_structure);
av_assert0(len <= 32);
if (len < sl->ref_count[list])
memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (sl->ref_count[list] - len));
memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (32 - len));
lens[list] = len;
}
@@ -178,8 +177,7 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
h-> long_ref, 16, 1, h->picture_structure);
av_assert0(len <= 32);
if (len < sl->ref_count[0])
memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (sl->ref_count[0] - len));
memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (32 - len));
}
#ifdef TRACE
for (int i = 0; i < sl->ref_count[0]; i++) {
+7 -2
View File
@@ -1948,8 +1948,7 @@ static int h264_slice_init(H264Context *h, H264SliceContext *sl,
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
ff_h264_direct_dist_scale_factor(h, sl);
if (!h->setup_finished)
ff_h264_direct_ref_list_init(h, sl);
ff_h264_direct_ref_list_init(h, sl);
if (h->avctx->skip_loop_filter >= AVDISCARD_ALL ||
(h->avctx->skip_loop_filter >= AVDISCARD_NONKEY &&
@@ -1978,6 +1977,12 @@ static int h264_slice_init(H264Context *h, H264SliceContext *sl,
h->ps.pps->chroma_qp_index_offset[1]) +
6 * (h->ps.sps->bit_depth_luma - 8);
// slice_table is uint16_t initialized to 0xFFFF as a sentinel.
if (h->current_slice >= 0xFFFE) {
av_log(h->avctx, AV_LOG_ERROR, "Too many slices (%d)\n", h->current_slice + 1);
return AVERROR_PATCHWELCOME;
}
sl->slice_num = ++h->current_slice;
if (sl->slice_num)
+3
View File
@@ -126,6 +126,9 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p,
;
}
if (bytestream2_get_bytes_left(&gb) < height * 4)
return AVERROR_INVALIDDATA;
if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
return ret;
-1
View File
@@ -1512,4 +1512,3 @@ void ff_hevc_hls_mvd_coding(HEVCLocalContext *lc, int x0, int y0, int log2_cb_si
case 0: lc->pu.mvd.y = 0; break;
}
}
+7
View File
@@ -1215,6 +1215,9 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
sps->bit_depth = rf->bit_depth_luma;
sps->width = rf->pic_width_in_luma_samples;
sps->height = rf->pic_height_in_luma_samples;
if ((ret = av_image_check_size(sps->width,
sps->height, 0, avctx)) < 0)
return ret;
sps->pic_conf_win.left_offset = rf->conf_win_left_offset;
sps->pic_conf_win.right_offset = rf->conf_win_right_offset;
@@ -1761,6 +1764,10 @@ static int colour_mapping_table(GetBitContext *gb, AVCodecContext *avctx, HEVCPP
pps->luma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
pps->chroma_bit_depth_cm_output = get_ue_golomb(gb) + 8;
if ( pps-> luma_bit_depth_cm_output < pps-> luma_bit_depth_cm_input
|| pps->chroma_bit_depth_cm_output < pps->chroma_bit_depth_cm_input)
return AVERROR_INVALIDDATA;
pps->cm_res_quant_bits = get_bits(gb, 2);
pps->cm_delta_flc_bits = get_bits(gb, 2) + 1;
+4 -1
View File
@@ -135,7 +135,10 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l)
if (ret < 0)
return NULL;
frame->rpl = ff_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
size_t rpl_bytes;
if (av_size_mult(s->pkt.nb_nals, sizeof(*frame->rpl), &rpl_bytes) < 0)
goto fail;
frame->rpl = ff_refstruct_allocz(rpl_bytes);
if (!frame->rpl)
goto fail;
frame->nb_rpl_elems = s->pkt.nb_nals;
+2 -2
View File
@@ -180,7 +180,7 @@ static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitCont
else
length = FFMAX(0, (int)s->exponent_ref_display_width[i] +
(int)s->prec_ref_display_width - 31);
s->mantissa_ref_display_width[i] = get_bits_long(gb, length);
s->mantissa_ref_display_width[i] = get_bits64(gb, length);
if (s->ref_viewing_distance_flag) {
s->exponent_ref_viewing_distance[i] = get_bits(gb, 6);
if (s->exponent_ref_viewing_distance[i] > 62)
@@ -190,7 +190,7 @@ static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitCont
else
length = FFMAX(0, (int)s->exponent_ref_viewing_distance[i] +
(int)s->prec_ref_viewing_dist - 31);
s->mantissa_ref_viewing_distance[i] = get_bits_long(gb, length);
s->mantissa_ref_viewing_distance[i] = get_bits64(gb, length);
}
s->additional_shift_present_flag[i] = get_bits1(gb);
if (s->additional_shift_present_flag[i]) {
+2 -2
View File
@@ -87,9 +87,9 @@ typedef struct HEVCSEITDRDI {
uint16_t left_view_id[32];
uint16_t right_view_id[32];
uint8_t exponent_ref_display_width[32];
uint8_t mantissa_ref_display_width[32];
uint64_t mantissa_ref_display_width[32];
uint8_t exponent_ref_viewing_distance[32];
uint8_t mantissa_ref_viewing_distance[32];
uint64_t mantissa_ref_viewing_distance[32];
uint8_t additional_shift_present_flag[32];
int16_t num_sample_shift[32];
uint8_t three_dimensional_reference_displays_extension_flag;
-1
View File
@@ -45,4 +45,3 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p
*loss_ptr = loss;
return best;
}
+2
View File
@@ -139,6 +139,8 @@ static int imm5_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
ret = avcodec_receive_frame(codec_avctx, frame);
if (ret == AVERROR(EAGAIN))
return avpkt->size;
if (ret < 0)
return ret;
+3
View File
@@ -437,6 +437,9 @@ static int fill_block(InterplayACMContext *s)
unsigned i, ind;
int ret;
if (get_bits_left(gb) < s->cols * 5)
return AVERROR_INVALIDDATA;
for (i = 0; i < s->cols; i++) {
ind = get_bits(gb, 5);
ret = filler_list[ind](s, ind, i);
+7 -4
View File
@@ -2038,7 +2038,7 @@ static int decode_cblk(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *cod
while (passno--) {
if (bpno < 0 || bpno > 29) {
av_log(s->avctx, AV_LOG_ERROR, "bpno became invalid\n");
av_log(s->avctx, AV_LOG_ERROR, "bpno (%d) became invalid\n", bpno);
return AVERROR_INVALIDDATA;
}
switch(pass_t) {
@@ -2237,8 +2237,8 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
band->coord[1][0] == band->coord[1][1])
continue;
if ((codsty->cblk_style & JPEG2000_CTSY_HTJ2K_F) && M_b >= 31) {
avpriv_request_sample(s->avctx, "JPEG2000_CTSY_HTJ2K_F and M_b >= 31");
if (M_b > 31) {
avpriv_request_sample(s->avctx, "M_b (%d) > 31", M_b);
return AVERROR_PATCHWELCOME;
}
@@ -2317,9 +2317,12 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
int h = tile->comp[compno].coord[1][1] - \
ff_jpeg2000_ceildiv(s->image_offset_y, s->cdy[compno]); \
int plane = 0; \
ptrdiff_t dstoffset = 0; \
\
if (planar) \
plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1); \
else \
dstoffset = s->cdef[compno] ? s->cdef[compno] - 1 : compno; \
\
y = tile->comp[compno].coord[1][0] - \
ff_jpeg2000_ceildiv(s->image_offset_y, s->cdy[compno]); \
@@ -2329,7 +2332,7 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
\
x = tile->comp[compno].coord[0][0] - \
ff_jpeg2000_ceildiv(s->image_offset_x, s->cdx[compno]); \
dst = line + x * pixelsize + compno*!planar; \
dst = line + x * pixelsize + dstoffset; \
\
if (codsty->transform == FF_DWT97) { \
for (; x < w; x++) { \
+11 -1
View File
@@ -1219,7 +1219,7 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
uint8_t *block_states = NULL;
int32_t n, val; // Post-processing
const uint32_t mask = UINT32_MAX >> (M_b + 1); // bit mask for ROI detection
const uint32_t mask = (UINT32_MAX >> M_b) >> 1; // bit mask for ROI detection
uint8_t num_rempass;
@@ -1254,6 +1254,11 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
"Cleanup pass length must be at least 2 bytes in length\n");
return AVERROR_INVALIDDATA;
}
// this might arise either if the codestream is corrupted; or contains multiple HT Sets
// (see Rec. ITU-T T.814, Annex B.1), which the parser does not currently support
if (Lcup + Lref != cblk->length)
return AVERROR_INVALIDDATA;
Dcup = cblk->data;
Dref = cblk->data + Lcup; // Dref comes after the refinement segment
@@ -1263,6 +1268,11 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
cblk->zbp = S_blk - 1;
pLSB = 30 - S_blk;
if (pLSB <= 1 || pLSB >= 31) {
avpriv_request_sample(s->avctx, "pLSB %d", pLSB);
return AVERROR_PATCHWELCOME;
}
Scup = (Dcup[Lcup - 1] << 4) + (Dcup[Lcup - 2] & 0x0F);
if (Scup < 2 || Scup > Lcup || Scup > 4079) {
+69 -59
View File
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config_components.h"
#include "libavutil/avassert.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
@@ -26,7 +24,6 @@
#include "decode.h"
#include "lcevcdec.h"
#if CONFIG_LIBLCEVC_DEC
static LCEVC_ColorFormat map_format(int format)
{
switch (format) {
@@ -50,13 +47,12 @@ static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc,
{
LCEVC_PictureDesc desc;
LCEVC_ColorFormat fmt = map_format(frame->format);
LCEVC_PictureLockHandle lock;
uint8_t *data[4] = { NULL };
int linesizes[4] = { 0 };
uint32_t planes;
LCEVC_PicturePlaneDesc planes[AV_VIDEO_MAX_PLANES] = { 0 };
int width = frame->width - frame->crop_left - frame->crop_right;
int height = frame->height - frame->crop_top - frame->crop_bottom;
LCEVC_ReturnCode res;
res = LCEVC_DefaultPictureDesc(&desc, fmt, frame->width, frame->height);
res = LCEVC_DefaultPictureDesc(&desc, fmt, width, height);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
@@ -67,36 +63,16 @@ static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc,
desc.sampleAspectRatioNum = frame->sample_aspect_ratio.num;
desc.sampleAspectRatioDen = frame->sample_aspect_ratio.den;
for (int i = 0; i < AV_VIDEO_MAX_PLANES; i++) {
planes[i].firstSample = frame->data[i];
planes[i].rowByteStride = frame->linesize[i];
}
/* Allocate LCEVC Picture */
res = LCEVC_AllocPicture(lcevc->decoder, &desc, picture);
res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
if (res != LCEVC_Success) {
return AVERROR_EXTERNAL;
}
res = LCEVC_LockPicture(lcevc->decoder, *picture, LCEVC_Access_Write, &lock);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
res = LCEVC_GetPicturePlaneCount(lcevc->decoder, *picture, &planes);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
for (unsigned i = 0; i < planes; i++) {
LCEVC_PicturePlaneDesc plane;
res = LCEVC_GetPictureLockPlaneDesc(lcevc->decoder, lock, i, &plane);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
data[i] = plane.firstSample;
linesizes[i] = plane.rowByteStride;
}
av_image_copy2(data, linesizes, frame->data, frame->linesize,
frame->format, frame->width, frame->height);
res = LCEVC_UnlockPicture(lcevc->decoder, lock);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
return 0;
}
@@ -132,6 +108,7 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
const AVFrameSideData *sd = av_frame_get_side_data(in, AV_FRAME_DATA_LCEVC);
AVFrame *opaque;
LCEVC_PictureHandle picture;
LCEVC_ReturnCode res;
int ret = 0;
@@ -139,7 +116,11 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame
if (!sd)
return 1;
#ifdef LCEVC_DEC_VERSION_MAJOR
res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, sd->data, sd->size);
#else
res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, 0, sd->data, sd->size);
#endif
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
@@ -147,9 +128,29 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame
if (ret < 0)
return ret;
res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, NULL);
if (res != LCEVC_Success)
opaque = av_frame_clone(in);
if (!opaque) {
LCEVC_FreePicture(lcevc->decoder, picture);
return AVERROR(ENOMEM);
}
res = LCEVC_SetPictureUserData(lcevc->decoder, picture, opaque);
if (res != LCEVC_Success) {
LCEVC_FreePicture(lcevc->decoder, picture);
av_frame_free(&opaque);
return AVERROR_EXTERNAL;
}
#ifdef LCEVC_DEC_VERSION_MAJOR
res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, picture, -1, opaque);
#else
res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, opaque);
#endif
if (res != LCEVC_Success) {
LCEVC_FreePicture(lcevc->decoder, picture);
av_frame_free(&opaque);
return AVERROR_EXTERNAL;
}
memset(&picture, 0, sizeof(picture));
ret = alloc_enhanced_frame(logctx, frame_ctx, &picture);
@@ -157,8 +158,10 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame
return ret;
res = LCEVC_SendDecoderPicture(lcevc->decoder, picture);
if (res != LCEVC_Success)
if (res != LCEVC_Success) {
LCEVC_FreePicture(lcevc->decoder, picture);
return AVERROR_EXTERNAL;
}
return 0;
}
@@ -176,8 +179,14 @@ static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
return AVERROR_EXTERNAL;
res = LCEVC_GetPictureDesc(lcevc->decoder, picture, &desc);
if (res != LCEVC_Success)
if (res != LCEVC_Success) {
LCEVC_FreePicture(lcevc->decoder, picture);
return AVERROR_EXTERNAL;
}
av_frame_unref(out);
av_frame_copy_props(frame_ctx->frame, (AVFrame *)info.baseUserData);
av_frame_move_ref(out, frame_ctx->frame);
out->crop_top = desc.cropTop;
out->crop_bottom = desc.cropBottom;
@@ -185,11 +194,6 @@ static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
out->crop_right = desc.cropRight;
out->sample_aspect_ratio.num = desc.sampleAspectRatioNum;
out->sample_aspect_ratio.den = desc.sampleAspectRatioDen;
av_frame_copy_props(frame_ctx->frame, out);
av_frame_unref(out);
av_frame_move_ref(out, frame_ctx->frame);
out->width = desc.width + out->crop_left + out->crop_right;
out->height = desc.height + out->crop_top + out->crop_bottom;
@@ -200,18 +204,13 @@ static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
return 0;
}
static int lcevc_receive_frame(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
LCEVC_PictureHandle picture;
LCEVC_ReturnCode res;
int ret;
ret = generate_output(logctx, frame_ctx, out);
if (ret < 0)
return ret;
while (1) {
AVFrame *base = NULL;
res = LCEVC_ReceiveDecoderBase (lcevc->decoder, &picture);
if (res != LCEVC_Success && res != LCEVC_Again)
return AVERROR_EXTERNAL;
@@ -219,6 +218,9 @@ static int lcevc_receive_frame(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *o
if (res == LCEVC_Again)
break;
LCEVC_GetPictureUserData(lcevc->decoder, picture, (void **)&base);
av_frame_free(&base);
res = LCEVC_FreePicture(lcevc->decoder, picture);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
@@ -227,6 +229,18 @@ static int lcevc_receive_frame(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *o
return 0;
}
static int lcevc_receive_frame(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
int ret;
ret = generate_output(logctx, frame_ctx, out);
if (ret < 0)
return ret;
return lcevc_flush_pictures(lcevc);
}
static void event_callback(LCEVC_DecoderHandle dec, LCEVC_Event event,
LCEVC_PictureHandle pic, const LCEVC_DecodeInformation *info,
const uint8_t *data, uint32_t size, void *logctx)
@@ -243,15 +257,16 @@ static void event_callback(LCEVC_DecoderHandle dec, LCEVC_Event event,
static void lcevc_free(FFRefStructOpaque unused, void *obj)
{
FFLCEVCContext *lcevc = obj;
if (lcevc->initialized)
if (lcevc->initialized) {
LCEVC_FlushDecoder(lcevc->decoder);
lcevc_flush_pictures(lcevc);
LCEVC_DestroyDecoder(lcevc->decoder);
}
memset(lcevc, 0, sizeof(*lcevc));
}
#endif
static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
{
#if CONFIG_LIBLCEVC_DEC
LCEVC_AccelContextHandle dummy = { 0 };
const int32_t event = LCEVC_Log;
@@ -270,7 +285,6 @@ static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
return AVERROR_EXTERNAL;
}
#endif
lcevc->initialized = 1;
return 0;
@@ -289,7 +303,6 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
return ret;
}
#if CONFIG_LIBLCEVC_DEC
av_assert0(frame_ctx->frame);
@@ -297,12 +310,11 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
if (ret)
return ret < 0 ? ret : 0;
lcevc_receive_frame(logctx, frame_ctx, frame);
ret = lcevc_receive_frame(logctx, frame_ctx, frame);
if (ret < 0)
return ret;
av_frame_remove_side_data(frame, AV_FRAME_DATA_LCEVC);
#endif
return 0;
}
@@ -310,11 +322,9 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
int ff_lcevc_alloc(FFLCEVCContext **plcevc)
{
FFLCEVCContext *lcevc = NULL;
#if CONFIG_LIBLCEVC_DEC
lcevc = ff_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free);
if (!lcevc)
return AVERROR(ENOMEM);
#endif
*plcevc = lcevc;
return 0;
}
+2 -2
View File
@@ -175,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
int height = avctx->height; // Real image height
unsigned int mszh_dlen;
unsigned char yq, y1q, uq, vq;
int uqvq, ret;
int ret;
unsigned int mthread_inlen, mthread_outlen;
unsigned int len = buf_size;
int linesize, offset;
@@ -306,7 +306,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
for (row = 0; row < height; row++) {
pixel_ptr = row * width * 3;
yq = encoded[pixel_ptr++];
uqvq = AV_RL16(encoded+pixel_ptr);
unsigned uqvq = AV_RL16(encoded+pixel_ptr);
pixel_ptr += 2;
for (col = 1; col < width; col++) {
encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
+4
View File
@@ -238,7 +238,11 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
} else if (svt_enc->qp > 0) {
param->qp = svt_enc->qp;
param->rate_control_mode = 0;
#if SVT_AV1_CHECK_VERSION(4, 0, 0)
param->aq_mode = 0;
#else
param->enable_adaptive_quantization = 0;
#endif
}
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+6 -7
View File
@@ -38,16 +38,15 @@
#define LZF_LONG_BACKREF 7 + 2
static inline int lzf_realloc(uint8_t **buf, size_t *size, int addition, unsigned *allocated_size)
static inline int lzf_realloc(uint8_t **buf, size_t new_size, unsigned *allocated_size)
{
void *ptr = av_fast_realloc(*buf, allocated_size, *size + addition);
void *ptr = av_fast_realloc(*buf, allocated_size, new_size);
if (!ptr) {
av_freep(buf); //probably not needed
return AVERROR(ENOMEM);
}
*buf = ptr;
*size += addition;
return 0;
}
@@ -63,8 +62,8 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, size_t *size, unsigned
if (s < LZF_LITERAL_MAX) {
s++;
if (s > *size - len) {
ret = lzf_realloc(buf, size, s, allocated_size);
if (s > *allocated_size - len) {
ret = lzf_realloc(buf, len + s, allocated_size);
if (ret < 0)
return ret;
p = *buf + len;
@@ -88,8 +87,8 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, size_t *size, unsigned
if (off > len)
return AVERROR_INVALIDDATA;
if (l > *size - len) {
ret = lzf_realloc(buf, size, l, allocated_size);
if (l > *allocated_size - len) {
ret = lzf_realloc(buf, len + l, allocated_size);
if (ret < 0)
return ret;
p = *buf + len;
+2 -1
View File
@@ -348,7 +348,8 @@ static int magy_decode_slice(AVCodecContext *avctx, void *tdata,
s->llviddsp.add_left_pred(dst, dst, width, 0);
dst += stride;
}
lefttop = left = dst[0];
if (1 + interlaced < height)
lefttop = left = dst[0];
for (k = 1 + interlaced; k < height; k++) {
s->llviddsp.add_median_pred(dst, dst - fake_stride,
dst, width, &left, &lefttop);
+3
View File
@@ -175,6 +175,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
int buf_size = avpkt->size;
int ret;
if (a->mb_width * a->mb_height * 3 > buf_size)
return AVERROR_INVALIDDATA;
if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
return ret;
+6 -4
View File
@@ -150,7 +150,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
if ((ret = init_default_huffman_tables(s)) < 0)
return ret;
if (s->extern_huff) {
if (s->extern_huff && avctx->extradata) {
av_log(avctx, AV_LOG_INFO, "using external huffman table\n");
if ((ret = init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8)) < 0)
return ret;
@@ -344,9 +344,11 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (av_image_check_size(width, height, 0, s->avctx) < 0)
return AVERROR_INVALIDDATA;
// A valid frame requires at least 1 bit for DC + 1 bit for AC for each 8x8 block.
if (s->buf_size && (width + 7) / 8 * ((height + 7) / 8) > s->buf_size * 4LL)
return AVERROR_INVALIDDATA;
if (!s->progressive && !s->ls) {
// A valid frame requires at least 1 bit for DC + 1 bit for AC for each 8x8 block.
if (s->buf_size && (width + 7) / 8 * ((height + 7) / 8) > s->buf_size * 4LL)
return AVERROR_INVALIDDATA;
}
nb_components = get_bits(&s->gb, 8);
if (nb_components <= 0 ||
-1
View File
@@ -369,4 +369,3 @@ void RENAME(ff_imdct36_blocks)(INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in,
out++;
}
}
-1
View File
@@ -778,4 +778,3 @@ static const FFCodecDefault mp2_defaults[] = {
{ "b", "0" },
{ NULL },
};
+6 -11
View File
@@ -2809,7 +2809,7 @@ static void write_mb_info(MpegEncContext *s)
bytestream_put_byte(&ptr, 0); /* vmv2 */
}
static void update_mb_info(MpegEncContext *s, int startcode)
static void update_mb_info(MpegEncContext *s)
{
if (!s->mb_info)
return;
@@ -2817,14 +2817,6 @@ static void update_mb_info(MpegEncContext *s, int startcode)
s->mb_info_size += 12;
s->prev_mb_info = s->last_mb_info;
}
if (startcode) {
s->prev_mb_info = put_bytes_count(&s->pb, 0);
/* This might have incremented mb_info_size above, and we return without
* actually writing any info into that slot yet. But in that case,
* this will be called again at the start of the after writing the
* start code, actually writing the mb info. */
return;
}
s->last_mb_info = put_bytes_count(&s->pb, 0);
if (!s->mb_info_size)
@@ -3040,8 +3032,11 @@ static int encode_thread(AVCodecContext *c, void *arg){
case AV_CODEC_ID_H263:
case AV_CODEC_ID_H263P:
if (CONFIG_H263_ENCODER) {
update_mb_info(s, 1);
if (s->mb_info && put_bytes_count(&s->pb, 0) - s->prev_mb_info >= s->mb_info)
s->mb_info_size += 12;
ff_h263_encode_gob_header(s, mb_y);
s->prev_mb_info = put_bits_count(&s->pb)/8;
}
break;
}
@@ -3067,7 +3062,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->mb_skipped=0;
s->dquant=0; //only for QP_RD
update_mb_info(s, 0);
update_mb_info(s);
if (mb_type & (mb_type-1) || (s->mpv_flags & FF_MPV_FLAG_QP_RD)) { // more than 1 MB type possible or FF_MPV_FLAG_QP_RD
int next_block=0;
-1
View File
@@ -282,4 +282,3 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64],
}
}
}
-1
View File
@@ -336,4 +336,3 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
*dc_val_ptr = &dc_val[0];
return pred;
}
+5 -1
View File
@@ -79,7 +79,7 @@ static int lz4_decompress(AVCodecContext *avctx,
PutByteContext *pb)
{
unsigned reference_pos, delta, pos = 0;
uint8_t history[64 * 1024];
uint8_t history[64 * 1024] = { 0 };
int match_length;
while (bytestream2_get_bytes_left(gb) > 0) {
@@ -90,6 +90,8 @@ static int lz4_decompress(AVCodecContext *avctx,
unsigned char current;
do {
current = bytestream2_get_byte(gb);
if (current > INT_MAX - num_literals)
return AVERROR_INVALIDDATA;
num_literals += current;
} while (current == 255);
}
@@ -122,6 +124,8 @@ static int lz4_decompress(AVCodecContext *avctx,
do {
current = bytestream2_get_byte(gb);
if (current > INT_MAX - match_length)
return AVERROR_INVALIDDATA;
match_length += current;
} while (current == 255);
}
+5
View File
@@ -684,6 +684,11 @@ static av_cold int omx_encode_init(AVCodecContext *avctx)
buffer = get_buffer(&s->output_mutex, &s->output_cond,
&s->num_done_out_buffers, s->done_out_buffers, 1);
if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
if (buffer->nFilledLen > INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE - avctx->extradata_size) {
ret = AVERROR(ENOMEM);
goto fail;
}
if ((ret = av_reallocp(&avctx->extradata, avctx->extradata_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
avctx->extradata_size = 0;
goto fail;
-1
View File
@@ -466,4 +466,3 @@ fail:
av_channel_layout_uninit(&layout);
return ret;
}
+3
View File
@@ -75,6 +75,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}
if (avpkt->size * 1032LL < ((avctx->width + 7) >> 3) * avctx->height) //Asymptotic max compression of deflate
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
+3
View File
@@ -62,6 +62,9 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (avctx->skip_frame >= AVDISCARD_ALL)
return avpkt->size;
if (avctx->width * avctx->height / 8 > s->bytestream_end - s->bytestream)
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
avctx->bits_per_raw_sample = av_log2(s->maxval) + 1;
+2
View File
@@ -1857,6 +1857,8 @@ static int qdm2_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if(buf_size < s->checksum_size)
return -1;
s->sub_packet = 0;
/* get output buffer */
frame->nb_samples = 16 * s->frame_size;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+1
View File
@@ -157,6 +157,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (ctx->max_frame_size > (1 << 20) || !ctx->max_frame_size) {
av_log(avctx, AV_LOG_ERROR, "invalid frame size %d\n",
ctx->max_frame_size);
return AVERROR_INVALIDDATA;
}
ctx->max_frame_size = FFMAX(ctx->max_frame_size, avctx->sample_rate);
+6 -4
View File
@@ -51,6 +51,8 @@ typedef struct RASCContext {
GetByteContext gb;
uint8_t *delta;
int delta_size;
uint8_t *mv_scratch;
unsigned int mv_scratch_size;
uint8_t *cursor;
int cursor_size;
unsigned cursor_w;
@@ -294,10 +296,8 @@ static int decode_move(AVCodecContext *avctx,
b2 -= s->frame2->linesize[0];
}
} else if (type == 0) {
uint8_t *buffer;
av_fast_padded_malloc(&s->delta, &s->delta_size, w * h * s->bpp);
buffer = s->delta;
av_fast_padded_malloc(&s->mv_scratch, &s->mv_scratch_size, w * h * s->bpp);
uint8_t *buffer = s->mv_scratch;
if (!buffer)
return AVERROR(ENOMEM);
@@ -772,6 +772,8 @@ static av_cold int decode_close(AVCodecContext *avctx)
s->cursor_size = 0;
av_freep(&s->delta);
s->delta_size = 0;
av_freep(&s->mv_scratch);
s->mv_scratch_size = 0;
av_frame_free(&s->frame1);
av_frame_free(&s->frame2);
ff_inflate_end(&s->zstream);
-2
View File
@@ -858,5 +858,3 @@ av_cold void ff_dwt_init(SnowDWTContext *c)
ff_dwt_init_x86(c);
#endif
}
+5 -3
View File
@@ -70,6 +70,8 @@ typedef struct SnowEncContext {
uint64_t encoding_error[SNOW_MAX_PLANES];
} SnowEncContext;
#define PTR_ADD(ptr, off) ((ptr) ? (ptr) + (off) : NULL)
static void init_ref(MotionEstContext *c, const uint8_t *const src[3],
uint8_t *const ref[3], uint8_t *const ref2[3],
int x, int y, int ref_index)
@@ -82,7 +84,7 @@ static void init_ref(MotionEstContext *c, const uint8_t *const src[3],
};
for (int i = 0; i < 3; i++) {
c->src[0][i] = src [i];
c->ref[0][i] = ref [i] + offset[i];
c->ref[0][i] = PTR_ADD(ref[i], offset[i]);
}
av_assert2(!ref_index);
}
@@ -400,8 +402,8 @@ static int encode_q_branch(SnowEncContext *enc, int level, int x, int y)
const int stride= s->current_picture->linesize[0];
const int uvstride= s->current_picture->linesize[1];
const uint8_t *const current_data[3] = { s->input_picture->data[0] + (x + y* stride)*block_w,
s->input_picture->data[1] + ((x*block_w)>>s->chroma_h_shift) + ((y*uvstride*block_w)>>s->chroma_v_shift),
s->input_picture->data[2] + ((x*block_w)>>s->chroma_h_shift) + ((y*uvstride*block_w)>>s->chroma_v_shift)};
PTR_ADD(s->input_picture->data[1], ((x*block_w)>>s->chroma_h_shift) + ((y*uvstride*block_w)>>s->chroma_v_shift)),
PTR_ADD(s->input_picture->data[2], ((x*block_w)>>s->chroma_h_shift) + ((y*uvstride*block_w)>>s->chroma_v_shift))};
int P[10][2];
int16_t last_mv[3][2];
int qpel= !!(s->avctx->flags & AV_CODEC_FLAG_QPEL); //unused
+5
View File
@@ -695,6 +695,11 @@ static int svq1_decode_frame(AVCodecContext *avctx, AVFrame *cur,
avctx->skip_frame >= AVDISCARD_ALL)
return buf_size;
// Reject obviously too-small packets early: require at least one remaining bit per aligned luma macroblock.
// FFALIGN(s->width, 16) * FFALIGN(s->height, 16) / 256 represent the number of Macroblocks
if (get_bits_left(&s->gb) < FFALIGN(s->width, 16) * FFALIGN(s->height, 16) / 256)
return AVERROR_INVALIDDATA;
result = ff_get_buffer(avctx, cur, s->nonref ? 0 : AV_GET_BUFFER_FLAG_REF);
if (result < 0)
return result;
+1 -1
View File
@@ -27,7 +27,7 @@
#define av_log(a, ...) while(0)
#define ff_dlog(a, ...) while(0)
#define AVUTIL_MEM_H
#define av_malloc(s) NULL
#define av_mallocz(s) NULL
#define av_malloc_array(a, b) NULL
#define av_realloc_f(p, o, n) NULL
#define av_free(p) while(0)
+6 -4
View File
@@ -242,7 +242,6 @@ static int tdsc_load_cursor(AVCodecContext *avctx)
bits <<= 1;
}
}
dst += ctx->cursor_stride - ctx->cursor_w * 4;
}
dst = ctx->cursor;
@@ -274,7 +273,6 @@ static int tdsc_load_cursor(AVCodecContext *avctx)
bits <<= 1;
}
}
dst += ctx->cursor_stride - ctx->cursor_w * 4;
}
break;
case CUR_FMT_BGRA:
@@ -360,7 +358,8 @@ static int tdsc_decode_jpeg_tile(AVCodecContext *avctx, int tile_size,
}
ret = avcodec_receive_frame(ctx->jpeg_avctx, ctx->jpgframe);
if (ret < 0 || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P) {
if (ret < 0 || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P ||
w > ctx->jpgframe->width || h > ctx->jpgframe->height) {
av_log(avctx, AV_LOG_ERROR,
"JPEG decoding error (%d).\n", ret);
@@ -404,7 +403,7 @@ static int tdsc_decode_tiles(AVCodecContext *avctx, int number_tiles)
}
tile_size = bytestream2_get_le32(&ctx->gbc);
if (bytestream2_get_bytes_left(&ctx->gbc) < tile_size)
if (bytestream2_get_bytes_left(&ctx->gbc) < tile_size + 24LL)
return AVERROR_INVALIDDATA;
tile_mode = bytestream2_get_le32(&ctx->gbc);
@@ -437,6 +436,9 @@ static int tdsc_decode_tiles(AVCodecContext *avctx, int number_tiles)
if (ret < 0)
return ret;
} else if (tile_mode == MKTAG(' ','W','A','R')) {
if (3LL * w * h > tile_size)
return AVERROR_INVALIDDATA;
/* Just copy the buffer to output */
av_image_copy_plane(ctx->refframe->data[0] + x * 3 +
ctx->refframe->linesize[0] * y,
+3 -3
View File
@@ -46,9 +46,6 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
unsigned x, y, fg, bg, c;
int ret;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
if (avpkt->size < 2*char_rows*char_cols) {
av_log(avctx, AV_LOG_ERROR,
"Input buffer too small, truncated sample?\n");
@@ -56,6 +53,9 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
dst = frame->data[0];
#if FF_API_PALETTE_HAS_CHANGED
+10 -10
View File
@@ -640,16 +640,16 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
if (frame_bytes > 0) {
/* calc from frame_bytes only */
if (id == AV_CODEC_ID_TRUESPEECH)
return 240 * (frame_bytes / 32);
if (id == AV_CODEC_ID_NELLYMOSER)
return 256 * (frame_bytes / 64);
if (id == AV_CODEC_ID_RA_144)
return 160 * (frame_bytes / 20);
if (id == AV_CODEC_ID_APTX)
return 4 * (frame_bytes / 4);
if (id == AV_CODEC_ID_APTX_HD)
return 4 * (frame_bytes / 6);
int64_t d = INT64_MIN;
switch(id) {
case AV_CODEC_ID_TRUESPEECH : d = 240LL * (frame_bytes / 32); break;
case AV_CODEC_ID_NELLYMOSER : d = 256LL * (frame_bytes / 64); break;
case AV_CODEC_ID_RA_144 : d = 160LL * (frame_bytes / 20); break;
case AV_CODEC_ID_APTX : d = 4LL * (frame_bytes / 4); break;
case AV_CODEC_ID_APTX_HD : d = 4LL * (frame_bytes / 6); break;
}
if (d > INT64_MIN)
return ((int)d == d && d > 0) ? d : 0;
if (bps > 0) {
/* calc from frame_bytes and bits_per_coded_sample */
+1 -1
View File
@@ -83,7 +83,7 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx)
p = vt_extradata;
*p++ = 1; /* version */
AV_WB24(p + 1, 0); /* flags */
AV_WB24(p, 0); /* flags */
p += 3;
*p++ = h->h.profile;
+1 -1
View File
@@ -2119,7 +2119,7 @@ static int copy_replace_length_codes(
uint8_t *new_sei;
old_sei_length = find_sei_end(avctx, dst_box, box_len, &new_sei);
if (old_sei_length < 0)
return status;
return old_sei_length;
wrote_bytes = write_sei(sei,
SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35,
+3 -4
View File
@@ -46,7 +46,6 @@
#include "decode.h"
#include "get_bits.h"
#include "hpeldsp.h"
#include "internal.h"
#include "jpegquanttables.h"
#include "mathops.h"
#include "progressframe.h"
@@ -2458,7 +2457,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
}
}
if (!avctx->internal->is_copy) {
if (ff_thread_sync_ref(avctx, offsetof(Vp3DecodeContext, coeff_vlc)) != FF_THREAD_IS_COPY) {
CoeffVLCs *vlcs = ff_refstruct_alloc_ext(sizeof(*s->coeff_vlc), 0,
NULL, free_vlc_tables);
if (!vlcs)
@@ -2527,8 +2526,6 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
const Vp3DecodeContext *s1 = src->priv_data;
int qps_changed = 0;
ff_refstruct_replace(&s->coeff_vlc, s1->coeff_vlc);
// copy previous frame data
ref_frames(s, s1);
if (!s1->current_frame.f ||
@@ -2899,6 +2896,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
if (av_image_check_size(visible_width, visible_height, 0, avctx) < 0 ||
visible_width + offset_x > s->width ||
visible_height + offset_y > s->height ||
visible_width + 512 < s->width ||
visible_height + 512 < s->height ||
visible_width < 18
) {
av_log(avctx, AV_LOG_ERROR,
+12 -6
View File
@@ -171,10 +171,12 @@ static int update_size(AVCodecContext *avctx, int w, int h)
uint8_t *p;
int bytesperpixel = s->bytesperpixel, ret, cols, rows;
int lflvl_len, i;
int changed = 0;
av_assert0(w > 0 && h > 0);
if (!(s->pix_fmt == s->gf_fmt && w == s->w && h == s->h)) {
changed = 1;
if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
return ret;
@@ -235,8 +237,10 @@ static int update_size(AVCodecContext *avctx, int w, int h)
*fmtp = AV_PIX_FMT_NONE;
ret = ff_get_format(avctx, pix_fmts);
if (ret < 0)
if (ret < 0) {
ff_set_dimensions(avctx, s->w, s->h);
return ret;
}
avctx->pix_fmt = ret;
s->gf_fmt = s->pix_fmt;
@@ -248,7 +252,7 @@ static int update_size(AVCodecContext *avctx, int w, int h)
rows = (h + 7) >> 3;
if (s->intra_pred_data[0] && cols == s->cols && rows == s->rows && s->pix_fmt == s->last_fmt)
return 0;
return changed;
s->last_fmt = s->pix_fmt;
s->sb_cols = (w + 63) >> 6;
@@ -293,9 +297,10 @@ static int update_size(AVCodecContext *avctx, int w, int h)
ff_vp9dsp_init(&s->dsp, s->s.h.bpp, avctx->flags & AV_CODEC_FLAG_BITEXACT);
ff_videodsp_init(&s->vdsp, s->s.h.bpp);
s->last_bpp = s->s.h.bpp;
changed = 1;
}
return 0;
return changed;
}
static int update_block_buffers(AVCodecContext *avctx)
@@ -502,6 +507,7 @@ static int decode_frame_header(AVCodecContext *avctx,
int c, i, j, k, l, m, n, w, h, max, size2, ret, sharp;
int last_invisible;
const uint8_t *data2;
int changed;
/* general header */
if ((ret = init_get_bits8(&s->gb, data, size)) < 0) {
@@ -767,10 +773,10 @@ static int decode_frame_header(AVCodecContext *avctx,
}
/* tiling info */
if ((ret = update_size(avctx, w, h)) < 0) {
if ((changed = update_size(avctx, w, h)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder for %dx%d @ %d\n",
w, h, s->pix_fmt);
return ret;
return changed;
}
for (s->s.h.tiling.log2_tile_cols = 0;
s->sb_cols > (64 << s->s.h.tiling.log2_tile_cols);
@@ -785,7 +791,7 @@ static int decode_frame_header(AVCodecContext *avctx,
}
s->s.h.tiling.log2_tile_rows = decode012(&s->gb);
s->s.h.tiling.tile_rows = 1 << s->s.h.tiling.log2_tile_rows;
if (s->s.h.tiling.tile_cols != (1 << s->s.h.tiling.log2_tile_cols)) {
if (s->s.h.tiling.tile_cols != (1 << s->s.h.tiling.log2_tile_cols) || changed) {
int n_range_coders;
VPXRangeCoder *rc;
-1
View File
@@ -693,4 +693,3 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const in
ff_vvc_ctu_free_cus(fc->tab.cus + rs);
return ret;
}
+2 -2
View File
@@ -65,14 +65,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
flags1 = 0;
flags2 = 1;
if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
extradata = av_malloc(4);
extradata = av_mallocz(4 + AV_INPUT_BUFFER_PADDING_SIZE);
if (!extradata)
return AVERROR(ENOMEM);
avctx->extradata_size = 4;
AV_WL16(extradata, flags1);
AV_WL16(extradata + 2, flags2);
} else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
extradata = av_mallocz(10);
extradata = av_mallocz(10 + AV_INPUT_BUFFER_PADDING_SIZE);
if (!extradata)
return AVERROR(ENOMEM);
avctx->extradata_size = 10;

Some files were not shown because too many files have changed in this diff Show More