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
56 changed files with 184 additions and 507 deletions

View File

@@ -36,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:

View File

@@ -1 +1 @@
4.2
4.1.git

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.

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 */

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

67
configure vendored
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 "$@"

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
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

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

View File

@@ -657,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;

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;
@@ -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) {

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;

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)

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 ||

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;

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;
}

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

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)

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]);

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

View File

@@ -143,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;
@@ -162,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);
@@ -176,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);
@@ -188,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;
@@ -204,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;
}
}
@@ -269,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,
@@ -437,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);

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

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) {
@@ -165,8 +163,6 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
/* 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;

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;
}

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.

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;

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);

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;

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;

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;
}

View File

@@ -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;
@@ -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);

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);

View File

@@ -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];
}

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);

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 < 0)
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];

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;
}

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, \

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;
}

View File

@@ -1403,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);
@@ -2959,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 */

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;
}

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, \

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

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);
}
}

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);

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.

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;

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)

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);
}

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);

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, \

View File

@@ -251,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;
@@ -273,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;
@@ -283,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'
@@ -374,20 +371,13 @@ 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;
@@ -396,12 +386,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
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];
}
@@ -411,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)
@@ -514,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);
@@ -570,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)

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,

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, \

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, \

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, \

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, \

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