Compare commits
311 commits
master
...
release/6.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d388c347d4 | ||
|
|
bd1c255af8 | ||
|
|
b67a6631a2 | ||
|
|
2a341fc5b2 | ||
|
|
5911b7e9f5 | ||
|
|
b98349b205 | ||
|
|
769c36b013 | ||
|
|
35f906521e | ||
|
|
c22db2bcf2 | ||
|
|
6387156008 | ||
|
|
d9d47bc981 | ||
|
|
8c6186efbe | ||
|
|
d859805efe | ||
|
|
bf0e6c6cb5 | ||
|
|
3096967c93 | ||
|
|
3610a803e7 | ||
|
|
c185e11321 | ||
|
|
0819bdc621 | ||
|
|
90a59f9e48 | ||
|
|
9dbeb1d5d0 | ||
|
|
ce29811117 | ||
|
|
4873178ee3 | ||
|
|
13ebc73259 | ||
|
|
af1bc3a91f | ||
|
|
27bcc1e967 | ||
|
|
fe5946684a | ||
|
|
5987250c42 | ||
|
|
06c213c8c4 | ||
|
|
df95c2630d | ||
|
|
853e15fb85 | ||
|
|
d0c5329c1b | ||
|
|
2c06fbfd0d | ||
|
|
f5f350919e | ||
|
|
9ffa59eba5 | ||
|
|
04cff32872 | ||
|
|
d9882369d8 | ||
|
|
d9b0effe77 | ||
|
|
308c337182 | ||
|
|
05d253b420 | ||
|
|
2c1117e6e2 | ||
|
|
ae59aff594 | ||
|
|
bf67615a1f | ||
|
|
40775100a0 | ||
|
|
d1eca0d05a | ||
|
|
f70db01b83 | ||
|
|
b9a3065c66 | ||
|
|
a004db8f4e | ||
|
|
055265fed1 | ||
|
|
c746bc5269 | ||
|
|
0100d1ae97 | ||
|
|
bf36c2211d | ||
|
|
73efebad01 | ||
|
|
22b7b67931 | ||
|
|
e534814967 | ||
|
|
a5103808f4 | ||
|
|
0c9b524163 | ||
|
|
0bd8112921 | ||
|
|
e0339c57e6 | ||
|
|
1ae20f1779 | ||
|
|
eea625e217 | ||
|
|
a7d8b3c7e4 | ||
|
|
d9dc74fa1a | ||
|
|
a18520cce8 | ||
|
|
8e72472dcc | ||
|
|
5a1b84bbd9 | ||
|
|
a7a73839ee | ||
|
|
43a9665f4a | ||
|
|
4565b4a507 | ||
|
|
e9479065e1 | ||
|
|
dce4cf6871 | ||
|
|
a83c489c02 | ||
|
|
cd306f0019 | ||
|
|
7a42e9d892 | ||
|
|
96cc1dd4d3 | ||
|
|
a487a57d72 | ||
|
|
552a58fb68 | ||
|
|
4df8f9fa2b | ||
|
|
302af6f9a7 | ||
|
|
ccf8c9bff7 | ||
|
|
9258cc72cb | ||
|
|
8cc8f54121 | ||
|
|
c0fc7466f1 | ||
|
|
978f270ef9 | ||
|
|
244bf4fa35 | ||
|
|
3e0bc91f68 | ||
|
|
bda83cba9d | ||
|
|
13bbc0cd5b | ||
|
|
b751dfc151 | ||
|
|
21b22341ef | ||
|
|
90571795e2 | ||
|
|
f9821fd907 | ||
|
|
aae59be400 | ||
|
|
fc8775ae96 | ||
|
|
1ad767bf27 | ||
|
|
ea2dcb9b39 | ||
|
|
a39e922fb7 | ||
|
|
59918c65ad | ||
|
|
87f8335bdf | ||
|
|
c18115b413 | ||
|
|
b6925ebc08 | ||
|
|
eac9841a9f | ||
|
|
47fa87996d | ||
|
|
48e30b8fab | ||
|
|
cd49ee45ba | ||
|
|
511b844423 | ||
|
|
b991129f83 | ||
|
|
ae7cd2fc02 | ||
|
|
178575bdc1 | ||
|
|
133069b434 | ||
|
|
c41ff724ed | ||
|
|
1f61aad00d | ||
|
|
dcaadb2a10 | ||
|
|
34ef4e9d46 | ||
|
|
302aa941eb | ||
|
|
2baff271a2 | ||
|
|
028ae6f26c | ||
|
|
d77be99a83 | ||
|
|
14b1998c1a | ||
|
|
7e7c3d5db2 | ||
|
|
66caaeec13 | ||
|
|
e825157874 | ||
|
|
f2a4a49afb | ||
|
|
7058f9a3d6 | ||
|
|
330b8305c1 | ||
|
|
07e3223dd0 | ||
|
|
2269a892fb | ||
|
|
e770922e30 | ||
|
|
d2577e1622 | ||
|
|
7b2b48078c | ||
|
|
b902f5113e | ||
|
|
1079565e8e | ||
|
|
6d25672afa | ||
|
|
85b9a8f296 | ||
|
|
55769812f7 | ||
|
|
8af32643c0 | ||
|
|
2d87c74e60 | ||
|
|
ba90a8dff2 | ||
|
|
df8936ef12 | ||
|
|
6ddb165b4b | ||
|
|
f4270205a4 | ||
|
|
034a3e6f9c | ||
|
|
d67bb81161 | ||
|
|
de458e5d3f | ||
|
|
be3ca673f4 | ||
|
|
5d6524445c | ||
|
|
f630725cb0 | ||
|
|
303afea1a8 | ||
|
|
8a0e48001f | ||
|
|
3b822405cd | ||
|
|
0ae86db6ba | ||
|
|
47333e3e30 | ||
|
|
f16d72dfeb | ||
|
|
5fd5e84474 | ||
|
|
8aae506dd2 | ||
|
|
f23f0ba87c | ||
|
|
8c5b391c63 | ||
|
|
342121cd35 | ||
|
|
c8319b4e00 | ||
|
|
33c009130c | ||
|
|
afb5d20e23 | ||
|
|
53bcb6eaf5 | ||
|
|
3a177811f4 | ||
|
|
ea918615a1 | ||
|
|
4917892af7 | ||
|
|
882052e293 | ||
|
|
eb32d51302 | ||
|
|
d30d9c817a | ||
|
|
38bc713c6d | ||
|
|
ebc4d0a310 | ||
|
|
47bd650d68 | ||
|
|
58c8e61703 | ||
|
|
e1a05fdb58 | ||
|
|
24be4134fd | ||
|
|
45d113af3a | ||
|
|
2631c7c7ce | ||
|
|
3fa5039012 | ||
|
|
b7a55ae0a8 | ||
|
|
e4dbe25f3b | ||
|
|
e0cd8ac126 | ||
|
|
60e46128f7 | ||
|
|
d57b29ff2b | ||
|
|
ab1981b445 | ||
|
|
1e26c4923a | ||
|
|
b07211eb9e | ||
|
|
ba5e12b2ed | ||
|
|
13438a6900 | ||
|
|
cea882ef99 | ||
|
|
8bce6ca582 | ||
|
|
15e1093f9a | ||
|
|
1bee64983e | ||
|
|
161b2b6ed6 | ||
|
|
68604c9dee | ||
|
|
992fc9d75a | ||
|
|
5531eacf9e | ||
|
|
410d733a8b | ||
|
|
09e888a5b4 | ||
|
|
aef59048e6 | ||
|
|
4c906c5867 | ||
|
|
52dd7a9f7a | ||
|
|
85cb7abb4c | ||
|
|
819e9068af | ||
|
|
a66733a8c9 | ||
|
|
79af71223d | ||
|
|
63270289a0 | ||
|
|
c598778d37 | ||
|
|
33ee9ab941 | ||
|
|
339463bd90 | ||
|
|
426117bb7e | ||
|
|
011511791a | ||
|
|
79edf58ba8 | ||
|
|
86682ab20f | ||
|
|
24b6f44f96 | ||
|
|
838cab9a07 | ||
|
|
40e81d5a8b | ||
|
|
4e3f8fd46a | ||
|
|
0ec70368b0 | ||
|
|
fbc224b126 | ||
|
|
fc7f2fdacf | ||
|
|
89950105b9 | ||
|
|
9000efe97f | ||
|
|
344f333c6c | ||
|
|
8c8a08e1bf | ||
|
|
63aa0cfd0e | ||
|
|
1d7dd08199 | ||
|
|
6500c15977 | ||
|
|
81ab846988 | ||
|
|
19db9ffb3b | ||
|
|
735f6be311 | ||
|
|
a06bf3dae8 | ||
|
|
953e26755b | ||
|
|
0291b86a94 | ||
|
|
d84e889785 | ||
|
|
a85d0bc84b | ||
|
|
67919ba682 | ||
|
|
1ed34709ff | ||
|
|
4cec33869e | ||
|
|
9a086ad5b1 | ||
|
|
407e6cde75 | ||
|
|
fa35ce082a | ||
|
|
efab690c16 | ||
|
|
14da53d4c6 | ||
|
|
b89cda3269 | ||
|
|
deeb0b6e94 | ||
|
|
89c0a651ad | ||
|
|
ea6ec6b507 | ||
|
|
c2a484cf5b | ||
|
|
1957bd1110 | ||
|
|
438ea0eaf3 | ||
|
|
f081f94601 | ||
|
|
318c295925 | ||
|
|
c5039e158d | ||
|
|
067ed535f4 | ||
|
|
3d5edb89e7 | ||
|
|
d2efb80027 | ||
|
|
d4a7a6e7fa | ||
|
|
1ebb0e43f9 | ||
|
|
9212b53ed5 | ||
|
|
cc703cf607 | ||
|
|
cedbf27a35 | ||
|
|
c433ad89a0 | ||
|
|
3f345ebf21 | ||
|
|
868af7d7a4 | ||
|
|
d341895a08 | ||
|
|
cb3453eb25 | ||
|
|
549430e14d | ||
|
|
bfa8a4a44b | ||
|
|
d7c0991cfc | ||
|
|
8ea302832f | ||
|
|
27205c0b47 | ||
|
|
8f61cbf1b9 | ||
|
|
2c11164707 | ||
|
|
5606d27006 | ||
|
|
4808ed94e3 | ||
|
|
bf704a0b30 | ||
|
|
a6dc92968a | ||
|
|
3980415627 | ||
|
|
a0d6566498 | ||
|
|
a3c93c03ad | ||
|
|
18dde8d4cf | ||
|
|
adb4688bfb | ||
|
|
916bdc0f19 | ||
|
|
58f18df430 | ||
|
|
1cf17633cd | ||
|
|
0e11aafb08 | ||
|
|
46970dd155 | ||
|
|
0981053c29 | ||
|
|
ea3d24bbe3 | ||
|
|
ff5cce2eaf | ||
|
|
1eb1acb62b | ||
|
|
718d6c71ef | ||
|
|
8ab01c8b0d | ||
|
|
d1e446d570 | ||
|
|
8e478e0cb1 | ||
|
|
81d9c57c43 | ||
|
|
3ae6feff7e | ||
|
|
197dcd28ef | ||
|
|
bc531eedbd | ||
|
|
e4eed31133 | ||
|
|
c56f84e656 | ||
|
|
bbcf3f4234 | ||
|
|
8a6c037acd | ||
|
|
b59152b474 | ||
|
|
0c1e67ab14 | ||
|
|
ec5edc0946 | ||
|
|
6f1b24c4fe | ||
|
|
691d019899 | ||
|
|
65873ac3ee | ||
|
|
34a1403831 | ||
|
|
a34b348328 | ||
|
|
6112745d8e | ||
|
|
71534916df |
214 changed files with 2005 additions and 933 deletions
4
CREDITS
4
CREDITS
|
|
@ -1,6 +1,6 @@
|
||||||
See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
|
See the Git history of the project (https://git.ffmpeg.org/ffmpeg) to
|
||||||
get the names of people who have contributed to FFmpeg.
|
get the names of people who have contributed to FFmpeg.
|
||||||
|
|
||||||
To check the log, you can type the command "git log" in the FFmpeg
|
To check the log, you can type the command "git log" in the FFmpeg
|
||||||
source directory, or browse the online repository at
|
source directory, or browse the online repository at
|
||||||
http://source.ffmpeg.org.
|
https://git.ffmpeg.org/ffmpeg
|
||||||
|
|
|
||||||
269
Changelog
269
Changelog
|
|
@ -1,6 +1,275 @@
|
||||||
Entries are sorted chronologically from oldest to youngest within each release,
|
Entries are sorted chronologically from oldest to youngest within each release,
|
||||||
releases are sorted from youngest to oldest.
|
releases are sorted from youngest to oldest.
|
||||||
|
|
||||||
|
version 6.0.2:
|
||||||
|
fate/subtitles: Ignore line endings for sub-scc test
|
||||||
|
avformat/mxfdec: Check index_edit_rate
|
||||||
|
swscale/utils: Fix xInc overflow
|
||||||
|
avformat/isom: Uninit layout in ff_mp4_read_dec_config_descr()
|
||||||
|
avcodec/exr: Dont use 64bits to hold 6bits
|
||||||
|
avcodec/exr: Check for remaining bits in huf_unpack_enc_table()
|
||||||
|
avformat/mpegts: Reset local nb_prg on add_program() failure
|
||||||
|
avformat/aiffdec: Check for previously set channels
|
||||||
|
avformat/mxfdec: Make edit_unit_byte_count unsigned
|
||||||
|
avformat/movenc: Check that cts fits in 32bit
|
||||||
|
avformat/mxfdec: Check first case of offset_temp computation for overflow
|
||||||
|
avfilter/vf_signature: Dont crash on no frames
|
||||||
|
avformat/westwood_vqa: Fix 2g packets
|
||||||
|
avformat/matroskadec: Check timescale
|
||||||
|
avformat/wavdec: satuarte next_tag_ofs, data_end
|
||||||
|
avformat/sbgdec: Check for negative duration
|
||||||
|
avformat/rpl: Use 64bit for total_audio_size and check it
|
||||||
|
avformat/timecode: use 64bit for intermediate for rounding in fps_from_frame_rate()
|
||||||
|
avformat/mov: use 64bit for intermediate for rounding
|
||||||
|
avformat/jacosubdec: Use 64bit for abs
|
||||||
|
avformat/concatdec: Check user_duration sum
|
||||||
|
avcodec/wavarc: Avoid signed integer overflow in sample
|
||||||
|
avcodec/truemotion1: Height not being a multiple of 4 is unsupported
|
||||||
|
avcodec/hcadec: do not set hfr_group_count to invalid values
|
||||||
|
avformat/concatdec: clip outpoint - inpoint overflow in get_best_effort_duration()
|
||||||
|
avformat/jacosubdec: clarify code
|
||||||
|
avformat/cafdec: Check that data chunk end fits within 64bit
|
||||||
|
avformat/iff: Saturate avio_tell() + 12
|
||||||
|
avformat/dxa: Adjust order of operations around block align
|
||||||
|
avformat/cafdec: dont seek beyond 64bit
|
||||||
|
avformat/id3v2: read_uslt() check for the amount read
|
||||||
|
avformat/wady: Check >0 samplerate and channels 1 || 2.
|
||||||
|
avcodec/proresenc_kostya: Remove bug similarity text
|
||||||
|
avcodec/vorbisdec: Check remaining data in vorbis_residue_decode_internal()
|
||||||
|
avformat/concatdec: Check in and outpoints to be to produce a positive representable duration
|
||||||
|
avcodec/8bps: Consider width in the minimal size check
|
||||||
|
libswscale/utils: Fix bayer to yuvj
|
||||||
|
swscale/swscale: Check srcSliceH for bayer
|
||||||
|
swscale/utils: Allocate more dithererror
|
||||||
|
avcodec/indeo3: Round dimensions up in allocate_frame_buffers()
|
||||||
|
avutil/rational: Document what is to be expected from av_d2q() of doubles representing rational numbers
|
||||||
|
avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure
|
||||||
|
avfilter/signature_lookup: dont leave uncleared pointers in sll_free()
|
||||||
|
avcodec/mpegvideo_enc: Use ptrdiff_t for stride
|
||||||
|
libavformat/hlsenc.c: Populate OTI using AAC profile in write_codec_attr.
|
||||||
|
avcodec/mpegvideo_enc: Dont copy beyond the image
|
||||||
|
avfilter/vf_minterpolate: Check pts before division
|
||||||
|
avformat/flacdec: Avoid double AVERRORS
|
||||||
|
avfilter/vf_vidstabdetect: Avoid double AVERRORS
|
||||||
|
avfilter/vf_swaprect: round coordinates down
|
||||||
|
avfilter/vf_swaprect: Use height for vertical variables
|
||||||
|
avfilter/vf_swaprect: assert that rectangles are within memory
|
||||||
|
avfilter/af_alimiter: Check nextpos before use
|
||||||
|
avfilter/f_reverse: Apply PTS compensation only when pts is available
|
||||||
|
avfilter/af_stereowiden: Check length
|
||||||
|
avformat/mov: Fix MSAN issue with stsd_id
|
||||||
|
avfilter/vf_weave: Fix odd height handling
|
||||||
|
avfilter/edge_template: Fix small inputs with gaussian_blur()
|
||||||
|
avfilter/vf_gradfun: Do not overread last line
|
||||||
|
avfilter/avf_showspectrum: fix off by 1 error
|
||||||
|
avformat/mov: do not set sign bit for chunk_offsets
|
||||||
|
avcodec/jpeglsdec: Check Jpeg-LS LSE
|
||||||
|
configure: Enable section_data_rel_ro for FreeBSD and NetBSD aarch64 / arm
|
||||||
|
avcodec/av1dec: Fix resolving zero divisor
|
||||||
|
avformat/mov: Ignore duplicate ftyp
|
||||||
|
avformat/mov: Fix integer overflow in mov_read_packet().
|
||||||
|
avformat/mov: Check if a key is longer than the atom containing it
|
||||||
|
avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one
|
||||||
|
avfilter/af_channelmap: disallow channel index 64
|
||||||
|
avfilter/af_channelmap: fix mapping if in_channel was a string but out_channel was not specified
|
||||||
|
avfilter/af_channelmap: fix error message if FL source channel was missing
|
||||||
|
avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
|
||||||
|
avformat/mov: don't abort on duplicate Mastering Display Metadata boxes
|
||||||
|
fftools/ffplay: use correct buffersink channel layout parameters
|
||||||
|
swresample/resample: fix rounding errors with filter_size=1 and phase_shift=0
|
||||||
|
avformat/mxfdec: remove resolve_strong_ref usage with AnyType
|
||||||
|
avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connection
|
||||||
|
avformat/mxfdec: do not use AnyType when resolving Descriptors and MultipleDescriptors
|
||||||
|
avformat/mxfdec: move resolving Descriptors to the multi descriptor resolve function
|
||||||
|
avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available
|
||||||
|
avcodec/av1dec: fix matrix coefficients exposed by codec context
|
||||||
|
avformat/mov_chan: never override number of channels based on chan atom
|
||||||
|
avformat/mov_chan: do not assume channels are in native order
|
||||||
|
avcodec/nvdec: don't free NVDECContext->bitstream
|
||||||
|
lavc/dvdsubenc: only check canvas size when it is actually set
|
||||||
|
|
||||||
|
|
||||||
|
version 6.0.1:
|
||||||
|
avcodec/4xm: Check for cfrm exhaustion
|
||||||
|
avformat/mov: Disallow FTYP after streams
|
||||||
|
doc/html: fix styling issue with Texinfo 7.0
|
||||||
|
doc/html: support texinfo 7.0
|
||||||
|
Changelog: update
|
||||||
|
avformat/lafdec: Check for 0 parameters
|
||||||
|
avformat/lafdec: Check for 0 parameters
|
||||||
|
avfilter/buffersink: fix order of operation with = and <0
|
||||||
|
avfilter/framesync: fix order of operation with = and <0
|
||||||
|
tools/target_dec_fuzzer: Adjust threshold for CSCD
|
||||||
|
avcodec/dovi_rpu: Use 64 bit in get_us/se_coeff()
|
||||||
|
avformat/mov: Check that is_still_picture_avif has no trak based streams
|
||||||
|
avformat/matroskadec: Fix declaration-after-statement warnings
|
||||||
|
Update for FFmpeg 6.0.1
|
||||||
|
fftools/ffmpeg_mux_init: Restrict disabling automatic copying of metadata
|
||||||
|
avformat/rtsp: Use rtsp_st->stream_index
|
||||||
|
avformat/rtsp: Use rtsp_st->stream_index
|
||||||
|
avutil/tx_template: fix integer ovberflwo in fft3()
|
||||||
|
avcodec/jpeg2000dec: Check image offset
|
||||||
|
avformat/mxfdec: Check klv offset
|
||||||
|
libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined
|
||||||
|
avcodec/h2645_parse: Avoid EAGAIN
|
||||||
|
avcodec/xvididct: Make c* unsigned to avoid undefined overflows
|
||||||
|
avcodec/bonk: Fix undefined overflow in predictor_calc_error()
|
||||||
|
avformat/tmv: Check video chunk size
|
||||||
|
avcodec/h264_parser: saturate dts a bit
|
||||||
|
avformat/asfdec_f: Saturate presentation time in marker
|
||||||
|
avformat/xwma: sanity check bits_per_coded_sample
|
||||||
|
avformat/matroskadec: Check prebuffered_ns for overflow
|
||||||
|
avformat/wavdec: Check left avio_tell for overflow
|
||||||
|
avformat/tta: Better totalframes check
|
||||||
|
avformat/rpl: Check for number_of_chunks overflow
|
||||||
|
avformat/mov: compute absolute dts difference without overflow in mov_find_next_sample()
|
||||||
|
avformat/jacosubdec: Check timeres
|
||||||
|
avformat/jacosubdec: avoid signed integer overflows in get_shift()
|
||||||
|
avformat/jacosubdec: Factorize code in get_shift() a bit
|
||||||
|
avformat/sbgdec: Check for negative duration or un-representable end pts
|
||||||
|
avcodec/escape124: Do not return random numbers
|
||||||
|
avcodec/apedec: Fix an integer overflow in predictor_update_filter()
|
||||||
|
tools/target_dec_fuzzer: Adjust wmapro threshold
|
||||||
|
avcodec/wavarc: Allocate AV_INPUT_BUFFER_PADDING_SIZE
|
||||||
|
avcodec/wavarc: Fix integer overflwo in do_stereo()
|
||||||
|
avutil/tx_template: Fix some signed integer overflows in DECL_FFT5()
|
||||||
|
avcodec/aacdec_template: Better avoidance of signed integer overflow in imdct_and_windowing_eld()
|
||||||
|
tools/target_dec_fuzzer: Adjust threshold for MVHA
|
||||||
|
avformat/avs: Check if return code is representable
|
||||||
|
avcodec/flacdec: Fix integer overflow in "33bit" DECODER_SUBFRAME_FIXED_WIDE()
|
||||||
|
avcodec/flacdec: Fix overflow in "33bit" decorrelate
|
||||||
|
avcodec/lcldec: Make PNG filter addressing match the code afterwards
|
||||||
|
avformat/westwood_vqa: Check chunk size
|
||||||
|
avformat/sbgdec: Check for period overflow
|
||||||
|
avformat/concatdec: Check in/outpoint for overflow
|
||||||
|
avformat/mov: Check avif_info
|
||||||
|
avformat/mxfdec: Remove this_partition
|
||||||
|
avcodec/xvididct: Fix integer overflow in idct_row()
|
||||||
|
avcodec/celp_math: avoid overflow in shift
|
||||||
|
tools/target_dec_fuzzer: Adjust threshold for rtv1
|
||||||
|
avformat/hls: reduce default max reload to 3
|
||||||
|
avformat/format: Stop reading data at EOF during probing
|
||||||
|
avcodec/bonk: Fix integer overflow in predictor_calc_error()
|
||||||
|
avcodec/jpeg2000dec: jpeg2000 has its own lowres option
|
||||||
|
avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
|
||||||
|
avcodec/cscd: Fix "CamStudio Lossless Codec 1.0" gzip files
|
||||||
|
avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of LZO files
|
||||||
|
avcodec/mpeg4videodec: consider lowres in dest_pcm[]
|
||||||
|
avcodec/hevcdec: Fix undefined memcpy()
|
||||||
|
avcodec/mpeg4videodec: more unsigned in amv computation
|
||||||
|
avcodec/tta: fix signed overflow in decorrelate
|
||||||
|
avcodec/apedec: remove unused variable
|
||||||
|
avcodec/apedec: Fix 48khz 24bit below insane level
|
||||||
|
avcodec/apedec: Fix CRC for 24bps and bigendian
|
||||||
|
avcodec/wavarc: Check that nb_samples is not negative
|
||||||
|
avcodec/wavarc: Check shift
|
||||||
|
avcodec/xvididct: Fix integer overflow in idct_row()
|
||||||
|
avformat/avr: Check sample rate
|
||||||
|
avformat/imf_cpl: Replace NULL content_title_utf8 by ""
|
||||||
|
avformat/imf_cpl: xmlNodeListGetString() can return NULL
|
||||||
|
avcodec/aacdec_template: Fix undefined signed interger operations
|
||||||
|
avcodec/wavarc: Fix k limit
|
||||||
|
avcodec/rka: Fix integer overflow in decode_filter()
|
||||||
|
avformat/rka: bps < 8 is invalid
|
||||||
|
avcodec/pcm: allow Changing parameters
|
||||||
|
avutil/tx_template: extend to 2M
|
||||||
|
avcodec/jpeg2000dec: Check for reduction factor and image offset
|
||||||
|
avutil/softfloat: Basic documentation for av_sincos_sf()
|
||||||
|
avutil/softfloat: fix av_sincos_sf()
|
||||||
|
tools/target_dec_fuzzer: Adjust threshold for speex
|
||||||
|
avcodec/utils: fix 2 integer overflows in get_audio_frame_duration()
|
||||||
|
avcodec/hevcdec: Avoid null pointer dereferences in MC
|
||||||
|
avcodec/takdsp: Fix integer overflows
|
||||||
|
avcodec/mpegvideo_dec: consider interlaced lowres 4:2:0 chroma in edge emulation check better
|
||||||
|
avcodec/rka: use unsigned for buf0 additions
|
||||||
|
avcodec/rka: Avoid undefined left shift
|
||||||
|
avcodec: Ignoring errors is only possible before the input end
|
||||||
|
avformat/jpegxl_probe: Forward error codes
|
||||||
|
avformat/jpegxl_probe: check length instead of blindly reading
|
||||||
|
avformat/jpegxl_probe: Remove intermediate macro obfuscation around get_bits*()
|
||||||
|
avcodec/noise_bsf: Check for wrapped frames
|
||||||
|
avformat/oggparsetheora: clip duration within 64bit
|
||||||
|
avcodec/rka: avoid undefined multiply in cmode==0
|
||||||
|
avcodec/rka: use 64bit for srate_pad computation
|
||||||
|
avcodec/bonk: Avoid undefined integer overflow in predictor_calc_error()
|
||||||
|
avformat/wavdec: Check that smv block fits in available space
|
||||||
|
avcodec/adpcm: Fix integer overflow in intermediate in ADPCM_XMD
|
||||||
|
avcodec/dpcm: fix undefined interger overflow in wady
|
||||||
|
avcodec/tiff: add a zero DNG_LINEARIZATION_TABLE check
|
||||||
|
avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()
|
||||||
|
avcodec/sonic: Fix two undefined integer overflows
|
||||||
|
avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated
|
||||||
|
avcodec/flacdec: Fix signed integre overflow
|
||||||
|
avcodec/exr: Cleanup befor return
|
||||||
|
avcodec/pngdec: Do not pass AVFrame into global header decode
|
||||||
|
avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk()
|
||||||
|
avcodec/wavarc: Check order before using it to write the list
|
||||||
|
avcodec/bonk: decode multiple passes in intlist_read() at once
|
||||||
|
avcodec/vorbisdec: Check codebook float values to be finite
|
||||||
|
avcodec/g2meet: Replace fake allocation avoidance for framebuf
|
||||||
|
avutil/tx_priv: Use unsigned in BF() to avoid signed overflows
|
||||||
|
avcodec/lcldec: More space for rgb24
|
||||||
|
avcodec/lcldec: Support 4:1:1 and 4:2:2 with odd width
|
||||||
|
libavcodec/lcldec: width and height should not be unsigned
|
||||||
|
avformat/imf: fix invalid resource handling
|
||||||
|
avcodec/escape124: Check that blocks are allocated before use
|
||||||
|
avcodec/rka: Fix signed integer overflow in decode_filter()
|
||||||
|
avcodec/huffyuvdec: Fix undefined behavior with shift
|
||||||
|
avcodec/j2kenc: Replace RGB24 special case by generic test
|
||||||
|
avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bits
|
||||||
|
avcodec/j2kenc: simplify pixel format setup
|
||||||
|
avcodec/j2kenc: Fix funky bpno errors on decoding
|
||||||
|
avcodec/j2kenc: remove misleading pred value
|
||||||
|
avcodec/j2kenc: fix 5/3 DWT identifer
|
||||||
|
avcodec/vp3: Check width to avoid assertion failure
|
||||||
|
avcodec/g729postfilter: Limit shift in long term filter
|
||||||
|
avcodec/wavarc: Fix several integer overflows
|
||||||
|
avcodec/tests/snowenc: Fix 2nd test
|
||||||
|
avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches
|
||||||
|
avcodec/snowenc: Fix visual weight calculation
|
||||||
|
avcodec/tests/snowenc: unbreak DWT tests
|
||||||
|
avcodec/mpeg12dec: Check input size
|
||||||
|
avcodec/escape124: Fix some return codes
|
||||||
|
avcodec/escape124: fix signdness of end of input check
|
||||||
|
Use https for repository links
|
||||||
|
avcodec/nvdec_hevc: fail to initialize on unsupported profiles
|
||||||
|
fftools/ffmpeg_enc: apply -top to individual encoded frames
|
||||||
|
avcodec/on2avc: use correct fft sizes
|
||||||
|
avcodec/on2avc: use the matching AVTX context for the 512 sized iMDCT
|
||||||
|
examples: fix build of mux and resample_audio
|
||||||
|
avcodec/nvenc: stop using deprecated rc modes with SDK 12.1
|
||||||
|
configure: use non-deprecated nvenc GUID for conftest
|
||||||
|
avcodec/x86/mathops: clip constants used with shift instructions within inline assembly
|
||||||
|
avfilter/vsrc_ddagrab: calculate pointer position on rotated screens
|
||||||
|
avfilter/vsrc_ddagrab: account for mouse-only frames during probing
|
||||||
|
avcodec/aac_ac3_parser: add preprocessor checks for codec specific code
|
||||||
|
avcodec/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
|
||||||
|
Revert "lavc/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE"
|
||||||
|
Revert "avcodec/nvenc: fix b-frame DTS behavior with fractional framerates"
|
||||||
|
avcodec/vdpau_mpeg4: fix order of quant matrix coefficients
|
||||||
|
avcodec/vdpau_mpeg12: fix order of quant matrix coefficients
|
||||||
|
avcodec/nvdec_mpeg4: fix order of quant matrix coefficients
|
||||||
|
avcodec/nvdec_mpeg2: fix order of quant matrix coefficients
|
||||||
|
fftools/ffmpeg_filter: fix leak of AVIOContext in read_binary()
|
||||||
|
fftools/ffmpeg: avoid possible invalid reads with short -tag values
|
||||||
|
avcodec/mp_cmp: reject invalid comparison function values
|
||||||
|
avcodec/aacpsy: clip global_quality within the psy_vbr_map array boundaries
|
||||||
|
avutil/wchar_filename: propagate MultiByteToWideChar() and WideCharToMultiByte() failures
|
||||||
|
avformat/concatf: check if any nodes were allocated
|
||||||
|
avcodec/nvenc: fix b-frame DTS behavior with fractional framerates
|
||||||
|
avcodec/vorbisdec: export skip_samples instead of dropping frames
|
||||||
|
fftools/ffmpeg_mux_init: avoid invalid reads in forced keyframe parsing
|
||||||
|
lavfi/vf_vpp_qsv: set the right timestamp for AVERROR_EOF
|
||||||
|
avfilter/vf_untile: swap the chroma shift values used for plane offsets
|
||||||
|
lavc/decode: stop mangling last_pkt_props->opaque
|
||||||
|
avcodec/nvenc: avoid failing b_ref_mode check when unset
|
||||||
|
lavu/vulkan: fix handle type for 32-bit targets
|
||||||
|
vulkan: Fix win/i386 calling convention
|
||||||
|
avfilter/graphparser: fix filter instance name when an id is provided
|
||||||
|
avcodec/aacps_tablegen: fix build error after avutil bump
|
||||||
|
avcodec/nvenc: fix potential NULL pointer dereference
|
||||||
|
|
||||||
|
|
||||||
version 6.0:
|
version 6.0:
|
||||||
- Radiance HDR image support
|
- Radiance HDR image support
|
||||||
- ddagrab (Desktop Duplication) video capture filter
|
- ddagrab (Desktop Duplication) video capture filter
|
||||||
|
|
|
||||||
6
Makefile
6
Makefile
|
|
@ -91,10 +91,10 @@ ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
||||||
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
||||||
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
||||||
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
|
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
|
||||||
ALTIVEC-OBJS VSX-OBJS RVV-OBJS MMX-OBJS X86ASM-OBJS \
|
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
|
||||||
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
||||||
MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \
|
MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS \
|
||||||
STLIBOBJS HOSTOBJS TESTOBJS
|
OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS
|
||||||
|
|
||||||
define RESET
|
define RESET
|
||||||
$(1) :=
|
$(1) :=
|
||||||
|
|
|
||||||
2
RELEASE
2
RELEASE
|
|
@ -1 +1 @@
|
||||||
5.1.git
|
6.0.2
|
||||||
|
|
|
||||||
15
RELEASE_NOTES
Normal file
15
RELEASE_NOTES
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
┌────────────────────────────────────────────┐
|
||||||
|
│ RELEASE NOTES for FFmpeg 6.0 "Von Neumann" │
|
||||||
|
└────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
The FFmpeg Project proudly presents FFmpeg 6.0 "Von Neumann", about 6
|
||||||
|
months after the release of FFmpeg 5.1.
|
||||||
|
|
||||||
|
A complete Changelog is available at the root of the project, and the
|
||||||
|
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
|
||||||
|
|
||||||
|
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.libera.chat) or ask
|
||||||
|
on the mailing-lists.
|
||||||
41
configure
vendored
41
configure
vendored
|
|
@ -2110,10 +2110,12 @@ ARCH_EXT_LIST_PPC="
|
||||||
ldbrx
|
ldbrx
|
||||||
power8
|
power8
|
||||||
ppc4xx
|
ppc4xx
|
||||||
|
vec_xl
|
||||||
vsx
|
vsx
|
||||||
"
|
"
|
||||||
|
|
||||||
ARCH_EXT_LIST_RISCV="
|
ARCH_EXT_LIST_RISCV="
|
||||||
|
rv
|
||||||
rvv
|
rvv
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
@ -2191,6 +2193,7 @@ HEADERS_LIST="
|
||||||
opencv2_core_core_c_h
|
opencv2_core_core_c_h
|
||||||
OpenGL_gl3_h
|
OpenGL_gl3_h
|
||||||
poll_h
|
poll_h
|
||||||
|
pthread_np_h
|
||||||
sys_param_h
|
sys_param_h
|
||||||
sys_resource_h
|
sys_resource_h
|
||||||
sys_select_h
|
sys_select_h
|
||||||
|
|
@ -2293,6 +2296,8 @@ SYSTEM_FUNCS="
|
||||||
posix_memalign
|
posix_memalign
|
||||||
prctl
|
prctl
|
||||||
pthread_cancel
|
pthread_cancel
|
||||||
|
pthread_set_name_np
|
||||||
|
pthread_setname_np
|
||||||
sched_getaffinity
|
sched_getaffinity
|
||||||
SecItemImport
|
SecItemImport
|
||||||
SetConsoleTextAttribute
|
SetConsoleTextAttribute
|
||||||
|
|
@ -2407,6 +2412,7 @@ HAVE_LIST="
|
||||||
opencl_vaapi_intel_media
|
opencl_vaapi_intel_media
|
||||||
perl
|
perl
|
||||||
pod2man
|
pod2man
|
||||||
|
posix_ioctl
|
||||||
texi2html
|
texi2html
|
||||||
xmllint
|
xmllint
|
||||||
zlib_gzip
|
zlib_gzip
|
||||||
|
|
@ -2627,9 +2633,11 @@ altivec_deps="ppc"
|
||||||
dcbzl_deps="ppc"
|
dcbzl_deps="ppc"
|
||||||
ldbrx_deps="ppc"
|
ldbrx_deps="ppc"
|
||||||
ppc4xx_deps="ppc"
|
ppc4xx_deps="ppc"
|
||||||
|
vec_xl_deps="altivec"
|
||||||
vsx_deps="altivec"
|
vsx_deps="altivec"
|
||||||
power8_deps="vsx"
|
power8_deps="vsx"
|
||||||
|
|
||||||
|
rv_deps="riscv"
|
||||||
rvv_deps="riscv"
|
rvv_deps="riscv"
|
||||||
|
|
||||||
loongson2_deps="mips"
|
loongson2_deps="mips"
|
||||||
|
|
@ -3892,6 +3900,8 @@ if test "$target_os_default" = aix; then
|
||||||
arch_default=$(uname -p)
|
arch_default=$(uname -p)
|
||||||
strip_default="strip -X32_64"
|
strip_default="strip -X32_64"
|
||||||
nm_default="nm -g -X32_64"
|
nm_default="nm -g -X32_64"
|
||||||
|
elif test "$MSYSTEM_CARCH" != ""; then
|
||||||
|
arch_default="$MSYSTEM_CARCH"
|
||||||
else
|
else
|
||||||
arch_default=$(uname -m)
|
arch_default=$(uname -m)
|
||||||
fi
|
fi
|
||||||
|
|
@ -5519,6 +5529,7 @@ case $target_os in
|
||||||
;;
|
;;
|
||||||
netbsd)
|
netbsd)
|
||||||
disable symver
|
disable symver
|
||||||
|
enable section_data_rel_ro
|
||||||
oss_indev_extralibs="-lossaudio"
|
oss_indev_extralibs="-lossaudio"
|
||||||
oss_outdev_extralibs="-lossaudio"
|
oss_outdev_extralibs="-lossaudio"
|
||||||
enabled gcc || check_ldflags -Wl,-zmuldefs
|
enabled gcc || check_ldflags -Wl,-zmuldefs
|
||||||
|
|
@ -5537,6 +5548,7 @@ case $target_os in
|
||||||
disable symver
|
disable symver
|
||||||
;;
|
;;
|
||||||
freebsd)
|
freebsd)
|
||||||
|
enable section_data_rel_ro
|
||||||
;;
|
;;
|
||||||
bsd/os)
|
bsd/os)
|
||||||
add_extralibs -lpoll -lgnugetopt
|
add_extralibs -lpoll -lgnugetopt
|
||||||
|
|
@ -6113,8 +6125,14 @@ elif enabled ppc; then
|
||||||
check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
|
check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if enabled altivec; then
|
||||||
|
check_cc vec_xl altivec.h "const unsigned char *y1i = { 0 };
|
||||||
|
vector unsigned char y0 = vec_xl(0, y1i);"
|
||||||
|
fi
|
||||||
|
|
||||||
elif enabled riscv; then
|
elif enabled riscv; then
|
||||||
|
|
||||||
|
enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"'
|
||||||
enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"'
|
enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"'
|
||||||
|
|
||||||
elif enabled x86; then
|
elif enabled x86; then
|
||||||
|
|
@ -6350,6 +6368,7 @@ check_headers malloc.h
|
||||||
check_headers mftransform.h
|
check_headers mftransform.h
|
||||||
check_headers net/udplite.h
|
check_headers net/udplite.h
|
||||||
check_headers poll.h
|
check_headers poll.h
|
||||||
|
check_headers pthread_np.h
|
||||||
check_headers sys/param.h
|
check_headers sys/param.h
|
||||||
check_headers sys/resource.h
|
check_headers sys/resource.h
|
||||||
check_headers sys/select.h
|
check_headers sys/select.h
|
||||||
|
|
@ -6513,6 +6532,12 @@ if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
|
||||||
if enabled pthreads; then
|
if enabled pthreads; then
|
||||||
check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
|
check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
|
||||||
check_func pthread_cancel $pthreads_extralibs
|
check_func pthread_cancel $pthreads_extralibs
|
||||||
|
hdrs=pthread.h
|
||||||
|
if enabled pthread_np_h; then
|
||||||
|
hdrs="$hdrs pthread_np.h"
|
||||||
|
fi
|
||||||
|
check_lib pthread_set_name_np "$hdrs" pthread_set_name_np -lpthread
|
||||||
|
check_lib pthread_setname_np "$hdrs" pthread_setname_np -lpthread
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -6859,11 +6884,13 @@ pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
|
||||||
rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
|
rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
|
||||||
xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint
|
xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint
|
||||||
|
|
||||||
|
check_headers linux/fb.h
|
||||||
|
check_headers linux/videodev2.h
|
||||||
|
test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
|
||||||
|
test_code cc sys/ioctl.h "int ioctl(int, int, ...)" && enable posix_ioctl
|
||||||
|
|
||||||
# check V4L2 codecs available in the API
|
# check V4L2 codecs available in the API
|
||||||
if enabled v4l2_m2m; then
|
if enabled v4l2_m2m; then
|
||||||
check_headers linux/fb.h
|
|
||||||
check_headers linux/videodev2.h
|
|
||||||
test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
|
|
||||||
check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
|
check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
|
||||||
check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
|
check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
|
||||||
check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
|
check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
|
||||||
|
|
@ -6908,8 +6935,7 @@ enabled alsa && { check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimesta
|
||||||
enabled libjack &&
|
enabled libjack &&
|
||||||
require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
|
require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
|
||||||
|
|
||||||
enabled sndio && { check_pkg_config sndio sndio "sndio.h" sio_open ||
|
enabled sndio && check_pkg_config sndio sndio sndio.h sio_open
|
||||||
check_lib sndio sndio.h sio_open -lsndio; }
|
|
||||||
|
|
||||||
if enabled libcdio; then
|
if enabled libcdio; then
|
||||||
check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
|
check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
|
||||||
|
|
@ -7018,7 +7044,7 @@ fi
|
||||||
|
|
||||||
if enabled x86; then
|
if enabled x86; then
|
||||||
case $target_os in
|
case $target_os in
|
||||||
mingw32*|mingw64*|win32|win64|linux|cygwin*)
|
freebsd|mingw32*|mingw64*|win32|win64|linux|cygwin*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
disable ffnvcodec cuvid nvdec nvenc
|
disable ffnvcodec cuvid nvdec nvenc
|
||||||
|
|
@ -7042,7 +7068,7 @@ enabled nvenc &&
|
||||||
test_cc -I$source_path <<EOF || disable nvenc
|
test_cc -I$source_path <<EOF || disable nvenc
|
||||||
#include <ffnvcodec/nvEncodeAPI.h>
|
#include <ffnvcodec/nvEncodeAPI.h>
|
||||||
NV_ENCODE_API_FUNCTION_LIST flist;
|
NV_ENCODE_API_FUNCTION_LIST flist;
|
||||||
void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }
|
void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_CODEC_H264_GUID } }; }
|
||||||
int main(void) { return 0; }
|
int main(void) { return 0; }
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
@ -7601,6 +7627,7 @@ if enabled ppc; then
|
||||||
echo "POWER8 enabled ${power8-no}"
|
echo "POWER8 enabled ${power8-no}"
|
||||||
echo "PPC 4xx optimizations ${ppc4xx-no}"
|
echo "PPC 4xx optimizations ${ppc4xx-no}"
|
||||||
echo "dcbzl available ${dcbzl-no}"
|
echo "dcbzl available ${dcbzl-no}"
|
||||||
|
echo "vec_xl available ${vec_xl-no}"
|
||||||
fi
|
fi
|
||||||
if enabled loongarch; then
|
if enabled loongarch; then
|
||||||
echo "LSX enabled ${lsx-no}"
|
echo "LSX enabled ${lsx-no}"
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER =
|
PROJECT_NUMBER = 6.0.2
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
The FFmpeg developers.
|
The FFmpeg developers.
|
||||||
|
|
||||||
For details about the authorship, see the Git history of the project
|
For details about the authorship, see the Git history of the project
|
||||||
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
|
(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||||
@command{git log} in the FFmpeg source directory, or browsing the
|
@command{git log} in the FFmpeg source directory, or browsing the
|
||||||
online repository at @url{http://source.ffmpeg.org}.
|
online repository at @url{https://git.ffmpeg.org/ffmpeg}.
|
||||||
|
|
||||||
Maintainers for the specific components are listed in the file
|
Maintainers for the specific components are listed in the file
|
||||||
@file{MAINTAINERS} in the source code tree.
|
@file{MAINTAINERS} in the source code tree.
|
||||||
|
|
|
||||||
2
doc/bootstrap.min.css
vendored
2
doc/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1949,22 +1949,6 @@ Set the number of slices, used in parallelized encoding. Default value
|
||||||
is 0. This is only used when @option{slice_mode} is set to
|
is 0. This is only used when @option{slice_mode} is set to
|
||||||
@samp{fixed}.
|
@samp{fixed}.
|
||||||
|
|
||||||
@item slice_mode
|
|
||||||
Set slice mode. Can assume one of the following possible values:
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item fixed
|
|
||||||
a fixed number of slices
|
|
||||||
@item rowmb
|
|
||||||
one slice per row of macroblocks
|
|
||||||
@item auto
|
|
||||||
automatic number of slices according to number of threads
|
|
||||||
@item dyn
|
|
||||||
dynamic slicing
|
|
||||||
@end table
|
|
||||||
|
|
||||||
Default value is @samp{auto}.
|
|
||||||
|
|
||||||
@item loopfilter
|
@item loopfilter
|
||||||
Enable loop filter, if set to 1 (automatically enabled). To disable
|
Enable loop filter, if set to 1 (automatically enabled). To disable
|
||||||
set a value of 0.
|
set a value of 0.
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ OBJS=$(addsuffix .o,$(EXAMPLES))
|
||||||
# the following examples make explicit use of the math library
|
# the following examples make explicit use of the math library
|
||||||
avcodec: LDLIBS += -lm
|
avcodec: LDLIBS += -lm
|
||||||
encode_audio: LDLIBS += -lm
|
encode_audio: LDLIBS += -lm
|
||||||
muxing: LDLIBS += -lm
|
mux: LDLIBS += -lm
|
||||||
resampling_audio: LDLIBS += -lm
|
resample_audio: LDLIBS += -lm
|
||||||
|
|
||||||
.phony: all clean-test clean
|
.phony: all clean-test clean
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26943,11 +26943,6 @@ Specify the frame rate expected for the video stream.
|
||||||
@item pixel_aspect, sar
|
@item pixel_aspect, sar
|
||||||
The sample (pixel) aspect ratio of the input video.
|
The sample (pixel) aspect ratio of the input video.
|
||||||
|
|
||||||
@item sws_param
|
|
||||||
This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
|
|
||||||
to the filtergraph description to specify swscale flags for automatically
|
|
||||||
inserted scalers. See @ref{Filtergraph syntax}.
|
|
||||||
|
|
||||||
@item hw_frames_ctx
|
@item hw_frames_ctx
|
||||||
When using a hardware pixel format, this should be a reference to an
|
When using a hardware pixel format, this should be a reference to an
|
||||||
AVHWFramesContext describing input frames.
|
AVHWFramesContext describing input frames.
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ Most distribution and operating system provide a package for it.
|
||||||
@section Cloning the source tree
|
@section Cloning the source tree
|
||||||
|
|
||||||
@example
|
@example
|
||||||
git clone git://source.ffmpeg.org/ffmpeg <target>
|
git clone https://git.ffmpeg.org/ffmpeg.git <target>
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
This will put the FFmpeg sources into the directory @var{<target>}.
|
This will put the FFmpeg sources into the directory @var{<target>}.
|
||||||
|
|
|
||||||
|
|
@ -795,12 +795,6 @@ deletes them. Increase this to allow continue clients to download segments which
|
||||||
were recently referenced in the playlist. Default value is 1, meaning segments older than
|
were recently referenced in the playlist. Default value is 1, meaning segments older than
|
||||||
@code{hls_list_size+1} will be deleted.
|
@code{hls_list_size+1} will be deleted.
|
||||||
|
|
||||||
@item hls_ts_options @var{options_list}
|
|
||||||
Set output format options using a :-separated list of key=value
|
|
||||||
parameters. Values containing @code{:} special characters must be
|
|
||||||
escaped.
|
|
||||||
@code{hls_ts_options} is deprecated, use hls_segment_options instead of it..
|
|
||||||
|
|
||||||
@item hls_start_number_source
|
@item hls_start_number_source
|
||||||
Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to the specified source.
|
Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to the specified source.
|
||||||
Unless @code{hls_flags single_file} is set, it also specifies source of starting sequence numbers of
|
Unless @code{hls_flags single_file} is set, it also specifies source of starting sequence numbers of
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,8 @@ programmatic use.
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
|
|
||||||
@item ich, in_channel_count
|
@item uchl, used_chlayout
|
||||||
Set the number of input channels. Default value is 0. Setting this
|
Set used input channel layout. Default is unset. This option is
|
||||||
value is not mandatory if the corresponding channel layout
|
|
||||||
@option{in_channel_layout} is set.
|
|
||||||
|
|
||||||
@item och, out_channel_count
|
|
||||||
Set the number of output channels. Default value is 0. Setting this
|
|
||||||
value is not mandatory if the corresponding channel layout
|
|
||||||
@option{out_channel_layout} is set.
|
|
||||||
|
|
||||||
@item uch, used_channel_count
|
|
||||||
Set the number of used input channels. Default value is 0. This option is
|
|
||||||
only used for special remapping.
|
only used for special remapping.
|
||||||
|
|
||||||
@item isr, in_sample_rate
|
@item isr, in_sample_rate
|
||||||
|
|
@ -41,8 +31,8 @@ Specify the output sample format. It is set by default to @code{none}.
|
||||||
Set the internal sample format. Default value is @code{none}.
|
Set the internal sample format. Default value is @code{none}.
|
||||||
This will automatically be chosen when it is not explicitly set.
|
This will automatically be chosen when it is not explicitly set.
|
||||||
|
|
||||||
@item icl, in_channel_layout
|
@item ichl, in_chlayout
|
||||||
@item ocl, out_channel_layout
|
@item ochl, out_chlayout
|
||||||
Set the input/output channel layout.
|
Set the input/output channel layout.
|
||||||
|
|
||||||
See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
|
See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
|
||||||
|
|
|
||||||
106
doc/t2h.pm
106
doc/t2h.pm
|
|
@ -20,8 +20,45 @@
|
||||||
# License along with FFmpeg; if not, write to the Free Software
|
# License along with FFmpeg; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
# Texinfo 7.0 changed the syntax of various functions.
|
||||||
|
# Provide a shim for older versions.
|
||||||
|
sub ff_set_from_init_file($$) {
|
||||||
|
my $key = shift;
|
||||||
|
my $value = shift;
|
||||||
|
if (exists &{'texinfo_set_from_init_file'}) {
|
||||||
|
texinfo_set_from_init_file($key, $value);
|
||||||
|
} else {
|
||||||
|
set_from_init_file($key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ff_get_conf($) {
|
||||||
|
my $key = shift;
|
||||||
|
if (exists &{'texinfo_get_conf'}) {
|
||||||
|
texinfo_get_conf($key);
|
||||||
|
} else {
|
||||||
|
get_conf($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_formatting_function($$) {
|
||||||
|
my $obj = shift;
|
||||||
|
my $func = shift;
|
||||||
|
|
||||||
|
my $sub = $obj->can('formatting_function');
|
||||||
|
if ($sub) {
|
||||||
|
return $obj->formatting_function($func);
|
||||||
|
} else {
|
||||||
|
return $obj->{$func};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# determine texinfo version
|
||||||
|
my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
|
||||||
|
my $program_version_6_8 = $program_version_num >= 6.008000;
|
||||||
|
|
||||||
# no navigation elements
|
# no navigation elements
|
||||||
set_from_init_file('HEADERS', 0);
|
ff_set_from_init_file('HEADERS', 0);
|
||||||
|
|
||||||
sub ffmpeg_heading_command($$$$$)
|
sub ffmpeg_heading_command($$$$$)
|
||||||
{
|
{
|
||||||
|
|
@ -55,7 +92,7 @@ sub ffmpeg_heading_command($$$$$)
|
||||||
$element = $command->{'parent'};
|
$element = $command->{'parent'};
|
||||||
}
|
}
|
||||||
if ($element) {
|
if ($element) {
|
||||||
$result .= &{$self->{'format_element_header'}}($self, $cmdname,
|
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
|
||||||
$command, $element);
|
$command, $element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,7 +149,11 @@ sub ffmpeg_heading_command($$$$$)
|
||||||
$cmdname
|
$cmdname
|
||||||
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
|
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
|
||||||
}
|
}
|
||||||
$result .= &{$self->{'format_heading_text'}}(
|
# format_heading_text expects an array of headings for texinfo >= 7.0
|
||||||
|
if ($program_version_num >= 7.000000) {
|
||||||
|
$heading = [$heading];
|
||||||
|
}
|
||||||
|
$result .= &{get_formatting_function($self,'format_heading_text')}(
|
||||||
$self, $cmdname, $heading,
|
$self, $cmdname, $heading,
|
||||||
$heading_level +
|
$heading_level +
|
||||||
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
|
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
|
||||||
|
|
@ -126,23 +167,19 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
|
||||||
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
|
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
# determine if texinfo is at least version 6.8
|
|
||||||
my $program_version_num = version->declare(get_conf('PACKAGE_VERSION'))->numify;
|
|
||||||
my $program_version_6_8 = $program_version_num >= 6.008000;
|
|
||||||
|
|
||||||
# print the TOC where @contents is used
|
# print the TOC where @contents is used
|
||||||
if ($program_version_6_8) {
|
if ($program_version_6_8) {
|
||||||
set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
|
ff_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
|
||||||
} else {
|
} else {
|
||||||
set_from_init_file('INLINE_CONTENTS', 1);
|
ff_set_from_init_file('INLINE_CONTENTS', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# make chapters <h2>
|
# make chapters <h2>
|
||||||
set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
|
ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
|
||||||
|
|
||||||
# Do not add <hr>
|
# Do not add <hr>
|
||||||
set_from_init_file('DEFAULT_RULE', '');
|
ff_set_from_init_file('DEFAULT_RULE', '');
|
||||||
set_from_init_file('BIG_RULE', '');
|
ff_set_from_init_file('BIG_RULE', '');
|
||||||
|
|
||||||
# Customized file beginning
|
# Customized file beginning
|
||||||
sub ffmpeg_begin_file($$$)
|
sub ffmpeg_begin_file($$$)
|
||||||
|
|
@ -159,7 +196,18 @@ sub ffmpeg_begin_file($$$)
|
||||||
my ($title, $description, $encoding, $date, $css_lines,
|
my ($title, $description, $encoding, $date, $css_lines,
|
||||||
$doctype, $bodytext, $copying_comment, $after_body_open,
|
$doctype, $bodytext, $copying_comment, $after_body_open,
|
||||||
$extra_head, $program_and_version, $program_homepage,
|
$extra_head, $program_and_version, $program_homepage,
|
||||||
$program, $generator) = $self->_file_header_informations($command);
|
$program, $generator);
|
||||||
|
if ($program_version_num >= 7.000000) {
|
||||||
|
($title, $description, $encoding, $date, $css_lines,
|
||||||
|
$doctype, $bodytext, $copying_comment, $after_body_open,
|
||||||
|
$extra_head, $program_and_version, $program_homepage,
|
||||||
|
$program, $generator) = $self->_file_header_information($command);
|
||||||
|
} else {
|
||||||
|
($title, $description, $encoding, $date, $css_lines,
|
||||||
|
$doctype, $bodytext, $copying_comment, $after_body_open,
|
||||||
|
$extra_head, $program_and_version, $program_homepage,
|
||||||
|
$program, $generator) = $self->_file_header_informations($command);
|
||||||
|
}
|
||||||
|
|
||||||
my $links = $self->_get_links ($filename, $element);
|
my $links = $self->_get_links ($filename, $element);
|
||||||
|
|
||||||
|
|
@ -223,7 +271,7 @@ if ($program_version_6_8) {
|
||||||
sub ffmpeg_end_file($)
|
sub ffmpeg_end_file($)
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $program_string = &{$self->{'format_program_string'}}($self);
|
my $program_string = &{get_formatting_function($self,'format_program_string')}($self);
|
||||||
my $program_text = <<EOT;
|
my $program_text = <<EOT;
|
||||||
<p style="font-size: small;">
|
<p style="font-size: small;">
|
||||||
$program_string
|
$program_string
|
||||||
|
|
@ -244,7 +292,7 @@ if ($program_version_6_8) {
|
||||||
|
|
||||||
# Dummy title command
|
# Dummy title command
|
||||||
# Ignore title. Title is handled through ffmpeg_begin_file().
|
# Ignore title. Title is handled through ffmpeg_begin_file().
|
||||||
set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
|
ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
|
||||||
sub ffmpeg_title($$$$)
|
sub ffmpeg_title($$$$)
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
|
|
@ -262,8 +310,14 @@ sub ffmpeg_float($$$$$)
|
||||||
my $args = shift;
|
my $args = shift;
|
||||||
my $content = shift;
|
my $content = shift;
|
||||||
|
|
||||||
my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
|
my ($caption, $prepended);
|
||||||
$command);
|
if ($program_version_num >= 7.000000) {
|
||||||
|
($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self,
|
||||||
|
$command);
|
||||||
|
} else {
|
||||||
|
($caption, $prepended) = Texinfo::Common::float_name_caption($self,
|
||||||
|
$command);
|
||||||
|
}
|
||||||
my $caption_text = '';
|
my $caption_text = '';
|
||||||
my $prepended_text;
|
my $prepended_text;
|
||||||
my $prepended_save = '';
|
my $prepended_save = '';
|
||||||
|
|
@ -335,8 +389,13 @@ sub ffmpeg_float($$$$$)
|
||||||
$caption->{'args'}->[0], 'float caption');
|
$caption->{'args'}->[0], 'float caption');
|
||||||
}
|
}
|
||||||
if ($prepended_text.$caption_text ne '') {
|
if ($prepended_text.$caption_text ne '') {
|
||||||
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
|
if ($program_version_num >= 7.000000) {
|
||||||
. $prepended_text;
|
$prepended_text = $self->html_attribute_class('div',['float-caption']). '>'
|
||||||
|
. $prepended_text;
|
||||||
|
} else {
|
||||||
|
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
|
||||||
|
. $prepended_text;
|
||||||
|
}
|
||||||
$caption_text .= '</div>';
|
$caption_text .= '</div>';
|
||||||
}
|
}
|
||||||
my $html_class = '';
|
my $html_class = '';
|
||||||
|
|
@ -349,8 +408,13 @@ sub ffmpeg_float($$$$$)
|
||||||
$prepended_text = '';
|
$prepended_text = '';
|
||||||
$caption_text = '';
|
$caption_text = '';
|
||||||
}
|
}
|
||||||
return $self->_attribute_class('div', $html_class). '>' . "\n" .
|
if ($program_version_num >= 7.000000) {
|
||||||
$prepended_text . $caption_text . $content . '</div>';
|
return $self->html_attribute_class('div', [$html_class]). '>' . "\n" .
|
||||||
|
$prepended_text . $caption_text . $content . '</div>';
|
||||||
|
} else {
|
||||||
|
return $self->_attribute_class('div', $html_class). '>' . "\n" .
|
||||||
|
$prepended_text . $caption_text . $content . '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
texinfo_register_command_formatting('float',
|
texinfo_register_command_formatting('float',
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ OBJS-$(HAVE_LASX) += $(LASX-OBJS) $(LASX-OBJS-yes)
|
||||||
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
|
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
|
||||||
OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
|
OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
|
||||||
|
|
||||||
|
OBJS-$(HAVE_RV) += $(RV-OBJS) $(RV-OBJS-yes)
|
||||||
OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes)
|
OBJS-$(HAVE_RVV) += $(RVV-OBJS) $(RVV-OBJS-yes)
|
||||||
|
|
||||||
OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
|
OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
|
||||||
|
|
|
||||||
|
|
@ -1337,6 +1337,9 @@ static void do_video_out(OutputFile *of,
|
||||||
in_picture->quality = enc->global_quality;
|
in_picture->quality = enc->global_quality;
|
||||||
in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture, i);
|
in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture, i);
|
||||||
|
|
||||||
|
if (ost->top_field_first >= 0)
|
||||||
|
in_picture->top_field_first = !!ost->top_field_first;
|
||||||
|
|
||||||
ret = submit_encode_frame(of, ost, in_picture);
|
ret = submit_encode_frame(of, ost, in_picture);
|
||||||
if (ret == AVERROR_EOF)
|
if (ret == AVERROR_EOF)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -628,8 +628,12 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
|
||||||
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
|
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
|
||||||
if (codec_tag) {
|
if (codec_tag) {
|
||||||
uint32_t tag = strtol(codec_tag, &next, 0);
|
uint32_t tag = strtol(codec_tag, &next, 0);
|
||||||
if (*next)
|
if (*next) {
|
||||||
tag = AV_RL32(codec_tag);
|
uint8_t buf[4] = { 0 };
|
||||||
|
memcpy(buf, codec_tag, FFMIN(sizeof(buf), strlen(codec_tag)));
|
||||||
|
tag = AV_RL32(buf);
|
||||||
|
}
|
||||||
|
|
||||||
st->codecpar->codec_tag = tag;
|
st->codecpar->codec_tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -352,11 +352,13 @@ static int read_binary(const char *path, uint8_t **data, int *len)
|
||||||
|
|
||||||
*len = fsize;
|
*len = fsize;
|
||||||
|
|
||||||
return 0;
|
ret = 0;
|
||||||
fail:
|
fail:
|
||||||
avio_close(io);
|
avio_close(io);
|
||||||
av_freep(data);
|
if (ret < 0) {
|
||||||
*len = 0;
|
av_freep(data);
|
||||||
|
*len = 0;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -606,8 +606,11 @@ static OutputStream *new_output_stream(Muxer *mux, const OptionsContext *o,
|
||||||
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
|
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
|
||||||
if (codec_tag) {
|
if (codec_tag) {
|
||||||
uint32_t tag = strtol(codec_tag, &next, 0);
|
uint32_t tag = strtol(codec_tag, &next, 0);
|
||||||
if (*next)
|
if (*next) {
|
||||||
tag = AV_RL32(codec_tag);
|
uint8_t buf[4] = { 0 };
|
||||||
|
memcpy(buf, codec_tag, FFMIN(sizeof(buf), strlen(codec_tag)));
|
||||||
|
tag = AV_RL32(buf);
|
||||||
|
}
|
||||||
ost->st->codecpar->codec_tag = tag;
|
ost->st->codecpar->codec_tag = tag;
|
||||||
if (ost->enc_ctx)
|
if (ost->enc_ctx)
|
||||||
ost->enc_ctx->codec_tag = tag;
|
ost->enc_ctx->codec_tag = tag;
|
||||||
|
|
@ -1819,11 +1822,11 @@ static int copy_metadata(Muxer *mux, AVFormatContext *ic,
|
||||||
parse_meta_type(mux, inspec, &type_in, &idx_in, &istream_spec);
|
parse_meta_type(mux, inspec, &type_in, &idx_in, &istream_spec);
|
||||||
parse_meta_type(mux, outspec, &type_out, &idx_out, &ostream_spec);
|
parse_meta_type(mux, outspec, &type_out, &idx_out, &ostream_spec);
|
||||||
|
|
||||||
if (type_in == 'g' || type_out == 'g')
|
if (type_in == 'g' || type_out == 'g' || (!*outspec && !ic))
|
||||||
*metadata_global_manual = 1;
|
*metadata_global_manual = 1;
|
||||||
if (type_in == 's' || type_out == 's')
|
if (type_in == 's' || type_out == 's' || (!*outspec && !ic))
|
||||||
*metadata_streams_manual = 1;
|
*metadata_streams_manual = 1;
|
||||||
if (type_in == 'c' || type_out == 'c')
|
if (type_in == 'c' || type_out == 'c' || (!*outspec && !ic))
|
||||||
*metadata_chapters_manual = 1;
|
*metadata_chapters_manual = 1;
|
||||||
|
|
||||||
/* ic is NULL when just disabling automatic mappings */
|
/* ic is NULL when just disabling automatic mappings */
|
||||||
|
|
@ -2063,7 +2066,7 @@ static void parse_forced_key_frames(KeyframeForceCtx *kf, const Muxer *mux,
|
||||||
if (next)
|
if (next)
|
||||||
*next++ = 0;
|
*next++ = 0;
|
||||||
|
|
||||||
if (!memcmp(p, "chapters", 8)) {
|
if (strstr(p, "chapters") == p) {
|
||||||
AVChapter * const *ch = mux->fc->chapters;
|
AVChapter * const *ch = mux->fc->chapters;
|
||||||
unsigned int nb_ch = mux->fc->nb_chapters;
|
unsigned int nb_ch = mux->fc->nb_chapters;
|
||||||
int j;
|
int j;
|
||||||
|
|
|
||||||
|
|
@ -1998,6 +1998,8 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (force_output_format) {
|
if (force_output_format) {
|
||||||
|
av_bprint_clear(&bp);
|
||||||
|
av_channel_layout_describe_bprint(&is->audio_tgt.ch_layout, &bp);
|
||||||
sample_rates [0] = is->audio_tgt.freq;
|
sample_rates [0] = is->audio_tgt.freq;
|
||||||
if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
|
if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
|
||||||
|
|
@ -887,6 +887,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= CFRAME_BUFFER_COUNT) {
|
if (i >= CFRAME_BUFFER_COUNT) {
|
||||||
|
if (free_index < 0)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
i = free_index;
|
i = free_index;
|
||||||
f->cfrm[i].id = id;
|
f->cfrm[i].id = id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
unsigned char *planemap = c->planemap;
|
unsigned char *planemap = c->planemap;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (buf_size < planes * height * 2)
|
if (buf_size < planes * height * (2 + 2*((avctx->width+128)/129)))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ get_next:
|
||||||
duration in seconds is still correct (as is the number of bits in
|
duration in seconds is still correct (as is the number of bits in
|
||||||
the frame). */
|
the frame). */
|
||||||
if (avctx->codec_id != AV_CODEC_ID_AAC) {
|
if (avctx->codec_id != AV_CODEC_ID_AAC) {
|
||||||
|
#if CONFIG_AC3_PARSER
|
||||||
AC3HeaderInfo hdr, *phrd = &hdr;
|
AC3HeaderInfo hdr, *phrd = &hdr;
|
||||||
int offset = ff_ac3_find_syncword(buf, buf_size);
|
int offset = ff_ac3_find_syncword(buf, buf_size);
|
||||||
|
|
||||||
|
|
@ -146,7 +147,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)
|
if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)
|
||||||
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
|
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
|
||||||
bit_rate = hdr.bit_rate;
|
bit_rate = hdr.bit_rate;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#if CONFIG_AAC_PARSER
|
||||||
AACADTSHeaderInfo hdr, *phrd = &hdr;
|
AACADTSHeaderInfo hdr, *phrd = &hdr;
|
||||||
int ret = avpriv_adts_header_parse(&phrd, buf, buf_size);
|
int ret = avpriv_adts_header_parse(&phrd, buf, buf_size);
|
||||||
|
|
||||||
|
|
@ -154,6 +157,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
bit_rate = hdr.bit_rate;
|
bit_rate = hdr.bit_rate;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the average bit rate */
|
/* Calculate the average bit rate */
|
||||||
|
|
|
||||||
|
|
@ -2856,8 +2856,8 @@ static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
|
||||||
ac->mdct512_fn(ac->mdct512, buf, in, sizeof(INTFLOAT));
|
ac->mdct512_fn(ac->mdct512, buf, in, sizeof(INTFLOAT));
|
||||||
|
|
||||||
for (i = 0; i < n; i+=2) {
|
for (i = 0; i < n; i+=2) {
|
||||||
buf[i + 0] = -(USE_FIXED + 1)*buf[i + 0];
|
buf[i + 0] = -(UINTFLOAT)(USE_FIXED + 1)*buf[i + 0];
|
||||||
buf[i + 1] = (USE_FIXED + 1)*buf[i + 1];
|
buf[i + 1] = (UINTFLOAT)(USE_FIXED + 1)*buf[i + 1];
|
||||||
}
|
}
|
||||||
// Like with the regular IMDCT at this point we still have the middle half
|
// Like with the regular IMDCT at this point we still have the middle half
|
||||||
// of a transform but with even symmetry on the left and odd symmetry on
|
// of a transform but with even symmetry on the left and odd symmetry on
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/libm.h"
|
#include "libavutil/libm.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem_internal.h"
|
||||||
#define NR_ALLPASS_BANDS20 30
|
#define NR_ALLPASS_BANDS20 30
|
||||||
#define NR_ALLPASS_BANDS34 50
|
#define NR_ALLPASS_BANDS34 50
|
||||||
#define PS_AP_LINKS 3
|
#define PS_AP_LINKS 3
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ static av_cold void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx)
|
||||||
AacPsyChannel *pch = &ctx->ch[i];
|
AacPsyChannel *pch = &ctx->ch[i];
|
||||||
|
|
||||||
if (avctx->flags & AV_CODEC_FLAG_QSCALE)
|
if (avctx->flags & AV_CODEC_FLAG_QSCALE)
|
||||||
pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm;
|
pch->attack_threshold = psy_vbr_map[av_clip(avctx->global_quality / FF_QP2LAMBDA, 0, 10)].st_lrm;
|
||||||
else
|
else
|
||||||
pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->ch_layout.nb_channels / 1000);
|
pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->ch_layout.nb_channels / 1000);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1579,11 +1579,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
nibble[0] = sign_extend(byte & 15, 4);
|
nibble[0] = sign_extend(byte & 15, 4);
|
||||||
nibble[1] = sign_extend(byte >> 4, 4);
|
nibble[1] = sign_extend(byte >> 4, 4);
|
||||||
|
|
||||||
out[2+n*2] = (nibble[0]*(scale<<14) + (history[0]*29336) - (history[1]*13136)) >> 14;
|
out[2+n*2] = nibble[0]*scale + ((history[0]*3667 - history[1]*1642) >> 11);
|
||||||
history[1] = history[0];
|
history[1] = history[0];
|
||||||
history[0] = out[2+n*2];
|
history[0] = out[2+n*2];
|
||||||
|
|
||||||
out[2+n*2+1] = (nibble[1]*(scale<<14) + (history[0]*29336) - (history[1]*13136)) >> 14;
|
out[2+n*2+1] = nibble[1]*scale + ((history[0]*3667 - history[1]*1642) >> 11);
|
||||||
history[1] = history[0];
|
history[1] = history[0];
|
||||||
history[0] = out[2+n*2+1];
|
history[0] = out[2+n*2+1];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,6 @@ typedef struct APEPredictor64 {
|
||||||
uint64_t coeffsA[2][4]; ///< adaption coefficients
|
uint64_t coeffsA[2][4]; ///< adaption coefficients
|
||||||
uint64_t coeffsB[2][5]; ///< adaption coefficients
|
uint64_t coeffsB[2][5]; ///< adaption coefficients
|
||||||
int64_t historybuffer[HISTORY_SIZE + PREDICTOR_SIZE];
|
int64_t historybuffer[HISTORY_SIZE + PREDICTOR_SIZE];
|
||||||
|
|
||||||
unsigned int sample_pos;
|
|
||||||
} APEPredictor64;
|
} APEPredictor64;
|
||||||
|
|
||||||
/** Decoder context */
|
/** Decoder context */
|
||||||
|
|
@ -860,8 +858,6 @@ static void init_predictor_decoder(APEContext *ctx)
|
||||||
p64->lastA[0] = p64->lastA[1] = 0;
|
p64->lastA[0] = p64->lastA[1] = 0;
|
||||||
|
|
||||||
p->sample_pos = 0;
|
p->sample_pos = 0;
|
||||||
|
|
||||||
p64->sample_pos = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get inverse sign of integer (-1 for positive, 1 for negative and 0 for zero) */
|
/** Get inverse sign of integer (-1 for positive, 1 for negative and 0 for zero) */
|
||||||
|
|
@ -1170,7 +1166,8 @@ static void predictor_decode_mono_3930(APEContext *ctx, int count)
|
||||||
static av_always_inline int predictor_update_filter(APEPredictor64 *p,
|
static av_always_inline int predictor_update_filter(APEPredictor64 *p,
|
||||||
const int decoded, const int filter,
|
const int decoded, const int filter,
|
||||||
const int delayA, const int delayB,
|
const int delayA, const int delayB,
|
||||||
const int adaptA, const int adaptB)
|
const int adaptA, const int adaptB,
|
||||||
|
int compression_level)
|
||||||
{
|
{
|
||||||
int64_t predictionA, predictionB;
|
int64_t predictionA, predictionB;
|
||||||
int32_t sign;
|
int32_t sign;
|
||||||
|
|
@ -1198,7 +1195,13 @@ static av_always_inline int predictor_update_filter(APEPredictor64 *p,
|
||||||
p->buf[delayB - 3] * p->coeffsB[filter][3] +
|
p->buf[delayB - 3] * p->coeffsB[filter][3] +
|
||||||
p->buf[delayB - 4] * p->coeffsB[filter][4];
|
p->buf[delayB - 4] * p->coeffsB[filter][4];
|
||||||
|
|
||||||
p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + (predictionB >> 1)) >> 10);
|
if (compression_level < COMPRESSION_LEVEL_INSANE) {
|
||||||
|
predictionA = (int32_t)predictionA;
|
||||||
|
predictionB = (int32_t)predictionB;
|
||||||
|
p->lastA[filter] = (int32_t)(decoded + (unsigned)((int32_t)(predictionA + (predictionB >> 1)) >> 10));
|
||||||
|
} else {
|
||||||
|
p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + (predictionB >> 1)) >> 10);
|
||||||
|
}
|
||||||
p->filterA[filter] = p->lastA[filter] + ((int64_t)(p->filterA[filter] * 31ULL) >> 5);
|
p->filterA[filter] = p->lastA[filter] + ((int64_t)(p->filterA[filter] * 31ULL) >> 5);
|
||||||
|
|
||||||
sign = APESIGN(decoded);
|
sign = APESIGN(decoded);
|
||||||
|
|
@ -1226,10 +1229,12 @@ static void predictor_decode_stereo_3950(APEContext *ctx, int count)
|
||||||
while (count--) {
|
while (count--) {
|
||||||
/* Predictor Y */
|
/* Predictor Y */
|
||||||
*decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB,
|
*decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB,
|
||||||
YADAPTCOEFFSA, YADAPTCOEFFSB);
|
YADAPTCOEFFSA, YADAPTCOEFFSB,
|
||||||
|
ctx->compression_level);
|
||||||
decoded0++;
|
decoded0++;
|
||||||
*decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB,
|
*decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB,
|
||||||
XADAPTCOEFFSA, XADAPTCOEFFSB);
|
XADAPTCOEFFSA, XADAPTCOEFFSB,
|
||||||
|
ctx->compression_level);
|
||||||
decoded1++;
|
decoded1++;
|
||||||
|
|
||||||
/* Combined */
|
/* Combined */
|
||||||
|
|
@ -1611,13 +1616,24 @@ static int ape_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
s->samples -= blockstodecode;
|
s->samples -= blockstodecode;
|
||||||
|
|
||||||
if (avctx->err_recognition & AV_EF_CRCCHECK &&
|
if (avctx->err_recognition & AV_EF_CRCCHECK &&
|
||||||
s->fileversion >= 3900 && s->bps < 24) {
|
s->fileversion >= 3900) {
|
||||||
uint32_t crc = s->CRC_state;
|
uint32_t crc = s->CRC_state;
|
||||||
const AVCRC *crc_tab = av_crc_get_table(AV_CRC_32_IEEE_LE);
|
const AVCRC *crc_tab = av_crc_get_table(AV_CRC_32_IEEE_LE);
|
||||||
|
int stride = s->bps == 24 ? 4 : (s->bps>>3);
|
||||||
|
int offset = s->bps == 24;
|
||||||
|
int bytes = s->bps >> 3;
|
||||||
|
|
||||||
for (i = 0; i < blockstodecode; i++) {
|
for (i = 0; i < blockstodecode; i++) {
|
||||||
for (ch = 0; ch < s->channels; ch++) {
|
for (ch = 0; ch < s->channels; ch++) {
|
||||||
uint8_t *smp = frame->data[ch] + (i*(s->bps >> 3));
|
#if HAVE_BIGENDIAN
|
||||||
crc = av_crc(crc_tab, crc, smp, s->bps >> 3);
|
uint8_t *smp_native = frame->data[ch] + i*stride;
|
||||||
|
uint8_t smp[4];
|
||||||
|
for(int j = 0; j<stride; j++)
|
||||||
|
smp[j] = smp_native[stride-j-1];
|
||||||
|
#else
|
||||||
|
uint8_t *smp = frame->data[ch] + i*stride;
|
||||||
|
#endif
|
||||||
|
crc = av_crc(crc_tab, crc, smp+offset, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ A .endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
// Begin loop
|
// Begin loop
|
||||||
01:
|
1:
|
||||||
.if TOTAL_TAPS == 0
|
.if TOTAL_TAPS == 0
|
||||||
// Things simplify a lot in this case
|
// Things simplify a lot in this case
|
||||||
// In fact this could be pipelined further if it's worth it...
|
// In fact this could be pipelined further if it's worth it...
|
||||||
|
|
@ -241,7 +241,7 @@ A .endif
|
||||||
str ST0, [PST, #-4]!
|
str ST0, [PST, #-4]!
|
||||||
str ST0, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
|
str ST0, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
|
||||||
str ST0, [PSAMP], #4 * MAX_CHANNELS
|
str ST0, [PSAMP], #4 * MAX_CHANNELS
|
||||||
bne 01b
|
bne 1b
|
||||||
.else
|
.else
|
||||||
.if \fir_taps & 1
|
.if \fir_taps & 1
|
||||||
.set LOAD_REG, 1
|
.set LOAD_REG, 1
|
||||||
|
|
@ -333,7 +333,7 @@ T orr AC0, AC0, AC1
|
||||||
str ST3, [PST, #-4]!
|
str ST3, [PST, #-4]!
|
||||||
str ST2, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
|
str ST2, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
|
||||||
str ST3, [PSAMP], #4 * MAX_CHANNELS
|
str ST3, [PSAMP], #4 * MAX_CHANNELS
|
||||||
bne 01b
|
bne 1b
|
||||||
.endif
|
.endif
|
||||||
b 99f
|
b 99f
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ static uint8_t get_shear_params_valid(AV1DecContext *s, int idx)
|
||||||
int16_t alpha, beta, gamma, delta, divf, divs;
|
int16_t alpha, beta, gamma, delta, divf, divs;
|
||||||
int64_t v, w;
|
int64_t v, w;
|
||||||
int32_t *param = &s->cur_frame.gm_params[idx][0];
|
int32_t *param = &s->cur_frame.gm_params[idx][0];
|
||||||
if (param[2] < 0)
|
if (param[2] <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
alpha = av_clip_int16(param[2] - (1 << AV1_WARPEDMODEL_PREC_BITS));
|
alpha = av_clip_int16(param[2] - (1 << AV1_WARPEDMODEL_PREC_BITS));
|
||||||
|
|
@ -675,7 +675,7 @@ static int set_context_with_sequence(AVCodecContext *avctx,
|
||||||
avctx->color_range =
|
avctx->color_range =
|
||||||
seq->color_config.color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
|
seq->color_config.color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
|
||||||
avctx->color_primaries = seq->color_config.color_primaries;
|
avctx->color_primaries = seq->color_config.color_primaries;
|
||||||
avctx->colorspace = seq->color_config.color_primaries;
|
avctx->colorspace = seq->color_config.matrix_coefficients;
|
||||||
avctx->color_trc = seq->color_config.transfer_characteristics;
|
avctx->color_trc = seq->color_config.transfer_characteristics;
|
||||||
|
|
||||||
switch (seq->color_config.chroma_sample_position) {
|
switch (seq->color_config.chroma_sample_position) {
|
||||||
|
|
|
||||||
|
|
@ -870,7 +870,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||||
|
|
||||||
binkb_init_bundles(c);
|
binkb_init_bundles(c);
|
||||||
ref_start = frame->data[plane_idx];
|
ref_start = frame->data[plane_idx];
|
||||||
ref_end = frame->data[plane_idx] + (bh * frame->linesize[plane_idx] + bw) * 8;
|
ref_end = frame->data[plane_idx] + ((bh - 1) * frame->linesize[plane_idx] + bw - 1) * 8;
|
||||||
|
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
||||||
coordmap[i] = (i & 7) + (i >> 3) * stride;
|
coordmap[i] = (i & 7) + (i >> 3) * stride;
|
||||||
|
|
@ -926,7 +926,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||||
ref = dst + xoff + yoff * stride;
|
ref = dst + xoff + yoff * stride;
|
||||||
if (ref < ref_start || ref + 8*stride > ref_end) {
|
if (ref < ref_start || ref > ref_end) {
|
||||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||||
c->put_pixels_tab(dst, ref, stride, 8);
|
c->put_pixels_tab(dst, ref, stride, 8);
|
||||||
|
|
@ -942,7 +942,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||||
ref = dst + xoff + yoff * stride;
|
ref = dst + xoff + yoff * stride;
|
||||||
if (ref < ref_start || ref + 8 * stride > ref_end) {
|
if (ref < ref_start || ref > ref_end) {
|
||||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||||
c->put_pixels_tab(dst, ref, stride, 8);
|
c->put_pixels_tab(dst, ref, stride, 8);
|
||||||
|
|
@ -974,7 +974,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||||
ref = dst + xoff + yoff * stride;
|
ref = dst + xoff + yoff * stride;
|
||||||
if (ref < ref_start || ref + 8 * stride > ref_end) {
|
if (ref < ref_start || ref > ref_end) {
|
||||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||||
c->put_pixels_tab(dst, ref, stride, 8);
|
c->put_pixels_tab(dst, ref, stride, 8);
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,7 @@ static int intlist_read(BonkContext *s, int *buf, int entries, int base_2_part)
|
||||||
int n_zeros = 0, step = 256, dominant = 0;
|
int n_zeros = 0, step = 256, dominant = 0;
|
||||||
int pos = 0, level = 0;
|
int pos = 0, level = 0;
|
||||||
BitCount *bits = s->bits;
|
BitCount *bits = s->bits;
|
||||||
|
int passes = 1;
|
||||||
|
|
||||||
memset(buf, 0, entries * sizeof(*buf));
|
memset(buf, 0, entries * sizeof(*buf));
|
||||||
if (base_2_part) {
|
if (base_2_part) {
|
||||||
|
|
@ -216,24 +217,28 @@ static int intlist_read(BonkContext *s, int *buf, int entries, int base_2_part)
|
||||||
x = 0;
|
x = 0;
|
||||||
n_zeros = 0;
|
n_zeros = 0;
|
||||||
for (i = 0; n_zeros < entries; i++) {
|
for (i = 0; n_zeros < entries; i++) {
|
||||||
|
if (x >= max_x)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (pos >= entries) {
|
if (pos >= entries) {
|
||||||
pos = 0;
|
pos = 0;
|
||||||
level += 1 << low_bits;
|
level += passes << low_bits;
|
||||||
|
passes = 1;
|
||||||
|
if (bits[x].bit && bits[x].count > entries - n_zeros)
|
||||||
|
passes = bits[x].count / (entries - n_zeros);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level > 1 << 16)
|
if (level > 1 << 16)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (x >= max_x)
|
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
|
|
||||||
if (buf[pos] >= level) {
|
if (buf[pos] >= level) {
|
||||||
if (bits[x].bit)
|
if (bits[x].bit)
|
||||||
buf[pos] += 1 << low_bits;
|
buf[pos] += passes << low_bits;
|
||||||
else
|
else
|
||||||
n_zeros++;
|
n_zeros++;
|
||||||
|
|
||||||
bits[x].count--;
|
av_assert1(bits[x].count >= passes);
|
||||||
|
bits[x].count -= passes;
|
||||||
x += bits[x].count == 0;
|
x += bits[x].count == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,14 +270,14 @@ static inline int shift(int a, int b)
|
||||||
|
|
||||||
static int predictor_calc_error(int *k, int *state, int order, int error)
|
static int predictor_calc_error(int *k, int *state, int order, int error)
|
||||||
{
|
{
|
||||||
int i, x = error - shift_down(k[order-1] * state[order-1], LATTICE_SHIFT);
|
int i, x = error - (unsigned)shift_down(k[order-1] * (unsigned)state[order-1], LATTICE_SHIFT);
|
||||||
int *k_ptr = &(k[order-2]),
|
int *k_ptr = &(k[order-2]),
|
||||||
*state_ptr = &(state[order-2]);
|
*state_ptr = &(state[order-2]);
|
||||||
|
|
||||||
for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--) {
|
for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--) {
|
||||||
unsigned k_value = *k_ptr, state_value = *state_ptr;
|
unsigned k_value = *k_ptr, state_value = *state_ptr;
|
||||||
|
|
||||||
x -= shift_down(k_value * state_value, LATTICE_SHIFT);
|
x -= (unsigned) shift_down(k_value * (unsigned)state_value, LATTICE_SHIFT);
|
||||||
state_ptr[1] = state_value + shift_down(k_value * x, LATTICE_SHIFT);
|
state_ptr[1] = state_value + shift_down(k_value * x, LATTICE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ int64_t ff_dot_product(const int16_t *a, const int16_t *b, int length);
|
||||||
*
|
*
|
||||||
* @return value << offset, if offset>=0; value >> -offset - otherwise
|
* @return value << offset, if offset>=0; value >> -offset - otherwise
|
||||||
*/
|
*/
|
||||||
static inline int bidir_sal(int value, int offset)
|
static inline unsigned bidir_sal(unsigned value, int offset)
|
||||||
{
|
{
|
||||||
if(offset < 0) return value >> -offset;
|
if(offset < 0) return value >> -offset;
|
||||||
else return value << offset;
|
else return value << offset;
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
CamStudioContext *c = avctx->priv_data;
|
CamStudioContext *c = avctx->priv_data;
|
||||||
int ret;
|
int ret;
|
||||||
|
int bpp = avctx->bits_per_coded_sample / 8;
|
||||||
|
int bugdelta = FFALIGN(avctx->width * bpp, 4) * avctx->height
|
||||||
|
- (avctx->width & ~3) * bpp * avctx->height;
|
||||||
|
|
||||||
if (buf_size < 2) {
|
if (buf_size < 2) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
|
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
|
||||||
|
|
@ -83,7 +86,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||||
switch ((buf[0] >> 1) & 7) {
|
switch ((buf[0] >> 1) & 7) {
|
||||||
case 0: { // lzo compression
|
case 0: { // lzo compression
|
||||||
int outlen = c->decomp_size, inlen = buf_size - 2;
|
int outlen = c->decomp_size, inlen = buf_size - 2;
|
||||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || outlen) {
|
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || (outlen && outlen != bugdelta)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +95,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||||
case 1: { // zlib compression
|
case 1: { // zlib compression
|
||||||
#if CONFIG_ZLIB
|
#if CONFIG_ZLIB
|
||||||
unsigned long dlen = c->decomp_size;
|
unsigned long dlen = c->decomp_size;
|
||||||
if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK || dlen != c->decomp_size) {
|
if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK || (dlen != c->decomp_size && dlen != c->decomp_size - bugdelta)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
|
av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ static int extract_packet_props(AVCodecInternal *avci, const AVPacket *pkt)
|
||||||
if (pkt) {
|
if (pkt) {
|
||||||
ret = av_packet_copy_props(avci->last_pkt_props, pkt);
|
ret = av_packet_copy_props(avci->last_pkt_props, pkt);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
avci->last_pkt_props->opaque = (void *)(intptr_t)pkt->size; // Needed for ff_decode_frame_props().
|
avci->last_pkt_props->stream_index = pkt->size; // Needed for ff_decode_frame_props().
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -461,7 +461,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
pkt->dts = AV_NOPTS_VALUE;
|
pkt->dts = AV_NOPTS_VALUE;
|
||||||
if (!(codec->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) {
|
if (!(codec->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) {
|
||||||
// See extract_packet_props() comment.
|
// See extract_packet_props() comment.
|
||||||
avci->last_pkt_props->opaque = (void *)((intptr_t)avci->last_pkt_props->opaque - consumed);
|
avci->last_pkt_props->stream_index = avci->last_pkt_props->stream_index - consumed;
|
||||||
avci->last_pkt_props->pts = AV_NOPTS_VALUE;
|
avci->last_pkt_props->pts = AV_NOPTS_VALUE;
|
||||||
avci->last_pkt_props->dts = AV_NOPTS_VALUE;
|
avci->last_pkt_props->dts = AV_NOPTS_VALUE;
|
||||||
}
|
}
|
||||||
|
|
@ -1355,7 +1355,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
|
||||||
int ret = ff_decode_frame_props_from_pkt(avctx, frame, pkt);
|
int ret = ff_decode_frame_props_from_pkt(avctx, frame, pkt);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
frame->pkt_size = (int)(intptr_t)pkt->opaque;
|
frame->pkt_size = pkt->stream_index;
|
||||||
}
|
}
|
||||||
#if FF_API_REORDERED_OPAQUE
|
#if FF_API_REORDERED_OPAQUE
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ static inline uint64_t get_ue_coef(GetBitContext *gb, const AVDOVIRpuDataHeader
|
||||||
|
|
||||||
case RPU_COEFF_FLOAT:
|
case RPU_COEFF_FLOAT:
|
||||||
fpart.u32 = get_bits_long(gb, 32);
|
fpart.u32 = get_bits_long(gb, 32);
|
||||||
return fpart.f32 * (1 << hdr->coef_log2_denom);
|
return fpart.f32 * (1LL << hdr->coef_log2_denom);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; /* unreachable */
|
return 0; /* unreachable */
|
||||||
|
|
@ -176,7 +176,7 @@ static inline int64_t get_se_coef(GetBitContext *gb, const AVDOVIRpuDataHeader *
|
||||||
|
|
||||||
case RPU_COEFF_FLOAT:
|
case RPU_COEFF_FLOAT:
|
||||||
fpart.u32 = get_bits_long(gb, 32);
|
fpart.u32 = get_bits_long(gb, 32);
|
||||||
return fpart.f32 * (1 << hdr->coef_log2_denom);
|
return fpart.f32 * (1LL << hdr->coef_log2_denom);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; /* unreachable */
|
return 0; /* unreachable */
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
if (n & 0x80)
|
if (n & 0x80)
|
||||||
s->sample[idx] = sign_extend((n & 0x7f) << 9, 16);
|
s->sample[idx] = sign_extend((n & 0x7f) << 9, 16);
|
||||||
else
|
else
|
||||||
s->sample[idx] += s->scale * wady_table[n & 0x7f];
|
s->sample[idx] += s->scale * (unsigned)wady_table[n & 0x7f];
|
||||||
*output_samples++ = av_clip_int16(s->sample[idx]);
|
*output_samples++ = av_clip_int16(s->sample[idx]);
|
||||||
idx ^= stereo;
|
idx ^= stereo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,8 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
|
||||||
x2 = vrect.x + vrect.w - 1;
|
x2 = vrect.x + vrect.w - 1;
|
||||||
y2 = vrect.y + vrect.h - 1;
|
y2 = vrect.y + vrect.h - 1;
|
||||||
|
|
||||||
if (x2 > avctx->width || y2 > avctx->height) {
|
if ((avctx->width > 0 && x2 > avctx->width) ||
|
||||||
|
(avctx->height > 0 && y2 > avctx->height)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "canvas_size(%d:%d) is too small(%d:%d) for render\n",
|
av_log(avctx, AV_LOG_ERROR, "canvas_size(%d:%d) is too small(%d:%d) for render\n",
|
||||||
avctx->width, avctx->height, x2, y2);
|
avctx->width, avctx->height, x2, y2);
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,9 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
|
||||||
ff_fdctdsp_init(&fdsp, avctx);
|
ff_fdctdsp_init(&fdsp, avctx);
|
||||||
ff_me_cmp_init(&mecc, avctx);
|
ff_me_cmp_init(&mecc, avctx);
|
||||||
ff_pixblockdsp_init(&pdsp, avctx);
|
ff_pixblockdsp_init(&pdsp, avctx);
|
||||||
ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp);
|
ret = ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp);
|
||||||
|
if (ret < 0)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
s->get_pixels = pdsp.get_pixels;
|
s->get_pixels = pdsp.get_pixels;
|
||||||
s->ildct_cmp = mecc.ildct_cmp[5];
|
s->ildct_cmp = mecc.ildct_cmp[5];
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,6 @@ static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth,
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
CodeBook cb = { 0 };
|
CodeBook cb = { 0 };
|
||||||
|
|
||||||
if (size >= INT_MAX / 34 || get_bits_left(gb) < size * 34)
|
|
||||||
return cb;
|
|
||||||
|
|
||||||
if (size >= INT_MAX / sizeof(MacroBlock))
|
|
||||||
return cb;
|
|
||||||
cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1);
|
cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1);
|
||||||
if (!cb.blocks)
|
if (!cb.blocks)
|
||||||
return cb;
|
return cb;
|
||||||
|
|
@ -163,7 +158,7 @@ static MacroBlock decode_macroblock(Escape124Context* s, GetBitContext* gb,
|
||||||
|
|
||||||
// This condition can occur with invalid bitstreams and
|
// This condition can occur with invalid bitstreams and
|
||||||
// *codebook_index == 2
|
// *codebook_index == 2
|
||||||
if (block_index >= s->codebooks[*codebook_index].size)
|
if (block_index >= s->codebooks[*codebook_index].size || !s->codebooks[*codebook_index].blocks)
|
||||||
return (MacroBlock) { { 0 } };
|
return (MacroBlock) { { 0 } };
|
||||||
|
|
||||||
return s->codebooks[*codebook_index].blocks[block_index];
|
return s->codebooks[*codebook_index].blocks[block_index];
|
||||||
|
|
@ -225,7 +220,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
// represent a lower bound of the space needed for skipped superblocks. Non
|
// represent a lower bound of the space needed for skipped superblocks. Non
|
||||||
// skipped SBs need more space.
|
// skipped SBs need more space.
|
||||||
if (get_bits_left(&gb) < 64 + s->num_superblocks * 23LL / 4320)
|
if (get_bits_left(&gb) < 64 + s->num_superblocks * 23LL / 4320)
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
frame_flags = get_bits_long(&gb, 32);
|
frame_flags = get_bits_long(&gb, 32);
|
||||||
frame_size = get_bits_long(&gb, 32);
|
frame_size = get_bits_long(&gb, 32);
|
||||||
|
|
@ -242,7 +237,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
if ((ret = av_frame_ref(frame, s->frame)) < 0)
|
if ((ret = av_frame_ref(frame, s->frame)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return frame_size;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
|
|
@ -276,9 +271,14 @@ static int escape124_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
av_freep(&s->codebooks[i].blocks);
|
av_freep(&s->codebooks[i].blocks);
|
||||||
|
if (cb_size >= INT_MAX / 34 || get_bits_left(&gb) < (int)cb_size * 34)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
|
if (cb_size >= INT_MAX / sizeof(MacroBlock))
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->codebooks[i] = unpack_codebook(&gb, cb_depth, cb_size);
|
s->codebooks[i] = unpack_codebook(&gb, cb_depth, cb_size);
|
||||||
if (!s->codebooks[i].blocks)
|
if (!s->codebooks[i].blocks)
|
||||||
return -1;
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,7 +371,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
|
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
|
|
||||||
return frame_size;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,10 @@ static int huf_unpack_enc_table(GetByteContext *gb,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (; im <= iM; im++) {
|
for (; im <= iM; im++) {
|
||||||
uint64_t l = freq[im] = get_bits(&gbit, 6);
|
int l;
|
||||||
|
if (get_bits_left(&gbit) < 6)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
l = freq[im] = get_bits(&gbit, 6);
|
||||||
|
|
||||||
if (l == LONG_ZEROCODE_RUN) {
|
if (l == LONG_ZEROCODE_RUN) {
|
||||||
int zerun = get_bits(&gbit, 8) + SHORTEST_LONG_RUN;
|
int zerun = get_bits(&gbit, 8) + SHORTEST_LONG_RUN;
|
||||||
|
|
@ -1930,8 +1933,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||||
|
|
||||||
bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, var_size));
|
bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, var_size));
|
||||||
if (strncmp("scanlineimage", key, var_size) &&
|
if (strncmp("scanlineimage", key, var_size) &&
|
||||||
strncmp("tiledimage", key, var_size))
|
strncmp("tiledimage", key, var_size)) {
|
||||||
return AVERROR_PATCHWELCOME;
|
ret = AVERROR_PATCHWELCOME;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else if ((var_size = check_header_variable(s, "preview",
|
} else if ((var_size = check_header_variable(s, "preview",
|
||||||
|
|
@ -1939,12 +1944,16 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||||
uint32_t pw = bytestream2_get_le32(gb);
|
uint32_t pw = bytestream2_get_le32(gb);
|
||||||
uint32_t ph = bytestream2_get_le32(gb);
|
uint32_t ph = bytestream2_get_le32(gb);
|
||||||
uint64_t psize = pw * ph;
|
uint64_t psize = pw * ph;
|
||||||
if (psize > INT64_MAX / 4)
|
if (psize > INT64_MAX / 4) {
|
||||||
return AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
psize *= 4;
|
psize *= 4;
|
||||||
|
|
||||||
if ((int64_t)psize >= bytestream2_get_bytes_left(gb))
|
if ((int64_t)psize >= bytestream2_get_bytes_left(gb)) {
|
||||||
return AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
bytestream2_skip(gb, psize);
|
bytestream2_skip(gb, psize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -475,6 +475,11 @@ static int read_extra_header(FFV1Context *f)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (f->num_h_slices > MAX_SLICES / f->num_v_slices) {
|
||||||
|
av_log(f->avctx, AV_LOG_ERROR, "slice count unsupported\n");
|
||||||
|
return AVERROR_PATCHWELCOME;
|
||||||
|
}
|
||||||
|
|
||||||
f->quant_table_count = get_symbol(c, state, 0);
|
f->quant_table_count = get_symbol(c, state, 0);
|
||||||
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
|
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
|
||||||
av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
|
av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
|
||||||
|
|
|
||||||
|
|
@ -366,19 +366,19 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
|
||||||
break; \
|
break; \
|
||||||
case 1: \
|
case 1: \
|
||||||
for (int i = pred_order; i < blocksize; i++) \
|
for (int i = pred_order; i < blocksize; i++) \
|
||||||
decoded[i] = (int64_t)residual[i] + (int64_t)decoded[i-1];\
|
decoded[i] = (uint64_t)residual[i] + (uint64_t)decoded[i-1];\
|
||||||
break; \
|
break; \
|
||||||
case 2: \
|
case 2: \
|
||||||
for (int i = pred_order; i < blocksize; i++) \
|
for (int i = pred_order; i < blocksize; i++) \
|
||||||
decoded[i] = (int64_t)residual[i] + 2*(int64_t)decoded[i-1] - (int64_t)decoded[i-2]; \
|
decoded[i] = (uint64_t)residual[i] + 2*(uint64_t)decoded[i-1] - (uint64_t)decoded[i-2]; \
|
||||||
break; \
|
break; \
|
||||||
case 3: \
|
case 3: \
|
||||||
for (int i = pred_order; i < blocksize; i++) \
|
for (int i = pred_order; i < blocksize; i++) \
|
||||||
decoded[i] = (int64_t)residual[i] + 3*(int64_t)decoded[i-1] - 3*(int64_t)decoded[i-2] + (int64_t)decoded[i-3]; \
|
decoded[i] = (uint64_t)residual[i] + 3*(uint64_t)decoded[i-1] - 3*(uint64_t)decoded[i-2] + (uint64_t)decoded[i-3]; \
|
||||||
break; \
|
break; \
|
||||||
case 4: \
|
case 4: \
|
||||||
for (int i = pred_order; i < blocksize; i++) \
|
for (int i = pred_order; i < blocksize; i++) \
|
||||||
decoded[i] = (int64_t)residual[i] + 4*(int64_t)decoded[i-1] - 6*(int64_t)decoded[i-2] + 4*(int64_t)decoded[i-3] - (int64_t)decoded[i-4]; \
|
decoded[i] = (uint64_t)residual[i] + 4*(uint64_t)decoded[i-1] - 6*(uint64_t)decoded[i-2] + 4*(uint64_t)decoded[i-3] - (uint64_t)decoded[i-4]; \
|
||||||
break; \
|
break; \
|
||||||
default: \
|
default: \
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order); \
|
av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order); \
|
||||||
|
|
@ -513,7 +513,7 @@ static int decode_subframe_lpc_33bps(FLACContext *s, int64_t *decoded,
|
||||||
for (i = pred_order; i < s->blocksize; i++, decoded++) {
|
for (i = pred_order; i < s->blocksize; i++, decoded++) {
|
||||||
int64_t sum = 0;
|
int64_t sum = 0;
|
||||||
for (j = 0; j < pred_order; j++)
|
for (j = 0; j < pred_order; j++)
|
||||||
sum += (int64_t)coeffs[j] * decoded[j];
|
sum += (int64_t)coeffs[j] * (uint64_t)decoded[j];
|
||||||
decoded[j] = residual[i] + (sum >> qlevel);
|
decoded[j] = residual[i] + (sum >> qlevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -706,10 +706,10 @@ static void decorrelate_33bps(int ch_mode, int32_t **decoded, int64_t *decoded_3
|
||||||
int i;
|
int i;
|
||||||
if (ch_mode == FLAC_CHMODE_LEFT_SIDE ) {
|
if (ch_mode == FLAC_CHMODE_LEFT_SIDE ) {
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
decoded[1][i] = decoded[0][i] - decoded_33bps[i];
|
decoded[1][i] = decoded[0][i] - (uint64_t)decoded_33bps[i];
|
||||||
} else if (ch_mode == FLAC_CHMODE_RIGHT_SIDE ) {
|
} else if (ch_mode == FLAC_CHMODE_RIGHT_SIDE ) {
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
decoded[0][i] = decoded[1][i] + decoded_33bps[i];
|
decoded[0][i] = decoded[1][i] + (uint64_t)decoded_33bps[i];
|
||||||
} else if (ch_mode == FLAC_CHMODE_MID_SIDE ) {
|
} else if (ch_mode == FLAC_CHMODE_MID_SIDE ) {
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
uint64_t a = decoded[0][i];
|
uint64_t a = decoded[0][i];
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,8 @@ typedef struct G2MContext {
|
||||||
int got_header;
|
int got_header;
|
||||||
|
|
||||||
uint8_t *framebuf;
|
uint8_t *framebuf;
|
||||||
int framebuf_stride, old_width, old_height;
|
int framebuf_stride;
|
||||||
|
unsigned int framebuf_allocated;
|
||||||
|
|
||||||
uint8_t *synth_tile, *jpeg_tile, *epic_buf, *epic_buf_base;
|
uint8_t *synth_tile, *jpeg_tile, *epic_buf, *epic_buf_base;
|
||||||
int tile_stride, epic_buf_stride, old_tile_w, old_tile_h;
|
int tile_stride, epic_buf_stride, old_tile_w, old_tile_h;
|
||||||
|
|
@ -1160,14 +1161,13 @@ static int g2m_init_buffers(G2MContext *c)
|
||||||
{
|
{
|
||||||
int aligned_height;
|
int aligned_height;
|
||||||
|
|
||||||
if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) {
|
c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
|
||||||
c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
|
aligned_height = c->height + 15;
|
||||||
aligned_height = c->height + 15;
|
|
||||||
av_free(c->framebuf);
|
av_fast_mallocz(&c->framebuf, &c->framebuf_allocated, c->framebuf_stride * aligned_height);
|
||||||
c->framebuf = av_calloc(c->framebuf_stride, aligned_height);
|
if (!c->framebuf)
|
||||||
if (!c->framebuf)
|
return AVERROR(ENOMEM);
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
|
||||||
if (!c->synth_tile || !c->jpeg_tile ||
|
if (!c->synth_tile || !c->jpeg_tile ||
|
||||||
(c->compression == 2 && !c->epic_buf_base) ||
|
(c->compression == 2 && !c->epic_buf_base) ||
|
||||||
c->old_tile_w < c->tile_width ||
|
c->old_tile_w < c->tile_width ||
|
||||||
|
|
@ -1617,6 +1617,7 @@ static av_cold int g2m_decode_end(AVCodecContext *avctx)
|
||||||
av_freep(&c->jpeg_tile);
|
av_freep(&c->jpeg_tile);
|
||||||
av_freep(&c->cursor);
|
av_freep(&c->cursor);
|
||||||
av_freep(&c->framebuf);
|
av_freep(&c->framebuf);
|
||||||
|
c->framebuf_allocated = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int pitch_delay_int,
|
||||||
if (tmp > 0)
|
if (tmp > 0)
|
||||||
L_temp0 >>= tmp;
|
L_temp0 >>= tmp;
|
||||||
else
|
else
|
||||||
L_temp1 >>= -tmp;
|
L_temp1 >>= FFMIN(-tmp, 31);
|
||||||
|
|
||||||
/* Check if longer filter increases the values of R'(k). */
|
/* Check if longer filter increases the values of R'(k). */
|
||||||
if (L_temp1 > L_temp0) {
|
if (L_temp1 > L_temp0) {
|
||||||
|
|
@ -581,7 +581,7 @@ void ff_g729_postfilter(AudioDSPContext *adsp, int16_t* ht_prev_data, int* voici
|
||||||
int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *speech,
|
int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *speech,
|
||||||
int subframe_size, int16_t gain_prev)
|
int subframe_size, int16_t gain_prev)
|
||||||
{
|
{
|
||||||
int gain; // (3.12)
|
unsigned gain; // (3.12)
|
||||||
int n;
|
int n;
|
||||||
int exp_before, exp_after;
|
int exp_before, exp_after;
|
||||||
|
|
||||||
|
|
@ -603,7 +603,7 @@ int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *
|
||||||
gain = ((gain_before - gain_after) << 14) / gain_after + 0x4000;
|
gain = ((gain_before - gain_after) << 14) / gain_after + 0x4000;
|
||||||
gain = bidir_sal(gain, exp_after - exp_before);
|
gain = bidir_sal(gain, exp_after - exp_before);
|
||||||
}
|
}
|
||||||
gain = av_clip_int16(gain);
|
gain = FFMIN(gain, 32767);
|
||||||
gain = (gain * G729_AGC_FAC1 + 0x4000) >> 15; // gain * (1-0.9875)
|
gain = (gain * G729_AGC_FAC1 + 0x4000) >> 15; // gain * (1-0.9875)
|
||||||
} else
|
} else
|
||||||
gain = 0;
|
gain = 0;
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ static int decode_slice(MpegEncContext *s)
|
||||||
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
|
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
|
||||||
s->mb_x, s->mb_y, ER_MB_ERROR & part_mask);
|
s->mb_x, s->mb_y, ER_MB_ERROR & part_mask);
|
||||||
|
|
||||||
if (s->avctx->err_recognition & AV_EF_IGNORE_ERR)
|
if ((s->avctx->err_recognition & AV_EF_IGNORE_ERR) && get_bits_left(&s->gb) > 0)
|
||||||
continue;
|
continue;
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ static inline int get_nalsize(int nal_length_size, const uint8_t *buf,
|
||||||
|
|
||||||
if (*buf_index >= buf_size - nal_length_size) {
|
if (*buf_index >= buf_size - nal_length_size) {
|
||||||
// the end of the buffer is reached, refill it
|
// the end of the buffer is reached, refill it
|
||||||
return AVERROR(EAGAIN);
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nal_length_size; i++)
|
for (i = 0; i < nal_length_size; i++)
|
||||||
|
|
|
||||||
|
|
@ -646,10 +646,10 @@ static int h264_parse(AVCodecParserContext *s,
|
||||||
int64_t num = time_base.num * (int64_t)avctx->pkt_timebase.den;
|
int64_t num = time_base.num * (int64_t)avctx->pkt_timebase.den;
|
||||||
if (s->dts != AV_NOPTS_VALUE) {
|
if (s->dts != AV_NOPTS_VALUE) {
|
||||||
// got DTS from the stream, update reference timestamp
|
// got DTS from the stream, update reference timestamp
|
||||||
p->reference_dts = s->dts - av_rescale(s->dts_ref_dts_delta, num, den);
|
p->reference_dts = av_sat_sub64(s->dts, av_rescale(s->dts_ref_dts_delta, num, den));
|
||||||
} else if (p->reference_dts != AV_NOPTS_VALUE) {
|
} else if (p->reference_dts != AV_NOPTS_VALUE) {
|
||||||
// compute DTS based on reference timestamp
|
// compute DTS based on reference timestamp
|
||||||
s->dts = p->reference_dts + av_rescale(s->dts_ref_dts_delta, num, den);
|
s->dts = av_sat_add64(p->reference_dts, av_rescale(s->dts_ref_dts_delta, num, den));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->reference_dts != AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE)
|
if (p->reference_dts != AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE)
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||||
float scale = 1.f / 8.f;
|
float scale = 1.f / 8.f;
|
||||||
unsigned b, chunk;
|
unsigned b, chunk;
|
||||||
int version, ret;
|
int version, ret;
|
||||||
|
unsigned hfr_group_count;
|
||||||
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||||
c->crc_table = av_crc_get_table(AV_CRC_16_ANSI);
|
c->crc_table = av_crc_get_table(AV_CRC_16_ANSI);
|
||||||
|
|
@ -229,11 +230,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||||
if (c->total_band_count < c->base_band_count)
|
if (c->total_band_count < c->base_band_count)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
c->hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + c->stereo_band_count),
|
hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + c->stereo_band_count),
|
||||||
c->bands_per_hfr_group);
|
c->bands_per_hfr_group);
|
||||||
|
|
||||||
if (c->base_band_count + c->stereo_band_count + (unsigned long)c->hfr_group_count > 128ULL)
|
if (c->base_band_count + c->stereo_band_count + (uint64_t)hfr_group_count > 128ULL)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
c->hfr_group_count = hfr_group_count;
|
||||||
|
|
||||||
for (int i = 0; i < avctx->ch_layout.nb_channels; i++) {
|
for (int i = 0; i < avctx->ch_layout.nb_channels; i++) {
|
||||||
c->ch[i].chan_type = r[i];
|
c->ch[i].chan_type = r[i];
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal,
|
||||||
den = ps->sps->vui.vui_time_scale;
|
den = ps->sps->vui.vui_time_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num != 0 && den != 0)
|
if (num > 0 && den > 0)
|
||||||
av_reduce(&avctx->framerate.den, &avctx->framerate.num,
|
av_reduce(&avctx->framerate.den, &avctx->framerate.num,
|
||||||
num, den, 1 << 30);
|
num, den, 1 << 30);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,7 @@ static void export_stream_params(HEVCContext *s, const HEVCSPS *sps)
|
||||||
den = sps->vui.vui_time_scale;
|
den = sps->vui.vui_time_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num != 0 && den != 0)
|
if (num > 0 && den > 0)
|
||||||
av_reduce(&avctx->framerate.den, &avctx->framerate.num,
|
av_reduce(&avctx->framerate.den, &avctx->framerate.num,
|
||||||
num, den, 1 << 30);
|
num, den, 1 << 30);
|
||||||
}
|
}
|
||||||
|
|
@ -1523,7 +1523,8 @@ static void luma_mc_uni(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride,
|
||||||
|
|
||||||
if (x_off < QPEL_EXTRA_BEFORE || y_off < QPEL_EXTRA_AFTER ||
|
if (x_off < QPEL_EXTRA_BEFORE || y_off < QPEL_EXTRA_AFTER ||
|
||||||
x_off >= pic_width - block_w - QPEL_EXTRA_AFTER ||
|
x_off >= pic_width - block_w - QPEL_EXTRA_AFTER ||
|
||||||
y_off >= pic_height - block_h - QPEL_EXTRA_AFTER) {
|
y_off >= pic_height - block_h - QPEL_EXTRA_AFTER ||
|
||||||
|
ref == s->frame) {
|
||||||
const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift;
|
const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift;
|
||||||
int offset = QPEL_EXTRA_BEFORE * srcstride + (QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
|
int offset = QPEL_EXTRA_BEFORE * srcstride + (QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
|
||||||
int buf_offset = QPEL_EXTRA_BEFORE * edge_emu_stride + (QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
|
int buf_offset = QPEL_EXTRA_BEFORE * edge_emu_stride + (QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
|
||||||
|
|
@ -1673,6 +1674,7 @@ static void chroma_mc_uni(HEVCLocalContext *lc, uint8_t *dst0,
|
||||||
intptr_t my = av_mod_uintp2(mv->y, 2 + vshift);
|
intptr_t my = av_mod_uintp2(mv->y, 2 + vshift);
|
||||||
intptr_t _mx = mx << (1 - hshift);
|
intptr_t _mx = mx << (1 - hshift);
|
||||||
intptr_t _my = my << (1 - vshift);
|
intptr_t _my = my << (1 - vshift);
|
||||||
|
int emu = src0 == s->frame->data[1] || src0 == s->frame->data[2];
|
||||||
|
|
||||||
x_off += mv->x >> (2 + hshift);
|
x_off += mv->x >> (2 + hshift);
|
||||||
y_off += mv->y >> (2 + vshift);
|
y_off += mv->y >> (2 + vshift);
|
||||||
|
|
@ -1680,7 +1682,8 @@ static void chroma_mc_uni(HEVCLocalContext *lc, uint8_t *dst0,
|
||||||
|
|
||||||
if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER ||
|
if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER ||
|
||||||
x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||
|
x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||
|
||||||
y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) {
|
y_off >= pic_height - block_h - EPEL_EXTRA_AFTER ||
|
||||||
|
emu) {
|
||||||
const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift;
|
const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift;
|
||||||
int offset0 = EPEL_EXTRA_BEFORE * (srcstride + (1 << s->ps.sps->pixel_shift));
|
int offset0 = EPEL_EXTRA_BEFORE * (srcstride + (1 << s->ps.sps->pixel_shift));
|
||||||
int buf_offset0 = EPEL_EXTRA_BEFORE *
|
int buf_offset0 = EPEL_EXTRA_BEFORE *
|
||||||
|
|
@ -1920,13 +1923,13 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0,
|
||||||
|
|
||||||
if (current_mv.pred_flag & PF_L0) {
|
if (current_mv.pred_flag & PF_L0) {
|
||||||
ref0 = refPicList[0].ref[current_mv.ref_idx[0]];
|
ref0 = refPicList[0].ref[current_mv.ref_idx[0]];
|
||||||
if (!ref0)
|
if (!ref0 || !ref0->frame->data[0])
|
||||||
return;
|
return;
|
||||||
hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH);
|
hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH);
|
||||||
}
|
}
|
||||||
if (current_mv.pred_flag & PF_L1) {
|
if (current_mv.pred_flag & PF_L1) {
|
||||||
ref1 = refPicList[1].ref[current_mv.ref_idx[1]];
|
ref1 = refPicList[1].ref[current_mv.ref_idx[1]];
|
||||||
if (!ref1)
|
if (!ref1 || !ref1->frame->data[0])
|
||||||
return;
|
return;
|
||||||
hevc_await_progress(s, ref1, ¤t_mv.mv[1], y0, nPbH);
|
hevc_await_progress(s, ref1, ¤t_mv.mv[1], y0, nPbH);
|
||||||
}
|
}
|
||||||
|
|
@ -2590,6 +2593,11 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *hevc_lclist,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
hls_sao_param(lc, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size);
|
hls_sao_param(lc, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size);
|
||||||
|
|
||||||
|
s->deblock[ctb_addr_rs].beta_offset = s->sh.beta_offset;
|
||||||
|
s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset;
|
||||||
|
s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag;
|
||||||
|
|
||||||
more_data = hls_coding_quadtree(lc, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0);
|
more_data = hls_coding_quadtree(lc, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0);
|
||||||
|
|
||||||
if (more_data < 0) {
|
if (more_data < 0) {
|
||||||
|
|
|
||||||
|
|
@ -695,9 +695,9 @@ static void decode_422_bitstream(HYuvDecContext *s, int count)
|
||||||
/* TODO instead of restarting the read when the code isn't in the first level
|
/* TODO instead of restarting the read when the code isn't in the first level
|
||||||
* of the joint table, jump into the 2nd level of the individual table. */
|
* of the joint table, jump into the 2nd level of the individual table. */
|
||||||
#define READ_2PIX_PLANE16(dst0, dst1, plane){\
|
#define READ_2PIX_PLANE16(dst0, dst1, plane){\
|
||||||
dst0 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
|
dst0 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
|
||||||
dst0 += get_bits(&s->gb, 2);\
|
dst0 += get_bits(&s->gb, 2);\
|
||||||
dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
|
dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
|
||||||
dst1 += get_bits(&s->gb, 2);\
|
dst1 += get_bits(&s->gb, 2);\
|
||||||
}
|
}
|
||||||
static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane)
|
static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane)
|
||||||
|
|
@ -755,7 +755,7 @@ static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( width&1 && get_bits_left(&s->gb)>0 ) {
|
if( width&1 && get_bits_left(&s->gb)>0 ) {
|
||||||
int dst = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
|
int dst = (unsigned)get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
|
||||||
s->temp16[0][width-1] = dst + get_bits(&s->gb, 2);
|
s->temp16[0][width-1] = dst + get_bits(&s->gb, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,9 @@ static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx,
|
||||||
int luma_size, chroma_size;
|
int luma_size, chroma_size;
|
||||||
ptrdiff_t luma_pitch, chroma_pitch;
|
ptrdiff_t luma_pitch, chroma_pitch;
|
||||||
|
|
||||||
|
luma_width = FFALIGN(luma_width , 2);
|
||||||
|
luma_height = FFALIGN(luma_height, 2);
|
||||||
|
|
||||||
if (luma_width < 16 || luma_width > 640 ||
|
if (luma_width < 16 || luma_width > 640 ||
|
||||||
luma_height < 16 || luma_height > 480 ||
|
luma_height < 16 || luma_height > 480 ||
|
||||||
luma_width & 1 || luma_height & 1) {
|
luma_width & 1 || luma_height & 1) {
|
||||||
|
|
|
||||||
|
|
@ -721,11 +721,10 @@ static void encode_cblk(Jpeg2000EncoderContext *s, Jpeg2000T1Context *t1, Jpeg20
|
||||||
|
|
||||||
if (max == 0){
|
if (max == 0){
|
||||||
cblk->nonzerobits = 0;
|
cblk->nonzerobits = 0;
|
||||||
bpno = 0;
|
|
||||||
} else{
|
} else{
|
||||||
cblk->nonzerobits = av_log2(max) + 1 - NMSEDEC_FRACBITS;
|
cblk->nonzerobits = av_log2(max) + 1 - NMSEDEC_FRACBITS;
|
||||||
bpno = cblk->nonzerobits - 1;
|
|
||||||
}
|
}
|
||||||
|
bpno = cblk->nonzerobits - 1;
|
||||||
|
|
||||||
cblk->data[0] = 0;
|
cblk->data[0] = 0;
|
||||||
ff_mqc_initenc(&t1->mqc, cblk->data + 1);
|
ff_mqc_initenc(&t1->mqc, cblk->data + 1);
|
||||||
|
|
@ -1531,6 +1530,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
int tileno, ret;
|
int tileno, ret;
|
||||||
Jpeg2000EncoderContext *s = avctx->priv_data;
|
Jpeg2000EncoderContext *s = avctx->priv_data;
|
||||||
uint8_t *chunkstart, *jp2cstart, *jp2hstart;
|
uint8_t *chunkstart, *jp2cstart, *jp2hstart;
|
||||||
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||||
|
|
||||||
if ((ret = ff_alloc_packet(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE)) < 0)
|
if ((ret = ff_alloc_packet(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -1543,7 +1543,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
|
|
||||||
s->lambda = s->picture->quality * LAMBDA_SCALE;
|
s->lambda = s->picture->quality * LAMBDA_SCALE;
|
||||||
|
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_BGR48 || avctx->pix_fmt == AV_PIX_FMT_GRAY16)
|
if (s->cbps[0] > 8)
|
||||||
copy_frame_16(s);
|
copy_frame_16(s);
|
||||||
else
|
else
|
||||||
copy_frame_8(s);
|
copy_frame_8(s);
|
||||||
|
|
@ -1587,7 +1587,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
bytestream_put_byte(&s->buf, 1);
|
bytestream_put_byte(&s->buf, 1);
|
||||||
bytestream_put_byte(&s->buf, 0);
|
bytestream_put_byte(&s->buf, 0);
|
||||||
bytestream_put_byte(&s->buf, 0);
|
bytestream_put_byte(&s->buf, 0);
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_RGB24 || avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
if ((desc->flags & AV_PIX_FMT_FLAG_RGB) || avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
||||||
bytestream_put_be32(&s->buf, 16);
|
bytestream_put_be32(&s->buf, 16);
|
||||||
} else if (s->ncomponents == 1) {
|
} else if (s->ncomponents == 1) {
|
||||||
bytestream_put_be32(&s->buf, 17);
|
bytestream_put_be32(&s->buf, 17);
|
||||||
|
|
@ -1717,6 +1717,7 @@ static av_cold int j2kenc_init(AVCodecContext *avctx)
|
||||||
Jpeg2000EncoderContext *s = avctx->priv_data;
|
Jpeg2000EncoderContext *s = avctx->priv_data;
|
||||||
Jpeg2000CodingStyle *codsty = &s->codsty;
|
Jpeg2000CodingStyle *codsty = &s->codsty;
|
||||||
Jpeg2000QuantStyle *qntsty = &s->qntsty;
|
Jpeg2000QuantStyle *qntsty = &s->qntsty;
|
||||||
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||||
|
|
||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "init\n");
|
av_log(s->avctx, AV_LOG_DEBUG, "init\n");
|
||||||
|
|
@ -1729,7 +1730,7 @@ static av_cold int j2kenc_init(AVCodecContext *avctx)
|
||||||
|
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && (s->pred != FF_DWT97_INT || s->format != CODEC_JP2)) {
|
if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && (s->pred != FF_DWT97_INT || s->format != CODEC_JP2)) {
|
||||||
av_log(s->avctx, AV_LOG_WARNING, "Forcing lossless jp2 for pal8\n");
|
av_log(s->avctx, AV_LOG_WARNING, "Forcing lossless jp2 for pal8\n");
|
||||||
s->pred = FF_DWT97_INT;
|
s->pred = 1;
|
||||||
s->format = CODEC_JP2;
|
s->format = CODEC_JP2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1759,20 +1760,13 @@ static av_cold int j2kenc_init(AVCodecContext *avctx)
|
||||||
s->width = avctx->width;
|
s->width = avctx->width;
|
||||||
s->height = avctx->height;
|
s->height = avctx->height;
|
||||||
|
|
||||||
|
s->ncomponents = desc->nb_components;
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_GRAY16 || avctx->pix_fmt == AV_PIX_FMT_RGB48)
|
s->cbps[i] = desc->comp[i].depth;
|
||||||
s->cbps[i] = 16;
|
|
||||||
else
|
|
||||||
s->cbps[i] = 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_RGB24 || avctx->pix_fmt == AV_PIX_FMT_RGB48){
|
if ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && s->ncomponents > 1) {
|
||||||
s->ncomponents = 3;
|
|
||||||
} else if (avctx->pix_fmt == AV_PIX_FMT_GRAY8 || avctx->pix_fmt == AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY16){
|
|
||||||
s->ncomponents = 1;
|
|
||||||
} else{ // planar YUV
|
|
||||||
s->planar = 1;
|
s->planar = 1;
|
||||||
s->ncomponents = 3;
|
|
||||||
ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt,
|
ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt,
|
||||||
s->chroma_shift, s->chroma_shift + 1);
|
s->chroma_shift, s->chroma_shift + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
@ -1810,7 +1804,7 @@ static const AVOption options[] = {
|
||||||
{ "tile_height", "Tile Height", OFFSET(tile_height), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, 1<<30, VE, },
|
{ "tile_height", "Tile Height", OFFSET(tile_height), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, 1<<30, VE, },
|
||||||
{ "pred", "DWT Type", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "pred" },
|
{ "pred", "DWT Type", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "pred" },
|
||||||
{ "dwt97int", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" },
|
{ "dwt97int", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" },
|
||||||
{ "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" },
|
{ "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "pred" },
|
||||||
{ "sop", "SOP marker", OFFSET(sop), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, },
|
{ "sop", "SOP marker", OFFSET(sop), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, },
|
||||||
{ "eph", "EPH marker", OFFSET(eph), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, },
|
{ "eph", "EPH marker", OFFSET(eph), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, },
|
||||||
{ "prog", "Progression Order", OFFSET(prog), AV_OPT_TYPE_INT, { .i64 = 0 }, JPEG2000_PGOD_LRCP, JPEG2000_PGOD_CPRL, VE, "prog" },
|
{ "prog", "Progression Order", OFFSET(prog), AV_OPT_TYPE_INT, { .i64 = 0 }, JPEG2000_PGOD_LRCP, JPEG2000_PGOD_CPRL, VE, "prog" },
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,16 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s->image_offset_x >= s->width || s->image_offset_y >= s->height) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "image offsets outside image");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s->reduction_factor && (s->image_offset_x || s->image_offset_y) ){
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "reduction factor with image offsets is not fully implemented");
|
||||||
|
return AVERROR_PATCHWELCOME;
|
||||||
|
}
|
||||||
|
|
||||||
s->ncomponents = ncomponents;
|
s->ncomponents = ncomponents;
|
||||||
|
|
||||||
if (s->tile_width <= 0 || s->tile_height <= 0) {
|
if (s->tile_width <= 0 || s->tile_height <= 0) {
|
||||||
|
|
@ -388,7 +398,7 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||||
dimy = FFMAX(dimy, ff_jpeg2000_ceildiv(o_dimy, s->cdy[i]));
|
dimy = FFMAX(dimy, ff_jpeg2000_ceildiv(o_dimy, s->cdy[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ff_set_dimensions(s->avctx, dimx, dimy);
|
ret = ff_set_dimensions(s->avctx, dimx << s->avctx->lowres, dimy << s->avctx->lowres);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
@ -2471,6 +2481,14 @@ static av_cold int jpeg2000_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
Jpeg2000DecoderContext *s = avctx->priv_data;
|
Jpeg2000DecoderContext *s = avctx->priv_data;
|
||||||
|
|
||||||
|
if (avctx->lowres)
|
||||||
|
av_log(avctx, AV_LOG_WARNING, "lowres is overriden by reduction_factor but set anyway\n");
|
||||||
|
if (!s->reduction_factor && avctx->lowres < JPEG2000_MAX_RESLEVELS) {
|
||||||
|
s->reduction_factor = avctx->lowres;
|
||||||
|
}
|
||||||
|
if (avctx->lowres != s->reduction_factor && avctx->lowres)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
ff_jpeg2000dsp_init(&s->dsp);
|
ff_jpeg2000dsp_init(&s->dsp);
|
||||||
ff_jpeg2000_init_tier1_luts();
|
ff_jpeg2000_init_tier1_luts();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -382,6 +382,19 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
||||||
state->T3 = s->t3;
|
state->T3 = s->t3;
|
||||||
state->reset = s->reset;
|
state->reset = s->reset;
|
||||||
ff_jpegls_reset_coding_parameters(state, 0);
|
ff_jpegls_reset_coding_parameters(state, 0);
|
||||||
|
|
||||||
|
/* Testing parameters here, we cannot test in LSE or SOF because
|
||||||
|
* these interdepend and are allowed in either order
|
||||||
|
*/
|
||||||
|
if (state->maxval >= (1<<state->bpp) ||
|
||||||
|
state->T1 > state->T2 ||
|
||||||
|
state->T2 > state->T3 ||
|
||||||
|
state->T3 > state->maxval ||
|
||||||
|
state->reset > FFMAX(255, state->maxval)) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
ff_jpegls_init_state(state);
|
ff_jpegls_init_state(state);
|
||||||
|
|
||||||
if (s->bits <= 8)
|
if (s->bits <= 8)
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,8 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
|
||||||
if (expected != (unsigned int)zstream->total_out) {
|
if (expected != (unsigned int)zstream->total_out) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
|
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
|
||||||
expected, zstream->total_out);
|
expected, zstream->total_out);
|
||||||
|
if (expected > (unsigned int)zstream->total_out)
|
||||||
|
return (unsigned int)zstream->total_out;
|
||||||
return AVERROR_UNKNOWN;
|
return AVERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
return zstream->total_out;
|
return zstream->total_out;
|
||||||
|
|
@ -169,8 +171,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
int row, col;
|
int row, col;
|
||||||
unsigned char *encoded = avpkt->data, *outptr;
|
unsigned char *encoded = avpkt->data, *outptr;
|
||||||
uint8_t *y_out, *u_out, *v_out;
|
uint8_t *y_out, *u_out, *v_out;
|
||||||
unsigned int width = avctx->width; // Real image width
|
int width = avctx->width; // Real image width
|
||||||
unsigned int height = avctx->height; // Real image height
|
int height = avctx->height; // Real image height
|
||||||
unsigned int mszh_dlen;
|
unsigned int mszh_dlen;
|
||||||
unsigned char yq, y1q, uq, vq;
|
unsigned char yq, y1q, uq, vq;
|
||||||
int uqvq, ret;
|
int uqvq, ret;
|
||||||
|
|
@ -227,16 +229,19 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
break;
|
break;
|
||||||
case COMP_MSZH_NOCOMP: {
|
case COMP_MSZH_NOCOMP: {
|
||||||
int bppx2;
|
int bppx2;
|
||||||
|
int aligned_width = width;
|
||||||
switch (c->imgtype) {
|
switch (c->imgtype) {
|
||||||
case IMGTYPE_YUV111:
|
case IMGTYPE_YUV111:
|
||||||
case IMGTYPE_RGB24:
|
case IMGTYPE_RGB24:
|
||||||
bppx2 = 6;
|
bppx2 = 6;
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_YUV422:
|
case IMGTYPE_YUV422:
|
||||||
|
aligned_width &= ~3;
|
||||||
case IMGTYPE_YUV211:
|
case IMGTYPE_YUV211:
|
||||||
bppx2 = 4;
|
bppx2 = 4;
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_YUV411:
|
case IMGTYPE_YUV411:
|
||||||
|
aligned_width &= ~3;
|
||||||
case IMGTYPE_YUV420:
|
case IMGTYPE_YUV420:
|
||||||
bppx2 = 3;
|
bppx2 = 3;
|
||||||
break;
|
break;
|
||||||
|
|
@ -244,7 +249,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
bppx2 = 0; // will error out below
|
bppx2 = 0; // will error out below
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (len < ((width * height * bppx2) >> 1))
|
if (len < ((aligned_width * height * bppx2) >> 1))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -276,12 +281,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
ret = zlib_decomp(avctx, buf + 8 + mthread_inlen, len - 8 - mthread_inlen,
|
ret = zlib_decomp(avctx, buf + 8 + mthread_inlen, len - 8 - mthread_inlen,
|
||||||
mthread_outlen, mthread_outlen);
|
mthread_outlen, mthread_outlen);
|
||||||
if (ret < 0) return ret;
|
if (ret < 0) return ret;
|
||||||
|
len = c->decomp_size;
|
||||||
} else {
|
} else {
|
||||||
int ret = zlib_decomp(avctx, buf, len, 0, c->decomp_size);
|
int ret = zlib_decomp(avctx, buf, len, 0, c->decomp_size);
|
||||||
if (ret < 0) return ret;
|
if (ret < 0) return ret;
|
||||||
|
len = ret;
|
||||||
}
|
}
|
||||||
encoded = c->decomp_buf;
|
encoded = c->decomp_buf;
|
||||||
len = c->decomp_size;
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
@ -309,8 +315,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_YUV422:
|
case IMGTYPE_YUV422:
|
||||||
|
pixel_ptr = 0;
|
||||||
for (row = 0; row < height; row++) {
|
for (row = 0; row < height; row++) {
|
||||||
pixel_ptr = row * width * 2;
|
|
||||||
yq = uq = vq =0;
|
yq = uq = vq =0;
|
||||||
for (col = 0; col < width/4; col++) {
|
for (col = 0; col < width/4; col++) {
|
||||||
encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
|
encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
|
||||||
|
|
@ -326,8 +332,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_YUV411:
|
case IMGTYPE_YUV411:
|
||||||
|
pixel_ptr = 0;
|
||||||
for (row = 0; row < height; row++) {
|
for (row = 0; row < height; row++) {
|
||||||
pixel_ptr = row * width / 2 * 3;
|
|
||||||
yq = uq = vq =0;
|
yq = uq = vq =0;
|
||||||
for (col = 0; col < width/4; col++) {
|
for (col = 0; col < width/4; col++) {
|
||||||
encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
|
encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
|
||||||
|
|
@ -403,6 +409,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
v_out[ col >> 1 ] = *encoded++ + 128;
|
v_out[ col >> 1 ] = *encoded++ + 128;
|
||||||
v_out[(col >> 1) + 1] = *encoded++ + 128;
|
v_out[(col >> 1) + 1] = *encoded++ + 128;
|
||||||
}
|
}
|
||||||
|
if (col && col < width) {
|
||||||
|
u_out[ col >> 1 ] = u_out[(col>>1) - 1];
|
||||||
|
v_out[ col >> 1 ] = v_out[(col>>1) - 1];
|
||||||
|
}
|
||||||
|
|
||||||
y_out -= frame->linesize[0];
|
y_out -= frame->linesize[0];
|
||||||
u_out -= frame->linesize[1];
|
u_out -= frame->linesize[1];
|
||||||
v_out -= frame->linesize[2];
|
v_out -= frame->linesize[2];
|
||||||
|
|
@ -424,6 +435,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
u_out[col >> 2] = *encoded++ + 128;
|
u_out[col >> 2] = *encoded++ + 128;
|
||||||
v_out[col >> 2] = *encoded++ + 128;
|
v_out[col >> 2] = *encoded++ + 128;
|
||||||
}
|
}
|
||||||
|
if (col && col < width) {
|
||||||
|
u_out[col >> 2] = u_out[(col>>2) - 1];
|
||||||
|
v_out[col >> 2] = v_out[(col>>2) - 1];
|
||||||
|
}
|
||||||
y_out -= frame->linesize[0];
|
y_out -= frame->linesize[0];
|
||||||
u_out -= frame->linesize[1];
|
u_out -= frame->linesize[1];
|
||||||
v_out -= frame->linesize[2];
|
v_out -= frame->linesize[2];
|
||||||
|
|
@ -481,6 +496,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||||
FFALIGN(avctx->height, 4);
|
FFALIGN(avctx->height, 4);
|
||||||
unsigned int max_decomp_size;
|
unsigned int max_decomp_size;
|
||||||
int subsample_h, subsample_v;
|
int subsample_h, subsample_v;
|
||||||
|
int partial_h_supported = 0;
|
||||||
|
|
||||||
if (avctx->extradata_size < 8) {
|
if (avctx->extradata_size < 8) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n");
|
av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n");
|
||||||
|
|
@ -502,26 +518,24 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 1:1:1.\n");
|
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 1:1:1.\n");
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_YUV422:
|
case IMGTYPE_YUV422:
|
||||||
c->decomp_size = basesize * 2;
|
c->decomp_size = (avctx->width & ~3) * avctx->height * 2;
|
||||||
max_decomp_size = max_basesize * 2;
|
max_decomp_size = max_basesize * 2;
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
|
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
|
||||||
if (avctx->width % 4) {
|
partial_h_supported = 1;
|
||||||
avpriv_request_sample(avctx, "Unsupported dimensions");
|
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_RGB24:
|
case IMGTYPE_RGB24:
|
||||||
c->decomp_size = basesize * 3;
|
c->decomp_size = FFALIGN(avctx->width*3, 4) * avctx->height;
|
||||||
max_decomp_size = max_basesize * 3;
|
max_decomp_size = max_basesize * 3;
|
||||||
avctx->pix_fmt = AV_PIX_FMT_BGR24;
|
avctx->pix_fmt = AV_PIX_FMT_BGR24;
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");
|
av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_YUV411:
|
case IMGTYPE_YUV411:
|
||||||
c->decomp_size = basesize / 2 * 3;
|
c->decomp_size = (avctx->width & ~3) * avctx->height / 2 * 3;
|
||||||
max_decomp_size = max_basesize / 2 * 3;
|
max_decomp_size = max_basesize / 2 * 3;
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV411P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV411P;
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:1:1.\n");
|
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:1:1.\n");
|
||||||
|
partial_h_supported = 1;
|
||||||
break;
|
break;
|
||||||
case IMGTYPE_YUV211:
|
case IMGTYPE_YUV211:
|
||||||
c->decomp_size = basesize * 2;
|
c->decomp_size = basesize * 2;
|
||||||
|
|
@ -541,7 +555,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &subsample_h, &subsample_v);
|
av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &subsample_h, &subsample_v);
|
||||||
if (avctx->width % (1<<subsample_h) || avctx->height % (1<<subsample_v)) {
|
if ((avctx->width % (1<<subsample_h) && !partial_h_supported) || avctx->height % (1<<subsample_v)) {
|
||||||
avpriv_request_sample(avctx, "Unsupported dimensions");
|
avpriv_request_sample(avctx, "Unsupported dimensions");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -575,7 +575,13 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
{
|
{
|
||||||
libx265Context *ctx = avctx->priv_data;
|
libx265Context *ctx = avctx->priv_data;
|
||||||
x265_picture x265pic;
|
x265_picture x265pic;
|
||||||
x265_picture x265pic_out = { 0 };
|
#if (X265_BUILD >= 210) && (X265_BUILD < 213)
|
||||||
|
x265_picture x265pic_layers_out[MAX_SCALABLE_LAYERS];
|
||||||
|
x265_picture* x265pic_lyrptr_out[MAX_SCALABLE_LAYERS];
|
||||||
|
#else
|
||||||
|
x265_picture x265pic_solo_out = { 0 };
|
||||||
|
#endif
|
||||||
|
x265_picture* x265pic_out;
|
||||||
x265_nal *nal;
|
x265_nal *nal;
|
||||||
x265_sei *sei;
|
x265_sei *sei;
|
||||||
uint8_t *dst;
|
uint8_t *dst;
|
||||||
|
|
@ -698,8 +704,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (X265_BUILD >= 210) && (X265_BUILD < 213)
|
||||||
|
for (i = 0; i < MAX_SCALABLE_LAYERS; i++)
|
||||||
|
x265pic_lyrptr_out[i] = &x265pic_layers_out[i];
|
||||||
|
|
||||||
ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
|
ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
|
||||||
pic ? &x265pic : NULL, &x265pic_out);
|
pic ? &x265pic : NULL, x265pic_lyrptr_out);
|
||||||
|
#else
|
||||||
|
ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
|
||||||
|
pic ? &x265pic : NULL, &x265pic_solo_out);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < sei->numPayloads; i++)
|
for (i = 0; i < sei->numPayloads; i++)
|
||||||
av_free(sei->payloads[i].payload);
|
av_free(sei->payloads[i].payload);
|
||||||
|
|
@ -729,10 +743,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt->pts = x265pic_out.pts;
|
#if (X265_BUILD >= 210) && (X265_BUILD < 213)
|
||||||
pkt->dts = x265pic_out.dts;
|
x265pic_out = x265pic_lyrptr_out[0];
|
||||||
|
#else
|
||||||
|
x265pic_out = &x265pic_solo_out;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (x265pic_out.sliceType) {
|
pkt->pts = x265pic_out->pts;
|
||||||
|
pkt->dts = x265pic_out->dts;
|
||||||
|
|
||||||
|
switch (x265pic_out->sliceType) {
|
||||||
case X265_TYPE_IDR:
|
case X265_TYPE_IDR:
|
||||||
case X265_TYPE_I:
|
case X265_TYPE_I:
|
||||||
pict_type = AV_PICTURE_TYPE_I;
|
pict_type = AV_PICTURE_TYPE_I;
|
||||||
|
|
@ -750,16 +770,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
}
|
}
|
||||||
|
|
||||||
#if X265_BUILD >= 130
|
#if X265_BUILD >= 130
|
||||||
if (x265pic_out.sliceType == X265_TYPE_B)
|
if (x265pic_out->sliceType == X265_TYPE_B)
|
||||||
#else
|
#else
|
||||||
if (x265pic_out.frameData.sliceType == 'b')
|
if (x265pic_out->frameData.sliceType == 'b')
|
||||||
#endif
|
#endif
|
||||||
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
|
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
|
||||||
|
|
||||||
ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
|
ff_side_data_set_encoder_stats(pkt, x265pic_out->frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
|
||||||
|
|
||||||
if (x265pic_out.userData) {
|
if (x265pic_out->userData) {
|
||||||
int idx = (int)(intptr_t)x265pic_out.userData - 1;
|
int idx = (int)(intptr_t)x265pic_out->userData - 1;
|
||||||
ReorderedData *rd = &ctx->rd[idx];
|
ReorderedData *rd = &ctx->rd[idx];
|
||||||
|
|
||||||
#if FF_API_REORDERED_OPAQUE
|
#if FF_API_REORDERED_OPAQUE
|
||||||
|
|
|
||||||
|
|
@ -473,8 +473,9 @@ static int zero_cmp(MpegEncContext *s, const uint8_t *a, const uint8_t *b,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type)
|
int ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(cmp, 0, sizeof(void *) * 6);
|
memset(cmp, 0, sizeof(void *) * 6);
|
||||||
|
|
@ -533,9 +534,13 @@ void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type)
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
av_log(NULL, AV_LOG_ERROR,
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
"internal error in cmp function selection\n");
|
"invalid cmp function selection\n");
|
||||||
|
ret = -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BUTTERFLY2(o1, o2, i1, i2) \
|
#define BUTTERFLY2(o1, o2, i1, i2) \
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ void ff_me_cmp_init_ppc(MECmpContext *c, AVCodecContext *avctx);
|
||||||
void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx);
|
void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx);
|
||||||
void ff_me_cmp_init_mips(MECmpContext *c, AVCodecContext *avctx);
|
void ff_me_cmp_init_mips(MECmpContext *c, AVCodecContext *avctx);
|
||||||
|
|
||||||
void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type);
|
int ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type);
|
||||||
|
|
||||||
void ff_dsputil_init_dwt(MECmpContext *c);
|
void ff_dsputil_init_dwt(MECmpContext *c);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,7 @@ int ff_init_me(MpegEncContext *s){
|
||||||
MotionEstContext * const c= &s->me;
|
MotionEstContext * const c= &s->me;
|
||||||
int cache_size= FFMIN(ME_MAP_SIZE>>ME_MAP_SHIFT, 1<<ME_MAP_SHIFT);
|
int cache_size= FFMIN(ME_MAP_SIZE>>ME_MAP_SHIFT, 1<<ME_MAP_SHIFT);
|
||||||
int dia_size= FFMAX(FFABS(s->avctx->dia_size)&255, FFABS(s->avctx->pre_dia_size)&255);
|
int dia_size= FFMAX(FFABS(s->avctx->dia_size)&255, FFABS(s->avctx->pre_dia_size)&255);
|
||||||
|
int ret;
|
||||||
|
|
||||||
if(FFMIN(s->avctx->dia_size, s->avctx->pre_dia_size) < -FFMIN(ME_MAP_SIZE, MAX_SAB_SIZE)){
|
if(FFMIN(s->avctx->dia_size, s->avctx->pre_dia_size) < -FFMIN(ME_MAP_SIZE, MAX_SAB_SIZE)){
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "ME_MAP size is too small for SAB diamond\n");
|
av_log(s->avctx, AV_LOG_ERROR, "ME_MAP size is too small for SAB diamond\n");
|
||||||
|
|
@ -324,10 +325,12 @@ int ff_init_me(MpegEncContext *s){
|
||||||
av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n");
|
av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ff_set_cmp(&s->mecc, s->mecc.me_pre_cmp, c->avctx->me_pre_cmp);
|
ret = ff_set_cmp(&s->mecc, s->mecc.me_pre_cmp, c->avctx->me_pre_cmp);
|
||||||
ff_set_cmp(&s->mecc, s->mecc.me_cmp, c->avctx->me_cmp);
|
ret |= ff_set_cmp(&s->mecc, s->mecc.me_cmp, c->avctx->me_cmp);
|
||||||
ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, c->avctx->me_sub_cmp);
|
ret |= ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, c->avctx->me_sub_cmp);
|
||||||
ff_set_cmp(&s->mecc, s->mecc.mb_cmp, c->avctx->mb_cmp);
|
ret |= ff_set_cmp(&s->mecc, s->mecc.mb_cmp, c->avctx->mb_cmp);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
c->flags = get_flags(c, 0, c->avctx->me_cmp &FF_CMP_CHROMA);
|
c->flags = get_flags(c, 0, c->avctx->me_cmp &FF_CMP_CHROMA);
|
||||||
c->sub_flags= get_flags(c, 0, c->avctx->me_sub_cmp&FF_CMP_CHROMA);
|
c->sub_flags= get_flags(c, 0, c->avctx->me_sub_cmp&FF_CMP_CHROMA);
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ static YuvPixel mp_get_yuv_from_rgb(MotionPixelsContext *mp, int x, int y)
|
||||||
int color;
|
int color;
|
||||||
|
|
||||||
color = *(uint16_t *)&mp->frame->data[0][y * mp->frame->linesize[0] + x * 2];
|
color = *(uint16_t *)&mp->frame->data[0][y * mp->frame->linesize[0] + x * 2];
|
||||||
return mp_rgb_yuv_table[color];
|
return mp_rgb_yuv_table[color & 0x7FFF];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const YuvPixel *p)
|
static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const YuvPixel *p)
|
||||||
|
|
|
||||||
|
|
@ -2956,6 +2956,10 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
GetBitContext *gb = &m->gb;
|
GetBitContext *gb = &m->gb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
// Check for minimal intra MB size (considering mb header, luma & chroma dc VLC, ac EOB VLC)
|
||||||
|
if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 + 3*4 + 2*2 + 2*6))
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
ret = ff_get_buffer(avctx, frame, 0);
|
ret = ff_get_buffer(avctx, frame, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb
|
||||||
int hsub = i ? s->chroma_x_shift : 0;
|
int hsub = i ? s->chroma_x_shift : 0;
|
||||||
int lowres = s->avctx->lowres;
|
int lowres = s->avctx->lowres;
|
||||||
int step = 1 << lowres;
|
int step = 1 << lowres;
|
||||||
dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub) - 1);
|
dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub + lowres) - 1);
|
||||||
for (int h = (16 >> (vsub + lowres)) - 1; h >= 0; h--){
|
for (int h = (16 >> (vsub + lowres)) - 1; h >= 0; h--){
|
||||||
for (int w = (16 >> (hsub + lowres)) - 1, idx = 0; w >= 0; w--, idx += step)
|
for (int w = (16 >> (hsub + lowres)) - 1, idx = 0; w >= 0; w--, idx += step)
|
||||||
dest_pcm[i][w] = src[idx];
|
dest_pcm[i][w] = src[idx];
|
||||||
|
|
@ -861,7 +861,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
|
||||||
for (y = 0; y < 16; y++) {
|
for (y = 0; y < 16; y++) {
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
v = mb_v + dy * y;
|
v = mb_v + (unsigned)dy * y;
|
||||||
// FIXME optimize
|
// FIXME optimize
|
||||||
for (x = 0; x < 16; x++) {
|
for (x = 0; x < 16; x++) {
|
||||||
sum += v >> shift;
|
sum += v >> shift;
|
||||||
|
|
@ -1437,7 +1437,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
|
||||||
if (SHOW_UBITS(re, &s->gb, 1) == 0) {
|
if (SHOW_UBITS(re, &s->gb, 1) == 0) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"1. marker bit missing in 3. esc\n");
|
"1. marker bit missing in 3. esc\n");
|
||||||
if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR))
|
if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&s->gb) <= 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
SKIP_CACHE(re, &s->gb, 1);
|
SKIP_CACHE(re, &s->gb, 1);
|
||||||
|
|
@ -1448,7 +1448,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
|
||||||
if (SHOW_UBITS(re, &s->gb, 1) == 0) {
|
if (SHOW_UBITS(re, &s->gb, 1) == 0) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"2. marker bit missing in 3. esc\n");
|
"2. marker bit missing in 3. esc\n");
|
||||||
if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR))
|
if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&s->gb) <= 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -637,6 +637,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
|
||||||
const int s_mask = (2 << lowres) - 1;
|
const int s_mask = (2 << lowres) - 1;
|
||||||
const int h_edge_pos = s->h_edge_pos >> lowres;
|
const int h_edge_pos = s->h_edge_pos >> lowres;
|
||||||
const int v_edge_pos = s->v_edge_pos >> lowres;
|
const int v_edge_pos = s->v_edge_pos >> lowres;
|
||||||
|
int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h;
|
||||||
linesize = s->current_picture.f->linesize[0] << field_based;
|
linesize = s->current_picture.f->linesize[0] << field_based;
|
||||||
uvlinesize = s->current_picture.f->linesize[1] << field_based;
|
uvlinesize = s->current_picture.f->linesize[1] << field_based;
|
||||||
|
|
||||||
|
|
@ -699,7 +700,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
|
||||||
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
|
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
|
||||||
|
|
||||||
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
|
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
|
||||||
(unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
|
(unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - FFMAX(h, hc<<s->chroma_y_shift), 0)) {
|
||||||
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr_y,
|
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr_y,
|
||||||
linesize >> field_based, linesize >> field_based,
|
linesize >> field_based, linesize >> field_based,
|
||||||
17, 17 + field_based,
|
17, 17 + field_based,
|
||||||
|
|
@ -744,7 +745,6 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
|
||||||
pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
|
pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
|
||||||
|
|
||||||
if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
|
if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
|
||||||
int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h;
|
|
||||||
uvsx = (uvsx << 2) >> lowres;
|
uvsx = (uvsx << 2) >> lowres;
|
||||||
uvsy = (uvsy << 2) >> lowres;
|
uvsy = (uvsy << 2) >> lowres;
|
||||||
if (hc) {
|
if (hc) {
|
||||||
|
|
|
||||||
|
|
@ -902,8 +902,10 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||||
|
|
||||||
s->quant_precision = 5;
|
s->quant_precision = 5;
|
||||||
|
|
||||||
ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, avctx->ildct_cmp);
|
ret = ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, avctx->ildct_cmp);
|
||||||
ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->frame_skip_cmp);
|
ret |= ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->frame_skip_cmp);
|
||||||
|
if (ret < 0)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) {
|
if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) {
|
||||||
ff_h263_encode_init(s);
|
ff_h263_encode_init(s);
|
||||||
|
|
@ -1175,8 +1177,8 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
|
||||||
&v_chroma_shift);
|
&v_chroma_shift);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
int src_stride = pic_arg->linesize[i];
|
ptrdiff_t src_stride = pic_arg->linesize[i];
|
||||||
int dst_stride = i ? s->uvlinesize : s->linesize;
|
ptrdiff_t dst_stride = i ? s->uvlinesize : s->linesize;
|
||||||
int h_shift = i ? h_chroma_shift : 0;
|
int h_shift = i ? h_chroma_shift : 0;
|
||||||
int v_shift = i ? v_chroma_shift : 0;
|
int v_shift = i ? v_chroma_shift : 0;
|
||||||
int w = s->width >> h_shift;
|
int w = s->width >> h_shift;
|
||||||
|
|
@ -1194,7 +1196,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
|
||||||
dst += INPLACE_OFFSET;
|
dst += INPLACE_OFFSET;
|
||||||
|
|
||||||
if (src_stride == dst_stride)
|
if (src_stride == dst_stride)
|
||||||
memcpy(dst, src, src_stride * h);
|
memcpy(dst, src, src_stride * h - src_stride + w);
|
||||||
else {
|
else {
|
||||||
int h2 = h;
|
int h2 = h;
|
||||||
uint8_t *dst2 = dst;
|
uint8_t *dst2 = dst;
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,12 @@ static int noise_init(AVBSFContext *ctx)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->par_in->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME &&
|
||||||
|
strcmp(s->amount_str, "0")) {
|
||||||
|
av_log(ctx, AV_LOG_ERROR, "Wrapped AVFrame noising is unsupported\n");
|
||||||
|
return AVERROR_PATCHWELCOME;
|
||||||
|
}
|
||||||
|
|
||||||
ret = av_expr_parse(&s->amount_pexpr, s->amount_str,
|
ret = av_expr_parse(&s->amount_pexpr, s->amount_str,
|
||||||
var_names, NULL, NULL, NULL, NULL, 0, ctx);
|
var_names, NULL, NULL, NULL, NULL, 0, ctx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
||||||
|
|
@ -266,8 +266,8 @@ int ff_nvdec_decode_uninit(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
||||||
|
|
||||||
av_freep(&ctx->bitstream);
|
|
||||||
av_freep(&ctx->bitstream_internal);
|
av_freep(&ctx->bitstream_internal);
|
||||||
|
ctx->bitstream = NULL;
|
||||||
ctx->bitstream_len = 0;
|
ctx->bitstream_len = 0;
|
||||||
ctx->bitstream_allocated = 0;
|
ctx->bitstream_allocated = 0;
|
||||||
|
|
||||||
|
|
@ -677,6 +677,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx)
|
||||||
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
||||||
int ret = ff_nvdec_end_frame(avctx);
|
int ret = ff_nvdec_end_frame(avctx);
|
||||||
ctx->bitstream = NULL;
|
ctx->bitstream = NULL;
|
||||||
|
ctx->bitstream_len = 0;
|
||||||
|
ctx->nb_slices = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,11 +137,11 @@ static int nvdec_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
|
||||||
const H264SliceContext *sl = &h->slice_ctx[0];
|
const H264SliceContext *sl = &h->slice_ctx[0];
|
||||||
void *tmp;
|
void *tmp;
|
||||||
|
|
||||||
tmp = av_fast_realloc(ctx->bitstream, &ctx->bitstream_allocated,
|
tmp = av_fast_realloc(ctx->bitstream_internal, &ctx->bitstream_allocated,
|
||||||
ctx->bitstream_len + size + 3);
|
ctx->bitstream_len + size + 3);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
ctx->bitstream = tmp;
|
ctx->bitstream = ctx->bitstream_internal = tmp;
|
||||||
|
|
||||||
tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
|
tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
|
||||||
(ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
|
(ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
|
||||||
|
|
|
||||||
|
|
@ -273,11 +273,11 @@ static int nvdec_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
|
||||||
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
||||||
void *tmp;
|
void *tmp;
|
||||||
|
|
||||||
tmp = av_fast_realloc(ctx->bitstream, &ctx->bitstream_allocated,
|
tmp = av_fast_realloc(ctx->bitstream_internal, &ctx->bitstream_allocated,
|
||||||
ctx->bitstream_len + size + 3);
|
ctx->bitstream_len + size + 3);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
ctx->bitstream = tmp;
|
ctx->bitstream = ctx->bitstream_internal = tmp;
|
||||||
|
|
||||||
tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
|
tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
|
||||||
(ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
|
(ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
|
||||||
|
|
@ -305,6 +305,15 @@ static int nvdec_hevc_frame_params(AVCodecContext *avctx,
|
||||||
static int nvdec_hevc_decode_init(AVCodecContext *avctx) {
|
static int nvdec_hevc_decode_init(AVCodecContext *avctx) {
|
||||||
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
||||||
ctx->supports_444 = 1;
|
ctx->supports_444 = 1;
|
||||||
|
|
||||||
|
if (avctx->profile != FF_PROFILE_HEVC_MAIN &&
|
||||||
|
avctx->profile != FF_PROFILE_HEVC_MAIN_10 &&
|
||||||
|
avctx->profile != FF_PROFILE_HEVC_MAIN_STILL_PICTURE &&
|
||||||
|
avctx->profile != FF_PROFILE_HEVC_REXT) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Unsupported HEVC profile: %d\n", avctx->profile);
|
||||||
|
return AVERROR(ENOTSUP);
|
||||||
|
}
|
||||||
|
|
||||||
return ff_nvdec_decode_init(avctx);
|
return ff_nvdec_decode_init(avctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,9 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < 64; ++i) {
|
for (i = 0; i < 64; ++i) {
|
||||||
ppc->QuantMatrixIntra[i] = s->intra_matrix[i];
|
int n = s->idsp.idct_permutation[i];
|
||||||
ppc->QuantMatrixInter[i] = s->inter_matrix[i];
|
ppc->QuantMatrixIntra[i] = s->intra_matrix[n];
|
||||||
|
ppc->QuantMatrixInter[i] = s->inter_matrix[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,9 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < 64; ++i) {
|
for (i = 0; i < 64; ++i) {
|
||||||
ppc->QuantMatrixIntra[i] = s->intra_matrix[i];
|
int n = s->idsp.idct_permutation[i];
|
||||||
ppc->QuantMatrixInter[i] = s->inter_matrix[i];
|
ppc->QuantMatrixIntra[i] = s->intra_matrix[n];
|
||||||
|
ppc->QuantMatrixInter[i] = s->inter_matrix[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to pass the full frame buffer and not just the slice
|
// We need to pass the full frame buffer and not just the slice
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
#include "av1.h"
|
#include "av1.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libavutil/buffer.h"
|
|
||||||
#include "libavutil/hwcontext_cuda.h"
|
#include "libavutil/hwcontext_cuda.h"
|
||||||
#include "libavutil/hwcontext.h"
|
#include "libavutil/hwcontext.h"
|
||||||
#include "libavutil/cuda_check.h"
|
#include "libavutil/cuda_check.h"
|
||||||
|
|
@ -44,9 +43,14 @@
|
||||||
#define CHECK_CU(x) FF_CUDA_CHECK_DL(avctx, dl_fn->cuda_dl, x)
|
#define CHECK_CU(x) FF_CUDA_CHECK_DL(avctx, dl_fn->cuda_dl, x)
|
||||||
|
|
||||||
#define NVENC_CAP 0x30
|
#define NVENC_CAP 0x30
|
||||||
|
|
||||||
|
#ifndef NVENC_NO_DEPRECATED_RC
|
||||||
#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR || \
|
#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR || \
|
||||||
rc == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ || \
|
rc == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ || \
|
||||||
rc == NV_ENC_PARAMS_RC_CBR_HQ)
|
rc == NV_ENC_PARAMS_RC_CBR_HQ)
|
||||||
|
#else
|
||||||
|
#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR)
|
||||||
|
#endif
|
||||||
|
|
||||||
const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
|
const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
|
||||||
AV_PIX_FMT_YUV420P,
|
AV_PIX_FMT_YUV420P,
|
||||||
|
|
@ -163,25 +167,6 @@ static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct FrameData {
|
|
||||||
int64_t pts;
|
|
||||||
int64_t duration;
|
|
||||||
#if FF_API_REORDERED_OPAQUE
|
|
||||||
int64_t reordered_opaque;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void *frame_opaque;
|
|
||||||
AVBufferRef *frame_opaque_ref;
|
|
||||||
} FrameData;
|
|
||||||
|
|
||||||
static void reorder_queue_flush(AVFifo *queue)
|
|
||||||
{
|
|
||||||
FrameData fd;
|
|
||||||
|
|
||||||
while (av_fifo_read(queue, &fd, 1) >= 0)
|
|
||||||
av_buffer_unref(&fd.frame_opaque_ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct GUIDTuple {
|
typedef struct GUIDTuple {
|
||||||
const GUID guid;
|
const GUID guid;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
@ -457,7 +442,7 @@ static int nvenc_check_cap(AVCodecContext *avctx, NV_ENC_CAPS cap)
|
||||||
static int nvenc_check_capabilities(AVCodecContext *avctx)
|
static int nvenc_check_capabilities(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
NvencContext *ctx = avctx->priv_data;
|
NvencContext *ctx = avctx->priv_data;
|
||||||
int ret;
|
int tmp, ret;
|
||||||
|
|
||||||
ret = nvenc_check_codec_support(avctx);
|
ret = nvenc_check_codec_support(avctx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
@ -538,16 +523,18 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NVENC_HAVE_BFRAME_REF_MODE
|
#ifdef NVENC_HAVE_BFRAME_REF_MODE
|
||||||
|
tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED;
|
||||||
ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
|
ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
|
||||||
if (ctx->b_ref_mode == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) {
|
if (tmp == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not supported\n");
|
av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not supported\n");
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
} else if (ctx->b_ref_mode != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) {
|
} else if (tmp != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "B frames as references are not supported\n");
|
av_log(avctx, AV_LOG_WARNING, "B frames as references are not supported\n");
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (ctx->b_ref_mode != 0) {
|
tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0;
|
||||||
|
if (tmp > 0) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n");
|
av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n");
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
}
|
}
|
||||||
|
|
@ -922,6 +909,7 @@ static void nvenc_override_rate_control(AVCodecContext *avctx)
|
||||||
case NV_ENC_PARAMS_RC_CONSTQP:
|
case NV_ENC_PARAMS_RC_CONSTQP:
|
||||||
set_constqp(avctx);
|
set_constqp(avctx);
|
||||||
return;
|
return;
|
||||||
|
#ifndef NVENC_NO_DEPRECATED_RC
|
||||||
case NV_ENC_PARAMS_RC_VBR_MINQP:
|
case NV_ENC_PARAMS_RC_VBR_MINQP:
|
||||||
if (avctx->qmin < 0) {
|
if (avctx->qmin < 0) {
|
||||||
av_log(avctx, AV_LOG_WARNING,
|
av_log(avctx, AV_LOG_WARNING,
|
||||||
|
|
@ -932,12 +920,15 @@ static void nvenc_override_rate_control(AVCodecContext *avctx)
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case NV_ENC_PARAMS_RC_VBR_HQ:
|
case NV_ENC_PARAMS_RC_VBR_HQ:
|
||||||
|
#endif
|
||||||
case NV_ENC_PARAMS_RC_VBR:
|
case NV_ENC_PARAMS_RC_VBR:
|
||||||
set_vbr(avctx);
|
set_vbr(avctx);
|
||||||
break;
|
break;
|
||||||
case NV_ENC_PARAMS_RC_CBR:
|
case NV_ENC_PARAMS_RC_CBR:
|
||||||
|
#ifndef NVENC_NO_DEPRECATED_RC
|
||||||
case NV_ENC_PARAMS_RC_CBR_HQ:
|
case NV_ENC_PARAMS_RC_CBR_HQ:
|
||||||
case NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ:
|
case NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ:
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -980,6 +971,10 @@ static av_cold int nvenc_recalc_surfaces(AVCodecContext *avctx)
|
||||||
ctx->nb_surfaces = FFMAX(1, FFMIN(MAX_REGISTERED_FRAMES, ctx->nb_surfaces));
|
ctx->nb_surfaces = FFMAX(1, FFMIN(MAX_REGISTERED_FRAMES, ctx->nb_surfaces));
|
||||||
ctx->async_depth = FFMIN(ctx->async_depth, ctx->nb_surfaces - 1);
|
ctx->async_depth = FFMIN(ctx->async_depth, ctx->nb_surfaces - 1);
|
||||||
|
|
||||||
|
// Output in the worst case will only start when the surface buffer is completely full.
|
||||||
|
// Hence we need to keep at least the max amount of surfaces plus the max reorder delay around.
|
||||||
|
ctx->frame_data_array_nb = FFMAX(ctx->nb_surfaces, ctx->nb_surfaces + ctx->encode_config.frameIntervalP - 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1207,12 +1202,14 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
|
||||||
|
|
||||||
h264->outputPictureTimingSEI = 1;
|
h264->outputPictureTimingSEI = 1;
|
||||||
|
|
||||||
|
#ifndef NVENC_NO_DEPRECATED_RC
|
||||||
if (cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ ||
|
if (cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ ||
|
||||||
cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_HQ ||
|
cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_HQ ||
|
||||||
cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_VBR_HQ) {
|
cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_VBR_HQ) {
|
||||||
h264->adaptiveTransformMode = NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE;
|
h264->adaptiveTransformMode = NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE;
|
||||||
h264->fmoMode = NV_ENC_H264_FMO_DISABLE;
|
h264->fmoMode = NV_ENC_H264_FMO_DISABLE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ctx->flags & NVENC_LOSSLESS) {
|
if (ctx->flags & NVENC_LOSSLESS) {
|
||||||
h264->qpPrimeYZeroTransformBypassFlag = 1;
|
h264->qpPrimeYZeroTransformBypassFlag = 1;
|
||||||
|
|
@ -1768,8 +1765,12 @@ static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx)
|
||||||
if (!ctx->surfaces)
|
if (!ctx->surfaces)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
ctx->reorder_queue = av_fifo_alloc2(ctx->nb_surfaces, sizeof(FrameData), 0);
|
ctx->frame_data_array = av_calloc(ctx->frame_data_array_nb, sizeof(*ctx->frame_data_array));
|
||||||
if (!ctx->reorder_queue)
|
if (!ctx->frame_data_array)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
ctx->timestamp_list = av_fifo_alloc2(ctx->nb_surfaces, sizeof(int64_t), 0);
|
||||||
|
if (!ctx->timestamp_list)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
ctx->unused_surface_queue = av_fifo_alloc2(ctx->nb_surfaces, sizeof(NvencSurface*), 0);
|
ctx->unused_surface_queue = av_fifo_alloc2(ctx->nb_surfaces, sizeof(NvencSurface*), 0);
|
||||||
|
|
@ -1853,12 +1854,17 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
|
||||||
p_nvenc->nvEncEncodePicture(ctx->nvencoder, ¶ms);
|
p_nvenc->nvEncEncodePicture(ctx->nvencoder, ¶ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
reorder_queue_flush(ctx->reorder_queue);
|
av_fifo_freep2(&ctx->timestamp_list);
|
||||||
av_fifo_freep2(&ctx->reorder_queue);
|
|
||||||
av_fifo_freep2(&ctx->output_surface_ready_queue);
|
av_fifo_freep2(&ctx->output_surface_ready_queue);
|
||||||
av_fifo_freep2(&ctx->output_surface_queue);
|
av_fifo_freep2(&ctx->output_surface_queue);
|
||||||
av_fifo_freep2(&ctx->unused_surface_queue);
|
av_fifo_freep2(&ctx->unused_surface_queue);
|
||||||
|
|
||||||
|
if (ctx->frame_data_array) {
|
||||||
|
for (i = 0; i < ctx->frame_data_array_nb; i++)
|
||||||
|
av_buffer_unref(&ctx->frame_data_array[i].frame_opaque_ref);
|
||||||
|
av_freep(&ctx->frame_data_array);
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->surfaces && (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->pix_fmt == AV_PIX_FMT_D3D11)) {
|
if (ctx->surfaces && (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->pix_fmt == AV_PIX_FMT_D3D11)) {
|
||||||
for (i = 0; i < ctx->nb_registered_frames; i++) {
|
for (i = 0; i < ctx->nb_registered_frames; i++) {
|
||||||
if (ctx->registered_frames[i].mapped)
|
if (ctx->registered_frames[i].mapped)
|
||||||
|
|
@ -2198,53 +2204,18 @@ static void nvenc_codec_specific_pic_params(AVCodecContext *avctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reorder_queue_enqueue(AVFifo *queue, const AVCodecContext *avctx,
|
static inline void timestamp_queue_enqueue(AVFifo *queue, int64_t timestamp)
|
||||||
const AVFrame *frame, AVBufferRef **opaque_ref)
|
|
||||||
{
|
{
|
||||||
FrameData fd;
|
av_fifo_write(queue, ×tamp, 1);
|
||||||
|
|
||||||
fd.pts = frame->pts;
|
|
||||||
fd.duration = frame->duration;
|
|
||||||
#if FF_API_REORDERED_OPAQUE
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
fd.reordered_opaque = frame->reordered_opaque;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
fd.frame_opaque = frame->opaque;
|
|
||||||
fd.frame_opaque_ref = *opaque_ref;
|
|
||||||
|
|
||||||
*opaque_ref = NULL;
|
|
||||||
|
|
||||||
av_fifo_write(queue, &fd, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t reorder_queue_dequeue(AVFifo *queue, AVCodecContext *avctx,
|
static inline int64_t timestamp_queue_dequeue(AVFifo *queue)
|
||||||
AVPacket *pkt)
|
|
||||||
{
|
{
|
||||||
FrameData fd;
|
int64_t timestamp = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
// The following call might fail if the queue is empty.
|
// The following call might fail if the queue is empty.
|
||||||
if (av_fifo_read(queue, &fd, 1) < 0)
|
av_fifo_read(queue, ×tamp, 1);
|
||||||
return AV_NOPTS_VALUE;
|
|
||||||
|
|
||||||
if (pkt) {
|
return timestamp;
|
||||||
#if FF_API_REORDERED_OPAQUE
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
avctx->reordered_opaque = fd.reordered_opaque;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
pkt->duration = fd.duration;
|
|
||||||
|
|
||||||
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
|
||||||
pkt->opaque = fd.frame_opaque;
|
|
||||||
pkt->opaque_ref = fd.frame_opaque_ref;
|
|
||||||
fd.frame_opaque_ref = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
av_buffer_unref(&fd.frame_opaque_ref);
|
|
||||||
|
|
||||||
return fd.pts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvenc_set_timestamp(AVCodecContext *avctx,
|
static int nvenc_set_timestamp(AVCodecContext *avctx,
|
||||||
|
|
@ -2252,14 +2223,12 @@ static int nvenc_set_timestamp(AVCodecContext *avctx,
|
||||||
AVPacket *pkt)
|
AVPacket *pkt)
|
||||||
{
|
{
|
||||||
NvencContext *ctx = avctx->priv_data;
|
NvencContext *ctx = avctx->priv_data;
|
||||||
int64_t dts;
|
|
||||||
|
|
||||||
pkt->pts = params->outputTimeStamp;
|
pkt->pts = params->outputTimeStamp;
|
||||||
|
|
||||||
dts = reorder_queue_dequeue(ctx->reorder_queue, avctx, pkt);
|
|
||||||
|
|
||||||
if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) {
|
if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) {
|
||||||
pkt->dts = dts - FFMAX(ctx->encode_config.frameIntervalP - 1, 0) * FFMAX(avctx->ticks_per_frame, 1);
|
pkt->dts = timestamp_queue_dequeue(ctx->timestamp_list) -
|
||||||
|
FFMAX(ctx->encode_config.frameIntervalP - 1, 0) * FFMAX(avctx->ticks_per_frame, 1);
|
||||||
} else {
|
} else {
|
||||||
pkt->dts = pkt->pts;
|
pkt->dts = pkt->pts;
|
||||||
}
|
}
|
||||||
|
|
@ -2267,6 +2236,65 @@ static int nvenc_set_timestamp(AVCodecContext *avctx,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nvenc_store_frame_data(AVCodecContext *avctx, NV_ENC_PIC_PARAMS *pic_params, const AVFrame *frame)
|
||||||
|
{
|
||||||
|
NvencContext *ctx = avctx->priv_data;
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
int idx = ctx->frame_data_array_pos;
|
||||||
|
NvencFrameData *frame_data = &ctx->frame_data_array[idx];
|
||||||
|
|
||||||
|
// in case the encoder got reconfigured, there might be leftovers
|
||||||
|
av_buffer_unref(&frame_data->frame_opaque_ref);
|
||||||
|
|
||||||
|
if (frame && frame->opaque_ref && avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||||
|
frame_data->frame_opaque_ref = av_buffer_ref(frame->opaque_ref);
|
||||||
|
if (!frame_data->frame_opaque_ref)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame_data->duration = frame->duration;
|
||||||
|
frame_data->frame_opaque = frame->opaque;
|
||||||
|
|
||||||
|
#if FF_API_REORDERED_OPAQUE
|
||||||
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
frame_data->reordered_opaque = frame->reordered_opaque;
|
||||||
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ctx->frame_data_array_pos = (ctx->frame_data_array_pos + 1) % ctx->frame_data_array_nb;
|
||||||
|
pic_params->inputDuration = idx;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int nvenc_retrieve_frame_data(AVCodecContext *avctx, NV_ENC_LOCK_BITSTREAM *lock_params, AVPacket *pkt)
|
||||||
|
{
|
||||||
|
NvencContext *ctx = avctx->priv_data;
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
int idx = lock_params->outputDuration;
|
||||||
|
NvencFrameData *frame_data = &ctx->frame_data_array[idx];
|
||||||
|
|
||||||
|
pkt->duration = frame_data->duration;
|
||||||
|
|
||||||
|
#if FF_API_REORDERED_OPAQUE
|
||||||
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
avctx->reordered_opaque = frame_data->reordered_opaque;
|
||||||
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
||||||
|
pkt->opaque = frame_data->frame_opaque;
|
||||||
|
pkt->opaque_ref = frame_data->frame_opaque_ref;
|
||||||
|
frame_data->frame_opaque_ref = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
av_buffer_unref(&frame_data->frame_opaque_ref);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSurface *tmpoutsurf)
|
static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSurface *tmpoutsurf)
|
||||||
{
|
{
|
||||||
NvencContext *ctx = avctx->priv_data;
|
NvencContext *ctx = avctx->priv_data;
|
||||||
|
|
@ -2353,10 +2381,14 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
goto error2;
|
goto error2;
|
||||||
|
|
||||||
|
res = nvenc_retrieve_frame_data(avctx, &lock_params, pkt);
|
||||||
|
if (res < 0)
|
||||||
|
goto error2;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
reorder_queue_dequeue(ctx->reorder_queue, avctx, NULL);
|
timestamp_queue_dequeue(ctx->timestamp_list);
|
||||||
|
|
||||||
error2:
|
error2:
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -2586,8 +2618,6 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
|
||||||
int sei_count = 0;
|
int sei_count = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
AVBufferRef *opaque_ref = NULL;
|
|
||||||
|
|
||||||
NvencContext *ctx = avctx->priv_data;
|
NvencContext *ctx = avctx->priv_data;
|
||||||
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
|
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
|
||||||
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
|
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
|
||||||
|
|
@ -2650,22 +2680,18 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
|
||||||
sei_count = res;
|
sei_count = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res = nvenc_store_frame_data(avctx, &pic_params, frame);
|
||||||
|
if (res < 0)
|
||||||
|
return res;
|
||||||
|
|
||||||
nvenc_codec_specific_pic_params(avctx, &pic_params, ctx->sei_data, sei_count);
|
nvenc_codec_specific_pic_params(avctx, &pic_params, ctx->sei_data, sei_count);
|
||||||
} else {
|
} else {
|
||||||
pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS;
|
pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a reference for enqueing in the reorder queue here,
|
|
||||||
// so that reorder_queue_enqueue() cannot fail
|
|
||||||
if (frame && frame->opaque_ref && avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
|
|
||||||
opaque_ref = av_buffer_ref(frame->opaque_ref);
|
|
||||||
if (!opaque_ref)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
res = nvenc_push_context(avctx);
|
res = nvenc_push_context(avctx);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
goto opaque_ref_fail;
|
return res;
|
||||||
|
|
||||||
nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params);
|
nv_status = p_nvenc->nvEncEncodePicture(ctx->nvencoder, &pic_params);
|
||||||
|
|
||||||
|
|
@ -2674,17 +2700,17 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
|
||||||
|
|
||||||
res = nvenc_pop_context(avctx);
|
res = nvenc_pop_context(avctx);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
goto opaque_ref_fail;
|
return res;
|
||||||
|
|
||||||
if (nv_status != NV_ENC_SUCCESS &&
|
if (nv_status != NV_ENC_SUCCESS &&
|
||||||
nv_status != NV_ENC_ERR_NEED_MORE_INPUT) {
|
nv_status != NV_ENC_ERR_NEED_MORE_INPUT)
|
||||||
res = nvenc_print_error(avctx, nv_status, "EncodePicture failed!");
|
return nvenc_print_error(avctx, nv_status, "EncodePicture failed!");
|
||||||
goto opaque_ref_fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame && frame->buf[0]) {
|
if (frame && frame->buf[0]) {
|
||||||
av_fifo_write(ctx->output_surface_queue, &in_surf, 1);
|
av_fifo_write(ctx->output_surface_queue, &in_surf, 1);
|
||||||
reorder_queue_enqueue(ctx->reorder_queue, avctx, frame, &opaque_ref);
|
|
||||||
|
if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER)
|
||||||
|
timestamp_queue_enqueue(ctx->timestamp_list, frame->pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all the pending buffers are now ready for output */
|
/* all the pending buffers are now ready for output */
|
||||||
|
|
@ -2694,10 +2720,6 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
opaque_ref_fail:
|
|
||||||
av_buffer_unref(&opaque_ref);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_nvenc_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
|
int ff_nvenc_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
|
||||||
|
|
@ -2756,5 +2778,5 @@ av_cold void ff_nvenc_encode_flush(AVCodecContext *avctx)
|
||||||
NvencContext *ctx = avctx->priv_data;
|
NvencContext *ctx = avctx->priv_data;
|
||||||
|
|
||||||
nvenc_send_frame(avctx, NULL);
|
nvenc_send_frame(avctx, NULL);
|
||||||
reorder_queue_flush(ctx->reorder_queue);
|
av_fifo_reset2(ctx->timestamp_list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ typedef void ID3D11Device;
|
||||||
#include <ffnvcodec/nvEncodeAPI.h>
|
#include <ffnvcodec/nvEncodeAPI.h>
|
||||||
|
|
||||||
#include "compat/cuda/dynlink_loader.h"
|
#include "compat/cuda/dynlink_loader.h"
|
||||||
|
#include "libavutil/buffer.h"
|
||||||
#include "libavutil/fifo.h"
|
#include "libavutil/fifo.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "hwconfig.h"
|
#include "hwconfig.h"
|
||||||
|
|
@ -77,6 +78,11 @@ typedef void ID3D11Device;
|
||||||
#define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
|
#define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// SDK 12.1 compile time feature checks
|
||||||
|
#if NVENCAPI_CHECK_VERSION(12, 1)
|
||||||
|
#define NVENC_NO_DEPRECATED_RC
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct NvencSurface
|
typedef struct NvencSurface
|
||||||
{
|
{
|
||||||
NV_ENC_INPUT_PTR input_surface;
|
NV_ENC_INPUT_PTR input_surface;
|
||||||
|
|
@ -90,6 +96,18 @@ typedef struct NvencSurface
|
||||||
NV_ENC_BUFFER_FORMAT format;
|
NV_ENC_BUFFER_FORMAT format;
|
||||||
} NvencSurface;
|
} NvencSurface;
|
||||||
|
|
||||||
|
typedef struct NvencFrameData
|
||||||
|
{
|
||||||
|
int64_t duration;
|
||||||
|
|
||||||
|
#if FF_API_REORDERED_OPAQUE
|
||||||
|
int64_t reordered_opaque;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *frame_opaque;
|
||||||
|
AVBufferRef *frame_opaque_ref;
|
||||||
|
} NvencFrameData;
|
||||||
|
|
||||||
typedef struct NvencDynLoadFunctions
|
typedef struct NvencDynLoadFunctions
|
||||||
{
|
{
|
||||||
CudaFunctions *cuda_dl;
|
CudaFunctions *cuda_dl;
|
||||||
|
|
@ -168,10 +186,14 @@ typedef struct NvencContext
|
||||||
int nb_surfaces;
|
int nb_surfaces;
|
||||||
NvencSurface *surfaces;
|
NvencSurface *surfaces;
|
||||||
|
|
||||||
|
NvencFrameData *frame_data_array;
|
||||||
|
int frame_data_array_nb;
|
||||||
|
int frame_data_array_pos;
|
||||||
|
|
||||||
AVFifo *unused_surface_queue;
|
AVFifo *unused_surface_queue;
|
||||||
AVFifo *output_surface_queue;
|
AVFifo *output_surface_queue;
|
||||||
AVFifo *output_surface_ready_queue;
|
AVFifo *output_surface_ready_queue;
|
||||||
AVFifo *reorder_queue;
|
AVFifo *timestamp_list;
|
||||||
|
|
||||||
NV_ENC_SEI_PAYLOAD *sei_data;
|
NV_ENC_SEI_PAYLOAD *sei_data;
|
||||||
int sei_data_size;
|
int sei_data_size;
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ static const AVOption options[] = {
|
||||||
{ "constqp", "Constant QP mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP }, 0, 0, VE, "rc" },
|
{ "constqp", "Constant QP mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP }, 0, 0, VE, "rc" },
|
||||||
{ "vbr", "Variable bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR }, 0, 0, VE, "rc" },
|
{ "vbr", "Variable bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR }, 0, 0, VE, "rc" },
|
||||||
{ "cbr", "Constant bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR }, 0, 0, VE, "rc" },
|
{ "cbr", "Constant bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR }, 0, 0, VE, "rc" },
|
||||||
|
#ifndef NVENC_NO_DEPRECATED_RC
|
||||||
{ "vbr_minqp", "Variable bitrate mode with MinQP (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_MINQP) }, 0, 0, VE, "rc" },
|
{ "vbr_minqp", "Variable bitrate mode with MinQP (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_MINQP) }, 0, 0, VE, "rc" },
|
||||||
{ "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
|
{ "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
|
||||||
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_QUALITY) }, 0, 0, VE, "rc" },
|
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_QUALITY) }, 0, 0, VE, "rc" },
|
||||||
|
|
@ -109,6 +110,17 @@ static const AVOption options[] = {
|
||||||
{ "cbr_ld_hq", "Constant bitrate low delay high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) }, 0, 0, VE, "rc" },
|
{ "cbr_ld_hq", "Constant bitrate low delay high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) }, 0, 0, VE, "rc" },
|
||||||
{ "cbr_hq", "Constant bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_HQ) }, 0, 0, VE, "rc" },
|
{ "cbr_hq", "Constant bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_HQ) }, 0, 0, VE, "rc" },
|
||||||
{ "vbr_hq", "Variable bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_HQ) }, 0, 0, VE, "rc" },
|
{ "vbr_hq", "Variable bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_HQ) }, 0, 0, VE, "rc" },
|
||||||
|
#else
|
||||||
|
{ "vbr_minqp", "Variable bitrate mode with MinQP (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
|
||||||
|
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "ll_2pass_size", "Multi-pass optimized for constant frame size (deprecated)",
|
||||||
|
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "vbr_2pass", "Multi-pass variable bitrate mode (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "cbr_ld_hq", "Constant bitrate low delay high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "cbr_hq", "Constant bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "vbr_hq", "Variable bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
#endif
|
||||||
{ "rc-lookahead", "Number of frames to look ahead for rate-control",
|
{ "rc-lookahead", "Number of frames to look ahead for rate-control",
|
||||||
OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
|
OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
|
||||||
{ "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
|
{ "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ static const AVOption options[] = {
|
||||||
{ "constqp", "Constant QP mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP }, 0, 0, VE, "rc" },
|
{ "constqp", "Constant QP mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP }, 0, 0, VE, "rc" },
|
||||||
{ "vbr", "Variable bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR }, 0, 0, VE, "rc" },
|
{ "vbr", "Variable bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR }, 0, 0, VE, "rc" },
|
||||||
{ "cbr", "Constant bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR }, 0, 0, VE, "rc" },
|
{ "cbr", "Constant bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR }, 0, 0, VE, "rc" },
|
||||||
|
#ifndef NVENC_NO_DEPRECATED_RC
|
||||||
{ "vbr_minqp", "Variable bitrate mode with MinQP (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_MINQP) }, 0, 0, VE, "rc" },
|
{ "vbr_minqp", "Variable bitrate mode with MinQP (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_MINQP) }, 0, 0, VE, "rc" },
|
||||||
{ "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
|
{ "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
|
||||||
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_QUALITY) }, 0, 0, VE, "rc" },
|
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_QUALITY) }, 0, 0, VE, "rc" },
|
||||||
|
|
@ -98,6 +99,17 @@ static const AVOption options[] = {
|
||||||
{ "cbr_ld_hq", "Constant bitrate low delay high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) }, 0, 0, VE, "rc" },
|
{ "cbr_ld_hq", "Constant bitrate low delay high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) }, 0, 0, VE, "rc" },
|
||||||
{ "cbr_hq", "Constant bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_HQ) }, 0, 0, VE, "rc" },
|
{ "cbr_hq", "Constant bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_HQ) }, 0, 0, VE, "rc" },
|
||||||
{ "vbr_hq", "Variable bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_HQ) }, 0, 0, VE, "rc" },
|
{ "vbr_hq", "Variable bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_HQ) }, 0, 0, VE, "rc" },
|
||||||
|
#else
|
||||||
|
{ "vbr_minqp", "Variable bitrate mode with MinQP (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
|
||||||
|
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "ll_2pass_size", "Multi-pass optimized for constant frame size (deprecated)",
|
||||||
|
0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "vbr_2pass", "Multi-pass variable bitrate mode (deprecated)", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "cbr_ld_hq", "Constant bitrate low delay high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "cbr_hq", "Constant bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) }, 0, 0, VE, "rc" },
|
||||||
|
{ "vbr_hq", "Variable bitrate high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) }, 0, 0, VE, "rc" },
|
||||||
|
#endif
|
||||||
{ "rc-lookahead", "Number of frames to look ahead for rate-control",
|
{ "rc-lookahead", "Number of frames to look ahead for rate-control",
|
||||||
OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
|
OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
|
||||||
{ "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
|
{ "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ typedef struct On2AVCContext {
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
AVFloatDSPContext *fdsp;
|
AVFloatDSPContext *fdsp;
|
||||||
AVTXContext *mdct, *mdct_half, *mdct_small;
|
AVTXContext *mdct, *mdct_half, *mdct_small;
|
||||||
AVTXContext *fft128, *fft256, *fft512, *fft1024;
|
AVTXContext *fft64, *fft128, *fft256, *fft512;
|
||||||
av_tx_fn mdct_fn, mdct_half_fn, mdct_small_fn;
|
av_tx_fn mdct_fn, mdct_half_fn, mdct_small_fn;
|
||||||
av_tx_fn fft128_fn, fft256_fn, fft512_fn, fft1024_fn;
|
av_tx_fn fft64_fn, fft128_fn, fft256_fn, fft512_fn;
|
||||||
void (*wtf)(struct On2AVCContext *ctx, float *out, float *in, int size);
|
void (*wtf)(struct On2AVCContext *ctx, float *out, float *in, int size);
|
||||||
|
|
||||||
int is_av500;
|
int is_av500;
|
||||||
|
|
@ -475,16 +475,16 @@ static void wtf_end_512(On2AVCContext *c, float *out, float *src,
|
||||||
zero_head_and_tail(tmp1 + 256, 128, 13, 7);
|
zero_head_and_tail(tmp1 + 256, 128, 13, 7);
|
||||||
zero_head_and_tail(tmp1 + 384, 128, 15, 5);
|
zero_head_and_tail(tmp1 + 384, 128, 15, 5);
|
||||||
|
|
||||||
c->fft128_fn(c->fft128, src + 0, tmp1 + 0, sizeof(float));
|
c->fft64_fn(c->fft64, src + 0, tmp1 + 0, sizeof(float));
|
||||||
c->fft128_fn(c->fft128, src + 128, tmp1 + 128, sizeof(float));
|
c->fft64_fn(c->fft64, src + 128, tmp1 + 128, sizeof(float));
|
||||||
c->fft128_fn(c->fft128, src + 256, tmp1 + 256, sizeof(float));
|
c->fft64_fn(c->fft64, src + 256, tmp1 + 256, sizeof(float));
|
||||||
c->fft128_fn(c->fft128, src + 384, tmp1 + 384, sizeof(float));
|
c->fft64_fn(c->fft64, src + 384, tmp1 + 384, sizeof(float));
|
||||||
|
|
||||||
combine_fft(src, src + 128, src + 256, src + 384, tmp1,
|
combine_fft(src, src + 128, src + 256, src + 384, tmp1,
|
||||||
ff_on2avc_ctab_1, ff_on2avc_ctab_2,
|
ff_on2avc_ctab_1, ff_on2avc_ctab_2,
|
||||||
ff_on2avc_ctab_3, ff_on2avc_ctab_4, 512, 2);
|
ff_on2avc_ctab_3, ff_on2avc_ctab_4, 512, 2);
|
||||||
|
|
||||||
c->fft512_fn(c->fft512, src, tmp1, sizeof(float));
|
c->fft256_fn(c->fft256, src, tmp1, sizeof(float));
|
||||||
|
|
||||||
pretwiddle(&tmp0[ 0], src, 512, 84, 4, 16, 4, ff_on2avc_tabs_20_84_1);
|
pretwiddle(&tmp0[ 0], src, 512, 84, 4, 16, 4, ff_on2avc_tabs_20_84_1);
|
||||||
pretwiddle(&tmp0[128], src, 512, 84, 4, 16, 4, ff_on2avc_tabs_20_84_2);
|
pretwiddle(&tmp0[128], src, 512, 84, 4, 16, 4, ff_on2avc_tabs_20_84_2);
|
||||||
|
|
@ -503,16 +503,16 @@ static void wtf_end_1024(On2AVCContext *c, float *out, float *src,
|
||||||
zero_head_and_tail(tmp1 + 512, 256, 13, 7);
|
zero_head_and_tail(tmp1 + 512, 256, 13, 7);
|
||||||
zero_head_and_tail(tmp1 + 768, 256, 15, 5);
|
zero_head_and_tail(tmp1 + 768, 256, 15, 5);
|
||||||
|
|
||||||
c->fft256_fn(c->fft256, src + 0, tmp1 + 0, sizeof(float));
|
c->fft128_fn(c->fft128, src + 0, tmp1 + 0, sizeof(float));
|
||||||
c->fft256_fn(c->fft256, src + 256, tmp1 + 256, sizeof(float));
|
c->fft128_fn(c->fft128, src + 256, tmp1 + 256, sizeof(float));
|
||||||
c->fft256_fn(c->fft256, src + 512, tmp1 + 512, sizeof(float));
|
c->fft128_fn(c->fft128, src + 512, tmp1 + 512, sizeof(float));
|
||||||
c->fft256_fn(c->fft256, src + 768, tmp1 + 768, sizeof(float));
|
c->fft128_fn(c->fft128, src + 768, tmp1 + 768, sizeof(float));
|
||||||
|
|
||||||
combine_fft(src, src + 256, src + 512, src + 768, tmp1,
|
combine_fft(src, src + 256, src + 512, src + 768, tmp1,
|
||||||
ff_on2avc_ctab_1, ff_on2avc_ctab_2,
|
ff_on2avc_ctab_1, ff_on2avc_ctab_2,
|
||||||
ff_on2avc_ctab_3, ff_on2avc_ctab_4, 1024, 1);
|
ff_on2avc_ctab_3, ff_on2avc_ctab_4, 1024, 1);
|
||||||
|
|
||||||
c->fft1024_fn(c->fft1024, src, tmp1, sizeof(float));
|
c->fft512_fn(c->fft512, src, tmp1, sizeof(float));
|
||||||
|
|
||||||
pretwiddle(&tmp0[ 0], src, 1024, 84, 4, 16, 4, ff_on2avc_tabs_20_84_1);
|
pretwiddle(&tmp0[ 0], src, 1024, 84, 4, 16, 4, ff_on2avc_tabs_20_84_1);
|
||||||
pretwiddle(&tmp0[256], src, 1024, 84, 4, 16, 4, ff_on2avc_tabs_20_84_2);
|
pretwiddle(&tmp0[256], src, 1024, 84, 4, 16, 4, ff_on2avc_tabs_20_84_2);
|
||||||
|
|
@ -700,7 +700,7 @@ static int on2avc_reconstruct_channel_ext(On2AVCContext *c, AVFrame *dst, int of
|
||||||
break;
|
break;
|
||||||
case WINDOW_TYPE_EXT5:
|
case WINDOW_TYPE_EXT5:
|
||||||
c->wtf(c, buf, in, 512);
|
c->wtf(c, buf, in, 512);
|
||||||
c->mdct_half_fn(c->mdct, buf + 512, in + 512, sizeof(float));
|
c->mdct_half_fn(c->mdct_half, buf + 512, in + 512, sizeof(float));
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
FFSWAP(float, buf[i + 512], buf[1023 - i]);
|
FFSWAP(float, buf[i + 512], buf[1023 - i]);
|
||||||
}
|
}
|
||||||
|
|
@ -956,14 +956,14 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
|
||||||
if ((ret = av_tx_init(&c->mdct_small, &c->mdct_small_fn, AV_TX_FLOAT_MDCT, 1, 128, &scale, 0)) < 0)
|
if ((ret = av_tx_init(&c->mdct_small, &c->mdct_small_fn, AV_TX_FLOAT_MDCT, 1, 128, &scale, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((ret = av_tx_init(&c->fft1024, &c->fft1024_fn, AV_TX_FLOAT_FFT, 1, 1024, NULL, 0)) < 0)
|
|
||||||
return ret;
|
|
||||||
if ((ret = av_tx_init(&c->fft512, &c->fft512_fn, AV_TX_FLOAT_FFT, 1, 512, NULL, 0)) < 0)
|
if ((ret = av_tx_init(&c->fft512, &c->fft512_fn, AV_TX_FLOAT_FFT, 1, 512, NULL, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if ((ret = av_tx_init(&c->fft256, &c->fft256_fn, AV_TX_FLOAT_FFT, 0, 256, NULL, 0)) < 0)
|
if ((ret = av_tx_init(&c->fft256, &c->fft256_fn, AV_TX_FLOAT_FFT, 1, 256, NULL, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if ((ret = av_tx_init(&c->fft128, &c->fft128_fn, AV_TX_FLOAT_FFT, 0, 128, NULL, 0)) < 0)
|
if ((ret = av_tx_init(&c->fft128, &c->fft128_fn, AV_TX_FLOAT_FFT, 0, 128, NULL, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
if ((ret = av_tx_init(&c->fft64, &c->fft64_fn, AV_TX_FLOAT_FFT, 0, 64, NULL, 0)) < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
c->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
c->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||||
if (!c->fdsp)
|
if (!c->fdsp)
|
||||||
|
|
@ -998,10 +998,10 @@ static av_cold int on2avc_decode_close(AVCodecContext *avctx)
|
||||||
av_tx_uninit(&c->mdct);
|
av_tx_uninit(&c->mdct);
|
||||||
av_tx_uninit(&c->mdct_half);
|
av_tx_uninit(&c->mdct_half);
|
||||||
av_tx_uninit(&c->mdct_small);
|
av_tx_uninit(&c->mdct_small);
|
||||||
|
av_tx_uninit(&c->fft64);
|
||||||
av_tx_uninit(&c->fft128);
|
av_tx_uninit(&c->fft128);
|
||||||
av_tx_uninit(&c->fft256);
|
av_tx_uninit(&c->fft256);
|
||||||
av_tx_uninit(&c->fft512);
|
av_tx_uninit(&c->fft512);
|
||||||
av_tx_uninit(&c->fft1024);
|
|
||||||
|
|
||||||
av_freep(&c->fdsp);
|
av_freep(&c->fdsp);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -578,7 +578,7 @@ const FFCodec ff_ ## name_ ## _decoder = { \
|
||||||
.priv_data_size = sizeof(PCMDecode), \
|
.priv_data_size = sizeof(PCMDecode), \
|
||||||
.init = pcm_decode_init, \
|
.init = pcm_decode_init, \
|
||||||
FF_CODEC_DECODE_CB(pcm_decode_frame), \
|
FF_CODEC_DECODE_CB(pcm_decode_frame), \
|
||||||
.p.capabilities = AV_CODEC_CAP_DR1, \
|
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_PARAM_CHANGE, \
|
||||||
.p.sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
|
.p.sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
|
||||||
AV_SAMPLE_FMT_NONE }, \
|
AV_SAMPLE_FMT_NONE }, \
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ void ff_png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
|
||||||
static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \
|
static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \
|
||||||
{ \
|
{ \
|
||||||
int i; \
|
int i; \
|
||||||
for (i = 0; i < size; i += 3 + alpha) { \
|
for (i = 0; i < size - 2; i += 3 + alpha) { \
|
||||||
int g = dst [i + 1]; \
|
int g = dst [i + 1]; \
|
||||||
dst[i + 0] += g; \
|
dst[i + 0] += g; \
|
||||||
dst[i + 2] += g; \
|
dst[i + 2] += g; \
|
||||||
|
|
@ -647,6 +647,8 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||||
int ret;
|
int ret;
|
||||||
size_t byte_depth = s->bit_depth > 8 ? 2 : 1;
|
size_t byte_depth = s->bit_depth > 8 ? 2 : 1;
|
||||||
|
|
||||||
|
if (!p)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
if (!(s->hdr_state & PNG_IHDR)) {
|
if (!(s->hdr_state & PNG_IHDR)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n");
|
av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
@ -883,7 +885,7 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int decode_iccp_chunk(PNGDecContext *s, GetByteContext *gb, AVFrame *f)
|
static int decode_iccp_chunk(PNGDecContext *s, GetByteContext *gb)
|
||||||
{
|
{
|
||||||
int ret, cnt = 0;
|
int ret, cnt = 0;
|
||||||
AVBPrint bp;
|
AVBPrint bp;
|
||||||
|
|
@ -1238,6 +1240,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||||
}
|
}
|
||||||
av_log(avctx, AV_LOG_ERROR, ", skipping\n");
|
av_log(avctx, AV_LOG_ERROR, ", skipping\n");
|
||||||
bytestream2_skip(&s->gb, length + 8); /* tag */
|
bytestream2_skip(&s->gb, length + 8); /* tag */
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tag = bytestream2_get_le32(&s->gb);
|
tag = bytestream2_get_le32(&s->gb);
|
||||||
|
|
@ -1337,7 +1340,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||||
s->have_srgb = 1;
|
s->have_srgb = 1;
|
||||||
break;
|
break;
|
||||||
case MKTAG('i', 'C', 'C', 'P'): {
|
case MKTAG('i', 'C', 'C', 'P'): {
|
||||||
if ((ret = decode_iccp_chunk(s, &gb_chunk, p)) < 0)
|
if ((ret = decode_iccp_chunk(s, &gb_chunk)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1382,6 +1385,9 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||||
}
|
}
|
||||||
exit_loop:
|
exit_loop:
|
||||||
|
|
||||||
|
if (!p)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (avctx->codec_id == AV_CODEC_ID_PNG &&
|
if (avctx->codec_id == AV_CODEC_ID_PNG &&
|
||||||
avctx->skip_frame == AVDISCARD_ALL) {
|
avctx->skip_frame == AVDISCARD_ALL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1642,7 +1648,7 @@ static int decode_frame_apng(AVCodecContext *avctx, AVFrame *p,
|
||||||
if ((ret = inflateReset(&s->zstream.zstream)) != Z_OK)
|
if ((ret = inflateReset(&s->zstream.zstream)) != Z_OK)
|
||||||
return AVERROR_EXTERNAL;
|
return AVERROR_EXTERNAL;
|
||||||
bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size);
|
bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size);
|
||||||
if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0)
|
if ((ret = decode_frame_common(avctx, s, NULL, avpkt)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,6 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Konstantin Shishkov
|
* Copyright (c) 2012 Konstantin Shishkov
|
||||||
*
|
*
|
||||||
* This encoder appears to be based on Anatoliy Wassermans considering
|
|
||||||
* similarities in the bugs.
|
|
||||||
*
|
|
||||||
* This file is part of FFmpeg.
|
* This file is part of FFmpeg.
|
||||||
*
|
*
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o
|
||||||
RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o
|
RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o
|
||||||
OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
|
OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
|
||||||
RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
|
RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
|
||||||
OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
|
OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o
|
||||||
riscv/audiodsp_rvf.o
|
RV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvf.o
|
||||||
RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
|
RVV-OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_rvv.o
|
||||||
OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o \
|
OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_init.o
|
||||||
riscv/bswapdsp_rvb.o
|
RV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvb.o
|
||||||
RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o
|
RVV-OBJS-$(CONFIG_BSWAPDSP) += riscv/bswapdsp_rvv.o
|
||||||
OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o
|
OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o
|
||||||
RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o
|
RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o
|
||||||
|
|
@ -14,8 +14,8 @@ OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o
|
||||||
RVV-OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_rvv.o
|
RVV-OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_rvv.o
|
||||||
OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o
|
OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o
|
||||||
RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o
|
RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o
|
||||||
OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \
|
OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o
|
||||||
riscv/pixblockdsp_rvi.o
|
RV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvi.o
|
||||||
RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
|
RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
|
||||||
OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
|
OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
|
||||||
RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
|
RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ void ff_vector_clipf_rvv(float *dst, const float *src, int len, float min, float
|
||||||
|
|
||||||
av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)
|
av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)
|
||||||
{
|
{
|
||||||
|
#if HAVE_RV
|
||||||
int flags = av_get_cpu_flags();
|
int flags = av_get_cpu_flags();
|
||||||
|
|
||||||
if (flags & AV_CPU_FLAG_RVF)
|
if (flags & AV_CPU_FLAG_RVF)
|
||||||
|
|
@ -45,4 +46,5 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c)
|
||||||
if (flags & AV_CPU_FLAG_RVV_F32)
|
if (flags & AV_CPU_FLAG_RVV_F32)
|
||||||
c->vector_clipf = ff_vector_clipf_rvv;
|
c->vector_clipf = ff_vector_clipf_rvv;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ void ff_bswap16_buf_rvv(uint16_t *dst, const uint16_t *src, int len);
|
||||||
|
|
||||||
av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
|
av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
|
||||||
{
|
{
|
||||||
|
#if HAVE_RV
|
||||||
int cpu_flags = av_get_cpu_flags();
|
int cpu_flags = av_get_cpu_flags();
|
||||||
|
|
||||||
#if (__riscv_xlen >= 64)
|
#if (__riscv_xlen >= 64)
|
||||||
|
|
@ -43,4 +44,5 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c)
|
||||||
c->bswap16_buf = ff_bswap16_buf_rvv;
|
c->bswap16_buf = ff_bswap16_buf_rvv;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,
|
||||||
AVCodecContext *avctx,
|
AVCodecContext *avctx,
|
||||||
unsigned high_bit_depth)
|
unsigned high_bit_depth)
|
||||||
{
|
{
|
||||||
|
#if HAVE_RV
|
||||||
int cpu_flags = av_get_cpu_flags();
|
int cpu_flags = av_get_cpu_flags();
|
||||||
|
|
||||||
if (cpu_flags & AV_CPU_FLAG_RVI) {
|
if (cpu_flags & AV_CPU_FLAG_RVI) {
|
||||||
|
|
@ -62,4 +63,5 @@ av_cold void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,
|
||||||
c->diff_pixels_unaligned = c->diff_pixels = ff_diff_pixels_rvv;
|
c->diff_pixels_unaligned = c->diff_pixels = ff_diff_pixels_rvv;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ static int chctx_init(RKAContext *s, ChContext *c,
|
||||||
c->bprob[0] = s->bprob[0];
|
c->bprob[0] = s->bprob[0];
|
||||||
c->bprob[1] = s->bprob[1];
|
c->bprob[1] = s->bprob[1];
|
||||||
|
|
||||||
c->srate_pad = (sample_rate << 13) / 44100 & 0xFFFFFFFCU;
|
c->srate_pad = ((int64_t)sample_rate << 13) / 44100 & 0xFFFFFFFCU;
|
||||||
c->pos_idx = 1;
|
c->pos_idx = 1;
|
||||||
|
|
||||||
for (int i = 0; i < FF_ARRAY_ELEMS(s->bprob[0]); i++)
|
for (int i = 0; i < FF_ARRAY_ELEMS(s->bprob[0]); i++)
|
||||||
|
|
@ -691,7 +691,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
|
||||||
else
|
else
|
||||||
split = size >> 4;
|
split = size >> 4;
|
||||||
|
|
||||||
if (size <= 0)
|
if (size <= 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (int x = 0; x < size;) {
|
for (int x = 0; x < size;) {
|
||||||
|
|
@ -723,34 +723,34 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
|
||||||
last_val = val;
|
last_val = val;
|
||||||
src = &ctx->buf1[off + -1];
|
src = &ctx->buf1[off + -1];
|
||||||
for (int i = 0; i < filt.size && i < 15; i++)
|
for (int i = 0; i < filt.size && i < 15; i++)
|
||||||
sum += filt.coeffs[i] * src[-i];
|
sum += filt.coeffs[i] * (unsigned)src[-i];
|
||||||
sum = sum * 2;
|
sum = sum * 2U;
|
||||||
for (int i = 15; i < filt.size; i++)
|
for (int i = 15; i < filt.size; i++)
|
||||||
sum += filt.coeffs[i] * src[-i];
|
sum += filt.coeffs[i] * (unsigned)src[-i];
|
||||||
sum = sum >> 6;
|
sum = sum >> 6;
|
||||||
if (ctx->cmode == 0) {
|
if (ctx->cmode == 0) {
|
||||||
if (bits == 0) {
|
if (bits == 0) {
|
||||||
ctx->buf1[off] = sum + val;
|
ctx->buf1[off] = sum + val;
|
||||||
} else {
|
} else {
|
||||||
ctx->buf1[off] = (val + (sum >> bits) << bits) +
|
ctx->buf1[off] = (val + (sum >> bits)) * (1U << bits) +
|
||||||
(((1U << bits) - 1U) & ctx->buf1[off + -1]);
|
(((1U << bits) - 1U) & ctx->buf1[off + -1]);
|
||||||
}
|
}
|
||||||
ctx->buf0[off] = ctx->buf1[off] + ctx->buf0[off + -1];
|
ctx->buf0[off] = ctx->buf1[off] + (unsigned)ctx->buf0[off + -1];
|
||||||
} else {
|
} else {
|
||||||
val <<= ctx->cmode;
|
val *= 1U << ctx->cmode;
|
||||||
sum += ctx->buf0[off + -1] + val;
|
sum += ctx->buf0[off + -1] + (unsigned)val;
|
||||||
switch (s->bps) {
|
switch (s->bps) {
|
||||||
case 16: sum = av_clip_int16(sum); break;
|
case 16: sum = av_clip_int16(sum); break;
|
||||||
case 8: sum = av_clip_int8(sum); break;
|
case 8: sum = av_clip_int8(sum); break;
|
||||||
}
|
}
|
||||||
ctx->buf1[off] = sum - ctx->buf0[off + -1];
|
ctx->buf1[off] = sum - ctx->buf0[off + -1];
|
||||||
ctx->buf0[off] = sum;
|
ctx->buf0[off] = sum;
|
||||||
m += FFABS(ctx->buf1[off]);
|
m += (unsigned)FFABS(ctx->buf1[off]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ctx->cmode2 != 0) {
|
if (ctx->cmode2 != 0) {
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (int i = (m << 6) / split; i > 0; i = i >> 1)
|
for (int i = (signed)((unsigned)m << 6) / split; i > 0; i = i >> 1)
|
||||||
sum++;
|
sum++;
|
||||||
sum = sum - (ctx->cmode2 + 7);
|
sum = sum - (ctx->cmode2 + 7);
|
||||||
ctx->cmode = FFMAX(sum, tab[ctx->cmode2]);
|
ctx->cmode = FFMAX(sum, tab[ctx->cmode2]);
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,10 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ff_set_cmp(&s->mecc, s->mecc.me_cmp, s->avctx->me_cmp);
|
ret = ff_set_cmp(&s->mecc, s->mecc.me_cmp, s->avctx->me_cmp);
|
||||||
ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, s->avctx->me_sub_cmp);
|
ret |= ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, s->avctx->me_sub_cmp);
|
||||||
|
if (ret < 0)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
s->input_picture = av_frame_alloc();
|
s->input_picture = av_frame_alloc();
|
||||||
if (!s->input_picture)
|
if (!s->input_picture)
|
||||||
|
|
@ -1551,10 +1553,10 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
|
||||||
int level, orientation, x, y;
|
int level, orientation, x, y;
|
||||||
|
|
||||||
for(level=0; level<s->spatial_decomposition_count; level++){
|
for(level=0; level<s->spatial_decomposition_count; level++){
|
||||||
|
int64_t error=0;
|
||||||
for(orientation=level ? 1 : 0; orientation<4; orientation++){
|
for(orientation=level ? 1 : 0; orientation<4; orientation++){
|
||||||
SubBand *b= &p->band[level][orientation];
|
SubBand *b= &p->band[level][orientation];
|
||||||
IDWTELEM *ibuf= b->ibuf;
|
IDWTELEM *ibuf= b->ibuf;
|
||||||
int64_t error=0;
|
|
||||||
|
|
||||||
memset(s->spatial_idwt_buffer, 0, sizeof(*s->spatial_idwt_buffer)*width*height);
|
memset(s->spatial_idwt_buffer, 0, sizeof(*s->spatial_idwt_buffer)*width*height);
|
||||||
ibuf[b->width/2 + b->height/2*b->stride]= 256*16;
|
ibuf[b->width/2 + b->height/2*b->stride]= 256*16;
|
||||||
|
|
@ -1565,9 +1567,13 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
|
||||||
error += d*d;
|
error += d*d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (orientation == 2)
|
||||||
|
error /= 2;
|
||||||
b->qlog= (int)(QROOT * log2(352256.0/sqrt(error)) + 0.5);
|
b->qlog= (int)(QROOT * log2(352256.0/sqrt(error)) + 0.5);
|
||||||
|
if (orientation != 1)
|
||||||
|
error = 0;
|
||||||
}
|
}
|
||||||
|
p->band[level][1].qlog = p->band[level][2].qlog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,7 @@ static void predictor_init_state(int *k, int *state, int order)
|
||||||
|
|
||||||
static int predictor_calc_error(int *k, int *state, int order, int error)
|
static int predictor_calc_error(int *k, int *state, int order, int error)
|
||||||
{
|
{
|
||||||
int i, x = error - shift_down(k[order-1] * (unsigned)state[order-1], LATTICE_SHIFT);
|
int i, x = error - (unsigned)shift_down(k[order-1] * (unsigned)state[order-1], LATTICE_SHIFT);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
int *k_ptr = &(k[order-2]),
|
int *k_ptr = &(k[order-2]),
|
||||||
|
|
@ -1013,7 +1013,7 @@ static int sonic_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
if (s->lossless)
|
if (s->lossless)
|
||||||
quant = 1;
|
quant = 1;
|
||||||
else
|
else
|
||||||
quant = get_symbol(&c, state, 0) * SAMPLE_FACTOR;
|
quant = get_symbol(&c, state, 0) * (unsigned)SAMPLE_FACTOR;
|
||||||
|
|
||||||
// av_log(NULL, AV_LOG_INFO, "quant: %d\n", quant);
|
// av_log(NULL, AV_LOG_INFO, "quant: %d\n", quant);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,9 @@ int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
||||||
if (ti->flags & TAK_FRAME_FLAG_HAS_METADATA)
|
if (ti->flags & TAK_FRAME_FLAG_HAS_METADATA)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
|
if (get_bits_left(gb) < 24)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
skip_bits(gb, 24);
|
skip_bits(gb, 24);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ static void decorrelate_ls(int32_t *p1, int32_t *p2, int length)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
int32_t a = p1[i];
|
uint32_t a = p1[i];
|
||||||
int32_t b = p2[i];
|
uint32_t b = p2[i];
|
||||||
p2[i] = a + b;
|
p2[i] = a + b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -39,8 +39,8 @@ static void decorrelate_sr(int32_t *p1, int32_t *p2, int length)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
int32_t a = p1[i];
|
uint32_t a = p1[i];
|
||||||
int32_t b = p2[i];
|
uint32_t b = p2[i];
|
||||||
p1[i] = b - a;
|
p1[i] = b - a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ static void decorrelate_sm(int32_t *p1, int32_t *p2, int length)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
int32_t a = p1[i];
|
uint32_t a = p1[i];
|
||||||
int32_t b = p2[i];
|
int32_t b = p2[i];
|
||||||
a -= b >> 1;
|
a -= b >> 1;
|
||||||
p1[i] = a;
|
p1[i] = a;
|
||||||
|
|
@ -63,7 +63,7 @@ static void decorrelate_sf(int32_t *p1, int32_t *p2, int length, int dshift, int
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
int32_t a = p1[i];
|
uint32_t a = p1[i];
|
||||||
int32_t b = p2[i];
|
int32_t b = p2[i];
|
||||||
b = (unsigned)((int)(dfactor * (unsigned)(b >> dshift) + 128) >> 8) << dshift;
|
b = (unsigned)((int)(dfactor * (unsigned)(b >> dshift) + 128) >> 8) << dshift;
|
||||||
p1[i] = b - a;
|
p1[i] = b - a;
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,13 @@ int main(void){
|
||||||
#define width 256
|
#define width 256
|
||||||
#define height 256
|
#define height 256
|
||||||
int buffer[2][width*height];
|
int buffer[2][width*height];
|
||||||
|
short obuffer[width*height];
|
||||||
SnowContext s;
|
SnowContext s;
|
||||||
int i;
|
int i;
|
||||||
AVLFG prng;
|
AVLFG prng;
|
||||||
s.spatial_decomposition_count=6;
|
s.spatial_decomposition_count=6;
|
||||||
s.spatial_decomposition_type=1;
|
s.spatial_decomposition_type=1;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
s.temp_dwt_buffer = av_calloc(width, sizeof(*s.temp_dwt_buffer));
|
s.temp_dwt_buffer = av_calloc(width, sizeof(*s.temp_dwt_buffer));
|
||||||
s.temp_idwt_buffer = av_calloc(width, sizeof(*s.temp_idwt_buffer));
|
s.temp_idwt_buffer = av_calloc(width, sizeof(*s.temp_idwt_buffer));
|
||||||
|
|
@ -49,24 +51,34 @@ int main(void){
|
||||||
|
|
||||||
printf("testing 5/3 DWT\n");
|
printf("testing 5/3 DWT\n");
|
||||||
for(i=0; i<width*height; i++)
|
for(i=0; i<width*height; i++)
|
||||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
|
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 19000 - 9000;
|
||||||
|
|
||||||
ff_spatial_dwt(buffer[0], s.temp_dwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
ff_spatial_dwt(buffer[0], s.temp_dwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||||
ff_spatial_idwt((IDWTELEM*)buffer[0], s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
for(i=0; i<width*height; i++)
|
||||||
|
obuffer[i] = buffer[0][i];
|
||||||
|
ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||||
|
|
||||||
for(i=0; i<width*height; i++)
|
for(i=0; i<width*height; i++)
|
||||||
if(buffer[0][i]!= buffer[1][i]) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
|
if(buffer[1][i]!= obuffer[i]) {
|
||||||
|
printf("fsck: %4dx%4dx %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
printf("testing 9/7 DWT\n");
|
printf("testing 9/7 DWT\n");
|
||||||
s.spatial_decomposition_type=0;
|
s.spatial_decomposition_type=0;
|
||||||
for(i=0; i<width*height; i++)
|
for(i=0; i<width*height; i++)
|
||||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
|
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 11000 - 5000;
|
||||||
|
|
||||||
ff_spatial_dwt(buffer[0], s.temp_dwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
ff_spatial_dwt(buffer[0], s.temp_dwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||||
ff_spatial_idwt((IDWTELEM*)buffer[0], s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
for(i=0; i<width*height; i++)
|
||||||
|
obuffer[i] = buffer[0][i];
|
||||||
|
ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||||
|
|
||||||
for(i=0; i<width*height; i++)
|
for(i=0; i<width*height; i++)
|
||||||
if(FFABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
|
if(FFABS(buffer[1][i] - obuffer[i])>20) {
|
||||||
|
printf("fsck: %4dx%4d %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int level, orientation, x, y;
|
int level, orientation, x, y;
|
||||||
|
|
@ -81,18 +93,18 @@ int main(void){
|
||||||
int w= width >> (s.spatial_decomposition_count-level);
|
int w= width >> (s.spatial_decomposition_count-level);
|
||||||
int h= height >> (s.spatial_decomposition_count-level);
|
int h= height >> (s.spatial_decomposition_count-level);
|
||||||
int stride= width << (s.spatial_decomposition_count-level);
|
int stride= width << (s.spatial_decomposition_count-level);
|
||||||
DWTELEM *buf= buffer[0];
|
IDWTELEM *buf= obuffer;
|
||||||
int64_t error=0;
|
int64_t error=0;
|
||||||
|
|
||||||
if(orientation&1) buf+=w;
|
if(orientation&1) buf+=w;
|
||||||
if(orientation>1) buf+=stride>>1;
|
if(orientation>1) buf+=stride>>1;
|
||||||
|
|
||||||
memset(buffer[0], 0, sizeof(int)*width*height);
|
memset(obuffer, 0, sizeof(short)*width*height);
|
||||||
buf[w/2 + h/2*stride]= 256*256;
|
buf[w/2 + h/2*stride]= 8*256;
|
||||||
ff_spatial_idwt((IDWTELEM*)buffer[0], s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||||
for(y=0; y<height; y++){
|
for(y=0; y<height; y++){
|
||||||
for(x=0; x<width; x++){
|
for(x=0; x<width; x++){
|
||||||
int64_t d= buffer[0][x + y*width];
|
int64_t d= obuffer[x + y*width];
|
||||||
error += d*d;
|
error += d*d;
|
||||||
if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9 && level==2) printf("%8"PRId64" ", d);
|
if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9 && level==2) printf("%8"PRId64" ", d);
|
||||||
}
|
}
|
||||||
|
|
@ -132,5 +144,5 @@ int main(void){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1451,7 +1451,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||||
break;
|
break;
|
||||||
case TIFF_GRAY_RESPONSE_CURVE:
|
case TIFF_GRAY_RESPONSE_CURVE:
|
||||||
case DNG_LINEARIZATION_TABLE:
|
case DNG_LINEARIZATION_TABLE:
|
||||||
if (count > FF_ARRAY_ELEMS(s->dng_lut))
|
if (count < 1 || count > FF_ARRAY_ELEMS(s->dng_lut))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
s->dng_lut[i] = ff_tget(&s->gb, type, s->le);
|
s->dng_lut[i] = ff_tget(&s->gb, type, s->le);
|
||||||
|
|
|
||||||
|
|
@ -408,6 +408,11 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s->h & 3) {
|
||||||
|
avpriv_request_sample(s->avctx, "Frame with height not being a multiple of 4");
|
||||||
|
return AVERROR_PATCHWELCOME;
|
||||||
|
}
|
||||||
|
|
||||||
if (s->w != s->avctx->width || s->h != s->avctx->height ||
|
if (s->w != s->avctx->width || s->h != s->avctx->height ||
|
||||||
new_pix_fmt != s->avctx->pix_fmt) {
|
new_pix_fmt != s->avctx->pix_fmt) {
|
||||||
av_frame_unref(s->frame);
|
av_frame_unref(s->frame);
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
if (s->channels > 1) {
|
if (s->channels > 1) {
|
||||||
int32_t *r = p - 1;
|
int32_t *r = p - 1;
|
||||||
for (*p += *r / 2; r > (int32_t*)p - s->channels; r--)
|
for (*p += *r / 2; r > (int32_t*)p - s->channels; r--)
|
||||||
*r = *(r + 1) - *r;
|
*r = *(r + 1) - (unsigned)*r;
|
||||||
}
|
}
|
||||||
cur_chan = 0;
|
cur_chan = 0;
|
||||||
i++;
|
i++;
|
||||||
|
|
|
||||||
|
|
@ -317,12 +317,13 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
|
if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
|
||||||
w_align = FFMAX(w_align, 8);
|
w_align = FFMAX(w_align, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
*width = FFALIGN(*width, w_align);
|
*width = FFALIGN(*width, w_align);
|
||||||
*height = FFALIGN(*height, h_align);
|
*height = FFALIGN(*height, h_align);
|
||||||
if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
|
if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
|
||||||
|
s->codec_id == AV_CODEC_ID_VC1 || s->codec_id == AV_CODEC_ID_WMV3 ||
|
||||||
s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
|
s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
|
||||||
s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
|
s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
|
||||||
) {
|
) {
|
||||||
|
|
@ -336,6 +337,9 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||||
// the next rounded up width is 32
|
// the next rounded up width is 32
|
||||||
*width = FFMAX(*width, 32);
|
*width = FFMAX(*width, 32);
|
||||||
}
|
}
|
||||||
|
if (s->codec_id == AV_CODEC_ID_SVQ3) {
|
||||||
|
*width = FFMAX(*width, 32);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
linesize_align[i] = STRIDE_ALIGN;
|
linesize_align[i] = STRIDE_ALIGN;
|
||||||
|
|
@ -637,9 +641,9 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
||||||
if (sr > 0) {
|
if (sr > 0) {
|
||||||
/* calc from sample rate */
|
/* calc from sample rate */
|
||||||
if (id == AV_CODEC_ID_TTA)
|
if (id == AV_CODEC_ID_TTA)
|
||||||
return 256 * sr / 245;
|
return 256ll * sr / 245;
|
||||||
else if (id == AV_CODEC_ID_DST)
|
else if (id == AV_CODEC_ID_DST)
|
||||||
return 588 * sr / 44100;
|
return 588ll * sr / 44100;
|
||||||
else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
|
else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
|
||||||
if (sr / 22050 > 22)
|
if (sr / 22050 > 22)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,9 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
|
||||||
info->f_code[1][0] = s->mpeg_f_code[1][0];
|
info->f_code[1][0] = s->mpeg_f_code[1][0];
|
||||||
info->f_code[1][1] = s->mpeg_f_code[1][1];
|
info->f_code[1][1] = s->mpeg_f_code[1][1];
|
||||||
for (i = 0; i < 64; ++i) {
|
for (i = 0; i < 64; ++i) {
|
||||||
info->intra_quantizer_matrix[i] = s->intra_matrix[i];
|
int n = s->idsp.idct_permutation[i];
|
||||||
info->non_intra_quantizer_matrix[i] = s->inter_matrix[i];
|
info->intra_quantizer_matrix[i] = s->intra_matrix[n];
|
||||||
|
info->non_intra_quantizer_matrix[i] = s->inter_matrix[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ff_vdpau_common_start_frame(pic_ctx, buffer, size);
|
return ff_vdpau_common_start_frame(pic_ctx, buffer, size);
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,9 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
|
||||||
info->alternate_vertical_scan_flag = s->alternate_scan;
|
info->alternate_vertical_scan_flag = s->alternate_scan;
|
||||||
info->top_field_first = s->top_field_first;
|
info->top_field_first = s->top_field_first;
|
||||||
for (i = 0; i < 64; ++i) {
|
for (i = 0; i < 64; ++i) {
|
||||||
info->intra_quantizer_matrix[i] = s->intra_matrix[i];
|
int n = s->idsp.idct_permutation[i];
|
||||||
info->non_intra_quantizer_matrix[i] = s->inter_matrix[i];
|
info->intra_quantizer_matrix[i] = s->intra_matrix[n];
|
||||||
|
info->non_intra_quantizer_matrix[i] = s->inter_matrix[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
ff_vdpau_common_start_frame(pic_ctx, buffer, size);
|
ff_vdpau_common_start_frame(pic_ctx, buffer, size);
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
|
||||||
av_assert2(start_x < end_x && block_w);
|
av_assert2(start_x < end_x && block_w);
|
||||||
|
|
||||||
w = end_x - start_x;
|
w = end_x - start_x;
|
||||||
src += start_y * src_linesize + start_x * sizeof(pixel);
|
src += start_y * src_linesize + start_x * (ptrdiff_t)sizeof(pixel);
|
||||||
buf += start_x * sizeof(pixel);
|
buf += start_x * sizeof(pixel);
|
||||||
|
|
||||||
// top
|
// top
|
||||||
|
|
@ -87,7 +87,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
|
||||||
buf += buf_linesize;
|
buf += buf_linesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf -= block_h * buf_linesize + start_x * sizeof(pixel);
|
buf -= block_h * buf_linesize + start_x * (ptrdiff_t)sizeof(pixel);
|
||||||
while (block_h--) {
|
while (block_h--) {
|
||||||
pixel *bufp = (pixel *) buf;
|
pixel *bufp = (pixel *) buf;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
#include "codec_internal.h"
|
#include "codec_internal.h"
|
||||||
#include "decode.h"
|
#include "decode.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
|
#include "internal.h"
|
||||||
#include "vorbis.h"
|
#include "vorbis.h"
|
||||||
#include "vorbisdsp.h"
|
#include "vorbisdsp.h"
|
||||||
#include "vorbis_data.h"
|
#include "vorbis_data.h"
|
||||||
|
|
@ -134,7 +135,6 @@ typedef struct vorbis_context_s {
|
||||||
av_tx_fn mdct_fn[2];
|
av_tx_fn mdct_fn[2];
|
||||||
|
|
||||||
uint8_t first_frame;
|
uint8_t first_frame;
|
||||||
int64_t initial_pts;
|
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
uint8_t audio_channels;
|
uint8_t audio_channels;
|
||||||
uint32_t audio_samplerate;
|
uint32_t audio_samplerate;
|
||||||
|
|
@ -368,6 +368,10 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
|
||||||
unsigned codebook_value_bits = get_bits(gb, 4) + 1;
|
unsigned codebook_value_bits = get_bits(gb, 4) + 1;
|
||||||
unsigned codebook_sequence_p = get_bits1(gb);
|
unsigned codebook_sequence_p = get_bits1(gb);
|
||||||
|
|
||||||
|
if (!isfinite(codebook_minimum_value) || !isfinite(codebook_delta_value)) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
ff_dlog(NULL, " We expect %d numbers for building the codevectors. \n",
|
ff_dlog(NULL, " We expect %d numbers for building the codevectors. \n",
|
||||||
codebook_lookup_values);
|
codebook_lookup_values);
|
||||||
ff_dlog(NULL, " delta %f minmum %f \n",
|
ff_dlog(NULL, " delta %f minmum %f \n",
|
||||||
|
|
@ -1464,6 +1468,9 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||||
unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
|
unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
|
||||||
vorbis_codebook codebook = vc->codebooks[vqbook];
|
vorbis_codebook codebook = vc->codebooks[vqbook];
|
||||||
|
|
||||||
|
if (get_bits_left(gb) <= 0)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (vr_type == 0) {
|
if (vr_type == 0) {
|
||||||
|
|
||||||
voffs = voffset+j*vlen;
|
voffs = voffset+j*vlen;
|
||||||
|
|
@ -1839,13 +1846,7 @@ static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||||
|
|
||||||
if (!vc->first_frame) {
|
if (!vc->first_frame) {
|
||||||
vc->first_frame = 1;
|
vc->first_frame = 1;
|
||||||
vc->initial_pts = frame->pts;
|
avctx->internal->skip_samples = len;
|
||||||
}
|
|
||||||
|
|
||||||
if (frame->pts == vc->initial_pts) {
|
|
||||||
*got_frame_ptr = 0;
|
|
||||||
av_frame_unref(frame);
|
|
||||||
return buf_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ff_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",
|
ff_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",
|
||||||
|
|
@ -1877,6 +1878,7 @@ static av_cold void vorbis_decode_flush(AVCodecContext *avctx)
|
||||||
sizeof(*vc->saved));
|
sizeof(*vc->saved));
|
||||||
}
|
}
|
||||||
vc->previous_window = -1;
|
vc->previous_window = -1;
|
||||||
|
vc->first_frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FFCodec ff_vorbis_decoder = {
|
const FFCodec ff_vorbis_decoder = {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue