Merge pull request #731 from nyanmisaka/jellyfin-8.1.2

New upstream version 8.1.2
This commit is contained in:
Nyanmisaka
2026-07-01 05:01:39 +00:00
committed by GitHub
301 changed files with 2433 additions and 2071 deletions
+156
View File
@@ -1,6 +1,162 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version 8.1.2:
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
(fforge/pr/23505) avformat/tls_gnutls:fix crash when connecting to peer
libavcodec/jpeg2000htdec: remove trailing whitespace
libavdevice/alsa.c: fix NULL pointer dereference
avcodec/libjxlenc: check orientation tag metadata before reading
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
aacdec_usac_mps212: reject reserved freq_res value
avcodec/aac/aacdec_usac_mps212: Off-by-one bounds check in ff_aac_ec_data_deci()
Update for 8.1.2
avcodec/snowenc: fix out-of-bounds memcpy in get_block_rd() for narrow planes
avutil/eval: apply unary sign to print, squish, gauss and lerp
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
avcodec/sanm: reject codec37 frames taller than the allocated buffer
avcodec/sanm: reject codec47 frames taller than the allocated buffer
avfilter: use ff_slice_pos() for per-slice boundary computation
avfilter: add ff_slice_pos() helper for slice boundaries
(origin/release/8.1, fforge/release/8.1) 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
avformat/dashdec: Fail with any inner stream count being 0
avcodec/mjpegdec: require progress in AVRn interlaced field loop
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
avcodec/adpcm: require block_align to be a multiple of channels in ADPCM_PSXC init
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_usac: avoid signed overflow in decode_tsd
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
avcodec/bsf/dts2pts: fix binary tree invariant violation on selective dec_poc
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()
tests/checkasm/crc: retain offset values between calls
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
avformat/dashdec: bound manifest reloads and fragment-open retries
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/ogg: Fix overflow and stale oggvorbis_private values
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.
avformat/mpegts: Dont assume fc->priv_data is a MpegTSContext
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
(fforge/pr/23464) forgejo/workflows: update test workflow for 8.1 release
(fforge/pr/23445) aarch64: vp9lpf: Fix GCS violations
(fforge/pr/23303) 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/23240) avformat/oggparsevorbis.c: Prevent integer overflow when summing header lengths; add bounds check.
(fforge/pr/23187) avformat/oggparsecelt: bound extra_headers to avoid an effectively infinite loop
(fforge/pr/23111) 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
vulkan: fix using encode caps before querying
avformat/rtpdec_av1: fix buffer overflow due to variable confusion
version 8.1.1:
avcodec/aac/aacdec_usac_mps212: fix attach_lsb() OOB after huff_decode
avcodec/dfpwmdec: Check nb_samples
+1 -1
View File
@@ -1 +1 @@
8.1.1
8.1.2
+1 -1
View File
@@ -1 +1 @@
8.1.1
8.1.2
+1 -1
View File
@@ -1,7 +1,7 @@
---
# We just wrap `build` so this is really it
name: "jellyfin-ffmpeg"
version: "8.1.1-4"
version: "8.1.2-1"
packages:
- bullseye-amd64
- bullseye-arm64
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/openssl/openssl.git"
SCRIPT_COMMIT="openssl-3.6.2"
SCRIPT_COMMIT="openssl-3.6.3"
SCRIPT_TAGFILTER="openssl-3.6.*"
ffbuild_enabled() {
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/harfbuzz/harfbuzz.git"
SCRIPT_COMMIT="b0ffab42d473eb380ad0fcf42730e0f1868cbc97"
SCRIPT_COMMIT="56feae4035bdd48f62ba2b8d8c16232d4d89b3a4"
ffbuild_enabled() {
return 0
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/KhronosGroup/Vulkan-Headers.git"
SCRIPT_COMMIT="v1.4.349"
SCRIPT_COMMIT="v1.4.355"
SCRIPT_TAGFILTER="v?.*.*"
ffbuild_enabled() {
@@ -4,7 +4,7 @@ SCRIPT_REPO="https://github.com/BtbN/Vulkan-Shim-Loader.git"
SCRIPT_COMMIT="65b3936528cd92eb4ea3de485d03f858a3850484"
SCRIPT_REPO2="https://github.com/KhronosGroup/Vulkan-Headers.git"
SCRIPT_COMMIT2="v1.4.349"
SCRIPT_COMMIT2="v1.4.355"
SCRIPT_TAGFILTER2="v?.*.*"
ffbuild_enabled() {
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/google/shaderc.git"
SCRIPT_COMMIT="301b4ede53d59b68bf55f95bb26412d9233c8187"
SCRIPT_COMMIT="d5f08ae5c5a9a45165578445cbd0f9adf0223448"
ffbuild_enabled() {
[[ $TARGET == mac* ]] && return -1
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/KhronosGroup/SPIRV-Cross.git"
SCRIPT_COMMIT="b9ded926bd2ec460b8d60d5c9678808bf8cbdd9b"
SCRIPT_COMMIT="1a6169566c73d3da552748fc372fe2bbb856e46e"
ffbuild_enabled() {
[[ $TARGET == mac* ]] && return -1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git"
SCRIPT_COMMIT="d0b3e6dd544a5f207bb6a12a1ecb98532491176a"
SCRIPT_COMMIT="eadd00804d5f7e5cd8c85d540073198312870776"
ffbuild_enabled() {
[[ $TARGET == mac* ]] && return -1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/libass/libass.git"
SCRIPT_COMMIT="bbb3c7f1570a4a021e52683f3fbdf74fe492ae84"
SCRIPT_COMMIT="4a05d8127f525943ebf45fdc6497c9e665947f0d"
ffbuild_enabled() {
return 0
+2 -2
View File
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/intel/libvpl.git"
SCRIPT_COMMIT="778a66d6c6537f08eabb91955dbbf1bce3812894"
SCRIPT_COMMIT="d77f9195cf495b937631607333288fd917ae8939"
ffbuild_enabled() {
[[ $TARGET == mac* ]] && return -1
@@ -17,7 +17,7 @@ ffbuild_dockerbuild() {
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \
-DCMAKE_INSTALL_BINDIR="$FFBUILD_PREFIX"/bin -DCMAKE_INSTALL_LIBDIR="$FFBUILD_PREFIX"/lib \
-DINSTALL_DEV=ON -DINSTALL_LIB=ON \
-DINSTALL_DEV=ON -DINSTALL_LIB=ON -DINSTALL_EXAMPLES=OFF \
-DBUILD_EXAMPLES=OFF -DBUILD_EXPERIMENTAL=OFF \
-DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF ..
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/OpenMPT/openmpt.git"
SCRIPT_COMMIT="a2b251c67ca757bb181a0cd4cc97e9e94bfe2608"
SCRIPT_COMMIT="11363ff11ba021b1cf1533da17d9fdf20c8d883c"
ffbuild_enabled() {
return 0
+9
View File
@@ -1,3 +1,12 @@
jellyfin-ffmpeg (8.1.2-1) unstable; urgency=medium
* New upstream version 8.1.2
* Fix a conflict between VPP tonemap and specific scaling mode
* Fix typos in some shader based deint filters
* Update build scripts and dependencies
-- nyanmisaka <nst799610810@gmail.com> Sun, 28 Jun 2026 17:07:36 +0800
jellyfin-ffmpeg (8.1.1-4) unstable; urgency=medium
* Fix broken macro place for scale_vt patch
@@ -2324,7 +2324,7 @@ Index: FFmpeg/libavfilter/vf_tonemap_opencl.c
+
+ if (max_compute_units >= 40)
+ ctx->tradeoff = 0;
+ else if (device_name) {
+ else if (device_name) {
+ const char *excluded_devices[5] = { "Arc", "Iris", "Xe", "770", "750" };
+ for (i = 0; i < FF_ARRAY_ELEMS(excluded_devices); i++) {
+ if (strstr(device_name, excluded_devices[i])) {
+11 -6
View File
@@ -241,7 +241,7 @@ Index: FFmpeg/libavfilter/vf_vpp_qsv.c
outvsi_conf.ColourDescriptionPresent = 1;
if (memcmp(&vpp->invsi_conf, &invsi_conf, sizeof(mfxExtVideoSignalInfo)) ||
@@ -689,12 +718,23 @@ static int config_output(AVFilterLink *o
@@ -689,12 +718,28 @@ static int config_output(AVFilterLink *o
if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) {
if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
@@ -256,10 +256,15 @@ Index: FFmpeg/libavfilter/vf_vpp_qsv.c
-#endif
+ /* Compute mode is only available on DG2+ platforms */
+ if (vpl && get_mfx_platform(ctx, &mfx_platform) == MFX_ERR_NONE) {
+ const AVPixFmtDescriptor *in_desc = av_pix_fmt_desc_get(in_format);
+ int code_name = mfx_platform.CodeName;
+ compute = code_name >= 45 &&
+ code_name <= 54 &&
+ code_name != 50;
+ /* When used with tonemap, only 4:2:0 chroma is supported */
+ if (vpp->tonemap && in_desc &&
+ !(in_desc->log2_chroma_w && in_desc->log2_chroma_h))
+ compute = 0;
+ }
+
+ if (mode == -1)
@@ -269,7 +274,7 @@ Index: FFmpeg/libavfilter/vf_vpp_qsv.c
INIT_MFX_EXTBUF(scale_conf, MFX_EXTBUFF_VPP_SCALING);
SET_MFX_PARAM_FIELD(scale_conf, ScalingMode, mode);
@@ -706,6 +746,13 @@ static int config_output(AVFilterLink *o
@@ -706,6 +751,13 @@ static int config_output(AVFilterLink *o
#undef INIT_MFX_EXTBUF
#undef SET_MFX_PARAM_FIELD
@@ -283,7 +288,7 @@ Index: FFmpeg/libavfilter/vf_vpp_qsv.c
if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format ||
@@ -884,19 +931,13 @@ static const AVOption vpp_options[] = {
@@ -884,19 +936,13 @@ static const AVOption vpp_options[] = {
{ "height", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
{ "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
{ "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = 4 }, 0, INT_MAX, .flags = FLAGS },
@@ -304,7 +309,7 @@ Index: FFmpeg/libavfilter/vf_vpp_qsv.c
{ "rate", "Generate output at frame rate or field rate, available only for deinterlace mode",
OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, .unit = "rate" },
@@ -927,8 +968,9 @@ static const AVOption vpp_options[] = {
@@ -927,8 +973,9 @@ static const AVOption vpp_options[] = {
{ "out_color_transfer", "Output color transfer characteristics",
OFFSET(color_transfer_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = FLAGS },
@@ -315,7 +320,7 @@ Index: FFmpeg/libavfilter/vf_vpp_qsv.c
{ NULL }
};
@@ -984,19 +1026,14 @@ static const AVOption qsvscale_options[]
@@ -984,19 +1031,14 @@ static const AVOption qsvscale_options[]
{ "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
{ "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
@@ -337,7 +342,7 @@ Index: FFmpeg/libavfilter/vf_vpp_qsv.c
{ NULL },
};
@@ -1021,6 +1058,7 @@ static const AVOption qsvdeint_options[]
@@ -1021,6 +1063,7 @@ static const AVOption qsvdeint_options[]
{ "bob", "bob algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_BOB}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
{ "advanced", "Motion adaptive algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, .unit = "mode"},
@@ -2,10 +2,11 @@ Index: FFmpeg/libavcodec/dxva2.c
===================================================================
--- FFmpeg.orig/libavcodec/dxva2.c
+++ FFmpeg/libavcodec/dxva2.c
@@ -616,6 +616,16 @@ int ff_dxva2_common_frame_params(AVCodec
@@ -616,6 +616,18 @@ int ff_dxva2_common_frame_params(AVCodec
else
surface_alignment = 16;
+#if CONFIG_D3D11VA
+ /* align surfaces to 32 on Intel to keep in line with the MSDK impl,
+ which avoids the unnecessary resizing when mapping to QSV */
+ if (device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) {
@@ -15,11 +16,12 @@ Index: FFmpeg/libavcodec/dxva2.c
+ surface_alignment = 32;
+ }
+ }
+#endif
+
/* 1 base work surface */
num_surfaces = 1;
@@ -623,9 +633,9 @@ int ff_dxva2_common_frame_params(AVCodec
@@ -623,9 +635,9 @@ int ff_dxva2_common_frame_params(AVCodec
if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC)
num_surfaces += 16;
else if (avctx->codec_id == AV_CODEC_ID_VP9 || avctx->codec_id == AV_CODEC_ID_AV1)
+44 -10
View File
@@ -2,7 +2,7 @@ Index: FFmpeg/configure
===================================================================
--- FFmpeg.orig/configure
+++ FFmpeg/configure
@@ -4120,6 +4120,7 @@ boxblur_opencl_filter_deps="opencl gpl"
@@ -4123,6 +4123,7 @@ boxblur_opencl_filter_deps="opencl gpl"
bs2b_filter_deps="libbs2b"
bwdif_cuda_filter_deps="ffnvcodec"
bwdif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
@@ -155,7 +155,7 @@ Index: FFmpeg/libavfilter/metal/vf_bwdif_videotoolbox.metal
+ if (abs(c - e) > temporal_diff0) {
+ interpol = (((coef_hf[0] * (prev2_0 + next2_0)
+ - coef_hf[1] * (prev2_mrefs2 + next2_mrefs2 + prev2_prefs2 + next2_prefs2)
+ + coef_hf[2] * (prev2_mrefs4 + next2_mrefs4 + prev2_prefs4 + next2_mrefs4)) / 4)
+ + coef_hf[2] * (prev2_mrefs4 + next2_mrefs4 + prev2_prefs4 + next2_prefs4)) / 4)
+ + coef_lf[0] * (c + e) - coef_lf[1] * (cur_mrefs3 + cur_prefs3)) / (1 << 13);
+ } else {
+ interpol = (coef_sp[0] * (c + e) - coef_sp[1] * (cur_mrefs3 + cur_prefs3)) / (1 << 13);
@@ -196,10 +196,10 @@ Index: FFmpeg/libavfilter/metal/vf_bwdif_videotoolbox.metal
+ }
+
+ // Calculate temporal prediction
+ texture2d<float, accesstype> prev2 = prev;
+ texture2d<float, accesstype> prev1 = is_second_field ? cur : prev;
+ texture2d<float, accesstype> next1 = is_second_field ? next : cur;
+ texture2d<float, accesstype> next2 = next;
+ texture2d<float, accesstype> prev2 = is_second_field ? cur : prev;
+ texture2d<float, accesstype> prev1 = prev;
+ texture2d<float, accesstype> next1 = next;
+ texture2d<float, accesstype> next2 = is_second_field ? next : cur;
+
+ T prev2_prefs4 = tex2D<T>(prev2, pos.x, pos.y+ 4);
+ T prev2_prefs2 = tex2D<T>(prev2, pos.x, pos.y + 2);
@@ -249,10 +249,10 @@ Index: FFmpeg/libavfilter/metal/vf_bwdif_videotoolbox.metal
+ }
+
+ // Calculate temporal prediction
+ texture2d<float, accesstype> prev2 = prev;
+ texture2d<float, accesstype> prev1 = is_second_field ? cur : prev;
+ texture2d<float, accesstype> next1 = is_second_field ? next : cur;
+ texture2d<float, accesstype> next2 = next;
+ texture2d<float, accesstype> prev2 = is_second_field ? cur : prev;
+ texture2d<float, accesstype> prev1 = prev;
+ texture2d<float, accesstype> next1 = next;
+ texture2d<float, accesstype> next2 = is_second_field ? next : cur;
+
+ T prev2_prefs4 = tex2D<T>(prev2, pos.x, pos.y+ 4);
+ T prev2_prefs2 = tex2D<T>(prev2, pos.x, pos.y + 2);
@@ -312,6 +312,40 @@ Index: FFmpeg/libavfilter/metal/vf_bwdif_videotoolbox.metal
+ }
+ dst.write(pred.xyyy, pos);
+}
Index: FFmpeg/libavfilter/metal/vf_yadif_videotoolbox.metal
===================================================================
--- FFmpeg.orig/libavfilter/metal/vf_yadif_videotoolbox.metal
+++ FFmpeg/libavfilter/metal/vf_yadif_videotoolbox.metal
@@ -88,7 +88,7 @@ T spatial_predictor(T a, T b, T c, T d,
T h, T i, T j, T k, T l, T m, T n)
{
T spatial_pred = (d + k)/2;
- T spatial_score = abs(c - j) + abs(d - k) + abs(e - l);
+ T spatial_score = abs(c - j) + abs(d - k) + abs(e - l) - (1.0f / 255.0f);
T score = abs(b - k) + abs(c - l) + abs(d - m);
if (score < spatial_score) {
@@ -128,7 +128,7 @@ T temporal_predictor(T A, T B, T C, T D,
T tdiff1 = (abs(A - F) + abs(B - G)) / 2;
T tdiff2 = (abs(K - F) + abs(G - L)) / 2;
- T diff = max3(tdiff0, tdiff1, tdiff2);
+ T diff = max3(tdiff0 / 2, tdiff1, tdiff2);
if (!skip_check) {
T maxi = max3(p2 - p3, p2 - p1, min(p0 - p1, p4 - p3));
@@ -239,9 +239,9 @@ T yadif(
T spatial_pred = yadif_compute_spatial<T>(cur, pos);
if (params.is_second_field) {
- return yadif_compute_temporal(cur, prev, cur, next, next, spatial_pred, params.skip_spatial_check, pos);
+ return yadif_compute_temporal(cur, cur, prev, next, next, spatial_pred, params.skip_spatial_check, pos);
} else {
- return yadif_compute_temporal(cur, prev, prev, cur, next, spatial_pred, params.skip_spatial_check, pos);
+ return yadif_compute_temporal(cur, prev, prev, next, cur, spatial_pred, params.skip_spatial_check, pos);
}
}
Index: FFmpeg/libavfilter/vf_bwdif_videotoolbox.m
===================================================================
--- /dev/null
@@ -2,7 +2,7 @@ Index: FFmpeg/configure
===================================================================
--- FFmpeg.orig/configure
+++ FFmpeg/configure
@@ -4121,6 +4121,7 @@ boxblur_opencl_filter_deps="opencl gpl"
@@ -4124,6 +4124,7 @@ boxblur_opencl_filter_deps="opencl gpl"
bs2b_filter_deps="libbs2b"
bwdif_cuda_filter_deps="ffnvcodec"
bwdif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
@@ -10,7 +10,7 @@ Index: FFmpeg/configure
bwdif_videotoolbox_filter_deps="metal corevideo videotoolbox"
bwdif_vulkan_filter_deps="vulkan spirv_compiler"
chromaber_vulkan_filter_deps="vulkan spirv_library"
@@ -4280,6 +4281,7 @@ xfade_opencl_filter_deps="opencl"
@@ -4283,6 +4284,7 @@ xfade_opencl_filter_deps="opencl"
xfade_vulkan_filter_deps="vulkan spirv_library"
yadif_cuda_filter_deps="ffnvcodec"
yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
@@ -52,7 +52,7 @@ Index: FFmpeg/libavfilter/allfilters.c
extern const FFFilter ff_vf_bwdif_videotoolbox;
extern const FFFilter ff_vf_bwdif_vulkan;
extern const FFFilter ff_vf_cas;
@@ -562,6 +563,7 @@ extern const FFFilter ff_vf_xpsnr;
@@ -563,6 +564,7 @@ extern const FFFilter ff_vf_xpsnr;
extern const FFFilter ff_vf_xstack;
extern const FFFilter ff_vf_yadif;
extern const FFFilter ff_vf_yadif_cuda;
@@ -228,7 +228,7 @@ Index: FFmpeg/libavfilter/opencl/bwdif.cl
+ if (fabs(c - e) > temporal_diff0) {
+ interpol = native_divide((((coef_hf[0] * (prev2_0 + next2_0)
+ - coef_hf[1] * (prev2_mrefs2 + next2_mrefs2 + prev2_prefs2 + next2_prefs2)
+ + coef_hf[2] * (prev2_mrefs4 + next2_mrefs4 + prev2_prefs4 + next2_mrefs4)) * 0.25f)
+ + coef_hf[2] * (prev2_mrefs4 + next2_mrefs4 + prev2_prefs4 + next2_prefs4)) * 0.25f)
+ + coef_lf[0] * (c + e) - coef_lf[1] * (cur_mrefs3 + cur_prefs3)), (float)(1 << 13));
+ } else {
+ interpol = native_divide((coef_sp[0] * (c + e) - coef_sp[1] * (cur_mrefs3 + cur_prefs3)), (float)(1 << 13));
@@ -322,17 +322,17 @@ Index: FFmpeg/libavfilter/opencl/bwdif.cl
+
+ if (channels == 1) {
+ float pred = is_second_field
+ ? bwdif_compute_float(dst, cur, prev, cur, next, next,
+ ? bwdif_compute_float(dst, cur, cur, prev, next, next,
+ parity, is_field_end, pos)
+ : bwdif_compute_float(dst, cur, prev, prev, cur, next,
+ : bwdif_compute_float(dst, cur, prev, prev, next, cur,
+ parity, is_field_end, pos);
+
+ write_imagef(dst, pos, (float4)(pred, 0.0f, 0.0f, 1.0f));
+ } else if (channels == 2) {
+ float2 pred = is_second_field
+ ? bwdif_compute_float2(dst, cur, prev, cur, next, next,
+ ? bwdif_compute_float2(dst, cur, cur, prev, next, next,
+ parity, is_field_end, pos)
+ : bwdif_compute_float2(dst, cur, prev, prev, cur, next,
+ : bwdif_compute_float2(dst, cur, prev, prev, next, cur,
+ parity, is_field_end, pos);
+
+ write_imagef(dst, pos, (float4)(pred.x, pred.y, 0.0f, 1.0f));
@@ -375,7 +375,7 @@ Index: FFmpeg/libavfilter/opencl/yadif.cl
+ float h, float i, float j, float k, float l, float m, float n)
+{
+ float spatial_pred = (d + k) * 0.5f;
+ float spatial_score = fabs(c - j) + fabs(d - k) + fabs(e - l);
+ float spatial_score = fabs(c - j) + fabs(d - k) + fabs(e - l) - (1.0f / 255.0f);
+
+ float score = fabs(b - k) + fabs(c - l) + fabs(d - m);
+ if (score < spatial_score) {
@@ -424,7 +424,7 @@ Index: FFmpeg/libavfilter/opencl/yadif.cl
+ float tdiff1 = (fabs(A - F) + fabs(B - G)) * 0.5f;
+ float tdiff2 = (fabs(K - F) + fabs(G - L)) * 0.5f;
+
+ float diff = max3(tdiff0, tdiff1, tdiff2);
+ float diff = max3(tdiff0 * 0.5f, tdiff1, tdiff2);
+
+ if (!skip_check) {
+ float maxi = max3(p2 - p3, p2 - p1, min(p0 - p1, p4 - p3));
@@ -523,18 +523,18 @@ Index: FFmpeg/libavfilter/opencl/yadif.cl
+ if (channels == 1) {
+ float spatial_pred = yadif_compute_spatial_float(cur, pos);
+ float pred = is_second_field
+ ? yadif_compute_temporal_float(cur, prev, cur, next, next,
+ ? yadif_compute_temporal_float(cur, cur, prev, next, next,
+ spatial_pred, skip_spatial_check, pos)
+ : yadif_compute_temporal_float(cur, prev, prev, cur, next,
+ : yadif_compute_temporal_float(cur, prev, prev, next, cur,
+ spatial_pred, skip_spatial_check, pos);
+
+ write_imagef(dst, pos, (float4)(pred, 0.0f, 0.0f, 1.0f));
+ } else if (channels == 2) {
+ float2 spatial_pred = yadif_compute_spatial_float2(cur, pos);
+ float2 pred = is_second_field
+ ? yadif_compute_temporal_float2(cur, prev, cur, next, next,
+ ? yadif_compute_temporal_float2(cur, cur, prev, next, next,
+ spatial_pred, skip_spatial_check, pos)
+ : yadif_compute_temporal_float2(cur, prev, prev, cur, next,
+ : yadif_compute_temporal_float2(cur, prev, prev, next, cur,
+ spatial_pred, skip_spatial_check, pos);
+
+ write_imagef(dst, pos, (float4)(pred.x, pred.y, 0.0f, 1.0f));
@@ -1,22 +0,0 @@
Index: FFmpeg/fftools/ffmpeg_demux.c
===================================================================
--- FFmpeg.orig/fftools/ffmpeg_demux.c
+++ FFmpeg/fftools/ffmpeg_demux.c
@@ -534,7 +534,7 @@ static void readrate_sleep(Demuxer *d)
ds->lag = lag;
ds->resume_wc = now;
ds->resume_pts = pts;
- av_log_once(ds, AV_LOG_WARNING, AV_LOG_DEBUG, &resume_warn,
+ av_log_once(ds, AV_LOG_VERBOSE, 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);
}
@@ -2152,7 +2152,7 @@ int ifile_open(const OptionsContext *o,
d->readrate_initial_burst);
return AVERROR(EINVAL);
}
- d->readrate_catchup = o->readrate_catchup ? o->readrate_catchup : d->readrate * 1.05;
+ d->readrate_catchup = o->readrate_catchup ? o->readrate_catchup : d->readrate * 100;
if (d->readrate_catchup < d->readrate) {
av_log(d, AV_LOG_ERROR,
"Option -readrate_catchup is %0.3f; it must be at least equal to %0.3f.\n",
@@ -0,0 +1,116 @@
Index: FFmpeg/fftools/ffmpeg_demux.c
===================================================================
--- FFmpeg.orig/fftools/ffmpeg_demux.c
+++ FFmpeg/fftools/ffmpeg_demux.c
@@ -96,12 +96,6 @@ 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 DemuxStreamGroup {
@@ -144,6 +138,13 @@ 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;
@@ -514,43 +515,55 @@ 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, now, wc_elapsed, elapsed, lag, max_pts, limit_pts;
-
- if (ds->discard) continue;
+ int64_t stream_ts_offset, pts, pts_diff;
+ if (ds->discard || ds->finished || ds->first_dts == AV_NOPTS_VALUE)
+ continue;
- stream_ts_offset = FFMAX(ds->first_dts != AV_NOPTS_VALUE ? ds->first_dts : 0, file_start);
+ stream_ts_offset = FFMAX(ds->first_dts, file_start);
pts = av_rescale(ds->dts, 1000000, AV_TIME_BASE);
- now = av_gettime_relative();
- wc_elapsed = now - d->wallclock_start;
-
- if (pts <= stream_ts_offset + initial_burst) continue;
-
- max_pts = stream_ts_offset + initial_burst + (int64_t)(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 + (int64_t)(elapsed * d->readrate_catchup);
- } else {
- elapsed = wc_elapsed;
- limit_pts = max_pts;
+ pts_diff = pts - stream_ts_offset;
+ if (pts_diff < progress) {
+ progress = pts_diff;
+ slowest = ds;
}
+ }
- 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_VERBOSE, 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,
@@ -83,19 +83,7 @@ Index: FFmpeg/libavcodec/nvenc.c
===================================================================
--- FFmpeg.orig/libavcodec/nvenc.c
+++ FFmpeg/libavcodec/nvenc.c
@@ -266,8 +266,10 @@ static void nvenc_map_preset(NvencContex
static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level)
{
-#if NVENCAPI_CHECK_VERSION(13, 1)
+#if NVENCAPI_CHECK_VERSION(13, 2)
const char *minver = "(unknown)";
+#elif NVENCAPI_CHECK_VERSION(13, 1)
+ const char *minver = "610.00";
#elif NVENCAPI_CHECK_VERSION(13, 0)
const char *minver = "570.0";
#elif NVENCAPI_CHECK_VERSION(12, 2)
@@ -592,12 +594,24 @@ static int nvenc_check_capabilities(AVCo
@@ -594,12 +594,24 @@ static int nvenc_check_capabilities(AVCo
#ifdef NVENC_HAVE_BFRAME_REF_MODE
tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED;
ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
@@ -126,7 +114,7 @@ Index: FFmpeg/libavcodec/nvenc.c
}
#else
tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0;
@@ -683,7 +697,9 @@ static int nvenc_check_capabilities(AVCo
@@ -685,7 +697,9 @@ static int nvenc_check_capabilities(AVCo
#ifdef NVENC_HAVE_MVHEVC
ctx->multiview_supported = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_MVHEVC_ENCODE) > 0;
@@ -137,7 +125,7 @@ Index: FFmpeg/libavcodec/nvenc.c
av_log(avctx, AV_LOG_WARNING, "Multiview not supported by the device\n");
return AVERROR(ENOSYS);
}
@@ -1163,6 +1179,13 @@ static av_cold int nvenc_setup_rate_cont
@@ -1165,6 +1179,13 @@ static av_cold int nvenc_setup_rate_cont
#ifdef NVENC_HAVE_QP_CHROMA_OFFSETS
ctx->encode_config.rcParams.cbQPIndexOffset = ctx->qp_cb_offset;
ctx->encode_config.rcParams.crQPIndexOffset = ctx->qp_cr_offset;
@@ -151,7 +139,7 @@ Index: FFmpeg/libavcodec/nvenc.c
#else
if (ctx->qp_cb_offset || ctx->qp_cr_offset)
av_log(avctx, AV_LOG_WARNING, "Failed setting QP CB/CR offsets, SDK 11.1 or greater required at compile time.\n");
@@ -1359,6 +1382,11 @@ static av_cold int nvenc_setup_h264_conf
@@ -1361,6 +1382,11 @@ static av_cold int nvenc_setup_h264_conf
case NV_ENC_H264_PROFILE_BASELINE:
cc->profileGUID = NV_ENC_H264_PROFILE_BASELINE_GUID;
avctx->profile = AV_PROFILE_H264_BASELINE;
@@ -163,35 +151,49 @@ Index: FFmpeg/libavcodec/nvenc.c
break;
case NV_ENC_H264_PROFILE_MAIN:
cc->profileGUID = NV_ENC_H264_PROFILE_MAIN_GUID;
@@ -2529,7 +2557,12 @@ static void nvenc_fill_time_code(AVCodec
unsigned hh, mm, ss, ff, drop;
ff_timecode_set_smpte(&drop, &hh, &mm, &ss, &ff, avctx->framerate, tc[i + 1], 0, 0);
+#ifdef NVENC_NEW_COUNTING_TYPE
+ time_code->clockTimestamp[i].countingTypeLSB = 0;
+ time_code->clockTimestamp[i].countingTypeMSB = 0;
+#else
time_code->clockTimestamp[i].countingType = 0;
+#endif
time_code->clockTimestamp[i].discontinuityFlag = 0;
time_code->clockTimestamp[i].cntDroppedFrames = drop;
time_code->clockTimestamp[i].nFrames = ff;
Index: FFmpeg/libavcodec/nvenc.h
Index: FFmpeg/libavfilter/vf_bwdif_cuda.cu
===================================================================
--- FFmpeg.orig/libavcodec/nvenc.h
+++ FFmpeg/libavcodec/nvenc.h
@@ -111,6 +111,11 @@ typedef void ID3D11Device;
#define NVENC_HAVE_MVHEVC
#endif
--- FFmpeg.orig/libavfilter/vf_bwdif_cuda.cu
+++ FFmpeg/libavfilter/vf_bwdif_cuda.cu
@@ -91,7 +91,7 @@ __inline__ __device__ T filter(T cur_pre
if (abs(c - e) > temporal_diff0) {
interpol = (((coef_hf[0] * (prev2_0 + next2_0)
- coef_hf[1] * (prev2_mrefs2 + next2_mrefs2 + prev2_prefs2 + next2_prefs2)
- + coef_hf[2] * (prev2_mrefs4 + next2_mrefs4 + prev2_prefs4 + next2_mrefs4)) >> 2)
+ + coef_hf[2] * (prev2_mrefs4 + next2_mrefs4 + prev2_prefs4 + next2_prefs4)) >> 2)
+ coef_lf[0] * (c + e) - coef_lf[1] * (cur_mrefs3 + cur_prefs3)) >> 13;
} else {
interpol = (coef_sp[0] * (c + e) - coef_sp[1] * (cur_mrefs3 + cur_prefs3)) >> 13;
@@ -146,10 +146,10 @@ __inline__ __device__ void bwdif_single(
// Calculate temporal prediction
int is_second_field = !(parity ^ tff);
+// SDK 13.1 compile time feature checks
+#if NVENCAPI_CHECK_VERSION(13, 1)
+#define NVENC_NEW_COUNTING_TYPE
+#endif
+
typedef struct NvencSurface
{
NV_ENC_INPUT_PTR input_surface;
- cudaTextureObject_t prev2 = prev;
- cudaTextureObject_t prev1 = is_second_field ? cur : prev;
- cudaTextureObject_t next1 = is_second_field ? next : cur;
- cudaTextureObject_t next2 = next;
+ cudaTextureObject_t prev2 = is_second_field ? cur : prev;
+ cudaTextureObject_t prev1 = prev;
+ cudaTextureObject_t next1 = next;
+ cudaTextureObject_t next2 = is_second_field ? next : cur;
T prev2_prefs4 = tex2D<T>(prev2, xo, yo + 4);
T prev2_prefs2 = tex2D<T>(prev2, xo, yo + 2);
@@ -213,10 +213,10 @@ __inline__ __device__ void bwdif_double(
int is_second_field = !(parity ^ tff);
- cudaTextureObject_t prev2 = prev;
- cudaTextureObject_t prev1 = is_second_field ? cur : prev;
- cudaTextureObject_t next1 = is_second_field ? next : cur;
- cudaTextureObject_t next2 = next;
+ cudaTextureObject_t prev2 = is_second_field ? cur : prev;
+ cudaTextureObject_t prev1 = prev;
+ cudaTextureObject_t next1 = next;
+ cudaTextureObject_t next2 = is_second_field ? next : cur;
T prev2_prefs4 = tex2D<T>(prev2, xo, yo + 4);
T prev2_prefs2 = tex2D<T>(prev2, xo, yo + 2);
Index: FFmpeg/libavfilter/vf_scale_cuda.h
===================================================================
--- FFmpeg.orig/libavfilter/vf_scale_cuda.h
@@ -207,3 +209,87 @@ Index: FFmpeg/libavfilter/vf_scale_cuda.h
#else
#include <ffnvcodec/dynlink_cuda.h>
#endif
Index: FFmpeg/libavfilter/vf_yadif_cuda.cu
===================================================================
--- FFmpeg.orig/libavfilter/vf_yadif_cuda.cu
+++ FFmpeg/libavfilter/vf_yadif_cuda.cu
@@ -23,7 +23,7 @@ __inline__ __device__ T spatial_predicto
T h, T i, T j, T k, T l, T m, T n)
{
int spatial_pred = (d + k)/2;
- int spatial_score = abs(c - j) + abs(d - k) + abs(e - l);
+ int spatial_score = abs(c - j) + abs(d - k) + abs(e - l) - 1;
int score = abs(b - k) + abs(c - l) + abs(d - m);
if (score < spatial_score) {
@@ -75,7 +75,7 @@ __inline__ __device__ T temporal_predict
int tdiff1 = (abs(A - F) + abs(B - G)) / 2;
int tdiff2 = (abs(K - F) + abs(G - L)) / 2;
- int diff = max3(tdiff0, tdiff1, tdiff2);
+ int diff = max3(tdiff0 >> 1, tdiff1, tdiff2);
if (!skip_check) {
int maxi = max3(p2 - p3, p2 - p1, min(p0 - p1, p4 - p3));
@@ -85,8 +85,7 @@ __inline__ __device__ T temporal_predict
if (spatial_pred > p2 + diff) {
spatial_pred = p2 + diff;
- }
- if (spatial_pred < p2 - diff) {
+ } else if (spatial_pred < p2 - diff) {
spatial_pred = p2 - diff;
}
@@ -139,10 +138,10 @@ __inline__ __device__ void yadif_single(
// Calculate temporal prediction
int is_second_field = !(parity ^ tff);
- cudaTextureObject_t prev2 = prev;
- cudaTextureObject_t prev1 = is_second_field ? cur : prev;
- cudaTextureObject_t next1 = is_second_field ? next : cur;
- cudaTextureObject_t next2 = next;
+ cudaTextureObject_t prev2 = is_second_field ? cur : prev;
+ cudaTextureObject_t prev1 = prev;
+ cudaTextureObject_t next1 = next;
+ cudaTextureObject_t next2 = is_second_field ? next : cur;
T A = tex2D<T>(prev2, xo, yo - 1);
T B = tex2D<T>(prev2, xo, yo + 1);
@@ -210,10 +209,10 @@ __inline__ __device__ void yadif_double(
// Calculate temporal prediction
int is_second_field = !(parity ^ tff);
- cudaTextureObject_t prev2 = prev;
- cudaTextureObject_t prev1 = is_second_field ? cur : prev;
- cudaTextureObject_t next1 = is_second_field ? next : cur;
- cudaTextureObject_t next2 = next;
+ cudaTextureObject_t prev2 = is_second_field ? cur : prev;
+ cudaTextureObject_t prev1 = prev;
+ cudaTextureObject_t next1 = next;
+ cudaTextureObject_t next2 = is_second_field ? next : cur;
T A = tex2D<T>(prev2, xo, yo - 1);
T B = tex2D<T>(prev2, xo, yo + 1);
Index: FFmpeg/libavutil/hwcontext_cuda.c
===================================================================
--- FFmpeg.orig/libavutil/hwcontext_cuda.c
+++ FFmpeg/libavutil/hwcontext_cuda.c
@@ -207,7 +207,7 @@ static int cuda_get_buffer(AVHWFramesCon
if (ctx->sw_format == AV_PIX_FMT_YUV420P) {
frame->linesize[1] = frame->linesize[2] = frame->linesize[0] / 2;
frame->data[2] = frame->data[1];
- frame->data[1] = frame->data[2] + frame->linesize[2] * (ctx->height / 2);
+ frame->data[1] = frame->data[2] + frame->linesize[2] * AV_CEIL_RSHIFT(ctx->height, 1);
}
frame->format = AV_PIX_FMT_CUDA;
@@ -259,7 +259,7 @@ static int cuda_transfer_data(AVHWFrames
.srcPitch = src->linesize[i],
.dstPitch = dst->linesize[i],
.WidthInBytes = FFMIN(src->linesize[i], dst->linesize[i]),
- .Height = src->height >> ((i == 0 || i == 3) ? 0 : priv->shift_height),
+ .Height = AV_CEIL_RSHIFT(src->height, ((i == 0 || i == 3) ? 0 : priv->shift_height)),
};
if (src->hw_frames_ctx) {
@@ -1,44 +0,0 @@
Index: FFmpeg/libavcodec/magicyuv.c
===================================================================
--- FFmpeg.orig/libavcodec/magicyuv.c
+++ FFmpeg/libavcodec/magicyuv.c
@@ -225,7 +225,8 @@ static int magy_decode_slice10(AVCodecCo
s->llviddsp.add_left_pred_int16(dst, dst, max, width, 0);
dst += stride;
}
- lefttop = left = dst[0];
+ if (1 + interlaced < height)
+ 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];
@@ -584,6 +585,13 @@ static int magy_decode_frame(AVCodecCont
"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);
@@ -594,11 +602,11 @@ static int magy_decode_frame(AVCodecCont
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;
@@ -2,7 +2,35 @@ Index: FFmpeg/fftools/ffmpeg_demux.c
===================================================================
--- FFmpeg.orig/fftools/ffmpeg_demux.c
+++ FFmpeg/fftools/ffmpeg_demux.c
@@ -1789,18 +1789,21 @@ static int safe_filename(const char *f,
@@ -1757,10 +1757,26 @@ static int is_windows_reserved_device_na
{
#if HAVE_DOS_PATHS
for (const char *p = f; p && *p; ) {
- char stem[6], *s;
+ char stem[16], *s;
+ size_t len;
av_strlcpy(stem, p, sizeof(stem));
+
+ if ((s = strchr(stem, '/')))
+ *s = 0;
+
+ /* Trim trailing spaces and dots */
+ len = strlen(stem);
+ while (len > 0 && (stem[len - 1] == ' ' || stem[len - 1] == '.'))
+ stem[--len] = 0;
+
if ((s = strchr(stem, '.')))
*s = 0;
+
+ /* Trim again after stripping extension */
+ len = strlen(stem);
+ while (len > 0 && (stem[len - 1] == ' ' || stem[len - 1] == '.'))
+ stem[--len] = 0;
+
if ((s = strpbrk(stem, "123456789")))
*s = '1';
@@ -1789,18 +1805,35 @@ static int safe_filename(const char *f,
return 0;
for (; *f; f++) {
@@ -10,10 +38,6 @@ Index: FFmpeg/fftools/ffmpeg_demux.c
- 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 != '.')
+ /* Non-ASCII bytes cannot be '/' or '.' */
+ if ((unsigned char)*f > 127)
+ continue;
@@ -23,17 +47,34 @@ Index: FFmpeg/fftools/ffmpeg_demux.c
+ if (*f == '/') {
+ if (!allow_subdir || f == start)
return 0;
- else if (allow_subdir && *f == '/')
- start = f + 1;
- else if (*f != '.')
+
+#if HAVE_DOS_PATHS
+ /* Reject intermediate dirs ending with trailing spaces or dots */
+ if (f > start && (*(f - 1) == ' ' || *(f - 1) == '.'))
return 0;
+#endif
+
+ start = f + 1;
+ } else if (*f == '.' && f == start) {
+ return 0;
}
}
- return 1;
+
+#if HAVE_DOS_PATHS
+ /* Reject final filenames ending with trailing spaces or dots */
+ if (f > start && (*(f - 1) == ' ' || *(f - 1) == '.'))
+ return 0;
+#endif
+
+ return f != start;
}
static int dump_attachment(InputStream *ist, const char *filename)
@@ -1817,8 +1820,8 @@ static int dump_attachment(InputStream *
@@ -1817,8 +1850,8 @@ static int dump_attachment(InputStream *
if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0))) {
filename = e->value;
if (!safe_filename(filename, 0)) {
@@ -12,11 +12,3 @@ Index: FFmpeg/libavcodec/codec_par.c
par->width = codec->width;
par->height = codec->height;
par->field_order = codec->field_order;
@@ -219,6 +220,7 @@ int avcodec_parameters_to_context(AVCode
switch (par->codec_type) {
case AVMEDIA_TYPE_VIDEO:
+ codec->sw_pix_fmt =
codec->pix_fmt = par->format;
codec->width = par->width;
codec->height = par->height;
@@ -1,764 +0,0 @@
Index: FFmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S
===================================================================
--- FFmpeg.orig/libavcodec/aarch64/vp9lpf_16bpp_neon.S
+++ FFmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S
@@ -56,9 +56,7 @@
mov x11, v4.d[0]
mov x12, v4.d[1]
adds x11, x11, x12
- b.ne 1f
- ret x10
-1:
+ b.eq 9f
.if \wd >= 8
dup v0.8h, w5
@@ -189,13 +187,7 @@
// If no pixels need flat8in, jump to flat8out
// (or to a writeout of the inner 4 pixels, for wd=8)
.if \wd >= 8
-.if \wd == 16
b.eq 6f
-.else
- b.ne 1f
- ret x13
-1:
-.endif
// flat8in
add \tmp1\().8h, v20.8h, v21.8h
@@ -249,20 +241,16 @@
mov x11, v2.d[0]
mov x12, v2.d[1]
adds x11, x11, x12
- b.ne 1f
// If no pixels needed flat8in nor flat8out, jump to a
// writeout of the inner 4 pixels
- ret x14
-1:
+ b.eq 7f
mov x11, v7.d[0]
mov x12, v7.d[1]
adds x11, x11, x12
- b.ne 1f
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
- ret x15
+ b.eq 8f
-1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -378,35 +366,57 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
+ mov x13, #0
loop_filter 4, v16, v17, v18, v19, v28, v29, v30, v31
ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8
+ mov x13, #0
loop_filter 8, v16, v17, v18, v19, v28, v29, v30, v31
ret
+6:
+ mov x13, #(1<<6)
+ ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16
+ mov x13, #0
loop_filter 16, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8
- // calculate alternative 'return' targets
- adr x13, 6f
bl vp9_loop_filter_8
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
@@ -540,7 +550,7 @@ function vp9_loop_filter_v_4_8_16_neon
st1 {v23.8h}, [x9], x1
st1 {v25.8h}, [x0], x1
sub x0, x0, x1, lsl #1
-
+9:
ret x10
endfunc
@@ -588,7 +598,7 @@ function vp9_loop_filter_h_4_8_16_neon
st1 {v25.d}[1], [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #4
-
+9:
ret x10
endfunc
@@ -619,7 +629,7 @@ function vp9_loop_filter_v_8_8_16_neon
st1 {v26.8h}, [x0], x1
sub x0, x0, x1, lsl #1
sub x0, x0, x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -670,7 +680,7 @@ function vp9_loop_filter_h_8_8_16_neon
st1 {v27.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #8
-
+9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -742,7 +752,7 @@ function vp9_loop_filter_v_16_8_16_neon
st1 {v17.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, x1
-
+9:
ret x10
8:
add x9, x9, x1, lsl #2
@@ -820,7 +830,7 @@ function vp9_loop_filter_h_16_8_16_neon
st1 {v9.8h}, [x9], x1
st1 {v31.8h}, [x0], x1
sub x0, x0, x1, lsl #3
-
+9:
ret x10
8:
// The same writeback as in loop_filter_h_8_8
Index: FFmpeg/libavcodec/aarch64/vp9lpf_neon.S
===================================================================
--- FFmpeg.orig/libavcodec/aarch64/vp9lpf_neon.S
+++ FFmpeg/libavcodec/aarch64/vp9lpf_neon.S
@@ -388,32 +388,28 @@
.endif
.if \wd == 16
6:
+ // If no pixels needed flat8in nor flat8out, jump to a
+ // writeout of the inner 4 pixels
orr v2\sz, v6\sz, v7\sz
mov x5, v2.d[0]
.ifc \sz, .16b
mov x6, v2.d[1]
adds x5, x5, x6
- b.ne 1f
+ b.eq 7f
.else
- cbnz x5, 1f
+ cbz x5, 7f
.endif
- // If no pixels needed flat8in nor flat8out, jump to a
- // writeout of the inner 4 pixels
- ret x14
-1:
+ // If no pixels need flat8out, jump to a writeout of the inner 6 pixels
mov x5, v7.d[0]
.ifc \sz, .16b
mov x6, v7.d[1]
adds x5, x5, x6
- b.ne 1f
+ b.eq 8f
.else
- cbnz x5, 1f
+ cbz x5, 8f
.endif
- // If no pixels need flat8out, jump to a writeout of the inner 6 pixels
- ret x15
-1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -529,76 +525,94 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
+ mov x13, #0
loop_filter 4, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_4_16b_mix_44
+ mov x13, #0
loop_filter 4, .16b, 44, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8
+ mov x13, #0
loop_filter 8, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
- ret x13
+ mov x13, #(1<<6)
+ ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8_16b_mix
+ mov x13, #0
loop_filter 8, .16b, 88, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
- ret x13
+ mov x13, #(1<<6)
+ ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16
+ mov x13, #0
loop_filter 16, .8b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
9:
- ldp d10, d11, [sp, #0x10]
- ldp d12, d13, [sp, #0x20]
- ldp d14, d15, [sp, #0x30]
- ldp d8, d9, [sp], #0x40
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16_16b
+ mov x13, #0
loop_filter 16, .16b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
9:
- ldp d10, d11, [sp, #0x10]
- ldp d12, d13, [sp, #0x20]
- ldp d14, d15, [sp, #0x30]
- ldp d8, d9, [sp], #0x40
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_4_16b_mix mix
bl vp9_loop_filter_4_16b_mix_\mix
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8
- // calculate alternative 'return' targets
- adr x13, 6f
bl vp9_loop_filter_8
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8_16b_mix mix
- // calculate alternative 'return' targets
- adr x13, 6f
.if \mix == 48
mov x11, #0xffffffff00000000
.elseif \mix == 84
@@ -607,20 +621,22 @@ endfunc
mov x11, #0xffffffffffffffff
.endif
bl vp9_loop_filter_8_16b_mix
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16_16b
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16_16b
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
@@ -647,7 +663,7 @@ function ff_vp9_loop_filter_v_4_8_neon,
st1 {v24.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v25.8b}, [x0], x1
-
+9:
ret x10
endfunc
@@ -671,7 +687,7 @@ function ff_vp9_loop_filter_v_44_16_neon
st1 {v24.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v25.16b}, [x0], x1
-
+9:
ret x10
endfunc
@@ -713,7 +729,7 @@ function ff_vp9_loop_filter_h_4_8_neon,
st1 {v24.s}[1], [x0], x1
st1 {v25.s}[0], [x9], x1
st1 {v25.s}[1], [x0], x1
-
+9:
ret x10
endfunc
@@ -765,7 +781,7 @@ function ff_vp9_loop_filter_h_44_16_neon
st1 {v24.s}[3], [x0], x1
st1 {v25.s}[1], [x9], x1
st1 {v25.s}[3], [x0], x1
-
+9:
ret x10
endfunc
@@ -792,7 +808,7 @@ function ff_vp9_loop_filter_v_8_8_neon,
st1 {v25.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v26.8b}, [x0], x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -827,7 +843,7 @@ function ff_vp9_loop_filter_v_\mix\()_16
st1 {v25.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v26.16b}, [x0], x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -875,7 +891,7 @@ function ff_vp9_loop_filter_h_8_8_neon,
st1 {v26.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v27.8b}, [x0], x1
-
+9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -941,7 +957,7 @@ function ff_vp9_loop_filter_h_\mix\()_16
st1 {v26.d}[1], [x0], x1
st1 {v27.8b}, [x9], x1
st1 {v27.d}[1], [x0], x1
-
+9:
ret x10
6:
add x9, x9, #2
Index: FFmpeg/libavcodec/vulkan_encode.c
===================================================================
--- FFmpeg.orig/libavcodec/vulkan_encode.c
+++ FFmpeg/libavcodec/vulkan_encode.c
@@ -772,14 +772,6 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR(EINVAL);
}
- if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
- feedback_flags) {
- av_log (avctx, AV_LOG_ERROR,
- "Driver does not support required encode feedback flags "
- "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
- return AVERROR(ENOTSUP);
- }
-
ctx->base.op = &vulkan_base_encode_ops;
ctx->codec = codec;
@@ -881,6 +873,14 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR_EXTERNAL;
}
+ if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
+ feedback_flags) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Driver does not support required encode feedback flags "
+ "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
+ return AVERROR(ENOTSUP);
+ }
+
err = init_rc(avctx, ctx);
if (err < 0)
return err;
Index: FFmpeg/libavformat/dashdec.c
===================================================================
--- FFmpeg.orig/libavformat/dashdec.c
+++ FFmpeg/libavformat/dashdec.c
@@ -447,7 +447,7 @@ static int open_url(AVFormatContext *s,
av_freep(pb);
av_dict_copy(&tmp, *opts, 0);
av_dict_copy(&tmp, opts2, 0);
- ret = ffio_open_whitelist(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp, s->protocol_whitelist, s->protocol_blacklist);
+ ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp);
if (ret >= 0) {
// update cookies on http response with setcookies.
char *new_cookies = NULL;
@@ -1255,7 +1255,7 @@ static int parse_manifest(AVFormatContex
close_in = 1;
av_dict_copy(&opts, c->avio_opts, 0);
- ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist);
+ ret = s->io_open(s, &in, url, AVIO_FLAG_READ, &opts);
av_dict_free(&opts);
if (ret < 0)
return ret;
@@ -1398,7 +1398,7 @@ cleanup:
av_bprint_finalize(&buf, NULL);
if (close_in) {
- avio_close(in);
+ ff_format_io_close(s, &in);
}
return ret;
}
Index: FFmpeg/libavformat/dashenc.c
===================================================================
--- FFmpeg.orig/libavformat/dashenc.c
+++ FFmpeg/libavformat/dashenc.c
@@ -490,7 +490,7 @@ static void dash_free(AVFormatContext *s
if (!c->single_file)
ffio_free_dyn_buf(&os->ctx->pb);
else
- avio_close(os->ctx->pb);
+ ff_format_io_close(s, &os->ctx->pb);
}
ff_format_io_close(s, &os->out);
avformat_free_context(os->ctx);
@@ -1458,7 +1458,7 @@ static int dash_init(AVFormatContext *s)
ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, &opts);
} else {
ctx->url = av_strdup(filename);
- ret = avio_open2(&ctx->pb, filename, AVIO_FLAG_WRITE, NULL, &opts);
+ ret = s->io_open(s, &ctx->pb, filename, AVIO_FLAG_WRITE, &opts);
}
av_dict_free(&opts);
if (ret < 0)
Index: FFmpeg/libavformat/demux.c
===================================================================
--- FFmpeg.orig/libavformat/demux.c
+++ FFmpeg/libavformat/demux.c
@@ -368,7 +368,7 @@ fail:
ff_id3v2_free_extra_meta(&id3v2_extra_meta);
av_dict_free(&tmp);
if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))
- avio_closep(&s->pb);
+ ff_format_io_close(s, &s->pb);
avformat_free_context(s);
*ps = NULL;
return ret;
Index: FFmpeg/libavformat/hlsenc.c
===================================================================
--- FFmpeg.orig/libavformat/hlsenc.c
+++ FFmpeg/libavformat/hlsenc.c
@@ -703,7 +703,7 @@ static int do_encrypt(AVFormatContext *s
return ret;
avio_seek(pb, 0, SEEK_CUR);
avio_write(pb, key, KEYSIZE);
- avio_close(pb);
+ ff_format_io_close(s, &pb);
}
return 0;
}
@@ -1171,9 +1171,7 @@ static int parse_playlist(AVFormatContex
const char *end;
double discont_program_date_time = 0;
- if ((ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist)) < 0)
+ if ((ret = s->io_open(s, &in, url, AVIO_FLAG_READ, NULL)) < 0)
return ret;
ff_get_chomp_line(in, line, sizeof(line));
@@ -1283,7 +1281,7 @@ static int parse_playlist(AVFormatContex
}
fail:
- avio_close(in);
+ ff_format_io_close(s, &in);
return ret;
}
Index: FFmpeg/libavformat/mov.c
===================================================================
--- FFmpeg.orig/libavformat/mov.c
+++ FFmpeg/libavformat/mov.c
@@ -1237,15 +1237,13 @@ static int mov_read_chnl(MOVContext *c,
version = avio_r8(pb);
flags = avio_rb24(pb);
if (version != 0 || flags != 0) {
- av_log(c->fc, AV_LOG_ERROR,
- "Unsupported 'chnl' box with version %d, flags: %#x",
+ av_log(c->fc, AV_LOG_WARNING,
+ "Unsupported 'chnl' box with version %d, flags: %#x\n",
version, flags);
- return AVERROR_INVALIDDATA;
+ return 0;
}
- ret = ff_mov_read_chnl(c->fc, pb, st);
- if (ret < 0)
- return ret;
+ ff_mov_read_chnl(c->fc, pb, st);
if (avio_tell(pb) != end) {
av_log(c->fc, AV_LOG_WARNING, "skip %" PRId64 " bytes of unknown data inside chnl\n",
Index: FFmpeg/libavformat/mov_chan.c
===================================================================
--- FFmpeg.orig/libavformat/mov_chan.c
+++ FFmpeg/libavformat/mov_chan.c
@@ -375,6 +375,7 @@ static int mov_get_channel_layout(AVChan
/* find the channel layout for the specified layout tag */
layout_map = find_layout_map(tag, map);
if (layout_map) {
+ AVChannelLayout tmp = { 0 };
int ret;
int map_layout_nb_channels = tag & 0xFFFF;
int nb_channels = ch_layout->nb_channels;
@@ -383,19 +384,23 @@ static int mov_get_channel_layout(AVChan
if (omitted_channel_map >> map_layout_nb_channels)
return AVERROR_INVALIDDATA;
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
return ret;
for (int i = 0, idx = 0; i < map_layout_nb_channels && idx < nb_channels; i++, omitted_channel_map >>= 1) {
if (!(omitted_channel_map & 1)) {
enum AVChannel id = layout_map[i].id;
- ch_layout->u.map[idx++].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN);
+ tmp.u.map[idx++].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN);
}
}
- return av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ if (ret < 0)
+ return ret;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
}
return 0;
}
@@ -543,6 +548,7 @@ int ff_mov_read_chan(AVFormatContext *s,
return 0;
if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) {
+ AVChannelLayout tmp = { 0 };
int nb_channels = ch_layout->nb_channels;
if (!num_descr || num_descr < nb_channels) {
@@ -562,8 +568,7 @@ int ff_mov_read_chan(AVFormatContext *s,
num_descr = nb_channels;
}
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
goto out;
@@ -580,12 +585,15 @@ int ff_mov_read_chan(AVFormatContext *s,
avio_rl32(pb); // mCoordinates[1]
avio_rl32(pb); // mCoordinates[2]
size -= 20;
- ch_layout->u.map[i].id = mov_get_channel_id(label);
+ tmp.u.map[i].id = mov_get_channel_id(label);
}
- ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
if (ret < 0)
goto out;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
} else if (layout_tag == MOV_CH_LAYOUT_USE_BITMAP) {
if (!ch_layout->nb_channels || av_popcount(bitmap) == ch_layout->nb_channels) {
if (bitmap < 0x40000) {
@@ -737,11 +745,10 @@ int ff_mov_read_chnl(AVFormatContext *s,
av_log(s, AV_LOG_TRACE, "'chnl' layout %d\n", layout);
if (!layout) {
- AVChannelLayout *ch_layout = &st->codecpar->ch_layout;
+ AVChannelLayout tmp = { 0 }, *ch_layout = &st->codecpar->ch_layout;
int nb_channels = ch_layout->nb_channels;
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
return ret;
@@ -762,12 +769,15 @@ int ff_mov_read_chnl(AVFormatContext *s,
channel = AV_CHAN_UNKNOWN;
}
- ch_layout->u.map[i].id = channel;
+ tmp.u.map[i].id = channel;
}
- ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
if (ret < 0)
return ret;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
} else {
uint64_t omitted_channel_map = avio_rb64(pb);
ret = ff_mov_get_channel_layout_from_config(layout, &st->codecpar->ch_layout, omitted_channel_map);
Index: FFmpeg/libavformat/oggparsecelt.c
===================================================================
--- FFmpeg.orig/libavformat/oggparsecelt.c
+++ FFmpeg/libavformat/oggparsecelt.c
@@ -27,6 +27,9 @@
#include "internal.h"
#include "oggdec.h"
+/* CELT-over-Ogg streams use at most a couple of vorbiscomment "extra" headers. */
+#define CELT_MAX_EXTRA_HEADERS 16
+
struct oggcelt_private {
int extra_headers_left;
};
@@ -62,6 +65,12 @@ static int celt_header(AVFormatContext *
overlap = AV_RL32(p + 48);
/* unused bytes per packet field skipped */
extra_headers = AV_RL32(p + 56);
+ if (extra_headers > CELT_MAX_EXTRA_HEADERS) {
+ av_log(s, AV_LOG_ERROR,
+ "Too many CELT extra headers (%u)\n", extra_headers);
+ av_free(priv);
+ return AVERROR_INVALIDDATA;
+ }
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_CELT;
st->codecpar->sample_rate = sample_rate;
Index: FFmpeg/libavformat/oggparsevorbis.c
===================================================================
--- FFmpeg.orig/libavformat/oggparsevorbis.c
+++ FFmpeg/libavformat/oggparsevorbis.c
@@ -230,8 +230,11 @@ static int fixup_vorbis_headers(AVFormat
int i, offset, len, err;
int buf_len;
unsigned char *ptr;
+ uint64_t total_len = (uint64_t)priv->len[0] + priv->len[1] + priv->len[2];
+ if (total_len + total_len / 255 + 64 > INT_MAX)
+ return AVERROR_INVALIDDATA;
- len = priv->len[0] + priv->len[1] + priv->len[2];
+ len = total_len;
buf_len = len + len / 255 + 64;
if (*buf)
Index: FFmpeg/libavformat/rtpdec_av1.c
===================================================================
--- FFmpeg.orig/libavformat/rtpdec_av1.c
+++ FFmpeg/libavformat/rtpdec_av1.c
@@ -249,7 +249,7 @@ static int av1_handle_packet(AVFormatCon
// ignore and remove OBUs according to spec
if ((obu_type == AV1_OBU_TEMPORAL_DELIMITER) ||
(obu_type == AV1_OBU_TILE_LIST)) {
- pktpos += obu_size;
+ buf_ptr += obu_size;
rem_pkt_size -= obu_size;
// TODO: This probably breaks if the OBU_TILE_LIST is fragmented
// into the next RTP packet, so at least check and fail here
Index: FFmpeg/libavformat/version.h
===================================================================
--- FFmpeg.orig/libavformat/version.h
+++ FFmpeg/libavformat/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 12
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
+6 -8
View File
@@ -74,19 +74,17 @@
0074-fix-mapped-hwframe-to-swframe-swscale-conversion.patch
0075-fix-hwupload-filter-cannot-use-devices-created-by-hwaccel.patch
0076-fix-seeking-h264-open-gop-videos-with-d3d11va-on-amd.patch
0077-fix-low-default-readrate-catchup-caused-remuxing-to-stall.patch
0077-fix-readrate-catchup-caused-remuxing-to-stall.patch
0078-backport-fixes-for-vulkan-from-upstream.patch
0079-add-fixes-for-vaapi-drm-prime-vulkan-interop.patch
0080-prefer-vulkan-device-with-higher-api-version.patch
0081-signal-vulkan-semaphores-in-drm-prime-reverse-mapping.patch
0082-add-fixes-and-enhancements-for-vulkan-filters.patch
0083-backport-fixes-for-nvenc-and-cuvid-from-upstream.patch
0083-backport-fixes-for-cuda-from-upstream.patch
0084-backport-fixes-for-detecting-ac4-streams-in-mpegts.patch
0085-fix-hdr10-sidedata-not-removed-in-libplacebo-outlink.patch
0086-workaround-amd-hevc-vaapi-encoder-out-of-band-vtag-hvc1.patch
0087-backport-a-fix-from-upstream-for-magicyuv-decoder.patch
0088-add-dtsx-detect-for-dts-hd-hra.patch
0089-add-webp-to-matroskadec-image-mime-types.patch
0090-relax-to-allow-safe-filenames-in-mkv-attachments.patch
0091-backport-a-fix-to-use-sw-pix-fmt-in-codec-par-if-set.patch
0092-backport-fixes-by-comparing-n8-1-1-and-release-8-1.patch
0087-add-dtsx-detect-for-dts-hd-hra.patch
0088-add-webp-to-matroskadec-image-mime-types.patch
0089-relax-to-allow-safe-filenames-in-mkv-attachments.patch
0090-backport-a-fix-to-use-sw-pix-fmt-in-codec-par-if-set.patch
+1 -1
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 8.1.1
PROJECT_NUMBER = 8.1.2
# 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
+6 -5
View File
@@ -179,7 +179,7 @@ ninja -j$(nproc) -C fontconfig_build install
popd
# HARFBUZZ
git clone -b 14.2.0 --depth=1 https://github.com/harfbuzz/harfbuzz.git
git clone -b 14.2.1 --depth=1 https://github.com/harfbuzz/harfbuzz.git
meson setup harfbuzz harfbuzz_build \
--prefix=${FF_DEPS_PREFIX} \
--cross-file=${FF_MESON_TOOLCHAIN} \
@@ -218,7 +218,7 @@ make install
popd
# LIBASS
git clone -b 0.17.4 --depth=1 https://github.com/libass/libass.git
git clone -b 0.17.5 --depth=1 https://github.com/libass/libass.git
pushd libass
./autogen.sh
./configure \
@@ -321,7 +321,7 @@ popd
# OPENMPT
mkdir mpt
pushd mpt
mpt_ver="0.8.6"
mpt_ver="0.8.7"
mpt_link="https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-${mpt_ver}+release.autotools.tar.gz"
wget ${mpt_link} -O mpt.tar.gz
tar xaf mpt.tar.gz
@@ -549,7 +549,7 @@ popd
# AMF
mkdir amf-headers
pushd amf-headers
amf_ver="1.5.0"
amf_ver="1.5.2"
amf_link="https://github.com/GPUOpen-LibrariesAndSDKs/AMF/releases/download/v${amf_ver}/AMF-headers-v${amf_ver}.tar.gz"
wget ${amf_link} -O amf.tar.gz
tar xaf amf.tar.gz
@@ -560,7 +560,7 @@ popd
popd
# VPL
git clone -b v2.16.0 --depth=1 https://github.com/intel/libvpl.git
git clone -b v2.17.0 --depth=1 https://github.com/intel/libvpl.git
pushd libvpl
mkdir build && pushd build
cmake \
@@ -571,6 +571,7 @@ cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DINSTALL_{DEV,LIB}=ON \
-DINSTALL_EXAMPLES=OFF \
-DBUILD_{TESTS,EXAMPLES,EXPERIMENTAL}=OFF \
..
make -j$(nproc)
+19 -10
View File
@@ -135,7 +135,7 @@ prepare_extra_common() {
# HARFBUZZ
pushd ${SOURCE_DIR}
git clone -b 14.2.0 --depth=1 https://github.com/harfbuzz/harfbuzz.git
git clone -b 14.2.1 --depth=1 https://github.com/harfbuzz/harfbuzz.git
meson setup harfbuzz harfbuzz_build \
${MESON_CROSS_OPT} \
--prefix=${TARGET_DIR} \
@@ -169,7 +169,7 @@ prepare_extra_common() {
# LIBASS
pushd ${SOURCE_DIR}
git clone -b 0.17.4 --depth=1 https://github.com/libass/libass.git
git clone -b 0.17.5 --depth=1 https://github.com/libass/libass.git
pushd libass
./autogen.sh
./configure \
@@ -315,7 +315,7 @@ prepare_extra_amd64() {
pushd ${SOURCE_DIR}
mkdir amf-headers
pushd amf-headers
amf_ver="1.5.0"
amf_ver="1.5.2"
amf_link="https://github.com/GPUOpen-LibrariesAndSDKs/AMF/releases/download/v${amf_ver}/AMF-headers-v${amf_ver}.tar.gz"
wget ${amf_link} -O amf.tar.gz
tar xaf amf.tar.gz
@@ -431,7 +431,7 @@ prepare_extra_amd64() {
# Provides VPL header and dispatcher (libvpl.so.2) for FFmpeg
# Both MSDK and VPL runtime can be loaded by VPL dispatcher
pushd ${SOURCE_DIR}
git clone -b v2.16.0 --depth=1 https://github.com/intel/libvpl.git
git clone -b v2.17.0 --depth=1 https://github.com/intel/libvpl.git
pushd libvpl
sed -i 's|ParseEnvSearchPaths(ONEVPL_PRIORITY_PATH_VAR, searchDirList)|searchDirList.push_back("/usr/lib/jellyfin-ffmpeg/lib")|g' libvpl/src/mfx_dispatcher_vpl_loader.cpp
mkdir build && pushd build
@@ -441,6 +441,7 @@ prepare_extra_amd64() {
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DINSTALL_{DEV,LIB}=ON \
-DINSTALL_EXAMPLES=OFF \
-DBUILD_{TESTS,EXAMPLES,EXPERIMENTAL}=OFF \
..
make -j$(nproc) && make install && make install DESTDIR=${SOURCE_DIR}/intel
@@ -453,7 +454,7 @@ prepare_extra_amd64() {
# VPL-GPU-RT (RT only)
# Provides VPL runtime (libmfx-gen.so.1.2) for 11th Gen Tiger Lake and newer
pushd ${SOURCE_DIR}
git clone -b intel-onevpl-26.1.6 --depth=1 https://github.com/intel/vpl-gpu-rt.git
git clone -b intel-onevpl-26.2.3 --depth=1 https://github.com/intel/vpl-gpu-rt.git
pushd vpl-gpu-rt
# Fix missing entries in PicStruct validation
wget -q -O - https://github.com/intel/vpl-gpu-rt/commit/c7eb030.patch | git apply
@@ -475,10 +476,12 @@ prepare_extra_amd64() {
# Full Feature Build: ENABLE_KERNELS=ON(Default) ENABLE_NONFREE_KERNELS=ON(Default)
# Free Kernel Build: ENABLE_KERNELS=ON ENABLE_NONFREE_KERNELS=OFF
pushd ${SOURCE_DIR}
git clone -b intel-media-26.1.6 --depth=1 https://github.com/intel/media-driver.git
git clone -b intel-media-26.2.3 --depth=1 https://github.com/intel/media-driver.git
pushd media-driver
# Enable VC1 decode on DG2 (note that MTL+ is not supported)
wget -q -O - https://github.com/intel/media-driver/commit/25fb926.patch | git apply
wget -q -O - https://github.com/intel/media-driver/commit/e47702f.patch | git apply
# Fix iHD crashes when used with Xe KMD on small BAR systems
wget -q -O - https://github.com/intel/media-driver/commit/6fd4037.patch | git apply
mkdir build && pushd build
cmake -DCMAKE_INSTALL_PREFIX=${TARGET_DIR} \
-DCMAKE_C_FLAGS="${CFLAGS} -Wno-error=array-bounds" \
@@ -498,7 +501,7 @@ prepare_extra_amd64() {
# Vulkan Headers
pushd ${SOURCE_DIR}
git clone -b v1.4.349 --depth=1 https://github.com/KhronosGroup/Vulkan-Headers.git
git clone -b v1.4.355 --depth=1 https://github.com/KhronosGroup/Vulkan-Headers.git
pushd Vulkan-Headers
mkdir build && pushd build
cmake \
@@ -511,7 +514,7 @@ prepare_extra_amd64() {
# Vulkan ICD Loader
pushd ${SOURCE_DIR}
git clone -b v1.4.349 --depth=1 https://github.com/KhronosGroup/Vulkan-Loader.git
git clone -b v1.4.355 --depth=1 https://github.com/KhronosGroup/Vulkan-Loader.git
pushd Vulkan-Loader
mkdir build && pushd build
cmake \
@@ -531,7 +534,7 @@ prepare_extra_amd64() {
popd
# SHADERC
shaderc_ver="v2026.1"
shaderc_ver="v2026.2"
pushd ${SOURCE_DIR}
git clone -b ${shaderc_ver} --depth=1 https://github.com/google/shaderc.git
pushd shaderc
@@ -578,6 +581,12 @@ prepare_extra_amd64() {
# Enable VAAPI VPP alpha blending support
wget -q -O - https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41090.patch | \
patch -p1 -d mesa-${mesa_ver}
# Fix misc CSC issues in VAAPI VPP
wget -q -O - https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42181.patch | \
patch -p1 -d mesa-${mesa_ver}
# Fix setting VPE rotation with horizontal flip enabled
wget -q -O - https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42408.patch | \
sed 's#/mm/#/#g' | patch -p1 -d mesa-${mesa_ver}
meson setup mesa-${mesa_ver} mesa_build \
--prefix=${TARGET_DIR} \
--libdir=lib \
+1 -1
View File
@@ -469,7 +469,7 @@ typedef struct Decoder {
enum AVMediaType type;
const uint8_t *subtitle_header;
uint8_t *subtitle_header;
int subtitle_header_size;
// number of frames/samples retrieved from the decoder
+11 -2
View File
@@ -136,6 +136,8 @@ 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);
@@ -1621,8 +1623,15 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
dp->dec_ctx->extra_hw_frames = extra_frames;
}
dp->dec.subtitle_header = dp->dec_ctx->subtitle_header;
dp->dec.subtitle_header_size = dp->dec_ctx->subtitle_header_size;
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;
}
if (param_out) {
if (dp->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
+1
View File
@@ -33,6 +33,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/dict.h"
#include "libavutil/common.h"
+6
View File
@@ -2383,6 +2383,12 @@ 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;
+8 -4
View File
@@ -215,6 +215,9 @@ 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 */
@@ -374,6 +377,8 @@ 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)
@@ -1385,11 +1390,10 @@ static void decode_tsd(GetBitContext *gb, int *data,
break;
}
int64_t c = k - p + 1;
for (int h = 2; h <= p; h++) {
c *= k - p + h;
c /= h;
for (int h = 2; h <= p && c <= s; h++) {
c += c*(k-p)/h;
}
if (s >= (int)c) { /* c is long long for up to 32 slots */
if (s >= c) {
s -= c;
data[k] = 1;
p--;
+1 -1
View File
@@ -645,7 +645,7 @@ int ff_aac_ec_data_dec(GetBitContext *gb, AACMPSLosslessData *ld,
stride_table[ld->freq_res[set_idx]],
start_band, end_band);
if (set_idx + data_pair > MPS_MAX_PARAM_SETS)
if (set_idx + data_pair >= MPS_MAX_PARAM_SETS)
return AVERROR(EINVAL);
for (int j = 0; j < data_bands; j++)
+36 -26
View File
@@ -56,9 +56,7 @@
mov x11, v4.d[0]
mov x12, v4.d[1]
adds x11, x11, x12
b.ne 1f
ret x10
1:
b.eq 9f
.if \wd >= 8
dup v0.8h, w5
@@ -189,13 +187,7 @@
// If no pixels need flat8in, jump to flat8out
// (or to a writeout of the inner 4 pixels, for wd=8)
.if \wd >= 8
.if \wd == 16
b.eq 6f
.else
b.ne 1f
ret x13
1:
.endif
// flat8in
add \tmp1\().8h, v20.8h, v21.8h
@@ -249,20 +241,16 @@
mov x11, v2.d[0]
mov x12, v2.d[1]
adds x11, x11, x12
b.ne 1f
// If no pixels needed flat8in nor flat8out, jump to a
// writeout of the inner 4 pixels
ret x14
1:
b.eq 7f
mov x11, v7.d[0]
mov x12, v7.d[1]
adds x11, x11, x12
b.ne 1f
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
ret x15
b.eq 8f
1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -378,35 +366,57 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
mov x13, #0
loop_filter 4, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
mov x13, #(1<<9)
ret
endfunc
function vp9_loop_filter_8
mov x13, #0
loop_filter 8, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
mov x13, #(1<<6)
ret
9:
mov x13, #(1<<9)
ret
endfunc
function vp9_loop_filter_16
mov x13, #0
loop_filter 16, v8, v9, v10, v11, v12, v13, v14, v15
ret
7:
mov x13, #(1<<7)
ret
8:
mov x13, #(1<<8)
ret
9:
mov x13, #(1<<9)
ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
tbnz x13, #9, 9f
.endm
.macro loop_filter_8
// calculate alternative 'return' targets
adr x13, 6f
bl vp9_loop_filter_8
tbnz x13, #6, 6f
tbnz x13, #9, 9f
.endm
.macro loop_filter_16
// calculate alternative 'return' targets
adr x14, 7f
adr x15, 8f
bl vp9_loop_filter_16
tbnz x13, #7, 7f
tbnz x13, #8, 8f
tbnz x13, #9, 9f
.endm
@@ -540,7 +550,7 @@ function vp9_loop_filter_v_4_8_16_neon
st1 {v23.8h}, [x9], x1
st1 {v25.8h}, [x0], x1
sub x0, x0, x1, lsl #1
9:
ret x10
endfunc
@@ -588,7 +598,7 @@ function vp9_loop_filter_h_4_8_16_neon
st1 {v25.d}[1], [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #4
9:
ret x10
endfunc
@@ -619,7 +629,7 @@ function vp9_loop_filter_v_8_8_16_neon
st1 {v26.8h}, [x0], x1
sub x0, x0, x1, lsl #1
sub x0, x0, x1
9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -670,7 +680,7 @@ function vp9_loop_filter_h_8_8_16_neon
st1 {v27.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #8
9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -742,7 +752,7 @@ function vp9_loop_filter_v_16_8_16_neon
st1 {v17.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, x1
9:
ret x10
8:
add x9, x9, x1, lsl #2
@@ -820,7 +830,7 @@ function vp9_loop_filter_h_16_8_16_neon
st1 {v9.8h}, [x9], x1
st1 {v31.8h}, [x0], x1
sub x0, x0, x1, lsl #3
9:
ret x10
8:
// The same writeback as in loop_filter_h_8_8
+61 -45
View File
@@ -388,32 +388,28 @@
.endif
.if \wd == 16
6:
// If no pixels needed flat8in nor flat8out, jump to a
// writeout of the inner 4 pixels
orr v2\sz, v6\sz, v7\sz
mov x5, v2.d[0]
.ifc \sz, .16b
mov x6, v2.d[1]
adds x5, x5, x6
b.ne 1f
b.eq 7f
.else
cbnz x5, 1f
cbz x5, 7f
.endif
// If no pixels needed flat8in nor flat8out, jump to a
// writeout of the inner 4 pixels
ret x14
1:
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
mov x5, v7.d[0]
.ifc \sz, .16b
mov x6, v7.d[1]
adds x5, x5, x6
b.ne 1f
b.eq 8f
.else
cbnz x5, 1f
cbz x5, 8f
.endif
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
ret x15
1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -529,76 +525,94 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
mov x13, #0
loop_filter 4, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
ret x10
mov x13, #(1<<9)
ret
endfunc
function vp9_loop_filter_4_16b_mix_44
mov x13, #0
loop_filter 4, .16b, 44, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
ret x10
mov x13, #(1<<9)
ret
endfunc
function vp9_loop_filter_8
mov x13, #0
loop_filter 8, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
ret x13
mov x13, #(1<<6)
ret
9:
ret x10
mov x13, #(1<<9)
ret
endfunc
function vp9_loop_filter_8_16b_mix
mov x13, #0
loop_filter 8, .16b, 88, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
ret x13
mov x13, #(1<<6)
ret
9:
ret x10
mov x13, #(1<<9)
ret
endfunc
function vp9_loop_filter_16
mov x13, #0
loop_filter 16, .8b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
7:
mov x13, #(1<<7)
ret
8:
mov x13, #(1<<8)
ret
9:
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
ldp d8, d9, [sp], #0x40
ret x10
mov x13, #(1<<9)
ret
endfunc
function vp9_loop_filter_16_16b
mov x13, #0
loop_filter 16, .16b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
7:
mov x13, #(1<<7)
ret
8:
mov x13, #(1<<8)
ret
9:
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
ldp d8, d9, [sp], #0x40
ret x10
mov x13, #(1<<9)
ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
tbnz x13, #9, 9f
.endm
.macro loop_filter_4_16b_mix mix
bl vp9_loop_filter_4_16b_mix_\mix
tbnz x13, #9, 9f
.endm
.macro loop_filter_8
// calculate alternative 'return' targets
adr x13, 6f
bl vp9_loop_filter_8
tbnz x13, #6, 6f
tbnz x13, #9, 9f
.endm
.macro loop_filter_8_16b_mix mix
// calculate alternative 'return' targets
adr x13, 6f
.if \mix == 48
mov x11, #0xffffffff00000000
.elseif \mix == 84
@@ -607,20 +621,22 @@ endfunc
mov x11, #0xffffffffffffffff
.endif
bl vp9_loop_filter_8_16b_mix
tbnz x13, #6, 6f
tbnz x13, #9, 9f
.endm
.macro loop_filter_16
// calculate alternative 'return' targets
adr x14, 7f
adr x15, 8f
bl vp9_loop_filter_16
tbnz x13, #7, 7f
tbnz x13, #8, 8f
tbnz x13, #9, 9f
.endm
.macro loop_filter_16_16b
// calculate alternative 'return' targets
adr x14, 7f
adr x15, 8f
bl vp9_loop_filter_16_16b
tbnz x13, #7, 7f
tbnz x13, #8, 8f
tbnz x13, #9, 9f
.endm
@@ -647,7 +663,7 @@ function ff_vp9_loop_filter_v_4_8_neon, export=1
st1 {v24.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v25.8b}, [x0], x1
9:
ret x10
endfunc
@@ -671,7 +687,7 @@ function ff_vp9_loop_filter_v_44_16_neon, export=1
st1 {v24.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v25.16b}, [x0], x1
9:
ret x10
endfunc
@@ -713,7 +729,7 @@ function ff_vp9_loop_filter_h_4_8_neon, export=1
st1 {v24.s}[1], [x0], x1
st1 {v25.s}[0], [x9], x1
st1 {v25.s}[1], [x0], x1
9:
ret x10
endfunc
@@ -765,7 +781,7 @@ function ff_vp9_loop_filter_h_44_16_neon, export=1
st1 {v24.s}[3], [x0], x1
st1 {v25.s}[1], [x9], x1
st1 {v25.s}[3], [x0], x1
9:
ret x10
endfunc
@@ -792,7 +808,7 @@ function ff_vp9_loop_filter_v_8_8_neon, export=1
st1 {v25.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v26.8b}, [x0], x1
9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -827,7 +843,7 @@ function ff_vp9_loop_filter_v_\mix\()_16_neon, export=1
st1 {v25.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v26.16b}, [x0], x1
9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -875,7 +891,7 @@ function ff_vp9_loop_filter_h_8_8_neon, export=1
st1 {v26.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v27.8b}, [x0], x1
9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -941,7 +957,7 @@ function ff_vp9_loop_filter_h_\mix\()_16_neon, export=1
st1 {v26.d}[1], [x0], x1
st1 {v27.8b}, [x9], x1
st1 {v27.d}[1], [x0], x1
9:
ret x10
6:
add x9, x9, #2
+3 -2
View File
@@ -294,7 +294,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
break;
case AV_CODEC_ID_ADPCM_PSXC:
max_channels = 8;
if (avctx->ch_layout.nb_channels <= 0 || avctx->block_align <= 0)
if (avctx->ch_layout.nb_channels <= 0 || avctx->block_align <= 0 ||
avctx->block_align % avctx->ch_layout.nb_channels)
return AVERROR_INVALIDDATA;
break;
case AV_CODEC_ID_ADPCM_IMA_DAT4:
@@ -1173,7 +1174,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
if(ch <= 0)
return 0;
if (buf_size > INT_MAX / 2)
if (buf_size > INT_MAX / 14)
return 0;
switch (avctx->codec->id) {
+10 -6
View File
@@ -409,12 +409,14 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
int map = s->map[x];
if (orig_mv_x >= -32) {
if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h ||
x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w)
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)
return AVERROR_INVALIDDATA;
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,
prev->data[plane] + ((s->blocks_h - 1 - y) * 8 - mv_y) * prev->linesize[plane] + (x * 8 + mv_x),
prev->data[plane] + src_y * prev->linesize[plane] + src_x,
frame->linesize[plane], prev->linesize[plane], 8);
if (map) {
s->idsp.idct(s->wblocks + x * 64);
@@ -446,12 +448,14 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
return ret;
if (orig_mv_x >= -32) {
if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h ||
x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w)
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)
return AVERROR_INVALIDDATA;
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,
prev->data[plane] + ((s->blocks_h - 1 - y) * 8 - mv_y) * prev->linesize[plane] + (x * 8 + mv_x),
prev->data[plane] + src_y * prev->linesize[plane] + src_x,
frame->linesize[plane], prev->linesize[plane], 8);
if (map) {
s->idsp.idct(s->block);
+5 -6
View File
@@ -208,14 +208,13 @@ static int apv_decode_tile_component(AVCodecContext *avctx, void *data,
{
APVRawFrame *input = data;
APVDecodeContext *apv = avctx->priv_data;
const CodedBitstreamAPVContext *apv_cbc = apv->cbc->priv_data;
const APVDerivedTileInfo *tile_info = &apv->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;
@@ -266,7 +265,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 = apv_cbc->bit_depth;
bit_depth = input->frame_header.frame_info.bit_depth_minus8 + 8;
qp_shift = qp / 6;
for (int y = 0; y < 8; y++) {
+34 -6
View File
@@ -412,11 +412,23 @@ static int hevc_init_nb_frame(AVBSFContext *ctx, int poc)
return 0;
}
static int same_gop(void *opaque, void *elem)
typedef struct DTS2PTSCollect {
int gop;
DTS2PTSNode **out;
int count;
int max;
} DTS2PTSCollect;
static int collect_same_gop(void *opaque, void *elem)
{
DTS2PTSCollect *c = opaque;
DTS2PTSNode *node = elem;
int gop = ((int *)opaque)[1];
return FFDIFFSIGN(gop, node->gop);
if (node->gop == c->gop) {
if (c->count < c->max)
c->out[c->count] = node;
c->count++;
}
return 0;
}
static int hevc_queue_frame(AVBSFContext *ctx, AVPacket *pkt, int poc, bool *queued)
@@ -440,10 +452,26 @@ static int hevc_queue_frame(AVBSFContext *ctx, AVPacket *pkt, int poc, bool *que
}
if (poc < s->nb_frame && hevc->gop == s->gop) {
int tmp[] = {s->nb_frame - poc, s->gop};
int dec = s->nb_frame - poc;
DTS2PTSNode *nodes[HEVC_MAX_DPB_SIZE * 2];
DTS2PTSCollect c = { s->gop, nodes, 0, FF_ARRAY_ELEMS(nodes) };
s->nb_frame -= tmp[0];
av_tree_enumerate(s->root, tmp, same_gop, dec_poc);
s->nb_frame -= dec;
av_tree_enumerate(s->root, &c, NULL, collect_same_gop);
av_assert0(c.count <= c.max);
for (int i = 0; i < c.count; i++) {
struct AVTreeNode *tnode = NULL;
DTS2PTSNode *r;
av_tree_insert(&s->root, nodes[i], cmp_insert, &tnode);
nodes[i]->poc -= dec;
r = av_tree_insert(&s->root, nodes[i], cmp_insert, &tnode);
if (r && r != nodes[i]) {
*r = *nodes[i];
av_refstruct_unref(&nodes[i]);
av_free(tnode);
}
}
}
ret = alloc_and_insert_node(ctx, pkt->dts, pkt->duration, s->nb_frame, 1, s->gop);
+1 -1
View File
@@ -73,7 +73,7 @@ static int ff_smpte436m_to_eia608_filter(AVBSFContext *ctx, AVPacket *out)
return 0;
}
if (ret != AVERROR_EOF)
return ret;
goto fail;
ret = AVERROR(EAGAIN);
fail:
+3
View File
@@ -186,10 +186,13 @@ 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);
+3 -3
View File
@@ -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;
flag(sps_subpic_info_present_flag);
u(1, sps_subpic_info_present_flag, 0, !current->sps_res_change_in_clvs_allowed_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) {
@@ -2022,7 +2022,7 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
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 - 1, 2,
remaining_height_in_ctbs_y - (current->pps_num_exp_slices_in_tile[i] - j), 2,
i, j);
slice_height_in_ctus =
current->
@@ -3145,7 +3145,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);
ue(sh_num_tiles_in_slice_minus1, 0, pps->num_tiles_in_pic - 1 - current->sh_slice_address);
else
infer(sh_num_tiles_in_slice_minus1, 0);
+5 -2
View File
@@ -1080,6 +1080,7 @@ 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;
@@ -1237,10 +1238,12 @@ 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 (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);
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);
return AVERROR_INVALIDDATA;
}
total_channels += q->subpacket[s].num_channels;
q->num_subpackets++;
s++;
+1
View File
@@ -69,6 +69,7 @@ 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;
+4 -4
View File
@@ -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, MAX_BLOCKSIZE);
s->edge_emu_buffer_base = av_malloc_array(stride, 4 * MAX_BLOCKSIZE);
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h + 5*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*FFALIGN(p->width, 16);
s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*s->buffer_stride*MAX_BLOCKSIZE;
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);
+2
View File
@@ -113,6 +113,8 @@ 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;
+3 -2
View File
@@ -481,12 +481,13 @@ 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 < dc->stack_pos; i++)
for (i = 0; i < n; i++)
if (dc->stack[i] == pix)
break;
return i != dc->stack_pos;
return i != n;
}
#define TOSIGNED(val) (((val) >> 1) ^ -((val) & 1))
+4 -4
View File
@@ -629,15 +629,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) {
+4 -2
View File
@@ -316,8 +316,10 @@ 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) {
((uint16_t*)dst)[0] = c[p];
av_memcpy_backptr(dst + 2, 2, bytes - 2);
if (bytes >= 1)
((uint16_t*)dst)[0] = c[p];
if (bytes >= 2)
av_memcpy_backptr(dst + 2, 2, 2 * (bytes - 1));
dst += frame->linesize[p];
for (int y = 1; y < height; y++) {
memcpy(dst, frame->data[p], 2*bytes);
+1 -1
View File
@@ -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 -= 4;
w--;
}
rshift += 8;
if (rshift > 16)
+34 -22
View File
@@ -62,6 +62,29 @@ 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;
@@ -702,12 +725,9 @@ static int decode_vps_ext(GetBitContext *gb, AVCodecContext *avctx, HEVCVPS *vps
}
if (get_bits1(gb) /* conformance_window_vps_flag */) {
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;
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;
}
vps->max_one_active_ref_layer = get_bits1(gb);
@@ -962,12 +982,7 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
vui->default_display_window_flag = get_bits1(gb);
if (vui->default_display_window_flag) {
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;
read_window(&vui->def_disp_win, gb, sps->chroma_format_idc, sps->width, sps->height);
if (apply_defdispwin &&
avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
@@ -1284,10 +1299,10 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
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);
@@ -1310,12 +1325,9 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
sps->conformance_window = get_bits1(gb);
if (sps->conformance_window) {
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;
ret = read_window(&sps->pic_conf_win, gb, sps->chroma_format_idc, sps->width, sps->height);
if (ret < 0)
return ret;
if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
av_log(avctx, AV_LOG_DEBUG,
+1 -4
View File
@@ -162,10 +162,7 @@ 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
uint16_t conf_win_left_offset;
uint16_t conf_win_right_offset;
uint16_t conf_win_top_offset;
uint16_t conf_win_bottom_offset;
HEVCWindow conf_win;
} RepFormat;
typedef struct HEVCVPS {
+3 -2
View File
@@ -473,12 +473,13 @@ 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; frame->f->data[i]; i++)
for (i = 0; i < nb_planes; 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; frame->f->data[i]; i++)
for (i = 0; i < nb_planes; 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));
+2
View File
@@ -62,6 +62,7 @@ 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,6 +74,7 @@ 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;
+7 -1
View File
@@ -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 = 3 << (bpno - 1), y0, x, y, runlen, dec;
int mask = (3u << bpno)>>1, y0, x, y, runlen, dec;
for (y0 = 0; y0 < height; y0 += 4) {
for (x = 0; x < width; x++) {
@@ -2448,8 +2448,14 @@ 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)
+13 -2
View File
@@ -1334,8 +1334,19 @@ 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))
val <<= roi_shift;
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;
}
}
t1->data[n] = val | sign; /* NOTE: Binary point for reconstruction value is located in 31 - M_b */
}
}
+1 -1
View File
@@ -499,7 +499,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s)
if (s->bits <= 8) {
uint8_t *src = s->picture_ptr->data[0];
for (i = 0; i < s->height; i++) {
for (i = 0; i < decoded_height; i++) {
switch(s->xfrm) {
case 1:
for (x = off; x + 2 < w; x += 3) {
+2 -1
View File
@@ -434,7 +434,8 @@ static int libjxl_preprocess_stream(AVCodecContext *avctx, const AVFrame *frame,
if (ret >= 0)
ret = av_exif_get_entry(avctx, &ifd, tag, 0, &orient);
if (ret >= 0 && orient) {
if (!have_matrix && orient->value.uint[0] >= 1 && orient->value.uint[0] <= 8) {
if (!have_matrix && orient->type == AV_TIFF_SHORT && orient->count
&& orient->value.uint[0] >= 1 && orient->value.uint[0] <= 8) {
av_exif_orientation_to_matrix(matrix, orient->value.uint[0]);
have_matrix = 1;
}
+134 -18
View File
@@ -59,8 +59,6 @@ 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]
@@ -129,6 +127,121 @@ 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);
@@ -180,22 +293,12 @@ fail:
}
/**
* 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.
* Populate the liboapv configuration from AVCodecContext and encoder options.
*
* 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.
* 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.
*
* @param[in] avctx codec context (AVCodecContext)
* @param[out] cdsc contains all APV encoder encoder parameters that should be initialized before the encoder is use
@@ -228,6 +331,13 @@ 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) {
@@ -275,6 +385,12 @@ 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;
}
@@ -426,7 +542,7 @@ static av_cold int liboapve_close(AVCodecContext *avctx)
{
ApvEncContext *apv = avctx->priv_data;
for (int i = 0; i < apv->num_frames; i++) {
for (int i = 0; i < apv->ifrms.num_frms; 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;
+13 -5
View File
@@ -225,7 +225,8 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata,
s->llviddsp.add_left_pred_int16(dst, dst, max, width, 0);
dst += stride;
}
lefttop = left = dst[0];
if (1 + interlaced < height)
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];
@@ -553,6 +554,13 @@ 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);
@@ -563,11 +571,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;
+6
View File
@@ -57,6 +57,12 @@ static av_cold int misc4_init(AVCodecContext *avctx)
{
MISC4Context *s = avctx->priv_data;
if (avctx->sample_rate <= 0)
return AVERROR_INVALIDDATA;
if (avctx->ch_layout.nb_channels != 1 && avctx->ch_layout.nb_channels != 2)
return AVERROR_INVALIDDATA;
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
switch (avctx->sample_rate) {
case 8000:
+3
View File
@@ -1453,6 +1453,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s)
int linesize[MAX_COMPONENTS];
GetBitContext mb_bitmask_gb = {0}; // initialize to silence gcc warning
int bytes_per_pixel = 1 + (s->bits > 8);
int field_pos = -1;
int ret;
if (s->avctx->codec_id == AV_CODEC_ID_MXPEG) {
@@ -1586,9 +1587,11 @@ next_field:
if (s->interlaced &&
bytestream2_get_bytes_left(&s->gB) > 2 &&
bytestream2_tell(&s->gB) > 2 &&
bytestream2_tell(&s->gB) != field_pos &&
s->gB.buffer[-2] == 0xFF &&
s->gB.buffer[-1] == 0xD1) {
av_log(s->avctx, AV_LOG_DEBUG, "AVRn interlaced picture marker found\n");
field_pos = bytestream2_tell(&s->gB);
s->bottom_field ^= 1;
goto next_field;
+11 -3
View File
@@ -65,6 +65,9 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, GetByteContext
} else if (run == 255) {
int pos = bytestream2_tell_p(pb);
if (!gbp)
return AVERROR_INVALIDDATA;
bytestream2_seek(gbp, pos, SEEK_SET);
if (pos + width - w < fill)
@@ -128,11 +131,16 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
bytestream2_init(&gb, s->decomp_buf, zstream->total_out);
bytestream2_init(&gbp, s->prev_frame->data[0], avctx->height * s->prev_frame->linesize[0]);
if (s->prev_frame->data[0])
bytestream2_init(&gbp, s->prev_frame->data[0], avctx->height * s->prev_frame->linesize[0]);
bytestream2_init_writer(&pb, frame->data[0], avctx->height * frame->linesize[0]);
if (rle_uncompress(&gb, &pb, &gbp, avctx->width, avctx->height, avctx->width * 3,
frame->linesize[0], s->prev_frame->linesize[0]))
ret = rle_uncompress(&gb, &pb, s->prev_frame->data[0] ? &gbp : NULL,
avctx->width, avctx->height, avctx->width * 3,
frame->linesize[0], s->prev_frame->linesize[0]);
if (ret < 0)
return ret;
if (ret)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
+8 -1
View File
@@ -263,8 +263,10 @@ static void nvenc_map_preset(NvencContext *ctx)
static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level)
{
#if NVENCAPI_CHECK_VERSION(13, 1)
#if NVENCAPI_CHECK_VERSION(13, 2)
const char *minver = "(unknown)";
#elif NVENCAPI_CHECK_VERSION(13, 1)
const char *minver = "610.00";
#elif NVENCAPI_CHECK_VERSION(13, 0)
const char *minver = "570.0";
#elif NVENCAPI_CHECK_VERSION(12, 2)
@@ -2526,7 +2528,12 @@ static void nvenc_fill_time_code(AVCodecContext *avctx, const AVFrame *frame, NV
unsigned hh, mm, ss, ff, drop;
ff_timecode_set_smpte(&drop, &hh, &mm, &ss, &ff, avctx->framerate, tc[i + 1], 0, 0);
#ifdef NVENC_NEW_COUNTING_TYPE
time_code->clockTimestamp[i].countingTypeLSB = 0;
time_code->clockTimestamp[i].countingTypeMSB = 0;
#else
time_code->clockTimestamp[i].countingType = 0;
#endif
time_code->clockTimestamp[i].discontinuityFlag = 0;
time_code->clockTimestamp[i].cntDroppedFrames = drop;
time_code->clockTimestamp[i].nFrames = ff;
+5
View File
@@ -111,6 +111,11 @@ typedef void ID3D11Device;
#define NVENC_HAVE_MVHEVC
#endif
// SDK 13.1 compile time feature checks
#if NVENCAPI_CHECK_VERSION(13, 1)
#define NVENC_NEW_COUNTING_TYPE
#endif
typedef struct NvencSurface
{
NV_ENC_INPUT_PTR input_surface;
+6
View File
@@ -866,6 +866,12 @@ static int on2avc_decode_frame(AVCodecContext * avctx, AVFrame *frame,
av_log(avctx, AV_LOG_ERROR, "No subframes present\n");
return AVERROR_INVALIDDATA;
}
if (num_frames > INT_MAX / ON2AVC_SUBFRAME_SIZE) {
av_log(avctx, AV_LOG_ERROR,
"Too many subframes (%d); per-frame sample count overflows\n",
num_frames);
return AVERROR_INVALIDDATA;
}
/* get output buffer */
frame->nb_samples = ON2AVC_SUBFRAME_SIZE * num_frames;
+2
View File
@@ -291,7 +291,9 @@ static const AVOption avcodec_options[] = {
{"bt709", "BT.709", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT709 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"gamma22", "BT.470 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA22 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"bt470m", "BT.470 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA22 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"gamma28", "BT.470 BG", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA28 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"bt470bg", "BT.470 BG", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA28 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"smpte170m", "SMPTE 170 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE170M }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"smpte240m", "SMPTE 240 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE240M }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
{"linear", "Linear", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LINEAR }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
+5
View File
@@ -414,6 +414,11 @@ static int decode_frame(AVCodecContext *avctx,
/* Flags */
int flags = bytestream2_get_be16(&gb_hdr);
int align = (flags >> 1) & 0x7;
if (align > 4) {
av_log(avctx, AV_LOG_ERROR,
"Invalid tile alignment %d (max 4)\n", align);
return AVERROR_INVALIDDATA;
}
/* Quantization matrix */
if (flags & 1)
+2 -1
View File
@@ -415,8 +415,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
H263DecContext *const h = &rv->h;
int mb_count, mb_pos, left, start_mb_x, active_bits_size, ret;
if ((ret = init_get_bits8(&h->gb, buf, FFMAX(buf_size, buf_size2))) < 0)
return ret;
active_bits_size = buf_size * 8;
init_get_bits(&h->gb, buf, FFMAX(buf_size, buf_size2) * 8);
if (h->c.codec_id == AV_CODEC_ID_RV10)
mb_count = rv10_decode_picture_header(h);
else
+8 -3
View File
@@ -1427,7 +1427,9 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
int mb_pos, slice_type;
int res;
init_get_bits(gb, buf, buf_size*8);
res = init_get_bits8(gb, buf, buf_size);
if (res < 0)
return res;
res = r->parse_slice_header(r, gb, &r->si);
if(res < 0){
av_log(s->avctx, AV_LOG_ERROR, "Incorrect or unknown slice header\n");
@@ -1647,7 +1649,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
return AVERROR_INVALIDDATA;
}
init_get_bits(&r->gb, buf+offset, (buf_size-offset)*8);
if ((ret = init_get_bits8(&r->gb, buf+offset, buf_size-offset)) < 0)
return ret;
if (r->parse_slice_header(r, &r->gb, &si) < 0 || si.start) {
av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
return AVERROR_INVALIDDATA;
@@ -1777,7 +1780,9 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
break;
}
init_get_bits(&r->gb, buf+offset1, (buf_size-offset1)*8);
ret = init_get_bits8(&r->gb, buf+offset1, buf_size-offset1);
if (ret < 0)
return ret;
if (r->parse_slice_header(r, &r->gb, &si) < 0) {
size = offset2 - offset;
}else
+6
View File
@@ -1228,6 +1228,9 @@ static int old_codec37(SANMVideoContext *ctx, GetByteContext *gb, int top, int l
if (width > ctx->aligned_width)
return AVERROR_INVALIDDATA;
if (FFALIGN(height, 4) > ctx->aligned_height)
return AVERROR_INVALIDDATA;
if (bytestream2_get_bytes_left(gb) < 16)
return AVERROR_INVALIDDATA;
@@ -1551,6 +1554,9 @@ static int old_codec47(SANMVideoContext *ctx, GetByteContext *gb, int top, int l
if (width > ctx->aligned_width)
return AVERROR_INVALIDDATA;
if (FFALIGN(height, 8) > ctx->aligned_height)
return AVERROR_INVALIDDATA;
if (bytestream2_get_bytes_left(gb) < 26)
return AVERROR_INVALIDDATA;
+15 -9
View File
@@ -705,13 +705,15 @@ static int get_dc(SnowEncContext *enc, int mb_x, int mb_y, int plane_index)
for(y2= FFMAX(y, 0); y2<FFMIN(h, y+block_h); y2++){
for(x2= FFMAX(x, 0); x2<FFMIN(w, x+block_w); x2++){
int index= x2-(block_w*mb_x - block_w/2) + (y2-(block_h*mb_y - block_h/2))*obmc_stride;
int col= x2-(block_w*mb_x - block_w/2);
int row= y2-(block_h*mb_y - block_h/2);
int index= col + row*obmc_stride;
int obmc_v= obmc[index];
int d;
if(y<0) obmc_v += obmc[index + block_h*obmc_stride];
if(x<0) obmc_v += obmc[index + block_w];
if(y+block_h>h) obmc_v += obmc[index - block_h*obmc_stride];
if(x+block_w>w) obmc_v += obmc[index - block_w];
if(y<0) obmc_v += obmc[index + block_h*obmc_stride];
if(x<0) obmc_v += obmc[index + block_w];
if(y+block_h>h && row-block_h >= 0) obmc_v += obmc[index - block_h*obmc_stride];
if(x+block_w>w && col-block_w >= 0) obmc_v += obmc[index - block_w];
//FIXME precalculate this or simplify it somehow else
d = -dst[index] + (1<<(FRAC_BITS-1));
@@ -723,6 +725,9 @@ static int get_dc(SnowEncContext *enc, int mb_x, int mb_y, int plane_index)
}
*b= backup;
if (!aa)
return 0;
return av_clip_uint8( ROUNDED_DIV((int64_t)ab<<LOG2_OBMC_MAX, aa) ); //FIXME we should not need clipping
}
@@ -820,13 +825,14 @@ static int get_block_rd(SnowEncContext *enc, int mb_x, int mb_y,
&& (mb_x == 0 || mb_x == b_stride-1)
&& (mb_y == 0 || mb_y == b_height-1)){
if(mb_x == 0)
x1 = block_w;
x1 = FFMIN(x1, block_w);
else
x0 = block_w;
x0 = FFMAX(x0, block_w);
if(mb_y == 0)
y1 = block_h;
y1 = FFMIN(y1, block_h);
else
y0 = block_h;
y0 = FFMAX(y0, block_h);
x0 = FFMIN(x0, x1);
for(y=y0; y<y1; y++)
memcpy(dst + sx+x0 + (sy+y)*ref_stride, cur + x0 + y*ref_stride, x1-x0);
}
+1
View File
@@ -127,6 +127,7 @@ static av_cold int tdsc_init(AVCodecContext *avctx)
ctx->jpeg_avctx->flags = avctx->flags;
ctx->jpeg_avctx->flags2 = avctx->flags2;
ctx->jpeg_avctx->idct_algo = avctx->idct_algo;
ctx->jpeg_avctx->max_pixels = avctx->max_pixels;
ret = avcodec_open2(ctx->jpeg_avctx, NULL, NULL);
if (ret < 0)
return ret;
+5
View File
@@ -323,6 +323,11 @@ static int truespeech_decode_frame(AVCodecContext *avctx, AVFrame *frame,
"Too small input buffer (%d bytes), need at least 32 bytes\n", buf_size);
return -1;
}
if (iterations > INT_MAX / 240) {
av_log(avctx, AV_LOG_ERROR,
"Too large input buffer (%d bytes); per-block sample count overflows\n", buf_size);
return AVERROR_INVALIDDATA;
}
/* get output buffer */
frame->nb_samples = iterations * 240;
+33 -33
View File
@@ -56,7 +56,7 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
ptrdiff_t stride, int width, int height)
{
int x, y;
dwtcoef *datal = data, *synth = t->buffer, *synthl = synth;
uint32_t *datal = (uint32_t *)data, *synth = (uint32_t *)t->buffer, *synthl = synth;
const ptrdiff_t synth_width = width << 1;
const ptrdiff_t synth_height = height << 1;
@@ -75,21 +75,21 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
synthl = synth;
for (y = 0; y < synth_height; y++) {
/* Lifting stage 2. */
synthl[1] -= (8*synthl[0] + 9*synthl[2] - synthl[4] + 8) >> 4;
synthl[1] -= (dwtcoef)(8*synthl[0] + 9*synthl[2] - synthl[4] + 8) >> 4;
for (x = 1; x < width - 2; x++)
synthl[2*x + 1] -= (9*synthl[2*x] + 9*synthl[2*x + 2] - synthl[2*x + 4] -
synthl[2*x + 1] -= (dwtcoef)(9*synthl[2*x] + 9*synthl[2*x + 2] - synthl[2*x + 4] -
synthl[2 * x - 2] + 8) >> 4;
synthl[synth_width - 1] -= (17*synthl[synth_width - 2] -
synthl[synth_width - 1] -= (dwtcoef)(17*synthl[synth_width - 2] -
synthl[synth_width - 4] + 8) >> 4;
synthl[synth_width - 3] -= (8*synthl[synth_width - 2] +
synthl[synth_width - 3] -= (dwtcoef)(8*synthl[synth_width - 2] +
9*synthl[synth_width - 4] -
synthl[synth_width - 6] + 8) >> 4;
/* Lifting stage 1. */
synthl[0] += (synthl[1] + synthl[1] + 2) >> 2;
synthl[0] += (dwtcoef)(synthl[1] + synthl[1] + 2) >> 2;
for (x = 1; x < width - 1; x++)
synthl[2*x] += (synthl[2*x - 1] + synthl[2*x + 1] + 2) >> 2;
synthl[2*x] += (dwtcoef)(synthl[2*x - 1] + synthl[2*x + 1] + 2) >> 2;
synthl[synth_width - 2] += (synthl[synth_width - 3] +
synthl[synth_width - 2] += (dwtcoef)(synthl[synth_width - 3] +
synthl[synth_width - 1] + 2) >> 2;
synthl += synth_width;
}
@@ -97,13 +97,13 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
/* Vertical synthesis: Lifting stage 2. */
synthl = synth + synth_width;
for (x = 0; x < synth_width; x++)
synthl[x] -= (8*synthl[x - synth_width] + 9*synthl[x + synth_width] -
synthl[x] -= (dwtcoef)(8*synthl[x - synth_width] + 9*synthl[x + synth_width] -
synthl[x + 3 * synth_width] + 8) >> 4;
synthl = synth + (synth_width << 1);
for (y = 1; y < height - 2; y++) {
for (x = 0; x < synth_width; x++)
synthl[x + synth_width] -= (9*synthl[x] +
synthl[x + synth_width] -= (dwtcoef)(9*synthl[x] +
9*synthl[x + 2 * synth_width] -
synthl[x - 2 * synth_width] -
synthl[x + 4 * synth_width] + 8) >> 4;
@@ -112,36 +112,36 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
synthl = synth + (synth_height - 1) * synth_width;
for (x = 0; x < synth_width; x++) {
synthl[x] -= (17*synthl[x - synth_width] -
synthl[x] -= (dwtcoef)(17*synthl[x - synth_width] -
synthl[x - 3*synth_width] + 8) >> 4;
synthl[x - 2*synth_width] -= (9*synthl[x - 3*synth_width] +
synthl[x - 2*synth_width] -= (dwtcoef)(9*synthl[x - 3*synth_width] +
8*synthl[x - 1*synth_width] - synthl[x - 5*synth_width] + 8) >> 4;
}
/* Vertical synthesis: Lifting stage 1. */
synthl = synth;
for (x = 0; x < synth_width; x++)
synthl[x] += (synthl[x + synth_width] + synthl[x + synth_width] + 2) >> 2;
synthl[x] += (dwtcoef)(synthl[x + synth_width] + synthl[x + synth_width] + 2) >> 2;
synthl = synth + (synth_width << 1);
for (y = 1; y < height - 1; y++) {
for (x = 0; x < synth_width; x++)
synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
synthl[x] += (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
synthl += synth_width << 1;
}
synthl = synth + (synth_height - 2) * synth_width;
for (x = 0; x < synth_width; x++)
synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
synthl[x] += (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
deinterleave(data, stride, width, height, synth);
deinterleave(data, stride, width, height, (dwtcoef *)synth);
}
static void vc2_subband_dwt_53(VC2TransformContext *t, dwtcoef *data,
ptrdiff_t stride, int width, int height)
{
int x, y;
dwtcoef *synth = t->buffer, *synthl = synth, *datal = data;
uint32_t *synth = (uint32_t *)t->buffer, *synthl = synth, *datal = (uint32_t *)data;
const ptrdiff_t synth_width = width << 1;
const ptrdiff_t synth_height = height << 1;
@@ -161,16 +161,16 @@ static void vc2_subband_dwt_53(VC2TransformContext *t, dwtcoef *data,
for (y = 0; y < synth_height; y++) {
/* Lifting stage 2. */
for (x = 0; x < width - 1; x++)
synthl[2 * x + 1] -= (synthl[2 * x] + synthl[2 * x + 2] + 1) >> 1;
synthl[2 * x + 1] -= (dwtcoef)(synthl[2 * x] + synthl[2 * x + 2] + 1) >> 1;
synthl[synth_width - 1] -= (2*synthl[synth_width - 2] + 1) >> 1;
synthl[synth_width - 1] -= (dwtcoef)(2*synthl[synth_width - 2] + 1) >> 1;
/* Lifting stage 1. */
synthl[0] += (2*synthl[1] + 2) >> 2;
synthl[0] += (dwtcoef)(2*synthl[1] + 2) >> 2;
for (x = 1; x < width - 1; x++)
synthl[2 * x] += (synthl[2 * x - 1] + synthl[2 * x + 1] + 2) >> 2;
synthl[2 * x] += (dwtcoef)(synthl[2 * x - 1] + synthl[2 * x + 1] + 2) >> 2;
synthl[synth_width - 2] += (synthl[synth_width - 3] + synthl[synth_width - 1] + 2) >> 2;
synthl[synth_width - 2] += (dwtcoef)(synthl[synth_width - 3] + synthl[synth_width - 1] + 2) >> 2;
synthl += synth_width;
}
@@ -178,37 +178,37 @@ static void vc2_subband_dwt_53(VC2TransformContext *t, dwtcoef *data,
/* Vertical synthesis: Lifting stage 2. */
synthl = synth + synth_width;
for (x = 0; x < synth_width; x++)
synthl[x] -= (synthl[x - synth_width] + synthl[x + synth_width] + 1) >> 1;
synthl[x] -= (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 1) >> 1;
synthl = synth + (synth_width << 1);
for (y = 1; y < height - 1; y++) {
for (x = 0; x < synth_width; x++)
synthl[x + synth_width] -= (synthl[x] + synthl[x + synth_width * 2] + 1) >> 1;
synthl[x + synth_width] -= (dwtcoef)(synthl[x] + synthl[x + synth_width * 2] + 1) >> 1;
synthl += (synth_width << 1);
}
synthl = synth + (synth_height - 1) * synth_width;
for (x = 0; x < synth_width; x++)
synthl[x] -= (2*synthl[x - synth_width] + 1) >> 1;
synthl[x] -= (dwtcoef)(2*synthl[x - synth_width] + 1) >> 1;
/* Vertical synthesis: Lifting stage 1. */
synthl = synth;
for (x = 0; x < synth_width; x++)
synthl[x] += (2*synthl[synth_width + x] + 2) >> 2;
synthl[x] += (dwtcoef)(2*synthl[synth_width + x] + 2) >> 2;
synthl = synth + (synth_width << 1);
for (y = 1; y < height - 1; y++) {
for (x = 0; x < synth_width; x++)
synthl[x] += (synthl[x + synth_width] + synthl[x - synth_width] + 2) >> 2;
synthl[x] += (dwtcoef)(synthl[x + synth_width] + synthl[x - synth_width] + 2) >> 2;
synthl += (synth_width << 1);
}
synthl = synth + (synth_height - 2)*synth_width;
for (x = 0; x < synth_width; x++)
synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
synthl[x] += (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
deinterleave(data, stride, width, height, synth);
deinterleave(data, stride, width, height, (dwtcoef *)synth);
}
static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
@@ -216,7 +216,7 @@ static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
const int s)
{
int x, y;
dwtcoef *synth = t->buffer, *synthl = synth, *datal = data;
uint32_t *synth = (uint32_t *)t->buffer, *synthl = synth, *datal = (uint32_t *)data;
const ptrdiff_t synth_width = width << 1;
const ptrdiff_t synth_height = height << 1;
@@ -225,7 +225,7 @@ static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
for (x = 0; x < synth_width; x += 2) {
synthl[y*synth_width + x + 1] = (datal[y*stride + x + 1] - datal[y*stride + x]) * (1 << s);
synthl[y*synth_width + x] = datal[y*stride + x + 0] * (1 << s) +
((synthl[y*synth_width + x + 1] + 1) >> 1);
((dwtcoef)(synthl[y*synth_width + x + 1] + 1) >> 1);
}
}
@@ -235,11 +235,11 @@ static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
synthl[(y + 1)*synth_width + x] = synthl[(y + 1)*synth_width + x] -
synthl[y*synth_width + x];
synthl[y*synth_width + x] = synthl[y*synth_width + x] +
((synthl[(y + 1)*synth_width + x] + 1) >> 1);
((dwtcoef)(synthl[(y + 1)*synth_width + x] + 1) >> 1);
}
}
deinterleave(data, stride, width, height, synth);
deinterleave(data, stride, width, height, (dwtcoef *)synth);
}
static void vc2_subband_dwt_haar(VC2TransformContext *t, dwtcoef *data,
+1 -1
View File
@@ -30,7 +30,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 28
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
+8 -8
View File
@@ -772,14 +772,6 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx, FFVulkanEncodeContext *
return AVERROR(EINVAL);
}
if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
feedback_flags) {
av_log (avctx, AV_LOG_ERROR,
"Driver does not support required encode feedback flags "
"(BUFFER_OFFSET and BYTES_WRITTEN).\n");
return AVERROR(ENOTSUP);
}
ctx->base.op = &vulkan_base_encode_ops;
ctx->codec = codec;
@@ -881,6 +873,14 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx, FFVulkanEncodeContext *
return AVERROR_EXTERNAL;
}
if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
feedback_flags) {
av_log(avctx, AV_LOG_ERROR,
"Driver does not support required encode feedback flags "
"(BUFFER_OFFSET and BYTES_WRITTEN).\n");
return AVERROR(ENOTSUP);
}
err = init_rc(avctx, ctx);
if (err < 0)
return err;
+2 -2
View File
@@ -41,8 +41,8 @@ align 16
mova m1, [angq+block_sizeq]
xorps m2, m2
xorps m3, m3
cmpleps m2, m0 ; m <= 0.0
cmpleps m3, m1 ; a <= 0.0
cmpltps m2, m0 ; m < 0.0
cmpltps m3, m1 ; a < 0.0
andps m2, m5 ; keep only the sign bit
xorps m1, m2
mova m4, m3
+4 -2
View File
@@ -381,8 +381,10 @@ int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stre
ret = AVERROR(ENOMEM);
goto fail;
}
new_device->device_name = av_strdup(name);
if ((tmp = strrchr(descr, '\n')) && tmp[1])
new_device->device_name = av_strdup(name ? name : "");
if (!descr)
new_device->device_description = av_strdup("");
else if ((tmp = strrchr(descr, '\n')) && tmp[1])
new_device->device_description = av_strdup(&tmp[1]);
else
new_device->device_description = av_strdup(descr);
+1 -1
View File
@@ -30,7 +30,7 @@
#include "version_major.h"
#define LIBAVDEVICE_VERSION_MINOR 3
#define LIBAVDEVICE_VERSION_MICRO 101
#define LIBAVDEVICE_VERSION_MICRO 102
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
+2 -2
View File
@@ -196,8 +196,8 @@ static int fn(filter_channels)(AVFilterContext *ctx, void *arg, int jobnr, int n
{
AudioAPContext *s = ctx->priv;
AVFrame *out = arg;
const int start = (out->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (out->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(out->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(out->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int c = start; c < end; c++) {
const ftype *input = (const ftype *)s->frame[0]->extended_data[c];
+2 -2
View File
@@ -269,8 +269,8 @@ static int fn(filter_channels)(AVFilterContext *ctx, void *arg, int jobnr, int n
const ftype tqfactor = s->tqfactor;
const ftype itqfactor = ONE / tqfactor;
const ftype fg = TAN(M_PI * tfrequency / sample_rate);
const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(in->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(in->ch_layout.nb_channels, jobnr + 1, nb_jobs);
const int is_disabled = ctx->is_disabled;
const int detection = s->detection;
const int tftype = s->tftype;
+2 -2
View File
@@ -397,8 +397,8 @@ static int filter_channels_## name(AVFilterContext *ctx, void *arg, int jobnr, i
AudioCrossoverContext *s = ctx->priv; \
AVFrame *in = arg; \
AVFrame **frames = s->frames; \
const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs; \
const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs; \
const int start = ff_slice_pos(in->ch_layout.nb_channels, jobnr, nb_jobs); \
const int end = ff_slice_pos(in->ch_layout.nb_channels, jobnr + 1, nb_jobs); \
const int nb_samples = in->nb_samples; \
const int nb_outs = ctx->nb_outputs; \
const int first_order = s->first_order; \
+2 -2
View File
@@ -161,8 +161,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
ThreadData *td = arg;
AVFrame *out = td->out;
AVFrame *in = td->in;
const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(in->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(in->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++)
s->filter_channel(ctx, ch, in, out);
+2 -2
View File
@@ -188,8 +188,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
ThreadData *td = arg;
AVFrame *out = td->out;
AVFrame *in = td->in;
const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(in->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(in->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++) {
s->filter[s->type](ctx, out->extended_data[ch],
+2 -2
View File
@@ -349,8 +349,8 @@ static int drc_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AudioDRCContext *s = ctx->priv;
AVFrame *in = s->in;
AVFrame *out = arg;
const int start = (out->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (out->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(out->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(out->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++)
drc_channel(ctx, in, out, ch);
+2 -2
View File
@@ -105,8 +105,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
ThreadData *td = arg;
AVFrame *out = td->out;
AVFrame *in = td->in;
const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(in->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(in->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++) {
const double *src = (const double *)in->extended_data[ch];
+2 -2
View File
@@ -1052,8 +1052,8 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
{
AudioFFTDeNoiseContext *s = ctx->priv;
AVFrame *in = arg;
const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(in->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(in->ch_layout.nb_channels, jobnr + 1, nb_jobs);
const int window_length = s->window_length;
const double *window = s->window;
+4 -4
View File
@@ -233,8 +233,8 @@ static int tx_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
AFFTFiltContext *s = ctx->priv;
const int channels = s->channels;
const int start = (channels * jobnr) / nb_jobs;
const int end = (channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(channels, jobnr, nb_jobs);
const int end = ff_slice_pos(channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++) {
AVComplexFloat *fft_in = s->fft_in[ch];
@@ -253,8 +253,8 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
const float *window_lut = s->window_func_lut;
const float f = sqrtf(1.f - s->overlap);
const int channels = s->channels;
const int start = (channels * jobnr) / nb_jobs;
const int end = (channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(channels, jobnr, nb_jobs);
const int end = ff_slice_pos(channels, jobnr + 1, nb_jobs);
double values[VAR_VARS_NB];
memcpy(values, arg, sizeof(values));
+2 -2
View File
@@ -156,8 +156,8 @@ static int fir_channel(AVFilterContext *ctx, AVFrame *out, int ch)
static int fir_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
AVFrame *out = arg;
const int start = (out->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (out->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(out->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(out->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++)
fir_channel(ctx, out, ch);
+2 -2
View File
@@ -292,8 +292,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
ThreadData *td = arg;
AVFrame *out = td->out;
AVFrame *in = td->in;
const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(in->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(in->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++)
s->filter_channel(ctx, ch, in, out);
+2 -2
View File
@@ -687,8 +687,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg,
{
AudioNEqualizerContext *s = ctx->priv;
AVFrame *buf = arg;
const int start = (buf->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (buf->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(buf->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(buf->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int i = 0; i < s->nb_filters; i++) {
EqualizatorFilter *f = &s->filters[i];
+2 -2
View File
@@ -532,8 +532,8 @@ static int psy_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
AudioPsyClipContext *s = ctx->priv;
AVFrame *out = arg;
const int start = (out->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (out->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(out->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(out->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++)
psy_channel(ctx, s->in, out, ch);
+2 -2
View File
@@ -1411,8 +1411,8 @@ static int rnnoise_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
ThreadData *td = arg;
AVFrame *in = td->in;
AVFrame *out = td->out;
const int start = (out->ch_layout.nb_channels * jobnr) / nb_jobs;
const int end = (out->ch_layout.nb_channels * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(out->ch_layout.nb_channels, jobnr, nb_jobs);
const int end = ff_slice_pos(out->ch_layout.nb_channels, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++) {
rnnoise_channel(s, &s->st[ch],

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