mirror of
https://github.com/jellyfin/jellyfin-ffmpeg.git
synced 2026-09-03 05:09:58 +03:00
New upstream version 4.0.4
This commit is contained in:
@@ -1,6 +1,95 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 4.0.4:
|
||||
- avcodec/hevcdec: Avoid only partly skiping duplicate first slices
|
||||
- lavc/bmp: Avoid a heap buffer overwrite for 1bpp input.
|
||||
- avcodec/mpegpicture: Check size of edge_emu_buffer
|
||||
- avformat/mov: Fix potential integer overflow in entry check in mov_read_trun()
|
||||
- avcodec/truemotion2: Fix integer overflow in tm2_null_res_block()
|
||||
- avcodec/dfa: Check the chunk header is not truncated
|
||||
- avcodec/clearvideo: Check remaining data in P frames
|
||||
- avcodec/dvbsubdec: Check object position
|
||||
- avcodec/cdgraphics: Use ff_set_dimensions()
|
||||
- avformat/gdv: Check fps
|
||||
- configure: use vpx_codec_vp8_dx/cx for libvpx-vp8 checking
|
||||
- configure: add missing pthreads extralibs dependency for libvpx-vp9
|
||||
- avcodec/mpeg4videodec: Check idx in mpeg4_decode_studio_block()
|
||||
- avcodec/dxv: Correct integer overflow in get_opcodes()
|
||||
- avcodec/scpr: Fix use of uninitialized variable
|
||||
- avcodec/qpeg: Limit copy in qpeg_decode_intra() to the available bytes
|
||||
- avcodec/aic: Check remaining bits in aic_decode_coeffs()
|
||||
- avcodec/gdv: Check for truncated tags in decompress_5()
|
||||
- avcodec/bethsoftvideo: Check block_type
|
||||
- avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()
|
||||
- avcodec/error_resilience: Use a symmetric check for skipping MV estimation
|
||||
- avcodec/mlpdec: Insuffient typo
|
||||
- avcodec/zmbv: obtain frame later
|
||||
- avcodec/jvdec: Check available input space before decode8x8()
|
||||
- avcodec/h264_direct: Fix overflow in POC comparission
|
||||
- avformat/webmdashenc: Check id in adaption_sets
|
||||
- avformat/http: Fix Out-of-Bounds access in process_line()
|
||||
- avformat/ftp: Fix Out-of-Bounds Access and Information Leak in ftp.c:393
|
||||
- avcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop for handling braces
|
||||
- avcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop for tag scaning
|
||||
- avformat/matroskadec: Do not leak queued packets on sync errors
|
||||
- avcodec/mpeg4videodec: Clear interlaced_dct for studio profile
|
||||
- avformat/mov: Do not use reference stream in mov_read_sidx() if there is no reference stream
|
||||
- avcodec/sbrdsp_fixed.c: remove input value limit for sbr_sum_square_c()
|
||||
- avformat/mov: validate chunk_count vs stsc_data
|
||||
- avformat/mov.c: require tfhd to begin parsing trun
|
||||
- avcodec/pgssubdec: Check for duplicate display segments
|
||||
- avformat/rtsp: Check number of streams in sdp_parse_line()
|
||||
- avformat/rtsp: Clear reply in every iteration in ff_rtsp_connect()
|
||||
- avcodec/fic: Check that there is input left in fic_decode_block()
|
||||
- avcodec/tiff: Check for 12bit gray fax
|
||||
- avutil/imgutils: Optimize memset_bytes() by using av_memcpy_backptr()
|
||||
- avutil/mem: Optimize fill32() by unrolling and using 64bit
|
||||
- configure: bump year
|
||||
- avcodec/diracdec: Check component quant
|
||||
- avcodec/tests/rangecoder: initialize array to avoid valgrind warning
|
||||
- avcodec/h264_slice: Fix integer overflow in implicit_weight_table()
|
||||
- avcodec/exr: set layer_match in all branches
|
||||
- avcodec/exr: Check for duplicate channel index
|
||||
- avcodec/4xm: Fix returned error codes
|
||||
- avformat/libopenmpt: Fix successfull typo
|
||||
- avcodec/v4l2_m2m: fix cant typo
|
||||
- avcodec/mjpegbdec: Fix some misplaced {} and spaces
|
||||
- avformat/wvdec: detect and error out on WavPack DSD files
|
||||
- avcodec/mips: Fix failed case: hevc-conformance-AMP_A_Samsung_* when enable msa
|
||||
- avcodec/fic: Fail on invalid slice size/off
|
||||
- postproc/postprocess_template: remove FF_REG_sp from clobber list
|
||||
- postproc/postprocess_template: Avoid using %4 for the threshold compare
|
||||
- avcodec/rpza: Check that there is enough data for all the blocks
|
||||
- avcodec/rpza: Move frame allocation to a later point
|
||||
- avcodec/avcodec: Document the data type for AV_PKT_DATA_MPEGTS_STREAM_ID
|
||||
- avformat/mpegts: Fix side data type for stream id
|
||||
- tests/fate/filter-video: increase fuzz for fate-filter-refcmp-psnr-rgb
|
||||
- avcodec/mjpegdec: Fix indention of ljpeg_decode_yuv_scan()
|
||||
- lavf/id3v2: fail read_apic on EOF reading mimetype
|
||||
- avformat/nutenc: Document trailer index assert better
|
||||
- lavf/mov: ensure only one tkhd per trak
|
||||
- avcodec/clearvideo: Check remaining input bits in P macro block loop
|
||||
- avcodec/dxv: Check that there is enough data to decompress
|
||||
- avcodec/ppc/hevcdsp: Fix build failures with powerpc-linux-gnu-gcc-4.8 with --disable-optimizations
|
||||
- avcodec/msvideo1: Check for too small dimensions
|
||||
- avcodec/wmv2dec: Skip I frame if its smaller than 1/8 of the minimal size
|
||||
- avcodec/msmpeg4dec: Skip frame if its smaller than 1/8 of the minimal size
|
||||
- avcodec/truemotion2rt: Fix rounding in input size check
|
||||
- avcodec/truemotion2: fix integer overflows in tm2_low_chroma()
|
||||
- avcodec/pngdec: Check compression method
|
||||
- fftools/ffmpeg: Repair reinit_filter feature
|
||||
- avcodec/shorten: Fix integer overflow with offset
|
||||
- h264_redundant_pps: Fix logging context
|
||||
- avcodec/cavsdec: Propagate error codes inside decode_mb_i()
|
||||
- avcodec/mpeg4videodec: Clear partitioned frame in decode_studio_vop_header()
|
||||
- avcodec/mpegaudio_parser: Consume more than 0 bytes in case of the unsupported mp3adu case
|
||||
- avcodec/hevcdec: decode at most one slice reporting being the first in the picture
|
||||
- avformat/dsfdec: fix calculation of size of data chunk
|
||||
- avformat/dsfdec: properly handle padded last packet
|
||||
- avcodec/hevcdec: fix non-ref frame judgement
|
||||
- avcodec/libaomenc: remove AVOption related to frame partitions
|
||||
|
||||
version 4.0.3:
|
||||
- avutil/integer: Fix integer overflow in av_mul_i()
|
||||
- avcodec/msrle: Check that the input is large enough to contain a end of picture code
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
#Installing FFmpeg:
|
||||
|
||||
1. Type `./configure` to create the configuration. A list of configure
|
||||
options is printed by running `configure --help`.
|
||||
|
||||
`configure` can be launched from a directory different from the FFmpeg
|
||||
sources to build the objects out of tree. To do this, use an absolute
|
||||
path when launching `configure`, e.g. `/ffmpegdir/ffmpeg/configure`.
|
||||
|
||||
2. Then type `make` to build FFmpeg. GNU Make 3.81 or later is required.
|
||||
|
||||
3. Type `make install` to install all binaries and libraries you built.
|
||||
|
||||
NOTICE
|
||||
------
|
||||
|
||||
- Non system dependencies (e.g. libx264, libvpx) are disabled by default.
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
---
|
||||
# We just wrap `build` so this is really it
|
||||
name: "jellyfin-ffmpeg"
|
||||
version: "4.0.3-6"
|
||||
version: "4.0.4-1"
|
||||
packages:
|
||||
- stretch-amd64
|
||||
- stretch-armhf
|
||||
|
||||
@@ -6073,21 +6073,21 @@ enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h
|
||||
enabled libvpx && {
|
||||
enabled libvpx_vp8_decoder && {
|
||||
check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
|
||||
check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
|
||||
check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp8_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ||
|
||||
die "ERROR: libvpx decoder version must be >=1.4.0";
|
||||
}
|
||||
enabled libvpx_vp8_encoder && {
|
||||
check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
|
||||
check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
|
||||
check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp8_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ||
|
||||
die "ERROR: libvpx encoder version must be >=1.4.0";
|
||||
}
|
||||
enabled libvpx_vp9_decoder && {
|
||||
check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
|
||||
check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
|
||||
check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
|
||||
}
|
||||
enabled libvpx_vp9_encoder && {
|
||||
check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
|
||||
check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
|
||||
check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
|
||||
}
|
||||
if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
|
||||
die "libvpx enabled but no supported decoders found"
|
||||
@@ -7155,7 +7155,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2018
|
||||
#define CONFIG_THIS_YEAR 2019
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
Vendored
+3
-2
@@ -1,9 +1,10 @@
|
||||
jellyfin-ffmpeg (4.0.3-6) unstable; urgency=medium
|
||||
jellyfin-ffmpeg (4.0.4-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version 4.0.4
|
||||
* Add Ubuntu Disco support
|
||||
* Add arm64 support
|
||||
|
||||
-- Joshua Boniface <joshua@boniface.me> Mon, 29 Apr 2019 10:51:22 -0400
|
||||
-- Joshua Boniface <joshua@boniface.me> Mon, 29 Apr 2019 23:20:37 -0400
|
||||
|
||||
jellyfin-ffmpeg (4.0.3-5) unstable; urgency=medium
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.0.3
|
||||
PROJECT_NUMBER = 4.0.4
|
||||
|
||||
# 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
|
||||
|
||||
+7
-3
@@ -2121,9 +2121,6 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
||||
|
||||
/* determine if the parameters for this input changed */
|
||||
need_reinit = ifilter->format != frame->format;
|
||||
if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx ||
|
||||
(ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data))
|
||||
need_reinit = 1;
|
||||
|
||||
switch (ifilter->ist->st->codecpar->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@@ -2137,6 +2134,13 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ifilter->ist->reinit_filters && fg->graph)
|
||||
need_reinit = 0;
|
||||
|
||||
if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx ||
|
||||
(ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data))
|
||||
need_reinit = 1;
|
||||
|
||||
if (need_reinit) {
|
||||
ret = ifilter_parameters_from_frame(ifilter, frame);
|
||||
if (ret < 0)
|
||||
|
||||
+2
-2
@@ -498,7 +498,7 @@ static int decode_i_block(FourXContext *f, int16_t *block)
|
||||
|
||||
if (get_bits_left(&f->gb) < 2){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->gb));
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* DC coef */
|
||||
@@ -732,7 +732,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
for (x = 0; x < width; x += 16) {
|
||||
unsigned int color[4] = { 0 }, bits;
|
||||
if (buf_end - buf < 8)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
// warning following is purely guessed ...
|
||||
color[0] = bytestream2_get_le16u(&g3);
|
||||
color[1] = bytestream2_get_le16u(&g3);
|
||||
|
||||
@@ -208,6 +208,9 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
|
||||
int mb, idx;
|
||||
unsigned val;
|
||||
|
||||
if (get_bits_left(gb) < 5)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
has_skips = get_bits1(gb);
|
||||
coeff_type = get_bits1(gb);
|
||||
coeff_bits = get_bits(gb, 3);
|
||||
|
||||
@@ -1312,7 +1312,7 @@ enum AVPacketSideDataType {
|
||||
AV_PKT_DATA_METADATA_UPDATE,
|
||||
|
||||
/**
|
||||
* MPEGTS stream ID, this is required to pass the stream ID
|
||||
* MPEGTS stream ID as uint8_t, this is required to pass the stream ID
|
||||
* information from the demuxer to the corresponding muxer.
|
||||
*/
|
||||
AV_PKT_DATA_MPEGTS_STREAM_ID,
|
||||
|
||||
@@ -109,6 +109,11 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
|
||||
if(yoffset >= avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
dst += vid->frame->linesize[0] * yoffset;
|
||||
case VIDEO_P_FRAME:
|
||||
case VIDEO_I_FRAME:
|
||||
break;
|
||||
default:
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
// main code
|
||||
|
||||
+4
-1
@@ -291,7 +291,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
||||
case 1:
|
||||
for (i = 0; i < avctx->height; i++) {
|
||||
int j;
|
||||
for (j = 0; j < n; j++) {
|
||||
for (j = 0; j < avctx->width >> 3; j++) {
|
||||
ptr[j*8+0] = buf[j] >> 7;
|
||||
ptr[j*8+1] = (buf[j] >> 6) & 1;
|
||||
ptr[j*8+2] = (buf[j] >> 5) & 1;
|
||||
@@ -301,6 +301,9 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
||||
ptr[j*8+6] = (buf[j] >> 1) & 1;
|
||||
ptr[j*8+7] = buf[j] & 1;
|
||||
}
|
||||
for (j = 0; j < (avctx->width & 7); j++) {
|
||||
ptr[avctx->width - (avctx->width & 7) + j] = buf[avctx->width >> 3] >> (7 - j) & 1;
|
||||
}
|
||||
buf += n;
|
||||
ptr += linesize;
|
||||
}
|
||||
|
||||
+21
-8
@@ -591,14 +591,21 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
|
||||
}
|
||||
|
||||
|
||||
static inline void decode_residual_chroma(AVSContext *h)
|
||||
static inline int decode_residual_chroma(AVSContext *h)
|
||||
{
|
||||
if (h->cbp & (1 << 4))
|
||||
decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
if (h->cbp & (1 << 4)) {
|
||||
int ret = decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
ff_cavs_chroma_qp[h->qp], h->cu, h->c_stride);
|
||||
if (h->cbp & (1 << 5))
|
||||
decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (h->cbp & (1 << 5)) {
|
||||
int ret = decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
ff_cavs_chroma_qp[h->qp], h->cv, h->c_stride);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int decode_residual_inter(AVSContext *h)
|
||||
@@ -649,6 +656,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code)
|
||||
uint8_t top[18];
|
||||
uint8_t *left = NULL;
|
||||
uint8_t *d;
|
||||
int ret;
|
||||
|
||||
ff_cavs_init_mb(h);
|
||||
|
||||
@@ -692,8 +700,11 @@ static int decode_mb_i(AVSContext *h, int cbp_code)
|
||||
ff_cavs_load_intra_pred_luma(h, top, &left, block);
|
||||
h->intra_pred_l[h->pred_mode_Y[scan3x3[block]]]
|
||||
(d, top, left, h->l_stride);
|
||||
if (h->cbp & (1<<block))
|
||||
decode_residual_block(h, gb, intra_dec, 1, h->qp, d, h->l_stride);
|
||||
if (h->cbp & (1<<block)) {
|
||||
ret = decode_residual_block(h, gb, intra_dec, 1, h->qp, d, h->l_stride);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* chroma intra prediction */
|
||||
@@ -703,7 +714,9 @@ static int decode_mb_i(AVSContext *h, int cbp_code)
|
||||
h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx * 10],
|
||||
h->left_border_v, h->c_stride);
|
||||
|
||||
decode_residual_chroma(h);
|
||||
ret = decode_residual_chroma(h);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ff_cavs_filter(h, I_8X8);
|
||||
set_mv_intra(h);
|
||||
return 0;
|
||||
|
||||
@@ -80,11 +80,8 @@ static av_cold int cdg_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR(ENOMEM);
|
||||
cc->transparency = -1;
|
||||
|
||||
avctx->width = CDG_FULL_WIDTH;
|
||||
avctx->height = CDG_FULL_HEIGHT;
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
|
||||
return 0;
|
||||
return ff_set_dimensions(avctx, CDG_FULL_WIDTH, CDG_FULL_HEIGHT);
|
||||
}
|
||||
|
||||
static void cdg_border_preset(CDGraphicsContext *cc, uint8_t *data)
|
||||
|
||||
@@ -558,6 +558,9 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
} else {
|
||||
int plane;
|
||||
|
||||
if (c->pmb_width * c->pmb_height > 8LL*(buf_size - bytestream2_tell(&gb)))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -573,6 +576,8 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
for (j = 0; j < c->pmb_height; j++) {
|
||||
for (i = 0; i < c->pmb_width; i++) {
|
||||
if (get_bits_left(&c->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits1(&c->gb)) {
|
||||
MV mv = mvi_predict(&c->mvi, i, j, zero_mv);
|
||||
|
||||
|
||||
@@ -355,6 +355,8 @@ static int dfa_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
bytestream2_init(&gb, avpkt->data, avpkt->size);
|
||||
while (bytestream2_get_bytes_left(&gb) > 0) {
|
||||
if (bytestream2_get_bytes_left(&gb) < 12)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bytestream2_skip(&gb, 4);
|
||||
chunk_size = bytestream2_get_le32(&gb);
|
||||
chunk_type = bytestream2_get_le32(&gb);
|
||||
|
||||
@@ -668,6 +668,10 @@ static void decode_component(DiracContext *s, int comp)
|
||||
b->length = get_interleaved_ue_golomb(&s->gb);
|
||||
if (b->length) {
|
||||
b->quant = get_interleaved_ue_golomb(&s->gb);
|
||||
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
|
||||
b->quant = 0;
|
||||
}
|
||||
align_get_bits(&s->gb);
|
||||
b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8;
|
||||
b->length = FFMIN(b->length, FFMAX(get_bits_left(&s->gb)/8, 0));
|
||||
|
||||
@@ -1261,6 +1261,13 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
|
||||
display->y_pos = AV_RB16(buf) & 0xfff;
|
||||
buf += 2;
|
||||
|
||||
if (display->x_pos >= region->width ||
|
||||
display->y_pos >= region->height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Object outside region\n");
|
||||
av_free(display);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) {
|
||||
display->fgcolor = *buf++;
|
||||
display->bgcolor = *buf++;
|
||||
|
||||
+8
-1
@@ -426,7 +426,8 @@ static int fill_optable(unsigned *table0, OpcodeTable *table1, int nb_elements)
|
||||
static int get_opcodes(GetByteContext *gb, uint32_t *table, uint8_t *dst, int op_size, int nb_elements)
|
||||
{
|
||||
OpcodeTable optable[1024];
|
||||
int sum, x, val, lshift, rshift, ret, size_in_bits, i, idx;
|
||||
int sum, x, val, lshift, rshift, ret, i, idx;
|
||||
int64_t size_in_bits;
|
||||
unsigned endoffset, newoffset, offset;
|
||||
unsigned next;
|
||||
uint8_t *src = (uint8_t *)gb->buffer;
|
||||
@@ -1192,6 +1193,12 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
|
||||
ret = decompress_tex(avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
{
|
||||
int w_block = avctx->coded_width / ctx->texture_block_w;
|
||||
int h_block = avctx->coded_height / ctx->texture_block_h;
|
||||
if (w_block * h_block * ctx->tex_step > ctx->tex_size * 8LL)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
tframe.f = data;
|
||||
ret = ff_thread_get_buffer(avctx, &tframe, 0);
|
||||
|
||||
@@ -437,7 +437,7 @@ static void guess_mv(ERContext *s)
|
||||
}
|
||||
|
||||
if ((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) ||
|
||||
num_avail <= mb_width / 2) {
|
||||
num_avail <= FFMAX(mb_width, mb_height) / 2) {
|
||||
for (mb_y = 0; mb_y < mb_height; mb_y++) {
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
||||
|
||||
@@ -1389,6 +1389,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
if (*ch_gb.buffer == '.')
|
||||
ch_gb.buffer++; /* skip dot if not given */
|
||||
} else {
|
||||
layer_match = 0;
|
||||
av_log(s->avctx, AV_LOG_INFO,
|
||||
"Channel doesn't match layer : %s.\n", ch_gb.buffer);
|
||||
}
|
||||
@@ -1463,6 +1464,11 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
}
|
||||
s->pixel_type = current_pixel_type;
|
||||
s->channel_offsets[channel_index] = s->current_channel_offset;
|
||||
} else if (channel_index >= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Multiple channels with index %d.\n", channel_index);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->channels = av_realloc(s->channels,
|
||||
|
||||
@@ -139,6 +139,9 @@ static int fic_decode_block(FICContext *ctx, GetBitContext *gb,
|
||||
{
|
||||
int i, num_coeff;
|
||||
|
||||
if (get_bits_left(gb) < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* Is it a skip block? */
|
||||
if (get_bits1(gb)) {
|
||||
*is_p = 1;
|
||||
@@ -380,6 +383,8 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
slice_h = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16);
|
||||
} else {
|
||||
slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
|
||||
if (slice_size < slice_off)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (slice_size < slice_off || slice_size > msize)
|
||||
|
||||
@@ -244,6 +244,8 @@ static int decompress_5(AVCodecContext *avctx, unsigned skip)
|
||||
|
||||
while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
|
||||
int tag = read_bits2(&bits, gb);
|
||||
if (bytestream2_get_bytes_left(gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (tag == 0) {
|
||||
bytestream2_put_byte(pb, bytestream2_get_byte(gb));
|
||||
} else if (tag == 1) {
|
||||
|
||||
@@ -156,8 +156,8 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
|
||||
av_log(h->avctx, AV_LOG_ERROR, "co located POCs unavailable\n");
|
||||
sl->col_parity = 1;
|
||||
} else
|
||||
sl->col_parity = (FFABS(col_poc[0] - cur_poc) >=
|
||||
FFABS(col_poc[1] - cur_poc));
|
||||
sl->col_parity = (FFABS(col_poc[0] - (int64_t)cur_poc) >=
|
||||
FFABS(col_poc[1] - (int64_t)cur_poc));
|
||||
ref1sidx =
|
||||
sidx = sl->col_parity;
|
||||
// FL -> FL & differ parity
|
||||
|
||||
@@ -90,7 +90,7 @@ static int h264_redundant_pps_filter(AVBSFContext *bsf, AVPacket *out)
|
||||
if (nal->type == H264_NAL_PPS) {
|
||||
h264_redundant_pps_fixup_pps(ctx, nal->content);
|
||||
if (!au_has_sps) {
|
||||
av_log(ctx, AV_LOG_VERBOSE, "Deleting redundant PPS "
|
||||
av_log(bsf, AV_LOG_VERBOSE, "Deleting redundant PPS "
|
||||
"at %"PRId64".\n", in->pts);
|
||||
ff_cbs_delete_unit(ctx->input, au, i);
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in
|
||||
cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure - 1];
|
||||
}
|
||||
if (sl->ref_count[0] == 1 && sl->ref_count[1] == 1 && !FRAME_MBAFF(h) &&
|
||||
sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2LL * cur_poc) {
|
||||
sl->pwt.use_weight = 0;
|
||||
sl->pwt.use_weight_chroma = 0;
|
||||
return;
|
||||
|
||||
@@ -485,6 +485,11 @@ static int hls_slice_header(HEVCContext *s)
|
||||
|
||||
// Coded parameters
|
||||
sh->first_slice_in_pic_flag = get_bits1(gb);
|
||||
if (s->ref && sh->first_slice_in_pic_flag) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the first in the same frame.\n");
|
||||
return 1; // This slice will be skiped later, do not corrupt state
|
||||
}
|
||||
|
||||
if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) {
|
||||
s->seq_decode = (s->seq_decode + 1) & 0xff;
|
||||
s->max_ra = INT_MAX;
|
||||
@@ -2915,6 +2920,11 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
|
||||
ret = hls_slice_header(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret == 1) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
(s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
|
||||
|
||||
@@ -559,8 +559,6 @@ static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
|
||||
case HEVC_NAL_VCL_N10:
|
||||
case HEVC_NAL_VCL_N12:
|
||||
case HEVC_NAL_VCL_N14:
|
||||
case HEVC_NAL_BLA_N_LP:
|
||||
case HEVC_NAL_IDR_N_LP:
|
||||
return 1;
|
||||
break;
|
||||
default: break;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "htmlsubtitles.h"
|
||||
#include <ctype.h>
|
||||
|
||||
static int html_color_parse(void *log_ctx, const char *str)
|
||||
{
|
||||
@@ -44,14 +45,32 @@ static void rstrip_spaces_buf(AVBPrint *buf)
|
||||
buf->str[--buf->len] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fast code for scanning text enclosed in braces. Functionally
|
||||
* equivalent to this sscanf call:
|
||||
*
|
||||
* sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0
|
||||
*/
|
||||
static int scanbraces(const char* in) {
|
||||
if (strncmp(in, "{\\an", 4) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if (!isdigit(in[4])) {
|
||||
return 0;
|
||||
}
|
||||
if (in[5] != '}') {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* skip all {\xxx} substrings except for {\an%d}
|
||||
and all microdvd like styles such as {Y:xxx} */
|
||||
static void handle_open_brace(AVBPrint *dst, const char **inp, int *an, int *closing_brace_missing)
|
||||
{
|
||||
int len = 0;
|
||||
const char *in = *inp;
|
||||
|
||||
*an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0;
|
||||
*an += scanbraces(in);
|
||||
|
||||
if (!*closing_brace_missing) {
|
||||
if ( (*an != 1 && in[1] == '\\')
|
||||
@@ -74,6 +93,34 @@ struct font_tag {
|
||||
uint32_t color;
|
||||
};
|
||||
|
||||
/*
|
||||
* Fast code for scanning the rest of a tag. Functionally equivalent to
|
||||
* this sscanf call:
|
||||
*
|
||||
* sscanf(in, "%127[^<>]>%n", buffer, lenp) == 2
|
||||
*/
|
||||
static int scantag(const char* in, char* buffer, int* lenp) {
|
||||
int len;
|
||||
|
||||
for (len = 0; len < 128; len++) {
|
||||
const char c = *in++;
|
||||
switch (c) {
|
||||
case '\0':
|
||||
return 0;
|
||||
case '<':
|
||||
return 0;
|
||||
case '>':
|
||||
buffer[len] = '\0';
|
||||
*lenp = len+1;
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
buffer[len] = c;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The general politic of the convert is to mask unsupported tags or formatting
|
||||
* errors (but still alert the user/subtitles writer with an error/warning)
|
||||
@@ -155,7 +202,7 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
|
||||
|
||||
len = 0;
|
||||
|
||||
if (sscanf(in+tag_close+1, "%127[^<>]>%n", buffer, &len) >= 1 && len > 0) {
|
||||
if (scantag(in+tag_close+1, buffer, &len) && len > 0) {
|
||||
const int skip = len + tag_close;
|
||||
const char *tagname = buffer;
|
||||
while (*tagname == ' ') {
|
||||
|
||||
@@ -531,7 +531,7 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
|
||||
}
|
||||
|
||||
for (i = 0; i < w * h; i++)
|
||||
data[i] = (data[i] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT;
|
||||
data[i] = (data[i] + ((1LL<<I_PRESHIFT)>>1)) >> I_PRESHIFT;
|
||||
}
|
||||
|
||||
int ff_jpeg2000_dwt_init(DWTContext *s, int border[2][2],
|
||||
|
||||
@@ -170,6 +170,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
GetBitContext gb;
|
||||
init_get_bits(&gb, buf, 8 * video_size);
|
||||
|
||||
if (avctx->height/8 * (avctx->width/8) > 4 * video_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Insufficient input data for dimensions\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (j = 0; j < avctx->height; j += 8)
|
||||
for (i = 0; i < avctx->width; i += 8)
|
||||
decode8x8(&gb,
|
||||
|
||||
@@ -697,10 +697,6 @@ static const AVOption options[] = {
|
||||
"alternate reference frame selection", OFFSET(lag_in_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE},
|
||||
{ "error-resilience", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, VE, "er"},
|
||||
{ "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"},
|
||||
{ "partitions", "The frame partitions are independently decodable "
|
||||
"by the bool decoder, meaning that partitions can be decoded even "
|
||||
"though earlier partitions have been lost. Note that intra predicition"
|
||||
" is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"},
|
||||
{ "crf", "Select the quality for constant quality mode", offsetof(AOMContext, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VE },
|
||||
{ "static-thresh", "A change threshold on blocks below which they will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
|
||||
{ "drop-threshold", "Frame drop threshold", offsetof(AOMContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
|
||||
|
||||
@@ -2630,7 +2630,7 @@ void ff_hevc_sao_edge_filter_8_msa(uint8_t *dst, uint8_t *src,
|
||||
int16_t *sao_offset_val,
|
||||
int eo, int width, int height)
|
||||
{
|
||||
ptrdiff_t stride_src = (2 * 64 + 32) / sizeof(uint8_t);
|
||||
ptrdiff_t stride_src = (2 * MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(uint8_t);
|
||||
|
||||
switch (eo) {
|
||||
case 0:
|
||||
|
||||
+9
-15
@@ -70,8 +70,7 @@ read_header:
|
||||
|
||||
skip_bits(&hgb, 32); /* reserved zeros */
|
||||
|
||||
if (get_bits_long(&hgb, 32) != MKBETAG('m','j','p','g'))
|
||||
{
|
||||
if (get_bits_long(&hgb, 32) != MKBETAG('m','j','p','g')) {
|
||||
av_log(avctx, AV_LOG_WARNING, "not mjpeg-b (bad fourcc)\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -85,19 +84,17 @@ read_header:
|
||||
|
||||
dqt_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "dqt is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "dqt offs: 0x%"PRIx32"\n", dqt_offs);
|
||||
if (dqt_offs)
|
||||
{
|
||||
if (dqt_offs) {
|
||||
init_get_bits(&s->gb, buf_ptr+dqt_offs, (buf_end - (buf_ptr+dqt_offs))*8);
|
||||
s->start_code = DQT;
|
||||
if (ff_mjpeg_decode_dqt(s) < 0 &&
|
||||
(avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
dht_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "dht is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "dht offs: 0x%"PRIx32"\n", dht_offs);
|
||||
if (dht_offs)
|
||||
{
|
||||
if (dht_offs) {
|
||||
init_get_bits(&s->gb, buf_ptr+dht_offs, (buf_end - (buf_ptr+dht_offs))*8);
|
||||
s->start_code = DHT;
|
||||
ff_mjpeg_decode_dht(s);
|
||||
@@ -105,8 +102,7 @@ read_header:
|
||||
|
||||
sof_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "sof is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "sof offs: 0x%"PRIx32"\n", sof_offs);
|
||||
if (sof_offs)
|
||||
{
|
||||
if (sof_offs) {
|
||||
init_get_bits(&s->gb, buf_ptr+sof_offs, (buf_end - (buf_ptr+sof_offs))*8);
|
||||
s->start_code = SOF0;
|
||||
if (ff_mjpeg_decode_sof(s) < 0)
|
||||
@@ -117,25 +113,23 @@ read_header:
|
||||
av_log(avctx, AV_LOG_DEBUG, "sos offs: 0x%"PRIx32"\n", sos_offs);
|
||||
sod_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "sof is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "sod offs: 0x%"PRIx32"\n", sod_offs);
|
||||
if (sos_offs)
|
||||
{
|
||||
if (sos_offs) {
|
||||
init_get_bits(&s->gb, buf_ptr + sos_offs,
|
||||
8 * FFMIN(field_size, buf_end - buf_ptr - sos_offs));
|
||||
s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16));
|
||||
s->start_code = SOS;
|
||||
if (ff_mjpeg_decode_sos(s, NULL, 0, NULL) < 0 &&
|
||||
(avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->interlaced) {
|
||||
s->bottom_field ^= 1;
|
||||
/* if not bottom field, do not output image yet */
|
||||
if (s->bottom_field != s->interlace_polarity && second_field_offs)
|
||||
{
|
||||
if (s->bottom_field != s->interlace_polarity && second_field_offs) {
|
||||
buf_ptr = buf + second_field_offs;
|
||||
goto read_header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//XXX FIXME factorize, this looks very similar to the EOI code
|
||||
|
||||
+16
-16
@@ -1201,25 +1201,25 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
|| v * mb_y + y >= s->height) {
|
||||
// Nothing to do
|
||||
} else if (bits<=8) {
|
||||
ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||
if(y==0 && toprow){
|
||||
if(x==0 && leftcol){
|
||||
pred= 1 << (bits - 1);
|
||||
ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||
if(y==0 && toprow){
|
||||
if(x==0 && leftcol){
|
||||
pred= 1 << (bits - 1);
|
||||
}else{
|
||||
pred= ptr[-1];
|
||||
}
|
||||
}else{
|
||||
pred= ptr[-1];
|
||||
if(x==0 && leftcol){
|
||||
pred= ptr[-linesize];
|
||||
}else{
|
||||
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(x==0 && leftcol){
|
||||
pred= ptr[-linesize];
|
||||
}else{
|
||||
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
|
||||
}
|
||||
}
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
ptr += linesize >> 1;
|
||||
pred &= mask;
|
||||
*ptr= pred + ((unsigned)dc << point_transform);
|
||||
if (s->interlaced && s->bottom_field)
|
||||
ptr += linesize >> 1;
|
||||
pred &= mask;
|
||||
*ptr= pred + ((unsigned)dc << point_transform);
|
||||
}else{
|
||||
ptr16 = (uint16_t*)(s->picture_ptr->data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); //FIXME optimize this crap
|
||||
if(y==0 && toprow){
|
||||
|
||||
+1
-1
@@ -1195,7 +1195,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
|
||||
}
|
||||
|
||||
if (length < header_size + substr_header_size) {
|
||||
av_log(m->avctx, AV_LOG_ERROR, "Insuffient data for headers\n");
|
||||
av_log(m->avctx, AV_LOG_ERROR, "Insufficient data for headers\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
@@ -1897,14 +1897,20 @@ static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n
|
||||
code >>= 1;
|
||||
run = (1 << (additional_code_len - 1)) + code;
|
||||
idx += run;
|
||||
if (idx > 63)
|
||||
return AVERROR_INVALIDDATA;
|
||||
j = scantable[idx++];
|
||||
block[j] = sign ? 1 : -1;
|
||||
} else if (group >= 13 && group <= 20) {
|
||||
/* Level value (Table B.49) */
|
||||
if (idx > 63)
|
||||
return AVERROR_INVALIDDATA;
|
||||
j = scantable[idx++];
|
||||
block[j] = get_xbits(&s->gb, additional_code_len);
|
||||
} else if (group == 21) {
|
||||
/* Escape */
|
||||
if (idx > 63)
|
||||
return AVERROR_INVALIDDATA;
|
||||
j = scantable[idx++];
|
||||
additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;
|
||||
flc = get_bits(&s->gb, additional_code_len);
|
||||
@@ -2967,6 +2973,8 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
if (get_bits_left(gb) <= 32)
|
||||
return 0;
|
||||
|
||||
s->partitioned_frame = 0;
|
||||
s->interlaced_dct = 0;
|
||||
s->decode_mb = mpeg4_decode_studio_mb;
|
||||
|
||||
decode_smpte_tc(ctx, gb);
|
||||
|
||||
@@ -101,7 +101,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
|
||||
"MP3ADU full parser");
|
||||
*poutbuf = NULL;
|
||||
*poutbuf_size = 0;
|
||||
return 0; /* parsers must not return error codes */
|
||||
return buf_size; /* parsers must not return error codes */
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "motion_est.h"
|
||||
@@ -57,6 +58,7 @@ do {\
|
||||
int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
|
||||
ScratchpadContext *sc, int linesize)
|
||||
{
|
||||
# define EMU_EDGE_HEIGHT (4 * 70)
|
||||
int alloc_size = FFALIGN(FFABS(linesize) + 64, 32);
|
||||
|
||||
if (avctx->hwaccel)
|
||||
@@ -67,13 +69,16 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (av_image_check_size2(alloc_size, EMU_EDGE_HEIGHT, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
// edge emu needs blocksize + filter length - 1
|
||||
// (= 17x17 for halfpel / 21x21 for H.264)
|
||||
// VC-1 computes luma and chroma simultaneously and needs 19X19 + 9x9
|
||||
// at uvlinesize. It supports only YUV420 so 24x24 is enough
|
||||
// linesize * interlaced * MBsize
|
||||
// we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, 4 * 70,
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, EMU_EDGE_HEIGHT,
|
||||
fail);
|
||||
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, me->scratchpad, alloc_size, 4 * 16 * 2,
|
||||
|
||||
@@ -412,6 +412,14 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s)
|
||||
{
|
||||
int code;
|
||||
|
||||
// at minimum one bit per macroblock is required at least in a valid frame,
|
||||
// we discard frames much smaller than this. Frames smaller than 1/8 of the
|
||||
// smallest "black/skip" frame generally contain not much recoverable content
|
||||
// while at the same time they have the highest computational requirements
|
||||
// per byte
|
||||
if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if(s->msmpeg4_version==1){
|
||||
int start_code = get_bits_long(&s->gb, 32);
|
||||
if(start_code!=0x00000100){
|
||||
|
||||
@@ -62,6 +62,9 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
if (avctx->width < 4 || avctx->height < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* figure out the colorspace based on the presence of a palette */
|
||||
if (s->avctx->bits_per_coded_sample == 8) {
|
||||
s->mode_8bit = 1;
|
||||
|
||||
@@ -676,6 +676,11 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
|
||||
*/
|
||||
break;
|
||||
case DISPLAY_SEGMENT:
|
||||
if (*data_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Duplicate display segment\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
break;
|
||||
}
|
||||
ret = display_end_segment(avctx, data, buf, segment_length);
|
||||
if (ret >= 0)
|
||||
*data_size = ret;
|
||||
|
||||
@@ -578,6 +578,10 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
}
|
||||
s->color_type = bytestream2_get_byte(&s->gb);
|
||||
s->compression_type = bytestream2_get_byte(&s->gb);
|
||||
if (s->compression_type) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid compression method %d\n", s->compression_type);
|
||||
goto error;
|
||||
}
|
||||
s->filter_type = bytestream2_get_byte(&s->gb);
|
||||
s->interlace_type = bytestream2_get_byte(&s->gb);
|
||||
bytestream2_skip(&s->gb, 4); /* crc */
|
||||
|
||||
@@ -57,7 +57,13 @@ static void transform4x4(vec_s16 src_01, vec_s16 src_23, vec_s32 res[4],
|
||||
e1 = vec_msums(src_02, trans4[2], zero);
|
||||
o1 = vec_msums(src_13, trans4[3], zero);
|
||||
|
||||
add = vec_sl(vec_splat_s32(1), vec_splat_u32(shift - 1));
|
||||
switch(shift) {
|
||||
case 7: add = vec_sl(vec_splat_s32(1), vec_splat_u32( 7 - 1)); break;
|
||||
case 10: add = vec_sl(vec_splat_s32(1), vec_splat_u32(10 - 1)); break;
|
||||
case 12: add = vec_sl(vec_splat_s32(1), vec_splat_u32(12 - 1)); break;
|
||||
default: abort();
|
||||
}
|
||||
|
||||
e0 = vec_add(e0, add);
|
||||
e1 = vec_add(e1, add);
|
||||
|
||||
@@ -70,7 +76,14 @@ static void transform4x4(vec_s16 src_01, vec_s16 src_23, vec_s32 res[4],
|
||||
static void scale(vec_s32 res[4], vec_s16 res_packed[2], int shift)
|
||||
{
|
||||
int i;
|
||||
vec_u32 v_shift = vec_splat_u32(shift);
|
||||
vec_u32 v_shift;
|
||||
|
||||
switch(shift) {
|
||||
case 7: v_shift = vec_splat_u32(7) ; break;
|
||||
case 10: v_shift = vec_splat_u32(10); break;
|
||||
case 12: v_shift = vec_splat_u32(12); break;
|
||||
default: abort();
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
res[i] = vec_sra(res[i], v_shift);
|
||||
|
||||
@@ -90,6 +90,8 @@ static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (bytestream2_get_bytes_left(&qctx->buffer) < copy)
|
||||
copy = bytestream2_get_bytes_left(&qctx->buffer);
|
||||
for(i = 0; i < copy; i++) {
|
||||
dst[filled++] = bytestream2_get_byte(&qctx->buffer);
|
||||
if (filled >= width) {
|
||||
|
||||
+11
-6
@@ -73,13 +73,12 @@ typedef struct RpzaContext {
|
||||
static int rpza_decode_stream(RpzaContext *s)
|
||||
{
|
||||
int width = s->avctx->width;
|
||||
int stride = s->frame->linesize[0] / 2;
|
||||
int row_inc = stride - 4;
|
||||
int stride, row_inc, ret;
|
||||
int chunk_size;
|
||||
uint16_t colorA = 0, colorB;
|
||||
uint16_t color4[4];
|
||||
uint16_t ta, tb;
|
||||
uint16_t *pixels = (uint16_t *)s->frame->data[0];
|
||||
uint16_t *pixels;
|
||||
|
||||
int row_ptr = 0;
|
||||
int pixel_ptr = 0;
|
||||
@@ -106,6 +105,15 @@ static int rpza_decode_stream(RpzaContext *s)
|
||||
/* Number of 4x4 blocks in frame. */
|
||||
total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
|
||||
|
||||
if (total_blocks / 32 > bytestream2_get_bytes_left(&s->gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_reget_buffer(s->avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
pixels = (uint16_t *)s->frame->data[0];
|
||||
stride = s->frame->linesize[0] / 2;
|
||||
row_inc = stride - 4;
|
||||
|
||||
/* Process chunk data */
|
||||
while (bytestream2_get_bytes_left(&s->gb)) {
|
||||
uint8_t opcode = bytestream2_get_byte(&s->gb); /* Get opcode */
|
||||
@@ -256,9 +264,6 @@ static int rpza_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
bytestream2_init(&s->gb, avpkt->data, avpkt->size);
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
|
||||
ret = rpza_decode_stream(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+19
-15
@@ -34,32 +34,36 @@
|
||||
static SoftFloat sbr_sum_square_c(int (*x)[2], int n)
|
||||
{
|
||||
SoftFloat ret;
|
||||
uint64_t accu, round;
|
||||
uint64_t accu = 0, round;
|
||||
uint64_t accu0 = 0, accu1 = 0, accu2 = 0, accu3 = 0;
|
||||
int i, nz, nz0;
|
||||
unsigned u;
|
||||
|
||||
nz = 0;
|
||||
for (i = 0; i < n; i += 2) {
|
||||
// Larger values are inavlid and could cause overflows of accu.
|
||||
av_assert2(FFABS(x[i + 0][0]) >> 30 == 0);
|
||||
accu0 += (int64_t)x[i + 0][0] * x[i + 0][0];
|
||||
av_assert2(FFABS(x[i + 0][1]) >> 30 == 0);
|
||||
accu1 += (int64_t)x[i + 0][1] * x[i + 0][1];
|
||||
av_assert2(FFABS(x[i + 1][0]) >> 30 == 0);
|
||||
accu2 += (int64_t)x[i + 1][0] * x[i + 1][0];
|
||||
av_assert2(FFABS(x[i + 1][1]) >> 30 == 0);
|
||||
accu3 += (int64_t)x[i + 1][1] * x[i + 1][1];
|
||||
if ((accu0|accu1|accu2|accu3) > UINT64_MAX - INT32_MIN*(int64_t)INT32_MIN || i+2>=n) {
|
||||
accu0 >>= nz;
|
||||
accu1 >>= nz;
|
||||
accu2 >>= nz;
|
||||
accu3 >>= nz;
|
||||
while ((accu0|accu1|accu2|accu3) > (UINT64_MAX - accu) >> 2) {
|
||||
accu0 >>= 1;
|
||||
accu1 >>= 1;
|
||||
accu2 >>= 1;
|
||||
accu3 >>= 1;
|
||||
accu >>= 1;
|
||||
nz ++;
|
||||
}
|
||||
accu += accu0 + accu1 + accu2 + accu3;
|
||||
accu0 = accu1 = accu2 = accu3 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nz0 = 15;
|
||||
while ((accu0|accu1|accu2|accu3) >> 62) {
|
||||
accu0 >>= 1;
|
||||
accu1 >>= 1;
|
||||
accu2 >>= 1;
|
||||
accu3 >>= 1;
|
||||
nz0 --;
|
||||
}
|
||||
accu = accu0 + accu1 + accu2 + accu3;
|
||||
nz0 = 15 - nz;
|
||||
|
||||
u = accu >> 32;
|
||||
if (u) {
|
||||
|
||||
+1
-1
@@ -508,7 +508,7 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
{
|
||||
SCPRContext *s = avctx->priv_data;
|
||||
GetByteContext *gb = &s->gb;
|
||||
int ret, temp, min, max, x, y, cx = 0, cx1 = 0;
|
||||
int ret, temp = 0, min, max, x, y, cx = 0, cx1 = 0;
|
||||
int backstep = linesize - avctx->width;
|
||||
const int cxshift = s->cxshift;
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
|
||||
/* subtract offset from previous samples to use in prediction */
|
||||
if (command == FN_QLPC && coffset)
|
||||
for (i = -pred_order; i < 0; i++)
|
||||
s->decoded[channel][i] -= coffset;
|
||||
s->decoded[channel][i] -= (unsigned)coffset;
|
||||
|
||||
/* decode residual and do LPC prediction */
|
||||
init_sum = pred_order ? (command == FN_QLPC ? s->lpcqoffset : 0) : coffset;
|
||||
@@ -397,7 +397,7 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
|
||||
/* add offset to current samples */
|
||||
if (command == FN_QLPC && coffset)
|
||||
for (i = 0; i < s->blocksize; i++)
|
||||
s->decoded[channel][i] += coffset;
|
||||
s->decoded[channel][i] += (unsigned)coffset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
int main(void)
|
||||
{
|
||||
RangeCoder c;
|
||||
uint8_t b[9 * SIZE];
|
||||
uint8_t b[9 * SIZE] = {0};
|
||||
uint8_t r[9 * SIZE];
|
||||
int i;
|
||||
uint8_t state[10];
|
||||
|
||||
+1
-1
@@ -571,7 +571,7 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
|
||||
if (s->compr == TIFF_CCITT_RLE ||
|
||||
s->compr == TIFF_G3 ||
|
||||
s->compr == TIFF_G4) {
|
||||
if (is_yuv)
|
||||
if (is_yuv || p->format == AV_PIX_FMT_GRAY12)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return tiff_unpack_fax(s, dst, stride, src, size, width, lines);
|
||||
|
||||
@@ -480,7 +480,7 @@ static inline void tm2_high_chroma(int *data, int stride, int *last, unsigned *C
|
||||
}
|
||||
}
|
||||
|
||||
static inline void tm2_low_chroma(int *data, int stride, int *clast, int *CD, int *deltas, int bx)
|
||||
static inline void tm2_low_chroma(int *data, int stride, int *clast, unsigned *CD, int *deltas, int bx)
|
||||
{
|
||||
int t;
|
||||
int l;
|
||||
@@ -490,8 +490,8 @@ static inline void tm2_low_chroma(int *data, int stride, int *clast, int *CD, in
|
||||
prev = clast[-3];
|
||||
else
|
||||
prev = 0;
|
||||
t = (CD[0] + CD[1]) >> 1;
|
||||
l = (prev - CD[0] - CD[1] + clast[1]) >> 1;
|
||||
t = (int)(CD[0] + CD[1]) >> 1;
|
||||
l = (int)(prev - CD[0] - CD[1] + clast[1]) >> 1;
|
||||
CD[1] = CD[0] + CD[1] - t;
|
||||
CD[0] = t;
|
||||
clast[0] = l;
|
||||
@@ -587,7 +587,8 @@ static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int
|
||||
{
|
||||
int i;
|
||||
int ct;
|
||||
int left, right, diff;
|
||||
unsigned left, right;
|
||||
int diff;
|
||||
int deltas[16];
|
||||
TM2_INIT_POINTERS();
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ static int truemotion2rt_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (avctx->width / s->hscale * avctx->height * s->delta_size > avpkt->size * 8LL * 4)
|
||||
if ((avctx->width + s->hscale - 1)/ s->hscale * avctx->height * s->delta_size > avpkt->size * 8LL * 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = init_get_bits8(gb, avpkt->data + ret, avpkt->size - ret);
|
||||
|
||||
@@ -104,7 +104,7 @@ int ff_v4l2_m2m_codec_init(AVCodecContext *avctx);
|
||||
int ff_v4l2_m2m_codec_end(AVCodecContext *avctx);
|
||||
|
||||
/**
|
||||
* Reinitializes the V4L2m2mContext when the driver cant continue processing
|
||||
* Reinitializes the V4L2m2mContext when the driver cannot continue processing
|
||||
* with the capture parameters.
|
||||
*
|
||||
* @param[in] ctx The V4L2m2mContext instantiated by the encoder/decoder.
|
||||
@@ -114,7 +114,7 @@ int ff_v4l2_m2m_codec_end(AVCodecContext *avctx);
|
||||
int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *ctx);
|
||||
|
||||
/**
|
||||
* Reinitializes the V4L2m2mContext when the driver cant continue processing
|
||||
* Reinitializes the V4L2m2mContext when the driver cannot continue processing
|
||||
* with the any of the current V4L2Contexts (ie, changes in output and capture).
|
||||
*
|
||||
* @param[in] ctx The V4L2m2mContext instantiated by the encoder/decoder.
|
||||
|
||||
@@ -166,6 +166,14 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
|
||||
}
|
||||
|
||||
s->dc_table_index = get_bits1(&s->gb);
|
||||
|
||||
// at minimum one bit per macroblock is required at least in a valid frame,
|
||||
// we discard frames much smaller than this. Frames smaller than 1/8 of the
|
||||
// smallest "black/skip" frame generally contain not much recoverable content
|
||||
// while at the same time they have the highest computational requirements
|
||||
// per byte
|
||||
if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->inter_intra_pred = 0;
|
||||
s->no_rounding = 1;
|
||||
|
||||
+3
-3
@@ -519,9 +519,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
if (c->comp == 0) { // uncompressed data
|
||||
if (c->decomp_size < len) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Buffer too small\n");
|
||||
@@ -547,6 +544,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
av_log(avctx, AV_LOG_ERROR, "decompressed size %d is incorrect, expected %d\n", c->decomp_len, expected_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
if (c->flags & ZMBV_KEYFRAME) {
|
||||
frame->key_frame = 1;
|
||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
|
||||
+34
-2
@@ -26,6 +26,8 @@
|
||||
|
||||
typedef struct {
|
||||
uint64_t data_end;
|
||||
uint64_t audio_size;
|
||||
uint64_t data_size;
|
||||
} DSFContext;
|
||||
|
||||
static int dsf_probe(AVProbeData *p)
|
||||
@@ -120,7 +122,7 @@ static int dsf_read_header(AVFormatContext *s)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
avio_skip(pb, 8);
|
||||
dsf->audio_size = avio_rl64(pb) / 8 * st->codecpar->channels;
|
||||
st->codecpar->block_align = avio_rl32(pb);
|
||||
if (st->codecpar->block_align > INT_MAX / st->codecpar->channels) {
|
||||
avpriv_request_sample(s, "block_align overflow");
|
||||
@@ -135,7 +137,9 @@ static int dsf_read_header(AVFormatContext *s)
|
||||
dsf->data_end = avio_tell(pb);
|
||||
if (avio_rl32(pb) != MKTAG('d', 'a', 't', 'a'))
|
||||
return AVERROR_INVALIDDATA;
|
||||
dsf->data_end += avio_rl64(pb);
|
||||
dsf->data_size = avio_rl64(pb) - 12;
|
||||
dsf->data_end += dsf->data_size + 12;
|
||||
s->internal->data_offset = avio_tell(pb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -151,6 +155,34 @@ static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return AVERROR_EOF;
|
||||
|
||||
pkt->stream_index = 0;
|
||||
if (dsf->data_size > dsf->audio_size) {
|
||||
int last_packet = pos == (dsf->data_end - st->codecpar->block_align);
|
||||
|
||||
if (last_packet) {
|
||||
int64_t data_pos = pos - s->internal->data_offset;
|
||||
int64_t packet_size = dsf->audio_size - data_pos;
|
||||
int64_t skip_size = dsf->data_size - data_pos - packet_size;
|
||||
uint8_t *dst;
|
||||
int ch, ret;
|
||||
|
||||
if (packet_size <= 0 || skip_size <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (av_new_packet(pkt, packet_size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
dst = pkt->data;
|
||||
for (ch = 0; ch < st->codecpar->channels; ch++) {
|
||||
ret = avio_read(pb, dst, packet_size / st->codecpar->channels);
|
||||
if (ret < packet_size / st->codecpar->channels)
|
||||
return AVERROR_EOF;
|
||||
|
||||
dst += ret;
|
||||
avio_skip(pb, skip_size / st->codecpar->channels);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return av_get_packet(pb, pkt, FFMIN(dsf->data_end - pos, st->codecpar->block_align));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -389,7 +389,7 @@ static int ftp_file_size(FTPContext *s)
|
||||
static const int size_codes[] = {213, 0};
|
||||
|
||||
snprintf(command, sizeof(command), "SIZE %s\r\n", s->path);
|
||||
if (ftp_send_command(s, command, size_codes, &res) == 213 && res) {
|
||||
if (ftp_send_command(s, command, size_codes, &res) == 213 && res && strlen(res) > 4) {
|
||||
s->filesize = strtoll(&res[4], NULL, 10);
|
||||
} else {
|
||||
s->filesize = -1;
|
||||
|
||||
@@ -86,6 +86,9 @@ static int gdv_read_header(AVFormatContext *ctx)
|
||||
vst->nb_frames = avio_rl16(pb);
|
||||
|
||||
fps = avio_rl16(pb);
|
||||
if (!fps)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
snd_flags = avio_rl16(pb);
|
||||
if (snd_flags & 1) {
|
||||
ast = avformat_new_stream(ctx, 0);
|
||||
|
||||
+1
-1
@@ -915,7 +915,7 @@ static int process_line(URLContext *h, char *line, int line_count,
|
||||
while (av_isspace(*p))
|
||||
p++;
|
||||
resource = p;
|
||||
while (!av_isspace(*p))
|
||||
while (*p && !av_isspace(*p))
|
||||
p++;
|
||||
*(p++) = '\0';
|
||||
av_log(h, AV_LOG_TRACE, "Requested resource: %s\n", resource);
|
||||
|
||||
+4
-2
@@ -590,7 +590,7 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||
int isv34)
|
||||
{
|
||||
int enc, pic_type;
|
||||
char mimetype[64];
|
||||
char mimetype[64] = {0};
|
||||
const CodecMime *mime = ff_id3v2_mime_tags;
|
||||
enum AVCodecID id = AV_CODEC_ID_NONE;
|
||||
ID3v2ExtraMetaAPIC *apic = NULL;
|
||||
@@ -612,7 +612,9 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||
if (isv34) {
|
||||
taglen -= avio_get_str(pb, taglen, mimetype, sizeof(mimetype));
|
||||
} else {
|
||||
avio_read(pb, mimetype, 3);
|
||||
if (avio_read(pb, mimetype, 3) < 0)
|
||||
goto fail;
|
||||
|
||||
mimetype[3] = 0;
|
||||
taglen -= 3;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ typedef struct MOVAtom {
|
||||
struct MOVParseTableEntry;
|
||||
|
||||
typedef struct MOVFragment {
|
||||
int found_tfhd;
|
||||
unsigned track_id;
|
||||
uint64_t base_data_offset;
|
||||
uint64_t moof_offset;
|
||||
|
||||
@@ -259,7 +259,7 @@ static int read_probe_openmpt(AVProbeData *p)
|
||||
} else {
|
||||
/* The file extension is unknown and we have very few data
|
||||
* bytes available. libopenmpt cannot decide anything here,
|
||||
* and returning any score > 0 would result in successfull
|
||||
* and returning any score > 0 would result in successful
|
||||
* probing of random data.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
@@ -3537,7 +3537,7 @@ static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
ret = matroska_resync(matroska, pos);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
|
||||
+35
-5
@@ -1325,6 +1325,10 @@ static int update_frag_index(MOVContext *c, int64_t offset)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < c->fc->nb_streams; i++) {
|
||||
// Avoid building frag index if streams lack track id.
|
||||
if (c->fc->streams[i]->id < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
frag_stream_info[i].id = c->fc->streams[i]->id;
|
||||
frag_stream_info[i].sidx_pts = AV_NOPTS_VALUE;
|
||||
frag_stream_info[i].tfdt_dts = AV_NOPTS_VALUE;
|
||||
@@ -1364,6 +1368,9 @@ static void fix_frag_index_entries(MOVFragmentIndex *frag_index, int index,
|
||||
|
||||
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
// Set by mov_read_tfhd(). mov_read_trun() will reject files missing tfhd.
|
||||
c->fragment.found_tfhd = 0;
|
||||
|
||||
if (!c->has_looked_for_mfra && c->use_mfra_for > 0) {
|
||||
c->has_looked_for_mfra = 1;
|
||||
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
||||
@@ -2685,8 +2692,11 @@ static inline int64_t mov_get_stsc_samples(MOVStreamContext *sc, unsigned int in
|
||||
|
||||
if (mov_stsc_index_valid(index, sc->stsc_count))
|
||||
chunk_count = sc->stsc_data[index + 1].first - sc->stsc_data[index].first;
|
||||
else
|
||||
else {
|
||||
// Validation for stsc / stco happens earlier in mov_read_stsc + mov_read_trak.
|
||||
av_assert0(sc->stsc_data[index].first <= sc->chunk_count);
|
||||
chunk_count = sc->chunk_count - (sc->stsc_data[index].first - 1);
|
||||
}
|
||||
|
||||
return sc->stsc_data[index].count * (int64_t)chunk_count;
|
||||
}
|
||||
@@ -4136,7 +4146,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
st = avformat_new_stream(c->fc, NULL);
|
||||
if (!st) return AVERROR(ENOMEM);
|
||||
st->id = c->fc->nb_streams;
|
||||
st->id = -1;
|
||||
sc = av_mallocz(sizeof(MOVStreamContext));
|
||||
if (!sc) return AVERROR(ENOMEM);
|
||||
|
||||
@@ -4150,6 +4160,13 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
c->trak_index = -1;
|
||||
|
||||
// Here stsc refers to a chunk not described in stco. This is technically invalid,
|
||||
// but we can overlook it (clearing stsc) whenever stts_count == 0 (indicating no samples).
|
||||
if (!sc->chunk_count && !sc->stts_count && sc->stsc_count) {
|
||||
sc->stsc_count = 0;
|
||||
av_freep(&sc->stsc_data);
|
||||
}
|
||||
|
||||
/* sanity checks */
|
||||
if ((sc->chunk_count && (!sc->stts_count || !sc->stsc_count ||
|
||||
(!sc->sample_size && !sc->sample_count))) ||
|
||||
@@ -4158,7 +4175,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
st->index);
|
||||
return 0;
|
||||
}
|
||||
if (sc->chunk_count && sc->stsc_count && sc->stsc_data[ sc->stsc_count - 1 ].first > sc->chunk_count) {
|
||||
if (sc->stsc_count && sc->stsc_data[ sc->stsc_count - 1 ].first > sc->chunk_count) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "stream %d, contradictionary STSC and STCO\n",
|
||||
st->index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -4420,6 +4437,11 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
st = c->fc->streams[c->fc->nb_streams-1];
|
||||
sc = st->priv_data;
|
||||
|
||||
// Each stream (trak) should have exactly 1 tkhd. This catches bad files and
|
||||
// avoids corrupting AVStreams mapped to an earlier tkhd.
|
||||
if (st->id != -1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
version = avio_r8(pb);
|
||||
flags = avio_rb24(pb);
|
||||
st->disposition |= (flags & MOV_TKHD_FLAG_ENABLED) ? AV_DISPOSITION_DEFAULT : 0;
|
||||
@@ -4522,6 +4544,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
MOVTrackExt *trex = NULL;
|
||||
int flags, track_id, i;
|
||||
|
||||
c->fragment.found_tfhd = 1;
|
||||
|
||||
avio_r8(pb); /* version */
|
||||
flags = avio_rb24(pb);
|
||||
|
||||
@@ -4657,6 +4681,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
AVIndexEntry *new_entries;
|
||||
MOVFragmentStreamInfo * frag_stream_info;
|
||||
|
||||
if (!frag->found_tfhd) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "trun track id unknown, no tfhd was found\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i = 0; i < c->fc->nb_streams; i++) {
|
||||
if (c->fc->streams[i]->id == frag->track_id) {
|
||||
st = c->fc->streams[i];
|
||||
@@ -4686,6 +4715,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
break;
|
||||
}
|
||||
}
|
||||
av_assert0(index_entry_pos <= st->nb_index_entries);
|
||||
|
||||
avio_r8(pb); /* version */
|
||||
flags = avio_rb24(pb);
|
||||
@@ -4730,7 +4760,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
av_log(c->fc, AV_LOG_TRACE, "first sample flags 0x%x\n", first_sample_flags);
|
||||
|
||||
// realloc space for new index entries
|
||||
if((unsigned)st->nb_index_entries + entries >= UINT_MAX / sizeof(AVIndexEntry)) {
|
||||
if((uint64_t)st->nb_index_entries + entries >= UINT_MAX / sizeof(AVIndexEntry)) {
|
||||
entries = UINT_MAX / sizeof(AVIndexEntry) - st->nb_index_entries;
|
||||
av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n");
|
||||
}
|
||||
@@ -4999,7 +5029,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < c->fc->nb_streams; i++) {
|
||||
if (ref_st) for (i = 0; i < c->fc->nb_streams; i++) {
|
||||
st = c->fc->streams[i];
|
||||
sc = st->priv_data;
|
||||
if (!sc->has_sidx) {
|
||||
|
||||
@@ -900,7 +900,7 @@ static void new_data_packet(const uint8_t *buffer, int len, AVPacket *pkt)
|
||||
|
||||
static int new_pes_packet(PESContext *pes, AVPacket *pkt)
|
||||
{
|
||||
char *sd;
|
||||
uint8_t *sd;
|
||||
|
||||
av_init_packet(pkt);
|
||||
|
||||
|
||||
@@ -1172,7 +1172,7 @@ static int nut_write_trailer(AVFormatContext *s)
|
||||
|
||||
ret = avio_open_dyn_buf(&dyn_bc);
|
||||
if (ret >= 0 && nut->sp_count) {
|
||||
av_assert1(nut->write_index);
|
||||
av_assert1(nut->write_index); // sp_count should be 0 if no index is going to be written
|
||||
write_index(nut, dyn_bc);
|
||||
put_packet(nut, bc, dyn_bc, 1, INDEX_STARTCODE);
|
||||
}
|
||||
|
||||
+6
-2
@@ -454,7 +454,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
|
||||
} else if (!strcmp(st_type, "text")) {
|
||||
codec_type = AVMEDIA_TYPE_SUBTITLE;
|
||||
}
|
||||
if (codec_type == AVMEDIA_TYPE_UNKNOWN || !(rt->media_type_mask & (1 << codec_type))) {
|
||||
if (codec_type == AVMEDIA_TYPE_UNKNOWN ||
|
||||
!(rt->media_type_mask & (1 << codec_type)) ||
|
||||
rt->nb_rtsp_streams >= s->max_streams
|
||||
) {
|
||||
s1->skip_media = 1;
|
||||
return;
|
||||
}
|
||||
@@ -1663,7 +1666,7 @@ int ff_rtsp_connect(AVFormatContext *s)
|
||||
char tcpname[1024], cmd[2048], auth[128];
|
||||
const char *lower_rtsp_proto = "tcp";
|
||||
int port, err, tcp_fd;
|
||||
RTSPMessageHeader reply1 = {0}, *reply = &reply1;
|
||||
RTSPMessageHeader reply1, *reply = &reply1;
|
||||
int lower_transport_mask = 0;
|
||||
int default_port = RTSP_DEFAULT_PORT;
|
||||
char real_challenge[64] = "";
|
||||
@@ -1692,6 +1695,7 @@ int ff_rtsp_connect(AVFormatContext *s)
|
||||
rt->lower_transport_mask &= (1 << RTSP_LOWER_TRANSPORT_NB) - 1;
|
||||
|
||||
redirect:
|
||||
memset(&reply1, 0, sizeof(reply1));
|
||||
/* extract hostname and port */
|
||||
av_url_split(proto, sizeof(proto), auth, sizeof(auth),
|
||||
host, sizeof(host), &port, path, sizeof(path), s->url);
|
||||
|
||||
@@ -466,6 +466,7 @@ static int parse_adaptation_sets(AVFormatContext *s)
|
||||
continue;
|
||||
else if (state == new_set && !strncmp(p, "id=", 3)) {
|
||||
void *mem = av_realloc(w->as, sizeof(*w->as) * (w->nb_as + 1));
|
||||
const char *comma;
|
||||
if (mem == NULL)
|
||||
return AVERROR(ENOMEM);
|
||||
w->as = mem;
|
||||
@@ -474,6 +475,11 @@ static int parse_adaptation_sets(AVFormatContext *s)
|
||||
w->as[w->nb_as - 1].streams = NULL;
|
||||
p += 3; // consume "id="
|
||||
q = w->as[w->nb_as - 1].id;
|
||||
comma = strchr(p, ',');
|
||||
if (!comma || comma - p >= sizeof(w->as[w->nb_as - 1].id)) {
|
||||
av_log(s, AV_LOG_ERROR, "'id' in 'adaptation_sets' is malformed.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
while (*p != ',') *q++ = *p++;
|
||||
*q = 0;
|
||||
p++;
|
||||
|
||||
@@ -40,6 +40,7 @@ enum WV_FLAGS {
|
||||
WV_HBAL = 0x0400,
|
||||
WV_MCINIT = 0x0800,
|
||||
WV_MCEND = 0x1000,
|
||||
WV_DSD = 0x80000000,
|
||||
};
|
||||
|
||||
static const int wv_rates[16] = {
|
||||
@@ -97,6 +98,11 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (wc->header.flags & WV_DSD) {
|
||||
avpriv_report_missing_feature(ctx, "WV DSD");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (wc->header.version < 0x402 || wc->header.version > 0x410) {
|
||||
avpriv_report_missing_feature(ctx, "WV version 0x%03X",
|
||||
wc->header.version);
|
||||
|
||||
+5
-22
@@ -501,7 +501,6 @@ int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
|
||||
static void memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear,
|
||||
size_t clear_size)
|
||||
{
|
||||
size_t pos = 0;
|
||||
int same = 1;
|
||||
int i;
|
||||
|
||||
@@ -521,28 +520,12 @@ static void memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear,
|
||||
if (clear_size == 1) {
|
||||
memset(dst, clear[0], dst_size);
|
||||
dst_size = 0;
|
||||
} else if (clear_size == 2) {
|
||||
uint16_t val = AV_RN16(clear);
|
||||
for (; dst_size >= 2; dst_size -= 2) {
|
||||
AV_WN16(dst, val);
|
||||
dst += 2;
|
||||
}
|
||||
} else if (clear_size == 4) {
|
||||
uint32_t val = AV_RN32(clear);
|
||||
for (; dst_size >= 4; dst_size -= 4) {
|
||||
AV_WN32(dst, val);
|
||||
dst += 4;
|
||||
}
|
||||
} else if (clear_size == 8) {
|
||||
uint32_t val = AV_RN64(clear);
|
||||
for (; dst_size >= 8; dst_size -= 8) {
|
||||
AV_WN64(dst, val);
|
||||
dst += 8;
|
||||
}
|
||||
} else {
|
||||
if (clear_size > dst_size)
|
||||
clear_size = dst_size;
|
||||
memcpy(dst, clear, clear_size);
|
||||
av_memcpy_backptr(dst + clear_size, clear_size, dst_size - clear_size);
|
||||
}
|
||||
|
||||
for (; dst_size; dst_size--)
|
||||
*dst++ = clear[pos++ % clear_size];
|
||||
}
|
||||
|
||||
// Maximum size in bytes of a plane element (usually a pixel, or multiple pixels
|
||||
|
||||
@@ -399,6 +399,18 @@ static void fill32(uint8_t *dst, int len)
|
||||
{
|
||||
uint32_t v = AV_RN32(dst - 4);
|
||||
|
||||
#if HAVE_FAST_64BIT
|
||||
uint64_t v2= v + ((uint64_t)v<<32);
|
||||
while (len >= 32) {
|
||||
AV_WN64(dst , v2);
|
||||
AV_WN64(dst+ 8, v2);
|
||||
AV_WN64(dst+16, v2);
|
||||
AV_WN64(dst+24, v2);
|
||||
dst += 32;
|
||||
len -= 32;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (len >= 4) {
|
||||
AV_WN32(dst, v);
|
||||
dst += 4;
|
||||
|
||||
@@ -1184,10 +1184,10 @@ FIND_MIN_MAX((%0, %1, 8))
|
||||
#endif
|
||||
"movq %%mm6, %%mm0 \n\t" // max
|
||||
"psubb %%mm7, %%mm6 \n\t" // max - min
|
||||
"push %4 \n\t"
|
||||
"movd %%mm6, %k4 \n\t"
|
||||
"cmpb "MANGLE(deringThreshold)", %b4 \n\t"
|
||||
"pop %4 \n\t"
|
||||
"push %%"FF_REG_a" \n\t"
|
||||
"movd %%mm6, %%eax \n\t"
|
||||
"cmpb "MANGLE(deringThreshold)", %%al \n\t"
|
||||
"pop %%"FF_REG_a" \n\t"
|
||||
" jb 1f \n\t"
|
||||
PAVGB(%%mm0, %%mm7) // a=(max + min)/2
|
||||
"punpcklbw %%mm7, %%mm7 \n\t"
|
||||
@@ -1317,7 +1317,7 @@ DERING_CORE((%0, %1, 8) ,(%%FF_REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,
|
||||
"1: \n\t"
|
||||
: : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb), "m"(c->pQPb2), "q"(tmp)
|
||||
NAMED_CONSTRAINTS_ADD(deringThreshold,b00,b02,b08)
|
||||
: "%"FF_REG_a, "%"FF_REG_d, "%"FF_REG_sp
|
||||
: "%"FF_REG_a, "%"FF_REG_d
|
||||
);
|
||||
#else // HAVE_7REGS && (TEMPLATE_PP_MMXEXT || TEMPLATE_PP_3DNOW)
|
||||
int y;
|
||||
|
||||
@@ -767,7 +767,7 @@ fate-filter-meta-4560-rotate0: CMD = framecrc -flags +bitexact -c:a aac_fixed -i
|
||||
REFCMP_DEPS = FFMPEG LAVFI_INDEV TESTSRC2_FILTER AVGBLUR_FILTER METADATA_FILTER
|
||||
|
||||
FATE_FILTER_SAMPLES-$(call ALLYES, $(REFCMP_DEPS) PSNR_FILTER) += fate-filter-refcmp-psnr-rgb
|
||||
fate-filter-refcmp-psnr-rgb: CMD = refcmp_metadata psnr rgb24 0.001
|
||||
fate-filter-refcmp-psnr-rgb: CMD = refcmp_metadata psnr rgb24 0.002
|
||||
|
||||
FATE_FILTER_SAMPLES-$(call ALLYES, $(REFCMP_DEPS) PSNR_FILTER) += fate-filter-refcmp-psnr-yuv
|
||||
fate-filter-refcmp-psnr-yuv: CMD = refcmp_metadata psnr yuv422p 0.0015
|
||||
|
||||
Reference in New Issue
Block a user