Compare commits
181 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c1c50650df | |||
| ff1f181178 | |||
| 9b33462dc4 | |||
| dd349b24ce | |||
| 814dd3e9eb | |||
| 224b47f76d | |||
| b4cea069a5 | |||
| 0f98030290 | |||
| d93a5a8d11 | |||
| 70d3ad7b6f | |||
| d2108de6b8 | |||
| d9b25b3923 | |||
| 0f928e5918 | |||
| 611ef6381b | |||
| 340690e8e6 | |||
| 0991208151 | |||
| b38c8fd291 | |||
| bc6c12b7e7 | |||
| 1d37fe95e8 | |||
| 79122e2671 | |||
| d8afd8d371 | |||
| 7f79879a01 | |||
| 6a9017d3a5 | |||
| d7b86cd308 | |||
| 8c33e2e11b | |||
| 8fbd347508 | |||
| bbda126477 | |||
| 236912f789 | |||
| 9fb677dd82 | |||
| 3ed0d94b82 | |||
| 6f8dab7a7b | |||
| 47da68fc8e | |||
| 479bb1cacd | |||
| b0f3f56bbc | |||
| 128b42f4d1 | |||
| d1dd90ae54 | |||
| 00a9eaff97 | |||
| 906f1f66a8 | |||
| f0ee408624 | |||
| 5121f31cac | |||
| 3526d25017 | |||
| 34ae610115 | |||
| ee92ea8903 | |||
| 256b9442df | |||
| 971fe06074 | |||
| 5d0e4c877f | |||
| 383fdec3b2 | |||
| 79f6a1b96e | |||
| 9b754ccc53 | |||
| 363b46cdbf | |||
| 35f293fe89 | |||
| 4a974cb595 | |||
| 924a2dd57a | |||
| e9c3c8df45 | |||
| e6997adee9 | |||
| 3af036360d | |||
| 3459fd598e | |||
| f58b45f0ac | |||
| 5d2ddaa139 | |||
| f66eaded01 | |||
| 452629fb23 | |||
| 311b29134e | |||
| be3a7857ed | |||
| 95c80c7d27 | |||
| 497de399c9 | |||
| 8850dc3771 | |||
| d9adb13ff6 | |||
| 9e54114647 | |||
| 49aa0e9cc7 | |||
| 27a30e4166 | |||
| abeb7838ca | |||
| 6ec9c902ee | |||
| 0d17ecffa5 | |||
| 88893627a1 | |||
| a483e46b79 | |||
| 97eb92b276 | |||
| e397902d47 | |||
| edb8d29ca5 | |||
| bf4b8b1677 | |||
| 298de0a183 | |||
| 8795bf9e5d | |||
| 77af726871 | |||
| 9970fa10c0 | |||
| ffa39cd574 | |||
| 3f7a9eef51 | |||
| eec20b665a | |||
| 4f0fecf9fa | |||
| fca86d3e28 | |||
| bd739bce1c | |||
| f8eea96d64 | |||
| c108bba1ae | |||
| 973a66108b | |||
| cbc5796fc3 | |||
| 66b7e165db | |||
| 99bedf74ac | |||
| 2ff5e3f54e | |||
| 28c618355c | |||
| 88a3e4c34e | |||
| e2462c8828 | |||
| 139d881273 | |||
| 6f590bf05f | |||
| cab8d31804 | |||
| 3585986a00 | |||
| 645b36ce64 | |||
| 67835afd79 | |||
| 955b97704f | |||
| 28b6588b48 | |||
| 7617b90f07 | |||
| 2adf20b3da | |||
| b80d4f58d8 | |||
| 85bf84c96c | |||
| 5520e00a49 | |||
| 671530ccb4 | |||
| 1e8212798c | |||
| 484ce1af75 | |||
| 175a569f5b | |||
| dd3a5f04b9 | |||
| a5bcb36874 | |||
| 142c65ba9c | |||
| dfda395b2f | |||
| 927ff67ab4 | |||
| 44eabc5d5d | |||
| 78fd652af4 | |||
| 65a9d0c66c | |||
| b1fc2c5c25 | |||
| b6a4aeb2f6 | |||
| 0875b2651d | |||
| 681ca7ecd0 | |||
| 51f24cb3f5 | |||
| 87dcc7502d | |||
| 3ffde707df | |||
| 2ff9e21f7f | |||
| 9eb0d76e25 | |||
| 508e410d34 | |||
| 059db22040 | |||
| 329176adc5 | |||
| 8119efdbec | |||
| 4f19268eee | |||
| 58a8e4733a | |||
| cfca0b9139 | |||
| da693f8daa | |||
| ed2ed4ac0f | |||
| 1968a1eef1 | |||
| f4f3bf3c94 | |||
| 6557ea8e2b | |||
| 9d742f774a | |||
| 5e84c94f69 | |||
| e90de50195 | |||
| 51ca6fda05 | |||
| d1cae50a04 | |||
| b51217381d | |||
| f5f0b2f44c | |||
| e9fc7a90ba | |||
| 414d11fff6 | |||
| 1830b0a6c7 | |||
| 0ed4f26cf2 | |||
| 69e35db80d | |||
| af43c7092c | |||
| ecdf52745f | |||
| 07e7ebf52d | |||
| 37589e6443 | |||
| ad37fb86d7 | |||
| 4f325589f9 | |||
| 707d4c7fb5 | |||
| c30d0ace65 | |||
| 0c188bc595 | |||
| 72e038acaf | |||
| 83e6a4a32b | |||
| 7182fbc471 | |||
| 0b4d87fad1 | |||
| 7034009f62 | |||
| 6c9574e490 | |||
| 37fcf089b4 | |||
| f4400a92f5 | |||
| a430ba9925 | |||
| 1833ec5334 | |||
| c9c977be27 | |||
| 3c9e1b89a1 | |||
| 2ff93effb3 | |||
| b1377b2d28 | |||
| e0064df4ff |
@@ -1,7 +1,144 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
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'
|
||||
- avcodec/webp: Fix signedness in prefix_code check
|
||||
- avcodec/svq3: Fix runtime error: signed integer overflow: 169 * 12717677 cannot be represented in type 'int'
|
||||
- avcodec/mlpdec: Check that there is enough data for headers
|
||||
- avcodec/ac3dec: Keep track of band structure
|
||||
- avcodec/webp: Add missing input padding
|
||||
- avcodec/aacdec_fixed: Fix runtime error: left shift of negative value -1
|
||||
- avcodec/aacsbr_template: Do not change bs_num_env before its checked
|
||||
- avcodec/scpr: Fix multiple runtime error: index 256 out of bounds for type 'unsigned int [256]'
|
||||
- avcodec/mlp: Fix multiple runtime error: left shift of negative value -1
|
||||
- avcodec/xpmdec: Fix multiple pointer/memory issues
|
||||
- avcodec/vp8dsp: vp7_luma_dc_wht_c: Fix multiple runtime error: signed integer overflow: -1366381240 + -1262413604 cannot be represented in type 'int'
|
||||
- avcodec/avcodec: Limit the number of side data elements per packet
|
||||
- avcodec/texturedsp: Fix runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
|
||||
- avcodec/g723_1dec: Fix runtime error: left shift of negative value -1
|
||||
- avcodec/wmv2dsp: Fix runtime error: signed integer overflow: 181 * -17047030 cannot be represented in type 'int'
|
||||
- avcodec/diracdec: Fix Assertion frame->buf[0] failed at libavcodec/decode.c:610
|
||||
- avcodec/msmpeg4dec: Check for cbpy VLC errors
|
||||
- avcodec/cllc: Check num_bits
|
||||
- avcodec/cllc: Factor VLC_BITS/DEPTH out, do not use repeated literal numbers
|
||||
- avcodec/scpr: Check y in first line loop in decompress_i()
|
||||
- avcodec/dvbsubdec: Check entry_id
|
||||
- avcodec/aacdec_fixed: Fix multiple shift exponent 33 is too large for 32-bit type 'int'
|
||||
- avcodec/mpeg12dec: Fixes runtime error: division by zero
|
||||
- avcodec/pixlet: Fix runtime error: signed integer overflow: 436207616 * -5160230545260541 cannot be represented in type 'long'
|
||||
- avcodec/webp: Always set pix_fmt
|
||||
- avfilter/vf_uspp: Fix currently unused input frame dimensions
|
||||
- avcodec/truemotion1: Fix multiple runtime error: left shift of negative value -1
|
||||
- avcodec/eatqi: Fix runtime error: signed integer overflow: 4466147 * 1075 cannot be represented in type 'int'
|
||||
- avcodec/dss_sp: Fix runtime error: signed integer overflow: 2147481189 + 4096 cannot be represented in type 'int'
|
||||
- avformat/wavdec: Check chunk_size
|
||||
- avcodec/cavs: Check updated MV
|
||||
- avcodec/y41pdec: Fix width in input buffer size check
|
||||
- avcodec/svq3: Fix multiple runtime error: signed integer overflow: -237341 * 24552 cannot be represented in type 'int'
|
||||
- avcodec/texturedsp: Fix runtime error: left shift of 218 by 24 places cannot be represented in type 'int'
|
||||
- avcodec/lagarith: Check scale_factor
|
||||
- avcodec/lagarith: Fix runtime error: left shift of negative value -1
|
||||
- avcodec/takdec: Fix multiple runtime error: left shift of negative value -1
|
||||
- avcodec/indeo2: Check for invalid VLCs
|
||||
- avcodec/g723_1dec: Fix several integer related cases of undefined behaviour
|
||||
- avcodec/htmlsubtitles: Check for string truncation and return error
|
||||
- avcodec/bmvvideo: Fix runtime error: left shift of 137 by 24 places cannot be represented in type 'int'
|
||||
- avcodec/dss_sp: Fix multiple runtime error: signed integer overflow: -15699 * -164039 cannot be represented in type 'int'
|
||||
- avcodec/dvbsubdec: check region dimensions
|
||||
- avcodec/vp8dsp: Fixes: runtime error: signed integer overflow: 1330143360 - -1023040530 cannot be represented in type 'int'
|
||||
- avcodec/hqxdsp: Fix multiple runtime error: signed integer overflow: 248220 * 21407 cannot be represented in type 'int' in idct_col()
|
||||
- avcodec/cavsdec: Check sym_factor
|
||||
- avcodec/cdxl: Check format for BGR24
|
||||
- avcodec/ffv1dec: Fix copying planes of paletted formats
|
||||
- avcodec/wmv2dsp: Fix runtime error: signed integer overflow: 181 * -12156865 cannot be represented in type 'int'
|
||||
- avcodec/xwddec: Check bpp more completely
|
||||
- avcodec/aacdec_template: Do not decode 2nd PCE if it will lead to failure
|
||||
- avcodec/s302m: Fix left shift of 8 by 28 places cannot be represented in type 'int'
|
||||
- avcodec/eamad: Fix runtime error: signed integer overflow: 49674 * 49858 cannot be represented in type 'int'
|
||||
- avcodec/g726: Fix runtime error: left shift of negative value -2
|
||||
- avcodec/magicyuv: Check len to be supported
|
||||
- avcodec/ra144: Fix runtime error: left shift of negative value -798
|
||||
- avcodec/mss34dsp: Fix multiple signed integer overflow
|
||||
- avcodec/targa_y216dec: Fix width type
|
||||
- avcodec/texturedsp: Fix multiple runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
|
||||
- avcodec/ivi_dsp: Fix multiple left shift of negative value -2
|
||||
- avcodec/svq3: Fix multiple runtime error: signed integer overflow: 44161 * 61694 cannot be represented in type 'int'
|
||||
- avcodec/msmpeg4dec: Correct table depth
|
||||
- avcodec/dds: Fix runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
|
||||
- avcodec/cdxl: Check format parameter
|
||||
- avutil/softfloat: Fix overflow in av_div_sf()
|
||||
- avcodec/hq_hqa: Fix runtime error: left shift of negative value -207
|
||||
- avcodec/mss3: Change types in rac_get_model_sym() to match the types they are initialized from
|
||||
- avcodec/shorten: Check k in get_uint()
|
||||
- avcodec/webp: Fix null pointer dereference
|
||||
- avcodec/dfa: Fix signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
|
||||
- avcodec/g723_1: Fix multiple runtime error: left shift of negative value
|
||||
- avcodec/mimic: Fix runtime error: left shift of negative value -1
|
||||
- avcodec/clearvideo: Fix multiple runtime error: left shift of negative value -1024
|
||||
- avcodec/fic: Fix multiple left shift of negative value -15
|
||||
- avcodec/mlpdec: Fix runtime error: left shift of negative value -22
|
||||
- avcodec/snowdec: Check qbias
|
||||
- avutil/softfloat: Fix multiple runtime error: left shift of negative value -8
|
||||
- avcodec/aacsbr_template: Do not leave bs_num_env invalid
|
||||
- avcodec/mdec: Fix signed integer overflow: 28835400 * 83 cannot be represented in type 'int'
|
||||
- avcodec/dfa: Fix off by 1 error
|
||||
- avcodec/nellymoser: Fix multiple left shift of negative value -8591
|
||||
- avcodec/cdxl: Fix signed integer overflow: 14243456 * 164 cannot be represented in type 'int'
|
||||
- avcodec/g722: Fix multiple runtime error: left shift of negative value -1
|
||||
- avcodec/dss_sp: Fix multiple left shift of negative value -466
|
||||
- avcodec/wnv1: Fix runtime error: left shift of negative value -1
|
||||
- avcodec/tiertexseqv: set the fixed dimenasions, do not depend on the demuxer doing so
|
||||
- avcodec/mjpegdec: Fix runtime error: signed integer overflow: -24543 * 2031616 cannot be represented in type 'int'
|
||||
- avcodec/cavsdec: Fix undefined behavior from integer overflow
|
||||
- avcodec/dvdsubdec: Fix runtime error: left shift of 242 by 24 places cannot be represented in type 'int'
|
||||
- libavcodec/mpeg4videodec: Convert sprite_offset to 64bit
|
||||
- avcodec/pngdec: Use ff_set_dimensions()
|
||||
- avcodec/msvideo1: Check buffer size before re-getting the frame
|
||||
- avcodec/h264_cavlc: Fix undefined behavior on qscale overflow
|
||||
- avcodec/dcadsp: Fix runtime error: signed integer overflow
|
||||
- avcodec/svq3: Reject dx/dy beyond 16bit
|
||||
- avcodec/svq3: Increase offsets to prevent integer overflows
|
||||
- avcodec/indeo2: Check remaining bits in ir2_decode_plane()
|
||||
- avcodec/vp3: Check remaining bits in unpack_dct_coeffs()
|
||||
- doc/developer: Add terse documentation of assumed C implementation defined behavior
|
||||
- avcodec/bmp: Use ff_set_dimensions()
|
||||
- avcodec/mdec: Fix runtime error: left shift of negative value -127
|
||||
- avcodec/x86/vc1dsp_init: Fix build failure with --disable-optimizations and clang
|
||||
- libavcodec/exr : fix float to uint16 conversion for negative float value
|
||||
- avformat/webmdashenc: Validate the 'streams' adaptation sets parameter
|
||||
- avformat/webmdashenc: Require the 'adaptation_sets' option to be set
|
||||
- lavfi/avfiltergraph: only return EOF in avfilter_graph_request_oldest if all sinks EOFed
|
||||
- ffmpeg: check for unconnected outputs
|
||||
- avformat/utils: free AVStream.codec properly in free_stream()
|
||||
- avcodec/options: do a more thorough clean up in avcodec_copy_context()
|
||||
- avcodec/options: factorize avcodec_copy_context() cleanup code
|
||||
- ffmpeg: count packets when queued
|
||||
- avformat/concatdec: fix the h264 annexb extradata check
|
||||
- avcodec/dnxhd_parser: fix parsing interlaced video, simplify code
|
||||
- ffmpeg; check return code of avcodec_send_frame when flushing encoders
|
||||
- avcodec/g723_1dec: Fix LCG type
|
||||
- avcodec/hqxdsp: Fix runtime error: signed integer overflow: -196264 * 11585 cannot be represented in type 'int'
|
||||
- avcodec/ac3dec: Fix: runtime error: index -1 out of bounds for type 'INTFLOAT [2]'
|
||||
- avcodec/mpeg4videodec: Clear sprite wraping on unsupported cases in VOP decode
|
||||
- avcodec/pixlet: Fixes: runtime error: signed integer overflow: 9203954323419769657 + 29897660706736950 cannot be represented in type 'long'
|
||||
- avcodec/dds: Fix runtime error: left shift of 210 by 24 places cannot be represented in type 'int'
|
||||
- avcodec/rscc: Check pixel_size for overflow
|
||||
- avcodec/fmvc: Check nb_blocks
|
||||
- avcodec/cllc: Check prefix
|
||||
- avcodec/webp: Factor update_canvas_size() out
|
||||
- avcodec/webp: Update canvas size in vp8_lossy_decode_frame() as in vp8_lossless_decode_frame()
|
||||
- avcodec/snowdec: Check width
|
||||
- avcodec/flacdec: Return error code instead of 0 for failures
|
||||
- avcodec/opus_silk: Fix integer overflow and out of array read
|
||||
- avcodec/aacps: Fix undefined behavior
|
||||
- avcodec/pixlet: Fix shift exponent 4294967268 is too large for 32-bit type 'int'
|
||||
- doc/general: fix project name after 2b1a6b1ae
|
||||
|
||||
|
||||
version 3.3:
|
||||
- CrystalHD decoder moved to new decode API
|
||||
- add internal ebur128 library, remove external libebur128 dependency
|
||||
- Pro-MPEG CoP #3-R2 FEC protocol
|
||||
@@ -22,6 +159,7 @@ version <next>:
|
||||
- threshold filter
|
||||
- midequalizer filter
|
||||
- Optimal Huffman tables for (M)JPEG encoding
|
||||
- VAAPI-accelerated MPEG-2 and VP8 encoding
|
||||
- FM Screen Capture Codec decoder
|
||||
- native Opus encoder
|
||||
- ScreenPressor decoder
|
||||
@@ -32,6 +170,7 @@ version <next>:
|
||||
- Removed the legacy X11 screen grabber, use XCB instead
|
||||
- MPEG-7 Video Signature filter
|
||||
- Removed asyncts filter (use af_aresample instead)
|
||||
- Intel QSV-accelerated VP8 video decoding
|
||||
|
||||
|
||||
version 3.2:
|
||||
@@ -119,7 +258,6 @@ version 3.1:
|
||||
- libutvideo wrapper removed
|
||||
- YUY2 Lossless Codec decoder
|
||||
- VideoToolbox H.264 encoder
|
||||
- VAAPI-accelerated MPEG-2 and VP8 encoding
|
||||
|
||||
|
||||
version 3.0:
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
┌────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 3.3 "Hilbert" │
|
||||
└────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 3.3 "Hilbert", about 5
|
||||
months after the release of FFmpeg 3.2.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on http://source.ffmpeg.org.
|
||||
|
||||
We hope you will like this release as much as we enjoyed working on it, and
|
||||
as usual, if you have any questions about it, or any FFmpeg related topic,
|
||||
feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
|
||||
on the mailing-lists.
|
||||
@@ -1513,6 +1513,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
|
||||
"
|
||||
|
||||
EXTERNAL_LIBRARY_NONFREE_LIST="
|
||||
decklink
|
||||
libfdk_aac
|
||||
openssl
|
||||
"
|
||||
@@ -1536,7 +1537,6 @@ EXTERNAL_LIBRARY_LIST="
|
||||
$EXTERNAL_LIBRARY_GPLV3_LIST
|
||||
chromaprint
|
||||
crystalhd
|
||||
decklink
|
||||
gcrypt
|
||||
gnutls
|
||||
jni
|
||||
|
||||
+11
-11
@@ -15,11 +15,11 @@ libavutil: 2015-08-28
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2017-03-31 - xxxxxxx - lavu 55.57.100 - spherical.h
|
||||
2017-03-31 - 9033e8723c - lavu 55.57.100 - spherical.h
|
||||
Add av_spherical_projection_name().
|
||||
Add av_spherical_from_name().
|
||||
|
||||
2017-03-30 - xxxxxxx - lavu 55.53.100 / 55.27.0 - hwcontext.h
|
||||
2017-03-30 - 4cda23f1f1 - lavu 55.53.100 / 55.27.0 - hwcontext.h
|
||||
Add av_hwframe_map() and associated AV_HWFRAME_MAP_* flags.
|
||||
Add av_hwframe_ctx_create_derived().
|
||||
|
||||
@@ -44,7 +44,7 @@ API changes, most recent first:
|
||||
Add AVCodecContext.hwaccel_flags field. This will control some hwaccels at
|
||||
a later point.
|
||||
|
||||
2017-03-21 - xxxxxxx - lavf 57.67.100 / 57.08.0 - avio.h
|
||||
2017-03-21 - fc9f14c7de - lavf 57.67.100 / 57.08.0 - avio.h
|
||||
Add AVIO_SEEKABLE_TIME flag.
|
||||
|
||||
2017-03-21 - d682ae70b4 - lavf 57.66.105, lavc 57.83.101 - avformat.h, avcodec.h
|
||||
@@ -52,7 +52,7 @@ API changes, most recent first:
|
||||
bump, and libavformat will behave as if it were always set.
|
||||
Deprecate av_packet_merge_side_data() and av_packet_split_side_data().
|
||||
|
||||
2016-03-20 - xxxxxxx - lavu 55.50.100 / 55.21.0 - imgutils.h
|
||||
2016-03-20 - 8200b16a9c - lavu 55.50.100 / 55.21.0 - imgutils.h
|
||||
Add av_image_copy_uc_from(), a version of av_image_copy() for copying
|
||||
from GPU mapped memory.
|
||||
|
||||
@@ -63,7 +63,7 @@ API changes, most recent first:
|
||||
Deprecate AVFilterGraph.resample_lavr_opts
|
||||
It's never been used by avfilter nor passed to anything.
|
||||
|
||||
2017-02-10 - xxxxxxx - lavu 55.48.100 / 55.33.0 - spherical.h
|
||||
2017-02-10 - 1b7ffddb3a - lavu 55.48.100 / 55.33.0 - spherical.h
|
||||
Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, av_spherical_tile_bounds(),
|
||||
and projection-specific properties (bound_left, bound_top, bound_right,
|
||||
bound_bottom, padding) to AVSphericalMapping.
|
||||
@@ -83,7 +83,7 @@ API changes, most recent first:
|
||||
2017-02-11 - e3af49b14b - lavu 55.47.100 - frame.h
|
||||
Add AVFrame.opaque_ref.
|
||||
|
||||
2017-01-31 - xxxxxxx - lavu 55.46.100 / 55.20.0 - cpu.h
|
||||
2017-01-31 - 2eab48177d - lavu 55.46.100 / 55.20.0 - cpu.h
|
||||
Add AV_CPU_FLAG_SSSE3SLOW.
|
||||
|
||||
2017-01-24 - c4618f842a - lavu 55.45.100 - channel_layout.h
|
||||
@@ -96,20 +96,20 @@ API changes, most recent first:
|
||||
Deprecate struct vaapi_context and the vaapi.h installed header.
|
||||
Callers should set AVCodecContext.hw_frames_ctx instead.
|
||||
|
||||
2017-01-12 - dbe9dbed31 - lavfi 6.69.100- buffersink.h
|
||||
2017-01-12 - dbe9dbed31 - lavfi 6.69.100 - buffersink.h
|
||||
Add av_buffersink_get_*() functions.
|
||||
|
||||
2017-01-06 - 9488032e10 - lavf 57.62.100- avio.h
|
||||
2017-01-06 - 9488032e10 - lavf 57.62.100 - avio.h
|
||||
Add avio_get_dyn_buf()
|
||||
|
||||
2016-12-10 - xxxxxxx - lavu xx.xx.100- imgutils.h
|
||||
2016-12-10 - f542b152aa - lavu 55.43.100 - imgutils.h
|
||||
Add av_image_check_size2()
|
||||
|
||||
2016-xx-xx - xxxxxxx - lavc 57.67.100 / 57.29.0 - avcodec.h
|
||||
2016-12-07 - e7a6f8c972 - lavc 57.67.100 / 57.29.0 - avcodec.h
|
||||
Add AV_PKT_DATA_SPHERICAL packet side data to export AVSphericalMapping
|
||||
information from containers.
|
||||
|
||||
2016-xx-xx - xxxxxxx - lavu 55.42.100 / 55.30.0 - spherical.h
|
||||
2016-12-07 - 8f58ecc344 - lavu 55.42.100 / 55.30.0 - spherical.h
|
||||
Add AV_FRAME_DATA_SPHERICAL value, av_spherical_alloc() API and
|
||||
AVSphericalMapping type to export and describe spherical video properties.
|
||||
|
||||
|
||||
+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 =
|
||||
PROJECT_NUMBER = 3.3.1
|
||||
|
||||
# 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
|
||||
|
||||
@@ -131,6 +131,11 @@ designated struct initializers (@samp{struct s x = @{ .i = 17 @};});
|
||||
|
||||
@item
|
||||
compound literals (@samp{x = (struct s) @{ 17, 23 @};}).
|
||||
|
||||
@item
|
||||
Implementation defined behavior for signed integers is assumed to match the
|
||||
expected behavior for two's complement. Non representable values in integer
|
||||
casts are binary truncated. Shift right of signed values uses sign extension.
|
||||
@end itemize
|
||||
|
||||
These features are supported by all compilers we care about, so we will not
|
||||
|
||||
@@ -64,7 +64,7 @@ static int decode_write_frame(const char *outfilename, AVCodecContext *avctx,
|
||||
fflush(stdout);
|
||||
|
||||
/* the picture is allocated by the decoder, no need to free it */
|
||||
snprintf(buf, sizeof(buf), outfilename, *frame_count);
|
||||
snprintf(buf, sizeof(buf), "%s-%d", outfilename, *frame_count);
|
||||
pgm_save(frame->data[0], frame->linesize[0],
|
||||
frame->width, frame->height, buf);
|
||||
(*frame_count)++;
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ For Linux and OS X, the supported AviSynth variant is
|
||||
|
||||
@float NOTE
|
||||
There is currently a regression in AviSynth+'s @code{capi.h} header as of
|
||||
October 2016, which interferes with the ability for builds of Libav to use
|
||||
October 2016, which interferes with the ability for builds of FFmpeg to use
|
||||
MSVC-built binaries of AviSynth. Until this is resolved, you can make sure
|
||||
a known good version is installed by checking out a version from before
|
||||
the regression occurred:
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if HAVE_IO_H
|
||||
@@ -319,7 +320,7 @@ void term_exit(void)
|
||||
|
||||
static volatile int received_sigterm = 0;
|
||||
static volatile int received_nb_signals = 0;
|
||||
static volatile int transcode_init_done = 0;
|
||||
static atomic_int transcode_init_done = ATOMIC_VAR_INIT(0);
|
||||
static volatile int ffmpeg_exited = 0;
|
||||
static int main_return_code = 0;
|
||||
|
||||
@@ -457,7 +458,7 @@ static int read_key(void)
|
||||
|
||||
static int decode_interrupt_cb(void *ctx)
|
||||
{
|
||||
return received_nb_signals > transcode_init_done;
|
||||
return received_nb_signals > atomic_load(&transcode_init_done);
|
||||
}
|
||||
|
||||
const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
|
||||
@@ -612,7 +613,7 @@ static void ffmpeg_cleanup(int ret)
|
||||
if (received_sigterm) {
|
||||
av_log(NULL, AV_LOG_INFO, "Exiting normally, received signal %d.\n",
|
||||
(int) received_sigterm);
|
||||
} else if (ret && transcode_init_done) {
|
||||
} else if (ret && atomic_load(&transcode_init_done)) {
|
||||
av_log(NULL, AV_LOG_INFO, "Conversion failed!\n");
|
||||
}
|
||||
term_exit();
|
||||
@@ -668,12 +669,28 @@ static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream,
|
||||
}
|
||||
}
|
||||
|
||||
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
|
||||
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
|
||||
{
|
||||
AVFormatContext *s = of->ctx;
|
||||
AVStream *st = ost->st;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Audio encoders may split the packets -- #frames in != #packets out.
|
||||
* But there is no reordering, so we can limit the number of output packets
|
||||
* by simply dropping them here.
|
||||
* Counting encoded video frames needs to be done separately because of
|
||||
* reordering, see do_video_out().
|
||||
* Do not count the packet when unqueued because it has been counted when queued.
|
||||
*/
|
||||
if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed) && !unqueue) {
|
||||
if (ost->frame_number >= ost->max_frames) {
|
||||
av_packet_unref(pkt);
|
||||
return;
|
||||
}
|
||||
ost->frame_number++;
|
||||
}
|
||||
|
||||
if (!of->header_written) {
|
||||
AVPacket tmp_pkt = {0};
|
||||
/* the muxer is not initialized yet, buffer the packet */
|
||||
@@ -702,20 +719,6 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
|
||||
(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))
|
||||
pkt->pts = pkt->dts = AV_NOPTS_VALUE;
|
||||
|
||||
/*
|
||||
* Audio encoders may split the packets -- #frames in != #packets out.
|
||||
* But there is no reordering, so we can limit the number of output packets
|
||||
* by simply dropping them here.
|
||||
* Counting encoded video frames needs to be done separately because of
|
||||
* reordering, see do_video_out()
|
||||
*/
|
||||
if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed)) {
|
||||
if (ost->frame_number >= ost->max_frames) {
|
||||
av_packet_unref(pkt);
|
||||
return;
|
||||
}
|
||||
ost->frame_number++;
|
||||
}
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
int i;
|
||||
uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS,
|
||||
@@ -860,10 +863,10 @@ static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
|
||||
goto finish;
|
||||
idx++;
|
||||
} else
|
||||
write_packet(of, pkt, ost);
|
||||
write_packet(of, pkt, ost, 0);
|
||||
}
|
||||
} else
|
||||
write_packet(of, pkt, ost);
|
||||
write_packet(of, pkt, ost, 0);
|
||||
|
||||
finish:
|
||||
if (ret < 0 && ret != AVERROR_EOF) {
|
||||
@@ -1903,8 +1906,6 @@ static void flush_encoders(void)
|
||||
if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO)
|
||||
continue;
|
||||
|
||||
avcodec_send_frame(enc, NULL);
|
||||
|
||||
for (;;) {
|
||||
const char *desc = NULL;
|
||||
AVPacket pkt;
|
||||
@@ -1926,7 +1927,17 @@ static void flush_encoders(void)
|
||||
pkt.size = 0;
|
||||
|
||||
update_benchmark(NULL);
|
||||
ret = avcodec_receive_packet(enc, &pkt);
|
||||
|
||||
while ((ret = avcodec_receive_packet(enc, &pkt)) == AVERROR(EAGAIN)) {
|
||||
ret = avcodec_send_frame(enc, NULL);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
|
||||
desc,
|
||||
av_err2str(ret));
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
|
||||
update_benchmark("flush_%s %d.%d", desc, ost->file_index, ost->index);
|
||||
if (ret < 0 && ret != AVERROR_EOF) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
|
||||
@@ -2962,7 +2973,7 @@ static int check_init_output_file(OutputFile *of, int file_index)
|
||||
while (av_fifo_size(ost->muxing_queue)) {
|
||||
AVPacket pkt;
|
||||
av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL);
|
||||
write_packet(of, &pkt, ost);
|
||||
write_packet(of, &pkt, ost, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3758,7 +3769,7 @@ static int transcode_init(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
transcode_init_done = 1;
|
||||
atomic_store(&transcode_init_done, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -638,6 +638,7 @@ void choose_sample_fmt(AVStream *st, AVCodec *codec);
|
||||
|
||||
int configure_filtergraph(FilterGraph *fg);
|
||||
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out);
|
||||
void check_filter_outputs(void);
|
||||
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist);
|
||||
int filtergraph_is_simple(FilterGraph *fg);
|
||||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost);
|
||||
|
||||
@@ -678,6 +678,21 @@ int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOu
|
||||
}
|
||||
}
|
||||
|
||||
void check_filter_outputs(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nb_filtergraphs; i++) {
|
||||
int n;
|
||||
for (n = 0; n < filtergraphs[i]->nb_outputs; n++) {
|
||||
OutputFilter *output = filtergraphs[i]->outputs[n];
|
||||
if (!output->ost) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name);
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
|
||||
{
|
||||
AVFormatContext *avf = input_files[ist->file_index]->ctx;
|
||||
|
||||
@@ -3260,6 +3260,8 @@ int ffmpeg_parse_options(int argc, char **argv)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
check_filter_outputs();
|
||||
|
||||
fail:
|
||||
uninit_parse_context(&octx);
|
||||
if (ret < 0) {
|
||||
|
||||
@@ -3442,8 +3442,6 @@ int main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
av_log_set_callback(log_callback);
|
||||
|
||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||
register_exit(ffprobe_cleanup);
|
||||
|
||||
@@ -3459,6 +3457,9 @@ int main(int argc, char **argv)
|
||||
show_banner(argc, argv, options);
|
||||
parse_options(NULL, argc, argv, options, opt_input_file);
|
||||
|
||||
if (do_show_log)
|
||||
av_log_set_callback(log_callback);
|
||||
|
||||
/* mark things to show, based on -show_entries */
|
||||
SET_DO_SHOW(CHAPTERS, chapters);
|
||||
SET_DO_SHOW(ERROR, error);
|
||||
|
||||
+2
-1
@@ -973,7 +973,8 @@ OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o aacadtsdec.o \
|
||||
OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o
|
||||
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
|
||||
OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o
|
||||
OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o
|
||||
OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o \
|
||||
h2645_parse.o
|
||||
OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
|
||||
OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF) += hevc_mp4toannexb_bsf.o
|
||||
OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o
|
||||
|
||||
@@ -49,14 +49,14 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (bsfc->par_in->extradata && in->size >= 2 && (AV_RB16(in->data) >> 4) != 0xfff)
|
||||
goto finish;
|
||||
|
||||
if (in->size < AAC_ADTS_HEADER_SIZE)
|
||||
goto packet_too_small;
|
||||
|
||||
init_get_bits(&gb, in->data, AAC_ADTS_HEADER_SIZE * 8);
|
||||
|
||||
if (bsfc->par_in->extradata && show_bits(&gb, 12) != 0xfff)
|
||||
goto finish;
|
||||
|
||||
if (avpriv_aac_parse_header(&gb, &hdr) < 0) {
|
||||
av_log(bsfc, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -125,7 +125,7 @@ static inline int *DEC_SQUAD(int *dst, unsigned idx)
|
||||
static inline int *DEC_UPAIR(int *dst, unsigned idx, unsigned sign)
|
||||
{
|
||||
dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE));
|
||||
dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) << 1));
|
||||
dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) * 2));
|
||||
|
||||
return dst + 2;
|
||||
}
|
||||
@@ -134,16 +134,16 @@ static inline int *DEC_UQUAD(int *dst, unsigned idx, unsigned sign)
|
||||
{
|
||||
unsigned nz = idx >> 12;
|
||||
|
||||
dst[0] = (idx & 3) * (1 + (((int)sign >> 31) << 1));
|
||||
dst[0] = (idx & 3) * (1 + (((int)sign >> 31) * 2));
|
||||
sign <<= nz & 1;
|
||||
nz >>= 1;
|
||||
dst[1] = (idx >> 2 & 3) * (1 + (((int)sign >> 31) << 1));
|
||||
dst[1] = (idx >> 2 & 3) * (1 + (((int)sign >> 31) * 2));
|
||||
sign <<= nz & 1;
|
||||
nz >>= 1;
|
||||
dst[2] = (idx >> 4 & 3) * (1 + (((int)sign >> 31) << 1));
|
||||
dst[2] = (idx >> 4 & 3) * (1 + (((int)sign >> 31) * 2));
|
||||
sign <<= nz & 1;
|
||||
nz >>= 1;
|
||||
dst[3] = (idx >> 6 & 3) * (1 + (((int)sign >> 31) << 1));
|
||||
dst[3] = (idx >> 6 & 3) * (1 + (((int)sign >> 31) * 2));
|
||||
|
||||
return dst + 4;
|
||||
}
|
||||
@@ -171,7 +171,11 @@ static void subband_scale(int *dst, int *src, int scale, int offset, int len)
|
||||
|
||||
s = offset - (s >> 2);
|
||||
|
||||
if (s > 0) {
|
||||
if (s > 31) {
|
||||
for (i=0; i<len; i++) {
|
||||
dst[i] = 0;
|
||||
}
|
||||
} else if (s > 0) {
|
||||
round = 1 << (s-1);
|
||||
for (i=0; i<len; i++) {
|
||||
out = (int)(((int64_t)src[i] * c) >> 32);
|
||||
|
||||
@@ -406,11 +406,15 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
/**
|
||||
* Save current output configuration if and only if it has been locked.
|
||||
*/
|
||||
static void push_output_configuration(AACContext *ac) {
|
||||
static int push_output_configuration(AACContext *ac) {
|
||||
int pushed = 0;
|
||||
|
||||
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
|
||||
ac->oc[0] = ac->oc[1];
|
||||
pushed = 1;
|
||||
}
|
||||
ac->oc[1].status = OC_NONE;
|
||||
return pushed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3026,7 +3030,13 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
case TYPE_PCE: {
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3];
|
||||
int tags;
|
||||
push_output_configuration(ac);
|
||||
|
||||
int pushed = push_output_configuration(ac);
|
||||
if (pce_found && !pushed) {
|
||||
err = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb,
|
||||
payload_alignment);
|
||||
if (tags < 0) {
|
||||
|
||||
@@ -74,8 +74,8 @@ void ff_aac_ltp_insert_new_frame(AACEncContext *s)
|
||||
|
||||
static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
|
||||
{
|
||||
int i, j, lag, max_corr = 0;
|
||||
float max_ratio;
|
||||
int i, j, lag = 0, max_corr = 0;
|
||||
float max_ratio = 0.0f;
|
||||
for (i = 0; i < 2048; i++) {
|
||||
float corr, s0 = 0.0f, s1 = 0.0f;
|
||||
const int start = FFMAX(0, i - 1024);
|
||||
|
||||
+1
-1
@@ -975,7 +975,7 @@ static void stereo_processing(PSContext *ps, INTFLOAT (*l)[32][2], INTFLOAT (*r)
|
||||
h_step[1][3] = AAC_MSUB31_V3(H22[1][e+1][b], h[1][3], width);
|
||||
}
|
||||
ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd](
|
||||
l[k] + start + 1, r[k] + start + 1,
|
||||
l[k] + 1 + start, r[k] + 1 + start,
|
||||
h, h_step, stop - start);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,24 +624,26 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
|
||||
int abs_bord_trail = 16;
|
||||
int num_rel_lead, num_rel_trail;
|
||||
unsigned bs_num_env_old = ch_data->bs_num_env;
|
||||
int bs_frame_class, bs_num_env;
|
||||
|
||||
ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env];
|
||||
ch_data->bs_amp_res = sbr->bs_amp_res_header;
|
||||
ch_data->t_env_num_env_old = ch_data->t_env[bs_num_env_old];
|
||||
|
||||
switch (ch_data->bs_frame_class = get_bits(gb, 2)) {
|
||||
switch (bs_frame_class = get_bits(gb, 2)) {
|
||||
case FIXFIX:
|
||||
ch_data->bs_num_env = 1 << get_bits(gb, 2);
|
||||
bs_num_env = 1 << get_bits(gb, 2);
|
||||
if (bs_num_env > 4) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
|
||||
bs_num_env);
|
||||
return -1;
|
||||
}
|
||||
ch_data->bs_num_env = bs_num_env;
|
||||
num_rel_lead = ch_data->bs_num_env - 1;
|
||||
if (ch_data->bs_num_env == 1)
|
||||
ch_data->bs_amp_res = 0;
|
||||
|
||||
if (ch_data->bs_num_env > 4) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
|
||||
ch_data->bs_num_env);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ch_data->t_env[0] = 0;
|
||||
ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail;
|
||||
@@ -689,14 +691,15 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
|
||||
abs_bord_trail += get_bits(gb, 2);
|
||||
num_rel_lead = get_bits(gb, 2);
|
||||
num_rel_trail = get_bits(gb, 2);
|
||||
ch_data->bs_num_env = num_rel_lead + num_rel_trail + 1;
|
||||
bs_num_env = num_rel_lead + num_rel_trail + 1;
|
||||
|
||||
if (ch_data->bs_num_env > 5) {
|
||||
if (bs_num_env > 5) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
|
||||
ch_data->bs_num_env);
|
||||
bs_num_env);
|
||||
return -1;
|
||||
}
|
||||
ch_data->bs_num_env = bs_num_env;
|
||||
|
||||
ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail;
|
||||
|
||||
@@ -711,6 +714,7 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
|
||||
get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env);
|
||||
break;
|
||||
}
|
||||
ch_data->bs_frame_class = bs_frame_class;
|
||||
|
||||
av_assert0(bs_pointer >= 0);
|
||||
if (bs_pointer > ch_data->bs_num_env + 1) {
|
||||
|
||||
@@ -61,37 +61,37 @@ endconst
|
||||
br x10
|
||||
.endm
|
||||
|
||||
.macro smull1 a b c
|
||||
.macro smull1 a, b, c
|
||||
smull \a, \b, \c
|
||||
.endm
|
||||
|
||||
.macro smlal1 a b c
|
||||
.macro smlal1 a, b, c
|
||||
smlal \a, \b, \c
|
||||
.endm
|
||||
|
||||
.macro smlsl1 a b c
|
||||
.macro smlsl1 a, b, c
|
||||
smlsl \a, \b, \c
|
||||
.endm
|
||||
|
||||
.macro idct_col4_top y1 y2 y3 y4 i l
|
||||
smull\i v7.4S, \y3\().\l, z2
|
||||
smull\i v16.4S, \y3\().\l, z6
|
||||
smull\i v17.4S, \y2\().\l, z1
|
||||
.macro idct_col4_top y1, y2, y3, y4, i, l
|
||||
smull\i v7.4S, \y3\l, z1
|
||||
smull\i v16.4S, \y3\l, z6
|
||||
smull\i v17.4S, \y2\l, z1
|
||||
add v19.4S, v23.4S, v7.4S
|
||||
smull\i v18.4S, \y2\().\l, z3
|
||||
smull\i v18.4S, \y2\l, z3
|
||||
add v20.4S, v23.4S, v16.4S
|
||||
smull\i v5.4S, \y2\().\l, z5
|
||||
smull\i v5.4S, \y2\l, z5
|
||||
sub v21.4S, v23.4S, v16.4S
|
||||
smull\i v6.4S, \y2\().\l, z7
|
||||
smull\i v6.4S, \y2\l, z7
|
||||
sub v22.4S, v23.4S, v7.4S
|
||||
|
||||
smlal\i v17.4S, \y4\().\l, z3
|
||||
smlsl\i v18.4S, \y4\().\l, z7
|
||||
smlsl\i v5.4S, \y4\().\l, z1
|
||||
smlsl\i v6.4S, \y4\().\l, z5
|
||||
smlal\i v17.4S, \y4\l, z3
|
||||
smlsl\i v18.4S, \y4\l, z7
|
||||
smlsl\i v5.4S, \y4\l, z1
|
||||
smlsl\i v6.4S, \y4\l, z5
|
||||
.endm
|
||||
|
||||
.macro idct_row4_neon y1 y2 y3 y4 pass
|
||||
.macro idct_row4_neon y1, y2, y3, y4, pass
|
||||
ld1 {\y1\().2D-\y2\().2D}, [x2], #32
|
||||
movi v23.4S, #1<<2, lsl #8
|
||||
orr v5.16B, \y1\().16B, \y2\().16B
|
||||
@@ -101,7 +101,7 @@ endconst
|
||||
mov x3, v5.D[1]
|
||||
smlal v23.4S, \y1\().4H, z4
|
||||
|
||||
idct_col4_top \y1 \y2 \y3 \y4 1 4H
|
||||
idct_col4_top \y1, \y2, \y3, \y4, 1, .4H
|
||||
|
||||
cmp x3, #0
|
||||
beq \pass\()f
|
||||
@@ -153,7 +153,7 @@ endconst
|
||||
trn2 \y4\().4S, v17.4S, v19.4S
|
||||
.endm
|
||||
|
||||
.macro declare_idct_col4_neon i l
|
||||
.macro declare_idct_col4_neon i, l
|
||||
function idct_col4_neon\i
|
||||
dup v23.4H, z4c
|
||||
.if \i == 1
|
||||
@@ -164,14 +164,14 @@ function idct_col4_neon\i
|
||||
.endif
|
||||
smull v23.4S, v23.4H, z4
|
||||
|
||||
idct_col4_top v24 v25 v26 v27 \i \l
|
||||
idct_col4_top v24, v25, v26, v27, \i, \l
|
||||
|
||||
mov x4, v28.D[\i - 1]
|
||||
mov x5, v29.D[\i - 1]
|
||||
cmp x4, #0
|
||||
beq 1f
|
||||
|
||||
smull\i v7.4S, v28.\l, z4
|
||||
smull\i v7.4S, v28\l, z4
|
||||
add v19.4S, v19.4S, v7.4S
|
||||
sub v20.4S, v20.4S, v7.4S
|
||||
sub v21.4S, v21.4S, v7.4S
|
||||
@@ -181,17 +181,17 @@ function idct_col4_neon\i
|
||||
cmp x5, #0
|
||||
beq 2f
|
||||
|
||||
smlal\i v17.4S, v29.\l, z5
|
||||
smlsl\i v18.4S, v29.\l, z1
|
||||
smlal\i v5.4S, v29.\l, z7
|
||||
smlal\i v6.4S, v29.\l, z3
|
||||
smlal\i v17.4S, v29\l, z5
|
||||
smlsl\i v18.4S, v29\l, z1
|
||||
smlal\i v5.4S, v29\l, z7
|
||||
smlal\i v6.4S, v29\l, z3
|
||||
|
||||
2: mov x5, v31.D[\i - 1]
|
||||
cmp x4, #0
|
||||
beq 3f
|
||||
|
||||
smull\i v7.4S, v30.\l, z6
|
||||
smull\i v16.4S, v30.\l, z2
|
||||
smull\i v7.4S, v30\l, z6
|
||||
smull\i v16.4S, v30\l, z2
|
||||
add v19.4S, v19.4S, v7.4S
|
||||
sub v22.4S, v22.4S, v7.4S
|
||||
sub v20.4S, v20.4S, v16.4S
|
||||
@@ -200,10 +200,10 @@ function idct_col4_neon\i
|
||||
3: cmp x5, #0
|
||||
beq 4f
|
||||
|
||||
smlal\i v17.4S, v31.\l, z7
|
||||
smlsl\i v18.4S, v31.\l, z5
|
||||
smlal\i v5.4S, v31.\l, z3
|
||||
smlsl\i v6.4S, v31.\l, z1
|
||||
smlal\i v17.4S, v31\l, z7
|
||||
smlsl\i v18.4S, v31\l, z5
|
||||
smlal\i v5.4S, v31\l, z3
|
||||
smlsl\i v6.4S, v31\l, z1
|
||||
|
||||
4: addhn v7.4H, v19.4S, v17.4S
|
||||
addhn2 v7.8H, v20.4S, v18.4S
|
||||
@@ -219,14 +219,14 @@ function idct_col4_neon\i
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
declare_idct_col4_neon 1 4H
|
||||
declare_idct_col4_neon 2 8H
|
||||
declare_idct_col4_neon 1, .4H
|
||||
declare_idct_col4_neon 2, .8H
|
||||
|
||||
function ff_simple_idct_put_neon, export=1
|
||||
idct_start x2
|
||||
|
||||
idct_row4_neon v24 v25 v26 v27 1
|
||||
idct_row4_neon v28 v29 v30 v31 2
|
||||
idct_row4_neon v24, v25, v26, v27, 1
|
||||
idct_row4_neon v28, v29, v30, v31, 2
|
||||
bl idct_col4_neon1
|
||||
|
||||
sqshrun v1.8B, v7.8H, #COL_SHIFT-16
|
||||
@@ -263,8 +263,8 @@ endfunc
|
||||
function ff_simple_idct_add_neon, export=1
|
||||
idct_start x2
|
||||
|
||||
idct_row4_neon v24 v25 v26 v27 1
|
||||
idct_row4_neon v28 v29 v30 v31 2
|
||||
idct_row4_neon v24, v25, v26, v27, 1
|
||||
idct_row4_neon v28, v29, v30, v31, 2
|
||||
bl idct_col4_neon1
|
||||
|
||||
sshr v1.8H, V7.8H, #COL_SHIFT-16
|
||||
@@ -328,8 +328,8 @@ function ff_simple_idct_neon, export=1
|
||||
idct_start x0
|
||||
|
||||
mov x2, x0
|
||||
idct_row4_neon v24 v25 v26 v27 1
|
||||
idct_row4_neon v28 v29 v30 v31 2
|
||||
idct_row4_neon v24, v25, v26, v27, 1
|
||||
idct_row4_neon v28, v29, v30, v31, 2
|
||||
add x2, x2, #-128
|
||||
bl idct_col4_neon1
|
||||
|
||||
|
||||
+16
-13
@@ -761,30 +761,31 @@ static void ac3_upmix_delay(AC3DecodeContext *s)
|
||||
* @param[in] default_band_struct default band structure table
|
||||
* @param[out] num_bands number of bands (optionally NULL)
|
||||
* @param[out] band_sizes array containing the number of bins in each band (optionally NULL)
|
||||
* @param[in,out] band_struct current band structure
|
||||
*/
|
||||
static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
|
||||
int ecpl, int start_subband, int end_subband,
|
||||
const uint8_t *default_band_struct,
|
||||
int *num_bands, uint8_t *band_sizes)
|
||||
int *num_bands, uint8_t *band_sizes,
|
||||
uint8_t *band_struct, int band_struct_size)
|
||||
{
|
||||
int subbnd, bnd, n_subbands, n_bands=0;
|
||||
uint8_t bnd_sz[22];
|
||||
uint8_t coded_band_struct[22];
|
||||
const uint8_t *band_struct;
|
||||
|
||||
n_subbands = end_subband - start_subband;
|
||||
|
||||
if (!blk)
|
||||
memcpy(band_struct, default_band_struct, band_struct_size);
|
||||
|
||||
av_assert0(band_struct_size >= start_subband + n_subbands);
|
||||
|
||||
band_struct += start_subband + 1;
|
||||
|
||||
/* decode band structure from bitstream or use default */
|
||||
if (!eac3 || get_bits1(gbc)) {
|
||||
for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
|
||||
coded_band_struct[subbnd] = get_bits1(gbc);
|
||||
band_struct[subbnd] = get_bits1(gbc);
|
||||
}
|
||||
band_struct = coded_band_struct;
|
||||
} else if (!blk) {
|
||||
band_struct = &default_band_struct[start_subband+1];
|
||||
} else {
|
||||
/* no change in band structure */
|
||||
return;
|
||||
}
|
||||
|
||||
/* calculate number of bands and band sizes based on band structure.
|
||||
@@ -863,7 +864,8 @@ static inline int spx_strategy(AC3DecodeContext *s, int blk)
|
||||
start_subband, end_subband,
|
||||
ff_eac3_default_spx_band_struct,
|
||||
&s->num_spx_bands,
|
||||
s->spx_band_sizes);
|
||||
s->spx_band_sizes,
|
||||
s->spx_band_struct, sizeof(s->spx_band_struct));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1000,7 +1002,8 @@ static inline int coupling_strategy(AC3DecodeContext *s, int blk,
|
||||
decode_band_structure(bc, blk, s->eac3, 0, cpl_start_subband,
|
||||
cpl_end_subband,
|
||||
ff_eac3_default_cpl_band_struct,
|
||||
&s->num_cpl_bands, s->cpl_band_sizes);
|
||||
&s->num_cpl_bands, s->cpl_band_sizes,
|
||||
s->cpl_band_struct, sizeof(s->cpl_band_struct));
|
||||
} else {
|
||||
/* coupling not in use */
|
||||
for (ch = 1; ch <= fbw_channels; ch++) {
|
||||
@@ -1386,7 +1389,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
for (ch = 1; ch <= s->channels; ch++) {
|
||||
int audio_channel = 0;
|
||||
INTFLOAT gain;
|
||||
if (s->channel_mode == AC3_CHMODE_DUALMONO)
|
||||
if (s->channel_mode == AC3_CHMODE_DUALMONO && ch <= 2)
|
||||
audio_channel = 2-ch;
|
||||
if (s->heavy_compression && s->compression_exists[audio_channel])
|
||||
gain = s->heavy_dynamic_range[audio_channel];
|
||||
|
||||
@@ -128,6 +128,7 @@ typedef struct AC3DecodeContext {
|
||||
int phase_flags_in_use; ///< phase flags in use (phsflginu)
|
||||
int phase_flags[AC3_MAX_CPL_BANDS]; ///< phase flags (phsflg)
|
||||
int num_cpl_bands; ///< number of coupling bands (ncplbnd)
|
||||
uint8_t cpl_band_struct[AC3_MAX_CPL_BANDS];
|
||||
uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band
|
||||
int firstchincpl; ///< first channel in coupling
|
||||
int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states (firstcplcos)
|
||||
@@ -144,6 +145,7 @@ typedef struct AC3DecodeContext {
|
||||
int spx_dst_start_freq; ///< spx starting frequency bin for copying (copystartmant)
|
||||
///< the copy region ends at the start of the spx region.
|
||||
int num_spx_bands; ///< number of spx bands (nspxbnds)
|
||||
uint8_t spx_band_struct[SPX_MAX_BANDS];
|
||||
uint8_t spx_band_sizes[SPX_MAX_BANDS]; ///< number of bins in each spx band
|
||||
uint8_t first_spx_coords[AC3_MAX_CHANNELS]; ///< first spx coordinates states (firstspxcos)
|
||||
INTFLOAT spx_noise_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS]; ///< spx noise blending factor (nblendfact)
|
||||
|
||||
@@ -1583,6 +1583,16 @@ enum AVPacketSideDataType {
|
||||
* to the AVSphericalMapping structure.
|
||||
*/
|
||||
AV_PKT_DATA_SPHERICAL,
|
||||
|
||||
/**
|
||||
* The number of side data elements (in fact a bit more than it).
|
||||
* This is not part of the public API/ABI in the sense that it may
|
||||
* change when new side data types are added.
|
||||
* This must stay the last enum value.
|
||||
* If its value becomes huge, some code using it
|
||||
* needs to be updated as it assumes it to be smaller than other limits.
|
||||
*/
|
||||
AV_PKT_DATA_NB
|
||||
};
|
||||
|
||||
#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
|
||||
|
||||
+16
-2
@@ -296,9 +296,20 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
uint8_t *data, size_t size)
|
||||
{
|
||||
AVPacketSideData *tmp;
|
||||
int elems = pkt->side_data_elems;
|
||||
int i, elems = pkt->side_data_elems;
|
||||
|
||||
if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
|
||||
for (i = 0; i < elems; i++) {
|
||||
AVPacketSideData *sd = &pkt->side_data[i];
|
||||
|
||||
if (sd->type == type) {
|
||||
av_free(sd->data);
|
||||
sd->data = data;
|
||||
sd->size = size;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((unsigned)elems + 1 > AV_PKT_DATA_NB)
|
||||
return AVERROR(ERANGE);
|
||||
|
||||
tmp = av_realloc(pkt->side_data, (elems + 1) * sizeof(*tmp));
|
||||
@@ -436,6 +447,9 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
p-= size+5;
|
||||
}
|
||||
|
||||
if (i > AV_PKT_DATA_NB)
|
||||
return AVERROR(ERANGE);
|
||||
|
||||
pkt->side_data = av_malloc_array(i, sizeof(*pkt->side_data));
|
||||
if (!pkt->side_data)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
+5
-2
@@ -133,8 +133,11 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
||||
alpha = bytestream_get_le32(&buf);
|
||||
}
|
||||
|
||||
avctx->width = width;
|
||||
avctx->height = height > 0 ? height : -(unsigned)height;
|
||||
ret = ff_set_dimensions(avctx, width, height > 0 ? height : -(unsigned)height);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions %d %d\n", width, height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_NONE;
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
|
||||
if (src < source || src >= source_end)
|
||||
return AVERROR_INVALIDDATA;
|
||||
shift += 2;
|
||||
val |= *src << shift;
|
||||
val |= (unsigned)*src << shift;
|
||||
if (*src & 0xC)
|
||||
break;
|
||||
}
|
||||
|
||||
+9
-2
@@ -613,8 +613,15 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC,
|
||||
mv_pred_median(h, mvP, mvA, mvB, mvC);
|
||||
|
||||
if (mode < MV_PRED_PSKIP) {
|
||||
mvP->x += get_se_golomb(&h->gb);
|
||||
mvP->y += get_se_golomb(&h->gb);
|
||||
int mx = get_se_golomb(&h->gb) + (unsigned)mvP->x;
|
||||
int my = get_se_golomb(&h->gb) + (unsigned)mvP->y;
|
||||
|
||||
if (mx != (int16_t)mx || my != (int16_t)my) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "MV %d %d out of supported range\n", mx, my);
|
||||
} else {
|
||||
mvP->x = mx;
|
||||
mvP->y = my;
|
||||
}
|
||||
}
|
||||
set_mvs(mvP, size);
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
|
||||
cavs_vector *col_mv)
|
||||
{
|
||||
cavs_vector *pmv_bw = pmv_fw + MV_BWD_OFFS;
|
||||
int den = h->direct_den[col_mv->ref];
|
||||
unsigned den = h->direct_den[col_mv->ref];
|
||||
int m = FF_SIGNBIT(col_mv->x);
|
||||
|
||||
pmv_fw->dist = h->dist[1];
|
||||
@@ -1031,6 +1031,10 @@ static int decode_pic(AVSContext *h)
|
||||
h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0;
|
||||
if (h->cur.f->pict_type == AV_PICTURE_TYPE_B) {
|
||||
h->sym_factor = h->dist[0] * h->scale_den[1];
|
||||
if (FFABS(h->sym_factor) > 32768) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "sym_factor %d too large\n", h->sym_factor);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else {
|
||||
h->direct_den[0] = h->dist[0] ? 16384 / h->dist[0] : 0;
|
||||
h->direct_den[1] = h->dist[1] ? 16384 / h->dist[1] : 0;
|
||||
|
||||
+3
-3
@@ -275,11 +275,11 @@ static int cdxl_decode_frame(AVCodecContext *avctx, void *data,
|
||||
else
|
||||
aligned_width = FFALIGN(c->avctx->width, 16);
|
||||
c->padded_bits = aligned_width - c->avctx->width;
|
||||
if (c->video_size < aligned_width * avctx->height * c->bpp / 8)
|
||||
if (c->video_size < aligned_width * avctx->height * (int64_t)c->bpp / 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!encoding && c->palette_size && c->bpp <= 8) {
|
||||
if (!encoding && c->palette_size && c->bpp <= 8 && c->format != CHUNKY) {
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
} else if (encoding == 1 && (c->bpp == 6 || c->bpp == 8)) {
|
||||
} else if (encoding == 1 && (c->bpp == 6 || c->bpp == 8) && c->format != CHUNKY) {
|
||||
if (c->palette_size != (1 << (c->bpp - 1)))
|
||||
return AVERROR_INVALIDDATA;
|
||||
avctx->pix_fmt = AV_PIX_FMT_BGR24;
|
||||
|
||||
@@ -185,8 +185,8 @@ static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac,
|
||||
const int t3 = OP( 2408 * blk[5 * step] - 1609 * blk[3 * step]); \
|
||||
const int t4 = OP( 1108 * blk[2 * step] - 2676 * blk[6 * step]); \
|
||||
const int t5 = OP( 2676 * blk[2 * step] + 1108 * blk[6 * step]); \
|
||||
const int t6 = ((blk[0 * step] + blk[4 * step]) << dshift) + bias; \
|
||||
const int t7 = ((blk[0 * step] - blk[4 * step]) << dshift) + bias; \
|
||||
const int t6 = ((blk[0 * step] + blk[4 * step]) * (1 << dshift)) + bias; \
|
||||
const int t7 = ((blk[0 * step] - blk[4 * step]) * (1 << dshift)) + bias; \
|
||||
const int t8 = t0 + t2; \
|
||||
const int t9 = t0 - t2; \
|
||||
const int tA = 181 * (t9 + (t1 - t3)) + 0x80 >> 8; \
|
||||
|
||||
+22
-7
@@ -29,6 +29,10 @@
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
|
||||
#define VLC_BITS 7
|
||||
#define VLC_DEPTH 2
|
||||
|
||||
|
||||
typedef struct CLLCContext {
|
||||
AVCodecContext *avctx;
|
||||
BswapDSPContext bdsp;
|
||||
@@ -51,6 +55,13 @@ static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
|
||||
|
||||
num_lens = get_bits(gb, 5);
|
||||
|
||||
if (num_lens > VLC_BITS * VLC_DEPTH) {
|
||||
vlc->table = NULL;
|
||||
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "To long VLCs %d\n", num_lens);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_lens; i++) {
|
||||
num_codes = get_bits(gb, 9);
|
||||
num_codes_sum += num_codes;
|
||||
@@ -70,11 +81,15 @@ static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
|
||||
|
||||
count++;
|
||||
}
|
||||
if (prefix > (65535 - 256)/2) {
|
||||
vlc->table = NULL;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
prefix <<= 1;
|
||||
}
|
||||
|
||||
return ff_init_vlc_sparse(vlc, 7, count, bits, 1, 1,
|
||||
return ff_init_vlc_sparse(vlc, VLC_BITS, count, bits, 1, 1,
|
||||
codes, 2, 2, symbols, 1, 1, 0);
|
||||
}
|
||||
|
||||
@@ -101,7 +116,7 @@ static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
|
||||
for (i = 0; i < ctx->avctx->width; i++) {
|
||||
/* Always get the alpha component */
|
||||
UPDATE_CACHE(bits, gb);
|
||||
GET_VLC(code, bits, gb, vlc[0].table, 7, 2);
|
||||
GET_VLC(code, bits, gb, vlc[0].table, VLC_BITS, VLC_DEPTH);
|
||||
|
||||
pred[0] += code;
|
||||
dst[0] = pred[0];
|
||||
@@ -110,21 +125,21 @@ static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
|
||||
if (dst[0]) {
|
||||
/* Red */
|
||||
UPDATE_CACHE(bits, gb);
|
||||
GET_VLC(code, bits, gb, vlc[1].table, 7, 2);
|
||||
GET_VLC(code, bits, gb, vlc[1].table, VLC_BITS, VLC_DEPTH);
|
||||
|
||||
pred[1] += code;
|
||||
dst[1] = pred[1];
|
||||
|
||||
/* Green */
|
||||
UPDATE_CACHE(bits, gb);
|
||||
GET_VLC(code, bits, gb, vlc[2].table, 7, 2);
|
||||
GET_VLC(code, bits, gb, vlc[2].table, VLC_BITS, VLC_DEPTH);
|
||||
|
||||
pred[2] += code;
|
||||
dst[2] = pred[2];
|
||||
|
||||
/* Blue */
|
||||
UPDATE_CACHE(bits, gb);
|
||||
GET_VLC(code, bits, gb, vlc[3].table, 7, 2);
|
||||
GET_VLC(code, bits, gb, vlc[3].table, VLC_BITS, VLC_DEPTH);
|
||||
|
||||
pred[3] += code;
|
||||
dst[3] = pred[3];
|
||||
@@ -166,7 +181,7 @@ static int read_rgb24_component_line(CLLCContext *ctx, GetBitContext *gb,
|
||||
/* Simultaneously read and restore the line */
|
||||
for (i = 0; i < ctx->avctx->width; i++) {
|
||||
UPDATE_CACHE(bits, gb);
|
||||
GET_VLC(code, bits, gb, vlc->table, 7, 2);
|
||||
GET_VLC(code, bits, gb, vlc->table, VLC_BITS, VLC_DEPTH);
|
||||
|
||||
pred += code;
|
||||
dst[0] = pred;
|
||||
@@ -195,7 +210,7 @@ static int read_yuv_component_line(CLLCContext *ctx, GetBitContext *gb,
|
||||
/* Simultaneously read and restore the line */
|
||||
for (i = 0; i < ctx->avctx->width >> is_chroma; i++) {
|
||||
UPDATE_CACHE(bits, gb);
|
||||
GET_VLC(code, bits, gb, vlc->table, 7, 2);
|
||||
GET_VLC(code, bits, gb, vlc->table, VLC_BITS, VLC_DEPTH);
|
||||
|
||||
pred += code;
|
||||
outbuf[i] = pred;
|
||||
|
||||
+1
-1
@@ -320,7 +320,7 @@ static void dmix_sub_c(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t le
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
dst[i] -= mul15(src[i], coeff);
|
||||
dst[i] -= (unsigned)mul15(src[i], coeff);
|
||||
}
|
||||
|
||||
static void dmix_add_c(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@
|
||||
|
||||
#define DDPF_FOURCC (1 << 2)
|
||||
#define DDPF_PALETTE (1 << 5)
|
||||
#define DDPF_NORMALMAP (1 << 31)
|
||||
#define DDPF_NORMALMAP (1U << 31)
|
||||
|
||||
enum DDSPostProc {
|
||||
DDS_NONE = 0,
|
||||
@@ -718,7 +718,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;
|
||||
|
||||
+3
-2
@@ -67,7 +67,8 @@ static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height
|
||||
const uint8_t *frame_start = frame;
|
||||
const uint8_t *frame_end = frame + width * height;
|
||||
int mask = 0x10000, bitbuf = 0;
|
||||
int v, count, segments;
|
||||
int v, count;
|
||||
unsigned segments;
|
||||
unsigned offset;
|
||||
|
||||
segments = bytestream2_get_le32(gb);
|
||||
@@ -175,7 +176,7 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame += v;
|
||||
} else {
|
||||
if (frame_end - frame < width + 3)
|
||||
if (frame_end - frame < width + 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame[0] = frame[1] =
|
||||
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
|
||||
|
||||
@@ -2047,9 +2047,9 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
|
||||
|
||||
if (out) {
|
||||
out->reference ^= DELAYED_PIC_REF;
|
||||
*got_frame = 1;
|
||||
if((ret = av_frame_ref(picture, out->avframe)) < 0)
|
||||
return ret;
|
||||
*got_frame = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
|
||||
typedef struct {
|
||||
ParseContext pc;
|
||||
int interlaced;
|
||||
int cur_field; /* first field is 0, second is 1 */
|
||||
int cur_byte;
|
||||
int remaining;
|
||||
int w, h;
|
||||
@@ -56,8 +54,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
|
||||
uint64_t state = pc->state64;
|
||||
int pic_found = pc->frame_start_found;
|
||||
int i = 0;
|
||||
int interlaced = dctx->interlaced;
|
||||
int cur_field = dctx->cur_field;
|
||||
|
||||
if (!pic_found) {
|
||||
for (i = 0; i < buf_size; i++) {
|
||||
@@ -65,8 +61,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
|
||||
if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {
|
||||
i++;
|
||||
pic_found = 1;
|
||||
interlaced = (state&2)>>1; /* byte following the 5-byte header prefix */
|
||||
cur_field = state&1;
|
||||
dctx->cur_byte = 0;
|
||||
dctx->remaining = 0;
|
||||
break;
|
||||
@@ -97,13 +91,11 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
|
||||
if (dctx->remaining <= 0)
|
||||
return dctx->remaining;
|
||||
}
|
||||
if (buf_size - i >= dctx->remaining && (!dctx->interlaced || dctx->cur_field)) {
|
||||
if (buf_size - i + 47 >= dctx->remaining) {
|
||||
int remaining = dctx->remaining;
|
||||
|
||||
pc->frame_start_found = 0;
|
||||
pc->state64 = -1;
|
||||
dctx->interlaced = interlaced;
|
||||
dctx->cur_field = 0;
|
||||
dctx->cur_byte = 0;
|
||||
dctx->remaining = 0;
|
||||
return remaining;
|
||||
@@ -120,8 +112,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
|
||||
|
||||
pc->frame_start_found = 0;
|
||||
pc->state64 = -1;
|
||||
dctx->interlaced = interlaced;
|
||||
dctx->cur_field = 0;
|
||||
dctx->cur_byte = 0;
|
||||
dctx->remaining = 0;
|
||||
return remaining;
|
||||
@@ -129,8 +119,6 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
|
||||
}
|
||||
pc->frame_start_found = pic_found;
|
||||
pc->state64 = state;
|
||||
dctx->interlaced = interlaced;
|
||||
dctx->cur_field = cur_field;
|
||||
return END_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -33,7 +33,7 @@
|
||||
|
||||
#define DSS_SP_FRAME_SIZE 42
|
||||
#define DSS_SP_SAMPLE_COUNT (66 * SUBFRAMES)
|
||||
#define DSS_SP_FORMULA(a, b, c) (((((a) << 15) + (b) * (c)) + 0x4000) >> 15)
|
||||
#define DSS_SP_FORMULA(a, b, c) ((int)((((a) * (1 << 15)) + (b) * (unsigned)(c)) + 0x4000) >> 15)
|
||||
|
||||
typedef struct DssSpSubframe {
|
||||
int16_t gain;
|
||||
@@ -499,7 +499,7 @@ static void dss_sp_scale_vector(int32_t *vec, int bits, int size)
|
||||
vec[i] = vec[i] >> -bits;
|
||||
else
|
||||
for (i = 0; i < size; i++)
|
||||
vec[i] = vec[i] << bits;
|
||||
vec[i] = vec[i] * (1 << bits);
|
||||
}
|
||||
|
||||
static void dss_sp_update_buf(int32_t *hist, int32_t *vector)
|
||||
@@ -524,12 +524,12 @@ static void dss_sp_shift_sq_sub(const int32_t *filter_buf,
|
||||
tmp = dst[a] * filter_buf[0];
|
||||
|
||||
for (i = 14; i > 0; i--)
|
||||
tmp -= error_buf[i] * filter_buf[i];
|
||||
tmp -= error_buf[i] * (unsigned)filter_buf[i];
|
||||
|
||||
for (i = 14; i > 0; i--)
|
||||
error_buf[i] = error_buf[i - 1];
|
||||
|
||||
tmp = (tmp + 4096) >> 13;
|
||||
tmp = (int)(tmp + 4096U) >> 13;
|
||||
|
||||
error_buf[1] = tmp;
|
||||
|
||||
|
||||
+10
-2
@@ -24,6 +24,7 @@
|
||||
#include "bytestream.h"
|
||||
#include "internal.h"
|
||||
#include "libavutil/colorspace.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define DVBSUB_PAGE_SEGMENT 0x10
|
||||
@@ -1159,9 +1160,9 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (depth & 0x80)
|
||||
if (depth & 0x80 && entry_id < 4)
|
||||
clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
|
||||
else if (depth & 0x40)
|
||||
else if (depth & 0x40 && entry_id < 16)
|
||||
clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha);
|
||||
else if (depth & 0x20)
|
||||
clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha);
|
||||
@@ -1184,6 +1185,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
|
||||
DVBSubObject *object;
|
||||
DVBSubObjectDisplay *display;
|
||||
int fill;
|
||||
int ret;
|
||||
|
||||
if (buf_size < 10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1212,6 +1214,12 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
|
||||
region->height = AV_RB16(buf);
|
||||
buf += 2;
|
||||
|
||||
ret = av_image_check_size(region->width, region->height, 0, avctx);
|
||||
if (ret < 0) {
|
||||
region->width= region->height= 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (region->width * region->height != region->buf_size) {
|
||||
av_free(region->pbuf);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *
|
||||
cb = *ycbcr++;
|
||||
YUV_TO_RGB1_CCIR(cb, cr);
|
||||
YUV_TO_RGB2_CCIR(r, g, b, y);
|
||||
*rgba++ = (*alpha++ << 24) | (r << 16) | (g << 8) | b;
|
||||
*rgba++ = ((unsigned)*alpha++ << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,12 +189,12 @@ static void guess_palette(DVDSubContext* ctx,
|
||||
r = (((subtitle_color >> 16) & 0xff) * level) >> 8;
|
||||
g = (((subtitle_color >> 8) & 0xff) * level) >> 8;
|
||||
b = (((subtitle_color >> 0) & 0xff) * level) >> 8;
|
||||
rgba_palette[i] = b | (g << 8) | (r << 16) | ((alpha[i] * 17) << 24);
|
||||
rgba_palette[i] = b | (g << 8) | (r << 16) | ((alpha[i] * 17U) << 24);
|
||||
color_used[colormap[i]] = (i + 1);
|
||||
j++;
|
||||
} else {
|
||||
rgba_palette[i] = (rgba_palette[color_used[colormap[i]] - 1] & 0x00ffffff) |
|
||||
((alpha[i] * 17) << 24);
|
||||
((alpha[i] * 17U) << 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (avctx->width != width || avctx->height != height) {
|
||||
av_frame_unref(s->last_frame);
|
||||
if((width * height)/2048*7 > bytestream2_get_bytes_left(&gb))
|
||||
if((width * (int64_t)height)/2048*7 > bytestream2_get_bytes_left(&gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ static inline void tqi_idct_put(AVCodecContext *avctx, AVFrame *frame,
|
||||
|
||||
static void tqi_calculate_qtable(TqiContext *t, int quant)
|
||||
{
|
||||
const int qscale = (215 - 2*quant)*5;
|
||||
const int64_t qscale = (215 - 2*quant)*5;
|
||||
int i;
|
||||
|
||||
t->intra_matrix[0] = (ff_inv_aanscales[0] * ff_mpeg1_default_intra_matrix[0]) >> 11;
|
||||
|
||||
+2
-2
@@ -220,9 +220,9 @@ static union av_intfloat32 exr_half2float(uint16_t hf)
|
||||
*
|
||||
* @return normalized 16-bit unsigned int
|
||||
*/
|
||||
static inline uint16_t exr_flt2uint(uint32_t v)
|
||||
static inline uint16_t exr_flt2uint(int32_t v)
|
||||
{
|
||||
unsigned int exp = v >> 23;
|
||||
int32_t exp = v >> 23;
|
||||
// "HACK": negative values result in exp< 0, so clipping them to 0
|
||||
// is also handled by this condition, avoids explicit check for sign bit.
|
||||
if (exp <= 127 + 7 - 24) // we would shift out all bits anyway
|
||||
|
||||
@@ -303,6 +303,11 @@ int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfi
|
||||
|
||||
last_clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset) =
|
||||
global ? (*env)->NewGlobalRef(env, clazz) : clazz;
|
||||
|
||||
if (global) {
|
||||
(*env)->DeleteLocalRef(env, clazz);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!last_clazz) {
|
||||
|
||||
@@ -45,7 +45,8 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
|
||||
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++;
|
||||
@@ -898,7 +899,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
const uint8_t *src[4];
|
||||
uint8_t *dst[4];
|
||||
ff_thread_await_progress(&f->last_picture, INT_MAX, 0);
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (j = 0; j < desc->nb_components; j++) {
|
||||
int pixshift = desc->comp[j].depth > 8;
|
||||
int sh = (j == 1 || j == 2) ? f->chroma_h_shift : 0;
|
||||
int sv = (j == 1 || j == 2) ? f->chroma_v_shift : 0;
|
||||
@@ -906,6 +907,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
(fs->slice_y >> sv) + ((fs->slice_x >> sh) << pixshift);
|
||||
src[j] = f->last_picture.f->data[j] + f->last_picture.f->linesize[j] *
|
||||
(fs->slice_y >> sv) + ((fs->slice_x >> sh) << pixshift);
|
||||
|
||||
}
|
||||
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
|
||||
desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
|
||||
dst[1] = p->data[1];
|
||||
src[1] = f->last_picture.f->data[1];
|
||||
}
|
||||
av_image_copy(dst, p->linesize, src,
|
||||
f->last_picture.f->linesize,
|
||||
|
||||
+2
-2
@@ -95,8 +95,8 @@ static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd
|
||||
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] << 15) + rnd;
|
||||
const int tB = (blk[0 * step] + blk[4 * step] << 15) + rnd;
|
||||
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;
|
||||
|
||||
@@ -205,12 +205,12 @@ static int get_metadata_size(const uint8_t *buf, int buf_size)
|
||||
buf += 4;
|
||||
do {
|
||||
if (buf_end - buf < 4)
|
||||
return 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);
|
||||
buf += 4;
|
||||
if (buf_end - buf < metadata_size) {
|
||||
/* need more data in order to read the complete header */
|
||||
return 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
buf += metadata_size;
|
||||
} while (!metadata_last);
|
||||
|
||||
@@ -561,6 +561,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
s->nb_blocks = s->xb * s->yb;
|
||||
if (!s->nb_blocks)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->blocks = av_calloc(s->nb_blocks, sizeof(*s->blocks));
|
||||
if (!s->blocks)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
+4
-4
@@ -88,14 +88,14 @@ static inline void s_zero(int cur_diff, struct G722Band *band)
|
||||
ACCUM(3, band->diff_mem[2], 1);
|
||||
ACCUM(2, band->diff_mem[1], 1);
|
||||
ACCUM(1, band->diff_mem[0], 1);
|
||||
ACCUM(0, cur_diff << 1, 1);
|
||||
ACCUM(0, cur_diff * 2, 1);
|
||||
} else {
|
||||
ACCUM(5, band->diff_mem[4], 0);
|
||||
ACCUM(4, band->diff_mem[3], 0);
|
||||
ACCUM(3, band->diff_mem[2], 0);
|
||||
ACCUM(2, band->diff_mem[1], 0);
|
||||
ACCUM(1, band->diff_mem[0], 0);
|
||||
ACCUM(0, cur_diff << 1, 0);
|
||||
ACCUM(0, cur_diff * 2, 0);
|
||||
}
|
||||
#undef ACCUM
|
||||
band->s_zero = s_zero;
|
||||
@@ -119,14 +119,14 @@ static void do_adaptive_prediction(struct G722Band *band, const int cur_diff)
|
||||
band->part_reconst_mem[0] = cur_part_reconst;
|
||||
|
||||
band->pole_mem[1] = av_clip((sg[0] * av_clip(band->pole_mem[0], -8191, 8191) >> 5) +
|
||||
(sg[1] << 7) + (band->pole_mem[1] * 127 >> 7), -12288, 12288);
|
||||
(sg[1] * 128) + (band->pole_mem[1] * 127 >> 7), -12288, 12288);
|
||||
|
||||
limit = 15360 - band->pole_mem[1];
|
||||
band->pole_mem[0] = av_clip(-192 * sg[0] + (band->pole_mem[0] * 255 >> 8), -limit, limit);
|
||||
|
||||
s_zero(cur_diff, band);
|
||||
|
||||
cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) << 1);
|
||||
cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) * 2);
|
||||
band->s_predictor = av_clip_int16(band->s_zero +
|
||||
(band->pole_mem[0] * cur_qtzd_reconst >> 15) +
|
||||
(band->pole_mem[1] * band->prev_qtzd_reconst >> 15));
|
||||
|
||||
+9
-9
@@ -41,7 +41,7 @@ int ff_g723_1_scale_vector(int16_t *dst, const int16_t *vector, int length)
|
||||
bits= FFMAX(bits, 0);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
dst[i] = vector[i] << bits >> 3;
|
||||
dst[i] = (vector[i] * (1 << bits)) >> 3;
|
||||
|
||||
return bits - 3;
|
||||
}
|
||||
@@ -125,9 +125,9 @@ static void lsp2lpc(int16_t *lpc)
|
||||
for (j = 0; j < LPC_ORDER; j++) {
|
||||
int index = (lpc[j] >> 7) & 0x1FF;
|
||||
int offset = lpc[j] & 0x7f;
|
||||
int temp1 = cos_tab[index] << 16;
|
||||
int temp1 = cos_tab[index] * (1 << 16);
|
||||
int temp2 = (cos_tab[index + 1] - cos_tab[index]) *
|
||||
((offset << 8) + 0x80) << 1;
|
||||
(((offset << 8) + 0x80) << 1);
|
||||
|
||||
lpc[j] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16);
|
||||
}
|
||||
@@ -138,11 +138,11 @@ static void lsp2lpc(int16_t *lpc)
|
||||
*/
|
||||
/* Initialize with values in Q28 */
|
||||
f1[0] = 1 << 28;
|
||||
f1[1] = (lpc[0] << 14) + (lpc[2] << 14);
|
||||
f1[1] = (lpc[0] + lpc[2]) * (1 << 14);
|
||||
f1[2] = lpc[0] * lpc[2] + (2 << 28);
|
||||
|
||||
f2[0] = 1 << 28;
|
||||
f2[1] = (lpc[1] << 14) + (lpc[3] << 14);
|
||||
f2[1] = (lpc[1] + lpc[3]) * (1 << 14);
|
||||
f2[2] = lpc[1] * lpc[3] + (2 << 28);
|
||||
|
||||
/*
|
||||
@@ -162,8 +162,8 @@ static void lsp2lpc(int16_t *lpc)
|
||||
|
||||
f1[0] >>= 1;
|
||||
f2[0] >>= 1;
|
||||
f1[1] = ((lpc[2 * i] << 16 >> i) + f1[1]) >> 1;
|
||||
f2[1] = ((lpc[2 * i + 1] << 16 >> i) + f2[1]) >> 1;
|
||||
f1[1] = ((lpc[2 * i] * 65536 >> i) + f1[1]) >> 1;
|
||||
f2[1] = ((lpc[2 * i + 1] * 65536 >> i) + f2[1]) >> 1;
|
||||
}
|
||||
|
||||
/* Convert polynomial coefficients to LPC coefficients */
|
||||
@@ -171,8 +171,8 @@ static void lsp2lpc(int16_t *lpc)
|
||||
int64_t ff1 = f1[i + 1] + f1[i];
|
||||
int64_t ff2 = f2[i + 1] - f2[i];
|
||||
|
||||
lpc[i] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16;
|
||||
lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) << 3) +
|
||||
lpc[i] = av_clipl_int32(((ff1 + ff2) * 8) + (1 << 15)) >> 16;
|
||||
lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) * 8) +
|
||||
(1 << 15)) >> 16;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@
|
||||
* @param b 16 bit multiplier
|
||||
*/
|
||||
#define MULL2(a, b) \
|
||||
((((a) >> 16) * (b) << 1) + (((a) & 0xffff) * (b) >> 15))
|
||||
((((a) >> 16) * (b) * 2) + (((a) & 0xffff) * (b) >> 15))
|
||||
|
||||
/**
|
||||
* G723.1 frame types
|
||||
|
||||
@@ -488,7 +488,7 @@ static void residual_interp(int16_t *buf, int16_t *out, int lag,
|
||||
(FRAME_LEN - lag) * sizeof(*out));
|
||||
} else { /* Unvoiced */
|
||||
for (i = 0; i < FRAME_LEN; i++) {
|
||||
*rseed = *rseed * 521 + 259;
|
||||
*rseed = (int16_t)(*rseed * 521 + 259);
|
||||
out[i] = gain * *rseed >> 15;
|
||||
}
|
||||
memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*buf));
|
||||
@@ -517,7 +517,7 @@ static void residual_interp(int16_t *buf, int16_t *out, int lag,
|
||||
(iir_coef)[n - 1] * ((dest)[m - n] >> in_shift);\
|
||||
}\
|
||||
\
|
||||
(dest)[m] = av_clipl_int32(((src)[m] << 16) + (filter << 3) +\
|
||||
(dest)[m] = av_clipl_int32(((src)[m] * 65536) + (filter * 8) +\
|
||||
(1 << 15)) >> res_shift;\
|
||||
}\
|
||||
}
|
||||
@@ -664,7 +664,7 @@ static int estimate_sid_gain(G723_1_Context *p)
|
||||
t = p->sid_gain << shift;
|
||||
else
|
||||
t = p->sid_gain >> -shift;
|
||||
x = t * cng_filt[0] >> 16;
|
||||
x = av_clipl_int32(t * (int64_t)cng_filt[0] >> 16);
|
||||
|
||||
if (x >= cng_bseg[2])
|
||||
return 0x3F;
|
||||
@@ -695,13 +695,13 @@ static int estimate_sid_gain(G723_1_Context *p)
|
||||
if (y <= 0) {
|
||||
t = seg * 32 + (val + 1 << seg2);
|
||||
t = t * t - x;
|
||||
val = (seg2 - 1 << 4) + val;
|
||||
val = (seg2 - 1) * 16 + val;
|
||||
if (t >= y)
|
||||
val++;
|
||||
} else {
|
||||
t = seg * 32 + (val - 1 << seg2);
|
||||
t = t * t - x;
|
||||
val = (seg2 - 1 << 4) + val;
|
||||
val = (seg2 - 1) * 16 + val;
|
||||
if (t >= y)
|
||||
val--;
|
||||
}
|
||||
@@ -733,7 +733,7 @@ static void generate_noise(G723_1_Context *p)
|
||||
off[i * 2 + 1] = ((t >> 1) & 1) + SUBFRAME_LEN;
|
||||
t >>= 2;
|
||||
for (j = 0; j < 11; j++) {
|
||||
signs[i * 11 + j] = (t & 1) * 2 - 1 << 14;
|
||||
signs[i * 11 + j] = ((t & 1) * 2 - 1) * (1 << 14);
|
||||
t >>= 1;
|
||||
}
|
||||
}
|
||||
@@ -777,7 +777,7 @@ static void generate_noise(G723_1_Context *p)
|
||||
sum = 0;
|
||||
if (shift < 0) {
|
||||
for (j = 0; j < SUBFRAME_LEN * 2; j++) {
|
||||
t = vector_ptr[j] << -shift;
|
||||
t = vector_ptr[j] * (1 << -shift);
|
||||
sum += t * t;
|
||||
tmp[j] = t;
|
||||
}
|
||||
@@ -815,7 +815,7 @@ static void generate_noise(G723_1_Context *p)
|
||||
if (shift < 0)
|
||||
x >>= -shift;
|
||||
else
|
||||
x <<= shift;
|
||||
x *= 1 << shift;
|
||||
x = av_clip(x, -10000, 10000);
|
||||
|
||||
for (j = 0; j < 11; j++) {
|
||||
@@ -904,7 +904,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
&p->subframe[i], p->cur_rate);
|
||||
/* Get the total excitation */
|
||||
for (j = 0; j < SUBFRAME_LEN; j++) {
|
||||
int v = av_clip_int16(vector_ptr[j] << 1);
|
||||
int v = av_clip_int16(vector_ptr[j] * 2);
|
||||
vector_ptr[j] = av_clip_int16(v + acb_vector[j]);
|
||||
}
|
||||
vector_ptr += SUBFRAME_LEN;
|
||||
|
||||
+1
-1
@@ -269,7 +269,7 @@ static int16_t g726_decode(G726Context* c, int I)
|
||||
c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]);
|
||||
c->se >>= 1;
|
||||
|
||||
return av_clip(re_signal << 2, -0xffff, 0xffff);
|
||||
return av_clip(re_signal * 4, -0xffff, 0xffff);
|
||||
}
|
||||
|
||||
static av_cold int g726_reset(G726Context *c)
|
||||
|
||||
@@ -1112,7 +1112,7 @@ decode_intra_mb:
|
||||
|
||||
dquant= get_se_golomb(&sl->gb);
|
||||
|
||||
sl->qscale += dquant;
|
||||
sl->qscale += (unsigned)dquant;
|
||||
|
||||
if (((unsigned)sl->qscale) > max_qp){
|
||||
if (sl->qscale < 0) sl->qscale += max_qp + 1;
|
||||
|
||||
@@ -59,6 +59,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
if (luma_weight_flag) {
|
||||
pwt->luma_weight[i][list][0] = get_se_golomb(gb);
|
||||
pwt->luma_weight[i][list][1] = get_se_golomb(gb);
|
||||
if ((int8_t)pwt->luma_weight[i][list][0] != pwt->luma_weight[i][list][0] ||
|
||||
(int8_t)pwt->luma_weight[i][list][1] != pwt->luma_weight[i][list][1])
|
||||
goto out_range_weight;
|
||||
if (pwt->luma_weight[i][list][0] != luma_def ||
|
||||
pwt->luma_weight[i][list][1] != 0) {
|
||||
pwt->use_weight = 1;
|
||||
@@ -76,6 +79,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
for (j = 0; j < 2; j++) {
|
||||
pwt->chroma_weight[i][list][j][0] = get_se_golomb(gb);
|
||||
pwt->chroma_weight[i][list][j][1] = get_se_golomb(gb);
|
||||
if ((int8_t)pwt->chroma_weight[i][list][j][0] != pwt->chroma_weight[i][list][j][0] ||
|
||||
(int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1])
|
||||
goto out_range_weight;
|
||||
if (pwt->chroma_weight[i][list][j][0] != chroma_def ||
|
||||
pwt->chroma_weight[i][list][j][1] != 0) {
|
||||
pwt->use_weight_chroma = 1;
|
||||
@@ -104,6 +110,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
|
||||
}
|
||||
pwt->use_weight = pwt->use_weight || pwt->use_weight_chroma;
|
||||
return 0;
|
||||
out_range_weight:
|
||||
avpriv_request_sample(logctx, "Out of range weight\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -109,7 +109,6 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src)
|
||||
dst->poc = src->poc;
|
||||
dst->frame_num = src->frame_num;
|
||||
dst->mmco_reset = src->mmco_reset;
|
||||
dst->pic_id = src->pic_id;
|
||||
dst->long_ref = src->long_ref;
|
||||
dst->mbaff = src->mbaff;
|
||||
dst->field_picture = src->field_picture;
|
||||
|
||||
+12
-6
@@ -1423,14 +1423,14 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
|
||||
* We have to do that before the "dummy" in-between frame allocation,
|
||||
* since that can modify h->cur_pic_ptr. */
|
||||
if (h->first_field) {
|
||||
int last_field = last_pic_structure == PICT_BOTTOM_FIELD;
|
||||
av_assert0(h->cur_pic_ptr);
|
||||
av_assert0(h->cur_pic_ptr->f->buf[0]);
|
||||
assert(h->cur_pic_ptr->reference != DELAYED_PIC_REF);
|
||||
|
||||
/* Mark old field/frame as completed */
|
||||
if (h->cur_pic_ptr->tf.owner == h->avctx) {
|
||||
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
|
||||
last_pic_structure == PICT_BOTTOM_FIELD);
|
||||
if (h->cur_pic_ptr->tf.owner[last_field] == h->avctx) {
|
||||
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, last_field);
|
||||
}
|
||||
|
||||
/* figure out if we have a complementary field pair */
|
||||
@@ -1568,7 +1568,9 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else {
|
||||
int field = h->picture_structure == PICT_BOTTOM_FIELD;
|
||||
release_unused_pictures(h, 0);
|
||||
h->cur_pic_ptr->tf.owner[field] = h->avctx;
|
||||
}
|
||||
/* Some macroblocks can be accessed before they're available in case
|
||||
* of lost slices, MBAFF or threading. */
|
||||
@@ -1778,9 +1780,12 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
|
||||
}
|
||||
if ((pps->weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) ||
|
||||
(pps->weighted_bipred_idc == 1 &&
|
||||
sl->slice_type_nos == AV_PICTURE_TYPE_B))
|
||||
ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count,
|
||||
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);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
sl->explicit_ref_marking = 0;
|
||||
if (nal->ref_idc) {
|
||||
@@ -1886,7 +1891,8 @@ static int h264_slice_init(H264Context *h, H264SliceContext *sl,
|
||||
|
||||
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
|
||||
ff_h264_direct_dist_scale_factor(h, sl);
|
||||
ff_h264_direct_ref_list_init(h, sl);
|
||||
if (!h->setup_finished)
|
||||
ff_h264_direct_ref_list_init(h, sl);
|
||||
|
||||
if (h->avctx->skip_loop_filter >= AVDISCARD_ALL ||
|
||||
(h->avctx->skip_loop_filter >= AVDISCARD_NONKEY &&
|
||||
|
||||
@@ -145,7 +145,7 @@ static int decode_nal_sei_display_orientation(HEVCContext *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_pic_timing(HEVCContext *s)
|
||||
static int decode_pic_timing(HEVCContext *s, int size)
|
||||
{
|
||||
GetBitContext *gb = &s->HEVClc->gb;
|
||||
HEVCSPS *sps;
|
||||
@@ -166,8 +166,12 @@ static int decode_pic_timing(HEVCContext *s)
|
||||
}
|
||||
get_bits(gb, 2); // source_scan_type
|
||||
get_bits(gb, 1); // duplicate_flag
|
||||
skip_bits1(gb);
|
||||
size--;
|
||||
}
|
||||
return 1;
|
||||
skip_bits_long(gb, 8 * size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_registered_user_data_closed_caption(HEVCContext *s, int size)
|
||||
@@ -297,9 +301,8 @@ static int decode_nal_sei_prefix(HEVCContext *s, int type, int size)
|
||||
return decode_nal_sei_display_orientation(s);
|
||||
case SEI_TYPE_PICTURE_TIMING:
|
||||
{
|
||||
int ret = decode_pic_timing(s);
|
||||
int ret = decode_pic_timing(s, size);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
|
||||
skip_bits(gb, 8 * size);
|
||||
return ret;
|
||||
}
|
||||
case SEI_TYPE_MASTERING_DISPLAY_INFO:
|
||||
|
||||
+16
-16
@@ -585,7 +585,7 @@ static int hls_slice_header(HEVCContext *s)
|
||||
}
|
||||
|
||||
/* 8.3.1 */
|
||||
if (s->temporal_id == 0 &&
|
||||
if (sh->first_slice_in_pic_flag && s->temporal_id == 0 &&
|
||||
s->nal_unit_type != HEVC_NAL_TRAIL_N &&
|
||||
s->nal_unit_type != HEVC_NAL_TSA_N &&
|
||||
s->nal_unit_type != HEVC_NAL_STSA_N &&
|
||||
@@ -2771,25 +2771,25 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (s->max_ra == INT_MAX) {
|
||||
if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) {
|
||||
s->max_ra = s->poc;
|
||||
if (s->sh.first_slice_in_pic_flag) {
|
||||
if (s->max_ra == INT_MAX) {
|
||||
if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) {
|
||||
s->max_ra = s->poc;
|
||||
} else {
|
||||
if (IS_IDR(s))
|
||||
s->max_ra = INT_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) &&
|
||||
s->poc <= s->max_ra) {
|
||||
s->is_decoded = 0;
|
||||
break;
|
||||
} else {
|
||||
if (IS_IDR(s))
|
||||
if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra)
|
||||
s->max_ra = INT_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) &&
|
||||
s->poc <= s->max_ra) {
|
||||
s->is_decoded = 0;
|
||||
break;
|
||||
} else {
|
||||
if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra)
|
||||
s->max_ra = INT_MIN;
|
||||
}
|
||||
|
||||
if (s->sh.first_slice_in_pic_flag) {
|
||||
ret = hevc_frame_start(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+2
-2
@@ -68,11 +68,11 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64],
|
||||
memset(block, 0, 64 * sizeof(*block));
|
||||
|
||||
if (!is_hqa) {
|
||||
block[0] = get_sbits(gb, 9) << 6;
|
||||
block[0] = get_sbits(gb, 9) * 64;
|
||||
q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)];
|
||||
} else {
|
||||
q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)];
|
||||
block[0] = get_sbits(gb, 9) << 6;
|
||||
block[0] = get_sbits(gb, 9) * 64;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
||||
+8
-8
@@ -39,18 +39,18 @@ static inline void idct_col(int16_t *blk, const uint8_t *quant)
|
||||
s6 = (int) blk[6 * 8] * quant[6 * 8];
|
||||
s7 = (int) blk[7 * 8] * quant[7 * 8];
|
||||
|
||||
t0 = (s3 * 19266 + s5 * 12873) >> 15;
|
||||
t1 = (s5 * 19266 - s3 * 12873) >> 15;
|
||||
t2 = ((s7 * 4520 + s1 * 22725) >> 15) - t0;
|
||||
t3 = ((s1 * 4520 - s7 * 22725) >> 15) - t1;
|
||||
t0 = (int)(s3 * 19266U + s5 * 12873U) >> 15;
|
||||
t1 = (int)(s5 * 19266U - s3 * 12873U) >> 15;
|
||||
t2 = ((int)(s7 * 4520U + s1 * 22725U) >> 15) - t0;
|
||||
t3 = ((int)(s1 * 4520U - s7 * 22725U) >> 15) - t1;
|
||||
t4 = t0 * 2 + t2;
|
||||
t5 = t1 * 2 + t3;
|
||||
t6 = t2 - t3;
|
||||
t7 = t3 * 2 + t6;
|
||||
t8 = (t6 * 11585) >> 14;
|
||||
t9 = (t7 * 11585) >> 14;
|
||||
tA = (s2 * 8867 - s6 * 21407) >> 14;
|
||||
tB = (s6 * 8867 + s2 * 21407) >> 14;
|
||||
t8 = (int)(t6 * 11585U) >> 14;
|
||||
t9 = (int)(t7 * 11585U) >> 14;
|
||||
tA = (int)(s2 * 8867U - s6 * 21407U) >> 14;
|
||||
tB = (int)(s6 * 8867U + s2 * 21407U) >> 14;
|
||||
tC = (s0 >> 1) - (s4 >> 1);
|
||||
tD = (s4 >> 1) * 2 + tC;
|
||||
tE = tC - (tA >> 1);
|
||||
|
||||
@@ -46,11 +46,12 @@ typedef struct SrtStack {
|
||||
|
||||
static void rstrip_spaces_buf(AVBPrint *buf)
|
||||
{
|
||||
while (buf->len > 0 && buf->str[buf->len - 1] == ' ')
|
||||
buf->str[--buf->len] = 0;
|
||||
if (av_bprint_is_complete(buf))
|
||||
while (buf->len > 0 && buf->str[buf->len - 1] == ' ')
|
||||
buf->str[--buf->len] = 0;
|
||||
}
|
||||
|
||||
void ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
|
||||
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;
|
||||
@@ -171,8 +172,13 @@ void ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
|
||||
line_start = 0;
|
||||
}
|
||||
|
||||
if (!av_bprint_is_complete(dst))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
while (dst->len >= 2 && !strncmp(&dst->str[dst->len - 2], "\\N", 2))
|
||||
dst->len -= 2;
|
||||
dst->str[dst->len] = 0;
|
||||
rstrip_spaces_buf(dst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
|
||||
#include "libavutil/bprint.h"
|
||||
|
||||
void ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in);
|
||||
int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in);
|
||||
|
||||
#endif /* AVCODEC_HTMLSUBTITLES_H */
|
||||
|
||||
@@ -579,6 +579,8 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
|
||||
HYuvContext *s = avctx->priv_data;
|
||||
int i, ret;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
if ((ret = ff_huffyuv_alloc_temp(s)) < 0) {
|
||||
ff_huffyuv_common_end(s);
|
||||
return ret;
|
||||
|
||||
+12
-1
@@ -69,6 +69,8 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
|
||||
for (i = 0; i < c * 2; i++)
|
||||
dst[out++] = 0x80;
|
||||
} else { /* copy two values from table */
|
||||
if (c <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
dst[out++] = table[c * 2];
|
||||
dst[out++] = table[(c * 2) + 1];
|
||||
}
|
||||
@@ -77,6 +79,8 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
|
||||
|
||||
for (j = 1; j < height; j++) {
|
||||
out = 0;
|
||||
if (get_bits_left(&ctx->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (out < width) {
|
||||
int c = ir2_get_code(&ctx->gb);
|
||||
if (c >= 0x80) { /* we have a skip */
|
||||
@@ -88,7 +92,10 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
|
||||
out++;
|
||||
}
|
||||
} else { /* add two deltas from table */
|
||||
int t = dst[out - pitch] + (table[c * 2] - 128);
|
||||
int t;
|
||||
if (c <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
t = dst[out - pitch] + (table[c * 2] - 128);
|
||||
t = av_clip_uint8(t);
|
||||
dst[out] = t;
|
||||
out++;
|
||||
@@ -116,12 +123,16 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
|
||||
|
||||
for (j = 0; j < height; j++) {
|
||||
out = 0;
|
||||
if (get_bits_left(&ctx->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (out < width) {
|
||||
c = ir2_get_code(&ctx->gb);
|
||||
if (c >= 0x80) { /* we have a skip */
|
||||
c -= 0x7F;
|
||||
out += c * 2;
|
||||
} else { /* add two deltas from table */
|
||||
if (c <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
t = dst[out] + (((table[c * 2] - 128)*3) >> 2);
|
||||
t = av_clip_uint8(t);
|
||||
dst[out] = t;
|
||||
|
||||
@@ -243,7 +243,7 @@ void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
|
||||
#define INV_HAAR8(s1, s5, s3, s7, s2, s4, s6, s8,\
|
||||
d1, d2, d3, d4, d5, d6, d7, d8,\
|
||||
t0, t1, t2, t3, t4, t5, t6, t7, t8) {\
|
||||
t1 = (s1) << 1; t5 = (s5) << 1;\
|
||||
t1 = (s1) * 2; t5 = (s5) * 2;\
|
||||
IVI_HAAR_BFLY(t1, t5, t1, t5, t0); IVI_HAAR_BFLY(t1, s3, t1, t3, t0);\
|
||||
IVI_HAAR_BFLY(t5, s7, t5, t7, t0); IVI_HAAR_BFLY(t1, s2, t1, t2, t0);\
|
||||
IVI_HAAR_BFLY(t3, s4, t3, t4, t0); IVI_HAAR_BFLY(t5, s6, t5, t6, t0);\
|
||||
@@ -284,10 +284,10 @@ void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
|
||||
if (flags[i]) {
|
||||
/* pre-scaling */
|
||||
shift = !(i & 4);
|
||||
sp1 = src[ 0] << shift;
|
||||
sp2 = src[ 8] << shift;
|
||||
sp3 = src[16] << shift;
|
||||
sp4 = src[24] << shift;
|
||||
sp1 = src[ 0] * (1 << shift);
|
||||
sp2 = src[ 8] * (1 << shift);
|
||||
sp3 = src[16] * (1 << shift);
|
||||
sp4 = src[24] * (1 << shift);
|
||||
INV_HAAR8( sp1, sp2, sp3, sp4,
|
||||
src[32], src[40], src[48], src[56],
|
||||
dst[ 0], dst[ 8], dst[16], dst[24],
|
||||
|
||||
@@ -98,7 +98,7 @@ static uint32_t softfloat_mul(uint32_t x, uint64_t mantissa)
|
||||
|
||||
static uint8_t lag_calc_zero_run(int8_t x)
|
||||
{
|
||||
return (x << 1) ^ (x >> 7);
|
||||
return (x * 2) ^ (x >> 7);
|
||||
}
|
||||
|
||||
static int lag_decode_prob(GetBitContext *gb, uint32_t *value)
|
||||
@@ -191,7 +191,9 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
|
||||
}
|
||||
|
||||
scale_factor++;
|
||||
cumulative_target = 1 << scale_factor;
|
||||
if (scale_factor >= 32U)
|
||||
return AVERROR_INVALIDDATA;
|
||||
cumulative_target = 1U << scale_factor;
|
||||
|
||||
if (scaled_cumul_prob > cumulative_target) {
|
||||
av_log(rac->avctx, AV_LOG_ERROR,
|
||||
|
||||
@@ -97,6 +97,8 @@ 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)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
AV_QSORT(he, 1024, HuffEntry, huff_cmp_len10);
|
||||
|
||||
@@ -127,6 +129,8 @@ 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)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
AV_QSORT(he, 256, HuffEntry, huff_cmp_len);
|
||||
|
||||
|
||||
+3
-3
@@ -73,7 +73,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
|
||||
if (diff >= 0xffff)
|
||||
return AVERROR_INVALIDDATA;
|
||||
a->last_dc[component] += diff;
|
||||
block[0] = a->last_dc[component] << 3;
|
||||
block[0] = a->last_dc[component] * (1 << 3);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
@@ -111,11 +111,11 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
|
||||
j = scantable[i];
|
||||
if (level < 0) {
|
||||
level = -level;
|
||||
level = (level * qscale * quant_matrix[j]) >> 3;
|
||||
level = (level * (unsigned)qscale * quant_matrix[j]) >> 3;
|
||||
level = (level - 1) | 1;
|
||||
level = -level;
|
||||
} else {
|
||||
level = (level * qscale * quant_matrix[j]) >> 3;
|
||||
level = (level * (unsigned)qscale * quant_matrix[j]) >> 3;
|
||||
level = (level - 1) | 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1129,9 +1129,11 @@ fail:
|
||||
|
||||
FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
|
||||
{
|
||||
int ret = -1;
|
||||
JNIEnv *env = NULL;
|
||||
FFAMediaCodec *codec = NULL;
|
||||
jstring codec_name = NULL;
|
||||
jobject object = NULL;
|
||||
|
||||
codec = av_mallocz(sizeof(FFAMediaCodec));
|
||||
if (!codec) {
|
||||
@@ -1154,12 +1156,12 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name);
|
||||
object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name);
|
||||
if (ff_jni_exception_check(env, 1, codec) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->object = (*env)->NewGlobalRef(env, codec->object);
|
||||
codec->object = (*env)->NewGlobalRef(env, object);
|
||||
if (!codec->object) {
|
||||
goto fail;
|
||||
}
|
||||
@@ -1172,24 +1174,31 @@ FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name)
|
||||
codec->has_get_i_o_buffer = 1;
|
||||
}
|
||||
|
||||
return codec;
|
||||
ret = 0;
|
||||
fail:
|
||||
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
|
||||
|
||||
if (codec_name) {
|
||||
(*env)->DeleteLocalRef(env, codec_name);
|
||||
}
|
||||
|
||||
av_freep(&codec);
|
||||
if (object) {
|
||||
(*env)->DeleteLocalRef(env, object);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (ret < 0) {
|
||||
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
|
||||
av_freep(&codec);
|
||||
}
|
||||
|
||||
return codec;
|
||||
}
|
||||
|
||||
FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime)
|
||||
{
|
||||
int ret = -1;
|
||||
JNIEnv *env = NULL;
|
||||
FFAMediaCodec *codec = NULL;
|
||||
jstring mime_type = NULL;
|
||||
jobject object = NULL;
|
||||
|
||||
codec = av_mallocz(sizeof(FFAMediaCodec));
|
||||
if (!codec) {
|
||||
@@ -1212,12 +1221,12 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type);
|
||||
object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_decoder_by_type_id, mime_type);
|
||||
if (ff_jni_exception_check(env, 1, codec) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->object = (*env)->NewGlobalRef(env, codec->object);
|
||||
codec->object = (*env)->NewGlobalRef(env, object);
|
||||
if (!codec->object) {
|
||||
goto fail;
|
||||
}
|
||||
@@ -1230,24 +1239,31 @@ FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime)
|
||||
codec->has_get_i_o_buffer = 1;
|
||||
}
|
||||
|
||||
return codec;
|
||||
ret = 0;
|
||||
fail:
|
||||
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
|
||||
|
||||
if (mime_type) {
|
||||
(*env)->DeleteLocalRef(env, mime_type);
|
||||
}
|
||||
|
||||
av_freep(&codec);
|
||||
if (object) {
|
||||
(*env)->DeleteLocalRef(env, object);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (ret < 0) {
|
||||
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
|
||||
av_freep(&codec);
|
||||
}
|
||||
|
||||
return codec;
|
||||
}
|
||||
|
||||
FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime)
|
||||
{
|
||||
int ret = -1;
|
||||
JNIEnv *env = NULL;
|
||||
FFAMediaCodec *codec = NULL;
|
||||
jstring mime_type = NULL;
|
||||
jobject object = NULL;
|
||||
|
||||
codec = av_mallocz(sizeof(FFAMediaCodec));
|
||||
if (!codec) {
|
||||
@@ -1270,12 +1286,12 @@ FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, mime_type);
|
||||
object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_encoder_by_type_id, mime_type);
|
||||
if (ff_jni_exception_check(env, 1, codec) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
codec->object = (*env)->NewGlobalRef(env, codec->object);
|
||||
codec->object = (*env)->NewGlobalRef(env, object);
|
||||
if (!codec->object) {
|
||||
goto fail;
|
||||
}
|
||||
@@ -1288,17 +1304,22 @@ FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime)
|
||||
codec->has_get_i_o_buffer = 1;
|
||||
}
|
||||
|
||||
return codec;
|
||||
ret = 0;
|
||||
fail:
|
||||
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
|
||||
|
||||
if (mime_type) {
|
||||
(*env)->DeleteLocalRef(env, mime_type);
|
||||
}
|
||||
|
||||
av_freep(&codec);
|
||||
if (object) {
|
||||
(*env)->DeleteLocalRef(env, object);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (ret < 0) {
|
||||
ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);
|
||||
av_freep(&codec);
|
||||
}
|
||||
|
||||
return codec;
|
||||
}
|
||||
|
||||
int ff_AMediaCodec_delete(FFAMediaCodec* codec)
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
|
||||
|
||||
coeff = vlcdec_lookup[num_bits][value];
|
||||
if (pos < 3)
|
||||
coeff <<= 4;
|
||||
coeff *= 16;
|
||||
else /* TODO Use >> 10 instead of / 1001 */
|
||||
coeff = (coeff * qscale) / 1001;
|
||||
|
||||
|
||||
@@ -757,7 +757,8 @@ static int decode_block_progressive(MJpegDecodeContext *s, int16_t *block,
|
||||
uint16_t *quant_matrix,
|
||||
int ss, int se, int Al, int *EOBRUN)
|
||||
{
|
||||
int code, i, j, level, val, run;
|
||||
int code, i, j, val, run;
|
||||
unsigned level;
|
||||
|
||||
if (*EOBRUN) {
|
||||
(*EOBRUN)--;
|
||||
|
||||
@@ -91,13 +91,17 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
|
||||
{
|
||||
int i, j, size;
|
||||
uint8_t *ptr;
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
MpegEncContext *s = NULL;
|
||||
|
||||
/* Since avctx->priv_data will point to LJpegEncContext in this case */
|
||||
if (avctx->codec_id != AV_CODEC_ID_LJPEG)
|
||||
s = avctx->priv_data;
|
||||
|
||||
if (avctx->codec_id != AV_CODEC_ID_LJPEG) {
|
||||
int matrix_count = 1 + !!memcmp(luma_intra_matrix,
|
||||
chroma_intra_matrix,
|
||||
sizeof(luma_intra_matrix[0]) * 64);
|
||||
if (s->force_duplicated_matrix)
|
||||
if (s && s->force_duplicated_matrix)
|
||||
matrix_count = 2;
|
||||
/* quant matrixes */
|
||||
put_marker(p, DQT);
|
||||
@@ -134,7 +138,7 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
|
||||
|
||||
// Only MJPEG can have a variable Huffman variable. All other
|
||||
// formats use the default Huffman table.
|
||||
if (s->out_format == FMT_MJPEG && s->huffman == HUFFMAN_TABLE_OPTIMAL) {
|
||||
if (s && s->huffman == HUFFMAN_TABLE_OPTIMAL) {
|
||||
size += put_huffman_table(p, 0, 0, s->mjpeg_ctx->bits_dc_luminance,
|
||||
s->mjpeg_ctx->val_dc_luminance);
|
||||
size += put_huffman_table(p, 0, 1, s->mjpeg_ctx->bits_dc_chrominance,
|
||||
|
||||
@@ -87,6 +87,8 @@ void ff_mjpegenc_huffman_compute_bits(PTable *prob_table, HuffTable *distincts,
|
||||
|
||||
int min;
|
||||
|
||||
av_assert0(max_length > 0);
|
||||
|
||||
to->nitems = 0;
|
||||
from->nitems = 0;
|
||||
to->item_idx[0] = 0;
|
||||
|
||||
+9
-4
@@ -264,7 +264,7 @@ static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
result = (result << lsb_bits) + get_bits(gbp, lsb_bits);
|
||||
|
||||
result += cp->sign_huff_offset;
|
||||
result <<= quant_step_size;
|
||||
result *= 1 << quant_step_size;
|
||||
|
||||
m->sample_buffer[pos + s->blockpos][channel] = result;
|
||||
}
|
||||
@@ -684,7 +684,7 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
}
|
||||
|
||||
for (i = 0; i < order; i++)
|
||||
fcoeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift;
|
||||
fcoeff[i] = get_sbits(gbp, coeff_bits) * (1 << coeff_shift);
|
||||
|
||||
if (get_bits1(gbp)) {
|
||||
int state_bits, state_shift;
|
||||
@@ -999,8 +999,8 @@ static void generate_2_noise_channels(MLPDecodeContext *m, unsigned int substr)
|
||||
|
||||
for (i = 0; i < s->blockpos; i++) {
|
||||
uint16_t seed_shr7 = seed >> 7;
|
||||
m->sample_buffer[i][maxchan+1] = ((int8_t)(seed >> 15)) << s->noise_shift;
|
||||
m->sample_buffer[i][maxchan+2] = ((int8_t) seed_shr7) << s->noise_shift;
|
||||
m->sample_buffer[i][maxchan+1] = ((int8_t)(seed >> 15)) * (1 << s->noise_shift);
|
||||
m->sample_buffer[i][maxchan+2] = ((int8_t) seed_shr7) * (1 << s->noise_shift);
|
||||
|
||||
seed = (seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);
|
||||
}
|
||||
@@ -1162,6 +1162,11 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
|
||||
substr_header_size += 2;
|
||||
}
|
||||
|
||||
if (length < header_size + substr_header_size) {
|
||||
av_log(m->avctx, AV_LOG_ERROR, "Insuffient data for headers\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(nonrestart_substr ^ m->is_major_sync_unit)) {
|
||||
av_log(m->avctx, AV_LOG_ERROR, "Invalid nonrestart_substr.\n");
|
||||
goto error;
|
||||
|
||||
+2
-2
@@ -113,8 +113,8 @@ int32_t ff_mlp_pack_output(int32_t lossless_check_data,
|
||||
for (i = 0; i < blockpos; i++) {
|
||||
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]
|
||||
<< output_shift[mat_ch];
|
||||
int32_t sample = sample_buffer[i][mat_ch] *
|
||||
(1 << output_shift[mat_ch]);
|
||||
lossless_check_data ^= (sample & 0xffffff) << mat_ch;
|
||||
if (is32)
|
||||
*data_32++ = sample << 8;
|
||||
|
||||
@@ -1242,7 +1242,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
|
||||
// MPEG-1 aspect
|
||||
avctx->sample_aspect_ratio = av_d2q(1.0 / ff_mpeg1_aspect[s->aspect_ratio_info], 255);
|
||||
AVRational aspect_inv = av_d2q(ff_mpeg1_aspect[s->aspect_ratio_info], 255);
|
||||
avctx->sample_aspect_ratio = (AVRational) { aspect_inv.den, aspect_inv.num };
|
||||
} else { // MPEG-2
|
||||
// MPEG-2 aspect
|
||||
if (s->aspect_ratio_info > 1) {
|
||||
|
||||
+64
-62
@@ -178,6 +178,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int min_ab, i, w2, h2, w3, h3;
|
||||
int sprite_ref[4][2];
|
||||
int virtual_ref[2][2];
|
||||
int64_t sprite_offset[2][2];
|
||||
|
||||
// only true for rectangle shapes
|
||||
const int vop_ref[4][2] = { { 0, 0 }, { s->width, 0 },
|
||||
@@ -257,10 +258,10 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
|
||||
switch (ctx->num_sprite_warping_points) {
|
||||
case 0:
|
||||
s->sprite_offset[0][0] =
|
||||
s->sprite_offset[0][1] =
|
||||
s->sprite_offset[1][0] =
|
||||
s->sprite_offset[1][1] = 0;
|
||||
sprite_offset[0][0] =
|
||||
sprite_offset[0][1] =
|
||||
sprite_offset[1][0] =
|
||||
sprite_offset[1][1] = 0;
|
||||
s->sprite_delta[0][0] = a;
|
||||
s->sprite_delta[0][1] =
|
||||
s->sprite_delta[1][0] = 0;
|
||||
@@ -269,11 +270,11 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
ctx->sprite_shift[1] = 0;
|
||||
break;
|
||||
case 1: // GMC only
|
||||
s->sprite_offset[0][0] = sprite_ref[0][0] - a * vop_ref[0][0];
|
||||
s->sprite_offset[0][1] = sprite_ref[0][1] - a * vop_ref[0][1];
|
||||
s->sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) -
|
||||
sprite_offset[0][0] = sprite_ref[0][0] - a * vop_ref[0][0];
|
||||
sprite_offset[0][1] = sprite_ref[0][1] - a * vop_ref[0][1];
|
||||
sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) -
|
||||
a * (vop_ref[0][0] / 2);
|
||||
s->sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) -
|
||||
sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) -
|
||||
a * (vop_ref[0][1] / 2);
|
||||
s->sprite_delta[0][0] = a;
|
||||
s->sprite_delta[0][1] =
|
||||
@@ -283,22 +284,22 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
ctx->sprite_shift[1] = 0;
|
||||
break;
|
||||
case 2:
|
||||
s->sprite_offset[0][0] = (sprite_ref[0][0] * (1 << alpha + rho)) +
|
||||
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));
|
||||
s->sprite_offset[0][1] = (sprite_ref[0][1] * (1 << alpha + rho)) +
|
||||
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));
|
||||
s->sprite_offset[1][0] = ((-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
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)));
|
||||
s->sprite_offset[1][1] = ((-r * sprite_ref[0][1] + virtual_ref[0][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 *
|
||||
@@ -315,30 +316,22 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
min_ab = FFMIN(alpha, beta);
|
||||
w3 = w2 >> min_ab;
|
||||
h3 = h2 >> min_ab;
|
||||
s->sprite_offset[0][0] = (sprite_ref[0][0] * (1<<(alpha + beta + rho - min_ab))) +
|
||||
(-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
h3 * (-vop_ref[0][0]) +
|
||||
(-r * sprite_ref[0][0] + virtual_ref[1][0]) *
|
||||
w3 * (-vop_ref[0][1]) +
|
||||
(1 << (alpha + beta + rho - min_ab - 1));
|
||||
s->sprite_offset[0][1] = (sprite_ref[0][1] * (1 << (alpha + beta + rho - min_ab))) +
|
||||
(-r * sprite_ref[0][1] + virtual_ref[0][1]) *
|
||||
h3 * (-vop_ref[0][0]) +
|
||||
(-r * sprite_ref[0][1] + virtual_ref[1][1]) *
|
||||
w3 * (-vop_ref[0][1]) +
|
||||
(1 << (alpha + beta + rho - min_ab - 1));
|
||||
s->sprite_offset[1][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) *
|
||||
h3 * (-2 * vop_ref[0][0] + 1) +
|
||||
(-r * sprite_ref[0][0] + virtual_ref[1][0]) *
|
||||
w3 * (-2 * vop_ref[0][1] + 1) + 2 * w2 * h3 *
|
||||
r * sprite_ref[0][0] - 16 * w2 * h3 +
|
||||
(1 << (alpha + beta + rho - min_ab + 1));
|
||||
s->sprite_offset[1][1] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) *
|
||||
h3 * (-2 * vop_ref[0][0] + 1) +
|
||||
(-r * sprite_ref[0][1] + virtual_ref[1][1]) *
|
||||
w3 * (-2 * vop_ref[0][1] + 1) + 2 * w2 * h3 *
|
||||
r * sprite_ref[0][1] - 16 * w2 * h3 +
|
||||
(1 << (alpha + beta + rho - min_ab + 1));
|
||||
sprite_offset[0][0] = ((int64_t)sprite_ref[0][0] * (1 << (alpha + beta + rho - min_ab))) +
|
||||
((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-vop_ref[0][0]) +
|
||||
((int64_t)-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-vop_ref[0][1]) +
|
||||
((int64_t)1 << (alpha + beta + rho - min_ab - 1));
|
||||
sprite_offset[0][1] = ((int64_t)sprite_ref[0][1] * (1 << (alpha + beta + rho - min_ab))) +
|
||||
((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-vop_ref[0][0]) +
|
||||
((int64_t)-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-vop_ref[0][1]) +
|
||||
((int64_t)1 << (alpha + beta + rho - min_ab - 1));
|
||||
sprite_offset[1][0] = ((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-2 * vop_ref[0][0] + 1) +
|
||||
((int64_t)-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-2 * vop_ref[0][1] + 1) +
|
||||
(int64_t)2 * w2 * h3 * r * sprite_ref[0][0] - 16 * w2 * h3 +
|
||||
((int64_t)1 << (alpha + beta + rho - min_ab + 1));
|
||||
sprite_offset[1][1] = ((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-2 * vop_ref[0][0] + 1) +
|
||||
((int64_t)-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-2 * vop_ref[0][1] + 1) +
|
||||
(int64_t)2 * w2 * h3 * r * sprite_ref[0][1] - 16 * w2 * h3 +
|
||||
((int64_t)1 << (alpha + beta + rho - min_ab + 1));
|
||||
s->sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3;
|
||||
s->sprite_delta[0][1] = (-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3;
|
||||
s->sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3;
|
||||
@@ -353,10 +346,10 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
s->sprite_delta[0][1] == 0 &&
|
||||
s->sprite_delta[1][0] == 0 &&
|
||||
s->sprite_delta[1][1] == a << ctx->sprite_shift[0]) {
|
||||
s->sprite_offset[0][0] >>= ctx->sprite_shift[0];
|
||||
s->sprite_offset[0][1] >>= ctx->sprite_shift[0];
|
||||
s->sprite_offset[1][0] >>= ctx->sprite_shift[1];
|
||||
s->sprite_offset[1][1] >>= ctx->sprite_shift[1];
|
||||
sprite_offset[0][0] >>= ctx->sprite_shift[0];
|
||||
sprite_offset[0][1] >>= ctx->sprite_shift[0];
|
||||
sprite_offset[1][0] >>= ctx->sprite_shift[1];
|
||||
sprite_offset[1][1] >>= ctx->sprite_shift[1];
|
||||
s->sprite_delta[0][0] = a;
|
||||
s->sprite_delta[0][1] = 0;
|
||||
s->sprite_delta[1][0] = 0;
|
||||
@@ -369,18 +362,18 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int shift_c = 16 - ctx->sprite_shift[1];
|
||||
|
||||
if (shift_c < 0 || shift_y < 0 ||
|
||||
FFABS(s->sprite_offset[0][0]) >= INT_MAX >> shift_y ||
|
||||
FFABS(s->sprite_offset[1][0]) >= INT_MAX >> shift_c ||
|
||||
FFABS(s->sprite_offset[0][1]) >= INT_MAX >> shift_y ||
|
||||
FFABS(s->sprite_offset[1][1]) >= INT_MAX >> shift_c
|
||||
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++) {
|
||||
s->sprite_offset[0][i] *= 1 << shift_y;
|
||||
s->sprite_offset[1][i] *= 1 << shift_c;
|
||||
sprite_offset[0][i] *= 1 << shift_y;
|
||||
sprite_offset[1][i] *= 1 << shift_c;
|
||||
s->sprite_delta[0][i] *= 1 << shift_y;
|
||||
s->sprite_delta[1][i] *= 1 << shift_y;
|
||||
ctx->sprite_shift[i] = 16;
|
||||
@@ -392,16 +385,16 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
s->sprite_delta[i][1] - a * (1LL<<16)
|
||||
};
|
||||
|
||||
if (llabs(s->sprite_offset[0][i] + s->sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_offset[0][i] + s->sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_offset[0][i] + s->sprite_delta[i][0] * (w+16LL) + s->sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
if (llabs(sprite_offset[0][i] + s->sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + s->sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + s->sprite_delta[i][0] * (w+16LL) + s->sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_delta[i][1] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sd[0]) >= INT_MAX ||
|
||||
llabs(sd[1]) >= INT_MAX ||
|
||||
llabs(s->sprite_offset[0][i] + sd[0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_offset[0][i] + sd[1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(s->sprite_offset[0][i] + sd[0] * (w+16LL) + sd[1] * (h+16LL)) >= INT_MAX
|
||||
llabs(sprite_offset[0][i] + sd[0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + sd[1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + sd[0] * (w+16LL) + sd[1] * (h+16LL)) >= INT_MAX
|
||||
) {
|
||||
avpriv_request_sample(s->avctx, "Overflow on sprite points");
|
||||
goto overflow;
|
||||
@@ -410,6 +403,11 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
s->real_sprite_warping_points = ctx->num_sprite_warping_points;
|
||||
}
|
||||
|
||||
s->sprite_offset[0][0] = sprite_offset[0][0];
|
||||
s->sprite_offset[0][1] = sprite_offset[0][1];
|
||||
s->sprite_offset[1][0] = sprite_offset[1][0];
|
||||
s->sprite_offset[1][1] = sprite_offset[1][1];
|
||||
|
||||
return 0;
|
||||
overflow:
|
||||
memset(s->sprite_offset, 0, sizeof(s->sprite_offset));
|
||||
@@ -2457,16 +2455,20 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
|
||||
}
|
||||
|
||||
if (s->pict_type == AV_PICTURE_TYPE_S &&
|
||||
(ctx->vol_sprite_usage == STATIC_SPRITE ||
|
||||
ctx->vol_sprite_usage == GMC_SPRITE)) {
|
||||
if (mpeg4_decode_sprite_trajectory(ctx, gb) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (ctx->sprite_brightness_change)
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"sprite_brightness_change not supported\n");
|
||||
if (ctx->vol_sprite_usage == STATIC_SPRITE)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n");
|
||||
if (s->pict_type == AV_PICTURE_TYPE_S) {
|
||||
if((ctx->vol_sprite_usage == STATIC_SPRITE ||
|
||||
ctx->vol_sprite_usage == GMC_SPRITE)) {
|
||||
if (mpeg4_decode_sprite_trajectory(ctx, gb) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (ctx->sprite_brightness_change)
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"sprite_brightness_change not supported\n");
|
||||
if (ctx->vol_sprite_usage == STATIC_SPRITE)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n");
|
||||
} else {
|
||||
memset(s->sprite_offset, 0, sizeof(s->sprite_offset));
|
||||
memset(s->sprite_delta, 0, sizeof(s->sprite_delta));
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->shape != BIN_ONLY_SHAPE) {
|
||||
|
||||
@@ -399,6 +399,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_AMV || (avctx->active_thread_type & FF_THREAD_SLICE))
|
||||
s->huffman = 0;
|
||||
|
||||
if (s->intra_dc_precision > (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ? 3 : 0)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "intra dc precision too large\n");
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
+14
-3
@@ -140,7 +140,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
if(s->msmpeg4_version==2)
|
||||
cbp= get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1);
|
||||
else
|
||||
cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1);
|
||||
cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
|
||||
if(cbp<0 || cbp>3){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
|
||||
return -1;
|
||||
@@ -169,12 +169,23 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
||||
s->mv[0][0][1] = my;
|
||||
*mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
|
||||
} else {
|
||||
int v;
|
||||
if(s->msmpeg4_version==2){
|
||||
s->ac_pred = get_bits1(&s->gb);
|
||||
cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
|
||||
v = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
|
||||
if (v < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cbpy vlc invalid\n");
|
||||
return -1;
|
||||
}
|
||||
cbp|= v<<2;
|
||||
} else{
|
||||
s->ac_pred = 0;
|
||||
cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
|
||||
v = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
|
||||
if (v < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cbpy vlc invalid\n");
|
||||
return -1;
|
||||
}
|
||||
cbp|= v<<2;
|
||||
if(s->pict_type==AV_PICTURE_TYPE_P) cbp^=0x3C;
|
||||
}
|
||||
*mb_type_ptr = MB_TYPE_INTRA;
|
||||
|
||||
+2
-1
@@ -356,8 +356,9 @@ static int rac_get_model2_sym(RangeCoder *c, Model2 *m)
|
||||
|
||||
static int rac_get_model_sym(RangeCoder *c, Model *m)
|
||||
{
|
||||
int prob, prob2, helper, val;
|
||||
int val;
|
||||
int end, end2;
|
||||
unsigned prob, prob2, helper;
|
||||
|
||||
prob = 0;
|
||||
prob2 = c->range;
|
||||
|
||||
+22
-22
@@ -62,30 +62,30 @@ void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma)
|
||||
}
|
||||
|
||||
#define DCT_TEMPLATE(blk, step, SOP, shift) \
|
||||
const int t0 = -39409 * blk[7 * step] - 58980 * blk[1 * step]; \
|
||||
const int t1 = 39410 * blk[1 * step] - 58980 * blk[7 * step]; \
|
||||
const int t2 = -33410 * blk[5 * step] - 167963 * blk[3 * step]; \
|
||||
const int t3 = 33410 * blk[3 * step] - 167963 * blk[5 * step]; \
|
||||
const int t4 = blk[3 * step] + blk[7 * step]; \
|
||||
const int t5 = blk[1 * step] + blk[5 * step]; \
|
||||
const int t6 = 77062 * t4 + 51491 * t5; \
|
||||
const int t7 = 77062 * t5 - 51491 * t4; \
|
||||
const int t8 = 35470 * blk[2 * step] - 85623 * blk[6 * step]; \
|
||||
const int t9 = 35470 * blk[6 * step] + 85623 * blk[2 * step]; \
|
||||
const int tA = SOP(blk[0 * step] - blk[4 * step]); \
|
||||
const int tB = SOP(blk[0 * step] + blk[4 * step]); \
|
||||
const unsigned t0 =-39409U * blk[7 * step] - 58980U * blk[1 * step]; \
|
||||
const unsigned t1 = 39410U * blk[1 * step] - 58980U * blk[7 * step]; \
|
||||
const unsigned t2 =-33410U * blk[5 * step] -167963U * blk[3 * step]; \
|
||||
const unsigned t3 = 33410U * blk[3 * step] -167963U * blk[5 * step]; \
|
||||
const unsigned t4 = blk[3 * step] + blk[7 * step]; \
|
||||
const unsigned t5 = blk[1 * step] + blk[5 * step]; \
|
||||
const unsigned t6 = 77062U * t4 + 51491U * t5; \
|
||||
const unsigned t7 = 77062U * t5 - 51491U * t4; \
|
||||
const unsigned t8 = 35470U * blk[2 * step] - 85623U * blk[6 * step]; \
|
||||
const unsigned t9 = 35470U * blk[6 * step] + 85623U * blk[2 * step]; \
|
||||
const unsigned tA = SOP(blk[0 * step] - blk[4 * step]); \
|
||||
const unsigned tB = SOP(blk[0 * step] + blk[4 * step]); \
|
||||
\
|
||||
blk[0 * step] = ( t1 + t6 + t9 + tB) >> shift; \
|
||||
blk[1 * step] = ( t3 + t7 + t8 + tA) >> shift; \
|
||||
blk[2 * step] = ( t2 + t6 - t8 + tA) >> shift; \
|
||||
blk[3 * step] = ( t0 + t7 - t9 + tB) >> shift; \
|
||||
blk[4 * step] = (-(t0 + t7) - t9 + tB) >> shift; \
|
||||
blk[5 * step] = (-(t2 + t6) - t8 + tA) >> shift; \
|
||||
blk[6 * step] = (-(t3 + t7) + t8 + tA) >> shift; \
|
||||
blk[7 * step] = (-(t1 + t6) + t9 + tB) >> shift; \
|
||||
blk[0 * step] = (int)( t1 + t6 + t9 + tB) >> shift; \
|
||||
blk[1 * step] = (int)( t3 + t7 + t8 + tA) >> shift; \
|
||||
blk[2 * step] = (int)( t2 + t6 - t8 + tA) >> shift; \
|
||||
blk[3 * step] = (int)( t0 + t7 - t9 + tB) >> shift; \
|
||||
blk[4 * step] = (int)(-(t0 + t7) - t9 + tB) >> shift; \
|
||||
blk[5 * step] = (int)(-(t2 + t6) - t8 + tA) >> shift; \
|
||||
blk[6 * step] = (int)(-(t3 + t7) + t8 + tA) >> shift; \
|
||||
blk[7 * step] = (int)(-(t1 + t6) + t9 + tB) >> shift; \
|
||||
|
||||
#define SOP_ROW(a) (((a) << 16) + 0x2000)
|
||||
#define SOP_COL(a) (((a) + 32) << 16)
|
||||
#define SOP_ROW(a) (((a) * (1U << 16)) + 0x2000)
|
||||
#define SOP_COL(a) (((a) + 32) * (1U << 16))
|
||||
|
||||
void ff_mss34_dct_put(uint8_t *dst, ptrdiff_t stride, int *block)
|
||||
{
|
||||
|
||||
@@ -301,6 +301,12 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
|
||||
s->buf = buf;
|
||||
s->size = buf_size;
|
||||
|
||||
// Discard frame if its smaller than the minimum frame size
|
||||
if (buf_size < (avctx->width/4) * (avctx->height/4) / 512) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ const int16_t ff_nelly_delta_table[32] = {
|
||||
|
||||
static inline int signed_shift(int i, int shift) {
|
||||
if (shift > 0)
|
||||
return i << shift;
|
||||
return (unsigned)i << shift;
|
||||
return i >> -shift;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ static int headroom(int *la)
|
||||
return 31;
|
||||
}
|
||||
l = 30 - av_log2(FFABS(*la));
|
||||
*la <<= l;
|
||||
*la *= 1<<l;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
+30
-15
@@ -188,6 +188,31 @@ void avcodec_free_context(AVCodecContext **pavctx)
|
||||
}
|
||||
|
||||
#if FF_API_COPY_CONTEXT
|
||||
static void copy_context_reset(AVCodecContext *avctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
av_opt_free(avctx);
|
||||
#if FF_API_CODED_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
av_frame_free(&avctx->coded_frame);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
av_freep(&avctx->rc_override);
|
||||
av_freep(&avctx->intra_matrix);
|
||||
av_freep(&avctx->inter_matrix);
|
||||
av_freep(&avctx->extradata);
|
||||
av_freep(&avctx->subtitle_header);
|
||||
av_buffer_unref(&avctx->hw_frames_ctx);
|
||||
av_buffer_unref(&avctx->hw_device_ctx);
|
||||
for (i = 0; i < avctx->nb_coded_side_data; i++)
|
||||
av_freep(&avctx->coded_side_data[i].data);
|
||||
av_freep(&avctx->coded_side_data);
|
||||
avctx->subtitle_header_size = 0;
|
||||
avctx->nb_coded_side_data = 0;
|
||||
avctx->extradata_size = 0;
|
||||
}
|
||||
|
||||
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
|
||||
{
|
||||
const AVCodec *orig_codec = dest->codec;
|
||||
@@ -200,12 +225,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
av_opt_free(dest);
|
||||
av_freep(&dest->rc_override);
|
||||
av_freep(&dest->intra_matrix);
|
||||
av_freep(&dest->inter_matrix);
|
||||
av_freep(&dest->extradata);
|
||||
av_freep(&dest->subtitle_header);
|
||||
copy_context_reset(dest);
|
||||
|
||||
memcpy(dest, src, sizeof(*dest));
|
||||
av_opt_copy(dest, src);
|
||||
@@ -230,11 +250,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
/* reallocate values that should be allocated separately */
|
||||
dest->extradata = NULL;
|
||||
dest->coded_side_data = NULL;
|
||||
dest->intra_matrix = NULL;
|
||||
dest->inter_matrix = NULL;
|
||||
dest->rc_override = NULL;
|
||||
dest->subtitle_header = NULL;
|
||||
dest->hw_frames_ctx = NULL;
|
||||
dest->hw_device_ctx = NULL;
|
||||
dest->nb_coded_side_data = 0;
|
||||
|
||||
#define alloc_and_copy_or_fail(obj, size, pad) \
|
||||
if (src->obj && size > 0) { \
|
||||
@@ -264,15 +287,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_freep(&dest->subtitle_header);
|
||||
av_freep(&dest->rc_override);
|
||||
av_freep(&dest->intra_matrix);
|
||||
av_freep(&dest->inter_matrix);
|
||||
av_freep(&dest->extradata);
|
||||
av_buffer_unref(&dest->hw_frames_ctx);
|
||||
dest->subtitle_header_size = 0;
|
||||
dest->extradata_size = 0;
|
||||
av_opt_free(dest);
|
||||
copy_context_reset(dest);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -128,8 +128,7 @@ static inline void silk_stabilize_lsf(int16_t nlsf[16], int order, const uint16_
|
||||
if (nlsf[0] < min_delta[0])
|
||||
nlsf[0] = min_delta[0];
|
||||
for (i = 1; i < order; i++)
|
||||
if (nlsf[i] < nlsf[i - 1] + min_delta[i])
|
||||
nlsf[i] = nlsf[i - 1] + min_delta[i];
|
||||
nlsf[i] = FFMAX(nlsf[i], FFMIN(nlsf[i - 1] + min_delta[i], 32767));
|
||||
|
||||
/* push backwards to increase distance */
|
||||
if (nlsf[order-1] > 32768 - min_delta[order])
|
||||
|
||||
+4
-4
@@ -154,7 +154,7 @@ static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size, int wi
|
||||
state = 120 * (escape + flag) + state - (120 * state >> 8);
|
||||
flag = 0;
|
||||
|
||||
if (state * 4 > 0xFF || i >= size)
|
||||
if (state * 4ULL > 0xFF || i >= size)
|
||||
continue;
|
||||
|
||||
nbits = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
|
||||
@@ -173,7 +173,7 @@ static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size, int wi
|
||||
}
|
||||
}
|
||||
|
||||
if (i + rlen > size)
|
||||
if (rlen > size - i)
|
||||
return AVERROR_INVALIDDATA;
|
||||
i += rlen;
|
||||
|
||||
@@ -256,11 +256,11 @@ static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, i
|
||||
j = 0;
|
||||
dst += stride;
|
||||
}
|
||||
state += (int64_t)d * yflag - (d * state >> 8);
|
||||
state += (int64_t)d * (uint64_t)yflag - ((int64_t)(d * (uint64_t)state) >> 8);
|
||||
|
||||
flag = 0;
|
||||
|
||||
if (state * 4 > 0xFF || i >= size)
|
||||
if (state * 4ULL > 0xFF || i >= size)
|
||||
continue;
|
||||
|
||||
pfx = ((state + 8) >> 5) + (state ? ff_clz(state): 32) - 24;
|
||||
|
||||
@@ -42,11 +42,6 @@
|
||||
#define PNG_FILTER_VALUE_PAETH 4
|
||||
#define PNG_FILTER_VALUE_MIXED 5
|
||||
|
||||
#define PNG_IHDR 0x0001
|
||||
#define PNG_IDAT 0x0002
|
||||
#define PNG_ALLIMAGE 0x0004
|
||||
#define PNG_PLTE 0x0008
|
||||
|
||||
#define NB_PASSES 7
|
||||
|
||||
#define PNGSIG 0x89504e470d0a1a0a
|
||||
|
||||
+44
-30
@@ -36,6 +36,16 @@
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
enum PNGHeaderState {
|
||||
PNG_IHDR = 1 << 0,
|
||||
PNG_PLTE = 1 << 1,
|
||||
};
|
||||
|
||||
enum PNGImageState {
|
||||
PNG_IDAT = 1 << 0,
|
||||
PNG_ALLIMAGE = 1 << 1,
|
||||
};
|
||||
|
||||
typedef struct PNGDecContext {
|
||||
PNGDSPContext dsp;
|
||||
AVCodecContext *avctx;
|
||||
@@ -45,7 +55,8 @@ typedef struct PNGDecContext {
|
||||
ThreadFrame last_picture;
|
||||
ThreadFrame picture;
|
||||
|
||||
int state;
|
||||
enum PNGHeaderState hdr_state;
|
||||
enum PNGImageState pic_state;
|
||||
int width, height;
|
||||
int cur_w, cur_h;
|
||||
int last_w, last_h;
|
||||
@@ -334,7 +345,7 @@ static void png_handle_row(PNGDecContext *s)
|
||||
}
|
||||
s->y++;
|
||||
if (s->y == s->cur_h) {
|
||||
s->state |= PNG_ALLIMAGE;
|
||||
s->pic_state |= PNG_ALLIMAGE;
|
||||
if (s->filter_type == PNG_FILTER_TYPE_LOCO) {
|
||||
if (s->bit_depth == 16) {
|
||||
deloco_rgb16((uint16_t *)ptr, s->row_size / 2,
|
||||
@@ -369,7 +380,7 @@ static void png_handle_row(PNGDecContext *s)
|
||||
memset(s->last_row, 0, s->row_size);
|
||||
for (;;) {
|
||||
if (s->pass == NB_PASSES - 1) {
|
||||
s->state |= PNG_ALLIMAGE;
|
||||
s->pic_state |= PNG_ALLIMAGE;
|
||||
goto the_end;
|
||||
} else {
|
||||
s->pass++;
|
||||
@@ -404,7 +415,7 @@ static int png_decode_idat(PNGDecContext *s, int length)
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
if (s->zstream.avail_out == 0) {
|
||||
if (!(s->state & PNG_ALLIMAGE)) {
|
||||
if (!(s->pic_state & PNG_ALLIMAGE)) {
|
||||
png_handle_row(s);
|
||||
}
|
||||
s->zstream.avail_out = s->crow_size;
|
||||
@@ -541,12 +552,12 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
if (length != 13)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (s->state & PNG_IDAT) {
|
||||
if (s->pic_state & PNG_IDAT) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IHDR after IDAT\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->state & PNG_IHDR) {
|
||||
if (s->hdr_state & PNG_IHDR) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Multiple IHDR\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -569,7 +580,7 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
s->filter_type = bytestream2_get_byte(&s->gb);
|
||||
s->interlace_type = bytestream2_get_byte(&s->gb);
|
||||
bytestream2_skip(&s->gb, 4); /* crc */
|
||||
s->state |= PNG_IHDR;
|
||||
s->hdr_state |= PNG_IHDR;
|
||||
if (avctx->debug & FF_DEBUG_PICT_INFO)
|
||||
av_log(avctx, AV_LOG_DEBUG, "width=%d height=%d depth=%d color_type=%d "
|
||||
"compression_type=%d filter_type=%d interlace_type=%d\n",
|
||||
@@ -585,7 +596,7 @@ error:
|
||||
|
||||
static int decode_phys_chunk(AVCodecContext *avctx, PNGDecContext *s)
|
||||
{
|
||||
if (s->state & PNG_IDAT) {
|
||||
if (s->pic_state & PNG_IDAT) {
|
||||
av_log(avctx, AV_LOG_ERROR, "pHYs after IDAT\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -605,14 +616,15 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
int ret;
|
||||
size_t byte_depth = s->bit_depth > 8 ? 2 : 1;
|
||||
|
||||
if (!(s->state & PNG_IHDR)) {
|
||||
if (!(s->hdr_state & PNG_IHDR)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (!(s->state & PNG_IDAT)) {
|
||||
if (!(s->pic_state & PNG_IDAT)) {
|
||||
/* init image info */
|
||||
avctx->width = s->width;
|
||||
avctx->height = s->height;
|
||||
ret = ff_set_dimensions(avctx, s->width, s->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
s->channels = ff_png_get_nb_channels(s->color_type);
|
||||
s->bits_per_pixel = s->bit_depth * s->channels;
|
||||
@@ -690,12 +702,12 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
if ((ret = ff_thread_get_buffer(avctx, &s->previous_picture, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
return ret;
|
||||
}
|
||||
ff_thread_finish_setup(avctx);
|
||||
|
||||
p->pict_type = AV_PICTURE_TYPE_I;
|
||||
p->key_frame = 1;
|
||||
p->interlaced_frame = !!s->interlace_type;
|
||||
|
||||
ff_thread_finish_setup(avctx);
|
||||
|
||||
/* compute the compressed row size */
|
||||
if (!s->interlace_type) {
|
||||
s->crow_size = s->row_size + 1;
|
||||
@@ -734,7 +746,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
s->zstream.next_out = s->crow_buf;
|
||||
}
|
||||
|
||||
s->state |= PNG_IDAT;
|
||||
s->pic_state |= PNG_IDAT;
|
||||
|
||||
/* set image to non-transparent bpp while decompressing */
|
||||
if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||
@@ -770,7 +782,7 @@ static int decode_plte_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
}
|
||||
for (; i < 256; i++)
|
||||
s->palette[i] = (0xFFU << 24);
|
||||
s->state |= PNG_PLTE;
|
||||
s->hdr_state |= PNG_PLTE;
|
||||
bytestream2_skip(&s->gb, 4); /* crc */
|
||||
|
||||
return 0;
|
||||
@@ -781,18 +793,18 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
{
|
||||
int v, i;
|
||||
|
||||
if (!(s->state & PNG_IHDR)) {
|
||||
if (!(s->hdr_state & PNG_IHDR)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "trns before IHDR\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->state & PNG_IDAT) {
|
||||
if (s->pic_state & PNG_IDAT) {
|
||||
av_log(avctx, AV_LOG_ERROR, "trns after IDAT\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
if (length > 256 || !(s->state & PNG_PLTE))
|
||||
if (length > 256 || !(s->hdr_state & PNG_PLTE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
@@ -906,7 +918,7 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
if (length != 26)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!(s->state & PNG_IHDR)) {
|
||||
if (!(s->hdr_state & PNG_IHDR)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "fctl before IHDR\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -1122,13 +1134,13 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||
}
|
||||
|
||||
if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) {
|
||||
if (!(s->state & PNG_IDAT))
|
||||
if (!(s->pic_state & PNG_IDAT))
|
||||
return 0;
|
||||
else
|
||||
goto exit_loop;
|
||||
}
|
||||
av_log(avctx, AV_LOG_ERROR, "%d bytes left\n", length);
|
||||
if ( s->state & PNG_ALLIMAGE
|
||||
if ( s->pic_state & PNG_ALLIMAGE
|
||||
&& avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL)
|
||||
goto exit_loop;
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
@@ -1228,9 +1240,9 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||
break;
|
||||
}
|
||||
case MKTAG('I', 'E', 'N', 'D'):
|
||||
if (!(s->state & PNG_ALLIMAGE))
|
||||
if (!(s->pic_state & PNG_ALLIMAGE))
|
||||
av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");
|
||||
if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {
|
||||
if (!(s->pic_state & (PNG_ALLIMAGE|PNG_IDAT))) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
@@ -1330,7 +1342,9 @@ static int decode_frame_png(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->y = s->state = s->has_trns = 0;
|
||||
s->y = s->has_trns = 0;
|
||||
s->hdr_state = 0;
|
||||
s->pic_state = 0;
|
||||
|
||||
/* init the zlib */
|
||||
s->zstream.zalloc = ff_png_zalloc;
|
||||
@@ -1377,7 +1391,7 @@ static int decode_frame_apng(AVCodecContext *avctx,
|
||||
FFSWAP(ThreadFrame, s->picture, s->last_picture);
|
||||
p = s->picture.f;
|
||||
|
||||
if (!(s->state & PNG_IHDR)) {
|
||||
if (!(s->hdr_state & PNG_IHDR)) {
|
||||
if (!avctx->extradata_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -1397,14 +1411,14 @@ static int decode_frame_apng(AVCodecContext *avctx,
|
||||
goto end;
|
||||
}
|
||||
s->y = 0;
|
||||
s->state &= ~(PNG_IDAT | PNG_ALLIMAGE);
|
||||
s->pic_state = 0;
|
||||
bytestream2_init(&s->gb, avpkt->data, avpkt->size);
|
||||
if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0)
|
||||
goto end;
|
||||
|
||||
if (!(s->state & PNG_ALLIMAGE))
|
||||
if (!(s->pic_state & PNG_ALLIMAGE))
|
||||
av_log(avctx, AV_LOG_WARNING, "Frame did not contain a complete image\n");
|
||||
if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {
|
||||
if (!(s->pic_state & (PNG_ALLIMAGE|PNG_IDAT))) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
@@ -1453,7 +1467,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
|
||||
|
||||
memcpy(pdst->palette, psrc->palette, sizeof(pdst->palette));
|
||||
|
||||
pdst->state |= psrc->state & (PNG_IHDR | PNG_PLTE);
|
||||
pdst->hdr_state |= psrc->hdr_state;
|
||||
|
||||
ff_thread_release_buffer(dst, &pdst->last_picture);
|
||||
if (psrc->last_picture.f->data[0] &&
|
||||
|
||||
+19
-15
@@ -380,7 +380,8 @@ static void release_delayed_buffers(PerThreadContext *p)
|
||||
}
|
||||
}
|
||||
|
||||
static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
|
||||
static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
|
||||
AVPacket *avpkt)
|
||||
{
|
||||
FrameThreadContext *fctx = p->parent;
|
||||
PerThreadContext *prev_thread = fctx->prev_thread;
|
||||
@@ -392,6 +393,12 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
|
||||
|
||||
pthread_mutex_lock(&p->mutex);
|
||||
|
||||
ret = update_context_from_user(p->avctx, user_avctx);
|
||||
if (ret) {
|
||||
pthread_mutex_unlock(&p->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
release_delayed_buffers(p);
|
||||
|
||||
if (prev_thread) {
|
||||
@@ -480,10 +487,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
|
||||
*/
|
||||
|
||||
p = &fctx->threads[fctx->next_decoding];
|
||||
err = update_context_from_user(p->avctx, avctx);
|
||||
if (err)
|
||||
goto finish;
|
||||
err = submit_packet(p, avpkt);
|
||||
err = submit_packet(p, avctx, avpkt);
|
||||
if (err)
|
||||
goto finish;
|
||||
|
||||
@@ -560,12 +564,12 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int field)
|
||||
atomic_load_explicit(&progress[field], memory_order_relaxed) >= n)
|
||||
return;
|
||||
|
||||
p = f->owner->internal->thread_ctx;
|
||||
|
||||
if (f->owner->debug&FF_DEBUG_THREADS)
|
||||
av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, n, field);
|
||||
p = f->owner[field]->internal->thread_ctx;
|
||||
|
||||
pthread_mutex_lock(&p->progress_mutex);
|
||||
if (f->owner[field]->debug&FF_DEBUG_THREADS)
|
||||
av_log(f->owner[field], AV_LOG_DEBUG,
|
||||
"%p finished %d field %d\n", progress, n, field);
|
||||
|
||||
atomic_store_explicit(&progress[field], n, memory_order_release);
|
||||
|
||||
@@ -582,12 +586,12 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int field)
|
||||
atomic_load_explicit(&progress[field], memory_order_acquire) >= n)
|
||||
return;
|
||||
|
||||
p = f->owner->internal->thread_ctx;
|
||||
|
||||
if (f->owner->debug&FF_DEBUG_THREADS)
|
||||
av_log(f->owner, AV_LOG_DEBUG, "thread awaiting %d field %d from %p\n", n, field, progress);
|
||||
p = f->owner[field]->internal->thread_ctx;
|
||||
|
||||
pthread_mutex_lock(&p->progress_mutex);
|
||||
if (f->owner[field]->debug&FF_DEBUG_THREADS)
|
||||
av_log(f->owner[field], AV_LOG_DEBUG,
|
||||
"thread awaiting %d field %d from %p\n", n, field, progress);
|
||||
while (atomic_load_explicit(&progress[field], memory_order_relaxed) < n)
|
||||
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
|
||||
pthread_mutex_unlock(&p->progress_mutex);
|
||||
@@ -878,7 +882,7 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
|
||||
PerThreadContext *p = avctx->internal->thread_ctx;
|
||||
int err;
|
||||
|
||||
f->owner = avctx;
|
||||
f->owner[0] = f->owner[1] = avctx;
|
||||
|
||||
ff_init_buffer_info(avctx, f->f);
|
||||
|
||||
@@ -982,7 +986,7 @@ void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
|
||||
av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p\n", f);
|
||||
|
||||
av_buffer_unref(&f->progress);
|
||||
f->owner = NULL;
|
||||
f->owner[0] = f->owner[1] = NULL;
|
||||
|
||||
if (can_direct_free) {
|
||||
av_frame_unref(f->f);
|
||||
|
||||
+1
-1
@@ -1598,7 +1598,7 @@ void ff_eval_coefs(int *coefs, const int *refl)
|
||||
int i, j;
|
||||
|
||||
for (i=0; i < LPC_ORDER; i++) {
|
||||
b1[i] = refl[i] << 4;
|
||||
b1[i] = refl[i] * 16;
|
||||
|
||||
for (j=0; j < i; j++)
|
||||
b1[j] = ((refl[i] * b2[i-j-1]) >> 12) + b2[j];
|
||||
|
||||
@@ -211,6 +211,12 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
|
||||
ctx->tiles[i].y = bytestream2_get_le16(gbc);
|
||||
ctx->tiles[i].h = bytestream2_get_le16(gbc);
|
||||
|
||||
if (pixel_size + ctx->tiles[i].w * (int64_t)ctx->tiles[i].h * ctx->component_size > INT_MAX) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid tile dimensions\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
|
||||
pixel_size += ctx->tiles[i].w * ctx->tiles[i].h * ctx->component_size;
|
||||
|
||||
ff_dlog(avctx, "tile %d orig(%d,%d) %dx%d.\n", i,
|
||||
|
||||
+4
-4
@@ -120,10 +120,10 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (avctx->bits_per_raw_sample == 24) {
|
||||
uint32_t *o = (uint32_t *)frame->data[0];
|
||||
for (; buf_size > 6; buf_size -= 7) {
|
||||
*o++ = (ff_reverse[buf[2]] << 24) |
|
||||
*o++ = ((unsigned)ff_reverse[buf[2]] << 24) |
|
||||
(ff_reverse[buf[1]] << 16) |
|
||||
(ff_reverse[buf[0]] << 8);
|
||||
*o++ = (ff_reverse[buf[6] & 0xf0] << 28) |
|
||||
*o++ = ((unsigned)ff_reverse[buf[6] & 0xf0] << 28) |
|
||||
(ff_reverse[buf[5]] << 20) |
|
||||
(ff_reverse[buf[4]] << 12) |
|
||||
(ff_reverse[buf[3] & 0x0f] << 4);
|
||||
@@ -142,10 +142,10 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
} else if (avctx->bits_per_raw_sample == 20) {
|
||||
uint32_t *o = (uint32_t *)frame->data[0];
|
||||
for (; buf_size > 5; buf_size -= 6) {
|
||||
*o++ = (ff_reverse[buf[2] & 0xf0] << 28) |
|
||||
*o++ = ((unsigned)ff_reverse[buf[2] & 0xf0] << 28) |
|
||||
(ff_reverse[buf[1]] << 20) |
|
||||
(ff_reverse[buf[0]] << 12);
|
||||
*o++ = (ff_reverse[buf[5] & 0xf0] << 28) |
|
||||
*o++ = ((unsigned)ff_reverse[buf[5] & 0xf0] << 28) |
|
||||
(ff_reverse[buf[4]] << 20) |
|
||||
(ff_reverse[buf[3]] << 12);
|
||||
buf += 6;
|
||||
|
||||
@@ -261,6 +261,9 @@ static int decode_unit(SCPRContext *s, PixelModel *pixel, unsigned step, unsigne
|
||||
break;
|
||||
c++;
|
||||
}
|
||||
if (x >= 16 || c >= 256) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((ret = s->decode(gb, rc, cumfr, cnt_c, totfr)) < 0)
|
||||
return ret;
|
||||
@@ -331,6 +334,9 @@ static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize)
|
||||
clr = (b << 16) + (g << 8) + r;
|
||||
k += run;
|
||||
while (run-- > 0) {
|
||||
if (y >= avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
dst[y * linesize + x] = clr;
|
||||
lx = x;
|
||||
ly = y;
|
||||
|
||||
@@ -160,8 +160,11 @@ static int allocate_buffers(ShortenContext *s)
|
||||
|
||||
static inline unsigned int get_uint(ShortenContext *s, int k)
|
||||
{
|
||||
if (s->version != 0)
|
||||
if (s->version != 0) {
|
||||
k = get_ur_golomb_shorten(&s->gb, ULONGSIZE);
|
||||
if (k > 31U)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return get_ur_golomb_shorten(&s->gb, k);
|
||||
}
|
||||
|
||||
|
||||
@@ -384,6 +384,10 @@ static int decode_header(SnowContext *s){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_count %d too large for size\n", s->spatial_decomposition_count);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->avctx->width > 65536-4) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Width %d is too large\n", s->avctx->width);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
s->qlog += get_symbol(&s->c, s->header_state, 1);
|
||||
@@ -395,6 +399,11 @@ static int decode_header(SnowContext *s){
|
||||
s->block_max_depth= 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (FFABS(s->qbias) > 127) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "qbias %d is too large\n", s->qbias);
|
||||
s->qbias = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+21
-21
@@ -223,7 +223,7 @@ static int svq3_decode_end(AVCodecContext *avctx);
|
||||
|
||||
static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
|
||||
{
|
||||
const int qmul = svq3_dequant_coeff[qp];
|
||||
const unsigned qmul = svq3_dequant_coeff[qp];
|
||||
#define stride 16
|
||||
int i;
|
||||
int temp[16];
|
||||
@@ -248,10 +248,10 @@ static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
|
||||
const int z2 = 7 * temp[4 * 1 + i] - 17 * temp[4 * 3 + i];
|
||||
const int z3 = 17 * temp[4 * 1 + i] + 7 * temp[4 * 3 + i];
|
||||
|
||||
output[stride * 0 + offset] = (z0 + z3) * qmul + 0x80000 >> 20;
|
||||
output[stride * 2 + offset] = (z1 + z2) * qmul + 0x80000 >> 20;
|
||||
output[stride * 8 + offset] = (z1 - z2) * qmul + 0x80000 >> 20;
|
||||
output[stride * 10 + offset] = (z0 - z3) * qmul + 0x80000 >> 20;
|
||||
output[stride * 0 + offset] = (int)((z0 + z3) * qmul + 0x80000) >> 20;
|
||||
output[stride * 2 + offset] = (int)((z1 + z2) * qmul + 0x80000) >> 20;
|
||||
output[stride * 8 + offset] = (int)((z1 - z2) * qmul + 0x80000) >> 20;
|
||||
output[stride * 10 + offset] = (int)((z0 - z3) * qmul + 0x80000) >> 20;
|
||||
}
|
||||
}
|
||||
#undef stride
|
||||
@@ -263,7 +263,7 @@ static void svq3_add_idct_c(uint8_t *dst, int16_t *block,
|
||||
int i;
|
||||
|
||||
if (dc) {
|
||||
dc = 13 * 13 * (dc == 1 ? 1538 * block[0]
|
||||
dc = 13 * 13 * (dc == 1 ? 1538U* block[0]
|
||||
: qmul * (block[0] >> 3) / 2);
|
||||
block[0] = 0;
|
||||
}
|
||||
@@ -281,16 +281,16 @@ static void svq3_add_idct_c(uint8_t *dst, int16_t *block,
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
const int z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]);
|
||||
const int z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]);
|
||||
const int z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3];
|
||||
const int z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3];
|
||||
const unsigned z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]);
|
||||
const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]);
|
||||
const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3];
|
||||
const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3];
|
||||
const int rr = (dc + 0x80000);
|
||||
|
||||
dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((z0 + z3) * qmul + rr >> 20));
|
||||
dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((z1 + z2) * qmul + rr >> 20));
|
||||
dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((z1 - z2) * qmul + rr >> 20));
|
||||
dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((z0 - z3) * qmul + rr >> 20));
|
||||
dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((int)((z0 + z3) * qmul + rr) >> 20));
|
||||
dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((int)((z1 + z2) * qmul + rr) >> 20));
|
||||
dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((int)((z1 - z2) * qmul + rr) >> 20));
|
||||
dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((int)((z0 - z3) * qmul + rr) >> 20));
|
||||
}
|
||||
|
||||
memset(block, 0, 16 * sizeof(int16_t));
|
||||
@@ -551,7 +551,7 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
|
||||
dy = get_interleaved_se_golomb(&s->gb_slice);
|
||||
dx = get_interleaved_se_golomb(&s->gb_slice);
|
||||
|
||||
if (dx == INVALID_VLC || dy == INVALID_VLC) {
|
||||
if (dx != (int16_t)dx || dy != (int16_t)dy) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid MV vlc\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -562,8 +562,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
|
||||
int fx, fy;
|
||||
mx = (mx + 1 >> 1) + dx;
|
||||
my = (my + 1 >> 1) + dy;
|
||||
fx = (unsigned)(mx + 0x3000) / 3 - 0x1000;
|
||||
fy = (unsigned)(my + 0x3000) / 3 - 0x1000;
|
||||
fx = (unsigned)(mx + 0x30000) / 3 - 0x10000;
|
||||
fy = (unsigned)(my + 0x30000) / 3 - 0x10000;
|
||||
dxy = (mx - 3 * fx) + 4 * (my - 3 * fy);
|
||||
|
||||
svq3_mc_dir_part(s, x, y, part_width, part_height,
|
||||
@@ -571,8 +571,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
|
||||
mx += mx;
|
||||
my += my;
|
||||
} else if (mode == HALFPEL_MODE || mode == PREDICT_MODE) {
|
||||
mx = (unsigned)(mx + 1 + 0x3000) / 3 + dx - 0x1000;
|
||||
my = (unsigned)(my + 1 + 0x3000) / 3 + dy - 0x1000;
|
||||
mx = (unsigned)(mx + 1 + 0x30000) / 3 + dx - 0x10000;
|
||||
my = (unsigned)(my + 1 + 0x30000) / 3 + dy - 0x10000;
|
||||
dxy = (mx & 1) + 2 * (my & 1);
|
||||
|
||||
svq3_mc_dir_part(s, x, y, part_width, part_height,
|
||||
@@ -580,8 +580,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
|
||||
mx *= 3;
|
||||
my *= 3;
|
||||
} else {
|
||||
mx = (unsigned)(mx + 3 + 0x6000) / 6 + dx - 0x1000;
|
||||
my = (unsigned)(my + 3 + 0x6000) / 6 + dy - 0x1000;
|
||||
mx = (unsigned)(mx + 3 + 0x60000) / 6 + dx - 0x10000;
|
||||
my = (unsigned)(my + 3 + 0x60000) / 6 + dy - 0x10000;
|
||||
|
||||
svq3_mc_dir_part(s, x, y, part_width, part_height,
|
||||
mx, my, 0, 0, dir, avg);
|
||||
|
||||
+6
-6
@@ -433,19 +433,19 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
|
||||
|
||||
s->predictors[0] = get_sbits(gb, 10);
|
||||
s->predictors[1] = get_sbits(gb, 10);
|
||||
s->predictors[2] = get_sbits(gb, size) << (10 - size);
|
||||
s->predictors[3] = get_sbits(gb, size) << (10 - size);
|
||||
s->predictors[2] = get_sbits(gb, size) * (1 << (10 - size));
|
||||
s->predictors[3] = get_sbits(gb, size) * (1 << (10 - size));
|
||||
if (filter_order > 4) {
|
||||
int tmp = size - get_bits1(gb);
|
||||
|
||||
for (i = 4; i < filter_order; i++) {
|
||||
if (!(i & 3))
|
||||
x = tmp - get_bits(gb, 2);
|
||||
s->predictors[i] = get_sbits(gb, x) << (10 - size);
|
||||
s->predictors[i] = get_sbits(gb, x) * (1 << (10 - size));
|
||||
}
|
||||
}
|
||||
|
||||
tfilter[0] = s->predictors[0] << 6;
|
||||
tfilter[0] = s->predictors[0] * 64;
|
||||
for (i = 1; i < filter_order; i++) {
|
||||
int32_t *p1 = &tfilter[0];
|
||||
int32_t *p2 = &tfilter[i - 1];
|
||||
@@ -457,7 +457,7 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
|
||||
p2--;
|
||||
}
|
||||
|
||||
tfilter[i] = s->predictors[i] << 6;
|
||||
tfilter[i] = s->predictors[i] * 64;
|
||||
}
|
||||
|
||||
x = 1 << (32 - (15 - filter_quant));
|
||||
@@ -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) << dshift) - *decoded;
|
||||
v = (av_clip_intp2(v >> filter_quant, 13) * (1 << dshift)) - *decoded;
|
||||
*decoded++ = v;
|
||||
s->residues[filter_order + i] = v >> dshift;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ static int y216_decode_frame(AVCodecContext *avctx, void *data,
|
||||
{
|
||||
AVFrame *pic = data;
|
||||
const uint16_t *src = (uint16_t *)avpkt->data;
|
||||
uint16_t *y, *u, *v, aligned_width = FFALIGN(avctx->width, 4);
|
||||
uint16_t *y, *u, *v;
|
||||
int aligned_width = FFALIGN(avctx->width, 4);
|
||||
int i, j, ret;
|
||||
|
||||
if (avpkt->size < 4 * avctx->height * aligned_width) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user