Compare commits
185 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9079c70d20 | |||
| 4f71435248 | |||
| 934878f2a6 | |||
| 38d9a782a5 | |||
| 6de5ec8ef8 | |||
| 0d2b67d17c | |||
| d40bb6f5e9 | |||
| aadfec7d6c | |||
| 47c0626ec7 | |||
| 2f75ebe24a | |||
| a9081b36f4 | |||
| b120685dca | |||
| b44a3cd06e | |||
| a930db5c82 | |||
| f10252e47d | |||
| 4627033a23 | |||
| 20c440edbc | |||
| ab81ea1035 | |||
| 2f2904030f | |||
| 064d0c6462 | |||
| 9ce4350c48 | |||
| 6ae1b70cb4 | |||
| dbb121688c | |||
| 1667b3ea0f | |||
| 20d4514f25 | |||
| 8d3ac812ff | |||
| ba3a4a94bc | |||
| fb55620369 | |||
| 0a36341e96 | |||
| 1a21edf7b8 | |||
| 94c8e53034 | |||
| 132037ad5b | |||
| f3cb2eedeb | |||
| 736c73a243 | |||
| 0272afe70d | |||
| 165b2ee692 | |||
| ea153eb52c | |||
| f21e96109d | |||
| 94f3c06678 | |||
| 3ed986522a | |||
| f1116294aa | |||
| 0749384f0a | |||
| fe8960ab86 | |||
| 5b8a97d000 | |||
| ada21bca55 | |||
| 72403ba2b9 | |||
| eaf2bacca1 | |||
| cf61bf8107 | |||
| 93456ca3ea | |||
| b2522f35ec | |||
| e8558abeaf | |||
| b8d0d76740 | |||
| 4384481fbc | |||
| 347cc89daf | |||
| 7119574f48 | |||
| f17443cdcd | |||
| ee2396cefd | |||
| 01ed8d93b2 | |||
| 1729101c44 | |||
| 15cc151709 | |||
| 0a709e2a10 | |||
| 10d821309b | |||
| f8a331598e | |||
| f33c3ccbe7 | |||
| 7a86581afd | |||
| 3c98e4be89 | |||
| d2567caea9 | |||
| 452c78a09c | |||
| cce9471373 | |||
| 34282abc57 | |||
| e1b6d78bf7 | |||
| 53a32fdf0a | |||
| f3ac7e40d6 | |||
| 5217145824 | |||
| 311f2f5aba | |||
| 460abcd671 | |||
| 741c341968 | |||
| ad9ce1fa1d | |||
| 50c2ef91d3 | |||
| 20f5e2c177 | |||
| 6d7192bcb7 | |||
| 4c7477f132 | |||
| 90b6425b12 | |||
| 07944df9a7 | |||
| 34887d091d | |||
| ec5e262e1d | |||
| 0fb432a23b | |||
| 3dd1f38329 | |||
| d34d06d1e2 | |||
| cefbc513ea | |||
| 0d19167a65 | |||
| 00312b5ea4 | |||
| b7904b58af | |||
| aae731b9d3 | |||
| 4e6de49a5a | |||
| 52a7ae844b | |||
| 3dc62e679a | |||
| 4f02447d45 | |||
| 30abd8e6f9 | |||
| 706b427ff5 | |||
| 797621afab | |||
| e3a1d133f7 | |||
| fc74ac463c | |||
| eac6114e01 | |||
| 9b351d0d88 | |||
| e5e01d2477 | |||
| 771206c0db | |||
| 1998147f2e | |||
| 003cce421d | |||
| 795f65eed5 | |||
| a24cd04074 | |||
| c1074aea71 | |||
| d59e6cef79 | |||
| 0a0eec60c8 | |||
| ece91a3918 | |||
| 722cc62baa | |||
| 3a0e4368ec | |||
| 22dab0f4e1 | |||
| b578ba915f | |||
| 080edf29e7 | |||
| be9268e350 | |||
| b419c7564c | |||
| 586e00d7d3 | |||
| bc2cbb3077 | |||
| cd3314552b | |||
| 3e18f0fddd | |||
| b330fec1ce | |||
| 1d589a93b0 | |||
| d2476bd465 | |||
| c0895d64f5 | |||
| f5626db24e | |||
| 573e40e8f1 | |||
| 75d881f1a9 | |||
| b803624aae | |||
| dbff2d602d | |||
| 92a23e2a63 | |||
| 42163d4c55 | |||
| 4e8c5721b3 | |||
| f85a71527a | |||
| a49743407b | |||
| 190787a026 | |||
| 80cebb992c | |||
| 38fd2a33b9 | |||
| 861c05b286 | |||
| ba7ea7c4b1 | |||
| 6b839e9aa3 | |||
| abd5277318 | |||
| 17a4e791bf | |||
| e73efe4691 | |||
| a7442f8d35 | |||
| d11c686204 | |||
| 0ea475942e | |||
| 3cfb016071 | |||
| f832d7361d | |||
| ff4f525905 | |||
| a5875f8a1e | |||
| f397613f05 | |||
| 9c65a87bd4 | |||
| e605faaabc | |||
| f3b6ea1408 | |||
| e46bc3052d | |||
| f254c7ea13 | |||
| fc7c379060 | |||
| 686eb3b1ed | |||
| b6c0ad571f | |||
| 72e5607c87 | |||
| 4186702184 | |||
| fedd8b6507 | |||
| 6ebb9e7b77 | |||
| 6e788fadae | |||
| f34dc82d56 | |||
| b7b28b6aad | |||
| 21d50c185d | |||
| 72e5ccfe37 | |||
| b147ded288 | |||
| 75697b500c | |||
| 1cbeb16187 | |||
| 6ee4b20f4a | |||
| 3e38bf95c5 | |||
| cbae648eb8 | |||
| 2fb25e2dd6 | |||
| 3bc5e427e4 | |||
| 8640339dbb | |||
| 7fae0ea21d | |||
| 19fea7d703 |
@@ -2,6 +2,193 @@ Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
|
||||
version 3.3.3:
|
||||
- avcodec/dirac_dwt: Fix multiple integer overflows in COMPOSE_DD97iH0()
|
||||
- avcodec/diracdec: Fix integer overflow in divide3()
|
||||
- avcodec/takdec: Fix integer overflow in decode_subframe()
|
||||
- avformat/rtmppkt: Convert ff_amf_get_field_value() to bytestream2
|
||||
- avformat/rtmppkt: Convert ff_amf_tag_size() to bytestream2
|
||||
- avcodec/diracdec: Fix integer overflow in signed multiplication in UNPACK_ARITH()
|
||||
- avcodec/pixlet: Simplify nbits computation
|
||||
- avcodec/dnxhddec: Move mb height check out of non hr branch
|
||||
- avcodec/hevc_ps: fix integer overflow in log2_parallel_merge_level_minus2
|
||||
- avformat/oggparsecelt: Do not re-allocate os->private
|
||||
- avcodec/ylc: Fix shift overflow
|
||||
- avcodec/aacps: Fix multiple integer overflow in map_val_34_to_20()
|
||||
- avcodec/aacdec_fixed: fix: left shift of negative value -1
|
||||
- avcodec/dirac_vlc: Fix undefined shift
|
||||
- doc/filters: typo in frei0r
|
||||
- avcodec/cfhd: Fix decoding regression due to height check
|
||||
- avcodec/aacdec_template (fixed point): Check gain in decode_cce() to avoid undefined shifts later
|
||||
- avcodec/ffv1dec_template: Fix signed integer overflow
|
||||
- avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()
|
||||
- avcodec/magicyuv: Check that vlc len is not too large
|
||||
- avcodec/mjpegdec: Clip DC also on the negative side.
|
||||
- avcodec/aacps (fixed point): Fix multiple signed integer overflows
|
||||
- avcodec/ylc: Fix vlc of 31 bits
|
||||
- avcodec/sbrdsp_fixed: Fix integer overflow in sbr_hf_apply_noise()
|
||||
- avcodec/hevcdec: do not let updated extradata corrupt state
|
||||
- avcodec/wavpack: Fix invalid shift
|
||||
- avcodec/h264_slice: Fix signed integer overflow
|
||||
- avcodec/hevc_ps: Fix integer overflow with beta/tc offsets
|
||||
- avcodec/cfhd: Fix invalid left shift of negative value
|
||||
- avcodec/vb: Check vertical GMC component before multiply
|
||||
- avcodec/hevcdec: do basic validity check on delta_chroma_weight and offset
|
||||
- avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()
|
||||
- avcodec/apedec: Fix integer overflow
|
||||
- avcodec/wavpack: Fix integer overflow in wv_unpack_stereo()
|
||||
- avcodec/hevc_ps: Fix max_dec_buffer check
|
||||
- avcodec/mpeg4videodec: Fix GMC with videos of dimension 1
|
||||
- avcodec/wavpack: Fix integer overflow
|
||||
- avcodec/takdec: Fix integer overflow
|
||||
- avcodec/tiff: Update pointer only when the result is used
|
||||
- avcodec/cfhd: Check bpc before setting bpc in context
|
||||
- avcodec/cfhd: Fix undefined shift
|
||||
- avcodec/hevc_filter: Fix invalid shift
|
||||
- avcodec/mpeg4videodec: Fix overflow in virtual_ref computation
|
||||
- avcodec/lpc: signed integer overflow in compute_lpc_coefs() (aacdec_fixed)
|
||||
- avcodec/wavpack: Fix undefined integer negation
|
||||
- avcodec/aacdec_fixed: Check s for being too small
|
||||
- avcodec/htmlsubtitles: Replace very slow redundant sscanf() calls by cleaner and faster code
|
||||
- avcodec/h264: Fix mix of lossless and lossy MBs decoding
|
||||
- avcodec/h264_mb: Fix 8x8dct in lossless for new versions of x264
|
||||
- avcodec/h264_cabac: Fix CABAC+8x8dct in 4:4:4
|
||||
- avcodec/takdec: Fixes: integer overflow in AV_SAMPLE_FMT_U8P output
|
||||
- avcodec/jpeg2000dsp: Reorder operations in ict_int() to avoid 2 integer overflows
|
||||
- avcodec/hevcpred_template: Fix left shift of negative value
|
||||
- avcodec/hevcdec: Fix signed integer overflow in decode_lt_rps()
|
||||
- avcodec/jpeg2000dec: Check nonzerobits more completely
|
||||
- avcodec/shorten: Sanity check maxnlpc
|
||||
- avcodec/truemotion2: Move skip computation after checks
|
||||
- avcodec/jpeg2000: Fixes integer overflow in ff_jpeg2000_ceildivpow2()
|
||||
- avcodec/dnxhd_parser: Do not return invalid value from dnxhd_find_frame_end() on error
|
||||
- avcodec/hevcdec: Check nb_sps
|
||||
- avcodec/hevc_refs: Check nb_refs in add_candidate_ref()
|
||||
- avcodec/mpeg4videodec: Check sprite delta upshift against overflowing.
|
||||
- avcodec/mpeg4videodec: Fix integer overflow in num_sprite_warping_points=2 case
|
||||
- avcodec/aacsbr_fixed: Check shift in sbr_hf_assemble()
|
||||
- avcodec/sbrdsp_fixed: Return an error from sbr_hf_apply_noise() if operations are impossible
|
||||
- avcodec/libvpxdec: Check that display dimensions fit in the storage dimensions
|
||||
- avcodec/jpeg2000dwt: Fix runtime error: left shift of negative value -123
|
||||
- avcodec/wavpack: Fix runtime error: signed integer overflow: 1886191616 + 277872640 cannot be represented in type 'int'
|
||||
- avcodec/snowdec: Fix runtime error: left shift of negative value -1
|
||||
- avcodec/aacdec_fixed: Fix runtime error: left shift of negative value -1297616
|
||||
- avcodec/tiff: Fix leak of geotags[].val
|
||||
- avcodec/ra144: Fix runtime error: signed integer overflow: -2200 * 1033073 cannot be represented in type 'int'
|
||||
- avcodec/flicvideo: Fix runtime error: signed integer overflow: 4864 * 459296 cannot be represented in type 'int'
|
||||
- avcodec/cfhd: Check band parameters before storing them
|
||||
- avcodec/h264_parse: Check picture structure when initializig weight table
|
||||
- avcodec/indeo4: Check remaining data in Pic hdr extension parsing code
|
||||
- avcodec/ac3dec_fixed: Fix multiple runtime error: signed integer overflow: -39271008 * 59 cannot be represented in type 'int'
|
||||
- lavc/aarch64/simple_idct: fix idct_col4_top coefficient
|
||||
|
||||
|
||||
version 3.3.2:
|
||||
- avcodec/mpeg4videodec: Fix runtime error: signed integer overflow: 53098 * 40448 cannot be represented in type 'int'
|
||||
- avcodec/pafvideo: Fix assertion failure
|
||||
- avcodec/takdec: Fix multiple runtime error: signed integer overflow: 637072 * 4096 cannot be represented in type 'int'
|
||||
- avcodec/mjpegdec: Check that reference frame matches the current frame
|
||||
- avcodec/tiff: Avoid loosing allocated geotag values
|
||||
- avcodec/cavs: Fix runtime error: signed integer overflow: -12648062 * 256 cannot be represented in type 'int'
|
||||
- avformat/hls: Check local file extensions
|
||||
- avcodec/qdrw: Fix null pointer dereference
|
||||
- avutil/softfloat: Fix sign error in and improve documentation of av_int2sf()
|
||||
- avcodec/hevc_ps: Fix runtime error: index 32 out of bounds for type 'uint8_t [32]'
|
||||
- avcodec/dxv: Check remaining bytes in dxv_decompress_raw()
|
||||
- avcodec/pafvideo: Check packet size and frame code before ff_reget_buffer()
|
||||
- avcodec/ac3dec_fixed: Fix runtime error: left shift of 419 by 23 places cannot be represented in type 'int'
|
||||
- avformat/options: log filename on open
|
||||
- avcodec/aacps: Fix runtime error: left shift of 1073741824 by 1 places cannot be represented in type 'INTFLOAT' (aka 'int')
|
||||
- avcodec/wavpack: Fix runtime error: shift exponent 32 is too large for 32-bit type 'int'
|
||||
- avcodec/cfhd: Fix runtime error: signed integer overflow: 65280 * 65288 cannot be represented in type 'int'
|
||||
- avcodec/wavpack: Fix runtime error: signed integer overflow: 2013265955 - -134217694 cannot be represented in type 'int'
|
||||
- avcodec/cinepak: Check input packet size before frame reallocation
|
||||
- avcodec/hevc_ps: Fix runtime error: signed integer overflow: 2147483628 + 256 cannot be represented in type 'int'
|
||||
- avcodec/ra144: Fixes runtime error: signed integer overflow: 7160 * 327138 cannot be represented in type 'int'
|
||||
- avcodec/pnm: Use ff_set_dimensions()
|
||||
- avcodec/cavsdec: Fix runtime error: signed integer overflow: 59 + 2147483600 cannot be represented in type 'int'
|
||||
- avcodec/nvenc: fix hw accelerated transcode with bframes
|
||||
- libavformat/hls: Observe Set-Cookie headers
|
||||
- libavformat/http: Ignore expired cookies
|
||||
- avformat/avidec: Limit formats in gab2 to srt and ass/ssa
|
||||
- avcodec/acelp_pitch_delay: Fix runtime error: value 4.83233e+39 is outside the range of representable values of type 'float'
|
||||
- avcodec/wavpack: Check float_shift
|
||||
- avcodec/wavpack: Fix runtime error: signed integer overflow: 24 * -2147483648 cannot be represented in type 'int'
|
||||
- avcodec/ansi: Fix frame memleak
|
||||
- avcodec/dds: Fix runtime error: left shift of 145 by 24 places cannot be represented in type 'int'
|
||||
- avcodec/jpeg2000dec: Use ff_set_dimensions()
|
||||
- avcodec/truemotion2: Fix passing null pointer to memset()
|
||||
- avcodec/truemotion2: Fix runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
|
||||
- avcodec/ra144: Fix runtime error: signed integer overflow: -2449 * 1398101 cannot be represented in type 'int'
|
||||
- avcodec/ra144: Fix runtime error: signed integer overflow: 11184810 * 404 cannot be represented in type 'int'
|
||||
- avcodec/aac_defines: Add missing () to AAC_HALF_SUM() macro
|
||||
- avcodec/webp: Fixes null pointer dereference
|
||||
- avcodec/aacdec_fixed: Fix runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
|
||||
- avcodec/ylc: Check count in build_vlc()
|
||||
- avcodec/snow: Fix runtime error: signed integer overflow: 1086573993 + 1086573994 cannot be represented in type 'int'
|
||||
- avcodec/jpeg2000: Fix runtime error: signed integer overflow: 4185 + 2147483394 cannot be represented in type 'int'
|
||||
- avcodec/jpeg2000dec: Check tile offsets more completely
|
||||
- avcodec/sheervideo: Check input buffer size before allocating and decoding
|
||||
- avcodec/aacdec_fixed: Fix multiple runtime error: shift exponent 127 is too large for 32-bit type 'int'
|
||||
- avcodec/wnv1: More strict buffer size check
|
||||
- avcodec/libfdk-aacdec: Correct buffer_size parameter
|
||||
- avcodec/sbrdsp_template: Fix: runtime error: signed integer overflow: 849815297 + 1315389781 cannot be represented in type 'int'
|
||||
- avcodec/ivi_dsp: Fix runtime error: left shift of negative value -2
|
||||
- doc/filters: Clarify scale2ref example
|
||||
- avcodec/mlpdec: Do not leave invalid values in matrix_out_ch[] on error
|
||||
- avcodec/ra144dec: Fix runtime error: left shift of negative value -17
|
||||
- avcodec/pixlet: Fix runtime error: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int'
|
||||
- avformat/mux: Fix copy an paste typo
|
||||
- avutil/internal: Do not enable CHECKED with DEBUG
|
||||
- avcodec/clearvideo: Check buf_size before decoding frame
|
||||
- avcodec/aacdec_fixed: Fix runtime error: signed integer overflow: -2147483648 * -1 cannot be represented in type 'int'
|
||||
- avcodec/smc: Check remaining input
|
||||
- avcodec/diracdec: Fix off by 1 error in quant check
|
||||
- avcodec/jpeg2000dec: Fix copy and paste error
|
||||
- avcodec/jpeg2000dec: Check tile offsets
|
||||
- avcodec/sanm: Fix uninitialized reference frames
|
||||
- avcodec/jpeglsdec: Check get_bits_left() before decoding a picture
|
||||
- avcodec/fmvc: Fix use of uninitialized memory when the first frame is not a keyframe
|
||||
- avcodec/ivi_dsp: Fix multiple runtime error: left shift of negative value -71
|
||||
- avcodec/mjpegdec: Fix runtime error: signed integer overflow: -32767 * 130560 cannot be represented in type 'int'
|
||||
- avcodec/aacdec_fixed: Fix runtime error: shift exponent 34 is too large for 32-bit type 'int'
|
||||
- avcodec/mpeg4videodec: Check for multiple VOL headers
|
||||
- avcodec/vp9block: fix runtime error: signed integer overflow: 196675 * 20670 cannot be represented in type 'int'
|
||||
- avcodec/vmnc: Check location before use
|
||||
- avcodec/takdec: Fix runtime error: signed integer overflow: 8192 * 524308 cannot be represented in type 'int'
|
||||
- avcodec/aac_defines: Fix: runtime error: left shift of negative value -2
|
||||
- avcodec/takdec: Fix runtime error: left shift of negative value -63
|
||||
- avcodec/mlpdsp: Fix runtime error: signed integer overflow: -24419392 * 128 cannot be represented in type 'int'
|
||||
- avcodec/sbrdsp_fixed: fix runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
|
||||
- avcodec/aacsbr_fixed: Fix multiple runtime error: shift exponent 170 is too large for 32-bit type 'int'
|
||||
- avcodec/mlpdec: Do not leave a invalid num_primitive_matrices in the context
|
||||
- avcodec/aacsbr_fixed: Fix multiple runtime error: shift exponent 150 is too large for 32-bit type 'int'
|
||||
- avcodec/mimic: Use ff_set_dimensions() to set the dimensions
|
||||
- avcodec/fic: Fix multiple runtime error: signed integer overflow: 5793 * 419752 cannot be represented in type 'int'
|
||||
- avcodec/pixlet: Fix reading invalid numbers of bits
|
||||
- avcodec/mlpdec: Fix: runtime error: left shift of negative value -8
|
||||
- avcodec/dfa: Fix: runtime error: signed integer overflow: -14202 * 196877 cannot be represented in type 'int'
|
||||
- avcodec/aacdec: Fix runtime error: signed integer overflow: 2147483520 + 255 cannot be represented in type 'int'
|
||||
- avcodec/aacdec_template: Fix fixed point scale in decode_cce()
|
||||
- avcodec/fmvc: Fix off by 1 error
|
||||
- avcodec/flicvideo: Check frame_size before decrementing
|
||||
- avcodec/mlpdec: Fix runtime error: left shift of negative value -1
|
||||
- avcodec/takdec: Fix runtime error: left shift of negative value -42
|
||||
- avcodec/hq_hqa: Fix: runtime error: signed integer overflow: -255 * 10180917 cannot be represented in type 'int'
|
||||
- avcodec/scpr: mask bits to prevent out of array read
|
||||
- avcodec/truemotion1: Fix multiple runtime error: signed integer overflow: 1246906962 * 2 cannot be represented in type 'int'
|
||||
- avcodec/svq3: Fix runtime error: left shift of negative value -6
|
||||
- avcodec/tiff: reset sampling[] if its invalid
|
||||
- configure: Fix the msvcrt version check for mingw32
|
||||
- lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out
|
||||
- lavc/ffjni: add missing '\n'
|
||||
- lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack
|
||||
- lavc/mediacodec_wrapper: fix local reference leaks
|
||||
- avcodec/nvenc: remove unnecessary alignment
|
||||
- Use AVOnce as a static variable consistently
|
||||
- avfilter: take_samples: do not directly return frame when samples are skipped
|
||||
- avutil/hwcontext_dxva2: Don't improperly free IDirect3DSurface9 objects
|
||||
|
||||
version 3.3.1:
|
||||
- libswscale/tests/swscale: Fix uninitialized variables
|
||||
- avcodec/ffv1dec: Fix runtime error: signed integer overflow: 1550964438 + 1550964438 cannot be represented in type 'int'
|
||||
|
||||
@@ -5067,7 +5067,7 @@ probe_libc(){
|
||||
add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
|
||||
check_${pfx}cpp_condition _mingw.h "defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0502" ||
|
||||
add_${pfx}cppflags -D_WIN32_WINNT=0x0502
|
||||
check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700__" &&
|
||||
check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
|
||||
add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
|
||||
eval test \$${pfx_no_}cc_type = "gcc" &&
|
||||
add_${pfx}cppflags -D__printf__=__gnu_printf__
|
||||
|
||||
+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.1
|
||||
PROJECT_NUMBER = 3.3.3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
+2
-2
@@ -8263,7 +8263,7 @@ It accepts the following parameters:
|
||||
@item filter_name
|
||||
The name of the frei0r effect to load. If the environment variable
|
||||
@env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
|
||||
directories specified by the colon-separated list in @env{FREIOR_PATH}.
|
||||
directories specified by the colon-separated list in @env{FREI0R_PATH}.
|
||||
Otherwise, the standard frei0r paths are searched, in this order:
|
||||
@file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
|
||||
@file{/usr/lib/frei0r-1/}.
|
||||
@@ -12077,7 +12077,7 @@ uses the reference video instead of the main input as basis.
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Scale a subtitle stream to match the main video in size before overlaying
|
||||
Scale a subtitle stream (b) to match the main video (a) in size before overlaying
|
||||
@example
|
||||
'scale2ref[b][a];[a][b]overlay'
|
||||
@end example
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define AAC_RENAME(x) x ## _fixed
|
||||
#define AAC_RENAME_32(x) x ## _fixed_32
|
||||
typedef int INTFLOAT;
|
||||
typedef unsigned UINTFLOAT; ///< Equivalent to INTFLOAT, Used as temporal cast to avoid undefined sign overflow operations.
|
||||
typedef int64_t INT64FLOAT;
|
||||
typedef int16_t SHORTFLOAT;
|
||||
typedef SoftFloat AAC_FLOAT;
|
||||
@@ -45,7 +46,7 @@ typedef int AAC_SIGNE;
|
||||
#define Q30(x) (int)((x)*1073741824.0 + 0.5)
|
||||
#define Q31(x) (int)((x)*2147483648.0 + 0.5)
|
||||
#define RANGE15(x) x
|
||||
#define GET_GAIN(x, y) (-(y) << (x)) + 1024
|
||||
#define GET_GAIN(x, y) (-(y) * (1 << (x))) + 1024
|
||||
#define AAC_MUL16(x, y) (int)(((int64_t)(x) * (y) + 0x8000) >> 16)
|
||||
#define AAC_MUL26(x, y) (int)(((int64_t)(x) * (y) + 0x2000000) >> 26)
|
||||
#define AAC_MUL30(x, y) (int)(((int64_t)(x) * (y) + 0x20000000) >> 30)
|
||||
@@ -72,7 +73,7 @@ typedef int AAC_SIGNE;
|
||||
#define AAC_MSUB31_V3(x, y, z) (int)((((int64_t)(x) * (z)) - \
|
||||
((int64_t)(y) * (z)) + \
|
||||
0x40000000) >> 31)
|
||||
#define AAC_HALF_SUM(x, y) (x) >> 1 + (y) >> 1
|
||||
#define AAC_HALF_SUM(x, y) (((x) >> 1) + ((y) >> 1))
|
||||
#define AAC_SRA_R(x, y) (int)(((x) + (1 << ((y) - 1))) >> (y))
|
||||
|
||||
#else
|
||||
@@ -83,6 +84,7 @@ typedef int AAC_SIGNE;
|
||||
#define AAC_RENAME(x) x
|
||||
#define AAC_RENAME_32(x) x
|
||||
typedef float INTFLOAT;
|
||||
typedef float UINTFLOAT;
|
||||
typedef float INT64FLOAT;
|
||||
typedef float SHORTFLOAT;
|
||||
typedef float AAC_FLOAT;
|
||||
|
||||
+3
-1
@@ -431,6 +431,8 @@ static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb)
|
||||
if (ctx->frame_length_type == 0) {
|
||||
int mux_slot_length = 0;
|
||||
do {
|
||||
if (get_bits_left(gb) < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
tmp = get_bits(gb, 8);
|
||||
mux_slot_length += tmp;
|
||||
} while (tmp == 255);
|
||||
@@ -460,7 +462,7 @@ static int read_audio_mux_element(struct LATMContext *latmctx,
|
||||
}
|
||||
if (latmctx->audio_mux_version_A == 0) {
|
||||
int mux_slot_length_bytes = read_payload_length_info(latmctx, gb);
|
||||
if (mux_slot_length_bytes * 8 > get_bits_left(gb)) {
|
||||
if (mux_slot_length_bytes < 0 || mux_slot_length_bytes * 8LL > get_bits_left(gb)) {
|
||||
av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, "incomplete frame\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (mux_slot_length_bytes * 8 + 256 < get_bits_left(gb)) {
|
||||
|
||||
@@ -181,14 +181,15 @@ static void subband_scale(int *dst, int *src, int scale, int offset, int len)
|
||||
out = (int)(((int64_t)src[i] * c) >> 32);
|
||||
dst[i] = ((int)(out+round) >> s) * ssign;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else if (s > -32) {
|
||||
s = s + 32;
|
||||
round = 1 << (s-1);
|
||||
for (i=0; i<len; i++) {
|
||||
out = (int)((int64_t)((int64_t)src[i] * c + round) >> s);
|
||||
dst[i] = out * ssign;
|
||||
dst[i] = out * (unsigned)ssign;
|
||||
}
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Overflow in subband_scale()\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,8 +208,12 @@ static void noise_scale(int *coefs, int scale, int band_energy, int len)
|
||||
c /= band_energy;
|
||||
s = 21 + nlz - (s >> 2);
|
||||
|
||||
if (s > 0) {
|
||||
round = 1 << (s-1);
|
||||
if (s > 31) {
|
||||
for (i=0; i<len; i++) {
|
||||
coefs[i] = 0;
|
||||
}
|
||||
} else if (s >= 0) {
|
||||
round = s ? 1 << (s-1) : 0;
|
||||
for (i=0; i<len; i++) {
|
||||
out = (int)(((int64_t)coefs[i] * c) >> 32);
|
||||
coefs[i] = ((int)(out+round) >> s) * ssign;
|
||||
@@ -366,7 +371,9 @@ static void apply_dependent_coupling_fixed(AACContext *ac,
|
||||
shift = (gain-1024) >> 3;
|
||||
}
|
||||
|
||||
if (shift < 0) {
|
||||
if (shift < -31) {
|
||||
// Nothing to do
|
||||
} else if (shift < 0) {
|
||||
shift = -shift;
|
||||
round = 1 << (shift - 1);
|
||||
|
||||
@@ -383,7 +390,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 << shift;
|
||||
dest[group * 128 + k] += tmp * (1 << shift);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,7 +430,7 @@ static void apply_independent_coupling_fixed(AACContext *ac,
|
||||
else {
|
||||
for (i = 0; i < len; i++) {
|
||||
tmp = (int)(((int64_t)src[i] * c + (int64_t)0x1000000000) >> 37);
|
||||
dest[i] += tmp << shift;
|
||||
dest[i] += tmp * (1 << shift);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2181,7 +2181,11 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
||||
coup->coupling_point += get_bits1(gb) || (coup->coupling_point >> 1);
|
||||
|
||||
sign = get_bits(gb, 1);
|
||||
scale = AAC_RENAME(cce_scale)[get_bits(gb, 2)];
|
||||
#if USE_FIXED
|
||||
scale = get_bits(gb, 2);
|
||||
#else
|
||||
scale = cce_scale[get_bits(gb, 2)];
|
||||
#endif
|
||||
|
||||
if ((ret = decode_ics(ac, sce, gb, 0, 0)))
|
||||
return ret;
|
||||
@@ -2195,6 +2199,10 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
||||
cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
|
||||
gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
|
||||
gain_cache = GET_GAIN(scale, gain);
|
||||
#if USE_FIXED
|
||||
if ((abs(gain_cache)-1024) >> 3 > 30)
|
||||
return AVERROR(ERANGE);
|
||||
#endif
|
||||
}
|
||||
if (coup->coupling_point == AFTER_IMDCT) {
|
||||
coup->gain[c][0] = gain_cache;
|
||||
@@ -2212,6 +2220,10 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
||||
t >>= 1;
|
||||
}
|
||||
gain_cache = GET_GAIN(scale, t) * s;
|
||||
#if USE_FIXED
|
||||
if ((abs(gain_cache)-1024) >> 3 > 30)
|
||||
return AVERROR(ERANGE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
coup->gain[c][idx] = gain_cache;
|
||||
@@ -2385,7 +2397,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
|
||||
* @param decode 1 if tool is used normally, 0 if tool is used in LTP.
|
||||
* @param coef spectral coefficients
|
||||
*/
|
||||
static void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
|
||||
static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
|
||||
IndividualChannelStream *ics, int decode)
|
||||
{
|
||||
const int mmm = FFMIN(ics->tns_max_bands, ics->max_sfb);
|
||||
@@ -2393,6 +2405,7 @@ static void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
|
||||
int bottom, top, order, start, end, size, inc;
|
||||
INTFLOAT lpc[TNS_MAX_ORDER];
|
||||
INTFLOAT tmp[TNS_MAX_ORDER+1];
|
||||
UINTFLOAT *coef = coef_param;
|
||||
|
||||
for (w = 0; w < ics->num_windows; w++) {
|
||||
bottom = ics->num_swb;
|
||||
@@ -2422,7 +2435,7 @@ static void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
|
||||
// ar filter
|
||||
for (m = 0; m < size; m++, start += inc)
|
||||
for (i = 1; i <= FFMIN(m, order); i++)
|
||||
coef[start] -= AAC_MUL26(coef[start - i * inc], lpc[i - 1]);
|
||||
coef[start] -= AAC_MUL26((INTFLOAT)coef[start - i * inc], lpc[i - 1]);
|
||||
} else {
|
||||
// ma filter
|
||||
for (m = 0; m < size; m++, start += inc) {
|
||||
|
||||
+13
-22
@@ -499,13 +499,13 @@ static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
|
||||
static void map_val_34_to_20(INTFLOAT par[PS_MAX_NR_IIDICC])
|
||||
{
|
||||
#if USE_FIXED
|
||||
par[ 0] = (int)(((int64_t)(par[ 0] + (par[ 1]>>1)) * 1431655765 + \
|
||||
par[ 0] = (int)(((int64_t)(par[ 0] + (unsigned)(par[ 1]>>1)) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
par[ 1] = (int)(((int64_t)((par[ 1]>>1) + par[ 2]) * 1431655765 + \
|
||||
par[ 1] = (int)(((int64_t)((par[ 1]>>1) + (unsigned)par[ 2]) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
par[ 2] = (int)(((int64_t)(par[ 3] + (par[ 4]>>1)) * 1431655765 + \
|
||||
par[ 2] = (int)(((int64_t)(par[ 3] + (unsigned)(par[ 4]>>1)) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
par[ 3] = (int)(((int64_t)((par[ 4]>>1) + par[ 5]) * 1431655765 + \
|
||||
par[ 3] = (int)(((int64_t)((par[ 4]>>1) + (unsigned)par[ 5]) * 1431655765 + \
|
||||
0x40000000) >> 31);
|
||||
#else
|
||||
par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333f;
|
||||
@@ -692,26 +692,17 @@ static void decorrelation(PSContext *ps, INTFLOAT (*out)[32][2], const INTFLOAT
|
||||
for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
|
||||
for (n = n0; n < nL; n++) {
|
||||
int decayed_peak;
|
||||
int denom;
|
||||
|
||||
decayed_peak = (int)(((int64_t)peak_decay_factor * \
|
||||
peak_decay_nrg[i] + 0x40000000) >> 31);
|
||||
peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]);
|
||||
power_smooth[i] += (power[i][n] - power_smooth[i] + 2) >> 2;
|
||||
peak_decay_diff_smooth[i] += (peak_decay_nrg[i] - power[i][n] - \
|
||||
peak_decay_diff_smooth[i] + 2) >> 2;
|
||||
denom = peak_decay_diff_smooth[i] + (peak_decay_diff_smooth[i] >> 1);
|
||||
if (denom > power_smooth[i]) {
|
||||
int p = power_smooth[i];
|
||||
while (denom < 0x40000000) {
|
||||
denom <<= 1;
|
||||
p <<= 1;
|
||||
}
|
||||
transient_gain[i][n] = p / (denom >> 16);
|
||||
}
|
||||
else {
|
||||
transient_gain[i][n] = 1 << 16;
|
||||
}
|
||||
power_smooth[i] += (power[i][n] + 2LL - power_smooth[i]) >> 2;
|
||||
peak_decay_diff_smooth[i] += (peak_decay_nrg[i] + 2LL - power[i][n] - \
|
||||
peak_decay_diff_smooth[i]) >> 2;
|
||||
|
||||
if (peak_decay_diff_smooth[i]) {
|
||||
transient_gain[i][n] = FFMIN(power_smooth[i]*43691LL / peak_decay_diff_smooth[i], 1<<16);
|
||||
} else
|
||||
transient_gain[i][n] = 1 << 16;
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -942,7 +933,7 @@ static void stereo_processing(PSContext *ps, INTFLOAT (*l)[32][2], INTFLOAT (*r)
|
||||
int stop = ps->border_position[e+1];
|
||||
INTFLOAT width = Q30(1.f) / ((stop - start) ? (stop - start) : 1);
|
||||
#if USE_FIXED
|
||||
width <<= 1;
|
||||
width = FFMIN(2U*width, INT_MAX);
|
||||
#endif
|
||||
b = k_to_i[k];
|
||||
h[0][0] = H11[0][e][b];
|
||||
|
||||
+31
-10
@@ -288,6 +288,8 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp,
|
||||
shift = a00.exp;
|
||||
if (shift >= 3)
|
||||
alpha0[k][0] = 0x7fffffff;
|
||||
else if (shift <= -30)
|
||||
alpha0[k][0] = 0;
|
||||
else {
|
||||
a00.mant <<= 1;
|
||||
shift = 2-shift;
|
||||
@@ -302,6 +304,8 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp,
|
||||
shift = a01.exp;
|
||||
if (shift >= 3)
|
||||
alpha0[k][1] = 0x7fffffff;
|
||||
else if (shift <= -30)
|
||||
alpha0[k][1] = 0;
|
||||
else {
|
||||
a01.mant <<= 1;
|
||||
shift = 2-shift;
|
||||
@@ -315,6 +319,8 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp,
|
||||
shift = a10.exp;
|
||||
if (shift >= 3)
|
||||
alpha1[k][0] = 0x7fffffff;
|
||||
else if (shift <= -30)
|
||||
alpha1[k][0] = 0;
|
||||
else {
|
||||
a10.mant <<= 1;
|
||||
shift = 2-shift;
|
||||
@@ -329,6 +335,8 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp,
|
||||
shift = a11.exp;
|
||||
if (shift >= 3)
|
||||
alpha1[k][1] = 0x7fffffff;
|
||||
else if (shift <= -30)
|
||||
alpha1[k][1] = 0;
|
||||
else {
|
||||
a11.mant <<= 1;
|
||||
shift = 2-shift;
|
||||
@@ -567,20 +575,33 @@ static void sbr_hf_assemble(int Y1[38][64][2],
|
||||
|
||||
SoftFloat *in = sbr->s_m[e];
|
||||
for (m = 0; m+1 < m_max; m+=2) {
|
||||
shift = 22 - in[m ].exp;
|
||||
round = 1 << (shift-1);
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
int shift2;
|
||||
shift = 22 - in[m ].exp;
|
||||
shift2= 22 - in[m+1].exp;
|
||||
if (shift < 1 || shift2 < 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Overflow in sbr_hf_assemble, shift=%d,%d\n", shift, shift2);
|
||||
return;
|
||||
}
|
||||
if (shift < 32) {
|
||||
round = 1 << (shift-1);
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
}
|
||||
|
||||
shift = 22 - in[m+1].exp;
|
||||
round = 1 << (shift-1);
|
||||
out[2*m+2] += (in[m+1].mant * B + round) >> shift;
|
||||
if (shift2 < 32) {
|
||||
round = 1 << (shift2-1);
|
||||
out[2*m+2] += (in[m+1].mant * B + round) >> shift2;
|
||||
}
|
||||
}
|
||||
if(m_max&1)
|
||||
{
|
||||
shift = 22 - in[m ].exp;
|
||||
round = 1 << (shift-1);
|
||||
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
shift = 22 - in[m ].exp;
|
||||
if (shift < 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Overflow in sbr_hf_assemble, shift=%d\n", shift);
|
||||
return;
|
||||
} else if (shift < 32) {
|
||||
round = 1 << (shift-1);
|
||||
out[2*m ] += (in[m ].mant * A + round) >> shift;
|
||||
}
|
||||
}
|
||||
}
|
||||
indexnoise = (indexnoise + m_max) & 0x1ff;
|
||||
|
||||
@@ -74,7 +74,7 @@ endconst
|
||||
.endm
|
||||
|
||||
.macro idct_col4_top y1, y2, y3, y4, i, l
|
||||
smull\i v7.4S, \y3\l, z1
|
||||
smull\i v7.4S, \y3\l, z2
|
||||
smull\i v16.4S, \y3\l, z6
|
||||
smull\i v17.4S, \y2\l, z1
|
||||
add v19.4S, v23.4S, v7.4S
|
||||
|
||||
@@ -65,11 +65,11 @@ static void scale_coefs (
|
||||
int len)
|
||||
{
|
||||
int i, shift, round;
|
||||
int16_t mul;
|
||||
unsigned mul;
|
||||
int temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||
|
||||
mul = (dynrng & 0x1f) + 0x20;
|
||||
shift = 4 - ((dynrng << 23) >> 28);
|
||||
shift = 4 - (sign_extend(dynrng, 9) >> 5);
|
||||
if (shift > 0 ) {
|
||||
round = 1 << (shift-1);
|
||||
for (i=0; i<len; i+=8) {
|
||||
|
||||
@@ -135,7 +135,7 @@ float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy,
|
||||
ff_exp10(0.05 *
|
||||
(avpriv_scalarproduct_float_c(pred_table, prediction_error, 4) +
|
||||
energy_mean)) /
|
||||
sqrtf(fixed_mean_energy);
|
||||
sqrtf(fixed_mean_energy ? fixed_mean_energy : 1.0);
|
||||
|
||||
// update quantified prediction error energy history
|
||||
memmove(&prediction_error[0], &prediction_error[1],
|
||||
|
||||
+5
-4
@@ -80,10 +80,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
AnsiContext *s = avctx->priv_data;
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
/* defaults */
|
||||
s->font = avpriv_vga16_font;
|
||||
s->font_height = 16;
|
||||
@@ -98,6 +94,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -1412,6 +1412,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int32_t *sample24;
|
||||
int i, ch, ret;
|
||||
int blockstodecode;
|
||||
uint64_t decoded_buffer_size;
|
||||
|
||||
/* this should never be negative, but bad things will happen if it is, so
|
||||
check it just to make sure. */
|
||||
@@ -1467,7 +1468,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
skip_bits_long(&s->gb, offset);
|
||||
}
|
||||
|
||||
if (!nblocks || nblocks > INT_MAX) {
|
||||
if (!nblocks || nblocks > INT_MAX / 2 / sizeof(*s->decoded_buffer) - 8) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %"PRIu32".\n",
|
||||
nblocks);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1493,8 +1494,9 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
blockstodecode = s->samples;
|
||||
|
||||
/* reallocate decoded sample buffer if needed */
|
||||
av_fast_malloc(&s->decoded_buffer, &s->decoded_size,
|
||||
2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer));
|
||||
decoded_buffer_size = 2LL * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer);
|
||||
av_assert0(decoded_buffer_size <= INT_MAX);
|
||||
av_fast_malloc(&s->decoded_buffer, &s->decoded_size, decoded_buffer_size);
|
||||
if (!s->decoded_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
memset(s->decoded_buffer, 0, s->decoded_size);
|
||||
|
||||
+1
-2
@@ -537,8 +537,7 @@ void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type)
|
||||
static inline void scale_mv(AVSContext *h, int *d_x, int *d_y,
|
||||
cavs_vector *src, int distp)
|
||||
{
|
||||
int den = h->scale_den[FFMAX(src->ref, 0)];
|
||||
|
||||
int64_t den = h->scale_den[FFMAX(src->ref, 0)];
|
||||
*d_x = (src->x * distp * den + 256 + FF_SIGNBIT(src->x)) >> 9;
|
||||
*d_y = (src->y * distp * den + 256 + FF_SIGNBIT(src->y)) >> 9;
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ static inline int decode_residual_inter(AVSContext *h)
|
||||
|
||||
/* get quantizer */
|
||||
if (h->cbp && !h->qp_fixed)
|
||||
h->qp = (h->qp + get_se_golomb(&h->gb)) & 63;
|
||||
h->qp = (h->qp + (unsigned)get_se_golomb(&h->gb)) & 63;
|
||||
for (block = 0; block < 4; block++)
|
||||
if (h->cbp & (1 << block))
|
||||
decode_residual_block(h, &h->gb, inter_dec, 0, h->qp,
|
||||
|
||||
+22
-16
@@ -258,6 +258,11 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->coded_height = data;
|
||||
} else if (tag == 101) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Bits per component: %"PRIu16"\n", data);
|
||||
if (data < 1 || data > 31) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Bits per component %d is invalid\n", data);
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->bpc = data;
|
||||
} else if (tag == 12) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Channel Count: %"PRIu16"\n", data);
|
||||
@@ -317,22 +322,22 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->prescale_shift[2] = (data >> 6) & 0x7;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Prescale shift (VC-5): %x\n", data);
|
||||
} else if (tag == 27) {
|
||||
s->plane[s->channel_num].band[0][0].width = data;
|
||||
s->plane[s->channel_num].band[0][0].stride = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Lowpass width %"PRIu16"\n", data);
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].a_width) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid lowpass width\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->plane[s->channel_num].band[0][0].width = data;
|
||||
s->plane[s->channel_num].band[0][0].stride = data;
|
||||
} else if (tag == 28) {
|
||||
s->plane[s->channel_num].band[0][0].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Lowpass height %"PRIu16"\n", data);
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].height) {
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].a_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid lowpass height\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->plane[s->channel_num].band[0][0].height = data;
|
||||
} else if (tag == 1)
|
||||
av_log(avctx, AV_LOG_DEBUG, "Sample type? %"PRIu16"\n", data);
|
||||
else if (tag == 10) {
|
||||
@@ -363,39 +368,39 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
av_log(avctx, AV_LOG_DEBUG, "Tag/Value = %x %x\n", tag2, val2);
|
||||
}
|
||||
} else if (tag == 41) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass width %i channel %i level %i subband %i\n", data, s->channel_num, s->level, s->subband_num);
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass width\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
} else if (tag == 42) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass height %i\n", data);
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass height\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
} else if (tag == 49) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass width2 %i\n", data);
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass width2\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
} else if (tag == 50) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass height2 %i\n", data);
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass height2\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
} else if (tag == 71) {
|
||||
s->codebook = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Codebook %i\n", s->codebook);
|
||||
@@ -404,12 +409,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
av_log(avctx, AV_LOG_DEBUG, "Other codebook? %i\n", s->codebook);
|
||||
} else if (tag == 70) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Subsampling or bit-depth flag? %i\n", data);
|
||||
s->bpc = data;
|
||||
if (!(s->bpc == 10 || s->bpc == 12)) {
|
||||
if (!(data == 10 || data == 12)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid bits per channel\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
}
|
||||
s->bpc = data;
|
||||
} else if (tag == 84) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Sample format? %i\n", data);
|
||||
if (data == 1)
|
||||
@@ -501,7 +506,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int highpass_a_width = s->plane[s->channel_num].band[s->level][s->subband_num].a_width;
|
||||
int highpass_a_height = s->plane[s->channel_num].band[s->level][s->subband_num].a_height;
|
||||
int highpass_stride = s->plane[s->channel_num].band[s->level][s->subband_num].stride;
|
||||
int expected = highpass_height * highpass_stride;
|
||||
int expected;
|
||||
int a_expected = highpass_a_height * highpass_a_width;
|
||||
int level, run, coeff;
|
||||
int count = 0, bytes;
|
||||
@@ -512,11 +517,12 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (highpass_height > highpass_a_height || highpass_width > highpass_a_width || a_expected < expected) {
|
||||
if (highpass_height > highpass_a_height || highpass_width > highpass_a_width || a_expected < highpass_height * (uint64_t)highpass_stride) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many highpass coefficients\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto end;
|
||||
}
|
||||
expected = highpass_height * highpass_stride;
|
||||
|
||||
av_log(avctx, AV_LOG_DEBUG, "Start subband coeffs plane %i level %i codebook %i expected %i\n", s->channel_num, s->level, s->codebook, expected);
|
||||
|
||||
@@ -657,7 +663,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
output = s->plane[plane].subband[0];
|
||||
for (i = 0; i < lowpass_height * 2; i++) {
|
||||
for (j = 0; j < lowpass_width * 2; j++)
|
||||
output[j] <<= 2;
|
||||
output[j] *= 4;
|
||||
|
||||
output += lowpass_width * 2;
|
||||
}
|
||||
@@ -710,7 +716,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
output = s->plane[plane].subband[0];
|
||||
for (i = 0; i < lowpass_height * 2; i++) {
|
||||
for (j = 0; j < lowpass_width * 2; j++)
|
||||
output[j] <<= 2;
|
||||
output[j] *= 4;
|
||||
|
||||
output += lowpass_width * 2;
|
||||
}
|
||||
|
||||
@@ -322,9 +322,6 @@ static int cinepak_decode (CinepakContext *s)
|
||||
int y0 = 0;
|
||||
int encoded_buf_size;
|
||||
|
||||
if (s->size < 10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
frame_flags = s->data[0];
|
||||
num_strips = AV_RB16 (&s->data[8]);
|
||||
encoded_buf_size = AV_RB24(&s->data[1]);
|
||||
@@ -439,6 +436,9 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
|
||||
s->data = buf;
|
||||
s->size = buf_size;
|
||||
|
||||
if (s->size < 10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -297,6 +297,11 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
c->pic->pict_type = frame_type & 0x20 ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
||||
|
||||
if (frame_type & 0x2) {
|
||||
if (buf_size < c->mb_width * c->mb_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
bytestream2_get_be32(&gb); // frame size;
|
||||
c->ac_quant = bytestream2_get_byte(&gb);
|
||||
c->luma_dc_quant = 32;
|
||||
|
||||
+1
-1
@@ -687,7 +687,7 @@ static int dds_decode(AVCodecContext *avctx, void *data,
|
||||
(frame->data[1][2+i*4]<<0)+
|
||||
(frame->data[1][1+i*4]<<8)+
|
||||
(frame->data[1][0+i*4]<<16)+
|
||||
(frame->data[1][3+i*4]<<24)
|
||||
((unsigned)frame->data[1][3+i*4]<<24)
|
||||
);
|
||||
}
|
||||
frame->palette_has_changed = 1;
|
||||
|
||||
+1
-1
@@ -250,7 +250,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height
|
||||
segments = bytestream2_get_le16u(gb);
|
||||
while ((segments & 0xC000) == 0xC000) {
|
||||
unsigned skip_lines = -(int16_t)segments;
|
||||
unsigned delta = -((int16_t)segments * width);
|
||||
int64_t delta = -((int16_t)segments * (int64_t)width);
|
||||
if (frame_end - frame <= delta || y + lines + skip_lines > height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame += delta;
|
||||
|
||||
@@ -99,7 +99,7 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
|
||||
(b1 + ((b0 + b2 + 1) >> 1))
|
||||
|
||||
#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
|
||||
(b2 + ((-b0 + 9*b1 + 9*b3 - b4 + 8) >> 4))
|
||||
(b2 + ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 8) >> 4))
|
||||
|
||||
#define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
|
||||
(b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5))
|
||||
|
||||
@@ -216,9 +216,14 @@ static void generate_offset_lut(DiracGolombLUT *lut, int off)
|
||||
INIT_RESIDUE(res);
|
||||
SET_RESIDUE(res, idx, LUT_BITS);
|
||||
|
||||
l->preamble = CONVERT_TO_RESIDUE(res >> (RSIZE_BITS - off), off);
|
||||
l->preamble_bits = off;
|
||||
l->sign = ((l->preamble >> (RSIZE_BITS - l->preamble_bits)) & 1) ? -1 : +1;
|
||||
if (off) {
|
||||
l->preamble = CONVERT_TO_RESIDUE(res >> (RSIZE_BITS - off), off);
|
||||
l->sign = ((l->preamble >> (RSIZE_BITS - l->preamble_bits)) & 1) ? -1 : +1;
|
||||
} else {
|
||||
l->preamble = 0;
|
||||
l->sign = 1;
|
||||
}
|
||||
|
||||
search_for_golomb(l, res << off, LUT_BITS - off);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ enum dirac_subband {
|
||||
/* magic number division by 3 from schroedinger */
|
||||
static inline int divide3(int x)
|
||||
{
|
||||
return ((x+1)*21845 + 10922) >> 16;
|
||||
return (int)((x+1U)*21845 + 10922) >> 16;
|
||||
}
|
||||
|
||||
static DiracFrame *remove_frame(DiracFrame *framelist[], int picnum)
|
||||
@@ -454,7 +454,8 @@ static inline int coeff_unpack_golomb(GetBitContext *gb, int qfactor, int qoffse
|
||||
static inline void coeff_unpack_arith_##n(DiracArith *c, int qfactor, int qoffset, \
|
||||
SubBand *b, type *buf, int x, int y) \
|
||||
{ \
|
||||
int coeff, sign, sign_pred = 0, pred_ctx = CTX_ZPZN_F1; \
|
||||
int sign, sign_pred = 0, pred_ctx = CTX_ZPZN_F1; \
|
||||
unsigned coeff; \
|
||||
const int mstride = -(b->stride >> (1+b->pshift)); \
|
||||
if (b->parent) { \
|
||||
const type *pbuf = (type *)b->parent->ibuf; \
|
||||
@@ -823,7 +824,7 @@ static int decode_hq_slice(DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf)
|
||||
skip_bits_long(gb, 8*s->highquality.prefix_bytes);
|
||||
quant_idx = get_bits(gb, 8);
|
||||
|
||||
if (quant_idx > DIRAC_MAX_QUANT_INDEX) {
|
||||
if (quant_idx > DIRAC_MAX_QUANT_INDEX - 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid quantization index - %i\n", quant_idx);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -81,16 +81,18 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
|
||||
dctx->w = (state >> 32) & 0xFFFF;
|
||||
} else if (dctx->cur_byte == 42) {
|
||||
int cid = (state >> 32) & 0xFFFFFFFF;
|
||||
int remaining;
|
||||
|
||||
if (cid <= 0)
|
||||
continue;
|
||||
|
||||
dctx->remaining = avpriv_dnxhd_get_frame_size(cid);
|
||||
if (dctx->remaining <= 0) {
|
||||
dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
|
||||
if (dctx->remaining <= 0)
|
||||
return dctx->remaining;
|
||||
remaining = avpriv_dnxhd_get_frame_size(cid);
|
||||
if (remaining <= 0) {
|
||||
remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
|
||||
if (remaining <= 0)
|
||||
continue;
|
||||
}
|
||||
dctx->remaining = remaining;
|
||||
if (buf_size - i + 47 >= dctx->remaining) {
|
||||
int remaining = dctx->remaining;
|
||||
|
||||
|
||||
@@ -298,14 +298,18 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
if (ctx->mb_height > 68 && ff_dnxhd_check_header_prefix_hr(header_prefix)) {
|
||||
ctx->data_offset = 0x170 + (ctx->mb_height << 2);
|
||||
} else {
|
||||
if (ctx->mb_height > 68 ||
|
||||
(ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
|
||||
if (ctx->mb_height > 68) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"mb height too big: %d\n", ctx->mb_height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ctx->data_offset = 0x280;
|
||||
}
|
||||
if ((ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"mb height too big: %d\n", ctx->mb_height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (buf_size < ctx->data_offset) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
|
||||
@@ -335,6 +335,9 @@ static int dxv_decompress_raw(AVCodecContext *avctx)
|
||||
DXVContext *ctx = avctx->priv_data;
|
||||
GetByteContext *gbc = &ctx->gbc;
|
||||
|
||||
if (bytestream2_get_bytes_left(gbc) < ctx->tex_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
bytestream2_get_buffer(gbc, ctx->tex_data, ctx->tex_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ JNIEnv *ff_jni_get_env(void *log_ctx)
|
||||
av_log(log_ctx, AV_LOG_ERROR, "The specified JNI version is not supported\n");
|
||||
break;
|
||||
default:
|
||||
av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment attached to this thread");
|
||||
av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment attached to this thread\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w,
|
||||
}
|
||||
|
||||
if (sign)
|
||||
diff = -diff;
|
||||
diff = -(unsigned)diff;
|
||||
|
||||
sample[1][x] = av_mod_uintp2(RENAME(predict)(sample[1] + x, sample[0] + x) + diff, bits);
|
||||
}
|
||||
|
||||
+16
-16
@@ -89,22 +89,22 @@ static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd
|
||||
const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step];
|
||||
const int t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step];
|
||||
const int t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step];
|
||||
const int t4 = 5793 * (t2 + t0 + 0x800 >> 12);
|
||||
const int t5 = 5793 * (t3 + t1 + 0x800 >> 12);
|
||||
const int t6 = t2 - t0;
|
||||
const int t7 = t3 - t1;
|
||||
const int t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step];
|
||||
const int t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step];
|
||||
const int tA = (blk[0 * step] - blk[4 * step]) * 32768 + rnd;
|
||||
const int tB = (blk[0 * step] + blk[4 * step]) * 32768 + rnd;
|
||||
blk[0 * step] = ( t4 + t9 + tB) >> shift;
|
||||
blk[1 * step] = ( t6 + t7 + t8 + tA) >> shift;
|
||||
blk[2 * step] = ( t6 - t7 - t8 + tA) >> shift;
|
||||
blk[3 * step] = ( t5 - t9 + tB) >> shift;
|
||||
blk[4 * step] = ( -t5 - t9 + tB) >> shift;
|
||||
blk[5 * step] = (-(t6 - t7) - t8 + tA) >> shift;
|
||||
blk[6 * step] = (-(t6 + t7) + t8 + tA) >> shift;
|
||||
blk[7 * step] = ( -t4 + t9 + tB) >> shift;
|
||||
const unsigned t4 = 5793U * (t2 + t0 + 0x800 >> 12);
|
||||
const unsigned t5 = 5793U * (t3 + t1 + 0x800 >> 12);
|
||||
const unsigned t6 = t2 - t0;
|
||||
const unsigned t7 = t3 - t1;
|
||||
const unsigned t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step];
|
||||
const unsigned t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step];
|
||||
const unsigned tA = (blk[0 * step] - blk[4 * step]) * 32768 + rnd;
|
||||
const unsigned tB = (blk[0 * step] + blk[4 * step]) * 32768 + rnd;
|
||||
blk[0 * step] = (int)( t4 + t9 + tB) >> shift;
|
||||
blk[1 * step] = (int)( t6 + t7 + t8 + tA) >> shift;
|
||||
blk[2 * step] = (int)( t6 - t7 - t8 + tA) >> shift;
|
||||
blk[3 * step] = (int)( t5 - t9 + tB) >> shift;
|
||||
blk[4 * step] = (int)( -t5 - t9 + tB) >> shift;
|
||||
blk[5 * step] = (int)(-(t6 - t7) - t8 + tA) >> shift;
|
||||
blk[6 * step] = (int)(-(t6 + t7) + t8 + tA) >> shift;
|
||||
blk[7 * step] = (int)( -t4 + t9 + tB) >> shift;
|
||||
}
|
||||
|
||||
static void fic_idct_put(uint8_t *dst, int stride, int16_t *block)
|
||||
|
||||
@@ -199,6 +199,9 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
|
||||
num_chunks = bytestream2_get_le16(&g2);
|
||||
bytestream2_skip(&g2, 8); /* skip padding */
|
||||
|
||||
if (frame_size < 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
frame_size -= 16;
|
||||
|
||||
/* iterate through the chunks */
|
||||
@@ -269,10 +272,14 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
|
||||
while (compressed_lines > 0) {
|
||||
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
|
||||
break;
|
||||
if (y_ptr > pixel_limit)
|
||||
return AVERROR_INVALIDDATA;
|
||||
line_packets = bytestream2_get_le16(&g2);
|
||||
if ((line_packets & 0xC000) == 0xC000) {
|
||||
// line skip opcode
|
||||
line_packets = -line_packets;
|
||||
if (line_packets > s->avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
y_ptr += line_packets * s->frame->linesize[0];
|
||||
} else if ((line_packets & 0xC000) == 0x4000) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets);
|
||||
@@ -321,6 +328,8 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
|
||||
case FLI_LC:
|
||||
/* line compressed */
|
||||
starting_line = bytestream2_get_le16(&g2);
|
||||
if (starting_line >= s->avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
y_ptr = 0;
|
||||
y_ptr += starting_line * s->frame->linesize[0];
|
||||
|
||||
@@ -519,6 +528,8 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
|
||||
if (frame_size > buf_size)
|
||||
frame_size = buf_size;
|
||||
|
||||
if (frame_size < 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame_size -= 16;
|
||||
|
||||
/* iterate through the chunks */
|
||||
@@ -555,9 +566,13 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
|
||||
while (compressed_lines > 0) {
|
||||
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
|
||||
break;
|
||||
if (y_ptr > pixel_limit)
|
||||
return AVERROR_INVALIDDATA;
|
||||
line_packets = bytestream2_get_le16(&g2);
|
||||
if (line_packets < 0) {
|
||||
line_packets = -line_packets;
|
||||
if (line_packets > s->avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
y_ptr += line_packets * s->frame->linesize[0];
|
||||
} else {
|
||||
compressed_lines--;
|
||||
@@ -804,6 +819,8 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
|
||||
if (frame_size > buf_size)
|
||||
frame_size = buf_size;
|
||||
|
||||
if (frame_size < 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame_size -= 16;
|
||||
|
||||
/* iterate through the chunks */
|
||||
@@ -840,9 +857,13 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
|
||||
while (compressed_lines > 0) {
|
||||
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
|
||||
break;
|
||||
if (y_ptr > pixel_limit)
|
||||
return AVERROR_INVALIDDATA;
|
||||
line_packets = bytestream2_get_le16(&g2);
|
||||
if (line_packets < 0) {
|
||||
line_packets = -line_packets;
|
||||
if (line_packets > s->avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
y_ptr += line_packets * s->frame->linesize[0];
|
||||
} else {
|
||||
compressed_lines--;
|
||||
|
||||
+3
-3
@@ -459,7 +459,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
int size, offset, start = 0;
|
||||
|
||||
offset = bytestream2_get_le16(gb);
|
||||
if (offset > s->nb_blocks)
|
||||
if (offset >= s->nb_blocks)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
size = bytestream2_get_le16(gb);
|
||||
@@ -596,8 +596,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->bpp = avctx->bits_per_coded_sample >> 3;
|
||||
s->buffer_size = avctx->width * avctx->height * 4;
|
||||
s->pbuffer_size = avctx->width * avctx->height * 4;
|
||||
s->buffer = av_malloc(s->buffer_size);
|
||||
s->pbuffer = av_malloc(s->pbuffer_size);
|
||||
s->buffer = av_mallocz(s->buffer_size);
|
||||
s->pbuffer = av_mallocz(s->pbuffer_size);
|
||||
if (!s->buffer || !s->pbuffer)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
||||
+41
-22
@@ -2347,21 +2347,40 @@ decode_intra_mb:
|
||||
if (CHROMA444(h) && IS_8x8DCT(mb_type)){
|
||||
int i;
|
||||
uint8_t *nnz_cache = sl->non_zero_count_cache;
|
||||
for (i = 0; i < 2; i++){
|
||||
if (sl->left_type[LEFT(i)] && !IS_8x8DCT(sl->left_type[LEFT(i)])) {
|
||||
nnz_cache[3+8* 1 + 2*8*i]=
|
||||
nnz_cache[3+8* 2 + 2*8*i]=
|
||||
nnz_cache[3+8* 6 + 2*8*i]=
|
||||
nnz_cache[3+8* 7 + 2*8*i]=
|
||||
nnz_cache[3+8*11 + 2*8*i]=
|
||||
nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
|
||||
if (h->sei.unregistered.x264_build < 151U) {
|
||||
for (i = 0; i < 2; i++){
|
||||
if (sl->left_type[LEFT(i)] && !IS_8x8DCT(sl->left_type[LEFT(i)])) {
|
||||
nnz_cache[3+8* 1 + 2*8*i]=
|
||||
nnz_cache[3+8* 2 + 2*8*i]=
|
||||
nnz_cache[3+8* 6 + 2*8*i]=
|
||||
nnz_cache[3+8* 7 + 2*8*i]=
|
||||
nnz_cache[3+8*11 + 2*8*i]=
|
||||
nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
|
||||
}
|
||||
}
|
||||
if (sl->top_type && !IS_8x8DCT(sl->top_type)){
|
||||
uint32_t top_empty = !IS_INTRA(mb_type) ? 0 : 0x40404040;
|
||||
AV_WN32A(&nnz_cache[4+8* 0], top_empty);
|
||||
AV_WN32A(&nnz_cache[4+8* 5], top_empty);
|
||||
AV_WN32A(&nnz_cache[4+8*10], top_empty);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 2; i++){
|
||||
if (sl->left_type[LEFT(i)] && !IS_8x8DCT(sl->left_type[LEFT(i)])) {
|
||||
nnz_cache[3+8* 1 + 2*8*i]=
|
||||
nnz_cache[3+8* 2 + 2*8*i]=
|
||||
nnz_cache[3+8* 6 + 2*8*i]=
|
||||
nnz_cache[3+8* 7 + 2*8*i]=
|
||||
nnz_cache[3+8*11 + 2*8*i]=
|
||||
nnz_cache[3+8*12 + 2*8*i]= !IS_INTRA_PCM(sl->left_type[LEFT(i)]) ? 0 : 64;
|
||||
}
|
||||
}
|
||||
if (sl->top_type && !IS_8x8DCT(sl->top_type)){
|
||||
uint32_t top_empty = !IS_INTRA_PCM(sl->top_type) ? 0 : 0x40404040;
|
||||
AV_WN32A(&nnz_cache[4+8* 0], top_empty);
|
||||
AV_WN32A(&nnz_cache[4+8* 5], top_empty);
|
||||
AV_WN32A(&nnz_cache[4+8*10], top_empty);
|
||||
}
|
||||
}
|
||||
if (sl->top_type && !IS_8x8DCT(sl->top_type)){
|
||||
uint32_t top_empty = !IS_INTRA(mb_type) ? 0 : 0x40404040;
|
||||
AV_WN32A(&nnz_cache[4+8* 0], top_empty);
|
||||
AV_WN32A(&nnz_cache[4+8* 5], top_empty);
|
||||
AV_WN32A(&nnz_cache[4+8*10], top_empty);
|
||||
}
|
||||
}
|
||||
h->cur_pic.mb_type[mb_xy] = mb_type;
|
||||
@@ -2370,14 +2389,6 @@ decode_intra_mb:
|
||||
const uint8_t *scan, *scan8x8;
|
||||
const uint32_t *qmul;
|
||||
|
||||
if(IS_INTERLACED(mb_type)){
|
||||
scan8x8 = sl->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
|
||||
scan = sl->qscale ? h->field_scan : h->field_scan_q0;
|
||||
}else{
|
||||
scan8x8 = sl->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
|
||||
scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
|
||||
}
|
||||
|
||||
// decode_cabac_mb_dqp
|
||||
if(get_cabac_noinline( &sl->cabac, &sl->cabac_state[60 + (sl->last_qscale_diff != 0)])){
|
||||
int val = 1;
|
||||
@@ -2408,6 +2419,14 @@ decode_intra_mb:
|
||||
}else
|
||||
sl->last_qscale_diff=0;
|
||||
|
||||
if(IS_INTERLACED(mb_type)){
|
||||
scan8x8 = sl->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
|
||||
scan = sl->qscale ? h->field_scan : h->field_scan_q0;
|
||||
}else{
|
||||
scan8x8 = sl->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
|
||||
scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
|
||||
}
|
||||
|
||||
decode_cabac_luma_residual(h, sl, scan, scan8x8, pixel_shift, mb_type, cbp, 0);
|
||||
if (CHROMA444(h)) {
|
||||
decode_cabac_luma_residual(h, sl, scan, scan8x8, pixel_shift, mb_type, cbp, 1);
|
||||
|
||||
@@ -1102,14 +1102,6 @@ decode_intra_mb:
|
||||
const uint8_t *scan, *scan8x8;
|
||||
const int max_qp = 51 + 6 * (h->ps.sps->bit_depth_luma - 8);
|
||||
|
||||
if(IS_INTERLACED(mb_type)){
|
||||
scan8x8 = sl->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
|
||||
scan = sl->qscale ? h->field_scan : h->field_scan_q0;
|
||||
}else{
|
||||
scan8x8 = sl->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0;
|
||||
scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
|
||||
}
|
||||
|
||||
dquant= get_se_golomb(&sl->gb);
|
||||
|
||||
sl->qscale += (unsigned)dquant;
|
||||
@@ -1126,6 +1118,14 @@ decode_intra_mb:
|
||||
sl->chroma_qp[0] = get_chroma_qp(h->ps.pps, 0, sl->qscale);
|
||||
sl->chroma_qp[1] = get_chroma_qp(h->ps.pps, 1, sl->qscale);
|
||||
|
||||
if(IS_INTERLACED(mb_type)){
|
||||
scan8x8 = sl->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
|
||||
scan = sl->qscale ? h->field_scan : h->field_scan_q0;
|
||||
}else{
|
||||
scan8x8 = sl->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0;
|
||||
scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
|
||||
}
|
||||
|
||||
if ((ret = decode_luma_residual(h, sl, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -637,7 +637,7 @@ static av_always_inline void hl_decode_mb_predict_luma(const H264Context *h,
|
||||
uint8_t *const ptr = dest_y + block_offset[i];
|
||||
const int dir = sl->intra4x4_pred_mode_cache[scan8[i]];
|
||||
if (transform_bypass && h->ps.sps->profile_idc == 244 && dir <= 1) {
|
||||
if (h->sei.unregistered.x264_build != -1) {
|
||||
if (h->sei.unregistered.x264_build < 151U) {
|
||||
h->hpc.pred8x8l_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
|
||||
} else
|
||||
h->hpc.pred8x8l_filter_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift),
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
|
||||
int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
const int *ref_count, int slice_type_nos,
|
||||
H264PredWeightTable *pwt, void *logctx)
|
||||
H264PredWeightTable *pwt,
|
||||
int picture_structure, void *logctx)
|
||||
{
|
||||
int list, i, j;
|
||||
int luma_def, chroma_def;
|
||||
@@ -98,11 +99,13 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
}
|
||||
|
||||
// for MBAFF
|
||||
pwt->luma_weight[16 + 2 * i][list][0] = pwt->luma_weight[16 + 2 * i + 1][list][0] = pwt->luma_weight[i][list][0];
|
||||
pwt->luma_weight[16 + 2 * i][list][1] = pwt->luma_weight[16 + 2 * i + 1][list][1] = pwt->luma_weight[i][list][1];
|
||||
for (j = 0; j < 2; j++) {
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][0] = pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = pwt->chroma_weight[i][list][j][0];
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][1] = pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = pwt->chroma_weight[i][list][j][1];
|
||||
if (picture_structure == PICT_FRAME) {
|
||||
pwt->luma_weight[16 + 2 * i][list][0] = pwt->luma_weight[16 + 2 * i + 1][list][0] = pwt->luma_weight[i][list][0];
|
||||
pwt->luma_weight[16 + 2 * i][list][1] = pwt->luma_weight[16 + 2 * i + 1][list][1] = pwt->luma_weight[i][list][1];
|
||||
for (j = 0; j < 2; j++) {
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][0] = pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = pwt->chroma_weight[i][list][j][0];
|
||||
pwt->chroma_weight[16 + 2 * i][list][j][1] = pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = pwt->chroma_weight[i][list][j][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (slice_type_nos != AV_PICTURE_TYPE_B)
|
||||
|
||||
@@ -55,7 +55,8 @@ typedef struct H264POCContext {
|
||||
|
||||
int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
const int *ref_count, int slice_type_nos,
|
||||
H264PredWeightTable *pwt, void *logctx);
|
||||
H264PredWeightTable *pwt,
|
||||
int picture_structure, void *logctx);
|
||||
|
||||
/**
|
||||
* Check if the top & left blocks are available if needed & change the
|
||||
|
||||
@@ -202,7 +202,7 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
|
||||
if ((p->ps.pps->weighted_pred && slice_type_nos == AV_PICTURE_TYPE_P) ||
|
||||
(p->ps.pps->weighted_bipred_idc == 1 && slice_type_nos == AV_PICTURE_TYPE_B))
|
||||
ff_h264_pred_weight_table(gb, p->ps.sps, ref_count, slice_type_nos,
|
||||
&pwt, logctx);
|
||||
&pwt, p->picture_structure, logctx);
|
||||
|
||||
if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
|
||||
int i;
|
||||
|
||||
@@ -1782,7 +1782,8 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
|
||||
(pps->weighted_bipred_idc == 1 &&
|
||||
sl->slice_type_nos == AV_PICTURE_TYPE_B)) {
|
||||
ret = ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count,
|
||||
sl->slice_type_nos, &sl->pwt, h->avctx);
|
||||
sl->slice_type_nos, &sl->pwt,
|
||||
picture_structure, h->avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
@@ -1804,7 +1805,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
|
||||
}
|
||||
|
||||
sl->last_qscale_diff = 0;
|
||||
tmp = pps->init_qp + get_se_golomb(&sl->gb);
|
||||
tmp = pps->init_qp + (unsigned)get_se_golomb(&sl->gb);
|
||||
if (tmp > 51 + 6 * (sps->bit_depth_luma - 8)) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -470,7 +470,7 @@ static int get_pcm(HEVCContext *s, int x, int y)
|
||||
|
||||
#define TC_CALC(qp, bs) \
|
||||
tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + \
|
||||
(tc_offset >> 1 << 1), \
|
||||
(tc_offset & -2), \
|
||||
0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
|
||||
|
||||
static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
|
||||
+22
-12
@@ -170,6 +170,12 @@ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
}
|
||||
}
|
||||
|
||||
if (k >= FF_ARRAY_ELEMS(rps->used)) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid num_delta_pocs: %d\n", k);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
rps->num_delta_pocs = k;
|
||||
rps->num_negative_pics = k0;
|
||||
// sort in increasing order (smallest first)
|
||||
@@ -751,7 +757,7 @@ static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingLi
|
||||
ff_hevc_diag_scan8x8_x[i];
|
||||
|
||||
scaling_list_delta_coef = get_se_golomb(gb);
|
||||
next_coef = (next_coef + scaling_list_delta_coef + 256) % 256;
|
||||
next_coef = (next_coef + 256U + scaling_list_delta_coef) % 256;
|
||||
sl->sl[size_id][matrix_id][pos] = next_coef;
|
||||
}
|
||||
}
|
||||
@@ -933,9 +939,9 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1;
|
||||
sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb);
|
||||
sps->temporal_layer[i].max_latency_increase = get_ue_golomb_long(gb) - 1;
|
||||
if (sps->temporal_layer[i].max_dec_pic_buffering > HEVC_MAX_DPB_SIZE) {
|
||||
if (sps->temporal_layer[i].max_dec_pic_buffering > (unsigned)HEVC_MAX_DPB_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "sps_max_dec_pic_buffering_minus1 out of range: %d\n",
|
||||
sps->temporal_layer[i].max_dec_pic_buffering - 1);
|
||||
sps->temporal_layer[i].max_dec_pic_buffering - 1U);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (sps->temporal_layer[i].num_reorder_pics > sps->temporal_layer[i].max_dec_pic_buffering - 1) {
|
||||
@@ -1432,6 +1438,7 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
int i, ret = 0;
|
||||
unsigned int pps_id = 0;
|
||||
ptrdiff_t nal_size;
|
||||
unsigned log2_parallel_merge_level_minus2;
|
||||
|
||||
AVBufferRef *pps_buf;
|
||||
HEVCPPS *pps = av_mallocz(sizeof(*pps));
|
||||
@@ -1602,20 +1609,22 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
pps->deblocking_filter_override_enabled_flag = get_bits1(gb);
|
||||
pps->disable_dbf = get_bits1(gb);
|
||||
if (!pps->disable_dbf) {
|
||||
pps->beta_offset = get_se_golomb(gb) * 2;
|
||||
pps->tc_offset = get_se_golomb(gb) * 2;
|
||||
if (pps->beta_offset/2 < -6 || pps->beta_offset/2 > 6) {
|
||||
int beta_offset_div2 = get_se_golomb(gb);
|
||||
int tc_offset_div2 = get_se_golomb(gb) ;
|
||||
if (beta_offset_div2 < -6 || beta_offset_div2 > 6) {
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_beta_offset_div2 out of range: %d\n",
|
||||
pps->beta_offset/2);
|
||||
beta_offset_div2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
if (pps->tc_offset/2 < -6 || pps->tc_offset/2 > 6) {
|
||||
if (tc_offset_div2 < -6 || tc_offset_div2 > 6) {
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_tc_offset_div2 out of range: %d\n",
|
||||
pps->tc_offset/2);
|
||||
tc_offset_div2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
pps->beta_offset = 2 * beta_offset_div2;
|
||||
pps->tc_offset = 2 * tc_offset_div2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1627,13 +1636,14 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
goto err;
|
||||
}
|
||||
pps->lists_modification_present_flag = get_bits1(gb);
|
||||
pps->log2_parallel_merge_level = get_ue_golomb_long(gb) + 2;
|
||||
if (pps->log2_parallel_merge_level > sps->log2_ctb_size) {
|
||||
log2_parallel_merge_level_minus2 = get_ue_golomb_long(gb);
|
||||
if (log2_parallel_merge_level_minus2 > sps->log2_ctb_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "log2_parallel_merge_level_minus2 out of range: %d\n",
|
||||
pps->log2_parallel_merge_level - 2);
|
||||
log2_parallel_merge_level_minus2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
pps->log2_parallel_merge_level = log2_parallel_merge_level_minus2 + 2;
|
||||
|
||||
pps->slice_header_extension_present_flag = get_bits1(gb);
|
||||
|
||||
|
||||
@@ -439,7 +439,7 @@ static int add_candidate_ref(HEVCContext *s, RefPicList *list,
|
||||
{
|
||||
HEVCFrame *ref = find_ref_idx(s, poc);
|
||||
|
||||
if (ref == s->ref)
|
||||
if (ref == s->ref || list->nb_refs >= HEVC_MAX_REFS)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!ref) {
|
||||
|
||||
+29
-8
@@ -138,7 +138,7 @@ fail:
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
static int pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
@@ -181,6 +181,12 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
for (j = 0; j < 2; j++) {
|
||||
int delta_chroma_weight_l0 = get_se_golomb(gb);
|
||||
int delta_chroma_offset_l0 = get_se_golomb(gb);
|
||||
|
||||
if ( (int8_t)delta_chroma_weight_l0 != delta_chroma_weight_l0
|
||||
|| delta_chroma_offset_l0 < -(1<<17) || delta_chroma_offset_l0 > (1<<17)) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->sh.chroma_weight_l0[i][j] = (1 << s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l0;
|
||||
s->sh.chroma_offset_l0[i][j] = av_clip((delta_chroma_offset_l0 - ((128 * s->sh.chroma_weight_l0[i][j])
|
||||
>> s->sh.chroma_log2_weight_denom) + 128), -128, 127);
|
||||
@@ -217,6 +223,12 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
for (j = 0; j < 2; j++) {
|
||||
int delta_chroma_weight_l1 = get_se_golomb(gb);
|
||||
int delta_chroma_offset_l1 = get_se_golomb(gb);
|
||||
|
||||
if ( (int8_t)delta_chroma_weight_l1 != delta_chroma_weight_l1
|
||||
|| delta_chroma_offset_l1 < -(1<<17) || delta_chroma_offset_l1 > (1<<17)) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->sh.chroma_weight_l1[i][j] = (1 << s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l1;
|
||||
s->sh.chroma_offset_l1[i][j] = av_clip((delta_chroma_offset_l1 - ((128 * s->sh.chroma_weight_l1[i][j])
|
||||
>> s->sh.chroma_log2_weight_denom) + 128), -128, 127);
|
||||
@@ -229,6 +241,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
|
||||
@@ -247,6 +260,8 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
|
||||
nb_sps = get_ue_golomb_long(gb);
|
||||
nb_sh = get_ue_golomb_long(gb);
|
||||
|
||||
if (nb_sps > sps->num_long_term_ref_pics_sps)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (nb_sh + (uint64_t)nb_sps > FF_ARRAY_ELEMS(rps->poc))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -270,12 +285,16 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
|
||||
|
||||
delta_poc_msb_present = get_bits1(gb);
|
||||
if (delta_poc_msb_present) {
|
||||
int delta = get_ue_golomb_long(gb);
|
||||
int64_t delta = get_ue_golomb_long(gb);
|
||||
int64_t poc;
|
||||
|
||||
if (i && i != nb_sps)
|
||||
delta += prev_delta_msb;
|
||||
|
||||
rps->poc[i] += s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb;
|
||||
poc = rps->poc[i] + s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb;
|
||||
if (poc != (int32_t)poc)
|
||||
return AVERROR_INVALIDDATA;
|
||||
rps->poc[i] = poc;
|
||||
prev_delta_msb = delta;
|
||||
}
|
||||
}
|
||||
@@ -676,7 +695,9 @@ static int hls_slice_header(HEVCContext *s)
|
||||
|
||||
if ((s->ps.pps->weighted_pred_flag && sh->slice_type == HEVC_SLICE_P) ||
|
||||
(s->ps.pps->weighted_bipred_flag && sh->slice_type == HEVC_SLICE_B)) {
|
||||
pred_weight_table(s, gb);
|
||||
int ret = pred_weight_table(s, gb);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
sh->max_num_merge_cand = 5 - get_ue_golomb_long(gb);
|
||||
@@ -2974,7 +2995,7 @@ static int verify_md5(HEVCContext *s, AVFrame *frame)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length)
|
||||
static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length, int first)
|
||||
{
|
||||
AVCodecContext *avctx = s->avctx;
|
||||
GetByteContext gb;
|
||||
@@ -3036,7 +3057,7 @@ static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length)
|
||||
|
||||
/* export stream parameters from the first SPS */
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) {
|
||||
if (s->ps.sps_list[i]) {
|
||||
if (first && s->ps.sps_list[i]) {
|
||||
const HEVCSPS *sps = (const HEVCSPS*)s->ps.sps_list[i]->data;
|
||||
export_stream_params(s->avctx, &s->ps, sps);
|
||||
break;
|
||||
@@ -3066,7 +3087,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
|
||||
new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
|
||||
&new_extradata_size);
|
||||
if (new_extradata && new_extradata_size > 0) {
|
||||
ret = hevc_decode_extradata(s, new_extradata, new_extradata_size);
|
||||
ret = hevc_decode_extradata(s, new_extradata, new_extradata_size, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
@@ -3349,7 +3370,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
|
||||
s->threads_number = 1;
|
||||
|
||||
if (avctx->extradata_size > 0 && avctx->extradata) {
|
||||
ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size);
|
||||
ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size, 1);
|
||||
if (ret < 0) {
|
||||
hevc_decode_free(avctx);
|
||||
return ret;
|
||||
|
||||
@@ -35,7 +35,7 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
|
||||
#define MVF(x, y) \
|
||||
(s->ref->tab_mvf[(x) + (y) * min_pu_width])
|
||||
#define MVF_PU(x, y) \
|
||||
MVF(PU(x0 + ((x) << hshift)), PU(y0 + ((y) << vshift)))
|
||||
MVF(PU(x0 + ((x) * (1 << hshift))), PU(y0 + ((y) * (1 << vshift))))
|
||||
#define IS_INTRA(x, y) \
|
||||
(MVF_PU(x, y).pred_flag == PF_INTRA)
|
||||
#define MIN_TB_ADDR_ZS(x, y) \
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64],
|
||||
pos += ff_hq_ac_skips[val];
|
||||
if (pos >= 64)
|
||||
break;
|
||||
block[ff_zigzag_direct[pos]] = (ff_hq_ac_syms[val] * q[pos]) >> 12;
|
||||
block[ff_zigzag_direct[pos]] = (int)(ff_hq_ac_syms[val] * (unsigned)q[pos]) >> 12;
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
|
||||
char *param, buffer[128], tmp[128];
|
||||
int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0;
|
||||
SrtStack stack[16];
|
||||
int closing_brace_missing = 0;
|
||||
|
||||
stack[0].tag[0] = 0;
|
||||
strcpy(stack[0].param[PARAM_SIZE], "{\\fs}");
|
||||
@@ -83,11 +84,20 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
|
||||
and all microdvd like styles such as {Y:xxx} */
|
||||
len = 0;
|
||||
an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0;
|
||||
if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len) >= 0 && len > 0)) ||
|
||||
(len = 0, sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n", &len) >= 0 && len > 0)) {
|
||||
in += len - 1;
|
||||
} else
|
||||
av_bprint_chars(dst, *in, 1);
|
||||
|
||||
if (!closing_brace_missing) {
|
||||
if ( (an != 1 && in[1] == '\\')
|
||||
|| (in[1] && strchr("CcFfoPSsYy", in[1]) && in[2] == ':')) {
|
||||
char *bracep = strchr(in+2, '}');
|
||||
if (bracep) {
|
||||
in = bracep;
|
||||
break;
|
||||
} else
|
||||
closing_brace_missing = 1;
|
||||
}
|
||||
}
|
||||
|
||||
av_bprint_chars(dst, *in, 1);
|
||||
break;
|
||||
case '<':
|
||||
tag_close = in[1] == '/';
|
||||
|
||||
@@ -237,6 +237,8 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
/* skip picture header extension if any */
|
||||
while (get_bits1(&ctx->gb)) {
|
||||
ff_dlog(avctx, "Pic hdr extension encountered!\n");
|
||||
if (get_bits_left(&ctx->gb) < 10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
skip_bits(&ctx->gb, 8);
|
||||
}
|
||||
|
||||
|
||||
+17
-17
@@ -116,10 +116,10 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
|
||||
b0_2 = b0_ptr[pitch+indx+1];
|
||||
tmp1 = tmp0 + b0_1;
|
||||
|
||||
p0 = tmp0 << 4;
|
||||
p1 = tmp1 << 3;
|
||||
p2 = (tmp0 + tmp2) << 3;
|
||||
p3 = (tmp1 + tmp2 + b0_2) << 2;
|
||||
p0 = tmp0 * 16;
|
||||
p1 = tmp1 * 8;
|
||||
p2 = (tmp0 + tmp2) * 8;
|
||||
p3 = (tmp1 + tmp2 + b0_2) * 4;
|
||||
}
|
||||
|
||||
/* process the HL-band by applying HPF vertically and LPF horizontally */
|
||||
@@ -132,10 +132,10 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
|
||||
tmp2 = tmp1 - tmp0*6 + b1_3;
|
||||
b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch+indx+1];
|
||||
|
||||
p0 += (tmp0 + tmp1) << 3;
|
||||
p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
|
||||
p2 += tmp2 << 2;
|
||||
p3 += (tmp2 + b1_3) << 1;
|
||||
p0 += (tmp0 + tmp1) * 8;
|
||||
p1 += (tmp0 + tmp1 + b1_1 + b1_2) * 4;
|
||||
p2 += tmp2 * 4;
|
||||
p3 += (tmp2 + b1_3) * 2;
|
||||
}
|
||||
|
||||
/* process the LH-band by applying LPF vertically and HPF horizontally */
|
||||
@@ -146,10 +146,10 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
|
||||
tmp0 = b2_1 + b2_2;
|
||||
tmp1 = b2_1 - b2_2*6 + b2_3;
|
||||
|
||||
p0 += tmp0 << 3;
|
||||
p1 += tmp1 << 2;
|
||||
p2 += (tmp0 + b2_4 + b2_5) << 2;
|
||||
p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) << 1;
|
||||
p0 += tmp0 * 8;
|
||||
p1 += tmp1 * 4;
|
||||
p2 += (tmp0 + b2_4 + b2_5) * 4;
|
||||
p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) * 2;
|
||||
}
|
||||
|
||||
/* process the HH-band by applying HPF both vertically and horizontally */
|
||||
@@ -163,9 +163,9 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
|
||||
|
||||
b3_9 = b3_3 - b3_6*6 + b3_ptr[pitch+indx+1];
|
||||
|
||||
p0 += (tmp0 + tmp1) << 2;
|
||||
p1 += (tmp0 - tmp1*6 + tmp2) << 1;
|
||||
p2 += (b3_7 + b3_8) << 1;
|
||||
p0 += (tmp0 + tmp1) * 4;
|
||||
p1 += (tmp0 - tmp1*6 + tmp2) * 2;
|
||||
p2 += (b3_7 + b3_8) * 2;
|
||||
p3 += b3_7 - b3_8*6 + b3_9;
|
||||
}
|
||||
|
||||
@@ -393,8 +393,8 @@ void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
|
||||
if (flags[i]) {
|
||||
/* pre-scaling */
|
||||
shift = !(i & 2);
|
||||
sp1 = src[0] << shift;
|
||||
sp2 = src[4] << shift;
|
||||
sp1 = src[0] * (1 << shift);
|
||||
sp2 = src[4] * (1 << shift);
|
||||
INV_HAAR4( sp1, sp2, src[8], src[12],
|
||||
dst[0], dst[4], dst[8], dst[12],
|
||||
t0, t1, t2, t3, t4);
|
||||
|
||||
@@ -215,12 +215,12 @@ typedef struct Jpeg2000Component {
|
||||
/* misc tools */
|
||||
static inline int ff_jpeg2000_ceildivpow2(int a, int b)
|
||||
{
|
||||
return -(((int64_t)(-a)) >> b);
|
||||
return -((-(int64_t)a) >> b);
|
||||
}
|
||||
|
||||
static inline int ff_jpeg2000_ceildiv(int a, int b)
|
||||
{
|
||||
return (a + b - 1) / b;
|
||||
return (a + (int64_t)b - 1) / b;
|
||||
}
|
||||
|
||||
/* TIER-1 routines */
|
||||
|
||||
@@ -260,6 +260,7 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
uint32_t log2_chroma_wh = 0;
|
||||
const enum AVPixelFormat *possible_fmts = NULL;
|
||||
int possible_fmts_nb = 0;
|
||||
int ret;
|
||||
|
||||
if (bytestream2_get_bytes_left(&s->g) < 36) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Insufficient space for SIZ\n");
|
||||
@@ -298,6 +299,16 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (s->tile_offset_x < 0 || s->tile_offset_y < 0 ||
|
||||
s->image_offset_x < s->tile_offset_x ||
|
||||
s->image_offset_y < s->tile_offset_y ||
|
||||
s->tile_width + (int64_t)s->tile_offset_x <= s->image_offset_x ||
|
||||
s->tile_height + (int64_t)s->tile_offset_y <= s->image_offset_y
|
||||
) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Tile offsets are invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->ncomponents = ncomponents;
|
||||
|
||||
if (s->tile_width <= 0 || s->tile_height <= 0) {
|
||||
@@ -349,10 +360,13 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
}
|
||||
|
||||
/* compute image size with reduction factor */
|
||||
s->avctx->width = ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x,
|
||||
s->reduction_factor);
|
||||
s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
|
||||
s->reduction_factor);
|
||||
ret = ff_set_dimensions(s->avctx,
|
||||
ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x,
|
||||
s->reduction_factor),
|
||||
ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
|
||||
s->reduction_factor));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_2K ||
|
||||
s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_4K) {
|
||||
@@ -946,9 +960,9 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
if (!cblk->npasses) {
|
||||
int v = expn[bandno] + numgbits - 1 -
|
||||
tag_tree_decode(s, prec->zerobits + cblkno, 100);
|
||||
if (v < 0) {
|
||||
if (v < 0 || v > 30) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"nonzerobits %d invalid\n", v);
|
||||
"nonzerobits %d invalid or unsupported\n", v);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
cblk->nonzerobits = v;
|
||||
|
||||
@@ -64,10 +64,10 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < csize; i++) {
|
||||
i0 = *src0 + (((i_ict_params[0] * *src2) + (1 << 15)) >> 16);
|
||||
i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16);
|
||||
i1 = *src0 - (((i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
||||
- (((i_ict_params[2] * *src2) + (1 << 15)) >> 16);
|
||||
i2 = *src0 + (((i_ict_params[3] * *src1) + (1 << 15)) >> 16);
|
||||
i2 = *src0 + (2 * *src1) + (((-14942 * *src1) + (1 << 15)) >> 16);
|
||||
*src0++ = i0;
|
||||
*src1++ = i1;
|
||||
*src2++ = i2;
|
||||
|
||||
@@ -488,7 +488,7 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
|
||||
line += 5;
|
||||
|
||||
for (i = 0; i < w * h; i++)
|
||||
data[i] <<= I_PRESHIFT;
|
||||
data[i] *= 1LL << I_PRESHIFT;
|
||||
|
||||
for (lev = 0; lev < s->ndeclevels; lev++) {
|
||||
int lh = s->linelen[lev][0],
|
||||
|
||||
@@ -390,6 +390,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
|
||||
ilv, point_transform, s->bits, s->cur_scan);
|
||||
}
|
||||
if (get_bits_left(&s->gb) < s->height) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
if (ilv == 0) { /* separate planes */
|
||||
if (s->cur_scan > s->nb_components) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -325,7 +325,7 @@ static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size, 0);
|
||||
err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size / sizeof(INT_PCM), 0);
|
||||
if (err == AAC_DEC_NOT_ENOUGH_BITS) {
|
||||
ret = avpkt->size - valid;
|
||||
goto end;
|
||||
|
||||
@@ -244,6 +244,13 @@ static int vpx_decode(AVCodecContext *avctx,
|
||||
(img_alpha = vpx_codec_get_frame(&ctx->decoder_alpha, &iter_alpha)))) {
|
||||
uint8_t *planes[4];
|
||||
int linesizes[4];
|
||||
|
||||
if (img->d_w > img->w || img->d_h > img->h) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n",
|
||||
img->d_w, img->d_h, img->w, img->h);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
if ((ret = set_pix_fmt(avctx, img, ctx->has_alpha_channel)) < 0) {
|
||||
#ifdef VPX_IMG_FMT_HIGHBITDEPTH
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
|
||||
|
||||
+5
-2
@@ -117,11 +117,14 @@ void ff_lpc_end(LPCContext *s);
|
||||
|
||||
#if USE_FIXED
|
||||
typedef int LPC_TYPE;
|
||||
typedef unsigned LPC_TYPE_U;
|
||||
#else
|
||||
#ifdef LPC_USE_DOUBLE
|
||||
typedef double LPC_TYPE;
|
||||
typedef double LPC_TYPE_U;
|
||||
#else
|
||||
typedef float LPC_TYPE;
|
||||
typedef float LPC_TYPE_U;
|
||||
#endif
|
||||
#endif // USE_FIXED
|
||||
|
||||
@@ -192,8 +195,8 @@ static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_o
|
||||
for(j=0; j < (i+1)>>1; j++) {
|
||||
LPC_TYPE f = lpc_last[ j];
|
||||
LPC_TYPE b = lpc_last[i-1-j];
|
||||
lpc[ j] = f + AAC_MUL26(r, b);
|
||||
lpc[i-1-j] = b + AAC_MUL26(r, f);
|
||||
lpc[ j] = f + (LPC_TYPE_U)AAC_MUL26(r, b);
|
||||
lpc[i-1-j] = b + (LPC_TYPE_U)AAC_MUL26(r, f);
|
||||
}
|
||||
|
||||
if (fail && err < 0)
|
||||
|
||||
@@ -97,7 +97,7 @@ static int huff_build10(VLC *vlc, uint8_t *len)
|
||||
for (i = 0; i < 1024; i++) {
|
||||
he[i].sym = 1023 - i;
|
||||
he[i].len = len[i];
|
||||
if (len[i] == 0)
|
||||
if (len[i] == 0 || len[i] > 32)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
AV_QSORT(he, 1024, HuffEntry, huff_cmp_len10);
|
||||
@@ -129,7 +129,7 @@ static int huff_build(VLC *vlc, uint8_t *len)
|
||||
for (i = 0; i < 256; i++) {
|
||||
he[i].sym = 255 - i;
|
||||
he[i].len = len[i];
|
||||
if (len[i] == 0)
|
||||
if (len[i] == 0 || len[i] > 32)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
AV_QSORT(he, 256, HuffEntry, huff_cmp_len);
|
||||
|
||||
@@ -66,7 +66,7 @@ struct JNIAMediaCodecListFields {
|
||||
jfieldID hevc_profile_main10_id;
|
||||
jfieldID hevc_profile_main10_hdr10_id;
|
||||
|
||||
} JNIAMediaCodecListFields;
|
||||
};
|
||||
|
||||
static const struct FFJniField jni_amediacodeclist_mapping[] = {
|
||||
{ "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecListFields, mediacodec_list_class), 1 },
|
||||
@@ -125,7 +125,7 @@ struct JNIAMediaFormatFields {
|
||||
|
||||
jmethodID to_string_id;
|
||||
|
||||
} JNIAMediaFormatFields;
|
||||
};
|
||||
|
||||
static const struct FFJniField jni_amediaformat_mapping[] = {
|
||||
{ "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaFormatFields, mediaformat_class), 1 },
|
||||
@@ -210,7 +210,7 @@ struct JNIAMediaCodecFields {
|
||||
jfieldID presentation_time_us_id;
|
||||
jfieldID size_id;
|
||||
|
||||
} JNIAMediaCodecFields;
|
||||
};
|
||||
|
||||
static const struct FFJniField jni_amediacodec_mapping[] = {
|
||||
{ "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecFields, mediacodec_class), 1 },
|
||||
@@ -608,6 +608,7 @@ FFAMediaFormat *ff_AMediaFormat_new(void)
|
||||
{
|
||||
JNIEnv *env = NULL;
|
||||
FFAMediaFormat *format = NULL;
|
||||
jobject object = NULL;
|
||||
|
||||
format = av_mallocz(sizeof(FFAMediaFormat));
|
||||
if (!format) {
|
||||
@@ -625,23 +626,27 @@ FFAMediaFormat *ff_AMediaFormat_new(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
format->object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id);
|
||||
object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id);
|
||||
if (!object) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
format->object = (*env)->NewGlobalRef(env, object);
|
||||
if (!format->object) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
format->object = (*env)->NewGlobalRef(env, format->object);
|
||||
fail:
|
||||
if (object) {
|
||||
(*env)->DeleteLocalRef(env, object);
|
||||
}
|
||||
|
||||
if (!format->object) {
|
||||
goto fail;
|
||||
ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format);
|
||||
av_freep(&format);
|
||||
}
|
||||
|
||||
return format;
|
||||
fail:
|
||||
ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format);
|
||||
|
||||
av_freep(&format);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static FFAMediaFormat *ff_AMediaFormat_newFromObject(void *object)
|
||||
@@ -1562,6 +1567,7 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
jobject buffer = NULL;
|
||||
jobject input_buffers = NULL;
|
||||
|
||||
JNI_GET_ENV_OR_RETURN(env, codec, NULL);
|
||||
|
||||
@@ -1572,12 +1578,12 @@ uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t
|
||||
}
|
||||
} else {
|
||||
if (!codec->input_buffers) {
|
||||
codec->input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id);
|
||||
input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id);
|
||||
if (ff_jni_exception_check(env, 1, codec) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->input_buffers = (*env)->NewGlobalRef(env, codec->input_buffers);
|
||||
codec->input_buffers = (*env)->NewGlobalRef(env, input_buffers);
|
||||
if (ff_jni_exception_check(env, 1, codec) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
@@ -1596,6 +1602,10 @@ fail:
|
||||
(*env)->DeleteLocalRef(env, buffer);
|
||||
}
|
||||
|
||||
if (input_buffers) {
|
||||
(*env)->DeleteLocalRef(env, input_buffers);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1605,6 +1615,7 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
jobject buffer = NULL;
|
||||
jobject output_buffers = NULL;
|
||||
|
||||
JNI_GET_ENV_OR_RETURN(env, codec, NULL);
|
||||
|
||||
@@ -1615,12 +1626,12 @@ uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t
|
||||
}
|
||||
} else {
|
||||
if (!codec->output_buffers) {
|
||||
codec->output_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffers_id);
|
||||
output_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffers_id);
|
||||
if (ff_jni_exception_check(env, 1, codec) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->output_buffers = (*env)->NewGlobalRef(env, codec->output_buffers);
|
||||
codec->output_buffers = (*env)->NewGlobalRef(env, output_buffers);
|
||||
if (ff_jni_exception_check(env, 1, codec) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
@@ -1639,6 +1650,10 @@ fail:
|
||||
(*env)->DeleteLocalRef(env, buffer);
|
||||
}
|
||||
|
||||
if (output_buffers) {
|
||||
(*env)->DeleteLocalRef(env, output_buffers);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -390,9 +390,11 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
res = ff_set_dimensions(avctx, width, height);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
ctx->avctx = avctx;
|
||||
avctx->width = width;
|
||||
avctx->height = height;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
for (i = 0; i < 3; i++) {
|
||||
ctx->num_vblocks[i] = AV_CEIL_RSHIFT(height, 3 + !!i);
|
||||
|
||||
+11
-2
@@ -697,7 +697,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
val = val * quant_matrix[0] + s->last_dc[component];
|
||||
val = FFMIN(val, 32767);
|
||||
val = av_clip_int16(val);
|
||||
s->last_dc[component] = val;
|
||||
block[0] = val;
|
||||
/* AC coefs */
|
||||
@@ -738,7 +738,7 @@ static int decode_dc_progressive(MJpegDecodeContext *s, int16_t *block,
|
||||
int component, int dc_index,
|
||||
uint16_t *quant_matrix, int Al)
|
||||
{
|
||||
int val;
|
||||
unsigned val;
|
||||
s->bdsp.clear_block(block);
|
||||
val = mjpeg_decode_dc(s, dc_index);
|
||||
if (val == 0xfffff) {
|
||||
@@ -1479,6 +1479,15 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (reference) {
|
||||
if (reference->width != s->picture_ptr->width ||
|
||||
reference->height != s->picture_ptr->height ||
|
||||
reference->format != s->picture_ptr->format) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Reference mismatching\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
av_assert0(s->picture_ptr->data[0]);
|
||||
/* XXX: verify len field validity */
|
||||
len = get_bits(&s->gb, 16);
|
||||
|
||||
+10
-5
@@ -701,7 +701,7 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
/* TODO: Check validity of state data. */
|
||||
|
||||
for (i = 0; i < order; i++)
|
||||
fp->state[i] = state_bits ? get_sbits(gbp, state_bits) << state_shift : 0;
|
||||
fp->state[i] = state_bits ? get_sbits(gbp, state_bits) * (1 << state_shift) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -729,7 +729,7 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
|
||||
av_log(m->avctx, AV_LOG_ERROR,
|
||||
"Number of primitive matrices cannot be greater than %d.\n",
|
||||
max_primitive_matrices);
|
||||
return AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (mat = 0; mat < s->num_primitive_matrices; mat++) {
|
||||
@@ -742,12 +742,12 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
|
||||
av_log(m->avctx, AV_LOG_ERROR,
|
||||
"Invalid channel %d specified as output from matrix.\n",
|
||||
s->matrix_out_ch[mat]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
if (frac_bits > 14) {
|
||||
av_log(m->avctx, AV_LOG_ERROR,
|
||||
"Too many fractional bits specified.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
|
||||
max_chan = s->max_matrix_channel;
|
||||
@@ -759,7 +759,7 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
|
||||
if (get_bits1(gbp))
|
||||
coeff_val = get_sbits(gbp, frac_bits + 2);
|
||||
|
||||
s->matrix_coeff[mat][ch] = coeff_val << (14 - frac_bits);
|
||||
s->matrix_coeff[mat][ch] = coeff_val * (1 << (14 - frac_bits));
|
||||
}
|
||||
|
||||
if (s->noise_type)
|
||||
@@ -769,6 +769,11 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
|
||||
}
|
||||
|
||||
return 0;
|
||||
error:
|
||||
s->num_primitive_matrices = 0;
|
||||
memset(s->matrix_out_ch, 0, sizeof(s->matrix_out_ch));
|
||||
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/** Read channel parameters. */
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ int32_t ff_mlp_pack_output(int32_t lossless_check_data,
|
||||
for (out_ch = 0; out_ch <= max_matrix_channel; out_ch++) {
|
||||
int mat_ch = ch_assign[out_ch];
|
||||
int32_t sample = sample_buffer[i][mat_ch] *
|
||||
(1 << output_shift[mat_ch]);
|
||||
(1U << output_shift[mat_ch]);
|
||||
lossless_check_data ^= (sample & 0xffffff) << mat_ch;
|
||||
if (is32)
|
||||
*data_32++ = sample << 8;
|
||||
|
||||
+47
-39
@@ -171,7 +171,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int a = 2 << s->sprite_warping_accuracy;
|
||||
int rho = 3 - s->sprite_warping_accuracy;
|
||||
int r = 16 / a;
|
||||
int alpha = 0;
|
||||
int alpha = 1;
|
||||
int beta = 0;
|
||||
int w = s->width;
|
||||
int h = s->height;
|
||||
@@ -243,18 +243,18 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
* from w&h based to w2&h2 based which are of the 2^x form. */
|
||||
virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2) +
|
||||
ROUNDED_DIV(((w - w2) *
|
||||
(r * sprite_ref[0][0] - 16 * vop_ref[0][0]) +
|
||||
w2 * (r * sprite_ref[1][0] - 16 * vop_ref[1][0])), w);
|
||||
(r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) +
|
||||
w2 * (r * sprite_ref[1][0] - 16LL * vop_ref[1][0])), w);
|
||||
virtual_ref[0][1] = 16 * vop_ref[0][1] +
|
||||
ROUNDED_DIV(((w - w2) *
|
||||
(r * sprite_ref[0][1] - 16 * vop_ref[0][1]) +
|
||||
w2 * (r * sprite_ref[1][1] - 16 * vop_ref[1][1])), w);
|
||||
(r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) +
|
||||
w2 * (r * sprite_ref[1][1] - 16LL * vop_ref[1][1])), w);
|
||||
virtual_ref[1][0] = 16 * vop_ref[0][0] +
|
||||
ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16 * vop_ref[0][0]) +
|
||||
h2 * (r * sprite_ref[2][0] - 16 * vop_ref[2][0])), h);
|
||||
ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) +
|
||||
h2 * (r * sprite_ref[2][0] - 16LL * vop_ref[2][0])), h);
|
||||
virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2) +
|
||||
ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16 * vop_ref[0][1]) +
|
||||
h2 * (r * sprite_ref[2][1] - 16 * vop_ref[2][1])), h);
|
||||
ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) +
|
||||
h2 * (r * sprite_ref[2][1] - 16LL * vop_ref[2][1])), h);
|
||||
|
||||
switch (ctx->num_sprite_warping_points) {
|
||||
case 0:
|
||||
@@ -284,26 +284,26 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
ctx->sprite_shift[1] = 0;
|
||||
break;
|
||||
case 2:
|
||||
sprite_offset[0][0] = (sprite_ref[0][0] * (1 << alpha + rho)) +
|
||||
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
(-vop_ref[0][0]) +
|
||||
(r * sprite_ref[0][1] - virtual_ref[0][1]) *
|
||||
(-vop_ref[0][1]) + (1 << (alpha + rho - 1));
|
||||
sprite_offset[0][1] = (sprite_ref[0][1] * (1 << alpha + rho)) +
|
||||
(-r * sprite_ref[0][1] + virtual_ref[0][1]) *
|
||||
(-vop_ref[0][0]) +
|
||||
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
(-vop_ref[0][1]) + (1 << (alpha + rho - 1));
|
||||
sprite_offset[1][0] = ((-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
(-2 * vop_ref[0][0] + 1) +
|
||||
(r * sprite_ref[0][1] - virtual_ref[0][1]) *
|
||||
(-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
|
||||
sprite_ref[0][0] - 16 * w2 + (1 << (alpha + rho + 1)));
|
||||
sprite_offset[1][1] = ((-r * sprite_ref[0][1] + virtual_ref[0][1]) *
|
||||
(-2 * vop_ref[0][0] + 1) +
|
||||
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
(-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
|
||||
sprite_ref[0][1] - 16 * w2 + (1 << (alpha + rho + 1)));
|
||||
sprite_offset[0][0] = ((int64_t) sprite_ref[0][0] * (1 << alpha + rho)) +
|
||||
((int64_t) -r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
((int64_t) -vop_ref[0][0]) +
|
||||
((int64_t) r * sprite_ref[0][1] - virtual_ref[0][1]) *
|
||||
((int64_t) -vop_ref[0][1]) + (1 << (alpha + rho - 1));
|
||||
sprite_offset[0][1] = ((int64_t) sprite_ref[0][1] * (1 << alpha + rho)) +
|
||||
((int64_t) -r * sprite_ref[0][1] + virtual_ref[0][1]) *
|
||||
((int64_t) -vop_ref[0][0]) +
|
||||
((int64_t) -r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
((int64_t) -vop_ref[0][1]) + (1 << (alpha + rho - 1));
|
||||
sprite_offset[1][0] = (((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
((int64_t)-2 * vop_ref[0][0] + 1) +
|
||||
((int64_t) r * sprite_ref[0][1] - virtual_ref[0][1]) *
|
||||
((int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 * r *
|
||||
(int64_t) sprite_ref[0][0] - 16 * w2 + (1 << (alpha + rho + 1)));
|
||||
sprite_offset[1][1] = (((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) *
|
||||
((int64_t)-2 * vop_ref[0][0] + 1) +
|
||||
((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]);
|
||||
@@ -361,14 +361,16 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int shift_y = 16 - ctx->sprite_shift[0];
|
||||
int shift_c = 16 - ctx->sprite_shift[1];
|
||||
|
||||
if (shift_c < 0 || shift_y < 0 ||
|
||||
FFABS(sprite_offset[0][0]) >= INT_MAX >> shift_y ||
|
||||
FFABS(sprite_offset[1][0]) >= INT_MAX >> shift_c ||
|
||||
FFABS(sprite_offset[0][1]) >= INT_MAX >> shift_y ||
|
||||
FFABS(sprite_offset[1][1]) >= INT_MAX >> shift_c
|
||||
) {
|
||||
avpriv_request_sample(s->avctx, "Too large sprite shift or offset");
|
||||
goto overflow;
|
||||
for (i = 0; i < 2; i++) {
|
||||
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
|
||||
) {
|
||||
avpriv_request_sample(s->avctx, "Too large sprite shift, delta or offset");
|
||||
goto overflow;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
@@ -2340,7 +2342,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
if (s->pict_type != AV_PICTURE_TYPE_B) {
|
||||
s->last_time_base = s->time_base;
|
||||
s->time_base += time_incr;
|
||||
s->time = s->time_base * s->avctx->framerate.num + time_increment;
|
||||
s->time = s->time_base * (int64_t)s->avctx->framerate.num + time_increment;
|
||||
if (s->workaround_bugs & FF_BUG_UMP4) {
|
||||
if (s->time < s->last_non_b_time) {
|
||||
/* header is not mpeg-4-compatible, broken encoder,
|
||||
@@ -2352,7 +2354,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
s->pp_time = s->time - s->last_non_b_time;
|
||||
s->last_non_b_time = s->time;
|
||||
} else {
|
||||
s->time = (s->last_time_base + time_incr) * s->avctx->framerate.num + time_increment;
|
||||
s->time = (s->last_time_base + time_incr) * (int64_t)s->avctx->framerate.num + time_increment;
|
||||
s->pb_time = s->pp_time - (s->last_non_b_time - s->time);
|
||||
if (s->pp_time <= s->pb_time ||
|
||||
s->pp_time <= s->pp_time - s->pb_time ||
|
||||
@@ -2566,6 +2568,7 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
MpegEncContext *s = &ctx->m;
|
||||
unsigned startcode, v;
|
||||
int ret;
|
||||
int vol = 0;
|
||||
|
||||
/* search next start code */
|
||||
align_get_bits(gb);
|
||||
@@ -2654,6 +2657,11 @@ 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;
|
||||
}
|
||||
vol++;
|
||||
if ((ret = decode_vol_header(ctx, gb)) < 0)
|
||||
return ret;
|
||||
} else if (startcode == USER_DATA_STARTCODE) {
|
||||
|
||||
+79
-4
@@ -373,9 +373,21 @@ static av_cold int nvenc_check_device(AVCodecContext *avctx, int idx)
|
||||
return 0;
|
||||
|
||||
fail3:
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
p_nvenc->nvEncDestroyEncoder(ctx->nvencoder);
|
||||
ctx->nvencoder = NULL;
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
fail2:
|
||||
dl_fn->cuda_dl->cuCtxDestroy(ctx->cu_context_internal);
|
||||
ctx->cu_context_internal = NULL;
|
||||
@@ -951,6 +963,8 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
|
||||
NV_ENC_PRESET_CONFIG preset_config = { 0 };
|
||||
NVENCSTATUS nv_status = NV_ENC_SUCCESS;
|
||||
AVCPBProperties *cpb_props;
|
||||
CUresult cu_res;
|
||||
CUcontext dummy;
|
||||
int res = 0;
|
||||
int dw, dh;
|
||||
|
||||
@@ -1038,7 +1052,20 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
nv_status = p_nvenc->nvEncInitializeEncoder(ctx->nvencoder, &ctx->init_encode_params);
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
if (nv_status != NV_ENC_SUCCESS) {
|
||||
return nvenc_print_error(avctx, nv_status, "InitializeEncoder failed");
|
||||
}
|
||||
@@ -1106,8 +1133,8 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx)
|
||||
}
|
||||
|
||||
allocSurf.version = NV_ENC_CREATE_INPUT_BUFFER_VER;
|
||||
allocSurf.width = (avctx->width + 31) & ~31;
|
||||
allocSurf.height = (avctx->height + 31) & ~31;
|
||||
allocSurf.width = avctx->width;
|
||||
allocSurf.height = avctx->height;
|
||||
allocSurf.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED;
|
||||
allocSurf.bufferFmt = ctx->surfaces[idx].format;
|
||||
|
||||
@@ -1147,6 +1174,9 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx)
|
||||
static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx)
|
||||
{
|
||||
NvencContext *ctx = avctx->priv_data;
|
||||
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
|
||||
CUresult cu_res;
|
||||
CUcontext dummy;
|
||||
int i, res;
|
||||
|
||||
ctx->surfaces = av_mallocz_array(ctx->nb_surfaces, sizeof(*ctx->surfaces));
|
||||
@@ -1163,9 +1193,28 @@ static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx)
|
||||
if (!ctx->output_surface_ready_queue)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < ctx->nb_surfaces; i++) {
|
||||
if ((res = nvenc_alloc_surface(avctx, i)) < 0)
|
||||
{
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1209,8 +1258,16 @@ av_cold int ff_nvenc_encode_close(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;
|
||||
CUresult cu_res;
|
||||
CUcontext dummy;
|
||||
int i;
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
/* the encoder has to be flushed before it can be closed */
|
||||
if (ctx->nvencoder) {
|
||||
NV_ENC_PIC_PARAMS params = { .version = NV_ENC_PIC_PARAMS_VER,
|
||||
@@ -1251,6 +1308,12 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
|
||||
p_nvenc->nvEncDestroyEncoder(ctx->nvencoder);
|
||||
ctx->nvencoder = NULL;
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
if (ctx->cu_context_internal)
|
||||
dl_fn->cuda_dl->cuCtxDestroy(ctx->cu_context_internal);
|
||||
ctx->cu_context = ctx->cu_context_internal = NULL;
|
||||
@@ -1718,8 +1781,8 @@ int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
pic_params.inputBuffer = inSurf->input_surface;
|
||||
pic_params.bufferFmt = inSurf->format;
|
||||
pic_params.inputWidth = avctx->width;
|
||||
pic_params.inputHeight = avctx->height;
|
||||
pic_params.inputWidth = inSurf->width;
|
||||
pic_params.inputHeight = inSurf->height;
|
||||
pic_params.inputPitch = inSurf->pitch;
|
||||
pic_params.outputBitstream = inSurf->output_surface;
|
||||
|
||||
@@ -1785,8 +1848,20 @@ int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
if (output_ready(avctx, !frame)) {
|
||||
av_fifo_generic_read(ctx->output_surface_ready_queue, &tmpoutsurf, sizeof(tmpoutsurf), NULL);
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
res = process_output_surface(avctx, pkt, tmpoutsurf);
|
||||
|
||||
cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy);
|
||||
if (cu_res != CUDA_SUCCESS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
|
||||
+11
-4
@@ -267,12 +267,20 @@ static int paf_video_decode(AVCodecContext *avctx, void *data,
|
||||
uint8_t code, *dst, *end;
|
||||
int i, frame, ret;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
|
||||
return ret;
|
||||
if (pkt->size < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
bytestream2_init(&c->gb, pkt->data, pkt->size);
|
||||
|
||||
code = bytestream2_get_byte(&c->gb);
|
||||
if ((code & 0xF) > 4 || (code & 0xF) == 3) {
|
||||
avpriv_request_sample(avctx, "unknown/invalid code");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
|
||||
return ret;
|
||||
|
||||
if (code & 0x20) { // frame is keyframe
|
||||
for (i = 0; i < 4; i++)
|
||||
memset(c->frame[i], 0, c->frame_size);
|
||||
@@ -367,8 +375,7 @@ static int paf_video_decode(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
avpriv_request_sample(avctx, "unknown/invalid code");
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_assert0(0);
|
||||
}
|
||||
|
||||
av_image_copy_plane(c->pic->data[0], c->pic->linesize[0],
|
||||
|
||||
+8
-2
@@ -206,8 +206,8 @@ static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, i
|
||||
if ((ret = init_get_bits8(b, src, bytestream2_get_bytes_left(&ctx->gb))) < 0)
|
||||
return ret;
|
||||
|
||||
if ((a >= 0) + (a ^ (a >> 31)) - (a >> 31) != 1) {
|
||||
nbits = 33 - ff_clz((a >= 0) + (a ^ (a >> 31)) - (a >> 31) - 1);
|
||||
if (a ^ (a >> 31)) {
|
||||
nbits = 33 - ff_clz(a ^ (a >> 31));
|
||||
if (nbits > 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else {
|
||||
@@ -229,6 +229,8 @@ static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, i
|
||||
cnt1 = get_bits(b, nbits);
|
||||
} else {
|
||||
pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14));
|
||||
if (pfx < 1 || pfx > 25)
|
||||
return AVERROR_INVALIDDATA;
|
||||
cnt1 *= (1 << pfx) - 1;
|
||||
shbits = show_bits(b, pfx);
|
||||
if (shbits <= 1) {
|
||||
@@ -592,6 +594,10 @@ static int pixlet_decode_frame(AVCodecContext *avctx, void *data,
|
||||
width = bytestream2_get_be32(&ctx->gb);
|
||||
height = bytestream2_get_be32(&ctx->gb);
|
||||
|
||||
if ( width > INT_MAX - (1U << (NB_LEVELS + 1))
|
||||
|| height > INT_MAX - (1U << (NB_LEVELS + 1)))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
w = FFALIGN(width, 1 << (NB_LEVELS + 1));
|
||||
h = FFALIGN(height, 1 << (NB_LEVELS + 1));
|
||||
|
||||
|
||||
+8
-4
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
#include "pnm.h"
|
||||
|
||||
static inline int pnm_space(int c)
|
||||
@@ -61,6 +62,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
|
||||
{
|
||||
char buf1[32], tuple_type[32];
|
||||
int h, w, depth, maxval;
|
||||
int ret;
|
||||
|
||||
pnm_get(s, buf1, sizeof(buf1));
|
||||
if(buf1[0] != 'P')
|
||||
@@ -111,8 +113,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
|
||||
av_image_check_size(w, h, 0, avctx) || s->bytestream >= s->bytestream_end)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avctx->width = w;
|
||||
avctx->height = h;
|
||||
ret = ff_set_dimensions(avctx, w, h);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
s->maxval = maxval;
|
||||
if (depth == 1) {
|
||||
if (maxval == 1) {
|
||||
@@ -154,8 +157,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
|
||||
if(w <= 0 || h <= 0 || av_image_check_size(w, h, 0, avctx) || s->bytestream >= s->bytestream_end)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avctx->width = w;
|
||||
avctx->height = h;
|
||||
ret = ff_set_dimensions(avctx, w, h);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (avctx->pix_fmt != AV_PIX_FMT_MONOWHITE && avctx->pix_fmt != AV_PIX_FMT_MONOBLACK) {
|
||||
pnm_get(s, buf1, sizeof(buf1));
|
||||
|
||||
+5
-1
@@ -58,6 +58,8 @@ static int parse_palette(AVCodecContext *avctx, GetByteContext *gbc,
|
||||
bytestream2_skip(gbc, 6);
|
||||
continue;
|
||||
}
|
||||
if (avctx->pix_fmt != AV_PIX_FMT_PAL8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
r = bytestream2_get_byte(gbc);
|
||||
bytestream2_skip(gbc, 1);
|
||||
g = bytestream2_get_byte(gbc);
|
||||
@@ -378,7 +380,9 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors);
|
||||
ret = parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
p->palette_has_changed = 1;
|
||||
|
||||
/* jump to image data */
|
||||
|
||||
+4
-4
@@ -1512,7 +1512,7 @@ static void add_wav(int16_t *dest, int n, int skip_first, int *m,
|
||||
|
||||
v[0] = 0;
|
||||
for (i=!skip_first; i<3; i++)
|
||||
v[i] = (ff_gain_val_tab[n][i] * m[i]) >> ff_gain_exp_tab[n];
|
||||
v[i] = (ff_gain_val_tab[n][i] * (unsigned)m[i]) >> ff_gain_exp_tab[n];
|
||||
|
||||
if (v[0]) {
|
||||
for (i=0; i < BLOCKSIZE; i++)
|
||||
@@ -1573,7 +1573,7 @@ int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
|
||||
if((int)(a*(unsigned)b) != a*(int64_t)b)
|
||||
return 1;
|
||||
#endif
|
||||
bp1[j] = ((bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12)) * b) >> 12;
|
||||
bp1[j] = (int)((bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12)) * (unsigned)b) >> 12;
|
||||
}
|
||||
|
||||
if ((unsigned) bp1[i] + 0x1000 > 0x1fff)
|
||||
@@ -1601,7 +1601,7 @@ void ff_eval_coefs(int *coefs, const int *refl)
|
||||
b1[i] = refl[i] * 16;
|
||||
|
||||
for (j=0; j < i; j++)
|
||||
b1[j] = ((refl[i] * b2[i-j-1]) >> 12) + b2[j];
|
||||
b1[j] = ((int)(refl[i] * (unsigned)b2[i-j-1]) >> 12) + b2[j];
|
||||
|
||||
FFSWAP(int *, b1, b2);
|
||||
}
|
||||
@@ -1701,7 +1701,7 @@ void ff_subblock_synthesis(RA144Context *ractx, const int16_t *lpc_coefs,
|
||||
if (cba_idx) {
|
||||
cba_idx += BLOCKSIZE/2 - 1;
|
||||
ff_copy_and_dup(ractx->buffer_a, ractx->adapt_cb, cba_idx);
|
||||
m[0] = (ff_irms(&ractx->adsp, ractx->buffer_a) * gval) >> 12;
|
||||
m[0] = (ff_irms(&ractx->adsp, ractx->buffer_a) * (unsigned)gval) >> 12;
|
||||
} else {
|
||||
m[0] = 0;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
|
||||
do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb);
|
||||
|
||||
for (j=0; j < BLOCKSIZE; j++)
|
||||
*samples++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2);
|
||||
*samples++ = av_clip_int16(ractx->curr_sblock[j + 10] * (1 << 2));
|
||||
}
|
||||
|
||||
ractx->old_energy = energy;
|
||||
|
||||
+4
-4
@@ -462,11 +462,11 @@ static void destroy_buffers(SANMVideoContext *ctx)
|
||||
|
||||
static av_cold int init_buffers(SANMVideoContext *ctx)
|
||||
{
|
||||
av_fast_padded_malloc(&ctx->frm0, &ctx->frm0_size, ctx->buf_size);
|
||||
av_fast_padded_malloc(&ctx->frm1, &ctx->frm1_size, ctx->buf_size);
|
||||
av_fast_padded_malloc(&ctx->frm2, &ctx->frm2_size, ctx->buf_size);
|
||||
av_fast_padded_mallocz(&ctx->frm0, &ctx->frm0_size, ctx->buf_size);
|
||||
av_fast_padded_mallocz(&ctx->frm1, &ctx->frm1_size, ctx->buf_size);
|
||||
av_fast_padded_mallocz(&ctx->frm2, &ctx->frm2_size, ctx->buf_size);
|
||||
if (!ctx->version)
|
||||
av_fast_padded_malloc(&ctx->stored_frame,
|
||||
av_fast_padded_mallocz(&ctx->stored_frame,
|
||||
&ctx->stored_frame_size, ctx->buf_size);
|
||||
|
||||
if (!ctx->frm0 || !ctx->frm1 || !ctx->frm2 ||
|
||||
|
||||
@@ -229,11 +229,11 @@ static void sbr_hf_gen_c(int (*X_high)[2], const int (*X_low)[2],
|
||||
static void sbr_hf_g_filt_c(int (*Y)[2], const int (*X_high)[40][2],
|
||||
const SoftFloat *g_filt, int m_max, intptr_t ixh)
|
||||
{
|
||||
int m, r;
|
||||
int m;
|
||||
int64_t accu;
|
||||
|
||||
for (m = 0; m < m_max; m++) {
|
||||
r = 1 << (22-g_filt[m].exp);
|
||||
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));
|
||||
|
||||
@@ -242,7 +242,7 @@ static void sbr_hf_g_filt_c(int (*Y)[2], const int (*X_high)[40][2],
|
||||
}
|
||||
}
|
||||
|
||||
static av_always_inline void sbr_hf_apply_noise(int (*Y)[2],
|
||||
static av_always_inline int sbr_hf_apply_noise(int (*Y)[2],
|
||||
const SoftFloat *s_m,
|
||||
const SoftFloat *q_filt,
|
||||
int noise,
|
||||
@@ -253,14 +253,17 @@ static av_always_inline void sbr_hf_apply_noise(int (*Y)[2],
|
||||
int m;
|
||||
|
||||
for (m = 0; m < m_max; m++) {
|
||||
int y0 = Y[m][0];
|
||||
int y1 = Y[m][1];
|
||||
unsigned y0 = Y[m][0];
|
||||
unsigned y1 = Y[m][1];
|
||||
noise = (noise + 1) & 0x1ff;
|
||||
if (s_m[m].mant) {
|
||||
int shift, round;
|
||||
|
||||
shift = 22 - s_m[m].exp;
|
||||
if (shift < 30) {
|
||||
if (shift < 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Overflow in sbr_hf_apply_noise, shift=%d\n", shift);
|
||||
return AVERROR(ERANGE);
|
||||
} else if (shift < 30) {
|
||||
round = 1 << (shift-1);
|
||||
y0 += (s_m[m].mant * phi_sign0 + round) >> shift;
|
||||
y1 += (s_m[m].mant * phi_sign1 + round) >> shift;
|
||||
@@ -270,7 +273,10 @@ static av_always_inline void sbr_hf_apply_noise(int (*Y)[2],
|
||||
int64_t accu;
|
||||
|
||||
shift = 22 - q_filt[m].exp;
|
||||
if (shift < 30) {
|
||||
if (shift < 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Overflow in sbr_hf_apply_noise, shift=%d\n", shift);
|
||||
return AVERROR(ERANGE);
|
||||
} else if (shift < 30) {
|
||||
round = 1 << (shift-1);
|
||||
|
||||
accu = (int64_t)q_filt[m].mant * ff_sbr_noise_table_fixed[noise][0];
|
||||
@@ -286,6 +292,7 @@ static av_always_inline void sbr_hf_apply_noise(int (*Y)[2],
|
||||
Y[m][1] = y1;
|
||||
phi_sign1 = -phi_sign1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "sbrdsp_template.c"
|
||||
|
||||
@@ -33,8 +33,13 @@ static void sbr_qmf_deint_bfly_c(INTFLOAT *v, const INTFLOAT *src0, const INTFLO
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
v[ i] = AAC_SRA_R((src0[i] - src1[63 - i]), 5);
|
||||
v[127 - i] = AAC_SRA_R((src0[i] + src1[63 - i]), 5);
|
||||
#if USE_FIXED
|
||||
v[ i] = (int)(0x10U + src0[i] - src1[63 - i]) >> 5;
|
||||
v[127 - i] = (int)(0x10U + src0[i] + src1[63 - i]) >> 5;
|
||||
#else
|
||||
v[ i] = src0[i] - src1[63 - i];
|
||||
v[127 - i] = src0[i] + src1[63 - i];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -488,7 +488,7 @@ static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize)
|
||||
|
||||
if (avctx->bits_per_coded_sample == 16) {
|
||||
cx1 = (clr & 0x3F00) >> 2;
|
||||
cx = (clr & 0xFFFFFF) >> 16;
|
||||
cx = (clr & 0x3FFFFF) >> 16;
|
||||
} else {
|
||||
cx1 = (clr & 0xFC00) >> 4;
|
||||
cx = (clr & 0xFFFFFF) >> 18;
|
||||
@@ -726,7 +726,7 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
|
||||
if (avctx->bits_per_coded_sample == 16) {
|
||||
cx1 = (clr & 0x3F00) >> 2;
|
||||
cx = (clr & 0xFFFFFF) >> 16;
|
||||
cx = (clr & 0x3FFFFF) >> 16;
|
||||
} else {
|
||||
cx1 = (clr & 0xFC00) >> 4;
|
||||
cx = (clr & 0xFFFFFF) >> 18;
|
||||
|
||||
@@ -3105,6 +3105,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (avpkt->size < 20 + avctx->width * avctx->height / 16) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->format != format) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -445,6 +445,10 @@ static int read_header(ShortenContext *s)
|
||||
s->blocksize = blocksize;
|
||||
|
||||
maxnlpc = get_uint(s, LPCQSIZE);
|
||||
if (maxnlpc > 1024U) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "maxnlpc is: %d\n", maxnlpc);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->nmean = get_uint(s, 0);
|
||||
|
||||
skip_bytes = get_uint(s, NSKIPSIZE);
|
||||
|
||||
@@ -132,6 +132,10 @@ static void smc_decode_stream(SmcContext *s)
|
||||
row_ptr, image_size);
|
||||
return;
|
||||
}
|
||||
if (bytestream2_get_bytes_left(&s->gb) < 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "input too small\n");
|
||||
return;
|
||||
}
|
||||
|
||||
opcode = bytestream2_get_byte(&s->gb);
|
||||
switch (opcode & 0xF0) {
|
||||
|
||||
+2
-1
@@ -540,7 +540,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
|
||||
if(get_rac(c, state+0))
|
||||
return 0;
|
||||
else{
|
||||
int i, e, a;
|
||||
int i, e;
|
||||
unsigned a;
|
||||
e= 0;
|
||||
while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
|
||||
e++;
|
||||
|
||||
@@ -586,7 +586,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
for(; yq<slice_h && yq<h; yq++){
|
||||
IDWTELEM * line = slice_buffer_get_line(&s->sb, yq);
|
||||
for(x=0; x<w; x++){
|
||||
line[x] <<= FRAC_BITS;
|
||||
line[x] *= 1<<FRAC_BITS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -524,8 +524,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
|
||||
if (mode != PREDICT_MODE) {
|
||||
svq3_pred_motion(s, k, part_width >> 2, dir, 1, &mx, &my);
|
||||
} else {
|
||||
mx = s->next_pic->motion_val[0][b_xy][0] << 1;
|
||||
my = s->next_pic->motion_val[0][b_xy][1] << 1;
|
||||
mx = s->next_pic->motion_val[0][b_xy][0] * 2;
|
||||
my = s->next_pic->motion_val[0][b_xy][1] * 2;
|
||||
|
||||
if (dir == 0) {
|
||||
mx = mx * s->frame_num_offset /
|
||||
|
||||
+7
-7
@@ -267,11 +267,11 @@ static int decode_segment(TAKDecContext *s, int8_t mode, int32_t *decoded, int l
|
||||
code = xcodes[mode - 1];
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
int x = get_bits_long(gb, code.init);
|
||||
unsigned x = get_bits_long(gb, code.init);
|
||||
if (x >= code.escape && get_bits1(gb)) {
|
||||
x |= 1 << code.init;
|
||||
if (x >= code.aescape) {
|
||||
int scale = get_unary(gb, 1, 9);
|
||||
unsigned scale = get_unary(gb, 1, 9);
|
||||
if (scale == 9) {
|
||||
int scale_bits = get_bits(gb, 3);
|
||||
if (scale_bits > 0) {
|
||||
@@ -483,7 +483,7 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
|
||||
int v = 1 << (filter_quant - 1);
|
||||
|
||||
if (filter_order & -16)
|
||||
v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter,
|
||||
v += (unsigned)s->adsp.scalarproduct_int16(&s->residues[i], s->filter,
|
||||
filter_order & -16);
|
||||
for (j = filter_order & -16; j < filter_order; j += 4) {
|
||||
v += s->residues[i + j + 3] * s->filter[j + 3] +
|
||||
@@ -491,7 +491,7 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
|
||||
s->residues[i + j + 1] * s->filter[j + 1] +
|
||||
s->residues[i + j ] * s->filter[j ];
|
||||
}
|
||||
v = (av_clip_intp2(v >> filter_quant, 13) * (1 << dshift)) - *decoded;
|
||||
v = (av_clip_intp2(v >> filter_quant, 13) * (1 << dshift)) - (unsigned)*decoded;
|
||||
*decoded++ = v;
|
||||
s->residues[filter_order + i] = v >> dshift;
|
||||
}
|
||||
@@ -862,7 +862,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
if (s->sample_shift[chan] > 0)
|
||||
for (i = 0; i < s->nb_samples; i++)
|
||||
decoded[i] <<= s->sample_shift[chan];
|
||||
decoded[i] *= 1U << s->sample_shift[chan];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -889,7 +889,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||
uint8_t *samples = (uint8_t *)frame->extended_data[chan];
|
||||
int32_t *decoded = s->decoded[chan];
|
||||
for (i = 0; i < s->nb_samples; i++)
|
||||
samples[i] = decoded[i] + 0x80;
|
||||
samples[i] = decoded[i] + 0x80U;
|
||||
}
|
||||
break;
|
||||
case AV_SAMPLE_FMT_S16P:
|
||||
@@ -904,7 +904,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||
for (chan = 0; chan < avctx->channels; chan++) {
|
||||
int32_t *samples = (int32_t *)frame->extended_data[chan];
|
||||
for (i = 0; i < s->nb_samples; i++)
|
||||
samples[i] <<= 8;
|
||||
samples[i] *= 1U << 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+7
-1
@@ -1033,6 +1033,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
s->subsampling[i] = ff_tget(&s->gb, type, s->le);
|
||||
if (s->subsampling[i] <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", s->subsampling[i]);
|
||||
s->subsampling[i] = 1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
@@ -1110,6 +1111,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
if (s->geotags[i].count == 0
|
||||
|| s->geotags[i].offset + s->geotags[i].count > count) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key);
|
||||
} else if (s->geotags[i].val) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Duplicate GeoTIFF key %d\n", s->geotags[i].key);
|
||||
} else {
|
||||
char *ap = doubles2str(&dp[s->geotags[i].offset], s->geotags[i].count, ", ");
|
||||
if (!ap) {
|
||||
@@ -1136,6 +1139,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
bytestream2_seek(&s->gb, pos + s->geotags[i].offset, SEEK_SET);
|
||||
if (bytestream2_get_bytes_left(&s->gb) < s->geotags[i].count)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->geotags[i].val)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ap = av_malloc(s->geotags[i].count);
|
||||
if (!ap) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
|
||||
@@ -1298,6 +1303,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
stride = p->linesize[plane];
|
||||
dst = p->data[plane];
|
||||
for (i = 0; i < s->height; i += s->rps) {
|
||||
if (i)
|
||||
dst += s->rps * stride;
|
||||
if (s->stripsizesoff)
|
||||
ssize = ff_tget(&stripsizes, s->sstype, le);
|
||||
else
|
||||
@@ -1318,7 +1325,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
dst += s->rps * stride;
|
||||
}
|
||||
if (s->predictor == 2) {
|
||||
if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {
|
||||
|
||||
@@ -180,7 +180,7 @@ static int make_ydt15_entry(int p1, int p2, int16_t *ydt)
|
||||
lo += (lo * 32) + (lo * 1024);
|
||||
hi = ydt[p2];
|
||||
hi += (hi * 32) + (hi * 1024);
|
||||
return (lo + (hi * (1 << 16))) * 2;
|
||||
return (lo + (hi * (1U << 16))) * 2;
|
||||
}
|
||||
|
||||
static int make_cdt15_entry(int p1, int p2, int16_t *cdt)
|
||||
@@ -190,7 +190,7 @@ static int make_cdt15_entry(int p1, int p2, int16_t *cdt)
|
||||
b = cdt[p2];
|
||||
r = cdt[p1] * 1024;
|
||||
lo = b + r;
|
||||
return (lo + (lo * (1 << 16))) * 2;
|
||||
return (lo + (lo * (1U << 16))) * 2;
|
||||
}
|
||||
|
||||
#if HAVE_BIGENDIAN
|
||||
|
||||
@@ -272,7 +272,7 @@ static int tm2_read_deltas(TM2Context *ctx, int stream_id)
|
||||
for (i = 0; i < d; i++) {
|
||||
v = get_bits_long(&ctx->gb, mb);
|
||||
if (v & (1 << (mb - 1)))
|
||||
ctx->deltas[stream_id][i] = v - (1 << mb);
|
||||
ctx->deltas[stream_id][i] = v - (1U << mb);
|
||||
else
|
||||
ctx->deltas[stream_id][i] = v;
|
||||
}
|
||||
@@ -298,15 +298,15 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i
|
||||
/* get stream length in dwords */
|
||||
bytestream2_init(&gb, buf, buf_size);
|
||||
len = bytestream2_get_be32(&gb);
|
||||
skip = len * 4 + 4;
|
||||
|
||||
if (len == 0)
|
||||
return 4;
|
||||
|
||||
if (len >= INT_MAX / 4 - 1 || len < 0 || skip > buf_size) {
|
||||
if (len >= INT_MAX / 4 - 1 || len < 0 || len * 4 + 4 > buf_size) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Error, invalid stream size.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
skip = len * 4 + 4;
|
||||
|
||||
toks = bytestream2_get_be32(&gb);
|
||||
if (toks & 1) {
|
||||
@@ -915,7 +915,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
buf_size - offset);
|
||||
if (t < 0) {
|
||||
int j = tm2_stream_order[i];
|
||||
memset(l->tokens[j], 0, sizeof(**l->tokens) * l->tok_lens[j]);
|
||||
if (l->tok_lens[j])
|
||||
memset(l->tokens[j], 0, sizeof(**l->tokens) * l->tok_lens[j]);
|
||||
return t;
|
||||
}
|
||||
offset += t;
|
||||
|
||||
@@ -205,6 +205,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
if (flags & VB_HAS_GMC) {
|
||||
i = (int16_t)bytestream2_get_le16(&c->stream);
|
||||
j = (int16_t)bytestream2_get_le16(&c->stream);
|
||||
if (FFABS(j) > avctx->height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "GMV out of range\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
offset = i + j * avctx->width;
|
||||
}
|
||||
if (flags & VB_HAS_VIDEO) {
|
||||
|
||||
+6
-12
@@ -381,6 +381,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
w = bytestream2_get_be16(gb);
|
||||
h = bytestream2_get_be16(gb);
|
||||
enc = bytestream2_get_be32(gb);
|
||||
if ((dx + w > c->width) || (dy + h > c->height)) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
|
||||
w, h, dx, dy, c->width, c->height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
outptr = c->pic->data[0] + dx * c->bpp2 + dy * c->pic->linesize[0];
|
||||
size_left = bytestream2_get_bytes_left(gb);
|
||||
switch (enc) {
|
||||
@@ -458,12 +464,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
bytestream2_skip(gb, 2);
|
||||
break;
|
||||
case 0x00000000: // raw rectangle data
|
||||
if ((dx + w > c->width) || (dy + h > c->height)) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
|
||||
w, h, dx, dy, c->width, c->height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (size_left < w * h * c->bpp2) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Premature end of data! (need %i got %i)\n",
|
||||
@@ -474,12 +474,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
c->pic->linesize[0]);
|
||||
break;
|
||||
case 0x00000005: // HexTile encoded rectangle
|
||||
if ((dx + w > c->width) || (dy + h > c->height)) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
|
||||
w, h, dx, dy, c->width, c->height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
res = decode_hextile(c, outptr, gb, w, h, c->pic->linesize[0]);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
@@ -915,9 +915,9 @@ skip_eob:
|
||||
if (!--band_left)
|
||||
band_left = band_counts[++band];
|
||||
if (is_tx32x32)
|
||||
STORE_COEF(coef, rc, ((vp8_rac_get(c) ? -val : val) * qmul[!!i]) / 2);
|
||||
STORE_COEF(coef, rc, (int)((vp8_rac_get(c) ? -val : val) * (unsigned)qmul[!!i]) / 2);
|
||||
else
|
||||
STORE_COEF(coef, rc, (vp8_rac_get(c) ? -val : val) * qmul[!!i]);
|
||||
STORE_COEF(coef, rc, (vp8_rac_get(c) ? -val : val) * (unsigned)qmul[!!i]);
|
||||
nnz = (1 + cache[nb[i][0]] + cache[nb[i][1]]) >> 1;
|
||||
tp = p[band][nnz];
|
||||
} while (++i < n_coeffs);
|
||||
|
||||
+15
-9
@@ -188,7 +188,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
|
||||
goto error;
|
||||
t += t2;
|
||||
} else {
|
||||
if (get_bits_left(gb) < t2 - 1)
|
||||
if (t2 >= 32 || get_bits_left(gb) < t2 - 1)
|
||||
goto error;
|
||||
t += get_bits_long(gb, t2 - 1) | (1 << (t2 - 1));
|
||||
}
|
||||
@@ -225,7 +225,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
|
||||
INC_MED(1);
|
||||
DEC_MED(2);
|
||||
} else {
|
||||
base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2);
|
||||
base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2U);
|
||||
add = GET_MED(2) - 1;
|
||||
INC_MED(0);
|
||||
INC_MED(1);
|
||||
@@ -245,7 +245,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
|
||||
if (get_bits_left(gb) <= 0)
|
||||
goto error;
|
||||
if (get_bits1(gb)) {
|
||||
add -= (mid - base);
|
||||
add -= (mid - (unsigned)base);
|
||||
base = mid;
|
||||
} else
|
||||
add = mid - base - 1;
|
||||
@@ -313,8 +313,8 @@ static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
|
||||
S <<= s->float_shift;
|
||||
sign = S < 0;
|
||||
if (sign)
|
||||
S = -S;
|
||||
if (S >= 0x1000000) {
|
||||
S = -(unsigned)S;
|
||||
if (S >= 0x1000000U) {
|
||||
if (s->got_extra_bits && get_bits1(&s->gb_extra_bits))
|
||||
S = get_bits(&s->gb_extra_bits, 23);
|
||||
else
|
||||
@@ -480,7 +480,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
|
||||
}
|
||||
|
||||
if (type == AV_SAMPLE_FMT_S16P) {
|
||||
if (FFABS(L) + FFABS(R) > (1<<19)) {
|
||||
if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -554,7 +554,7 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb,
|
||||
if (type != AV_SAMPLE_FMT_S16P)
|
||||
S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
|
||||
else
|
||||
S = T + ((s->decorr[i].weightA * A + 512) >> 10);
|
||||
S = T + ((int)(s->decorr[i].weightA * (unsigned)A + 512) >> 10);
|
||||
if (A && T)
|
||||
s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta;
|
||||
s->decorr[i].samplesA[j] = T = S;
|
||||
@@ -846,9 +846,9 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
|
||||
continue;
|
||||
}
|
||||
bytestream2_get_buffer(&gb, val, 4);
|
||||
if (val[0] > 31) {
|
||||
if (val[0] > 30) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid INT32INFO, extra_bits = %d (> 32)\n", val[0]);
|
||||
"Invalid INT32INFO, extra_bits = %d (> 30)\n", val[0]);
|
||||
continue;
|
||||
} else if (val[0]) {
|
||||
s->extra_bits = val[0];
|
||||
@@ -887,6 +887,12 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
|
||||
s->float_flag = bytestream2_get_byte(&gb);
|
||||
s->float_shift = bytestream2_get_byte(&gb);
|
||||
s->float_max_exp = bytestream2_get_byte(&gb);
|
||||
if (s->float_shift > 31) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid FLOATINFO, shift = %d (> 31)\n", s->float_shift);
|
||||
s->float_shift = 0;
|
||||
continue;
|
||||
}
|
||||
got_float = 1;
|
||||
bytestream2_skip(&gb, 1);
|
||||
break;
|
||||
|
||||
@@ -94,7 +94,7 @@ typedef struct Decorr {
|
||||
typedef struct WvChannel {
|
||||
int median[3];
|
||||
int slow_level, error_limit;
|
||||
int bitrate_acc, bitrate_delta;
|
||||
unsigned bitrate_acc, bitrate_delta;
|
||||
} WvChannel;
|
||||
|
||||
// macros for manipulating median values
|
||||
|
||||
@@ -1351,6 +1351,9 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!*got_frame)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
update_canvas_size(avctx, avctx->width, avctx->height);
|
||||
|
||||
if (s->has_alpha) {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
int prev_y = 0, prev_u = 0, prev_v = 0;
|
||||
uint8_t *rbuf;
|
||||
|
||||
if (buf_size <= 8) {
|
||||
if (buf_size < 8 + avctx->height * (avctx->width/2)/8) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Packet size %d is too small\n", buf_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+6
-2
@@ -69,7 +69,7 @@ static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
|
||||
|
||||
s = nodes[node].sym;
|
||||
if (s != -1) {
|
||||
bits[*pos] = (~pfx) & ((1 << FFMAX(pl, 1)) - 1);
|
||||
bits[*pos] = (~pfx) & ((1ULL << FFMAX(pl, 1)) - 1);
|
||||
lens[*pos] = FFMAX(pl, 1);
|
||||
xlat[*pos] = s + (pl == 0);
|
||||
(*pos)++;
|
||||
@@ -109,7 +109,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table)
|
||||
int new_node = j;
|
||||
int first_node = cur_node;
|
||||
int second_node = cur_node;
|
||||
int nd, st;
|
||||
unsigned nd, st;
|
||||
|
||||
nodes[cur_node].count = -1;
|
||||
|
||||
@@ -133,6 +133,10 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table)
|
||||
st = nodes[first_node].count;
|
||||
nodes[second_node].count = 0;
|
||||
nodes[first_node].count = 0;
|
||||
if (nd >= UINT32_MAX - st) {
|
||||
av_log(avctx, AV_LOG_ERROR, "count overflow\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
nodes[cur_node].count = nd + st;
|
||||
nodes[cur_node].sym = -1;
|
||||
nodes[cur_node].n0 = cur_node;
|
||||
|
||||
@@ -73,7 +73,7 @@ static void register_all(void)
|
||||
|
||||
void avdevice_register_all(void)
|
||||
{
|
||||
AVOnce control = AV_ONCE_INIT;
|
||||
static AVOnce control = AV_ONCE_INIT;
|
||||
|
||||
ff_thread_once(&control, register_all);
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ static void register_all(void)
|
||||
|
||||
void avfilter_register_all(void)
|
||||
{
|
||||
AVOnce control = AV_ONCE_INIT;
|
||||
static AVOnce control = AV_ONCE_INIT;
|
||||
|
||||
ff_thread_once(&control, register_all);
|
||||
}
|
||||
|
||||
@@ -1191,7 +1191,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
|
||||
called with enough samples. */
|
||||
av_assert1(samples_ready(link, link->min_samples));
|
||||
frame0 = frame = ff_framequeue_peek(&link->fifo, 0);
|
||||
if (frame->nb_samples >= min && frame->nb_samples < max) {
|
||||
if (!link->fifo.samples_skipped && frame->nb_samples >= min && frame->nb_samples <= max) {
|
||||
*rframe = ff_framequeue_take(&link->fifo);
|
||||
return 0;
|
||||
}
|
||||
@@ -1522,6 +1522,12 @@ int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
|
||||
*rframe = NULL;
|
||||
if (!ff_inlink_check_available_frame(link))
|
||||
return 0;
|
||||
|
||||
if (link->fifo.samples_skipped) {
|
||||
frame = ff_framequeue_peek(&link->fifo, 0);
|
||||
return ff_inlink_consume_samples(link, frame->nb_samples, frame->nb_samples, rframe);
|
||||
}
|
||||
|
||||
frame = ff_framequeue_take(&link->fifo);
|
||||
consume_update(link, frame);
|
||||
*rframe = frame;
|
||||
|
||||
@@ -107,6 +107,7 @@ AVFrame *ff_framequeue_take(FFFrameQueue *fq)
|
||||
fq->tail &= fq->allocated - 1;
|
||||
fq->total_frames_tail++;
|
||||
fq->total_samples_tail += b->frame->nb_samples;
|
||||
fq->samples_skipped = 0;
|
||||
check_consistency(fq);
|
||||
return b->frame;
|
||||
}
|
||||
@@ -146,5 +147,6 @@ void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational tim
|
||||
for (i = 0; i < planes && i < AV_NUM_DATA_POINTERS; i++)
|
||||
b->frame->data[i] = b->frame->extended_data[i];
|
||||
fq->total_samples_tail += samples;
|
||||
fq->samples_skipped = 1;
|
||||
ff_framequeue_update_peeked(fq, 0);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,11 @@ typedef struct FFFrameQueue {
|
||||
*/
|
||||
uint64_t total_samples_tail;
|
||||
|
||||
/**
|
||||
* Indicate that samples are skipped
|
||||
*/
|
||||
int samples_skipped;
|
||||
|
||||
} FFFrameQueue;
|
||||
|
||||
/**
|
||||
|
||||
@@ -384,7 +384,7 @@ static void register_all(void)
|
||||
|
||||
void av_register_all(void)
|
||||
{
|
||||
AVOnce control = AV_ONCE_INIT;
|
||||
static AVOnce control = AV_ONCE_INIT;
|
||||
|
||||
ff_thread_once(&control, register_all);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user