Compare commits
251 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fcbd117df3 | |||
| b8aa7b9a6d | |||
| d2ce6472a7 | |||
| ebc01c8f6d | |||
| 00e7e4b188 | |||
| 938bc919ea | |||
| afebdc3ed7 | |||
| 6e14fc4aa1 | |||
| 1061a2e2ef | |||
| 65b0caf47d | |||
| bccddd7fcc | |||
| b2e9d3da81 | |||
| 380bc8585c | |||
| 8791a1e7de | |||
| 70d0d83d4d | |||
| aec3daa8b4 | |||
| 7b23dd0f41 | |||
| 967604fecf | |||
| 3fb09dba40 | |||
| a634da282b | |||
| df6e929e89 | |||
| 42355d12db | |||
| eb495b20e5 | |||
| 7f521fae2b | |||
| 531ebb7506 | |||
| d7973cf03d | |||
| 45fb50b4bc | |||
| f645fd64c3 | |||
| 1a05e6ced3 | |||
| 5a4234de5e | |||
| 47f608a7e1 | |||
| 5af88171e7 | |||
| 6d2b2ee3a5 | |||
| 9afcf994f6 | |||
| 7da37aa980 | |||
| 318b13a5ad | |||
| 17a5df4ab8 | |||
| 968ffb93af | |||
| 84ab680624 | |||
| 8327559fe8 | |||
| 229025799f | |||
| a04ff0c054 | |||
| ce828a247d | |||
| 6e60a38322 | |||
| f2b51fd54c | |||
| 0f36c5f5c7 | |||
| 3f095c5b56 | |||
| b95c209a61 | |||
| cd42c19f53 | |||
| 32353f8bcb | |||
| 2c3ea34082 | |||
| c0a6febf32 | |||
| cc0817af0d | |||
| 386975d7a4 | |||
| 8591d16ce5 | |||
| 07255282d0 | |||
| f9235773d6 | |||
| 4f51a21c30 | |||
| 6cf72a56e7 | |||
| 88093d2c1f | |||
| 8147da2bad | |||
| f291acafbb | |||
| cec6df48ba | |||
| 1a4a6d94cc | |||
| 2be51cbeea | |||
| 49a90d5d31 | |||
| fab3418cb9 | |||
| 9cc5337247 | |||
| d6d7853b4b | |||
| db923b3fbd | |||
| 0a155c57bd | |||
| 3ef38c414e | |||
| 40ed40902a | |||
| 0561cde128 | |||
| 670b565ba2 | |||
| 6b65f46673 | |||
| 052edeec55 | |||
| 48479937c3 | |||
| fd53179f4a | |||
| 5db47b3983 | |||
| 0981dfee7d | |||
| d8c4b2ae57 | |||
| fc92ca5b8e | |||
| 6d992a51c7 | |||
| 6f4b82cc3a | |||
| 37f505cc85 | |||
| a21703ca5d | |||
| a28ab09e2a | |||
| 4439d6aa69 | |||
| 3bf80c7b22 | |||
| 1361e4abb8 | |||
| 5fd1dce39a | |||
| de0a1d01ba | |||
| c4b23793d4 | |||
| e21e5c95c1 | |||
| 2b13c136c4 | |||
| d3536ce839 | |||
| 679d749eab | |||
| 7610538224 | |||
| 0003ace83b | |||
| 20c5fb9721 | |||
| 841e1399e6 | |||
| 9f76f0fab8 | |||
| bf3e331b76 | |||
| 21732c1adc | |||
| d00548f2c1 | |||
| 10e5302db4 | |||
| 84280dc7cf | |||
| 2c404cc11a | |||
| acb7907319 | |||
| 2c138c2d8c | |||
| b5106c5aa2 | |||
| 789bac72ed | |||
| 33fcbb4372 | |||
| a56eb4d56c | |||
| 70799fae35 | |||
| e049f7c24f | |||
| 83a737aa70 | |||
| 2deeb2eaef | |||
| 9eaf908897 | |||
| 1ca157b026 | |||
| f36128518b | |||
| 897524954b | |||
| f0e4bc61e3 | |||
| 36628bd215 | |||
| e42ab0115e | |||
| 10f68641ae | |||
| f0a10f6376 | |||
| 0b4d76d891 | |||
| 4fa2078217 | |||
| 081874a050 | |||
| 028a0c9148 | |||
| 9a53e8572a | |||
| 3aa3b05d64 | |||
| 7a5ddf731b | |||
| 4b12afccb2 | |||
| b55c824ee7 | |||
| a90497c183 | |||
| 65b2b0d98a | |||
| 0097cc0ea3 | |||
| 07767c704b | |||
| 2e7830e5ff | |||
| 4f644b2632 | |||
| 1d01a3b34c | |||
| 2742cb10c7 | |||
| 8229afc3a9 | |||
| 76f8c8cd05 | |||
| 786834a693 | |||
| f2c253f083 | |||
| e26be20a27 | |||
| 7b7c582c15 | |||
| 06b84f7271 | |||
| f974cc9830 | |||
| af0ba288e7 | |||
| c98d84e229 | |||
| b3d740263c | |||
| 6edf0ecab0 | |||
| b2aaf5de42 | |||
| 217367b5eb | |||
| c97f9ed53f | |||
| 05ac7fdeeb | |||
| c071618ba6 | |||
| b367c23da1 | |||
| 58a03420be | |||
| cbe442048f | |||
| 87e9f5e118 | |||
| 2cffce26a7 | |||
| c26e101654 | |||
| 60e408f252 | |||
| e61dcd2c86 | |||
| dd3914c5b5 | |||
| 90c4c076c7 | |||
| d976855c00 | |||
| 7bc5d49c60 | |||
| 36c4995428 | |||
| 57bb78d980 | |||
| b2cb42f1c3 | |||
| fe7f2a77c7 | |||
| 9dfe36616f | |||
| 4ace1597a2 | |||
| 6d2c5bb5d2 | |||
| a6d85a97d0 | |||
| 72a34d2332 | |||
| c8b57d4333 | |||
| da399903c7 | |||
| 8336a66270 | |||
| d1845e7f1a | |||
| 852f78443a | |||
| c343eabfb7 | |||
| 7ad163c258 | |||
| ef28571efe | |||
| 97aea63340 | |||
| bb6a34f237 | |||
| db5631e408 | |||
| df2c811b7c | |||
| 6f55a36be9 | |||
| 33042d632d | |||
| 3054e53ddc | |||
| 84bf631018 | |||
| 2884575d97 | |||
| 76716518a8 | |||
| e8caf67f56 | |||
| e40922c16c | |||
| ef9478d264 | |||
| 13d83899df | |||
| 61fed89ad4 | |||
| 7931e01540 | |||
| 93cee87b13 | |||
| 2a44f706aa | |||
| 61b673b1f1 | |||
| 8fde71acd9 | |||
| b32f865969 | |||
| d89eea3455 | |||
| 0a22e31fbb | |||
| 70a01aa490 | |||
| da6c519f6e | |||
| 29328d96b9 | |||
| 44cb647477 | |||
| a768c0a3e1 | |||
| 58569162c2 | |||
| 6b2fee19a7 | |||
| 8cd79c2e73 | |||
| 0502602d37 | |||
| ace829cb45 | |||
| b9b3ef4f5a | |||
| b2b7cb0f60 | |||
| 5cc6370a15 | |||
| 8b019be79b | |||
| e36830c695 | |||
| bc2ceeb3ac | |||
| 66bdf8f145 | |||
| bfe61bbd00 | |||
| 5888679ae3 | |||
| ecb375684d | |||
| df56bc18ef | |||
| ef99025603 | |||
| 860293a9a2 | |||
| 9b71114247 | |||
| 0b6de235b9 | |||
| a73b464118 | |||
| d9e9e97e5f | |||
| d52676da38 | |||
| ca85c3cd7d | |||
| de253343c1 | |||
| 9c787a21ce | |||
| 7e11a86175 | |||
| 9ef90ff0a2 | |||
| 6c95a26c1a | |||
| b6ec181240 | |||
| b42e135614 | |||
| 0564e8ee49 |
@@ -1,6 +1,6 @@
|
||||
See the Git history of the project (https://git.ffmpeg.org/ffmpeg) to
|
||||
See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
|
||||
get the names of people who have contributed to FFmpeg.
|
||||
|
||||
To check the log, you can type the command "git log" in the FFmpeg
|
||||
source directory, or browse the online repository at
|
||||
https://git.ffmpeg.org/ffmpeg
|
||||
http://source.ffmpeg.org.
|
||||
|
||||
+8
-11
@@ -121,6 +121,7 @@ Generic Parts:
|
||||
motion* Michael Niedermayer
|
||||
rate control:
|
||||
ratecontrol.c Michael Niedermayer
|
||||
libxvid_rc.c Michael Niedermayer
|
||||
simple IDCT:
|
||||
simple_idct.c, simple_idct.h Michael Niedermayer
|
||||
postprocessing:
|
||||
@@ -219,7 +220,7 @@ Codecs:
|
||||
ptx.c Ivo van Poorten
|
||||
qcelp* Reynaldo H. Verdejo Pinochet
|
||||
qdm2.c, qdm2data.h Roberto Togni
|
||||
qsv* Mark Thompson, Zhong Li
|
||||
qsv* Mark Thompson
|
||||
qtrle.c Mike Melanson
|
||||
ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
|
||||
resample2.c Michael Niedermayer
|
||||
@@ -332,7 +333,6 @@ Filters:
|
||||
vf_bwdif Thomas Mundt (CC <thomas.mundt@hr.de>)
|
||||
vf_chromakey.c Timo Rothenpieler
|
||||
vf_colorchannelmixer.c Paul B Mahol
|
||||
vf_colorconstancy.c Mina Sami (CC <minas.gorgy@gmail.com>)
|
||||
vf_colorbalance.c Paul B Mahol
|
||||
vf_colorkey.c Timo Rothenpieler
|
||||
vf_colorlevels.c Paul B Mahol
|
||||
@@ -413,6 +413,7 @@ Muxers/Demuxers:
|
||||
flvenc.c Michael Niedermayer, Steven Liu
|
||||
gxf.c Reimar Doeffinger
|
||||
gxfenc.c Baptiste Coudurier
|
||||
hls.c Anssi Hannula
|
||||
hlsenc.c Christian Suloway, Steven Liu
|
||||
idcin.c Mike Melanson
|
||||
idroqdec.c Mike Melanson
|
||||
@@ -523,7 +524,7 @@ Operating systems / CPU architectures
|
||||
=====================================
|
||||
|
||||
Alpha Falk Hueffner
|
||||
MIPS Manojkumar Bhosale, Shiyou Yin
|
||||
MIPS Manojkumar Bhosale
|
||||
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
|
||||
Amiga / PowerPC Colin Ward
|
||||
Windows MinGW Alex Beregszaszi, Ramiro Polla
|
||||
@@ -574,11 +575,8 @@ Releases
|
||||
If you want to maintain an older release, please contact us
|
||||
|
||||
|
||||
GnuPG Fingerprints and IRC nicknames of maintainers and contributors
|
||||
====================================================================
|
||||
|
||||
IRC nicknames are in parentheses. These apply
|
||||
to the IRC channels listed on the website.
|
||||
GnuPG Fingerprints of maintainers and contributors
|
||||
==================================================
|
||||
|
||||
Alexander Strasser 1C96 78B7 83CB 8AA7 9AF5 D1EB A7D8 A57B A876 E58F
|
||||
Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB
|
||||
@@ -596,9 +594,8 @@ Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
|
||||
James Almer 7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 59E0
|
||||
Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
|
||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Lou Logan (llogan) 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
|
||||
Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
|
||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||
DD1E C9E8 DE08 5C62 9B3E 1846 B18E 8928 B394 8D64
|
||||
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
|
||||
@@ -614,5 +611,5 @@ Steinar H. Gunderson C2E9 004F F028 C18E 4EAD DB83 7F61 7561 7797 8F76
|
||||
Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863
|
||||
Tiancheng "Timothy" Gu 9456 AFC0 814A 8139 E994 8351 7FE6 B095 B582 B0D4
|
||||
Tim Nicholson 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
|
||||
Tomas Härdin (thardin) A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 2551
|
||||
Tomas Härdin A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 2551
|
||||
Wei Gao 4269 7741 857A 0E60 9EC5 08D2 4744 4EFA 62C1 87B9
|
||||
|
||||
@@ -58,7 +58,6 @@ tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
||||
CONFIGURABLE_COMPONENTS = \
|
||||
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
|
||||
$(SRC_PATH)/libavcodec/bitstream_filters.c \
|
||||
$(SRC_PATH)/libavcodec/parsers.c \
|
||||
$(SRC_PATH)/libavformat/protocols.c \
|
||||
|
||||
config.h: ffbuild/.config
|
||||
|
||||
+6
-6
@@ -1,15 +1,15 @@
|
||||
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 4.1 "al-Khwarizmi" │
|
||||
└─────────────────────────────────────────────┘
|
||||
┌───────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 4.0 "Wu" │
|
||||
└───────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 4.1 "al-Khwarizmi", about 6
|
||||
months after the release of FFmpeg 4.0.
|
||||
The FFmpeg Project proudly presents FFmpeg 4.0 "Wu", about 6
|
||||
months after the release of FFmpeg 3.4.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
|
||||
|
||||
We hope you will like this release as much as we enjoyed working on it, and
|
||||
as usual, if you have any questions about it, or any FFmpeg related topic,
|
||||
feel free to join us on the #ffmpeg IRC channel (on irc.libera.chat) or ask
|
||||
feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
|
||||
on the mailing-lists.
|
||||
|
||||
@@ -15,41 +15,6 @@ libavutil: 2017-10-21
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
-------- 8< --------- FFmpeg 4.1 was cut here -------- 8< ---------
|
||||
|
||||
2018-10-27 - 718044dc19 - lavu 56.21.100 - pixdesc.h
|
||||
Add av_read_image_line2(), av_write_image_line2()
|
||||
|
||||
2018-10-24 - f9d4126f28 - lavu 56.20.100 - frame.h
|
||||
Add AV_FRAME_DATA_S12M_TIMECODE
|
||||
|
||||
2018-10-11 - f6d48b618a - lavc 58.33.100 - mediacodec.h
|
||||
Add av_mediacodec_render_buffer_at_time().
|
||||
|
||||
2018-09-09 - 35498c124a - lavc 58.29.100 - avcodec.h
|
||||
Add AV_PKT_DATA_AFD
|
||||
|
||||
2018-08-16 - b33f5299a5 - lavc 58.23.100 - avcodec.h
|
||||
Add av_bsf_flush().
|
||||
|
||||
2018-05-18 - 2b2f2f65f3 - lavf 58.15.100 - avformat.h
|
||||
Add pmt_version field to AVProgram
|
||||
|
||||
2018-05-17 - 5dfeb7f081 - lavf 58.14.100 - avformat.h
|
||||
Add AV_DISPOSITION_STILL_IMAGE
|
||||
|
||||
2018-05-10 - c855683427 - lavu 56.18.101 - hwcontext_cuda.h
|
||||
Add AVCUDADeviceContext.stream.
|
||||
|
||||
2018-04-30 - 56b081da57 - lavu 56.18.100 - pixdesc.h
|
||||
Add AV_PIX_FMT_FLAG_ALPHA to AV_PIX_FMT_PAL8.
|
||||
|
||||
2018-04-26 - 5be0410cb3 - lavu 56.17.100 - opt.h
|
||||
Add AV_OPT_FLAG_DEPRECATED.
|
||||
|
||||
2018-04-26 - 71fa82bed6 - lavu 56.16.100 - threadmessage.h
|
||||
Add av_thread_message_queue_nb_elems().
|
||||
|
||||
-------- 8< --------- FFmpeg 4.0 was cut here -------- 8< ---------
|
||||
|
||||
2018-04-03 - d6fc031caf - lavu 56.13.100 - pixdesc.h
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.1.11
|
||||
PROJECT_NUMBER = 4.0.3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
The FFmpeg developers.
|
||||
|
||||
For details about the authorship, see the Git history of the project
|
||||
(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||
@command{git log} in the FFmpeg source directory, or browsing the
|
||||
online repository at @url{https://git.ffmpeg.org/ffmpeg}.
|
||||
online repository at @url{http://source.ffmpeg.org}.
|
||||
|
||||
Maintainers for the specific components are listed in the file
|
||||
@file{MAINTAINERS} in the source code tree.
|
||||
|
||||
@@ -37,58 +37,6 @@ raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or
|
||||
to MOV/MP4 files and related formats such as 3GP or M4A. Please note
|
||||
that it is auto-inserted for MP4A-LATM and MOV/MP4 and related formats.
|
||||
|
||||
@section av1_metadata
|
||||
|
||||
Modify metadata embedded in an AV1 stream.
|
||||
|
||||
@table @option
|
||||
@item td
|
||||
Insert or remove temporal delimiter OBUs in all temporal units of the
|
||||
stream.
|
||||
|
||||
@table @samp
|
||||
@item insert
|
||||
Insert a TD at the beginning of every TU which does not already have one.
|
||||
@item remove
|
||||
Remove the TD from the beginning of every TU which has one.
|
||||
@end table
|
||||
|
||||
@item color_primaries
|
||||
@item transfer_characteristics
|
||||
@item matrix_coefficients
|
||||
Set the color description fields in the stream (see AV1 section 6.4.2).
|
||||
|
||||
@item color_range
|
||||
Set the color range in the stream (see AV1 section 6.4.2; note that
|
||||
this cannot be set for streams using BT.709 primaries, sRGB transfer
|
||||
characteristic and identity (RGB) matrix coefficients).
|
||||
@table @samp
|
||||
@item tv
|
||||
Limited range.
|
||||
@item pc
|
||||
Full range.
|
||||
@end table
|
||||
|
||||
@item chroma_sample_position
|
||||
Set the chroma sample location in the stream (see AV1 section 6.4.2).
|
||||
This can only be set for 4:2:0 streams.
|
||||
|
||||
@table @samp
|
||||
@item vertical
|
||||
Left position (matching the default in MPEG-2 and H.264).
|
||||
@item colocated
|
||||
Top-left position.
|
||||
@end table
|
||||
|
||||
@item tick_rate
|
||||
Set the tick rate (@emph{num_units_in_display_tick / time_scale}) in
|
||||
the timing info in the sequence header.
|
||||
@item num_ticks_per_picture
|
||||
Set the number of ticks in each picture, to indicate that the stream
|
||||
has a fixed framerate. Ignored if @option{tick_rate} is not also set.
|
||||
|
||||
@end table
|
||||
|
||||
@section chomp
|
||||
|
||||
Remove zero padding at the end of a packet.
|
||||
@@ -267,15 +215,6 @@ insert the string ``hello'' associated with the given UUID.
|
||||
@item delete_filler
|
||||
Deletes both filler NAL units and filler SEI messages.
|
||||
|
||||
@item level
|
||||
Set the level in the SPS. Refer to H.264 section A.3 and tables A-1
|
||||
to A-5.
|
||||
|
||||
The argument must be the name of a level (for example, @samp{4.2}), a
|
||||
level_idc value (for example, @samp{42}), or the special name @samp{auto}
|
||||
indicating that the filter should attempt to guess the level from the
|
||||
input stream properties.
|
||||
|
||||
@end table
|
||||
|
||||
@section h264_mp4toannexb
|
||||
@@ -566,33 +505,7 @@ Log trace output containing all syntax elements in the coded stream
|
||||
headers (everything above the level of individual coded blocks).
|
||||
This can be useful for debugging low-level stream issues.
|
||||
|
||||
Supports H.264, H.265, MPEG-2 and VP9.
|
||||
|
||||
@section vp9_metadata
|
||||
|
||||
Modify metadata embedded in a VP9 stream.
|
||||
|
||||
@table @option
|
||||
@item color_space
|
||||
Set the color space value in the frame header.
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item bt601
|
||||
@item bt709
|
||||
@item smpte170
|
||||
@item smpte240
|
||||
@item bt2020
|
||||
@item rgb
|
||||
@end table
|
||||
|
||||
@item color_range
|
||||
Set the color range value in the frame header. Note that this cannot
|
||||
be set in RGB streams.
|
||||
@table @samp
|
||||
@item tv
|
||||
@item pc
|
||||
@end table
|
||||
@end table
|
||||
Supports H.264, H.265 and MPEG-2.
|
||||
|
||||
@section vp9_superframe
|
||||
|
||||
|
||||
@@ -986,6 +986,10 @@ Set chroma qp offset from luma.
|
||||
@item trellis @var{integer} (@emph{encoding,audio,video})
|
||||
Set rate-distortion optimal quantization.
|
||||
|
||||
@item sc_factor @var{integer} (@emph{encoding,video})
|
||||
Set value multiplied by qscale for each frame and added to
|
||||
scene_change_score.
|
||||
|
||||
@item mv0_threshold @var{integer} (@emph{encoding,video})
|
||||
@item b_sensitivity @var{integer} (@emph{encoding,video})
|
||||
Adjust sensitivity of b_frame_strategy 1.
|
||||
|
||||
+9
-23
@@ -47,12 +47,6 @@ top-field-first is assumed
|
||||
|
||||
@end table
|
||||
|
||||
@section libdavs2
|
||||
|
||||
AVS2-P2/IEEE1857.4 video decoder wrapper.
|
||||
|
||||
This decoder allows libavcodec to decode AVS2 streams with davs2 library.
|
||||
|
||||
@c man end VIDEO DECODERS
|
||||
|
||||
@chapter Audio Decoders
|
||||
@@ -254,25 +248,18 @@ configuration. You need to explicitly configure the build with
|
||||
|
||||
@table @option
|
||||
@item txt_page
|
||||
List of teletext page numbers to decode. Pages that do not match the specified
|
||||
list are dropped. You may use the special @code{*} string to match all pages,
|
||||
or @code{subtitle} to match all subtitle pages.
|
||||
List of teletext page numbers to decode. You may use the special * string to
|
||||
match all pages. Pages that do not match the specified list are dropped.
|
||||
Default value is *.
|
||||
@item txt_chop_top
|
||||
Discards the top teletext line. Default value is 1.
|
||||
@item txt_format
|
||||
Specifies the format of the decoded subtitles.
|
||||
@table @option
|
||||
@item bitmap
|
||||
The default format, you should use this for teletext pages, because certain
|
||||
graphics and colors cannot be expressed in simple text or even ASS.
|
||||
@item text
|
||||
Simple text based output without formatting.
|
||||
@item ass
|
||||
Formatted ASS output, subtitle pages and teletext pages are returned in
|
||||
different styles, subtitle pages are stripped down to text, but an effort is
|
||||
made to keep the text alignment and the formatting.
|
||||
@end table
|
||||
Specifies the format of the decoded subtitles. The teletext decoder is capable
|
||||
of decoding the teletext pages to bitmaps or to simple text, you should use
|
||||
"bitmap" for teletext pages, because certain graphics and colors cannot be
|
||||
expressed in simple text. You might use "text" for teletext based subtitles if
|
||||
your application can handle simple text based subtitles. Default value is
|
||||
bitmap.
|
||||
@item txt_left
|
||||
X offset of generated bitmaps, default is 0.
|
||||
@item txt_top
|
||||
@@ -285,8 +272,7 @@ present between the subtitle lines because of double-sized teletext characters.
|
||||
Default value is 1.
|
||||
@item txt_duration
|
||||
Sets the display duration of the decoded teletext pages or subtitles in
|
||||
milliseconds. Default value is -1 which means infinity or until the next
|
||||
subtitle event comes.
|
||||
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.
|
||||
|
||||
@@ -269,12 +269,6 @@ ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
|
||||
@table @option
|
||||
@item -flv_metadata @var{bool}
|
||||
Allocate the streams according to the onMetaData array content.
|
||||
|
||||
@item -flv_ignore_prevtag @var{bool}
|
||||
Ignore the size of previous tag value.
|
||||
|
||||
@item -flv_full_metadata @var{bool}
|
||||
Output all context of the onMetadata.
|
||||
@end table
|
||||
|
||||
@section gif
|
||||
@@ -544,9 +538,6 @@ This demuxer accepts the following options:
|
||||
Set size limit for looking up a new synchronization. Default value is
|
||||
65536.
|
||||
|
||||
@item skip_unknown_pmt
|
||||
Skip PMTs for programs not defined in the PAT. Default value is 0.
|
||||
|
||||
@item fix_teletext_pts
|
||||
Override teletext packet PTS and DTS values with the timestamps calculated
|
||||
from the PCR of the first program which the teletext stream is part of and is
|
||||
@@ -561,10 +552,6 @@ Show the detected raw packet size, cannot be set by the user.
|
||||
Scan and combine all PMTs. The value is an integer with value from -1
|
||||
to 1 (-1 means automatic setting, 1 means enabled, 0 means
|
||||
disabled). Default value is -1.
|
||||
|
||||
@item merge_pmt_versions
|
||||
Re-use existing streams when a PMT's version is updated and elementary
|
||||
streams move to different PIDs. Default value is 0.
|
||||
@end table
|
||||
|
||||
@section mpjpeg
|
||||
|
||||
@@ -128,9 +128,6 @@ designated struct initializers (@samp{struct s x = @{ .i = 17 @};});
|
||||
@item
|
||||
compound literals (@samp{x = (struct s) @{ 17, 23 @};}).
|
||||
|
||||
@item
|
||||
for loops with variable definition (@samp{for (int i = 0; i < 8; i++)});
|
||||
|
||||
@item
|
||||
Implementation defined behavior for signed integers is assumed to match the
|
||||
expected behavior for two's complement. Non representable values in integer
|
||||
|
||||
+7
-118
@@ -2565,9 +2565,6 @@ The following standard libavcodec options are used:
|
||||
@option{bf} / @option{max_b_frames}
|
||||
@item
|
||||
@option{profile}
|
||||
|
||||
If not set, this will be determined automatically from the format of the input
|
||||
frames and the profiles supported by the driver.
|
||||
@item
|
||||
@option{level}
|
||||
@item
|
||||
@@ -2588,8 +2585,7 @@ Speed / quality tradeoff: higher values are faster / worse quality.
|
||||
Size / quality tradeoff: higher values are smaller / worse quality.
|
||||
@item
|
||||
@option{qmin}
|
||||
@item
|
||||
@option{qmax}
|
||||
(only: @option{qmax} is not supported)
|
||||
@item
|
||||
@option{i_qfactor} / @option{i_quant_factor}
|
||||
@item
|
||||
@@ -2598,22 +2594,8 @@ Size / quality tradeoff: higher values are smaller / worse quality.
|
||||
@option{b_qfactor} / @option{b_quant_factor}
|
||||
@item
|
||||
@option{b_qoffset} / @option{b_quant_offset}
|
||||
@item
|
||||
@option{slices}
|
||||
@end itemize
|
||||
|
||||
All encoders support the following options:
|
||||
@itemize
|
||||
@item
|
||||
@option{low_power}
|
||||
|
||||
Some drivers/platforms offer a second encoder for some codecs intended to use
|
||||
less power than the default encoder; setting this option will attempt to use
|
||||
that encoder. Note that it may support a reduced feature set, so some other
|
||||
options may not be available in this mode.
|
||||
@end itemize
|
||||
|
||||
Each encoder also has its own specific options:
|
||||
@table @option
|
||||
|
||||
@item h264_vaapi
|
||||
@@ -2621,6 +2603,8 @@ Each encoder also has its own specific options:
|
||||
@option{level} sets the value of @emph{level_idc}.
|
||||
|
||||
@table @option
|
||||
@item low_power
|
||||
Use low-power encoding mode.
|
||||
@item coder
|
||||
Set entropy encoder (default is @emph{cabac}). Possible values:
|
||||
|
||||
@@ -2633,70 +2617,21 @@ Use CABAC.
|
||||
@item cavlc
|
||||
Use CAVLC.
|
||||
@end table
|
||||
|
||||
@item aud
|
||||
Include access unit delimiters in the stream (not included by default).
|
||||
|
||||
@item sei
|
||||
Set SEI message types to include.
|
||||
Some combination of the following values:
|
||||
@table @samp
|
||||
@item identifier
|
||||
Include a @emph{user_data_unregistered} message containing information about
|
||||
the encoder.
|
||||
@item timing
|
||||
Include picture timing parameters (@emph{buffering_period} and
|
||||
@emph{pic_timing} messages).
|
||||
@item recovery_point
|
||||
Include recovery points where appropriate (@emph{recovery_point} messages).
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@item hevc_vaapi
|
||||
@option{profile} and @option{level} set the values of
|
||||
@emph{general_profile_idc} and @emph{general_level_idc} respectively.
|
||||
|
||||
@table @option
|
||||
@item aud
|
||||
Include access unit delimiters in the stream (not included by default).
|
||||
|
||||
@item tier
|
||||
Set @emph{general_tier_flag}. This may affect the level chosen for the stream
|
||||
if it is not explicitly specified.
|
||||
|
||||
@item sei
|
||||
Set SEI message types to include.
|
||||
Some combination of the following values:
|
||||
@table @samp
|
||||
@item hdr
|
||||
Include HDR metadata if the input frames have it
|
||||
(@emph{mastering_display_colour_volume} and @emph{content_light_level}
|
||||
messages).
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@item mjpeg_vaapi
|
||||
Only baseline DCT encoding is supported. The encoder always uses the standard
|
||||
quantisation and huffman tables - @option{global_quality} scales the standard
|
||||
quantisation table (range 1-100).
|
||||
|
||||
For YUV, 4:2:0, 4:2:2 and 4:4:4 subsampling modes are supported. RGB is also
|
||||
supported, and will create an RGB JPEG.
|
||||
|
||||
@table @option
|
||||
@item jfif
|
||||
Include JFIF header in each frame (not included by default).
|
||||
@item huffman
|
||||
Include standard huffman tables (on by default). Turning this off will save
|
||||
a few hundred bytes in each output frame, but may lose compatibility with some
|
||||
JPEG decoders which don't fully handle MJPEG.
|
||||
@end table
|
||||
Always encodes using the standard quantisation and huffman tables -
|
||||
@option{global_quality} scales the standard quantisation table (range 1-100).
|
||||
|
||||
@item mpeg2_vaapi
|
||||
@option{profile} and @option{level} set the value of @emph{profile_and_level_indication}.
|
||||
|
||||
No rate control is supported.
|
||||
|
||||
@item vp8_vaapi
|
||||
B-frames are not supported.
|
||||
|
||||
@@ -2791,52 +2726,6 @@ Reduces detail but attempts to preserve color at extremely low bitrates.
|
||||
|
||||
@end table
|
||||
|
||||
@section libxavs2
|
||||
|
||||
xavs2 AVS2-P2/IEEE1857.4 encoder wrapper.
|
||||
|
||||
This encoder requires the presence of the libxavs2 headers and library
|
||||
during configuration. You need to explicitly configure the build with
|
||||
@option{--enable-libxavs2}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item lcu_row_threads
|
||||
Set the number of parallel threads for rows from 1 to 8 (default 5).
|
||||
|
||||
@item initial_qp
|
||||
Set the xavs2 quantization parameter from 1 to 63 (default 34). This is
|
||||
used to set the initial qp for the first frame.
|
||||
|
||||
@item qp
|
||||
Set the xavs2 quantization parameter from 1 to 63 (default 34). This is
|
||||
used to set the qp value under constant-QP mode.
|
||||
|
||||
@item max_qp
|
||||
Set the max qp for rate control from 1 to 63 (default 55).
|
||||
|
||||
@item min_qp
|
||||
Set the min qp for rate control from 1 to 63 (default 20).
|
||||
|
||||
@item speed_level
|
||||
Set the Speed level from 0 to 9 (default 0). Higher is better but slower.
|
||||
|
||||
@item log_level
|
||||
Set the log level from -1 to 3 (default 0). -1: none, 0: error,
|
||||
1: warning, 2: info, 3: debug.
|
||||
|
||||
@item xavs2-params
|
||||
Set xavs2 options using a list of @var{key}=@var{value} couples separated
|
||||
by ":".
|
||||
|
||||
For example to specify libxavs2 encoding options with @option{-xavs2-params}:
|
||||
|
||||
@example
|
||||
ffmpeg -i input -c:v libxavs2 -xavs2-params preset_level=5 output.avs2
|
||||
@end example
|
||||
@end table
|
||||
|
||||
@c man end VIDEO ENCODERS
|
||||
|
||||
@chapter Subtitles Encoders
|
||||
|
||||
@@ -20,5 +20,3 @@
|
||||
/scaling_video
|
||||
/transcode_aac
|
||||
/transcoding
|
||||
/vaapi_encode
|
||||
/vaapi_transcode
|
||||
|
||||
@@ -74,6 +74,7 @@ static int open_input_file(const char *filename)
|
||||
if (!dec_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
avcodec_parameters_to_context(dec_ctx, fmt_ctx->streams[audio_stream_index]->codecpar);
|
||||
av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
|
||||
|
||||
/* init the audio decoder */
|
||||
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
|
||||
#define _XOPEN_SOURCE 600 /* for usleep */
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
@@ -79,6 +77,7 @@ static int open_input_file(const char *filename)
|
||||
if (!dec_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
avcodec_parameters_to_context(dec_ctx, fmt_ctx->streams[video_stream_index]->codecpar);
|
||||
av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
|
||||
|
||||
/* init the video decoder */
|
||||
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
|
||||
@@ -211,20 +210,17 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
AVPacket packet;
|
||||
AVFrame *frame;
|
||||
AVFrame *filt_frame;
|
||||
AVFrame *frame = av_frame_alloc();
|
||||
AVFrame *filt_frame = av_frame_alloc();
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s file\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
frame = av_frame_alloc();
|
||||
filt_frame = av_frame_alloc();
|
||||
if (!frame || !filt_frame) {
|
||||
perror("Could not allocate frame");
|
||||
exit(1);
|
||||
}
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s file\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((ret = open_input_file(argv[1])) < 0)
|
||||
goto end;
|
||||
@@ -252,25 +248,27 @@ int main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
frame->pts = frame->best_effort_timestamp;
|
||||
if (ret >= 0) {
|
||||
frame->pts = frame->best_effort_timestamp;
|
||||
|
||||
/* push the decoded frame into the filtergraph */
|
||||
if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* pull filtered frames from the filtergraph */
|
||||
while (1) {
|
||||
ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
||||
/* push the decoded frame into the filtergraph */
|
||||
if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
|
||||
break;
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base);
|
||||
av_frame_unref(filt_frame);
|
||||
}
|
||||
|
||||
/* pull filtered frames from the filtergraph */
|
||||
while (1) {
|
||||
ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
||||
break;
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base);
|
||||
av_frame_unref(filt_frame);
|
||||
}
|
||||
av_frame_unref(frame);
|
||||
}
|
||||
av_frame_unref(frame);
|
||||
}
|
||||
}
|
||||
av_packet_unref(&packet);
|
||||
|
||||
+14
-15
@@ -4,23 +4,21 @@
|
||||
*
|
||||
* HW Acceleration API (video decoding) decode sample
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* 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.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -213,6 +211,7 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
|
||||
decoder_ctx->get_format = get_hw_format;
|
||||
av_opt_set_int(decoder_ctx, "refcounted_frames", 1, 0);
|
||||
|
||||
if (hw_decoder_init(decoder_ctx, type) < 0)
|
||||
return -1;
|
||||
|
||||
+13
-15
@@ -1,23 +1,21 @@
|
||||
/*
|
||||
* Video Acceleration API (video encoding) encode sample
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* 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.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
/*
|
||||
* Video Acceleration API (video transcoding) transcode sample
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* 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.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -155,8 +155,6 @@ space on each client, network bandwidth and so on benefit from smaller test case
|
||||
Also keep in mind older checkouts use existing sample files, that means in
|
||||
practice generally do not replace, remove or overwrite files as it likely would
|
||||
break older checkouts or releases.
|
||||
Also all needed samples for a commit should be uploaded, ideally 24
|
||||
hours, before the push.
|
||||
|
||||
@example
|
||||
#First update your local samples copy:
|
||||
@@ -224,11 +222,6 @@ Set to @samp{1} to generate the missing or mismatched references.
|
||||
Specify which hardware acceleration to use while running regression tests,
|
||||
by default @samp{none} is used.
|
||||
|
||||
@item KEEP
|
||||
Set to @samp{1} to keep temp files generated by fate test(s) when test is successful.
|
||||
Default is @samp{0}, which removes these files. Files are always kept when a test
|
||||
fails.
|
||||
|
||||
@end table
|
||||
|
||||
@section Examples
|
||||
|
||||
+16
-215
@@ -216,208 +216,16 @@ filters is obviously also impossible, since filters work on uncompressed data.
|
||||
@chapter Stream selection
|
||||
@c man begin STREAM SELECTION
|
||||
|
||||
@command{ffmpeg} provides the @code{-map} option for manual control of stream selection in each
|
||||
output file. Users can skip @code{-map} and let ffmpeg perform automatic stream selection as
|
||||
described below. The @code{-vn / -an / -sn / -dn} options can be used to skip inclusion of
|
||||
video, audio, subtitle and data streams respectively, whether manually mapped or automatically
|
||||
selected, except for those streams which are outputs of complex filtergraphs.
|
||||
By default, @command{ffmpeg} includes only one stream of each type (video, audio, subtitle)
|
||||
present in the input files and adds them to each output file. It picks the
|
||||
"best" of each based upon the following criteria: for video, it is the stream
|
||||
with the highest resolution, for audio, it is the stream with the most channels, for
|
||||
subtitles, it is the first subtitle stream. In the case where several streams of
|
||||
the same type rate equally, the stream with the lowest index is chosen.
|
||||
|
||||
@section Description
|
||||
The sub-sections that follow describe the various rules that are involved in stream selection.
|
||||
The examples that follow next show how these rules are applied in practice.
|
||||
|
||||
While every effort is made to accurately reflect the behavior of the program, FFmpeg is under
|
||||
continuous development and the code may have changed since the time of this writing.
|
||||
|
||||
@subsection Automatic stream selection
|
||||
|
||||
In the absence of any map options for a particular output file, ffmpeg inspects the output
|
||||
format to check which type of streams can be included in it, viz. video, audio and/or
|
||||
subtitles. For each acceptable stream type, ffmpeg will pick one stream, when available,
|
||||
from among all the inputs.
|
||||
|
||||
It will select that stream based upon the following criteria:
|
||||
@itemize
|
||||
@item
|
||||
for video, it is the stream with the highest resolution,
|
||||
@item
|
||||
for audio, it is the stream with the most channels,
|
||||
@item
|
||||
for subtitles, it is the first subtitle stream found but there's a caveat.
|
||||
The output format's default subtitle encoder can be either text-based or image-based,
|
||||
and only a subtitle stream of the same type will be chosen.
|
||||
@end itemize
|
||||
|
||||
In the case where several streams of the same type rate equally, the stream with the lowest
|
||||
index is chosen.
|
||||
|
||||
Data or attachment streams are not automatically selected and can only be included
|
||||
using @code{-map}.
|
||||
@subsection Manual stream selection
|
||||
|
||||
When @code{-map} is used, only user-mapped streams are included in that output file,
|
||||
with one possible exception for filtergraph outputs described below.
|
||||
|
||||
@subsection Complex filtergraphs
|
||||
|
||||
If there are any complex filtergraph output streams with unlabeled pads, they will be added
|
||||
to the first output file. This will lead to a fatal error if the stream type is not supported
|
||||
by the output format. In the absence of the map option, the inclusion of these streams leads
|
||||
to the automatic stream selection of their types being skipped. If map options are present,
|
||||
these filtergraph streams are included in addition to the mapped streams.
|
||||
|
||||
Complex filtergraph output streams with labeled pads must be mapped once and exactly once.
|
||||
|
||||
@subsection Stream handling
|
||||
|
||||
Stream handling is independent of stream selection, with an exception for subtitles described
|
||||
below. Stream handling is set via the @code{-codec} option addressed to streams within a
|
||||
specific @emph{output} file. In particular, codec options are applied by ffmpeg after the
|
||||
stream selection process and thus do not influence the latter. If no @code{-codec} option is
|
||||
specified for a stream type, ffmpeg will select the default encoder registered by the output
|
||||
file muxer.
|
||||
|
||||
An exception exists for subtitles. If a subtitle encoder is specified for an output file, the
|
||||
first subtitle stream found of any type, text or image, will be included. ffmpeg does not validate
|
||||
if the specified encoder can convert the selected stream or if the converted stream is acceptable
|
||||
within the output format. This applies generally as well: when the user sets an encoder manually,
|
||||
the stream selection process cannot check if the encoded stream can be muxed into the output file.
|
||||
If it cannot, ffmpeg will abort and @emph{all} output files will fail to be processed.
|
||||
|
||||
@section Examples
|
||||
|
||||
The following examples illustrate the behavior, quirks and limitations of ffmpeg's stream
|
||||
selection methods.
|
||||
|
||||
They assume the following three input files.
|
||||
|
||||
@verbatim
|
||||
|
||||
input file 'A.avi'
|
||||
stream 0: video 640x360
|
||||
stream 1: audio 2 channels
|
||||
|
||||
input file 'B.mp4'
|
||||
stream 0: video 1920x1080
|
||||
stream 1: audio 2 channels
|
||||
stream 2: subtitles (text)
|
||||
stream 3: audio 5.1 channels
|
||||
stream 4: subtitles (text)
|
||||
|
||||
input file 'C.mkv'
|
||||
stream 0: video 1280x720
|
||||
stream 1: audio 2 channels
|
||||
stream 2: subtitles (image)
|
||||
@end verbatim
|
||||
|
||||
@subsubheading Example: automatic stream selection
|
||||
@example
|
||||
ffmpeg -i A.avi -i B.mp4 out1.mkv out2.wav -map 1:a -c:a copy out3.mov
|
||||
@end example
|
||||
There are three output files specified, and for the first two, no @code{-map} options
|
||||
are set, so ffmpeg will select streams for these two files automatically.
|
||||
|
||||
@file{out1.mkv} is a Matroska container file and accepts video, audio and subtitle streams,
|
||||
so ffmpeg will try to select one of each type.@*
|
||||
For video, it will select @code{stream 0} from @file{B.mp4}, which has the highest
|
||||
resolution among all the input video streams.@*
|
||||
For audio, it will select @code{stream 3} from @file{B.mp4}, since it has the greatest
|
||||
number of channels.@*
|
||||
For subtitles, it will select @code{stream 2} from @file{B.mp4}, which is the first subtitle
|
||||
stream from among @file{A.avi} and @file{B.mp4}.
|
||||
|
||||
@file{out2.wav} accepts only audio streams, so only @code{stream 3} from @file{B.mp4} is
|
||||
selected.
|
||||
|
||||
For @file{out3.mov}, since a @code{-map} option is set, no automatic stream selection will
|
||||
occur. The @code{-map 1:a} option will select all audio streams from the second input
|
||||
@file{B.mp4}. No other streams will be included in this output file.
|
||||
|
||||
For the first two outputs, all included streams will be transcoded. The encoders chosen will
|
||||
be the default ones registered by each output format, which may not match the codec of the
|
||||
selected input streams.
|
||||
|
||||
For the third output, codec option for audio streams has been set
|
||||
to @code{copy}, so no decoding-filtering-encoding operations will occur, or @emph{can} occur.
|
||||
Packets of selected streams shall be conveyed from the input file and muxed within the output
|
||||
file.
|
||||
|
||||
@subsubheading Example: automatic subtitles selection
|
||||
@example
|
||||
ffmpeg -i C.mkv out1.mkv -c:s dvdsub -an out2.mkv
|
||||
@end example
|
||||
Although @file{out1.mkv} is a Matroska container file which accepts subtitle streams, only a
|
||||
video and audio stream shall be selected. The subtitle stream of @file{C.mkv} is image-based
|
||||
and the default subtitle encoder of the Matroska muxer is text-based, so a transcode operation
|
||||
for the subtitles is expected to fail and hence the stream isn't selected. However, in
|
||||
@file{out2.mkv}, a subtitle encoder is specified in the command and so, the subtitle stream is
|
||||
selected, in addition to the video stream. The presence of @code{-an} disables audio stream
|
||||
selection for @file{out2.mkv}.
|
||||
|
||||
@subsubheading Example: unlabeled filtergraph outputs
|
||||
@example
|
||||
ffmpeg -i A.avi -i C.mkv -i B.mp4 -filter_complex "overlay" out1.mp4 out2.srt
|
||||
@end example
|
||||
A filtergraph is setup here using the @code{-filter_complex} option and consists of a single
|
||||
video filter. The @code{overlay} filter requires exactly two video inputs, but none are
|
||||
specified, so the first two available video streams are used, those of @file{A.avi} and
|
||||
@file{C.mkv}. The output pad of the filter has no label and so is sent to the first output file
|
||||
@file{out1.mp4}. Due to this, automatic selection of the video stream is skipped, which would
|
||||
have selected the stream in @file{B.mp4}. The audio stream with most channels viz. @code{stream 3}
|
||||
in @file{B.mp4}, is chosen automatically. No subtitle stream is chosen however, since the MP4
|
||||
format has no default subtitle encoder registered, and the user hasn't specified a subtitle encoder.
|
||||
|
||||
The 2nd output file, @file{out2.srt}, only accepts text-based subtitle streams. So, even though
|
||||
the first subtitle stream available belongs to @file{C.mkv}, it is image-based and hence skipped.
|
||||
The selected stream, @code{stream 2} in @file{B.mp4}, is the first text-based subtitle stream.
|
||||
|
||||
@subsubheading Example: labeled filtergraph outputs
|
||||
@example
|
||||
ffmpeg -i A.avi -i B.mp4 -i C.mkv -filter_complex "[1:v]hue=s=0[outv];overlay;aresample" \
|
||||
-map '[outv]' -an out1.mp4 \
|
||||
out2.mkv \
|
||||
-map '[outv]' -map 1:a:0 out3.mkv
|
||||
@end example
|
||||
|
||||
The above command will fail, as the output pad labelled @code{[outv]} has been mapped twice.
|
||||
None of the output files shall be processed.
|
||||
|
||||
@example
|
||||
ffmpeg -i A.avi -i B.mp4 -i C.mkv -filter_complex "[1:v]hue=s=0[outv];overlay;aresample" \
|
||||
-an out1.mp4 \
|
||||
out2.mkv \
|
||||
-map 1:a:0 out3.mkv
|
||||
@end example
|
||||
|
||||
This command above will also fail as the hue filter output has a label, @code{[outv]},
|
||||
and hasn't been mapped anywhere.
|
||||
|
||||
The command should be modified as follows,
|
||||
@example
|
||||
ffmpeg -i A.avi -i B.mp4 -i C.mkv -filter_complex "[1:v]hue=s=0,split=2[outv1][outv2];overlay;aresample" \
|
||||
-map '[outv1]' -an out1.mp4 \
|
||||
out2.mkv \
|
||||
-map '[outv2]' -map 1:a:0 out3.mkv
|
||||
@end example
|
||||
The video stream from @file{B.mp4} is sent to the hue filter, whose output is cloned once using
|
||||
the split filter, and both outputs labelled. Then a copy each is mapped to the first and third
|
||||
output files.
|
||||
|
||||
The overlay filter, requiring two video inputs, uses the first two unused video streams. Those
|
||||
are the streams from @file{A.avi} and @file{C.mkv}. The overlay output isn't labelled, so it is
|
||||
sent to the first output file @file{out1.mp4}, regardless of the presence of the @code{-map} option.
|
||||
|
||||
The aresample filter is sent the first unused audio stream, that of @file{A.avi}. Since this filter
|
||||
output is also unlabelled, it too is mapped to the first output file. The presence of @code{-an}
|
||||
only suppresses automatic or manual stream selection of audio streams, not outputs sent from
|
||||
filtergraphs. Both these mapped streams shall be ordered before the mapped stream in @file{out1.mp4}.
|
||||
|
||||
The video, audio and subtitle streams mapped to @code{out2.mkv} are entirely determined by
|
||||
automatic stream selection.
|
||||
|
||||
@file{out3.mkv} consists of the cloned video output from the hue filter and the first audio
|
||||
stream from @file{B.mp4}.
|
||||
@*
|
||||
You can disable some of those defaults by using the @code{-vn/-an/-sn/-dn} options. For
|
||||
full manual control, use the @code{-map} option, which disables the defaults just
|
||||
described.
|
||||
|
||||
@c man end STREAM SELECTION
|
||||
|
||||
@@ -508,7 +316,7 @@ input until the timestamps reach @var{position}.
|
||||
@var{position} must be a time duration specification,
|
||||
see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
|
||||
|
||||
@item -sseof @var{position} (@emph{input})
|
||||
@item -sseof @var{position} (@emph{input/output})
|
||||
|
||||
Like the @code{-ss} option but relative to the "end of file". That is negative
|
||||
values are earlier in the file, 0 is at EOF.
|
||||
@@ -567,31 +375,22 @@ The following dispositions are recognized:
|
||||
@item hearing_impaired
|
||||
@item visual_impaired
|
||||
@item clean_effects
|
||||
@item attached_pic
|
||||
@item captions
|
||||
@item descriptions
|
||||
@item dependent
|
||||
@item metadata
|
||||
@end table
|
||||
|
||||
For example, to make the second audio stream the default stream:
|
||||
@example
|
||||
ffmpeg -i in.mkv -c copy -disposition:a:1 default out.mkv
|
||||
ffmpeg -i in.mkv -disposition:a:1 default out.mkv
|
||||
@end example
|
||||
|
||||
To make the second subtitle stream the default stream and remove the default
|
||||
disposition from the first subtitle stream:
|
||||
@example
|
||||
ffmpeg -i in.mkv -c copy -disposition:s:0 0 -disposition:s:1 default out.mkv
|
||||
ffmpeg -i INPUT -disposition:s:0 0 -disposition:s:1 default OUTPUT
|
||||
@end example
|
||||
|
||||
To add an embedded cover/thumbnail:
|
||||
@example
|
||||
ffmpeg -i in.mp4 -i IMAGE -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mp4
|
||||
@end example
|
||||
|
||||
Not all muxers support embedded thumbnails, and those who do, only support a few formats, like JPEG or PNG.
|
||||
|
||||
@item -program [title=@var{title}:][program_num=@var{program_num}:]st=@var{stream}[:st=@var{stream}...] (@emph{output})
|
||||
|
||||
Creates a program with the specified @var{title}, @var{program_num} and adds the specified
|
||||
@@ -824,6 +623,8 @@ as the input (or graph output) and automatic conversions are disabled.
|
||||
|
||||
@item -sws_flags @var{flags} (@emph{input/output})
|
||||
Set SwScaler flags.
|
||||
@item -vdt @var{n}
|
||||
Discard threshold.
|
||||
|
||||
@item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream})
|
||||
Rate control override for specific intervals, formatted as "int,int,int"
|
||||
@@ -1353,12 +1154,12 @@ disable any chapter copying.
|
||||
|
||||
@item -benchmark (@emph{global})
|
||||
Show benchmarking information at the end of an encode.
|
||||
Shows real, system and user time used and maximum memory consumption.
|
||||
Shows CPU time used and maximum memory consumption.
|
||||
Maximum memory consumption is not supported on all systems,
|
||||
it will usually display as 0 if not supported.
|
||||
@item -benchmark_all (@emph{global})
|
||||
Show benchmarking information during the encode.
|
||||
Shows real, system and user time used in various steps (audio/video encode/decode).
|
||||
Shows CPU time used in various steps (audio/video encode/decode).
|
||||
@item -timelimit @var{duration} (@emph{global})
|
||||
Exit after ffmpeg has been running for @var{duration} seconds.
|
||||
@item -dump (@emph{global})
|
||||
|
||||
@@ -60,8 +60,6 @@ Play @var{duration} seconds of audio/video.
|
||||
see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
|
||||
@item -bytes
|
||||
Seek by bytes.
|
||||
@item -seek_interval
|
||||
Set custom interval, in seconds, for seeking using left/right keys. Default is 10 seconds.
|
||||
@item -nodisp
|
||||
Disable graphical display.
|
||||
@item -noborder
|
||||
@@ -74,10 +72,6 @@ as 100.
|
||||
Force format.
|
||||
@item -window_title @var{title}
|
||||
Set window title (default is the input filename).
|
||||
@item -left @var{title}
|
||||
Set the x position for the left of the window (default is a centered window).
|
||||
@item -top @var{title}
|
||||
Set the y position for the top of the window (default is a centered window).
|
||||
@item -loop @var{number}
|
||||
Loops movie playback <number> times. 0 means forever.
|
||||
@item -showmode @var{mode}
|
||||
|
||||
+1
-1
@@ -584,7 +584,7 @@ value is 0.
|
||||
This is required for generating an XML file which can be validated
|
||||
through an XSD file.
|
||||
|
||||
@item xsd_strict, x
|
||||
@item xsd_compliant, x
|
||||
If set to 1 perform more checks for ensuring that the output is XSD
|
||||
compliant. Default value is 0.
|
||||
This option automatically sets @option{fully_qualified} to 1.
|
||||
|
||||
+48
-1442
File diff suppressed because it is too large
Load Diff
+18
-28
@@ -30,43 +30,37 @@ latency. Must be an integer not lesser than 32. It is 5000000 by default.
|
||||
@item packetsize @var{integer} (@emph{output})
|
||||
Set packet size.
|
||||
|
||||
@item fflags @var{flags}
|
||||
Set format flags. Some are implemented for a limited number of formats.
|
||||
@item fflags @var{flags} (@emph{input/output})
|
||||
Set format flags.
|
||||
|
||||
Possible values for input files:
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item discardcorrupt
|
||||
Discard corrupted packets.
|
||||
@item ignidx
|
||||
Ignore index.
|
||||
@item fastseek
|
||||
Enable fast, but inaccurate seeks for some formats.
|
||||
@item genpts
|
||||
Generate missing PTS if DTS is present.
|
||||
@item igndts
|
||||
Ignore DTS if PTS is set. Inert when nofillin is set.
|
||||
@item ignidx
|
||||
Ignore index.
|
||||
@item keepside (@emph{deprecated},@emph{inert})
|
||||
@item nobuffer
|
||||
Reduce the latency introduced by buffering during initial input streams analysis.
|
||||
Generate PTS.
|
||||
@item nofillin
|
||||
Do not fill in missing values in packet fields that can be exactly calculated.
|
||||
Do not fill in missing values that can be exactly calculated.
|
||||
@item noparse
|
||||
Disable AVParsers, this needs @code{+nofillin} too.
|
||||
@item igndts
|
||||
Ignore DTS.
|
||||
@item discardcorrupt
|
||||
Discard corrupted frames.
|
||||
@item sortdts
|
||||
Try to interleave output packets by DTS. At present, available only for AVIs with an index.
|
||||
@end table
|
||||
|
||||
Possible values for output files:
|
||||
@table @samp
|
||||
@item autobsf
|
||||
Automatically apply bitstream filters as required by the output format. Enabled by default.
|
||||
Try to interleave output packets by DTS.
|
||||
@item keepside
|
||||
Do not merge side data.
|
||||
@item latm
|
||||
Enable RTP MP4A-LATM payload.
|
||||
@item nobuffer
|
||||
Reduce the latency introduced by optional buffering
|
||||
@item bitexact
|
||||
Only write platform-, build- and time-independent data.
|
||||
This ensures that file and data checksums are reproducible and match between
|
||||
platforms. Its primary use is for regression testing.
|
||||
@item flush_packets
|
||||
Write out packets immediately.
|
||||
@item latm (@emph{deprecated},@emph{inert})
|
||||
@item shortest
|
||||
Stop muxing at the end of the shortest stream.
|
||||
It may be needed to increase max_interleave_delta to avoid flushing the longer
|
||||
@@ -220,10 +214,6 @@ ffprobe -dump_separator "
|
||||
@item max_streams @var{integer} (@emph{input})
|
||||
Specifies the maximum number of streams. This can be used to reject files that
|
||||
would require too many resources due to a large number of streams.
|
||||
|
||||
@item skip_estimate_duration_from_pts @var{bool} (@emph{input})
|
||||
Skip estimation of input duration when calculated using PTS.
|
||||
At present, applicable for MPEG-PS and MPEG-TS.
|
||||
@end table
|
||||
|
||||
@c man end FORMAT OPTIONS
|
||||
|
||||
+4
-39
@@ -17,34 +17,6 @@ for more formats. None of them are used by default, their use has to be
|
||||
explicitly requested by passing the appropriate flags to
|
||||
@command{./configure}.
|
||||
|
||||
@section libxavs2
|
||||
|
||||
FFmpeg can make use of the xavs2 library for AVS2-P2/IEEE1857.4 video encoding.
|
||||
|
||||
Go to @url{https://github.com/pkuvcl/xavs2} and follow the instructions for
|
||||
installing the library. Then pass @code{--enable-libxavs2} to configure to
|
||||
enable it.
|
||||
|
||||
@float NOTE
|
||||
libxavs2 is under the GNU Public License Version 2 or later
|
||||
(see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for
|
||||
details), you must upgrade FFmpeg's license to GPL in order to use it.
|
||||
@end float
|
||||
|
||||
@section libdavs2
|
||||
|
||||
FFmpeg can make use of the davs2 library for AVS2-P2/IEEE1857.4 video decoding.
|
||||
|
||||
Go to @url{https://github.com/pkuvcl/davs2} and follow the instructions for
|
||||
installing the library. Then pass @code{--enable-libdavs2} to configure to
|
||||
enable it.
|
||||
|
||||
@float NOTE
|
||||
libdavs2 is under the GNU Public License Version 2 or later
|
||||
(see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for
|
||||
details), you must upgrade FFmpeg's license to GPL in order to use it.
|
||||
@end float
|
||||
|
||||
@section Alliance for Open Media libaom
|
||||
|
||||
FFmpeg can make use of the libaom library for AV1 decoding.
|
||||
@@ -74,10 +46,9 @@ upgrade FFmpeg's license to LGPL version 3 (or if you have enabled
|
||||
GPL components, GPL version 3) by passing @code{--enable-version3} to configure in
|
||||
order to use it.
|
||||
|
||||
The license of the Fraunhofer AAC library is incompatible with the GPL.
|
||||
Therefore, for GPL builds, you have to pass @code{--enable-nonfree} to
|
||||
configure in order to use it. To the best of our knowledge, it is
|
||||
compatible with the LGPL.
|
||||
The Fraunhofer AAC library is licensed under a license incompatible to the GPL
|
||||
and is not known to be compatible to the LGPL. Therefore, you have to pass
|
||||
@code{--enable-nonfree} to configure to use it.
|
||||
@end float
|
||||
|
||||
@subsection OpenCORE AMR
|
||||
@@ -100,7 +71,7 @@ Then pass @code{--enable-libvo-amrwbenc} to configure to enable it.
|
||||
|
||||
@subsection Fraunhofer AAC library
|
||||
|
||||
FFmpeg can make use of the Fraunhofer AAC library for AAC decoding & encoding.
|
||||
FFmpeg can make use of the Fraunhofer AAC library for AAC encoding.
|
||||
|
||||
Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the
|
||||
instructions for installing the library.
|
||||
@@ -545,7 +516,6 @@ library:
|
||||
@item raw VC-1 @tab X @tab X
|
||||
@item raw PCM A-law @tab X @tab X
|
||||
@item raw PCM mu-law @tab X @tab X
|
||||
@item raw PCM Archimedes VIDC @tab X @tab X
|
||||
@item raw PCM signed 8 bit @tab X @tab X
|
||||
@item raw PCM signed 16 bit big-endian @tab X @tab X
|
||||
@item raw PCM signed 16 bit little-endian @tab X @tab X
|
||||
@@ -589,7 +559,6 @@ library:
|
||||
@item SAP @tab X @tab X
|
||||
@item SBG @tab @tab X
|
||||
@item SDP @tab @tab X
|
||||
@item SER @tab @tab X
|
||||
@item Sega FILM/CPK @tab X @tab X
|
||||
@tab Used in many Sega Saturn console games.
|
||||
@item Silicon Graphics Movie @tab @tab X
|
||||
@@ -833,7 +802,6 @@ following image formats are supported:
|
||||
@tab fourcc: G2M2, G2M3
|
||||
@item Go2Webinar @tab @tab X
|
||||
@tab fourcc: G2M4
|
||||
@item Gremlin Digital Video @tab @tab X
|
||||
@item H.261 @tab X @tab X
|
||||
@item H.263 / H.263-1996 @tab X @tab X
|
||||
@item H.263+ / H.263-1998 / H.263 version 2 @tab X @tab X
|
||||
@@ -854,7 +822,6 @@ following image formats are supported:
|
||||
@tab IFF interleaved bitmap
|
||||
@item IFF ByteRun1 @tab @tab X
|
||||
@tab IFF run length encoded bitmap
|
||||
@item Infinity IMM4 @tab @tab X
|
||||
@item Intel H.263 @tab @tab X
|
||||
@item Intel Indeo 2 @tab @tab X
|
||||
@item Intel Indeo 3 @tab @tab X
|
||||
@@ -1081,7 +1048,6 @@ following image formats are supported:
|
||||
@item ATRAC1 @tab @tab X
|
||||
@item ATRAC3 @tab @tab X
|
||||
@item ATRAC3+ @tab @tab X
|
||||
@item ATRAC9 @tab @tab X
|
||||
@item Bink Audio @tab @tab X
|
||||
@tab Used in Bink and Smacker files in many games.
|
||||
@item CELT @tab @tab E
|
||||
@@ -1148,7 +1114,6 @@ following image formats are supported:
|
||||
@tab encoding supported through external library libopus
|
||||
@item PCM A-law @tab X @tab X
|
||||
@item PCM mu-law @tab X @tab X
|
||||
@item PCM Archimedes VIDC @tab X @tab X
|
||||
@item PCM signed 8-bit planar @tab X @tab X
|
||||
@item PCM signed 16-bit big-endian planar @tab X @tab X
|
||||
@item PCM signed 16-bit little-endian planar @tab X @tab X
|
||||
|
||||
+2
-22
@@ -53,7 +53,7 @@ Most distribution and operating system provide a package for it.
|
||||
@section Cloning the source tree
|
||||
|
||||
@example
|
||||
git clone https://git.ffmpeg.org/ffmpeg.git <target>
|
||||
git clone git://source.ffmpeg.org/ffmpeg <target>
|
||||
@end example
|
||||
|
||||
This will put the FFmpeg sources into the directory @var{<target>}.
|
||||
@@ -187,18 +187,11 @@ to make sure you don't have untracked files or deletions.
|
||||
git add [-i|-p|-A] <filenames/dirnames>
|
||||
@end example
|
||||
|
||||
Make sure you have told Git your name, email address and GPG key
|
||||
Make sure you have told Git your name and email address
|
||||
|
||||
@example
|
||||
git config --global user.name "My Name"
|
||||
git config --global user.email my@@email.invalid
|
||||
git config --global user.signingkey ABCDEF0123245
|
||||
@end example
|
||||
|
||||
Enable signing all commits or use -S
|
||||
|
||||
@example
|
||||
git config --global commit.gpgsign true
|
||||
@end example
|
||||
|
||||
Use @option{--global} to set the global configuration for all your Git checkouts.
|
||||
@@ -400,19 +393,6 @@ git checkout -b svn_23456 $SHA1
|
||||
where @var{$SHA1} is the commit hash from the @command{git log} output.
|
||||
|
||||
|
||||
@chapter gpg key generation
|
||||
|
||||
If you have no gpg key yet, we recommend that you create a ed25519 based key as it
|
||||
is small, fast and secure. Especially it results in small signatures in git.
|
||||
|
||||
@example
|
||||
gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key "human@@server.com"
|
||||
@end example
|
||||
|
||||
When generating a key, make sure the email specified matches the email used in git as some sites like
|
||||
github consider mismatches a reason to declare such commits unverified. After generating a key you
|
||||
can add it to the MAINTAINER file and upload it to a keyserver.
|
||||
|
||||
@chapter Pre-push checklist
|
||||
|
||||
Once you have a set of commits that you feel are ready for pushing,
|
||||
|
||||
+112
-149
@@ -267,8 +267,7 @@ audio track.
|
||||
|
||||
@item list_devices
|
||||
If set to @option{true}, print a list of devices and exit.
|
||||
Defaults to @option{false}. Alternatively you can use the @code{-sources}
|
||||
option of ffmpeg to list the available input devices.
|
||||
Defaults to @option{false}.
|
||||
|
||||
@item list_formats
|
||||
If set to @option{true}, print a list of supported formats and exit.
|
||||
@@ -327,12 +326,6 @@ Defaults to @samp{2}.
|
||||
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}.
|
||||
Defaults to @samp{unset}.
|
||||
|
||||
@item timecode_format
|
||||
Timecode type to include in the frame and video stream metadata. Must be
|
||||
@samp{none}, @samp{rp188vitc}, @samp{rp188vitc2}, @samp{rp188ltc},
|
||||
@samp{rp188any}, @samp{vitc}, @samp{vitc2}, or @samp{serial}. Defaults to
|
||||
@samp{none} (not included).
|
||||
|
||||
@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}.
|
||||
@@ -371,20 +364,6 @@ If set to @option{true}, timestamps are forwarded as they are without removing
|
||||
the initial offset.
|
||||
Defaults to @option{false}.
|
||||
|
||||
@item timestamp_align
|
||||
Capture start time alignment in seconds. If set to nonzero, input frames are
|
||||
dropped till the system timestamp aligns with configured value.
|
||||
Alignment difference of up to one frame duration is tolerated.
|
||||
This is useful for maintaining input synchronization across N different
|
||||
hardware devices deployed for 'N-way' redundancy. The system time of different
|
||||
hardware devices should be synchronized with protocols such as NTP or PTP,
|
||||
before using this option.
|
||||
Note that this method is not foolproof. In some border cases input
|
||||
synchronization may not happen due to thread scheduling jitters in the OS.
|
||||
Either sync could go wrong by 1 frame or in a rarer case
|
||||
@option{timestamp_align} seconds.
|
||||
Defaults to @samp{0}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@@ -423,6 +402,116 @@ ffmpeg -channels 16 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder'
|
||||
|
||||
@end itemize
|
||||
|
||||
@section kmsgrab
|
||||
|
||||
KMS video input device.
|
||||
|
||||
Captures the KMS scanout framebuffer associated with a specified CRTC or plane as a
|
||||
DRM object that can be passed to other hardware functions.
|
||||
|
||||
Requires either DRM master or CAP_SYS_ADMIN to run.
|
||||
|
||||
If you don't understand what all of that means, you probably don't want this. Look at
|
||||
@option{x11grab} instead.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item device
|
||||
DRM device to capture on. Defaults to @option{/dev/dri/card0}.
|
||||
|
||||
@item format
|
||||
Pixel format of the framebuffer. Defaults to @option{bgr0}.
|
||||
|
||||
@item format_modifier
|
||||
Format modifier to signal on output frames. This is necessary to import correctly into
|
||||
some APIs, but can't be autodetected. See the libdrm documentation for possible values.
|
||||
|
||||
@item crtc_id
|
||||
KMS CRTC ID to define the capture source. The first active plane on the given CRTC
|
||||
will be used.
|
||||
|
||||
@item plane_id
|
||||
KMS plane ID to define the capture source. Defaults to the first active plane found if
|
||||
neither @option{crtc_id} nor @option{plane_id} are specified.
|
||||
|
||||
@item framerate
|
||||
Framerate to capture at. This is not synchronised to any page flipping or framebuffer
|
||||
changes - it just defines the interval at which the framebuffer is sampled. Sampling
|
||||
faster than the framebuffer update rate will generate independent frames with the same
|
||||
content. Defaults to @code{30}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
|
||||
@item
|
||||
Capture from the first active plane, download the result to normal frames and encode.
|
||||
This will only work if the framebuffer is both linear and mappable - if not, the result
|
||||
may be scrambled or fail to download.
|
||||
@example
|
||||
ffmpeg -f kmsgrab -i - -vf 'hwdownload,format=bgr0' output.mp4
|
||||
@end example
|
||||
|
||||
@item
|
||||
Capture from CRTC ID 42 at 60fps, map the result to VAAPI, convert to NV12 and encode as H.264.
|
||||
@example
|
||||
ffmpeg -crtc_id 42 -framerate 60 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v h264_vaapi output.mp4
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
@section libndi_newtek
|
||||
|
||||
The libndi_newtek input device provides capture capabilities for using NDI (Network
|
||||
Device Interface, standard created by NewTek).
|
||||
|
||||
Input filename is a NDI source name that could be found by sending -find_sources 1
|
||||
to command line - it has no specific syntax but human-readable formatted.
|
||||
|
||||
To enable this input device, you need the NDI SDK and you
|
||||
need to configure with the appropriate @code{--extra-cflags}
|
||||
and @code{--extra-ldflags}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item find_sources
|
||||
If set to @option{true}, print a list of found/available NDI sources and exit.
|
||||
Defaults to @option{false}.
|
||||
|
||||
@item wait_sources
|
||||
Override time to wait until the number of online sources have changed.
|
||||
Defaults to @option{0.5}.
|
||||
|
||||
@item allow_video_fields
|
||||
When this flag is @option{false}, all video that you receive will be progressive.
|
||||
Defaults to @option{true}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
|
||||
@item
|
||||
List input devices:
|
||||
@example
|
||||
ffmpeg -f libndi_newtek -find_sources 1 -i dummy
|
||||
@end example
|
||||
|
||||
@item
|
||||
Restream to NDI:
|
||||
@example
|
||||
ffmpeg -f libndi_newtek -i "DEV-5.INTERNAL.M1STEREO.TV (NDI_SOURCE_NAME_1)" -f libndi_newtek -y NDI_SOURCE_NAME_2
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
@section dshow
|
||||
|
||||
Windows DirectShow input device.
|
||||
@@ -850,68 +939,6 @@ Set the number of channels. Default is 2.
|
||||
|
||||
@end table
|
||||
|
||||
@section kmsgrab
|
||||
|
||||
KMS video input device.
|
||||
|
||||
Captures the KMS scanout framebuffer associated with a specified CRTC or plane as a
|
||||
DRM object that can be passed to other hardware functions.
|
||||
|
||||
Requires either DRM master or CAP_SYS_ADMIN to run.
|
||||
|
||||
If you don't understand what all of that means, you probably don't want this. Look at
|
||||
@option{x11grab} instead.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item device
|
||||
DRM device to capture on. Defaults to @option{/dev/dri/card0}.
|
||||
|
||||
@item format
|
||||
Pixel format of the framebuffer. Defaults to @option{bgr0}.
|
||||
|
||||
@item format_modifier
|
||||
Format modifier to signal on output frames. This is necessary to import correctly into
|
||||
some APIs, but can't be autodetected. See the libdrm documentation for possible values.
|
||||
|
||||
@item crtc_id
|
||||
KMS CRTC ID to define the capture source. The first active plane on the given CRTC
|
||||
will be used.
|
||||
|
||||
@item plane_id
|
||||
KMS plane ID to define the capture source. Defaults to the first active plane found if
|
||||
neither @option{crtc_id} nor @option{plane_id} are specified.
|
||||
|
||||
@item framerate
|
||||
Framerate to capture at. This is not synchronised to any page flipping or framebuffer
|
||||
changes - it just defines the interval at which the framebuffer is sampled. Sampling
|
||||
faster than the framebuffer update rate will generate independent frames with the same
|
||||
content. Defaults to @code{30}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
|
||||
@item
|
||||
Capture from the first active plane, download the result to normal frames and encode.
|
||||
This will only work if the framebuffer is both linear and mappable - if not, the result
|
||||
may be scrambled or fail to download.
|
||||
@example
|
||||
ffmpeg -f kmsgrab -i - -vf 'hwdownload,format=bgr0' output.mp4
|
||||
@end example
|
||||
|
||||
@item
|
||||
Capture from CRTC ID 42 at 60fps, map the result to VAAPI, convert to NV12 and encode as H.264.
|
||||
@example
|
||||
ffmpeg -crtc_id 42 -framerate 60 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v h264_vaapi output.mp4
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
@section lavfi
|
||||
|
||||
Libavfilter input virtual device.
|
||||
@@ -1050,71 +1077,6 @@ IIDC1394 input device, based on libdc1394 and libraw1394.
|
||||
|
||||
Requires the configure option @code{--enable-libdc1394}.
|
||||
|
||||
@section libndi_newtek
|
||||
|
||||
The libndi_newtek input device provides capture capabilities for using NDI (Network
|
||||
Device Interface, standard created by NewTek).
|
||||
|
||||
Input filename is a NDI source name that could be found by sending -find_sources 1
|
||||
to command line - it has no specific syntax but human-readable formatted.
|
||||
|
||||
To enable this input device, you need the NDI SDK and you
|
||||
need to configure with the appropriate @code{--extra-cflags}
|
||||
and @code{--extra-ldflags}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item find_sources
|
||||
If set to @option{true}, print a list of found/available NDI sources and exit.
|
||||
Defaults to @option{false}.
|
||||
|
||||
@item wait_sources
|
||||
Override time to wait until the number of online sources have changed.
|
||||
Defaults to @option{0.5}.
|
||||
|
||||
@item allow_video_fields
|
||||
When this flag is @option{false}, all video that you receive will be progressive.
|
||||
Defaults to @option{true}.
|
||||
|
||||
@item extra_ips
|
||||
If is set to list of comma separated ip addresses, scan for sources not only
|
||||
using mDNS but also use unicast ip addresses specified by this list.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
|
||||
@item
|
||||
List input devices:
|
||||
@example
|
||||
ffmpeg -f libndi_newtek -find_sources 1 -i dummy
|
||||
@end example
|
||||
|
||||
@item
|
||||
List local and remote input devices:
|
||||
@example
|
||||
ffmpeg -f libndi_newtek -extra_ips "192.168.10.10" -find_sources 1 -i dummy
|
||||
@end example
|
||||
|
||||
@item
|
||||
Restream to NDI:
|
||||
@example
|
||||
ffmpeg -f libndi_newtek -i "DEV-5.INTERNAL.M1STEREO.TV (NDI_SOURCE_NAME_1)" -f libndi_newtek -y NDI_SOURCE_NAME_2
|
||||
@end example
|
||||
|
||||
@item
|
||||
Restream remote NDI to local NDI:
|
||||
@example
|
||||
ffmpeg -f libndi_newtek -extra_ips "192.168.10.10" -i "DEV-5.REMOTE.M1STEREO.TV (NDI_SOURCE_NAME_1)" -f libndi_newtek -y NDI_SOURCE_NAME_2
|
||||
@end example
|
||||
|
||||
|
||||
@end itemize
|
||||
|
||||
@section openal
|
||||
|
||||
The OpenAL input device provides audio capture on all systems with a
|
||||
@@ -1233,6 +1195,7 @@ Set the number of channels. Default is 2.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@section pulse
|
||||
|
||||
PulseAudio input device.
|
||||
|
||||
@@ -95,6 +95,7 @@ Stuff that didn't reach the codebase:
|
||||
- 0cef06df0 checkasm: add HEVC MC tests
|
||||
- e7078e842 hevcdsp: add x86 SIMD for MC
|
||||
- 7993ec19a hevc: Add hevc_get_pixel_4/8/12/16/24/32/48/64
|
||||
- new bitstream reader (see http://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209609.html)
|
||||
- use av_cpu_max_align() instead of hardcoding alignment requirements (see https://ffmpeg.org/pipermail/ffmpeg-devel/2017-September/215834.html)
|
||||
- f44ec22e0 lavc: use av_cpu_max_align() instead of hardcoding alignment requirements
|
||||
- 4de220d2e frame: allow align=0 (meaning automatic) for av_frame_get_buffer()
|
||||
@@ -104,6 +105,7 @@ Stuff that didn't reach the codebase:
|
||||
Collateral damage that needs work locally:
|
||||
------------------------------------------
|
||||
|
||||
- Merge proresdec2.c and proresdec_lgpl.c
|
||||
- Merge proresenc_anatoliy.c and proresenc_kostya.c
|
||||
- Fix MIPS AC3 downmix
|
||||
|
||||
|
||||
+47
-16
@@ -47,8 +47,7 @@ We cannot provide help for scripts and/or third-party tools.
|
||||
@anchor{How do I ask a question or send a message to a mailing list?}
|
||||
@section How do I ask a question or send a message to a mailing list?
|
||||
|
||||
First you must @ref{How do I subscribe?, subscribe}. Then all you have to do is
|
||||
send an email:
|
||||
All you have to do is send an email:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@@ -58,18 +57,49 @@ ffmpeg-user mailing list.
|
||||
@item
|
||||
Email @email{libav-user@@ffmpeg.org} to send a message to the
|
||||
libav-user mailing list.
|
||||
|
||||
@item
|
||||
Email @email{ffmpeg-devel@@ffmpeg.org} to send a message to the
|
||||
ffmpeg-devel mailing list.
|
||||
@end itemize
|
||||
|
||||
Note that the ffmpeg-devel mailing list does not require you to subscribe
|
||||
to send a message or patch, but ffmpeg-user and libav-user do require
|
||||
subscription.
|
||||
If you are not subscribed to the mailing list then your question must be
|
||||
manually approved. Approval may take several days, but the wait is
|
||||
usually less. If you want the message to be sent with no delay then you
|
||||
must subscribe first. See @ref{How do I subscribe?}
|
||||
|
||||
Please do not send a message, subscribe, and re-send the message: this
|
||||
results in duplicates, causes more work for the admins, and may lower
|
||||
your chance at getting an answer. However, you may do so if you first
|
||||
@ref{How do I delete my message in the moderation queue?, delete your original message from the moderation queue}.
|
||||
|
||||
@chapter Subscribing / Unsubscribing
|
||||
|
||||
@section What does subscribing do?
|
||||
|
||||
Subscribing allows two things:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Your messages will show up in the mailing list without waiting in the
|
||||
moderation queue and needing to be manually approved by a mailing list
|
||||
admin.
|
||||
|
||||
@item
|
||||
You will receive all messages to the mailing list including replies to
|
||||
your messages. Non-subscribed users do not receive any messages.
|
||||
@end itemize
|
||||
|
||||
@section Do I need to subscribe?
|
||||
|
||||
No. You can still send a message to the mailing list without
|
||||
subscribing. See @ref{How do I ask a question or send a message to a mailing list?}
|
||||
|
||||
However, your message will need to be manually approved by a mailing
|
||||
list admin, and you will not receive any mailing list messages or
|
||||
replies.
|
||||
|
||||
You can ask to be CCd in your message, but replying users will
|
||||
sometimes forget to do so.
|
||||
|
||||
You may also view and reply to messages via the @ref{Where are the archives?, archives}.
|
||||
|
||||
@anchor{How do I subscribe?}
|
||||
@section How do I subscribe?
|
||||
|
||||
@@ -104,6 +134,8 @@ must be manually approved by a mailing list admin:
|
||||
These are:
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Messages from users who are @strong{not} subscribed.
|
||||
|
||||
@item
|
||||
Messages that exceed the @ref{What is the message size limit?, message size limit}.
|
||||
@@ -116,12 +148,13 @@ or is abusive towards others).
|
||||
|
||||
@section How long does it take for my message in the moderation queue to be approved?
|
||||
|
||||
The queue is usually checked daily to several times a week.
|
||||
The queue is usually checked once or twice a day, but on occasion
|
||||
several days may pass before someone checks the queue.
|
||||
|
||||
@anchor{How do I delete my message in the moderation queue?}
|
||||
@section How do I delete my message in the moderation queue?
|
||||
|
||||
You should have received an email with the subject @emph{Your message to <mailing list name> awaits moderator approval}.
|
||||
You should have received an email with the subject @emph{Your message to ffmpeg-user awaits moderator approval}.
|
||||
A link is in the message that will allow you to delete your message
|
||||
unless a mailing list admin already approved or rejected it.
|
||||
|
||||
@@ -142,9 +175,6 @@ Click the email link at the top of the message just under the subject
|
||||
title. The link will provide the proper headers to keep the message
|
||||
within the thread.
|
||||
|
||||
Note that you must be subscribed to send a message to the ffmpeg-user or
|
||||
libav-user mailing lists.
|
||||
|
||||
@section How do I search the archives?
|
||||
|
||||
Perform a site search using your favorite search engine. Example:
|
||||
@@ -173,8 +203,9 @@ Instead, use trimmed interleaved/inline replies (@url{https://lists.ffmpeg.org/p
|
||||
@anchor{What is the message size limit?}
|
||||
@section What is the message size limit?
|
||||
|
||||
The message size limit is 1000 kilobytes. Please provide links to larger files
|
||||
instead of attaching them.
|
||||
The message size limit is 500 kilobytes for the user lists and 1000
|
||||
kilobytes for ffmpeg-devel. Please provide links to larger files instead
|
||||
of attaching them.
|
||||
|
||||
@section Where can I upload sample files?
|
||||
|
||||
|
||||
+50
-112
@@ -226,12 +226,7 @@ ffmpeg -re -i <input> -map 0 -map 0 -c:a libfdk_aac -c:v libx264
|
||||
|
||||
@table @option
|
||||
@item -min_seg_duration @var{microseconds}
|
||||
This is a deprecated option to set the segment length in microseconds, use @var{seg_duration} instead.
|
||||
@item -seg_duration @var{duration}
|
||||
Set the segment length in seconds (fractional value can be set). The value is
|
||||
treated as average segment duration when @var{use_template} is enabled and
|
||||
@var{use_timeline} is disabled and as minimum segment duration for all the other
|
||||
use cases.
|
||||
Set the segment length in microseconds.
|
||||
@item -window_size @var{size}
|
||||
Set the maximum number of segments kept in the manifest.
|
||||
@item -extra_window_size @var{size}
|
||||
@@ -252,8 +247,6 @@ DASH-templated name to used for the initialization segment. Default is "init-str
|
||||
DASH-templated name to used for the media segments. Default is "chunk-stream$RepresentationID$-$Number%05d$.m4s"
|
||||
@item -utc_timing_url @var{utc_url}
|
||||
URL of the page that will return the UTC timestamp in ISO format. Example: "https://time.akamai.com/?iso"
|
||||
@item method @var{method}
|
||||
Use the given HTTP method to create output files. Generally set to PUT or POST.
|
||||
@item -http_user_agent @var{user_agent}
|
||||
Override User-Agent field in HTTP header. Applicable only for HTTP output.
|
||||
@item -http_persistent @var{http_persistent}
|
||||
@@ -273,30 +266,6 @@ To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be use
|
||||
When no assignment is defined, this defaults to an AdaptationSet for each stream.
|
||||
@item -timeout @var{timeout}
|
||||
Set timeout for socket I/O operations. Applicable only for HTTP output.
|
||||
@item -index_correction @var{index_correction}
|
||||
Enable (1) or Disable (0) segment index correction logic. Applicable only when
|
||||
@var{use_template} is enabled and @var{use_timeline} is disabled.
|
||||
|
||||
When enabled, the logic monitors the flow of segment indexes. If a streams's
|
||||
segment index value is not at the expected real time position, then the logic
|
||||
corrects that index value.
|
||||
|
||||
Typically this logic is needed in live streaming use cases. The network bandwidth
|
||||
fluctuations are common during long run streaming. Each fluctuation can cause
|
||||
the segment indexes fall behind the expected real time position.
|
||||
@item -format_options @var{options_list}
|
||||
Set container format (mp4/webm) options using a @code{:} separated list of
|
||||
key=value parameters. Values containing @code{:} special characters must be
|
||||
escaped.
|
||||
|
||||
@item dash_segment_type @var{dash_segment_type}
|
||||
Possible values:
|
||||
@item mp4
|
||||
If this flag is set, the dash segment files will be in in ISOBMFF format. This is the default format.
|
||||
|
||||
@item webm
|
||||
If this flag is set, the dash segment files will be in in WebM format.
|
||||
|
||||
@end table
|
||||
|
||||
@anchor{framecrc}
|
||||
@@ -617,7 +586,7 @@ This example will produce the playlist, @file{out.m3u8}, and segment files:
|
||||
but only the file name part without any path info will be contained in the m3u8 segment list.
|
||||
Should a relative path be specified, the path of the created segment
|
||||
files will be relative to the current working directory.
|
||||
When strftime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list.
|
||||
When use_localtime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list.
|
||||
|
||||
When @code{var_stream_map} is set with two or more variant streams, the
|
||||
@var{filename} pattern must contain the string "%v", this string specifies
|
||||
@@ -646,40 +615,34 @@ This example will produce the playlists segment file sets:
|
||||
@file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc.
|
||||
|
||||
@item use_localtime
|
||||
Same as strftime option, will be deprecated.
|
||||
|
||||
@item strftime
|
||||
Use strftime() on @var{filename} to expand the segment filename with localtime.
|
||||
The segment number is also available in this mode, but to use it, you need to specify second_level_segment_index
|
||||
hls_flag and %%d will be the specifier.
|
||||
@example
|
||||
ffmpeg -i in.nut -strftime 1 -hls_segment_filename 'file-%Y%m%d-%s.ts' out.m3u8
|
||||
ffmpeg -i in.nut -use_localtime 1 -hls_segment_filename 'file-%Y%m%d-%s.ts' out.m3u8
|
||||
@end example
|
||||
This example will produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, etc.
|
||||
Note: On some systems/environments, the @code{%s} specifier is not available. See
|
||||
@code{strftime()} documentation.
|
||||
@example
|
||||
ffmpeg -i in.nut -strftime 1 -hls_flags second_level_segment_index -hls_segment_filename 'file-%Y%m%d-%%04d.ts' out.m3u8
|
||||
ffmpeg -i in.nut -use_localtime 1 -hls_flags second_level_segment_index -hls_segment_filename 'file-%Y%m%d-%%04d.ts' out.m3u8
|
||||
@end example
|
||||
This example will produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@file{file-20160215-0001.ts}, @file{file-20160215-0002.ts}, etc.
|
||||
|
||||
@item use_localtime_mkdir
|
||||
Same as strftime_mkdir option, will be deprecated .
|
||||
|
||||
@item strftime_mkdir
|
||||
Used together with -strftime_mkdir, it will create all subdirectories which
|
||||
Used together with -use_localtime, it will create all subdirectories which
|
||||
is expanded in @var{filename}.
|
||||
@example
|
||||
ffmpeg -i in.nut -strftime 1 -strftime_mkdir 1 -hls_segment_filename '%Y%m%d/file-%Y%m%d-%s.ts' out.m3u8
|
||||
ffmpeg -i in.nut -use_localtime 1 -use_localtime_mkdir 1 -hls_segment_filename '%Y%m%d/file-%Y%m%d-%s.ts' out.m3u8
|
||||
@end example
|
||||
This example will create a directory 201560215 (if it does not exist), and then
|
||||
produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@file{20160215/file-20160215-1455569023.ts}, @file{20160215/file-20160215-1455569024.ts}, etc.
|
||||
|
||||
@example
|
||||
ffmpeg -i in.nut -strftime 1 -strftime_mkdir 1 -hls_segment_filename '%Y/%m/%d/file-%Y%m%d-%s.ts' out.m3u8
|
||||
ffmpeg -i in.nut -use_localtime 1 -use_localtime_mkdir 1 -hls_segment_filename '%Y/%m/%d/file-%Y%m%d-%s.ts' out.m3u8
|
||||
@end example
|
||||
This example will create a directory hierarchy 2016/02/15 (if any of them do not exist), and then
|
||||
produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@@ -764,17 +727,17 @@ Possible values:
|
||||
|
||||
@table @samp
|
||||
@item mpegts
|
||||
Output segment files in MPEG-2 Transport Stream format. This is
|
||||
compatible with all HLS versions.
|
||||
If this flag is set, the hls segment files will format to mpegts.
|
||||
the mpegts files is used in all hls versions.
|
||||
|
||||
@item fmp4
|
||||
Output segment files in fragmented MP4 format, similar to MPEG-DASH.
|
||||
fmp4 files may be used in HLS version 7 and above.
|
||||
If this flag is set, the hls segment files will format to fragment mp4 looks like dash.
|
||||
the fmp4 files is used in hls after version 7.
|
||||
|
||||
@end table
|
||||
|
||||
@item hls_fmp4_init_filename @var{filename}
|
||||
Set filename to the fragment files header file, default filename is @file{init.mp4}.
|
||||
set filename to the fragment files header file, default filename is @file{init.mp4}.
|
||||
|
||||
When @code{var_stream_map} is set with two or more variant streams, the
|
||||
@var{filename} pattern must contain the string "%v", this string specifies
|
||||
@@ -839,24 +802,24 @@ Generate @code{EXT-X-PROGRAM-DATE-TIME} tags.
|
||||
|
||||
@item second_level_segment_index
|
||||
Makes it possible to use segment indexes as %%d in hls_segment_filename expression
|
||||
besides date/time values when strftime is on.
|
||||
besides date/time values when use_localtime is on.
|
||||
To get fixed width numbers with trailing zeroes, %%0xd format is available where x is the required width.
|
||||
|
||||
@item second_level_segment_size
|
||||
Makes it possible to use segment sizes (counted in bytes) as %%s in hls_segment_filename
|
||||
expression besides date/time values when strftime is on.
|
||||
expression besides date/time values when use_localtime is on.
|
||||
To get fixed width numbers with trailing zeroes, %%0xs format is available where x is the required width.
|
||||
|
||||
@item second_level_segment_duration
|
||||
Makes it possible to use segment duration (calculated in microseconds) as %%t in hls_segment_filename
|
||||
expression besides date/time values when strftime is on.
|
||||
expression besides date/time values when use_localtime is on.
|
||||
To get fixed width numbers with trailing zeroes, %%0xt format is available where x is the required width.
|
||||
|
||||
@example
|
||||
ffmpeg -i sample.mpeg \
|
||||
-f hls -hls_time 3 -hls_list_size 5 \
|
||||
-hls_flags second_level_segment_index+second_level_segment_size+second_level_segment_duration \
|
||||
-strftime 1 -strftime_mkdir 1 -hls_segment_filename "segment_%Y%m%d%H%M%S_%%04d_%%08s_%%013t.ts" stream.m3u8
|
||||
-use_localtime 1 -use_localtime_mkdir 1 -hls_segment_filename "segment_%Y%m%d%H%M%S_%%04d_%%08s_%%013t.ts" stream.m3u8
|
||||
@end example
|
||||
This will produce segments like this:
|
||||
@file{segment_20170102194334_0003_00122200_0000003000000.ts}, @file{segment_20170102194334_0004_00120072_0000003000000.ts} etc.
|
||||
@@ -1350,18 +1313,6 @@ be negative. This enables the initial sample to have DTS/CTS of zero, and
|
||||
reduces the need for edit lists for some cases such as video tracks with
|
||||
B-frames. Additionally, eases conformance with the DASH-IF interoperability
|
||||
guidelines.
|
||||
|
||||
This option is implicitly set when writing ismv (Smooth Streaming) files.
|
||||
@item -write_prft
|
||||
Write producer time reference box (PRFT) with a specified time source for the
|
||||
NTP field in the PRFT box. Set value as @samp{wallclock} to specify timesource
|
||||
as wallclock time and @samp{pts} to specify timesource as input packets' PTS
|
||||
values.
|
||||
|
||||
Setting value to @samp{pts} is applicable only for a live encoding use case,
|
||||
where PTS values are set as as wallclock time at the source. For example, an
|
||||
encoding use case with decklink capture source where @option{video_pts} and
|
||||
@option{audio_pts} are set to @samp{abs_wallclock}.
|
||||
@end table
|
||||
|
||||
@subsection Example
|
||||
@@ -2070,35 +2021,20 @@ ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv -map 0:v -map 0
|
||||
@anchor{tee}
|
||||
@section tee
|
||||
|
||||
The tee muxer can be used to write the same data to several outputs, such as files or streams.
|
||||
It can be used, for example, to stream a video over a network and save it to disk at the same time.
|
||||
The tee muxer can be used to write the same data to several files or any
|
||||
other kind of muxer. It can be used, for example, to both stream a video to
|
||||
the network and save it to disk at the same time.
|
||||
|
||||
It is different from specifying several outputs to the @command{ffmpeg}
|
||||
command-line tool. With the tee muxer, the audio and video data will be encoded only once.
|
||||
With conventional multiple outputs, multiple encoding operations in parallel are initiated,
|
||||
which can be a very expensive process. The tee muxer is not useful when using the libavformat API
|
||||
directly because it is then possible to feed the same packets to several muxers directly.
|
||||
|
||||
Since the tee muxer does not represent any particular output format, ffmpeg cannot auto-select
|
||||
output streams. So all streams intended for output must be specified using @code{-map}. See
|
||||
the examples below.
|
||||
|
||||
Some encoders may need different options depending on the output format;
|
||||
the auto-detection of this can not work with the tee muxer, so they need to be explicitly specified.
|
||||
The main example is the @option{global_header} flag.
|
||||
|
||||
The slave outputs are specified in the file name given to the muxer,
|
||||
separated by '|'. If any of the slave name contains the '|' separator,
|
||||
leading or trailing spaces or any special character, those must be
|
||||
escaped (see @ref{quoting_and_escaping,,the "Quoting and escaping"
|
||||
section in the ffmpeg-utils(1) manual,ffmpeg-utils}).
|
||||
|
||||
@subsection Options
|
||||
command-line tool because the audio and video data will be encoded only once
|
||||
with the tee muxer; encoding can be a very expensive process. It is not
|
||||
useful when using the libavformat API directly because it is then possible
|
||||
to feed the same packets to several muxers directly.
|
||||
|
||||
@table @option
|
||||
|
||||
@item use_fifo @var{bool}
|
||||
If set to 1, slave outputs will be processed in separate threads using the @ref{fifo}
|
||||
If set to 1, slave outputs will be processed in separate thread using @ref{fifo}
|
||||
muxer. This allows to compensate for different speed/latency/reliability of
|
||||
outputs and setup transparent recovery. By default this feature is turned off.
|
||||
|
||||
@@ -2107,6 +2043,12 @@ Options to pass to fifo pseudo-muxer instances. See @ref{fifo}.
|
||||
|
||||
@end table
|
||||
|
||||
The slave outputs are specified in the file name given to the muxer,
|
||||
separated by '|'. If any of the slave name contains the '|' separator,
|
||||
leading or trailing spaces or any special character, it must be
|
||||
escaped (see @ref{quoting_and_escaping,,the "Quoting and escaping"
|
||||
section in the ffmpeg-utils(1) manual,ffmpeg-utils}).
|
||||
|
||||
Muxer options can be specified for each slave by prepending them as a list of
|
||||
@var{key}=@var{value} pairs separated by ':', between square brackets. If
|
||||
the options values contain a special character or the ':' separator, they
|
||||
@@ -2115,27 +2057,13 @@ must be escaped; note that this is a second level escaping.
|
||||
The following special options are also recognized:
|
||||
@table @option
|
||||
@item f
|
||||
Specify the format name. Required if it cannot be guessed from the
|
||||
output URL.
|
||||
Specify the format name. Useful if it cannot be guessed from the
|
||||
output name suffix.
|
||||
|
||||
@item bsfs[/@var{spec}]
|
||||
Specify a list of bitstream filters to apply to the specified
|
||||
output.
|
||||
|
||||
It is possible to specify to which streams a given bitstream filter
|
||||
applies, by appending a stream specifier to the option separated by
|
||||
@code{/}. @var{spec} must be a stream specifier (see @ref{Format
|
||||
stream specifiers}).
|
||||
|
||||
If the stream specifier is not specified, the bitstream filters will be
|
||||
applied to all streams in the output. This will cause that output operation
|
||||
to fail if the output contains streams to which the bitstream filter cannot
|
||||
be applied e.g. @code{h264_mp4toannexb} being applied to an output containing an audio stream.
|
||||
|
||||
Options for a bitstream filter must be specified in the form of @code{opt=value}.
|
||||
|
||||
Several bitstream filters can be specified, separated by ",".
|
||||
|
||||
@item use_fifo @var{bool}
|
||||
This allows to override tee muxer use_fifo option for individual slave muxer.
|
||||
|
||||
@@ -2143,13 +2071,19 @@ This allows to override tee muxer use_fifo option for individual slave muxer.
|
||||
This allows to override tee muxer fifo_options for individual slave muxer.
|
||||
See @ref{fifo}.
|
||||
|
||||
It is possible to specify to which streams a given bitstream filter
|
||||
applies, by appending a stream specifier to the option separated by
|
||||
@code{/}. @var{spec} must be a stream specifier (see @ref{Format
|
||||
stream specifiers}). If the stream specifier is not specified, the
|
||||
bitstream filters will be applied to all streams in the output.
|
||||
|
||||
Several bitstream filters can be specified, separated by ",".
|
||||
|
||||
@item select
|
||||
Select the streams that should be mapped to the slave output,
|
||||
specified by a stream specifier. If not specified, this defaults to
|
||||
all the mapped streams. This will cause that output operation to fail
|
||||
if the output format does not accept all mapped streams.
|
||||
|
||||
You may use multiple stream specifiers separated by commas (@code{,}) e.g.: @code{a:0,v}
|
||||
all the input streams. You may use multiple stream specifiers
|
||||
separated by commas (@code{,}) e.g.: @code{a:0,v}
|
||||
|
||||
@item onfail
|
||||
Specify behaviour on output failure. This can be set to either @code{abort} (which is
|
||||
@@ -2163,7 +2097,7 @@ will continue without being affected.
|
||||
@itemize
|
||||
@item
|
||||
Encode something and both archive it in a WebM file and stream it
|
||||
as MPEG-TS over UDP:
|
||||
as MPEG-TS over UDP (the streams need to be explicitly mapped):
|
||||
@example
|
||||
ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
|
||||
"archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
|
||||
@@ -2186,19 +2120,23 @@ option is applied to @file{out.aac} in order to make it contain only
|
||||
audio packets.
|
||||
@example
|
||||
ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
|
||||
-f tee "[bsfs/v=dump_extra=freq=keyframe]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac"
|
||||
-f tee "[bsfs/v=dump_extra]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac"
|
||||
@end example
|
||||
|
||||
@item
|
||||
As above, but select only stream @code{a:1} for the audio output. Note
|
||||
As below, but select only stream @code{a:1} for the audio output. Note
|
||||
that a second level escaping must be performed, as ":" is a special
|
||||
character used to separate options.
|
||||
@example
|
||||
ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
|
||||
-f tee "[bsfs/v=dump_extra=freq=keyframe]out.ts|[movflags=+faststart]out.mp4|[select=\'a:1\']out.aac"
|
||||
-f tee "[bsfs/v=dump_extra]out.ts|[movflags=+faststart]out.mp4|[select=\'a:1\']out.aac"
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
Note: some codecs may need different options depending on the output format;
|
||||
the auto-detection of this can not work with the tee muxer. The main example
|
||||
is the @option{global_header} flag.
|
||||
|
||||
@section webm_dash_manifest
|
||||
|
||||
WebM DASH Manifest muxer.
|
||||
|
||||
+30
-48
@@ -140,8 +140,7 @@ device with @command{-list_formats 1}. Audio sample rate is always 48 kHz.
|
||||
|
||||
@item list_devices
|
||||
If set to @option{true}, print a list of devices and exit.
|
||||
Defaults to @option{false}. Alternatively you can use the @code{-sinks}
|
||||
option of ffmpeg to list the available output devices.
|
||||
Defaults to @option{false}.
|
||||
|
||||
@item list_formats
|
||||
If set to @option{true}, print a list of supported formats and exit.
|
||||
@@ -151,10 +150,6 @@ Defaults to @option{false}.
|
||||
Amount of time to preroll video in seconds.
|
||||
Defaults to @option{0.5}.
|
||||
|
||||
@item duplex_mode
|
||||
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}.
|
||||
Defaults to @samp{unset}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@@ -187,35 +182,6 @@ ffmpeg -i test.avi -f decklink -pix_fmt uyvy422 -s 720x486 -r 24000/1001 'DeckLi
|
||||
|
||||
@end itemize
|
||||
|
||||
@section fbdev
|
||||
|
||||
Linux framebuffer output device.
|
||||
|
||||
The Linux framebuffer is a graphic hardware-independent abstraction
|
||||
layer to show graphics on a computer monitor, typically on the
|
||||
console. It is accessed through a file device node, usually
|
||||
@file{/dev/fb0}.
|
||||
|
||||
For more detailed information read the file
|
||||
@file{Documentation/fb/framebuffer.txt} included in the Linux source tree.
|
||||
|
||||
@subsection Options
|
||||
@table @option
|
||||
|
||||
@item xoffset
|
||||
@item yoffset
|
||||
Set x/y coordinate of top left corner. Default is 0.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
Play a file on framebuffer device @file{/dev/fb0}.
|
||||
Required pixel format depends on current framebuffer settings.
|
||||
@example
|
||||
ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
|
||||
@end example
|
||||
|
||||
See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
|
||||
|
||||
@section libndi_newtek
|
||||
|
||||
The libndi_newtek output device provides playback capabilities for using NDI (Network
|
||||
@@ -261,6 +227,35 @@ ffmpeg -i "udp://@@239.1.1.1:10480?fifo_size=1000000&overrun_nonfatal=1" -vf "sc
|
||||
|
||||
@end itemize
|
||||
|
||||
@section fbdev
|
||||
|
||||
Linux framebuffer output device.
|
||||
|
||||
The Linux framebuffer is a graphic hardware-independent abstraction
|
||||
layer to show graphics on a computer monitor, typically on the
|
||||
console. It is accessed through a file device node, usually
|
||||
@file{/dev/fb0}.
|
||||
|
||||
For more detailed information read the file
|
||||
@file{Documentation/fb/framebuffer.txt} included in the Linux source tree.
|
||||
|
||||
@subsection Options
|
||||
@table @option
|
||||
|
||||
@item xoffset
|
||||
@item yoffset
|
||||
Set x/y coordinate of top left corner. Default is 0.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
Play a file on framebuffer device @file{/dev/fb0}.
|
||||
Required pixel format depends on current framebuffer settings.
|
||||
@example
|
||||
ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
|
||||
@end example
|
||||
|
||||
See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
|
||||
|
||||
@section opengl
|
||||
OpenGL output device.
|
||||
|
||||
@@ -398,18 +393,9 @@ Set the SDL window size, can be a string of the form
|
||||
If not specified it defaults to the size of the input video,
|
||||
downscaled according to the aspect ratio.
|
||||
|
||||
@item window_x
|
||||
@item window_y
|
||||
Set the position of the window on the screen.
|
||||
|
||||
@item window_fullscreen
|
||||
Set fullscreen mode when non-zero value is provided.
|
||||
Default value is zero.
|
||||
|
||||
@item window_enable_quit
|
||||
Enable quit action (using window button or keyboard key)
|
||||
when non-zero value is provided.
|
||||
Default value is 1 (enable quit action)
|
||||
@end table
|
||||
|
||||
@subsection Interactive commands
|
||||
@@ -434,10 +420,6 @@ ffmpeg -i INPUT -c:v rawvideo -pix_fmt yuv420p -window_size qcif -f sdl "SDL out
|
||||
|
||||
sndio audio output device.
|
||||
|
||||
@section v4l2
|
||||
|
||||
Video4Linux2 output device.
|
||||
|
||||
@section xv
|
||||
|
||||
XV (XVideo) output device.
|
||||
|
||||
+13
-3
@@ -148,11 +148,16 @@ To target 32 bits replace @code{x86_64} with @code{i686} in the command above.
|
||||
|
||||
@section Microsoft Visual C++ or Intel C++ Compiler for Windows
|
||||
|
||||
FFmpeg can be built with MSVC 2013 or later.
|
||||
FFmpeg can be built with MSVC 2012 or earlier using a C99-to-C89 conversion utility
|
||||
and wrapper, or with MSVC 2013 and ICL natively.
|
||||
|
||||
You will need the following prerequisites:
|
||||
|
||||
@itemize
|
||||
@item @uref{https://github.com/libav/c99-to-c89/, C99-to-C89 Converter & Wrapper}
|
||||
(if using MSVC 2012 or earlier)
|
||||
@item @uref{http://code.google.com/p/msinttypes/, msinttypes}
|
||||
(if using MSVC 2012 or earlier)
|
||||
@item @uref{http://msys2.github.io/, MSYS2}
|
||||
@item @uref{http://www.nasm.us/, NASM}
|
||||
(Also available via MSYS2's package manager.)
|
||||
@@ -161,13 +166,16 @@ You will need the following prerequisites:
|
||||
To set up a proper environment in MSYS2, you need to run @code{msys_shell.bat} from
|
||||
the Visual Studio or Intel Compiler command prompt.
|
||||
|
||||
Place @code{yasm.exe} somewhere in your @code{PATH}.
|
||||
Place @code{yasm.exe} somewhere in your @code{PATH}. If using MSVC 2012 or
|
||||
earlier, place @code{c99wrap.exe} and @code{c99conv.exe} somewhere in your
|
||||
@code{PATH} as well.
|
||||
|
||||
Next, make sure any other headers and libs you want to use, such as zlib, are
|
||||
located in a spot that the compiler can see. Do so by modifying the @code{LIB}
|
||||
and @code{INCLUDE} environment variables to include the @strong{Windows-style}
|
||||
paths to these directories. Alternatively, you can try to use the
|
||||
@code{--extra-cflags}/@code{--extra-ldflags} configure options.
|
||||
@code{--extra-cflags}/@code{--extra-ldflags} configure options. If using MSVC
|
||||
2012 or earlier, place @code{inttypes.h} somewhere the compiler can see too.
|
||||
|
||||
Finally, run:
|
||||
|
||||
@@ -209,6 +217,8 @@ can see.
|
||||
|
||||
@item FFmpeg has been tested with the following on i686 and x86_64:
|
||||
@itemize
|
||||
@item Visual Studio 2010 Pro and Express
|
||||
@item Visual Studio 2012 Pro and Express
|
||||
@item Visual Studio 2013 Pro and Express
|
||||
@item Intel Composer XE 2013
|
||||
@item Intel Composer XE 2013 SP1
|
||||
|
||||
+12
-133
@@ -1210,17 +1210,6 @@ IP Type of Service. Applies to sender only. Default value is 0xB8.
|
||||
@item ipttl=@var{ttl}
|
||||
IP Time To Live. Applies to sender only. Default value is 64.
|
||||
|
||||
@item latency
|
||||
Timestamp-based Packet Delivery Delay.
|
||||
Used to absorb bursts of missed packet retransmissions.
|
||||
This flag sets both @option{rcvlatency} and @option{peerlatency}
|
||||
to the same value. Note that prior to version 1.3.0
|
||||
this is the only flag to set the latency, however
|
||||
this is effectively equivalent to setting @option{peerlatency},
|
||||
when side is sender and @option{rcvlatency}
|
||||
when side is receiver, and the bidirectional stream
|
||||
sending is not supported.
|
||||
|
||||
@item listen_timeout
|
||||
Set socket listen timeout.
|
||||
|
||||
@@ -1266,25 +1255,6 @@ only if @option{pbkeylen} is non-zero. It is used on
|
||||
the receiver only if the received data is encrypted.
|
||||
The configured passphrase cannot be recovered (write-only).
|
||||
|
||||
@item payload_size=@var{bytes}
|
||||
Sets the maximum declared size of a packet transferred
|
||||
during the single call to the sending function in Live
|
||||
mode. Use 0 if this value isn't used (which is default in
|
||||
file mode).
|
||||
Default is -1 (automatic), which typically means MPEG-TS;
|
||||
if you are going to use SRT
|
||||
to send any different kind of payload, such as, for example,
|
||||
wrapping a live stream in very small frames, then you can
|
||||
use a bigger maximum frame size, though not greater than
|
||||
1456 bytes.
|
||||
|
||||
@item pkt_size=@var{bytes}
|
||||
Alias for @samp{payload_size}.
|
||||
|
||||
@item peerlatency
|
||||
The latency value (as described in @option{rcvlatency}) that is
|
||||
set by the sender side as a minimum value for the receiver.
|
||||
|
||||
@item pbkeylen=@var{bytes}
|
||||
Sender encryption key length, in bytes.
|
||||
Only can be set to 0, 16, 24 and 32.
|
||||
@@ -1293,23 +1263,11 @@ Not required on receiver (set to 0),
|
||||
key size obtained from sender in HaiCrypt handshake.
|
||||
Default value is 0.
|
||||
|
||||
@item rcvlatency
|
||||
The time that should elapse since the moment when the
|
||||
packet was sent and the moment when it's delivered to
|
||||
the receiver application in the receiving function.
|
||||
This time should be a buffer time large enough to cover
|
||||
the time spent for sending, unexpectedly extended RTT
|
||||
time, and the time needed to retransmit the lost UDP
|
||||
packet. The effective latency value will be the maximum
|
||||
of this options' value and the value of @option{peerlatency}
|
||||
set by the peer side. Before version 1.3.0 this option
|
||||
is only available as @option{latency}.
|
||||
|
||||
@item recv_buffer_size=@var{bytes}
|
||||
Set UDP receive buffer size, expressed in bytes.
|
||||
Set receive buffer size, expressed in bytes.
|
||||
|
||||
@item send_buffer_size=@var{bytes}
|
||||
Set UDP send buffer size, expressed in bytes.
|
||||
Set send buffer size, expressed in bytes.
|
||||
|
||||
@item rw_timeout
|
||||
Set raise error timeout for read/write optations.
|
||||
@@ -1329,86 +1287,9 @@ have no chance of being delivered in time. It was
|
||||
automatically enabled in the sender if the receiver
|
||||
supports it.
|
||||
|
||||
@item sndbuf=@var{bytes}
|
||||
Set send buffer size, expressed in bytes.
|
||||
|
||||
@item rcvbuf=@var{bytes}
|
||||
Set receive buffer size, expressed in bytes.
|
||||
|
||||
Receive buffer must not be greater than @option{ffs}.
|
||||
|
||||
@item lossmaxttl=@var{packets}
|
||||
The value up to which the Reorder Tolerance may grow. When
|
||||
Reorder Tolerance is > 0, then packet loss report is delayed
|
||||
until that number of packets come in. Reorder Tolerance
|
||||
increases every time a "belated" packet has come, but it
|
||||
wasn't due to retransmission (that is, when UDP packets tend
|
||||
to come out of order), with the difference between the latest
|
||||
sequence and this packet's sequence, and not more than the
|
||||
value of this option. By default it's 0, which means that this
|
||||
mechanism is turned off, and the loss report is always sent
|
||||
immediately upon experiencing a "gap" in sequences.
|
||||
|
||||
@item minversion
|
||||
The minimum SRT version that is required from the peer. A connection
|
||||
to a peer that does not satisfy the minimum version requirement
|
||||
will be rejected.
|
||||
|
||||
The version format in hex is 0xXXYYZZ for x.y.z in human readable
|
||||
form.
|
||||
|
||||
@item streamid=@var{string}
|
||||
A string limited to 512 characters that can be set on the socket prior
|
||||
to connecting. This stream ID will be able to be retrieved by the
|
||||
listener side from the socket that is returned from srt_accept and
|
||||
was connected by a socket with that set stream ID. SRT does not enforce
|
||||
any special interpretation of the contents of this string.
|
||||
This option doesn’t make sense in Rendezvous connection; the result
|
||||
might be that simply one side will override the value from the other
|
||||
side and it’s the matter of luck which one would win
|
||||
|
||||
@item smoother=@var{live|file}
|
||||
The type of Smoother used for the transmission for that socket, which
|
||||
is responsible for the transmission and congestion control. The Smoother
|
||||
type must be exactly the same on both connecting parties, otherwise
|
||||
the connection is rejected.
|
||||
|
||||
@item messageapi=@var{1|0}
|
||||
When set, this socket uses the Message API, otherwise it uses Buffer
|
||||
API. Note that in live mode (see @option{transtype}) there’s only
|
||||
message API available. In File mode you can chose to use one of two modes:
|
||||
|
||||
Stream API (default, when this option is false). In this mode you may
|
||||
send as many data as you wish with one sending instruction, or even use
|
||||
dedicated functions that read directly from a file. The internal facility
|
||||
will take care of any speed and congestion control. When receiving, you
|
||||
can also receive as many data as desired, the data not extracted will be
|
||||
waiting for the next call. There is no boundary between data portions in
|
||||
the Stream mode.
|
||||
|
||||
Message API. In this mode your single sending instruction passes exactly
|
||||
one piece of data that has boundaries (a message). Contrary to Live mode,
|
||||
this message may span across multiple UDP packets and the only size
|
||||
limitation is that it shall fit as a whole in the sending buffer. The
|
||||
receiver shall use as large buffer as necessary to receive the message,
|
||||
otherwise the message will not be given up. When the message is not
|
||||
complete (not all packets received or there was a packet loss) it will
|
||||
not be given up.
|
||||
|
||||
@item transtype=@var{live|file}
|
||||
Sets the transmission type for the socket, in particular, setting this
|
||||
option sets multiple other parameters to their default values as required
|
||||
for a particular transmission type.
|
||||
|
||||
live: Set options as for live transmission. In this mode, you should
|
||||
send by one sending instruction only so many data that fit in one UDP packet,
|
||||
and limited to the value defined first in @option{payload_size} (1316 is
|
||||
default in this mode). There is no speed control in this mode, only the
|
||||
bandwidth control, if configured, in order to not exceed the bandwidth with
|
||||
the overhead transmission (retransmitted and control packets).
|
||||
|
||||
file: Set options as for non-live transmission. See @option{messageapi}
|
||||
for further explanations
|
||||
@item tsbpddelay
|
||||
Timestamp-based Packet Delivery Delay.
|
||||
Used to absorb burst of missed packet retransmission.
|
||||
|
||||
@end table
|
||||
|
||||
@@ -1516,9 +1397,6 @@ Set send buffer size, expressed bytes.
|
||||
|
||||
@item tcp_nodelay=@var{1|0}
|
||||
Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0.
|
||||
|
||||
@item tcp_mss=@var{bytes}
|
||||
Set maximum segment size for outgoing TCP packets, expressed in bytes.
|
||||
@end table
|
||||
|
||||
The following example shows how to setup a listening TCP connection
|
||||
@@ -1625,8 +1503,9 @@ packet bursts.
|
||||
Override the local UDP port to bind with.
|
||||
|
||||
@item localaddr=@var{addr}
|
||||
Local IP address of a network interface used for sending packets or joining
|
||||
multicast groups.
|
||||
Choose the local IP address. This is useful e.g. if sending multicast
|
||||
and the host has multiple interfaces, where the user can choose
|
||||
which interface to send on by specifying the IP address of that interface.
|
||||
|
||||
@item pkt_size=@var{size}
|
||||
Set the size in bytes of UDP packets.
|
||||
@@ -1649,12 +1528,12 @@ For receiving, this gives the benefit of only receiving packets from
|
||||
the specified peer address/port.
|
||||
|
||||
@item sources=@var{address}[,@var{address}]
|
||||
Only receive packets sent from the specified addresses. In case of multicast,
|
||||
also subscribe to multicast traffic coming from these addresses only.
|
||||
Only receive packets sent to the multicast group from one of the
|
||||
specified sender IP addresses.
|
||||
|
||||
@item block=@var{address}[,@var{address}]
|
||||
Ignore packets sent from the specified addresses. In case of multicast, also
|
||||
exclude the source addresses in the multicast subscription.
|
||||
Ignore packets sent to the multicast group from the specified
|
||||
sender IP addresses.
|
||||
|
||||
@item fifo_size=@var{units}
|
||||
Set the UDP receiving circular buffer size, expressed as a number of
|
||||
|
||||
@@ -418,4 +418,4 @@ done:
|
||||
|
||||
When all of this is done, you can submit your patch to the ffmpeg-devel
|
||||
mailing-list for review. If you need any help, feel free to come on our IRC
|
||||
channel, #ffmpeg-devel on irc.libera.chat.
|
||||
channel, #ffmpeg-devel on irc.freenode.net.
|
||||
|
||||
+2
-26
@@ -1018,7 +1018,7 @@ static int init_report(const char *env)
|
||||
av_free(key);
|
||||
}
|
||||
|
||||
av_bprint_init(&filename, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
av_bprint_init(&filename, 0, 1);
|
||||
expand_filename_template(&filename,
|
||||
av_x_if_null(filename_template, "%p-%t.log"), tm);
|
||||
av_free(filename_template);
|
||||
@@ -1414,16 +1414,6 @@ static void print_codec(const AVCodec *c)
|
||||
AV_CODEC_CAP_SLICE_THREADS |
|
||||
AV_CODEC_CAP_AUTO_THREADS))
|
||||
printf("threads ");
|
||||
if (c->capabilities & AV_CODEC_CAP_AVOID_PROBING)
|
||||
printf("avoidprobe ");
|
||||
if (c->capabilities & AV_CODEC_CAP_INTRA_ONLY)
|
||||
printf("intraonly ");
|
||||
if (c->capabilities & AV_CODEC_CAP_LOSSLESS)
|
||||
printf("lossless ");
|
||||
if (c->capabilities & AV_CODEC_CAP_HARDWARE)
|
||||
printf("hardware ");
|
||||
if (c->capabilities & AV_CODEC_CAP_HYBRID)
|
||||
printf("hybrid ");
|
||||
if (!c->capabilities)
|
||||
printf("none");
|
||||
printf("\n");
|
||||
@@ -1444,17 +1434,6 @@ static void print_codec(const AVCodec *c)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (avcodec_get_hw_config(c, 0)) {
|
||||
printf(" Supported hardware devices: ");
|
||||
for (int i = 0;; i++) {
|
||||
const AVCodecHWConfig *config = avcodec_get_hw_config(c, i);
|
||||
if (!config)
|
||||
break;
|
||||
printf("%s ", av_hwdevice_get_type_name(config->device_type));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (c->supported_framerates) {
|
||||
const AVRational *fps = c->supported_framerates;
|
||||
|
||||
@@ -1956,10 +1935,7 @@ static void show_help_bsf(const char *name)
|
||||
{
|
||||
const AVBitStreamFilter *bsf = av_bsf_get_by_name(name);
|
||||
|
||||
if (!name) {
|
||||
av_log(NULL, AV_LOG_ERROR, "No bitstream filter name specified.\n");
|
||||
return;
|
||||
} else if (!bsf) {
|
||||
if (!bsf) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
+31
-100
@@ -120,14 +120,8 @@ const char *const forced_keyframes_const_names[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
typedef struct BenchmarkTimeStamps {
|
||||
int64_t real_usec;
|
||||
int64_t user_usec;
|
||||
int64_t sys_usec;
|
||||
} BenchmarkTimeStamps;
|
||||
|
||||
static void do_video_stats(OutputStream *ost, int frame_size);
|
||||
static BenchmarkTimeStamps get_benchmark_time_stamps(void);
|
||||
static int64_t getutime(void);
|
||||
static int64_t getmaxrss(void);
|
||||
static int ifilter_has_all_input_formats(FilterGraph *fg);
|
||||
|
||||
@@ -139,7 +133,7 @@ static int64_t decode_error_stat[2];
|
||||
|
||||
static int want_sdp = 1;
|
||||
|
||||
static BenchmarkTimeStamps current_time;
|
||||
static int current_time;
|
||||
AVIOContext *progress_avio = NULL;
|
||||
|
||||
static uint8_t *subtitle_out;
|
||||
@@ -567,7 +561,6 @@ static void ffmpeg_cleanup(int ret)
|
||||
ost->audio_channels_mapped = 0;
|
||||
|
||||
av_dict_free(&ost->sws_dict);
|
||||
av_dict_free(&ost->swr_opts);
|
||||
|
||||
avcodec_free_context(&ost->enc_ctx);
|
||||
avcodec_parameters_free(&ost->ref_par);
|
||||
@@ -660,7 +653,7 @@ static void abort_codec_experimental(AVCodec *c, int encoder)
|
||||
static void update_benchmark(const char *fmt, ...)
|
||||
{
|
||||
if (do_benchmark_all) {
|
||||
BenchmarkTimeStamps t = get_benchmark_time_stamps();
|
||||
int64_t t = getutime();
|
||||
va_list va;
|
||||
char buf[1024];
|
||||
|
||||
@@ -668,11 +661,7 @@ static void update_benchmark(const char *fmt, ...)
|
||||
va_start(va, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, va);
|
||||
va_end(va);
|
||||
av_log(NULL, AV_LOG_INFO,
|
||||
"bench: %8" PRIu64 " user %8" PRIu64 " sys %8" PRIu64 " real %s \n",
|
||||
t.user_usec - current_time.user_usec,
|
||||
t.sys_usec - current_time.sys_usec,
|
||||
t.real_usec - current_time.real_usec, buf);
|
||||
av_log(NULL, AV_LOG_INFO, "bench: %8"PRIu64" %s \n", t - current_time, buf);
|
||||
}
|
||||
current_time = t;
|
||||
}
|
||||
@@ -725,11 +714,11 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
|
||||
if (ret < 0)
|
||||
exit_program(1);
|
||||
}
|
||||
ret = av_packet_make_refcounted(pkt);
|
||||
ret = av_packet_ref(&tmp_pkt, pkt);
|
||||
if (ret < 0)
|
||||
exit_program(1);
|
||||
av_packet_move_ref(&tmp_pkt, pkt);
|
||||
av_fifo_generic_write(ost->muxing_queue, &tmp_pkt, sizeof(tmp_pkt), NULL);
|
||||
av_packet_unref(pkt);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -773,7 +762,7 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
|
||||
- FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1)
|
||||
- FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1);
|
||||
}
|
||||
if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) &&
|
||||
if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
|
||||
pkt->dts != AV_NOPTS_VALUE &&
|
||||
!(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) &&
|
||||
ost->last_mux_dts != AV_NOPTS_VALUE) {
|
||||
@@ -1122,7 +1111,7 @@ static void do_video_out(OutputFile *of,
|
||||
format_video_sync != VSYNC_PASSTHROUGH &&
|
||||
format_video_sync != VSYNC_DROP) {
|
||||
if (delta0 < -0.6) {
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0);
|
||||
av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0);
|
||||
} else
|
||||
av_log(NULL, AV_LOG_DEBUG, "Clipping frame in rate conversion by %f\n", -delta0);
|
||||
sync_ipts = ost->sync_opts;
|
||||
@@ -1237,12 +1226,8 @@ static void do_video_out(OutputFile *of,
|
||||
in_picture->quality = enc->global_quality;
|
||||
in_picture->pict_type = 0;
|
||||
|
||||
if (ost->forced_kf_ref_pts == AV_NOPTS_VALUE &&
|
||||
in_picture->pts != AV_NOPTS_VALUE)
|
||||
ost->forced_kf_ref_pts = in_picture->pts;
|
||||
|
||||
pts_time = in_picture->pts != AV_NOPTS_VALUE ?
|
||||
(in_picture->pts - ost->forced_kf_ref_pts) * av_q2d(enc->time_base) : NAN;
|
||||
in_picture->pts * av_q2d(enc->time_base) : NAN;
|
||||
if (ost->forced_kf_index < ost->forced_kf_count &&
|
||||
in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) {
|
||||
ost->forced_kf_index++;
|
||||
@@ -1690,7 +1675,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
|
||||
|
||||
vid = 0;
|
||||
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
av_bprint_init(&buf_script, 0, 1);
|
||||
for (i = 0; i < nb_output_streams; i++) {
|
||||
float q = -1;
|
||||
ost = output_streams[i];
|
||||
@@ -1711,7 +1696,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
|
||||
av_bprintf(&buf, "frame=%5d fps=%3.*f q=%3.1f ",
|
||||
frame_number, fps < 9.95, fps, q);
|
||||
av_bprintf(&buf_script, "frame=%d\n", frame_number);
|
||||
av_bprintf(&buf_script, "fps=%.2f\n", fps);
|
||||
av_bprintf(&buf_script, "fps=%.1f\n", fps);
|
||||
av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n",
|
||||
ost->file_index, ost->index, q);
|
||||
if (is_last_report)
|
||||
@@ -1795,11 +1780,9 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
|
||||
if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n");
|
||||
else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size);
|
||||
if (pts == AV_NOPTS_VALUE) {
|
||||
av_bprintf(&buf_script, "out_time_us=N/A\n");
|
||||
av_bprintf(&buf_script, "out_time_ms=N/A\n");
|
||||
av_bprintf(&buf_script, "out_time=N/A\n");
|
||||
} else {
|
||||
av_bprintf(&buf_script, "out_time_us=%"PRId64"\n", pts);
|
||||
av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts);
|
||||
av_bprintf(&buf_script, "out_time=%s%02d:%02d:%02d.%06d\n",
|
||||
hours_sign, hours, mins, secs, us);
|
||||
@@ -2111,12 +2094,10 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret)
|
||||
if (ret < 0 && exit_on_error)
|
||||
exit_program(1);
|
||||
|
||||
if (*got_output && ist) {
|
||||
if (exit_on_error && *got_output && ist) {
|
||||
if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
|
||||
av_log(NULL, exit_on_error ? AV_LOG_FATAL : AV_LOG_WARNING,
|
||||
"%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->url, ist->st->index);
|
||||
if (exit_on_error)
|
||||
exit_program(1);
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->url, ist->st->index);
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2140,6 +2121,9 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
||||
|
||||
/* determine if the parameters for this input changed */
|
||||
need_reinit = ifilter->format != frame->format;
|
||||
if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx ||
|
||||
(ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data))
|
||||
need_reinit = 1;
|
||||
|
||||
switch (ifilter->ist->st->codecpar->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@@ -2153,13 +2137,6 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ifilter->ist->reinit_filters && fg->graph)
|
||||
need_reinit = 0;
|
||||
|
||||
if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx ||
|
||||
(ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data))
|
||||
need_reinit = 1;
|
||||
|
||||
if (need_reinit) {
|
||||
ret = ifilter_parameters_from_frame(ifilter, frame);
|
||||
if (ret < 0)
|
||||
@@ -2719,7 +2696,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
||||
ist->dts = ist->next_dts;
|
||||
switch (ist->dec_ctx->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
av_assert1(pkt->duration >= 0);
|
||||
if (ist->dec_ctx->sample_rate) {
|
||||
ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->frame_size) /
|
||||
ist->dec_ctx->sample_rate;
|
||||
@@ -3079,13 +3055,7 @@ static int init_output_stream_streamcopy(OutputStream *ost)
|
||||
"Error setting up codec context options.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = avcodec_parameters_from_context(par_src, ost->enc_ctx);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Error getting reference codec parameters.\n");
|
||||
return ret;
|
||||
}
|
||||
avcodec_parameters_from_context(par_src, ost->enc_ctx);
|
||||
|
||||
if (!codec_tag) {
|
||||
unsigned int codec_tag_tmp;
|
||||
@@ -3413,12 +3383,6 @@ static int init_output_stream_encode(OutputStream *ost)
|
||||
enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
|
||||
}
|
||||
|
||||
if (ost->top_field_first == 0) {
|
||||
enc_ctx->field_order = AV_FIELD_BB;
|
||||
} else if (ost->top_field_first == 1) {
|
||||
enc_ctx->field_order = AV_FIELD_TT;
|
||||
}
|
||||
|
||||
if (ost->forced_keyframes) {
|
||||
if (!strncmp(ost->forced_keyframes, "expr:", 5)) {
|
||||
ret = av_expr_parse(&ost->forced_keyframes_pexpr, ost->forced_keyframes+5,
|
||||
@@ -3505,23 +3469,6 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (ist && ist->dec->type == AVMEDIA_TYPE_SUBTITLE && ost->enc->type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
int input_props = 0, output_props = 0;
|
||||
AVCodecDescriptor const *input_descriptor =
|
||||
avcodec_descriptor_get(dec->codec_id);
|
||||
AVCodecDescriptor const *output_descriptor =
|
||||
avcodec_descriptor_get(ost->enc_ctx->codec_id);
|
||||
if (input_descriptor)
|
||||
input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
|
||||
if (output_descriptor)
|
||||
output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
|
||||
if (input_props && output_props && input_props != output_props) {
|
||||
snprintf(error, error_len,
|
||||
"Subtitle encoding currently only possible from text to text "
|
||||
"or bitmap to bitmap");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 0) {
|
||||
if (ret == AVERROR_EXPERIMENTAL)
|
||||
@@ -4242,8 +4189,7 @@ static int seek_to_start(InputFile *ifile, AVFormatContext *is)
|
||||
ifile->time_base = ist->st->time_base;
|
||||
/* the total duration of the stream, max_pts - min_pts is
|
||||
* the duration of the stream without the last frame */
|
||||
if (ist->max_pts > ist->min_pts && ist->max_pts - (uint64_t)ist->min_pts < INT64_MAX - duration)
|
||||
duration += ist->max_pts - ist->min_pts;
|
||||
duration += ist->max_pts - ist->min_pts;
|
||||
ifile->time_base = duration_max(duration, &ifile->duration, ist->st->time_base,
|
||||
ifile->time_base);
|
||||
}
|
||||
@@ -4358,11 +4304,9 @@ static int process_input(int file_index)
|
||||
if (ist->discard)
|
||||
goto discard_packet;
|
||||
|
||||
if (pkt.flags & AV_PKT_FLAG_CORRUPT) {
|
||||
av_log(NULL, exit_on_error ? AV_LOG_FATAL : AV_LOG_WARNING,
|
||||
"%s: corrupt input packet in stream %d\n", is->url, pkt.stream_index);
|
||||
if (exit_on_error)
|
||||
exit_program(1);
|
||||
if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->url, pkt.stream_index);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (debug_ts) {
|
||||
@@ -4797,30 +4741,23 @@ static int transcode(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BenchmarkTimeStamps get_benchmark_time_stamps(void)
|
||||
|
||||
static int64_t getutime(void)
|
||||
{
|
||||
BenchmarkTimeStamps time_stamps = { av_gettime_relative() };
|
||||
#if HAVE_GETRUSAGE
|
||||
struct rusage rusage;
|
||||
|
||||
getrusage(RUSAGE_SELF, &rusage);
|
||||
time_stamps.user_usec =
|
||||
(rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
|
||||
time_stamps.sys_usec =
|
||||
(rusage.ru_stime.tv_sec * 1000000LL) + rusage.ru_stime.tv_usec;
|
||||
return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
|
||||
#elif HAVE_GETPROCESSTIMES
|
||||
HANDLE proc;
|
||||
FILETIME c, e, k, u;
|
||||
proc = GetCurrentProcess();
|
||||
GetProcessTimes(proc, &c, &e, &k, &u);
|
||||
time_stamps.user_usec =
|
||||
((int64_t)u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
|
||||
time_stamps.sys_usec =
|
||||
((int64_t)k.dwHighDateTime << 32 | k.dwLowDateTime) / 10;
|
||||
return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
|
||||
#else
|
||||
time_stamps.user_usec = time_stamps.sys_usec = 0;
|
||||
return av_gettime_relative();
|
||||
#endif
|
||||
return time_stamps;
|
||||
}
|
||||
|
||||
static int64_t getmaxrss(void)
|
||||
@@ -4848,7 +4785,7 @@ static void log_callback_null(void *ptr, int level, const char *fmt, va_list vl)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, ret;
|
||||
BenchmarkTimeStamps ti;
|
||||
int64_t ti;
|
||||
|
||||
init_dynload();
|
||||
|
||||
@@ -4900,18 +4837,12 @@ int main(int argc, char **argv)
|
||||
want_sdp = 0;
|
||||
}
|
||||
|
||||
current_time = ti = get_benchmark_time_stamps();
|
||||
current_time = ti = getutime();
|
||||
if (transcode() < 0)
|
||||
exit_program(1);
|
||||
ti = getutime() - ti;
|
||||
if (do_benchmark) {
|
||||
int64_t utime, stime, rtime;
|
||||
current_time = get_benchmark_time_stamps();
|
||||
utime = current_time.user_usec - ti.user_usec;
|
||||
stime = current_time.sys_usec - ti.sys_usec;
|
||||
rtime = current_time.real_usec - ti.real_usec;
|
||||
av_log(NULL, AV_LOG_INFO,
|
||||
"bench: utime=%0.3fs stime=%0.3fs rtime=%0.3fs\n",
|
||||
utime / 1000000.0, stime / 1000000.0, rtime / 1000000.0);
|
||||
av_log(NULL, AV_LOG_INFO, "bench: utime=%0.3fs\n", ti / 1000000.0);
|
||||
}
|
||||
av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" frames successfully decoded, %"PRIu64" decoding errors\n",
|
||||
decode_error_stat[0], decode_error_stat[1]);
|
||||
|
||||
@@ -484,7 +484,6 @@ typedef struct OutputStream {
|
||||
AVRational frame_aspect_ratio;
|
||||
|
||||
/* forced key frames */
|
||||
int64_t forced_kf_ref_pts;
|
||||
int64_t *forced_kf_pts;
|
||||
int forced_kf_count;
|
||||
int forced_kf_index;
|
||||
|
||||
@@ -65,7 +65,6 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx, AVCod
|
||||
if (codec && codec->pix_fmts) {
|
||||
const enum AVPixelFormat *p = codec->pix_fmts;
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target);
|
||||
//FIXME: This should check for AV_PIX_FMT_FLAG_ALPHA after PAL8 pixel format without alpha is implemented
|
||||
int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
|
||||
enum AVPixelFormat best= AV_PIX_FMT_NONE;
|
||||
|
||||
@@ -775,7 +774,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
sar = ifilter->sample_aspect_ratio;
|
||||
if(!sar.den)
|
||||
sar = (AVRational){0,1};
|
||||
av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
av_bprint_init(&args, 0, 1);
|
||||
av_bprintf(&args,
|
||||
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
|
||||
"pixel_aspect=%d/%d:sws_param=flags=%d",
|
||||
|
||||
+8
-45
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* ffmpeg option parsing
|
||||
*
|
||||
@@ -901,14 +900,13 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
|
||||
static void assert_file_overwrite(const char *filename)
|
||||
{
|
||||
const char *proto_name = avio_find_protocol_name(filename);
|
||||
|
||||
if (file_overwrite && no_file_overwrite) {
|
||||
fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (!file_overwrite) {
|
||||
const char *proto_name = avio_find_protocol_name(filename);
|
||||
if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 0) == 0) {
|
||||
if (stdin_interaction && !no_file_overwrite) {
|
||||
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
|
||||
@@ -927,19 +925,6 @@ static void assert_file_overwrite(const char *filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (proto_name && !strcmp(proto_name, "file")) {
|
||||
for (int i = 0; i < nb_input_files; i++) {
|
||||
InputFile *file = input_files[i];
|
||||
if (file->ctx->iformat->flags & AVFMT_NOFILE)
|
||||
continue;
|
||||
if (!strcmp(filename, file->ctx->url)) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Output %s same as Input #%d - exiting\n", filename, i);
|
||||
av_log(NULL, AV_LOG_WARNING, "FFmpeg cannot edit existing files in-place.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_attachment(AVStream *st, const char *filename)
|
||||
@@ -1118,22 +1103,9 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
if (o->start_time != AV_NOPTS_VALUE && o->start_time_eof != AV_NOPTS_VALUE) {
|
||||
av_log(NULL, AV_LOG_WARNING, "Cannot use -ss and -sseof both, using -ss for %s\n", filename);
|
||||
o->start_time_eof = AV_NOPTS_VALUE;
|
||||
}
|
||||
|
||||
if (o->start_time_eof != AV_NOPTS_VALUE) {
|
||||
if (o->start_time_eof >= 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "-sseof value must be negative; aborting\n");
|
||||
exit_program(1);
|
||||
}
|
||||
if (ic->duration > 0) {
|
||||
if (ic->duration>0) {
|
||||
o->start_time = o->start_time_eof + ic->duration;
|
||||
if (o->start_time < 0) {
|
||||
av_log(NULL, AV_LOG_WARNING, "-sseof value seeks to before start of file %s; ignored\n", filename);
|
||||
o->start_time = AV_NOPTS_VALUE;
|
||||
}
|
||||
} else
|
||||
av_log(NULL, AV_LOG_WARNING, "Cannot use -sseof, duration of %s not known\n", filename);
|
||||
}
|
||||
@@ -1150,10 +1122,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
||||
int dts_heuristic = 0;
|
||||
for (i=0; i<ic->nb_streams; i++) {
|
||||
const AVCodecParameters *par = ic->streams[i]->codecpar;
|
||||
if (par->video_delay) {
|
||||
if (par->video_delay)
|
||||
dts_heuristic = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dts_heuristic) {
|
||||
seek_timestamp -= 3*AV_TIME_BASE / 23;
|
||||
@@ -1354,7 +1324,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
ost->file_index = nb_output_files - 1;
|
||||
ost->index = idx;
|
||||
ost->st = st;
|
||||
ost->forced_kf_ref_pts = AV_NOPTS_VALUE;
|
||||
st->codecpar->codec_type = type;
|
||||
|
||||
ret = choose_encoder(o, oc, ost);
|
||||
@@ -2333,14 +2302,12 @@ loop_end:
|
||||
o->attachments[i]);
|
||||
exit_program(1);
|
||||
}
|
||||
if (len > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE ||
|
||||
!(attachment = av_malloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Attachment %s too large.\n",
|
||||
if (!(attachment = av_malloc(len))) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Attachment %s too large to fit into memory.\n",
|
||||
o->attachments[i]);
|
||||
exit_program(1);
|
||||
}
|
||||
avio_read(pb, attachment, len);
|
||||
memset(attachment + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
ost = new_attachment_stream(o, oc, -1);
|
||||
ost->stream_copy = 0;
|
||||
@@ -2732,14 +2699,13 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
||||
} else {
|
||||
/* Try to determine PAL/NTSC by peeking in the input files */
|
||||
if (nb_input_files) {
|
||||
int i, j;
|
||||
int i, j, fr;
|
||||
for (j = 0; j < nb_input_files; j++) {
|
||||
for (i = 0; i < input_files[j]->nb_streams; i++) {
|
||||
AVStream *st = input_files[j]->ctx->streams[i];
|
||||
int64_t fr;
|
||||
if (st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
continue;
|
||||
fr = st->time_base.den * 1000LL / st->time_base.num;
|
||||
fr = st->time_base.den * 1000 / st->time_base.num;
|
||||
if (fr == 25000) {
|
||||
norm = PAL;
|
||||
break;
|
||||
@@ -3191,9 +3157,7 @@ void show_help_default(const char *opt, const char *arg)
|
||||
#if CONFIG_SWSCALE
|
||||
show_help_children(sws_get_class(), flags);
|
||||
#endif
|
||||
#if CONFIG_SWRESAMPLE
|
||||
show_help_children(swr_get_class(), AV_OPT_FLAG_AUDIO_PARAM);
|
||||
#endif
|
||||
show_help_children(avfilter_get_class(), AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM);
|
||||
show_help_children(av_bsf_get_class(), AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_BSF_PARAM);
|
||||
}
|
||||
@@ -3232,7 +3196,6 @@ static int open_files(OptionGroupList *l, const char *inout,
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error parsing options for %s file "
|
||||
"%s.\n", inout, g->arg);
|
||||
uninit_options(&o);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3374,7 +3337,7 @@ const OptionDef options[] = {
|
||||
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) },
|
||||
"set the start time offset", "time_off" },
|
||||
{ "sseof", HAS_ARG | OPT_TIME | OPT_OFFSET |
|
||||
OPT_INPUT, { .off = OFFSET(start_time_eof) },
|
||||
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time_eof) },
|
||||
"set the start time offset relative to EOF", "time_off" },
|
||||
{ "seek_timestamp", HAS_ARG | OPT_INT | OPT_OFFSET |
|
||||
OPT_INPUT, { .off = OFFSET(seek_timestamp) },
|
||||
|
||||
@@ -93,7 +93,7 @@ int qsv_init(AVCodecContext *s)
|
||||
frames_ctx->height = FFALIGN(s->coded_height, 32);
|
||||
frames_ctx->format = AV_PIX_FMT_QSV;
|
||||
frames_ctx->sw_format = s->sw_pix_fmt;
|
||||
frames_ctx->initial_pool_size = 64 + s->extra_hw_frames;
|
||||
frames_ctx->initial_pool_size = 64;
|
||||
frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
|
||||
|
||||
ret = av_hwframe_ctx_init(ist->hw_frames_ctx);
|
||||
|
||||
+10
-35
@@ -314,14 +314,11 @@ static int default_width = 640;
|
||||
static int default_height = 480;
|
||||
static int screen_width = 0;
|
||||
static int screen_height = 0;
|
||||
static int screen_left = SDL_WINDOWPOS_CENTERED;
|
||||
static int screen_top = SDL_WINDOWPOS_CENTERED;
|
||||
static int audio_disable;
|
||||
static int video_disable;
|
||||
static int subtitle_disable;
|
||||
static const char* wanted_stream_spec[AVMEDIA_TYPE_NB] = {0};
|
||||
static int seek_by_bytes = -1;
|
||||
static float seek_interval = 10;
|
||||
static int display_disable;
|
||||
static int borderless;
|
||||
static int startup_volume = 100;
|
||||
@@ -957,22 +954,6 @@ static int upload_texture(SDL_Texture **tex, AVFrame *frame, struct SwsContext *
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void set_sdl_yuv_conversion_mode(AVFrame *frame)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2,0,8)
|
||||
SDL_YUV_CONVERSION_MODE mode = SDL_YUV_CONVERSION_AUTOMATIC;
|
||||
if (frame && (frame->format == AV_PIX_FMT_YUV420P || frame->format == AV_PIX_FMT_YUYV422 || frame->format == AV_PIX_FMT_UYVY422)) {
|
||||
if (frame->color_range == AVCOL_RANGE_JPEG)
|
||||
mode = SDL_YUV_CONVERSION_JPEG;
|
||||
else if (frame->colorspace == AVCOL_SPC_BT709)
|
||||
mode = SDL_YUV_CONVERSION_BT709;
|
||||
else if (frame->colorspace == AVCOL_SPC_BT470BG || frame->colorspace == AVCOL_SPC_SMPTE170M || frame->colorspace == AVCOL_SPC_SMPTE240M)
|
||||
mode = SDL_YUV_CONVERSION_BT601;
|
||||
}
|
||||
SDL_SetYUVConversionMode(mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void video_image_display(VideoState *is)
|
||||
{
|
||||
Frame *vp;
|
||||
@@ -1034,9 +1015,7 @@ static void video_image_display(VideoState *is)
|
||||
vp->flip_v = vp->frame->linesize[0] < 0;
|
||||
}
|
||||
|
||||
set_sdl_yuv_conversion_mode(vp->frame);
|
||||
SDL_RenderCopyEx(renderer, is->vid_texture, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0);
|
||||
set_sdl_yuv_conversion_mode(NULL);
|
||||
if (sp) {
|
||||
#if USE_ONEPASS_SUBTITLE_RENDER
|
||||
SDL_RenderCopy(renderer, is->sub_texture, NULL, &rect);
|
||||
@@ -1348,7 +1327,7 @@ static int video_open(VideoState *is)
|
||||
SDL_SetWindowTitle(window, window_title);
|
||||
|
||||
SDL_SetWindowSize(window, w, h);
|
||||
SDL_SetWindowPosition(window, screen_left, screen_top);
|
||||
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||
if (is_full_screen)
|
||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
SDL_ShowWindow(window);
|
||||
@@ -2214,8 +2193,6 @@ static int video_thread(void *arg)
|
||||
ret = queue_picture(is, frame, pts, duration, frame->pkt_pos, is->viddec.pkt_serial);
|
||||
av_frame_unref(frame);
|
||||
#if CONFIG_AVFILTER
|
||||
if (is->videoq.serial != is->viddec.pkt_serial)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2601,7 +2578,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
if (forced_codec_name) av_log(NULL, AV_LOG_WARNING,
|
||||
"No codec could be found with name '%s'\n", forced_codec_name);
|
||||
else av_log(NULL, AV_LOG_WARNING,
|
||||
"No decoder could be found for codec %s\n", avcodec_get_name(avctx->codec_id));
|
||||
"No codec could be found with id %d\n", avctx->codec_id);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
@@ -3274,14 +3251,15 @@ static void event_loop(VideoState *cur_stream)
|
||||
refresh_loop_wait_event(cur_stream, &event);
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
if (exit_on_keydown || event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_q) {
|
||||
if (exit_on_keydown) {
|
||||
do_exit(cur_stream);
|
||||
break;
|
||||
}
|
||||
// If we don't yet have a window, skip all key events, because read_thread might still be initializing...
|
||||
if (!cur_stream->width)
|
||||
continue;
|
||||
switch (event.key.keysym.sym) {
|
||||
case SDLK_ESCAPE:
|
||||
case SDLK_q:
|
||||
do_exit(cur_stream);
|
||||
break;
|
||||
case SDLK_f:
|
||||
toggle_full_screen(cur_stream);
|
||||
cur_stream->force_refresh = 1;
|
||||
@@ -3346,10 +3324,10 @@ static void event_loop(VideoState *cur_stream)
|
||||
seek_chapter(cur_stream, -1);
|
||||
break;
|
||||
case SDLK_LEFT:
|
||||
incr = seek_interval ? -seek_interval : -10.0;
|
||||
incr = -10.0;
|
||||
goto do_seek;
|
||||
case SDLK_RIGHT:
|
||||
incr = seek_interval ? seek_interval : 10.0;
|
||||
incr = 10.0;
|
||||
goto do_seek;
|
||||
case SDLK_UP:
|
||||
incr = 60.0;
|
||||
@@ -3585,7 +3563,6 @@ static const OptionDef options[] = {
|
||||
{ "ss", HAS_ARG, { .func_arg = opt_seek }, "seek to a given position in seconds", "pos" },
|
||||
{ "t", HAS_ARG, { .func_arg = opt_duration }, "play \"duration\" seconds of audio/video", "duration" },
|
||||
{ "bytes", OPT_INT | HAS_ARG, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
|
||||
{ "seek_interval", OPT_FLOAT | HAS_ARG, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
|
||||
{ "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" },
|
||||
{ "noborder", OPT_BOOL, { &borderless }, "borderless window" },
|
||||
{ "volume", OPT_INT | HAS_ARG, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
|
||||
@@ -3604,8 +3581,6 @@ static const OptionDef options[] = {
|
||||
{ "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
|
||||
{ "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
|
||||
{ "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", "window title" },
|
||||
{ "left", OPT_INT | HAS_ARG | OPT_EXPERT, { &screen_left }, "set the x position for the left of the window", "x pos" },
|
||||
{ "top", OPT_INT | HAS_ARG | OPT_EXPERT, { &screen_top }, "set the y position for the top of the window", "y pos" },
|
||||
#if CONFIG_AVFILTER
|
||||
{ "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
|
||||
{ "af", OPT_STRING | HAS_ARG, { &afilters }, "set audio filters", "filter_graph" },
|
||||
@@ -3658,7 +3633,7 @@ void show_help_default(const char *opt, const char *arg)
|
||||
"c cycle program\n"
|
||||
"w cycle video filters or show modes\n"
|
||||
"s activate frame-step mode\n"
|
||||
"left/right seek backward/forward 10 seconds or to custom interval if -seek_interval is set\n"
|
||||
"left/right seek backward/forward 10 seconds\n"
|
||||
"down/up seek backward/forward 1 minute\n"
|
||||
"page down/page up seek backward/forward 10 minutes\n"
|
||||
"right mouse click seek to percentage in file corresponding to fraction of width\n"
|
||||
|
||||
+2
-2
@@ -131,8 +131,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
||||
u = x/2 + (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
||||
v = x/2 + (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
||||
memcpy(y, y_temp, sizeof(*y) * (width - x));
|
||||
memcpy(u, u_temp, sizeof(*u) * ((width - x + 1) / 2));
|
||||
memcpy(v, v_temp, sizeof(*v) * ((width - x + 1) / 2));
|
||||
memcpy(u, u_temp, sizeof(*u) * (width - x + 1) / 2);
|
||||
memcpy(v, v_temp, sizeof(*v) * (width - x + 1) / 2);
|
||||
}
|
||||
|
||||
line_end += stride;
|
||||
|
||||
+5
-11
@@ -158,7 +158,7 @@ typedef struct FourXContext {
|
||||
#define FIX_1_847759065 121095
|
||||
#define FIX_2_613125930 171254
|
||||
|
||||
#define MULTIPLY(var, const) ((int)((var) * (unsigned)(const)) >> 16)
|
||||
#define MULTIPLY(var, const) (((var) * (const)) >> 16)
|
||||
|
||||
static void idct(int16_t block[64])
|
||||
{
|
||||
@@ -351,8 +351,6 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
|
||||
index = size2index[log2h][log2w];
|
||||
av_assert0(index >= 0);
|
||||
|
||||
if (get_bits_left(&f->gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
h = 1 << log2h;
|
||||
code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index].table,
|
||||
BLOCK_TYPE_VLC_BITS, 1);
|
||||
@@ -498,9 +496,9 @@ static int decode_i_block(FourXContext *f, int16_t *block)
|
||||
{
|
||||
int code, i, j, level, val;
|
||||
|
||||
if (get_bits_left(&f->pre_gb) < 2) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->pre_gb));
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits_left(&f->gb) < 2){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->gb));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* DC coef */
|
||||
@@ -525,10 +523,6 @@ static int decode_i_block(FourXContext *f, int16_t *block)
|
||||
break;
|
||||
if (code == 0xf0) {
|
||||
i += 16;
|
||||
if (i >= 64) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "run %d overflow\n", i);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (code & 0xf) {
|
||||
level = get_xbits(&f->gb, code & 0xf);
|
||||
@@ -738,7 +732,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
for (x = 0; x < width; x += 16) {
|
||||
unsigned int color[4] = { 0 }, bits;
|
||||
if (buf_end - buf < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
return -1;
|
||||
// warning following is purely guessed ...
|
||||
color[0] = bytestream2_get_le16u(&g3);
|
||||
color[1] = bytestream2_get_le16u(&g3);
|
||||
|
||||
@@ -70,9 +70,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
unsigned char *planemap = c->planemap;
|
||||
int ret;
|
||||
|
||||
if (buf_size < planes * height *2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
+9
-28
@@ -44,7 +44,6 @@ OBJS = ac3_parser.o \
|
||||
options.o \
|
||||
mjpegenc_huffman.o \
|
||||
parser.o \
|
||||
parsers.o \
|
||||
profiles.o \
|
||||
qsv_api.o \
|
||||
raw.o \
|
||||
@@ -63,12 +62,9 @@ OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o
|
||||
OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o
|
||||
OBJS-$(CONFIG_CABAC) += cabac.o
|
||||
OBJS-$(CONFIG_CBS) += cbs.o
|
||||
OBJS-$(CONFIG_CBS_AV1) += cbs_av1.o
|
||||
OBJS-$(CONFIG_CBS_H264) += cbs_h2645.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H265) += cbs_h2645.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_JPEG) += cbs_jpeg.o
|
||||
OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o
|
||||
OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
|
||||
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
|
||||
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
|
||||
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
|
||||
@@ -213,7 +209,6 @@ OBJS-$(CONFIG_ATRAC3P_DECODER) += atrac3plusdec.o atrac3plus.o \
|
||||
atrac3plusdsp.o atrac.o
|
||||
OBJS-$(CONFIG_ATRAC3PAL_DECODER) += atrac3plusdec.o atrac3plus.o \
|
||||
atrac3plusdsp.o atrac.o
|
||||
OBJS-$(CONFIG_ATRAC9_DECODER) += atrac9dec.o
|
||||
OBJS-$(CONFIG_AURA_DECODER) += cyuv.o
|
||||
OBJS-$(CONFIG_AURA2_DECODER) += aura.o
|
||||
OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o mjpegdec.o
|
||||
@@ -356,7 +351,7 @@ OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o
|
||||
OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec_h2645.o
|
||||
OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o
|
||||
OBJS-$(CONFIG_H264_RKMPP_DECODER) += rkmppdec.o
|
||||
OBJS-$(CONFIG_H264_VAAPI_ENCODER) += vaapi_encode_h264.o h264_levels.o
|
||||
OBJS-$(CONFIG_H264_VAAPI_ENCODER) += vaapi_encode_h264.o
|
||||
OBJS-$(CONFIG_H264_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
|
||||
OBJS-$(CONFIG_H264_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
||||
OBJS-$(CONFIG_H264_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
|
||||
@@ -374,7 +369,7 @@ OBJS-$(CONFIG_HEVC_QSV_DECODER) += qsvdec_h2645.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o \
|
||||
hevc_data.o
|
||||
OBJS-$(CONFIG_HEVC_RKMPP_DECODER) += rkmppdec.o
|
||||
OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o h265_profile_level.o
|
||||
OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o
|
||||
OBJS-$(CONFIG_HEVC_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
||||
OBJS-$(CONFIG_HEVC_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
|
||||
OBJS-$(CONFIG_HNM4_VIDEO_DECODER) += hnm4video.o
|
||||
@@ -386,9 +381,7 @@ OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
|
||||
OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o
|
||||
OBJS-$(CONFIG_IDF_DECODER) += bintext.o cga_data.o
|
||||
OBJS-$(CONFIG_IFF_ILBM_DECODER) += iff.o
|
||||
OBJS-$(CONFIG_ILBC_DECODER) += ilbcdec.o
|
||||
OBJS-$(CONFIG_IMC_DECODER) += imc.o
|
||||
OBJS-$(CONFIG_IMM4_DECODER) += imm4.o
|
||||
OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o
|
||||
OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o
|
||||
OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o
|
||||
@@ -485,7 +478,6 @@ OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
|
||||
OBJS-$(CONFIG_MTS2_DECODER) += mss4.o
|
||||
OBJS-$(CONFIG_MVC1_DECODER) += mvcdec.o
|
||||
OBJS-$(CONFIG_MVC2_DECODER) += mvcdec.o
|
||||
OBJS-$(CONFIG_MWSC_DECODER) += mwsc.o
|
||||
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o
|
||||
@@ -516,10 +508,10 @@ OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
|
||||
OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o
|
||||
OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o
|
||||
OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o proresdsp.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_LGPL_DECODER) += proresdec_lgpl.o proresdsp.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o
|
||||
OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o
|
||||
OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o
|
||||
OBJS-$(CONFIG_PROSUMER_DECODER) += prosumer.o
|
||||
OBJS-$(CONFIG_PSD_DECODER) += psd.o
|
||||
OBJS-$(CONFIG_PTX_DECODER) += ptx.o
|
||||
OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \
|
||||
@@ -539,7 +531,6 @@ OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o
|
||||
OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o
|
||||
OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_filters.o
|
||||
OBJS-$(CONFIG_RALF_DECODER) += ralf.o
|
||||
OBJS-$(CONFIG_RASC_DECODER) += rasc.o
|
||||
OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o
|
||||
OBJS-$(CONFIG_RAWVIDEO_ENCODER) += rawenc.o
|
||||
OBJS-$(CONFIG_REALTEXT_DECODER) += realtextdec.o ass.o
|
||||
@@ -583,7 +574,7 @@ OBJS-$(CONFIG_SOL_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_SONIC_DECODER) += sonic.o
|
||||
OBJS-$(CONFIG_SONIC_ENCODER) += sonic.o
|
||||
OBJS-$(CONFIG_SONIC_LS_ENCODER) += sonic.o
|
||||
OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o mpeg12.o mpeg12data.o simple_idct.o
|
||||
OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o simple_idct.o
|
||||
OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o
|
||||
OBJS-$(CONFIG_SRGC_DECODER) += mscc.o
|
||||
OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o htmlsubtitles.o
|
||||
@@ -681,7 +672,6 @@ OBJS-$(CONFIG_VP9_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
||||
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
|
||||
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
|
||||
OBJS-$(CONFIG_WAVPACK_ENCODER) += wavpackenc.o
|
||||
OBJS-$(CONFIG_WCMV_DECODER) += wcmv.o
|
||||
OBJS-$(CONFIG_WEBP_DECODER) += webp.o
|
||||
OBJS-$(CONFIG_WEBVTT_DECODER) += webvttdec.o ass.o
|
||||
OBJS-$(CONFIG_WEBVTT_ENCODER) += webvttenc.o ass_split.o
|
||||
@@ -794,8 +784,6 @@ OBJS-$(CONFIG_PCM_U32BE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U32BE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U32LE_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_U32LE_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_VIDC_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_VIDC_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_ZORK_DECODER) += pcm.o
|
||||
|
||||
OBJS-$(CONFIG_ADPCM_4XM_DECODER) += adpcm.o adpcm_data.o
|
||||
@@ -956,7 +944,6 @@ OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o
|
||||
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
|
||||
OBJS-$(CONFIG_LIBCODEC2_DECODER) += libcodec2.o codec2utils.o
|
||||
OBJS-$(CONFIG_LIBCODEC2_ENCODER) += libcodec2.o codec2utils.o
|
||||
OBJS-$(CONFIG_LIBDAVS2_DECODER) += libdavs2.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
|
||||
OBJS-$(CONFIG_LIBGSM_DECODER) += libgsmdec.o
|
||||
@@ -998,8 +985,7 @@ OBJS-$(CONFIG_LIBX262_ENCODER) += libx264.o
|
||||
OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
|
||||
OBJS-$(CONFIG_LIBX265_ENCODER) += libx265.o
|
||||
OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
|
||||
OBJS-$(CONFIG_LIBXAVS2_ENCODER) += libxavs2.o
|
||||
OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o
|
||||
OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o libxvid_rc.o
|
||||
OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o
|
||||
|
||||
# parsers
|
||||
@@ -1008,8 +994,6 @@ OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
|
||||
mpeg4audio.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
|
||||
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o av1_parse.o
|
||||
OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
|
||||
OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
|
||||
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
|
||||
OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
|
||||
@@ -1056,15 +1040,14 @@ OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o
|
||||
|
||||
# bitstream filters
|
||||
OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_AV1_METADATA_BSF) += av1_metadata_bsf.o
|
||||
OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o
|
||||
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
|
||||
OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o
|
||||
OBJS-$(CONFIG_EAC3_CORE_BSF) += eac3_core_bsf.o
|
||||
OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o \
|
||||
av1_parse.o h2645_parse.o
|
||||
h2645_parse.o
|
||||
OBJS-$(CONFIG_FILTER_UNITS_BSF) += filter_units_bsf.o
|
||||
OBJS-$(CONFIG_H264_METADATA_BSF) += h264_metadata_bsf.o h264_levels.o
|
||||
OBJS-$(CONFIG_H264_METADATA_BSF) += h264_metadata_bsf.o
|
||||
OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
|
||||
OBJS-$(CONFIG_H264_REDUNDANT_PPS_BSF) += h264_redundant_pps_bsf.o
|
||||
OBJS-$(CONFIG_HAPQA_EXTRACT_BSF) += hapqa_extract_bsf.o hap.o
|
||||
@@ -1083,7 +1066,6 @@ OBJS-$(CONFIG_NULL_BSF) += null_bsf.o
|
||||
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o
|
||||
OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
|
||||
OBJS-$(CONFIG_TRACE_HEADERS_BSF) += trace_headers_bsf.o
|
||||
OBJS-$(CONFIG_VP9_METADATA_BSF) += vp9_metadata_bsf.o
|
||||
OBJS-$(CONFIG_VP9_RAW_REORDER_BSF) += vp9_raw_reorder_bsf.o
|
||||
OBJS-$(CONFIG_VP9_SUPERFRAME_BSF) += vp9_superframe_bsf.o
|
||||
OBJS-$(CONFIG_VP9_SUPERFRAME_SPLIT_BSF) += vp9_superframe_split_bsf.o
|
||||
@@ -1145,7 +1127,6 @@ TESTPROGS-$(CONFIG_IDCTDSP) += dct
|
||||
TESTPROGS-$(CONFIG_IIRFILTER) += iirfilter
|
||||
TESTPROGS-$(HAVE_MMX) += motion
|
||||
TESTPROGS-$(CONFIG_MPEGVIDEO) += mpeg12framerate
|
||||
TESTPROGS-$(CONFIG_H264_METADATA_BSF) += h264_levels
|
||||
TESTPROGS-$(CONFIG_RANGECODER) += rangecoder
|
||||
TESTPROGS-$(CONFIG_SNOW_ENCODER) += snowenc
|
||||
|
||||
|
||||
@@ -843,25 +843,25 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
|
||||
sce0->ics.swb_sizes[g],
|
||||
sce0->sf_idx[w*16+g],
|
||||
sce0->band_type[w*16+g],
|
||||
lambda / (band0->threshold + FLT_MIN), INFINITY, &b1, NULL, 0);
|
||||
lambda / band0->threshold, INFINITY, &b1, NULL, 0);
|
||||
dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],
|
||||
R34,
|
||||
sce1->ics.swb_sizes[g],
|
||||
sce1->sf_idx[w*16+g],
|
||||
sce1->band_type[w*16+g],
|
||||
lambda / (band1->threshold + FLT_MIN), INFINITY, &b2, NULL, 0);
|
||||
lambda / band1->threshold, INFINITY, &b2, NULL, 0);
|
||||
dist2 += quantize_band_cost(s, M,
|
||||
M34,
|
||||
sce0->ics.swb_sizes[g],
|
||||
mididx,
|
||||
midcb,
|
||||
lambda / (minthr + FLT_MIN), INFINITY, &b3, NULL, 0);
|
||||
lambda / minthr, INFINITY, &b3, NULL, 0);
|
||||
dist2 += quantize_band_cost(s, S,
|
||||
S34,
|
||||
sce1->ics.swb_sizes[g],
|
||||
sididx,
|
||||
sidcb,
|
||||
mslambda / (minthr * bmax + FLT_MIN), INFINITY, &b4, NULL, 0);
|
||||
mslambda / (minthr * bmax), INFINITY, &b4, NULL, 0);
|
||||
B0 += b1+b2;
|
||||
B1 += b3+b4;
|
||||
dist1 -= b1+b2;
|
||||
|
||||
+2
-4
@@ -411,8 +411,6 @@ static int read_stream_mux_config(struct LATMContext *latmctx,
|
||||
} else {
|
||||
int esc;
|
||||
do {
|
||||
if (get_bits_left(gb) < 9)
|
||||
return AVERROR_INVALIDDATA;
|
||||
esc = get_bits(gb, 1);
|
||||
skip_bits(gb, 8);
|
||||
} while (esc);
|
||||
@@ -563,7 +561,7 @@ AVCodec ff_aac_decoder = {
|
||||
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
.channel_layouts = aac_channel_layout,
|
||||
.flush = flush,
|
||||
.priv_class = &aac_decoder_class,
|
||||
@@ -588,7 +586,7 @@ AVCodec ff_aac_latm_decoder = {
|
||||
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
.channel_layouts = aac_channel_layout,
|
||||
.flush = flush,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
|
||||
@@ -155,9 +155,9 @@ static void vector_pow43(int *coefs, int len)
|
||||
for (i=0; i<len; i++) {
|
||||
coef = coefs[i];
|
||||
if (coef < 0)
|
||||
coef = -(int)ff_cbrt_tab_fixed[(-coef) & 8191];
|
||||
coef = -(int)ff_cbrt_tab_fixed[-coef];
|
||||
else
|
||||
coef = (int)ff_cbrt_tab_fixed[ coef & 8191];
|
||||
coef = (int)ff_cbrt_tab_fixed[coef];
|
||||
coefs[i] = coef;
|
||||
}
|
||||
}
|
||||
@@ -195,12 +195,12 @@ static void subband_scale(int *dst, int *src, int scale, int offset, int len)
|
||||
|
||||
static void noise_scale(int *coefs, int scale, int band_energy, int len)
|
||||
{
|
||||
int s = -scale;
|
||||
int ssign = scale < 0 ? -1 : 1;
|
||||
int s = FFABS(scale);
|
||||
unsigned int round;
|
||||
int i, out, c = exp2tab[s & 3];
|
||||
int nlz = 0;
|
||||
|
||||
av_assert0(s >= 0);
|
||||
while (band_energy > 0x7fff) {
|
||||
band_energy >>= 1;
|
||||
nlz++;
|
||||
@@ -216,20 +216,15 @@ static void noise_scale(int *coefs, int scale, int band_energy, int len)
|
||||
round = s ? 1 << (s-1) : 0;
|
||||
for (i=0; i<len; i++) {
|
||||
out = (int)(((int64_t)coefs[i] * c) >> 32);
|
||||
coefs[i] = -((int)(out+round) >> s);
|
||||
coefs[i] = ((int)(out+round) >> s) * ssign;
|
||||
}
|
||||
}
|
||||
else {
|
||||
s = s + 32;
|
||||
if (s > 0) {
|
||||
round = 1 << (s-1);
|
||||
for (i=0; i<len; i++) {
|
||||
out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s);
|
||||
coefs[i] = -out;
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<len; i++)
|
||||
coefs[i] = -(int64_t)coefs[i] * c * (1 << -s);
|
||||
round = 1 << (s-1);
|
||||
for (i=0; i<len; i++) {
|
||||
out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s);
|
||||
coefs[i] = out * ssign;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1157,9 +1157,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
AACContext *ac = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
if (avctx->sample_rate > 96000)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = ff_thread_once(&aac_table_init, &aac_static_table_init);
|
||||
if (ret != 0)
|
||||
return AVERROR_UNKNOWN;
|
||||
@@ -1676,24 +1673,25 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
|
||||
}
|
||||
} else if (cbt_m1 == NOISE_BT - 1) {
|
||||
for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
|
||||
#if !USE_FIXED
|
||||
float scale;
|
||||
#endif /* !USE_FIXED */
|
||||
INTFLOAT band_energy;
|
||||
#if USE_FIXED
|
||||
|
||||
for (k = 0; k < off_len; k++) {
|
||||
ac->random_state = lcg_random(ac->random_state);
|
||||
#if USE_FIXED
|
||||
cfo[k] = ac->random_state >> 3;
|
||||
#else
|
||||
cfo[k] = ac->random_state;
|
||||
#endif /* USE_FIXED */
|
||||
}
|
||||
|
||||
#if USE_FIXED
|
||||
band_energy = ac->fdsp->scalarproduct_fixed(cfo, cfo, off_len);
|
||||
band_energy = fixed_sqrt(band_energy, 31);
|
||||
noise_scale(cfo, sf[idx], band_energy, off_len);
|
||||
#else
|
||||
float scale;
|
||||
|
||||
for (k = 0; k < off_len; k++) {
|
||||
ac->random_state = lcg_random(ac->random_state);
|
||||
cfo[k] = ac->random_state;
|
||||
}
|
||||
|
||||
band_energy = ac->fdsp->scalarproduct_float(cfo, cfo, off_len);
|
||||
scale = sf[idx] / sqrtf(band_energy);
|
||||
ac->fdsp->vector_fmul_scalar(cfo, cfo, scale, off_len);
|
||||
@@ -2495,9 +2493,6 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
|
||||
INTFLOAT tmp[TNS_MAX_ORDER+1];
|
||||
UINTFLOAT *coef = coef_param;
|
||||
|
||||
if(!mmm)
|
||||
return;
|
||||
|
||||
for (w = 0; w < ics->num_windows; w++) {
|
||||
bottom = ics->num_swb;
|
||||
for (filt = 0; filt < tns->n_filt[w]; filt++) {
|
||||
@@ -2662,7 +2657,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
|
||||
ac->mdct.imdct_half(&ac->mdct, buf, in);
|
||||
#if USE_FIXED
|
||||
for (i=0; i<1024; i++)
|
||||
buf[i] = (buf[i] + 4LL) >> 3;
|
||||
buf[i] = (buf[i] + 4) >> 3;
|
||||
#endif /* USE_FIXED */
|
||||
}
|
||||
|
||||
@@ -2807,7 +2802,7 @@ static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
|
||||
|
||||
static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
|
||||
{
|
||||
UINTFLOAT *in = sce->coeffs;
|
||||
INTFLOAT *in = sce->coeffs;
|
||||
INTFLOAT *out = sce->ret;
|
||||
INTFLOAT *saved = sce->saved;
|
||||
INTFLOAT *buf = ac->buf_mdct;
|
||||
@@ -3127,7 +3122,6 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
int samples = 0, multiplier, audio_found = 0, pce_found = 0;
|
||||
int is_dmono, sce_count = 0;
|
||||
int payload_alignment;
|
||||
uint8_t che_presence[4][MAX_ELEM_ID] = {{0}};
|
||||
|
||||
ac->frame = data;
|
||||
|
||||
@@ -3165,17 +3159,6 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
|
||||
if (elem_type < TYPE_DSE) {
|
||||
if (che_presence[elem_type][elem_id]) {
|
||||
int error = che_presence[elem_type][elem_id] > 1;
|
||||
av_log(ac->avctx, error ? AV_LOG_ERROR : AV_LOG_DEBUG, "channel element %d.%d duplicate\n",
|
||||
elem_type, elem_id);
|
||||
if (error) {
|
||||
err = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
che_presence[elem_type][elem_id]++;
|
||||
|
||||
if (!(che=get_che(ac, elem_type, elem_id))) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
|
||||
elem_type, elem_id);
|
||||
@@ -3341,14 +3324,20 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
AV_PKT_DATA_JP_DUALMONO,
|
||||
&jp_dualmono_size);
|
||||
|
||||
if (new_extradata) {
|
||||
/* discard previous configuration */
|
||||
ac->oc[1].status = OC_NONE;
|
||||
err = decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
|
||||
new_extradata,
|
||||
new_extradata_size * 8LL, 1);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
if (new_extradata && 0) {
|
||||
av_free(avctx->extradata);
|
||||
avctx->extradata = av_mallocz(new_extradata_size +
|
||||
AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!avctx->extradata)
|
||||
return AVERROR(ENOMEM);
|
||||
avctx->extradata_size = new_extradata_size;
|
||||
memcpy(avctx->extradata, new_extradata, new_extradata_size);
|
||||
push_output_configuration(ac);
|
||||
if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
|
||||
avctx->extradata,
|
||||
avctx->extradata_size*8LL, 1) < 0) {
|
||||
pop_output_configuration(ac);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-7
@@ -28,7 +28,6 @@
|
||||
* TODOs:
|
||||
* add sane pulse detection
|
||||
***********************************/
|
||||
#include <float.h>
|
||||
|
||||
#include "libavutil/libm.h"
|
||||
#include "libavutil/thread.h"
|
||||
@@ -856,7 +855,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
/* Not so fast though */
|
||||
ratio = sqrtf(ratio);
|
||||
}
|
||||
s->lambda = av_clipf(s->lambda * ratio, FLT_EPSILON, 65536.f);
|
||||
s->lambda = FFMIN(s->lambda * ratio, 65536.f);
|
||||
|
||||
/* Keep iterating if we must reduce and lambda is in the sky */
|
||||
if (ratio > 0.9f && ratio < 1.1f) {
|
||||
@@ -901,7 +900,7 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
|
||||
{
|
||||
AACEncContext *s = avctx->priv_data;
|
||||
|
||||
av_log(avctx, AV_LOG_INFO, "Qavg: %.3f\n", s->lambda_count ? s->lambda_sum / s->lambda_count : NAN);
|
||||
av_log(avctx, AV_LOG_INFO, "Qavg: %.3f\n", s->lambda_sum / s->lambda_count);
|
||||
|
||||
ff_mdct_end(&s->mdct1024);
|
||||
ff_mdct_end(&s->mdct128);
|
||||
@@ -983,13 +982,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
if (s->needs_pce) {
|
||||
char buf[64];
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(aac_pce_configs); i++)
|
||||
if (avctx->channel_layout == aac_pce_configs[i].layout)
|
||||
break;
|
||||
av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
|
||||
ERROR_IF(i == FF_ARRAY_ELEMS(aac_pce_configs), "Unsupported channel layout \"%s\"\n", buf);
|
||||
av_log(avctx, AV_LOG_INFO, "Using a PCE to encode channel layout \"%s\"\n", buf);
|
||||
ERROR_IF(i == FF_ARRAY_ELEMS(aac_pce_configs), "Unsupported channel layout\n");
|
||||
av_log(avctx, AV_LOG_INFO, "Using a PCE to encode channel layout\n");
|
||||
s->pce = aac_pce_configs[i];
|
||||
s->reorder_map = s->pce.reorder_map;
|
||||
s->chan_map = s->pce.config_map;
|
||||
|
||||
+18
-18
@@ -414,33 +414,33 @@ static void hybrid_synthesis(PSDSPContext *dsp, INTFLOAT out[2][38][64],
|
||||
memset(out[0][n], 0, 5*sizeof(out[0][n][0]));
|
||||
memset(out[1][n], 0, 5*sizeof(out[1][n][0]));
|
||||
for (i = 0; i < 12; i++) {
|
||||
out[0][n][0] += (UINTFLOAT)in[ i][n][0];
|
||||
out[1][n][0] += (UINTFLOAT)in[ i][n][1];
|
||||
out[0][n][0] += in[ i][n][0];
|
||||
out[1][n][0] += in[ i][n][1];
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
out[0][n][1] += (UINTFLOAT)in[12+i][n][0];
|
||||
out[1][n][1] += (UINTFLOAT)in[12+i][n][1];
|
||||
out[0][n][1] += in[12+i][n][0];
|
||||
out[1][n][1] += in[12+i][n][1];
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
out[0][n][2] += (UINTFLOAT)in[20+i][n][0];
|
||||
out[1][n][2] += (UINTFLOAT)in[20+i][n][1];
|
||||
out[0][n][3] += (UINTFLOAT)in[24+i][n][0];
|
||||
out[1][n][3] += (UINTFLOAT)in[24+i][n][1];
|
||||
out[0][n][4] += (UINTFLOAT)in[28+i][n][0];
|
||||
out[1][n][4] += (UINTFLOAT)in[28+i][n][1];
|
||||
out[0][n][2] += in[20+i][n][0];
|
||||
out[1][n][2] += in[20+i][n][1];
|
||||
out[0][n][3] += in[24+i][n][0];
|
||||
out[1][n][3] += in[24+i][n][1];
|
||||
out[0][n][4] += in[28+i][n][0];
|
||||
out[1][n][4] += in[28+i][n][1];
|
||||
}
|
||||
}
|
||||
dsp->hybrid_synthesis_deint(out, in + 27, 5, len);
|
||||
} else {
|
||||
for (n = 0; n < len; n++) {
|
||||
out[0][n][0] = (UINTFLOAT)in[0][n][0] + in[1][n][0] + in[2][n][0] +
|
||||
(UINTFLOAT)in[3][n][0] + in[4][n][0] + in[5][n][0];
|
||||
out[1][n][0] = (UINTFLOAT)in[0][n][1] + in[1][n][1] + in[2][n][1] +
|
||||
(UINTFLOAT)in[3][n][1] + in[4][n][1] + in[5][n][1];
|
||||
out[0][n][1] = (UINTFLOAT)in[6][n][0] + in[7][n][0];
|
||||
out[1][n][1] = (UINTFLOAT)in[6][n][1] + in[7][n][1];
|
||||
out[0][n][2] = (UINTFLOAT)in[8][n][0] + in[9][n][0];
|
||||
out[1][n][2] = (UINTFLOAT)in[8][n][1] + in[9][n][1];
|
||||
out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] +
|
||||
in[3][n][0] + in[4][n][0] + in[5][n][0];
|
||||
out[1][n][0] = in[0][n][1] + in[1][n][1] + in[2][n][1] +
|
||||
in[3][n][1] + in[4][n][1] + in[5][n][1];
|
||||
out[0][n][1] = in[6][n][0] + in[7][n][0];
|
||||
out[1][n][1] = in[6][n][1] + in[7][n][1];
|
||||
out[0][n][2] = in[8][n][0] + in[9][n][0];
|
||||
out[1][n][2] = in[8][n][1] + in[9][n][1];
|
||||
}
|
||||
dsp->hybrid_synthesis_deint(out, in + 7, 3, len);
|
||||
}
|
||||
|
||||
@@ -54,10 +54,10 @@ static void ps_hybrid_analysis_c(INTFLOAT (*out)[2], INTFLOAT (*in)[2],
|
||||
INT64FLOAT sum_im = (INT64FLOAT)filter[i][6][0] * in[6][1];
|
||||
|
||||
for (j = 0; j < 6; j++) {
|
||||
INT64FLOAT in0_re = in[j][0];
|
||||
INT64FLOAT in0_im = in[j][1];
|
||||
INT64FLOAT in1_re = in[12-j][0];
|
||||
INT64FLOAT in1_im = in[12-j][1];
|
||||
INTFLOAT in0_re = in[j][0];
|
||||
INTFLOAT in0_im = in[j][1];
|
||||
INTFLOAT in1_re = in[12-j][0];
|
||||
INTFLOAT in1_im = in[12-j][1];
|
||||
sum_re += (INT64FLOAT)filter[i][j][0] * (in0_re + in1_re) -
|
||||
(INT64FLOAT)filter[i][j][1] * (in0_im - in1_im);
|
||||
sum_im += (INT64FLOAT)filter[i][j][0] * (in0_im + in1_im) +
|
||||
|
||||
+1
-4
@@ -308,9 +308,6 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
||||
const int bandwidth = ctx->cutoff ? ctx->cutoff : AAC_CUTOFF(ctx->avctx);
|
||||
const float num_bark = calc_bark((float)bandwidth);
|
||||
|
||||
if (bandwidth <= 0)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext));
|
||||
if (!ctx->model_priv_data)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -797,7 +794,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
|
||||
|
||||
if (pe < 1.15f * desired_pe) {
|
||||
/* 6.6.1.3.6 "Final threshold modification by linearization" */
|
||||
norm_fac = norm_fac ? 1.0f / norm_fac : 0;
|
||||
norm_fac = 1.0f / norm_fac;
|
||||
for (w = 0; w < wi->num_windows*16; w += 16) {
|
||||
for (g = 0; g < num_bands; g++) {
|
||||
AacPsyBand *band = &pch->band[w+g];
|
||||
|
||||
@@ -111,4 +111,16 @@ static DECLARE_ALIGNED(32, INTFLOAT, sbr_qmf_window_us)[640] = {
|
||||
Q31( 0.8537385600f),
|
||||
};
|
||||
|
||||
static av_cold void aacsbr_tableinit(void)
|
||||
{
|
||||
int n;
|
||||
for (n = 1; n < 320; n++)
|
||||
sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
|
||||
sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
|
||||
sbr_qmf_window_us[512] = -sbr_qmf_window_us[512];
|
||||
|
||||
for (n = 0; n < 320; n++)
|
||||
sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_AACSBR_TABLEGEN_COMMON_H */
|
||||
|
||||
@@ -34,18 +34,6 @@
|
||||
|
||||
#include "libavutil/qsort.h"
|
||||
|
||||
static av_cold void aacsbr_tableinit(void)
|
||||
{
|
||||
int n;
|
||||
for (n = 1; n < 320; n++)
|
||||
sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
|
||||
sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
|
||||
sbr_qmf_window_us[512] = -sbr_qmf_window_us[512];
|
||||
|
||||
for (n = 0; n < 320; n++)
|
||||
sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
|
||||
}
|
||||
|
||||
av_cold void AAC_RENAME(ff_aac_sbr_init)(void)
|
||||
{
|
||||
static const struct {
|
||||
|
||||
@@ -34,20 +34,20 @@ void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
||||
void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
||||
int beta, int8_t *tc0);
|
||||
|
||||
void ff_weight_h264_pixels_16_neon(uint8_t *dst, ptrdiff_t stride, int height,
|
||||
void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height,
|
||||
int log2_den, int weight, int offset);
|
||||
void ff_weight_h264_pixels_8_neon(uint8_t *dst, ptrdiff_t stride, int height,
|
||||
void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height,
|
||||
int log2_den, int weight, int offset);
|
||||
void ff_weight_h264_pixels_4_neon(uint8_t *dst, ptrdiff_t stride, int height,
|
||||
void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height,
|
||||
int log2_den, int weight, int offset);
|
||||
|
||||
void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
|
||||
void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int stride,
|
||||
int height, int log2_den, int weightd,
|
||||
int weights, int offset);
|
||||
void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
|
||||
void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int stride,
|
||||
int height, int log2_den, int weightd,
|
||||
int weights, int offset);
|
||||
void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
|
||||
void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride,
|
||||
int height, int log2_den, int weightd,
|
||||
int weights, int offset);
|
||||
|
||||
|
||||
+17
-17
@@ -104,26 +104,26 @@ static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
case MKTAG('A', 'A', 'S', 'C'):
|
||||
switch (compr) {
|
||||
case 0:
|
||||
stride = (avctx->width * psize + psize) & ~psize;
|
||||
if (buf_size < stride * avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = avctx->height - 1; i >= 0; i--) {
|
||||
memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize);
|
||||
buf += stride;
|
||||
buf_size -= stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bytestream2_init(&s->gb, buf, buf_size);
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
|
||||
switch (compr) {
|
||||
case 0:
|
||||
stride = (avctx->width * psize + psize) & ~psize;
|
||||
if (buf_size < stride * avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = avctx->height - 1; i >= 0; i--) {
|
||||
memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize);
|
||||
buf += stride;
|
||||
buf_size -= stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bytestream2_init(&s->gb, buf, buf_size);
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown FourCC: %X\n", avctx->codec_tag);
|
||||
return -1;
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
#define AC3_DYNAMIC_RANGE1 0
|
||||
|
||||
typedef int INTFLOAT;
|
||||
typedef unsigned int UINTFLOAT;
|
||||
typedef int16_t SHORTFLOAT;
|
||||
|
||||
#else /* USE_FIXED */
|
||||
@@ -95,7 +94,6 @@ typedef int16_t SHORTFLOAT;
|
||||
#define AC3_DYNAMIC_RANGE1 1.0f
|
||||
|
||||
typedef float INTFLOAT;
|
||||
typedef float UINTFLOAT;
|
||||
typedef float SHORTFLOAT;
|
||||
|
||||
#endif /* USE_FIXED */
|
||||
|
||||
@@ -107,30 +107,29 @@ static void scale_coefs (
|
||||
}
|
||||
} else {
|
||||
shift = -shift;
|
||||
mul <<= shift;
|
||||
for (i=0; i<len; i+=8) {
|
||||
|
||||
temp = src[i] * mul;
|
||||
temp1 = src[i+1] * mul;
|
||||
temp2 = src[i+2] * mul;
|
||||
|
||||
dst[i] = temp;
|
||||
dst[i] = temp << shift;
|
||||
temp3 = src[i+3] * mul;
|
||||
|
||||
dst[i+1] = temp1;
|
||||
dst[i+1] = temp1 << shift;
|
||||
temp4 = src[i + 4] * mul;
|
||||
dst[i+2] = temp2;
|
||||
dst[i+2] = temp2 << shift;
|
||||
|
||||
temp5 = src[i+5] * mul;
|
||||
dst[i+3] = temp3;
|
||||
dst[i+3] = temp3 << shift;
|
||||
temp6 = src[i+6] * mul;
|
||||
|
||||
dst[i+4] = temp4;
|
||||
dst[i+4] = temp4 << shift;
|
||||
temp7 = src[i+7] * mul;
|
||||
|
||||
dst[i+5] = temp5;
|
||||
dst[i+6] = temp6;
|
||||
dst[i+7] = temp7;
|
||||
dst[i+5] = temp5 << shift;
|
||||
dst[i+6] = temp6 << shift;
|
||||
dst[i+7] = temp7 << shift;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -1065,7 +1065,7 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset)
|
||||
{
|
||||
int blk, ch;
|
||||
|
||||
snr_offset = (snr_offset - 240) * 4;
|
||||
snr_offset = (snr_offset - 240) << 2;
|
||||
|
||||
reset_block_bap(s);
|
||||
for (blk = 0; blk < s->num_blocks; blk++) {
|
||||
@@ -2051,8 +2051,7 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
|
||||
av_freep(&block->cpl_coord_mant);
|
||||
}
|
||||
|
||||
if (s->mdct_end)
|
||||
s->mdct_end(s);
|
||||
s->mdct_end(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2434,7 +2433,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
|
||||
|
||||
ret = validate_options(s);
|
||||
if (ret)
|
||||
goto init_fail;
|
||||
return ret;
|
||||
|
||||
avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks;
|
||||
avctx->initial_padding = AC3_BLOCK_SIZE;
|
||||
|
||||
+21
-36
@@ -110,10 +110,6 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
|
||||
case AV_CODEC_ID_ADPCM_MTAF:
|
||||
min_channels = 2;
|
||||
max_channels = 8;
|
||||
if (avctx->channels & 1) {
|
||||
avpriv_request_sample(avctx, "channel count %d\n", avctx->channels);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_PSX:
|
||||
max_channels = 8;
|
||||
@@ -139,8 +135,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_IMA_APC:
|
||||
if (avctx->extradata && avctx->extradata_size >= 8) {
|
||||
c->status[0].predictor = av_clip_intp2(AV_RL32(avctx->extradata ), 18);
|
||||
c->status[1].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 4), 18);
|
||||
c->status[0].predictor = AV_RL32(avctx->extradata);
|
||||
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
|
||||
}
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_IMA_WS:
|
||||
@@ -293,7 +289,7 @@ static inline int16_t adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nib
|
||||
c->predictor = av_clip_intp2(predictor, 11);
|
||||
c->step_index = step_index;
|
||||
|
||||
return c->predictor * 16;
|
||||
return c->predictor << 4;
|
||||
}
|
||||
|
||||
static inline int16_t adpcm_ct_expand_nibble(ADPCMChannelStatus *c, int8_t nibble)
|
||||
@@ -382,10 +378,6 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
|
||||
avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
|
||||
filter=0;
|
||||
}
|
||||
if (shift < 0) {
|
||||
avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
|
||||
shift = 0;
|
||||
}
|
||||
f0 = xa_adpcm_table[filter][0];
|
||||
f1 = xa_adpcm_table[filter][1];
|
||||
|
||||
@@ -396,7 +388,7 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
|
||||
d = in[16+i+j*4];
|
||||
|
||||
t = sign_extend(d, 4);
|
||||
s = t*(1<<shift) + ((s_1*f0 + s_2*f1+32)>>6);
|
||||
s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
|
||||
s_2 = s_1;
|
||||
s_1 = av_clip_int16(s);
|
||||
out0[j] = s_1;
|
||||
@@ -411,14 +403,10 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
|
||||
|
||||
shift = 12 - (in[5+i*2] & 15);
|
||||
filter = in[5+i*2] >> 4;
|
||||
if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table) || shift < 0) {
|
||||
if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) {
|
||||
avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
|
||||
filter=0;
|
||||
}
|
||||
if (shift < 0) {
|
||||
avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
|
||||
shift = 0;
|
||||
}
|
||||
|
||||
f0 = xa_adpcm_table[filter][0];
|
||||
f1 = xa_adpcm_table[filter][1];
|
||||
@@ -427,7 +415,7 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
|
||||
d = in[16+i+j*4];
|
||||
|
||||
t = sign_extend(d >> 4, 4);
|
||||
s = t*(1<<shift) + ((s_1*f0 + s_2*f1+32)>>6);
|
||||
s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
|
||||
s_2 = s_1;
|
||||
s_1 = av_clip_int16(s);
|
||||
out1[j] = s_1;
|
||||
@@ -1153,11 +1141,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
for (i=0; i<=st; i++) {
|
||||
for (i=0; i<=st; i++)
|
||||
c->status[i].predictor = bytestream2_get_le32u(&gb);
|
||||
if (FFABS((int64_t)c->status[i].predictor) > (1<<16))
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (n = nb_samples >> (1 - st); n > 0; n--) {
|
||||
int byte = bytestream2_get_byteu(&gb);
|
||||
@@ -1204,8 +1189,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
for (count2 = 0; count2 < 28; count2++) {
|
||||
byte = bytestream2_get_byteu(&gb);
|
||||
next_left_sample = sign_extend(byte >> 4, 4) * (1 << shift_left);
|
||||
next_right_sample = sign_extend(byte, 4) * (1 << shift_right);
|
||||
next_left_sample = sign_extend(byte >> 4, 4) << shift_left;
|
||||
next_right_sample = sign_extend(byte, 4) << shift_right;
|
||||
|
||||
next_left_sample = (next_left_sample +
|
||||
(current_left_sample * coeff1l) +
|
||||
@@ -1244,7 +1229,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (st) byte[1] = bytestream2_get_byteu(&gb);
|
||||
for(i = 4; i >= 0; i-=4) { /* Pairwise samples LL RR (st) or LL LL (mono) */
|
||||
for(channel = 0; channel < avctx->channels; channel++) {
|
||||
int sample = sign_extend(byte[channel] >> i, 4) * (1 << shift[channel]);
|
||||
int sample = sign_extend(byte[channel] >> i, 4) << shift[channel];
|
||||
sample = (sample +
|
||||
c->status[channel].sample1 * coeff[channel][0] +
|
||||
c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8;
|
||||
@@ -1305,10 +1290,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
for (count2=0; count2<28; count2++) {
|
||||
if (count2 & 1)
|
||||
next_sample = (unsigned)sign_extend(byte, 4) << shift;
|
||||
next_sample = sign_extend(byte, 4) << shift;
|
||||
else {
|
||||
byte = bytestream2_get_byte(&gb);
|
||||
next_sample = (unsigned)sign_extend(byte >> 4, 4) << shift;
|
||||
next_sample = sign_extend(byte >> 4, 4) << shift;
|
||||
}
|
||||
|
||||
next_sample += (current_sample * coeff1) +
|
||||
@@ -1359,11 +1344,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int level, pred;
|
||||
int byte = bytestream2_get_byteu(&gb);
|
||||
|
||||
level = sign_extend(byte >> 4, 4) * (1 << shift[n]);
|
||||
level = sign_extend(byte >> 4, 4) << shift[n];
|
||||
pred = s[-1] * coeff[0][n] + s[-2] * coeff[1][n];
|
||||
s[0] = av_clip_int16((level + pred + 0x80) >> 8);
|
||||
|
||||
level = sign_extend(byte, 4) * (1 << shift[n]);
|
||||
level = sign_extend(byte, 4) << shift[n];
|
||||
pred = s[0] * coeff[0][n] + s[-1] * coeff[1][n];
|
||||
s[1] = av_clip_int16((level + pred + 0x80) >> 8);
|
||||
}
|
||||
@@ -1520,8 +1505,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
sampledat = sign_extend(byte >> 4, 4);
|
||||
}
|
||||
|
||||
sampledat = ((prev1 * factor1 + prev2 * factor2) >> 11) +
|
||||
sampledat * scale;
|
||||
sampledat = ((prev1 * factor1 + prev2 * factor2) +
|
||||
((sampledat * scale) << 11)) >> 11;
|
||||
*samples = av_clip_int16(sampledat);
|
||||
prev2 = prev1;
|
||||
prev1 = *samples++;
|
||||
@@ -1583,8 +1568,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int byte = bytestream2_get_byteu(&gb);
|
||||
int index = (byte >> 4) & 7;
|
||||
unsigned int exp = byte & 0x0F;
|
||||
int64_t factor1 = table[ch][index * 2];
|
||||
int64_t factor2 = table[ch][index * 2 + 1];
|
||||
int factor1 = table[ch][index * 2];
|
||||
int factor2 = table[ch][index * 2 + 1];
|
||||
|
||||
/* Decode 14 samples. */
|
||||
for (n = 0; n < 14 && (i * 14 + n < nb_samples); n++) {
|
||||
@@ -1598,7 +1583,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
|
||||
sampledat = ((c->status[ch].sample1 * factor1
|
||||
+ c->status[ch].sample2 * factor2) >> 11) + sampledat * (1 << exp);
|
||||
+ c->status[ch].sample2 * factor2) >> 11) + (sampledat << exp);
|
||||
*samples = av_clip_int16(sampledat);
|
||||
c->status[ch].sample2 = c->status[ch].sample1;
|
||||
c->status[ch].sample1 = *samples++;
|
||||
@@ -1645,7 +1630,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
else
|
||||
sampledat = sign_extend(byte >> 4, 4);
|
||||
|
||||
sampledat = ((sampledat * (1 << 12)) >> (header & 0xf)) * (1 << 6) + prev;
|
||||
sampledat = (((sampledat << 12) >> (header & 0xf)) << 6) + prev;
|
||||
*samples++ = av_clip_int16(sampledat >> 6);
|
||||
c->status[channel].sample2 = c->status[channel].sample1;
|
||||
c->status[channel].sample1 = sampledat;
|
||||
@@ -1682,7 +1667,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
scale = sign_extend(byte, 4);
|
||||
}
|
||||
|
||||
scale = scale * (1 << 12);
|
||||
scale = scale << 12;
|
||||
sample = (int)((scale >> shift) + (c->status[channel].sample1 * xa_adpcm_table[filter][0] + c->status[channel].sample2 * xa_adpcm_table[filter][1]) / 64);
|
||||
}
|
||||
*samples++ = av_clip_int16(sample);
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav,
|
||||
s2 = prev->s2;
|
||||
for (i = 0, j = 0; j < 32; i += channels, j++) {
|
||||
s0 = wav[i];
|
||||
d = s0 + ((-c->coeff[0] * s1 - c->coeff[1] * s2) >> COEFF_BITS);
|
||||
d = ((s0 << COEFF_BITS) - c->coeff[0] * s1 - c->coeff[1] * s2) >> COEFF_BITS;
|
||||
if (max < d)
|
||||
max = d;
|
||||
if (min > d)
|
||||
@@ -79,13 +79,13 @@ static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav,
|
||||
s1 = prev->s1;
|
||||
s2 = prev->s2;
|
||||
for (i = 0, j = 0; j < 32; i += channels, j++) {
|
||||
d = wav[i] + ((-c->coeff[0] * s1 - c->coeff[1] * s2) >> COEFF_BITS);
|
||||
d = ((wav[i] << COEFF_BITS) - c->coeff[0] * s1 - c->coeff[1] * s2) >> COEFF_BITS;
|
||||
|
||||
d = av_clip_intp2(ROUNDED_DIV(d, scale), 3);
|
||||
|
||||
put_sbits(&pb, 4, d);
|
||||
|
||||
s0 = d * scale + ((c->coeff[0] * s1 + c->coeff[1] * s2) >> COEFF_BITS);
|
||||
s0 = ((d << COEFF_BITS) * scale + c->coeff[0] * s1 + c->coeff[1] * s2) >> COEFF_BITS;
|
||||
s2 = s1;
|
||||
s1 = s0;
|
||||
}
|
||||
|
||||
@@ -208,9 +208,6 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
|
||||
int mb, idx;
|
||||
unsigned val;
|
||||
|
||||
if (get_bits_left(gb) < 5)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
has_skips = get_bits1(gb);
|
||||
coeff_type = get_bits1(gb);
|
||||
coeff_bits = get_bits(gb, 3);
|
||||
|
||||
+11
-16
@@ -171,12 +171,12 @@ static inline int sign_only(int v)
|
||||
return v ? FFSIGN(v) : 0;
|
||||
}
|
||||
|
||||
static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
|
||||
static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out,
|
||||
int nb_samples, int bps, int16_t *lpc_coefs,
|
||||
int lpc_order, int lpc_quant)
|
||||
{
|
||||
int i;
|
||||
uint32_t *pred = buffer_out;
|
||||
int32_t *pred = buffer_out;
|
||||
|
||||
/* first sample always copies */
|
||||
*buffer_out = *error_buffer;
|
||||
@@ -208,27 +208,27 @@ static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
|
||||
for (; i < nb_samples; i++) {
|
||||
int j;
|
||||
int val = 0;
|
||||
unsigned error_val = error_buffer[i];
|
||||
int error_val = error_buffer[i];
|
||||
int error_sign;
|
||||
int d = *pred++;
|
||||
|
||||
/* LPC prediction */
|
||||
for (j = 0; j < lpc_order; j++)
|
||||
val += (pred[j] - d) * lpc_coefs[j];
|
||||
val = (val + (1LL << (lpc_quant - 1))) >> lpc_quant;
|
||||
val = (val + (1 << (lpc_quant - 1))) >> lpc_quant;
|
||||
val += d + error_val;
|
||||
buffer_out[i] = sign_extend(val, bps);
|
||||
|
||||
/* adapt LPC coefficients */
|
||||
error_sign = sign_only(error_val);
|
||||
if (error_sign) {
|
||||
for (j = 0; j < lpc_order && (int)(error_val * error_sign) > 0; j++) {
|
||||
for (j = 0; j < lpc_order && error_val * error_sign > 0; j++) {
|
||||
int sign;
|
||||
val = d - pred[j];
|
||||
sign = sign_only(val) * error_sign;
|
||||
lpc_coefs[j] -= sign;
|
||||
val *= (unsigned)sign;
|
||||
error_val -= (val >> lpc_quant) * (j + 1U);
|
||||
val *= sign;
|
||||
error_val -= (val >> lpc_quant) * (j + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,12 +250,10 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
|
||||
|
||||
alac->extra_bits = get_bits(&alac->gb, 2) << 3;
|
||||
bps = alac->sample_size - alac->extra_bits + channels - 1;
|
||||
if (bps > 32) {
|
||||
if (bps > 32U) {
|
||||
avpriv_report_missing_feature(avctx, "bps %d", bps);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (bps < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* whether the frame is compressed */
|
||||
is_compressed = !get_bits1(&alac->gb);
|
||||
@@ -302,16 +300,13 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
|
||||
decorr_shift = get_bits(&alac->gb, 8);
|
||||
decorr_left_weight = get_bits(&alac->gb, 8);
|
||||
|
||||
if (channels == 2 && decorr_left_weight && decorr_shift > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (ch = 0; ch < channels; ch++) {
|
||||
prediction_type[ch] = get_bits(&alac->gb, 4);
|
||||
lpc_quant[ch] = get_bits(&alac->gb, 4);
|
||||
rice_history_mult[ch] = get_bits(&alac->gb, 3);
|
||||
lpc_order[ch] = get_bits(&alac->gb, 5);
|
||||
|
||||
if (lpc_order[ch] >= alac->max_samples_per_frame || !lpc_quant[ch])
|
||||
if (lpc_order[ch] >= alac->max_samples_per_frame)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* read the predictor table */
|
||||
@@ -400,13 +395,13 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
|
||||
case 20: {
|
||||
for (ch = 0; ch < channels; ch++) {
|
||||
for (i = 0; i < alac->nb_samples; i++)
|
||||
alac->output_samples_buffer[ch][i] *= 1U << 12;
|
||||
alac->output_samples_buffer[ch][i] <<= 12;
|
||||
}}
|
||||
break;
|
||||
case 24: {
|
||||
for (ch = 0; ch < channels; ch++) {
|
||||
for (i = 0; i < alac->nb_samples; i++)
|
||||
alac->output_samples_buffer[ch][i] *= 1U << 8;
|
||||
alac->output_samples_buffer[ch][i] <<= 8;
|
||||
}}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ static void decorrelate_stereo(int32_t *buffer[2], int nb_samples,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_samples; i++) {
|
||||
uint32_t a, b;
|
||||
int32_t a, b;
|
||||
|
||||
a = buffer[0][i];
|
||||
b = buffer[1][i];
|
||||
|
||||
a -= (int)(b * decorr_left_weight) >> decorr_shift;
|
||||
a -= (b * decorr_left_weight) >> decorr_shift;
|
||||
b += a;
|
||||
|
||||
buffer[0][i] = b;
|
||||
@@ -49,7 +49,7 @@ static void append_extra_bits(int32_t *buffer[2], int32_t *extra_bits_buffer[2],
|
||||
|
||||
for (ch = 0; ch < channels; ch++)
|
||||
for (i = 0; i < nb_samples; i++)
|
||||
buffer[ch][i] = ((unsigned)buffer[ch][i] << extra_bits) | extra_bits_buffer[ch][i];
|
||||
buffer[ch][i] = (buffer[ch][i] << extra_bits) | extra_bits_buffer[ch][i];
|
||||
}
|
||||
|
||||
av_cold void ff_alacdsp_init(ALACDSPContext *c)
|
||||
|
||||
@@ -62,9 +62,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (bytestream2_get_bytes_left(&gb) < width*height / 255)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = ff_get_buffer(avctx, f, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+2
-20
@@ -58,7 +58,6 @@ extern AVCodec ff_ayuv_decoder;
|
||||
extern AVCodec ff_bethsoftvid_decoder;
|
||||
extern AVCodec ff_bfi_decoder;
|
||||
extern AVCodec ff_bink_decoder;
|
||||
extern AVCodec ff_bitpacked_decoder;
|
||||
extern AVCodec ff_bmp_encoder;
|
||||
extern AVCodec ff_bmp_decoder;
|
||||
extern AVCodec ff_bmv_video_decoder;
|
||||
@@ -154,7 +153,6 @@ extern AVCodec ff_huffyuv_encoder;
|
||||
extern AVCodec ff_huffyuv_decoder;
|
||||
extern AVCodec ff_idcin_decoder;
|
||||
extern AVCodec ff_iff_ilbm_decoder;
|
||||
extern AVCodec ff_imm4_decoder;
|
||||
extern AVCodec ff_indeo2_decoder;
|
||||
extern AVCodec ff_indeo3_decoder;
|
||||
extern AVCodec ff_indeo4_decoder;
|
||||
@@ -213,7 +211,6 @@ extern AVCodec ff_mszh_decoder;
|
||||
extern AVCodec ff_mts2_decoder;
|
||||
extern AVCodec ff_mvc1_decoder;
|
||||
extern AVCodec ff_mvc2_decoder;
|
||||
extern AVCodec ff_mwsc_decoder;
|
||||
extern AVCodec ff_mxpeg_decoder;
|
||||
extern AVCodec ff_nuv_decoder;
|
||||
extern AVCodec ff_paf_video_decoder;
|
||||
@@ -237,7 +234,7 @@ extern AVCodec ff_prores_encoder;
|
||||
extern AVCodec ff_prores_decoder;
|
||||
extern AVCodec ff_prores_aw_encoder;
|
||||
extern AVCodec ff_prores_ks_encoder;
|
||||
extern AVCodec ff_prosumer_decoder;
|
||||
extern AVCodec ff_prores_lgpl_decoder;
|
||||
extern AVCodec ff_psd_decoder;
|
||||
extern AVCodec ff_ptx_decoder;
|
||||
extern AVCodec ff_qdraw_decoder;
|
||||
@@ -248,7 +245,6 @@ extern AVCodec ff_r10k_encoder;
|
||||
extern AVCodec ff_r10k_decoder;
|
||||
extern AVCodec ff_r210_encoder;
|
||||
extern AVCodec ff_r210_decoder;
|
||||
extern AVCodec ff_rasc_decoder;
|
||||
extern AVCodec ff_rawvideo_encoder;
|
||||
extern AVCodec ff_rawvideo_decoder;
|
||||
extern AVCodec ff_rl2_decoder;
|
||||
@@ -338,8 +334,8 @@ extern AVCodec ff_vp9_decoder;
|
||||
extern AVCodec ff_vp9_rkmpp_decoder;
|
||||
extern AVCodec ff_vp9_v4l2m2m_decoder;
|
||||
extern AVCodec ff_vqa_decoder;
|
||||
extern AVCodec ff_bitpacked_decoder;
|
||||
extern AVCodec ff_webp_decoder;
|
||||
extern AVCodec ff_wcmv_decoder;
|
||||
extern AVCodec ff_wrapped_avframe_encoder;
|
||||
extern AVCodec ff_wrapped_avframe_decoder;
|
||||
extern AVCodec ff_wmv1_encoder;
|
||||
@@ -397,7 +393,6 @@ extern AVCodec ff_atrac3_decoder;
|
||||
extern AVCodec ff_atrac3al_decoder;
|
||||
extern AVCodec ff_atrac3p_decoder;
|
||||
extern AVCodec ff_atrac3pal_decoder;
|
||||
extern AVCodec ff_atrac9_decoder;
|
||||
extern AVCodec ff_binkaudio_dct_decoder;
|
||||
extern AVCodec ff_binkaudio_rdft_decoder;
|
||||
extern AVCodec ff_bmv_audio_decoder;
|
||||
@@ -424,7 +419,6 @@ extern AVCodec ff_g729_decoder;
|
||||
extern AVCodec ff_gsm_decoder;
|
||||
extern AVCodec ff_gsm_ms_decoder;
|
||||
extern AVCodec ff_iac_decoder;
|
||||
extern AVCodec ff_ilbc_decoder;
|
||||
extern AVCodec ff_imc_decoder;
|
||||
extern AVCodec ff_interplay_acm_decoder;
|
||||
extern AVCodec ff_mace3_decoder;
|
||||
@@ -552,8 +546,6 @@ extern AVCodec ff_pcm_u32be_encoder;
|
||||
extern AVCodec ff_pcm_u32be_decoder;
|
||||
extern AVCodec ff_pcm_u32le_encoder;
|
||||
extern AVCodec ff_pcm_u32le_decoder;
|
||||
extern AVCodec ff_pcm_vidc_encoder;
|
||||
extern AVCodec ff_pcm_vidc_decoder;
|
||||
extern AVCodec ff_pcm_zork_decoder;
|
||||
|
||||
/* DPCM codecs */
|
||||
@@ -676,7 +668,6 @@ extern AVCodec ff_libaom_av1_encoder;
|
||||
extern AVCodec ff_libcelt_decoder;
|
||||
extern AVCodec ff_libcodec2_encoder;
|
||||
extern AVCodec ff_libcodec2_decoder;
|
||||
extern AVCodec ff_libdavs2_decoder;
|
||||
extern AVCodec ff_libfdk_aac_encoder;
|
||||
extern AVCodec ff_libfdk_aac_decoder;
|
||||
extern AVCodec ff_libgsm_encoder;
|
||||
@@ -715,7 +706,6 @@ extern AVCodec ff_libx264_encoder;
|
||||
extern AVCodec ff_libx264rgb_encoder;
|
||||
extern AVCodec ff_libx265_encoder;
|
||||
extern AVCodec ff_libxavs_encoder;
|
||||
extern AVCodec ff_libxavs2_encoder;
|
||||
extern AVCodec ff_libxvid_encoder;
|
||||
extern AVCodec ff_libzvbi_teletext_decoder;
|
||||
|
||||
@@ -771,15 +761,7 @@ extern AVCodec ff_vp9_cuvid_decoder;
|
||||
extern AVCodec ff_vp9_mediacodec_decoder;
|
||||
extern AVCodec ff_vp9_vaapi_encoder;
|
||||
|
||||
// The iterate API is not usable with ossfuzz due to the excessive size of binaries created
|
||||
#if CONFIG_OSSFUZZ
|
||||
AVCodec * codec_list[] = {
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
#else
|
||||
#include "libavcodec/codec_list.c"
|
||||
#endif
|
||||
|
||||
static AVOnce av_codec_static_init = AV_ONCE_INIT;
|
||||
static void av_codec_init_static(void)
|
||||
|
||||
+26
-60
@@ -348,11 +348,6 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
if (als_id != MKBETAG('A','L','S','\0'))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (avctx->channels > FF_SANE_NB_CHANNELS) {
|
||||
avpriv_request_sample(avctx, "Huge number of channels\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
ctx->cur_frame_length = sconf->frame_length;
|
||||
|
||||
// read channel config
|
||||
@@ -492,7 +487,7 @@ static void parse_bs_info(const uint32_t bs_info, unsigned int n,
|
||||
static int32_t decode_rice(GetBitContext *gb, unsigned int k)
|
||||
{
|
||||
int max = get_bits_left(gb) - k;
|
||||
unsigned q = get_unary(gb, 0, max);
|
||||
int q = get_unary(gb, 0, max);
|
||||
int r = k ? get_bits1(gb) : !(q & 1);
|
||||
|
||||
if (k > 1) {
|
||||
@@ -512,7 +507,7 @@ static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
|
||||
int i, j;
|
||||
|
||||
for (i = 0, j = k - 1; i < j; i++, j--) {
|
||||
unsigned tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
|
||||
int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
|
||||
cof[j] += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20);
|
||||
cof[i] += tmp1;
|
||||
}
|
||||
@@ -662,7 +657,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
// do not continue in case of a damaged stream since
|
||||
// block_length must be evenly divisible by sub_blocks
|
||||
if (bd->block_length & (sub_blocks - 1) || bd->block_length <= 0) {
|
||||
if (bd->block_length & (sub_blocks - 1)) {
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"Block length is not evenly divisible by the number of subblocks.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -761,7 +756,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
}
|
||||
|
||||
for (k = 2; k < opt_order; k++)
|
||||
quant_cof[k] = (quant_cof[k] * (1U << 14)) + (add_base << 13);
|
||||
quant_cof[k] = (quant_cof[k] * (1 << 14)) + (add_base << 13);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,8 +767,8 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
if (*bd->use_ltp) {
|
||||
int r, c;
|
||||
|
||||
bd->ltp_gain[0] = decode_rice(gb, 1) * 8;
|
||||
bd->ltp_gain[1] = decode_rice(gb, 2) * 8;
|
||||
bd->ltp_gain[0] = decode_rice(gb, 1) << 3;
|
||||
bd->ltp_gain[1] = decode_rice(gb, 2) << 3;
|
||||
|
||||
r = get_unary(gb, 0, 4);
|
||||
c = get_bits(gb, 2);
|
||||
@@ -784,8 +779,8 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
bd->ltp_gain[2] = ltp_gain_values[r][c];
|
||||
|
||||
bd->ltp_gain[3] = decode_rice(gb, 2) * 8;
|
||||
bd->ltp_gain[4] = decode_rice(gb, 1) * 8;
|
||||
bd->ltp_gain[3] = decode_rice(gb, 2) << 3;
|
||||
bd->ltp_gain[4] = decode_rice(gb, 1) << 3;
|
||||
|
||||
*bd->ltp_lag = get_bits(gb, ctx->ltp_lag_length);
|
||||
*bd->ltp_lag += FFMAX(4, opt_order + 1);
|
||||
@@ -794,20 +789,14 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
// read first value and residuals in case of a random access block
|
||||
if (bd->ra_block) {
|
||||
start = FFMIN(opt_order, 3);
|
||||
av_assert0(sb_length <= sconf->frame_length);
|
||||
if (sb_length <= start) {
|
||||
// opt_order or sb_length may be corrupted, either way this is unsupported and not well defined in the specification
|
||||
av_log(avctx, AV_LOG_ERROR, "Sub block length smaller or equal start\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (opt_order)
|
||||
bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);
|
||||
if (opt_order > 1)
|
||||
bd->raw_samples[1] = decode_rice(gb, FFMIN(s[0] + 3, ctx->s_max));
|
||||
if (opt_order > 2)
|
||||
bd->raw_samples[2] = decode_rice(gb, FFMIN(s[0] + 1, ctx->s_max));
|
||||
|
||||
start = FFMIN(opt_order, 3);
|
||||
}
|
||||
|
||||
// read all residuals
|
||||
@@ -821,9 +810,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
unsigned int low;
|
||||
unsigned int value;
|
||||
|
||||
int ret = ff_bgmc_decode_init(gb, &high, &low, &value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ff_bgmc_decode_init(gb, &high, &low, &value);
|
||||
|
||||
current_res = bd->raw_samples + start;
|
||||
|
||||
@@ -833,9 +820,6 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
k [sb] = s[sb] > b ? s[sb] - b : 0;
|
||||
delta[sb] = 5 - s[sb] + k[sb];
|
||||
|
||||
if (k[sb] >= 32)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ff_bgmc_decode(gb, sb_len, current_res,
|
||||
delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status);
|
||||
|
||||
@@ -877,7 +861,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
res >>= 1;
|
||||
|
||||
if (cur_k) {
|
||||
res *= 1U << cur_k;
|
||||
res *= 1 << cur_k;
|
||||
res |= get_bits_long(gb, cur_k);
|
||||
}
|
||||
}
|
||||
@@ -928,7 +912,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
y = 1 << 6;
|
||||
|
||||
for (base = begin; base < end; base++, tab++)
|
||||
y += (uint64_t)MUL64(bd->ltp_gain[tab], raw_samples[base]);
|
||||
y += MUL64(bd->ltp_gain[tab], raw_samples[base]);
|
||||
|
||||
raw_samples[ltp_smp] += y >> 7;
|
||||
}
|
||||
@@ -940,7 +924,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
y = 1 << 19;
|
||||
|
||||
for (sb = 0; sb < smp; sb++)
|
||||
y += (uint64_t)MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
|
||||
y += MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
|
||||
|
||||
*raw_samples++ -= y >> 20;
|
||||
parcor_to_lpc(smp, quant_cof, lpc_cof);
|
||||
@@ -956,7 +940,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
// reconstruct difference signal for prediction (joint-stereo)
|
||||
if (bd->js_blocks && bd->raw_other) {
|
||||
uint32_t *left, *right;
|
||||
int32_t *left, *right;
|
||||
|
||||
if (bd->raw_other > raw_samples) { // D = R - L
|
||||
left = raw_samples;
|
||||
@@ -990,7 +974,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
y = 1 << 19;
|
||||
|
||||
for (sb = -opt_order; sb < 0; sb++)
|
||||
y += (uint64_t)MUL64(lpc_cof[sb], raw_samples[sb]);
|
||||
y += MUL64(lpc_cof[sb], raw_samples[sb]);
|
||||
|
||||
*raw_samples -= y >> 20;
|
||||
}
|
||||
@@ -1015,10 +999,6 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
ALSSpecificConfig *sconf = &ctx->sconf;
|
||||
|
||||
*bd->shift_lsbs = 0;
|
||||
|
||||
if (get_bits_left(gb) < 7)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
// read block type flag and read the samples accordingly
|
||||
if (get_bits1(gb)) {
|
||||
ret = read_var_block_data(ctx, bd);
|
||||
@@ -1053,7 +1033,7 @@ static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
if (*bd->shift_lsbs)
|
||||
for (smp = 0; smp < bd->block_length; smp++)
|
||||
bd->raw_samples[smp] = (unsigned)bd->raw_samples[smp] << *bd->shift_lsbs;
|
||||
bd->raw_samples[smp] <<= *bd->shift_lsbs;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1189,10 +1169,10 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
|
||||
av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair.\n");
|
||||
|
||||
for (s = 0; s < div_blocks[b]; s++)
|
||||
bd[0].raw_samples[s] = bd[1].raw_samples[s] - (unsigned)bd[0].raw_samples[s];
|
||||
bd[0].raw_samples[s] = bd[1].raw_samples[s] - bd[0].raw_samples[s];
|
||||
} else if (bd[1].js_blocks) {
|
||||
for (s = 0; s < div_blocks[b]; s++)
|
||||
bd[1].raw_samples[s] = bd[1].raw_samples[s] + (unsigned)bd[0].raw_samples[s];
|
||||
bd[1].raw_samples[s] = bd[1].raw_samples[s] + bd[0].raw_samples[s];
|
||||
}
|
||||
|
||||
offset += div_blocks[b];
|
||||
@@ -1399,9 +1379,6 @@ static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) {
|
||||
mantissa_temp = (uint64_t)a.mant * (uint64_t)b.mant;
|
||||
mask_64 = (uint64_t)0x1 << 47;
|
||||
|
||||
if (!mantissa_temp)
|
||||
return FLOAT_0;
|
||||
|
||||
// Count the valid bit count
|
||||
while (!(mantissa_temp & mask_64) && mask_64) {
|
||||
bit_count--;
|
||||
@@ -1418,11 +1395,7 @@ static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) {
|
||||
}
|
||||
}
|
||||
|
||||
if (cutoff_bit_count >= 0) {
|
||||
mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
|
||||
} else {
|
||||
mantissa = (unsigned int)(mantissa_temp <<-cutoff_bit_count);
|
||||
}
|
||||
mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
|
||||
|
||||
// Need one more shift?
|
||||
if (mantissa & 0x01000000ul) {
|
||||
@@ -1434,7 +1407,7 @@ static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) {
|
||||
return_val = 0x80000000U;
|
||||
}
|
||||
|
||||
return_val |= ((unsigned)av_clip(a.exp + b.exp + bit_count - 47, -126, 127) << 23) & 0x7F800000;
|
||||
return_val |= (a.exp + b.exp + bit_count - 47) << 23;
|
||||
return_val |= mantissa;
|
||||
return av_bits2sf_ieee754(return_val);
|
||||
}
|
||||
@@ -1479,9 +1452,6 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
|
||||
ff_mlz_flush_dict(ctx->mlz);
|
||||
}
|
||||
|
||||
if (avctx->channels * 8 > get_bits_left(gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (c = 0; c < avctx->channels; ++c) {
|
||||
if (use_acf) {
|
||||
//acf_flag
|
||||
@@ -1822,17 +1792,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
|
||||
#define INTERLEAVE_OUTPUT(bps) \
|
||||
{ \
|
||||
int##bps##_t *dest = (int##bps##_t*)frame->data[0]; \
|
||||
int channels = avctx->channels; \
|
||||
int32_t **raw_samples = ctx->raw_samples; \
|
||||
shift = bps - ctx->avctx->bits_per_raw_sample; \
|
||||
if (!ctx->cs_switch) { \
|
||||
for (sample = 0; sample < ctx->cur_frame_length; sample++) \
|
||||
for (c = 0; c < channels; c++) \
|
||||
*dest++ = raw_samples[c][sample] * (1U << shift); \
|
||||
for (c = 0; c < avctx->channels; c++) \
|
||||
*dest++ = ctx->raw_samples[c][sample] << shift; \
|
||||
} else { \
|
||||
for (sample = 0; sample < ctx->cur_frame_length; sample++) \
|
||||
for (c = 0; c < channels; c++) \
|
||||
*dest++ = raw_samples[sconf->chan_pos[c]][sample] * (1U << shift);\
|
||||
for (c = 0; c < avctx->channels; c++) \
|
||||
*dest++ = ctx->raw_samples[sconf->chan_pos[c]][sample] << shift; \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -2016,8 +1984,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
// allocate quantized parcor coefficient buffer
|
||||
num_buffers = sconf->mc_coding ? avctx->channels : 1;
|
||||
if (num_buffers * (uint64_t)num_buffers > INT_MAX) // protect chan_data_buffer allocation
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ctx->quant_cof = av_malloc_array(num_buffers, sizeof(*ctx->quant_cof));
|
||||
ctx->lpc_cof = av_malloc_array(num_buffers, sizeof(*ctx->lpc_cof));
|
||||
@@ -2150,6 +2116,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
decode_end(avctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2175,5 +2142,4 @@ AVCodec ff_als_decoder = {
|
||||
.decode = decode_frame,
|
||||
.flush = flush,
|
||||
.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
||||
+1
-1
@@ -438,7 +438,7 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buff
|
||||
int64_t timestamp = AV_NOPTS_VALUE;
|
||||
int64_t size = buffer->pVtbl->GetSize(buffer);
|
||||
|
||||
if ((ret = av_new_packet(pkt, size)) < 0) {
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, size, 0)) < 0) {
|
||||
return ret;
|
||||
}
|
||||
memcpy(pkt->data, buffer->pVtbl->GetNative(buffer), size);
|
||||
|
||||
@@ -119,9 +119,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
uint8_t *dst, *dst_end;
|
||||
int count, ret;
|
||||
|
||||
if (buf_size < 7)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
dst = s->frame->data[0];
|
||||
|
||||
+1
-8
@@ -430,8 +430,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
s->args[s->nb_args] = FFMAX(s->args[s->nb_args], 0) * 10 + buf[0] - '0';
|
||||
break;
|
||||
case ';':
|
||||
if (s->nb_args < MAX_NB_ARGS)
|
||||
s->nb_args++;
|
||||
s->nb_args++;
|
||||
if (s->nb_args < MAX_NB_ARGS)
|
||||
s->args[s->nb_args] = 0;
|
||||
break;
|
||||
@@ -474,11 +473,6 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const AVCodecDefault ansi_defaults[] = {
|
||||
{ "max_pixels", "640*480" },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
AVCodec ff_ansi_decoder = {
|
||||
.name = "ansi",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"),
|
||||
@@ -490,5 +484,4 @@ AVCodec ff_ansi_decoder = {
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
.defaults = ansi_defaults,
|
||||
};
|
||||
|
||||
+43
-45
@@ -101,7 +101,7 @@ typedef struct APEFilter {
|
||||
int16_t *historybuffer; ///< filter memory
|
||||
int16_t *delay; ///< filtered values
|
||||
|
||||
uint32_t avg;
|
||||
int avg;
|
||||
} APEFilter;
|
||||
|
||||
typedef struct APERice {
|
||||
@@ -460,7 +460,7 @@ static inline void update_rice(APERice *rice, unsigned int x)
|
||||
|
||||
if (rice->ksum < lim)
|
||||
rice->k--;
|
||||
else if (rice->ksum >= (1 << (rice->k + 5)) && rice->k < 24)
|
||||
else if (rice->ksum >= (1 << (rice->k + 5)))
|
||||
rice->k++;
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ static inline int ape_decode_value_3990(APEContext *ctx, APERice *rice)
|
||||
overflow = range_get_symbol(ctx, counts_3980, counts_diff_3980);
|
||||
|
||||
if (overflow == (MODEL_ELEMENTS - 1)) {
|
||||
overflow = (unsigned)range_decode_bits(ctx, 16) << 16;
|
||||
overflow = range_decode_bits(ctx, 16) << 16;
|
||||
overflow |= range_decode_bits(ctx, 16);
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
|
||||
int32_t *out, APERice *rice, int blockstodecode)
|
||||
{
|
||||
int i;
|
||||
unsigned ksummax, ksummin;
|
||||
int ksummax, ksummin;
|
||||
|
||||
rice->ksum = 0;
|
||||
for (i = 0; i < FFMIN(blockstodecode, 5); i++) {
|
||||
@@ -610,7 +610,7 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
|
||||
ksummin = rice->k ? (1 << rice->k + 6) : 0;
|
||||
for (; i < blockstodecode; i++) {
|
||||
out[i] = get_rice_ook(&ctx->gb, rice->k);
|
||||
rice->ksum += out[i] - (unsigned)out[i - 64];
|
||||
rice->ksum += out[i] - out[i - 64];
|
||||
while (rice->ksum < ksummin) {
|
||||
rice->k--;
|
||||
ksummin = rice->k ? ksummin >> 1 : 0;
|
||||
@@ -836,7 +836,7 @@ static av_always_inline int filter_fast_3320(APEPredictor *p,
|
||||
else
|
||||
p->coeffsA[filter][0]--;
|
||||
|
||||
p->filterA[filter] += (unsigned)p->lastA[filter];
|
||||
p->filterA[filter] += p->lastA[filter];
|
||||
|
||||
return p->filterA[filter];
|
||||
}
|
||||
@@ -859,9 +859,9 @@ static av_always_inline int filter_3800(APEPredictor *p,
|
||||
return predictionA;
|
||||
}
|
||||
d2 = p->buf[delayA];
|
||||
d1 = (p->buf[delayA] - (unsigned)p->buf[delayA - 1]) * 2;
|
||||
d0 = p->buf[delayA] + ((p->buf[delayA - 2] - (unsigned)p->buf[delayA - 1]) * 8);
|
||||
d3 = p->buf[delayB] * 2U - p->buf[delayB - 1];
|
||||
d1 = (p->buf[delayA] - p->buf[delayA - 1]) << 1;
|
||||
d0 = p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) << 3);
|
||||
d3 = p->buf[delayB] * 2 - p->buf[delayB - 1];
|
||||
d4 = p->buf[delayB];
|
||||
|
||||
predictionA = d0 * p->coeffsA[filter][0] +
|
||||
@@ -880,8 +880,8 @@ static av_always_inline int filter_3800(APEPredictor *p,
|
||||
p->coeffsB[filter][0] += (((d3 >> 29) & 4) - 2) * sign;
|
||||
p->coeffsB[filter][1] -= (((d4 >> 30) & 2) - 1) * sign;
|
||||
|
||||
p->filterB[filter] = p->lastA[filter] + (unsigned)(predictionB >> shift);
|
||||
p->filterA[filter] = p->filterB[filter] + (unsigned)((int)(p->filterA[filter] * 31U) >> 5);
|
||||
p->filterB[filter] = p->lastA[filter] + (predictionB >> shift);
|
||||
p->filterA[filter] = p->filterB[filter] + ((p->filterA[filter] * 31) >> 5);
|
||||
|
||||
return p->filterA[filter];
|
||||
}
|
||||
@@ -902,10 +902,10 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
|
||||
dotprod = 0;
|
||||
sign = APESIGN(buffer[i]);
|
||||
for (j = 0; j < order; j++) {
|
||||
dotprod += delay[j] * (unsigned)coeffs[j];
|
||||
dotprod += delay[j] * coeffs[j];
|
||||
coeffs[j] += ((delay[j] >> 31) | 1) * sign;
|
||||
}
|
||||
buffer[i] -= (unsigned)(dotprod >> shift);
|
||||
buffer[i] -= dotprod >> shift;
|
||||
for (j = 0; j < order - 1; j++)
|
||||
delay[j] = delay[j + 1];
|
||||
delay[order - 1] = buffer[i];
|
||||
@@ -916,8 +916,7 @@ static void long_filter_ehigh_3830(int32_t *buffer, int length)
|
||||
{
|
||||
int i, j;
|
||||
int32_t dotprod, sign;
|
||||
int32_t delay[8] = { 0 };
|
||||
uint32_t coeffs[8] = { 0 };
|
||||
int32_t coeffs[8] = { 0 }, delay[8] = { 0 };
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
dotprod = 0;
|
||||
@@ -929,7 +928,7 @@ static void long_filter_ehigh_3830(int32_t *buffer, int length)
|
||||
for (j = 7; j > 0; j--)
|
||||
delay[j] = delay[j - 1];
|
||||
delay[0] = buffer[i];
|
||||
buffer[i] -= (unsigned)(dotprod >> 9);
|
||||
buffer[i] -= dotprod >> 9;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1038,13 +1037,13 @@ static av_always_inline int predictor_update_3930(APEPredictor *p,
|
||||
const int delayA)
|
||||
{
|
||||
int32_t predictionA, sign;
|
||||
uint32_t d0, d1, d2, d3;
|
||||
int32_t d0, d1, d2, d3;
|
||||
|
||||
p->buf[delayA] = p->lastA[filter];
|
||||
d0 = p->buf[delayA ];
|
||||
d1 = p->buf[delayA ] - (unsigned)p->buf[delayA - 1];
|
||||
d2 = p->buf[delayA - 1] - (unsigned)p->buf[delayA - 2];
|
||||
d3 = p->buf[delayA - 2] - (unsigned)p->buf[delayA - 3];
|
||||
d1 = p->buf[delayA ] - p->buf[delayA - 1];
|
||||
d2 = p->buf[delayA - 1] - p->buf[delayA - 2];
|
||||
d3 = p->buf[delayA - 2] - p->buf[delayA - 3];
|
||||
|
||||
predictionA = d0 * p->coeffsA[filter][0] +
|
||||
d1 * p->coeffsA[filter][1] +
|
||||
@@ -1052,13 +1051,13 @@ static av_always_inline int predictor_update_3930(APEPredictor *p,
|
||||
d3 * p->coeffsA[filter][3];
|
||||
|
||||
p->lastA[filter] = decoded + (predictionA >> 9);
|
||||
p->filterA[filter] = p->lastA[filter] + ((int)(p->filterA[filter] * 31U) >> 5);
|
||||
p->filterA[filter] = p->lastA[filter] + ((p->filterA[filter] * 31) >> 5);
|
||||
|
||||
sign = APESIGN(decoded);
|
||||
p->coeffsA[filter][0] += (((int32_t)d0 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][1] += (((int32_t)d1 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][2] += (((int32_t)d2 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][3] += (((int32_t)d3 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][0] += ((d0 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][1] += ((d1 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][2] += ((d2 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][3] += ((d3 < 0) * 2 - 1) * sign;
|
||||
|
||||
return p->filterA[filter];
|
||||
}
|
||||
@@ -1122,7 +1121,7 @@ static av_always_inline int predictor_update_filter(APEPredictor *p,
|
||||
|
||||
p->buf[delayA] = p->lastA[filter];
|
||||
p->buf[adaptA] = APESIGN(p->buf[delayA]);
|
||||
p->buf[delayA - 1] = p->buf[delayA] - (unsigned)p->buf[delayA - 1];
|
||||
p->buf[delayA - 1] = p->buf[delayA] - p->buf[delayA - 1];
|
||||
p->buf[adaptA - 1] = APESIGN(p->buf[delayA - 1]);
|
||||
|
||||
predictionA = p->buf[delayA ] * p->coeffsA[filter][0] +
|
||||
@@ -1131,9 +1130,9 @@ static av_always_inline int predictor_update_filter(APEPredictor *p,
|
||||
p->buf[delayA - 3] * p->coeffsA[filter][3];
|
||||
|
||||
/* Apply a scaled first-order filter compression */
|
||||
p->buf[delayB] = p->filterA[filter ^ 1] - ((int)(p->filterB[filter] * 31U) >> 5);
|
||||
p->buf[delayB] = p->filterA[filter ^ 1] - ((p->filterB[filter] * 31) >> 5);
|
||||
p->buf[adaptB] = APESIGN(p->buf[delayB]);
|
||||
p->buf[delayB - 1] = p->buf[delayB] - (unsigned)p->buf[delayB - 1];
|
||||
p->buf[delayB - 1] = p->buf[delayB] - p->buf[delayB - 1];
|
||||
p->buf[adaptB - 1] = APESIGN(p->buf[delayB - 1]);
|
||||
p->filterB[filter] = p->filterA[filter ^ 1];
|
||||
|
||||
@@ -1143,8 +1142,8 @@ static av_always_inline int predictor_update_filter(APEPredictor *p,
|
||||
p->buf[delayB - 3] * p->coeffsB[filter][3] +
|
||||
p->buf[delayB - 4] * p->coeffsB[filter][4];
|
||||
|
||||
p->lastA[filter] = decoded + ((int)((unsigned)predictionA + (predictionB >> 1)) >> 10);
|
||||
p->filterA[filter] = p->lastA[filter] + ((int)(p->filterA[filter] * 31U) >> 5);
|
||||
p->lastA[filter] = decoded + ((predictionA + (predictionB >> 1)) >> 10);
|
||||
p->filterA[filter] = p->lastA[filter] + ((p->filterA[filter] * 31) >> 5);
|
||||
|
||||
sign = APESIGN(decoded);
|
||||
p->coeffsA[filter][0] += p->buf[adaptA ] * sign;
|
||||
@@ -1203,14 +1202,14 @@ static void predictor_decode_mono_3950(APEContext *ctx, int count)
|
||||
A = *decoded0;
|
||||
|
||||
p->buf[YDELAYA] = currentA;
|
||||
p->buf[YDELAYA - 1] = p->buf[YDELAYA] - (unsigned)p->buf[YDELAYA - 1];
|
||||
p->buf[YDELAYA - 1] = p->buf[YDELAYA] - p->buf[YDELAYA - 1];
|
||||
|
||||
predictionA = p->buf[YDELAYA ] * p->coeffsA[0][0] +
|
||||
p->buf[YDELAYA - 1] * p->coeffsA[0][1] +
|
||||
p->buf[YDELAYA - 2] * p->coeffsA[0][2] +
|
||||
p->buf[YDELAYA - 3] * p->coeffsA[0][3];
|
||||
|
||||
currentA = A + (unsigned)(predictionA >> 10);
|
||||
currentA = A + (predictionA >> 10);
|
||||
|
||||
p->buf[YADAPTCOEFFSA] = APESIGN(p->buf[YDELAYA ]);
|
||||
p->buf[YADAPTCOEFFSA - 1] = APESIGN(p->buf[YDELAYA - 1]);
|
||||
@@ -1230,7 +1229,7 @@ static void predictor_decode_mono_3950(APEContext *ctx, int count)
|
||||
p->buf = p->historybuffer;
|
||||
}
|
||||
|
||||
p->filterA[0] = currentA + (unsigned)((int)(p->filterA[0] * 31U) >> 5);
|
||||
p->filterA[0] = currentA + ((p->filterA[0] * 31) >> 5);
|
||||
*(decoded0++) = p->filterA[0];
|
||||
}
|
||||
|
||||
@@ -1267,8 +1266,8 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
|
||||
f->delay - order,
|
||||
f->adaptcoeffs - order,
|
||||
order, APESIGN(*data));
|
||||
res = (int)(res + (1U << (fracbits - 1))) >> fracbits;
|
||||
res += (unsigned)*data;
|
||||
res = (res + (1 << (fracbits - 1))) >> fracbits;
|
||||
res += *data;
|
||||
*data++ = res;
|
||||
|
||||
/* Update the output history */
|
||||
@@ -1283,10 +1282,10 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
|
||||
/* Version 3.98 and later files */
|
||||
|
||||
/* Update the adaption coefficients */
|
||||
absres = res < 0 ? -(unsigned)res : res;
|
||||
absres = FFABS(res);
|
||||
if (absres)
|
||||
*f->adaptcoeffs = APESIGN(res) *
|
||||
(8 << ((absres > f->avg * 3LL) + (absres > (f->avg + f->avg / 3))));
|
||||
(8 << ((absres > f->avg * 3) + (absres > f->avg * 4 / 3)));
|
||||
/* equivalent to the following code
|
||||
if (absres <= f->avg * 4 / 3)
|
||||
*f->adaptcoeffs = APESIGN(res) * 8;
|
||||
@@ -1298,7 +1297,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
|
||||
else
|
||||
*f->adaptcoeffs = 0;
|
||||
|
||||
f->avg += (int)(absres - (unsigned)f->avg) / 16;
|
||||
f->avg += (absres - f->avg) / 16;
|
||||
|
||||
f->adaptcoeffs[-1] >>= 1;
|
||||
f->adaptcoeffs[-2] >>= 1;
|
||||
@@ -1377,7 +1376,7 @@ static void ape_unpack_mono(APEContext *ctx, int count)
|
||||
|
||||
static void ape_unpack_stereo(APEContext *ctx, int count)
|
||||
{
|
||||
unsigned left, right;
|
||||
int32_t left, right;
|
||||
int32_t *decoded0 = ctx->decoded[0];
|
||||
int32_t *decoded1 = ctx->decoded[1];
|
||||
|
||||
@@ -1394,7 +1393,7 @@ static void ape_unpack_stereo(APEContext *ctx, int count)
|
||||
|
||||
/* Decorrelate and scale to output depth */
|
||||
while (count--) {
|
||||
left = *decoded1 - (unsigned)(*decoded0 / 2);
|
||||
left = *decoded1 - (*decoded0 / 2);
|
||||
right = left + *decoded0;
|
||||
|
||||
*(decoded0++) = left;
|
||||
@@ -1452,8 +1451,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (s->fileversion >= 3900) {
|
||||
if (offset > 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n");
|
||||
av_freep(&s->data);
|
||||
s->data_size = 0;
|
||||
s->data = NULL;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->data_end - s->ptr < offset) {
|
||||
@@ -1501,7 +1499,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
av_fast_malloc(&s->decoded_buffer, &s->decoded_size, decoded_buffer_size);
|
||||
if (!s->decoded_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
memset(s->decoded_buffer, 0, decoded_buffer_size);
|
||||
memset(s->decoded_buffer, 0, s->decoded_size);
|
||||
s->decoded[0] = s->decoded_buffer;
|
||||
s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8);
|
||||
|
||||
@@ -1529,7 +1527,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
for (ch = 0; ch < s->channels; ch++) {
|
||||
sample8 = (uint8_t *)frame->data[ch];
|
||||
for (i = 0; i < blockstodecode; i++)
|
||||
*sample8++ = (s->decoded[ch][i] + 0x80U) & 0xff;
|
||||
*sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
@@ -1543,7 +1541,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
for (ch = 0; ch < s->channels; ch++) {
|
||||
sample24 = (int32_t *)frame->data[ch];
|
||||
for (i = 0; i < blockstodecode; i++)
|
||||
*sample24++ = s->decoded[ch][i] * 256U;
|
||||
*sample24++ = s->decoded[ch][i] << 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+8
-11
@@ -480,7 +480,7 @@ static void aptx_update_codeword_history(Channel *channel)
|
||||
int32_t cw = ((channel->quantize[0].quantized_sample & 3) << 0) +
|
||||
((channel->quantize[1].quantized_sample & 2) << 1) +
|
||||
((channel->quantize[2].quantized_sample & 1) << 3);
|
||||
channel->codeword_history = (cw << 8) + ((unsigned)channel->codeword_history << 4);
|
||||
channel->codeword_history = (cw << 8) + (channel->codeword_history << 4);
|
||||
}
|
||||
|
||||
static void aptx_generate_dither(Channel *channel)
|
||||
@@ -492,9 +492,9 @@ static void aptx_generate_dither(Channel *channel)
|
||||
aptx_update_codeword_history(channel);
|
||||
|
||||
m = (int64_t)5184443 * (channel->codeword_history >> 7);
|
||||
d = (m * 4) + (m >> 22);
|
||||
d = (m << 2) + (m >> 22);
|
||||
for (subband = 0; subband < NB_SUBBANDS; subband++)
|
||||
channel->dither[subband] = (unsigned)d << (23 - 5*subband);
|
||||
channel->dither[subband] = d << (23 - 5*subband);
|
||||
channel->dither_parity = (d >> 25) & 1;
|
||||
}
|
||||
|
||||
@@ -759,12 +759,12 @@ static void aptx_invert_quantization(InvertQuantize *invert_quantize,
|
||||
if (quantized_sample < 0)
|
||||
qr = -qr;
|
||||
|
||||
qr = rshift64_clip24((qr * (1LL<<32)) + MUL64(dither, tables->invert_quantize_dither_factors[idx]), 32);
|
||||
qr = rshift64_clip24(((int64_t)qr<<32) + MUL64(dither, tables->invert_quantize_dither_factors[idx]), 32);
|
||||
invert_quantize->reconstructed_difference = MUL64(invert_quantize->quantization_factor, qr) >> 19;
|
||||
|
||||
/* update factor_select */
|
||||
factor_select = 32620 * invert_quantize->factor_select;
|
||||
factor_select = rshift32(factor_select + (tables->quantize_factor_select_offset[idx] * (1 << 15)), 15);
|
||||
factor_select = rshift32(factor_select + (tables->quantize_factor_select_offset[idx] << 15), 15);
|
||||
invert_quantize->factor_select = av_clip(factor_select, 0, tables->factor_max);
|
||||
|
||||
/* update quantization factor */
|
||||
@@ -801,7 +801,7 @@ static void aptx_prediction_filtering(Prediction *prediction,
|
||||
prediction->previous_reconstructed_sample = reconstructed_sample;
|
||||
|
||||
reconstructed_differences = aptx_reconstructed_differences_update(prediction, reconstructed_difference, order);
|
||||
srd0 = FFDIFFSIGN(reconstructed_difference, 0) * (1 << 23);
|
||||
srd0 = FFDIFFSIGN(reconstructed_difference, 0) << 23;
|
||||
for (i = 0; i < order; i++) {
|
||||
int32_t srd = FF_SIGNBIT(reconstructed_differences[-i-1]) | 1;
|
||||
prediction->d_weight[i] -= rshift32(prediction->d_weight[i] - srd*srd0, 8);
|
||||
@@ -830,7 +830,7 @@ static void aptx_process_subband(InvertQuantize *invert_quantize,
|
||||
|
||||
range = 0x100000;
|
||||
sw1 = rshift32(-same_sign[1] * prediction->s_weight[1], 1);
|
||||
sw1 = (av_clip(sw1, -range, range) & ~0xF) * 16;
|
||||
sw1 = (av_clip(sw1, -range, range) & ~0xF) << 4;
|
||||
|
||||
range = 0x300000;
|
||||
weight[0] = 254 * prediction->s_weight[0] + 0x800000*same_sign[0] + sw1;
|
||||
@@ -989,9 +989,6 @@ static av_cold int aptx_init(AVCodecContext *avctx)
|
||||
AptXContext *s = avctx->priv_data;
|
||||
int chan, subband;
|
||||
|
||||
if (avctx->channels != 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->hd = avctx->codec->id == AV_CODEC_ID_APTX_HD;
|
||||
s->block_size = s->hd ? 6 : 4;
|
||||
|
||||
@@ -1047,7 +1044,7 @@ static int aptx_decode_frame(AVCodecContext *avctx, void *data,
|
||||
for (channel = 0; channel < NB_CHANNELS; channel++)
|
||||
for (sample = 0; sample < 4; sample++)
|
||||
AV_WN32A(&frame->data[channel][4*(opos+sample)],
|
||||
samples[channel][sample] * 256);
|
||||
samples[channel][sample] << 8);
|
||||
}
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
+1
-2
@@ -31,8 +31,7 @@ static av_cold int ass_decode_init(AVCodecContext *avctx)
|
||||
avctx->subtitle_header = av_malloc(avctx->extradata_size + 1);
|
||||
if (!avctx->subtitle_header)
|
||||
return AVERROR(ENOMEM);
|
||||
if (avctx->extradata_size)
|
||||
memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
|
||||
memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
|
||||
avctx->subtitle_header[avctx->extradata_size] = 0;
|
||||
avctx->subtitle_header_size = avctx->extradata_size;
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -964,7 +964,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (avctx->block_align > 1024 || avctx->block_align <= 0)
|
||||
if (avctx->block_align >= UINT_MAX / 2)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
|
||||
|
||||
@@ -456,10 +456,6 @@ static int decode_channel_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
|
||||
} else if (chan->fill_mode == 3) {
|
||||
pos = ch_num ? chan->num_coded_vals + chan->split_point
|
||||
: ctx->num_quant_units - chan->split_point;
|
||||
if (pos > FF_ARRAY_ELEMS(chan->qu_wordlen)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Split point beyond array\n");
|
||||
pos = FF_ARRAY_ELEMS(chan->qu_wordlen);
|
||||
}
|
||||
for (i = chan->num_coded_vals; i < pos; i++)
|
||||
chan->qu_wordlen[i] = 1;
|
||||
}
|
||||
|
||||
@@ -1,979 +0,0 @@
|
||||
/*
|
||||
* ATRAC9 decoder
|
||||
* Copyright (c) 2018 Rostislav Pehlivanov <atomnuker@gmail.com>
|
||||
*
|
||||
* 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 "internal.h"
|
||||
#include "get_bits.h"
|
||||
#include "fft.h"
|
||||
#include "atrac9tab.h"
|
||||
#include "libavutil/lfg.h"
|
||||
#include "libavutil/float_dsp.h"
|
||||
|
||||
typedef struct ATRAC9ChannelData {
|
||||
int band_ext;
|
||||
int q_unit_cnt;
|
||||
int band_ext_data[4];
|
||||
int32_t scalefactors[31];
|
||||
int32_t scalefactors_prev[31];
|
||||
|
||||
int precision_coarse[30];
|
||||
int precision_fine[30];
|
||||
int precision_mask[30];
|
||||
|
||||
int codebookset[30];
|
||||
|
||||
int32_t q_coeffs_coarse[256];
|
||||
int32_t q_coeffs_fine[256];
|
||||
|
||||
DECLARE_ALIGNED(32, float, coeffs )[256];
|
||||
DECLARE_ALIGNED(32, float, prev_win)[128];
|
||||
} ATRAC9ChannelData;
|
||||
|
||||
typedef struct ATRAC9BlockData {
|
||||
ATRAC9ChannelData channel[2];
|
||||
|
||||
/* Base */
|
||||
int band_count;
|
||||
int q_unit_cnt;
|
||||
int q_unit_cnt_prev;
|
||||
|
||||
/* Stereo block only */
|
||||
int stereo_q_unit;
|
||||
|
||||
/* Band extension only */
|
||||
int has_band_ext;
|
||||
int has_band_ext_data;
|
||||
int band_ext_q_unit;
|
||||
|
||||
/* Gradient */
|
||||
int grad_mode;
|
||||
int grad_boundary;
|
||||
int gradient[31];
|
||||
|
||||
/* Stereo */
|
||||
int cpe_base_channel;
|
||||
int is_signs[30];
|
||||
|
||||
int reuseable;
|
||||
|
||||
} ATRAC9BlockData;
|
||||
|
||||
typedef struct ATRAC9Context {
|
||||
AVCodecContext *avctx;
|
||||
AVFloatDSPContext *fdsp;
|
||||
FFTContext imdct;
|
||||
ATRAC9BlockData block[5];
|
||||
AVLFG lfg;
|
||||
|
||||
/* Set on init */
|
||||
int frame_log2;
|
||||
int avg_frame_size;
|
||||
int frame_count;
|
||||
int samplerate_idx;
|
||||
const ATRAC9BlockConfig *block_config;
|
||||
|
||||
/* Generated on init */
|
||||
VLC sf_vlc[2][8]; /* Signed/unsigned, length */
|
||||
VLC coeff_vlc[2][8][4]; /* Cookbook, precision, cookbook index */
|
||||
uint8_t alloc_curve[48][48];
|
||||
DECLARE_ALIGNED(32, float, imdct_win)[256];
|
||||
|
||||
DECLARE_ALIGNED(32, float, temp)[256];
|
||||
} ATRAC9Context;
|
||||
|
||||
static inline int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
GetBitContext *gb)
|
||||
{
|
||||
int grad_range[2];
|
||||
int grad_value[2];
|
||||
int values, sign, base;
|
||||
uint8_t *curve;
|
||||
float scale;
|
||||
|
||||
b->grad_mode = get_bits(gb, 2);
|
||||
if (b->grad_mode) {
|
||||
grad_range[0] = get_bits(gb, 5);
|
||||
grad_range[1] = 31;
|
||||
grad_value[0] = get_bits(gb, 5);
|
||||
grad_value[1] = 31;
|
||||
} else {
|
||||
grad_range[0] = get_bits(gb, 6);
|
||||
grad_range[1] = get_bits(gb, 6) + 1;
|
||||
grad_value[0] = get_bits(gb, 5);
|
||||
grad_value[1] = get_bits(gb, 5);
|
||||
}
|
||||
b->grad_boundary = get_bits(gb, 4);
|
||||
|
||||
if (grad_range[0] >= grad_range[1] || grad_range[1] > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (grad_value[0] > 31 || grad_value[1] > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (b->grad_boundary > b->q_unit_cnt)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
values = grad_value[1] - grad_value[0];
|
||||
sign = 1 - 2*(values < 0);
|
||||
base = grad_value[0] + sign;
|
||||
scale = (FFABS(values) - 1) / 31.0f;
|
||||
curve = s->alloc_curve[grad_range[1] - grad_range[0] - 1];
|
||||
|
||||
for (int i = 0; i <= b->q_unit_cnt; i++)
|
||||
b->gradient[i] = grad_value[i >= grad_range[0]];
|
||||
|
||||
for (int i = grad_range[0]; i < grad_range[1]; i++)
|
||||
b->gradient[i] = base + sign*((int)(scale*curve[i - grad_range[0]]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void calc_precision(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
ATRAC9ChannelData *c)
|
||||
{
|
||||
memset(c->precision_mask, 0, sizeof(c->precision_mask));
|
||||
for (int i = 1; i < b->q_unit_cnt; i++) {
|
||||
const int delta = FFABS(c->scalefactors[i] - c->scalefactors[i - 1]) - 1;
|
||||
if (delta > 0) {
|
||||
const int neg = c->scalefactors[i - 1] > c->scalefactors[i];
|
||||
c->precision_mask[i - neg] += FFMIN(delta, 5);
|
||||
}
|
||||
}
|
||||
|
||||
if (b->grad_mode) {
|
||||
for (int i = 0; i < b->q_unit_cnt; i++) {
|
||||
c->precision_coarse[i] = c->scalefactors[i];
|
||||
c->precision_coarse[i] += c->precision_mask[i] - b->gradient[i];
|
||||
if (c->precision_coarse[i] < 0)
|
||||
continue;
|
||||
switch (b->grad_mode) {
|
||||
case 1:
|
||||
c->precision_coarse[i] >>= 1;
|
||||
break;
|
||||
case 2:
|
||||
c->precision_coarse[i] = (3 * c->precision_coarse[i]) >> 3;
|
||||
break;
|
||||
case 3:
|
||||
c->precision_coarse[i] >>= 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < b->q_unit_cnt; i++)
|
||||
c->precision_coarse[i] = c->scalefactors[i] - b->gradient[i];
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < b->q_unit_cnt; i++)
|
||||
c->precision_coarse[i] = FFMAX(c->precision_coarse[i], 1);
|
||||
|
||||
for (int i = 0; i < b->grad_boundary; i++)
|
||||
c->precision_coarse[i]++;
|
||||
|
||||
for (int i = 0; i < b->q_unit_cnt; i++) {
|
||||
c->precision_fine[i] = 0;
|
||||
if (c->precision_coarse[i] > 15) {
|
||||
c->precision_fine[i] = FFMIN(c->precision_coarse[i], 30) - 15;
|
||||
c->precision_coarse[i] = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline int parse_band_ext(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
GetBitContext *gb, int stereo)
|
||||
{
|
||||
int ext_band = 0;
|
||||
|
||||
if (b->has_band_ext) {
|
||||
if (b->q_unit_cnt < 13 || b->q_unit_cnt > 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ext_band = at9_tab_band_ext_group[b->q_unit_cnt - 13][2];
|
||||
if (stereo) {
|
||||
b->channel[1].band_ext = get_bits(gb, 2);
|
||||
b->channel[1].band_ext = ext_band > 2 ? b->channel[1].band_ext : 4;
|
||||
} else {
|
||||
skip_bits1(gb);
|
||||
}
|
||||
}
|
||||
|
||||
b->has_band_ext_data = get_bits1(gb);
|
||||
if (!b->has_band_ext_data)
|
||||
return 0;
|
||||
|
||||
if (!b->has_band_ext) {
|
||||
skip_bits(gb, 2);
|
||||
skip_bits_long(gb, get_bits(gb, 5));
|
||||
return 0;
|
||||
}
|
||||
|
||||
b->channel[0].band_ext = get_bits(gb, 2);
|
||||
b->channel[0].band_ext = ext_band > 2 ? b->channel[0].band_ext : 4;
|
||||
|
||||
if (!get_bits(gb, 5)) {
|
||||
for (int i = 0; i <= stereo; i++) {
|
||||
ATRAC9ChannelData *c = &b->channel[i];
|
||||
const int count = at9_tab_band_ext_cnt[c->band_ext][ext_band];
|
||||
for (int j = 0; j < count; j++) {
|
||||
int len = at9_tab_band_ext_lengths[c->band_ext][ext_band][j];
|
||||
c->band_ext_data[j] = av_clip_uintp2_c(c->band_ext_data[j], len);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i <= stereo; i++) {
|
||||
ATRAC9ChannelData *c = &b->channel[i];
|
||||
const int count = at9_tab_band_ext_cnt[c->band_ext][ext_band];
|
||||
for (int j = 0; j < count; j++) {
|
||||
int len = at9_tab_band_ext_lengths[c->band_ext][ext_band][j];
|
||||
c->band_ext_data[j] = get_bits(gb, len);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int read_scalefactors(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
ATRAC9ChannelData *c, GetBitContext *gb,
|
||||
int channel_idx, int first_in_pkt)
|
||||
{
|
||||
static const int mode_map[2][4] = { { 0, 1, 2, 3 }, { 0, 2, 3, 4 } };
|
||||
const int mode = mode_map[channel_idx][get_bits(gb, 2)];
|
||||
|
||||
memset(c->scalefactors, 0, sizeof(c->scalefactors));
|
||||
|
||||
if (first_in_pkt && (mode == 4 || ((mode == 3) && !channel_idx))) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid scalefactor coding mode!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case 0: { /* VLC delta offset */
|
||||
const uint8_t *sf_weights = at9_tab_sf_weights[get_bits(gb, 3)];
|
||||
const int base = get_bits(gb, 5);
|
||||
const int len = get_bits(gb, 2) + 3;
|
||||
const VLC *tab = &s->sf_vlc[0][len];
|
||||
|
||||
c->scalefactors[0] = get_bits(gb, len);
|
||||
|
||||
for (int i = 1; i < b->band_ext_q_unit; i++) {
|
||||
int val = c->scalefactors[i - 1] + get_vlc2(gb, tab->table, 9, 2);
|
||||
c->scalefactors[i] = val & ((1 << len) - 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < b->band_ext_q_unit; i++)
|
||||
c->scalefactors[i] += base - sf_weights[i];
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: { /* CLC offset */
|
||||
const int len = get_bits(gb, 2) + 2;
|
||||
const int base = len < 5 ? get_bits(gb, 5) : 0;
|
||||
for (int i = 0; i < b->band_ext_q_unit; i++)
|
||||
c->scalefactors[i] = base + get_bits(gb, len);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 4: { /* VLC dist to baseline */
|
||||
const int *baseline = mode == 4 ? c->scalefactors_prev :
|
||||
channel_idx ? b->channel[0].scalefactors :
|
||||
c->scalefactors_prev;
|
||||
const int baseline_len = mode == 4 ? b->q_unit_cnt_prev :
|
||||
channel_idx ? b->band_ext_q_unit :
|
||||
b->q_unit_cnt_prev;
|
||||
|
||||
const int len = get_bits(gb, 2) + 2;
|
||||
const int unit_cnt = FFMIN(b->band_ext_q_unit, baseline_len);
|
||||
const VLC *tab = &s->sf_vlc[1][len];
|
||||
|
||||
for (int i = 0; i < unit_cnt; i++) {
|
||||
int dist = get_vlc2(gb, tab->table, 9, 2);
|
||||
c->scalefactors[i] = baseline[i] + dist;
|
||||
}
|
||||
|
||||
for (int i = unit_cnt; i < b->band_ext_q_unit; i++)
|
||||
c->scalefactors[i] = get_bits(gb, 5);
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: { /* VLC offset with baseline */
|
||||
const int *baseline = channel_idx ? b->channel[0].scalefactors :
|
||||
c->scalefactors_prev;
|
||||
const int baseline_len = channel_idx ? b->band_ext_q_unit :
|
||||
b->q_unit_cnt_prev;
|
||||
|
||||
const int base = get_bits(gb, 5) - (1 << (5 - 1));
|
||||
const int len = get_bits(gb, 2) + 1;
|
||||
const int unit_cnt = FFMIN(b->band_ext_q_unit, baseline_len);
|
||||
const VLC *tab = &s->sf_vlc[0][len];
|
||||
|
||||
c->scalefactors[0] = get_bits(gb, len);
|
||||
|
||||
for (int i = 1; i < unit_cnt; i++) {
|
||||
int val = c->scalefactors[i - 1] + get_vlc2(gb, tab->table, 9, 2);
|
||||
c->scalefactors[i] = val & ((1 << len) - 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < unit_cnt; i++)
|
||||
c->scalefactors[i] += base + baseline[i];
|
||||
|
||||
for (int i = unit_cnt; i < b->band_ext_q_unit; i++)
|
||||
c->scalefactors[i] = get_bits(gb, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < b->band_ext_q_unit; i++)
|
||||
if (c->scalefactors[i] < 0 || c->scalefactors[i] > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
memcpy(c->scalefactors_prev, c->scalefactors, sizeof(c->scalefactors));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void calc_codebook_idx(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
ATRAC9ChannelData *c)
|
||||
{
|
||||
int avg = 0;
|
||||
const int last_sf = c->scalefactors[c->q_unit_cnt];
|
||||
|
||||
memset(c->codebookset, 0, sizeof(c->codebookset));
|
||||
|
||||
if (c->q_unit_cnt <= 1)
|
||||
return;
|
||||
if (s->samplerate_idx > 7)
|
||||
return;
|
||||
|
||||
c->scalefactors[c->q_unit_cnt] = c->scalefactors[c->q_unit_cnt - 1];
|
||||
|
||||
if (c->q_unit_cnt > 12) {
|
||||
for (int i = 0; i < 12; i++)
|
||||
avg += c->scalefactors[i];
|
||||
avg = (avg + 6) / 12;
|
||||
}
|
||||
|
||||
for (int i = 8; i < c->q_unit_cnt; i++) {
|
||||
const int prev = c->scalefactors[i - 1];
|
||||
const int cur = c->scalefactors[i ];
|
||||
const int next = c->scalefactors[i + 1];
|
||||
const int min = FFMIN(prev, next);
|
||||
if ((cur - min >= 3 || 2*cur - prev - next >= 3))
|
||||
c->codebookset[i] = 1;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 12; i < c->q_unit_cnt; i++) {
|
||||
const int cur = c->scalefactors[i];
|
||||
const int cnd = at9_q_unit_to_coeff_cnt[i] == 16;
|
||||
const int min = FFMIN(c->scalefactors[i + 1], c->scalefactors[i - 1]);
|
||||
if (c->codebookset[i])
|
||||
continue;
|
||||
|
||||
c->codebookset[i] = (((cur - min) >= 2) && (cur >= (avg - cnd)));
|
||||
}
|
||||
|
||||
c->scalefactors[c->q_unit_cnt] = last_sf;
|
||||
}
|
||||
|
||||
static inline void read_coeffs_coarse(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
ATRAC9ChannelData *c, GetBitContext *gb)
|
||||
{
|
||||
const int max_prec = s->samplerate_idx > 7 ? 1 : 7;
|
||||
|
||||
memset(c->q_coeffs_coarse, 0, sizeof(c->q_coeffs_coarse));
|
||||
|
||||
for (int i = 0; i < c->q_unit_cnt; i++) {
|
||||
int *coeffs = &c->q_coeffs_coarse[at9_q_unit_to_coeff_idx[i]];
|
||||
const int bands = at9_q_unit_to_coeff_cnt[i];
|
||||
const int prec = c->precision_coarse[i] + 1;
|
||||
|
||||
if (prec <= max_prec) {
|
||||
const int cb = c->codebookset[i];
|
||||
const int cbi = at9_q_unit_to_codebookidx[i];
|
||||
const VLC *tab = &s->coeff_vlc[cb][prec][cbi];
|
||||
const HuffmanCodebook *huff = &at9_huffman_coeffs[cb][prec][cbi];
|
||||
const int groups = bands >> huff->value_cnt_pow;
|
||||
|
||||
for (int j = 0; j < groups; j++) {
|
||||
uint16_t val = get_vlc2(gb, tab->table, 9, huff->max_bit_size);
|
||||
|
||||
for (int k = 0; k < huff->value_cnt; k++) {
|
||||
coeffs[k] = sign_extend(val, huff->value_bits);
|
||||
val >>= huff->value_bits;
|
||||
}
|
||||
|
||||
coeffs += huff->value_cnt;
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < bands; j++)
|
||||
coeffs[j] = sign_extend(get_bits(gb, prec), prec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void read_coeffs_fine(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
ATRAC9ChannelData *c, GetBitContext *gb)
|
||||
{
|
||||
memset(c->q_coeffs_fine, 0, sizeof(c->q_coeffs_fine));
|
||||
|
||||
for (int i = 0; i < c->q_unit_cnt; i++) {
|
||||
const int start = at9_q_unit_to_coeff_idx[i + 0];
|
||||
const int end = at9_q_unit_to_coeff_idx[i + 1];
|
||||
const int len = c->precision_fine[i] + 1;
|
||||
|
||||
if (c->precision_fine[i] <= 0)
|
||||
continue;
|
||||
|
||||
for (int j = start; j < end; j++)
|
||||
c->q_coeffs_fine[j] = sign_extend(get_bits(gb, len), len);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void dequantize(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
ATRAC9ChannelData *c)
|
||||
{
|
||||
memset(c->coeffs, 0, sizeof(c->coeffs));
|
||||
|
||||
for (int i = 0; i < c->q_unit_cnt; i++) {
|
||||
const int start = at9_q_unit_to_coeff_idx[i + 0];
|
||||
const int end = at9_q_unit_to_coeff_idx[i + 1];
|
||||
|
||||
const float coarse_c = at9_quant_step_coarse[c->precision_coarse[i]];
|
||||
const float fine_c = at9_quant_step_fine[c->precision_fine[i]];
|
||||
|
||||
for (int j = start; j < end; j++) {
|
||||
const float vc = c->q_coeffs_coarse[j] * coarse_c;
|
||||
const float vf = c->q_coeffs_fine[j] * fine_c;
|
||||
c->coeffs[j] = vc + vf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void apply_intensity_stereo(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
const int stereo)
|
||||
{
|
||||
float *src = b->channel[ b->cpe_base_channel].coeffs;
|
||||
float *dst = b->channel[!b->cpe_base_channel].coeffs;
|
||||
|
||||
if (!stereo)
|
||||
return;
|
||||
|
||||
if (b->q_unit_cnt <= b->stereo_q_unit)
|
||||
return;
|
||||
|
||||
for (int i = b->stereo_q_unit; i < b->q_unit_cnt; i++) {
|
||||
const int sign = b->is_signs[i];
|
||||
const int start = at9_q_unit_to_coeff_idx[i + 0];
|
||||
const int end = at9_q_unit_to_coeff_idx[i + 1];
|
||||
for (int j = start; j < end; j++)
|
||||
dst[j] = sign*src[j];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void apply_scalefactors(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
const int stereo)
|
||||
{
|
||||
for (int i = 0; i <= stereo; i++) {
|
||||
float *coeffs = b->channel[i].coeffs;
|
||||
for (int j = 0; j < b->q_unit_cnt; j++) {
|
||||
const int start = at9_q_unit_to_coeff_idx[j + 0];
|
||||
const int end = at9_q_unit_to_coeff_idx[j + 1];
|
||||
const int scalefactor = b->channel[i].scalefactors[j];
|
||||
const float scale = at9_scalefactor_c[scalefactor];
|
||||
for (int k = start; k < end; k++)
|
||||
coeffs[k] *= scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void fill_with_noise(ATRAC9Context *s, ATRAC9ChannelData *c,
|
||||
int start, int count)
|
||||
{
|
||||
float maxval = 0.0f;
|
||||
for (int i = 0; i < count; i += 2) {
|
||||
double tmp[2];
|
||||
av_bmg_get(&s->lfg, tmp);
|
||||
c->coeffs[start + i + 0] = tmp[0];
|
||||
c->coeffs[start + i + 1] = tmp[1];
|
||||
maxval = FFMAX(FFMAX(FFABS(tmp[0]), FFABS(tmp[1])), maxval);
|
||||
}
|
||||
/* Normalize */
|
||||
for (int i = 0; i < count; i++)
|
||||
c->coeffs[start + i] /= maxval;
|
||||
}
|
||||
|
||||
static inline void scale_band_ext_coeffs(ATRAC9ChannelData *c, float sf[6],
|
||||
const int s_unit, const int e_unit)
|
||||
{
|
||||
for (int i = s_unit; i < e_unit; i++) {
|
||||
const int start = at9_q_unit_to_coeff_idx[i + 0];
|
||||
const int end = at9_q_unit_to_coeff_idx[i + 1];
|
||||
for (int j = start; j < end; j++)
|
||||
c->coeffs[j] *= sf[i - s_unit];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void apply_band_extension(ATRAC9Context *s, ATRAC9BlockData *b,
|
||||
const int stereo)
|
||||
{
|
||||
const int g_units[4] = { /* A, B, C, total units */
|
||||
b->q_unit_cnt,
|
||||
at9_tab_band_ext_group[b->q_unit_cnt - 13][0],
|
||||
at9_tab_band_ext_group[b->q_unit_cnt - 13][1],
|
||||
FFMAX(g_units[2], 22),
|
||||
};
|
||||
|
||||
const int g_bins[4] = { /* A, B, C, total bins */
|
||||
at9_q_unit_to_coeff_idx[g_units[0]],
|
||||
at9_q_unit_to_coeff_idx[g_units[1]],
|
||||
at9_q_unit_to_coeff_idx[g_units[2]],
|
||||
at9_q_unit_to_coeff_idx[g_units[3]],
|
||||
};
|
||||
|
||||
for (int ch = 0; ch <= stereo; ch++) {
|
||||
ATRAC9ChannelData *c = &b->channel[ch];
|
||||
|
||||
/* Mirror the spectrum */
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < (g_bins[i + 1] - g_bins[i + 0]); j++)
|
||||
c->coeffs[g_bins[i] + j] = c->coeffs[g_bins[i] - j - 1];
|
||||
|
||||
switch (c->band_ext) {
|
||||
case 0: {
|
||||
float sf[6] = { 0.0f };
|
||||
const int l = g_units[3] - g_units[0] - 1;
|
||||
const int n_start = at9_q_unit_to_coeff_idx[g_units[3] - 1];
|
||||
const int n_cnt = at9_q_unit_to_coeff_cnt[g_units[3] - 1];
|
||||
switch (at9_tab_band_ext_group[b->q_unit_cnt - 13][2]) {
|
||||
case 3:
|
||||
sf[0] = at9_band_ext_scales_m0[0][0][c->band_ext_data[0]];
|
||||
sf[1] = at9_band_ext_scales_m0[0][1][c->band_ext_data[0]];
|
||||
sf[2] = at9_band_ext_scales_m0[0][2][c->band_ext_data[1]];
|
||||
sf[3] = at9_band_ext_scales_m0[0][3][c->band_ext_data[2]];
|
||||
sf[4] = at9_band_ext_scales_m0[0][4][c->band_ext_data[3]];
|
||||
break;
|
||||
case 4:
|
||||
sf[0] = at9_band_ext_scales_m0[1][0][c->band_ext_data[0]];
|
||||
sf[1] = at9_band_ext_scales_m0[1][1][c->band_ext_data[0]];
|
||||
sf[2] = at9_band_ext_scales_m0[1][2][c->band_ext_data[1]];
|
||||
sf[3] = at9_band_ext_scales_m0[1][3][c->band_ext_data[2]];
|
||||
sf[4] = at9_band_ext_scales_m0[1][4][c->band_ext_data[3]];
|
||||
break;
|
||||
case 5:
|
||||
sf[0] = at9_band_ext_scales_m0[2][0][c->band_ext_data[0]];
|
||||
sf[1] = at9_band_ext_scales_m0[2][1][c->band_ext_data[1]];
|
||||
sf[2] = at9_band_ext_scales_m0[2][2][c->band_ext_data[1]];
|
||||
break;
|
||||
}
|
||||
|
||||
sf[l] = at9_scalefactor_c[c->scalefactors[g_units[0]]];
|
||||
|
||||
fill_with_noise(s, c, n_start, n_cnt);
|
||||
scale_band_ext_coeffs(c, sf, g_units[0], g_units[3]);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
float sf[6];
|
||||
for (int i = g_units[0]; i < g_units[3]; i++)
|
||||
sf[i - g_units[0]] = at9_scalefactor_c[c->scalefactors[i]];
|
||||
|
||||
fill_with_noise(s, c, g_bins[0], g_bins[3] - g_bins[0]);
|
||||
scale_band_ext_coeffs(c, sf, g_units[0], g_units[3]);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const float g_sf[2] = {
|
||||
at9_band_ext_scales_m2[c->band_ext_data[0]],
|
||||
at9_band_ext_scales_m2[c->band_ext_data[1]],
|
||||
};
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int j = g_bins[i + 0]; j < g_bins[i + 1]; j++)
|
||||
c->coeffs[j] *= g_sf[i];
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
float scale = at9_band_ext_scales_m3[c->band_ext_data[0]][0];
|
||||
float rate = at9_band_ext_scales_m3[c->band_ext_data[1]][1];
|
||||
rate = pow(2, rate);
|
||||
for (int i = g_bins[0]; i < g_bins[3]; i++) {
|
||||
scale *= rate;
|
||||
c->coeffs[i] *= scale;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
const float m = at9_band_ext_scales_m4[c->band_ext_data[0]];
|
||||
const float g_sf[3] = { 0.7079468f*m, 0.5011902f*m, 0.3548279f*m };
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = g_bins[i + 0]; j < g_bins[i + 1]; j++)
|
||||
c->coeffs[j] *= g_sf[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int atrac9_decode_block(ATRAC9Context *s, GetBitContext *gb,
|
||||
ATRAC9BlockData *b, AVFrame *frame,
|
||||
int frame_idx, int block_idx)
|
||||
{
|
||||
const int first_in_pkt = !get_bits1(gb);
|
||||
const int reuse_params = get_bits1(gb);
|
||||
const int stereo = s->block_config->type[block_idx] == ATRAC9_BLOCK_TYPE_CPE;
|
||||
|
||||
if (s->block_config->type[block_idx] == ATRAC9_BLOCK_TYPE_LFE) {
|
||||
ATRAC9ChannelData *c = &b->channel[0];
|
||||
const int precision = reuse_params ? 8 : 4;
|
||||
c->q_unit_cnt = b->q_unit_cnt = 2;
|
||||
|
||||
memset(c->scalefactors, 0, sizeof(c->scalefactors));
|
||||
memset(c->q_coeffs_fine, 0, sizeof(c->q_coeffs_fine));
|
||||
memset(c->q_coeffs_coarse, 0, sizeof(c->q_coeffs_coarse));
|
||||
|
||||
for (int i = 0; i < b->q_unit_cnt; i++) {
|
||||
c->scalefactors[i] = get_bits(gb, 5);
|
||||
c->precision_coarse[i] = precision;
|
||||
c->precision_fine[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < c->q_unit_cnt; i++) {
|
||||
const int start = at9_q_unit_to_coeff_idx[i + 0];
|
||||
const int end = at9_q_unit_to_coeff_idx[i + 1];
|
||||
for (int j = start; j < end; j++)
|
||||
c->q_coeffs_coarse[j] = get_bits(gb, c->precision_coarse[i] + 1);
|
||||
}
|
||||
|
||||
dequantize (s, b, c);
|
||||
apply_scalefactors(s, b, 0);
|
||||
|
||||
goto imdct;
|
||||
}
|
||||
|
||||
if (first_in_pkt && reuse_params) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid block flags!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* Band parameters */
|
||||
if (!reuse_params) {
|
||||
int stereo_band, ext_band;
|
||||
const int min_band_count = s->samplerate_idx > 7 ? 1 : 3;
|
||||
b->reuseable = 0;
|
||||
b->band_count = get_bits(gb, 4) + min_band_count;
|
||||
b->q_unit_cnt = at9_tab_band_q_unit_map[b->band_count];
|
||||
|
||||
b->band_ext_q_unit = b->stereo_q_unit = b->q_unit_cnt;
|
||||
|
||||
if (b->band_count > at9_tab_sri_max_bands[s->samplerate_idx]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid band count %i!\n",
|
||||
b->band_count);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (stereo) {
|
||||
stereo_band = get_bits(gb, 4) + min_band_count;
|
||||
if (stereo_band > b->band_count) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid stereo band %i!\n",
|
||||
stereo_band);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
b->stereo_q_unit = at9_tab_band_q_unit_map[stereo_band];
|
||||
}
|
||||
|
||||
b->has_band_ext = get_bits1(gb);
|
||||
if (b->has_band_ext) {
|
||||
ext_band = get_bits(gb, 4) + min_band_count;
|
||||
if (ext_band < b->band_count) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid extension band %i!\n",
|
||||
ext_band);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
b->band_ext_q_unit = at9_tab_band_q_unit_map[ext_band];
|
||||
}
|
||||
b->reuseable = 1;
|
||||
}
|
||||
if (!b->reuseable) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid block reused!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* Calculate bit alloc gradient */
|
||||
if (parse_gradient(s, b, gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* IS data */
|
||||
b->cpe_base_channel = 0;
|
||||
if (stereo) {
|
||||
b->cpe_base_channel = get_bits1(gb);
|
||||
if (get_bits1(gb)) {
|
||||
for (int i = b->stereo_q_unit; i < b->q_unit_cnt; i++)
|
||||
b->is_signs[i] = 1 - 2*get_bits1(gb);
|
||||
} else {
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(b->is_signs); i++)
|
||||
b->is_signs[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Band extension */
|
||||
if (parse_band_ext(s, b, gb, stereo))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* Scalefactors */
|
||||
for (int i = 0; i <= stereo; i++) {
|
||||
ATRAC9ChannelData *c = &b->channel[i];
|
||||
c->q_unit_cnt = i == b->cpe_base_channel ? b->q_unit_cnt :
|
||||
b->stereo_q_unit;
|
||||
if (read_scalefactors(s, b, c, gb, i, first_in_pkt))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
calc_precision (s, b, c);
|
||||
calc_codebook_idx (s, b, c);
|
||||
read_coeffs_coarse(s, b, c, gb);
|
||||
read_coeffs_fine (s, b, c, gb);
|
||||
dequantize (s, b, c);
|
||||
}
|
||||
|
||||
b->q_unit_cnt_prev = b->has_band_ext ? b->band_ext_q_unit : b->q_unit_cnt;
|
||||
|
||||
apply_intensity_stereo(s, b, stereo);
|
||||
apply_scalefactors (s, b, stereo);
|
||||
|
||||
if (b->has_band_ext && b->has_band_ext_data)
|
||||
apply_band_extension (s, b, stereo);
|
||||
|
||||
imdct:
|
||||
for (int i = 0; i <= stereo; i++) {
|
||||
ATRAC9ChannelData *c = &b->channel[i];
|
||||
const int dst_idx = s->block_config->plane_map[block_idx][i];
|
||||
const int wsize = 1 << s->frame_log2;
|
||||
const ptrdiff_t offset = wsize*frame_idx*sizeof(float);
|
||||
float *dst = (float *)(frame->extended_data[dst_idx] + offset);
|
||||
|
||||
s->imdct.imdct_half(&s->imdct, s->temp, c->coeffs);
|
||||
s->fdsp->vector_fmul_window(dst, c->prev_win, s->temp,
|
||||
s->imdct_win, wsize >> 1);
|
||||
memcpy(c->prev_win, s->temp + (wsize >> 1), sizeof(float)*wsize >> 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int atrac9_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int *got_frame_ptr, AVPacket *avpkt)
|
||||
{
|
||||
int ret;
|
||||
GetBitContext gb;
|
||||
AVFrame *frame = data;
|
||||
ATRAC9Context *s = avctx->priv_data;
|
||||
const int frames = FFMIN(avpkt->size / s->avg_frame_size, s->frame_count);
|
||||
|
||||
frame->nb_samples = (1 << s->frame_log2) * frames;
|
||||
ret = ff_get_buffer(avctx, frame, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
init_get_bits8(&gb, avpkt->data, avpkt->size);
|
||||
|
||||
for (int i = 0; i < frames; i++) {
|
||||
for (int j = 0; j < s->block_config->count; j++) {
|
||||
ret = atrac9_decode_block(s, &gb, &s->block[j], frame, i, j);
|
||||
if (ret)
|
||||
return ret;
|
||||
align_get_bits(&gb);
|
||||
}
|
||||
}
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
return avctx->block_align;
|
||||
}
|
||||
|
||||
static void atrac9_decode_flush(AVCodecContext *avctx)
|
||||
{
|
||||
ATRAC9Context *s = avctx->priv_data;
|
||||
|
||||
for (int j = 0; j < s->block_config->count; j++) {
|
||||
ATRAC9BlockData *b = &s->block[j];
|
||||
const int stereo = s->block_config->type[j] == ATRAC9_BLOCK_TYPE_CPE;
|
||||
for (int i = 0; i <= stereo; i++) {
|
||||
ATRAC9ChannelData *c = &b->channel[i];
|
||||
memset(c->prev_win, 0, sizeof(c->prev_win));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static av_cold int atrac9_decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
ATRAC9Context *s = avctx->priv_data;
|
||||
|
||||
for (int i = 1; i < 7; i++)
|
||||
ff_free_vlc(&s->sf_vlc[0][i]);
|
||||
for (int i = 2; i < 6; i++)
|
||||
ff_free_vlc(&s->sf_vlc[1][i]);
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int j = 0; j < 8; j++)
|
||||
for (int k = 0; k < 4; k++)
|
||||
ff_free_vlc(&s->coeff_vlc[i][j][k]);
|
||||
|
||||
ff_mdct_end(&s->imdct);
|
||||
av_free(s->fdsp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold int atrac9_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
GetBitContext gb;
|
||||
ATRAC9Context *s = avctx->priv_data;
|
||||
int version, block_config_idx, superframe_idx, alloc_c_len;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
av_lfg_init(&s->lfg, 0xFBADF00D);
|
||||
|
||||
if (avctx->block_align <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid block align\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (avctx->extradata_size != 12) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid extradata length!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
version = AV_RL32(avctx->extradata);
|
||||
if (version > 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported version (%i)!\n", version);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
init_get_bits8(&gb, avctx->extradata + 4, avctx->extradata_size);
|
||||
|
||||
if (get_bits(&gb, 8) != 0xFE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Incorrect magic byte!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->samplerate_idx = get_bits(&gb, 4);
|
||||
avctx->sample_rate = at9_tab_samplerates[s->samplerate_idx];
|
||||
|
||||
block_config_idx = get_bits(&gb, 3);
|
||||
if (block_config_idx > 5) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Incorrect block config!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->block_config = &at9_block_layout[block_config_idx];
|
||||
|
||||
avctx->channel_layout = s->block_config->channel_layout;
|
||||
avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||
|
||||
if (get_bits1(&gb)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Incorrect verification bit!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* Average frame size in bytes */
|
||||
s->avg_frame_size = get_bits(&gb, 11) + 1;
|
||||
|
||||
superframe_idx = get_bits(&gb, 2);
|
||||
if (superframe_idx & 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid superframe index!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->frame_count = 1 << superframe_idx;
|
||||
s->frame_log2 = at9_tab_sri_frame_log2[s->samplerate_idx];
|
||||
|
||||
if (ff_mdct_init(&s->imdct, s->frame_log2 + 1, 1, 1.0f / 32768.0f))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||
if (!s->fdsp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
/* iMDCT window */
|
||||
for (int i = 0; i < (1 << s->frame_log2); i++) {
|
||||
const int len = 1 << s->frame_log2;
|
||||
const float sidx = ( i + 0.5f) / len;
|
||||
const float eidx = (len - i - 0.5f) / len;
|
||||
const float s_c = sinf(sidx*M_PI - M_PI_2)*0.5f + 0.5f;
|
||||
const float e_c = sinf(eidx*M_PI - M_PI_2)*0.5f + 0.5f;
|
||||
s->imdct_win[i] = s_c / ((s_c * s_c) + (e_c * e_c));
|
||||
}
|
||||
|
||||
/* Allocation curve */
|
||||
alloc_c_len = FF_ARRAY_ELEMS(at9_tab_b_dist);
|
||||
for (int i = 1; i <= alloc_c_len; i++)
|
||||
for (int j = 0; j < i; j++)
|
||||
s->alloc_curve[i - 1][j] = at9_tab_b_dist[(j * alloc_c_len) / i];
|
||||
|
||||
/* Unsigned scalefactor VLCs */
|
||||
for (int i = 1; i < 7; i++) {
|
||||
const HuffmanCodebook *hf = &at9_huffman_sf_unsigned[i];
|
||||
|
||||
init_vlc(&s->sf_vlc[0][i], 9, hf->size, hf->bits, 1, 1, hf->codes,
|
||||
2, 2, 0);
|
||||
}
|
||||
|
||||
/* Signed scalefactor VLCs */
|
||||
for (int i = 2; i < 6; i++) {
|
||||
const HuffmanCodebook *hf = &at9_huffman_sf_signed[i];
|
||||
|
||||
int nums = hf->size;
|
||||
int16_t sym[32];
|
||||
for (int j = 0; j < nums; j++)
|
||||
sym[j] = sign_extend(j, hf->value_bits);
|
||||
|
||||
ff_init_vlc_sparse(&s->sf_vlc[1][i], 9, hf->size, hf->bits, 1, 1,
|
||||
hf->codes, 2, 2, sym, sizeof(*sym), sizeof(*sym), 0);
|
||||
}
|
||||
|
||||
/* Coefficient VLCs */
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
for (int k = 0; k < 4; k++) {
|
||||
const HuffmanCodebook *hf = &at9_huffman_coeffs[i][j][k];
|
||||
init_vlc(&s->coeff_vlc[i][j][k], 9, hf->size, hf->bits, 1, 1,
|
||||
hf->codes, 2, 2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec ff_atrac9_decoder = {
|
||||
.name = "atrac9",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATRAC9 (Adaptive TRansform Acoustic Coding 9)"),
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_ATRAC9,
|
||||
.priv_data_size = sizeof(ATRAC9Context),
|
||||
.init = atrac9_decode_init,
|
||||
.close = atrac9_decode_close,
|
||||
.decode = atrac9_decode_frame,
|
||||
.flush = atrac9_decode_flush,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1,
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -79,7 +79,7 @@ static void vector_clipf_c(float *dst, const float *src, int len,
|
||||
static int32_t scalarproduct_int16_c(const int16_t *v1, const int16_t *v2,
|
||||
int order)
|
||||
{
|
||||
unsigned res = 0;
|
||||
int res = 0;
|
||||
|
||||
while (order--)
|
||||
res += *v1++ **v2++;
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* AV1 common definitions
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AV1_H
|
||||
#define AVCODEC_AV1_H
|
||||
|
||||
// OBU types (section 6.2.2).
|
||||
typedef enum {
|
||||
// 0 reserved.
|
||||
AV1_OBU_SEQUENCE_HEADER = 1,
|
||||
AV1_OBU_TEMPORAL_DELIMITER = 2,
|
||||
AV1_OBU_FRAME_HEADER = 3,
|
||||
AV1_OBU_TILE_GROUP = 4,
|
||||
AV1_OBU_METADATA = 5,
|
||||
AV1_OBU_FRAME = 6,
|
||||
AV1_OBU_REDUNDANT_FRAME_HEADER = 7,
|
||||
AV1_OBU_TILE_LIST = 8,
|
||||
// 9-14 reserved.
|
||||
AV1_OBU_PADDING = 15,
|
||||
} AV1_OBU_Type;
|
||||
|
||||
// Metadata types (section 6.7.1).
|
||||
enum {
|
||||
AV1_METADATA_TYPE_HDR_CLL = 1,
|
||||
AV1_METADATA_TYPE_HDR_MDCV = 2,
|
||||
AV1_METADATA_TYPE_SCALABILITY = 3,
|
||||
AV1_METADATA_TYPE_ITUT_T35 = 4,
|
||||
AV1_METADATA_TYPE_TIMECODE = 5,
|
||||
};
|
||||
|
||||
// Frame types (section 6.8.2).
|
||||
enum {
|
||||
AV1_FRAME_KEY = 0,
|
||||
AV1_FRAME_INTER = 1,
|
||||
AV1_FRAME_INTRA_ONLY = 2,
|
||||
AV1_FRAME_SWITCH = 3,
|
||||
};
|
||||
|
||||
// Reference frames (section 6.10.24).
|
||||
enum {
|
||||
AV1_REF_FRAME_INTRA = 0,
|
||||
AV1_REF_FRAME_LAST = 1,
|
||||
AV1_REF_FRAME_LAST2 = 2,
|
||||
AV1_REF_FRAME_LAST3 = 3,
|
||||
AV1_REF_FRAME_GOLDEN = 4,
|
||||
AV1_REF_FRAME_BWDREF = 5,
|
||||
AV1_REF_FRAME_ALTREF2 = 6,
|
||||
AV1_REF_FRAME_ALTREF = 7,
|
||||
};
|
||||
|
||||
// Constants (section 3).
|
||||
enum {
|
||||
AV1_MAX_OPERATING_POINTS = 32,
|
||||
|
||||
AV1_MAX_SB_SIZE = 128,
|
||||
AV1_MI_SIZE = 4,
|
||||
|
||||
AV1_MAX_TILE_WIDTH = 4096,
|
||||
AV1_MAX_TILE_AREA = 4096 * 2304,
|
||||
AV1_MAX_TILE_ROWS = 64,
|
||||
AV1_MAX_TILE_COLS = 64,
|
||||
|
||||
AV1_NUM_REF_FRAMES = 8,
|
||||
AV1_REFS_PER_FRAME = 7,
|
||||
AV1_TOTAL_REFS_PER_FRAME = 8,
|
||||
AV1_PRIMARY_REF_NONE = 7,
|
||||
|
||||
AV1_MAX_SEGMENTS = 8,
|
||||
AV1_SEG_LVL_MAX = 8,
|
||||
|
||||
AV1_SEG_LVL_ALT_Q = 0,
|
||||
AV1_SEG_LVL_ALT_LF_Y_V = 1,
|
||||
AV1_SEG_LVL_REF_FRAME = 5,
|
||||
AV1_SEG_LVL_SKIP = 6,
|
||||
AV1_SEG_LVL_GLOBAL_MV = 7,
|
||||
|
||||
AV1_SELECT_SCREEN_CONTENT_TOOLS = 2,
|
||||
AV1_SELECT_INTEGER_MV = 2,
|
||||
|
||||
AV1_SUPERRES_NUM = 8,
|
||||
AV1_SUPERRES_DENOM_MIN = 9,
|
||||
|
||||
AV1_INTERPOLATION_FILTER_SWITCHABLE = 4,
|
||||
|
||||
AV1_GM_ABS_ALPHA_BITS = 12,
|
||||
AV1_GM_ALPHA_PREC_BITS = 15,
|
||||
AV1_GM_ABS_TRANS_ONLY_BITS = 9,
|
||||
AV1_GM_TRANS_ONLY_PREC_BITS = 3,
|
||||
AV1_GM_ABS_TRANS_BITS = 12,
|
||||
AV1_GM_TRANS_PREC_BITS = 6,
|
||||
AV1_WARPEDMODEL_PREC_BITS = 16,
|
||||
|
||||
AV1_WARP_MODEL_IDENTITY = 0,
|
||||
AV1_WARP_MODEL_TRANSLATION = 1,
|
||||
AV1_WARP_MODEL_ROTZOOM = 2,
|
||||
AV1_WARP_MODEL_AFFINE = 3,
|
||||
};
|
||||
|
||||
|
||||
// The main colour configuration information uses the same ISO/IEC 23001-8
|
||||
// (H.273) enums as FFmpeg does, so separate definitions are not required.
|
||||
|
||||
// Chroma sample position.
|
||||
enum {
|
||||
AV1_CSP_UNKNOWN = 0,
|
||||
AV1_CSP_VERTICAL = 1, // -> AVCHROMA_LOC_LEFT.
|
||||
AV1_CSP_COLOCATED = 2, // -> AVCHROMA_LOC_TOPLEFT.
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_AV1_H */
|
||||
@@ -1,298 +0,0 @@
|
||||
/*
|
||||
* 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 "libavutil/common.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#include "bsf.h"
|
||||
#include "cbs.h"
|
||||
#include "cbs_av1.h"
|
||||
|
||||
enum {
|
||||
PASS,
|
||||
INSERT,
|
||||
REMOVE,
|
||||
};
|
||||
|
||||
typedef struct AV1MetadataContext {
|
||||
const AVClass *class;
|
||||
|
||||
CodedBitstreamContext *cbc;
|
||||
CodedBitstreamFragment access_unit;
|
||||
|
||||
int td;
|
||||
|
||||
int color_primaries;
|
||||
int transfer_characteristics;
|
||||
int matrix_coefficients;
|
||||
|
||||
int color_range;
|
||||
int chroma_sample_position;
|
||||
|
||||
AVRational tick_rate;
|
||||
int num_ticks_per_picture;
|
||||
} AV1MetadataContext;
|
||||
|
||||
|
||||
static int av1_metadata_update_sequence_header(AVBSFContext *bsf,
|
||||
AV1RawSequenceHeader *seq)
|
||||
{
|
||||
AV1MetadataContext *ctx = bsf->priv_data;
|
||||
AV1RawColorConfig *clc = &seq->color_config;
|
||||
AV1RawTimingInfo *tim = &seq->timing_info;
|
||||
|
||||
if (ctx->color_primaries >= 0 ||
|
||||
ctx->transfer_characteristics >= 0 ||
|
||||
ctx->matrix_coefficients >= 0) {
|
||||
if (!clc->color_description_present_flag) {
|
||||
clc->color_description_present_flag = 1;
|
||||
clc->color_primaries = AVCOL_PRI_UNSPECIFIED;
|
||||
clc->transfer_characteristics = AVCOL_TRC_UNSPECIFIED;
|
||||
clc->matrix_coefficients = AVCOL_SPC_UNSPECIFIED;
|
||||
}
|
||||
|
||||
if (ctx->color_primaries >= 0)
|
||||
clc->color_primaries = ctx->color_primaries;
|
||||
if (ctx->transfer_characteristics >= 0)
|
||||
clc->transfer_characteristics = ctx->transfer_characteristics;
|
||||
if (ctx->matrix_coefficients >= 0)
|
||||
clc->matrix_coefficients = ctx->matrix_coefficients;
|
||||
}
|
||||
|
||||
if (ctx->color_range >= 0) {
|
||||
if (clc->color_primaries == AVCOL_PRI_BT709 &&
|
||||
clc->transfer_characteristics == AVCOL_TRC_IEC61966_2_1 &&
|
||||
clc->matrix_coefficients == AVCOL_SPC_RGB) {
|
||||
av_log(bsf, AV_LOG_WARNING, "Warning: color_range cannot be set "
|
||||
"on RGB streams encoded in BT.709 sRGB.\n");
|
||||
} else {
|
||||
clc->color_range = ctx->color_range;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->chroma_sample_position >= 0) {
|
||||
if (clc->mono_chrome || !clc->subsampling_x || !clc->subsampling_y) {
|
||||
av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position "
|
||||
"can only be set for 4:2:0 streams.\n");
|
||||
} else {
|
||||
clc->chroma_sample_position = ctx->chroma_sample_position;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->tick_rate.num && ctx->tick_rate.den) {
|
||||
int num, den;
|
||||
|
||||
av_reduce(&num, &den, ctx->tick_rate.num, ctx->tick_rate.den,
|
||||
UINT32_MAX > INT_MAX ? UINT32_MAX : INT_MAX);
|
||||
|
||||
tim->time_scale = num;
|
||||
tim->num_units_in_display_tick = den;
|
||||
seq->timing_info_present_flag = 1;
|
||||
|
||||
if (ctx->num_ticks_per_picture > 0) {
|
||||
tim->equal_picture_interval = 1;
|
||||
tim->num_ticks_per_picture_minus_1 =
|
||||
ctx->num_ticks_per_picture - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *out)
|
||||
{
|
||||
AV1MetadataContext *ctx = bsf->priv_data;
|
||||
AVPacket *in = NULL;
|
||||
CodedBitstreamFragment *frag = &ctx->access_unit;
|
||||
AV1RawOBU td, *obu;
|
||||
int err, i;
|
||||
|
||||
err = ff_bsf_get_packet(bsf, &in);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = ff_cbs_read_packet(ctx->cbc, frag, in);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to read packet.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < frag->nb_units; i++) {
|
||||
if (frag->units[i].type == AV1_OBU_SEQUENCE_HEADER) {
|
||||
obu = frag->units[i].content;
|
||||
err = av1_metadata_update_sequence_header(bsf, &obu->obu.sequence_header);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
// If a Temporal Delimiter is present, it must be the first OBU.
|
||||
if (frag->units[0].type == AV1_OBU_TEMPORAL_DELIMITER) {
|
||||
if (ctx->td == REMOVE)
|
||||
ff_cbs_delete_unit(ctx->cbc, frag, 0);
|
||||
} else if (ctx->td == INSERT) {
|
||||
td = (AV1RawOBU) {
|
||||
.header.obu_type = AV1_OBU_TEMPORAL_DELIMITER,
|
||||
};
|
||||
|
||||
err = ff_cbs_insert_unit_content(ctx->cbc, frag, 0, AV1_OBU_TEMPORAL_DELIMITER,
|
||||
&td, NULL);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to insert Temporal Delimiter.\n");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
err = ff_cbs_write_packet(ctx->cbc, out, frag);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to write packet.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
err = av_packet_copy_props(out, in);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_uninit(ctx->cbc, frag);
|
||||
|
||||
if (err < 0)
|
||||
av_packet_unref(out);
|
||||
av_packet_free(&in);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int av1_metadata_init(AVBSFContext *bsf)
|
||||
{
|
||||
AV1MetadataContext *ctx = bsf->priv_data;
|
||||
CodedBitstreamFragment *frag = &ctx->access_unit;
|
||||
AV1RawOBU *obu;
|
||||
int err, i;
|
||||
|
||||
err = ff_cbs_init(&ctx->cbc, AV_CODEC_ID_AV1, bsf);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (bsf->par_in->extradata) {
|
||||
err = ff_cbs_read_extradata(ctx->cbc, frag, bsf->par_in);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < frag->nb_units; i++) {
|
||||
if (frag->units[i].type == AV1_OBU_SEQUENCE_HEADER) {
|
||||
obu = frag->units[i].content;
|
||||
err = av1_metadata_update_sequence_header(bsf, &obu->obu.sequence_header);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
err = ff_cbs_write_extradata(ctx->cbc, bsf->par_out, frag);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_uninit(ctx->cbc, frag);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void av1_metadata_close(AVBSFContext *bsf)
|
||||
{
|
||||
AV1MetadataContext *ctx = bsf->priv_data;
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(AV1MetadataContext, x)
|
||||
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
|
||||
static const AVOption av1_metadata_options[] = {
|
||||
{ "td", "Temporal Delimiter OBU",
|
||||
OFFSET(td), AV_OPT_TYPE_INT,
|
||||
{ .i64 = PASS }, PASS, REMOVE, FLAGS, "td" },
|
||||
{ "pass", NULL, 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = PASS }, .flags = FLAGS, .unit = "td" },
|
||||
{ "insert", NULL, 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = INSERT }, .flags = FLAGS, .unit = "td" },
|
||||
{ "remove", NULL, 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = REMOVE }, .flags = FLAGS, .unit = "td" },
|
||||
|
||||
{ "color_primaries", "Set color primaries (section 6.4.2)",
|
||||
OFFSET(color_primaries), AV_OPT_TYPE_INT,
|
||||
{ .i64 = -1 }, -1, 255, FLAGS },
|
||||
{ "transfer_characteristics", "Set transfer characteristics (section 6.4.2)",
|
||||
OFFSET(transfer_characteristics), AV_OPT_TYPE_INT,
|
||||
{ .i64 = -1 }, -1, 255, FLAGS },
|
||||
{ "matrix_coefficients", "Set matrix coefficients (section 6.4.2)",
|
||||
OFFSET(matrix_coefficients), AV_OPT_TYPE_INT,
|
||||
{ .i64 = -1 }, -1, 255, FLAGS },
|
||||
|
||||
{ "color_range", "Set color range flag (section 6.4.2)",
|
||||
OFFSET(color_range), AV_OPT_TYPE_INT,
|
||||
{ .i64 = -1 }, -1, 1, FLAGS, "cr" },
|
||||
{ "tv", "TV (limited) range", 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = 0 }, .flags = FLAGS, .unit = "cr" },
|
||||
{ "pc", "PC (full) range", 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = 1 }, .flags = FLAGS, .unit = "cr" },
|
||||
|
||||
{ "chroma_sample_position", "Set chroma sample position (section 6.4.2)",
|
||||
OFFSET(chroma_sample_position), AV_OPT_TYPE_INT,
|
||||
{ .i64 = -1 }, -1, 3, FLAGS, "csp" },
|
||||
{ "unknown", "Unknown chroma sample position", 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = AV1_CSP_UNKNOWN }, .flags = FLAGS, .unit = "csp" },
|
||||
{ "vertical", "Left chroma sample position", 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = AV1_CSP_VERTICAL }, .flags = FLAGS, .unit = "csp" },
|
||||
{ "colocated", "Top-left chroma sample position", 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = AV1_CSP_COLOCATED }, .flags = FLAGS, .unit = "csp" },
|
||||
|
||||
{ "tick_rate", "Set display tick rate (num_units_in_display_tick / time_scale)",
|
||||
OFFSET(tick_rate), AV_OPT_TYPE_RATIONAL,
|
||||
{ .dbl = 0.0 }, 0, UINT_MAX, FLAGS },
|
||||
{ "num_ticks_per_picture", "Set display ticks per picture for CFR streams",
|
||||
OFFSET(num_ticks_per_picture), AV_OPT_TYPE_INT,
|
||||
{ .i64 = -1 }, -1, INT_MAX, FLAGS },
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const AVClass av1_metadata_class = {
|
||||
.class_name = "av1_metadata_bsf",
|
||||
.item_name = av_default_item_name,
|
||||
.option = av1_metadata_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
static const enum AVCodecID av1_metadata_codec_ids[] = {
|
||||
AV_CODEC_ID_AV1, AV_CODEC_ID_NONE,
|
||||
};
|
||||
|
||||
const AVBitStreamFilter ff_av1_metadata_bsf = {
|
||||
.name = "av1_metadata",
|
||||
.priv_data_size = sizeof(AV1MetadataContext),
|
||||
.priv_class = &av1_metadata_class,
|
||||
.init = &av1_metadata_init,
|
||||
.close = &av1_metadata_close,
|
||||
.filter = &av1_metadata_filter,
|
||||
.codec_ids = av1_metadata_codec_ids,
|
||||
};
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* AV1 common parsing code
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
#include "libavutil/mem.h"
|
||||
|
||||
#include "av1.h"
|
||||
#include "av1_parse.h"
|
||||
#include "bytestream.h"
|
||||
|
||||
int ff_av1_extract_obu(AV1OBU *obu, const uint8_t *buf, int length, void *logctx)
|
||||
{
|
||||
int64_t obu_size;
|
||||
int start_pos, type, temporal_id, spatial_id;
|
||||
int len;
|
||||
|
||||
len = parse_obu_header(buf, length, &obu_size, &start_pos,
|
||||
&type, &temporal_id, &spatial_id);
|
||||
if (len < 0)
|
||||
return len;
|
||||
|
||||
obu->type = type;
|
||||
obu->temporal_id = temporal_id;
|
||||
obu->spatial_id = spatial_id;
|
||||
|
||||
obu->data = buf + start_pos;
|
||||
obu->size = obu_size;
|
||||
obu->raw_data = buf;
|
||||
obu->raw_size = len;
|
||||
|
||||
av_log(logctx, AV_LOG_DEBUG,
|
||||
"obu_type: %d, temporal_id: %d, spatial_id: %d, payload size: %d\n",
|
||||
obu->type, obu->temporal_id, obu->spatial_id, obu->size);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int ff_av1_packet_split(AV1Packet *pkt, const uint8_t *buf, int length, void *logctx)
|
||||
{
|
||||
GetByteContext bc;
|
||||
int ret, consumed;
|
||||
|
||||
bytestream2_init(&bc, buf, length);
|
||||
pkt->nb_obus = 0;
|
||||
|
||||
while (bytestream2_get_bytes_left(&bc) > 0) {
|
||||
AV1OBU *obu;
|
||||
|
||||
if (pkt->obus_allocated < pkt->nb_obus + 1) {
|
||||
int new_size = pkt->obus_allocated + 1;
|
||||
AV1OBU *tmp = av_realloc_array(pkt->obus, new_size, sizeof(*tmp));
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
pkt->obus = tmp;
|
||||
memset(pkt->obus + pkt->obus_allocated, 0,
|
||||
(new_size - pkt->obus_allocated) * sizeof(*tmp));
|
||||
pkt->obus_allocated = new_size;
|
||||
}
|
||||
obu = &pkt->obus[pkt->nb_obus];
|
||||
|
||||
consumed = ff_av1_extract_obu(obu, bc.buffer, bytestream2_get_bytes_left(&bc), logctx);
|
||||
if (consumed < 0)
|
||||
return consumed;
|
||||
|
||||
bytestream2_skip(&bc, consumed);
|
||||
|
||||
obu->size_bits = get_obu_bit_length(obu->data, obu->size, obu->type);
|
||||
|
||||
if (obu->size_bits < 0 || (!obu->size_bits && obu->type != AV1_OBU_TEMPORAL_DELIMITER)) {
|
||||
av_log(logctx, AV_LOG_ERROR, "Invalid OBU of type %d, skipping.\n", obu->type);
|
||||
continue;
|
||||
}
|
||||
|
||||
pkt->nb_obus++;
|
||||
|
||||
ret = init_get_bits(&obu->gb, obu->data, obu->size_bits);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_av1_packet_uninit(AV1Packet *pkt)
|
||||
{
|
||||
av_freep(&pkt->obus);
|
||||
pkt->obus_allocated = 0;
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
/*
|
||||
* AV1 common parsing code
|
||||
*
|
||||
* 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_AV1_PARSE_H
|
||||
#define AVCODEC_AV1_PARSE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "av1.h"
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
typedef struct AV1OBU {
|
||||
/** Size of payload */
|
||||
int size;
|
||||
const uint8_t *data;
|
||||
|
||||
/**
|
||||
* Size, in bits, of just the data, excluding the trailing_one_bit and
|
||||
* any trailing padding.
|
||||
*/
|
||||
int size_bits;
|
||||
|
||||
/** Size of entire OBU, including header */
|
||||
int raw_size;
|
||||
const uint8_t *raw_data;
|
||||
|
||||
/** GetBitContext initialized to the start of the payload */
|
||||
GetBitContext gb;
|
||||
|
||||
int type;
|
||||
|
||||
int temporal_id;
|
||||
int spatial_id;
|
||||
} AV1OBU;
|
||||
|
||||
/** An input packet split into OBUs */
|
||||
typedef struct AV1Packet {
|
||||
AV1OBU *obus;
|
||||
int nb_obus;
|
||||
int obus_allocated;
|
||||
} AV1Packet;
|
||||
|
||||
/**
|
||||
* Extract an OBU from a raw bitstream.
|
||||
*
|
||||
* @note This function does not copy or store any bitstream data. All
|
||||
* the pointers in the AV1OBU structure will be valid as long
|
||||
* as the input buffer also is.
|
||||
*/
|
||||
int ff_av1_extract_obu(AV1OBU *obu, const uint8_t *buf, int length,
|
||||
void *logctx);
|
||||
|
||||
/**
|
||||
* Split an input packet into OBUs.
|
||||
*
|
||||
* @note This function does not copy or store any bitstream data. All
|
||||
* the pointers in the AV1Packet structure will be valid as
|
||||
* long as the input buffer also is.
|
||||
*/
|
||||
int ff_av1_packet_split(AV1Packet *pkt, const uint8_t *buf, int length,
|
||||
void *logctx);
|
||||
|
||||
/**
|
||||
* Free all the allocated memory in the packet.
|
||||
*/
|
||||
void ff_av1_packet_uninit(AV1Packet *pkt);
|
||||
|
||||
static inline int64_t leb128(GetBitContext *gb) {
|
||||
int64_t ret = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
int byte = get_bits(gb, 8);
|
||||
ret |= (int64_t)(byte & 0x7f) << (i * 7);
|
||||
if (!(byte & 0x80))
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int parse_obu_header(const uint8_t *buf, int buf_size,
|
||||
int64_t *obu_size, int *start_pos, int *type,
|
||||
int *temporal_id, int *spatial_id)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int ret, extension_flag, has_size_flag;
|
||||
int64_t size;
|
||||
|
||||
ret = init_get_bits8(&gb, buf, FFMIN(buf_size, 2 + 8)); // OBU header fields + max leb128 length
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (get_bits1(&gb) != 0) // obu_forbidden_bit
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
*type = get_bits(&gb, 4);
|
||||
extension_flag = get_bits1(&gb);
|
||||
has_size_flag = get_bits1(&gb);
|
||||
skip_bits1(&gb); // obu_reserved_1bit
|
||||
|
||||
if (extension_flag) {
|
||||
*temporal_id = get_bits(&gb, 3);
|
||||
*spatial_id = get_bits(&gb, 2);
|
||||
skip_bits(&gb, 3); // extension_header_reserved_3bits
|
||||
} else {
|
||||
*temporal_id = *spatial_id = 0;
|
||||
}
|
||||
|
||||
*obu_size = has_size_flag ? leb128(&gb)
|
||||
: buf_size - 1 - extension_flag;
|
||||
|
||||
if (get_bits_left(&gb) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
*start_pos = get_bits_count(&gb) / 8;
|
||||
|
||||
size = *obu_size + *start_pos;
|
||||
|
||||
if (size > buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static inline int get_obu_bit_length(const uint8_t *buf, int size, int type)
|
||||
{
|
||||
int v;
|
||||
|
||||
/* There are no trailing bits on these */
|
||||
if (type == AV1_OBU_TILE_GROUP || type == AV1_OBU_FRAME) {
|
||||
if (size > INT_MAX / 8)
|
||||
return AVERROR(ERANGE);
|
||||
else
|
||||
return size * 8;
|
||||
}
|
||||
|
||||
while (size > 0 && buf[size - 1] == 0)
|
||||
size--;
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
v = buf[size - 1];
|
||||
|
||||
if (size > INT_MAX / 8)
|
||||
return AVERROR(ERANGE);
|
||||
size *= 8;
|
||||
|
||||
/* Remove the trailing_one_bit and following trailing zeros */
|
||||
if (v)
|
||||
size -= ff_ctz(v) + 1;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_AV1_PARSE_H */
|
||||
@@ -1,230 +0,0 @@
|
||||
/*
|
||||
* AV1 parser
|
||||
*
|
||||
* Copyright (C) 2018 James Almer <jamrial@gmail.com>
|
||||
*
|
||||
* 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 "av1_parse.h"
|
||||
#include "cbs.h"
|
||||
#include "cbs_av1.h"
|
||||
#include "parser.h"
|
||||
|
||||
typedef struct AV1ParseContext {
|
||||
CodedBitstreamContext *cbc;
|
||||
CodedBitstreamFragment temporal_unit;
|
||||
int parsed_extradata;
|
||||
} AV1ParseContext;
|
||||
|
||||
static const enum AVPixelFormat pix_fmts_8bit[2][2] = {
|
||||
{ AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE },
|
||||
{ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P },
|
||||
};
|
||||
static const enum AVPixelFormat pix_fmts_10bit[2][2] = {
|
||||
{ AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE },
|
||||
{ AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV420P10 },
|
||||
};
|
||||
static const enum AVPixelFormat pix_fmts_12bit[2][2] = {
|
||||
{ AV_PIX_FMT_YUV444P12, AV_PIX_FMT_NONE },
|
||||
{ AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12 },
|
||||
};
|
||||
|
||||
static int av1_parser_parse(AVCodecParserContext *ctx,
|
||||
AVCodecContext *avctx,
|
||||
const uint8_t **out_data, int *out_size,
|
||||
const uint8_t *data, int size)
|
||||
{
|
||||
AV1ParseContext *s = ctx->priv_data;
|
||||
CodedBitstreamFragment *td = &s->temporal_unit;
|
||||
CodedBitstreamAV1Context *av1 = s->cbc->priv_data;
|
||||
int ret;
|
||||
|
||||
*out_data = data;
|
||||
*out_size = size;
|
||||
|
||||
ctx->key_frame = -1;
|
||||
ctx->pict_type = AV_PICTURE_TYPE_NONE;
|
||||
ctx->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
|
||||
|
||||
s->cbc->log_ctx = avctx;
|
||||
|
||||
if (avctx->extradata_size && !s->parsed_extradata) {
|
||||
s->parsed_extradata = 1;
|
||||
|
||||
ret = ff_cbs_read(s->cbc, td, avctx->extradata, avctx->extradata_size);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata.\n");
|
||||
}
|
||||
|
||||
ff_cbs_fragment_uninit(s->cbc, td);
|
||||
}
|
||||
|
||||
ret = ff_cbs_read(s->cbc, td, data, size);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!av1->sequence_header) {
|
||||
av_log(avctx, AV_LOG_ERROR, "No sequence header available\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (int i = 0; i < td->nb_units; i++) {
|
||||
CodedBitstreamUnit *unit = &td->units[i];
|
||||
AV1RawOBU *obu = unit->content;
|
||||
AV1RawSequenceHeader *seq = av1->sequence_header;
|
||||
AV1RawColorConfig *color = &seq->color_config;
|
||||
AV1RawFrameHeader *frame;
|
||||
int frame_type;
|
||||
|
||||
if (unit->type == AV1_OBU_FRAME)
|
||||
frame = &obu->obu.frame.header;
|
||||
else if (unit->type == AV1_OBU_FRAME_HEADER)
|
||||
frame = &obu->obu.frame_header;
|
||||
else
|
||||
continue;
|
||||
|
||||
if (obu->header.spatial_id > 0)
|
||||
continue;
|
||||
|
||||
if (frame->show_existing_frame) {
|
||||
AV1ReferenceFrameState *ref = &av1->ref[frame->frame_to_show_map_idx];
|
||||
|
||||
if (!ref->valid) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid reference frame\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->width = ref->frame_width;
|
||||
ctx->height = ref->frame_height;
|
||||
frame_type = ref->frame_type;
|
||||
|
||||
ctx->key_frame = 0;
|
||||
} else if (!frame->show_frame) {
|
||||
continue;
|
||||
} else {
|
||||
ctx->width = av1->frame_width;
|
||||
ctx->height = av1->frame_height;
|
||||
frame_type = frame->frame_type;
|
||||
|
||||
ctx->key_frame = frame_type == AV1_FRAME_KEY;
|
||||
}
|
||||
|
||||
avctx->profile = seq->seq_profile;
|
||||
avctx->level = seq->seq_level_idx[0];
|
||||
|
||||
switch (frame_type) {
|
||||
case AV1_FRAME_KEY:
|
||||
case AV1_FRAME_INTRA_ONLY:
|
||||
ctx->pict_type = AV_PICTURE_TYPE_I;
|
||||
break;
|
||||
case AV1_FRAME_INTER:
|
||||
ctx->pict_type = AV_PICTURE_TYPE_P;
|
||||
break;
|
||||
case AV1_FRAME_SWITCH:
|
||||
ctx->pict_type = AV_PICTURE_TYPE_SP;
|
||||
break;
|
||||
}
|
||||
ctx->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
|
||||
|
||||
switch (av1->bit_depth) {
|
||||
case 8:
|
||||
ctx->format = color->mono_chrome ? AV_PIX_FMT_GRAY8
|
||||
: pix_fmts_8bit [color->subsampling_x][color->subsampling_y];
|
||||
break;
|
||||
case 10:
|
||||
ctx->format = color->mono_chrome ? AV_PIX_FMT_GRAY10
|
||||
: pix_fmts_10bit[color->subsampling_x][color->subsampling_y];
|
||||
break;
|
||||
case 12:
|
||||
ctx->format = color->mono_chrome ? AV_PIX_FMT_GRAY12
|
||||
: pix_fmts_12bit[color->subsampling_x][color->subsampling_y];
|
||||
break;
|
||||
}
|
||||
av_assert2(ctx->format != AV_PIX_FMT_NONE);
|
||||
}
|
||||
|
||||
end:
|
||||
ff_cbs_fragment_uninit(s->cbc, td);
|
||||
|
||||
s->cbc->log_ctx = NULL;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static const CodedBitstreamUnitType decompose_unit_types[] = {
|
||||
AV1_OBU_TEMPORAL_DELIMITER,
|
||||
AV1_OBU_SEQUENCE_HEADER,
|
||||
AV1_OBU_FRAME_HEADER,
|
||||
AV1_OBU_TILE_GROUP,
|
||||
AV1_OBU_FRAME,
|
||||
};
|
||||
|
||||
static av_cold int av1_parser_init(AVCodecParserContext *ctx)
|
||||
{
|
||||
AV1ParseContext *s = ctx->priv_data;
|
||||
int ret;
|
||||
|
||||
ret = ff_cbs_init(&s->cbc, AV_CODEC_ID_AV1, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
s->cbc->decompose_unit_types = (CodedBitstreamUnitType *)decompose_unit_types;
|
||||
s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void av1_parser_close(AVCodecParserContext *ctx)
|
||||
{
|
||||
AV1ParseContext *s = ctx->priv_data;
|
||||
|
||||
ff_cbs_close(&s->cbc);
|
||||
}
|
||||
|
||||
static int av1_parser_split(AVCodecContext *avctx,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
AV1OBU obu;
|
||||
const uint8_t *ptr = buf, *end = buf + buf_size;
|
||||
|
||||
while (ptr < end) {
|
||||
int len = ff_av1_extract_obu(&obu, ptr, buf_size, avctx);
|
||||
if (len < 0)
|
||||
break;
|
||||
|
||||
if (obu.type == AV1_OBU_FRAME_HEADER ||
|
||||
obu.type == AV1_OBU_FRAME) {
|
||||
return ptr - buf;
|
||||
}
|
||||
ptr += len;
|
||||
buf_size -= len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodecParser ff_av1_parser = {
|
||||
.codec_ids = { AV_CODEC_ID_AV1 },
|
||||
.priv_data_size = sizeof(AV1ParseContext),
|
||||
.parser_init = av1_parser_init,
|
||||
.parser_close = av1_parser_close,
|
||||
.parser_parse = av1_parser_parse,
|
||||
.split = av1_parser_split,
|
||||
};
|
||||
+1
-23
@@ -409,7 +409,6 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_DXV,
|
||||
AV_CODEC_ID_SCREENPRESSO,
|
||||
AV_CODEC_ID_RSCC,
|
||||
AV_CODEC_ID_AVS2,
|
||||
|
||||
AV_CODEC_ID_Y41P = 0x8000,
|
||||
AV_CODEC_ID_AVRP,
|
||||
@@ -447,11 +446,6 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_SVG,
|
||||
AV_CODEC_ID_GDV,
|
||||
AV_CODEC_ID_FITS,
|
||||
AV_CODEC_ID_IMM4,
|
||||
AV_CODEC_ID_PROSUMER,
|
||||
AV_CODEC_ID_MWSC,
|
||||
AV_CODEC_ID_WCMV,
|
||||
AV_CODEC_ID_RASC,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
||||
@@ -491,7 +485,6 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_PCM_S64BE,
|
||||
AV_CODEC_ID_PCM_F16LE,
|
||||
AV_CODEC_ID_PCM_F24LE,
|
||||
AV_CODEC_ID_PCM_VIDC,
|
||||
|
||||
/* various ADPCM codecs */
|
||||
AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
|
||||
@@ -644,7 +637,6 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_APTX,
|
||||
AV_CODEC_ID_APTX_HD,
|
||||
AV_CODEC_ID_SBC,
|
||||
AV_CODEC_ID_ATRAC9,
|
||||
|
||||
/* subtitle codecs */
|
||||
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
|
||||
@@ -673,7 +665,6 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_PJS,
|
||||
AV_CODEC_ID_ASS,
|
||||
AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
|
||||
AV_CODEC_ID_TTML,
|
||||
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||
@@ -1321,7 +1312,7 @@ enum AVPacketSideDataType {
|
||||
AV_PKT_DATA_METADATA_UPDATE,
|
||||
|
||||
/**
|
||||
* MPEGTS stream ID as uint8_t, this is required to pass the stream ID
|
||||
* MPEGTS stream ID, this is required to pass the stream ID
|
||||
* information from the demuxer to the corresponding muxer.
|
||||
*/
|
||||
AV_PKT_DATA_MPEGTS_STREAM_ID,
|
||||
@@ -1366,12 +1357,6 @@ enum AVPacketSideDataType {
|
||||
*/
|
||||
AV_PKT_DATA_ENCRYPTION_INFO,
|
||||
|
||||
/**
|
||||
* Active Format Description data consisting of a single byte as specified
|
||||
* in ETSI TS 101 154 using AVActiveFormatDescription enum.
|
||||
*/
|
||||
AV_PKT_DATA_AFD,
|
||||
|
||||
/**
|
||||
* The number of side data types.
|
||||
* This is not part of the public API/ABI in the sense that it may
|
||||
@@ -1627,7 +1612,6 @@ typedef struct AVCodecContext {
|
||||
* The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
|
||||
* than extradata_size to avoid problems if it is read with the bitstream reader.
|
||||
* The bytewise contents of extradata must not depend on the architecture or CPU endianness.
|
||||
* Must be allocated with the av_malloc() family of functions.
|
||||
* - encoding: Set/allocated/freed by libavcodec.
|
||||
* - decoding: Set/allocated/freed by user.
|
||||
*/
|
||||
@@ -5782,7 +5766,6 @@ typedef struct AVBitStreamFilter {
|
||||
int (*init)(AVBSFContext *ctx);
|
||||
int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
|
||||
void (*close)(AVBSFContext *ctx);
|
||||
void (*flush)(AVBSFContext *ctx);
|
||||
} AVBitStreamFilter;
|
||||
|
||||
#if FF_API_OLD_BSF
|
||||
@@ -5909,11 +5892,6 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
|
||||
*/
|
||||
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Reset the internal bitstream filter state / flush internal buffers.
|
||||
*/
|
||||
void av_bsf_flush(AVBSFContext *ctx);
|
||||
|
||||
/**
|
||||
* Free a bitstream filter context and everything associated with it; write NULL
|
||||
* into the supplied pointer.
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ int avcodec_dct_init(AVDCT *dsp)
|
||||
|
||||
#if CONFIG_IDCTDSP
|
||||
{
|
||||
IDCTDSPContext idsp = {0};
|
||||
IDCTDSPContext idsp;
|
||||
ff_idctdsp_init(&idsp, avctx);
|
||||
COPY(idsp, idct);
|
||||
COPY(idsp, idct_permutation);
|
||||
|
||||
+4
-10
@@ -375,9 +375,6 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
|
||||
case AV_PKT_DATA_DISPLAYMATRIX: return "Display Matrix";
|
||||
case AV_PKT_DATA_STEREO3D: return "Stereo 3D";
|
||||
case AV_PKT_DATA_AUDIO_SERVICE_TYPE: return "Audio Service Type";
|
||||
case AV_PKT_DATA_QUALITY_STATS: return "Quality stats";
|
||||
case AV_PKT_DATA_FALLBACK_TRACK: return "Fallback track";
|
||||
case AV_PKT_DATA_CPB_PROPERTIES: return "CPB properties";
|
||||
case AV_PKT_DATA_SKIP_SAMPLES: return "Skip Samples";
|
||||
case AV_PKT_DATA_JP_DUALMONO: return "JP Dual Mono";
|
||||
case AV_PKT_DATA_STRINGS_METADATA: return "Strings Metadata";
|
||||
@@ -391,9 +388,6 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
|
||||
case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata";
|
||||
case AV_PKT_DATA_SPHERICAL: return "Spherical Mapping";
|
||||
case AV_PKT_DATA_A53_CC: return "A53 Closed Captions";
|
||||
case AV_PKT_DATA_ENCRYPTION_INIT_INFO: return "Encryption initialization data";
|
||||
case AV_PKT_DATA_ENCRYPTION_INFO: return "Encryption info";
|
||||
case AV_PKT_DATA_AFD: return "Active Format Description data";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -580,10 +574,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
dst->side_data = NULL;
|
||||
dst->side_data_elems = 0;
|
||||
for (i = 0; i < src->side_data_elems; i++) {
|
||||
enum AVPacketSideDataType type = src->side_data[i].type;
|
||||
int size = src->side_data[i].size;
|
||||
uint8_t *src_data = src->side_data[i].data;
|
||||
uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
|
||||
enum AVPacketSideDataType type = src->side_data[i].type;
|
||||
int size = src->side_data[i].size;
|
||||
uint8_t *src_data = src->side_data[i].data;
|
||||
uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
|
||||
|
||||
if (!dst_data) {
|
||||
av_packet_free_side_data(dst);
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* AVS2-P2/IEEE1857.4 video parser.
|
||||
* Copyright (c) 2018 Huiwen Ren <hwrenx@gmail.com>
|
||||
*
|
||||
* 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 "parser.h"
|
||||
|
||||
#define SLICE_MAX_START_CODE 0x000001af
|
||||
|
||||
#define ISPIC(x) ((x) == 0xB3 || (x) == 0xB6)
|
||||
#define ISUNIT(x) ((x) == 0xB0 || (x) == 0xB1 || (x) == 0xB2 || ISPIC(x))
|
||||
|
||||
static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
|
||||
{
|
||||
int pic_found = pc->frame_start_found;
|
||||
uint32_t state = pc->state;
|
||||
int cur = 0;
|
||||
|
||||
if (!pic_found) {
|
||||
for (; cur < buf_size; ++cur) {
|
||||
state = (state<<8) | buf[cur];
|
||||
if (ISUNIT(buf[cur])){
|
||||
++cur;
|
||||
pic_found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pic_found) {
|
||||
if (!buf_size)
|
||||
return END_NOT_FOUND;
|
||||
for (; cur < buf_size; ++cur) {
|
||||
state = (state << 8) | buf[cur];
|
||||
if ((state & 0xFFFFFF00) == 0x100 && state > SLICE_MAX_START_CODE) {
|
||||
pc->frame_start_found = 0;
|
||||
pc->state = -1;
|
||||
return cur - 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pc->frame_start_found = pic_found;
|
||||
pc->state = state;
|
||||
|
||||
return END_NOT_FOUND;
|
||||
}
|
||||
|
||||
static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
const uint8_t **poutbuf, int *poutbuf_size,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
ParseContext *pc = s->priv_data;
|
||||
int next;
|
||||
|
||||
if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
|
||||
next = buf_size;
|
||||
} else {
|
||||
next = avs2_find_frame_end(pc, buf, buf_size);
|
||||
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
|
||||
*poutbuf = NULL;
|
||||
*poutbuf_size = 0;
|
||||
return buf_size;
|
||||
}
|
||||
}
|
||||
|
||||
*poutbuf = buf;
|
||||
*poutbuf_size = buf_size;
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
AVCodecParser ff_avs2_parser = {
|
||||
.codec_ids = { AV_CODEC_ID_AVS2 },
|
||||
.priv_data_size = sizeof(ParseContext),
|
||||
.parser_parse = avs2_parse,
|
||||
.parser_close = ff_parse_close,
|
||||
.split = ff_mpeg4video_split,
|
||||
};
|
||||
@@ -109,11 +109,6 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
|
||||
if(yoffset >= avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
dst += vid->frame->linesize[0] * yoffset;
|
||||
case VIDEO_P_FRAME:
|
||||
case VIDEO_I_FRAME:
|
||||
break;
|
||||
default:
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
// main code
|
||||
|
||||
+1
-6
@@ -485,17 +485,12 @@ av_cold void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
|
||||
|
||||
|
||||
/** Initialize decoding and reads the first value */
|
||||
int ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
|
||||
void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
|
||||
unsigned int *l, unsigned int *v)
|
||||
{
|
||||
if (get_bits_left(gb) < VALUE_BITS)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
*h = TOP_VALUE;
|
||||
*l = 0;
|
||||
*v = get_bits_long(gb, VALUE_BITS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status);
|
||||
void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status);
|
||||
|
||||
|
||||
int ff_bgmc_decode_init(GetBitContext *gb,
|
||||
void ff_bgmc_decode_init(GetBitContext *gb,
|
||||
unsigned int *h, unsigned int *l, unsigned int *v);
|
||||
|
||||
|
||||
|
||||
+11
-33
@@ -371,19 +371,11 @@ static const uint8_t bink_rlelens[4] = { 4, 8, 12, 32 };
|
||||
|
||||
static int read_block_types(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
|
||||
{
|
||||
BinkContext * const c = avctx->priv_data;
|
||||
int t, v;
|
||||
int last = 0;
|
||||
const uint8_t *dec_end;
|
||||
|
||||
CHECK_READ_VAL(gb, b, t);
|
||||
if (c->version == 'k') {
|
||||
t ^= 0xBBu;
|
||||
if (t == 0) {
|
||||
b->cur_dec = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
dec_end = b->cur_dec + t;
|
||||
if (dec_end > b->data_end) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many block type values\n");
|
||||
@@ -702,15 +694,15 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64],
|
||||
return quant_idx;
|
||||
}
|
||||
|
||||
static void unquantize_dct_coeffs(int32_t block[64], const uint32_t quant[64],
|
||||
static void unquantize_dct_coeffs(int32_t block[64], const int32_t quant[64],
|
||||
int coef_count, int coef_idx[64],
|
||||
const uint8_t *scan)
|
||||
{
|
||||
int i;
|
||||
block[0] = (int)(block[0] * quant[0]) >> 11;
|
||||
block[0] = (block[0] * quant[0]) >> 11;
|
||||
for (i = 0; i < coef_count; i++) {
|
||||
int idx = coef_idx[i];
|
||||
block[scan[idx]] = (int)(block[scan[idx]] * quant[idx]) >> 11;
|
||||
block[scan[idx]] = (block[scan[idx]] * quant[idx]) >> 11;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,7 +830,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
|
||||
binkb_init_bundles(c);
|
||||
ref_start = frame->data[plane_idx];
|
||||
ref_end = frame->data[plane_idx] + ((bh - 1) * frame->linesize[plane_idx] + bw - 1) * 8;
|
||||
ref_end = frame->data[plane_idx] + (bh * frame->linesize[plane_idx] + bw) * 8;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
coordmap[i] = (i & 7) + (i >> 3) * stride;
|
||||
@@ -894,7 +886,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||
ref = dst + xoff + yoff * stride;
|
||||
if (ref < ref_start || ref > ref_end) {
|
||||
if (ref < ref_start || ref + 8*stride > ref_end) {
|
||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||
c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
|
||||
@@ -910,7 +902,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||
ref = dst + xoff + yoff * stride;
|
||||
if (ref < ref_start || ref > ref_end) {
|
||||
if (ref < ref_start || ref + 8 * stride > ref_end) {
|
||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||
c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
|
||||
@@ -942,7 +934,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||
ref = dst + xoff + yoff * stride;
|
||||
if (ref < ref_start || ref > ref_end) {
|
||||
if (ref < ref_start || ref + 8 * stride > ref_end) {
|
||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||
c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
|
||||
@@ -1002,17 +994,6 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
int bw = is_chroma ? (c->avctx->width + 15) >> 4 : (c->avctx->width + 7) >> 3;
|
||||
int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3;
|
||||
int width = c->avctx->width >> is_chroma;
|
||||
int height = c->avctx->height >> is_chroma;
|
||||
|
||||
if (c->version == 'k' && get_bits1(gb)) {
|
||||
int fill = get_bits(gb, 8);
|
||||
|
||||
dst = frame->data[plane_idx];
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
memset(dst + i * stride, fill, width);
|
||||
goto end;
|
||||
}
|
||||
|
||||
init_lengths(c, FFMAX(width, 8), bw);
|
||||
for (i = 0; i < BINK_NB_SRC; i++)
|
||||
@@ -1054,7 +1035,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) {
|
||||
blk = get_value(c, BINK_SRC_BLOCK_TYPES);
|
||||
// 16x16 block type on odd line means part of the already decoded block, so skip it
|
||||
if (((by & 1) || (bx & 1)) && blk == SCALED_BLOCK) {
|
||||
if ((by & 1) && blk == SCALED_BLOCK) {
|
||||
bx++;
|
||||
dst += 8;
|
||||
prev += 8;
|
||||
@@ -1209,8 +1190,6 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
if (get_bits_count(gb) & 0x1F) //next plane data starts at 32-bit boundary
|
||||
skip_bits_long(gb, 32 - (get_bits_count(gb) & 0x1F));
|
||||
|
||||
@@ -1335,15 +1314,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
c->avctx = avctx;
|
||||
|
||||
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
|
||||
return ret;
|
||||
|
||||
c->last = av_frame_alloc();
|
||||
if (!c->last)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
|
||||
return ret;
|
||||
|
||||
avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
|
||||
avctx->color_range = c->version == 'k' ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
|
||||
|
||||
ff_blockdsp_init(&c->bdsp, avctx);
|
||||
ff_hpeldsp_init(&c->hdsp, avctx->flags);
|
||||
|
||||
@@ -95,8 +95,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
if (avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT) {
|
||||
// audio is already interleaved for the RDFT format variant
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
if (sample_rate > INT_MAX / avctx->channels)
|
||||
return AVERROR_INVALIDDATA;
|
||||
sample_rate *= avctx->channels;
|
||||
s->channels = 1;
|
||||
if (!s->version_b)
|
||||
@@ -109,7 +107,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->frame_len = 1 << frame_len_bits;
|
||||
s->overlap_len = s->frame_len / 16;
|
||||
s->block_size = (s->frame_len - s->overlap_len) * s->channels;
|
||||
sample_rate_half = (sample_rate + 1LL) / 2;
|
||||
sample_rate_half = (sample_rate + 1) / 2;
|
||||
if (avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT)
|
||||
s->root = 2.0 / (sqrt(s->frame_len) * 32768.0);
|
||||
else
|
||||
|
||||
@@ -33,22 +33,20 @@
|
||||
#define A3 3784
|
||||
#define A4 -5352
|
||||
|
||||
#define MUL(X,Y) ((int)((unsigned)(X) * (Y)) >> 11)
|
||||
|
||||
#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\
|
||||
const int a0 = (src)[s0] + (src)[s4]; \
|
||||
const int a1 = (src)[s0] - (src)[s4]; \
|
||||
const int a2 = (src)[s2] + (src)[s6]; \
|
||||
const int a3 = MUL(A1, (src)[s2] - (src)[s6]); \
|
||||
const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \
|
||||
const int a4 = (src)[s5] + (src)[s3]; \
|
||||
const int a5 = (src)[s5] - (src)[s3]; \
|
||||
const int a6 = (src)[s1] + (src)[s7]; \
|
||||
const int a7 = (src)[s1] - (src)[s7]; \
|
||||
const int b0 = a4 + a6; \
|
||||
const int b1 = MUL(A3, a5 + a7); \
|
||||
const int b2 = MUL(A4, a5) - b0 + b1; \
|
||||
const int b3 = MUL(A1, a6 - a4) - b2; \
|
||||
const int b4 = MUL(A2, a7) + b3 - b1; \
|
||||
const int b1 = (A3*(a5 + a7)) >> 11; \
|
||||
const int b2 = ((A4*a5) >> 11) - b0 + b1; \
|
||||
const int b3 = (A1*(a6 - a4) >> 11) - b2; \
|
||||
const int b4 = ((A2*a7) >> 11) + b3 - b1; \
|
||||
(dest)[d0] = munge(a0+a2 +b0); \
|
||||
(dest)[d1] = munge(a1+a3-a2+b2); \
|
||||
(dest)[d2] = munge(a1-a3+a2+b3); \
|
||||
|
||||
+20
-9
@@ -63,10 +63,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_ERROR, "not enough extradata\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (!s->font_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid font height\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else {
|
||||
s->font_height = 8;
|
||||
s->flags = 0;
|
||||
@@ -100,6 +96,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
if (avctx->width < FONT_WIDTH || avctx->height < s->font_height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
||||
s->frame = av_frame_alloc();
|
||||
if (!s->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -145,12 +146,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
const uint8_t *buf_end = buf+buf_size;
|
||||
int ret;
|
||||
|
||||
if ((avctx->width / FONT_WIDTH) * (avctx->height / s->font_height) / 256 > buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->frame = data;
|
||||
s->x = s->y = 0;
|
||||
if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
s->frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
s->frame->palette_has_changed = 1;
|
||||
@@ -208,10 +205,21 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = av_frame_ref(data, s->frame)) < 0)
|
||||
return ret;
|
||||
*got_frame = 1;
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static av_cold int decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
XbinContext *s = avctx->priv_data;
|
||||
|
||||
av_frame_free(&s->frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_BINTEXT_DECODER
|
||||
AVCodec ff_bintext_decoder = {
|
||||
.name = "bintext",
|
||||
@@ -220,6 +228,7 @@ AVCodec ff_bintext_decoder = {
|
||||
.id = AV_CODEC_ID_BINTEXT,
|
||||
.priv_data_size = sizeof(XbinContext),
|
||||
.init = decode_init,
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
};
|
||||
@@ -232,6 +241,7 @@ AVCodec ff_xbin_decoder = {
|
||||
.id = AV_CODEC_ID_XBIN,
|
||||
.priv_data_size = sizeof(XbinContext),
|
||||
.init = decode_init,
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
};
|
||||
@@ -244,6 +254,7 @@ AVCodec ff_idf_decoder = {
|
||||
.id = AV_CODEC_ID_IDF,
|
||||
.priv_data_size = sizeof(XbinContext),
|
||||
.init = decode_init,
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
};
|
||||
|
||||
@@ -162,9 +162,9 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
uint32_t code;
|
||||
volatile VLC_TYPE (* volatile table)[2]; // the double volatile is needed to prevent an internal compiler error in gcc 4.2
|
||||
|
||||
table_size = 1 << table_nb_bits;
|
||||
if (table_nb_bits > 30)
|
||||
return -1;
|
||||
table_size = 1 << table_nb_bits;
|
||||
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
|
||||
ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
|
||||
if (table_index < 0)
|
||||
@@ -188,9 +188,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
}
|
||||
for (k = 0; k < nb; k++) {
|
||||
int bits = table[j][1];
|
||||
int oldsym = table[j][0];
|
||||
ff_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
|
||||
if ((bits || oldsym) && (bits != n || oldsym != symbol)) {
|
||||
if (bits != 0 && bits != n) {
|
||||
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -227,10 +226,6 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
/* note: realloc has been done, so reload tables */
|
||||
table = (volatile VLC_TYPE (*)[2])&vlc->table[table_index];
|
||||
table[j][0] = index; //code
|
||||
if (table[j][0] != index) {
|
||||
avpriv_request_sample(NULL, "strange codes");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
i = k-1;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user