Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 638b521c7b |
@@ -53,6 +53,7 @@ libavutil/.*d3d12va.* @jianhuaw
|
||||
libavutil/eval.* @michaelni
|
||||
libavutil/iamf.* @jamrial
|
||||
libavutil/integer.* @michaelni
|
||||
libavutil/kiss99.* @michaelni
|
||||
libavutil/lfg.* @michaelni
|
||||
libavutil/lls.* @michaelni
|
||||
libavutil/md5.* @michaelni
|
||||
|
||||
@@ -18,14 +18,6 @@ repos:
|
||||
- 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
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.4.1
|
||||
hooks:
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
name: Autolabel
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, synchronize]
|
||||
@@ -8,7 +6,6 @@ on:
|
||||
|
||||
jobs:
|
||||
pr_labeler:
|
||||
name: Labeler
|
||||
runs-on: utilities
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release/8.0
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Pre-Commit
|
||||
runs-on: utilities
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
@@ -1,39 +1,21 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release/8.0
|
||||
- master
|
||||
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'
|
||||
runner: [linux-amd64,linux-aarch64]
|
||||
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
|
||||
run: ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2
|
||||
- name: Build
|
||||
run: make -j$(nproc)
|
||||
- name: Restore Cached Fate-Suite
|
||||
@@ -48,7 +30,7 @@ jobs:
|
||||
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
|
||||
echo "hash=$(find fate-suite -type f | 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 }}
|
||||
@@ -56,13 +38,12 @@ jobs:
|
||||
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)
|
||||
run: make fate 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-8.0:latest"]
|
||||
image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
|
||||
runs-on: linux-amd64
|
||||
container: ${{ matrix.image }}
|
||||
steps:
|
||||
@@ -76,5 +57,3 @@ jobs:
|
||||
--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
|
||||
|
||||
@@ -1,525 +1,13 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 8.0.3:
|
||||
Bump for 8.0.3
|
||||
fix missing padding for AV1 extradata
|
||||
fix crash when stsz_sample_size is zero and sample_sizes is null
|
||||
Fix out-of-bounds write errors in yuv2rgb_lasx.c file.
|
||||
bound manifest reloads and fragment-open retries
|
||||
Fail with any inner stream count being 0
|
||||
swscale/x86/rgb_2_rgb: fix uyvytoyuv422 overwrite on odd width
|
||||
swscale/aarch64: fix uyvy/yuyv to yuv420p/yuv422p on odd width
|
||||
avcodec/snowenc: fix SIGFPE in get_dc() when a block lies outside the plane
|
||||
avcodec/snowenc: fix out-of-bounds OBMC read in get_dc() for narrow planes
|
||||
avcodec/snowenc: fix out-of-bounds memcpy in get_block_rd() for narrow planes
|
||||
libavdevice/alsa.c: fix NULL pointer dereference
|
||||
avformat/icecast: reject CR/LF in metadata header values
|
||||
avfilter/avf_showspectrum: Fix allocation check
|
||||
avformat/sctp: add size check in sctp_read() matching sctp_write()
|
||||
avcodec/jpeg2000: Fix undefined behavior on ROI shift-up
|
||||
avcodec/cbs_av1_syntax_template: reset seen_frame_header on sequence headers
|
||||
avfilter/convolution: compute user matrix products in unsigned
|
||||
avformat/mpegts: use av_fast_realloc() for prg
|
||||
avfilter/avf_showcwt: fix DIRECTION_DU EOF fill clearing the wrong rows
|
||||
avfilter/avf_showcwt: fix DIRECTION_RL EOF fill clearing the wrong columns
|
||||
avfilter/avf_showcwt: avoid undefined float to int conversion of nb_consumed_samples
|
||||
avfilter/avf_showcwt: fix out of array read in compute_kernel
|
||||
avfilter/v360: compute remap table offsets in 64bit
|
||||
avfilter/v360: reject out-of-range dimensions
|
||||
swresample/x86/resample: write only int16 in the int16 resampler
|
||||
avformat/rtpenc_amr: Check input size
|
||||
swscale/ppc: fix ASAN stack-buffer-overflow in yuv2planeX
|
||||
swscale/ppc: fix LOAD_FILTER overread in VSX path
|
||||
avfilter: use ff_slice_pos() for per-slice boundary computation
|
||||
avfilter: add ff_slice_pos() helper for slice boundaries
|
||||
(origin/release/8.0, fforge/release/8.0) avformat/iamf_writer: reject muxing PCM streams
|
||||
avfilter/estdif: avoid signed overflow in slice boundary calculation
|
||||
swscale: support sliced input with cascaded scaling contexts
|
||||
avformat/rtspdec: bound Content-Length in the ANNOUNCE handler to SDP_MAX_SIZE
|
||||
avcodec/cbs_h266_syntax_template: reject subpic info with res_change_in_clvs
|
||||
avcodec/misc4: Check nb channels
|
||||
avcodec/rv10, rv34: check init_get_bits8() before RealVideo bit access
|
||||
avformat/http: reject request-line tokens not terminated by whitespace
|
||||
avformat/mov: reject out of range ispe dimensions, avoid overflow summing HEIF tile dimensions
|
||||
avcodec/agm: validate actual src_y against prev plane in decode_inter_plane
|
||||
avformat/dhav: Fix second integer overflow in get_duration()
|
||||
fftools/ffmpeg_dec: deep-copy subtitle_header to fix use-after-free
|
||||
avcodec/hevc/ps: Check window parameters
|
||||
avcodec/hevc/ps: Factor window reading out
|
||||
avcodec/truespeech: reject iterations count whose * 240 product overflows 32-bit
|
||||
libavcodec/options_table: gamma22 and gamma28 aliases
|
||||
avcodec/on2avc: reject subframe count whose * SUBFRAME_SIZE product overflows 32-bit
|
||||
avfilter/zmq: initialize send_buf before shared cleanup on parse failure
|
||||
avcodec/adpcm: fix signed integer overflow in get_nb_samples()
|
||||
avformat/matroskadec: avoid signed overflow in DASH cue time differences
|
||||
avcodec/fastaudio: reject subframes count whose * 256 product overflows 32-bit
|
||||
avcodec/vc2enc_dwt: avoid signed overflow in the 9/7 DWT lifting
|
||||
avcodec/vc2enc_dwt: avoid signed overflow in the 5/3 and Haar DWT
|
||||
avcodec/mwsc: do not dereference a missing reference frame
|
||||
avcodec/misc4: reject invalid sample rate
|
||||
swscale/output: avoid signed overflow in yuv2rgba64_1 alpha
|
||||
swscale/output: avoid signed overflow in yuv2rgba64_full_1 alpha
|
||||
tools/target_dem_fuzzer: do not exit on io_buffer allocation failure
|
||||
avformat/gxfenc: Check timecode and propagate error
|
||||
swscale/rgb2rgb_template: use unsigned for <<24
|
||||
avformat/iamf_parse: bound substream count by remaining OBU size
|
||||
avformat/matroskadec: bound TRACKENTRY parsing by max_streams
|
||||
avcodec/diracdec: fix heap buffer overflow in edge_emu_buffer
|
||||
avformat/rtmppkt: Check recursion depth
|
||||
avcodec/tdsc: propagate max_pixels to the JPEG tile decoder
|
||||
avcodec/imm5: propagate max_pixels to the H264/HEVC sub-decoders
|
||||
avcodec/cri: propagate max_pixels to the JPEG tile decoder
|
||||
avcodec/jpeglsdec: only apply color transform to decoded rows
|
||||
avfilter/avf_showcwt: fix out-of-bounds read in du scroll
|
||||
avfilter/f_ebur128: avoid signed-int wrap when sizing per-channel cache
|
||||
avformat/mov: cap HEIF ICC profile copies via c*max_streams to bound CPU and memory
|
||||
avcodec/aac/aacdec_usac: reject explicit usacSamplingFrequency of 0
|
||||
avcodec/aac/aacdec: reject decoded frame without a valid sample rate
|
||||
avformat/iff: check av_get_packet() result in ANIM branch
|
||||
avcodec/cbs_h266_syntax_template: Fix pps_exp_slice_height_in_ctus_minus1 range
|
||||
avfilter/vf_scale: split rational multiply
|
||||
avfilter/vf_drawtext: Avoid double free in glyph_enu_border_free()
|
||||
avfilter/vf_drawtext: plug error-path leaks in measure_text/draw_text
|
||||
avfilter/vf_drawtext: shape_text_hb() free allocated things on error
|
||||
avfilter/vf_drawtext: avoid double-free of aliased FT_Glyph in glyph_enu_free
|
||||
avfilter/vf_drawtext: don't double-free glyph that has been cached in tree
|
||||
avfilter/vf_drawtext: always check pixel_mode == FT_PIXEL_MODE_MONO
|
||||
avcodec/cook: bound subpacket channel sum against channel count
|
||||
avcodec/apv_decode: avoid using apv_cbc
|
||||
avformat/mxfdec: Remove unneeded check
|
||||
avformat/ftp: Check string used for RNTO
|
||||
avformat/ftp: Check for Telnet IAC characters and other non printable ASCII chars
|
||||
avformat/ftp: reject CR/LF in the URL path to prevent FTP command injection
|
||||
avcodec/jpeg2000dec: Clear header derived variables
|
||||
avcodec/bsf/smpte436m_to_eia608: properly frees stuff on errors in ff_smpte436m_to_eia608_filter()
|
||||
avformat/avc: Adjust get_ue_golomb() to handle 32 bit
|
||||
avformat/whip: require remote DTLS fingerprint in SDP answer
|
||||
avcodec/x86/vorbisdsp: change cmpleps to cmpltps in inverse coupling
|
||||
avcodec/liboapvenc: derive and validate APV profile from pixel format
|
||||
avfilter/af_join: fix wrong loop bound in buffer dedup (use-after-free)
|
||||
avcodec/nvenc: fix compatibility with Video Codec SDK 13.1
|
||||
avformat/mov: validate APV access unit length before passing to decoder
|
||||
avcodec/h264_slice: guard color_frame() against chroma-width underflow
|
||||
avcodec/magicyuv: reject slice_height misaligned with chroma vshift
|
||||
avcodec/magicyuv: Expand the s->interlaced slice-height sanity check
|
||||
avcodec/magicyuv: Fix 1 line MEDIAN slices
|
||||
avformat/mxfdec: zero-init Sony MPEG-4 extradata and add padding
|
||||
avformat/soxdec: Check sample_rate for nan
|
||||
tests/tiny_ssim: fixed mistake in ssim_c1 calculation
|
||||
avformat/hls: Check TIME-OFFSET value
|
||||
avformat/hls: Check url_offset and size
|
||||
avcodec/prores_raw: reject invalid tile alignment values
|
||||
avformat/ty: check rec_size
|
||||
avformat/rtpenc_xiph: bail out when the max payload size underflows
|
||||
avformat/rtpenc_aac: reject packets smaller than the ADTS header
|
||||
avcodec/jpeg2000dec: compute mask in decode_clnpass() like in decode_sigpass()
|
||||
avformat/flvdec: Check size at the top of the main loop
|
||||
avformat/vividas: fix misaligned access
|
||||
avformat/mccdec: dont pass NULL to bytestream2_put_buffer()
|
||||
avcodec/g2meet: The stack is EPIC_PIX_STACK_SIZE
|
||||
avcodec/h2645_sei: Initialize side data before deallocation
|
||||
avfilter/boxblur: Fix off by one errors
|
||||
avformat/assenc: Add the missing parentheses
|
||||
avcodec/diracdec: Enlarge `mctmp` to cover the worst-case `blheight·ybsep + yblen` rows, and break the MC loop when no output rows remain
|
||||
tools/zmqsend: free the AVBprint buffer after using it
|
||||
[Wave] Fix issues with unaligned metadata chunks.
|
||||
fftools/graph: Add missing include "libavutil/mem.h" for fftools/graph/graphprint.c
|
||||
avcodec/cbs_h266_syntax_template: tighten sh_num_tiles_in_slice_minus1 upper bound
|
||||
avcodec/hevc: limit missing-ref fill to coded planes
|
||||
avformat/mov: Fix negative index given to can_seek_to_key_sample()
|
||||
avcodec/hdrdec: fix pixel count decrement in RLE decompress loop
|
||||
configure: bump CONFIG_THIS_YEAR to 2026
|
||||
(fforge/pr/23304) avformat/mov: don't abort on unsupported or invalid chnl boxes
|
||||
avformat/mov_chan: keep the layout untouched on chan/chnl box failure
|
||||
(fforge/pr/23239) avformat/oggparsevorbis.c: Prevent integer overflow when summing header lengths; add bounds check.
|
||||
(fforge/pr/23186) avformat/oggparsecelt: bound extra_headers to avoid an effectively infinite loop
|
||||
(fforge/pr/23112) avformat/demux: use correct close function for custom io
|
||||
avformat/hlsenc: use correct close function for custom io
|
||||
avformat/hlsenc: respect io_open set in AVFormatContext
|
||||
avformat/dashenc: respect io_open set in AVFormatContext
|
||||
avformat/dashdec: respect io_open set in AVFormatContext
|
||||
(fforge/pr/23170) Changelog: fix typos
|
||||
avformat/rtpdec_av1: fix buffer overflow due to variable confusion
|
||||
version <next>:
|
||||
|
||||
|
||||
version 8.0.2:
|
||||
avcodec/dfpwmdec: Check nb_samples
|
||||
avcodec/alsdec: do not set nbits invalidly
|
||||
swscale/swscale_unscaled: adjust last line copy
|
||||
swscale/swscale: Check srcSliceY and srcSliceH
|
||||
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
|
||||
swscale: fix signed integer overflow in color conversion arithmetic
|
||||
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
|
||||
avcodec/vp9: fix cbs fragment leak on error
|
||||
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/wmv2dec: More Checks about reading skip bits
|
||||
avcodec/cbs_h266_syntax_template: Fix w/h typo
|
||||
aacdec_usac: skip FD-specific decoding for LPD channels
|
||||
avformat/dhav: Fix handling or slightly larger files
|
||||
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
|
||||
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
|
||||
avcodec/jpeg2000dec: fix integer overflow in dequantization_int_97()
|
||||
avformat/demux: Fix integer overflows in select_from_pts_buffer()
|
||||
avcodec/golomb: Fix get_ur_golomb_jpegls() with esclen = 0
|
||||
avcodec/jpeg2000dec: Handle M_b = -1
|
||||
swresample/resample_template: add casts to avoid undefined overflows
|
||||
avcodec/h264_parser: Check pts for overflow
|
||||
avformat/rtpenc: use unsigned type for ssrc option
|
||||
swscale/output: Fix some integer overflows in yuv2rgba64_full*()
|
||||
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/libtheoraenc: make keyframe mask unsigned and handle its larger range
|
||||
avcodec/rv60dec: check last_size
|
||||
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 indentation
|
||||
avcodec/exr: Handle axmax like bxmin in 04d7a6d3db56ea1a93908ff2d3d312e3fc40a58c
|
||||
avformat/flvdec: Check *size in cts parsing
|
||||
avcodec/prores_raw: Tiles of width less than 16 result in undefined behavior
|
||||
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()
|
||||
avformat/flvdec: Check need_context_update when audio codec changes
|
||||
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/ffv1enc: refine end condition
|
||||
avcodec/dca_xll: Check get_rice_array()
|
||||
libavformat/argo_brp: fix incorrect ASF chunk header read
|
||||
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: allow bpno of -1
|
||||
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/hlsenc: fix format string vulnerability in parse_playlist
|
||||
lavc/vvc: Fix unchecked error codes from set_qp_y
|
||||
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
|
||||
avformat/iamf_parse: stop trying to parse files that report an unknown layout
|
||||
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
|
||||
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
|
||||
avformat/iamf_parse: fix parsing of Scalable layouts with Mono and Stereo layers
|
||||
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
|
||||
libavcodec/prores_raw: Fix heap-buffer-overflow in decode_frame
|
||||
avutil/hwcontext_d3d12va: use hwdev context for logging
|
||||
avfilter/x86/f_ebur128: only use filter_channels_avx for >= 2 channels
|
||||
fate: add missing options in config template
|
||||
avformat/hls_sample_encryption: add missing padding for audio setup buffer
|
||||
(fforge/pr/22931) avformat/mov: Merge tts after building index for old-style uncompressed PCM
|
||||
(fforge/pr/22825) lavc/videotoolbox_vp9: fix vpcC flags offset
|
||||
lavc/videotoolboxenc: return SEI parse errors
|
||||
(fforge-npc/release/8.0) aarch64/hpeldsp_neon: fix out-of-bounds read
|
||||
(fforge/pr/22415) avformat/mov: check return value of mov_read_iref_thmb()
|
||||
avformat/mov: Fix multiple issues related to mov_read_iref_dimg()
|
||||
avformat/mov: free item_name on infe entry parsing failure
|
||||
avformat/mov: check for EOF in more loops
|
||||
avformat/mov: abort if the queried item doesn't exist instead of overwriting it
|
||||
avformat/mov: add overflow checks to item offset values
|
||||
avformat/mov: reindent after the previous change
|
||||
avformat/mov: don't parse reserved ISOBMFF fields as if they were QT
|
||||
avformat/mov: make items referencing items generic
|
||||
(fforge/pr/22312) avformat/mov: fix cases where we discard iamf packets from enabled streams
|
||||
avformat/mov: fix setting iamf stream id offsets
|
||||
(fforge/pr/20965) avformat/whip: remove the confused option buffer_size
|
||||
avformat/whip: add new option ts_buffer_size to deprecate buffer_size
|
||||
avformat/whip: remind user increase -buffer_size
|
||||
avformat/whip: pass through buffer_size option to udp
|
||||
avformat/whip: fix potential 8bit overflow for profile_idc
|
||||
avformat/whip: fix 8 bits overflow and map constraint_set bits for H264
|
||||
avformat/whip: fix SDP ICE candidates parsing
|
||||
avformat/whip: fix ssrc might be same
|
||||
(fforge/pr/21699) 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/21638) checkasm/hevc_pel: rename loop variable 'size' to 'idx' to avoid confusion
|
||||
checkasm/hevc_pel: fix typo size[sizes] -> sizes[size]
|
||||
(fforge/pr/21625) avcodec/libsvtav1: rename aq_mode for v4.0.0
|
||||
(fforge/pr/21624) vulkan_vp9: fix subsampling source and show_frame flag
|
||||
(fforge/pr/21433) avfilter/vf_lcevc: attach a reference to the source frame to each passed in base picture
|
||||
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
|
||||
hwcontext_vulkan: add support for implicit DRM sync for export
|
||||
(fforge/pr/21329) lavc/vvc: Prevent OOB write to slice_top_left_ctu_x in PPS CBS
|
||||
lavc/vvc: Error on inter slice with no reference pics
|
||||
forgejo: backport CI job names
|
||||
avformat/img2dec: reject input images too big to fit into a single packet
|
||||
(fforge/pr/21350) cbs_vp9: Always update loop filter and segmentation from current frame
|
||||
(fforge/pr/21330) avformat/iamf_writer: check that stream count is consistent for ambisonic Audio Elements
|
||||
avformat/iamf_writer: fix writing some ambisonics fields in Audio Elements
|
||||
avformat/iamf_parse: fix setting denominator in AVIAMFLayer.demixing_matrix
|
||||
tests/fate/filter-video: add two feedback tests
|
||||
avfilter/vf_feedback: fix feedback block
|
||||
(fforge/pr/21218) fate/ffmpeg: remove comparison against ref from fix_sub_duration_heartbeat
|
||||
configure: Lower libdvdnav and libdvdread minimum versions for EL9
|
||||
(fforge/pr/21158) avcodec/aac_ac3_parser: do not override the profile set by the decoder
|
||||
avcodec/aac_ac3_parser: simplify
|
||||
avcodec/aac_ac3_parser: remove unused USAC/ADTS code
|
||||
avfilter/af_amerge: fix possible crash with custom layouts
|
||||
(fforge/pr/21091) avcodec/vp3: Sync VLCs once during init, fix crash
|
||||
(fforge/pr/21066) avcodec/prores_raw: add missing includes
|
||||
avfilter/stack_internal: fix checkheaders test
|
||||
forgejo: apply needed CI changes for 8.0
|
||||
forgejo/workflows: run tests on correct release branch
|
||||
forgejo: backport CI changes to release/8.0
|
||||
configure: replace openssl header check with 1.1.1 API
|
||||
configure: require at least OpenSSL 1.1.1 (LTS)
|
||||
configure: remove openssl version check for whip
|
||||
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
|
||||
avfilter/vf_scale: don't attempt to rescale AV_NOPTS_VALUE
|
||||
avfilter/framesync: don't attempt to rescale AV_NOPTS_VALUE
|
||||
avutil/hwcontext_d3d12va: fix buf size when call av_buffer_create
|
||||
avfilter/f_select: Added activate for aselect
|
||||
avcodec/videotoolboxenc: fix crash with negative linesize
|
||||
avcodec/videotoolboxenc: improve Lock/Unlock BaseAddress error handling
|
||||
doc/filters: add section for VideoToolbox filter
|
||||
avformat/mov: fix missing video size when some decoders are disabled
|
||||
avformat/mov: relax check on proj box size
|
||||
(fforge/pr/20976) tests/fate/hevc: add a mv-hevc sample using long term ref
|
||||
avcodec/hevc: reset long_term_rps.nb_refs for IDR
|
||||
(fforge/pr/20987) Changelog: fix spell and remove redundant descriptions
|
||||
|
||||
|
||||
version 8.0.1:
|
||||
avutil/common: cast GET_BYTE/GET_16BIT returned value
|
||||
avfilter/vf_drawtext: fix call GET_UTF8 with invalid argument
|
||||
avfilter/vf_drawtext: fix incorrect text length
|
||||
avfilter/vf_drawtext: Account for bbox text separator
|
||||
avcodec/mediacodecdec_common: Check that the input to mediacodec_wrap_sw_audio_buffer() contains channel * sample_size
|
||||
avcodec/rv60dec: Clear blk_info
|
||||
avformat/whip: Fix rtp_ctx->streams access
|
||||
avcodec/utvideodec: Set B for the width= 1 case in restore_median_planar_il()
|
||||
avcodec/osq: Fix 32bit sample overflow
|
||||
avformat/rtpdec_rfc4175: Only change PayloadContext on success
|
||||
avformat/rtpdec_rfc4175: Check dimensions
|
||||
avformat/rtpdec_rfc4175: Fix memleak of sampling
|
||||
avformat/http: Fix off by 1 error
|
||||
avcodec/exr: spelling
|
||||
avcodec/rv60dec: add upper bound check for qp
|
||||
avcodec/exr: use tile dimensions in pxr24 UINT case
|
||||
avcodec/exr: Simple check for available channels
|
||||
avformat/sctp: Check size in sctp_write()
|
||||
avformat/rtmpproto: consider command line argument lengths
|
||||
avformat/rtmpproto_ Check tcurl and flashver length
|
||||
avcodec/g723_1enc: Make min_err 64bit
|
||||
avcodec/vlc: Clear val8/16 in vlc_multi_gen() by av_mallocz()
|
||||
avformat/rtpenc_h264_hevc: Check space for nal_length_size in ff_rtp_send_h264_hevc()
|
||||
avcodec/ffv1enc: Consider variation in slice sizes
|
||||
libavcodec/cbs_apv_syntax_template: limit tile to 2gb
|
||||
swscale/output: Fix unsigned cast position in yuv2*
|
||||
swscale/output: Fix integer overflow in yuv2ya16_X_c_template()
|
||||
avcodec/exr: Check that DWA has 3 channels
|
||||
avcodec/exr: check ac_size
|
||||
avcodec/exr: Round dc_w/h up
|
||||
avcodec/mjpegdec: Explain buf_size/width/height check
|
||||
configure: strip non numeric trailer from gcc version
|
||||
avformat/dhav: Fix off by length of read element error
|
||||
avformat/aviobuf: Keep checksum_ptr consistent in avio_seek()
|
||||
doc/examples/vaapi_encode: fix invalid check on fwrite
|
||||
avcodec/librsvgdec: fix compilation with librsvg 2.50.3
|
||||
avcodec/mfenc: fix memory leak with D3D11 input surfaces
|
||||
swscale/graph: fix double-free when legacy pass fails initializing
|
||||
libavformat/udp: Fix call to recvfrom(2)
|
||||
avfilter/f_ebur128: Fix incorrect ebur128 peak calculation.
|
||||
avformat/udp: fix warning about unused variable
|
||||
avdevice/lavfi: stop setting deprecated buffersink options
|
||||
configure: unbreak glslang build
|
||||
swscale/range_convert: fix truncation bias in range conversion
|
||||
lavc/aarch64: Fix addp overflow in ff_pred16x16_plane_neon_10
|
||||
avcodec/mlpdec: don't depend on context channel layout when setting substream masks
|
||||
avformat/demux: pass new extradata to the parser
|
||||
avfilter/af_whisper: fix srt index
|
||||
avfilter/af_whisper: fix int64 printf format
|
||||
avfilter/af_whisper: fix srt file format
|
||||
avfilter/whisper: correct option formatting
|
||||
avfilter/af_whisper: fix broken output for multibyte character
|
||||
avformat/rtsp: fix leading space in RTSP reason
|
||||
avformat/rtsp: do not log invalid values
|
||||
avformat/http: Handle IPv6 Zone ID in hostname
|
||||
avformat/dump: fix log level passed to av_log when printing stream group side data
|
||||
avcodec/hevc/sei: don't attempt to use stale values in HEVCSEITDRDI
|
||||
avcodec/hevc/sei: prevent storing a potentially bogus num_ref_displays value in HEVCSEITDRDI
|
||||
avcodec/hevc/refs: don't unconditionally discard non-IRAP frames if no IRAP frame was seen before
|
||||
libavutil/arm: Rename the HWCAP defines
|
||||
libavutil/arm: Make use of elf_aux_info() on FreeBSD/OpenBSD
|
||||
fftools/ffmpeg: fix gracefully shutdown
|
||||
avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx
|
||||
avcodec/x86/pngdsp: add missing emms at the end of add_png_paeth_prediction
|
||||
avcodec/videotoolboxenc: ensure bitrate is set in low_delay mode
|
||||
avcodec/videotoolboxenc: allow low latency RC with HEVC
|
||||
avcodec/videotoolboxenc: support global_quality without qscale
|
||||
avcodec/videotoolboxenc: fix the loss of precision when calculating quality
|
||||
fftools/ffmpeg_demux: ensure the display_rotation option is honored
|
||||
avcodec/mjpegdec: use ff_frame_new_side_data() to export display matrix
|
||||
avutil/tests/aes_ctr: extend the test to cover payloads smaller than a block
|
||||
avutil/aes_ctr: reintroduce the block offset state
|
||||
avfilter/vf_lcevc: support LCEVCdec version 4
|
||||
avcodec/lcevcdec: support LCEVCdec version 4
|
||||
movenc: ensure chapters track extradata is not null and populated
|
||||
|
||||
version 8.0:
|
||||
- Whisper filter
|
||||
- Drop support for OpenSSL < 1.1.0
|
||||
- Enable TLS peer certificate verification by default (on next major version bump)
|
||||
- Drop support for OpenSSL < 1.1.1
|
||||
- yasm support dropped, users need to use nasm
|
||||
- VVC VAAPI decoder
|
||||
- RealVideo 6.0 decoder
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
┌────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 8.0 "Huffman" │
|
||||
└────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 8.0 "Huffman", about 11
|
||||
months after the release of FFmpeg 7.1.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
|
||||
|
||||
We hope you will like this release as much as we enjoyed working on it, and
|
||||
as usual, if you have any questions about it, or any FFmpeg related topic,
|
||||
feel free to join us on the #ffmpeg IRC channel (on irc.libera.chat) or ask
|
||||
on the mailing-lists.
|
||||
@@ -4800,9 +4800,6 @@ if enabled cuda_nvcc; then
|
||||
if $nvcc $nvccflags_default 2>&1 | grep -qi unsupported; then
|
||||
nvccflags_default="-gencode arch=compute_60,code=sm_60 -O2"
|
||||
fi
|
||||
if $nvcc $nvccflags_default 2>&1 | grep -qi unsupported; then
|
||||
nvccflags_default="-gencode arch=compute_75,code=sm_75 -O2"
|
||||
fi
|
||||
fi
|
||||
|
||||
set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
|
||||
@@ -4830,7 +4827,7 @@ fi
|
||||
|
||||
exesuf() {
|
||||
case $1 in
|
||||
mingw32*|mingw64*|msys*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian|windows_nt) echo .exe ;;
|
||||
mingw32*|mingw64*|msys*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -5177,7 +5174,7 @@ probe_cc(){
|
||||
# but we can force it back to gnu mode and get the version from there.
|
||||
_ident=$($_cc -flavor gnu --version 2>/dev/null)
|
||||
_ld_o='-out:$@'
|
||||
_flags_filter=msvc_flags_link
|
||||
_flags_filter=msvc_flags
|
||||
_ld_lib='lib%.a'
|
||||
_ld_path='-libpath:'
|
||||
elif VSLANG=1033 $_cc -nologo- 2>&1 | grep -q ^Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
|
||||
@@ -7040,8 +7037,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.0" dvdnav/dvdnav.h dvdnav_open2
|
||||
enabled libdvdread && require_pkg_config libdvdread "dvdread >= 6.1.1" dvdread/dvd_reader.h DVDOpen2
|
||||
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 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"; } }
|
||||
@@ -7052,16 +7049,12 @@ 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
|
||||
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 \
|
||||
enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
|
||||
-lglslang -lMachineIndependent -lGenericCodeGen \
|
||||
${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
|
||||
-lSPVRemapper -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 \
|
||||
${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ;
|
||||
fi
|
||||
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ; }
|
||||
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
|
||||
@@ -7265,13 +7258,13 @@ enabled omx_rpi && { test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoR
|
||||
enabled omx && require_headers OMX_Core.h && \
|
||||
warn "The OpenMAX encoders are deprecated and will be removed in future versions"
|
||||
|
||||
enabled openssl && { { check_pkg_config openssl "openssl >= 3.0.0" openssl/ssl.h DTLS_get_data_mtu &&
|
||||
enabled openssl && { { check_pkg_config openssl "openssl >= 3.0.0" openssl/ssl.h OPENSSL_init_ssl &&
|
||||
{ enabled gplv3 || ! enabled gpl || enabled nonfree || die "ERROR: OpenSSL >=3.0.0 requires --enable-version3"; }; } ||
|
||||
{ enabled gpl && ! enabled nonfree && die "ERROR: OpenSSL <3.0.0 is incompatible with the gpl"; } ||
|
||||
check_pkg_config openssl "openssl >= 1.1.1" openssl/ssl.h DTLS_get_data_mtu ||
|
||||
check_lib openssl openssl/ssl.h DTLS_get_data_mtu -lssl -lcrypto ||
|
||||
check_lib openssl openssl/ssl.h DTLS_get_data_mtu -lssl -lcrypto -lws2_32 -lgdi32 ||
|
||||
die "ERROR: openssl (>= 1.1.1) not found"; }
|
||||
check_pkg_config openssl "openssl >= 1.1.0" openssl/ssl.h OPENSSL_init_ssl ||
|
||||
check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
|
||||
check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto -lws2_32 -lgdi32 ||
|
||||
die "ERROR: openssl (>= 1.1.0) not found"; }
|
||||
enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
|
||||
enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
|
||||
require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
|
||||
@@ -7280,6 +7273,15 @@ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/r
|
||||
}
|
||||
enabled vapoursynth && require_headers "vapoursynth/VSScript4.h vapoursynth/VapourSynth4.h"
|
||||
|
||||
enabled openssl && {
|
||||
enabled whip_muxer && {
|
||||
$pkg_config --exists --print-errors "openssl >= 1.0.1k" ||
|
||||
require_pkg_config openssl "openssl >= 1.0.1k" openssl/ssl.h SSL_library_init ||
|
||||
require_pkg_config openssl "openssl >= 1.0.1k" openssl/ssl.h OPENSSL_init_ssl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if enabled gcrypt; then
|
||||
GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
|
||||
if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
|
||||
@@ -7752,7 +7754,7 @@ if enabled icc; then
|
||||
fi
|
||||
elif enabled gcc; then
|
||||
gcc_version=$($cc -dumpversion)
|
||||
major_version=${gcc_version%%[!0-9]*}
|
||||
major_version=${gcc_version%%.*}
|
||||
if [ $major_version -lt 13 ]; then
|
||||
# Disable tree-vectorize for GCC <13 - it has historically been buggy.
|
||||
check_optflags -fno-tree-vectorize
|
||||
@@ -8387,7 +8389,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 2026
|
||||
#define CONFIG_THIS_YEAR 2025
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 8.0.3
|
||||
PROJECT_NUMBER =
|
||||
|
||||
# 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
-1
@@ -123,7 +123,7 @@ Internally, the TC should take decisions with a majority, or using ranked-choice
|
||||
|
||||
Each TC member must vote on such decision according to what is, in their view, best for the project.
|
||||
|
||||
If a TC member feels they are affected by a conflict of interest with regards to the case, they should announce it and recuse themselves from the TC
|
||||
If a TC member feels they are affected by a conflict of interest with regards to the case, they should announce it and recurse themselves from the TC
|
||||
discussion and vote.
|
||||
|
||||
A conflict of interest is presumed to occur when a TC member has a personal interest (e.g. financial) in a specific outcome of the case.
|
||||
|
||||
@@ -88,7 +88,7 @@ static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE *fout)
|
||||
enc_pkt->stream_index = 0;
|
||||
ret = fwrite(enc_pkt->data, enc_pkt->size, 1, fout);
|
||||
av_packet_unref(enc_pkt);
|
||||
if (!ret) {
|
||||
if (ret != enc_pkt->size) {
|
||||
ret = AVERROR(errno);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -11,21 +11,16 @@ 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
|
||||
|
||||
+69
-106
@@ -21294,6 +21294,27 @@ If the specified expression is not valid, it is kept at its current
|
||||
value.
|
||||
@end table
|
||||
|
||||
@section scale_vt
|
||||
|
||||
Scale and convert the color parameters using VTPixelTransferSession.
|
||||
|
||||
The filter accepts the following options:
|
||||
@table @option
|
||||
@item w
|
||||
@item h
|
||||
Set the output video dimension expression. Default value is the input dimension.
|
||||
|
||||
@item color_matrix
|
||||
Set the output colorspace matrix.
|
||||
|
||||
@item color_primaries
|
||||
Set the output color primaries.
|
||||
|
||||
@item color_transfer
|
||||
Set the output transfer characteristics.
|
||||
|
||||
@end table
|
||||
|
||||
@section scharr
|
||||
Apply scharr operator to input video stream.
|
||||
|
||||
@@ -26903,12 +26924,6 @@ frame-consumer that exhausts the limited decoder frame pool.
|
||||
If set to 1, frames are passed through as-is if they match the desired output
|
||||
parameters. This is the default behaviour.
|
||||
|
||||
@item use_filters
|
||||
If set to 1, filter with a generic weight LUT instead of using fixed-function
|
||||
shader kernels. May be faster or slower depending on the hardware. A value
|
||||
of @code{auto} (the default) enables this automatically when required for
|
||||
correct anti-aliasing when downscaling.
|
||||
|
||||
@item param
|
||||
Algorithm-Specific parameter.
|
||||
|
||||
@@ -28715,106 +28730,6 @@ drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
|
||||
|
||||
@c man end VAAPI VIDEO FILTERS
|
||||
|
||||
@chapter VideoToolbox Video Filters
|
||||
@c man begin VIDEOTOOLBOX VIDEO FILTERS
|
||||
|
||||
Below is a description of the currently available VideoToolbox video filters.
|
||||
|
||||
VideoToolbox filter depends on VideoToolbox framework, and is auto detected
|
||||
when building ffmpeg for an Apple platform such as macOS. Add
|
||||
@code{--enable-videotoolbox} to configure if autodetect is disabled.
|
||||
|
||||
@section scale_vt
|
||||
|
||||
Scale and convert the color parameters using VTPixelTransferSession.
|
||||
|
||||
The filter accepts the following options:
|
||||
@table @option
|
||||
@item w
|
||||
@item h
|
||||
Set the output video dimension expression. Default value is the input dimension.
|
||||
|
||||
@item color_matrix
|
||||
Set the output colorspace matrix.
|
||||
|
||||
@item color_primaries
|
||||
Set the output color primaries.
|
||||
|
||||
@item color_transfer
|
||||
Set the output transfer characteristics.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Perform HDR to SDR conversion, and scale to half size of input
|
||||
@example
|
||||
ffmpeg -hwaccel videotoolbox \
|
||||
-hwaccel_output_format videotoolbox_vld \
|
||||
-i hdr.mov \
|
||||
-c:v hevc_videotoolbox \
|
||||
-profile:v main \
|
||||
-b:v 3M \
|
||||
-vf scale_vt=w=iw/2:h=ih/2:color_matrix=bt709:color_primaries=bt709:color_transfer=bt709 \
|
||||
-c:a copy \
|
||||
-tag:v hvc1 \
|
||||
sdr.mp4
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
@section transpose_vt
|
||||
|
||||
Transpose rows with columns in the input video and optionally flip it.
|
||||
For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
@table @option
|
||||
|
||||
@item dir
|
||||
Specify the transposition direction.
|
||||
|
||||
Can assume the following values:
|
||||
@table @samp
|
||||
@item cclock_flip
|
||||
Rotate by 90 degrees counterclockwise and vertically flip. (default)
|
||||
|
||||
@item clock
|
||||
Rotate by 90 degrees clockwise.
|
||||
|
||||
@item cclock
|
||||
Rotate by 90 degrees counterclockwise.
|
||||
|
||||
@item clock_flip
|
||||
Rotate by 90 degrees clockwise and vertically flip.
|
||||
|
||||
@item hflip
|
||||
Flip the input video horizontally.
|
||||
|
||||
@item vflip
|
||||
Flip the input video vertically.
|
||||
|
||||
@end table
|
||||
|
||||
@item passthrough
|
||||
Do not apply the transposition if the input geometry matches the one
|
||||
specified by the specified value. It accepts the following values:
|
||||
@table @samp
|
||||
@item none
|
||||
Always apply transposition. (default)
|
||||
@item portrait
|
||||
Preserve portrait geometry (when @var{height} >= @var{width}).
|
||||
@item landscape
|
||||
Preserve landscape geometry (when @var{width} >= @var{height}).
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@c man end VIDEOTOOLBOX VIDEO FILTERS
|
||||
|
||||
@chapter Vulkan Video Filters
|
||||
@c man begin VULKAN VIDEO FILTERS
|
||||
|
||||
@@ -29116,6 +29031,54 @@ Default value is @code{0}.
|
||||
|
||||
@end table
|
||||
|
||||
@section transpose_vt
|
||||
|
||||
Transpose rows with columns in the input video and optionally flip it.
|
||||
For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
@table @option
|
||||
|
||||
@item dir
|
||||
Specify the transposition direction.
|
||||
|
||||
Can assume the following values:
|
||||
@table @samp
|
||||
@item cclock_flip
|
||||
Rotate by 90 degrees counterclockwise and vertically flip. (default)
|
||||
|
||||
@item clock
|
||||
Rotate by 90 degrees clockwise.
|
||||
|
||||
@item cclock
|
||||
Rotate by 90 degrees counterclockwise.
|
||||
|
||||
@item clock_flip
|
||||
Rotate by 90 degrees clockwise and vertically flip.
|
||||
|
||||
@item hflip
|
||||
Flip the input video horizontally.
|
||||
|
||||
@item vflip
|
||||
Flip the input video vertically.
|
||||
|
||||
@end table
|
||||
|
||||
@item passthrough
|
||||
Do not apply the transposition if the input geometry matches the one
|
||||
specified by the specified value. It accepts the following values:
|
||||
@table @samp
|
||||
@item none
|
||||
Always apply transposition. (default)
|
||||
@item portrait
|
||||
Preserve portrait geometry (when @var{height} >= @var{width}).
|
||||
@item landscape
|
||||
Preserve landscape geometry (when @var{width} >= @var{height}).
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@section transpose_vulkan
|
||||
|
||||
Transpose rows with columns in the input video and optionally flip it.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3955,10 +3955,6 @@ Default value is 5000.
|
||||
Set the maximum size, in bytes, of RTP packets that send out.
|
||||
Default value is 1500.
|
||||
|
||||
@item ts_buffer_size @var{integer}
|
||||
Set the buffer size, in bytes, of underlying protocol.
|
||||
Default value is -1(auto). The UDP auto selects a reasonable value.
|
||||
|
||||
@item authorization @var{string}
|
||||
The optional Bearer token for WHIP Authorization.
|
||||
|
||||
|
||||
+2
-3
@@ -806,6 +806,8 @@ static int check_keyboard_interaction(int64_t cur_time)
|
||||
{
|
||||
int i, key;
|
||||
static int64_t last_time;
|
||||
if (received_nb_signals)
|
||||
return AVERROR_EXIT;
|
||||
/* read_key() returns 0 on EOF */
|
||||
if (cur_time - last_time >= 100000) {
|
||||
key = read_key();
|
||||
@@ -889,9 +891,6 @@ static int transcode(Scheduler *sch)
|
||||
while (!sch_wait(sch, stats_period, &transcode_ts)) {
|
||||
int64_t cur_time= av_gettime_relative();
|
||||
|
||||
if (received_nb_signals)
|
||||
break;
|
||||
|
||||
/* if 'q' pressed, exits */
|
||||
if (stdin_interaction)
|
||||
if (check_keyboard_interaction(cur_time) < 0)
|
||||
|
||||
+1
-3
@@ -257,8 +257,6 @@ typedef struct OptionsContext {
|
||||
SpecifierOptList enc_stats_pre_fmt;
|
||||
SpecifierOptList enc_stats_post_fmt;
|
||||
SpecifierOptList mux_stats_fmt;
|
||||
|
||||
int depth;
|
||||
} OptionsContext;
|
||||
|
||||
enum IFilterFlags {
|
||||
@@ -448,7 +446,7 @@ typedef struct Decoder {
|
||||
|
||||
enum AVMediaType type;
|
||||
|
||||
uint8_t *subtitle_header;
|
||||
const uint8_t *subtitle_header;
|
||||
int subtitle_header_size;
|
||||
|
||||
// number of frames/samples retrieved from the decoder
|
||||
|
||||
+2
-11
@@ -136,8 +136,6 @@ void dec_free(Decoder **pdec)
|
||||
av_frame_free(&dp->sub_prev[i]);
|
||||
av_frame_free(&dp->sub_heartbeat);
|
||||
|
||||
av_freep(&dp->dec.subtitle_header);
|
||||
|
||||
av_freep(&dp->parent_name);
|
||||
|
||||
av_freep(&dp->views_requested);
|
||||
@@ -1619,15 +1617,8 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
|
||||
dp->dec_ctx->extra_hw_frames = extra_frames;
|
||||
}
|
||||
|
||||
if (dp->dec_ctx->subtitle_header) {
|
||||
/* ASS code assumes this buffer is null terminated so add extra byte. */
|
||||
dp->dec.subtitle_header = av_mallocz(dp->dec_ctx->subtitle_header_size + 1);
|
||||
if (!dp->dec.subtitle_header)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(dp->dec.subtitle_header, dp->dec_ctx->subtitle_header,
|
||||
dp->dec_ctx->subtitle_header_size);
|
||||
dp->dec.subtitle_header_size = dp->dec_ctx->subtitle_header_size;
|
||||
}
|
||||
dp->dec.subtitle_header = dp->dec_ctx->subtitle_header;
|
||||
dp->dec.subtitle_header_size = dp->dec_ctx->subtitle_header_size;
|
||||
|
||||
if (param_out) {
|
||||
if (dp->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
|
||||
+34
-118
@@ -67,7 +67,6 @@ typedef struct DemuxStream {
|
||||
int reinit_filters;
|
||||
int autorotate;
|
||||
int apply_cropping;
|
||||
int force_display_matrix;
|
||||
int drop_changed;
|
||||
|
||||
|
||||
@@ -96,6 +95,12 @@ typedef struct DemuxStream {
|
||||
uint64_t nb_packets;
|
||||
// combined size of all the packets read
|
||||
uint64_t data_size;
|
||||
// latest wallclock time at which packet reading resumed after a stall - used for readrate
|
||||
int64_t resume_wc;
|
||||
// timestamp of first packet sent after the latest stall - used for readrate
|
||||
int64_t resume_pts;
|
||||
// measure of how far behind packet reading is against spceified readrate
|
||||
int64_t lag;
|
||||
} DemuxStream;
|
||||
|
||||
typedef struct Demuxer {
|
||||
@@ -131,13 +136,6 @@ typedef struct Demuxer {
|
||||
double readrate_initial_burst;
|
||||
float readrate_catchup;
|
||||
|
||||
// latest wallclock time at which packet reading resumed after a stall - used for readrate
|
||||
int64_t resume_wc;
|
||||
// relative timestamp of first packet sent after the latest stall - used for readrate
|
||||
int64_t resume_progress;
|
||||
// measure of how far behind packet reading is against spceified readrate
|
||||
int64_t lag;
|
||||
|
||||
Scheduler *sch;
|
||||
|
||||
AVPacket *pkt_heartbeat;
|
||||
@@ -508,55 +506,40 @@ static void readrate_sleep(Demuxer *d)
|
||||
int64_t initial_burst = AV_TIME_BASE * d->readrate_initial_burst;
|
||||
int resume_warn = 0;
|
||||
|
||||
DemuxStream *slowest = NULL;
|
||||
int64_t progress = INT64_MAX;
|
||||
|
||||
for (int i = 0; i < f->nb_streams; i++) {
|
||||
InputStream *ist = f->streams[i];
|
||||
DemuxStream *ds = ds_from_ist(ist);
|
||||
int64_t stream_ts_offset, pts, pts_diff;
|
||||
if (ds->discard || ds->finished || ds->first_dts == AV_NOPTS_VALUE)
|
||||
continue;
|
||||
int64_t stream_ts_offset, pts, now, wc_elapsed, elapsed, lag, max_pts, limit_pts;
|
||||
|
||||
stream_ts_offset = FFMAX(ds->first_dts, file_start);
|
||||
if (ds->discard) continue;
|
||||
|
||||
stream_ts_offset = FFMAX(ds->first_dts != AV_NOPTS_VALUE ? ds->first_dts : 0, file_start);
|
||||
pts = av_rescale(ds->dts, 1000000, AV_TIME_BASE);
|
||||
pts_diff = pts - stream_ts_offset;
|
||||
if (pts_diff < progress) {
|
||||
progress = pts_diff;
|
||||
slowest = ds;
|
||||
now = av_gettime_relative();
|
||||
wc_elapsed = now - d->wallclock_start;
|
||||
max_pts = stream_ts_offset + initial_burst + wc_elapsed * d->readrate;
|
||||
lag = FFMAX(max_pts - pts, 0);
|
||||
if ( (!ds->lag && lag > 0.3 * AV_TIME_BASE) || ( lag > ds->lag + 0.3 * AV_TIME_BASE) ) {
|
||||
ds->lag = lag;
|
||||
ds->resume_wc = now;
|
||||
ds->resume_pts = pts;
|
||||
av_log_once(ds, AV_LOG_WARNING, AV_LOG_DEBUG, &resume_warn,
|
||||
"Resumed reading at pts %0.3f with rate %0.3f after a lag of %0.3fs\n",
|
||||
(float)pts/AV_TIME_BASE, d->readrate_catchup, (float)lag/AV_TIME_BASE);
|
||||
}
|
||||
if (ds->lag && !lag)
|
||||
ds->lag = ds->resume_wc = ds->resume_pts = 0;
|
||||
if (ds->resume_wc) {
|
||||
elapsed = now - ds->resume_wc;
|
||||
limit_pts = ds->resume_pts + elapsed * d->readrate_catchup;
|
||||
} else {
|
||||
elapsed = wc_elapsed;
|
||||
limit_pts = max_pts;
|
||||
}
|
||||
|
||||
if (pts > limit_pts)
|
||||
av_usleep(pts - limit_pts);
|
||||
}
|
||||
|
||||
if (!slowest || progress <= initial_burst)
|
||||
return;
|
||||
|
||||
int64_t now = av_gettime_relative();
|
||||
int64_t wc_elapsed = now - d->wallclock_start;
|
||||
int64_t max_prog = initial_burst + (int64_t)(wc_elapsed * d->readrate);
|
||||
int64_t lag = FFMAX(max_prog - progress, 0);
|
||||
int64_t limit;
|
||||
|
||||
if ( (!d->lag && lag > 0.3 * AV_TIME_BASE) || ( lag > d->lag + 0.3 * AV_TIME_BASE) ) {
|
||||
d->lag = lag;
|
||||
d->resume_wc = now;
|
||||
d->resume_progress = progress;
|
||||
|
||||
int64_t pts = FFMAX(slowest->first_dts, file_start) + progress;
|
||||
av_log_once(slowest, AV_LOG_WARNING, AV_LOG_DEBUG, &resume_warn,
|
||||
"Resumed reading at pts %0.3f with rate %0.3f after a lag of %0.3fs\n",
|
||||
(float)pts/AV_TIME_BASE, d->readrate_catchup, (float)lag/AV_TIME_BASE);
|
||||
}
|
||||
if (d->lag && !lag)
|
||||
d->lag = d->resume_wc = d->resume_progress = 0;
|
||||
if (d->resume_wc) {
|
||||
int64_t elapsed = now - d->resume_wc;
|
||||
limit = d->resume_progress + (int64_t)(elapsed * d->readrate_catchup);
|
||||
} else {
|
||||
limit = max_prog;
|
||||
}
|
||||
|
||||
if (progress > limit)
|
||||
av_usleep(progress - limit);
|
||||
}
|
||||
|
||||
static int do_send(Demuxer *d, DemuxStream *ds, AVPacket *pkt, unsigned flags,
|
||||
@@ -1200,7 +1183,6 @@ static int add_display_matrix_to_stream(const OptionsContext *o,
|
||||
AVFormatContext *ctx, InputStream *ist)
|
||||
{
|
||||
AVStream *st = ist->st;
|
||||
DemuxStream *ds = ds_from_ist(ist);
|
||||
AVPacketSideData *sd;
|
||||
double rotation = DBL_MAX;
|
||||
int hflip = -1, vflip = -1;
|
||||
@@ -1235,8 +1217,6 @@ static int add_display_matrix_to_stream(const OptionsContext *o,
|
||||
hflip_set ? hflip : 0,
|
||||
vflip_set ? vflip : 0);
|
||||
|
||||
ds->force_display_matrix = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1475,15 +1455,6 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st, AVDictiona
|
||||
av_dict_set_int(&ds->decoder_opts, "apply_cropping",
|
||||
ds->apply_cropping && ds->apply_cropping != CROP_CONTAINER, 0);
|
||||
|
||||
if (ds->force_display_matrix) {
|
||||
char buf[32];
|
||||
if (av_dict_get(ds->decoder_opts, "side_data_prefer_packet", NULL, 0))
|
||||
buf[0] = ',';
|
||||
else
|
||||
buf[0] = '\0';
|
||||
av_strlcat(buf, "displaymatrix", sizeof(buf));
|
||||
av_dict_set(&ds->decoder_opts, "side_data_prefer_packet", buf, AV_DICT_APPEND);
|
||||
}
|
||||
/* Attached pics are sparse, therefore we would not want to delay their decoding
|
||||
* till EOF. */
|
||||
if (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)
|
||||
@@ -1602,56 +1573,6 @@ 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;
|
||||
@@ -1663,13 +1584,8 @@ 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);
|
||||
|
||||
@@ -1593,7 +1593,7 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o)
|
||||
{
|
||||
AVFormatContext *oc = mux->fc;
|
||||
InputStream *best_ist = NULL;
|
||||
int64_t best_score = 0;
|
||||
int best_score = 0;
|
||||
int qcr;
|
||||
|
||||
/* video: highest resolution */
|
||||
@@ -1604,16 +1604,16 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o)
|
||||
for (int j = 0; j < nb_input_files; j++) {
|
||||
InputFile *ifile = input_files[j];
|
||||
InputStream *file_best_ist = NULL;
|
||||
int64_t file_best_score = 0;
|
||||
int file_best_score = 0;
|
||||
for (int i = 0; i < ifile->nb_streams; i++) {
|
||||
InputStream *ist = ifile->streams[i];
|
||||
int64_t score;
|
||||
int score;
|
||||
|
||||
if (ist->user_set_discard == AVDISCARD_ALL ||
|
||||
ist->st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
continue;
|
||||
|
||||
score = ist->st->codecpar->width * (int64_t)ist->st->codecpar->height
|
||||
score = ist->st->codecpar->width * ist->st->codecpar->height
|
||||
+ 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
|
||||
+ 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
|
||||
if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
|
||||
|
||||
@@ -558,8 +558,6 @@ 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],
|
||||
@@ -1023,12 +1021,6 @@ 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);
|
||||
|
||||
@@ -1040,7 +1032,6 @@ 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;
|
||||
|
||||
@@ -1068,7 +1059,6 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
}
|
||||
|
||||
fail:
|
||||
o->depth = depth;
|
||||
fclose(f);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/common.h"
|
||||
|
||||
+2
-2
@@ -45,6 +45,7 @@ OBJS = ac3_parser.o \
|
||||
get_buffer.o \
|
||||
imgconvert.o \
|
||||
jni.o \
|
||||
lcevcdec.o \
|
||||
mathtables.o \
|
||||
mediacodec.o \
|
||||
mpeg12framerate.o \
|
||||
@@ -127,7 +128,6 @@ 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
|
||||
@@ -637,7 +637,7 @@ OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o proresdsp.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_RAW_DECODER) += prores_raw.o proresdsp.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_RAW_DECODER) += prores_raw.o
|
||||
OBJS-$(CONFIG_PRORES_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
|
||||
OBJS-$(CONFIG_PROSUMER_DECODER) += prosumer.o
|
||||
OBJS-$(CONFIG_PSD_DECODER) += psd.o
|
||||
|
||||
+3
-40
@@ -62,7 +62,6 @@
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/tx.h"
|
||||
#include "libavutil/version.h"
|
||||
#include "libavutil/refstruct.h"
|
||||
|
||||
/*
|
||||
* supported tools
|
||||
@@ -164,12 +163,6 @@ 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]);
|
||||
@@ -428,26 +421,6 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
return layout;
|
||||
}
|
||||
|
||||
static void copy_oc(OutputConfiguration *dst, OutputConfiguration *src)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < src->usac.nb_elems; i++) {
|
||||
AACUsacElemConfig *src_e = &src->usac.elems[i];
|
||||
AACUsacElemConfig *dst_e = &dst->usac.elems[i];
|
||||
/* dst_e->ext.pl_buf is guaranteed to be set to src_e->ext.pl_buf
|
||||
* upon this function's return */
|
||||
av_refstruct_replace(&dst_e->ext.pl_buf, src_e->ext.pl_buf);
|
||||
}
|
||||
|
||||
/* Unref all additional buffers to close leaks */
|
||||
for (; i < dst->usac.nb_elems; i++)
|
||||
av_refstruct_unref(&dst->usac.elems[i].ext.pl_buf);
|
||||
|
||||
/* Set all other properties */
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save current output configuration if and only if it has been locked.
|
||||
*/
|
||||
@@ -456,7 +429,7 @@ static int push_output_configuration(AACDecContext *ac)
|
||||
int pushed = 0;
|
||||
|
||||
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
|
||||
copy_oc(&ac->oc[0], &ac->oc[1]);
|
||||
ac->oc[0] = ac->oc[1];
|
||||
pushed = 1;
|
||||
}
|
||||
ac->oc[1].status = OC_NONE;
|
||||
@@ -470,8 +443,7 @@ static int push_output_configuration(AACDecContext *ac)
|
||||
static void pop_output_configuration(AACDecContext *ac)
|
||||
{
|
||||
if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
|
||||
copy_oc(&ac->oc[1], &ac->oc[0]);
|
||||
|
||||
ac->oc[1] = ac->oc[0];
|
||||
ac->avctx->ch_layout = ac->oc[1].ch_layout;
|
||||
ff_aac_output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
|
||||
ac->oc[1].status, 0);
|
||||
@@ -494,9 +466,6 @@ int ff_aac_output_configure(AACDecContext *ac,
|
||||
uint8_t id_map[TYPE_END][MAX_ELEM_ID] = {{ 0 }};
|
||||
uint8_t type_counts[TYPE_END] = { 0 };
|
||||
|
||||
if (get_new_frame && !ac->frame)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (ac->oc[1].layout_map != layout_map) {
|
||||
memcpy(ac->oc[1].layout_map, layout_map, tags * sizeof(layout_map[0]));
|
||||
ac->oc[1].layout_map_tags = tags;
|
||||
@@ -1138,7 +1107,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
AACUSACConfig *usac = &oc->usac;
|
||||
for (int j = 0; j < usac->nb_elems; j++) {
|
||||
AACUsacElemConfig *ec = &usac->elems[j];
|
||||
av_refstruct_unref(&ec->ext.pl_buf);
|
||||
av_freep(&ec->ext.pl_data);
|
||||
}
|
||||
|
||||
av_channel_layout_uninit(&ac->oc[i].ch_layout);
|
||||
@@ -2383,12 +2352,6 @@ static int decode_frame_ga(AVCodecContext *avctx, AACDecContext *ac,
|
||||
ac->oc[1].status = OC_LOCKED;
|
||||
}
|
||||
|
||||
if (samples && avctx->sample_rate <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Cannot output a frame without a valid sample rate\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (!ac->frame->data[0] && samples) {
|
||||
av_log(avctx, AV_LOG_ERROR, "no frame data found\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -344,7 +344,7 @@ typedef struct AACUsacElemConfig {
|
||||
uint8_t payload_frag;
|
||||
uint32_t default_len;
|
||||
uint32_t pl_data_offset;
|
||||
uint8_t *pl_buf;
|
||||
uint8_t *pl_data;
|
||||
} ext;
|
||||
} AACUsacElemConfig;
|
||||
|
||||
@@ -353,7 +353,7 @@ typedef struct AACUSACConfig {
|
||||
uint16_t core_frame_len;
|
||||
uint16_t stream_identifier;
|
||||
|
||||
AACUsacElemConfig elems[MAX_ELEM_ID];
|
||||
AACUsacElemConfig elems[64];
|
||||
int nb_elems;
|
||||
|
||||
struct {
|
||||
|
||||
@@ -24,13 +24,12 @@
|
||||
#include "aacdec_ac.h"
|
||||
|
||||
#include "libavcodec/aacsbr.h"
|
||||
|
||||
#include "libavcodec/aactab.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavcodec/mpeg4audio.h"
|
||||
#include "libavcodec/unary.h"
|
||||
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/refstruct.h"
|
||||
|
||||
/* Number of scalefactor bands per complex prediction band, equal to 2. */
|
||||
#define SFB_PER_PRED_BAND 2
|
||||
|
||||
@@ -213,33 +212,18 @@ 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 */
|
||||
|
||||
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;
|
||||
if (get_bits1(gb)) /* bsOttBandsPhasePresent */
|
||||
e->mps.otts_bands_phase = get_bits(gb, 5); /* bsOttBandsPhase */
|
||||
|
||||
e->mps.residual_coding = e->stereo_config_index >= 2; /* bsResidualCoding */
|
||||
if (e->mps.residual_coding) {
|
||||
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.residual_bands = get_bits(gb, 5); /* bsResidualBands */
|
||||
e->mps.pseudo_lr = get_bits1(gb); /* bsPseudoLr */
|
||||
}
|
||||
if (e->mps.temp_shape_config == 2)
|
||||
@@ -330,7 +314,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[j];
|
||||
SingleChannelElement *sce = &che->ch[ch];
|
||||
AACUsacElemData *ue = &sce->ue;
|
||||
|
||||
memset(ue, 0, sizeof(*ue));
|
||||
@@ -373,8 +357,6 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx,
|
||||
freq_idx = get_bits(gb, 5); /* usacSamplingFrequencyIndex */
|
||||
if (freq_idx == 0x1f) {
|
||||
samplerate = get_bits(gb, 24); /* usacSamplingFrequency */
|
||||
if (samplerate == 0)
|
||||
return AVERROR(EINVAL);
|
||||
} else {
|
||||
samplerate = ff_aac_usac_samplerate[freq_idx];
|
||||
if (samplerate < 0)
|
||||
@@ -1305,8 +1287,7 @@ static void spectrum_decode(AACDecContext *ac, AACUSACConfig *usac,
|
||||
SingleChannelElement *sce = &cpe->ch[ch];
|
||||
AACUsacElemData *ue = &sce->ue;
|
||||
|
||||
if (!ue->core_mode)
|
||||
spectrum_scale(ac, sce, ue);
|
||||
spectrum_scale(ac, sce, ue);
|
||||
}
|
||||
|
||||
if (nb_channels > 1 && us->common_window) {
|
||||
@@ -1356,9 +1337,8 @@ 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);
|
||||
|
||||
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);
|
||||
ac->oc[1].m4ac.frame_length_short ? ac->dsp.imdct_and_windowing_768(ac, sce) :
|
||||
ac->dsp.imdct_and_windowing(ac, sce);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1594,6 +1574,7 @@ static int parse_audio_preroll(AACDecContext *ac, GetBitContext *gb)
|
||||
static int parse_ext_ele(AACDecContext *ac, AACUsacElemConfig *e,
|
||||
GetBitContext *gb)
|
||||
{
|
||||
uint8_t *tmp;
|
||||
uint8_t pl_frag_start = 1;
|
||||
uint8_t pl_frag_end = 1;
|
||||
uint32_t len;
|
||||
@@ -1620,26 +1601,18 @@ static int parse_ext_ele(AACDecContext *ac, AACUsacElemConfig *e,
|
||||
if (pl_frag_start)
|
||||
e->ext.pl_data_offset = 0;
|
||||
|
||||
/* If an extension starts and ends this packet, we can directly use it below.
|
||||
* Otherwise, we have to copy it to a buffer and accumulate it. */
|
||||
/* If an extension starts and ends this packet, we can directly use it */
|
||||
if (!(pl_frag_start && pl_frag_end)) {
|
||||
/* Reallocate the data */
|
||||
uint8_t *tmp_buf = av_refstruct_alloc_ext(e->ext.pl_data_offset + len,
|
||||
AV_REFSTRUCT_FLAG_NO_ZEROING,
|
||||
NULL, NULL);
|
||||
if (!tmp_buf)
|
||||
tmp = av_realloc(e->ext.pl_data, e->ext.pl_data_offset + len);
|
||||
if (!tmp) {
|
||||
av_free(e->ext.pl_data);
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
/* Copy the data over only if we had saved data to begin with */
|
||||
if (e->ext.pl_buf)
|
||||
memcpy(tmp_buf, e->ext.pl_buf, e->ext.pl_data_offset);
|
||||
|
||||
av_refstruct_unref(&e->ext.pl_buf);
|
||||
e->ext.pl_buf = tmp_buf;
|
||||
}
|
||||
e->ext.pl_data = tmp;
|
||||
|
||||
/* Readout data to a buffer */
|
||||
for (int i = 0; i < len; i++)
|
||||
e->ext.pl_buf[e->ext.pl_data_offset + i] = get_bits(gb, 8);
|
||||
e->ext.pl_data[e->ext.pl_data_offset + i] = get_bits(gb, 8);
|
||||
}
|
||||
|
||||
e->ext.pl_data_offset += len;
|
||||
@@ -1651,7 +1624,7 @@ static int parse_ext_ele(AACDecContext *ac, AACUsacElemConfig *e,
|
||||
GetBitContext *gb2 = gb;
|
||||
GetBitContext gbc;
|
||||
if (!(pl_frag_start && pl_frag_end)) {
|
||||
ret = init_get_bits8(&gbc, e->ext.pl_buf, pl_len);
|
||||
ret = init_get_bits8(&gbc, e->ext.pl_data, pl_len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1669,7 +1642,7 @@ static int parse_ext_ele(AACDecContext *ac, AACUsacElemConfig *e,
|
||||
/* This should never happen */
|
||||
av_assert0(0);
|
||||
}
|
||||
av_refstruct_unref(&e->ext.pl_buf);
|
||||
av_freep(&e->ext.pl_data);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -147,15 +147,15 @@ get_next:
|
||||
} else {
|
||||
#if CONFIG_AAC_PARSER
|
||||
AACADTSHeaderInfo hdr;
|
||||
GetBitContext gb;
|
||||
|
||||
init_get_bits8(&gb, buf, buf_size);
|
||||
if (buf_size < AV_AAC_ADTS_HEADER_SIZE ||
|
||||
ff_adts_header_parse_buf(buf, &hdr) < 0)
|
||||
ff_adts_header_parse(&gb, &hdr) < 0)
|
||||
return i;
|
||||
|
||||
if (avctx->profile == AV_PROFILE_UNKNOWN)
|
||||
avctx->profile = hdr.object_type - 1;
|
||||
/* ADTS does not support USAC */
|
||||
s1->key_frame = 1;
|
||||
avctx->profile = hdr.object_type - 1;
|
||||
s1->key_frame = (avctx->profile == AV_PROFILE_AAC_USAC) ? get_bits1(&gb) : 1;
|
||||
bit_rate = hdr.bit_rate;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ static inline void quantize_bands(int *out, const float *in, const float *scaled
|
||||
{
|
||||
for (int i = 0; i < size; i++) {
|
||||
float qc = scaled[i] * Q34;
|
||||
int tmp = (int)FFMIN((float)(qc + rounding), (float)maxval);
|
||||
int tmp = (int)FFMIN(qc + rounding, (float)maxval);
|
||||
if (is_signed && in[i] < 0.0f) {
|
||||
tmp = -tmp;
|
||||
}
|
||||
|
||||
@@ -489,10 +489,10 @@ function ff_pred16x16_plane_neon_10, export=1
|
||||
mul v2.8h, v2.8h, v0.8h
|
||||
mul v3.8h, v3.8h, v0.8h
|
||||
addp v2.8h, v2.8h, v3.8h
|
||||
saddlp v2.4s, v2.8h
|
||||
addp v2.4s, v2.4s, v2.4s
|
||||
shl v3.4s, v2.4s, #2
|
||||
add v2.4s, v3.4s, v2.4s
|
||||
addp v2.8h, v2.8h, v2.8h
|
||||
addp v2.4h, v2.4h, v2.4h
|
||||
sshll v3.4s, v2.4h, #2
|
||||
saddw v2.4s, v3.4s, v2.4h
|
||||
rshrn v4.4h, v2.4s, #6
|
||||
trn2 v5.4h, v4.4h, v4.4h
|
||||
add v2.4h, v4.4h, v5.4h
|
||||
@@ -506,13 +506,14 @@ function ff_pred16x16_plane_neon_10, export=1
|
||||
sxtl v6.4s, v5.4h // c
|
||||
|
||||
mov v0.h[0], wzr
|
||||
mul v0.8h, v0.8h, v4.h[0]
|
||||
dup v16.4s, v2.s[0]
|
||||
dup v17.4s, v2.s[0]
|
||||
dup v2.8h, v4.h[0] // b
|
||||
dup v3.4s, v6.s[0] // c
|
||||
sshll v2.4s, v2.4h, #3 // b * 8
|
||||
smlal v16.4s, v0.4h, v4.h[0]
|
||||
smlal2 v17.4s, v0.8h, v4.h[0]
|
||||
saddw v16.4s, v16.4s, v0.4h
|
||||
saddw2 v17.4s, v17.4s, v0.8h
|
||||
sub v3.4s, v3.4s, v2.4s
|
||||
|
||||
mov w3, #16
|
||||
|
||||
@@ -50,13 +50,12 @@
|
||||
.endm
|
||||
|
||||
.macro pixels16_x2 rnd=1, avg=0
|
||||
1:
|
||||
ldur q1, [x1, #1]
|
||||
ld1 {v0.16b}, [x1], x2
|
||||
1: ld1 {v0.16b, v1.16b}, [x1], x2
|
||||
ld1 {v2.16b, v3.16b}, [x1], x2
|
||||
subs w3, w3, #2
|
||||
ldur q3, [x1, #1]
|
||||
ld1 {v2.16b}, [x1], x2
|
||||
ext v1.16b, v0.16b, v1.16b, #1
|
||||
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
|
||||
@@ -109,20 +108,20 @@
|
||||
|
||||
.macro pixels16_xy2 rnd=1, avg=0
|
||||
sub w3, w3, #2
|
||||
ldur q1, [x1, #1]
|
||||
ld1 {v0.16b}, [x1], x2
|
||||
ld1 {v0.16b, v1.16b}, [x1], x2
|
||||
ld1 {v4.16b, v5.16b}, [x1], x2
|
||||
NRND movi v26.8H, #1
|
||||
ldur q5, [x1, #1]
|
||||
ld1 {v4.16b}, [x1], x2
|
||||
ext v1.16b, v0.16b, v1.16b, #1
|
||||
ext v5.16b, v4.16b, v5.16b, #1
|
||||
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
|
||||
ldur q30, [x1, #1]
|
||||
ld1 {v0.16b}, [x1], x2
|
||||
ld1 {v0.16b, v1.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
|
||||
@@ -132,12 +131,12 @@ NRND add v1.8H, v1.8H, v26.8H
|
||||
urhadd v28.16b, v28.16b, v16.16b
|
||||
.endif
|
||||
uaddl v16.8h, v0.8b, v30.8b
|
||||
ldur q3, [x1, #1]
|
||||
ld1 {v2.16b}, [x1], x2
|
||||
ld1 {v2.16b, v3.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
|
||||
@@ -151,10 +150,10 @@ NRND add v0.8H, v0.8H, v26.8H
|
||||
st1 {v30.16b}, [x0], x2
|
||||
b.gt 1b
|
||||
|
||||
ldur q30, [x1, #1]
|
||||
ld1 {v0.16b}, [x1], x2
|
||||
ld1 {v0.16b, v1.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
|
||||
@@ -207,11 +206,10 @@ NRND add v0.8H, v0.8H, v26.8H
|
||||
.endm
|
||||
|
||||
.macro pixels8_x2 rnd=1, avg=0
|
||||
1:
|
||||
ldur d1, [x1, #1]
|
||||
ld1 {v0.8b}, [x1], x2
|
||||
ldur d3, [x1, #1]
|
||||
ld1 {v2.8b}, [x1], x2
|
||||
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
|
||||
subs w3, w3, #2
|
||||
avg v0.8b, v0.8b, v1.8b
|
||||
avg v2.8b, v2.8b, v3.8b
|
||||
@@ -265,23 +263,22 @@ 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.8b}, [x1], x2
|
||||
ld1 {v0.16b}, [x1], x2
|
||||
ld1 {v1.16b}, [x1], x2
|
||||
NRND movi v19.8H, #1
|
||||
ldur d6, [x1, #1]
|
||||
ld1 {v1.8b}, [x1], x2
|
||||
ext v4.16b, v0.16b, v4.16b, #1
|
||||
ext v6.16b, v1.16b, v6.16b, #1
|
||||
uaddl v16.8h, v0.8b, v4.8b
|
||||
uaddl v17.8h, v1.8b, v6.8b
|
||||
1: subs w3, w3, #2
|
||||
ldur d4, [x1, #1]
|
||||
ld1 {v0.8b}, [x1], x2
|
||||
ld1 {v0.16b}, [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
|
||||
ldur d6, [x1, #1]
|
||||
ld1 {v1.8b}, [x1], x2
|
||||
ld1 {v1.16b}, [x1], x2
|
||||
add v18.8h, v16.8h, v17.8h
|
||||
.if \avg
|
||||
ld1 {v7.8b}, [x0]
|
||||
@@ -294,13 +291,14 @@ 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
|
||||
|
||||
ldur d4, [x1, #1]
|
||||
ld1 {v0.8b}, [x1], x2
|
||||
ld1 {v0.16b}, [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
|
||||
|
||||
@@ -1037,8 +1037,6 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
|
||||
if(ch <= 0)
|
||||
return 0;
|
||||
if (buf_size > INT_MAX / 14)
|
||||
return 0;
|
||||
|
||||
switch (avctx->codec->id) {
|
||||
/* constant, only check buf_size */
|
||||
|
||||
+6
-10
@@ -408,14 +408,12 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
|
||||
int map = s->map[x];
|
||||
|
||||
if (orig_mv_x >= -32) {
|
||||
int src_y = (s->blocks_h - 1 - y) * 8 - mv_y;
|
||||
int src_x = x * 8 + mv_x;
|
||||
if (src_y < 0 || src_y + 8 > h ||
|
||||
src_x < 0 || src_x + 8 > w)
|
||||
if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h ||
|
||||
x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,
|
||||
prev->data[plane] + src_y * prev->linesize[plane] + src_x,
|
||||
prev->data[plane] + ((s->blocks_h - 1 - y) * 8 - mv_y) * prev->linesize[plane] + (x * 8 + mv_x),
|
||||
frame->linesize[plane], prev->linesize[plane], 8);
|
||||
if (map) {
|
||||
s->idsp.idct(s->wblocks + x * 64);
|
||||
@@ -447,14 +445,12 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
|
||||
return ret;
|
||||
|
||||
if (orig_mv_x >= -32) {
|
||||
int src_y = (s->blocks_h - 1 - y) * 8 - mv_y;
|
||||
int src_x = x * 8 + mv_x;
|
||||
if (src_y < 0 || src_y + 8 > h ||
|
||||
src_x < 0 || src_x + 8 > w)
|
||||
if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h ||
|
||||
x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,
|
||||
prev->data[plane] + src_y * prev->linesize[plane] + src_x,
|
||||
prev->data[plane] + ((s->blocks_h - 1 - y) * 8 - mv_y) * prev->linesize[plane] + (x * 8 + mv_x),
|
||||
frame->linesize[plane], prev->linesize[plane], 8);
|
||||
if (map) {
|
||||
s->idsp.idct(s->block);
|
||||
|
||||
+4
-13
@@ -1548,12 +1548,8 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < frame_length; ++i) {
|
||||
if (ctx->raw_samples[c][i] == 0) {
|
||||
ctx->raw_mantissa[c][i] = AV_RB32(larray + j);
|
||||
j += 4;
|
||||
}
|
||||
ctx->raw_mantissa[c][i] = AV_RB32(larray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1564,10 +1560,7 @@ 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 Table 14.45 and 14.46 from the ISO spec
|
||||
if (av_cmp_sf_ieee754(acf[c], FLOAT_1)) {
|
||||
int nbit = av_log2(FFABSU(ctx->raw_samples[c][i]));
|
||||
if (nbit > 23)
|
||||
return AVERROR_INVALIDDATA;
|
||||
nbits[i] = 23 - nbit;
|
||||
nbits[i] = 23 - av_log2(abs(ctx->raw_samples[c][i]));
|
||||
} else {
|
||||
nbits[i] = 23;
|
||||
}
|
||||
@@ -1641,7 +1634,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];
|
||||
ctx->raw_samples[c][i] = raw_mantissa[c][i] & 0x007fffffUL;
|
||||
}
|
||||
}
|
||||
align_get_bits(gb);
|
||||
@@ -1797,9 +1790,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
}
|
||||
|
||||
if (sconf->floating) {
|
||||
ret = read_diff_float_data(ctx, ra_frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
read_diff_float_data(ctx, ra_frame);
|
||||
}
|
||||
|
||||
if (get_bits_left(gb) < 0) {
|
||||
|
||||
@@ -152,9 +152,8 @@ 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 || s->sets[set_idx])
|
||||
if (!fgp)
|
||||
goto error;
|
||||
aom = &fgp->codec.aom;
|
||||
|
||||
@@ -213,7 +212,7 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
|
||||
}
|
||||
|
||||
predict_scaling = get_bits1(gb);
|
||||
if (predict_scaling && !ref)
|
||||
if (predict_scaling && (!ref || ref == fgp))
|
||||
goto error; // prediction must be from valid, different set
|
||||
|
||||
predict_y_scaling = predict_scaling ? get_bits1(gb) : 0;
|
||||
|
||||
+13
-58
@@ -35,16 +35,6 @@
|
||||
#include "thread.h"
|
||||
|
||||
|
||||
typedef struct APVDerivedTileInfo {
|
||||
uint8_t tile_cols;
|
||||
uint8_t tile_rows;
|
||||
uint16_t num_tiles;
|
||||
// The spec uses an extra element on the end of these arrays
|
||||
// not corresponding to any tile.
|
||||
uint16_t col_starts[APV_MAX_TILE_COLS + 1];
|
||||
uint16_t row_starts[APV_MAX_TILE_ROWS + 1];
|
||||
} APVDerivedTileInfo;
|
||||
|
||||
typedef struct APVDecodeContext {
|
||||
CodedBitstreamContext *cbc;
|
||||
APVDSPContext dsp;
|
||||
@@ -62,9 +52,9 @@ typedef struct APVDecodeContext {
|
||||
static const enum AVPixelFormat apv_format_table[5][5] = {
|
||||
{ AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16 },
|
||||
{ 0 }, // 4:2:0 is not valid.
|
||||
{ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV422P16 },
|
||||
{ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16 },
|
||||
{ AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, 0 ,AV_PIX_FMT_YUVA444P16 },
|
||||
{ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV422P16 },
|
||||
{ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV444P16 },
|
||||
{ AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUVA444P16 },
|
||||
};
|
||||
|
||||
static APVVLCLUT decode_lut;
|
||||
@@ -85,11 +75,6 @@ static int apv_decode_check_format(AVCodecContext *avctx,
|
||||
avctx->pix_fmt =
|
||||
apv_format_table[header->frame_info.chroma_format_idc][bit_depth - 4 >> 2];
|
||||
|
||||
if (!avctx->pix_fmt) {
|
||||
avpriv_request_sample(avctx, "YUVA444P14");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
err = ff_set_dimensions(avctx,
|
||||
FFALIGN(header->frame_info.frame_width, 16),
|
||||
FFALIGN(header->frame_info.frame_height, 16));
|
||||
@@ -193,13 +178,14 @@ static int apv_decode_tile_component(AVCodecContext *avctx, void *data,
|
||||
{
|
||||
APVRawFrame *input = data;
|
||||
APVDecodeContext *apv = avctx->priv_data;
|
||||
const APVDerivedTileInfo *tile_info = &apv->tile_info;
|
||||
const CodedBitstreamAPVContext *apv_cbc = apv->cbc->priv_data;
|
||||
const APVDerivedTileInfo *tile_info = &apv_cbc->tile_info;
|
||||
|
||||
int tile_index = job / apv_cbc->num_comp;
|
||||
int comp_index = job % apv_cbc->num_comp;
|
||||
|
||||
const AVPixFmtDescriptor *pix_fmt_desc =
|
||||
av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
int nb_components = pix_fmt_desc->nb_components;
|
||||
|
||||
int tile_index = job / nb_components;
|
||||
int comp_index = job % nb_components;
|
||||
|
||||
int sub_w_shift = comp_index == 0 ? 0 : pix_fmt_desc->log2_chroma_w;
|
||||
int sub_h_shift = comp_index == 0 ? 0 : pix_fmt_desc->log2_chroma_h;
|
||||
@@ -250,7 +236,7 @@ static int apv_decode_tile_component(AVCodecContext *avctx, void *data,
|
||||
int qp = tile->tile_header.tile_qp[comp_index];
|
||||
int level_scale = apv_level_scale[qp % 6];
|
||||
|
||||
bit_depth = input->frame_header.frame_info.bit_depth_minus8 + 8;
|
||||
bit_depth = apv_cbc->bit_depth;
|
||||
qp_shift = qp / 6;
|
||||
|
||||
for (int y = 0; y < 8; y++) {
|
||||
@@ -306,38 +292,12 @@ fail:
|
||||
return err;
|
||||
}
|
||||
|
||||
static void apv_derive_tile_info(APVDerivedTileInfo *ti,
|
||||
const APVRawFrameHeader *fh)
|
||||
{
|
||||
int frame_width_in_mbs = (fh->frame_info.frame_width + (APV_MB_WIDTH - 1)) >> 4;
|
||||
int frame_height_in_mbs = (fh->frame_info.frame_height + (APV_MB_HEIGHT - 1)) >> 4;
|
||||
int start_mb, i;
|
||||
|
||||
start_mb = 0;
|
||||
for (i = 0; start_mb < frame_width_in_mbs; i++) {
|
||||
ti->col_starts[i] = start_mb * APV_MB_WIDTH;
|
||||
start_mb += fh->tile_info.tile_width_in_mbs;
|
||||
}
|
||||
ti->col_starts[i] = frame_width_in_mbs * APV_MB_WIDTH;
|
||||
ti->tile_cols = i;
|
||||
|
||||
start_mb = 0;
|
||||
for (i = 0; start_mb < frame_height_in_mbs; i++) {
|
||||
ti->row_starts[i] = start_mb * APV_MB_HEIGHT;
|
||||
start_mb += fh->tile_info.tile_height_in_mbs;
|
||||
}
|
||||
ti->row_starts[i] = frame_height_in_mbs * APV_MB_HEIGHT;
|
||||
ti->tile_rows = i;
|
||||
|
||||
ti->num_tiles = ti->tile_cols * ti->tile_rows;
|
||||
}
|
||||
|
||||
static int apv_decode(AVCodecContext *avctx, AVFrame *output,
|
||||
APVRawFrame *input)
|
||||
{
|
||||
APVDecodeContext *apv = avctx->priv_data;
|
||||
const AVPixFmtDescriptor *desc = NULL;
|
||||
APVDerivedTileInfo *tile_info = &apv->tile_info;
|
||||
const CodedBitstreamAPVContext *apv_cbc = apv->cbc->priv_data;
|
||||
const APVDerivedTileInfo *tile_info = &apv_cbc->tile_info;
|
||||
int err, job_count;
|
||||
|
||||
err = apv_decode_check_format(avctx, &input->frame_header);
|
||||
@@ -346,9 +306,6 @@ static int apv_decode(AVCodecContext *avctx, AVFrame *output,
|
||||
return err;
|
||||
}
|
||||
|
||||
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
av_assert0(desc);
|
||||
|
||||
err = ff_thread_get_buffer(avctx, output, 0);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@@ -356,11 +313,9 @@ static int apv_decode(AVCodecContext *avctx, AVFrame *output,
|
||||
apv->output_frame = output;
|
||||
atomic_store_explicit(&apv->tile_errors, 0, memory_order_relaxed);
|
||||
|
||||
apv_derive_tile_info(tile_info, &input->frame_header);
|
||||
|
||||
// Each component within a tile is independent of every other,
|
||||
// so we can decode all in parallel.
|
||||
job_count = tile_info->num_tiles * desc->nb_components;
|
||||
job_count = tile_info->num_tiles * apv_cbc->num_comp;
|
||||
|
||||
avctx->execute2(avctx, apv_decode_tile_component,
|
||||
input, NULL, job_count);
|
||||
|
||||
+4
-12
@@ -98,11 +98,12 @@ 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)
|
||||
{
|
||||
int primary_frame;
|
||||
uint8_t primary_frame, prev_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;
|
||||
|
||||
@@ -112,10 +113,8 @@ 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 {
|
||||
int prev_frame = s->raw_frame_header->ref_frame_idx[primary_frame];
|
||||
else
|
||||
prev_gm_param = s->ref[prev_frame].gm_params[ref][idx];
|
||||
}
|
||||
|
||||
if (idx < 2) {
|
||||
if (type == AV1_WARP_MODEL_TRANSLATION) {
|
||||
@@ -1304,8 +1303,6 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
|
||||
av_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) {
|
||||
@@ -1342,8 +1339,6 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
|
||||
|
||||
av_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
|
||||
@@ -1416,11 +1411,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AV1_OBU_TEMPORAL_DELIMITER:
|
||||
s->raw_frame_header = NULL;
|
||||
raw_tile_group = NULL;
|
||||
// fall-through
|
||||
case AV1_OBU_TILE_LIST:
|
||||
case AV1_OBU_TEMPORAL_DELIMITER:
|
||||
case AV1_OBU_PADDING:
|
||||
break;
|
||||
case AV1_OBU_METADATA:
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -236,7 +236,7 @@ static int ff_eia608_to_smpte436m_filter(AVBSFContext *ctx, AVPacket *out)
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
ret = 0;
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (ret < 0)
|
||||
|
||||
@@ -68,12 +68,10 @@ static int ff_smpte436m_to_eia608_filter(AVBSFContext *ctx, AVPacket *out)
|
||||
// verified it won't fail by running it above
|
||||
av_smpte_291m_anc_8bit_extract_cta_708(&anc, out->data, ctx);
|
||||
|
||||
av_packet_free(&in);
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (ret != AVERROR_EOF)
|
||||
goto fail;
|
||||
return ret;
|
||||
ret = AVERROR(EAGAIN);
|
||||
|
||||
fail:
|
||||
|
||||
+21
-6
@@ -37,18 +37,33 @@ static int cbs_apv_get_num_comp(const APVRawFrameHeader *fh)
|
||||
}
|
||||
}
|
||||
|
||||
static void cbs_apv_derive_tile_info(CodedBitstreamContext *ctx,
|
||||
static void cbs_apv_derive_tile_info(APVDerivedTileInfo *ti,
|
||||
const APVRawFrameHeader *fh)
|
||||
{
|
||||
CodedBitstreamAPVContext *priv = ctx->priv_data;
|
||||
int frame_width_in_mbs = (fh->frame_info.frame_width + 15) / 16;
|
||||
int frame_height_in_mbs = (fh->frame_info.frame_height + 15) / 16;
|
||||
int tile_cols = (frame_width_in_mbs + fh->tile_info.tile_width_in_mbs - 1) / fh->tile_info.tile_width_in_mbs;
|
||||
int tile_rows = (frame_height_in_mbs + fh->tile_info.tile_height_in_mbs - 1) / fh->tile_info.tile_height_in_mbs;
|
||||
int start_mb, i;
|
||||
|
||||
av_assert0(tile_cols <= APV_MAX_TILE_COLS && tile_rows <= APV_MAX_TILE_ROWS);
|
||||
start_mb = 0;
|
||||
for (i = 0; start_mb < frame_width_in_mbs; i++) {
|
||||
ti->col_starts[i] = start_mb * APV_MB_WIDTH;
|
||||
start_mb += fh->tile_info.tile_width_in_mbs;
|
||||
}
|
||||
av_assert0(i <= APV_MAX_TILE_COLS);
|
||||
ti->col_starts[i] = frame_width_in_mbs * APV_MB_WIDTH;
|
||||
ti->tile_cols = i;
|
||||
|
||||
priv->num_tiles = tile_cols * tile_rows;
|
||||
start_mb = 0;
|
||||
for (i = 0; start_mb < frame_height_in_mbs; i++) {
|
||||
av_assert0(i < APV_MAX_TILE_ROWS);
|
||||
ti->row_starts[i] = start_mb * APV_MB_HEIGHT;
|
||||
start_mb += fh->tile_info.tile_height_in_mbs;
|
||||
}
|
||||
av_assert0(i <= APV_MAX_TILE_ROWS);
|
||||
ti->row_starts[i] = frame_height_in_mbs * APV_MB_HEIGHT;
|
||||
ti->tile_rows = i;
|
||||
|
||||
ti->num_tiles = ti->tile_cols * ti->tile_rows;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-1
@@ -187,11 +187,21 @@ typedef struct APVRawMetadata {
|
||||
} APVRawMetadata;
|
||||
|
||||
|
||||
typedef struct APVDerivedTileInfo {
|
||||
uint8_t tile_cols;
|
||||
uint8_t tile_rows;
|
||||
uint16_t num_tiles;
|
||||
// The spec uses an extra element on the end of these arrays
|
||||
// not corresponding to any tile.
|
||||
uint16_t col_starts[APV_MAX_TILE_COLS + 1];
|
||||
uint16_t row_starts[APV_MAX_TILE_ROWS + 1];
|
||||
} APVDerivedTileInfo;
|
||||
|
||||
typedef struct CodedBitstreamAPVContext {
|
||||
int bit_depth;
|
||||
int num_comp;
|
||||
|
||||
uint16_t num_tiles;
|
||||
APVDerivedTileInfo tile_info;
|
||||
} CodedBitstreamAPVContext;
|
||||
|
||||
#endif /* AVCODEC_CBS_APV_H */
|
||||
|
||||
@@ -128,10 +128,10 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
|
||||
ub(1, tile_size_present_in_fh_flag);
|
||||
|
||||
cbs_apv_derive_tile_info(ctx, fh);
|
||||
cbs_apv_derive_tile_info(&priv->tile_info, fh);
|
||||
|
||||
if (current->tile_size_present_in_fh_flag) {
|
||||
for (int t = 0; t < priv->num_tiles; t++) {
|
||||
for (int t = 0; t < priv->tile_info.num_tiles; t++) {
|
||||
us(32, tile_size_in_fh[t], 10, MAX_UINT_BITS(32), 1, t);
|
||||
}
|
||||
}
|
||||
@@ -262,8 +262,8 @@ static int FUNC(frame)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
|
||||
CHECK(FUNC(frame_header)(ctx, rw, ¤t->frame_header));
|
||||
|
||||
for (int t = 0; t < priv->num_tiles; t++) {
|
||||
us(32, tile_size[t], 10, MAX_INT_BITS(32), 1, t);
|
||||
for (int t = 0; t < priv->tile_info.num_tiles; t++) {
|
||||
us(32, tile_size[t], 10, MAX_UINT_BITS(32), 1, t);
|
||||
|
||||
CHECK(FUNC(tile)(ctx, rw, ¤t->tile[t],
|
||||
t, current->tile_size[t]));
|
||||
|
||||
@@ -186,13 +186,10 @@ static int FUNC(decoder_model_info)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
static int FUNC(sequence_header_obu)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
AV1RawSequenceHeader *current)
|
||||
{
|
||||
CodedBitstreamAV1Context *priv = ctx->priv_data;
|
||||
int i, err;
|
||||
|
||||
HEADER("Sequence Header");
|
||||
|
||||
priv->seen_frame_header = 0;
|
||||
|
||||
fc(3, seq_profile, AV_PROFILE_AV1_MAIN,
|
||||
AV_PROFILE_AV1_PROFESSIONAL);
|
||||
flag(still_picture);
|
||||
|
||||
@@ -1133,7 +1133,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
max_width_minus1 = tmp_width_val - 1;
|
||||
max_height_minus1 = tmp_height_val - 1;
|
||||
|
||||
u(1, sps_subpic_info_present_flag, 0, !current->sps_res_change_in_clvs_allowed_flag);
|
||||
flag(sps_subpic_info_present_flag);
|
||||
if (current->sps_subpic_info_present_flag) {
|
||||
ue(sps_num_subpics_minus1, 0, VVC_MAX_SLICES - 1);
|
||||
if (current->sps_num_subpics_minus1 > 0) {
|
||||
@@ -1216,7 +1216,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_height_minus1[0] + 1) ||
|
||||
tmp_height_val % (current->sps_subpic_width_minus1[0] + 1) ||
|
||||
current->sps_num_subpics_minus1 !=
|
||||
(num_subpic_cols * tmp_height_val /
|
||||
(current->sps_subpic_height_minus1[0] + 1) - 1))
|
||||
@@ -1971,18 +1971,16 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
current->slice_top_left_tile_idx[i] = tile_idx;
|
||||
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 - tile_x, 1, i);
|
||||
0, current->num_tile_columns - 1, 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 - tile_y, 1, i);
|
||||
0, current->num_tile_rows - 1, 1, i);
|
||||
} else {
|
||||
if (tile_y == current->num_tile_rows - 1)
|
||||
infer(pps_slice_height_in_tiles_minus1[i], 0);
|
||||
@@ -2013,16 +2011,10 @@ 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,
|
||||
remaining_height_in_ctbs_y - (current->pps_num_exp_slices_in_tile[i] - j), 2,
|
||||
remaining_height_in_ctbs_y - 1, 2,
|
||||
i, j);
|
||||
slice_height_in_ctus =
|
||||
current->
|
||||
@@ -2039,13 +2031,6 @@ 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;
|
||||
@@ -3145,7 +3130,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
|
||||
if (!pps->pps_rect_slice_flag &&
|
||||
pps->num_tiles_in_pic - current->sh_slice_address > 1)
|
||||
ue(sh_num_tiles_in_slice_minus1, 0, pps->num_tiles_in_pic - 1 - current->sh_slice_address);
|
||||
ue(sh_num_tiles_in_slice_minus1, 0, pps->num_tiles_in_pic - 1);
|
||||
else
|
||||
infer(sh_num_tiles_in_slice_minus1, 0);
|
||||
|
||||
@@ -3263,12 +3248,6 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
FFMIN(ref_pic_lists->rpl_ref_list[i].num_ref_entries,
|
||||
pps->pps_num_ref_idx_default_active_minus1[i] + 1);
|
||||
}
|
||||
|
||||
if (current->num_ref_idx_active[i] <= 0) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR,
|
||||
"Inter slice but no reference pictures available for RPL%d.\n", i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else {
|
||||
current->num_ref_idx_active[i] = 0;
|
||||
}
|
||||
@@ -3508,7 +3487,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_columns;
|
||||
tile_y = tile_idx / pps->num_tile_rows;
|
||||
height = pps->row_height_val[tile_y];
|
||||
current->num_entry_points += (entropy_sync ? height : 1);
|
||||
}
|
||||
|
||||
@@ -152,6 +152,7 @@ static int FUNC(interpolation_filter)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
static int FUNC(loop_filter_params)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
VP9RawFrameHeader *current)
|
||||
{
|
||||
CodedBitstreamVP9Context *vp9 = ctx->priv_data;
|
||||
int err, i;
|
||||
|
||||
f(6, loop_filter_level);
|
||||
@@ -159,6 +160,8 @@ static int FUNC(loop_filter_params)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
|
||||
f(1, loop_filter_delta_enabled);
|
||||
if (current->loop_filter_delta_enabled) {
|
||||
memcpy(current->loop_filter_ref_deltas, vp9->loop_filter_ref_deltas, sizeof(vp9->loop_filter_ref_deltas));
|
||||
memcpy(current->loop_filter_mode_deltas, vp9->loop_filter_mode_deltas, sizeof(vp9->loop_filter_mode_deltas));
|
||||
f(1, loop_filter_delta_update);
|
||||
if (current->loop_filter_delta_update) {
|
||||
for (i = 0; i < VP9_MAX_REF_FRAMES; i++) {
|
||||
@@ -171,9 +174,9 @@ static int FUNC(loop_filter_params)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
if (current->update_mode_delta[i])
|
||||
ss(6, loop_filter_mode_deltas[i], 1, i);
|
||||
}
|
||||
memcpy(vp9->loop_filter_ref_deltas, current->loop_filter_ref_deltas, sizeof(vp9->loop_filter_ref_deltas));
|
||||
memcpy(vp9->loop_filter_mode_deltas, current->loop_filter_mode_deltas, sizeof(vp9->loop_filter_mode_deltas));
|
||||
}
|
||||
} else {
|
||||
infer(loop_filter_delta_update, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -198,11 +201,18 @@ static int FUNC(segmentation_params)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
{
|
||||
static const uint8_t segmentation_feature_bits[VP9_SEG_LVL_MAX] = { 8, 6, 2, 0 };
|
||||
static const uint8_t segmentation_feature_signed[VP9_SEG_LVL_MAX] = { 1, 1, 0, 0 };
|
||||
|
||||
CodedBitstreamVP9Context *vp9 = ctx->priv_data;
|
||||
int err, i, j;
|
||||
|
||||
f(1, segmentation_enabled);
|
||||
|
||||
if (current->segmentation_enabled) {
|
||||
memcpy(current->segmentation_tree_probs, vp9->segmentation_tree_probs, sizeof(vp9->segmentation_tree_probs));
|
||||
memcpy(current->segmentation_pred_prob, vp9->segmentation_pred_prob, sizeof(vp9->segmentation_pred_prob));
|
||||
memcpy(current->feature_enabled, vp9->feature_enabled, sizeof(vp9->feature_enabled));
|
||||
memcpy(current->feature_value, vp9->feature_value, sizeof(vp9->feature_value));
|
||||
memcpy(current->feature_sign, vp9->feature_sign, sizeof(vp9->feature_sign));
|
||||
f(1, segmentation_update_map);
|
||||
if (current->segmentation_update_map) {
|
||||
for (i = 0; i < 7; i++)
|
||||
@@ -214,6 +224,8 @@ static int FUNC(segmentation_params)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
else
|
||||
infer(segmentation_pred_prob[i], 255);
|
||||
}
|
||||
memcpy(vp9->segmentation_tree_probs, current->segmentation_tree_probs, sizeof(vp9->segmentation_tree_probs));
|
||||
memcpy(vp9->segmentation_pred_prob, current->segmentation_pred_prob, sizeof(vp9->segmentation_pred_prob));
|
||||
}
|
||||
|
||||
f(1, segmentation_update_data);
|
||||
@@ -236,9 +248,10 @@ static int FUNC(segmentation_params)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
}
|
||||
}
|
||||
}
|
||||
memcpy(vp9->feature_enabled, current->feature_enabled, sizeof(vp9->feature_enabled));
|
||||
memcpy(vp9->feature_value, current->feature_value, sizeof(vp9->feature_value));
|
||||
memcpy(vp9->feature_sign, current->feature_sign, sizeof(vp9->feature_sign));
|
||||
}
|
||||
} else {
|
||||
infer(segmentation_update_data, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -355,6 +368,18 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
|
||||
f(2, frame_context_idx);
|
||||
|
||||
if (current->frame_type == VP9_KEY_FRAME || current->error_resilient_mode || current->intra_only) {
|
||||
infer(update_ref_delta[0], 1);
|
||||
infer(update_ref_delta[1], 0);
|
||||
infer(update_ref_delta[2], -1);
|
||||
infer(update_ref_delta[3], -1);
|
||||
infer(loop_filter_mode_deltas[0], 0);
|
||||
infer(loop_filter_mode_deltas[1], 0);
|
||||
memset(vp9->feature_enabled, 0, sizeof(current->feature_enabled));
|
||||
memset(vp9->feature_value, 0, sizeof(current->feature_value));
|
||||
memset(vp9->feature_sign, 0, sizeof(current->feature_sign));
|
||||
}
|
||||
|
||||
CHECK(FUNC(loop_filter_params)(ctx, rw, current));
|
||||
CHECK(FUNC(quantization_params)(ctx, rw, current));
|
||||
CHECK(FUNC(segmentation_params)(ctx, rw, current));
|
||||
@@ -374,58 +399,6 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
}
|
||||
}
|
||||
|
||||
// Update top-level loop filter and segmentation state with changes
|
||||
// from this frame.
|
||||
if (current->frame_type == VP9_KEY_FRAME ||
|
||||
current->intra_only ||
|
||||
current->error_resilient_mode) {
|
||||
// setup_past_independence() - fill with the initial values.
|
||||
|
||||
vp9->loop_filter_ref_deltas[VP9_INTRA_FRAME] = 1;
|
||||
vp9->loop_filter_ref_deltas[VP9_LAST_FRAME] = 0;
|
||||
vp9->loop_filter_ref_deltas[VP9_GOLDEN_FRAME] = -1;
|
||||
vp9->loop_filter_ref_deltas[VP9_ALTREF_FRAME] = -1;
|
||||
|
||||
vp9->loop_filter_mode_deltas[0] = 0;
|
||||
vp9->loop_filter_mode_deltas[1] = 0;
|
||||
|
||||
memset(vp9->feature_enabled, 0, sizeof(vp9->feature_enabled));
|
||||
memset(vp9->feature_value, 0, sizeof(vp9->feature_value));
|
||||
memset(vp9->feature_sign, 0, sizeof(vp9->feature_sign));
|
||||
}
|
||||
|
||||
// Modify previous state based on updates in this frame.
|
||||
if (current->loop_filter_delta_update) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (current->update_ref_delta[i])
|
||||
vp9->loop_filter_ref_deltas[i] =
|
||||
current->loop_filter_ref_deltas[i];
|
||||
}
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (current->update_mode_delta[i])
|
||||
vp9->loop_filter_mode_deltas[i] =
|
||||
current->loop_filter_mode_deltas[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (current->segmentation_update_data) {
|
||||
memcpy(vp9->feature_enabled, current->feature_enabled,
|
||||
sizeof(vp9->feature_enabled));
|
||||
memcpy(vp9->feature_value, current->feature_value,
|
||||
sizeof(vp9->feature_value));
|
||||
memcpy(vp9->feature_sign, current->feature_sign,
|
||||
sizeof(vp9->feature_sign));
|
||||
|
||||
if (current->segmentation_update_map) {
|
||||
memcpy(vp9->segmentation_tree_probs,
|
||||
current->segmentation_tree_probs,
|
||||
sizeof(vp9->segmentation_tree_probs));
|
||||
memcpy(vp9->segmentation_pred_prob,
|
||||
current->segmentation_pred_prob,
|
||||
sizeof(vp9->segmentation_pred_prob));
|
||||
}
|
||||
}
|
||||
|
||||
av_log(ctx->log_ctx, AV_LOG_DEBUG, "Frame: size %dx%d "
|
||||
"subsample %dx%d bit_depth %d tiles %dx%d.\n",
|
||||
vp9->frame_width, vp9->frame_height,
|
||||
|
||||
+2
-7
@@ -631,7 +631,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 == CoefficientSegment &&
|
||||
if (tag == BitstreamMarker && data == 0xf0f &&
|
||||
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;
|
||||
@@ -698,15 +698,10 @@ 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 == CoefficientSegment) {
|
||||
if (tag == BitstreamMarker && data == 0xf0f) {
|
||||
int lowpass_height, lowpass_width, lowpass_a_height, lowpass_a_width;
|
||||
|
||||
if (!s->a_width || !s->a_height) {
|
||||
|
||||
@@ -91,15 +91,6 @@ 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
|
||||
|
||||
@@ -627,7 +627,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
}
|
||||
|
||||
bytestream2_put_be16(pby, BitstreamMarker);
|
||||
bytestream2_put_be16(pby, LowPassSegment);
|
||||
bytestream2_put_be16(pby, 0x1a4a);
|
||||
|
||||
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, CoefficientSegment);
|
||||
bytestream2_put_be16(pby, 0x0f0f);
|
||||
|
||||
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, LowPassEndSegment);
|
||||
bytestream2_put_be16(pby, 0x1b4b);
|
||||
|
||||
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, HighPassSegment);
|
||||
bytestream2_put_be16(pby, 0x0d0d);
|
||||
|
||||
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, BandSegment);
|
||||
bytestream2_put_be16(pby, 0x0e0e);
|
||||
|
||||
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, HighPassEndSegment);
|
||||
bytestream2_put_be16(pby, 0x0c0c);
|
||||
}
|
||||
|
||||
s->plane[p].size = bytestream2_tell_p(pby) - pos;
|
||||
|
||||
+2
-5
@@ -1080,7 +1080,6 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
int s = 0;
|
||||
unsigned int channel_mask = 0;
|
||||
int samples_per_frame = 0;
|
||||
int total_channels = 0;
|
||||
int ret;
|
||||
int channels = avctx->ch_layout.nb_channels;
|
||||
|
||||
@@ -1238,12 +1237,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
q->subpacket[s].gains2.now = q->subpacket[s].gain_3;
|
||||
q->subpacket[s].gains2.previous = q->subpacket[s].gain_4;
|
||||
|
||||
if (total_channels + q->subpacket[s].num_channels > channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many subpacket channels %d for channels %d\n",
|
||||
total_channels + q->subpacket[s].num_channels, channels);
|
||||
if (q->num_subpackets + q->subpacket[s].num_channels > channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many subpackets %d for channels %d\n", q->num_subpackets, channels);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
total_channels += q->subpacket[s].num_channels;
|
||||
|
||||
q->num_subpackets++;
|
||||
s++;
|
||||
|
||||
@@ -69,7 +69,6 @@ static av_cold int cri_decode_init(AVCodecContext *avctx)
|
||||
s->jpeg_avctx->flags = avctx->flags;
|
||||
s->jpeg_avctx->flags2 = avctx->flags2;
|
||||
s->jpeg_avctx->idct_algo = avctx->idct_algo;
|
||||
s->jpeg_avctx->max_pixels = avctx->max_pixels;
|
||||
ret = avcodec_open2(s->jpeg_avctx, NULL, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -973,7 +973,8 @@ rc_mode_found:
|
||||
case RC_MODE_CQP:
|
||||
// cqp ConfigParams will be updated in ctx->codec->configure.
|
||||
break;
|
||||
case RC_MODE_CBR: {
|
||||
|
||||
case RC_MODE_CBR:
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_CBR *cbr_ctl;
|
||||
|
||||
ctx->rc.ConfigParams.DataSize = sizeof(D3D12_VIDEO_ENCODER_RATE_CONTROL_CBR);
|
||||
@@ -994,8 +995,8 @@ rc_mode_found:
|
||||
|
||||
ctx->rc.ConfigParams.pConfiguration_CBR = cbr_ctl;
|
||||
break;
|
||||
}
|
||||
case RC_MODE_VBR: {
|
||||
|
||||
case RC_MODE_VBR:
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_VBR *vbr_ctl;
|
||||
|
||||
ctx->rc.ConfigParams.DataSize = sizeof(D3D12_VIDEO_ENCODER_RATE_CONTROL_VBR);
|
||||
@@ -1017,8 +1018,8 @@ rc_mode_found:
|
||||
|
||||
ctx->rc.ConfigParams.pConfiguration_VBR = vbr_ctl;
|
||||
break;
|
||||
}
|
||||
case RC_MODE_QVBR: {
|
||||
|
||||
case RC_MODE_QVBR:
|
||||
D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR *qvbr_ctl;
|
||||
|
||||
ctx->rc.ConfigParams.DataSize = sizeof(D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR);
|
||||
@@ -1038,7 +1039,7 @@ rc_mode_found:
|
||||
|
||||
ctx->rc.ConfigParams.pConfiguration_QVBR = qvbr_ctl;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+5
-15
@@ -64,16 +64,12 @@ static void get_linear_array(GetBitContext *gb, int32_t *array, int size, int n)
|
||||
array[i] = get_linear(gb, n);
|
||||
}
|
||||
|
||||
static int get_rice_array(GetBitContext *gb, int32_t *array, int size, int k)
|
||||
static void get_rice_array(GetBitContext *gb, int32_t *array, int size, int k)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size && get_bits_left(gb) > k; i++)
|
||||
for (i = 0; i < size; i++)
|
||||
array[i] = get_rice(gb, k);
|
||||
|
||||
if (i < size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_dmix_coeffs(DCAXllDecoder *s, DCAXllChSet *c)
|
||||
@@ -533,10 +529,8 @@ 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
|
||||
int ret = get_rice_array(&s->gb, part_a, c->nsamples_part_a[k],
|
||||
c->bitalloc_part_a[k]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
get_rice_array(&s->gb, part_a, c->nsamples_part_a[k],
|
||||
c->bitalloc_part_a[k]);
|
||||
|
||||
if (c->bitalloc_hybrid_linear[k]) {
|
||||
// Hybrid Rice codes
|
||||
@@ -566,9 +560,7 @@ 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
|
||||
ret = get_rice_array(&s->gb, part_b, nsamples_part_b, c->bitalloc_part_b[k]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
get_rice_array(&s->gb, part_b, nsamples_part_b, c->bitalloc_part_b[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1102,7 +1094,6 @@ 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;
|
||||
@@ -1157,7 +1148,6 @@ 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)
|
||||
|
||||
+18
-36
@@ -93,14 +93,10 @@ typedef struct DecodeContext {
|
||||
*/
|
||||
uint64_t side_data_pref_mask;
|
||||
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
struct {
|
||||
FFLCEVCContext *ctx;
|
||||
int frame;
|
||||
int width;
|
||||
int height;
|
||||
} lcevc;
|
||||
#endif
|
||||
FFLCEVCContext *lcevc;
|
||||
int lcevc_frame;
|
||||
int width;
|
||||
int height;
|
||||
} DecodeContext;
|
||||
|
||||
static DecodeContext *decode_ctx(AVCodecInternal *avci)
|
||||
@@ -1577,29 +1573,26 @@ 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.ctx && avctx->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||
dc->lcevc_frame = dc->lcevc && avctx->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||
av_frame_get_side_data(frame, AV_FRAME_DATA_LCEVC);
|
||||
|
||||
if (dc->lcevc.frame) {
|
||||
dc->lcevc.width = frame->width;
|
||||
dc->lcevc.height = frame->height;
|
||||
if (dc->lcevc_frame) {
|
||||
dc->width = frame->width;
|
||||
dc->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 = frame->private_ref;
|
||||
FFLCEVCFrame *frame_ctx;
|
||||
int ret;
|
||||
@@ -1614,13 +1607,13 @@ static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
frame_ctx->lcevc = av_refstruct_ref(dc->lcevc.ctx);
|
||||
frame_ctx->lcevc = av_refstruct_ref(dc->lcevc);
|
||||
frame_ctx->frame->width = frame->width;
|
||||
frame_ctx->frame->height = frame->height;
|
||||
frame_ctx->frame->format = frame->format;
|
||||
|
||||
frame->width = dc->lcevc.width;
|
||||
frame->height = dc->lcevc.height;
|
||||
frame->width = dc->width;
|
||||
frame->height = dc->height;
|
||||
|
||||
ret = avctx->get_buffer2(avctx, frame_ctx->frame, 0);
|
||||
if (ret < 0) {
|
||||
@@ -1634,8 +1627,7 @@ 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;
|
||||
#endif
|
||||
dc->lcevc_frame = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2003,13 +1995,9 @@ int ff_decode_preinit(AVCodecContext *avctx)
|
||||
return ret;
|
||||
|
||||
if (!(avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS)) {
|
||||
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
|
||||
}
|
||||
ret = ff_lcevc_alloc(&dc->lcevc);
|
||||
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2247,19 +2235,13 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src)
|
||||
const DecodeContext *src_dc = decode_ctx(src->internal);
|
||||
DecodeContext *dst_dc = decode_ctx(dst->internal);
|
||||
|
||||
dst_dc->initial_pict_type = src_dc->initial_pict_type;
|
||||
dst_dc->intra_only_flag = src_dc->intra_only_flag;
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
av_refstruct_replace(&dst_dc->lcevc.ctx, src_dc->lcevc.ctx);
|
||||
#endif
|
||||
av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);
|
||||
}
|
||||
|
||||
void ff_decode_internal_uninit(AVCodecContext *avctx)
|
||||
{
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
AVCodecInternal *avci = avctx->internal;
|
||||
DecodeContext *dc = decode_ctx(avci);
|
||||
|
||||
av_refstruct_unref(&dc->lcevc.ctx);
|
||||
#endif
|
||||
av_refstruct_unref(&dc->lcevc);
|
||||
}
|
||||
|
||||
+3
-7
@@ -93,13 +93,9 @@ int ff_attach_decode_data(AVFrame *frame);
|
||||
*/
|
||||
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
/**
|
||||
* Check that the provided frame dimensions are valid and set them on the codec
|
||||
* context.
|
||||
*/
|
||||
int ff_set_dimensions(AVCodecContext *s, int width, int height);
|
||||
|
||||
|
||||
@@ -101,16 +101,15 @@ 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;
|
||||
|
||||
if (nb_samples > INT_MAX || !nb_samples) {
|
||||
frame->nb_samples = packet->size * 8LL / ctx->ch_layout.nb_channels;
|
||||
if (frame->nb_samples <= 0) {
|
||||
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;
|
||||
|
||||
@@ -339,9 +339,9 @@ static int alloc_buffers(DiracContext *s, int stride)
|
||||
av_freep(&s->mctmp);
|
||||
av_freep(&s->mcscratch);
|
||||
|
||||
s->edge_emu_buffer_base = av_malloc_array(stride, 4 * MAX_BLOCKSIZE);
|
||||
s->edge_emu_buffer_base = av_malloc_array(stride, MAX_BLOCKSIZE);
|
||||
|
||||
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h + 5*MAX_BLOCKSIZE) * sizeof(*s->mctmp));
|
||||
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
|
||||
s->mcscratch = av_malloc_array(stride, MAX_BLOCKSIZE);
|
||||
|
||||
if (!s->edge_emu_buffer_base || !s->mctmp || !s->mcscratch)
|
||||
@@ -1895,7 +1895,7 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
||||
|
||||
/* FIXME: small resolutions */
|
||||
for (i = 0; i < 4; i++)
|
||||
s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*s->buffer_stride*MAX_BLOCKSIZE;
|
||||
s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*FFALIGN(p->width, 16);
|
||||
|
||||
if (!s->zero_res && !s->low_delay)
|
||||
{
|
||||
@@ -1944,7 +1944,7 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
||||
h = p->height - start;
|
||||
else
|
||||
h = p->ybsep - (start - dsty);
|
||||
if (h <= 0)
|
||||
if (h < 0)
|
||||
break;
|
||||
|
||||
memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight);
|
||||
|
||||
@@ -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 (buf_size <= pc->packet_len - pc->packet_index) {
|
||||
if (pc->packet_index + buf_size <= pc->packet_len) {
|
||||
memcpy(pc->packet + pc->packet_index, buf, buf_size);
|
||||
pc->packet_index += buf_size;
|
||||
if (pc->packet_index >= pc->packet_len) {
|
||||
|
||||
+12
-41
@@ -38,15 +38,12 @@ typedef struct DXVContext {
|
||||
GetByteContext gbc;
|
||||
|
||||
uint8_t *tex_data; // Compressed texture
|
||||
unsigned tex_data_size;
|
||||
uint8_t *ctex_data; // Compressed chroma texture
|
||||
unsigned ctex_data_size;
|
||||
|
||||
size_t tex_size; // Texture size
|
||||
int64_t tex_size; // Texture size
|
||||
int64_t ctex_size; // Chroma texture size
|
||||
|
||||
uint8_t *op_data[4]; // Opcodes
|
||||
unsigned op_data_size[4];
|
||||
int64_t op_size[4]; // Opcodes size
|
||||
} DXVContext;
|
||||
|
||||
@@ -277,9 +274,7 @@ static int dxv_decompress_opcodes(GetByteContext *gb, void *dstp, size_t op_size
|
||||
|
||||
if ((flag & 3) == 0) {
|
||||
bytestream2_skip(gb, 1);
|
||||
int read_size = bytestream2_get_buffer(gb, dstp, op_size);
|
||||
if (read_size != op_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bytestream2_get_buffer(gb, dstp, op_size);
|
||||
} else if ((flag & 3) == 1) {
|
||||
bytestream2_skip(gb, 1);
|
||||
memset(dstp, bytestream2_get_byte(gb), op_size);
|
||||
@@ -828,12 +823,7 @@ static int dxv_decompress_dxt5(AVCodecContext *avctx)
|
||||
static int dxv_decompress_lzf(AVCodecContext *avctx)
|
||||
{
|
||||
DXVContext *ctx = avctx->priv_data;
|
||||
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;
|
||||
return ff_lzf_uncompress(&ctx->gbc, &ctx->tex_data, &ctx->tex_size);
|
||||
}
|
||||
|
||||
static int dxv_decompress_raw(AVCodecContext *avctx)
|
||||
@@ -945,8 +935,6 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame,
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (avctx->coded_height / 2 / TEXTURE_BLOCK_H < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
texdsp_ctx.slice_count = av_clip(avctx->thread_count, 1,
|
||||
avctx->coded_height / TEXTURE_BLOCK_H);
|
||||
@@ -981,14 +969,9 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame,
|
||||
ctx->tex_size = avctx->coded_width / (texdsp_ctx.raw_ratio / (avctx->pix_fmt == AV_PIX_FMT_RGBA ? 4 : 1)) *
|
||||
avctx->coded_height / TEXTURE_BLOCK_H *
|
||||
texdsp_ctx.tex_ratio;
|
||||
unsigned old_size = ctx->tex_data_size;
|
||||
void *ptr = av_fast_realloc(ctx->tex_data, &ctx->tex_data_size, ctx->tex_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!ptr)
|
||||
return AVERROR(ENOMEM);
|
||||
ctx->tex_data = ptr;
|
||||
|
||||
if (ctx->tex_data_size > old_size)
|
||||
memset(ctx->tex_data + old_size, 0, ctx->tex_data_size - old_size);
|
||||
ret = av_reallocp(&ctx->tex_data, ctx->tex_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (avctx->pix_fmt != AV_PIX_FMT_RGBA) {
|
||||
int i;
|
||||
@@ -1002,20 +985,13 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame,
|
||||
ctx->op_size[2] = avctx->coded_width * avctx->coded_height / 32;
|
||||
ctx->op_size[3] = avctx->coded_width * avctx->coded_height / 16;
|
||||
|
||||
old_size = ctx->ctex_data_size;
|
||||
ptr = av_fast_realloc(ctx->ctex_data, &ctx->ctex_data_size, ctx->ctex_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!ptr)
|
||||
return AVERROR(ENOMEM);
|
||||
ctx->ctex_data = ptr;
|
||||
if (old_size < ctx->ctex_data_size)
|
||||
memset(ctx->ctex_data + old_size, 0, ctx->ctex_data_size - old_size);
|
||||
|
||||
ret = av_reallocp(&ctx->ctex_data, ctx->ctex_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
for (i = 0; i < 4; i++) {
|
||||
old_size = ctx->op_data_size[i];
|
||||
ptr = av_fast_realloc(ctx->op_data[i], &ctx->op_data_size[i], ctx->op_size[i]);
|
||||
if (!ptr)
|
||||
return AVERROR(ENOMEM);
|
||||
ctx->op_data[i] = ptr;
|
||||
ret = av_reallocp(&ctx->op_data[i], ctx->op_size[i]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1102,16 +1078,11 @@ static av_cold int dxv_close(AVCodecContext *avctx)
|
||||
DXVContext *ctx = avctx->priv_data;
|
||||
|
||||
av_freep(&ctx->tex_data);
|
||||
ctx->tex_data_size = 0;
|
||||
|
||||
av_freep(&ctx->ctex_data);
|
||||
ctx->ctex_data_size = 0;
|
||||
|
||||
av_freep(&ctx->op_data[0]);
|
||||
av_freep(&ctx->op_data[1]);
|
||||
av_freep(&ctx->op_data[2]);
|
||||
av_freep(&ctx->op_data[3]);
|
||||
memset(ctx->op_data_size, 0, sizeof(ctx->op_data_size));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ static av_cold int escape130_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->old_y_avg = av_mallocz(avctx->width * avctx->height / 4);
|
||||
s->old_y_avg = av_malloc(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) {
|
||||
|
||||
+15
-72
@@ -175,9 +175,6 @@ typedef struct EXRContext {
|
||||
|
||||
int is_luma;/* 1 if there is an Y plane */
|
||||
|
||||
#define M(chr) (1<<chr - 'A')
|
||||
int has_channel; ///< combination of flags representing the channel codes A-Z
|
||||
|
||||
GetByteContext gb;
|
||||
const uint8_t *buf;
|
||||
int buf_size;
|
||||
@@ -637,9 +634,6 @@ 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);
|
||||
@@ -751,12 +745,12 @@ static int pxr24_uncompress(const EXRContext *s, const uint8_t *src,
|
||||
break;
|
||||
case EXR_UINT:
|
||||
ptr[0] = in;
|
||||
ptr[1] = ptr[0] + td->xsize;
|
||||
ptr[2] = ptr[1] + td->xsize;
|
||||
ptr[3] = ptr[2] + td->xsize;
|
||||
in = ptr[3] + td->xsize;
|
||||
ptr[1] = ptr[0] + s->xdelta;
|
||||
ptr[2] = ptr[1] + s->xdelta;
|
||||
ptr[3] = ptr[2] + s->xdelta;
|
||||
in = ptr[3] + s->xdelta;
|
||||
|
||||
for (j = 0; j < td->xsize; ++j) {
|
||||
for (j = 0; j < s->xdelta; ++j) {
|
||||
uint32_t diff = ((uint32_t)*(ptr[0]++) << 24) |
|
||||
(*(ptr[1]++) << 16) |
|
||||
(*(ptr[2]++) << 8 ) |
|
||||
@@ -998,8 +992,8 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse
|
||||
int64_t version, lo_usize, lo_size;
|
||||
int64_t ac_size, dc_size, rle_usize, rle_csize, rle_raw_size;
|
||||
int64_t ac_count, dc_count, ac_compression;
|
||||
const int dc_w = (td->xsize + 7) >> 3;
|
||||
const int dc_h = (td->ysize + 7) >> 3;
|
||||
const int dc_w = td->xsize >> 3;
|
||||
const int dc_h = td->ysize >> 3;
|
||||
GetByteContext gb, agb;
|
||||
int skip, ret;
|
||||
int have_rle = 0;
|
||||
@@ -1011,11 +1005,6 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse
|
||||
if (version != 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (s->nb_channels < 3) {
|
||||
avpriv_request_sample(s->avctx, "Gray DWA");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
lo_usize = AV_RL64(src + 8);
|
||||
lo_size = AV_RL64(src + 16);
|
||||
ac_size = AV_RL64(src + 24);
|
||||
@@ -1032,20 +1021,11 @@ static int dwa_uncompress(const EXRContext *s, const uint8_t *src, int compresse
|
||||
)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (ac_size <= 0) {
|
||||
avpriv_request_sample(s->avctx, "Zero ac_size");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((uint64_t)rle_raw_size > INT_MAX) {
|
||||
avpriv_request_sample(s->avctx, "Too big rle_raw_size");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (td->xsize % 8 || td->ysize % 8) {
|
||||
avpriv_request_sample(s->avctx, "odd dimensions DWA");
|
||||
}
|
||||
|
||||
bytestream2_init(&gb, src + 88, compressed_size - 88);
|
||||
skip = bytestream2_get_le16(&gb);
|
||||
if (skip < 2)
|
||||
@@ -1488,8 +1468,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
}
|
||||
|
||||
// Zero out the end if xmax+1 is not w
|
||||
if (s->desc->flags & AV_PIX_FMT_FLAG_PLANAR || !c)
|
||||
memset(ptr_x, 0, axmax);
|
||||
memset(ptr_x, 0, axmax);
|
||||
channel_buffer[c] += td->channel_line_size;
|
||||
}
|
||||
}
|
||||
@@ -1629,7 +1608,6 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
s->is_tile = 0;
|
||||
s->is_multipart = 0;
|
||||
s->is_luma = 0;
|
||||
s->has_channel = 0;
|
||||
s->current_part = 0;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 10) {
|
||||
@@ -1733,26 +1711,23 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
}
|
||||
|
||||
if (layer_match) { /* only search channel if the layer match is valid */
|
||||
if (strlen(ch_gb.buffer) == 1) {
|
||||
int ch_chr = av_toupper(*ch_gb.buffer);
|
||||
if (ch_chr >= 'A' && ch_chr <= 'Z')
|
||||
s->has_channel |= M(ch_chr);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "%c\n", ch_chr);
|
||||
}
|
||||
|
||||
if (!av_strcasecmp(ch_gb.buffer, "R") ||
|
||||
!av_strcasecmp(ch_gb.buffer, "X") ||
|
||||
!av_strcasecmp(ch_gb.buffer, "U")) {
|
||||
channel_index = 0;
|
||||
s->is_luma = 0;
|
||||
} else if (!av_strcasecmp(ch_gb.buffer, "G") ||
|
||||
!av_strcasecmp(ch_gb.buffer, "V")) {
|
||||
channel_index = 1;
|
||||
s->is_luma = 0;
|
||||
} else if (!av_strcasecmp(ch_gb.buffer, "Y")) {
|
||||
channel_index = 1;
|
||||
s->is_luma = 1;
|
||||
} else if (!av_strcasecmp(ch_gb.buffer, "B") ||
|
||||
!av_strcasecmp(ch_gb.buffer, "Z") ||
|
||||
!av_strcasecmp(ch_gb.buffer, "W")) {
|
||||
channel_index = 2;
|
||||
s->is_luma = 0;
|
||||
} else if (!av_strcasecmp(ch_gb.buffer, "A")) {
|
||||
channel_index = 3;
|
||||
} else {
|
||||
@@ -1811,17 +1786,12 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
s->channels = av_realloc(s->channels,
|
||||
++s->nb_channels * sizeof(EXRChannel));
|
||||
if (!s->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;
|
||||
@@ -1833,20 +1803,6 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
s->current_channel_offset += 4;
|
||||
}
|
||||
}
|
||||
if (!((M('R') + M('G') + M('B')) & ~s->has_channel)) {
|
||||
s->is_luma = 0;
|
||||
} else if (!((M('X') + M('Y') + M('Z')) & ~s->has_channel)) {
|
||||
s->is_luma = 0;
|
||||
} else if (!((M('Y') + M('U') + M('V')) & ~s->has_channel)) {
|
||||
s->is_luma = 0;
|
||||
} else if (!((M('Y') ) & ~s->has_channel) &&
|
||||
!((M('R') + M('G') + M('B') + M('U') + M('V') + M('X') + M('Z')) & s->has_channel)) {
|
||||
s->is_luma = 1;
|
||||
} else {
|
||||
avpriv_request_sample(s->avctx, "Uncommon channel combination");
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Check if all channels are set with an offset or if the channels
|
||||
* are causing an overflow */
|
||||
@@ -2130,17 +2086,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
if ((ret = decode_header(s, picture)) < 0)
|
||||
return ret;
|
||||
|
||||
if (s->compression == EXR_DWAA ||
|
||||
s->compression == EXR_DWAB) {
|
||||
for (int i = 0; i<s->nb_channels; i++) {
|
||||
EXRChannel *channel = &s->channels[i];
|
||||
if (channel->pixel_type != s->pixel_type) {
|
||||
avpriv_request_sample(s->avctx, "mixed pixel type DWA");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (s->pixel_type) {
|
||||
case EXR_HALF:
|
||||
if (s->channel_offsets[3] >= 0) {
|
||||
@@ -2247,8 +2192,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
out_line_size = avctx->width * s->desc->comp[0].step;
|
||||
|
||||
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 */
|
||||
|
||||
@@ -113,8 +113,6 @@ static int fastaudio_decode(AVCodecContext *avctx, AVFrame *frame,
|
||||
int ret;
|
||||
|
||||
subframes = pkt->size / (40 * avctx->ch_layout.nb_channels);
|
||||
if (subframes <= 0 || subframes > INT_MAX / 256)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame->nb_samples = subframes * 256;
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -435,7 +435,7 @@ static void set_micro_version(FFV1Context *f)
|
||||
if (f->version == 3) {
|
||||
f->micro_version = 4;
|
||||
} else if (f->version == 4) {
|
||||
f->micro_version = 9;
|
||||
f->micro_version = 8;
|
||||
} else
|
||||
av_assert0(0);
|
||||
|
||||
@@ -1310,7 +1310,7 @@ static int encode_float32_remap_segment(FFV1SliceContext *sc,
|
||||
int current_mul = current_mul_index < 0 ? 1 : FFABS(mul[current_mul_index]);
|
||||
int64_t val;
|
||||
if (i == pixel_num) {
|
||||
if (last_val == 0xFFFFFFFF && (!run || run1final)) {
|
||||
if (last_val == 0xFFFFFFFF) {
|
||||
break;
|
||||
} else {
|
||||
val = last_val + ((1LL<<32) - last_val + current_mul - 1) / current_mul * current_mul;
|
||||
@@ -1684,11 +1684,9 @@ size_t ff_ffv1_encode_buffer_size(AVCodecContext *avctx)
|
||||
{
|
||||
FFV1Context *f = avctx->priv_data;
|
||||
|
||||
int w = avctx->width + f->num_h_slices;
|
||||
int h = avctx->height + f->num_v_slices;
|
||||
size_t maxsize = w*h * (1 + f->transparency);
|
||||
size_t maxsize = avctx->width*avctx->height * (1 + f->transparency);
|
||||
if (f->chroma_planes)
|
||||
maxsize += AV_CEIL_RSHIFT(w, f->chroma_h_shift) * AV_CEIL_RSHIFT(h, f->chroma_v_shift) * 2;
|
||||
maxsize += AV_CEIL_RSHIFT(avctx->width, f->chroma_h_shift) * AV_CEIL_RSHIFT(f->height, f->chroma_v_shift) * 2;
|
||||
maxsize += f->slice_count * 800; //for slice header
|
||||
if (f->version > 3) {
|
||||
maxsize *= f->bits_per_raw_sample + 1;
|
||||
|
||||
@@ -314,9 +314,6 @@ 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
-3
@@ -481,13 +481,12 @@ static void epic_free_pixel_cache(ePICPixHash *hash)
|
||||
static inline int is_pixel_on_stack(const ePICContext *dc, uint32_t pix)
|
||||
{
|
||||
int i;
|
||||
int n = FFMIN(dc->stack_pos, EPIC_PIX_STACK_SIZE);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
for (i = 0; i < dc->stack_pos; i++)
|
||||
if (dc->stack[i] == pix)
|
||||
break;
|
||||
|
||||
return i != n;
|
||||
return i != dc->stack_pos;
|
||||
}
|
||||
|
||||
#define TOSIGNED(val) (((val) >> 1) ^ -((val) & 1))
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ typedef struct HFParam {
|
||||
* Optimized fixed codebook excitation parameters
|
||||
*/
|
||||
typedef struct FCBParam {
|
||||
int64_t min_err;
|
||||
int min_err;
|
||||
int amp_index;
|
||||
int grid_index;
|
||||
int dirac_train;
|
||||
|
||||
@@ -1013,7 +1013,7 @@ static void fcb_search(G723_1_ChannelContext *p, int16_t *impulse_resp,
|
||||
int pulse_cnt = pulses[index];
|
||||
int i;
|
||||
|
||||
optim.min_err = 1LL << 31;
|
||||
optim.min_err = 1 << 30;
|
||||
get_fcb_param(&optim, impulse_resp, buf, pulse_cnt, SUBFRAME_LEN);
|
||||
|
||||
if (p->pitch_lag[index >> 1] < SUBFRAME_LEN - 2) {
|
||||
|
||||
@@ -455,8 +455,6 @@ static av_cold int g726_decode_init(AVCodecContext *avctx)
|
||||
g726_reset(c);
|
||||
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
if (!avctx->sample_rate)
|
||||
avctx->sample_rate = 8000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -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 (esc_len && i == limit - 1) {
|
||||
} else if (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 (esc_len && i == limit - 1) {
|
||||
} else if (i == limit - 1) {
|
||||
buf = SHOW_UBITS(re, gb, esc_len);
|
||||
LAST_SKIP_BITS(re, gb, esc_len);
|
||||
|
||||
|
||||
@@ -145,7 +145,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 = -1;
|
||||
int country_code, provider_code;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -592,15 +592,15 @@ static int h2645_sei_to_side_data(AVCodecContext *avctx, H2645SEI *sei,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
dst_env->ambient_illuminance = av_make_q(env->ambient_illuminance, 10000);
|
||||
dst_env->ambient_light_x = av_make_q(env->ambient_light_x, 50000);
|
||||
dst_env->ambient_light_y = av_make_q(env->ambient_light_y, 50000);
|
||||
|
||||
ret = ff_frame_new_side_data_from_buf_ext(avctx, sd, nb_sd,
|
||||
AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, &buf);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dst_env->ambient_illuminance = av_make_q(env->ambient_illuminance, 10000);
|
||||
dst_env->ambient_light_x = av_make_q(env->ambient_light_x, 50000);
|
||||
dst_env->ambient_light_y = av_make_q(env->ambient_light_y, 50000);
|
||||
}
|
||||
|
||||
if (sei->mastering_display.present) {
|
||||
|
||||
+15
-19
@@ -121,30 +121,26 @@ 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, field;
|
||||
int list, j, field;
|
||||
int sidx = (h->picture_structure & 1) ^ 1;
|
||||
int ref1sidx = (ref1->reference & 1) ^ 1;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -223,9 +223,6 @@ 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,
|
||||
@@ -650,12 +647,8 @@ 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) {
|
||||
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 (p->reference_dts != AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE)
|
||||
s->pts = s->dts + av_rescale(s->pts_dts_delta, num, den);
|
||||
|
||||
if (s->dts_sync_point > 0)
|
||||
p->reference_dts = s->dts; // new reference
|
||||
|
||||
@@ -156,7 +156,8 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
|
||||
h->long_ref, 16, 1, h->picture_structure);
|
||||
av_assert0(len <= 32);
|
||||
|
||||
memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (32 - len));
|
||||
if (len < sl->ref_count[list])
|
||||
memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (sl->ref_count[list] - len));
|
||||
lens[list] = len;
|
||||
}
|
||||
|
||||
@@ -177,7 +178,8 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
|
||||
h-> long_ref, 16, 1, h->picture_structure);
|
||||
av_assert0(len <= 32);
|
||||
|
||||
memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (32 - len));
|
||||
if (len < sl->ref_count[0])
|
||||
memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (sl->ref_count[0] - len));
|
||||
}
|
||||
#ifdef TRACE
|
||||
for (int i = 0; i < sl->ref_count[0]; i++) {
|
||||
|
||||
+4
-11
@@ -316,10 +316,8 @@ static void color_frame(AVFrame *frame, const int c[4])
|
||||
int bytes = is_chroma ? AV_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
|
||||
int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
|
||||
if (desc->comp[0].depth >= 9) {
|
||||
if (bytes >= 1)
|
||||
((uint16_t*)dst)[0] = c[p];
|
||||
if (bytes >= 2)
|
||||
av_memcpy_backptr(dst + 2, 2, 2 * (bytes - 1));
|
||||
((uint16_t*)dst)[0] = c[p];
|
||||
av_memcpy_backptr(dst + 2, 2, bytes - 2);
|
||||
dst += frame->linesize[p];
|
||||
for (int y = 1; y < height; y++) {
|
||||
memcpy(dst, frame->data[p], 2*bytes);
|
||||
@@ -1951,7 +1949,8 @@ 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);
|
||||
ff_h264_direct_ref_list_init(h, sl);
|
||||
if (!h->setup_finished)
|
||||
ff_h264_direct_ref_list_init(h, sl);
|
||||
|
||||
if (h->avctx->skip_loop_filter >= AVDISCARD_ALL ||
|
||||
(h->avctx->skip_loop_filter >= AVDISCARD_NONKEY &&
|
||||
@@ -1980,12 +1979,6 @@ 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)
|
||||
|
||||
+1
-4
@@ -72,7 +72,7 @@ static int decompress(uint8_t *scanline, int w, GetByteContext *gb, const uint8_
|
||||
for (int i = run << rshift; i > 0 && w > 0 && scanline >= start + 4; i--) {
|
||||
memcpy(scanline, scanline - 4, 4);
|
||||
scanline += 4;
|
||||
w--;
|
||||
w -= 4;
|
||||
}
|
||||
rshift += 8;
|
||||
if (rshift > 16)
|
||||
@@ -126,9 +126,6 @@ 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;
|
||||
|
||||
|
||||
@@ -916,7 +916,6 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext
|
||||
sh->short_term_ref_pic_set_size = 0;
|
||||
sh->short_term_rps = NULL;
|
||||
sh->long_term_ref_pic_set_size = 0;
|
||||
sh->long_term_rps.nb_refs = 0;
|
||||
sh->slice_temporal_mvp_enabled_flag = 0;
|
||||
}
|
||||
|
||||
@@ -4107,7 +4106,7 @@ static int hevc_sei_to_context(AVCodecContext *avctx, HEVCSEI *sei)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (sei->tdrdi.present) {
|
||||
if (sei->tdrdi.num_ref_displays) {
|
||||
AVBufferRef *buf;
|
||||
size_t size;
|
||||
AV3DReferenceDisplaysInfo *tdrdi = av_tdrdi_alloc(sei->tdrdi.num_ref_displays, &size);
|
||||
|
||||
+22
-41
@@ -62,29 +62,6 @@ static const uint8_t hevc_sub_height_c[] = {
|
||||
1, 2, 1, 1
|
||||
};
|
||||
|
||||
static int read_window(HEVCWindow *window, GetBitContext *gb, int chroma_format_idc, int w, int h)
|
||||
{
|
||||
int64_t vert_mult = hevc_sub_height_c[chroma_format_idc];
|
||||
int64_t horiz_mult = hevc_sub_width_c [chroma_format_idc];
|
||||
int64_t left = get_ue_golomb_long(gb) * horiz_mult;
|
||||
int64_t right = get_ue_golomb_long(gb) * horiz_mult;
|
||||
int64_t top = get_ue_golomb_long(gb) * vert_mult;
|
||||
int64_t bottom = get_ue_golomb_long(gb) * vert_mult;
|
||||
|
||||
if (left < 0 || right < 0 || top < 0 || bottom < 0 ||
|
||||
w <= left + right ||
|
||||
h <= top + bottom) {
|
||||
memset(window, 0, sizeof(*window));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
window->left_offset = left;
|
||||
window->right_offset = right;
|
||||
window->top_offset = top;
|
||||
window->bottom_offset = bottom;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void remove_sps(HEVCParamSets *s, int id)
|
||||
{
|
||||
int i;
|
||||
@@ -724,9 +701,12 @@ static int decode_vps_ext(GetBitContext *gb, AVCodecContext *avctx, HEVCVPS *vps
|
||||
}
|
||||
|
||||
if (get_bits1(gb) /* conformance_window_vps_flag */) {
|
||||
int ret = read_window(&vps->rep_format.conf_win, gb, vps->rep_format.chroma_format_idc, vps->rep_format.pic_width_in_luma_samples, vps->rep_format.pic_height_in_luma_samples);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
int vert_mult = hevc_sub_height_c[vps->rep_format.chroma_format_idc];
|
||||
int horiz_mult = hevc_sub_width_c[vps->rep_format.chroma_format_idc];
|
||||
vps->rep_format.conf_win_left_offset = get_ue_golomb(gb) * horiz_mult;
|
||||
vps->rep_format.conf_win_right_offset = get_ue_golomb(gb) * horiz_mult;
|
||||
vps->rep_format.conf_win_top_offset = get_ue_golomb(gb) * vert_mult;
|
||||
vps->rep_format.conf_win_bottom_offset = get_ue_golomb(gb) * vert_mult;
|
||||
}
|
||||
|
||||
vps->max_one_active_ref_layer = get_bits1(gb);
|
||||
@@ -981,7 +961,12 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
|
||||
vui->default_display_window_flag = get_bits1(gb);
|
||||
|
||||
if (vui->default_display_window_flag) {
|
||||
read_window(&vui->def_disp_win, gb, sps->chroma_format_idc, sps->width, sps->height);
|
||||
int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
|
||||
int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
|
||||
vui->def_disp_win.left_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
vui->def_disp_win.right_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
vui->def_disp_win.top_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
|
||||
if (apply_defdispwin &&
|
||||
avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
|
||||
@@ -1294,14 +1279,11 @@ 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;
|
||||
sps->pic_conf_win.top_offset = rf->conf_win.top_offset;
|
||||
sps->pic_conf_win.bottom_offset = rf->conf_win.bottom_offset;
|
||||
sps->pic_conf_win.left_offset = rf->conf_win_left_offset;
|
||||
sps->pic_conf_win.right_offset = rf->conf_win_right_offset;
|
||||
sps->pic_conf_win.top_offset = rf->conf_win_top_offset;
|
||||
sps->pic_conf_win.bottom_offset = rf->conf_win_bottom_offset;
|
||||
|
||||
} else {
|
||||
sps->chroma_format_idc = get_ue_golomb_long(gb);
|
||||
@@ -1324,9 +1306,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
|
||||
sps->conformance_window = get_bits1(gb);
|
||||
if (sps->conformance_window) {
|
||||
ret = read_window(&sps->pic_conf_win, gb, sps->chroma_format_idc, sps->width, sps->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
|
||||
int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
|
||||
sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
|
||||
if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
|
||||
av_log(avctx, AV_LOG_DEBUG,
|
||||
@@ -1840,10 +1825,6 @@ 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;
|
||||
|
||||
|
||||
@@ -162,7 +162,10 @@ typedef struct RepFormat {
|
||||
uint8_t separate_colour_plane_flag;
|
||||
uint8_t bit_depth_luma; ///< bit_depth_vps_luma_minus8 + 8
|
||||
uint8_t bit_depth_chroma; ///< bit_depth_vps_chroma_minus8 + 8
|
||||
HEVCWindow conf_win;
|
||||
uint16_t conf_win_left_offset;
|
||||
uint16_t conf_win_right_offset;
|
||||
uint16_t conf_win_top_offset;
|
||||
uint16_t conf_win_bottom_offset;
|
||||
} RepFormat;
|
||||
|
||||
typedef struct HEVCVPS {
|
||||
|
||||
@@ -162,10 +162,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l)
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
size_t rpl_bytes;
|
||||
if (av_size_mult(s->pkt.nb_nals, sizeof(*frame->rpl), &rpl_bytes) < 0)
|
||||
goto fail;
|
||||
frame->rpl = av_refstruct_allocz(rpl_bytes);
|
||||
frame->rpl = av_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
|
||||
if (!frame->rpl)
|
||||
goto fail;
|
||||
frame->nb_rpl_elems = s->pkt.nb_nals;
|
||||
@@ -238,7 +235,6 @@ int ff_hevc_set_new_ref(HEVCContext *s, HEVCLayerContext *l, int poc)
|
||||
s->layers[0].cur_frame - s->layers[0].DPB : -1;
|
||||
|
||||
no_output = !IS_IRAP(s) && (s->poc < s->recovery_poc) &&
|
||||
HEVC_IS_RECOVERING(s) &&
|
||||
!(s->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) &&
|
||||
!(s->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL);
|
||||
if (s->sh.pic_output_flag && !no_output)
|
||||
@@ -473,13 +469,12 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, HEVCLayerContext *l, int
|
||||
return NULL;
|
||||
|
||||
if (!s->avctx->hwaccel) {
|
||||
int nb_planes = l->sps->chroma_format_idc ? 3 : 1;
|
||||
if (!l->sps->pixel_shift) {
|
||||
for (i = 0; i < nb_planes; i++)
|
||||
for (i = 0; frame->f->data[i]; i++)
|
||||
memset(frame->f->data[i], 1 << (l->sps->bit_depth - 1),
|
||||
frame->f->linesize[i] * AV_CEIL_RSHIFT(l->sps->height, l->sps->vshift[i]));
|
||||
} else {
|
||||
for (i = 0; i < nb_planes; i++)
|
||||
for (i = 0; frame->f->data[i]; i++)
|
||||
for (y = 0; y < (l->sps->height >> l->sps->vshift[i]); y++) {
|
||||
uint8_t *dst = frame->f->data[i] + y * frame->f->linesize[i];
|
||||
AV_WN16(dst, 1 << (l->sps->bit_depth - 1));
|
||||
|
||||
@@ -167,8 +167,6 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb)
|
||||
|
||||
static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitContext *gb)
|
||||
{
|
||||
unsigned num_ref_displays;
|
||||
|
||||
s->prec_ref_display_width = get_ue_golomb(gb);
|
||||
if (s->prec_ref_display_width > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -178,10 +176,10 @@ static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitCont
|
||||
if (s->prec_ref_viewing_dist > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
num_ref_displays = get_ue_golomb(gb);
|
||||
if (num_ref_displays > 31)
|
||||
s->num_ref_displays = get_ue_golomb(gb);
|
||||
if (s->num_ref_displays > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->num_ref_displays = num_ref_displays + 1;
|
||||
s->num_ref_displays += 1;
|
||||
|
||||
for (int i = 0; i < s->num_ref_displays; i++) {
|
||||
int length;
|
||||
@@ -195,7 +193,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_bits64(gb, length);
|
||||
s->mantissa_ref_display_width[i] = get_bits_long(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)
|
||||
@@ -205,7 +203,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_bits64(gb, length);
|
||||
s->mantissa_ref_viewing_distance[i] = get_bits_long(gb, length);
|
||||
}
|
||||
s->additional_shift_present_flag[i] = get_bits1(gb);
|
||||
if (s->additional_shift_present_flag[i]) {
|
||||
@@ -217,8 +215,6 @@ static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitCont
|
||||
}
|
||||
s->three_dimensional_reference_displays_extension_flag = get_bits1(gb);
|
||||
|
||||
s->present = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,13 +87,12 @@ typedef struct HEVCSEITDRDI {
|
||||
uint16_t left_view_id[32];
|
||||
uint16_t right_view_id[32];
|
||||
uint8_t exponent_ref_display_width[32];
|
||||
uint64_t mantissa_ref_display_width[32];
|
||||
uint8_t mantissa_ref_display_width[32];
|
||||
uint8_t exponent_ref_viewing_distance[32];
|
||||
uint64_t mantissa_ref_viewing_distance[32];
|
||||
uint8_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;
|
||||
int present;
|
||||
} HEVCSEITDRDI;
|
||||
|
||||
typedef struct HEVCSEIRecoveryPoint {
|
||||
@@ -127,7 +126,6 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s,
|
||||
*/
|
||||
static inline void ff_hevc_reset_sei(HEVCSEI *sei)
|
||||
{
|
||||
sei->tdrdi.present = 0;
|
||||
ff_h2645_sei_reset(&sei->common);
|
||||
}
|
||||
|
||||
|
||||
@@ -675,7 +675,6 @@ static void get_codebook(int16_t * cbvec, /* (o) Constructed codebook vector *
|
||||
/* get vector */
|
||||
memcpy(cbvec, mem + lMem - k, cbveclen * 2);
|
||||
} else if (index < base_size) {
|
||||
memset(cbvec, 0, cbveclen * 2);
|
||||
|
||||
/* Calculate lag */
|
||||
|
||||
@@ -702,7 +701,6 @@ static void get_codebook(int16_t * cbvec, /* (o) Constructed codebook vector *
|
||||
|
||||
filter_mafq12(&mem[memIndTest + 4], cbvec, kCbFiltersRev, CB_FILTERLEN, cbveclen);
|
||||
} else {
|
||||
memset(cbvec, 0, cbveclen * 2);
|
||||
/* interpolated vectors */
|
||||
/* Stuff zeros outside memory buffer */
|
||||
memIndTest = lMem - cbveclen - CB_FILTERLEN;
|
||||
|
||||
@@ -61,7 +61,6 @@ static av_cold int imm5_init(AVCodecContext *avctx)
|
||||
ctx->h264_avctx->thread_count = 1;
|
||||
ctx->h264_avctx->flags = avctx->flags;
|
||||
ctx->h264_avctx->flags2 = avctx->flags2;
|
||||
ctx->h264_avctx->max_pixels = avctx->max_pixels;
|
||||
ret = avcodec_open2(ctx->h264_avctx, NULL, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -73,7 +72,6 @@ static av_cold int imm5_init(AVCodecContext *avctx)
|
||||
ctx->hevc_avctx->thread_count = 1;
|
||||
ctx->hevc_avctx->flags = avctx->flags;
|
||||
ctx->hevc_avctx->flags2 = avctx->flags2;
|
||||
ctx->hevc_avctx->max_pixels = avctx->max_pixels;
|
||||
ret = avcodec_open2(ctx->hevc_avctx, NULL, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -137,8 +135,6 @@ 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;
|
||||
|
||||
|
||||
@@ -437,9 +437,6 @@ 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);
|
||||
|
||||
+16
-25
@@ -1900,7 +1900,7 @@ static void decode_sigpass(Jpeg2000T1Context *t1, int width, int height,
|
||||
int bpno, int bandno,
|
||||
int vert_causal_ctx_csty_symbol)
|
||||
{
|
||||
int mask = (3u << bpno)>>1, y0, x, y;
|
||||
int mask = 3 << (bpno - 1), y0, x, y;
|
||||
|
||||
for (y0 = 0; y0 < height; y0 += 4)
|
||||
for (x = 0; x < width; x++)
|
||||
@@ -1933,7 +1933,7 @@ static void decode_refpass(Jpeg2000T1Context *t1, int width, int height,
|
||||
int phalf;
|
||||
int y0, x, y;
|
||||
|
||||
phalf = 1 << bpno;
|
||||
phalf = 1 << (bpno - 1);
|
||||
|
||||
for (y0 = 0; y0 < height; y0 += 4)
|
||||
for (x = 0; x < width; x++)
|
||||
@@ -1942,11 +1942,11 @@ static void decode_refpass(Jpeg2000T1Context *t1, int width, int height,
|
||||
int flags_mask = (vert_causal_ctx_csty_symbol && y == y0 + 3) ?
|
||||
~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S) : -1;
|
||||
int ctxno = ff_jpeg2000_getrefctxno(t1->flags[(y + 1) * t1->stride + x + 1] & flags_mask);
|
||||
t1->data[(y) * t1->stride + x] |= phalf >> 1;
|
||||
t1->data[(y) * t1->stride + x] |= phalf;
|
||||
if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno))
|
||||
t1->data[(y) * t1->stride + x] |= phalf;
|
||||
t1->data[(y) * t1->stride + x] |= phalf << 1;
|
||||
else {
|
||||
t1->data[(y) * t1->stride + x] &= ~(phalf);
|
||||
t1->data[(y) * t1->stride + x] &= ~(phalf << 1);
|
||||
|
||||
}
|
||||
t1->flags[(y + 1) * t1->stride + x + 1] |= JPEG2000_T1_REF;
|
||||
@@ -1957,7 +1957,7 @@ static void decode_clnpass(const Jpeg2000DecoderContext *s, Jpeg2000T1Context *t
|
||||
int width, int height, int bpno, int bandno,
|
||||
int seg_symbols, int vert_causal_ctx_csty_symbol)
|
||||
{
|
||||
int mask = (3u << bpno)>>1, y0, x, y, runlen, dec;
|
||||
int mask = 3 << (bpno - 1), y0, x, y, runlen, dec;
|
||||
|
||||
for (y0 = 0; y0 < height; y0 += 4) {
|
||||
for (x = 0; x < width; x++) {
|
||||
@@ -2043,8 +2043,8 @@ static int decode_cblk(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *cod
|
||||
ff_mqc_initdec(&t1->mqc, cblk->data, 0, 1);
|
||||
|
||||
while (passno--) {
|
||||
if (bpno < -1 || bpno > 29) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bpno (%d) became invalid\n", bpno);
|
||||
if (bpno < 0 || bpno > 29) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bpno became invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
switch(pass_t) {
|
||||
@@ -2100,7 +2100,7 @@ static int decode_cblk(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *cod
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
int32_t sign, n, val;
|
||||
const uint32_t mask = (int64_t)UINT32_MAX >> (M_b + 1); // bit mask for ROI detection
|
||||
const uint32_t mask = UINT32_MAX >> (M_b + 1); // bit mask for ROI detection
|
||||
|
||||
n = x + (y * t1->stride);
|
||||
val = t1->data[n];
|
||||
@@ -2130,7 +2130,7 @@ static void dequantization_float(int x, int y, Jpeg2000Cblk *cblk,
|
||||
int w = cblk->coord[0][1] - cblk->coord[0][0];
|
||||
const int downshift = 31 - M_b;
|
||||
float fscale = band->f_stepsize;
|
||||
fscale /= (float)(1LL << downshift);
|
||||
fscale /= (float)(1 << downshift);
|
||||
for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {
|
||||
float *datap = &comp->f_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
|
||||
int *src = t1->data + j*t1->stride;
|
||||
@@ -2149,7 +2149,7 @@ static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk,
|
||||
Jpeg2000T1Context *t1, Jpeg2000Band *band, const int M_b)
|
||||
{
|
||||
int i, j;
|
||||
const int downshift = FFMIN(31 - M_b, 31);
|
||||
const int downshift = 31 - M_b;
|
||||
int w = cblk->coord[0][1] - cblk->coord[0][0];
|
||||
for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {
|
||||
int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
|
||||
@@ -2188,7 +2188,7 @@ static void dequantization_int_97(int x, int y, Jpeg2000Cblk *cblk,
|
||||
const int PRESCALE = 6; // At least 6 is required to pass the conformance tests in ISO/IEC 15444-4
|
||||
int scale;
|
||||
|
||||
fscale /= (float)(1LL << downshift);
|
||||
fscale /= (float)(1 << downshift);
|
||||
fscale *= (float)(1 << PRESCALE);
|
||||
fscale *= (float)(1 << (16 + I_PRESHIFT));
|
||||
scale = (int)(fscale + 0.5);
|
||||
@@ -2201,7 +2201,7 @@ static void dequantization_int_97(int x, int y, Jpeg2000Cblk *cblk,
|
||||
if (val < 0) // Convert sign-magnitude to two's complement
|
||||
val = -(val & INT32_MAX);
|
||||
// Shifting down to prevent overflow in dequantization
|
||||
val = (val + (1LL << (PRESCALE - 1))) >> PRESCALE;
|
||||
val = (val + (1 << (PRESCALE - 1))) >> PRESCALE;
|
||||
datap[i] = RSHIFT(val * (int64_t)band->i_stepsize, 16);
|
||||
}
|
||||
}
|
||||
@@ -2270,8 +2270,8 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
|
||||
band->coord[1][0] == band->coord[1][1])
|
||||
continue;
|
||||
|
||||
if (M_b > 31) {
|
||||
avpriv_request_sample(s->avctx, "M_b (%d) > 31", M_b);
|
||||
if ((codsty->cblk_style & JPEG2000_CTSY_HTJ2K_F) && M_b >= 31) {
|
||||
avpriv_request_sample(s->avctx, "JPEG2000_CTSY_HTJ2K_F and M_b >= 31");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
@@ -2348,12 +2348,9 @@ 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]); \
|
||||
@@ -2363,7 +2360,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 + dstoffset; \
|
||||
dst = line + x * pixelsize + compno*!planar; \
|
||||
\
|
||||
if (codsty->transform == FF_DWT97) { \
|
||||
for (; x < w; x++) { \
|
||||
@@ -2448,14 +2445,8 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
|
||||
memset(s->qntsty, 0, sizeof(s->qntsty));
|
||||
memset(s->properties, 0, sizeof(s->properties));
|
||||
memset(&s->poc , 0, sizeof(s->poc));
|
||||
memset(s->roi_shift, 0, sizeof(s->roi_shift));
|
||||
s->numXtiles = s->numYtiles = 0;
|
||||
s->ncomponents = 0;
|
||||
s->has_ppm = 0;
|
||||
s->isHT = 0;
|
||||
s->precision = 0;
|
||||
s->colour_space = 0;
|
||||
s->pal8 = 0;
|
||||
}
|
||||
|
||||
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
||||
|
||||
@@ -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 = (int64_t)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,11 +1254,6 @@ 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
|
||||
|
||||
@@ -1268,11 +1263,6 @@ 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) {
|
||||
@@ -1334,19 +1324,8 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
|
||||
sign = val & INT32_MIN;
|
||||
val &= INT32_MAX;
|
||||
/* ROI shift, if necessary */
|
||||
if (roi_shift && (((uint32_t)val & ~mask) == 0)) {
|
||||
if ((32 - ff_clz(val | 1)) < roi_shift)
|
||||
// Assuming that the internal precision for codeblock decoding is 32 bits.
|
||||
val <<= roi_shift;
|
||||
else {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Pixel precision in ROI is beyond the supported range.\n"
|
||||
);
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto free;
|
||||
}
|
||||
|
||||
}
|
||||
if (roi_shift && (((uint32_t)val & ~mask) == 0))
|
||||
val <<= roi_shift;
|
||||
t1->data[n] = val | sign; /* NOTE: Binary point for reconstruction value is located in 31 - M_b */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
||||
if (s->bits <= 8) {
|
||||
uint8_t *src = s->picture_ptr->data[0];
|
||||
|
||||
for (i = 0; i < decoded_height; i++) {
|
||||
for (i = 0; i < s->height; i++) {
|
||||
switch(s->xfrm) {
|
||||
case 1:
|
||||
for (x = off; x + 2 < w; x += 3) {
|
||||
|
||||
+59
-69
@@ -16,6 +16,8 @@
|
||||
* 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,6 +28,7 @@
|
||||
#include "decode.h"
|
||||
#include "lcevcdec.h"
|
||||
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
static LCEVC_ColorFormat map_format(int format)
|
||||
{
|
||||
switch (format) {
|
||||
@@ -49,12 +52,13 @@ static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc,
|
||||
{
|
||||
LCEVC_PictureDesc desc;
|
||||
LCEVC_ColorFormat fmt = map_format(frame->format);
|
||||
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_PictureLockHandle lock;
|
||||
uint8_t *data[4] = { NULL };
|
||||
int linesizes[4] = { 0 };
|
||||
uint32_t planes;
|
||||
LCEVC_ReturnCode res;
|
||||
|
||||
res = LCEVC_DefaultPictureDesc(&desc, fmt, width, height);
|
||||
res = LCEVC_DefaultPictureDesc(&desc, fmt, frame->width, frame->height);
|
||||
if (res != LCEVC_Success)
|
||||
return AVERROR_EXTERNAL;
|
||||
|
||||
@@ -65,16 +69,36 @@ 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_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture);
|
||||
res = LCEVC_AllocPicture(lcevc->decoder, &desc, 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;
|
||||
}
|
||||
@@ -110,7 +134,6 @@ 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;
|
||||
@@ -118,11 +141,7 @@ 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;
|
||||
|
||||
@@ -130,29 +149,9 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
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);
|
||||
res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, NULL);
|
||||
if (res != LCEVC_Success)
|
||||
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);
|
||||
@@ -160,10 +159,8 @@ static int lcevc_send_frame(void *logctx, FFLCEVCFrame *frame_ctx, const AVFrame
|
||||
return ret;
|
||||
|
||||
res = LCEVC_SendDecoderPicture(lcevc->decoder, picture);
|
||||
if (res != LCEVC_Success) {
|
||||
LCEVC_FreePicture(lcevc->decoder, picture);
|
||||
if (res != LCEVC_Success)
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -181,14 +178,8 @@ 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) {
|
||||
LCEVC_FreePicture(lcevc->decoder, picture);
|
||||
if (res != LCEVC_Success)
|
||||
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;
|
||||
@@ -196,6 +187,11 @@ 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;
|
||||
|
||||
@@ -206,13 +202,18 @@ static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
|
||||
static int lcevc_receive_frame(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
|
||||
{
|
||||
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;
|
||||
@@ -220,9 +221,6 @@ static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
|
||||
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;
|
||||
@@ -231,18 +229,6 @@ static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
|
||||
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)
|
||||
@@ -259,16 +245,15 @@ static void event_callback(LCEVC_DecoderHandle dec, LCEVC_Event event,
|
||||
static void lcevc_free(AVRefStructOpaque unused, void *obj)
|
||||
{
|
||||
FFLCEVCContext *lcevc = obj;
|
||||
if (lcevc->initialized) {
|
||||
LCEVC_FlushDecoder(lcevc->decoder);
|
||||
lcevc_flush_pictures(lcevc);
|
||||
if (lcevc->initialized)
|
||||
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;
|
||||
|
||||
@@ -287,6 +272,7 @@ static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
#endif
|
||||
lcevc->initialized = 1;
|
||||
|
||||
return 0;
|
||||
@@ -305,6 +291,7 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
av_assert0(frame_ctx->frame);
|
||||
|
||||
|
||||
@@ -312,11 +299,12 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
|
||||
if (ret)
|
||||
return ret < 0 ? ret : 0;
|
||||
|
||||
ret = lcevc_receive_frame(logctx, frame_ctx, frame);
|
||||
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;
|
||||
}
|
||||
@@ -324,9 +312,11 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
|
||||
int ff_lcevc_alloc(FFLCEVCContext **plcevc)
|
||||
{
|
||||
FFLCEVCContext *lcevc = NULL;
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
lcevc = av_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free);
|
||||
if (!lcevc)
|
||||
return AVERROR(ENOMEM);
|
||||
#endif
|
||||
*plcevc = lcevc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -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 ret;
|
||||
int uqvq, 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++];
|
||||
unsigned uqvq = AV_RL16(encoded+pixel_ptr);
|
||||
uqvq = AV_RL16(encoded+pixel_ptr);
|
||||
pixel_ptr += 2;
|
||||
for (col = 1; col < width; col++) {
|
||||
encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
|
||||
|
||||
+18
-134
@@ -60,6 +60,8 @@ typedef struct ApvEncContext {
|
||||
|
||||
oapv_frms_t ifrms; // frames for input
|
||||
|
||||
int num_frames; // number of frames in an access unit
|
||||
|
||||
int preset_id; // preset of apv ( fastest, fast, medium, slow, placebo)
|
||||
|
||||
int qp; // quantization parameter (QP) [0,63]
|
||||
@@ -128,121 +130,6 @@ static inline int get_color_format(enum AVPixelFormat pix_fmt)
|
||||
return cf;
|
||||
}
|
||||
|
||||
static inline int get_chroma_format_idc(enum AVPixelFormat pix_fmt)
|
||||
{
|
||||
int cfi = -1;
|
||||
|
||||
switch (pix_fmt) {
|
||||
case AV_PIX_FMT_GRAY10:
|
||||
cfi = APV_CHROMA_FORMAT_400;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV422P10:
|
||||
case AV_PIX_FMT_YUV422P12:
|
||||
cfi = APV_CHROMA_FORMAT_422;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV444P10:
|
||||
case AV_PIX_FMT_YUV444P12:
|
||||
cfi = APV_CHROMA_FORMAT_444;
|
||||
break;
|
||||
case AV_PIX_FMT_YUVA444P10:
|
||||
case AV_PIX_FMT_YUVA444P12:
|
||||
cfi = APV_CHROMA_FORMAT_4444;
|
||||
break;
|
||||
default:
|
||||
av_assert0(cfi >= 0);
|
||||
}
|
||||
|
||||
return cfi;
|
||||
}
|
||||
|
||||
static inline int get_min_profile(enum AVPixelFormat pix_fmt)
|
||||
{
|
||||
int profile = AV_PROFILE_UNKNOWN;
|
||||
|
||||
switch (pix_fmt) {
|
||||
case AV_PIX_FMT_GRAY10:
|
||||
profile = AV_PROFILE_APV_400_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV422P10:
|
||||
profile = AV_PROFILE_APV_422_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV422P12:
|
||||
profile = AV_PROFILE_APV_422_12;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV444P10:
|
||||
profile = AV_PROFILE_APV_444_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV444P12:
|
||||
profile = AV_PROFILE_APV_444_12;
|
||||
break;
|
||||
case AV_PIX_FMT_YUVA444P10:
|
||||
profile = AV_PROFILE_APV_4444_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUVA444P12:
|
||||
profile = AV_PROFILE_APV_4444_12;
|
||||
break;
|
||||
default:
|
||||
av_assert0(profile != AV_PROFILE_UNKNOWN);
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
static int profile_is_compatible(enum AVPixelFormat pix_fmt, int profile)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
|
||||
const int chroma_format_idc = get_chroma_format_idc(pix_fmt);
|
||||
const int bit_depth = desc->comp[0].depth;
|
||||
|
||||
av_assert0(desc);
|
||||
|
||||
switch (profile) {
|
||||
case AV_PROFILE_APV_422_10:
|
||||
return chroma_format_idc == APV_CHROMA_FORMAT_422 && bit_depth == 10;
|
||||
case AV_PROFILE_APV_422_12:
|
||||
return chroma_format_idc == APV_CHROMA_FORMAT_422 &&
|
||||
bit_depth >= 10 && bit_depth <= 12;
|
||||
case AV_PROFILE_APV_444_10:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_444 &&
|
||||
bit_depth == 10;
|
||||
case AV_PROFILE_APV_444_12:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_444 &&
|
||||
bit_depth >= 10 && bit_depth <= 12;
|
||||
case AV_PROFILE_APV_4444_10:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_4444 &&
|
||||
bit_depth == 10;
|
||||
case AV_PROFILE_APV_4444_12:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_4444 &&
|
||||
bit_depth >= 10 && bit_depth <= 12;
|
||||
case AV_PROFILE_APV_400_10:
|
||||
return chroma_format_idc == APV_CHROMA_FORMAT_400 && bit_depth == 10;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int validate_profile(AVCodecContext *avctx, int profile)
|
||||
{
|
||||
const int minimum = get_min_profile(avctx->pix_fmt);
|
||||
const char *profile_name = av_get_profile_name(avctx->codec, profile);
|
||||
const char *minimum_name = av_get_profile_name(avctx->codec, minimum);
|
||||
|
||||
if (!profile_is_compatible(avctx->pix_fmt, profile)) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Profile %s (%d) is incompatible with pixel format %s; minimum compatible profile is %s (%d)\n",
|
||||
profile_name ? profile_name : "unknown", profile,
|
||||
av_get_pix_fmt_name(avctx->pix_fmt),
|
||||
minimum_name ? minimum_name : "unknown", minimum);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static oapv_imgb_t *apv_imgb_create(AVCodecContext *avctx)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
@@ -294,12 +181,22 @@ fail:
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the liboapv configuration from AVCodecContext and encoder options.
|
||||
* The function returns a pointer to the object of the oapve_cdesc_t type.
|
||||
* oapve_cdesc_t contains all encoder parameters that should be initialized before the encoder is used.
|
||||
*
|
||||
* AVCodecContext fields are applied first, followed by liboapv private options
|
||||
* and finally oapv-params. The APV profile defaults to the minimum profile
|
||||
* implied by pix_fmt, and later overrides must remain compatible with that
|
||||
* pixel format.
|
||||
* The field values of the oapve_cdesc_t structure are populated based on:
|
||||
* - the corresponding field values of the AvCodecConetxt structure,
|
||||
* - the apv encoder specific option values,
|
||||
*
|
||||
* The order of processing input data and populating the apve_cdsc structure
|
||||
* 1) first, the fields of the AVCodecContext structure corresponding to the provided input options are processed,
|
||||
* (i.e -pix_fmt yuv422p -s:v 1920x1080 -r 30 -profile:v 0)
|
||||
* 2) then apve-specific options added as AVOption to the apv AVCodec implementation
|
||||
* (i.e -preset 0)
|
||||
*
|
||||
* Keep in mind that, there are options that can be set in different ways.
|
||||
* In this case, please follow the above-mentioned order of processing.
|
||||
* The most recent assignments overwrite the previous values.
|
||||
*
|
||||
* @param[in] avctx codec context (AVCodecContext)
|
||||
* @param[out] cdsc contains all APV encoder encoder parameters that should be initialized before the encoder is use
|
||||
@@ -332,13 +229,6 @@ static int get_conf(AVCodecContext *avctx, oapve_cdesc_t *cdsc)
|
||||
cdsc->param[FRM_IDX].fps_den = avctx->time_base.num;
|
||||
}
|
||||
|
||||
cdsc->param[FRM_IDX].profile_idc = get_min_profile(avctx->pix_fmt);
|
||||
if (avctx->profile != AV_PROFILE_UNKNOWN) {
|
||||
ret = validate_profile(avctx, avctx->profile);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cdsc->param[FRM_IDX].profile_idc = avctx->profile;
|
||||
}
|
||||
cdsc->param[FRM_IDX].preset = apv->preset_id;
|
||||
cdsc->param[FRM_IDX].qp = apv->qp;
|
||||
if (avctx->bit_rate / 1000 > INT_MAX || avctx->rc_max_rate / 1000 > INT_MAX) {
|
||||
@@ -386,12 +276,6 @@ static int get_conf(AVCodecContext *avctx, oapve_cdesc_t *cdsc)
|
||||
av_log(avctx, AV_LOG_WARNING, "Error parsing option '%s = %s'.\n", en->key, en->value);
|
||||
}
|
||||
|
||||
ret = validate_profile(avctx, cdsc->param[FRM_IDX].profile_idc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
avctx->profile = cdsc->param[FRM_IDX].profile_idc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -543,7 +427,7 @@ static av_cold int liboapve_close(AVCodecContext *avctx)
|
||||
{
|
||||
ApvEncContext *apv = avctx->priv_data;
|
||||
|
||||
for (int i = 0; i < apv->ifrms.num_frms; i++) {
|
||||
for (int i = 0; i < apv->num_frames; i++) {
|
||||
if (apv->ifrms.frm[i].imgb != NULL)
|
||||
apv->ifrms.frm[i].imgb->release(apv->ifrms.frm[i].imgb);
|
||||
apv->ifrms.frm[i].imgb = NULL;
|
||||
|
||||
@@ -90,6 +90,8 @@ static int librsvg_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
goto end;
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_RGB32;
|
||||
viewport.width = dimensions.width;
|
||||
viewport.height = dimensions.height;
|
||||
|
||||
ret = ff_get_buffer(avctx, frame, 0);
|
||||
if (ret < 0)
|
||||
@@ -114,8 +116,6 @@ static int librsvg_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
cairo_restore(crender);
|
||||
|
||||
#if LIBRSVG_MAJOR_VERSION > 2 || LIBRSVG_MAJOR_VERSION == 2 && LIBRSVG_MINOR_VERSION >= 52
|
||||
viewport.width = dimensions.width;
|
||||
viewport.height = dimensions.height;
|
||||
gret = rsvg_handle_render_document(handle, crender, &viewport, &error);
|
||||
#else
|
||||
cairo_scale(crender, dimensions.width / (double)unscaled_dimensions.width,
|
||||
|
||||
@@ -238,11 +238,7 @@ 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);
|
||||
|
||||
@@ -53,7 +53,7 @@ typedef struct TheoraContext {
|
||||
int stats_offset;
|
||||
int uv_hshift;
|
||||
int uv_vshift;
|
||||
unsigned keyframe_mask;
|
||||
int keyframe_mask;
|
||||
int speed_level;
|
||||
} TheoraContext;
|
||||
|
||||
@@ -249,7 +249,7 @@ static av_cold int encode_init(AVCodecContext* avc_context)
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
h->keyframe_mask = (1U << av_ceil_log2(avc_context->gop_size)) - 1;
|
||||
h->keyframe_mask = (1 << av_ceil_log2(avc_context->gop_size)) - 1;
|
||||
/* Clear up theora_info struct */
|
||||
th_info_clear(&t_info);
|
||||
|
||||
|
||||
@@ -114,12 +114,6 @@ static av_cold int oggvorbis_decode_init(AVCodecContext *avccontext)
|
||||
}
|
||||
}
|
||||
|
||||
if (context->vi.rate <= 0 || context->vi.rate > INT_MAX) {
|
||||
av_log(avccontext, AV_LOG_ERROR, "vorbis rate is invalid\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
|
||||
av_channel_layout_uninit(&avccontext->ch_layout);
|
||||
avccontext->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
avccontext->ch_layout.nb_channels = context->vi.channels;
|
||||
|
||||
+7
-19
@@ -37,21 +37,7 @@
|
||||
#define LZF_LITERAL_MAX (1 << 5)
|
||||
#define LZF_LONG_BACKREF 7 + 2
|
||||
|
||||
|
||||
static inline int lzf_realloc(uint8_t **buf, size_t new_size, unsigned *allocated_size)
|
||||
{
|
||||
void *ptr = av_fast_realloc(*buf, allocated_size, new_size);
|
||||
|
||||
if (!ptr) {
|
||||
av_freep(buf); //probably not needed
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
*buf = ptr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, size_t *size, unsigned *allocated_size)
|
||||
int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size)
|
||||
{
|
||||
int ret = 0;
|
||||
uint8_t *p = *buf;
|
||||
@@ -62,8 +48,9 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, size_t *size, unsigned
|
||||
|
||||
if (s < LZF_LITERAL_MAX) {
|
||||
s++;
|
||||
if (s > *allocated_size - len) {
|
||||
ret = lzf_realloc(buf, len + s, allocated_size);
|
||||
if (s > *size - len) {
|
||||
*size += s + *size /2;
|
||||
ret = av_reallocp(buf, *size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
p = *buf + len;
|
||||
@@ -87,8 +74,9 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, size_t *size, unsigned
|
||||
if (off > len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (l > *allocated_size - len) {
|
||||
ret = lzf_realloc(buf, len + l, allocated_size);
|
||||
if (l > *size - len) {
|
||||
*size += l + *size / 2;
|
||||
ret = av_reallocp(buf, *size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
p = *buf + len;
|
||||
|
||||
+1
-1
@@ -24,6 +24,6 @@
|
||||
|
||||
#include "bytestream.h"
|
||||
|
||||
int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, size_t *size, unsigned *allocated_size);
|
||||
int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size);
|
||||
|
||||
#endif /* AVCODEC_LZF_H */
|
||||
|
||||
+6
-15
@@ -225,8 +225,7 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata,
|
||||
s->llviddsp.add_left_pred_int16(dst, dst, max, width, 0);
|
||||
dst += stride;
|
||||
}
|
||||
if (1 + interlaced < height)
|
||||
lefttop = left = dst[0];
|
||||
lefttop = left = dst[0];
|
||||
for (k = 1 + interlaced; k < height; k++) {
|
||||
magicyuv_median_pred16(dst, dst - fake_stride, dst, width, &left, &lefttop, max);
|
||||
lefttop = left = dst[0];
|
||||
@@ -349,8 +348,7 @@ static int magy_decode_slice(AVCodecContext *avctx, void *tdata,
|
||||
s->llviddsp.add_left_pred(dst, dst, width, 0);
|
||||
dst += stride;
|
||||
}
|
||||
if (1 + interlaced < height)
|
||||
lefttop = left = dst[0];
|
||||
lefttop = left = dst[0];
|
||||
for (k = 1 + interlaced; k < height; k++) {
|
||||
s->llviddsp.add_median_pred(dst, dst - fake_stride,
|
||||
dst, width, &left, &lefttop);
|
||||
@@ -554,13 +552,6 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
"invalid slice height: %d\n", s->slice_height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->vshift[1] && (s->slice_height & ((1 << s->vshift[1]) - 1))) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"slice_height %d is not aligned to chroma vertical "
|
||||
"subsampling (must be a multiple of %d)\n",
|
||||
s->slice_height, 1 << s->vshift[1]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
bytestream2_skipu(&gb, 4);
|
||||
|
||||
@@ -571,11 +562,11 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((s->slice_height >> s->vshift[1]) <= s->interlaced) {
|
||||
av_log(avctx, AV_LOG_ERROR, "impossible slice height\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->interlaced) {
|
||||
if ((s->slice_height >> s->vshift[1]) < 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "impossible slice height\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if ((avctx->coded_height % s->slice_height) && ((avctx->coded_height % s->slice_height) >> s->vshift[1]) < 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "impossible height\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -174,9 +174,6 @@ 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;
|
||||
|
||||
|
||||
@@ -385,12 +385,6 @@ static int mediacodec_wrap_sw_audio_buffer(AVCodecContext *avctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (info->size % (sample_size * avctx->ch_layout.nb_channels)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "input is not a multiple of channels * sample_size\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto done;
|
||||
}
|
||||
|
||||
frame->format = avctx->sample_fmt;
|
||||
frame->sample_rate = avctx->sample_rate;
|
||||
frame->nb_samples = info->size / (sample_size * avctx->ch_layout.nb_channels);
|
||||
|
||||
@@ -1356,9 +1356,6 @@ static int mf_close(AVCodecContext *avctx)
|
||||
if (c->async_events)
|
||||
IMFMediaEventGenerator_Release(c->async_events);
|
||||
|
||||
if (c->dxgiManager)
|
||||
IMFDXGIDeviceManager_Release(c->dxgiManager);
|
||||
|
||||
#if !HAVE_UWP
|
||||
if (c->library)
|
||||
ff_free_mf(&c->functions, &c->mft);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user