5 years agocheckasm: Add tests for h264 idct
Martin Storsjö [Sat, 11 Jun 2016 11:17:37 +0000 (14:17 +0300)]
checkasm: Add tests for h264 idct

The tests are inspired by similar tests for vp9 by
Ronald Bultje.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 years agomov: Support prores with multiple stsd
Vittorio Giovara [Thu, 9 Jun 2016 22:55:19 +0000 (18:55 -0400)]
mov: Support prores with multiple stsd

This function needs to return false, or data in the additional tables
will be skipped, and the decoder will not be able to decode frames
associated with them.

5 years agomov: Implement support for multiple sample description tables
Vittorio Giovara [Wed, 15 Jun 2016 19:24:30 +0000 (15:24 -0400)]
mov: Implement support for multiple sample description tables

Store data from each stsd in a separate extradata buffer, keep track of
the stsc index for read and seek operations, switch buffers when the
index differs. Decoder is notified with an AV_PKT_DATA_NEW_EXTRADATA
packet side data.

Since H264 supports this notification, and can be reset midstream, enable
this feature only for multiple avcC's. All other stsd types (such as
hvc1 and hev1) need decoder-side changes, so they are left disabled for

This is implemented only in non-fragmented MOVs.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
5 years agoh264: Support AV_PKT_DATA_NEW_EXTRADATA
Vittorio Giovara [Thu, 9 Jun 2016 22:55:17 +0000 (18:55 -0400)]

5 years agolavc: Document AV_PKT_DATA_NEW_EXTRADATA
Vittorio Giovara [Thu, 9 Jun 2016 22:55:16 +0000 (18:55 -0400)]

5 years agox86: Add missing movsxd for the int stride parameter
Martin Storsjö [Sat, 11 Jun 2016 19:06:16 +0000 (22:06 +0300)]
x86: Add missing movsxd for the int stride parameter

Signed-off-by: Martin Storsjö <martin@martin.st>
5 years agoavdevice: Ignore timefilter test program
Diego Biurrun [Mon, 13 Jun 2016 12:50:38 +0000 (12:50 +0000)]
avdevice: Ignore timefilter test program

5 years agoLICENSE: Fix silly typo
Diego Biurrun [Mon, 13 Jun 2016 16:11:49 +0000 (18:11 +0200)]
LICENSE: Fix silly typo

5 years agoh264: Drop unused function check_opcodes()
Diego Biurrun [Mon, 13 Jun 2016 16:14:41 +0000 (18:14 +0200)]
h264: Drop unused function check_opcodes()

5 years agoavpacket: Error out when creating 0-sized side data
Vittorio Giovara [Thu, 9 Jun 2016 22:35:03 +0000 (18:35 -0400)]
avpacket: Error out when creating 0-sized side data

This mimics the behaviour of other av_*_new_side_data().
This is not caught by the malloc check, since padding
is always added to the allocated size.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
5 years agopixdesc: Use C99 array to list color properties names
Vittorio Giovara [Wed, 1 Jun 2016 20:13:17 +0000 (16:13 -0400)]
pixdesc: Use C99 array to list color properties names

5 years agoh264: Fix decoding delay for Intra only streams
Anton Mitrofanov [Sun, 8 May 2016 11:28:00 +0000 (13:28 +0200)]
h264: Fix decoding delay for Intra only streams

Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 years agolavc: add H.264 MVC profiles
Anton Khirnov [Sat, 14 May 2016 15:15:46 +0000 (17:15 +0200)]
lavc: add H.264 MVC profiles

5 years agoh264: factor out setting the parameter sets for a frame
Anton Khirnov [Thu, 12 May 2016 12:37:35 +0000 (14:37 +0200)]
h264: factor out setting the parameter sets for a frame

5 years agoh264: pass just the PPS to get_chroma_qp()
Anton Khirnov [Thu, 12 May 2016 12:25:52 +0000 (14:25 +0200)]
h264: pass just the PPS to get_chroma_qp()

It does not need the whole context. This will simplify the following

5 years agoh264: merge the two reinit blocks in slice_header_parse()
Anton Khirnov [Tue, 10 May 2016 11:34:59 +0000 (13:34 +0200)]
h264: merge the two reinit blocks in slice_header_parse()

The only difference is that the first of them contains a
ff_h264_flush_change() call. While that is not necessary in the second
block, it should cause no problems either.

Reduce the verbosity of the reinit log message from info to verbose,
since now it will be displayed during every decode session.

5 years agoh264: factor starting a new field out of parsing the slice header
Anton Khirnov [Mon, 9 May 2016 13:58:32 +0000 (15:58 +0200)]
h264: factor starting a new field out of parsing the slice header

5 years agoh264: postpone generating the implicit MMCOs
Anton Khirnov [Mon, 9 May 2016 12:25:56 +0000 (14:25 +0200)]
h264: postpone generating the implicit MMCOs

Do it right before the MMCOs are applied to the DPB. This will allow
moving the frame_start() call out of the slice header parsing, since
generating the implicit MMCOs needs to be done after frame_start().

5 years agoh264: decode the MMCOs into per-slice contexts
Anton Khirnov [Mon, 9 May 2016 11:48:01 +0000 (13:48 +0200)]
h264: decode the MMCOs into per-slice contexts

They are stored in the slice header, so technically they are per-slice
(though they must be the same in every slice). This will simplify the
following commits.

5 years agoh264: rename mmco_index to nb_mmco
Anton Khirnov [Mon, 9 May 2016 07:30:10 +0000 (09:30 +0200)]
h264: rename mmco_index to nb_mmco

The variable stores the number of mmco entries, so the current name is

5 years agoh264: move initializing the slice start out of h264_slice_header_parse()
Anton Khirnov [Sat, 16 Apr 2016 01:20:37 +0000 (03:20 +0200)]
h264: move initializing the slice start out of h264_slice_header_parse()

5 years agoh264: move calculating the POC out of h264_slice_header_parse()
Anton Khirnov [Thu, 14 Apr 2016 18:53:59 +0000 (20:53 +0200)]
h264: move calculating the POC out of h264_slice_header_parse()

This function does not do any bitstream parsing and it depends on the
current frame being allocated, so this will allow the frame_start() to
be moved out eventually.

5 years agoh264: move building the reference list out of h264_slice_header_parse()
Anton Khirnov [Thu, 14 Apr 2016 18:53:59 +0000 (20:53 +0200)]
h264: move building the reference list out of h264_slice_header_parse()

This does not do any bitstream parsing and will allow moving out other
code in later commits.

5 years agoh264: move initing the implicit pred weight table out of h264_slice_header_parse()
Anton Khirnov [Thu, 14 Apr 2016 18:53:59 +0000 (20:53 +0200)]
h264: move initing the implicit pred weight table out of h264_slice_header_parse()

It depends on the reference list, so this will allow moving out the
reference list construction and consequently other code it depends on.

5 years agoh264: split reading the ref list modifications and actually building the ref list
Anton Khirnov [Fri, 15 Apr 2016 14:10:21 +0000 (16:10 +0200)]
h264: split reading the ref list modifications and actually building the ref list

This will allow postponing the reference list construction (and by
consequence some other functions, like frame_start) until the whole
slice header has been parsed.

5 years agoh264: move initialising the implicit pred weight table for MBAFF
Anton Khirnov [Fri, 15 Apr 2016 13:02:33 +0000 (15:02 +0200)]
h264: move initialising the implicit pred weight table for MBAFF

Do it where the normal implicit table is initialised.

5 years agoh264: call ff_h264_fill_mbaff_ref_list() when constructing the normal ref list
Anton Khirnov [Fri, 15 Apr 2016 13:00:29 +0000 (15:00 +0200)]
h264: call ff_h264_fill_mbaff_ref_list() when constructing the normal ref list

There is no real reason to call it separately.

5 years agoh264: move initialising the explicit pred weight table for MBAFF
Anton Khirnov [Fri, 15 Apr 2016 12:45:48 +0000 (14:45 +0200)]
h264: move initialising the explicit pred weight table for MBAFF

Currently it's done in the code that initialises the ref list for
MBAFF, which is not a logical place for it. Move it to the function that
parses the pred table from the bitstream, which is analogous to what is
done for the implicit weight table as well.

5 years agoh264: drop an outdated comment
Anton Khirnov [Thu, 14 Apr 2016 18:59:20 +0000 (20:59 +0200)]
h264: drop an outdated comment

5 years agoh264: move direct mode inits out of h264_slice_header_parse()
Anton Khirnov [Thu, 14 Apr 2016 18:53:59 +0000 (20:53 +0200)]
h264: move direct mode inits out of h264_slice_header_parse()

This code does not do any bitstream parsing, it just initializes some
internal state.

5 years agoh264: start splitting decode_slice_header()
Anton Khirnov [Wed, 13 Apr 2016 15:53:50 +0000 (17:53 +0200)]
h264: start splitting decode_slice_header()

That function is currently very long and entangles bitstream parsing and
decoder configuration. This makes the code much harder to read than

Begin splitting the code that configures the decoder state based on the
slice header information from the parsing of the slice header.

5 years agovaapi_h265: cu_qp_delta should not be used in constant-QP mode
Mark Thompson [Tue, 31 May 2016 09:21:19 +0000 (10:21 +0100)]
vaapi_h265: cu_qp_delta should not be used in constant-QP mode

5 years agovaapi_h264: Add source version identifier as unregistered SEI
Mark Thompson [Wed, 18 May 2016 09:19:07 +0000 (10:19 +0100)]
vaapi_h264: Add source version identifier as unregistered SEI

Contains the libavcodec version, the VAAPI version and the libva
driver vendor string.

5 years agovaapi_h264: Add support for SEI messages
Mark Thompson [Tue, 17 May 2016 14:52:58 +0000 (15:52 +0100)]
vaapi_h264: Add support for SEI messages

Send buffering_period and pic_timing messages when in modes
targetting bitrate.  Also adds NAL HRD parameters to VUI.

5 years agovaapi_encode: Add support for writing arbitrary additional packed headers
Mark Thompson [Sat, 9 Apr 2016 15:48:27 +0000 (16:48 +0100)]
vaapi_encode: Add support for writing arbitrary additional packed headers

5 years agovaapi_h264: Add support for VUI parameters
Mark Thompson [Tue, 17 May 2016 14:14:57 +0000 (15:14 +0100)]
vaapi_h264: Add support for VUI parameters

Supports aspect ratio, colour format and timing information.

5 years agoh264: drop unused H264Context.gb
Anton Khirnov [Thu, 9 Jun 2016 08:29:55 +0000 (10:29 +0200)]
h264: drop unused H264Context.gb

Signed-off-by: Diego Biurrun <diego@biurrun.de>
5 years agoDrop unnecessary golomb.h #includes
Diego Biurrun [Tue, 7 Jun 2016 16:02:34 +0000 (18:02 +0200)]
Drop unnecessary golomb.h #includes

5 years agoDrop unnecessary unary.h #includes
Diego Biurrun [Tue, 7 Jun 2016 15:18:14 +0000 (17:18 +0200)]
Drop unnecessary unary.h #includes

5 years agodvbsub_parser: Add missing mem.h #include
Diego Biurrun [Tue, 7 Jun 2016 14:35:18 +0000 (16:35 +0200)]
dvbsub_parser: Add missing mem.h #include

5 years agogsm: Move requant_tab table to the gsm tables file
Diego Biurrun [Sat, 4 Jun 2016 14:53:54 +0000 (16:53 +0200)]
gsm: Move requant_tab table to the gsm tables file

This avoids duplicating the table in the gsm template file.
Also adjust the table type to uint8_t to save space.

5 years agompc: Drop unused GetBitContext context member
Diego Biurrun [Sat, 4 Jun 2016 15:13:39 +0000 (17:13 +0200)]
mpc: Drop unused GetBitContext context member

5 years agosvq1enc: Drop unused GetBitContext context member
Diego Biurrun [Sat, 4 Jun 2016 15:12:41 +0000 (17:12 +0200)]
svq1enc: Drop unused GetBitContext context member

5 years agovorbis: Kill some pointless debug code
Diego Biurrun [Sat, 4 Jun 2016 06:41:15 +0000 (08:41 +0200)]
vorbis: Kill some pointless debug code

5 years agomss2: Drop a silly assert
Diego Biurrun [Sat, 4 Jun 2016 10:58:11 +0000 (12:58 +0200)]
mss2: Drop a silly assert

5 years agoget_bits: Move BITSTREAM_READER_LE definition before all relevant #includes
Diego Biurrun [Sat, 4 Jun 2016 13:07:30 +0000 (15:07 +0200)]
get_bits: Move BITSTREAM_READER_LE definition before all relevant #includes

This avoids the danger that get_bits.h might get indirectly #included before

Also sort headers into canonical order where appropriate.

5 years agoindeo2: Drop disabled big-endian ir2_codes table
Diego Biurrun [Sat, 4 Jun 2016 15:04:45 +0000 (17:04 +0200)]
indeo2: Drop disabled big-endian ir2_codes table

Only the little-endian variant of the table is ever used.

5 years agoRemove unnecessary get_bits.h #includes
Diego Biurrun [Sat, 4 Jun 2016 09:45:16 +0000 (11:45 +0200)]
Remove unnecessary get_bits.h #includes

5 years agosgirledec: simplify, no need to use reget buffer
Paul B Mahol [Wed, 1 Jun 2016 19:10:42 +0000 (15:10 -0400)]
sgirledec: simplify, no need to use reget buffer

Signed-off-by: Paul B Mahol <onemda@gmail.com>
5 years agoaic: add frame threading support
Paul B Mahol [Wed, 1 Jun 2016 19:46:49 +0000 (15:46 -0400)]
aic: add frame threading support

Signed-off-by: Paul B Mahol <onemda@gmail.com>
5 years agofate: Move Canopus decoder tests to a separate file
Vittorio Giovara [Fri, 3 Jun 2016 18:09:18 +0000 (14:09 -0400)]
fate: Move Canopus decoder tests to a separate file

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
5 years agoavconv: Do not copy extradata if source buffer is empty
Vittorio Giovara [Fri, 3 Jun 2016 16:14:50 +0000 (12:14 -0400)]
avconv: Do not copy extradata if source buffer is empty

Fixes clang-usan runtime error "null pointer passed as argument 2,
which is declared to never be null" while streamcopying.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
5 years agovp9: Return the correct size when decoding a superframe
Denis Charmet [Sat, 4 Jun 2016 11:22:42 +0000 (13:22 +0200)]
vp9: Return the correct size when decoding a superframe

According to avcodec.h, avcodec_decode_video2 should return the number of
bytes used if a frame was decoded.

The current implementation returns size - used size of all the subframes.
This fixes the VLC's bug https://trac.videolan.org/vlc/ticket/16836.

The superframe is always fully consumed.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
5 years agobuild: Only enable symbol reduction if the compiler does proper DCE
Diego Biurrun [Fri, 27 May 2016 18:14:21 +0000 (20:14 +0200)]
build: Only enable symbol reduction if the compiler does proper DCE

With compilers that do not support proper dead code elimination, like
Sun C 5.12, linking fails due to missing references to unavailable,
but also unused, symbols.

Bug-Id: 895

5 years agobuild: Simplify postprocessing of linker version script files
Diego Biurrun [Fri, 27 May 2016 09:38:38 +0000 (11:38 +0200)]
build: Simplify postprocessing of linker version script files

Generate the files in a single postprocessing step w/o intermediate files.

5 years agobuild: Change structure of the linker version script templates
Diego Biurrun [Tue, 24 May 2016 00:18:40 +0000 (02:18 +0200)]
build: Change structure of the linker version script templates

Split version files into one line per symbol/directive to allow compatibility
with the Solaris linker without preprocessing and eliminate $ from version file
templates to simplify the postprocessing shell command.

5 years agobuild: Print a message when generating version scripts
Diego Biurrun [Tue, 24 May 2016 10:39:54 +0000 (12:39 +0200)]
build: Print a message when generating version scripts

5 years agoasm: FF_-prefix internal macros used in inline assembly
Diego Biurrun [Wed, 25 May 2016 11:34:12 +0000 (13:34 +0200)]
asm: FF_-prefix internal macros used in inline assembly

These warnings conflict with system macros on Solaris, producing
truckloads of warnings about macro redefinition.

5 years agoDrop unnecessary libavutil/x86/asm.h #includes
Diego Biurrun [Tue, 24 May 2016 18:06:03 +0000 (20:06 +0200)]
Drop unnecessary libavutil/x86/asm.h #includes

5 years agoac3: Check the array bound before dereferencing
Luca Barbato [Thu, 26 May 2016 00:41:25 +0000 (02:41 +0200)]
ac3: Check the array bound before dereferencing

CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
5 years agovaapi_h264: Add trivial support for low-power encoding
Mark Thompson [Tue, 17 May 2016 22:08:57 +0000 (23:08 +0100)]
vaapi_h264: Add trivial support for low-power encoding

Experimental; requires Skylake and VAAPI 0.39.1 (not yet released).
Also increases the allowed range of the quality option - in low-power
mode, the Intel driver supports levels 1-8 (and 0 meaning default).

5 years agovaapi_h264: Fix frame_num after non-reference frames
Mark Thompson [Mon, 16 May 2016 13:01:31 +0000 (14:01 +0100)]
vaapi_h264: Fix frame_num after non-reference frames

Non-reference frames (nal_ref_idc == 0) should be discardable, so
frame_num does not advance after them.  Before this change, a stream
containing unreferenced B-frames would be rejected by the reference

5 years agovaapi_encode: Check config attributes before creating config
Mark Thompson [Wed, 18 May 2016 09:58:56 +0000 (10:58 +0100)]
vaapi_encode: Check config attributes before creating config

This prevents attempts to use unsupported modes, such as low-power
H.264 mode on non-Skylake targets.  Also fixes a crash on invalid
configuration, when trying to destroy an invalid VA config/context.

5 years agobuild: Ignore generated mapfile and remove it on distclean
Diego Biurrun [Tue, 24 May 2016 10:16:52 +0000 (12:16 +0200)]
build: Ignore generated mapfile and remove it on distclean

5 years agoFATE: drop the audio stream from the dxtory test
Anton Khirnov [Tue, 24 May 2016 20:20:45 +0000 (22:20 +0200)]
FATE: drop the audio stream from the dxtory test

This is a video test and there are no audio packets in the sample

5 years agoavconv: fix parsing bitstream filters
Anton Khirnov [Tue, 24 May 2016 14:49:19 +0000 (16:49 +0200)]
avconv: fix parsing bitstream filters

The current code modifies the user-supplied string, which is shared for
the whole output file. So a bitstream filter specification applied to
multiple streams would not work correctly.

5 years agoavconv: fix a check for av_bsf_get_by_name() return value
Anton Khirnov [Tue, 24 May 2016 14:36:16 +0000 (16:36 +0200)]
avconv: fix a check for av_bsf_get_by_name() return value

5 years agoavconv_vaapi: use the hwcontext device creation API
Anton Khirnov [Thu, 19 May 2016 17:08:06 +0000 (19:08 +0200)]
avconv_vaapi: use the hwcontext device creation API

5 years agoavconv_dxva2: use the hwcontext device creation API
Anton Khirnov [Thu, 19 May 2016 17:08:06 +0000 (19:08 +0200)]
avconv_dxva2: use the hwcontext device creation API

5 years agoavconv_vdpau: use the hwcontext device creation API
Anton Khirnov [Thu, 19 May 2016 17:08:06 +0000 (19:08 +0200)]
avconv_vdpau: use the hwcontext device creation API

5 years agohwcontext_vaapi: implement device creation
Anton Khirnov [Thu, 19 May 2016 17:19:20 +0000 (19:19 +0200)]
hwcontext_vaapi: implement device creation

5 years agohwcontext_dxva2: implement device creation
Anton Khirnov [Thu, 19 May 2016 17:19:20 +0000 (19:19 +0200)]
hwcontext_dxva2: implement device creation

5 years agohwcontext_cuda: implement device creation
Anton Khirnov [Thu, 19 May 2016 17:19:20 +0000 (19:19 +0200)]
hwcontext_cuda: implement device creation

5 years agohwcontext_vdpau: implement device creation
Anton Khirnov [Thu, 19 May 2016 14:33:15 +0000 (16:33 +0200)]
hwcontext_vdpau: implement device creation

5 years agohwcontext: add a function for opening devices
Anton Khirnov [Thu, 19 May 2016 13:59:25 +0000 (15:59 +0200)]
hwcontext: add a function for opening devices

5 years agolavc: handle hw_frames_ctx where necessary
Andrey Turkin [Wed, 25 May 2016 11:16:14 +0000 (14:16 +0300)]
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>
5 years agogolomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names
Diego Biurrun [Mon, 23 May 2016 23:20:34 +0000 (01:20 +0200)]
golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names

5 years agofate: More fine-grained dependencies for demuxer tests
Diego Biurrun [Mon, 23 May 2016 20:15:43 +0000 (22:15 +0200)]
fate: More fine-grained dependencies for demuxer tests

5 years agofate: More fine-grained dependencies for voice codec tests
Diego Biurrun [Mon, 23 May 2016 20:15:10 +0000 (22:15 +0200)]
fate: More fine-grained dependencies for voice codec tests

5 years agortsp: Use avcodec_descriptor_get instead of avcodec_find_decoder
Martin Storsjö [Tue, 24 May 2016 08:20:28 +0000 (11:20 +0300)]
rtsp: Use avcodec_descriptor_get instead of avcodec_find_decoder

This is only used for logging a human readable codec name for

Signed-off-by: Martin Storsjö <martin@martin.st>
5 years agoavcodec: Bump micro version after changing public JPEG 2000 defines
Diego Biurrun [Tue, 24 May 2016 10:32:01 +0000 (12:32 +0200)]
avcodec: Bump micro version after changing public JPEG 2000 defines

5 years agojpeg2000: Fix profile define values
Francois Cartegnie [Mon, 23 May 2016 12:12:15 +0000 (14:12 +0200)]
jpeg2000: Fix profile define values

Signed-off-by: Diego Biurrun <diego@biurrun.de>
5 years agoavfiltergraph: check the query_formats() return value
Anton Khirnov [Sun, 22 May 2016 08:46:19 +0000 (10:46 +0200)]
avfiltergraph: check the query_formats() return value

5 years agolavc: document that avcodec_close() should not be used
Anton Khirnov [Sat, 21 May 2016 10:05:38 +0000 (12:05 +0200)]
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.

5 years agolavc: deprecate avcodec_get_context_defaults3()
Anton Khirnov [Sat, 21 May 2016 09:57:28 +0000 (11:57 +0200)]
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

5 years agolavc: deprecate avcodec_copy_context()
Anton Khirnov [Sat, 21 May 2016 09:46:44 +0000 (11:46 +0200)]
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.

5 years agolavf: update muxing doxy
Anton Khirnov [Sat, 21 May 2016 09:41:37 +0000 (11:41 +0200)]
lavf: update muxing doxy

Describe the new AVCodecParameters API.

5 years agomp3: Make the extrasize explicit
Luca Barbato [Tue, 19 Apr 2016 04:35:53 +0000 (06:35 +0200)]
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>
5 years agoget_bits: Drop some TRACE-level debug code
Diego Biurrun [Sat, 21 May 2016 11:31:24 +0000 (13:31 +0200)]
get_bits: Drop some TRACE-level debug code

It will not be provided by the new bit reader anyway.

5 years agodump: Drop unused variable
Diego Biurrun [Sat, 21 May 2016 11:41:19 +0000 (13:41 +0200)]
dump: Drop unused variable

5 years agoavconv: Use more precise deprecation ifdefs
Diego Biurrun [Sat, 21 May 2016 11:49:46 +0000 (13:49 +0200)]
avconv: Use more precise deprecation ifdefs

This fixes compilation with the libavcodec version bumped to 58.

5 years agoavconv: stop using AVStream.codec
Anton Khirnov [Sat, 21 May 2016 09:37:33 +0000 (11:37 +0200)]
avconv: stop using AVStream.codec

It is now only used by the av_parser_change() call during streamcopy, so
allocate a special AVCodecContext instance for this case. This instance
should go away when the new parser API is finished.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
5 years agonvenc: allow setting the number of slices
Anton Khirnov [Sat, 14 May 2016 14:47:55 +0000 (16:47 +0200)]
nvenc: allow setting the number of slices

Based on a patch by Agatha Hu <ahu@nvidia.com>

5 years agonvenc: De-compensate aspect ratio compensation of DVD-like content.
Philip Langdale [Wed, 28 Jan 2015 17:05:53 +0000 (09:05 -0800)]
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,

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>
5 years agonvenc: list the major contributors in the copyright header
Anton Khirnov [Fri, 13 May 2016 07:43:51 +0000 (09:43 +0200)]
nvenc: list the major contributors in the copyright header

5 years agoconfigure: Don't require nonfree for nvenc
Timo Rothenpieler [Sat, 23 Apr 2016 16:55:51 +0000 (18:55 +0200)]
configure: Don't require nonfree for nvenc

As the nvEncodeApi.h header is now MIT licensed, this can be dropped.
The loaded CUDA and NVENC libraries are part of the nvidia driver, and
thus count as system libraries.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 years agonvenc: drop the hard dependency on CUDA
Anton Khirnov [Fri, 13 May 2016 07:13:47 +0000 (09:13 +0200)]
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>.

5 years agonvenc: only support HW frames when CUDA is enabled
Anton Khirnov [Fri, 13 May 2016 07:05:25 +0000 (09:05 +0200)]
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

5 years agonvenc: write the VUI signal properties for HEVC
Anton Khirnov [Thu, 12 May 2016 07:22:29 +0000 (09:22 +0200)]
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>.

5 years agonvenc: only write the VUI signal type fields if they are set
Anton Khirnov [Thu, 12 May 2016 07:20:19 +0000 (09:20 +0200)]
nvenc: only write the VUI signal type fields if they are set

Based on a patch by Agatha Hu <ahu@nvidia.com>.