Commit Graph

69568 Commits

Author SHA1 Message Date
Philip Langdale d20df2601f avcodec/nvenc: De-compensate aspect ratio compensation of DVD-like content.
For reasons we are not privy to, nvidia decided that the nvenc encoder
should apply aspect ratio compensation to 'DVD like' content, assuming that
the content is not bt.601 compliant, but needs to be bt.601 compliant. In
this context, that means that they make the following, questionable,
assumptions:

1) If the input dimensions are 720x480 or 720x576, assume the content has
an active area of 704x480 or 704x576.

2) Assume that whatever the input sample aspect ratio is, it does not account
for the difference between 'physical' and 'active' dimensions.

From, these assumptions, they then conclude that they can 'help', by adjusting
the sample aspect ratio by a factor of 45/44. And indeed, if you wanted to
display only the 704 wide active area with the same aspect ratio as the full
720 wide image - this would be the correct adjustment factor, but what if you
don't? And more importantly, what if you're used to ffmpeg not making this kind
of adjustment at encode time - because none of the other encoders do this!

And, what if you had already accounted for bt.601 and your input had the
correct attributes? Well, it's going to apply the compensation anyway!
So, if you take some content, and feed it through nvenc repeatedly, it
will keep scaling the aspect ratio every time, stretching your video out
more and more and more.

So, clearly, regardless of whether you want to apply bt.601 aspect ratio
adjustments or not, this is not the way to do it. With any other ffmpeg
encoder, you would do it as part of defining your input paramters or
do the adjustment at playback time, and there's no reason by nvenc
should be any different.

This change adds some logic to undo the compensation that nvenc would
otherwise do.

nvidia engineers have told us that they will work to make this
compensation mechanism optional in a future release of the nvenc
SDK. At that point, we can adapt accordingly.

Signed-off-by: Philip Langdale <philipl@overt.org>
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 02:32:33 +01:00
Michael Niedermayer 692b22626e 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>
2015-02-05 00:33:50 +01:00
Michael Niedermayer fd52d2d3d1 avcodec/mpegvideo_motion: Fix gmc chroma dimensions
Fixes integer overflow and out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 00:33:50 +01:00
James Almer 7457afc64d hevcdsp: replace the SAOParams struct parameter from sao_edge_filter
As with sao_band_filter, pass instead the two variables from the struct needed in the function.
This simplifies writing asm optimized versions.

Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-02-04 17:53:04 -03:00
James Almer 121ccc3365 hevcdsp: further simplify sao_edge_filter
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-02-04 17:52:59 -03:00
Seppo Tomperi 4386e1fd94 hevcdsp: simplified sao_edge_filter
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr>
2015-02-04 17:52:54 -03:00
Seppo Tomperi 74d7faf400 hevcdsp: separated sao edge filter and pixel restore funcs
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr>
2015-02-04 17:52:49 -03:00
Michael Niedermayer fabbfaa095 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>
2015-02-04 20:49:12 +01:00
Michael Niedermayer afa92907f3 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 20:14:18 +01:00
Michael Niedermayer 7f02fcd917 avfilter/vf_fps: Do not drop a random subset of frames
This also avoids droping the frame which is closest to the target timestamp

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 18:52:14 +01:00
Hendrik Leppkes b11994593a dxva2_hevc: properly fill the scaling list structure
The scaling list can be specified in either the SPS or PPS.
Additionally, compensate for the diagonal scan permutation applied in the decoder.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 16:31:49 +01:00
Michael Niedermayer 05e1619529 avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 14:55:42 +01:00
Paul B Mahol 9f1a5dbc26 avcodec/cdxl: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 13:40:04 +00:00
Michael Niedermayer 85a8069d23 Merge commit '8c1ce7787ad7af8fc321b4a145e9dc965f6d0e86'
* commit '8c1ce7787ad7af8fc321b4a145e9dc965f6d0e86':
  aacsbr: silence message for SBR extension "padding".

See: 1ac606bae6
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 14:20:32 +01:00
Paul B Mahol 469a170135 avformat/siff: fix if_( style
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 13:10:53 +00:00
Michael Niedermayer ba4fba8f48 Merge commit 'd615187f74ddf3413778a8b5b7ae17255b0df88e'
* commit 'd615187f74ddf3413778a8b5b7ae17255b0df88e':
  aacdec: Support for ER AAC ELD 480.

Conflicts:
	libavcodec/aacdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 13:49:17 +01:00
Michael Niedermayer dd72e26d0c Merge commit '7640c4a371a97899dfb443d980fd0bf8ac587754'
* commit '7640c4a371a97899dfb443d980fd0bf8ac587754':
  aacdec: Tables for length 480 AAC ELD.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 13:40:23 +01:00
Michael Niedermayer f53aa3f4f3 Merge commit '0ee2573347ecdb9cb5656001f7201d819eec16d8'
* commit '0ee2573347ecdb9cb5656001f7201d819eec16d8':
  aacdec: Support for ER AAC in LATM

Conflicts:
	libavcodec/aacdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 13:31:24 +01:00
Michael Niedermayer 5348d7b605 Merge commit 'edd9ea3ffba1d5873dead1c57c74b1e3cc912167'
* commit 'edd9ea3ffba1d5873dead1c57c74b1e3cc912167':
  aacdec: Refactor aac_er_decode_frame.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 13:18:51 +01:00
Stefano Sabatini fd242b468d lavf/utils: fix if_( style 2015-02-04 13:17:30 +01:00
Liviu Oniciuc d2330e5844 doc/muxers/image2: remove the non-negative number requirement for start_number
Update after b37858eae1.
2015-02-04 13:17:30 +01:00
Michael Niedermayer 0afc26d330 Merge commit '82bd8a57692d8f3643ad0903c97e4a0f84393f53'
* commit '82bd8a57692d8f3643ad0903c97e4a0f84393f53':
  aacdec: Refactor decode_ics_info.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 13:09:52 +01:00
Carl Eugen Hoyos adfe89bc48 Fix standalone compilation of the tblend filter. 2015-02-04 11:09:14 +01:00
Paul B Mahol cecc4ea1fc avcodec/evrcdec: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:42 +00:00
Paul B Mahol 63cb546f0a avcodec/wnv1: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:41 +00:00
Paul B Mahol 1634d2bcd1 avcodec/on2avc: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:41 +00:00
Paul B Mahol 49f8257135 avcodec/tak_parser: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:41 +00:00
Paul B Mahol c93a7b264f avcodec/ac3dec: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:41 +00:00
Paul B Mahol e9eb94ac5a avcodec/qcelpdec: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:41 +00:00
Paul B Mahol 6e7ac5ee55 avcodec/webp: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:41 +00:00
Reimar Döffinger 8c1ce7787a aacsbr: silence message for SBR extension "padding".
Some files contain a few additional, all-0 bits.
Check for that case and don't print incorrect "not supported"
message.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
2015-02-03 20:32:16 -08:00
Alex Converse d615187f74 aacdec: Support for ER AAC ELD 480.
Based in part on work from Niel van der Westhuizen <espes@pequalsnp.com>.
2015-02-03 20:32:16 -08:00
Niel van der Westhuizen 7640c4a371 aacdec: Tables for length 480 AAC ELD. 2015-02-03 20:32:16 -08:00
Niel van der Westhuizen 0ee2573347 aacdec: Support for ER AAC in LATM 2015-02-03 20:32:16 -08:00
Alex Converse edd9ea3ffb aacdec: Refactor aac_er_decode_frame. 2015-02-03 20:32:15 -08:00
Alex Converse 82bd8a5769 aacdec: Refactor decode_ics_info. 2015-02-03 20:32:15 -08:00
Michael Niedermayer 77f326dc36 ffmpeg: Make CFR frame drop threshold user adjustable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 02:40:41 +01:00
Christophe Gisquet 52f2adc015 avcodec/hevc: Update the USE_SAO_SMALL_BUFFER case for the alignment requirements in FFmpeg
Use edge emu buffers
And enable the code unconditionally

Speed difference without USE_SAO_SMALL_BUFFER and with the new code:
Decicycles: 26772->26220 (BO32),  83803->80942 (BO64)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 01:54:22 +01:00
Christophe Gisquet 00fe77855b avcodec/hevc: Do not zero is_pcm on allocation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 01:54:13 +01:00
Fabrice Bellard da81cc38e8 avcodec/hevc: reduce memory for SAO
cherry picked from commit 5d9f79edef2c11b915bdac3a025b59a32082f409

SAO edge filter uses pre-SAO pixel data on the left and top of the ctb, so
this data must be kept available. This was done previously by having 2
copies of the frame, one before and one after SAO.

This commit reduces the storage to just that, instead of the previous whole
frame.

Commit message taken from patch by Christophe Gisquet <christophe.gisquet@gmail.com>

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 01:54:01 +01:00
wm4 b737a2c528 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>
2015-02-04 00:55:47 +01:00
wm4 56cc024220 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>
2015-02-04 00:39:56 +01:00
Christophe Gisquet e93d3a22cb x86: lavu/x264asm: fix ymm register instantiation
This mimicks what is done for the other instruction sets.

Tested-by: James Almer <jamrial@gmail.com>
Tested-by: Mickaël Raulet <mraulet@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 00:18:29 +01:00
Michael Niedermayer d304cb49eb Merge commit '898276c16b1683ac77723e97574a3bfdb29507fd'
* commit '898276c16b1683ac77723e97574a3bfdb29507fd':
  r3d: Fix pos type

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 00:04:49 +01:00
Michael Niedermayer bd12634d6b Merge commit 'ec524ed12aa1aeb37125203f1adf5aa10dfcb0de'
* commit 'ec524ed12aa1aeb37125203f1adf5aa10dfcb0de':
  tta: Fix framepos and start_offset types

Conflicts:
	libavformat/tta.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 23:49:14 +01:00
Michael Niedermayer 1dc1c4e7a8 Merge commit 'a6653787a4b1e89170ff7962312dd110769c83a3'
* commit 'a6653787a4b1e89170ff7962312dd110769c83a3':
  libopencv: Check kernel_str life cycle

Conflicts:
	libavfilter/vf_libopencv.c

See: f16a6f667c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 23:35:08 +01:00
Michael Niedermayer 741b56fcee avcodec/svq1dec: Add assert to ensure "stages >= 0"
This is currently always true, the assert protects against
future changes to the code breaking this assumtation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 23:03:38 +01:00
Michael Niedermayer cba3a46e93 Merge commit '9b8c8a9395c849639aea0f6b5300e991e93c3a73'
* commit '9b8c8a9395c849639aea0f6b5300e991e93c3a73':
  svq1dec: Validate the stages value strictly

Not merged, this is wrong, the condition is not possible

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 23:03:19 +01:00
Michael Niedermayer acfb4ede2f Merge commit '6f7a32839d1b913be8170e91c3ac9816b314da21'
* commit '6f7a32839d1b913be8170e91c3ac9816b314da21':
  svq1enc: correctly handle memory error and allocations

Conflicts:
	libavcodec/svq1enc.c

See: 79888388e7
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 22:40:46 +01:00
Michael Niedermayer 94337f8c2d Merge commit '67e9f3907d6d438a413df72d72c1339a0c11a290'
* commit '67e9f3907d6d438a413df72d72c1339a0c11a290':
  isom: Decode Prores 4444 XQ with the existing Prores decoder

See: fe47cba7e8
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 22:29:04 +01:00