Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c2ea706282 | |||
| 622ccbd8ab | |||
| c8c5f66b42 | |||
| bc6174d4af | |||
| 2303cea5be | |||
| d0590d9349 | |||
| e60a00e0cc | |||
| e6351504dc | |||
| 8834e080c2 | |||
| 39dc26f0c1 | |||
| 496267f8e9 | |||
| 9d738e6968 | |||
| 77c9c35093 | |||
| 03f996d183 | |||
| c68ce48260 | |||
| ac8ac46641 | |||
| c2087fc48b | |||
| 21a9797737 | |||
| 65c10f0f5c | |||
| ed1c6f701a | |||
| 7a3dc2f7b6 | |||
| e91b7852df | |||
| 5aaf7e3182 | |||
| ed38046c5c | |||
| ba642f0319 | |||
| 8b21b44e7e | |||
| 748a4747da | |||
| 6fc29572fb | |||
| 677ea4a49b | |||
| 12320c0822 | |||
| c46d22a4a5 | |||
| 40ab55746e | |||
| 949094a4cd | |||
| 79f52a0dbd | |||
| ae89381962 | |||
| 596513ca2c | |||
| 2f07937926 | |||
| 4943abe051 | |||
| 8c4a67183b | |||
| 049d767715 | |||
| 8003a5d237 | |||
| ec30a498e6 | |||
| fabc1c9e56 | |||
| 0ad4d4198a | |||
| 93422bc92e | |||
| 22a0c0e764 | |||
| 77f978996b | |||
| 4770eac663 | |||
| afd57722e1 | |||
| 7d42daeea2 | |||
| 055e5c80ee | |||
| 905372be8f | |||
| f4b8892ccb |
@@ -3,6 +3,56 @@ releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
version 3.1.4:
|
||||
- avformat/avidec: Check nb_streams in read_gab2_sub()
|
||||
- avformat/avidec: Remove ancient assert
|
||||
- avfilter/vf_colorspace: fix range for output colorspace option
|
||||
- lavc/mediacodecdec_h264: fix SODB escaping
|
||||
- avcodec/nvenc: fix const options for hevc gpu setting
|
||||
- avformat/avidec: Fix memleak with dv in avi
|
||||
- lavc/movtextdec.c: Avoid infinite loop on invalid data.
|
||||
- avcodec/ansi: Check dimensions
|
||||
- avcodec/cavsdsp: use av_clip_uint8() for idct
|
||||
- avformat/movenc: Check packet in mov_write_single_packet() too
|
||||
- avformat/movenc: Factor check_pkt() out
|
||||
- avformat/utils: fix timebase error in avformat_seek_file()
|
||||
- avcodec/g726: Add missing ADDB output mask
|
||||
- avcodec/avpacket: clear side_data_elems
|
||||
- avformat/movenc: Check first DTS similar to dts difference
|
||||
- avcodec/ccaption_dec: Use simple array instead of AVBuffer
|
||||
- avcodec/svq3: Reintroduce slice_type
|
||||
- avformat/mov: Fix potential integer overflow in mov_read_keys
|
||||
- swscale/swscale_unscaled: Try to fix Rgb16ToPlanarRgb16Wrapper() with slices
|
||||
- swscale/swscale_unscaled: Fix packed_16bpc_bswap() with slices
|
||||
- avformat/avidec: Fix infinite loop in avi_read_nikon()
|
||||
- lavf/utils: Avoid an overflow for huge negative durations.
|
||||
- avformat/hls: Fix handling of EXT-X-BYTERANGE streams over 2GB
|
||||
- lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().
|
||||
- lavc/mjpegdec: Do not skip reading quantization tables.
|
||||
- cmdutils: fix implicit declaration of SetDllDirectory function
|
||||
|
||||
version 3.1.3:
|
||||
- examples/demuxing_decoding: convert to codecpar
|
||||
- avcodec/exr: Check tile positions
|
||||
- avcodec/aacenc: Tighter input checks
|
||||
- avformat/wtvdec: Check pointer before use
|
||||
- libavcodec/wmalosslessdec: Check the remaining bits
|
||||
- avcodec/adpcm: Fix adpcm_ima_wav padding
|
||||
- avcodec/svq3: fix slice size check
|
||||
- avcodec/diracdec: Check numx/y
|
||||
- avcodec/h2645_parse: fix nal size
|
||||
- avcodec/h2645_parse: Use get_nalsize() in ff_h2645_packet_split()
|
||||
- h2645_parse: only read avc length code at the correct position
|
||||
- h2645_parse: don't overread AnnexB NALs within an avc stream
|
||||
- avcodec/h264_parser: Factor get_avc_nalsize() out
|
||||
- avcodec/cfhd: Increase minimum band dimension to 3
|
||||
- avcodec/indeo2: check ctab
|
||||
- avformat/swfdec: Fix inflate() error code check
|
||||
- avcodec/rawdec: Fix bits_per_coded_sample checks
|
||||
- vcodec/h2645_parse: Clear buffer padding
|
||||
- avcodec/h2645: Fix NAL unit padding
|
||||
- avfilter/drawutils: Fix single plane with alpha
|
||||
- cmdutils: check for SetDllDirectory() availability
|
||||
|
||||
version 3.1.2:
|
||||
- cmdutils: remove the current working directory from the DLL search path on win32
|
||||
|
||||
+4
-1
@@ -61,6 +61,9 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#if HAVE_SETDLLDIRECTORY
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static int init_report(const char *env);
|
||||
|
||||
@@ -109,7 +112,7 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v
|
||||
|
||||
void init_dynload(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if HAVE_SETDLLDIRECTORY
|
||||
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
|
||||
* current working directory from the DLL search path as a security pre-caution. */
|
||||
SetDllDirectory("");
|
||||
|
||||
@@ -1935,6 +1935,7 @@ SYSTEM_FUNCS="
|
||||
sched_getaffinity
|
||||
SetConsoleTextAttribute
|
||||
SetConsoleCtrlHandler
|
||||
SetDllDirectory
|
||||
setmode
|
||||
setrlimit
|
||||
Sleep
|
||||
@@ -5475,6 +5476,7 @@ check_func_headers windows.h MapViewOfFile
|
||||
check_func_headers windows.h PeekNamedPipe
|
||||
check_func_headers windows.h SetConsoleTextAttribute
|
||||
check_func_headers windows.h SetConsoleCtrlHandler
|
||||
check_func_headers windows.h SetDllDirectory
|
||||
check_func_headers windows.h Sleep
|
||||
check_func_headers windows.h VirtualAlloc
|
||||
check_struct windows.h "CONDITION_VARIABLE" Ptr
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 3.1.2
|
||||
PROJECT_NUMBER = 3.1.4
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
||||
@@ -148,11 +148,10 @@ static int decode_packet(int *got_frame, int cached)
|
||||
}
|
||||
|
||||
static int open_codec_context(int *stream_idx,
|
||||
AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||
AVCodecContext **dec_ctx, AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||
{
|
||||
int ret, stream_index;
|
||||
AVStream *st;
|
||||
AVCodecContext *dec_ctx = NULL;
|
||||
AVCodec *dec = NULL;
|
||||
AVDictionary *opts = NULL;
|
||||
|
||||
@@ -166,17 +165,31 @@ static int open_codec_context(int *stream_idx,
|
||||
st = fmt_ctx->streams[stream_index];
|
||||
|
||||
/* find decoder for the stream */
|
||||
dec_ctx = st->codec;
|
||||
dec = avcodec_find_decoder(dec_ctx->codec_id);
|
||||
dec = avcodec_find_decoder(st->codecpar->codec_id);
|
||||
if (!dec) {
|
||||
fprintf(stderr, "Failed to find %s codec\n",
|
||||
av_get_media_type_string(type));
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
/* Allocate a codec context for the decoder */
|
||||
*dec_ctx = avcodec_alloc_context3(dec);
|
||||
if (!*dec_ctx) {
|
||||
fprintf(stderr, "Failed to allocate the %s codec context\n",
|
||||
av_get_media_type_string(type));
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
/* Copy codec parameters from input stream to output codec context */
|
||||
if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) < 0) {
|
||||
fprintf(stderr, "Failed to copy %s codec parameters to decoder context\n",
|
||||
av_get_media_type_string(type));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Init the decoders, with or without reference counting */
|
||||
av_dict_set(&opts, "refcounted_frames", refcount ? "1" : "0", 0);
|
||||
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
|
||||
if ((ret = avcodec_open2(*dec_ctx, dec, &opts)) < 0) {
|
||||
fprintf(stderr, "Failed to open %s codec\n",
|
||||
av_get_media_type_string(type));
|
||||
return ret;
|
||||
@@ -255,9 +268,8 @@ int main (int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (open_codec_context(&video_stream_idx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
||||
if (open_codec_context(&video_stream_idx, &video_dec_ctx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
||||
video_stream = fmt_ctx->streams[video_stream_idx];
|
||||
video_dec_ctx = video_stream->codec;
|
||||
|
||||
video_dst_file = fopen(video_dst_filename, "wb");
|
||||
if (!video_dst_file) {
|
||||
@@ -279,9 +291,8 @@ int main (int argc, char **argv)
|
||||
video_dst_bufsize = ret;
|
||||
}
|
||||
|
||||
if (open_codec_context(&audio_stream_idx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
||||
if (open_codec_context(&audio_stream_idx, &audio_dec_ctx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
||||
audio_stream = fmt_ctx->streams[audio_stream_idx];
|
||||
audio_dec_ctx = audio_stream->codec;
|
||||
audio_dst_file = fopen(audio_dst_filename, "wb");
|
||||
if (!audio_dst_file) {
|
||||
fprintf(stderr, "Could not open destination file %s\n", audio_dst_filename);
|
||||
@@ -369,8 +380,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
end:
|
||||
avcodec_close(video_dec_ctx);
|
||||
avcodec_close(audio_dec_ctx);
|
||||
avcodec_free_context(&video_dec_ctx);
|
||||
avcodec_free_context(&audio_dec_ctx);
|
||||
avformat_close_input(&fmt_ctx);
|
||||
if (video_dst_file)
|
||||
fclose(video_dst_file);
|
||||
|
||||
+2
-2
@@ -622,8 +622,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
|
||||
for (k = 0; k < 1024; k++) {
|
||||
if (!isfinite(cpe->ch[ch].coeffs[k])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
|
||||
if (!(fabs(cpe->ch[ch].coeffs[k]) < 1E16)) { // Ensure headroom for energy calculation
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains (near) NaN/+-Inf\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -803,7 +803,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (avctx->bits_per_coded_sample != 4) {
|
||||
int samples_per_block = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
|
||||
int block_size = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2];
|
||||
uint8_t temp[20] = { 0 };
|
||||
uint8_t temp[20 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
|
||||
GetBitContext g;
|
||||
|
||||
for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) {
|
||||
|
||||
@@ -94,6 +94,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (avctx->width % FONT_WIDTH || avctx->height % s->font_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,8 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
||||
pkt->buf = av_buffer_alloc(new_size);
|
||||
if (!pkt->buf)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(pkt->buf->data, pkt->data, pkt->size);
|
||||
if (pkt->size > 0)
|
||||
memcpy(pkt->buf->data, pkt->data, pkt->size);
|
||||
pkt->data = pkt->buf->data;
|
||||
}
|
||||
pkt->size += grow_by;
|
||||
@@ -198,6 +199,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
|
||||
{
|
||||
pkt->data = NULL;
|
||||
pkt->side_data = NULL;
|
||||
pkt->side_data_elems = 0;
|
||||
if (pkt->buf) {
|
||||
AVBufferRef *ref = av_buffer_ref(src->buf);
|
||||
if (!ref)
|
||||
@@ -207,9 +209,11 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
|
||||
} else {
|
||||
DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF);
|
||||
}
|
||||
if (pkt->side_data_elems && dup)
|
||||
if (src->side_data_elems && dup) {
|
||||
pkt->side_data = src->side_data;
|
||||
if (pkt->side_data_elems && !dup) {
|
||||
pkt->side_data_elems = src->side_data_elems;
|
||||
}
|
||||
if (src->side_data_elems && !dup) {
|
||||
return av_copy_packet_side_data(pkt, src);
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -188,7 +188,6 @@ static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc
|
||||
static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
|
||||
int i;
|
||||
int16_t (*src)[8] = (int16_t(*)[8])block;
|
||||
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
|
||||
|
||||
src[0][0] += 8;
|
||||
|
||||
@@ -243,14 +242,14 @@ static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
|
||||
const int b2 = a5 - a7;
|
||||
const int b3 = a4 - a6;
|
||||
|
||||
dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b4) >> 7)];
|
||||
dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b1 + b5) >> 7)];
|
||||
dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b2 + b6) >> 7)];
|
||||
dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b3 + b7) >> 7)];
|
||||
dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b3 - b7) >> 7)];
|
||||
dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b2 - b6) >> 7)];
|
||||
dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b1 - b5) >> 7)];
|
||||
dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b4) >> 7)];
|
||||
dst[i + 0*stride] = av_clip_uint8( dst[i + 0*stride] + ((b0 + b4) >> 7));
|
||||
dst[i + 1*stride] = av_clip_uint8( dst[i + 1*stride] + ((b1 + b5) >> 7));
|
||||
dst[i + 2*stride] = av_clip_uint8( dst[i + 2*stride] + ((b2 + b6) >> 7));
|
||||
dst[i + 3*stride] = av_clip_uint8( dst[i + 3*stride] + ((b3 + b7) >> 7));
|
||||
dst[i + 4*stride] = av_clip_uint8( dst[i + 4*stride] + ((b3 - b7) >> 7));
|
||||
dst[i + 5*stride] = av_clip_uint8( dst[i + 5*stride] + ((b2 - b6) >> 7));
|
||||
dst[i + 6*stride] = av_clip_uint8( dst[i + 6*stride] + ((b1 - b5) >> 7));
|
||||
dst[i + 7*stride] = av_clip_uint8( dst[i + 7*stride] + ((b0 - b4) >> 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-16
@@ -247,7 +247,8 @@ typedef struct CCaptionSubContext {
|
||||
int64_t last_real_time;
|
||||
char prev_cmd[2];
|
||||
/* buffer to store pkt data */
|
||||
AVBufferRef *pktbuf;
|
||||
uint8_t *pktbuf;
|
||||
int pktbuf_size;
|
||||
int readorder;
|
||||
} CCaptionSubContext;
|
||||
|
||||
@@ -273,11 +274,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
/* allocate pkt buffer */
|
||||
ctx->pktbuf = av_buffer_alloc(128);
|
||||
if (!ctx->pktbuf) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -285,7 +282,8 @@ static av_cold int close_decoder(AVCodecContext *avctx)
|
||||
{
|
||||
CCaptionSubContext *ctx = avctx->priv_data;
|
||||
av_bprint_finalize(&ctx->buffer, NULL);
|
||||
av_buffer_unref(&ctx->pktbuf);
|
||||
av_freep(&ctx->pktbuf);
|
||||
ctx->pktbuf_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -729,16 +727,13 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (ctx->pktbuf->size < len) {
|
||||
ret = av_buffer_realloc(&ctx->pktbuf, len);
|
||||
if (ret < 0) {
|
||||
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf->size);
|
||||
len = ctx->pktbuf->size;
|
||||
ret = 0;
|
||||
}
|
||||
av_fast_padded_malloc(&ctx->pktbuf, &ctx->pktbuf_size, len);
|
||||
if (!ctx->pktbuf) {
|
||||
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf_size);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(ctx->pktbuf->data, avpkt->data, len);
|
||||
bptr = ctx->pktbuf->data;
|
||||
memcpy(ctx->pktbuf, avpkt->data, len);
|
||||
bptr = ctx->pktbuf;
|
||||
|
||||
for (i = 0; i < len; i += 3) {
|
||||
uint8_t cc_type = *(bptr + i) & 3;
|
||||
|
||||
+6
-6
@@ -320,7 +320,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->plane[s->channel_num].band[0][0].width = data;
|
||||
s->plane[s->channel_num].band[0][0].stride = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Lowpass width %"PRIu16"\n", data);
|
||||
if (data < 2 || data > s->plane[s->channel_num].band[0][0].a_width) {
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].a_width) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid lowpass width\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -328,7 +328,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
} else if (tag == 28) {
|
||||
s->plane[s->channel_num].band[0][0].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Lowpass height %"PRIu16"\n", data);
|
||||
if (data < 2 || data > s->plane[s->channel_num].band[0][0].height) {
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid lowpass height\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -366,7 +366,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass width %i channel %i level %i subband %i\n", data, s->channel_num, s->level, s->subband_num);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass width\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -374,7 +374,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
} else if (tag == 42) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass height %i\n", data);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass height\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -383,7 +383,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass width2 %i\n", data);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass width2\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -391,7 +391,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
} else if (tag == 50) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass height2 %i\n", data);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass height2\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
|
||||
@@ -1153,6 +1153,11 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
||||
else {
|
||||
s->num_x = get_interleaved_ue_golomb(gb);
|
||||
s->num_y = get_interleaved_ue_golomb(gb);
|
||||
if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX) {
|
||||
av_log(s->avctx,AV_LOG_ERROR,"Invalid numx/y\n");
|
||||
s->num_x = s->num_y = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->ld_picture) {
|
||||
s->lowdelay.bytes.num = get_interleaved_ue_golomb(gb);
|
||||
s->lowdelay.bytes.den = get_interleaved_ue_golomb(gb);
|
||||
|
||||
+12
-2
@@ -1027,8 +1027,9 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
uint64_t line_offset, uncompressed_size;
|
||||
uint16_t *ptr_x;
|
||||
uint8_t *ptr;
|
||||
uint32_t data_size, line, col = 0;
|
||||
uint32_t tileX, tileY, tileLevelX, tileLevelY;
|
||||
uint32_t data_size;
|
||||
uint64_t line, col = 0;
|
||||
uint64_t tileX, tileY, tileLevelX, tileLevelY;
|
||||
const uint8_t *src;
|
||||
int axmax = (avctx->width - (s->xmax + 1)) * 2 * s->desc->nb_components; /* nb pixel to add at the right of the datawindow */
|
||||
int bxmin = s->xmin * 2 * s->desc->nb_components; /* nb pixel to add at the left of the datawindow */
|
||||
@@ -1059,9 +1060,18 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (s->xmin || s->ymin) {
|
||||
avpriv_report_missing_feature(s->avctx, "Tiles with xmin/ymin");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
line = s->tile_attr.ySize * tileY;
|
||||
col = s->tile_attr.xSize * tileX;
|
||||
|
||||
if (line < s->ymin || line > s->ymax ||
|
||||
col < s->xmin || col > s->xmax)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
td->ysize = FFMIN(s->tile_attr.ySize, s->ydelta - tileY * s->tile_attr.ySize);
|
||||
td->xsize = FFMIN(s->tile_attr.xSize, s->xdelta - tileX * s->tile_attr.xSize);
|
||||
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ static int16_t g726_decode(G726Context* c, int I)
|
||||
|
||||
if (I_sig) /* get the sign */
|
||||
dq = -dq;
|
||||
re_signal = c->se + dq;
|
||||
re_signal = (int16_t)(c->se + dq);
|
||||
|
||||
/* Update second order predictor coefficient A2 and A1 */
|
||||
pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;
|
||||
|
||||
+1
-1
@@ -898,7 +898,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
|
||||
}
|
||||
|
||||
ret = ff_h2645_packet_split(&h->pkt, buf, buf_size, avctx, h->is_avc,
|
||||
h->nal_length_size, avctx->codec_id);
|
||||
h->nal_length_size, avctx->codec_id, avctx->flags2 & AV_CODEC_FLAG2_FAST);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error splitting the input into NAL units.\n");
|
||||
|
||||
@@ -57,8 +57,6 @@
|
||||
|
||||
#define MAX_DELAYED_PIC_COUNT 16
|
||||
|
||||
#define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
|
||||
|
||||
/* Compiling in interlaced support reduces the speed
|
||||
* of progressive decoding by about 2%. */
|
||||
#define ALLOW_INTERLACE
|
||||
|
||||
+20
-16
@@ -30,10 +30,11 @@
|
||||
#include "h2645_parse.h"
|
||||
|
||||
int ff_h2645_extract_rbsp(const uint8_t *src, int length,
|
||||
H2645NAL *nal)
|
||||
H2645NAL *nal, int small_padding)
|
||||
{
|
||||
int i, si, di;
|
||||
uint8_t *dst;
|
||||
int64_t padding = small_padding ? 0 : MAX_MBPAIR_SIZE;
|
||||
|
||||
nal->skipped_bytes = 0;
|
||||
#define STARTCODE_TEST \
|
||||
@@ -81,16 +82,17 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length,
|
||||
}
|
||||
#endif /* HAVE_FAST_UNALIGNED */
|
||||
|
||||
if (i >= length - 1) { // no escaped 0
|
||||
if (i >= length - 1 && small_padding) { // no escaped 0
|
||||
nal->data =
|
||||
nal->raw_data = src;
|
||||
nal->size =
|
||||
nal->raw_size = length;
|
||||
return length;
|
||||
}
|
||||
} else if (i > length)
|
||||
i = length;
|
||||
|
||||
av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,
|
||||
length + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
av_fast_padded_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,
|
||||
length + padding);
|
||||
if (!nal->rbsp_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -247,7 +249,7 @@ static int h264_parse_nal_header(H2645NAL *nal, void *logctx)
|
||||
|
||||
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
void *logctx, int is_nalff, int nal_length_size,
|
||||
enum AVCodecID codec_id)
|
||||
enum AVCodecID codec_id, int small_padding)
|
||||
{
|
||||
int consumed, ret = 0;
|
||||
const uint8_t *next_avc = is_nalff ? buf : buf + length;
|
||||
@@ -258,19 +260,21 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
int extract_length = 0;
|
||||
int skip_trailing_zeros = 1;
|
||||
|
||||
if (buf >= next_avc) {
|
||||
int i;
|
||||
for (i = 0; i < nal_length_size; i++)
|
||||
extract_length = (extract_length << 8) | buf[i];
|
||||
if (buf == next_avc) {
|
||||
int i = 0;
|
||||
extract_length = get_nalsize(nal_length_size,
|
||||
buf, length, &i, logctx);
|
||||
if (extract_length < 0)
|
||||
return extract_length;
|
||||
|
||||
buf += nal_length_size;
|
||||
length -= nal_length_size;
|
||||
|
||||
if (extract_length > length) {
|
||||
av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit size.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
next_avc = buf + extract_length;
|
||||
} else {
|
||||
if (buf > next_avc)
|
||||
av_log(logctx, AV_LOG_WARNING, "Exceeded next NALFF position, re-syncing.\n");
|
||||
|
||||
/* search start code */
|
||||
while (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
|
||||
++buf;
|
||||
@@ -290,7 +294,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
|
||||
buf += 3;
|
||||
length -= 3;
|
||||
extract_length = length;
|
||||
extract_length = FFMIN(length, next_avc - buf);
|
||||
|
||||
if (buf >= next_avc) {
|
||||
/* skip to the start of the next NAL */
|
||||
@@ -322,7 +326,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
}
|
||||
nal = &pkt->nals[pkt->nb_nals];
|
||||
|
||||
consumed = ff_h2645_extract_rbsp(buf, extract_length, nal);
|
||||
consumed = ff_h2645_extract_rbsp(buf, extract_length, nal, small_padding);
|
||||
if (consumed < 0)
|
||||
return consumed;
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
#define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
|
||||
|
||||
typedef struct H2645NAL {
|
||||
uint8_t *rbsp_buffer;
|
||||
int rbsp_buffer_size;
|
||||
@@ -74,18 +76,38 @@ typedef struct H2645Packet {
|
||||
* Extract the raw (unescaped) bitstream.
|
||||
*/
|
||||
int ff_h2645_extract_rbsp(const uint8_t *src, int length,
|
||||
H2645NAL *nal);
|
||||
H2645NAL *nal, int small_padding);
|
||||
|
||||
/**
|
||||
* Split an input packet into NAL units.
|
||||
*/
|
||||
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
void *logctx, int is_nalff, int nal_length_size,
|
||||
enum AVCodecID codec_id);
|
||||
enum AVCodecID codec_id, int small_padding);
|
||||
|
||||
/**
|
||||
* Free all the allocated memory in the packet.
|
||||
*/
|
||||
void ff_h2645_packet_uninit(H2645Packet *pkt);
|
||||
|
||||
static inline int get_nalsize(int nal_length_size, const uint8_t *buf,
|
||||
int buf_size, int *buf_index, void *logctx)
|
||||
{
|
||||
int i, nalsize = 0;
|
||||
|
||||
if (*buf_index >= buf_size - nal_length_size) {
|
||||
// the end of the buffer is reached, refill it
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
for (i = 0; i < nal_length_size; i++)
|
||||
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
|
||||
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
|
||||
av_log(logctx, AV_LOG_ERROR,
|
||||
"Invalid nal size %d\n", nalsize);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return nalsize;
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_H2645_PARSE_H */
|
||||
|
||||
@@ -327,7 +327,7 @@ static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps,
|
||||
H2645Packet pkt = { 0 };
|
||||
int i, ret = 0;
|
||||
|
||||
ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264);
|
||||
ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264, 1);
|
||||
if (ret < 0) {
|
||||
ret = 0;
|
||||
goto fail;
|
||||
|
||||
@@ -226,26 +226,6 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int get_avc_nalsize(H264ParseContext *p, const uint8_t *buf,
|
||||
int buf_size, int *buf_index, void *logctx)
|
||||
{
|
||||
int i, nalsize = 0;
|
||||
|
||||
if (*buf_index >= buf_size - p->nal_length_size) {
|
||||
// the end of the buffer is reached, refill it
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
for (i = 0; i < p->nal_length_size; i++)
|
||||
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
|
||||
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
|
||||
av_log(logctx, AV_LOG_ERROR,
|
||||
"AVC: nal size %d\n", nalsize);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return nalsize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse NAL units of found picture and decode some basic information.
|
||||
*
|
||||
@@ -286,7 +266,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
int src_length, consumed, nalsize = 0;
|
||||
|
||||
if (buf_index >= next_avc) {
|
||||
nalsize = get_avc_nalsize(p, buf, buf_size, &buf_index, avctx);
|
||||
nalsize = get_nalsize(p->nal_length_size, buf, buf_size, &buf_index, avctx);
|
||||
if (nalsize < 0)
|
||||
break;
|
||||
next_avc = buf_index + nalsize;
|
||||
@@ -316,7 +296,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
}
|
||||
break;
|
||||
}
|
||||
consumed = ff_h2645_extract_rbsp(buf + buf_index, src_length, &nal);
|
||||
consumed = ff_h2645_extract_rbsp(buf + buf_index, src_length, &nal, 1);
|
||||
if (consumed < 0)
|
||||
break;
|
||||
|
||||
|
||||
+1
-1
@@ -2867,7 +2867,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
|
||||
/* split the input packet into NAL units, so we know the upper bound on the
|
||||
* number of slices in the frame */
|
||||
ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff,
|
||||
s->nal_length_size, s->avctx->codec_id);
|
||||
s->nal_length_size, s->avctx->codec_id, 1);
|
||||
if (ret < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Error splitting the input into NAL units.\n");
|
||||
|
||||
@@ -90,7 +90,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
|
||||
int ret, i;
|
||||
|
||||
ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, 0, 0,
|
||||
AV_CODEC_ID_HEVC);
|
||||
AV_CODEC_ID_HEVC, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -243,7 +243,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
|
||||
src_length = 20;
|
||||
}
|
||||
|
||||
consumed = ff_h2645_extract_rbsp(buf, src_length, nal);
|
||||
consumed = ff_h2645_extract_rbsp(buf, src_length, nal, 1);
|
||||
if (consumed < 0)
|
||||
return consumed;
|
||||
|
||||
|
||||
@@ -171,6 +171,12 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
ltab = buf[0x22] & 3;
|
||||
ctab = buf[0x22] >> 2;
|
||||
|
||||
if (ctab > 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "ctab %d is invalid\n", ctab);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->decode_delta) { /* intraframe */
|
||||
if ((ret = ir2_decode_plane(s, avctx->width, avctx->height,
|
||||
p->data[0], p->linesize[0],
|
||||
|
||||
@@ -103,9 +103,9 @@ static int h264_ps_to_nalu(const uint8_t *src, int src_size, uint8_t **out, int
|
||||
}
|
||||
*out = p = new;
|
||||
|
||||
i = i + 3;
|
||||
memmove(p + i, p + i - 1, *out_size - i);
|
||||
p[i - 1] = 0x03;
|
||||
i = i + 2;
|
||||
memmove(p + i + 1, p + i, *out_size - (i + 1));
|
||||
p[i] = 0x03;
|
||||
}
|
||||
}
|
||||
done:
|
||||
|
||||
@@ -2119,6 +2119,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
ret = mjpeg_decode_com(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (start_code == DQT) {
|
||||
ff_mjpeg_decode_dqt(s);
|
||||
}
|
||||
|
||||
ret = -1;
|
||||
@@ -2151,9 +2153,6 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->restart_count = 0;
|
||||
/* nothing to do on SOI */
|
||||
break;
|
||||
case DQT:
|
||||
ff_mjpeg_decode_dqt(s);
|
||||
break;
|
||||
case DHT:
|
||||
if ((ret = ff_mjpeg_decode_dht(s)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
|
||||
|
||||
@@ -471,6 +471,10 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
|
||||
tsmb_type = AV_RB32(tsmb);
|
||||
tsmb += 4;
|
||||
|
||||
if (tsmb_size == 0) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (tsmb_size == 1) {
|
||||
if (m->tracksize + 16 > avpkt->size)
|
||||
break;
|
||||
|
||||
@@ -76,7 +76,7 @@ static const AVOption options[] = {
|
||||
{ "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, INT_MAX, VE },
|
||||
{ "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "2pass", "Use 2pass encoding mode", OFFSET(twopass), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
|
||||
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(device), AV_OPT_TYPE_INT, { .i64 = ANY_DEVICE }, -2, INT_MAX, VE },
|
||||
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(device), AV_OPT_TYPE_INT, { .i64 = ANY_DEVICE }, -2, INT_MAX, VE, "device" },
|
||||
{ "any", "Pick the first device available", 0, AV_OPT_TYPE_CONST, { .i64 = ANY_DEVICE }, 0, 0, VE, "device" },
|
||||
{ "list", "List the available devices", 0, AV_OPT_TYPE_CONST, { .i64 = LIST_DEVICES }, 0, 0, VE, "device" },
|
||||
{ "delay", "Delay frame output by the given amount of frames", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 0, INT_MAX, VE },
|
||||
|
||||
@@ -69,7 +69,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
/* parse the SPS */
|
||||
ret = ff_h2645_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal);
|
||||
ret = ff_h2645_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal, 1);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error unescaping the SPS buffer\n");
|
||||
return ret;
|
||||
|
||||
+3
-2
@@ -204,8 +204,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
|
||||
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
|
||||
if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4
|
||||
|| avctx->bits_per_coded_sample <= 2) &&
|
||||
if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4 ||
|
||||
avctx->bits_per_coded_sample == 2 || avctx->bits_per_coded_sample == 1 ||
|
||||
(avctx->bits_per_coded_sample == 0 && (context->is_nut_pal8 || context->is_mono)) ) &&
|
||||
(context->is_mono || context->is_pal8) &&
|
||||
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ') ||
|
||||
context->is_nut_mono || context->is_nut_pal8)) {
|
||||
|
||||
+8
-2
@@ -102,6 +102,7 @@ typedef struct SVQ3Context {
|
||||
int prev_frame_num;
|
||||
|
||||
enum AVPictureType pict_type;
|
||||
enum AVPictureType slice_type;
|
||||
int low_delay;
|
||||
|
||||
int mb_x, mb_y;
|
||||
@@ -1027,7 +1028,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
|
||||
slice_bits = slice_length * 8;
|
||||
slice_bytes = slice_length + length - 1;
|
||||
|
||||
if (slice_bytes > get_bits_left(&s->gb)) {
|
||||
if (8LL*slice_bytes > get_bits_left(&s->gb)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -1057,7 +1058,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
s->pict_type = ff_h264_golomb_to_pict_type[slice_id];
|
||||
s->slice_type = ff_h264_golomb_to_pict_type[slice_id];
|
||||
|
||||
if ((header & 0x9F) == 2) {
|
||||
i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1));
|
||||
@@ -1426,6 +1427,8 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (svq3_decode_slice_header(avctx))
|
||||
return -1;
|
||||
|
||||
s->pict_type = s->slice_type;
|
||||
|
||||
if (s->pict_type != AV_PICTURE_TYPE_B)
|
||||
FFSWAP(H264Picture*, s->next_pic, s->last_pic);
|
||||
|
||||
@@ -1539,6 +1542,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (svq3_decode_slice_header(avctx))
|
||||
return -1;
|
||||
}
|
||||
if (s->slice_type != s->pict_type) {
|
||||
avpriv_request_sample(avctx, "non constant slice type\n");
|
||||
}
|
||||
/* TODO: support s->mb_skip_run */
|
||||
}
|
||||
|
||||
|
||||
@@ -1271,6 +1271,11 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
if (remaining_bits(s, gb) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Overread %d\n", -remaining_bits(s, gb));
|
||||
s->packet_loss = 1;
|
||||
}
|
||||
|
||||
if (s->packet_done && !s->packet_loss &&
|
||||
remaining_bits(s, gb) > 0) {
|
||||
/* save the rest of the data so that it can be decoded
|
||||
|
||||
@@ -450,6 +450,7 @@ void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color,
|
||||
alpha = 0x101 * color->rgba[3] + 0x2;
|
||||
}
|
||||
nb_planes = draw->nb_planes - !!(draw->desc->flags & AV_PIX_FMT_FLAG_ALPHA);
|
||||
nb_planes += !nb_planes;
|
||||
for (plane = 0; plane < nb_planes; plane++) {
|
||||
nb_comp = draw->pixelstep[plane];
|
||||
p0 = pointer_at(draw, dst, dst_linesize, plane, x0, y0);
|
||||
@@ -627,6 +628,7 @@ void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color,
|
||||
alpha = (0x101 * color->rgba[3] + 0x2) >> 8;
|
||||
}
|
||||
nb_planes = draw->nb_planes - !!(draw->desc->flags & AV_PIX_FMT_FLAG_ALPHA);
|
||||
nb_planes += !nb_planes;
|
||||
for (plane = 0; plane < nb_planes; plane++) {
|
||||
nb_comp = draw->pixelstep[plane];
|
||||
p0 = pointer_at(draw, dst, dst_linesize, plane, x0, y0);
|
||||
|
||||
@@ -1008,7 +1008,7 @@ static const AVOption colorspace_options[] = {
|
||||
|
||||
{ "space", "Output colorspace",
|
||||
OFFSET(user_csp), AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED },
|
||||
AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
|
||||
AVCOL_SPC_RGB, AVCOL_SPC_NB - 1, FLAGS, "csp"},
|
||||
ENUM("bt709", AVCOL_SPC_BT709, "csp"),
|
||||
ENUM("fcc", AVCOL_SPC_FCC, "csp"),
|
||||
ENUM("bt470bg", AVCOL_SPC_BT470BG, "csp"),
|
||||
|
||||
@@ -344,14 +344,14 @@ static void avi_metadata_creation_time(AVDictionary **metadata, char *date)
|
||||
|
||||
static void avi_read_nikon(AVFormatContext *s, uint64_t end)
|
||||
{
|
||||
while (avio_tell(s->pb) < end) {
|
||||
while (avio_tell(s->pb) < end && !avio_feof(s->pb)) {
|
||||
uint32_t tag = avio_rl32(s->pb);
|
||||
uint32_t size = avio_rl32(s->pb);
|
||||
switch (tag) {
|
||||
case MKTAG('n', 'c', 't', 'g'): /* Nikon Tags */
|
||||
{
|
||||
uint64_t tag_end = avio_tell(s->pb) + size;
|
||||
while (avio_tell(s->pb) < tag_end) {
|
||||
while (avio_tell(s->pb) < tag_end && !avio_feof(s->pb)) {
|
||||
uint16_t tag = avio_rl16(s->pb);
|
||||
uint16_t size = avio_rl16(s->pb);
|
||||
const char *name = NULL;
|
||||
@@ -605,9 +605,13 @@ static int avi_read_header(AVFormatContext *s)
|
||||
ast = s->streams[0]->priv_data;
|
||||
av_freep(&s->streams[0]->codecpar->extradata);
|
||||
av_freep(&s->streams[0]->codecpar);
|
||||
av_freep(&s->streams[0]->codec);
|
||||
if (s->streams[0]->info)
|
||||
av_freep(&s->streams[0]->info->duration_error);
|
||||
av_freep(&s->streams[0]->info);
|
||||
if (s->streams[0]->internal)
|
||||
av_freep(&s->streams[0]->internal->avctx);
|
||||
av_freep(&s->streams[0]->internal);
|
||||
av_freep(&s->streams[0]);
|
||||
s->nb_streams = 0;
|
||||
if (CONFIG_DV_DEMUXER) {
|
||||
@@ -1093,6 +1097,8 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
||||
goto error;
|
||||
|
||||
if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) {
|
||||
if (ast->sub_ctx->nb_streams != 1)
|
||||
goto error;
|
||||
ff_read_packet(ast->sub_ctx, &ast->sub_pkt);
|
||||
avcodec_parameters_copy(st->codecpar, ast->sub_ctx->streams[0]->codecpar);
|
||||
time_base = ast->sub_ctx->streams[0]->time_base;
|
||||
@@ -1849,7 +1855,6 @@ static int avi_read_seek(AVFormatContext *s, int stream_index,
|
||||
continue;
|
||||
|
||||
// av_assert1(st2->codecpar->block_align);
|
||||
av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001);
|
||||
index = av_index_search_timestamp(st2,
|
||||
av_rescale_q(timestamp,
|
||||
st->time_base,
|
||||
|
||||
+5
-5
@@ -416,10 +416,10 @@ static struct segment *new_init_section(struct playlist *pls,
|
||||
}
|
||||
|
||||
if (info->byterange[0]) {
|
||||
sec->size = atoi(info->byterange);
|
||||
sec->size = strtoll(info->byterange, NULL, 10);
|
||||
ptr = strchr(info->byterange, '@');
|
||||
if (ptr)
|
||||
sec->url_offset = atoi(ptr+1);
|
||||
sec->url_offset = strtoll(ptr+1, NULL, 10);
|
||||
} else {
|
||||
/* the entire file is the init section */
|
||||
sec->size = -1;
|
||||
@@ -731,7 +731,7 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
ret = ensure_playlist(c, &pls, url);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
pls->target_duration = atoi(ptr) * AV_TIME_BASE;
|
||||
pls->target_duration = strtoll(ptr, NULL, 10) * AV_TIME_BASE;
|
||||
} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
|
||||
ret = ensure_playlist(c, &pls, url);
|
||||
if (ret < 0)
|
||||
@@ -760,10 +760,10 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
is_segment = 1;
|
||||
duration = atof(ptr) * AV_TIME_BASE;
|
||||
} else if (av_strstart(line, "#EXT-X-BYTERANGE:", &ptr)) {
|
||||
seg_size = atoi(ptr);
|
||||
seg_size = strtoll(ptr, NULL, 10);
|
||||
ptr = strchr(ptr, '@');
|
||||
if (ptr)
|
||||
seg_offset = atoi(ptr+1);
|
||||
seg_offset = strtoll(ptr+1, NULL, 10);
|
||||
} else if (av_strstart(line, "#", NULL)) {
|
||||
continue;
|
||||
} else if (line[0]) {
|
||||
|
||||
+1
-1
@@ -3243,7 +3243,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
avio_skip(pb, 4);
|
||||
count = avio_rb32(pb);
|
||||
if (count > UINT_MAX / sizeof(*c->meta_keys)) {
|
||||
if (count > UINT_MAX / sizeof(*c->meta_keys) - 1) {
|
||||
av_log(c->fc, AV_LOG_ERROR,
|
||||
"The 'keys' atom with the invalid key count: %d\n", count);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
+29
-6
@@ -4592,15 +4592,10 @@ static int mov_auto_flush_fragment(AVFormatContext *s, int force)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
static int check_pkt(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
MOVMuxContext *mov = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
MOVTrack *trk = &mov->tracks[pkt->stream_index];
|
||||
AVCodecParameters *par = trk->par;
|
||||
unsigned int samples_in_chunk = 0;
|
||||
int size = pkt->size, ret = 0;
|
||||
uint8_t *reformatted_data = NULL;
|
||||
|
||||
if (trk->entry) {
|
||||
int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;
|
||||
@@ -4612,11 +4607,35 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
pkt->dts = trk->cluster[trk->entry - 1].dts + 1;
|
||||
pkt->pts = AV_NOPTS_VALUE;
|
||||
}
|
||||
} else if (pkt->dts <= INT_MIN || pkt->dts >= INT_MAX) {
|
||||
av_log(s, AV_LOG_ERROR, "Application provided initial timestamp: %"PRId64" is out of range for mov/mp4 format\n",
|
||||
pkt->dts
|
||||
);
|
||||
|
||||
pkt->dts = 0;
|
||||
pkt->pts = AV_NOPTS_VALUE;
|
||||
}
|
||||
if (pkt->duration < 0 || pkt->duration > INT_MAX) {
|
||||
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
MOVMuxContext *mov = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
MOVTrack *trk = &mov->tracks[pkt->stream_index];
|
||||
AVCodecParameters *par = trk->par;
|
||||
unsigned int samples_in_chunk = 0;
|
||||
int size = pkt->size, ret = 0;
|
||||
uint8_t *reformatted_data = NULL;
|
||||
|
||||
ret = check_pkt(s, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
|
||||
int ret;
|
||||
if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
|
||||
@@ -4882,6 +4901,10 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int64_t frag_duration = 0;
|
||||
int size = pkt->size;
|
||||
|
||||
int ret = check_pkt(s, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (mov->flags & FF_MOV_FLAG_FRAG_DISCONT) {
|
||||
int i;
|
||||
for (i = 0; i < s->nb_streams; i++)
|
||||
|
||||
@@ -119,10 +119,10 @@ retry:
|
||||
z->avail_out = buf_size;
|
||||
|
||||
ret = inflate(z, Z_NO_FLUSH);
|
||||
if (ret < 0)
|
||||
return AVERROR(EINVAL);
|
||||
if (ret == Z_STREAM_END)
|
||||
return AVERROR_EOF;
|
||||
if (ret != Z_OK)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (buf_size - z->avail_out == 0)
|
||||
goto retry;
|
||||
|
||||
+6
-2
@@ -307,7 +307,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
|
||||
int score;
|
||||
AVInputFormat *fmt = av_probe_input_format3(pd, 1, &score);
|
||||
|
||||
if (fmt && st->request_probe <= score) {
|
||||
if (fmt) {
|
||||
int i;
|
||||
av_log(s, AV_LOG_DEBUG,
|
||||
"Probe with size=%d, packets=%d detected %s with score=%d\n",
|
||||
@@ -318,6 +318,9 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
|
||||
if (fmt_id_type[i].type != AVMEDIA_TYPE_AUDIO &&
|
||||
st->codecpar->sample_rate)
|
||||
continue;
|
||||
if (st->request_probe > score &&
|
||||
st->codecpar->codec_id != fmt_id_type[i].id)
|
||||
continue;
|
||||
st->codecpar->codec_id = fmt_id_type[i].id;
|
||||
st->codecpar->codec_type = fmt_id_type[i].type;
|
||||
st->internal->need_context_update = 1;
|
||||
@@ -2411,6 +2414,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
|
||||
max_ts = av_rescale_rnd(max_ts, time_base.den,
|
||||
time_base.num * (int64_t)AV_TIME_BASE,
|
||||
AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX);
|
||||
stream_index = 0;
|
||||
}
|
||||
|
||||
ret = s->iformat->read_seek2(s, stream_index, min_ts,
|
||||
@@ -2500,7 +2504,7 @@ static void update_stream_timings(AVFormatContext *ic)
|
||||
end_time1 = av_rescale_q_rnd(st->duration, st->time_base,
|
||||
AV_TIME_BASE_Q,
|
||||
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
|
||||
if (end_time1 != AV_NOPTS_VALUE && start_time1 <= INT64_MAX - end_time1) {
|
||||
if (end_time1 != AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
|
||||
end_time1 += start_time1;
|
||||
end_time = FFMAX(end_time, end_time1);
|
||||
}
|
||||
|
||||
@@ -1031,7 +1031,7 @@ static int read_header(AVFormatContext *s)
|
||||
while (1) {
|
||||
uint64_t frame_nb = avio_rl64(pb);
|
||||
uint64_t position = avio_rl64(pb);
|
||||
while (frame_nb > e->size && e <= e_end) {
|
||||
while (e <= e_end && frame_nb > e->size) {
|
||||
e->pos = last_position;
|
||||
e++;
|
||||
}
|
||||
|
||||
@@ -352,6 +352,7 @@ static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[],
|
||||
int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr));
|
||||
if(!dstPtr || !srcPtr)
|
||||
continue;
|
||||
dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr;
|
||||
for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) {
|
||||
for (j = 0; j < min_stride; j++) {
|
||||
dstPtr[j] = av_bswap16(srcPtr[j]);
|
||||
@@ -557,6 +558,8 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[],
|
||||
int bpc = dst_format->comp[0].depth;
|
||||
int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA;
|
||||
int swap = 0;
|
||||
int i;
|
||||
|
||||
if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) ||
|
||||
!HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE)
|
||||
swap++;
|
||||
@@ -570,6 +573,12 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[],
|
||||
src_format->name, dst_format->name);
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
for(i=0; i<4; i++) {
|
||||
dst2013[i] += stride2013[i] * srcSliceY / 2;
|
||||
dst1023[i] += stride1023[i] * srcSliceY / 2;
|
||||
}
|
||||
|
||||
switch (c->srcFormat) {
|
||||
case AV_PIX_FMT_RGB48LE:
|
||||
case AV_PIX_FMT_RGB48BE:
|
||||
|
||||
Reference in New Issue
Block a user