Compare commits

..

1 Commits

Author SHA1 Message Date
Michael Niedermayer 80bb65fafa Bump minor versions again on master to keep 4.2 versions separate from master
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-21 18:36:31 +02:00
95 changed files with 302 additions and 865 deletions
-69
View File
@@ -1,74 +1,6 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version 4.2.1:
- avformat/vividas: check for tiny blocks using alignment
- avcodec/vc1_pred: Fix refdist in scaleforopp()
- avcodec/vorbisdec: fix FASTDIV usage for vr_type == 2
- avcodec/iff: Check for overlap in cmap_read_palette()
- avcodec/apedec: Fix 32bit int overflow in do_apply_filter()
- lavf/rawenc: Only accept the appropriate stream type for raw muxers.
- avformat/matroskadec: use av_fast_realloc to reallocate ebml list arrays
- avformat/matroskadec: use proper types for some EbmlSyntax fields
- avcodec/ralf: fix undefined shift in extend_code()
- avcodec/ralf: fix undefined shift
- avcodec/bgmc: Check input space in ff_bgmc_decode_init()
- avcodec/vp3: Check for end of input in 2 places of vp4_unpack_macroblocks()
- avcodec/truemotion2: Fix multiple integer overflows in tm2_null_res_block()
- avcodec/vc1_block: Check the return code from vc1_decode_p_block()
- avcodec/vc1dec: Require res_sprite for wmv3images
- avcodec/vc1_block: Check for double escapes
- avcodec/vorbisdec: Check get_vlc2() failure
- avcodec/tta: Fix integer overflow in prediction
- avcodec/vb: Check input packet size to be large enough to contain flags
- avcodec/cavsdec: Limit the number of access units per packet to 2
- avcodec/atrac9dec: Check block_align
- avcodec/alac: Check for bps of 0
- avcodec/alac: Fix multiple integer overflows in lpc_prediction()
- avcodec/rl2: set dimensions
- avcodec/aacdec: Add FF_CODEC_CAP_INIT_CLEANUP
- avcodec/idcinvideo: Add 320x240 default maximum resolution
- avformat/realtextdec: free queue on error
- avcodec/vp5/6/8: use vpX_rac_is_end()
- avformat/vividas: Check av_xiphlacing() return value before use
- avcodec/alsdec: Fix integer overflow in decode_var_block_data()
- avcodec/alsdec: Limit maximum channels to 512
- avcodec/anm: Check input size for a frame with just a stop code
- avcodec/flicvideo: Optimize and Simplify FLI_COPY in flic_decode_frame_24BPP() by using bytestream2_get_buffer()
- avcodec/loco: Check left column value
- avcodec/ffwavesynth: Fixes invalid shift with pink noise seeking
- avcodec/ffwavesynth: Fix integer overflow for some corner case values
- avcodec/indeo2: Check remaining input more often
- avcodec/diracdec: Check that slices are fewer than pixels
- avcodec/vp56: Consider the alpha start as end of the prior header
- avcodec/4xm: Check for end of input in decode_p_block()
- avcodec/hevcdec: Check delta_luma_weight_l0/1
- avcodec/hnm4video: Optimize postprocess_current_frame()
- avcodec/hevc_refs: Optimize 16bit generate_missing_ref()
- avcodec/scpr: Use av_memcpy_backptr() in type 17 and 33
- avcodec/tiff: Enforce increasing offsets
- avcodec/dds: Use ff_set_dimensions()
- avformat/vividas: Fix another infinite loop
- avformat/vividas: Fix infinite loop in header parser
- avcodec/mpc8: Fix 32bit mask/enum
- avcodec/alsdec: Fix integer overflows of raw_samples in decode_var_block_data()
- avcodec/alsdec: Fix integer overflow of raw_samples in decode_blocks()
- avcodec/alsdec: fix mantisse shift
- avcodec/pngdec: consider chunk size in minimal size check
- avcodec/vc1_block: Fix invalid shifts in vc1_decode_i_blocks()
- avcodec/vc1_block: fix invalid shift in vc1_decode_p_mb()
- avcodec/aacdec_template: fix integer overflow in imdct_and_windowing()
- avformat/mpegts: Check if ready on SCTE reception
- avcodec/omx: fix xFramerate calculation
- avformat/avidec: add support for recognizing HEVC fourcc when demuxing
- avformat/mpegts: fix teletext PTS when selecting teletext streams only
- avcodec/h2645_parse: zero initialize the rbsp buffer
- avcodec/omx: Fix handling of fragmented buffers
- avcodec/omx: ensure zerocopy mode can be disabled on rpi builds
- avformat/mxfdec: do not ignore bad size errors
- avformat/matroskadec: Fix seeking
- ffplay: properly detect all window size changes
version 4.2:
- tpad filter
- AV1 decoding support through libdav1d
@@ -104,7 +36,6 @@ version 4.2:
- derain filter
- deesser filter
- mov muxer writes tracks with unspecified language instead of English by default
- add support for using clang to compile CUDA kernels
version 4.1:
+1 -1
View File
@@ -1 +1 @@
4.2.1
4.1.git
-15
View File
@@ -1,15 +0,0 @@
┌────────────────────────────────────┐
│ RELEASE NOTES for FFmpeg 4.2 "Ada" │
└────────────────────────────────────┘
The FFmpeg Project proudly presents FFmpeg 4.2 "Ada", about 8
months after the release of FFmpeg 4.1.
A complete Changelog is available at the root of the project, and the
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
We hope you will like this release as much as we enjoyed working on it, and
as usual, if you have any questions about it, or any FFmpeg related topic,
feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
on the mailing-lists.
-131
View File
@@ -1,131 +0,0 @@
/*
* Minimum CUDA compatibility definitions header
*
* Copyright (c) 2019 Rodger Combs
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMPAT_CUDA_CUDA_RUNTIME_H
#define COMPAT_CUDA_CUDA_RUNTIME_H
// Common macros
#define __global__ __attribute__((global))
#define __device__ __attribute__((device))
#define __device_builtin__ __attribute__((device_builtin))
#define __align__(N) __attribute__((aligned(N)))
#define __inline__ __inline__ __attribute__((always_inline))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define abs(x) ((x) < 0 ? -(x) : (x))
#define atomicAdd(a, b) (__atomic_fetch_add(a, b, __ATOMIC_SEQ_CST))
// Basic typedefs
typedef __device_builtin__ unsigned long long cudaTextureObject_t;
typedef struct __device_builtin__ __align__(2) uchar2
{
unsigned char x, y;
} uchar2;
typedef struct __device_builtin__ __align__(4) ushort2
{
unsigned short x, y;
} ushort2;
typedef struct __device_builtin__ uint3
{
unsigned int x, y, z;
} uint3;
typedef struct uint3 dim3;
typedef struct __device_builtin__ __align__(8) int2
{
int x, y;
} int2;
typedef struct __device_builtin__ __align__(4) uchar4
{
unsigned char x, y, z, w;
} uchar4;
typedef struct __device_builtin__ __align__(8) ushort4
{
unsigned char x, y, z, w;
} ushort4;
typedef struct __device_builtin__ __align__(16) int4
{
int x, y, z, w;
} int4;
// Accessors for special registers
#define GETCOMP(reg, comp) \
asm("mov.u32 %0, %%" #reg "." #comp ";" : "=r"(tmp)); \
ret.comp = tmp;
#define GET(name, reg) static inline __device__ uint3 name() {\
uint3 ret; \
unsigned tmp; \
GETCOMP(reg, x) \
GETCOMP(reg, y) \
GETCOMP(reg, z) \
return ret; \
}
GET(getBlockIdx, ctaid)
GET(getBlockDim, ntid)
GET(getThreadIdx, tid)
// Instead of externs for these registers, we turn access to them into calls into trivial ASM
#define blockIdx (getBlockIdx())
#define blockDim (getBlockDim())
#define threadIdx (getThreadIdx())
// Basic initializers (simple macros rather than inline functions)
#define make_uchar2(a, b) ((uchar2){.x = a, .y = b})
#define make_ushort2(a, b) ((ushort2){.x = a, .y = b})
#define make_uchar4(a, b, c, d) ((uchar4){.x = a, .y = b, .z = c, .w = d})
#define make_ushort4(a, b, c, d) ((ushort4){.x = a, .y = b, .z = c, .w = d})
// Conversions from the tex instruction's 4-register output to various types
#define TEX2D(type, ret) static inline __device__ void conv(type* out, unsigned a, unsigned b, unsigned c, unsigned d) {*out = (ret);}
TEX2D(unsigned char, a & 0xFF)
TEX2D(unsigned short, a & 0xFFFF)
TEX2D(uchar2, make_uchar2(a & 0xFF, b & 0xFF))
TEX2D(ushort2, make_ushort2(a & 0xFFFF, b & 0xFFFF))
TEX2D(uchar4, make_uchar4(a & 0xFF, b & 0xFF, c & 0xFF, d & 0xFF))
TEX2D(ushort4, make_ushort4(a & 0xFFFF, b & 0xFFFF, c & 0xFFFF, d & 0xFFFF))
// Template calling tex instruction and converting the output to the selected type
template <class T>
static inline __device__ T tex2D(cudaTextureObject_t texObject, float x, float y)
{
T ret;
unsigned ret1, ret2, ret3, ret4;
asm("tex.2d.v4.u32.f32 {%0, %1, %2, %3}, [%4, {%5, %6}];" :
"=r"(ret1), "=r"(ret2), "=r"(ret3), "=r"(ret4) :
"l"(texObject), "f"(x), "f"(y));
conv(&ret, ret1, ret2, ret3, ret4);
return ret;
}
#endif /* COMPAT_CUDA_CUDA_RUNTIME_H */
+3 -3
View File
@@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMPAT_CUDA_DYNLINK_LOADER_H
#define COMPAT_CUDA_DYNLINK_LOADER_H
#ifndef AV_COMPAT_CUDA_DYNLINK_LOADER_H
#define AV_COMPAT_CUDA_DYNLINK_LOADER_H
#include "libavutil/log.h"
#include "compat/w32dlfcn.h"
@@ -30,4 +30,4 @@
#include <ffnvcodec/dynlink_loader.h>
#endif /* COMPAT_CUDA_DYNLINK_LOADER_H */
#endif
Vendored
+22 -45
View File
@@ -322,7 +322,6 @@ External library support:
--disable-amf disable AMF video encoding code [autodetect]
--disable-audiotoolbox disable Apple AudioToolbox code [autodetect]
--enable-cuda-nvcc enable Nvidia CUDA compiler [no]
--disable-cuda-llvm disable CUDA compilation using clang [autodetect]
--disable-cuvid disable Nvidia CUVID support [autodetect]
--disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect]
--disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect]
@@ -371,7 +370,7 @@ Toolchain options:
--cxx=CXX use C compiler CXX [$cxx_default]
--objcc=OCC use ObjC compiler OCC [$cc_default]
--dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
--nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default]
--nvcc=NVCC use Nvidia CUDA compiler NVCC [$nvcc_default]
--ld=LD use linker LD [$ld_default]
--pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
--pkg-config-flags=FLAGS pass additional flags to pkgconf []
@@ -1039,16 +1038,12 @@ test_nvcc(){
tmpcu_=$TMPCU
tmpo_=$TMPO
[ -x "$(command -v cygpath)" ] && tmpcu_=$(cygpath -m $tmpcu_) && tmpo_=$(cygpath -m $tmpo_)
test_cmd $nvcc $nvccflags "$@" $NVCC_C $(nvcc_o $tmpo_) $tmpcu_
test_cmd $nvcc -ptx $NVCCFLAGS "$@" $NVCC_C $(nvcc_o $tmpo_) $tmpcu_
}
check_nvcc() {
log check_nvcc "$@"
name=$1
shift 1
disabled $name && return
disable $name
test_nvcc "$@" <<EOF && enable $name
test_nvcc <<EOF
extern "C" {
__global__ void hello(unsigned char *data) {}
}
@@ -1819,7 +1814,6 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
audiotoolbox
crystalhd
cuda
cuda_llvm
cuvid
d3d11va
dxva2
@@ -2993,10 +2987,8 @@ v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
hwupload_cuda_filter_deps="ffnvcodec"
scale_npp_filter_deps="ffnvcodec libnpp"
scale_cuda_filter_deps="ffnvcodec"
scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
thumbnail_cuda_filter_deps="ffnvcodec"
thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
thumbnail_cuda_filter_deps="ffnvcodec cuda_nvcc"
transpose_npp_filter_deps="ffnvcodec libnpp"
amf_deps_any="libdl LoadLibrary"
@@ -3555,8 +3547,7 @@ zscale_filter_deps="libzimg const_nan"
scale_vaapi_filter_deps="vaapi"
vpp_qsv_filter_deps="libmfx"
vpp_qsv_filter_select="qsvvpp"
yadif_cuda_filter_deps="ffnvcodec"
yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
yadif_cuda_filter_deps="ffnvcodec cuda_nvcc"
# examples
avio_dir_cmd_deps="avformat avutil"
@@ -3660,6 +3651,8 @@ version_script='--version-script'
objformat="elf32"
x86asmexe_default="nasm"
windres_default="windres"
nvcc_default="nvcc"
nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
striptype="direct"
# OS
@@ -4227,20 +4220,6 @@ windres_default="${cross_prefix}${windres_default}"
sysinclude_default="${sysroot}/usr/include"
if enabled cuda_sdk; then
warn "Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead."
enable cuda_nvcc
fi
if enabled cuda_nvcc; then
nvcc_default="nvcc"
nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
else
nvcc_default="clang"
nvccflags_default="--cuda-gpu-arch=sm_30 -O2"
NVCC_C=""
fi
set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
target_exec x86asmexe nvcc
enabled cross_compile || host_cc_default=$cc
@@ -6081,21 +6060,9 @@ check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
if [ -z "$nvccflags" ]; then
nvccflags=$nvccflags_default
fi
if enabled x86_64 || enabled ppc64 || enabled aarch64; then
nvccflags="$nvccflags -m64"
else
nvccflags="$nvccflags -m32"
fi
if enabled cuda_nvcc; then
nvccflags="$nvccflags -ptx"
else
nvccflags="$nvccflags -S -nocudalib -nocudainc --cuda-device-only -include ${source_link}/compat/cuda/cuda_runtime.h"
check_nvcc cuda_llvm
if enabled cuda_sdk; then
warn "Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead."
enable cuda_nvcc
fi
if ! disabled ffnvcodec; then
@@ -6173,7 +6140,7 @@ for func in $COMPLEX_FUNCS; do
done
# these are off by default, so fail if requested and not available
enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; }
enabled cuda_nvcc && { check_nvcc || die "ERROR: failed checking for nvcc."; }
enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
enabled decklink && { require_headers DeckLinkAPI.h &&
{ test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a090500" || die "ERROR: Decklink API version must be >= 10.9.5."; } }
@@ -6734,6 +6701,16 @@ if [ -z "$optflags" ]; then
fi
fi
if [ -z "$nvccflags" ]; then
nvccflags=$nvccflags_default
fi
if enabled x86_64 || enabled ppc64 || enabled aarch64; then
nvccflags="$nvccflags -m64"
else
nvccflags="$nvccflags -m32"
fi
check_optflags(){
check_cflags "$@"
enabled lto && check_ldflags "$@"
+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 = 4.2.1
PROJECT_NUMBER =
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
+2 -1
View File
@@ -38,6 +38,7 @@ OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
X86ASMFLAGS += $(IFLAGS:%=%/) -I$(<D)/ -Pconfig.asm
NVCCFLAGS += -ptx
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
@@ -90,7 +91,7 @@ COMPILE_NVCC = $(call COMPILE,NVCC)
%.h.c:
$(Q)echo '#include "$*.h"' >$@
%.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h
%.ptx: %.cu
$(COMPILE_NVCC)
%.ptx.c: %.ptx
+1 -1
View File
@@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
break;
case SDL_WINDOWEVENT:
switch (event.window.event) {
case SDL_WINDOWEVENT_SIZE_CHANGED:
case SDL_WINDOWEVENT_RESIZED:
screen_width = cur_stream->width = event.window.data1;
screen_height = cur_stream->height = event.window.data2;
if (cur_stream->vis_texture) {
-2
View File
@@ -351,8 +351,6 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
index = size2index[log2h][log2w];
av_assert0(index >= 0);
if (get_bits_left(&f->gb) < 1)
return AVERROR_INVALIDDATA;
h = 1 << log2h;
code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index].table,
BLOCK_TYPE_VLC_BITS, 1);
+2 -2
View File
@@ -559,7 +559,7 @@ AVCodec ff_aac_decoder = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
},
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
.channel_layouts = aac_channel_layout,
.flush = flush,
.priv_class = &aac_decoder_class,
@@ -584,7 +584,7 @@ AVCodec ff_aac_latm_decoder = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
},
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
.channel_layouts = aac_channel_layout,
.flush = flush,
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
+1 -1
View File
@@ -2659,7 +2659,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
ac->mdct.imdct_half(&ac->mdct, buf, in);
#if USE_FIXED
for (i=0; i<1024; i++)
buf[i] = (buf[i] + 4LL) >> 3;
buf[i] = (buf[i] + 4) >> 3;
#endif /* USE_FIXED */
}
+5 -7
View File
@@ -171,12 +171,12 @@ static inline int sign_only(int v)
return v ? FFSIGN(v) : 0;
}
static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out,
int nb_samples, int bps, int16_t *lpc_coefs,
int lpc_order, int lpc_quant)
{
int i;
uint32_t *pred = buffer_out;
int32_t *pred = buffer_out;
/* first sample always copies */
*buffer_out = *error_buffer;
@@ -208,7 +208,7 @@ static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
for (; i < nb_samples; i++) {
int j;
int val = 0;
unsigned error_val = error_buffer[i];
int error_val = error_buffer[i];
int error_sign;
int d = *pred++;
@@ -222,7 +222,7 @@ static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
/* adapt LPC coefficients */
error_sign = sign_only(error_val);
if (error_sign) {
for (j = 0; j < lpc_order && (int)error_val * error_sign > 0; j++) {
for (j = 0; j < lpc_order && error_val * error_sign > 0; j++) {
int sign;
val = d - pred[j];
sign = sign_only(val) * error_sign;
@@ -250,12 +250,10 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
alac->extra_bits = get_bits(&alac->gb, 2) << 3;
bps = alac->sample_size - alac->extra_bits + channels - 1;
if (bps > 32) {
if (bps > 32U) {
avpriv_report_missing_feature(avctx, "bps %d", bps);
return AVERROR_PATCHWELCOME;
}
if (bps < 1)
return AVERROR_INVALIDDATA;
/* whether the frame is compressed */
is_compressed = !get_bits1(&alac->gb);
+8 -19
View File
@@ -348,11 +348,6 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
if (als_id != MKBETAG('A','L','S','\0'))
return AVERROR_INVALIDDATA;
if (avctx->channels > FF_SANE_NB_CHANNELS) {
avpriv_request_sample(avctx, "Huge number of channels\n");
return AVERROR_PATCHWELCOME;
}
ctx->cur_frame_length = sconf->frame_length;
// read channel config
@@ -662,7 +657,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
// do not continue in case of a damaged stream since
// block_length must be evenly divisible by sub_blocks
if (bd->block_length & (sub_blocks - 1) || bd->block_length <= 0) {
if (bd->block_length & (sub_blocks - 1)) {
av_log(avctx, AV_LOG_WARNING,
"Block length is not evenly divisible by the number of subblocks.\n");
return AVERROR_INVALIDDATA;
@@ -821,9 +816,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
unsigned int low;
unsigned int value;
int ret = ff_bgmc_decode_init(gb, &high, &low, &value);
if (ret < 0)
return ret;
ff_bgmc_decode_init(gb, &high, &low, &value);
current_res = bd->raw_samples + start;
@@ -925,7 +918,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
y = 1 << 6;
for (base = begin; base < end; base++, tab++)
y += (uint64_t)MUL64(bd->ltp_gain[tab], raw_samples[base]);
y += MUL64(bd->ltp_gain[tab], raw_samples[base]);
raw_samples[ltp_smp] += y >> 7;
}
@@ -937,7 +930,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
y = 1 << 19;
for (sb = 0; sb < smp; sb++)
y += (uint64_t)MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
y += MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
*raw_samples++ -= y >> 20;
parcor_to_lpc(smp, quant_cof, lpc_cof);
@@ -953,7 +946,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
// reconstruct difference signal for prediction (joint-stereo)
if (bd->js_blocks && bd->raw_other) {
uint32_t *left, *right;
int32_t *left, *right;
if (bd->raw_other > raw_samples) { // D = R - L
left = raw_samples;
@@ -1182,10 +1175,10 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair.\n");
for (s = 0; s < div_blocks[b]; s++)
bd[0].raw_samples[s] = bd[1].raw_samples[s] - (unsigned)bd[0].raw_samples[s];
bd[0].raw_samples[s] = bd[1].raw_samples[s] - bd[0].raw_samples[s];
} else if (bd[1].js_blocks) {
for (s = 0; s < div_blocks[b]; s++)
bd[1].raw_samples[s] = bd[1].raw_samples[s] + (unsigned)bd[0].raw_samples[s];
bd[1].raw_samples[s] = bd[1].raw_samples[s] + bd[0].raw_samples[s];
}
offset += div_blocks[b];
@@ -1411,11 +1404,7 @@ static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) {
}
}
if (cutoff_bit_count >= 0) {
mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
} else {
mantissa = (unsigned int)(mantissa_temp <<-cutoff_bit_count);
}
mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
// Need one more shift?
if (mantissa & 0x01000000ul) {
-3
View File
@@ -119,9 +119,6 @@ static int decode_frame(AVCodecContext *avctx,
uint8_t *dst, *dst_end;
int count, ret;
if (buf_size < 7)
return AVERROR_INVALIDDATA;
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
return ret;
dst = s->frame->data[0];
+11 -12
View File
@@ -589,7 +589,7 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
int32_t *out, APERice *rice, int blockstodecode)
{
int i;
unsigned ksummax, ksummin;
int ksummax, ksummin;
rice->ksum = 0;
for (i = 0; i < FFMIN(blockstodecode, 5); i++) {
@@ -836,7 +836,7 @@ static av_always_inline int filter_fast_3320(APEPredictor *p,
else
p->coeffsA[filter][0]--;
p->filterA[filter] += (unsigned)p->lastA[filter];
p->filterA[filter] += p->lastA[filter];
return p->filterA[filter];
}
@@ -859,9 +859,9 @@ static av_always_inline int filter_3800(APEPredictor *p,
return predictionA;
}
d2 = p->buf[delayA];
d1 = (p->buf[delayA] - p->buf[delayA - 1]) * 2U;
d0 = p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) * 8U);
d3 = p->buf[delayB] * 2U - p->buf[delayB - 1];
d1 = (p->buf[delayA] - p->buf[delayA - 1]) << 1;
d0 = p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) << 3);
d3 = p->buf[delayB] * 2 - p->buf[delayB - 1];
d4 = p->buf[delayB];
predictionA = d0 * p->coeffsA[filter][0] +
@@ -881,7 +881,7 @@ static av_always_inline int filter_3800(APEPredictor *p,
p->coeffsB[filter][1] -= (((d4 >> 30) & 2) - 1) * sign;
p->filterB[filter] = p->lastA[filter] + (predictionB >> shift);
p->filterA[filter] = p->filterB[filter] + ((int)(p->filterA[filter] * 31U) >> 5);
p->filterA[filter] = p->filterB[filter] + ((p->filterA[filter] * 31) >> 5);
return p->filterA[filter];
}
@@ -902,7 +902,7 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
dotprod = 0;
sign = APESIGN(buffer[i]);
for (j = 0; j < order; j++) {
dotprod += delay[j] * (unsigned)coeffs[j];
dotprod += delay[j] * coeffs[j];
coeffs[j] += ((delay[j] >> 31) | 1) * sign;
}
buffer[i] -= dotprod >> shift;
@@ -1266,7 +1266,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
f->delay - order,
f->adaptcoeffs - order,
order, APESIGN(*data));
res = (int)(res + (1U << (fracbits - 1))) >> fracbits;
res = (res + (1 << (fracbits - 1))) >> fracbits;
res += *data;
*data++ = res;
@@ -1376,7 +1376,7 @@ static void ape_unpack_mono(APEContext *ctx, int count)
static void ape_unpack_stereo(APEContext *ctx, int count)
{
unsigned left, right;
int32_t left, right;
int32_t *decoded0 = ctx->decoded[0];
int32_t *decoded1 = ctx->decoded[1];
@@ -1393,7 +1393,7 @@ static void ape_unpack_stereo(APEContext *ctx, int count)
/* Decorrelate and scale to output depth */
while (count--) {
left = *decoded1 - (unsigned)(*decoded0 / 2);
left = *decoded1 - (*decoded0 / 2);
right = left + *decoded0;
*(decoded0++) = left;
@@ -1451,8 +1451,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
if (s->fileversion >= 3900) {
if (offset > 3) {
av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n");
av_freep(&s->data);
s->data_size = 0;
s->data = NULL;
return AVERROR_INVALIDDATA;
}
if (s->data_end - s->ptr < offset) {
+1 -2
View File
@@ -31,8 +31,7 @@ static av_cold int ass_decode_init(AVCodecContext *avctx)
avctx->subtitle_header = av_malloc(avctx->extradata_size + 1);
if (!avctx->subtitle_header)
return AVERROR(ENOMEM);
if (avctx->extradata_size)
memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
avctx->subtitle_header[avctx->extradata_size] = 0;
avctx->subtitle_header_size = avctx->extradata_size;
return 0;
+1 -6
View File
@@ -121,7 +121,7 @@ static inline int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b,
}
b->grad_boundary = get_bits(gb, 4);
if (grad_range[0] >= grad_range[1] || grad_range[1] > 31)
if (grad_range[0] >= grad_range[1] || grad_range[1] > 47)
return AVERROR_INVALIDDATA;
if (grad_value[0] > 31 || grad_value[1] > 31)
@@ -842,11 +842,6 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx)
av_lfg_init(&s->lfg, 0xFBADF00D);
if (avctx->block_align <= 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid block align\n");
return AVERROR_INVALIDDATA;
}
if (avctx->extradata_size != 12) {
av_log(avctx, AV_LOG_ERROR, "Invalid extradata length!\n");
return AVERROR_INVALIDDATA;
+1 -6
View File
@@ -485,17 +485,12 @@ av_cold void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
/** Initialize decoding and reads the first value */
int ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
unsigned int *l, unsigned int *v)
{
if (get_bits_left(gb) < VALUE_BITS)
return AVERROR_INVALIDDATA;
*h = TOP_VALUE;
*l = 0;
*v = get_bits_long(gb, VALUE_BITS);
return 0;
}
+1 -1
View File
@@ -40,7 +40,7 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status);
void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status);
int ff_bgmc_decode_init(GetBitContext *gb,
void ff_bgmc_decode_init(GetBitContext *gb,
unsigned int *h, unsigned int *l, unsigned int *v);
+1 -4
View File
@@ -204,10 +204,6 @@ static int pix_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
avpriv_request_sample(avctx, "Format %d", hdr.format);
return AVERROR_PATCHWELCOME;
}
bytes_per_scanline = bytes_pp * hdr.width;
if (bytestream2_get_bytes_left(&gb) < hdr.height * bytes_per_scanline)
return AVERROR_INVALIDDATA;
if ((ret = ff_set_dimensions(avctx, hdr.width, hdr.height)) < 0)
return ret;
@@ -265,6 +261,7 @@ static int pix_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
bytestream2_skip(&gb, 8);
// read the image data to the buffer
bytes_per_scanline = bytes_pp * hdr.width;
bytes_left = bytestream2_get_bytes_left(&gb);
if (chunk_type != IMAGE_DATA_CHUNK || data_len != bytes_left ||
-4
View File
@@ -1215,7 +1215,6 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int input_size, ret;
const uint8_t *buf_end;
const uint8_t *buf_ptr;
int frame_start = 0;
if (buf_size == 0) {
if (!h->low_delay && h->DPB[0].f->data[0]) {
@@ -1249,9 +1248,6 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
h->got_keyframe = 1;
}
case PIC_PB_START_CODE:
if (frame_start > 1)
return AVERROR_INVALIDDATA;
frame_start ++;
if (*got_frame)
av_frame_unref(data);
*got_frame = 0;
+3 -4
View File
@@ -419,17 +419,16 @@ static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw,
for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
flags(found_ref[i], 1, i);
if (current->found_ref[i]) {
AV1ReferenceFrameState *ref;
AV1ReferenceFrameState *ref =
&priv->ref[current->ref_frame_idx[i]];
if (current->ref_frame_idx[i] < 0 ||
!priv->ref[current->ref_frame_idx[i]].valid) {
if (!ref->valid) {
av_log(ctx->log_ctx, AV_LOG_ERROR,
"Missing reference frame needed for frame size "
"(ref = %d, ref_frame_idx = %d).\n",
i, current->ref_frame_idx[i]);
return AVERROR_INVALIDDATA;
}
ref = &priv->ref[current->ref_frame_idx[i]];
priv->upscaled_width = ref->upscaled_width;
priv->frame_width = ref->frame_width;
+1 -1
View File
@@ -665,7 +665,7 @@ static av_cold int clv_decode_init(AVCodecContext *avctx)
}
c->tile_shift = av_log2(c->tile_size);
if (1U << c->tile_shift != c->tile_size) {
if (1 << c->tile_shift != c->tile_size) {
av_log(avctx, AV_LOG_ERROR, "Tile size: %d, is not power of 2.\n", c->tile_size);
return AVERROR_INVALIDDATA;
}
+3 -4
View File
@@ -613,7 +613,6 @@ static int dds_decode(AVCodecContext *avctx, void *data,
AVFrame *frame = data;
int mipmap;
int ret;
int width, height;
ff_texturedsp_init(&ctx->texdsp);
bytestream2_init(gbc, avpkt->data, avpkt->size);
@@ -632,9 +631,9 @@ static int dds_decode(AVCodecContext *avctx, void *data,
bytestream2_skip(gbc, 4); // flags
height = bytestream2_get_le32(gbc);
width = bytestream2_get_le32(gbc);
ret = ff_set_dimensions(avctx, width, height);
avctx->height = bytestream2_get_le32(gbc);
avctx->width = bytestream2_get_le32(gbc);
ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid image size %dx%d.\n",
avctx->width, avctx->height);
+1 -1
View File
@@ -212,7 +212,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
if (parse_timing_info && pu1.prev_pu_offset >= 13) {
uint8_t *cur_pu = pc->buffer +
pc->index - 13 - pu1.prev_pu_offset;
int64_t pts = AV_RB32(cur_pu + 13);
int pts = AV_RB32(cur_pu + 13);
if (s->last_pts == 0 && s->last_dts == 0)
s->dts = pts - 1;
else
+1 -3
View File
@@ -1276,9 +1276,7 @@ static int dirac_unpack_idwt_params(DiracContext *s)
s->num_y = get_interleaved_ue_golomb(gb);
if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX ||
s->num_x * (uint64_t)s->avctx->width > INT_MAX ||
s->num_y * (uint64_t)s->avctx->height > INT_MAX ||
s->num_x > s->avctx->width ||
s->num_y > s->avctx->height
s->num_y * (uint64_t)s->avctx->height > INT_MAX
) {
av_log(s->avctx,AV_LOG_ERROR,"Invalid numx/y\n");
s->num_x = s->num_y = 0;
-3
View File
@@ -300,9 +300,6 @@ static int tgv_decode_frame(AVCodecContext *avctx,
s->palette[i] = 0xFFU << 24 | AV_RB24(buf);
buf += 3;
}
if (buf_end - buf < 5) {
return AVERROR_INVALIDDATA;
}
}
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
-3
View File
@@ -131,9 +131,6 @@ static int tqi_decode_frame(AVCodecContext *avctx,
AVFrame *frame = data;
int ret, w, h;
if (buf_size < 12)
return AVERROR_INVALIDDATA;
t->avctx = avctx;
w = AV_RL16(&buf[0]);
+3 -3
View File
@@ -220,7 +220,7 @@ static void wavesynth_seek(struct wavesynth_context *ws, int64_t ts)
int64_t pink_ts_cur = (ws->cur_ts + PINK_UNIT - 1) & ~(PINK_UNIT - 1);
int64_t pink_ts_next = ts & ~(PINK_UNIT - 1);
int pos = ts & (PINK_UNIT - 1);
lcg_seek(&ws->pink_state, (pink_ts_next - pink_ts_cur) * 2);
lcg_seek(&ws->pink_state, (pink_ts_next - pink_ts_cur) << 1);
if (pos) {
pink_fill(ws);
ws->pink_pos = pos;
@@ -301,8 +301,8 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
default:
return AVERROR(EINVAL);
}
in->amp0 = (uint64_t)a1 << 32;
in->damp = (int64_t)(((uint64_t)a2 << 32) - ((uint64_t)a1 << 32)) / dt;
in->amp0 = (int64_t)a1 << 32;
in->damp = (((int64_t)a2 << 32) - ((int64_t)a1 << 32)) / dt;
}
if (edata != edata_end)
return AVERROR(EINVAL);
+8 -1
View File
@@ -1024,7 +1024,14 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
y_ptr += s->frame->linesize[0]) {
bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s->avctx->width);
pixel_countdown = s->avctx->width;
pixel_ptr = 0;
while (pixel_countdown > 0) {
pixel = bytestream2_get_le24(&g2);
AV_WL24(&pixels[y_ptr + pixel_ptr], pixel);
pixel_ptr += 3;
pixel_countdown--;
}
if (s->avctx->width & 1)
bytestream2_skip(&g2, 3);
}
+1 -4
View File
@@ -614,7 +614,7 @@ retry:
if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
return ret;
if (!s->divx_packed && !avctx->hwaccel)
if (!s->divx_packed)
ff_thread_finish_setup(avctx);
if (avctx->hwaccel) {
@@ -747,9 +747,6 @@ const AVCodecHWConfigInternal *ff_h263_hw_config_list[] = {
#if CONFIG_H263_VAAPI_HWACCEL
HWACCEL_VAAPI(h263),
#endif
#if CONFIG_MPEG4_NVDEC_HWACCEL
HWACCEL_NVDEC(mpeg4),
#endif
#if CONFIG_MPEG4_VDPAU_HWACCEL
HWACCEL_VDPAU(mpeg4),
#endif
+2 -7
View File
@@ -345,18 +345,13 @@ static int find_next_start_code(const uint8_t *buf, const uint8_t *next_avc)
static void alloc_rbsp_buffer(H2645RBSP *rbsp, unsigned int size, int use_ref)
{
int min_size = size;
if (size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
goto fail;
size += AV_INPUT_BUFFER_PADDING_SIZE;
if (rbsp->rbsp_buffer_alloc_size >= size &&
(!rbsp->rbsp_buffer_ref || av_buffer_is_writable(rbsp->rbsp_buffer_ref))) {
av_assert0(rbsp->rbsp_buffer);
memset(rbsp->rbsp_buffer + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
(!rbsp->rbsp_buffer_ref || av_buffer_is_writable(rbsp->rbsp_buffer_ref)))
return;
}
size = FFMIN(size + size / 16 + 32, INT_MAX);
@@ -365,7 +360,7 @@ static void alloc_rbsp_buffer(H2645RBSP *rbsp, unsigned int size, int use_ref)
else
av_free(rbsp->rbsp_buffer);
rbsp->rbsp_buffer = av_mallocz(size);
rbsp->rbsp_buffer = av_malloc(size);
if (!rbsp->rbsp_buffer)
goto fail;
rbsp->rbsp_buffer_alloc_size = size;
+6 -6
View File
@@ -394,7 +394,7 @@ static void mark_ref(HEVCFrame *frame, int flag)
static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
{
HEVCFrame *frame;
int i, y;
int i, x, y;
frame = alloc_frame(s);
if (!frame)
@@ -407,11 +407,11 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
frame->frame->buf[i]->size);
} else {
for (i = 0; frame->frame->data[i]; i++)
for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++) {
uint8_t *dst = frame->frame->data[i] + y * frame->frame->linesize[i];
AV_WN16(dst, 1 << (s->ps.sps->bit_depth - 1));
av_memcpy_backptr(dst + 2, 2, 2*(s->ps.sps->width >> s->ps.sps->hshift[i]) - 2);
}
for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++)
for (x = 0; x < (s->ps.sps->width >> s->ps.sps->hshift[i]); x++) {
AV_WN16(frame->frame->data[i] + y * frame->frame->linesize[i] + 2 * x,
1 << (s->ps.sps->bit_depth - 1));
}
}
}
-4
View File
@@ -182,8 +182,6 @@ static int pred_weight_table(HEVCContext *s, GetBitContext *gb)
for (i = 0; i < s->sh.nb_refs[L0]; i++) {
if (luma_weight_l0_flag[i]) {
int delta_luma_weight_l0 = get_se_golomb(gb);
if ((int8_t)delta_luma_weight_l0 != delta_luma_weight_l0)
return AVERROR_INVALIDDATA;
s->sh.luma_weight_l0[i] = (1 << s->sh.luma_log2_weight_denom) + delta_luma_weight_l0;
s->sh.luma_offset_l0[i] = get_se_golomb(gb);
}
@@ -226,8 +224,6 @@ static int pred_weight_table(HEVCContext *s, GetBitContext *gb)
for (i = 0; i < s->sh.nb_refs[L1]; i++) {
if (luma_weight_l1_flag[i]) {
int delta_luma_weight_l1 = get_se_golomb(gb);
if ((int8_t)delta_luma_weight_l1 != delta_luma_weight_l1)
return AVERROR_INVALIDDATA;
s->sh.luma_weight_l1[i] = (1 << s->sh.luma_log2_weight_denom) + delta_luma_weight_l1;
s->sh.luma_offset_l1[i] = get_se_golomb(gb);
}
+15 -22
View File
@@ -117,17 +117,14 @@ static void unpack_intraframe(AVCodecContext *avctx, uint8_t *src,
static void postprocess_current_frame(AVCodecContext *avctx)
{
Hnm4VideoContext *hnm = avctx->priv_data;
uint32_t x, y, src_y;
int width = hnm->width;
uint32_t x, y, src_x, src_y;
for (y = 0; y < hnm->height; y++) {
uint8_t *dst = hnm->processed + y * width;
const uint8_t *src = hnm->current;
src_y = y - (y % 2);
src += src_y * width + (y % 2);
for (x = 0; x < width; x++) {
dst[x] = *src;
src += 2;
src_x = src_y * hnm->width + (y % 2);
for (x = 0; x < hnm->width; x++) {
hnm->processed[(y * hnm->width) + x] = hnm->current[src_x];
src_x += 2;
}
}
}
@@ -146,7 +143,7 @@ static void copy_processed_frame(AVCodecContext *avctx, AVFrame *frame)
}
}
static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t size)
static void decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t size)
{
Hnm4VideoContext *hnm = avctx->priv_data;
GetByteContext gb;
@@ -165,7 +162,7 @@ static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t si
if (tag == 0) {
if (writeoffset + 2 > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
break;
}
hnm->current[writeoffset++] = bytestream2_get_byte(&gb);
hnm->current[writeoffset++] = bytestream2_get_byte(&gb);
@@ -179,7 +176,7 @@ static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t si
count = bytestream2_get_byte(&gb) * 2;
if (writeoffset + count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
break;
}
while (count > 0) {
hnm->current[writeoffset++] = bytestream2_peek_byte(&gb);
@@ -191,7 +188,7 @@ static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t si
}
if (writeoffset > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n");
return AVERROR_INVALIDDATA;
break;
}
} else {
previous = bytestream2_peek_byte(&gb) & 0x20;
@@ -207,25 +204,24 @@ static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t si
if (!backward && offset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
break;
} else if (backward && offset + 1 >= hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
break;
} else if (writeoffset + 2*count > hnm->width * hnm->height) {
av_log(avctx, AV_LOG_ERROR,
"Attempting to write out of bounds\n");
return AVERROR_INVALIDDATA;
break;
}
if(backward) {
if (offset < (!!backline)*(2 * hnm->width - 1) + 2*(left-1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
break;
}
} else {
if (offset < (!!backline)*(2 * hnm->width - 1)) {
av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n");
return AVERROR_INVALIDDATA;
break;
}
}
@@ -272,7 +268,6 @@ static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t si
}
}
}
return 0;
}
static void decode_interframe_v4a(AVCodecContext *avctx, uint8_t *src,
@@ -440,9 +435,7 @@ static int hnm_decode_frame(AVCodecContext *avctx, void *data,
decode_interframe_v4a(avctx, avpkt->data + 8, avpkt->size - 8);
memcpy(hnm->processed, hnm->current, hnm->width * hnm->height);
} else {
int ret = decode_interframe_v4(avctx, avpkt->data + 8, avpkt->size - 8);
if (ret < 0)
return ret;
decode_interframe_v4(avctx, avpkt->data + 8, avpkt->size - 8);
postprocess_current_frame(avctx);
}
copy_processed_frame(avctx, frame);
-6
View File
@@ -243,11 +243,6 @@ static int idcin_decode_frame(AVCodecContext *avctx,
return buf_size;
}
static const AVCodecDefault idcin_defaults[] = {
{ "max_pixels", "320*240" },
{ NULL },
};
AVCodec ff_idcin_decoder = {
.name = "idcinvideo",
.long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"),
@@ -257,5 +252,4 @@ AVCodec ff_idcin_decoder = {
.init = idcin_decode_init,
.decode = idcin_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
.defaults = idcin_defaults,
};
+17 -21
View File
@@ -111,23 +111,23 @@ static const uint64_t plane8_lut[8][256] = {
LUT8(4), LUT8(5), LUT8(6), LUT8(7),
};
#define LUT32(plane) { \
0, 0, 0, 0, \
0, 0, 0, 1U << plane, \
0, 0, 1U << plane, 0, \
0, 0, 1U << plane, 1U << plane, \
0, 1U << plane, 0, 0, \
0, 1U << plane, 0, 1U << plane, \
0, 1U << plane, 1U << plane, 0, \
0, 1U << plane, 1U << plane, 1U << plane, \
1U << plane, 0, 0, 0, \
1U << plane, 0, 0, 1U << plane, \
1U << plane, 0, 1U << plane, 0, \
1U << plane, 0, 1U << plane, 1U << plane, \
1U << plane, 1U << plane, 0, 0, \
1U << plane, 1U << plane, 0, 1U << plane, \
1U << plane, 1U << plane, 1U << plane, 0, \
1U << plane, 1U << plane, 1U << plane, 1U << plane, \
#define LUT32(plane) { \
0, 0, 0, 0, \
0, 0, 0, 1 << plane, \
0, 0, 1 << plane, 0, \
0, 0, 1 << plane, 1 << plane, \
0, 1 << plane, 0, 0, \
0, 1 << plane, 0, 1 << plane, \
0, 1 << plane, 1 << plane, 0, \
0, 1 << plane, 1 << plane, 1 << plane, \
1 << plane, 0, 0, 0, \
1 << plane, 0, 0, 1 << plane, \
1 << plane, 0, 1 << plane, 0, \
1 << plane, 0, 1 << plane, 1 << plane, \
1 << plane, 1 << plane, 0, 0, \
1 << plane, 1 << plane, 0, 1 << plane, \
1 << plane, 1 << plane, 1 << plane, 0, \
1 << plane, 1 << plane, 1 << plane, 1 << plane, \
}
// 32 planes * 4-bit mask * 4 lookup tables each
@@ -180,10 +180,6 @@ static int cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
pal[i] = 0xFF000000 | gray2rgb((i * 255) >> avctx->bits_per_coded_sample);
}
if (s->masking == MASK_HAS_MASK) {
if ((1 << avctx->bits_per_coded_sample) < count) {
avpriv_request_sample(avctx, "overlapping mask");
return AVERROR_PATCHWELCOME;
}
memcpy(pal + (1 << avctx->bits_per_coded_sample), pal, count * 4);
for (i = 0; i < count; i++)
pal[i] &= 0xFFFFFF;
+5 -6
View File
@@ -79,11 +79,10 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
for (j = 1; j < height; j++) {
out = 0;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
while (out < width) {
int c;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
int c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
if (out + c*2 > width)
@@ -124,9 +123,9 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
for (j = 0; j < height; j++) {
out = 0;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
while (out < width) {
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
-6
View File
@@ -88,8 +88,6 @@ static inline int loco_get_rice(RICEContext *r)
loco_update_rice_param(r, 0);
return 0;
}
if (get_bits_left(&r->gb) < 1)
return INT_MIN;
v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0);
loco_update_rice_param(r, (v + 1) >> 1);
if (!v) {
@@ -161,14 +159,10 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
for (j = 1; j < height; j++) {
/* restore left column */
val = loco_get_rice(&rc);
if (val == INT_MIN)
return AVERROR_INVALIDDATA;
data[0] = data[-stride] + val;
/* restore all other pixels */
for (i = 1; i < width; i++) {
val = loco_get_rice(&rc);
if (val == INT_MIN)
return -1;
data[i] = loco_predict(&data[i], stride) + val;
}
data += stride;
+10 -9
View File
@@ -392,6 +392,8 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e
struct JNIAMediaCodecListFields jfields = { 0 };
struct JNIAMediaFormatFields mediaformat_jfields = { 0 };
jobject format = NULL;
jobject codec = NULL;
jobject codec_name = NULL;
jobject info = NULL;
@@ -467,11 +469,6 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e
goto done;
}
if (codec_name) {
(*env)->DeleteLocalRef(env, codec_name);
codec_name = NULL;
}
/* Skip software decoders */
if (
strstr(name, "OMX.google") ||
@@ -569,6 +566,14 @@ done_with_info:
}
done:
if (format) {
(*env)->DeleteLocalRef(env, format);
}
if (codec) {
(*env)->DeleteLocalRef(env, codec);
}
if (codec_name) {
(*env)->DeleteLocalRef(env, codec_name);
}
@@ -1332,10 +1337,6 @@ char *ff_AMediaCodec_getName(FFAMediaCodec *codec)
ret = ff_jni_jstring_to_utf_chars(env, name, codec);
fail:
if (name) {
(*env)->DeleteLocalRef(env, name);
}
return ret;
}
-2
View File
@@ -26,8 +26,6 @@
#include <stdint.h>
#include <sys/types.h>
#include "avcodec.h"
/**
* The following API around MediaCodec and MediaFormat is based on the
* NDK one provided by Google since Android 5.0.
+1 -1
View File
@@ -62,7 +62,7 @@ static inline int mpc8_dec_enum(GetBitContext *gb, int k, int n)
do {
n--;
if (code >= C[n]) {
bits |= 1U << n;
bits |= 1 << n;
code -= C[n];
C -= 32;
k--;
-3
View File
@@ -56,8 +56,6 @@ static void arith_normalise(ArithCoder *c)
c->low <<= 1;
c->high <<= 1;
c->high |= 1;
if (get_bits_left(c->gbc.gb) < 1)
c->overread++;
c->value |= get_bits1(c->gbc.gb);
}
}
@@ -114,7 +112,6 @@ static void arith_init(ArithCoder *c, GetBitContext *gb)
c->low = 0;
c->high = 0xFFFF;
c->value = get_bits(gb, 16);
c->overread = 0;
c->gbc.gb = gb;
c->get_model_sym = arith_get_model_sym;
c->get_number = arith_get_number;
-12
View File
@@ -161,8 +161,6 @@ static av_always_inline int decode_pixel(ArithCoder *acoder, PixContext *pctx,
{
int i, val, pix;
if (acoder->overread > MAX_OVERREAD)
return AVERROR_INVALIDDATA;
val = acoder->get_model_sym(acoder, &pctx->cache_model);
if (val < pctx->num_syms) {
if (any_ngb) {
@@ -308,8 +306,6 @@ static int decode_region(ArithCoder *acoder, uint8_t *dst, uint8_t *rgb_pic,
else
p = decode_pixel_in_context(acoder, pctx, dst + i, stride,
i, j, width - i - 1);
if (p < 0)
return p;
dst[i] = p;
if (rgb_pic)
@@ -402,8 +398,6 @@ static int decode_region_masked(MSS12Context const *c, ArithCoder *acoder,
else
p = decode_pixel_in_context(acoder, pctx, dst + i, stride,
i, j, width - i - 1);
if (p < 0)
return p;
dst[i] = p;
if (c->rgb_pic)
AV_WB24(rgb_dst + i * 3, c->pal[p]);
@@ -479,8 +473,6 @@ static int decode_region_intra(SliceContext *sc, ArithCoder *acoder,
uint8_t *rgb_dst = c->rgb_pic + x * 3 + y * rgb_stride;
pix = decode_pixel(acoder, &sc->intra_pix_ctx, NULL, 0, 0);
if (pix < 0)
return pix;
rgb_pix = c->pal[pix];
for (i = 0; i < height; i++, dst += stride, rgb_dst += rgb_stride) {
memset(dst, pix, width);
@@ -507,8 +499,6 @@ static int decode_region_inter(SliceContext *sc, ArithCoder *acoder,
if (!mode) {
mode = decode_pixel(acoder, &sc->inter_pix_ctx, NULL, 0, 0);
if (mode < 0)
return mode;
if (c->avctx->err_recognition & AV_EF_EXPLODE &&
( c->rgb_pic && mode != 0x01 && mode != 0x02 && mode != 0x04 ||
@@ -540,8 +530,6 @@ int ff_mss12_decode_rect(SliceContext *sc, ArithCoder *acoder,
int x, int y, int width, int height)
{
int mode, pivot;
if (acoder->overread > MAX_OVERREAD)
return AVERROR_INVALIDDATA;
mode = acoder->get_model_sym(acoder, &sc->split_mode);
-2
View File
@@ -47,8 +47,6 @@ typedef struct Model {
typedef struct ArithCoder {
int low, high, value;
int overread;
#define MAX_OVERREAD 16
union {
GetBitContext *gb;
GetByteContext *gB;
-1
View File
@@ -152,7 +152,6 @@ static void arith2_init(ArithCoder *c, GetByteContext *gB)
c->low = 0;
c->high = 0xFFFFFF;
c->value = bytestream2_get_be24(gB);
c->overread = 0;
c->gbc.gB = gB;
c->get_model_sym = arith2_get_model_sym;
c->get_number = arith2_get_number;
-4
View File
@@ -298,10 +298,6 @@ static void rac_normalise(RangeCoder *c)
c->got_error = 1;
c->low = 1;
}
if (c->low > c->range) {
c->got_error = 1;
c->low = 1;
}
if (c->range >= RAC_BOTTOM)
return;
}
+8 -8
View File
@@ -473,9 +473,9 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
in_port_params.format.video.nFrameWidth = avctx->width;
in_port_params.format.video.nFrameHeight = avctx->height;
if (avctx->framerate.den > 0 && avctx->framerate.num > 0)
in_port_params.format.video.xFramerate = (1LL << 16) * avctx->framerate.num / avctx->framerate.den;
in_port_params.format.video.xFramerate = (1 << 16) * avctx->framerate.num / avctx->framerate.den;
else
in_port_params.format.video.xFramerate = (1LL << 16) * avctx->time_base.den / avctx->time_base.num;
in_port_params.format.video.xFramerate = (1 << 16) * avctx->time_base.den / avctx->time_base.num;
err = OMX_SetParameter(s->handle, OMX_IndexParamPortDefinition, &in_port_params);
CHECK(err);
@@ -644,6 +644,10 @@ static av_cold int omx_encode_init(AVCodecContext *avctx)
OMX_BUFFERHEADERTYPE *buffer;
OMX_ERRORTYPE err;
#if CONFIG_OMX_RPI
s->input_zerocopy = 1;
#endif
s->omx_context = omx_init(avctx, s->libname, s->libprefix);
if (!s->omx_context)
return AVERROR_ENCODER_NOT_FOUND;
@@ -735,7 +739,6 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int ret = 0;
OMX_BUFFERHEADERTYPE* buffer;
OMX_ERRORTYPE err;
int had_partial = 0;
if (frame) {
uint8_t *dst[4];
@@ -827,7 +830,7 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
// packet, or get EOS.
buffer = get_buffer(&s->output_mutex, &s->output_cond,
&s->num_done_out_buffers, s->done_out_buffers,
!frame || had_partial);
!frame);
if (!buffer)
break;
@@ -862,9 +865,6 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
s->output_buf = NULL;
s->output_buf_size = 0;
}
#if CONFIG_OMX_RPI
had_partial = 1;
#endif
} else {
// End of frame, and the caller provided a preallocated frame
if ((ret = ff_alloc_packet2(avctx, pkt, s->output_buf_size + buffer->nFilledLen, 0)) < 0) {
@@ -913,7 +913,7 @@ static av_cold int omx_encode_end(AVCodecContext *avctx)
static const AVOption options[] = {
{ "omx_libname", "OpenMAX library name", OFFSET(libname), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
{ "omx_libprefix", "OpenMAX library prefix", OFFSET(libprefix), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
{ "zerocopy", "Try to avoid copying input frames if possible", OFFSET(input_zerocopy), AV_OPT_TYPE_INT, { .i64 = CONFIG_OMX_RPI }, 0, 1, VE },
{ "zerocopy", "Try to avoid copying input frames if possible", OFFSET(input_zerocopy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
{ "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, FF_PROFILE_H264_HIGH, VE, "profile" },
{ "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE }, 0, 0, VE, "profile" },
{ "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN }, 0, 0, VE, "profile" },
+1 -1
View File
@@ -1547,7 +1547,7 @@ static int decode_frame_lscr(AVCodecContext *avctx,
return ret;
nb_blocks = bytestream2_get_le16(gb);
if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * (12 + 8))
if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * 12)
return AVERROR_INVALIDDATA;
if (s->last_picture.f->data[0]) {
-5
View File
@@ -1727,11 +1727,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
s->sub_sampling = s->fft_order - 7;
s->frequency_range = 255 / (1 << (2 - s->sub_sampling));
if (s->frame_size * 4 >> s->sub_sampling > MPA_FRAME_SIZE) {
avpriv_request_sample(avctx, "large frames");
return AVERROR_PATCHWELCOME;
}
switch ((s->sub_sampling * 2 + s->channels - 1)) {
case 0: tmp = 40; break;
case 1: tmp = 48; break;
+5 -5
View File
@@ -220,7 +220,7 @@ static inline int extend_code(GetBitContext *gb, int val, int range, int bits)
val -= range;
}
if (bits)
val = ((unsigned)val << bits) | get_bits(gb, bits);
val = (val << bits) | get_bits(gb, bits);
return val;
}
@@ -286,7 +286,7 @@ static int decode_channel(RALFContext *ctx, GetBitContext *gb, int ch,
add_bits--;
range = 10;
range2 = 21;
code_vlc = set->long_codes + (code_params - 15);
code_vlc = set->long_codes + code_params - 15;
} else {
add_bits = 0;
range = 6;
@@ -300,8 +300,8 @@ static int decode_channel(RALFContext *ctx, GetBitContext *gb, int ch,
t = get_vlc2(gb, code_vlc->table, code_vlc->bits, 2);
code1 = t / range2;
code2 = t % range2;
dst[i] = extend_code(gb, code1, range, 0) * (1 << add_bits);
dst[i + 1] = extend_code(gb, code2, range, 0) * (1 << add_bits);
dst[i] = extend_code(gb, code1, range, 0) << add_bits;
dst[i + 1] = extend_code(gb, code2, range, 0) << add_bits;
if (add_bits) {
dst[i] |= get_bits(gb, add_bits);
dst[i + 1] |= get_bits(gb, add_bits);
@@ -323,7 +323,7 @@ static void apply_lpc(RALFContext *ctx, int ch, int length, int bits)
acc = 0;
for (j = 0; j < flen; j++)
acc += (unsigned)ctx->filter[j] * audio[i - j - 1];
acc += ctx->filter[j] * audio[i - j - 1];
if (acc < 0) {
acc = (acc + bias - 1) >> ctx->filter_bits;
acc = FFMAX(acc, min_clip);
-5
View File
@@ -134,15 +134,10 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
Rl2Context *s = avctx->priv_data;
int back_size;
int i;
int ret;
s->avctx = avctx;
avctx->pix_fmt = AV_PIX_FMT_PAL8;
ret = ff_set_dimensions(avctx, 320, 200);
if (ret < 0)
return ret;
/** parse extra data */
if (!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid extradata size\n");
+5 -5
View File
@@ -491,11 +491,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->avctx = avctx;
ctx->version = !avctx->extradata_size;
// early sanity check before allocations to avoid need for deallocation code.
if (!ctx->version && avctx->extradata_size < 1026) {
av_log(avctx, AV_LOG_ERROR, "Not enough extradata.\n");
return AVERROR_INVALIDDATA;
}
avctx->pix_fmt = ctx->version ? AV_PIX_FMT_RGB565 : AV_PIX_FMT_PAL8;
@@ -511,6 +506,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (!ctx->version) {
int i;
if (avctx->extradata_size < 1026) {
av_log(avctx, AV_LOG_ERROR, "Not enough extradata.\n");
return AVERROR_INVALIDDATA;
}
ctx->subversion = AV_RL16(avctx->extradata);
for (i = 0; i < PALETTE_SIZE; i++)
ctx->pal[i] = 0xFFU << 24 | AV_RL32(avctx->extradata + 2 + i * 4);
+4 -3
View File
@@ -532,7 +532,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
s->current_frame->linesize[0] / 4);
} else if (type == 17 || type == 33) {
uint32_t clr, *dst = (uint32_t *)s->current_frame->data[0];
int y;
int x, y;
frame->key_frame = 1;
bytestream2_skip(gb, 1);
@@ -548,8 +548,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
clr = bytestream2_get_le24(gb);
}
for (y = 0; y < avctx->height; y++) {
dst[0] = clr;
av_memcpy_backptr((uint8_t*)(dst+1), 4, 4*avctx->width - 4);
for (x = 0; x < avctx->width; x++) {
dst[x] = clr;
}
dst += s->current_frame->linesize[0] / 4;
}
} else if (type == 0 || type == 1) {
+1 -10
View File
@@ -1399,7 +1399,7 @@ static int decode_frame(AVCodecContext *avctx,
TiffContext *const s = avctx->priv_data;
AVFrame *const p = data;
ThreadFrame frame = { .f = data };
unsigned off, last_off;
unsigned off;
int le, ret, plane, planes;
int i, j, entries, stride;
unsigned soff, ssize;
@@ -1454,7 +1454,6 @@ again:
/** whether we should process this multi-page IFD's next page */
retry_for_page = s->get_page && s->cur_page + 1 < s->get_page; // get_page is 1-indexed
last_off = off;
if (retry_for_page) {
// set offset to the next IFD
off = ff_tget_long(&s->gb, le);
@@ -1464,14 +1463,6 @@ again:
}
if (retry_for_subifd || retry_for_page) {
if (!off) {
av_log(avctx, AV_LOG_ERROR, "Requested entry not found\n");
return AVERROR_INVALIDDATA;
}
if (off <= last_off) {
avpriv_request_sample(s->avctx, "non increasing IFD offset\n");
return AVERROR_INVALIDDATA;
}
if (off >= UINT_MAX - 14 || avpkt->size < off + 14) {
av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n");
return AVERROR_INVALIDDATA;
+6 -6
View File
@@ -619,7 +619,7 @@ static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int
ct = ctx->D[0] + ctx->D[1] + ctx->D[2] + ctx->D[3];
if (bx > 0)
left = last[-1] - (unsigned)ct;
left = last[-1] - ct;
else
left = 0;
@@ -630,7 +630,7 @@ static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int
last[2] = right - (diff >> 2);
last[3] = right;
{
unsigned tp = left;
int tp = left;
ctx->D[0] = (tp + (ct >> 2)) - left;
left += ctx->D[0];
@@ -764,10 +764,10 @@ static inline void tm2_motion_block(TM2Context *ctx, AVFrame *pic, int bx, int b
}
/* calculate deltas */
Y -= Ystride * 4;
ctx->D[0] = (unsigned)Y[3] - last[3];
ctx->D[1] = (unsigned)Y[3 + Ystride] - Y[3];
ctx->D[2] = (unsigned)Y[3 + Ystride * 2] - Y[3 + Ystride];
ctx->D[3] = (unsigned)Y[3 + Ystride * 3] - Y[3 + Ystride * 2];
ctx->D[0] = Y[3] - last[3];
ctx->D[1] = Y[3 + Ystride] - Y[3];
ctx->D[2] = Y[3 + Ystride * 2] - Y[3 + Ystride];
ctx->D[3] = Y[3 + Ystride * 3] - Y[3 + Ystride * 2];
for (i = 0; i < 4; i++)
last[i] = Y[i + Ystride * 3];
}
+5 -5
View File
@@ -227,7 +227,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
GetBitContext gb;
int i, ret;
int cur_chan = 0, framelen = s->frame_length;
uint32_t *p;
int32_t *p;
if (avctx->err_recognition & AV_EF_CRCCHECK) {
if (buf_size < 4 ||
@@ -261,7 +261,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
}
i = 0;
for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++) {
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) {
int32_t *predictor = &s->ch_ctx[cur_chan].predictor;
TTAFilter *filter = &s->ch_ctx[cur_chan].filter;
TTARice *rice = &s->ch_ctx[cur_chan].rice;
@@ -334,7 +334,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
// decorrelate in case of multiple channels
if (s->channels > 1) {
int32_t *r = p - 1;
for (*p += *r / 2; r > (int32_t*)p - s->channels; r--)
for (*p += *r / 2; r > p - s->channels; r--)
*r = *(r + 1) - *r;
}
cur_chan = 0;
@@ -358,13 +358,13 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
switch (s->bps) {
case 1: {
uint8_t *samples = (uint8_t *)frame->data[0];
for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++)
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++)
*samples++ = *p + 0x80;
break;
}
case 2: {
int16_t *samples = (int16_t *)frame->data[0];
for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++)
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++)
*samples++ = *p;
break;
}
-1
View File
@@ -1041,7 +1041,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_dict_free(&tmp);
av_freep(&avctx->priv_data);
av_freep(&avctx->subtitle_header);
if (avctx->internal) {
av_frame_free(&avctx->internal->to_free);
av_frame_free(&avctx->internal->compat_decode_frame);
-3
View File
@@ -199,9 +199,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
uint32_t size;
int offset = 0;
if (avpkt->size < 2)
return AVERROR_INVALIDDATA;
bytestream2_init(&c->stream, avpkt->data, avpkt->size);
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+16 -35
View File
@@ -430,12 +430,12 @@ static inline int ff_vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
if (c_avail && (n != 1 && n != 3)) {
q2 = FFABS(s->current_picture.qscale_table[mb_pos - 1]);
if (q2 && q2 != q1)
c = (int)((unsigned)c * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18;
c = (c * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18;
}
if (a_avail && (n != 2 && n != 3)) {
q2 = FFABS(s->current_picture.qscale_table[mb_pos - s->mb_stride]);
if (q2 && q2 != q1)
a = (int)((unsigned)a * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18;
a = (a * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18;
}
if (a_avail && c_avail && (n != 3)) {
int off = mb_pos;
@@ -445,7 +445,7 @@ static inline int ff_vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
off -= s->mb_stride;
q2 = FFABS(s->current_picture.qscale_table[off]);
if (q2 && q2 != q1)
b = (int)((unsigned)b * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18;
b = (b * s->y_dc_scale_table[q2] * ff_vc1_dqscale[dqscale_index] + 0x20000) >> 18;
}
if (c_avail && (!a_avail || abs(a - b) <= abs(b - c))) {
@@ -526,8 +526,6 @@ static int vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip,
int escape = decode210(gb);
if (escape != 2) {
index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
if (index >= ff_vc1_ac_sizes[codingset] - 1U)
return AVERROR_INVALIDDATA;
run = vc1_index_decode_table[codingset][index][0];
level = vc1_index_decode_table[codingset][index][1];
lst = index >= vc1_last_decode_table[codingset];
@@ -1378,15 +1376,13 @@ static int vc1_decode_p_mb(VC1Context *v)
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
if (v->rangeredfrm)
for (j = 0; j < 64; j++)
v->block[v->cur_blk_idx][block_map[i]][j] *= 2;
v->block[v->cur_blk_idx][block_map[i]][j] <<= 1;
block_cbp |= 0xF << (i << 2);
block_intra |= 1 << i;
} else if (val) {
pat = vc1_decode_p_block(v, v->block[v->cur_blk_idx][block_map[i]], i, mquant, ttmb, first_block,
s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
if (pat < 0)
return pat;
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
@@ -1490,8 +1486,6 @@ static int vc1_decode_p_mb(VC1Context *v)
(i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY),
&block_tt);
if (pat < 0)
return pat;
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
@@ -1702,8 +1696,6 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
if (pat < 0)
return pat;
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
@@ -1840,8 +1832,6 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
(i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY),
&block_tt);
if (pat < 0)
return pat;
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
@@ -1861,7 +1851,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
/** Decode one B-frame MB (in Main profile)
*/
static int vc1_decode_b_mb(VC1Context *v)
static void vc1_decode_b_mb(VC1Context *v)
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
@@ -1927,7 +1917,7 @@ static int vc1_decode_b_mb(VC1Context *v)
bmvtype = BMV_TYPE_INTERPOLATED;
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return 0;
return;
}
if (direct) {
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
@@ -1944,7 +1934,7 @@ static int vc1_decode_b_mb(VC1Context *v)
/* no coded blocks - effectively skipped */
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return 0;
return;
}
if (s->mb_intra && !mb_has_coeffs) {
GET_MQUANT();
@@ -1959,7 +1949,7 @@ static int vc1_decode_b_mb(VC1Context *v)
/* interpolated skipped block */
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
return 0;
return;
}
}
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
@@ -2003,23 +1993,20 @@ static int vc1_decode_b_mb(VC1Context *v)
i & 4 ? s->uvlinesize
: s->linesize);
} else if (val) {
int pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), NULL);
if (pat < 0)
return pat;
vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), NULL);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
first_block = 0;
}
}
return 0;
}
/** Decode one B-frame MB (in interlaced field B picture)
*/
static int vc1_decode_b_mb_intfi(VC1Context *v)
static void vc1_decode_b_mb_intfi(VC1Context *v)
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
@@ -2124,7 +2111,7 @@ static int vc1_decode_b_mb_intfi(VC1Context *v)
dmv_x[1] = dmv_y[1] = pred_flag[0] = 0;
if (!s->next_picture_ptr->field_picture) {
av_log(s->avctx, AV_LOG_ERROR, "Mixed field/frame direct mode not supported\n");
return AVERROR_INVALIDDATA;
return;
}
}
ff_vc1_pred_b_mv_intfi(v, 0, dmv_x, dmv_y, 1, pred_flag);
@@ -2169,8 +2156,6 @@ static int vc1_decode_b_mb_intfi(VC1Context *v)
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : s->linesize,
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
if (pat < 0)
return pat;
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
@@ -2180,8 +2165,6 @@ static int vc1_decode_b_mb_intfi(VC1Context *v)
}
v->cbp[s->mb_x] = block_cbp;
v->ttblk[s->mb_x] = block_tt;
return 0;
}
/** Decode one B-frame MB (in interlaced frame B picture)
@@ -2468,8 +2451,6 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
if (pat < 0)
return pat;
block_cbp |= pat << (i << 2);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
@@ -2619,13 +2600,13 @@ static void vc1_decode_i_blocks(VC1Context *v)
if (v->rangeredfrm)
for (k = 0; k < 6; k++)
for (j = 0; j < 64; j++)
v->block[v->cur_blk_idx][block_map[k]][j] *= 2;
v->block[v->cur_blk_idx][block_map[k]][j] <<= 1;
vc1_put_blocks_clamped(v, 1);
} else {
if (v->rangeredfrm)
for (k = 0; k < 6; k++)
for (j = 0; j < 64; j++)
v->block[v->cur_blk_idx][block_map[k]][j] = (v->block[v->cur_blk_idx][block_map[k]][j] - 64) * 2;
v->block[v->cur_blk_idx][block_map[k]][j] = (v->block[v->cur_blk_idx][block_map[k]][j] - 64) << 1;
vc1_put_blocks_clamped(v, 0);
}
+2 -3
View File
@@ -178,7 +178,7 @@ static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */,
brfd = FFMIN(v->brfd, 3);
scalesame = ff_vc1_b_field_mvpred_scales[0][brfd];
n = (n * scalesame >> 8) * (1 << hpel);
n = (n * scalesame >> 8) << hpel;
return n;
}
@@ -197,10 +197,9 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
return n;
}
if (v->s.pict_type != AV_PICTURE_TYPE_B)
refdist = v->refdist;
refdist = FFMIN(v->refdist, 3);
else
refdist = dir ? v->brfd : v->frfd;
refdist = FFMIN(refdist, 3);
scaleopp = ff_vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
n = (n * scaleopp >> 8) * (1 << hpel);
-5
View File
@@ -450,11 +450,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
if ((ret = ff_vc1_decode_sequence_header(avctx, v, &gb)) < 0)
return ret;
if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE && !v->res_sprite) {
avpriv_request_sample(avctx, "Non sprite WMV3IMAGE");
return AVERROR_PATCHWELCOME;
}
count = avctx->extradata_size*8 - get_bits_count(&gb);
if (count > 0) {
av_log(avctx, AV_LOG_INFO, "Extra data: %i bits left, value: %X\n",
+1 -1
View File
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 54
#define LIBAVCODEC_VERSION_MINOR 55
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
+10 -36
View File
@@ -1182,9 +1182,6 @@ static int vorbis_floor0_decode(vorbis_context *vc,
q *= q;
}
if (p + q == 0.0)
return AVERROR_INVALIDDATA;
/* calculate linear floor value */
q = exp((((amplitude*vf->amplitude_offset) /
(((1ULL << vf->amplitude_bits) - 1) * sqrt(p + q)))
@@ -1361,12 +1358,8 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
return AVERROR_INVALIDDATA;
}
if (vr->classifications == 1) {
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
if (i < ptns_to_read)
vr->classifs[p + i] = 0;
}
} else {
av_assert0(vr->classifications > 1); //needed for inverse[]
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
temp2 = (((uint64_t)temp) * inverse_class) >> 32;
@@ -1374,7 +1367,6 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
vr->classifs[p + i] = temp - temp2 * vr->classifications;
temp = temp2;
}
}
}
p += ptns_to_read;
}
@@ -1442,7 +1434,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
int vqbook = vr->books[vqclass][pass];
if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) {
int coffs;
unsigned coffs;
unsigned dim = vc->codebooks[vqbook].dimensions;
unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
vorbis_codebook codebook = vc->codebooks[vqbook];
@@ -1451,20 +1443,14 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
voffs = voffset+j*vlen;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
if (coffs < 0)
return coffs;
coffs *= dim;
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l)
vec[voffs + k + l * step] += codebook.codevectors[coffs + l];
}
} else if (vr_type == 1) {
voffs = voffset + j * vlen;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
if (coffs < 0)
return coffs;
coffs *= dim;
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l, ++voffs) {
vec[voffs]+=codebook.codevectors[coffs+l];
@@ -1477,19 +1463,13 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
if (dim == 2) {
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
if (coffs < 0)
return coffs;
coffs *= 2;
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2;
vec[voffs + k ] += codebook.codevectors[coffs ];
vec[voffs + k + vlen] += codebook.codevectors[coffs + 1];
}
} else if (dim == 4) {
for (k = 0; k < step; ++k, voffs += 2) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
if (coffs < 0)
return coffs;
coffs *= 4;
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4;
vec[voffs ] += codebook.codevectors[coffs ];
vec[voffs + 1 ] += codebook.codevectors[coffs + 2];
vec[voffs + vlen ] += codebook.codevectors[coffs + 1];
@@ -1497,10 +1477,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
}
} else
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
if (coffs < 0)
return coffs;
coffs *= dim;
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; l += 2, voffs++) {
vec[voffs ] += codebook.codevectors[coffs + l ];
vec[voffs + vlen] += codebook.codevectors[coffs + l + 1];
@@ -1513,14 +1490,11 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
}
} else if (vr_type == 2) {
unsigned voffs_div = ch == 1 ? voffset : FASTDIV(voffset, ch);
unsigned voffs_div = FASTDIV(voffset << 1, ch <<1);
unsigned voffs_mod = voffset - voffs_div * ch;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
if (coffs < 0)
return coffs;
coffs *= dim;
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l) {
vec[voffs_div + voffs_mod * vlen] +=
codebook.codevectors[coffs + l];
-10
View File
@@ -710,8 +710,6 @@ static int vp4_unpack_macroblocks(Vp3DecodeContext *s, GetBitContext *gb)
has_partial = 0;
bit = get_bits1(gb);
for (i = 0; i < s->yuv_macroblock_count; i += current_run) {
if (get_bits_left(gb) <= 0)
return AVERROR_INVALIDDATA;
current_run = vp4_get_mb_count(s, gb);
if (current_run > s->yuv_macroblock_count - i)
return -1;
@@ -721,8 +719,6 @@ static int vp4_unpack_macroblocks(Vp3DecodeContext *s, GetBitContext *gb)
}
if (has_partial) {
if (get_bits_left(gb) <= 0)
return AVERROR_INVALIDDATA;
bit = get_bits1(gb);
current_run = vp4_get_mb_count(s, gb);
for (i = 0; i < s->yuv_macroblock_count; i++) {
@@ -1407,8 +1403,6 @@ static int vp4_unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
int eob_run;
while (!eob_tracker[coeff_i]) {
if (get_bits_left(gb) < 1)
return AVERROR_INVALIDDATA;
token = get_vlc2(gb, vlc_tables[coeff_i]->table, 11, 3);
@@ -2963,10 +2957,6 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
s->theora_header = 0;
s->theora = get_bits_long(gb, 24);
av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
if (!s->theora) {
s->theora = 1;
avpriv_request_sample(s->avctx, "theora 0");
}
/* 3.2.0 aka alpha3 has the same frame orientation as original vp3
* but previous versions have the image flipped relative to vp3 */
+1 -1
View File
@@ -183,7 +183,7 @@ static int vp5_parse_coeff(VP56Context *s)
int b, i, cg, idx, ctx, ctx_last;
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
if (vpX_rac_is_end(c)) {
if (c->end <= c->buffer && c->bits >= 0) {
av_log(s->avctx, AV_LOG_ERROR, "End of AC stream reached in vp5_parse_coeff\n");
return AVERROR_INVALIDDATA;
}
+2 -2
View File
@@ -572,7 +572,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
VP56Context *s = avctx->priv_data;
AVFrame *const p = s->frames[VP56_FRAME_CURRENT];
int remaining_buf_size = avpkt->size;
int alpha_offset = remaining_buf_size;
int av_uninit(alpha_offset);
int i, res;
int ret;
@@ -585,7 +585,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_INVALIDDATA;
}
res = s->parse_header(s, buf, alpha_offset);
res = s->parse_header(s, buf, remaining_buf_size);
if (res < 0)
return res;
+1 -1
View File
@@ -473,7 +473,7 @@ static int vp6_parse_coeff(VP56Context *s)
int b, i, cg, idx, ctx;
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
if (vpX_rac_is_end(c)) {
if (c->end <= c->buffer && c->bits >= 0) {
av_log(s->avctx, AV_LOG_ERROR, "End of AC stream reached in vp6_parse_coeff\n");
return AVERROR_INVALIDDATA;
}
+3 -3
View File
@@ -661,7 +661,7 @@ static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
s->fade_present = vp8_rac_get(c);
}
if (vpX_rac_is_end(c))
if (c->end <= c->buffer && c->bits >= 0)
return AVERROR_INVALIDDATA;
/* E. Fading information for previous frame */
if (s->fade_present && vp8_rac_get(c)) {
@@ -2372,7 +2372,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
curframe->tf.f->data[2] + 8 * mb_y * s->uvlinesize
};
if (vpX_rac_is_end(c))
if (c->end <= c->buffer && c->bits >= 0)
return AVERROR_INVALIDDATA;
if (mb_y == 0)
@@ -2403,7 +2403,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
td->mv_bounds.mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
if (vpX_rac_is_end(c))
if (c->end <= c->buffer && c->bits >= 0)
return AVERROR_INVALIDDATA;
// Wait for previous thread to read mb_x+2, and reach mb_y-1.
if (prev_td != td) {
+1 -1
View File
@@ -147,7 +147,7 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
}
s->width = AV_RL16(&s->avctx->extradata[6]);
s->height = AV_RL16(&s->avctx->extradata[8]);
if ((ret = ff_set_dimensions(avctx, s->width, s->height)) < 0) {
if ((ret = av_image_check_size(s->width, s->height, 0, avctx)) < 0) {
s->width= s->height= 0;
return ret;
}
+1 -1
View File
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVDEVICE_VERSION_MAJOR 58
#define LIBAVDEVICE_VERSION_MINOR 8
#define LIBAVDEVICE_VERSION_MINOR 9
#define LIBAVDEVICE_VERSION_MICRO 100
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
+1 -1
View File
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 7
#define LIBAVFILTER_VERSION_MINOR 57
#define LIBAVFILTER_VERSION_MINOR 58
#define LIBAVFILTER_VERSION_MICRO 100
+1 -1
View File
@@ -71,7 +71,7 @@ __global__ void Thumbnail_ushort2(cudaTextureObject_t ushort2_tex,
{
ushort2 pixel = tex2D<ushort2>(ushort2_tex, x, y);
atomicAdd(&histogram[(pixel.x + 128) >> 8], 1);
atomicAdd(&histogram[256 + ((pixel.y + 128) >> 8)], 1);
atomicAdd(&histogram[256 + (pixel.y + 128) >> 8], 1);
}
}
+42 -62
View File
@@ -76,6 +76,18 @@ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size)
return ret;
}
typedef struct AV1SequenceParameters {
uint8_t seq_profile;
uint8_t seq_level_idx_0;
uint8_t seq_tier_0;
uint8_t high_bitdepth;
uint8_t twelve_bit;
uint8_t monochrome;
uint8_t chroma_subsampling_x;
uint8_t chroma_subsampling_y;
uint8_t chroma_sample_position;
} AV1SequenceParameters;
static inline void uvlc(GetBitContext *gb)
{
int leading_zeros = 0;
@@ -94,51 +106,49 @@ static inline void uvlc(GetBitContext *gb)
static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb)
{
int twelve_bit = 0;
int high_bitdepth = get_bits1(gb);
if (seq_params->profile == FF_PROFILE_AV1_PROFESSIONAL && high_bitdepth)
twelve_bit = get_bits1(gb);
int color_primaries, transfer_characteristics, matrix_coefficients;
seq_params->bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2);
seq_params->high_bitdepth = get_bits1(gb);
if (seq_params->seq_profile == FF_PROFILE_AV1_PROFESSIONAL && seq_params->high_bitdepth)
seq_params->twelve_bit = get_bits1(gb);
if (seq_params->profile == FF_PROFILE_AV1_HIGH)
if (seq_params->seq_profile == FF_PROFILE_AV1_HIGH)
seq_params->monochrome = 0;
else
seq_params->monochrome = get_bits1(gb);
seq_params->color_description_present_flag = get_bits1(gb);
if (seq_params->color_description_present_flag) {
seq_params->color_primaries = get_bits(gb, 8);
seq_params->transfer_characteristics = get_bits(gb, 8);
seq_params->matrix_coefficients = get_bits(gb, 8);
if (get_bits1(gb)) { // color_description_present_flag
color_primaries = get_bits(gb, 8);
transfer_characteristics = get_bits(gb, 8);
matrix_coefficients = get_bits(gb, 8);
} else {
seq_params->color_primaries = AVCOL_PRI_UNSPECIFIED;
seq_params->transfer_characteristics = AVCOL_TRC_UNSPECIFIED;
seq_params->matrix_coefficients = AVCOL_SPC_UNSPECIFIED;
color_primaries = AVCOL_PRI_UNSPECIFIED;
transfer_characteristics = AVCOL_TRC_UNSPECIFIED;
matrix_coefficients = AVCOL_SPC_UNSPECIFIED;
}
if (seq_params->monochrome) {
seq_params->color_range = get_bits1(gb);
skip_bits1(gb); // color_range
seq_params->chroma_subsampling_x = 1;
seq_params->chroma_subsampling_y = 1;
seq_params->chroma_sample_position = 0;
return 0;
} else if (seq_params->color_primaries == AVCOL_PRI_BT709 &&
seq_params->transfer_characteristics == AVCOL_TRC_IEC61966_2_1 &&
seq_params->matrix_coefficients == AVCOL_SPC_RGB) {
} else if (color_primaries == AVCOL_PRI_BT709 &&
transfer_characteristics == AVCOL_TRC_IEC61966_2_1 &&
matrix_coefficients == AVCOL_SPC_RGB) {
seq_params->chroma_subsampling_x = 0;
seq_params->chroma_subsampling_y = 0;
} else {
seq_params->color_range = get_bits1(gb);
skip_bits1(gb); // color_range
if (seq_params->profile == FF_PROFILE_AV1_MAIN) {
if (seq_params->seq_profile == FF_PROFILE_AV1_MAIN) {
seq_params->chroma_subsampling_x = 1;
seq_params->chroma_subsampling_y = 1;
} else if (seq_params->profile == FF_PROFILE_AV1_HIGH) {
} else if (seq_params->seq_profile == FF_PROFILE_AV1_HIGH) {
seq_params->chroma_subsampling_x = 0;
seq_params->chroma_subsampling_y = 0;
} else {
if (twelve_bit) {
if (seq_params->twelve_bit) {
seq_params->chroma_subsampling_x = get_bits1(gb);
if (seq_params->chroma_subsampling_x)
seq_params->chroma_subsampling_y = get_bits1(gb);
@@ -175,14 +185,14 @@ static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_
memset(seq_params, 0, sizeof(*seq_params));
seq_params->profile = get_bits(&gb, 3);
seq_params->seq_profile = get_bits(&gb, 3);
skip_bits1(&gb); // still_picture
reduced_still_picture_header = get_bits1(&gb);
if (reduced_still_picture_header) {
seq_params->level = get_bits(&gb, 5);
seq_params->tier = 0;
seq_params->seq_level_idx_0 = get_bits(&gb, 5);
seq_params->seq_tier_0 = 0;
} else {
int initial_display_delay_present_flag, operating_points_cnt_minus_1;
int decoder_model_info_present_flag, buffer_delay_length_minus_1;
@@ -232,8 +242,8 @@ static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_
}
if (i == 0) {
seq_params->level = seq_level_idx;
seq_params->tier = seq_tier;
seq_params->seq_level_idx_0 = seq_level_idx;
seq_params->seq_tier_0 = seq_tier;
}
}
}
@@ -287,36 +297,6 @@ static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_
return 0;
}
int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size)
{
int64_t obu_size;
int start_pos, type, temporal_id, spatial_id;
if (size <= 0)
return AVERROR_INVALIDDATA;
while (size > 0) {
int len = parse_obu_header(buf, size, &obu_size, &start_pos,
&type, &temporal_id, &spatial_id);
if (len < 0)
return len;
switch (type) {
case AV1_OBU_SEQUENCE_HEADER:
if (!obu_size)
return AVERROR_INVALIDDATA;
return parse_sequence_header(seq, buf + start_pos, obu_size);
default:
break;
}
size -= len;
buf += len;
}
return AVERROR_INVALIDDATA;
}
int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
{
AVIOContext *seq_pb = NULL, *meta_pb = NULL;
@@ -383,11 +363,11 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
put_bits(&pbc, 1, 1); // marker
put_bits(&pbc, 7, 1); // version
put_bits(&pbc, 3, seq_params.profile);
put_bits(&pbc, 5, seq_params.level);
put_bits(&pbc, 1, seq_params.tier);
put_bits(&pbc, 1, seq_params.bitdepth > 8);
put_bits(&pbc, 1, seq_params.bitdepth == 12);
put_bits(&pbc, 3, seq_params.seq_profile);
put_bits(&pbc, 5, seq_params.seq_level_idx_0);
put_bits(&pbc, 1, seq_params.seq_tier_0);
put_bits(&pbc, 1, seq_params.high_bitdepth);
put_bits(&pbc, 1, seq_params.twelve_bit);
put_bits(&pbc, 1, seq_params.monochrome);
put_bits(&pbc, 1, seq_params.chroma_subsampling_x);
put_bits(&pbc, 1, seq_params.chroma_subsampling_y);
-28
View File
@@ -25,22 +25,6 @@
#include "avio.h"
typedef struct AV1SequenceParameters {
uint8_t profile;
uint8_t level;
uint8_t tier;
uint8_t bitdepth;
uint8_t monochrome;
uint8_t chroma_subsampling_x;
uint8_t chroma_subsampling_y;
uint8_t chroma_sample_position;
uint8_t color_description_present_flag;
uint8_t color_primaries;
uint8_t transfer_characteristics;
uint8_t matrix_coefficients;
uint8_t color_range;
} AV1SequenceParameters;
/**
* Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
* the resulting bitstream to the provided AVIOContext.
@@ -71,18 +55,6 @@ int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size);
*/
int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size);
/**
* Parses a Sequence Header from the the provided buffer.
*
* @param seq pointer to the AV1SequenceParameters where the parsed values will
* be written
* @param buf input data buffer
* @param size size in bytes of the input data buffer
*
* @return >= 0 in case of success, a negative AVERROR code in case of failure
*/
int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size);
/**
* Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided
* AVIOContext.
-3
View File
@@ -815,9 +815,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
"mov tag found in avi (fourcc %s)\n",
av_fourcc2str(tag1));
}
if (!st->codecpar->codec_id)
st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags_unofficial, tag1);
/* This is needed to get the pict type which is necessary
* for generating correct pts. */
st->need_parsing = AVSTREAM_PARSE_HEADERS;
+11 -28
View File
@@ -35,7 +35,6 @@
#include "libavutil/time.h"
#include "libavutil/time_internal.h"
#include "av1.h"
#include "avc.h"
#include "avformat.h"
#include "avio_internal.h"
@@ -386,21 +385,6 @@ static void set_codec_str(AVFormatContext *s, AVCodecParameters *par,
av_strlcatf(str, size, ".%02x%02x%02x",
extradata[1], extradata[2], extradata[3]);
av_free(tmpbuf);
} else if (!strcmp(str, "av01")) {
AV1SequenceParameters seq;
if (!par->extradata_size)
return;
if (ff_av1_parse_seq_header(&seq, par->extradata, par->extradata_size) < 0)
return;
av_strlcatf(str, size, ".%01u.%02u%s.%02u",
seq.profile, seq.level, seq.tier ? "H" : "M", seq.bitdepth);
if (seq.color_description_present_flag)
av_strlcatf(str, size, ".%01u.%01u%01u%01u.%02u.%02u.%02u.%01u",
seq.monochrome,
seq.chroma_subsampling_x, seq.chroma_subsampling_y, seq.chroma_sample_position,
seq.color_primaries, seq.transfer_characteristics, seq.matrix_coefficients,
seq.color_range);
}
}
@@ -1451,24 +1435,23 @@ static void find_index_range(AVFormatContext *s, const char *full_path,
}
static int update_stream_extradata(AVFormatContext *s, OutputStream *os,
AVPacket *pkt, AVRational *frame_rate)
AVCodecParameters *par,
AVRational *frame_rate)
{
AVCodecParameters *par = os->ctx->streams[0]->codecpar;
uint8_t *extradata;
int ret, extradata_size;
if (par->extradata_size)
if (os->ctx->streams[0]->codecpar->extradata_size || !par->extradata_size)
return 0;
extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &extradata_size);
if (!extradata_size)
return 0;
extradata = av_malloc(par->extradata_size);
ret = ff_alloc_extradata(par, extradata_size);
if (ret < 0)
return ret;
if (!extradata)
return AVERROR(ENOMEM);
memcpy(par->extradata, extradata, extradata_size);
memcpy(extradata, par->extradata, par->extradata_size);
os->ctx->streams[0]->codecpar->extradata = extradata;
os->ctx->streams[0]->codecpar->extradata_size = par->extradata_size;
set_codec_str(s, par, frame_rate, os->codec_str, sizeof(os->codec_str));
@@ -1685,7 +1668,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
int64_t seg_end_duration, elapsed_duration;
int ret;
ret = update_stream_extradata(s, os, pkt, &st->avg_frame_rate);
ret = update_stream_extradata(s, os, st->codecpar, &st->avg_frame_rate);
if (ret < 0)
return ret;
+5 -12
View File
@@ -97,8 +97,8 @@ typedef enum {
typedef const struct EbmlSyntax {
uint32_t id;
EbmlType type;
size_t list_elem_size;
size_t data_offset;
int list_elem_size;
int data_offset;
union {
int64_t i;
uint64_t u;
@@ -110,7 +110,6 @@ typedef const struct EbmlSyntax {
typedef struct EbmlList {
int nb_elem;
unsigned int alloc_elem_size;
void *elem;
} EbmlList;
@@ -758,7 +757,7 @@ static int matroska_reset_status(MatroskaDemuxContext *matroska,
uint32_t id, int64_t position)
{
if (position >= 0) {
int64_t err = avio_seek(matroska->ctx->pb, position, SEEK_SET);
int err = avio_seek(matroska->ctx->pb, position, SEEK_SET);
if (err < 0)
return err;
}
@@ -1237,13 +1236,8 @@ static int ebml_parse(MatroskaDemuxContext *matroska,
data = (char *) data + syntax->data_offset;
if (syntax->list_elem_size) {
EbmlList *list = data;
void *newelem;
if ((unsigned)list->nb_elem + 1 >= UINT_MAX / syntax->list_elem_size)
return AVERROR(ENOMEM);
newelem = av_fast_realloc(list->elem,
&list->alloc_elem_size,
(list->nb_elem + 1) * syntax->list_elem_size);
void *newelem = av_realloc_array(list->elem, list->nb_elem + 1,
syntax->list_elem_size);
if (!newelem)
return AVERROR(ENOMEM);
list->elem = newelem;
@@ -1496,7 +1490,6 @@ static void ebml_free(EbmlSyntax *syntax, void *data)
ebml_free(syntax[i].def.n, ptr);
av_freep(&list->elem);
list->nb_elem = 0;
list->alloc_elem_size = 0;
} else
ebml_free(syntax[i].def.n, data_off);
default:
+2 -5
View File
@@ -88,7 +88,7 @@ static int mpc_read_header(AVFormatContext *s)
st = avformat_new_stream(s, NULL);
if (!st)
goto mem_error;
return AVERROR(ENOMEM);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_MUSEPACK7;
st->codecpar->channels = 2;
@@ -96,7 +96,7 @@ static int mpc_read_header(AVFormatContext *s)
st->codecpar->bits_per_coded_sample = 16;
if (ff_get_extradata(s, st->codecpar, s->pb, 16) < 0)
goto mem_error;
return AVERROR(ENOMEM);
st->codecpar->sample_rate = mpc_rate[st->codecpar->extradata[2] & 3];
avpriv_set_pts_info(st, 32, MPC_FRAMESIZE, st->codecpar->sample_rate);
/* scan for seekpoints */
@@ -113,9 +113,6 @@ static int mpc_read_header(AVFormatContext *s)
}
return 0;
mem_error:
av_freep(&c->frames);
return AVERROR(ENOMEM);
}
static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
+3 -12
View File
@@ -1303,17 +1303,15 @@ skip:
st = pst;
}
}
if (f->last_pcr != -1 && !f->discard) {
if (f->last_pcr != -1 && st && st->discard != AVDISCARD_ALL) {
// teletext packets do not always have correct timestamps,
// the standard says they should be handled after 40.6 ms at most,
// and the pcr error to this packet should be no more than 100 ms.
// TODO: we should interpolate the PCR, not just use the last one
int64_t pcr = f->last_pcr / 300;
pcr_found = 1;
if (st) {
pes->st->pts_wrap_reference = st->pts_wrap_reference;
pes->st->pts_wrap_behavior = st->pts_wrap_behavior;
}
pes->st->pts_wrap_reference = st->pts_wrap_reference;
pes->st->pts_wrap_behavior = st->pts_wrap_behavior;
if (pes->dts == AV_NOPTS_VALUE || pes->dts < pcr) {
pes->pts = pes->dts = pcr;
} else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT &&
@@ -1725,13 +1723,6 @@ static void scte_data_cb(MpegTSFilter *filter, const uint8_t *section,
if (idx < 0)
return;
/**
* In case we receive an SCTE-35 packet before mpegts context is fully
* initialized.
*/
if (!ts->pkt)
return;
new_data_packet(section, section_len, ts->pkt);
ts->pkt->stream_index = idx;
prg = av_find_program_from_stream(ts->stream, NULL, idx);
+2 -2
View File
@@ -3508,8 +3508,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
} else {
if ((size = next_ofs - pos) <= 0) {
av_log(s, AV_LOG_ERROR, "bad size: %"PRId64"\n", size);
mxf->current_klv_data = (KLVPacket){{0}};
return AVERROR_INVALIDDATA;
ret = AVERROR_INVALIDDATA;
goto skip;
}
// We must not overread, because the next edit unit might be in another KLV
if (size > max_data_size)
+2 -1
View File
@@ -1944,7 +1944,8 @@ static int mxf_write_partition(AVFormatContext *s, int bodysid,
index_byte_count = 80;
if (index_byte_count) {
index_byte_count += 16 + 4; // add encoded ber4 length
// add encoded ber length
index_byte_count += 16 + klv_ber_length(index_byte_count);
index_byte_count += klv_fill_size(index_byte_count);
}
-12
View File
@@ -39,18 +39,6 @@ static int force_one_stream(AVFormatContext *s)
s->oformat->name);
return AVERROR(EINVAL);
}
if ( s->oformat->audio_codec != AV_CODEC_ID_NONE
&& s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
av_log(s, AV_LOG_ERROR, "%s files have exactly one audio stream\n",
s->oformat->name);
return AVERROR(EINVAL);
}
if ( s->oformat->video_codec != AV_CODEC_ID_NONE
&& s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
av_log(s, AV_LOG_ERROR, "%s files have exactly one video stream\n",
s->oformat->name);
return AVERROR(EINVAL);
}
return 0;
}
-6
View File
@@ -87,10 +87,6 @@ static int realtext_read_header(AVFormatContext *s)
/* save header to extradata */
const char *p = ff_smil_get_attr_ptr(buf.str, "duration");
if (st->codecpar->extradata) {
res = AVERROR_INVALIDDATA;
goto end;
}
if (p)
duration = read_ts(p);
st->codecpar->extradata = av_strdup(buf.str);
@@ -123,8 +119,6 @@ static int realtext_read_header(AVFormatContext *s)
end:
av_bprint_finalize(&buf, NULL);
if (res < 0)
ff_subtitles_queue_clean(&rt->q);
return res;
}
-5
View File
@@ -491,11 +491,6 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ AV_CODEC_ID_NONE, 0 }
};
const AVCodecTag ff_codec_bmp_tags_unofficial[] = {
{ AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
{ AV_CODEC_ID_NONE, 0 }
};
const AVCodecTag ff_codec_wav_tags[] = {
{ AV_CODEC_ID_PCM_S16LE, 0x0001 },
/* must come after s16le in this list */
-2
View File
@@ -73,8 +73,6 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *pa
extern const AVCodecTag ff_codec_bmp_tags[]; // exposed through avformat_get_riff_video_tags()
extern const AVCodecTag ff_codec_wav_tags[];
extern const AVCodecTag ff_codec_bmp_tags_unofficial[];
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale);
int ff_read_riff_info(AVFormatContext *s, int64_t size);
+1 -1
View File
@@ -32,7 +32,7 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 58
#define LIBAVFORMAT_VERSION_MINOR 29
#define LIBAVFORMAT_VERSION_MINOR 30
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
+10 -42
View File
@@ -153,10 +153,6 @@ static void decode_block(uint8_t *src, uint8_t *dest, unsigned size,
if (align) {
uint32_t tmpkey = *key_ptr - key;
if (a2 > s) {
a2 = s;
avpriv_request_sample(NULL, "tiny aligned block\n");
}
memcpy(tmp + align, src, a2);
xor_block(tmp, tmp, 4, key, &tmpkey);
memcpy(dest, tmp + align, a2);
@@ -255,9 +251,6 @@ static uint8_t *read_sb_block(AVIOContext *src, unsigned *size,
*key = tmpkey;
}
if (n < 8)
return NULL;
buf = av_malloc(n);
if (!buf)
return NULL;
@@ -277,7 +270,7 @@ static uint8_t *read_sb_block(AVIOContext *src, unsigned *size,
return buf;
}
static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size)
static void track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size)
{
int i,j;
int64_t off;
@@ -287,7 +280,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
pb = avio_alloc_context(buf, size, 0, NULL, NULL, NULL, NULL);
if (!pb)
return AVERROR(ENOMEM);
return;
ffio_read_varlen(pb); // track_header_len
avio_r8(pb); // '1'
@@ -378,40 +371,22 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
ffio_read_varlen(pb); // len_3
num_data = avio_r8(pb);
for (j = 0; j < num_data; j++) {
uint64_t len = ffio_read_varlen(pb);
if (len > INT_MAX/2 - xd_size) {
av_free(pb);
return AVERROR_INVALIDDATA;
}
data_len[j] = len;
xd_size += len;
data_len[j] = ffio_read_varlen(pb);
xd_size += data_len[j];
}
st->codecpar->extradata_size = 64 + xd_size + xd_size / 255;
if (ff_alloc_extradata(st->codecpar, st->codecpar->extradata_size)) {
av_free(pb);
return AVERROR(ENOMEM);
}
if (ff_alloc_extradata(st->codecpar, st->codecpar->extradata_size))
return;
p = st->codecpar->extradata;
p[0] = 2;
for (j = 0; j < num_data - 1; j++) {
unsigned delta = av_xiphlacing(&p[offset], data_len[j]);
if (delta > data_len[j]) {
av_free(pb);
return AVERROR_INVALIDDATA;
}
offset += delta;
}
for (j = 0; j < num_data - 1; j++)
offset += av_xiphlacing(&p[offset], data_len[j]);
for (j = 0; j < num_data; j++) {
int ret = avio_read(pb, &p[offset], data_len[j]);
if (ret < data_len[j]) {
st->codecpar->extradata_size = 0;
av_freep(&st->codecpar->extradata);
break;
}
avio_read(pb, &p[offset], data_len[j]);
offset += data_len[j];
}
@@ -421,7 +396,6 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
}
av_free(pb);
return 0;
}
static void track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, unsigned size)
@@ -524,7 +498,6 @@ static int viv_read_header(AVFormatContext *s)
uint32_t b22_size = 0;
uint32_t b22_key = 0;
uint8_t *buf = 0;
int ret;
avio_skip(pb, 9);
@@ -556,9 +529,6 @@ static int viv_read_header(AVFormatContext *s)
break;
block_len = ffio_read_varlen(pb);
if (avio_feof(pb) || block_len <= 0)
return AVERROR_INVALIDDATA;
block_type = avio_r8(pb);
if (block_type == 22) {
@@ -583,10 +553,8 @@ static int viv_read_header(AVFormatContext *s)
buf = read_vblock(pb, &v, key, &k2, 0);
if (!buf)
return AVERROR(EIO);
ret = track_header(viv, s, buf, v);
track_header(viv, s, buf, v);
av_free(buf);
if (ret < 0)
return ret;
buf = read_vblock(pb, &v, key, &k2, v);
if (!buf)
+5 -7
View File
@@ -233,9 +233,9 @@ static inline int wav_parse_bext_string(AVFormatContext *s, const char *key,
char temp[257];
int ret;
av_assert0(length < sizeof(temp));
if ((ret = avio_read(s->pb, temp, length)) != length)
return ret < 0 ? ret : AVERROR_INVALIDDATA;
av_assert0(length <= sizeof(temp));
if ((ret = avio_read(s->pb, temp, length)) < 0)
return ret;
temp[length] = 0;
@@ -304,10 +304,8 @@ static int wav_parse_bext_tag(AVFormatContext *s, int64_t size)
if (!(coding_history = av_malloc(size + 1)))
return AVERROR(ENOMEM);
if ((ret = avio_read(s->pb, coding_history, size)) != size) {
av_free(coding_history);
return ret < 0 ? ret : AVERROR_INVALIDDATA;
}
if ((ret = avio_read(s->pb, coding_history, size)) < 0)
return ret;
coding_history[size] = 0;
if ((ret = av_dict_set(&s->metadata, "coding_history", coding_history,
+1 -1
View File
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 56
#define LIBAVUTIL_VERSION_MINOR 31
#define LIBAVUTIL_VERSION_MINOR 32
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
+1 -1
View File
@@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBPOSTPROC_VERSION_MAJOR 55
#define LIBPOSTPROC_VERSION_MINOR 5
#define LIBPOSTPROC_VERSION_MINOR 6
#define LIBPOSTPROC_VERSION_MICRO 100
#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
+1 -1
View File
@@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBSWRESAMPLE_VERSION_MAJOR 3
#define LIBSWRESAMPLE_VERSION_MINOR 5
#define LIBSWRESAMPLE_VERSION_MINOR 6
#define LIBSWRESAMPLE_VERSION_MICRO 100
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
+1 -1
View File
@@ -27,7 +27,7 @@
#include "libavutil/version.h"
#define LIBSWSCALE_VERSION_MAJOR 5
#define LIBSWSCALE_VERSION_MINOR 5
#define LIBSWSCALE_VERSION_MINOR 6
#define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
+1
View File
@@ -25,6 +25,7 @@ compat/avisynth/avs/types.h
compat/avisynth/avxsynth_c.h
compat/avisynth/windowsPorts/basicDataTypeConversions.h
compat/avisynth/windowsPorts/windows2linux.h
compat/cuda/dynlink_loader.h
compat/djgpp/math.h
compat/float/float.h
compat/float/limits.h