Commit Graph

34635 Commits

Author SHA1 Message Date
Claudio Freire
aa64a48357 AAC encoder: fix I/S relative error evaluation
The relative error between two encoding strategies is the simple
difference of rate-distortion values, and not the absolute
difference. An absolute measure would allow worsening of the
quantization error as well as improving.
2016-01-13 05:28:34 -03:00
Claudio Freire
6711aa21e2 AAC encoder: various fixes in M/S coding
1. Fix sf_idx and band_type addressing to address only the first
subwindow in the group (others could hold garbage values)

2. Don't step on ms_mask when is_mask is set. I/S selection
already sets the ms_mask properly and shouldn't be overridden.

3. Use mid/sid cb/sf when computing coding error, as should be
since those are the cb/sfs that will eventually be set.

4. Fix distortion computation on multi-subwindow groups (was
subtracting the bits terms multiple times)

5. Clear ms_mask when one side uses PNS and the other doesn't.
When using PNS, ms_mask signals correlated noise, which can be
detected just like regular M/S detection, so we don't skip
noise bands, but when only one side uses PNS setting the flag
can confuse some encoders, so avoid that.
2016-01-13 05:28:34 -03:00
Claudio Freire
4dcb69cc12 AAC encoder: in IS, fix index of sf_idx, band_type
Correct addressing of sf_idx and band_type arrays in I/S code.

Both arrays don't guarantee valid values for subwindows at all
times, depending on which coder is being used, which could result
in reading of garbage values. Instead, only the first subwindow
in the window group has to be used, ie: use w*16+g instead of
(w+w2)*16+g
2016-01-13 05:28:34 -03:00
Claudio Freire
509f168017 AAC encoder: don't apply MS on special bands
Change the condition for application of the M/S transform to match
that of the decoder. Namely, that no special coding books must be
in use in either channel. While the condition ought to be
equivalent to the current one when the invariant of is_mask is
kept, matching the decoder's condition is safer and easier to
maintain.
2016-01-13 05:28:34 -03:00
Claudio Freire
00d481b2c3 AAC encoder: avoid assertion failure on PNS
In rare corner cases it could still fail an assert on sf_diff due
to failure to update prev_sf in some code paths. Fix that case.
2016-01-13 05:28:34 -03:00
Claudio Freire
2a31b076b4 AAC encoder: fix assertion error with prediction
Fixes an assertion error reported in #2686 that happens when
using prediction (either explicitly or implicitly by setting
the AAC main profile), since prediction code would allow
creating new zeroes or removing existing ones, without
properly checking for SF delta violations.

This patch forbids creating/removing zeroes, perhaps an
overly conservative approach, but a safe one. More permissive
and sophisticated approaches may be attempted in the future.
2016-01-13 05:28:34 -03:00
Carl Eugen Hoyos
d3fe2e0dc9 lavc/mjpeg2jpeg: Accept more mjpeg streams as input.
Fixes ticket #5151.
2016-01-13 09:01:29 +01:00
James Zern
1a876cc581 libvpxdec: fix 'ISO C90 forbids mixed declarations and code' warning
since:
cbcc88c libvpx: Support setting color range for vp9.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
2016-01-12 14:30:33 -08:00
Michael Niedermayer
782c4ab4ed avcodec/truemotion2: Cleanup in case of tm2_read_stream() failure
Fixes memleaks
Fixes: 245dae71bc28fe8f3f454300277e575a/signal_sigabrt_7ffff6ae7cb7_5062_f7d9dfa385454806586076f9db48c0bf.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-12 17:23:13 +01:00
Carl Eugen Hoyos
27fa70fdfe lavc/mjpeg2jpeg: Check for jpeg file header. 2016-01-12 16:13:27 +01:00
Michael Niedermayer
7c97946d61 avcodec/mpeg4video: Check time_incr
Fixes assertion failure
Fixes out of memory access

Fixes: test_casex.ivf

Found-by: Tyson Smith <twsmith@mozilla.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-12 03:35:29 +01:00
Andreas Cadhalpun
d637a58750 diracdec: fix idwt_stride calculation in bytes
The transformation to bytes must happen after alignment to get the same
resulting pointers as before.

This fixes segmentation faults in the assembler code.

The regression was introduced in commit 9553689.

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-01-12 00:12:36 +01:00
Ganesh Ajjanagadde
07a11ebcab lavc/cbrt_tablegen: speed up tablegen
This exploits an approach based on the sieve of Eratosthenes, a popular
method for generating prime numbers.

Tables are identical to previous ones.

Tested with FATE with/without --enable-hardcoded-tables.

Sample benchmark (Haswell, GNU/Linux+gcc):
prev:
7860100 decicycles in cbrt_tableinit,       1 runs,      0 skips
7777490 decicycles in cbrt_tableinit,       2 runs,      0 skips
[...]
7582339 decicycles in cbrt_tableinit,     256 runs,      0 skips
7563556 decicycles in cbrt_tableinit,     512 runs,      0 skips

new:
2099480 decicycles in cbrt_tableinit,       1 runs,      0 skips
2044470 decicycles in cbrt_tableinit,       2 runs,      0 skips
[...]
1796544 decicycles in cbrt_tableinit,     256 runs,      0 skips
1791631 decicycles in cbrt_tableinit,     512 runs,      0 skips

Both small and large run count given as this is called once so small run
count may give a better picture, small numbers are fairly consistent,
and there is a consistent downward trend from small to large runs,
at which point it stabilizes to a new value.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2016-01-11 17:20:38 -05:00
Michael Niedermayer
59c915a403 avcodec/wavpackenc: Check the number of channels
They are stored in a byte, thus more than 255 is not possible

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-11 18:58:08 +01:00
Michael Niedermayer
26757b0279 avcodec/wavpackenc: Headers are per channel
Fixes: 1b8b83a53bfa751f01b1daa65a4758db/signal_sigabrt_7ffff6ae7cb7_7488_403f71d1a2565b598d01b6cb110fac8f.aiff
Fixes: assertion failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-11 18:47:33 +01:00
Michael Niedermayer
56ec8f85e2 avcodec/ac3enc: Remove duplicate #include
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-11 01:35:34 +01:00
Michael Niedermayer
590863876d avcodec/aacdec_template: Check id_map
Fixes index out of bounds error
Fixes: aac_index_out_of_bounds.wmv

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-10 19:31:39 +01:00
Michael Niedermayer
93ac72a98d avcodec/dvdec: Fix "left shift of negative value -254"
Fixes: dvdec_left_shift.avi

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-10 17:44:33 +01:00
Michael Niedermayer
030c7f0309 avcodec/g2meet: Check for ff_els_decode_bit() failure in epic_decode_run_length()
Fixes invalid shift
Fixes: g2m_left_shift_2.wmv

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-10 17:23:51 +01:00
Clément Bœsch
6d32628bf3 lavc/ccaption_dec: improve default style
Use monospaced font, and a black box outline.
2016-01-10 16:28:14 +01:00
Michael Niedermayer
d86d7b2486 avcodec/mjpegdec: Fix negative shift
Fixes: mjpeg_left_shift.avi

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-10 15:59:27 +01:00
Carl Eugen Hoyos
f587ed0cbb lavc/x264: Add compatibility values for coder options.
Fixes ticket #5142.
2016-01-10 14:25:56 +01:00
Clément Bœsch
a43deea861 lavc/ccaption_dec: fix ASS tags 2016-01-10 14:07:45 +01:00
Michael Niedermayer
e273dade78 avcodec/mss2: Check for repeat overflow
Fixes: mss2_left_shift.wmv

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-10 12:49:35 +01:00
Michael Niedermayer
42c54d4cc3 avcodec/codec_desc: Add ff_aac_profiles to aac_latm
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-10 04:50:46 +01:00
Sasi Inguva
cbcc88c039 libvpx: Support setting color range for vp9.
Pass through color range to vp9 encoder. Parse color range in libvpxdec.c.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-01-09 12:51:34 -03:00
Clément Bœsch
0948e0f553 lavc/ccaption_dec: simplify rollup cases 2016-01-09 12:44:10 +01:00
Clément Bœsch
22765140fa lavc/ccaption_dec: check for bprint completeness outside the loop 2016-01-09 12:40:50 +01:00
Clément Bœsch
31bff21d2c lavc/ccaption_dec: mark row and font as const in capture_screen() 2016-01-09 12:38:36 +01:00
Clément Bœsch
d587fbb676 lavc/ccaption_dec: fix mixed declarations and code warning 2016-01-09 12:37:30 +01:00
Clément Bœsch
5ae07914d0 lavc/ccaption_dec: check for bprint completeness only at the end 2016-01-09 12:37:11 +01:00
Aman Gupta
b7e64be8fb lavc/ccaption_dec: implement font styles 2016-01-09 12:32:27 +01:00
Aman Gupta
086093c77c lavc/ccaption_dec: simplify by incrementing cursor_column inside write_char() 2016-01-09 12:30:15 +01:00
Aman Gupta
811ce8f9c5 lavc/ccaption_dec: simplify by passing screen into write_char() 2016-01-09 12:29:19 +01:00
Aman Gupta
080de371d8 lavc/ccaption_dec: extract capture_screen() for future use
unlike reap_screen(), capture_screen() can be used to populate buffer
without touching the timestamps. this is useful for upcoming commits
which implement a real time caption stream.
2016-01-09 12:24:49 +01:00
Aman Gupta
e521a32af2 lavc/ccaption_dec: clear buffer before populating with screen contents 2016-01-09 12:23:54 +01:00
Aman Gupta
7def844be8 lavc/ccaption_dec: centralize buffer_changed=1 into reap_screen 2016-01-09 11:54:05 +01:00
Aman Gupta
c75b869516 lavc/ccaption_dec: rename screen_changed to buffer_changed 2016-01-09 11:54:00 +01:00
Aman Gupta
8fd7f03c56 lavc/ccaption_dec: extract ass time base into constant 2016-01-09 11:53:56 +01:00
Aman Gupta
6049b15c0a lavc/ccaption_dec: combine ROLLUP modes as they are identical 2016-01-09 11:53:52 +01:00
Aman Gupta
2693275c02 Revert "lavc/ccaption_dec: reap_screen() is responsible for clearing output buffer and signaling screen_changed"
This reverts commit 53ee84f811.
2016-01-09 11:53:47 +01:00
Aman Gupta
578b911b5e Revert "lavc/ccaption_dec: implement "erase non displayed memory""
This reverts commit 26abdd61a3.
2016-01-09 11:53:40 +01:00
Aman Gupta
23a50c8ab9 Revert "lavc/ccaption_dec: reap_screen is not necessary when clearing screen or buffer"
This reverts commit fe225b113b.
2016-01-09 11:53:37 +01:00
Carl Eugen Hoyos
836c793514 lavc/libvpxenc: Improve documentation for option cpu-used.
Fixes ticket #5140.
Reviewed-by: James Zern
2016-01-09 10:53:22 +01:00
Aman Gupta
fe225b113b lavc/ccaption_dec: reap_screen is not necessary when clearing screen or buffer 2016-01-08 20:39:55 +01:00
Aman Gupta
26abdd61a3 lavc/ccaption_dec: implement "erase non displayed memory" 2016-01-08 20:24:49 +01:00
Aman Gupta
53ee84f811 lavc/ccaption_dec: reap_screen() is responsible for clearing output buffer and signaling screen_changed
moves the screen_changed bit and the bprint_clear into reap_screen() so
the logic is centralized and callers do not need to touch the bit or the
buffer before calling reap_screen()
2016-01-08 20:23:47 +01:00
Aman Gupta
5695c85332 lavc/ccaption_dec: remove unused return value from internal functions 2016-01-08 20:07:00 +01:00
Aman Gupta
b261749f70 lavc/ccaption_dec: clean up whitespace 2016-01-08 20:06:31 +01:00
James Almer
28d5a3a74a lavu: rename and move ff_parity to av_parity
av_popcount is not defined in intmath.h.

Reviewed-by: ubitux
Signed-off-by: James Almer <jamrial@gmail.com>
2016-01-07 20:04:24 -03:00