Compare commits

...

491 Commits

Author SHA1 Message Date
Timothy Gu
d3426fb592 Merge commit '606fb6c032fa44d9fa1efd4971308c228f2ebfff'
* commit '606fb6c032fa44d9fa1efd4971308c228f2ebfff':
  h264: call the hwaccel frame_start() from h264_field_start()

This commit is a noop, as it conflicts with 3e53211a578fc6b042ceff45b2702335294e0464.

Merged-by: Timothy Gu <timothygu99@gmail.com>
2016-08-03 17:47:06 -07:00
Timothy Gu
826c780c12 Revert "Revert "Merge commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22'""
This reverts commit e4af9be0f45c8f2ca148fb971f1e0c6782530e8c and redoes
796027f22154c799e0063e2457b31e0cfd1dddae.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-03 17:45:52 -07:00
Timothy Gu
e4af9be0f4 Revert "Merge commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22'"
This reverts commit 796027f22154c799e0063e2457b31e0cfd1dddae, reversing
changes made to bca30ed2b67f095fd31e07319a622ac30ad22978.

Preemptive revert before further testing has been done.
2016-08-03 17:06:55 -07:00
Timothy Gu
796027f221 Merge commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22'
* commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22':
  h264: fix the check for mixed IDR/non-IDR slices

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

Merged-by: Timothy Gu <timothygu99@gmail.com>
2016-08-03 15:59:51 -07:00
Timothy Gu
bca30ed2b6 Merge commit 'b13fc1e344011949929975a3451f78f226aa1de3'
* commit 'b13fc1e344011949929975a3451f78f226aa1de3':
  h264: do not pass H264Context to h264_slice_header_parse()

Conflicts:
	libavcodec/h264dec.h

Did not merge the h264_slice_header_parse() part. We use a few other
members of H264Context for error checking in that function.

Merged-by: Timothy Gu <timothygu99@gmail.com>
2016-08-03 15:41:59 -07:00
Paul B Mahol
4be8ab70a6 avfilter/af_astats: extend bitdepth calculation 2016-08-03 20:32:43 +02:00
Michael Niedermayer
b1ce800372 avformat/teeproto: Support parsing protocol options
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-03 19:40:26 +02:00
Michael Niedermayer
c5cc3b08e5 avformat/oggdec: Fix integer overflow with invalid pts
If negative pts are possible for some codecs in ogg then the code needs to be
changed to use signed values.

Found-by: Thomas Guilbert <tguilbert@google.com>
Fixes: clusterfuzz_usan-2016-08-02
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-03 16:09:03 +02:00
Michael Niedermayer
6cd9a8b67a ffplay: Fix invalid array index
Found-by: Thomas Guilbert <tguilbert@google.com>
Fixes: clusterfuzz_usan-2016-08-02
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-03 16:09:03 +02:00
Carl Eugen Hoyos
8916ad956a doc/filters: Fix option ranges for the sab filter.
Fixes ticket #5751.
2016-08-03 15:20:38 +02:00
Patrick Felt
e9659d1a0b decklink: Remove unneeded spaces in initializers 2016-08-02 22:46:28 -07:00
Burt P
e0b8cba058 af_hdcd: add flags to AVOption defs
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-08-02 22:40:23 -07:00
Timothy Gu
fd242479c6 mediacodec: Return ENOSYS on unsupported platforms 2016-08-02 22:32:12 -07:00
Timothy Gu
4e2a8c4920 jni: Return ENOSYS on unsupported platforms 2016-08-02 22:32:12 -07:00
Timothy Gu
58c7bf789f doxygen: Standardize root-level modules 2016-08-02 22:15:25 -07:00
Timothy Gu
a4d7a6d1dd mathematics: Extend and edit Doxygen 2016-08-02 21:53:34 -07:00
Timothy Gu
952c4cf7d0 rational: Extend Doxygen 2016-08-02 21:52:40 -07:00
Timothy Gu
f29ffbc87d avutil/hash: Add more detailed Doxygen documentation 2016-08-02 21:49:52 -07:00
James Almer
613c86299f avcodec/h264dec: move ff_h264_ps_uninit prototype to h264_ps.h
It's the proper place since 8c7932884d09bc580036640453fd6b7ad4dd77b4

Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-03 00:36:09 -03:00
Steven Robertson
e1be80aa11 libavcodec/dnxhd: Enable 12-bit DNxHR support.
10- and 12-bit DNxHR use the same DC coefficient decoding process and
VLC table, just with a different shift value. From SMPTE 2019-1:2016,
8.2.4 DC Coefficient Decoding:

"For 8-bit video sampling, the maximum value of η=11 and for
10-/12-bit video sampling, the maximum value of η=13."

A sample file will be uploaded to show that with this patch, things
decode correctly:
dnxhr_hqx_12bit_1080p_smpte_colorbars_davinci_resolve.mov

Signed-off-by: Steven Robertson <steven@strobe.cc>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-03 03:17:32 +02:00
Timothy Gu
708d9e9fba Doxyfile: Set STRIP_FROM_INC_PATH to project root
Show proper #include's on struct pages.

Before:

    #include <buffer.h>

After

    #include <libavutil/buffer.h>
2016-08-02 15:53:53 -07:00
Timothy Gu
ec234ccea4 mem: Order function prototypes semantically 2016-08-02 15:17:31 -07:00
Patrick Felt
5469293758 cosmetics: Correct comments in decklink_dec
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-08-02 13:01:12 -07:00
James Almer
efc9d5c4bc x86/ttaenc: add ff_ttaenc_filter_process_{ssse3,sse4}
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-02 15:48:04 -03:00
James Almer
7a9a8afc82 avcodec/ttaenc: split off hybrid filter processing as ttaencdsp
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-02 15:47:38 -03:00
Michael Niedermayer
35e7fc6030 avformat/tee: Factor parse_slave_options() out
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-02 20:22:55 +02:00
LoRd_MuldeR
8ab200fb8a avfilter/af_dynaudnorm: improve pre-filling code
In order to avoid possible clipping at the very
beginning. Especially apparent when "alternative"
boundary mode is used.

Adopted from original commit by committer.
2016-08-02 20:00:44 +02:00
Paul B Mahol
82b84c71b0 avcodec/alacenc: allocate bigger packets 2016-08-02 18:41:11 +02:00
Timothy Gu
1fcf243216 mathematics: Make function prototypes identical to definitions
Doxygen gets confused by this.
2016-08-02 09:01:09 -07:00
Carl Eugen Hoyos
5aede05120 lavu/hwcontext_vaapi: Fix compilation if VA_FOURCC_ABGR is not defined.
Fixes ticket #5484.
2016-08-02 17:07:41 +02:00
Timothy Gu
39211cb9aa murmur3: Add Doxygen documentation
The interface has been stable for some time now.
2016-08-02 07:50:44 -07:00
Timothy Gu
0a7a4e33f3 avutil: Add detailed Doxygen description to a few hashes 2016-08-02 07:48:21 -07:00
Timothy Gu
19d7098c9e avutil: Group hash functions separately in Doxygen 2016-08-02 07:48:08 -07:00
Timothy Gu
fbe22355b7 build: Make API documentation depend on config.mak
The Doxygen command is generated from the list of installed headers,
which may change per configuration (e.g. `--enable-gpl` results in
libpostproc to be built and installed).
2016-08-02 07:45:13 -07:00
Carl Eugen Hoyos
8ee113afa1 lavf/rmdec: Do not return EIO on EOF.
Reported-by: applemax82
2016-08-02 16:16:31 +02:00
Lucas Cooper
3d7ea1d39e doc/filters: Add stats_version documentation to PSNR filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-02 12:50:06 +02:00
Petru Rares Sincraian
7be021d949 fate: add test for tremolo filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-02 12:50:04 +02:00
James Almer
01f0598b18 Merge commit '996f13413b0415097e2a184d161462ffb3ceb647'
* commit '996f13413b0415097e2a184d161462ffb3ceb647':
  h264: fix warnings in fill_filter_caches_inter()

Conflicts:
libavcodec/h264_slice.c

See ef8f6464a55db730cab8c48a1a51fa4e6ca12107

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 19:11:08 -03:00
Burt P
bea17a3d57 af_hdcd: Warn if there is any resampling or format conversion in the link chain
HDCD is only encoded in s16@44100Hz. Scan the chain of AVFilterLinks
for any resampling or format conversion/truncation that might cause
problems for the filter and issue warnings.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-01 23:57:55 +02:00
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
Anssi Hannula
4d85069e5d avformat/hls: Sync starting segment across variants on live streams
This will avoid a large time difference between variants in the most
common case.
2016-07-28 01:24:57 +03:00
Anssi Hannula
9cb30f7a88 avformat/hls: Fix regression with ranged media segments
Commit 81306fd4bdf ("hls: eliminate ffurl_* usage", merged in d0fc5de3a6)
changed the hls demuxer to use AVIOContext instead of URLContext for its
HTTP requests.

HLS demuxer uses the "offset" option of the http demuxer, requesting
the initial file offset for the I/O (http URLProtocol uses the "Range:"
HTTP header to try to accommodate that).

However, the code in libavformat/aviobuf.c seems to be doing its own
accounting for the current file offset (AVIOContext.pos), with the
assumption that the initial offset is always zero.

HLS demuxer does an explicit seek after open_url to account for cases
where the "offset" was not effective (due to the URL being a local file
or the HTTP server not obeying it), which should be a no-op in case the
file offset is already at that position.

However, since aviobuf.c code thinks the starting offset is 0, this
doesn't work properly.

This breaks retrieval of ranged media segments.

To fix the regression, just drop the seek call from the HLS demuxer when
the HTTP(S) protocol is used.
2016-07-28 01:24:57 +03:00
Anssi Hannula
60873bf992 avformat/utils: Fix find_stream_info not considering the extradata it found
Commit 9200514ad8717c6 ("lavf: replace AVStream.codec with
AVStream.codecpar") merged in commit 6f69f7a8bf6a0d01 changed
avformat_find_stream_info() to put the extradata it got from
st->parser->parser->split() to st->internal->avctx instead of st->codec
(extradata in st->internal->avctx will be later copied to st->codecpar).

However, in the same function, the "is stream ready?" check was changed
to check for extradata in st->codecpar instead of st->codec, even
though st->codecpar is not yet updated at that point.

Extradata retrieved from split() is therefore not considered anymore,
and avformat_find_stream_info() will therefore needlessly continue
probing in some cases.

Fix that by checking for the extradata at st->internal->avctx where it
is actually put.
2016-07-28 01:24:57 +03:00
Burt P
c26305f6ae af_hdcd: Add counter for cdt expirations
Adds a counter for when the "code detect timer" expired without
finding a valid packet.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 23:09:45 +02:00
Burt P
c7ba34b6ea af_hdcd: more comments in state struct
Add some comments describing the fields in hdcd_state_t.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 23:09:26 +02:00
Burt P
91854b8ef6 af_hdcd: Improve HDCD detection
HDCD is now only considered detected if a valid packet
is active in both channels simultaneously.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 22:21:43 +02:00
Burt P
bfe9155aee fate: Add HDCD filter tests for false positive and error detection
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 22:21:43 +02:00
Michael Niedermayer
8385e1718e avcodec/h264_slice: Make setup_finished check cover more cases 2016-07-27 19:29:55 +02:00
Xinzheng Zhang
ad14aab3b4 avformat/flvdec: parse keyframe before a\v stream was created add_keyframes_index() when stream created or keyframe parsed
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 19:29:55 +02:00
Xinzheng Zhang
cd141e71bd avformat/flvdec: splitting add_keyframes_index() out from parse_keyframes_index()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 19:29:55 +02:00
Clément Bœsch
6c41eda18e Merge commit 'debca90863e4ee53447efd02483c500f89766384'
* commit 'debca90863e4ee53447efd02483c500f89766384':
  h264: store {curr,max}_pic_num in the per-slice context

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-27 18:07:30 +02:00
Clément Bœsch
87d1f82059 Merge commit 'f966498e433fead2f5e6b5b66fad2ac062146d22'
* commit 'f966498e433fead2f5e6b5b66fad2ac062146d22':
  h264: decode the poc values from the slice header into the per-slice context

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-27 17:31:18 +02:00
Clément Bœsch
f8ce1e8282 lavc/h264_slice: adjust a few line breaks to reduce diff with Libav 2016-07-27 17:24:48 +02:00
Clément Bœsch
78c7197ea0 Merge commit '54dd9b1cdd9e54f1ee39ae25af0324f8aba2831b'
* commit '54dd9b1cdd9e54f1ee39ae25af0324f8aba2831b':
  h264: set mb_aff_frame in frame_start()
  h264: move the block starting a new field out of slice_header_parse()

Both commits are merged at the same time in order to prevent a
regression with Ticket #4440 (see 38660128).

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-27 17:00:14 +02:00
Matthieu Bouron
376d8fb2c5 lavc/ffjni: replace ff_jni_{attach,detach} with ff_jni_get_env
If a JNI environment is not already attached to the thread where the
MediaCodec calls are made the current implementation will attach /
detach an environment for each MediaCodec call wasting some CPU time.

ff_jni_get_env replaces ff_jni_{attach,detach} by permanently attaching
an environment (if it is not already the case) to the current thread.
The environment will be automatically detached at the thread destruction
using a pthread_key callback.

Saves around 5% of CPU time (out of 20%) while decoding a stream with
MediaCodec.
2016-07-27 15:43:39 +02:00
Martin Storsjö
293676c476 libopenh264: Support building with the 1.6 release
This fixes trac issue #5417.

This is cherry-picked from libav commit
d825b1a5306576dcd0553b7d0d24a3a46ad92864.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-07-27 10:19:46 +03:00
Martin Storsjö
c5d326f551 Add an OpenH264 decoder wrapper
This is cherrypicked from libav, from commits
82b7525173f20702a8cbc26ebedbf4b69b8fecec and
d0b1e6049b06eeeeca146ece4d2f199c5dba1565.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-07-27 10:19:40 +03:00
James Almer
54a0a52be1 checkasm/vp9dsp: use declare_func_emms in check_loopfilter
Fixes checkasm failures on mmxext functions

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-26 22:16:21 -03:00
dericed
461073e809 ffprobe.xsd: add missing timecode attribute to frameSideDataType
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 00:42:13 +02:00
Josh de Kock
c2fcf4fa0b avdev/jack: remove duplicated dispatch macros
The macros were moved to compat/dispatch_semaphore/semaphore.h after a libav merge, and were never removed from jack.c
2016-07-26 23:10:47 +01:00
Ronald S. Bultje
a4edaa0270 vp9: add mxext versions of the single-block (w=8,npx=8) h/v loopfilters.
Each takes about 0.1% of runtime in my profiles, and they didn't have
any SIMD yet so far (we only had simd for npx=16 double-block versions).
2016-07-26 15:59:07 -04:00
Ronald S. Bultje
7ca422bb1b vp9: add mxext versions of the single-block (w=4,npx=8) h/v loopfilters.
Each takes about 0.5% of runtime in my profiles, and they didn't have
any SIMD yet so far (we only had simd for npx=16 double-block versions).
2016-07-26 15:59:07 -04:00
Ronald S. Bultje
726501a34e vp9: add 32x32 idct AVX2 implementation.
About 1.8x speedup compared to AVX version for full IDCT. Other
sub-IDCT scenarios also see speedups. Full --bench output for
idct_32x32_add_{bpp}_${subidct}_${opt} (50k cycles):

nop: 16.5
vp9_inv_dct_dct_32x32_add_8_1_c: 2284.4
vp9_inv_dct_dct_32x32_add_8_1_sse2: 145.0
vp9_inv_dct_dct_32x32_add_8_1_ssse3: 137.4
vp9_inv_dct_dct_32x32_add_8_1_avx: 137.1
vp9_inv_dct_dct_32x32_add_8_1_avx2: 73.2
vp9_inv_dct_dct_32x32_add_8_2_c: 14680.8
vp9_inv_dct_dct_32x32_add_8_2_sse2: 2617.2
vp9_inv_dct_dct_32x32_add_8_2_ssse3: 982.9
vp9_inv_dct_dct_32x32_add_8_2_avx: 958.5
vp9_inv_dct_dct_32x32_add_8_2_avx2: 704.2
vp9_inv_dct_dct_32x32_add_8_4_c: 14443.1
vp9_inv_dct_dct_32x32_add_8_4_sse2: 2717.1
vp9_inv_dct_dct_32x32_add_8_4_ssse3: 965.7
vp9_inv_dct_dct_32x32_add_8_4_avx: 1000.7
vp9_inv_dct_dct_32x32_add_8_4_avx2: 717.1
vp9_inv_dct_dct_32x32_add_8_8_c: 14436.4
vp9_inv_dct_dct_32x32_add_8_8_sse2: 2671.8
vp9_inv_dct_dct_32x32_add_8_8_ssse3: 1038.5
vp9_inv_dct_dct_32x32_add_8_8_avx: 983.0
vp9_inv_dct_dct_32x32_add_8_8_avx2: 729.4
vp9_inv_dct_dct_32x32_add_8_16_c: 14614.7
vp9_inv_dct_dct_32x32_add_8_16_sse2: 2701.7
vp9_inv_dct_dct_32x32_add_8_16_ssse3: 1334.4
vp9_inv_dct_dct_32x32_add_8_16_avx: 1276.7
vp9_inv_dct_dct_32x32_add_8_16_avx2: 719.5
vp9_inv_dct_dct_32x32_add_8_32_c: 14363.6
vp9_inv_dct_dct_32x32_add_8_32_sse2: 2575.6
vp9_inv_dct_dct_32x32_add_8_32_ssse3: 2633.9
vp9_inv_dct_dct_32x32_add_8_32_avx: 2539.6
vp9_inv_dct_dct_32x32_add_8_32_avx2: 1395.0
2016-07-26 15:59:07 -04:00
Clément Bœsch
c6e900e925 lavfi/curves: fix meaningless const int returned value
Spotted-by: James Almer <jamrial@gmail.com>
2016-07-26 21:22:27 +02:00
Luca Barbato
e85d38c20a librtmp: Avoid an infiniloop setting connection arguments
The exit condition was missing.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-07-26 12:05:29 -07:00
James Almer
be04c4aa00 avformt/matroskaenc: undo an accidental revert by commit 5d48e4ea
Commit 5d48e4eafa6c4559683892b8638d10508125f3cf accidentally reverted changes
made to matroskaenc by commit 989a614b707dcff8abdffe28dc24ec64a83b2837.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-26 15:22:32 -03:00
Dmitry Vagin
dc151d138c ffprobe: add missing PROGRAM_STREAM_TAGS case
ffprobe did not show tags with only '-show_entries programs'

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-26 19:22:47 +02:00
James Almer
fb91850fe1 avutil/frame: access avframe fields directly in get_frame_defaults()
The accessors are needed only from outside libavutil.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-25 17:37:18 -03:00
Josh de Kock
384251daff lavd/libdc1394: distinguish between enumeration errors and no cameras found
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-25 19:39:13 +02:00
Kacper Michajłow
e947b75b1c libavformat/rtpdec_asf: zero initialize the AVIOContext struct
This fixes crash in avformat_open_input() when accessing
protocol_whitelist field.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-25 19:39:13 +02:00
James Almer
0c75bd8e3c avcodec/dnxhddata: move avpriv_dnxhd_parse_header_prefix to a header
It's a small and simple function that can be inlined.

This removes one private symbol and should reduce object dependencies with the next
major bump

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-25 12:19:39 -03:00
James Almer
26cb7232c3 Revert "lavc: always build dnxhddata"
This reverts commit 2adbea4e216ce38a8bf6c72de16267c9162c174d.

A better solution will follow in the next commit.
2016-07-25 12:19:31 -03:00
Carl Eugen Hoyos
71167f7f84 lavc/Makefile: Fix standalone compilation of the svq3 decoder.
Regression since 0bf5fd2e
2016-07-24 23:50:33 +02:00
Matthieu Bouron
2adbea4e21 lavc: always build dnxhddata
lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by
dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a.

Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not
enabled.
2016-07-24 22:57:06 +02:00
Carl Eugen Hoyos
9bd35a76fc lavc/h264_ps: Be more verbose when truncating likely oversized PPS. 2016-07-24 20:21:37 +02:00
Ivan Uskov
b4054100f6 Revert "Merge commit '3c53627ac17fc6bdea5029be57da1e03b32d265d'"
This reverts commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e, reversing changes made to
acc155ac55baa95d1c16c0364b02244bc04d83a8. The commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e
provided irrelevant code complexity and decoding slowdown. But the main disadvantage of this
commit is a decoder crash. So it should be reverted.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-24 18:36:26 +02:00
Clément Bœsch
308f9b1c49 lavfi/selectivecolor: add 16-bit support 2016-07-24 15:29:37 +02:00
Clément Bœsch
b8aaedcd01 lavfi/selectivecolor: fix picking black as neutral when alpha is present 2016-07-24 14:21:50 +02:00
Mark Reid
6108cb2ce3 tests/fate: add dnxhr encoding tests
added sws_flags flags and tested against x86_32

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-24 12:31:07 +02:00
Clément Bœsch
6e971f7d66 lavfi: bump minor after recent curves filter additions 2016-07-24 12:22:41 +02:00
Clément Bœsch
b470d81f4e lavfi/curves: prefix init and uninit function names 2016-07-24 12:18:30 +02:00
Clément Bœsch
62a31aecf6 lavfi/curves: pass log ctx as void* instead of AVFilterContext* 2016-07-24 12:18:30 +02:00
Clément Bœsch
39c6d4a8c5 lavfi/curves: reindent after previous commit 2016-07-24 12:18:30 +02:00
Clément Bœsch
e30cdac14b lavfi/curves: add 16-bit support 2016-07-24 12:18:30 +02:00
Clément Bœsch
f19f5b906d lavfi/curves: move alloc and init of LUTs inside config_input()
This is needed in order to have different sizes of LUTs according to the
input.
2016-07-24 12:18:30 +02:00
Clément Bœsch
050f790594 lavfi/curves: dynamically allocate LUTs
This simplifies following commits.
2016-07-24 12:18:30 +02:00
Clément Bœsch
4eee06ae87 lavfi/curves: add various const where it makes sense 2016-07-24 12:18:30 +02:00
Clément Bœsch
51a873d441 lavfi/curves: remove pointless logging since the addition of plot option 2016-07-24 12:18:30 +02:00
Clément Bœsch
4a8f5f1fd8 lavfi/curves: add plot option 2016-07-24 12:18:30 +02:00
Clément Bœsch
5c14018fc4 lavfi/curves: do not automatically insert points at x=0 and x=1
There is actually a need for the origin and end point not to be defined.
We can not automatically insert them with the y value of the first and
last point as it will influence the curves in a wrong way.

Fixes #5397
2016-07-24 12:18:30 +02:00
Michael Niedermayer
783a2568b2 tests/fate/filter-audio: fate-filter-chorus: Randomly change parameters to some values which pass on arm/mips/x86-32/64
If this still doesnt give the same results on all platforms then this should be
disabled

Found-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-24 03:52:55 +02:00
Kacper Michajłow
69630f4d30 libavutil/opt: Small bugfix in example.
Fix const corectness and zero init the struct. This example code would actually crash when initializing string.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-24 00:41:15 +02:00
Jan Sebechlebsky
75bd5d3e2d avformat/tee: Rescale ts using av_packet_rescale_ts
This ensures that AV_NOPTS_VALUE value is handled
correctly.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-23 20:02:05 +02:00
Mark Reid
ece12db4f1 libavcodec/dnxhdenc: add support for dnxhr encoding
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 14:07:43 +02:00
Mark Reid
cdca1902ab libavcodec/dnxhdenc: add support for variable mircoblock counts
dnxhr has variable resolution, 8160 is the mb num for 1920x1080

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 14:07:37 +02:00
Mark Reid
c2cd1a5ea7 tests/fate/dnxhd: add dnxhr prefix tests
The data offset value in the prefix increases as the heights increases.
This test adds a tests for some common dnxhr heights.

can somebody add the following test footage to fate/dnxhd?
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x1536.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x1716.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x2048.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x2160.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x3212.dnxhr

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 13:54:13 +02:00
Mark Reid
e47981dab7 libavformat/movenc: add dnxhr compatibility for apple players
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 13:54:12 +02:00
Nikolay Aleksandrov
8ec599caa4 MAINTAINERS: add myself to the project server
I've been helping out with the project servers' maintenance and migration
to the new machine hosted in Telepoint's data center in Sofia, BG.

Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 11:13:06 +02:00
Chris Cunningham
d59820f6fe libavformat/matroskadec: fix unsigned overflow to improve seeking
When seeking a file where codec delay is greater than 0, the timecode
can become negative after offsetting by the codec delay. Failing to cast
to a signed int64 will cause the check against skip_to_timecode to evaluate
true for these negative values. This breaks the "skip_to" seek mechanism.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 10:32:28 +02:00
Mark Reid
0a088dea3d ffmpeg.c: copy video profile when using stream_copy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 03:52:38 +02:00
Carl Eugen Hoyos
db8e8c9731 lavc/intrax8: Use correct printf specifier for size_t on Windows. 2016-07-22 19:23:01 +02:00
Jan Sebechlebsky
1c46e53dcc avcodec/mpeg4_unpack_bframes_bsf: Check av_packet_from_data() return value
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 19:04:21 +02:00
Jan Sebechlebsky
8c997b3d3d avcodec/mpeg4_unpack_bframes_bsf: Copy packet props
mpeg4_unpack_bframes_bsf bitstream filters constructs
resulting packet using av_packet_from_data() function.
This function however modifies only buffer (data) and leaves
other fields untouched, so the content of other fields
of the output packet is undefined.
It is working with old BSF API, since old API filters
just data and the packet fields are copied in
av_apply_bitstream_filters from input packet.

This change fixes the behaviour for the new BSF API.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 18:55:37 +02:00
Sasi Inguva
282477bf45 libx264: Increase x264 opts character limit to 4096
Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 16:37:44 +02:00
Steven Liu
41ad6d193a doc/muxers: improve hlsenc description
Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 16:31:30 +02:00
Steven Liu
6f07467831 doc/muxers: add hls_flags option description
Signed-off-by: Steven Liu <liuqi@gosun.com>
Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 16:31:30 +02:00
Petru Rares Sincraian
fa393e3061 fate: add test for extrastereo filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 13:13:24 +02:00
Michael Niedermayer
e83a01def3 avformat/teeproto: Fix memset sizeof
Found-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 10:47:34 +02:00
James Zern
640c0962c0 libvpxenc,cosmetics: rename common fns vp8 -> vpx
+ the context struct

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Zern <jzern@google.com>
2016-07-21 20:51:13 -07:00
James Zern
2afddfe9bf libvpxdec,cosmetics: rename common fns vp8 -> vpx
+ the context struct

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Zern <jzern@google.com>
2016-07-21 20:50:26 -07:00
Yong Lei
8dcfe43de0 avcodec/huffman: beautify: add space between #include and filename.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 03:14:07 +02:00
Michael Niedermayer
b9d77c1dfc doc/protocols: Fix seperated typo
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 01:05:49 +02:00
Michael Niedermayer
697b2bbd54 avcodec/ffv1dec: Test extradata_size instead of extradata for better robustness
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 23:37:02 +02:00
Michael Niedermayer
38cc5c298c avformat/mov: Do not allocate empty extradata
Fixes Ticket5723

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 21:55:18 +02:00
Michael Niedermayer
9264bb7e79 avfilter/vf_psnr: Fix rounding error in average_max
The intermediate was rounded to an integer

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 11:26:28 +02:00
Mark Reid
541731488e libavformat/rawenc: add dnxhr raw format extension
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 04:15:15 +02:00
Jörn Heusipp
64131b87d6 libopenmpt: Add "date" to metadata.
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Jörn Heusipp
840df1f193 libopenmpt: set stream duration and fix time base
Fix the confusion around the used time base.

Check size returned from avio_size()

Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Josh de Kock
4ed6edac76 docs/demuxers: add libopenmpt section
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Josh de Kock
9134d2df5b libopenmpt: add subsong support
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
James Almer
120f34b6ac avformat/oggenc: add vp8 muxing support
Addresses ticket #5687

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-20 22:32:48 -03:00
James Almer
66408fce49 avformat: add an Ogg Video muxer
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-20 22:32:43 -03:00
James Almer
ec0e888e3a Changelog: move a misplaced entry to the correct section
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-20 22:32:39 -03:00
Michael Niedermayer
3af1aba2be avformat/mux: Fix some codecpar non uses
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 03:02:24 +02:00
Petru Rares Sincraian
3fd2ef922e fate: add test for earwax filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-20 23:09:04 +02:00
Petru Rares Sincraian
7403dcc34e fate: add test for dcshift filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-20 23:09:04 +02:00
James Almer
7a15cf42ee x86/diracdsp: make ff_put_signed_rect_clamped_10_sse4 work on x86_32
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-20 13:43:38 -03:00
Mark Reid
41d7642a7b libavcodec/dnxhd: add dnxhr profiles
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-20 13:40:06 +02:00
Jun Zhao
a06acfff76 ffmpeg_opt: Delete duplicate “hwaccel_output_format” option.
Delete duplicate “hwaccel_output_format” option.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-20 12:07:38 +02:00
Vignesh Venkatasubramanian
134fe28981 libavcodec/libvpx: Add VPx alpha decode support
VPx (VP8/VP9) alpha encoding has been part of FFmpeg. Now, add the
ability to decode such files with alpha channel.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2016-07-19 20:31:13 -07:00
Petru Rares Sincraian
2383618a40 fate: add test for chorus filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-20 02:53:42 +02:00
James Almer
1582e306a4 avformat/avlanguage: make av_convert_lang_to() internal
The header was never installed and the function is only used in libavformat

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 21:43:14 -03:00
James Almer
b3820cabad avformat/oggenc: fix page duration calculation when granule differs from timestamp
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 21:12:18 -03:00
James Almer
5adfbd3918 avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 21:12:10 -03:00
James Almer
114870dbc9 configure: add support for new CPUs
Add new -march values for Intel and AMD CPUs introduced with GCC 5 and 6, and
improve SunCC flags accordingly.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 20:45:48 -03:00
Michael Niedermayer
9bf3fdcd3c avcodec/h264_slice: Move h264_init_ps() call into h264_field_start()
This was missing from f512e4a39037ef798ec78170f734c7733abe3231

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-20 00:07:18 +02:00
Michael Niedermayer
fd1588919d avcodec/h264: remove list_count and ref_count clearing
The code conflicts with moving the h264_init_ps() call point

Without this, ff_h264_parse_ref_count() fills ref and list count and
h264_init_ps() subsequently wipes them out on a "success" path.
Subsequently things crash as the wiped fields are used.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-20 00:02:12 +02:00
Petru Rares Sincraian
68f991d909 fate: add test for avfft
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-19 23:25:01 +02:00
Michael Niedermayer
64caafaeb1 avformat: Add tee protocol
Option passing support will be submitted seperately to the ML

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-19 18:41:19 +02:00
Clément Bœsch
21c081a246 lavc/h264: fix spacing before comment 2016-07-19 15:34:03 +02:00
Zhao Zhili
450cf400fc avutil/mem: fix wrong comment
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-18 22:52:36 +02:00
Josh de Kock
daf421d2ab MAINTAINERS: add myself for libopenmpt
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-18 20:10:29 +02:00
Aman Gupta
a49ed9e32d avcodec/ccaption_dec: default rollup to row 10
This ensures that captions are written towards the bottom of the screen
when tuning into mid-stream. The row will be reset on the receipt of the
next PAC command. Row 10 was chosen as it corresponds to the value of
"0" in a PAC (see row_map in handle_pac()).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-18 01:34:56 +02:00
Aman Gupta
9ca9671458 avcodec/ccaption_dec: implement positioning for closed captions
Positioning math is based on the guidelines in https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-18 01:31:25 +02:00
James Almer
64d16fd7f5 tools/patcheck: add a couple more common typos
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-17 18:38:14 -03:00
Aman Gupta
309322ef65 avcodec/ccaption_dec: change write_char() to void as return value is unused
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-17 20:16:22 +02:00
Michael Niedermayer
af13967b64 MAINTAINERS: Add Aman Gupta for ccaption_dec
Anshul appears to have no time currently as he has not reacted to patches or mails
and Aman agreed to take over maintaince or help

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-17 20:01:38 +02:00
James Almer
d688f39dc4 cosmetics: fix some misspelled words
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-17 13:10:27 -03:00
Jörn Heusipp
f1eb6ddcb3 libavformat/libopenmpt: Fix memory leak in error path in read_header_openmpt().
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-17 16:20:46 +02:00
Michael Niedermayer
2b14204339 avcodec/dnxhddata: replace % by &
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-16 22:08:37 +02:00
James Almer
8f0434f85c fate: fix apng tests dependencies
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-16 15:29:43 -03:00
James Almer
298f556af4 configure: add missing loongson dependencies
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-16 15:18:58 -03:00
Mark Reid
ed0dc14ebb libavcodec/dnxhd: add support more dnxhr header prefixes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-16 15:39:28 +02:00
Jan Sebechlebsky
df9cc7f0a9 avformat/tee: Use ff_format_output_open() function
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:30:01 +02:00
Jan Sebechlebsky
6a3515a5a4 avformat/utils: Add ff_format_output_open() function
Add ff_format_output_open utility function to wrap
io_open callback of AVFormatContext structure.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:29:44 +02:00
Jan Sebechlebsky
e144b86fa4 avformat/tee: Support flushing by writing NULL pkt
This will add support for flushing by writing NULL
packet to the tee muxer, which propagates the action
to slave muxers as expected.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:28:11 +02:00
Jan Sebechlebsky
3d7b5ad217 avformat/tee: Use ff_stream_encode_params_copy()
Use ff_stream_encode_params_copy() to copy encoding-related
fields (parameters) of stream.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:15:16 +02:00
Jan Sebechlebsky
1732d89403 avformat/utils: Add ff_stream_encode_params_copy()
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:15:00 +02:00
Josh de Kock
d52dd768a3 lavf: add libopenmpt demuxer
Fixes ticket #5623

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-15 20:59:25 +02:00
Steven Liu
b701ec4152 refine the method option describe of hlsenc doc
Signed-off-by: LiuQi <liuqi@gosun.com>
Reviewed-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-15 16:24:28 +02:00
Pavel Koshevoy
25ca74d314 Restore compatibility with powerpc-apple-darwin9-gcc-4.2.1
... and attempt to preserve compatibility with clang that was
introduced in 311a953c76081fca99b872629d248f9d69ebc0c3 (untested)

Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-15 13:58:54 +02:00
Clément Bœsch
77726d32a8 lavf/vplayerdec: Improve auto-detection.
Fixes the incorrect detection of 16_selma_OneFrame_QP39.yuv (gray16le
rawvideo) as vplayer format.
2016-07-15 10:36:05 +02:00
Carl Eugen Hoyos
e1023aa1dd lavf/img2dec: Also auto-detect (unusual) uncompressed pcx. 2016-07-15 10:26:27 +02:00
Carl Eugen Hoyos
040b4e139b lavf/img2: Remove ffv1-img.
The ffv1 format currently needs a container.
2016-07-15 10:25:02 +02:00
Burt P
c41718c0d0 af_hdcd: detect and report encoding errors and oddities
Count and report when a code is signaled but fails to match a known pattern.
For example try Līve - Secret Samadhi.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-14 22:09:00 +02:00
Burt P
5c7457c028 af_hdcd: only hdcd_update_info() when something changes
Only call hdcd_update_info() when the control code changes
instead of every frame, so the counters are more meaningful.

Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-14 22:09:00 +02:00
Burt P
33fc4cc7c6 af_hdcd: fewer false positives by ignoring code_counterC in HDCD detection
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-14 22:09:00 +02:00
Steven Liu
e29d2d9c92 avformat/segment: remove the check_bitstream from segment
because the BSF logic was re-factored into a shareable
function and both av_write_frame and av_interleaved_write_frame use it it

Signed-off-by: LiuQi <liuqi@gosun.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-14 21:33:19 +02:00
Clément Bœsch
2c138b2c9b Merge commit 'b25cd7540e7cba9868edc13817c0ce1ddef90ffc'
* commit 'b25cd7540e7cba9868edc13817c0ce1ddef90ffc':
  h264: pass a H2645NAL to slice header decoding

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-14 19:41:37 +02:00
Clément Bœsch
def8506766 Merge commit '523c4c5b70994f5cd1f192b68d07cf24b292ca05'
* commit '523c4c5b70994f5cd1f192b68d07cf24b292ca05':
  fate: Add TrueMotion 2 RT tests

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-14 19:37:14 +02:00
Clément Bœsch
e28d66052d Merge commit '906ffed9b1b8b06979eb656989aecacb1ae75a3a'
* commit '906ffed9b1b8b06979eb656989aecacb1ae75a3a':
  fate: Move Duck Truemotion 1 and 2 tests to vpx.mak

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-14 19:35:04 +02:00
Clément Bœsch
bec7145252 lavc/truemotion2rt: mark AVPacket* as const 2016-07-14 19:29:43 +02:00
Clément Bœsch
93c13886a2 Merge commit '470cd0c5fe6337b6cb5276b3f84400999450fc1b'
* commit '470cd0c5fe6337b6cb5276b3f84400999450fc1b':
  Add TrueMotion 2.0 Real Time decoder

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-14 19:27:39 +02:00
Clément Bœsch
87e9cefa91 lavc/codec_desc: move a few codecs out of the image codecs list
Also shuffle them a little to simplify next Libav merge.
2016-07-14 19:14:26 +02:00
Clément Bœsch
9e6bb3b6ee fate/video: use FATE_VIDEO instead of FATE_SAMPLES_AVCONV
Consistent with the rest of the rules
2016-07-14 19:01:51 +02:00
Clément Bœsch
cd02df5256 Merge commit 'cc58656aca95b5ab517989a9524b9a2b1c5653cf'
* commit 'cc58656aca95b5ab517989a9524b9a2b1c5653cf':
  fate: Add tests for MagicYUV

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-14 18:57:37 +02:00
Clément Bœsch
c3e2e842fa Merge commit 'd78fd2fa21cde28465e40dd0be4446b1387d22a6'
* commit 'd78fd2fa21cde28465e40dd0be4446b1387d22a6':
  Add MagicYUV decoder

Changes observed from Libav:
- many cosmetics (function renames/move, spacing, line breaks)
- MagicYUVContext.slices_size is now unsigned
- use of pixdesc (include fixed in FFmpeg)
- mention of "Lossless" in the long name dropped (also removed from
  general.texi in FFmpeg)
- addition of the FF_CODEC_CAP_INIT_THREADSAFE caps
- use of qsort() instead of AV_QSORT() (NOT MERGED)
- use of AVCodecContext.{width,height} instead of AVCodecContext.coded_{width,height} (NOT MERGED)

See also 77f9c4b7aa9eb793b3019025e177245896821816

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-14 18:52:20 +02:00
Michael Niedermayer
a2c90d5f98 avformat/mux: Apply auto bsfs in av_write_frame() too
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-14 17:51:57 +02:00
Michael Niedermayer
de9674c5ea avformat/mux: Factor do_packet_auto_bsf() out
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-14 17:51:57 +02:00
Matthieu Bouron
6c8942cdfb lavf/mov: fix stream extradata_size allocation
Fixes CID 1363963.
2016-07-14 09:18:39 +02:00
Rostislav Pehlivanov
f41e37b84f dirac_vlc: prevent shifting a 0 by 64 bits when zeroing residue
Adding a check for bits == 0 would still make Coverity misdetect this,
so just revert to the normal way of setting the residue to 0.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-14 01:29:34 +01:00
Rostislav Pehlivanov
c4adcff976 dirac_vlc: add a SET_RESIDUE macro and fix recent regression
Can also be used in future cleanups since 99% of the time the leftover
appending will just append to an already empty residue.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-14 01:00:59 +01:00
Rostislav Pehlivanov
000eb01a7d diracdec: fix unchecked byte length
Also drops the start variable since it's redundant.
Found by Coverity, fixes CID1363964

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-13 23:53:05 +01:00
Rostislav Pehlivanov
b2b12b2d4a diracdec: fix maximum quantization index checks
Found by Coverity, fixes CID1363961 and CID1363962

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-13 23:40:06 +01:00
Rostislav Pehlivanov
9c0aba434e dirac_vlc: remove redundant macro declaration
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-13 23:38:10 +01:00
Rostislav Pehlivanov
e24c31b656 dirac_vlc: fix undefined shifts
Shifting by more than 63 bits is undefined behavior, athough any
compiler not returning 0 after shifting by any amount would be insane.

Found by Coverity, fixes CID1363959 and CID1363960

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-13 23:35:03 +01:00
Michael Niedermayer
e879819e7b avfilter/vf_uspp: Check for encoding failure
Fixes CID1363015

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-13 20:16:27 +02:00
Matthieu Bouron
57fa9608e4 Merge commit 'ec9f04423b82afa323e90f5b2c677be74302c1fd'
* commit 'ec9f04423b82afa323e90f5b2c677be74302c1fd':
  ffv1: Error out on unsupported format

This commit is a noop, the feature is already present in FFmpeg.

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-07-13 17:40:56 +02:00
James Almer
fde9c5e424 fate: fix fate-vp8 dependencies
Fix the demuxer dependencies in some of the tests and remove the vp8 decoder
dependency for the stream copy tests

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-13 12:33:56 -03:00
Matthieu Bouron
a91c330a29 Merge commit '105998fb5ca3c343f5c8cb39ce3197f87a5e4d36'
* commit '105998fb5ca3c343f5c8cb39ce3197f87a5e4d36':
  checkasm: Add tests for h264 idct

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-07-13 17:22:29 +02:00
Matthieu Bouron
495a40cecb tests/checkasm: reduce cosmetic diff with libav
Chunk was not merged in ca5ec2bf51d8c4f8bb0a829d0a65c70c968888a3.
2016-07-13 17:11:58 +02:00
Matthieu Bouron
354336490d Merge commit '846a3e78a535f05ee61bb23a160f3378f041f751'
* commit '846a3e78a535f05ee61bb23a160f3378f041f751':
  mov: Support prores with multiple stsd

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-07-13 16:56:20 +02:00
Matthieu Bouron
3c058f5701 Merge commit '76729970049fe95659346503f7401a5d869f9959'
* commit '76729970049fe95659346503f7401a5d869f9959':
  mov: Implement support for multiple sample description tables

Notes:
  * The sc->stsc_data[index].id checks have been moved from the mov_read_stsc
  to mov_read_packet before the value is used in mov_change_extradata to
  not break playback of samples with broken stsc entries (see sample of
  ticket #1918).

  * sc->stsc_index is now checked against sc->stsc_count - 1 before it
  is incremented so it remains lesser than sc->stsc_count. Fixes a crash
  with:

  ./ffmpeg -i matrixbench_mpeg2.mpg -t 1 -frag_duration 200k test.mov
  ./ffprobe -show_packets test.mov

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-07-13 16:34:54 +02:00
Martin Vignali
f2b08a0702 libavcodec/exr : cosmetics, rename variable in b44_uncompress func
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-13 14:56:27 +02:00
Vignesh Venkatasubramanian
acca56d962 libvpx: Enable vp9 alpha encoding
Chrome canary now supports decoding of VP9 streams with alpha
channel [1]. Add support to ffmpeg for creating such files.

[1] https://codereview.chromium.org/2096813002/

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2016-07-12 23:19:50 -07:00
Burt P
7af44ce2f7 af_hdcd: don't log full HDCD stats if HDCD was not detected
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-12 22:55:04 +02:00
Burt P
0d8caeb41e af_hdcd: integrate() renamed hdcd_integrate() to be consistent with the other function names
Signed-off-by: Burt P <pburt0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-12 21:39:01 +02:00
Michael Niedermayer
2408f92678 avcodec/dirac_vlc: Fix avutil.h include
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-12 19:11:40 +02:00
James Almer
4acdbb1c6c avformat/oggenc: always use the time base stored in the theora header
Fixes ticket #5704

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-12 11:24:30 -03:00
Michael Niedermayer
9157ac2f9c avcodec/dirac_vlc: Fix mixed declaration and statements
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-12 13:30:52 +02:00
Rostislav Pehlivanov
a337cb7361 diracdec: fix #coeffs -> byte conversion
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-12 10:44:24 +01:00
Rostislav Pehlivanov
df1dc52195 diracdsp_init: add missing ARCH_X86_64 check
That SIMD is still x86_64 only for now.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-07-12 00:39:12 +01:00
Rostislav Pehlivanov
2094562923 diracdec: do not memset the entire coefficient buffer for HQ pictures
This is now handled by the slice decoding function.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:41:32 +01:00
Rostislav Pehlivanov
dcad4677d6 diracdec: do not allocate and free slice parameters every frame
Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:40:57 +01:00
Rostislav Pehlivanov
0eb0f93109 diracdec: implement a LUT-based Golomb code parser
Still much left to optimize, but it provides a significant performance
improvement - 10% for 300Mbps (1080p30), 25% for 1.5Gbps (4k 60fps) in
comparison with the default implementation.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:40:28 +01:00
Rostislav Pehlivanov
c43485f707 diracdec: rewrite HQ slice decoding
Now coefficients are written to a buffer and are then dequantized by the
new SIMD dequantization functions. For the lower bands without enough
coefficients to fill a register (and hence they overwrite) the C version
of the dequantization function is used.

The buffer is per-thread and will be realloc'd if anything changes.
This prevents regressions and having to limit slice size.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:38:45 +01:00
Rostislav Pehlivanov
09d89d9406 diractab: expose the maximum quantization index as a macro
Prevents having to have random magic values in the decoder and a
separate macro in the encoder.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:38:01 +01:00
Rostislav Pehlivanov
b9c6c5f453 diracdec: decode HQ profile slices in rows
Siginificantly improves the performance.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:34:54 +01:00
Rostislav Pehlivanov
17caae7202 diracdec: simplify golomb parsing and dequantization
In preparation for the following commits, this commit simplifies the
coefficient parsing and dequantization function. It was needlessly
inlined without much performance gain.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:34:25 +01:00
Rostislav Pehlivanov
bd61f3c6bf diracdsp: add SIMD for the 10 bit version of put_signed_rect_clamped
Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:33:24 +01:00
Rostislav Pehlivanov
80721cc1ff diracdsp: add dequantization SIMD
Currently unused, to be used in the following commits.

Signed-off-by: Rostislav Pehlivanov <rpehlivanov@obe.tv>
2016-07-11 23:30:11 +01:00
Carl Eugen Hoyos
244d22452c lavc/Makefile: Fix standalone compilation of the lame encoder.
Also fix a possible issue with the mpegaudio audiotoolbox decoders.
Fixes ticket #5703.
2016-07-11 23:21:19 +02:00
James Almer
f60b54902f avformat/oggenc: make flac the default for oga muxer
This allows simpler selection of flac in ogg from the command line,
while following the RFC 5334 recommendation[1] for the oga extension.

[1] https://tools.ietf.org/html/rfc5334#section-10.3

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-11 13:08:19 -03:00
Ronald S. Bultje
70d418c7e6 Revert "PPC64: Add versions of functions in libswscale/input.c optimized for POWER8 VSX SIMD."
This reverts commit 1df908f33f658979b32599489ca6f1a39821013c. The expected
performance improvements are essentially non-existent.
2016-07-11 10:15:05 -04:00
Ronald S. Bultje
f0a2b6249b vp9: add 16x16 idct avx2 (8-bit).
checkasm --bench, 10k runs, for *_add_${bpc}_${sub_idct}_${opt}, shows
that it's about 1.65x as fast as the AVX version for the full IDCT, and
similar speedups for the sub-IDCTs:

nop: 24.6
vp9_inv_dct_dct_16x16_add_8_1_c: 6444.8
vp9_inv_dct_dct_16x16_add_8_1_sse2: 638.6
vp9_inv_dct_dct_16x16_add_8_1_ssse3: 484.4
vp9_inv_dct_dct_16x16_add_8_1_avx: 661.2
vp9_inv_dct_dct_16x16_add_8_1_avx2: 311.5
vp9_inv_dct_dct_16x16_add_8_2_c: 6665.7
vp9_inv_dct_dct_16x16_add_8_2_sse2: 646.9
vp9_inv_dct_dct_16x16_add_8_2_ssse3: 455.2
vp9_inv_dct_dct_16x16_add_8_2_avx: 521.9
vp9_inv_dct_dct_16x16_add_8_2_avx2: 304.3
vp9_inv_dct_dct_16x16_add_8_4_c: 7022.7
vp9_inv_dct_dct_16x16_add_8_4_sse2: 647.4
vp9_inv_dct_dct_16x16_add_8_4_ssse3: 467.1
vp9_inv_dct_dct_16x16_add_8_4_avx: 446.1
vp9_inv_dct_dct_16x16_add_8_4_avx2: 297.0
vp9_inv_dct_dct_16x16_add_8_8_c: 6800.4
vp9_inv_dct_dct_16x16_add_8_8_sse2: 598.6
vp9_inv_dct_dct_16x16_add_8_8_ssse3: 465.7
vp9_inv_dct_dct_16x16_add_8_8_avx: 440.9
vp9_inv_dct_dct_16x16_add_8_8_avx2: 290.2
vp9_inv_dct_dct_16x16_add_8_16_c: 6626.6
vp9_inv_dct_dct_16x16_add_8_16_sse2: 599.5
vp9_inv_dct_dct_16x16_add_8_16_ssse3: 475.0
vp9_inv_dct_dct_16x16_add_8_16_avx: 469.9
vp9_inv_dct_dct_16x16_add_8_16_avx2: 286.4
2016-07-11 10:14:58 -04:00
Michael Niedermayer
a2550e7d2e avcodec/iff: Check that there are enough bytes in dgb before reading
Fixes CID1361959

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-11 14:48:57 +02:00
Michael Niedermayer
9585c50942 avcodec/iff: remove useless ()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-11 14:44:27 +02:00
Michael Niedermayer
92139c1bd1 avcodec/mediacodecdec_h264: Fix occured typo
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-11 13:00:04 +02:00
Michael Niedermayer
37c658b56b doc/muxers: Fix Thisimproves typo
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-11 12:55:29 +02:00
Steven Liu
b45a976ed4 add split_by_time flag for support splite mpegts segment at non-keyframe
support split hls segment at duration set by hls_time

Signed-off-by: LiuQi <liuqi@gosun.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-11 12:20:40 +02:00
Marton Balint
593987810e avutil/parseutils: dont assume standard time when parsing a timestamp
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-11 01:06:23 +02:00
Michael Niedermayer
58dc8bbca4 avcodec/h264_refs: Assert that op is 0-2
Coverity fails to realize this

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-10 21:23:11 +02:00
Sami Hult
d4c8e93190 Changed metadata print option to accept general urls
This is an - once again - updated patch, that uses avio_write instead
of avio_puts to stream clean text output without null characters. Works
now for me as intended.

Changes metadata filter to accept general urls as file argument without
breaking former behaviour. As a byproduct, it also allows for writing to
file "-" if specified as "file:-".

Example:

ffmpeg -i test.wav -filter_complex "silencedetect=n=-40dB:d=0.1,ametadata=mode=print:file='pipe\:4'" -f null

Signed-off-by: Sami Hult <sami.hult@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-10 00:36:49 +02:00
Michael Niedermayer
e98ab799be avcodec/vaapi_encode_h264: Use av_clip_uintp2()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-10 00:36:20 +02:00
James Almer
fd6dbc5385 Revert "configure: Enable GCC vectorization on ≥4.9 on x86"
This reverts commit cb8646af24bd8e9627cc5e1c62b049a00fe0b07b.

This change has brough more issues than benefits, between compilation
time failures depending on flags used and code miscompilation causing
runtime crashes.

See the "[PATCH 2/2] configure: Enable GCC vectorization on ≥4.9"
thread in the ffmpeg-devel mailing list for the relevant discussion.
2016-07-09 16:00:06 -03:00
Clément Bœsch
3cdd5f4b7c Revert "Merge commit '187d719760bd130f848194ec4a6bd476341914bb'"
This reverts commit c67aa7f287e791b2c02c0c6471336c8adc88020e, reversing
changes made to 46bd0e8e0dfb4b295e8fbe6854904eccb0cb5c82.

The merge should have been a noop as the support was added in
601c2388549ff395bc99383029e92c2219152af0
2016-07-09 15:56:04 +02:00
Clément Bœsch
c67aa7f287 Merge commit '187d719760bd130f848194ec4a6bd476341914bb'
* commit '187d719760bd130f848194ec4a6bd476341914bb':
  h264: Support AV_PKT_DATA_NEW_EXTRADATA

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 15:03:27 +02:00
Clément Bœsch
46bd0e8e0d Merge commit '75872d77d215d64b8d9430df23c6c74ff921227b'
* commit '75872d77d215d64b8d9430df23c6c74ff921227b':
  lavc: Document AV_PKT_DATA_NEW_EXTRADATA

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:55:39 +02:00
Clément Bœsch
84ecbbfb27 Merge commit 'f1a9eee41c4b5ea35db9ff0088ce4e6f1e187f2c'
* commit 'f1a9eee41c4b5ea35db9ff0088ce4e6f1e187f2c':
  x86: Add missing movsxd for the int stride parameter

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:52:23 +02:00
Clément Bœsch
1ad3ffadd9 Merge commit 'a2ddfadc2d9e91cf70aa7430a7340b418bdb5b42'
* commit 'a2ddfadc2d9e91cf70aa7430a7340b418bdb5b42':
  avdevice: Ignore timefilter test program

This commit is a noop, /timefilter entry was added in the original merge
(5d48e4eafa6c4559683892b8638d10508125f3cf)

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:49:32 +02:00
Clément Bœsch
3536493082 Merge commit 'd6c2c2796d8885e99fc90793cdd7937826f82fab'
* commit 'd6c2c2796d8885e99fc90793cdd7937826f82fab':
  LICENSE: Fix silly typo

This commit is a noop, the typo disappeared when the whole paragraph was
reworked in 484aec4da3f729fca9d9f84a6b895a8f882554db.

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:48:24 +02:00
Clément Bœsch
a7ce5b25c0 Merge commit '84b2d3fb68caf71cff4b80b44ff865d7ae2531ce'
* commit '84b2d3fb68caf71cff4b80b44ff865d7ae2531ce':
  h264: Drop unused function check_opcodes()

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:45:12 +02:00
Clément Bœsch
415072605b Merge commit '05a4bacbf7ece618553d339afe1d0b57bc87aea8'
* commit '05a4bacbf7ece618553d339afe1d0b57bc87aea8':
  avpacket: Error out when creating 0-sized side data

This commit is a noop, see 5a633ec2dd453c67ff23819c28d98e6b09c47295

AV_PKT_DATA_METADATA_UPDATE can be zero sized in order to clear old
meta.

Note: maybe we could add a start or end marker.

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:43:46 +02:00
Clément Bœsch
1cfa350429 Merge commit 'bcc07e2576cb723007bea1238afd019ae2d1b005'
* commit 'bcc07e2576cb723007bea1238afd019ae2d1b005':
  pixdesc: Use C99 array to list color properties names

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:21:01 +02:00
Clément Bœsch
b4abf0e396 Merge commit 'a833ff68f6bf9dc72c3ef0ddf830ebed743c0703'
* commit 'a833ff68f6bf9dc72c3ef0ddf830ebed743c0703':
  h264: Fix decoding delay for Intra only streams

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:06:11 +02:00
Clément Bœsch
775389fc59 Merge commit '90f469aa2b98a868cdbe35170c24272de10e1341'
* commit '90f469aa2b98a868cdbe35170c24272de10e1341':
  lavc: add H.264 MVC profiles

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-09 14:01:28 +02:00
Clément Bœsch
f512e4a390 Merge commit '61f168ae348f94f39e7afc6971654455a5de0e4d'
* commit '61f168ae348f94f39e7afc6971654455a5de0e4d':
  h264: factor out setting the parameter sets for a frame

Michael's changes on top of the merge undo parts of the original diff
that are not factorization:

"The call point is left where it was before. Such a change should be in
a separate commit and has multiple issues, one being null pointer
dereferences the other is that some safety checks would become
conditional.

I tried to split the PPS init between the new and old functions
similarly to the SPS code."

Merged-by: Clément Bœsch <u@pkh.me>
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-09 13:57:43 +02:00
Matthieu Bouron
0f2654c9a3 lavc: add mediacodec hwaccel support 2016-07-08 17:02:37 +02:00
Hendrik Leppkes
83a940e7fb h2645_parse: don't overread AnnexB NALs within an avc stream
We know the maximum size of an AnnexB NAL, signaling it as the maximum
NAL size allows ff_h2645_extract_rbsp to determine the correct size.
2016-07-08 15:20:20 +02:00
Hendrik Leppkes
c3e9b098e1 h2645_parse: only read avc length code at the correct position
Reading it from any other position would result in a wrong size being
read, instead fallback to the re-sync mechanic in the else clause.
2016-07-08 15:20:16 +02:00
Michael Niedermayer
b450b82514 avcodec/exr: Fix mixed declarations and statements
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-07 14:53:01 +02:00
Martin Vignali
50747d6b1f libavcodec/exr : indent gray support patch
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 23:53:28 +02:00
Martin Vignali
7ebd13fc8b libavodec/exr : add support for Y and YA file (ticket #5621)
a gray channel in exr, is named Y
we admit that the file need to be interpreted as gray
only if no other channel match (except alpha)

to manage RGB and Y in the color conversion part of decode_block,
the color processing is now made with a for loop.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 23:52:49 +02:00
Burt P
ba69a81019 libavfilter/af_hdcd.c: Collect HDCD stats and report
The new HDCD filter really does nothing to show that it is working or
that HDCD control information was even detected in the stream. This
patch collects information about the decode, like which features were
used, and reports it to the user at the end.

Also,
* Fixes low-level gain adjustment
* Updates the documentation

Signed-off-by: Burt P <pburt0@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 22:54:47 +02:00
Carl Eugen Hoyos
3e4357eb82 lavc/libx265: Support gray encoding.
Gray encoding crashes with libx265 <= 84, so check the library version.
2016-07-06 18:56:19 +02:00
Matthieu Bouron
88d9c30cf5 lavc/mediacodecdec_h264: properly convert extradata to annex-b
H264ParamSets has its SPS/PPS stored raw (SODB) and needs to be
converted to NAL units before sending them to MediaCodec.

This patch adds the missing convertion of the SPS/PPS from SOBP to RBSP
which makes the resulting NAL units correct.

Fixes codec initialization on Nexus 4 and Nexus 7.
2016-07-06 15:10:16 +02:00
Michael Niedermayer
55ef890b29 avcodec/iff: Print error for cols/bpp/bytes being bad in decode_delta_j()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 11:20:41 +02:00
Michael Niedermayer
fcdbbbd85a avcodec/iff: decode_delta_j: Check that the number of bytes that will be read are available
This should avoid long loops
related to CID1361958

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 11:19:41 +02:00
Petru Rares Sincraian
3f5b7a2d73 fate: add test for asetrate
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-06 01:20:21 +02:00
Carl Eugen Hoyos
420ba222c6 lavc/mjpeg_parser: Allow jpegls parsing.
Fixes ticket #5691.
2016-07-05 23:48:22 +02:00
James Almer
645489cf90 x86/dcadsp: optimize lfe_fir0_float_fma3 on x86_32
About 10% faster.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-05 17:48:20 -03:00
smitbose
d915b6e592 Added Quadrox format
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-05 02:31:35 +02:00
Martin Vignali
ce466d0a15 fate/apng : add test for apng decoding
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-05 01:48:00 +02:00
Martin Vignali
9cc114fa54 fate/png : add test for rgba64 and interleaved rgb
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-05 01:48:00 +02:00
Paul B Mahol
de30863fff avfilter/vf_rotate: add >8 bit depth support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-07-04 20:39:16 +02:00
Hendrik Leppkes
1ad4471526 configure: disable the new optimizer in Visual Studio 2015 Update 3
Visual Studio 2015 Update 3 introduced a new SSA optimizer, however
it unfortunately causes miscompilations. Until it is fixed, the new
optimizations are disabled and should be re-checked on subsequent
compiler releases.

Fixes recent FATE failure of fate-lavf-pam on VS2015.
2016-07-03 23:37:44 +02:00
James Almer
293484fa5e avcodec: add missing xmm/neon clobber test wrappers for the new decode API
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-03 18:04:30 -03:00
Clément Bœsch
64c619369b lavc/h264_slice: use sps directly when checking for invalid 8x8 inference 2016-07-03 15:11:40 +02:00
Carl Eugen Hoyos
d5edb6c048 lavf/aiffdec: Support QDMC demuxing. 2016-07-03 04:37:48 +02:00
Michael Graczyk
37941878f1 libopusenc: Add channel mapping family argument
The default value of -1 indicates that ffmpeg should determine the channel
mapping automatically, which was the behavior before this commit.

Unless the -mapping_family argument is provided, behavior is unchanged.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-02 23:31:16 +02:00
Michael Graczyk
a1e3c7cf0f libopusenc: Refactor to simplify forthcoming mapping_family parameter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-02 23:31:10 +02:00
Michael Niedermayer
fb6b6b5166 tests/checkasm/pixblockdsp: Test 8 byte aligned positions
The code is documented as to require 8byte alignment

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-02 22:21:53 +02:00
Michael Niedermayer
07f5e75a47 tests/fate: Add test for ticket 3386 ([H264] [Regression] illegal short term buffer state detected)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-02 21:37:48 +02:00
Michael Niedermayer
febc862b53 avcodec/h264_parser: Set sps/pps_ref
Fixes use of freed memory
Should fix valgrind failures of fate-h264-skip-nointra

Found-by: logan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-02 03:07:23 +02:00
James Almer
77eb05a2f1 avcodec/h264_slice: Only call ff_h264_flush_change() on initialized contexts
Changed by committer to ensure context_initialized is reset
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-01 21:39:09 +02:00
Martin Vignali
92bf87db29 fate/webp : add test for lossless picture to improve cover
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-01 20:58:51 +02:00
Clément Bœsch
5565e27111 Merge commit '6e92181bf836f48627a4733b6fd240a99fd36365'
* commit '6e92181bf836f48627a4733b6fd240a99fd36365':
  h264: pass just the PPS to get_chroma_qp()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-07-01 14:23:38 +02:00
Clément Bœsch
2021326f99 Merge commit 'd1f539c97e04e7cebecaf6916c5064f243d39fcf'
* commit 'd1f539c97e04e7cebecaf6916c5064f243d39fcf':
  h264: merge the two reinit blocks in slice_header_parse()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-07-01 14:19:09 +02:00
Clément Bœsch
99b37f53a1 Merge commit '3fba16ecd978d5bed338b8da643c3435e62b3437'
* commit '3fba16ecd978d5bed338b8da643c3435e62b3437':
  h264: factor starting a new field out of parsing the slice header

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-07-01 14:02:00 +02:00
Michael Niedermayer
2a8dadb38f doc/APIchanges: fill in missing git hash
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-01 02:42:03 +02:00
Michael Niedermayer
86fec7a7e8 doc/APIchanges: document the lavu/lavf field moves
Based-on: patch by James Almer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-01 02:11:47 +02:00
Michael Niedermayer
c1c7e0abb0 avformat/avformat: Move new field to the end of AVStream
This fixes part of Ticket5676
This fixes kodi, mpv, chromium and ffplay build against 3.0 and linked to 3.1

This is a similar ABI fix to 1eb43af1a0e542ad83dcbf327197785d815fc42d

Approved-by: BBB
Approved-by: jamrial
Approved-by: BtbN
Approved-by: nevcairiel
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 17:43:01 +02:00
Hendrik Leppkes
c2e13d2ecd avformat/utils: update deprecated AVStream->codec when the context is updated
This ensures the AVStream->codec entry is kept in sync when new streams are
discovered mid-playback or changes to the context occur from other sources.

Fixes trac 5678.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 17:43:01 +02:00
Michael Niedermayer
042fb69deb avutil/frame: Move new field to the end of AVFrame
This fixes part of Ticket5676
This fixes kodi, mpv, chromium and ffplay build against 3.0 and linked to 3.1

This is a similar ABI fix to 1eb43af1a0e542ad83dcbf327197785d815fc42d

Approved-by: BBB
Approved-by: jamrial
Approved-by: BtbN
Approved-by: nevcairiel
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 17:43:01 +02:00
Martin Vignali
d9e1e08133 libavcodec/exr : fix decoding piz float file.
fix ticket #5674

the size of data to process in piz_uncompress, is now calc
using the pixel type of each channel.

the data reorganization, alos take care about the size of
each channel

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 12:16:52 +02:00
Dan Parrot
1df908f33f PPC64: Add versions of functions in libswscale/input.c optimized for POWER8 VSX SIMD.
This patch addresses Trac ticket #5570. The optimized functions are in file
libswscale/ppc/input_vsx.c. Each optimized function name is a concatenation of the
corresponding name in libswscale/input.c with suffix _vsx.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 12:02:08 +02:00
Vadim Kalinsky
e370aad67d avformat/mov: Skip non-key frames if AVDISCARD_NONKEY is set.
Github: Closes #222
2016-06-30 12:00:13 +02:00
Clément Bœsch
f48aea66dd Merge commit 'bec993381cfec72051b0d9f12ac9d9bb9c750983'
* commit 'bec993381cfec72051b0d9f12ac9d9bb9c750983':
  h264: postpone generating the implicit MMCOs

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-30 10:24:03 +02:00
Clément Bœsch
d407e76c42 Merge commit '2d410ebbaa1e760d6837cb434a6d1d4c3c6f0d85'
* commit '2d410ebbaa1e760d6837cb434a6d1d4c3c6f0d85':
  h264: decode the MMCOs into per-slice contexts

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-30 10:15:51 +02:00
Benoit Fouet
879330c561 h264: make H264ParamSets sps const 2016-06-30 09:24:39 +02:00
Benoit Fouet
4cc1ce4a91 h264: straighten dimensions check ff_h264_decode_seq_parameter_set
The MBS only flag was not taken into account when checking macroblock dimensions.
Also removes the unneeded check in init_dimensions for slices.
2016-06-30 09:24:39 +02:00
Benoit Fouet
3e8cda1eb1 h264_ps: change decode_scaling_matrices so that it takes const {s,p}ps
In order to be able to make SPS const in H264ParamSets,
modify decode_scaling_matrices so that it returns if the scaling
matrix are present in the SPS, instead of altering the input SPS
structure.
2016-06-30 09:24:39 +02:00
Clément Bœsch
57d30fde9e Merge commit '39ab2ea53121b9976a619cd545fbd3464b908696'
* commit '39ab2ea53121b9976a619cd545fbd3464b908696':
  h264: rename mmco_index to nb_mmco

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-29 20:07:52 +02:00
Clément Bœsch
c28aecc56a Merge commit '7ab5d577a9affe3397c08b032f983f9bf7101865'
* commit '7ab5d577a9affe3397c08b032f983f9bf7101865':
  h264: move initializing the slice start out of h264_slice_header_parse()

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-29 20:04:23 +02:00
Petru Rares Sincraian
2b1995e3ee fate: add test for asetnsamples
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-29 19:32:37 +02:00
Timo Rothenpieler
1a75145559 lavfi: Move new field to the end of AVFilterContext
This fixes an accidental ABI break introduced at 8688d3a.
2016-06-29 18:23:28 +02:00
Clément Bœsch
4890b0851c Merge commit '4cec43a9eeb58eb9e581a2d9d25f78e5bfbb0960'
* commit '4cec43a9eeb58eb9e581a2d9d25f78e5bfbb0960':
  h264: move calculating the POC out of h264_slice_header_parse()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 17:59:57 +02:00
Clément Bœsch
9ab6f01839 Merge commit '6dd996c7c81575a1e4969987ab175a6df7beab3d'
* commit '6dd996c7c81575a1e4969987ab175a6df7beab3d':
  h264: move building the reference list out of h264_slice_header_parse()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 17:42:06 +02:00
Clément Bœsch
3b95452ca8 Merge commit '0bad254300356005af4aef00a706bf2e8eee96bc'
* commit '0bad254300356005af4aef00a706bf2e8eee96bc':
  h264: move initing the implicit pred weight table out of h264_slice_header_parse()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 17:39:33 +02:00
Clément Bœsch
2aff557c6a Merge commit 'ed9a20ebe4a89de119ea97bdccf688ece8c6648c' into merge-libav-new
* commit 'ed9a20ebe4a89de119ea97bdccf688ece8c6648c':
  h264: split reading the ref list modifications and actually building the ref list

ref_modifications.val are read as u32 instead of u8 in FFmpeg.

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 17:32:05 +02:00
Michael Niedermayer
89cccfc905 fate/h264: add test for skip-nointra and skip-nokey 2016-06-29 16:22:37 +02:00
Clément Bœsch
a2901472fe lavc/h264_slice: properly forward positive "error" code
Fixes ./ffmpeg -skip_frame nokey -i h264/h264_intra_first-small.ts

Regression since c54e2740e1f4a8fb7fa4e521755bf4158c4cda51
2016-06-29 16:16:26 +02:00
Clément Bœsch
cdecb39fca Merge commit 'fa57059079190242517701120cfdccad93c866da'
* commit 'fa57059079190242517701120cfdccad93c866da':
  h264: move initialising the implicit pred weight table for MBAFF

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 15:29:38 +02:00
Clément Bœsch
527a579327 Merge commit '7b50d60442af8d9527e9da46818011fe15a5265a'
* commit '7b50d60442af8d9527e9da46818011fe15a5265a':
  h264: call ff_h264_fill_mbaff_ref_list() when constructing the normal ref list

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 15:17:16 +02:00
Clément Bœsch
d7a2451688 Merge commit 'b16e9b9ac9db449cae2242767dd3c3fc309357c4'
* commit 'b16e9b9ac9db449cae2242767dd3c3fc309357c4':
  h264: move initialising the explicit pred weight table for MBAFF

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 15:03:12 +02:00
Clément Bœsch
7f607120d9 Merge commit 'b93c0aed79f7f942e0dec26e53c147f297ce2ff6'
* commit 'b93c0aed79f7f942e0dec26e53c147f297ce2ff6':
  h264: drop an outdated comment

This commit is a noop, see 237d31e0b98b95eef687e612177ca3ea24b709fc

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 15:00:01 +02:00
Clément Bœsch
3c5a3882f9 Merge commit '77a1e2c5f8f8250dfacff24b993eb473260ed13e'
* commit '77a1e2c5f8f8250dfacff24b993eb473260ed13e':
  h264: move direct mode inits out of h264_slice_header_parse()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 14:58:31 +02:00
Clément Bœsch
c54e2740e1 Merge commit 'd06e4d8aab9c679b6aea2591d2a9b382df9e5f74'
* commit 'd06e4d8aab9c679b6aea2591d2a9b382df9e5f74':
  h264: start splitting decode_slice_header()

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 14:55:02 +02:00
Michael Niedermayer
0c50f6905f avcodec/h264: Remove au_pps_id
This should not be needed anymore and simplifies the next merge

Requested-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-29 14:49:15 +02:00
Michael Niedermayer
e6e8750e94 avcodec/h264: Remove current_sps_id
This should not be needed anymore and simplifies the next merge

Requested-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-29 14:49:15 +02:00
Timo Rothenpieler
1eb43af1a0 lavfi: Move new field to the end of AVFilterLink
Even though this is not part of the public API, some external
applications access fields after it, thus breaking after updating from
ffmpeg 3.0 or earlier.
Since it is not public, it can be freely moved to the end to avoid
that problem in the future.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-29 12:53:07 +02:00
Timo Rothenpieler
1bd9fb6de5 ffplay: Fix usage of private lavfi API
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-29 12:53:01 +02:00
Clément Bœsch
6c841e03ce Merge commit '2940e196c5e439d9869f8c02a49a318d0847453c'
* commit '2940e196c5e439d9869f8c02a49a318d0847453c':
  vaapi_h265: cu_qp_delta should not be used in constant-QP mode

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:47 +02:00
Clément Bœsch
4b90413cb2 Merge commit '02fa1ad9266f9b1ea11565ac2f93f45853e351e8'
* commit '02fa1ad9266f9b1ea11565ac2f93f45853e351e8':
  vaapi_h264: Add source version identifier as unregistered SEI

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:40 +02:00
Clément Bœsch
cc3de390b7 Merge commit '48e2967cd50c2e1a2a539fd697d20ead2c5c4cc8'
* commit '48e2967cd50c2e1a2a539fd697d20ead2c5c4cc8':
  vaapi_h264: Add support for SEI messages

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:28 +02:00
Clément Bœsch
19fe328f12 Merge commit '19d7667a81499d4357ec8e0851701e17c238e584'
* commit '19d7667a81499d4357ec8e0851701e17c238e584':
  vaapi_encode: Add support for writing arbitrary additional packed headers

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:20 +02:00
Clément Bœsch
3e71e34333 Merge commit '081961f819c0b16c7a860d7da7d39f1fd91bd2f0'
* commit '081961f819c0b16c7a860d7da7d39f1fd91bd2f0':
  vaapi_h264: Add support for VUI parameters

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 12:03:06 +02:00
Clément Bœsch
fc0eafb7f8 Merge commit '2e4a7bd553ec7c805b4a3b90733405a14ba69072'
* commit '2e4a7bd553ec7c805b4a3b90733405a14ba69072':
  h264: drop unused H264Context.gb

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:56:57 +02:00
Clément Bœsch
bef74ef367 Merge commit '4f81f8dba735c212efae077c4fec8ad4fe53b352'
* commit '4f81f8dba735c212efae077c4fec8ad4fe53b352':
  Drop unnecessary golomb.h #includes

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:54:54 +02:00
Clément Bœsch
4b9574b275 Merge commit '197ae68e78784524a7ccf97a3c301092715305d3'
* commit '197ae68e78784524a7ccf97a3c301092715305d3':
  Drop unnecessary unary.h #includes

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:52:34 +02:00
Clément Bœsch
bf7d016219 Merge commit '6ac52f05a6fcadb84972c9557b28c67a416f866b'
* commit '6ac52f05a6fcadb84972c9557b28c67a416f866b':
  dvbsub_parser: Add missing mem.h #include

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:52:03 +02:00
Clément Bœsch
daedfa7254 Merge commit '81f769fa129edc51c28285649c2df6da717e718f'
* commit '81f769fa129edc51c28285649c2df6da717e718f':
  gsm: Move requant_tab table to the gsm tables file

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:48:53 +02:00
Clément Bœsch
0501305e38 Merge commit '42dc214323637464759354912e18b2bee1884dd1'
* commit '42dc214323637464759354912e18b2bee1884dd1':
  mpc: Drop unused GetBitContext context member

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:46:36 +02:00
Clément Bœsch
c7253353f8 Merge commit '85b8403c6fd11e1c570caa970c7f435ac5f9583e'
* commit '85b8403c6fd11e1c570caa970c7f435ac5f9583e':
  svq1enc: Drop unused GetBitContext context member

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:45:37 +02:00
Clément Bœsch
f8beca6f10 Merge commit '6d8fd614ff957af242efcd8a6a0619874382f3a4'
* commit '6d8fd614ff957af242efcd8a6a0619874382f3a4':
  vorbis: Kill some pointless debug code

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:43:57 +02:00
Clément Bœsch
9afa64dfdf Merge commit '59c6509d9f0236acbc317198eab76dab8320bced'
* commit '59c6509d9f0236acbc317198eab76dab8320bced':
  mss2: Drop a silly assert

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:42:42 +02:00
Clément Bœsch
f755aa5ebd lavc: move 2 more BITSTREAM_READER_LE definitions
This was mentioned to be in ae753dbd0de448b51f0e0b980c26b94747ec44f5 but
actually wasn't.
2016-06-29 11:41:12 +02:00
Clément Bœsch
ae753dbd0d Merge commit 'b668662939de3a02454cfc9ba3e6d10b87527a40'
* commit 'b668662939de3a02454cfc9ba3e6d10b87527a40':
  get_bits: Move BITSTREAM_READER_LE definition before all relevant #includes

The merge commit also includes changes for libavcodec/interplayacm.c and
libavcodec/truemotion2rt.c

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:35:10 +02:00
Clément Bœsch
543142990b Merge commit '09c4e5c5988c0037d108c5fc2a137d9ad488f7f4'
* commit '09c4e5c5988c0037d108c5fc2a137d9ad488f7f4':
  indeo2: Drop disabled big-endian ir2_codes table

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:20:20 +02:00
Clément Bœsch
9b35242370 Merge commit 'b7f98659f21dce438c33b512e25fd64b8d07c347'
* commit 'b7f98659f21dce438c33b512e25fd64b8d07c347':
  Remove unnecessary get_bits.h #includes

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:16:01 +02:00
Clément Bœsch
1994a73a6b Merge commit '2a48a75a6f508121b96b0732a9fe03a46303f579'
* commit '2a48a75a6f508121b96b0732a9fe03a46303f579':
  sgirledec: simplify, no need to use reget buffer

This commit is a noop, see ccc3f4e7104eda0f72436720ebcdc2e916217c7a

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:09:36 +02:00
Clément Bœsch
ee7d01e81a Merge commit '6e2ad28cf76461b02d85ad178087ba0c628b8d9d'
* commit '6e2ad28cf76461b02d85ad178087ba0c628b8d9d':
  aic: add frame threading support

This commit is a noop, see 8e069eb525d46b8f89089e37fc7ac81b2d9b1092

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:07:41 +02:00
Clément Bœsch
dd1b1e3223 Merge commit 'c3ed259e4fef64a1af4f6537be545fba47491aa9'
* commit 'c3ed259e4fef64a1af4f6537be545fba47491aa9':
  fate: Move Canopus decoder tests to a separate file

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:05:49 +02:00
Matthieu Bouron
db0af7250a lavc/mediacodecdec_h264: add missing NAL headers to SPS/PPS buffers
Fixes a regression introduced by 0cd5e281df3f69c1ed8f2a72a5bcbf9691e1b5d5.
2016-06-29 10:46:29 +02:00
Michael Niedermayer
8a3221cc67 avformat/mov: Check sample size
Fixes integer overflow
Fixes: poc.mp4

Found-by: ajax secure <ajax4sec@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-29 00:30:55 +02:00
Martin Vignali
2bdb26b4ee fate/webp : add test for lossy compression.
the result of ffmpeg decoding is binary exact with the yuv output of
official decoder (dwebp)

Signed-off-by: James Almer <jamrial@gmail.com>
2016-06-28 18:21:12 -03:00
Michael Niedermayer
c0cb53cd1f avdevice/decklink_common: Replace rare spelling of Succesfully by 500 times more common one
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-28 03:07:54 +02:00
Michael Niedermayer
6cc4c42226 avcodec/ccaption_dec: Fix mixed declaration and statement.
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-28 02:33:03 +02:00
Aman Gupta
4448f16ef5 avcodec/ccaption_dec: implement tab offset commands
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-28 01:52:31 +02:00
Michael Niedermayer
0a72b69889 MAINTAINERS: remove 2.4 as 3.1 was released
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-27 22:51:39 +02:00
Clément Bœsch
8b4d6cc809 Merge commit '20a8c78ce0a5baf37f6a94e2d1e57e186b6f4b54'
* commit '20a8c78ce0a5baf37f6a94e2d1e57e186b6f4b54':
  avconv: Do not copy extradata if source buffer is empty

This commit is a noop, see 4d02dfbde475d249916eb19c360e890059aa6aa5

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-27 20:10:35 +02:00
Clément Bœsch
e6d0acd438 Merge commit '38f99017e69bd25e88be87117237c29727c25635'
* commit '38f99017e69bd25e88be87117237c29727c25635':
  vp9: Return the correct size when decoding a superframe

This commit is a noop, see c2f3715cb3fce093137591e3005de3e831b1f9fd

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-27 19:54:37 +02:00
Clément Bœsch
85a52a77ce Merge commit 'b2d5d6a7f20a255a5f3c9bf539cc507afd909ce5'
* commit 'b2d5d6a7f20a255a5f3c9bf539cc507afd909ce5':
  build: Only enable symbol reduction if the compiler does proper DCE

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-27 19:48:21 +02:00
Clément Bœsch
da7c918e80 Merge commit 'c5fd4b50610f62cbb3baa4f4108139363128dea1'
* commit 'c5fd4b50610f62cbb3baa4f4108139363128dea1':
  build: Simplify postprocessing of linker version script files

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-27 19:39:46 +02:00
Clément Bœsch
c5566f0a94 lavc/pnm_parser: disable parsing for text based PNMs
P1, P2, and P3 are respectively the text versions of PBM, PGM and PPM
files.

We can not obtain the buffer size using av_imgage_get_buffer_size() as
every pixel in the picture will occupy a random size between 16 and 32
bits ("4 " and "231 " are such example).

Ideally, we could look for the next header (or EOF) in the bytestream,
but this commit is meant to fix a decoding regression introduced by
48ac4532d437790e56b8ed5d0d467dc88685f035.

Fix Ticket #5670
2016-06-27 18:04:50 +02:00
Matthieu Bouron
0acc170aad Merge commit '535a742c2695a9e0c586b50d7fa76e318232ff24'
* commit '535a742c2695a9e0c586b50d7fa76e318232ff24':
  build: Change structure of the linker version script templates

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-06-27 17:56:47 +02:00
Rick Kern
d956171813 Changelog: Add VideoToolbox encoder entry for 3.1
Signed-off-by: Rick Kern <kernrj@gmail.com>
2016-06-27 11:43:13 -04:00
Matthieu Bouron
0fd76d77d6 Merge commit '5b1b495c8d21600eac694d50f428654a3125e217'
* commit '5b1b495c8d21600eac694d50f428654a3125e217':
  build: Print a message when generating version scripts

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-06-27 17:35:04 +02:00
Matthieu Bouron
9eb3da2f99 asm: FF_-prefix internal macros used in inline assembly
See merge commit '39d6d3618d48625decaff7d9bdbb45b44ef2a805'.
2016-06-27 17:21:18 +02:00
Matthieu Bouron
39d6d3618d Merge commit '1e9c5bf4c136fe9e010cc8a7e7270bba0d1bf45e'
* commit '1e9c5bf4c136fe9e010cc8a7e7270bba0d1bf45e':
  asm: FF_-prefix internal macros used in inline assembly

This commit is a noop as the ASM codebase differs too much between libav
and ffmpeg. The corresponding chunks will be found in the next commit.

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-06-27 17:18:25 +02:00
Paul B Mahol
d693392886 avformat/mov: parse rtmd track timecode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-27 10:27:25 +02:00
Marton Balint
b18d6c5800 avdevice/decklink: fix mingw portability
Fixes ticket #5669.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-27 02:12:07 +02:00
Rick Kern
729d82abae configure: use c++98 for c++ files
Use c++98 standard instead of c++11.

Signed-off-by: Rick Kern <kernrj@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-26 23:25:23 +02:00
Martin Vignali
bd2cec7021 fate/webp : add test for webp lossless decoding (rgb and rgba)
output have been compared with official decoding tool output (dwebp)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-26 21:12:33 +02:00
Martin Vignali
971ee09d32 fate/exr : add tests for file with half and float channels
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-26 21:12:32 +02:00
James Almer
c6f2d1a21f changelog: fix entry order
Signed-off-by: James Almer <jamrial@gmail.com>
2016-06-26 15:27:47 -03:00
James Almer
069fd69662 Update FFmpeg 3.1 cut marker
Signed-off-by: James Almer <jamrial@gmail.com>
2016-06-26 14:45:54 -03:00
Marton Balint
cf0a05668b avdevice/decklink: add support for setting input packet timestamp source
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:18:06 +02:00
Marton Balint
da89c6e37c avdevice/decklink: add support for audio and video input selection
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:18:02 +02:00
Marton Balint
8f9fa49bd8 avdevice/decklink: add support for setting duplex mode
This patch also makes BlackMagic drivers v10.6.1 a hard requirement.

Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:56 +02:00
Marton Balint
e22760aafd avdevice/decklink: always free decklink resources on error
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:52 +02:00
Marton Balint
38d75fe906 avdevice/decklink: factorize device finder function
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:45 +02:00
Marton Balint
4ce0a77ec8 avdevice/decklink: remove unused itermode iterators
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:40 +02:00
Marton Balint
1fc85d8511 avdevice/decklink: factorize cleanup function to common code
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:37 +02:00
Marton Balint
340cea9f22 avdevice/decklink_dec: fix bitrate calculations
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:29 +02:00
Anton Khirnov
606fb6c032 h264: call the hwaccel frame_start() from h264_field_start()
This is a more appropriate place for it.
2016-06-21 11:19:51 +02:00
Anton Khirnov
d1d7678040 h264: fix the check for mixed IDR/non-IDR slices 2016-06-21 11:19:19 +02:00
Anton Khirnov
b13fc1e344 h264: do not pass H264Context to h264_slice_header_parse()
This should make it more clear that this function does not need any
decoder-global state other than the parameter sets.
2016-06-21 11:18:44 +02:00
Anton Khirnov
996f13413b h264: fix warnings in fill_filter_caches_inter()
The code does some weird casting to a 2-dimensional sub-array of
ref2frm. This is not necessary, since only one dimension is needed
there.
2016-06-21 11:18:15 +02:00
Anton Khirnov
bc7f426851 h264: drop tests whether the codec id is AV_CODEC_ID_H264
Those are unused remnants of the old SVQ3 code.
2016-06-21 11:17:59 +02:00
Anton Khirnov
8281cd5cb8 h264_cabac: drop an always true condition 2016-06-21 11:17:53 +02:00
Anton Khirnov
5c2fb561d9 h264: add H264_ prefix to the NAL unit types
This will prevent conflicts e.g. in code that deals with both h264 and
hevc.
2016-06-21 11:17:28 +02:00
Anton Khirnov
1cf2f3d334 h264_sei: drop an unnecessary h264dec.h include
The code does not depend on the h264 decoder anymore and only needs
information from h264_ps
2016-06-21 11:15:44 +02:00
Anton Khirnov
b24dafe105 lavc: drop unnecessary h264dec.h includes 2016-06-21 11:15:11 +02:00
Anton Khirnov
70b1dcef2d h264: tighten the valid range for ref_frame_count
This field (which the spec calls max_num_ref_frames) must be less than
or equal to MaxDpbFrames, which is at most 16.
2016-06-21 11:14:07 +02:00
Anton Khirnov
f638b67e57 h264: move the parameter set definitions to a new header file
The PS parsing code is independent from the decoder, so it makes more
sense for it to have its own separate header.
2016-06-21 11:13:29 +02:00
Anton Khirnov
4e2f621248 svq3: stop using H264Picture
The SVQ3 decoder has been decoupled from the H.264 decoder, so it can
now use its own data type.
2016-06-21 11:13:08 +02:00
Anton Khirnov
251cbb4400 h264: create a new header for common h264 definitions
Move the NAL unit types into it. This will allow to stop including the
whole decoder-specific h264dec.h in some code that is unrelated to the
decoder and only needs some enum values.
2016-06-21 11:12:41 +02:00
Anton Khirnov
9df889a5f1 h264: rename h264.[ch] to h264dec.[ch]
This is more consistent with the naming of other decoders.
2016-06-21 11:11:26 +02:00
Anton Khirnov
f651c6a259 h264: factor out setting frame properties / side data
Right now this code is mixed with selecting the next output frame. Move
it to a separate function called from h264_field_start(), which is a
more appropriate place for this.
2016-06-21 11:10:58 +02:00
Anton Khirnov
19446dc5ff h264: drop unused NAL_FF_IGNORE 2016-06-21 11:10:46 +02:00
Anton Khirnov
bcd91f1644 h264: move a per-field block from decode_slice_header() to field_start()
This is a more appropriate place for it.
2016-06-21 11:10:29 +02:00
Anton Khirnov
17e7c03e12 h264: only allow ending a field/starting a new one before finish_setup()
Doing this after ff_thread_finish_setup() is called is invalid and can
conflict with reads from the other thread.
2016-06-21 11:10:00 +02:00
Anton Khirnov
debca90863 h264: store {curr,max}_pic_num in the per-slice context
While the value of those variables will be constant for the whole frame,
they are only used in two functions called from slice header decoding.
Moving them to the per-slice context allows us to make the H264Context
passed to slice_header_parse() constant.
2016-06-21 11:09:21 +02:00
Anton Khirnov
f966498e43 h264: decode the poc values from the slice header into the per-slice context
Copy them into the decoder-global context in field_start(). This avoids
modifying the decoder-global context during bitstream parsing.
2016-06-21 11:08:56 +02:00
Anton Khirnov
54dd9b1cdd h264: set mb_aff_frame in frame_start()
Avoid unnecessary modification of the decoder-global state in per-slice
code.
2016-06-21 11:08:32 +02:00
Anton Khirnov
8d36932c8d h264: move the block starting a new field out of slice_header_parse()
There is no bitstream parsing in that block and messing with
decoder-global state is not something that belongs into header parsing.

Nothing else in this function depends on the value of current_slice,
except for two validity checks. Those checks are also moved out of
slice_header_parse().
2016-06-21 11:08:03 +02:00
Anton Khirnov
b25cd7540e h264: pass a H2645NAL to slice header decoding
Replace the decoder-global nal_unit_type/nal_ref_idc variables with the
per-NAL ones. The decoder-global ones still cannot be removed because
they are used by hwaccels.
2016-06-21 11:07:10 +02:00
Vittorio Giovara
523c4c5b70 fate: Add TrueMotion 2 RT tests 2016-06-20 15:51:34 -04:00
Vittorio Giovara
906ffed9b1 fate: Move Duck Truemotion 1 and 2 tests to vpx.mak 2016-06-20 15:49:09 -04:00
Paul B Mahol
470cd0c5fe Add TrueMotion 2.0 Real Time decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-20 15:48:12 -04:00
Vittorio Giovara
cc58656aca fate: Add tests for MagicYUV 2016-06-20 15:47:23 -04:00
Paul B Mahol
d78fd2fa21 Add MagicYUV decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-20 15:45:51 -04:00
Jerome Martinez
ec9f04423b ffv1: Error out on unsupported format
Transparency is supported only by YUV and within specific bit depths.
2016-06-18 12:46:43 +02:00
Martin Storsjö
105998fb5c 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>
2016-06-17 21:37:56 +03:00
Vittorio Giovara
846a3e78a5 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.
2016-06-17 11:38:33 -04:00
Vittorio Giovara
7672997004 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
now.

This is implemented only in non-fragmented MOVs.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-17 11:38:33 -04:00
Vittorio Giovara
187d719760 h264: Support AV_PKT_DATA_NEW_EXTRADATA 2016-06-17 11:05:33 -04:00
Vittorio Giovara
75872d77d2 lavc: Document AV_PKT_DATA_NEW_EXTRADATA 2016-06-17 11:02:40 -04:00
Martin Storsjö
f1a9eee41c x86: Add missing movsxd for the int stride parameter
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-06-17 00:11:21 +03:00
Diego Biurrun
a2ddfadc2d avdevice: Ignore timefilter test program 2016-06-14 11:14:06 +02:00
Diego Biurrun
d6c2c2796d LICENSE: Fix silly typo 2016-06-14 11:14:06 +02:00
Diego Biurrun
84b2d3fb68 h264: Drop unused function check_opcodes() 2016-06-14 11:14:06 +02:00
Vittorio Giovara
05a4bacbf7 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>
2016-06-13 13:31:21 -04:00
Vittorio Giovara
bcc07e2576 pixdesc: Use C99 array to list color properties names 2016-06-13 11:51:18 -04:00
Anton Mitrofanov
a833ff68f6 h264: Fix decoding delay for Intra only streams
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-06-12 20:29:29 +02:00
Anton Khirnov
90f469aa2b lavc: add H.264 MVC profiles 2016-06-12 20:27:53 +02:00
Anton Khirnov
61f168ae34 h264: factor out setting the parameter sets for a frame 2016-06-12 20:27:53 +02:00
Anton Khirnov
6e92181bf8 h264: pass just the PPS to get_chroma_qp()
It does not need the whole context. This will simplify the following
commit.
2016-06-12 20:27:53 +02:00
Anton Khirnov
d1f539c97e 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.
2016-06-12 20:27:53 +02:00
Anton Khirnov
3fba16ecd9 h264: factor starting a new field out of parsing the slice header 2016-06-12 20:27:53 +02:00
Anton Khirnov
bec993381c 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().
2016-06-12 20:27:53 +02:00
Anton Khirnov
2d410ebbaa 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.
2016-06-12 20:27:53 +02:00
Anton Khirnov
39ab2ea531 h264: rename mmco_index to nb_mmco
The variable stores the number of mmco entries, so the current name is
misleading.
2016-06-12 20:27:53 +02:00
Anton Khirnov
7ab5d577a9 h264: move initializing the slice start out of h264_slice_header_parse() 2016-06-12 20:27:53 +02:00
Anton Khirnov
4cec43a9ee 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.
2016-06-12 20:27:52 +02:00
Anton Khirnov
6dd996c7c8 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.
2016-06-12 20:27:52 +02:00
Anton Khirnov
0bad254300 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.
2016-06-12 20:27:52 +02:00
Anton Khirnov
ed9a20ebe4 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.
2016-06-12 20:27:52 +02:00
Anton Khirnov
fa57059079 h264: move initialising the implicit pred weight table for MBAFF
Do it where the normal implicit table is initialised.
2016-06-12 20:27:52 +02:00
Anton Khirnov
7b50d60442 h264: call ff_h264_fill_mbaff_ref_list() when constructing the normal ref list
There is no real reason to call it separately.
2016-06-12 20:27:52 +02:00
Anton Khirnov
b16e9b9ac9 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.
2016-06-12 20:27:52 +02:00
Anton Khirnov
b93c0aed79 h264: drop an outdated comment 2016-06-12 20:27:52 +02:00
Anton Khirnov
77a1e2c5f8 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.
2016-06-12 20:27:52 +02:00
Anton Khirnov
d06e4d8aab 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
necessary.

Begin splitting the code that configures the decoder state based on the
slice header information from the parsing of the slice header.
2016-06-12 20:27:52 +02:00
Mark Thompson
2940e196c5 vaapi_h265: cu_qp_delta should not be used in constant-QP mode 2016-06-09 21:15:39 +01:00
Mark Thompson
02fa1ad926 vaapi_h264: Add source version identifier as unregistered SEI
Contains the libavcodec version, the VAAPI version and the libva
driver vendor string.
2016-06-09 21:15:39 +01:00
Mark Thompson
48e2967cd5 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.
2016-06-09 21:15:39 +01:00
Mark Thompson
19d7667a81 vaapi_encode: Add support for writing arbitrary additional packed headers 2016-06-09 21:15:39 +01:00
Mark Thompson
081961f819 vaapi_h264: Add support for VUI parameters
Supports aspect ratio, colour format and timing information.
2016-06-09 21:15:39 +01:00
Anton Khirnov
2e4a7bd553 h264: drop unused H264Context.gb
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-06-09 11:19:15 +02:00
Diego Biurrun
4f81f8dba7 Drop unnecessary golomb.h #includes 2016-06-08 18:51:57 +02:00
Diego Biurrun
197ae68e78 Drop unnecessary unary.h #includes 2016-06-08 18:51:56 +02:00
Diego Biurrun
6ac52f05a6 dvbsub_parser: Add missing mem.h #include 2016-06-08 18:51:56 +02:00
Diego Biurrun
81f769fa12 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.
2016-06-07 13:22:22 +02:00
Diego Biurrun
42dc214323 mpc: Drop unused GetBitContext context member 2016-06-07 13:09:57 +02:00
Diego Biurrun
85b8403c6f svq1enc: Drop unused GetBitContext context member 2016-06-07 13:09:57 +02:00
Diego Biurrun
6d8fd614ff vorbis: Kill some pointless debug code 2016-06-07 13:09:57 +02:00
Diego Biurrun
59c6509d9f mss2: Drop a silly assert 2016-06-07 13:09:57 +02:00
Diego Biurrun
b668662939 get_bits: Move BITSTREAM_READER_LE definition before all relevant #includes
This avoids the danger that get_bits.h might get indirectly #included before
BITSTREAM_READER_LE is defined.

Also sort headers into canonical order where appropriate.
2016-06-07 13:09:57 +02:00
Diego Biurrun
09c4e5c598 indeo2: Drop disabled big-endian ir2_codes table
Only the little-endian variant of the table is ever used.
2016-06-07 13:09:57 +02:00
Diego Biurrun
b7f98659f2 Remove unnecessary get_bits.h #includes 2016-06-07 13:09:57 +02:00
Paul B Mahol
2a48a75a6f sgirledec: simplify, no need to use reget buffer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-06 12:05:02 -04:00
Paul B Mahol
6e2ad28cf7 aic: add frame threading support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-06 12:03:20 -04:00
Vittorio Giovara
c3ed259e4f fate: Move Canopus decoder tests to a separate file
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-06 11:59:53 -04:00
Vittorio Giovara
20a8c78ce0 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>
2016-06-06 11:56:21 -04:00
Denis Charmet
38f99017e6 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>
2016-06-05 16:58:04 +02:00
Diego Biurrun
b2d5d6a7f2 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
2016-05-30 14:59:43 +02:00
Diego Biurrun
c5fd4b5061 build: Simplify postprocessing of linker version script files
Generate the files in a single postprocessing step w/o intermediate files.
2016-05-29 16:49:16 +02:00
Diego Biurrun
535a742c26 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.
2016-05-29 16:43:11 +02:00
Diego Biurrun
5b1b495c8d build: Print a message when generating version scripts 2016-05-29 15:09:05 +02:00
Diego Biurrun
1e9c5bf4c1 asm: FF_-prefix internal macros used in inline assembly
These warnings conflict with system macros on Solaris, producing
truckloads of warnings about macro redefinition.
2016-05-28 19:18:26 +02:00
450 changed files with 15428 additions and 6659 deletions

View File

@ -2,7 +2,16 @@ Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version <next>:
- YUY2 Lossless Codec decoder
- libopenmpt demuxer
- tee protocol
- Changed metadata print option to accept general urls
- Alias muxer for Ogg Video (.ogv)
- VP8 in Ogg muxing
- curves filter doesn't automatically insert points at x=0 and x=1 anymore
- 16-bit support in curves filter
- 16-bit support in selectivecolor filter
- OpenH264 decoder wrapper
- MediaCodec hwaccel
version 3.1:
@ -48,6 +57,8 @@ version 3.1:
- CUDA CUVID H264/HEVC decoder
- 10-bit depth support in native utvideo decoder
- libutvideo wrapper removed
- YUY2 Lossless Codec decoder
- VideoToolbox H.264 encoder
version 3.0:

View File

@ -43,7 +43,7 @@ Miscellaneous Areas
===================
documentation Stefano Sabatini, Mike Melanson, Timothy Gu, Lou Logan
project server Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser
project server Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser, Nikolay Aleksandrov
presets Robert Swain
metadata subsystem Aurelien Jacobs
release management Michael Niedermayer
@ -147,7 +147,7 @@ Codecs:
celp_filters.* Vitor Sessak
cinepak.c Roberto Togni
cinepakenc.c Rl / Aetey G.T. AB
ccaption_dec.c Anshul Maheshwari
ccaption_dec.c Anshul Maheshwari, Aman Gupta
cljr Alex Beregszaszi
cpia.c Stephan Hilb
crystalhd.c Philip Langdale
@ -308,6 +308,7 @@ Filters:
af_chorus.c Paul B Mahol
af_compand.c Paul B Mahol
af_firequalizer.c Muhammad Faiz
af_hdcd.c Burt P.
af_ladspa.c Paul B Mahol
af_loudnorm.c Kyle Swanson
af_pan.c Nicolas George
@ -402,6 +403,7 @@ Muxers/Demuxers:
jvdec.c Peter Ross
libmodplug.c Clément Bœsch
libnut.c Oded Shimon
libopenmpt.c Josh de Kock
lmlm4.c Ivo van Poorten
lvfdec.c Paul B Mahol
lxfdec.c Tomas Härdin
@ -520,7 +522,6 @@ Releases
2.7 Michael Niedermayer
2.6 Michael Niedermayer
2.5 Michael Niedermayer
2.4 Michael Niedermayer
If you want to maintain an older release, please contact us
@ -546,6 +547,7 @@ Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
Nikolay Aleksandrov 8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1
Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
Philip Langdale 5DC5 8D66 5FBA 3A43 18EC 045E F8D6 B194 6A75 682E

View File

@ -83,12 +83,7 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
%.h.c:
$(Q)echo '#include "$*.h"' >$@
%.ver: %.v
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ | sed -e 's/:/:\
/' -e 's/; /;\
/g' > $@
%.c %.h: TAG = GEN
%.c %.h %.ver: TAG = GEN
# Dummy rule to stop make trying to rebuild removed or renamed headers
%.h:
@ -152,7 +147,7 @@ $(TOOLOBJS): | tools
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS))
CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ver-sol2 *.ho *.gcno *.gcda *$(DEFAULT_YASMD).asm
CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.ho *$(DEFAULT_YASMD).asm
DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a

63
configure vendored
View File

@ -245,6 +245,7 @@ External library support:
--enable-libopencv enable video filtering via libopencv [no]
--enable-libopenh264 enable H.264 encoding via OpenH264 [no]
--enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
--enable-libopenmpt enable decoding tracked files via libopenmpt [no]
--enable-libopus enable Opus de/encoding via libopus [no]
--enable-libpulse enable Pulseaudio input via libpulse [no]
--enable-librubberband enable rubberband needed for rubberband filter [no]
@ -1505,6 +1506,7 @@ EXTERNAL_LIBRARY_LIST="
libopencv
libopenh264
libopenjpeg
libopenmpt
libopus
libpulse
librtmp
@ -2211,6 +2213,8 @@ setend_deps="arm"
map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
loongson2_deps="mips"
loongson3_deps="mips"
mipsfpu_deps="mips"
mipsdsp_deps="mips"
mipsdspr2_deps="mips"
@ -2555,6 +2559,7 @@ h264_d3d11va_hwaccel_select="h264_decoder"
h264_dxva2_hwaccel_deps="dxva2"
h264_dxva2_hwaccel_select="h264_decoder"
h264_mediacodec_decoder_deps="mediacodec"
h264_mediacodec_hwaccel_deps="mediacodec"
h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
h264_mmal_decoder_deps="mmal"
h264_mmal_decoder_select="mmal"
@ -2766,9 +2771,12 @@ libopencore_amrnb_decoder_deps="libopencore_amrnb"
libopencore_amrnb_encoder_deps="libopencore_amrnb"
libopencore_amrnb_encoder_select="audio_frame_queue"
libopencore_amrwb_decoder_deps="libopencore_amrwb"
libopenh264_decoder_deps="libopenh264"
libopenh264_decoder_select="h264_mp4toannexb_bsf"
libopenh264_encoder_deps="libopenh264"
libopenjpeg_decoder_deps="libopenjpeg"
libopenjpeg_encoder_deps="libopenjpeg"
libopenmpt_demuxer_deps="libopenmpt"
libopus_decoder_deps="libopus"
libopus_encoder_deps="libopus"
libopus_encoder_select="audio_frame_queue"
@ -2854,6 +2862,7 @@ nut_muxer_select="riffenc"
nuv_demuxer_select="riffdec"
oga_muxer_select="ogg_muxer"
ogg_demuxer_select="dirac_parse"
ogv_muxer_select="ogg_muxer"
opus_muxer_select="ogg_muxer"
psp_muxer_select="mov_muxer"
rtp_demuxer_select="sdp_demuxer"
@ -3148,6 +3157,7 @@ objformat="elf"
pkg_config_default=pkg-config
ranlib_default="ranlib"
strip_default="strip"
version_script='--version-script'
yasmexe_default="yasm"
windres_default="windres"
@ -3209,6 +3219,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
VERSION_SCRIPT_POSTPROCESS_CMD="cat"
asflags_filter=echo
cflags_filter=echo
@ -3793,11 +3804,11 @@ suncc_flags(){
westmere) echo -xtarget=westmere ;;
silvermont) echo -xarch=sse4_2 ;;
corei7-avx|sandybridge) echo -xtarget=sandybridge ;;
core-avx*|ivybridge|haswell|broadwell)
core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
echo -xarch=avx ;;
amdfam10|barcelona) echo -xtarget=barcelona ;;
btver1) echo -xarch=amdsse4a ;;
btver2|bdver*) echo -xarch=avx ;;
btver2|bdver*|znver*) echo -xarch=avx ;;
athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
k8|opteron|athlon64|athlon-fx)
echo -xarch=sse2a ;;
@ -4493,7 +4504,8 @@ elif enabled x86; then
;;
# targets that do support nopl and conditional mov (cmov)
i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
|core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|amdfam10|barcelona|b[dt]ver*)
|core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
|amdfam10|barcelona|b[dt]ver*|znver*)
cpuflags="-march=$cpu"
enable i686
enable fast_cmov
@ -4529,7 +4541,7 @@ fi
add_cppflags -D_ISOC99_SOURCE
add_cxxflags -D__STDC_CONSTANT_MACROS
add_cxxflags -std=c++11
add_cxxflags -std=c++98
check_cflags -std=c99
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
#include <stdlib.h>
@ -4627,7 +4639,8 @@ case $target_os in
echo "hwcap_1 = OVERRIDE;" > mapfile &&
add_ldflags -Wl,-M,mapfile
nm_default='nm -P -g'
SLIB_CREATE_DEF_CMD='$(Q)perl $(SRC_PATH)/compat/solaris/make_sunver.pl $$(filter %.ver,$$^) $(OBJS) | grep -v @ > $(SUBDIR)lib$(NAME).ver-sol2'
version_script='-M'
VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
;;
netbsd)
disable symver
@ -5625,7 +5638,8 @@ enabled cuvid && { check_lib cuviddec.h cuvidCreateDecoder -lnvcuvid
enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
enabled coreimage_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimage_filter; }
enabled coreimagesrc_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimagesrc_filter; }
enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; }
enabled decklink && { { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; } &&
{ check_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } }
enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
enabled gmp && require2 gmp gmp.h mpz_export -lgmp
enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
@ -5674,6 +5688,7 @@ enabled libopenjpeg && { check_lib openjpeg-2.1/openjpeg.h opj_version -lo
check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
die "ERROR: libopenjpeg not found"; }
enabled libopenmpt && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
@ -6023,6 +6038,8 @@ enabled neon_clobber_test &&
-Wl,--wrap,avcodec_decode_subtitle2 \
-Wl,--wrap,avcodec_encode_audio2 \
-Wl,--wrap,avcodec_encode_video2 \
-Wl,--wrap,avcodec_send_packet \
-Wl,--wrap,avcodec_receive_frame \
-Wl,--wrap,avcodec_encode_subtitle \
-Wl,--wrap,swr_convert \
-Wl,--wrap,avresample_convert ||
@ -6036,26 +6053,33 @@ enabled xmm_clobber_test &&
-Wl,--wrap,avcodec_encode_audio2 \
-Wl,--wrap,avcodec_encode_video2 \
-Wl,--wrap,avcodec_encode_subtitle \
-Wl,--wrap,avcodec_send_packet \
-Wl,--wrap,avcodec_receive_frame \
-Wl,--wrap,swr_convert \
-Wl,--wrap,avresample_convert \
-Wl,--wrap,sws_scale ||
disable xmm_clobber_test
echo "X { local: *; };" > $TMPV
if test_ldflags -Wl,--version-script,$TMPV; then
append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
elif test_ldflags -Wl,-M,$TMPV; then
append SHFLAGS '-Wl,-M,\$(SUBDIR)lib\$(NAME).ver-sol2'
fi
check_ld "cc" <<EOF && enable proper_dce
extern const int array[512];
static inline int func(void) { return array[0]; }
int main(void) { return 0; }
EOF
check_cc <<EOF && enable symver_asm_label
if enabled proper_dce; then
echo "X { local: *; };" > $TMPV
if test_ldflags -Wl,${version_script},$TMPV; then
append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
check_cc <<EOF && enable symver_asm_label
void ff_foo(void) __asm__ ("av_foo@VERSION");
void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
EOF
check_cc <<EOF && enable symver_gnu_asm
check_cc <<EOF && enable symver_gnu_asm
__asm__(".symver ff_foo,av_foo@VERSION");
void ff_foo(void) {}
EOF
fi
fi
if [ -z "$optflags" ]; then
if enabled small; then
@ -6125,11 +6149,7 @@ elif enabled ccc; then
add_cflags -msg_disable nonstandcast
add_cflags -msg_disable unsupieee
elif enabled gcc; then
case $gcc_basever in
4.9*) enabled x86 || check_optflags -fno-tree-vectorize ;;
4.*) check_optflags -fno-tree-vectorize ;;
*) enabled x86 || check_optflags -fno-tree-vectorize ;;
esac
check_optflags -fno-tree-vectorize
check_cflags -Werror=format-security
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes
@ -6194,6 +6214,10 @@ __declspec($_restrict) void* foo(int);
EOF
fi
check_func strtoll || add_cflags -Dstrtoll=_strtoi64
# the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code
# this flag should be re-checked on newer compiler releases and put under a
# version check once its fixed
check_cflags -d2SSAOptimizer-
fi
for pfx in "" host_; do
@ -6587,6 +6611,7 @@ SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
SAMPLES:=${samples:-\$(FATE_SAMPLES)}
NOREDZONE_FLAGS=$noredzone_flags
EOF

View File

@ -15,14 +15,33 @@ libavutil: 2015-08-28
API changes, most recent first:
2016-06-26 - xxxxxxx / 1c9e861 - lavu 55.27.100 / 55.13.0 - hwcontext.h
Add av_hwdevice_ctx_create().
2016-07-09 - xxxxxxx / 90f469a - lavc 57.50.100 / 57.20.0 - avcodec.h
Add FF_PROFILE_H264_MULTIVIEW_HIGH and FF_PROFILE_H264_STEREO_HIGH.
2016-06-26 - xxxxxxx / e47b8bb - lavc 57.48.101 / 57.19.1 - avcodec.h
Adjust values for JPEG 2000 profiles.
2016-06-30 - c1c7e0ab - lavf 57.41.100 - avformat.h
Moved codecpar field from AVStream to the end of the struct, so that
the following private fields are in the same location as in FFmpeg 3.0 (lavf 57.25.100).
2016-06-30 - 042fb69d - lavu 55.28.100 - frame.h
Moved hw_frames_ctx field from AVFrame to the end of the struct, so that
the following private fields are in the same location as in FFmpeg 3.0 (lavu 55.17.103).
2016-06-29 - 1a751455 - lavfi 6.47.100 - avfilter.h
Fix accidental ABI breakage in AVFilterContext.
ABI was broken in 8688d3a, lavfi 6.42.100 and released as ffmpeg 3.1.
Because of this, ffmpeg and ffplay built against lavfi>=6.42.100 will not be
compatible with lavfi>=6.47.100. Potentially also affects other users of
libavfilter if they are using one of the affected fields.
-------- 8< --------- FFmpeg 3.1 was cut here -------- 8< ---------
2016-06-26 - 481f320 / 1c9e861 - lavu 55.27.100 / 55.13.0 - hwcontext.h
Add av_hwdevice_ctx_create().
2016-06-26 - b95534b / e47b8bb - lavc 57.48.101 / 57.19.1 - avcodec.h
Adjust values for JPEG 2000 profiles.
2016-06-23 - 5d75e46 / db7968b - lavf 57.40.100 / 57.7.0 - avio.h
Add AVIODataMarkerType, write_data_type, ignore_boundary_point and
avio_write_marker.

File diff suppressed because it is too large Load Diff

View File

@ -125,7 +125,7 @@ $(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples
OBJDIRS += doc/examples
DOXY_INPUT = $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c)
DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT))
DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT)) config.mak
doc/doxy/html: TAG = DOXY
doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(SRC_PATH)/doc/doxy-wrapper.sh $(DOXY_INPUT_DEPS)

View File

@ -279,7 +279,7 @@ present between the subtitle lines because of double-sized teletext charactes.
Default value is 1.
@item txt_duration
Sets the display duration of the decoded teletext pages or subtitles in
miliseconds. Default value is 30000 which is 30 seconds.
milliseconds. Default value is 30000 which is 30 seconds.
@item txt_transparent
Force transparent background of the generated teletext bitmaps. Default value
is 0 which means an opaque background.

View File

@ -267,6 +267,33 @@ track. Track indexes start at 0. The demuxer exports the number of tracks as
For very large files, the @option{max_size} option may have to be adjusted.
@section libopenmpt
libopenmpt based module demuxer
See @url{https://lib.openmpt.org/libopenmpt/} for more information.
Some files have multiple subsongs (tracks) this can be set with the @option{subsong}
option.
It accepts the following options:
@table @option
@item subsong
Set the subsong index. This can be either 'all', 'auto', or the index of the
subsong. Subsong indexes start at 0. The default is 'auto'.
The default value is to let libopenmpt choose.
@item layout
Set the channel layout. Valid values are 1, 2, and 4 channel layouts.
The default value is STEREO.
@item sample_rate
Set the sample rate for libopenmpt to output.
Range is from 1000 to INT_MAX. The value default is 48000.
@end table
@section gif
Animated GIF demuxer.

View File

@ -1184,6 +1184,17 @@ following: 4000, 6000, 8000, 12000, or 20000, corresponding to
narrowband, mediumband, wideband, super wideband, and fullband
respectively. The default is 0 (cutoff disabled).
@item mapping_family (@emph{mapping_family})
Set channel mapping family to be used by the encoder. The default value of -1
uses mapping family 0 for mono and stereo inputs, and mapping family 1
otherwise. The default also disables the surround masking and LFE bandwidth
optimzations in libopus, and requires that the input contains 8 channels or
fewer.
Other values include 0 for mono and stereo, 1 for surround sound with masking
and LFE bandwidth optimizations, and 255 for independent streams with an
unspecified channel layout.
@end table
@section libvorbis
@ -1390,7 +1401,7 @@ is 0. This is only used when @option{slice_mode} is set to
@samp{fixed}.
@item slice_mode
Set slice mode. Can assume one of the follwing possible values:
Set slice mode. Can assume one of the following possible values:
@table @samp
@item fixed

View File

@ -129,6 +129,7 @@
<xsd:complexType name="frameSideDataType">
<xsd:attribute name="side_data_type" type="xsd:string"/>
<xsd:attribute name="side_data_size" type="xsd:int" />
<xsd:attribute name="timecode" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="subtitleType">

View File

@ -3243,7 +3243,7 @@ silenceremove=1:5:0.02
@end example
@item
Trim all silence encountered from begining to end where there is more than 1
Trim all silence encountered from beginning to end where there is more than 1
second of silence in audio:
@example
silenceremove=0:0:0:-1:1:-90dB
@ -4713,7 +4713,7 @@ ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_compl
Display CIE color diagram with pixels overlaid onto it.
The filter acccepts the following options:
The filter accepts the following options:
@table @option
@item system
@ -4743,7 +4743,7 @@ Set CIE system.
@item gamuts
Set what gamuts to draw.
See @code{system} option for avaiable values.
See @code{system} option for available values.
@item size, s
Set ciescope size, by default set to 512.
@ -5710,10 +5710,6 @@ strictly increasing over the x-axis, and their @var{x} and @var{y} values must
be in the @var{[0;1]} interval. If the computed curves happened to go outside
the vector spaces, the values will be clipped accordingly.
If there is no key point defined in @code{x=0}, the filter will automatically
insert a @var{(0;0)} point. In the same way, if there is no key point defined
in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
The filter accepts the following options:
@table @option
@ -5754,6 +5750,8 @@ options. In this case, the unset component(s) will fallback on this
@option{all} setting.
@item psfile
Specify a Photoshop curves file (@code{.acv}) to import the settings from.
@item plot
Save Gnuplot script of the curves in specified file.
@end table
To avoid some filtergraph syntax conflicts, each key points list need to be
@ -5765,13 +5763,13 @@ defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
@item
Increase slightly the middle level of blue:
@example
curves=blue='0.5/0.58'
curves=blue='0/0 0.5/0.58 1/1'
@end example
@item
Vintage effect:
@example
curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
@end example
Here we obtain the following coordinates for each components:
@table @var
@ -5798,7 +5796,15 @@ curves=vintage
@item
Use a Photoshop preset and redefine the points of the green component:
@example
curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
@end example
@item
Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
and @command{gnuplot}:
@example
ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
gnuplot -p /tmp/curves.plt
@end example
@end itemize
@ -6432,6 +6438,9 @@ Scroll from right to left.
@item rscroll
Scroll from left to right.
@item picture
Draw single picture.
@end table
Default is @code{frame}.
@ -8427,8 +8436,23 @@ ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
@section hdcd
Decodes high definition audio cd data. 16-Bit PCM stream containing hdcd flags
is converted to 20-bit PCM stream.
Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
embedded HDCD codes is expanded into a 20-bit PCM stream.
The filter supports the Peak Extend and Low-level Gain Adjustment features
of HDCD, and detects the Transient Filter flag.
@example
ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
@end example
When using the filter with wav, note the default encoding for wav is 16-bit,
so the resulting 20-bit stream will be truncated back to 16-bit. Use something
like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
@example
ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
@end example
@section hflip
@ -9375,13 +9399,14 @@ Float representation of @code{value} from metadata key.
@item VALUE2
Float representation of @code{value} as supplied by user in @code{value} option.
@end table
@item file
If specified in @code{print} mode, output is written to the named file. When
filename equals "-" data is written to standard output.
If @code{file} option is not set, output is written to the log with AV_LOG_INFO
loglevel.
If specified in @code{print} mode, output is written to the named file. Instead of
plain filename any writable url can be specified. Filename ``-'' is a shorthand
for standard output. If @code{file} option is not set, output is written to the log
with AV_LOG_INFO loglevel.
@end table
@end table
@subsection Examples
@ -9391,8 +9416,18 @@ loglevel.
Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
between 0 and 1.
@example
@end example
signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
@end example
@item
Print silencedetect output to file @file{metadata.txt}.
@example
silencedetect,ametadata=mode=print:file=metadata.txt
@end example
@item
Direct all metadata to a pipe with file descriptor 4.
@example
metadata=mode=print:file='pipe\:4'
@end example
@end itemize
@section mpdecimate
@ -10657,13 +10692,31 @@ The description of the accepted parameters follows.
If specified the filter will use the named file to save the PSNR of
each individual frame. When filename equals "-" the data is sent to
standard output.
@item stats_version
Specifies which version of the stats file format to use. Details of
each format are written below.
Default value is 1.
@end table
The file printed if @var{stats_file} is selected, contains a sequence of
key/value pairs of the form @var{key}:@var{value} for each compared
couple of frames.
A description of each shown parameter follows:
If a @var{stats_version} greater than 1 is specified, a header line precedes
the list of per-frame-pair stats, with key value pairs following the frame
format with the following parameters:
@table @option
@item psnr_log_version
The version of the log file format. Will match @var{stats_version}.
@item fields
A comma separated list of the per-frame-pair parameters included in
the log.
@end table
A description of each shown per-frame-pair parameter follows:
@table @option
@item n
@ -11166,16 +11219,16 @@ Set luma maximum difference between pixels to still be considered, must
be a value in the 0.1-100.0 range, default value is 1.0.
@item chroma_radius, cr
Set chroma blur filter strength, must be a value in range 0.1-4.0. A
Set chroma blur filter strength, must be a value in range -0.9-4.0. A
greater value will result in a more blurred image, and in slower
processing.
@item chroma_pre_filter_radius, cpfr
Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
@item chroma_strength, cs
Set chroma maximum difference between pixels to still be considered,
must be a value in the 0.1-100.0 range.
must be a value in the -0.9-100.0 range.
@end table
Each chroma option value, if not explicitly specified, is set to the
@ -12319,6 +12372,9 @@ interleaved columns, left eye first
@item icr
interleaved columns, right eye first
@item hdmi
HDMI frame pack
@end table
Default value is @samp{arcd}.

View File

@ -103,12 +103,19 @@ enable it.
@section OpenH264
FFmpeg can make use of the OpenH264 library for H.264 encoding.
FFmpeg can make use of the OpenH264 library for H.264 encoding and decoding.
Go to @url{http://www.openh264.org/} and follow the instructions for
installing the library. Then pass @code{--enable-libopenh264} to configure to
enable it.
For decoding, this library is much more limited than the built-in decoder
in libavcodec; currently, this library lacks support for decoding B-frames
and some other main/high profile features. (It currently only supports
constrained baseline profile and CABAC.) Using it is mostly useful for
testing and for taking advantage of Cisco's patent portfolio license
(@url{http://www.openh264.org/BINARY_LICENSE.txt}).
@section x264
FFmpeg can make use of the x264 library for H.264 encoding.
@ -679,6 +686,8 @@ following image formats are supported:
@tab fourcc: DUCK
@item Duck TrueMotion 2.0 @tab @tab X
@tab fourcc: TM20
@item Duck TrueMotion 2.0 RT @tab @tab X
@tab fourcc: TR20
@item DV (Digital Video) @tab X @tab X
@item Dxtory capture format @tab @tab X
@item Feeble Files/ScummVM DXA @tab @tab X
@ -745,7 +754,7 @@ following image formats are supported:
@item LucasArts SANM/Smush @tab @tab X
@tab Used in LucasArts games / SMUSH animations.
@item lossless MJPEG @tab X @tab X
@item MagicYUV Lossless Video @tab @tab X
@item MagicYUV Video @tab @tab X
@item Microsoft ATC Screen @tab @tab X
@tab Also known as Microsoft Screen 3.
@item Microsoft Expression Encoder Screen @tab @tab X

View File

@ -251,6 +251,28 @@ To use this option, ffmpeg needs to be compiled with @code{--enable-libzvbi}.
Defines number of audio channels to capture. Must be @samp{2}, @samp{8} or @samp{16}.
Defaults to @samp{2}.
@item duplex_mode
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}.
Defaults to @samp{unset}.
@item video_input
Sets the video input source. Must be @samp{unset}, @samp{sdi}, @samp{hdmi},
@samp{optical_sdi}, @samp{component}, @samp{composite} or @samp{s_video}.
Defaults to @samp{unset}.
@item audio_input
Sets the audio input source. Must be @samp{unset}, @samp{embedded},
@samp{aes_ebu}, @samp{analog}, @samp{analog_xlr}, @samp{analog_rca} or
@samp{microphone}. Defaults to @samp{unset}.
@item video_pts
Sets the video packet timestamp source. Must be @samp{video}, @samp{audio},
@samp{reference} or @samp{wallclock}. Defaults to @samp{video}.
@item audio_pts
Sets the audio packet timestamp source. Must be @samp{video}, @samp{audio},
@samp{reference} or @samp{wallclock}. Defaults to @samp{audio}.
@end table
@subsection Examples

View File

@ -396,8 +396,8 @@ which can be cyclic, for example if the @option{wrap} option is
specified.
@item hls_segment_filename @var{filename}
Set the segment filename. Unless hls_flags single_file is set @var{filename}
is used as a string format with the segment number:
Set the segment filename. Unless @code{hls_flags single_file} is set,
@var{filename} is used as a string format with the segment number:
@example
ffmpeg in.nut -hls_segment_filename 'file%03d.ts' out.m3u8
@end example
@ -495,6 +495,23 @@ Will produce the playlist, @file{out.m3u8}, and a single segment file,
Segment files removed from the playlist are deleted after a period of time
equal to the duration of the segment plus the duration of the playlist.
@item hls_flags round_durations
Round the duration info in the playlist file segment info to integer
values, instead of using floating point.
@item hls_flags discont_starts
Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the
first segment's information.
@item hls_flags omit_endlist
Do not append the @code{EXT-X-ENDLIST} tag at the end of the playlist.
@item hls_flags split_by_time
Allow segments to start on frames other than keyframes. This improves
behavior on some players when the time between keyframes is inconsistent,
but may make things worse on others, and can cause some oddities during
seeking. This flag should be used with the @code{hls_time} option.
@item hls_playlist_type event
Emit @code{#EXT-X-PLAYLIST-TYPE:EVENT} in the m3u8 header. Forces
@option{hls_list_size} to 0; the playlist can only be appended to.
@ -502,6 +519,17 @@ Emit @code{#EXT-X-PLAYLIST-TYPE:EVENT} in the m3u8 header. Forces
@item hls_playlist_type vod
Emit @code{#EXT-X-PLAYLIST-TYPE:VOD} in the m3u8 header. Forces
@option{hls_list_size} to 0; the playlist must not change.
@item method
Use the given HTTP method to create the hls files.
@example
ffmpeg -re -i in.ts -f hls -method PUT http://example.com/live/out.m3u8
@end example
This example will upload all the mpegts segment files to the HTTP
server using the HTTP PUT method, and update the m3u8 files every
@code{refresh} times using the same method.
Note that the HTTP server must support the given method for uploading
files.
@end table
@anchor{ico}

View File

@ -695,7 +695,7 @@ This protocol accepts the following options.
@table @option
@item timeout
Set timeout in miliseconds of socket I/O operations used by the underlying
Set timeout in milliseconds of socket I/O operations used by the underlying
low level operation. By default it is set to -1, which means that the timeout
is not specified.
@ -1159,6 +1159,15 @@ Play an AVI file directly from a TAR archive:
subfile,,start,183241728,end,366490624,,:archive.tar
@end example
@section tee
Writes the output to multiple protocols. The individual outputs are separated
by |
@example
tee:file://path/to/local/this.avi|file://path/to/local/that.avi
@end example
@section tcp
Transmission Control Protocol.

View File

@ -3019,6 +3019,7 @@ static int transcode_init(void)
enc_ctx->width = dec_ctx->width;
enc_ctx->height = dec_ctx->height;
enc_ctx->has_b_frames = dec_ctx->has_b_frames;
enc_ctx->profile = dec_ctx->profile;
if (ost->frame_aspect_ratio.num) { // overridden by the -aspect cli option
sar =
av_mul_q(ost->frame_aspect_ratio,
@ -3499,12 +3500,12 @@ static int check_keyboard_interaction(int64_t cur_time)
key == 'c' ? AVFILTER_CMD_FLAG_ONE : 0);
fprintf(stderr, "Command reply for stream %d: ret:%d res:\n%s", i, ret, buf);
} else if (key == 'c') {
fprintf(stderr, "Queing commands only on filters supporting the specific command is unsupported\n");
fprintf(stderr, "Queuing commands only on filters supporting the specific command is unsupported\n");
ret = AVERROR_PATCHWELCOME;
} else {
ret = avfilter_graph_queue_command(fg->graph, target, command, arg, 0, time);
if (ret < 0)
fprintf(stderr, "Queing command failed with error %s\n", av_err2str(ret));
fprintf(stderr, "Queuing command failed with error %s\n", av_err2str(ret));
}
}
}

View File

@ -3384,9 +3384,6 @@ const OptionDef options[] = {
{ "hwaccel_output_format", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) },
"select output format used with HW accelerated decoding", "format" },
{ "hwaccel_output_format", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) },
"select output format used with HW accelerated decoding", "format" },
#if CONFIG_VDA || CONFIG_VIDEOTOOLBOX
{ "videotoolbox_pixfmt", HAS_ARG | OPT_STRING | OPT_EXPERT, { &videotoolbox_pixfmt}, "" },
#endif

View File

@ -2725,7 +2725,7 @@ static int stream_component_open(VideoState *is, int stream_index)
goto fail;
link = is->out_audio_filter->inputs[0];
sample_rate = link->sample_rate;
nb_channels = link->channels;
nb_channels = avfilter_link_get_channels(link);
channel_layout = link->channel_layout;
}
#else
@ -2936,7 +2936,7 @@ static int read_thread(void *arg)
AVStream *st = ic->streams[i];
enum AVMediaType type = st->codecpar->codec_type;
st->discard = AVDISCARD_ALL;
if (wanted_stream_spec[type] && st_index[type] == -1)
if (type >= 0 && wanted_stream_spec[type] && st_index[type] == -1)
if (avformat_match_stream_specifier(ic, st, wanted_stream_spec[type]) > 0)
st_index[type] = i;
}

View File

@ -3277,6 +3277,7 @@ int main(int argc, char **argv)
SET_DO_SHOW(FRAME_TAGS, frame_tags);
SET_DO_SHOW(PROGRAM_TAGS, program_tags);
SET_DO_SHOW(STREAM_TAGS, stream_tags);
SET_DO_SHOW(PROGRAM_STREAM_TAGS, stream_tags);
SET_DO_SHOW(PACKET_TAGS, packet_tags);
if (do_bitexact && (do_show_program_version || do_show_library_versions)) {

View File

@ -10,6 +10,7 @@ HEADERS = avcodec.h \
dv_profile.h \
dxva2.h \
jni.h \
mediacodec.h \
qsv.h \
vaapi.h \
vda.h \
@ -35,6 +36,7 @@ OBJS = allcodecs.o \
imgconvert.o \
jni.o \
mathtables.o \
mediacodec.o \
options.o \
parser.o \
profiles.o \
@ -92,7 +94,7 @@ OBJS-$(CONFIG_LSP) += lsp.o
OBJS-$(CONFIG_LZF) += lzf.o
OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o mdct_fixed_32.o
OBJS-$(CONFIG_ME_CMP) += me_cmp.o
OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec.o mediacodec_wrapper.o mediacodec_sw_buffer.o
OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec.o mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \
mpegaudiodecheader.o
@ -236,7 +238,8 @@ OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadata.o dcahuff.o \
OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dca.o dcadata.o
OBJS-$(CONFIG_DDS_DECODER) += dds.o
OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab.o \
dirac_arith.o mpeg12data.o dirac_dwt.o
dirac_arith.o mpeg12data.o dirac_dwt.o \
dirac_vlc.o
OBJS-$(CONFIG_DFA_DECODER) += dfa.o
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
@ -306,7 +309,7 @@ OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \
intelh263dec.o h263data.o
OBJS-$(CONFIG_H263_ENCODER) += mpeg4videoenc.o mpeg4video.o \
h263.o ituh263enc.o flvenc.o h263data.o
OBJS-$(CONFIG_H264_DECODER) += h264.o h264_cabac.o h264_cavlc.o \
OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \
h264_direct.o h264_loopfilter.o \
h264_mb.o h264_picture.o h264_ps.o \
h264_refs.o h264_sei.o \
@ -528,7 +531,8 @@ OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263data.o
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o h263data.o \
h263.o ituh263enc.o
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o h264_parse.o h264data.o
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o \
h264_parse.o h264data.o h264_ps.o h2645_parse.o
OBJS-$(CONFIG_TEXT_DECODER) += textdec.o ass.o
OBJS-$(CONFIG_TEXT_ENCODER) += srtenc.o ass_split.o
OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o takdsp.o
@ -548,7 +552,7 @@ OBJS-$(CONFIG_TRUESPEECH_DECODER) += truespeech.o
OBJS-$(CONFIG_TSCC_DECODER) += tscc.o msrledec.o
OBJS-$(CONFIG_TSCC2_DECODER) += tscc2.o
OBJS-$(CONFIG_TTA_DECODER) += tta.o ttadata.o ttadsp.o
OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttadata.o
OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttaencdsp.o ttadata.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvqdec.o twinvq.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
@ -837,9 +841,9 @@ OBJS-$(CONFIG_AMR_NB_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_EAC3_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_GSM_MS_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_ILBC_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP2_AT_DECODER) += audiotoolboxdec.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP3_AT_DECODER) += audiotoolboxdec.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP2_AT_DECODER) += audiotoolboxdec.o mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP3_AT_DECODER) += audiotoolboxdec.o mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_PCM_MULAW_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_PCM_ALAW_AT_DECODER) += audiotoolboxdec.o
OBJS-$(CONFIG_QDMC_AT_DECODER) += audiotoolboxdec.o
@ -860,11 +864,12 @@ OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsmenc.o
OBJS-$(CONFIG_LIBILBC_DECODER) += libilbc.o
OBJS-$(CONFIG_LIBILBC_ENCODER) += libilbc.o
OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o
OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
@ -993,7 +998,7 @@ SKIPHEADERS-$(CONFIG_JNI) += ffjni.h
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h
SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.h
SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodecdec.h mediacodec_wrapper.h mediacodec_sw_buffer.h
SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodecdec.h mediacodec_surface.h mediacodec_wrapper.h mediacodec_sw_buffer.h
SKIPHEADERS-$(CONFIG_NVENC) += nvenc.h
SKIPHEADERS-$(CONFIG_QSV) += qsv.h qsv_internal.h
SKIPHEADERS-$(CONFIG_QSVDEC) += qsvdec.h

View File

@ -77,3 +77,13 @@ wrap(avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
{
testneonclobbers(avcodec_encode_video2, avctx, avpkt, frame, got_packet_ptr);
}
wrap(avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt))
{
testneonclobbers(avcodec_send_packet, avctx, avpkt);
}
wrap(avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame))
{
testneonclobbers(avcodec_receive_frame, avctx, frame);
}

View File

@ -24,9 +24,10 @@
* Common code between the AC-3 encoder and decoder.
*/
#include "libavutil/common.h"
#include "avcodec.h"
#include "ac3.h"
#include "get_bits.h"
/**
* Starting frequency coefficient bin for each critical band.

View File

@ -623,7 +623,7 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
else
max_frame_size = s->max_coded_frame_size;
if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size, 0)) < 0)
if ((ret = ff_alloc_packet2(avctx, avpkt, 4 * max_frame_size, 0)) < 0)
return ret;
/* use verbatim mode for compression_level 0 */

View File

@ -72,6 +72,7 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(H264_CUVID, h264_cuvid);
REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);
REGISTER_HWACCEL(H264_MMAL, h264_mmal);
REGISTER_HWACCEL(H264_QSV, h264_qsv);
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
@ -622,7 +623,7 @@ void avcodec_register_all(void)
/* external libraries, that shouldn't be used by default if one of the
* above is available */
REGISTER_ENCODER(LIBOPENH264, libopenh264);
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);

View File

@ -77,3 +77,13 @@ wrap(avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
{
testneonclobbers(avcodec_encode_video2, avctx, avpkt, frame, got_packet_ptr);
}
wrap(avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt))
{
testneonclobbers(avcodec_send_packet, avctx, avpkt);
}
wrap(avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame))
{
testneonclobbers(avcodec_receive_frame, avctx, frame);
}

View File

@ -43,7 +43,9 @@
#include "version.h"
/**
* @defgroup libavc Encoding/Decoding Library
* @defgroup libavc libavcodec
* Encoding/Decoding Library
*
* @{
*
* @defgroup lavc_decoding Decoding
@ -1348,6 +1350,14 @@ typedef struct AVCPBProperties {
*/
enum AVPacketSideDataType {
AV_PKT_DATA_PALETTE,
/**
* The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
* that the extradata buffer was changed and the receiving side should
* act upon it appropriately. The new extradata is embedded in the side
* data buffer and should be immediately used for processing the current
* frame or packet.
*/
AV_PKT_DATA_NEW_EXTRADATA,
/**
@ -3165,6 +3175,13 @@ typedef struct AVCodecContext {
#define FF_PROFILE_MPEG2_AAC_LOW 128
#define FF_PROFILE_MPEG2_AAC_HE 131
#define FF_PROFILE_DNXHD 0
#define FF_PROFILE_DNXHR_LB 1
#define FF_PROFILE_DNXHR_SQ 2
#define FF_PROFILE_DNXHR_HQ 3
#define FF_PROFILE_DNXHR_HQX 4
#define FF_PROFILE_DNXHR_444 5
#define FF_PROFILE_DTS 20
#define FF_PROFILE_DTS_ES 30
#define FF_PROFILE_DTS_96_24 40
@ -3189,8 +3206,10 @@ typedef struct AVCodecContext {
#define FF_PROFILE_H264_HIGH 100
#define FF_PROFILE_H264_HIGH_10 110
#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
#define FF_PROFILE_H264_HIGH_422 122
#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_STEREO_HIGH 128
#define FF_PROFILE_H264_HIGH_444 144
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)

View File

@ -23,17 +23,17 @@
#include "libavutil/attributes.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "binkdata.h"
#include "binkdsp.h"
#include "blockdsp.h"
#include "get_bits.h"
#include "hpeldsp.h"
#include "internal.h"
#include "mathops.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#define BINK_FLAG_ALPHA 0x00100000
#define BINK_FLAG_GRAY 0x00020000

View File

@ -29,15 +29,16 @@
*/
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#include "dct.h"
#include "rdft.h"
#include "internal.h"
#include "wma_freqs.h"
#include "libavutil/intfloat.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "dct.h"
#include "get_bits.h"
#include "internal.h"
#include "rdft.h"
#include "wma_freqs.h"
static float quant_table[96];
#define MAX_CHANNELS 2

View File

@ -261,6 +261,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
/* taking by default roll up to 2 */
ctx->mode = CCMODE_ROLLUP;
ctx->rollup = 2;
ctx->cursor_row = 10;
ret = ff_ass_subtitle_header(avctx, "Monospace",
ASS_DEFAULT_FONT_SIZE,
ASS_DEFAULT_COLOR,
@ -298,7 +299,7 @@ static void flush_decoder(AVCodecContext *avctx)
ctx->prev_cmd[1] = 0;
ctx->mode = CCMODE_ROLLUP;
ctx->rollup = 2;
ctx->cursor_row = 0;
ctx->cursor_row = 10;
ctx->cursor_column = 0;
ctx->cursor_font = 0;
ctx->cursor_color = 0;
@ -315,7 +316,7 @@ static void flush_decoder(AVCodecContext *avctx)
/**
* @param ctx closed caption context just to print log
*/
static int write_char(CCaptionSubContext *ctx, struct Screen *screen, char ch)
static void write_char(CCaptionSubContext *ctx, struct Screen *screen, char ch)
{
uint8_t col = ctx->cursor_column;
char *row = screen->characters[ctx->cursor_row];
@ -328,16 +329,16 @@ static int write_char(CCaptionSubContext *ctx, struct Screen *screen, char ch)
charset[col] = ctx->cursor_charset;
ctx->cursor_charset = CCSET_BASIC_AMERICAN;
if (ch) ctx->cursor_column++;
return 0;
return;
}
/* We have extra space at end only for null character */
else if (col == SCREEN_COLUMNS && ch == 0) {
row[col] = ch;
return 0;
return;
}
else {
av_log(ctx, AV_LOG_WARNING, "Data Ignored since exceeding screen width\n");
return AVERROR_INVALIDDATA;
return;
}
}
@ -435,11 +436,24 @@ static void roll_up(CCaptionSubContext *ctx)
static int capture_screen(CCaptionSubContext *ctx)
{
int i;
int i, j, tab = 0;
struct Screen *screen = ctx->screen + ctx->active_screen;
enum cc_font prev_font = CCFONT_REGULAR;
av_bprint_clear(&ctx->buffer);
for (i = 0; screen->row_used && i < SCREEN_ROWS; i++)
{
if (CHECK_FLAG(screen->row_used, i)) {
const char *row = screen->characters[i];
const char *charset = screen->charsets[i];
j = 0;
while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN)
j++;
if (!tab || j < tab)
tab = j;
}
}
for (i = 0; screen->row_used && i < SCREEN_ROWS; i++)
{
if (CHECK_FLAG(screen->row_used, i)) {
@ -447,12 +461,17 @@ static int capture_screen(CCaptionSubContext *ctx)
const char *font = screen->fonts[i];
const char *charset = screen->charsets[i];
const char *override;
int j = 0;
int x, y, seen_char = 0;
j = 0;
/* skip leading space */
while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN)
while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN && j < tab)
j++;
x = ASS_DEFAULT_PLAYRESX * (0.1 + 0.0250 * j);
y = ASS_DEFAULT_PLAYRESY * (0.1 + 0.0533 * i);
av_bprintf(&ctx->buffer, "{\\an7}{\\pos(%d,%d)}", x, y);
for (; j < SCREEN_COLUMNS; j++) {
const char *e_tag = "", *s_tag = "";
@ -487,9 +506,14 @@ static int capture_screen(CCaptionSubContext *ctx)
override = charset_overrides[(int)charset[j]][(int)row[j]];
if (override) {
av_bprintf(&ctx->buffer, "%s%s%s", e_tag, s_tag, override);
seen_char = 1;
} else if (row[j] == ' ' && !seen_char) {
av_bprintf(&ctx->buffer, "%s%s\\h", e_tag, s_tag);
} else {
av_bprintf(&ctx->buffer, "%s%s%c", e_tag, s_tag, row[j]);
seen_char = 1;
}
}
av_bprintf(&ctx->buffer, "\\N");
}
@ -713,6 +737,12 @@ static void process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, uint
/* Standard characters (always in pairs) */
handle_char(ctx, hi, lo, pts);
ctx->prev_cmd[0] = ctx->prev_cmd[1] = 0;
} else if (hi == 0x17 && lo >= 0x21 && lo <= 0x23) {
int i;
/* Tab offsets (spacing) */
for (i = 0; i < lo - 0x20; i++) {
handle_char(ctx, ' ', 0, pts);
}
} else {
/* Ignoring all other non data code */
ff_dlog(ctx, "Unknown command 0x%hhx 0x%hhx\n", hi, lo);

View File

@ -513,7 +513,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
}
if (highpass_height > highpass_a_height || highpass_width > highpass_a_width || a_expected < expected) {
av_log(avctx, AV_LOG_ERROR, "Too many highpass coefficents\n");
av_log(avctx, AV_LOG_ERROR, "Too many highpass coefficients\n");
ret = AVERROR(EINVAL);
goto end;
}

View File

@ -665,6 +665,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "dnxhd",
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
.profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
},
{
.id = AV_CODEC_ID_THP,
@ -1303,6 +1304,41 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("innoHeim/Rsupport Screen Capture Codec"),
.props = AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_MAGICYUV,
.type = AVMEDIA_TYPE_VIDEO,
.name = "magicyuv",
.long_name = NULL_IF_CONFIG_SMALL("MagicYUV video"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_TRUEMOTION2RT,
.type = AVMEDIA_TYPE_VIDEO,
.name = "truemotion2rt",
.long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_CFHD,
.type = AVMEDIA_TYPE_VIDEO,
.name = "cfhd",
.long_name = NULL_IF_CONFIG_SMALL("Cineform HD"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_SHEERVIDEO,
.type = AVMEDIA_TYPE_VIDEO,
.name = "sheervideo",
.long_name = NULL_IF_CONFIG_SMALL("BitJazz SheerVideo"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_YLC,
.type = AVMEDIA_TYPE_VIDEO,
.name = "ylc",
.long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
/* image codecs */
{
@ -1528,41 +1564,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSLESS,
.mime_types= MT("image/png"),
},
{
.id = AV_CODEC_ID_CFHD,
.type = AVMEDIA_TYPE_VIDEO,
.name = "cfhd",
.long_name = NULL_IF_CONFIG_SMALL("Cineform HD"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_TRUEMOTION2RT,
.type = AVMEDIA_TYPE_VIDEO,
.name = "truemotion2rt",
.long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_MAGICYUV,
.type = AVMEDIA_TYPE_VIDEO,
.name = "magicyuv",
.long_name = NULL_IF_CONFIG_SMALL("MagicYUV Lossless Video"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_SHEERVIDEO,
.type = AVMEDIA_TYPE_VIDEO,
.name = "sheervideo",
.long_name = NULL_IF_CONFIG_SMALL("BitJazz SheerVideo"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_YLC,
.type = AVMEDIA_TYPE_VIDEO,
.name = "ylc",
.long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
/* various PCM "codecs" */
{

View File

@ -83,7 +83,7 @@
#include <libcrystalhd/libcrystalhd_if.h>
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "internal.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"

247
libavcodec/dirac_vlc.c Normal file
View File

@ -0,0 +1,247 @@
/*
* Copyright (C) 2016 Open Broadcast Systems Ltd.
* Author 2016 Rostislav Pehlivanov <rpehlivanov@obe.tv>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "dirac_vlc.h"
#define LUT_SIZE (1 << LUT_BITS)
#define RSIZE_BITS (CHAR_BIT*sizeof(residual))
#define CONVERT_TO_RESIDUE(a, b) \
(((residual)(a)) << (RSIZE_BITS - (b)))
#define INIT_RESIDUE(N) \
residual N = 0; \
av_unused int32_t N ## _bits = 0
#define SET_RESIDUE(N, I, B) \
N = CONVERT_TO_RESIDUE(I, B); \
N ## _bits = B
#define APPEND_RESIDUE(N, M) \
N |= M >> (N ## _bits); \
N ## _bits += (M ## _bits)
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int bytes, uint8_t *_dst, int coeffs)
{
int i, b, c_idx = 0;
int32_t *dst = (int32_t *)_dst;
DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
INIT_RESIDUE(res);
for (b = 1; b <= bytes; b++) {
future[0] = &lut_ctx[buf[b]];
future[1] = future[0] + 1*LUT_SIZE;
future[2] = future[0] + 2*LUT_SIZE;
future[3] = future[0] + 3*LUT_SIZE;
if ((c_idx + 1) > coeffs)
return c_idx;
/* res_bits is a hint for better branch prediction */
if (res_bits && l->sign) {
int32_t coeff = 1;
APPEND_RESIDUE(res, l->preamble);
for (i = 0; i < (res_bits >> 1) - 1; i++) {
coeff <<= 1;
coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1;
}
dst[c_idx++] = l->sign * (coeff - 1);
res_bits = res = 0;
}
memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t));
c_idx += l->ready_num;
APPEND_RESIDUE(res, l->leftover);
l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];
}
return c_idx;
}
int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int bytes, uint8_t *_dst, int coeffs)
{
int i, b, c_idx = 0;
int16_t *dst = (int16_t *)_dst;
DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
INIT_RESIDUE(res);
for (b = 1; b <= bytes; b++) {
future[0] = &lut_ctx[buf[b]];
future[1] = future[0] + 1*LUT_SIZE;
future[2] = future[0] + 2*LUT_SIZE;
future[3] = future[0] + 3*LUT_SIZE;
if ((c_idx + 1) > coeffs)
return c_idx;
if (res_bits && l->sign) {
int32_t coeff = 1;
APPEND_RESIDUE(res, l->preamble);
for (i = 0; i < (res_bits >> 1) - 1; i++) {
coeff <<= 1;
coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1;
}
dst[c_idx++] = l->sign * (coeff - 1);
res_bits = res = 0;
}
for (i = 0; i < LUT_BITS; i++)
dst[c_idx + i] = l->ready[i];
c_idx += l->ready_num;
APPEND_RESIDUE(res, l->leftover);
l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];
}
return c_idx;
}
/* Searches for golomb codes in a residue */
static inline void search_for_golomb(DiracGolombLUT *l, residual r, int bits)
{
int r_count = RSIZE_BITS - 1;
int bits_start, bits_tot = bits, need_sign = 0;
#define READ_BIT(N) (((N) >> (N ## _count--)) & 1)
while (1) {
int32_t coef = 1;
bits_start = (RSIZE_BITS - 1) - r_count;
while (1) {
if (!bits--)
goto leftover;
if (READ_BIT(r))
break;
coef <<= 1;
if (!bits--)
goto leftover;
coef |= READ_BIT(r);
}
l->ready[l->ready_num] = coef - 1;
if (l->ready[l->ready_num]) {
if (!bits--) {
need_sign = 1;
goto leftover;
}
l->ready[l->ready_num] *= READ_BIT(r) ? -1 : +1;
}
l->ready_num++;
if (!bits)
return;
}
leftover:
l->leftover = r << bits_start;
l->leftover_bits = bits_tot - bits_start;
l->need_s = need_sign;
}
/* Parity LUTs - even and odd bit end positions */
static void generate_parity_lut(DiracGolombLUT *lut, int even)
{
int idx;
for (idx = 0; idx < LUT_SIZE; idx++) {
DiracGolombLUT *l = &lut[idx];
int symbol_end_loc = -1;
uint32_t code;
int i;
INIT_RESIDUE(res);
SET_RESIDUE(res, idx, LUT_BITS);
for (i = 0; i < LUT_BITS; i++) {
const int cond = even ? (i & 1) : !(i & 1);
if (((res >> (RSIZE_BITS - i - 1)) & 1) && cond) {
symbol_end_loc = i + 2;
break;
}
}
if (symbol_end_loc < 0 || symbol_end_loc > LUT_BITS) {
l->preamble = 0;
l->preamble_bits = 0;
l->leftover_bits = LUT_BITS;
l->leftover = CONVERT_TO_RESIDUE(idx, l->leftover_bits);
if (even)
l->need_s = idx & 1;
continue;
}
/* Gets bits 0 through to (symbol_end_loc - 1) inclusive */
code = idx >> ((LUT_BITS - 1) - (symbol_end_loc - 1));
code &= ((1 << LUT_BITS) - 1) >> (LUT_BITS - symbol_end_loc);
l->preamble_bits = symbol_end_loc;
l->preamble = CONVERT_TO_RESIDUE(code, l->preamble_bits);
l->sign = ((l->preamble >> (RSIZE_BITS - l->preamble_bits)) & 1) ? -1 : +1;
search_for_golomb(l, res << symbol_end_loc, LUT_BITS - symbol_end_loc);
}
}
/* Reset (off == 0) and needs-one-more-bit (off == 1) LUTs */
static void generate_offset_lut(DiracGolombLUT *lut, int off)
{
int idx;
for (idx = 0; idx < LUT_SIZE; idx++) {
DiracGolombLUT *l = &lut[idx];
INIT_RESIDUE(res);
SET_RESIDUE(res, idx, LUT_BITS);
l->preamble = CONVERT_TO_RESIDUE(res >> (RSIZE_BITS - off), off);
l->preamble_bits = off;
l->sign = ((l->preamble >> (RSIZE_BITS - l->preamble_bits)) & 1) ? -1 : +1;
search_for_golomb(l, res << off, LUT_BITS - off);
}
}
av_cold int ff_dirac_golomb_reader_init(DiracGolombLUT **lut_ctx)
{
DiracGolombLUT *lut;
if (!(lut = av_calloc(4*LUT_SIZE, sizeof(DiracGolombLUT))))
return AVERROR(ENOMEM);
generate_parity_lut(&lut[0*LUT_SIZE], 0);
generate_parity_lut(&lut[1*LUT_SIZE], 1);
generate_offset_lut(&lut[2*LUT_SIZE], 0);
generate_offset_lut(&lut[3*LUT_SIZE], 1);
*lut_ctx = lut;
return 0;
}
av_cold void ff_dirac_golomb_reader_end(DiracGolombLUT **lut_ctx)
{
av_freep(lut_ctx);
}

51
libavcodec/dirac_vlc.h Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2016 Open Broadcast Systems Ltd.
* Author 2016 Rostislav Pehlivanov <rpehlivanov@obe.tv>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_DIRAC_VLC_H
#define AVCODEC_DIRAC_VLC_H
#include "libavutil/avutil.h"
/* Can be 32 bits wide for some performance gain on some machines, but it will
* incorrectly decode very long coefficients (usually only 1 or 2 per frame) */
typedef uint64_t residual;
#define LUT_BITS 8
/* Exactly 64 bytes */
typedef struct DiracGolombLUT {
residual preamble, leftover;
int32_t ready[LUT_BITS];
int32_t preamble_bits, leftover_bits, ready_num;
int8_t need_s, sign;
} DiracGolombLUT;
av_cold int ff_dirac_golomb_reader_init(DiracGolombLUT **lut_ctx);
int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int bytes, uint8_t *dst, int coeffs);
int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
int bytes, uint8_t *_dst, int coeffs);
av_cold void ff_dirac_golomb_reader_end(DiracGolombLUT **lut_ctx);
#endif /* AVCODEC_DIRAC_VLC_H */

View File

@ -32,6 +32,7 @@
#include "internal.h"
#include "golomb.h"
#include "dirac_arith.h"
#include "dirac_vlc.h"
#include "mpeg12data.h"
#include "libavcodec/mpegvideo.h"
#include "mpegvideoencdsp.h"
@ -120,11 +121,20 @@ typedef struct Plane {
SubBand band[MAX_DWT_LEVELS][4];
} Plane;
/* Used by Low Delay and High Quality profiles */
typedef struct DiracSlice {
GetBitContext gb;
int slice_x;
int slice_y;
int bytes;
} DiracSlice;
typedef struct DiracContext {
AVCodecContext *avctx;
MpegvideoEncDSPContext mpvencdsp;
VideoDSPContext vdsp;
DiracDSPContext diracdsp;
DiracGolombLUT *reader_ctx;
DiracVersionInfo version;
GetBitContext gb;
AVDiracSeqHeader seq;
@ -161,6 +171,13 @@ typedef struct DiracContext {
unsigned num_x; /* number of horizontal slices */
unsigned num_y; /* number of vertical slices */
uint8_t *thread_buf; /* Per-thread buffer for coefficient storage */
int threads_num_buf; /* Current # of buffers allocated */
int thread_buf_size; /* Each thread has a buffer this size */
DiracSlice *slice_params_buf;
int slice_params_num_buf;
struct {
unsigned width;
unsigned height;
@ -370,6 +387,11 @@ static av_cold int dirac_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->frame_number = -1;
s->thread_buf = NULL;
s->threads_num_buf = -1;
s->thread_buf_size = -1;
ff_dirac_golomb_reader_init(&s->reader_ctx);
ff_diracdsp_init(&s->diracdsp);
ff_mpegvideoencdsp_init(&s->mpvencdsp, avctx);
ff_videodsp_init(&s->vdsp, 8);
@ -399,65 +421,29 @@ static av_cold int dirac_decode_end(AVCodecContext *avctx)
DiracContext *s = avctx->priv_data;
int i;
ff_dirac_golomb_reader_end(&s->reader_ctx);
dirac_decode_flush(avctx);
for (i = 0; i < MAX_FRAMES; i++)
av_frame_free(&s->all_frames[i].avframe);
av_freep(&s->thread_buf);
av_freep(&s->slice_params_buf);
return 0;
}
#define SIGN_CTX(x) (CTX_SIGN_ZERO + ((x) > 0) - ((x) < 0))
static inline int coeff_unpack_golomb(GetBitContext *gb, int qfactor, int qoffset)
{
int sign, coeff;
uint32_t buf;
OPEN_READER(re, gb);
UPDATE_CACHE(re, gb);
buf = GET_CACHE(re, gb);
if (buf & 0x80000000) {
LAST_SKIP_BITS(re,gb,1);
CLOSE_READER(re, gb);
return 0;
}
if (buf & 0xAA800000) {
buf >>= 32 - 8;
SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
coeff = ff_interleaved_ue_golomb_vlc_code[buf];
} else {
unsigned ret = 1;
do {
buf >>= 32 - 8;
SKIP_BITS(re, gb,
FFMIN(ff_interleaved_golomb_vlc_len[buf], 8));
if (ff_interleaved_golomb_vlc_len[buf] != 9) {
ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
ret |= ff_interleaved_dirac_golomb_vlc_code[buf];
break;
}
ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
UPDATE_CACHE(re, gb);
buf = GET_CACHE(re, gb);
} while (ret<0x8000000U && BITS_AVAILABLE(re, gb));
coeff = ret - 1;
}
coeff = (coeff * qfactor + qoffset) >> 2;
sign = SHOW_SBITS(re, gb, 1);
LAST_SKIP_BITS(re, gb, 1);
coeff = (coeff ^ sign) - sign;
CLOSE_READER(re, gb);
int coeff = dirac_get_se_golomb(gb);
const int sign = FFSIGN(coeff);
if (coeff)
coeff = sign*((sign * coeff * qfactor + qoffset) >> 2);
return coeff;
}
#define SIGN_CTX(x) (CTX_SIGN_ZERO + ((x) > 0) - ((x) < 0))
#define UNPACK_ARITH(n, type) \
static inline void coeff_unpack_arith_##n(DiracArith *c, int qfactor, int qoffset, \
SubBand *b, type *buf, int x, int y) \
@ -527,7 +513,7 @@ static inline void codeblock(DiracContext *s, SubBand *b,
b->quant = quant;
}
if (b->quant > 115) {
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
b->quant = 0;
return;
@ -717,12 +703,12 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant,
uint8_t *buf2 = b2 ? b2->ibuf + top * b2->stride: NULL;
int x, y;
if (quant > 115) {
if (quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", quant);
return;
}
qfactor = ff_dirac_qscale_tab[quant & 0x7f];
qoffset = ff_dirac_qoffset_intra_tab[quant & 0x7f] + 2;
qfactor = ff_dirac_qscale_tab[quant];
qoffset = ff_dirac_qoffset_intra_tab[quant] + 2;
/* we have to constantly check for overread since the spec explicitly
requires this, with the meaning that all remaining coeffs are set to 0 */
if (get_bits_count(gb) >= bits_end)
@ -750,15 +736,6 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant,
}
}
/* Used by Low Delay and High Quality profiles */
typedef struct DiracSlice {
GetBitContext gb;
int slice_x;
int slice_y;
int bytes;
} DiracSlice;
/**
* Dirac Specification ->
* 13.5.2 Slices. slice(sx,sy)
@ -801,52 +778,120 @@ static int decode_lowdelay_slice(AVCodecContext *avctx, void *arg)
return 0;
}
typedef struct SliceCoeffs {
int left;
int top;
int tot_h;
int tot_v;
int tot;
} SliceCoeffs;
static int subband_coeffs(DiracContext *s, int x, int y, int p,
SliceCoeffs c[MAX_DWT_LEVELS])
{
int level, coef = 0;
for (level = 0; level < s->wavelet_depth; level++) {
SliceCoeffs *o = &c[level];
SubBand *b = &s->plane[p].band[level][3]; /* orientation doens't matter */
o->top = b->height * y / s->num_y;
o->left = b->width * x / s->num_x;
o->tot_h = ((b->width * (x + 1)) / s->num_x) - o->left;
o->tot_v = ((b->height * (y + 1)) / s->num_y) - o->top;
o->tot = o->tot_h*o->tot_v;
coef += o->tot * (4 - !!level);
}
return coef;
}
/**
* VC-2 Specification ->
* 13.5.3 hq_slice(sx,sy)
*/
static int decode_hq_slice(AVCodecContext *avctx, void *arg)
static int decode_hq_slice(DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf)
{
int i, quant, level, orientation, quant_idx;
uint8_t quants[MAX_DWT_LEVELS][4];
DiracContext *s = avctx->priv_data;
DiracSlice *slice = arg;
int i, level, orientation, quant_idx;
int qfactor[MAX_DWT_LEVELS][4], qoffset[MAX_DWT_LEVELS][4];
GetBitContext *gb = &slice->gb;
SliceCoeffs coeffs_num[MAX_DWT_LEVELS];
skip_bits_long(gb, 8*s->highquality.prefix_bytes);
quant_idx = get_bits(gb, 8);
if (quant_idx > DIRAC_MAX_QUANT_INDEX) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid quantization index - %i\n", quant_idx);
return AVERROR_INVALIDDATA;
}
/* Slice quantization (slice_quantizers() in the specs) */
for (level = 0; level < s->wavelet_depth; level++) {
for (orientation = !!level; orientation < 4; orientation++) {
quant = FFMAX(quant_idx - s->lowdelay.quant[level][orientation], 0);
quants[level][orientation] = quant;
const int quant = FFMAX(quant_idx - s->lowdelay.quant[level][orientation], 0);
qfactor[level][orientation] = ff_dirac_qscale_tab[quant];
qoffset[level][orientation] = ff_dirac_qoffset_intra_tab[quant] + 2;
}
}
/* Luma + 2 Chroma planes */
for (i = 0; i < 3; i++) {
int64_t length = s->highquality.size_scaler * get_bits(gb, 8);
int64_t bits_left = 8 * length;
int64_t bits_end = get_bits_count(gb) + bits_left;
int coef_num, coef_par, off = 0;
int64_t length = s->highquality.size_scaler*get_bits(gb, 8);
int64_t bits_end = get_bits_count(gb) + 8*length;
const uint8_t *addr = align_get_bits(gb);
if (bits_end >= INT_MAX) {
if (length*8 > get_bits_left(gb)) {
av_log(s->avctx, AV_LOG_ERROR, "end too far away\n");
return AVERROR_INVALIDDATA;
}
coef_num = subband_coeffs(s, slice->slice_x, slice->slice_y, i, coeffs_num);
if (s->pshift)
coef_par = ff_dirac_golomb_read_32bit(s->reader_ctx, addr,
length, tmp_buf, coef_num);
else
coef_par = ff_dirac_golomb_read_16bit(s->reader_ctx, addr,
length, tmp_buf, coef_num);
if (coef_num > coef_par) {
const int start_b = coef_par * (1 << (s->pshift + 1));
const int end_b = coef_num * (1 << (s->pshift + 1));
memset(&tmp_buf[start_b], 0, end_b - start_b);
}
for (level = 0; level < s->wavelet_depth; level++) {
const SliceCoeffs *c = &coeffs_num[level];
for (orientation = !!level; orientation < 4; orientation++) {
decode_subband(s, gb, quants[level][orientation], slice->slice_x, slice->slice_y, bits_end,
&s->plane[i].band[level][orientation], NULL);
const SubBand *b1 = &s->plane[i].band[level][orientation];
uint8_t *buf = b1->ibuf + c->top * b1->stride + (c->left << (s->pshift + 1));
/* Change to c->tot_h <= 4 for AVX2 dequantization */
const int qfunc = s->pshift + 2*(c->tot_h <= 2);
s->diracdsp.dequant_subband[qfunc](&tmp_buf[off], buf, b1->stride,
qfactor[level][orientation],
qoffset[level][orientation],
c->tot_v, c->tot_h);
off += c->tot << (s->pshift + 1);
}
}
skip_bits_long(gb, bits_end - get_bits_count(gb));
}
return 0;
}
static int decode_hq_slice_row(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
{
int i;
DiracContext *s = avctx->priv_data;
DiracSlice *slices = ((DiracSlice *)arg) + s->num_x*jobnr;
uint8_t *thread_buf = &s->thread_buf[s->thread_buf_size*threadnr];
for (i = 0; i < s->num_x; i++)
decode_hq_slice(s, &slices[i], thread_buf);
return 0;
}
/**
* Dirac Specification ->
* 13.5.1 low_delay_transform_data()
@ -855,14 +900,37 @@ static int decode_lowdelay(DiracContext *s)
{
AVCodecContext *avctx = s->avctx;
int slice_x, slice_y, bufsize;
int64_t bytes = 0;
int64_t coef_buf_size, bytes = 0;
const uint8_t *buf;
DiracSlice *slices;
SliceCoeffs tmp[MAX_DWT_LEVELS];
int slice_num = 0;
slices = av_mallocz_array(s->num_x, s->num_y * sizeof(DiracSlice));
if (!slices)
return AVERROR(ENOMEM);
if (s->slice_params_num_buf != (s->num_x * s->num_y)) {
s->slice_params_buf = av_realloc_f(s->thread_buf, s->num_x * s->num_y, sizeof(DiracSlice));
if (!s->slice_params_buf) {
av_log(s->avctx, AV_LOG_ERROR, "slice params buffer allocation failure\n");
return AVERROR(ENOMEM);
}
s->slice_params_num_buf = s->num_x * s->num_y;
}
slices = s->slice_params_buf;
/* 8 becacuse that's how much the golomb reader could overread junk data
* from another plane/slice at most, and 512 because SIMD */
coef_buf_size = subband_coeffs(s, s->num_x - 1, s->num_y - 1, 0, tmp) + 8;
coef_buf_size = (coef_buf_size << (1 + s->pshift)) + 512;
if (s->threads_num_buf != avctx->thread_count ||
s->thread_buf_size != coef_buf_size) {
s->threads_num_buf = avctx->thread_count;
s->thread_buf_size = coef_buf_size;
s->thread_buf = av_realloc_f(s->thread_buf, avctx->thread_count, s->thread_buf_size);
if (!s->thread_buf) {
av_log(s->avctx, AV_LOG_ERROR, "thread buffer allocation failure\n");
return AVERROR(ENOMEM);
}
}
align_get_bits(&s->gb);
/*[DIRAC_STD] 13.5.2 Slices. slice(sx,sy) */
@ -879,9 +947,8 @@ static int decode_lowdelay(DiracContext *s)
if (bytes <= bufsize/8)
bytes += buf[bytes] * s->highquality.size_scaler + 1;
}
if (bytes >= INT_MAX) {
if (bytes >= INT_MAX || bytes*8 > bufsize) {
av_log(s->avctx, AV_LOG_ERROR, "too many bytes\n");
av_free(slices);
return AVERROR_INVALIDDATA;
}
@ -898,8 +965,13 @@ static int decode_lowdelay(DiracContext *s)
bufsize = 0;
}
}
avctx->execute(avctx, decode_hq_slice, slices, NULL, slice_num,
sizeof(DiracSlice));
if (s->num_x*s->num_y != slice_num) {
av_log(s->avctx, AV_LOG_ERROR, "too few slices\n");
return AVERROR_INVALIDDATA;
}
avctx->execute2(avctx, decode_hq_slice_row, slices, NULL, s->num_y);
} else {
for (slice_y = 0; bufsize > 0 && slice_y < s->num_y; slice_y++) {
for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) {
@ -933,7 +1005,7 @@ static int decode_lowdelay(DiracContext *s)
intra_dc_prediction_8(&s->plane[2].band[0][0]);
}
}
av_free(slices);
return 0;
}
@ -1743,9 +1815,11 @@ static int dirac_decode_frame_internal(DiracContext *s)
if (s->low_delay) {
/* [DIRAC_STD] 13.5.1 low_delay_transform_data() */
for (comp = 0; comp < 3; comp++) {
Plane *p = &s->plane[comp];
memset(p->idwt.buf, 0, p->idwt.stride * p->idwt.height);
if (!s->hq_picture) {
for (comp = 0; comp < 3; comp++) {
Plane *p = &s->plane[comp];
memset(p->idwt.buf, 0, p->idwt.stride * p->idwt.height);
}
}
if (!s->zero_res) {
if ((ret = decode_lowdelay(s)) < 0)

View File

@ -189,6 +189,27 @@ static void add_rect_clamped_c(uint8_t *dst, const uint16_t *src, int stride,
}
}
#define DEQUANT_SUBBAND(PX) \
static void dequant_subband_ ## PX ## _c(uint8_t *src, uint8_t *dst, ptrdiff_t stride, \
const int qf, const int qs, int tot_v, int tot_h) \
{ \
int i, y; \
for (y = 0; y < tot_v; y++) { \
PX c, sign, *src_r = (PX *)src, *dst_r = (PX *)dst; \
for (i = 0; i < tot_h; i++) { \
c = *src_r++; \
sign = FFSIGN(c)*(!!c); \
c = (FFABS(c)*qf + qs) >> 2; \
*dst_r++ = c*sign; \
} \
src += tot_h << (sizeof(PX) >> 1); \
dst += stride; \
} \
}
DEQUANT_SUBBAND(int16_t)
DEQUANT_SUBBAND(int32_t)
#define PIXFUNC(PFX, WIDTH) \
c->PFX ## _dirac_pixels_tab[WIDTH>>4][0] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _c; \
c->PFX ## _dirac_pixels_tab[WIDTH>>4][1] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l2_c; \
@ -214,6 +235,9 @@ av_cold void ff_diracdsp_init(DiracDSPContext *c)
c->biweight_dirac_pixels_tab[1] = biweight_dirac_pixels16_c;
c->biweight_dirac_pixels_tab[2] = biweight_dirac_pixels32_c;
c->dequant_subband[0] = c->dequant_subband[2] = dequant_subband_int16_t_c;
c->dequant_subband[1] = c->dequant_subband[3] = dequant_subband_int32_t_c;
PIXFUNC(put, 8);
PIXFUNC(put, 16);
PIXFUNC(put, 32);

View File

@ -22,6 +22,7 @@
#define AVCODEC_DIRACDSP_H
#include <stdint.h>
#include <stddef.h>
typedef void (*dirac_weight_func)(uint8_t *block, int stride, int log2_denom, int weight, int h);
typedef void (*dirac_biweight_func)(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, int weightd, int weights, int h);
@ -46,6 +47,9 @@ typedef struct {
void (*add_rect_clamped)(uint8_t *dst/*align 16*/, const uint16_t *src/*align 16*/, int stride, const int16_t *idwt/*align 16*/, int idwt_stride, int width, int height/*mod 2*/);
void (*add_dirac_obmc[3])(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen);
/* 0-1: int16_t and int32_t asm/c, 2-3: int16 and int32_t, C only */
void (*dequant_subband[4])(uint8_t *src, uint8_t *dst, ptrdiff_t stride, const int qf, const int qs, int tot_v, int tot_h);
dirac_weight_func weight_dirac_pixels_tab[3];
dirac_biweight_func biweight_dirac_pixels_tab[3];
} DiracDSPContext;

View File

@ -38,4 +38,6 @@ extern const int32_t ff_dirac_qoffset_intra_tab[120];
/* Scaling offsets needed for quantization/dequantization, for inter frames */
extern const int ff_dirac_qoffset_inter_tab[122];
#define DIRAC_MAX_QUANT_INDEX (FF_ARRAY_ELEMS(ff_dirac_qscale_tab))
#endif /* AVCODEC_DIRACTAB_H */

View File

@ -22,7 +22,6 @@
#include "avcodec.h"
#include "dnxhddata.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
/* The quantization tables below are in zigzag order! */
@ -1047,35 +1046,35 @@ const CIDEntry ff_dnxhd_cid_table[] = {
dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_info,
dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
{ 0 } },
{ 0 }, { { 0 } }, { 57344, 255} },
{ 1271, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE,
0, 6, DNXHD_VARIABLE, 4,
dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight,
dnxhd_1235_dc_codes, dnxhd_1235_dc_bits,
dnxhd_1235_ac_codes, dnxhd_1235_ac_bits, dnxhd_1235_ac_info,
dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1235_run,
{ 0 } },
{ 0 }, { { 0 } }, { 28672, 255} },
{ 1272, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE,
0, 4, 8, 4,
dnxhd_1238_luma_weight, dnxhd_1238_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_info,
dnxhd_1235_run_codes, dnxhd_1235_run_bits, dnxhd_1238_run,
{ 0 } },
{ 0 }, { { 0 } }, { 28672, 255} },
{ 1273, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE,
0, 4, 8, 3,
dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_info,
dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
{ 0 } },
{ 0 }, { { 0 } }, { 18944, 255} },
{ 1274, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE, DNXHD_VARIABLE,
0, 4, 8, 3,
dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_info,
dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
{ 0 } },
{ 0 }, { { 0 } }, { 5888, 255} },
};
int ff_dnxhd_get_cid_table(int cid)
@ -1103,17 +1102,38 @@ int avpriv_dnxhd_get_interlaced(int cid)
return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0;
}
#if LIBAVCODEC_VERSION_MAJOR < 58
uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf)
{
uint64_t prefix = AV_RB32(buf);
prefix = (prefix << 16) | buf[4] << 8;
return ff_dnxhd_check_header_prefix(prefix);
return ff_dnxhd_parse_header_prefix(buf);
}
#endif
static int dnxhd_find_hr_cid(AVCodecContext *avctx)
{
switch (avctx->profile) {
case FF_PROFILE_DNXHR_444:
return 1270;
case FF_PROFILE_DNXHR_HQX:
return 1271;
case FF_PROFILE_DNXHR_HQ:
return 1272;
case FF_PROFILE_DNXHR_SQ:
return 1273;
case FF_PROFILE_DNXHR_LB:
return 1274;
}
return 0;
}
int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
{
int i, j;
int mbs = avctx->bit_rate / 1000000;
if (avctx->profile != FF_PROFILE_DNXHD)
return dnxhd_find_hr_cid(avctx);
if (!mbs)
return 0;
for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {

View File

@ -25,6 +25,7 @@
#include <stdint.h>
#include "avcodec.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
/** Additional profile info flags */
#define DNXHD_INTERLACED (1<<0)
@ -34,8 +35,6 @@
/** Frame headers, extra 0x00 added to end for parser */
#define DNXHD_HEADER_INITIAL 0x000002800100
#define DNXHD_HEADER_444 0x000002800200
#define DNXHD_HEADER_HR1 0x000002800300
#define DNXHD_HEADER_HR2 0x0000038C0300
/** Indicate that a CIDEntry value must be read in the bitstream */
#define DNXHD_VARIABLE 0
@ -57,6 +56,7 @@ typedef struct CIDEntry {
const uint8_t *run_bits, *run;
int bit_rates[5]; ///< Helper to choose variants, rounded to nearest 5Mb/s
AVRational frame_rates[5];
AVRational packet_scale;
} CIDEntry;
extern const CIDEntry ff_dnxhd_cid_table[];
@ -65,17 +65,36 @@ int ff_dnxhd_get_cid_table(int cid);
int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth);
void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel);
static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix)
static av_always_inline uint64_t ff_dnxhd_check_header_prefix_hr(uint64_t prefix)
{
if (prefix == DNXHD_HEADER_INITIAL ||
prefix == DNXHD_HEADER_444 ||
prefix == DNXHD_HEADER_HR1 ||
prefix == DNXHD_HEADER_HR2)
uint64_t data_offset = prefix >> 16;
if ((prefix & 0xFFFF0000FFFFLL) == 0x0300 &&
data_offset >= 0x0280 && data_offset <= 0x2170 &&
(data_offset & 3) == 0)
return prefix;
return 0;
}
static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix)
{
if (prefix == DNXHD_HEADER_INITIAL ||
prefix == DNXHD_HEADER_444 ||
ff_dnxhd_check_header_prefix_hr(prefix))
return prefix;
return 0;
}
static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf)
{
uint64_t prefix = AV_RB32(buf);
prefix = (prefix << 16) | buf[4] << 8;
return ff_dnxhd_check_header_prefix(prefix);
}
int avpriv_dnxhd_get_frame_size(int cid);
int avpriv_dnxhd_get_interlaced(int cid);
#if LIBAVCODEC_VERSION_MAJOR < 58
attribute_deprecated
uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf);
#endif
#endif /* AVCODEC_DNXHDDATA_H */

View File

@ -33,6 +33,7 @@
#include "dnxhddata.h"
#include "idctdsp.h"
#include "internal.h"
#include "profiles.h"
#include "thread.h"
typedef struct RowContext {
@ -118,11 +119,6 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, bitdepth);
return AVERROR_INVALIDDATA;
}
if (bitdepth > 10) {
avpriv_request_sample(ctx->avctx, "DNXHR 12-bit");
if (ctx->avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)
return AVERROR_PATCHWELCOME;
}
ctx->cid_table = &ff_dnxhd_cid_table[index];
av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %d.\n", cid);
@ -133,7 +129,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
ctx->cid_table->ac_bits, 1, 1,
ctx->cid_table->ac_codes, 2, 2, 0);
init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth + 4,
init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12,
ctx->cid_table->dc_bits, 1, 1,
ctx->cid_table->dc_codes, 1, 1, 0);
init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62,
@ -159,6 +155,23 @@ static av_cold int dnxhd_decode_init_thread_copy(AVCodecContext *avctx)
return 0;
}
static int dnxhd_get_profile(int cid)
{
switch(cid) {
case 1270:
return FF_PROFILE_DNXHR_444;
case 1271:
return FF_PROFILE_DNXHR_HQX;
case 1272:
return FF_PROFILE_DNXHR_HQ;
case 1273:
return FF_PROFILE_DNXHR_SQ;
case 1274:
return FF_PROFILE_DNXHR_LB;
}
return FF_PROFILE_DNXHD;
}
static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
const uint8_t *buf, int buf_size,
int first_field)
@ -172,7 +185,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}
header_prefix = avpriv_dnxhd_parse_header_prefix(buf);
header_prefix = ff_dnxhd_parse_header_prefix(buf);
if (header_prefix == 0) {
av_log(ctx->avctx, AV_LOG_ERROR,
"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
@ -204,6 +217,9 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
}
cid = AV_RB32(buf + 0x28);
ctx->avctx->profile = dnxhd_get_profile(cid);
if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)
return ret;
if (ctx->mbaff && ctx->cid_table->cid != 1260)
@ -275,7 +291,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
ctx->bit_depth, ctx->mbaff, ctx->act);
// Newer format supports variable mb_scan_index sizes
if (header_prefix == DNXHD_HEADER_HR2) {
if (ctx->mb_height > 68 && ff_dnxhd_check_header_prefix_hr(header_prefix)) {
ctx->data_offset = 0x170 + (ctx->mb_height << 2);
} else {
if (ctx->mb_height > 68 ||
@ -692,4 +708,5 @@ AVCodec ff_dnxhd_decoder = {
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(dnxhd_decode_init_thread_copy),
.profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
};

View File

@ -34,6 +34,7 @@
#include "internal.h"
#include "mpegvideo.h"
#include "pixblockdsp.h"
#include "profiles.h"
#include "dnxhdenc.h"
// The largest value that will not lead to overflow for 10-bit samples.
@ -48,6 +49,21 @@ static const AVOption options[] = {
{ "ibias", "intra quant bias",
offsetof(DNXHDEncContext, intra_quant_bias), AV_OPT_TYPE_INT,
{ .i64 = 0 }, INT_MIN, INT_MAX, VE },
{ "profile", NULL, offsetof(DNXHDEncContext, profile), AV_OPT_TYPE_INT,
{ .i64 = FF_PROFILE_DNXHD },
FF_PROFILE_DNXHD, FF_PROFILE_DNXHR_444, VE, "profile" },
{ "dnxhd", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_DNXHD },
0, 0, VE, "profile" },
{ "dnxhr_444", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_DNXHR_444 },
0, 0, VE, "profile" },
{ "dnxhr_hqx", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_DNXHR_HQX },
0, 0, VE, "profile" },
{ "dnxhr_hq", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_DNXHR_HQ },
0, 0, VE, "profile" },
{ "dnxhr_sq", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_DNXHR_SQ },
0, 0, VE, "profile" },
{ "dnxhr_lb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_DNXHR_LB },
0, 0, VE, "profile" },
{ NULL }
};
@ -270,13 +286,13 @@ fail:
static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx)
{
FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->mb_rc, (ctx->m.avctx->qmax + 1), 8160 * sizeof(RCEntry), fail);
FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->mb_rc, (ctx->m.avctx->qmax + 1),
ctx->m.mb_num * sizeof(RCEntry), fail);
if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->mb_cmp,
ctx->m.mb_num, sizeof(RCCMPEntry), fail);
ctx->frame_bits = (ctx->cid_table->coding_unit_size -
640 - 4 - ctx->min_padding) * 8;
ctx->frame_bits = (ctx->coding_unit_size -
ctx->data_offset - 4 - ctx->min_padding) * 8;
ctx->qscale = 1;
ctx->lambda = 2 << LAMBDA_FRAC_BITS; // qscale 2
return 0;
@ -284,6 +300,12 @@ fail:
return AVERROR(ENOMEM);
}
static int dnxhd_get_hr_frame_size(const CIDEntry* profile, int mb_num)
{
int result = mb_num * profile->packet_scale.num / profile->packet_scale.den;
result = (result + 2048) / 4096 * 4096;
return FFMAX(result, 8192);
}
static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
{
DNXHDEncContext *ctx = avctx->priv_data;
@ -302,6 +324,14 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
if (ctx->profile == FF_PROFILE_DNXHR_HQX ||
ctx->profile == FF_PROFILE_DNXHR_HQX) {
avpriv_report_missing_feature(avctx,
"dnxhr_444 or dnxhr_hqx profile");
return AVERROR_PATCHWELCOME;
}
avctx->profile = ctx->profile;
ctx->cid = ff_dnxhd_find_cid(avctx, bit_depth);
if (!ctx->cid) {
av_log(avctx, AV_LOG_ERROR,
@ -311,6 +341,15 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
}
av_log(avctx, AV_LOG_DEBUG, "cid %d\n", ctx->cid);
if (ctx->cid >= 1270 && ctx->cid <= 1274)
avctx->codec_tag = MKTAG('A','V','d','h');
if (avctx->width < 256 || avctx->height < 120) {
av_log(avctx, AV_LOG_ERROR,
"Input dimensions too small, input must be at least 256x120\n");
return AVERROR(EINVAL);
}
index = ff_dnxhd_get_cid_table(ctx->cid);
av_assert0(index >= 0);
@ -354,6 +393,20 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width;
if (ctx->cid_table->frame_size == DNXHD_VARIABLE) {
ctx->frame_size = dnxhd_get_hr_frame_size(ctx->cid_table,
ctx->m.mb_num);
ctx->coding_unit_size = ctx->frame_size;
} else {
ctx->frame_size = ctx->cid_table->frame_size;
ctx->coding_unit_size = ctx->cid_table->coding_unit_size;
}
if (ctx->m.mb_height > 68)
ctx->data_offset = 0x170 + (ctx->m.mb_height << 2);
else
ctx->data_offset = 0x280;
#if FF_API_QUANT_BIAS
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
@ -414,11 +467,16 @@ fail: // for FF_ALLOCZ_OR_GOTO
static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf)
{
DNXHDEncContext *ctx = avctx->priv_data;
static const uint8_t header_prefix[5] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
memset(buf, 0, 640);
memset(buf, 0, ctx->data_offset);
// * write prefix */
AV_WB16(buf + 0x02, ctx->data_offset);
if (ctx->cid >= 1270 && ctx->cid <= 1274)
buf[4] = 0x03;
else
buf[4] = 0x01;
memcpy(buf, header_prefix, 5);
buf[5] = ctx->interlaced ? ctx->cur_field + 2 : 0x01;
buf[6] = 0x80; // crc flag off
buf[7] = 0xa0; // reserved
@ -572,7 +630,7 @@ void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y)
pdsp->get_pixels(ctx->blocks[2], ptr_u, ctx->m.uvlinesize);
pdsp->get_pixels(ctx->blocks[3], ptr_v, ctx->m.uvlinesize);
if (mb_y + 1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {
if (mb_y + 1 == ctx->m.mb_height && (ctx->m.avctx->height % 16) != 0) {
if (ctx->interlaced) {
ctx->get_pixels_8x4_sym(ctx->blocks[4],
ptr_y + ctx->dct_y_offset,
@ -660,8 +718,8 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg,
ssd += dnxhd_ssd_block(block, src_block);
}
}
ctx->mb_rc[qscale][mb].ssd = ssd;
ctx->mb_rc[qscale][mb].bits = ac_bits + dc_bits + 12 +
ctx->mb_rc[(qscale * ctx->m.mb_num) + mb].ssd = ssd;
ctx->mb_rc[(qscale * ctx->m.mb_num) + mb].bits = ac_bits + dc_bits + 12 +
8 * ctx->vlc_bits[0];
}
return 0;
@ -673,7 +731,7 @@ static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg,
DNXHDEncContext *ctx = avctx->priv_data;
int mb_y = jobnr, mb_x;
ctx = ctx->thread[threadnr];
init_put_bits(&ctx->m.pb, (uint8_t *)arg + 640 + ctx->slice_offs[jobnr],
init_put_bits(&ctx->m.pb, (uint8_t *)arg + ctx->data_offset + ctx->slice_offs[jobnr],
ctx->slice_size[jobnr]);
ctx->m.last_dc[0] =
@ -739,7 +797,7 @@ static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg,
int sum;
int varc;
if (!partial_last_row && mb_x * 16 <= avctx->width - 16) {
if (!partial_last_row && mb_x * 16 <= avctx->width - 16 && (avctx->width % 16) == 0) {
sum = ctx->m.mpvencdsp.pix_sum(pix, ctx->m.linesize);
varc = ctx->m.mpvencdsp.pix_norm1(pix, ctx->m.linesize);
} else {
@ -817,17 +875,20 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
unsigned min = UINT_MAX;
int qscale = 1;
int mb = y * ctx->m.mb_width + x;
int rc = 0;
for (q = 1; q < avctx->qmax; q++) {
unsigned score = ctx->mb_rc[q][mb].bits * lambda +
((unsigned) ctx->mb_rc[q][mb].ssd << LAMBDA_FRAC_BITS);
int i = (q*ctx->m.mb_num) + mb;
unsigned score = ctx->mb_rc[i].bits * lambda +
((unsigned) ctx->mb_rc[i].ssd << LAMBDA_FRAC_BITS);
if (score < min) {
min = score;
qscale = q;
rc = i;
}
}
bits += ctx->mb_rc[qscale][mb].bits;
bits += ctx->mb_rc[rc].bits;
ctx->mb_qscale[mb] = qscale;
ctx->mb_bits[mb] = ctx->mb_rc[qscale][mb].bits;
ctx->mb_bits[mb] = ctx->mb_rc[rc].bits;
}
bits = (bits + 31) & ~31; // padding
if (bits > ctx->frame_bits)
@ -888,7 +949,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx)
NULL, NULL, ctx->m.mb_height);
for (y = 0; y < ctx->m.mb_height; y++) {
for (x = 0; x < ctx->m.mb_width; x++)
bits += ctx->mb_rc[qscale][y*ctx->m.mb_width+x].bits;
bits += ctx->mb_rc[(qscale*ctx->m.mb_num) + (y*ctx->m.mb_width+x)].bits;
bits = (bits+31)&~31; // padding
if (bits > ctx->frame_bits)
break;
@ -997,17 +1058,18 @@ static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
for (y = 0; y < ctx->m.mb_height; y++) {
for (x = 0; x < ctx->m.mb_width; x++) {
int mb = y * ctx->m.mb_width + x;
int rc = (ctx->qscale * ctx->m.mb_num ) + mb;
int delta_bits;
ctx->mb_qscale[mb] = ctx->qscale;
ctx->mb_bits[mb] = ctx->mb_rc[ctx->qscale][mb].bits;
max_bits += ctx->mb_rc[ctx->qscale][mb].bits;
ctx->mb_bits[mb] = ctx->mb_rc[rc].bits;
max_bits += ctx->mb_rc[rc].bits;
if (!RC_VARIANCE) {
delta_bits = ctx->mb_rc[ctx->qscale][mb].bits -
ctx->mb_rc[ctx->qscale + 1][mb].bits;
delta_bits = ctx->mb_rc[rc].bits -
ctx->mb_rc[rc + ctx->m.mb_num].bits;
ctx->mb_cmp[mb].mb = mb;
ctx->mb_cmp[mb].value =
delta_bits ? ((ctx->mb_rc[ctx->qscale][mb].ssd -
ctx->mb_rc[ctx->qscale + 1][mb].ssd) * 100) /
delta_bits ? ((ctx->mb_rc[rc].ssd -
ctx->mb_rc[rc + ctx->m.mb_num].ssd) * 100) /
delta_bits
: INT_MIN; // avoid increasing qscale
}
@ -1021,10 +1083,11 @@ static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
radix_sort(ctx->mb_cmp, ctx->m.mb_num);
for (x = 0; x < ctx->m.mb_num && max_bits > ctx->frame_bits; x++) {
int mb = ctx->mb_cmp[x].mb;
max_bits -= ctx->mb_rc[ctx->qscale][mb].bits -
ctx->mb_rc[ctx->qscale + 1][mb].bits;
int rc = (ctx->qscale * ctx->m.mb_num ) + mb;
max_bits -= ctx->mb_rc[rc].bits -
ctx->mb_rc[rc + ctx->m.mb_num].bits;
ctx->mb_qscale[mb] = ctx->qscale + 1;
ctx->mb_bits[mb] = ctx->mb_rc[ctx->qscale + 1][mb].bits;
ctx->mb_bits[mb] = ctx->mb_rc[rc + ctx->m.mb_num].bits;
}
}
return 0;
@ -1057,7 +1120,7 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
int offset, i, ret;
uint8_t *buf;
if ((ret = ff_alloc_packet2(avctx, pkt, ctx->cid_table->frame_size, 0)) < 0)
if ((ret = ff_alloc_packet2(avctx, pkt, ctx->frame_size, 0)) < 0)
return ret;
buf = pkt->data;
@ -1093,16 +1156,16 @@ encode_coding_unit:
avctx->execute2(avctx, dnxhd_encode_thread, buf, NULL, ctx->m.mb_height);
av_assert1(640 + offset + 4 <= ctx->cid_table->coding_unit_size);
memset(buf + 640 + offset, 0,
ctx->cid_table->coding_unit_size - 4 - offset - 640);
av_assert1(ctx->data_offset + offset + 4 <= ctx->coding_unit_size);
memset(buf + ctx->data_offset + offset, 0,
ctx->coding_unit_size - 4 - offset - ctx->data_offset);
AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
AV_WB32(buf + ctx->coding_unit_size - 4, 0x600DC0DE); // EOF
if (ctx->interlaced && first_field) {
first_field = 0;
ctx->cur_field ^= 1;
buf += ctx->cid_table->coding_unit_size;
buf += ctx->coding_unit_size;
goto encode_coding_unit;
}
@ -1170,4 +1233,5 @@ AVCodec ff_dnxhd_encoder = {
},
.priv_class = &dnxhd_class,
.defaults = dnxhd_defaults,
.profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
};

View File

@ -45,6 +45,7 @@ typedef struct DNXHDEncContext {
MpegEncContext m; ///< Used for quantization dsp functions
int cid;
int profile;
const CIDEntry *cid_table;
uint8_t *msip; ///< Macroblock Scan Indexes Payload
uint32_t *slice_size;
@ -58,6 +59,10 @@ typedef struct DNXHDEncContext {
unsigned dct_uv_offset;
unsigned block_width_l2;
int frame_size;
int coding_unit_size;
int data_offset;
int interlaced;
int cur_field;
@ -89,7 +94,7 @@ typedef struct DNXHDEncContext {
uint8_t *mb_qscale;
RCCMPEntry *mb_cmp;
RCEntry (*mb_rc)[8160];
RCEntry *mb_rc;
void (*get_pixels_8x4_sym)(int16_t * /* align 16 */,
const uint8_t *, ptrdiff_t);

View File

@ -44,7 +44,6 @@
#include "avcodec.h"
#include "dv.h"
#include "dvdata.h"
#include "get_bits.h"
#include "internal.h"
#include "put_bits.h"
#include "simple_idct.h"

View File

@ -29,8 +29,8 @@
#include "avcodec.h"
#include "dv_profile.h"
#include "get_bits.h"
#include "me_cmp.h"
#include "vlc.h"
typedef struct DVwork_chunk {
uint16_t buf_offset;

View File

@ -18,8 +18,14 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <inttypes.h>
#include <string.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
/* Parser (mostly) copied from dvdsub.c */

View File

@ -27,6 +27,7 @@
#include "config.h"
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
@ -35,6 +36,7 @@
#include "dv_tablegen.h"
#include "fdctdsp.h"
#include "internal.h"
#include "mathops.h"
#include "me_cmp.h"
#include "pixblockdsp.h"
#include "put_bits.h"

View File

@ -22,14 +22,15 @@
#include <inttypes.h>
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "internal.h"
#include "unary.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic,
const uint8_t *src, int src_size,

View File

@ -22,8 +22,9 @@
#include "libavutil/avassert.h"
#include "h264.h"
#include "h264dec.h"
#include "h264data.h"
#include "h264_ps.h"
#include "mpegutils.h"
// The headers above may include w32threads.h, which uses the original

View File

@ -28,13 +28,13 @@
* http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TGQ
*/
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#include "bytestream.h"
#include "idctdsp.h"
#include "aandcttab.h"
#include "avcodec.h"
#include "bytestream.h"
#include "eaidct.h"
#include "get_bits.h"
#include "idctdsp.h"
#include "internal.h"
typedef struct TgqContext {

View File

@ -28,13 +28,14 @@
* http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TGV
*/
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#include "internal.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
#define EA_PREAMBLE_SIZE 8
#define kVGT_TAG MKTAG('k', 'V', 'G', 'T')

View File

@ -19,11 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "internal.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
typedef union MacroBlock {
uint16_t pixels[4];

View File

@ -21,8 +21,9 @@
#include "libavutil/attributes.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"

View File

@ -129,6 +129,8 @@ typedef struct EXRContext {
EXRTileAttribute tile_attr; /* header data attribute of tile */
int is_tile; /* 0 if scanline, 1 if tile */
int is_luma;/* 1 if there is an Y plane */
GetByteContext gb;
const uint8_t *buf;
int buf_size;
@ -749,6 +751,9 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
uint16_t *tmp = (uint16_t *)td->tmp;
uint8_t *out;
int ret, i, j;
int pixel_half_size;/* 1 for half, 2 for float and uint32 */
EXRChannel *channel;
int tmp_offset;
if (!td->bitmap)
td->bitmap = av_malloc(BITMAP_SIZE);
@ -781,24 +786,38 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
ptr = tmp;
for (i = 0; i < s->nb_channels; i++) {
EXRChannel *channel = &s->channels[i];
int size = channel->pixel_type;
channel = &s->channels[i];
for (j = 0; j < size; j++)
wav_decode(ptr + j, td->xsize, size, td->ysize,
td->xsize * size, maxval);
ptr += td->xsize * td->ysize * size;
if (channel->pixel_type == EXR_HALF)
pixel_half_size = 1;
else
pixel_half_size = 2;
for (j = 0; j < pixel_half_size; j++)
wav_decode(ptr + j, td->xsize, pixel_half_size, td->ysize,
td->xsize * pixel_half_size, maxval);
ptr += td->xsize * td->ysize * pixel_half_size;
}
apply_lut(td->lut, tmp, dsize / sizeof(uint16_t));
out = td->uncompressed_data;
for (i = 0; i < td->ysize; i++)
for (i = 0; i < td->ysize; i++) {
tmp_offset = 0;
for (j = 0; j < s->nb_channels; j++) {
uint16_t *in = tmp + j * td->xsize * td->ysize + i * td->xsize;
memcpy(out, in, td->xsize * 2);
out += td->xsize * 2;
uint16_t *in;
EXRChannel *channel = &s->channels[j];
if (channel->pixel_type == EXR_HALF)
pixel_half_size = 1;
else
pixel_half_size = 2;
in = tmp + tmp_offset * td->xsize * td->ysize + i * td->xsize * pixel_half_size;
tmp_offset += pixel_half_size;
memcpy(out, in, td->xsize * 2 * pixel_half_size);
out += td->xsize * 2 * pixel_half_size;
}
}
return 0;
}
@ -925,74 +944,74 @@ static void unpack_3(const uint8_t b[3], uint16_t s[16])
static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size,
int uncompressed_size, EXRThreadData *td) {
const int8_t *sr = src;
int stayToUncompress = compressed_size;
int nbB44BlockW, nbB44BlockH;
int indexHgX, indexHgY, indexOut, indexTmp;
uint16_t tmpBuffer[16]; /* B44 use 4x4 half float pixel */
int stay_to_uncompress = compressed_size;
int nb_b44_block_w, nb_b44_block_h;
int index_tl_x, index_tl_y, index_out, index_tmp;
uint16_t tmp_buffer[16]; /* B44 use 4x4 half float pixel */
int c, iY, iX, y, x;
int target_channel_offset = 0;
/* calc B44 block count */
nbB44BlockW = td->xsize / 4;
nb_b44_block_w = td->xsize / 4;
if ((td->xsize % 4) != 0)
nbB44BlockW++;
nb_b44_block_w++;
nbB44BlockH = td->ysize / 4;
nb_b44_block_h = td->ysize / 4;
if ((td->ysize % 4) != 0)
nbB44BlockH++;
nb_b44_block_h++;
for (c = 0; c < s->nb_channels; c++) {
if (s->channels[c].pixel_type == EXR_HALF) {/* B44 only compress half float data */
for (iY = 0; iY < nbB44BlockH; iY++) {
for (iX = 0; iX < nbB44BlockW; iX++) {/* For each B44 block */
if (stayToUncompress < 3) {
av_log(s, AV_LOG_ERROR, "Not enough data for B44A block: %d", stayToUncompress);
for (iY = 0; iY < nb_b44_block_h; iY++) {
for (iX = 0; iX < nb_b44_block_w; iX++) {/* For each B44 block */
if (stay_to_uncompress < 3) {
av_log(s, AV_LOG_ERROR, "Not enough data for B44A block: %d", stay_to_uncompress);
return AVERROR_INVALIDDATA;
}
if (src[compressed_size - stayToUncompress + 2] == 0xfc) { /* B44A block */
unpack_3(sr, tmpBuffer);
if (src[compressed_size - stay_to_uncompress + 2] == 0xfc) { /* B44A block */
unpack_3(sr, tmp_buffer);
sr += 3;
stayToUncompress -= 3;
stay_to_uncompress -= 3;
} else {/* B44 Block */
if (stayToUncompress < 14) {
av_log(s, AV_LOG_ERROR, "Not enough data for B44 block: %d", stayToUncompress);
if (stay_to_uncompress < 14) {
av_log(s, AV_LOG_ERROR, "Not enough data for B44 block: %d", stay_to_uncompress);
return AVERROR_INVALIDDATA;
}
unpack_14(sr, tmpBuffer);
unpack_14(sr, tmp_buffer);
sr += 14;
stayToUncompress -= 14;
stay_to_uncompress -= 14;
}
/* copy data to uncompress buffer (B44 block can exceed target resolution)*/
indexHgX = iX * 4;
indexHgY = iY * 4;
index_tl_x = iX * 4;
index_tl_y = iY * 4;
for (y = indexHgY; y < FFMIN(indexHgY + 4, td->ysize); y++) {
for (x = indexHgX; x < FFMIN(indexHgX + 4, td->xsize); x++) {
indexOut = target_channel_offset * td->xsize + y * td->channel_line_size + 2 * x;
indexTmp = (y-indexHgY) * 4 + (x-indexHgX);
td->uncompressed_data[indexOut] = tmpBuffer[indexTmp] & 0xff;
td->uncompressed_data[indexOut + 1] = tmpBuffer[indexTmp] >> 8;
for (y = index_tl_y; y < FFMIN(index_tl_y + 4, td->ysize); y++) {
for (x = index_tl_x; x < FFMIN(index_tl_x + 4, td->xsize); x++) {
index_out = target_channel_offset * td->xsize + y * td->channel_line_size + 2 * x;
index_tmp = (y-index_tl_y) * 4 + (x-index_tl_x);
td->uncompressed_data[index_out] = tmp_buffer[index_tmp] & 0xff;
td->uncompressed_data[index_out + 1] = tmp_buffer[index_tmp] >> 8;
}
}
}
}
target_channel_offset += 2;
} else {/* Float or UINT 32 channel */
if (stayToUncompress < td->ysize * td->xsize * 4) {
av_log(s, AV_LOG_ERROR, "Not enough data for uncompress channel: %d", stayToUncompress);
if (stay_to_uncompress < td->ysize * td->xsize * 4) {
av_log(s, AV_LOG_ERROR, "Not enough data for uncompress channel: %d", stay_to_uncompress);
return AVERROR_INVALIDDATA;
}
for (y = 0; y < td->ysize; y++) {
indexOut = target_channel_offset * td->xsize + y * td->channel_line_size;
memcpy(&td->uncompressed_data[indexOut], sr, td->xsize * 4);
index_out = target_channel_offset * td->xsize + y * td->channel_line_size;
memcpy(&td->uncompressed_data[index_out], sr, td->xsize * 4);
sr += td->xsize * 4;
}
target_channel_offset += 4;
stayToUncompress -= td->ysize * td->xsize * 4;
stay_to_uncompress -= td->ysize * td->xsize * 4;
}
}
@ -1016,6 +1035,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
int axmax = (avctx->width - (s->xmax + 1)) * 2 * s->desc->nb_components; /* nb pixel to add at the right of the datawindow */
int bxmin = s->xmin * 2 * s->desc->nb_components; /* nb pixel to add at the left of the datawindow */
int i, x, buf_size = s->buf_size;
int c, rgb_channel_count;
float one_gamma = 1.0f / s->gamma;
avpriv_trc_function trc_func = avpriv_get_trc_function_from_trc(s->apply_trc_type);
int ret;
@ -1125,9 +1145,15 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
src = td->uncompressed_data;
}
channel_buffer[0] = src + td->xsize * s->channel_offsets[0];
channel_buffer[1] = src + td->xsize * s->channel_offsets[1];
channel_buffer[2] = src + td->xsize * s->channel_offsets[2];
if (!s->is_luma) {
channel_buffer[0] = src + td->xsize * s->channel_offsets[0];
channel_buffer[1] = src + td->xsize * s->channel_offsets[1];
channel_buffer[2] = src + td->xsize * s->channel_offsets[2];
rgb_channel_count = 3;
} else { /* put y data in the first channel_buffer */
channel_buffer[0] = src + td->xsize * s->channel_offsets[1];
rgb_channel_count = 1;
}
if (s->channel_offsets[3] >= 0)
channel_buffer[3] = src + td->xsize * s->channel_offsets[3];
@ -1136,11 +1162,13 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
for (i = 0;
i < td->ysize; i++, ptr += p->linesize[0]) {
const uint8_t *r, *g, *b, *a;
const uint8_t * a;
const uint8_t *rgb[3];
for (c = 0; c < rgb_channel_count; c++){
rgb[c] = channel_buffer[c];
}
r = channel_buffer[0];
g = channel_buffer[1];
b = channel_buffer[2];
if (channel_buffer[3])
a = channel_buffer[3];
@ -1155,37 +1183,27 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
if (trc_func) {
for (x = 0; x < td->xsize; x++) {
union av_intfloat32 t;
t.i = bytestream_get_le32(&r);
t.f = trc_func(t.f);
*ptr_x++ = exr_flt2uint(t.i);
t.i = bytestream_get_le32(&g);
t.f = trc_func(t.f);
*ptr_x++ = exr_flt2uint(t.i);
t.i = bytestream_get_le32(&b);
t.f = trc_func(t.f);
*ptr_x++ = exr_flt2uint(t.i);
for (c = 0; c < rgb_channel_count; c++) {
t.i = bytestream_get_le32(&rgb[c]);
t.f = trc_func(t.f);
*ptr_x++ = exr_flt2uint(t.i);
}
if (channel_buffer[3])
*ptr_x++ = exr_flt2uint(bytestream_get_le32(&a));
}
} else {
for (x = 0; x < td->xsize; x++) {
union av_intfloat32 t;
t.i = bytestream_get_le32(&r);
if (t.f > 0.0f) /* avoid negative values */
t.f = powf(t.f, one_gamma);
*ptr_x++ = exr_flt2uint(t.i);
int c;
t.i = bytestream_get_le32(&g);
if (t.f > 0.0f)
t.f = powf(t.f, one_gamma);
*ptr_x++ = exr_flt2uint(t.i);
for (c = 0; c < rgb_channel_count; c++) {
t.i = bytestream_get_le32(&rgb[c]);
if (t.f > 0.0f) /* avoid negative values */
t.f = powf(t.f, one_gamma);
*ptr_x++ = exr_flt2uint(t.i);
}
t.i = bytestream_get_le32(&b);
if (t.f > 0.0f)
t.f = powf(t.f, one_gamma);
*ptr_x++ = exr_flt2uint(t.i);
if (channel_buffer[3])
*ptr_x++ = exr_flt2uint(bytestream_get_le32(&a));
}
@ -1193,9 +1211,11 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
} else {
// 16-bit
for (x = 0; x < td->xsize; x++) {
*ptr_x++ = s->gamma_table[bytestream_get_le16(&r)];
*ptr_x++ = s->gamma_table[bytestream_get_le16(&g)];
*ptr_x++ = s->gamma_table[bytestream_get_le16(&b)];
int c;
for (c = 0; c < rgb_channel_count; c++) {
*ptr_x++ = s->gamma_table[bytestream_get_le16(&rgb[c])];
}
if (channel_buffer[3])
*ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a));
}
@ -1279,6 +1299,7 @@ static int decode_header(EXRContext *s)
s->tile_attr.xSize = -1;
s->tile_attr.ySize = -1;
s->is_tile = 0;
s->is_luma = 0;
if (bytestream2_get_bytes_left(&s->gb) < 10) {
av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
@ -1346,21 +1367,27 @@ static int decode_header(EXRContext *s)
if (layer_match) { /* only search channel if the layer match is valid */
if (!strcmp(ch_gb.buffer, "R") ||
!strcmp(ch_gb.buffer, "X") ||
!strcmp(ch_gb.buffer, "U"))
!strcmp(ch_gb.buffer, "U")) {
channel_index = 0;
else if (!strcmp(ch_gb.buffer, "G") ||
!strcmp(ch_gb.buffer, "Y") ||
!strcmp(ch_gb.buffer, "V"))
s->is_luma = 0;
} else if (!strcmp(ch_gb.buffer, "G") ||
!strcmp(ch_gb.buffer, "V")) {
channel_index = 1;
else if (!strcmp(ch_gb.buffer, "B") ||
!strcmp(ch_gb.buffer, "Z") ||
!strcmp(ch_gb.buffer, "W"))
channel_index = 2;
else if (!strcmp(ch_gb.buffer, "A"))
s->is_luma = 0;
} else if (!strcmp(ch_gb.buffer, "Y")) {
channel_index = 1;
s->is_luma = 1;
} else if (!strcmp(ch_gb.buffer, "B") ||
!strcmp(ch_gb.buffer, "Z") ||
!strcmp(ch_gb.buffer, "W")){
channel_index = 2;
s->is_luma = 0;
} else if (!strcmp(ch_gb.buffer, "A")) {
channel_index = 3;
else
} else {
av_log(s->avctx, AV_LOG_WARNING,
"Unsupported channel %.256s.\n", ch_gb.buffer);
}
}
/* skip until you get a 0 */
@ -1383,6 +1410,7 @@ static int decode_header(EXRContext *s)
bytestream2_skip(&ch_gb, 4);
xsub = bytestream2_get_le32(&ch_gb);
ysub = bytestream2_get_le32(&ch_gb);
if (xsub != 1 || ysub != 1) {
avpriv_report_missing_feature(s->avctx,
"Subsampling %dx%d",
@ -1417,16 +1445,18 @@ static int decode_header(EXRContext *s)
/* Check if all channels are set with an offset or if the channels
* are causing an overflow */
if (FFMIN3(s->channel_offsets[0],
s->channel_offsets[1],
s->channel_offsets[2]) < 0) {
if (s->channel_offsets[0] < 0)
av_log(s->avctx, AV_LOG_ERROR, "Missing red channel.\n");
if (s->channel_offsets[1] < 0)
av_log(s->avctx, AV_LOG_ERROR, "Missing green channel.\n");
if (s->channel_offsets[2] < 0)
av_log(s->avctx, AV_LOG_ERROR, "Missing blue channel.\n");
return AVERROR_INVALIDDATA;
if (!s->is_luma){/* if we expected to have at least 3 channels */
if (FFMIN3(s->channel_offsets[0],
s->channel_offsets[1],
s->channel_offsets[2]) < 0) {
if (s->channel_offsets[0] < 0)
av_log(s->avctx, AV_LOG_ERROR, "Missing red channel.\n");
if (s->channel_offsets[1] < 0)
av_log(s->avctx, AV_LOG_ERROR, "Missing green channel.\n");
if (s->channel_offsets[2] < 0)
av_log(s->avctx, AV_LOG_ERROR, "Missing blue channel.\n");
return AVERROR_INVALIDDATA;
}
}
// skip one last byte and update main gb
@ -1577,10 +1607,19 @@ static int decode_frame(AVCodecContext *avctx, void *data,
switch (s->pixel_type) {
case EXR_FLOAT:
case EXR_HALF:
if (s->channel_offsets[3] >= 0)
avctx->pix_fmt = AV_PIX_FMT_RGBA64;
else
avctx->pix_fmt = AV_PIX_FMT_RGB48;
if (s->channel_offsets[3] >= 0) {
if (!s->is_luma) {
avctx->pix_fmt = AV_PIX_FMT_RGBA64;
} else {
avctx->pix_fmt = AV_PIX_FMT_YA16;
}
} else {
if (!s->is_luma) {
avctx->pix_fmt = AV_PIX_FMT_RGB48;
} else {
avctx->pix_fmt = AV_PIX_FMT_GRAY16;
}
}
break;
case EXR_UINT:
avpriv_request_sample(avctx, "32-bit unsigned int");

View File

@ -31,25 +31,42 @@
#include "jni.h"
#include "ffjni.h"
static JavaVM *java_vm = NULL;
static JavaVM *java_vm;
static pthread_key_t current_env;
static pthread_once_t once = PTHREAD_ONCE_INIT;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx)
static void jni_detach_env(void *data)
{
if (java_vm) {
(*java_vm)->DetachCurrentThread(java_vm);
}
}
static void jni_create_pthread_key(void)
{
pthread_key_create(&current_env, jni_detach_env);
}
JNIEnv *ff_jni_get_env(void *log_ctx)
{
int ret = 0;
JNIEnv *env = NULL;
*attached = 0;
pthread_mutex_lock(&lock);
if (java_vm == NULL) {
java_vm = av_jni_get_java_vm(log_ctx);
}
pthread_mutex_unlock(&lock);
if (!java_vm) {
av_log(log_ctx, AV_LOG_ERROR, "No Java virtual machine has been registered\n");
return NULL;
goto done;
}
pthread_once(&once, jni_create_pthread_key);
if ((env = pthread_getspecific(current_env)) != NULL) {
goto done;
}
ret = (*java_vm)->GetEnv(java_vm, (void **)&env, JNI_VERSION_1_6);
@ -59,7 +76,7 @@ JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx)
av_log(log_ctx, AV_LOG_ERROR, "Failed to attach the JNI environment to the current thread\n");
env = NULL;
} else {
*attached = 1;
pthread_setspecific(current_env, env);
}
break;
case JNI_OK:
@ -72,19 +89,11 @@ JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx)
break;
}
done:
pthread_mutex_unlock(&lock);
return env;
}
int ff_jni_detach_env(void *log_ctx)
{
if (java_vm == NULL) {
av_log(log_ctx, AV_LOG_ERROR, "No Java virtual machine has been registered\n");
return AVERROR(EINVAL);
}
return (*java_vm)->DetachCurrentThread(java_vm);
}
char *ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx)
{
char *ret = NULL;

View File

@ -26,7 +26,10 @@
#include <jni.h>
/*
* Attach a JNI environment to the current thread.
* Attach permanently a JNI environment to the current thread and retrieve it.
*
* If successfully attached, the JNI environment will automatically be detached
* at thread destruction.
*
* @param attached pointer to an integer that will be set to 1 if the
* environment has been attached to the current thread or 0 if it is
@ -34,15 +37,7 @@
* @param log_ctx context used for logging, can be NULL
* @return the JNI environment on success, NULL otherwise
*/
JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx);
/*
* Detach the JNI environment from the current thread.
*
* @param log_ctx context used for logging, can be NULL
* @return 0 on success, < 0 otherwise
*/
int ff_jni_detach_env(void *log_ctx);
JNIEnv *ff_jni_get_env(void *log_ctx);
/*
* Convert a jstring to its utf characters equivalent.

View File

@ -36,7 +36,6 @@
#include "avcodec.h"
#include "internal.h"
#include "rangecoder.h"
#include "golomb.h"
#include "mathops.h"
#include "ffv1.h"

View File

@ -881,7 +881,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if ((ret = ff_ffv1_common_init(avctx)) < 0)
return ret;
if (avctx->extradata && (ret = read_extra_header(f)) < 0)
if (avctx->extradata_size > 0 && (ret = read_extra_header(f)) < 0)
return ret;
if ((ret = ff_ffv1_init_slice_contexts(f)) < 0)

View File

@ -24,6 +24,7 @@
#include "libavutil/intmath.h"
#include "libavutil/md5.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bswapdsp.h"
#include "put_bits.h"

View File

@ -25,17 +25,18 @@
* G.723.1 compatible decoder
*/
#define BITSTREAM_READER_LE
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "get_bits.h"
#define BITSTREAM_READER_LE
#include "acelp_vectors.h"
#include "avcodec.h"
#include "celp_filters.h"
#include "celp_math.h"
#include "g723_1.h"
#include "get_bits.h"
#include "internal.h"
#include "g723_1.h"
#define CNG_RANDOM_SEED 12345

View File

@ -26,6 +26,13 @@ const uint16_t ff_gsm_long_term_gain_tab[4] = {
3277, 11469, 21299, 32767
};
const uint8_t ff_gsm_requant_tab[4][8] = {
{ 0 },
{ 0, 7 },
{ 0, 2, 5, 7 },
{ 0, 1, 2, 3, 4, 5, 6, 7 }
};
const int16_t ff_gsm_dequant_tab[64][8] = {
{ -28, -20, -12, -4, 4, 12, 20, 28},
{ -56, -40, -24, -8, 8, 24, 40, 56},

View File

@ -38,6 +38,7 @@ typedef struct GSMContext {
} GSMContext;
extern const uint16_t ff_gsm_long_term_gain_tab[4];
extern const uint8_t ff_gsm_requant_tab[4][8];
extern const int16_t ff_gsm_dequant_tab[64][8];
extern const int* const ff_gsm_apcm_bits[][4];

View File

@ -28,13 +28,6 @@
#include "gsm.h"
#include "gsmdec_data.h"
static const int requant_tab[4][8] = {
{ 0 },
{ 0, 7 },
{ 0, 2, 5, 7 },
{ 0, 1, 2, 3, 4, 5, 6, 7 }
};
static void apcm_dequant_add(GetBitContext *gb, int16_t *dst, const int *frame_bits)
{
int i, val;
@ -42,7 +35,7 @@ static void apcm_dequant_add(GetBitContext *gb, int16_t *dst, const int *frame_b
const int16_t *tab = ff_gsm_dequant_tab[maxidx];
for (i = 0; i < 13; i++) {
val = get_bits(gb, frame_bits[i]);
dst[3*i] += tab[requant_tab[frame_bits[i]][val]];
dst[3 * i] += tab[ff_gsm_requant_tab[frame_bits[i]][val]];
}
}

View File

@ -35,7 +35,6 @@
#include "h263data.h"
#include "mathops.h"
#include "mpegutils.h"
#include "unary.h"
#include "flv.h"
#include "mpeg4video.h"

File diff suppressed because it is too large Load Diff

View File

@ -258,7 +258,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
int extract_length = 0;
int skip_trailing_zeros = 1;
if (buf >= next_avc) {
if (buf == next_avc) {
int i;
for (i = 0; i < nal_length_size; i++)
extract_length = (extract_length << 8) | buf[i];
@ -271,6 +271,9 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
}
next_avc = buf + extract_length;
} else {
if (buf > next_avc)
av_log(logctx, AV_LOG_WARNING, "Exceeded next NALFF position, re-syncing.\n");
/* search start code */
while (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
++buf;
@ -290,7 +293,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
buf += 3;
length -= 3;
extract_length = length;
extract_length = FFMIN(length, next_avc - buf);
if (buf >= next_avc) {
/* skip to the start of the next NAL */

View File

@ -37,10 +37,9 @@
#include "cabac_functions.h"
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264data.h"
#include "h264_mvpred.h"
#include "golomb.h"
#include "mpegutils.h"
#if ARCH_X86
@ -2359,7 +2358,7 @@ decode_intra_mb:
}
}
if (sl->top_type && !IS_8x8DCT(sl->top_type)){
uint32_t top_empty = CABAC(h) && !IS_INTRA(mb_type) ? 0 : 0x40404040;
uint32_t top_empty = !IS_INTRA(mb_type) ? 0 : 0x40404040;
AV_WN32A(&nnz_cache[4+8* 0], top_empty);
AV_WN32A(&nnz_cache[4+8* 5], top_empty);
AV_WN32A(&nnz_cache[4+8*10], top_empty);
@ -2404,8 +2403,8 @@ decode_intra_mb:
if (sl->qscale < 0) sl->qscale += max_qp + 1;
else sl->qscale -= max_qp + 1;
}
sl->chroma_qp[0] = get_chroma_qp(h, 0, sl->qscale);
sl->chroma_qp[1] = get_chroma_qp(h, 1, sl->qscale);
sl->chroma_qp[0] = get_chroma_qp(h->ps.pps, 0, sl->qscale);
sl->chroma_qp[1] = get_chroma_qp(h->ps.pps, 1, sl->qscale);
}else
sl->last_qscale_diff=0;

View File

@ -30,7 +30,7 @@
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264_mvpred.h"
#include "h264data.h"
#include "golomb.h"
@ -1123,8 +1123,8 @@ decode_intra_mb:
}
}
sl->chroma_qp[0] = get_chroma_qp(h, 0, sl->qscale);
sl->chroma_qp[1] = get_chroma_qp(h, 1, sl->qscale);
sl->chroma_qp[0] = get_chroma_qp(h->ps.pps, 0, sl->qscale);
sl->chroma_qp[1] = get_chroma_qp(h->ps.pps, 1, sl->qscale);
if ((ret = decode_luma_residual(h, sl, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ) {
return -1;

View File

@ -27,7 +27,8 @@
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264_ps.h"
#include "mpegutils.h"
#include "rectangle.h"
#include "thread.h"

View File

@ -29,7 +29,8 @@
#include "libavutil/intreadwrite.h"
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264_ps.h"
#include "mathops.h"
#include "mpegutils.h"
#include "rectangle.h"
@ -258,9 +259,9 @@ static av_always_inline void h264_filter_mb_fast_internal(const H264Context *h,
int qp = h->cur_pic.qscale_table[mb_xy];
int qp0 = h->cur_pic.qscale_table[mb_xy - 1];
int qp1 = h->cur_pic.qscale_table[sl->top_mb_xy];
int qpc = get_chroma_qp( h, 0, qp );
int qpc0 = get_chroma_qp( h, 0, qp0 );
int qpc1 = get_chroma_qp( h, 0, qp1 );
int qpc = get_chroma_qp(h->ps.pps, 0, qp);
int qpc0 = get_chroma_qp(h->ps.pps, 0, qp0);
int qpc1 = get_chroma_qp(h->ps.pps, 0, qp1);
qp0 = (qp + qp0 + 1) >> 1;
qp1 = (qp + qp1 + 1) >> 1;
qpc0 = (qpc + qpc0 + 1) >> 1;
@ -529,8 +530,8 @@ static av_always_inline void filter_mb_dir(const H264Context *h, H264SliceContex
ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);
{ int i; for (i = 0; i < 4; i++) ff_tlog(h->avctx, " bS[%d]:%d", i, bS[i]); ff_tlog(h->avctx, "\n"); }
filter_mb_edgeh( &img_y[j*linesize], tmp_linesize, bS, qp, a, b, h, 0 );
chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h, 0, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;
chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h, 1, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;
chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;
chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;
if (chroma) {
if (chroma444) {
filter_mb_edgeh (&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0);
@ -594,8 +595,8 @@ static av_always_inline void filter_mb_dir(const H264Context *h, H264SliceContex
//ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp[0], h->cur_pic.qscale_table[mbn_xy]);
ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);
//{ int i; for (i = 0; i < 4; i++) ff_tlog(h->avctx, " bS[%d]:%d", i, bS[i]); ff_tlog(h->avctx, "\n"); }
chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h, 0, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;
chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h, 1, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;
chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;
chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;
if( dir == 0 ) {
filter_mb_edgev( &img_y[0], linesize, bS, qp, a, b, h, 1 );
if (chroma) {
@ -779,15 +780,15 @@ void ff_h264_filter_mb(const H264Context *h, H264SliceContext *sl,
mbn0_qp = h->cur_pic.qscale_table[sl->left_mb_xy[0]];
mbn1_qp = h->cur_pic.qscale_table[sl->left_mb_xy[1]];
qp[0] = ( mb_qp + mbn0_qp + 1 ) >> 1;
bqp[0] = ( get_chroma_qp( h, 0, mb_qp ) +
get_chroma_qp( h, 0, mbn0_qp ) + 1 ) >> 1;
rqp[0] = ( get_chroma_qp( h, 1, mb_qp ) +
get_chroma_qp( h, 1, mbn0_qp ) + 1 ) >> 1;
bqp[0] = (get_chroma_qp(h->ps.pps, 0, mb_qp) +
get_chroma_qp(h->ps.pps, 0, mbn0_qp) + 1) >> 1;
rqp[0] = (get_chroma_qp(h->ps.pps, 1, mb_qp) +
get_chroma_qp(h->ps.pps, 1, mbn0_qp) + 1) >> 1;
qp[1] = ( mb_qp + mbn1_qp + 1 ) >> 1;
bqp[1] = ( get_chroma_qp( h, 0, mb_qp ) +
get_chroma_qp( h, 0, mbn1_qp ) + 1 ) >> 1;
rqp[1] = ( get_chroma_qp( h, 1, mb_qp ) +
get_chroma_qp( h, 1, mbn1_qp ) + 1 ) >> 1;
bqp[1] = (get_chroma_qp(h->ps.pps, 0, mb_qp) +
get_chroma_qp(h->ps.pps, 0, mbn1_qp) + 1 ) >> 1;
rqp[1] = (get_chroma_qp(h->ps.pps, 1, mb_qp) +
get_chroma_qp(h->ps.pps, 1, mbn1_qp) + 1 ) >> 1;
/* Filter edge */
ff_tlog(h->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPb:%d/%d QPr:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], bqp[0], bqp[1], rqp[0], rqp[1], linesize, uvlinesize);

View File

@ -31,7 +31,8 @@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264_ps.h"
#include "qpeldsp.h"
#include "thread.h"

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "h264.h"
#include "h264dec.h"
#undef MCFUNC

View File

@ -30,7 +30,7 @@
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "mpegutils.h"
#include "libavutil/avassert.h"

View File

@ -20,13 +20,15 @@
#include "get_bits.h"
#include "golomb.h"
#include "h264.h"
#include "h264dec.h"
#include "h264_parse.h"
#include "h264_ps.h"
int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
const int *ref_count, int slice_type_nos,
H264PredWeightTable *pwt, void *logctx)
{
int list, i;
int list, i, j;
int luma_def, chroma_def;
pwt->use_weight = 0;
@ -88,6 +90,14 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
}
}
}
// for MBAFF
pwt->luma_weight[16 + 2 * i][list][0] = pwt->luma_weight[16 + 2 * i + 1][list][0] = pwt->luma_weight[i][list][0];
pwt->luma_weight[16 + 2 * i][list][1] = pwt->luma_weight[16 + 2 * i + 1][list][1] = pwt->luma_weight[i][list][1];
for (j = 0; j < 2; j++) {
pwt->chroma_weight[16 + 2 * i][list][j][0] = pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = pwt->chroma_weight[i][list][j][0];
pwt->chroma_weight[16 + 2 * i][list][j][1] = pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = pwt->chroma_weight[i][list][j][1];
}
}
if (slice_type_nos != AV_PICTURE_TYPE_B)
break;
@ -336,12 +346,12 @@ static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps,
for (i = 0; i < pkt.nb_nals; i++) {
H2645NAL *nal = &pkt.nals[i];
switch (nal->type) {
case NAL_SPS:
case H264_NAL_SPS:
ret = ff_h264_decode_seq_parameter_set(&nal->gb, logctx, ps, 0);
if (ret < 0)
goto fail;
break;
case NAL_PPS:
case H264_NAL_PPS:
ret = ff_h264_decode_picture_parameter_set(&nal->gb, logctx, ps,
nal->size_bits);
if (ret < 0)

View File

@ -25,6 +25,7 @@
#define AVCODEC_H264_PARSE_H
#include "get_bits.h"
#include "h264_ps.h"
typedef struct H264PredWeightTable {
int use_weight;
@ -52,11 +53,7 @@ typedef struct H264POCContext {
int prev_frame_num; ///< frame_num of the last pic for POC type 1/2
} H264POCContext;
struct SPS;
struct PPS;
struct H264ParamSets;
int ff_h264_pred_weight_table(GetBitContext *gb, const struct SPS *sps,
int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
const int *ref_count, int slice_type_nos,
H264PredWeightTable *pwt, void *logctx);
@ -76,20 +73,20 @@ int ff_h264_check_intra_pred_mode(void *logctx, int top_samples_available,
int mode, int is_chroma);
int ff_h264_parse_ref_count(int *plist_count, int ref_count[2],
GetBitContext *gb, const struct PPS *pps,
GetBitContext *gb, const PPS *pps,
int slice_type_nos, int picture_structure, void *logctx);
int ff_h264_init_poc(int pic_field_poc[2], int *pic_poc,
const struct SPS *sps, H264POCContext *poc,
const SPS *sps, H264POCContext *poc,
int picture_structure, int nal_ref_idc);
int ff_h264_decode_extradata(const uint8_t *data, int size, struct H264ParamSets *ps,
int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps,
int *is_avc, int *nal_length_size,
int err_recognition, void *logctx);
/**
* compute profile from sps
*/
int ff_h264_get_profile(const struct SPS *sps);
int ff_h264_get_profile(const SPS *sps);
#endif /* AVCODEC_H264_PARSE_H */

View File

@ -36,10 +36,12 @@
#include "libavutil/mem.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
#include "get_bits.h"
#include "golomb.h"
#include "h264.h"
#include "h264_sei.h"
#include "h264_ps.h"
#include "h264data.h"
#include "internal.h"
#include "mpegutils.h"
@ -104,14 +106,14 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
state >>= 1; // 2->1, 1->0, 0->0
} else if (state <= 5) {
int nalu_type = buf[i] & 0x1F;
if (nalu_type == NAL_SEI || nalu_type == NAL_SPS ||
nalu_type == NAL_PPS || nalu_type == NAL_AUD) {
if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS ||
nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) {
if (pc->frame_start_found) {
i++;
goto found;
}
} else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA ||
nalu_type == NAL_IDR_SLICE) {
} else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA ||
nalu_type == H264_NAL_IDR_SLICE) {
state += 8;
continue;
}
@ -301,10 +303,10 @@ static inline int parse_nal_units(AVCodecParserContext *s,
state = buf[buf_index];
switch (state & 0x1f) {
case NAL_SLICE:
case NAL_IDR_SLICE:
case H264_NAL_SLICE:
case H264_NAL_IDR_SLICE:
// Do not walk the whole buffer just to decode slice header
if ((state & 0x1f) == NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) {
if ((state & 0x1f) == H264_NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) {
/* IDR or disposable slice
* No need to decode many bytes because MMCOs shall not be present. */
if (src_length > 60)
@ -330,17 +332,17 @@ static inline int parse_nal_units(AVCodecParserContext *s,
nal.type = get_bits(&nal.gb, 5);
switch (nal.type) {
case NAL_SPS:
case H264_NAL_SPS:
ff_h264_decode_seq_parameter_set(&nal.gb, avctx, &p->ps, 0);
break;
case NAL_PPS:
case H264_NAL_PPS:
ff_h264_decode_picture_parameter_set(&nal.gb, avctx, &p->ps,
nal.size_bits);
break;
case NAL_SEI:
case H264_NAL_SEI:
ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, avctx);
break;
case NAL_IDR_SLICE:
case H264_NAL_IDR_SLICE:
s->key_frame = 1;
p->poc.prev_frame_num = 0;
@ -348,7 +350,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
p->poc.prev_poc_msb =
p->poc.prev_poc_lsb = 0;
/* fall through */
case NAL_SLICE:
case H264_NAL_SLICE:
get_ue_golomb_long(&nal.gb); // skip first_mb_in_slice
slice_type = get_ue_golomb_31(&nal.gb);
s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5];
@ -367,13 +369,26 @@ static inline int parse_nal_units(AVCodecParserContext *s,
"non-existing PPS %u referenced\n", pps_id);
goto fail;
}
p->ps.pps = (const PPS*)p->ps.pps_list[pps_id]->data;
av_buffer_unref(&p->ps.pps_ref);
av_buffer_unref(&p->ps.sps_ref);
p->ps.pps = NULL;
p->ps.sps = NULL;
p->ps.pps_ref = av_buffer_ref(p->ps.pps_list[pps_id]);
if (!p->ps.pps_ref)
goto fail;
p->ps.pps = (const PPS*)p->ps.pps_ref->data;
if (!p->ps.sps_list[p->ps.pps->sps_id]) {
av_log(avctx, AV_LOG_ERROR,
"non-existing SPS %u referenced\n", p->ps.pps->sps_id);
goto fail;
}
p->ps.sps = (SPS*)p->ps.sps_list[p->ps.pps->sps_id]->data;
p->ps.sps_ref = av_buffer_ref(p->ps.sps_list[p->ps.pps->sps_id]);
if (!p->ps.sps_ref)
goto fail;
p->ps.sps = (const SPS*)p->ps.sps_ref->data;
sps = p->ps.sps;
@ -425,7 +440,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
}
}
if (nal.type == NAL_IDR_SLICE)
if (nal.type == H264_NAL_IDR_SLICE)
get_ue_golomb_long(&nal.gb); /* idr_pic_id */
if (sps->poc_type == 0) {
p->poc.poc_lsb = get_bits(&nal.gb, sps->log2_max_poc_lsb);
@ -454,7 +469,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
* FIXME: MMCO_RESET could appear in non-first slice.
* Maybe, we should parse all undisposable non-IDR slice of this
* picture until encountering MMCO_RESET in a slice of it. */
if (nal.ref_idc && nal.type != NAL_IDR_SLICE) {
if (nal.ref_idc && nal.type != H264_NAL_IDR_SLICE) {
got_reset = scan_mmco_reset(s, &nal.gb, avctx);
if (got_reset < 0)
goto fail;
@ -622,17 +637,17 @@ static int h264_split(AVCodecContext *avctx,
if ((state & 0xFFFFFF00) != 0x100)
break;
nalu_type = state & 0x1F;
if (nalu_type == NAL_SPS) {
if (nalu_type == H264_NAL_SPS) {
has_sps = 1;
} else if (nalu_type == NAL_PPS)
} else if (nalu_type == H264_NAL_PPS)
has_pps = 1;
/* else if (nalu_type == 0x01 ||
* nalu_type == 0x02 ||
* nalu_type == 0x05) {
* }
*/
else if ((nalu_type != NAL_SEI || has_pps) &&
nalu_type != NAL_AUD && nalu_type != NAL_SPS_EXT &&
else if ((nalu_type != H264_NAL_SEI || has_pps) &&
nalu_type != H264_NAL_AUD && nalu_type != H264_NAL_SPS_EXT &&
nalu_type != 0x0f) {
if (has_sps) {
while (ptr - 4 > buf && ptr[-5] == 0)

View File

@ -33,11 +33,10 @@
#include "cabac_functions.h"
#include "error_resilience.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264data.h"
#include "h264chroma.h"
#include "h264_mvpred.h"
#include "golomb.h"
#include "mathops.h"
#include "mpegutils.h"
#include "rectangle.h"
@ -165,7 +164,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
if (!h->droppable) {
err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
err = ff_h264_execute_ref_pic_marking(h);
h->poc.prev_poc_msb = h->poc.poc_msb;
h->poc.prev_poc_lsb = h->poc.poc_lsb;
}

View File

@ -31,13 +31,15 @@
#include "internal.h"
#include "mathops.h"
#include "avcodec.h"
#include "h264.h"
#include "h264data.h"
#include "h264_ps.h"
#include "golomb.h"
#define MAX_LOG2_MAX_FRAME_NUM (12 + 4)
#define MIN_LOG2_MAX_FRAME_NUM 4
#define EXTENDED_SAR 255
static const uint8_t default_scaling4[2][16] = {
{ 6, 13, 20, 28, 13, 20, 28, 32,
20, 28, 32, 37, 28, 32, 37, 42 },
@ -265,8 +267,9 @@ static void decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size,
}
}
static void decode_scaling_matrices(GetBitContext *gb, SPS *sps,
PPS *pps, int is_sps,
/* returns non zero if the provided SPS scaling matrix has been filled */
static int decode_scaling_matrices(GetBitContext *gb, const SPS *sps,
const PPS *pps, int is_sps,
uint8_t(*scaling_matrix4)[16],
uint8_t(*scaling_matrix8)[64])
{
@ -277,8 +280,9 @@ static void decode_scaling_matrices(GetBitContext *gb, SPS *sps,
fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
fallback_sps ? sps->scaling_matrix8[3] : default_scaling8[1]
};
int ret = 0;
if (get_bits1(gb)) {
sps->scaling_matrix_present |= is_sps;
ret = is_sps;
decode_scaling_list(gb, scaling_matrix4[0], 16, default_scaling4[0], fallback[0]); // Intra, Y
decode_scaling_list(gb, scaling_matrix4[1], 16, default_scaling4[0], scaling_matrix4[0]); // Intra, Cr
decode_scaling_list(gb, scaling_matrix4[2], 16, default_scaling4[0], scaling_matrix4[1]); // Intra, Cb
@ -296,6 +300,8 @@ static void decode_scaling_matrices(GetBitContext *gb, SPS *sps,
}
}
}
return ret;
}
void ff_h264_ps_uninit(H264ParamSets *ps)
@ -401,7 +407,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
goto fail;
}
sps->transform_bypass = get_bits1(gb);
decode_scaling_matrices(gb, sps, NULL, 1,
sps->scaling_matrix_present |= decode_scaling_matrices(gb, sps, NULL, 1,
sps->scaling_matrix4, sps->scaling_matrix8);
} else {
sps->chroma_format_idc = 1;
@ -451,8 +457,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
sps->ref_frame_count = get_ue_golomb_31(gb);
if (avctx->codec_tag == MKTAG('S', 'M', 'V', '2'))
sps->ref_frame_count = FFMAX(2, sps->ref_frame_count);
if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 ||
sps->ref_frame_count > 16U) {
if (sps->ref_frame_count > MAX_DELAYED_PIC_COUNT) {
av_log(avctx, AV_LOG_ERROR,
"too many reference frames %d\n", sps->ref_frame_count);
goto fail;
@ -460,13 +465,6 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
sps->gaps_in_frame_num_allowed_flag = get_bits1(gb);
sps->mb_width = get_ue_golomb(gb) + 1;
sps->mb_height = get_ue_golomb(gb) + 1;
if ((unsigned)sps->mb_width >= INT_MAX / 16 ||
(unsigned)sps->mb_height >= INT_MAX / 16 ||
av_image_check_size(16 * sps->mb_width,
16 * sps->mb_height, 0, avctx)) {
av_log(avctx, AV_LOG_ERROR, "mb_width/height overflow\n");
goto fail;
}
sps->frame_mbs_only_flag = get_bits1(gb);
if (!sps->frame_mbs_only_flag)
@ -474,6 +472,14 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
else
sps->mb_aff = 0;
if ((unsigned)sps->mb_width >= INT_MAX / 16 ||
(unsigned)sps->mb_height >= INT_MAX / (16 * (2 - sps->frame_mbs_only_flag)) ||
av_image_check_size(16 * sps->mb_width,
16 * sps->mb_height * (2 - sps->frame_mbs_only_flag), 0, avctx)) {
av_log(avctx, AV_LOG_ERROR, "mb_width/height overflow\n");
goto fail;
}
sps->direct_8x8_inference_flag = get_bits1(gb);
#ifndef ALLOW_INTERLACE
@ -555,7 +561,8 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
/* if the maximum delay is not stored in the SPS, derive it based on the
* level */
if (!sps->bitstream_restriction_flag) {
if (!sps->bitstream_restriction_flag &&
(sps->ref_frame_count || avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT)) {
sps->num_reorder_frames = MAX_DELAYED_PIC_COUNT - 1;
for (i = 0; i < FF_ARRAY_ELEMS(level_max_dpb_mbs); i++) {
if (level_max_dpb_mbs[i][0] == sps->level_idc) {
@ -707,7 +714,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
H264ParamSets *ps, int bit_length)
{
AVBufferRef *pps_buf;
SPS *sps;
const SPS *sps;
unsigned int pps_id = get_ue_golomb(gb);
PPS *pps;
int qp_bd_offset;
@ -726,7 +733,9 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
pps->data_size = gb->buffer_end - gb->buffer;
if (pps->data_size > sizeof(pps->data)) {
av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized PPS\n");
av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized PPS "
"(%"SIZE_SPECIFIER" > %"SIZE_SPECIFIER")\n",
pps->data_size, sizeof(pps->data));
pps->data_size = sizeof(pps->data);
}
memcpy(pps->data, gb->buffer, pps->data_size);
@ -738,7 +747,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
ret = AVERROR_INVALIDDATA;
goto fail;
}
sps = (SPS*)ps->sps_list[pps->sps_id]->data;
sps = (const SPS*)ps->sps_list[pps->sps_id]->data;
if (sps->bit_depth_luma > 14) {
av_log(avctx, AV_LOG_ERROR,
"Invalid luma bit depth=%d\n",

164
libavcodec/h264_ps.h Normal file
View File

@ -0,0 +1,164 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* H.264 parameter set handling
*/
#ifndef AVCODEC_H264_PS_H
#define AVCODEC_H264_PS_H
#include <stdint.h>
#include "libavutil/buffer.h"
#include "libavutil/pixfmt.h"
#include "libavutil/rational.h"
#include "avcodec.h"
#include "get_bits.h"
#include "h264.h"
#define MAX_SPS_COUNT 32
#define MAX_PPS_COUNT 256
/**
* Sequence parameter set
*/
typedef struct SPS {
unsigned int sps_id;
int profile_idc;
int level_idc;
int chroma_format_idc;
int transform_bypass; ///< qpprime_y_zero_transform_bypass_flag
int log2_max_frame_num; ///< log2_max_frame_num_minus4 + 4
int poc_type; ///< pic_order_cnt_type
int log2_max_poc_lsb; ///< log2_max_pic_order_cnt_lsb_minus4
int delta_pic_order_always_zero_flag;
int offset_for_non_ref_pic;
int offset_for_top_to_bottom_field;
int poc_cycle_length; ///< num_ref_frames_in_pic_order_cnt_cycle
int ref_frame_count; ///< num_ref_frames
int gaps_in_frame_num_allowed_flag;
int mb_width; ///< pic_width_in_mbs_minus1 + 1
int mb_height; ///< pic_height_in_map_units_minus1 + 1
int frame_mbs_only_flag;
int mb_aff; ///< mb_adaptive_frame_field_flag
int direct_8x8_inference_flag;
int crop; ///< frame_cropping_flag
/* those 4 are already in luma samples */
unsigned int crop_left; ///< frame_cropping_rect_left_offset
unsigned int crop_right; ///< frame_cropping_rect_right_offset
unsigned int crop_top; ///< frame_cropping_rect_top_offset
unsigned int crop_bottom; ///< frame_cropping_rect_bottom_offset
int vui_parameters_present_flag;
AVRational sar;
int video_signal_type_present_flag;
int full_range;
int colour_description_present_flag;
enum AVColorPrimaries color_primaries;
enum AVColorTransferCharacteristic color_trc;
enum AVColorSpace colorspace;
int timing_info_present_flag;
uint32_t num_units_in_tick;
uint32_t time_scale;
int fixed_frame_rate_flag;
short offset_for_ref_frame[256]; // FIXME dyn aloc?
int bitstream_restriction_flag;
int num_reorder_frames;
int scaling_matrix_present;
uint8_t scaling_matrix4[6][16];
uint8_t scaling_matrix8[6][64];
int nal_hrd_parameters_present_flag;
int vcl_hrd_parameters_present_flag;
int pic_struct_present_flag;
int time_offset_length;
int cpb_cnt; ///< See H.264 E.1.2
int initial_cpb_removal_delay_length; ///< initial_cpb_removal_delay_length_minus1 + 1
int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1
int dpb_output_delay_length; ///< dpb_output_delay_length_minus1 + 1
int bit_depth_luma; ///< bit_depth_luma_minus8 + 8
int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8
int residual_color_transform_flag; ///< residual_colour_transform_flag
int constraint_set_flags; ///< constraint_set[0-3]_flag
uint8_t data[4096];
size_t data_size;
} SPS;
/**
* Picture parameter set
*/
typedef struct PPS {
unsigned int sps_id;
int cabac; ///< entropy_coding_mode_flag
int pic_order_present; ///< pic_order_present_flag
int slice_group_count; ///< num_slice_groups_minus1 + 1
int mb_slice_group_map_type;
unsigned int ref_count[2]; ///< num_ref_idx_l0/1_active_minus1 + 1
int weighted_pred; ///< weighted_pred_flag
int weighted_bipred_idc;
int init_qp; ///< pic_init_qp_minus26 + 26
int init_qs; ///< pic_init_qs_minus26 + 26
int chroma_qp_index_offset[2];
int deblocking_filter_parameters_present; ///< deblocking_filter_parameters_present_flag
int constrained_intra_pred; ///< constrained_intra_pred_flag
int redundant_pic_cnt_present; ///< redundant_pic_cnt_present_flag
int transform_8x8_mode; ///< transform_8x8_mode_flag
uint8_t scaling_matrix4[6][16];
uint8_t scaling_matrix8[6][64];
uint8_t chroma_qp_table[2][QP_MAX_NUM+1]; ///< pre-scaled (with chroma_qp_index_offset) version of qp_table
int chroma_qp_diff;
uint8_t data[4096];
size_t data_size;
uint32_t dequant4_buffer[6][QP_MAX_NUM + 1][16];
uint32_t dequant8_buffer[6][QP_MAX_NUM + 1][64];
uint32_t(*dequant4_coeff[6])[16];
uint32_t(*dequant8_coeff[6])[64];
} PPS;
typedef struct H264ParamSets {
AVBufferRef *sps_list[MAX_SPS_COUNT];
AVBufferRef *pps_list[MAX_PPS_COUNT];
AVBufferRef *pps_ref;
AVBufferRef *sps_ref;
/* currently active parameters sets */
const PPS *pps;
const SPS *sps;
} H264ParamSets;
/**
* Decode SPS
*/
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
H264ParamSets *ps, int ignore_truncation);
/**
* Decode PPS
*/
int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
H264ParamSets *ps, int bit_length);
/**
* Uninit H264 param sets structure.
*/
void ff_h264_ps_uninit(H264ParamSets *ps);
#endif /* AVCODEC_H264_PS_H */

View File

@ -31,6 +31,7 @@
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "golomb.h"
#include "mpegutils.h"
@ -270,7 +271,32 @@ static int pic_num_extract(const H264Context *h, int pic_num, int *structure)
return pic_num;
}
int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl)
static void h264_fill_mbaff_ref_list(H264SliceContext *sl)
{
int list, i, j;
for (list = 0; list < sl->list_count; list++) {
for (i = 0; i < sl->ref_count[list]; i++) {
H264Ref *frame = &sl->ref_list[list][i];
H264Ref *field = &sl->ref_list[list][16 + 2 * i];
field[0] = *frame;
for (j = 0; j < 3; j++)
field[0].linesize[j] <<= 1;
field[0].reference = PICT_TOP_FIELD;
field[0].poc = field[0].parent->field_poc[0];
field[1] = field[0];
for (j = 0; j < 3; j++)
field[1].data[j] += frame->parent->f->linesize[j];
field[1].reference = PICT_BOTTOM_FIELD;
field[1].poc = field[1].parent->field_poc[1];
}
}
}
int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
{
int list, index, pic_structure;
@ -280,102 +306,90 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl)
h264_initialise_ref_list(h, sl);
for (list = 0; list < sl->list_count; list++) {
if (get_bits1(&sl->gb)) { // ref_pic_list_modification_flag_l[01]
int pred = h->curr_pic_num;
int pred = sl->curr_pic_num;
for (index = 0; ; index++) {
unsigned int modification_of_pic_nums_idc = get_ue_golomb_31(&sl->gb);
unsigned int pic_id;
int i;
H264Picture *ref = NULL;
for (index = 0; index < sl->nb_ref_modifications[list]; index++) {
unsigned int modification_of_pic_nums_idc = sl->ref_modifications[list][index].op;
unsigned int val = sl->ref_modifications[list][index].val;
unsigned int pic_id;
int i;
H264Picture *ref = NULL;
if (modification_of_pic_nums_idc == 3)
break;
switch (modification_of_pic_nums_idc) {
case 0:
case 1: {
const unsigned int abs_diff_pic_num = val + 1;
int frame_num;
if (index >= sl->ref_count[list]) {
av_log(h->avctx, AV_LOG_ERROR, "reference count overflow\n");
return -1;
}
switch (modification_of_pic_nums_idc) {
case 0:
case 1: {
const unsigned int abs_diff_pic_num = get_ue_golomb_long(&sl->gb) + 1;
int frame_num;
if (abs_diff_pic_num > h->max_pic_num) {
av_log(h->avctx, AV_LOG_ERROR,
"abs_diff_pic_num overflow\n");
return AVERROR_INVALIDDATA;
}
if (modification_of_pic_nums_idc == 0)
pred -= abs_diff_pic_num;
else
pred += abs_diff_pic_num;
pred &= h->max_pic_num - 1;
frame_num = pic_num_extract(h, pred, &pic_structure);
for (i = h->short_ref_count - 1; i >= 0; i--) {
ref = h->short_ref[i];
assert(ref->reference);
assert(!ref->long_ref);
if (ref->frame_num == frame_num &&
(ref->reference & pic_structure))
break;
}
if (i >= 0)
ref->pic_id = pred;
break;
}
case 2: {
int long_idx;
pic_id = get_ue_golomb(&sl->gb); // long_term_pic_idx
long_idx = pic_num_extract(h, pic_id, &pic_structure);
if (long_idx > 31U) {
av_log(h->avctx, AV_LOG_ERROR,
"long_term_pic_idx overflow\n");
return AVERROR_INVALIDDATA;
}
ref = h->long_ref[long_idx];
assert(!(ref && !ref->reference));
if (ref && (ref->reference & pic_structure) && !mismatches_ref(h, ref)) {
ref->pic_id = pic_id;
assert(ref->long_ref);
i = 0;
} else {
i = -1;
}
break;
}
default:
if (abs_diff_pic_num > sl->max_pic_num) {
av_log(h->avctx, AV_LOG_ERROR,
"illegal modification_of_pic_nums_idc %u\n",
modification_of_pic_nums_idc);
"abs_diff_pic_num overflow\n");
return AVERROR_INVALIDDATA;
}
if (i < 0) {
if (modification_of_pic_nums_idc == 0)
pred -= abs_diff_pic_num;
else
pred += abs_diff_pic_num;
pred &= sl->max_pic_num - 1;
frame_num = pic_num_extract(h, pred, &pic_structure);
for (i = h->short_ref_count - 1; i >= 0; i--) {
ref = h->short_ref[i];
assert(ref->reference);
assert(!ref->long_ref);
if (ref->frame_num == frame_num &&
(ref->reference & pic_structure))
break;
}
if (i >= 0)
ref->pic_id = pred;
break;
}
case 2: {
int long_idx;
pic_id = val; // long_term_pic_idx
long_idx = pic_num_extract(h, pic_id, &pic_structure);
if (long_idx > 31U) {
av_log(h->avctx, AV_LOG_ERROR,
"reference picture missing during reorder\n");
memset(&sl->ref_list[list][index], 0, sizeof(sl->ref_list[0][0])); // FIXME
"long_term_pic_idx overflow\n");
return AVERROR_INVALIDDATA;
}
ref = h->long_ref[long_idx];
assert(!(ref && !ref->reference));
if (ref && (ref->reference & pic_structure)) {
ref->pic_id = pic_id;
assert(ref->long_ref);
i = 0;
} else {
for (i = index; i + 1 < sl->ref_count[list]; i++) {
if (sl->ref_list[list][i].parent &&
ref->long_ref == sl->ref_list[list][i].parent->long_ref &&
ref->pic_id == sl->ref_list[list][i].pic_id)
break;
}
for (; i > index; i--) {
sl->ref_list[list][i] = sl->ref_list[list][i - 1];
}
ref_from_h264pic(&sl->ref_list[list][index], ref);
if (FIELD_PICTURE(h)) {
pic_as_field(&sl->ref_list[list][index], pic_structure);
}
i = -1;
}
break;
}
default:
av_assert1(0);
}
if (i < 0) {
av_log(h->avctx, AV_LOG_ERROR,
"reference picture missing during reorder\n");
memset(&sl->ref_list[list][index], 0, sizeof(sl->ref_list[0][0])); // FIXME
} else {
for (i = index; i + 1 < sl->ref_count[list]; i++) {
if (sl->ref_list[list][i].parent &&
ref->long_ref == sl->ref_list[list][i].parent->long_ref &&
ref->pic_id == sl->ref_list[list][i].pic_id)
break;
}
for (; i > index; i--) {
sl->ref_list[list][i] = sl->ref_list[list][i - 1];
}
ref_from_h264pic(&sl->ref_list[list][index], ref);
if (FIELD_PICTURE(h)) {
pic_as_field(&sl->ref_list[list][index], pic_structure);
}
}
}
@ -398,39 +412,45 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl)
}
}
if (FRAME_MBAFF(h))
h264_fill_mbaff_ref_list(sl);
return 0;
}
void ff_h264_fill_mbaff_ref_list(H264SliceContext *sl)
int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx)
{
int list, i, j;
int list, index;
sl->nb_ref_modifications[0] = 0;
sl->nb_ref_modifications[1] = 0;
for (list = 0; list < sl->list_count; list++) {
for (i = 0; i < sl->ref_count[list]; i++) {
H264Ref *frame = &sl->ref_list[list][i];
H264Ref *field = &sl->ref_list[list][16 + 2 * i];
if (!get_bits1(&sl->gb)) // ref_pic_list_modification_flag_l[01]
continue;
field[0] = *frame;
for (index = 0; ; index++) {
unsigned int op = get_ue_golomb_31(&sl->gb);
for (j = 0; j < 3; j++)
field[0].linesize[j] <<= 1;
field[0].reference = PICT_TOP_FIELD;
field[0].poc = field[0].parent->field_poc[0];
if (op == 3)
break;
field[1] = field[0];
for (j = 0; j < 3; j++)
field[1].data[j] += frame->parent->f->linesize[j];
field[1].reference = PICT_BOTTOM_FIELD;
field[1].poc = field[1].parent->field_poc[1];
sl->pwt.luma_weight[16 + 2 * i][list][0] = sl->pwt.luma_weight[16 + 2 * i + 1][list][0] = sl->pwt.luma_weight[i][list][0];
sl->pwt.luma_weight[16 + 2 * i][list][1] = sl->pwt.luma_weight[16 + 2 * i + 1][list][1] = sl->pwt.luma_weight[i][list][1];
for (j = 0; j < 2; j++) {
sl->pwt.chroma_weight[16 + 2 * i][list][j][0] = sl->pwt.chroma_weight[16 + 2 * i + 1][list][j][0] = sl->pwt.chroma_weight[i][list][j][0];
sl->pwt.chroma_weight[16 + 2 * i][list][j][1] = sl->pwt.chroma_weight[16 + 2 * i + 1][list][j][1] = sl->pwt.chroma_weight[i][list][j][1];
if (index >= sl->ref_count[list]) {
av_log(logctx, AV_LOG_ERROR, "reference count overflow\n");
return AVERROR_INVALIDDATA;
} else if (op > 2) {
av_log(logctx, AV_LOG_ERROR,
"illegal modification_of_pic_nums_idc %u\n",
op);
return AVERROR_INVALIDDATA;
}
sl->ref_modifications[list][index].val = get_ue_golomb_long(&sl->gb);
sl->ref_modifications[list][index].op = op;
sl->nb_ref_modifications[list]++;
}
}
return 0;
}
/**
@ -562,67 +582,43 @@ void ff_h264_remove_all_refs(H264Context *h)
h->short_ref_count = 0;
memset(h->default_ref, 0, sizeof(h->default_ref));
for (i = 0; i < h->nb_slice_ctx; i++) {
H264SliceContext *sl = &h->slice_ctx[i];
sl->list_count = sl->ref_count[0] = sl->ref_count[1] = 0;
memset(sl->ref_list, 0, sizeof(sl->ref_list));
}
}
static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos)
static void generate_sliding_window_mmcos(H264Context *h)
{
int i;
for (i = 0; i < n_mmcos; i++) {
if (mmco1[i].opcode != mmco2[i].opcode) {
av_log(NULL, AV_LOG_ERROR, "MMCO opcode [%d, %d] at %d mismatches between slices\n",
mmco1[i].opcode, mmco2[i].opcode, i);
return -1;
}
}
return 0;
}
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
{
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
int mmco_index = 0, i = 0;
MMCO *mmco = h->mmco;
int nb_mmco = 0;
if (h->short_ref_count &&
h->long_ref_count + h->short_ref_count >= h->ps.sps->ref_frame_count &&
!(FIELD_PICTURE(h) && !h->first_field && h->cur_pic_ptr->reference)) {
mmco[0].opcode = MMCO_SHORT2UNUSED;
mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num;
mmco_index = 1;
nb_mmco = 1;
if (FIELD_PICTURE(h)) {
mmco[0].short_pic_num *= 2;
mmco[1].opcode = MMCO_SHORT2UNUSED;
mmco[1].short_pic_num = mmco[0].short_pic_num + 1;
mmco_index = 2;
nb_mmco = 2;
}
}
if (first_slice) {
h->mmco_index = mmco_index;
} else if (!first_slice && mmco_index >= 0 &&
(mmco_index != h->mmco_index ||
(i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
av_log(h->avctx, AV_LOG_ERROR,
"Inconsistent MMCO state between slices [%d, %d]\n",
mmco_index, h->mmco_index);
return AVERROR_INVALIDDATA;
}
return 0;
h->nb_mmco = nb_mmco;
}
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
int ff_h264_execute_ref_pic_marking(H264Context *h)
{
MMCO *mmco = h->mmco;
int mmco_count;
int i, av_uninit(j);
int pps_ref_count[2] = {0};
int current_ref_assigned = 0, err = 0;
H264Picture *av_uninit(pic);
if (!h->explicit_ref_marking)
generate_sliding_window_mmcos(h);
mmco_count = h->nb_mmco;
if ((h->avctx->debug & FF_DEBUG_MMCO) && mmco_count == 0)
av_log(h->avctx, AV_LOG_DEBUG, "no mmco here\n");
@ -825,30 +821,32 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
return (h->avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
}
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
int first_slice)
int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb,
const H2645NAL *nal, void *logctx)
{
int i, ret;
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = mmco_temp;
int mmco_index = 0;
int i;
MMCO *mmco = sl->mmco;
int nb_mmco = 0;
if (h->nal_unit_type == NAL_IDR_SLICE) { // FIXME fields
if (nal->type == H264_NAL_IDR_SLICE) { // FIXME fields
skip_bits1(gb); // broken_link
if (get_bits1(gb)) {
mmco[0].opcode = MMCO_LONG;
mmco[0].long_arg = 0;
mmco_index = 1;
nb_mmco = 1;
}
sl->explicit_ref_marking = 1;
} else {
if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
sl->explicit_ref_marking = get_bits1(gb);
if (sl->explicit_ref_marking) {
for (i = 0; i < MAX_MMCO_COUNT; i++) {
MMCOOpcode opcode = get_ue_golomb_31(gb);
mmco[i].opcode = opcode;
if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG) {
mmco[i].short_pic_num =
(h->curr_pic_num - get_ue_golomb_long(gb) - 1) &
(h->max_pic_num - 1);
(sl->curr_pic_num - get_ue_golomb_long(gb) - 1) &
(sl->max_pic_num - 1);
#if 0
if (mmco[i].short_pic_num >= h->short_ref_count ||
!h->short_ref[mmco[i].short_pic_num]) {
@ -865,8 +863,8 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
if (long_arg >= 32 ||
(long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG &&
long_arg == 16) &&
!(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE(h)))) {
av_log(h->avctx, AV_LOG_ERROR,
!(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE(sl)))) {
av_log(logctx, AV_LOG_ERROR,
"illegal long ref in memory management control "
"operation %d\n", opcode);
return -1;
@ -875,7 +873,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
}
if (opcode > (unsigned) MMCO_LONG) {
av_log(h->avctx, AV_LOG_ERROR,
av_log(logctx, AV_LOG_ERROR,
"illegal memory management control operation %d\n",
opcode);
return -1;
@ -883,28 +881,11 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
if (opcode == MMCO_END)
break;
}
mmco_index = i;
} else {
if (first_slice) {
ret = ff_generate_sliding_window_mmcos(h, first_slice);
if (ret < 0 && h->avctx->err_recognition & AV_EF_EXPLODE)
return ret;
}
mmco_index = -1;
nb_mmco = i;
}
}
if (first_slice && mmco_index != -1) {
memcpy(h->mmco, mmco_temp, sizeof(h->mmco));
h->mmco_index = mmco_index;
} else if (!first_slice && mmco_index >= 0 &&
(mmco_index != h->mmco_index ||
check_opcodes(h->mmco, mmco_temp, mmco_index))) {
av_log(h->avctx, AV_LOG_ERROR,
"Inconsistent MMCO state between slices [%d, %d]\n",
mmco_index, h->mmco_index);
return AVERROR_INVALIDDATA;
}
sl->nb_mmco = nb_mmco;
return 0;
}

View File

@ -28,7 +28,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "golomb.h"
#include "h264.h"
#include "h264_ps.h"
#include "h264_sei.h"
#include "internal.h"
@ -278,7 +278,7 @@ static int decode_buffering_period(H264SEIBufferingPeriod *h, GetBitContext *gb,
{
unsigned int sps_id;
int sched_sel_idx;
SPS *sps;
const SPS *sps;
sps_id = get_ue_golomb_31(gb);
if (sps_id > 31 || !ps->sps_list[sps_id]) {
@ -286,7 +286,7 @@ static int decode_buffering_period(H264SEIBufferingPeriod *h, GetBitContext *gb,
"non-existing SPS %d referenced in buffering period\n", sps_id);
return sps_id > 31 ? AVERROR_INVALIDDATA : AVERROR_PS_NOT_FOUND;
}
sps = (SPS*)ps->sps_list[sps_id]->data;
sps = (const SPS*)ps->sps_list[sps_id]->data;
// NOTE: This is really so duplicated in the standard... See H.264, D.1.1
if (sps->nal_hrd_parameters_present_flag) {

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
#include "libavutil/avutil.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264data.h"
const uint8_t ff_h264_golomb_to_pict_type[5] = {

View File

@ -21,7 +21,7 @@
#include <stdint.h>
#include "h264.h"
#include "h264dec.h"
extern const uint8_t ff_h264_golomb_to_pict_type[5];
extern const uint8_t ff_h264_golomb_to_intra4x4_cbp[48];

View File

@ -40,10 +40,12 @@
#include "error_resilience.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h2645_parse.h"
#include "h264data.h"
#include "h264chroma.h"
#include "h264_mvpred.h"
#include "h264_ps.h"
#include "golomb.h"
#include "mathops.h"
#include "me_cmp.h"
@ -308,7 +310,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
h->backup_width = -1;
h->backup_height = -1;
h->backup_pix_fmt = AV_PIX_FMT_NONE;
h->current_sps_id = -1;
h->cur_chroma_format_idc = -1;
h->picture_structure = PICT_FRAME;
@ -405,15 +406,13 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
return AVERROR_UNKNOWN;
}
if (avctx->codec_id == AV_CODEC_ID_H264) {
if (avctx->ticks_per_frame == 1) {
if(h->avctx->time_base.den < INT_MAX/2) {
h->avctx->time_base.den *= 2;
} else
h->avctx->time_base.num /= 2;
}
avctx->ticks_per_frame = 2;
if (avctx->ticks_per_frame == 1) {
if(h->avctx->time_base.den < INT_MAX/2) {
h->avctx->time_base.den *= 2;
} else
h->avctx->time_base.num /= 2;
}
avctx->ticks_per_frame = 2;
if (avctx->extradata_size > 0 && avctx->extradata) {
ret = ff_h264_decode_extradata(avctx->extradata, avctx->extradata_size,
@ -498,153 +497,6 @@ static void decode_postinit(H264Context *h, int setup_finished)
return;
}
cur->f->interlaced_frame = 0;
cur->f->repeat_pict = 0;
/* Signal interlacing information externally. */
/* Prioritize picture timing SEI information over used
* decoding process if it exists. */
if (sps->pic_struct_present_flag) {
H264SEIPictureTiming *pt = &h->sei.picture_timing;
switch (pt->pic_struct) {
case SEI_PIC_STRUCT_FRAME:
break;
case SEI_PIC_STRUCT_TOP_FIELD:
case SEI_PIC_STRUCT_BOTTOM_FIELD:
cur->f->interlaced_frame = 1;
break;
case SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_BOTTOM_TOP:
if (FIELD_OR_MBAFF_PICTURE(h))
cur->f->interlaced_frame = 1;
else
// try to flag soft telecine progressive
cur->f->interlaced_frame = h->prev_interlaced_frame;
break;
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
/* Signal the possibility of telecined film externally
* (pic_struct 5,6). From these hints, let the applications
* decide if they apply deinterlacing. */
cur->f->repeat_pict = 1;
break;
case SEI_PIC_STRUCT_FRAME_DOUBLING:
cur->f->repeat_pict = 2;
break;
case SEI_PIC_STRUCT_FRAME_TRIPLING:
cur->f->repeat_pict = 4;
break;
}
if ((pt->ct_type & 3) &&
pt->pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
cur->f->interlaced_frame = (pt->ct_type & (1 << 1)) != 0;
} else {
/* Derive interlacing flag from used decoding process. */
cur->f->interlaced_frame = FIELD_OR_MBAFF_PICTURE(h);
}
h->prev_interlaced_frame = cur->f->interlaced_frame;
if (cur->field_poc[0] != cur->field_poc[1]) {
/* Derive top_field_first from field pocs. */
cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1];
} else {
if (sps->pic_struct_present_flag) {
/* Use picture timing SEI information. Even if it is a
* information of a past frame, better than nothing. */
if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM ||
h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
cur->f->top_field_first = 1;
else
cur->f->top_field_first = 0;
} else if (cur->f->interlaced_frame) {
/* Default to top field first when pic_struct_present_flag
* is not set but interlaced frame detected */
cur->f->top_field_first = 1;
} else {
/* Most likely progressive */
cur->f->top_field_first = 0;
}
}
if (h->sei.frame_packing.present &&
h->sei.frame_packing.frame_packing_arrangement_type <= 6 &&
h->sei.frame_packing.content_interpretation_type > 0 &&
h->sei.frame_packing.content_interpretation_type < 3) {
H264SEIFramePacking *fp = &h->sei.frame_packing;
AVStereo3D *stereo = av_stereo3d_create_side_data(cur->f);
if (stereo) {
switch (fp->frame_packing_arrangement_type) {
case 0:
stereo->type = AV_STEREO3D_CHECKERBOARD;
break;
case 1:
stereo->type = AV_STEREO3D_COLUMNS;
break;
case 2:
stereo->type = AV_STEREO3D_LINES;
break;
case 3:
if (fp->quincunx_sampling_flag)
stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
else
stereo->type = AV_STEREO3D_SIDEBYSIDE;
break;
case 4:
stereo->type = AV_STEREO3D_TOPBOTTOM;
break;
case 5:
stereo->type = AV_STEREO3D_FRAMESEQUENCE;
break;
case 6:
stereo->type = AV_STEREO3D_2D;
break;
}
if (fp->content_interpretation_type == 2)
stereo->flags = AV_STEREO3D_FLAG_INVERT;
}
}
if (h->sei.display_orientation.present &&
(h->sei.display_orientation.anticlockwise_rotation ||
h->sei.display_orientation.hflip ||
h->sei.display_orientation.vflip)) {
H264SEIDisplayOrientation *o = &h->sei.display_orientation;
double angle = o->anticlockwise_rotation * 360 / (double) (1 << 16);
AVFrameSideData *rotation = av_frame_new_side_data(cur->f,
AV_FRAME_DATA_DISPLAYMATRIX,
sizeof(int32_t) * 9);
if (rotation) {
av_display_rotation_set((int32_t *)rotation->data, angle);
av_display_matrix_flip((int32_t *)rotation->data,
o->hflip, o->vflip);
}
}
if (h->sei.afd.present) {
AVFrameSideData *sd = av_frame_new_side_data(cur->f, AV_FRAME_DATA_AFD,
sizeof(uint8_t));
if (sd) {
*sd->data = h->sei.afd.active_format_description;
h->sei.afd.present = 0;
}
}
if (h->sei.a53_caption.a53_caption) {
H264SEIA53Caption *a53 = &h->sei.a53_caption;
AVFrameSideData *sd = av_frame_new_side_data(cur->f,
AV_FRAME_DATA_A53_CC,
a53->a53_caption_size);
if (sd)
memcpy(sd->data, a53->a53_caption, a53->a53_caption_size);
av_freep(&a53->a53_caption);
a53->a53_caption_size = 0;
h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
}
cur->mmco_reset = h->mmco_reset;
h->mmco_reset = 0;
@ -777,8 +629,6 @@ void ff_h264_flush_change(H264Context *h)
h->frame_recovered = 0;
h->current_slice = 0;
h->mmco_reset = 1;
for (i = 0; i < h->nb_slice_ctx; i++)
h->slice_ctx[i].list_count = 0;
}
/* forget old pics after a seek */
@ -822,13 +672,13 @@ static int get_last_needed_nal(H264Context *h)
* which splits NALs strangely if so, when frame threading we
* can't start the next thread until we've read all of them */
switch (nal->type) {
case NAL_SPS:
case NAL_PPS:
case H264_NAL_SPS:
case H264_NAL_PPS:
nals_needed = i;
break;
case NAL_DPA:
case NAL_IDR_SLICE:
case NAL_SLICE:
case H264_NAL_DPA:
case H264_NAL_IDR_SLICE:
case H264_NAL_SLICE:
ret = init_get_bits8(&gb, nal->data + 1, (nal->size - 1));
if (ret < 0)
return ret;
@ -916,7 +766,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
int err;
if (avctx->skip_frame >= AVDISCARD_NONREF &&
nal->ref_idc == 0 && nal->type != NAL_SEI)
nal->ref_idc == 0 && nal->type != H264_NAL_SEI)
continue;
again:
@ -926,19 +776,13 @@ again:
err = 0;
switch (nal->type) {
case NAL_IDR_SLICE:
case H264_NAL_IDR_SLICE:
if ((nal->data[1] & 0xFC) == 0x98) {
av_log(h->avctx, AV_LOG_ERROR, "Invalid inter IDR frame\n");
h->next_outputed_poc = INT_MIN;
ret = -1;
goto end;
}
if (nal->type != NAL_IDR_SLICE) {
av_log(h->avctx, AV_LOG_ERROR,
"Invalid mix of idr and non-idr slices\n");
ret = -1;
goto end;
}
if(!idr_cleared) {
if (h->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) {
av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n");
@ -949,13 +793,10 @@ again:
}
idr_cleared = 1;
h->has_recovery_point = 1;
case NAL_SLICE:
case H264_NAL_SLICE:
sl->gb = nal->gb;
if ( nals_needed >= i
|| (!(avctx->active_thread_type & FF_THREAD_FRAME) && !context_count))
h->au_pps_id = -1;
if ((err = ff_h264_decode_slice_header(h, sl)))
if ((err = ff_h264_decode_slice_header(h, sl, nal)))
break;
if (h->sei.recovery_point.recovery_frame_cnt >= 0) {
@ -973,16 +814,16 @@ again:
}
}
h->cur_pic_ptr->f->key_frame |= (nal->type == NAL_IDR_SLICE);
h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE);
if (nal->type == NAL_IDR_SLICE ||
if (nal->type == H264_NAL_IDR_SLICE ||
(h->recovery_frame == h->poc.frame_num && nal->ref_idc)) {
h->recovery_frame = -1;
h->cur_pic_ptr->recovered = 1;
}
// If we have an IDR, all frames after it in decoded order are
// "recovered".
if (nal->type == NAL_IDR_SLICE)
if (nal->type == H264_NAL_IDR_SLICE)
h->frame_recovered |= FRAME_RECOVERED_IDR;
#if 1
h->cur_pic_ptr->recovered |= h->frame_recovered;
@ -1025,12 +866,12 @@ again:
context_count++;
}
break;
case NAL_DPA:
case NAL_DPB:
case NAL_DPC:
case H264_NAL_DPA:
case H264_NAL_DPB:
case H264_NAL_DPC:
avpriv_request_sample(avctx, "data partitioning");
break;
case NAL_SEI:
case H264_NAL_SEI:
ret = ff_h264_sei_decode(&h->sei, &nal->gb, &h->ps, avctx);
h->has_recovery_point = h->has_recovery_point || h->sei.recovery_point.recovery_frame_cnt != -1;
if (avctx->debug & FF_DEBUG_GREEN_MD)
@ -1043,7 +884,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
goto end;
break;
case NAL_SPS: {
case H264_NAL_SPS: {
GetBitContext tmp_gb = nal->gb;
if (ff_h264_decode_seq_parameter_set(&tmp_gb, avctx, &h->ps, 0) >= 0)
break;
@ -1055,20 +896,18 @@ FF_ENABLE_DEPRECATION_WARNINGS
ff_h264_decode_seq_parameter_set(&nal->gb, avctx, &h->ps, 1);
break;
}
case NAL_PPS:
case H264_NAL_PPS:
ret = ff_h264_decode_picture_parameter_set(&nal->gb, avctx, &h->ps,
nal->size_bits);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
goto end;
break;
case NAL_AUD:
case NAL_END_SEQUENCE:
case NAL_END_STREAM:
case NAL_FILLER_DATA:
case NAL_SPS_EXT:
case NAL_AUXILIARY_SLICE:
break;
case NAL_FF_IGNORE:
case H264_NAL_AUD:
case H264_NAL_END_SEQUENCE:
case H264_NAL_END_STREAM:
case H264_NAL_FILLER_DATA:
case H264_NAL_SPS_EXT:
case H264_NAL_AUXILIARY_SLICE:
break;
default:
av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n",
@ -1310,7 +1149,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
if (buf_index < 0)
return AVERROR_INVALIDDATA;
if (!h->cur_pic_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
if (!h->cur_pic_ptr && h->nal_unit_type == H264_NAL_END_SEQUENCE) {
av_assert0(buf_index <= buf_size);
goto out;
}

864
libavcodec/h264dec.h Normal file
View File

@ -0,0 +1,864 @@
/*
* H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* H.264 / AVC / MPEG-4 part10 codec.
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#ifndef AVCODEC_H264DEC_H
#define AVCODEC_H264DEC_H
#include "libavutil/buffer.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/thread.h"
#include "cabac.h"
#include "error_resilience.h"
#include "h264_parse.h"
#include "h264_ps.h"
#include "h264_sei.h"
#include "h2645_parse.h"
#include "h264chroma.h"
#include "h264dsp.h"
#include "h264pred.h"
#include "h264qpel.h"
#include "internal.h"
#include "mpegutils.h"
#include "parser.h"
#include "qpeldsp.h"
#include "rectangle.h"
#include "videodsp.h"
#define H264_MAX_PICTURE_COUNT 36
#define MAX_MMCO_COUNT 66
#define MAX_DELAYED_PIC_COUNT 16
#define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
/* Compiling in interlaced support reduces the speed
* of progressive decoding by about 2%. */
#define ALLOW_INTERLACE
#define FMO 0
/**
* The maximum number of slices supported by the decoder.
* must be a power of 2
*/
#define MAX_SLICES 32
#ifdef ALLOW_INTERLACE
#define MB_MBAFF(h) (h)->mb_mbaff
#define MB_FIELD(sl) (sl)->mb_field_decoding_flag
#define FRAME_MBAFF(h) (h)->mb_aff_frame
#define FIELD_PICTURE(h) ((h)->picture_structure != PICT_FRAME)
#define LEFT_MBS 2
#define LTOP 0
#define LBOT 1
#define LEFT(i) (i)
#else
#define MB_MBAFF(h) 0
#define MB_FIELD(sl) 0
#define FRAME_MBAFF(h) 0
#define FIELD_PICTURE(h) 0
#undef IS_INTERLACED
#define IS_INTERLACED(mb_type) 0
#define LEFT_MBS 1
#define LTOP 0
#define LBOT 0
#define LEFT(i) 0
#endif
#define FIELD_OR_MBAFF_PICTURE(h) (FRAME_MBAFF(h) || FIELD_PICTURE(h))
#ifndef CABAC
#define CABAC(h) (h)->ps.pps->cabac
#endif
#define CHROMA(h) ((h)->ps.sps->chroma_format_idc)
#define CHROMA422(h) ((h)->ps.sps->chroma_format_idc == 2)
#define CHROMA444(h) ((h)->ps.sps->chroma_format_idc == 3)
#define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit
#define MB_TYPE_8x8DCT 0x01000000
#define IS_REF0(a) ((a) & MB_TYPE_REF0)
#define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT)
/**
* Memory management control operation opcode.
*/
typedef enum MMCOOpcode {
MMCO_END = 0,
MMCO_SHORT2UNUSED,
MMCO_LONG2UNUSED,
MMCO_SHORT2LONG,
MMCO_SET_MAX_LONG,
MMCO_RESET,
MMCO_LONG,
} MMCOOpcode;
/**
* Memory management control operation.
*/
typedef struct MMCO {
MMCOOpcode opcode;
int short_pic_num; ///< pic_num without wrapping (pic_num & max_pic_num)
int long_arg; ///< index, pic_num, or num long refs depending on opcode
} MMCO;
typedef struct H264Picture {
AVFrame *f;
ThreadFrame tf;
AVBufferRef *qscale_table_buf;
int8_t *qscale_table;
AVBufferRef *motion_val_buf[2];
int16_t (*motion_val[2])[2];
AVBufferRef *mb_type_buf;
uint32_t *mb_type;
AVBufferRef *hwaccel_priv_buf;
void *hwaccel_picture_private; ///< hardware accelerator private data
AVBufferRef *ref_index_buf[2];
int8_t *ref_index[2];
int field_poc[2]; ///< top/bottom POC
int poc; ///< frame POC
int frame_num; ///< frame_num (raw frame_num from slice header)
int mmco_reset; /**< MMCO_RESET set this 1. Reordering code must
not mix pictures before and after MMCO_RESET. */
int pic_id; /**< pic_num (short -> no wrap version of pic_num,
pic_num & max_pic_num; long -> long_pic_num) */
int long_ref; ///< 1->long term reference 0->short term reference
int ref_poc[2][2][32]; ///< POCs of the frames/fields used as reference (FIXME need per slice)
int ref_count[2][2]; ///< number of entries in ref_poc (FIXME need per slice)
int mbaff; ///< 1 -> MBAFF frame 0-> not MBAFF
int field_picture; ///< whether or not picture was encoded in separate fields
int reference;
int recovered; ///< picture at IDR or recovery point + recovery count
int invalid_gap;
int sei_recovery_frame_cnt;
int crop;
int crop_left;
int crop_top;
} H264Picture;
typedef struct H264Ref {
uint8_t *data[3];
int linesize[3];
int reference;
int poc;
int pic_id;
H264Picture *parent;
} H264Ref;
typedef struct H264SliceContext {
struct H264Context *h264;
GetBitContext gb;
ERContext er;
int slice_num;
int slice_type;
int slice_type_nos; ///< S free slice type (SI/SP are remapped to I/P)
int slice_type_fixed;
int qscale;
int chroma_qp[2]; // QPc
int qp_thresh; ///< QP threshold to skip loopfilter
int last_qscale_diff;
// deblock
int deblocking_filter; ///< disable_deblocking_filter_idc with 1 <-> 0
int slice_alpha_c0_offset;
int slice_beta_offset;
H264PredWeightTable pwt;
int prev_mb_skipped;
int next_mb_skipped;
int chroma_pred_mode;
int intra16x16_pred_mode;
int8_t intra4x4_pred_mode_cache[5 * 8];
int8_t(*intra4x4_pred_mode);
int topleft_mb_xy;
int top_mb_xy;
int topright_mb_xy;
int left_mb_xy[LEFT_MBS];
int topleft_type;
int top_type;
int topright_type;
int left_type[LEFT_MBS];
const uint8_t *left_block;
int topleft_partition;
unsigned int topleft_samples_available;
unsigned int top_samples_available;
unsigned int topright_samples_available;
unsigned int left_samples_available;
ptrdiff_t linesize, uvlinesize;
ptrdiff_t mb_linesize; ///< may be equal to s->linesize or s->linesize * 2, for mbaff
ptrdiff_t mb_uvlinesize;
int mb_x, mb_y;
int mb_xy;
int resync_mb_x;
int resync_mb_y;
unsigned int first_mb_addr;
// index of the first MB of the next slice
int next_slice_idx;
int mb_skip_run;
int is_complex;
int picture_structure;
int mb_field_decoding_flag;
int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag
int redundant_pic_count;
/**
* number of neighbors (top and/or left) that used 8x8 dct
*/
int neighbor_transform_size;
int direct_spatial_mv_pred;
int col_parity;
int col_fieldoff;
int cbp;
int top_cbp;
int left_cbp;
int dist_scale_factor[32];
int dist_scale_factor_field[2][32];
int map_col_to_list0[2][16 + 32];
int map_col_to_list0_field[2][2][16 + 32];
/**
* num_ref_idx_l0/1_active_minus1 + 1
*/
unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode
unsigned int list_count;
H264Ref ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs.
* Reordered version of default_ref_list
* according to picture reordering in slice header */
struct {
uint8_t op;
uint32_t val;
} ref_modifications[2][32];
int nb_ref_modifications[2];
unsigned int pps_id;
const uint8_t *intra_pcm_ptr;
int16_t *dc_val_base;
uint8_t *bipred_scratchpad;
uint8_t *edge_emu_buffer;
uint8_t (*top_borders[2])[(16 * 3) * 2];
int bipred_scratchpad_allocated;
int edge_emu_buffer_allocated;
int top_borders_allocated[2];
/**
* non zero coeff count cache.
* is 64 if not available.
*/
DECLARE_ALIGNED(8, uint8_t, non_zero_count_cache)[15 * 8];
/**
* Motion vector cache.
*/
DECLARE_ALIGNED(16, int16_t, mv_cache)[2][5 * 8][2];
DECLARE_ALIGNED(8, int8_t, ref_cache)[2][5 * 8];
DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5 * 8][2];
uint8_t direct_cache[5 * 8];
DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4];
///< as a DCT coefficient is int32_t in high depth, we need to reserve twice the space.
DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2];
DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2];
///< as mb is addressed by scantable[i] and scantable is uint8_t we can either
///< check that i is not too large or ensure that there is some unused stuff after mb
int16_t mb_padding[256 * 2];
uint8_t (*mvd_table[2])[2];
/**
* Cabac
*/
CABACContext cabac;
uint8_t cabac_state[1024];
int cabac_init_idc;
MMCO mmco[MAX_MMCO_COUNT];
int nb_mmco;
int explicit_ref_marking;
int frame_num;
int poc_lsb;
int delta_poc_bottom;
int delta_poc[2];
int curr_pic_num;
int max_pic_num;
} H264SliceContext;
/**
* H264Context
*/
typedef struct H264Context {
const AVClass *class;
AVCodecContext *avctx;
VideoDSPContext vdsp;
H264DSPContext h264dsp;
H264ChromaContext h264chroma;
H264QpelContext h264qpel;
H264Picture DPB[H264_MAX_PICTURE_COUNT];
H264Picture *cur_pic_ptr;
H264Picture cur_pic;
H264Picture last_pic_for_ec;
H264SliceContext *slice_ctx;
int nb_slice_ctx;
H2645Packet pkt;
int pixel_shift; ///< 0 for 8-bit H.264, 1 for high-bit-depth H.264
/* coded dimensions -- 16 * mb w/h */
int width, height;
int chroma_x_shift, chroma_y_shift;
/**
* Backup frame properties: needed, because they can be different
* between returned frame and last decoded frame.
**/
int backup_width;
int backup_height;
enum AVPixelFormat backup_pix_fmt;
int droppable;
int coded_picture_number;
int context_initialized;
int flags;
int workaround_bugs;
/* Set when slice threading is used and at least one slice uses deblocking
* mode 1 (i.e. across slice boundaries). Then we disable the loop filter
* during normal MB decoding and execute it serially at the end.
*/
int postpone_filter;
/*
* Set to 1 when the current picture is IDR, 0 otherwise.
*/
int picture_idr;
int8_t(*intra4x4_pred_mode);
H264PredContext hpc;
uint8_t (*non_zero_count)[48];
#define LIST_NOT_USED -1 // FIXME rename?
#define PART_NOT_AVAILABLE -2
/**
* block_offset[ 0..23] for frame macroblocks
* block_offset[24..47] for field macroblocks
*/
int block_offset[2 * (16 * 3)];
uint32_t *mb2b_xy; // FIXME are these 4 a good idea?
uint32_t *mb2br_xy;
int b_stride; // FIXME use s->b4_stride
uint16_t *slice_table; ///< slice_table_base + 2*mb_stride + 1
// interlacing specific flags
int mb_aff_frame;
int picture_structure;
int first_field;
uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type
/* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */
uint16_t *cbp_table;
/* chroma_pred_mode for i4x4 or i16x16, else 0 */
uint8_t *chroma_pred_mode_table;
uint8_t (*mvd_table[2])[2];
uint8_t *direct_table;
uint8_t zigzag_scan[16];
uint8_t zigzag_scan8x8[64];
uint8_t zigzag_scan8x8_cavlc[64];
uint8_t field_scan[16];
uint8_t field_scan8x8[64];
uint8_t field_scan8x8_cavlc[64];
uint8_t zigzag_scan_q0[16];
uint8_t zigzag_scan8x8_q0[64];
uint8_t zigzag_scan8x8_cavlc_q0[64];
uint8_t field_scan_q0[16];
uint8_t field_scan8x8_q0[64];
uint8_t field_scan8x8_cavlc_q0[64];
int mb_y;
int mb_height, mb_width;
int mb_stride;
int mb_num;
// =============================================================
// Things below are not used in the MB or more inner code
int nal_ref_idc;
int nal_unit_type;
/**
* Used to parse AVC variant of H.264
*/
int is_avc; ///< this flag is != 0 if codec is avc1
int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
int bit_depth_luma; ///< luma bit depth from sps to detect changes
int chroma_format_idc; ///< chroma format from sps to detect changes
H264ParamSets ps;
uint16_t *slice_table_base;
H264POCContext poc;
H264Ref default_ref[2];
H264Picture *short_ref[32];
H264Picture *long_ref[32];
H264Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size?
int last_pocs[MAX_DELAYED_PIC_COUNT];
H264Picture *next_output_pic;
int next_outputed_poc;
/**
* memory management control operations buffer.
*/
MMCO mmco[MAX_MMCO_COUNT];
int nb_mmco;
int mmco_reset;
int explicit_ref_marking;
int long_ref_count; ///< number of actual long term references
int short_ref_count; ///< number of actual short term references
/**
* @name Members for slice based multithreading
* @{
*/
/**
* current slice number, used to initialize slice_num of each thread/context
*/
int current_slice;
/**
* Max number of threads / contexts.
* This is equal to AVCodecContext.thread_count unless
* multithreaded decoding is impossible, in which case it is
* reduced to 1.
*/
int max_contexts;
/**
* 1 if the single thread fallback warning has already been
* displayed, 0 otherwise.
*/
int single_decode_warning;
/** @} */
/**
* Complement sei_pic_struct
* SEI_PIC_STRUCT_TOP_BOTTOM and SEI_PIC_STRUCT_BOTTOM_TOP indicate interlaced frames.
* However, soft telecined frames may have these values.
* This is used in an attempt to flag soft telecine progressive.
*/
int prev_interlaced_frame;
/**
* Are the SEI recovery points looking valid.
*/
int valid_recovery_point;
/**
* recovery_frame is the frame_num at which the next frame should
* be fully constructed.
*
* Set to -1 when not expecting a recovery point.
*/
int recovery_frame;
/**
* We have seen an IDR, so all the following frames in coded order are correctly
* decodable.
*/
#define FRAME_RECOVERED_IDR (1 << 0)
/**
* Sufficient number of frames have been decoded since a SEI recovery point,
* so all the following frames in presentation order are correct.
*/
#define FRAME_RECOVERED_SEI (1 << 1)
int frame_recovered; ///< Initial frame has been completely recovered
int has_recovery_point;
int missing_fields;
/* for frame threading, this is set to 1
* after finish_setup() has been called, so we cannot modify
* some context properties (which are supposed to stay constant between
* slices) anymore */
int setup_finished;
int cur_chroma_format_idc;
int cur_bit_depth_luma;
int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
int enable_er;
H264SEIContext sei;
AVBufferPool *qscale_table_pool;
AVBufferPool *mb_type_pool;
AVBufferPool *motion_val_pool;
AVBufferPool *ref_index_pool;
int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
} H264Context;
extern const uint16_t ff_h264_mb_sizes[4];
/**
* Reconstruct bitstream slice_type.
*/
int ff_h264_get_slice_type(const H264SliceContext *sl);
/**
* Allocate tables.
* needs width/height
*/
int ff_h264_alloc_tables(H264Context *h);
int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx);
int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl);
void ff_h264_remove_all_refs(H264Context *h);
/**
* Execute the reference picture marking (memory management control operations).
*/
int ff_h264_execute_ref_pic_marking(H264Context *h);
int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb,
const H2645NAL *nal, void *logctx);
void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl);
int ff_h264_decode_init(AVCodecContext *avctx);
void ff_h264_decode_init_vlc(void);
/**
* Decode a macroblock
* @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR on error
*/
int ff_h264_decode_mb_cavlc(const H264Context *h, H264SliceContext *sl);
/**
* Decode a CABAC coded macroblock
* @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR on error
*/
int ff_h264_decode_mb_cabac(const H264Context *h, H264SliceContext *sl);
void ff_h264_init_cabac_states(const H264Context *h, H264SliceContext *sl);
void ff_h264_direct_dist_scale_factor(const H264Context *const h, H264SliceContext *sl);
void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *sl);
void ff_h264_pred_direct_motion(const H264Context *const h, H264SliceContext *sl,
int *mb_type);
void ff_h264_filter_mb_fast(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y,
uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
unsigned int linesize, unsigned int uvlinesize);
void ff_h264_filter_mb(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y,
uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
unsigned int linesize, unsigned int uvlinesize);
/*
* o-o o-o
* / / /
* o-o o-o
* ,---'
* o-o o-o
* / / /
* o-o o-o
*/
/* Scan8 organization:
* 0 1 2 3 4 5 6 7
* 0 DY y y y y y
* 1 y Y Y Y Y
* 2 y Y Y Y Y
* 3 y Y Y Y Y
* 4 y Y Y Y Y
* 5 DU u u u u u
* 6 u U U U U
* 7 u U U U U
* 8 u U U U U
* 9 u U U U U
* 10 DV v v v v v
* 11 v V V V V
* 12 v V V V V
* 13 v V V V V
* 14 v V V V V
* DY/DU/DV are for luma/chroma DC.
*/
#define LUMA_DC_BLOCK_INDEX 48
#define CHROMA_DC_BLOCK_INDEX 49
// This table must be here because scan8[constant] must be known at compiletime
static const uint8_t scan8[16 * 3 + 3] = {
4 + 1 * 8, 5 + 1 * 8, 4 + 2 * 8, 5 + 2 * 8,
6 + 1 * 8, 7 + 1 * 8, 6 + 2 * 8, 7 + 2 * 8,
4 + 3 * 8, 5 + 3 * 8, 4 + 4 * 8, 5 + 4 * 8,
6 + 3 * 8, 7 + 3 * 8, 6 + 4 * 8, 7 + 4 * 8,
4 + 6 * 8, 5 + 6 * 8, 4 + 7 * 8, 5 + 7 * 8,
6 + 6 * 8, 7 + 6 * 8, 6 + 7 * 8, 7 + 7 * 8,
4 + 8 * 8, 5 + 8 * 8, 4 + 9 * 8, 5 + 9 * 8,
6 + 8 * 8, 7 + 8 * 8, 6 + 9 * 8, 7 + 9 * 8,
4 + 11 * 8, 5 + 11 * 8, 4 + 12 * 8, 5 + 12 * 8,
6 + 11 * 8, 7 + 11 * 8, 6 + 12 * 8, 7 + 12 * 8,
4 + 13 * 8, 5 + 13 * 8, 4 + 14 * 8, 5 + 14 * 8,
6 + 13 * 8, 7 + 13 * 8, 6 + 14 * 8, 7 + 14 * 8,
0 + 0 * 8, 0 + 5 * 8, 0 + 10 * 8
};
static av_always_inline uint32_t pack16to32(unsigned a, unsigned b)
{
#if HAVE_BIGENDIAN
return (b & 0xFFFF) + (a << 16);
#else
return (a & 0xFFFF) + (b << 16);
#endif
}
static av_always_inline uint16_t pack8to16(unsigned a, unsigned b)
{
#if HAVE_BIGENDIAN
return (b & 0xFF) + (a << 8);
#else
return (a & 0xFF) + (b << 8);
#endif
}
/**
* Get the chroma qp.
*/
static av_always_inline int get_chroma_qp(const PPS *pps, int t, int qscale)
{
return pps->chroma_qp_table[t][qscale];
}
/**
* Get the predicted intra4x4 prediction mode.
*/
static av_always_inline int pred_intra_mode(const H264Context *h,
H264SliceContext *sl, int n)
{
const int index8 = scan8[n];
const int left = sl->intra4x4_pred_mode_cache[index8 - 1];
const int top = sl->intra4x4_pred_mode_cache[index8 - 8];
const int min = FFMIN(left, top);
ff_tlog(h->avctx, "mode:%d %d min:%d\n", left, top, min);
if (min < 0)
return DC_PRED;
else
return min;
}
static av_always_inline void write_back_intra_pred_mode(const H264Context *h,
H264SliceContext *sl)
{
int8_t *i4x4 = sl->intra4x4_pred_mode + h->mb2br_xy[sl->mb_xy];
int8_t *i4x4_cache = sl->intra4x4_pred_mode_cache;
AV_COPY32(i4x4, i4x4_cache + 4 + 8 * 4);
i4x4[4] = i4x4_cache[7 + 8 * 3];
i4x4[5] = i4x4_cache[7 + 8 * 2];
i4x4[6] = i4x4_cache[7 + 8 * 1];
}
static av_always_inline void write_back_non_zero_count(const H264Context *h,
H264SliceContext *sl)
{
const int mb_xy = sl->mb_xy;
uint8_t *nnz = h->non_zero_count[mb_xy];
uint8_t *nnz_cache = sl->non_zero_count_cache;
AV_COPY32(&nnz[ 0], &nnz_cache[4 + 8 * 1]);
AV_COPY32(&nnz[ 4], &nnz_cache[4 + 8 * 2]);
AV_COPY32(&nnz[ 8], &nnz_cache[4 + 8 * 3]);
AV_COPY32(&nnz[12], &nnz_cache[4 + 8 * 4]);
AV_COPY32(&nnz[16], &nnz_cache[4 + 8 * 6]);
AV_COPY32(&nnz[20], &nnz_cache[4 + 8 * 7]);
AV_COPY32(&nnz[32], &nnz_cache[4 + 8 * 11]);
AV_COPY32(&nnz[36], &nnz_cache[4 + 8 * 12]);
if (!h->chroma_y_shift) {
AV_COPY32(&nnz[24], &nnz_cache[4 + 8 * 8]);
AV_COPY32(&nnz[28], &nnz_cache[4 + 8 * 9]);
AV_COPY32(&nnz[40], &nnz_cache[4 + 8 * 13]);
AV_COPY32(&nnz[44], &nnz_cache[4 + 8 * 14]);
}
}
static av_always_inline void write_back_motion_list(const H264Context *h,
H264SliceContext *sl,
int b_stride,
int b_xy, int b8_xy,
int mb_type, int list)
{
int16_t(*mv_dst)[2] = &h->cur_pic.motion_val[list][b_xy];
int16_t(*mv_src)[2] = &sl->mv_cache[list][scan8[0]];
AV_COPY128(mv_dst + 0 * b_stride, mv_src + 8 * 0);
AV_COPY128(mv_dst + 1 * b_stride, mv_src + 8 * 1);
AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2);
AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3);
if (CABAC(h)) {
uint8_t (*mvd_dst)[2] = &sl->mvd_table[list][FMO ? 8 * sl->mb_xy
: h->mb2br_xy[sl->mb_xy]];
uint8_t(*mvd_src)[2] = &sl->mvd_cache[list][scan8[0]];
if (IS_SKIP(mb_type)) {
AV_ZERO128(mvd_dst);
} else {
AV_COPY64(mvd_dst, mvd_src + 8 * 3);
AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8 * 0);
AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8 * 1);
AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8 * 2);
}
}
{
int8_t *ref_index = &h->cur_pic.ref_index[list][b8_xy];
int8_t *ref_cache = sl->ref_cache[list];
ref_index[0 + 0 * 2] = ref_cache[scan8[0]];
ref_index[1 + 0 * 2] = ref_cache[scan8[4]];
ref_index[0 + 1 * 2] = ref_cache[scan8[8]];
ref_index[1 + 1 * 2] = ref_cache[scan8[12]];
}
}
static av_always_inline void write_back_motion(const H264Context *h,
H264SliceContext *sl,
int mb_type)
{
const int b_stride = h->b_stride;
const int b_xy = 4 * sl->mb_x + 4 * sl->mb_y * h->b_stride; // try mb2b(8)_xy
const int b8_xy = 4 * sl->mb_xy;
if (USES_LIST(mb_type, 0)) {
write_back_motion_list(h, sl, b_stride, b_xy, b8_xy, mb_type, 0);
} else {
fill_rectangle(&h->cur_pic.ref_index[0][b8_xy],
2, 2, 2, (uint8_t)LIST_NOT_USED, 1);
}
if (USES_LIST(mb_type, 1))
write_back_motion_list(h, sl, b_stride, b_xy, b8_xy, mb_type, 1);
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && CABAC(h)) {
if (IS_8X8(mb_type)) {
uint8_t *direct_table = &h->direct_table[4 * sl->mb_xy];
direct_table[1] = sl->sub_mb_type[1] >> 1;
direct_table[2] = sl->sub_mb_type[2] >> 1;
direct_table[3] = sl->sub_mb_type[3] >> 1;
}
}
}
static av_always_inline int get_dct8x8_allowed(const H264Context *h, H264SliceContext *sl)
{
if (h->ps.sps->direct_8x8_inference_flag)
return !(AV_RN64A(sl->sub_mb_type) &
((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8) *
0x0001000100010001ULL));
else
return !(AV_RN64A(sl->sub_mb_type) &
((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8 | MB_TYPE_DIRECT2) *
0x0001000100010001ULL));
}
static inline int find_start_code(const uint8_t *buf, int buf_size,
int buf_index, int next_avc)
{
uint32_t state = -1;
buf_index = avpriv_find_start_code(buf + buf_index, buf + next_avc + 1, &state) - buf - 1;
return FFMIN(buf_index, buf_size);
}
int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup);
int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src);
void ff_h264_unref_picture(H264Context *h, H264Picture *pic);
int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl);
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height);
int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl,
const H2645NAL *nal);
#define SLICE_SINGLETHREAD 1
#define SLICE_SKIPED 2
int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count);
int ff_h264_update_thread_context(AVCodecContext *dst,
const AVCodecContext *src);
void ff_h264_flush_change(H264Context *h);
void ff_h264_free_tables(H264Context *h);
void ff_h264_set_erpic(ERPicture *dst, H264Picture *src);
#endif /* AVCODEC_H264DEC_H */

View File

@ -27,7 +27,7 @@
#include "bit_depth_template.c"
#include "libavutil/common.h"
#include "h264.h"
#include "h264dec.h"
#include "h264idct.h"
void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride)

View File

@ -37,7 +37,6 @@
#include "bytestream.h"
#include "hap.h"
#include "internal.h"
#include "memory.h"
#include "snappy.h"
#include "texturedsp.h"
#include "thread.h"

View File

@ -26,7 +26,6 @@
#include "libavutil/internal.h"
#include "cabac_functions.h"
#include "golomb.h"
#include "hevc.h"
#include "bit_depth_template.c"

View File

@ -25,6 +25,7 @@
#include "avcodec.h"
#include "canopus.h"
#include "get_bits.h"
#include "internal.h"
#include "hq_hqa.h"

View File

@ -24,9 +24,9 @@
#include <stdint.h>
#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
#include "hq_hqadsp.h"
#include "vlc.h"
#define NUM_HQ_AC_ENTRIES 746
#define NUM_HQ_PROFILES 22

View File

@ -27,7 +27,7 @@
#include <stdint.h>
#include "libavutil/qsort.h"
#include"libavutil/common.h"
#include "libavutil/common.h"
#include "avcodec.h"
#include "huffman.h"

View File

@ -865,8 +865,10 @@ static void decode_delta_j(uint8_t *dst,
for (g = 0; g < groups; g++) {
offset = bytestream2_get_be16(&gb);
if (bytestream2_get_bytes_left(&gb) < 1)
if (cols * bpp == 0 || bytestream2_get_bytes_left(&gb) < cols * bpp) {
av_log(NULL, AV_LOG_ERROR, "cols*bpp is invalid (%d*%d)", cols, bpp);
return;
}
if (kludge_j)
offset = ((offset / (320 / 8)) * pitch) + (offset % (320 / 8)) - kludge_j;
@ -911,8 +913,10 @@ static void decode_delta_j(uint8_t *dst,
for (d = 0; d < bpp; d++) {
unsigned noffset = offset + (r * pitch) + d * planepitch;
if (bytestream2_get_bytes_left(&gb) < 1)
if (!bytes || bytestream2_get_bytes_left(&gb) < bytes) {
av_log(NULL, AV_LOG_ERROR, "bytes %d is invalid", bytes);
return;
}
for (b = 0; b < bytes; b++) {
uint8_t value = bytestream2_get_byte(&gb);
@ -1377,13 +1381,15 @@ static void decode_delta_l(uint8_t *dst,
bytestream2_init(&dgb, buf + 2 * poff0, buf_end - (buf + 2 * poff0));
bytestream2_init(&ogb, buf + 2 * poff1, buf_end - (buf + 2 * poff1));
while ((bytestream2_peek_be16(&ogb)) != 0xFFFF && bytestream2_get_bytes_left(&ogb) >= 4) {
while (bytestream2_peek_be16(&ogb) != 0xFFFF && bytestream2_get_bytes_left(&ogb) >= 4) {
uint32_t offset = bytestream2_get_be16(&ogb);
int16_t cnt = bytestream2_get_be16(&ogb);
uint16_t data;
offset = ((2 * offset) / planepitch_byte) * pitch + ((2 * offset) % planepitch_byte) + k * planepitch;
if (cnt < 0) {
if (bytestream2_get_bytes_left(&dgb) < 2)
break;
bytestream2_seek_p(&pb, offset, SEEK_SET);
cnt = -cnt;
data = bytestream2_get_be16(&dgb);
@ -1392,6 +1398,8 @@ static void decode_delta_l(uint8_t *dst,
bytestream2_skip_p(&pb, dstpitch - 2);
}
} else {
if (bytestream2_get_bytes_left(&dgb) < 2*cnt)
break;
bytestream2_seek_p(&pb, offset, SEEK_SET);
for (i = 0; i < cnt; i++) {
data = bytestream2_get_be16(&dgb);

View File

@ -24,8 +24,9 @@
* Intel Indeo 2 decoder.
*/
#define BITSTREAM_READER_LE
#include "libavutil/attributes.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "get_bits.h"
#include "indeo2data.h"

View File

@ -26,7 +26,6 @@
#define IR2_CODES 143
static const uint16_t ir2_codes[IR2_CODES][2] = {
#ifdef BITSTREAM_READER_LE
{ 0x0000, 3 }, { 0x0004, 3 }, { 0x0006, 3 }, { 0x0001, 5 },
{ 0x0009, 5 }, { 0x0019, 5 }, { 0x000D, 5 }, { 0x001D, 5 },
{ 0x0023, 6 }, { 0x0013, 6 }, { 0x0033, 6 }, { 0x000B, 6 },
@ -63,44 +62,6 @@ static const uint16_t ir2_codes[IR2_CODES][2] = {
{ 0x003B, 6 }, { 0x0047, 8 }, { 0x00C7, 8 }, { 0x0017, 8 },
{ 0x00D7, 8 }, { 0x0077, 8 }, { 0x010F, 9 }, { 0x004F, 9 },
{ 0x01CF, 9 }, { 0x00AF, 9 }, { 0x016F, 9 },
#else
{ 0x0000, 3 }, { 0x0001, 3 }, { 0x0003, 3 }, { 0x0010, 5 },
{ 0x0012, 5 }, { 0x0013, 5 }, { 0x0016, 5 }, { 0x0017, 5 },
{ 0x0031, 6 }, { 0x0032, 6 }, { 0x0033, 6 }, { 0x0034, 6 },
{ 0x0035, 6 }, { 0x0036, 6 }, { 0x00E0, 8 }, { 0x00E1, 8 },
{ 0x00E4, 8 }, { 0x00E5, 8 }, { 0x00E6, 8 }, { 0x00E7, 8 },
{ 0x00E9, 8 }, { 0x00EA, 8 }, { 0x00EC, 8 }, { 0x00ED, 8 },
{ 0x00EF, 8 }, { 0x01E0, 9 }, { 0x01E2, 9 }, { 0x01E3, 9 },
{ 0x01E5, 9 }, { 0x01E6, 9 }, { 0x01E8, 9 }, { 0x01E9, 9 },
{ 0x01EB, 9 }, { 0x01EC, 9 }, { 0x01EE, 9 }, { 0x01EF, 9 },
{ 0x03E0, 10 }, { 0x03E1, 10 }, { 0x03E2, 10 }, { 0x03E3, 10 },
{ 0x03E4, 10 }, { 0x03E5, 10 }, { 0x03E6, 10 }, { 0x03E7, 10 },
{ 0x03E8, 10 }, { 0x03E9, 10 }, { 0x03EA, 10 }, { 0x03EB, 10 },
{ 0x03EC, 10 }, { 0x03ED, 10 }, { 0x03EE, 10 }, { 0x03EF, 10 },
{ 0x1F80, 13 }, { 0x1F81, 13 }, { 0x1F82, 13 }, { 0x1F83, 13 },
{ 0x1F84, 13 }, { 0x1F85, 13 }, { 0x1F86, 13 }, { 0x1F87, 13 },
{ 0x1F88, 13 }, { 0x1F89, 13 }, { 0x1F8A, 13 }, { 0x1F8B, 13 },
{ 0x1F8C, 13 }, { 0x1F8D, 13 }, { 0x1F8E, 13 }, { 0x1F8F, 13 },
{ 0x1F90, 13 }, { 0x1F91, 13 }, { 0x1F92, 13 }, { 0x1F93, 13 },
{ 0x1F94, 13 }, { 0x1F95, 13 }, { 0x1F96, 13 }, { 0x1F97, 13 },
{ 0x1F98, 13 }, { 0x1F99, 13 }, { 0x1F9A, 13 }, { 0x1F9B, 13 },
{ 0x1F9C, 13 }, { 0x1F9D, 13 }, { 0x1F9E, 13 }, { 0x1F9F, 13 },
{ 0x1FA0, 13 }, { 0x1FA1, 13 }, { 0x1FA2, 13 }, { 0x1FA3, 13 },
{ 0x1FA4, 13 }, { 0x1FA5, 13 }, { 0x1FA6, 13 }, { 0x1FA7, 13 },
{ 0x1FA8, 13 }, { 0x1FA9, 13 }, { 0x1FAA, 13 }, { 0x1FAB, 13 },
{ 0x1FAC, 13 }, { 0x1FAD, 13 }, { 0x1FAE, 13 }, { 0x1FAF, 13 },
{ 0x1FB0, 13 }, { 0x1FB1, 13 }, { 0x1FB2, 13 }, { 0x1FB3, 13 },
{ 0x1FB4, 13 }, { 0x1FB5, 13 }, { 0x1FB6, 13 }, { 0x1FB7, 13 },
{ 0x1FB8, 13 }, { 0x1FB9, 13 }, { 0x1FBA, 13 }, { 0x1FBB, 13 },
{ 0x1FBC, 13 }, { 0x1FBD, 13 }, { 0x1FBE, 13 }, { 0x1FBF, 13 },
{ 0x3F80, 14 }, { 0x3F81, 14 }, { 0x3F82, 14 }, { 0x3F83, 14 },
{ 0x3F84, 14 }, { 0x3F85, 14 }, { 0x3F86, 14 }, { 0x3F87, 14 },
{ 0x3F88, 14 }, { 0x3F89, 14 }, { 0x3F8A, 14 }, { 0x0002, 3 },
{ 0x0011, 5 }, { 0x0014, 5 }, { 0x0015, 5 }, { 0x0030, 6 },
{ 0x0037, 6 }, { 0x00E2, 8 }, { 0x00E3, 8 }, { 0x00E8, 8 },
{ 0x00EB, 8 }, { 0x00EE, 8 }, { 0x01E1, 9 }, { 0x01E4, 9 },
{ 0x01E7, 9 }, { 0x01EA, 9 }, { 0x01ED, 9 },
#endif
};
static const uint8_t ir2_delta_table[4][256] = {

View File

@ -30,10 +30,10 @@
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "get_bits.h"
#include "ivi.h"
#include "ivi_dsp.h"
#include "indeo4data.h"
#include "internal.h"
#include "ivi.h"
#include "ivi_dsp.h"
#define IVI4_PIC_SIZE_ESC 7

View File

@ -19,8 +19,9 @@
*/
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"

View File

@ -39,11 +39,12 @@
#include <string.h>
#include "libavutil/intreadwrite.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "bytestream.h"
#include "hpeldsp.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#include "hpeldsp.h"
#include "internal.h"
#define PALETTE_COUNT 256

View File

@ -116,7 +116,7 @@ static av_cold int x8_vlc_init(void)
#undef init_or_vlc
if (offset != sizeof(table) / sizeof(VLC_TYPE) / 2) {
av_log(NULL, AV_LOG_ERROR, "table size %zd does not match needed %i\n",
av_log(NULL, AV_LOG_ERROR, "table size %"SIZE_SPECIFIER" does not match needed %i\n",
sizeof(table) / sizeof(VLC_TYPE) / 2, offset);
return AVERROR_INVALIDDATA;
}

Some files were not shown because too many files have changed in this diff Show More