Compare commits

...

229 Commits

Author SHA1 Message Date
Paul B Mahol
49fb1f66f1 doc/utils: fix typo for min() description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit bdf474bcff29f5b40fe14f6fa1dbe10e69c73ab7)
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-03-02 16:45:56 -08:00
Michael Niedermayer
f8b25be7f7 swscale/x86/rgb2rgb_template: Fallback to mmx in interleaveBytes() if the alignment is insufficient for SSE*
This also as a sideeffect fixes the non aligned case

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a066ff89bcbae6033c2ffda9271cad84f6c1b807)
2015-12-15 11:20:47 +01:00
Michael Niedermayer
633bf6246c swscale/x86/rgb2rgb_template: Do not crash on misaligend stride
Fixes Ticket5013

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 80bfce35ccd11458e97f68f417fc094c5347070c)
2015-12-15 11:20:45 +01:00
Michael Niedermayer
0fde898f16 avcodec/ffv1dec: Clear quant_table_count if its invalid
Fixes deallocation of corrupted pointer
Fixes: 343dfbe142a38b521ed069dc4ea7c03b/signal_sigsegv_421427_4074_ffb11959610278cd40dbc153464aa254.avi
No releases affected

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e04126072e984f8db5db9da9303c89ae01f7d6bb)

Fixes ticket #5052.
2015-12-06 14:13:56 +01:00
Michael Niedermayer
1fff994709 avcodec/ffv1dec: Print an error if the quant table count is invalid
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a8b254e436dce2f5c8c6459108dab4b02cc6b79b)
2015-12-06 14:13:43 +01:00
Michael Niedermayer
eb0a9cd68a avcodec/ffv1dec: Check for 0 quant tables
Fixes assertion failure
Fixes: 07ec1fc3c1cbf2d3edcd7d9b52ca156c/asan_heap-oob_13624c5_491_ecd4720a03e697ba750b235690656c8f.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5745cf799a4389bc5d14f2b4daf32fe4631c50bc)
2015-12-06 14:13:04 +01:00
Andrey Utkin
f450caf057 doc/filters/drawtext: fix centering example
Signed-off-by: Andrey Utkin <andrey.od.utkin@gmail.com>
Signed-off-by: Lou Logan <lou@lrcd.com>
(cherry picked from commit 648b26acc5e25ab40c43fddc54b50e9f0b13ebd8)
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2015-12-01 17:33:33 -08:00
Ronald S. Bultje
f6006295c0 videodsp: don't overread edges in vfix3 emu_edge.
Fixes trac ticket 3226. Also see Andreas' analysis in
https://bugs.debian.org/801745, which was very helpful.
(cherry picked from commit 52f84d82bdf1851ecfcc412c1719e5f6f3396209)
2015-10-25 01:25:17 +02:00
Michael Niedermayer
5279f5d068 avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check
Fixes Ticket4778

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2bb54b82b5094fd906aa28c0443be08c95662a31)
2015-10-09 22:46:33 +02:00
Michael Niedermayer
d40ab18c07 avformat/oggenc: Check segments_count for headers too
Fixes infinite loop and segfault in ogg_buffer_data()
Fixes Ticket4806

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 81a8701eb52d2b6469ae16ef442ce425388141b7)
2015-10-09 22:46:18 +02:00
Michael Niedermayer
80a467b452 avformat/avidec: Workaround broken initial frame
Fixes Ticket4851

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3e2ef00394b8079e93835d47c993868229f07502)
2015-10-09 22:46:05 +02:00
Hendrik Leppkes
9e1b493916 hevc: properly handle no_rasl_output_flag when removing pictures from the DPB
Fixes ticket #4185.

Reviewed-By: Mickael Raulet <Mickael.Raulet@insa-rennes.fr>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
(cherry picked from commit 0118158efa8e45761f9f65a3bb74f33907bd2aec)
2015-10-09 22:45:48 +02:00
Ronald S. Bultje
44184226ac hevc: fix wpp threading deadlock.
Fixes ticket 4258.
(cherry picked from commit 74e4948235bc8f8946eeca20525258bbf383f75d)
2015-10-09 22:45:11 +02:00
Michael Niedermayer
e2f0443af0 avcodec/ffv1: seperate slice_count from max_slice_count
Fix segfault with too large slice_count
Fixes Ticket4879

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

Conflicts:
	libavcodec/ffv1enc.c
	libavcodec/ffv1.c
2015-10-09 22:44:48 +02:00
wm4
f57a595024 avcodec/mp3: fix skipping zeros
Commits 43bc5cf9 and c5371f77 add code for skipping initial zeros in mp3
packets. This code forgot to report to the user that data was skipped at
all.

Since audio codecs allow partial packet decoding, the user application
has to rely on the return value. It will remove the data reported as
consumed by the decoder, and feed it to the decoder again. This resulted
in the mp3 frame after the zero region to be decoded over and over
again, until the zero region was finally skipped by the application.

Fix this by including the amount of skipped bytes to the number of
consumed bytes returned by the decode call.

Fixes trac ticket #4890.
(cherry picked from commit cb1da9fb8d71bb611a7b0028914c97afc3f5711d)
2015-10-09 22:44:00 +02:00
Michael Niedermayer
d88a85c493 MAINTAINERS: Remove myself as leader
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f2c58931e629343f7d68258cc2b2d62c5f501ba5)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-31 18:35:31 +02:00
Michael Niedermayer
bf4fa00162 avformat/swfdec: Do not error out on pixel format changes
Instead print an error and continue

Fixes Ticket4702

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6a1204a1a46674084b1e6b92562f81aaab7aac69)
2015-07-08 12:48:57 +02:00
Paul B Mahol
17d9157c82 avcodec/exr: fix crash caused by merge
Various header informations need to be reset when decoding next frame.
Regression since: 95582b5c

Fixes ticket #4597.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit a03b69478b7f1c0c31e53acb0cf392917c0f967a)
2015-06-19 11:32:32 +02:00
Michael Niedermayer
e1afd6ed60 avcodec/x86/h264_weight: handle weight1=128
Fix ticket4596

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e1009665759d4a3938dd2dd07b7e84d8bc9c5290)
2015-06-19 11:32:20 +02:00
Michael Niedermayer
7d97587b1a avformat/mov: Mark avio context of decompressed atoms as seekable
Fixes Ticket4329

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8ce564ea280b61d21eebf8a2fd741f792ce81638)
2015-06-19 11:32:06 +02:00
Michael Niedermayer
86c85b6f1a avfilter/x86/vf_hqdn3d: Fix register types
Fixes Ticket4301

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 52fc3e372f8ed4de5735abed1f7f7569fe37b023)
2015-06-19 11:31:53 +02:00
Carl Eugen Hoyos
ac4126decd lavfi/fade: Do not overread input buffer.
(cherry picked from commit ab3ff19f08b7a83e320c39ab066f289c242b8030)
2015-05-17 12:48:21 +02:00
Michael Niedermayer
db27f50e06 avformat/mov: Fix mixed declaration and statement warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 19:53:11 +01:00
Michael Niedermayer
8327bef1c9 Update for 2.3.6
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 19:37:09 +01:00
Michael Niedermayer
a620c463f0 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-06 18:28:35 +01:00
Michael Niedermayer
63b5cb1fb0 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-06 18:28:35 +01:00
Michael Niedermayer
7959b9a0f3 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-06 18:28:35 +01:00
Paul B Mahol
bbfe0f7b08 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-06 18:28:35 +01:00
Dale Curtis
27a910a857 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-06 18:28:35 +01:00
Michael Niedermayer
ffe915b6f5 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-06 18:28:35 +01:00
Dale Curtis
22558d6f6e 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>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:35 +01:00
wm4
f03888b449 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-06 18:28:35 +01:00
Michael Niedermayer
11c0531099 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-06 18:28:35 +01:00
Michael Niedermayer
0b033cd3a1 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-06 18:28:35 +01:00
Michael Niedermayer
c9a25ff5a0 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)

Conflicts:

	libavformat/flvdec.c
2015-01-06 18:28:35 +01:00
Michael Niedermayer
3ee4a610c2 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-06 18:28:35 +01:00
Michael Niedermayer
d071c1f0e1 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-06 18:28:35 +01:00
Clément Bœsch
15601df419 avformat/mov: strengthen some table allocations
(cherry picked from commit 5ab882d7283f57560c889919c35f2688253b1d9c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:35 +01:00
Michael Niedermayer
103cf56c62 avformat/mov: Fix memleaks for duplicate STCO/CO64/STSC atoms
Also see [FFmpeg-devel] [PATCH] avformat/mov: strengthen some table allocations
which contains more fixes but is unfinished

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:35 +01:00
Michael Niedermayer
d4c45f9249 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
841ce9a838 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>
2015-01-06 18:28:34 +01:00
Anton Khirnov
8a01fb3729 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
(cherry picked from commit b0273232d8fffdc8a977ccdad460b8071a0e353c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:34 +01:00
Anton Khirnov
b5dbe93c8b 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
(cherry picked from commit e012cb8dea7969c7b3927dbf846ef2742cd4a7ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
185e55279c 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
730826275f 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
afd7fac3f1 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
3353a00d58 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
b052ea0f5b 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
c8fb53357d 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
30e7dae22c 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
a74a0a5c0c 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
0f77303c57 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
dbe690b572 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
6eca20aaec 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)

Conflicts:

	libavformat/isom.h
2015-01-06 18:28:34 +01:00
Michael Niedermayer
7ef11e8221 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
942806cbe4 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
557e3790ef 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>
2015-01-06 18:28:34 +01:00
Michael Niedermayer
2b15ceec62 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>
2015-01-06 18:28:33 +01:00
wm4
c3cd7b8a29 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>
2015-01-06 18:28:33 +01:00
Michael Niedermayer
0621421ee2 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>
2015-01-06 18:28:33 +01:00
Michael Niedermayer
0e9fe8510e 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>
2015-01-06 18:28:33 +01:00
Rob Sykes
1f59cfe65b 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>
2015-01-06 18:28:33 +01:00
wm4
a6f808b36a 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>
2015-01-06 18:28:33 +01:00
Michael Niedermayer
4a495766d1 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>
2015-01-06 18:28:33 +01:00
Michael Niedermayer
cedb96db37 swscale/x86/rgb2rgb_template: fix crash with tiny size and nv12 output
Fixes Ticket4151

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:33 +01:00
Michael Niedermayer
de75b4063d avformat/rmdec: Check codec_data_size
Fixes infinite loop
Fixes Ticket4154

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:33 +01:00
Michael Niedermayer
bb70b6673f avformat/aviobuf: Fix infinite loop in ff_get_line()
Fixes ticket4152

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:28:33 +01:00
Michael Niedermayer
a07dfcdd6d avcodec/motion_est: use 2x8x8 for interlaced qpel
Fixes out of array read
Fixes Ticket4121

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:51 +01:00
Anton Khirnov
5630d5cdc2 opusdec: make sure all substreams have the same number of coded samples
Fixes invalid writes with invalid multichannel streams.

CC:libav-stable@libav.org
(cherry picked from commit 1973079417e8701b52ba810a72cb6c7c6f7f9a56)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:51 +01:00
Michael Niedermayer
87d0339d67 avcodec/hevc_ps: Check num_long_term_ref_pics_sps
Fixes out of array access
Fixes: signal_sigsegv_35bd0f0_1182_cov_791726764_STRUCT_B_Samsung_4.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ea38e5a6b75706477898eb1e6582d667dbb9946c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:51 +01:00
Michael Niedermayer
fac6ae0814 avcodec/mjpegdec: Fix integer overflow in shift
Fixes: signal_sigabrt_7ffff6ac7bb9_2683_cov_4120310995_m_ijpg.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 970a8f1c256f08d2f6414d573a54f2fa035c8e7a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:51 +01:00
Michael Niedermayer
0c51b26729 avcodec/hevc_ps: Check return code from pps_range_extensions()
Fixes out of array read
Fixes: asan_heap-oob_177e222_885_cov_1532528832_MERGE_D_TI_3.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9f9440bd8122cc8798139c9370db0873a24ae14b)

Conflicts:

	libavcodec/hevc_ps.c
2015-01-06 18:25:51 +01:00
Michael Niedermayer
e0822b147f avcodec/rawdec: Check the return code of avpicture_get_size()
Fixes out of array access
Fixes: asan_heap-oob_22388d0_3435_cov_3297128910_small_roll5_FlashCine1.cine
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1d3a3b9f8907625b361420d48fe05716859620ff)

Conflicts:

	libavcodec/rawdec.c
2015-01-06 18:25:50 +01:00
Michael Niedermayer
1bfd23d2c9 avcodec/pngdec: Check IHDR/IDAT order
Fixes out of array access
Fixes: asan_heap-oob_20a6c26_2690_cov_3434532168_mail.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 79ceaf827be0b070675d4cd0a55c3386542defd8)

Conflicts:

	libavcodec/pngdec.c
2015-01-06 18:25:50 +01:00
Michael Niedermayer
419bd6e303 avcodec/flacdec: Call ff_flacdsp_init() unconditionally
Fixes out of array access
Fixes: signal_sigsegv_324b135_3398_cov_246853371_short.flac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e5c01ccdf5a9a330d4c51a9b9ea721fd8f1fb70b)

Conflicts:

	libavcodec/flacdec.c
2015-01-06 18:25:50 +01:00
Michael Niedermayer
494d3d14db avcodec/utils: Check that the data is complete in avpriv_bprint_to_extradata()
Fixes out of array read
Fixes: asan_heap-oob_4d2250_814_cov_2745172097_JACOsub_capability_tester.jss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3d5d95db3f5d8e2093e9e19d0c46e86f54ed2a5d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
6c63eb5909 avcodec/mjpegdec: Fix context fields becoming inconsistent
Fixes out of array access
Fixes: asan_heap-oob_1ca4f85_2760_cov_144449187_miss_congeniality_pegasus_ljpg.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0eecf40935b22644e6cd74c586057237ecfd6844)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
142896f2d0 avcodec/mjpegdec: Check for pixfmtid 0x42111100 || 0x24111100 with more than 8 bits
These cases are not supported yet

Fixes assertion failure
Fixes: signal_sigabrt_7ffff6ac7bb9_1_cov_1553101927_00.jpg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0bf416f2628137e5389050fa323c329692dd4ba6)

Conflicts:

	libavcodec/mjpegdec.c
(cherry picked from commit bc73ee996b08b331d5a6c41df6acdd53e8deeb5d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
dca70c5931 swscale/x86/rgb2rgb_template: handle the first 2 lines with C in rgb24toyv12_*()
This avoids out of array accesses
Should fix Ticket3451

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
17ff5d3f88 doc/APIchanges: Fix some wrong versions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4eae568a0712b8b59cb74b3882963f938c26eab4)

Conflicts:

	doc/APIchanges
(cherry picked from commit f00c8f879ac311066001b74d3f396cf3dc1f9ad3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
693d0d3ac5 avformat/hlsenc: Free context after hls_append_segment
Fixes reading uninitialized memory

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

Conflicts:

	libavformat/hlsenc.c
(cherry picked from commit 0ac22f043bee2f1c4daf5e1044b014326325d929)

Conflicts:

	libavformat/hlsenc.c
2015-01-06 18:25:50 +01:00
Lukasz Marek
bb2c09310c lavu/opt: fix av_opt_get function
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
(cherry picked from commit 173d51c982f1ecaa8d28cd0d8611164be0c9d36d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
66261cfa77 avcodec/wmaprodec: Fix integer overflow in sfb_offsets initialization
Fixes out of array read
Fixes: asan_heap-oob_2aec5b0_1828_classical_22_16_2_16000_v3c_0_exclusive_0_29.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5dcb99033df16eccc4dbbc4a099ad64457f9f090)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
b89b136c00 avcodec/utvideodec: fix assumtation that slice_height >= 1
Fixes out of array read
Fixes: asan_heap-oob_2573085_3783_utvideo_rgba_median.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7656c4c6e66f8a787d384f027ad824cc1677fda1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
6ed35a6674 avcodec/options_table fix min of audio channels and sample rate
Found-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 206c98f303e833c9e94427c9e3f9867f85265f78)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Carl Eugen Hoyos
d4c70c8b50 lavc/utils: Make pix_fmt desc pointer const.
Fixes an "initialization discards qualifiers from pointer target type" warning.
(cherry picked from commit f05855414ed4cce97c06ba2a31f4987af47e6d4e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Michael Niedermayer
05bc6f8ba6 avcodec/h264_slice: Clear table pointers to avoid stale pointers
Might fix Ticket3889

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 18:25:50 +01:00
Clément Bœsch
c2517fb363 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:02:27 -03:00
Michael Stypa
0cc15f7c83 fix Makefile objects for pulseaudio support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cb58c771ade66afcc623250e1c7ac8191381d991)
2014-12-01 00:21:57 +01:00
Michael Niedermayer
b6ff3acafc avformat/avidec: fix handling dv in avi
Fixes Ticket4086

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f0ae0354d3f04c369257c2a28557524d28c5df15)
2014-11-21 09:55:19 +01:00
Michael Niedermayer
8047380514 avformat/segment: export inner muxer timebase
Fixes "Non-monotonous DTS in output stream 0:0"
Fixes Ticket4020

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ce80f9fee97160049687bbbef4eb31a68166c3ee)
2014-11-17 01:13:20 +01:00
Michael Niedermayer
b152305bb3 Revert "v4l2: setting device parameters early"
This reverts commit b1ad9312331759679a9c956233716a67ae681d89.

Fixes Ticket #3517

Requested-by: Giorgio Vazzana <mywing81@gmail.com>
Merged-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6f21fb793238ab6a790b94b86084148d99373ddf)

Conflicts:
	libavdevice/v4l2.c
2014-11-08 14:26:27 +01:00
Michael Niedermayer
a0605792c2 avcodec/mpegaudio_parser: fix off by 1 error in bitrate calculation
Fixes Ticket3918

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 817663897e59f45f60016fa9d3d16e325b803967)
2014-11-06 01:06:17 +01:00
Michael Niedermayer
4b8cb3fe51 avcodec/h264_parser: rewrite the parse_nal_units() loop logic based on h264.c
Fixes Ticket4011

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-01 17:11:41 +01:00
Michael Niedermayer
48bf926bad avcodec/h264: simplify find_start_code()
this also uses avpriv_find_start_code(), though no speed change is expected as
the area searched is generally small

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-01 17:09:16 +01:00
Michael Niedermayer
ab43652c67 Move get_avc_nalsize() and find_start_code() to h264.h
This allows sharing them with the h264 parser

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

Conflicts:

	libavcodec/h264.c
2014-11-01 17:05:35 +01:00
Michael Niedermayer
48b586ca4e ffmpeg: Copy extradata if it has been initialized later from the encoder
Fixes Ticket3909

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ab84effdeda931a74d8503891488ed538619a5d3)
2014-11-01 15:53:19 +01:00
Michael Niedermayer
4e2e997faf avformat/mpeg: increase score for short mpeg-ps by 1
Fixes Ticket 3855

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5109ce2017c15202275b33bce58ec9d88044eeb5)
2014-11-01 15:52:43 +01:00
Michael Niedermayer
19ccc06d8b avformat/mp3dec: Improve seeking frame sync code
Fixes Ticket3884

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1b5ccae0f2045ac86bc9e1257cec1b3fba81315f)
2014-11-01 15:52:08 +01:00
Clément Bœsch
193b949f71 avcodec/mjpegdec: Fix chroma width rounding
Fixes vertical line at the right side
Fixes Ticket 3929

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b96d864fd685aa1f661a5f8666224129d68b8eaf)
2014-11-01 15:51:41 +01:00
Michael Niedermayer
63ed7e09dd avformat/mpegts: Improve probe heuristic by considering the overall frequency of 0x47 headers
Fixes Ticket3939

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 296cd9c432775bbf57867fd76e8d2f505a512569)
2014-11-01 15:51:03 +01:00
Michael Niedermayer
10464ca0eb avformat/options_table: add FF_COMPLIANCE_UNOFFICIAL
Fixes ticket 3959

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c02ea58c5f0a77f20c8046041edb974bb4376f4c)
2014-11-01 15:49:41 +01:00
Michael Niedermayer
4f515913a2 avformat/matroskadec: do not trust the default duration to be the real 1/timebase if its less than 5fps
Fixes Ticket3980

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit be695ee389724d713e1b8a61ef899fe1795193ce)
2014-11-01 15:48:58 +01:00
Michael Niedermayer
b44506c393 update for 2.3.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-01 14:30:10 +01:00
Michael Niedermayer
9395a3a96b avcodec/svq1dec: zero terminate embedded message before printing
Fixes out of array access
Fixes: asan_stack-oob_49b1e5_10_009.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e91ba2efa949470e9157b652535d207a101f91e0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 18:38:45 +01:00
Michael Niedermayer
25d2a4dde7 avcodec/cook: check that the subpacket sizes fit in block_align
Fixes out of array read
Fixes: asan_heap-oob_fb5c50_19_018.rmvb
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 10e32618acce9c3fc64c061eb7907e8a8d2749ae)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 17:23:37 +01:00
Michael Niedermayer
bfee1e9072 avcodec/g2meet: check tile dimensions to avoid integer overflow
Fixes out of array access
Fixes: asan_heap-oob_12a55d3_30_029.wmv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 32e666c354e4a3160d8cf1d303cb51990b095c87)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 01:51:30 +01:00
Michael Niedermayer
0db579445f avcodec/utils: Align dimensions by at least their chroma sub-sampling factors.
Fixes: out of array accesses
Fixes: asan_heap-oob_112c6b3_13_012.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit df74811cd53e45fcbbd3b77a1c42416816687c5c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-29 16:23:36 +01:00
Michael Niedermayer
e3275571c7 avcodec/dnxhddec: treat pix_fmt like width/height
Fixes out of array accesses
Fixes: asan_heap-oob_22c9a39_16_015.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f3c0e0bf6f53df0977f3878d4f5cec99dff8de9e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-29 01:31:49 +01:00
Michael Niedermayer
7b7d12ea04 avcodec/dxa: check dimensions
Fixes out of array access
Fixes: asan_heap-oob_11222fb_21_020.dxa
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e70312dfc22c4e54d5716f28f28db8f99c74cc90)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-28 16:05:18 +01:00
Michael Niedermayer
e26fd791ef avcodec/dirac_arith: fix integer overflow
Fixes: asan_heap-oob_1078676_9_008.drc
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 39680caceebfc6abf09b17032048752c014e57a8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-28 15:00:05 +01:00
Michael Niedermayer
ad98b2891c avcodec/diracdec: Tighter checks on CODEBLOCKS_X/Y
Fixes very long but finite loop
Fixes: asan_heap-oob_107866c_42_041.drc
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5145d22b88b9835db81c4d286b931a78e08ab76a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-28 15:00:04 +01:00
Michael Niedermayer
1ec6a3c768 avcodec/diracdec: Use 64bit in calculation of codeblock coordinates
Fixes integer overflow
Fixes out of array read
Fixes: asan_heap-oob_107866c_42_041.drc
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 526886e6069636a918c8c04db17e864e3d8151c1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-28 15:00:02 +01:00
Michael Niedermayer
5c791b1c9c avcodec/sgidec: fix count check
Fixes: asan_heap-oob_22b30d4_39_038.sgi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a050cf0c451bdf1c1bd512c4fce6b6f8a5e85102)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-27 21:16:55 +01:00
Michael Niedermayer
4a03c31728 avcodec/sgidec: fix linesize for 16bit
Fixes: asan_heap-oob_22b30d4_39_038.sgi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3b20ed85489a14cb5028c873d06960dbc5eef88a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-27 21:16:54 +01:00
Christophe Gisquet
c3c8857263 avcodec/tiffenc: properly compute packet size
The bytes per row is a better indication of it.

Helps resolving ticket #3874 by fixing ffmpeg's encoder and transforming
the issue in a issue with non-compliant decoders. ffmpeg's one is ok,
but unfortunately, many others aren't handling correctly unusual chroma
samplings.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-22 22:31:44 +02:00
Lukasz Marek
4fbdac00e9 lavd: export all symbols with av_ prefix
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
(cherry picked from commit e493814d6191c6dd2900296df546b5f5c7e4452d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-22 02:16:17 +02:00
Michael Niedermayer
0f4c149730 postproc: fix qp count
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0b7e5d0d75e7d8762dd04d35f8c0821736164372)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-13 16:24:47 +02:00
Michael Niedermayer
d887a12145 postproc/postprocess: fix quant store for fq mode
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 941aaa39e8cd78ba4d16dfcec767290aec9a0136)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-13 01:39:10 +02:00
Christophe Gisquet
f2fba07494 utvideoenc: properly set slice height/last line
Mimic decoder and obey sampling.

Does not affect fate tests for utvideo.
Fixes ticket #3949.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-10 20:30:12 +02:00
Michael Niedermayer
1ebd7d2ccf swresample/swresample: fix sample drop loop end condition
Fixes Ticket3985

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 01:31:16 +02:00
Michael Niedermayer
5f7e48a113 avcodec/on2avc: Check number of channels
Fixes out of array access
Fixes: asan_heap-oob_4da4f3_7_asan_heap-oob_4da4f3_173_Xmen_avc_500.vp6

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 22:26:33 +02:00
Michael Niedermayer
e2e0c5b7f6 avcodec/hevc: fix chroma transform_add size
Fixes accessing misaligned address
Fixes: signal_sigsegv_1feb99c_10_signal_sigsegv_2d1d35c_79_cov_691940146_EXT_A_ericsson_3.bit

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 17:56:37 +02:00
Michael Niedermayer
279003eb9e avcodec/h264: Check mode before considering mixed mode intra prediction
Fixes out of array read
Fixes: asan_heap-oob_e476fc_2_asan_heap-oob_1333ec6_61_CAMACI3_Sony_C.jsv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 15:04:33 +02:00
Michael Niedermayer
5926bea980 avformat/mpegts: use a padded buffer in read_sl_header()
Fixes overread
Fixes: asan_heap-oob_84f75d_8_asan_heap-oob_a2a00a_341_mbc.ts

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 05:29:32 +02:00
Michael Niedermayer
cbfd6b1fa4 avformat/mpegts: Check desc_len / get8() return code
Fixes out of array read
Fixes: signal_sigsegv_844d59_10_signal_sigsegv_a17bb7_366_mpegts_mpeg2video_mp2_dvbsub_topfield.rec

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 05:29:31 +02:00
Michael Niedermayer
fdc8f4e5b4 avcodec/vorbisdec: Fix off by 1 error in ptns_to_read
Fixes read of uninitialized memory
Fixes: asan_heap-uaf_18dac2b_9_asan_heap-uaf_22eb375_208_beta3_test_small.ogg

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 04:14:20 +02:00
Michael Niedermayer
603f4ecd14 avcodec/svq3: Dont memcpy AVFrame
This avoids out of array accesses

Fixes: asan_heap-uaf_21f42e4_9_asan_heap-uaf_21f42e4_278_gl2.mov

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 01:15:09 +02:00
Michael Niedermayer
1ac4ae2a32 avcodec/smc: fix off by 1 error
Fixes out of array access
Fixes: asan_heap-oob_1685bf0_5_asan_heap-oob_1f35116_430_smc.mov

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 23:24:14 +02:00
Michael Niedermayer
3998071039 avcodec/qpeg: fix off by 1 error in MV bounds check
Fixes out of array access
Fixes: asan_heap-oob_153760f_4_asan_heap-oob_1d7a4cf_164_VWbig6.avi

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 21:32:04 +02:00
Michael Niedermayer
6fb9bfb1a3 avcodec/gifdec: factorize interleave end handling out
also change it to a loop
Fixes out of array access
Fixes: asan_heap-oob_ca5410_8_asan_heap-oob_ca5410_97_ID_LSD_Size_Less_Then_Data_Inter_3.gif

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 20:28:35 +02:00
Michael Niedermayer
693faadd30 avcodec/cinepak: fix integer underflow
Fixes out of array access
Fixes: asan_heap-oob_4da0ba_6_asan_heap-oob_4da0ba_241_cvid_crash.avi

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 19:47:33 +02:00
Michael Niedermayer
9806028fbb avcodec/pngdec: Calculate MPNG bytewidth more defensively
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e830902934a29df05c7af65aef2a480b15f572c4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 18:29:13 +02:00
Michael Niedermayer
433e15bb87 avcodec/pngdec: Check bits per pixel before setting monoblack pixel format
Fixes out of array accesses
Fixes: asan_heap-oob_14dbfcf_4_asan_heap-oob_1ce5767_179_add_method_small.png

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 18:29:11 +02:00
Michael Niedermayer
c3af801c63 avcodec/tiff: more completely check bpp/bppcount
Fixes pixel format selection
Fixes out of array accesses
Fixes: asan_heap-oob_1766029_6_asan_heap-oob_20aa045_332_cov_1823216757_m2-d1d366d7965db766c19a66c7a2ccbb6b.tif

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 16:47:21 +02:00
Michael Niedermayer
01817d508b avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks
Fixes out of array access
Fixes: asan_heap-oob_4da4f3_8_asan_heap-oob_4da4f3_419_scene1a.mm

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 15:09:43 +02:00
Michael Niedermayer
b5ef1eee45 avcodec/h263dec: Fix decoding messenger.h263
Fixes http://samples.mplayerhq.hu/V-codecs/h263/h263-raw/messenger.h263
Fixes regression since b239f3f6

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 13:10:08 +02:00
Michael Niedermayer
e2c5f88237 avcodec/utils: Add case for jv to avcodec_align_dimensions2()
Fixes out of array accesses
Fixes: asan_heap-oob_12304aa_8_asan_heap-oob_4da4f3_300_intro.jv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 05:07:15 +02:00
Michael Niedermayer
d005e2ecce update for FFmpeg 2.3.4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:41:00 +02:00
Michael Niedermayer
57bdb3f3dd avcodec/mjpegdec: check bits per pixel for changes similar to dimensions
Fixes out of array accesses
Fixes: asan_heap-oob_16668e9_2_asan_heap-oob_16668e9_346_miss_congeniality_pegasus_mjpg.avi

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
5e34dded10 avcodec/jpeglsdec: Check run value more completely in ls_decode_line()
previously it could have been by 1 too large
Fixes out of array access
Fixes: asan_heap-oob_12240f5_1_asan_heap-oob_12240f5_448_t8c1e3.jls
Fixes: asan_heap-oob_12240f5_1_asan_heap-oob_12240f5_448_t8nde0.jls
Fixes: asan_heap-oob_12240fa_1_asan_heap-oob_12240fa_448_t16e3.jls

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Reimar Döffinger
45ca270ec9 configure: add noexecstack to linker options if supported.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(cherry picked from commit b7082d953fda93f7841ffffe7d15a6c3cd15bdee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
ca2ccd85d7 avcodec/ac3enc_template: fix out of array read
Found-by: Andreas Cadhalpun
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d85ebea3f3b68ebccfe308fa839fc30fa634e4de)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
lvqcl
437f6fb488 avutil/x86/cpu: fix cpuid sub-leaf selection
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e58fc44649d07d523fcd17aa10d9eb0d3a5ef3f4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Philip DeCamp
f913da3e15 libavutil/opt: fix av_opt_set_channel_layout() to access correct memory address
Signed-off-by: Philip DeCamp <decamp@mit.edu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 857fc0a71f1b52fbba3281ba64b5a35195458622)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Benoit Fouet
ed9c6529f0 avformat/riffenc: Filter out "BottomUp" in ff_put_bmp_header()
Fixes Ticket1304

Commit message and extradata size bugfix by commiter
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6843b9dc78bc966bb30121828ef4f6b6755cf877)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Pascal Massimino
aa40bbb492 avcodec/webp: fix default palette color 0xff000000 -> 0x00000000
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e5b3112996c3da45aa03b39c5ade375d40d4407d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Gianluigi Tiesi
8e276fc96a avcodec/libilbc: support for latest git of libilbc
in the latest git commits of libilbc developers removed WebRtc_xxx typedefs

This commit uses int types instead,
it's safe to apply also for previous versions since
WebRtc_Word16 was always a typedef of int16_t and
WebRtc_UWord16 a typedef of uint16_t

Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 59af5383c18c8cf3fe2a4b5cc1ebf2f3300bdfe5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Pascal Massimino
4a4e30a6d8 libavcodec/webp: treat out-of-bound palette index as translucent black
See https://code.google.com/p/webp/issues/detail?id=206
for a description of the problem/fix.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

This patch makes the decoder follow the recommendation of the spec.
There is some disagreement (see "[FFmpeg-devel] [PATCH]: libavcodec/webp")
about what would be best to be written in the spec, so in case the spec
is changed again, this potentially would need to be amended or reverted
(cherry picked from commit 4fd21d58a72c38ab63c3a4483b420db260fa7b8d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
1c733a440a avcodec/x86/vp9lpf: Always include x86util.asm
Fixes executable stack

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Katerina Barone-Adesi
5c3bc127ca apetag: Fix APE tag size check
The size variable is (correctly) unsigned, but is passed to several functions
which take signed parameters, such as avio_read, sometimes after having
numbers added to it. So ensure that size remains within the bounds that
these functions can handle.

CC: libav-stable@libav.org
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit c5560e72d0bb69f8a1ac9536570398f84388f396)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
be94d15a03 tools/crypto_bench: fix build when AV_READ_TIME is unavailable
Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4a99134f1a71994a0dc4542a0d6bee8e36146b60)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
9c57328b81 ffmpeg: Do av_buffersink_set_frame_size() when reconfiguring the filtergraph not just when changing audio resample parameters
Fixes Ticket3562

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
6952f6f39b avcodec/cabac_functions: fix "warning: UNCHECKED_BITSTREAM_READER is not defined, evaluates to 0"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a67b6c95415438b4a6bfb6277f066f7c7b57b40f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
6359be6751 avformat/m4vdec: Check for non startcode 00 00 00 sequences in probe
Fixes miss detection of PCM as m4v
Fixes Ticket 3928

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
beb55b3981 avcodec/mpegvideo: Set err on failure in ff_mpv_common_frame_size_change()
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cfce6f7efd28130bf0dd409b2367ca0f8c9b2417)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
80aec733ad avcodec/mpegvideo: check that the context is initialized in ff_mpv_common_frame_size_change()
The function otherwise would initialize the context without setting context_initialized
alternatively we could set context_initialized

Fixes valgrind anomalies related to ticket 3928

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
77bb6b5bcc avcodec/mpegvideo: Use "goto fail" for all error paths in ff_mpv_common_frame_size_change()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2762323c37511fbbc98b164c07620b9ebc59ec68)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
f68395f7fc avcodec/h264: Allow partial escaping
Fixes Ticket3923

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:59 +02:00
Michael Niedermayer
eefb6b654d avformat/swfdec: Do not change the pixel format
This is currently not supported
Fixes part of Ticket 3539

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Michael Niedermayer
d18d48def6 avformat/swfdec: Use side data to communicate w/h changes to the decoder
Fixes reading from freed data
Fixes part of Ticket3539

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Mika Raento
8df77c3758 segment: don't access outside seg->frames array
Fixes wrong number of segments output and undefined memory access.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Mark Harris
08f56b846c doc/filters.texi: fix filter name in examples
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1b3a98f137900b6c3eb9a4c177d0b25684d6d144)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Michael Niedermayer
f903147f2d avcodec/mjpegdec: fix green line at the bottom with upscale v
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f0d4f00f24d41441ebd63694df57ab203a764aa5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Michael Niedermayer
9a840d5e17 avcodec/mjpegdec: fix green vertical line at the right with upscale h
Fixes Ticket3891

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
wm4
9e43d92d6a oggdec: fix invalid free on error
The read_packet callback passes a pointer to a stack-allocated AVPacket.
Attempting to free it with av_free() makes no sense.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Michael Niedermayer
e13e928baa avcodec/snow: check coeffs for validity
Fixes deadlock
Fixes integer overflow
Fixes Ticket 3892

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Michael Niedermayer
d3bfb66a66 ffmpeg: Fix missing {} in Stream to Packet side data code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 31f9c228c042e7f0a017670e7eb18d9b27a71a10)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:40:58 +02:00
Michael Niedermayer
17a6ca7d31 avcodec/vc1dec: fix null pointer dereference
Fixes Ticket3860

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:16:38 +02:00
Michael Niedermayer
8a20224059 avcodec/utils: add GBRP16 to avcodec_align_dimensions2()
Fixes Ticket3869

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:16:37 +02:00
Michael Niedermayer
29ee8b72c4 avcodec: fix aac/ac3 parser bitstream buffer size
Buffers containing copies of the AAC and AC3 header bits were not padded
before parsing, violating init_get_bits() buffer padding requirement,
leading to potential buffer read overflows.
This change adds FF_INPUT_BUFFER_PADDING_SIZE bytes to the bit buffer
for parsing the header in each of aac_parser.c and ac3_parser.c.

Based on patch by: Matt Wolenetz <wolenetz@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fccd85b9f30525f88692f53134eba41f1f2d90db)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 03:16:37 +02:00
Christophe Gisquet
25864cf562 wavpackenc: proper buffer allocation
The allocation didn't account for headers, that can be easily 79 bytes.
As a result, buffers allocated for a few samples (e.g. 5 in the original
bug) could be undersized.

Fixed ticket #2881.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 02:51:57 +02:00
Christophe Gisquet
f74206cb40 wavpack: report if there is no bits left
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 11a39bdf534a4ead634b4a593c66ebf756910b9b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 02:51:57 +02:00
Clément Bœsch
148d9cd122 avformat/vobsub: fix NULL dereference
(cherry picked from commit d86cf4a91de2aa9e167a73b56fb59962230e3a32)
2014-09-13 15:18:11 +02:00
Michael Niedermayer
bc259185cb Update for FFmpeg 2.3.3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-17 15:30:38 +02:00
Michael Niedermayer
3b6bde3b3d avcodec/h264_mb: fix grayscale only decoding with weighted prediction
Fixes Ticket3412

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-17 15:09:05 +02:00
Michael Niedermayer
4f187f0af1 avformat/mpegts: Use differential score for analyze()
This avoids high scores in random data that has a high 0x47 frequency

Fixes Ticket3844

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-16 23:59:26 +02:00
Michael Niedermayer
10c2d22ba1 avcodec/mjpegdec: Support AV_PIX_FMT_YUV420P16 with upscale_h
Fixes assertion failure
Fixes: test42f.jpg
Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5c7899a4834ee927f5629e4c02bfa225b846f016)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-14 16:53:36 +02:00
Christophe Gisquet
35738e5898 proresenc_kostya: properly account for alpha
The packet buffer allocation considered as dct-coded, while it is
actually run-coded and thus requires a larger buffer.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-14 15:44:54 +02:00
Justin Jacobs
59d98fc050 avformat/matroskadec: Check avpriv_new_chapter() for failure
Fixes null pointer dereference

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-14 03:26:34 +02:00
Christophe Gisquet
60bfa9154d proresenc_kostya: report buffer overflow
If the allocated size, despite best efforts, is too small, exit
with the appropriate error.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 02:40:15 +02:00
Christophe Gisquet
9794727ccd proresenc_kostya: remove unneeded parameters
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bf10f09bccdcfdb41b9f5bbae01d55961bfd0693)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 02:40:14 +02:00
Michael Niedermayer
b88de7b31a Changelog: update for 2.3.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 17:06:48 +02:00
Michael Niedermayer
11420649d0 avcodec/snow: fix null pointer dereference in cleanup after allocation failure
Fixes: snowf.avi
Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9a162146ca6cc12ef7ad4a15164349482885962c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 15:45:42 +02:00
Michael Niedermayer
dbf5d7e5cd avcodec/huffyuvdec: fix overread checks
Fixes: ffvhuff_f.avi
Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba47d519e537299179d20b9a599c5824589a3f7a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 15:32:00 +02:00
Michael Niedermayer
6badd558ce avcodec/get_bits: add BITS_LEFT() for finding the bits left with an opened reader
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 11512d70facf42fb490168d33a5986448cf36074)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 15:31:59 +02:00
Michael Niedermayer
a1fe3b4150 avcodec/vc1dec: do not crash when flushing without an allocated frame
Fixes Ticket3837
Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6801eb0a0981f113f5f09ed4799d9ae805af62a3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 02:26:29 +02:00
Michael Niedermayer
c5129da726 update for FFmpeg 2.3.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
fc57959fd5 avcodec/iff: Factorize av_pix_fmt_desc_get() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9bcdb98839f3d883867d87c6425e67ed7bcc7149)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
83956309cc avcodec/iff: check pixfmt for rgb8 / rgbn
Fixes out of array access

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3539d6c63a16e1b2874bb037a86f317449c58770)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
ed15be7519 avformat/matroskaenc: fix MAX_CUEPOINT_SIZE calculation
Fixes assertion failure
Fixes Ticket3822

as a side-effect this makes some mkv files a few bytes smaller

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Felix Abecassis
6928193493 h264: fix interpretation of interleved stereo modes
Column and row frame packing arrangements were inverted.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
(cherry picked from commit a7e541c9926d531a100ba0d36f4e56956dd84651)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Anton Khirnov
a72b7286e6 cdgraphics: do not return 0 from the decode function
0 means no data consumed, so it can trigger an infinite loop in the
caller.

CC:libav-stable@libav.org
(cherry picked from commit c7d9b473e28238d4a4ef1b7e8b42c1cca256da36)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
901e275697 avutil/cpu: add aarch64 entries to 2nd table
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit efc4fe9d74a5040e465dbff80b29468dbc227c19)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
7a6b5d7a86 ffserver: initialize pbuffer in prepare_sdp_description()
also check pbuffer before use

Found-by: CSA
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1d8d21b90ab91aa471f369e0f9d1ea20fb40733b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
fdfe94f4b1 avcodec/wavpackenc: Fix log2sample() result value
Found-by: CSA
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e706fe764049b3f1ccf10ba9f686426a4c007906)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
b63ec0cb0f avformat/tee: flip assigment direction
Found-by: CSA
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2e6fdcb7f3c86491408a3699f0aa9dc52b7c5686)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 22:40:50 +02:00
Michael Niedermayer
2eb72d5bdc ffmpeg_opt: Use av_guess_codec() instead of AVOutputFormat->*codec
Fixes part of ticket2236

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 03:41:46 +02:00
Michael Niedermayer
638c3aca64 avcodec/dvdsub_parser: print message if packet is smaller than the packet size field
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bcc898dd2643c883522ffa565be4b226ce798c78)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 01:27:04 +02:00
Michael Niedermayer
76d59f1b34 avcodec/dvdsub_parser: Check buf_size before reading 32bit packet size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 81c1657a593b1c0f8e46fca00ead1d30ee1cd418)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 01:27:03 +02:00
Michael Niedermayer
aa0a8ef50e avcodec/dvdsub_parser: never return 0 when the input isnt 0
Fixes a infinite loop
Fixes Ticket3804

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 01:27:02 +02:00
Michael Niedermayer
d6173ae341 avcodec/mpeg12dec: fix support for interlaced mpeg2 with missing last slice
Fixes Ticket3809

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-01 21:20:43 +02:00
Anshul Maheswhwari
3ed27832e7 v4l2enc: adding AVClass
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fcb11ec291e9b3e3f352fa4d3e9026c0f7f64aa8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 19:06:12 +02:00
Michael Niedermayer
594b1fa961 libavcodec/h264_parser: Increase parse_history, fix huge resolutions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0782fb6bcb32fe3ab956a99af4cc472ff81da0c2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 16:50:32 +02:00
Benoit Fouet
7a1262fca3 h264_mp4toannexb_bsf: account for consecutive IDR pictures.
If there are consecutive IDR pictures, then SPS/PPS should be prepended
to all of them, not only the first one.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 16:50:31 +02:00
Chris \"Koying\" Browet
6d2219e9f9 avcodec/h264_mp4toannexb_bsf: fix issue when sps/pps are already in the bistream
(cherry picked from commit ad91bf854b559f1afc42fc06f8a7dfbb75def5c8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 16:50:26 +02:00
Michael Niedermayer
7c2d152f56 Changelog: highlighting for 2.3.1
Suggested-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 03:17:03 +02:00
Gerion Entrup
1f58590e1e doc: add very basic libcdio documentation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dc315cdb4ecffb7ec4d3496f1d0c8d0c123f0a7b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 03:08:04 +02:00
Michael Niedermayer
64bbbcd7b0 update for FFmpeg 2.3.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-30 23:14:25 +02:00
Michael Niedermayer
de9d3f22f0 avdevice/pulse_audio_enc: use getter function for AVFrame.channels
This is required by the API/ABI for things outside libavutil

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-30 22:39:08 +02:00
Michael Niedermayer
ea5bb5613f MAINTAINERS: update list of releases i maintain
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5003b8b9c3bacc4e542c923a7766c2ff46e0b1e8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-30 22:39:08 +02:00
Michael Niedermayer
c61ac696e5 avcodec/avdct: Add avcodec_dct_get_class()
This should have been in the initial commit of AVDCT

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-30 22:39:08 +02:00
Janne Grunau
6a250c858e fate: support testing of release branches
Adding 'branch=release/2.3' to the fate config file will check the
release/2.3 branch instead of master. If no branch is specified it will
use 'master' so that existing config are still valid.

(cherry picked from commit 42eb9154a83e9a7aedb1168b2f1112af765cf2b5)

Conflicts:

	tests/fate.sh
2014-07-30 22:39:08 +02:00
Michael Niedermayer
5411040802 tests/fate.sh: If cat *.rep fails try it with a for loop.
Fixes fate on haiku, where cat dies due to too many arguments
xargs could be used too but we do not use xargs currently so it
would be an additional dependency.

Also the plain cat is left in place as it is faster than the loop

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

Conflicts:

	tests/fate.sh
2014-07-30 22:39:08 +02:00
Vittorio Giovara
ab1ea597bd g2meet: allow size changes within original sizes
(cherry picked from commit 14b4e64eabc84c5a5e57c8ccc56bbeb95380823b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-30 22:32:01 +02:00
Michael Niedermayer
ee606fd031 version.sh: Print versions based on the last git tag for release branches
release branches are detected by checking if "git" is not in RELEASE
This changes "N-64706-g2f71aeb" to "n2.3-8-g2f71aeb"
for git master theres no change

This should improve the readability of lists of versions which come from
more than 1 release branch or master + release. fate.ffmpeg.org is
one possible example

Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-28 14:48:50 +02:00
Michael Niedermayer
2f71aeb301 remove VERSION file
it overrides what version.sh prints and thus makes its output
from release branches rather useless

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-28 02:22:11 +02:00
Christophe Gisquet
65259b4d68 x86: hevc_mc: replace one lea by add
Should have been in 036f11bdb565.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 17:32:01 +02:00
Michael Niedermayer
8f53d32dfb avfilter/vf_spp: use AVDCT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e3fac208246f5f94cfc4d3abdb1a4770272f96ee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-27 17:28:41 +02:00
Michael Niedermayer
fcc6568a10 avcodec: add avdct
This provides a public sustainable API/ABI for DCT functions.
Only externally used dct functions are included.
The structure is extensible without ABI issues compared to the
existing dct contexts.

See Mailing list and IRC log of 2014-07-26/27

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

Conflicts:

	doc/APIchanges
2014-07-27 17:28:32 +02:00
Timothy Gu
489d066d49 RELEASE_NOTES: fix WebVTT decoder typo (-> encoder)
Found-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 065fa668723687eba234ba93bc9aa532d68c8d1c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-25 13:22:26 +02:00
Michael Niedermayer
9cb45f6ad2 doc/APIchanges: mention FF_INPUT_BUFFER_PADDING_SIZE chage
Suggested-by: Andreas Cadhalpun
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 94c4ad27dc6305a7e1f218b86311db019e41f632)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 05:22:25 +02:00
Andreas Cadhalpun
0f04e2741e libavformat/img2dec.c: Add a long_name to the piped image demuxers
This fixes segfaults in gst-libav1.0 compiled against FFmpeg 2.3.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 05:21:50 +02:00
Michael Niedermayer
84642ec879 avformat/dv: implement fallback in dv_extract_pack()
Fixes Ticket2340
Fixes Ticket2341

Based-on mail from Dave Rice <dave@dericed.com>
Tested-by: Dave Rice <dave@dericed.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 88f038ac97a875f25c2eceac6d2107a09314984c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-17 16:00:21 +02:00
Timothy Gu
bef4d9bf87 RELEASE_NOTES: update
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-16 02:42:16 +02:00
Michael Niedermayer
bc4f6ae88e Changelog: change "version <next>" to "version 2.3"
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit faafd1e4f1fcc2d618633eae4dc532050b2be988)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-16 02:09:50 +02:00
Michael Niedermayer
2678b25099 doc/APIchanges: update
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 13a72d9b08c914c3d3c99be1053e9d5cda8baa88)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-16 02:07:02 +02:00
Michael Niedermayer
e322496054 RELEASE_NOTES: update version numbers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-16 02:01:14 +02:00
Michael Niedermayer
7fa72ff19c update for FFmpeg 2.3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-16 01:45:34 +02:00
154 changed files with 1198 additions and 458 deletions

View File

@ -1,7 +1,31 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version <next>:
version 2.3.3:
- h264: fix grayscale only decoding with weighted prediction
- mjpegdec: support AV_PIX_FMT_YUV420P16 with upscale_h
- proresenc_ks: fix buffer overflow
- matroskadec: fix crash
version 2.3.2:
- snow: fix null pointer dereference
- huffyucdec: fix overread
- vc1dec: fix crash
- iff: fix out of array access
- matroskaenc: fix assertion failure
- cdgraphics: fix infinite loop
- dvdsub_parser: fix infinite loop
- mpeg12dec: support decoding some broken files
- v4l2enc: fix crash
- h264_parser: fix handling huge resolutions
- h264_mp4toannexb_bsf: multiple bugfixes
version 2.3.1:
- public AVDCT API/ABI for DCT functions
- g2meet: allow size changes within original sizes
- dv: improved error resilience, fixing Ticket2340 and Ticket2341
version 2.3:
- AC3 fixed-point decoding
- shuffleplanes filter
- subfile protocol

View File

@ -14,7 +14,6 @@ patches and related discussions.
Project Leader
==============
Michael Niedermayer
final design decisions
@ -528,8 +527,8 @@ x86 Michael Niedermayer
Releases
========
2.3 Michael Niedermayer
2.2 Michael Niedermayer
2.1 Michael Niedermayer
1.2 Michael Niedermayer
If you want to maintain an older release, please contact us

View File

@ -110,7 +110,7 @@ endef
$(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)
$(CP) $< $@

View File

@ -1 +1 @@
2.2.git
2.3.6

View File

@ -7,9 +7,10 @@
since the release of FFmpeg 2.2.
In this release, there are lots of internal overhauls that make FFmpeg a
more accessible project for new developers. Many important new features
like QTKit and AVFoundation input devices are committed. Contributions done
by Libav such as a new native Opus decoder are also merged.
more accessible project for new developers. Many important new
optimizations and features like QTKit and AVFoundation input devices are
committed. Contributions done by Libav such as a new native Opus decoder
are also merged.
Because of the increasing difficulty to maintain and lack of maintainers,
we are very sorry to say that we have removed all Blackfin and SPARC
@ -17,8 +18,9 @@
interested in maintaining optimization for these two architecture, feel
free to contact us and we will restore the code!
Since this release, the traditional Changelog file is upgraded to this
modern-looking release note. Old changelogs are moved to doc/Changelog.old.
Oh, and since this release, this modern-looking release note is provided in
addition to the old-style Changelog file, to make it easier for you to
focus on the most important features in this release.
Enjoy!
@ -33,9 +35,9 @@
• libavutil 52.92.100
• libavcodec 55.69.100
• libavformat 55.47.100
• libavformat 55.48.100
• libavdevice 55.13.102
• libavfilter 4.10.100
• libavfilter 4.11.100
• libswscale 2. 6.100
• libswresample 0.19.100
• libpostproc 52. 3.100
@ -103,7 +105,7 @@
Other interesting new features including hqx video filter, a pixel art
scaling filter; a fixed-point AC-3 decoder contributed by Imagination
Technologies; an On2 TrueMotion VP7 video decoder; an HTML5 WebVTT
subtitle decoder that allows creation of WebVTT from any text-based
subtitle encoder that allows creation of WebVTT from any text-based
subtitles; and an 1-bit Direct Stream Digital audio decoder.
┌────────────────────────────┐

View File

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

2
configure vendored
View File

@ -4528,6 +4528,7 @@ EOF
fi
check_ldflags -Wl,--as-needed
check_ldflags -Wl,-z,noexecstack
if check_func dlopen; then
ldl=
@ -5534,6 +5535,7 @@ enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
mkdir -p doc
mkdir -p tests
echo "@c auto-generated by configure" > doc/config.texi
print_config ARCH_ "$config_files" $ARCH_LIST

View File

@ -15,13 +15,13 @@ libavutil: 2012-10-22
API changes, most recent first:
2014-07-14 - xxxxxxx - lavf 55.47.100 - avformat.h
2014-07-14 - 62227a7 - lavf 55.47.100 - avformat.h
Add av_stream_get_parser()
2014-07-xx - xxxxxxx - lavu 53.18.0 - display.h
2014-07-09 - c67690f / a54f03b - lavu 52.92.100 / 53.18.0 - display.h
Add av_display_matrix_flip() to flip the transformation matrix.
2014-07-xx - xxxxxxx - lavc 55.56.0 - dv_profile.h
2014-07-09 - 1b58f13 / f6ee61f - lavc 55.69.100 / 55.56.0 - dv_profile.h
Add a public API for DV profile handling.
2014-06-20 - 0dceefc / 9e500ef - lavu 52.90.100 / 53.17.0 - imgutils.h
@ -35,6 +35,10 @@ API changes, most recent first:
is now setting AVStream.time_base, instead of AVStream.codec.time_base as was
done previously. The old method is now deprecated.
2014-06-11 - 67d29da - lavc 55.66.101 - avcodec.h
Increase FF_INPUT_BUFFER_PADDING_SIZE to 32 due to some corner cases needing
it
2014-06-10 - xxxxxxx - lavf 55.43.100 - avformat.h
New field int64_t max_analyze_duration2 instead of deprecated
int max_analyze_duration.
@ -42,7 +46,7 @@ API changes, most recent first:
2014-05-30 - 00759d7 - lavu 52.89.100 - opt.h
Add av_opt_copy()
2014-04-xx - 03bb99a / 0957b27 - lavc 55.66.100 / 55.54.0 - avcodec.h
2014-06-01 - 03bb99a / 0957b27 - lavc 55.66.100 / 55.54.0 - avcodec.h
Add AVCodecContext.side_data_only_packets to allow encoders to output packets
with only side data. This option may become mandatory in the future, so all
users are recommended to update their code and enable this option.
@ -52,7 +56,7 @@ API changes, most recent first:
AVColorTransferCharacteristic, and AVChromaLocation) inside lavu.
And add AVFrame fields for them.
2014-04-xx - bdb2e80 / b2d4565 - lavr 1.3.0 - avresample.h
2014-05-29 - bdb2e80 / b2d4565 - lavr 1.3.0 - avresample.h
Add avresample_max_output_samples
2014-05-24 - d858ee7 / 6d21259 - lavf 55.42.100 / 55.19.0 - avformat.h
@ -101,10 +105,10 @@ API changes, most recent first:
2014-05-11 - 14aef38 / 66e6c8a - lavu 52.83.100 / 53.14.0 - pixfmt.h
Add AV_PIX_FMT_VDA for new-style VDA acceleration.
2014-05-xx - xxxxxxx - lavu 52.82.0 - fifo.h
2014-05-xx - xxxxxxx - lavu 52.82.100 - fifo.h
Add av_fifo_freep() function.
2014-05-02 - ba52fb11 - lavu 52.81.0 - opt.h
2014-05-02 - ba52fb11 - lavu 52.81.100 - opt.h
Add av_opt_set_dict2() function.
2014-05-01 - e77b985 / a2941c8 - lavc 55.60.103 / 55.50.3 - avcodec.h

View File

@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER =
PROJECT_NUMBER = 2.3.6
# 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

View File

@ -116,6 +116,10 @@ static int open_output_file(const char *filename)
|| dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
/* in this example, we choose transcoding to same codec */
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,
* sample rate etc.). These properties can be changed for output

View File

@ -491,7 +491,7 @@ aeval=val(ch)/2:c=same
@item
Invert phase of the second channel:
@example
eval=val(0)|-val(1)
aeval=val(0)|-val(1)
@end example
@end itemize
@ -3968,7 +3968,7 @@ within the parameter list.
@item
Show the text at the center of the video frame:
@example
drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
@end example
@item
@ -9318,7 +9318,7 @@ Default value is "all", which will cycle through the list of all tests.
Some examples:
@example
testsrc=t=dc_luma
mptestsrc=t=dc_luma
@end example
will generate a "dc_luma" test pattern.

View File

@ -483,6 +483,21 @@ ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
@end itemize
@section libcdio
Audio-CD input device based on cdio.
To enable this input device during configuration you need libcdio
installed on your system.
This device allows playing and grabbing from an Audio-CD.
For example to copy with @command{ffmpeg} the entire Audio-CD in /dev/sr0,
you may run the command:
@example
ffmpeg -f libcdio -i /dev/sr0 cd.wav
@end example
@section libdc1394
IIDC1394 input device, based on libdc1394 and libraw1394.

View File

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

View File

@ -578,6 +578,14 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
AVCodecContext *avctx = ost->st->codec;
int ret;
if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) {
ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (ost->st->codec->extradata) {
memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size);
ost->st->codec->extradata_size = ost->enc_ctx->extradata_size;
}
}
if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) ||
(avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))
pkt->pts = pkt->dts = AV_NOPTS_VALUE;
@ -1799,18 +1807,10 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
for (i = 0; i < nb_filtergraphs; i++)
if (ist_in_filtergraph(filtergraphs[i], ist)) {
FilterGraph *fg = filtergraphs[i];
int j;
if (configure_filtergraph(fg) < 0) {
av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
exit_program(1);
}
for (j = 0; j < fg->nb_outputs; j++) {
OutputStream *ost = fg->outputs[j]->ost;
if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
!(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
av_buffersink_set_frame_size(ost->filter->filter,
ost->enc_ctx->frame_size);
}
}
}
@ -3419,7 +3419,7 @@ static int process_input(int file_index)
}
/* add the stream-global side data to the first packet */
if (ist->nb_packets == 1)
if (ist->nb_packets == 1) {
if (ist->st->nb_side_data)
av_packet_split_side_data(&pkt);
for (i = 0; i < ist->st->nb_side_data; i++) {
@ -3435,6 +3435,7 @@ static int process_input(int file_index)
memcpy(dst_data, src_sd->data, src_sd->size);
}
}
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);

View File

@ -919,6 +919,16 @@ int configure_filtergraph(FilterGraph *fg)
}
fg->reconfiguration = 1;
for (i = 0; i < fg->nb_outputs; i++) {
OutputStream *ost = fg->outputs[i]->ost;
if (ost &&
ost->enc->type == AVMEDIA_TYPE_AUDIO &&
!(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
av_buffersink_set_frame_size(ost->filter->filter,
ost->enc_ctx->frame_size);
}
return 0;
}

View File

@ -1828,7 +1828,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
/* pick the "best" stream of each type */
/* video: highest resolution */
if (!o->video_disable && oc->oformat->video_codec != AV_CODEC_ID_NONE) {
if (!o->video_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_VIDEO) != AV_CODEC_ID_NONE) {
int area = 0, idx = -1;
int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
for (i = 0; i < nb_input_streams; i++) {
@ -1850,7 +1850,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
}
/* audio: most channels */
if (!o->audio_disable && oc->oformat->audio_codec != AV_CODEC_ID_NONE) {
if (!o->audio_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) {
int channels = 0, idx = -1;
for (i = 0; i < nb_input_streams; i++) {
ist = input_streams[i];

View File

@ -2977,6 +2977,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
AVDictionaryEntry *entry = av_dict_get(stream->metadata, "title", NULL, 0);
int i;
*pbuffer = NULL;
avc = avformat_alloc_context();
if (avc == NULL || !rtp_format) {
return -1;
@ -3013,7 +3015,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
av_free(avc);
av_free(avs);
return strlen(*pbuffer);
return *pbuffer ? strlen(*pbuffer) : AVERROR(ENOMEM);
}
static void rtsp_cmd_options(HTTPContext *c, const char *url)

View File

@ -15,6 +15,7 @@ HEADERS = avcodec.h \
OBJS = allcodecs.o \
audioconvert.o \
avdct.o \
avpacket.o \
avpicture.o \
bitstream.o \

View File

@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
int size;
union {
uint64_t u64;
uint8_t u8[8];
uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
} tmp;
tmp.u64 = av_be2ne64(state);

View File

@ -166,7 +166,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
int err;
union {
uint64_t u64;
uint8_t u8[8];
uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
} tmp = { av_be2ne64(state) };
AC3HeaderInfo hdr, *phdr = &hdr;
GetBitContext gbc;

View File

@ -263,7 +263,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
energy_cpl = energy[blk][CPL_CH][bnd];
energy_ch = energy[blk][ch][bnd];
blk1 = blk+1;
while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) {
while (blk1 < s->num_blocks && !s->blocks[blk1].new_cpl_coords[ch]) {
if (s->blocks[blk1].cpl_in_use) {
energy_cpl += energy[blk1][CPL_CH][bnd];
energy_ch += energy[blk1][ch][bnd];

124
libavcodec/avdct.c Normal file
View File

@ -0,0 +1,124 @@
/*
* Copyright (c) 2014 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "idctdsp.h"
#include "fdctdsp.h"
#include "avdct.h"
#define OFFSET(x) offsetof(AVDCT,x)
#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
//these names are too long to be readable
#define V AV_OPT_FLAG_VIDEO_PARAM
#define A AV_OPT_FLAG_AUDIO_PARAM
#define E AV_OPT_FLAG_ENCODING_PARAM
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption avdct_options[] = {
{"dct", "DCT algorithm", OFFSET(dct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E, "dct"},
{"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"},
{"fastint", "fast integer (experimental / for debugging)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"},
{"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"},
{"mmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"},
{"altivec", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"},
{"faan", "floating point AAN DCT (experimental / for debugging)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"},
{"idct", "select IDCT implementation", OFFSET(idct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E|D, "idct"},
{"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_AUTO }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"int", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_INT }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"simple", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"simplemmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"arm", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"altivec", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"},
#if FF_API_ARCH_SH4
{"sh4", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"},
#endif
{"simplearm", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"simplearmv5te", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"simplearmv6", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"simpleneon", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"},
#if FF_API_ARCH_ALPHA
{"simplealpha", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"},
#endif
{"ipp", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"xvidmmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVIDMMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"faani", "floating point AAN IDCT (experimental / for debugging)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"},
{"simpleauto", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEAUTO }, INT_MIN, INT_MAX, V|E|D, "idct"},
{NULL},
};
static const AVClass avdct_class = {
.class_name = "AVDCT",
.option = avdct_options,
.version = LIBAVUTIL_VERSION_INT,
};
const AVClass *avcodec_dct_get_class(void)
{
return &avdct_class;
}
AVDCT *avcodec_dct_alloc(void)
{
AVDCT *dsp = av_mallocz(sizeof(AVDCT));
if (!dsp)
return NULL;
dsp->av_class = &avdct_class;
av_opt_set_defaults(dsp);
return dsp;
}
int avcodec_dct_init(AVDCT *dsp)
{
AVCodecContext *avctx = avcodec_alloc_context3(NULL);
if (!avctx)
return AVERROR(ENOMEM);
avctx->idct_algo = dsp->idct_algo;
avctx->dct_algo = dsp->dct_algo;
#define COPY(src, name) memcpy(&dsp->name, &src.name, sizeof(dsp->name))
#if CONFIG_IDCTDSP
{
IDCTDSPContext idsp;
ff_idctdsp_init(&idsp, avctx);
COPY(idsp, idct);
COPY(idsp, idct_permutation);
}
#endif
#if CONFIG_FDCTDSP
{
FDCTDSPContext fdsp;
ff_fdctdsp_init(&fdsp, avctx);
COPY(fdsp, fdct);
}
#endif
avcodec_close(avctx);
av_free(avctx);
return 0;
}

78
libavcodec/avdct.h Normal file
View File

@ -0,0 +1,78 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_AVDCT_H
#define AVCODEC_AVDCT_H
#include "libavutil/opt.h"
/**
* AVDCT context.
* @note function pointers can be NULL if the specific features have been
* disabled at build time.
*/
typedef struct AVDCT {
const AVClass *av_class;
void (*idct)(int16_t *block /* align 16 */);
/**
* IDCT input permutation.
* Several optimized IDCTs need a permutated input (relative to the
* normal order of the reference IDCT).
* This permutation must be performed before the idct_put/add.
* Note, normally this can be merged with the zigzag/alternate scan<br>
* An example to avoid confusion:
* - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
* - (x -> reference DCT -> reference IDCT -> x)
* - (x -> reference DCT -> simple_mmx_perm = idct_permutation
* -> simple_idct_mmx -> x)
* - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
* -> simple_idct_mmx -> ...)
*/
uint8_t idct_permutation[64];
void (*fdct)(int16_t *block /* align 16 */);
/**
* DCT algorithm.
* must use AVOptions to set this field.
*/
int dct_algo;
/**
* IDCT algorithm.
* must use AVOptions to set this field.
*/
int idct_algo;
} AVDCT;
/**
* Allocates a AVDCT context.
* This needs to be initialized with avcodec_dct_init() after optionally
* configuring it with AVOptions.
*
* To free it use av_free()
*/
AVDCT *avcodec_dct_alloc(void);
int avcodec_dct_init(AVDCT *);
const AVClass *avcodec_dct_get_class(void);
#endif /* AVCODEC_AVDCT_H */

View File

@ -32,6 +32,10 @@
#include "cabac.h"
#include "config.h"
#ifndef UNCHECKED_BITSTREAM_READER
#define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
#endif
#if ARCH_AARCH64
# include "aarch64/cabac.h"
#endif

View File

@ -353,10 +353,9 @@ static int cdg_decode_frame(AVCodecContext *avctx,
*got_frame = 1;
} else {
*got_frame = 0;
buf_size = 0;
}
return buf_size;
return avpkt->size;
}
static av_cold int cdg_decode_end(AVCodecContext *avctx)

View File

@ -135,7 +135,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip,
const uint8_t *eod = (data + size);
uint32_t flag, mask;
uint8_t *cb0, *cb1, *cb2, *cb3;
unsigned int x, y;
int x, y;
char *ip0, *ip1, *ip2, *ip3;
flag = 0;

View File

@ -1215,8 +1215,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->num_subpackets++;
s++;
if (s > MAX_SUBPACKETS) {
avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS);
if (s > FFMIN(MAX_SUBPACKETS, avctx->block_align)) {
avpriv_request_sample(avctx, "subpackets > %d", FFMIN(MAX_SUBPACKETS, avctx->block_align));
return AVERROR_PATCHWELCOME;
}
}

View File

@ -2359,6 +2359,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
#else
if (s->xch_present && !s->xch_disable) {
#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;
if (s->lfe) {
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;

View File

@ -171,6 +171,10 @@ static inline int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_c
{
int ret = 1;
while (!dirac_get_arith_bit(c, follow_ctx)) {
if (ret >= 0x40000000) {
av_log(NULL, AV_LOG_ERROR, "dirac_get_arith_uint overflow\n");
return -1;
}
ret <<= 1;
ret += dirac_get_arith_bit(c, data_ctx);
follow_ctx = ff_dirac_next_ctx[follow_ctx];

View File

@ -611,10 +611,10 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b
top = 0;
for (cb_y = 0; cb_y < cb_height; cb_y++) {
bottom = (b->height * (cb_y+1)) / cb_height;
bottom = (b->height * (cb_y+1LL)) / cb_height;
left = 0;
for (cb_x = 0; cb_x < cb_width; cb_x++) {
right = (b->width * (cb_x+1)) / cb_width;
right = (b->width * (cb_x+1LL)) / cb_width;
codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith);
left = right;
}
@ -1003,8 +1003,8 @@ static int dirac_unpack_idwt_params(DiracContext *s)
/* Codeblock parameters (core syntax only) */
if (get_bits1(gb)) {
for (i = 0; i <= s->wavelet_depth; i++) {
CHECKEDREAD(s->codeblock[i].width , tmp < 1, "codeblock width invalid\n")
CHECKEDREAD(s->codeblock[i].height, tmp < 1, "codeblock height invalid\n")
CHECKEDREAD(s->codeblock[i].width , tmp < 1 || tmp > (s->avctx->width >>s->wavelet_depth-i), "codeblock width invalid\n")
CHECKEDREAD(s->codeblock[i].height, tmp < 1 || tmp > (s->avctx->height>>s->wavelet_depth-i), "codeblock height invalid\n")
}
CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock mode\n")

View File

@ -38,6 +38,7 @@ typedef struct DNXHDContext {
BlockDSPContext bdsp;
int64_t cid; ///< compression id
unsigned int width, height;
enum AVPixelFormat pix_fmt;
unsigned int mb_width, mb_height;
uint32_t mb_scan_index[68]; /* max for 1080p */
int cur_field; ///< current interlaced field
@ -141,7 +142,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
ctx->is_444 = 0;
if (buf[0x4] == 0x2) {
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
ctx->pix_fmt = AV_PIX_FMT_YUV444P10;
ctx->avctx->bits_per_raw_sample = 10;
if (ctx->bit_depth != 10) {
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
@ -151,7 +152,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
}
ctx->is_444 = 1;
} else if (buf[0x21] & 0x40) {
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
ctx->avctx->bits_per_raw_sample = 10;
if (ctx->bit_depth != 10) {
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
@ -160,7 +161,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
}
} else {
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
ctx->avctx->bits_per_raw_sample = 8;
if (ctx->bit_depth != 8) {
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
@ -446,7 +447,13 @@ decode_coding_unit:
avctx->width, avctx->height, ctx->width, ctx->height);
first_field = 1;
}
if (avctx->pix_fmt != AV_PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {
av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",
av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));
first_field = 1;
}
avctx->pix_fmt = ctx->pix_fmt;
ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
if (ret < 0)
return ret;

View File

@ -45,8 +45,11 @@ static int dvdsub_parse(AVCodecParserContext *s,
DVDSubParseContext *pc = s->priv_data;
if (pc->packet_index == 0) {
if (buf_size < 2)
return 0;
if (buf_size < 2 || AV_RB16(buf) && buf_size < 6) {
if (buf_size)
av_log(avctx, AV_LOG_DEBUG, "Parser input %d too small\n", buf_size);
return buf_size;
}
pc->packet_len = AV_RB16(buf);
if (pc->packet_len == 0) /* HD-DVD subpicture packet */
pc->packet_len = AV_RB32(buf+2);

View File

@ -105,6 +105,9 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
int x, y, len, color;
uint8_t *d;
if (start >= buf_size)
return -1;
bit_len = (buf_size - start) * 8;
init_get_bits(&gb, buf + start, bit_len);
@ -356,10 +359,12 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
sub_header->num_rects = 1;
sub_header->rects[0]->pict.data[0] = bitmap;
decode_rle(bitmap, w * 2, w, (h + 1) / 2,
buf, offset1, buf_size, is_8bit);
decode_rle(bitmap + w, w * 2, w, h / 2,
buf, offset2, buf_size, is_8bit);
if (decode_rle(bitmap, w * 2, w, (h + 1) / 2,
buf, offset1, buf_size, is_8bit) < 0)
goto fail;
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);
if (is_8bit) {
if (yuv_palette == 0)

View File

@ -329,6 +329,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
DxaDecContext * const c = avctx->priv_data;
if (avctx->width%4 || avctx->height%4) {
avpriv_request_sample(avctx, "dimensions are not a multiple of 4");
return AVERROR_INVALIDDATA;
}
c->prev = av_frame_alloc();
if (!c->prev)
return AVERROR(ENOMEM);

View File

@ -1011,6 +1011,22 @@ static int decode_header(EXRContext *s)
int current_channel_offset = 0;
int magic_number, version, flags, i;
s->xmin = ~0;
s->xmax = ~0;
s->ymin = ~0;
s->ymax = ~0;
s->xdelta = ~0;
s->ydelta = ~0;
s->channel_offsets[0] = -1;
s->channel_offsets[1] = -1;
s->channel_offsets[2] = -1;
s->channel_offsets[3] = -1;
s->pixel_type = EXR_UNKNOWN;
s->compression = EXR_UNKN;
s->nb_channels = 0;
s->w = 0;
s->h = 0;
if (bytestream2_get_bytes_left(&s->gb) < 10) {
av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
return AVERROR_INVALIDDATA;
@ -1351,21 +1367,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
float one_gamma = 1.0f / s->gamma;
s->avctx = avctx;
s->xmin = ~0;
s->xmax = ~0;
s->ymin = ~0;
s->ymax = ~0;
s->xdelta = ~0;
s->ydelta = ~0;
s->channel_offsets[0] = -1;
s->channel_offsets[1] = -1;
s->channel_offsets[2] = -1;
s->channel_offsets[3] = -1;
s->pixel_type = EXR_UNKNOWN;
s->compression = EXR_UNKN;
s->nb_channels = 0;
s->w = 0;
s->h = 0;
if ( one_gamma > 0.9999f && one_gamma < 1.0001f ) {
for ( i = 0; i < 65536; ++i ) {

View File

@ -101,7 +101,7 @@ av_cold int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
av_cold int ffv1_init_slices_state(FFV1Context *f)
{
int i, ret;
for (i = 0; i < f->slice_count; i++) {
for (i = 0; i < f->max_slice_count; i++) {
FFV1Context *fs = f->slice_context[i];
if ((ret = ffv1_init_slice_state(f, fs)) < 0)
return AVERROR(ENOMEM);
@ -113,10 +113,10 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
{
int i;
f->slice_count = f->num_h_slices * f->num_v_slices;
av_assert0(f->slice_count > 0);
f->max_slice_count = f->num_h_slices * f->num_v_slices;
av_assert0(f->max_slice_count > 0);
for (i = 0; i < f->slice_count; i++) {
for (i = 0; i < f->max_slice_count; i++) {
FFV1Context *fs = av_mallocz(sizeof(*fs));
int sx = i % f->num_h_slices;
int sy = i / f->num_h_slices;
@ -201,7 +201,7 @@ av_cold int ffv1_close(AVCodecContext *avctx)
ff_thread_release_buffer(avctx, &s->last_picture);
av_frame_free(&s->last_picture.f);
for (j = 0; j < s->slice_count; j++) {
for (j = 0; j < s->max_slice_count; j++) {
FFV1Context *fs = s->slice_context[j];
for (i = 0; i < s->plane_count; i++) {
PlaneContext *p = &fs->plane[i];
@ -215,14 +215,14 @@ av_cold int ffv1_close(AVCodecContext *avctx)
av_freep(&avctx->stats_out);
for (j = 0; j < s->quant_table_count; j++) {
av_freep(&s->initial_states[j]);
for (i = 0; i < s->slice_count; i++) {
for (i = 0; i < s->max_slice_count; i++) {
FFV1Context *sf = s->slice_context[i];
av_freep(&sf->rc_stat2[j]);
}
av_freep(&s->rc_stat2[j]);
}
for (i = 0; i < s->slice_count; i++)
for (i = 0; i < s->max_slice_count; i++)
av_freep(&s->slice_context[i]);
return 0;

View File

@ -117,6 +117,7 @@ typedef struct FFV1Context {
struct FFV1Context *slice_context[MAX_SLICES];
int slice_count;
int max_slice_count;
int num_v_slices;
int num_h_slices;
int slice_width;

View File

@ -554,8 +554,11 @@ static int read_extra_header(FFV1Context *f)
}
f->quant_table_count = get_symbol(c, state, 0);
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES)
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
f->quant_table_count = 0;
return AVERROR_INVALIDDATA;
}
for (i = 0; i < f->quant_table_count; i++) {
f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);
@ -758,6 +761,7 @@ static int read_header(FFV1Context *f)
av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
return AVERROR_INVALIDDATA;
}
f->slice_count = f->max_slice_count;
} else if (f->version < 3) {
f->slice_count = get_symbol(c, state, 0);
} else {
@ -772,8 +776,8 @@ static int read_header(FFV1Context *f)
p -= size + trailer;
}
}
if (f->slice_count > (unsigned)MAX_SLICES || f->slice_count <= 0) {
av_log(f->avctx, AV_LOG_ERROR, "slice count %d is invalid\n", f->slice_count);
if (f->slice_count > (unsigned)MAX_SLICES || f->slice_count <= 0 || f->slice_count > f->max_slice_count) {
av_log(f->avctx, AV_LOG_ERROR, "slice count %d is invalid (max=%d)\n", f->slice_count, f->max_slice_count);
return AVERROR_INVALIDDATA;
}
@ -996,6 +1000,7 @@ static int init_thread_copy(AVCodecContext *avctx)
f->picture.f = NULL;
f->last_picture.f = NULL;
f->sample_buffer = NULL;
f->max_slice_count = 0;
f->slice_count = 0;
for (i = 0; i < f->quant_table_count; i++) {
@ -1066,7 +1071,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
av_assert0(!fdst->sample_buffer);
}
av_assert1(fdst->slice_count == fsrc->slice_count);
av_assert1(fdst->max_slice_count == fsrc->max_slice_count);
ff_thread_release_buffer(dst, &fdst->picture);

View File

@ -955,6 +955,7 @@ slices_ok:
if ((ret = ffv1_init_slice_contexts(s)) < 0)
return ret;
s->slice_count = s->max_slice_count;
if ((ret = ffv1_init_slices_state(s)) < 0)
return ret;
@ -964,7 +965,7 @@ slices_ok:
if (!avctx->stats_out)
return AVERROR(ENOMEM);
for (i = 0; i < s->quant_table_count; i++)
for (j = 0; j < s->slice_count; j++) {
for (j = 0; j < s->max_slice_count; j++) {
FFV1Context *sf = s->slice_context[j];
av_assert0(!sf->rc_stat2[i]);
sf->rc_stat2[i] = av_mallocz(s->context_count[i] *
@ -1188,6 +1189,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
for (i = 0; i < f->quant_table_count; i++)
memset(f->rc_stat2[i], 0, f->context_count[i] * sizeof(*f->rc_stat2[i]));
av_assert0(f->slice_count == f->max_slice_count);
for (j = 0; j < f->slice_count; j++) {
FFV1Context *fs = f->slice_context[j];
for (i = 0; i < 256; i++) {

View File

@ -471,10 +471,10 @@ static int decode_frame(FLACContext *s)
ret = allocate_buffers(s);
if (ret < 0)
return ret;
ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
s->got_streaminfo = 1;
dump_headers(s->avctx, (FLACStreaminfo *)s);
}
ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
// dump_headers(s->avctx, (FLACStreaminfo *)s);

View File

@ -90,6 +90,7 @@ typedef struct G2MContext {
int compression;
int width, height, bpp;
int orig_width, orig_height;
int tile_width, tile_height;
int tiles_x, tiles_y, tile_x, tile_y;
@ -712,8 +713,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
}
c->width = bytestream2_get_be32(&bc);
c->height = bytestream2_get_be32(&bc);
if (c->width < 16 || c->width > avctx->width ||
c->height < 16 || c->height > avctx->height) {
if (c->width < 16 || c->width > c->orig_width ||
c->height < 16 || c->height > c->orig_height) {
av_log(avctx, AV_LOG_ERROR,
"Invalid frame dimensions %dx%d\n",
c->width, c->height);
@ -735,8 +736,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
}
c->tile_width = bytestream2_get_be32(&bc);
c->tile_height = bytestream2_get_be32(&bc);
if (!c->tile_width || !c->tile_height ||
((c->tile_width | c->tile_height) & 0xF)) {
if (c->tile_width <= 0 || c->tile_height <= 0 ||
((c->tile_width | c->tile_height) & 0xF) ||
c->tile_width * 4LL * c->tile_height >= INT_MAX
) {
av_log(avctx, AV_LOG_ERROR,
"Invalid tile dimensions %dx%d\n",
c->tile_width, c->tile_height);
@ -882,6 +885,10 @@ static av_cold int g2m_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_RGB24;
// store original sizes and check against those if resize happens
c->orig_width = avctx->width;
c->orig_height = avctx->height;
return 0;
}

View File

@ -113,6 +113,9 @@ typedef struct RL_VLC_ELEM {
* LAST_SKIP_BITS(name, gb, num)
* Like SKIP_BITS, to be used if next call is UPDATE_CACHE or CLOSE_READER.
*
* BITS_LEFT(name, gb)
* Return the number of bits left
*
* For examples see get_bits, show_bits, skip_bits, get_vlc.
*/
@ -179,6 +182,8 @@ typedef struct RL_VLC_ELEM {
name ## _index = FFMIN(name ## _size_plus8, name ## _index + (num))
#endif
#define BITS_LEFT(name, gb) ((int)((gb)->size_in_bits - name ## _index))
#define SKIP_BITS(name, gb, num) \
do { \
SKIP_CACHE(name, gb, num); \

View File

@ -258,26 +258,21 @@ static int gif_read_image(GifState *s, AVFrame *frame)
case 1:
y1 += 8;
ptr += linesize * 8;
if (y1 >= height) {
y1 = pass ? 2 : 4;
ptr = ptr1 + linesize * y1;
pass++;
}
break;
case 2:
y1 += 4;
ptr += linesize * 4;
if (y1 >= height) {
y1 = 1;
ptr = ptr1 + linesize;
pass++;
}
break;
case 3:
y1 += 2;
ptr += linesize * 2;
break;
}
while (y1 >= height) {
y1 = 4 >> pass;
ptr = ptr1 + linesize * y1;
pass++;
}
} else {
ptr += linesize;
}

View File

@ -336,6 +336,14 @@ static int decode_slice(MpegEncContext *s)
s->padding_bug_score += 32;
}
if (s->codec_id == AV_CODEC_ID_H263 &&
(s->workaround_bugs & FF_BUG_AUTODETECT) &&
get_bits_left(&s->gb) >= 64 &&
AV_RB64(s->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
s->padding_bug_score += 32;
}
if (s->workaround_bugs & FF_BUG_AUTODETECT) {
if (s->padding_bug_score > -2 && !s->data_partitioning)
s->workaround_bugs |= FF_BUG_NO_PADDING;

View File

@ -215,18 +215,18 @@ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma)
if ((h->left_samples_available & 0x8080) != 0x8080) {
mode = left[mode];
if (is_chroma && (h->left_samples_available & 0x8080)) {
// mad cow disease mode, aka MBAFF + constrained_intra_pred
mode = ALZHEIMER_DC_L0T_PRED8x8 +
(!(h->left_samples_available & 0x8000)) +
2 * (mode == DC_128_PRED8x8);
}
if (mode < 0) {
av_log(h->avctx, AV_LOG_ERROR,
"left block unavailable for requested intra mode at %d %d\n",
h->mb_x, h->mb_y);
return AVERROR_INVALIDDATA;
}
if (is_chroma && (h->left_samples_available & 0x8080)) {
// mad cow disease mode, aka MBAFF + constrained_intra_pred
mode = ALZHEIMER_DC_L0T_PRED8x8 +
(!(h->left_samples_available & 0x8000)) +
2 * (mode == DC_128_PRED8x8);
}
}
return mode;
@ -248,7 +248,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
#define STARTCODE_TEST \
if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
if (src[i + 2] != 3) { \
if (src[i + 2] != 3 && src[i + 2] != 0) { \
/* startcode, so we must be past the end */ \
length = i; \
} \
@ -321,7 +321,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
if (src[si + 2] > 3) {
dst[di++] = src[si++];
dst[di++] = src[si++];
} else if (src[si] == 0 && src[si + 1] == 0) {
} else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) {
if (src[si + 2] == 3) { // escape
dst[di++] = 0;
dst[di++] = 0;
@ -392,6 +392,7 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
if (free_rbsp && h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
ff_h264_unref_picture(h, &h->DPB[i]);
memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
av_freep(&h->DPB);
} else if (h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
@ -841,10 +842,10 @@ static void decode_postinit(H264Context *h, int setup_finished)
stereo->type = AV_STEREO3D_CHECKERBOARD;
break;
case 1:
stereo->type = AV_STEREO3D_LINES;
stereo->type = AV_STEREO3D_COLUMNS;
break;
case 2:
stereo->type = AV_STEREO3D_COLUMNS;
stereo->type = AV_STEREO3D_LINES;
break;
case 3:
if (h->quincunx_subsampling)
@ -990,6 +991,16 @@ int ff_pred_weight_table(H264Context *h)
h->luma_log2_weight_denom = get_ue_golomb(&h->gb);
if (h->sps.chroma_format_idc)
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;
chroma_def = 1 << h->chroma_log2_weight_denom;
@ -1330,43 +1341,6 @@ int ff_set_ref_count(H264Context *h)
static const uint8_t start_code[] = { 0x00, 0x00, 0x01 };
static int find_start_code(const uint8_t *buf, int buf_size,
int buf_index, int next_avc)
{
// start code prefix search
for (; buf_index + 3 < next_avc; buf_index++)
// This should always succeed in the first iteration.
if (buf[buf_index] == 0 &&
buf[buf_index + 1] == 0 &&
buf[buf_index + 2] == 1)
break;
buf_index += 3;
if (buf_index >= buf_size)
return buf_size;
return buf_index;
}
static int get_avc_nalsize(H264Context *h, const uint8_t *buf,
int buf_size, int *buf_index)
{
int i, nalsize = 0;
if (*buf_index >= buf_size - h->nal_length_size)
return -1;
for (i = 0; i < h->nal_length_size; i++)
nalsize = (nalsize << 8) | buf[(*buf_index)++];
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
av_log(h->avctx, AV_LOG_ERROR,
"AVC: nal size %d\n", nalsize);
return -1;
}
return nalsize;
}
static int get_bit_length(H264Context *h, const uint8_t *buf,
const uint8_t *ptr, int dst_length,
int i, int next_avc)

View File

@ -37,6 +37,7 @@
#include "h264dsp.h"
#include "h264pred.h"
#include "h264qpel.h"
#include "internal.h" // for avpriv_find_start_code()
#include "mpegutils.h"
#include "parser.h"
#include "qpeldsp.h"
@ -337,6 +338,7 @@ typedef struct H264Picture {
* H264Context
*/
typedef struct H264Context {
AVClass *av_class;
AVCodecContext *avctx;
VideoDSPContext vdsp;
H264DSPContext h264dsp;
@ -749,7 +751,7 @@ typedef struct H264Context {
int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
uint8_t parse_history[4];
uint8_t parse_history[6];
int parse_history_count;
int parse_last_mb;
uint8_t *edge_emu_buffer;
@ -1092,6 +1094,34 @@ static av_always_inline int get_dct8x8_allowed(H264Context *h)
0x0001000100010001ULL));
}
static inline int find_start_code(const uint8_t *buf, int buf_size,
int buf_index, int next_avc)
{
uint32_t state = -1;
buf_index = avpriv_find_start_code(buf + buf_index, buf + next_avc + 1, &state) - buf - 1;
return FFMIN(buf_index, buf_size);
}
static inline int get_avc_nalsize(H264Context *h, const uint8_t *buf,
int buf_size, int *buf_index)
{
int i, nalsize = 0;
if (*buf_index >= buf_size - h->nal_length_size)
return -1;
for (i = 0; i < h->nal_length_size; i++)
nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
av_log(h->avctx, AV_LOG_ERROR,
"AVC: nal size %d\n", nalsize);
return -1;
}
return nalsize;
}
int ff_h264_field_end(H264Context *h, int in_setup);
int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src);

View File

@ -420,10 +420,12 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
int weight1 = 64 - weight0;
luma_weight_avg(dest_y, tmp_y, h->mb_linesize,
height, 5, weight0, weight1, 0);
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize,
chroma_height, 5, weight0, weight1, 0);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize,
chroma_height, 5, weight0, weight1, 0);
if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize,
chroma_height, 5, weight0, weight1, 0);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize,
chroma_height, 5, weight0, weight1, 0);
}
} else {
luma_weight_avg(dest_y, tmp_y, h->mb_linesize, height,
h->luma_log2_weight_denom,
@ -431,18 +433,20 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
h->luma_weight[refn1][1][0],
h->luma_weight[refn0][0][1] +
h->luma_weight[refn1][1][1]);
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn0][0][0][0],
h->chroma_weight[refn1][1][0][0],
h->chroma_weight[refn0][0][0][1] +
h->chroma_weight[refn1][1][0][1]);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn0][0][1][0],
h->chroma_weight[refn1][1][1][0],
h->chroma_weight[refn0][0][1][1] +
h->chroma_weight[refn1][1][1][1]);
if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn0][0][0][0],
h->chroma_weight[refn1][1][0][0],
h->chroma_weight[refn0][0][0][1] +
h->chroma_weight[refn1][1][0][1]);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn0][0][1][0],
h->chroma_weight[refn1][1][1][0],
h->chroma_weight[refn0][0][1][1] +
h->chroma_weight[refn1][1][1][1]);
}
}
} else {
int list = list1 ? 1 : 0;
@ -456,15 +460,17 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
h->luma_log2_weight_denom,
h->luma_weight[refn][list][0],
h->luma_weight[refn][list][1]);
if (h->use_weight_chroma) {
chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn][list][0][0],
h->chroma_weight[refn][list][0][1]);
chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn][list][1][0],
h->chroma_weight[refn][list][1][1]);
if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
if (h->use_weight_chroma) {
chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn][list][0][0],
h->chroma_weight[refn][list][0][1]);
chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height,
h->chroma_log2_weight_denom,
h->chroma_weight[refn][list][1][0],
h->chroma_weight[refn][list][1][1]);
}
}
}
}

View File

@ -28,6 +28,7 @@
typedef struct H264BSFContext {
uint8_t length_size;
uint8_t first_idr;
uint8_t idr_sps_pps_seen;
int extradata_parsed;
} H264BSFContext;
@ -155,6 +156,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
return ret;
ctx->length_size = ret;
ctx->first_idr = 1;
ctx->idr_sps_pps_seen = 0;
ctx->extradata_parsed = 1;
}
@ -171,11 +173,20 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
buf += ctx->length_size;
unit_type = *buf & 0x1f;
if (buf + nal_size > buf_end || nal_size < 0)
if (nal_size > buf_end - buf || nal_size < 0)
goto fail;
/* prepend only to the first type 5 NAL unit of an IDR picture */
if (ctx->first_idr && (unit_type == 5 || unit_type == 7 || unit_type == 8)) {
if (ctx->first_idr && (unit_type == 7 || unit_type == 8))
ctx->idr_sps_pps_seen = 1;
/* if this is a new IDR picture following an IDR picture, reset the idr flag.
* Just check first_mb_in_slice to be 0 as this is the simplest solution.
* This could be checking idr_pic_id instead, but would complexify the parsing. */
if (!ctx->first_idr && unit_type == 5 && (buf[1] & 0x80))
ctx->first_idr = 1;
/* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */
if (ctx->first_idr && unit_type == 5 && !ctx->idr_sps_pps_seen) {
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
avctx->extradata, avctx->extradata_size,
buf, nal_size)) < 0)
@ -185,8 +196,10 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
NULL, 0, buf, nal_size)) < 0)
goto fail;
if (!ctx->first_idr && unit_type == 1)
if (!ctx->first_idr && unit_type == 1) {
ctx->first_idr = 1;
ctx->idr_sps_pps_seen = 0;
}
}
buf += nal_size;

View File

@ -92,7 +92,7 @@ static int h264_find_frame_end(H264Context *h, const uint8_t *buf,
state = 7;
} else {
h->parse_history[h->parse_history_count++]= buf[i];
if (h->parse_history_count>3) {
if (h->parse_history_count>5) {
unsigned int mb, last_mb= h->parse_last_mb;
GetBitContext gb;
@ -120,7 +120,7 @@ found:
pc->frame_start_found = 0;
if (h->is_avc)
return next_avc;
return i - (state & 5) - 3 * (state > 7);
return i - (state & 5) - 5 * (state > 7);
}
static int scan_mmco_reset(AVCodecParserContext *s)
@ -203,10 +203,10 @@ static int scan_mmco_reset(AVCodecParserContext *s)
*/
static inline int parse_nal_units(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
const uint8_t * const buf, int buf_size)
{
H264Context *h = s->priv_data;
const uint8_t *buf_end = buf + buf_size;
int buf_index, next_avc;
unsigned int pps_id;
unsigned int slice_type;
int state = -1, got_reset = 0;
@ -226,26 +226,26 @@ static inline int parse_nal_units(AVCodecParserContext *s,
if (!buf_size)
return 0;
buf_index = 0;
next_avc = h->is_avc ? 0 : buf_size;
for (;;) {
int src_length, dst_length, consumed, nalsize = 0;
if (h->is_avc) {
int i;
if (h->nal_length_size >= buf_end - buf) break;
nalsize = 0;
for (i = 0; i < h->nal_length_size; i++)
nalsize = (nalsize << 8) | *buf++;
if (nalsize <= 0 || nalsize > buf_end - buf) {
av_log(h->avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
if (buf_index >= next_avc) {
nalsize = get_avc_nalsize(h, buf, buf_size, &buf_index);
if (nalsize < 0)
break;
}
src_length = nalsize;
next_avc = buf_index + nalsize;
} else {
buf = avpriv_find_start_code(buf, buf_end, &state);
if (buf >= buf_end)
break;
--buf;
src_length = buf_end - buf;
buf_index = find_start_code(buf, buf_size, buf_index, next_avc);
if (buf_index >= buf_size)
break;
if (buf_index >= next_avc)
continue;
}
src_length = next_avc - buf_index;
state = buf[buf_index];
switch (state & 0x1f) {
case NAL_SLICE:
case NAL_IDR_SLICE:
@ -262,10 +262,13 @@ static inline int parse_nal_units(AVCodecParserContext *s,
}
break;
}
ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
ptr = ff_h264_decode_nal(h, buf + buf_index, &dst_length,
&consumed, src_length);
if (ptr == NULL || dst_length < 0)
break;
buf_index += consumed;
init_get_bits(&h->gb, ptr, 8 * dst_length);
switch (h->nal_unit_type) {
case NAL_SPS:
@ -440,7 +443,6 @@ static inline int parse_nal_units(AVCodecParserContext *s,
return 0; /* no need to evaluate the rest */
}
buf += h->is_avc ? nalsize : consumed;
}
if (q264)
return 0;

View File

@ -586,6 +586,17 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
h->mb_type_pool = NULL;
h->ref_index_pool = NULL;
h->motion_val_pool = NULL;
h->intra4x4_pred_mode= NULL;
h->non_zero_count = NULL;
h->slice_table_base = NULL;
h->slice_table = NULL;
h->cbp_table = NULL;
h->chroma_pred_mode_table = NULL;
memset(h->mvd_table, 0, sizeof(h->mvd_table));
h->direct_table = NULL;
h->list_counts = NULL;
h->mb2b_xy = NULL;
h->mb2br_xy = NULL;
for (i = 0; i < 2; i++) {
h->rbsp_buffer[i] = NULL;
h->rbsp_buffer_size[i] = 0;

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)
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,
sizeof(*s->tab_slice_address));
s->qp_y_tab = av_malloc_array(pic_size_in_ctb,
@ -746,6 +746,8 @@ static int hls_slice_header(HEVCContext *s)
s->HEVClc->tu.cu_qp_offset_cb = 0;
s->HEVClc->tu.cu_qp_offset_cr = 0;
s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == NAL_CRA_NUT && s->last_eos);
return 0;
}
@ -978,7 +980,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
for (i = 0; i < (size * size); i++) {
coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3);
}
s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride);
s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride);
}
}
@ -1007,7 +1009,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
for (i = 0; i < (size * size); i++) {
coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3);
}
s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride);
s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride);
}
}
} else if (blk_idx == 3) {
@ -2378,6 +2380,8 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int
if (more_data < 0) {
s->tab_slice_address[ctb_addr_rs] = -1;
avpriv_atomic_int_set(&s1->wpp_err, 1);
ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
return more_data;
}
@ -3306,6 +3310,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
s->pocTid0 = s0->pocTid0;
s->max_ra = s0->max_ra;
s->eos = s0->eos;
s->no_rasl_output_flag = s0->no_rasl_output_flag;
s->is_nalff = s0->is_nalff;
s->nal_length_size = s0->nal_length_size;
@ -3400,6 +3405,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
s->enable_parallel_tiles = 0;
s->picture_struct = 0;
s->eos = 1;
if(avctx->active_thread_type & FF_THREAD_SLICE)
s->threads_number = avctx->thread_count;
@ -3441,6 +3447,7 @@ static void hevc_decode_flush(AVCodecContext *avctx)
HEVCContext *s = avctx->priv_data;
ff_hevc_flush_dpb(s);
s->max_ra = INT_MAX;
s->eos = 1;
}
#define OFFSET(x) offsetof(HEVCContext, x)

View File

@ -850,6 +850,7 @@ typedef struct HEVCContext {
int bs_height;
int is_decoded;
int no_rasl_output_flag;
HEVCPredContext hpc;
HEVCDSPContext hevcdsp;

View File

@ -865,6 +865,11 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->long_term_ref_pics_present_flag = get_bits1(gb);
if (sps->long_term_ref_pics_present_flag) {
sps->num_long_term_ref_pics_sps = get_ue_golomb_long(gb);
if (sps->num_long_term_ref_pics_sps > 31U) {
av_log(0, AV_LOG_ERROR, "num_long_term_ref_pics_sps %d is out of range.\n",
sps->num_long_term_ref_pics_sps);
goto err;
}
for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) {
sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb);
sps->used_by_curr_pic_lt_sps_flag[i] = get_bits1(gb);
@ -1164,6 +1169,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
if (pps->cu_qp_delta_enabled_flag)
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);
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",
@ -1289,7 +1302,8 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) {
av_log(s->avctx, AV_LOG_ERROR,
"PPS extension flag is partially implemented.\n");
pps_range_extensions(s, pps, sps);
if ((ret = pps_range_extensions(s, pps, sps)) < 0)
goto err;
}
}

View File

@ -163,7 +163,7 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
int min_poc = INT_MAX;
int i, min_idx, ret;
if (s->sh.no_output_of_prior_pics_flag == 1) {
if (s->sh.no_output_of_prior_pics_flag == 1 && s->no_rasl_output_flag == 1) {
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *frame = &s->DPB[i];
if ((frame->flags & HEVC_FRAME_FLAG_OUTPUT) && frame->poc != s->poc &&

View File

@ -625,9 +625,9 @@ static void decode_422_bitstream(HYuvContext *s, int count)
READ_2PIX(s->temp[0][2 * i ], s->temp[1][i], 1);
READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2);
}
for (; i < count && get_bits_left(&s->gb) > 0; i++) {
for (; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
READ_2PIX(s->temp[0][2 * i ], s->temp[1][i], 1);
if (get_bits_left(&s->gb) <= 0) break;
if (BITS_LEFT(re, &s->gb) <= 0) break;
READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2);
}
for (; i < count; i++)
@ -666,7 +666,7 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane)
if (s->bps <= 8) {
OPEN_READER(re, &s->gb);
if (count >= (get_bits_left(&s->gb)) / (32 * 2)) {
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
READ_2PIX_PLANE(s->temp[0][2 * i], s->temp[0][2 * i + 1], plane, OP8bits);
}
} else {
@ -678,7 +678,7 @@ static void decode_plane_bitstream(HYuvContext *s, int count, int plane)
} else if (s->bps <= 14) {
OPEN_READER(re, &s->gb);
if (count >= (get_bits_left(&s->gb)) / (32 * 2)) {
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
READ_2PIX_PLANE(s->temp16[0][2 * i], s->temp16[0][2 * i + 1], plane, OP14bits);
}
} else {
@ -707,7 +707,7 @@ static void decode_gray_bitstream(HYuvContext *s, int count)
count/=2;
if (count >= (get_bits_left(&s->gb)) / (32 * 2)) {
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
}
} else {
@ -724,7 +724,7 @@ static av_always_inline void decode_bgr_1(HYuvContext *s, int count,
int i;
OPEN_READER(re, &s->gb);
for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
unsigned int index;
int code, n;

View File

@ -677,11 +677,15 @@ static int decode_frame(AVCodecContext *avctx,
const uint8_t *buf_end = buf + buf_size;
int y, plane, res;
GetByteContext gb;
const AVPixFmtDescriptor *desc;
if ((res = extract_header(avctx, avpkt)) < 0)
return res;
if ((res = ff_reget_buffer(avctx, s->frame)) < 0)
return res;
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
if (!s->init && avctx->bits_per_coded_sample <= 8 &&
avctx->pix_fmt == AV_PIX_FMT_PAL8) {
if ((res = cmap_read_palette(avctx, (uint32_t *)s->frame->data[1])) < 0)
@ -721,7 +725,6 @@ static int decode_frame(AVCodecContext *avctx,
} else
return unsupported(avctx);
} else if (avctx->codec_tag == MKTAG('D', 'E', 'E', 'P')) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
int raw_width = avctx->width * (av_get_bits_per_pixel(desc) >> 3);
int x;
for (y = 0; y < avctx->height && buf < buf_end; y++) {
@ -838,7 +841,6 @@ static int decode_frame(AVCodecContext *avctx,
} else
return unsupported(avctx);
} else if (avctx->codec_tag == MKTAG('D', 'E', 'E', 'P')) { // IFF-DEEP
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
if (av_get_bits_per_pixel(desc) == 32)
decode_deep_rle32(s->frame->data[0], buf, buf_size, avctx->width, avctx->height, s->frame->linesize[0]);
else
@ -847,16 +849,15 @@ static int decode_frame(AVCodecContext *avctx,
break;
case 4:
bytestream2_init(&gb, buf, buf_size);
if (avctx->codec_tag == MKTAG('R', 'G', 'B', '8'))
if (avctx->codec_tag == MKTAG('R', 'G', 'B', '8') && avctx->pix_fmt == AV_PIX_FMT_RGB32)
decode_rgb8(&gb, s->frame->data[0], avctx->width, avctx->height, s->frame->linesize[0]);
else if (avctx->codec_tag == MKTAG('R', 'G', 'B', 'N'))
else if (avctx->codec_tag == MKTAG('R', 'G', 'B', 'N') && avctx->pix_fmt == AV_PIX_FMT_RGB444)
decode_rgbn(&gb, s->frame->data[0], avctx->width, avctx->height, s->frame->linesize[0]);
else
return unsupported(avctx);
break;
case 5:
if (avctx->codec_tag == MKTAG('D', 'E', 'E', 'P')) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
if (av_get_bits_per_pixel(desc) == 32)
decode_deep_tvdc32(s->frame->data[0], buf, buf_size, avctx->width, avctx->height, s->frame->linesize[0], s->tvdc);
else

View File

@ -94,7 +94,7 @@ typedef struct Indeo3DecodeContext {
int16_t width, height;
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
uint8_t cb_offset; ///< needed for selecting VQ tables
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;
const uint8_t *bs_hdr;
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;
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->v_data_size = ends[1] - starts[1];
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(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");

View File

@ -269,6 +269,11 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s,
x += stride;
}
if (x >= w) {
av_log(NULL, AV_LOG_ERROR, "run overflow\n");
return;
}
/* decode run termination value */
Rb = R(last, x);
RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;

View File

@ -43,6 +43,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
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();
if (!s->frame)
return AVERROR(ENOMEM);

View File

@ -96,8 +96,7 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
WebRtcIlbcfix_DecodeImpl((WebRtc_Word16*) frame->data[0],
(const WebRtc_UWord16*) buf, &s->decoder, 1);
WebRtcIlbcfix_DecodeImpl((int16_t *) frame->data[0], (const uint16_t *) buf, &s->decoder, 1);
*got_frame_ptr = 1;
@ -170,7 +169,7 @@ static int ilbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
if ((ret = ff_alloc_packet2(avctx, avpkt, 50)) < 0)
return ret;
WebRtcIlbcfix_EncodeImpl((WebRtc_UWord16*) avpkt->data, (const WebRtc_Word16*) frame->data[0], &s->encoder);
WebRtcIlbcfix_EncodeImpl((uint16_t *) avpkt->data, (const int16_t *) frame->data[0], &s->encoder);
avpkt->size = s->encoder.no_of_bytes;
*got_packet_ptr = 1;

View File

@ -236,10 +236,10 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
case AV_STEREO3D_CHECKERBOARD:
fpa_type = 0;
break;
case AV_STEREO3D_LINES:
case AV_STEREO3D_COLUMNS:
fpa_type = 1;
break;
case AV_STEREO3D_COLUMNS:
case AV_STEREO3D_LINES:
fpa_type = 2;
break;
case AV_STEREO3D_SIDEBYSIDE:

View File

@ -244,7 +244,8 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
{
int len, nb_components, i, width, height, pix_fmt_id, ret;
int len, nb_components, i, width, height, bits, ret;
unsigned pix_fmt_id;
int h_count[MAX_COMPONENTS];
int v_count[MAX_COMPONENTS];
@ -254,11 +255,11 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
s->avctx->bits_per_raw_sample =
s->bits = get_bits(&s->gb, 8);
bits = get_bits(&s->gb, 8);
if (s->pegasus_rct)
s->bits = 9;
if (s->bits == 9 && !s->pegasus_rct)
bits = 9;
if (bits == 9 && !s->pegasus_rct)
s->rct = 1; // FIXME ugly
if(s->lossless && s->avctx->lowres){
@ -291,7 +292,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
return AVERROR_INVALIDDATA;
}
}
if (s->ls && !(s->bits <= 8 || nb_components == 1)) {
if (s->ls && !(bits <= 8 || nb_components == 1)) {
avpriv_report_missing_feature(s->avctx,
"JPEG-LS that is not <= 8 "
"bits/component or 16-bit gray");
@ -337,11 +338,13 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
/* if different size, realloc/alloc picture */
if ( width != s->width || height != s->height
|| bits != s->bits
|| memcmp(s->h_count, h_count, sizeof(h_count))
|| memcmp(s->v_count, v_count, sizeof(v_count))) {
s->width = width;
s->height = height;
s->bits = bits;
memcpy(s->h_count, h_count, sizeof(h_count));
memcpy(s->v_count, v_count, sizeof(v_count));
s->interlaced = 0;
@ -376,7 +379,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else if (!s->lossless)
s->rgb = 0;
/* XXX: not complete test ! */
pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) |
pix_fmt_id = ((unsigned)s->h_count[0] << 28) | (s->v_count[0] << 24) |
(s->h_count[1] << 20) | (s->v_count[1] << 16) |
(s->h_count[2] << 12) | (s->v_count[2] << 8) |
(s->h_count[3] << 4) | s->v_count[3];
@ -511,6 +514,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
if (pix_fmt_id == 0x42111100) {
if (s->bits > 8)
goto unk_pixfmt;
s->upscale_h = 6;
s->chroma_height = s->height / 2;
}
@ -1591,6 +1596,8 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
}
if (id == AV_RB32("LJIF")) {
int rgb = s->rgb;
int pegasus_rct = s->pegasus_rct;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO,
"Pegasus lossless jpeg header found\n");
@ -1600,17 +1607,27 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
skip_bits(&s->gb, 16); /* unknown always 0? */
switch (i=get_bits(&s->gb, 8)) {
case 1:
s->rgb = 1;
s->pegasus_rct = 0;
rgb = 1;
pegasus_rct = 0;
break;
case 2:
s->rgb = 1;
s->pegasus_rct = 1;
rgb = 1;
pegasus_rct = 1;
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace %d\n", i);
}
len -= 9;
if (s->got_picture)
if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) {
av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n");
goto out;
}
s->rgb = rgb;
s->pegasus_rct = pegasus_rct;
goto out;
}
if (id == AV_RL32("colr") && len > 0) {
@ -1894,6 +1911,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int start_code;
int i, index;
int ret = 0;
int is16bit;
av_dict_free(&s->exif_metadata);
av_freep(&s->stereo3d);
@ -2072,6 +2090,9 @@ fail:
s->got_picture = 0;
return ret;
the_end:
is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step_minus1;
if (s->upscale_h) {
int p;
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
@ -2081,6 +2102,7 @@ the_end:
avctx->pix_fmt == AV_PIX_FMT_YUVA444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P16||
avctx->pix_fmt == AV_PIX_FMT_GBRAP
);
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
@ -2091,9 +2113,16 @@ the_end:
continue;
if (p==1 || p==2)
w >>= hshift;
av_assert0(w > 0);
for (i = 0; i < s->chroma_height; i++) {
for (index = w - 1; index; index--)
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
if (is16bit) ((uint16_t*)line)[w - 1] = ((uint16_t*)line)[(w - 1) / 2];
else line[w - 1] = line[(w - 1) / 2];
for (index = w - 2; index > 0; index--) {
if (is16bit)
((uint16_t*)line)[index] = (((uint16_t*)line)[index / 2] + ((uint16_t*)line)[(index + 1) / 2]) >> 1;
else
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
}
line += s->linesize[p];
}
}
@ -2114,11 +2143,11 @@ the_end:
if (!(s->upscale_v & (1<<p)))
continue;
if (p==1 || p==2)
w >>= hshift;
w = FF_CEIL_RSHIFT(w, hshift);
for (i = s->height - 1; i; i--) {
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[p])[i / 2 * s->linesize[p]];
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[p])[(i + 1) / 2 * s->linesize[p]];
if (src1 == src2) {
if (src1 == src2 || i == s->height - 1) {
memcpy(dst, src1, w);
} else {
for (index = 0; index < w; index++)

View File

@ -61,6 +61,13 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
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();
if (!s->frame)
return AVERROR(ENOMEM);
@ -111,7 +118,7 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
if (color) {
memset(s->frame->data[0] + y*s->frame->linesize[0] + x, color, run_length);
if (half_vert)
if (half_vert && y + half_vert < s->avctx->height)
memset(s->frame->data[0] + (y+1)*s->frame->linesize[0] + x, color, run_length);
}
x+= run_length;

View File

@ -190,7 +190,13 @@ static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int
int uvdxy; /* no, it might not be used uninitialized */
if(dxy){
if(qpel){
c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h)
if (h << size == 16) {
c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h)
} else if (size == 0 && h == 8) {
c->qpel_put[1][dxy](c->temp , ref[0] + x + y*stride , stride);
c->qpel_put[1][dxy](c->temp + 8, ref[0] + x + y*stride + 8, stride);
} else
av_assert2(0);
if(chroma){
int cx= hx/2;
int cy= hy/2;

View File

@ -1884,6 +1884,14 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
} else
goto eos;
}
if (s->mb_y >= ((s->height + 15) >> 4) &&
s->progressive_frame &&
!s->progressive_sequence &&
get_bits_left(&s->gb) <= 8 &&
get_bits_left(&s->gb) >= 0 &&
s->mb_skip_run == -1 &&
show_bits(&s->gb, 8) == 0)
goto eos;
ff_init_block_index(s);
}

View File

@ -73,20 +73,21 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
if (i > 4)
s->header_count = -2;
} else {
int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id;
if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
s->header_count= -3;
s->header= state;
s->header_count++;
s->frame_size = ret-4;
if (s->header_count > 0 + (avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id)) {
if (s->header_count > header_threshold) {
avctx->sample_rate= sr;
avctx->channels = channels;
s1->duration = frame_size;
avctx->codec_id = codec_id;
if (s->no_bitrate || !avctx->bit_rate) {
s->no_bitrate = 1;
avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count;
avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold);
}
}
break;

View File

@ -1642,9 +1642,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
uint32_t header;
int ret;
int skipped = 0;
while(buf_size && !*buf){
buf++;
buf_size--;
skipped++;
}
if (buf_size < HEADER_SIZE)
@ -1699,7 +1701,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
return ret;
}
s->frame_size = 0;
return buf_size;
return buf_size + skipped;
}
static void mp_flush(MPADecodeContext *ctx)

View File

@ -1436,6 +1436,9 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
{
int i, err = 0;
if (!s->context_initialized)
return AVERROR(EINVAL);
if (s->slice_context_count > 1) {
for (i = 0; i < s->slice_context_count; i++) {
free_duplicate_context(s->thread_context[i]);
@ -1465,8 +1468,8 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
s->mb_height = (s->height + 15) / 16;
if ((s->width || s->height) &&
av_image_check_size(s->width, s->height, 0, s->avctx))
return AVERROR_INVALIDDATA;
(err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
goto fail;
if ((err = init_context_frame(s)))
goto fail;
@ -1482,7 +1485,7 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
}
for (i = 0; i < nb_slices; i++) {
if (init_duplicate_context(s->thread_context[i]) < 0)
if ((err = init_duplicate_context(s->thread_context[i])) < 0)
goto fail;
s->thread_context[i]->start_mb_y =
(s->mb_height * (i) + nb_slices / 2) / nb_slices;

View File

@ -908,6 +908,11 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
On2AVCContext *c = avctx->priv_data;
int i;
if (avctx->channels > 2U) {
avpriv_request_sample(avctx, "Decoding more than 2 channels");
return AVERROR_PATCHWELCOME;
}
c->avctx = avctx;
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO

View File

@ -102,8 +102,8 @@ static const AVOption avcodec_options[] = {
{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX},
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},

View File

@ -499,6 +499,12 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
return ret;
}
if (coded_samples != s->packet.frame_count * s->packet.frame_duration) {
av_log(avctx, AV_LOG_ERROR,
"Mismatching coded sample count in substream %d.\n", i);
return AVERROR_INVALIDDATA;
}
s->silk_samplerate = get_silk_samplerate(s->packet.config);
}

View File

@ -576,6 +576,12 @@ static int decode_frame(AVCodecContext *avctx,
case MKTAG('I', 'H', 'D', 'R'):
if (length != 13)
goto fail;
if (s->state & PNG_IDAT) {
av_log(avctx, AV_LOG_ERROR, "IHDR after IDAT\n");
goto fail;
}
s->width = bytestream2_get_be32(&s->gb);
s->height = bytestream2_get_be32(&s->gb);
if (av_image_check_size(s->width, s->height, 0, avctx)) {
@ -644,7 +650,7 @@ static int decode_frame(AVCodecContext *avctx,
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (s->bit_depth == 1) {
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1) {
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
@ -851,10 +857,11 @@ exit_loop:
int i, j;
uint8_t *pd = p->data[0];
uint8_t *pd_last = s->last_picture.f->data[0];
int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0), s->width * s->bpp);
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
for (j = 0; j < s->height; j++) {
for (i = 0; i < s->width * s->bpp; i++)
for (i = 0; i < ls; i++)
pd[i] += pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;

View File

@ -471,7 +471,6 @@ static void put_alpha_run(PutBitContext *pb, int run)
// todo alpha quantisation for high quants
static int encode_alpha_plane(ProresContext *ctx, PutBitContext *pb,
const uint16_t *src, int linesize,
int mbs_per_slice, uint16_t *blocks,
int quant)
{
@ -566,11 +565,16 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
get_alpha_data(ctx, src, linesize, xp, yp,
pwidth, avctx->height / ctx->pictures_per_frame,
ctx->blocks[0], mbs_per_slice, ctx->alpha_bits);
sizes[i] = encode_alpha_plane(ctx, pb, src, linesize,
sizes[i] = encode_alpha_plane(ctx, pb,
mbs_per_slice, ctx->blocks[0],
quant);
}
total_size += sizes[i];
if (put_bits_left(pb) < 0) {
av_log(avctx, AV_LOG_ERROR, "Serious underevaluation of"
"required buffer size");
return AVERROR_BUFFER_TOO_SMALL;
}
}
return total_size;
}
@ -941,9 +945,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
pkt_size = ctx->frame_size_upper_bound + FF_MIN_BUFFER_SIZE;
pkt_size = ctx->frame_size_upper_bound;
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0)
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size + FF_MIN_BUFFER_SIZE)) < 0)
return ret;
orig_buf = pkt->data;
@ -1020,7 +1024,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
slice_hdr = buf;
buf += slice_hdr_size - 1;
init_put_bits(&pb, buf, (pkt_size - (buf - orig_buf)) * 8);
encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
ret = encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
if (ret < 0)
return ret;
bytestream_put_byte(&slice_hdr, q);
slice_size = slice_hdr_size + sizes[ctx->num_planes - 1];
@ -1202,8 +1208,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
ctx->bits_per_mb = ls * 8;
if (ctx->chroma_factor == CFACTOR_Y444)
ctx->bits_per_mb += ls * 4;
if (ctx->num_planes == 4)
ctx->bits_per_mb += ls * 4;
}
ctx->frame_size_upper_bound = ctx->pictures_per_frame *
@ -1212,6 +1216,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
(mps * ctx->bits_per_mb) / 8)
+ 200;
if (ctx->alpha_bits) {
// alpha plane is run-coded and might run over bit budget
ctx->frame_size_upper_bound += ctx->pictures_per_frame *
ctx->slices_per_picture *
/* num pixels per slice */ (ctx->mbs_per_slice * 256 *
/* bits per pixel */ (1 + ctx->alpha_bits + 1) + 7 >> 3);
}
avctx->codec_tag = ctx->profile_info->tag;
av_log(avctx, AV_LOG_DEBUG,

View File

@ -163,7 +163,7 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
/* check motion vector */
if ((me_x + filled < 0) || (me_x + me_w + filled > width) ||
(height - me_y - me_h < 0) || (height - me_y > orig_height) ||
(height - me_y - me_h < 0) || (height - me_y >= orig_height) ||
(filled + me_w > width) || (height - me_h < 0))
av_log(NULL, AV_LOG_ERROR, "Bogus motion vector (%i,%i), block size %ix%i at %i,%i\n",
me_x, me_y, me_w, me_h, filled, height);

View File

@ -117,6 +117,9 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
avctx->height);
}
if (context->frame_size < 0)
return context->frame_size;
if ((avctx->extradata_size >= 9 &&
!memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9)) ||

View File

@ -98,7 +98,7 @@ static int expand_rle_row16(SgiState *s, uint16_t *out_buf,
break;
/* Check for buffer overflow. */
if (pixelstride * (count - 1) >= len) {
if (out_end - out_buf <= pixelstride * (count - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid pixel count.\n");
return AVERROR_INVALIDDATA;
}
@ -145,7 +145,7 @@ static int read_rle_sgi(uint8_t *out_buf, SgiState *s)
for (z = 0; z < s->depth; z++) {
dest_row = out_buf;
for (y = 0; y < s->height; y++) {
linesize = s->width * s->depth * s->bytes_per_channel;
linesize = s->width * s->depth;
dest_row -= s->linesize;
start_offset = bytestream2_get_be32(&g_table);
bytestream2_seek(&s->g, start_offset, SEEK_SET);

View File

@ -70,7 +70,7 @@ typedef struct SmcContext {
row_ptr += stride * 4; \
} \
total_blocks--; \
if (total_blocks < 0) \
if (total_blocks < 0 + !!n_blocks) \
{ \
av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
return; \

View File

@ -713,7 +713,7 @@ av_cold void ff_snow_common_end(SnowContext *s)
for(i=0; i<MAX_REF_FRAMES; i++){
av_freep(&s->ref_mvs[i]);
av_freep(&s->ref_scores[i]);
if(s->last_picture[i]->data[0]) {
if(s->last_picture[i] && s->last_picture[i]->data[0]) {
av_assert0(s->last_picture[i]->data[0] != s->current_picture->data[0]);
}
av_frame_free(&s->last_picture[i]);

View File

@ -659,7 +659,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
if(v){
v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);
v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l&0xFF] + 3*ff_quant3bA[t&0xFF]]);
if ((uint16_t)v != v) {
av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n");
v = 1;
}
xc->x=x;
(xc++)->coeff= v;
}
@ -669,6 +672,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
else run= INT_MAX;
v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);
v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);
if ((uint16_t)v != v) {
av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n");
v = 1;
}
xc->x=x;
(xc++)->coeff= v;

View File

@ -495,7 +495,7 @@ static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp,
return result;
}
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out)
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t out[257])
{
uint8_t seed;
int i;
@ -507,6 +507,7 @@ static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out)
out[i] = get_bits(bitbuf, 8) ^ seed;
seed = string_table[out[i] ^ seed];
}
out[i] = 0;
}
static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
@ -549,12 +550,12 @@ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
}
if ((s->frame_code ^ 0x10) >= 0x50) {
uint8_t msg[256];
uint8_t msg[257];
svq1_parse_string(bitbuf, msg);
av_log(avctx, AV_LOG_INFO,
"embedded message:\n%s\n", (char *)msg);
"embedded message:\n%s\n", ((char *)msg) + 1);
}
skip_bits(bitbuf, 2);

View File

@ -1176,7 +1176,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
h->cur_pic_ptr = s->cur_pic;
av_frame_unref(&h->cur_pic.f);
h->cur_pic = *s->cur_pic;
memcpy(&h->cur_pic.tf, &s->cur_pic->tf, sizeof(h->cur_pic) - offsetof(H264Picture, tf));
ret = av_frame_ref(&h->cur_pic.f, &s->cur_pic->f);
if (ret < 0)
return ret;

View File

@ -712,13 +712,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
s->height = value;
break;
case TIFF_BPP:
s->bppcount = count;
if (count > 4) {
if (count > 4U) {
av_log(s->avctx, AV_LOG_ERROR,
"This format is not supported (bpp=%d, %d components)\n",
s->bpp, count);
value, count);
return AVERROR_INVALIDDATA;
}
s->bppcount = count;
if (count == 1)
s->bpp = value;
else {
@ -736,6 +736,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
s->bpp = -1;
}
}
if (s->bpp > 64U) {
av_log(s->avctx, AV_LOG_ERROR,
"This format is not supported (bpp=%d, %d components)\n",
s->bpp, count);
s->bpp = 0;
return AVERROR_INVALIDDATA;
}
break;
case TIFF_SAMPLES_PER_PIXEL:
if (count != 1) {

View File

@ -305,7 +305,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
strips = (s->height - 1) / s->rps + 1;
packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 +
bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
packet_size = avctx->height * bytes_per_row * 2 +
avctx->height * 4 + FF_MIN_BUFFER_SIZE;
if ((ret = ff_alloc_packet2(avctx, pkt, packet_size)) < 0)
@ -333,8 +335,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
goto fail;
}
bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
if (is_yuv) {
av_fast_padded_malloc(&s->yuv_line, &s->yuv_line_size, bytes_per_row);
if (s->yuv_line == NULL) {

View File

@ -66,6 +66,9 @@
#include "compat/os2threads.h"
#endif
#include "libavutil/ffversion.h"
const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
static int default_lockmgr_cb(void **arg, enum AVLockOp op)
{
@ -297,6 +300,12 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
int i;
int w_align = 1;
int h_align = 1;
AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
if (desc) {
w_align = 1 << desc->log2_chroma_w;
h_align = 1 << desc->log2_chroma_h;
}
switch (s->pix_fmt) {
case AV_PIX_FMT_YUV420P:
@ -374,6 +383,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
case AV_PIX_FMT_GBRP12BE:
case AV_PIX_FMT_GBRP14LE:
case AV_PIX_FMT_GBRP14BE:
case AV_PIX_FMT_GBRP16LE:
case AV_PIX_FMT_GBRP16BE:
w_align = 16; //FIXME assume 16 pixel per macroblock
h_align = 16 * 2; // interlaced needs 2 macroblocks height
break;
@ -403,6 +414,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
w_align = 4;
h_align = 4;
}
if (s->codec_id == AV_CODEC_ID_JV) {
w_align = 8;
h_align = 8;
}
break;
case AV_PIX_FMT_BGR24:
if ((s->codec_id == AV_CODEC_ID_MSZH) ||
@ -418,8 +433,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
}
break;
default:
w_align = 1;
h_align = 1;
break;
}
@ -3591,6 +3604,11 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
ret = av_bprint_finalize(buf, &str);
if (ret < 0)
return ret;
if (!av_bprint_is_complete(buf)) {
av_free(str);
return AVERROR(ENOMEM);
}
avctx->extradata = str;
/* Note: the string is NUL terminated (so extradata can be read as a
* string), but the ending character is not accounted in the size (in

View File

@ -214,6 +214,8 @@ static void restore_median(uint8_t *src, int step, int stride,
slice_height = ((((slice + 1) * height) / slices) & cmask) -
slice_start;
if (!slice_height)
continue;
bsrc = src + slice_start * stride;
// first line - left neighbour prediction
@ -224,7 +226,7 @@ static void restore_median(uint8_t *src, int step, int stride,
A = bsrc[i];
}
bsrc += stride;
if (slice_height == 1)
if (slice_height <= 1)
continue;
// second line - first element has top prediction, the rest uses median
C = bsrc[-stride];
@ -269,6 +271,8 @@ static void restore_median_il(uint8_t *src, int step, int stride,
slice_height = ((((slice + 1) * height) / slices) & cmask) -
slice_start;
slice_height >>= 1;
if (!slice_height)
continue;
bsrc = src + slice_start * stride;
@ -284,7 +288,7 @@ static void restore_median_il(uint8_t *src, int step, int stride,
A = bsrc[stride + i];
}
bsrc += stride2;
if (slice_height == 1)
if (slice_height <= 1)
continue;
// second line - first element has top prediction, the rest uses median
C = bsrc[-stride2];

View File

@ -389,7 +389,7 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
}
static int encode_plane(AVCodecContext *avctx, uint8_t *src,
uint8_t *dst, int stride,
uint8_t *dst, int stride, int plane_no,
int width, int height, PutByteContext *pb)
{
UtvideoContext *c = avctx->priv_data;
@ -399,6 +399,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
HuffEntry he[256];
uint32_t offset = 0, slice_len = 0;
const int cmask = ~(!plane_no && avctx->pix_fmt == AV_PIX_FMT_YUV420P);
int i, sstart, send = 0;
int symbol;
int ret;
@ -408,7 +409,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
case PRED_NONE:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
send = height * (i + 1) / c->slices & cmask;
av_image_copy_plane(dst + sstart * width, width,
src + sstart * stride, stride,
width, send - sstart);
@ -417,7 +418,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
case PRED_LEFT:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
send = height * (i + 1) / c->slices & cmask;
left_predict(src + sstart * stride, dst + sstart * width,
stride, width, send - sstart);
}
@ -425,7 +426,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
case PRED_MEDIAN:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
send = height * (i + 1) / c->slices & cmask;
median_predict(c, src + sstart * stride, dst + sstart * width,
stride, width, send - sstart);
}
@ -489,7 +490,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
send = 0;
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
send = height * (i + 1) / c->slices & cmask;
/*
* Write the huffman codes to a buffer,
@ -571,7 +572,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
case AV_PIX_FMT_RGBA:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, c->slice_buffer[i] + 2 * c->slice_stride,
c->slice_buffer[i], c->slice_stride,
c->slice_buffer[i], c->slice_stride, i,
width, height, &pb);
if (ret) {
@ -583,7 +584,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
case AV_PIX_FMT_YUV422P:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
pic->linesize[i], width >> !!i, height, &pb);
pic->linesize[i], i, width >> !!i, height, &pb);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Error encoding plane %d.\n", i);
@ -594,7 +595,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
case AV_PIX_FMT_YUV420P:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
pic->linesize[i], width >> !!i, height >> !!i,
pic->linesize[i], i, width >> !!i, height >> !!i,
&pb);
if (ret) {

View File

@ -5484,7 +5484,7 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb)
if (ret < 0)
return ret;
if (!s->current_picture.f->data[0]) {
if (!s->current_picture.f || !s->current_picture.f->data[0]) {
av_log(avctx, AV_LOG_ERROR, "Got no sprites\n");
return -1;
}
@ -5514,7 +5514,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx)
Since we can't enforce it, clear to black the missing sprite. This is
wrong but it looks better than doing nothing. */
if (f->data[0])
if (f && f->data[0])
for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++)
for (i = 0; i < v->sprite_height>>!!plane; i++)
memset(f->data[plane] + i * f->linesize[plane],

View File

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

View File

@ -1314,7 +1314,9 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
vorbis_residue *vr,
uint8_t *do_not_decode,
unsigned ch_used,
int partition_count)
int partition_count,
int ptns_to_read
)
{
int p, j, i;
unsigned c_p_c = vc->codebooks[vr->classbook].dimensions;
@ -1336,7 +1338,7 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
temp2 = (((uint64_t)temp) * inverse_class) >> 32;
if (i < vr->ptns_to_read)
if (i < ptns_to_read)
vr->classifs[p + i] = temp - temp2 * vr->classifications;
temp = temp2;
}
@ -1344,13 +1346,13 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
temp2 = temp / vr->classifications;
if (i < vr->ptns_to_read)
if (i < ptns_to_read)
vr->classifs[p + i] = temp - temp2 * vr->classifications;
temp = temp2;
}
}
}
p += vr->ptns_to_read;
p += ptns_to_read;
}
return 0;
}
@ -1404,7 +1406,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC error
if (!pass) {
int ret;
if ((ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count)) < 0)
if ((ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count, ptns_to_read)) < 0)
return ret;
}
for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) {

View File

@ -253,6 +253,10 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
return sign ? ~ret : ret;
error:
ret = get_bits_left(gb);
if (ret <= 0) {
av_log(ctx->avctx, AV_LOG_ERROR, "Too few bits (%d) left\n", ret);
}
*last = 1;
return 0;
}

View File

@ -638,7 +638,7 @@ static uint32_t log2sample(uint32_t v, int limit, uint32_t *result)
if ((v += v >> 9) < (1 << 8)) {
dbits = nbits_table[v];
result += (dbits << 8) + wp_log2_table[(v << (9 - dbits)) & 0xff];
*result += (dbits << 8) + wp_log2_table[(v << (9 - dbits)) & 0xff];
} else {
if (v < (1L << 16))
dbits = nbits_table[v >> 8] + 8;
@ -647,7 +647,7 @@ static uint32_t log2sample(uint32_t v, int limit, uint32_t *result)
else
dbits = nbits_table[v >> 24] + 24;
result += dbits = (dbits << 8) + wp_log2_table[(v >> (dbits - 9)) & 0xff];
*result += dbits = (dbits << 8) + wp_log2_table[(v >> (dbits - 9)) & 0xff];
if (limit && dbits >= limit)
return 1;
@ -2876,10 +2876,11 @@ static int wavpack_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return AVERROR(ENOMEM);
}
if ((ret = ff_alloc_packet2(avctx, avpkt, s->block_samples * avctx->channels * 8)) < 0)
buf_size = s->block_samples * avctx->channels * 8
+ 200 /* for headers */;
if ((ret = ff_alloc_packet2(avctx, avpkt, buf_size)) < 0)
return ret;
buf = avpkt->data;
buf_size = avpkt->size;
for (s->ch_offset = 0; s->ch_offset < avctx->channels;) {
set_samplerate(s);

View File

@ -1028,7 +1028,7 @@ static int apply_color_indexing_transform(WebPContext *s)
ImageContext *img;
ImageContext *pal;
int i, x, y;
uint8_t *p, *pi;
uint8_t *p;
img = &s->image[IMAGE_ROLE_ARGB];
pal = &s->image[IMAGE_ROLE_COLOR_INDEXING];
@ -1066,11 +1066,11 @@ static int apply_color_indexing_transform(WebPContext *s)
p = GET_PIXEL(img->frame, x, y);
i = p[2];
if (i >= pal->frame->width) {
av_log(s->avctx, AV_LOG_ERROR, "invalid palette index %d\n", i);
return AVERROR_INVALIDDATA;
AV_WB32(p, 0x00000000);
} else {
const uint8_t *pi = GET_PIXEL(pal->frame, i, 0);
AV_COPY32(p, pi);
}
pi = GET_PIXEL(pal->frame, i, 0);
AV_COPY32(p, pi);
}
}

View File

@ -422,6 +422,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
offset &= ~3;
if (offset > s->sfb_offsets[i][band - 1])
s->sfb_offsets[i][band++] = offset;
if (offset >= subframe_len)
break;
}
s->sfb_offsets[i][band - 1] = subframe_len;
s->num_sfb[i] = band - 1;

View File

@ -135,8 +135,11 @@ WEIGHT_FUNC_HALF_MM 8, 8
add off_regd, 1
or off_regd, 1
add r4, 1
cmp r6d, 128
je .nonnormal
cmp r5, 128
jne .normal
.nonnormal
sar r5, 1
sar r6, 1
sar off_regd, 1

View File

@ -342,7 +342,7 @@ QPEL_TABLE 10, 4, w, sse4
%macro LOOP_END 4
lea %1q, [%1q+2*%2q] ; dst += dststride
lea %3q, [%3q+ %4q] ; src += srcstride
add %3q, %4q ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
%endmacro

View File

@ -185,8 +185,12 @@ hvar_fn
%elif (%2-%%off) == 2
mov valw, [srcq+%2-2]
%elifidn %1, body
mov vald, [srcq+%2-3]
%else
mov valb, [srcq+%2-1]
sal vald, 16
mov valw, [srcq+%2-3]
%elifidn %1, bottom
movd mm %+ %%mmx_idx, [srcq+%2-4]
%else ; top
movd mm %+ %%mmx_idx, [srcq+%2-3]
%endif
%endif ; (%2-%%off) >= 1
@ -242,12 +246,15 @@ hvar_fn
mov [dstq+%2-2], valw
%elifidn %1, body
mov [dstq+%2-3], valw
shr vald, 16
sar vald, 16
mov [dstq+%2-1], valb
%else
movd vald, mm %+ %%mmx_idx
%ifidn %1, bottom
sar vald, 8
%endif
mov [dstq+%2-3], valw
shr vald, 16
sar vald, 16
mov [dstq+%2-1], valb
%endif
%endif ; (%2-%%off) >= 1

View File

@ -20,10 +20,10 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%if ARCH_X86_64
%include "libavutil/x86/x86util.asm"
%if ARCH_X86_64
SECTION_RODATA
cextern pb_3

View File

@ -34,7 +34,7 @@ OBJS-$(CONFIG_OPENGL_OUTDEV) += opengl_enc.o
OBJS-$(CONFIG_OSS_INDEV) += oss_audio.o
OBJS-$(CONFIG_OSS_OUTDEV) += oss_audio.o
OBJS-$(CONFIG_PULSE_INDEV) += pulse_audio_dec.o \
pulse_audio_common.o
pulse_audio_common.o timefilter.o
OBJS-$(CONFIG_PULSE_OUTDEV) += pulse_audio_enc.o \
pulse_audio_common.o
OBJS-$(CONFIG_QTKIT_INDEV) += qtkit.o

View File

@ -23,6 +23,9 @@
#include "avdevice.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 D AV_OPT_FLAG_DECODING_PARAM
#define A AV_OPT_FLAG_AUDIO_PARAM

View File

@ -1,4 +1,4 @@
LIBAVDEVICE_$MAJOR {
global: avdevice_*;
global: avdevice_*; av_*;
local: *;
};

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