Commit Graph

81214 Commits

Author SHA1 Message Date
Burt P d574e22659 af_hdcd: Process stereo channels together, fix #5727
Issue #5727: gain adjustment should only be applied if matching
gain value from a valid packet in both channels. The existing functions process
each channel separately, so it was not possible.

* New versions of hdcd_process(), hdcd_scan(), hdcd_integrate() named
  hdcd_*_stereo() that process both channels together.
* target_gain applied will be the last matching target_gain.
* The old single channel functions remain as an option. They can be
  used by: -af hdcd=process_stereo=0.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-01 23:57:55 +02:00
James Almer 517dd04f6d Merge commit 'bc7f4268514624e1286ea76d27a89a56b4ee18e1'
* commit 'bc7f4268514624e1286ea76d27a89a56b4ee18e1':
  h264: drop tests whether the codec id is AV_CODEC_ID_H264

Conflicts:
libavcodec/h264dec.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 18:15:07 -03:00
James Almer fd4eb56528 Merge commit '8281cd5cb80582d668ce0848e0e035b383f161f6'
* commit '8281cd5cb80582d668ce0848e0e035b383f161f6':
  h264_cabac: drop an always true condition

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 16:46:57 -03:00
James Almer f41048f6ec Merge commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c'
* commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c':
  h264: add H264_ prefix to the NAL unit types

Conflicts:
libavcodec/h264_parse.c
libavcodec/h264_parser.c
libavcodec/h264_slice.c
libavcodec/h264dec.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 15:11:05 -03:00
Burt P 12759cc034 af_hdcd: Move code detect/check into own function
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-01 19:48:32 +02:00
Burt P b90d0ab4be af_hdcd: add force_pe filter option
Used to attempt replication of some results from
http://www.audiomisc.co.uk/HFN/HDCD/Examined.html
May not be generally useful, defaults to off.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-01 19:48:28 +02:00
Burt P 6517177d97 af_hdcd: Improve error detection logging
* Moves the filter context member out of state and into HDCDContext
* More useful information when an error is detected
* Gives a location near where the error was detected

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-01 19:48:24 +02:00
Burt P bbf0b4fa88 MAINTAINERS: Add myself for af_hdcd
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-01 19:47:54 +02:00
James Almer 4c121ad546 Merge commit '1cf2f3d334f52849aae2be868bad1e5fa5f59aa0'
* commit '1cf2f3d334f52849aae2be868bad1e5fa5f59aa0':
  h264_sei: drop an unnecessary h264dec.h include

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 13:04:30 -03:00
James Almer 7c8bf2dc2b Merge commit 'b24dafe10572254ff0decc18b0d7c3d3707d5a29'
* commit 'b24dafe10572254ff0decc18b0d7c3d3707d5a29':
  lavc: drop unnecessary h264dec.h includes

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 13:03:15 -03:00
James Almer 9ee1f03365 Merge commit '70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4'
* commit '70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4':
  h264: tighten the valid range for ref_frame_count

Conflicts:
libavcodec/h264_ps.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 13:02:20 -03:00
James Almer 8c7932884d Merge commit 'f638b67e5790735f34620bf82025c9b9d6fc7216'
* commit 'f638b67e5790735f34620bf82025c9b9d6fc7216':
  h264: move the parameter set definitions to a new header file

Conflicts:
libavcodec/h264_parse.h
libavcodec/h264_ps.c
libavcodec/h264dec.h

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 12:58:09 -03:00
Michael Niedermayer 77b0f3f26d avcodec/vp9_parser: Check the input frame sizes for being consistent
Suggested-by: BBB
Fixed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-01 17:05:51 +02:00
Timothy Gu fd2cde0234 Doxygen: Re-enable JAVADOC_AUTOBRIEF 2016-07-31 20:56:23 -07:00
Timothy Gu 04da20e58f dynarray: Change AV_ to FF_ for AV_DYNARRAY_ADD
The header is not installed and the macro isn't used outside libavutil,
so it is obviously privat to libavutil. Make the name reflect that.
2016-07-31 10:19:03 -07:00
Michael Bradshaw c9ae8be5a8 avformat/matroskaenc: fix Voids with size < 10
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-31 16:59:49 +02:00
Burt P 390eea61be af_hdcd: give cdt expired counter a value for never set
The counter is now -1 if the code detect timer was never set,
and 0 if it was set but never expired.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-31 16:36:22 +02:00
Burt P 999c6b1da8 af_hdcd: fix a minor cosmetic annoyance
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-31 16:36:08 +02:00
Timothy Gu cebad64d4f Doxyfile: Reset unused options back to default
Silences a few warnings.
2016-07-30 19:52:28 -07:00
Timothy Gu 5522da9ee1 doxygen: Remove outdated EXPAND_AS_DEFINED 2016-07-30 19:52:24 -07:00
Alexey Tourbin 906ee41141 avfilter/af_stereowiden: fix read/write past the end of buffer
The stereowiden filter uses a buffer, s->buffer[], and a pointer
within the buffer, s->write, to implement inter-channel delays.
The loop which applies the delayed samples turns out to be faulty.

   109      for (n = 0; n < in->nb_samples; n++, src += 2, dst += 2) {
   110          const float left = src[0], right = src[1];
   111          float *read = s->write + 2;
   112
   113          if (read > s->buffer + s->length)
   114              read = s->buffer;
   115
   116          dst[0] = drymix * left - crossfeed * right - feedback * read[1];
   117          dst[1] = drymix * right - crossfeed * left - feedback * read[0];
   118
   119          s->write[0] = left;
   120          s->write[1] = right;
   121
   122          if (s->write == s->buffer + s->length)
   123              s->write = s->buffer;
   124          else
   125              s->write += 2;
   126      }

For one, the buffer gets written past its end in lines 119-120, before
the bound check is done in lines 122-123.  This can be easily confirmed
by valgrind.

==3544== Invalid read of size 4
==3544==    at 0x593B41: filter_frame (af_stereowiden.c:116)
==3544==  Address 0xb1b03c4 is 4 bytes after a block of size 7,680 alloc'd
==3544==
==3544== Invalid read of size 4
==3544==    at 0x593B66: filter_frame (af_stereowiden.c:117)
==3544==  Address 0xb1b03c0 is 0 bytes after a block of size 7,680 alloc'd
==3544==
==3544== Invalid write of size 4
==3544==    at 0x593B79: filter_frame (af_stereowiden.c:119)
==3544==  Address 0xb1b03c0 is 0 bytes after a block of size 7,680 alloc'd
==3544==
==3544== Invalid write of size 4
==3544==    at 0x593B7D: filter_frame (af_stereowiden.c:120)
==3544==  Address 0xb1b03c4 is 4 bytes after a block of size 7,680 alloc'd

Also, using two separate pointers, s->write and read = s->write + 2,
does not seem to be well thought out.  To apply the delay of s->buffer[],
it is enough to read the delayed samples at the current position within
the buffer, and then to store new samples at the same current position.
Thus the application of delayed samples can probably be best described
with a single pointer s->cur.

I also introduce a minor change to ensure that the size of s->buffer[]
is always a multiple of 2.  Since the delay parameter is a float, it is
otherwise possible to trick the code into allocating off-by-one buffer.
2016-07-30 21:53:25 +02:00
Paul B Mahol 61d302dd52 doc/filters: mention HDMI output format for stereo3d filter 2016-07-30 15:17:21 +02:00
Timothy Gu 7204a6298b doxygen: Set tab size to 4 2016-07-29 19:01:40 -07:00
Timothy Gu 6253e5676f doxygen: Update Doxyfile for Doxygen 1.8.8 2016-07-29 19:01:40 -07:00
Timothy Gu f198b8af72 doxygen: Fix PREDEFINED syntax 2016-07-29 19:01:40 -07:00
Timothy Gu 22df70e9ed doxygen: Add a note on libavutil's modular nature 2016-07-29 19:01:40 -07:00
Chris Cunningham 52ec4cc09b libavformat/matroskadec: Add test for seeking with codec delay.
Also cleanup parens for the skip_to_timecode check.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-30 01:02:41 +02:00
Lucas Cooper bc9ce5f6be avfilter: Add new format for PSNR stats log
Add an AVOption stats_version with a new header for V2 stats, which
specifies the stats log version and lists the fields that will be
present in the log (to ease parsing).

The primary motivation is to facilitate the addition of optional fields
to the log without breaking backwards compatibility, while making the
logs easier to parse.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-29 20:49:53 +02:00
Michael Niedermayer 0219dc6c07 avformat/rmdec: Clear extradata when extradata_size is cleared
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-29 12:12:18 +02:00
Clément Bœsch a170365ae9 Merge commit '4e2f6212483ae1b2a4043cddf0a1cb001b476abc'
* commit '4e2f6212483ae1b2a4043cddf0a1cb001b476abc':
  svq3: stop using H264Picture

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:20:55 +02:00
Clément Bœsch ecf65c30cf Merge commit '251cbb44003caf179fb17afbb8a6c56643c2a646'
* commit '251cbb44003caf179fb17afbb8a6c56643c2a646':
  h264: create a new header for common h264 definitions

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:13:44 +02:00
Clément Bœsch 15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Clément Bœsch 7dda97fb86 Merge commit 'f651c6a259d4bc78f25db11d25df9256d5110bd3'
* commit 'f651c6a259d4bc78f25db11d25df9256d5110bd3':
  h264: factor out setting frame properties / side data

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 10:39:57 +02:00
Clément Bœsch cc0852bee3 Merge commit '19446dc5fff6a2f5ccd1a73db66e266255a5d768'
* commit '19446dc5fff6a2f5ccd1a73db66e266255a5d768':
  h264: drop unused NAL_FF_IGNORE

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 10:24:42 +02:00
Clément Bœsch 13872d2aa1 Merge commit 'bcd91f1644b46dd142c5355c8b742b27d9028903'
* commit 'bcd91f1644b46dd142c5355c8b742b27d9028903':
  h264: move a per-field block from decode_slice_header() to field_start()

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 10:24:06 +02:00
Josh de Kock 238733f741 hapdec: remove unused memory.h include
Most systems have this, so it isn't really a problem to include it
even if it's not used, but some do not have memory.h as it is
non-standard. Since it's unused just remove it anyway.
2016-07-29 09:13:01 +01:00
Clément Bœsch a63c73122e Merge commit '17e7c03e12d1e4490921e7bffaeaa6b46a7ada4e'
* commit '17e7c03e12d1e4490921e7bffaeaa6b46a7ada4e':
  h264: only allow ending a field/starting a new one before finish_setup()

This commit is a noop. According to Michael, after 8385e171 this commit
should not be necessary anymore.

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 09:59:36 +02:00
Stefano Sabatini 156b5bb9bf lavf/mpegtsenc: add special case for handling timed ID3 packets
Set the stream_id to 0xbd (private_stream_id_1). Tools seem to assume
that value, and this is consistent with MPEG TS specification (ITU-T
H.222.0 section 2.12.3).
2016-07-29 08:47:41 +02:00
Petru Rares Sincraian 286368099a fate: add test for stereotools filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-29 00:30:22 +02:00
Petru Rares Sincraian 08c1b6bb72 fate: add test for silenceremove filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-29 00:30:22 +02:00
Matthieu Bouron 83b9909398 Changelog: add entry for MediaCodec hwaccel 2016-07-28 16:11:52 +02:00
Zhao Zhili 65b2feb890 avutil/mem: fix memleak
The original code assumes av_realloc() will free ptr if size is zero.
The assumes is incorrect now.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-28 12:09:05 +02:00
Paul B Mahol d7ae4f79d3 avfilter/f_drawgraph: add another slide mode 2016-07-28 10:30:06 +02:00
Clément Bœsch 37abc8cca2 lavfi/hdcd: fix style 2016-07-28 09:30:10 +02:00
Clément Bœsch 4791716c1d lavfi/hdcd: mark pe_str as static and const 2016-07-28 09:29:20 +02:00
Burt P fb91143ef1 af_hdcd: Report PE as being intermittent or permanent
The Peak Extend feature could be enabled permanently or only
when needed. This is now reported.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-28 02:26:57 +02:00
softworkz 70c1647a35 avformat/matroskaenc: Write duration early during mkv_write_header (Rev #3)
Rev #2: Fixes doubled header writing, checked FATE running without errors
Rev #3: Fixed coding style

This commit addresses the following scenario:

we are using ffmpeg to transcode or remux mkv (or something else) to mkv. The result is being streamed on-the-fly to an HTML5 client (streaming starts while ffmpeg is still running). The problem here is that the client is unable to detect the duration because the duration is only written to the mkv at the end of the transcoding/remoxing process. In matroskaenc.c, the duration is only written during mkv_write_trailer but not during mkv_write_header.

The approach:

FFMPEG is currently putting quite some effort to estimate the durations of source streams, but in many cases the source stream durations are still left at 0 and these durations are nowhere mapped to or used for output streams. As much as I would have liked to deduct or estimate output durations based on input stream durations - I realized that this is a hard task (as Nicolas already mentioned in a previous conversation). It would involve changes to the duration calculation/estimation/deduction for input streams and propagating these durations to output streams or the output context in a correct way.
So I looked for a simple and small solution with better chances to get accepted. In webmdashenc.c I found that a duration is written during write_header and this duration is taken from the streams' metadata, so I decided for a similar approach.

And here's what it does:

At first it is checking the duration of the AVFormatContext. In typical cases this value is not set, but: It is set in cases where the user has specified a recording_time or an end_time via the -t or -to parameters.
Then it is looking for a DURATION metadata field in the metadata of the output context (AVFormatContext::metadata). This would only exist in case the user has explicitly specified a metadata DURATION value from the command line.
Then it is iterating all streams looking for a "DURATION" metadata (this works unless the option "-map_metadata -1" has been specified) and determines the maximum value.
The precendence is as follows: 1. Use duration of AVFormatContext - 2. Use explicitly specified metadata duration value - 3. Use maximum (mapped) metadata duration over all streams.

To test this:

1. With explicit recording time:
ffmpeg -i file:"src.mkv" -loglevel debug -t 01:38:36.000 -y "dest.mkv"

2. Take duration from metadata specified via command line parameters:
ffmpeg -i file:"src.mkv" -loglevel debug -map_metadata -1 -metadata Duration="01:14:33.00" -y "dest.mkv"

3. Take duration from mapped input metadata:
ffmpeg -i file:"src.mkv" -loglevel debug -y "dest.mkv"

Regression risk:

Very low IMO because it only affects the header while ffmpeg is still running. When ffmpeg completes the process, the duration is rewritten to the header with the usual value (same like without this commit).

Signed-off-by: SoftWorkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-28 02:06:55 +02:00
Anssi Hannula 04964ac311 avformat/hls: Fix missing streams in some cases with MPEG TS
HLS demuxer calls the subdemuxer avformat_find_stream_info() while
overriding the subdemuxer AVFMTCTX_NOHEADER flag by clearing it.
However, this prevents some streams in some MPEG TS streams from being
detected properly.

Simply removing the clearing of the flag would cause the inner
avformat_find_stream_info() call to take longer in some cases, without
a way to control it.

To fix the issue, do not clear the flag but propagate it to HLS demuxer.
To avoid the above-mentioned mandatory delay, the call to
avformat_find_stream_info() is dropped except in the HLS ID3 timestamped
case. The HLS demuxer user should be calling avformat_find_stream_info()
on the HLS demuxer if it wants to find the stream info.

The main streams are now created dynamically after read_header time if
the subdemuxer uses AVFMTCTX_NOHEADER (mpegts).

Subdemuxer avformat_find_stream_info() is still called for the HLS ID3
timestamped case as the HLS demuxer needs to know the packet durations
to properly interleave ID3 timestamped streams with MPEG TS streams on
sub-segment level.

Fixes ticket #4930.
2016-07-28 01:24:57 +03:00
Anssi Hannula 83db3c84fa avformat/hls: Move stream propagation to a separate function
Creation of main demuxer streams from subdemuxer streams is moved to
update_streams_from_subdemuxer() which can be called repeatedly.

There should be no functional changes.
2016-07-28 01:24:57 +03:00
Anssi Hannula 9884f17e34 avformat/hls: Use an array instead of stream offset for stream mapping
This will be useful when the amount of streams per subdemuxer is not
known at hls_read_header time in a following commit.
2016-07-28 01:24:57 +03:00