Compare commits
196 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93e2cb4511 | |||
| d4b5ffeb57 | |||
| b8ef20becf | |||
| d7bda29820 | |||
| 01645d5915 | |||
| 7af6fba145 | |||
| 3e3704da0c | |||
| 6de499caed | |||
| 41458534aa | |||
| 9b56e65e8c | |||
| 9b1a4da668 | |||
| c9452899db | |||
| 0e5946d5b2 | |||
| 23f13130f1 | |||
| 30c26bb78f | |||
| ae2c159b87 | |||
| 1d3c141af4 | |||
| 3f949b7a64 | |||
| 49336482fd | |||
| 15d4dc0da1 | |||
| d79b274acc | |||
| 769cb89738 | |||
| 8a89cce372 | |||
| 899d40c17f | |||
| a89b45b492 | |||
| 5b586f0bc8 | |||
| 719b9b673c | |||
| 02bf1c617c | |||
| edfe9ae63b | |||
| 3a29fda42a | |||
| e61cdbe271 | |||
| e0a08c833d | |||
| 8cf7205a72 | |||
| 42bd425205 | |||
| e89d8ed7cb | |||
| fef832c188 | |||
| 6daa205cd3 | |||
| e908a595db | |||
| c3e774784b | |||
| 4d45d5b606 | |||
| 5909508e8d | |||
| bafb13dc0f | |||
| bcc6d40928 | |||
| f3562ee6fc | |||
| b9d5b1f05d | |||
| 4018d8586f | |||
| b172815c3c | |||
| 1a387f1ce6 | |||
| 205689ae8a | |||
| af5c12c029 | |||
| 93a16aebf2 | |||
| 37cd7f3375 | |||
| 1a4f8de03d | |||
| 2a85ead5a3 | |||
| 659a23e89f | |||
| 519d48c861 | |||
| 878fc42a90 | |||
| e8fb74c0c9 | |||
| 76a886dae3 | |||
| f03616d2a4 | |||
| 0df3ad79c7 | |||
| 65fc03589f | |||
| 55e6c6b5fe | |||
| 66881cf2b5 | |||
| 838d02fcff | |||
| 0322f78177 | |||
| 4d4656e8cd | |||
| a97335b1b3 | |||
| d07a0ae1af | |||
| 55f9c21363 | |||
| 38384cdd99 | |||
| 4019c2a67c | |||
| bb5748ec9d | |||
| 90cfaff0bb | |||
| 093c80747b | |||
| 61a911d007 | |||
| d74839d793 | |||
| aec30d0da9 | |||
| dbe356a009 | |||
| ce82d4722b | |||
| fb27cebc93 | |||
| 162bbc22e2 | |||
| 60bc7a6ec0 | |||
| a9fb2f8c80 | |||
| 488a6ae7e5 | |||
| eecb0ecf51 | |||
| 68f9a9fe4b | |||
| 980fe1b7a6 | |||
| 68ca7aefb2 | |||
| 7965ffbeb1 | |||
| d8e501de42 | |||
| 014ba5c737 | |||
| bf7715fd29 | |||
| 347744121b | |||
| ba2f8469ba | |||
| e4afafaa7e | |||
| d81bfc042c | |||
| 05a9266894 | |||
| e2edfff9a8 | |||
| fea559c3d5 | |||
| 09419de216 | |||
| dfd2f4ee26 | |||
| d68d537f0a | |||
| 4bb40c32ee | |||
| 802ebfae3b | |||
| f85b102c80 | |||
| 03292829aa | |||
| 96e8400553 | |||
| 54897d7466 | |||
| f2b83f4aba | |||
| 1bc06771d8 | |||
| 2cde8dc055 | |||
| 0da741ba6b | |||
| b66e3e321f | |||
| 1d9830cba3 | |||
| 41a706b912 | |||
| 7a5c738963 | |||
| bdba0f6786 | |||
| badca11741 | |||
| b7c9f27ad6 | |||
| 603845225c | |||
| 3d297038a9 | |||
| 054188db10 | |||
| 454a2405ce | |||
| 01ab4117dc | |||
| 39db2f9514 | |||
| 272a9687a7 | |||
| 9bc2f44c27 | |||
| 85ea121684 | |||
| 79ec638115 | |||
| c8bbddf057 | |||
| cead6c94c5 | |||
| d5bdcd8a27 | |||
| 7bc064d461 | |||
| 70dc266342 | |||
| 2de4eb6fec | |||
| 11a940adbc | |||
| edd0cd21f4 | |||
| 362967fec6 | |||
| a0eccf673c | |||
| fa29141e34 | |||
| f4e25620a1 | |||
| 1c9af4d7a8 | |||
| 78a0356fae | |||
| 4a412dc6ad | |||
| 01439fe1e1 | |||
| 488c2e8487 | |||
| 74104d2dc0 | |||
| 066c657376 | |||
| aac7ca7a36 | |||
| 96fe37a339 | |||
| b3067f95c9 | |||
| 8be48f1c9a | |||
| c1d31ccfac | |||
| c8027878d0 | |||
| 286e3bf174 | |||
| 19fb467fcb | |||
| 67208cf992 | |||
| 56a56c0cb5 | |||
| d3264c496a | |||
| ffa2d60ac5 | |||
| 4a47195d2a | |||
| 912448efc1 | |||
| 6fb7e324fe | |||
| faa84a0c06 | |||
| 02612c3e3e | |||
| 18fbf2622c | |||
| 3d6ffa2bb5 | |||
| b33d302195 | |||
| ca47e9ffdc | |||
| a7aac19933 | |||
| 670d3189e9 | |||
| 60b385a5bf | |||
| b33434ec62 | |||
| 0ccb27e094 | |||
| e8fd32b69f | |||
| 20fd9217d8 | |||
| 48933f28c2 | |||
| d13d3feba2 | |||
| aa6c44c333 | |||
| 0009272f94 | |||
| 7cc854ce15 | |||
| 0a231e7dd3 | |||
| ab43bc50c0 | |||
| 4768b30b5b | |||
| 6b9ffcdb2b | |||
| 520daf8c0e | |||
| c54317a17e | |||
| ab845587d1 | |||
| 4bc16930ef | |||
| b5b52c0ca7 | |||
| 940659036f | |||
| 6d1ebb9def | |||
| 4e341bd904 | |||
| bf6cd808be | |||
| 9f7042f9cd |
@@ -1,6 +1,200 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 3.3.7:
|
||||
- avformat/utils: Check cur_dts in update_initial_timestamps() more
|
||||
- avcodec/utils: Enforce minimum width also for VP5/6
|
||||
- avcodec/truemotion2: Propagate out of bounds error from GET_TOK()
|
||||
- avformat/utils: Fix integer overflow in end time calculation in update_stream_timings()
|
||||
- avformat/utils: fix mixed declarations and code
|
||||
- avcodec/mjpegdec: Check input buffer size.
|
||||
- avcodec/h264_slice: Fix integer overflow with last_poc
|
||||
- avformat/mov: Fix extradata memleak
|
||||
- lavc/libopusdec: Allow avcodec_open2 to call .close
|
||||
- avcodec/movtextdec: Check style_start/end
|
||||
- avcodec/aacsbr_fixed: Fix integer overflow in sbr_hf_assemble()
|
||||
- libavcodec/rv34: error out earlier on missing references
|
||||
- swresample/swresample: Fix for seg fault in swr_convert_internal() -> sum2_float during dithering.
|
||||
- avcodec/aacdec_fixed: Fix integer overflow in apply_independent_coupling_fixed()
|
||||
- avcodec/cscd: Error out when LZ* decompression fails
|
||||
- avcodec/imgconvert: Fix loss mask bug in avcodec_find_best_pix_fmt_of_list()
|
||||
- avfilter/vf_signature: use av_strlcpy()
|
||||
- avcodec/utvideodec: Set pro flag based on fourcc
|
||||
- avcodec/wmalosslessdec: Fix null pointer dereference in decode_frame()
|
||||
- avcodec/tableprint_vlc: Fix build failure with --enable-hardcoded-tables
|
||||
- avformat/mov: Move +1 in check to avoid hypothetical overflow in add_ctts_entry()
|
||||
- avcodec/get_bits: Make sure the input bitstream with padding can be addressed
|
||||
- avformat/mov: Check STSC and remove invalid entries
|
||||
- avcodec/nuv: rtjpeg with dimensions less than 16 would result in no decoded pixels thus reject it
|
||||
- avcodec/nuv: Check for minimum input size for uncomprssed and rtjpeg
|
||||
- avcodec/wmalosslessdec: Reset num_saved_bits on error path
|
||||
- avformat/mov: Fix integer overflows related to sample_duration
|
||||
- avformat/oggparsedaala: Do not adjust AV_NOPTS_VALUE
|
||||
- avformat/oggparseogm: Check lb against psize
|
||||
- avformat/oggparseogm: Fix undefined shift in ogm_packet()
|
||||
- avformat/avidec: Fix integer overflow in cum_len check
|
||||
- avformat/oggparsetheora: Do not adjust AV_NOPTS_VALUE
|
||||
- avformat/utils: Fix integer overflow of fps_first/last_dts
|
||||
- avformat/oggdec: Fix metadata memleak on multiple headers
|
||||
- libavformat/oggparsevorbis: Fix memleak on multiple headers
|
||||
- avcodec/truemotion2rt: Check input buffer size
|
||||
- avcodec/g2meet: Check tile dimensions with av_image_check_size2()
|
||||
- avcodec/exr: fix invalid shift in unpack_14()
|
||||
- avcodec/bintext: sanity check dimensions
|
||||
- avcodec/utvideodec: Check subsample factors
|
||||
- avcodec/smc: Check input packet size
|
||||
- avcodec/cavsdec: Check alpha/beta offset
|
||||
- avcodec/diracdec: Fix integer overflow in mv computation
|
||||
- avcodec/h264_parse: Clear invalid chroma weights in ff_h264_pred_weight_table()
|
||||
- avcodec/aacdec_templat: Fix integer overflow in apply_ltp()
|
||||
- avcodec/jpeg2000dwt: Fix integer overflows in sr_1d53()
|
||||
- avcodec/diracdec: Use int64 in global mv to prevent overflow
|
||||
- avcodec/dxtory: Remove code that corrupts dimensions
|
||||
- avcodec/dirac_dwt_template: Fix Integer overflow in horizontal_compose_dd137i()
|
||||
- avcodec/hevcdec: Check luma/chroma_log2_weight_denom
|
||||
- avcodec/jpeg2000dec: Use av_image_check_size2()
|
||||
- avcodec/vp8: Check for bitstream end before vp7_fade_frame()
|
||||
- avcodec/exr: Check remaining bits in last get code loop
|
||||
- avutil/common: Fix integer overflow in av_clip_uint8_c() and av_clip_uint16_c()
|
||||
- avcodec/h264_cabac: Tighten allowed coeff_abs range
|
||||
- avcodec/h264_cavlc: Set valid qscale value in ff_h264_decode_mb_cavlc()
|
||||
- avcodec/vp3: Error out on invalid num_coeffs in unpack_vlcs()
|
||||
- avcodec/mpeg4videodec: Ignore multiple VOL headers
|
||||
- avcodec/vp3: Check eob_run
|
||||
- avcodec/pafvideo: Check allocated frame size
|
||||
- avcodec/scpr: Fix reading a pixel before the first
|
||||
- avcodec/mpeg2dec: Fix field selection for skipped macroblocks
|
||||
- avcodec/huffyuvdec: Check input buffer size
|
||||
- avcodec/utvideodec: Fix bytes left check in decode_frame()
|
||||
- avcodec/wavpack: Fix integer overflow in FFABS
|
||||
- avcodec/aacsbr_fixed: Fix overflows in rounding in sbr_hf_assemble()
|
||||
- avcodec/exr: Fix memleaks in decode_header()
|
||||
- avcodec/dirac_dwt: Fix several integer overflows
|
||||
- avcodec/indeo5: Do not leave frame_type set to an invalid value
|
||||
- avcodec/hevc_ps: Check log2_sao_offset_scale_*
|
||||
- avcodec/hevc_ps: extract SPS fields required for hvcC construction
|
||||
- avcodec/mpeg4videodec: Avoid possibly aliasing violating casts
|
||||
- avcodec/get_bits: Document the return code of get_vlc2()
|
||||
- avcodec/mpeg4videodec: Check mb_num also against 0
|
||||
- avfilter/vf_transpose: Fix used plane count.
|
||||
- avcodec/hevc_cabac: Check prefix so as to avoid invalid shifts in coeff_abs_level_remaining_decode()
|
||||
- avcodec/mjpegdec: Fix integer overflow in DC dequantization
|
||||
- avcodec/dxtory: Fix bits left checks
|
||||
- avcodec/hevc_cabac: Move prefix check in coeff_abs_level_remaining_decode() down
|
||||
- avcodec/truemotion2: Fix integer overflow in TM2_RECALC_BLOCK()
|
||||
- avcodec/snowdec: Fix integer overflow before htaps check
|
||||
- avcodec/ulti: Check number of blocks at init
|
||||
- avcodec/jpeg2000: Check sum of sizes of band->prec before allocating
|
||||
- avcodec/ac3dec_fixed: Fix integer overflow in scale_coefs()
|
||||
- avformat/lrcdec: Fix memory leak in lrc_read_header()
|
||||
- avformat/matroskadec: Fix float-cast-overflow undefined behavior in matroska_parse_tracks()
|
||||
- configure: bump year
|
||||
- avcodec/utils: Avoid hardcoding duplicated types in sizeof()
|
||||
- avcodec/arm/sbrdsp_neon: Use a free register instead of putting 2 things in one
|
||||
- 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
|
||||
- avformat/hvcc: zero initialize the nal buffers past the last written byte
|
||||
- swresample/rematrix: fix update of channel matrix if input or output layout is undefined
|
||||
- configure: add support for libnpp* from cuda sdk 9
|
||||
- avcodec/nvenc: also clear data pointer after unregistering a resource
|
||||
- avcodec/nvenc: add some more error case checks
|
||||
- avcodec/nvenc: unregister input resource when unmapping
|
||||
- avcodec/nvenc: refcount input frame mappings
|
||||
- avformat/libssh: check the user provided a password before trying to use it
|
||||
|
||||
|
||||
version 3.3.6:
|
||||
- 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/extract_extradata_bsf: Fix leak discovered via fuzzing
|
||||
- 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.
|
||||
- Fix leak of frame_duration_buffer in mov_fix_index().
|
||||
- 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/h264idct_template: Fix integer overflows in ff_h264_idct8_add()
|
||||
- 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
|
||||
- lavfi/af_pan: fix sign handling in channel coefficient parser
|
||||
- vc2enc_dwt: pad the temporary buffer by the slice siz
|
||||
|
||||
version 3.3.5:
|
||||
- ffserver: Fix off by 1 error in path
|
||||
- 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 warning: signed dword value exceeds bounds
|
||||
- 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.3.4:
|
||||
- avcodec/hevc_ps: improve check for missing default display window bitstream
|
||||
|
||||
@@ -5797,7 +5797,9 @@ enabled libmfx && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
|
||||
enabled libmodplug && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load
|
||||
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
|
||||
enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
|
||||
enabled libnpp && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
|
||||
enabled libnpp && { check_lib npp.h nppGetLibVersion -lnppig -lnppicc -lnppc ||
|
||||
check_lib npp.h nppGetLibVersion -lnppi -lnppc ||
|
||||
die "ERROR: libnpp not found"; }
|
||||
enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
|
||||
enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
|
||||
enabled libopencv && { check_header opencv2/core/core_c.h &&
|
||||
@@ -6797,7 +6799,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.3.4
|
||||
PROJECT_NUMBER = 3.3.7
|
||||
|
||||
# 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
|
||||
|
||||
+9
-13
@@ -476,7 +476,7 @@ static int compute_datarate(DataRateData *drd, int64_t count)
|
||||
static void start_children(FFServerStream *feed)
|
||||
{
|
||||
char *pathname;
|
||||
char *slash;
|
||||
char *dirname, *prog;
|
||||
int i;
|
||||
size_t cmd_length;
|
||||
|
||||
@@ -495,22 +495,18 @@ static void start_children(FFServerStream *feed)
|
||||
return;
|
||||
}
|
||||
|
||||
slash = strrchr(my_program_name, '/');
|
||||
if (!slash) {
|
||||
pathname = av_mallocz(sizeof("ffmpeg"));
|
||||
} else {
|
||||
pathname = av_mallocz(slash - my_program_name + sizeof("ffmpeg"));
|
||||
if (pathname != NULL) {
|
||||
memcpy(pathname, my_program_name, slash - my_program_name);
|
||||
}
|
||||
/* use "ffmpeg" in the path of current program. Ignore user provided path */
|
||||
prog = av_strdup(my_program_name);
|
||||
if (prog) {
|
||||
dirname = av_dirname(prog);
|
||||
pathname = *dirname ? av_asprintf("%s/%s", dirname, "ffmpeg")
|
||||
: av_asprintf("ffmpeg");
|
||||
av_free(prog);
|
||||
}
|
||||
if (!pathname) {
|
||||
if (!prog || !pathname) {
|
||||
http_log("Could not allocate memory for children cmd line\n");
|
||||
return;
|
||||
}
|
||||
/* use "ffmpeg" in the path of current program. Ignore user provided path */
|
||||
|
||||
strcat(pathname, "ffmpeg");
|
||||
|
||||
for (; feed; feed = feed->next) {
|
||||
|
||||
|
||||
@@ -307,9 +307,9 @@ static av_always_inline void predict(PredictorState *ps, int *coef,
|
||||
|
||||
if (shift < 31) {
|
||||
if (shift > 0) {
|
||||
*coef += (pv.mant + (1 << (shift - 1))) >> shift;
|
||||
*coef += (unsigned)((pv.mant + (1 << (shift - 1))) >> shift);
|
||||
} else
|
||||
*coef += pv.mant << -shift;
|
||||
*coef += (unsigned)pv.mant << -shift;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,7 +417,7 @@ static void apply_independent_coupling_fixed(AACContext *ac,
|
||||
int i, c, shift, round, tmp;
|
||||
const int gain = cce->coup.gain[index][0];
|
||||
const int *src = cce->ch[0].ret;
|
||||
int *dest = target->ret;
|
||||
unsigned int *dest = target->ret;
|
||||
const int len = 1024 << (ac->oc[1].m4ac.sbr == 1);
|
||||
|
||||
c = cce_scale_fixed[gain & 7];
|
||||
|
||||
@@ -1967,16 +1967,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) {
|
||||
@@ -1984,37 +1985,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2510,7 +2522,7 @@ static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
|
||||
for (sfb = 0; sfb < FFMIN(sce->ics.max_sfb, MAX_LTP_LONG_SFB); sfb++)
|
||||
if (ltp->used[sfb])
|
||||
for (i = offsets[sfb]; i < offsets[sfb + 1]; i++)
|
||||
sce->coeffs[i] += predFreq[i];
|
||||
sce->coeffs[i] += (UINTFLOAT)predFreq[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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]);
|
||||
@@ -570,8 +571,9 @@ static void sbr_hf_assemble(int Y1[38][64][2],
|
||||
int idx = indexsine&1;
|
||||
int A = (1-((indexsine+(kx & 1))&2));
|
||||
int B = (A^(-idx)) + idx;
|
||||
int *out = &Y1[i][kx][idx];
|
||||
int shift, round;
|
||||
unsigned *out = &Y1[i][kx][idx];
|
||||
int shift;
|
||||
unsigned round;
|
||||
|
||||
SoftFloat *in = sbr->s_m[e];
|
||||
for (m = 0; m+1 < m_max; m+=2) {
|
||||
@@ -584,12 +586,12 @@ static void sbr_hf_assemble(int Y1[38][64][2],
|
||||
}
|
||||
if (shift < 32) {
|
||||
round = 1 << (shift-1);
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
out[2*m ] += (int)(in[m ].mant * A + round) >> shift;
|
||||
}
|
||||
|
||||
if (shift2 < 32) {
|
||||
round = 1 << (shift2-1);
|
||||
out[2*m+2] += (in[m+1].mant * B + round) >> shift2;
|
||||
out[2*m+2] += (int)(in[m+1].mant * B + round) >> shift2;
|
||||
}
|
||||
}
|
||||
if(m_max&1)
|
||||
@@ -600,7 +602,7 @@ static void sbr_hf_assemble(int Y1[38][64][2],
|
||||
return;
|
||||
} else if (shift < 32) {
|
||||
round = 1 << (shift-1);
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
out[2*m ] += (int)(in[m ].mant * A + round) >> shift;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ static void scale_coefs (
|
||||
int dynrng,
|
||||
int len)
|
||||
{
|
||||
int i, shift, round;
|
||||
unsigned mul;
|
||||
int i, shift;
|
||||
unsigned mul, round;
|
||||
int temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||
|
||||
mul = (dynrng & 0x1f) + 0x20;
|
||||
|
||||
@@ -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]!
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "bintext.h"
|
||||
#include "internal.h"
|
||||
|
||||
#define FONT_WIDTH 8
|
||||
|
||||
typedef struct XbinContext {
|
||||
AVFrame *frame;
|
||||
int palette[16];
|
||||
@@ -91,6 +93,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (avctx->width < FONT_WIDTH || avctx->height < s->font_height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
@@ -113,8 +118,6 @@ av_unused static void hscroll(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
#define FONT_WIDTH 8
|
||||
|
||||
/**
|
||||
* Draw character to screen
|
||||
*/
|
||||
|
||||
@@ -1067,6 +1067,11 @@ static int decode_pic(AVSContext *h)
|
||||
if (!h->loop_filter_disable && get_bits1(&h->gb)) {
|
||||
h->alpha_offset = get_se_golomb(&h->gb);
|
||||
h->beta_offset = get_se_golomb(&h->gb);
|
||||
if ( h->alpha_offset < -64 || h->alpha_offset > 64
|
||||
|| h-> beta_offset < -64 || h-> beta_offset > 64) {
|
||||
h->alpha_offset = h->beta_offset = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else {
|
||||
h->alpha_offset = h->beta_offset = 0;
|
||||
}
|
||||
|
||||
+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));
|
||||
|
||||
|
||||
+6
-2
@@ -81,15 +81,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
switch ((buf[0] >> 1) & 7) {
|
||||
case 0: { // lzo compression
|
||||
int outlen = c->decomp_size, inlen = buf_size - 2;
|
||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
|
||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: { // zlib compression
|
||||
#if CONFIG_ZLIB
|
||||
unsigned long dlen = c->decomp_size;
|
||||
if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK)
|
||||
if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK) {
|
||||
av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
|
||||
|
||||
+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 - (unsigned)((int)(b0 + (unsigned)(b2) + 2) >> 2))
|
||||
|
||||
#define COMPOSE_DIRAC53iH0(b0, b1, b2)\
|
||||
(b1 + ((b0 + b2 + 1) >> 1))
|
||||
(b1 + (unsigned)((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 - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
((unsigned)(b1) - ((int)(1817*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH1(b0, b1, b2)\
|
||||
(b1 - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7))
|
||||
((unsigned)(b1) - ((int)( 113*(b0 + (unsigned)b2) + 64) >> 7))
|
||||
|
||||
#define COMPOSE_DAUB97iL0(b0, b1, b2)\
|
||||
(b1 + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
((unsigned)(b1) + ((int)( 217*(b0 + (unsigned)b2) + 2048) >> 12))
|
||||
|
||||
#define COMPOSE_DAUB97iH0(b0, b1, b2)\
|
||||
(b1 + ((int)(6497*(b0 + (unsigned)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] -= (int)(b0[i] + (unsigned)b2[i] + 2) >> 2;
|
||||
b1[i] -= (unsigned)((int)(b0[i] + (unsigned)b2[i] + 2) >> 2);
|
||||
}
|
||||
|
||||
static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src1, int w2,
|
||||
@@ -95,8 +95,8 @@ static void RENAME(horizontal_compose_dd97i)(uint8_t *_b, uint8_t *_tmp, int w)
|
||||
tmp[w2+1] = tmp[w2] = tmp[w2-1];
|
||||
|
||||
for (x = 0; x < w2; x++) {
|
||||
b[2*x ] = (tmp[x] + 1)>>1;
|
||||
b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], tmp[x+2]) + 1)>>1;
|
||||
b[2*x ] = ((int)(tmp[x] + 1U))>>1;
|
||||
b[2*x+1] = ((int)(COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], tmp[x+2]) + 1U))>>1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +118,8 @@ static void RENAME(horizontal_compose_dd137i)(uint8_t *_b, uint8_t *_tmp, int w)
|
||||
tmp[w2+1] = tmp[w2] = tmp[w2-1];
|
||||
|
||||
for (x = 0; x < w2; x++) {
|
||||
b[2*x ] = (tmp[x] + 1)>>1;
|
||||
b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], tmp[x+2]) + 1)>>1;
|
||||
b[2*x ] = ((int)(tmp[x] + 1U))>>1;
|
||||
b[2*x+1] = ((int)(COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], tmp[x+2]) + 1U))>>1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -508,16 +508,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)) {
|
||||
@@ -1399,8 +1399,8 @@ static void global_mv(DiracContext *s, DiracBlock *block, int x, int y, int ref)
|
||||
int *c = s->globalmc[ref].perspective;
|
||||
|
||||
int m = (1<<ep) - (c[0]*x + c[1]*y);
|
||||
int mx = m * ((A[0][0] * x + A[0][1]*y) + (1<<ez) * b[0]);
|
||||
int my = m * ((A[1][0] * x + A[1][1]*y) + (1<<ez) * b[1]);
|
||||
int64_t mx = m * (int64_t)((A[0][0] * x + A[0][1]*y) + (1<<ez) * b[0]);
|
||||
int64_t my = m * (int64_t)((A[1][0] * x + A[1][1]*y) + (1<<ez) * b[1]);
|
||||
|
||||
block->u.mv[ref][0] = (mx + (1<<(ez+ep))) >> (ez+ep);
|
||||
block->u.mv[ref][1] = (my + (1<<(ez+ep))) >> (ez+ep);
|
||||
@@ -1437,8 +1437,8 @@ static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock
|
||||
global_mv(s, block, x, y, i);
|
||||
} else {
|
||||
pred_mv(block, stride, x, y, i);
|
||||
block->u.mv[i][0] += dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
|
||||
block->u.mv[i][1] += dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
|
||||
block->u.mv[i][0] += (unsigned)dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
|
||||
block->u.mv[i][1] += (unsigned)dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; \
|
||||
|
||||
@@ -377,6 +377,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);
|
||||
@@ -430,7 +434,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;
|
||||
}
|
||||
|
||||
+6
-10
@@ -305,11 +305,7 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic,
|
||||
}
|
||||
|
||||
if (avctx->height - line) {
|
||||
av_log(avctx, AV_LOG_VERBOSE,
|
||||
"Not enough slice data available, "
|
||||
"cropping the frame by %d pixels\n",
|
||||
avctx->height - line);
|
||||
avctx->height = line;
|
||||
avpriv_request_sample(avctx, "Not enough slice data available");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -326,7 +322,7 @@ static int dx2_decode_slice_5x5(GetBitContext *gb, AVFrame *frame,
|
||||
int stride = frame->linesize[0];
|
||||
uint8_t *dst = frame->data[0] + stride * line;
|
||||
|
||||
for (y = 0; y < left && get_bits_left(gb) > 16; y++) {
|
||||
for (y = 0; y < left && get_bits_left(gb) > 6 * width; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
b = decode_sym_565(gb, lru[0], 5);
|
||||
g = decode_sym_565(gb, lru[1], is_565 ? 6 : 5);
|
||||
@@ -392,7 +388,7 @@ static int dx2_decode_slice_rgb(GetBitContext *gb, AVFrame *frame,
|
||||
int stride = frame->linesize[0];
|
||||
uint8_t *dst = frame->data[0] + stride * line;
|
||||
|
||||
for (y = 0; y < left && get_bits_left(gb) > 16; y++) {
|
||||
for (y = 0; y < left && get_bits_left(gb) > 6 * width; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
dst[x * 3 + 0] = decode_sym(gb, lru[0]);
|
||||
dst[x * 3 + 1] = decode_sym(gb, lru[1]);
|
||||
@@ -437,7 +433,7 @@ static int dx2_decode_slice_410(GetBitContext *gb, AVFrame *frame,
|
||||
uint8_t *U = frame->data[1] + (ustride >> 2) * line;
|
||||
uint8_t *V = frame->data[2] + (vstride >> 2) * line;
|
||||
|
||||
for (y = 0; y < left - 3 && get_bits_left(gb) > 16; y += 4) {
|
||||
for (y = 0; y < left - 3 && get_bits_left(gb) > 9 * width; y += 4) {
|
||||
for (x = 0; x < width; x += 4) {
|
||||
for (j = 0; j < 4; j++)
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -481,7 +477,7 @@ static int dx2_decode_slice_420(GetBitContext *gb, AVFrame *frame,
|
||||
uint8_t *V = frame->data[2] + (vstride >> 1) * line;
|
||||
|
||||
|
||||
for (y = 0; y < left - 1 && get_bits_left(gb) > 16; y += 2) {
|
||||
for (y = 0; y < left - 1 && get_bits_left(gb) > 6 * width; y += 2) {
|
||||
for (x = 0; x < width; x += 2) {
|
||||
Y[x + 0 + 0 * ystride] = decode_sym(gb, lru[0]);
|
||||
Y[x + 1 + 0 * ystride] = decode_sym(gb, lru[0]);
|
||||
@@ -524,7 +520,7 @@ static int dx2_decode_slice_444(GetBitContext *gb, AVFrame *frame,
|
||||
uint8_t *U = frame->data[1] + ustride * line;
|
||||
uint8_t *V = frame->data[2] + vstride * line;
|
||||
|
||||
for (y = 0; y < left && get_bits_left(gb) > 16; y++) {
|
||||
for (y = 0; y < left && get_bits_left(gb) > 6 * width; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
Y[x] = decode_sym(gb, lru[0]);
|
||||
U[x] = decode_sym(gb, lru[1]) ^ 0x80;
|
||||
|
||||
+63
-33
@@ -574,7 +574,7 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
|
||||
while (lc > 0) {
|
||||
const HufDec pl = hdecod[(c << (HUF_DECBITS - lc)) & HUF_DECMASK];
|
||||
|
||||
if (pl.len) {
|
||||
if (pl.len && lc >= pl.len) {
|
||||
lc -= pl.len;
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe, outb);
|
||||
} else {
|
||||
@@ -866,7 +866,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;
|
||||
@@ -910,7 +910,7 @@ static int pxr24_uncompress(EXRContext *s, const uint8_t *src,
|
||||
|
||||
static void unpack_14(const uint8_t b[14], uint16_t s[16])
|
||||
{
|
||||
unsigned short shift = (b[ 2] >> 2);
|
||||
unsigned short shift = (b[ 2] >> 2) & 15;
|
||||
unsigned short bias = (0x20 << shift);
|
||||
int i;
|
||||
|
||||
@@ -1062,7 +1062,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;
|
||||
@@ -1073,7 +1073,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 */
|
||||
@@ -1106,7 +1106,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;
|
||||
@@ -1116,7 +1116,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 ?? */
|
||||
@@ -1317,6 +1317,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
AVDictionary *metadata = NULL;
|
||||
int magic_number, version, i, flags, sar = 0;
|
||||
int layer_match = 0;
|
||||
int ret;
|
||||
|
||||
s->current_channel_offset = 0;
|
||||
s->xmin = ~0;
|
||||
@@ -1375,8 +1376,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
if ((var_size = check_header_variable(s, "channels",
|
||||
"chlist", 38)) >= 0) {
|
||||
GetByteContext ch_gb;
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytestream2_init(&ch_gb, s->gb.buffer, var_size);
|
||||
|
||||
@@ -1435,14 +1438,16 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
|
||||
if (bytestream2_get_bytes_left(&ch_gb) < 4) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incomplete header.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
current_pixel_type = bytestream2_get_le32(&ch_gb);
|
||||
if (current_pixel_type >= EXR_UNKNOWN) {
|
||||
avpriv_report_missing_feature(s->avctx, "Pixel type %d",
|
||||
current_pixel_type);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytestream2_skip(&ch_gb, 4);
|
||||
@@ -1453,7 +1458,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
avpriv_report_missing_feature(s->avctx,
|
||||
"Subsampling %dx%d",
|
||||
xsub, ysub);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (channel_index >= 0 && s->channel_offsets[channel_index] == -1) { /* channel has not been previously assigned */
|
||||
@@ -1461,7 +1467,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
s->pixel_type != current_pixel_type) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"RGB channels not of the same depth.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
s->pixel_type = current_pixel_type;
|
||||
s->channel_offsets[channel_index] = s->current_channel_offset;
|
||||
@@ -1469,8 +1476,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
|
||||
s->channels = av_realloc(s->channels,
|
||||
++s->nb_channels * sizeof(EXRChannel));
|
||||
if (!s->channels)
|
||||
return AVERROR(ENOMEM);
|
||||
if (!s->channels) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
channel = &s->channels[s->nb_channels - 1];
|
||||
channel->pixel_type = current_pixel_type;
|
||||
channel->xsub = xsub;
|
||||
@@ -1495,7 +1504,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Missing green channel.\n");
|
||||
if (s->channel_offsets[2] < 0)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Missing blue channel.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1504,8 +1514,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "dataWindow", "box2i",
|
||||
31)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->xmin = bytestream2_get_le32(&s->gb);
|
||||
s->ymin = bytestream2_get_le32(&s->gb);
|
||||
@@ -1517,8 +1529,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "displayWindow",
|
||||
"box2i", 34)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytestream2_skip(&s->gb, 8);
|
||||
s->w = bytestream2_get_le32(&s->gb) + 1;
|
||||
@@ -1528,29 +1542,36 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
} else if ((var_size = check_header_variable(s, "lineOrder",
|
||||
"lineOrder", 25)) >= 0) {
|
||||
int line_order;
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
line_order = bytestream2_get_byte(&s->gb);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "line order: %d.\n", line_order);
|
||||
if (line_order > 2) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unknown line order.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "pixelAspectRatio",
|
||||
"float", 31)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sar = bytestream2_get_le32(&s->gb);
|
||||
|
||||
continue;
|
||||
} else if ((var_size = check_header_variable(s, "compression",
|
||||
"compression", 29)) >= 0) {
|
||||
if (!var_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!var_size) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->compression == EXR_UNKN)
|
||||
s->compression = bytestream2_get_byte(&s->gb);
|
||||
@@ -1577,13 +1598,15 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
if (s->tile_attr.level_mode >= EXR_TILE_LEVEL_UNKNOWN){
|
||||
avpriv_report_missing_feature(s->avctx, "Tile level mode %d",
|
||||
s->tile_attr.level_mode);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->tile_attr.level_round >= EXR_TILE_ROUND_UNKNOWN) {
|
||||
avpriv_report_missing_feature(s->avctx, "Tile level round %d",
|
||||
s->tile_attr.level_round);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -1600,7 +1623,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
// Check if there are enough bytes for a header
|
||||
if (bytestream2_get_bytes_left(&s->gb) <= 9) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incomplete header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// Process unknown variables
|
||||
@@ -1615,19 +1639,22 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
|
||||
if (s->compression == EXR_UNKN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Missing compression attribute.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->is_tile) {
|
||||
if (s->tile_attr.xSize < 1 || s->tile_attr.ySize < 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid tile attribute.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (bytestream2_get_bytes_left(&s->gb) <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incomplete frame.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
av_frame_set_metadata(frame, metadata);
|
||||
@@ -1635,6 +1662,9 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
// aaand we are done
|
||||
bytestream2_skip(&s->gb, 1);
|
||||
return 0;
|
||||
fail:
|
||||
av_dict_free(&metadata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
@@ -78,7 +78,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
|
||||
ret = ff_h2645_packet_split(&h2645_pkt, pkt->data, pkt->size,
|
||||
ctx, 0, 0, ctx->par_in->codec_id, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i < h2645_pkt.nb_nals; i++) {
|
||||
H2645NAL *nal = &h2645_pkt.nals[i];
|
||||
@@ -101,14 +101,17 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
|
||||
|
||||
if (s->remove) {
|
||||
filtered_buf = av_buffer_alloc(pkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!filtered_buf)
|
||||
if (!filtered_buf) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
filtered_data = filtered_buf->data;
|
||||
}
|
||||
|
||||
extradata = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!extradata) {
|
||||
av_buffer_unref(&filtered_buf);
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +354,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;
|
||||
@@ -699,7 +699,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);
|
||||
|
||||
@@ -298,7 +298,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:
|
||||
@@ -456,7 +456,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;
|
||||
|
||||
+3
-1
@@ -28,6 +28,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
@@ -1451,7 +1452,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
c->tile_height = bytestream2_get_be32(&bc);
|
||||
if (c->tile_width <= 0 || c->tile_height <= 0 ||
|
||||
((c->tile_width | c->tile_height) & 0xF) ||
|
||||
c->tile_width * (uint64_t)c->tile_height >= INT_MAX / 4
|
||||
c->tile_width * (uint64_t)c->tile_height >= INT_MAX / 4 ||
|
||||
av_image_check_size2(c->tile_width, c->tile_height, avctx->max_pixels, avctx->pix_fmt, 0, avctx) < 0
|
||||
) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid tile dimensions %dx%d\n",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "avcodec.h"
|
||||
#include "mathops.h"
|
||||
#include "vlc.h"
|
||||
|
||||
@@ -428,7 +429,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
|
||||
int buffer_size;
|
||||
int ret = 0;
|
||||
|
||||
if (bit_size >= INT_MAX - 7 || bit_size < 0 || !buffer) {
|
||||
if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || bit_size < 0 || !buffer) {
|
||||
bit_size = 0;
|
||||
buffer = NULL;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
@@ -550,6 +551,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
|
||||
* @param max_depth is the number of times bits bits must be read to completely
|
||||
* read the longest vlc code
|
||||
* = (max_vlc_length + bits - 1) / bits
|
||||
* @returns the code parsed or -1 if no vlc matches
|
||||
*/
|
||||
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
|
||||
int bits, int max_depth)
|
||||
|
||||
@@ -1735,7 +1735,7 @@ decode_cabac_residual_internal(const H264Context *h, H264SliceContext *sl,
|
||||
\
|
||||
if( coeff_abs >= 15 ) { \
|
||||
int j = 0; \
|
||||
while (get_cabac_bypass(CC) && j < 30) { \
|
||||
while (get_cabac_bypass(CC) && j < 16+7) { \
|
||||
j++; \
|
||||
} \
|
||||
\
|
||||
|
||||
@@ -1111,6 +1111,7 @@ decode_intra_mb:
|
||||
else sl->qscale -= max_qp+1;
|
||||
if (((unsigned)sl->qscale) > max_qp){
|
||||
av_log(h->avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, sl->mb_x, sl->mb_y);
|
||||
sl->qscale = max_qp;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,11 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
pwt->chroma_weight[i][list][j][0] = get_se_golomb(gb);
|
||||
pwt->chroma_weight[i][list][j][1] = get_se_golomb(gb);
|
||||
if ((int8_t)pwt->chroma_weight[i][list][j][0] != pwt->chroma_weight[i][list][j][0] ||
|
||||
(int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1])
|
||||
(int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1]) {
|
||||
pwt->chroma_weight[i][list][j][0] = chroma_def;
|
||||
pwt->chroma_weight[i][list][j][1] = 0;
|
||||
goto out_range_weight;
|
||||
}
|
||||
if (pwt->chroma_weight[i][list][j][0] != chroma_def ||
|
||||
pwt->chroma_weight[i][list][j][1] != 0) {
|
||||
pwt->use_weight_chroma = 1;
|
||||
|
||||
@@ -1297,7 +1297,7 @@ static int h264_select_output_frame(H264Context *h)
|
||||
}
|
||||
out_of_order = MAX_DELAYED_PIC_COUNT - i;
|
||||
if( cur->f->pict_type == AV_PICTURE_TYPE_B
|
||||
|| (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
|
||||
|| (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - (int64_t)h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
|
||||
out_of_order = FFMAX(out_of_order, 1);
|
||||
if (out_of_order == MAX_DELAYED_PIC_COUNT) {
|
||||
av_log(h->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]);
|
||||
@@ -1552,6 +1552,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -415,6 +415,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;
|
||||
@@ -107,10 +107,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
|
||||
}
|
||||
for( i = 0; i < 8; i++ )
|
||||
{
|
||||
const unsigned a0 = block[0+i*8] + block[4+i*8];
|
||||
const unsigned a2 = block[0+i*8] - block[4+i*8];
|
||||
const unsigned a4 = (block[2+i*8]>>1) - block[6+i*8];
|
||||
const unsigned a6 = (block[6+i*8]>>1) + block[2+i*8];
|
||||
const unsigned a0 = block[0+i*8] + (unsigned)block[4+i*8];
|
||||
const unsigned a2 = block[0+i*8] - (unsigned)block[4+i*8];
|
||||
const unsigned a4 = (block[2+i*8]>>1) - (unsigned)block[6+i*8];
|
||||
const unsigned a6 = (block[6+i*8]>>1) + (unsigned)block[2+i*8];
|
||||
|
||||
const unsigned b0 = a0 + a6;
|
||||
const unsigned b2 = a2 + a4;
|
||||
|
||||
+10
-5
@@ -635,8 +635,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;
|
||||
@@ -977,16 +979,19 @@ static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int
|
||||
|
||||
while (prefix < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc))
|
||||
prefix++;
|
||||
if (prefix == CABAC_MAX_BIN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (prefix < 3) {
|
||||
for (i = 0; i < rc_rice_param; i++)
|
||||
suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc);
|
||||
last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix;
|
||||
} else {
|
||||
int prefix_minus3 = prefix - 3;
|
||||
|
||||
if (prefix == CABAC_MAX_BIN || prefix_minus3 + rc_rice_param >= 31) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < prefix_minus3 + rc_rice_param; i++)
|
||||
suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc);
|
||||
last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1)
|
||||
|
||||
@@ -891,7 +891,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
skip_bits1(gb); // temporal_id_nesting_flag
|
||||
sps->temporal_id_nesting_flag = get_bits(gb, 1);
|
||||
|
||||
if ((ret = parse_ptl(gb, avctx, &sps->ptl, sps->max_sub_layers)) < 0)
|
||||
return ret;
|
||||
@@ -954,6 +954,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
sps->bit_depth, bit_depth_chroma);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
sps->bit_depth_chroma = bit_depth_chroma;
|
||||
|
||||
ret = map_pixel_format(avctx, sps);
|
||||
if (ret < 0)
|
||||
@@ -1329,6 +1330,11 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
|
||||
pps->log2_sao_offset_scale_luma = get_ue_golomb_long(gb);
|
||||
pps->log2_sao_offset_scale_chroma = get_ue_golomb_long(gb);
|
||||
|
||||
if ( pps->log2_sao_offset_scale_luma > FFMAX(sps->bit_depth - 10, 0)
|
||||
|| pps->log2_sao_offset_scale_chroma > FFMAX(sps->bit_depth_chroma - 10, 0)
|
||||
)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ typedef struct HEVCSPS {
|
||||
HEVCWindow pic_conf_win;
|
||||
|
||||
int bit_depth;
|
||||
int bit_depth_chroma;
|
||||
int pixel_shift;
|
||||
enum AVPixelFormat pix_fmt;
|
||||
|
||||
@@ -163,6 +164,7 @@ typedef struct HEVCSPS {
|
||||
int num_reorder_pics;
|
||||
int max_latency_increase;
|
||||
} temporal_layer[HEVC_MAX_SUB_LAYERS];
|
||||
uint8_t temporal_id_nesting_flag;
|
||||
|
||||
VUI vui;
|
||||
PTL ptl;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -149,12 +149,18 @@ static int pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
int luma_log2_weight_denom;
|
||||
|
||||
luma_log2_weight_denom = get_ue_golomb_long(gb);
|
||||
if (luma_log2_weight_denom < 0 || luma_log2_weight_denom > 7)
|
||||
if (luma_log2_weight_denom < 0 || luma_log2_weight_denom > 7) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is invalid\n", luma_log2_weight_denom);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->sh.luma_log2_weight_denom = av_clip_uintp2(luma_log2_weight_denom, 3);
|
||||
if (s->ps.sps->chroma_format_idc != 0) {
|
||||
int delta = get_se_golomb(gb);
|
||||
s->sh.chroma_log2_weight_denom = av_clip_uintp2(s->sh.luma_log2_weight_denom + delta, 3);
|
||||
int64_t chroma_log2_weight_denom = luma_log2_weight_denom + (int64_t)get_se_golomb(gb);
|
||||
if (chroma_log2_weight_denom < 0 || chroma_log2_weight_denom > 7) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "chroma_log2_weight_denom %"PRId64" is invalid\n", chroma_log2_weight_denom);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->sh.chroma_log2_weight_denom = chroma_log2_weight_denom;
|
||||
}
|
||||
|
||||
for (i = 0; i < s->sh.nb_refs[L0]; i++) {
|
||||
|
||||
@@ -121,7 +121,7 @@ static void FUNC(dequant)(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++;
|
||||
}
|
||||
}
|
||||
@@ -915,7 +915,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;
|
||||
@@ -970,7 +970,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;
|
||||
@@ -1051,7 +1051,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;
|
||||
@@ -1355,7 +1355,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;
|
||||
@@ -1407,7 +1407,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;
|
||||
@@ -1486,7 +1486,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;
|
||||
|
||||
@@ -919,6 +919,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
AVFrame *const p = data;
|
||||
int table_size = 0, ret;
|
||||
|
||||
if (buf_size < (width * height + 7)/8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
av_fast_padded_malloc(&s->bitstream_buffer,
|
||||
&s->bitstream_buffer_size,
|
||||
buf_size);
|
||||
|
||||
@@ -69,10 +69,14 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p
|
||||
int i;
|
||||
|
||||
enum AVPixelFormat best = AV_PIX_FMT_NONE;
|
||||
int loss;
|
||||
|
||||
for(i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++)
|
||||
best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr);
|
||||
for (i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) {
|
||||
loss = *loss_ptr;
|
||||
best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, &loss);
|
||||
}
|
||||
|
||||
*loss_ptr = loss;
|
||||
return best;
|
||||
}
|
||||
|
||||
|
||||
@@ -324,6 +324,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
ctx->frame_type = get_bits(&ctx->gb, 3);
|
||||
if (ctx->frame_type >= 5) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid frame type: %d \n", ctx->frame_type);
|
||||
ctx->frame_type = FRAMETYPE_INTRA;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
+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)
|
||||
@@ -540,6 +543,9 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
if (!reslevel->band)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (reslevel->num_precincts_x * (uint64_t)reslevel->num_precincts_y * reslevel->nbands > avctx->max_pixels / sizeof(*reslevel->band->prec))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++) {
|
||||
ret = init_band(avctx, reslevel,
|
||||
comp, codsty, qntsty,
|
||||
|
||||
@@ -282,7 +282,7 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
avpriv_request_sample(s->avctx, "Support for image offsets");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (av_image_check_size(s->width, s->height, 0, s->avctx)) {
|
||||
if (av_image_check_size2(s->width, s->height, s->avctx->max_pixels, AV_PIX_FMT_NONE, 0, s->avctx)) {
|
||||
avpriv_request_sample(s->avctx, "Large Dimensions");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ 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);
|
||||
i0 = *src0 + *src2 + ((int)((26345U * *src2) + (1 << 15)) >> 16);
|
||||
i1 = *src0 - ((int)(((unsigned)i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
||||
- (((i_ict_params[2] * *src2) + (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;
|
||||
|
||||
@@ -305,22 +305,22 @@ static void dwt_encode97_int(DWTContext *s, int *t)
|
||||
t[i] = (t[i] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT;
|
||||
}
|
||||
|
||||
static void sr_1d53(int *p, int i0, int i1)
|
||||
static void sr_1d53(unsigned *p, int i0, int i1)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (i1 <= i0 + 1) {
|
||||
if (i0 == 1)
|
||||
p[1] >>= 1;
|
||||
p[1] = (int)p[1] >> 1;
|
||||
return;
|
||||
}
|
||||
|
||||
extend53(p, i0, i1);
|
||||
|
||||
for (i = (i0 >> 1); i < (i1 >> 1) + 1; i++)
|
||||
p[2 * i] -= (p[2 * i - 1] + p[2 * i + 1] + 2) >> 2;
|
||||
p[2 * i] -= (int)(p[2 * i - 1] + p[2 * i + 1] + 2) >> 2;
|
||||
for (i = (i0 >> 1); i < (i1 >> 1); i++)
|
||||
p[2 * i + 1] += (p[2 * i] + p[2 * i + 2]) >> 1;
|
||||
p[2 * i + 1] += (int)(p[2 * i] + p[2 * i + 2]) >> 1;
|
||||
}
|
||||
|
||||
static void dwt_decode53(DWTContext *s, int *t)
|
||||
|
||||
@@ -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);
|
||||
@@ -443,6 +446,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);
|
||||
|
||||
@@ -126,7 +126,10 @@ static av_cold int libopus_decode_close(AVCodecContext *avc)
|
||||
{
|
||||
struct libopus_context *opus = avc->priv_data;
|
||||
|
||||
opus_multistream_decoder_destroy(opus->dec);
|
||||
if (opus->dec) {
|
||||
opus_multistream_decoder_destroy(opus->dec);
|
||||
opus->dec = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -200,6 +203,7 @@ AVCodec ff_libopus_decoder = {
|
||||
.decode = libopus_decode,
|
||||
.flush = libopus_flush,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
|
||||
AV_SAMPLE_FMT_S16,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
@@ -309,6 +309,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height);
|
||||
if (av_image_check_size(width, height, 0, s->avctx))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->buf_size && (width + 7) / 8 * ((height + 7) / 8) > s->buf_size * 4LL)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
nb_components = get_bits(&s->gb, 8);
|
||||
if (nb_components <= 0 ||
|
||||
@@ -696,7 +698,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
|
||||
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
val = val * quant_matrix[0] + s->last_dc[component];
|
||||
val = val * (unsigned)quant_matrix[0] + s->last_dc[component];
|
||||
val = av_clip_int16(val);
|
||||
s->last_dc[component] = val;
|
||||
block[0] = val;
|
||||
@@ -2091,6 +2093,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int ret = 0;
|
||||
int is16bit;
|
||||
|
||||
s->buf_size = buf_size;
|
||||
|
||||
av_dict_free(&s->exif_metadata);
|
||||
av_freep(&s->stereo3d);
|
||||
s->adobe_transform = -1;
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef struct MJpegDecodeContext {
|
||||
AVClass *class;
|
||||
AVCodecContext *avctx;
|
||||
GetBitContext gb;
|
||||
int buf_size;
|
||||
|
||||
int start_code; /* current start code */
|
||||
int buffer_size;
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -299,6 +299,14 @@ static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
|
||||
m->s_temp->style_start = AV_RB16(tsmb);
|
||||
tsmb += 2;
|
||||
m->s_temp->style_end = AV_RB16(tsmb);
|
||||
|
||||
if ( m->s_temp->style_end < m->s_temp->style_start
|
||||
|| (m->count_s && m->s_temp->style_start < m->s[m->count_s - 1]->style_end)) {
|
||||
av_freep(&m->s_temp);
|
||||
mov_text_cleanup(m);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
tsmb += 2;
|
||||
m->s_temp->style_fontID = AV_RB16(tsmb);
|
||||
tsmb += 2;
|
||||
|
||||
@@ -1983,6 +1983,8 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
|
||||
s->mv[0][0][1] = s->last_mv[0][0][1];
|
||||
s->mv[1][0][0] = s->last_mv[1][0][0];
|
||||
s->mv[1][0][1] = s->last_mv[1][0][1];
|
||||
s->field_select[0][0] = (s->picture_structure - 1) & 1;
|
||||
s->field_select[1][0] = (s->picture_structure - 1) & 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+57
-46
@@ -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:
|
||||
@@ -459,7 +460,7 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
|
||||
}
|
||||
|
||||
mb_num = get_bits(&s->gb, mb_num_bits);
|
||||
if (mb_num >= s->mb_num) {
|
||||
if (mb_num >= s->mb_num || !mb_num) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num);
|
||||
return -1;
|
||||
@@ -1250,10 +1251,12 @@ not_coded:
|
||||
*/
|
||||
static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
{
|
||||
Mpeg4DecContext *ctx = (Mpeg4DecContext *)s;
|
||||
Mpeg4DecContext *ctx = s->avctx->priv_data;
|
||||
int cbp, mb_type;
|
||||
const int xy = s->mb_x + s->mb_y * s->mb_stride;
|
||||
|
||||
av_assert2(s == (void*)ctx);
|
||||
|
||||
mb_type = s->current_picture.mb_type[xy];
|
||||
cbp = s->cbp_table[xy];
|
||||
|
||||
@@ -1335,12 +1338,13 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
|
||||
static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
{
|
||||
Mpeg4DecContext *ctx = (Mpeg4DecContext *)s;
|
||||
Mpeg4DecContext *ctx = s->avctx->priv_data;
|
||||
int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
|
||||
int16_t *mot_val;
|
||||
static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
|
||||
const int xy = s->mb_x + s->mb_y * s->mb_stride;
|
||||
|
||||
av_assert2(s == (void*)ctx);
|
||||
av_assert2(s->h263_pred);
|
||||
|
||||
if (s->pict_type == AV_PICTURE_TYPE_P ||
|
||||
@@ -2148,8 +2152,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)
|
||||
@@ -2659,8 +2670,8 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
|
||||
if (startcode >= 0x120 && startcode <= 0x12F) {
|
||||
if (vol) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Multiple VOL headers");
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Ignoring multiple VOL headers\n");
|
||||
continue;
|
||||
}
|
||||
vol++;
|
||||
if ((ret = decode_vol_header(ctx, gb)) < 0)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -161,6 +161,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int orig_size = buf_size;
|
||||
int keyframe, ret;
|
||||
int size_change = 0;
|
||||
int minsize = 0;
|
||||
int result, init_frame = !avctx->frame_number;
|
||||
enum {
|
||||
NUV_UNCOMPRESSED = '0',
|
||||
@@ -198,6 +199,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
case NUV_RTJPEG_IN_LZO:
|
||||
case NUV_RTJPEG:
|
||||
keyframe = !buf[2];
|
||||
if (c->width < 16 || c->height < 16) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
case NUV_COPY_LAST:
|
||||
keyframe = 0;
|
||||
@@ -206,6 +210,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
keyframe = 1;
|
||||
break;
|
||||
}
|
||||
switch (comptype) {
|
||||
case NUV_UNCOMPRESSED:
|
||||
minsize = c->width * c->height * 3 / 2;
|
||||
break;
|
||||
case NUV_RTJPEG:
|
||||
minsize = c->width/16 * (c->height/16) * 6;
|
||||
break;
|
||||
}
|
||||
if (buf_size < minsize / 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
retry:
|
||||
// Skip the rest of the frame header.
|
||||
buf = &buf[12];
|
||||
|
||||
+43
-20
@@ -1281,12 +1281,9 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
|
||||
av_fifo_freep(&ctx->output_surface_queue);
|
||||
|
||||
if (ctx->surfaces && avctx->pix_fmt == AV_PIX_FMT_CUDA) {
|
||||
for (i = 0; i < ctx->nb_surfaces; ++i) {
|
||||
if (ctx->surfaces[i].input_surface) {
|
||||
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->surfaces[i].in_map.mappedResource);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ctx->nb_registered_frames; i++) {
|
||||
if (ctx->registered_frames[i].mapped)
|
||||
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[i].in_map.mappedResource);
|
||||
if (ctx->registered_frames[i].regptr)
|
||||
p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[i].regptr);
|
||||
}
|
||||
@@ -1416,6 +1413,7 @@ static int nvenc_find_free_reg_resource(AVCodecContext *avctx)
|
||||
NvencContext *ctx = avctx->priv_data;
|
||||
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
|
||||
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
|
||||
NVENCSTATUS nv_status;
|
||||
|
||||
int i;
|
||||
|
||||
@@ -1423,8 +1421,10 @@ static int nvenc_find_free_reg_resource(AVCodecContext *avctx)
|
||||
for (i = 0; i < ctx->nb_registered_frames; i++) {
|
||||
if (!ctx->registered_frames[i].mapped) {
|
||||
if (ctx->registered_frames[i].regptr) {
|
||||
p_nvenc->nvEncUnregisterResource(ctx->nvencoder,
|
||||
ctx->registered_frames[i].regptr);
|
||||
nv_status = p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[i].regptr);
|
||||
if (nv_status != NV_ENC_SUCCESS)
|
||||
return nvenc_print_error(avctx, nv_status, "Failed unregistering unused input resource");
|
||||
ctx->registered_frames[i].ptr = 0;
|
||||
ctx->registered_frames[i].regptr = NULL;
|
||||
}
|
||||
return i;
|
||||
@@ -1503,19 +1503,23 @@ static int nvenc_upload_frame(AVCodecContext *avctx, const AVFrame *frame,
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
nvenc_frame->in_map.version = NV_ENC_MAP_INPUT_RESOURCE_VER;
|
||||
nvenc_frame->in_map.registeredResource = ctx->registered_frames[reg_idx].regptr;
|
||||
nv_status = p_nvenc->nvEncMapInputResource(ctx->nvencoder, &nvenc_frame->in_map);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
av_frame_unref(nvenc_frame->in_ref);
|
||||
return nvenc_print_error(avctx, nv_status, "Error mapping an input resource");
|
||||
if (!ctx->registered_frames[reg_idx].mapped) {
|
||||
ctx->registered_frames[reg_idx].in_map.version = NV_ENC_MAP_INPUT_RESOURCE_VER;
|
||||
ctx->registered_frames[reg_idx].in_map.registeredResource = ctx->registered_frames[reg_idx].regptr;
|
||||
nv_status = p_nvenc->nvEncMapInputResource(ctx->nvencoder, &ctx->registered_frames[reg_idx].in_map);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
av_frame_unref(nvenc_frame->in_ref);
|
||||
return nvenc_print_error(avctx, nv_status, "Error mapping an input resource");
|
||||
}
|
||||
}
|
||||
|
||||
ctx->registered_frames[reg_idx].mapped = 1;
|
||||
ctx->registered_frames[reg_idx].mapped += 1;
|
||||
|
||||
nvenc_frame->reg_idx = reg_idx;
|
||||
nvenc_frame->input_surface = nvenc_frame->in_map.mappedResource;
|
||||
nvenc_frame->format = nvenc_frame->in_map.mappedBufferFmt;
|
||||
nvenc_frame->input_surface = ctx->registered_frames[reg_idx].in_map.mappedResource;
|
||||
nvenc_frame->format = ctx->registered_frames[reg_idx].in_map.mappedBufferFmt;
|
||||
nvenc_frame->pitch = frame->linesize[0];
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
NV_ENC_LOCK_INPUT_BUFFER lockBufferParams = { 0 };
|
||||
@@ -1660,14 +1664,33 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
|
||||
memcpy(pkt->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);
|
||||
|
||||
nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
|
||||
if (nv_status != NV_ENC_SUCCESS)
|
||||
nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
res = nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {
|
||||
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, tmpoutsurf->in_map.mappedResource);
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].mapped -= 1;
|
||||
if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped == 0) {
|
||||
nv_status = p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].in_map.mappedResource);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
res = nvenc_print_error(avctx, nv_status, "Failed unmapping input resource");
|
||||
goto error;
|
||||
}
|
||||
nv_status = p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].regptr);
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
res = nvenc_print_error(avctx, nv_status, "Failed unregistering input resource");
|
||||
goto error;
|
||||
}
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].ptr = 0;
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].regptr = NULL;
|
||||
} else if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped < 0) {
|
||||
res = AVERROR_BUG;
|
||||
goto error;
|
||||
}
|
||||
|
||||
av_frame_unref(tmpoutsurf->in_ref);
|
||||
ctx->registered_frames[tmpoutsurf->reg_idx].mapped = 0;
|
||||
|
||||
tmpoutsurf->input_surface = NULL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,6 @@ typedef struct NvencSurface
|
||||
{
|
||||
NV_ENC_INPUT_PTR input_surface;
|
||||
AVFrame *in_ref;
|
||||
NV_ENC_MAP_INPUT_RESOURCE in_map;
|
||||
int reg_idx;
|
||||
int width;
|
||||
int height;
|
||||
@@ -118,6 +117,7 @@ typedef struct NvencContext
|
||||
CUdeviceptr ptr;
|
||||
NV_ENC_REGISTERED_PTR regptr;
|
||||
int mapped;
|
||||
NV_ENC_MAP_INPUT_RESOURCE in_map;
|
||||
} registered_frames[MAX_REGISTERED_FRAMES];
|
||||
int nb_registered_frames;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -78,6 +78,7 @@ static av_cold int paf_video_init(AVCodecContext *avctx)
|
||||
{
|
||||
PAFVideoDecContext *c = avctx->priv_data;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
c->width = avctx->width;
|
||||
c->height = avctx->height;
|
||||
@@ -90,6 +91,9 @@ static av_cold int paf_video_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
ret = av_image_check_size2(avctx->width, FFALIGN(avctx->height, 256), avctx->max_pixels, avctx->pix_fmt, 0, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
c->pic = av_frame_alloc();
|
||||
if (!c->pic)
|
||||
@@ -181,6 +185,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 +204,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++;
|
||||
|
||||
+1
-1
@@ -1366,7 +1366,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;
|
||||
|
||||
|
||||
+3
-3
@@ -1585,7 +1585,7 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte
|
||||
|
||||
// Do no call ff_mpeg_update_thread_context on a partially initialized
|
||||
// decoder context.
|
||||
if (!s1->linesize)
|
||||
if (!s1->context_initialized)
|
||||
return 0;
|
||||
|
||||
return ff_mpeg_update_thread_context(dst, src);
|
||||
@@ -1733,6 +1733,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
|
||||
if ((err = rv34_decoder_realloc(r)) < 0)
|
||||
return err;
|
||||
}
|
||||
if (faulty_b)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I;
|
||||
if (ff_mpv_frame_start(s, s->avctx) < 0)
|
||||
return -1;
|
||||
@@ -1783,8 +1785,6 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
|
||||
"multithreading mode (start MB is %d).\n", si.start);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (faulty_b)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for(i = 0; i < slice_count; i++){
|
||||
int offset = get_slice_offset(avctx, slices_hdr, i , slice_count, buf_size);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -679,6 +679,8 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bx == 0) {
|
||||
if (by < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
z = backstep;
|
||||
} else {
|
||||
z = 0;
|
||||
@@ -708,6 +710,8 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bx == 0) {
|
||||
if (by < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
z = backstep;
|
||||
} else {
|
||||
z = 0;
|
||||
|
||||
@@ -438,6 +438,10 @@ static int smc_decode_frame(AVCodecContext *avctx,
|
||||
int pal_size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
|
||||
int ret;
|
||||
int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
|
||||
|
||||
if (total_blocks / 1024 > avpkt->size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
bytestream2_init(&s->gb, buf, buf_size);
|
||||
|
||||
|
||||
+25
-12
@@ -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)
|
||||
@@ -354,9 +363,10 @@ static int decode_header(SnowContext *s){
|
||||
int htaps, i, sum=0;
|
||||
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)
|
||||
htaps= get_symbol(&s->c, s->header_state, 0);
|
||||
if((unsigned)htaps >= HTAPS_MAX/2 - 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
htaps = htaps*2 + 2;
|
||||
p->htaps= htaps;
|
||||
for(i= htaps/2; i; i--){
|
||||
p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1));
|
||||
@@ -374,7 +384,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 +400,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 +438,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));
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define av_freep(p) while(0)
|
||||
#define AVCODEC_AVCODEC_H
|
||||
#define AVCODEC_INTERNAL_H
|
||||
#define AV_INPUT_BUFFER_PADDING_SIZE 64 // the value does not matter for this
|
||||
#include "tableprint.h"
|
||||
#include "get_bits.h"
|
||||
#include "mathtables.c"
|
||||
|
||||
+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;
|
||||
|
||||
@@ -63,6 +63,7 @@ typedef struct TM2Context {
|
||||
AVFrame *pic;
|
||||
|
||||
GetBitContext gb;
|
||||
int error;
|
||||
BswapDSPContext bdsp;
|
||||
|
||||
uint8_t *buffer;
|
||||
@@ -398,6 +399,7 @@ static inline int GET_TOK(TM2Context *ctx,int type)
|
||||
{
|
||||
if (ctx->tok_ptrs[type] >= ctx->tok_lens[type]) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Read token from stream %i out of bounds (%i>=%i)\n", type, ctx->tok_ptrs[type], ctx->tok_lens[type]);
|
||||
ctx->error = 1;
|
||||
return 0;
|
||||
}
|
||||
if (type <= TM2_MOT) {
|
||||
@@ -441,8 +443,8 @@ static inline int GET_TOK(TM2Context *ctx,int type)
|
||||
|
||||
/* recalculate last and delta values for next blocks */
|
||||
#define TM2_RECALC_BLOCK(CHR, stride, last, CD) {\
|
||||
CD[0] = CHR[1] - last[1];\
|
||||
CD[1] = (int)CHR[stride + 1] - (int)CHR[1];\
|
||||
CD[0] = (unsigned)CHR[ 1] - (unsigned)last[1];\
|
||||
CD[1] = (unsigned)CHR[stride + 1] - (unsigned) CHR[1];\
|
||||
last[0] = (int)CHR[stride + 0];\
|
||||
last[1] = (int)CHR[stride + 1];}
|
||||
|
||||
@@ -465,7 +467,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++) {
|
||||
@@ -809,6 +811,8 @@ static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
|
||||
default:
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Skipping unknown block type %i\n", type);
|
||||
}
|
||||
if (ctx->error)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -889,6 +893,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
int offset = TM2_HEADER_SIZE;
|
||||
int i, t, ret;
|
||||
|
||||
l->error = 0;
|
||||
|
||||
av_fast_padded_malloc(&l->buffer, &l->buffer_size, buf_size);
|
||||
if (!l->buffer) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
|
||||
|
||||
@@ -116,6 +116,9 @@ static int truemotion2rt_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (avctx->width / s->hscale * avctx->height * s->delta_size > avpkt->size * 8LL * 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = init_get_bits8(gb, avpkt->data + ret, avpkt->size - ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -50,6 +50,8 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx)
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
s->blocks = (s->width / 8) * (s->height / 8);
|
||||
if (s->blocks == 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV410P;
|
||||
s->ulti_codebook = ulti_codebook;
|
||||
|
||||
|
||||
+6
-3
@@ -418,7 +418,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
|
||||
*width = FFALIGN(*width, w_align);
|
||||
*height = FFALIGN(*height, h_align);
|
||||
if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {
|
||||
if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
|
||||
s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
|
||||
s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
|
||||
) {
|
||||
// some of the optimized chroma MC reads one line too much
|
||||
// which is also done in mpeg decoders with lowres > 0
|
||||
*height += 2;
|
||||
@@ -1270,7 +1273,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;
|
||||
@@ -2795,7 +2798,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)
|
||||
|
||||
+43
-32
@@ -28,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "avcodec.h"
|
||||
#include "bswapdsp.h"
|
||||
#include "bytestream.h"
|
||||
@@ -638,7 +639,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
for (j = 0; j < c->slices; j++) {
|
||||
slice_end = bytestream2_get_le32u(&gb);
|
||||
if (slice_end < 0 || slice_end < slice_start ||
|
||||
bytestream2_get_bytes_left(&gb) < slice_end) {
|
||||
bytestream2_get_bytes_left(&gb) < slice_end + 1024LL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -824,43 +825,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
UtvideoContext * const c = avctx->priv_data;
|
||||
int h_shift, v_shift;
|
||||
|
||||
c->avctx = avctx;
|
||||
|
||||
ff_bswapdsp_init(&c->bdsp);
|
||||
ff_llviddsp_init(&c->llviddsp);
|
||||
|
||||
if (avctx->extradata_size >= 16) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
|
||||
avctx->extradata[3], avctx->extradata[2],
|
||||
avctx->extradata[1], avctx->extradata[0]);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Original format %"PRIX32"\n",
|
||||
AV_RB32(avctx->extradata + 4));
|
||||
c->frame_info_size = AV_RL32(avctx->extradata + 8);
|
||||
c->flags = AV_RL32(avctx->extradata + 12);
|
||||
|
||||
if (c->frame_info_size != 4)
|
||||
avpriv_request_sample(avctx, "Frame info not 4 bytes");
|
||||
av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08"PRIX32"\n", c->flags);
|
||||
c->slices = (c->flags >> 24) + 1;
|
||||
c->compression = c->flags & 1;
|
||||
c->interlaced = c->flags & 0x800;
|
||||
} else if (avctx->extradata_size == 8) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
|
||||
avctx->extradata[3], avctx->extradata[2],
|
||||
avctx->extradata[1], avctx->extradata[0]);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Original format %"PRIX32"\n",
|
||||
AV_RB32(avctx->extradata + 4));
|
||||
c->interlaced = 0;
|
||||
c->pro = 1;
|
||||
c->frame_info_size = 4;
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Insufficient extradata size %d, should be at least 16\n",
|
||||
avctx->extradata_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
c->slice_bits_size = 0;
|
||||
|
||||
switch (avctx->codec_tag) {
|
||||
@@ -889,14 +860,17 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
break;
|
||||
case MKTAG('U', 'Q', 'Y', '2'):
|
||||
c->planes = 3;
|
||||
c->pro = 1;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
||||
break;
|
||||
case MKTAG('U', 'Q', 'R', 'G'):
|
||||
c->planes = 3;
|
||||
c->pro = 1;
|
||||
avctx->pix_fmt = AV_PIX_FMT_GBRP10;
|
||||
break;
|
||||
case MKTAG('U', 'Q', 'R', 'A'):
|
||||
c->planes = 4;
|
||||
c->pro = 1;
|
||||
avctx->pix_fmt = AV_PIX_FMT_GBRAP10;
|
||||
break;
|
||||
case MKTAG('U', 'L', 'H', '0'):
|
||||
@@ -920,6 +894,43 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &h_shift, &v_shift);
|
||||
if ((avctx->width & ((1<<h_shift)-1)) ||
|
||||
(avctx->height & ((1<<v_shift)-1))) {
|
||||
avpriv_request_sample(avctx, "Odd dimensions");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (!c->pro && avctx->extradata_size >= 16) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
|
||||
avctx->extradata[3], avctx->extradata[2],
|
||||
avctx->extradata[1], avctx->extradata[0]);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Original format %"PRIX32"\n",
|
||||
AV_RB32(avctx->extradata + 4));
|
||||
c->frame_info_size = AV_RL32(avctx->extradata + 8);
|
||||
c->flags = AV_RL32(avctx->extradata + 12);
|
||||
|
||||
if (c->frame_info_size != 4)
|
||||
avpriv_request_sample(avctx, "Frame info not 4 bytes");
|
||||
av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08"PRIX32"\n", c->flags);
|
||||
c->slices = (c->flags >> 24) + 1;
|
||||
c->compression = c->flags & 1;
|
||||
c->interlaced = c->flags & 0x800;
|
||||
} else if (c->pro && avctx->extradata_size == 8) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
|
||||
avctx->extradata[3], avctx->extradata[2],
|
||||
avctx->extradata[1], avctx->extradata[0]);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Original format %"PRIX32"\n",
|
||||
AV_RB32(avctx->extradata + 4));
|
||||
c->interlaced = 0;
|
||||
c->frame_info_size = 4;
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Insufficient extradata size %d, should be at least 16\n",
|
||||
avctx->extradata_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -951,9 +951,11 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
|
||||
Vp3Fragment *all_fragments = s->all_fragments;
|
||||
VLC_TYPE(*vlc_table)[2] = table->table;
|
||||
|
||||
if (num_coeffs < 0)
|
||||
if (num_coeffs < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Invalid number of coefficients at level %d\n", coeff_index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (eob_run > num_coeffs) {
|
||||
coeff_i =
|
||||
@@ -978,6 +980,9 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
|
||||
if (eob_run_get_bits[token])
|
||||
eob_run += get_bits(gb, eob_run_get_bits[token]);
|
||||
|
||||
if (!eob_run)
|
||||
eob_run = INT_MAX;
|
||||
|
||||
// record only the number of blocks ended in this plane,
|
||||
// any spill will be recorded in the next plane.
|
||||
if (eob_run > num_coeffs - coeff_i) {
|
||||
|
||||
@@ -606,6 +606,8 @@ static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
|
||||
s->fade_present = vp8_rac_get(c);
|
||||
}
|
||||
|
||||
if (c->end <= c->buffer && c->bits >= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* E. Fading information for previous frame */
|
||||
if (s->fade_present && vp8_rac_get(c)) {
|
||||
if ((ret = vp7_fade_frame(s ,c)) < 0)
|
||||
|
||||
@@ -480,7 +480,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
}
|
||||
|
||||
if (type == AV_SAMPLE_FMT_S16P) {
|
||||
if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) {
|
||||
if (FFABS((int64_t)L) + FFABS((int64_t)R) > (1<<19)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -1148,6 +1148,7 @@ static void save_bits(WmallDecodeCtx *s, GetBitContext* gb, int len,
|
||||
if (len <= 0 || buflen > s->max_frame_size) {
|
||||
avpriv_request_sample(s->avctx, "Too small input buffer");
|
||||
s->packet_loss = 1;
|
||||
s->num_saved_bits = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1255,7 +1256,9 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
|
||||
(frame_size = show_bits(gb, s->log2_frame_size)) &&
|
||||
frame_size <= remaining_bits(s, gb)) {
|
||||
save_bits(s, gb, frame_size, 0);
|
||||
s->packet_done = !decode_frame(s);
|
||||
|
||||
if (!s->packet_loss)
|
||||
s->packet_done = !decode_frame(s);
|
||||
} else if (!s->len_prefix
|
||||
&& s->num_saved_bits > get_bits_count(&s->gb)) {
|
||||
/* when the frames do not have a length prefix, we don't know the
|
||||
|
||||
+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
|
||||
@@ -86,8 +87,8 @@ cglobal diff_bytes, 4,5,2, dst, src1, src2, w
|
||||
jz .end_%1%2
|
||||
%if mmsize > 16
|
||||
; fall back to narrower xmm
|
||||
%define regsize mmsize / 2
|
||||
DIFF_BYTES_LOOP_PREP .setup_loop_gpr_aa
|
||||
%define regsize (mmsize / 2)
|
||||
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)) |
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
goto fail;
|
||||
}
|
||||
/* gains */
|
||||
sign = 1;
|
||||
while (1) {
|
||||
gain = 1;
|
||||
if (sscanf(arg, "%lf%n *%n", &gain, &len, &len))
|
||||
|
||||
@@ -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; \
|
||||
|
||||
@@ -573,7 +573,8 @@ static int export(AVFilterContext *ctx, StreamContext *sc, int input)
|
||||
/* error already handled */
|
||||
av_assert0(av_get_frame_filename(filename, sizeof(filename), sic->filename, input) == 0);
|
||||
} else {
|
||||
strcpy(filename, sic->filename);
|
||||
if (av_strlcpy(filename, sic->filename, sizeof(filename)) >= sizeof(filename))
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (sic->format == FORMAT_XML) {
|
||||
return xml_export(ctx, sc, filename);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user