Compare commits
243 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
384d90f268 | ||
|
|
d20200d303 | ||
|
|
02a5e88ebc | ||
|
|
b6efd022b7 | ||
|
|
68e9caf16f | ||
|
|
e34cbd1d2b | ||
|
|
6c1a2e6bc3 | ||
|
|
a4fb905a14 | ||
|
|
ff7a4df8ac | ||
|
|
9115acb326 | ||
|
|
1f35ea813d | ||
|
|
c26c8bb23a | ||
|
|
e23768b8ff | ||
|
|
197e4693f6 | ||
|
|
e6b3f3ff81 | ||
|
|
c4a0b84b58 | ||
|
|
777f8b9fe1 | ||
|
|
00bbf3063c | ||
|
|
25778b2692 | ||
|
|
c26cbe6c2e | ||
|
|
d5948243f5 | ||
|
|
8c3e90f5ed | ||
|
|
f0862b18c5 | ||
|
|
693288c344 | ||
|
|
3d9c007b61 | ||
|
|
5b8ee8f013 | ||
|
|
f77bb85b08 | ||
|
|
6c96200ceb | ||
|
|
b18a571e23 | ||
|
|
0131f5c376 | ||
|
|
255e61c25b | ||
|
|
119301d312 | ||
|
|
0c2d6a219f | ||
|
|
8a4b18c639 | ||
|
|
a57b701bdc | ||
|
|
e08b1cf2df | ||
|
|
ce44100cb0 | ||
|
|
18e3e322b3 | ||
|
|
37904d1177 | ||
|
|
518934b5f1 | ||
|
|
b0ebef0578 | ||
|
|
540a4433bd | ||
|
|
a1d9c17368 | ||
|
|
f788507607 | ||
|
|
5c1540553d | ||
|
|
a7c7543a3d | ||
|
|
140626b386 | ||
|
|
4a2f30eeff | ||
|
|
c2e4ced78e | ||
|
|
cc27b8e09f | ||
|
|
0d8a17410b | ||
|
|
60ca730d21 | ||
|
|
ebe104e827 | ||
|
|
42a20f1fea | ||
|
|
936d07ab25 | ||
|
|
571d4af281 | ||
|
|
5f3043e51c | ||
|
|
096aab12a3 | ||
|
|
04310c11aa | ||
|
|
eaf2f750c3 | ||
|
|
755d6e4190 | ||
|
|
a190ca54f4 | ||
|
|
6f1ef60d50 | ||
|
|
02ac02e2ac | ||
|
|
1f8452b428 | ||
|
|
d98d006eef | ||
|
|
dec89aee89 | ||
|
|
e23f86d2fb | ||
|
|
4f2716da68 | ||
|
|
668e47e9fd | ||
|
|
e90fbc86c1 | ||
|
|
37ff66d1bd | ||
|
|
b6b7034416 | ||
|
|
b7940ecb5a | ||
|
|
2dcc0bce39 | ||
|
|
0e3dc45ce8 | ||
|
|
072246993a | ||
|
|
5d1502d4b6 | ||
|
|
e70caba384 | ||
|
|
d0f8741a5a | ||
|
|
9b506280dd | ||
|
|
312757eb84 | ||
|
|
e2de6f31c0 | ||
|
|
53e1493cb5 | ||
|
|
315f1dea84 | ||
|
|
b4f42e5c85 | ||
|
|
cb936d6266 | ||
|
|
71378e7937 | ||
|
|
f70e9726dc | ||
|
|
89a22d3fbf | ||
|
|
d000e66c4f | ||
|
|
52d8c1e474 | ||
|
|
a5ba9eab44 | ||
|
|
eaf79ac2d9 | ||
|
|
c35a140e71 | ||
|
|
5c2e26275c | ||
|
|
727ec4acc4 | ||
|
|
1499f65ad4 | ||
|
|
6a7f0585ab | ||
|
|
356e035773 | ||
|
|
e1c1cb4aa1 | ||
|
|
c19e965704 | ||
|
|
a401893487 | ||
|
|
50d34cbf5a | ||
|
|
1af13ea539 | ||
|
|
cb0b818244 | ||
|
|
e3f671b101 | ||
|
|
5a1433b19a | ||
|
|
d6fbc7a2da | ||
|
|
5ede8a9d8c | ||
|
|
facf964d37 | ||
|
|
72f1701c92 | ||
|
|
d77684b853 | ||
|
|
2c52b74980 | ||
|
|
13f032abbb | ||
|
|
d69dc10466 | ||
|
|
d4f64a0f54 | ||
|
|
b3991ccd11 | ||
|
|
230c04e3f6 | ||
|
|
c3f97bf544 | ||
|
|
2a5c41e3e4 | ||
|
|
9e6586ceb2 | ||
|
|
6456a7416e | ||
|
|
de487cb765 | ||
|
|
2fece989f8 | ||
|
|
a2d3e7392d | ||
|
|
d391719be1 | ||
|
|
a22155dacd | ||
|
|
1a43626fdf | ||
|
|
675258764d | ||
|
|
6109c10b81 | ||
|
|
08eef74a39 | ||
|
|
7fefd77668 | ||
|
|
f12c0da09b | ||
|
|
30c80e81d2 | ||
|
|
fc36e692c4 | ||
|
|
263add4462 | ||
|
|
d2566b124a | ||
|
|
d89979e86b | ||
|
|
c2ea706282 | ||
|
|
622ccbd8ab | ||
|
|
c8c5f66b42 | ||
|
|
bc6174d4af | ||
|
|
2303cea5be | ||
|
|
d0590d9349 | ||
|
|
e60a00e0cc | ||
|
|
e6351504dc | ||
|
|
8834e080c2 | ||
|
|
39dc26f0c1 | ||
|
|
496267f8e9 | ||
|
|
9d738e6968 | ||
|
|
77c9c35093 | ||
|
|
03f996d183 | ||
|
|
c68ce48260 | ||
|
|
ac8ac46641 | ||
|
|
c2087fc48b | ||
|
|
21a9797737 | ||
|
|
65c10f0f5c | ||
|
|
ed1c6f701a | ||
|
|
7a3dc2f7b6 | ||
|
|
e91b7852df | ||
|
|
5aaf7e3182 | ||
|
|
ed38046c5c | ||
|
|
ba642f0319 | ||
|
|
8b21b44e7e | ||
|
|
748a4747da | ||
|
|
6fc29572fb | ||
|
|
677ea4a49b | ||
|
|
12320c0822 | ||
|
|
c46d22a4a5 | ||
|
|
40ab55746e | ||
|
|
949094a4cd | ||
|
|
79f52a0dbd | ||
|
|
ae89381962 | ||
|
|
596513ca2c | ||
|
|
2f07937926 | ||
|
|
4943abe051 | ||
|
|
8c4a67183b | ||
|
|
049d767715 | ||
|
|
8003a5d237 | ||
|
|
ec30a498e6 | ||
|
|
fabc1c9e56 | ||
|
|
0ad4d4198a | ||
|
|
93422bc92e | ||
|
|
22a0c0e764 | ||
|
|
77f978996b | ||
|
|
4770eac663 | ||
|
|
afd57722e1 | ||
|
|
7d42daeea2 | ||
|
|
055e5c80ee | ||
|
|
905372be8f | ||
|
|
f4b8892ccb | ||
|
|
4275b27a23 | ||
|
|
9745c5ebf8 | ||
|
|
19d2921bbf | ||
|
|
e160064d39 | ||
|
|
a75a7feebd | ||
|
|
309fa24f36 | ||
|
|
3586c68687 | ||
|
|
456cf87de9 | ||
|
|
54d48c8e90 | ||
|
|
43407bde3e | ||
|
|
7c9ee83d2f | ||
|
|
67f421fd77 | ||
|
|
46732e6a55 | ||
|
|
5222f660d7 | ||
|
|
c70b1ae930 | ||
|
|
327033d913 | ||
|
|
9a345b235f | ||
|
|
8f6a95a103 | ||
|
|
b4922daead | ||
|
|
88e3e6b943 | ||
|
|
87d5146fb7 | ||
|
|
caf32880fd | ||
|
|
7c01fa962e | ||
|
|
e4eab67a0a | ||
|
|
86f9228740 | ||
|
|
7cab4142c5 | ||
|
|
2e1be22715 | ||
|
|
7da59005be | ||
|
|
1410732621 | ||
|
|
f9a150fc31 | ||
|
|
ce36e74e75 | ||
|
|
fc25481d17 | ||
|
|
5c695ce903 | ||
|
|
f617b94c23 | ||
|
|
79af094b93 | ||
|
|
7747300289 | ||
|
|
37c83b5373 | ||
|
|
3e730278f5 | ||
|
|
1fdf549462 | ||
|
|
0a6d760230 | ||
|
|
cd427a9d07 | ||
|
|
8fd5669077 | ||
|
|
25f0ea9ece | ||
|
|
36fcb8cc55 | ||
|
|
18ce5a4d1b | ||
|
|
cf09348b9e | ||
|
|
970f2ad966 | ||
|
|
104c357b6a | ||
|
|
b2a74dd629 | ||
|
|
182cfe4832 | ||
|
|
e5d434b840 |
239
Changelog
239
Changelog
@@ -1,8 +1,241 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
- YUY2 Lossless Codec decoder
|
||||
version 3.1.7:
|
||||
- avcodec/h264_slice: Clear ref_counts on redundant slices
|
||||
- lavf/mov.c: Avoid heap allocation wrap in mov_read_uuid
|
||||
- lavf/mov.c: Avoid heap allocation wrap in mov_read_hdlr
|
||||
- avcodec/pictordec: Fix logic error
|
||||
- ffserver_config: Setup codecpar in add_codec()
|
||||
- avcodec/movtextdec: Fix decode_styl() cleanup
|
||||
- lavf/matroskadec: fix is_keyframe for early Blocks
|
||||
- configure: bump year
|
||||
- avcodec/pngdec: Check trns more completely
|
||||
- avcodec/interplayvideo: Move parameter change check up
|
||||
- avcodec/dca_lbr: Fix off by 1 error in freq check
|
||||
- avcodec/mjpegdec: Check for for the bitstream end in mjpeg_decode_scan_progressive_ac()
|
||||
- avformat/flacdec: Check avio_read result when reading flac block header.
|
||||
- avcodec/utils: correct align value for interplay
|
||||
- avcodec/vp56: Check for the bitstream end, pass error codes on
|
||||
- avcodec/mjpegdec: Check remaining bitstream in ljpeg_decode_yuv_scan()
|
||||
- avcodec/pngdec: Fix off by 1 size in decode_zbuf()
|
||||
- avcodec/omx: Do not pass negative value into av_malloc()
|
||||
- avformat/avidec: skip odml master index chunks in avi_sync
|
||||
- avcodec/mjpegdec: Check for rgb before flipping
|
||||
- avutil/random_seed: Reduce the time needed on systems with very low precision clock()
|
||||
- avutil/random_seed: Improve get_generic_seed() with higher precision clock()
|
||||
- avformat/mp3dec: fix msan warning when verifying mpa header
|
||||
- avformat/utils: Print verbose error message if stream count exceeds max_streams
|
||||
- avformat/options_table: Set the default maximum number of streams to 1000
|
||||
- pgssubdec: reset rle_data_len/rle_remaining_len on allocation error
|
||||
- avutil: Add av_image_check_size2()
|
||||
- avformat: Add max_streams option
|
||||
- avcodec/ffv1enc: Allocate smaller packet if the worst case size cannot be allocated
|
||||
- avcodec/mpeg4videodec: Fix undefined shifts in mpeg4_decode_sprite_trajectory()
|
||||
- avformat/oggdec: Skip streams in duration correction that did not had their duration set.
|
||||
- avcodec/ffv1enc: Fix size of first slice
|
||||
- avfilter/vf_hwupload_cuda: Add min/max limits for the 'device' option
|
||||
- configure: check for strtoull on msvc
|
||||
|
||||
version 3.1.6:
|
||||
- configure: check for strtoull on msvc
|
||||
- http: move chunk handling from http_read_stream() to http_buf_read().
|
||||
- http: make length/offset-related variables unsigned.
|
||||
- ffserver: Check chunk size
|
||||
- Avoid using the term "file" and prefer "url" in some docs and comments
|
||||
- avformat/rtmppkt: Check for packet size mismatches
|
||||
- zmqsend: Initialize ret to 0
|
||||
- avcodec/rawdec: check for side data before checking its size
|
||||
- avcodec/flacdec: Fix undefined shift in decode_subframe()
|
||||
- avcodec/get_bits: Fix get_sbits_long(0)
|
||||
- avformat/ffmdec: Check media type for chunks
|
||||
- avcodec/flacdec: Fix signed integer overflow in decode_subframe_fixed()
|
||||
- avcodec/flacdsp_template: Fix undefined shift in flac_decorrelate_indep_c
|
||||
- avformat/oggparsespeex: Check frames_per_packet and packet_size
|
||||
- avformat/utils: Check start/end before computing duration in update_stream_timings()
|
||||
- avcodec/flac_parser: Update nb_headers_buffered
|
||||
- avformat/idroqdec: Check chunk_size for being too large
|
||||
- avformat/utils: Fix type mismatch
|
||||
- avformat/mpeg: Adjust vid probe threshold to correct mis-detection
|
||||
- avcodec/rv40: Test remaining space in loop of get_dimension()
|
||||
- avcodec/ituh263dec: Avoid spending a long time in slice sync
|
||||
- avcodec/movtextdec: Add error message for tsmb_size check
|
||||
- avcodec/movtextdec: Fix tsmb_size check==0 check
|
||||
- avcodec/movtextdec: Fix potential integer overflow
|
||||
- avcodec/sunrast: Fix input buffer pointer check
|
||||
- avcodec/tscc: Check side data size before use
|
||||
- avcodec/rawdec: Check side data size before use
|
||||
- avcodec/msvideo1: Check side data size before use
|
||||
- avcodec/qpeg: Check side data size before use
|
||||
- avcodec/qtrle: Check side data size before use
|
||||
- avcodec/msrle: Check side data size before use
|
||||
- avcodec/kmvc: Check side data size before use
|
||||
- avcodec/idcinvideo: Check side data size before use
|
||||
- avcodec/cinepak: Check side data size before use
|
||||
- avcodec/8bps: Check side data size before use
|
||||
- avformat/flvdec: Fix regression losing streams
|
||||
- avcodec/dvdsubdec: Fix off by 1 error
|
||||
- avformat/isom: Fix old API regression with exporting max bitrate
|
||||
- avcodec/dvdsubdec: Fix buf_size check
|
||||
- vp9: change order of operations in adapt_prob().
|
||||
- avcodec/interplayvideo: Check side data size before use
|
||||
- mss2: only use error correction for matching block counts
|
||||
- softfloat: decrease MIN_EXP to cover full float range
|
||||
- libopusdec: default to stereo for invalid number of channels
|
||||
- flvdec: require need_context_update when changing codec id
|
||||
- pgssubdec: only set w/h/linesize when allocating data
|
||||
- sbgdec: prevent NULL pointer access
|
||||
- rmdec: validate block alignment
|
||||
- smacker: limit recursion depth of smacker_decode_bigtree
|
||||
- mxfdec: fix NULL pointer dereference in mxf_read_packet_old
|
||||
- ffmdec: validate codec parameters
|
||||
- exr: reindent after previous commit
|
||||
- exr: fix out-of-bounds read
|
||||
- libschroedingerdec: fix leaking of framewithpts
|
||||
- libschroedingerdec: don't produce empty frames
|
||||
- softfloat: handle -INT_MAX correctly
|
||||
- filmstripdec: correctly check image dimensions
|
||||
- pnmdec: make sure v is capped by maxval
|
||||
- smvjpegdec: make sure cur_frame is not negative
|
||||
- icodec: correctly check avio_read return value
|
||||
- dvbsubdec: fix division by zero in compute_default_clut
|
||||
- proresdec_lgpl: explicitly check coff[3] against slice_data_size
|
||||
- escape124: reject codebook size 0
|
||||
- icodec: add ico_read_close to fix leaking ico->images
|
||||
- icodec: fix leaking pkt on error
|
||||
- mpegts: prevent division by zero
|
||||
- matroskadec: fix NULL pointer dereference in webm_dash_manifest_read_header
|
||||
- mpegaudio_parser: don't return AVERROR_PATCHWELCOME
|
||||
- mxfdec: fix NULL pointer dereference
|
||||
- lzf: update pointer p after realloc
|
||||
- diracdec: check return code of get_buffer_with_edge
|
||||
- ppc: pixblockdsp: do unaligned block accesses correctly again
|
||||
- interplayacm: increase bitstream buffer size by AV_INPUT_BUFFER_PADDING_SIZE
|
||||
- interplayacm: validate number of channels
|
||||
- interplayacm: check for too large b
|
||||
- mpeg12dec: unref discarded picture from extradata
|
||||
- cavsdec: unref frame before referencing again
|
||||
- dcstr: fix division by zero
|
||||
- aiff: check block_align in aiff_read_packet
|
||||
- rsd: limit number of channels
|
||||
- avformat: prevent triggering request_probe assert in ff_read_packet
|
||||
- westwood_aud: prevent division by zero
|
||||
- astdec: fix division by zero
|
||||
- aiffdec: fix division by zero
|
||||
- avcodec/avpacket: fix leak on realloc in av_packet_add_side_data()
|
||||
|
||||
version 3.1.5:
|
||||
- avformat/mxfdec: Check size to avoid integer overflow in mxf_read_utf16_string()
|
||||
- avcodec/mpegvideo_enc: Clear mmx state in ff_mpv_reallocate_putbitbuffer()
|
||||
- avcodec/utils: Clear MMX state before returning from avcodec_default_execute*()
|
||||
- doc/examples/demuxing_decoding: Drop AVFrame->pts use
|
||||
- libopenjpegenc: fix out-of-bounds reads when filling the edges
|
||||
- libopenjpegenc: stop reusing image data buffer for openjpeg 2
|
||||
- configure: fix detection of libopenjpeg
|
||||
- doc: fix various typos and grammar errors
|
||||
- avformat/utils: Update codec_id before using it in the parser init
|
||||
- cmdutils: fix typos
|
||||
- lavfi: fix typos
|
||||
- lavc: fix typos
|
||||
- tools: fix grammar error
|
||||
- ffmpeg: remove unused and errorneous AVFrame timestamp check
|
||||
- Support for MIPS cpu P6600
|
||||
- avutil/mips/generic_macros_msa: rename macro variable which causes segfault for mips r6
|
||||
|
||||
version 3.1.4:
|
||||
- avformat/avidec: Check nb_streams in read_gab2_sub()
|
||||
- avformat/avidec: Remove ancient assert
|
||||
- avfilter/vf_colorspace: fix range for output colorspace option
|
||||
- lavc/mediacodecdec_h264: fix SODB escaping
|
||||
- avcodec/nvenc: fix const options for hevc gpu setting
|
||||
- avformat/avidec: Fix memleak with dv in avi
|
||||
- lavc/movtextdec.c: Avoid infinite loop on invalid data.
|
||||
- avcodec/ansi: Check dimensions
|
||||
- avcodec/cavsdsp: use av_clip_uint8() for idct
|
||||
- avformat/movenc: Check packet in mov_write_single_packet() too
|
||||
- avformat/movenc: Factor check_pkt() out
|
||||
- avformat/utils: fix timebase error in avformat_seek_file()
|
||||
- avcodec/g726: Add missing ADDB output mask
|
||||
- avcodec/avpacket: clear side_data_elems
|
||||
- avformat/movenc: Check first DTS similar to dts difference
|
||||
- avcodec/ccaption_dec: Use simple array instead of AVBuffer
|
||||
- avcodec/svq3: Reintroduce slice_type
|
||||
- avformat/mov: Fix potential integer overflow in mov_read_keys
|
||||
- swscale/swscale_unscaled: Try to fix Rgb16ToPlanarRgb16Wrapper() with slices
|
||||
- swscale/swscale_unscaled: Fix packed_16bpc_bswap() with slices
|
||||
- avformat/avidec: Fix infinite loop in avi_read_nikon()
|
||||
- lavf/utils: Avoid an overflow for huge negative durations.
|
||||
- avformat/hls: Fix handling of EXT-X-BYTERANGE streams over 2GB
|
||||
- lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().
|
||||
- lavc/mjpegdec: Do not skip reading quantization tables.
|
||||
- cmdutils: fix implicit declaration of SetDllDirectory function
|
||||
|
||||
version 3.1.3:
|
||||
- examples/demuxing_decoding: convert to codecpar
|
||||
- avcodec/exr: Check tile positions
|
||||
- avcodec/aacenc: Tighter input checks
|
||||
- avformat/wtvdec: Check pointer before use
|
||||
- libavcodec/wmalosslessdec: Check the remaining bits
|
||||
- avcodec/adpcm: Fix adpcm_ima_wav padding
|
||||
- avcodec/svq3: fix slice size check
|
||||
- avcodec/diracdec: Check numx/y
|
||||
- avcodec/h2645_parse: fix nal size
|
||||
- avcodec/h2645_parse: Use get_nalsize() in ff_h2645_packet_split()
|
||||
- h2645_parse: only read avc length code at the correct position
|
||||
- h2645_parse: don't overread AnnexB NALs within an avc stream
|
||||
- avcodec/h264_parser: Factor get_avc_nalsize() out
|
||||
- avcodec/cfhd: Increase minimum band dimension to 3
|
||||
- avcodec/indeo2: check ctab
|
||||
- avformat/swfdec: Fix inflate() error code check
|
||||
- avcodec/rawdec: Fix bits_per_coded_sample checks
|
||||
- vcodec/h2645_parse: Clear buffer padding
|
||||
- avcodec/h2645: Fix NAL unit padding
|
||||
- avfilter/drawutils: Fix single plane with alpha
|
||||
- cmdutils: check for SetDllDirectory() availability
|
||||
|
||||
version 3.1.2:
|
||||
- cmdutils: remove the current working directory from the DLL search path on win32
|
||||
- avcodec/rawdec: Fix palette handling with changing palettes
|
||||
- avcodec/raw: Fix decoding of ilacetest.mov
|
||||
- avformat/mov: Enable mp3 parsing if a packet needs it
|
||||
- avformat/hls: Use an array instead of stream offset for stream mapping
|
||||
- avformat/hls: Sync starting segment across variants on live streams
|
||||
- avformat/hls: Fix regression with ranged media segments
|
||||
- avcodec/ffv1enc: Fix assertion failure with non zero bits per sample
|
||||
- avfilter/af_hdcd: small fix in af_hdcd.c where gain was not being adjusted for "attenuate slowly"
|
||||
- avformat/oggdec: Fix integer overflow with invalid pts
|
||||
- ffplay: Fix invalid array index
|
||||
- avcodec/alacenc: allocate bigger packets (cherry picked from commit 82b84c71b009884c8d041361027718b19922c76d)
|
||||
- libavcodec/dnxhd: Enable 12-bit DNxHR support.
|
||||
- lavc/vaapi_encode_h26x: Fix a crash if "." is not the decimal separator.
|
||||
- jni: Return ENOSYS on unsupported platforms
|
||||
- lavu/hwcontext_vaapi: Fix compilation if VA_FOURCC_ABGR is not defined.
|
||||
- avcodec/vp9_parser: Check the input frame sizes for being consistent
|
||||
- avformat/flvdec: parse keyframe before a\v stream was created add_keyframes_index() when stream created or keyframe parsed
|
||||
- avformat/flvdec: splitting add_keyframes_index() out from parse_keyframes_index()
|
||||
- libavformat/rtpdec_asf: zero initialize the AVIOContext struct
|
||||
- libavutil/opt: Small bugfix in example.
|
||||
- libx264: Increase x264 opts character limit to 4096
|
||||
- avcodec/h264_parser: Set sps/pps_ref
|
||||
- librtmp: Avoid an infiniloop setting connection arguments
|
||||
- avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame
|
||||
- lavc/Makefile: Fix standalone compilation of the svq3 decoder.
|
||||
- lavf/vplayerdec: Improve auto-detection.
|
||||
- lavc/mediacodecdec_h264: properly convert extradata to annex-b
|
||||
- Revert "configure: Enable GCC vectorization on ≥4.9 on x86"
|
||||
|
||||
version 3.1.1:
|
||||
- doc/APIchanges: document the lavu/lavf field moves
|
||||
- avformat/avformat: Move new field to the end of AVStream
|
||||
- avformat/utils: update deprecated AVStream->codec when the context is updated
|
||||
- avutil/frame: Move new field to the end of AVFrame
|
||||
- libavcodec/exr : fix decoding piz float file.
|
||||
- avformat/mov: Check sample size
|
||||
- lavfi: Move new field to the end of AVFilterContext
|
||||
- lavfi: Move new field to the end of AVFilterLink
|
||||
- ffplay: Fix usage of private lavfi API
|
||||
- lavc/mediacodecdec_h264: add missing NAL headers to SPS/PPS buffers
|
||||
- lavc/pnm_parser: disable parsing for text based PNMs
|
||||
|
||||
|
||||
version 3.1:
|
||||
@@ -48,6 +281,8 @@ version 3.1:
|
||||
- CUDA CUVID H264/HEVC decoder
|
||||
- 10-bit depth support in native utvideo decoder
|
||||
- libutvideo wrapper removed
|
||||
- YUY2 Lossless Codec decoder
|
||||
- VideoToolbox H.264 encoder
|
||||
|
||||
|
||||
version 3.0:
|
||||
|
||||
15
RELEASE_NOTES
Normal file
15
RELEASE_NOTES
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
┌────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 3.1 "Laplace" │
|
||||
└────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 3.1 "Laplace", about 4
|
||||
months after the release of FFmpeg 3.0.
|
||||
|
||||
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.
|
||||
16
cmdutils.c
16
cmdutils.c
@@ -61,6 +61,9 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#if HAVE_SETDLLDIRECTORY
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static int init_report(const char *env);
|
||||
|
||||
@@ -107,6 +110,15 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v
|
||||
}
|
||||
}
|
||||
|
||||
void init_dynload(void)
|
||||
{
|
||||
#if HAVE_SETDLLDIRECTORY
|
||||
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
|
||||
* current working directory from the DLL search path as a security pre-caution. */
|
||||
SetDllDirectory("");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void (*program_exit)(int ret);
|
||||
|
||||
void register_exit(void (*cb)(int ret))
|
||||
@@ -2099,7 +2111,7 @@ static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts)
|
||||
if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category))
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
printf("Audo-detected sources for %s:\n", fmt->name);
|
||||
printf("Auto-detected sources for %s:\n", fmt->name);
|
||||
if (!fmt->get_device_list) {
|
||||
ret = AVERROR(ENOSYS);
|
||||
printf("Cannot list sources. Not implemented.\n");
|
||||
@@ -2129,7 +2141,7 @@ static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts)
|
||||
if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category))
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
printf("Audo-detected sinks for %s:\n", fmt->name);
|
||||
printf("Auto-detected sinks for %s:\n", fmt->name);
|
||||
if (!fmt->get_device_list) {
|
||||
ret = AVERROR(ENOSYS);
|
||||
printf("Cannot list sinks. Not implemented.\n");
|
||||
|
||||
@@ -61,6 +61,11 @@ void register_exit(void (*cb)(int ret));
|
||||
*/
|
||||
void exit_program(int ret) av_noreturn;
|
||||
|
||||
/**
|
||||
* Initialize dynamic library loading
|
||||
*/
|
||||
void init_dynload(void);
|
||||
|
||||
/**
|
||||
* Initialize the cmdutils option system, in particular
|
||||
* allocate the *_opts contexts.
|
||||
@@ -445,13 +450,13 @@ int show_devices(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
/**
|
||||
* Print a listing containing audodetected sinks of the output device.
|
||||
* Print a listing containing autodetected sinks of the output device.
|
||||
* Device name with options may be passed as an argument to limit results.
|
||||
*/
|
||||
int show_sinks(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing audodetected sources of the input device.
|
||||
* Print a listing containing autodetected sources of the input device.
|
||||
* Device name with options may be passed as an argument to limit results.
|
||||
*/
|
||||
int show_sources(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
28
configure
vendored
28
configure
vendored
@@ -1935,6 +1935,7 @@ SYSTEM_FUNCS="
|
||||
sched_getaffinity
|
||||
SetConsoleTextAttribute
|
||||
SetConsoleCtrlHandler
|
||||
SetDllDirectory
|
||||
setmode
|
||||
setrlimit
|
||||
Sleep
|
||||
@@ -4335,7 +4336,7 @@ elif enabled mips; then
|
||||
enable mips32r2
|
||||
disable msa
|
||||
;;
|
||||
p5600|i6400)
|
||||
p5600|i6400|p6600)
|
||||
disable mipsdsp
|
||||
disable mipsdspr2
|
||||
;;
|
||||
@@ -4400,6 +4401,10 @@ elif enabled mips; then
|
||||
enable mips64r6
|
||||
check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
|
||||
;;
|
||||
p6600)
|
||||
enable mips64r6
|
||||
check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# We do not disable anything. Is up to the user to disable the unwanted features.
|
||||
@@ -4529,7 +4534,7 @@ fi
|
||||
|
||||
add_cppflags -D_ISOC99_SOURCE
|
||||
add_cxxflags -D__STDC_CONSTANT_MACROS
|
||||
add_cxxflags -std=c++11
|
||||
add_cxxflags -std=c++98
|
||||
check_cflags -std=c99
|
||||
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
|
||||
#include <stdlib.h>
|
||||
@@ -5475,6 +5480,7 @@ check_func_headers windows.h MapViewOfFile
|
||||
check_func_headers windows.h PeekNamedPipe
|
||||
check_func_headers windows.h SetConsoleTextAttribute
|
||||
check_func_headers windows.h SetConsoleCtrlHandler
|
||||
check_func_headers windows.h SetDllDirectory
|
||||
check_func_headers windows.h Sleep
|
||||
check_func_headers windows.h VirtualAlloc
|
||||
check_struct windows.h "CONDITION_VARIABLE" Ptr
|
||||
@@ -5669,10 +5675,11 @@ enabled libopencv && { check_header opencv2/core/core_c.h &&
|
||||
require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
|
||||
require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
|
||||
enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
|
||||
enabled libopenjpeg && { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC ||
|
||||
check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC ||
|
||||
check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
|
||||
check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
|
||||
enabled libopenjpeg && { { check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
|
||||
check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
|
||||
{ check_lib2 openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
|
||||
{ check_lib2 openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
|
||||
{ check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
|
||||
die "ERROR: libopenjpeg not found"; }
|
||||
enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
|
||||
enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
|
||||
@@ -6125,11 +6132,7 @@ elif enabled ccc; then
|
||||
add_cflags -msg_disable nonstandcast
|
||||
add_cflags -msg_disable unsupieee
|
||||
elif enabled gcc; then
|
||||
case $gcc_basever in
|
||||
4.9*) enabled x86 || check_optflags -fno-tree-vectorize ;;
|
||||
4.*) check_optflags -fno-tree-vectorize ;;
|
||||
*) enabled x86 || check_optflags -fno-tree-vectorize ;;
|
||||
esac
|
||||
check_optflags -fno-tree-vectorize
|
||||
check_cflags -Werror=format-security
|
||||
check_cflags -Werror=implicit-function-declaration
|
||||
check_cflags -Werror=missing-prototypes
|
||||
@@ -6194,6 +6197,7 @@ __declspec($_restrict) void* foo(int);
|
||||
EOF
|
||||
fi
|
||||
check_func strtoll || add_cflags -Dstrtoll=_strtoi64
|
||||
check_func strtoull || add_cflags -Dstrtoull=_strtoui64
|
||||
fi
|
||||
|
||||
for pfx in "" host_; do
|
||||
@@ -6620,7 +6624,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2016
|
||||
#define CONFIG_THIS_YEAR 2017
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
@@ -15,14 +15,30 @@ libavutil: 2015-08-28
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2016-06-26 - xxxxxxx / 1c9e861 - lavu 55.27.100 / 55.13.0 - hwcontext.h
|
||||
Add av_hwdevice_ctx_create().
|
||||
2016-06-30 - c1c7e0ab - lavf 57.41.100 - avformat.h
|
||||
Moved codecpar field from AVStream to the end of the struct, so that
|
||||
the following private fields are in the same location as in FFmpeg 3.0 (lavf 57.25.100).
|
||||
|
||||
2016-06-26 - xxxxxxx / e47b8bb - lavc 57.48.101 / 57.19.1 - avcodec.h
|
||||
Adjust values for JPEG 2000 profiles.
|
||||
2016-06-30 - 042fb69d - lavu 55.28.100 - frame.h
|
||||
Moved hw_frames_ctx field from AVFrame to the end of the struct, so that
|
||||
the following private fields are in the same location as in FFmpeg 3.0 (lavu 55.17.103).
|
||||
|
||||
2016-06-29 - 1a751455 - lavfi 6.47.100 - avfilter.h
|
||||
Fix accidental ABI breakage in AVFilterContext.
|
||||
ABI was broken in 8688d3a, lavfi 6.42.100 and released as ffmpeg 3.1.
|
||||
|
||||
Because of this, ffmpeg and ffplay built against lavfi>=6.42.100 will not be
|
||||
compatible with lavfi>=6.47.100. Potentially also affects other users of
|
||||
libavfilter if they are using one of the affected fields.
|
||||
|
||||
-------- 8< --------- FFmpeg 3.1 was cut here -------- 8< ---------
|
||||
|
||||
2016-06-26 - 481f320 / 1c9e861 - lavu 55.27.100 / 55.13.0 - hwcontext.h
|
||||
Add av_hwdevice_ctx_create().
|
||||
|
||||
2016-06-26 - b95534b / e47b8bb - lavc 57.48.101 / 57.19.1 - avcodec.h
|
||||
Adjust values for JPEG 2000 profiles.
|
||||
|
||||
2016-06-23 - 5d75e46 / db7968b - lavf 57.40.100 / 57.7.0 - avio.h
|
||||
Add AVIODataMarkerType, write_data_type, ignore_boundary_point and
|
||||
avio_write_marker.
|
||||
|
||||
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NUMBER = 3.1.7
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
||||
@@ -1173,7 +1173,7 @@ Set to 1 to disable processing alpha (transparency). This works like the
|
||||
instead of alpha. Default is 0.
|
||||
|
||||
@item codec_whitelist @var{list} (@emph{input})
|
||||
"," separated List of allowed decoders. By default all are allowed.
|
||||
"," separated list of allowed decoders. By default all are allowed.
|
||||
|
||||
@item dump_separator @var{string} (@emph{input})
|
||||
Separator used to separate the fields printed on the command line about the
|
||||
|
||||
@@ -72,7 +72,7 @@ Do not try to resynchronize by looking for a certain optional start code.
|
||||
Virtual concatenation script demuxer.
|
||||
|
||||
This demuxer reads a list of files and other directives from a text file and
|
||||
demuxes them one after the other, as if all their packet had been muxed
|
||||
demuxes them one after the other, as if all their packets had been muxed
|
||||
together.
|
||||
|
||||
The timestamps in the files are adjusted so that the first file starts at 0
|
||||
@@ -107,7 +107,7 @@ Identify the script type and version. It also sets the @option{safe} option
|
||||
to 1 if it was -1.
|
||||
|
||||
To make FFmpeg recognize the format automatically, this directive must
|
||||
appears exactly as is (no extra space or byte-order-mark) on the very first
|
||||
appear exactly as is (no extra space or byte-order-mark) on the very first
|
||||
line of the script.
|
||||
|
||||
@item @code{duration @var{dur}}
|
||||
|
||||
@@ -93,10 +93,9 @@ static int decode_packet(int *got_frame, int cached)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("video_frame%s n:%d coded_n:%d pts:%s\n",
|
||||
printf("video_frame%s n:%d coded_n:%d\n",
|
||||
cached ? "(cached)" : "",
|
||||
video_frame_count++, frame->coded_picture_number,
|
||||
av_ts2timestr(frame->pts, &video_dec_ctx->time_base));
|
||||
video_frame_count++, frame->coded_picture_number);
|
||||
|
||||
/* copy decoded frame to destination buffer:
|
||||
* this is required since rawvideo expects non aligned data */
|
||||
@@ -148,11 +147,10 @@ static int decode_packet(int *got_frame, int cached)
|
||||
}
|
||||
|
||||
static int open_codec_context(int *stream_idx,
|
||||
AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||
AVCodecContext **dec_ctx, AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||
{
|
||||
int ret, stream_index;
|
||||
AVStream *st;
|
||||
AVCodecContext *dec_ctx = NULL;
|
||||
AVCodec *dec = NULL;
|
||||
AVDictionary *opts = NULL;
|
||||
|
||||
@@ -166,17 +164,31 @@ static int open_codec_context(int *stream_idx,
|
||||
st = fmt_ctx->streams[stream_index];
|
||||
|
||||
/* find decoder for the stream */
|
||||
dec_ctx = st->codec;
|
||||
dec = avcodec_find_decoder(dec_ctx->codec_id);
|
||||
dec = avcodec_find_decoder(st->codecpar->codec_id);
|
||||
if (!dec) {
|
||||
fprintf(stderr, "Failed to find %s codec\n",
|
||||
av_get_media_type_string(type));
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
/* Allocate a codec context for the decoder */
|
||||
*dec_ctx = avcodec_alloc_context3(dec);
|
||||
if (!*dec_ctx) {
|
||||
fprintf(stderr, "Failed to allocate the %s codec context\n",
|
||||
av_get_media_type_string(type));
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
/* Copy codec parameters from input stream to output codec context */
|
||||
if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) < 0) {
|
||||
fprintf(stderr, "Failed to copy %s codec parameters to decoder context\n",
|
||||
av_get_media_type_string(type));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Init the decoders, with or without reference counting */
|
||||
av_dict_set(&opts, "refcounted_frames", refcount ? "1" : "0", 0);
|
||||
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
|
||||
if ((ret = avcodec_open2(*dec_ctx, dec, &opts)) < 0) {
|
||||
fprintf(stderr, "Failed to open %s codec\n",
|
||||
av_get_media_type_string(type));
|
||||
return ret;
|
||||
@@ -255,9 +267,8 @@ int main (int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (open_codec_context(&video_stream_idx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
||||
if (open_codec_context(&video_stream_idx, &video_dec_ctx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
||||
video_stream = fmt_ctx->streams[video_stream_idx];
|
||||
video_dec_ctx = video_stream->codec;
|
||||
|
||||
video_dst_file = fopen(video_dst_filename, "wb");
|
||||
if (!video_dst_file) {
|
||||
@@ -279,9 +290,8 @@ int main (int argc, char **argv)
|
||||
video_dst_bufsize = ret;
|
||||
}
|
||||
|
||||
if (open_codec_context(&audio_stream_idx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
||||
if (open_codec_context(&audio_stream_idx, &audio_dec_ctx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
||||
audio_stream = fmt_ctx->streams[audio_stream_idx];
|
||||
audio_dec_ctx = audio_stream->codec;
|
||||
audio_dst_file = fopen(audio_dst_filename, "wb");
|
||||
if (!audio_dst_file) {
|
||||
fprintf(stderr, "Could not open destination file %s\n", audio_dst_filename);
|
||||
@@ -369,8 +379,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
end:
|
||||
avcodec_close(video_dec_ctx);
|
||||
avcodec_close(audio_dec_ctx);
|
||||
avcodec_free_context(&video_dec_ctx);
|
||||
avcodec_free_context(&audio_dec_ctx);
|
||||
avformat_close_input(&fmt_ctx);
|
||||
if (video_dst_file)
|
||||
fclose(video_dst_file);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
@chapter Synopsis
|
||||
|
||||
ffmpeg [@var{global_options}] @{[@var{input_file_options}] -i @file{input_file}@} ... @{[@var{output_file_options}] @file{output_file}@} ...
|
||||
ffmpeg [@var{global_options}] @{[@var{input_file_options}] -i @file{input_url}@} ... @{[@var{output_file_options}] @file{output_url}@} ...
|
||||
|
||||
@chapter Description
|
||||
@c man begin DESCRIPTION
|
||||
@@ -24,10 +24,10 @@ rates and resize video on the fly with a high quality polyphase filter.
|
||||
@command{ffmpeg} reads from an arbitrary number of input "files" (which can be regular
|
||||
files, pipes, network streams, grabbing devices, etc.), specified by the
|
||||
@code{-i} option, and writes to an arbitrary number of output "files", which are
|
||||
specified by a plain output filename. Anything found on the command line which
|
||||
cannot be interpreted as an option is considered to be an output filename.
|
||||
specified by a plain output url. Anything found on the command line which
|
||||
cannot be interpreted as an option is considered to be an output url.
|
||||
|
||||
Each input or output file can, in principle, contain any number of streams of
|
||||
Each input or output url can, in principle, contain any number of streams of
|
||||
different types (video/audio/subtitle/attachment/data). The allowed number and/or
|
||||
types of streams may be limited by the container format. Selecting which
|
||||
streams from which inputs will go into which output is either done automatically
|
||||
@@ -243,8 +243,8 @@ Force input or output file format. The format is normally auto detected for inpu
|
||||
files and guessed from the file extension for output files, so this option is not
|
||||
needed in most cases.
|
||||
|
||||
@item -i @var{filename} (@emph{input})
|
||||
input file name
|
||||
@item -i @var{url} (@emph{input})
|
||||
input file url
|
||||
|
||||
@item -y (@emph{global})
|
||||
Overwrite output files without asking.
|
||||
@@ -281,7 +281,7 @@ libx264, and the 138th audio, which will be encoded with libvorbis.
|
||||
When used as an input option (before @code{-i}), limit the @var{duration} of
|
||||
data read from the input file.
|
||||
|
||||
When used as an output option (before an output filename), stop writing the
|
||||
When used as an output option (before an output url), stop writing the
|
||||
output after its duration reaches @var{duration}.
|
||||
|
||||
@var{duration} must be a time duration specification,
|
||||
@@ -310,7 +310,7 @@ extra segment between the seek point and @var{position} will be decoded and
|
||||
discarded. When doing stream copy or when @option{-noaccurate_seek} is used, it
|
||||
will be preserved.
|
||||
|
||||
When used as an output option (before an output filename), decodes but discards
|
||||
When used as an output option (before an output url), decodes but discards
|
||||
input until the timestamps reach @var{position}.
|
||||
|
||||
@var{position} must be a time duration specification,
|
||||
@@ -1008,7 +1008,7 @@ Dump each input packet to stderr.
|
||||
@item -hex (@emph{global})
|
||||
When dumping packets, also dump the payload.
|
||||
@item -re (@emph{input})
|
||||
Read input at native frame rate. Mainly used to simulate a grab device.
|
||||
Read input at native frame rate. Mainly used to simulate a grab device,
|
||||
or live input stream (e.g. when reading from a file). Should not be used
|
||||
with actual grab devices or live input streams (where it can cause packet
|
||||
loss).
|
||||
@@ -1129,7 +1129,7 @@ may be reassigned to a different value.
|
||||
For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
|
||||
an output mpegts file:
|
||||
@example
|
||||
ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
|
||||
ffmpeg -i inurl -streamid 0:33 -streamid 1:36 out.ts
|
||||
@end example
|
||||
|
||||
@item -bsf[:@var{stream_specifier}] @var{bitstream_filters} (@emph{output,per-stream})
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
@chapter Synopsis
|
||||
|
||||
ffplay [@var{options}] [@file{input_file}]
|
||||
ffplay [@var{options}] [@file{input_url}]
|
||||
|
||||
@chapter Description
|
||||
@c man begin DESCRIPTION
|
||||
@@ -106,8 +106,8 @@ the input audio.
|
||||
Use the option "-filters" to show all the available filters (including
|
||||
sources and sinks).
|
||||
|
||||
@item -i @var{input_file}
|
||||
Read @var{input_file}.
|
||||
@item -i @var{input_url}
|
||||
Read @var{input_url}.
|
||||
@end table
|
||||
|
||||
@section Advanced options
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
@chapter Synopsis
|
||||
|
||||
ffprobe [@var{options}] [@file{input_file}]
|
||||
ffprobe [@var{options}] [@file{input_url}]
|
||||
|
||||
@chapter Description
|
||||
@c man begin DESCRIPTION
|
||||
@@ -24,8 +24,8 @@ For example it can be used to check the format of the container used
|
||||
by a multimedia stream and the format and type of each media stream
|
||||
contained in it.
|
||||
|
||||
If a filename is specified in input, ffprobe will try to open and
|
||||
probe the file content. If the file cannot be opened or recognized as
|
||||
If a url is specified in input, ffprobe will try to open and
|
||||
probe the url content. If the url cannot be opened or recognized as
|
||||
a multimedia file, a positive exit code is returned.
|
||||
|
||||
ffprobe may be employed both as a standalone application or in
|
||||
@@ -332,8 +332,8 @@ with name "PIXEL_FORMAT".
|
||||
Force bitexact output, useful to produce output which is not dependent
|
||||
on the specific build.
|
||||
|
||||
@item -i @var{input_file}
|
||||
Read @var{input_file}.
|
||||
@item -i @var{input_url}
|
||||
Read @var{input_url}.
|
||||
|
||||
@end table
|
||||
@c man end
|
||||
|
||||
@@ -176,10 +176,10 @@ loglevel will be used. If multiple loglevel parameters are given, using
|
||||
Show nothing at all; be silent.
|
||||
@item panic, 0
|
||||
Only show fatal errors which could lead the process to crash, such as
|
||||
and assert failure. This is not currently used for anything.
|
||||
an assertion failure. This is not currently used for anything.
|
||||
@item fatal, 8
|
||||
Only show fatal errors. These are errors after which the process absolutely
|
||||
cannot continue after.
|
||||
cannot continue.
|
||||
@item error, 16
|
||||
Show all errors, including ones which can be recovered from.
|
||||
@item warning, 24
|
||||
@@ -195,13 +195,13 @@ Show everything, including debugging information.
|
||||
@item trace, 56
|
||||
@end table
|
||||
|
||||
By default the program logs to stderr, if coloring is supported by the
|
||||
By default the program logs to stderr. If coloring is supported by the
|
||||
terminal, colors are used to mark errors and warnings. Log coloring
|
||||
can be disabled setting the environment variable
|
||||
@env{AV_LOG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting
|
||||
the environment variable @env{AV_LOG_FORCE_COLOR}.
|
||||
The use of the environment variable @env{NO_COLOR} is deprecated and
|
||||
will be dropped in a following FFmpeg version.
|
||||
will be dropped in a future FFmpeg version.
|
||||
|
||||
@item -report
|
||||
Dump full command line and console output to a file named
|
||||
|
||||
@@ -845,14 +845,14 @@ A gate is mainly used to reduce lower parts of a signal. This kind of signal
|
||||
processing reduces disturbing noise between useful signals.
|
||||
|
||||
Gating is done by detecting the volume below a chosen level @var{threshold}
|
||||
and divide it by the factor set with @var{ratio}. The bottom of the noise
|
||||
and dividing it by the factor set with @var{ratio}. The bottom of the noise
|
||||
floor is set via @var{range}. Because an exact manipulation of the signal
|
||||
would cause distortion of the waveform the reduction can be levelled over
|
||||
time. This is done by setting @var{attack} and @var{release}.
|
||||
|
||||
@var{attack} determines how long the signal has to fall below the threshold
|
||||
before any reduction will occur and @var{release} sets the time the signal
|
||||
has to raise above the threshold to reduce the reduction again.
|
||||
has to rise above the threshold to reduce the reduction again.
|
||||
Shorter signals than the chosen attack time will be left untouched.
|
||||
|
||||
@table @option
|
||||
@@ -869,7 +869,7 @@ If a signal rises above this level the gain reduction is released.
|
||||
Default is 0.125. Allowed range is from 0 to 1.
|
||||
|
||||
@item ratio
|
||||
Set a ratio about which the signal is reduced.
|
||||
Set a ratio by which the signal is reduced.
|
||||
Default is 2. Allowed range is from 1 to 9000.
|
||||
|
||||
@item attack
|
||||
@@ -892,19 +892,19 @@ Default is 2.828427125. Allowed range is from 1 to 8.
|
||||
|
||||
@item detection
|
||||
Choose if exact signal should be taken for detection or an RMS like one.
|
||||
Default is rms. Can be peak or rms.
|
||||
Default is @code{rms}. Can be @code{peak} or @code{rms}.
|
||||
|
||||
@item link
|
||||
Choose if the average level between all channels or the louder channel affects
|
||||
the reduction.
|
||||
Default is average. Can be average or maximum.
|
||||
Default is @code{average}. Can be @code{average} or @code{maximum}.
|
||||
@end table
|
||||
|
||||
@section alimiter
|
||||
|
||||
The limiter prevents input signal from raising over a desired threshold.
|
||||
The limiter prevents an input signal from rising over a desired threshold.
|
||||
This limiter uses lookahead technology to prevent your signal from distorting.
|
||||
It means that there is a small delay after signal is processed. Keep in mind
|
||||
It means that there is a small delay after the signal is processed. Keep in mind
|
||||
that the delay it produces is the attack time you set.
|
||||
|
||||
The filter accepts the following options:
|
||||
@@ -1353,7 +1353,7 @@ Set the number of samples per each output audio frame.
|
||||
|
||||
The last output packet may contain a different number of samples, as
|
||||
the filter will flush all the remaining samples when the input audio
|
||||
signal its end.
|
||||
signals its end.
|
||||
|
||||
The filter accepts the following options:
|
||||
|
||||
@@ -2445,7 +2445,7 @@ filtering with large delay. Default is disabled.
|
||||
Enable multichannels evaluation on gain. Default is disabled.
|
||||
|
||||
@item zero_phase
|
||||
Enable zero phase mode by substracting timestamp to compensate delay.
|
||||
Enable zero phase mode by subtracting timestamp to compensate delay.
|
||||
Default is disabled.
|
||||
@end table
|
||||
|
||||
@@ -3216,7 +3216,7 @@ Can be specified in dB (in case "dB" is appended to the specified value)
|
||||
or amplitude ratio. Default value is @code{0}.
|
||||
|
||||
@item leave_silence
|
||||
This indicate that @var{stop_duration} length of audio should be left intact
|
||||
This indicates that @var{stop_duration} length of audio should be left intact
|
||||
at the beginning of each period of silence.
|
||||
For example, if you want to remove long pauses between words but do not want
|
||||
to remove the pauses completely. Default value is @code{0}.
|
||||
@@ -6622,10 +6622,10 @@ This option does not exist, please see the timeline system
|
||||
|
||||
@item alpha
|
||||
Draw the text applying alpha blending. The value can
|
||||
be either a number between 0.0 and 1.0
|
||||
The expression accepts the same variables @var{x, y} do.
|
||||
be a number between 0.0 and 1.0.
|
||||
The expression accepts the same variables @var{x, y} as well.
|
||||
The default value is 1.
|
||||
Please see fontcolor_expr
|
||||
Please see @var{fontcolor_expr}.
|
||||
|
||||
@item fontsize
|
||||
The font size to be used for drawing text.
|
||||
@@ -6808,7 +6808,7 @@ the following expansion mechanism is used.
|
||||
The backslash character @samp{\}, followed by any character, always expands to
|
||||
the second character.
|
||||
|
||||
Sequence of the form @code{%@{...@}} are expanded. The text between the
|
||||
Sequences of the form @code{%@{...@}} are expanded. The text between the
|
||||
braces is a function name, possibly followed by arguments separated by ':'.
|
||||
If the arguments contain special characters or delimiters (':' or '@}'),
|
||||
they should be escaped.
|
||||
@@ -8714,8 +8714,8 @@ value.
|
||||
|
||||
Detect video interlacing type.
|
||||
|
||||
This filter tries to detect if the input frames as interlaced, progressive,
|
||||
top or bottom field first. It will also try and detect fields that are
|
||||
This filter tries to detect if the input frames are interlaced, progressive,
|
||||
top or bottom field first. It will also try to detect fields that are
|
||||
repeated between adjacent frames (a sign of telecine).
|
||||
|
||||
Single frame detection considers only immediately adjacent frames when classifying each frame.
|
||||
@@ -8782,7 +8782,7 @@ Set progressive threshold.
|
||||
Threshold for repeated field detection.
|
||||
@item half_life
|
||||
Number of frames after which a given frame's contribution to the
|
||||
statistics is halved (i.e., it contributes only 0.5 to it's
|
||||
statistics is halved (i.e., it contributes only 0.5 to its
|
||||
classification). The default of 0 means that all frames seen are given
|
||||
full weight of 1.0 forever.
|
||||
@item analyze_interlaced_flag
|
||||
@@ -14281,7 +14281,7 @@ syntax is deprecated:
|
||||
Create a pattern generated by an elementary cellular automaton.
|
||||
|
||||
The initial state of the cellular automaton can be defined through the
|
||||
@option{filename}, and @option{pattern} options. If such options are
|
||||
@option{filename} and @option{pattern} options. If such options are
|
||||
not specified an initial state is created randomly.
|
||||
|
||||
At each new frame a new row in the video is filled with the result of
|
||||
@@ -15324,7 +15324,7 @@ Temporally interleave frames from several inputs.
|
||||
These filters read frames from several inputs and send the oldest
|
||||
queued frame to the output.
|
||||
|
||||
Input streams must have a well defined, monotonically increasing frame
|
||||
Input streams must have well defined, monotonically increasing frame
|
||||
timestamp values.
|
||||
|
||||
In order to submit one frame to output, these filters need to enqueue
|
||||
@@ -15332,9 +15332,9 @@ at least one frame for each input, so they cannot work in case one
|
||||
input is not yet terminated and will not receive incoming frames.
|
||||
|
||||
For example consider the case when one input is a @code{select} filter
|
||||
which always drop input frames. The @code{interleave} filter will keep
|
||||
which always drops input frames. The @code{interleave} filter will keep
|
||||
reading from that input, but it will never be able to send new frames
|
||||
to output until the input will send an end-of-stream signal.
|
||||
to output until the input sends an end-of-stream signal.
|
||||
|
||||
Also, depending on inputs synchronization, the filters will drop
|
||||
frames in case one input receives more frames than the other ones, and
|
||||
|
||||
@@ -195,7 +195,7 @@ delayed bt the time duration specified in @var{offset}. Default value
|
||||
is @code{0} (meaning that no offset is applied).
|
||||
|
||||
@item format_whitelist @var{list} (@emph{input})
|
||||
"," separated List of allowed demuxers. By default all are allowed.
|
||||
"," separated list of allowed demuxers. By default all are allowed.
|
||||
|
||||
@item dump_separator @var{string} (@emph{input})
|
||||
Separator used to separate the fields printed on the command line about the
|
||||
@@ -205,6 +205,10 @@ For example to separate the fields with newlines and indention:
|
||||
ffprobe -dump_separator "
|
||||
" -i ~/videos/matrixbench_mpeg2.mpg
|
||||
@end example
|
||||
|
||||
@item max_streams @var{integer} (@emph{input})
|
||||
Specifies the maximum number of streams. This can be used to reject files that
|
||||
would require too many resources due to a large number of streams.
|
||||
@end table
|
||||
|
||||
@c man end FORMAT OPTIONS
|
||||
|
||||
@@ -656,7 +656,7 @@ is an exact value. For HDV, it is not frame exact, since HDV does
|
||||
not have a fixed frame size.
|
||||
|
||||
@item dvguid
|
||||
Select the capture device by specifying it's GUID. Capturing will only
|
||||
Select the capture device by specifying its GUID. Capturing will only
|
||||
be performed from the specified device and fails if no device with the
|
||||
given GUID is found. This is useful to select the input if multiple
|
||||
devices are connected at the same time.
|
||||
@@ -1319,7 +1319,7 @@ ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
|
||||
|
||||
@table @option
|
||||
@item draw_mouse
|
||||
Specify whether to draw the mouse pointer. A value of @code{0} specify
|
||||
Specify whether to draw the mouse pointer. A value of @code{0} specifies
|
||||
not to draw the pointer. Default value is @code{1}.
|
||||
|
||||
@item follow_mouse
|
||||
|
||||
@@ -274,14 +274,14 @@ the loops:
|
||||
ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
|
||||
@end example
|
||||
|
||||
Note 1: if you wish to extract the frames in separate GIF files, you need to
|
||||
Note 1: if you wish to extract the frames into separate GIF files, you need to
|
||||
force the @ref{image2} muxer:
|
||||
@example
|
||||
ffmpeg -i INPUT -c:v gif -f image2 "out%d.gif"
|
||||
@end example
|
||||
|
||||
Note 2: the GIF format has a very small time base: the delay between two frames
|
||||
can not be smaller than one centi second.
|
||||
Note 2: the GIF format has a very large time base: the delay between two frames
|
||||
can therefore not be smaller than one centi second.
|
||||
|
||||
@anchor{hash}
|
||||
@section hash
|
||||
|
||||
@@ -173,7 +173,7 @@ earlier, place @code{c99wrap.exe} and @code{c99conv.exe} somewhere in your
|
||||
Next, make sure any other headers and libs you want to use, such as zlib, are
|
||||
located in a spot that the compiler can see. Do so by modifying the @code{LIB}
|
||||
and @code{INCLUDE} environment variables to include the @strong{Windows-style}
|
||||
paths to these directories. Alternatively, you can try and use the
|
||||
paths to these directories. Alternatively, you can try to use the
|
||||
@code{--extra-cflags}/@code{--extra-ldflags} configure options. If using MSVC
|
||||
2012 or earlier, place @code{inttypes.h} somewhere the compiler can see too.
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ autodetection in the future.
|
||||
If set to 1 enables experimental HTTP server. This can be used to send data when
|
||||
used as an output option, or read data from a client with HTTP POST when used as
|
||||
an input option.
|
||||
If set to 2 enables experimental mutli-client HTTP server. This is not yet implemented
|
||||
If set to 2 enables experimental multi-client HTTP server. This is not yet implemented
|
||||
in ffmpeg.c or ffserver.c and thus must not be used as a command line option.
|
||||
@example
|
||||
# Server side (sending):
|
||||
|
||||
9
ffmpeg.c
9
ffmpeg.c
@@ -2026,12 +2026,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
|
||||
}
|
||||
}
|
||||
|
||||
/* if the decoder provides a pts, use it instead of the last packet pts.
|
||||
the decoder could be delaying output by a packet or more. */
|
||||
if (decoded_frame->pts != AV_NOPTS_VALUE) {
|
||||
ist->dts = ist->next_dts = ist->pts = ist->next_pts = av_rescale_q(decoded_frame->pts, avctx->time_base, AV_TIME_BASE_Q);
|
||||
decoded_frame_tb = avctx->time_base;
|
||||
} else if (decoded_frame->pkt_pts != AV_NOPTS_VALUE) {
|
||||
if (decoded_frame->pkt_pts != AV_NOPTS_VALUE) {
|
||||
decoded_frame->pts = decoded_frame->pkt_pts;
|
||||
decoded_frame_tb = ist->st->time_base;
|
||||
} else if (pkt->pts != AV_NOPTS_VALUE) {
|
||||
@@ -4303,6 +4298,8 @@ int main(int argc, char **argv)
|
||||
int ret;
|
||||
int64_t ti;
|
||||
|
||||
init_dynload();
|
||||
|
||||
register_exit(ffmpeg_cleanup);
|
||||
|
||||
setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */
|
||||
|
||||
@@ -3009,8 +3009,8 @@ enum OptGroup {
|
||||
};
|
||||
|
||||
static const OptionGroupDef groups[] = {
|
||||
[GROUP_OUTFILE] = { "output file", NULL, OPT_OUTPUT },
|
||||
[GROUP_INFILE] = { "input file", "i", OPT_INPUT },
|
||||
[GROUP_OUTFILE] = { "output url", NULL, OPT_OUTPUT },
|
||||
[GROUP_INFILE] = { "input url", "i", OPT_INPUT },
|
||||
};
|
||||
|
||||
static int open_files(OptionGroupList *l, const char *inout,
|
||||
|
||||
6
ffplay.c
6
ffplay.c
@@ -2725,7 +2725,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
goto fail;
|
||||
link = is->out_audio_filter->inputs[0];
|
||||
sample_rate = link->sample_rate;
|
||||
nb_channels = link->channels;
|
||||
nb_channels = avfilter_link_get_channels(link);
|
||||
channel_layout = link->channel_layout;
|
||||
}
|
||||
#else
|
||||
@@ -2936,7 +2936,7 @@ static int read_thread(void *arg)
|
||||
AVStream *st = ic->streams[i];
|
||||
enum AVMediaType type = st->codecpar->codec_type;
|
||||
st->discard = AVDISCARD_ALL;
|
||||
if (wanted_stream_spec[type] && st_index[type] == -1)
|
||||
if (type >= 0 && wanted_stream_spec[type] && st_index[type] == -1)
|
||||
if (avformat_match_stream_specifier(ic, st, wanted_stream_spec[type]) > 0)
|
||||
st_index[type] = i;
|
||||
}
|
||||
@@ -3776,6 +3776,8 @@ int main(int argc, char **argv)
|
||||
char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy";
|
||||
char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1";
|
||||
|
||||
init_dynload();
|
||||
|
||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||
parse_loglevel(argc, argv, options);
|
||||
|
||||
|
||||
@@ -3241,6 +3241,8 @@ int main(int argc, char **argv)
|
||||
char *w_name = NULL, *w_args = NULL;
|
||||
int ret, i;
|
||||
|
||||
init_dynload();
|
||||
|
||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||
register_exit(ffprobe_cleanup);
|
||||
|
||||
|
||||
@@ -2702,8 +2702,10 @@ static int http_receive_data(HTTPContext *c)
|
||||
} else if (c->buffer_ptr - c->buffer >= 2 &&
|
||||
!memcmp(c->buffer_ptr - 1, "\r\n", 2)) {
|
||||
c->chunk_size = strtol(c->buffer, 0, 16);
|
||||
if (c->chunk_size == 0) // end of stream
|
||||
if (c->chunk_size <= 0) { // end of stream or invalid chunk size
|
||||
c->chunk_size = 0;
|
||||
goto fail;
|
||||
}
|
||||
c->buffer_ptr = c->buffer;
|
||||
break;
|
||||
} else if (++loop_run > 10)
|
||||
@@ -2725,6 +2727,7 @@ static int http_receive_data(HTTPContext *c)
|
||||
/* end of connection : close it */
|
||||
goto fail;
|
||||
else {
|
||||
av_assert0(len <= c->chunk_size);
|
||||
c->chunk_size -= len;
|
||||
c->buffer_ptr += len;
|
||||
c->data_count += len;
|
||||
@@ -3980,6 +3983,7 @@ int main(int argc, char **argv)
|
||||
int cfg_parsed;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
init_dynload();
|
||||
|
||||
config.filename = av_strdup("/etc/ffserver.conf");
|
||||
|
||||
|
||||
@@ -323,6 +323,8 @@ done:
|
||||
av_dict_free(&recommended);
|
||||
av_stream_set_recommended_encoder_configuration(st, enc_config);
|
||||
st->codec = av;
|
||||
st->codecpar = avcodec_parameters_alloc();
|
||||
avcodec_parameters_from_context(st->codecpar, av);
|
||||
stream->streams[stream->nb_streams++] = st;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,12 +119,15 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
|
||||
if (avctx->bits_per_coded_sample <= 8) {
|
||||
int size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt,
|
||||
AV_PKT_DATA_PALETTE,
|
||||
NULL);
|
||||
if (pal) {
|
||||
&size);
|
||||
if (pal && size == AVPALETTE_SIZE) {
|
||||
frame->palette_has_changed = 1;
|
||||
memcpy(c->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||
}
|
||||
|
||||
memcpy (frame->data[1], c->pal, AVPALETTE_SIZE);
|
||||
|
||||
@@ -528,7 +528,8 @@ OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
|
||||
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263data.o
|
||||
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o h263data.o \
|
||||
h263.o ituh263enc.o
|
||||
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o h264_parse.o h264data.o
|
||||
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o \
|
||||
h264_parse.o h264data.o h264_ps.o h2645_parse.o
|
||||
OBJS-$(CONFIG_TEXT_DECODER) += textdec.o ass.o
|
||||
OBJS-$(CONFIG_TEXT_ENCODER) += srtenc.o ass_split.o
|
||||
OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o takdsp.o
|
||||
|
||||
@@ -622,8 +622,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
|
||||
for (k = 0; k < 1024; k++) {
|
||||
if (!isfinite(cpe->ch[ch].coeffs[k])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
|
||||
if (!(fabs(cpe->ch[ch].coeffs[k]) < 1E16)) { // Ensure headroom for energy calculation
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains (near) NaN/+-Inf\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (avctx->bits_per_coded_sample != 4) {
|
||||
int samples_per_block = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
|
||||
int block_size = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2];
|
||||
uint8_t temp[20] = { 0 };
|
||||
uint8_t temp[20 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
|
||||
GetBitContext g;
|
||||
|
||||
for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) {
|
||||
|
||||
@@ -623,7 +623,7 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
else
|
||||
max_frame_size = s->max_coded_frame_size;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size, 0)) < 0)
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, 4 * max_frame_size, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
/* use verbatim mode for compression_level 0 */
|
||||
|
||||
@@ -94,6 +94,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (avctx->width % FONT_WIDTH || avctx->height % s->font_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ static inline void asv2_put_level(ASV1Context *a, PutBitContext *pb, int level)
|
||||
} else {
|
||||
put_bits(pb, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]);
|
||||
if (level < -128 || level > 127) {
|
||||
av_log(a->avctx, AV_LOG_WARNING, "Cliping level %d, increase qscale\n", level);
|
||||
av_log(a->avctx, AV_LOG_WARNING, "Clipping level %d, increase qscale\n", level);
|
||||
level = av_clip_int8(level);
|
||||
}
|
||||
asv2_put_bits(pb, 8, level & 0xFF);
|
||||
|
||||
@@ -139,7 +139,8 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
||||
pkt->buf = av_buffer_alloc(new_size);
|
||||
if (!pkt->buf)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(pkt->buf->data, pkt->data, pkt->size);
|
||||
if (pkt->size > 0)
|
||||
memcpy(pkt->buf->data, pkt->data, pkt->size);
|
||||
pkt->data = pkt->buf->data;
|
||||
}
|
||||
pkt->size += grow_by;
|
||||
@@ -198,6 +199,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
|
||||
{
|
||||
pkt->data = NULL;
|
||||
pkt->side_data = NULL;
|
||||
pkt->side_data_elems = 0;
|
||||
if (pkt->buf) {
|
||||
AVBufferRef *ref = av_buffer_ref(src->buf);
|
||||
if (!ref)
|
||||
@@ -207,9 +209,11 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
|
||||
} else {
|
||||
DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF);
|
||||
}
|
||||
if (pkt->side_data_elems && dup)
|
||||
if (src->side_data_elems && dup) {
|
||||
pkt->side_data = src->side_data;
|
||||
if (pkt->side_data_elems && !dup) {
|
||||
pkt->side_data_elems = src->side_data_elems;
|
||||
}
|
||||
if (src->side_data_elems && !dup) {
|
||||
return av_copy_packet_side_data(pkt, src);
|
||||
}
|
||||
return 0;
|
||||
@@ -291,16 +295,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
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;
|
||||
|
||||
if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
|
||||
return AVERROR(ERANGE);
|
||||
|
||||
pkt->side_data = av_realloc(pkt->side_data,
|
||||
(elems + 1) * sizeof(*pkt->side_data));
|
||||
if (!pkt->side_data)
|
||||
tmp = av_realloc(pkt->side_data, (elems + 1) * sizeof(*tmp));
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
pkt->side_data = tmp;
|
||||
pkt->side_data[elems].data = data;
|
||||
pkt->side_data[elems].size = size;
|
||||
pkt->side_data[elems].type = type;
|
||||
|
||||
@@ -1217,6 +1217,8 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
h->got_keyframe = 1;
|
||||
}
|
||||
case PIC_PB_START_CODE:
|
||||
if (*got_frame)
|
||||
av_frame_unref(data);
|
||||
*got_frame = 0;
|
||||
if (!h->got_keyframe)
|
||||
break;
|
||||
|
||||
@@ -188,7 +188,6 @@ static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc
|
||||
static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
|
||||
int i;
|
||||
int16_t (*src)[8] = (int16_t(*)[8])block;
|
||||
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
|
||||
|
||||
src[0][0] += 8;
|
||||
|
||||
@@ -243,14 +242,14 @@ static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
|
||||
const int b2 = a5 - a7;
|
||||
const int b3 = a4 - a6;
|
||||
|
||||
dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b4) >> 7)];
|
||||
dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b1 + b5) >> 7)];
|
||||
dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b2 + b6) >> 7)];
|
||||
dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b3 + b7) >> 7)];
|
||||
dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b3 - b7) >> 7)];
|
||||
dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b2 - b6) >> 7)];
|
||||
dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b1 - b5) >> 7)];
|
||||
dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b4) >> 7)];
|
||||
dst[i + 0*stride] = av_clip_uint8( dst[i + 0*stride] + ((b0 + b4) >> 7));
|
||||
dst[i + 1*stride] = av_clip_uint8( dst[i + 1*stride] + ((b1 + b5) >> 7));
|
||||
dst[i + 2*stride] = av_clip_uint8( dst[i + 2*stride] + ((b2 + b6) >> 7));
|
||||
dst[i + 3*stride] = av_clip_uint8( dst[i + 3*stride] + ((b3 + b7) >> 7));
|
||||
dst[i + 4*stride] = av_clip_uint8( dst[i + 4*stride] + ((b3 - b7) >> 7));
|
||||
dst[i + 5*stride] = av_clip_uint8( dst[i + 5*stride] + ((b2 - b6) >> 7));
|
||||
dst[i + 6*stride] = av_clip_uint8( dst[i + 6*stride] + ((b1 - b5) >> 7));
|
||||
dst[i + 7*stride] = av_clip_uint8( dst[i + 7*stride] + ((b0 - b4) >> 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,8 @@ typedef struct CCaptionSubContext {
|
||||
int64_t last_real_time;
|
||||
char prev_cmd[2];
|
||||
/* buffer to store pkt data */
|
||||
AVBufferRef *pktbuf;
|
||||
uint8_t *pktbuf;
|
||||
int pktbuf_size;
|
||||
int readorder;
|
||||
} CCaptionSubContext;
|
||||
|
||||
@@ -273,11 +274,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
/* allocate pkt buffer */
|
||||
ctx->pktbuf = av_buffer_alloc(128);
|
||||
if (!ctx->pktbuf) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -285,7 +282,8 @@ static av_cold int close_decoder(AVCodecContext *avctx)
|
||||
{
|
||||
CCaptionSubContext *ctx = avctx->priv_data;
|
||||
av_bprint_finalize(&ctx->buffer, NULL);
|
||||
av_buffer_unref(&ctx->pktbuf);
|
||||
av_freep(&ctx->pktbuf);
|
||||
ctx->pktbuf_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -729,16 +727,13 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (ctx->pktbuf->size < len) {
|
||||
ret = av_buffer_realloc(&ctx->pktbuf, len);
|
||||
if (ret < 0) {
|
||||
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf->size);
|
||||
len = ctx->pktbuf->size;
|
||||
ret = 0;
|
||||
}
|
||||
av_fast_padded_malloc(&ctx->pktbuf, &ctx->pktbuf_size, len);
|
||||
if (!ctx->pktbuf) {
|
||||
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf_size);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(ctx->pktbuf->data, avpkt->data, len);
|
||||
bptr = ctx->pktbuf->data;
|
||||
memcpy(ctx->pktbuf, avpkt->data, len);
|
||||
bptr = ctx->pktbuf;
|
||||
|
||||
for (i = 0; i < len; i += 3) {
|
||||
uint8_t cc_type = *(bptr + i) & 3;
|
||||
|
||||
@@ -320,7 +320,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->plane[s->channel_num].band[0][0].width = data;
|
||||
s->plane[s->channel_num].band[0][0].stride = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Lowpass width %"PRIu16"\n", data);
|
||||
if (data < 2 || data > s->plane[s->channel_num].band[0][0].a_width) {
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].a_width) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid lowpass width\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -328,7 +328,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
} else if (tag == 28) {
|
||||
s->plane[s->channel_num].band[0][0].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Lowpass height %"PRIu16"\n", data);
|
||||
if (data < 2 || data > s->plane[s->channel_num].band[0][0].height) {
|
||||
if (data < 3 || data > s->plane[s->channel_num].band[0][0].height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid lowpass height\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -366,7 +366,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass width %i channel %i level %i subband %i\n", data, s->channel_num, s->level, s->subband_num);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass width\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -374,7 +374,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
} else if (tag == 42) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass height %i\n", data);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass height\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -383,7 +383,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].width = data;
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].stride = FFALIGN(data, 8);
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass width2 %i\n", data);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass width2\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
@@ -391,7 +391,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
} else if (tag == 50) {
|
||||
s->plane[s->channel_num].band[s->level][s->subband_num].height = data;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Highpass height2 %i\n", data);
|
||||
if (data < 2) {
|
||||
if (data < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid highpass height2\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
break;
|
||||
|
||||
@@ -443,10 +443,13 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
|
||||
if (s->palette_video) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
if (pal) {
|
||||
int size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
|
||||
if (pal && size == AVPALETTE_SIZE) {
|
||||
s->frame->palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ static int parse_tonal(DCALbrDecoder *s, int group)
|
||||
break; // End of subframe
|
||||
|
||||
freq += diff - 2;
|
||||
if (freq >> (5 - group) > s->nsubbands * 4 - 5) {
|
||||
if (freq >> (5 - group) > s->nsubbands * 4 - 6) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid spectral line offset\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1153,6 +1153,11 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
||||
else {
|
||||
s->num_x = get_interleaved_ue_golomb(gb);
|
||||
s->num_y = get_interleaved_ue_golomb(gb);
|
||||
if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX) {
|
||||
av_log(s->avctx,AV_LOG_ERROR,"Invalid numx/y\n");
|
||||
s->num_x = s->num_y = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->ld_picture) {
|
||||
s->lowdelay.bytes.num = get_interleaved_ue_golomb(gb);
|
||||
s->lowdelay.bytes.den = get_interleaved_ue_golomb(gb);
|
||||
@@ -1895,7 +1900,9 @@ static int dirac_decode_picture_header(DiracContext *s)
|
||||
for (j = 0; j < MAX_FRAMES; j++)
|
||||
if (!s->all_frames[j].avframe->data[0]) {
|
||||
s->ref_pics[i] = &s->all_frames[j];
|
||||
get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
|
||||
ret = get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,11 +118,6 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, bitdepth);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (bitdepth > 10) {
|
||||
avpriv_request_sample(ctx->avctx, "DNXHR 12-bit");
|
||||
if (ctx->avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
ctx->cid_table = &ff_dnxhd_cid_table[index];
|
||||
av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %d.\n", cid);
|
||||
|
||||
@@ -133,7 +128,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
|
||||
init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
|
||||
ctx->cid_table->ac_bits, 1, 1,
|
||||
ctx->cid_table->ac_codes, 2, 2, 0);
|
||||
init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth + 4,
|
||||
init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12,
|
||||
ctx->cid_table->dc_bits, 1, 1,
|
||||
ctx->cid_table->dc_codes, 1, 1, 0);
|
||||
init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62,
|
||||
|
||||
@@ -810,7 +810,7 @@ static void compute_default_clut(AVSubtitleRect *rect, int w, int h)
|
||||
list_inv[ i ] = bestv;
|
||||
}
|
||||
|
||||
count = i - 1;
|
||||
count = FFMAX(i - 1, 1);
|
||||
for (i--; i>=0; i--) {
|
||||
int v = i*255/count;
|
||||
AV_WN32(rect->data[1] + 4*list_inv[i], RGBA(v/2,v,v/2,v));
|
||||
|
||||
@@ -185,7 +185,7 @@ static void guess_palette(DVDSubContext* ctx,
|
||||
for(i = 0; i < 4; i++) {
|
||||
if (alpha[i] != 0) {
|
||||
if (!color_used[colormap[i]]) {
|
||||
level = level_map[nb_opaque_colors][j];
|
||||
level = level_map[nb_opaque_colors - 1][j];
|
||||
r = (((subtitle_color >> 16) & 0xff) * level) >> 8;
|
||||
g = (((subtitle_color >> 8) & 0xff) * level) >> 8;
|
||||
b = (((subtitle_color >> 0) & 0xff) * level) >> 8;
|
||||
@@ -548,7 +548,8 @@ static int append_to_cached_buf(AVCodecContext *avctx,
|
||||
{
|
||||
DVDSubContext *ctx = avctx->priv_data;
|
||||
|
||||
if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
|
||||
av_assert0(buf_size >= 0 && ctx->buf_size <= sizeof(ctx->buf));
|
||||
if (buf_size >= sizeof(ctx->buf) - ctx->buf_size) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
|
||||
"too large SPU packets aborted.\n");
|
||||
ctx->buf_size = 0;
|
||||
|
||||
@@ -250,6 +250,10 @@ static int escape124_decode_frame(AVCodecContext *avctx,
|
||||
// This codebook can be cut off at places other than
|
||||
// powers of 2, leaving some of the entries undefined.
|
||||
cb_size = get_bits_long(&gb, 20);
|
||||
if (!cb_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid codebook size 0.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
cb_depth = av_log2(cb_size - 1) + 1;
|
||||
} else {
|
||||
cb_depth = get_bits(&gb, 4);
|
||||
|
||||
@@ -749,6 +749,9 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
|
||||
uint16_t *tmp = (uint16_t *)td->tmp;
|
||||
uint8_t *out;
|
||||
int ret, i, j;
|
||||
int pixel_half_size;/* 1 for half, 2 for float and uint32 */
|
||||
EXRChannel *channel;
|
||||
int tmp_offset;
|
||||
|
||||
if (!td->bitmap)
|
||||
td->bitmap = av_malloc(BITMAP_SIZE);
|
||||
@@ -781,24 +784,38 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
|
||||
|
||||
ptr = tmp;
|
||||
for (i = 0; i < s->nb_channels; i++) {
|
||||
EXRChannel *channel = &s->channels[i];
|
||||
int size = channel->pixel_type;
|
||||
channel = &s->channels[i];
|
||||
|
||||
for (j = 0; j < size; j++)
|
||||
wav_decode(ptr + j, td->xsize, size, td->ysize,
|
||||
td->xsize * size, maxval);
|
||||
ptr += td->xsize * td->ysize * size;
|
||||
if (channel->pixel_type == EXR_HALF)
|
||||
pixel_half_size = 1;
|
||||
else
|
||||
pixel_half_size = 2;
|
||||
|
||||
for (j = 0; j < pixel_half_size; j++)
|
||||
wav_decode(ptr + j, td->xsize, pixel_half_size, td->ysize,
|
||||
td->xsize * pixel_half_size, maxval);
|
||||
ptr += td->xsize * td->ysize * pixel_half_size;
|
||||
}
|
||||
|
||||
apply_lut(td->lut, tmp, dsize / sizeof(uint16_t));
|
||||
|
||||
out = td->uncompressed_data;
|
||||
for (i = 0; i < td->ysize; i++)
|
||||
for (i = 0; i < td->ysize; i++) {
|
||||
tmp_offset = 0;
|
||||
for (j = 0; j < s->nb_channels; j++) {
|
||||
uint16_t *in = tmp + j * td->xsize * td->ysize + i * td->xsize;
|
||||
memcpy(out, in, td->xsize * 2);
|
||||
out += td->xsize * 2;
|
||||
uint16_t *in;
|
||||
EXRChannel *channel = &s->channels[j];
|
||||
if (channel->pixel_type == EXR_HALF)
|
||||
pixel_half_size = 1;
|
||||
else
|
||||
pixel_half_size = 2;
|
||||
|
||||
in = tmp + tmp_offset * td->xsize * td->ysize + i * td->xsize * pixel_half_size;
|
||||
tmp_offset += pixel_half_size;
|
||||
memcpy(out, in, td->xsize * 2 * pixel_half_size);
|
||||
out += td->xsize * 2 * pixel_half_size;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1010,8 +1027,9 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
uint64_t line_offset, uncompressed_size;
|
||||
uint16_t *ptr_x;
|
||||
uint8_t *ptr;
|
||||
uint32_t data_size, line, col = 0;
|
||||
uint32_t tileX, tileY, tileLevelX, tileLevelY;
|
||||
uint32_t data_size;
|
||||
uint64_t line, col = 0;
|
||||
uint64_t tileX, tileY, tileLevelX, tileLevelY;
|
||||
const uint8_t *src;
|
||||
int axmax = (avctx->width - (s->xmax + 1)) * 2 * s->desc->nb_components; /* nb pixel to add at the right of the datawindow */
|
||||
int bxmin = s->xmin * 2 * s->desc->nb_components; /* nb pixel to add at the left of the datawindow */
|
||||
@@ -1042,9 +1060,18 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (s->xmin || s->ymin) {
|
||||
avpriv_report_missing_feature(s->avctx, "Tiles with xmin/ymin");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
line = s->tile_attr.ySize * tileY;
|
||||
col = s->tile_attr.xSize * tileX;
|
||||
|
||||
if (line < s->ymin || line > s->ymax ||
|
||||
col < s->xmin || col > s->xmax)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
td->ysize = FFMIN(s->tile_attr.ySize, s->ydelta - tileY * s->tile_attr.ySize);
|
||||
td->xsize = FFMIN(s->tile_attr.xSize, s->xdelta - tileX * s->tile_attr.xSize);
|
||||
|
||||
@@ -1390,17 +1417,15 @@ static int decode_header(EXRContext *s)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (s->channel_offsets[channel_index] == -1){/* channel have not been previously assign */
|
||||
if (channel_index >= 0) {
|
||||
if (s->pixel_type != EXR_UNKNOWN &&
|
||||
s->pixel_type != current_pixel_type) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"RGB channels not of the same depth.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->pixel_type = current_pixel_type;
|
||||
s->channel_offsets[channel_index] = s->current_channel_offset;
|
||||
if (channel_index >= 0 && s->channel_offsets[channel_index] == -1) { /* channel has not been previously assigned */
|
||||
if (s->pixel_type != EXR_UNKNOWN &&
|
||||
s->pixel_type != current_pixel_type) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"RGB channels not of the same depth.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->pixel_type = current_pixel_type;
|
||||
s->channel_offsets[channel_index] = s->current_channel_offset;
|
||||
}
|
||||
|
||||
s->channels = av_realloc(s->channels,
|
||||
|
||||
@@ -781,14 +781,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
s->colorspace = 1;
|
||||
s->transparency = 1;
|
||||
s->chroma_planes = 1;
|
||||
if (!avctx->bits_per_raw_sample)
|
||||
s->bits_per_raw_sample = 8;
|
||||
s->bits_per_raw_sample = 8;
|
||||
break;
|
||||
case AV_PIX_FMT_0RGB32:
|
||||
s->colorspace = 1;
|
||||
s->chroma_planes = 1;
|
||||
if (!avctx->bits_per_raw_sample)
|
||||
s->bits_per_raw_sample = 8;
|
||||
s->bits_per_raw_sample = 8;
|
||||
break;
|
||||
case AV_PIX_FMT_GBRP9:
|
||||
if (!avctx->bits_per_raw_sample)
|
||||
@@ -1225,7 +1223,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
FFV1Context *f = avctx->priv_data;
|
||||
RangeCoder *const c = &f->slice_context[0]->c;
|
||||
AVFrame *const p = f->picture.f;
|
||||
int used_count = 0;
|
||||
uint8_t keystate = 128;
|
||||
uint8_t *buf_p;
|
||||
int i, ret;
|
||||
@@ -1281,6 +1278,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
if (f->version > 3)
|
||||
maxsize = AV_INPUT_BUFFER_MIN_SIZE + avctx->width*avctx->height*3LL*4;
|
||||
|
||||
if (maxsize > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Cannot allocate worst case packet size, the encoding could fail\n");
|
||||
maxsize = INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32;
|
||||
}
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, maxsize, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1314,11 +1316,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 1; i < f->slice_count; i++) {
|
||||
for (i = 0; i < f->slice_count; i++) {
|
||||
FFV1Context *fs = f->slice_context[i];
|
||||
uint8_t *start = pkt->data + (pkt->size - used_count) * (int64_t)i / f->slice_count;
|
||||
uint8_t *start = pkt->data + pkt->size * (int64_t)i / f->slice_count;
|
||||
int len = pkt->size / f->slice_count;
|
||||
ff_init_range_encoder(&fs->c, start, len);
|
||||
if (i) {
|
||||
ff_init_range_encoder(&fs->c, start, len);
|
||||
} else {
|
||||
av_assert0(fs->c.bytestream_end >= fs->c.bytestream_start + len);
|
||||
av_assert0(fs->c.bytestream < fs->c.bytestream_start + len);
|
||||
fs->c.bytestream_end = fs->c.bytestream_start + len;
|
||||
}
|
||||
}
|
||||
avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL,
|
||||
f->slice_count, sizeof(void *));
|
||||
|
||||
@@ -586,10 +586,12 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
temp = curr->next;
|
||||
av_freep(&curr->link_penalty);
|
||||
av_free(curr);
|
||||
fpc->nb_headers_buffered--;
|
||||
}
|
||||
fpc->headers = fpc->best_header->next;
|
||||
av_freep(&fpc->best_header->link_penalty);
|
||||
av_freep(&fpc->best_header);
|
||||
fpc->nb_headers_buffered--;
|
||||
}
|
||||
|
||||
/* Find and score new headers. */
|
||||
|
||||
@@ -268,7 +268,8 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
|
||||
int pred_order, int bps)
|
||||
{
|
||||
const int blocksize = s->blocksize;
|
||||
int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i;
|
||||
unsigned av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d);
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
/* warm up samples */
|
||||
@@ -447,7 +448,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
|
||||
if (wasted) {
|
||||
int i;
|
||||
for (i = 0; i < s->blocksize; i++)
|
||||
decoded[i] <<= wasted;
|
||||
decoded[i] = (unsigned)decoded[i] << wasted;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -56,7 +56,7 @@ static void FUNC(flac_decorrelate_indep_c)(uint8_t **out, int32_t **in,
|
||||
|
||||
for (j = 0; j < len; j++)
|
||||
for (i = 0; i < channels; i++)
|
||||
S(samples, i, j) = in[i][j] << shift;
|
||||
S(samples, i, j) = (int)((unsigned)in[i][j] << shift);
|
||||
}
|
||||
|
||||
static void FUNC(flac_decorrelate_ls_c)(uint8_t **out, int32_t **in,
|
||||
|
||||
@@ -206,7 +206,7 @@ static int16_t g726_decode(G726Context* c, int I)
|
||||
|
||||
if (I_sig) /* get the sign */
|
||||
dq = -dq;
|
||||
re_signal = c->se + dq;
|
||||
re_signal = (int16_t)(c->se + dq);
|
||||
|
||||
/* Update second order predictor coefficient A2 and A1 */
|
||||
pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;
|
||||
|
||||
@@ -369,6 +369,10 @@ static inline uint64_t get_bits64(GetBitContext *s, int n)
|
||||
*/
|
||||
static inline int get_sbits_long(GetBitContext *s, int n)
|
||||
{
|
||||
// sign_extend(x, 0) is undefined
|
||||
if (!n)
|
||||
return 0;
|
||||
|
||||
return sign_extend(get_bits_long(s, n), n);
|
||||
}
|
||||
|
||||
|
||||
@@ -898,7 +898,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
|
||||
}
|
||||
|
||||
ret = ff_h2645_packet_split(&h->pkt, buf, buf_size, avctx, h->is_avc,
|
||||
h->nal_length_size, avctx->codec_id);
|
||||
h->nal_length_size, avctx->codec_id, avctx->flags2 & AV_CODEC_FLAG2_FAST);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error splitting the input into NAL units.\n");
|
||||
@@ -1023,7 +1023,8 @@ again:
|
||||
#endif
|
||||
} else
|
||||
context_count++;
|
||||
}
|
||||
} else
|
||||
sl->ref_count[0] = sl->ref_count[1] = 0;
|
||||
break;
|
||||
case NAL_DPA:
|
||||
case NAL_DPB:
|
||||
|
||||
@@ -57,8 +57,6 @@
|
||||
|
||||
#define MAX_DELAYED_PIC_COUNT 16
|
||||
|
||||
#define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
|
||||
|
||||
/* Compiling in interlaced support reduces the speed
|
||||
* of progressive decoding by about 2%. */
|
||||
#define ALLOW_INTERLACE
|
||||
|
||||
@@ -30,10 +30,11 @@
|
||||
#include "h2645_parse.h"
|
||||
|
||||
int ff_h2645_extract_rbsp(const uint8_t *src, int length,
|
||||
H2645NAL *nal)
|
||||
H2645NAL *nal, int small_padding)
|
||||
{
|
||||
int i, si, di;
|
||||
uint8_t *dst;
|
||||
int64_t padding = small_padding ? 0 : MAX_MBPAIR_SIZE;
|
||||
|
||||
nal->skipped_bytes = 0;
|
||||
#define STARTCODE_TEST \
|
||||
@@ -81,16 +82,17 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length,
|
||||
}
|
||||
#endif /* HAVE_FAST_UNALIGNED */
|
||||
|
||||
if (i >= length - 1) { // no escaped 0
|
||||
if (i >= length - 1 && small_padding) { // no escaped 0
|
||||
nal->data =
|
||||
nal->raw_data = src;
|
||||
nal->size =
|
||||
nal->raw_size = length;
|
||||
return length;
|
||||
}
|
||||
} else if (i > length)
|
||||
i = length;
|
||||
|
||||
av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,
|
||||
length + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
av_fast_padded_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,
|
||||
length + padding);
|
||||
if (!nal->rbsp_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -247,7 +249,7 @@ static int h264_parse_nal_header(H2645NAL *nal, void *logctx)
|
||||
|
||||
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
void *logctx, int is_nalff, int nal_length_size,
|
||||
enum AVCodecID codec_id)
|
||||
enum AVCodecID codec_id, int small_padding)
|
||||
{
|
||||
int consumed, ret = 0;
|
||||
const uint8_t *next_avc = is_nalff ? buf : buf + length;
|
||||
@@ -258,19 +260,21 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
int extract_length = 0;
|
||||
int skip_trailing_zeros = 1;
|
||||
|
||||
if (buf >= next_avc) {
|
||||
int i;
|
||||
for (i = 0; i < nal_length_size; i++)
|
||||
extract_length = (extract_length << 8) | buf[i];
|
||||
if (buf == next_avc) {
|
||||
int i = 0;
|
||||
extract_length = get_nalsize(nal_length_size,
|
||||
buf, length, &i, logctx);
|
||||
if (extract_length < 0)
|
||||
return extract_length;
|
||||
|
||||
buf += nal_length_size;
|
||||
length -= nal_length_size;
|
||||
|
||||
if (extract_length > length) {
|
||||
av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit size.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
next_avc = buf + extract_length;
|
||||
} else {
|
||||
if (buf > next_avc)
|
||||
av_log(logctx, AV_LOG_WARNING, "Exceeded next NALFF position, re-syncing.\n");
|
||||
|
||||
/* search start code */
|
||||
while (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
|
||||
++buf;
|
||||
@@ -290,7 +294,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
|
||||
buf += 3;
|
||||
length -= 3;
|
||||
extract_length = length;
|
||||
extract_length = FFMIN(length, next_avc - buf);
|
||||
|
||||
if (buf >= next_avc) {
|
||||
/* skip to the start of the next NAL */
|
||||
@@ -322,7 +326,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
}
|
||||
nal = &pkt->nals[pkt->nb_nals];
|
||||
|
||||
consumed = ff_h2645_extract_rbsp(buf, extract_length, nal);
|
||||
consumed = ff_h2645_extract_rbsp(buf, extract_length, nal, small_padding);
|
||||
if (consumed < 0)
|
||||
return consumed;
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
#define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
|
||||
|
||||
typedef struct H2645NAL {
|
||||
uint8_t *rbsp_buffer;
|
||||
int rbsp_buffer_size;
|
||||
@@ -74,18 +76,38 @@ typedef struct H2645Packet {
|
||||
* Extract the raw (unescaped) bitstream.
|
||||
*/
|
||||
int ff_h2645_extract_rbsp(const uint8_t *src, int length,
|
||||
H2645NAL *nal);
|
||||
H2645NAL *nal, int small_padding);
|
||||
|
||||
/**
|
||||
* Split an input packet into NAL units.
|
||||
*/
|
||||
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
void *logctx, int is_nalff, int nal_length_size,
|
||||
enum AVCodecID codec_id);
|
||||
enum AVCodecID codec_id, int small_padding);
|
||||
|
||||
/**
|
||||
* Free all the allocated memory in the packet.
|
||||
*/
|
||||
void ff_h2645_packet_uninit(H2645Packet *pkt);
|
||||
|
||||
static inline int get_nalsize(int nal_length_size, const uint8_t *buf,
|
||||
int buf_size, int *buf_index, void *logctx)
|
||||
{
|
||||
int i, nalsize = 0;
|
||||
|
||||
if (*buf_index >= buf_size - nal_length_size) {
|
||||
// the end of the buffer is reached, refill it
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
for (i = 0; i < nal_length_size; i++)
|
||||
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
|
||||
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
|
||||
av_log(logctx, AV_LOG_ERROR,
|
||||
"Invalid nal size %d\n", nalsize);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return nalsize;
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_H2645_PARSE_H */
|
||||
|
||||
@@ -327,7 +327,7 @@ static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps,
|
||||
H2645Packet pkt = { 0 };
|
||||
int i, ret = 0;
|
||||
|
||||
ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264);
|
||||
ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264, 1);
|
||||
if (ret < 0) {
|
||||
ret = 0;
|
||||
goto fail;
|
||||
|
||||
@@ -226,26 +226,6 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int get_avc_nalsize(H264ParseContext *p, const uint8_t *buf,
|
||||
int buf_size, int *buf_index, void *logctx)
|
||||
{
|
||||
int i, nalsize = 0;
|
||||
|
||||
if (*buf_index >= buf_size - p->nal_length_size) {
|
||||
// the end of the buffer is reached, refill it
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
for (i = 0; i < p->nal_length_size; i++)
|
||||
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
|
||||
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
|
||||
av_log(logctx, AV_LOG_ERROR,
|
||||
"AVC: nal size %d\n", nalsize);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return nalsize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse NAL units of found picture and decode some basic information.
|
||||
*
|
||||
@@ -286,7 +266,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
int src_length, consumed, nalsize = 0;
|
||||
|
||||
if (buf_index >= next_avc) {
|
||||
nalsize = get_avc_nalsize(p, buf, buf_size, &buf_index, avctx);
|
||||
nalsize = get_nalsize(p->nal_length_size, buf, buf_size, &buf_index, avctx);
|
||||
if (nalsize < 0)
|
||||
break;
|
||||
next_avc = buf_index + nalsize;
|
||||
@@ -316,7 +296,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
}
|
||||
break;
|
||||
}
|
||||
consumed = ff_h2645_extract_rbsp(buf + buf_index, src_length, &nal);
|
||||
consumed = ff_h2645_extract_rbsp(buf + buf_index, src_length, &nal, 1);
|
||||
if (consumed < 0)
|
||||
break;
|
||||
|
||||
@@ -367,13 +347,26 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
"non-existing PPS %u referenced\n", pps_id);
|
||||
goto fail;
|
||||
}
|
||||
p->ps.pps = (const PPS*)p->ps.pps_list[pps_id]->data;
|
||||
|
||||
av_buffer_unref(&p->ps.pps_ref);
|
||||
av_buffer_unref(&p->ps.sps_ref);
|
||||
p->ps.pps = NULL;
|
||||
p->ps.sps = NULL;
|
||||
p->ps.pps_ref = av_buffer_ref(p->ps.pps_list[pps_id]);
|
||||
if (!p->ps.pps_ref)
|
||||
goto fail;
|
||||
p->ps.pps = (const PPS*)p->ps.pps_ref->data;
|
||||
|
||||
if (!p->ps.sps_list[p->ps.pps->sps_id]) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"non-existing SPS %u referenced\n", p->ps.pps->sps_id);
|
||||
goto fail;
|
||||
}
|
||||
p->ps.sps = (SPS*)p->ps.sps_list[p->ps.pps->sps_id]->data;
|
||||
|
||||
p->ps.sps_ref = av_buffer_ref(p->ps.sps_list[p->ps.pps->sps_id]);
|
||||
if (!p->ps.sps_ref)
|
||||
goto fail;
|
||||
p->ps.sps = (SPS*)p->ps.sps_ref->data;
|
||||
|
||||
sps = p->ps.sps;
|
||||
|
||||
|
||||
@@ -2867,7 +2867,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
|
||||
/* split the input packet into NAL units, so we know the upper bound on the
|
||||
* number of slices in the frame */
|
||||
ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff,
|
||||
s->nal_length_size, s->avctx->codec_id);
|
||||
s->nal_length_size, s->avctx->codec_id, 1);
|
||||
if (ret < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Error splitting the input into NAL units.\n");
|
||||
|
||||
@@ -90,7 +90,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
|
||||
int ret, i;
|
||||
|
||||
ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, 0, 0,
|
||||
AV_CODEC_ID_HEVC);
|
||||
AV_CODEC_ID_HEVC, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -243,7 +243,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
|
||||
src_length = 20;
|
||||
}
|
||||
|
||||
consumed = ff_h2645_extract_rbsp(buf, src_length, nal);
|
||||
consumed = ff_h2645_extract_rbsp(buf, src_length, nal, 1);
|
||||
if (consumed < 0)
|
||||
return consumed;
|
||||
|
||||
|
||||
@@ -214,7 +214,8 @@ static int idcin_decode_frame(AVCodecContext *avctx,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
IdcinContext *s = avctx->priv_data;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
int pal_size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
|
||||
AVFrame *frame = data;
|
||||
int ret;
|
||||
|
||||
@@ -227,9 +228,11 @@ static int idcin_decode_frame(AVCodecContext *avctx,
|
||||
if (idcin_decode_vlcs(s, frame))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (pal) {
|
||||
if (pal && pal_size == AVPALETTE_SIZE) {
|
||||
frame->palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
|
||||
}
|
||||
/* make the palette available on the way out */
|
||||
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
|
||||
|
||||
@@ -171,6 +171,12 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
ltab = buf[0x22] & 3;
|
||||
ctab = buf[0x22] >> 2;
|
||||
|
||||
if (ctab > 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "ctab %d is invalid\n", ctab);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->decode_delta) { /* intraframe */
|
||||
if ((ret = ir2_decode_plane(s, avctx->width, avctx->height,
|
||||
p->data[0], p->linesize[0],
|
||||
|
||||
@@ -61,6 +61,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
if (avctx->extradata_size < 14)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (avctx->channels <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->channels);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->level = AV_RL16(avctx->extradata + 12) & 0xf;
|
||||
s->rows = AV_RL16(avctx->extradata + 12) >> 4;
|
||||
s->cols = 1 << s->level;
|
||||
@@ -71,7 +76,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->block = av_calloc(s->block_len, sizeof(int));
|
||||
s->wrapbuf = av_calloc(s->wrapbuf_len, sizeof(int));
|
||||
s->ampbuf = av_calloc(0x10000, sizeof(int));
|
||||
s->bitstream = av_calloc(s->max_framesize, sizeof(*s->bitstream));
|
||||
s->bitstream = av_calloc(s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*s->bitstream) + 1, sizeof(*s->bitstream));
|
||||
if (!s->block || !s->wrapbuf || !s->ampbuf || !s->bitstream)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -325,6 +330,10 @@ static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
|
||||
for (i = 0; i < s->rows; i++) {
|
||||
/* b = (x1) + (x2 * 3) + (x3 * 9) */
|
||||
b = get_bits(gb, 5);
|
||||
if (b > 26) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 26\n", b);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
n1 = (mul_3x3[b] & 0x0F) - 1;
|
||||
n2 = ((mul_3x3[b] >> 4) & 0x0F) - 1;
|
||||
@@ -350,6 +359,10 @@ static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
|
||||
for (i = 0; i < s->rows; i++) {
|
||||
/* b = (x1) + (x2 * 5) + (x3 * 25) */
|
||||
b = get_bits(gb, 7);
|
||||
if (b > 124) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 124\n", b);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
n1 = (mul_3x5[b] & 0x0F) - 2;
|
||||
n2 = ((mul_3x5[b] >> 4) & 0x0F) - 2;
|
||||
@@ -374,6 +387,10 @@ static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
|
||||
for (i = 0; i < s->rows; i++) {
|
||||
/* b = (x1) + (x2 * 11) */
|
||||
b = get_bits(gb, 7);
|
||||
if (b > 120) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 120\n", b);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
n1 = (mul_2x11[b] & 0x0F) - 5;
|
||||
n2 = ((mul_2x11[b] >> 4) & 0x0F) - 5;
|
||||
|
||||
@@ -988,6 +988,11 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
AVFrame *frame = data;
|
||||
int ret;
|
||||
|
||||
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
|
||||
av_frame_unref(s->last_frame);
|
||||
av_frame_unref(s->second_last_frame);
|
||||
}
|
||||
|
||||
if (buf_size < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -999,10 +1004,6 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
if (buf_size < s->decoding_map_size + 2)
|
||||
return buf_size;
|
||||
|
||||
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
|
||||
av_frame_unref(s->last_frame);
|
||||
av_frame_unref(s->second_last_frame);
|
||||
}
|
||||
|
||||
s->decoding_map = buf + 2;
|
||||
bytestream2_init(&s->stream_ptr, buf + 2 + s->decoding_map_size,
|
||||
@@ -1012,10 +1013,13 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
|
||||
if (!s->is_16bpp) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
if (pal) {
|
||||
int size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
|
||||
if (pal && size == AVPALETTE_SIZE) {
|
||||
frame->palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ static int h263_decode_gob_header(MpegEncContext *s)
|
||||
/* We have a GBSC probably with GSTUFF */
|
||||
skip_bits(&s->gb, 16); /* Drop the zeros */
|
||||
left= get_bits_left(&s->gb);
|
||||
left = FFMIN(left, 32);
|
||||
//MN: we must check the bits left or we might end in an infinite loop (or segfault)
|
||||
for(;left>13; left--){
|
||||
if(get_bits1(&s->gb)) break; /* Seek the '1' bit */
|
||||
|
||||
@@ -20,19 +20,18 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "jni.h"
|
||||
|
||||
#if CONFIG_JNI
|
||||
|
||||
#include <errno.h>
|
||||
#include <jni.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "ffjni.h"
|
||||
|
||||
void *java_vm;
|
||||
@@ -69,7 +68,7 @@ void *av_jni_get_java_vm(void *log_ctx)
|
||||
|
||||
int av_jni_set_java_vm(void *vm, void *log_ctx)
|
||||
{
|
||||
return 0;
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
void *av_jni_get_java_vm(void *log_ctx)
|
||||
|
||||
@@ -268,7 +268,8 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame,
|
||||
int i, ret;
|
||||
int header;
|
||||
int blocksize;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
int pal_size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
|
||||
|
||||
bytestream2_init(&ctx->g, avpkt->data, avpkt->size);
|
||||
|
||||
@@ -303,9 +304,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame,
|
||||
}
|
||||
}
|
||||
|
||||
if (pal) {
|
||||
if (pal && pal_size == AVPALETTE_SIZE) {
|
||||
frame->palette_has_changed = 1;
|
||||
memcpy(ctx->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
|
||||
}
|
||||
|
||||
if (ctx->setpal) {
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
* JPEG 2000 decoder using libopenjpeg
|
||||
*/
|
||||
|
||||
#define OPJ_STATIC
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
* JPEG 2000 encoder using libopenjpeg
|
||||
*/
|
||||
|
||||
#define OPJ_STATIC
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
@@ -54,7 +52,9 @@
|
||||
|
||||
typedef struct LibOpenJPEGContext {
|
||||
AVClass *avclass;
|
||||
#if OPENJPEG_MAJOR_VERSION == 1
|
||||
opj_image_t *image;
|
||||
#endif // OPENJPEG_MAJOR_VERSION == 1
|
||||
opj_cparameters_t enc_params;
|
||||
#if OPENJPEG_MAJOR_VERSION == 1
|
||||
opj_event_mgr_t event_mgr;
|
||||
@@ -371,18 +371,22 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
|
||||
cinema_parameters(&ctx->enc_params);
|
||||
}
|
||||
|
||||
#if OPENJPEG_MAJOR_VERSION == 1
|
||||
ctx->image = mj2_create_image(avctx, &ctx->enc_params);
|
||||
if (!ctx->image) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
|
||||
err = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
#endif // OPENJPEG_MAJOR_VERSION == 1
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
#if OPENJPEG_MAJOR_VERSION == 1
|
||||
opj_image_destroy(ctx->image);
|
||||
ctx->image = NULL;
|
||||
#endif // OPENJPEG_MAJOR_VERSION == 1
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -417,7 +421,7 @@ static int libopenjpeg_copy_packed8(AVCodecContext *avctx, const AVFrame *frame,
|
||||
for (; y < image->comps[compno].h; ++y) {
|
||||
image_line = image->comps[compno].data + y * image->comps[compno].w;
|
||||
for (x = 0; x < image->comps[compno].w; ++x) {
|
||||
image_line[x] = image_line[x - image->comps[compno].w];
|
||||
image_line[x] = image_line[x - (int)image->comps[compno].w];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,7 +461,7 @@ static int libopenjpeg_copy_packed12(AVCodecContext *avctx, const AVFrame *frame
|
||||
for (; y < image->comps[compno].h; ++y) {
|
||||
image_line = image->comps[compno].data + y * image->comps[compno].w;
|
||||
for (x = 0; x < image->comps[compno].w; ++x) {
|
||||
image_line[x] = image_line[x - image->comps[compno].w];
|
||||
image_line[x] = image_line[x - (int)image->comps[compno].w];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -497,7 +501,7 @@ static int libopenjpeg_copy_packed16(AVCodecContext *avctx, const AVFrame *frame
|
||||
for (; y < image->comps[compno].h; ++y) {
|
||||
image_line = image->comps[compno].data + y * image->comps[compno].w;
|
||||
for (x = 0; x < image->comps[compno].w; ++x) {
|
||||
image_line[x] = image_line[x - image->comps[compno].w];
|
||||
image_line[x] = image_line[x - (int)image->comps[compno].w];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,8 +528,8 @@ static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *fram
|
||||
}
|
||||
|
||||
for (compno = 0; compno < numcomps; ++compno) {
|
||||
width = avctx->width / image->comps[compno].dx;
|
||||
height = avctx->height / image->comps[compno].dy;
|
||||
width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx;
|
||||
height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
|
||||
for (y = 0; y < height; ++y) {
|
||||
image_line = image->comps[compno].data + y * image->comps[compno].w;
|
||||
frame_index = y * frame->linesize[compno];
|
||||
@@ -538,7 +542,7 @@ static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *fram
|
||||
for (; y < image->comps[compno].h; ++y) {
|
||||
image_line = image->comps[compno].data + y * image->comps[compno].w;
|
||||
for (x = 0; x < image->comps[compno].w; ++x) {
|
||||
image_line[x] = image_line[x - image->comps[compno].w];
|
||||
image_line[x] = image_line[x - (int)image->comps[compno].w];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -566,8 +570,8 @@ static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *fra
|
||||
}
|
||||
|
||||
for (compno = 0; compno < numcomps; ++compno) {
|
||||
width = avctx->width / image->comps[compno].dx;
|
||||
height = avctx->height / image->comps[compno].dy;
|
||||
width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx;
|
||||
height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
|
||||
frame_ptr = (uint16_t *)frame->data[compno];
|
||||
for (y = 0; y < height; ++y) {
|
||||
image_line = image->comps[compno].data + y * image->comps[compno].w;
|
||||
@@ -581,7 +585,7 @@ static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *fra
|
||||
for (; y < image->comps[compno].h; ++y) {
|
||||
image_line = image->comps[compno].data + y * image->comps[compno].w;
|
||||
for (x = 0; x < image->comps[compno].w; ++x) {
|
||||
image_line[x] = image_line[x - image->comps[compno].w];
|
||||
image_line[x] = image_line[x - (int)image->comps[compno].w];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -593,19 +597,25 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
const AVFrame *frame, int *got_packet)
|
||||
{
|
||||
LibOpenJPEGContext *ctx = avctx->priv_data;
|
||||
opj_image_t *image = ctx->image;
|
||||
int ret;
|
||||
AVFrame *gbrframe;
|
||||
int cpyresult = 0;
|
||||
#if OPENJPEG_MAJOR_VERSION == 1
|
||||
opj_image_t *image = ctx->image;
|
||||
opj_cinfo_t *compress = NULL;
|
||||
opj_cio_t *stream = NULL;
|
||||
int len;
|
||||
#else // OPENJPEG_MAJOR_VERSION == 2
|
||||
PacketWriter writer = { 0 };
|
||||
opj_codec_t *compress = NULL;
|
||||
opj_stream_t *stream = NULL;
|
||||
PacketWriter writer = { 0 };
|
||||
opj_image_t *image = mj2_create_image(avctx, &ctx->enc_params);
|
||||
if (!image) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto done;
|
||||
}
|
||||
#endif // OPENJPEG_MAJOR_VERSION == 1
|
||||
int cpyresult = 0;
|
||||
int ret;
|
||||
AVFrame *gbrframe;
|
||||
|
||||
switch (avctx->pix_fmt) {
|
||||
case AV_PIX_FMT_RGB24:
|
||||
@@ -628,8 +638,10 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
case AV_PIX_FMT_GBRP14:
|
||||
case AV_PIX_FMT_GBRP16:
|
||||
gbrframe = av_frame_clone(frame);
|
||||
if (!gbrframe)
|
||||
return AVERROR(ENOMEM);
|
||||
if (!gbrframe) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto done;
|
||||
}
|
||||
gbrframe->data[0] = frame->data[2]; // swap to be rgb
|
||||
gbrframe->data[1] = frame->data[0];
|
||||
gbrframe->data[2] = frame->data[1];
|
||||
@@ -686,19 +698,21 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"The frame's pixel format '%s' is not supported\n",
|
||||
av_get_pix_fmt_name(avctx->pix_fmt));
|
||||
return AVERROR(EINVAL);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!cpyresult) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Could not copy the frame data to the internal image buffer\n");
|
||||
return -1;
|
||||
ret = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
#if OPENJPEG_MAJOR_VERSION == 2
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, 1024, 0)) < 0) {
|
||||
return ret;
|
||||
goto done;
|
||||
}
|
||||
#endif // OPENJPEG_MAJOR_VERSION == 2
|
||||
|
||||
@@ -765,7 +779,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
#error Missing call to opj_stream_set_user_data
|
||||
#endif
|
||||
|
||||
if (!opj_start_compress(compress, ctx->image, stream) ||
|
||||
if (!opj_start_compress(compress, image, stream) ||
|
||||
!opj_encode(compress, stream) ||
|
||||
!opj_end_compress(compress, stream)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n");
|
||||
@@ -784,6 +798,7 @@ done:
|
||||
#if OPENJPEG_MAJOR_VERSION == 2
|
||||
opj_stream_destroy(stream);
|
||||
opj_destroy_codec(compress);
|
||||
opj_image_destroy(image);
|
||||
#else
|
||||
opj_cio_close(stream);
|
||||
opj_destroy_compress(compress);
|
||||
@@ -793,10 +808,12 @@ done:
|
||||
|
||||
static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
|
||||
{
|
||||
#if OPENJPEG_MAJOR_VERSION == 1
|
||||
LibOpenJPEGContext *ctx = avctx->priv_data;
|
||||
|
||||
opj_image_destroy(ctx->image);
|
||||
ctx->image = NULL;
|
||||
#endif // OPENJPEG_MAJOR_VERSION == 1
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,13 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
|
||||
int ret, channel_map = 0, gain_db = 0, nb_streams, nb_coupled;
|
||||
uint8_t mapping_arr[8] = { 0, 1 }, *mapping;
|
||||
|
||||
avc->channels = avc->extradata_size >= 10 ? avc->extradata[9] : (avc->channels == 1) ? 1 : 2;
|
||||
if (avc->channels <= 0) {
|
||||
av_log(avc, AV_LOG_WARNING,
|
||||
"Invalid number of channels %d, defaulting to stereo\n", avc->channels);
|
||||
avc->channels = 2;
|
||||
}
|
||||
|
||||
avc->sample_rate = 48000;
|
||||
avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
|
||||
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
|
||||
|
||||
@@ -218,6 +218,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
|
||||
int outer = 1;
|
||||
SchroParseUnitContext parse_ctx;
|
||||
LibSchroFrameContext *framewithpts = NULL;
|
||||
int ret;
|
||||
|
||||
*got_frame = 0;
|
||||
|
||||
@@ -307,11 +308,10 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
|
||||
/* Grab next frame to be returned from the top of the queue. */
|
||||
framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);
|
||||
|
||||
if (framewithpts && framewithpts->frame) {
|
||||
int ret;
|
||||
if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) {
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0)
|
||||
return ret;
|
||||
goto end;
|
||||
|
||||
memcpy(avframe->data[0],
|
||||
framewithpts->frame->components[0].data,
|
||||
@@ -332,15 +332,17 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
|
||||
avframe->linesize[2] = framewithpts->frame->components[2].stride;
|
||||
|
||||
*got_frame = 1;
|
||||
|
||||
/* Now free the frame resources. */
|
||||
libschroedinger_decode_frame_free(framewithpts->frame);
|
||||
av_free(framewithpts);
|
||||
} else {
|
||||
data = NULL;
|
||||
*got_frame = 0;
|
||||
}
|
||||
return buf_size;
|
||||
ret = buf_size;
|
||||
end:
|
||||
/* Now free the frame resources. */
|
||||
if (framewithpts && framewithpts->frame)
|
||||
libschroedinger_decode_frame_free(framewithpts->frame);
|
||||
av_freep(&framewithpts);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -777,8 +777,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
if(x4->x264opts){
|
||||
const char *p= x4->x264opts;
|
||||
while(p){
|
||||
char param[256]={0}, val[256]={0};
|
||||
if(sscanf(p, "%255[^:=]=%255[^:]", param, val) == 1){
|
||||
char param[4096]={0}, val[4096]={0};
|
||||
if(sscanf(p, "%4095[^:=]=%4095[^:]", param, val) == 1){
|
||||
OPT_STR(param, "1");
|
||||
}else
|
||||
OPT_STR(param, val);
|
||||
|
||||
@@ -53,6 +53,7 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size)
|
||||
ret = av_reallocp(buf, *size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
p = *buf + len;
|
||||
}
|
||||
|
||||
bytestream2_get_buffer(gb, p, s);
|
||||
@@ -75,6 +76,7 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size)
|
||||
ret = av_reallocp(buf, *size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
p = *buf + len;
|
||||
}
|
||||
|
||||
av_memcpy_backptr(p, off, l);
|
||||
|
||||
@@ -65,6 +65,58 @@ static av_cold int mediacodec_decode_close(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int h264_ps_to_nalu(const uint8_t *src, int src_size, uint8_t **out, int *out_size)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
uint8_t *p = NULL;
|
||||
static const uint8_t nalu_header[] = { 0x00, 0x00, 0x00, 0x01 };
|
||||
|
||||
if (!out || !out_size) {
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
p = av_malloc(sizeof(nalu_header) + src_size);
|
||||
if (!p) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
*out = p;
|
||||
*out_size = sizeof(nalu_header) + src_size;
|
||||
|
||||
memcpy(p, nalu_header, sizeof(nalu_header));
|
||||
memcpy(p + sizeof(nalu_header), src, src_size);
|
||||
|
||||
/* Escape 0x00, 0x00, 0x0{0-3} pattern */
|
||||
for (i = 4; i < *out_size; i++) {
|
||||
if (i < *out_size - 3 &&
|
||||
p[i + 0] == 0 &&
|
||||
p[i + 1] == 0 &&
|
||||
p[i + 2] <= 3) {
|
||||
uint8_t *new;
|
||||
|
||||
*out_size += 1;
|
||||
new = av_realloc(*out, *out_size);
|
||||
if (!new) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto done;
|
||||
}
|
||||
*out = p = new;
|
||||
|
||||
i = i + 2;
|
||||
memmove(p + i + 1, p + i, *out_size - (i + 1));
|
||||
p[i] = 0x03;
|
||||
}
|
||||
}
|
||||
done:
|
||||
if (ret < 0) {
|
||||
av_freep(out);
|
||||
*out_size = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
int i;
|
||||
@@ -112,8 +164,20 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
if (pps && sps) {
|
||||
ff_AMediaFormat_setBuffer(format, "csd-0", (void*)sps->data, sps->data_size);
|
||||
ff_AMediaFormat_setBuffer(format, "csd-1", (void*)pps->data, pps->data_size);
|
||||
uint8_t *data = NULL;
|
||||
size_t data_size = 0;
|
||||
|
||||
if ((ret = h264_ps_to_nalu(sps->data, sps->data_size, &data, &data_size)) < 0) {
|
||||
goto done;
|
||||
}
|
||||
ff_AMediaFormat_setBuffer(format, "csd-0", (void*)data, data_size);
|
||||
av_freep(&data);
|
||||
|
||||
if ((ret = h264_ps_to_nalu(pps->data, pps->data_size, &data, &data_size)) < 0) {
|
||||
goto done;
|
||||
}
|
||||
ff_AMediaFormat_setBuffer(format, "csd-1", (void*)data, data_size);
|
||||
av_freep(&data);
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR, "Could not extract PPS/SPS from extradata");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -1082,6 +1082,10 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
if (get_bits_left(&s->gb) < 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bitstream end in yuv_scan\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->restart_interval && !s->restart_count){
|
||||
s->restart_count = s->restart_interval;
|
||||
resync_mb_x = mb_x;
|
||||
@@ -1393,6 +1397,10 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
int block_idx = mb_y * s->block_stride[c];
|
||||
int16_t (*block)[64] = &s->blocks[c][block_idx];
|
||||
uint8_t *last_nnz = &s->last_nnz[c][block_idx];
|
||||
if (get_bits_left(&s->gb) <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bitstream truncated in mjpeg_decode_scan_progressive_ac\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) {
|
||||
int ret;
|
||||
if (s->restart_interval && !s->restart_count)
|
||||
@@ -2119,6 +2127,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
ret = mjpeg_decode_com(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (start_code == DQT) {
|
||||
ff_mjpeg_decode_dqt(s);
|
||||
}
|
||||
|
||||
ret = -1;
|
||||
@@ -2151,9 +2161,6 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->restart_count = 0;
|
||||
/* nothing to do on SOI */
|
||||
break;
|
||||
case DQT:
|
||||
ff_mjpeg_decode_dqt(s);
|
||||
break;
|
||||
case DHT:
|
||||
if ((ret = ff_mjpeg_decode_dht(s)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
|
||||
@@ -2384,7 +2391,7 @@ the_end:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s->flipped) {
|
||||
if (s->flipped && !s->rgb) {
|
||||
int j;
|
||||
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
|
||||
av_assert0(s->nb_components == av_pix_fmt_count_planes(s->picture_ptr->format));
|
||||
|
||||
@@ -116,6 +116,8 @@ static void mov_text_cleanup(MovTextContext *m)
|
||||
av_freep(&m->s[i]);
|
||||
}
|
||||
av_freep(&m->s);
|
||||
m->count_s = 0;
|
||||
m->style_entries = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,12 +281,14 @@ static int decode_hclr(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
|
||||
static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
|
||||
{
|
||||
int i;
|
||||
m->style_entries = AV_RB16(tsmb);
|
||||
int style_entries = AV_RB16(tsmb);
|
||||
tsmb += 2;
|
||||
// A single style record is of length 12 bytes.
|
||||
if (m->tracksize + m->size_var + 2 + m->style_entries * 12 > avpkt->size)
|
||||
if (m->tracksize + m->size_var + 2 + style_entries * 12 > avpkt->size)
|
||||
return -1;
|
||||
|
||||
m->style_entries = style_entries;
|
||||
|
||||
m->box_flags |= STYL_BOX;
|
||||
for(i = 0; i < m->style_entries; i++) {
|
||||
m->s_temp = av_malloc(sizeof(*m->s_temp));
|
||||
@@ -481,7 +485,12 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
|
||||
m->size_var = 8;
|
||||
//size_var is equal to 8 or 16 depending on the size of box
|
||||
|
||||
if (m->tracksize + tsmb_size > avpkt->size)
|
||||
if (tsmb_size == 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "tsmb_size is 0\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (tsmb_size > avpkt->size - m->tracksize)
|
||||
break;
|
||||
|
||||
for (size_t i = 0; i < box_count; i++) {
|
||||
|
||||
@@ -2389,7 +2389,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
s->closed_gop = get_bits1(&s->gb);
|
||||
/* broken_link indicate that after editing the
|
||||
/* broken_link indicates that after editing the
|
||||
* reference frames of the first B-Frames after GOP I-Frame
|
||||
* are missing (open gop) */
|
||||
broken_link = get_bits1(&s->gb);
|
||||
@@ -2784,6 +2784,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data,
|
||||
avctx->extradata, avctx->extradata_size);
|
||||
if (*got_output) {
|
||||
av_log(avctx, AV_LOG_ERROR, "picture in extradata\n");
|
||||
av_frame_unref(picture);
|
||||
*got_output = 0;
|
||||
}
|
||||
s->extradata_decoded = 1;
|
||||
|
||||
@@ -315,13 +315,13 @@ 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] << (alpha + beta + rho - 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] << (alpha + beta + rho - min_ab)) +
|
||||
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]) *
|
||||
@@ -368,10 +368,10 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
int shift_y = 16 - ctx->sprite_shift[0];
|
||||
int shift_c = 16 - ctx->sprite_shift[1];
|
||||
for (i = 0; i < 2; i++) {
|
||||
s->sprite_offset[0][i] <<= shift_y;
|
||||
s->sprite_offset[1][i] <<= shift_c;
|
||||
s->sprite_delta[0][i] <<= shift_y;
|
||||
s->sprite_delta[1][i] <<= shift_y;
|
||||
s->sprite_offset[0][i] *= 1 << shift_y;
|
||||
s->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;
|
||||
}
|
||||
s->real_sprite_warping_points = ctx->num_sprite_warping_points;
|
||||
|
||||
@@ -98,7 +98,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
|
||||
} else if (codec_id == AV_CODEC_ID_MP3ADU) {
|
||||
avpriv_report_missing_feature(avctx,
|
||||
"MP3ADU full parser");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
return 0; /* parsers must not return error codes */
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -2911,6 +2911,8 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t s
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
emms_c();
|
||||
|
||||
av_fast_padded_malloc(&new_buffer, &new_buffer_size,
|
||||
s->avctx->internal->byte_buffer_size + size_increase);
|
||||
if (!new_buffer)
|
||||
|
||||
@@ -99,11 +99,14 @@ static int msrle_decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
|
||||
if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
int size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
|
||||
|
||||
if (pal) {
|
||||
if (pal && size == AVPALETTE_SIZE) {
|
||||
s->frame->palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||
}
|
||||
/* make the palette available */
|
||||
memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
|
||||
|
||||
@@ -422,7 +422,13 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
|
||||
|
||||
ff_vc1_decode_blocks(v);
|
||||
|
||||
ff_er_frame_end(&s->er);
|
||||
if (v->end_mb_x == s->mb_width && s->end_mb_y == s->mb_height) {
|
||||
ff_er_frame_end(&s->er);
|
||||
} else {
|
||||
av_log(v->s.avctx, AV_LOG_WARNING,
|
||||
"disabling error correction due to block count mismatch %dx%d != %dx%d\n",
|
||||
v->end_mb_x, s->end_mb_y, s->mb_width, s->mb_height);
|
||||
}
|
||||
|
||||
ff_mpv_frame_end(s);
|
||||
|
||||
|
||||
@@ -305,11 +305,14 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
|
||||
if (s->mode_8bit) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
int size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
|
||||
|
||||
if (pal) {
|
||||
if (pal && size == AVPALETTE_SIZE) {
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
s->frame->palette_has_changed = 1;
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ static const AVOption options[] = {
|
||||
{ "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, INT_MAX, VE },
|
||||
{ "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "2pass", "Use 2pass encoding mode", OFFSET(twopass), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
|
||||
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(device), AV_OPT_TYPE_INT, { .i64 = ANY_DEVICE }, -2, INT_MAX, VE },
|
||||
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(device), AV_OPT_TYPE_INT, { .i64 = ANY_DEVICE }, -2, INT_MAX, VE, "device" },
|
||||
{ "any", "Pick the first device available", 0, AV_OPT_TYPE_CONST, { .i64 = ANY_DEVICE }, 0, 0, VE, "device" },
|
||||
{ "list", "List the available devices", 0, AV_OPT_TYPE_CONST, { .i64 = LIST_DEVICES }, 0, 0, VE, "device" },
|
||||
{ "delay", "Delay frame output by the given amount of frames", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 0, INT_MAX, VE },
|
||||
|
||||
@@ -761,7 +761,10 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
} else {
|
||||
// If not, we need to allocate a new buffer with the right
|
||||
// size and copy the input frame into it.
|
||||
uint8_t *buf = av_malloc(av_image_get_buffer_size(avctx->pix_fmt, s->stride, s->plane_size, 1));
|
||||
uint8_t *buf = NULL;
|
||||
int image_buffer_size = av_image_get_buffer_size(avctx->pix_fmt, s->stride, s->plane_size, 1);
|
||||
if (image_buffer_size >= 0)
|
||||
buf = av_malloc(image_buffer_size);
|
||||
if (!buf) {
|
||||
// Return the buffer to the queue so it's not lost
|
||||
append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer);
|
||||
|
||||
@@ -300,8 +300,11 @@ static int parse_object_segment(AVCodecContext *avctx,
|
||||
|
||||
av_fast_padded_malloc(&object->rle, &object->rle_buffer_size, rle_bitmap_len);
|
||||
|
||||
if (!object->rle)
|
||||
if (!object->rle) {
|
||||
object->rle_data_len = 0;
|
||||
object->rle_remaining_len = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
memcpy(object->rle, buf, buf_size);
|
||||
object->rle_data_len = buf_size;
|
||||
@@ -556,12 +559,13 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
|
||||
|
||||
sub->rects[i]->x = ctx->presentation.objects[i].x;
|
||||
sub->rects[i]->y = ctx->presentation.objects[i].y;
|
||||
sub->rects[i]->w = object->w;
|
||||
sub->rects[i]->h = object->h;
|
||||
|
||||
sub->rects[i]->linesize[0] = object->w;
|
||||
|
||||
if (object->rle) {
|
||||
sub->rects[i]->w = object->w;
|
||||
sub->rects[i]->h = object->h;
|
||||
|
||||
sub->rects[i]->linesize[0] = object->w;
|
||||
|
||||
if (object->rle_remaining_len) {
|
||||
av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n",
|
||||
object->rle_data_len, object->rle_remaining_len);
|
||||
|
||||
@@ -142,7 +142,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
|
||||
return -1;
|
||||
if (s->width != avctx->width && s->height != avctx->height) {
|
||||
if (s->width != avctx->width || s->height != avctx->height) {
|
||||
ret = ff_set_dimensions(avctx, s->width, s->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -437,13 +437,13 @@ static int decode_zbuf(AVBPrint *bp, const uint8_t *data,
|
||||
av_bprint_init(bp, 0, -1);
|
||||
|
||||
while (zstream.avail_in > 0) {
|
||||
av_bprint_get_buffer(bp, 1, &buf, &buf_size);
|
||||
if (!buf_size) {
|
||||
av_bprint_get_buffer(bp, 2, &buf, &buf_size);
|
||||
if (buf_size < 2) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
zstream.next_out = buf;
|
||||
zstream.avail_out = buf_size;
|
||||
zstream.avail_out = buf_size - 1;
|
||||
ret = inflate(&zstream, Z_PARTIAL_FLUSH);
|
||||
if (ret != Z_OK && ret != Z_STREAM_END) {
|
||||
ret = AVERROR_EXTERNAL;
|
||||
@@ -772,6 +772,16 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
{
|
||||
int v, i;
|
||||
|
||||
if (!(s->state & PNG_IHDR)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "trns before IHDR\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->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))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -782,7 +792,8 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
}
|
||||
} else if (s->color_type == PNG_COLOR_TYPE_GRAY || s->color_type == PNG_COLOR_TYPE_RGB) {
|
||||
if ((s->color_type == PNG_COLOR_TYPE_GRAY && length != 2) ||
|
||||
(s->color_type == PNG_COLOR_TYPE_RGB && length != 6))
|
||||
(s->color_type == PNG_COLOR_TYPE_RGB && length != 6) ||
|
||||
s->bit_depth == 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (i = 0; i < length / 2; i++) {
|
||||
@@ -1241,6 +1252,8 @@ exit_loop:
|
||||
size_t raw_bpp = s->bpp - byte_depth;
|
||||
unsigned x, y;
|
||||
|
||||
av_assert0(s->bit_depth > 1);
|
||||
|
||||
for (y = 0; y < s->height; ++y) {
|
||||
uint8_t *row = &s->image_buf[s->image_linesize * y];
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ retry:
|
||||
}
|
||||
#endif
|
||||
next = END_NOT_FOUND;
|
||||
} else if (pnmctx.type < 4) {
|
||||
next = END_NOT_FOUND;
|
||||
} else {
|
||||
next = pnmctx.bytestream - pnmctx.bytestream_start
|
||||
+ av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);
|
||||
|
||||
@@ -43,7 +43,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int buf_size = avpkt->size;
|
||||
PNMContext * const s = avctx->priv_data;
|
||||
AVFrame * const p = data;
|
||||
int i, j, n, linesize, h, upgrade = 0, is_mono = 0;
|
||||
int i, j, k, n, linesize, h, upgrade = 0, is_mono = 0;
|
||||
unsigned char *ptr;
|
||||
int components, sample_len, ret;
|
||||
|
||||
@@ -143,10 +143,14 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
v = (*s->bytestream++)&1;
|
||||
} else {
|
||||
/* read a sequence of digits */
|
||||
do {
|
||||
for (k = 0; k < 5 && c <= 9; k += 1) {
|
||||
v = 10*v + c;
|
||||
c = (*s->bytestream++) - '0';
|
||||
} while (c <= 9);
|
||||
}
|
||||
if (v > s->maxval) {
|
||||
av_log(avctx, AV_LOG_ERROR, "value %d larger than maxval %d\n", v, s->maxval);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (sample_len == 16) {
|
||||
((uint16_t*)ptr)[j] = (((1<<sample_len)-1)*v + (s->maxval>>1))/s->maxval;
|
||||
|
||||
@@ -67,10 +67,10 @@ static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels,
|
||||
ptrdiff_t line_size)
|
||||
{
|
||||
int i;
|
||||
vec_u8 perm = vec_lvsl(0, pixels);
|
||||
const vec_u8 zero = (const vec_u8)vec_splat_u8(0);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
vec_u8 perm = vec_lvsl(0, pixels);
|
||||
/* Read potentially unaligned pixels.
|
||||
* We're reading 16 pixels, and actually only want 8,
|
||||
* but we simply ignore the extras. */
|
||||
@@ -157,8 +157,7 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
|
||||
const uint8_t *s2, int stride)
|
||||
{
|
||||
int i;
|
||||
vec_u8 perm1 = vec_lvsl(0, s1);
|
||||
vec_u8 perm2 = vec_lvsl(0, s2);
|
||||
vec_u8 perm;
|
||||
const vec_u8 zero = (const vec_u8)vec_splat_u8(0);
|
||||
vec_s16 shorts1, shorts2;
|
||||
|
||||
@@ -166,17 +165,19 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
|
||||
/* Read potentially unaligned pixels.
|
||||
* We're reading 16 pixels, and actually only want 8,
|
||||
* but we simply ignore the extras. */
|
||||
perm = vec_lvsl(0, s1);
|
||||
vec_u8 pixl = vec_ld(0, s1);
|
||||
vec_u8 pixr = vec_ld(15, s1);
|
||||
vec_u8 bytes = vec_perm(pixl, pixr, perm1);
|
||||
vec_u8 bytes = vec_perm(pixl, pixr, perm);
|
||||
|
||||
// Convert the bytes into shorts.
|
||||
shorts1 = (vec_s16)vec_mergeh(zero, bytes);
|
||||
|
||||
// Do the same for the second block of pixels.
|
||||
perm = vec_lvsl(0, s2);
|
||||
pixl = vec_ld(0, s2);
|
||||
pixr = vec_ld(15, s2);
|
||||
bytes = vec_perm(pixl, pixr, perm2);
|
||||
bytes = vec_perm(pixl, pixr, perm);
|
||||
|
||||
// Convert the bytes into shorts.
|
||||
shorts2 = (vec_s16)vec_mergeh(zero, bytes);
|
||||
@@ -197,17 +198,19 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1,
|
||||
/* Read potentially unaligned pixels.
|
||||
* We're reading 16 pixels, and actually only want 8,
|
||||
* but we simply ignore the extras. */
|
||||
perm = vec_lvsl(0, s1);
|
||||
pixl = vec_ld(0, s1);
|
||||
pixr = vec_ld(15, s1);
|
||||
bytes = vec_perm(pixl, pixr, perm1);
|
||||
bytes = vec_perm(pixl, pixr, perm);
|
||||
|
||||
// Convert the bytes into shorts.
|
||||
shorts1 = (vec_s16)vec_mergeh(zero, bytes);
|
||||
|
||||
// Do the same for the second block of pixels.
|
||||
perm = vec_lvsl(0, s2);
|
||||
pixl = vec_ld(0, s2);
|
||||
pixr = vec_ld(15, s2);
|
||||
bytes = vec_perm(pixl, pixr, perm2);
|
||||
bytes = vec_perm(pixl, pixr, perm);
|
||||
|
||||
// Convert the bytes into shorts.
|
||||
shorts2 = (vec_s16)vec_mergeh(zero, bytes);
|
||||
|
||||
@@ -625,7 +625,7 @@ static int decode_slice(AVCodecContext *avctx, void *tdata)
|
||||
|
||||
/* if V or alpha component size is negative that means that previous
|
||||
component sizes are too large */
|
||||
if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6) {
|
||||
if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6 || coff[3] > slice_data_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid data size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -260,7 +260,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
AVFrame * const ref = a->ref;
|
||||
uint8_t* outdata;
|
||||
int delta, ret;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
int pal_size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
|
||||
|
||||
if (avpkt->size < 0x86) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
|
||||
@@ -287,9 +288,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
/* make the palette available on the way out */
|
||||
if (pal) {
|
||||
if (pal && pal_size == AVPALETTE_SIZE) {
|
||||
p->palette_has_changed = 1;
|
||||
memcpy(a->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
|
||||
}
|
||||
memcpy(p->data[1], a->pal, AVPALETTE_SIZE);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
/* parse the SPS */
|
||||
ret = ff_h2645_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal);
|
||||
ret = ff_h2645_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal, 1);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error unescaping the SPS buffer\n");
|
||||
return ret;
|
||||
|
||||
@@ -506,11 +506,14 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
if(has_palette) {
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
|
||||
int size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
|
||||
|
||||
if (pal) {
|
||||
if (pal && size == AVPALETTE_SIZE) {
|
||||
s->frame->palette_has_changed = 1;
|
||||
memcpy(s->pal, pal, AVPALETTE_SIZE);
|
||||
} else if (pal) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||
}
|
||||
|
||||
/* make the palette available on the way out */
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
const PixelFormatTag ff_raw_pix_fmt_tags[] = {
|
||||
{ AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
|
||||
{ AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
|
||||
{ AV_PIX_FMT_YUV420P, MKTAG('y', 'v', '1', '2') },
|
||||
{ AV_PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') },
|
||||
{ AV_PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
|
||||
{ AV_PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') },
|
||||
|
||||
@@ -204,8 +204,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
|
||||
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
|
||||
if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4
|
||||
|| avctx->bits_per_coded_sample <= 2) &&
|
||||
if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4 ||
|
||||
avctx->bits_per_coded_sample == 2 || avctx->bits_per_coded_sample == 1 ||
|
||||
(avctx->bits_per_coded_sample == 0 && (context->is_nut_pal8 || context->is_mono)) ) &&
|
||||
(context->is_mono || context->is_pal8) &&
|
||||
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ') ||
|
||||
context->is_nut_mono || context->is_nut_pal8)) {
|
||||
@@ -363,22 +364,38 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
}
|
||||
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
||||
int pal_size;
|
||||
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE,
|
||||
NULL);
|
||||
if (pal) {
|
||||
av_buffer_unref(&context->palette);
|
||||
&pal_size);
|
||||
int ret;
|
||||
|
||||
if (pal && pal_size != AVPALETTE_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
|
||||
pal = NULL;
|
||||
}
|
||||
|
||||
if (!context->palette)
|
||||
context->palette = av_buffer_alloc(AVPALETTE_SIZE);
|
||||
if (!context->palette) {
|
||||
av_buffer_unref(&frame->buf[0]);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
if (!context->palette) {
|
||||
av_buffer_unref(&frame->buf[0]);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
ret = av_buffer_make_writable(&context->palette);
|
||||
if (ret < 0) {
|
||||
av_buffer_unref(&frame->buf[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (pal) {
|
||||
memcpy(context->palette->data, pal, AVPALETTE_SIZE);
|
||||
frame->palette_has_changed = 1;
|
||||
} else if (context->is_nut_pal8) {
|
||||
int vid_size = avctx->width * avctx->height;
|
||||
if (avpkt->size - vid_size) {
|
||||
int pal_size = avpkt->size - vid_size;
|
||||
|
||||
if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) {
|
||||
pal = avpkt->data + vid_size;
|
||||
memcpy(context->palette->data, pal, avpkt->size - vid_size);
|
||||
memcpy(context->palette->data, pal, pal_size);
|
||||
frame->palette_has_changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,8 @@ static int get_dimension(GetBitContext *gb, const int *dim)
|
||||
val = dim[get_bits1(gb) - val];
|
||||
if(!val){
|
||||
do{
|
||||
if (get_bits_left(gb) < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
t = get_bits(gb, 8);
|
||||
val += t << 2;
|
||||
}while(t == 0xFF);
|
||||
|
||||
@@ -129,8 +129,12 @@ static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t pref
|
||||
/**
|
||||
* Decode header tree
|
||||
*/
|
||||
static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx)
|
||||
static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx, int length)
|
||||
{
|
||||
if(length > 500) { // Larger length can cause segmentation faults due to too deep recursion.
|
||||
av_log(NULL, AV_LOG_ERROR, "length too long\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (hc->current + 1 >= hc->length) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -159,12 +163,12 @@ static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx
|
||||
int r = 0, r_new, t;
|
||||
|
||||
t = hc->current++;
|
||||
r = smacker_decode_bigtree(gb, hc, ctx);
|
||||
r = smacker_decode_bigtree(gb, hc, ctx, length + 1);
|
||||
if(r < 0)
|
||||
return r;
|
||||
hc->values[t] = SMK_NODE | r;
|
||||
r++;
|
||||
r_new = smacker_decode_bigtree(gb, hc, ctx);
|
||||
r_new = smacker_decode_bigtree(gb, hc, ctx, length + 1);
|
||||
if (r_new < 0)
|
||||
return r_new;
|
||||
return r + r_new;
|
||||
@@ -275,7 +279,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (smacker_decode_bigtree(gb, &huff, &ctx) < 0)
|
||||
if (smacker_decode_bigtree(gb, &huff, &ctx, 0) < 0)
|
||||
err = -1;
|
||||
skip_bits1(gb);
|
||||
if(ctx.last[0] == -1) ctx.last[0] = huff.current++;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user