Compare commits
142 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 028a032a31 | |||
| 124a3ddc4b | |||
| fc7e3955ae | |||
| acf1316167 | |||
| 24c49e0b42 | |||
| 4fb5f391ae | |||
| 4fb4a642c6 | |||
| adfefc9c9a | |||
| 1ab3e34cb4 | |||
| a9fb75893b | |||
| c28752f03a | |||
| d89941aa89 | |||
| 3f86cc0680 | |||
| c4ead1ab27 | |||
| 6d654eb036 | |||
| 439f3564fa | |||
| ab0e4b5b51 | |||
| 34a9bef0c9 | |||
| 4be2a19822 | |||
| 954c2b07b6 | |||
| 2c60731777 | |||
| 8bd6bf8214 | |||
| 9ad735588c | |||
| 34cad2f0e2 | |||
| ce28047755 | |||
| 235a55700b | |||
| 1a6f38b31b | |||
| 969485aace | |||
| 49efdb1e77 | |||
| 17b3485a67 | |||
| 91c7cc9726 | |||
| 32d1657192 | |||
| e1a854da2d | |||
| fc3e4c9ab3 | |||
| 50dd0e43af | |||
| e8a3b17dd4 | |||
| 5ee4c376d0 | |||
| 857c5fa976 | |||
| 42b9df5a98 | |||
| b48a36e773 | |||
| 02d11e616a | |||
| 13763f7192 | |||
| 380515e5b9 | |||
| a03d488ae2 | |||
| c09c0ce374 | |||
| 81bf24a827 | |||
| d6ff6dc56b | |||
| 37a14a3d83 | |||
| 5fdc679561 | |||
| b24b316e30 | |||
| 3e3e42dbc4 | |||
| 7d14046740 | |||
| e69edb7aef | |||
| cbc839681b | |||
| b51f515c5c | |||
| 4654cc8cee | |||
| 1fc3ebbcd9 | |||
| 314d78992c | |||
| 5f58877bd9 | |||
| d857f1035b | |||
| 4730046891 | |||
| 4e87ab803a | |||
| 4d9f669a9f | |||
| 7a8b61357c | |||
| d7c29005a4 | |||
| 8b8502a66f | |||
| d6ecc61db8 | |||
| 0bd6717c0f | |||
| 8bd2ba44a1 | |||
| fcfa854abd | |||
| 7373064247 | |||
| 374a2d2250 | |||
| 519a54cc19 | |||
| 4b1e87dc32 | |||
| b76dcd0786 | |||
| 70d0cc8221 | |||
| 1959c0f9f9 | |||
| f052d1df3e | |||
| 11f5a13196 | |||
| b2c9771dd4 | |||
| 16b07d59de | |||
| 0eb0b21c7f | |||
| 2db9b31996 | |||
| d9630deca4 | |||
| 79bec49315 | |||
| 2293e5a78a | |||
| 74b28c54d9 | |||
| 04be199f8e | |||
| 9e8a636551 | |||
| 397674a3fb | |||
| 720a44f3a3 | |||
| 5cf5a1034c | |||
| 6b66cd8c40 | |||
| ab2d991382 | |||
| 98f8f5b12f | |||
| 0a5251d28e | |||
| 2cfabd8ce7 | |||
| 87ef295ddf | |||
| 03bf78eba6 | |||
| f3c3cd5afb | |||
| 256ebf8bb4 | |||
| 36c0958fbd | |||
| 4e4177dde2 | |||
| c9527df274 | |||
| 372bb59438 | |||
| d5b42af8e7 | |||
| 2173539519 | |||
| 816f7337bf | |||
| 9cbac36026 | |||
| a051de092e | |||
| e29c9ef2d5 | |||
| 50d726273e | |||
| a4cc1101cc | |||
| d4fc6b211f | |||
| 5bc9f70441 | |||
| 2bbef8ee27 | |||
| 98e177c728 | |||
| f94517934b | |||
| 2920c7cec0 | |||
| baca98fc09 | |||
| 726133b6d2 | |||
| 3738a41830 | |||
| 53a6cdf89d | |||
| 50cb32480b | |||
| 74410f2aba | |||
| febea34f91 | |||
| 6da5e63ba7 | |||
| d15b1da8bc | |||
| dc86479e5f | |||
| 98cd9cd4c2 | |||
| bd09e3b19c | |||
| 5bc3b18e3d | |||
| 952393b69e | |||
| 04db307c77 | |||
| 342d5c20ce | |||
| 52c4069119 | |||
| e595087048 | |||
| b66aa37834 | |||
| 16ee405707 | |||
| 19938f1a11 | |||
| 892ceb512f | |||
| 5987b16f86 |
@@ -1,6 +1,147 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 3.2.10:
|
||||
- avcodec/utils: Avoid hardcoding duplicated types in sizeof()
|
||||
- avcodec/arm/sbrdsp_neon: Use a free register instead of putting 2 things in one
|
||||
- avformat/libssh: check the user provided a password before trying to use it
|
||||
- avcodec/h264addpx_template: Fixes integer overflows
|
||||
- avcodec/dirac_dwt: Fix overflows in COMPOSE_HAARiH0/COMPOSE_HAARiL0
|
||||
- avcodec/diracdec: Fix integer overflow with quant
|
||||
- avcodec/opus_parser: Check payload_len in parse_opus_ts_header()
|
||||
- avcodec/jpeg2000dsp: Fix integer overflows in ict_int()
|
||||
- avcodec/h264_slice: Do not attempt to render into frames already output
|
||||
- avcodec/dnxhddec: Check dc vlc
|
||||
- x264: Support version 153
|
||||
- avcodec/exr: Check buf_size more completely
|
||||
- avcodec/flacdec: Fix overflow in multiplication in decode_subframe_fixed()
|
||||
- avcodec/hevcdsp_template: Fix Invalid shifts in put_hevc_qpel_bi_w_h() and put_hevc_qpel_bi_w_w()
|
||||
- avcodec/flacdec: avoid undefined shift
|
||||
- avcodec/hevcdsp_template.c: Fix undefined shift in FUNC(dequant)
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD97iH0() and COMPOSE_DD137iL0()
|
||||
- avcodec/hevc_cabac: Fix integer overflow in ff_hevc_cu_qp_delta_abs()
|
||||
- tests/audiomatch: Add missing return code at the end of main()
|
||||
- avcodec/hevc_sei: Fix integer overflows in decode_nal_sei_message()
|
||||
- avcodec/hevcdsp_template: Fix undefined shift in put_hevc_qpel_bi_w_hv()
|
||||
- libavfilter/af_dcshift.c: Fixed repeated spelling error
|
||||
- avfilter/formats: fix wrong function name in error message
|
||||
- avcodec/amrwbdec: Fix division by 0 in voice_factor()
|
||||
- avcodec/diracdsp: Fix integer overflow in PUT_SIGNED_RECT_CLAMPED()
|
||||
- avcodec/dirac_dwt: Fix integer overflows in COMPOSE_DAUB97*
|
||||
- avcodec/vorbis: Fix another 1 << 31 > int32_t::max() with 1u.
|
||||
- Don't manipulate duration when it's AV_NOPTS_VALUE.
|
||||
- avcodec/vorbis: 1 << 31 > int32_t::max(), so use 1u << 31 instead.
|
||||
- avformat/utils: Prevent undefined shift with wrap_bits > 64.
|
||||
- avcodec/j2kenc: Fix out of array access in encode_cblk()
|
||||
- avcodec/hevcdsp_template: Fix undefined shift in put_hevc_epel_bi_w_h()
|
||||
- avcodec/mlpdsp: Fix signed integer overflow, 2nd try
|
||||
- avcodec/kgv1dec: Check that there is enough input for maximum RLE compression
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*
|
||||
- avcodec/mpeg4videodec: Check also for negative versions in the validity check
|
||||
- Close ogg stream upon error when using AV_EF_EXPLODE.
|
||||
- Fix undefined shift on assumed 8-bit input.
|
||||
- Use ff_thread_once for fixed, float table init.
|
||||
- avformat/mov: Propagate errors in mov_switch_root.
|
||||
- avcodec/hevcdsp_template: Fix invalid shift in put_hevc_epel_bi_w_v()
|
||||
- avcodec/mlpdsp: Fix undefined shift ff_mlp_pack_output()
|
||||
- avcodec/zmbv: Check that the buffer is large enough for mvec
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD137iL0()
|
||||
- avcodec/wmv2dec: Check end of bitstream in parse_mb_skip() and ff_wmv2_decode_mb()
|
||||
- avcodec/snowdec: Check for remaining bitstream in decode_blocks()
|
||||
- avcodec/snowdec: Check intra block dc differences.
|
||||
- avformat/mov: Check size of STSC allocation
|
||||
- avcodec/vc2enc: Clear coef_buf on allocation
|
||||
- avcodec/h264dec: Fix potential array overread
|
||||
- avcodec/x86/mpegvideodsp: Fix signedness bug in need_emu
|
||||
- avcodec/aacpsdsp_template: Fix integer overflows in ps_decorrelate_c()
|
||||
- avcodec/aacdec_fixed: Fix undefined shift
|
||||
- avcodec/mdct_*: Fix integer overflow in addition in RESCALE()
|
||||
- avcodec/snowdec: Fix integer overflow in header parsing
|
||||
- avcodec/cngdec: Fix integer clipping
|
||||
- avcodec/sbrdsp_fixed: Fix integer overflow in shift in sbr_hf_g_filt_c()
|
||||
- avcodec/aacsbr_fixed: Fix division by zero in sbr_gain_calc()
|
||||
- avutil/softfloat: Add FLOAT_MIN
|
||||
- avcodec/h264idct_template: Fix integer overflows in ff_h264_idct8_add()
|
||||
- avcodec/xan: Check for bitstream end in xan_huffman_decode()
|
||||
- avcodec/exr: fix undefined shift in pxr24_uncompress()
|
||||
- avformat: Free the internal codec context at the end
|
||||
- avcodec/xan: Improve overlapping check
|
||||
- avcodec/aacdec_fixed: Fix integer overflow in apply_dependent_coupling_fixed()
|
||||
- avcodec/aacdec_fixed: Fix integer overflow in predict()
|
||||
- avcodec/jpeglsdec: Check for end of bitstream in ls_decode_line()
|
||||
- avcodec/jpeglsdec: Check ilv for being a supported value
|
||||
- vc2enc_dwt: pad the temporary buffer by the slice size
|
||||
|
||||
version 3.2.9:
|
||||
- avcodec/snowdec: Check mv_scale
|
||||
- avcodec/pafvideo: Check for bitstream end in decode_0()
|
||||
- avcodec/ffv1dec: Fix out of array read in slice counting
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_53iL0()
|
||||
- avcodec/mpeg_er: Clear mcsel in mpeg_er_decode_mb()
|
||||
- avcodec/mpeg4videodec: Use 64 bit intermediates for sprite delta
|
||||
- avcodec/x86/lossless_videoencdsp: Fix handling of small widths
|
||||
- avcodec/truemotion2: Fix integer overflows in tm2_high_chroma()
|
||||
- avcodec/aacdec_template: Clear tns present flag on error
|
||||
- avcodec/proresdec2: SKIP_BITS() does not work with len=32
|
||||
- avcodec/hevcdsp_template: Fix undefined shift
|
||||
- avcodec/jpeg2000: Check that codsty->log2_prec_widths/heights has been initialized
|
||||
- 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
|
||||
|
||||
version 3.2.8:
|
||||
- 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
|
||||
- avcodec/dirac_vlc: limit res_bits in APPEND_RESIDUE()
|
||||
- libavcodec/h264_parse: don't use uninitialized value when chroma_format_idc==0
|
||||
- avformat/asfdec: Fix DoS in asf_build_simple_index()
|
||||
- avformat/mov: Fix DoS in read_tfra()
|
||||
- avcodec/dirac_vlc: Fix invalid shift in ff_dirac_golomb_read_32bit()
|
||||
- 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: Fixes integer overflow
|
||||
- avcodec/diracdec: Check perspective_exp and zrs_exp.
|
||||
- avcodec/ffv1dec_template: Fix undefined shift
|
||||
- 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
|
||||
- avcodec/diracdsp: fix integer overflow
|
||||
- avcodec/diracdec: Check weight_log2denom
|
||||
- avfilter/vf_ssim: fix temp size calculation
|
||||
|
||||
version 3.2.7:
|
||||
- avcodec/dirac_dwt: Fix multiple integer overflows in COMPOSE_DD97iH0()
|
||||
- avcodec/diracdec: Fix integer overflow in divide3()
|
||||
|
||||
@@ -6703,7 +6703,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2017
|
||||
#define CONFIG_THIS_YEAR 2018
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 3.2.7
|
||||
PROJECT_NUMBER = 3.2.10
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
@@ -293,6 +293,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.
|
||||
|
||||
@@ -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];
|
||||
@@ -2244,29 +2294,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 (par->field_order == AV_FIELD_PROGRESSIVE)
|
||||
print_str("field_order", "progressive");
|
||||
|
||||
@@ -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 += (unsigned)((pv.mant + (1 << (shift - 1))) >> shift);
|
||||
} else
|
||||
*coef += (unsigned)pv.mant << -shift;
|
||||
}
|
||||
}
|
||||
|
||||
e0 = av_int2sf(*coef, 2);
|
||||
@@ -390,7 +394,7 @@ static void apply_dependent_coupling_fixed(AACContext *ac,
|
||||
for (k = offsets[i]; k < offsets[i + 1]; k++) {
|
||||
tmp = (int)(((int64_t)src[group * 128 + k] * c + \
|
||||
(int64_t)0x1000000000) >> 37);
|
||||
dest[group * 128 + k] += tmp * (1 << shift);
|
||||
dest[group * 128 + k] += tmp * (1U << shift);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1259,6 +1259,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");
|
||||
@@ -1309,8 +1311,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];
|
||||
@@ -1334,7 +1338,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);
|
||||
@@ -1353,7 +1358,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||
return 0;
|
||||
fail:
|
||||
ics->max_sfb = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
return ret_fail;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1940,16 +1945,17 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
||||
global_gain = get_bits(gb, 8);
|
||||
|
||||
if (!common_window && !scale_flag) {
|
||||
if (decode_ics_info(ac, ics, gb) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = decode_ics_info(ac, ics, gb);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((ret = decode_band_types(ac, sce->band_type,
|
||||
sce->band_type_run_end, gb, ics)) < 0)
|
||||
return ret;
|
||||
goto fail;
|
||||
if ((ret = decode_scalefactors(ac, sce->sf, gb, global_gain, ics,
|
||||
sce->band_type, sce->band_type_run_end)) < 0)
|
||||
return ret;
|
||||
goto fail;
|
||||
|
||||
pulse_present = 0;
|
||||
if (!scale_flag) {
|
||||
@@ -1957,37 +1963,48 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
||||
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Pulse tool not allowed in eight short sequence.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Pulse data corrupt or invalid.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
tns->present = get_bits1(gb);
|
||||
if (tns->present && !er_syntax)
|
||||
if (decode_tns(ac, tns, gb, ics) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (tns->present && !er_syntax) {
|
||||
ret = decode_tns(ac, tns, gb, ics);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
if (!eld_syntax && get_bits1(gb)) {
|
||||
avpriv_request_sample(ac->avctx, "SSR");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
// I see no textual basis in the spec for this occurring after SSR gain
|
||||
// control, but this is what both reference and real implmentations do
|
||||
if (tns->present && er_syntax)
|
||||
if (decode_tns(ac, tns, gb, ics) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (tns->present && er_syntax) {
|
||||
ret = decode_tns(ac, tns, gb, ics);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present,
|
||||
&pulse, ics, sce->band_type) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present,
|
||||
&pulse, ics, sce->band_type);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN && !common_window)
|
||||
apply_prediction(ac, sce);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
tns->present = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,12 +129,12 @@ static void ps_decorrelate_c(INTFLOAT (*out)[2], INTFLOAT (*delay)[2],
|
||||
INTFLOAT apd_im = in_im;
|
||||
in_re = AAC_MSUB30(link_delay_re, fractional_delay_re,
|
||||
link_delay_im, fractional_delay_im);
|
||||
in_re -= a_re;
|
||||
in_re -= (UINTFLOAT)a_re;
|
||||
in_im = AAC_MADD30(link_delay_re, fractional_delay_im,
|
||||
link_delay_im, fractional_delay_re);
|
||||
in_im -= a_im;
|
||||
ap_delay[m][n+5][0] = apd_re + AAC_MUL31(ag[m], in_re);
|
||||
ap_delay[m][n+5][1] = apd_im + AAC_MUL31(ag[m], in_im);
|
||||
in_im -= (UINTFLOAT)a_im;
|
||||
ap_delay[m][n+5][0] = apd_re + (UINTFLOAT)AAC_MUL31(ag[m], in_re);
|
||||
ap_delay[m][n+5][1] = apd_im + (UINTFLOAT)AAC_MUL31(ag[m], in_im);
|
||||
}
|
||||
out[n][0] = AAC_MUL16(transient_gain[n], in_re);
|
||||
out[n][1] = AAC_MUL16(transient_gain[n], in_im);
|
||||
|
||||
@@ -437,6 +437,7 @@ static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
|
||||
av_add_sf(FLOAT_1, sbr->e_curr[e][m]),
|
||||
av_add_sf(FLOAT_1, sbr->q_mapped[e][m]))));
|
||||
}
|
||||
sbr->gain[e][m] = av_add_sf(sbr->gain[e][m], FLOAT_MIN);
|
||||
}
|
||||
for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
|
||||
sum[0] = av_add_sf(sum[0], sbr->e_origmapped[e][m]);
|
||||
|
||||
@@ -611,7 +611,7 @@ static float voice_factor(float *p_vector, float p_gain,
|
||||
AMRWB_SFR_SIZE) *
|
||||
f_gain * f_gain;
|
||||
|
||||
return (p_ener - f_ener) / (p_ener + f_ener);
|
||||
return (p_ener - f_ener) / (p_ener + f_ener + 0.01);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -336,11 +336,11 @@ function ff_sbr_hf_apply_noise_0_neon, export=1
|
||||
vld1.32 {d0}, [r0,:64]
|
||||
vld1.32 {d6}, [lr,:64]
|
||||
vld1.32 {d2[]}, [r1,:32]!
|
||||
vld1.32 {d3[]}, [r2,:32]!
|
||||
vld1.32 {d18[]}, [r2,:32]!
|
||||
vceq.f32 d4, d2, #0
|
||||
veor d2, d2, d3
|
||||
vmov d1, d0
|
||||
vmla.f32 d0, d6, d3
|
||||
vmla.f32 d0, d6, d18
|
||||
vadd.f32 s2, s2, s4
|
||||
vbif d0, d1, d4
|
||||
vst1.32 {d0}, [r0,:64]!
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return ret;
|
||||
buf_out = (int16_t *)frame->data[0];
|
||||
for (i = 0; i < avctx->frame_size; i++)
|
||||
buf_out[i] = p->filter_out[i + p->order];
|
||||
buf_out[i] = av_clip_int16(p->filter_out[i + p->order]);
|
||||
memcpy(p->filter_out, p->filter_out + avctx->frame_size,
|
||||
p->order * sizeof(*p->filter_out));
|
||||
|
||||
|
||||
+12
-12
@@ -93,40 +93,40 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
|
||||
|
||||
// shared stuff for simd optimizations
|
||||
#define COMPOSE_53iL0(b0, b1, b2)\
|
||||
(b1 - ((b0 + b2 + 2) >> 2))
|
||||
(b1 - ((int)(b0 + (unsigned)(b2) + 2) >> 2))
|
||||
|
||||
#define COMPOSE_DIRAC53iH0(b0, b1, b2)\
|
||||
(b1 + ((b0 + b2 + 1) >> 1))
|
||||
(b1 + ((int)(b0 + (unsigned)(b2) + 1) >> 1))
|
||||
|
||||
#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
|
||||
(b2 + ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 8) >> 4))
|
||||
(int)(((unsigned)(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))
|
||||
(int)(((unsigned)(b2) - ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 16) >> 5)))
|
||||
|
||||
#define COMPOSE_HAARiL0(b0, b1)\
|
||||
(b0 - ((b1 + 1) >> 1))
|
||||
((int)(b0 - (unsigned)((int)(b1 + 1U) >> 1)))
|
||||
|
||||
#define COMPOSE_HAARiH0(b0, b1)\
|
||||
(b0 + b1)
|
||||
((int)(b0 + (unsigned)(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))
|
||||
((unsigned)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))
|
||||
((unsigned)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))
|
||||
((unsigned)(b1) - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH1(b0, b1, b2)\
|
||||
(b1 - (( 113*(b0 + b2) + 64) >> 7))
|
||||
((unsigned)(b1) - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7))
|
||||
|
||||
#define COMPOSE_DAUB97iL0(b0, b1, b2)\
|
||||
(b1 + (( 217*(b0 + b2) + 2048) >> 12))
|
||||
((unsigned)(b1) + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH0(b0, b1, b2)\
|
||||
(b1 + ((6497*(b0 + b2) + 2048) >> 12))
|
||||
((unsigned)(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,
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#define APPEND_RESIDUE(N, M) \
|
||||
N |= M >> (N ## _bits); \
|
||||
N ## _bits += (M ## _bits)
|
||||
N ## _bits = (N ## _bits + (M ## _bits)) & 0x3F
|
||||
|
||||
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
|
||||
int bytes, uint8_t *_dst, int coeffs)
|
||||
|
||||
+17
-8
@@ -436,7 +436,7 @@ static av_cold int dirac_decode_end(AVCodecContext *avctx)
|
||||
static inline int coeff_unpack_golomb(GetBitContext *gb, int qfactor, int qoffset)
|
||||
{
|
||||
int coeff = dirac_get_se_golomb(gb);
|
||||
const int sign = FFSIGN(coeff);
|
||||
const unsigned sign = FFSIGN(coeff);
|
||||
if (coeff)
|
||||
coeff = sign*((sign * coeff * qfactor + qoffset) >> 2);
|
||||
return coeff;
|
||||
@@ -502,16 +502,16 @@ static inline void codeblock(DiracContext *s, SubBand *b,
|
||||
}
|
||||
|
||||
if (s->codeblock_mode && !(s->old_delta_quant && blockcnt_one)) {
|
||||
int quant = b->quant;
|
||||
int quant;
|
||||
if (is_arith)
|
||||
quant += dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA);
|
||||
quant = dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA);
|
||||
else
|
||||
quant += dirac_get_se_golomb(gb);
|
||||
if (quant < 0) {
|
||||
quant = dirac_get_se_golomb(gb);
|
||||
if (quant > INT_MAX - b->quant || b->quant + quant < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid quant\n");
|
||||
return;
|
||||
}
|
||||
b->quant = quant;
|
||||
b->quant += quant;
|
||||
}
|
||||
|
||||
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
|
||||
@@ -580,7 +580,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 ->
|
||||
@@ -1155,6 +1155,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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1173,6 +1177,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);
|
||||
@@ -1407,7 +1416,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,10 +159,10 @@ static void put_signed_rect_clamped_ ## PX ## bit_c(uint8_t *_dst, int dst_strid
|
||||
int32_t *src = (int32_t *)_src; \
|
||||
for (y = 0; y < height; y++) { \
|
||||
for (x = 0; x < width; x+=4) { \
|
||||
dst[x ] = av_clip_uintp2(src[x ] + (1 << (PX - 1)), PX); \
|
||||
dst[x+1] = av_clip_uintp2(src[x+1] + (1 << (PX - 1)), PX); \
|
||||
dst[x+2] = av_clip_uintp2(src[x+2] + (1 << (PX - 1)), PX); \
|
||||
dst[x+3] = av_clip_uintp2(src[x+3] + (1 << (PX - 1)), PX); \
|
||||
dst[x ] = av_clip_uintp2(src[x ] + (1U << (PX - 1)), PX); \
|
||||
dst[x+1] = av_clip_uintp2(src[x+1] + (1U << (PX - 1)), PX); \
|
||||
dst[x+2] = av_clip_uintp2(src[x+2] + (1U << (PX - 1)), PX); \
|
||||
dst[x+3] = av_clip_uintp2(src[x+3] + (1U << (PX - 1)), PX); \
|
||||
} \
|
||||
dst += dst_stride >> 1; \
|
||||
src += src_stride >> 2; \
|
||||
@@ -199,7 +199,7 @@ static void dequant_subband_ ## PX ## _c(uint8_t *src, uint8_t *dst, ptrdiff_t s
|
||||
for (i = 0; i < tot_h; i++) { \
|
||||
c = *src_r++; \
|
||||
sign = FFSIGN(c)*(!!c); \
|
||||
c = (FFABS(c)*qf + qs) >> 2; \
|
||||
c = (FFABS(c)*(unsigned)qf + qs) >> 2; \
|
||||
*dst_r++ = c*sign; \
|
||||
} \
|
||||
src += tot_h << (sizeof(PX) >> 1); \
|
||||
|
||||
@@ -372,6 +372,10 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
|
||||
|
||||
UPDATE_CACHE(bs, &row->gb);
|
||||
GET_VLC(len, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1);
|
||||
if (len < 0) {
|
||||
ret = len;
|
||||
goto error;
|
||||
}
|
||||
if (len) {
|
||||
level = GET_CACHE(bs, &row->gb);
|
||||
LAST_SKIP_BITS(bs, &row->gb, len);
|
||||
@@ -425,7 +429,7 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
|
||||
GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table,
|
||||
DNXHD_VLC_BITS, 2);
|
||||
}
|
||||
|
||||
error:
|
||||
CLOSE_READER(bs, &row->gb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
+5
-5
@@ -864,7 +864,7 @@ static int pxr24_uncompress(EXRContext *s, const uint8_t *src,
|
||||
in = ptr[2] + td->xsize;
|
||||
|
||||
for (j = 0; j < td->xsize; ++j) {
|
||||
uint32_t diff = (*(ptr[0]++) << 24) |
|
||||
uint32_t diff = ((unsigned)*(ptr[0]++) << 24) |
|
||||
(*(ptr[1]++) << 16) |
|
||||
(*(ptr[2]++) << 8);
|
||||
pixel += diff;
|
||||
@@ -1044,7 +1044,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
line_offset = AV_RL64(s->gb.buffer + jobnr * 8);
|
||||
|
||||
if (s->is_tile) {
|
||||
if (line_offset > buf_size - 20)
|
||||
if (buf_size < 20 || line_offset > buf_size - 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
src = buf + line_offset + 20;
|
||||
@@ -1055,7 +1055,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
tileLevelY = AV_RL32(src - 8);
|
||||
|
||||
data_size = AV_RL32(src - 4);
|
||||
if (data_size <= 0 || data_size > buf_size)
|
||||
if (data_size <= 0 || data_size > buf_size - line_offset - 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (tileLevelX || tileLevelY) { /* tile level, is not the full res level */
|
||||
@@ -1088,7 +1088,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */
|
||||
uncompressed_size = td->channel_line_size * (uint64_t)td->ysize;/* uncompress size of the block */
|
||||
} else {
|
||||
if (line_offset > buf_size - 8)
|
||||
if (buf_size < 8 || line_offset > buf_size - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
src = buf + line_offset + 8;
|
||||
@@ -1098,7 +1098,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
data_size = AV_RL32(src - 4);
|
||||
if (data_size <= 0 || data_size > buf_size)
|
||||
if (data_size <= 0 || data_size > buf_size - line_offset - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
td->ysize = FFMIN(s->scan_lines_per_block, s->ymax - line + 1); /* s->ydelta - line ?? */
|
||||
|
||||
@@ -359,7 +359,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;
|
||||
@@ -684,7 +684,7 @@ static int read_header(FFV1Context *f)
|
||||
} else {
|
||||
const uint8_t *p = c->bytestream_end;
|
||||
for (f->slice_count = 0;
|
||||
f->slice_count < MAX_SLICES && 3 < p - c->bytestream_start;
|
||||
f->slice_count < MAX_SLICES && 3 + 5*!!f->ec < p - c->bytestream_start;
|
||||
f->slice_count++) {
|
||||
int trailer = 3 + 5*!!f->ec;
|
||||
int size = AV_RB24(p-trailer);
|
||||
|
||||
@@ -149,7 +149,7 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[3], int w, int
|
||||
}
|
||||
|
||||
if (lbd)
|
||||
*((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + (g<<8) + (r<<16) + (a<<24);
|
||||
*((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + ((unsigned)g<<8) + ((unsigned)r<<16) + ((unsigned)a<<24);
|
||||
else if (sizeof(TYPE) == 4) {
|
||||
*((uint16_t*)(src[0] + x*2 + stride[0]*y)) = g;
|
||||
*((uint16_t*)(src[1] + x*2 + stride[1]*y)) = b;
|
||||
|
||||
+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];
|
||||
|
||||
@@ -287,7 +287,7 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
|
||||
if (pred_order > 2)
|
||||
c = b - decoded[pred_order-2] + decoded[pred_order-3];
|
||||
if (pred_order > 3)
|
||||
d = c - decoded[pred_order-2] + 2*decoded[pred_order-3] - decoded[pred_order-4];
|
||||
d = c - decoded[pred_order-2] + 2U*decoded[pred_order-3] - decoded[pred_order-4];
|
||||
|
||||
switch (pred_order) {
|
||||
case 0:
|
||||
@@ -445,7 +445,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (wasted) {
|
||||
if (wasted && wasted < 32) {
|
||||
int i;
|
||||
for (i = 0; i < s->blocksize; i++)
|
||||
decoded[i] = (unsigned)decoded[i] << wasted;
|
||||
|
||||
+15
-12
@@ -34,21 +34,22 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
|
||||
pwt->use_weight = 0;
|
||||
pwt->use_weight_chroma = 0;
|
||||
pwt->luma_log2_weight_denom = get_ue_golomb(gb);
|
||||
if (sps->chroma_format_idc)
|
||||
pwt->chroma_log2_weight_denom = get_ue_golomb(gb);
|
||||
|
||||
pwt->luma_log2_weight_denom = get_ue_golomb(gb);
|
||||
if (pwt->luma_log2_weight_denom > 7U) {
|
||||
av_log(logctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", pwt->luma_log2_weight_denom);
|
||||
pwt->luma_log2_weight_denom = 0;
|
||||
}
|
||||
if (pwt->chroma_log2_weight_denom > 7U) {
|
||||
av_log(logctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", pwt->chroma_log2_weight_denom);
|
||||
pwt->chroma_log2_weight_denom = 0;
|
||||
}
|
||||
luma_def = 1 << pwt->luma_log2_weight_denom;
|
||||
|
||||
luma_def = 1 << pwt->luma_log2_weight_denom;
|
||||
chroma_def = 1 << pwt->chroma_log2_weight_denom;
|
||||
if (sps->chroma_format_idc) {
|
||||
pwt->chroma_log2_weight_denom = get_ue_golomb(gb);
|
||||
if (pwt->chroma_log2_weight_denom > 7U) {
|
||||
av_log(logctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", pwt->chroma_log2_weight_denom);
|
||||
pwt->chroma_log2_weight_denom = 0;
|
||||
}
|
||||
chroma_def = 1 << pwt->chroma_log2_weight_denom;
|
||||
}
|
||||
|
||||
for (list = 0; list < 2; list++) {
|
||||
pwt->luma_weight_flag[list] = 0;
|
||||
@@ -102,9 +103,11 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
if (picture_structure == PICT_FRAME) {
|
||||
pwt->luma_weight[16 + 2 * i][list][0] = pwt->luma_weight[16 + 2 * i + 1][list][0] = pwt->luma_weight[i][list][0];
|
||||
pwt->luma_weight[16 + 2 * i][list][1] = pwt->luma_weight[16 + 2 * i + 1][list][1] = pwt->luma_weight[i][list][1];
|
||||
for (j = 0; j < 2; j++) {
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][0] = pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = pwt->chroma_weight[i][list][j][0];
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][1] = pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = pwt->chroma_weight[i][list][j][1];
|
||||
if (sps->chroma_format_idc) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][0] = pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = pwt->chroma_weight[i][list][j][0];
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][1] = pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = pwt->chroma_weight[i][list][j][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-7
@@ -1462,6 +1462,12 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
|
||||
* one except for reference purposes. */
|
||||
h->first_field = 1;
|
||||
h->cur_pic_ptr = NULL;
|
||||
} else if (h->cur_pic_ptr->reference & DELAYED_PIC_REF) {
|
||||
/* This frame was already output, we cannot draw into it
|
||||
* anymore.
|
||||
*/
|
||||
h->first_field = 1;
|
||||
h->cur_pic_ptr = NULL;
|
||||
} else {
|
||||
/* Second field in complementary pair */
|
||||
h->first_field = 0;
|
||||
@@ -1739,17 +1745,19 @@ static int h264_slice_header_parse(const 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride)
|
||||
stride /= sizeof(pixel);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
dst[2] += src[2];
|
||||
dst[3] += src[3];
|
||||
dst[0] += (unsigned)src[0];
|
||||
dst[1] += (unsigned)src[1];
|
||||
dst[2] += (unsigned)src[2];
|
||||
dst[3] += (unsigned)src[3];
|
||||
|
||||
dst += stride;
|
||||
src += 4;
|
||||
@@ -55,14 +55,14 @@ static void FUNCC(ff_h264_add_pixels8)(uint8_t *_dst, int16_t *_src, int stride)
|
||||
stride /= sizeof(pixel);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
dst[0] += src[0];
|
||||
dst[1] += src[1];
|
||||
dst[2] += src[2];
|
||||
dst[3] += src[3];
|
||||
dst[4] += src[4];
|
||||
dst[5] += src[5];
|
||||
dst[6] += src[6];
|
||||
dst[7] += src[7];
|
||||
dst[0] += (unsigned)src[0];
|
||||
dst[1] += (unsigned)src[1];
|
||||
dst[2] += (unsigned)src[2];
|
||||
dst[3] += (unsigned)src[3];
|
||||
dst[4] += (unsigned)src[4];
|
||||
dst[5] += (unsigned)src[5];
|
||||
dst[6] += (unsigned)src[6];
|
||||
dst[7] += (unsigned)src[7];
|
||||
|
||||
dst += stride;
|
||||
src += 8;
|
||||
|
||||
@@ -422,6 +422,7 @@ typedef struct H264Context {
|
||||
uint8_t (*mvd_table[2])[2];
|
||||
uint8_t *direct_table;
|
||||
|
||||
uint8_t scan_padding[16];
|
||||
uint8_t zigzag_scan[16];
|
||||
uint8_t zigzag_scan8x8[64];
|
||||
uint8_t zigzag_scan8x8_cavlc[64];
|
||||
|
||||
@@ -91,10 +91,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
|
||||
const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
|
||||
const int a7 = block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
|
||||
|
||||
const int b1 = (a7>>2) + a1;
|
||||
const int b3 = a3 + (a5>>2);
|
||||
const int b5 = (a3>>2) - a5;
|
||||
const int b7 = a7 - (a1>>2);
|
||||
const int b1 = (a7>>2) + (unsigned)a1;
|
||||
const int b3 = (unsigned)a3 + (a5>>2);
|
||||
const int b5 = (a3>>2) - (unsigned)a5;
|
||||
const int b7 = (unsigned)a7 - (a1>>2);
|
||||
|
||||
block[i+0*8] = b0 + b7;
|
||||
block[i+7*8] = b0 - b7;
|
||||
|
||||
+2
-2
@@ -545,8 +545,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;
|
||||
|
||||
|
||||
@@ -633,8 +633,10 @@ int ff_hevc_cu_qp_delta_abs(HEVCContext *s)
|
||||
suffix_val += 1 << k;
|
||||
k++;
|
||||
}
|
||||
if (k == CABAC_MAX_BIN)
|
||||
if (k == CABAC_MAX_BIN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
while (k--)
|
||||
suffix_val += get_cabac_bypass(&s->HEVClc->cc) << k;
|
||||
|
||||
+15
-3
@@ -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);
|
||||
@@ -1014,10 +1026,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -344,11 +344,15 @@ static int decode_nal_sei_message(HEVCContext *s)
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "Decoding SEI\n");
|
||||
|
||||
while (byte == 0xFF) {
|
||||
if (get_bits_left(gb) < 16 || payload_type > INT_MAX - 255)
|
||||
return AVERROR_INVALIDDATA;
|
||||
byte = get_bits(gb, 8);
|
||||
payload_type += byte;
|
||||
}
|
||||
byte = 0xFF;
|
||||
while (byte == 0xFF) {
|
||||
if (get_bits_left(gb) < 8 + 8LL*payload_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
byte = get_bits(gb, 8);
|
||||
payload_size += byte;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ static void FUNC(transform_skip)(int16_t *_coeffs, int16_t log2_size)
|
||||
} else {
|
||||
for (y = 0; y < size; y++) {
|
||||
for (x = 0; x < size; x++) {
|
||||
*coeffs = *coeffs << -shift;
|
||||
*coeffs = *(uint16_t*)coeffs << -shift;
|
||||
coeffs++;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -921,7 +921,7 @@ static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -976,7 +976,7 @@ static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -1057,7 +1057,7 @@ static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uin
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
tmp += MAX_PB_SIZE;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -1361,7 +1361,7 @@ static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -1413,7 +1413,7 @@ static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
src += srcstride;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
@@ -1492,7 +1492,7 @@ static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uin
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
|
||||
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
|
||||
((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
|
||||
tmp += MAX_PB_SIZE;
|
||||
dst += dststride;
|
||||
src2 += MAX_PB_SIZE;
|
||||
|
||||
+2
-1
@@ -688,7 +688,8 @@ static void encode_cblk(Jpeg2000EncoderContext *s, Jpeg2000T1Context *t1, Jpeg20
|
||||
cblk->npasses = passno;
|
||||
cblk->ninclpasses = passno;
|
||||
|
||||
cblk->passes[passno-1].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno-1].flushed, &cblk->passes[passno-1].flushed_len);
|
||||
if (passno)
|
||||
cblk->passes[passno-1].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno-1].flushed, &cblk->passes[passno-1].flushed_len);
|
||||
}
|
||||
|
||||
/* tier-2 routines: */
|
||||
|
||||
@@ -506,6 +506,9 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
// update precincts size: 2^n value
|
||||
reslevel->log2_prec_width = codsty->log2_prec_widths[reslevelno];
|
||||
reslevel->log2_prec_height = codsty->log2_prec_heights[reslevelno];
|
||||
if (!reslevel->log2_prec_width || !reslevel->log2_prec_height) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* Number of bands for each resolution level */
|
||||
if (reslevelno == 0)
|
||||
|
||||
@@ -64,10 +64,10 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < csize; i++) {
|
||||
i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16);
|
||||
i1 = *src0 - (((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);
|
||||
i0 = *src0 + *src2 + ((int)((26345U * *src2) + (1 << 15)) >> 16);
|
||||
i1 = *src0 - ((int)(((unsigned)i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
||||
- ((int)(((unsigned)i_ict_params[2] * *src2) + (1 << 15)) >> 16);
|
||||
i2 = *src0 + (2 * *src1) + ((int)((-14942U * *src1) + (1 << 15)) >> 16);
|
||||
*src0++ = i0;
|
||||
*src1++ = i1;
|
||||
*src2++ = i2;
|
||||
|
||||
@@ -233,6 +233,9 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s,
|
||||
while (x < w) {
|
||||
int err, pred;
|
||||
|
||||
if (get_bits_left(&s->gb) <= 0)
|
||||
return;
|
||||
|
||||
/* compute gradients */
|
||||
Ra = x ? R(dst, x - stride) : R(last, x);
|
||||
Rb = R(last, x);
|
||||
@@ -438,6 +441,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
||||
avpriv_report_missing_feature(s->avctx, "Sample interleaved images");
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto end;
|
||||
} else { /* unknown interleaving */
|
||||
avpriv_report_missing_feature(s->avctx, "Unknown interleaved images");
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (s->xfrm && s->nb_components == 3) {
|
||||
|
||||
@@ -62,6 +62,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
h = (buf[1] + 1) * 8;
|
||||
buf += 2;
|
||||
|
||||
if (avpkt->size < 2 + w*h / 513)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (w != avctx->width || h != avctx->height) {
|
||||
av_freep(&c->frame_buffer);
|
||||
av_freep(&c->last_frame_buffer);
|
||||
|
||||
@@ -279,7 +279,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
|
||||
|
||||
x264_picture_init( &x4->pic );
|
||||
x4->pic.img.i_csp = x4->params.i_csp;
|
||||
#if X264_BUILD >= 153
|
||||
if (x4->params.i_bitdepth > 8)
|
||||
#else
|
||||
if (x264_bit_depth > 8)
|
||||
#endif
|
||||
x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH;
|
||||
x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt);
|
||||
|
||||
@@ -490,6 +494,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
|
||||
x4->params.p_log_private = avctx;
|
||||
x4->params.i_log_level = X264_LOG_DEBUG;
|
||||
x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt);
|
||||
#if X264_BUILD >= 153
|
||||
x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth;
|
||||
#endif
|
||||
|
||||
PARSE_X264_OPT("weightp", wpredp);
|
||||
|
||||
@@ -878,6 +885,24 @@ static const enum AVPixelFormat pix_fmts_10bit[] = {
|
||||
AV_PIX_FMT_NV20,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
static const enum AVPixelFormat pix_fmts_all[] = {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_YUVJ420P,
|
||||
AV_PIX_FMT_YUV422P,
|
||||
AV_PIX_FMT_YUVJ422P,
|
||||
AV_PIX_FMT_YUV444P,
|
||||
AV_PIX_FMT_YUVJ444P,
|
||||
AV_PIX_FMT_NV12,
|
||||
AV_PIX_FMT_NV16,
|
||||
#ifdef X264_CSP_NV21
|
||||
AV_PIX_FMT_NV21,
|
||||
#endif
|
||||
AV_PIX_FMT_YUV420P10,
|
||||
AV_PIX_FMT_YUV422P10,
|
||||
AV_PIX_FMT_YUV444P10,
|
||||
AV_PIX_FMT_NV20,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
#if CONFIG_LIBX264RGB_ENCODER
|
||||
static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
|
||||
AV_PIX_FMT_BGR0,
|
||||
@@ -889,12 +914,16 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
|
||||
|
||||
static av_cold void X264_init_static(AVCodec *codec)
|
||||
{
|
||||
#if X264_BUILD < 153
|
||||
if (x264_bit_depth == 8)
|
||||
codec->pix_fmts = pix_fmts_8bit;
|
||||
else if (x264_bit_depth == 9)
|
||||
codec->pix_fmts = pix_fmts_9bit;
|
||||
else if (x264_bit_depth == 10)
|
||||
codec->pix_fmts = pix_fmts_10bit;
|
||||
#else
|
||||
codec->pix_fmts = pix_fmts_all;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(X264Context, x)
|
||||
|
||||
@@ -39,13 +39,13 @@ void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input)
|
||||
|
||||
/* pre rotation */
|
||||
for(i=0;i<n8;i++) {
|
||||
re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
|
||||
re = RSCALE(-input[2*i+n3], - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i], + input[n4-1-2*i]);
|
||||
j = revtab[i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
|
||||
|
||||
re = RSCALE( input[2*i] - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
|
||||
re = RSCALE( input[2*i] , - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i], - input[ n-1-2*i]);
|
||||
j = revtab[n8 + i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
*/
|
||||
|
||||
#if FFT_FLOAT
|
||||
# define RSCALE(x) (x)
|
||||
# define RSCALE(x, y) ((x) + (y))
|
||||
#else
|
||||
#if FFT_FIXED_32
|
||||
# define RSCALE(x) (((x) + 32) >> 6)
|
||||
# define RSCALE(x, y) ((int)((x) + (unsigned)(y) + 32) >> 6)
|
||||
#else /* FFT_FIXED_32 */
|
||||
# define RSCALE(x) ((x) >> 1)
|
||||
# define RSCALE(x, y) ((int)((x) + (unsigned)(y)) >> 1)
|
||||
#endif /* FFT_FIXED_32 */
|
||||
#endif
|
||||
|
||||
@@ -181,13 +181,13 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
|
||||
|
||||
/* pre rotation */
|
||||
for(i=0;i<n8;i++) {
|
||||
re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
|
||||
re = RSCALE(-input[2*i+n3], - input[n3-1-2*i]);
|
||||
im = RSCALE(-input[n4+2*i], + input[n4-1-2*i]);
|
||||
j = revtab[i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
|
||||
|
||||
re = RSCALE( input[2*i] - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
|
||||
re = RSCALE( input[2*i] , - input[n2-1-2*i]);
|
||||
im = RSCALE(-input[n2+2*i], - input[ n-1-2*i]);
|
||||
j = revtab[n8 + i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
|
||||
}
|
||||
|
||||
+5
-5
@@ -628,7 +628,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);
|
||||
}
|
||||
@@ -668,7 +668,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
|
||||
@@ -695,7 +695,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++)
|
||||
@@ -714,7 +714,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));
|
||||
|
||||
@@ -817,7 +817,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 =
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ int32_t ff_mlp_pack_output(int32_t lossless_check_data,
|
||||
(1U << output_shift[mat_ch]);
|
||||
lossless_check_data ^= (sample & 0xffffff) << mat_ch;
|
||||
if (is32)
|
||||
*data_32++ = sample << 8;
|
||||
*data_32++ = sample * 256U;
|
||||
else
|
||||
*data_16++ = sample >> 8;
|
||||
}
|
||||
|
||||
+50
-41
@@ -179,6 +179,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int sprite_ref[4][2];
|
||||
int virtual_ref[2][2];
|
||||
int64_t sprite_offset[2][2];
|
||||
int64_t sprite_delta[2][2];
|
||||
|
||||
// only true for rectangle shapes
|
||||
const int vop_ref[4][2] = { { 0, 0 }, { s->width, 0 },
|
||||
@@ -262,10 +263,10 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
sprite_offset[0][1] =
|
||||
sprite_offset[1][0] =
|
||||
sprite_offset[1][1] = 0;
|
||||
s->sprite_delta[0][0] = a;
|
||||
s->sprite_delta[0][1] =
|
||||
s->sprite_delta[1][0] = 0;
|
||||
s->sprite_delta[1][1] = a;
|
||||
sprite_delta[0][0] = a;
|
||||
sprite_delta[0][1] =
|
||||
sprite_delta[1][0] = 0;
|
||||
sprite_delta[1][1] = a;
|
||||
ctx->sprite_shift[0] =
|
||||
ctx->sprite_shift[1] = 0;
|
||||
break;
|
||||
@@ -276,10 +277,10 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
a * (vop_ref[0][0] / 2);
|
||||
sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) -
|
||||
a * (vop_ref[0][1] / 2);
|
||||
s->sprite_delta[0][0] = a;
|
||||
s->sprite_delta[0][1] =
|
||||
s->sprite_delta[1][0] = 0;
|
||||
s->sprite_delta[1][1] = a;
|
||||
sprite_delta[0][0] = a;
|
||||
sprite_delta[0][1] =
|
||||
sprite_delta[1][0] = 0;
|
||||
sprite_delta[1][1] = a;
|
||||
ctx->sprite_shift[0] =
|
||||
ctx->sprite_shift[1] = 0;
|
||||
break;
|
||||
@@ -304,10 +305,10 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
((int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
|
||||
(int64_t) sprite_ref[0][1] - 16 * w2 + (1 << (alpha + rho + 1)));
|
||||
s->sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
|
||||
s->sprite_delta[0][1] = (+r * sprite_ref[0][1] - virtual_ref[0][1]);
|
||||
s->sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]);
|
||||
s->sprite_delta[1][1] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
|
||||
sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
|
||||
sprite_delta[0][1] = (+r * sprite_ref[0][1] - virtual_ref[0][1]);
|
||||
sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]);
|
||||
sprite_delta[1][1] = (-r * sprite_ref[0][0] + virtual_ref[0][0]);
|
||||
|
||||
ctx->sprite_shift[0] = alpha + rho;
|
||||
ctx->sprite_shift[1] = alpha + rho + 2;
|
||||
@@ -332,28 +333,28 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
((int64_t)-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-2 * vop_ref[0][1] + 1) +
|
||||
(int64_t)2 * w2 * h3 * r * sprite_ref[0][1] - 16 * w2 * h3 +
|
||||
((int64_t)1 << (alpha + beta + rho - min_ab + 1));
|
||||
s->sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3;
|
||||
s->sprite_delta[0][1] = (-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3;
|
||||
s->sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3;
|
||||
s->sprite_delta[1][1] = (-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3;
|
||||
sprite_delta[0][0] = (-r * (int64_t)sprite_ref[0][0] + virtual_ref[0][0]) * h3;
|
||||
sprite_delta[0][1] = (-r * (int64_t)sprite_ref[0][0] + virtual_ref[1][0]) * w3;
|
||||
sprite_delta[1][0] = (-r * (int64_t)sprite_ref[0][1] + virtual_ref[0][1]) * h3;
|
||||
sprite_delta[1][1] = (-r * (int64_t)sprite_ref[0][1] + virtual_ref[1][1]) * w3;
|
||||
|
||||
ctx->sprite_shift[0] = alpha + beta + rho - min_ab;
|
||||
ctx->sprite_shift[1] = alpha + beta + rho - min_ab + 2;
|
||||
break;
|
||||
}
|
||||
/* try to simplify the situation */
|
||||
if (s->sprite_delta[0][0] == a << ctx->sprite_shift[0] &&
|
||||
s->sprite_delta[0][1] == 0 &&
|
||||
s->sprite_delta[1][0] == 0 &&
|
||||
s->sprite_delta[1][1] == a << ctx->sprite_shift[0]) {
|
||||
if (sprite_delta[0][0] == a << ctx->sprite_shift[0] &&
|
||||
sprite_delta[0][1] == 0 &&
|
||||
sprite_delta[1][0] == 0 &&
|
||||
sprite_delta[1][1] == a << ctx->sprite_shift[0]) {
|
||||
sprite_offset[0][0] >>= ctx->sprite_shift[0];
|
||||
sprite_offset[0][1] >>= ctx->sprite_shift[0];
|
||||
sprite_offset[1][0] >>= ctx->sprite_shift[1];
|
||||
sprite_offset[1][1] >>= ctx->sprite_shift[1];
|
||||
s->sprite_delta[0][0] = a;
|
||||
s->sprite_delta[0][1] = 0;
|
||||
s->sprite_delta[1][0] = 0;
|
||||
s->sprite_delta[1][1] = a;
|
||||
sprite_delta[0][0] = a;
|
||||
sprite_delta[0][1] = 0;
|
||||
sprite_delta[1][0] = 0;
|
||||
sprite_delta[1][1] = a;
|
||||
ctx->sprite_shift[0] = 0;
|
||||
ctx->sprite_shift[1] = 0;
|
||||
s->real_sprite_warping_points = 1;
|
||||
@@ -365,8 +366,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
if (shift_c < 0 || shift_y < 0 ||
|
||||
FFABS( sprite_offset[0][i]) >= INT_MAX >> shift_y ||
|
||||
FFABS( sprite_offset[1][i]) >= INT_MAX >> shift_c ||
|
||||
FFABS(s->sprite_delta[0][i]) >= INT_MAX >> shift_y ||
|
||||
FFABS(s->sprite_delta[1][i]) >= INT_MAX >> shift_y
|
||||
FFABS( sprite_delta[0][i]) >= INT_MAX >> shift_y ||
|
||||
FFABS( sprite_delta[1][i]) >= INT_MAX >> shift_y
|
||||
) {
|
||||
avpriv_request_sample(s->avctx, "Too large sprite shift, delta or offset");
|
||||
goto overflow;
|
||||
@@ -376,22 +377,22 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
for (i = 0; i < 2; i++) {
|
||||
sprite_offset[0][i] *= 1 << shift_y;
|
||||
sprite_offset[1][i] *= 1 << shift_c;
|
||||
s->sprite_delta[0][i] *= 1 << shift_y;
|
||||
s->sprite_delta[1][i] *= 1 << shift_y;
|
||||
sprite_delta[0][i] *= 1 << shift_y;
|
||||
sprite_delta[1][i] *= 1 << shift_y;
|
||||
ctx->sprite_shift[i] = 16;
|
||||
|
||||
}
|
||||
for (i = 0; i < 2; i++) {
|
||||
int64_t sd[2] = {
|
||||
s->sprite_delta[i][0] - a * (1LL<<16),
|
||||
s->sprite_delta[i][1] - a * (1LL<<16)
|
||||
sprite_delta[i][0] - a * (1LL<<16),
|
||||
sprite_delta[i][1] - a * (1LL<<16)
|
||||
};
|
||||
|
||||
if (llabs(sprite_offset[0][i] + s->sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + s->sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + s->sprite_delta[i][0] * (w+16LL) + s->sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_delta[i][1] * (w+16LL)) >= INT_MAX ||
|
||||
if (llabs(sprite_offset[0][i] + sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + sprite_delta[i][0] * (w+16LL) + sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_delta[i][1] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sd[0]) >= INT_MAX ||
|
||||
llabs(sd[1]) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + sd[0] * (w+16LL)) >= INT_MAX ||
|
||||
@@ -405,10 +406,10 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
s->real_sprite_warping_points = ctx->num_sprite_warping_points;
|
||||
}
|
||||
|
||||
s->sprite_offset[0][0] = sprite_offset[0][0];
|
||||
s->sprite_offset[0][1] = sprite_offset[0][1];
|
||||
s->sprite_offset[1][0] = sprite_offset[1][0];
|
||||
s->sprite_offset[1][1] = sprite_offset[1][1];
|
||||
for (i = 0; i < 4; i++) {
|
||||
s->sprite_offset[i&1][i>>1] = sprite_offset[i&1][i>>1];
|
||||
s->sprite_delta [i&1][i>>1] = sprite_delta [i&1][i>>1];
|
||||
}
|
||||
|
||||
return 0;
|
||||
overflow:
|
||||
@@ -2148,8 +2149,15 @@ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
e = sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
|
||||
if (e != 4) {
|
||||
e = sscanf(buf, "Lavc%d.%d.%d", &ver, &ver2, &ver3) + 1;
|
||||
if (e > 1)
|
||||
build = (ver << 16) + (ver2 << 8) + ver3;
|
||||
if (e > 1) {
|
||||
if (ver > 0xFFU || ver2 > 0xFFU || ver3 > 0xFFU) {
|
||||
av_log(s->avctx, AV_LOG_WARNING,
|
||||
"Unknown Lavc version string encountered, %d.%d.%d; "
|
||||
"clamping sub-version values to 8-bits.\n",
|
||||
ver, ver2, ver3);
|
||||
}
|
||||
build = ((ver & 0xFF) << 16) + ((ver2 & 0xFF) << 8) + (ver3 & 0xFF);
|
||||
}
|
||||
}
|
||||
if (e != 4) {
|
||||
if (strcmp(buf, "ffmpeg") == 0)
|
||||
@@ -2290,6 +2298,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)) {
|
||||
|
||||
@@ -71,6 +71,7 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
|
||||
s->mb_skipped = mb_skipped;
|
||||
s->mb_x = mb_x;
|
||||
s->mb_y = mb_y;
|
||||
s->mcsel = 0;
|
||||
memcpy(s->mv, mv, sizeof(*mv));
|
||||
|
||||
ff_init_block_index(s);
|
||||
|
||||
@@ -20,17 +20,21 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/thread.h"
|
||||
#include "mpegaudiodsp.h"
|
||||
#include "dct.h"
|
||||
#include "dct32.h"
|
||||
|
||||
static AVOnce mpadsp_float_table_init = AV_ONCE_INIT;
|
||||
static AVOnce mpadsp_fixed_table_init = AV_ONCE_INIT;
|
||||
|
||||
av_cold void ff_mpadsp_init(MPADSPContext *s)
|
||||
{
|
||||
DCTContext dct;
|
||||
|
||||
ff_dct_init(&dct, 5, DCT_II);
|
||||
ff_init_mpadsp_tabs_float();
|
||||
ff_init_mpadsp_tabs_fixed();
|
||||
ff_thread_once(&mpadsp_float_table_init, &ff_init_mpadsp_tabs_float);
|
||||
ff_thread_once(&mpadsp_fixed_table_init, &ff_init_mpadsp_tabs_fixed);
|
||||
|
||||
s->apply_window_float = ff_mpadsp_apply_window_float;
|
||||
s->apply_window_fixed = ff_mpadsp_apply_window_fixed;
|
||||
|
||||
@@ -43,6 +43,7 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le
|
||||
const uint8_t *buf = start + 1;
|
||||
int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
|
||||
uint8_t flags;
|
||||
uint64_t payload_len_tmp;
|
||||
|
||||
GetByteContext gb;
|
||||
bytestream2_init(&gb, buf, buf_len);
|
||||
@@ -52,11 +53,11 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le
|
||||
end_trim_flag = (flags >> 3) & 1;
|
||||
control_extension_flag = (flags >> 2) & 1;
|
||||
|
||||
*payload_len = 0;
|
||||
payload_len_tmp = *payload_len = 0;
|
||||
while (bytestream2_peek_byte(&gb) == 0xff)
|
||||
*payload_len += bytestream2_get_byte(&gb);
|
||||
payload_len_tmp += bytestream2_get_byte(&gb);
|
||||
|
||||
*payload_len += bytestream2_get_byte(&gb);
|
||||
payload_len_tmp += bytestream2_get_byte(&gb);
|
||||
|
||||
if (start_trim_flag)
|
||||
bytestream2_skip(&gb, 2);
|
||||
@@ -67,6 +68,11 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le
|
||||
bytestream2_skip(&gb, control_extension_length);
|
||||
}
|
||||
|
||||
if (bytestream2_tell(&gb) + payload_len_tmp > buf_len)
|
||||
return NULL;
|
||||
|
||||
*payload_len = payload_len_tmp;
|
||||
|
||||
return buf + bytestream2_tell(&gb);
|
||||
}
|
||||
|
||||
@@ -104,6 +110,10 @@ static int opus_find_frame_end(AVCodecParserContext *ctx, AVCodecContext *avctx,
|
||||
state = (state << 8) | payload[i];
|
||||
if ((state & OPUS_TS_MASK) == OPUS_TS_HEADER) {
|
||||
payload = parse_opus_ts_header(payload, &payload_len, buf_size - i);
|
||||
if (!payload) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error parsing Ogg TS header.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
*header_len = payload - buf;
|
||||
start_found = 1;
|
||||
break;
|
||||
|
||||
@@ -181,6 +181,8 @@ static int decode_0(PAFVideoDecContext *c, uint8_t *pkt, uint8_t code)
|
||||
dend = c->frame[page] + c->frame_size;
|
||||
offset = (x & 0x7F) * 2;
|
||||
j = bytestream2_get_le16(&c->gb) + offset;
|
||||
if (bytestream2_get_bytes_left(&c->gb) < (j - offset) * 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
do {
|
||||
offset++;
|
||||
if (dst + 3 * c->width + 4 > dend)
|
||||
@@ -198,7 +200,8 @@ static int decode_0(PAFVideoDecContext *c, uint8_t *pkt, uint8_t code)
|
||||
do {
|
||||
set_src_position(c, &src, &send);
|
||||
if ((src + 3 * c->width + 4 > send) ||
|
||||
(dst + 3 * c->width + 4 > dend))
|
||||
(dst + 3 * c->width + 4 > dend) ||
|
||||
bytestream2_get_bytes_left(&c->gb) < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
copy_block4(dst, src, c->width, c->width, 4);
|
||||
i++;
|
||||
|
||||
@@ -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 > FFMIN(MIN_CACHE_BITS, 31)) \
|
||||
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;
|
||||
|
||||
|
||||
+25
-23
@@ -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);
|
||||
}
|
||||
@@ -233,12 +233,14 @@ static void sbr_hf_g_filt_c(int (*Y)[2], const int (*X_high)[40][2],
|
||||
int64_t accu;
|
||||
|
||||
for (m = 0; m < m_max; m++) {
|
||||
int64_t r = 1LL << (22-g_filt[m].exp);
|
||||
accu = (int64_t)X_high[m][ixh][0] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][0] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
if (22 - g_filt[m].exp < 61) {
|
||||
int64_t r = 1LL << (22-g_filt[m].exp);
|
||||
accu = (int64_t)X_high[m][ixh][0] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][0] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
|
||||
accu = (int64_t)X_high[m][ixh][1] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][1] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
accu = (int64_t)X_high[m][ixh][1] * ((g_filt[m].mant + 0x40)>>7);
|
||||
Y[m][1] = (int)((accu + r) >> (23-g_filt[m].exp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+24
-12
@@ -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;
|
||||
|
||||
@@ -183,13 +183,22 @@ static int decode_q_branch(SnowContext *s, int level, int x, int y){
|
||||
int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
|
||||
|
||||
type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0;
|
||||
|
||||
if(type){
|
||||
int ld, cbd, crd;
|
||||
pred_mv(s, &mx, &my, 0, left, top, tr);
|
||||
l += get_symbol(&s->c, &s->block_state[32], 1);
|
||||
ld = get_symbol(&s->c, &s->block_state[32], 1);
|
||||
if (ld < -255 || ld > 255) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
l += ld;
|
||||
if (s->nb_planes > 2) {
|
||||
cb+= get_symbol(&s->c, &s->block_state[64], 1);
|
||||
cr+= get_symbol(&s->c, &s->block_state[96], 1);
|
||||
cbd = get_symbol(&s->c, &s->block_state[64], 1);
|
||||
crd = get_symbol(&s->c, &s->block_state[96], 1);
|
||||
if (cbd < -255 || cbd > 255 || crd < -255 || crd > 255) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
cb += cbd;
|
||||
cr += crd;
|
||||
}
|
||||
}else{
|
||||
if(s->ref_frames > 1)
|
||||
@@ -355,7 +364,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--){
|
||||
@@ -374,7 +383,7 @@ static int decode_header(SnowContext *s){
|
||||
}
|
||||
}
|
||||
|
||||
s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1);
|
||||
s->spatial_decomposition_type+= (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
if(s->spatial_decomposition_type > 1U){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_type %d not supported\n", s->spatial_decomposition_type);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -390,13 +399,14 @@ static int decode_header(SnowContext *s){
|
||||
}
|
||||
|
||||
|
||||
s->qlog += get_symbol(&s->c, s->header_state, 1);
|
||||
s->mv_scale += get_symbol(&s->c, s->header_state, 1);
|
||||
s->qbias += get_symbol(&s->c, s->header_state, 1);
|
||||
s->block_max_depth+= get_symbol(&s->c, s->header_state, 1);
|
||||
if(s->block_max_depth > 1 || s->block_max_depth < 0){
|
||||
s->qlog += (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
s->mv_scale += (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
s->qbias += (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
s->block_max_depth+= (unsigned)get_symbol(&s->c, s->header_state, 1);
|
||||
if(s->block_max_depth > 1 || s->block_max_depth < 0 || s->mv_scale > 256U){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "block_max_depth= %d is too large\n", s->block_max_depth);
|
||||
s->block_max_depth= 0;
|
||||
s->mv_scale = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (FFABS(s->qbias) > 127) {
|
||||
@@ -427,6 +437,8 @@ static int decode_blocks(SnowContext *s){
|
||||
|
||||
for(y=0; y<h; y++){
|
||||
for(x=0; x<w; x++){
|
||||
if (s->c.bytestream >= s->c.bytestream_end)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((res = decode_q_branch(s, 0, x, y)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
||||
+1
-1
@@ -285,7 +285,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));
|
||||
|
||||
+5
-5
@@ -206,7 +206,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;
|
||||
}
|
||||
@@ -486,10 +486,10 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
|
||||
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)) - (unsigned)*decoded;
|
||||
*decoded++ = v;
|
||||
|
||||
@@ -465,7 +465,7 @@ static inline void tm2_apply_deltas(TM2Context *ctx, int* Y, int stride, int *de
|
||||
}
|
||||
}
|
||||
|
||||
static inline void tm2_high_chroma(int *data, int stride, int *last, int *CD, int *deltas)
|
||||
static inline void tm2_high_chroma(int *data, int stride, int *last, unsigned *CD, int *deltas)
|
||||
{
|
||||
int i, j;
|
||||
for (j = 0; j < 2; j++) {
|
||||
|
||||
+3
-3
@@ -1274,7 +1274,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
avctx->internal = av_mallocz(sizeof(AVCodecInternal));
|
||||
avctx->internal = av_mallocz(sizeof(*avctx->internal));
|
||||
if (!avctx->internal) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto end;
|
||||
@@ -1570,7 +1570,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) {
|
||||
@@ -2766,7 +2766,7 @@ void avsubtitle_free(AVSubtitle *sub)
|
||||
|
||||
av_freep(&sub->rects);
|
||||
|
||||
memset(sub, 0, sizeof(AVSubtitle));
|
||||
memset(sub, 0, sizeof(*sub));
|
||||
}
|
||||
|
||||
static int do_decode(AVCodecContext *avctx, AVPacket *pkt)
|
||||
|
||||
+3
-2
@@ -1171,7 +1171,7 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx)
|
||||
p->dwt_width = w = FFALIGN(p->width, (1 << s->wavelet_depth));
|
||||
p->dwt_height = h = FFALIGN(p->height, (1 << s->wavelet_depth));
|
||||
p->coef_stride = FFALIGN(p->dwt_width, 32);
|
||||
p->coef_buf = av_malloc(p->coef_stride*p->dwt_height*sizeof(dwtcoef));
|
||||
p->coef_buf = av_mallocz(p->coef_stride*p->dwt_height*sizeof(dwtcoef));
|
||||
if (!p->coef_buf)
|
||||
goto alloc_fail;
|
||||
for (level = s->wavelet_depth-1; level >= 0; level--) {
|
||||
@@ -1190,7 +1190,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 */
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
|
||||
if (bits[p] > 32)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = 0; i < bits[p]; ++i)
|
||||
exit_at_level[i+1] = 1 << i;
|
||||
exit_at_level[i+1] = 1u << i;
|
||||
|
||||
++p;
|
||||
|
||||
@@ -91,7 +91,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
|
||||
exit_at_level[i] = 0;
|
||||
// construct code (append 0s to end) and introduce new exits
|
||||
for (j = i + 1 ;j <= bits[p]; ++j)
|
||||
exit_at_level[j] = code + (1 << (j - 1));
|
||||
exit_at_level[j] = code + (1u << (j - 1));
|
||||
codes[p] = code;
|
||||
}
|
||||
|
||||
|
||||
+16
-2
@@ -30,7 +30,7 @@
|
||||
#include "wmv2.h"
|
||||
|
||||
|
||||
static void parse_mb_skip(Wmv2Context *w)
|
||||
static int parse_mb_skip(Wmv2Context *w)
|
||||
{
|
||||
int mb_x, mb_y;
|
||||
MpegEncContext *const s = &w->s;
|
||||
@@ -45,6 +45,8 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
MB_TYPE_16x16 | MB_TYPE_L0;
|
||||
break;
|
||||
case SKIP_TYPE_MPEG:
|
||||
if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
|
||||
mb_type[mb_y * s->mb_stride + mb_x] =
|
||||
@@ -52,6 +54,8 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
break;
|
||||
case SKIP_TYPE_ROW:
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||
if (get_bits_left(&s->gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits1(&s->gb)) {
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++)
|
||||
mb_type[mb_y * s->mb_stride + mb_x] =
|
||||
@@ -65,6 +69,8 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
break;
|
||||
case SKIP_TYPE_COL:
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
if (get_bits_left(&s->gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits1(&s->gb)) {
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++)
|
||||
mb_type[mb_y * s->mb_stride + mb_x] =
|
||||
@@ -77,6 +83,7 @@ static void parse_mb_skip(Wmv2Context *w)
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_ext_header(Wmv2Context *w)
|
||||
@@ -170,9 +177,12 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
|
||||
}
|
||||
} else {
|
||||
int cbp_index;
|
||||
int ret;
|
||||
w->j_type = 0;
|
||||
|
||||
parse_mb_skip(w);
|
||||
ret = parse_mb_skip(w);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cbp_index = decode012(&s->gb);
|
||||
w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
|
||||
|
||||
@@ -359,6 +369,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
w->hshift = 0;
|
||||
return 0;
|
||||
}
|
||||
if (get_bits_left(&s->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
|
||||
MB_NON_INTRA_VLC_BITS, 3);
|
||||
@@ -369,6 +381,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
cbp = code & 0x3f;
|
||||
} else {
|
||||
s->mb_intra = 1;
|
||||
if (get_bits_left(&s->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
|
||||
if (code < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
|
||||
@@ -42,10 +42,11 @@ cglobal diff_bytes, 4,5,2, dst, src1, src2, w
|
||||
%define i t0q
|
||||
%endmacro
|
||||
|
||||
; label to jump to if w < regsize
|
||||
%macro DIFF_BYTES_LOOP_PREP 1
|
||||
; labels to jump to if w < regsize and w < 0
|
||||
%macro DIFF_BYTES_LOOP_PREP 2
|
||||
mov i, wq
|
||||
and i, -2 * regsize
|
||||
js %2
|
||||
jz %1
|
||||
add dstq, i
|
||||
add src1q, i
|
||||
@@ -87,7 +88,7 @@ cglobal diff_bytes, 4,5,2, dst, src1, src2, w
|
||||
%if mmsize > 16
|
||||
; fall back to narrower xmm
|
||||
%define regsize mmsize / 2
|
||||
DIFF_BYTES_LOOP_PREP .setup_loop_gpr_aa
|
||||
DIFF_BYTES_LOOP_PREP .setup_loop_gpr_aa, .end_aa
|
||||
.loop2_%1%2:
|
||||
DIFF_BYTES_LOOP_CORE %1, %2, xm0, xm1
|
||||
add i, 2 * regsize
|
||||
@@ -114,7 +115,7 @@ cglobal diff_bytes, 4,5,2, dst, src1, src2, w
|
||||
INIT_MMX mmx
|
||||
DIFF_BYTES_PROLOGUE
|
||||
%define regsize mmsize
|
||||
DIFF_BYTES_LOOP_PREP .skip_main_aa
|
||||
DIFF_BYTES_LOOP_PREP .skip_main_aa, .end_aa
|
||||
DIFF_BYTES_BODY a, a
|
||||
%undef i
|
||||
%endif
|
||||
@@ -122,7 +123,7 @@ DIFF_BYTES_PROLOGUE
|
||||
INIT_XMM sse2
|
||||
DIFF_BYTES_PROLOGUE
|
||||
%define regsize mmsize
|
||||
DIFF_BYTES_LOOP_PREP .skip_main_aa
|
||||
DIFF_BYTES_LOOP_PREP .skip_main_aa, .end_aa
|
||||
test dstq, regsize - 1
|
||||
jnz .loop_uu
|
||||
test src1q, regsize - 1
|
||||
@@ -138,7 +139,7 @@ DIFF_BYTES_PROLOGUE
|
||||
%define regsize mmsize
|
||||
; Directly using unaligned SSE2 version is marginally faster than
|
||||
; branching based on arguments.
|
||||
DIFF_BYTES_LOOP_PREP .skip_main_uu
|
||||
DIFF_BYTES_LOOP_PREP .skip_main_uu, .end_uu
|
||||
test dstq, regsize - 1
|
||||
jnz .loop_uu
|
||||
test src1q, regsize - 1
|
||||
|
||||
@@ -52,8 +52,9 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src,
|
||||
const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);
|
||||
const int dxh = dxy * (h - 1);
|
||||
const int dyw = dyx * (w - 1);
|
||||
int need_emu = (unsigned) ix >= width - w ||
|
||||
(unsigned) iy >= height - h;
|
||||
int need_emu = (unsigned) ix >= width - w || width < w ||
|
||||
(unsigned) iy >= height - h || height< h
|
||||
;
|
||||
|
||||
if ( // non-constant fullpel offset (3% of blocks)
|
||||
((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -131,7 +131,10 @@ static int xan_huffman_decode(uint8_t *dest, int dest_len,
|
||||
return ret;
|
||||
|
||||
while (val != 0x16) {
|
||||
unsigned idx = val - 0x17 + get_bits1(&gb) * byte;
|
||||
unsigned idx;
|
||||
if (get_bits_left(&gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
idx = val - 0x17 + get_bits1(&gb) * byte;
|
||||
if (idx >= 2 * byte)
|
||||
return AVERROR_INVALIDDATA;
|
||||
val = src[idx];
|
||||
@@ -263,7 +266,7 @@ static inline void xan_wc3_copy_pixel_run(XanContext *s, AVFrame *frame,
|
||||
prevframe_index = (y + motion_y) * stride + x + motion_x;
|
||||
prevframe_x = x + motion_x;
|
||||
|
||||
if (prev_palette_plane == palette_plane && FFABS(curframe_index - prevframe_index) < pixel_count) {
|
||||
if (prev_palette_plane == palette_plane && FFABS(motion_x + width*motion_y) < pixel_count) {
|
||||
avpriv_request_sample(s->avctx, "Overlapping copy");
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -539,6 +539,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
} else {
|
||||
frame->key_frame = 0;
|
||||
frame->pict_type = AV_PICTURE_TYPE_P;
|
||||
if (c->decomp_len < 2LL * ((c->width + c->bw - 1) / c->bw) * ((c->height + c->bh - 1) / c->bh))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (c->decomp_len)
|
||||
c->decode_xor(c);
|
||||
}
|
||||
|
||||
+10
-10
@@ -28,7 +28,7 @@
|
||||
typedef struct DCShiftContext {
|
||||
const AVClass *class;
|
||||
double dcshift;
|
||||
double limiterthreshhold;
|
||||
double limiterthreshold;
|
||||
double limitergain;
|
||||
} DCShiftContext;
|
||||
|
||||
@@ -47,7 +47,7 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
{
|
||||
DCShiftContext *s = ctx->priv;
|
||||
|
||||
s->limiterthreshhold = INT32_MAX * (1.0 - (fabs(s->dcshift) - s->limitergain));
|
||||
s->limiterthreshold = INT32_MAX * (1.0 - (fabs(s->dcshift) - s->limitergain));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -106,14 +106,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
|
||||
d = src[j];
|
||||
|
||||
if (d > s->limiterthreshhold && dcshift > 0) {
|
||||
d = (d - s->limiterthreshhold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshhold) +
|
||||
s->limiterthreshhold + dcshift;
|
||||
} else if (d < -s->limiterthreshhold && dcshift < 0) {
|
||||
d = (d + s->limiterthreshhold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshhold) -
|
||||
s->limiterthreshhold + dcshift;
|
||||
if (d > s->limiterthreshold && dcshift > 0) {
|
||||
d = (d - s->limiterthreshold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshold) +
|
||||
s->limiterthreshold + dcshift;
|
||||
} else if (d < -s->limiterthreshold && dcshift < 0) {
|
||||
d = (d + s->limiterthreshold) * s->limitergain /
|
||||
(INT32_MAX - s->limiterthreshold) -
|
||||
s->limiterthreshold + dcshift;
|
||||
} else {
|
||||
d = dcshift * INT32_MAX + d;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ do {
|
||||
for (j = 0; j < b->nb; j++) \
|
||||
if (a->fmts[i] == b->fmts[j]) { \
|
||||
if(k >= FFMIN(a->nb, b->nb)){ \
|
||||
av_log(NULL, AV_LOG_ERROR, "Duplicate formats in avfilter_merge_formats() detected\n"); \
|
||||
av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s detected\n", __FUNCTION__); \
|
||||
av_free(ret->fmts); \
|
||||
av_free(ret); \
|
||||
return NULL; \
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -205,6 +205,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)
|
||||
@@ -1255,6 +1256,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)
|
||||
@@ -1286,6 +1288,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) {
|
||||
@@ -2143,6 +2148,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}
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -688,9 +688,9 @@ static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, const cha
|
||||
}
|
||||
|
||||
if (decode_str(s, pb, 0, &dst, &len) < 0)
|
||||
return;
|
||||
goto end;
|
||||
if (len < 16)
|
||||
return;
|
||||
goto end;
|
||||
|
||||
start = avio_rb32(pb);
|
||||
end = avio_rb32(pb);
|
||||
|
||||
@@ -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;
|
||||
|
||||
+15
-3
@@ -2390,6 +2390,8 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
avio_rb24(pb); /* flags */
|
||||
|
||||
entries = avio_rb32(pb);
|
||||
if ((uint64_t)entries * 12 + 4 > atom.size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
av_log(c->fc, AV_LOG_TRACE, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
|
||||
|
||||
@@ -4888,7 +4890,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;
|
||||
@@ -5394,6 +5396,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);
|
||||
@@ -5661,6 +5670,7 @@ static int should_retry(AVIOContext *pb, int error_code) {
|
||||
|
||||
static int mov_switch_root(AVFormatContext *s, int64_t target)
|
||||
{
|
||||
int ret;
|
||||
MOVContext *mov = s->priv_data;
|
||||
int i, j;
|
||||
int already_read = 0;
|
||||
@@ -5697,8 +5707,10 @@ static int mov_switch_root(AVFormatContext *s, int64_t target)
|
||||
|
||||
mov->found_mdat = 0;
|
||||
|
||||
if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
|
||||
avio_feof(s->pb))
|
||||
ret = mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX });
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (avio_feof(s->pb))
|
||||
return AVERROR_EOF;
|
||||
av_log(s, AV_LOG_TRACE, "read fragments, offset 0x%"PRIx64"\n", avio_tell(s->pb));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -500,7 +500,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;
|
||||
}
|
||||
@@ -899,6 +899,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))) ||
|
||||
@@ -909,6 +911,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')) {
|
||||
|
||||
@@ -709,8 +709,10 @@ static int ogg_read_header(AVFormatContext *s)
|
||||
"Headers mismatch for stream %d: "
|
||||
"expected %d received %d.\n",
|
||||
i, os->codec->nb_header, os->nb_header);
|
||||
if (s->error_recognition & AV_EF_EXPLODE)
|
||||
if (s->error_recognition & AV_EF_EXPLODE) {
|
||||
ogg_read_close(s);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (os->start_granule != OGG_NOGRANULE_VALUE)
|
||||
os->lastpts = s->streams[i]->start_time =
|
||||
|
||||
@@ -125,7 +125,7 @@ static int vp8_packet(AVFormatContext *s, int idx)
|
||||
os->lastdts = vp8_gptopts(s, idx, os->granule, NULL) - duration;
|
||||
if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
|
||||
s->streams[idx]->start_time = os->lastpts;
|
||||
if (s->streams[idx]->duration)
|
||||
if (s->streams[idx]->duration && s->streams[idx]->duration != AV_NOPTS_VALUE)
|
||||
s->streams[idx]->duration -= s->streams[idx]->start_time;
|
||||
}
|
||||
}
|
||||
|
||||
+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
@@ -1238,8 +1238,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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+5
-9
@@ -1710,13 +1710,14 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
if (next_pkt->dts != AV_NOPTS_VALUE) {
|
||||
int wrap_bits = s->streams[next_pkt->stream_index]->pts_wrap_bits;
|
||||
av_assert2(wrap_bits <= 64);
|
||||
// last dts seen for this stream. if any of packets following
|
||||
// current one had no dts, we will set this to AV_NOPTS_VALUE.
|
||||
int64_t last_dts = next_pkt->dts;
|
||||
while (pktl && next_pkt->pts == AV_NOPTS_VALUE) {
|
||||
if (pktl->pkt.stream_index == next_pkt->stream_index &&
|
||||
(av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1)) < 0)) {
|
||||
if (av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) {
|
||||
av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2ULL << (wrap_bits - 1)) < 0) {
|
||||
if (av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2ULL << (wrap_bits - 1))) {
|
||||
// not B-frame
|
||||
next_pkt->pts = pktl->pkt.dts;
|
||||
}
|
||||
@@ -3737,12 +3738,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
}
|
||||
|
||||
// close codecs which were opened in try_decode_frame()
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
st = ic->streams[i];
|
||||
avcodec_close(st->internal->avctx);
|
||||
}
|
||||
|
||||
ff_rfps_calculate(ic);
|
||||
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
@@ -3923,6 +3918,7 @@ find_stream_info_err:
|
||||
st = ic->streams[i];
|
||||
if (st->info)
|
||||
av_freep(&st->info->duration_error);
|
||||
avcodec_close(ic->streams[i]->internal->avctx);
|
||||
av_freep(&ic->streams[i]->info);
|
||||
}
|
||||
if (ic->pb)
|
||||
@@ -4172,8 +4168,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ static const SoftFloat FLOAT_EPSILON = { 0x29F16B12, -16};
|
||||
static const SoftFloat FLOAT_1584893192 = { 0x32B771ED, 1}; ///< 1.584893192 (10^.2)
|
||||
static const SoftFloat FLOAT_100000 = { 0x30D40000, 17}; ///< 100000
|
||||
static const SoftFloat FLOAT_0999999 = { 0x3FFFFBCE, 0}; ///< 0.999999
|
||||
static const SoftFloat FLOAT_MIN = { 0x20000000, MIN_EXP};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,4 +107,6 @@ int main(int argc, char **argv){
|
||||
}
|
||||
}
|
||||
printf("presig: %d postsig:%d c:%7.4f lenerr:%d\n", bestpos, datlen - siglen - bestpos, bestc / sigamp, datlen - siglen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user