Commit Graph

20762 Commits

Author SHA1 Message Date
Andrey Turkin 24b5cff01b lavc: handle hw_frames_ctx where necessary
avcodec_copy_context() didn't handle hw_frames_ctx references correctly
which could cause crashes.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-26 15:40:05 +02:00
Diego Biurrun 4024b566d6 golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names 2016-05-25 16:37:43 +02:00
Diego Biurrun e47b8bbf0b avcodec: Bump micro version after changing public JPEG 2000 defines 2016-05-24 15:47:15 +02:00
Francois Cartegnie ad61da054b jpeg2000: Fix profile define values
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-24 12:22:57 +02:00
Anton Khirnov 2ef6dab0a7 lavc: document that avcodec_close() should not be used
We cannot deprecate it until the new parser API is in place, because of
the way libavformat works. But the majority of the users can already
simply replace it with avcodec_free_context(), which will simplify the
transition once it is finally deprecated.
2016-05-23 06:46:18 +02:00
Anton Khirnov 04fc8e24a0 lavc: deprecate avcodec_get_context_defaults3()
This function is supposed to "reset" a codec context to a clean state so
that it can be opened again. The only reason it exists is to allow using
AVStream.codec as a decoding context (after it was already
opened/used/closed by avformat_find_stream_info()). Since that behaviour
is now deprecated, there is no reason for this function to exist
anymore.
2016-05-23 06:46:17 +02:00
Anton Khirnov 5f30ac2779 lavc: deprecate avcodec_copy_context()
Since AVCodecContext contains a lot of complex state, copying a codec
context is not a well-defined operation. The purpose for which it is
typically used (which is well-defined) is copying the stream parameters
from one codec context to another. That is now possible with through the
AVCodecParameters API. Therefore, there is no reason for
avcodec_copy_context() to exist.
2016-05-23 06:46:17 +02:00
Luca Barbato 74b1bf632f mp3: Make the extrasize explicit
Initialize the bit buffer with the correct size (amount of bits that will
be read) instead of relying on the bitstream reader overreading the
correct values.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-22 23:07:54 +02:00
Diego Biurrun 52567e8198 get_bits: Drop some TRACE-level debug code
It will not be provided by the new bit reader anyway.
2016-05-22 20:22:43 +02:00
Anton Khirnov 3399a26d3f nvenc: allow setting the number of slices
Based on a patch by Agatha Hu <ahu@nvidia.com>
2016-05-19 14:17:04 +02:00
Philip Langdale 10545f84b8 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 lavc 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 lavc
encoder, you would do it as part of defining your input parameters 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: Anton Khirnov <anton@khirnov.net>
2016-05-19 14:17:04 +02:00
Anton Khirnov 9375c97460 nvenc: list the major contributors in the copyright header 2016-05-19 14:17:04 +02:00
Anton Khirnov 6f58b4dc47 nvenc: drop the hard dependency on CUDA
The code needs only a few definitions from cuda.h, so define them
directly when CUDA is not enabled. CUDA is still required for accepting
HW frames as input.

Based on the code by Timo Rothenpieler <timo@rothenpieler.org>.
2016-05-19 14:17:03 +02:00
Anton Khirnov f11ec8cee7 nvenc: only support HW frames when CUDA is enabled
hwcontext_cuda.h includes cuda.h, so this will allow building nvenc
without depending on cuda.h
2016-05-19 14:17:03 +02:00
Anton Khirnov 2156c4c300 nvenc: write the VUI signal properties for HEVC
Bump the API version requirement to 6.

Based on a patch by Agatha Hu <ahu@nvidia.com>.
2016-05-19 14:17:03 +02:00
Anton Khirnov a1df786503 nvenc: only write the VUI signal type fields if they are set
Based on a patch by Agatha Hu <ahu@nvidia.com>.
2016-05-19 14:17:03 +02:00
Timo Rothenpieler cea1fb854c nvenc: Generate bufferingPeriod/pictureTiming SEI
For some unknown reason enabling these causes proper CBR padding,
so as there are no known downsides just always enable them in CBR mode.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-19 14:17:03 +02:00
Timo Rothenpieler a1e215ea01 nvenc: Delay frame output to increase encoding speed
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-19 14:17:01 +02:00
Anton Khirnov 9427d92f40 nvenc: add support for lossless encoding
Based on a patch by Philip Langdale <philipl@overt.org>
2016-05-19 14:08:55 +02:00
Timo Rothenpieler 795329dd4c nvenc: Generate AUD NAL units for better compatiblity
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-19 14:08:30 +02:00
Anton Khirnov e42b9bc894 nvenc: fix the rc option definitions 2016-05-19 14:08:25 +02:00
Derek Buitenhuis d68fb14758 mjpegdec: Properly fail on malloc failure
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-19 13:44:41 +02:00
Anton Khirnov 0d95d88fbd lavc: revert the Makefile part of 330177b
There is no real advantage to listing some codecs or subsystems
separately simply because they are somehow "hw-accelerated", on the
contrary it makes them harder to find than in a plain alphabetically
ordered list.
2016-05-19 13:40:53 +02:00
Alexandra Hájková ffa190d047 Move VLC and RL_VLC_ELEM structure definitions to a separate header
Use the newly created vlc.h directly instead of including get_bits when needed.
The VLC and RL_VLC_ELEM structures are independent from the bitreader.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2016-05-17 10:29:27 +02:00
Alexandra Hájková d338abb664 mpeg4videodec: Call av_log() in check_marker() with AVCodecContext instead of NULL
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-16 10:51:17 +02:00
Alexandra Hájková e4b38878da Move check_marker() from get_bits to mpeg4videodec
MPEG-4 is the only decoder which uses check_marker().

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-05-16 10:51:01 +02:00
Anton Khirnov 31f6a4b4b8 lavc: mark the old audio/video encoding API as deprecated 2016-05-16 10:31:26 +02:00
Anton Khirnov 8996515b13 avpacket: fix setting AVPacket.data in av_packet_ref()
The data field does not necessarily point to the beginning of the
underlying AVBuffer.

CC: libav-stable@libav.org
2016-05-16 10:31:08 +02:00
Anton Khirnov e62ff72fc1 lavc: make avcodec_open2() fail when the timebase is not set for encoding
Many encoders use it. There is also a divide by the timebase lower in
this function, which would crash when it is not set.
2016-05-16 10:30:57 +02:00
Diego Biurrun a6a750c7ef tests: Move all test programs to a subdirectory 2016-05-13 14:55:56 +02:00
Diego Biurrun 257f00ec1a Split global .gitignore file into per-directory files 2016-05-13 14:55:56 +02:00
Diego Biurrun 763d69bfb2 Add some more deprecation guards
Avoids unused function/label/variable warnings after the next version bump.
2016-05-11 12:22:49 +02:00
Diego Biurrun b7e64fba7f Reduce the scope of some variables
This avoids unused variable warnings after the next version bump.
Also drop a trace level av_log() call that is in the way.
2016-05-11 12:21:25 +02:00
Jan Ekström 885a9d6087 pgssub: Fix subpicture colorspace and range
Widen the values from limited to full range and use BT.709 where it
should be used according to the video resolution:

SD is BT.601, HD is BT.709

Default to BT.709 due to most observed HDMV content being HD.
2016-05-10 11:30:25 +02:00
Michael Niedermayer 283226e11c simple_idct_template: Fix strict aliasing violation
This fixes fate-wmv8-intrax8 in certain configurations, e.g.
gcc 4.4.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-10 09:41:07 +03:00
Diego Biurrun 5afb94c817 Mark read-only tables as static 2016-05-05 10:48:34 +02:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Alexandra Hájková 5c31eaa999 Remove unnecessary get_bits.h #includes and add missing headers where needed.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 15:14:14 +02:00
Diego Biurrun c11c693acc h264: Drop broken trace debug output 2016-05-03 15:45:11 +02:00
Diego Biurrun 5f1c3cbd52 vaapi: Drop pointless debug output 2016-05-03 15:45:11 +02:00
Diego Biurrun 015c2d9239 libopencore-amr: Fix ff_dlog()/av_log() invocations 2016-05-03 15:45:10 +02:00
Diego Biurrun 0f40c90984 Drop pointless assert.h #includes 2016-05-03 15:45:10 +02:00
wm4 74beead9bd mmaldec: limit internal buffering
This uses a new MMAL feature, which limits the number of extra frames
that can be buffered within the decoder. VIDEO_MAX_NUM_CALLBACKS can
be defined as positive or negative number. Positive numbers are
absolute, and can lead to deadlocks if the user underestimates the
number of required buffers. Negative numbers specify the number of extra
buffers, e.g. -1 means no extra buffer, (-1-N) means N extra buffers.

Set a gratuitous default of -11 (N=10). This is much lower than the
firmware default, which appears to be 96.

This is backwards compatible, but needs a symbol only present in newer
firmware headers. (It's an enum item, so it requires a check in
configure.)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:31:08 +02:00
wm4 45a954f5aa mmaldec: print the MMAL format FourCC automatically
Slight simplification. The result is the same. Also, change the
wording of the message as requested in patch review.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:29:13 +02:00
wm4 ce589940c2 mmaldec: send only a single EOS packet on flushing
Fixes apparent mmal_port_disable() freezes in ffmmal_stop_decoder() when
calling ffmmal_decode() with flush semantics a large number of times in
a row.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:26:22 +02:00
wm4 46aaad78c3 mmaldec: correct package buffering accounting
The assert in ffmmal_stop_decoder() could trigger sometimes. The
packets_buffered counter was indeed not correctly maintained, and
packets were not subtracted from it if they were still in the waiting
queue.

For some reason, this happened especially with VC-1.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:19:58 +02:00
wm4 9a382f3639 mmaldec: add vc1 decoding support
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:19:53 +02:00
Julian Scheel d52208e8d5 mmaldec: Add mpeg2 decoding support
Register mmaldec as mpeg2 decoder. Supporting mpeg2 in mmaldec is just a
matter of setting the correct MMAL_ENCODING on the input port. To ease the
addition of further supported mmal codecs a macro is introduced to generate
the decoder and decoder class structs.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:11:13 +02:00
Julian Scheel 2689bb115c mmaldec: Fix avpriv_atomic_get usage
There is no avpriv_atomic_get, instead avpriv_atomic_int_get is to be used for
integers. This fixes building mmaldec.

Signed-off-by: Julian Scheel <julian@jusst.de>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:00:58 +02:00
Michael Niedermayer 366ba2dee1 mmaldec: Use av_assert0() instead of assert()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:00:02 +02:00