Compare commits

...

137 Commits

Author SHA1 Message Date
Clément Bœsch
3429714f3d avfilter/dctdnoiz: fix slice_h computation
ceilf() can only work if the reminder of the division is not 0.

This fixes memory errors with for instance:
  ffmpeg -f lavfi -i testsrc=s=800x500 -threads 3 -vf dctdnoiz -frames:v 1 -f null -

(cherry picked from commit eb7efaa9244720c5f2051d76d76faeec864eca7a)
2015-02-12 20:21:56 +01:00
James Almer
ee902d3d2d x86/lossless_audiodsp: fix compilation with --disable-yasm
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 383fddeec65f4cebcb197eae702dfefdc6192eb0)

Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 20:04:09 +01:00
James Almer
9bc62da980 avutil/opencl: don't include config.h
It's not an installed header.

Tested-by: Thilo Borgmann <thilo.borgmann@mail.de>
Tested-by: Wei Gao <highgod0401@gmail.com>
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 3aaff803489af21011b8cf03847e17b29643c922)
2015-02-12 15:43:47 -03:00
James Almer
2a6d16ba5f x86/swr: add missing alignment check to pack_6ch functions
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 5f14f9e9849579b3418aebfde8a162d9c172d0ea)
2015-02-12 15:43:43 -03:00
Michael Niedermayer
c7e967a7cb Update for 2.5.4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:44:24 +01:00
Michael Niedermayer
5262c88bb0 avformat/rtmpproto: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:11:55 +01:00
Michael Niedermayer
bd78b9416d avformat/riffdec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:11:54 +01:00
Michael Niedermayer
48ae72e501 avformat/os_support: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:11:54 +01:00
Michael Niedermayer
0f671dfeac avcodec/arm/videodsp_armv5te: Fix linking failure with "g++ -shared -D__STDC_CONSTANT_MACROS -o test.so ... libavcodec.a"
Tested-by: Andreas Haupt
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cab6302534962331753fb69c674df86a458b098d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
345962121d avcodec/mjpegdec: Skip blocks which are outside the visible area
Fixes out of array accesses
Fixes: ffmpeg_mjpeg_crash.avi

Found-by: Thomas Lindroth <thomas.lindroth@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 08509c8f86626815a3e9e68d600d1aacbb8df4bf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
0cbf53bdf5 avcodec/h264_slice: assert that reinit does not occur after the first slice
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2fd9ce92af43e6dcbc8ed7c26c00b052de48ccad)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
b20409c690 avcodec/h264_slice: ignore SAR changes in slices after the first
Fixes race condition and null pointer dereference
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 38d5241b7f36c1571a88517a0650caade16dd5f4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
7997ec54c9 avcodec/h264_slice: Check picture structure before setting the related fields
This might fix a hypothetical race condition

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f111831ed61103f9fa8fdda41473a23da016bdaa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
e805826903 avcodec/h264_slice: Do not change frame_num after the first slice
Fixes potential race condition
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f906982c9411f3062e3ce68013309b37c213c4dd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
137a000377 avutil/opt: Fix type used to access AV_OPT_TYPE_SAMPLE_FMT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1750b45cdf7498d0a05bea29cafcb26aa576d595)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
78c314e39e avutil/opt: Fix types used to access AV_OPT_TYPE_PIXEL_FMT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a0640e63463e6428b80422c89e1bfc96147ecfc6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
756d85dc14 avcodec/h264: Be more strict on rejecting pps/sps changes
Fixes race condition
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6fafc62b0bd0e206deb77a7aabbf3a370ad80789)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
eeab3e1b20 avcodec/h264: Be more strict on rejecting pps_id changes
Fixes race condition
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 31cc9c04ca386dce289864021982da62190982ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
a75787a71a avcodec/h264_ps: More completely check the bit depths
Fixes out of array read
Fixes: asan_static-oob_30328b6_719_cov_3325483287_H264_artifacts_motion.h264

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 69aa79365c1e8e1cb597d33e77bf1062c2ef47d4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
09425294c9 Revert "avcodec/x86/lossless_audiodsp: Make scalarproduct_and_madd_int16 prototypes more similar"
This reverts commit 3b4ffba3af968ae702e3a44f6b5f53445efc7363.

Unbreaks the SSSE3 code on mingw32

Conflicts:

	libavcodec/x86/lossless_audiodsp.asm

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a6c2c8fe3f076d14c0170b4d1965a0dea0393b8d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
3572eaaf02 avcodec/x86/lossless_audiodsp: Move order&8 fallback into C code
This is simpler and more robust, and fixes mismatching XMM save restore
mismatches

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f1214763af1abf5d7f49b98f88c06e13b98932a6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
25da8d84a4 avcodec/x86/lossless_audiodsp: Make scalarproduct_and_madd_int16 prototypes more similar
This is needed as the mmx code is used as fallback from the ssse3 code

Suggested-by: jamrial
Tested-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3b4ffba3af968ae702e3a44f6b5f53445efc7363)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
0f642909d8 avformat/thp: Check av_get_packet() for failure not only for partial output
Fixes null pointer dereference
Fixes: signal_sigsegv_db2c1f_3108_cov_163322880_pikmin2_opening1_partial.thp

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f2579dbb4b31e6ae731e7f5555680528ef3020ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
6252e9141b swscale/utils: Limit filter shifting so as not to read from prior the array
Fixes out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 692b22626ec9a9585f667c124a186b1a9796e432)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
c65a731b6f avcodec/mpegvideo_motion: Fix gmc chroma dimensions
Fixes integer overflow and out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fd52d2d3d1ee41822a9801dffd41c0e1a2db32a8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
58096b70fa avcodec/mjpegdec: Check number of components for JPEG-LS
Fixes out of array accesses
Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fabbfaa095660982cc0bc63242c459561fa37037)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
0ae93844d0 avcodec/mjpegdec: Check escape sequence validity
Fixes assertion failure
Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit afa92907f3c6a0c3bdad766ec8d938ee17ee1c9e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
657dc91b44 avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 05e161952954acf247e0fd1fdef00559675c4d4d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
wm4
352d17086f avformat/mpc8: fix broken pointer math
This could overflow and crash at least on 32 bit systems.

Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b737a2c52857b214be246ff615c6293730033cfa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
wm4
193440f566 avformat/mpc8: fix hang with fuzzed file
This can lead to an endless loop by seeking back a few bytes after each
attempted chunk read. Assuming negative sizes are always invalid, this
is easy to fix. Other code in this demuxer treats negative sizes as
invalid as well.

Fixes ticket #4262.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 56cc024220886927350cfc26ee695062ca7ecaf4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
wm4
563e542b31 avformat/tta: fix crash with corrupted files
av_add_index_entry() can fail, for example because the parameters are
invalid, or because memory allocation fails. Check this; it can actually
happen with corrupted files.

The second hunk is just for robustness. Just in case functions like
ff_reduce_index() remove entries. (Not sure if this can actually
happen.)

Fixes ticket #4294.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6a0cd529a35190d9374b0b26504e71857cd67b83)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Rong Yan
b0b6d8de7e avcodec/ppc/idctdsp.c: POWER LE support in idct_add_altivec()
also add GET_TMP2() macro

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fc35df893175cedd65c14a4f7ebab6f33aeae4a6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
2f5c5767d1 avcodec/mpegvideo_enc: Fix number suffixes in rc_buffer_size calculation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4531e2c489d279bfc90d54ca26ed898c5b265a7f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
979a54ed18 avcodec/h264_cabac: use int instead of long for mbb_xy
The mb address fits in int

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 592ba6ec106206f97133c9345313010c76361e12)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
d11bca8043 avformat/omadec: fix number suffix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f1f7f5903ab49b84789af5341492afbaba808a70)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
a3ef410b9c avformat/smacker: Fix number suffix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 465f3705b1ef832fd6904750d018f81f9044f3ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
260e5c6dbe avformat/matroskadec: Fix number suffixes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fc3cdb00d084222a107e61e7168903bf3d3d0b47)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
bac6554c74 avcodec/dxtory: Use LL instead of L number suffix
This is probably unneeded and normal int would be fine, but its
safer to use LL and this isnt speed relevant

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b4ad2853c50d055e9ba8c29f2e1c83b292f29d7a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
1e366c15ed swresample/dither: Cleanup number suffixes
The <<31 case needs LL

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c77cc2c1766666cdb5f14daee0f75e397bf7a194)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
675fb3a8af avformat/utils: Fix number suffixes in tb_unreliable()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4b15bba2aec93776bfdc69a1bca42a4795a7d191)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
25fc0faccb doc/APIchanges: fill in more missing hash values and dates
all values before 2.5 seem to be filled in now

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8c8ee17e8d2800144116ec52f26a435a06b49420)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
164083434e doc/APIchanges: fill in and correct some values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0d64982828aee5f3495a71050e4930fa2898ca15)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
8026606497 doc/APIchanges: Add av_find_best_pix_fmt_of_2() and av_get_pix_fmt_loss()
also add deprecation note for avcodec_get_pix_fmt_loss(), avcodec_find_best_pix_fmt_of_2()

Found-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f7a1c5e4d2294a8970ede7f6deb2fe0a64e202a5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
6ac8ac0109 doc/APIchanges: Fill in some more missing hash values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bbdd940f36662d4b6156464b1bda5131fc382465)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
f07e2ff697 swscale/input: fix rgba64 alpha non native
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f30798584fd9709e83644f831107fdc9e26b1311)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
b62b3e1a25 swscale/input: Fix alpha of YA16 input
Fixes Ticket4278

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 95d04690aa4f43f6b61640713a11a9649cbf85e9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Andreas Cadhalpun
a45b8af839 libavcodec/ppc/mpegvideoencdsp.c: fix stack smashing in pix_norm1_altivec() and pix_sum_altivec()
The vec_ste calls were mistakenly changed to vec_vsx_st in c5ca76a, which
caused stack smashing.

Changing them back fixes crashes on ppc64el, when configured with
--toolchain=hardened.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 840c3c05316a59c70a7470ed27aaa9c2f3ba410a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
a443b48ccf avformat/rmdec: Check for overflow in ff_rm_read_mdpr_codecdata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03abf55f252945c70f4a79eaf4d609cee4d98710)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
a45402d4c0 avformat/mpeg: do not count PES packets inside PES packets during probing
Fixes: misdetection of test2.mp3

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e15b29bb18bee8b65fab5a3c873540e01fd20afe)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
0bdc64e8b9 hevc: always clip luma_log2_weight_denom
Its value shall be between 0 and 7 according to the specifications.

Bug-Id: CID 1257502
2015-02-12 17:10:35 +01:00
Martin Storsjö
5fbf63ea39 rtpdec_h263_rfc2190: Clear the stored bits if discarding buffered data
If we throw away the buffered incomplete frame, make sure to also
throw away the buffered bits of an incomplete byte at the same
time.

(cherry picked from commit df07c07b3de0a5e8890078944de1eb5cb8372ef8)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
4d74bb24e3 aacenc: correctly check returned value
(cherry picked from commit 971099ff5a85377579eb5b8d3620e283957f097e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
7f8d0cf93a swscale: check memory allocations
Bug-Id: CID 1257779
(cherry picked from commit 1dd797e3c9f179f957316a0becbec048b42df8aa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
28fba55306 opt: check memory allocation
Bug-Id: CID 1257771
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
wm4
7caee17204 avformat/utils: check for malloc failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a66893ac949864352b36b39e48c4cd72bbd81e54)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
edec2a4da3 avcodec/flac_parser: fix handling EOF if no headers are found
Fixes assertion failure
Fixes Ticket4269

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c4d85fc23c100f7a27d9bad710eb153214868e27)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
65074a5dae avfilter/vf_framepack: Check and update frame_rate
The frame_rate update was missing leaving the output frame rate
wrong.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a46a23d30fea9c8a5570e07ec4d9c9b4eaa6eb4f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
e3b6144e0c avdevice: Use av_format_get_control_message_cb()
This is required as the location of this field could change and is
specified in libavformat not avdevice

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba97cf2c4562b60fbef89103b61516891e31845e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
8acbba0ec3 vp8: improve memory allocation checks
Check memory earlier, check one more allocation and clean up on error.

CC: libav-stable@libav.org
Bug-Id: CID 1257773
(cherry picked from commit 014b6b416fec89777cb9cff61bcf7896eaf7cf39)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Andreas Cadhalpun
9e9cde6afa configure: enable vsx together with altivec for ppc64el
The altivec optimizations on little endian ppc64 don't work without vsx.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6108485cf70f04dbf4708bd84ce749da871fa3f1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
4f8814964c avcodec/hevc: Fix handling of skipped_bytes() reallocation failures
Fixes CID1260704

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e172f5e53ae4dbbcdcf81c9a3b962dc9f5a8a98d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
wm4
8a6770a214 qpeg: avoid pointless invalid memcpy()
If refdata was NULL, the memcpy() ended up copying the same memory
block onto itself, which is not only pointless, but also undefined
behavior.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 921706691a87c3ea5f5b92afd9b423e5f8c6e9d9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Carl Eugen Hoyos
763e6ecf83 lavc/aarch64: Do not use the neon horizontal chroma loop filter for H.264 4:2:2.
(cherry picked from commit 4faea46bd906b3897018736208123aa36c3f45d5)
2015-02-03 23:08:15 +01:00
Andreas Cadhalpun
07d508e4f5 doc/examples: fix lib math dep for decoding_encoding
It uses at least sin().

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f97f2a3527eac2cf60ba86206d1bae9a970a7e71)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 05:03:04 +01:00
Michael Niedermayer
b089b58250 avformat/movenc: workaround bug in "PathScale EKOPath(tm) Compiler Suite Version 4.0.12.1"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7824dc5150c0ea44ffa7cd4d57803f9a9697e7d7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 05:01:20 +01:00
Michael Niedermayer
a7dd37169c Update for 2.5.3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:37:34 +01:00
wm4
3032291b3a vp9: fix parser return values in error case
The parser must always set the out_size and out_data pointers. The API
seems to require it, and the common code in parser.c also relies on it.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b88e80589bd11ef935a5e9dab53d4edb00de16e4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
f9bbc26e69 ffmpeg: Clear error message array at init.
This avoids printing uninitialized bytes if no error message is set

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6d1a2efb8ac399a003ea7d3b6f8c641d192567ee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
wm4
b895e29941 avcodec/dvdsubdec: fix accessing dangling pointers
dvdsub_decode() can call append_to_cached_buf() 2 times, the second time
with ctx->buf as argument. If the second append_to_cached_buf() reallocs
ctx->buf, the argument will be a pointer to the previous, freed block.
This can cause invalid reads at least with some fuzzed files - and
possibly with valid files.

Since packets can apparently not be larger than 64K (even if packets are
combined), just use a fixed size buffer. It will be allocated as part of
the DVDSubContext, and although some memory is "wasted", it's relatively
minimal by modern standards and should be acceptable.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 816577716bc6170bccfea3b9e865618b69a4b426)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
wm4
3d71024f8a avcodec/dvdsubdec: error on bitmaps with size 0
Attemtping to decode them could lead to invalid writes with some fuzzed
samples.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bcaa9099b3648b47060e1724a97dc98b63c83702)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
James Almer
b834dc14da configure: bump year
Happy new year!
(cherry picked from commit b8db25a3338b67186837c49580fe538d63dd73c7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
d0041dc8c4 avformat/mov: Fix mixed declaration and statement warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit db27f50e0658e91758e8a17fdcf390e6bc93c1d2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
b3c082412c cmdutils: Use 64bit for file size/offset related variable in cmdutils_read_file()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 369b4cd4120bf67aa5187b6bc72574970a24ca22)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
918ed73b70 avformat/utils: Clear pointer in ff_alloc_extradata() to avoid leaving a stale pointer in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bbfca8e84b0e69abba523d665536c0135fc1c00e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
2791eba1d7 avformat/matroskadec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e70e4aca50696040cc9256ec96e5c31d9641432)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
0d3a07852c avformat/mov: use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 383c6a3a07b71981bd32d083496f5a4935f620f9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Paul B Mahol
c7a2ac6b6b lavfi: check av_strdup() return value
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 145a84717b62e086cdb5f26649ad9f1b51ef38d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Dale Curtis
0ce35b8ce8 mov: Fix negative size calculation in mov_read_default().
The previous code assumed if an atom was marked with a 64-bit
size extension, it actually had that data available. The new
code verfies there's enough data in the atom for this to be
done.

Failure to verify causes total_size > atom.size which will
result in negative size calculations later on.

Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3ebd76a9c57558e284e94da367dd23b435e6a6d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
25312a427b avformat/mov: fix integer overflow in mov_read_udta_string()
Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3859868c75313e318ebc5d0d33baada62d45dd75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Dale Curtis
9143ab0e5a mov: Fix overflow and error handling in read_tfra().
Under abnormal conditions the item_count may exceed the max
allocation size on 32-bit systems, this causes the allocated
size to overflow and become too small for the given count.

Additionally, if av_reallocp() fails its allocation, the
fragment_index_count is not correctly decremented.

Ensuring further havoc may be wrought, the error code for
read_tfra() is not checked upon return.

Found-by: Paul Mehta <paul@paulmehta.com>

positive return code and use of _array functions by commiter

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit db42d93a61be26873be6115c57f5921b4dfdec14)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Dale Curtis
022bfd3dd4 mov: Avoid overflow with mov_metadata_raw()
The code previously added 1 to len without checking its size,
resulting in an overflow which can corrupt value[-1] -- which
may be used to store unaligned ptr information for certain
allocators.

Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
2015-01-09 17:19:10 +01:00
wm4
e0a12b3dc3 avcodec/dvdsubdec: fix out of bounds accesses
The code blindly trusted buffer offsets read from the file in the RLE
decoder. Explicitly check the offset. Also error out on other RLE
decoding errors.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c9151de7c42553bb145be608df8513c1287f1f24)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
252ba4a925 avfilter/vf_sab: fix filtering tiny images
Fixes out of array reads

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9bff052b51f27f6cce04e8d7d8b405c710d7ad67)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
5bb31e856d avformat/flvdec: Increase string array size
Fixes parsing httphostheader of Scarlatti\,\ Pieter-Jan\ Belder\ -\ Sonata\ K113\ in\ A\ major\ -\ Alle.flv

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit eb767a276bfdb9a0493bdb0b38203638230b7ccb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
eac0451e47 avformat/flvdec: do not inject dts=0 metadata packets which failed to be parsed into a new data stream
Such data streams (which then contain no other packets except the faulty one)
confuse some user applications, like VLC
Works around vlcticket 12389

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 322f0f5960a743cac47252d90a0f1ea7a025feff)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
68c6347089 avformat/cdxl: Fix integer overflow of image_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3eb5cbe0c50d0a0bbe10bcabbd6b16d73d93c128)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:09 +01:00
Michael Niedermayer
bcd7f35717 avformat/segment: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 68fa549230af35179df2a2af2bdb84ee6c825bed)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:09 +01:00
Martin Storsjö
93cbdcd4d3 libavformat: Build hevc.o when building the RTP muxer
The RTP muxer enables the actual codepaths within sdp.c,
which depend on hevc.o since e5cfc8fd.

This fixes builds with --disable-everything --enable-muxer=rtp.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit fccfc22d1f304aef42a0b960e4c1d55ce67107f5)
2015-01-09 00:50:31 -03:00
Michael Niedermayer
959ab06c68 Changelog: update for 2.5.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-23 04:28:09 +01:00
Michael Niedermayer
46db3121c6 update for 2.5.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:41:27 +01:00
Michael Niedermayer
c96c755320 Makefile: add dependencies which require ffversion.h
Without this ffversion.h could sometimes be built too late

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4ae87554f3c8bc54db572873f5049427a7e6cb31)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:56 +01:00
Michael Niedermayer
9f8cdd520b Add FFMPEG_VERSION into the binary libs
This simplifies identifying from which revision a binary of a lib came from

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 649c158e8c94ac0cff7f03e97d6ea8bbf71b7f02)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:56 +01:00
Anton Khirnov
f5631d23e0 mmvideo: check frame dimensions
The frame size must be set by the caller and each dimension must be a
multiple of 2.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
See: 8b0e96e1f21b761ca15dbb470cd619a1ebf86c3e
These should be redundant, but are backported for saftey anyway
2014-12-22 03:17:56 +01:00
Anton Khirnov
50f4543c6b jvdec: check frame dimensions
The frame size must be set by the caller and each dimension must be a
multiple of 8.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
See: 105654e376a736d243aef4a1d121abebce912e6b
These should be redundant, but are backported for saftey anyway
2014-12-22 03:17:56 +01:00
Michael Niedermayer
1344e91f33 avcodec/indeo3: ensure offsets are non negative
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 368642361f3a589d7b0c23ea327d988edb434e3f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
f13e6ec7a6 avcodec/h264: Check *log2_weight_denom
Fixes undefined behavior
Fixes: signal_sigsegv_14768d2_2248_cov_3629497219_h264_h264___pi_20070614T182942.h264
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 61296d41e2de3b41304339e4631dd44c2e15f805)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
bf2c9e1ad4 avcodec/hevc_ps: Check diff_cu_qp_delta_depth
Fixes undefined behavior
Fixes: asan_static-oob_17aa046_582_cov_1577759978_DBLK_G_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3281fa892599d71b4dc298a426af8296419cd90e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
0663aab1d9 avcodec/h264: Clear delayed_pic on deallocation
Fixes use of freed memory

Fixes: case5_av_frame_copy_props.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e8714f6f93d1a32f4e4655209960afcf4c185214)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
e911f125fc avcodec/hevc: clear filter_slice_edges() on allocation
This avoids use of uninitialized memory
Fixes: asan_static-oob_17aa046_582_cov_212287884_DBLK_G_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8aa8d12554868c32436750f881954193087219c8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
5aead5ee05 avcodec/dcadec: Check that the added xch channel isnt already there
Fixes null pointer dereference
Fixes: signal_sigsegv_369609d_623_cov_2008234281_ES_6.1_16bit.dts
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7d593495e42e92693cc8f3ce9b42cf3edcea377a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
3a5b749d7c avcodec/indeo3: use signed variables to avoid underflow
Fixes out of array read
Fixes: signal_sigsegv_1b0a4da_1865_cov_2167818389_computer_anger.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3305acdc92fa37869f160a11a87741c8a0de0454)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
4b4d0b0290 avcodec/h264: make the first field of H264Context an AVClass
Fixes use of freed memory
Fixes: asan_heap-uaf_3660f67_757_cov_1257014655_Hi422FR1_SONY_A.jsv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f3b5b139ad853b6f69c6a0b036815a60e7b3f261)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
c9b25252cb swscale: increase yuv2rgb table headroom
Fixes out of array access
Fixes: case2_bad_read_yuv2rgbx32.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2a983ff7fe076ae93926eb33cfb44ca49183dacc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
4400385d5f avformat/mov: fix integer overflow of size
Fixes: case1_call_stack_overflow.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit be9ce6e10a8d53b8bc346c9337d75a5a30631a2a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
d85e25fe0b avformat/mov: check atom nesting depth
Fixes call stack overflow
Fixes: case1_call_stack_overflow.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit caa7a3914f499f74b3ee346f26d598ebdc0ec210)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
3d1972d182 avcodec/utvideodec: Fix handling of slice_height=0
Fixes out of array accesses
Fixes: asan_heap-oob_25bcd7e_3783_cov_3553517262_utvideo_rgba_median.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3881606240953b9275a247a1c98a567f3c44890f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
71b1abe638 avcodec/xface: Add asserts to limit nb_words from becoming too large
Approved-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 211200e0c0efa48b2815ce93fda10dab43526d1b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
991ef3a67e avcodec/xface: correct the XFACE_MAX_* values
Fixes out of array access

Fixes: asan_stack-oob_32c12e5_2536_cov_2442316831_lena.xface
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 93a5a16f136d095d23610f57bdad10ba88120fba)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
b850b01533 avcodec/vmdvideo: Check len before using it in method 3
Fixes out of array access
Fixes: asan_heap-oob_4d23ba_91_cov_3853393937_128.vmd

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3030fb7e0d41836f8add6399e9a7c7b740b48bfd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
23a17b4a3d avformat/flvdec: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 91ea466551c148bd897706a1b6a168e783761a06)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
3a8ad4b878 avformat/hdsenc: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 16d763fa45b95783c6770edc559769d9a83d6a10)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
b85a939633 configure: create the tests directory like the doc directory
This fixes an issue where the tests directory is not created for out of tree
builds before its needed

Tested-by: Dave Yeo <daveryeo@telus.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e631872f13b6be0583603d45a11e53319754bc8d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Clément Bœsch
7e130ca5b4 avformat/rsd: make tag_buf string larger
av_get_codec_tag_string() uses more that 1 char for unprintable characters.

(cherry picked from commit edbbb11488e1fce9b9703535936d2e1731e2e318)
2014-12-19 18:01:31 -03:00
Clément Bœsch
f295f9488a avformat/apngdec: make tag_buf string larger
av_get_codec_tag_string() uses more that 1 char for unprintable characters.

(cherry picked from commit d60fb4f7946272d2ef39703762b54c5f3a1b5789)
2014-12-19 18:00:40 -03:00
Michael Niedermayer
2c01dd2ea5 Update Changelog for 2.5.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 23:52:03 +01:00
Michael Niedermayer
5e26152ee4 Update for FFmpeg 2.5.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 15:30:31 +01:00
wm4
135c733125 lavu/frame: fix malloc error path in av_frame_copy_props()
The error path frees all side data, but forgets to reset the side data
count. This can blow up later in av_frame_unref() and free_side_data().

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a400edbb6d00c0211de38e4f1b4f593681db91d8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 05:32:36 +01:00
Michael Niedermayer
3b3a3c3d44 avformat/utils: Do not update programs streams from program-less streams in update_wrap_reference()
Fixes Ticket3686

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a29524bf2e197dd8d582445de0fe17f03b79f79d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-14 20:58:33 +01:00
Michael Niedermayer
13244abcd3 avformat/aviobuf: Check that avio_seek() target is non negative
Fixes out of array access

Suggested-by: Andrew Scherkus <scherkus@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ed86dbd05d61363dc1c0d33f3267e2177c985fdd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-14 17:42:16 +01:00
Rob Sykes
9783d5bfda swresample/soxr_resample: fix error handling
Fixes CID1257659

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4b6f2253741f3023928e61ae5105ccd4b1c515fb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-13 22:20:16 +01:00
Michael Niedermayer
0e4efad93c avformat/flvdec: fix potential use of uninitialized variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0fadbd3623cf9132832f48810c0edb93aa63f51b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-10 13:42:29 +01:00
Michael Niedermayer
0103bc67fd avformat/crypto: fix key vs iv typo
Fixes Ticket 4167

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2d0117f816b92510546caf26414961ee6088f961)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-09 20:08:03 +01:00
Moritz Barsnick
d5af3fb1c5 configure: use use_pkg_config() instead of check_pkg_config() for libsmbclient
This ensures that the CFLAGS and LDFLAGS are actually applied.
Fixes an incorrect change introduced with the clean-up in commit
cfcaf6b38e39ed6e788abb1a5a44f23660dce2f6.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 754f4957d7a7e5be0df0e9de1d31aebeecdc4476)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-09 01:04:32 +01:00
Rong Yan
6ec5a199ea avcodec/ppc/vp3dsp_altivec: POWER LE support to vp3_idct_add_altivec()
add GET_VDST16() macro

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9bd8f2cc32c2616c2bc010dd50f542ce6a85162b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 15:30:03 +01:00
wm4
f7b5366657 avformat/matroskadec: fix handling of recursive SeekHead elements
When matroska_execute_seekhead() is called, it goes through the list of
seekhead entries and attempts to read elements not read yet. When doing
this, the parser can find further SeekHead elements, and will extend the
matroska->seekhead list. This can lead to a (practically) infinite loop
with certain broken files. (Maybe it can happen even with valid files.
The demuxer doesn't seem to check correctly whether an element has
already been read.)

Fix this by ignoring elements that were added to the seekhead field
during executing seekhead entries.

This does not fix the possible situation when multiple SeekHead elements
after the file header (i.e. occur after the "before_pos" file position)
point to the same elements. These elements will probably be parsed
multiple times, likely leading to bugs.

Fixes ticket #4162.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6551acab6877addae815decd02aeca33ba4990c8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-07 23:04:23 +01:00
Piotr Fusik
542332e523 doc/examples/filtering_video: fix frame rate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c99e5191ab846d4897dfc565ba446ec960e04aa9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-05 17:36:19 +01:00
Michael Niedermayer
aa24dd487f avcodec/mpegaudiodec_template: only allocate fdsp when its used
Fixes memleak

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a7ebd0b011f9576c843a86bd6a1828ecaa6faf3a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-05 05:16:14 +01:00
Michael Niedermayer
3bcd1daad7 doc/examples/transcoding: check encoder before using it
Fixes null pointer exception

Found-by: stoupeace
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bde27e1e617dfeb3c026f530f48a77f5ed8aa2ea)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 19:08:32 +01:00
Michael Niedermayer
91f88eab32 MAINTAINERS: add 2.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a4f21a8dd9d8b327334d706a96c0cb5c41bd82b6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 14:48:20 +01:00
Rong Yan
aac467ae17 avcodec/ppc/vp8dsp_altivec.c: POWER LE support put_vp8_epel_h_altivec_core() put_vp8_epel_v_altivec_core() put_vp8_pixels16_altivec() add marcos GET_PIXHL() GET_OUTER() LOAD_HL()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d23e8832486f0a37c7ad708b504b723bcfa2f71d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 14:48:19 +01:00
Rong Yan
968e733b2e avcodec/ppc/vc1dsp_altivec: add POWER LE support to vc1_inv_trans_8x4_altivec()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 36cd2bcbc343c299241dc7275cb85cbc3fc6b8ad)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 12:09:38 +01:00
Timothy Gu
192d46e6d1 Update RELEASE_NOTES
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 06:06:18 +01:00
Timothy Gu
bb8614cb7b Changelog/RELEASE_NOTES: Add APNG decoder
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2014-12-04 06:06:07 +01:00
Michael Niedermayer
d9bdf7d9ae Changelog: release is 2.5 not "next"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 02:16:55 +01:00
Michael Niedermayer
a588e1e560 avcodec/aacdec: reduce noisiness of missing channel elements
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5fe026f2bda68a129d70b9609c4902917db9ca2e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 01:58:32 +01:00
Carl Eugen Hoyos
36e7385d0e Fix standalone compilation of the iec61883 input device.
(cherry picked from commit 963aa1daf88066d43c7495803b870800c5faaa4d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 01:58:28 +01:00
Michael Niedermayer
5108323aa9 Update for 2.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 00:47:17 +01:00
99 changed files with 737 additions and 312 deletions

View File

@ -1,7 +1,98 @@
Entries are sorted chronologically from oldest to youngest within each release, Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest. releases are sorted from youngest to oldest.
version <next>: version 2.5.4:
- avcodec/arm/videodsp_armv5te: Fix linking failure with shared libs
- avcodec/mjpegdec: Skip blocks which are outside the visible area
- avcodec/h264_slice: ignore SAR changes in slices after the first
- avcodec/h264_slice: Check picture structure before setting the related fields
- avcodec/h264_slice: Do not change frame_num after the first slice
- avutil/opt: Fix type used to access AV_OPT_TYPE_SAMPLE_FMT
- avutil/opt: Fix types used to access AV_OPT_TYPE_PIXEL_FMT
- avcodec/h264: Be more strict on rejecting pps/sps changes
- avcodec/h264: Be more strict on rejecting pps_id changes
- avcodec/h264_ps: More completely check the bit depths
- avformat/thp: Check av_get_packet() for failure not only for partial output
- swscale/utils: Limit filter shifting so as not to read from prior the array
- avcodec/mpegvideo_motion: Fix gmc chroma dimensions
- avcodec/mjpegdec: Check number of components for JPEG-LS
- avcodec/mjpegdec: Check escape sequence validity
- avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
- avformat/mpc8: fix broken pointer math
- avformat/mpc8: fix hang with fuzzed file
- avformat/tta: fix crash with corrupted files
- avcodec/ppc/idctdsp.c: POWER LE support in idct_add_altivec()
- swscale/input: fix rgba64 alpha non native
- swscale/input: Fix alpha of YA16 input
- libavcodec/ppc/mpegvideoencdsp.c: fix stack smashing in pix_norm1_altivec() and pix_sum_altivec()
- avformat/rmdec: Check for overflow in ff_rm_read_mdpr_codecdata()
- avformat/mpeg: do not count PES packets inside PES packets during probing
- hevc: always clip luma_log2_weight_denom
- rtpdec_h263_rfc2190: Clear the stored bits if discarding buffered data
- aacenc: correctly check returned value
- swscale: check memory allocations
- opt: check memory allocation
- avformat/utils: check for malloc failure
- avcodec/flac_parser: fix handling EOF if no headers are found
- avfilter/vf_framepack: Check and update frame_rate
- vp8: improve memory allocation checks
- configure: enable vsx together with altivec for ppc64el
- avcodec/hevc: Fix handling of skipped_bytes() reallocation failures
- qpeg: avoid pointless invalid memcpy()
version 2.5.3:
- vp9: fix parser return values in error case
- ffmpeg: Clear error message array at init.
- avcodec/dvdsubdec: fix accessing dangling pointers
- avcodec/dvdsubdec: error on bitmaps with size 0
- cmdutils: Use 64bit for file size/offset related variable in cmdutils_read_file()
- mov: Fix negative size calculation in mov_read_default().
- avformat/mov: fix integer overflow in mov_read_udta_string()
- mov: Fix overflow and error handling in read_tfra().
- mov: Avoid overflow with mov_metadata_raw()
- avcodec/dvdsubdec: fix out of bounds accesses
- avfilter/vf_sab: fix filtering tiny images
- avformat/flvdec: Increase string array size
- avformat/flvdec: do not inject dts=0 metadata packets which failed to be parsed into a new data stream
- avformat/cdxl: Fix integer overflow of image_size
- libavformat: Build hevc.o when building the RTP muxer
version 2.5.2:
- avcodec/indeo3: ensure offsets are non negative
- avcodec/h264: Check *log2_weight_denom
- avcodec/hevc_ps: Check diff_cu_qp_delta_depth
- avcodec/h264: Clear delayed_pic on deallocation
- avcodec/hevc: clear filter_slice_edges() on allocation
- avcodec/dcadec: Check that the added xch channel isnt already there
- avcodec/indeo3: use signed variables to avoid underflow
- swscale: increase yuv2rgb table headroom
- avformat/mov: fix integer overflow of size
- avformat/mov: check atom nesting depth
- avcodec/utvideodec: Fix handling of slice_height=0
- avcodec/xface: correct the XFACE_MAX_* values
- avcodec/vmdvideo: Check len before using it in method 3
- configure: create the tests directory like the doc directory
- mmvideo: check frame dimensions
- jvdec: check frame dimensions
version 2.5.1:
- lavu/frame: fix malloc error path in av_frame_copy_props()
- avformat/aviobuf: Check that avio_seek() target is non negative
- swresample/soxr_resample: fix error handling
- avformat/flvdec: fix potential use of uninitialized variables
- avformat/crypto: fix key vs iv typo
- configure: use use_pkg_config() instead of check_pkg_config() for libsmbclient
- avcodec/ppc/vp3dsp_altivec: POWER LE support to vp3_idct_add_altivec()
- avformat/matroskadec: fix handling of recursive SeekHead elements
- doc/examples/filtering_video: fix frame rate
- avcodec/mpegaudiodec_template: only allocate fdsp when its used
- doc/examples/transcoding: check encoder before using it
- update MAINTAINERS file
- POWER LE support in put_vp8_epel_h_altivec_core() put_vp8_epel_v_altivec_core() put_vp8_pixels16_altivec()
- POWER LE support in vc1_inv_trans_8x4_altivec()
version 2.5:
- HEVC/H.265 RTP payload format (draft v6) packetizer - HEVC/H.265 RTP payload format (draft v6) packetizer
- SUP/PGS subtitle demuxer - SUP/PGS subtitle demuxer
- ffprobe -show_pixel_formats option - ffprobe -show_pixel_formats option
@ -16,7 +107,7 @@ version <next>:
- creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer - creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer
- WebP muxer with animated WebP support - WebP muxer with animated WebP support
- zygoaudio decoding support - zygoaudio decoding support
- APNG demuxer - APNG decoder and demuxer
- postproc visualization support - postproc visualization support

View File

@ -537,6 +537,7 @@ x86 Michael Niedermayer
Releases Releases
======== ========
2.5 Michael Niedermayer
2.4 Michael Niedermayer 2.4 Michael Niedermayer
2.2 Michael Niedermayer 2.2 Michael Niedermayer
1.2 Michael Niedermayer 1.2 Michael Niedermayer

View File

@ -112,7 +112,7 @@ endef
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=)))) $(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
ffprobe.o cmdutils.o : libavutil/ffversion.h ffprobe.o cmdutils.o libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF) $(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
$(CP) $< $@ $(CP) $< $@

View File

@ -1 +1 @@
2.4.git 2.5.4

View File

@ -2,9 +2,13 @@
│ RELEASE NOTES for FFmpeg 2.5 "Bohr" │ │ RELEASE NOTES for FFmpeg 2.5 "Bohr" │
└────────────────────────────────────────┘ └────────────────────────────────────────┘
The FFmpeg Project proudly presents FFmpeg 2.5 "Bohr", just 2.5 months The FFmpeg Project proudly presents FFmpeg 2.5 "Bohr", 2.5 months after the
after the release of 2.4. Since this wasn't a long time ago, the Changelog release of 2.4.
is a bit short this time.
The most important new features are AVFoundation screen-grabbing support,
animated WebP decoding support, and Animated PNG support. In addition, many
exciting features for video streaming are also implemented, including MPEG-
DASH fragmenting muxer, HEVC RTP payload muxer, and UDP Lite support.
As usual, if you have any question on this release or any FFmpeg related As usual, if you have any question on this release or any FFmpeg related
topic, feel free to join us on the #ffmpeg IRC channel (on topic, feel free to join us on the #ffmpeg IRC channel (on
@ -56,6 +60,7 @@
• libutvideo YUV 4:2:2 10bit support • libutvideo YUV 4:2:2 10bit support
• animated WebP decoding support • animated WebP decoding support
• zygoaudio decoding support • zygoaudio decoding support
• APNG decoder
┌────────────────────────────┐ ┌────────────────────────────┐
│ libavdevice │ │ libavdevice │
@ -72,7 +77,8 @@
• SUP/PGS subtitle demuxer • SUP/PGS subtitle demuxer
• STL subtitle demuxer • STL subtitle demuxer
• UDP-Lite support (RFC 3828) • UDP-Lite support (RFC 3828)
• creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer • MPEG-DASH segmenting muxer, which allows creating DASH compatible
fragmented MP4
• WebP muxer • WebP muxer
• APNG demuxer • APNG demuxer
@ -93,7 +99,3 @@
└────────────────────────────┘ └────────────────────────────┘
• visualization support • visualization support
┌────────────────────────────┐
│ ⚠ Behaviour changes │
└────────────────────────────┘

View File

@ -1860,7 +1860,7 @@ int read_yesno(void)
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size) int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
{ {
int ret; int64_t ret;
FILE *f = av_fopen_utf8(filename, "rb"); FILE *f = av_fopen_utf8(filename, "rb");
if (!f) { if (!f) {

9
configure vendored
View File

@ -1635,7 +1635,6 @@ HEADERS_LIST="
asm_types_h asm_types_h
cdio_paranoia_h cdio_paranoia_h
cdio_paranoia_paranoia_h cdio_paranoia_paranoia_h
CL_cl_h
dev_bktr_ioctl_bt848_h dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h dev_bktr_ioctl_meteor_h
dev_ic_bt8xx_h dev_ic_bt8xx_h
@ -4413,7 +4412,7 @@ unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF EOF
od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
if [ "$cpu" = "power7" ] || [ "$cpu" = "power8" ] ;then if [ "$cpu" = "power7" ] || [ "$cpu" = "power8" ] || enabled ppc64; then
if ! enabled bigendian && enabled altivec ;then if ! enabled bigendian && enabled altivec ;then
enable vsx enable vsx
fi fi
@ -4756,7 +4755,6 @@ check_func_headers glob.h glob
enabled xlib && enabled xlib &&
check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
check_header cl/cl.h
check_header direct.h check_header direct.h
check_header dlfcn.h check_header dlfcn.h
check_header dxva.h check_header dxva.h
@ -4883,7 +4881,7 @@ enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
enabled libsmbclient && { check_pkg_config smbclient libsmbclient.h smbc_init || enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init ||
require smbclient libsmbclient.h smbc_init -lsmbclient; } require smbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
@ -5678,7 +5676,7 @@ cat > $TMPH <<EOF
#define FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)" #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
#define FFMPEG_LICENSE "$(c_escape $license)" #define FFMPEG_LICENSE "$(c_escape $license)"
#define CONFIG_THIS_YEAR 2014 #define CONFIG_THIS_YEAR 2015
#define FFMPEG_DATADIR "$(eval c_escape $datadir)" #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)" #define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})" #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
@ -5706,6 +5704,7 @@ enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
mkdir -p doc mkdir -p doc
mkdir -p tests
echo "@c auto-generated by configure" > doc/config.texi echo "@c auto-generated by configure" > doc/config.texi
print_config ARCH_ "$config_files" $ARCH_LIST print_config ARCH_ "$config_files" $ARCH_LIST

View File

@ -200,7 +200,7 @@ API changes, most recent first:
Increase FF_INPUT_BUFFER_PADDING_SIZE to 32 due to some corner cases needing Increase FF_INPUT_BUFFER_PADDING_SIZE to 32 due to some corner cases needing
it it
2014-06-10 - xxxxxxx - lavf 55.43.100 - avformat.h 2014-06-10 - 5482780 - lavf 55.43.100 - avformat.h
New field int64_t max_analyze_duration2 instead of deprecated New field int64_t max_analyze_duration2 instead of deprecated
int max_analyze_duration. int max_analyze_duration.
@ -224,7 +224,7 @@ API changes, most recent first:
Add strict_std_compliance and related AVOptions to support experimental Add strict_std_compliance and related AVOptions to support experimental
muxing. muxing.
2014-05-26 - xxxxxxx - lavu 52.87.100 - threadmessage.h 2014-05-26 - 55cc60c - lavu 52.87.100 - threadmessage.h
Add thread message queue API. Add thread message queue API.
2014-05-26 - c37d179 - lavf 55.41.100 - avformat.h 2014-05-26 - c37d179 - lavf 55.41.100 - avformat.h
@ -234,7 +234,7 @@ API changes, most recent first:
Add av_stream_get_side_data() to access stream-level side data Add av_stream_get_side_data() to access stream-level side data
in the same way as av_packet_get_side_data(). in the same way as av_packet_get_side_data().
2014-05-xx - xxxxxxx - lavu 52.86.100 - fifo.h 2014-05-20 - 7336e39 - lavu 52.86.100 - fifo.h
Add av_fifo_alloc_array() function. Add av_fifo_alloc_array() function.
2014-05-19 - ef1d4ee / bddd8cb - lavu 52.85.100 / 53.15.0 - frame.h, display.h 2014-05-19 - ef1d4ee / bddd8cb - lavu 52.85.100 / 53.15.0 - frame.h, display.h
@ -266,7 +266,7 @@ API changes, most recent first:
2014-05-11 - 14aef38 / 66e6c8a - lavu 52.83.100 / 53.14.0 - pixfmt.h 2014-05-11 - 14aef38 / 66e6c8a - lavu 52.83.100 / 53.14.0 - pixfmt.h
Add AV_PIX_FMT_VDA for new-style VDA acceleration. Add AV_PIX_FMT_VDA for new-style VDA acceleration.
2014-05-xx - xxxxxxx - lavu 52.82.100 - fifo.h 2014-05-07 - 351f611 - lavu 52.82.100 - fifo.h
Add av_fifo_freep() function. Add av_fifo_freep() function.
2014-05-02 - ba52fb11 - lavu 52.81.100 - opt.h 2014-05-02 - ba52fb11 - lavu 52.81.100 - opt.h
@ -288,10 +288,14 @@ API changes, most recent first:
Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing
reference-counted frames to encoders. reference-counted frames to encoders.
2014-04-30 - 617e866 - lavu 52.81.100 - pixdesc.h
Add av_find_best_pix_fmt_of_2(), av_get_pix_fmt_loss()
Deprecate avcodec_get_pix_fmt_loss(), avcodec_find_best_pix_fmt_of_2()
2014-04-29 - 1bf6396 - lavc 55.60.100 - avcodec.h 2014-04-29 - 1bf6396 - lavc 55.60.100 - avcodec.h
Add AVCodecDescriptor.mime_types field. Add AVCodecDescriptor.mime_types field.
2014-04-29 - xxxxxxx - lavu 52.80.0 - hash.h 2014-04-29 - b804eb4 - lavu 52.80.100 - hash.h
Add av_hash_final_bin(), av_hash_final_hex() and av_hash_final_b64(). Add av_hash_final_bin(), av_hash_final_hex() and av_hash_final_b64().
2014-03-07 - 8b2a130 - lavc 55.50.0 / 55.53.100 - dxva2.h 2014-03-07 - 8b2a130 - lavc 55.50.0 / 55.53.100 - dxva2.h
@ -303,7 +307,7 @@ API changes, most recent first:
2014-04-17 - a8d01a7 / 0983d48 - lavu 53.12.0 / 52.77.100 - crc.h 2014-04-17 - a8d01a7 / 0983d48 - lavu 53.12.0 / 52.77.100 - crc.h
Add AV_CRC_16_ANSI_LE crc variant. Add AV_CRC_16_ANSI_LE crc variant.
2014-04-XX - xxxxxxx - lavf xx.xx.1xx - avformat.h 2014-04-15 - ef818d8 - lavf 55.37.101 - avformat.h
Add av_format_inject_global_side_data() Add av_format_inject_global_side_data()
2014-04-12 - 4f698be - lavu 52.76.100 - log.h 2014-04-12 - 4f698be - lavu 52.76.100 - log.h
@ -383,7 +387,7 @@ API changes, most recent first:
2014-02-19 - f4c8d00 / 6bb8720 - lavu 52.64.101 / 53.3.1 - opt.h 2014-02-19 - f4c8d00 / 6bb8720 - lavu 52.64.101 / 53.3.1 - opt.h
Deprecate unused AV_OPT_FLAG_METADATA. Deprecate unused AV_OPT_FLAG_METADATA.
2014-02-xx - xxxxxxx - lavd 55.10.100 - avdevice.h 2014-02-16 - 81c3f81 - lavd 55.10.100 - avdevice.h
Add avdevice_list_devices() and avdevice_free_list_devices() Add avdevice_list_devices() and avdevice_free_list_devices()
2014-02-16 - db3c970 - lavf 55.33.100 - avio.h 2014-02-16 - db3c970 - lavf 55.33.100 - avio.h
@ -424,7 +428,7 @@ API changes, most recent first:
2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h 2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h
Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags(). Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags().
2014-01-19 - xxxxxxx - lavu 52.63.100 - rational.h 2014-01-19 - 3532dd5 - lavu 52.63.100 - rational.h
Add av_make_q() function. Add av_make_q() function.
2014-01-05 - 4cf4da9 / 5b4797a - lavu 52.62.100 / 53.2.0 - frame.h 2014-01-05 - 4cf4da9 / 5b4797a - lavu 52.62.100 / 53.2.0 - frame.h

View File

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

View File

@ -29,6 +29,7 @@ OBJS=$(addsuffix .o,$(EXAMPLES))
# the following examples make explicit use of the math library # the following examples make explicit use of the math library
avcodec: LDLIBS += -lm avcodec: LDLIBS += -lm
decoding_encoding: LDLIBS += -lm
muxing: LDLIBS += -lm muxing: LDLIBS += -lm
resampling_audio: LDLIBS += -lm resampling_audio: LDLIBS += -lm

View File

@ -90,6 +90,7 @@ static int init_filters(const char *filters_descr)
AVFilter *buffersink = avfilter_get_by_name("buffersink"); AVFilter *buffersink = avfilter_get_by_name("buffersink");
AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc();
AVRational time_base = fmt_ctx->streams[video_stream_index]->time_base;
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
filter_graph = avfilter_graph_alloc(); filter_graph = avfilter_graph_alloc();
@ -102,7 +103,7 @@ static int init_filters(const char *filters_descr)
snprintf(args, sizeof(args), snprintf(args, sizeof(args),
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt, dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
dec_ctx->time_base.num, dec_ctx->time_base.den, time_base.num, time_base.den,
dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den); dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in", ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",

View File

@ -116,6 +116,10 @@ static int open_output_file(const char *filename)
|| dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { || dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
/* in this example, we choose transcoding to same codec */ /* in this example, we choose transcoding to same codec */
encoder = avcodec_find_encoder(dec_ctx->codec_id); encoder = avcodec_find_encoder(dec_ctx->codec_id);
if (!encoder) {
av_log(NULL, AV_LOG_FATAL, "Neccessary encoder not found\n");
return AVERROR_INVALIDDATA;
}
/* In this example, we transcode to same properties (picture size, /* In this example, we transcode to same properties (picture size,
* sample rate etc.). These properties can be changed for output * sample rate etc.). These properties can be changed for output

View File

@ -2521,7 +2521,7 @@ static int transcode_init(void)
AVFormatContext *oc; AVFormatContext *oc;
OutputStream *ost; OutputStream *ost;
InputStream *ist; InputStream *ist;
char error[1024]; char error[1024] = {0};
int want_sdp = 1; int want_sdp = 1;
for (i = 0; i < nb_filtergraphs; i++) { for (i = 0; i < nb_filtergraphs; i++) {

View File

@ -2780,7 +2780,7 @@ static void spectral_to_sample(AACContext *ac)
apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling); apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling);
che->present = 0; che->present = 0;
} else if (che) { } else if (che) {
av_log(ac->avctx, AV_LOG_WARNING, "ChannelElement %d.%d missing \n", type, i); av_log(ac->avctx, AV_LOG_VERBOSE, "ChannelElement %d.%d missing \n", type, i);
} }
} }
} }

View File

@ -753,10 +753,10 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
s->chan_map = aac_chan_configs[s->channels-1]; s->chan_map = aac_chan_configs[s->channels-1];
if (ret = dsp_init(avctx, s)) if ((ret = dsp_init(avctx, s)) < 0)
goto fail; goto fail;
if (ret = alloc_buffers(avctx, s)) if ((ret = alloc_buffers(avctx, s)) < 0)
goto fail; goto fail;
avctx->extradata_size = 5; avctx->extradata_size = 5;
@ -768,7 +768,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
lengths[1] = ff_aac_num_swb_128[i]; lengths[1] = ff_aac_num_swb_128[i];
for (i = 0; i < s->chan_map[0]; i++) for (i = 0; i < s->chan_map[0]; i++)
grouping[i] = s->chan_map[i + 1] == TYPE_CPE; grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
if (ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping)) if ((ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths,
s->chan_map[0], grouping)) < 0)
goto fail; goto fail;
s->psypp = ff_psy_preprocess_init(avctx); s->psypp = ff_psy_preprocess_init(avctx);
s->coder = &ff_aac_coders[s->options.aac_coder]; s->coder = &ff_aac_coders[s->options.aac_coder];

View File

@ -78,6 +78,7 @@ av_cold void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth,
c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;
c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;
c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
if (chroma_format_idc <= 1)
c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;

View File

@ -23,9 +23,10 @@
#include "libavutil/arm/asm.S" #include "libavutil/arm/asm.S"
function ff_prefetch_arm, export=1 function ff_prefetch_arm, export=1
1:
subs r2, r2, #1 subs r2, r2, #1
pld [r0] pld [r0]
add r0, r0, r1 add r0, r0, r1
bne X(ff_prefetch_arm) bne 1b
bx lr bx lr
endfunc endfunc

View File

@ -2360,6 +2360,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
#else #else
if (s->xch_present && !s->xch_disable) { if (s->xch_present && !s->xch_disable) {
#endif #endif
if (avctx->channel_layout & AV_CH_BACK_CENTER) {
avpriv_request_sample(avctx, "XCh with Back center channel");
return AVERROR_INVALIDDATA;
}
avctx->channel_layout |= AV_CH_BACK_CENTER; avctx->channel_layout |= AV_CH_BACK_CENTER;
if (s->lfe) { if (s->lfe) {
avctx->channel_layout |= AV_CH_LOW_FREQUENCY; avctx->channel_layout |= AV_CH_LOW_FREQUENCY;

View File

@ -39,7 +39,7 @@ typedef struct DVDSubContext
int has_palette; int has_palette;
uint8_t colormap[4]; uint8_t colormap[4];
uint8_t alpha[256]; uint8_t alpha[256];
uint8_t *buf; uint8_t buf[0x10000];
int buf_size; int buf_size;
int forced_subs_only; int forced_subs_only;
#ifdef DEBUG #ifdef DEBUG
@ -108,6 +108,12 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
int x, y, len, color; int x, y, len, color;
uint8_t *d; uint8_t *d;
if (start >= buf_size)
return -1;
if (w <= 0 || h <= 0)
return -1;
bit_len = (buf_size - start) * 8; bit_len = (buf_size - start) * 8;
init_get_bits(&gb, buf + start, bit_len); init_get_bits(&gb, buf + start, bit_len);
@ -359,10 +365,12 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect)); sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
sub_header->num_rects = 1; sub_header->num_rects = 1;
sub_header->rects[0]->pict.data[0] = bitmap; sub_header->rects[0]->pict.data[0] = bitmap;
decode_rle(bitmap, w * 2, w, (h + 1) / 2, if (decode_rle(bitmap, w * 2, w, (h + 1) / 2,
buf, offset1, buf_size, is_8bit); buf, offset1, buf_size, is_8bit) < 0)
decode_rle(bitmap + w, w * 2, w, h / 2, goto fail;
buf, offset2, buf_size, is_8bit); if (decode_rle(bitmap + w, w * 2, w, h / 2,
buf, offset2, buf_size, is_8bit) < 0)
goto fail;
sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE); sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
if (is_8bit) { if (is_8bit) {
if (!yuv_palette) if (!yuv_palette)
@ -501,15 +509,11 @@ static int append_to_cached_buf(AVCodecContext *avctx,
{ {
DVDSubContext *ctx = avctx->priv_data; DVDSubContext *ctx = avctx->priv_data;
if (ctx->buf_size > 0xffff - buf_size) { if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct " av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
"too large SPU packets aborted.\n"); "too large SPU packets aborted.\n");
av_freep(&ctx->buf);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
ctx->buf = av_realloc(ctx->buf, ctx->buf_size + buf_size);
if (!ctx->buf)
return AVERROR(ENOMEM);
memcpy(ctx->buf + ctx->buf_size, buf, buf_size); memcpy(ctx->buf + ctx->buf_size, buf, buf_size);
ctx->buf_size += buf_size; ctx->buf_size += buf_size;
return 0; return 0;
@ -525,7 +529,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
AVSubtitle *sub = data; AVSubtitle *sub = data;
int is_menu; int is_menu;
if (ctx->buf) { if (ctx->buf_size) {
int ret = append_to_cached_buf(avctx, buf, buf_size); int ret = append_to_cached_buf(avctx, buf, buf_size);
if (ret < 0) { if (ret < 0) {
*data_size = 0; *data_size = 0;
@ -567,7 +571,6 @@ static int dvdsub_decode(AVCodecContext *avctx,
} }
#endif #endif
av_freep(&ctx->buf);
ctx->buf_size = 0; ctx->buf_size = 0;
*data_size = 1; *data_size = 1;
return buf_size; return buf_size;
@ -711,7 +714,6 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
static av_cold int dvdsub_close(AVCodecContext *avctx) static av_cold int dvdsub_close(AVCodecContext *avctx)
{ {
DVDSubContext *ctx = avctx->priv_data; DVDSubContext *ctx = avctx->priv_data;
av_freep(&ctx->buf);
ctx->buf_size = 0; ctx->buf_size = 0;
return 0; return 0;
} }

View File

@ -65,7 +65,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
uint8_t *Y1, *Y2, *Y3, *Y4, *U, *V; uint8_t *Y1, *Y2, *Y3, *Y4, *U, *V;
int ret; int ret;
if (src_size < avctx->width * avctx->height * 9L / 8) { if (src_size < avctx->width * avctx->height * 9LL / 8) {
av_log(avctx, AV_LOG_ERROR, "packet too small\n"); av_log(avctx, AV_LOG_ERROR, "packet too small\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -108,7 +108,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
uint8_t *Y1, *Y2, *U, *V; uint8_t *Y1, *Y2, *U, *V;
int ret; int ret;
if (src_size < avctx->width * avctx->height * 3L / 2) { if (src_size < avctx->width * avctx->height * 3LL / 2) {
av_log(avctx, AV_LOG_ERROR, "packet too small\n"); av_log(avctx, AV_LOG_ERROR, "packet too small\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -145,7 +145,7 @@ static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic,
uint8_t *Y, *U, *V; uint8_t *Y, *U, *V;
int ret; int ret;
if (src_size < avctx->width * avctx->height * 3L) { if (src_size < avctx->width * avctx->height * 3LL) {
av_log(avctx, AV_LOG_ERROR, "packet too small\n"); av_log(avctx, AV_LOG_ERROR, "packet too small\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }

View File

@ -697,7 +697,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
handle_error: handle_error:
*poutbuf = NULL; *poutbuf = NULL;
*poutbuf_size = 0; *poutbuf_size = 0;
return read_end - buf; return buf_size ? read_end - buf : 0;
} }
static av_cold int flac_parse_init(AVCodecParserContext *c) static av_cold int flac_parse_init(AVCodecParserContext *c)

View File

@ -391,6 +391,7 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
if (free_rbsp && h->DPB) { if (free_rbsp && h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
ff_h264_unref_picture(h, &h->DPB[i]); ff_h264_unref_picture(h, &h->DPB[i]);
memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
av_freep(&h->DPB); av_freep(&h->DPB);
} else if (h->DPB) { } else if (h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
@ -990,6 +991,16 @@ int ff_pred_weight_table(H264Context *h)
h->luma_log2_weight_denom = get_ue_golomb(&h->gb); h->luma_log2_weight_denom = get_ue_golomb(&h->gb);
if (h->sps.chroma_format_idc) if (h->sps.chroma_format_idc)
h->chroma_log2_weight_denom = get_ue_golomb(&h->gb); h->chroma_log2_weight_denom = get_ue_golomb(&h->gb);
if (h->luma_log2_weight_denom > 7U) {
av_log(h->avctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", h->luma_log2_weight_denom);
h->luma_log2_weight_denom = 0;
}
if (h->chroma_log2_weight_denom > 7U) {
av_log(h->avctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", h->chroma_log2_weight_denom);
h->chroma_log2_weight_denom = 0;
}
luma_def = 1 << h->luma_log2_weight_denom; luma_def = 1 << h->luma_log2_weight_denom;
chroma_def = 1 << h->chroma_log2_weight_denom; chroma_def = 1 << h->chroma_log2_weight_denom;
@ -1504,8 +1515,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
continue; continue;
again: again:
if ( !(avctx->active_thread_type & FF_THREAD_FRAME) if ( (!(avctx->active_thread_type & FF_THREAD_FRAME) || nals_needed >= nal_index)
|| nals_needed >= nal_index) && !h->current_slice)
h->au_pps_id = -1; h->au_pps_id = -1;
/* Ignore per frame NAL unit type during extradata /* Ignore per frame NAL unit type during extradata
* parsing. Decoding slices is not possible in codec init * parsing. Decoding slices is not possible in codec init

View File

@ -338,6 +338,7 @@ typedef struct H264Picture {
* H264Context * H264Context
*/ */
typedef struct H264Context { typedef struct H264Context {
AVClass *av_class;
AVCodecContext *avctx; AVCodecContext *avctx;
MECmpContext mecc; MECmpContext mecc;
VideoDSPContext vdsp; VideoDSPContext vdsp;

View File

@ -1282,7 +1282,7 @@ void ff_h264_init_cabac_states(H264Context *h) {
} }
static int decode_cabac_field_decoding_flag(H264Context *h) { static int decode_cabac_field_decoding_flag(H264Context *h) {
const long mbb_xy = h->mb_xy - 2L*h->mb_stride; const int mbb_xy = h->mb_xy - 2*h->mb_stride;
unsigned long ctx = 0; unsigned long ctx = 0;

View File

@ -371,7 +371,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
"Different chroma and luma bit depth"); "Different chroma and luma bit depth");
goto fail; goto fail;
} }
if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U) { if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 ||
sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) {
av_log(h->avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n", av_log(h->avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n",
sps->bit_depth_luma, sps->bit_depth_chroma); sps->bit_depth_luma, sps->bit_depth_chroma);
goto fail; goto fail;

View File

@ -1305,6 +1305,9 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
int must_reinit; int must_reinit;
int needs_reinit = 0; int needs_reinit = 0;
int field_pic_flag, bottom_field_flag; int field_pic_flag, bottom_field_flag;
int first_slice = h == h0 && !h0->current_slice;
int frame_num, picture_structure, droppable;
PPS *pps;
h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab; h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
h->qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab; h->qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab;
@ -1378,18 +1381,27 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
h0->au_pps_id, pps_id); h0->au_pps_id, pps_id);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
h->pps = *h0->pps_buffers[pps_id];
if (!h0->sps_buffers[h->pps.sps_id]) { pps = h0->pps_buffers[pps_id];
if (!h0->sps_buffers[pps->sps_id]) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
"non-existing SPS %u referenced\n", "non-existing SPS %u referenced\n",
h->pps.sps_id); h->pps.sps_id);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (first_slice)
h->pps = *h0->pps_buffers[pps_id];
if (h->pps.sps_id != h->sps.sps_id || if (pps->sps_id != h->sps.sps_id ||
h->pps.sps_id != h->current_sps_id || pps->sps_id != h->current_sps_id ||
h0->sps_buffers[h->pps.sps_id]->new) { h0->sps_buffers[pps->sps_id]->new) {
if (!first_slice) {
av_log(h->avctx, AV_LOG_ERROR,
"SPS changed in the middle of the frame\n");
return AVERROR_INVALIDDATA;
}
h->sps = *h0->sps_buffers[h->pps.sps_id]; h->sps = *h0->sps_buffers[h->pps.sps_id];
@ -1419,13 +1431,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|| 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height || 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height
|| h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc || h->cur_chroma_format_idc != h->sps.chroma_format_idc
|| av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio)
|| h->mb_width != h->sps.mb_width || h->mb_width != h->sps.mb_width
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) || h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
)); ));
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0))) if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
must_reinit = 1; must_reinit = 1;
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
must_reinit = 1;
h->mb_width = h->sps.mb_width; h->mb_width = h->sps.mb_width;
h->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); h->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
h->mb_num = h->mb_width * h->mb_height; h->mb_num = h->mb_width * h->mb_height;
@ -1466,6 +1480,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
av_assert1(first_slice);
ff_h264_flush_change(h); ff_h264_flush_change(h);
if ((ret = get_pixel_format(h, 1)) < 0) if ((ret = get_pixel_format(h, 1)) < 0)
@ -1504,39 +1520,43 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
h264_init_dequant_tables(h); h264_init_dequant_tables(h);
} }
h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num); frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
if (!first_slice) {
if (h0->frame_num != frame_num) {
av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n",
h0->frame_num, frame_num);
return AVERROR_INVALIDDATA;
}
}
h->mb_mbaff = 0; h->mb_mbaff = 0;
h->mb_aff_frame = 0; h->mb_aff_frame = 0;
last_pic_structure = h0->picture_structure; last_pic_structure = h0->picture_structure;
last_pic_droppable = h0->droppable; last_pic_droppable = h0->droppable;
h->droppable = h->nal_ref_idc == 0; droppable = h->nal_ref_idc == 0;
if (h->sps.frame_mbs_only_flag) { if (h->sps.frame_mbs_only_flag) {
h->picture_structure = PICT_FRAME; picture_structure = PICT_FRAME;
} else { } else {
if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) { if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) {
av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n");
return -1; return -1;
} }
field_pic_flag = get_bits1(&h->gb); field_pic_flag = get_bits1(&h->gb);
if (field_pic_flag) { if (field_pic_flag) {
bottom_field_flag = get_bits1(&h->gb); bottom_field_flag = get_bits1(&h->gb);
h->picture_structure = PICT_TOP_FIELD + bottom_field_flag; picture_structure = PICT_TOP_FIELD + bottom_field_flag;
} else { } else {
h->picture_structure = PICT_FRAME; picture_structure = PICT_FRAME;
h->mb_aff_frame = h->sps.mb_aff; h->mb_aff_frame = h->sps.mb_aff;
} }
} }
h->mb_field_decoding_flag = h->picture_structure != PICT_FRAME; if (h0->current_slice) {
if (last_pic_structure != picture_structure ||
if (h0->current_slice != 0) { last_pic_droppable != droppable) {
if (last_pic_structure != h->picture_structure ||
last_pic_droppable != h->droppable) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
"Changing field mode (%d -> %d) between slices is not allowed\n", "Changing field mode (%d -> %d) between slices is not allowed\n",
last_pic_structure, h->picture_structure); last_pic_structure, h->picture_structure);
h->picture_structure = last_pic_structure;
h->droppable = last_pic_droppable;
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} else if (!h0->cur_pic_ptr) { } else if (!h0->cur_pic_ptr) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
@ -1544,7 +1564,14 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
h0->current_slice + 1); h0->current_slice + 1);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} else { }
h->picture_structure = picture_structure;
h->droppable = droppable;
h->frame_num = frame_num;
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
if (h0->current_slice == 0) {
/* Shorten frame num gaps so we don't have to allocate reference /* Shorten frame num gaps so we don't have to allocate reference
* frames just to throw them away */ * frames just to throw them away */
if (h->frame_num != h->prev_frame_num) { if (h->frame_num != h->prev_frame_num) {

View File

@ -108,7 +108,7 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
if (!s->tab_ipm || !s->cbf_luma || !s->is_pcm) if (!s->tab_ipm || !s->cbf_luma || !s->is_pcm)
goto fail; goto fail;
s->filter_slice_edges = av_malloc(ctb_count); s->filter_slice_edges = av_mallocz(ctb_count);
s->tab_slice_address = av_malloc_array(pic_size_in_ctb, s->tab_slice_address = av_malloc_array(pic_size_in_ctb,
sizeof(*s->tab_slice_address)); sizeof(*s->tab_slice_address));
s->qp_y_tab = av_malloc_array(pic_size_in_ctb, s->qp_y_tab = av_malloc_array(pic_size_in_ctb,
@ -144,7 +144,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
uint8_t luma_weight_l1_flag[16]; uint8_t luma_weight_l1_flag[16];
uint8_t chroma_weight_l1_flag[16]; uint8_t chroma_weight_l1_flag[16];
s->sh.luma_log2_weight_denom = get_ue_golomb_long(gb); s->sh.luma_log2_weight_denom = av_clip_c(get_ue_golomb_long(gb), 0, 7);
if (s->sps->chroma_format_idc != 0) { if (s->sps->chroma_format_idc != 0) {
int delta = get_se_golomb(gb); int delta = get_se_golomb(gb);
s->sh.chroma_log2_weight_denom = av_clip(s->sh.luma_log2_weight_denom + delta, 0, 7); s->sh.chroma_log2_weight_denom = av_clip(s->sh.luma_log2_weight_denom + delta, 0, 7);
@ -2870,17 +2870,30 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
if (s->nals_allocated < s->nb_nals + 1) { if (s->nals_allocated < s->nb_nals + 1) {
int new_size = s->nals_allocated + 1; int new_size = s->nals_allocated + 1;
HEVCNAL *tmp = av_realloc_array(s->nals, new_size, sizeof(*tmp)); void *tmp = av_realloc_array(s->nals, new_size, sizeof(*s->nals));
ret = AVERROR(ENOMEM);
if (!tmp) { if (!tmp) {
ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
s->nals = tmp; s->nals = tmp;
memset(s->nals + s->nals_allocated, 0, memset(s->nals + s->nals_allocated, 0,
(new_size - s->nals_allocated) * sizeof(*tmp)); (new_size - s->nals_allocated) * sizeof(*s->nals));
av_reallocp_array(&s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
av_reallocp_array(&s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal)); tmp = av_realloc_array(s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
av_reallocp_array(&s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal)); if (!tmp)
goto fail;
s->skipped_bytes_nal = tmp;
tmp = av_realloc_array(s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
if (!tmp)
goto fail;
s->skipped_bytes_pos_size_nal = tmp;
tmp = av_realloc_array(s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
if (!tmp)
goto fail;
s->skipped_bytes_pos_nal = tmp;
s->skipped_bytes_pos_size_nal[s->nals_allocated] = 1024; // initial buffer size s->skipped_bytes_pos_size_nal[s->nals_allocated] = 1024; // initial buffer size
s->skipped_bytes_pos_nal[s->nals_allocated] = av_malloc_array(s->skipped_bytes_pos_size_nal[s->nals_allocated], sizeof(*s->skipped_bytes_pos)); s->skipped_bytes_pos_nal[s->nals_allocated] = av_malloc_array(s->skipped_bytes_pos_size_nal[s->nals_allocated], sizeof(*s->skipped_bytes_pos));
s->nals_allocated = new_size; s->nals_allocated = new_size;

View File

@ -1255,6 +1255,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
if (pps->cu_qp_delta_enabled_flag) if (pps->cu_qp_delta_enabled_flag)
pps->diff_cu_qp_delta_depth = get_ue_golomb_long(gb); pps->diff_cu_qp_delta_depth = get_ue_golomb_long(gb);
if (pps->diff_cu_qp_delta_depth < 0 ||
pps->diff_cu_qp_delta_depth > sps->log2_diff_max_min_coding_block_size) {
av_log(s->avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n",
pps->diff_cu_qp_delta_depth);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->cb_qp_offset = get_se_golomb(gb); pps->cb_qp_offset = get_se_golomb(gb);
if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) { if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) {
av_log(s->avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n", av_log(s->avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n",

View File

@ -94,7 +94,7 @@ typedef struct Indeo3DecodeContext {
int16_t width, height; int16_t width, height;
uint32_t frame_num; ///< current frame number (zero-based) uint32_t frame_num; ///< current frame number (zero-based)
uint32_t data_size; ///< size of the frame data in bytes int data_size; ///< size of the frame data in bytes
uint16_t frame_flags; ///< frame properties uint16_t frame_flags; ///< frame properties
uint8_t cb_offset; ///< needed for selecting VQ tables uint8_t cb_offset; ///< needed for selecting VQ tables
uint8_t buf_sel; ///< active frame buffer: 0 - primary, 1 -secondary uint8_t buf_sel; ///< active frame buffer: 0 - primary, 1 -secondary
@ -899,7 +899,8 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
GetByteContext gb; GetByteContext gb;
const uint8_t *bs_hdr; const uint8_t *bs_hdr;
uint32_t frame_num, word2, check_sum, data_size; uint32_t frame_num, word2, check_sum, data_size;
uint32_t y_offset, u_offset, v_offset, starts[3], ends[3]; int y_offset, u_offset, v_offset;
uint32_t starts[3], ends[3];
uint16_t height, width; uint16_t height, width;
int i, j; int i, j;
@ -981,7 +982,8 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
ctx->y_data_size = ends[0] - starts[0]; ctx->y_data_size = ends[0] - starts[0];
ctx->v_data_size = ends[1] - starts[1]; ctx->v_data_size = ends[1] - starts[1];
ctx->u_data_size = ends[2] - starts[2]; ctx->u_data_size = ends[2] - starts[2];
if (FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 || if (FFMIN3(y_offset, v_offset, u_offset) < 0 ||
FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
FFMIN3(y_offset, v_offset, u_offset) < gb.buffer - bs_hdr + 16 || FFMIN3(y_offset, v_offset, u_offset) < gb.buffer - bs_hdr + 16 ||
FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) { FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) {
av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n"); av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n");

View File

@ -43,6 +43,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
{ {
JvContext *s = avctx->priv_data; JvContext *s = avctx->priv_data;
if (!avctx->width || !avctx->height ||
(avctx->width & 7) || (avctx->height & 7)) {
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
avctx->width, avctx->height);
return AVERROR(EINVAL);
}
s->frame = av_frame_alloc(); s->frame = av_frame_alloc();
if (!s->frame) if (!s->frame)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -561,9 +561,12 @@ unk_pixfmt:
} }
if (s->ls) { if (s->ls) {
s->upscale_h = s->upscale_v = 0; s->upscale_h = s->upscale_v = 0;
if (s->nb_components > 1) if (s->nb_components == 3) {
s->avctx->pix_fmt = AV_PIX_FMT_RGB24; s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
else if (s->palette_index && s->bits <= 8) } else if (s->nb_components != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of components %d\n", s->nb_components);
return AVERROR_PATCHWELCOME;
} else if (s->palette_index && s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_PAL8; s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
else if (s->bits <= 8) else if (s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
@ -1248,13 +1251,18 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
if (s->interlaced && s->bottom_field) if (s->interlaced && s->bottom_field)
block_offset += linesize[c] >> 1; block_offset += linesize[c] >> 1;
ptr = data[c] + block_offset; if ( 8*(h * mb_x + x) < s->width
&& 8*(v * mb_y + y) < s->height) {
ptr = data[c] + block_offset;
} else
ptr = NULL;
if (!s->progressive) { if (!s->progressive) {
if (copy_mb) if (copy_mb) {
mjpeg_copy_block(s, ptr, reference_data[c] + block_offset, if (ptr)
linesize[c], s->avctx->lowres); mjpeg_copy_block(s, ptr, reference_data[c] + block_offset,
linesize[c], s->avctx->lowres);
else { } else {
s->bdsp.clear_block(s->block); s->bdsp.clear_block(s->block);
if (decode_block(s, s->block, i, if (decode_block(s, s->block, i,
s->dc_index[i], s->ac_index[i], s->dc_index[i], s->ac_index[i],
@ -1263,9 +1271,11 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
"error y=%d x=%d\n", mb_y, mb_x); "error y=%d x=%d\n", mb_y, mb_x);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
s->idsp.idct_put(ptr, linesize[c], s->block); if (ptr) {
if (s->bits & 7) s->idsp.idct_put(ptr, linesize[c], s->block);
shift_output(s, ptr, linesize[c]); if (s->bits & 7)
shift_output(s, ptr, linesize[c]);
}
} }
} else { } else {
int block_idx = s->block_stride[c] * (v * mb_y + y) + int block_idx = s->block_stride[c] * (v * mb_y + y) +
@ -1904,6 +1914,10 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
put_bits(&pb, 8, x); put_bits(&pb, 8, x);
if (x == 0xFF) { if (x == 0xFF) {
x = src[b++]; x = src[b++];
if (x & 0x80) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
x &= 0x7f;
}
put_bits(&pb, 7, x); put_bits(&pb, 7, x);
bit_count--; bit_count--;
} }

View File

@ -61,6 +61,13 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_PAL8; avctx->pix_fmt = AV_PIX_FMT_PAL8;
if (!avctx->width || !avctx->height ||
(avctx->width & 1) || (avctx->height & 1)) {
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
avctx->width, avctx->height);
return AVERROR(EINVAL);
}
s->frame = av_frame_alloc(); s->frame = av_frame_alloc();
if (!s->frame) if (!s->frame)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -428,9 +428,11 @@ static av_cold int decode_init(AVCodecContext * avctx)
s->avctx = avctx; s->avctx = avctx;
#if USE_FLOATS
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT); s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
if (!s->fdsp) if (!s->fdsp)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
#endif
ff_mpadsp_init(&s->mpadsp); ff_mpadsp_init(&s->mpadsp);

View File

@ -395,18 +395,18 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
switch(avctx->codec_id) { switch(avctx->codec_id) {
case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO: case AV_CODEC_ID_MPEG2VIDEO:
avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112L / 15000000 * 16384; avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112LL / 15000000 * 16384;
break; break;
case AV_CODEC_ID_MPEG4: case AV_CODEC_ID_MPEG4:
case AV_CODEC_ID_MSMPEG4V1: case AV_CODEC_ID_MSMPEG4V1:
case AV_CODEC_ID_MSMPEG4V2: case AV_CODEC_ID_MSMPEG4V2:
case AV_CODEC_ID_MSMPEG4V3: case AV_CODEC_ID_MSMPEG4V3:
if (avctx->rc_max_rate >= 15000000) { if (avctx->rc_max_rate >= 15000000) {
avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000L) * (760-320) / (38400000 - 15000000); avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000LL) * (760-320) / (38400000 - 15000000);
} else if(avctx->rc_max_rate >= 2000000) { } else if(avctx->rc_max_rate >= 2000000) {
avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000L) * (320- 80) / (15000000 - 2000000); avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000LL) * (320- 80) / (15000000 - 2000000);
} else if(avctx->rc_max_rate >= 384000) { } else if(avctx->rc_max_rate >= 384000) {
avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000L) * ( 80- 40) / ( 2000000 - 384000); avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000LL) * ( 80- 40) / ( 2000000 - 384000);
} else } else
avctx->rc_buffer_size = 40; avctx->rc_buffer_size = 40;
avctx->rc_buffer_size *= 16384; avctx->rc_buffer_size *= 16384;

View File

@ -178,7 +178,7 @@ static void gmc_motion(MpegEncContext *s,
s->sprite_delta[0][0], s->sprite_delta[0][1], s->sprite_delta[0][0], s->sprite_delta[0][1],
s->sprite_delta[1][0], s->sprite_delta[1][1], s->sprite_delta[1][0], s->sprite_delta[1][1],
a + 1, (1 << (2 * a + 1)) - s->no_rounding, a + 1, (1 << (2 * a + 1)) - s->no_rounding,
s->h_edge_pos >> 1, s->v_edge_pos >> 1); (s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1);
ptr = ref_picture[2]; ptr = ref_picture[2];
s->mdsp.gmc(dest_cr, ptr, uvlinesize, 8, s->mdsp.gmc(dest_cr, ptr, uvlinesize, 8,
@ -186,7 +186,7 @@ static void gmc_motion(MpegEncContext *s,
s->sprite_delta[0][0], s->sprite_delta[0][1], s->sprite_delta[0][0], s->sprite_delta[0][1],
s->sprite_delta[1][0], s->sprite_delta[1][1], s->sprite_delta[1][0], s->sprite_delta[1][1],
a + 1, (1 << (2 * a + 1)) - s->no_rounding, a + 1, (1 << (2 * a + 1)) - s->no_rounding,
s->h_edge_pos >> 1, s->v_edge_pos >> 1); (s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1);
} }
static inline int hpel_motion(MpegEncContext *s, static inline int hpel_motion(MpegEncContext *s,

View File

@ -209,16 +209,26 @@ static void idct_add_altivec(uint8_t *dest, int stride, int16_t *blk)
IDCT; IDCT;
#if HAVE_BIGENDIAN
p0 = vec_lvsl(0, dest); p0 = vec_lvsl(0, dest);
p1 = vec_lvsl(stride, dest); p1 = vec_lvsl(stride, dest);
p = vec_splat_u8(-1); p = vec_splat_u8(-1);
perm0 = vec_mergeh(p, p0); perm0 = vec_mergeh(p, p0);
perm1 = vec_mergeh(p, p1); perm1 = vec_mergeh(p, p1);
#endif
#if HAVE_BIGENDIAN
#define GET_TMP2(dest, prm) \
tmp = vec_ld(0, dest); \
tmp2 = (vec_s16) vec_perm(tmp, (vec_u8) zero, prm);
#else
#define GET_TMP2(dest, prm) \
tmp = vec_vsx_ld(0, dest); \
tmp2 = (vec_s16) vec_mergeh(tmp, (vec_u8) zero)
#endif
#define ADD(dest, src, perm) \ #define ADD(dest, src, perm) \
/* *(uint64_t *) &tmp = *(uint64_t *) dest; */ \ GET_TMP2(dest, perm); \
tmp = vec_ld(0, dest); \
tmp2 = (vec_s16) vec_perm(tmp, (vec_u8) zero, perm); \
tmp3 = vec_adds(tmp2, src); \ tmp3 = vec_adds(tmp2, src); \
tmp = vec_packsu(tmp3, tmp3); \ tmp = vec_packsu(tmp3, tmp3); \
vec_ste((vec_u32) tmp, 0, (unsigned int *) dest); \ vec_ste((vec_u32) tmp, 0, (unsigned int *) dest); \

View File

@ -55,7 +55,7 @@ static int pix_norm1_altivec(uint8_t *pix, int line_size)
/* Sum up the four partial sums, and put the result into s. */ /* Sum up the four partial sums, and put the result into s. */
sum = vec_sums((vector signed int) sv, (vector signed int) zero); sum = vec_sums((vector signed int) sv, (vector signed int) zero);
sum = vec_splat(sum, 3); sum = vec_splat(sum, 3);
vec_vsx_st(sum, 0, &s); vec_ste(sum, 0, &s);
return s; return s;
} }
#else #else
@ -113,7 +113,7 @@ static int pix_sum_altivec(uint8_t *pix, int line_size)
/* Sum up the four partial sums, and put the result into s. */ /* Sum up the four partial sums, and put the result into s. */
sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero); sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
sumdiffs = vec_splat(sumdiffs, 3); sumdiffs = vec_splat(sumdiffs, 3);
vec_vsx_st(sumdiffs, 0, &s); vec_ste(sumdiffs, 0, &s);
return s; return s;
} }
#else #else

View File

@ -304,16 +304,23 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, int16_t *block)
src2 = vec_pack(s2, sA); src2 = vec_pack(s2, sA);
src3 = vec_pack(s3, sB); src3 = vec_pack(s3, sB);
#if HAVE_BIGENDIAN
p0 = vec_lvsl (0, dest); p0 = vec_lvsl (0, dest);
p1 = vec_lvsl (stride, dest); p1 = vec_lvsl (stride, dest);
p = vec_splat_u8 (-1); p = vec_splat_u8 (-1);
perm0 = vec_mergeh (p, p0); perm0 = vec_mergeh (p, p0);
perm1 = vec_mergeh (p, p1); perm1 = vec_mergeh (p, p1);
#define GET_TMP2(dst, p) \
tmp = vec_ld (0, dest); \
tmp2 = (vector signed short)vec_perm (tmp, vec_splat_u8(0), p);
#else
#define GET_TMP2(dst,p) \
tmp = vec_vsx_ld (0, dst); \
tmp2 = (vector signed short)vec_mergeh (tmp, vec_splat_u8(0));
#endif
#define ADD(dest,src,perm) \ #define ADD(dest,src,perm) \
/* *(uint64_t *)&tmp = *(uint64_t *)dest; */ \ GET_TMP2(dest, perm); \
tmp = vec_ld (0, dest); \
tmp2 = (vector signed short)vec_perm (tmp, vec_splat_u8(0), perm); \
tmp3 = vec_adds (tmp2, src); \ tmp3 = vec_adds (tmp2, src); \
tmp = vec_packsu (tmp3, tmp3); \ tmp = vec_packsu (tmp3, tmp3); \
vec_ste ((vector unsigned int)tmp, 0, (unsigned int *)dest); \ vec_ste ((vector unsigned int)tmp, 0, (unsigned int *)dest); \

View File

@ -32,8 +32,13 @@
static const vec_s16 constants = static const vec_s16 constants =
{0, 64277, 60547, 54491, 46341, 36410, 25080, 12785}; {0, 64277, 60547, 54491, 46341, 36410, 25080, 12785};
#if HAVE_BIGENDIAN
static const vec_u8 interleave_high = static const vec_u8 interleave_high =
{0, 1, 16, 17, 4, 5, 20, 21, 8, 9, 24, 25, 12, 13, 28, 29}; {0, 1, 16, 17, 4, 5, 20, 21, 8, 9, 24, 25, 12, 13, 28, 29};
#else
static const vec_u8 interleave_high =
{2, 3, 18, 19, 6, 7, 22, 23, 10, 11, 26, 27, 14, 15, 30, 31};
#endif
#define IDCT_START \ #define IDCT_START \
vec_s16 A, B, C, D, Ad, Bd, Cd, Dd, E, F, G, H;\ vec_s16 A, B, C, D, Ad, Bd, Cd, Dd, E, F, G, H;\
@ -156,9 +161,18 @@ static void vp3_idct_add_altivec(uint8_t *dst, int stride, int16_t block[64])
TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7); TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);
IDCT_1D(ADD8, SHIFT4) IDCT_1D(ADD8, SHIFT4)
#define ADD(a)\ #if HAVE_BIGENDIAN
#define GET_VDST16\
vdst = vec_ld(0, dst);\ vdst = vec_ld(0, dst);\
vdst_16 = (vec_s16)vec_perm(vdst, zero_u8v, vdst_mask);\ vdst_16 = (vec_s16)vec_perm(vdst, zero_u8v, vdst_mask);
#else
#define GET_VDST16\
vdst = vec_vsx_ld(0,dst);\
vdst_16 = (vec_s16)vec_mergeh(vdst, zero_u8v);
#endif
#define ADD(a)\
GET_VDST16;\
vdst_16 = vec_adds(a, vdst_16);\ vdst_16 = vec_adds(a, vdst_16);\
t = vec_packsu(vdst_16, vdst_16);\ t = vec_packsu(vdst_16, vdst_16);\
vec_ste((vec_u32)t, 0, (unsigned int *)dst);\ vec_ste((vec_u32)t, 0, (unsigned int *)dst);\

View File

@ -59,17 +59,30 @@ static const vec_s8 h_subpel_filters_outer[3] =
vec_s8 filter_outerh = h_subpel_filters_outer[(i)>>1]; \ vec_s8 filter_outerh = h_subpel_filters_outer[(i)>>1]; \
vec_s8 filter_outerl = vec_sld(filter_outerh, filter_outerh, 2) vec_s8 filter_outerl = vec_sld(filter_outerh, filter_outerh, 2)
#if HAVE_BIGENDIAN
#define GET_PIXHL(offset) \
a = vec_ld((offset)-is6tap-1, src); \
b = vec_ld((offset)-is6tap-1+15, src); \
pixh = vec_perm(a, b, permh##offset); \
pixl = vec_perm(a, b, perml##offset)
#define GET_OUTER(offset) outer = vec_perm(a, b, perm_6tap##offset)
#else
#define GET_PIXHL(offset) \
a = vec_vsx_ld((offset)-is6tap-1, src); \
pixh = vec_perm(a, a, perm_inner); \
pixl = vec_perm(a, a, vec_add(perm_inner, vec_splat_u8(4)))
#define GET_OUTER(offset) outer = vec_perm(a, a, perm_outer)
#endif
#define FILTER_H(dstv, off) \ #define FILTER_H(dstv, off) \
a = vec_ld((off)-is6tap-1, src); \ GET_PIXHL(off); \
b = vec_ld((off)-is6tap-1+15, src); \
\
pixh = vec_perm(a, b, permh##off); \
pixl = vec_perm(a, b, perml##off); \
filth = vec_msum(filter_inner, pixh, c64); \ filth = vec_msum(filter_inner, pixh, c64); \
filtl = vec_msum(filter_inner, pixl, c64); \ filtl = vec_msum(filter_inner, pixl, c64); \
\ \
if (is6tap) { \ if (is6tap) { \
outer = vec_perm(a, b, perm_6tap##off); \ GET_OUTER(off); \
filth = vec_msum(filter_outerh, outer, filth); \ filth = vec_msum(filter_outerh, outer, filth); \
filtl = vec_msum(filter_outerl, outer, filtl); \ filtl = vec_msum(filter_outerl, outer, filtl); \
} \ } \
@ -84,9 +97,12 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
int h, int mx, int w, int is6tap) int h, int mx, int w, int is6tap)
{ {
LOAD_H_SUBPEL_FILTER(mx-1); LOAD_H_SUBPEL_FILTER(mx-1);
vec_u8 align_vec0, align_vec8, permh0, permh8, filt; #if HAVE_BIGENDIAN
vec_u8 align_vec0, align_vec8, permh0, permh8;
vec_u8 perm_6tap0, perm_6tap8, perml0, perml8; vec_u8 perm_6tap0, perm_6tap8, perml0, perml8;
vec_u8 a, b, pixh, pixl, outer; vec_u8 b;
#endif
vec_u8 filt, a, pixh, pixl, outer;
vec_s16 f16h, f16l; vec_s16 f16h, f16l;
vec_s32 filth, filtl; vec_s32 filth, filtl;
@ -97,6 +113,7 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6)); vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));
vec_u16 c7 = vec_splat_u16(7); vec_u16 c7 = vec_splat_u16(7);
#if HAVE_BIGENDIAN
align_vec0 = vec_lvsl( -is6tap-1, src); align_vec0 = vec_lvsl( -is6tap-1, src);
align_vec8 = vec_lvsl(8-is6tap-1, src); align_vec8 = vec_lvsl(8-is6tap-1, src);
@ -107,6 +124,7 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
perml8 = vec_perm(align_vec8, align_vec8, perm_inner); perml8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer); perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer);
perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer); perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer);
#endif
while (h --> 0) { while (h --> 0) {
FILTER_H(f16h, 0); FILTER_H(f16h, 0);
@ -164,6 +182,12 @@ static const vec_u8 v_subpel_filters[7] =
dstv = vec_adds(dstv, c64); \ dstv = vec_adds(dstv, c64); \
dstv = vec_sra(dstv, c7) dstv = vec_sra(dstv, c7)
#if HAVE_BIGENDIAN
#define LOAD_HL(off, s, perm) load_with_perm_vec(off, s, perm)
#else
#define LOAD_HL(off, s, perm) vec_mergeh(vec_vsx_ld(off,s), vec_vsx_ld(off+8,s))
#endif
static av_always_inline static av_always_inline
void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride, void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
uint8_t *src, ptrdiff_t src_stride, uint8_t *src, ptrdiff_t src_stride,
@ -175,6 +199,7 @@ void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
vec_s16 c64 = vec_sl(vec_splat_s16(1), vec_splat_u16(6)); vec_s16 c64 = vec_sl(vec_splat_s16(1), vec_splat_u16(6));
vec_u16 c7 = vec_splat_u16(7); vec_u16 c7 = vec_splat_u16(7);
#if HAVE_BIGENDIAN
// we want pixels 0-7 to be in the even positions and 8-15 in the odd, // we want pixels 0-7 to be in the even positions and 8-15 in the odd,
// so combine this permute with the alignment permute vector // so combine this permute with the alignment permute vector
align_vech = vec_lvsl(0, src); align_vech = vec_lvsl(0, src);
@ -183,22 +208,23 @@ void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
perm_vec = vec_mergeh(align_vech, align_vecl); perm_vec = vec_mergeh(align_vech, align_vecl);
else else
perm_vec = vec_mergeh(align_vech, align_vech); perm_vec = vec_mergeh(align_vech, align_vech);
#endif
if (is6tap) if (is6tap)
s0 = load_with_perm_vec(-2*src_stride, src, perm_vec); s0 = LOAD_HL(-2*src_stride, src, perm_vec);
s1 = load_with_perm_vec(-1*src_stride, src, perm_vec); s1 = LOAD_HL(-1*src_stride, src, perm_vec);
s2 = load_with_perm_vec( 0*src_stride, src, perm_vec); s2 = LOAD_HL( 0*src_stride, src, perm_vec);
s3 = load_with_perm_vec( 1*src_stride, src, perm_vec); s3 = LOAD_HL( 1*src_stride, src, perm_vec);
if (is6tap) if (is6tap)
s4 = load_with_perm_vec( 2*src_stride, src, perm_vec); s4 = LOAD_HL( 2*src_stride, src, perm_vec);
src += (2+is6tap)*src_stride; src += (2+is6tap)*src_stride;
while (h --> 0) { while (h --> 0) {
if (is6tap) if (is6tap)
s5 = load_with_perm_vec(0, src, perm_vec); s5 = LOAD_HL(0, src, perm_vec);
else else
s4 = load_with_perm_vec(0, src, perm_vec); s4 = LOAD_HL(0, src, perm_vec);
FILTER_V(f16h, vec_mule); FILTER_V(f16h, vec_mule);
@ -272,39 +298,25 @@ EPEL_HV(4, 4,4)
static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t dstride, uint8_t *src, ptrdiff_t sstride, int h, int mx, int my) static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t dstride, uint8_t *src, ptrdiff_t sstride, int h, int mx, int my)
{ {
register vector unsigned char pixelsv1, pixelsv2; register vector unsigned char perm;
register vector unsigned char pixelsv1B, pixelsv2B;
register vector unsigned char pixelsv1C, pixelsv2C;
register vector unsigned char pixelsv1D, pixelsv2D;
register vector unsigned char perm = vec_lvsl(0, src);
int i; int i;
register ptrdiff_t dstride2 = dstride << 1, sstride2 = sstride << 1; register ptrdiff_t dstride2 = dstride << 1, sstride2 = sstride << 1;
register ptrdiff_t dstride3 = dstride2 + dstride, sstride3 = sstride + sstride2; register ptrdiff_t dstride3 = dstride2 + dstride, sstride3 = sstride + sstride2;
register ptrdiff_t dstride4 = dstride << 2, sstride4 = sstride << 2; register ptrdiff_t dstride4 = dstride << 2, sstride4 = sstride << 2;
#if HAVE_BIGENDIAN
perm = vec_lvsl(0, src);
#endif
// hand-unrolling the loop by 4 gains about 15% // hand-unrolling the loop by 4 gains about 15%
// mininum execution time goes from 74 to 60 cycles // mininum execution time goes from 74 to 60 cycles
// it's faster than -funroll-loops, but using // it's faster than -funroll-loops, but using
// -funroll-loops w/ this is bad - 74 cycles again. // -funroll-loops w/ this is bad - 74 cycles again.
// all this is on a 7450, tuning for the 7450 // all this is on a 7450, tuning for the 7450
for (i = 0; i < h; i += 4) { for (i = 0; i < h; i += 4) {
pixelsv1 = vec_ld( 0, src); vec_st(load_with_perm_vec(0, src, perm), 0, dst);
pixelsv2 = vec_ld(15, src); vec_st(load_with_perm_vec(sstride, src, perm), dstride, dst);
pixelsv1B = vec_ld(sstride, src); vec_st(load_with_perm_vec(sstride2, src, perm), dstride2, dst);
pixelsv2B = vec_ld(15 + sstride, src); vec_st(load_with_perm_vec(sstride3, src, perm), dstride3, dst);
pixelsv1C = vec_ld(sstride2, src);
pixelsv2C = vec_ld(15 + sstride2, src);
pixelsv1D = vec_ld(sstride3, src);
pixelsv2D = vec_ld(15 + sstride3, src);
vec_st(vec_perm(pixelsv1, pixelsv2, perm),
0, (unsigned char*)dst);
vec_st(vec_perm(pixelsv1B, pixelsv2B, perm),
dstride, (unsigned char*)dst);
vec_st(vec_perm(pixelsv1C, pixelsv2C, perm),
dstride2, (unsigned char*)dst);
vec_st(vec_perm(pixelsv1D, pixelsv2D, perm),
dstride3, (unsigned char*)dst);
src += sstride4; src += sstride4;
dst += dstride4; dst += dstride4;
} }

View File

@ -120,12 +120,13 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
int filled = 0; int filled = 0;
int orig_height; int orig_height;
if(!refdata) if (refdata) {
refdata= dst; /* copy prev frame */
for (i = 0; i < height; i++)
/* copy prev frame */ memcpy(dst + (i * stride), refdata + (i * stride), width);
for(i = 0; i < height; i++) } else {
memcpy(dst + (i * stride), refdata + (i * stride), width); refdata = dst;
}
orig_height = height; orig_height = height;
height--; height--;

View File

@ -66,6 +66,9 @@
#include "compat/os2threads.h" #include "compat/os2threads.h"
#endif #endif
#include "libavutil/ffversion.h"
const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS #if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
static int default_lockmgr_cb(void **arg, enum AVLockOp op) static int default_lockmgr_cb(void **arg, enum AVLockOp op)
{ {

View File

@ -215,6 +215,8 @@ static void restore_median(uint8_t *src, int step, int stride,
slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_height = ((((slice + 1) * height) / slices) & cmask) -
slice_start; slice_start;
if (!slice_height)
continue;
bsrc = src + slice_start * stride; bsrc = src + slice_start * stride;
// first line - left neighbour prediction // first line - left neighbour prediction
@ -270,6 +272,8 @@ static void restore_median_il(uint8_t *src, int step, int stride,
slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_height = ((((slice + 1) * height) / slices) & cmask) -
slice_start; slice_start;
slice_height >>= 1; slice_height >>= 1;
if (!slice_height)
continue;
bsrc = src + slice_start * stride; bsrc = src + slice_start * stride;

View File

@ -339,6 +339,9 @@ static int vmd_decode(VmdVideoContext *s, AVFrame *frame)
ofs += slen; ofs += slen;
bytestream2_skip(&gb, len); bytestream2_skip(&gb, len);
} else { } else {
if (ofs + len > frame_width ||
bytestream2_get_bytes_left(&gb) < len)
return AVERROR_INVALIDDATA;
bytestream2_get_buffer(&gb, &dp[ofs], len); bytestream2_get_buffer(&gb, &dp[ofs], len);
ofs += len; ofs += len;
} }

View File

@ -176,19 +176,25 @@ int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
s->top_border = av_mallocz((s->mb_width + 1) * sizeof(*s->top_border)); s->top_border = av_mallocz((s->mb_width + 1) * sizeof(*s->top_border));
s->thread_data = av_mallocz(MAX_THREADS * sizeof(VP8ThreadData)); s->thread_data = av_mallocz(MAX_THREADS * sizeof(VP8ThreadData));
if (!s->macroblocks_base || !s->top_nnz || !s->top_border ||
!s->thread_data || (!s->intra4x4_pred_mode_top && !s->mb_layout)) {
free_buffers(s);
return AVERROR(ENOMEM);
}
for (i = 0; i < MAX_THREADS; i++) { for (i = 0; i < MAX_THREADS; i++) {
s->thread_data[i].filter_strength = s->thread_data[i].filter_strength =
av_mallocz(s->mb_width * sizeof(*s->thread_data[0].filter_strength)); av_mallocz(s->mb_width * sizeof(*s->thread_data[0].filter_strength));
if (!s->thread_data[i].filter_strength) {
free_buffers(s);
return AVERROR(ENOMEM);
}
#if HAVE_THREADS #if HAVE_THREADS
pthread_mutex_init(&s->thread_data[i].lock, NULL); pthread_mutex_init(&s->thread_data[i].lock, NULL);
pthread_cond_init(&s->thread_data[i].cond, NULL); pthread_cond_init(&s->thread_data[i].cond, NULL);
#endif #endif
} }
if (!s->macroblocks_base || !s->top_nnz || !s->top_border ||
(!s->intra4x4_pred_mode_top && !s->mb_layout))
return AVERROR(ENOMEM);
s->macroblocks = s->macroblocks_base + 1; s->macroblocks = s->macroblocks_base + 1;
return 0; return 0;

View File

@ -77,6 +77,8 @@ static int parse(AVCodecParserContext *ctx,
idx += a; \ idx += a; \
if (sz > size) { \ if (sz > size) { \
s->n_frames = 0; \ s->n_frames = 0; \
*out_size = 0; \
*out_data = data; \
av_log(avctx, AV_LOG_ERROR, \ av_log(avctx, AV_LOG_ERROR, \
"Superframe packet size too big: %u > %d\n", \ "Superframe packet size too big: %u > %d\n", \
sz, size); \ sz, size); \

View File

@ -26,12 +26,6 @@ SECTION_TEXT
; int ff_scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, ; int ff_scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3,
; int order, int mul) ; int order, int mul)
cglobal scalarproduct_and_madd_int16, 4,4,8, v1, v2, v3, order, mul cglobal scalarproduct_and_madd_int16, 4,4,8, v1, v2, v3, order, mul
%if mmsize == 16
test orderq, 8
jnz scalarproduct_and_madd_int16_fallback
%else
scalarproduct_and_madd_int16_fallback
%endif
shl orderq, 1 shl orderq, 1
movd m7, mulm movd m7, mulm
%if mmsize == 16 %if mmsize == 16
@ -123,8 +117,6 @@ align 16
; int order, int mul) ; int order, int mul)
INIT_XMM ssse3 INIT_XMM ssse3
cglobal scalarproduct_and_madd_int16, 4,5,10, v1, v2, v3, order, mul cglobal scalarproduct_and_madd_int16, 4,5,10, v1, v2, v3, order, mul
test orderq, 8
jnz scalarproduct_and_madd_int16_fallback
shl orderq, 1 shl orderq, 1
movd m7, mulm movd m7, mulm
pshuflw m7, m7, 0 pshuflw m7, m7, 0

View File

@ -31,17 +31,41 @@ int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2,
const int16_t *v3, const int16_t *v3,
int order, int mul); int order, int mul);
#if HAVE_YASM
static int32_t scalarproduct_and_madd_int16_sse2(int16_t *v1, const int16_t *v2,
const int16_t *v3,
int order, int mul)
{
if (order & 8)
return ff_scalarproduct_and_madd_int16_mmxext(v1, v2, v3, order, mul);
else
return ff_scalarproduct_and_madd_int16_sse2(v1, v2, v3, order, mul);
}
static int32_t scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2,
const int16_t *v3,
int order, int mul)
{
if (order & 8)
return ff_scalarproduct_and_madd_int16_mmxext(v1, v2, v3, order, mul);
else
return ff_scalarproduct_and_madd_int16_ssse3(v1, v2, v3, order, mul);
}
#endif
av_cold void ff_llauddsp_init_x86(LLAudDSPContext *c) av_cold void ff_llauddsp_init_x86(LLAudDSPContext *c)
{ {
#if HAVE_YASM
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_MMXEXT(cpu_flags)) if (EXTERNAL_MMXEXT(cpu_flags))
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmxext; c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmxext;
if (EXTERNAL_SSE2(cpu_flags)) if (EXTERNAL_SSE2(cpu_flags))
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_sse2;
if (EXTERNAL_SSSE3(cpu_flags) && if (EXTERNAL_SSSE3(cpu_flags) &&
!(cpu_flags & (AV_CPU_FLAG_SSE42 | AV_CPU_FLAG_3DNOW))) // cachesplit !(cpu_flags & (AV_CPU_FLAG_SSE42 | AV_CPU_FLAG_3DNOW))) // cachesplit
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_ssse3;
#endif
} }

View File

@ -24,6 +24,8 @@
* X-Face common data and utilities definition. * X-Face common data and utilities definition.
*/ */
#include "libavutil/avassert.h"
#include "xface.h" #include "xface.h"
void ff_big_add(BigInt *b, uint8_t a) void ff_big_add(BigInt *b, uint8_t a)
@ -43,6 +45,7 @@ void ff_big_add(BigInt *b, uint8_t a)
c >>= XFACE_BITSPERWORD; c >>= XFACE_BITSPERWORD;
} }
if (i == b->nb_words && c) { if (i == b->nb_words && c) {
av_assert0(b->nb_words < XFACE_MAX_WORDS);
b->nb_words++; b->nb_words++;
*w = c & XFACE_WORDMASK; *w = c & XFACE_WORDMASK;
} }
@ -98,6 +101,7 @@ void ff_big_mul(BigInt *b, uint8_t a)
return; return;
if (a == 0) { if (a == 0) {
/* treat this as a == WORDCARRY and just shift everything left a WORD */ /* treat this as a == WORDCARRY and just shift everything left a WORD */
av_assert0(b->nb_words < XFACE_MAX_WORDS);
i = b->nb_words++; i = b->nb_words++;
w = b->words + i; w = b->words + i;
while (i--) { while (i--) {
@ -116,6 +120,7 @@ void ff_big_mul(BigInt *b, uint8_t a)
c >>= XFACE_BITSPERWORD; c >>= XFACE_BITSPERWORD;
} }
if (c) { if (c) {
av_assert0(b->nb_words < XFACE_MAX_WORDS);
b->nb_words++; b->nb_words++;
*w = c & XFACE_WORDMASK; *w = c & XFACE_WORDMASK;
} }

View File

@ -41,17 +41,17 @@
/* /*
* Image is encoded as a big integer, using characters from '~' to * Image is encoded as a big integer, using characters from '~' to
* '!', for a total of 94 symbols. In order to express * '!', for a total of 94 symbols. In order to express
* 48x48*2=8*XFACE_MAX_WORDS=4608 * 48x48 pixels with the worst case encoding 666 symbols should
* bits, we need a total of 704 digits, as given by: * be sufficient.
* ceil(lg_94(2^4608)) = 704
*/ */
#define XFACE_MAX_DIGITS 704 #define XFACE_MAX_DIGITS 666
#define XFACE_BITSPERWORD 8 #define XFACE_BITSPERWORD 8
#define XFACE_WORDCARRY (1 << XFACE_BITSPERWORD) #define XFACE_WORDCARRY (1 << XFACE_BITSPERWORD)
#define XFACE_WORDMASK (XFACE_WORDCARRY - 1) #define XFACE_WORDMASK (XFACE_WORDCARRY - 1)
#define XFACE_MAX_WORDS ((XFACE_PIXELS * 2 + XFACE_BITSPERWORD - 1) / XFACE_BITSPERWORD) // This must be larger or equal to log256(94^XFACE_MAX_DIGITS)
#define XFACE_MAX_WORDS 546
/* Portable, very large unsigned integer arithmetic is needed. /* Portable, very large unsigned integer arithmetic is needed.
* Implementation uses arrays of WORDs. */ * Implementation uses arrays of WORDs. */

View File

@ -23,6 +23,9 @@
#include "avdevice.h" #include "avdevice.h"
#include "config.h" #include "config.h"
#include "libavutil/ffversion.h"
const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
#define E AV_OPT_FLAG_ENCODING_PARAM #define E AV_OPT_FLAG_ENCODING_PARAM
#define D AV_OPT_FLAG_DECODING_PARAM #define D AV_OPT_FLAG_DECODING_PARAM
#define A AV_OPT_FLAG_AUDIO_PARAM #define A AV_OPT_FLAG_AUDIO_PARAM
@ -131,9 +134,9 @@ int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToD
int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type, int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type,
void *data, size_t data_size) void *data, size_t data_size)
{ {
if (!s->control_message_cb) if (!av_format_get_control_message_cb(s))
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
return s->control_message_cb(s, type, data, data_size); return av_format_get_control_message_cb(s)(s, type, data, data_size);
} }
int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s,

View File

@ -350,7 +350,7 @@ static int iec61883_read_header(AVFormatContext *context)
if (!dv->max_packets) if (!dv->max_packets)
dv->max_packets = 100; dv->max_packets = 100;
if (dv->type == IEC61883_HDV) { if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
/* Init HDV receive */ /* Init HDV receive */
@ -444,7 +444,7 @@ static int iec61883_close(AVFormatContext *context)
pthread_mutex_destroy(&dv->mutex); pthread_mutex_destroy(&dv->mutex);
#endif #endif
if (dv->type == IEC61883_HDV) { if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
iec61883_mpeg2_recv_stop(dv->iec61883_mpeg2); iec61883_mpeg2_recv_stop(dv->iec61883_mpeg2);
iec61883_mpeg2_close(dv->iec61883_mpeg2); iec61883_mpeg2_close(dv->iec61883_mpeg2);
avpriv_mpegts_parse_close(dv->mpeg_demux); avpriv_mpegts_parse_close(dv->mpeg_demux);

View File

@ -496,6 +496,8 @@ static av_cold int init(AVFilterContext *ctx)
snprintf(name, sizeof(name), "input%d", i); snprintf(name, sizeof(name), "input%d", i);
pad.type = AVMEDIA_TYPE_AUDIO; pad.type = AVMEDIA_TYPE_AUDIO;
pad.name = av_strdup(name); pad.name = av_strdup(name);
if (!pad.name)
return AVERROR(ENOMEM);
pad.filter_frame = filter_frame; pad.filter_frame = filter_frame;
ff_insert_inpad(ctx, i, &pad); ff_insert_inpad(ctx, i, &pad);

View File

@ -214,6 +214,8 @@ static av_cold int join_init(AVFilterContext *ctx)
snprintf(name, sizeof(name), "input%d", i); snprintf(name, sizeof(name), "input%d", i);
pad.type = AVMEDIA_TYPE_AUDIO; pad.type = AVMEDIA_TYPE_AUDIO;
pad.name = av_strdup(name); pad.name = av_strdup(name);
if (!pad.name)
return AVERROR(ENOMEM);
pad.filter_frame = filter_frame; pad.filter_frame = filter_frame;
pad.needs_fifo = 1; pad.needs_fifo = 1;

View File

@ -37,6 +37,9 @@
#include "formats.h" #include "formats.h"
#include "internal.h" #include "internal.h"
#include "libavutil/ffversion.h"
const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame); static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame);
void ff_tlog_ref(void *ctx, AVFrame *ref, int end) void ff_tlog_ref(void *ctx, AVFrame *ref, int end)

View File

@ -52,6 +52,8 @@ static av_cold int split_init(AVFilterContext *ctx)
snprintf(name, sizeof(name), "output%d", i); snprintf(name, sizeof(name), "output%d", i);
pad.type = ctx->filter->inputs[0].type; pad.type = ctx->filter->inputs[0].type;
pad.name = av_strdup(name); pad.name = av_strdup(name);
if (!pad.name)
return AVERROR(ENOMEM);
ff_insert_outpad(ctx, i, &pad); ff_insert_outpad(ctx, i, &pad);
} }

View File

@ -289,6 +289,8 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
snprintf(name, sizeof(name), "out%d", i); snprintf(name, sizeof(name), "out%d", i);
pad.type = movie->st[i].st->codec->codec_type; pad.type = movie->st[i].st->codec->codec_type;
pad.name = av_strdup(name); pad.name = av_strdup(name);
if (!pad.name)
return AVERROR(ENOMEM);
pad.config_props = movie_config_output_props; pad.config_props = movie_config_output_props;
pad.request_frame = movie_request_frame; pad.request_frame = movie_request_frame;
ff_insert_outpad(ctx, i, &pad); ff_insert_outpad(ctx, i, &pad);

View File

@ -534,7 +534,7 @@ static int config_input(AVFilterLink *inlink)
/* each slice will need to (pre & re)process the top and bottom block of /* each slice will need to (pre & re)process the top and bottom block of
* the previous one in in addition to its processing area. This is because * the previous one in in addition to its processing area. This is because
* each pixel is averaged by all the surrounding blocks */ * each pixel is averaged by all the surrounding blocks */
slice_h = (int)ceilf(s->pr_height / s->nb_threads) + (s->bsize - 1) * 2; slice_h = (int)ceilf(s->pr_height / (float)s->nb_threads) + (s->bsize - 1) * 2;
for (i = 0; i < s->nb_threads; i++) { for (i = 0; i < s->nb_threads; i++) {
s->slices[i] = av_malloc_array(linesize, slice_h * sizeof(*s->slices[i])); s->slices[i] = av_malloc_array(linesize, slice_h * sizeof(*s->slices[i]));
if (!s->slices[i]) if (!s->slices[i])

View File

@ -82,6 +82,7 @@ static int config_output(AVFilterLink *outlink)
int width = ctx->inputs[LEFT]->w; int width = ctx->inputs[LEFT]->w;
int height = ctx->inputs[LEFT]->h; int height = ctx->inputs[LEFT]->h;
AVRational time_base = ctx->inputs[LEFT]->time_base; AVRational time_base = ctx->inputs[LEFT]->time_base;
AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
// check size and fps match on the other input // check size and fps match on the other input
if (width != ctx->inputs[RIGHT]->w || if (width != ctx->inputs[RIGHT]->w ||
@ -93,11 +94,18 @@ static int config_output(AVFilterLink *outlink)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) { } else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Left and right framerates differ (%d/%d vs %d/%d).\n", "Left and right time bases differ (%d/%d vs %d/%d).\n",
time_base.num, time_base.den, time_base.num, time_base.den,
ctx->inputs[RIGHT]->time_base.num, ctx->inputs[RIGHT]->time_base.num,
ctx->inputs[RIGHT]->time_base.den); ctx->inputs[RIGHT]->time_base.den);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
av_log(ctx, AV_LOG_ERROR,
"Left and right framerates differ (%d/%d vs %d/%d).\n",
frame_rate.num, frame_rate.den,
ctx->inputs[RIGHT]->frame_rate.num,
ctx->inputs[RIGHT]->frame_rate.den);
return AVERROR_INVALIDDATA;
} }
s->pix_desc = av_pix_fmt_desc_get(outlink->format); s->pix_desc = av_pix_fmt_desc_get(outlink->format);
@ -108,6 +116,8 @@ static int config_output(AVFilterLink *outlink)
switch (s->format) { switch (s->format) {
case AV_STEREO3D_FRAMESEQUENCE: case AV_STEREO3D_FRAMESEQUENCE:
time_base.den *= 2; time_base.den *= 2;
frame_rate.num *= 2;
s->double_pts = AV_NOPTS_VALUE; s->double_pts = AV_NOPTS_VALUE;
break; break;
case AV_STEREO3D_COLUMNS: case AV_STEREO3D_COLUMNS:
@ -126,6 +136,7 @@ static int config_output(AVFilterLink *outlink)
outlink->w = width; outlink->w = width;
outlink->h = height; outlink->h = height;
outlink->time_base = time_base; outlink->time_base = time_base;
outlink->frame_rate= frame_rate;
return 0; return 0;
} }

View File

@ -220,6 +220,19 @@ static int config_props(AVFilterLink *inlink)
#define NB_PLANES 4 #define NB_PLANES 4
static inline int mirror(int x, int w)
{
if (!w)
return 0;
while ((unsigned)x > (unsigned)w) {
x = -x;
if (x < 0)
x += 2 * w;
}
return x;
}
static void blur(uint8_t *dst, const int dst_linesize, static void blur(uint8_t *dst, const int dst_linesize,
const uint8_t *src, const int src_linesize, const uint8_t *src, const int src_linesize,
const int w, const int h, FilterParam *fp) const int w, const int h, FilterParam *fp)
@ -253,8 +266,7 @@ static void blur(uint8_t *dst, const int dst_linesize,
for (dy = 0; dy < radius*2 + 1; dy++) { for (dy = 0; dy < radius*2 + 1; dy++) {
int dx; int dx;
int iy = y+dy - radius; int iy = y+dy - radius;
if (iy < 0) iy = -iy; iy = mirror(iy, h-1);
else if (iy >= h) iy = h+h-iy-1;
for (dx = 0; dx < radius*2 + 1; dx++) { for (dx = 0; dx < radius*2 + 1; dx++) {
const int ix = x+dx - radius; const int ix = x+dx - radius;
@ -265,13 +277,11 @@ static void blur(uint8_t *dst, const int dst_linesize,
for (dy = 0; dy < radius*2+1; dy++) { for (dy = 0; dy < radius*2+1; dy++) {
int dx; int dx;
int iy = y+dy - radius; int iy = y+dy - radius;
if (iy < 0) iy = -iy; iy = mirror(iy, h-1);
else if (iy >= h) iy = h+h-iy-1;
for (dx = 0; dx < radius*2 + 1; dx++) { for (dx = 0; dx < radius*2 + 1; dx++) {
int ix = x+dx - radius; int ix = x+dx - radius;
if (ix < 0) ix = -ix; ix = mirror(ix, w-1);
else if (ix >= w) ix = w+w-ix-1;
UPDATE_FACTOR; UPDATE_FACTOR;
} }
} }

View File

@ -377,7 +377,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \
rtpenc_h264.o \ rtpenc_h264.o \
rtpenc_vp8.o \ rtpenc_vp8.o \
rtpenc_xiph.o \ rtpenc_xiph.o \
avc.o avc.o hevc.o
OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o rtspdec.o httpauth.o \ OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o rtspdec.o httpauth.o \
urldecode.o urldecode.o
OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o \ OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o \
@ -519,6 +519,9 @@ OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o
OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
# libavdevice dependencies
OBJS-$(CONFIG_IEC61883_INDEV) += dv.o
# Windows resource file # Windows resource file
SLIBOBJS-$(HAVE_GNU_WINDRES) += avformatres.o SLIBOBJS-$(HAVE_GNU_WINDRES) += avformatres.o

View File

@ -404,7 +404,7 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0; return 0;
default: default:
{ {
char tag_buf[5]; char tag_buf[32];
av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag); av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag);
avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32, tag_buf, tag, len); avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32, tag_buf, tag, len);

View File

@ -223,6 +223,9 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
return offset1; return offset1;
offset += offset1; offset += offset1;
} }
if (offset < 0)
return AVERROR(EINVAL);
offset1 = offset - pos; offset1 = offset - pos;
if (!s->must_flush && (!s->direct || !s->seek) && if (!s->must_flush && (!s->direct || !s->seek) &&
offset1 >= 0 && offset1 <= buffer_size) { offset1 >= 0 && offset1 <= buffer_size) {

View File

@ -127,6 +127,8 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
height = AV_RB16(&cdxl->header[16]); height = AV_RB16(&cdxl->header[16]);
palette_size = AV_RB16(&cdxl->header[20]); palette_size = AV_RB16(&cdxl->header[20]);
audio_size = AV_RB16(&cdxl->header[22]); audio_size = AV_RB16(&cdxl->header[22]);
if (FFALIGN(width, 16) * (uint64_t)height * cdxl->header[19] > INT_MAX)
return AVERROR_INVALIDDATA;
image_size = FFALIGN(width, 16) * height * cdxl->header[19] / 8; image_size = FFALIGN(width, 16) * height * cdxl->header[19] / 8;
video_size = palette_size + image_size; video_size = palette_size + image_size;

View File

@ -122,7 +122,7 @@ static int crypto_open2(URLContext *h, const char *uri, int flags, AVDictionary
c->key, c->keylen, "decryption key")) < 0) c->key, c->keylen, "decryption key")) < 0)
goto err; goto err;
if ((ret = set_aes_arg(c, &c->decrypt_iv, &c->decrypt_ivlen, if ((ret = set_aes_arg(c, &c->decrypt_iv, &c->decrypt_ivlen,
c->key, c->keylen, "decryption IV")) < 0) c->iv, c->ivlen, "decryption IV")) < 0)
goto err; goto err;
} }
@ -132,7 +132,7 @@ static int crypto_open2(URLContext *h, const char *uri, int flags, AVDictionary
if (ret < 0) if (ret < 0)
goto err; goto err;
if ((ret = set_aes_arg(c, &c->encrypt_iv, &c->encrypt_ivlen, if ((ret = set_aes_arg(c, &c->encrypt_iv, &c->encrypt_ivlen,
c->key, c->keylen, "encryption IV")) < 0) c->iv, c->ivlen, "encryption IV")) < 0)
goto err; goto err;
} }

View File

@ -390,7 +390,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
FLVContext *flv = s->priv_data; FLVContext *flv = s->priv_data;
AVIOContext *ioc; AVIOContext *ioc;
AMFDataType amf_type; AMFDataType amf_type;
char str_val[256]; char str_val[1024];
double num_val; double num_val;
num_val = 0; num_val = 0;
@ -459,11 +459,11 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
} }
if (key) { if (key) {
acodec = astream ? astream->codec : NULL;
vcodec = vstream ? vstream->codec : NULL;
// stream info doesn't live any deeper than the first object // stream info doesn't live any deeper than the first object
if (depth == 1) { if (depth == 1) {
acodec = astream ? astream->codec : NULL;
vcodec = vstream ? vstream->codec : NULL;
if (amf_type == AMF_DATA_TYPE_NUMBER || if (amf_type == AMF_DATA_TYPE_NUMBER ||
amf_type == AMF_DATA_TYPE_BOOL) { amf_type == AMF_DATA_TYPE_BOOL) {
if (!strcmp(key, "duration")) if (!strcmp(key, "duration"))
@ -558,13 +558,13 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos)
type = avio_r8(ioc); type = avio_r8(ioc);
if (type != AMF_DATA_TYPE_STRING || if (type != AMF_DATA_TYPE_STRING ||
amf_get_string(ioc, buffer, sizeof(buffer)) < 0) amf_get_string(ioc, buffer, sizeof(buffer)) < 0)
return -1; return 2;
if (!strcmp(buffer, "onTextData")) if (!strcmp(buffer, "onTextData"))
return 1; return 1;
if (strcmp(buffer, "onMetaData") && strcmp(buffer, "onCuePoint")) if (strcmp(buffer, "onMetaData") && strcmp(buffer, "onCuePoint"))
return -1; return 2;
// find the streams now so that amf_parse_object doesn't need to do // find the streams now so that amf_parse_object doesn't need to do
// the lookup every time it is called. // the lookup every time it is called.
@ -623,7 +623,7 @@ static int flv_read_close(AVFormatContext *s)
static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size) static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
{ {
av_free(st->codec->extradata); av_freep(&st->codec->extradata);
if (ff_get_extradata(st->codec, s->pb, size) < 0) if (ff_get_extradata(st->codec, s->pb, size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
return 0; return 0;
@ -822,7 +822,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
stream_type=FLV_STREAM_TYPE_DATA; stream_type=FLV_STREAM_TYPE_DATA;
if (size > 13 + 1 + 4 && dts == 0) { // Header-type metadata stuff if (size > 13 + 1 + 4 && dts == 0) { // Header-type metadata stuff
meta_pos = avio_tell(s->pb); meta_pos = avio_tell(s->pb);
if (flv_read_metabody(s, next) == 0) { if (flv_read_metabody(s, next) <= 0) {
goto skip; goto skip;
} }
avio_seek(s->pb, meta_pos, SEEK_SET); avio_seek(s->pb, meta_pos, SEEK_SET);

View File

@ -145,15 +145,15 @@ static void hds_free(AVFormatContext *s)
if (os->ctx && os->ctx_inited) if (os->ctx && os->ctx_inited)
av_write_trailer(os->ctx); av_write_trailer(os->ctx);
if (os->ctx && os->ctx->pb) if (os->ctx && os->ctx->pb)
av_free(os->ctx->pb); av_freep(&os->ctx->pb);
if (os->ctx) if (os->ctx)
avformat_free_context(os->ctx); avformat_free_context(os->ctx);
av_free(os->metadata); av_freep(&os->metadata);
for (j = 0; j < os->nb_extra_packets; j++) for (j = 0; j < os->nb_extra_packets; j++)
av_free(os->extra_packets[j]); av_freep(&os->extra_packets[j]);
for (j = 0; j < os->nb_fragments; j++) for (j = 0; j < os->nb_fragments; j++)
av_free(os->fragments[j]); av_freep(&os->fragments[j]);
av_free(os->fragments); av_freep(&os->fragments);
} }
av_freep(&c->streams); av_freep(&c->streams);
} }
@ -499,7 +499,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
if (remove > 0) { if (remove > 0) {
for (i = 0; i < remove; i++) { for (i = 0; i < remove; i++) {
unlink(os->fragments[i]->file); unlink(os->fragments[i]->file);
av_free(os->fragments[i]); av_freep(&os->fragments[i]);
} }
os->nb_fragments -= remove; os->nb_fragments -= remove;
memmove(os->fragments, os->fragments + remove, memmove(os->fragments, os->fragments + remove,

View File

@ -189,6 +189,7 @@ typedef struct MOVContext {
int has_looked_for_mfra; int has_looked_for_mfra;
MOVFragmentIndex** fragment_index_data; MOVFragmentIndex** fragment_index_data;
unsigned fragment_index_count; unsigned fragment_index_count;
int atom_depth;
} MOVContext; } MOVContext;
int ff_mp4_read_descr_len(AVIOContext *pb); int ff_mp4_read_descr_len(AVIOContext *pb);

View File

@ -1080,7 +1080,7 @@ static void ebml_free(EbmlSyntax *syntax, void *data)
for (j = 0; j < list->nb_elem; for (j = 0; j < list->nb_elem;
j++, ptr += syntax[i].list_elem_size) j++, ptr += syntax[i].list_elem_size)
ebml_free(syntax[i].def.n, ptr); ebml_free(syntax[i].def.n, ptr);
av_free(list->elem); av_freep(&list->elem);
} else } else
ebml_free(syntax[i].def.n, data_off); ebml_free(syntax[i].def.n, data_off);
default: default:
@ -1414,13 +1414,17 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
EbmlList *seekhead_list = &matroska->seekhead; EbmlList *seekhead_list = &matroska->seekhead;
int64_t before_pos = avio_tell(matroska->ctx->pb); int64_t before_pos = avio_tell(matroska->ctx->pb);
int i; int i;
int nb_elem;
// we should not do any seeking in the streaming case // we should not do any seeking in the streaming case
if (!matroska->ctx->pb->seekable || if (!matroska->ctx->pb->seekable ||
(matroska->ctx->flags & AVFMT_FLAG_IGNIDX)) (matroska->ctx->flags & AVFMT_FLAG_IGNIDX))
return; return;
for (i = 0; i < seekhead_list->nb_elem; i++) { // do not read entries that are added while parsing seekhead entries
nb_elem = seekhead_list->nb_elem;
for (i = 0; i < nb_elem; i++) {
MatroskaSeekhead *seekhead = seekhead_list->elem; MatroskaSeekhead *seekhead = seekhead_list->elem;
if (seekhead[i].pos <= before_pos) if (seekhead[i].pos <= before_pos)
continue; continue;
@ -1922,8 +1926,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
1000000000, track->default_duration, 30000); 1000000000, track->default_duration, 30000);
#if FF_API_R_FRAME_RATE #if FF_API_R_FRAME_RATE
if ( st->avg_frame_rate.num < st->avg_frame_rate.den * 1000L if ( st->avg_frame_rate.num < st->avg_frame_rate.den * 1000LL
&& st->avg_frame_rate.num > st->avg_frame_rate.den * 5L) && st->avg_frame_rate.num > st->avg_frame_rate.den * 5LL)
st->r_frame_rate = st->avg_frame_rate; st->r_frame_rate = st->avg_frame_rate;
#endif #endif
} }
@ -2130,7 +2134,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
{ {
if (matroska->num_packets > 0) { if (matroska->num_packets > 0) {
memcpy(pkt, matroska->packets[0], sizeof(AVPacket)); memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
av_free(matroska->packets[0]); av_freep(&matroska->packets[0]);
if (matroska->num_packets > 1) { if (matroska->num_packets > 1) {
void *newpackets; void *newpackets;
memmove(&matroska->packets[0], &matroska->packets[1], memmove(&matroska->packets[0], &matroska->packets[1],
@ -2161,7 +2165,7 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska)
int n; int n;
for (n = 0; n < matroska->num_packets; n++) { for (n = 0; n < matroska->num_packets; n++) {
av_free_packet(matroska->packets[n]); av_free_packet(matroska->packets[n]);
av_free(matroska->packets[n]); av_freep(&matroska->packets[n]);
} }
av_freep(&matroska->packets); av_freep(&matroska->packets);
matroska->num_packets = 0; matroska->num_packets = 0;
@ -2999,7 +3003,7 @@ static int matroska_read_close(AVFormatContext *s)
for (n = 0; n < matroska->tracks.nb_elem; n++) for (n = 0; n < matroska->tracks.nb_elem; n++)
if (tracks[n].type == MATROSKA_TRACK_TYPE_AUDIO) if (tracks[n].type == MATROSKA_TRACK_TYPE_AUDIO)
av_free(tracks[n].audio.buf); av_freep(&tracks[n].audio.buf);
ebml_free(matroska_cluster, &matroska->current_cluster); ebml_free(matroska_cluster, &matroska->current_cluster);
ebml_free(matroska_segment, matroska); ebml_free(matroska_segment, matroska);

View File

@ -210,7 +210,11 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
static int mov_metadata_raw(MOVContext *c, AVIOContext *pb, static int mov_metadata_raw(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key) unsigned len, const char *key)
{ {
char *value = av_malloc(len + 1); char *value;
// Check for overflow.
if (len >= INT_MAX)
return AVERROR(EINVAL);
value = av_malloc(len + 1);
if (!value) if (!value)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avio_read(pb, value, len); avio_read(pb, value, len);
@ -352,7 +356,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (!key) if (!key)
return 0; return 0;
if (atom.size < 0) if (atom.size < 0 || str_size >= INT_MAX/2)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
str_size_alloc = str_size << 1; // worst-case requirement for output string in case of utf8 coded input str_size_alloc = str_size << 1; // worst-case requirement for output string in case of utf8 coded input
@ -1150,7 +1154,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
st->codec->codec_id == AV_CODEC_ID_QDMC || st->codec->codec_id == AV_CODEC_ID_QDMC ||
st->codec->codec_id == AV_CODEC_ID_SPEEX) { st->codec->codec_id == AV_CODEC_ID_SPEEX) {
// pass all frma atom to codec, needed at least for QDMC and QDM2 // pass all frma atom to codec, needed at least for QDMC and QDM2
av_free(st->codec->extradata); av_freep(&st->codec->extradata);
if (ff_get_extradata(st->codec, pb, atom.size) < 0) if (ff_get_extradata(st->codec, pb, atom.size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} else if (atom.size > 8) { /* to read frma, esds atoms */ } else if (atom.size > 8) { /* to read frma, esds atoms */
@ -1190,7 +1194,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c, AV_LOG_WARNING, "ignoring multiple glbl\n"); av_log(c, AV_LOG_WARNING, "ignoring multiple glbl\n");
return 0; return 0;
} }
av_free(st->codec->extradata); av_freep(&st->codec->extradata);
if (ff_get_extradata(st->codec, pb, atom.size) < 0) if (ff_get_extradata(st->codec, pb, atom.size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -1215,7 +1219,7 @@ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0; return 0;
avio_seek(pb, 6, SEEK_CUR); avio_seek(pb, 6, SEEK_CUR);
av_free(st->codec->extradata); av_freep(&st->codec->extradata);
if ((ret = ff_get_extradata(st->codec, pb, atom.size - 7)) < 0) if ((ret = ff_get_extradata(st->codec, pb, atom.size - 7)) < 0)
return ret; return ret;
@ -1241,7 +1245,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
avio_skip(pb, 40); avio_skip(pb, 40);
av_free(st->codec->extradata); av_freep(&st->codec->extradata);
if (ff_get_extradata(st->codec, pb, atom.size - 40) < 0) if (ff_get_extradata(st->codec, pb, atom.size - 40) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
return 0; return 0;
@ -1550,7 +1554,7 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb, static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,
AVStream *st, MOVStreamContext *sc, AVStream *st, MOVStreamContext *sc,
int size) int64_t size)
{ {
// ttxt stsd contains display flags, justification, background // ttxt stsd contains display flags, justification, background
// color, fonts, and default styles, so fake an atom to read it // color, fonts, and default styles, so fake an atom to read it
@ -1615,10 +1619,10 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st)
static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb,
AVStream *st, MOVStreamContext *sc, AVStream *st, MOVStreamContext *sc,
int size) int64_t size)
{ {
if (st->codec->codec_tag == MKTAG('t','m','c','d')) { if (st->codec->codec_tag == MKTAG('t','m','c','d')) {
if (ff_get_extradata(st->codec, pb, size) < 0) if ((int)size != size || ff_get_extradata(st->codec, pb, size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (size > 16) { if (size > 16) {
MOVStreamContext *tmcd_ctx = st->priv_data; MOVStreamContext *tmcd_ctx = st->priv_data;
@ -3388,6 +3392,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
MOVAtom a; MOVAtom a;
int i; int i;
if (c->atom_depth > 10) {
av_log(c->fc, AV_LOG_ERROR, "Atoms too deeply nested\n");
return AVERROR_INVALIDDATA;
}
c->atom_depth ++;
if (atom.size < 0) if (atom.size < 0)
atom.size = INT64_MAX; atom.size = INT64_MAX;
while (total_size + 8 <= atom.size && !avio_feof(pb)) { while (total_size + 8 <= atom.size && !avio_feof(pb)) {
@ -3417,11 +3427,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
av_log(c->fc, AV_LOG_ERROR, "Broken file, trak/mdat not at top-level\n"); av_log(c->fc, AV_LOG_ERROR, "Broken file, trak/mdat not at top-level\n");
avio_skip(pb, -8); avio_skip(pb, -8);
c->atom_depth --;
return 0; return 0;
} }
} }
total_size += 8; total_size += 8;
if (a.size == 1) { /* 64 bit extended size */ if (a.size == 1 && total_size + 8 <= atom.size) { /* 64 bit extended size */
a.size = avio_rb64(pb) - 8; a.size = avio_rb64(pb) - 8;
total_size += 8; total_size += 8;
} }
@ -3453,13 +3464,16 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int64_t start_pos = avio_tell(pb); int64_t start_pos = avio_tell(pb);
int64_t left; int64_t left;
int err = parse(c, pb, a); int err = parse(c, pb, a);
if (err < 0) if (err < 0) {
c->atom_depth --;
return err; return err;
}
if (c->found_moov && c->found_mdat && if (c->found_moov && c->found_mdat &&
((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) || ((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) ||
start_pos + a.size == avio_size(pb))) { start_pos + a.size == avio_size(pb))) {
if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX)
c->next_root_atom = start_pos + a.size; c->next_root_atom = start_pos + a.size;
c->atom_depth --;
return 0; return 0;
} }
left = a.size - avio_tell(pb) + start_pos; left = a.size - avio_tell(pb) + start_pos;
@ -3479,6 +3493,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (total_size < atom.size && atom.size < 0x7ffff) if (total_size < atom.size && atom.size < 0x7ffff)
avio_skip(pb, atom.size - total_size); avio_skip(pb, atom.size - total_size);
c->atom_depth --;
return 0; return 0;
} }
@ -3768,35 +3783,39 @@ static void export_orphan_timecode(AVFormatContext *s)
static int read_tfra(MOVContext *mov, AVIOContext *f) static int read_tfra(MOVContext *mov, AVIOContext *f)
{ {
MOVFragmentIndex* index = NULL; MOVFragmentIndex* index = NULL;
int version, fieldlength, i, j, err; int version, fieldlength, i, j;
int64_t pos = avio_tell(f); int64_t pos = avio_tell(f);
uint32_t size = avio_rb32(f); uint32_t size = avio_rb32(f);
void *tmp;
if (avio_rb32(f) != MKBETAG('t', 'f', 'r', 'a')) { if (avio_rb32(f) != MKBETAG('t', 'f', 'r', 'a')) {
return -1; return 1;
} }
av_log(mov->fc, AV_LOG_VERBOSE, "found tfra\n"); av_log(mov->fc, AV_LOG_VERBOSE, "found tfra\n");
index = av_mallocz(sizeof(MOVFragmentIndex)); index = av_mallocz(sizeof(MOVFragmentIndex));
if (!index) { if (!index) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
mov->fragment_index_count++;
if ((err = av_reallocp(&mov->fragment_index_data, tmp = av_realloc_array(mov->fragment_index_data,
mov->fragment_index_count * mov->fragment_index_count + 1,
sizeof(MOVFragmentIndex*))) < 0) { sizeof(MOVFragmentIndex*));
if (!tmp) {
av_freep(&index); av_freep(&index);
return err; return AVERROR(ENOMEM);
} }
mov->fragment_index_data[mov->fragment_index_count - 1] = mov->fragment_index_data = tmp;
index; mov->fragment_index_data[mov->fragment_index_count++] = index;
version = avio_r8(f); version = avio_r8(f);
avio_rb24(f); avio_rb24(f);
index->track_id = avio_rb32(f); index->track_id = avio_rb32(f);
fieldlength = avio_rb32(f); fieldlength = avio_rb32(f);
index->item_count = avio_rb32(f); index->item_count = avio_rb32(f);
index->items = av_mallocz( index->items = av_mallocz_array(
index->item_count * sizeof(MOVFragmentIndexItem)); index->item_count, sizeof(MOVFragmentIndexItem));
if (!index->items) { if (!index->items) {
index->item_count = 0;
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
for (i = 0; i < index->item_count; i++) { for (i = 0; i < index->item_count; i++) {
@ -3850,11 +3869,13 @@ static int mov_read_mfra(MOVContext *c, AVIOContext *f)
av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (tag mismatch)\n"); av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (tag mismatch)\n");
goto fail; goto fail;
} }
ret = 0;
av_log(c->fc, AV_LOG_VERBOSE, "stream has mfra\n"); av_log(c->fc, AV_LOG_VERBOSE, "stream has mfra\n");
while (!read_tfra(c, f)) { do {
/* Empty */ ret = read_tfra(c, f);
} if (ret < 0)
goto fail;
} while (!ret);
ret = 0;
fail: fail:
seek_ret = avio_seek(f, original_pos, SEEK_SET); seek_ret = avio_seek(f, original_pos, SEEK_SET);
if (seek_ret < 0) { if (seek_ret < 0) {
@ -4093,7 +4114,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
#if CONFIG_DV_DEMUXER #if CONFIG_DV_DEMUXER
if (mov->dv_demux && sc->dv_audio_container) { if (mov->dv_demux && sc->dv_audio_container) {
avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos); avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos);
av_free(pkt->data); av_freep(&pkt->data);
pkt->size = 0; pkt->size = 0;
ret = avpriv_dv_get_packet(mov->dv_demux, pkt); ret = avpriv_dv_get_packet(mov->dv_demux, pkt);
if (ret < 0) if (ret < 0)

View File

@ -2499,7 +2499,8 @@ static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
} }
version = max_track_len < UINT32_MAX ? 0 : 1; version = max_track_len < UINT32_MAX ? 0 : 1;
(version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */ avio_wb32(pb, version == 1 ? 120 : 108); /* size */
ffio_wfourcc(pb, "mvhd"); ffio_wfourcc(pb, "mvhd");
avio_w8(pb, version); avio_w8(pb, version);
avio_wb24(pb, 0); /* flags */ avio_wb24(pb, 0); /* flags */

View File

@ -57,7 +57,7 @@ typedef struct {
static inline int64_t bs_get_v(const uint8_t **bs) static inline int64_t bs_get_v(const uint8_t **bs)
{ {
int64_t v = 0; uint64_t v = 0;
int br = 0; int br = 0;
int c; int c;
@ -91,7 +91,7 @@ static int mpc8_probe(AVProbeData *p)
size = bs_get_v(&bs); size = bs_get_v(&bs);
if (size < 2) if (size < 2)
return 0; return 0;
if (bs + size - 2 >= bs_end) if (size >= bs_end - bs + 2)
return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet
if (header_found) { if (header_found) {
if (size < 11 || size > 28) if (size < 11 || size > 28)
@ -108,7 +108,7 @@ static int mpc8_probe(AVProbeData *p)
static inline int64_t gb_get_v(GetBitContext *gb) static inline int64_t gb_get_v(GetBitContext *gb)
{ {
int64_t v = 0; uint64_t v = 0;
int bits = 0; int bits = 0;
while(get_bits1(gb) && bits < 64-7){ while(get_bits1(gb) && bits < 64-7){
v <<= 7; v <<= 7;
@ -223,6 +223,10 @@ static int mpc8_read_header(AVFormatContext *s)
while(!avio_feof(pb)){ while(!avio_feof(pb)){
pos = avio_tell(pb); pos = avio_tell(pb);
mpc8_get_chunk_header(pb, &tag, &size); mpc8_get_chunk_header(pb, &tag, &size);
if (size < 0) {
av_log(s, AV_LOG_ERROR, "Invalid chunk length\n");
return AVERROR_INVALIDDATA;
}
if(tag == TAG_STREAMHDR) if(tag == TAG_STREAMHDR)
break; break;
mpc8_handle_chunk(s, tag, pos, size); mpc8_handle_chunk(s, tag, pos, size);

View File

@ -70,20 +70,23 @@ static int mpegps_probe(AVProbeData *p)
int i; int i;
int sys = 0, pspack = 0, priv1 = 0, vid = 0; int sys = 0, pspack = 0, priv1 = 0, vid = 0;
int audio = 0, invalid = 0, score = 0; int audio = 0, invalid = 0, score = 0;
int endpes = 0;
for (i = 0; i < p->buf_size; i++) { for (i = 0; i < p->buf_size; i++) {
code = (code << 8) + p->buf[i]; code = (code << 8) + p->buf[i];
if ((code & 0xffffff00) == 0x100) { if ((code & 0xffffff00) == 0x100) {
int len = p->buf[i + 1] << 8 | p->buf[i + 2]; int len = p->buf[i + 1] << 8 | p->buf[i + 2];
int pes = check_pes(p->buf + i, p->buf + p->buf_size); int pes = endpes <= i && check_pes(p->buf + i, p->buf + p->buf_size);
int pack = check_pack_header(p->buf + i); int pack = check_pack_header(p->buf + i);
if (code == SYSTEM_HEADER_START_CODE) if (code == SYSTEM_HEADER_START_CODE)
sys++; sys++;
else if (code == PACK_START_CODE && pack) else if (code == PACK_START_CODE && pack)
pspack++; pspack++;
else if ((code & 0xf0) == VIDEO_ID && pes) else if ((code & 0xf0) == VIDEO_ID && pes) {
endpes = i + len;
vid++; vid++;
}
// skip pes payload to avoid start code emulation for private // skip pes payload to avoid start code emulation for private
// and audio streams // and audio streams
else if ((code & 0xe0) == AUDIO_ID && pes) {audio++; i+=len;} else if ((code & 0xe0) == AUDIO_ID && pes) {audio++; i+=len;}

View File

@ -174,7 +174,7 @@ static int nprobe(AVFormatContext *s, uint8_t *enc_header, unsigned size,
taglen = AV_RB32(&enc_header[pos + 32]); taglen = AV_RB32(&enc_header[pos + 32]);
datalen = AV_RB32(&enc_header[pos + 36]) >> 4; datalen = AV_RB32(&enc_header[pos + 36]) >> 4;
pos += 44L + taglen; pos += 44LL + taglen;
if (pos + (((uint64_t)datalen) << 4) > size) if (pos + (((uint64_t)datalen) << 4) > size)
return -1; return -1;

View File

@ -159,9 +159,9 @@ void ff_freeaddrinfo(struct addrinfo *res)
} }
#endif /* HAVE_WINSOCK2_H */ #endif /* HAVE_WINSOCK2_H */
av_free(res->ai_canonname); av_freep(&res->ai_canonname);
av_free(res->ai_addr); av_freep(&res->ai_addr);
av_free(res); av_freep(&res);
} }
int ff_getnameinfo(const struct sockaddr *sa, int salen, int ff_getnameinfo(const struct sockaddr *sa, int salen,

View File

@ -114,7 +114,7 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
size -= 22; size -= 22;
} }
if (cbSize > 0) { if (cbSize > 0) {
av_free(codec->extradata); av_freep(&codec->extradata);
if (ff_get_extradata(codec, pb, cbSize) < 0) if (ff_get_extradata(codec, pb, cbSize) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
size -= cbSize; size -= cbSize;

View File

@ -412,7 +412,11 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
skip: skip:
/* skip codec info */ /* skip codec info */
size = avio_tell(pb) - codec_pos; size = avio_tell(pb) - codec_pos;
avio_skip(pb, codec_data_size - size); if (codec_data_size >= size) {
avio_skip(pb, codec_data_size - size);
} else {
av_log(s, AV_LOG_WARNING, "codec_data_size %u < size %d\n", codec_data_size, size);
}
return 0; return 0;
} }

View File

@ -70,7 +70,7 @@ static int rsd_read_header(AVFormatContext *s)
codec->codec_tag = avio_rl32(pb); codec->codec_tag = avio_rl32(pb);
codec->codec_id = ff_codec_get_id(rsd_tags, codec->codec_tag); codec->codec_id = ff_codec_get_id(rsd_tags, codec->codec_tag);
if (!codec->codec_id) { if (!codec->codec_id) {
char tag_buf[5]; char tag_buf[32];
av_get_codec_tag_string(tag_buf, sizeof(tag_buf), codec->codec_tag); av_get_codec_tag_string(tag_buf, sizeof(tag_buf), codec->codec_tag);
for (i=0; i < FF_ARRAY_ELEMS(rsd_unsupported_tags); i++) { for (i=0; i < FF_ARRAY_ELEMS(rsd_unsupported_tags); i++) {

View File

@ -217,9 +217,8 @@ static void free_tracked_methods(RTMPContext *rt)
int i; int i;
for (i = 0; i < rt->nb_tracked_methods; i ++) for (i = 0; i < rt->nb_tracked_methods; i ++)
av_free(rt->tracked_methods[i].name); av_freep(&rt->tracked_methods[i].name);
av_free(rt->tracked_methods); av_freep(&rt->tracked_methods);
rt->tracked_methods = NULL;
rt->tracked_methods_size = 0; rt->tracked_methods_size = 0;
rt->nb_tracked_methods = 0; rt->nb_tracked_methods = 0;
} }
@ -2552,7 +2551,7 @@ static int inject_fake_duration_metadata(RTMPContext *rt)
// Increase the size by the injected packet // Increase the size by the injected packet
rt->flv_size += 55; rt->flv_size += 55;
// Delete the old FLV data // Delete the old FLV data
av_free(old_flv_data); av_freep(&old_flv_data);
p = rt->flv_data + 13; p = rt->flv_data + 13;
bytestream_put_byte(&p, FLV_TAG_TYPE_META); bytestream_put_byte(&p, FLV_TAG_TYPE_META);

View File

@ -83,6 +83,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
avio_close_dyn_buf(data->buf, &p); avio_close_dyn_buf(data->buf, &p);
av_free(p); av_free(p);
data->buf = NULL; data->buf = NULL;
data->endbyte_bits = 0;
} }
if (len < 4) { if (len < 4) {

View File

@ -343,7 +343,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
if (seg->list_size && seg->segment_count >= seg->list_size) { if (seg->list_size && seg->segment_count >= seg->list_size) {
entry = seg->segment_list_entries; entry = seg->segment_list_entries;
seg->segment_list_entries = seg->segment_list_entries->next; seg->segment_list_entries = seg->segment_list_entries->next;
av_free(entry->filename); av_freep(&entry->filename);
av_freep(&entry); av_freep(&entry);
} }
@ -501,10 +501,10 @@ static int open_null_ctx(AVIOContext **ctx)
return 0; return 0;
} }
static void close_null_ctx(AVIOContext *pb) static void close_null_ctxp(AVIOContext **pb)
{ {
av_free(pb->buffer); av_freep(&(*pb)->buffer);
av_free(pb); av_freep(pb);
} }
static int select_reference_stream(AVFormatContext *s) static int select_reference_stream(AVFormatContext *s)
@ -687,7 +687,7 @@ static int seg_write_header(AVFormatContext *s)
s->avoid_negative_ts = 1; s->avoid_negative_ts = 1;
if (!seg->write_header_trailer) { if (!seg->write_header_trailer) {
close_null_ctx(oc->pb); close_null_ctxp(&oc->pb);
if ((ret = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, if ((ret = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0) &s->interrupt_callback, NULL)) < 0)
goto fail; goto fail;
@ -820,7 +820,7 @@ static int seg_write_trailer(struct AVFormatContext *s)
goto fail; goto fail;
open_null_ctx(&oc->pb); open_null_ctx(&oc->pb);
ret = av_write_trailer(oc); ret = av_write_trailer(oc);
close_null_ctx(oc->pb); close_null_ctxp(&oc->pb);
} else { } else {
ret = segment_end(s, 1, 1); ret = segment_end(s, 1, 1);
} }
@ -836,7 +836,7 @@ fail:
cur = seg->segment_list_entries; cur = seg->segment_list_entries;
while (cur) { while (cur) {
next = cur->next; next = cur->next;
av_free(cur->filename); av_freep(&cur->filename);
av_free(cur); av_free(cur);
cur = next; cur = next;
} }

View File

@ -321,7 +321,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
int err; int err;
size = avio_rl32(s->pb) - 4; size = avio_rl32(s->pb) - 4;
if (!size || size + 4L > frame_size) { if (!size || size + 4LL > frame_size) {
av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }

View File

@ -184,6 +184,8 @@ static int thp_read_packet(AVFormatContext *s,
pkt->stream_index = thp->video_stream_index; pkt->stream_index = thp->video_stream_index;
} else { } else {
ret = av_get_packet(pb, pkt, thp->audiosize); ret = av_get_packet(pb, pkt, thp->audiosize);
if (ret < 0)
return ret;
if (ret != thp->audiosize) { if (ret != thp->audiosize) {
av_free_packet(pkt); av_free_packet(pkt);
return AVERROR(EIO); return AVERROR(EIO);

View File

@ -118,8 +118,10 @@ static int tta_read_header(AVFormatContext *s)
ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX); ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX);
for (i = 0; i < c->totalframes; i++) { for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_rl32(s->pb); uint32_t size = avio_rl32(s->pb);
av_add_index_entry(st, framepos, i * c->frame_size, size, 0, int r;
AVINDEX_KEYFRAME); if ((r = av_add_index_entry(st, framepos, i * c->frame_size, size, 0,
AVINDEX_KEYFRAME)) < 0)
return r;
framepos += size; framepos += size;
} }
crc = ffio_get_checksum(s->pb) ^ UINT32_MAX; crc = ffio_get_checksum(s->pb) ^ UINT32_MAX;
@ -153,6 +155,11 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
if (c->currentframe >= c->totalframes) if (c->currentframe >= c->totalframes)
return AVERROR_EOF; return AVERROR_EOF;
if (st->nb_index_entries < c->totalframes) {
av_log(s, AV_LOG_ERROR, "Index entry disappeared\n");
return AVERROR_INVALIDDATA;
}
size = st->index_entries[c->currentframe].size; size = st->index_entries[c->currentframe].size;
ret = av_get_packet(s->pb, pkt, size); ret = av_get_packet(s->pb, pkt, size);

View File

@ -53,6 +53,9 @@
#include "riff.h" #include "riff.h"
#include "url.h" #include "url.h"
#include "libavutil/ffversion.h"
const char av_format_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
/** /**
* @file * @file
* various utility functions for use within FFmpeg * various utility functions for use within FFmpeg
@ -594,6 +597,8 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in
int default_stream_index = av_find_default_stream_index(s); int default_stream_index = av_find_default_stream_index(s);
if (s->streams[default_stream_index]->pts_wrap_reference == AV_NOPTS_VALUE) { if (s->streams[default_stream_index]->pts_wrap_reference == AV_NOPTS_VALUE) {
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
if (av_find_program_from_stream(s, NULL, i))
continue;
s->streams[i]->pts_wrap_reference = pts_wrap_reference; s->streams[i]->pts_wrap_reference = pts_wrap_reference;
s->streams[i]->pts_wrap_behavior = pts_wrap_behavior; s->streams[i]->pts_wrap_behavior = pts_wrap_behavior;
} }
@ -2807,8 +2812,8 @@ static int get_std_framerate(int i)
* And there are "variable" fps files this needs to detect as well. */ * And there are "variable" fps files this needs to detect as well. */
static int tb_unreliable(AVCodecContext *c) static int tb_unreliable(AVCodecContext *c)
{ {
if (c->time_base.den >= 101L * c->time_base.num || if (c->time_base.den >= 101LL * c->time_base.num ||
c->time_base.den < 5L * c->time_base.num || c->time_base.den < 5LL * c->time_base.num ||
// c->codec_tag == AV_RL32("DIVX") || // c->codec_tag == AV_RL32("DIVX") ||
// c->codec_tag == AV_RL32("XVID") || // c->codec_tag == AV_RL32("XVID") ||
c->codec_tag == AV_RL32("mp4v") || c->codec_tag == AV_RL32("mp4v") ||
@ -2824,6 +2829,7 @@ int ff_alloc_extradata(AVCodecContext *avctx, int size)
int ret; int ret;
if (size < 0 || size >= INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { if (size < 0 || size >= INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
avctx->extradata = NULL;
avctx->extradata_size = 0; avctx->extradata_size = 0;
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
@ -3644,6 +3650,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
st->info->last_dts = AV_NOPTS_VALUE; st->info->last_dts = AV_NOPTS_VALUE;
st->codec = avcodec_alloc_context3(c); st->codec = avcodec_alloc_context3(c);
if (!st->codec) {
av_free(st->info);
av_free(st);
return NULL;
}
if (s->iformat) { if (s->iformat) {
/* no default bitrate if decoding */ /* no default bitrate if decoding */
st->codec->bit_rate = 0; st->codec->bit_rate = 0;

View File

@ -503,6 +503,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
free_side_data(&dst->side_data[i]); free_side_data(&dst->side_data[i]);
} }
av_freep(&dst->side_data); av_freep(&dst->side_data);
dst->nb_side_data = 0;
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
memcpy(sd_dst->data, sd_src->data, sd_src->size); memcpy(sd_dst->data, sd_src->data, sd_src->size);

View File

@ -32,11 +32,10 @@
#ifndef LIBAVUTIL_OPENCL_H #ifndef LIBAVUTIL_OPENCL_H
#define LIBAVUTIL_OPENCL_H #define LIBAVUTIL_OPENCL_H
#include "config.h" #ifdef __APPLE__
#if HAVE_CL_CL_H
#include <CL/cl.h>
#else
#include <OpenCL/cl.h> #include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif #endif
#include <stdint.h> #include <stdint.h>
#include "dict.h" #include "dict.h"

View File

@ -65,8 +65,8 @@ static int read_number(const AVOption *o, const void *dst, double *num, int *den
{ {
switch (o->type) { switch (o->type) {
case AV_OPT_TYPE_FLAGS: *intnum = *(unsigned int*)dst;return 0; case AV_OPT_TYPE_FLAGS: *intnum = *(unsigned int*)dst;return 0;
case AV_OPT_TYPE_PIXEL_FMT: case AV_OPT_TYPE_PIXEL_FMT: *intnum = *(enum AVPixelFormat *)dst;return 0;
case AV_OPT_TYPE_SAMPLE_FMT: case AV_OPT_TYPE_SAMPLE_FMT:*intnum = *(enum AVSampleFormat*)dst;return 0;
case AV_OPT_TYPE_INT: *intnum = *(int *)dst;return 0; case AV_OPT_TYPE_INT: *intnum = *(int *)dst;return 0;
case AV_OPT_TYPE_CHANNEL_LAYOUT: case AV_OPT_TYPE_CHANNEL_LAYOUT:
case AV_OPT_TYPE_DURATION: case AV_OPT_TYPE_DURATION:
@ -100,9 +100,9 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int
} }
switch (o->type) { switch (o->type) {
case AV_OPT_TYPE_PIXEL_FMT: *(enum AVPixelFormat *)dst = llrint(num/den) * intnum; break;
case AV_OPT_TYPE_SAMPLE_FMT:*(enum AVSampleFormat*)dst = llrint(num/den) * intnum; break;
case AV_OPT_TYPE_FLAGS: case AV_OPT_TYPE_FLAGS:
case AV_OPT_TYPE_PIXEL_FMT:
case AV_OPT_TYPE_SAMPLE_FMT:
case AV_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break; case AV_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break;
case AV_OPT_TYPE_DURATION: case AV_OPT_TYPE_DURATION:
case AV_OPT_TYPE_CHANNEL_LAYOUT: case AV_OPT_TYPE_CHANNEL_LAYOUT:
@ -143,6 +143,8 @@ static int set_string_binary(void *obj, const AVOption *o, const char *val, uint
len /= 2; len /= 2;
ptr = bin = av_malloc(len); ptr = bin = av_malloc(len);
if (!ptr)
return AVERROR(ENOMEM);
while (*val) { while (*val) {
int a = hexchar2int(*val++); int a = hexchar2int(*val++);
int b = hexchar2int(*val++); int b = hexchar2int(*val++);

View File

@ -27,6 +27,9 @@
* various utility functions * various utility functions
*/ */
#include "libavutil/ffversion.h"
const char av_util_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
unsigned avutil_version(void) unsigned avutil_version(void)
{ {
static int checks_done; static int checks_done;

View File

@ -89,6 +89,9 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
#include "postprocess_internal.h" #include "postprocess_internal.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/ffversion.h"
const char postproc_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
unsigned postproc_version(void) unsigned postproc_version(void)
{ {
av_assert0(LIBPOSTPROC_VERSION_MICRO >= 100); av_assert0(LIBPOSTPROC_VERSION_MICRO >= 100);

View File

@ -84,14 +84,14 @@ int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFo
in_fmt = av_get_packed_sample_fmt( in_fmt); in_fmt = av_get_packed_sample_fmt( in_fmt);
if(in_fmt == AV_SAMPLE_FMT_FLT || in_fmt == AV_SAMPLE_FMT_DBL){ if(in_fmt == AV_SAMPLE_FMT_FLT || in_fmt == AV_SAMPLE_FMT_DBL){
if(out_fmt == AV_SAMPLE_FMT_S32) scale = 1.0/(1L<<31); if(out_fmt == AV_SAMPLE_FMT_S32) scale = 1.0/(1LL<<31);
if(out_fmt == AV_SAMPLE_FMT_S16) scale = 1.0/(1L<<15); if(out_fmt == AV_SAMPLE_FMT_S16) scale = 1.0/(1LL<<15);
if(out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1.0/(1L<< 7); if(out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1.0/(1LL<< 7);
} }
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S32 && (s->dither.output_sample_bits&31)) scale = 1; if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S32 && (s->dither.output_sample_bits&31)) scale = 1;
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S16) scale = 1L<<16; if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S16) scale = 1<<16;
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1L<<24; if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1<<24;
if(in_fmt == AV_SAMPLE_FMT_S16 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1L<<8; if(in_fmt == AV_SAMPLE_FMT_S16 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1<<8;
scale *= s->dither.scale; scale *= s->dither.scale;

View File

@ -76,8 +76,12 @@ static int process(
AudioData *src, int src_size, int *consumed){ AudioData *src, int src_size, int *consumed){
size_t idone, odone; size_t idone, odone;
soxr_error_t error = soxr_set_error((soxr_t)c, soxr_set_num_channels((soxr_t)c, src->ch_count)); soxr_error_t error = soxr_set_error((soxr_t)c, soxr_set_num_channels((soxr_t)c, src->ch_count));
error = soxr_process((soxr_t)c, src->ch, (size_t)src_size, if (!error)
&idone, dst->ch, (size_t)dst_size, &odone); error = soxr_process((soxr_t)c, src->ch, (size_t)src_size,
&idone, dst->ch, (size_t)dst_size, &odone);
else
idone = 0;
*consumed = (int)idone; *consumed = (int)idone;
return error? -1 : odone; return error? -1 : odone;
} }

View File

@ -28,6 +28,9 @@
#define ALIGN 32 #define ALIGN 32
#include "libavutil/ffversion.h"
const char swr_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
unsigned swresample_version(void) unsigned swresample_version(void)
{ {
av_assert0(LIBSWRESAMPLE_VERSION_MICRO >= 100); av_assert0(LIBSWRESAMPLE_VERSION_MICRO >= 100);

View File

@ -221,6 +221,8 @@ cglobal pack_6ch_%2_to_%1_%3, 2,8,7, dst, src, src1, src2, src3, src4, src5, len
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
test srcq, mmsize-1 test srcq, mmsize-1
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
test src1q, mmsize-1
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
test src2q, mmsize-1 test src2q, mmsize-1
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
test src3q, mmsize-1 test src3q, mmsize-1

View File

@ -412,14 +412,24 @@ static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
} }
} }
static void rgba64ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
const uint8_t *unused2, int width, uint32_t *unused) const uint8_t *unused2, int width, uint32_t *unused)
{ {
int16_t *dst = (int16_t *)_dst; int16_t *dst = (int16_t *)_dst;
const uint16_t *src = (const uint16_t *)_src; const uint16_t *src = (const uint16_t *)_src;
int i; int i;
for (i = 0; i < width; i++) for (i = 0; i < width; i++)
dst[i] = src[4 * i + 3]; dst[i] = AV_RL16(src + 4 * i + 3);
}
static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
const uint8_t *unused2, int width, uint32_t *unused)
{
int16_t *dst = (int16_t *)_dst;
const uint16_t *src = (const uint16_t *)_src;
int i;
for (i = 0; i < width; i++)
dst[i] = AV_RB16(src + 4 * i + 3);
} }
static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused) static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
@ -1249,11 +1259,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
#endif #endif
case AV_PIX_FMT_YA16LE: case AV_PIX_FMT_YA16LE:
c->lumToYV12 = read_ya16le_gray_c; c->lumToYV12 = read_ya16le_gray_c;
c->alpToYV12 = read_ya16le_alpha_c;
break; break;
case AV_PIX_FMT_YA16BE: case AV_PIX_FMT_YA16BE:
c->lumToYV12 = read_ya16be_gray_c; c->lumToYV12 = read_ya16be_gray_c;
c->alpToYV12 = read_ya16be_alpha_c;
break; break;
case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YUYV422:
case AV_PIX_FMT_YVYU422: case AV_PIX_FMT_YVYU422:
@ -1361,9 +1369,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
} }
switch (srcFormat) { switch (srcFormat) {
case AV_PIX_FMT_BGRA64LE: case AV_PIX_FMT_BGRA64LE:
case AV_PIX_FMT_RGBA64LE: c->alpToYV12 = rgba64leToA_c; break;
case AV_PIX_FMT_BGRA64BE: case AV_PIX_FMT_BGRA64BE:
case AV_PIX_FMT_RGBA64LE: case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64beToA_c; break;
case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64ToA_c; break;
case AV_PIX_FMT_BGRA: case AV_PIX_FMT_BGRA:
case AV_PIX_FMT_RGBA: case AV_PIX_FMT_RGBA:
c->alpToYV12 = rgbaToA_c; c->alpToYV12 = rgbaToA_c;
@ -1375,6 +1383,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YA8: case AV_PIX_FMT_YA8:
c->alpToYV12 = uyvyToY_c; c->alpToYV12 = uyvyToY_c;
break; break;
case AV_PIX_FMT_YA16LE:
c->alpToYV12 = read_ya16le_alpha_c;
break;
case AV_PIX_FMT_YA16BE:
c->alpToYV12 = read_ya16be_alpha_c;
break;
case AV_PIX_FMT_PAL8 : case AV_PIX_FMT_PAL8 :
c->alpToYV12 = palToA_c; c->alpToYV12 = palToA_c;
break; break;

View File

@ -39,7 +39,7 @@
#define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long #define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long
#define YUVRGB_TABLE_HEADROOM 128 #define YUVRGB_TABLE_HEADROOM 256
#define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE #define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE

View File

@ -611,14 +611,15 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
} }
if ((*filterPos)[i] + filterSize > srcW) { if ((*filterPos)[i] + filterSize > srcW) {
int shift = (*filterPos)[i] + filterSize - srcW; int shift = (*filterPos)[i] + FFMIN(filterSize - srcW, 0);
// move filter coefficients right to compensate for filterPos // move filter coefficients right to compensate for filterPos
for (j = filterSize - 2; j >= 0; j--) { for (j = filterSize - 2; j >= 0; j--) {
int right = FFMIN(j + shift, filterSize - 1); int right = FFMIN(j + shift, filterSize - 1);
filter[i * filterSize + right] += filter[i * filterSize + j]; filter[i * filterSize + right] += filter[i * filterSize + j];
filter[i * filterSize + j] = 0; filter[i * filterSize + j] = 0;
} }
(*filterPos)[i]= srcW - filterSize; (*filterPos)[i]-= shift;
} }
} }

View File

@ -771,9 +771,13 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
av_freep(&c->yuvTable); av_freep(&c->yuvTable);
#define ALLOC_YUV_TABLE(x) \
c->yuvTable = av_malloc(x); \
if (!c->yuvTable) \
return AVERROR(ENOMEM);
switch (bpp) { switch (bpp) {
case 1: case 1:
c->yuvTable = av_malloc(1024); ALLOC_YUV_TABLE(1024);
y_table = c->yuvTable; y_table = c->yuvTable;
yb = -(384 << 16) - oy; yb = -(384 << 16) - oy;
for (i = 0; i < 1024 - 110; i++) { for (i = 0; i < 1024 - 110; i++) {
@ -788,7 +792,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
rbase = isRgb ? 3 : 0; rbase = isRgb ? 3 : 0;
gbase = 1; gbase = 1;
bbase = isRgb ? 0 : 3; bbase = isRgb ? 0 : 3;
c->yuvTable = av_malloc(1024 * 3); ALLOC_YUV_TABLE(1024 * 3);
y_table = c->yuvTable; y_table = c->yuvTable;
yb = -(384 << 16) - oy; yb = -(384 << 16) - oy;
for (i = 0; i < 1024 - 110; i++) { for (i = 0; i < 1024 - 110; i++) {
@ -807,7 +811,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
rbase = isRgb ? 5 : 0; rbase = isRgb ? 5 : 0;
gbase = isRgb ? 2 : 3; gbase = isRgb ? 2 : 3;
bbase = isRgb ? 0 : 6; bbase = isRgb ? 0 : 6;
c->yuvTable = av_malloc(1024 * 3); ALLOC_YUV_TABLE(1024 * 3);
y_table = c->yuvTable; y_table = c->yuvTable;
yb = -(384 << 16) - oy; yb = -(384 << 16) - oy;
for (i = 0; i < 1024 - 38; i++) { for (i = 0; i < 1024 - 38; i++) {
@ -826,7 +830,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
rbase = isRgb ? 8 : 0; rbase = isRgb ? 8 : 0;
gbase = 4; gbase = 4;
bbase = isRgb ? 0 : 8; bbase = isRgb ? 0 : 8;
c->yuvTable = av_malloc(1024 * 3 * 2); ALLOC_YUV_TABLE(1024 * 3 * 2);
y_table16 = c->yuvTable; y_table16 = c->yuvTable;
yb = -(384 << 16) - oy; yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) { for (i = 0; i < 1024; i++) {
@ -849,7 +853,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
rbase = isRgb ? bpp - 5 : 0; rbase = isRgb ? bpp - 5 : 0;
gbase = 5; gbase = 5;
bbase = isRgb ? 0 : (bpp - 5); bbase = isRgb ? 0 : (bpp - 5);
c->yuvTable = av_malloc(1024 * 3 * 2); ALLOC_YUV_TABLE(1024 * 3 * 2);
y_table16 = c->yuvTable; y_table16 = c->yuvTable;
yb = -(384 << 16) - oy; yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) { for (i = 0; i < 1024; i++) {
@ -869,7 +873,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
break; break;
case 24: case 24:
case 48: case 48:
c->yuvTable = av_malloc(1024); ALLOC_YUV_TABLE(1024);
y_table = c->yuvTable; y_table = c->yuvTable;
yb = -(384 << 16) - oy; yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) { for (i = 0; i < 1024; i++) {
@ -891,7 +895,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat); needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
if (!needAlpha) if (!needAlpha)
abase = (base + 24) & 31; abase = (base + 24) & 31;
c->yuvTable = av_malloc(1024 * 3 * 4); ALLOC_YUV_TABLE(1024 * 3 * 4);
y_table32 = c->yuvTable; y_table32 = c->yuvTable;
yb = -(384 << 16) - oy; yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) { for (i = 0; i < 1024; i++) {

View File

@ -1,16 +1,16 @@
#tb 0: 1/25 #tb 0: 1/50
0, 0, 0, 1, 152064, 0x05b789ef 0, 0, 0, 1, 152064, 0x05b789ef
0, 1, 1, 1, 152064, 0x05b789ef 0, 1, 1, 1, 152064, 0x05b789ef
0, 2, 2, 1, 152064, 0x4bb46551 0, 2, 2, 1, 152064, 0x4bb46551
0, 3, 3, 1, 152064, 0x9dddf64a 0, 3, 3, 1, 152064, 0x4bb46551
0, 4, 4, 1, 152064, 0x2a8380b0 0, 4, 4, 1, 152064, 0x9dddf64a
0, 5, 5, 1, 152064, 0x4de3b652 0, 5, 5, 1, 152064, 0x9dddf64a
0, 6, 6, 1, 152064, 0xedb5a8e6 0, 6, 6, 1, 152064, 0x2a8380b0
0, 7, 7, 1, 152064, 0xe20f7c23 0, 7, 7, 1, 152064, 0x2a8380b0
0, 8, 8, 1, 152064, 0x5ab58bac 0, 8, 8, 1, 152064, 0x4de3b652
0, 9, 9, 1, 152064, 0x1f1b8026 0, 9, 9, 1, 152064, 0x4de3b652
0, 10, 10, 1, 152064, 0x91373915 0, 10, 10, 1, 152064, 0xedb5a8e6
0, 11, 11, 1, 152064, 0x02344760 0, 11, 11, 1, 152064, 0xedb5a8e6
0, 12, 12, 1, 152064, 0x30f5fcd5 0, 12, 12, 1, 152064, 0xe20f7c23
0, 13, 13, 1, 152064, 0xc711ad61 0, 13, 13, 1, 152064, 0xe20f7c23
0, 14, 14, 1, 152064, 0x24eca223 0, 14, 14, 1, 152064, 0x5ab58bac