Compare commits
123 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4154f89678 | |||
| 6c75df556f | |||
| 58cd70201e | |||
| 1d720b37f0 | |||
| f1ecebcdb7 | |||
| daca529112 | |||
| 65f94b732a | |||
| ad0f4a7d10 | |||
| cb4768e7f2 | |||
| 6972b353b4 | |||
| abf36b76de | |||
| a7cb7a2e43 | |||
| b429df281d | |||
| 7ce56329e7 | |||
| dbef08b60f | |||
| 77d244e7a9 | |||
| 8cee4190f3 | |||
| 04ce4cc072 | |||
| 5d208aac52 | |||
| 83bfd4f3b5 | |||
| 9bf40978c6 | |||
| 1e50a327c6 | |||
| ad12d9df1e | |||
| 67d030787e | |||
| c90836cc3d | |||
| 6c0124d392 | |||
| 29619a8ac2 | |||
| 09683e1f4e | |||
| 662b6351c8 | |||
| b8dd1d2d4b | |||
| 92335fc02b | |||
| ff491b1544 | |||
| 4e624c89fd | |||
| 9495228df0 | |||
| 339f40f618 | |||
| ec22b46a4d | |||
| 11375cd101 | |||
| f7f3937494 | |||
| cc5361ed18 | |||
| 4d1fcd734e | |||
| 8066cb3556 | |||
| d25f388584 | |||
| 1a82246cae | |||
| 7e204f7260 | |||
| 53f3f5233f | |||
| 110eff79ca | |||
| 33c8009773 | |||
| 74700e50bf | |||
| 00cdf4e4e5 | |||
| bcc71f30ad | |||
| 31a1d2aa83 | |||
| 7816497ba0 | |||
| 953f97979f | |||
| e75a73d629 | |||
| b482e94e59 | |||
| 0f1332309a | |||
| f5c9753bfd | |||
| d8b8b27dc3 | |||
| 62f5325ca3 | |||
| bcfd82b0be | |||
| 31fa50f3d9 | |||
| 552733d48b | |||
| a8b5990f45 | |||
| cb6af7dfa1 | |||
| 29d978c91e | |||
| 3a52cae2c7 | |||
| 792df36f42 | |||
| c694273feb | |||
| 9239d58b36 | |||
| 1623f42d99 | |||
| 99576bf034 | |||
| e385fc45dd | |||
| 15857674c5 | |||
| 6b6c854658 | |||
| 41ee513c81 | |||
| 33b4aba5bd | |||
| ea279bd160 | |||
| 929b5519d8 | |||
| 5ed024e40b | |||
| 5550946ff4 | |||
| daef9d4382 | |||
| 69f50eb915 | |||
| 73c90818b1 | |||
| c22b67feaa | |||
| 4c0be3a60c | |||
| 42357b37cb | |||
| e3fbbb7d18 | |||
| 2f75965c47 | |||
| e1f40f0dae | |||
| 45f5f2086e | |||
| 321c418b87 | |||
| f5859d4a8e | |||
| 54fbdacc37 | |||
| 228f17ced3 | |||
| 9b5a6bb67b | |||
| 219cbc5527 | |||
| 55c36d2498 | |||
| 558ba71de5 | |||
| 1a5db666ac | |||
| eee0cf487a | |||
| 90db1e441f | |||
| 4fe90900d8 | |||
| ee349bd0fd | |||
| ab744447e1 | |||
| 89d65915cf | |||
| e69bb0fb05 | |||
| 98a9d868d1 | |||
| b66152a4e5 | |||
| ac50246cc4 | |||
| ddc284300e | |||
| b420f23566 | |||
| 5356e61001 | |||
| a4ddc3c9fc | |||
| 59e30c05d7 | |||
| fcffed470a | |||
| 9efc591cb7 | |||
| d4c5f515f0 | |||
| bb01cd3cc0 | |||
| fed94c2f22 | |||
| a9e9303f26 | |||
| 49bc641e89 | |||
| 4f1e07090a | |||
| 11dff170ef |
@@ -1,6 +1,129 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 4.1.3:
|
||||
- avcodec/rscc: Check that the to be uncompressed input is large enough
|
||||
- avformat/movenc: free eac3 private data only when closing the stream
|
||||
- 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/cbs_av1: fix range of values for Mastering Display Color Volume Metadata OBUs
|
||||
- avcodec/av1_parser: don't abort parsing the first frame if extradata parsing fails
|
||||
|
||||
version 4.1.2:
|
||||
- avcodec/dfa: Check the chunk header is not truncated
|
||||
- avcodec/clearvideo: Check remaining data in P frames
|
||||
- avcodec/hevcdec: decode at most one slice reporting being the first in the picture
|
||||
- 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()
|
||||
- avcodec/prores_ks: Fix luma quantization if q >= MAX_STORED_Q
|
||||
- avformat/mov: fix hang while seek on a kind of fragmented mp4
|
||||
- avformat/async: fix assertion condition when draining buffer
|
||||
- avcodec/cbs_av1: don't call cbs_av1_read_trailing_bits() when no bits remain in the OBU
|
||||
|
||||
version 4.1.1:
|
||||
- avformat/mov: validate chunk_count vs stsc_data
|
||||
- avformat/mov: 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/rasc: Move ff_get_buffer() after frame checks
|
||||
- avcodec/rasc: Check uncompressed dlta size
|
||||
- avcodec/fic: Check that there is input left in fic_decode_block()
|
||||
- avcodec/ilbcdec: Fix undefined integer overflow lsf2poly()
|
||||
- avcodec/ilbcdec: Fix integer overflow in construct_vector()
|
||||
- avcodec/prosumer: Error out if decompress() stops reading data
|
||||
- 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/tests/rangecoder: initialize array to avoid valgrind warning
|
||||
- avcodec/gdv: Optimize and factorize scaling loops
|
||||
- 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
|
||||
- avfilter/vf_tonemap_opencl: Make static tables const
|
||||
- doc/indevs: fix upto typo
|
||||
- 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
|
||||
- avcodec/ilbcdec: fix integer overflow in energy
|
||||
- postproc/postprocess_template: remove FF_REG_sp from clobber list
|
||||
- postproc/postprocess_template: Avoid using %4 for the threshold compare
|
||||
- libavformat/mov: Fix NULL-dereference read for some encrypted content.
|
||||
- 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
|
||||
- avcodec/rasc: Check that the number of moves is less than or equal the number of pixels
|
||||
- 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/rasc: Check input space before reading chunk
|
||||
- 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/diracdec: Check component quant
|
||||
- avcodec/tiff: Limit filtering to decoded data
|
||||
- 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
|
||||
- avcodec/imm4: Use ff_set_dimensions()
|
||||
- h264_redundant_pps: Fix logging context
|
||||
- avfilter/af_asetnsamples: fix last frame props
|
||||
- cbs_av1: Fix reading of overlong uvlc codes
|
||||
- avcodec/cbs_av1: fix parsing delta_frame_id_minus1
|
||||
- avfilter/vf_overlay: fix filtering with negative y
|
||||
- avformat/movenc: get number of written bytes from bitstream writer
|
||||
- avformat/movenc: fix size calculation in mov_write_eac3_tag()
|
||||
- avfilter/vf_overlay: fix crash with negative y
|
||||
- avcodec/mpeg_er: fix clearing chroma blocks for 422 and 444
|
||||
- avfilter/af_afade: fix duration maximum
|
||||
- avfilter/vf_fade: fix start/duration max value
|
||||
- avcodec/cbs_av1: fix parsing signed integer values
|
||||
- avcodec/cbs_av1: fix storage size for segmentation_params feature_value fields
|
||||
- configure: Add missing xlib dependency for VAAPI X11 code
|
||||
- avcodec/hevcdec: fix non-ref frame judgement
|
||||
|
||||
|
||||
version 4.1:
|
||||
- deblock filter
|
||||
- tmix filter
|
||||
|
||||
@@ -2812,6 +2812,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
|
||||
dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
|
||||
ffnvcodec_deps_any="libdl LoadLibrary"
|
||||
nvdec_deps="ffnvcodec"
|
||||
vaapi_x11_deps="xlib"
|
||||
videotoolbox_hwaccel_deps="videotoolbox pthreads"
|
||||
videotoolbox_hwaccel_extralibs="-framework QuartzCore"
|
||||
xvmc_deps="X11_extensions_XvMClib_h"
|
||||
@@ -6151,21 +6152,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"
|
||||
@@ -7242,7 +7243,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})"
|
||||
|
||||
+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.1
|
||||
PROJECT_NUMBER = 4.1.3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
+1
-1
@@ -374,7 +374,7 @@ Defaults to @option{false}.
|
||||
@item timestamp_align
|
||||
Capture start time alignment in seconds. If set to nonzero, input frames are
|
||||
dropped till the system timestamp aligns with configured value.
|
||||
Alignment difference of upto one frame duration is tolerated.
|
||||
Alignment difference of up to one frame duration is tolerated.
|
||||
This is useful for maintaining input synchronization across N different
|
||||
hardware devices deployed for 'N-way' redundancy. The system time of different
|
||||
hardware devices should be synchronized with protocols such as NTP or PTP,
|
||||
|
||||
+7
-3
@@ -2139,9 +2139,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:
|
||||
@@ -2155,6 +2152,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);
|
||||
|
||||
@@ -68,8 +68,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
|
||||
|
||||
ret = ff_cbs_read(s->cbc, td, avctx->extradata, avctx->extradata_size);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to parse extradata.\n");
|
||||
goto end;
|
||||
av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata.\n");
|
||||
}
|
||||
|
||||
ff_cbs_fragment_uninit(s->cbc, td);
|
||||
|
||||
@@ -1321,7 +1321,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;
|
||||
}
|
||||
|
||||
+55
-41
@@ -29,45 +29,67 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc,
|
||||
const char *name, uint32_t *write_to,
|
||||
uint32_t range_min, uint32_t range_max)
|
||||
{
|
||||
uint32_t value;
|
||||
int position, zeroes, i, j;
|
||||
char bits[65];
|
||||
uint32_t zeroes, bits_value, value;
|
||||
int position;
|
||||
|
||||
if (ctx->trace_enable)
|
||||
position = get_bits_count(gbc);
|
||||
|
||||
zeroes = i = 0;
|
||||
zeroes = 0;
|
||||
while (1) {
|
||||
if (get_bits_left(gbc) < zeroes + 1) {
|
||||
if (get_bits_left(gbc) < 1) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
|
||||
"%s: bitstream ended.\n", name);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (get_bits1(gbc)) {
|
||||
bits[i++] = '1';
|
||||
if (get_bits1(gbc))
|
||||
break;
|
||||
} else {
|
||||
bits[i++] = '0';
|
||||
++zeroes;
|
||||
}
|
||||
++zeroes;
|
||||
}
|
||||
|
||||
if (zeroes >= 32) {
|
||||
value = MAX_UINT_BITS(32);
|
||||
} else {
|
||||
value = get_bits_long(gbc, zeroes);
|
||||
if (get_bits_left(gbc) < zeroes) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
|
||||
"%s: bitstream ended.\n", name);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (j = 0; j < zeroes; j++)
|
||||
bits[i++] = (value >> (zeroes - j - 1) & 1) ? '1' : '0';
|
||||
|
||||
value += (1 << zeroes) - 1;
|
||||
bits_value = get_bits_long(gbc, zeroes);
|
||||
value = bits_value + (UINT32_C(1) << zeroes) - 1;
|
||||
}
|
||||
|
||||
if (ctx->trace_enable) {
|
||||
char bits[65];
|
||||
int i, j, k;
|
||||
|
||||
if (zeroes >= 32) {
|
||||
while (zeroes > 32) {
|
||||
k = FFMIN(zeroes - 32, 32);
|
||||
for (i = 0; i < k; i++)
|
||||
bits[i] = '0';
|
||||
bits[i] = 0;
|
||||
ff_cbs_trace_syntax_element(ctx, position, name,
|
||||
NULL, bits, 0);
|
||||
zeroes -= k;
|
||||
position += k;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < zeroes; i++)
|
||||
bits[i] = '0';
|
||||
bits[i++] = '1';
|
||||
|
||||
if (zeroes < 32) {
|
||||
for (j = 0; j < zeroes; j++)
|
||||
bits[i++] = (bits_value >> (zeroes - j - 1) & 1) ? '1' : '0';
|
||||
}
|
||||
|
||||
bits[i] = 0;
|
||||
ff_cbs_trace_syntax_element(ctx, position, name, NULL,
|
||||
bits, value);
|
||||
ff_cbs_trace_syntax_element(ctx, position, name,
|
||||
NULL, bits, value);
|
||||
}
|
||||
|
||||
if (value < range_min || value > range_max) {
|
||||
@@ -189,30 +211,26 @@ static int cbs_av1_read_su(CodedBitstreamContext *ctx, GetBitContext *gbc,
|
||||
int width, const char *name,
|
||||
const int *subscripts, int32_t *write_to)
|
||||
{
|
||||
uint32_t magnitude;
|
||||
int position, sign;
|
||||
int position;
|
||||
int32_t value;
|
||||
|
||||
if (ctx->trace_enable)
|
||||
position = get_bits_count(gbc);
|
||||
|
||||
if (get_bits_left(gbc) < width + 1) {
|
||||
if (get_bits_left(gbc) < width) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at "
|
||||
"%s: bitstream ended.\n", name);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
magnitude = get_bits(gbc, width);
|
||||
sign = get_bits1(gbc);
|
||||
value = sign ? -(int32_t)magnitude : magnitude;
|
||||
value = get_sbits(gbc, width);
|
||||
|
||||
if (ctx->trace_enable) {
|
||||
char bits[33];
|
||||
int i;
|
||||
for (i = 0; i < width; i++)
|
||||
bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
|
||||
bits[i] = sign ? '1' : '0';
|
||||
bits[i + 1] = 0;
|
||||
bits[i] = value & (1 << (width - i - 1)) ? '1' : '0';
|
||||
bits[i] = 0;
|
||||
|
||||
ff_cbs_trace_syntax_element(ctx, position,
|
||||
name, subscripts, bits, value);
|
||||
@@ -226,29 +244,21 @@ static int cbs_av1_write_su(CodedBitstreamContext *ctx, PutBitContext *pbc,
|
||||
int width, const char *name,
|
||||
const int *subscripts, int32_t value)
|
||||
{
|
||||
uint32_t magnitude;
|
||||
int sign;
|
||||
|
||||
if (put_bits_left(pbc) < width + 1)
|
||||
if (put_bits_left(pbc) < width)
|
||||
return AVERROR(ENOSPC);
|
||||
|
||||
sign = value < 0;
|
||||
magnitude = sign ? -value : value;
|
||||
|
||||
if (ctx->trace_enable) {
|
||||
char bits[33];
|
||||
int i;
|
||||
for (i = 0; i < width; i++)
|
||||
bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
|
||||
bits[i] = sign ? '1' : '0';
|
||||
bits[i + 1] = 0;
|
||||
bits[i] = value & (1 << (width - i - 1)) ? '1' : '0';
|
||||
bits[i] = 0;
|
||||
|
||||
ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc),
|
||||
name, subscripts, bits, value);
|
||||
}
|
||||
|
||||
put_bits(pbc, width, magnitude);
|
||||
put_bits(pbc, 1, sign);
|
||||
put_sbits(pbc, width, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1061,8 +1071,12 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
|
||||
if (obu->obu_size > 0 &&
|
||||
obu->header.obu_type != AV1_OBU_TILE_GROUP &&
|
||||
obu->header.obu_type != AV1_OBU_FRAME) {
|
||||
err = cbs_av1_read_trailing_bits(ctx, &gbc,
|
||||
obu->obu_size * 8 + start_pos - end_pos);
|
||||
int nb_bits = obu->obu_size * 8 + start_pos - end_pos;
|
||||
|
||||
if (nb_bits <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
err = cbs_av1_read_trailing_bits(ctx, &gbc, nb_bits);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ typedef struct AV1RawFrameHeader {
|
||||
uint8_t last_frame_idx;
|
||||
uint8_t golden_frame_idx;
|
||||
int8_t ref_frame_idx[AV1_REFS_PER_FRAME];
|
||||
uint8_t delta_frame_id_minus1;
|
||||
uint32_t delta_frame_id_minus1[AV1_REFS_PER_FRAME];
|
||||
|
||||
uint8_t allow_high_precision_mv;
|
||||
uint8_t is_filter_switchable;
|
||||
@@ -210,7 +210,7 @@ typedef struct AV1RawFrameHeader {
|
||||
uint8_t segmentation_temporal_update;
|
||||
uint8_t segmentation_update_data;
|
||||
uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
|
||||
uint8_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
|
||||
int16_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
|
||||
|
||||
uint8_t delta_q_present;
|
||||
uint8_t delta_q_res;
|
||||
|
||||
@@ -1323,8 +1323,8 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
if (!current->frame_refs_short_signaling)
|
||||
fbs(3, ref_frame_idx[i], 1, i);
|
||||
if (seq->frame_id_numbers_present_flag) {
|
||||
fb(seq->delta_frame_id_length_minus_2 + 2,
|
||||
delta_frame_id_minus1);
|
||||
fbs(seq->delta_frame_id_length_minus_2 + 2,
|
||||
delta_frame_id_minus1[i], 1, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1637,15 +1637,18 @@ static int FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
int err, i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
fcs(16, primary_chromaticity_x[i], 0, 50000, 1, i);
|
||||
fcs(16, primary_chromaticity_y[i], 0, 50000, 1, i);
|
||||
fbs(16, primary_chromaticity_x[i], 1, i);
|
||||
fbs(16, primary_chromaticity_y[i], 1, i);
|
||||
}
|
||||
|
||||
fc(16, white_point_chromaticity_x, 0, 50000);
|
||||
fc(16, white_point_chromaticity_y, 0, 50000);
|
||||
fb(16, white_point_chromaticity_x);
|
||||
fb(16, white_point_chromaticity_y);
|
||||
|
||||
fc(32, luminance_max, 1, MAX_UINT_BITS(32));
|
||||
fc(32, luminance_min, 0, current->luminance_max >> 6);
|
||||
// luminance_min must be lower than luminance_max. Convert luminance_max from
|
||||
// 24.8 fixed point to 18.14 fixed point in order to compare them.
|
||||
fc(32, luminance_min, 0, FFMIN(((uint64_t)current->luminance_max << 6) - 1,
|
||||
MAX_UINT_BITS(32)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,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)
|
||||
|
||||
@@ -555,6 +555,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;
|
||||
|
||||
@@ -570,6 +573,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);
|
||||
|
||||
@@ -676,6 +676,11 @@ static int 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;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
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));
|
||||
|
||||
@@ -1267,6 +1267,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)
|
||||
|
||||
+66
-23
@@ -72,9 +72,64 @@ static av_cold int gdv_decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void scaleup(uint8_t *dst, const uint8_t *src, int w)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < w - 7; x+=8) {
|
||||
dst[x + 0] =
|
||||
dst[x + 1] = src[(x>>1) + 0];
|
||||
dst[x + 2] =
|
||||
dst[x + 3] = src[(x>>1) + 1];
|
||||
dst[x + 4] =
|
||||
dst[x + 5] = src[(x>>1) + 2];
|
||||
dst[x + 6] =
|
||||
dst[x + 7] = src[(x>>1) + 3];
|
||||
}
|
||||
for (; x < w; x++) {
|
||||
dst[x] = src[(x>>1)];
|
||||
}
|
||||
}
|
||||
|
||||
static void scaleup_rev(uint8_t *dst, const uint8_t *src, int w)
|
||||
{
|
||||
int x;
|
||||
|
||||
for (x = w - 1; (x+1) & 7; x--) {
|
||||
dst[x] = src[(x>>1)];
|
||||
}
|
||||
for (x -= 7; x >= 0; x -= 8) {
|
||||
dst[x + 6] =
|
||||
dst[x + 7] = src[(x>>1) + 3];
|
||||
dst[x + 4] =
|
||||
dst[x + 5] = src[(x>>1) + 2];
|
||||
dst[x + 2] =
|
||||
dst[x + 3] = src[(x>>1) + 1];
|
||||
dst[x + 0] =
|
||||
dst[x + 1] = src[(x>>1) + 0];
|
||||
}
|
||||
}
|
||||
|
||||
static void scaledown(uint8_t *dst, const uint8_t *src, int w)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < w - 7; x+=8) {
|
||||
dst[x + 0] = src[2*x + 0];
|
||||
dst[x + 1] = src[2*x + 2];
|
||||
dst[x + 2] = src[2*x + 4];
|
||||
dst[x + 3] = src[2*x + 6];
|
||||
dst[x + 4] = src[2*x + 8];
|
||||
dst[x + 5] = src[2*x +10];
|
||||
dst[x + 6] = src[2*x +12];
|
||||
dst[x + 7] = src[2*x +14];
|
||||
}
|
||||
for (; x < w; x++) {
|
||||
dst[x] = src[2*x];
|
||||
}
|
||||
}
|
||||
|
||||
static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, int scale_h)
|
||||
{
|
||||
int j, y, x;
|
||||
int j, y;
|
||||
|
||||
if ((gdv->scale_v == scale_v) && (gdv->scale_h == scale_h)) {
|
||||
return;
|
||||
@@ -86,14 +141,7 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in
|
||||
uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
|
||||
uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1);
|
||||
|
||||
for (x = w - 1; x >= 0 && !(x&1); x--) {
|
||||
dst1[x] = src1[(x>>1)];
|
||||
}
|
||||
|
||||
for (x--; x >= 0; x-=2) {
|
||||
dst1[x ] =
|
||||
dst1[x+1] = src1[(x>>1)];
|
||||
}
|
||||
scaleup_rev(dst1, src1, w);
|
||||
}
|
||||
} else if (gdv->scale_h) {
|
||||
for (j = 0; j < h; j++) {
|
||||
@@ -108,9 +156,7 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in
|
||||
for (y = 0; y < (h>>1); y++) {
|
||||
uint8_t *dst1 = dst + PREAMBLE_SIZE + y * (w>>1);
|
||||
uint8_t *src1 = dst + PREAMBLE_SIZE + y*2 * w;
|
||||
for (x = 0; x < (w>>1); x++) {
|
||||
dst1[x] = src1[x*2];
|
||||
}
|
||||
scaledown(dst1, src1, w>>1);
|
||||
}
|
||||
} else if (scale_h) {
|
||||
for (y = 0; y < (h>>1); y++) {
|
||||
@@ -121,9 +167,7 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in
|
||||
} else if (scale_v) {
|
||||
for (y = 0; y < h; y++) {
|
||||
uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
|
||||
for (x = 0; x < (w>>1); x++) {
|
||||
dst1[x] = dst1[x*2];
|
||||
}
|
||||
scaledown(dst1, dst1, w>>1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,6 +294,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) {
|
||||
@@ -481,19 +527,16 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
} else {
|
||||
int sidx = PREAMBLE_SIZE, didx = 0;
|
||||
int y, x;
|
||||
int y;
|
||||
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
if (!gdv->scale_v) {
|
||||
memcpy(dst + didx, gdv->frame + sidx, avctx->width);
|
||||
} else {
|
||||
for (x = 0; x < avctx->width - 1; x+=2) {
|
||||
dst[didx + x ] =
|
||||
dst[didx + x + 1] = gdv->frame[sidx + (x>>1)];
|
||||
}
|
||||
for (; x < avctx->width; x++) {
|
||||
dst[didx + x] = gdv->frame[sidx + (x>>1)];
|
||||
}
|
||||
uint8_t *dst2 = dst + didx;
|
||||
uint8_t *src2 = gdv->frame + sidx;
|
||||
|
||||
scaleup(dst2, src2, avctx->width);
|
||||
}
|
||||
if (!gdv->scale_h || ((y & 1) == 1)) {
|
||||
sidx += !gdv->scale_v ? avctx->width : avctx->width/2;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -91,7 +91,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);
|
||||
}
|
||||
|
||||
@@ -678,7 +678,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 == ' ') {
|
||||
|
||||
@@ -408,11 +408,11 @@ static void lsf2poly(int16_t *a, int16_t *lsf)
|
||||
|
||||
a[0] = 4096;
|
||||
for (i = 5; i > 0; i--) {
|
||||
tmp = f[0][6 - i] + (unsigned)f[1][6 - i];
|
||||
a[6 - i] = (tmp + 4096) >> 13;
|
||||
tmp = f[0][6 - i] + (unsigned)f[1][6 - i] + 4096;
|
||||
a[6 - i] = tmp >> 13;
|
||||
|
||||
tmp = f[0][6 - i] - (unsigned)f[1][6 - i];
|
||||
a[5 + i] = (tmp + 4096) >> 13;
|
||||
tmp = f[0][6 - i] - (unsigned)f[1][6 - i] + 4096;
|
||||
a[5 + i] = tmp >> 13;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -745,7 +745,7 @@ static void construct_vector (
|
||||
for (j = 0; j < veclen; j++) {
|
||||
a32 = SPL_MUL_16_16(*gainPtr++, cbvec0[j]);
|
||||
a32 += SPL_MUL_16_16(*gainPtr++, cbvec1[j]);
|
||||
a32 += SPL_MUL_16_16(*gainPtr, cbvec2[j]);
|
||||
a32 += (unsigned)SPL_MUL_16_16(*gainPtr, cbvec2[j]);
|
||||
gainPtr -= 2;
|
||||
decvector[j] = (a32 + 8192) >> 14;
|
||||
}
|
||||
@@ -1303,7 +1303,8 @@ static int xcorr_coeff(int16_t *target, int16_t *regressor,
|
||||
pos += step;
|
||||
|
||||
/* Do a +/- to get the next energy */
|
||||
energy += step * ((*rp_end * *rp_end - *rp_beg * *rp_beg) >> shifts);
|
||||
energy += (unsigned)step * ((*rp_end * *rp_end - *rp_beg * *rp_beg) >> shifts);
|
||||
|
||||
rp_beg += step;
|
||||
rp_end += step;
|
||||
}
|
||||
|
||||
+3
-2
@@ -428,8 +428,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
av_log(avctx, AV_LOG_ERROR, "Frame size change is unsupported.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->width = width;
|
||||
avctx->height = height;
|
||||
ret = ff_set_dimensions(avctx, width, height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s->changed_size = 1;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
@@ -1206,25 +1206,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1899,14 +1899,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);
|
||||
@@ -3057,6 +3063,7 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
return 0;
|
||||
|
||||
s->partitioned_frame = 0;
|
||||
s->interlaced_dct = 0;
|
||||
s->decode_mb = mpeg4_decode_studio_mb;
|
||||
|
||||
decode_smpte_tc(ctx, gb);
|
||||
|
||||
@@ -78,6 +78,8 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
|
||||
ff_update_block_index(s);
|
||||
|
||||
s->bdsp.clear_blocks(s->block[0]);
|
||||
if (!s->chroma_y_shift)
|
||||
s->bdsp.clear_blocks(s->block[6]);
|
||||
|
||||
s->dest[0] = s->current_picture.f->data[0] +
|
||||
s->mb_y * 16 * s->linesize +
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -58,7 +58,13 @@ static av_always_inline void transform4x4(vec_s16 src_01, vec_s16 src_23,
|
||||
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);
|
||||
|
||||
@@ -72,7 +78,14 @@ static av_always_inline void scale(vec_s32 res[4], vec_s16 res_packed[2],
|
||||
const 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);
|
||||
|
||||
@@ -221,6 +221,7 @@ typedef struct ProresThreadData {
|
||||
DECLARE_ALIGNED(16, int16_t, blocks)[MAX_PLANES][64 * 4 * MAX_MBS_PER_SLICE];
|
||||
DECLARE_ALIGNED(16, uint16_t, emu_buf)[16 * 16];
|
||||
int16_t custom_q[64];
|
||||
int16_t custom_chroma_q[64];
|
||||
struct TrellisNode *nodes;
|
||||
} ProresThreadData;
|
||||
|
||||
@@ -231,6 +232,7 @@ typedef struct ProresContext {
|
||||
int16_t quants[MAX_STORED_Q][64];
|
||||
int16_t quants_chroma[MAX_STORED_Q][64];
|
||||
int16_t custom_q[64];
|
||||
int16_t custom_chroma_q[64];
|
||||
const uint8_t *quant_mat;
|
||||
const uint8_t *quant_chroma_mat;
|
||||
const uint8_t *scantable;
|
||||
@@ -573,7 +575,7 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
|
||||
qmat_chroma = ctx->quants_chroma[quant];
|
||||
} else {
|
||||
qmat = ctx->custom_q;
|
||||
qmat_chroma = ctx->custom_q;
|
||||
qmat_chroma = ctx->custom_chroma_q;
|
||||
for (i = 0; i < 64; i++) {
|
||||
qmat[i] = ctx->quant_mat[i] * quant;
|
||||
qmat_chroma[i] = ctx->quant_chroma_mat[i] * quant;
|
||||
@@ -901,7 +903,7 @@ static int find_slice_quant(AVCodecContext *avctx,
|
||||
qmat_chroma = ctx->quants_chroma[q];
|
||||
} else {
|
||||
qmat = td->custom_q;
|
||||
qmat_chroma = td->custom_q;
|
||||
qmat_chroma = td->custom_chroma_q;
|
||||
for (i = 0; i < 64; i++) {
|
||||
qmat[i] = ctx->quant_mat[i] * q;
|
||||
qmat_chroma[i] = ctx->quant_chroma_mat[i] * q;
|
||||
|
||||
@@ -99,6 +99,8 @@ static int decompress(GetByteContext *gb, int size, PutByteContext *pb, const ui
|
||||
}
|
||||
idx = a >> 20;
|
||||
b = lut[2 * idx];
|
||||
if (!b)
|
||||
return AVERROR_INVALIDDATA;
|
||||
continue;
|
||||
}
|
||||
idx = 2;
|
||||
@@ -159,8 +161,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
memset(s->decbuffer, 0, s->size);
|
||||
bytestream2_init(&s->gb, avpkt->data, avpkt->size);
|
||||
bytestream2_init_writer(&s->pb, s->decbuffer, s->size);
|
||||
|
||||
decompress(&s->gb, AV_RL32(avpkt->data + 28) >> 1, &s->pb, s->lut);
|
||||
ret = decompress(&s->gb, AV_RL32(avpkt->data + 28) >> 1, &s->pb, s->lut);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
vertical_predict((uint32_t *)s->decbuffer, 0, (uint32_t *)s->initial_line, s->stride, 1);
|
||||
vertical_predict((uint32_t *)s->decbuffer, s->stride, (uint32_t *)s->decbuffer, s->stride, avctx->height - 1);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+9
-4
@@ -215,7 +215,7 @@ static int decode_move(AVCodecContext *avctx,
|
||||
bytestream2_skip(gb, 8);
|
||||
compression = bytestream2_get_le32(gb);
|
||||
|
||||
if (nb_moves > INT32_MAX / 16)
|
||||
if (nb_moves > INT32_MAX / 16 || nb_moves > avctx->width * avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
uncompressed_size = 16 * nb_moves;
|
||||
@@ -353,6 +353,8 @@ static int decode_dlta(AVCodecContext *avctx,
|
||||
compression = bytestream2_get_le32(gb);
|
||||
|
||||
if (compression == 1) {
|
||||
if (w * h * s->bpp * 3 < uncompressed_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = decode_zlib(avctx, avpkt, size, uncompressed_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -680,6 +682,9 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
while (bytestream2_get_bytes_left(gb) > 0) {
|
||||
unsigned type, size = 0;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
type = bytestream2_get_le32(gb);
|
||||
if (type == KBND || type == BNDL) {
|
||||
intra = type == KBND;
|
||||
@@ -718,12 +723,12 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
if (!s->frame2->data[0] || !s->frame1->data[0])
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
copy_plane(avctx, s->frame2, s->frame);
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
|
||||
memcpy(s->frame->data[1], s->frame2->data[1], 1024);
|
||||
|
||||
+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;
|
||||
|
||||
@@ -198,6 +198,12 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
|
||||
/* If necessary, uncompress tiles, and hijack the bytestream reader */
|
||||
if (packed_tiles_size != tiles_nb * TILE_SIZE) {
|
||||
uLongf length = tiles_nb * TILE_SIZE;
|
||||
|
||||
if (bytestream2_get_bytes_left(gbc) < packed_tiles_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
|
||||
inflated_tiles = av_malloc(length);
|
||||
if (!inflated_tiles) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
|
||||
+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
@@ -512,7 +512,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;
|
||||
|
||||
if (bytestream2_get_byte(gb) == 0)
|
||||
|
||||
@@ -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];
|
||||
|
||||
+7
-4
@@ -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);
|
||||
@@ -1304,6 +1304,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
planes = s->planar ? s->bppcount : 1;
|
||||
for (plane = 0; plane < planes; plane++) {
|
||||
int remaining = avpkt->size;
|
||||
int decoded_height;
|
||||
stride = p->linesize[plane];
|
||||
dst = p->data[plane];
|
||||
for (i = 0; i < s->height; i += s->rps) {
|
||||
@@ -1331,6 +1332,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
break;
|
||||
}
|
||||
}
|
||||
decoded_height = FFMIN(i, s->height);
|
||||
|
||||
if (s->predictor == 2) {
|
||||
if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "predictor == 2 with YUV is unsupported");
|
||||
@@ -1347,7 +1350,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
s->avctx->pix_fmt == AV_PIX_FMT_YA16LE ||
|
||||
s->avctx->pix_fmt == AV_PIX_FMT_GBRP16LE ||
|
||||
s->avctx->pix_fmt == AV_PIX_FMT_GBRAP16LE) {
|
||||
for (i = 0; i < s->height; i++) {
|
||||
for (i = 0; i < decoded_height; i++) {
|
||||
for (j = soff; j < ssize; j += 2)
|
||||
AV_WL16(dst + j, AV_RL16(dst + j) + AV_RL16(dst + j - soff));
|
||||
dst += stride;
|
||||
@@ -1358,13 +1361,13 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
s->avctx->pix_fmt == AV_PIX_FMT_YA16BE ||
|
||||
s->avctx->pix_fmt == AV_PIX_FMT_GBRP16BE ||
|
||||
s->avctx->pix_fmt == AV_PIX_FMT_GBRAP16BE) {
|
||||
for (i = 0; i < s->height; i++) {
|
||||
for (i = 0; i < decoded_height; i++) {
|
||||
for (j = soff; j < ssize; j += 2)
|
||||
AV_WB16(dst + j, AV_RB16(dst + j) + AV_RB16(dst + j - soff));
|
||||
dst += stride;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < s->height; i++) {
|
||||
for (i = 0; i < decoded_height; i++) {
|
||||
for (j = soff; j < ssize; j++)
|
||||
dst[j] += dst[j - soff];
|
||||
dst += stride;
|
||||
|
||||
@@ -484,7 +484,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;
|
||||
@@ -494,8 +494,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;
|
||||
@@ -591,7 +591,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.
|
||||
|
||||
@@ -181,6 +181,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
@@ -525,9 +525,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");
|
||||
@@ -553,6 +550,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;
|
||||
|
||||
@@ -245,8 +245,8 @@ static const AVOption afade_options[] = {
|
||||
{ "ns", "set number of samples for fade duration", OFFSET(nb_samples), AV_OPT_TYPE_INT64, {.i64 = 44100}, 1, INT64_MAX, FLAGS },
|
||||
{ "start_time", "set time to start fading", OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "st", "set time to start fading", OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "duration", "set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
|
||||
{ "d", "set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
|
||||
{ "duration", "set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "d", "set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "curve", "set fade curve type", OFFSET(curve), AV_OPT_TYPE_INT, {.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" },
|
||||
{ "c", "set fade curve type", OFFSET(curve), AV_OPT_TYPE_INT, {.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" },
|
||||
{ "tri", "linear slope", 0, AV_OPT_TYPE_CONST, {.i64 = TRI }, 0, 0, FLAGS, "curve" },
|
||||
|
||||
@@ -76,6 +76,13 @@ static int activate(AVFilterContext *ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
ret = av_frame_copy_props(pad_frame, frame);
|
||||
if (ret < 0) {
|
||||
av_frame_free(&pad_frame);
|
||||
av_frame_free(&frame);
|
||||
return ret;
|
||||
}
|
||||
|
||||
av_samples_copy(pad_frame->extended_data, frame->extended_data,
|
||||
0, 0, frame->nb_samples, frame->channels, frame->format);
|
||||
av_samples_set_silence(pad_frame->extended_data, frame->nb_samples,
|
||||
|
||||
@@ -386,13 +386,13 @@ static const AVOption fade_options[] = {
|
||||
OFFSET(nb_frames), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, FLAGS },
|
||||
{ "alpha", "fade alpha if it is available on the input", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FLAGS },
|
||||
{ "start_time", "Number of seconds of the beginning of the effect.",
|
||||
OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
|
||||
OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "st", "Number of seconds of the beginning of the effect.",
|
||||
OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
|
||||
OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "duration", "Duration of the effect in seconds.",
|
||||
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
|
||||
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "d", "Duration of the effect in seconds.",
|
||||
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
|
||||
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
|
||||
{ "color", "set color", OFFSET(color_rgba), AV_OPT_TYPE_COLOR, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
|
||||
{ "c", "set color", OFFSET(color_rgba), AV_OPT_TYPE_COLOR, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
|
||||
{ NULL }
|
||||
|
||||
+13
-13
@@ -380,15 +380,15 @@ static av_always_inline void blend_slice_packed_rgb(AVFilterContext *ctx,
|
||||
uint8_t *S, *sp, *d, *dp;
|
||||
|
||||
i = FFMAX(-y, 0);
|
||||
imax = FFMIN(-y + dst_h, src_h);
|
||||
imax = FFMIN3(-y + dst_h, FFMIN(src_h, dst_h), y + src_h);
|
||||
|
||||
slice_start = (imax * jobnr) / nb_jobs;
|
||||
slice_end = (imax * (jobnr+1)) / nb_jobs;
|
||||
slice_start = i + (imax * jobnr) / nb_jobs;
|
||||
slice_end = i + (imax * (jobnr+1)) / nb_jobs;
|
||||
|
||||
sp = src->data[0] + (i + slice_start) * src->linesize[0];
|
||||
dp = dst->data[0] + (y + i + slice_start) * dst->linesize[0];
|
||||
sp = src->data[0] + (slice_start) * src->linesize[0];
|
||||
dp = dst->data[0] + (y + slice_start) * dst->linesize[0];
|
||||
|
||||
for (i = i + slice_start; i < slice_end; i++) {
|
||||
for (i = slice_start; i < slice_end; i++) {
|
||||
j = FFMAX(-x, 0);
|
||||
S = sp + j * sstep;
|
||||
d = dp + (x+j) * dstep;
|
||||
@@ -468,19 +468,19 @@ static av_always_inline void blend_plane(AVFilterContext *ctx,
|
||||
int slice_start, slice_end;
|
||||
|
||||
j = FFMAX(-yp, 0);
|
||||
jmax = FFMIN(-yp + dst_hp, src_hp);
|
||||
jmax = FFMIN3(-yp + dst_hp, FFMIN(src_hp, dst_hp), yp + src_hp);
|
||||
|
||||
slice_start = (jmax * jobnr) / nb_jobs;
|
||||
slice_end = (jmax * (jobnr+1)) / nb_jobs;
|
||||
slice_start = j + (jmax * jobnr) / nb_jobs;
|
||||
slice_end = j + (jmax * (jobnr+1)) / nb_jobs;
|
||||
|
||||
sp = src->data[i] + slice_start * src->linesize[i];
|
||||
sp = src->data[i] + (slice_start) * src->linesize[i];
|
||||
dp = dst->data[dst_plane]
|
||||
+ (yp + slice_start) * dst->linesize[dst_plane]
|
||||
+ dst_offset;
|
||||
ap = src->data[3] + (slice_start << vsub) * src->linesize[3];
|
||||
dap = dst->data[3] + ((yp + slice_start) << vsub) * dst->linesize[3];
|
||||
|
||||
for (j = j + slice_start; j < slice_end; j++) {
|
||||
for (j = slice_start; j < slice_end; j++) {
|
||||
k = FFMAX(-xp, 0);
|
||||
d = dp + (xp+k) * dst_step;
|
||||
s = sp + k;
|
||||
@@ -961,13 +961,13 @@ static int do_blend(FFFrameSync *fs)
|
||||
s->var_values[VAR_Y], s->y);
|
||||
}
|
||||
|
||||
if (s->x < mainpic->width && s->x + second->width >= 0 ||
|
||||
if (s->x < mainpic->width && s->x + second->width >= 0 &&
|
||||
s->y < mainpic->height && s->y + second->height >= 0) {
|
||||
ThreadData td;
|
||||
|
||||
td.dst = mainpic;
|
||||
td.src = second;
|
||||
ctx->internal->execute(ctx, s->blend_slice, &td, NULL, FFMIN(FFMIN(mainpic->height - s->y, second->height),
|
||||
ctx->internal->execute(ctx, s->blend_slice, &td, NULL, FFMIN(FFMAX(1, FFMIN3(s->y + second->height, FFMIN(second->height, mainpic->height), mainpic->height - s->y)),
|
||||
ff_filter_get_nb_threads(ctx)));
|
||||
}
|
||||
return ff_filter_frame(ctx->outputs[0], mainpic);
|
||||
|
||||
@@ -98,12 +98,12 @@ static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = {
|
||||
[AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 },
|
||||
};
|
||||
|
||||
static struct PrimaryCoefficients primaries_table[AVCOL_PRI_NB] = {
|
||||
static const struct PrimaryCoefficients primaries_table[AVCOL_PRI_NB] = {
|
||||
[AVCOL_PRI_BT709] = { 0.640, 0.330, 0.300, 0.600, 0.150, 0.060 },
|
||||
[AVCOL_PRI_BT2020] = { 0.708, 0.292, 0.170, 0.797, 0.131, 0.046 },
|
||||
};
|
||||
|
||||
static struct WhitepointCoefficients whitepoint_table[AVCOL_PRI_NB] = {
|
||||
static const struct WhitepointCoefficients whitepoint_table[AVCOL_PRI_NB] = {
|
||||
[AVCOL_PRI_BT709] = { 0.3127, 0.3290 },
|
||||
[AVCOL_PRI_BT2020] = { 0.3127, 0.3290 },
|
||||
};
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ static int ring_size_of_read_back(RingBuffer *ring)
|
||||
static int ring_drain(RingBuffer *ring, int offset)
|
||||
{
|
||||
av_assert2(offset >= -ring_size_of_read_back(ring));
|
||||
av_assert2(offset <= -ring_size(ring));
|
||||
av_assert2(offset <= ring_size(ring));
|
||||
ring->read_pos += offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,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;
|
||||
|
||||
@@ -3541,7 +3541,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,
|
||||
|
||||
+50
-17
@@ -1270,7 +1270,7 @@ static int64_t get_frag_time(MOVFragmentIndex *frag_index,
|
||||
static int search_frag_timestamp(MOVFragmentIndex *frag_index,
|
||||
AVStream *st, int64_t timestamp)
|
||||
{
|
||||
int a, b, m;
|
||||
int a, b, m, m0;
|
||||
int64_t frag_time;
|
||||
int id = -1;
|
||||
|
||||
@@ -1286,15 +1286,18 @@ static int search_frag_timestamp(MOVFragmentIndex *frag_index,
|
||||
b = frag_index->nb_items;
|
||||
|
||||
while (b - a > 1) {
|
||||
m = (a + b) >> 1;
|
||||
frag_time = get_frag_time(frag_index, m, id);
|
||||
if (frag_time != AV_NOPTS_VALUE) {
|
||||
if (frag_time >= timestamp)
|
||||
b = m;
|
||||
if (frag_time <= timestamp)
|
||||
a = m;
|
||||
}
|
||||
m0 = m = (a + b) >> 1;
|
||||
|
||||
while (m < b &&
|
||||
(frag_time = get_frag_time(frag_index, m, id)) == AV_NOPTS_VALUE)
|
||||
m++;
|
||||
|
||||
if (m < b && frag_time <= timestamp)
|
||||
a = m;
|
||||
else
|
||||
b = m0;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -1326,6 +1329,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;
|
||||
@@ -1366,6 +1373,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) {
|
||||
@@ -2689,8 +2699,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;
|
||||
}
|
||||
@@ -4154,7 +4167,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);
|
||||
|
||||
@@ -4168,6 +4181,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))) ||
|
||||
@@ -4176,7 +4196,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;
|
||||
@@ -4438,6 +4458,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;
|
||||
@@ -4540,6 +4565,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);
|
||||
|
||||
@@ -4675,6 +4702,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];
|
||||
@@ -4704,6 +4736,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);
|
||||
@@ -4748,7 +4781,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");
|
||||
}
|
||||
@@ -5017,7 +5050,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) {
|
||||
@@ -6546,14 +6579,14 @@ static int cenc_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *s
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cenc_filter(MOVContext *mov, MOVStreamContext *sc, AVPacket *pkt, int current_index)
|
||||
static int cenc_filter(MOVContext *mov, AVStream* st, MOVStreamContext *sc, AVPacket *pkt, int current_index)
|
||||
{
|
||||
MOVFragmentStreamInfo *frag_stream_info;
|
||||
MOVEncryptionIndex *encryption_index;
|
||||
AVEncryptionInfo *encrypted_sample;
|
||||
int encrypted_index, ret;
|
||||
|
||||
frag_stream_info = get_current_frag_stream_info(&mov->frag_index);
|
||||
frag_stream_info = get_frag_stream_info(&mov->frag_index, mov->frag_index.current, st->id);
|
||||
encrypted_index = current_index;
|
||||
encryption_index = NULL;
|
||||
if (frag_stream_info) {
|
||||
@@ -7783,7 +7816,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (mov->aax_mode)
|
||||
aax_filter(pkt->data, pkt->size, mov);
|
||||
|
||||
ret = cenc_filter(mov, sc, pkt, current_index);
|
||||
ret = cenc_filter(mov, st, sc, pkt, current_index);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -541,11 +541,10 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
info = track->eac3_priv;
|
||||
size = 2 + 4 * (info->num_ind_sub + 1);
|
||||
size = 2 + ((34 * (info->num_ind_sub + 1) + 7) >> 3);
|
||||
buf = av_malloc(size);
|
||||
if (!buf) {
|
||||
size = AVERROR(ENOMEM);
|
||||
goto end;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
init_put_bits(&pbc, buf, size);
|
||||
@@ -563,12 +562,12 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
|
||||
put_bits(&pbc, 4, info->substream[i].num_dep_sub);
|
||||
if (!info->substream[i].num_dep_sub) {
|
||||
put_bits(&pbc, 1, 0); /* reserved */
|
||||
size--;
|
||||
} else {
|
||||
put_bits(&pbc, 9, info->substream[i].chan_loc);
|
||||
}
|
||||
}
|
||||
flush_put_bits(&pbc);
|
||||
size = put_bits_count(&pbc) >> 3;
|
||||
|
||||
avio_wb32(pb, size + 8);
|
||||
ffio_wfourcc(pb, "dec3");
|
||||
@@ -576,10 +575,6 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
|
||||
|
||||
av_free(buf);
|
||||
|
||||
end:
|
||||
av_packet_unref(&info->pkt);
|
||||
av_freep(&track->eac3_priv);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -5947,6 +5942,11 @@ static void mov_free(AVFormatContext *s)
|
||||
av_freep(&mov->tracks[i].frag_info);
|
||||
av_packet_unref(&mov->tracks[i].cover_image);
|
||||
|
||||
if (mov->tracks[i].eac3_priv) {
|
||||
struct eac3_info *info = mov->tracks[i].eac3_priv;
|
||||
av_packet_unref(&info->pkt);
|
||||
av_freep(&mov->tracks[i].eac3_priv);
|
||||
}
|
||||
if (mov->tracks[i].vos_len)
|
||||
av_freep(&mov->tracks[i].vos_data);
|
||||
|
||||
|
||||
@@ -918,7 +918,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;
|
||||
|
||||
@@ -782,7 +782,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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
39aef1afff761d673fd1be07182941d1 *tests/data/fate/copy-trac3074.mp4
|
||||
333991 tests/data/fate/copy-trac3074.mp4
|
||||
f92a201033712bda262f1e071e25544a *tests/data/fate/copy-trac3074.mp4
|
||||
333992 tests/data/fate/copy-trac3074.mp4
|
||||
#tb 0: 1/48000
|
||||
#media_type 0: audio
|
||||
#codec_id 0: eac3
|
||||
|
||||
Reference in New Issue
Block a user