Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29584733e6 | |||
| 526628058e | |||
| 24b4c4c5ba | |||
| 6f6cd2e29d | |||
| f8e254716b | |||
| 7653e8db4d | |||
| a9c1ef2626 | |||
| ac1ddc6361 | |||
| 86d6fca94b | |||
| 13deb0c1f6 | |||
| da11322641 | |||
| 7cce800930 | |||
| 38c1df15c6 | |||
| 27505de3b9 | |||
| dc5240a4d7 | |||
| c7ad616dda | |||
| 743354358b | |||
| b9f0979e16 | |||
| bfb7744aaf | |||
| 7333799de5 | |||
| 61c5c89d04 | |||
| 19045efd05 | |||
| 33e67eb80c | |||
| 4b43dd03ed | |||
| 10ae5fb269 | |||
| 5e7ddf0b4a | |||
| 29b9505215 | |||
| 5cc3add036 | |||
| 93a32c15a8 | |||
| 22dbd1eb31 | |||
| 92ec4eacf9 | |||
| 5d67851392 | |||
| 0e4612ea68 | |||
| f69905e230 | |||
| fcc2119eac | |||
| 28c08ab943 | |||
| 953c6259d6 | |||
| 770482def3 | |||
| 64aa8bb886 | |||
| 0eb399381a | |||
| 0d32491b74 | |||
| d4a333f00b | |||
| 5ff09443c5 | |||
| 0575adfd4a | |||
| 5351c8bd46 | |||
| 6622be010b | |||
| 7b6dba892f | |||
| edac232860 | |||
| 1fa31e28fd | |||
| 3ee6a9cfb4 | |||
| b2f99c424f | |||
| 96d5786027 | |||
| 1b5548cc09 | |||
| df2efc212d | |||
| a5c83b586b | |||
| 55fe7a738f | |||
| 46023f3258 | |||
| 74e9dbf0df | |||
| ee17fdffd4 | |||
| eadb52d459 | |||
| afa34cb36e | |||
| fef71d661b | |||
| 6d849e2706 | |||
| acedc53186 | |||
| 6b1c71040d | |||
| 6274709c1c | |||
| 06ce68d8a0 | |||
| 54a6c1368c | |||
| f4c8449238 | |||
| 956f2db21f | |||
| 7f3124e08c | |||
| 65304d33a2 | |||
| a0edd7f583 | |||
| 2755c73d55 | |||
| 918d45ec82 | |||
| 2453c66b0f | |||
| c6d9d00220 | |||
| 02bec657f3 | |||
| a2c3c9bc60 | |||
| 94077cf673 | |||
| 506bbbc099 | |||
| 910878e4d9 | |||
| 51f0580c5f | |||
| 215d6f897d | |||
| be1f146a0f | |||
| 965f15551f | |||
| 0837678cbd | |||
| d2452b9e20 | |||
| 73f42b7b58 | |||
| 634e9a696d | |||
| 750fec58e1 | |||
| 62e942ab1c | |||
| f626a479f4 | |||
| b3cf49b6f9 | |||
| 10a085a21f | |||
| 62b536690d |
@@ -1,6 +1,92 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 3.1.11:
|
||||
- avcodec/takdec: Fix integer overflow in decode_lpc()
|
||||
- avcodec/proresdec2: Check bits in DECODE_CODEWORD(), fixes invalid shift
|
||||
- avcodec/takdec: Fix integer overflows in decode_subframe()
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*()
|
||||
- avcodec/ffv1dec: Fix integer overflow in read_quant_table()
|
||||
- avcodec/svq3: Fix overflow in svq3_add_idct_c()
|
||||
- avcodec/pngdec: Clean up on av_frame_ref() failure
|
||||
- avcodec/hevc_ps: Fix c?_qp_offset_list size
|
||||
- avcodec/shorten: Move buffer allocation and offset init to end of read_header()
|
||||
- avcodec/jpeg2000dsp: Fix multiple integer overflows in ict_int()
|
||||
- avcodec/hevcdsp_template: Fix undefined shift in put_hevc_pel_bi_w_pixels
|
||||
- avcodec/diracdec: Fix overflow in DC computation
|
||||
- avformat/asfdec: Fix DoS in asf_build_simple_index()
|
||||
- avformat/mov: Fix DoS in read_tfra()
|
||||
- avcodec/dirac_dwt: Fix multiple overflows in 9/7 lifting
|
||||
- avcodec/diracdec: Fix integer overflow in INTRA_DC_PRED()
|
||||
- avformat/mxfdec: Fix Sign error in mxf_read_primer_pack()
|
||||
- avformat/mxfdec: Fix DoS issues in mxf_read_index_entry_array()
|
||||
- avformat/nsvdec: Fix DoS due to lack of eof check in nsvs_file_offset loop.
|
||||
- avcodec/snowdec: Fix integer overflow in decode_subband_slice_buffered()
|
||||
- avcodec/hevc_ps: Fix undefined shift in pcm code
|
||||
- avcodec/sbrdsp_fixed: Fix undefined overflows in autocorrelate()
|
||||
- avformat/mvdec: Fix DoS due to lack of eof check
|
||||
- avformat/rl2: Fix DoS due to lack of eof check
|
||||
- avformat/rmdec: Fix DoS due to lack of eof check
|
||||
- avformat/cinedec: Fix DoS due to lack of eof check
|
||||
- avformat/asfdec: Fix DoS due to lack of eof check
|
||||
- avformat/hls: Fix DoS due to infinite loop
|
||||
- ffprobe: Fix NULL pointer handling in color parameter printing
|
||||
- ffprobe: Fix null pointer dereference with color primaries
|
||||
- avcodec/hevc_ps: Check delta_pocs in ff_hevc_decode_short_term_rps()
|
||||
- avformat/rtpdec_h264: Fix heap-buffer-overflow
|
||||
- avformat/aviobuf: Fix signed integer overflow in avio_seek()
|
||||
- avformat/mov: Fix signed integer overflows with total_size
|
||||
- avcodec/utils: Fix signed integer overflow in rc_initial_buffer_occupancy initialization
|
||||
- avcodec/aacdec_template: Fix running cleanup in decode_ics_info()
|
||||
- avcodec/me_cmp: Fix crashes on ARM due to misalignment
|
||||
- avcodec/dirac_dwt_template: Fix integer overflow in vertical_compose53iL0()
|
||||
- avcodec/fic: Fixes signed integer overflow
|
||||
- avcodec/snowdec: Fix off by 1 error
|
||||
- avcodec/diracdec: Check perspective_exp and zrs_exp.
|
||||
- avcodec/mpeg4videodec: Clear mcsel before decoding an image
|
||||
- avcodec/dirac_dwt: Fixes integer overflows in COMPOSE_DAUB97*
|
||||
- avcodec/aacdec_fixed: fix invalid shift in predict()
|
||||
- avcodec/h264_slice: Fix overflow in slice offset
|
||||
- avformat/utils: fix memory leak in avformat_free_context
|
||||
- avfilter/vf_ssim: fix temp size calculation
|
||||
|
||||
|
||||
version 3.1.10:
|
||||
- avcodec/diracdec: Check weight_log2denom
|
||||
- avcodec/dirac_dwt: Fix multiple integer overflows in COMPOSE_DD97iH0()
|
||||
- avcodec/diracdec: Fix integer overflow in divide3()
|
||||
- avcodec/takdec: Fix integer overflow in decode_subframe()
|
||||
- avformat/rtmppkt: Convert ff_amf_get_field_value() to bytestream2
|
||||
- avformat/rtmppkt: Convert ff_amf_tag_size() to bytestream2
|
||||
- avcodec/diracdec: Fix integer overflow in signed multiplication in UNPACK_ARITH()
|
||||
- avcodec/dnxhddec: Move mb height check out of non hr branch
|
||||
- avcodec/hevc_ps: fix integer overflow in log2_parallel_merge_level_minus2
|
||||
- avformat/oggparsecelt: Do not re-allocate os->private
|
||||
- avcodec/ylc: Fix shift overflow
|
||||
- avcodec/aacps: Fix multiple integer overflow in map_val_34_to_20()
|
||||
- avcodec/aacdec_fixed: fix: left shift of negative value -1
|
||||
- doc/filters: typo in frei0r
|
||||
- avcodec/cfhd: Fix decoding regression due to height check
|
||||
- avcodec/aacdec_template (fixed point): Check gain in decode_cce() to avoid undefined shifts later
|
||||
- avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()
|
||||
- avcodec/magicyuv: Check that vlc len is not too large
|
||||
- avcodec/mjpegdec: Clip DC also on the negative side.
|
||||
- avcodec/aacps (fixed point): Fix multiple signed integer overflows
|
||||
- avcodec/ylc: Fix vlc of 31 bits
|
||||
- avcodec/sbrdsp_fixed: Fix integer overflow in sbr_hf_apply_noise()
|
||||
- avcodec/wavpack: Fix invalid shift
|
||||
- avcodec/h264_slice: Fix signed integer overflow
|
||||
- avcodec/hevc_ps: Fix integer overflow with beta/tc offsets
|
||||
- avcodec/cfhd: Fix invalid left shift of negative value
|
||||
- avcodec/vb: Check vertical GMC component before multiply
|
||||
- avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()
|
||||
- avcodec/apedec: Fix integer overflow
|
||||
- avcodec/wavpack: Fix integer overflow in wv_unpack_stereo()
|
||||
- avcodec/mpeg4videodec: Fix GMC with videos of dimension 1
|
||||
- avcodec/wavpack: Fix integer overflow
|
||||
- avcodec/takdec: Fix integer overflow
|
||||
- avcodec/tiff: Update pointer only when the result is used
|
||||
|
||||
|
||||
version 3.1.9:
|
||||
- avcodec/cfhd: Check bpc before setting bpc in context
|
||||
|
||||
+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.9
|
||||
PROJECT_NUMBER = 3.1.11
|
||||
|
||||
# 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
|
||||
|
||||
@@ -306,6 +306,24 @@ used to end the output video at the length of the shortest input file,
|
||||
which in this case is @file{input.mp4} as the GIF in this example loops
|
||||
infinitely.
|
||||
|
||||
@section hls
|
||||
|
||||
HLS demuxer
|
||||
|
||||
It accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item live_start_index
|
||||
segment index to start live streams at (negative values are from the end).
|
||||
|
||||
@item allowed_extensions
|
||||
',' separated list of file extensions that hls is allowed to access.
|
||||
|
||||
@item max_reload
|
||||
Maximum number of times a insufficient list is attempted to be reloaded.
|
||||
Default value is 1000.
|
||||
@end table
|
||||
|
||||
@section image2
|
||||
|
||||
Image file demuxer.
|
||||
|
||||
+1
-1
@@ -8094,7 +8094,7 @@ It accepts the following parameters:
|
||||
@item filter_name
|
||||
The name of the frei0r effect to load. If the environment variable
|
||||
@env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
|
||||
directories specified by the colon-separated list in @env{FREIOR_PATH}.
|
||||
directories specified by the colon-separated list in @env{FREI0R_PATH}.
|
||||
Otherwise, the standard frei0r paths are searched, in this order:
|
||||
@file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
|
||||
@file{/usr/lib/frei0r-1/}.
|
||||
|
||||
@@ -1789,6 +1789,56 @@ static void print_pkt_side_data(WriterContext *w,
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
static void print_color_range(WriterContext *w, enum AVColorRange color_range, const char *fallback)
|
||||
{
|
||||
const char *val = av_color_range_name(color_range);
|
||||
if (!val || color_range == AVCOL_RANGE_UNSPECIFIED) {
|
||||
print_str_opt("color_range", fallback);
|
||||
} else {
|
||||
print_str("color_range", val);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
|
||||
{
|
||||
const char *val = av_color_space_name(color_space);
|
||||
if (!val || color_space == AVCOL_SPC_UNSPECIFIED) {
|
||||
print_str_opt("color_space", "unknown");
|
||||
} else {
|
||||
print_str("color_space", val);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries)
|
||||
{
|
||||
const char *val = av_color_primaries_name(color_primaries);
|
||||
if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) {
|
||||
print_str_opt("color_primaries", "unknown");
|
||||
} else {
|
||||
print_str("color_primaries", val);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_color_trc(WriterContext *w, enum AVColorTransferCharacteristic color_trc)
|
||||
{
|
||||
const char *val = av_color_transfer_name(color_trc);
|
||||
if (!val || color_trc == AVCOL_TRC_UNSPECIFIED) {
|
||||
print_str_opt("color_transfer", "unknown");
|
||||
} else {
|
||||
print_str("color_transfer", val);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
|
||||
{
|
||||
const char *val = av_chroma_location_name(chroma_location);
|
||||
if (!val || chroma_location == AVCHROMA_LOC_UNSPECIFIED) {
|
||||
print_str_opt("chroma_location", "unspecified");
|
||||
} else {
|
||||
print_str("chroma_location", val);
|
||||
}
|
||||
}
|
||||
|
||||
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
|
||||
{
|
||||
char val_str[128];
|
||||
@@ -2243,29 +2293,12 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
if (s) print_str ("pix_fmt", s);
|
||||
else print_str_opt("pix_fmt", "unknown");
|
||||
print_int("level", par->level);
|
||||
if (par->color_range != AVCOL_RANGE_UNSPECIFIED)
|
||||
print_str ("color_range", av_color_range_name(par->color_range));
|
||||
else
|
||||
print_str_opt("color_range", "N/A");
|
||||
|
||||
s = av_get_colorspace_name(par->color_space);
|
||||
if (s) print_str ("color_space", s);
|
||||
else print_str_opt("color_space", "unknown");
|
||||
|
||||
if (par->color_trc != AVCOL_TRC_UNSPECIFIED)
|
||||
print_str("color_transfer", av_color_transfer_name(par->color_trc));
|
||||
else
|
||||
print_str_opt("color_transfer", av_color_transfer_name(par->color_trc));
|
||||
|
||||
if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)
|
||||
print_str("color_primaries", av_color_primaries_name(par->color_primaries));
|
||||
else
|
||||
print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries));
|
||||
|
||||
if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
|
||||
print_str("chroma_location", av_chroma_location_name(par->chroma_location));
|
||||
else
|
||||
print_str_opt("chroma_location", av_chroma_location_name(par->chroma_location));
|
||||
print_color_range(w, par->color_range, "N/A");
|
||||
print_color_space(w, par->color_space);
|
||||
print_color_trc(w, par->color_trc);
|
||||
print_primaries(w, par->color_primaries);
|
||||
print_chroma_location(w, par->chroma_location);
|
||||
|
||||
#if FF_API_PRIVATE_OPT
|
||||
if (dec_ctx && dec_ctx->timecode_frame_start >= 0) {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define AAC_RENAME(x) x ## _fixed
|
||||
#define AAC_RENAME_32(x) x ## _fixed_32
|
||||
typedef int INTFLOAT;
|
||||
typedef unsigned UINTFLOAT; ///< Equivalent to INTFLOAT, Used as temporal cast to avoid undefined sign overflow operations.
|
||||
typedef int64_t INT64FLOAT;
|
||||
typedef int16_t SHORTFLOAT;
|
||||
typedef SoftFloat AAC_FLOAT;
|
||||
@@ -83,6 +84,7 @@ typedef int AAC_SIGNE;
|
||||
#define AAC_RENAME(x) x
|
||||
#define AAC_RENAME_32(x) x
|
||||
typedef float INTFLOAT;
|
||||
typedef float UINTFLOAT;
|
||||
typedef float INT64FLOAT;
|
||||
typedef float SHORTFLOAT;
|
||||
typedef float AAC_FLOAT;
|
||||
|
||||
@@ -305,8 +305,12 @@ static av_always_inline void predict(PredictorState *ps, int *coef,
|
||||
if (output_enable) {
|
||||
int shift = 28 - pv.exp;
|
||||
|
||||
if (shift < 31)
|
||||
*coef += (pv.mant + (1 << (shift - 1))) >> shift;
|
||||
if (shift < 31) {
|
||||
if (shift > 0) {
|
||||
*coef += (pv.mant + (1 << (shift - 1))) >> shift;
|
||||
} else
|
||||
*coef += pv.mant << -shift;
|
||||
}
|
||||
}
|
||||
|
||||
e0 = av_int2sf(*coef, 2);
|
||||
@@ -430,7 +434,7 @@ static void apply_independent_coupling_fixed(AACContext *ac,
|
||||
else {
|
||||
for (i = 0; i < len; i++) {
|
||||
tmp = (int)(((int64_t)src[i] * c + (int64_t)0x1000000000) >> 37);
|
||||
dest[i] += tmp << shift;
|
||||
dest[i] += tmp * (1 << shift);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1255,6 +1255,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||
const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
|
||||
const int aot = m4ac->object_type;
|
||||
const int sampling_index = m4ac->sampling_index;
|
||||
int ret_fail = AVERROR_INVALIDDATA;
|
||||
|
||||
if (aot != AOT_ER_AAC_ELD) {
|
||||
if (get_bits1(gb)) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n");
|
||||
@@ -1305,8 +1307,10 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||
ics->num_swb = ff_aac_num_swb_512[sampling_index];
|
||||
ics->tns_max_bands = ff_tns_max_bands_512[sampling_index];
|
||||
}
|
||||
if (!ics->num_swb || !ics->swb_offset)
|
||||
return AVERROR_BUG;
|
||||
if (!ics->num_swb || !ics->swb_offset) {
|
||||
ret_fail = AVERROR_BUG;
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
ics->swb_offset = ff_swb_offset_1024[sampling_index];
|
||||
ics->num_swb = ff_aac_num_swb_1024[sampling_index];
|
||||
@@ -1330,7 +1334,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||
if (aot == AOT_ER_AAC_LD) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"LTP in ER AAC LD not yet implemented.\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret_fail = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
if ((ics->ltp.present = get_bits(gb, 1)))
|
||||
decode_ltp(&ics->ltp, gb, ics->max_sfb);
|
||||
@@ -1349,7 +1354,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||
return 0;
|
||||
fail:
|
||||
ics->max_sfb = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
return ret_fail;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2173,6 +2178,10 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
||||
cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
|
||||
gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
|
||||
gain_cache = GET_GAIN(scale, gain);
|
||||
#if USE_FIXED
|
||||
if ((abs(gain_cache)-1024) >> 3 > 30)
|
||||
return AVERROR(ERANGE);
|
||||
#endif
|
||||
}
|
||||
if (coup->coupling_point == AFTER_IMDCT) {
|
||||
coup->gain[c][0] = gain_cache;
|
||||
@@ -2190,6 +2199,10 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
||||
t >>= 1;
|
||||
}
|
||||
gain_cache = GET_GAIN(scale, t) * s;
|
||||
#if USE_FIXED
|
||||
if ((abs(gain_cache)-1024) >> 3 > 30)
|
||||
return AVERROR(ERANGE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
coup->gain[c][idx] = gain_cache;
|
||||
@@ -2363,7 +2376,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
|
||||
* @param decode 1 if tool is used normally, 0 if tool is used in LTP.
|
||||
* @param coef spectral coefficients
|
||||
*/
|
||||
static void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
|
||||
static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
|
||||
IndividualChannelStream *ics, int decode)
|
||||
{
|
||||
const int mmm = FFMIN(ics->tns_max_bands, ics->max_sfb);
|
||||
@@ -2371,6 +2384,7 @@ static void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
|
||||
int bottom, top, order, start, end, size, inc;
|
||||
INTFLOAT lpc[TNS_MAX_ORDER];
|
||||
INTFLOAT tmp[TNS_MAX_ORDER+1];
|
||||
UINTFLOAT *coef = coef_param;
|
||||
|
||||
for (w = 0; w < ics->num_windows; w++) {
|
||||
bottom = ics->num_swb;
|
||||
@@ -2400,7 +2414,7 @@ static void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
|
||||
// ar filter
|
||||
for (m = 0; m < size; m++, start += inc)
|
||||
for (i = 1; i <= FFMIN(m, order); i++)
|
||||
coef[start] -= AAC_MUL26(coef[start - i * inc], lpc[i - 1]);
|
||||
coef[start] -= AAC_MUL26((INTFLOAT)coef[start - i * inc], lpc[i - 1]);
|
||||
} else {
|
||||
// ma filter
|
||||
for (m = 0; m < size; m++, start += inc) {
|
||||
|
||||
+12
-21
@@ -499,13 +499,13 @@ static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
|
||||
static void map_val_34_to_20(INTFLOAT par[PS_MAX_NR_IIDICC])
|
||||
{
|
||||
#if USE_FIXED
|
||||
par[ 0] = (int)(((int64_t)(par[ 0] + (par[ 1]>>1)) * 1431655765 + \
|
||||
par[ 0] = (int)(((int64_t)(par[ 0] + (unsigned)(par[ 1]>>1)) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
par[ 1] = (int)(((int64_t)((par[ 1]>>1) + par[ 2]) * 1431655765 + \
|
||||
par[ 1] = (int)(((int64_t)((par[ 1]>>1) + (unsigned)par[ 2]) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
par[ 2] = (int)(((int64_t)(par[ 3] + (par[ 4]>>1)) * 1431655765 + \
|
||||
par[ 2] = (int)(((int64_t)(par[ 3] + (unsigned)(par[ 4]>>1)) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
par[ 3] = (int)(((int64_t)((par[ 4]>>1) + par[ 5]) * 1431655765 + \
|
||||
par[ 3] = (int)(((int64_t)((par[ 4]>>1) + (unsigned)par[ 5]) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
#else
|
||||
par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333f;
|
||||
@@ -692,26 +692,17 @@ static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT
|
||||
for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
|
||||
for (n = n0; n < nL; n++) {
|
||||
int decayed_peak;
|
||||
int denom;
|
||||
|
||||
decayed_peak = (int)(((int64_t)peak_decay_factor * \
|
||||
peak_decay_nrg[i] + 0x40000000) >> 31);
|
||||
peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]);
|
||||
power_smooth[i] += (power[i][n] - power_smooth[i] + 2) >> 2;
|
||||
peak_decay_diff_smooth[i] += (peak_decay_nrg[i] - power[i][n] - \
|
||||
peak_decay_diff_smooth[i] + 2) >> 2;
|
||||
denom = peak_decay_diff_smooth[i] + (peak_decay_diff_smooth[i] >> 1);
|
||||
if (denom > power_smooth[i]) {
|
||||
int p = power_smooth[i];
|
||||
while (denom < 0x40000000) {
|
||||
denom <<= 1;
|
||||
p <<= 1;
|
||||
}
|
||||
transient_gain[i][n] = p / (denom >> 16);
|
||||
}
|
||||
else {
|
||||
transient_gain[i][n] = 1 << 16;
|
||||
}
|
||||
power_smooth[i] += (power[i][n] + 2LL - power_smooth[i]) >> 2;
|
||||
peak_decay_diff_smooth[i] += (peak_decay_nrg[i] + 2LL - power[i][n] - \
|
||||
peak_decay_diff_smooth[i]) >> 2;
|
||||
|
||||
if (peak_decay_diff_smooth[i]) {
|
||||
transient_gain[i][n] = FFMIN(power_smooth[i]*43691LL / peak_decay_diff_smooth[i], 1<<16);
|
||||
} else
|
||||
transient_gain[i][n] = 1 << 16;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
+5
-3
@@ -1412,6 +1412,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int32_t *sample24;
|
||||
int i, ch, ret;
|
||||
int blockstodecode;
|
||||
uint64_t decoded_buffer_size;
|
||||
|
||||
/* this should never be negative, but bad things will happen if it is, so
|
||||
check it just to make sure. */
|
||||
@@ -1467,7 +1468,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
skip_bits_long(&s->gb, offset);
|
||||
}
|
||||
|
||||
if (!nblocks || nblocks > INT_MAX) {
|
||||
if (!nblocks || nblocks > INT_MAX / 2 / sizeof(*s->decoded_buffer) - 8) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %"PRIu32".\n",
|
||||
nblocks);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1493,8 +1494,9 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
blockstodecode = s->samples;
|
||||
|
||||
/* reallocate decoded sample buffer if needed */
|
||||
av_fast_malloc(&s->decoded_buffer, &s->decoded_size,
|
||||
2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer));
|
||||
decoded_buffer_size = 2LL * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer);
|
||||
av_assert0(decoded_buffer_size <= INT_MAX);
|
||||
av_fast_malloc(&s->decoded_buffer, &s->decoded_size, decoded_buffer_size);
|
||||
if (!s->decoded_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
memset(s->decoded_buffer, 0, s->decoded_size);
|
||||
|
||||
@@ -58,6 +58,9 @@ const AVBitStreamFilter *av_bsf_get_by_name(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; bitstream_filters[i]; i++) {
|
||||
const AVBitStreamFilter *f = bitstream_filters[i];
|
||||
if (!strcmp(f->name, name))
|
||||
|
||||
+2
-2
@@ -332,7 +332,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->plane[s->channel_num].band[0][0].stride = data;
|
||||
} else if (tag == 28) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Lowpass height %"PRIu16"\n", data);
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].height) {
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].a_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid lowpass height\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -662,7 +662,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
output = s->plane[plane].subband[0];
|
||||
for (i = 0; i < lowpass_height * 2; i++) {
|
||||
for (j = 0; j < lowpass_width * 2; j++)
|
||||
output[j] <<= 2;
|
||||
output[j] *= 4;
|
||||
|
||||
output += lowpass_width * 2;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
|
||||
(b1 + ((b0 + b2 + 1) >> 1))
|
||||
|
||||
#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
|
||||
(b2 + ((-b0 + 9*b1 + 9*b3 - b4 + 8) >> 4))
|
||||
(b2 + ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 8) >> 4))
|
||||
|
||||
#define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
|
||||
(b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5))
|
||||
@@ -111,22 +111,22 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
|
||||
(b0 + b1)
|
||||
|
||||
#define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
|
||||
(b4 - ((-8*(b0+b8) + 21*(b1+b7) - 46*(b2+b6) + 161*(b3+b5) + 128) >> 8))
|
||||
(b4 - ((int)(-8*(b0+(unsigned)b8) + 21*(b1+(unsigned)b7) - 46*(b2+(unsigned)b6) + 161*(b3+(unsigned)b5) + 128) >> 8))
|
||||
|
||||
#define COMPOSE_FIDELITYiH0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
|
||||
(b4 + ((-2*(b0+b8) + 10*(b1+b7) - 25*(b2+b6) + 81*(b3+b5) + 128) >> 8))
|
||||
(b4 + ((int)(-2*(b0+(unsigned)b8) + 10*(b1+(unsigned)b7) - 25*(b2+(unsigned)b6) + 81*(b3+(unsigned)b5) + 128) >> 8))
|
||||
|
||||
#define COMPOSE_DAUB97iL1(b0, b1, b2)\
|
||||
(b1 - ((1817*(b0 + b2) + 2048) >> 12))
|
||||
(b1 - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH1(b0, b1, b2)\
|
||||
(b1 - (( 113*(b0 + b2) + 64) >> 7))
|
||||
(b1 - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7))
|
||||
|
||||
#define COMPOSE_DAUB97iL0(b0, b1, b2)\
|
||||
(b1 + (( 217*(b0 + b2) + 2048) >> 12))
|
||||
(b1 + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH0(b0, b1, b2)\
|
||||
(b1 + ((6497*(b0 + b2) + 2048) >> 12))
|
||||
(b1 + ((int)(6497*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
|
||||
#endif /* AVCODEC_DWT_H */
|
||||
|
||||
@@ -49,7 +49,7 @@ static void RENAME(vertical_compose53iL0)(uint8_t *_b0, uint8_t *_b1, uint8_t *_
|
||||
TYPE *b1 = (TYPE *)_b1;
|
||||
TYPE *b2 = (TYPE *)_b2;
|
||||
for (i = 0; i < width; i++)
|
||||
b1[i] -= (b0[i] + b2[i] + 2) >> 2;
|
||||
b1[i] -= (int)(b0[i] + (unsigned)b2[i] + 2) >> 2;
|
||||
}
|
||||
|
||||
static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src1, int w2,
|
||||
|
||||
+14
-4
@@ -231,7 +231,7 @@ enum dirac_subband {
|
||||
/* magic number division by 3 from schroedinger */
|
||||
static inline int divide3(int x)
|
||||
{
|
||||
return ((x+1)*21845 + 10922) >> 16;
|
||||
return (int)((x+1U)*21845 + 10922) >> 16;
|
||||
}
|
||||
|
||||
static DiracFrame *remove_frame(DiracFrame *framelist[], int picnum)
|
||||
@@ -462,7 +462,8 @@ static inline int coeff_unpack_golomb(GetBitContext *gb, int qfactor, int qoffse
|
||||
static inline void coeff_unpack_arith_##n(DiracArith *c, int qfactor, int qoffset, \
|
||||
SubBand *b, type *buf, int x, int y) \
|
||||
{ \
|
||||
int coeff, sign, sign_pred = 0, pred_ctx = CTX_ZPZN_F1; \
|
||||
int sign, sign_pred = 0, pred_ctx = CTX_ZPZN_F1; \
|
||||
unsigned coeff; \
|
||||
const int mstride = -(b->stride >> (1+b->pshift)); \
|
||||
if (b->parent) { \
|
||||
const type *pbuf = (type *)b->parent->ibuf; \
|
||||
@@ -593,7 +594,7 @@ static inline void codeblock(DiracContext *s, SubBand *b,
|
||||
} \
|
||||
|
||||
INTRA_DC_PRED(8, int16_t)
|
||||
INTRA_DC_PRED(10, int32_t)
|
||||
INTRA_DC_PRED(10, uint32_t)
|
||||
|
||||
/**
|
||||
* Dirac Specification ->
|
||||
@@ -1081,6 +1082,10 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
||||
s->globalmc[ref].perspective[0] = dirac_get_se_golomb(gb);
|
||||
s->globalmc[ref].perspective[1] = dirac_get_se_golomb(gb);
|
||||
}
|
||||
if (s->globalmc[ref].perspective_exp + (uint64_t)s->globalmc[ref].zrs_exp > 30) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,6 +1104,11 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
s->weight_log2denom = get_interleaved_ue_golomb(gb);
|
||||
if (s->weight_log2denom < 1 || s->weight_log2denom > 8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "weight_log2denom unsupported or invalid\n");
|
||||
s->weight_log2denom = 1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->weight[0] = dirac_get_se_golomb(gb);
|
||||
if (s->num_refs == 2)
|
||||
s->weight[1] = dirac_get_se_golomb(gb);
|
||||
@@ -1333,7 +1343,7 @@ static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock
|
||||
if (!block->ref) {
|
||||
pred_block_dc(block, stride, x, y);
|
||||
for (i = 0; i < 3; i++)
|
||||
block->u.dc[i] += dirac_get_arith_int(arith+1+i, CTX_DC_F1, CTX_DC_DATA);
|
||||
block->u.dc[i] += (unsigned)dirac_get_arith_int(arith+1+i, CTX_DC_F1, CTX_DC_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -273,14 +273,18 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
if (header_prefix == DNXHD_HEADER_HR2) {
|
||||
ctx->data_offset = 0x170 + (ctx->mb_height << 2);
|
||||
} else {
|
||||
if (ctx->mb_height > 68 ||
|
||||
(ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
|
||||
if (ctx->mb_height > 68) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"mb height too big: %d\n", ctx->mb_height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ctx->data_offset = 0x280;
|
||||
}
|
||||
if ((ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"mb height too big: %d\n", ctx->mb_height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (buf_size < ctx->data_offset) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
|
||||
@@ -483,7 +483,7 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)
|
||||
memset(state, 128, sizeof(state));
|
||||
|
||||
for (v = 0; i < 128; v++) {
|
||||
unsigned len = get_symbol(c, state, 0) + 1;
|
||||
unsigned len = get_symbol(c, state, 0) + 1U;
|
||||
|
||||
if (len > 128 - i || !len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
+6
-6
@@ -84,12 +84,12 @@ static const uint8_t fic_header[7] = { 0, 0, 1, 'F', 'I', 'C', 'V' };
|
||||
|
||||
static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd)
|
||||
{
|
||||
const int t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step];
|
||||
const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step];
|
||||
const int t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step];
|
||||
const int t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step];
|
||||
const unsigned t4 = 5793U * (t2 + t0 + 0x800 >> 12);
|
||||
const unsigned t5 = 5793U * (t3 + t1 + 0x800 >> 12);
|
||||
const unsigned t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step];
|
||||
const unsigned t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step];
|
||||
const unsigned t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step];
|
||||
const unsigned t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step];
|
||||
const unsigned t4 = 5793U * ((int)(t2 + t0 + 0x800) >> 12);
|
||||
const unsigned t5 = 5793U * ((int)(t3 + t1 + 0x800) >> 12);
|
||||
const unsigned t6 = t2 - t0;
|
||||
const unsigned t7 = t3 - t1;
|
||||
const unsigned t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step];
|
||||
|
||||
+10
-8
@@ -1667,7 +1667,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
|
||||
}
|
||||
|
||||
sl->last_qscale_diff = 0;
|
||||
tmp = pps->init_qp + get_se_golomb(&sl->gb);
|
||||
tmp = pps->init_qp + (unsigned)get_se_golomb(&sl->gb);
|
||||
if (tmp > 51 + 6 * (sps->bit_depth_luma - 8)) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1697,17 +1697,19 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
|
||||
sl->deblocking_filter ^= 1; // 1<->0
|
||||
|
||||
if (sl->deblocking_filter) {
|
||||
sl->slice_alpha_c0_offset = get_se_golomb(&sl->gb) * 2;
|
||||
sl->slice_beta_offset = get_se_golomb(&sl->gb) * 2;
|
||||
if (sl->slice_alpha_c0_offset > 12 ||
|
||||
sl->slice_alpha_c0_offset < -12 ||
|
||||
sl->slice_beta_offset > 12 ||
|
||||
sl->slice_beta_offset < -12) {
|
||||
int slice_alpha_c0_offset_div2 = get_se_golomb(&sl->gb);
|
||||
int slice_beta_offset_div2 = get_se_golomb(&sl->gb);
|
||||
if (slice_alpha_c0_offset_div2 > 6 ||
|
||||
slice_alpha_c0_offset_div2 < -6 ||
|
||||
slice_beta_offset_div2 > 6 ||
|
||||
slice_beta_offset_div2 < -6) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"deblocking filter parameters %d %d out of range\n",
|
||||
sl->slice_alpha_c0_offset, sl->slice_beta_offset);
|
||||
slice_alpha_c0_offset_div2, slice_beta_offset_div2);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
sl->slice_alpha_c0_offset = slice_alpha_c0_offset_div2 * 2;
|
||||
sl->slice_beta_offset = slice_beta_offset_div2 * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2792,6 +2792,10 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
|
||||
}
|
||||
|
||||
if (s->sh.first_slice_in_pic_flag) {
|
||||
if (s->ref) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the first in the same frame.\n");
|
||||
goto fail;
|
||||
}
|
||||
ret = hevc_frame_start(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+2
-2
@@ -539,8 +539,8 @@ typedef struct HEVCPPS {
|
||||
uint8_t chroma_qp_offset_list_enabled_flag;
|
||||
uint8_t diff_cu_chroma_qp_offset_depth;
|
||||
uint8_t chroma_qp_offset_list_len_minus1;
|
||||
int8_t cb_qp_offset_list[5];
|
||||
int8_t cr_qp_offset_list[5];
|
||||
int8_t cb_qp_offset_list[6];
|
||||
int8_t cr_qp_offset_list[6];
|
||||
uint8_t log2_sao_offset_scale_luma;
|
||||
uint8_t log2_sao_offset_scale_chroma;
|
||||
|
||||
|
||||
+28
-12
@@ -224,6 +224,12 @@ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
prev = 0;
|
||||
for (i = 0; i < rps->num_negative_pics; i++) {
|
||||
delta_poc = get_ue_golomb_long(gb) + 1;
|
||||
if (delta_poc < 1 || delta_poc > 32768) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid value of delta_poc: %d\n",
|
||||
delta_poc);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
prev -= delta_poc;
|
||||
rps->delta_poc[i] = prev;
|
||||
rps->used[i] = get_bits1(gb);
|
||||
@@ -231,6 +237,12 @@ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
prev = 0;
|
||||
for (i = 0; i < nb_positive_pics; i++) {
|
||||
delta_poc = get_ue_golomb_long(gb) + 1;
|
||||
if (delta_poc < 1 || delta_poc > 32768) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid value of delta_poc: %d\n",
|
||||
delta_poc);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
prev += delta_poc;
|
||||
rps->delta_poc[rps->num_negative_pics + i] = prev;
|
||||
rps->used[rps->num_negative_pics + i] = get_bits1(gb);
|
||||
@@ -1002,10 +1014,10 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
sps->pcm.log2_min_pcm_cb_size = get_ue_golomb_long(gb) + 3;
|
||||
sps->pcm.log2_max_pcm_cb_size = sps->pcm.log2_min_pcm_cb_size +
|
||||
get_ue_golomb_long(gb);
|
||||
if (sps->pcm.bit_depth > sps->bit_depth) {
|
||||
if (FFMAX(sps->pcm.bit_depth, sps->pcm.bit_depth_chroma) > sps->bit_depth) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"PCM bit depth (%d) is greater than normal bit depth (%d)\n",
|
||||
sps->pcm.bit_depth, sps->bit_depth);
|
||||
"PCM bit depth (%d, %d) is greater than normal bit depth (%d)\n",
|
||||
sps->pcm.bit_depth, sps->pcm.bit_depth_chroma, sps->bit_depth);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -1413,6 +1425,7 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCSPS *sps = NULL;
|
||||
int i, ret = 0;
|
||||
unsigned int pps_id = 0;
|
||||
unsigned log2_parallel_merge_level_minus2;
|
||||
|
||||
AVBufferRef *pps_buf;
|
||||
HEVCPPS *pps = av_mallocz(sizeof(*pps));
|
||||
@@ -1572,20 +1585,22 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
pps->deblocking_filter_override_enabled_flag = get_bits1(gb);
|
||||
pps->disable_dbf = get_bits1(gb);
|
||||
if (!pps->disable_dbf) {
|
||||
pps->beta_offset = get_se_golomb(gb) * 2;
|
||||
pps->tc_offset = get_se_golomb(gb) * 2;
|
||||
if (pps->beta_offset/2 < -6 || pps->beta_offset/2 > 6) {
|
||||
int beta_offset_div2 = get_se_golomb(gb);
|
||||
int tc_offset_div2 = get_se_golomb(gb) ;
|
||||
if (beta_offset_div2 < -6 || beta_offset_div2 > 6) {
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_beta_offset_div2 out of range: %d\n",
|
||||
pps->beta_offset/2);
|
||||
beta_offset_div2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
if (pps->tc_offset/2 < -6 || pps->tc_offset/2 > 6) {
|
||||
if (tc_offset_div2 < -6 || tc_offset_div2 > 6) {
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_tc_offset_div2 out of range: %d\n",
|
||||
pps->tc_offset/2);
|
||||
tc_offset_div2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
pps->beta_offset = 2 * beta_offset_div2;
|
||||
pps->tc_offset = 2 * tc_offset_div2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1597,13 +1612,14 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
goto err;
|
||||
}
|
||||
pps->lists_modification_present_flag = get_bits1(gb);
|
||||
pps->log2_parallel_merge_level = get_ue_golomb_long(gb) + 2;
|
||||
if (pps->log2_parallel_merge_level > sps->log2_ctb_size) {
|
||||
log2_parallel_merge_level_minus2 = get_ue_golomb_long(gb);
|
||||
if (log2_parallel_merge_level_minus2 > sps->log2_ctb_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "log2_parallel_merge_level_minus2 out of range: %d\n",
|
||||
pps->log2_parallel_merge_level - 2);
|
||||
log2_parallel_merge_level_minus2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
pps->log2_parallel_merge_level = log2_parallel_merge_level_minus2 + 2;
|
||||
|
||||
pps->slice_header_extension_present_flag = get_bits1(gb);
|
||||
|
||||
|
||||
@@ -599,7 +599,7 @@ static void FUNC(put_hevc_pel_bi_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride,
|
||||
ox1 = ox1 * (1 << (BIT_DEPTH - 8));
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
dst[x] = av_clip_pixel(( (src[x] << (14 - BIT_DEPTH)) * wx1 + src2[x] * wx0 + ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
dst[x] = av_clip_pixel(( (src[x] << (14 - BIT_DEPTH)) * wx1 + src2[x] * wx0 + (ox0 + ox1 + 1) * (1 << log2Wd)) >> (log2Wd + 1));
|
||||
}
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
|
||||
@@ -65,9 +65,9 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize)
|
||||
|
||||
for (i = 0; i < csize; i++) {
|
||||
i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16);
|
||||
i1 = *src0 - (((i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
||||
i1 = *src0 - ((int)(((unsigned)i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
||||
- (((i_ict_params[2] * *src2) + (1 << 15)) >> 16);
|
||||
i2 = *src0 + (2 * *src1) + (((-14942 * *src1) + (1 << 15)) >> 16);
|
||||
i2 = *src0 + (2 * *src1) + ((int)((-14942U * *src1) + (1 << 15)) >> 16);
|
||||
*src0++ = i0;
|
||||
*src1++ = i1;
|
||||
*src2++ = i2;
|
||||
|
||||
@@ -488,7 +488,7 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
|
||||
line += 5;
|
||||
|
||||
for (i = 0; i < w * h; i++)
|
||||
data[i] *= 1 << I_PRESHIFT;
|
||||
data[i] *= 1LL << I_PRESHIFT;
|
||||
|
||||
for (lev = 0; lev < s->ndeclevels; lev++) {
|
||||
int lh = s->linelen[lev][0],
|
||||
|
||||
@@ -362,7 +362,6 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
// Check if subtraction resulted in an overflow
|
||||
if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) {
|
||||
av_packet_unref(avpkt);
|
||||
av_free(avpkt);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (discard_padding > 0) {
|
||||
@@ -371,7 +370,6 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
10);
|
||||
if(!side_data) {
|
||||
av_packet_unref(avpkt);
|
||||
av_free(avpkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
AV_WL32(side_data + 4, discard_padding);
|
||||
|
||||
@@ -805,7 +805,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
cx_frame->sz_alpha + 8);
|
||||
if(!side_data) {
|
||||
av_packet_unref(pkt);
|
||||
av_free(pkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
AV_WB64(side_data, 1);
|
||||
|
||||
@@ -90,6 +90,8 @@ static int build_huff(VLC *vlc, uint8_t *len)
|
||||
for (i = 0; i < 256; i++) {
|
||||
he[i].sym = 255 - i;
|
||||
he[i].len = len[i];
|
||||
if (len[i] == 0 || len[i] > 32)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
AV_QSORT(he, 256, HuffEntry, ff_magy_huff_cmp_len);
|
||||
|
||||
|
||||
+5
-5
@@ -555,7 +555,7 @@ static int dct_sad8x8_c(MpegEncContext *s, uint8_t *src1,
|
||||
|
||||
av_assert2(h == 8);
|
||||
|
||||
s->pdsp.diff_pixels(temp, src1, src2, stride);
|
||||
s->pdsp.diff_pixels_unaligned(temp, src1, src2, stride);
|
||||
s->fdsp.fdct(temp);
|
||||
return s->mecc.sum_abs_dctelem(temp);
|
||||
}
|
||||
@@ -595,7 +595,7 @@ static int dct264_sad8x8_c(MpegEncContext *s, uint8_t *src1,
|
||||
int16_t dct[8][8];
|
||||
int i, sum = 0;
|
||||
|
||||
s->pdsp.diff_pixels(dct[0], src1, src2, stride);
|
||||
s->pdsp.diff_pixels_unaligned(dct[0], src1, src2, stride);
|
||||
|
||||
#define SRC(x) dct[i][x]
|
||||
#define DST(x, v) dct[i][x] = v
|
||||
@@ -622,7 +622,7 @@ static int dct_max8x8_c(MpegEncContext *s, uint8_t *src1,
|
||||
|
||||
av_assert2(h == 8);
|
||||
|
||||
s->pdsp.diff_pixels(temp, src1, src2, stride);
|
||||
s->pdsp.diff_pixels_unaligned(temp, src1, src2, stride);
|
||||
s->fdsp.fdct(temp);
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
@@ -641,7 +641,7 @@ static int quant_psnr8x8_c(MpegEncContext *s, uint8_t *src1,
|
||||
av_assert2(h == 8);
|
||||
s->mb_intra = 0;
|
||||
|
||||
s->pdsp.diff_pixels(temp, src1, src2, stride);
|
||||
s->pdsp.diff_pixels_unaligned(temp, src1, src2, stride);
|
||||
|
||||
memcpy(bak, temp, 64 * sizeof(int16_t));
|
||||
|
||||
@@ -744,7 +744,7 @@ static int bit8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2,
|
||||
|
||||
av_assert2(h == 8);
|
||||
|
||||
s->pdsp.diff_pixels(temp, src1, src2, stride);
|
||||
s->pdsp.diff_pixels_unaligned(temp, src1, src2, stride);
|
||||
|
||||
s->block_last_index[0 /* FIXME */] =
|
||||
last =
|
||||
|
||||
@@ -693,7 +693,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
val = val * quant_matrix[0] + s->last_dc[component];
|
||||
val = FFMIN(val, 32767);
|
||||
val = av_clip_int16(val);
|
||||
s->last_dc[component] = val;
|
||||
block[0] = val;
|
||||
/* AC coefs */
|
||||
|
||||
@@ -171,7 +171,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int a = 2 << s->sprite_warping_accuracy;
|
||||
int rho = 3 - s->sprite_warping_accuracy;
|
||||
int r = 16 / a;
|
||||
int alpha = 0;
|
||||
int alpha = 1;
|
||||
int beta = 0;
|
||||
int w = s->width;
|
||||
int h = s->height;
|
||||
@@ -2283,6 +2283,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
int time_incr, time_increment;
|
||||
int64_t pts;
|
||||
|
||||
s->mcsel = 0;
|
||||
s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* pict type: I = 0 , P = 1 */
|
||||
if (s->pict_type == AV_PICTURE_TYPE_B && s->low_delay &&
|
||||
ctx->vol_control_parameters == 0 && !(s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)) {
|
||||
|
||||
@@ -82,6 +82,7 @@ av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx)
|
||||
{
|
||||
const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
|
||||
|
||||
c->diff_pixels_unaligned =
|
||||
c->diff_pixels = diff_pixels_c;
|
||||
|
||||
switch (avctx->bits_per_raw_sample) {
|
||||
|
||||
@@ -31,6 +31,11 @@ typedef struct PixblockDSPContext {
|
||||
const uint8_t *s1 /* align 8 */,
|
||||
const uint8_t *s2 /* align 8 */,
|
||||
int stride);
|
||||
void (*diff_pixels_unaligned)(int16_t *av_restrict block /* align 16 */,
|
||||
const uint8_t *s1,
|
||||
const uint8_t *s2,
|
||||
int stride);
|
||||
|
||||
} PixblockDSPContext;
|
||||
|
||||
void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx);
|
||||
|
||||
+1
-1
@@ -1358,7 +1358,7 @@ static int decode_frame_png(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
if ((ret = av_frame_ref(data, s->picture.f)) < 0)
|
||||
return ret;
|
||||
goto the_end;
|
||||
|
||||
*got_frame = 1;
|
||||
|
||||
|
||||
@@ -267,6 +267,8 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
|
||||
\
|
||||
if (q > switch_bits) { /* exp golomb */ \
|
||||
bits = exp_order - switch_bits + (q<<1); \
|
||||
if (bits > MIN_CACHE_BITS) \
|
||||
return AVERROR_INVALIDDATA; \
|
||||
val = SHOW_UBITS(re, gb, bits) - (1 << exp_order) + \
|
||||
((switch_bits + 1) << rice_order); \
|
||||
SKIP_BITS(re, gb, bits); \
|
||||
@@ -286,7 +288,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
|
||||
|
||||
static const uint8_t dc_codebook[7] = { 0x04, 0x28, 0x28, 0x4D, 0x4D, 0x70, 0x70};
|
||||
|
||||
static av_always_inline void decode_dc_coeffs(GetBitContext *gb, int16_t *out,
|
||||
static av_always_inline int decode_dc_coeffs(GetBitContext *gb, int16_t *out,
|
||||
int blocks_per_slice)
|
||||
{
|
||||
int16_t prev_dc;
|
||||
@@ -310,6 +312,7 @@ static av_always_inline void decode_dc_coeffs(GetBitContext *gb, int16_t *out,
|
||||
out[0] = prev_dc;
|
||||
}
|
||||
CLOSE_READER(re, gb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// adaptive codebook switching lut according to previous run/level values
|
||||
@@ -376,7 +379,8 @@ static int decode_slice_luma(AVCodecContext *avctx, SliceContext *slice,
|
||||
|
||||
init_get_bits(&gb, buf, buf_size << 3);
|
||||
|
||||
decode_dc_coeffs(&gb, blocks, blocks_per_slice);
|
||||
if ((ret = decode_dc_coeffs(&gb, blocks, blocks_per_slice)) < 0)
|
||||
return ret;
|
||||
if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -409,7 +413,8 @@ static int decode_slice_chroma(AVCodecContext *avctx, SliceContext *slice,
|
||||
|
||||
init_get_bits(&gb, buf, buf_size << 3);
|
||||
|
||||
decode_dc_coeffs(&gb, blocks, blocks_per_slice);
|
||||
if ((ret = decode_dc_coeffs(&gb, blocks, blocks_per_slice)) < 0)
|
||||
return ret;
|
||||
if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
+20
-20
@@ -136,19 +136,19 @@ static av_always_inline void autocorrelate(const int x[40][2], SoftFloat phi[3][
|
||||
|
||||
if (lag) {
|
||||
for (i = 1; i < 38; i++) {
|
||||
accu_re += (int64_t)x[i][0] * x[i+lag][0];
|
||||
accu_re += (int64_t)x[i][1] * x[i+lag][1];
|
||||
accu_im += (int64_t)x[i][0] * x[i+lag][1];
|
||||
accu_im -= (int64_t)x[i][1] * x[i+lag][0];
|
||||
accu_re += (uint64_t)x[i][0] * x[i+lag][0];
|
||||
accu_re += (uint64_t)x[i][1] * x[i+lag][1];
|
||||
accu_im += (uint64_t)x[i][0] * x[i+lag][1];
|
||||
accu_im -= (uint64_t)x[i][1] * x[i+lag][0];
|
||||
}
|
||||
|
||||
real_sum = accu_re;
|
||||
imag_sum = accu_im;
|
||||
|
||||
accu_re += (int64_t)x[ 0][0] * x[lag][0];
|
||||
accu_re += (int64_t)x[ 0][1] * x[lag][1];
|
||||
accu_im += (int64_t)x[ 0][0] * x[lag][1];
|
||||
accu_im -= (int64_t)x[ 0][1] * x[lag][0];
|
||||
accu_re += (uint64_t)x[ 0][0] * x[lag][0];
|
||||
accu_re += (uint64_t)x[ 0][1] * x[lag][1];
|
||||
accu_im += (uint64_t)x[ 0][0] * x[lag][1];
|
||||
accu_im -= (uint64_t)x[ 0][1] * x[lag][0];
|
||||
|
||||
phi[2-lag][1][0] = autocorr_calc(accu_re);
|
||||
phi[2-lag][1][1] = autocorr_calc(accu_im);
|
||||
@@ -156,28 +156,28 @@ static av_always_inline void autocorrelate(const int x[40][2], SoftFloat phi[3][
|
||||
if (lag == 1) {
|
||||
accu_re = real_sum;
|
||||
accu_im = imag_sum;
|
||||
accu_re += (int64_t)x[38][0] * x[39][0];
|
||||
accu_re += (int64_t)x[38][1] * x[39][1];
|
||||
accu_im += (int64_t)x[38][0] * x[39][1];
|
||||
accu_im -= (int64_t)x[38][1] * x[39][0];
|
||||
accu_re += (uint64_t)x[38][0] * x[39][0];
|
||||
accu_re += (uint64_t)x[38][1] * x[39][1];
|
||||
accu_im += (uint64_t)x[38][0] * x[39][1];
|
||||
accu_im -= (uint64_t)x[38][1] * x[39][0];
|
||||
|
||||
phi[0][0][0] = autocorr_calc(accu_re);
|
||||
phi[0][0][1] = autocorr_calc(accu_im);
|
||||
}
|
||||
} else {
|
||||
for (i = 1; i < 38; i++) {
|
||||
accu_re += (int64_t)x[i][0] * x[i][0];
|
||||
accu_re += (int64_t)x[i][1] * x[i][1];
|
||||
accu_re += (uint64_t)x[i][0] * x[i][0];
|
||||
accu_re += (uint64_t)x[i][1] * x[i][1];
|
||||
}
|
||||
real_sum = accu_re;
|
||||
accu_re += (int64_t)x[ 0][0] * x[ 0][0];
|
||||
accu_re += (int64_t)x[ 0][1] * x[ 0][1];
|
||||
accu_re += (uint64_t)x[ 0][0] * x[ 0][0];
|
||||
accu_re += (uint64_t)x[ 0][1] * x[ 0][1];
|
||||
|
||||
phi[2][1][0] = autocorr_calc(accu_re);
|
||||
|
||||
accu_re = real_sum;
|
||||
accu_re += (int64_t)x[38][0] * x[38][0];
|
||||
accu_re += (int64_t)x[38][1] * x[38][1];
|
||||
accu_re += (uint64_t)x[38][0] * x[38][0];
|
||||
accu_re += (uint64_t)x[38][1] * x[38][1];
|
||||
|
||||
phi[1][0][0] = autocorr_calc(accu_re);
|
||||
}
|
||||
@@ -253,8 +253,8 @@ static av_always_inline int sbr_hf_apply_noise(int (*Y)[2],
|
||||
int m;
|
||||
|
||||
for (m = 0; m < m_max; m++) {
|
||||
int y0 = Y[m][0];
|
||||
int y1 = Y[m][1];
|
||||
unsigned y0 = Y[m][0];
|
||||
unsigned y1 = Y[m][1];
|
||||
noise = (noise + 1) & 0x1ff;
|
||||
if (s_m[m].mant) {
|
||||
int shift, round;
|
||||
|
||||
@@ -453,12 +453,6 @@ static int read_header(ShortenContext *s)
|
||||
}
|
||||
s->nwrap = FFMAX(NWRAP, maxnlpc);
|
||||
|
||||
if ((ret = allocate_buffers(s)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = init_offset(s)) < 0)
|
||||
return ret;
|
||||
|
||||
if (s->version > 1)
|
||||
s->lpcqoffset = V2LPCQOFFSET;
|
||||
|
||||
@@ -494,6 +488,13 @@ static int read_header(ShortenContext *s)
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
if ((ret = allocate_buffers(s)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = init_offset(s)) < 0)
|
||||
return ret;
|
||||
|
||||
s->cur_chan = 0;
|
||||
s->bitshift = 0;
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, sli
|
||||
v = b->x_coeff[new_index].coeff;
|
||||
x = b->x_coeff[new_index++].x;
|
||||
while(x < w){
|
||||
register int t= ( (v>>1)*qmul + qadd)>>QEXPSHIFT;
|
||||
register int t= (int)( (v>>1)*(unsigned)qmul + qadd)>>QEXPSHIFT;
|
||||
register int u= -(v&1);
|
||||
line[x] = (t^u) - u;
|
||||
|
||||
@@ -355,7 +355,7 @@ static int decode_header(SnowContext *s){
|
||||
Plane *p= &s->plane[plane_index];
|
||||
p->diag_mc= get_rac(&s->c, s->header_state);
|
||||
htaps= get_symbol(&s->c, s->header_state, 0)*2 + 2;
|
||||
if((unsigned)htaps > HTAPS_MAX || htaps==0)
|
||||
if((unsigned)htaps >= HTAPS_MAX || htaps==0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
p->htaps= htaps;
|
||||
for(i= htaps/2; i; i--){
|
||||
|
||||
+1
-1
@@ -272,7 +272,7 @@ static void svq3_add_idct_c(uint8_t *dst, int16_t *block,
|
||||
const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]);
|
||||
const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3];
|
||||
const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3];
|
||||
const int rr = (dc + 0x80000);
|
||||
const int rr = (dc + 0x80000u);
|
||||
|
||||
dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((int)((z0 + z3) * qmul + rr) >> 20));
|
||||
dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((int)((z1 + z2) * qmul + rr) >> 20));
|
||||
|
||||
+7
-7
@@ -204,7 +204,7 @@ static void decode_lpc(int32_t *coeffs, int mode, int length)
|
||||
int a1 = *coeffs++;
|
||||
for (i = 0; i < length - 1 >> 1; i++) {
|
||||
*coeffs += a1;
|
||||
coeffs[1] += *coeffs;
|
||||
coeffs[1] += (unsigned)*coeffs;
|
||||
a1 = coeffs[1];
|
||||
coeffs += 2;
|
||||
}
|
||||
@@ -481,15 +481,15 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
|
||||
int v = 1 << (filter_quant - 1);
|
||||
|
||||
if (filter_order & -16)
|
||||
v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter,
|
||||
v += (unsigned)s->adsp.scalarproduct_int16(&s->residues[i], s->filter,
|
||||
filter_order & -16);
|
||||
for (j = filter_order & -16; j < filter_order; j += 4) {
|
||||
v += s->residues[i + j + 3] * s->filter[j + 3] +
|
||||
s->residues[i + j + 2] * s->filter[j + 2] +
|
||||
s->residues[i + j + 1] * s->filter[j + 1] +
|
||||
s->residues[i + j ] * s->filter[j ];
|
||||
v += s->residues[i + j + 3] * (unsigned)s->filter[j + 3] +
|
||||
s->residues[i + j + 2] * (unsigned)s->filter[j + 2] +
|
||||
s->residues[i + j + 1] * (unsigned)s->filter[j + 1] +
|
||||
s->residues[i + j ] * (unsigned)s->filter[j ];
|
||||
}
|
||||
v = (av_clip_intp2(v >> filter_quant, 13) * (1 << dshift)) - *decoded;
|
||||
v = (av_clip_intp2(v >> filter_quant, 13) * (1 << dshift)) - (unsigned)*decoded;
|
||||
*decoded++ = v;
|
||||
s->residues[filter_order + i] = v >> dshift;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1288,6 +1288,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
stride = p->linesize[plane];
|
||||
dst = p->data[plane];
|
||||
for (i = 0; i < s->height; i += s->rps) {
|
||||
if (i)
|
||||
dst += s->rps * stride;
|
||||
if (s->stripsizesoff)
|
||||
ssize = ff_tget(&stripsizes, s->sstype, le);
|
||||
else
|
||||
@@ -1308,7 +1310,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
dst += s->rps * stride;
|
||||
}
|
||||
if (s->predictor == 2) {
|
||||
if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {
|
||||
|
||||
+1
-1
@@ -1540,7 +1540,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
if (!avctx->rc_initial_buffer_occupancy)
|
||||
avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
|
||||
avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;
|
||||
|
||||
if (avctx->ticks_per_frame && avctx->time_base.num &&
|
||||
avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
|
||||
|
||||
@@ -205,6 +205,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
if (flags & VB_HAS_GMC) {
|
||||
i = (int16_t)bytestream2_get_le16(&c->stream);
|
||||
j = (int16_t)bytestream2_get_le16(&c->stream);
|
||||
if (FFABS(j) > avctx->height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "GMV out of range\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
offset = i + j * avctx->width;
|
||||
}
|
||||
if (flags & VB_HAS_VIDEO) {
|
||||
|
||||
+2
-1
@@ -1193,7 +1193,8 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx)
|
||||
/* DWT init */
|
||||
if (ff_vc2enc_init_transforms(&s->transform_args[i].t,
|
||||
s->plane[i].coef_stride,
|
||||
s->plane[i].dwt_height))
|
||||
s->plane[i].dwt_height,
|
||||
s->slice_width, s->slice_height))
|
||||
goto alloc_fail;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,21 +255,27 @@ static void vc2_subband_dwt_haar_shift(VC2TransformContext *t, dwtcoef *data,
|
||||
dwt_haar(t, data, stride, width, height, 1);
|
||||
}
|
||||
|
||||
av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_width, int p_height)
|
||||
av_cold int ff_vc2enc_init_transforms(VC2TransformContext *s, int p_stride,
|
||||
int p_height, int slice_w, int slice_h)
|
||||
{
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_9_7] = vc2_subband_dwt_97;
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_5_3] = vc2_subband_dwt_53;
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR] = vc2_subband_dwt_haar;
|
||||
s->vc2_subband_dwt[VC2_TRANSFORM_HAAR_S] = vc2_subband_dwt_haar_shift;
|
||||
|
||||
s->buffer = av_malloc(2*p_width*p_height*sizeof(dwtcoef));
|
||||
/* Pad by the slice size, only matters for non-Haar wavelets */
|
||||
s->buffer = av_calloc((p_stride + slice_w)*(p_height + slice_h), sizeof(dwtcoef));
|
||||
if (!s->buffer)
|
||||
return 1;
|
||||
|
||||
s->padding = (slice_h >> 1)*p_stride + (slice_w >> 1);
|
||||
s->buffer += s->padding;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_cold void ff_vc2enc_free_transforms(VC2TransformContext *s)
|
||||
{
|
||||
av_freep(&s->buffer);
|
||||
av_free(s->buffer - s->padding);
|
||||
s->buffer = NULL;
|
||||
}
|
||||
|
||||
@@ -41,12 +41,14 @@ enum VC2TransformType {
|
||||
|
||||
typedef struct VC2TransformContext {
|
||||
dwtcoef *buffer;
|
||||
int padding;
|
||||
void (*vc2_subband_dwt[VC2_TRANSFORMS_NB])(struct VC2TransformContext *t,
|
||||
dwtcoef *data, ptrdiff_t stride,
|
||||
int width, int height);
|
||||
} VC2TransformContext;
|
||||
|
||||
int ff_vc2enc_init_transforms(VC2TransformContext *t, int p_width, int p_height);
|
||||
int ff_vc2enc_init_transforms(VC2TransformContext *t, int p_stride, int p_height,
|
||||
int slice_w, int slice_h);
|
||||
void ff_vc2enc_free_transforms(VC2TransformContext *t);
|
||||
|
||||
#endif /* AVCODEC_VC2ENC_DWT_H */
|
||||
|
||||
@@ -219,7 +219,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
|
||||
INC_MED(1);
|
||||
DEC_MED(2);
|
||||
} else {
|
||||
base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2);
|
||||
base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2U);
|
||||
add = GET_MED(2) - 1;
|
||||
INC_MED(0);
|
||||
INC_MED(1);
|
||||
@@ -474,7 +474,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
}
|
||||
|
||||
if (type == AV_SAMPLE_FMT_S16P) {
|
||||
if (FFABS(L) + FFABS(R) > (1<<19)) {
|
||||
if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -837,9 +837,9 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
|
||||
continue;
|
||||
}
|
||||
bytestream2_get_buffer(&gb, val, 4);
|
||||
if (val[0] > 31) {
|
||||
if (val[0] > 30) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid INT32INFO, extra_bits = %d (> 32)\n", val[0]);
|
||||
"Invalid INT32INFO, extra_bits = %d (> 30)\n", val[0]);
|
||||
continue;
|
||||
} else if (val[0]) {
|
||||
s->extra_bits = val[0];
|
||||
|
||||
@@ -39,12 +39,14 @@ av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c,
|
||||
if (EXTERNAL_MMX(cpu_flags)) {
|
||||
if (!high_bit_depth)
|
||||
c->get_pixels = ff_get_pixels_mmx;
|
||||
c->diff_pixels_unaligned =
|
||||
c->diff_pixels = ff_diff_pixels_mmx;
|
||||
}
|
||||
|
||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||
if (!high_bit_depth)
|
||||
c->get_pixels = ff_get_pixels_sse2;
|
||||
c->diff_pixels_unaligned =
|
||||
c->diff_pixels = ff_diff_pixels_sse2;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
|
||||
|
||||
s = nodes[node].sym;
|
||||
if (s != -1) {
|
||||
bits[*pos] = (~pfx) & ((1 << FFMAX(pl, 1)) - 1);
|
||||
bits[*pos] = (~pfx) & ((1ULL << FFMAX(pl, 1)) - 1);
|
||||
lens[*pos] = FFMAX(pl, 1);
|
||||
xlat[*pos] = s + (pl == 0);
|
||||
(*pos)++;
|
||||
|
||||
+15
-4
@@ -118,14 +118,16 @@ static int iec61883_callback(unsigned char *data, int length,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
packet->buf = av_malloc(length);
|
||||
packet->buf = av_malloc(length + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!packet->buf) {
|
||||
av_free(packet);
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
packet->len = length;
|
||||
|
||||
memcpy(packet->buf, data, length);
|
||||
memset(packet->buf + length, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
if (dv->queue_first) {
|
||||
dv->queue_last->next = packet;
|
||||
@@ -199,13 +201,21 @@ static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
|
||||
size = avpriv_dv_produce_packet(dv->dv_demux, pkt,
|
||||
packet->buf, packet->len, -1);
|
||||
dv->queue_first = packet->next;
|
||||
if (size < 0)
|
||||
av_free(packet->buf);
|
||||
av_free(packet);
|
||||
dv->packets--;
|
||||
|
||||
if (size > 0)
|
||||
return size;
|
||||
if (size < 0)
|
||||
return -1;
|
||||
|
||||
return -1;
|
||||
if (av_packet_from_data(pkt, pkt->data, pkt->size) < 0) {
|
||||
av_freep(&pkt->data);
|
||||
av_packet_unref(pkt);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int iec61883_parse_queue_hdv(struct iec61883_data *dv, AVPacket *pkt)
|
||||
@@ -453,6 +463,7 @@ static int iec61883_close(AVFormatContext *context)
|
||||
} else {
|
||||
iec61883_dv_fb_stop(dv->iec61883_dv);
|
||||
iec61883_dv_fb_close(dv->iec61883_dv);
|
||||
av_freep(&dv->dv_demux);
|
||||
}
|
||||
while (dv->queue_first) {
|
||||
DVPacket *packet = dv->queue_first;
|
||||
|
||||
@@ -186,8 +186,17 @@ static int config_input(AVFilterLink *inlink)
|
||||
|
||||
s->start_duration = av_rescale(s->start_duration, inlink->sample_rate,
|
||||
AV_TIME_BASE);
|
||||
if (s->start_duration < 0) {
|
||||
av_log(ctx, AV_LOG_WARNING, "start duration must be non-negative\n");
|
||||
s->start_duration = -s->start_duration;
|
||||
}
|
||||
|
||||
s->stop_duration = av_rescale(s->stop_duration, inlink->sample_rate,
|
||||
AV_TIME_BASE);
|
||||
if (s->stop_duration < 0) {
|
||||
av_log(ctx, AV_LOG_WARNING, "stop duration must be non-negative\n");
|
||||
s->stop_duration = -s->stop_duration;
|
||||
}
|
||||
|
||||
s->start_holdoff = av_malloc_array(FFMAX(s->start_duration, 1),
|
||||
sizeof(*s->start_holdoff) *
|
||||
|
||||
@@ -147,6 +147,8 @@ static float ssim_endn(const int (*sum0)[4], const int (*sum1)[4], int width)
|
||||
return ssim;
|
||||
}
|
||||
|
||||
#define SUM_LEN(w) (((w) >> 2) + 3)
|
||||
|
||||
static float ssim_plane(SSIMDSPContext *dsp,
|
||||
uint8_t *main, int main_stride,
|
||||
uint8_t *ref, int ref_stride,
|
||||
@@ -155,7 +157,7 @@ static float ssim_plane(SSIMDSPContext *dsp,
|
||||
int z = 0, y;
|
||||
float ssim = 0.0;
|
||||
int (*sum0)[4] = temp;
|
||||
int (*sum1)[4] = sum0 + (width >> 2) + 3;
|
||||
int (*sum1)[4] = sum0 + SUM_LEN(width);
|
||||
|
||||
width >>= 2;
|
||||
height >>= 2;
|
||||
@@ -297,7 +299,7 @@ static int config_input_ref(AVFilterLink *inlink)
|
||||
for (i = 0; i < s->nb_components; i++)
|
||||
s->coefs[i] = (double) s->planeheight[i] * s->planewidth[i] / sum;
|
||||
|
||||
s->temp = av_malloc((2 * inlink->w + 12) * sizeof(*s->temp));
|
||||
s->temp = av_mallocz_array(2 * SUM_LEN(inlink->w), sizeof(int[4]));
|
||||
if (!s->temp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
||||
@@ -749,13 +749,15 @@ static int asf_read_marker(AVFormatContext *s, int64_t size)
|
||||
count = avio_rl32(pb); // markers count
|
||||
avio_rl16(pb); // reserved 2 bytes
|
||||
name_len = avio_rl16(pb); // name length
|
||||
for (i = 0; i < name_len; i++)
|
||||
avio_r8(pb); // skip the name
|
||||
avio_skip(pb, name_len);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
int64_t pres_time;
|
||||
int name_len;
|
||||
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_rl64(pb); // offset, 8 bytes
|
||||
pres_time = avio_rl64(pb); // presentation time
|
||||
pres_time -= asf->hdr.preroll * 10000;
|
||||
@@ -1608,6 +1610,11 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
|
||||
int64_t pos = s->internal->data_offset + s->packet_size * (int64_t)pktnum;
|
||||
int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
|
||||
|
||||
if (avio_feof(s->pb)) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (pos != last_pos) {
|
||||
av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d pts: %"PRId64"\n",
|
||||
pktnum, pktct, index_pts);
|
||||
|
||||
@@ -249,6 +249,8 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||
offset1 = pos + (s->buf_ptr - s->buffer);
|
||||
if (offset == 0)
|
||||
return offset1;
|
||||
if (offset > INT64_MAX - offset1)
|
||||
return AVERROR(EINVAL);
|
||||
offset += offset1;
|
||||
}
|
||||
if (offset < 0)
|
||||
|
||||
@@ -267,8 +267,12 @@ static int cine_read_header(AVFormatContext *avctx)
|
||||
|
||||
/* parse image offsets */
|
||||
avio_seek(pb, offImageOffsets, SEEK_SET);
|
||||
for (i = 0; i < st->duration; i++)
|
||||
for (i = 0; i < st->duration; i++) {
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
av_add_index_entry(st, avio_rl64(pb), i, 0, 0, AVINDEX_KEYFRAME);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ typedef struct HLSContext {
|
||||
AVDictionary *avio_opts;
|
||||
int strict_std_compliance;
|
||||
char *allowed_extensions;
|
||||
int max_reload;
|
||||
} HLSContext;
|
||||
|
||||
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
|
||||
@@ -1254,6 +1255,7 @@ static int read_data(void *opaque, uint8_t *buf, int buf_size)
|
||||
HLSContext *c = v->parent->priv_data;
|
||||
int ret, i;
|
||||
int just_opened = 0;
|
||||
int reload_count = 0;
|
||||
|
||||
restart:
|
||||
if (!v->needed)
|
||||
@@ -1285,6 +1287,9 @@ restart:
|
||||
reload_interval = default_reload_interval(v);
|
||||
|
||||
reload:
|
||||
reload_count++;
|
||||
if (reload_count > c->max_reload)
|
||||
return AVERROR_EOF;
|
||||
if (!v->finished &&
|
||||
av_gettime_relative() - v->last_load_time >= reload_interval) {
|
||||
if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) {
|
||||
@@ -2062,6 +2067,8 @@ static const AVOption hls_options[] = {
|
||||
OFFSET(allowed_extensions), AV_OPT_TYPE_STRING,
|
||||
{.str = "3gp,aac,avi,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
|
||||
INT_MIN, INT_MAX, FLAGS},
|
||||
{"max_reload", "Maximum number of times a insufficient list is attempted to be reloaded",
|
||||
OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ static av_cold int libssh_authentication(LIBSSHContext *libssh, const char *user
|
||||
}
|
||||
}
|
||||
|
||||
if (!authorized && (auth_methods & SSH_AUTH_METHOD_PASSWORD)) {
|
||||
if (!authorized && password && (auth_methods & SSH_AUTH_METHOD_PASSWORD)) {
|
||||
if (ssh_userauth_password(libssh->session, NULL, password) == SSH_AUTH_SUCCESS) {
|
||||
av_log(libssh, AV_LOG_DEBUG, "Authentication successful with password.\n");
|
||||
authorized = 1;
|
||||
|
||||
@@ -660,7 +660,7 @@ static const EbmlSyntax matroska_segments[] = {
|
||||
};
|
||||
|
||||
static const EbmlSyntax matroska_blockmore[] = {
|
||||
{ MATROSKA_ID_BLOCKADDID, EBML_UINT, 0, offsetof(MatroskaBlock,additional_id) },
|
||||
{ MATROSKA_ID_BLOCKADDID, EBML_UINT, 0, offsetof(MatroskaBlock,additional_id), { .u = 1 } },
|
||||
{ MATROSKA_ID_BLOCKADDITIONAL, EBML_BIN, 0, offsetof(MatroskaBlock,additional) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
+8
-1
@@ -4415,7 +4415,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
if (atom.size < 0)
|
||||
atom.size = INT64_MAX;
|
||||
while (total_size + 8 <= atom.size && !avio_feof(pb)) {
|
||||
while (total_size <= atom.size - 8 && !avio_feof(pb)) {
|
||||
int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
|
||||
a.size = atom.size;
|
||||
a.type=0;
|
||||
@@ -4862,6 +4862,13 @@ static int read_tfra(MOVContext *mov, AVIOContext *f)
|
||||
}
|
||||
for (i = 0; i < index->item_count; i++) {
|
||||
int64_t time, offset;
|
||||
|
||||
if (avio_feof(f)) {
|
||||
index->item_count = 0;
|
||||
av_freep(&index->items);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (version == 1) {
|
||||
time = avio_rb64(f);
|
||||
offset = avio_rb64(f);
|
||||
|
||||
@@ -338,6 +338,8 @@ static int mv_read_header(AVFormatContext *avctx)
|
||||
uint32_t pos = avio_rb32(pb);
|
||||
uint32_t asize = avio_rb32(pb);
|
||||
uint32_t vsize = avio_rb32(pb);
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, 8);
|
||||
av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
|
||||
av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
|
||||
|
||||
@@ -492,7 +492,7 @@ static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, U
|
||||
avpriv_request_sample(pb, "Primer pack item length %d", item_len);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (item_num > 65536) {
|
||||
if (item_num > 65536 || item_num < 0) {
|
||||
av_log(mxf->fc, AV_LOG_ERROR, "item_num %d is too large\n", item_num);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -888,6 +888,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
|
||||
segment->nb_index_entries = avio_rb32(pb);
|
||||
|
||||
length = avio_rb32(pb);
|
||||
if(segment->nb_index_entries && length < 11)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!(segment->temporal_offset_entries=av_calloc(segment->nb_index_entries, sizeof(*segment->temporal_offset_entries))) ||
|
||||
!(segment->flag_entries = av_calloc(segment->nb_index_entries, sizeof(*segment->flag_entries))) ||
|
||||
@@ -898,6 +900,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
|
||||
}
|
||||
|
||||
for (i = 0; i < segment->nb_index_entries; i++) {
|
||||
if(avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
segment->temporal_offset_entries[i] = avio_r8(pb);
|
||||
avio_r8(pb); /* KeyFrameOffset */
|
||||
segment->flag_entries[i] = avio_r8(pb);
|
||||
|
||||
@@ -350,8 +350,11 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
|
||||
if (!nsv->nsvs_file_offset)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for(i=0;i<table_entries_used;i++)
|
||||
for(i=0;i<table_entries_used;i++) {
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
nsv->nsvs_file_offset[i] = avio_rl32(pb) + size;
|
||||
}
|
||||
|
||||
if(table_entries > table_entries_used &&
|
||||
avio_rl32(pb) == MKTAG('T','O','C','2')) {
|
||||
|
||||
@@ -65,9 +65,14 @@ static int celt_header(AVFormatContext *s, int idx)
|
||||
st->codecpar->channels = nb_channels;
|
||||
if (sample_rate)
|
||||
avpriv_set_pts_info(st, 64, 1, sample_rate);
|
||||
priv->extra_headers_left = 1 + extra_headers;
|
||||
av_free(os->private);
|
||||
|
||||
if (os->private) {
|
||||
av_free(priv);
|
||||
priv = os->private;
|
||||
}
|
||||
os->private = priv;
|
||||
priv->extra_headers_left = 1 + extra_headers;
|
||||
|
||||
AV_WL32(st->codecpar->extradata + 0, overlap);
|
||||
AV_WL32(st->codecpar->extradata + 4, version);
|
||||
return 1;
|
||||
|
||||
+12
-3
@@ -170,12 +170,21 @@ static av_cold int rl2_read_header(AVFormatContext *s)
|
||||
}
|
||||
|
||||
/** read offset and size tables */
|
||||
for(i=0; i < frame_count;i++)
|
||||
for(i=0; i < frame_count;i++) {
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
chunk_size[i] = avio_rl32(pb);
|
||||
for(i=0; i < frame_count;i++)
|
||||
}
|
||||
for(i=0; i < frame_count;i++) {
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
chunk_offset[i] = avio_rl32(pb);
|
||||
for(i=0; i < frame_count;i++)
|
||||
}
|
||||
for(i=0; i < frame_count;i++) {
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
audio_size[i] = avio_rl32(pb) & 0xFFFF;
|
||||
}
|
||||
|
||||
/** build the sample index */
|
||||
for(i=0;i<frame_count;i++){
|
||||
|
||||
+4
-1
@@ -1235,8 +1235,11 @@ static int ivr_read_header(AVFormatContext *s)
|
||||
av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val);
|
||||
} else if (type == 4) {
|
||||
av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
|
||||
for (j = 0; j < len; j++)
|
||||
for (j = 0; j < len; j++) {
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
|
||||
}
|
||||
av_log(s, AV_LOG_DEBUG, "'\n");
|
||||
} else if (len == 4 && type == 3 && !strncmp(key, "StreamCount", tlen)) {
|
||||
nb_streams = value = avio_rb32(pb);
|
||||
|
||||
+85
-40
@@ -433,97 +433,142 @@ void ff_rtmp_packet_destroy(RTMPPacket *pkt)
|
||||
pkt->size = 0;
|
||||
}
|
||||
|
||||
int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)
|
||||
static int amf_tag_skip(GetByteContext *gb)
|
||||
{
|
||||
const uint8_t *base = data;
|
||||
AMFDataType type;
|
||||
unsigned nb = -1;
|
||||
int parse_key = 1;
|
||||
|
||||
if (data >= data_end)
|
||||
if (bytestream2_get_bytes_left(gb) < 1)
|
||||
return -1;
|
||||
switch ((type = *data++)) {
|
||||
case AMF_DATA_TYPE_NUMBER: return 9;
|
||||
case AMF_DATA_TYPE_BOOL: return 2;
|
||||
case AMF_DATA_TYPE_STRING: return 3 + AV_RB16(data);
|
||||
case AMF_DATA_TYPE_LONG_STRING: return 5 + AV_RB32(data);
|
||||
case AMF_DATA_TYPE_NULL: return 1;
|
||||
case AMF_DATA_TYPE_DATE: return 11;
|
||||
|
||||
type = bytestream2_get_byte(gb);
|
||||
switch (type) {
|
||||
case AMF_DATA_TYPE_NUMBER:
|
||||
bytestream2_get_be64(gb);
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_BOOL:
|
||||
bytestream2_get_byte(gb);
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_STRING:
|
||||
bytestream2_skip(gb, bytestream2_get_be16(gb));
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_LONG_STRING:
|
||||
bytestream2_skip(gb, bytestream2_get_be32(gb));
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_NULL:
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_DATE:
|
||||
bytestream2_skip(gb, 10);
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_ARRAY:
|
||||
parse_key = 0;
|
||||
case AMF_DATA_TYPE_MIXEDARRAY:
|
||||
nb = bytestream_get_be32(&data);
|
||||
nb = bytestream2_get_be32(gb);
|
||||
case AMF_DATA_TYPE_OBJECT:
|
||||
while (nb-- > 0 || type != AMF_DATA_TYPE_ARRAY) {
|
||||
int t;
|
||||
if (parse_key) {
|
||||
int size = bytestream_get_be16(&data);
|
||||
int size = bytestream2_get_be16(gb);
|
||||
if (!size) {
|
||||
data++;
|
||||
bytestream2_get_byte(gb);
|
||||
break;
|
||||
}
|
||||
if (size < 0 || size >= data_end - data)
|
||||
if (size < 0 || size >= bytestream2_get_bytes_left(gb))
|
||||
return -1;
|
||||
data += size;
|
||||
bytestream2_skip(gb, size);
|
||||
}
|
||||
t = ff_amf_tag_size(data, data_end);
|
||||
if (t < 0 || t >= data_end - data)
|
||||
t = amf_tag_skip(gb);
|
||||
if (t < 0 || bytestream2_get_bytes_left(gb) <= 0)
|
||||
return -1;
|
||||
data += t;
|
||||
}
|
||||
return data - base;
|
||||
case AMF_DATA_TYPE_OBJECT_END: return 1;
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_OBJECT_END: return 0;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
|
||||
int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)
|
||||
{
|
||||
GetByteContext gb;
|
||||
int ret;
|
||||
|
||||
if (data >= data_end)
|
||||
return -1;
|
||||
|
||||
bytestream2_init(&gb, data, data_end - data);
|
||||
|
||||
ret = amf_tag_skip(&gb);
|
||||
if (ret < 0 || bytestream2_get_bytes_left(&gb) <= 0)
|
||||
return -1;
|
||||
av_assert0(bytestream2_tell(&gb) >= 0 && bytestream2_tell(&gb) <= data_end - data);
|
||||
return bytestream2_tell(&gb);
|
||||
}
|
||||
|
||||
static int amf_get_field_value2(GetByteContext *gb,
|
||||
const uint8_t *name, uint8_t *dst, int dst_size)
|
||||
{
|
||||
int namelen = strlen(name);
|
||||
int len;
|
||||
|
||||
while (*data != AMF_DATA_TYPE_OBJECT && data < data_end) {
|
||||
len = ff_amf_tag_size(data, data_end);
|
||||
if (len < 0)
|
||||
len = data_end - data;
|
||||
data += len;
|
||||
while (bytestream2_peek_byte(gb) != AMF_DATA_TYPE_OBJECT && bytestream2_get_bytes_left(gb) > 0) {
|
||||
int ret = amf_tag_skip(gb);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
}
|
||||
if (data_end - data < 3)
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return -1;
|
||||
data++;
|
||||
bytestream2_get_byte(gb);
|
||||
|
||||
for (;;) {
|
||||
int size = bytestream_get_be16(&data);
|
||||
int size = bytestream2_get_be16(gb);
|
||||
if (!size)
|
||||
break;
|
||||
if (size < 0 || size >= data_end - data)
|
||||
if (size < 0 || size >= bytestream2_get_bytes_left(gb))
|
||||
return -1;
|
||||
data += size;
|
||||
if (size == namelen && !memcmp(data-size, name, namelen)) {
|
||||
switch (*data++) {
|
||||
bytestream2_skip(gb, size);
|
||||
if (size == namelen && !memcmp(gb->buffer-size, name, namelen)) {
|
||||
switch (bytestream2_get_byte(gb)) {
|
||||
case AMF_DATA_TYPE_NUMBER:
|
||||
snprintf(dst, dst_size, "%g", av_int2double(AV_RB64(data)));
|
||||
snprintf(dst, dst_size, "%g", av_int2double(bytestream2_get_be64(gb)));
|
||||
break;
|
||||
case AMF_DATA_TYPE_BOOL:
|
||||
snprintf(dst, dst_size, "%s", *data ? "true" : "false");
|
||||
snprintf(dst, dst_size, "%s", bytestream2_get_byte(gb) ? "true" : "false");
|
||||
break;
|
||||
case AMF_DATA_TYPE_STRING:
|
||||
len = bytestream_get_be16(&data);
|
||||
av_strlcpy(dst, data, FFMIN(len+1, dst_size));
|
||||
len = bytestream2_get_be16(gb);
|
||||
if (dst_size < 1)
|
||||
return -1;
|
||||
if (dst_size < len + 1)
|
||||
len = dst_size - 1;
|
||||
bytestream2_get_buffer(gb, dst, len);
|
||||
dst[len] = 0;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
len = ff_amf_tag_size(data, data_end);
|
||||
if (len < 0 || len >= data_end - data)
|
||||
len = amf_tag_skip(gb);
|
||||
if (len < 0 || bytestream2_get_bytes_left(gb) <= 0)
|
||||
return -1;
|
||||
data += len;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
|
||||
const uint8_t *name, uint8_t *dst, int dst_size)
|
||||
{
|
||||
GetByteContext gb;
|
||||
|
||||
if (data >= data_end)
|
||||
return -1;
|
||||
|
||||
bytestream2_init(&gb, data, data_end - data);
|
||||
|
||||
return amf_get_field_value2(&gb, name, dst, dst_size);
|
||||
}
|
||||
|
||||
static const char* rtmp_packet_type(int type)
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
@@ -166,7 +166,7 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
|
||||
parse_profile_level_id(s, h264_data, value);
|
||||
} else if (!strcmp(attr, "sprop-parameter-sets")) {
|
||||
int ret;
|
||||
if (value[strlen(value) - 1] == ',') {
|
||||
if (*value == 0 || value[strlen(value) - 1] == ',') {
|
||||
av_log(s, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, ignoring\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -4046,8 +4046,8 @@ void avformat_free_context(AVFormatContext *s)
|
||||
av_freep(&s->chapters);
|
||||
av_dict_free(&s->metadata);
|
||||
av_freep(&s->streams);
|
||||
av_freep(&s->internal);
|
||||
flush_packet_queue(s);
|
||||
av_freep(&s->internal);
|
||||
av_free(s);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
* The situation is undefined according to POSIX and may crash with
|
||||
* some libc implementations.
|
||||
*/
|
||||
av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Free a memory block which has been allocated with av_malloc(z)() or
|
||||
|
||||
Reference in New Issue
Block a user