Compare commits

...

447 Commits

Author SHA1 Message Date
Michael Niedermayer
2515907a45 Update for FFmpeg 1.2.12
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 14:28:03 +01:00
Michael Niedermayer
7e7772c13a avcodec/mjpegdec: Skip blocks which are outside the visible area
Fixes out of array accesses
Fixes: ffmpeg_mjpeg_crash.avi

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

Conflicts:

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

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

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

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

Conflicts:

	libavcodec/h264_slice.c
2015-02-07 14:14:28 +01:00
Michael Niedermayer
4de40be507 avcodec/h264_slice: Check picture structure before setting the related fields
This might fix a hypothetical race condition

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

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

Conflicts:

	libavcodec/h264_slice.c

Conflicts:

	libavcodec/h264.c
2015-02-07 14:14:24 +01:00
Michael Niedermayer
64e50b2f2a avcodec/h264_slice: Do not change frame_num after the first slice
Fixes potential race condition
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

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

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

Conflicts:

	libavcodec/h264_slice.c
2015-02-07 14:11:25 +01:00
Michael Niedermayer
5b4a79ee02 avutil/opt: Fix type used to access AV_OPT_TYPE_SAMPLE_FMT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1750b45cdf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-06 22:31:03 +01:00
Michael Niedermayer
d9618b964b avutil/opt: Fix types used to access AV_OPT_TYPE_PIXEL_FMT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a0640e6346)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-06 22:31:02 +01:00
Michael Niedermayer
763c753348 avcodec/h264: Be more strict on rejecting pps/sps changes
Fixes race condition
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

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

Conflicts:

	libavcodec/h264.c
2015-02-06 15:53:48 +01:00
Michael Niedermayer
4ef5605fc9 avcodec/h264_ps: More completely check the bit depths
Fixes out of array read
Fixes: asan_static-oob_30328b6_719_cov_3325483287_H264_artifacts_motion.h264

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

Conflicts:

	libavcodec/h264_ps.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-06 04:51:35 +01:00
Michael Niedermayer
3508aa1427 avformat/thp: Check av_get_packet() for failure not only for partial output
Fixes null pointer dereference
Fixes: signal_sigsegv_db2c1f_3108_cov_163322880_pikmin2_opening1_partial.thp

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 04:30:41 +01:00
Michael Niedermayer
42d9a7010f swscale/utils: Limit filter shifting so as not to read from prior the array
Fixes out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 00:42:51 +01:00
Michael Niedermayer
fd6a9fcd42 avcodec/mjpegdec: Check number of components for JPEG-LS
Fixes out of array accesses
Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg

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

Conflicts:

	libavcodec/mjpegdec.c
2015-02-04 21:27:46 +01:00
Michael Niedermayer
20be3ea442 avcodec/mjpegdec: Check escape sequence validity
Fixes assertion failure
Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 21:27:44 +01:00
Michael Niedermayer
70ff376e83 avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 05e1619529)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 15:08:37 +01:00
wm4
49dd89f902 avformat/mpc8: fix broken pointer math
This could overflow and crash at least on 32 bit systems.

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

Conflicts:

	libavformat/mpc8.c
2015-02-04 01:06:09 +01:00
wm4
bdc4abd694 avformat/mpc8: fix hang with fuzzed file
This can lead to an endless loop by seeking back a few bytes after each
attempted chunk read. Assuming negative sizes are always invalid, this
is easy to fix. Other code in this demuxer treats negative sizes as
invalid as well.

Fixes ticket #4262.

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

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

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

Fixes ticket #4294.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 16:18:23 +01:00
Michael Niedermayer
7881d3b2a5 avcodec/mpegvideo_enc: Fix number suffixes in rc_buffer_size calculation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4531e2c489)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-01 20:33:43 +01:00
Michael Niedermayer
5f2902bdc7 avcodec/h264_cabac: use int instead of long for mbb_xy
The mb address fits in int

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-01 20:33:00 +01:00
Michael Niedermayer
ef3687998f avformat/smacker: Fix number suffix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 465f3705b1)

Conflicts:

	libavformat/smacker.c
2015-02-01 20:24:05 +01:00
Michael Niedermayer
ba5e66cf65 avformat/matroskadec: Fix number suffixes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fc3cdb00d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-01 20:23:01 +01:00
Michael Niedermayer
0e79fd1ec9 swresample/dither: Cleanup number suffixes
The <<31 case needs LL

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

Conflicts:

	libswresample/dither.c
2015-02-01 20:18:33 +01:00
Michael Niedermayer
9939d98b2c avformat/utils: Fix number suffixes in tb_unreliable()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4b15bba2ae)

Conflicts:

	libavformat/utils.c
(cherry picked from commit e651a2f88c)
2015-02-01 20:16:02 +01:00
Michael Niedermayer
abfa416181 avformat/rmdec: Check for overflow in ff_rm_read_mdpr_codecdata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03abf55f25)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-18 00:28:16 +01:00
Martin Storsjö
237cf31a57 rtpdec_h263_rfc2190: Clear the stored bits if discarding buffered data
If we throw away the buffered incomplete frame, make sure to also
throw away the buffered bits of an incomplete byte at the same
time.

(cherry picked from commit df07c07b3d)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-17 23:25:00 +01:00
Vittorio Giovara
051b47dc4e swscale: check memory allocations
Bug-Id: CID 1257779
(cherry picked from commit 1dd797e3c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-17 22:49:13 +01:00
Vittorio Giovara
71bdcd66e1 opt: check memory allocation
Bug-Id: CID 1257771
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-17 22:46:33 +01:00
Michael Niedermayer
a86cc0cc1b avcodec/flac_parser: fix handling EOF if no headers are found
Fixes assertion failure
Fixes Ticket4269

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-17 02:13:11 +01:00
Michael Niedermayer
b00a3bf332 avformat/movenc: workaround bug in "PathScale EKOPath(tm) Compiler Suite Version 4.0.12.1"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7824dc5150)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 05:02:27 +01:00
Michael Niedermayer
08fe58ef32 ffmpeg: Clear error message array at init.
This avoids printing uninitialized bytes if no error message is set

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-08 23:11:00 +01:00
wm4
8a3a3e3154 avcodec/dvdsubdec: error on bitmaps with size 0
Attemtping to decode them could lead to invalid writes with some fuzzed
samples.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-08 02:11:29 +01:00
Johan Andersson
5410d6d26f cmdutils: update copyright year to 2015.
(cherry picked from commit 3e16065221)

Conflicts:

	cmdutils.c
2015-01-06 20:42:35 +01:00
Michael Niedermayer
529488afa3 avformat/mov: Fix mixed declaration and statement warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit db27f50e06)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 20:38:05 +01:00
Michael Niedermayer
e81236d1a5 avformat/matroskadec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e70e4aca5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 16:09:39 +01:00
Dale Curtis
54a9f64d42 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 3ebd76a9c5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 05:49:19 +01:00
Michael Niedermayer
b6351f9978 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 3859868c75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 05:49:18 +01:00
Dale Curtis
07f634f948 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 04:21:21 +01:00
wm4
931f4313b2 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 c9151de7c4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-05 05:13:27 +01:00
Michael Niedermayer
fd4c80177b 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 eb767a276b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-01 18:41:21 +01:00
Michael Niedermayer
2dd1d0c60b avformat/cdxl: Fix integer overflow of image_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3eb5cbe0c5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-31 22:39:39 +01:00
Stefano Sabatini
fa8d407c1f lavf/segment: remove duplicated and inconsistent cleanup code in seg_write_packet()
In particular, avoid to leave around the seg->avf pointer to freed
structure, and fix crash with:
ffmpeg -f lavfi -i testsrc -c:v h264 -map 0 -f segment foo-%d.ts
(cherry picked from commit 169065fbfb)

Found-by: Qinghao Tang
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-28 13:08:06 +01:00
Michael Niedermayer
8a21620c26 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 1b5d112406)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-20 11:55:28 +01:00
Michael Niedermayer
c60caa5769 avcodec/indeo3: ensure offsets are non negative
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 368642361f)

Conflicts:

	libavcodec/indeo3.c
2014-12-18 18:58:35 +01:00
Michael Niedermayer
96e2a4ba74 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 61296d41e2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-18 03:48:46 +01:00
Michael Niedermayer
a9c0f905aa 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 e8714f6f93)

Conflicts:

	libavcodec/h264.c
2014-12-17 22:17:32 +01:00
Michael Niedermayer
42b7d224bc 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 3305acdc92)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-17 05:24:50 +01:00
Michael Niedermayer
45bb57e009 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 f3b5b139ad)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-17 02:14:37 +01:00
Michael Niedermayer
ec0f77fbff 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>
2014-12-17 00:01:16 +01:00
Michael Niedermayer
3aa99bed5d 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 caa7a3914f)

Conflicts:

	libavformat/isom.h
2014-12-16 23:57:22 +01:00
Michael Niedermayer
ece0c9c4b0 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 3881606240)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-16 23:06:36 +01:00
Michael Niedermayer
0da0d7754e 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 3030fb7e0d)

Conflicts:

	libavcodec/vmdvideo.c
2014-12-16 19:43:41 +01:00
Michael Niedermayer
c03491d96b Update for 1.2.11
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-16 00:10:02 +01:00
Michael Niedermayer
237958f8e8 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 ed86dbd05d)

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-13 22:20:34 +01:00
wm4
084102cd47 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 6551acab68)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-07 23:04:42 +01:00
Michael Niedermayer
0d5e626197 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 8524558858)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-03 20:39:11 +01:00
Michael Niedermayer
6560e61826 avformat/rmdec: Check codec_data_size
Fixes infinite loop
Fixes Ticket4154

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-03 20:08:08 +01:00
Michael Niedermayer
71b3f64935 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 4388e78a0f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 00:28:33 +01:00
Michael Niedermayer
69a92ae397 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 b50e003e1c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 00:26:19 +01:00
Michael Niedermayer
d723f92dbf 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 79ceaf827b)

Conflicts:

	libavcodec/pngdec.c
2014-12-02 00:26:19 +01:00
Michael Niedermayer
11e5106c56 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 e5c01ccdf5)

Conflicts:

	libavcodec/flacdec.c
2014-12-02 00:26:19 +01:00
Michael Niedermayer
a65573c45d 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 3d5d95db3f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 00:26:19 +01:00
Michael Niedermayer
6c28673cb3 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 0eecf40935)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 00:26:19 +01:00
Michael Niedermayer
5284d17562 avformat/hlsenc: Free context after hls_append_segment
Fixes reading uninitialized memory

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

Conflicts:

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

Conflicts:

	libavformat/hlsenc.c
(cherry picked from commit 134d3e1c0331462ea94c78a5e13a63b20d283653)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-16 11:15:20 +01:00
Michael Niedermayer
01384e3dde 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 5dcb99033d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-10 23:49:08 +01:00
Michael Niedermayer
2d39d8ffc1 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 7656c4c6e6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-10 23:38:50 +01:00
Michael Niedermayer
5d33142fd6 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 206c98f303)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-03 13:30:09 +01:00
Michael Niedermayer
7e8b4506e0 update for 1.2.10
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:34:41 +01:00
Michael Niedermayer
96dac432f7 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 e91ba2efa9)

Conflicts:

	libavcodec/svq1dec.c
2014-11-02 11:15:12 +01:00
Michael Niedermayer
b92ccfefc3 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 df74811cd5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:14:25 +01:00
Michael Niedermayer
6e45a99a7c 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 f3c0e0bf6f)

Conflicts:

	libavcodec/dnxhddec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:14:25 +01:00
Michael Niedermayer
d59804bafb 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 e70312dfc2)

Conflicts:

	libavcodec/dxa.c
2014-11-02 11:14:25 +01:00
Michael Niedermayer
35cf24eee9 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 39680cacee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:14:25 +01:00
Michael Niedermayer
341cf9ed81 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 5145d22b88)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:14:25 +01:00
Michael Niedermayer
c36f5df34a 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 526886e606)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:14:25 +01:00
Michael Niedermayer
23b3fe00bb postproc: fix qp count
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0b7e5d0d75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:14:25 +01:00
Michael Niedermayer
42669252e8 postproc/postprocess: fix quant store for fq mode
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 941aaa39e8)

Conflicts:

	tests/ref/fate/filter-pp3
(cherry picked from commit 705748caf3f6a4a3e74ad3d2fc547a5a0213a521)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 11:14:25 +01:00
Michael Niedermayer
25a9823eb4 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 547fce9585)

Conflicts:

	libavcodec/h264_slice.c

Conflicts:

	libavcodec/h264.c
2014-11-02 02:22:14 +01:00
Carl Eugen Hoyos
a8fd50bb4e Fix compilation after aa9d7058. 2014-11-02 00:43:50 +01:00
Michael Niedermayer
9282c96071 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 69a9a90d2e)

Conflicts:

	libavcodec/h264_parser.c
2014-11-01 20:27:01 +01:00
Michael Niedermayer
aa9d705871 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 3b678da5e3)

Conflicts:

	libavcodec/h264.h
2014-11-01 20:12:25 +01:00
Michael Niedermayer
7ddf252c7e 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 4898440f6b)

Conflicts:

	libavcodec/h264.c
	libavcodec/h264.h
2014-11-01 20:12:16 +01:00
Michael Niedermayer
1abb0e5639 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 be695ee389)
2014-11-01 17:39:56 +01:00
Michael Niedermayer
e5cf4d16c6 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 5109ce2017)

Conflicts:
	libavformat/mpeg.c
2014-11-01 17:39:42 +01:00
Michael Niedermayer
e0465d6fcf Update for 1.2.9
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-07 19:40:13 +02:00
Michael Niedermayer
65889b62b3 swresample/swresample: fix sample drop loop end condition
Fixes Ticket3985

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 01:31:39 +02:00
Michael Niedermayer
7fc97160c2 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 9734a7a1de)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 15:04:43 +02:00
Michael Niedermayer
c4f0f3c52d 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 c3d7f00ee3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-04 05:30:22 +02:00
Michael Niedermayer
4865948d2e 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 c727401aa9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 23:24:27 +02:00
Michael Niedermayer
891376d261 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 dd3bfe3cc1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 21:32:15 +02:00
Michael Niedermayer
24a5cd720d 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 8f1457864b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 20:28:52 +02:00
Michael Niedermayer
75f5fe165c 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 e7e5114c50)

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

Conflicts:

	libavcodec/pngdec.c
2014-10-03 18:36:41 +02:00
Michael Niedermayer
12c8e4021c 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 3e2b745020)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 18:35:38 +02:00
Michael Niedermayer
f56095c4d7 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 e1c0cfaa41)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 16:48:23 +02:00
Michael Niedermayer
76601e4ab8 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 8b0e96e1f2)

Conflicts:

	libavcodec/mmvideo.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 15:12:37 +02:00
Michael Niedermayer
e90d620cb9 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 105654e376)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-03 05:07:33 +02:00
Michael Niedermayer
0ffa44340f 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 5c378d6a6d)

Conflicts:

	libavcodec/mjpegdec.c
(cherry picked from commit 94371a404c663c3dae3d542fa43951567ab67f82)

Conflicts:

	libavcodec/mjpegdec.c
2014-10-03 02:30:00 +02:00
Michael Niedermayer
0bd9b78fb6 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 06e7d58410)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-28 12:11:22 +02:00
Michael Niedermayer
e9d85860d0 avcodec/ac3enc_template: fix out of array read
Found-by: Andreas Cadhalpun
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d85ebea3f3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-27 20:58:44 +02:00
lvqcl
2144ce08c1 avutil/x86/cpu: fix cpuid sub-leaf selection
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e58fc44649)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-27 13:58:59 +02:00
Gianluigi Tiesi
e28c27e25f 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 59af5383c1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-21 17:04:19 +02:00
James Almer
9b9048a3dd x86/dsputil: add emms to ff_scalarproduct_int16_mmxext()
Also undo the changes to ra144enc.c from previous commits.
Should fix ticket #3429

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9e0e1f9067)

Conflicts:

	libavcodec/ra144enc.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-20 14:14:30 +02:00
Katerina Barone-Adesi
70dc7bb893 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 c5560e72d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-17 21:38:31 +02:00
Michael Niedermayer
b9b97900c1 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 7c1835c52a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 17:11:03 +02:00
Michael Niedermayer
d49b57fe0f 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 cfce6f7efd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 15:33:07 +02:00
Michael Niedermayer
0f1882b9b2 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 0d0f7f0ba4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 15:33:06 +02:00
Michael Niedermayer
0fc229450f 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 2762323c37)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 15:33:05 +02:00
Michael Niedermayer
6f02de4ee8 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 c2430304df)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 13:41:13 +02:00
Michael Niedermayer
248a2fca90 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 1c55d0ff32)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 13:41:13 +02:00
Michael Niedermayer
1482253790 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 596636a474)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 13:41:13 +02:00
Timothy Gu
0f578ea705 bktr: Fix Fabrice's name
Signed-off-by: Timothy Gu <timothygu99@gmail.com>

This file with the incorrect name was added after the name was fixed in all other files.
This is thus fixing a mistake

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 13:41:13 +02:00
Michael Niedermayer
48443598ed avcodec/utils: add GBRP16 to avcodec_align_dimensions2()
Fixes Ticket3869

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 13:41:13 +02:00
Michael Niedermayer
30ffb80dca 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 fccd85b9f3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-07 13:41:13 +02:00
Michael Niedermayer
0a64e9a029 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>
(cherry picked from commit ee606fd031)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-19 03:16:20 +02:00
Michael Niedermayer
59b2a9ef95 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>
(cherry picked from commit 2f71aeb301)

Conflicts:

	VERSION
(cherry picked from commit f543d32455)

Conflicts:

	VERSION
2014-08-19 03:16:11 +02:00
Michael Niedermayer
4ce6d65b6f Changelog: update for 1.2.8
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-19 02:13:02 +02:00
Michael Niedermayer
ab4e54f6f6 update for 1.2.8
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-17 17:31:13 +02:00
Christophe Gisquet
18342848f7 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 52b81ff463)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-17 16:49:56 +02:00
Luca Barbato
61a51598e3 lavc: move put_bits_left in put_bits.h
(cherry picked from commit afe03092dd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-17 16:49:56 +02:00
Michael Niedermayer
abc1fa7c5a 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 3539d6c63a)

Conflicts:

	libavcodec/iff.c
(cherry picked from commit 656f930160)

Conflicts:

	libavcodec/iff.c
2014-08-10 22:31:02 +02:00
Anton Khirnov
f712d3669e 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 c7d9b473e2)

Conflicts:

	libavcodec/cdgraphics.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-07 02:05:19 +02:00
Michael Niedermayer
ca232ff9b0 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 2e6fdcb7f3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-05 03:18:15 +02:00
Michael Niedermayer
b4632cec74 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 bcc898dd26)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 01:27:36 +02:00
Michael Niedermayer
f70ee7d14f 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 cfdb30d2f1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 01:27:34 +02:00
Michael Niedermayer
c285db74f6 avformat/utils: do not wait for packets from discarded streams for genpts
Fixes long loop
Fixes Ticket3208

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-13 01:15:57 +02:00
Michael Niedermayer
cc8d20e345 Update for FFmpeg 1.2.7
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:32:54 +02:00
Michael Niedermayer
c2b72eac6c avformat/mpc: attempt to allocate a packet that is not smaller than the data inside it
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 86a9370e2b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:43 +02:00
Michael Niedermayer
9d77a62936 avcodec/alsdec: Clear MPEG4AudioConfig so that no use of uninitialized memory is possible
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e6bd5481c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:43 +02:00
Michael Niedermayer
f2aaee49b2 avformat/flvenc: Do not allow creating h263/mpeg4 in flv without unofficial format extensions being enabled.
Found-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 74760883fc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:43 +02:00
Michael Niedermayer
d13cf32099 avcodec/mss4: Fix () in MKVAL() macro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cf7ff0146c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
5626e11bd5 avcodec/mss34dsp: fix () in SOP* macros
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e720c5c81)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
8d1f38c4b1 avcodec/mlpdec: fix () in MSB_MASK() macro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fa160af08b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
ea7fbd0b16 avcodec/golomb-test: fix () in EXTEND() macro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 97e6b5ee3a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
b2b4df8d51 avcodec/aac: fix () in IS_CODEBOOK_UNSIGNED macro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fa915d4193)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
5691d9a6c1 avcodec/libvorbisenc: dont add the duration to AV_NOPTS_VALUE
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 19e66c7232)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
2b8490b762 avutil/cpu: force mmx on selection of higher x86 SIMD features
Fixes various runtime failures with manually set flags that represent no
existing CPU

Fixes Ticket3653

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
4b638ea42d avcodec/diracdec: move mc buffer allocation to per frame
Fixes out of array accesses for non default buffers with large strides

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
4ecd718285 avfilter/graphdump: Fix pointer to local outside scope
Fixes CID1194435
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 18af0ce62d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
0607c8af2b avcodec/mjpegdec: Fix undefined shift
Fixes CID1194388

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
3c385ea24c ffmpeg_filter: fix pointer to local outside scope
Fixes CID1206652
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 09b16619d3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
c7e9626b7b swresample: fix AV_CH_LAYOUT_STEREO_DOWNMIX input
Fixes Ticket 3542

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
26d7253441 avformat/h263dec: Fix h263 probe
The code was missing 1 bit in the src format

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
c75a915f66 avformat/mux: Check for and remove invalid packet durations
Fixes assertion failure
Fixes Ticket3575

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
ecd30280f5 avutil/lzo: add asserts to be double sure against overflows
These asserts cannot fail since d6af26c55c

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
eada99a854 avutil/lzo: Fix integer overflow
Embargoed-till: 2014-06-27 requested by researcher, but embargo broken by libav today (git and mailing list)

Fixes: LMS-2014-06-16-4
Found-by: "Don A. Bailey" <donb@securitymouse.com>
See: ccda51b14c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d6af26c55c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Xi Wang
9ade5b804e lzo: fix overflow checking in copy_backptr()
The check `src > dst' in the form `&c->out[-back] > c->out' invokes
pointer overflow, which is undefined behavior in C.

Remove the check.  Also replace `&c->out[-back] < c->out_start' with
a safe form `c->out - c->out_start < back' to avoid overflow.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ca6c3f2c53)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:17:42 +02:00
Michael Niedermayer
753f0738ca avfilter/filtfmts: Support dynamically allocated in/outputs
Fixes crash
Fixes Ticket3468

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:21 +02:00
Michael Niedermayer
85b00d798f iavcodec/vc1dec: Fix missing {}
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cb53beb81a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:21 +02:00
Michael Niedermayer
8d60d8bef2 avfilter/vf_deshake: fix loss of precission with odd resolutions
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 73734282e0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:21 +02:00
Michael Niedermayer
53c02d04e4 avcodec/g723_1: add assert to help static code analyzers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1457f3fd90)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:21 +02:00
Michael Niedermayer
90c7dfb907 avcodec/diracdec: fix undefined behavior with shifts
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b8598f6ce6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:21 +02:00
Michael Niedermayer
424b00a300 avformat/mpegts: Remove redundant check
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ff6fa0b4b9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:21 +02:00
Michael Niedermayer
7b38ea4003 avcodec/mjpegen: Fix declared argument size
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 256f530603)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
71104f7cb0 swscale/swscale: fix srcStride/srcSlice typo
Fixes part of Ticket3466
Found by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 14fa7fc6a8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
98fe429ba5 avcodec/x86/idct_sse2_xvid: fix non C99 inline function
Found-by: Matt Oliver <protogonoi@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 46d5625f44)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Anthoine Bourgeois
90cf672d7a avcodec/dirac_arith: Fix build with PIC and stack-check options
Fixes Ticket3540

The function dirac_get_arith_bit in libavcodec/dirac_arith.h can't be
built with PIC and check-stack because the asm code needs 6 registers
and PIC and check-stack options take 1 each and x86 is quite limited
in this area.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
4af56488c8 swscale/x86/swscale_template: loose hardcoded dstw_offset
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f6759d9ad4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
4065e55759 swresample/resample: use av_malloc_array() where appropriate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5027f39712)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
fe97363c38 swresample/dither: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a5290cb1ac)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
ce95904013 swresample/resample: Limit filter length
Related to CID1197063

The limit choosen is arbitrary and much larger than what makes sense.
It avoids the need for checking arithmetic operations with the length for overflow

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
a61998e4f4 avcodec/msrle: check return code for success before use
The check is possibly redundant, but better to check for errors
that dont occur than to skip the check and crash

Fixes CID1197060

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
e5546d4871 avcodec/wma: use av_freep(), do not leave stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d167faafe9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Lukasz Marek
8f7ebb88b8 lavu/opt: validate range before dereference
This change make error handling simplier.
av_opt_freep_ranges may be called when some ranges are NULL,
for example after memory allocation fail.

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3aac5fcfa9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
e897eb108b avcodec/libx264: move where x264opts is applied down so it isnt overridden by avctx & defaults
fixes x264opts opengop=1

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
2af3a04164 avcodec/h264_mp4toannexb_bsf: prepend global headers before any in stream parameter sets
Fixes h264_mp4toannexb_bsf_failure.mkv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
92ca3578bf avcodec/x86/mpegvideoenc_template: fix integer overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Michael Niedermayer
1be06c8531 swscale/swscale: fix integer overflow
Should fix fate failure with clang ftrapv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 18:16:20 +02:00
Carl Eugen Hoyos
6011b806dd Show duration for large asf files as written in the file header.
Fixes ticket #3428.
(cherry picked from commit e3fd263f0b)
2014-06-21 23:08:55 +02:00
Carl Eugen Hoyos
3ac85d70f0 Revert two backports to release/1.2 that broke fate.
Revert "ff_id3v2_read: add option to limit ID3 magic number search"
Revert "ff_id3v2_free_extra_meta: set the pointer pointing to extra_meta to NULL"

This reverts commit 7f8aa37bc3.
This reverts commit 5219e20d58.
2014-06-20 01:58:14 +02:00
Martin Storsjö
401b3dafd9 adpcm: Write the proper predictor in trellis mode in IMA QT
The actual predictor value, set by the trellis code, never
was written back into the variable that was written into
the block header. This was accidentally removed in b304244b.

This significantly improves the audio quality of the trellis
case, which was plain broken since b304244b.

Encoding IMA QT with trellis still actually gives a slightly
worse quality than without trellis, since the trellis encoder
doesn't use the exact same way of rounding as in
adpcm_ima_qt_compress_sample and adpcm_ima_qt_expand_nibble.

Fixes part of Ticket3701

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

Conflicts:
	tests/ref/acodec/adpcm-ima_qt-trellis
2014-06-10 00:24:30 +02:00
Martin Storsjö
71516ac175 adpcm: Fix trellis encoding of IMA QT
This was broken in 095be4fb - samples+ch (for the previous
non-planar case) equals &samples_p[ch][0]. The confusion
probably stemmed from the IMA WAV case where it originally
was &samples[avctx->channels + ch], which was correctly
changed into &samples_p[ch][1].

Fixes part of Ticket3701

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a32765c425)
2014-06-10 00:24:22 +02:00
Carl Eugen Hoyos
0983720cf2 avcodec/utvideodec: Increase vlc len
Fixes a regression since fb3e380 similar to ticket #2661,
reported by fluffrabbit at aol dot com.

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

Conflicts:
	libavcodec/utvideodec.c
2014-06-10 00:21:05 +02:00
Michael Niedermayer
9e9d92bbcc avformat/avidec: allow rounding errors between scale/rate and timebase
Fixes Ticket3670

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

Conflicts:
	libavformat/avidec.c
2014-06-10 00:18:22 +02:00
Michael Niedermayer
3d79041f85 sws: dont use the optimized 410->420 unscaled conversion when height%4
Fixes Ticket3594
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 421b21ca8a)
2014-05-01 18:32:45 +02:00
Michael Niedermayer
2c71734d9e avcodec/vorbisdec: try to workaround libvorbisenc bug
Fixes Ticket3590

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

Conflicts:
	libavcodec/vorbisdec.c
2014-05-01 18:32:13 +02:00
Stefano Sabatini
0759bdc315 ffprobe: fix scaling of vali in value_string() in case -prefix is selected
Fix trac ticket #3523.
(cherry picked from commit 1ba59b1cbe)
2014-04-23 17:22:49 +02:00
Michael Niedermayer
1530fbccac avformat/avidec: Speed up keyframe detection code
Fixes Ticket3531

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

Conflicts:
	libavformat/avidec.c
2014-04-23 17:22:06 +02:00
Peter Ross
7f8aa37bc3 ff_id3v2_read: add option to limit ID3 magic number search
Several chunked formats (AIFF, IFF,DSF) store ID3 metadata within an 'ID3 '
chunk tag. If such chunks are stored sequentially, it is possible for the
ID3v2 parser to confuse the chunk tag for the ID3 magic number. e.g.

[1st chunk tag ('ID3 ') | chunk size] [ID3 magic number | metadata ...]
[2nd chunk tag ('ID3 ') | chunk size] [ID3 magic number | metadata ...]

Fixes ticket #3530.

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5331773cc3)

Conflicts:
	libavformat/dsfdec.c
	libavformat/id3v2.c
2014-04-19 13:28:22 +02:00
Peter Ross
5219e20d58 ff_id3v2_free_extra_meta: set the pointer pointing to extra_meta to NULL
Fixes ticket #3530.

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c94305ae23)
2014-04-19 13:20:04 +02:00
Michael Niedermayer
8ee704c392 avformat/matroskadec: support SVQ3 as generated by mkvtoolnix-6.6.0
Fixes part of Ticket3256

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

Conflicts:
	libavformat/matroskadec.c
2014-04-16 19:51:51 +02:00
Michael Niedermayer
9060c10c65 avformat/matroskaenc: wrap V_QUICKTIME codec private in something that looks like its part of quicktime stsd
This is needed for matroska spec compliance
Fixes playback of SVQ3 in matroska with vlc
Fixes Ticket 3256

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8456bd2c0f)
2014-04-16 19:46:38 +02:00
Michael Niedermayer
5202621ac4 avformat/mov: fix keyframe flags for sample from chromium Issue 340865
Fixes ticket #3362.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a0911b0597)
2014-03-24 23:30:34 +01:00
Hendrik Leppkes
da6a8c9cfd avformat/mov: only force parsing for video tracks if stss is empty
Fixes playback of some AAC streams, which are otherwise mangled by the
parser, and stss is typically only valid for video anyway.

Fixes a regression since e41ea866.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 019247bdc3)
2014-03-24 23:30:09 +01:00
Michael Niedermayer
f07cebcd91 avcodec/h263dec: Fix use of uninitialized memory from the bitstream buffer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-18 18:06:17 +01:00
Michael Niedermayer
d0ba12fa0c swscale/x86/swscale: fix missing xmm clobbers in yuv2yuvX_sse3()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6c47a4e972)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-18 17:07:58 +01:00
Michael Niedermayer
a58053dc24 avutil/timestamp: Warn about missing __STDC_FORMAT_MACROS for C++ use
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8b02dfd37c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-18 17:07:58 +01:00
Peter Ross
b1a960cc83 avcodec/adpcm: squelch 'mismatch in coded sample count' warning for AV_CODEC_ID_ADPCM_EA_R2/3
These ADPCM codecs include a per-frame flag that enables a raw 16-bit mode. Therefore
the the number of samples returned by get_nb_samples() is only ever approximate.

Fixes ticket #3460.

Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7380201451)
2014-03-17 16:06:20 +01:00
Peter Ross
620d80d572 avcodec/adpcm: ADPCM_IMA_DK3 packets are padded to 16-bit packet boundary
Fixes ticket #3461.

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d1bb17940d)
2014-03-17 16:06:09 +01:00
Michael Niedermayer
e3ce3d373c avcodec/h264: be more tolerant on what pixel format changes trigger reinits
Fixes Ticket3260

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

Conflicts:
	libavcodec/h264.c
2014-03-17 16:06:04 +01:00
Michael Niedermayer
f31682f2f2 avformat/flvdec: discard inconsistent timestamps
Fixes Ticket3425

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

Conflicts:
	libavformat/flvdec.c
2014-03-13 07:37:58 +01:00
Michael Niedermayer
fb44a3e4a3 avcodec/vorbisdec: use the stored previous window type only when the actual previous is not known
Fixes Ticket3432

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5171ae781a)
2014-03-13 07:35:17 +01:00
Michael Niedermayer
6ee47bd008 Merge remote-tracking branch 'TimothyGu/release/1.2' into release/1.2
* TimothyGu/release/1.2:
  configure: use pkg-config to detect libbluray

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 13:15:42 +01:00
Luca Barbato
7819750157 avidec: Let the inner dv demuxer take care of discarding
Fixes ticket #1796.
(cherry picked from commit c8f0b20b4a)

Conflicts:
	libavformat/avidec.c
2014-03-09 14:05:17 +01:00
Timothy Gu
0d819ed318 configure: use pkg-config to detect libbluray
The current configure fails when static libbluray is compiled with libxml2
support.

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

Conflicts:
	configure
2014-03-06 17:55:46 -08:00
Michael Niedermayer
e63346f7e8 update for 1.2.6
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:55:25 +01:00
Michael Niedermayer
ddcccababe avcodec/utvideoenc: fix slice_bits size
Fixes assertion failure

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

Conflicts:

	libavcodec/utvideoenc.c
(cherry picked from commit 57522ca79cc38c279123596d3288ddbf56fa8903)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
b580bae53a avcodec/snow: split block clipping checks
Fixes out of array read
Fixes: d4476f68ca1c1c57afbc45806f581963-asan_heap-oob_2266b27_8607_cov_4044577381_snow_chroma_bug.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 61d59703c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
9085cdd677 avcodec/ansi: fix integer overflow
Fixes out of array read
Fixes: 5f9698e86d92f19bb08d54ff0d57027f-signal_sigsegv_b30756_3795_cov_2693691257_ansi256.ans
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d42ec8433c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
ab31a9ee4a avcodec/msrle: use av_image_get_linesize() to calculate the linesize
Fixes out of array access
Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c919e1ca2e)

Conflicts:

	libavcodec/msrle.c
(cherry picked from commit bc1c8ec5e6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
a57d29a50c avformat/mpegtsenc: Check data array size in mpegts_write_pmt()
Prevents out of array writes

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

Conflicts:

	libavformat/mpegtsenc.c
(cherry picked from commit e87de3f50b765134588d0b048c32ed4b8acc16fb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
11b14d0e63 avcodec/wmalosslessdec: fix mclms_coeffs* array size
Fixes corruption of context
Fixes: 8835659dde6a4f7dcdf341de6a45c6c8-signal_sigsegv_1dce67b_4564_cov_2504444599_classical_22_16_1_14000_v3c_0_extend_0_29.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ec9578d54d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Justin Ruggles
bb683ebdba samplefmt: avoid integer overflow in av_samples_get_buffer_size()
CC:libav-stable@libav.org
(cherry picked from commit 0e830094ad)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
b3cc4bd18f avcodec/vc1: reset fcm/field_mode in non advanced header parsing
Fixes NULL pointer dereference
Fixes: signal_sigsegv_1ab8bf4_2847_cov_4254117347_SA10091.vc1
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b51e935477)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
ca9d302519 avcodec/takdec: always check bits_per_raw_sample
Fixes out of array access
Fixes: asan_heap-oob_19c7a94_6470_cov_1453611734_luckynight-partial.tak
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f58eab1512)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
e925fd215f avcodec/vmnc: Check that rectangles are within the picture
Prevents out of array accesses with CODEC_FLAG_EMU_EDGE

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

Conflicts:

	libavcodec/vmnc.c

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Michael Niedermayer
5e01cd3b69 dnxhdenc: fix mb_rc size
Fixes out of array access with RC_VARIANCE set to 0

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 03:06:10 +01:00
Anton Khirnov
2256b2a3c1 pthread_frame: flush all threads on flush, not just the first one
avcodec_flush_buffers() must release all internally held references
according to its documentation, for which all the threads need to be
flushed.

Bug-Id: vlc/9665
(cherry picked from commit d1f9563d50)

Conflicts:
	libavcodec/pthread_frame.c
2014-03-04 01:39:11 +01:00
Martin Storsjö
89c917fcd9 rtpdec_asf: Copy the need_parsing field from the chained demuxer
This fixes playback of mp3 streams in rtp/asf. This used to work
until 950482bf, but mostly by coincidence.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 2aec9e228c)

Fixes ticket #3223
2014-01-27 15:48:27 +01:00
Reimar Döffinger
8a38deb789 Fix compilation on ARM with android gcc 4.7
With the current code it fails due to running out
of registers.
So code the store offsets manually into the assembler
instead.
Passes "make fate-dts".

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(cherry picked from commit 8067f55edf)

Fixes ticket #2756.
2014-01-26 16:23:58 +01:00
Carl Eugen Hoyos
4fdcb1e1b7 Allow decoding of slightly broken Nikon avi files.
Fixes ticket #3330.
(cherry picked from commit f9c2d4d17e)

Conflicts:
	libavformat/avidec.c
2014-01-20 22:40:36 +01:00
Michael Niedermayer
b902ba478c avcodec/mjpegdec: Dont skip picture allocation if theres no picture allocated
Fixes Ticket 3245
(cherry picked from commit ad8d063f23)
2014-01-20 22:39:50 +01:00
Michael Niedermayer
f0fabcc6ed avcodec/mjpegdec: Dont treat the lack of a startcode differently from end of the bitstream
Fixes Ticket3303

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

Conflicts:
	libavcodec/mjpegdec.c
2014-01-19 14:43:47 +01:00
Michael Niedermayer
bd29764c61 avcodec/aacdec: Dont fail if channels arent known yet
Fixes Ticket3312

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

Conflicts:
	libavcodec/aacdec.c
2014-01-19 14:41:05 +01:00
Michael Niedermayer
d81ccf1fb2 avcodec/mjpegdec: only run EOI emulation code when there was a scan
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 361e27a3d8)
2014-01-19 14:38:03 +01:00
Michael Niedermayer
67d20495f5 avcodec/mjpegdec: update cur_scan also for non-LS jpeg
This should make no difference but the variable will be used in a subsequent commit

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

Conflicts:
	libavcodec/mjpegdec.c
2014-01-19 14:37:32 +01:00
Michael Niedermayer
5a0a156e88 cmdutils: update year
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 02:53:32 +01:00
Michael Niedermayer
884094deba Update for 1.2.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 02:52:53 +01:00
Michael Niedermayer
db20610c49 wmaprodec: Fix null pointer dereference in decode_frame()
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c7a7605656)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 01:58:13 +01:00
Michael Niedermayer
15a736483e h264: check mb_width/height
Fixes inconsistency that leads to out of array accesses with threads

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:52:56 +01:00
Michael Niedermayer
c8b90c7cd5 h264: Always decode MMCOs into temprary array
When decoding succeeded the array is copied into the permanent one.
This prevents inconsistencies
Fixes assertion failure

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:52:56 +01:00
Michael Niedermayer
97978b7ae8 h264: move the default_ref_list_done check down after its inputs have been written
Fixes out of array read

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:52:56 +01:00
Michael Niedermayer
3f2efac0fe h264: Move slice_table clean out of frame_start
Fixes inconsistency ultimately leading to an out of array read

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:52:56 +01:00
Michael Niedermayer
b9058f58bd h264_refs: Check for attempts to assign pictures to short & long.
Fixes null pointer dereference

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:49:11 +01:00
Michael Niedermayer
47faf347a0 h264_cavlc: fix assertion failure due to reading too long vlc
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 10ece44d09)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:48:58 +01:00
Michael Niedermayer
3d1e4b7ca5 avcodec/aacps: fix number of bands used with ipd/opd
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f861d16355f_1664_File1_fixed.aac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6433b393ba)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:47:25 +01:00
Michael Niedermayer
a2bea0df0e aacps: correct opdipd code to match spec
This fixes out of array reads

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:47:18 +01:00
Michael Niedermayer
483b2016bb avcodec/ansi: Fix right/bottom end checks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6021615bbe)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:45:22 +01:00
Michael Niedermayer
271f5d68b9 avcodec/ansi: Check x/y
This prevents out of array accesses

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:45:07 +01:00
Michael Niedermayer
dee327b0e7 shorten: fix "off by padding" bug
Fixes array overread

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:42:23 +01:00
Michael Niedermayer
e438fd3be9 avcodec/lcldec: Check that dimensions are a multiple of the subsample factors
Other dimensions would not work correctly currently,
also ask for a sample for files that fail this check.

This fixes an integer overflow leading to out of array
accesses.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
3d380ffde9 avformat/vqf: check number of channels before use.
Fixes division by zero

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
84b100396e dxa: check vectors of 2x2 motion blocks
Fixes out of array reads

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
7855083443 dxa: check vectors of 4x4 motion blocks
Fixes out of array reads

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
ca7f64e0ac shorten: allocate space for padding
Fixes array overread

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
2b26f8c6bf evrcdec: fix sign error
The specification wants round(abs(x))) * sign(x) which is
equivakent to round(x)

Fixes out of array access

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
6e3697b985 eamad: Check against minimum supported dimensions
Fixes out of array reads

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
c93501687c xan: Check for overlapping copies
No valid samples i found use such copies

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
bb6f466794 avcodec/bitstream: check codes in ff_init_vlc_sparse()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6998af4a40)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
08a319549a avcodec/bitstream: Check bits in ff_init_vlc_sparse()
Fixes out of array reads

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
d1da1c8384 avcodec/mpegvideo_motion: Use a field from the current frame if the last is unavailable in DMV & 16x8
Fixes null pointer dereference

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
8ded3738d1 avcodec/c93: Check for block overlap.
Fixes overlapping memcpy()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
a2186a8054 avcodec/mpegvideo_motion: Check P field references
If a reference is unavailable use a field from the current
picture
Fixes null pointer dereference

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
a92b73da99 svq3: use memmove to avoid overlap in memcpy.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4c8ce750ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
ab38b39059 evrcdec: use memmove() instead of memcpy() when regions can overlap.
This occurs also with valid files.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
5dde8ba59e avutil/log: skip IO calls on empty strings
These occur when no context is set for example, thus they are common

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
b841869477 avcodec/error_resilience: check that er is supported before attempting to read the status of the previous slice
Fixes incorrectly set error_occured and improves speed

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
3488e9e269 avcodec/error_resilience: factor er_supported() check out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit afb18c5578)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Paul B Mahol
5a8d78ab7f avcodec/libopusenc: change default frame duration to 20 ms
20 ms is used by libopus encoder.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 74906d3727)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
dea7f1c62e avcodec: move end zeroing code from av_packet_split_side_data() to avcodec_decode_subtitle2()
This code changes the input packet, which is read only and can in
rare circumstances lead to decoder errors. (i run into one of these in
the audio decoder, which corrupted the packet during av_find_stream_info()
so that actual decoding that single packet failed later)
Until a better fix is implemented, this commit limits the problem.
A better fix might be to make the subtitle decoders not depend on
data[size] = 0 or to copy their input when this is not the case.
(cherry picked from commit 01923bab98)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
c7027ae738 h264: Do not treat the initial frame special in handling of frame gaps
The not handling of frame gaps has lead to the lack of a dummy reference
frame, which has lead to the failure of decode_slice_header() which has
lead to one SEI recovery message being skiped which had introduced a
slightly suboptimal recovery point for at least 1 h264 file compared to
JM.

Found-by: Carl & BugMaster
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9e5ef1c5c3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
971b13752d avformat/thp: force moving forward
Fixes infinite loop
Fixes Ticket3098

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
d0ed672484 avformat/thp: fix variable types to avoid overflows
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2b1056e4e2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
751e684aae avcodec/jpeglsdec: check err value for ls_get_code_runterm()
Fixes infinite loop
Fixes Ticket3086

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
803ca5c349 avutil/opt: initialize ret
Fixes CID1108610
Fixes use of uninitialized variable

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
252002aec1 avcodec/utils: add some saftey checks to add_metadata_from_side_data()
This fixes potential overreads with crafted files.

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

Conflicts:

	libavcodec/utils.c
2014-01-16 00:35:12 +01:00
Michael Niedermayer
d805a51713 avcodec/avpacket/av_packet_split_side_data: ensure that side data padding is initialized
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 240fd8c96f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Michael Niedermayer
45dd7df83b avfilter/ff_insert_pad: fix order of operations
Fixes out of bounds access
Fixes CID732170
Fixes CID732169

No filter is known to use this function in a way so the issue can be reproduced.

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

Conflicts:

	libavfilter/avfilter.c
(cherry picked from commit 86591b244f3a27293153896813f5569b49b2f5c0)

Conflicts:

	libavfilter/avfilter.c
2014-01-16 00:35:12 +01:00
Michael Niedermayer
da82be0cc0 ffserver: strip odd chars from html error messages before sending them back
Fixes Ticket3034

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Paul B Mahol
b8b77aefe8 avcodec/ffv1dec: fix format detection
Fixes crash with carefuly designed files.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit a27227d401)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 00:35:12 +01:00
Carl Eugen Hoyos
30147f14d4 Do not read mkv audio bit_depth if bits_per_coded_sample is already set.
This allows decoding broken mkv files containing G.726 audio.
(cherry picked from commit 1132937077)
2014-01-16 00:28:49 +01:00
Carl Eugen Hoyos
d6a705d778 Do not set mkv bit_depth to av_get_bytes_per_sample() for G.726.
The value is wrong and leads to broken files.
(cherry picked from commit 565102dcac)
2014-01-16 00:28:15 +01:00
Michael Niedermayer
e24b33cd68 avcodec/msvideo1enc: fix SKIPS_MAX
Fixes Ticket3270

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fb8f5d0510)
2014-01-09 11:45:45 +01:00
Carl Eugen Hoyos
6f7fd2f589 Use the h264 parser when decoding VSSH in avi.
Fixes ticket #3261 visually.

Analyzed-by: Michael Doilnitsyn
(cherry picked from commit 94cf4f8bac)

Conflicts:
	libavformat/avidec.c
2014-01-08 10:24:03 +01:00
Michael Niedermayer
f974c54909 avformat/mxfdec: detect loops during header parsing
The header parser uses forward and backward parsing, making the
bulletproof prevention of loops difficult, thus this simple
detection code.
If someone improves the forward/backward parsing so it cannot loop
then this commit should be reverted

Fixes Ticket3278

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1c010fd035)
2014-01-08 10:22:31 +01:00
Michael Niedermayer
71b3235cea avformat/oggdec: dont read timestamps from EOS pages of ogm videos
Some muxers store invalid timestamps there, which breaks seeking
Fixes Ticket2739

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5e0c7eab2a)
2014-01-05 17:27:29 +01:00
Alexander Strasser
dcd1acce1a configure: Special case libfreetype test
Include the freetype header, in-directly through a macro, like it
is done in the drawtext filter. Do not break if the header is moved.

Unfortunately the drawtext filter included the file where the include
macros are defined in a wrong way. This is not needed and breaks the
build. Remove that #include line too.

(cherry picked from commit cea5812fa7)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>

Conflicts:
	configure
2013-12-29 11:37:29 +01:00
Michael Niedermayer
5c502e5d41 nutenc/write_index: warn if 2 consecutive keyframes have the same PTS and discard the 2nd
This fixes an assertion failure and regression and restores previous behaviour
Fixes Ticket3197

An alternative would be to fail hard in this case and refuse to mux such data.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit de2a2caf4d)
2013-12-24 08:06:42 +01:00
Peter Ross
fa45feefad wtvenc: populate VIDEOINFOHEADER2
Fixes ticket #2835.

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6da21c1f81)

Conflicts:
	tests/ref/lavf/wtv
	tests/ref/seek/lavf-wtv
2013-12-24 07:59:01 +01:00
Peter Ross
9f3135b30b avformat/riffenc: indent
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f93b0abe40)

Conflicts:
	libavformat/riffenc.c
2013-12-24 07:53:52 +01:00
Peter Ross
7ba102d008 riffenc: add option to ff_put_bmp_header to ignore extradata
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fcbb94712d)

Conflicts:
	libavformat/riffenc.c
2013-12-24 07:52:36 +01:00
Martin Storsjö
3e65caf5bc arm: Don't clobber callee saved registers in scalarproduct
q4-q7/d8-d15 are supposed to not be clobbered by the callee.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d307e408d4)
2013-12-21 09:55:05 +01:00
Michael Niedermayer
af7cbdf470 swscale/utils: check chroma width for fast bilinear scaler
Fixes artifacts where fast bilinear was used for downscaling chroma

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 037fc3b054)
2013-12-16 02:26:24 +01:00
Michael Niedermayer
414b377462 swscale/utils: remove useless ()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 554e913fd7)
2013-12-16 02:26:22 +01:00
Michael Niedermayer
86d4d4b011 avcodec/cabac: force get_cabac to be not inlined
works around bug in gccs inline asm register assignment
Fixes Ticket3177

gcc from 4.4 to 4.6 is affected at least, no non affected gccs known
clang seems not affected

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0538b29ae8)
2013-12-09 10:36:54 +01:00
Michael Niedermayer
14f31df2cc ffmpeg: Fix forcing of the framerate for stream copy on input
Fixes Ticket2211

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 356363c898)
2013-11-29 11:27:12 +01:00
Clément Bœsch
d04e78805a build: avoid stdin stall with GNU AS probing.
a758c5e added probing for various tools, such as AS. Unfortunately, GNU
AS is reading stdin with -v, and thus configure is stalled with
configure arguments such as --as=as.

Fixes Ticket #1898.
(cherry picked from commit dbb41f93c1)
2013-11-18 14:49:08 +01:00
Michael Niedermayer
25c67b2165 avformat/utils: dont count attached pics toward the probesize
Such pics behave more like headers which we also dont count.
Fixes Ticket3146

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a8dec360c5)
2013-11-18 14:48:53 +01:00
Michael Niedermayer
fd8af75109 avcodec/bink: fix seeking to frame 0
Fixes Ticket3088

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

Conflicts:
	libavcodec/bink.c
2013-10-31 01:01:52 +01:00
Michael Niedermayer
93d720b040 avformat/utils: do not override pts in h264 when they are provided from the demuxer
Fixes Ticket2143

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1e5271a9fd)
2013-10-27 19:43:26 +01:00
Michael Niedermayer
720e2d4143 h264: make flush_change() set mmco_reset
This ensures that frames do not get mixed on context reinits

Fixes Ticket2836

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3c9dd93faa)
2013-10-26 02:42:40 +02:00
Michael Niedermayer
9195ef6f65 avcodec/h264: reduce noisiness of "mmco: unref short failure"
Do not consider it an error if we have no frames and should discard one.
This condition can easily happen when decoding is started from an I frame

Fixes Ticket2811

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

Conflicts:
	libavcodec/h264_refs.c
2013-10-26 01:06:43 +02:00
Michael Niedermayer
833dce3818 avformat/mp3dec: perform seek resync in the correct direction
Fixes seeking to the last frame in CBR files
Fixes Ticket2773

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba8716df7f)
2013-10-26 01:05:12 +02:00
Michael Niedermayer
a8b6721bed avcodec/h264: do not trust last_pic_droppable when marking pictures as done
This simplifies the code and fixes a deadlock

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

Conflicts:
	libavcodec/h264.c
2013-10-26 01:03:53 +02:00
Michael Niedermayer
1fe734f4d3 avcodec/h264_refs: modify key frame detection heuristic to detect more cases
Fixes Ticket2968

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5ac6b6028f)
2013-10-24 11:07:37 +02:00
mrlika
311e58e478 lavd/v4l2: do not fail when VIDIOC_ENUMSTD returns EINVAL without a valid match
With some (buggy) drivers, the VIDIOC_G_STD ioctl returns a std_id that cannot
be matched with any of the enumerated v4l2_standard structures (for example
std_id = 0 or std_id = 0xffffff). Do not fail when we reach the end of the
enumeration without a valid match.

Fixes ticket #2370

Note: This commit message has been modified by Giorgio Vazzana, the original
commit message was:

"Fixed regression for mandatory VIDIOC_ENUMSTD support by v4l2"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ed72542539)
2013-10-24 11:02:35 +02:00
Michael Niedermayer
970109deaf avformat/wavdec: Dont trust the fact chunk for PCM
Fixes Ticket3033

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

Conflicts:
	libavformat/wavdec.c
2013-10-24 11:01:33 +02:00
Michael Niedermayer
eff0bf7def avformat/matroskadec: only set r_frame_rate if the value is within reasonable limits
Fixes Ticket2451

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6853e40106)
2013-10-24 10:57:14 +02:00
Michael Niedermayer
6559bb893f avformat/mov: force parsing of headers if stts is absent
Fixes Ticket2991

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e41ea866fc)
2013-10-24 10:54:46 +02:00
Michael Niedermayer
14e258d847 update for 1.2.4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:28:06 +02:00
Michael Niedermayer
ca47aec665 Merge remote-tracking branch 'TimothyGu/release/1.2' into release/1.2
* TimothyGu/release/1.2:
  doc/encoders: add doc for AAC encoder
  doc/encoders: improve libvo-aacenc doc
  doc/ffmpeg-formats: Add documentation for 3 parameters that have been missing
  doc/encoders: Remove options that were not there when branch was cut from master
  doc/encoders: reformat and add some clarification in libtwolame doc
  doc/encoders: reformat libmp3lame doc

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:18:26 +02:00
Michael Niedermayer
95e26d33d7 avcodec/parser: reset indexes on realloc failure
Fixes Ticket2982

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:19 +02:00
Michael Niedermayer
f32051cd73 avcodec/ffv1enc: update buffer check for 16bps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3728603f18)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:19 +02:00
Michael Niedermayer
c3ee5b4c36 avcodec/truemotion2: Fix av_freep arguments
Fixes null pointer dereference
Fixes Ticket2944

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

Conflicts:

	libavcodec/truemotion2.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:19 +02:00
Michael Niedermayer
c17fd9f9ce avcodec/mjpegdec: Add some sanity checks to ljpeg_decode_rgb_scan()
These prevent the rgb ljpeg code from being run on parameters that it doesnt
support. No testcase available but it seems possible to trigger these.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:18 +02:00
Michael Niedermayer
0f3cdddf38 avfilter/vf_fps: make sure the fifo is not empty before using it
Fixes Ticket2905

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:18 +02:00
Michael Niedermayer
a0d13f578b avcodec/dsputil: fix signedness in sizeof() comparissions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 454a11a1c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:18 +02:00
Michael Niedermayer
91e19ab930 ffv1dec: Check bits_per_raw_sample and colorspace for equality in ver 0/1 headers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b05cd1ea7e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:18 +02:00
Michael Niedermayer
bb4126e250 ffv1dec: check that global parameters dont change in version 0/1
Such changes are not allowed nor supported

Fixes Ticket2906

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:18 +02:00
Michael Niedermayer
9902eef0f5 avcodec/ffv1dec: check global header version
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 20b965a1a4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 01:04:18 +02:00
Timothy Gu
6db67ac2a4 doc/encoders: add doc for AAC encoder
Thanks-to: Kostya Shishkov <kostya.shishkov@gmail.com>
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 0e11790cf7)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-09-22 15:18:16 -07:00
Timothy Gu
85eeab4d22 doc/encoders: improve libvo-aacenc doc
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 81bbe49a0e)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-09-22 15:16:23 -07:00
Timothy Gu
4431ee1896 doc/ffmpeg-formats: Add documentation for 3 parameters that have been missing
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b7dd459863)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Conflicts:
	doc/formats.texi
2013-09-22 15:14:57 -07:00
Timothy Gu
d2feaf2ba6 doc/encoders: Remove options that were not there when branch was cut from master
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-09-22 14:58:21 -07:00
Timothy Gu
0f73cb454d doc/encoders: reformat and add some clarification in libtwolame doc
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit e45e72f5f8)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-09-22 14:58:21 -07:00
Timothy Gu
82cfb8c2db doc/encoders: reformat libmp3lame doc
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 40b8350b57)

Conflicts:
	doc/encoders.texi
2013-09-22 14:58:21 -07:00
Clément Bœsch
0a55c882cb avcodec/srtdec: fix potential overread.
(cherry picked from commit 3a54c221d5)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2013-09-16 21:39:34 +02:00
Clément Bœsch
c09acf9882 avformat/subtitles: add a next line jumper and use it.
This fixes a bunch of possible overread in avformat with the idiom p +=
strcspn(p, "\n") + 1 (strcspn() can focus on the trailing '\0' if no
'\n' is found, so the +1 leads to an overread).

Note on lavf/matroskaenc: no extra subtitles.o Makefile dependency is
added because only the header is required for ff_subtitles_next_line().

Note on lavf/mpsubdec: code gets slightly complex to avoid an infinite
loop in the probing since there is no more forced increment.

NOTE:
Code of function ff_subtitles_next_line fixed by Alexander Strasser.

The original code from master did test the wrong character, but was
corrected by a subsequent commit. That commit however is not backported,
so it had to be fixed in this commit for the backport.

Conflicts:
	libavformat/mpl2dec.c

(cherry picked from commit 90fc00a623)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2013-09-16 21:39:34 +02:00
Clément Bœsch
a0779a2ee5 avformat/srtdec: skip initial random line breaks.
I found a bunch of (recent) SRT files in the wild with 3 to 10 line
breaks at the beginning.

(cherry picked from commit cfcd55db16)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2013-09-16 21:39:33 +02:00
Carl Eugen Hoyos
b4f90013ab Use rc_max_rate if no video bit_rate was specified when muxing mxf_d10.
Fixes ticket #2945.

Reviewed-by: Matthieu Bouron
(cherry picked from commit d73565d5dd)
2013-09-12 23:15:49 +02:00
Carl Eugen Hoyos
3a6fbb0c8e Store the video bit_rate in the context when muxing mxf.
This will allow using rc_max_rate if no bit_rate is specified (on remuxing).

Reviewed-by: Matthieu Bouron
(cherry picked from commit 52cf08b4c8)
2013-09-12 23:15:44 +02:00
Clément Bœsch
6a782e20d7 avformat/subtitles: check lower bound for duration overlap seeking.
(cherry picked from commit 1ca4bf930b)
2013-09-10 21:39:16 +02:00
Clément Bœsch
8cea63c48a avformat/vobsub: fix seeking.
(cherry picked from commit f8678dcef3)
2013-09-10 21:39:12 +02:00
Paul B Mahol
8f87e75c6c avformat/matroskaenc: remove bogus prores tag
Fixes: ffmpeg -i input -c:v prores output.mkv

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 14851ca5f5)

Conflicts:
	libavformat/matroskaenc.c
2013-09-08 22:12:31 +02:00
Carl Eugen Hoyos
06a927a6b5 Read h264 headers from v4l2 to allow stream-copying.
Fixes ticket #2882.
Analyzed and tested by William C Bonner.
(cherry picked from commit e337c9d564)
2013-09-05 22:55:33 +02:00
Paul B Mahol
3c523bdda8 w64dec: fix end position of summarylist guid
Noticed-by: James Almer

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 3e36dc8626)
2013-09-05 22:55:25 +02:00
Paul B Mahol
ece54c7085 w64dec: fix skipping of unknown guids
Regression since 14d50c1.
Fixes #2932.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 79b70e47a4)
2013-09-05 22:55:15 +02:00
Carl Eugen Hoyos
7eee79ea2f Avoid a deadlock when decoding wma.
Fixes ticket #2925.
(cherry picked from commit ec8a4841f7)
2013-09-02 08:56:32 +02:00
Michael Niedermayer
458933fdb8 avformat/lxfdec: use a parser to parse video frame headers
lxf needs a parser (or would need to set a few fields explicitly).
Fixes Ticket2917

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8349be852b)
2013-09-01 10:01:25 +02:00
Michael Niedermayer
95d0baa952 avcodec/h264: set er.ref_count earlier
Fixes Ticket2910

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 93cf7b0195)
2013-09-01 10:01:22 +02:00
Michael Niedermayer
32cff0d3f0 avformat/avidec: match first index and first packet size=0 handling
Fixes Ticket2861

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

Conflicts:
	libavformat/avidec.c
2013-08-31 09:45:14 +02:00
Michael Niedermayer
ddce97c7b0 avcodec/pngdsp: fix (un)signed type in end comparission
Fixes out of array accesses
Fixes Ticket2919

Found_by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 86736f59d6)
2013-08-30 23:37:31 +02:00
Stefano Sabatini
26617b47fa doc/codecs: fix dangling reference to codec-options chapter
(cherry picked from commit b4bd21b7fe)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Conflicts:
	doc/codecs.texi
2013-08-27 01:21:34 +02:00
Michael Niedermayer
b3fb651a8a update for 1.2.3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-27 00:26:24 +02:00
Stefano Sabatini
2da5b69020 doc/filters: review introductory example and explanation
In particular, fix wrong vertical mirroring command, and clarify
and extend explanation.

Based on a patch by littlebat <dashing.meng@gmail.com>.

Should fix trac ticket #2413.
(cherry picked from commit 215ca86475)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Conflicts:
	doc/filters.texi
2013-08-26 12:00:03 -07:00
Timothy Gu
b23642aa7e doc/encoders: add libxvid doc
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 6b255e5e70)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Conflicts:
	doc/encoders.texi
2013-08-26 11:29:32 -07:00
Timothy Gu
eae4dfd4e8 doc/encoders: partially rewrite and reformat libx264 docs
Format is based on the thread:
"[PATCH] doc/encoders: Add libopus encoder doc" (06-28-2013)
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/165368/

Also merge the two option sections (Mapping and Private options).

Patch partially edited by Stefano Sabatini.

Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 11cb697501)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:29:16 -07:00
Timothy Gu
6fb2c03e1a doc/encoders: add libopus encoder doc
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 561e05136f)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:29:14 -07:00
Timothy Gu
1d6b261a24 doc/muxers: Add AIFF doc
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 4ec46b1160)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:28:25 -07:00
Timothy Gu
02f1ae5406 doc/decoders: document libopus decoder
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 7eb5288f17)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:28:25 -07:00
Timothy Gu
aaac34f5e6 doc/encoders: alphabetically list the encoders
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 934df3b037)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:27:39 -07:00
Timothy Gu
7858d261aa doc/decoders: Add libopencore-amrwb decoder doc
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 83647ace73)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:27:08 -07:00
Timothy Gu
f85c44264b doc/decoders: Document libopencore-amrnb decoder
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b43860ee0c)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:27:08 -07:00
Timothy Gu
025e286757 doc/decoders: Document libilbc decoder
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8cdea50f6e)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:27:08 -07:00
Timothy Gu
79ec45a455 doc/decoders: Document libgsm decoder
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c16496c377)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:27:08 -07:00
Timothy Gu
09653c5444 doc/encoders: Add libopencore-amrnb doc
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9ead06057a)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 11:27:01 -07:00
Timothy Gu
c788713589 doc/decoders: Document libcelt
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e358044922)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 09:26:22 -07:00
Timothy Gu
f637fa5d33 doc/general: Make the license status of the Android libraries clearer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6fe419bf73)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 09:25:53 -07:00
Timothy Gu
dc1881ee11 doc/encoders: Add libvo-amrwbenc doc
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0ec65aa104)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Conflicts:
	doc/encoders.texi
2013-08-26 09:20:30 -07:00
Timothy Gu
24187a96ee doc/encoders: Add libvo-aacenc doc
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba7cb4807f)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 09:19:42 -07:00
Timothy Gu
c87f3c3ab4 doc/encoders: add documentation for libtwolame
(cherry picked from commit ea038b996d)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 09:19:35 -07:00
Timothy Gu
8f07c09b20 doc/encoders: Add documentation for libmp3lame
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4703a345fb)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 09:19:29 -07:00
Timothy Gu
8e3581ab03 doc/filters: fix width/height typo in crop filter.
Signed-off-by: Clément Bœsch <ubitux@gmail.com>
(cherry picked from commit 874173002e)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2013-08-26 09:19:19 -07:00
Michael Niedermayer
5d3cd041fc avformat/matroskadec: check out_samplerate before using it in av_rescale()
Prevent assertion failure with damaged input

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-26 04:51:06 +02:00
James Almer
9865f19f15 matroskadec: Improve TTA duration calculation
Calculate the duration as accurately as possible to improve decoding of samples
where the last frame is smaller than the rest.

Signed-off-by: James Almer <jamrial@gmail.com>
Approved-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit af248fa117)
2013-08-26 04:51:06 +02:00
Michael Niedermayer
90ed770192 matroskaenc: simplify mkv_check_tag()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 066111bf19)
2013-08-26 04:51:06 +02:00
James Almer
f9fa321734 lavf/matroskaenc: Check for valid metadata before creating tags
Tags must have at least one SimpleTag element to be spec conformant.
Updated lavf-mkv and seek-lavf-mkv FATE references as the tests were affected by
this.

Fixes ticket #2785

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 088ed53146)
2013-08-26 04:51:06 +02:00
Michael Niedermayer
a0e328d28b matroska_read_seek: Fix used streams for subtitle index compensation
Might fix Ticket1907 (I have no testcase so i cant test)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-26 04:51:06 +02:00
Michael Niedermayer
848e5cfc0f jpeg2000: check log2_cblk dimensions
Fixes out of array access
Fixes Ticket2895

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

Conflicts:

	libavcodec/jpeg2000dec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-25 20:23:53 +02:00
Michael Niedermayer
9d8795e598 avcodec/rpza: Perform pointer advance and checks before using the pointers
Fixes out of array accesses
Fixes Ticket2850

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-25 19:50:54 +02:00
Michael Niedermayer
64d440a3b4 avcodec/flashsv: check diff_start/height
Fixes out of array accesses
Fixes Ticket2844

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-25 19:50:54 +02:00
Michael Niedermayer
42586c8754 avformat/paf: Fix integer overflow and out of array read
Found-by:  Laurent Butti <laurentb@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f58cd2867a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-25 19:50:54 +02:00
Michael Niedermayer
64d362fce7 avfilter: fix plane validity checks
Fixes out of array accesses

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

Conflicts:

	libavfilter/vf_delogo.c
	libavfilter/vf_fieldmatch.c
	libavfilter/vf_fieldorder.c
	libavfilter/vf_hflip.c
	libavfilter/vf_kerndeint.c
	libavfilter/vf_lut.c
	libavfilter/vf_pad.c
	libavfilter/vf_showinfo.c
	libavfilter/vf_vignette.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-25 19:50:54 +02:00
Michael Niedermayer
c55a09a8b6 swr/rematrix: Fix handling of AV_CH_LAYOUT_STEREO_DOWNMIX output
Fixes Ticket2859

Note, testcases related to the downmix channels are welcome.
(id like to make sure this is working correctly now, as obviously it didnt
 work before ...)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c56d4dab03)
2013-08-20 18:42:44 +02:00
Michael Niedermayer
a94404457b swr: clean layouts before checking sanity
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6dfffe9200)
2013-08-20 18:42:40 +02:00
Michael Niedermayer
364495a351 movenc: ilbc needs audio_vbr set.
Without this the block_align or bitrate value is not available to the decoder

Fixes Ticket2858

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3d64845600)
2013-08-20 18:42:13 +02:00
Michael Niedermayer
f9c872622e avcodec/kmvc: fix MV checks
Fixes Ticket2813
Fixes regression since 70b5583

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3cd8aaa2b2)
2013-07-31 02:56:15 +02:00
Paul B Mahol
9f2d73168f Revert "pnm: remove nonsense code"
Breaks decoding pgms with 255 < maxval < 65535.

Found-by: Carl Eugen Hoyos <cehoyos@ag.or.at>.

This reverts commit a0348d0966.
(cherry picked from commit 768e40b451)
2013-07-29 00:02:59 +02:00
Michael Niedermayer
930d035e72 update for 1.2.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-28 00:24:46 +02:00
Michael Niedermayer
875649bfae avformat/dtsdec: Improve probe, reject things looking like analog signals
Fixes Ticket2810

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

Conflicts:
	libavformat/dtsdec.c
2013-07-26 12:16:29 +02:00
Rémi Denis-Courmont
70127070dd mpeg12: Ignore slice threading if hwaccel is active
Slice threading does not work with hardware acceleration, as decoding
is per-picture.  This fixes Bugzilla #542.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit 93a51984a2)

Conflicts:
	libavcodec/mpeg12dec.c
2013-07-26 11:43:38 +02:00
Michael Niedermayer
d83ab33715 swscale/input: fix 16bit gbrp input
Fixes Ticket2793

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

Conflicts:
	libswscale/input.c
2013-07-19 14:59:58 +02:00
Michael Niedermayer
06190d75d0 avformat/matroskadec: Detect conflicting sample rate/default_duration
Fixes Ticket2508

Thanks-to: Moritz Bunkus
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6158a3bcdf)
2013-07-16 11:47:52 +02:00
Michael Niedermayer
c9ea1f7fc5 Merge remote-tracking branch 'jamrial/release/1.2' into release/1.2
* jamrial/release/1.2:
  oggparseskeleton: avoid header parsing failure
  oggparseskeleton: Replace avpriv_report_missing_feature() with a normal av_log() call
  oggparseskeleton: Fix fisbone header parsing

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-15 01:20:44 +02:00
Michael Niedermayer
47de8ccf42 avfilter/af_earwax: Fix out of array accesses on odd packets
Found-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0a3a0edd52)

Conflicts:

	libavfilter/af_earwax.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-10 19:07:10 +02:00
Michael Niedermayer
72c1de649a avcodec/qdm2: initialize sign_bits
Fixes non deterministic output

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-10 19:05:23 +02:00
Michael Niedermayer
5e3e67f977 avcodec/qdm2: store bits in an integer instead of float variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fbe159e850)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-10 19:05:21 +02:00
Luca Barbato
221bbd002c atrac3: fix error handling
decode_tonal_components returns a proper AVERROR.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-10 18:56:45 +02:00
Luca Barbato
fffc9316da indeo: Properly forward the error codes
If the tile data size does not match the buffer size it did not
return an AVERROR_INVALIDDATA causing futher corruption later.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 7388c0c586)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-10 18:51:42 +02:00
Michael Niedermayer
9a87ba0933 update all trac links to use the trac subdomain
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-10 18:46:35 +02:00
Dale Curtis
d8538a1002 avformat/utils: Keep internal and external av_read_frame() packets in sync.
Otherwise, during error conditions, the caller will be left with
dangling pointers to a destructed packet => boom.

BUG=242786
TEST=ffmpeg_regression_tests

Commit slightly simplified by commiter
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c54a1565f5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-10 18:46:35 +02:00
Michael Niedermayer
6cb33e0763 mpeg12dec: avoid reinitialization on PS changes when possible.
Fixes Ticket2574

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

Conflicts:
	libavcodec/mpeg12dec.c
2013-07-09 00:21:03 +02:00
Michael Niedermayer
2e75c45593 mp3dec: detect CBR and use CBR axiom to seek
This should also work reasonable with truncated and growing mp3s.
Fixes Ticket2590

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

Conflicts:
	libavformat/mp3dec.c
2013-07-09 00:20:37 +02:00
Michael Niedermayer
ba4cb43f0b oggparseskeleton: avoid header parsing failure
Based on description by James Almer and the xiph wiki

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9a6e814be7)
2013-07-07 21:42:01 -03:00
James Almer
dc73774792 oggparseskeleton: Replace avpriv_report_missing_feature() with a normal av_log() call
since there should not be more than one fisbone for a given stream.

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

Conflicts:
	libavformat/oggparseskeleton.c
2013-07-07 21:41:37 -03:00
James Almer
ce11d9490c oggparseskeleton: Fix fisbone header parsing
start_granule should be applied to the stream referenced in the fisbone packet, not to the
Skeleton stream.
This was broken in d1f05dd183 and produced bogus warnings about
multiple fisbone in the same stream on files with more than one stream.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3960992f0a)
2013-07-07 21:41:16 -03:00
Michael Niedermayer
430ef8a716 mmsh: dont close context on seeking failure
Fixes Ticket2581

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b4579a29c7)
2013-07-07 21:32:19 +02:00
Michael Niedermayer
627772d988 avformat/mov: Fix duration of fragmented mov
Fixes Ticket2757

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dc2a13aa80)
2013-07-07 18:25:25 +02:00
Michael Niedermayer
5ce57e0248 libavcodec/x86/mpegvideo: Move mmx functions under HAVE_MMX_INLINE
should fix ticket2755

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 707b2135fd)
2013-07-07 18:24:18 +02:00
Michael Niedermayer
5effd65312 avcodec/x86/vp3dsp_init: move mmx functions under HAVE_MMX_INLINE
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit abce6dfd9e)
2013-07-07 18:23:59 +02:00
Michael Niedermayer
cb340ecd7d mpegts: only reopen pmt_cb filter if its different from the previous.
Fixes Ticket2632

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b009267910)
2013-07-07 18:20:18 +02:00
Michael Niedermayer
b88bea1d6c rmdec: Pass AVIOContext to rm_read_metadata()
Fix null pointer dereference
Fixes Ticket2588

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bf87908cd8)
2013-07-07 18:15:57 +02:00
Michael Niedermayer
99036565ca avcodec/x86/dsputil_init: only use xvid idct for lowres=0
Fixes crash
Fixes Ticket2714

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

Conflicts:
	libavcodec/x86/dsputil_init.c
2013-07-07 18:14:55 +02:00
Nigel Touati-Evans
fcc6460dbf Fix copying extradata to codec in mxfdec.c
The code that copies any extradata from the MXFDescriptor to the codec does
not set the size, which it should otherwise the copied data is useless.

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

Conflicts:
	libavformat/mxfdec.c
2013-06-27 14:15:12 +02:00
Hendrik Leppkes
1065d4197e mathops/x86: work around inline asm miscompilation with GCC 4.8.1
The volatile is not required here, and prevents a miscompilation with GCC
4.8.1 when building on x86 with --cpu=i686

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 659df32a9d)
2013-06-24 08:44:24 +02:00
Michael Niedermayer
fbb1af39e4 avdevice/x11grab: allocate just one Cursor
Fixes resource leak and Ticket2450

Reviewed-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1ee8fadb81)
2013-06-21 16:45:36 +02:00
Michael Niedermayer
073bde2b1f avformat/iff: Byte seek is unsupported
Fixes Ticket2194

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03cd3bec6e)
2013-06-21 01:11:56 +02:00
Michael Niedermayer
e4bb67bc50 avformat/libmodplug: Reduce the probe score for small input
This ensures that theres enough data for mpeg_probe() to recognize mpeg-ps
Fixes Ticket2583

Based on code by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c605adbf56)
2013-06-21 01:11:45 +02:00
Carl Eugen Hoyos
59549b5ab7 Autodetect idcin only if audio properties allow decoding.
Fixes ticket #2688.
(cherry picked from commit 06bede95fc)
2013-06-19 23:45:18 +02:00
Michael Niedermayer
c0445df5b3 ff_gen_search: fix infinite loop
Fixes Ticket2639

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f8ca8138f0)
2013-06-18 23:46:14 +02:00
Michael Niedermayer
c77b3737b9 ff_gen_search: fix limit
The limit value could become slightly wrong in the last iteration

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b3dd50cd0d)
2013-06-18 23:46:05 +02:00
Michael Niedermayer
04d6946600 ff_gen_search: make step 64 bit to prevent hypothetical integer overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9d73e30253)
2013-06-18 23:45:37 +02:00
Michael Niedermayer
ae93d3405e swresample/x86/audio_convert: add emms to CONV
Fixes ticket #1874

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ca2818b881)
2013-06-18 02:52:30 +02:00
Janne Grunau
054779625f vaapi: return early from ff_vaapi_render_picture() without picture
Fixes an assertion when called on uninitialized frame. Spotted after
seeking in vlc.
Fixes ticket #2461.

Tested-by: Timo
Reviewed-by: Joakim Plate
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
(cherry picked from commit 2ee380aefb)
2013-06-18 02:12:18 +02:00
Michael Niedermayer
e22dd7fbd0 alacenc: Fix missing sign_extend()
Fixes ticket #2497

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8aea2f05dc)
2013-06-13 00:01:13 +02:00
Michael Niedermayer
376a9f8e6e avcodec/utils: Fix encoder allocation size
Fixes Ticket2645
Found-by: Darrell Walisser
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 175e916fa2)

Conflicts:
	libavcodec/utils.c
2013-06-11 09:49:56 +02:00
Claudio Freire
9af68f8d1f AAC encoder: Fix rate control on twoloop.
Fixes a case where multichannel bitrate isn't accurately
targetted by psy model alone, never achieving the target bitrate.
Now fixed.

Fixes ticket #2625.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
2013-06-02 16:18:09 +02:00
Michael Niedermayer
f2361593ca mpegvideo: implement ff_put_h264_chroma_mc1 & ff_avg_h264_chroma_mc2
These are needed for lowres 3

Fixes Ticket2538

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

Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
2013-06-02 16:17:09 +02:00
Michael Niedermayer
96e6d4da37 h264_cavlc: fix reading skip run
Fixes Ticket2606

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 826b3a75cd)
2013-05-30 22:33:03 +02:00
Michael Niedermayer
735deda2cf avienc: Disallow the first frame to be skiped
Fixes Ticket2386

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cc0db8cf30)
2013-05-27 23:52:08 +02:00
Michael Niedermayer
5f64a7a625 smacker: remove av_clip_int16()
Fixes Ticket2425

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2211c76287)
2013-05-20 23:56:53 +02:00
Michael Niedermayer
ffd28de388 ffmpeg: free threads on error conditions.
Fixes Ticket2562

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1a36c756d8)
2013-05-17 23:21:43 +02:00
Carl Eugen Hoyos
af589dd5e9 configure: Autodetect VA-API
This fixes a regression (reproducible since 1.2) and restores the
behaviour of 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 1.0 and 1.1.
(cherry picked from commit 17989dcf54)
2013-05-17 23:02:19 +02:00
Michael Niedermayer
fd60aeb55b avidec: dont randomly skip packets for offseting the index
Fixes Ticket2490

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6c593f1b67)
2013-05-17 22:51:37 +02:00
Carl Eugen Hoyos
79a3f364dd Do not read strd chunk in avi files as H264 extradata.
Fixes ticket #2561.
(cherry picked from commit 231b331718)
2013-05-13 14:25:11 +02:00
Carl Eugen Hoyos
33d699a4e7 Fix configure --help output for some autodetected features.
(cherry picked from commit 0f05b72f19)
2013-05-10 10:53:08 +02:00
Michael Niedermayer
f166a02b67 exr: silence warning "libavcodec/exr.c:351:9: warning: variable ret set but not used"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7ff3bfd584)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:22:26 +02:00
Michael Niedermayer
c5948b472b update for 1.2.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:17:06 +02:00
Michael Niedermayer
7ee5e97c46 gifdec: reset previous Graphic Control Extension disposal type
This fixes out of array accesses.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:16:23 +02:00
Michael Niedermayer
7ef2dbd239 avcodec/cdgraphics: check buffer size before use
Fixes out of array accesses

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:16:23 +02:00
Michael Niedermayer
524d0d2cfc sanm: Check dimensions before use
Fixes integer overflow and out of array accesses

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:16:23 +02:00
Clément Bœsch
91f04e7410 cmdutils: avtool -> fftool
(cherry picked from commit 7d8ad6c1fa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:16:23 +02:00
Michael Niedermayer
9f7baf139f avutil/intfloat_readwrite: include common.h for isinf()
Solution based on rational.c, which uses isinf() too

This should fix compilation with msvc

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:16:23 +02:00
Michael Niedermayer
ec89046fa1 avutil/intfloat_readwrite: avoid comparission with INFINITY, use isinf()
Should fix pgc warning

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:16:23 +02:00
Michael Niedermayer
cc0dd86580 avutil/log: Fix context pointer used for get_category()
Fixes calling a random pointer

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:02:15 +02:00
Michael Niedermayer
0baa0a5a02 vmdav: Try to fix unpack_rle()
This fixes out of array accesses
The code prior to this commit could not have worked, thus obviously
was untested. I was also not able to find a valid sample that uses this
code.
This fix is thus only based on the description of the format

If someone has a sample that uses unpack_rle(), please mail me.

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

Conflicts:

	libavcodec/vmdav.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 22:01:55 +02:00
Michael Niedermayer
039f6921c2 mmvideo/mm_decode_intra: check horizontal coordinate too
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ae2132ac90)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:44:08 +02:00
Michael Niedermayer
7fa6db2545 mmvideo/mm_decode_inter: check horizontal coordinate too
Fixes out of array accesses

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:44:03 +02:00
Michael Niedermayer
840931e766 mjpegdec: fix overlapping memcpy with upscale_v
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b39fd7d63648442c20671c3e4b357268ec5c49f2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:42:40 +02:00
Michael Niedermayer
1ce3f736d2 src_movie: fix scanf string
Fixes out of array accesses

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:01:03 +02:00
Michael Niedermayer
4d0090f90a xbmdec: fix off by one error in scanf()
Fixes out of array access

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:01:02 +02:00
Dale Curtis
f8d5f3dff5 Fix heap-buffer-overflow in matroska_parse_block
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 81e85bc95c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:01:02 +02:00
ArnoB
298e03d102 dpxenc: fix data offset
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 361319d0f4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:01:02 +02:00
Michael Niedermayer
54f3902393 rmdec: flush audio packet on seeking
Fixes Ticket1605

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-09 21:01:02 +02:00
Michael Niedermayer
3ca6253beb avcodec/mpegvideo: Fix edge emu with lowres
Fixes a few green artifacts at the top
Fixes rest of Ticket 2535

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c67bca2b5a)
2013-05-09 17:21:12 +02:00
Michael Niedermayer
84df0dc40b avcodec/mpegvideo: Fix block height for lowres 3 interlaced blocks
Fixes green trash
Fixes part of Ticket2535

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bca50e5cd5)
2013-05-09 17:20:52 +02:00
Reimar Döffinger
a857811c75 matroska: set "done" only during resync fail.
Fixes playback of test7.mkv validation test file.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(cherry picked from commit 762d4335ae)
2013-05-09 17:19:37 +02:00
Clément Bœsch
3d6219b6db lavfi/subtitles: zero-init AVSubtitle.
This avoids invalid free when the stream id doesn't match the packet
stream index.

Ticket #2501
(cherry picked from commit 035a3792c2)
2013-05-09 17:05:02 +02:00
Carl Eugen Hoyos
0a53c7016f Fix type of shared flac table ff_flac_blocksize_table[].
Fixes ticket #2533.
(cherry picked from commit a07ac1f788)
2013-05-05 20:39:56 +02:00
Janne Grunau
f0dc5c0419 vaapi: fix argument for ff_vaapi_common_end_frame call
(cherry picked from commit b066d90211)
2013-04-13 10:09:50 +02:00
Nicolas George
df8c36265a lavc: fix recoded subtitles end.
Text subtitles packets are not 0-terminated (and if they are,
it is handled by the recoding process since 0 is a valid
Unicode code point). The terminating 0 would overwrite the
last payload octet.

OTOH, packets must be 0-padded.

Fix a problem reported in trac ticket #2431.
2013-04-07 15:36:10 +02:00
Carl Eugen Hoyos
c351d8781d Skip padding in an id3 tag in aiff files.
Fixes ticket #2430.

Reviewed-by: Matthieu Bouron
(cherry picked from commit db2d3a9082)
2013-04-03 23:22:11 +02:00
Paul B Mahol
d553a522b9 smacker: fix off by one error
Regression since a93b572ae4.

Fixes #2426.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit e3cc92a623)
2013-04-03 15:16:06 +02:00
Carl Eugen Hoyos
0b6d5f27c8 Write broken aac frames to mov files instead of skipping them.
Fixes decoding with picky media players.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b448c0a68d)
2013-04-02 12:50:05 +02:00
Carl Eugen Hoyos
9ecfd7daa3 Only test the first frame for missing aac_adtstoasc bistream filter.
Many players ignore broken aac frames, so don't abort mov or flv
muxing when encountering one, just print a warning instead.

Fixes ticket #2380.
(cherry picked from commit 1741fece70)
2013-03-27 00:50:39 +01:00
Diego Biurrun
90f1aa38b6 configure: Enable hwaccels without external dependencies by default.
Fixes ticket #2368.
(cherry picked from commit 2e2ec66741)
2013-03-22 13:24:16 +01:00
Carl Eugen Hoyos
fc5c81ce0a Do not (re-)set libx264 parameter b_tff if interlaced encoding was not requested.
Reconfiguring can break x264 lossless encoding.

Fixes ticket #2165.
(cherry picked from commit 75c7e4583f)
2013-03-18 02:11:30 +01:00
Fabrizio Gennari
e820e3a259 mem: Fix usage of memalign() on DJGPP.
Credits to Khusraw of bttr-software.de forum.
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
(cherry picked from commit 91b747ac78)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 23:30:35 +01:00
Michael Niedermayer
17911d0a96 release_notes: update
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 23:30:35 +01:00
Michael Niedermayer
2ed7f5a670 Changelog: update version
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 23:30:35 +01:00
Michael Niedermayer
7c6c5767eb jpegdec: be less picky on padding
Fixes Ticket2353

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3c24fbbf65)
2013-03-14 21:59:42 +01:00
Michael Niedermayer
0ec869527c mpegts: clear avprograms only for removed programs
Fixes Ticket2186

Requested-by: carl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 806a66fd08)
2013-03-10 09:55:39 +01:00
Carl Eugen Hoyos
0b198e38c5 Revert "build: disable iconv by default."
This reverts commit 9ad3cd5b5f.

The misdetection on OS X should be fixed, we will only get
problem reports if auto-detection is enabled.
(cherry picked from commit 3f78f0904b)
2013-03-10 09:55:25 +01:00
Michael Niedermayer
1ea3248290 Update for FFmpeg 1.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-09 14:31:52 +01:00
Michael Niedermayer
bdd2db60c2 MAINTAINERS: update for 1.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 14:45:46 +01:00
263 changed files with 2742 additions and 1003 deletions

View File

@@ -1,7 +1,15 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version <next>:
version 1.2.8:
- proresenc_ks: fix buffer overflow
- iff: fix crash
- cdgraphics: fix infinite loop
- Fix Ticket3804
- Fix Ticket3208
version 1.2:
- VDPAU hardware acceleration through normal hwaccel
- SRTP support

View File

@@ -445,9 +445,9 @@ x86 Michael Niedermayer
Releases
========
1.2 Michael Niedermayer
1.1 Michael Niedermayer
1.0 Michael Niedermayer
0.11 Michael Niedermayer

View File

@@ -1 +1 @@
1.1.git
1.2.12

View File

@@ -65,7 +65,7 @@ struct SwsContext *sws_opts;
AVDictionary *swr_opts;
AVDictionary *format_opts, *codec_opts, *resample_opts;
const int this_year = 2013;
const int this_year = 2015;
static FILE *report_file;

View File

@@ -190,13 +190,13 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
void show_help_children(const AVClass *class, int flags);
/**
* Per-avtool specific help handler. Implemented in each
* avtool, called by show_help().
* Per-fftool specific help handler. Implemented in each
* fftool, called by show_help().
*/
void show_help_default(const char *opt, const char *arg);
/**
* Generic -h handler common to all avtools.
* Generic -h handler common to all fftools.
*/
int show_help(void *optctx, const char *opt, const char *arg);

56
configure vendored
View File

@@ -140,10 +140,10 @@ Component options:
--disable-fft disable FFT code
Hardware accelerators:
--enable-dxva2 enable DXVA2 code
--enable-vaapi enable VAAPI code
--disable-dxva2 disable DXVA2 code [autodetect]
--disable-vaapi disable VAAPI code [autodetect]
--enable-vda enable VDA code
--enable-vdpau enable VDPAU code
--disable-vdpau disable VDPAU code [autodetect]
Individual component options:
--disable-everything disable all components listed below
@@ -184,11 +184,11 @@ Individual component options:
External library support:
--enable-avisynth enable reading of AVISynth script files [no]
--enable-bzlib enable bzlib [autodetect]
--disable-bzlib disable bzlib [autodetect]
--enable-fontconfig enable fontconfig
--enable-frei0r enable frei0r video filtering
--enable-gnutls enable gnutls [no]
--enable-iconv enable iconv [no]
--disable-iconv disable iconv [autodetect]
--enable-libaacplus enable AAC+ encoding via libaacplus [no]
--enable-libass enable libass subtitles rendering [no]
--enable-libbluray enable BluRay reading using libbluray [no]
@@ -235,7 +235,7 @@ External library support:
--enable-openal enable OpenAL 1.1 capture support [no]
--enable-openssl enable openssl [no]
--enable-x11grab enable X11 grabbing [no]
--enable-zlib enable zlib [autodetect]
--disable-zlib disable zlib [autodetect]
Advanced options (experts only):
--cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
@@ -1075,6 +1075,26 @@ require_pkg_config(){
add_extralibs $(get_safe ${pkg}_libs)
}
require_libfreetype(){
log require_libfreetype "$@"
pkg="freetype2"
check_cmd $pkg_config --exists --print-errors $pkg \
|| die "ERROR: $pkg not found"
pkg_cflags=$($pkg_config --cflags $pkg)
pkg_libs=$($pkg_config --libs $pkg)
{
echo "#include <ft2build.h>"
echo "#include FT_FREETYPE_H"
echo "long check_func(void) { return (long) FT_Init_FreeType; }"
echo "int main(void) { return 0; }"
} | check_ld "cc" $pkg_cflags $pkg_libs \
&& set_safe ${pkg}_cflags $pkg_cflags \
&& set_safe ${pkg}_libs $pkg_libs \
|| die "ERROR: $pkg not found"
add_cflags $(get_safe ${pkg}_cflags)
add_extralibs $(get_safe ${pkg}_libs)
}
hostcc_o(){
eval printf '%s\\n' $HOSTCC_O
}
@@ -2169,6 +2189,9 @@ enable safe_bitstream_reader
enable static
enable swscale_alpha
# Enable hwaccels by default.
enable dxva2 vaapi vdpau
# build settings
SHFLAGS='-shared -Wl,-soname,$$(@F)'
FFSERVERLDFLAGS=-Wl,-E
@@ -2633,7 +2656,9 @@ probe_cc(){
unset _depflags _DEPCMD _DEPFLAGS
_flags_filter=echo
if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
true # no-op to avoid reading stdin in following checks
elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
_type=llvm_gcc
gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
_ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
@@ -3725,6 +3750,7 @@ EOF
fi
check_ldflags -Wl,--as-needed
check_ldflags -Wl,-z,noexecstack
if check_func dlopen; then
ldl=
@@ -3873,7 +3899,6 @@ fi
check_lib math.h sin -lm && LIBM="-lm"
disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
enabled vaapi && require vaapi va/va.h vaInitialize -lva
atan2f_args=2
ldexpf_args=2
@@ -3891,7 +3916,7 @@ enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_in
enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
enabled libass && require_pkg_config libass ass/ass.h ass_library_init
enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open
enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
{ check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
@@ -3900,7 +3925,7 @@ enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaa
enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
enabled libfreetype && require_libfreetype
enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
check_lib "${gsm_hdr}" gsm_create -lgsm && break;
done || die "ERROR: libgsm not found"; }
@@ -4041,19 +4066,16 @@ require X11 X11/Xlib.h XOpenDisplay -lX11 &&
require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
if ! disabled vaapi; then
check_lib va/va.h vaInitialize -lva && {
check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
} || disable vaapi
fi
enabled vaapi &&
check_lib va/va.h vaInitialize -lva ||
disable vaapi
enabled vdpau &&
check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
disable vdpau
# Funny iconv installations are not unusual, so check it after all flags have been set
enabled iconv && { check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || die "ERROR: iconv not found"; }
disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
enabled coverage && add_cflags "-fprofile-arcs -ftest-coverage" && add_ldflags "-fprofile-arcs -ftest-coverage"

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 = 1.2.12
# With the PROJECT_LOGO tag one can specify an logo or icon that is included
# in the documentation. The maximum height of the logo should not exceed 55

View File

@@ -1,7 +1,7 @@
Release Notes
=============
* 0.10 "Freedom" January, 2012
* 1.2 "Magic" March, 2013
General notes
@@ -14,9 +14,3 @@ accepted. If you are experiencing issues with any formally released version of
FFmpeg, please try git master to check if the issue still exists. If it does,
make your report against the development code following the usual bug reporting
guidelines.
Of big interest to our Windows users, FFmpeg now supports building with the MSVC
compiler. Since MSVC does not support C99 features used extensively by FFmpeg,
this has been accomplished using a converter that turns C99 code to C89. See the
platform-specific documentation for more detailed documentation on building
FFmpeg with MSVC.

View File

@@ -60,6 +60,78 @@ This decoder generates wave patterns according to predefined sequences. Its
use is purely internal and the format of the data it accepts is not publicly
documented.
@section libcelt
libcelt decoder wrapper
libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec.
Requires the presence of the libcelt headers and library during configuration.
You need to explicitly configure the build with @code{--enable-libcelt}.
@section libgsm
libgsm decoder wrapper
libgsm allows libavcodec to decode the GSM full rate audio codec. Requires
the presence of the libgsm headers and library during configuration. You need
to explicitly configure the build with @code{--enable-libgsm}.
This decoder supports both the ordinary GSM and the Microsoft variant.
@section libilbc
libilbc decoder wrapper
libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC)
audio codec. Requires the presence of the libilbc headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libilbc}.
@subsection Options
The following option is supported by the libilbc wrapper.
@table @option
@item enhance
Enable the enhancement of the decoded audio when set to 1. The default
value is 0 (disabled).
@end table
@section libopencore-amrnb
libopencore-amrnb decoder wrapper
libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate
Narrowband audio codec. Using it requires the presence of the
libopencore-amrnb headers and library during configuration. You need to
explicitly configure the build with @code{--enable-libopencore-amrnb}.
An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB
without this library.
@section libopencore-amrwb
libopencore-amrwb decoder wrapper.
libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate
Wideband audio codec. Using it requires the presence of the
libopencore-amrwb headers and library during configuration. You need to
explicitly configure the build with @code{--enable-libopencore-amrwb}.
An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB
without this library.
@section libopus
libopus decoder wrapper.
libopus allows libavcodec to decode the Opus Interactive Audio Codec.
Requires the presence of the libopus headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libopus}.
@c man end AUDIO DECODERS
@chapter Subtitles Decoders

View File

@@ -25,6 +25,95 @@ enabled encoders.
A description of some of the currently available audio encoders
follows.
@anchor{aacenc}
@section aac
Advanced Audio Coding (AAC) encoder.
This encoder is an experimental FFmpeg-native AAC encoder. Currently only the
low complexity (AAC-LC) profile is supported. To use this encoder, you must set
@option{strict} option to @samp{experimental} or lower.
As this encoder is experimental, unexpected behavior may exist from time to
time. For a more stable AAC encoder, see @ref{libvo-aacenc}. However, be warned
that it has a worse quality reported by some users.
@c Comment this out until somebody writes the respective documentation.
@c See also @ref{libfaac}, @ref{libaacplus}, and @ref{libfdk-aac-enc}.
@subsection Options
@table @option
@item b
Set bit rate in bits/s. Setting this automatically activates constant bit rate
(CBR) mode.
@item q
Set quality for variable bit rate (VBR) mode. This option is valid only using
the @command{ffmpeg} command-line tool. For library interface users, use
@option{global_quality}.
@item stereo_mode
Set stereo encoding mode. Possible values:
@table @samp
@item auto
Automatically selected by the encoder.
@item ms_off
Disable middle/side encoding. This is the default.
@item ms_force
Force middle/side encoding.
@end table
@item aac_coder
Set AAC encoder coding method. Possible values:
@table @samp
@item 0
FAAC-inspired method.
This method is a simplified reimplementation of the method used in FAAC, which
sets thresholds proportional to the band energies, and then decreases all the
thresholds with quantizer steps to find the appropriate quantization with
distortion below threshold band by band.
The quality of this method is comparable to the two loop searching method
descibed below, but somewhat a little better and slower.
@item 1
Average noise to mask ratio (ANMR) trellis-based solution.
This has a theoretic best quality out of all the coding methods, but at the
cost of the slowest speed.
@item 2
Two loop searching (TLS) method.
This method first sets quantizers depending on band thresholds and then tries
to find an optimal combination by adding or subtracting a specific value from
all quantizers and adjusting some individual quantizer a little.
This method produces similar quality with the FAAC method and is the default.
@item 3
Constant quantizer method.
This method sets a constant quantizer for all bands. This is the fastest of all
the methods, yet produces the worst quality.
@end table
@end table
@subsection Tips and Tricks
According to some reports
(e.g. @url{http://d.hatena.ne.jp/kamedo2/20120729/1343545890}), setting the
@option{cutoff} option to 15000 Hz greatly improves the quality of the output
quality. As a result, we encourage you to do the same.
@section ac3 and ac3_fixed
AC-3 audio encoders.
@@ -412,6 +501,279 @@ Selected by Encoder (default)
@end table
@section libmp3lame
LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper
Requires the presence of the libmp3lame headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libmp3lame}.
@subsection Options
The following options are supported by the libmp3lame wrapper. The
@command{lame}-equivalent of the options are listed in parentheses.
@table @option
@item b (@emph{-b})
Set bitrate expressed in bits/s for CBR. LAME @code{bitrate} is
expressed in kilobits/s.
@item q (@emph{-V})
Set constant quality setting for VBR. This option is valid only
using the @command{ffmpeg} command-line tool. For library interface
users, use @option{global_quality}.
@item compression_level (@emph{-q})
Set algorithm quality. Valid arguments are integers in the 0-9 range,
with 0 meaning highest quality but slowest, and 9 meaning fastest
while producing the worst quality.
@item reservoir
Enable use of bit reservoir when set to 1. Default value is 1. LAME
has this enabled by default, but can be overriden by use
@option{--nores} option.
@end table
@section libopencore-amrnb
OpenCORE Adaptive Multi-Rate Narrowband encoder.
Requires the presence of the libopencore-amrnb headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libopencore-amrnb --enable-version3}.
This is a mono-only encoder. Officially it only supports 8000Hz sample rate,
but you can override it by setting @option{strict} to @samp{unofficial} or
lower.
@subsection Options
@table @option
@item b
Set bitrate in bits per second. Only the following bitrates are supported,
otherwise libavcodec will round to the nearest valid bitrate.
@table @option
@item 4750
@item 5150
@item 5900
@item 6700
@item 7400
@item 7950
@item 10200
@item 12200
@end table
@item dtx
Allow discontinuous transmission (generate comfort noise) when set to 1. The
default value is 0 (disabled).
@end table
@section libtwolame
TwoLAME MP2 encoder wrapper
Requires the presence of the libtwolame headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libtwolame}.
@subsection Options
The following options are supported by the libtwolame wrapper. The
@command{twolame}-equivalent options follow the FFmpeg ones and are in
parentheses.
@table @option
@item b (@emph{-b})
Set bitrate expressed in bits/s for CBR. @command{twolame} @option{b}
option is expressed in kilobits/s. Default value is 128k.
@item q (@emph{-V})
Set quality for experimental VBR support. Maximum value range is
from -50 to 50, useful range is from -10 to 10. The higher the
value, the better the quality. This option is valid only using the
@command{ffmpeg} command-line tool. For library interface users,
use @option{global_quality}.
@item mode (@emph{--mode})
Set the mode of the resulting audio. Possible values:
@table @samp
@item auto
Choose mode automatically based on the input. This is the default.
@item stereo
Stereo
@item joint_stereo
Joint stereo
@item dual_channel
Dual channel
@item mono
Mono
@end table
@item psymodel (@emph{--psyc-mode})
Set psychoacoustic model to use in encoding. The argument must be
an integer between -1 and 4, inclusive. The higher the value, the
better the quality. The default value is 3.
@item energy_levels (@emph{--energy})
Enable energy levels extensions when set to 1. The default value is
0 (disabled).
@item error_protection (@emph{--protect})
Enable CRC error protection when set to 1. The default value is 0
(disabled).
@item copyright (@emph{--copyright})
Set MPEG audio copyright flag when set to 1. The default value is 0
(disabled).
@item original (@emph{--original})
Set MPEG audio original flag when set to 1. The default value is 0
(disabled).
@end table
@anchor{libvo-aacenc}
@section libvo-aacenc
VisualOn AAC encoder
Requires the presence of the libvo-aacenc headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libvo-aacenc --enable-version3}.
This encoder is considered to be worse than the
@ref{aacenc,,native experimental FFmpeg AAC encoder}, according to
multiple sources.
@subsection Options
The VisualOn AAC encoder only support encoding AAC-LC and up to 2
channels. It is also CBR-only.
@table @option
@item b
Set bit rate in bits/s.
@end table
@section libvo-amrwbenc
VisualOn Adaptive Multi-Rate Wideband encoder
Requires the presence of the libvo-amrwbenc headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libvo-amrwbenc --enable-version3}.
This is a mono-only encoder. Officially it only supports 16000Hz sample
rate, but you can override it by setting @option{strict} to
@samp{unofficial} or lower.
@subsection Options
@table @option
@item b
Set bitrate in bits/s. Only the following bitrates are supported, otherwise
libavcodec will round to the nearest valid bitrate.
@table @samp
@item 6600
@item 8850
@item 12650
@item 14250
@item 15850
@item 18250
@item 19850
@item 23050
@item 23850
@end table
@item dtx
Allow discontinuous transmission (generate comfort noise) when set to 1. The
default value is 0 (disabled).
@end table
@section libopus
libopus Opus Interactive Audio Codec encoder wrapper.
Requires the presence of the libopus headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libopus}.
@subsection Option Mapping
Most libopus options are modeled after the @command{opusenc} utility from
opus-tools. The following is an option mapping chart describing options
supported by the libopus wrapper, and their @command{opusenc}-equivalent
in parentheses.
@table @option
@item b (@emph{bitrate})
Set the bit rate in bits/s. FFmpeg's @option{b} option is
expressed in bits/s, while @command{opusenc}'s @option{bitrate} in
kilobits/s.
@item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr})
Set VBR mode. The FFmpeg @option{vbr} option has the following
valid arguments, with the their @command{opusenc} equivalent options
in parentheses:
@table @samp
@item off (@emph{hard-cbr})
Use constant bit rate encoding.
@item on (@emph{vbr})
Use variable bit rate encoding (the default).
@item constrained (@emph{cvbr})
Use constrained variable bit rate encoding.
@end table
@item compression_level (@emph{comp})
Set encoding algorithm complexity. Valid options are integers in
the 0-10 range. 0 gives the fastest encodes but lower quality, while 10
gives the highest quality but slowest encoding. The default is 10.
@item frame_duration (@emph{framesize})
Set maximum frame size, or duration of a frame in milliseconds. The
argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller
frame sizes achieve lower latency but less quality at a given bitrate.
Sizes greater than 20ms are only interesting at fairly low bitrates.
The default is 20ms.
@item packet_loss (@emph{expect-loss})
Set expected packet loss percentage. The default is 0.
@item application (N.A.)
Set intended application type. Valid options are listed below:
@table @samp
@item voip
Favor improved speech intelligibility.
@item audio
Favor faithfulness to the input (the default).
@item lowdelay
Restrict to only the lowest delay modes.
@end table
@item cutoff (N.A.)
Set cutoff bandwidth in Hz. The argument must be exactly one of the
following: 4000, 6000, 8000, 12000, or 20000, corresponding to
narrowband, mediumband, wideband, super wideband, and fullband
respectively. The default is 0 (cutoff disabled).
@end table
@c man end AUDIO ENCODERS
@chapter Video Encoders
@@ -583,178 +945,318 @@ For more information about libvpx see:
x264 H.264/MPEG-4 AVC encoder wrapper
Requires the presence of the libx264 headers and library during
configuration. You need to explicitly configure the build with
This encoder requires the presence of the libx264 headers and library
during configuration. You need to explicitly configure the build with
@code{--enable-libx264}.
x264 supports an impressive number of features, including 8x8 and 4x4 adaptive
spatial transform, adaptive B-frame placement, CAVLC/CABAC entropy coding,
interlacing (MBAFF), lossless mode, psy optimizations for detail retention
(adaptive quantization, psy-RD, psy-trellis).
libx264 supports an impressive number of features, including 8x8 and
4x4 adaptive spatial transform, adaptive B-frame placement, CAVLC/CABAC
entropy coding, interlacing (MBAFF), lossless mode, psy optimizations
for detail retention (adaptive quantization, psy-RD, psy-trellis).
The FFmpeg wrapper provides a mapping for most of them using global options
that match those of the encoders and provides private options for the unique
encoder options. Additionally an expert override is provided to directly pass
a list of key=value tuples as accepted by x264_param_parse.
Many libx264 encoder options are mapped to FFmpeg global codec
options, while unique encoder options are provided through private
options. Additionally the @option{x264opts} and @option{x264-params}
private options allows to pass a list of key=value tuples as accepted
by the libx264 @code{x264_param_parse} function.
@subsection Option Mapping
The x264 project website is at
@url{http://www.videolan.org/developers/x264.html}.
The following options are supported by the x264 wrapper, the x264-equivalent
options follow the FFmpeg ones.
@subsection Options
@multitable @columnfractions .2 .2
@item b @tab bitrate
FFmpeg @code{b} option is expressed in bits/s, x264 @code{bitrate} in kilobits/s.
@item bf @tab bframes
Maximum number of B-frames.
@item g @tab keyint
Maximum GOP size.
@item qmin @tab qpmin
@item qmax @tab qpmax
@item qdiff @tab qpstep
@item qblur @tab qblur
@item qcomp @tab qcomp
@item refs @tab ref
@item sc_threshold @tab scenecut
@item trellis @tab trellis
@item nr @tab nr
Noise reduction.
@item me_range @tab merange
@item me_method @tab me
@item subq @tab subme
@item b_strategy @tab b-adapt
@item keyint_min @tab keyint-min
@item coder @tab cabac
Set coder to @code{ac} to use CABAC.
@item cmp @tab chroma-me
Set to @code{chroma} to use chroma motion estimation.
@item threads @tab threads
@item thread_type @tab sliced_threads
Set to @code{slice} to use sliced threading instead of frame threading.
@item flags -cgop @tab open-gop
Set @code{-cgop} to use recovery points to close GOPs.
@item rc_init_occupancy @tab vbv-init
Initial buffer occupancy.
@end multitable
The following options are supported by the libx264 wrapper. The
@command{x264}-equivalent options or values are listed in parentheses
for easy migration.
To reduce the duplication of documentation, only the private options
and some others requiring special attention are documented here. For
the documentation of the undocumented generic options, see
@ref{codec-options,,the Codec Options chapter}.
To get a more accurate and extensive documentation of the libx264
options, invoke the command @command{x264 --full-help} or consult
the libx264 documentation.
@subsection Private Options
@table @option
@item -preset @var{string}
Set the encoding preset (cf. x264 --fullhelp).
@item -tune @var{string}
Tune the encoding params (cf. x264 --fullhelp).
@item -profile @var{string}
Set profile restrictions (cf. x264 --fullhelp).
@item -fastfirstpass @var{integer}
Use fast settings when encoding first pass.
@item -crf @var{float}
Select the quality for constant quality mode.
@item -crf_max @var{float}
In CRF mode, prevents VBV from lowering quality beyond this point.
@item -qp @var{integer}
Constant quantization parameter rate control method.
@item -aq-mode @var{integer}
AQ method
@item b (@emph{bitrate})
Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
expressed in bits/s, while @command{x264}'s @option{bitrate} is in
kilobits/s.
@item bf (@emph{bframes})
@item g (@emph{keyint})
@item qmax (@emph{qpmax})
@item qmin (@emph{qpmin})
@item qdiff (@emph{qpstep})
@item qblur (@emph{qblur})
@item qcomp (@emph{qcomp})
@item refs (@emph{ref})
@item sc_threshold (@emph{scenecut})
@item trellis (@emph{trellis})
@item nr (@emph{nr})
@item me_range (@emph{merange})
@item me_method (@emph{me})
Set motion estimation method. Possible values in the decreasing order
of speed:
Possible values:
@table @samp
@item none
@item dia (@emph{dia})
@item epzs (@emph{dia})
Diamond search with radius 1 (fastest). @samp{epzs} is an alias for
@samp{dia}.
@item hex (@emph{hex})
Hexagonal search with radius 2.
@item umh (@emph{umh})
Uneven multi-hexagon search.
@item esa (@emph{esa})
Exhaustive search.
@item tesa (@emph{tesa})
Hadamard exhaustive search (slowest).
@end table
@item variance
@item subq (@emph{subme})
@item b_strategy (@emph{b-adapt})
@item keyint_min (@emph{min-keyint})
@item coder
Set entropy encoder. Possible values:
@table @samp
@item ac
Enable CABAC.
@item vlc
Enable CAVLC and disable CABAC. It generates the same effect as
@command{x264}'s @option{--no-cabac} option.
@end table
@item cmp
Set full pixel motion estimation comparation algorithm. Possible values:
@table @samp
@item chroma
Enable chroma in motion estimation.
@item sad
Ignore chroma in motion estimation. It generates the same effect as
@command{x264}'s @option{--no-chroma-me} option.
@end table
@item threads (@emph{threads})
@item thread_type
Set multithreading technique. Possible values:
@table @samp
@item slice
Slice-based multithreading. It generates the same effect as
@command{x264}'s @option{--sliced-threads} option.
@item frame
Frame-based multithreading.
@end table
@item flags
Set encoding flags. It can be used to disable closed GOP and enable
open GOP by setting it to @code{-cgop}. The result is similar to
the behavior of @command{x264}'s @option{--open-gop} option.
@item rc_init_occupancy (@emph{vbv-init})
@item preset (@emph{preset})
Set the encoding preset.
@item tune (@emph{tune})
Set tuning of the encoding params.
@item profile (@emph{profile})
Set profile restrictions.
@item fastfirstpass
Enable fast settings when encoding first pass, when set to 1. When set
to 0, it has the same effect of @command{x264}'s
@option{--slow-firstpass} option.
@item crf (@emph{crf})
Set the quality for constant quality mode.
@item crf_max (@emph{crf-max})
In CRF mode, prevents VBV from lowering quality beyond this point.
@item qp (@emph{qp})
Set constant quantization rate control method parameter.
@item aq-mode (@emph{aq-mode})
Set AQ method. Possible values:
@table @samp
@item none (@emph{0})
Disabled.
@item variance (@emph{1})
Variance AQ (complexity mask).
@item autovariance
@item autovariance (@emph{2})
Auto-variance AQ (experimental).
@end table
@item -aq-strength @var{float}
AQ strength, reduces blocking and blurring in flat and textured areas.
@item -psy @var{integer}
Use psychovisual optimizations.
@item -psy-rd @var{string}
Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.
@item -rc-lookahead @var{integer}
Number of frames to look ahead for frametype and ratecontrol.
@item -weightb @var{integer}
Weighted prediction for B-frames.
@item -weightp @var{integer}
Weighted prediction analysis method.
Possible values:
@item aq-strength (@emph{aq-strength})
Set AQ strength, reduce blocking and blurring in flat and textured areas.
@item psy
Use psychovisual optimizations when set to 1. When set to 0, it has the
same effect as @command{x264}'s @option{--no-psy} option.
@item psy-rd (@emph{psy-rd})
Set strength of psychovisual optimization, in
@var{psy-rd}:@var{psy-trellis} format.
@item rc-lookahead (@emph{rc-lookahead})
Set number of frames to look ahead for frametype and ratecontrol.
@item weightb
Enable weighted prediction for B-frames when set to 1. When set to 0,
it has the same effect as @command{x264}'s @option{--no-weightb} option.
@item weightp (@emph{weightp})
Set weighted prediction method for P-frames. Possible values:
@table @samp
@item none
@item simple
@item smart
@item none (@emph{0})
Disabled
@item simple (@emph{1})
Enable only weighted refs
@item smart (@emph{2})
Enable both weighted refs and duplicates
@end table
@item -ssim @var{integer}
Calculate and print SSIM stats.
@item -intra-refresh @var{integer}
Use Periodic Intra Refresh instead of IDR frames.
@item -b-bias @var{integer}
Influences how often B-frames are used.
@item -b-pyramid @var{integer}
Keep some B-frames as references.
Possible values:
@item ssim (@emph{ssim})
Enable calculation and printing SSIM stats after the encoding.
@item intra-refresh (@emph{intra-refresh})
Enable the use of Periodic Intra Refresh instead of IDR frames when set
to 1.
@item b-bias (@emph{b-bias})
Set the influence on how often B-frames are used.
@item b-pyramid (@emph{b-pyramid})
Set method for keeping of some B-frames as references. Possible values:
@table @samp
@item none
@item strict
@item none (@emph{none})
Disabled.
@item strict (@emph{strict})
Strictly hierarchical pyramid.
@item normal
@item normal (@emph{normal})
Non-strict (not Blu-ray compatible).
@end table
@item -mixed-refs @var{integer}
One reference per partition, as opposed to one reference per macroblock.
@item -8x8dct @var{integer}
High profile 8x8 transform.
@item -fast-pskip @var{integer}
@item -aud @var{integer}
Use access unit delimiters.
@item -mbtree @var{integer}
Use macroblock tree ratecontrol.
@item -deblock @var{string}
Loop filter parameters, in <alpha:beta> form.
@item -cplxblur @var{float}
Reduce fluctuations in QP (before curve compression).
@item -partitions @var{string}
A comma-separated list of partitions to consider, possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all.
@item -direct-pred @var{integer}
Direct MV prediction mode
Possible values:
@item mixed-refs
Enable the use of one reference per partition, as opposed to one
reference per macroblock when set to 1. When set to 0, it has the
same effect as @command{x264}'s @option{--no-mixed-refs} option.
@item 8x8dct
Enable adaptive spatial transform (high profile 8x8 transform)
when set to 1. When set to 0, it has the same effect as
@command{x264}'s @option{--no-8x8dct} option.
@item fast-pskip
Enable early SKIP detection on P-frames when set to 1. When set
to 0, it has the same effect as @command{x264}'s
@option{--no-fast-pskip} option.
@item aud (@emph{aud})
Enable use of access unit delimiters when set to 1.
@item mbtree
Enable use macroblock tree ratecontrol when set to 1. When set
to 0, it has the same effect as @command{x264}'s
@option{--no-mbtree} option.
@item deblock (@emph{deblock})
Set loop filter parameters, in @var{alpha}:@var{beta} form.
@item cplxblur (@emph{cplxblur})
Set fluctuations reduction in QP (before curve compression).
@item partitions (@emph{partitions})
Set partitions to consider as a comma-separated list of. Possible
values in the list:
@table @samp
@item none
@item spatial
@item temporal
@item auto
@end table
@item -slice-max-size @var{integer}
Limit the size of each slice in bytes.
@item -stats @var{string}
Filename for 2 pass stats.
@item -nal-hrd @var{integer}
Signal HRD information (requires vbv-bufsize; cbr not allowed in .mp4).
Possible values:
@table @samp
@item none
@item vbr
@item cbr
@item p8x8
8x8 P-frame partition.
@item p4x4
4x4 P-frame partition.
@item b8x8
4x4 B-frame partition.
@item i8x8
8x8 I-frame partition.
@item i4x4
4x4 I-frame partition.
(Enabling @samp{p4x4} requires @samp{p8x8} to be enabled. Enabling
@samp{i8x8} requires adaptive spatial transform (@option{8x8dct}
option) to be enabled.)
@item none (@emph{none})
Do not consider any partitions.
@item all (@emph{all})
Consider every partition.
@end table
@item x264opts @var{options}
Allow to set any x264 option, see @code{x264 --fullhelp} for a list.
@item direct-pred (@emph{direct})
Set direct MV prediction mode. Possible values:
@var{options} is a list of @var{key}=@var{value} couples separated by
@table @samp
@item none (@emph{none})
Disable MV prediction.
@item spatial (@emph{spatial})
Enable spatial predicting.
@item temporal (@emph{temporal})
Enable temporal predicting.
@item auto (@emph{auto})
Automatically decided.
@end table
@item slice-max-size (@emph{slice-max-size})
Set the limit of the size of each slice in bytes. If not specified
but RTP payload size (@option{ps}) is specified, that is used.
@item stats (@emph{stats})
Set the file name for multi-pass stats.
@item nal-hrd (@emph{nal-hrd})
Set signal HRD information (requires @option{vbv-bufsize} to be set).
Possible values:
@table @samp
@item none (@emph{none})
Disable HRD information signaling.
@item vbr (@emph{vbr})
Variable bit rate.
@item cbr (@emph{cbr})
Constant bit rate (not allowed in MP4 container).
@end table
@item x264opts (N.A.)
Set any x264 option, see @command{x264 --fullhelp} for a list.
Argument is a list of @var{key}=@var{value} couples separated by
":". In @var{filter} and @var{psy-rd} options that use ":" as a separator
themselves, use "," instead. They accept it as well since long ago but this
is kept undocumented for some reason.
@@ -764,17 +1266,135 @@ For example to specify libx264 encoding options with @command{ffmpeg}:
ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
@end example
For more information about libx264 and the supported options see:
@url{http://www.videolan.org/developers/x264.html}
@item x264-params (N.A.)
Override the x264 configuration using a :-separated list of key=value
parameters.
@item -x264-params @var{string}
Override the x264 configuration using a :-separated list of key=value parameters.
This option is functionally the same as the @option{x264opts}, but is
duplicated for compability with the Libav fork.
For example to specify libx264 encoding options with @command{ffmpeg}:
@example
-x264-params level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subq=6:8x8dct=0:trellis=0
ffmpeg -i INPUT -c:v libx264 -x264-params level=30:bframes=0:weightp=0:\
cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:\
no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 OUTPUT
@end example
@end table
Encoding avpresets for common usages are provided so they can be used with the
general presets system (e.g. passing the @code{-pre} option).
Encoding ffpresets for common usages are provided so they can be used with the
general presets system (e.g. passing the @option{pre} option).
@section libxvid
Xvid MPEG-4 Part 2 encoder wrapper.
This encoder requires the presence of the libxvidcore headers and library
during configuration. You need to explicitly configure the build with
@code{--enable-libxvid --enable-gpl}.
The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
users can encode to this format without this library.
@subsection Options
The following options are supported by the libxvid wrapper. Some of
the following options are listed but are not documented, and
correspond to shared codec options. See @ref{codec-options,,the Codec
Options chapter} for their documentation. The other shared options
which are not listed have no effect for the libxvid encoder.
@table @option
@item b
@item g
@item qmin
@item qmax
@item mpeg_quant
@item threads
@item bf
@item b_qfactor
@item b_qoffset
@item flags
Set specific encoding flags. Possible values:
@table @samp
@item mv4
Use four motion vector by macroblock.
@item aic
Enable high quality AC prediction.
@item gray
Only encode grayscale.
@item gmc
Enable the use of global motion compensation (GMC).
@item qpel
Enable quarter-pixel motion compensation.
@item cgop
Enable closed GOP.
@item global_header
Place global headers in extradata instead of every keyframe.
@end table
@item trellis
@item me_method
Set motion estimation method. Possible values in decreasing order of
speed and increasing order of quality:
@table @samp
@item zero
Use no motion estimation (default).
@item phods
@item x1
@item log
Enable advanced diamond zonal search for 16x16 blocks and half-pixel
refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
@samp{phods}.
@item epzs
Enable all of the things described above, plus advanced diamond zonal
search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
estimation on chroma planes.
@item full
Enable all of the things described above, plus extended 16x16 and 8x8
blocks search.
@end table
@item mbd
Set macroblock decision algorithm. Possible values in the increasing
order of quality:
@table @samp
@item simple
Use macroblock comparing function algorithm (default).
@item bits
Enable rate distortion-based half pixel and quarter pixel refinement for
16x16 blocks.
@item rd
Enable all of the things described above, plus rate distortion-based
half pixel and quarter pixel refinement for 8x8 blocks, and rate
distortion-based search using square pattern.
@end table
@end table
@c man end VIDEO ENCODERS

View File

@@ -17,6 +17,7 @@ the libavcodec library.
@c man end DESCRIPTION
@anchor{codec-options}
@chapter Codec Options
@c man begin CODEC OPTIONS

View File

@@ -76,6 +76,9 @@ Enable RTP MP4A-LATM payload.
Reduce the latency introduced by optional buffering
@end table
@item seek2any @var{integer} (@emph{input})
Forces seeking to enable seek to any mode if set to 1. Default is 0.
@item analyzeduration @var{integer} (@emph{input})
Specify how many microseconds are analyzed to probe the input. A
higher value will allow to detect more accurate information, but will
@@ -142,6 +145,12 @@ Use wallclock as timestamps.
@item avoid_negative_ts @var{integer} (@emph{output})
Shift timestamps to make them positive. 1 enables, 0 disables, default
of -1 enables when required by target format.
@item skip_initial_bytes @var{integer} (@emph{input})
Set number initial bytes to skip. Default is 0.
@item correct_ts_overflow @var{integer} (@emph{input})
Correct single timestamp overflows if set to 1. Default is 1.
@end table
@c man end FORMAT OPTIONS

View File

@@ -3,10 +3,10 @@
Filtering in FFmpeg is enabled through the libavfilter library.
In libavfilter, it is possible for filters to have multiple inputs and
multiple outputs.
To illustrate the sorts of things that are possible, we can
use a complex filter graph. For example, the following one:
In libavfilter, a filter can have multiple inputs and multiple
outputs.
To illustrate the sorts of things that are possible, we consider the
following filtergraph.
@example
input --> split ---------------------> overlay --> output
@@ -15,25 +15,32 @@ input --> split ---------------------> overlay --> output
+-----> crop --> vflip -------+
@end example
splits the stream in two streams, sends one stream through the crop filter
and the vflip filter before merging it back with the other stream by
overlaying it on top. You can use the following command to achieve this:
This filtergraph splits the input stream in two streams, sends one
stream through the crop filter and the vflip filter before merging it
back with the other stream by overlaying it on top. You can use the
following command to achieve this:
@example
ffmpeg -i input -vf "[in] split [T1], [T2] overlay=0:H/2 [out]; [T1] crop=iw:ih/2:0:ih/2, vflip [T2]" output
ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
@end example
The result will be that in output the top half of the video is mirrored
onto the bottom half.
Filters are loaded using the @var{-vf} or @var{-af} option passed to
@command{ffmpeg} or to @command{ffplay}. Filters in the same linear
chain are separated by commas. In our example, @var{split,
overlay} are in one linear chain, and @var{crop, vflip} are in
another. The points where the linear chains join are labeled by names
enclosed in square brackets. In our example, that is @var{[T1]} and
@var{[T2]}. The special labels @var{[in]} and @var{[out]} are the points
where video is input and output.
Filters in the same linear chain are separated by commas, and distinct
linear chains of filters are separated by semicolons. In our example,
@var{crop,vflip} are in one linear chain, @var{split} and
@var{overlay} are separately in another. The points where the linear
chains join are labelled by names enclosed in square brackets. In the
example, the split filter generates two outputs that are associated to
the labels @var{[main]} and @var{[tmp]}.
The stream sent to the second output of @var{split}, labelled as
@var{[tmp]}, is processed through the @var{crop} filter, which crops
away the lower half part of the video, and then vertically flipped. The
@var{overlay} filter takes in input the first unchanged output of the
split filter (which was labelled as @var{[main]}), and overlay on its
lower half the output generated by the @var{crop,vflip} filterchain.
Some filters take in input a list of parameters: they are specified
after the filter name and an equal sign, and are separated from each other
@@ -2030,7 +2037,7 @@ This expression is evaluated only once during the filter
configuration.
@item h, out_h
Set the crop area width. It defaults to @code{ih}.
Set the crop area height. It defaults to @code{ih}.
This expression is evaluated only once during the filter
configuration.

View File

@@ -24,7 +24,7 @@ instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjp
@file{./configure}.
@section OpenCORE and VisualOn libraries
@section OpenCORE, VisualOn, and Fraunhofer libraries
Spun off Google Android sources, OpenCore, VisualOn and Fraunhofer
libraries provide encoders for a number of audio codecs.
@@ -32,9 +32,14 @@ libraries provide encoders for a number of audio codecs.
@float NOTE
OpenCORE and VisualOn libraries are under the Apache License 2.0
(see @url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is
incompatible with the LGPL version 2.1 and GPL version 2. You have to
incompatible to the LGPL version 2.1 and GPL version 2. You have to
upgrade FFmpeg's license to LGPL version 3 (or if you have enabled
GPL components, GPL version 3) to use it.
GPL components, GPL version 3) by passing @code{--enable-version3} to configure in
order to use it.
The Fraunhofer AAC library is licensed under a license incompatible to the GPL
and is not known to be compatible to the LGPL. Therefore, you have to pass
@code{--enable-nonfree} to configure to use it.
@end float
@subsection OpenCORE AMR

View File

@@ -24,7 +24,7 @@ a mail for every change to every issue.
The subscription URL for the ffmpeg-trac list is:
http(s)://ffmpeg.org/mailman/listinfo/ffmpeg-trac
The URL of the webinterface of the tracker is:
http(s)://ffmpeg.org/trac/ffmpeg
http(s)://trac.ffmpeg.org
Type:
-----

View File

@@ -18,6 +18,23 @@ enabled muxers.
A description of some of the currently available muxers follows.
@anchor{aiff}
@section aiff
Audio Interchange File Format muxer.
It accepts the following options:
@table @option
@item write_id3v2
Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
@item id3v2_version
Select ID3v2 version to write. Currently only version 3 and 4 (aka.
ID3v2.3 and ID3v2.4) are supported. The default is version 4.
@end table
@anchor{crc}
@section crc

View File

@@ -162,6 +162,8 @@ static struct termios oldtty;
static int restore_tty;
#endif
static void free_input_threads(void);
/* sub2video hack:
Convert subtitles to video with alpha to insert them in filter graphs.
@@ -457,6 +459,9 @@ static void exit_program(void)
av_freep(&output_streams[i]->logfile_prefix);
av_freep(&output_streams[i]);
}
#if HAVE_PTHREADS
free_input_threads();
#endif
for (i = 0; i < nb_input_files; i++) {
avformat_close_input(&input_files[i]->ctx);
av_freep(&input_files[i]);
@@ -1905,7 +1910,10 @@ static int output_packet(InputStream *ist, const AVPacket *pkt)
ist->st->codec->sample_rate;
break;
case AVMEDIA_TYPE_VIDEO:
if (pkt->duration) {
if (ist->framerate.num) {
int64_t next_dts = av_rescale_q(ist->next_dts, AV_TIME_BASE_Q, av_inv_q(ist->framerate));
ist->next_dts = av_rescale_q(next_dts + 1, av_inv_q(ist->framerate), AV_TIME_BASE_Q);
} else if (pkt->duration) {
ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
} else if(ist->st->codec->time_base.num != 0) {
int ticks= ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame;
@@ -2084,7 +2092,7 @@ static int transcode_init(void)
AVCodecContext *codec;
OutputStream *ost;
InputStream *ist;
char error[1024];
char error[1024] = {0};
int want_sdp = 1;
/* init framerate emulation */
@@ -2208,6 +2216,8 @@ static int transcode_init(void)
codec->time_base = icodec->time_base;
}
if (ist && !ost->frame_rate.num)
ost->frame_rate = ist->framerate;
if(ost->frame_rate.num)
codec->time_base = av_inv_q(ost->frame_rate);

View File

@@ -43,12 +43,15 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFo
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target);
int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE;
const enum AVPixelFormat mjpeg_formats[] = { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE };
const enum AVPixelFormat ljpeg_formats[] = { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE };
if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
if (st->codec->codec_id == AV_CODEC_ID_MJPEG) {
p = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE };
p = mjpeg_formats;
} else if (st->codec->codec_id == AV_CODEC_ID_LJPEG) {
p = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE };
p =ljpeg_formats;
}
}
for (; *p != AV_PIX_FMT_NONE; p++) {

View File

@@ -203,6 +203,7 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
vald /= pow(10, index * 3);
prefix_string = decimal_unit_prefixes[index];
}
vali = vald;
}
if (show_float || (use_value_prefix && vald != (long long int)vald))

View File

@@ -328,6 +328,14 @@ static AVLFG random_state;
static FILE *logfile = NULL;
static void htmlstrip(char *s) {
while (s && *s) {
s += strspn(s, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. ");
if (*s)
*s++ = '?';
}
}
static int64_t ffm_read_write_index(int fd)
{
uint8_t buf[8];
@@ -1887,6 +1895,7 @@ static int http_parse_request(HTTPContext *c)
send_error:
c->http_error = 404;
q = c->buffer;
htmlstrip(msg);
snprintf(q, c->buffer_size,
"HTTP/1.0 404 Not Found\r\n"
"Content-type: text/html\r\n"

View File

@@ -81,7 +81,7 @@ enum BandType {
INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions.
};
#define IS_CODEBOOK_UNSIGNED(x) ((x - 1) & 10)
#define IS_CODEBOOK_UNSIGNED(x) (((x) - 1) & 10)
enum ChannelPosition {
AAC_CHANNEL_OFF = 0,

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

@@ -710,7 +710,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
const float lambda)
{
int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
float dists[128] = { 0 }, uplims[128];
float maxvals[128];
int fflag, minscaler;

View File

@@ -189,6 +189,9 @@ static int frame_configure_elements(AVCodecContext *avctx)
}
}
if (!avctx->channels)
return 1;
/* get output buffer */
ac->frame->nb_samples = 2048;
if ((ret = ff_get_buffer(avctx, ac->frame)) < 0) {

View File

@@ -429,6 +429,7 @@ static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64],
#define DECAY_SLOPE 0.05f
/// Number of frequency bands that can be addressed by the parameter index, b(k)
static const int NR_PAR_BANDS[] = { 20, 34 };
static const int NR_IPDOPD_BANDS[] = { 11, 17 };
/// Number of frequency bands that can be addressed by the sub subband index, k
static const int NR_BANDS[] = { 71, 91 };
/// Start frequency band for the all-pass filter decay slope
@@ -823,7 +824,8 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2
h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];
h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];
h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];
if (!PS_BASELINE && ps->enable_ipdopd && b < ps->nr_ipdopd_par) {
if (!PS_BASELINE && ps->enable_ipdopd && b < NR_IPDOPD_BANDS[is34]) {
//The spec say says to only run this smoother when enable_ipdopd
//is set but the reference decoder appears to run it constantly
float h11i, h12i, h21i, h22i;

View File

@@ -147,7 +147,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;
GetBitContext gbc;

View File

@@ -260,7 +260,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];

View File

@@ -449,9 +449,11 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_
* @param[out] coded_samples set to the number of samples as coded in the
* packet, or 0 if the codec does not encode the
* number of samples in each frame.
* @param[out] approx_nb_samples set to non-zero if the number of samples
* returned is an approximation.
*/
static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
int buf_size, int *coded_samples)
int buf_size, int *coded_samples, int *approx_nb_samples)
{
ADPCMDecodeContext *s = avctx->priv_data;
int nb_samples = 0;
@@ -460,6 +462,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
int header_size;
*coded_samples = 0;
*approx_nb_samples = 0;
if(ch <= 0)
return 0;
@@ -530,10 +533,12 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
case AV_CODEC_ID_ADPCM_EA_R2:
header_size = 4 + 5 * ch;
*coded_samples = bytestream2_get_le32(gb);
*approx_nb_samples = 1;
break;
case AV_CODEC_ID_ADPCM_EA_R3:
header_size = 4 + 5 * ch;
*coded_samples = bytestream2_get_be32(gb);
*approx_nb_samples = 1;
break;
}
*coded_samples -= *coded_samples % 28;
@@ -625,11 +630,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
int16_t **samples_p;
int st; /* stereo */
int count1, count2;
int nb_samples, coded_samples, ret;
int nb_samples, coded_samples, approx_nb_samples, ret;
GetByteContext gb;
bytestream2_init(&gb, buf, buf_size);
nb_samples = get_nb_samples(avctx, &gb, buf_size, &coded_samples);
nb_samples = get_nb_samples(avctx, &gb, buf_size, &coded_samples, &approx_nb_samples);
if (nb_samples <= 0) {
av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n");
return AVERROR_INVALIDDATA;
@@ -647,7 +652,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
/* use coded_samples when applicable */
/* it is always <= nb_samples, so the output buffer will be large enough */
if (coded_samples) {
if (coded_samples != nb_samples)
if (!approx_nb_samples && coded_samples != nb_samples)
av_log(avctx, AV_LOG_WARNING, "mismatch in coded sample count\n");
frame->nb_samples = nb_samples = coded_samples;
}
@@ -863,6 +868,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
*samples++ = c->status[0].predictor + c->status[1].predictor;
*samples++ = c->status[0].predictor - c->status[1].predictor;
}
if ((bytestream2_tell(&gb) & 1))
bytestream2_skip(&gb, 1);
break;
}
case AV_CODEC_ID_ADPCM_IMA_ISS:

View File

@@ -557,10 +557,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
put_bits(&pb, 7, status->step_index);
if (avctx->trellis > 0) {
uint8_t buf[64];
adpcm_compress_trellis(avctx, &samples_p[ch][1], buf, status,
adpcm_compress_trellis(avctx, &samples_p[ch][0], buf, status,
64, 1);
for (i = 0; i < 64; i++)
put_bits(&pb, 4, buf[i ^ 1]);
status->prev_sample = status->predictor;
} else {
for (i = 0; i < 64; i += 2) {
int t1, t2;

View File

@@ -274,7 +274,7 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch)
// generate warm-up samples
residual[0] = samples[0];
for (i = 1; i <= lpc.lpc_order; i++)
residual[i] = samples[i] - samples[i-1];
residual[i] = sign_extend(samples[i] - samples[i-1], s->write_sample_size);
// perform lpc on remaining samples
for (i = lpc.lpc_order + 1; i < s->frame_size; i++) {

View File

@@ -284,7 +284,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
GetBitContext gb;
uint64_t ht_size;
int i, config_offset;
MPEG4AudioConfig m4ac;
MPEG4AudioConfig m4ac = {0};
ALSSpecificConfig *sconf = &ctx->sconf;
AVCodecContext *avctx = ctx->avctx;
uint32_t als_id, header_size, trailer_size;

View File

@@ -112,7 +112,7 @@ static void hscroll(AVCodecContext *avctx)
AnsiContext *s = avctx->priv_data;
int i;
if (s->y < avctx->height - s->font_height) {
if (s->y <= avctx->height - 2*s->font_height) {
s->y += s->font_height;
return;
}
@@ -165,7 +165,7 @@ static void draw_char(AVCodecContext *avctx, int c)
ff_draw_pc_font(s->frame.data[0] + s->y * s->frame.linesize[0] + s->x,
s->frame.linesize[0], s->font, s->font_height, c, fg, bg);
s->x += FONT_WIDTH;
if (s->x >= avctx->width) {
if (s->x > avctx->width - FONT_WIDTH) {
s->x = 0;
hscroll(avctx);
}
@@ -239,6 +239,8 @@ static int execute_code(AVCodecContext * avctx, int c)
default:
av_log_ask_for_sample(avctx, "unsupported screen mode\n");
}
s->x = av_clip(s->x, 0, width - FONT_WIDTH);
s->y = av_clip(s->y, 0, height - s->font_height);
if (width != avctx->width || height != avctx->height) {
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
@@ -335,6 +337,8 @@ static int execute_code(AVCodecContext * avctx, int c)
av_log_ask_for_sample(avctx, "unsupported escape code\n");
break;
}
s->x = av_clip(s->x, 0, avctx->width - FONT_WIDTH);
s->y = av_clip(s->y, 0, avctx->height - s->font_height);
return 0;
}
@@ -415,7 +419,7 @@ static int decode_frame(AVCodecContext *avctx,
switch(buf[0]) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (s->nb_args < MAX_NB_ARGS)
if (s->nb_args < MAX_NB_ARGS && s->args[s->nb_args] < 6553)
s->args[s->nb_args] = FFMAX(s->args[s->nb_args], 0) * 10 + buf[0] - '0';
break;
case ';':

View File

@@ -34,46 +34,44 @@ static inline int decode_blockcodes(int code1, int code2, int levels,
{
int v0, v1, v2, v3, v4, v5;
__asm__ ("smmul %8, %14, %18 \n"
"smmul %11, %15, %18 \n"
"smlabb %14, %8, %17, %14 \n"
"smlabb %15, %11, %17, %15 \n"
"smmul %9, %8, %18 \n"
"smmul %12, %11, %18 \n"
"sub %14, %14, %16, lsr #1 \n"
"sub %15, %15, %16, lsr #1 \n"
"smlabb %8, %9, %17, %8 \n"
"smlabb %11, %12, %17, %11 \n"
"smmul %10, %9, %18 \n"
"smmul %13, %12, %18 \n"
"str %14, %0 \n"
"str %15, %4 \n"
"sub %8, %8, %16, lsr #1 \n"
"sub %11, %11, %16, lsr #1 \n"
"smlabb %9, %10, %17, %9 \n"
"smlabb %12, %13, %17, %12 \n"
"smmul %14, %10, %18 \n"
"smmul %15, %13, %18 \n"
"str %8, %1 \n"
"str %11, %5 \n"
"sub %9, %9, %16, lsr #1 \n"
"sub %12, %12, %16, lsr #1 \n"
"smlabb %10, %14, %17, %10 \n"
"smlabb %13, %15, %17, %13 \n"
"str %9, %2 \n"
"str %12, %6 \n"
"sub %10, %10, %16, lsr #1 \n"
"sub %13, %13, %16, lsr #1 \n"
"str %10, %3 \n"
"str %13, %7 \n"
: "=m"(values[0]), "=m"(values[1]),
"=m"(values[2]), "=m"(values[3]),
"=m"(values[4]), "=m"(values[5]),
"=m"(values[6]), "=m"(values[7]),
"=&r"(v0), "=&r"(v1), "=&r"(v2),
__asm__ ("smmul %0, %6, %10 \n"
"smmul %3, %7, %10 \n"
"smlabb %6, %0, %9, %6 \n"
"smlabb %7, %3, %9, %7 \n"
"smmul %1, %0, %10 \n"
"smmul %4, %3, %10 \n"
"sub %6, %6, %8, lsr #1 \n"
"sub %7, %7, %8, lsr #1 \n"
"smlabb %0, %1, %9, %0 \n"
"smlabb %3, %4, %9, %3 \n"
"smmul %2, %1, %10 \n"
"smmul %5, %4, %10 \n"
"str %6, [%11, #0] \n"
"str %7, [%11, #16] \n"
"sub %0, %0, %8, lsr #1 \n"
"sub %3, %3, %8, lsr #1 \n"
"smlabb %1, %2, %9, %1 \n"
"smlabb %4, %5, %9, %4 \n"
"smmul %6, %2, %10 \n"
"smmul %7, %5, %10 \n"
"str %0, [%11, #4] \n"
"str %3, [%11, #20] \n"
"sub %1, %1, %8, lsr #1 \n"
"sub %4, %4, %8, lsr #1 \n"
"smlabb %2, %6, %9, %2 \n"
"smlabb %5, %7, %9, %5 \n"
"str %1, [%11, #8] \n"
"str %4, [%11, #24] \n"
"sub %2, %2, %8, lsr #1 \n"
"sub %5, %5, %8, lsr #1 \n"
"str %2, [%11, #12] \n"
"str %5, [%11, #28] \n"
: "=&r"(v0), "=&r"(v1), "=&r"(v2),
"=&r"(v3), "=&r"(v4), "=&r"(v5),
"+&r"(code1), "+&r"(code2)
: "r"(levels - 1), "r"(-levels), "r"(ff_inverse[levels]));
: "r"(levels - 1), "r"(-levels),
"r"(ff_inverse[levels]), "r"(values)
: "memory");
return code1 | code2;
}

View File

@@ -41,10 +41,10 @@ function ff_scalarproduct_int16_neon, export=1
vpadd.s32 d16, d0, d1
vpadd.s32 d17, d2, d3
vpadd.s32 d10, d4, d5
vpadd.s32 d11, d6, d7
vpadd.s32 d18, d4, d5
vpadd.s32 d19, d6, d7
vpadd.s32 d0, d16, d17
vpadd.s32 d1, d10, d11
vpadd.s32 d1, d18, d19
vpadd.s32 d2, d0, d1
vpaddl.s32 d3, d2
vmov.32 r0, d3[0]
@@ -81,10 +81,10 @@ function ff_scalarproduct_and_madd_int16_neon, export=1
vpadd.s32 d16, d0, d1
vpadd.s32 d17, d2, d3
vpadd.s32 d10, d4, d5
vpadd.s32 d11, d6, d7
vpadd.s32 d18, d4, d5
vpadd.s32 d19, d6, d7
vpadd.s32 d0, d16, d17
vpadd.s32 d1, d10, d11
vpadd.s32 d1, d18, d19
vpadd.s32 d2, d0, d1
vpaddl.s32 d3, d2
vmov.32 r0, d3[0]

View File

@@ -661,8 +661,8 @@ static int decode_channel_sound_unit(ATRAC3Context *q, GetBitContext *gb,
snd->num_components = decode_tonal_components(gb, snd->components,
snd->bands_coded);
if (snd->num_components == -1)
return -1;
if (snd->num_components < 0)
return snd->num_components;
num_subbands = decode_spectrum(gb, snd->spectrum);

View File

@@ -286,7 +286,7 @@ int av_packet_split_side_data(AVPacket *pkt){
for (i=0; ; i++){
size= AV_RB32(p);
av_assert0(size<=INT_MAX && p - pkt->data >= size);
pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
pkt->side_data[i].size = size;
pkt->side_data[i].type = p[4]&127;
if (!pkt->side_data[i].data)

View File

@@ -117,6 +117,7 @@ typedef struct BinkContext {
int version; ///< internal Bink file version
int has_alpha;
int swap_planes;
unsigned frame_num;
Bundle bundle[BINKB_NB_SRC]; ///< bundles for decoding all data types
Tree col_high[16]; ///< trees for decoding high nibble in "colours" data type
@@ -1207,6 +1208,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if (c->version >= 'i')
skip_bits_long(&gb, 32);
c->frame_num++;
for (plane = 0; plane < 3; plane++) {
plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3);
@@ -1215,7 +1218,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
return ret;
} else {
if ((ret = binkb_decode_plane(c, &gb, plane_idx,
!avctx->frame_number, !!plane)) < 0)
c->frame_num == 1, !!plane)) < 0)
return ret;
}
if (get_bits_count(&gb) >= bits_count)
@@ -1339,6 +1342,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
return 0;
}
static void flush(AVCodecContext *avctx)
{
BinkContext * const c = avctx->priv_data;
c->frame_num = 0;
}
AVCodec ff_bink_decoder = {
.name = "binkvideo",
.type = AVMEDIA_TYPE_VIDEO,
@@ -1348,5 +1358,6 @@ AVCodec ff_bink_decoder = {
.close = decode_end,
.decode = decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Bink video"),
.flush = flush,
.capabilities = CODEC_CAP_DR1,
};

View File

@@ -305,7 +305,15 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size);\
if (!(condition))\
continue;\
if (buf[j].bits > 3*nb_bits || buf[j].bits>32) {\
av_log(NULL, AV_LOG_ERROR, "Too long VLC in init_vlc\n");\
return -1;\
}\
GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\
if (buf[j].code >= (1LL<<buf[j].bits)) {\
av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\
return -1;\
}\
if (flags & INIT_VLC_LE)\
buf[j].code = bitswap_32(buf[j].code);\
else\

View File

@@ -175,7 +175,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
case C93_4X4_FROM_PREV:
for (j = 0; j < 8; j += 4) {
for (i = 0; i < 8; i += 4) {
offset = bytestream2_get_le16(&gb);
int offset = bytestream2_get_le16(&gb);
int from_x = offset % WIDTH;
int from_y = offset / WIDTH;
if (block_type == C93_4X4_FROM_CURR && from_y == y+j &&
(FFABS(from_x - x-i) < 4 || FFABS(from_x - x-i) > WIDTH-4)) {
return AVERROR_INVALIDDATA;
}
if ((ret = copy_block(avctx, &out[j*stride+i],
copy_from, offset, 4, stride)) < 0)
return ret;

View File

@@ -305,7 +305,7 @@ STOP_TIMER("get_cabac_bypass")
for(i=0; i<SIZE; i++){
START_TIMER
if( (r[i]&1) != get_cabac(&c, state) )
if( (r[i]&1) != get_cabac_noinline(&c, state) )
av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
STOP_TIMER("get_cabac")
}

View File

@@ -300,7 +300,9 @@ static int cdg_decode_frame(AVCodecContext *avctx,
inst = bytestream_get_byte(&buf);
inst &= CDG_MASK;
buf += 2; /// skipping 2 unneeded bytes
bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
if (buf_size > CDG_HEADER_SIZE)
bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
if ((command & CDG_MASK) == CDG_COMMAND) {
switch (inst) {
@@ -359,11 +361,10 @@ static int cdg_decode_frame(AVCodecContext *avctx,
*got_frame = 1;
} else {
*got_frame = 0;
buf_size = 0;
}
*(AVFrame *) data = cc->frame;
return buf_size;
return avpkt->size;
}
static av_cold int cdg_decode_end(AVCodecContext *avctx)

View File

@@ -134,7 +134,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

@@ -28,6 +28,7 @@
#ifndef AVCODEC_DIRAC_ARITH_H
#define AVCODEC_DIRAC_ARITH_H
#include "libavutil/x86/asm.h"
#include "bytestream.h"
#include "get_bits.h"
@@ -134,7 +135,7 @@ static inline int dirac_get_arith_bit(DiracArith *c, int ctx)
range_times_prob = (c->range * prob_zero) >> 16;
#if HAVE_FAST_CMOV && HAVE_INLINE_ASM
#if HAVE_FAST_CMOV && HAVE_INLINE_ASM && HAVE_6REGS
low -= range_times_prob << 16;
range -= range_times_prob;
bit = 0;
@@ -170,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

@@ -201,6 +201,7 @@ typedef struct DiracContext {
uint16_t *mctmp; /* buffer holding the MC data multipled by OBMC weights */
uint8_t *mcscratch;
int buffer_stride;
DECLARE_ALIGNED(16, uint8_t, obmc_weight)[3][MAX_BLOCKSIZE*MAX_BLOCKSIZE];
@@ -343,22 +344,44 @@ static int alloc_sequence_buffers(DiracContext *s)
return AVERROR(ENOMEM);
}
w = s->source.width;
h = s->source.height;
/* fixme: allocate using real stride here */
s->sbsplit = av_malloc(sbwidth * sbheight);
s->blmotion = av_malloc(sbwidth * sbheight * 16 * sizeof(*s->blmotion));
s->edge_emu_buffer_base = av_malloc((w+64)*MAX_BLOCKSIZE);
s->sbsplit = av_malloc_array(sbwidth, sbheight);
s->blmotion = av_malloc_array(sbwidth, sbheight * 16 * sizeof(*s->blmotion));
s->mctmp = av_malloc((w+64+MAX_BLOCKSIZE) * (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
s->mcscratch = av_malloc((w+64)*MAX_BLOCKSIZE);
if (!s->sbsplit || !s->blmotion || !s->mctmp || !s->mcscratch)
if (!s->sbsplit || !s->blmotion)
return AVERROR(ENOMEM);
return 0;
}
static int alloc_buffers(DiracContext *s, int stride)
{
int w = s->source.width;
int h = s->source.height;
av_assert0(stride >= w);
stride += 64;
if (s->buffer_stride >= stride)
return 0;
s->buffer_stride = 0;
av_freep(&s->edge_emu_buffer_base);
memset(s->edge_emu_buffer, 0, sizeof(s->edge_emu_buffer));
av_freep(&s->mctmp);
av_freep(&s->mcscratch);
s->edge_emu_buffer_base = av_malloc_array(stride, MAX_BLOCKSIZE);
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
s->mcscratch = av_malloc_array(stride, MAX_BLOCKSIZE);
if (!s->edge_emu_buffer_base || !s->mctmp || !s->mcscratch)
return AVERROR(ENOMEM);
s->buffer_stride = stride;
return 0;
}
static void free_sequence_buffers(DiracContext *s)
{
int i, j, k;
@@ -382,6 +405,7 @@ static void free_sequence_buffers(DiracContext *s)
av_freep(&s->plane[i].idwt_tmp);
}
s->buffer_stride = 0;
av_freep(&s->sbsplit);
av_freep(&s->blmotion);
av_freep(&s->edge_emu_buffer_base);
@@ -574,10 +598,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;
}
@@ -966,8 +990,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")
@@ -1343,8 +1367,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5],
motion_y >>= s->chroma_y_shift;
}
mx = motion_x & ~(-1 << s->mv_precision);
my = motion_y & ~(-1 << s->mv_precision);
mx = motion_x & ~(-1U << s->mv_precision);
my = motion_y & ~(-1U << s->mv_precision);
motion_x >>= s->mv_precision;
motion_y >>= s->mv_precision;
/* normalize subpel coordinates to epel */
@@ -1818,6 +1842,9 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
s->plane[1].stride = pic->avframe.linesize[1];
s->plane[2].stride = pic->avframe.linesize[2];
if (alloc_buffers(s, FFMAX3(FFABS(s->plane[0].stride), FFABS(s->plane[1].stride), FFABS(s->plane[2].stride))) < 0)
return AVERROR(ENOMEM);
/* [DIRAC_STD] 11.1 Picture parse. picture_parse() */
if (dirac_decode_picture_header(s))
return -1;

View File

@@ -39,6 +39,7 @@ typedef struct DNXHDContext {
GetBitContext gb;
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
@@ -135,7 +136,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
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_dsputil_init(&ctx->dsp, ctx->avctx);
@@ -143,7 +144,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
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_dsputil_init(&ctx->dsp, ctx->avctx);
@@ -381,9 +382,15 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
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;
}
if (av_image_check_size(ctx->width, ctx->height, 0, avctx))
return -1;
avctx->pix_fmt = ctx->pix_fmt;
avcodec_set_dimensions(avctx, ctx->width, ctx->height);
if (first_field) {

View File

@@ -236,7 +236,7 @@ static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
static int dnxhd_init_rc(DNXHDEncContext *ctx)
{
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*(ctx->m.avctx->qmax + 1)*sizeof(RCEntry), fail);
if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);

View File

@@ -212,6 +212,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
buf[803] = s->bits_per_component;
write16(buf + 804, (s->bits_per_component == 10 || s->bits_per_component == 12) ?
1 : 0); /* packing method */
write32(buf + 808, HEADER_SIZE); /* data offset */
/* Image source information header */
write32(buf + 1628, avctx->sample_aspect_ratio.num);

View File

@@ -1897,7 +1897,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
long i;
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
long a = *(long*)(src+i);
long b = *(long*)(dst+i);
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
@@ -1922,7 +1922,7 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
}
}else
#endif
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
long a = *(long*)(src1+i);
long b = *(long*)(src2+i);
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);

View File

@@ -350,11 +350,6 @@ static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5;
static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
static inline int put_bits_left(PutBitContext* s)
{
return (s->buf_end - s->buf) * 8 - put_bits_count(s);
}
#if CONFIG_SMALL
/* Converts run and level (where level != 0) pair into VLC, returning bit size */
static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc)

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

@@ -99,6 +99,12 @@ 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;
if (w <= 0 || h <= 0)
return -1;
bit_len = (buf_size - start) * 8;
init_get_bits(&gb, buf + start, bit_len);
@@ -340,10 +346,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

@@ -71,6 +71,11 @@ static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint
case 4: // motion compensation
x = (*mv) >> 4; if(x & 8) x = 8 - x;
y = (*mv++) & 0xF; if(y & 8) y = 8 - y;
if (i < -x || avctx->width - i - 4 < x ||
j < -y || avctx->height - j - 4 < y) {
av_log(avctx, AV_LOG_ERROR, "MV %d %d out of bounds\n", x,y);
return AVERROR_INVALIDDATA;
}
tmp2 += x + y*stride;
case 0: // skip
case 5: // skip in method 12
@@ -128,6 +133,11 @@ static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint
case 0x80: // motion compensation
x = (*mv) >> 4; if(x & 8) x = 8 - x;
y = (*mv++) & 0xF; if(y & 8) y = 8 - y;
if (i + 2*(k & 1) < -x || avctx->width - i - 2*(k & 1) - 2 < x ||
j + (k & 2) < -y || avctx->height - j - (k & 2) - 2 < y) {
av_log(avctx, AV_LOG_ERROR, "MV %d %d out of bounds\n", x,y);
return AVERROR_INVALIDDATA;
}
tmp2 += x + y*stride;
case 0x00: // skip
tmp[d + 0 ] = tmp2[0];
@@ -298,6 +308,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_PAL8;
if (avctx->width%4 || avctx->height%4) {
av_log(avctx, AV_LOG_ERROR, "dimensions are not a multiple of 4");
return AVERROR_INVALIDDATA;
}
avcodec_get_frame_defaults(&c->pic);
avcodec_get_frame_defaults(&c->prev);

View File

@@ -255,6 +255,11 @@ static int decode_frame(AVCodecContext *avctx,
calc_quant_matrix(s, buf[13]);
buf += 16;
if (width < 16 || height < 16) {
av_log(avctx, AV_LOG_ERROR, "Dimensions too small\n");
return AVERROR_INVALIDDATA;
}
if (avctx->width != width || avctx->height != height) {
if((width * height)/2048*7 > buf_end-buf)
return AVERROR_INVALIDDATA;

View File

@@ -762,6 +762,17 @@ void ff_er_frame_start(ERContext *s)
s->error_occurred = 0;
}
static int er_supported(ERContext *s)
{
if(s->avctx->hwaccel ||
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
!s->cur_pic ||
s->cur_pic->field_picture
)
return 0;
return 1;
}
/**
* Add a slice.
* @param endx x component of the last macroblock, can be -1
@@ -828,7 +839,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
s->error_status_table[start_xy] |= VP_START;
if (start_xy > 0 && !(s->avctx->active_thread_type & FF_THREAD_SLICE) &&
s->avctx->skip_top * s->mb_width < start_i) {
er_supported(s) && s->avctx->skip_top * s->mb_width < start_i) {
int prev_status = s->error_status_table[s->mb_index2xy[start_i - 1]];
prev_status &= ~ VP_START;
@@ -851,9 +862,7 @@ void ff_er_frame_end(ERContext *s)
* though it should not crash if enabled. */
if (!s->avctx->err_recognition || s->error_count == 0 ||
s->avctx->lowres ||
s->avctx->hwaccel ||
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
!s->cur_pic || s->cur_pic->field_picture ||
!er_supported(s) ||
s->error_count == 3 * s->mb_width *
(s->avctx->skip_top + s->avctx->skip_bottom)) {
return;

View File

@@ -374,7 +374,7 @@ static void bl_intrp(EVRCContext *e, float *ex, float delay)
int offset, i, coef_idx;
int16_t t;
offset = lrintf(fabs(delay));
offset = lrintf(delay);
t = (offset - delay + 0.5) * 8.0 + 0.5;
if (t == 8) {
@@ -640,7 +640,7 @@ static void postfilter(EVRCContext *e, float *in, const float *coeff,
/* Short term postfilter */
synthesis_filter(temp, wcoef2, e->postfilter_iir, length, out);
memcpy(e->postfilter_residual,
memmove(e->postfilter_residual,
e->postfilter_residual + length, ACB_SIZE * sizeof(float));
}
@@ -714,7 +714,7 @@ static void frame_erasure(EVRCContext *e, float *samples)
e->pitch[ACB_SIZE + j] = e->energy_vector[i];
}
memcpy(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
memmove(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
if (e->bitrate != RATE_QUANT && e->avg_acb_gain < 0.4) {
f = 0.1 * e->avg_fcb_gain;
@@ -814,7 +814,7 @@ static int evrc_decode_frame(AVCodecContext *avctx, void *data,
interpolate_delay(idelay, delay, e->prev_pitch_delay, i);
acb_excitation(e, e->pitch + ACB_SIZE, e->avg_acb_gain, idelay, subframe_size);
memcpy(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
memmove(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
}
}
@@ -872,7 +872,7 @@ static int evrc_decode_frame(AVCodecContext *avctx, void *data,
e->pitch[ACB_SIZE + j] = e->energy_vector[i];
}
memcpy(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
memmove(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
synthesis_filter(e->pitch + ACB_SIZE, ilpc,
e->synthesis, subframe_size, tmp);

View File

@@ -348,7 +348,8 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
const uint8_t *src;
int axmax = (avctx->width - (s->xmax + 1)) * 2 * s->desc->nb_components;
int bxmin = s->xmin * 2 * s->desc->nb_components;
int ret, i, x, buf_size = s->buf_size;
int i, x, buf_size = s->buf_size;
int av_unused ret;
line_offset = AV_RL64(s->table + jobnr * 8);
// Check if the buffer has the required bytes needed from the offset

View File

@@ -446,6 +446,10 @@ static int read_extra_header(FFV1Context *f)
ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
f->version = get_symbol(c, state, 0);
if (f->version < 2) {
av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n");
return AVERROR_INVALIDDATA;
}
if (f->version > 2) {
c->bytestream_end -= 4;
f->minor_version = get_symbol(c, state, 0);
@@ -523,6 +527,7 @@ static int read_header(FFV1Context *f)
memset(state, 128, sizeof(state));
if (f->version < 2) {
int chroma_planes, chroma_h_shift, chroma_v_shift, transparency, colorspace, bits_per_raw_sample;
unsigned v= get_symbol(c, state, 0);
if (v >= 2) {
av_log(f->avctx, AV_LOG_ERROR, "invalid version %d in ver01 header\n", v);
@@ -535,15 +540,32 @@ static int read_header(FFV1Context *f)
f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i];
}
f->colorspace = get_symbol(c, state, 0); //YUV cs type
colorspace = get_symbol(c, state, 0); //YUV cs type
bits_per_raw_sample = f->version > 0 ? get_symbol(c, state, 0) : f->avctx->bits_per_raw_sample;
chroma_planes = get_rac(c, state);
chroma_h_shift = get_symbol(c, state, 0);
chroma_v_shift = get_symbol(c, state, 0);
transparency = get_rac(c, state);
if (f->version > 0)
f->avctx->bits_per_raw_sample = get_symbol(c, state, 0);
if (f->plane_count) {
if ( colorspace != f->colorspace
|| bits_per_raw_sample != f->avctx->bits_per_raw_sample
|| chroma_planes != f->chroma_planes
|| chroma_h_shift!= f->chroma_h_shift
|| chroma_v_shift!= f->chroma_v_shift
|| transparency != f->transparency) {
av_log(f->avctx, AV_LOG_ERROR, "Invalid change of global parameters\n");
return AVERROR_INVALIDDATA;
}
}
f->colorspace = colorspace;
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
f->chroma_planes = chroma_planes;
f->chroma_h_shift = chroma_h_shift;
f->chroma_v_shift = chroma_v_shift;
f->transparency = transparency;
f->chroma_planes = get_rac(c, state);
f->chroma_h_shift = get_symbol(c, state, 0);
f->chroma_v_shift = get_symbol(c, state, 0);
f->transparency = get_rac(c, state);
f->plane_count = 2 + f->transparency;
}
@@ -561,47 +583,32 @@ static int read_header(FFV1Context *f)
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P; break;
case 0x20: f->avctx->pix_fmt = AV_PIX_FMT_YUV411P; break;
case 0x22: f->avctx->pix_fmt = AV_PIX_FMT_YUV410P; break;
default:
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return AVERROR(ENOSYS);
}
} else if (f->avctx->bits_per_raw_sample <= 8 && f->transparency) {
switch(16*f->chroma_h_shift + f->chroma_v_shift) {
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUVA444P; break;
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUVA422P; break;
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUVA420P; break;
default:
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return AVERROR(ENOSYS);
}
} else if (f->avctx->bits_per_raw_sample == 9) {
} else if (f->avctx->bits_per_raw_sample == 9 && !f->transparency) {
f->packed_at_lsb = 1;
switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P9; break;
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P9; break;
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P9; break;
default:
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return AVERROR(ENOSYS);
}
} else if (f->avctx->bits_per_raw_sample == 10) {
} else if (f->avctx->bits_per_raw_sample == 10 && !f->transparency) {
f->packed_at_lsb = 1;
switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P10; break;
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P10; break;
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P10; break;
default:
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return AVERROR(ENOSYS);
}
} else {
} else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency){
switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUV444P16; break;
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; break;
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; break;
default:
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return AVERROR(ENOSYS);
}
}
} else if (f->colorspace == 1) {
@@ -625,6 +632,10 @@ static int read_header(FFV1Context *f)
av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
return AVERROR(ENOSYS);
}
if (f->avctx->pix_fmt == AV_PIX_FMT_NONE) {
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return AVERROR(ENOSYS);
}
av_dlog(f->avctx, "%d %d %d\n",
f->chroma_h_shift, f->chroma_v_shift, f->avctx->pix_fmt);

View File

@@ -274,7 +274,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w,
int run_mode = 0;
if (s->ac) {
if (c->bytestream_end - c->bytestream < w * 20) {
if (c->bytestream_end - c->bytestream < w * 35) {
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return AVERROR_INVALIDDATA;
}

View File

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

View File

@@ -27,7 +27,7 @@ const int ff_flac_sample_rate_table[16] =
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
0, 0, 0, 0 };
const int16_t ff_flac_blocksize_table[16] = {
const int32_t ff_flac_blocksize_table[16] = {
0, 192, 576<<0, 576<<1, 576<<2, 576<<3, 0, 0,
256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7
};

View File

@@ -26,6 +26,6 @@
extern const int ff_flac_sample_rate_table[16];
extern const int16_t ff_flac_blocksize_table[16];
extern const int32_t ff_flac_blocksize_table[16];
#endif /* AVCODEC_FLACDATA_H */

View File

@@ -463,10 +463,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

@@ -394,6 +394,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
}
s->diff_start = get_bits(&gb, 8);
s->diff_height = get_bits(&gb, 8);
if (s->diff_start + s->diff_height > cur_blk_height) {
av_log(avctx, AV_LOG_ERROR, "Block parameters invalid\n");
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_DEBUG,
"%dx%d diff start %d height %d\n",
i, j, s->diff_start, s->diff_height);

View File

@@ -2288,7 +2288,8 @@ static int pack_bitstream(G723_1_Context *p, unsigned char *frame, int size)
if (p->cur_rate == RATE_6300) {
info_bits = 0;
put_bits(&pb, 2, info_bits);
}
}else
av_assert0(0);
put_bits(&pb, 8, p->lsp_index[2]);
put_bits(&pb, 8, p->lsp_index[1]);

View File

@@ -253,26 +253,21 @@ static int gif_read_image(GifState *s)
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;
}
@@ -462,6 +457,7 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A
if (s->keyframe) {
s->keyframe_ok = 0;
s->gce_prev_disposal = GCE_DISPOSAL_NONE;
if ((ret = gif_read_header1(s)) < 0)
return ret;

View File

@@ -58,7 +58,7 @@ int main(void)
}
}
#define EXTEND(i) (i << 3 | i & 7)
#define EXTEND(i) ((i) << 3 | (i) & 7)
init_put_bits(&pb, temp, SIZE);
for (i = 0; i < COUNT; i++)
set_ue_golomb(&pb, EXTEND(i));

View File

@@ -721,10 +721,10 @@ frame_end:
}
if(startcode_found){
av_fast_malloc(
av_fast_padded_mallocz(
&s->bitstream_buffer,
&s->allocated_bitstream_buffer_size,
buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE);
buf_size - current_pos);
if (!s->bitstream_buffer)
return AVERROR(ENOMEM);
memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);

View File

@@ -417,18 +417,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 -1;
}
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;
@@ -1043,6 +1043,7 @@ static void free_tables(H264Context *h, int free_rbsp)
av_freep(&h->visualization_buffer[i]);
if (free_rbsp) {
memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
for (i = 0; i < h->picture_count && !h->avctx->internal->is_copy; i++)
free_picture(h, &h->DPB[i]);
av_freep(&h->DPB);
@@ -1600,6 +1601,17 @@ static int decode_update_thread_context(AVCodecContext *dst,
memset(&h->me, 0, sizeof(h->me));
h->avctx = dst;
h->DPB = 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;
if (h1->context_initialized) {
h->context_initialized = 0;
@@ -1782,11 +1794,6 @@ int ff_h264_frame_start(H264Context *h)
h->block_offset[48 + 32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * h->uvlinesize * ((scan8[i] - scan8[0]) >> 3);
}
/* Some macroblocks can be accessed before they're available in case
* of lost slices, MBAFF or threading. */
memset(h->slice_table, -1,
(h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table));
// s->decode = (h->flags & CODEC_FLAG_PSNR) || !s->encoding ||
// h->cur_pic.f.reference /* || h->contains_intra */ || 1;
@@ -2425,6 +2432,16 @@ static int 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;
@@ -2584,6 +2601,7 @@ static void flush_change(H264Context *h)
h->sync= 0;
h->list_count = 0;
h->current_slice = 0;
h->mmco_reset = 1;
}
/* forget old pics after a seek */
@@ -3098,6 +3116,18 @@ static int h264_slice_header_init(H264Context *h, int reinit)
return 0;
}
static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
{
switch (a) {
case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
default:
return a;
}
}
/**
* Decode a slice header.
* This will also call ff_MPV_common_init() and frame_start() as needed.
@@ -3114,10 +3144,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
unsigned int pps_id;
int num_ref_idx_active_override_flag, ret;
unsigned int slice_type, tmp, i, j;
int default_ref_list_done = 0;
int last_pic_structure, last_pic_droppable;
int must_reinit;
int needs_reinit = 0;
int first_slice = h == h0 && !h0->current_slice;
int frame_num, picture_structure, droppable;
PPS *pps;
h->me.qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
h->me.qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab;
@@ -3154,12 +3186,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
h->slice_type_fixed = 0;
slice_type = golomb_to_pict_type[slice_type];
if (slice_type == AV_PICTURE_TYPE_I ||
(h0->current_slice != 0 &&
slice_type == h0->last_slice_type &&
!memcmp(h0->last_ref_count, h0->ref_count, sizeof(h0->ref_count)))) {
default_ref_list_done = 1;
}
h->slice_type = slice_type;
h->slice_type_nos = slice_type & 3;
@@ -3177,17 +3203,26 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
pps_id);
return -1;
}
h->pps = *h0->pps_buffers[pps_id];
if (!h0->sps_buffers[h->pps.sps_id]) {
pps = h0->pps_buffers[pps_id];
if (!h0->sps_buffers[pps->sps_id]) {
av_log(h->avctx, AV_LOG_ERROR,
"non-existing SPS %u referenced\n",
h->pps.sps_id);
return -1;
}
if (first_slice)
h->pps = *h0->pps_buffers[pps_id];
if (h->pps.sps_id != h->current_sps_id ||
h0->sps_buffers[h->pps.sps_id]->new) {
if (pps->sps_id != h->current_sps_id ||
h0->sps_buffers[pps->sps_id]->new) {
if (!first_slice) {
av_log(h->avctx, AV_LOG_ERROR,
"SPS changed in the middle of the frame\n");
return AVERROR_INVALIDDATA;
}
h0->sps_buffers[h->pps.sps_id]->new = 0;
h->current_sps_id = h->pps.sps_id;
@@ -3219,8 +3254,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|| 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height
|| h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc
|| av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio)));
if (h0->avctx->pix_fmt != get_pixel_format(h0, 0))
|| h->mb_width != h->sps.mb_width
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
));
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
must_reinit = 1;
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
must_reinit = 1;
h->mb_width = h->sps.mb_width;
@@ -3296,37 +3336,40 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
init_dequant_tables(h);
}
h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
if (!first_slice) {
if (h0->frame_num != frame_num) {
av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n",
h0->frame_num, frame_num);
return AVERROR_INVALIDDATA;
}
}
h->mb_mbaff = 0;
h->mb_aff_frame = 0;
last_pic_structure = h0->picture_structure;
last_pic_droppable = h0->droppable;
h->droppable = h->nal_ref_idc == 0;
droppable = h->nal_ref_idc == 0;
if (h->sps.frame_mbs_only_flag) {
h->picture_structure = PICT_FRAME;
picture_structure = PICT_FRAME;
} else {
if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) {
av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n");
return -1;
}
if (get_bits1(&h->gb)) { // field_pic_flag
h->picture_structure = PICT_TOP_FIELD + get_bits1(&h->gb); // bottom_field_flag
picture_structure = PICT_TOP_FIELD + get_bits1(&h->gb); // bottom_field_flag
} else {
h->picture_structure = PICT_FRAME;
picture_structure = PICT_FRAME;
h->mb_aff_frame = h->sps.mb_aff;
}
}
h->mb_field_decoding_flag = h->picture_structure != PICT_FRAME;
if (h0->current_slice != 0) {
if (last_pic_structure != h->picture_structure ||
last_pic_droppable != h->droppable) {
if (h0->current_slice) {
if (last_pic_structure != picture_structure ||
last_pic_droppable != droppable) {
av_log(h->avctx, AV_LOG_ERROR,
"Changing field mode (%d -> %d) between slices is not allowed\n",
last_pic_structure, h->picture_structure);
h->picture_structure = last_pic_structure;
h->droppable = last_pic_droppable;
return AVERROR_INVALIDDATA;
} else if (!h0->cur_pic_ptr) {
av_log(h->avctx, AV_LOG_ERROR,
@@ -3334,10 +3377,17 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
h0->current_slice + 1);
return AVERROR_INVALIDDATA;
}
} else {
}
h->picture_structure = picture_structure;
h->droppable = droppable;
h->frame_num = frame_num;
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
if (h0->current_slice == 0) {
/* Shorten frame num gaps so we don't have to allocate reference
* frames just to throw them away */
if (h->frame_num != h->prev_frame_num && h->prev_frame_num >= 0) {
if (h->frame_num != h->prev_frame_num) {
int unwrap_prev_frame_num = h->prev_frame_num;
int max_frame_num = 1 << h->sps.log2_max_frame_num;
@@ -3364,7 +3414,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
assert(h0->cur_pic_ptr->f.reference != DELAYED_PIC_REF);
/* Mark old field/frame as completed */
if (!last_pic_droppable && h0->cur_pic_ptr->owner2 == h0) {
if (h0->cur_pic_ptr->owner2 == h0) {
ff_thread_report_progress(&h0->cur_pic_ptr->f, INT_MAX,
last_pic_structure == PICT_BOTTOM_FIELD);
}
@@ -3373,7 +3423,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
if (!FIELD_PICTURE || h->picture_structure == last_pic_structure) {
/* Previous field is unmatched. Don't display it, but let it
* remain for reference if marked as such. */
if (!last_pic_droppable && last_pic_structure != PICT_FRAME) {
if (last_pic_structure != PICT_FRAME) {
ff_thread_report_progress(&h0->cur_pic_ptr->f, INT_MAX,
last_pic_structure == PICT_TOP_FIELD);
}
@@ -3383,7 +3433,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
* different frame_nums. Consider this field first in
* pair. Throw away previous field except for reference
* purposes. */
if (!last_pic_droppable && last_pic_structure != PICT_FRAME) {
if (last_pic_structure != PICT_FRAME) {
ff_thread_report_progress(&h0->cur_pic_ptr->f, INT_MAX,
last_pic_structure == PICT_TOP_FIELD);
}
@@ -3419,7 +3469,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
}
}
while (h->frame_num != h->prev_frame_num && h->prev_frame_num >= 0 && !h0->first_field &&
while (h->frame_num != h->prev_frame_num && !h0->first_field &&
h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) {
Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
@@ -3498,6 +3548,15 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
} else {
release_unused_pictures(h, 0);
}
/* Some macroblocks can be accessed before they're available in case
* of lost slices, MBAFF or threading. */
if (FIELD_PICTURE) {
for(i = (h->picture_structure == PICT_BOTTOM_FIELD); i<h->mb_height; i++)
memset(h->slice_table + i*h->mb_stride, -1, (h->mb_stride - (i+1==h->mb_height)) * sizeof(*h->slice_table));
} else {
memset(h->slice_table, -1,
(h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table));
}
}
if (h != h0 && (ret = clone_slice(h, h0)) < 0)
return ret;
@@ -3590,9 +3649,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
h->list_count = 0;
h->ref_count[0] = h->ref_count[1] = 0;
}
if (!default_ref_list_done)
if (slice_type != AV_PICTURE_TYPE_I &&
(h0->current_slice == 0 ||
slice_type != h0->last_slice_type ||
memcmp(h0->last_ref_count, h0->ref_count, sizeof(h0->ref_count)))) {
ff_h264_fill_default_ref_list(h);
}
if (h->slice_type_nos != AV_PICTURE_TYPE_I &&
ff_h264_decode_ref_pic_list_reordering(h) < 0) {
@@ -3775,6 +3837,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
if (h->ref_count[0]) h->er.last_pic = &h->ref_list[0][0];
if (h->ref_count[1]) h->er.next_pic = &h->ref_list[1][0];
h->er.ref_count = h->ref_count[0];
if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
av_log(h->avctx, AV_LOG_DEBUG,
@@ -4166,7 +4229,6 @@ static void er_add_slice(H264Context *h, int startx, int starty,
if (CONFIG_ERROR_RESILIENCE) {
ERContext *er = &h->er;
er->ref_count = h->ref_count[0];
ff_er_add_slice(er, startx, starty, endx, endy, status);
}
}

View File

@@ -255,6 +255,7 @@ typedef struct MMCO {
* H264Context
*/
typedef struct H264Context {
AVClass *av_class;
AVCodecContext *avctx;
VideoDSPContext vdsp;
H264DSPContext h264dsp;
@@ -969,6 +970,33 @@ 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_mpv_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;
}
void ff_h264_draw_horiz_band(H264Context *h, int y, int height);
#endif /* AVCODEC_H264_H */

View File

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

View File

@@ -549,9 +549,15 @@ static int decode_residual(H264Context *h, GetBitContext *gb, int16_t *block, in
if(prefix<15){
level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length);
}else{
level_code = (15<<suffix_length) + get_bits(gb, prefix-3);
if(prefix>=16)
level_code = 15<<suffix_length;
if (prefix>=16) {
if(prefix > 25+3){
av_log(h->avctx, AV_LOG_ERROR, "Invalid level prefix\n");
return AVERROR_INVALIDDATA;
}
level_code += (1<<(prefix-3))-4096;
}
level_code += get_bits(gb, prefix-3);
}
mask= -(level_code&1);
level_code= (((2+level_code)>>1) ^ mask) - mask;
@@ -706,7 +712,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h){
down the code */
if(h->slice_type_nos != AV_PICTURE_TYPE_I){
if(h->mb_skip_run==-1)
h->mb_skip_run= get_ue_golomb(&h->gb);
h->mb_skip_run= get_ue_golomb_long(&h->gb);
if (h->mb_skip_run--) {
if(FRAME_MBAFF && (h->mb_y&1) == 0){

View File

@@ -154,7 +154,7 @@ pps:
goto fail;
/* prepend only to the first type 5 NAL unit of an IDR picture */
if (ctx->first_idr && unit_type == 5) {
if (ctx->first_idr && (unit_type == 5 || unit_type == 7 || unit_type == 8)) {
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
avctx->extradata, avctx->extradata_size,
buf, nal_size)) < 0)

View File

@@ -139,10 +139,10 @@ found:
*/
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;
@@ -162,26 +162,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_mpv_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:
@@ -190,10 +190,12 @@ static inline int parse_nal_units(AVCodecParserContext *s,
src_length = 20;
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:
@@ -277,7 +279,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

@@ -379,7 +379,9 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
}
sps->bit_depth_luma = get_ue_golomb(&h->gb) + 8;
sps->bit_depth_chroma = get_ue_golomb(&h->gb) + 8;
if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U || sps->bit_depth_luma != sps->bit_depth_chroma) {
if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 ||
sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14 ||
sps->bit_depth_luma != sps->bit_depth_chroma) {
av_log(h->avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n",
sps->bit_depth_luma, sps->bit_depth_chroma);
goto fail;

View File

@@ -543,7 +543,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
if(!pic){
if(mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg]
|| h->long_ref[mmco[i].long_arg]->frame_num != frame_num) {
av_log(h->avctx, AV_LOG_ERROR, "mmco: unref short failure\n");
av_log(h->avctx, h->short_ref_count ? AV_LOG_ERROR : AV_LOG_DEBUG, "mmco: unref short failure\n");
err = AVERROR_INVALIDDATA;
}
continue;
@@ -586,6 +586,9 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
if (h->long_ref[mmco[i].long_arg] != h->cur_pic_ptr) {
remove_long(h, mmco[i].long_arg, 0);
if (remove_short(h, h->cur_pic_ptr->frame_num, 0)) {
av_log(h->avctx, AV_LOG_ERROR, "mmco: cannot assign current picture to short and long at the same time\n");
}
h->long_ref[ mmco[i].long_arg ]= h->cur_pic_ptr;
h->long_ref[ mmco[i].long_arg ]->long_ref=1;
@@ -680,7 +683,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
print_short_term(h);
print_long_term(h);
if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (h->picture_structure != PICT_FRAME) && h->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){
if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=2 + (h->picture_structure != PICT_FRAME) && h->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){
h->cur_pic_ptr->sync |= 1;
if(!h->avctx->has_b_frames)
h->sync = 2;
@@ -693,7 +696,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
int first_slice)
{
int i, ret;
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = mmco_temp;
int mmco_index = 0;
if (h->nal_unit_type == NAL_IDR_SLICE){ // FIXME fields
@@ -759,6 +762,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
}
if (first_slice && mmco_index != -1) {
memcpy(h->mmco, mmco_temp, sizeof(h->mmco));
h->mmco_index = mmco_index;
} else if (!first_slice && mmco_index >= 0 &&
(mmco_index != h->mmco_index ||

View File

@@ -31,9 +31,11 @@
c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_ ## depth ## _c; \
c->put_h264_chroma_pixels_tab[3] = put_h264_chroma_mc1_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_ ## depth ## _c; \
c->avg_h264_chroma_pixels_tab[3] = avg_h264_chroma_mc1_ ## depth ## _c; \
void ff_h264chroma_init(H264ChromaContext *c, int bit_depth)
{

View File

@@ -24,8 +24,8 @@
typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
typedef struct H264ChromaContext {
h264_chroma_mc_func put_h264_chroma_pixels_tab[3];
h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
h264_chroma_mc_func put_h264_chroma_pixels_tab[4];
h264_chroma_mc_func avg_h264_chroma_pixels_tab[4];
} H264ChromaContext;
void ff_h264chroma_init(H264ChromaContext *c, int bit_depth);

View File

@@ -24,6 +24,34 @@
#include "bit_depth_template.c"
#define H264_CHROMA_MC(OPNAME, OP)\
static void FUNCC(OPNAME ## h264_chroma_mc1)(uint8_t *_dst/*align 8*/, uint8_t *_src/*align 1*/, int stride, int h, int x, int y){\
pixel *dst = (pixel*)_dst;\
pixel *src = (pixel*)_src;\
const int A=(8-x)*(8-y);\
const int B=( x)*(8-y);\
const int C=(8-x)*( y);\
const int D=( x)*( y);\
int i;\
stride >>= sizeof(pixel)-1;\
\
av_assert2(x<8 && y<8 && x>=0 && y>=0);\
\
if(D){\
for(i=0; i<h; i++){\
OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
dst+= stride;\
src+= stride;\
}\
}else{\
const int E= B+C;\
const int step= C ? stride : 1;\
for(i=0; i<h; i++){\
OP(dst[0], (A*src[0] + E*src[step+0]));\
dst+= stride;\
src+= stride;\
}\
}\
}\
static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst/*align 8*/, uint8_t *_src/*align 1*/, int stride, int h, int x, int y){\
pixel *dst = (pixel*)_dst;\
pixel *src = (pixel*)_src;\

View File

@@ -832,9 +832,9 @@ 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);

View File

@@ -95,7 +95,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
@@ -897,7 +897,8 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
{
const uint8_t *buf_ptr = buf, *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;
@@ -977,7 +978,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(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");
return AVERROR_INVALIDDATA;

View File

@@ -804,8 +804,16 @@ static int decode_band(IVI45DecContext *ctx,
break;
result = ivi_decode_blocks(&ctx->gb, band, tile, avctx);
if (result < 0 || ((get_bits_count(&ctx->gb) - pos) >> 3) != tile->data_size) {
av_log(avctx, AV_LOG_ERROR, "Corrupted tile data encountered!\n");
if (result < 0) {
av_log(avctx, AV_LOG_ERROR,
"Corrupted tile data encountered!\n");
break;
}
if (((get_bits_count(&ctx->gb) - pos) >> 3) != tile->data_size) {
av_log(avctx, AV_LOG_ERROR,
"Tile data_size mismatch!\n");
result = AVERROR_INVALIDDATA;
break;
}

View File

@@ -31,6 +31,7 @@
#include "bytestream.h"
#include "internal.h"
#include "j2k.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#define JP2_SIG_TYPE 0x6A502020
@@ -302,6 +303,10 @@ static int get_cox(J2kDecoderContext *s, J2kCodingStyle *c)
c->log2_cblk_width = bytestream2_get_byteu(&s->g) + 2; // cblk width
c->log2_cblk_height = bytestream2_get_byteu(&s->g) + 2; // cblk height
if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {
return AVERROR_PATCHWELCOME;
}
c->cblk_style = bytestream2_get_byteu(&s->g);
if (c->cblk_style != 0){ // cblk style
av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style);
@@ -719,6 +724,9 @@ static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Contex
int bpass_csty_symbol = J2K_CBLK_BYPASS & codsty->cblk_style;
int vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style;
av_assert0(width <= J2K_MAX_CBLKW);
av_assert0(height <= J2K_MAX_CBLKH);
for (y = 0; y < height+2; y++)
memset(t1->flags[y], 0, (width+2)*sizeof(int));

View File

@@ -142,6 +142,8 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI
ret = ret >> 1;
}
if(FFABS(ret) > 0xFFFF)
return -0x10000;
/* update state */
state->A[Q] += FFABS(ret) - RItype;
ret *= state->twonear;
@@ -205,6 +207,11 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
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

@@ -107,7 +107,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h)
val = bytestream2_get_byte(&ctx->g);
mx = val & 0xF;
my = val >> 4;
if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 316*196) {
if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 320*197 - 4) {
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
return AVERROR_INVALIDDATA;
}
@@ -132,7 +132,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h)
val = bytestream2_get_byte(&ctx->g);
mx = val & 0xF;
my = val >> 4;
if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 318*198) {
if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 320*199 - 2) {
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
return AVERROR_INVALIDDATA;
}
@@ -207,7 +207,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
val = bytestream2_get_byte(&ctx->g);
mx = (val & 0xF) - 8;
my = (val >> 4) - 8;
if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 318*198) {
if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 320*197 - 4) {
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
return AVERROR_INVALIDDATA;
}
@@ -232,7 +232,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
val = bytestream2_get_byte(&ctx->g);
mx = (val & 0xF) - 8;
my = (val >> 4) - 8;
if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 318*198) {
if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 320*199 - 2) {
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
return AVERROR_INVALIDDATA;
}

View File

@@ -42,6 +42,7 @@
#include <stdlib.h>
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
@@ -491,6 +492,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
unsigned int max_basesize = FFALIGN(avctx->width, 4) *
FFALIGN(avctx->height, 4);
unsigned int max_decomp_size;
int subsample_h, subsample_v;
avcodec_get_frame_defaults(&c->pic);
if (avctx->extradata_size < 8) {
@@ -517,6 +519,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
max_decomp_size = max_basesize * 2;
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
if (avctx->width % 4) {
return AVERROR_INVALIDDATA;
}
break;
case IMGTYPE_RGB24:
c->decomp_size = basesize * 3;
@@ -547,6 +552,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &subsample_h, &subsample_v);
if (avctx->width % (1<<subsample_h) || avctx->height % (1<<subsample_v)) {
return AVERROR_INVALIDDATA;
}
/* Detect compression method */
c->compression = (int8_t)avctx->extradata[5];
switch (avctx->codec_id) {

View File

@@ -98,8 +98,7 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
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;
@@ -185,7 +184,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

@@ -380,7 +380,7 @@ static const AVOption libopus_options[] = {
{ "voip", "Favor improved speech intelligibility", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_VOIP }, 0, 0, FLAGS, "application" },
{ "audio", "Favor faithfulness to the input", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_AUDIO }, 0, 0, FLAGS, "application" },
{ "lowdelay", "Restrict to only the lowest delay modes", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0, FLAGS, "application" },
{ "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 10.0 }, 2.5, 60.0, FLAGS },
{ "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 20.0 }, 2.5, 60.0, FLAGS },
{ "packet_loss", "Expected packet loss percentage", OFFSET(packet_loss), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, FLAGS },
{ "vbr", "Variable bit rate mode", OFFSET(vbr), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 2, FLAGS, "vbr" },
{ "off", "Use constant bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "vbr" },

View File

@@ -362,7 +362,8 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
avctx->delay = duration;
av_assert0(!s->afq.remaining_delay);
s->afq.frames->duration += duration;
s->afq.frames->pts -= duration;
if (s->afq.frames->pts != AV_NOPTS_VALUE)
s->afq.frames->pts -= duration;
s->afq.remaining_samples += duration;
}
ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration);

View File

@@ -175,7 +175,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P :
frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B :
X264_TYPE_AUTO;
if (x4->params.b_tff != frame->top_field_first) {
if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) {
x4->params.b_tff = frame->top_field_first;
x264_encoder_reconfig(x4->enc, &x4->params);
}
@@ -343,19 +343,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
OPT_STR("level", x4->level);
if(x4->x264opts){
const char *p= x4->x264opts;
while(p){
char param[256]={0}, val[256]={0};
if(sscanf(p, "%255[^:=]=%255[^:]", param, val) == 1){
OPT_STR(param, "1");
}else
OPT_STR(param, val);
p= strchr(p, ':');
p+=!!p;
}
}
if (avctx->i_quant_factor > 0)
x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
@@ -525,6 +512,19 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
x4->params.b_repeat_headers = 0;
if(x4->x264opts){
const char *p= x4->x264opts;
while(p){
char param[256]={0}, val[256]={0};
if(sscanf(p, "%255[^:=]=%255[^:]", param, val) == 1){
OPT_STR(param, "1");
}else
OPT_STR(param, val);
p= strchr(p, ':');
p+=!!p;
}
}
if (x4->x264_params) {
AVDictionary *dict = NULL;
AVDictionaryEntry *en = NULL;

View File

@@ -211,7 +211,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
{
int len, nb_components, i, width, height, pix_fmt_id;
int len, nb_components, i, width, height, bits, pix_fmt_id;
int h_count[MAX_COMPONENTS];
int v_count[MAX_COMPONENTS];
@@ -220,14 +220,14 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
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->bits != 8 && !s->lossless) {
if (bits != 8 && !s->lossless) {
av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n");
return -1;
}
@@ -258,7 +258,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)) {
av_log_missing_feature(s->avctx,
"For JPEG-LS anything except <= 8 bits/component"
" or 16-bit gray", 0);
@@ -301,12 +301,14 @@ 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))) {
av_freep(&s->qscale_table);
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;
@@ -329,7 +331,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->first_picture = 0;
}
if (s->interlaced && (s->bottom_field == !s->interlace_polarity)) {
if (s->got_picture && s->interlaced && (s->bottom_field == !s->interlace_polarity)) {
if (s->progressive) {
av_log_ask_for_sample(s->avctx, "progressively coded interlaced pictures not supported\n");
return AVERROR_INVALIDDATA;
@@ -435,9 +437,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
}
if (s->ls) {
s->upscale_h = s->upscale_v = 0;
if (s->nb_components > 1)
if (s->nb_components == 3) {
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
else if (s->bits <= 8)
} else if (s->nb_components != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of components %d\n", s->nb_components);
return AVERROR_PATCHWELCOME;
} else if (s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
else
s->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
@@ -747,7 +752,9 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
i = 8 + ((-get_bits_count(&s->gb)) & 7);
/* skip RSTn */
if (s->restart_count == 0 && show_bits(&s->gb, i) == (1 << i) - 1) {
if (s->restart_count == 0) {
if( show_bits(&s->gb, i) == (1 << i) - 1
|| show_bits(&s->gb, i) == 0xFF) {
int pos = get_bits_count(&s->gb);
align_get_bits(&s->gb);
while (get_bits_left(&s->gb) >= 8 && show_bits(&s->gb, 8) == 0xFF)
@@ -757,6 +764,7 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
s->last_dc[i] = 1024;
} else
skip_bits_long(&s->gb, pos - get_bits_count(&s->gb));
}
}
}
}
@@ -771,6 +779,12 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
int resync_mb_y = 0;
int resync_mb_x = 0;
if (s->nb_components != 3 && s->nb_components != 4)
return AVERROR_INVALIDDATA;
if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
return AVERROR_INVALIDDATA;
s->restart_count = s->restart_interval;
av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size,
@@ -1069,13 +1083,18 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
if (s->interlaced && s->bottom_field)
block_offset += linesize[c] >> 1;
ptr = data[c] + block_offset;
if ( 8*(h * mb_x + x) < s->width
&& 8*(v * mb_y + y) < s->height) {
ptr = data[c] + block_offset;
} else
ptr = NULL;
if (!s->progressive) {
if (copy_mb)
mjpeg_copy_block(s, ptr, reference_data[c] + block_offset,
linesize[c], s->avctx->lowres);
if (copy_mb) {
if (ptr)
mjpeg_copy_block(s, ptr, reference_data[c] + block_offset,
linesize[c], s->avctx->lowres);
else {
} else {
s->dsp.clear_block(s->block);
if (decode_block(s, s->block, i,
s->dc_index[i], s->ac_index[i],
@@ -1084,7 +1103,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
"error y=%d x=%d\n", mb_y, mb_x);
return AVERROR_INVALIDDATA;
}
s->dsp.idct_put(ptr, linesize[c], s->block);
if (ptr) {
s->dsp.idct_put(ptr, linesize[c], s->block);
}
}
} else {
int block_idx = s->block_stride[c] * (v * mb_y + y) +
@@ -1135,7 +1156,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
}
if (!Al) {
s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss);
s->coefs_finished[c] |= (2LL << se) - (1LL << ss);
last_scan = !~s->coefs_finished[c];
}
@@ -1426,6 +1447,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");
@@ -1435,17 +1458,27 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
skip_bits(&s->gb, 16); /* unknown always 0? */
switch (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\n");
}
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;
}
@@ -1587,8 +1620,6 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
int t = 0, b = 0;
PutBitContext pb;
s->cur_scan++;
/* find marker */
while (src + t < buf_end) {
uint8_t x = src[t++];
@@ -1610,6 +1641,10 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
put_bits(&pb, 8, x);
if (x == 0xFF) {
x = src[b++];
if (x & 0x80) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
x &= 0x7f;
}
put_bits(&pb, 7, x);
bit_count--;
}
@@ -1636,6 +1671,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
MJpegDecodeContext *s = avctx->priv_data;
const uint8_t *buf_end, *buf_ptr;
const uint8_t *unescaped_buf_ptr;
int hshift, vshift;
int unescaped_buf_size;
int start_code;
int i, index;
@@ -1651,7 +1687,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
&unescaped_buf_size);
/* EOF */
if (start_code < 0) {
goto the_end;
break;
} else if (unescaped_buf_size > (1U<<28)) {
av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (0x%x/0x%x), corrupt data?\n",
start_code, unescaped_buf_size, buf_size);
@@ -1761,6 +1797,7 @@ eoi_parser:
goto the_end;
case SOS:
s->cur_scan++;
if ((ret = ff_mjpeg_decode_sos(s, NULL, NULL)) < 0 &&
(avctx->err_recognition & AV_EF_EXPLODE))
goto fail;
@@ -1790,7 +1827,7 @@ eoi_parser:
(get_bits_count(&s->gb) + 7) / 8, get_bits_count(&s->gb));
}
}
if (s->got_picture) {
if (s->got_picture && s->cur_scan) {
av_log(avctx, AV_LOG_WARNING, "EOI missing, emulating\n");
goto eoi_parser;
}
@@ -1814,6 +1851,9 @@ the_end:
}
if (s->upscale_v) {
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]];
int w;
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
w = s->width >> hshift;
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
@@ -1822,16 +1862,16 @@ the_end:
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]];
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]];
if (src1 == src2) {
memcpy(dst, src1, s->width);
memcpy(dst, src1, w);
} else {
for (index = 0; index < s->width; index++)
for (index = 0; index < w; index++)
dst[index] = (src1[index] + src2[index]) >> 1;
}
dst -= s->linesize[s->upscale_v];
}
}
if (s->flipped && (s->avctx->flags & CODEC_FLAG_EMU_EDGE)) {
int hshift, vshift, j;
int j;
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
for (index=0; index<4; index++) {
uint8_t *dst = s->picture_ptr->data[index];

View File

@@ -454,7 +454,7 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n)
put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]);
}
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64])
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[12][64])
{
int i;
if (s->chroma_format == CHROMA_444) {

View File

@@ -56,6 +56,6 @@ void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
uint8_t *huff_size, uint16_t *huff_code);
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64]);
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[12][64]);
#endif /* AVCODEC_MJPEGENC_H */

View File

@@ -813,7 +813,7 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
return 0;
}
#define MSB_MASK(bits) (-1u << bits)
#define MSB_MASK(bits) (-1u << (bits))
/** Generate PCM samples using the prediction filters and residual values
* read from the data stream, and update the filter state. */

View File

@@ -104,9 +104,12 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
if (half_horiz)
run_length *=2;
if (run_length > s->avctx->width - x)
return AVERROR_INVALIDDATA;
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;
@@ -151,6 +154,8 @@ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert)
int replace_array = bytestream2_get_byte(&s->gb);
for(j=0; j<8; j++) {
int replace = (replace_array >> (7-j)) & 1;
if (x + half_horiz >= s->avctx->width)
return AVERROR_INVALIDDATA;
if (replace) {
int color = bytestream2_get_byte(&data_ptr);
s->frame.data[0][y*s->frame.linesize[0] + x] = color;

View File

@@ -189,7 +189,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

@@ -1266,7 +1266,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
s1->save_width != s->width ||
s1->save_height != s->height ||
s1->save_aspect_info != s->aspect_ratio_info ||
s1->save_progressive_seq != s->progressive_sequence ||
(s1->save_progressive_seq != s->progressive_sequence && (s->height&31)) ||
0)
{
@@ -2277,7 +2277,8 @@ static int decode_chunks(AVCodecContext *avctx,
buf_ptr = avpriv_mpv_find_start_code(buf_ptr, buf_end, &start_code);
if (start_code > 0x1ff) {
if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) {
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
!avctx->hwaccel) {
int i;
av_assert0(avctx->thread_count > 1);
@@ -2337,7 +2338,8 @@ static int decode_chunks(AVCodecContext *avctx,
s2->intra_dc_precision= 3;
s2->intra_matrix[0]= 1;
}
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) && s->slice_count) {
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
!avctx->hwaccel && s->slice_count) {
int i;
avctx->execute(avctx, slice_decode_thread,
@@ -2504,7 +2506,8 @@ static int decode_chunks(AVCodecContext *avctx,
break;
}
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE) &&
!avctx->hwaccel) {
int threshold = (s2->mb_height * s->slice_count +
s2->slice_context_count / 2) /
s2->slice_context_count;

View File

@@ -1086,6 +1086,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]);
@@ -1114,8 +1117,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;
@@ -1131,7 +1134,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;
@@ -2102,7 +2105,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
int motion_x, int motion_y)
{
const int lowres = s->avctx->lowres;
const int op_index = FFMIN(lowres, 2);
const int op_index = FFMIN(lowres, 3);
const int s_mask = (2 << lowres) - 1;
int emu = 0;
int sx, sy;
@@ -2155,7 +2158,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy,
uvsx, uvsy;
const int lowres = s->avctx->lowres;
const int op_index = FFMIN(lowres-1+s->chroma_x_shift, 2);
const int op_index = FFMIN(lowres-1+s->chroma_x_shift, 3);
const int block_s = 8>>lowres;
const int s_mask = (2 << lowres) - 1;
const int h_edge_pos = s->h_edge_pos >> lowres;
@@ -2221,7 +2224,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) ||
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
(unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y,
linesize >> field_based, 17, 17 + field_based,
@@ -2261,11 +2264,12 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h;
uvsx = (uvsx << 2) >> lowres;
uvsy = (uvsy << 2) >> lowres;
if (h >> s->chroma_y_shift) {
pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
if (hc) {
pix_op[op_index](dest_cb, ptr_cb, uvlinesize, hc, uvsx, uvsy);
pix_op[op_index](dest_cr, ptr_cr, uvlinesize, hc, uvsx, uvsy);
}
}
// FIXME h261 lowres loop filter
@@ -2278,7 +2282,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
int mx, int my)
{
const int lowres = s->avctx->lowres;
const int op_index = FFMIN(lowres, 2);
const int op_index = FFMIN(lowres, 3);
const int block_s = 8 >> lowres;
const int s_mask = (2 << lowres) - 1;
const int h_edge_pos = s->h_edge_pos >> lowres + 1;

View File

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

View File

@@ -812,7 +812,8 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
}
} else {
if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){
if( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
|| !ref_picture[0]){
ref_picture = s->current_picture_ptr->f.data;
}
@@ -826,8 +827,8 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
for(i=0; i<2; i++){
uint8_t ** ref2picture;
if(s->picture_structure == s->field_select[dir][i] + 1
|| s->pict_type == AV_PICTURE_TYPE_B || s->first_field){
if((s->picture_structure == s->field_select[dir][i] + 1
|| s->pict_type == AV_PICTURE_TYPE_B || s->first_field) && ref_picture[0]){
ref2picture= ref_picture;
}else{
ref2picture = s->current_picture_ptr->f.data;
@@ -856,6 +857,9 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
pix_op = s->dsp.avg_pixels_tab;
}
}else{
if (!ref_picture[0]) {
ref_picture = s->current_picture_ptr->f.data;
}
for(i=0; i<2; i++){
mpeg_motion(s, dest_y, dest_cb, dest_cr,
s->picture_structure != i+1,

View File

@@ -34,6 +34,7 @@
#include "avcodec.h"
#include "msrledec.h"
#include "libavutil/imgutils.h"
typedef struct MsrleContext {
AVCodecContext *avctx;
@@ -112,11 +113,14 @@ static int msrle_decode_frame(AVCodecContext *avctx,
/* FIXME how to correctly detect RLE ??? */
if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8;
int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
uint8_t *ptr = s->frame.data[0];
uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
int i, j;
if (linesize < 0)
return linesize;
for (i = 0; i < avctx->height; i++) {
if (avctx->bits_per_coded_sample == 4) {
for (j = 0; j < avctx->width - 1; j += 2) {

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