New upstream version 8.1.2

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
nyanmisaka
2026-06-30 01:00:02 +08:00
parent cb9d33e339
commit 621dde56e2
262 changed files with 1974 additions and 1075 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
@@ -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
+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],
+6 -6
View File
@@ -52,8 +52,8 @@ static int sdr_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)\
AVFrame *u = s->cache[0]; \
AVFrame *v = s->cache[1]; \
const int channels = u->ch_layout.nb_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); \
const int nb_samples = u->nb_samples; \
\
for (int ch = start; ch < end; ch++) { \
@@ -85,8 +85,8 @@ static int sisdr_##name(AVFilterContext *ctx, void *arg,int jobnr,int nb_jobs)\
AVFrame *u = s->cache[0]; \
AVFrame *v = s->cache[1]; \
const int channels = u->ch_layout.nb_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); \
const int nb_samples = u->nb_samples; \
\
for (int ch = start; ch < end; ch++) { \
@@ -121,8 +121,8 @@ static int psnr_##name(AVFilterContext *ctx, void *arg, int jobnr,int nb_jobs)\
AVFrame *u = s->cache[0]; \
AVFrame *v = s->cache[1]; \
const int channels = u->ch_layout.nb_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); \
const int nb_samples = u->nb_samples; \
\
for (int ch = start; ch < end; ch++) { \
+2 -2
View File
@@ -410,8 +410,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
AVFrame *in = td->in;
const int channels = td->channels;
const int nb_samples = td->nb_samples;
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);
s->filter(s, (void **)out->extended_data, (const void **)in->extended_data,
nb_samples, channels, start, end);
+2 -2
View File
@@ -438,8 +438,8 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
const float *window_func_lut = s->window_func_lut;
AVFrame *in = arg;
const int channels = s->nb_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);
const int offset = s->win_size - s->hop_size;
for (int ch = start; ch < end; ch++) {
+2 -2
View File
@@ -684,8 +684,8 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
const uint8_t * const * const data = (const uint8_t * const *)buf->extended_data;
const int channels = s->nb_channels;
const int samples = buf->nb_samples;
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);
switch (inlink->format) {
case AV_SAMPLE_FMT_DBLP:
+2 -2
View File
@@ -108,8 +108,8 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
const double b2 = s->b2;
const double a1 = -s->a1;
const double a2 = -s->a2;
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 buffer_samples = s->buffer_samples;
for (int ch = start; ch < end; ch++) {
+2 -2
View File
@@ -210,8 +210,8 @@ static int filter_channels_## name(AVFilterContext *ctx, void *arg, \
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); \
const double level = s->level; \
\
for (int ch = start; ch < end; ch++) { \
+2 -2
View File
@@ -125,8 +125,8 @@ static int filter_channels_## name(AVFilterContext *ctx, void *arg, \
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); \
const type level = s->level; \
\
for (int ch = start; ch < end; ch++) { \
+2 -2
View File
@@ -1242,8 +1242,8 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
AVFrame *buf = td->in;
AVFrame *out_buf = td->out;
BiquadsContext *s = ctx->priv;
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);
int ch;
for (ch = start; ch < end; ch++) {
+2 -2
View File
@@ -65,8 +65,8 @@ static int filter_## inverse ##_## fmt ##_## clp(AVFilterContext *ctx, \
const int channels = td->channels; \
const type mult = td->mult; \
const type scale = one / (-mult + one); \
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); \
\
if (packed) { \
type *prv = p[0]; \
+4 -4
View File
@@ -579,8 +579,8 @@ static int update_gain_histories(AVFilterContext *ctx, void *arg, int jobnr, int
DynamicAudioNormalizerContext *s = ctx->priv;
AVFrame *analyze_frame = arg;
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 c = start; c < end; c++)
update_gain_history(s, c, get_max_local_gain(s, analyze_frame, c));
@@ -824,8 +824,8 @@ static int amplify_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
AVFrame *in = td->in;
const int enabled = td->enabled;
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++)
amplify_channel(s, in, out, enabled, ch);
+1 -1
View File
@@ -469,7 +469,7 @@ static int try_push_frame(AVFilterContext *ctx)
for (j = 0; j < nb_buffers; j++)
if (s->buffers[j]->buffer == buf->buffer)
break;
if (j == i)
if (j == nb_buffers)
s->buffers[nb_buffers++] = buf;
}
+4 -4
View File
@@ -1261,8 +1261,8 @@ static int fft_channel(AVFilterContext *ctx, AVFrame *in, int ch)
static int fft_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
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);
for (int ch = start; ch < end; ch++)
fft_channel(ctx, in, ch);
@@ -1302,8 +1302,8 @@ static int ifft_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
{
AudioSurroundContext *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++) {
if (s->upmix)
+2 -2
View File
@@ -106,8 +106,8 @@ static int fn(filter_channels)(AVFilterContext *ctx, void *arg, int jobnr, int n
{
AudioNLMSContext *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
@@ -133,8 +133,8 @@ static int fn(filter_channels)(AVFilterContext *ctx, void *arg, int jobnr, int n
{
AudioRLSContext *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
@@ -201,8 +201,8 @@ static int fade(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AudioVectorScopeContext *s = ctx->priv;
const int linesize = s->outpicref->linesize[0];
const int height = s->outpicref->height;
const int slice_start = (height * jobnr ) / nb_jobs;
const int slice_end = (height * (jobnr+1)) / nb_jobs;
const int slice_start = ff_slice_pos(height, jobnr, nb_jobs);
const int slice_end = ff_slice_pos(height, jobnr + 1, nb_jobs);
if (s->fade[0] == 255 && s->fade[1] == 255 && s->fade[2] == 255) {
for (int i = slice_start; i < slice_end; i++)
+16 -15
View File
@@ -446,8 +446,8 @@ static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
const ptrdiff_t alinesize = s->outpicref->linesize[3];
const float log_factor = 1.f/logf(s->logarithmic_basis);
const int count = s->frequency_band_count;
const int start = (count * jobnr) / nb_jobs;
const int end = (count * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(count, jobnr, nb_jobs);
const int end = ff_slice_pos(count, jobnr + 1, nb_jobs);
const int nb_channels = s->nb_channels;
const int iscale = s->intensity_scale;
const int ihop_index = s->ihop_index;
@@ -650,8 +650,8 @@ static int run_channel_cwt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
const float scale = 1.f / input_padding_size;
const int ihop_size = s->ihop_size;
const int count = s->frequency_band_count;
const int start = (count * jobnr) / nb_jobs;
const int end = (count * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(count, jobnr, nb_jobs);
const int end = ff_slice_pos(count, jobnr + 1, nb_jobs);
for (int y = start; y < end; y++) {
AVComplexFloat *chout = ((AVComplexFloat *)s->ch_out->extended_data[y]) + ch * ihop_size;
@@ -753,7 +753,7 @@ static int compute_kernel(AVFilterContext *ctx)
}
}
for (int n = b; n >= a; n--) {
for (int n = b - 1; n >= a; n--) {
if (tkernel[n+range] != 0.f) {
if (tkernel[n+range] > FLT_MIN)
av_log(ctx, AV_LOG_DEBUG, "out of range kernel %g\n", tkernel[n+range]);
@@ -808,6 +808,7 @@ static int config_output(AVFilterLink *outlink)
float maximum_frequency = fminf(s->maximum_frequency, limit_frequency);
float minimum_frequency = s->minimum_frequency;
float scale = 1.f, factor;
double nb_samples;
int ret;
if (minimum_frequency >= maximum_frequency) {
@@ -877,11 +878,11 @@ static int config_output(AVFilterLink *outlink)
if (!s->frequency_band)
return AVERROR(ENOMEM);
s->nb_consumed_samples = inlink->sample_rate *
frequency_band(s->frequency_band,
s->frequency_band_count, maximum_frequency - minimum_frequency,
minimum_frequency, s->frequency_scale, s->deviation);
s->nb_consumed_samples = FFMIN(s->nb_consumed_samples, 65536);
nb_samples = inlink->sample_rate *
frequency_band(s->frequency_band,
s->frequency_band_count, maximum_frequency - minimum_frequency,
minimum_frequency, s->frequency_scale, s->deviation);
s->nb_consumed_samples = av_clip(av_clipd(nb_samples, 1, 65536), 1, 65536);
s->nb_threads = FFMIN(s->frequency_band_count, ff_filter_get_nb_threads(ctx));
s->nb_channels = inlink->ch_layout.nb_channels;
@@ -1060,7 +1061,7 @@ static int output_frame(AVFilterContext *ctx)
for (int p = 0; p < nb_planes; p++) {
ptrdiff_t linesize = s->outpicref->linesize[p];
for (int y = 0; y < s->sono_size; y++) {
for (int y = 0; y < s->sono_size - 1; y++) {
uint8_t *dst = s->outpicref->data[p] + y * linesize;
memmove(dst, dst + linesize, s->w);
@@ -1140,7 +1141,7 @@ static int output_frame(AVFilterContext *ctx)
case DIRECTION_RL:
for (int p = 0; p < nb_planes; p++) {
ptrdiff_t linesize = s->outpicref->linesize[p];
const int size = s->w - s->pos;
const int size = FFMIN(s->pos + 1, s->sono_size);
const int fill = p > 0 && p < 3 ? 128 : 0;
for (int y = 0; y < s->h; y++) {
@@ -1167,7 +1168,7 @@ static int output_frame(AVFilterContext *ctx)
ptrdiff_t linesize = s->outpicref->linesize[p];
const int fill = p > 0 && p < 3 ? 128 : 0;
for (int y = s->h - s->pos; y >= 0; y--) {
for (int y = FFMIN(s->pos, s->sono_size - 1); y >= 0; y--) {
uint8_t *dst = s->outpicref->data[p] + y * linesize;
memset(dst, fill, s->w);
@@ -1222,8 +1223,8 @@ static int run_channels_cwt_prepare(AVFilterContext *ctx, void *arg, int jobnr,
{
ShowCWTContext *s = ctx->priv;
const int count = s->nb_channels;
const int start = (count * jobnr) / nb_jobs;
const int end = (count * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(count, jobnr, nb_jobs);
const int end = ff_slice_pos(count, jobnr + 1, nb_jobs);
for (int ch = start; ch < end; ch++)
run_channel_cwt_prepare(ctx, arg, jobnr, ch);
+5 -5
View File
@@ -1143,6 +1143,11 @@ static int config_output(AVFilterLink *outlink)
float scale = 1.f;
ret = av_tx_init(&s->fft[i], &s->tx_fn, AV_TX_FLOAT_FFT, 0, fft_size << (!!s->stop), &scale, 0);
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Unable to create FFT context. "
"The window size might be too high.\n");
return ret;
}
if (s->stop) {
ret = av_tx_init(&s->ifft[i], &s->itx_fn, AV_TX_FLOAT_FFT, 1, fft_size << (!!s->stop), &scale, 0);
if (ret < 0) {
@@ -1151,11 +1156,6 @@ static int config_output(AVFilterLink *outlink)
return ret;
}
}
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Unable to create FFT context. "
"The window size might be too high.\n");
return ret;
}
}
s->magnitudes = av_calloc(s->nb_display_channels, sizeof(*s->magnitudes));
+2 -2
View File
@@ -114,9 +114,9 @@ int ff_boxblur_eval_filter_params(AVFilterLink *inlink,
#define CHECK_RADIUS_VAL(w_, h_, comp) \
if (comp->radius < 0 || \
2*comp->radius > FFMIN(w_, h_)) { \
2*comp->radius >= FFMIN(w_, h_)) { \
av_log(ctx, AV_LOG_ERROR, \
"Invalid " #comp " radius value %d, must be >= 0 and <= %d\n", \
"Invalid " #comp " radius value %d, must be >= 0 and < %d\n", \
comp->radius, FFMIN(w_, h_)/2); \
return AVERROR(EINVAL); \
}
+4 -4
View File
@@ -54,8 +54,8 @@ static av_always_inline int fn(filter_slice_rgba_planar)(AVFilterContext *ctx, v
AVFrame *out = td->out;
const float pa = s->preserve_amount;
const float max = (1 << depth) - 1;
const int slice_start = (out->height * jobnr) / nb_jobs;
const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
const int slice_start = ff_slice_pos(out->height, jobnr, nb_jobs);
const int slice_end = ff_slice_pos(out->height, jobnr + 1, nb_jobs);
const pixel *srcg = (const pixel *)(in->data[0] + slice_start * in->linesize[0]);
const pixel *srcb = (const pixel *)(in->data[1] + slice_start * in->linesize[1]);
const pixel *srcr = (const pixel *)(in->data[2] + slice_start * in->linesize[2]);
@@ -172,8 +172,8 @@ static av_always_inline int fn(filter_slice_rgba_packed)(AVFilterContext *ctx, v
AVFrame *out = td->out;
const float pa = s->preserve_amount;
const float max = (1 << depth) - 1;
const int slice_start = (out->height * jobnr) / nb_jobs;
const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
const int slice_start = ff_slice_pos(out->height, jobnr, nb_jobs);
const int slice_end = ff_slice_pos(out->height, jobnr + 1, nb_jobs);
const uint8_t roffset = s->rgba_map[R];
const uint8_t goffset = s->rgba_map[G];
const uint8_t boffset = s->rgba_map[B];
+10 -3
View File
@@ -445,15 +445,22 @@ static int config_audio_output(AVFilterLink *outlink)
if (!ebur128->ch_weighting || !ebur128->dsp.y || !ebur128->dsp.z)
return AVERROR(ENOMEM);
#define I400_BINS(x) ((x) * 4 / 10)
#define I400_BINS(x) ((x) * 2 / 5)
#define I3000_BINS(x) ((x) * 3)
if (outlink->sample_rate > INT_MAX/3U || outlink->sample_rate < 3)
return AVERROR(EINVAL);
ebur128->i400.cache_size = I400_BINS(outlink->sample_rate);
ebur128->i3000.cache_size = I3000_BINS(outlink->sample_rate);
size_t i400_count, i3000_count;
if (av_size_mult(nb_channels, ebur128->i400.cache_size, &i400_count) < 0 || i400_count > INT_MAX ||
av_size_mult(nb_channels, ebur128->i3000.cache_size, &i3000_count) < 0 || i3000_count > INT_MAX)
return AVERROR(EINVAL);
ebur128->i400.sum = av_calloc(nb_channels, sizeof(*ebur128->i400.sum));
ebur128->i3000.sum = av_calloc(nb_channels, sizeof(*ebur128->i3000.sum));
ebur128->i400.cache = av_calloc(nb_channels * ebur128->i400.cache_size, sizeof(*ebur128->i400.cache));
ebur128->i3000.cache = av_calloc(nb_channels * ebur128->i3000.cache_size, sizeof(*ebur128->i3000.cache));
ebur128->i400.cache = av_calloc(i400_count, sizeof(*ebur128->i400.cache));
ebur128->i3000.cache = av_calloc(i3000_count, sizeof(*ebur128->i3000.cache));
if (!ebur128->i400.sum || !ebur128->i3000.sum ||
!ebur128->i400.cache || !ebur128->i3000.cache)
return AVERROR(ENOMEM);
+1 -1
View File
@@ -156,7 +156,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
while (1) {
char cmd_buf[1024];
char *recv_buf, *send_buf;
char *recv_buf = NULL, *send_buf = NULL;
int recv_buf_size;
Command cmd = {0};
int ret;
+15
View File
@@ -750,6 +750,21 @@ int ff_filter_process_command(AVFilterContext *ctx, const char *cmd,
*/
int ff_filter_get_nb_threads(AVFilterContext *ctx) av_pure;
/**
* Compute the boundary index for a slice when work of size total is split
* into nb_jobs slices. Returns the first index of slice jobnr, so the slice
* jobnr covers [ff_slice_pos(total, jobnr, nb_jobs),
* ff_slice_pos(total, jobnr + 1, nb_jobs)).
*
* The multiplication is performed in 64bit to avoid signed overflow of the
* total * jobnr intermediate that would occur for large dimensions and many
* slice threads.
*/
static inline int ff_slice_pos(int total, int jobnr, int nb_jobs)
{
return (int)((int64_t)total * jobnr / nb_jobs);
}
/**
* Send a frame of data to the next filter.
*
+1 -1
View File
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFILTER_VERSION_MINOR 14
#define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_MICRO 102
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
+2 -2
View File
@@ -98,8 +98,8 @@ typedef struct ThreadData {
const stype limit[2] = { s->llimit, s->hlimit }; \
\
for (int p = 0; p < s->nb_planes; p++) { \
const int slice_start = (s->height[p] * jobnr) / nb_jobs; \
const int slice_end = (s->height[p] * (jobnr+1)) / nb_jobs; \
const int slice_start = ff_slice_pos(s->height[p], jobnr, nb_jobs); \
const int slice_end = ff_slice_pos(s->height[p], jobnr + 1, nb_jobs); \
type *dst = (type *)(out->data[p] + slice_start * out->linesize[p]); \
ptrdiff_t dst_linesize = out->linesize[p] / sizeof(type); \
\
+2 -2
View File
@@ -345,8 +345,8 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
const float *weights = s->weights[p];
const int h = s->planeheight[p];
const int w = s->planewidth[p];
const int slice_start = (h * jobnr) / nb_jobs;
const int slice_end = (h * (jobnr+1)) / nb_jobs;
const int slice_start = ff_slice_pos(h, jobnr, nb_jobs);
const int slice_end = ff_slice_pos(h, jobnr + 1, nb_jobs);
const uint8_t *src = in->data[p] + slice_start * in->linesize[p];
uint8_t *dst = out->data[p] + slice_start * out->linesize[p];
const int thra = s->thra[p];
+4 -4
View File
@@ -48,8 +48,8 @@ static int do_backgroundkey_slice(AVFilterContext *avctx, void *arg, int jobnr,
{
BackgroundkeyContext *s = avctx->priv;
AVFrame *frame = arg;
const int slice_start = (frame->height * jobnr) / nb_jobs;
const int slice_end = (frame->height * (jobnr + 1)) / nb_jobs;
const int slice_start = ff_slice_pos(frame->height, jobnr, nb_jobs);
const int slice_end = ff_slice_pos(frame->height, jobnr + 1, nb_jobs);
const int min_diff = (255 + 255 + 255) * s->similarity;
const float blend = s->blend;
const int hsub = s->hsub_log2;
@@ -91,8 +91,8 @@ static int do_backgroundkey16_slice(AVFilterContext *avctx, void *arg, int jobnr
{
BackgroundkeyContext *s = avctx->priv;
AVFrame *frame = arg;
const int slice_start = (frame->height * jobnr) / nb_jobs;
const int slice_end = (frame->height * (jobnr + 1)) / nb_jobs;
const int slice_start = ff_slice_pos(frame->height, jobnr, nb_jobs);
const int slice_end = ff_slice_pos(frame->height, jobnr + 1, nb_jobs);
const int hsub = s->hsub_log2;
const int vsub = s->vsub_log2;
const int max = s->max;
+8 -8
View File
@@ -157,8 +157,8 @@ static void bilateralh_##name(BilateralContext *s, AVFrame *out, AVFrame *in, \
{ \
const int width = s->planewidth[plane]; \
const int height = s->planeheight[plane]; \
const int slice_start = (height * jobnr) / nb_jobs; \
const int slice_end = (height * (jobnr+1)) / nb_jobs; \
const int slice_start = ff_slice_pos(height, jobnr, nb_jobs); \
const int slice_end = ff_slice_pos(height, jobnr + 1, nb_jobs); \
const int src_linesize = in->linesize[plane] / sizeof(type); \
const type *src = (const type *)in->data[plane]; \
float *img_temp = s->img_temp[plane]; \
@@ -229,8 +229,8 @@ static void bilateralv_##name(BilateralContext *s, AVFrame *out, AVFrame *in, \
{ \
const int width = s->planewidth[plane]; \
const int height = s->planeheight[plane]; \
const int slice_start = (width * jobnr) / nb_jobs; \
const int slice_end = (width * (jobnr+1)) / nb_jobs; \
const int slice_start = ff_slice_pos(width, jobnr, nb_jobs); \
const int slice_end = ff_slice_pos(width, jobnr + 1, nb_jobs); \
const int src_linesize = in->linesize[plane] / sizeof(type); \
const type *src = (const type *)in->data[plane] + slice_start; \
float *img_out_f = s->img_out_f[plane] + slice_start; \
@@ -332,8 +332,8 @@ static void bilateralo_##name(BilateralContext *s, AVFrame *out, AVFrame *in, \
{ \
const int width = s->planewidth[plane]; \
const int height = s->planeheight[plane]; \
const int slice_start = (height * jobnr) / nb_jobs; \
const int slice_end = (height * (jobnr+1)) / nb_jobs; \
const int slice_start = ff_slice_pos(height, jobnr, nb_jobs); \
const int slice_end = ff_slice_pos(height, jobnr + 1, nb_jobs); \
const int dst_linesize = out->linesize[plane] / sizeof(type); \
\
for (int i = slice_start; i < slice_end; i++) { \
@@ -401,8 +401,8 @@ static int bilateralo_planes(AVFilterContext *ctx, void *arg,
if (!(s->planes & (1 << plane))) {
if (out != in) {
const int height = s->planeheight[plane];
const int slice_start = (height * jobnr) / nb_jobs;
const int slice_end = (height * (jobnr+1)) / nb_jobs;
const int slice_start = ff_slice_pos(height, jobnr, nb_jobs);
const int slice_end = ff_slice_pos(height, jobnr + 1, nb_jobs);
const int width = s->planewidth[plane];
const int linesize = in->linesize[plane];
const int dst_linesize = out->linesize[plane];
+2 -2
View File
@@ -168,8 +168,8 @@ static int black_counter(AVFilterContext *ctx, void *arg,
const int plane = s->alpha ? 3 : 0;
const int linesize = in->linesize[plane];
const int h = in->height;
const int start = (h * jobnr) / nb_jobs;
const int end = (h * (jobnr+1)) / nb_jobs;
const int start = ff_slice_pos(h, jobnr, nb_jobs);
const int end = ff_slice_pos(h, jobnr + 1, nb_jobs);
s->counter[jobnr] = s->func(in->data[plane] + start * linesize,
linesize, in->width, end - start,
+2 -2
View File
@@ -68,8 +68,8 @@ static const enum AVPixelFormat pix_fmts[] = {
static int blackframe_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
ThreadData *td = arg;
int slice_start = (td->height * jobnr) / nb_jobs;
int slice_end = (td->height * (jobnr+1)) / nb_jobs;
int slice_start = ff_slice_pos(td->height, jobnr, nb_jobs);
int slice_end = ff_slice_pos(td->height, jobnr + 1, nb_jobs);
const uint8_t *p;
unsigned int black_pixels_count = 0;

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