Compare commits

...

106 Commits

Author SHA1 Message Date
Luca Barbato
b62191f9c1 librtmp: Avoid an infiniloop setting connection arguments
The exit condition was missing.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
(cherry picked from commit e85d38c20a8893cb59d7c86f74481f2497882196)
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-07-26 12:07:55 -07:00
James Almer
21c36d83f8 avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 5adfbd391847fcdaea1e9b105fae2dd90af2a733)
2016-07-25 10:00:10 -03:00
James Almer
4774eb8128 Revert "configure: Enable GCC vectorization on ≥4.9 on x86"
This reverts commit cb8646af24bd8e9627cc5e1c62b049a00fe0b07b.

This change has brough more issues than benefits, between compilation
time failures depending on flags used and code miscompilation causing
runtime crashes.

See the "[PATCH 2/2] configure: Enable GCC vectorization on ≥4.9"
thread in the ffmpeg-devel mailing list for the relevant discussion.

(cherry picked from commit fd6dbc53855fbfc9a782095d0ffe11dd3a98905f)
2016-07-09 17:39:31 -03:00
Michael Niedermayer
96f5019bde avcodec/libopenjpegenc: Set numresolutions by default to a value that is not too large
Fixes issues with libopenjpeg 2.1

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e9394ca63dab3434bc8e869de019ecd86cb604ac)
2016-07-01 00:01:46 -03:00
Timo Rothenpieler
bffe1c4222 ffplay: Fix usage of private lavfi API
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1bd9fb6de59bb96144ece914643d2d205818168d)
2016-06-29 22:49:58 -03:00
Michael Niedermayer
fbdf5ca763 tests/checkasm/checkasm: Disable checkasm_check_pixblockdsp for ppc64be
See: Ticket5508

Suggested-by: Carl
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e5d434b840404d84585456e51755e052a0fe0731)
2016-06-26 04:17:59 +02:00
Michael Niedermayer
c6470d8193 avcodec/mpegvideo: Deallocate last/next picture earlier
Fixes regression with mplayers direct rendering and reduces buffer count
pressure in some cases

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 39c0b22df42088cf4fb1ceb2447291c224a5c7ed)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
e5942c1436 avcodec/bmp_parser: Fix state
Fixes Ticket5598

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d0388bd32e1c84a9ef87ba6c448c7fffb6a9f259)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Thomas Guilbert
dab82a2a7c avformat/oggparseopus: Fix Undefined behavior in oggparseopus.c and libavformat/utils.c
Fixes: usan_granule_overflow

constant type fix by commiter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1a82d2cf8fb6a7e854e7548dfcf73c3d046b34ac)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
7f864badc0 avformat/utils: avoid overflow in compute_chapters_end() with huge durations
Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c1ed78a591f68f3c81eded0bfaac313937ffa3b6)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
cc1e01d8b6 avformat/utils: avoid overflow in update_stream_timings() with huge durations
Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2be3007ed55f1513bcae3d2a076e71878f48eb03)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
69c3dfdd54 doc/developer.texi: Add a code of conduct
See: [FFmpeg-devel] [Vote] Code of Conduct

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 89e9393022373bf97d528e6e9f2601ad0b3d0fc1)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Gregor Riepl
241f1e603f ffserver: fixed deallocation bug in build_feed_streams
Signed-off-by: Gregor Riepl <onitake@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d970f7ba31246040787e5ea6eb73bb85cafb932b)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
4d9fdca053 avcodec/diracdec: Fix potential integer overflow
Fixes CID1361948

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7ecfe4dc363435c81e66dd14881dc0b0ccc73fb1)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
b11900251f avformat/avidec: Detect index with too short entries
Fixes Ticket5498

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d08f2c172fd2baab022f0118f49e5b2852a2d463)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Chris Cunningham
145b18ce9a avformat/utils: Check negative bps before shifting in ff_get_pcm_codec_id()
Fixes: undefined shift.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2875745d354ab0ebc4af1ebaca5c5a8d26ccdc03)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
e5d167149d avformat/utils: Do not compute the bitrate from duration == 0
Fixes division by 0 in fate-acodec-ra144

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 635b2ec5f20d6cdef1adf4907ca28f8f09abcecc)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
ed71759fd0 ffmpeg: Check that r_frame_rate is set before attempting to use it
Avoids unexpected occurance and dependency on NaN behavior and divisions by 0

Testcase: fate-lavf-fate-avi_cram

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6085d6b2aeef28671614f625601a23cfc922d282)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
d7ae13d479 swresample/resample: Fix division by 0 with tap_count=1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit feeb3a92616310b5f79191b0ef3064712c40b7d3)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
1cd872a7d5 swresample/rematrix: Use clipping s16 rematrixing if overflows are possible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2f76157eb05bf63725f96167feda6b2e07501c7e)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:31 +02:00
Michael Niedermayer
f6586db165 swresample/rematrix: Use error diffusion to avoid error in the DC component of the matrix
This fixes the sum of the integer coefficients ending up summing to a value
larger than the value representing unity.

This issue occurs with qN0.dts when converting to stereo

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7fe81bc4f8ba684626fa08f7bef46da3e8abe373)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
Will Kelleher
7c43c48fda hevc: Fix memory leak related to a53_caption data
Signed-off-by: Will Kelleher <wkelleher@gogoair.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 964f07f68e1cc4e2d585615e2b1a1fade269afb0)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
Chris Cunningham
069eea16d9 libavformat/oggdec: Free stream private when header parsing fails.
Leaking this private structure opens up the possibility that it may
be re-used when parsing later packets in the stream. This is
problematic if the later packets are not the same codec type (e.g.
private allocated during Vorbis parsing, but later packets are Opus
and the private is assumed to be the oggopus_private type in
opus_header()).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 542f725964e52201000ec34e2f23229cf534ad3a)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
Michael Niedermayer
79181b97d4 avformat/utils: Check bps before using it in a shift in ff_get_pcm_codec_id()
Fixes undefined shift
Fixes: usan_shift

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ea791c080dd5494b3bee0c618a3f52e371b5f320)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
Michael Niedermayer
46360e36d9 avformat/oggparseopus: Check that granule pos is within the supported range
Larger values would imply file durations of astronomic proportions and cause
overflows

Fixes integer overflow
Fixes: usan_int64_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8efaee3710baa87af40556a622bf2d96a27c6425)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
Michael Niedermayer
ef2b8416d9 avcodec/mjpegdec: Do not try to detect last scan but apply idct after all scans for progressive jpeg
Fixes: IMG-20160418-WA0002.jpg

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit deaf58abf236e09fc9b97db29f1edd064e4b5ad4)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
Michael Niedermayer
9491f47035 avformat/options_table: Add missing identifier for very strict compliance
Fixes Ticket5443

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 11db7eee9b001d6992c34b65ee7b0d64f6f5c758)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
Michael Niedermayer
2fc7e5c1b5 avformat/ffmdec: Check pix_fmt
Fixes crash
Fixes Ticket5412

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 78baa450d9939957f52d5187beb95d763d2f1f18)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-05 02:40:30 +02:00
James Almer
68dcb46205 doc/general: update supported DCA extensions 2016-05-14 23:02:52 -03:00
James Almer
8dce66d33d avcodec/rscc: check input buffer size for deflate mode
Fixes overreads.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit b2244fa0a624f7e38893d58265e9c039bed2e4de)
2016-05-10 19:13:54 -03:00
foo86
08c21bcb5d avcodec/dca: fix sync word search error condition
This didn't actually check if sync word was found and always errored out
with "-err_detect explode" option enabled.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ce2f9fdb0a92956aedfa2c564d1374a2f1eebfbd)
2016-05-02 22:48:52 -03:00
Carl Eugen Hoyos
e675926a4f lavf/mpegts: Return small probe score for very short transport streams.
Fixes Debian bug 823098.

(cherry picked from commit 88a849c714c17ad80d411f68e6575dfa1c8e8358)
2016-05-02 22:48:45 -03:00
Michael Niedermayer
c66f4d1ae6 Changelog: Fix minor formating inconsistency
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-28 03:03:39 +02:00
Michael Niedermayer
ad559492dc update for 3.0.2
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-28 01:40:54 +02:00
Michael Niedermayer
8d0cfa68b9 avcodec/ttaenc: Reallocate packet if its too small
Fixes assertion failure
Fixes Ticket5394

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 005c61c6b8982f977e415aa69d2d2b42e6b7f3f2)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-26 19:49:09 +02:00
Shivraj Patil
83eaaae005 configure: build fix for P5600 with mips code restructuring
Note:- backporting commit 15ef98afd10b3696d29fb6d19606ba03a9dd47ad from head

Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-26 12:27:49 +02:00
Vicente Olivert Riera
a5638dbfba mips: add support for R6
Note:- backporting commit ad16eff64ba78d8dc98a8324640025c7cb2857f3 from head

Understanding the mips32r6 and mips64r6 ISAs in the configure script is
not enough. In order to have full support for MIPS R6 in FFmpeg we need
to be able to build it, and for that we need to make sure we don't use
incompatible assembler code which makes the build fail. Ifdefing the
offending code is sufficient to fix the problem.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-26 12:27:39 +02:00
Jan Ekström
666754c665 pgssubdec: fix subpicture output colorspace and range
Functionality used before didn't widen the values from limited to
full range. Additionally, now the decoder uses BT.709 where it
should be used according to the video resolution.

Default for not yet set colorimetry is BT.709 due to most observed
HDMV content being HD.

BT.709 coefficients were gathered from the first two parts of BT.709
to BT.2020 conversion guide in ARIB STD-B62 (Pt. 1, Chapter 6.2.2).
They were additionally confirmed by manually calculating values.

Fixes 
(cherry picked from commit 9779b6262471d553c1ed811ff7312564e39d8adf)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-26 02:47:09 +02:00
Michael Niedermayer
4c896d6bd4 avcodec/ac3dec: Reset SPX when switching from EAC3 to AC3
Fixes Ticket5319

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9ac154d1facd4756db6918f866dccf3e3ffb698c)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-25 04:27:29 +02:00
Michael Niedermayer
f2e9e4757f avfilter/vf_drawtext: Check return code of load_glyph()
Fixes segfault
Fixes Ticket5347

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2e67a99fbc6b99315925de40fc6fa7161576be10)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-24 12:41:09 +02:00
Michael Niedermayer
512c064cd9 avformat/mux: Check that deinit is set before calling it
Fixes null pointer dereference

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c84ba07db4abd123b2ad93784e312a24d9341553)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-24 12:40:58 +02:00
Paul B Mahol
7626fb6cbf avcodec/takdec: add code that got somehow lost in process of REing
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 38797a8033d061ade58b30b8ac86da222fe42a84)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-21 14:13:38 +02:00
Paul B Mahol
6fdd122b11 avcodec/apedec: fix decoding of stereo files with one channel full of silence
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 9149e9c0baaec122bc3da925d6068dffa60b5427)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-21 14:12:45 +02:00
Michael Niedermayer
264c9fe6aa avcodec/avpacket: Fix off by 5 error
Fixes out of array read
Fixes: mozilla bug 1266129
Found-by: Tyson Smith
Tested-by: Tyson Smith
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9f36ea57ae6eefb42432220feab0350494f4144c)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-21 00:54:00 +02:00
Ivan
76573c5239 avcodec/h264: Fix for H.264 configuration parsing
Sometimes video fails to decode if H.264 configuration changes mid stream.
The reason is that configuration parser assumes that nal_ref_idc is equal to 11b
while actually some codecs but 01b there. The H.264 spec is somewhat
vague about this but it looks like it allows any non-zero nal_ref_idc for sps/pps.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3a727606c474d3d0b9efa3c900294a84bdb5e331)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-17 02:40:53 +02:00
Michael Niedermayer
14fdebc4ff avcodec/bmp_parser: Ensure remaining_size is not too small in startcode packet crossing corner case
Fixes Ticket 5438

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8e26bdd59bf559d00c7e60c53fff292de10139ff)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-14 15:29:25 +02:00
Michael Niedermayer
325d0b64d5 avcodec/pngdec: Fix alpha detection with skip_frame
Fixes Ticket4816

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d433623fba2b273491ff7dda401648e7d07e19fe)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-09 01:12:32 +02:00
Michael Niedermayer
6103a8453f Changelog: Make formating consistent
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-04 22:45:14 +02:00
Marios Titas
47f0d80ee0 avfilter/src_movie: fix how we check for overflows with seek_point
Currently, if the movie source filter is used and a seek_point is
specified on a file that has a negative start time, ffmpeg will fail.

An easy way to reproduce this is as follows:
$ ffmpeg -vsync passthrough -filter_complex 'color=d=10,setpts=PTS-1/TB' test.mp4
$ ffmpeg -filter_complex 'movie=filename=test.mp4:seek_point=2' -f null -

The problem is caused by checking for int64_t overflow the wrong way.
In general, to check whether a + b overflows, it is not enough to do:
    a > INT64_MAX - b
because b might be negative; the correct way is:
    b > 0 && > a > INT64_MAX - b

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c1f9734f977f59bc0034096afbe8e43e40d93a5d)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-03 01:55:24 +02:00
Aaron Boxer
5d79566ab3 avcodec/j2kenc: Add attribution to OpenJPEG project:
http://ghostscript.com/~tor/gs-browse/gs/openjpeg/libopenjpeg/t1.c

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b6b4b0a65e02495edf9d7e5b23bef99a92921147)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-01 17:35:50 +02:00
Michael Niedermayer
fda00aa774 doc/Doxyfile: update for 3.0.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-29 04:25:48 +02:00
Michael Niedermayer
9b1b674ebe Changelog: update
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-29 04:23:42 +02:00
Michael Niedermayer
00b54d4625 avcodec/diracdec: check bitstream size related fields for overflows
Fixes segfault
Fixes Ticket5333

Regression since bfc8a4dabe5a0154b31128b59dca575010176441
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8f2a1990c06df73cf58401c8ba193711eb8947e7)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-29 03:25:15 +02:00
Michael Niedermayer
26d29f0c3d avcodec/h264_slice: Check PPS more extensively when its not copied
Fixes Ticket5371
Fixes null pointer dereference

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c50be7a52bc1e8e18a0059e489743ec12a43f257)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-29 03:25:15 +02:00
James Almer
7b1e020fc5 avformat/svag: fix division by zero
Fixes ticket 

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d5a3578350a3901a26df39df196bb085760ec46f)
2016-03-28 19:10:34 -03:00
Rostislav Pehlivanov
3d9ebfd272 Changelog: update for 3.0.1's vc2enc fixes
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-03-28 17:04:23 +01:00
Rostislav Pehlivanov
f01919b57a vc2enc: correctly zero out coefficient array padding
Credit for figuring this out goes to James Darnley.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
(cherry picked from commit 3ef10406e19663a78791ed1b38178fb00d4c7d88)
2016-03-28 17:02:05 +01:00
Rostislav Pehlivanov
6cb5bbc660 Changelog: update for 3.0.1's aacenc optimizations
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-03-28 16:59:14 +01:00
Ganesh Ajjanagadde
f281cb4ea9 lavc/aacenc_utils: replace powf(x,y) by expf(logf(x), y)
This is ~2x faster for y not an integer on Haswell+GCC, and should
generally be faster due to the fact that anyway powf essentially does
this under the hood. Made an inline function in lavu/internal.h for this
purpose.

Note that there are some accuracy differences, that should generally be
negligible. In particular, FATE still passes on this platform.

Results in ~ 7% speedup in aac encoding with -march=native, Haswell+GCC.
before:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac  6.05s user 0.06s system 104% cpu 5.821 total

after:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac  5.67s user 0.03s system 105% cpu 5.416 total

This is also faster than an alternative approach that pulls in powf, gets rid of
the crufty NaN checks and other special cases, exploits knowledge about the intervals, etc.
This of course does not exclude smarter approaches; just suggests that
there would need to be significant work on this front of lower utility than
searches for hotspots elsewhere.

Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
(cherry picked from commit bccc81dfa08e6561df6ed37860e3a08f7d983825)
2016-03-28 16:57:41 +01:00
Reimar Döffinger
b176ab0556 aacenc_utils: Use temporary variable.
This ensures gcc does not create unnecessary
loads or stores and possibly even does not vectorize
the negation.
Speeds up mp3 to aac transcoding with default settings
by 10% when using "gcc (Debian 5.3.1-10) 5.3.1 20160224".

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(cherry picked from commit b60dfae7af65c4c7d255ef599352f2c54964303d)
2016-03-28 16:56:27 +01:00
Reimar Döffinger
1cbe4ff2ac aacenc: avoid double in quantize_bands.
I cannot see any point whatsoever to use
double here instead of float, the results
are likely identical in all cases..
Using float allows for much more
efficient use of SIMD.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(cherry picked from commit 0a04c2885f02f7db6b410b6d43d120e5eb48dc18)
2016-03-28 16:56:11 +01:00
Ganesh Ajjanagadde
7c2576e15d lavc/aacenc_utils: replace sqrtf(Q*sqrtf(Q)) by precomputed value
It makes no sense whatsoever to do this at each function call; we
already have a table for this.

Yields a 2x improvement in find_min_book (x86-64, Haswell+GCC):
ffmpeg -i sin.flac -acodec aac -y sin.aac
find_min_book
old
    605 decicycles in find_min_book, 8388453 runs,    155 skips.9x
    606 decicycles in find_min_book,16776912 runs,    304 skips.9x
    607 decicycles in find_min_book,33553819 runs,    613 skips.2x
    607 decicycles in find_min_book,67107668 runs,   1196 skips.3x
    607 decicycles in find_min_book,134215360 runs,   2368 skips3x

new
    359 decicycles in find_min_book, 8388552 runs,     56 skips.3x
    360 decicycles in find_min_book,16777112 runs,    104 skips.1x
    361 decicycles in find_min_book,33554218 runs,    214 skips.4x
    361 decicycles in find_min_book,67108381 runs,    483 skips.5x
    361 decicycles in find_min_book,134216725 runs,   1003 skips5x

and more importantly a non-negligible speedup (~ 8%) to overall AAC encoding:
old:
ffmpeg -i sin.flac -acodec aac -strict -2 -y sin_new.aac  6.82s user 0.03s system 104% cpu 6.565 total
new:
ffmpeg -i sin.flac -acodec aac -strict -2 -y sin_old.aac  6.24s user 0.03s system 104% cpu 5.993 total

This also improves accuracy of the expression by ~ 2 ulp in some cases.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
(cherry picked from commit bd9c58756a50b52e495b748d6ea6b0aafe397c25)
2016-03-28 16:55:59 +01:00
Michael Niedermayer
526c7b2186 Update for 3.0.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 22:37:41 +01:00
Michael Niedermayer
2d0e415482 avcodec/libutvideodec: copy frame so it has reference counters when refcounted_frames is set
Reviewed-by: maintainer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0cd9ff4e3aa23318a855c21d60b1c9035b2b99d2)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:48 +01:00
Ico Doornekamp
daa6dc0a3b avformat/rtpdec_jpeg: fix low contrast image on low quality setting
Original mail and my own followup on ffmpeg-user earlier today:

I have a device sending out a MJPEG/RTP stream on a low quality setting.
Decoding and displaying the video with libavformat results in a washed
out, low contrast, greyish image. Playing the same stream with VLC results
in proper color representation.

Screenshots for comparison:

  http://zevv.nl/div/libav/shot-ffplay.jpg
  http://zevv.nl/div/libav/shot-vlc.jpg

A pcap capture of a few seconds of video and SDP file for playing the
stream are available at

  http://zevv.nl/div/libav/mjpeg.pcap
  http://zevv.nl/div/libav/mjpeg.sdp

I believe the problem might be in the calculation of the quantization
tables in the function create_default_qtables(), the attached patch
solves the issue for me.

The problem is that the argument 'q' is of the type uint8_t. According to the
JPEG standard, if 1 <= q <= 50, the scale factor 'S' should be 5000 / Q.
Because the create_default_qtables() reuses the variable 'q' to store the
result of this calculation, for small values of q < 19, q wil subsequently
overflow and give wrong results in the calculated quantization tables. The
patch below uses a new variable 'S' (same name as in RFC2435) with the proper
range to store the result of the division.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e3e6a2cff4af9542455d416faec4584d5e823d5d)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:48 +01:00
Michael Niedermayer
6e5648ad42 avformat/mpegtsenc: Fix used service
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 26811fd9468dc484402faca3ca33cacb2e58c53e)

Conflicts:

	libavformat/version.h
2016-03-26 21:52:48 +01:00
Michael Niedermayer
e15a48d35a avformat/mpegtsenc: Keep track of the program for each service
Simplifies code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 50d017a28171177b89c367194ec8d02f963e7e9e)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:48 +01:00
Michael Niedermayer
0fae52d7e3 avformat/file: Add crypto to default whitelist
Fixes Ticket5287

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit efa98cdc2ff17a2f3b0ceb69e22864fd5bc433db)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
50a639a62a avcodec/mjpegenc_common: Store approximate aspect if exact cannot be stored
Fixes Ticket5244

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 068026b0f7845e0f1850094d974f60d181480d64)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Mark Thompson
d6adcab842 lavc/hevc: Allow arbitrary garbage in bytestream as long as at least one NAL unit is found.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fbec157ea08f61063847bbe0dba28525e6283ff5)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
bf80b1d88d avcodec/resample: Remove disabled and faulty code
Fixes Ticket5345

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 50ef7361cb5f78c94da2323f3bae86c6bbd618c8)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Luca Barbato
53fffc9fc4 indeo2: Fix banding artefacts
Rename luma table to delta table and change how it is used.

CC: libav-stable@libav.org
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit f8c34f4b8d62afad3f63cf3d9617d73735bef8c1)
(cherry picked from commit 73f3c8f73edf0a69502233b2c50fa9e7104f99ec)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Luca Barbato
b0e836466f indeo2data: K&R formatting cosmetics
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit d4066a702407352a0648af882c34ea81a404fa2b)
(cherry picked from commit 522ab0b9a92962edda7156a91a494a1e2b8a7f64)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
e158936712 avformat/hlsenc: Fix passing options, regression since bc9a5965c815cf7fd998d8ce14a18b8e861dd9ce
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b2ab3398f59ed18a565063584f961ff84484d699)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
c8977ec6e9 avutil/random_seed: Add the runtime in cycles of the main loop to the entropy pool
This should theoretically improve the randomness slightly

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2540d884f3fd7cfac503e048112098967be2569a)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Martin Cracauer
934bc32acc avutil/channel_layout: AV_CH_LAYOUT_6POINT1_BACK not reachable in parsing
Trying to make heads and tails out of DTS 6.1 I can across this typo.

I also noticed that this wiki page is incorrect or misleading, the
channel order for 6.1 given does not match the source code.  At the
least it should be clarified that the layout given does not apply to
DTS.  https://trac.ffmpeg.org/wiki/AudioChannelManipulation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 73d1398f0c4ce2de16790f46e05a79242137d153)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
64f2b48be0 avformat/concatdec: set safe mode to enabled instead of auto
This is safer, as a selected demuxer could still mean that it was auto-detected
by a user application

Reviewed-previously-by: Nicolas George <george@nsup.org>
Reviewed-previously-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 689211d5727231c3fe92762d224dbadebdbf4e30)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
756f4b586a avformat/utils: fix dts from pts code in compute_pkt_fields() during ascending delay
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit de1de4932419d0fb49c9c23f62e68cdbe90d0ee3)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Boris Nagels
56c4dca5ae avformat/rtpenc: Fix integer overflow in NTP_TO_RTP_FORMAT
RTCP synchronization packet was broken since commit in ffmpeg version > 2.8.3
(commit: e04b039b1528f4c7df5c2b93865651bfea168a19) Since this commit (2e814d0329aded98c811d0502839618f08642685)
"rtpenc: Simplify code by introducing a macro for rescaling NTP timestamps", NTP_TO_RTP_FORMAT
uses av_rescale_rnd() function to add the data to the packet.

This causes an overflow in the av_rescale_rnd() function and it will return INT64_MIN.
Causing the NTP stamp in the RTCP packet to have an invalid value.

Github: Closes 

Reverting commit '2e814d0329aded98c811d0502839618f08642685' solves the problem.
(cherry picked from commit 1109ed7973c7fd1e7001898adc4976590d862122)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
foo86
da6ccfe18e avcodec/dca: clear X96 channels if nothing was decoded
The first X96 channel set can have more channels than core, causing X96
decoding to be skipped. Clear the number of decoded X96 channels to zero
in this rudimentary case.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit db44b599805fdd96940cf2e5a336f872648bbda1)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
27a61302b7 fate/aac: Increase fuzz from of fate-aac-pns-encode from 72 to 74 for Loongson
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c78a7267175a3d1e07b88be42f949f95124925e3)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
b4be953c55 avformat/cache: Fix memleak of tree entries
Found-by: jamrial

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 554f6e930ce05a4c5449efcaae36bdafe2d9de74)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Rodger Combs
3b179b6302 lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac
(cherry picked from commit 22dbc1caaf13e4bb17c9e0164a5b1ccaf490e428)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Rodger Combs
bf8f2fae2a lavf/mov: fix sidx with edit lists
(cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
0d7343f8dd avcodec/mjpegdec: Fix decoding slightly odd progressive jpeg
Fixes: ebd58db6-dc86-11e5-91c2-59daeddf50c7.jpg

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c6f4720b8664e6e22eb5b3da6bb48ed5b113f746)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
fb8676eb1c swscale/utils: Fix chrSrcHSubSample for GBRAP16
Fixes part of Ticket5264

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 67e5bd0c501f7568fc8d93284d0f7eb40663ab06)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
ca5c639446 swscale/input: Fix GBRAP16 input
Fixes part of Ticket5264

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit df36257a53561a51af969a6ea6319dd2579509b9)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
bd79dbfa2b avutil/pixdesc: Make get_color_type() aware of CIE XYZ formats
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1ec7a703806049265991723a8826bd61555edef4)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
c4765a41b9 avcodec/h264: Execute error concealment before marking the frame as done.
Fixes race condition causing artifacts
Fixes Ticket4122

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 98a0053d0f90e3309dc1038b1bae3a48bbd9067c)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
be5acd6cb1 swscale/x86/output: Fix yuv2planeX_16* with unaligned destination
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f6492a2ea8df80be0ed9591aee4019cef0e36e99)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
Michael Niedermayer
c3e7a7ef3f swscale/x86/output: Move code into yuv2planeX_mainloop
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d07f6e5f1c36be675e0900edba3e40a32f05f0f4)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:47 +01:00
KO Myung-Hun
9e4d297ba7 MAINTAINERS: add myself as an OS/2 maintainer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 346ec917646c18fc9e26bddf04bfa8f8f1e2e18f)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:46 +01:00
James Almer
373bc77a35 libwebpenc_animencoder: print library messages in verbose log levels
Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit f875ba48739f59691661393eed1f7cc2371c93f1)
2016-03-17 12:57:00 -03:00
James Almer
20d89a3a32 libwebpenc_animencoder: zero initialize the WebPAnimEncoderOptions struct
This zeroes the WebPAnimEncoderOptions.verbose field, silencing library info messages
printed to stderr.

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 626b6b769ced6d3e55d2661985ab2a1cb89f481e)
2016-03-17 12:56:30 -03:00
Hendrik Leppkes
ee7c347935 configure: check for SEC_I_CONTEXT_EXPIRED before enabling SChannel
Fixes build on mingw32, which lacks this constant.
2016-03-16 15:32:50 +01:00
Carl Eugen Hoyos
9da31a0373 lavf/http: Add httpproxy to the default protocol whitelist.
(cherry picked from commit 58fa694978735e30f433f8ede6c7f808b9409919)
2016-03-14 16:39:05 +01:00
Paul B Mahol
eb46065f4a doc/utils: fix typo for min() description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit bdf474bcff29f5b40fe14f6fa1dbe10e69c73ab7)
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-03-02 16:43:57 -08:00
Oliver Collyer
b80083a5c1 ffserver&ffm: Fixed issues preventing ffserver write_index and files_size from being set correctly which was breaking ffserver streaming.
I discovered that ffserver streaming was broken (it seems like it has been since 20th November) and I opened a ticket for this (https://trac.ffmpeg.org/ticket/5250 <https://trac.ffmpeg.org/ticket/5250>).

I spent yesterday learning git bisect (with the kind help of cehoyos) to painstakingly track down the cause. This was made more difficult due to the presence of a segfault in ffserver during the period where the bug was introduced so I first had to identify when and how that was fixed and then retrospectively apply that fix again for each step of the second git bisect to find the actual bug.

Anyway, the fruits of my labour are the innocent looking patch below to correct a couple of typos and define a valid range for two variables.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a2f8beef2dfaee573f7c4a607afaa9e83fc2c1e0)
2016-02-23 15:58:42 +01:00
Carl Eugen Hoyos
449ff0e3fd postproc: fix unaligned access
Based on 59074310 by Andreas Cadhalpun.
Fixes ticket .
(cherry picked from commit 2aa21eec1adcb3737be59f0eab7081c5a790faa9)
2016-02-23 15:58:07 +01:00
Rostislav Pehlivanov
0aa2fbddb1 vc2enc: fix use of uninitialized variables in the rate control system
Fixes: CID1352550
Fixes: CID1352549

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
(cherry picked from commit 7cdea450c67d24a3503a0eb64f491f58e474973f)
2016-02-15 15:36:59 +00:00
Michael Niedermayer
c40983a6f6 fate/source-check.sh: Use "git show" instead of git --version to test for git
This fixes fate with non git source trees

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 295de3efc53efa3945c3116b5a910b1464632358)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-15 03:51:39 +01:00
Michael Niedermayer
bd0497b28b avcodec/cfhd: Temporary disable frame threading until related bugs have been fixed
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-15 03:12:13 +01:00
James Almer
4d95207938 x86: use the new helper macros where useful
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 70d685a77f283b110e7b1ab565ff5de53f752d55)
2016-02-14 20:04:19 -03:00
James Almer
1e8a75fae4 x86: add some more helper macros to check for slow cpuflags
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 73a4589d4b0d97cbd6f8bf8be18b78151b657898)
2016-02-14 20:04:06 -03:00
Rostislav Pehlivanov
380980e0d2 Changelog: add entries for the SMPTE VC-2 decoder and encoder
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-02-14 22:12:06 +00:00
Michael Niedermayer
1fd8eb4d4f Basic updates for 3.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-14 23:03:41 +01:00
119 changed files with 1174 additions and 565 deletions

@ -1,7 +1,67 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version <next>:
version 3.0.2:
- avcodec/ttaenc: Reallocate packet if its too small
- configure: build fix for P5600 with mips code restructuring
- mips: add support for R6
- pgssubdec: fix subpicture output colorspace and range
- avcodec/ac3dec: Reset SPX when switching from EAC3 to AC3
- avfilter/vf_drawtext: Check return code of load_glyph()
- avformat/mux: Check that deinit is set before calling it
- avcodec/takdec: add code that got somehow lost in process of REing
- avcodec/apedec: fix decoding of stereo files with one channel full of silence
- avcodec/avpacket: Fix off by 5 error
- avcodec/h264: Fix for H.264 configuration parsing
- avcodec/bmp_parser: Ensure remaining_size is not too small in startcode packet crossing corner case
- avcodec/pngdec: Fix alpha detection with skip_frame
- Changelog: Make formating consistent
- avfilter/src_movie: fix how we check for overflows with seek_point
- avcodec/j2kenc: Add attribution to OpenJPEG project:
version 3.0.1:
- avcodec/libutvideodec: copy frame so it has reference counters when refcounted_frames is set
- avformat/rtpdec_jpeg: fix low contrast image on low quality setting
- avformat/mpegtsenc: Fix used service
- avformat/mpegtsenc: Keep track of the program for each service
- avformat/file: Add crypto to default whitelist
- avcodec/mjpegenc_common: Store approximate aspect if exact cannot be stored
- lavc/hevc: Allow arbitrary garbage in bytestream as long as at least one NAL unit is found.
- avcodec/resample: Remove disabled and faulty code
- indeo2: Fix banding artefacts
- indeo2data: K&R formatting cosmetics
- avformat/hlsenc: Fix passing options, regression since bc9a5965c815cf7fd998d8ce14a18b8e861dd9ce
- avutil/random_seed: Add the runtime in cycles of the main loop to the entropy pool
- avutil/channel_layout: AV_CH_LAYOUT_6POINT1_BACK not reachable in parsing
- avformat/concatdec: set safe mode to enabled instead of auto
- avformat/utils: fix dts from pts code in compute_pkt_fields() during ascending delay
- avformat/rtpenc: Fix integer overflow in NTP_TO_RTP_FORMAT
- avcodec/dca: clear X96 channels if nothing was decoded
- fate/aac: Increase fuzz from of fate-aac-pns-encode from 72 to 74 for Loongson
- avformat/cache: Fix memleak of tree entries
- lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac #5216
- lavf/mov: fix sidx with edit lists
- avcodec/mjpegdec: Fix decoding slightly odd progressive jpeg
- swscale/utils: Fix chrSrcHSubSample for GBRAP16
- swscale/input: Fix GBRAP16 input
- avutil/pixdesc: Make get_color_type() aware of CIE XYZ formats
- avcodec/h264: Execute error concealment before marking the frame as done.
- swscale/x86/output: Fix yuv2planeX_16* with unaligned destination
- swscale/x86/output: Move code into yuv2planeX_mainloop
- MAINTAINERS: add myself as an OS/2 maintainer
- libwebpenc_animencoder: print library messages in verbose log levels
- libwebpenc_animencoder: zero initialize the WebPAnimEncoderOptions struct
- configure: check for SEC_I_CONTEXT_EXPIRED before enabling SChannel
- lavf/http: Add httpproxy to the default protocol whitelist.
- doc/utils: fix typo for min() description
- ffserver&ffm: Fixed issues preventing ffserver write_index and files_size from being set correctly which was breaking ffserver streaming.
- postproc: fix unaligned access
- vc2enc: fix use of uninitialized variables in the rate control system, correctly zero out coefficient array padding
- aacenc: optimize encoding speed
- avcodec/diracdec: check bitstream size related fields for overflows
- avcodec/h264_slice: Check PPS more extensively when its not copied
version 3.0:
@ -70,6 +130,8 @@ version 3.0:
- streamselect video and astreamselect audio filter
- swaprect filter
- metadata video and ametadata audio filter
- SMPTE VC-2 HQ profile support for the Dirac decoder
- SMPTE VC-2 native encoder supporting the HQ profile
version 2.8:

@ -564,6 +564,7 @@ Windows ICL Matthew Oliver
ADI/Blackfin DSP Marc Hoffman
Sparc Roman Shaposhnik
x86 Michael Niedermayer
OS/2 KO Myung-Hun
Releases

@ -1 +1 @@
2.8.git
3.0.2

15
RELEASE_NOTES Normal file

@ -0,0 +1,15 @@
┌─────────────────────────────────────────┐
│ RELEASE NOTES for FFmpeg 3.0 "Einstein" │
└─────────────────────────────────────────┘
The FFmpeg Project proudly presents FFmpeg 3.0 "Einstein", about 5
months after the release of FFmpeg 2.8.
A complete Changelog is available at the root of the project, and the
complete Git history on http://source.ffmpeg.org.
We hope you will like this release as much as we enjoyed working on it, and
as usual, if you have any questions about it, or any FFmpeg related topic,
feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
on the mailing-lists.

260
configure vendored

@ -913,6 +913,25 @@ void foo(void){ __asm__ volatile($code); }
EOF
}
check_inline_asm_flags(){
log check_inline_asm_flags "$@"
name="$1"
code="$2"
flags=''
shift 2
while [ "$1" != "" ]; do
append flags $1
shift
done;
disable $name
cat > $TMPC <<EOF
void foo(void){ __asm__ volatile($code); }
EOF
log_file $TMPC
check_cmd $cc $CPPFLAGS $CFLAGS $flags "$@" $CC_C $(cc_o $TMPO) $TMPC &&
enable $name && add_cflags $flags && add_asflags $flags && add_ldflags $flags
}
check_insn(){
log check_insn "$@"
check_inline_asm ${1}_inline "\"$2\""
@ -1657,6 +1676,7 @@ ARCH_EXT_LIST_ARM="
ARCH_EXT_LIST_MIPS="
mipsfpu
mips32r2
mips32r5
mips64r2
mips32r6
mips64r6
@ -2150,10 +2170,11 @@ mipsfpu_deps="mips"
mipsdsp_deps="mips"
mipsdspr2_deps="mips"
mips32r2_deps="mips"
mips32r5_deps="mips"
mips32r6_deps="mips"
mips64r2_deps="mips"
mips64r6_deps="mips"
msa_deps="mips"
msa_deps="mipsfpu"
mmi_deps="mips"
altivec_deps="ppc"
@ -4153,118 +4174,90 @@ elif enabled mips; then
cpuflags="-march=$cpu"
case $cpu in
24kc)
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsfpu
disable mipsdsp
disable mipsdspr2
disable msa
;;
24kf*)
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsdsp
disable mipsdspr2
disable msa
;;
24kec|34kc|1004kc)
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsfpu
disable mipsdspr2
disable msa
;;
24kef*|34kf*|1004kf*)
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsdspr2
disable msa
;;
74kc)
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsfpu
disable msa
;;
74kf)
disable mips32r6
disable mips64r2
disable mips64r6
disable msa
;;
p5600)
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsdsp
disable mipsdspr2
check_cflags "-mtune=p5600" &&
check_cflags "-mfp64 -msched-weight -mload-store-pairs -funroll-loops" &&
add_asflags "-mfp64"
;;
i6400)
disable mips32r2
disable mips32r6
disable mips64r2
disable mipsdsp
disable mipsdspr2
check_cflags "-mtune=i6400 -mabi=64" &&
check_cflags "-mfp64 -msched-weight -mload-store-pairs -funroll-loops" &&
check_ldflags "-mabi=64" &&
add_asflags "-mfp64"
;;
loongson*)
disable mips32r2
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsfpu
disable mipsdsp
disable mipsdspr2
disable msa
enable local_aligned_8 local_aligned_16 local_aligned_32
enable simd_align_16
enable fast_64bit
enable fast_clz
enable fast_cmov
enable fast_unaligned
disable aligned_stack
case $cpu in
loongson3*)
cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
;;
loongson2e)
cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations"
;;
loongson2f)
cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations"
;;
esac
;;
generic)
disable mips64r6
disable msa
;;
*)
# Unknown CPU. Disable everything.
warn "unknown CPU. Disabling all MIPS optimizations."
disable mipsfpu
disable mips32r2
disable mips32r6
disable mips64r2
disable mips64r6
disable mipsdsp
disable mipsdspr2
disable msa
;;
esac
if [ "$cpu" != "generic" ]; then
disable mips32r2
disable mips32r5
disable mips64r2
disable mips32r6
disable mips64r6
disable loongson2
disable loongson3
case $cpu in
24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
enable mips32r2
disable msa
;;
p5600|i6400)
disable mipsdsp
disable mipsdspr2
;;
loongson*)
enable loongson2
enable loongson3
enable local_aligned_8 local_aligned_16 local_aligned_32
enable simd_align_16
enable fast_64bit
enable fast_clz
enable fast_cmov
enable fast_unaligned
disable aligned_stack
case $cpu in
loongson3*)
cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
;;
loongson2e)
cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations"
;;
loongson2f)
cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations"
;;
esac
;;
*)
# Unknown CPU. Disable everything.
warn "unknown CPU. Disabling all MIPS optimizations."
disable mipsfpu
disable mipsdsp
disable mipsdspr2
disable msa
disable mmi
;;
esac
case $cpu in
24kc)
disable mipsfpu
disable mipsdsp
disable mipsdspr2
;;
24kf*)
disable mipsdsp
disable mipsdspr2
;;
24kec|34kc|1004kc)
disable mipsfpu
disable mipsdspr2
;;
24kef*|34kf*|1004kf*)
disable mipsdspr2
;;
74kc)
disable mipsfpu
;;
p5600)
enable mips32r5
check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
;;
i6400)
enable mips64r6
check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
;;
esac
else
# We do not disable anything. Is up to the user to disable the unwanted features.
warn 'generic cpu selected'
fi
elif enabled ppc; then
@ -5073,27 +5066,22 @@ elif enabled mips; then
enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
# Enable minimum ISA based on selected options
if enabled mips64 && (enabled mipsdsp || enabled mipsdspr2); then
add_cflags "-mips64r2"
add_asflags "-mips64r2"
elif enabled mips64 && enabled mipsfpu && disabled loongson2 && disabled loongson3; then
add_cflags "-mips64"
add_asflags "-mips64"
elif enabled mipsdsp || enabled mipsdspr2; then
add_cflags "-mips32r2 -mfp32"
add_asflags "-mips32r2 -mfp32"
if enabled mips64; then
enabled mips64r6 && check_inline_asm_flags mips64r6 '"dlsa $0, $0, $0, 1"' '-mips64r6'
enabled mips64r2 && check_inline_asm_flags mips64r2 '"dext $0, $0, 0, 1"' '-mips64r2'
disabled mips64r6 && disabled mips64r2 && check_inline_asm_flags mips64r1 '"daddi $0, $0, 0"' '-mips64'
else
enabled mips32r6 && check_inline_asm_flags mips32r6 '"aui $0, $0, 0"' '-mips32r6'
enabled mips32r5 && check_inline_asm_flags mips32r5 '"eretnc"' '-mips32r5'
enabled mips32r2 && check_inline_asm_flags mips32r2 '"ext $0, $0, 0, 1"' '-mips32r2'
disabled mips32r6 && disabled mips32r5 && disabled mips32r2 && check_inline_asm_flags mips32r1 '"addi $0, $0, 0"' '-mips32'
fi
enabled mipsdsp && add_cflags "-mdsp" && add_asflags "-mdsp" &&
check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"'
enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
enabled msa && check_cflags "-mmsa" && check_ldflags "-mmsa" &&
check_inline_asm msa '"addvi.b $w0, $w1, 1"'
enabled msa && add_asflags "-mmsa"
enabled mipsfpu && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f2"' '-mhard-float'
enabled mipsfpu && (enabled mips32r5 || enabled mips32r6 || enabled mips64r6) && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f1"' '-mfp64'
enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_header msa.h || disable msa
enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp'
enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2'
elif enabled parisc; then
@ -5659,7 +5647,7 @@ disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreF
enable securetransport; }
disabled schannel || { check_func_headers "windows.h Security.h" InitializeSecurityContext -DSECURITY_WIN32 -lSecur32 &&
enable schannel && add_extralibs -lSecur32; }
check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && enable schannel && add_extralibs -lSecur32; }
makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
enabled makeinfo \
@ -5935,11 +5923,7 @@ elif enabled ccc; then
add_cflags -msg_disable nonstandcast
add_cflags -msg_disable unsupieee
elif enabled gcc; then
case $gcc_basever in
4.9*) enabled x86 || check_optflags -fno-tree-vectorize ;;
4.*) check_optflags -fno-tree-vectorize ;;
*) enabled x86 || check_optflags -fno-tree-vectorize ;;
esac
check_optflags -fno-tree-vectorize
check_cflags -Werror=format-security
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes

@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER =
PROJECT_NUMBER = 3.0.2
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
# in the documentation. The maximum height of the logo should not exceed 55

@ -104,7 +104,7 @@ All subsequent file-related directives apply to that file.
@item @code{ffconcat version 1.0}
Identify the script type and version. It also sets the @option{safe} option
to 1 if it was to its default -1.
to 1 if it was -1.
To make FFmpeg recognize the format automatically, this directive must
appears exactly as is (no extra space or byte-order-mark) on the very first
@ -192,7 +192,9 @@ component.
If set to 0, any file name is accepted.
The default is -1, it is equivalent to 1 if the format was automatically
The default is 1.
-1 is equivalent to 1 if the format was automatically
probed and 0 otherwise.
@item auto_convert

@ -403,6 +403,35 @@ finding a new maintainer and also don't forget to update the @file{MAINTAINERS}
We think our rules are not too hard. If you have comments, contact us.
@section Code of conduct
Be friendly and respectful towards others and third parties.
Treat others the way you yourself want to be treated.
Be considerate. Not everyone shares the same viewpoint and priorities as you do.
Different opinions and interpretations help the project.
Looking at issues from a different perspective assists development.
Do not assume malice for things that can be attributed to incompetence. Even if
it is malice, it's rarely good to start with that as initial assumption.
Stay friendly even if someone acts contrarily. Everyone has a bad day
once in a while.
If you yourself have a bad day or are angry then try to take a break and reply
once you are calm and without anger if you have to.
Try to help other team members and cooperate if you can.
The goal of software development is to create technical excellence, not for any
individual to be better and "win" against the others. Large software projects
are only possible and successful through teamwork.
If someone struggles do not put them down. Give them a helping hand
instead and point them in the right direction.
Finally, keep in mind the immortal words of Bill and Ted,
"Be excellent to each other."
@anchor{Submitting patches}
@section Submitting patches

@ -950,7 +950,7 @@ following image formats are supported:
@item COOK @tab @tab X
@tab All versions except 5.1 are supported.
@item DCA (DTS Coherent Acoustics) @tab X @tab X
@tab supported extensions: XCh, XLL (partially)
@tab supported extensions: XCh, XXCH, X96, XBR, XLL
@item DPCM id RoQ @tab X @tab X
@tab Used in Quake III, Jedi Knight 2 and other computer games.
@item DPCM Interplay @tab @tab X

@ -869,7 +869,7 @@ Return 1 if @var{x} is lesser than or equal to @var{y}, 0 otherwise.
Return the maximum between @var{x} and @var{y}.
@item min(x, y)
Return the maximum between @var{x} and @var{y}.
Return the minimum between @var{x} and @var{y}.
@item mod(x, y)
Compute the remainder of division of @var{x} by @var{y}.

@ -2893,7 +2893,8 @@ static int transcode_init(void)
* overhead
*/
if(!strcmp(oc->oformat->name, "avi")) {
if ( copy_tb<0 && av_q2d(ist->st->r_frame_rate) >= av_q2d(ist->st->avg_frame_rate)
if ( copy_tb<0 && ist->st->r_frame_rate.num
&& av_q2d(ist->st->r_frame_rate) >= av_q2d(ist->st->avg_frame_rate)
&& 0.5/av_q2d(ist->st->r_frame_rate) > av_q2d(ist->st->time_base)
&& 0.5/av_q2d(ist->st->r_frame_rate) > av_q2d(dec_ctx->time_base)
&& av_q2d(ist->st->time_base) < 1.0/500 && av_q2d(dec_ctx->time_base) < 1.0/500

@ -2730,7 +2730,7 @@ static int stream_component_open(VideoState *is, int stream_index)
goto fail;
link = is->out_audio_filter->inputs[0];
sample_rate = link->sample_rate;
nb_channels = link->channels;
nb_channels = avfilter_link_get_channels(link);
channel_layout = link->channel_layout;
}
#else

@ -373,8 +373,8 @@ static void ffm_set_write_index(AVFormatContext *s, int64_t pos,
int64_t file_size)
{
av_opt_set_int(s, "server_attached", 1, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(s, "write_index", pos, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(s, "file_size", file_size, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(s, "ffm_write_index", pos, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(s, "ffm_file_size", file_size, AV_OPT_SEARCH_CHILDREN);
}
static char *ctime1(char *buf2, size_t buf_size)
@ -3858,6 +3858,8 @@ drop:
if (avformat_write_header(s, NULL) < 0) {
http_log("Container doesn't support the required parameters\n");
avio_closep(&s->pb);
s->streams = NULL;
s->nb_streams = 0;
avformat_free_context(s);
goto bail;
}

@ -28,6 +28,7 @@
#ifndef AVCODEC_AACENC_UTILS_H
#define AVCODEC_AACENC_UTILS_H
#include "libavutil/internal.h"
#include "aac.h"
#include "aacenctab.h"
#include "aactab.h"
@ -66,13 +67,13 @@ static inline void quantize_bands(int *out, const float *in, const float *scaled
const float rounding)
{
int i;
double qc;
for (i = 0; i < size; i++) {
qc = scaled[i] * Q34;
out[i] = (int)FFMIN(qc + rounding, (double)maxval);
float qc = scaled[i] * Q34;
int tmp = (int)FFMIN(qc + rounding, (float)maxval);
if (is_signed && in[i] < 0.0f) {
out[i] = -out[i];
tmp = -tmp;
}
out[i] = tmp;
}
}
@ -90,8 +91,7 @@ static inline float find_max_val(int group_len, int swb_size, const float *scale
static inline int find_min_book(float maxval, int sf)
{
float Q = ff_aac_pow2sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - SCALE_DIV_512];
float Q34 = sqrtf(Q * sqrtf(Q));
float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - SCALE_DIV_512];
int qmaxval, cb;
qmaxval = maxval * Q34 + C_QUANT;
if (qmaxval >= (FF_ARRAY_ELEMS(aac_maxval_cb)))
@ -123,7 +123,10 @@ static inline float find_form_factor(int group_len, int swb_size, float thresh,
if (s >= ethresh) {
nzl += 1.0f;
} else {
nzl += powf(s / ethresh, nzslope);
if (nzslope == 2.f)
nzl += (s / ethresh) * (s / ethresh);
else
nzl += ff_fast_powf(s / ethresh, nzslope);
}
}
if (e2 > thresh) {

@ -895,11 +895,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
ff_eac3_default_spx_band_struct,
&s->num_spx_bands,
s->spx_band_sizes);
} else {
for (ch = 1; ch <= fbw_channels; ch++) {
s->channel_uses_spx[ch] = 0;
s->first_spx_coords[ch] = 1;
}
}
}
if (!s->eac3 || !s->spx_in_use) {
s->spx_in_use = 0;
for (ch = 1; ch <= fbw_channels; ch++) {
s->channel_uses_spx[ch] = 0;
s->first_spx_coords[ch] = 1;
}
}

@ -1372,7 +1372,7 @@ static void ape_unpack_stereo(APEContext *ctx, int count)
int32_t *decoded0 = ctx->decoded[0];
int32_t *decoded1 = ctx->decoded[1];
if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
if ((ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) == APE_FRAMECODE_STEREO_SILENCE) {
/* We are pure silence, so we're done. */
av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n");
return;

@ -401,10 +401,12 @@ int av_packet_split_side_data(AVPacket *pkt){
p = pkt->data + pkt->size - 8 - 5;
for (i=1; ; i++){
size = AV_RB32(p);
if (size>INT_MAX || p - pkt->data < size)
if (size>INT_MAX - 5 || p - pkt->data < size)
return 0;
if (p[4]&128)
break;
if (p - pkt->data < size + 5)
return 0;
p-= size+5;
}
@ -415,7 +417,7 @@ int av_packet_split_side_data(AVPacket *pkt){
p= pkt->data + pkt->size - 8 - 5;
for (i=0; ; i++){
size= AV_RB32(p);
av_assert0(size<=INT_MAX && p - pkt->data >= size);
av_assert0(size<=INT_MAX - 5 && p - pkt->data >= size);
pkt->side_data[i].data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
pkt->side_data[i].size = size;
pkt->side_data[i].type = p[4]&127;

@ -63,10 +63,12 @@ restart:
continue;
}
bpc->pc.frame_start_found++;
bpc->remaining_size = bpc->fsize + i - 17;
bpc->remaining_size = bpc->fsize + FFMAX(i - 17, 0);
if (bpc->pc.index + i > 17) {
next = i - 17;
state = 0;
break;
} else
goto restart;
} else if (bpc->pc.frame_start_found)

@ -756,6 +756,6 @@ AVCodec ff_cfhd_decoder = {
.init = cfhd_decode_init,
.close = cfhd_close_decoder,
.decode = cfhd_decode,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
};

@ -1760,6 +1760,7 @@ static int parse_x96_frame_exss(DCACoreDecoder *s)
return ret;
// Channel set data
s->x96_nchannels = 0;
for (i = 0, x96_base_ch = 0; i < x96_nchsets; i++) {
header_pos = get_bits_count(&s->gb);
@ -1899,9 +1900,10 @@ static int parse_optional_info(DCACoreDecoder *s)
}
}
if (s->avctx->err_recognition & AV_EF_EXPLODE) {
if (!s->xch_pos) {
av_log(s->avctx, AV_LOG_ERROR, "XCH sync word not found\n");
return AVERROR_INVALIDDATA;
if (s->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
}
break;
@ -1921,9 +1923,10 @@ static int parse_optional_info(DCACoreDecoder *s)
}
}
if (s->avctx->err_recognition & AV_EF_EXPLODE) {
if (!s->x96_pos) {
av_log(s->avctx, AV_LOG_ERROR, "X96 sync word not found\n");
return AVERROR_INVALIDDATA;
if (s->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
}
break;
@ -1946,9 +1949,10 @@ static int parse_optional_info(DCACoreDecoder *s)
}
}
if (s->avctx->err_recognition & AV_EF_EXPLODE) {
if (!s->xxch_pos) {
av_log(s->avctx, AV_LOG_ERROR, "XXCH sync word not found\n");
return AVERROR_INVALIDDATA;
if (s->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
}
break;
}

@ -173,7 +173,7 @@ typedef struct DiracContext {
struct {
unsigned prefix_bytes;
unsigned size_scaler;
uint64_t size_scaler;
} highquality;
struct {
@ -826,9 +826,15 @@ static int decode_hq_slice(AVCodecContext *avctx, void *arg)
/* Luma + 2 Chroma planes */
for (i = 0; i < 3; i++) {
int length = s->highquality.size_scaler * get_bits(gb, 8);
int bits_left = 8 * length;
int bits_end = get_bits_count(gb) + bits_left;
int64_t length = s->highquality.size_scaler * get_bits(gb, 8);
int64_t bits_left = 8 * length;
int64_t bits_end = get_bits_count(gb) + bits_left;
if (bits_end >= INT_MAX) {
av_log(s->avctx, AV_LOG_ERROR, "end too far away\n");
return AVERROR_INVALIDDATA;
}
for (level = 0; level < s->wavelet_depth; level++) {
for (orientation = !!level; orientation < 4; orientation++) {
decode_subband(s, gb, quants[level][orientation], slice->slice_x, slice->slice_y, bits_end,
@ -848,7 +854,8 @@ static int decode_hq_slice(AVCodecContext *avctx, void *arg)
static int decode_lowdelay(DiracContext *s)
{
AVCodecContext *avctx = s->avctx;
int slice_x, slice_y, bytes = 0, bufsize;
int slice_x, slice_y, bufsize;
int64_t bytes = 0;
const uint8_t *buf;
DiracSlice *slices;
int slice_num = 0;
@ -872,6 +879,11 @@ static int decode_lowdelay(DiracContext *s)
if (bytes <= bufsize/8)
bytes += buf[bytes] * s->highquality.size_scaler + 1;
}
if (bytes >= INT_MAX) {
av_log(s->avctx, AV_LOG_ERROR, "too many bytes\n");
av_free(slices);
return AVERROR_INVALIDDATA;
}
slices[slice_num].bytes = bytes;
slices[slice_num].slice_x = slice_x;
@ -891,8 +903,8 @@ static int decode_lowdelay(DiracContext *s)
} else {
for (slice_y = 0; bufsize > 0 && slice_y < s->num_y; slice_y++) {
for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) {
bytes = (slice_num+1) * s->lowdelay.bytes.num / s->lowdelay.bytes.den
- slice_num * s->lowdelay.bytes.num / s->lowdelay.bytes.den;
bytes = (slice_num+1) * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den
- slice_num * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den;
slices[slice_num].bytes = bytes;
slices[slice_num].slice_x = slice_x;
slices[slice_num].slice_y = slice_y;
@ -1151,6 +1163,10 @@ static int dirac_unpack_idwt_params(DiracContext *s)
} else if (s->hq_picture) {
s->highquality.prefix_bytes = svq3_get_ue_golomb(gb);
s->highquality.size_scaler = svq3_get_ue_golomb(gb);
if (s->highquality.prefix_bytes >= INT_MAX / 8) {
av_log(s->avctx,AV_LOG_ERROR,"too many prefix bytes\n");
return AVERROR_INVALIDDATA;
}
}
/* [DIRAC_STD] 11.3.5 Quantisation matrices (low-delay syntax). quant_matrix() */

@ -1678,6 +1678,47 @@ again:
ret = 0;
end:
#if CONFIG_ERROR_RESILIENCE
sl = h->slice_ctx;
/*
* FIXME: Error handling code does not seem to support interlaced
* when slices span multiple rows
* The ff_er_add_slice calls don't work right for bottom
* fields; they cause massive erroneous error concealing
* Error marking covers both fields (top and bottom).
* This causes a mismatched s->error_count
* and a bad error table. Further, the error count goes to
* INT_MAX when called for bottom field, because mb_y is
* past end by one (callers fault) and resync_mb_y != 0
* causes problems for the first MB line, too.
*/
if (!FIELD_PICTURE(h) && h->current_slice && !h->sps.new && h->enable_er) {
int use_last_pic = h->last_pic_for_ec.f->buf[0] && !sl->ref_count[0];
ff_h264_set_erpic(&sl->er.cur_pic, h->cur_pic_ptr);
if (use_last_pic) {
ff_h264_set_erpic(&sl->er.last_pic, &h->last_pic_for_ec);
sl->ref_list[0][0].parent = &h->last_pic_for_ec;
memcpy(sl->ref_list[0][0].data, h->last_pic_for_ec.f->data, sizeof(sl->ref_list[0][0].data));
memcpy(sl->ref_list[0][0].linesize, h->last_pic_for_ec.f->linesize, sizeof(sl->ref_list[0][0].linesize));
sl->ref_list[0][0].reference = h->last_pic_for_ec.reference;
} else if (sl->ref_count[0]) {
ff_h264_set_erpic(&sl->er.last_pic, sl->ref_list[0][0].parent);
} else
ff_h264_set_erpic(&sl->er.last_pic, NULL);
if (sl->ref_count[1])
ff_h264_set_erpic(&sl->er.next_pic, sl->ref_list[1][0].parent);
sl->er.ref_count = sl->ref_count[0];
ff_er_frame_end(&sl->er);
if (use_last_pic)
memset(&sl->ref_list[0][0], 0, sizeof(sl->ref_list[0][0]));
}
#endif /* CONFIG_ERROR_RESILIENCE */
/* clean up */
if (h->cur_pic_ptr && !h->droppable) {
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
@ -1740,7 +1781,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
const uint8_t *p= buf+6;
while(cnt--){
int nalsize= AV_RB16(p) + 2;
if(nalsize > buf_size - (p-buf) || p[2]!=0x67)
if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 7)
return 0;
p += nalsize;
}
@ -1749,7 +1790,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
return 0;
while(cnt--){
int nalsize= AV_RB16(p) + 2;
if(nalsize > buf_size - (p-buf) || p[2]!=0x68)
if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 8)
return 0;
p += nalsize;
}

@ -186,47 +186,6 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
ff_vdpau_h264_picture_complete(h);
#endif
#if CONFIG_ERROR_RESILIENCE
av_assert0(sl == h->slice_ctx);
/*
* FIXME: Error handling code does not seem to support interlaced
* when slices span multiple rows
* The ff_er_add_slice calls don't work right for bottom
* fields; they cause massive erroneous error concealing
* Error marking covers both fields (top and bottom).
* This causes a mismatched s->error_count
* and a bad error table. Further, the error count goes to
* INT_MAX when called for bottom field, because mb_y is
* past end by one (callers fault) and resync_mb_y != 0
* causes problems for the first MB line, too.
*/
if (!FIELD_PICTURE(h) && h->current_slice && !h->sps.new && h->enable_er) {
int use_last_pic = h->last_pic_for_ec.f->buf[0] && !sl->ref_count[0];
ff_h264_set_erpic(&sl->er.cur_pic, h->cur_pic_ptr);
if (use_last_pic) {
ff_h264_set_erpic(&sl->er.last_pic, &h->last_pic_for_ec);
sl->ref_list[0][0].parent = &h->last_pic_for_ec;
memcpy(sl->ref_list[0][0].data, h->last_pic_for_ec.f->data, sizeof(sl->ref_list[0][0].data));
memcpy(sl->ref_list[0][0].linesize, h->last_pic_for_ec.f->linesize, sizeof(sl->ref_list[0][0].linesize));
sl->ref_list[0][0].reference = h->last_pic_for_ec.reference;
} else if (sl->ref_count[0]) {
ff_h264_set_erpic(&sl->er.last_pic, sl->ref_list[0][0].parent);
} else
ff_h264_set_erpic(&sl->er.last_pic, NULL);
if (sl->ref_count[1])
ff_h264_set_erpic(&sl->er.next_pic, sl->ref_list[1][0].parent);
sl->er.ref_count = sl->ref_count[0];
ff_er_frame_end(&sl->er);
if (use_last_pic)
memset(&sl->ref_list[0][0], 0, sizeof(sl->ref_list[0][0]));
}
#endif /* CONFIG_ERROR_RESILIENCE */
if (!in_setup && !h->droppable)
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
h->picture_structure == PICT_BOTTOM_FIELD);

@ -1282,9 +1282,13 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
if (first_slice) {
h->pps = *h->pps_buffers[pps_id];
} else if (h->setup_finished && h->dequant_coeff_pps != pps_id) {
av_log(h->avctx, AV_LOG_ERROR, "PPS changed between slices\n");
return AVERROR_INVALIDDATA;
} else {
if (h->pps.sps_id != pps->sps_id ||
h->pps.transform_8x8_mode != pps->transform_8x8_mode ||
(h->setup_finished && h->dequant_coeff_pps != pps_id)) {
av_log(h->avctx, AV_LOG_ERROR, "PPS changed between slices\n");
return AVERROR_INVALIDDATA;
}
}
if (pps->sps_id != h->sps.sps_id ||

@ -3149,6 +3149,8 @@ static av_cold int hevc_init_context(AVCodecContext *avctx)
s->context_initialized = 1;
s->eos = 0;
ff_hevc_reset_sei(s);
return 0;
fail:

@ -1092,6 +1092,15 @@ int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, in
int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id,
uint8_t *buf, int buf_size);
/**
* Reset SEI values that are stored on the Context.
* e.g. Caption data that was extracted during NAL
* parsing.
*
* @param s HEVCContext.
*/
void ff_hevc_reset_sei(HEVCContext *s);
extern const uint8_t ff_hevc_qpel_extra_before[4];
extern const uint8_t ff_hevc_qpel_extra_after[4];
extern const uint8_t ff_hevc_qpel_extra[4];

@ -232,8 +232,14 @@ int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, in
++buf;
--length;
if (length < 4) {
av_log(avctx, AV_LOG_ERROR, "No start code is found.\n");
return AVERROR_INVALIDDATA;
if (pkt->nb_nals > 0) {
// No more start codes: we discarded some irrelevant
// bytes at the end of the packet.
return 0;
} else {
av_log(avctx, AV_LOG_ERROR, "No start code is found.\n");
return AVERROR_INVALIDDATA;
}
}
}

@ -209,6 +209,8 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
h->avctx = avctx;
ff_hevc_reset_sei(h);
if (!buf_size)
return 0;

@ -373,3 +373,9 @@ int ff_hevc_decode_nal_sei(HEVCContext *s)
} while (more_rbsp_data(&s->HEVClc->gb));
return 1;
}
void ff_hevc_reset_sei(HEVCContext *s)
{
s->a53_caption_size = 0;
av_freep(&s->a53_caption);
}

@ -146,6 +146,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
AVFrame *picture = data;
AVFrame * const p = s->picture;
int start, ret;
int ltab, ctab;
if ((ret = ff_reget_buffer(avctx, p)) < 0)
return ret;
@ -168,34 +169,36 @@ static int ir2_decode_frame(AVCodecContext *avctx,
if ((ret = init_get_bits8(&s->gb, buf + start, buf_size - start)) < 0)
return ret;
ltab = buf[0x22] & 3;
ctab = buf[0x22] >> 2;
if (s->decode_delta) { /* intraframe */
if ((ret = ir2_decode_plane(s, avctx->width, avctx->height,
p->data[0], p->linesize[0],
ir2_luma_table)) < 0)
ir2_delta_table[ltab])) < 0)
return ret;
/* swapped U and V */
if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
p->data[2], p->linesize[2],
ir2_luma_table)) < 0)
ir2_delta_table[ctab])) < 0)
return ret;
if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
p->data[1], p->linesize[1],
ir2_luma_table)) < 0)
ir2_delta_table[ctab])) < 0)
return ret;
} else { /* interframe */
if ((ret = ir2_decode_plane_inter(s, avctx->width, avctx->height,
p->data[0], p->linesize[0],
ir2_luma_table)) < 0)
ir2_delta_table[ltab])) < 0)
return ret;
/* swapped U and V */
if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
p->data[2], p->linesize[2],
ir2_luma_table)) < 0)
ir2_delta_table[ctab])) < 0)
return ret;
if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
p->data[1], p->linesize[1],
ir2_luma_table)) < 0)
ir2_delta_table[ctab])) < 0)
return ret;
}

@ -27,115 +27,211 @@
#define IR2_CODES 143
static const uint16_t ir2_codes[IR2_CODES][2] = {
#ifdef BITSTREAM_READER_LE
{0x0000, 3}, {0x0004, 3}, {0x0006, 3}, {0x0001, 5},
{0x0009, 5}, {0x0019, 5}, {0x000D, 5}, {0x001D, 5},
{0x0023, 6}, {0x0013, 6}, {0x0033, 6}, {0x000B, 6},
{0x002B, 6}, {0x001B, 6}, {0x0007, 8}, {0x0087, 8},
{0x0027, 8}, {0x00A7, 8}, {0x0067, 8}, {0x00E7, 8},
{0x0097, 8}, {0x0057, 8}, {0x0037, 8}, {0x00B7, 8},
{0x00F7, 8}, {0x000F, 9}, {0x008F, 9}, {0x018F, 9},
{0x014F, 9}, {0x00CF, 9}, {0x002F, 9}, {0x012F, 9},
{0x01AF, 9}, {0x006F, 9}, {0x00EF, 9}, {0x01EF, 9},
{0x001F, 10}, {0x021F, 10}, {0x011F, 10}, {0x031F, 10},
{0x009F, 10}, {0x029F, 10}, {0x019F, 10}, {0x039F, 10},
{0x005F, 10}, {0x025F, 10}, {0x015F, 10}, {0x035F, 10},
{0x00DF, 10}, {0x02DF, 10}, {0x01DF, 10}, {0x03DF, 10},
{0x003F, 13}, {0x103F, 13}, {0x083F, 13}, {0x183F, 13},
{0x043F, 13}, {0x143F, 13}, {0x0C3F, 13}, {0x1C3F, 13},
{0x023F, 13}, {0x123F, 13}, {0x0A3F, 13}, {0x1A3F, 13},
{0x063F, 13}, {0x163F, 13}, {0x0E3F, 13}, {0x1E3F, 13},
{0x013F, 13}, {0x113F, 13}, {0x093F, 13}, {0x193F, 13},
{0x053F, 13}, {0x153F, 13}, {0x0D3F, 13}, {0x1D3F, 13},
{0x033F, 13}, {0x133F, 13}, {0x0B3F, 13}, {0x1B3F, 13},
{0x073F, 13}, {0x173F, 13}, {0x0F3F, 13}, {0x1F3F, 13},
{0x00BF, 13}, {0x10BF, 13}, {0x08BF, 13}, {0x18BF, 13},
{0x04BF, 13}, {0x14BF, 13}, {0x0CBF, 13}, {0x1CBF, 13},
{0x02BF, 13}, {0x12BF, 13}, {0x0ABF, 13}, {0x1ABF, 13},
{0x06BF, 13}, {0x16BF, 13}, {0x0EBF, 13}, {0x1EBF, 13},
{0x01BF, 13}, {0x11BF, 13}, {0x09BF, 13}, {0x19BF, 13},
{0x05BF, 13}, {0x15BF, 13}, {0x0DBF, 13}, {0x1DBF, 13},
{0x03BF, 13}, {0x13BF, 13}, {0x0BBF, 13}, {0x1BBF, 13},
{0x07BF, 13}, {0x17BF, 13}, {0x0FBF, 13}, {0x1FBF, 13},
{0x007F, 14}, {0x207F, 14}, {0x107F, 14}, {0x307F, 14},
{0x087F, 14}, {0x287F, 14}, {0x187F, 14}, {0x387F, 14},
{0x047F, 14}, {0x247F, 14}, {0x147F, 14}, {0x0002, 3},
{0x0011, 5}, {0x0005, 5}, {0x0015, 5}, {0x0003, 6},
{0x003B, 6}, {0x0047, 8}, {0x00C7, 8}, {0x0017, 8},
{0x00D7, 8}, {0x0077, 8}, {0x010F, 9}, {0x004F, 9},
{0x01CF, 9}, {0x00AF, 9}, {0x016F, 9},
{ 0x0000, 3 }, { 0x0004, 3 }, { 0x0006, 3 }, { 0x0001, 5 },
{ 0x0009, 5 }, { 0x0019, 5 }, { 0x000D, 5 }, { 0x001D, 5 },
{ 0x0023, 6 }, { 0x0013, 6 }, { 0x0033, 6 }, { 0x000B, 6 },
{ 0x002B, 6 }, { 0x001B, 6 }, { 0x0007, 8 }, { 0x0087, 8 },
{ 0x0027, 8 }, { 0x00A7, 8 }, { 0x0067, 8 }, { 0x00E7, 8 },
{ 0x0097, 8 }, { 0x0057, 8 }, { 0x0037, 8 }, { 0x00B7, 8 },
{ 0x00F7, 8 }, { 0x000F, 9 }, { 0x008F, 9 }, { 0x018F, 9 },
{ 0x014F, 9 }, { 0x00CF, 9 }, { 0x002F, 9 }, { 0x012F, 9 },
{ 0x01AF, 9 }, { 0x006F, 9 }, { 0x00EF, 9 }, { 0x01EF, 9 },
{ 0x001F, 10 }, { 0x021F, 10 }, { 0x011F, 10 }, { 0x031F, 10 },
{ 0x009F, 10 }, { 0x029F, 10 }, { 0x019F, 10 }, { 0x039F, 10 },
{ 0x005F, 10 }, { 0x025F, 10 }, { 0x015F, 10 }, { 0x035F, 10 },
{ 0x00DF, 10 }, { 0x02DF, 10 }, { 0x01DF, 10 }, { 0x03DF, 10 },
{ 0x003F, 13 }, { 0x103F, 13 }, { 0x083F, 13 }, { 0x183F, 13 },
{ 0x043F, 13 }, { 0x143F, 13 }, { 0x0C3F, 13 }, { 0x1C3F, 13 },
{ 0x023F, 13 }, { 0x123F, 13 }, { 0x0A3F, 13 }, { 0x1A3F, 13 },
{ 0x063F, 13 }, { 0x163F, 13 }, { 0x0E3F, 13 }, { 0x1E3F, 13 },
{ 0x013F, 13 }, { 0x113F, 13 }, { 0x093F, 13 }, { 0x193F, 13 },
{ 0x053F, 13 }, { 0x153F, 13 }, { 0x0D3F, 13 }, { 0x1D3F, 13 },
{ 0x033F, 13 }, { 0x133F, 13 }, { 0x0B3F, 13 }, { 0x1B3F, 13 },
{ 0x073F, 13 }, { 0x173F, 13 }, { 0x0F3F, 13 }, { 0x1F3F, 13 },
{ 0x00BF, 13 }, { 0x10BF, 13 }, { 0x08BF, 13 }, { 0x18BF, 13 },
{ 0x04BF, 13 }, { 0x14BF, 13 }, { 0x0CBF, 13 }, { 0x1CBF, 13 },
{ 0x02BF, 13 }, { 0x12BF, 13 }, { 0x0ABF, 13 }, { 0x1ABF, 13 },
{ 0x06BF, 13 }, { 0x16BF, 13 }, { 0x0EBF, 13 }, { 0x1EBF, 13 },
{ 0x01BF, 13 }, { 0x11BF, 13 }, { 0x09BF, 13 }, { 0x19BF, 13 },
{ 0x05BF, 13 }, { 0x15BF, 13 }, { 0x0DBF, 13 }, { 0x1DBF, 13 },
{ 0x03BF, 13 }, { 0x13BF, 13 }, { 0x0BBF, 13 }, { 0x1BBF, 13 },
{ 0x07BF, 13 }, { 0x17BF, 13 }, { 0x0FBF, 13 }, { 0x1FBF, 13 },
{ 0x007F, 14 }, { 0x207F, 14 }, { 0x107F, 14 }, { 0x307F, 14 },
{ 0x087F, 14 }, { 0x287F, 14 }, { 0x187F, 14 }, { 0x387F, 14 },
{ 0x047F, 14 }, { 0x247F, 14 }, { 0x147F, 14 }, { 0x0002, 3 },
{ 0x0011, 5 }, { 0x0005, 5 }, { 0x0015, 5 }, { 0x0003, 6 },
{ 0x003B, 6 }, { 0x0047, 8 }, { 0x00C7, 8 }, { 0x0017, 8 },
{ 0x00D7, 8 }, { 0x0077, 8 }, { 0x010F, 9 }, { 0x004F, 9 },
{ 0x01CF, 9 }, { 0x00AF, 9 }, { 0x016F, 9 },
#else
{0x0000, 3}, {0x0001, 3}, {0x0003, 3}, {0x0010, 5},
{0x0012, 5}, {0x0013, 5}, {0x0016, 5}, {0x0017, 5},
{0x0031, 6}, {0x0032, 6}, {0x0033, 6}, {0x0034, 6},
{0x0035, 6}, {0x0036, 6}, {0x00E0, 8}, {0x00E1, 8},
{0x00E4, 8}, {0x00E5, 8}, {0x00E6, 8}, {0x00E7, 8},
{0x00E9, 8}, {0x00EA, 8}, {0x00EC, 8}, {0x00ED, 8},
{0x00EF, 8}, {0x01E0, 9}, {0x01E2, 9}, {0x01E3, 9},
{0x01E5, 9}, {0x01E6, 9}, {0x01E8, 9}, {0x01E9, 9},
{0x01EB, 9}, {0x01EC, 9}, {0x01EE, 9}, {0x01EF, 9},
{0x03E0, 10}, {0x03E1, 10}, {0x03E2, 10}, {0x03E3, 10},
{0x03E4, 10}, {0x03E5, 10}, {0x03E6, 10}, {0x03E7, 10},
{0x03E8, 10}, {0x03E9, 10}, {0x03EA, 10}, {0x03EB, 10},
{0x03EC, 10}, {0x03ED, 10}, {0x03EE, 10}, {0x03EF, 10},
{0x1F80, 13}, {0x1F81, 13}, {0x1F82, 13}, {0x1F83, 13},
{0x1F84, 13}, {0x1F85, 13}, {0x1F86, 13}, {0x1F87, 13},
{0x1F88, 13}, {0x1F89, 13}, {0x1F8A, 13}, {0x1F8B, 13},
{0x1F8C, 13}, {0x1F8D, 13}, {0x1F8E, 13}, {0x1F8F, 13},
{0x1F90, 13}, {0x1F91, 13}, {0x1F92, 13}, {0x1F93, 13},
{0x1F94, 13}, {0x1F95, 13}, {0x1F96, 13}, {0x1F97, 13},
{0x1F98, 13}, {0x1F99, 13}, {0x1F9A, 13}, {0x1F9B, 13},
{0x1F9C, 13}, {0x1F9D, 13}, {0x1F9E, 13}, {0x1F9F, 13},
{0x1FA0, 13}, {0x1FA1, 13}, {0x1FA2, 13}, {0x1FA3, 13},
{0x1FA4, 13}, {0x1FA5, 13}, {0x1FA6, 13}, {0x1FA7, 13},
{0x1FA8, 13}, {0x1FA9, 13}, {0x1FAA, 13}, {0x1FAB, 13},
{0x1FAC, 13}, {0x1FAD, 13}, {0x1FAE, 13}, {0x1FAF, 13},
{0x1FB0, 13}, {0x1FB1, 13}, {0x1FB2, 13}, {0x1FB3, 13},
{0x1FB4, 13}, {0x1FB5, 13}, {0x1FB6, 13}, {0x1FB7, 13},
{0x1FB8, 13}, {0x1FB9, 13}, {0x1FBA, 13}, {0x1FBB, 13},
{0x1FBC, 13}, {0x1FBD, 13}, {0x1FBE, 13}, {0x1FBF, 13},
{0x3F80, 14}, {0x3F81, 14}, {0x3F82, 14}, {0x3F83, 14},
{0x3F84, 14}, {0x3F85, 14}, {0x3F86, 14}, {0x3F87, 14},
{0x3F88, 14}, {0x3F89, 14}, {0x3F8A, 14}, {0x0002, 3},
{0x0011, 5}, {0x0014, 5}, {0x0015, 5}, {0x0030, 6},
{0x0037, 6}, {0x00E2, 8}, {0x00E3, 8}, {0x00E8, 8},
{0x00EB, 8}, {0x00EE, 8}, {0x01E1, 9}, {0x01E4, 9},
{0x01E7, 9}, {0x01EA, 9}, {0x01ED, 9}
{ 0x0000, 3 }, { 0x0001, 3 }, { 0x0003, 3 }, { 0x0010, 5 },
{ 0x0012, 5 }, { 0x0013, 5 }, { 0x0016, 5 }, { 0x0017, 5 },
{ 0x0031, 6 }, { 0x0032, 6 }, { 0x0033, 6 }, { 0x0034, 6 },
{ 0x0035, 6 }, { 0x0036, 6 }, { 0x00E0, 8 }, { 0x00E1, 8 },
{ 0x00E4, 8 }, { 0x00E5, 8 }, { 0x00E6, 8 }, { 0x00E7, 8 },
{ 0x00E9, 8 }, { 0x00EA, 8 }, { 0x00EC, 8 }, { 0x00ED, 8 },
{ 0x00EF, 8 }, { 0x01E0, 9 }, { 0x01E2, 9 }, { 0x01E3, 9 },
{ 0x01E5, 9 }, { 0x01E6, 9 }, { 0x01E8, 9 }, { 0x01E9, 9 },
{ 0x01EB, 9 }, { 0x01EC, 9 }, { 0x01EE, 9 }, { 0x01EF, 9 },
{ 0x03E0, 10 }, { 0x03E1, 10 }, { 0x03E2, 10 }, { 0x03E3, 10 },
{ 0x03E4, 10 }, { 0x03E5, 10 }, { 0x03E6, 10 }, { 0x03E7, 10 },
{ 0x03E8, 10 }, { 0x03E9, 10 }, { 0x03EA, 10 }, { 0x03EB, 10 },
{ 0x03EC, 10 }, { 0x03ED, 10 }, { 0x03EE, 10 }, { 0x03EF, 10 },
{ 0x1F80, 13 }, { 0x1F81, 13 }, { 0x1F82, 13 }, { 0x1F83, 13 },
{ 0x1F84, 13 }, { 0x1F85, 13 }, { 0x1F86, 13 }, { 0x1F87, 13 },
{ 0x1F88, 13 }, { 0x1F89, 13 }, { 0x1F8A, 13 }, { 0x1F8B, 13 },
{ 0x1F8C, 13 }, { 0x1F8D, 13 }, { 0x1F8E, 13 }, { 0x1F8F, 13 },
{ 0x1F90, 13 }, { 0x1F91, 13 }, { 0x1F92, 13 }, { 0x1F93, 13 },
{ 0x1F94, 13 }, { 0x1F95, 13 }, { 0x1F96, 13 }, { 0x1F97, 13 },
{ 0x1F98, 13 }, { 0x1F99, 13 }, { 0x1F9A, 13 }, { 0x1F9B, 13 },
{ 0x1F9C, 13 }, { 0x1F9D, 13 }, { 0x1F9E, 13 }, { 0x1F9F, 13 },
{ 0x1FA0, 13 }, { 0x1FA1, 13 }, { 0x1FA2, 13 }, { 0x1FA3, 13 },
{ 0x1FA4, 13 }, { 0x1FA5, 13 }, { 0x1FA6, 13 }, { 0x1FA7, 13 },
{ 0x1FA8, 13 }, { 0x1FA9, 13 }, { 0x1FAA, 13 }, { 0x1FAB, 13 },
{ 0x1FAC, 13 }, { 0x1FAD, 13 }, { 0x1FAE, 13 }, { 0x1FAF, 13 },
{ 0x1FB0, 13 }, { 0x1FB1, 13 }, { 0x1FB2, 13 }, { 0x1FB3, 13 },
{ 0x1FB4, 13 }, { 0x1FB5, 13 }, { 0x1FB6, 13 }, { 0x1FB7, 13 },
{ 0x1FB8, 13 }, { 0x1FB9, 13 }, { 0x1FBA, 13 }, { 0x1FBB, 13 },
{ 0x1FBC, 13 }, { 0x1FBD, 13 }, { 0x1FBE, 13 }, { 0x1FBF, 13 },
{ 0x3F80, 14 }, { 0x3F81, 14 }, { 0x3F82, 14 }, { 0x3F83, 14 },
{ 0x3F84, 14 }, { 0x3F85, 14 }, { 0x3F86, 14 }, { 0x3F87, 14 },
{ 0x3F88, 14 }, { 0x3F89, 14 }, { 0x3F8A, 14 }, { 0x0002, 3 },
{ 0x0011, 5 }, { 0x0014, 5 }, { 0x0015, 5 }, { 0x0030, 6 },
{ 0x0037, 6 }, { 0x00E2, 8 }, { 0x00E3, 8 }, { 0x00E8, 8 },
{ 0x00EB, 8 }, { 0x00EE, 8 }, { 0x01E1, 9 }, { 0x01E4, 9 },
{ 0x01E7, 9 }, { 0x01EA, 9 }, { 0x01ED, 9 },
#endif
};
static const uint8_t ir2_luma_table[256] = {
0x80, 0x80, 0x84, 0x84, 0x7C, 0x7C, 0x7F, 0x85,
0x81, 0x7B, 0x85, 0x7F, 0x7B, 0x81, 0x8C, 0x8C,
0x74, 0x74, 0x83, 0x8D, 0x7D, 0x73, 0x8D, 0x83,
0x73, 0x7D, 0x77, 0x89, 0x89, 0x77, 0x89, 0x77,
0x77, 0x89, 0x8C, 0x95, 0x74, 0x6B, 0x95, 0x8C,
0x6B, 0x74, 0x7C, 0x90, 0x84, 0x70, 0x90, 0x7C,
0x70, 0x84, 0x96, 0x96, 0x6A, 0x6A, 0x82, 0x98,
0x7E, 0x68, 0x98, 0x82, 0x68, 0x7E, 0x97, 0xA2,
0x69, 0x5E, 0xA2, 0x97, 0x5E, 0x69, 0xA2, 0xA2,
0x5E, 0x5E, 0x8B, 0xA3, 0x75, 0x5D, 0xA3, 0x8B,
0x5D, 0x75, 0x71, 0x95, 0x8F, 0x6B, 0x95, 0x71,
0x6B, 0x8F, 0x78, 0x9D, 0x88, 0x63, 0x9D, 0x78,
0x63, 0x88, 0x7F, 0xA7, 0x81, 0x59, 0xA7, 0x7F,
0x59, 0x81, 0xA4, 0xB1, 0x5C, 0x4F, 0xB1, 0xA4,
0x4F, 0x5C, 0x96, 0xB1, 0x6A, 0x4F, 0xB1, 0x96,
0x4F, 0x6A, 0xB2, 0xB2, 0x4E, 0x4E, 0x65, 0x9B,
0x9B, 0x65, 0x9B, 0x65, 0x65, 0x9B, 0x89, 0xB4,
0x77, 0x4C, 0xB4, 0x89, 0x4C, 0x77, 0x6A, 0xA3,
0x96, 0x5D, 0xA3, 0x6A, 0x5D, 0x96, 0x73, 0xAC,
0x8D, 0x54, 0xAC, 0x73, 0x54, 0x8D, 0xB4, 0xC3,
0x4C, 0x3D, 0xC3, 0xB4, 0x3D, 0x4C, 0xA4, 0xC3,
0x5C, 0x3D, 0xC3, 0xA4, 0x3D, 0x5C, 0xC4, 0xC4,
0x3C, 0x3C, 0x96, 0xC6, 0x6A, 0x3A, 0xC6, 0x96,
0x3A, 0x6A, 0x7C, 0xBA, 0x84, 0x46, 0xBA, 0x7C,
0x46, 0x84, 0x5B, 0xAB, 0xA5, 0x55, 0xAB, 0x5B,
0x55, 0xA5, 0x63, 0xB4, 0x9D, 0x4C, 0xB4, 0x63,
0x4C, 0x9D, 0x86, 0xCA, 0x7A, 0x36, 0xCA, 0x86,
0x36, 0x7A, 0xB6, 0xD7, 0x4A, 0x29, 0xD7, 0xB6,
0x29, 0x4A, 0xC8, 0xD7, 0x38, 0x29, 0xD7, 0xC8,
0x29, 0x38, 0xA4, 0xD8, 0x5C, 0x28, 0xD8, 0xA4,
0x28, 0x5C, 0x6C, 0xC1, 0x94, 0x3F, 0xC1, 0x6C,
0x3F, 0x94, 0xD9, 0xD9, 0x27, 0x27, 0x80, 0x80
static const uint8_t ir2_delta_table[4][256] = {
{ 0x80, 0x80, 0x84, 0x84, 0x7C, 0x7C, 0x7F, 0x85,
0x81, 0x7B, 0x85, 0x7F, 0x7B, 0x81, 0x8C, 0x8C,
0x74, 0x74, 0x83, 0x8D, 0x7D, 0x73, 0x8D, 0x83,
0x73, 0x7D, 0x77, 0x89, 0x89, 0x77, 0x89, 0x77,
0x77, 0x89, 0x8C, 0x95, 0x74, 0x6B, 0x95, 0x8C,
0x6B, 0x74, 0x7C, 0x90, 0x84, 0x70, 0x90, 0x7C,
0x70, 0x84, 0x96, 0x96, 0x6A, 0x6A, 0x82, 0x98,
0x7E, 0x68, 0x98, 0x82, 0x68, 0x7E, 0x97, 0xA2,
0x69, 0x5E, 0xA2, 0x97, 0x5E, 0x69, 0xA2, 0xA2,
0x5E, 0x5E, 0x8B, 0xA3, 0x75, 0x5D, 0xA3, 0x8B,
0x5D, 0x75, 0x71, 0x95, 0x8F, 0x6B, 0x95, 0x71,
0x6B, 0x8F, 0x78, 0x9D, 0x88, 0x63, 0x9D, 0x78,
0x63, 0x88, 0x7F, 0xA7, 0x81, 0x59, 0xA7, 0x7F,
0x59, 0x81, 0xA4, 0xB1, 0x5C, 0x4F, 0xB1, 0xA4,
0x4F, 0x5C, 0x96, 0xB1, 0x6A, 0x4F, 0xB1, 0x96,
0x4F, 0x6A, 0xB2, 0xB2, 0x4E, 0x4E, 0x65, 0x9B,
0x9B, 0x65, 0x9B, 0x65, 0x65, 0x9B, 0x89, 0xB4,
0x77, 0x4C, 0xB4, 0x89, 0x4C, 0x77, 0x6A, 0xA3,
0x96, 0x5D, 0xA3, 0x6A, 0x5D, 0x96, 0x73, 0xAC,
0x8D, 0x54, 0xAC, 0x73, 0x54, 0x8D, 0xB4, 0xC3,
0x4C, 0x3D, 0xC3, 0xB4, 0x3D, 0x4C, 0xA4, 0xC3,
0x5C, 0x3D, 0xC3, 0xA4, 0x3D, 0x5C, 0xC4, 0xC4,
0x3C, 0x3C, 0x96, 0xC6, 0x6A, 0x3A, 0xC6, 0x96,
0x3A, 0x6A, 0x7C, 0xBA, 0x84, 0x46, 0xBA, 0x7C,
0x46, 0x84, 0x5B, 0xAB, 0xA5, 0x55, 0xAB, 0x5B,
0x55, 0xA5, 0x63, 0xB4, 0x9D, 0x4C, 0xB4, 0x63,
0x4C, 0x9D, 0x86, 0xCA, 0x7A, 0x36, 0xCA, 0x86,
0x36, 0x7A, 0xB6, 0xD7, 0x4A, 0x29, 0xD7, 0xB6,
0x29, 0x4A, 0xC8, 0xD7, 0x38, 0x29, 0xD7, 0xC8,
0x29, 0x38, 0xA4, 0xD8, 0x5C, 0x28, 0xD8, 0xA4,
0x28, 0x5C, 0x6C, 0xC1, 0x94, 0x3F, 0xC1, 0x6C,
0x3F, 0x94, 0xD9, 0xD9, 0x27, 0x27, 0x80, 0x80, },
{ 0x80, 0x80, 0x85, 0x85, 0x7B, 0x7B, 0x7E, 0x87,
0x82, 0x79, 0x87, 0x7E, 0x79, 0x82, 0x8F, 0x8F,
0x71, 0x71, 0x84, 0x8F, 0x7C, 0x71, 0x8F, 0x84,
0x71, 0x7C, 0x75, 0x8B, 0x8B, 0x75, 0x8B, 0x75,
0x75, 0x8B, 0x8E, 0x9A, 0x72, 0x66, 0x9A, 0x8E,
0x66, 0x72, 0x7B, 0x93, 0x85, 0x6D, 0x93, 0x7B,
0x6D, 0x85, 0x9B, 0x9B, 0x65, 0x65, 0x82, 0x9D,
0x7E, 0x63, 0x9D, 0x82, 0x63, 0x7E, 0x9B, 0xA8,
0x65, 0x58, 0xA8, 0x9B, 0x58, 0x65, 0xA9, 0xA9,
0x57, 0x57, 0x8D, 0xAA, 0x73, 0x56, 0xAA, 0x8D,
0x56, 0x73, 0x6E, 0x99, 0x92, 0x67, 0x99, 0x6E,
0x67, 0x92, 0x76, 0xA2, 0x8A, 0x5E, 0xA2, 0x76,
0x5E, 0x8A, 0x7F, 0xAF, 0x81, 0x51, 0xAF, 0x7F,
0x51, 0x81, 0xAB, 0xBA, 0x55, 0x46, 0xBA, 0xAB,
0x46, 0x55, 0x9A, 0xBB, 0x66, 0x45, 0xBB, 0x9A,
0x45, 0x66, 0xBB, 0xBB, 0x45, 0x45, 0x60, 0xA0,
0xA0, 0x60, 0xA0, 0x60, 0x60, 0xA0, 0x8B, 0xBE,
0x75, 0x42, 0xBE, 0x8B, 0x42, 0x75, 0x66, 0xAA,
0x9A, 0x56, 0xAA, 0x66, 0x56, 0x9A, 0x70, 0xB5,
0x90, 0x4B, 0xB5, 0x70, 0x4B, 0x90, 0xBE, 0xCF,
0x42, 0x31, 0xCF, 0xBE, 0x31, 0x42, 0xAB, 0xD0,
0x55, 0x30, 0xD0, 0xAB, 0x30, 0x55, 0xD1, 0xD1,
0x2F, 0x2F, 0x9A, 0xD3, 0x66, 0x2D, 0xD3, 0x9A,
0x2D, 0x66, 0x7B, 0xC5, 0x85, 0x3B, 0xC5, 0x7B,
0x3B, 0x85, 0x54, 0xB4, 0xAC, 0x4C, 0xB4, 0x54,
0x4C, 0xAC, 0x5E, 0xBE, 0xA2, 0x42, 0xBE, 0x5E,
0x42, 0xA2, 0x87, 0xD8, 0x79, 0x28, 0xD8, 0x87,
0x28, 0x79, 0xC0, 0xE8, 0x40, 0x18, 0xE8, 0xC0,
0x18, 0x40, 0xD5, 0xE8, 0x2B, 0x18, 0xE8, 0xD5,
0x18, 0x2B, 0xAB, 0xE9, 0x55, 0x17, 0xE9, 0xAB,
0x17, 0x55, 0x68, 0xCD, 0x98, 0x33, 0xCD, 0x68,
0x33, 0x98, 0xEA, 0xEA, 0x16, 0x16, 0x80, 0x80, },
{ 0x80, 0x80, 0x86, 0x86, 0x7A, 0x7A, 0x7E, 0x88,
0x82, 0x78, 0x88, 0x7E, 0x78, 0x82, 0x92, 0x92,
0x6E, 0x6E, 0x85, 0x92, 0x7B, 0x6E, 0x92, 0x85,
0x6E, 0x7B, 0x73, 0x8D, 0x8D, 0x73, 0x8D, 0x73,
0x73, 0x8D, 0x91, 0x9E, 0x6F, 0x62, 0x9E, 0x91,
0x62, 0x6F, 0x79, 0x97, 0x87, 0x69, 0x97, 0x79,
0x69, 0x87, 0xA0, 0xA0, 0x60, 0x60, 0x83, 0xA2,
0x7D, 0x5E, 0xA2, 0x83, 0x5E, 0x7D, 0xA0, 0xB0,
0x60, 0x50, 0xB0, 0xA0, 0x50, 0x60, 0xB1, 0xB1,
0x4F, 0x4F, 0x8F, 0xB2, 0x71, 0x4E, 0xB2, 0x8F,
0x4E, 0x71, 0x6B, 0x9E, 0x95, 0x62, 0x9E, 0x6B,
0x62, 0x95, 0x74, 0xA9, 0x8C, 0x57, 0xA9, 0x74,
0x57, 0x8C, 0x7F, 0xB8, 0x81, 0x48, 0xB8, 0x7F,
0x48, 0x81, 0xB4, 0xC5, 0x4C, 0x3B, 0xC5, 0xB4,
0x3B, 0x4C, 0x9F, 0xC6, 0x61, 0x3A, 0xC6, 0x9F,
0x3A, 0x61, 0xC6, 0xC6, 0x3A, 0x3A, 0x59, 0xA7,
0xA7, 0x59, 0xA7, 0x59, 0x59, 0xA7, 0x8D, 0xCA,
0x73, 0x36, 0xCA, 0x8D, 0x36, 0x73, 0x61, 0xB2,
0x9F, 0x4E, 0xB2, 0x61, 0x4E, 0x9F, 0x6D, 0xBF,
0x93, 0x41, 0xBF, 0x6D, 0x41, 0x93, 0xCA, 0xDF,
0x36, 0x21, 0xDF, 0xCA, 0x21, 0x36, 0xB3, 0xDF,
0x4D, 0x21, 0xDF, 0xB3, 0x21, 0x4D, 0xE1, 0xE1,
0x1F, 0x1F, 0x9F, 0xE3, 0x61, 0x1D, 0xE3, 0x9F,
0x1D, 0x61, 0x7A, 0xD3, 0x86, 0x2D, 0xD3, 0x7A,
0x2D, 0x86, 0x4C, 0xBE, 0xB4, 0x42, 0xBE, 0x4C,
0x42, 0xB4, 0x57, 0xCA, 0xA9, 0x36, 0xCA, 0x57,
0x36, 0xA9, 0x88, 0xE9, 0x78, 0x17, 0xE9, 0x88,
0x17, 0x78, 0xCC, 0xFB, 0x34, 0x05, 0xFB, 0xCC,
0x05, 0x34, 0xE6, 0xFB, 0x1A, 0x05, 0xFB, 0xE6,
0x05, 0x1A, 0xB4, 0xFD, 0x4C, 0x03, 0xFD, 0xB4,
0x03, 0x4C, 0x63, 0xDC, 0x9D, 0x24, 0xDC, 0x63,
0x24, 0x9D, 0xFE, 0xFE, 0x02, 0x02, 0x80, 0x80, },
{ 0x80, 0x80, 0x87, 0x87, 0x79, 0x79, 0x7E, 0x89,
0x82, 0x77, 0x89, 0x7E, 0x77, 0x82, 0x95, 0x95,
0x6B, 0x6B, 0x86, 0x96, 0x7A, 0x6A, 0x96, 0x86,
0x6A, 0x7A, 0x70, 0x90, 0x90, 0x70, 0x90, 0x70,
0x70, 0x90, 0x94, 0xA4, 0x6C, 0x5C, 0xA4, 0x94,
0x5C, 0x6C, 0x78, 0x9B, 0x88, 0x65, 0x9B, 0x78,
0x65, 0x88, 0xA6, 0xA6, 0x5A, 0x5A, 0x83, 0xA9,
0x7D, 0x57, 0xA9, 0x83, 0x57, 0x7D, 0xA6, 0xB9,
0x5A, 0x47, 0xB9, 0xA6, 0x47, 0x5A, 0xBA, 0xBA,
0x46, 0x46, 0x92, 0xBC, 0x6E, 0x44, 0xBC, 0x92,
0x44, 0x6E, 0x67, 0xA3, 0x99, 0x5D, 0xA3, 0x67,
0x5D, 0x99, 0x72, 0xB0, 0x8E, 0x50, 0xB0, 0x72,
0x50, 0x8E, 0x7F, 0xC3, 0x81, 0x3D, 0xC3, 0x7F,
0x3D, 0x81, 0xBE, 0xD2, 0x42, 0x2E, 0xD2, 0xBE,
0x2E, 0x42, 0xA5, 0xD4, 0x5B, 0x2C, 0xD4, 0xA5,
0x2C, 0x5B, 0xD4, 0xD4, 0x2C, 0x2C, 0x52, 0xAE,
0xAE, 0x52, 0xAE, 0x52, 0x52, 0xAE, 0x8F, 0xD8,
0x71, 0x28, 0xD8, 0x8F, 0x28, 0x71, 0x5B, 0xBB,
0xA5, 0x45, 0xBB, 0x5B, 0x45, 0xA5, 0x69, 0xCB,
0x97, 0x35, 0xCB, 0x69, 0x35, 0x97, 0xD8, 0xF0,
0x28, 0x10, 0xF0, 0xD8, 0x10, 0x28, 0xBD, 0xF1,
0x43, 0x0F, 0xF1, 0xBD, 0x0F, 0x43, 0xF3, 0xF3,
0x0D, 0x0D, 0xA5, 0xF6, 0x5B, 0x0A, 0xF6, 0xA5,
0x0A, 0x5B, 0x78, 0xE2, 0x88, 0x1E, 0xE2, 0x78,
0x1E, 0x88, 0x42, 0xC9, 0xBE, 0x37, 0xC9, 0x42,
0x37, 0xBE, 0x4F, 0xD8, 0xB1, 0x28, 0xD8, 0x4F,
0x28, 0xB1, 0x8A, 0xFD, 0x76, 0x03, 0xFD, 0x8A,
0x03, 0x76, 0xDB, 0xFF, 0x25, 0x01, 0xFF, 0xDB,
0x01, 0x25, 0xF9, 0xFF, 0x07, 0x01, 0xFF, 0xF9,
0x01, 0x07, 0xBE, 0xFF, 0x42, 0x01, 0xFF, 0xBE,
0x01, 0x42, 0x5E, 0xED, 0xA2, 0x13, 0xED, 0x5E,
0x13, 0xA2, 0xFF, 0xFF, 0x01, 0x01, 0x80, 0x80, },
};
#endif /* AVCODEC_INDEO2DATA_H */

@ -17,8 +17,46 @@
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* **********************************************************************************************************************
*
*
*
* This source code incorporates work covered by the following copyright and
* permission notice:
*
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* JPEG2000 image encoder
* @file

@ -352,6 +352,12 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
ctx->enc_params.cp_cinema = ctx->cinema_mode;
#endif
if (!ctx->numresolution) {
ctx->numresolution = 6;
while (FFMIN(avctx->width, avctx->height) >> ctx->numresolution < 1)
ctx->numresolution --;
}
ctx->enc_params.mode = !!avctx->global_quality;
ctx->enc_params.prog_order = ctx->prog_order;
ctx->enc_params.numresolution = ctx->numresolution;
@ -814,7 +820,7 @@ static const AVOption options[] = {
{ "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(RPCL) }, 0, 0, VE, "prog_order" },
{ "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(PCRL) }, 0, 0, VE, "prog_order" },
{ "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CPRL) }, 0, 0, VE, "prog_order" },
{ "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 6 }, 1, INT_MAX, VE },
{ "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
{ "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 10, VE },
{ "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
{ "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },

@ -222,9 +222,19 @@ static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
pic->data[0] = utv->buffer + utv->buf_size + pic->linesize[0];
break;
}
pic->width = w;
pic->height = h;
pic->format = avctx->pix_fmt;
if (avctx->refcounted_frames) {
int ret = av_frame_ref((AVFrame*)data, pic);
if (ret < 0)
return ret;
} else {
av_frame_move_ref((AVFrame*)data, pic);
}
*got_frame = 1;
av_frame_move_ref((AVFrame*)data, pic);
return avpkt->size;
}

@ -41,8 +41,9 @@ static av_cold int libwebp_anim_encode_init(AVCodecContext *avctx)
int ret = ff_libwebp_encode_init_common(avctx);
if (!ret) {
LibWebPAnimContext *s = avctx->priv_data;
WebPAnimEncoderOptions enc_options;
WebPAnimEncoderOptions enc_options = { 0 };
WebPAnimEncoderOptionsInit(&enc_options);
enc_options.verbose = av_log_get_level() >= AV_LOG_VERBOSE;
// TODO(urvang): Expose some options on command-line perhaps.
s->enc = WebPAnimEncoderNew(avctx->width, avctx->height, &enc_options);
if (!s->enc)

@ -66,6 +66,7 @@
#include "libavcodec/aacenc_utils.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
typedef struct BandCodingPath {
int prev_idx;
float cost;
@ -2477,10 +2478,12 @@ static void search_for_ms_mips(AACEncContext *s, ChannelElement *cpe)
#include "libavcodec/aaccoder_trellis.h"
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
void ff_aac_coder_init_mips(AACEncContext *c) {
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
AACCoefficientsEncoder *e = c->coder;
int option = c->options.coder;
@ -2494,5 +2497,6 @@ void ff_aac_coder_init_mips(AACEncContext *c) {
#if HAVE_MIPSFPU
e->search_for_ms = search_for_ms_mips;
#endif /* HAVE_MIPSFPU */
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
}

@ -61,6 +61,7 @@
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM && HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static inline float *VMUL2_mips(float *dst, const float *v, unsigned idx,
const float *scale)
{
@ -246,6 +247,7 @@ static inline float *VMUL4S_mips(float *dst, const float *v, unsigned idx,
#define VMUL4 VMUL4_mips
#define VMUL2S VMUL2S_mips
#define VMUL4S VMUL4S_mips
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM && HAVE_MIPSFPU */
#endif /* AVCODEC_MIPS_AACDEC_MIPS_H */

@ -188,6 +188,7 @@ static void ps_hybrid_synthesis_deint_mips(float out[2][38][64],
}
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void ps_add_squares_mips(float *dst, const float (*src)[2], int n)
{
int i;
@ -442,6 +443,7 @@ static void ps_stereo_interpolate_mips(float (*l)[2], float (*r)[2],
: "memory"
);
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
@ -451,10 +453,12 @@ void ff_psdsp_init_mips(PSDSPContext *s)
s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_mips;
s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_mips;
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
s->add_squares = ps_add_squares_mips;
s->mul_pair_single = ps_mul_pair_single_mips;
s->decorrelate = ps_decorrelate_mips;
s->stereo_interpolate[0] = ps_stereo_interpolate_mips;
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
}

@ -59,6 +59,7 @@
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM && HAVE_MIPSFPU && ( PSY_LAME_FIR_LEN == 21 )
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void calc_thr_3gpp_mips(const FFPsyWindowInfo *wi, const int num_bands,
AacPsyChannel *pch, const uint8_t *band_sizes,
const float *coefs, const int cutoff)
@ -232,5 +233,6 @@ static void psy_hp_filter_mips(const float *firbuf, float *hpfsmpl, const float
#define calc_thr_3gpp calc_thr_3gpp_mips
#define psy_hp_filter psy_hp_filter_mips
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM && HAVE_MIPSFPU */
#endif /* AVCODEC_MIPS_AACPSY_MIPS_H */

@ -311,6 +311,7 @@ static int sbr_x_gen_mips(SpectralBandReplication *sbr, float X[2][38][64],
}
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void sbr_hf_assemble_mips(float Y1[38][64][2],
const float X_high[64][40][2],
SpectralBandReplication *sbr, SBRData *ch_data,
@ -603,6 +604,7 @@ static void sbr_hf_inverse_filter_mips(SBRDSPContext *dsp,
}
}
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
@ -612,8 +614,10 @@ void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c)
c->sbr_lf_gen = sbr_lf_gen_mips;
c->sbr_x_gen = sbr_x_gen_mips;
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
c->sbr_hf_inverse_filter = sbr_hf_inverse_filter_mips;
c->sbr_hf_assemble = sbr_hf_assemble_mips;
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
}

@ -150,6 +150,7 @@ static void sbr_qmf_analysis_mips(AVFloatDSPContext *fdsp, FFTContext *mdct,
}
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void sbr_qmf_synthesis_mips(FFTContext *mdct,
SBRDSPContext *sbrdsp, AVFloatDSPContext *fdsp,
float *out, float X[2][38][64],
@ -488,6 +489,7 @@ static void sbr_qmf_synthesis_mips(FFTContext *mdct,
#define sbr_qmf_analysis sbr_qmf_analysis_mips
#define sbr_qmf_synthesis sbr_qmf_synthesis_mips
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */

@ -201,6 +201,7 @@ static void ac3_update_bap_counts_mips(uint16_t mant_cnt[16], uint8_t *bap,
#endif
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void float_to_fixed24_mips(int32_t *dst, const float *src, unsigned int len)
{
const float scale = 1 << 24;
@ -395,7 +396,8 @@ static void ac3_downmix_mips(float **samples, float (*matrix)[2],
:"memory"
);
}
#endif
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
void ff_ac3dsp_init_mips(AC3DSPContext *c, int bit_exact) {
@ -405,9 +407,11 @@ void ff_ac3dsp_init_mips(AC3DSPContext *c, int bit_exact) {
c->update_bap_counts = ac3_update_bap_counts_mips;
#endif
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
c->float_to_fixed24 = float_to_fixed24_mips;
c->downmix = ac3_downmix_mips;
#endif
#endif
#endif
}

@ -57,6 +57,7 @@
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void ff_acelp_interpolatef_mips(float *out, const float *in,
const float *filter_coeffs, int precision,
int frac_pos, int filter_length, int length)
@ -206,12 +207,15 @@ static void ff_acelp_apply_order_2_transfer_function_mips(float *out, const floa
"$f12", "$f13", "$f14", "$f15", "$f16", "memory"
);
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
void ff_acelp_filter_init_mips(ACELPFContext *c)
{
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
c->acelp_interpolatef = ff_acelp_interpolatef_mips;
c->acelp_apply_order_2_transfer_function = ff_acelp_apply_order_2_transfer_function_mips;
#endif
#endif
}

@ -57,6 +57,7 @@
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void ff_weighted_vector_sumf_mips(
float *out, const float *in_a, const float *in_b,
float weight_coeff_a, float weight_coeff_b, int length)
@ -92,11 +93,14 @@ static void ff_weighted_vector_sumf_mips(
: "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "memory"
);
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
void ff_acelp_vectors_init_mips(ACELPVContext *c)
{
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
c->weighted_vector_sumf = ff_weighted_vector_sumf_mips;
#endif
#endif
}

@ -54,6 +54,7 @@
#include "amrwbdec_mips.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
void ff_hb_fir_filter_mips(float *out, const float fir_coef[HB_FIR_SIZE + 1],
float mem[HB_FIR_SIZE], const float *in)
{
@ -184,4 +185,5 @@ void ff_hb_fir_filter_mips(float *out, const float fir_coef[HB_FIR_SIZE + 1],
}
memcpy(mem, data + AMRWB_SFR_SIZE_16k, HB_FIR_SIZE * sizeof(float));
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */

@ -54,9 +54,11 @@
#include "config.h"
#if HAVE_MIPSFPU && HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
void ff_hb_fir_filter_mips(float *out, const float fir_coef[],
float mem[], const float *in);
#define hb_fir_filter ff_hb_fir_filter_mips
#endif
#endif
#endif /* AVCODEC_MIPS_AMRWBDEC_MIPS_H */

@ -58,6 +58,7 @@
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void ff_celp_lp_synthesis_filterf_mips(float *out,
const float *filter_coeffs,
const float* in, int buffer_length,
@ -278,12 +279,15 @@ static void ff_celp_lp_zero_synthesis_filterf_mips(float *out,
out[n] = sum_out1;
}
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
void ff_celp_filter_init_mips(CELPFContext *c)
{
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
c->celp_lp_synthesis_filterf = ff_celp_lp_synthesis_filterf_mips;
c->celp_lp_zero_synthesis_filterf = ff_celp_lp_zero_synthesis_filterf_mips;
#endif
#endif
}

@ -56,6 +56,7 @@
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static float ff_dot_productf_mips(const float* a, const float* b,
int length)
{
@ -80,11 +81,14 @@ static float ff_dot_productf_mips(const float* a, const float* b,
);
return sum;
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
void ff_celp_math_init_mips(CELPMContext *c)
{
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
c->dot_productf = ff_dot_productf_mips;
#endif
#endif
}

@ -58,6 +58,7 @@
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void compute_antialias_mips_float(MPADecodeContext *s,
GranuleDef *g)
{
@ -179,6 +180,7 @@ static void compute_antialias_mips_float(MPADecodeContext *s,
);
}
#define compute_antialias compute_antialias_mips_float
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H */

@ -57,6 +57,7 @@
*/
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void ff_fft_calc_mips(FFTContext *s, FFTComplex *z)
{
int nbits, i, n, num_transforms, offset, step;
@ -494,6 +495,7 @@ static void ff_imdct_calc_mips(FFTContext *s, FFTSample *output, const FFTSample
output[n-k-4] = output[n2+k+3];
}
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
av_cold void ff_fft_init_mips(FFTContext *s)
@ -504,10 +506,12 @@ av_cold void ff_fft_init_mips(FFTContext *s)
ff_init_ff_cos_tabs(16);
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
s->fft_calc = ff_fft_calc_mips;
#if CONFIG_MDCT
s->imdct_calc = ff_imdct_calc_mips;
s->imdct_half = ff_imdct_half_mips;
#endif
#endif
#endif
}

@ -55,6 +55,7 @@
#include "libavcodec/iirfilter.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
typedef struct FFIIRFilterCoeffs {
int order;
float gain;
@ -195,10 +196,13 @@ static void ff_iir_filter_flt_mips(const struct FFIIRFilterCoeffs *c,
}
}
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
void ff_iir_filter_init_mips(FFIIRFilterContext *f) {
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
f->filter_flt = ff_iir_filter_flt_mips;
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
}

@ -55,6 +55,7 @@
#define AVCODEC_MIPS_LSP_MIPS_H
#if HAVE_MIPSFPU && HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
#include "libavutil/mips/asmdefs.h"
static av_always_inline void ff_lsp2polyf_mips(const double *lsp, double *f, int lp_half_order)
@ -107,5 +108,6 @@ static av_always_inline void ff_lsp2polyf_mips(const double *lsp, double *f, int
}
}
#define ff_lsp2polyf ff_lsp2polyf_mips
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU && HAVE_INLINE_ASM */
#endif /* AVCODEC_MIPS_LSP_MIPS_H */

@ -57,6 +57,9 @@
#include "libavutil/mips/asmdefs.h"
#include "libavcodec/mpegaudiodsp.h"
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void ff_mpadsp_apply_window_mips_fixed(int32_t *synth_buf, int32_t *window,
int *dither_state, int16_t *samples, int incr)
{
@ -901,8 +904,15 @@ static void ff_imdct36_blocks_mips_fixed(int *out, int *buf, int *in,
}
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM */
void ff_mpadsp_init_mipsdsp(MPADSPContext *s)
{
#if HAVE_INLINE_ASM
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
s->apply_window_fixed = ff_mpadsp_apply_window_mips_fixed;
s->imdct36_blocks_fixed = ff_imdct36_blocks_mips_fixed;
#endif
#endif
}

@ -58,6 +58,9 @@
#include "libavutil/mips/asmdefs.h"
#include "libavcodec/mpegaudiodsp.h"
#if HAVE_INLINE_ASM && HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void ff_mpadsp_apply_window_mips_float(float *synth_buf, float *window,
int *dither_state, float *samples, int incr)
{
@ -1243,9 +1246,16 @@ static void ff_imdct36_blocks_mips_float(float *out, float *buf, float *in,
}
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_INLINE_ASM && HAVE_MIPSFPU */
void ff_mpadsp_init_mipsfpu(MPADSPContext *s)
{
#if HAVE_INLINE_ASM && HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
s->apply_window_float = ff_mpadsp_apply_window_mips_float;
s->imdct36_blocks_float = ff_imdct36_blocks_mips_float;
s->dct32_float = ff_dct32_mips_float;
#endif
#endif
}

@ -166,6 +166,7 @@ static void sbr_qmf_post_shuffle_mips(float W[32][2], const float *z)
}
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
static void sbr_sum64x5_mips(float *z)
{
int k;
@ -882,6 +883,7 @@ static void sbr_hf_apply_noise_3_mips(float (*Y)[2], const float *s_m,
phi_sign = -phi_sign;
}
}
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
@ -891,6 +893,7 @@ void ff_sbrdsp_init_mips(SBRDSPContext *s)
s->qmf_pre_shuffle = sbr_qmf_pre_shuffle_mips;
s->qmf_post_shuffle = sbr_qmf_post_shuffle_mips;
#if HAVE_MIPSFPU
#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
s->sum64x5 = sbr_sum64x5_mips;
s->sum_square = sbr_sum_square_mips;
s->qmf_deint_bfly = sbr_qmf_deint_bfly_mips;
@ -902,6 +905,7 @@ void ff_sbrdsp_init_mips(SBRDSPContext *s)
s->hf_apply_noise[1] = sbr_hf_apply_noise_1_mips;
s->hf_apply_noise[2] = sbr_hf_apply_noise_2_mips;
s->hf_apply_noise[3] = sbr_hf_apply_noise_3_mips;
#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
}

@ -1369,11 +1369,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
int mb_x, mb_y;
int EOBRUN = 0;
int c = s->comp_index[0];
uint8_t *data = s->picture_ptr->data[c];
int linesize = s->linesize[c];
int last_scan = 0;
int16_t *quant_matrix = s->quant_matrixes[s->quant_sindex[0]];
int bytes_per_pixel = 1 + (s->bits > 8);
av_assert0(ss>=0 && Ah>=0 && Al>=0);
if (se < ss || se > 63) {
@ -1381,20 +1377,13 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
return AVERROR_INVALIDDATA;
}
if (!Al) {
// s->coefs_finished is a bitmask for coefficients coded
// ss and se are parameters telling start and end coefficients
s->coefs_finished[c] |= (2ULL << se) - (1ULL << ss);
last_scan = !~s->coefs_finished[c];
}
if (s->interlaced && s->bottom_field)
data += linesize >> 1;
// s->coefs_finished is a bitmask for coefficients coded
// ss and se are parameters telling start and end coefficients
s->coefs_finished[c] |= (2ULL << se) - (1ULL << ss);
s->restart_count = 0;
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
uint8_t *ptr = data + (mb_y * linesize * 8 >> s->avctx->lowres);
int block_idx = mb_y * s->block_stride[c];
int16_t (*block)[64] = &s->blocks[c][block_idx];
uint8_t *last_nnz = &s->last_nnz[c][block_idx];
@ -1415,12 +1404,6 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
return AVERROR_INVALIDDATA;
}
if (last_scan) {
s->idsp.idct_put(ptr, linesize, *block);
if (s->bits & 7)
shift_output(s, ptr, linesize);
ptr += bytes_per_pixel*8 >> s->avctx->lowres;
}
if (handle_rstn(s, 0))
EOBRUN = 0;
}
@ -1428,6 +1411,41 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
return 0;
}
static void mjpeg_idct_scan_progressive_ac(MJpegDecodeContext *s)
{
int mb_x, mb_y;
int c;
const int bytes_per_pixel = 1 + (s->bits > 8);
const int block_size = s->lossless ? 1 : 8;
for (c = 0; c < s->nb_components; c++) {
uint8_t *data = s->picture_ptr->data[c];
int linesize = s->linesize[c];
int h = s->h_max / s->h_count[c];
int v = s->v_max / s->v_count[c];
int mb_width = (s->width + h * block_size - 1) / (h * block_size);
int mb_height = (s->height + v * block_size - 1) / (v * block_size);
if (~s->coefs_finished[c])
av_log(s->avctx, AV_LOG_WARNING, "component %d is incomplete\n", c);
if (s->interlaced && s->bottom_field)
data += linesize >> 1;
for (mb_y = 0; mb_y < mb_height; mb_y++) {
uint8_t *ptr = data + (mb_y * linesize * 8 >> s->avctx->lowres);
int block_idx = mb_y * s->block_stride[c];
int16_t (*block)[64] = &s->blocks[c][block_idx];
for (mb_x = 0; mb_x < mb_width; mb_x++, block++) {
s->idsp.idct_put(ptr, linesize, *block);
if (s->bits & 7)
shift_output(s, ptr, linesize);
ptr += bytes_per_pixel*8 >> s->avctx->lowres;
}
}
}
}
int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
int mb_bitmask_size, const AVFrame *reference)
{
@ -2164,6 +2182,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break;
case EOI:
eoi_parser:
if (avctx->skip_frame != AVDISCARD_ALL && s->progressive && s->cur_scan && s->got_picture)
mjpeg_idct_scan_progressive_ac(s);
s->cur_scan = 0;
if (!s->got_picture) {
av_log(avctx, AV_LOG_WARNING,

@ -122,6 +122,16 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
uint8_t *ptr;
if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
AVRational sar = avctx->sample_aspect_ratio;
if (sar.num > 65535 || sar.den > 65535) {
if (!av_reduce(&sar.num, &sar.den, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 65535))
av_log(avctx, AV_LOG_WARNING,
"Cannot store exact aspect ratio %d:%d\n",
avctx->sample_aspect_ratio.num,
avctx->sample_aspect_ratio.den);
}
/* JFIF header */
put_marker(p, APP0);
put_bits(p, 16, 16);
@ -131,8 +141,8 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
* released revision. */
put_bits(p, 16, 0x0102);
put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
put_bits(p, 16, avctx->sample_aspect_ratio.num);
put_bits(p, 16, avctx->sample_aspect_ratio.den);
put_bits(p, 16, sar.num);
put_bits(p, 16, sar.den);
put_bits(p, 8, 0); /* thumbnail width */
put_bits(p, 8, 0); /* thumbnail height */
}

@ -1216,6 +1216,8 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
}
ff_mpeg_unref_picture(s->avctx, &s->current_picture);
ff_mpeg_unref_picture(s->avctx, &s->last_picture);
ff_mpeg_unref_picture(s->avctx, &s->next_picture);
/* release non reference frames */
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
@ -1367,14 +1369,12 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
memset(s->next_picture.f->data, 0, sizeof(s->next_picture.f->data));
#endif
if (s->last_picture_ptr) {
ff_mpeg_unref_picture(s->avctx, &s->last_picture);
if (s->last_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s->avctx, &s->last_picture,
s->last_picture_ptr)) < 0)
return ret;
}
if (s->next_picture_ptr) {
ff_mpeg_unref_picture(s->avctx, &s->next_picture);
if (s->next_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s->avctx, &s->next_picture,
s->next_picture_ptr)) < 0)

@ -354,8 +354,14 @@ static int parse_palette_segment(AVCodecContext *avctx,
cb = bytestream_get_byte(&buf);
alpha = bytestream_get_byte(&buf);
YUV_TO_RGB1(cb, cr);
YUV_TO_RGB2(r, g, b, y);
/* Default to BT.709 colorimetry. In case of <= 576 height use BT.601 */
if (avctx->height <= 0 || avctx->height > 576) {
YUV_TO_RGB1_CCIR_BT709(cb, cr);
} else {
YUV_TO_RGB1_CCIR(cb, cr);
}
YUV_TO_RGB2_CCIR(r, g, b, y);
ff_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);

@ -1136,6 +1136,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
case MKTAG('p', 'H', 'Y', 's'):
case MKTAG('t', 'E', 'X', 't'):
case MKTAG('I', 'D', 'A', 'T'):
case MKTAG('t', 'R', 'N', 'S'):
break;
default:
goto skip_tag;

@ -291,12 +291,6 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
short *output_bak = NULL;
int lenout;
if (s->input_channels == s->output_channels && s->ratio == 1.0 && 0) {
/* nothing to do */
memcpy(output, input, nb_samples * s->input_channels * sizeof(short));
return nb_samples;
}
if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {
int istride[1] = { s->sample_size[0] };
int ostride[1] = { 2 };

@ -223,6 +223,12 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
ff_dlog(avctx, "pixel_size %d packed_size %d.\n", pixel_size, packed_size);
if (packed_size < 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid tile size %d\n", packed_size);
ret = AVERROR_INVALIDDATA;
goto end;
}
/* Get pixels buffer, it may be deflated or just raw */
if (pixel_size == packed_size) {
if (bytestream2_get_bytes_left(gbc) < pixel_size) {
@ -233,6 +239,11 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
pixels = gbc->buffer;
} else {
uLongf len = ctx->inflated_size;
if (bytestream2_get_bytes_left(gbc) < packed_size) {
av_log(avctx, AV_LOG_ERROR, "Insufficient input for %d\n", packed_size);
ret = AVERROR_INVALIDDATA;
goto end;
}
ret = uncompress(ctx->inflated_buf, &len, gbc->buffer, packed_size);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Pixel deflate error %d.\n", ret);

@ -227,6 +227,7 @@ static void decode_lpc(int32_t *coeffs, int mode, int length)
int a3 = coeffs[2];
int a4 = a3 + a1;
int a5 = a4 + a2;
coeffs[2] = a5;
coeffs += 3;
for (i = 0; i < length - 3; i++) {
a3 += *coeffs;

@ -114,9 +114,12 @@ static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
{
TTAEncContext *s = avctx->priv_data;
PutBitContext pb;
int ret, i, out_bytes, cur_chan = 0, res = 0, samples = 0;
int ret, i, out_bytes, cur_chan, res, samples;
int64_t pkt_size = frame->nb_samples * 2LL * avctx->channels * s->bps;
if ((ret = ff_alloc_packet2(avctx, avpkt, frame->nb_samples * 2 * avctx->channels * s->bps, 0)) < 0)
pkt_alloc:
cur_chan = 0, res = 0, samples = 0;
if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size, 0)) < 0)
return ret;
init_put_bits(&pb, avpkt->data, avpkt->size);
@ -174,6 +177,14 @@ static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
rice->k1++;
unary = 1 + (outval >> k);
if (unary + 100LL > put_bits_left(&pb)) {
if (pkt_size < INT_MAX/2) {
pkt_size *= 2;
av_packet_unref(avpkt);
goto pkt_alloc;
} else
return AVERROR(ENOMEM);
}
do {
if (unary > 31) {
put_bits(&pb, 31, 0x7FFFFFFF);

@ -658,7 +658,8 @@ static int rate_control(AVCodecContext *avctx, void *arg)
VC2EncContext *s = slice_dat->ctx;
const int sx = slice_dat->x;
const int sy = slice_dat->y;
int quant_buf[2], bits_buf[2], quant = s->q_start, range = s->q_start/3;
int bits_last = INT_MAX, quant_buf[2] = {-1, -1};
int quant = s->q_start, range = s->q_start/3;
const int64_t top = slice_dat->bits_ceil;
const double percent = s->tolerance;
const double bottom = top - top*(percent/100.0f);
@ -670,14 +671,13 @@ static int rate_control(AVCodecContext *avctx, void *arg)
bits = count_hq_slice(s, sx, sy, quant);
range = av_clip(range/2, 1, s->q_ceil);
if (quant_buf[1] == quant) {
quant = bits_buf[0] < bits ? quant_buf[0] : quant;
bits = bits_buf[0] < bits ? bits_buf[0] : bits;
quant = bits_last < bits ? quant_buf[0] : quant;
bits = bits_last < bits ? bits_last : bits;
break;
}
quant_buf[1] = quant_buf[0];
quant_buf[0] = quant;
bits_buf[1] = bits_buf[0];
bits_buf[0] = bits;
bits_last = bits;
}
slice_dat->quant_idx = av_clip(quant, 0, s->q_ceil);
slice_dat->bytes = FFALIGN((bits >> 3), s->size_scaler) + 4 + s->prefix_bytes;
@ -867,7 +867,7 @@ static int dwt_plane(AVCodecContext *avctx, void *arg)
}
}
memset(buf, 0, (p->coef_stride*p->dwt_height - p->height*p->width)*sizeof(dwtcoef));
memset(buf, 0, p->coef_stride * (p->dwt_height - p->height) * sizeof(dwtcoef));
for (level = s->wavelet_depth-1; level >= 0; level--) {
const SubBand *b = &p->band[level][0];

@ -753,6 +753,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
c->transform_add[3] = ff_hevc_transform_add32_8_avx;
}
if (EXTERNAL_AVX2(cpu_flags)) {
c->sao_band_filter[0] = ff_hevc_sao_band_filter_8_8_avx2;
c->sao_band_filter[1] = ff_hevc_sao_band_filter_16_8_avx2;
}
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
c->idct_dc[2] = ff_hevc_idct16x16_dc_8_avx2;
c->idct_dc[3] = ff_hevc_idct32x32_dc_8_avx2;
if (ARCH_X86_64) {
@ -897,7 +901,9 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
SAO_BAND_INIT(10, avx);
}
if (EXTERNAL_AVX2(cpu_flags)) {
c->sao_band_filter[0] = ff_hevc_sao_band_filter_8_10_avx2;
}
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
c->idct_dc[2] = ff_hevc_idct16x16_dc_10_avx2;
c->idct_dc[3] = ff_hevc_idct32x32_dc_10_avx2;
if (ARCH_X86_64) {
@ -1095,6 +1101,9 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
SAO_BAND_INIT(12, avx);
}
if (EXTERNAL_AVX2(cpu_flags)) {
c->sao_band_filter[0] = ff_hevc_sao_band_filter_8_12_avx2;
}
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
c->idct_dc[2] = ff_hevc_idct16x16_dc_12_avx2;
c->idct_dc[3] = ff_hevc_idct32x32_dc_12_avx2;

@ -98,7 +98,7 @@ av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c)
c->diff_bytes = ff_diff_bytes_sse2;
}
if (EXTERNAL_AVX2(cpu_flags)) {
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
c->diff_bytes = ff_diff_bytes_avx2;
}
}

@ -44,7 +44,7 @@ av_cold void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c)
c->mct_decode[FF_DWT97] = ff_ict_float_avx;
}
if (EXTERNAL_AVX2(cpu_flags)) {
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
c->mct_decode[FF_DWT53] = ff_rct_int_avx2;
}
}

@ -199,6 +199,6 @@ av_cold void ff_mlpdsp_init_x86(MLPDSPContext *c)
#endif
if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags))
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_sse4;
if (ARCH_X86_64 && EXTERNAL_AVX2(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_avx2_bmi2;
}

@ -67,7 +67,7 @@ av_cold void ff_synth_filter_init_x86(SynthFilterContext *s)
if (EXTERNAL_AVX_FAST(cpu_flags)) {
s->synth_filter_float = synth_filter_avx;
}
if (EXTERNAL_FMA3(cpu_flags) && !(cpu_flags & AV_CPU_FLAG_AVXSLOW)) {
if (EXTERNAL_FMA3_FAST(cpu_flags)) {
s->synth_filter_float = synth_filter_fma3;
}
#endif /* HAVE_YASM */

@ -45,7 +45,7 @@ av_cold void ff_v210enc_init_x86(V210EncContext *s)
if (EXTERNAL_AVX(cpu_flags))
s->pack_line_8 = ff_v210_planar_pack_8_avx;
if (EXTERNAL_AVX2(cpu_flags)) {
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
s->pack_line_8 = ff_v210_planar_pack_8_avx2;
s->pack_line_10 = ff_v210_planar_pack_10_avx2;
s->sample_factor = 2;

@ -377,7 +377,7 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact)
init_ipred(32, avx, v, VERT);
}
if (EXTERNAL_AVX2(cpu_flags)) {
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
init_fpel_func(1, 1, 32, avg, _8, avx2);
init_fpel_func(0, 1, 64, avg, _8, avx2);
if (ARCH_X86_64) {

@ -129,7 +129,7 @@ av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp)
init_ipred_funcs(hd, HOR_DOWN, 16, avx);
}
if (EXTERNAL_AVX2(cpu_flags)) {
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
init_fpel_func(2, 1, 32, avg, _16, avx2);
init_fpel_func(1, 1, 64, avg, _16, avx2);
init_fpel_func(0, 1, 128, avg, _16, avx2);

@ -225,7 +225,7 @@ av_cold void INIT_FUNC(VP9DSPContext *dsp, int bitexact)
init_lpf_funcs(BPC, avx);
}
if (EXTERNAL_AVX2(cpu_flags)) {
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
#if HAVE_AVX2_EXTERNAL
init_subpel3_32_64(0, put, BPC, avx2);
init_subpel3_32_64(1, avg, BPC, avx2);

@ -240,7 +240,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
timestamp = movie->seek_point;
// add the stream start time, should it exist
if (movie->format_ctx->start_time != AV_NOPTS_VALUE) {
if (timestamp > INT64_MAX - movie->format_ctx->start_time) {
if (timestamp > 0 && movie->format_ctx->start_time > INT64_MAX - timestamp) {
av_log(ctx, AV_LOG_ERROR,
"%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n",
movie->file_name, movie->format_ctx->start_time, movie->seek_point);

@ -1222,7 +1222,9 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame,
dummy.code = code;
glyph = av_tree_find(s->glyphs, &dummy, glyph_cmp, NULL);
if (!glyph) {
load_glyph(ctx, &glyph, code);
ret = load_glyph(ctx, &glyph, code);
if (ret < 0)
return ret;
}
y_min = FFMIN(glyph->bbox.yMin, y_min);

@ -1695,6 +1695,8 @@ static int guess_ni_flag(AVFormatContext *s)
size = avio_rl32(s->pb);
if (get_stream_idx(tag) == i && pos + size > st->index_entries[1].pos)
last_start = INT64_MAX;
if (get_stream_idx(tag) == i && size == st->index_entries[0].size + 8)
last_start = INT64_MAX;
}
if (st->index_entries[0].pos > last_start)

@ -283,6 +283,12 @@ resolve_eof:
return ret;
}
static int enu_free(void *opaque, void *elem)
{
av_free(elem);
return 0;
}
static int cache_close(URLContext *h)
{
Context *c= h->priv_data;
@ -292,6 +298,7 @@ static int cache_close(URLContext *h)
close(c->fd);
ffurl_close(c->inner);
av_tree_enumerate(c->root, NULL, NULL, enu_free);
av_tree_destroy(c->root);
return 0;

@ -710,7 +710,7 @@ static int concat_seek(AVFormatContext *avf, int stream,
static const AVOption options[] = {
{ "safe", "enable safe mode",
OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, DEC },
OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, DEC },
{ "auto_convert", "automatically convert bitstream format",
OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC },
{ "segment_time_metadata", "output file segment start time and duration as packet metadata",

@ -27,6 +27,7 @@
#include "libavutil/opt.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/pixdesc.h"
#include "avformat.h"
#include "internal.h"
#include "ffm.h"
@ -377,6 +378,11 @@ static int ffm2_read_header(AVFormatContext *s)
codec->height = avio_rb16(pb);
codec->gop_size = avio_rb16(pb);
codec->pix_fmt = avio_rb32(pb);
if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
codec->pix_fmt = AV_PIX_FMT_NONE;
goto fail;
}
codec->qmin = avio_r8(pb);
codec->qmax = avio_r8(pb);
codec->max_qdiff = avio_r8(pb);
@ -569,6 +575,11 @@ static int ffm_read_header(AVFormatContext *s)
codec->height = avio_rb16(pb);
codec->gop_size = avio_rb16(pb);
codec->pix_fmt = avio_rb32(pb);
if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
codec->pix_fmt = AV_PIX_FMT_NONE;
goto fail;
}
codec->qmin = avio_r8(pb);
codec->qmax = avio_r8(pb);
codec->max_qdiff = avio_r8(pb);
@ -775,8 +786,8 @@ static int ffm_probe(AVProbeData *p)
static const AVOption options[] = {
{"server_attached", NULL, offsetof(FFMContext, server_attached), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
{"ffm_write_index", NULL, offsetof(FFMContext, write_index), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
{"ffm_file_size", NULL, offsetof(FFMContext, file_size), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, 1, AV_OPT_FLAG_EXPORT },
{"ffm_write_index", NULL, offsetof(FFMContext, write_index), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, AV_OPT_FLAG_EXPORT },
{"ffm_file_size", NULL, offsetof(FFMContext, file_size), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, AV_OPT_FLAG_EXPORT },
{ NULL },
};

@ -349,7 +349,7 @@ URLProtocol ff_file_protocol = {
.url_open_dir = file_open_dir,
.url_read_dir = file_read_dir,
.url_close_dir = file_close_dir,
.default_whitelist = "file"
.default_whitelist = "file,crypto"
};
#endif /* CONFIG_FILE_PROTOCOL */
@ -388,7 +388,7 @@ URLProtocol ff_pipe_protocol = {
.url_check = file_check,
.priv_data_size = sizeof(FileContext),
.priv_data_class = &pipe_class,
.default_whitelist = "none"
.default_whitelist = "crypto"
};
#endif /* CONFIG_PIPE_PROTOCOL */

@ -396,7 +396,7 @@ static int hls_window(AVFormatContext *s, int last)
set_http_options(&options, hls);
snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename);
if ((ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL)) < 0)
if ((ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, &options)) < 0)
goto fail;
for (en = hls->segments; en; en = en->next) {

@ -1522,7 +1522,7 @@ URLProtocol ff_http_protocol = {
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &http_context_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
.default_whitelist = "http,https,tls,rtp,tcp,udp,crypto"
.default_whitelist = "http,https,tls,rtp,tcp,udp,crypto,httpproxy"
};
#endif /* CONFIG_HTTP_PROTOCOL */
@ -1541,7 +1541,7 @@ URLProtocol ff_https_protocol = {
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &https_context_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
.default_whitelist = "http,https,tls,rtp,tcp,udp,crypto"
.default_whitelist = "http,https,tls,rtp,tcp,udp,crypto,httpproxy"
};
#endif /* CONFIG_HTTPS_PROTOCOL */

@ -193,6 +193,8 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
if (sep)
p = sep + 1;
else
break;
}
}
if (ctx->playpath) {

@ -3609,7 +3609,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", dts);
} else {
dts = frag->time;
dts = frag->time - sc->time_offset;
av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64
", using it for dts\n", dts);
}
@ -3666,7 +3666,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
version = avio_r8(pb);
if (version > 1) {
avpriv_request_sample(c->fc, "sidx version %u", version);
return AVERROR_PATCHWELCOME;
return 0;
}
avio_rb24(pb); // flags
@ -3679,8 +3679,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
}
if (!st) {
av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", track_id);
return AVERROR_INVALIDDATA;
av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %d\n", track_id);
return 0;
}
sc = st->priv_data;

@ -2441,7 +2441,7 @@ static int mpegts_probe(AVProbeData *p)
#define CHECK_COUNT 10
#define CHECK_BLOCK 100
if (check_count < CHECK_COUNT)
if (!check_count)
return 0;
for (i = 0; i<check_count; i+=CHECK_BLOCK) {
@ -2459,10 +2459,15 @@ static int mpegts_probe(AVProbeData *p)
ff_dlog(0, "TS score: %d %d\n", sumscore, maxscore);
if (sumscore > 6) return AVPROBE_SCORE_MAX + sumscore - CHECK_COUNT;
else if (maxscore > 6) return AVPROBE_SCORE_MAX/2 + sumscore - CHECK_COUNT;
else
if (check_count >= CHECK_COUNT && sumscore > 6) {
return AVPROBE_SCORE_MAX + sumscore - CHECK_COUNT;
} else if (check_count >= CHECK_COUNT && maxscore > 6) {
return AVPROBE_SCORE_MAX/2 + sumscore - CHECK_COUNT;
} else if (sumscore > 6) {
return 2;
} else {
return 0;
}
}
/* return the 90kHz PCR and the extension for the 27MHz PCR. return

@ -56,6 +56,7 @@ typedef struct MpegTSService {
int pcr_pid;
int pcr_packet_count;
int pcr_packet_period;
AVProgram *program;
} MpegTSService;
// service_type values as defined in ETSI 300 468
@ -275,15 +276,12 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
if (s->nb_programs) {
int j, k, found = 0;
int k, found = 0;
AVProgram *program = service->program;
for (j = 0; j < s->nb_programs; j++)
if (s->programs[j]->id == service->sid) {
for (k = 0; k < s->programs[j]->nb_stream_indexes; k++)
if (s->programs[j]->stream_index[k] == i) {
found = 1;
break;
}
for (k = 0; k < program->nb_stream_indexes; k++)
if (program->stream_index[k] == i) {
found = 1;
break;
}
@ -784,6 +782,7 @@ static int mpegts_init(AVFormatContext *s)
service->pmt.write_packet = section_write_packet;
service->pmt.opaque = s;
service->pmt.cc = 15;
service->program = program;
}
}
@ -807,6 +806,7 @@ static int mpegts_init(AVFormatContext *s)
/* assign pids to each stream */
for (i = 0; i < s->nb_streams; i++) {
AVProgram *program;
st = s->streams[i];
ts_st = av_mallocz(sizeof(MpegTSWriteStream));
@ -824,6 +824,17 @@ static int mpegts_init(AVFormatContext *s)
ret = AVERROR(ENOMEM);
goto fail;
}
program = av_find_program_from_stream(s, NULL, i);
if (program) {
for (j = 0; j < ts->nb_services; j++) {
if (ts->services[j]->program == program) {
service = ts->services[j];
break;
}
}
}
ts_st->service = service;
/* MPEG pid values < 16 are reserved. Applications which set st->id in
* this range are assigned a calculated pid. */

@ -400,7 +400,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
if (s->oformat->init && (ret = s->oformat->init(s)) < 0) {
s->oformat->deinit(s);
if (s->oformat->deinit)
s->oformat->deinit(s);
goto fail;
}

@ -701,6 +701,7 @@ static int ogg_read_header(AVFormatContext *s)
if (ogg->streams[i].header < 0) {
av_log(s, AV_LOG_ERROR, "Header parsing failed for stream %d\n", i);
ogg->streams[i].codec = NULL;
av_freep(&ogg->streams[i].private);
} else if (os->codec && os->nb_header < os->codec->nb_header) {
av_log(s, AV_LOG_WARNING,
"Headers mismatch for stream %d: "

@ -117,6 +117,10 @@ static int opus_packet(AVFormatContext *avf, int idx)
if (!os->psize)
return AVERROR_INVALIDDATA;
if (os->granule > (1LL << 62)) {
av_log(avf, AV_LOG_ERROR, "Unsupported huge granule pos %"PRId64 "\n", os->granule);
return AVERROR_INVALIDDATA;
}
if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) {
int seg, d;

@ -82,7 +82,11 @@ static uint64_t vp8_gptopts(AVFormatContext *s, int idx,
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
uint64_t pts = (granule >> 32);
int invcnt = !((granule >> 30) & 3);
// If page granule is that of an invisible vp8 frame, its pts will be
// that of the end of the next visible frame. We substract 1 for those
// to prevent messing up pts calculations.
uint64_t pts = (granule >> 32) - invcnt;
uint32_t dist = (granule >> 3) & 0x07ffffff;
if (!dist)

@ -87,6 +87,7 @@ static const AVOption avformat_options[] = {
{"max_interleave_delta", "maximum buffering duration for interleaving", OFFSET(max_interleave_delta), AV_OPT_TYPE_INT64, { .i64 = 10000000 }, 0, INT64_MAX, E },
{"f_strict", "how strictly to follow the standards (deprecated; use strict, save via avconv)", OFFSET(strict_std_compliance), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, D|E, "strict"},
{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, D|E, "strict"},
{"very", "strictly conform to a older more strict version of the spec or reference software", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_VERY_STRICT }, INT_MIN, INT_MAX, D|E, "strict"},
{"strict", "strictly conform to all the things in the spec no matter what the consequences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, D|E, "strict"},
{"normal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_NORMAL }, INT_MIN, INT_MAX, D|E, "strict"},
{"unofficial", "allow unofficial extensions", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, D|E, "strict"},

@ -193,16 +193,17 @@ static void create_default_qtables(uint8_t *qtables, uint8_t q)
{
int factor = q;
int i;
uint16_t S;
factor = av_clip(q, 1, 99);
if (q < 50)
q = 5000 / factor;
S = 5000 / factor;
else
q = 200 - factor * 2;
S = 200 - factor * 2;
for (i = 0; i < 128; i++) {
int val = (default_quantizers[i] * q + 50) / 100;
int val = (default_quantizers[i] * S + 50) / 100;
/* Limit the quantizers to 1 <= q <= 255. */
val = av_clip(val, 1, 255);

@ -271,7 +271,8 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time, int bye)
avio_w8(s1->pb, RTCP_SR);
avio_wb16(s1->pb, 6); /* length in words - 1 */
avio_wb32(s1->pb, s->ssrc);
avio_wb64(s1->pb, NTP_TO_RTP_FORMAT(ntp_time));
avio_wb32(s1->pb, ntp_time / 1000000);
avio_wb32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
avio_wb32(s1->pb, rtp_ts);
avio_wb32(s1->pb, s->packet_count);
avio_wb32(s1->pb, s->octet_count);

@ -48,7 +48,7 @@ static int svag_read_header(AVFormatContext *s)
if (st->codec->sample_rate <= 0)
return AVERROR_INVALIDDATA;
st->codec->channels = avio_rl32(s->pb);
if (st->codec->channels <= 0)
if (st->codec->channels <= 0 || st->codec->channels > 8)
return AVERROR_INVALIDDATA;
st->duration = size / (16 * st->codec->channels) * 28;
align = avio_rl32(s->pb);

@ -1186,12 +1186,13 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
}
}
if (pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY && has_decode_delay_been_guessed(st)) {
if (pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
st->pts_buffer[0] = pkt->pts;
for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
pkt->dts = select_from_pts_buffer(st, st->pts_buffer, pkt->dts);
if(has_decode_delay_been_guessed(st))
pkt->dts = select_from_pts_buffer(st, st->pts_buffer, pkt->dts);
}
// We skipped it above so we try here.
if (!onein_oneout)
@ -2369,7 +2370,7 @@ static void update_stream_timings(AVFormatContext *ic)
end_time1 = av_rescale_q_rnd(st->duration, st->time_base,
AV_TIME_BASE_Q,
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
if (end_time1 != AV_NOPTS_VALUE) {
if (end_time1 != AV_NOPTS_VALUE && start_time1 <= INT64_MAX - end_time1) {
end_time1 += start_time1;
end_time = FFMAX(end_time, end_time1);
}
@ -2407,7 +2408,7 @@ static void update_stream_timings(AVFormatContext *ic)
if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) {
ic->duration = duration;
}
if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration != AV_NOPTS_VALUE) {
if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0) {
/* compute the bitrate */
double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
(double) ic->duration;
@ -2832,6 +2833,9 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
{
if (bps <= 0 || bps > 64)
return AV_CODEC_ID_NONE;
if (flt) {
switch (bps) {
case 32:
@ -2915,7 +2919,7 @@ static void compute_chapters_end(AVFormatContext *s)
unsigned int i, j;
int64_t max_time = 0;
if (s->duration > 0)
if (s->duration > 0 && s->start_time < INT64_MAX - s->duration)
max_time = s->duration +
((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time);

@ -94,7 +94,7 @@ static const struct {
{ "6.0(front)", 6, AV_CH_LAYOUT_6POINT0_FRONT },
{ "hexagonal", 6, AV_CH_LAYOUT_HEXAGONAL },
{ "6.1", 7, AV_CH_LAYOUT_6POINT1 },
{ "6.1", 7, AV_CH_LAYOUT_6POINT1_BACK },
{ "6.1(back)", 7, AV_CH_LAYOUT_6POINT1_BACK },
{ "6.1(front)", 7, AV_CH_LAYOUT_6POINT1_FRONT },
{ "7.0", 7, AV_CH_LAYOUT_7POINT0 },
{ "7.0(front)", 7, AV_CH_LAYOUT_7POINT0_FRONT },

@ -41,6 +41,16 @@
b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\
}
#define YUV_TO_RGB1_CCIR_BT709(cb1, cr1)\
{\
cb = (cb1) - 128;\
cr = (cr1) - 128;\
r_add = FIX(1.5747*255.0/224.0) * cr + ONE_HALF;\
g_add = - FIX(0.1873*255.0/224.0) * cb - FIX(0.4682*255.0/224.0) * cr + \
ONE_HALF;\
b_add = FIX(1.8556*255.0/224.0) * cb + ONE_HALF;\
}
#define YUV_TO_RGB2_CCIR(r, g, b, y1)\
{\
y = ((y1) - 16) * FIX(255.0/219.0);\

@ -24,13 +24,16 @@
#define CPUEXT_SUFFIX(flags, suffix, cpuext) \
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext))
#define CPUEXT_SUFFIX_FAST(flags, suffix, cpuext) \
#define CPUEXT_SUFFIX_FAST2(flags, suffix, cpuext, slow_cpuext) \
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext) && \
!((flags) & AV_CPU_FLAG_ ## cpuext ## SLOW))
!((flags) & AV_CPU_FLAG_ ## slow_cpuext ## SLOW))
#define CPUEXT_SUFFIX_SLOW(flags, suffix, cpuext) \
#define CPUEXT_SUFFIX_SLOW2(flags, suffix, cpuext, slow_cpuext) \
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext) && \
((flags) & AV_CPU_FLAG_ ## cpuext ## SLOW))
((flags) & AV_CPU_FLAG_ ## slow_cpuext ## SLOW))
#define CPUEXT_SUFFIX_FAST(flags, suffix, cpuext) CPUEXT_SUFFIX_FAST2(flags, suffix, cpuext, cpuext)
#define CPUEXT_SUFFIX_SLOW(flags, suffix, cpuext) CPUEXT_SUFFIX_SLOW2(flags, suffix, cpuext, cpuext)
#define CPUEXT(flags, cpuext) CPUEXT_SUFFIX(flags, , cpuext)
#define CPUEXT_FAST(flags, cpuext) CPUEXT_SUFFIX_FAST(flags, , cpuext)

@ -313,6 +313,22 @@ static av_always_inline float ff_exp10f(float x)
return exp2f(M_LOG2_10 * x);
}
/**
* Compute x^y for floating point x, y. Note: this function is faster than the
* libm variant due to mainly 2 reasons:
* 1. It does not handle any edge cases. In particular, this is only guaranteed
* to work correctly for x > 0.
* 2. It is not as accurate as a standard nearly "correctly rounded" libm variant.
* @param x base
* @param y exponent
* @return x^y
*/
static av_always_inline float ff_fast_powf(float x, float y)
{
return expf(logf(x) * y);
}
/**
* A wrapper for open() setting O_CLOEXEC.
*/

Some files were not shown because too many files have changed in this diff Show More