Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c41ff724ed | ||
|
|
1f61aad00d | ||
|
|
dcaadb2a10 | ||
|
|
34ef4e9d46 | ||
|
|
302aa941eb | ||
|
|
2baff271a2 | ||
|
|
028ae6f26c | ||
|
|
d77be99a83 | ||
|
|
14b1998c1a | ||
|
|
7e7c3d5db2 | ||
|
|
66caaeec13 | ||
|
|
e825157874 | ||
|
|
f2a4a49afb | ||
|
|
7058f9a3d6 | ||
|
|
330b8305c1 | ||
|
|
07e3223dd0 | ||
|
|
2269a892fb | ||
|
|
e770922e30 | ||
|
|
d2577e1622 | ||
|
|
7b2b48078c | ||
|
|
b902f5113e | ||
|
|
1079565e8e | ||
|
|
6d25672afa | ||
|
|
85b9a8f296 | ||
|
|
55769812f7 | ||
|
|
8af32643c0 | ||
|
|
2d87c74e60 | ||
|
|
ba90a8dff2 | ||
|
|
df8936ef12 | ||
|
|
6ddb165b4b | ||
|
|
f4270205a4 | ||
|
|
034a3e6f9c | ||
|
|
d67bb81161 | ||
|
|
de458e5d3f | ||
|
|
be3ca673f4 | ||
|
|
5d6524445c | ||
|
|
f630725cb0 | ||
|
|
303afea1a8 | ||
|
|
8a0e48001f | ||
|
|
3b822405cd | ||
|
|
0ae86db6ba | ||
|
|
47333e3e30 | ||
|
|
f16d72dfeb | ||
|
|
5fd5e84474 | ||
|
|
8aae506dd2 | ||
|
|
f23f0ba87c | ||
|
|
8c5b391c63 | ||
|
|
342121cd35 | ||
|
|
c8319b4e00 | ||
|
|
33c009130c | ||
|
|
afb5d20e23 | ||
|
|
53bcb6eaf5 | ||
|
|
3a177811f4 | ||
|
|
ea918615a1 | ||
|
|
4917892af7 | ||
|
|
882052e293 | ||
|
|
eb32d51302 | ||
|
|
d30d9c817a | ||
|
|
38bc713c6d | ||
|
|
ebc4d0a310 | ||
|
|
47bd650d68 | ||
|
|
58c8e61703 | ||
|
|
e1a05fdb58 | ||
|
|
24be4134fd | ||
|
|
45d113af3a | ||
|
|
2631c7c7ce | ||
|
|
3fa5039012 | ||
|
|
b7a55ae0a8 | ||
|
|
e4dbe25f3b | ||
|
|
e0cd8ac126 | ||
|
|
60e46128f7 | ||
|
|
d57b29ff2b | ||
|
|
ab1981b445 | ||
|
|
1e26c4923a | ||
|
|
b07211eb9e | ||
|
|
ba5e12b2ed | ||
|
|
13438a6900 | ||
|
|
cea882ef99 | ||
|
|
8bce6ca582 | ||
|
|
15e1093f9a | ||
|
|
1bee64983e | ||
|
|
161b2b6ed6 | ||
|
|
68604c9dee | ||
|
|
992fc9d75a | ||
|
|
5531eacf9e | ||
|
|
410d733a8b | ||
|
|
09e888a5b4 | ||
|
|
aef59048e6 | ||
|
|
4c906c5867 | ||
|
|
52dd7a9f7a | ||
|
|
85cb7abb4c | ||
|
|
819e9068af | ||
|
|
a66733a8c9 | ||
|
|
79af71223d | ||
|
|
63270289a0 | ||
|
|
c598778d37 | ||
|
|
33ee9ab941 | ||
|
|
339463bd90 | ||
|
|
426117bb7e | ||
|
|
011511791a | ||
|
|
79edf58ba8 | ||
|
|
86682ab20f | ||
|
|
24b6f44f96 | ||
|
|
838cab9a07 | ||
|
|
40e81d5a8b | ||
|
|
4e3f8fd46a | ||
|
|
0ec70368b0 | ||
|
|
fbc224b126 | ||
|
|
fc7f2fdacf | ||
|
|
89950105b9 | ||
|
|
9000efe97f | ||
|
|
344f333c6c | ||
|
|
8c8a08e1bf | ||
|
|
63aa0cfd0e | ||
|
|
1d7dd08199 | ||
|
|
6500c15977 | ||
|
|
81ab846988 | ||
|
|
19db9ffb3b | ||
|
|
735f6be311 | ||
|
|
a06bf3dae8 | ||
|
|
953e26755b | ||
|
|
0291b86a94 | ||
|
|
d84e889785 | ||
|
|
a85d0bc84b | ||
|
|
67919ba682 | ||
|
|
1ed34709ff | ||
|
|
4cec33869e | ||
|
|
9a086ad5b1 | ||
|
|
407e6cde75 | ||
|
|
fa35ce082a | ||
|
|
efab690c16 | ||
|
|
14da53d4c6 | ||
|
|
b89cda3269 | ||
|
|
deeb0b6e94 | ||
|
|
89c0a651ad | ||
|
|
ea6ec6b507 | ||
|
|
c2a484cf5b | ||
|
|
1957bd1110 | ||
|
|
438ea0eaf3 | ||
|
|
f081f94601 | ||
|
|
318c295925 | ||
|
|
c5039e158d | ||
|
|
067ed535f4 | ||
|
|
3d5edb89e7 | ||
|
|
d2efb80027 | ||
|
|
d4a7a6e7fa | ||
|
|
1ebb0e43f9 | ||
|
|
9212b53ed5 | ||
|
|
cc703cf607 | ||
|
|
cedbf27a35 | ||
|
|
c433ad89a0 | ||
|
|
3f345ebf21 | ||
|
|
868af7d7a4 | ||
|
|
d341895a08 | ||
|
|
cb3453eb25 | ||
|
|
549430e14d | ||
|
|
bfa8a4a44b | ||
|
|
d7c0991cfc | ||
|
|
8ea302832f | ||
|
|
27205c0b47 | ||
|
|
8f61cbf1b9 | ||
|
|
2c11164707 | ||
|
|
5606d27006 | ||
|
|
4808ed94e3 | ||
|
|
bf704a0b30 | ||
|
|
a6dc92968a | ||
|
|
3980415627 | ||
|
|
a0d6566498 | ||
|
|
a3c93c03ad | ||
|
|
18dde8d4cf | ||
|
|
adb4688bfb | ||
|
|
916bdc0f19 | ||
|
|
58f18df430 | ||
|
|
1cf17633cd | ||
|
|
0e11aafb08 | ||
|
|
46970dd155 | ||
|
|
0981053c29 | ||
|
|
ea3d24bbe3 | ||
|
|
ff5cce2eaf | ||
|
|
1eb1acb62b | ||
|
|
718d6c71ef | ||
|
|
8ab01c8b0d | ||
|
|
d1e446d570 | ||
|
|
8e478e0cb1 | ||
|
|
81d9c57c43 | ||
|
|
3ae6feff7e | ||
|
|
197dcd28ef | ||
|
|
bc531eedbd | ||
|
|
e4eed31133 | ||
|
|
c56f84e656 | ||
|
|
bbcf3f4234 | ||
|
|
8a6c037acd | ||
|
|
b59152b474 | ||
|
|
0c1e67ab14 | ||
|
|
ec5edc0946 | ||
|
|
6f1b24c4fe | ||
|
|
691d019899 | ||
|
|
65873ac3ee | ||
|
|
34a1403831 | ||
|
|
a34b348328 | ||
|
|
6112745d8e | ||
|
|
71534916df |
4
.mailmap
4
.mailmap
@@ -1,8 +1,8 @@
|
||||
<jeebjp@gmail.com> <jan.ekstrom@aminocom.com>
|
||||
<sw@jkqxz.net> <mrt@jkqxz.net>
|
||||
<u@pkh.me> <cboesch@gopro.com>
|
||||
<quinkblack@foxmail.com> <wantlamy@gmail.com>
|
||||
<quinkblack@foxmail.com> <zhilizhao@tencent.com>
|
||||
<zhilizhao@tencent.com> <quinkblack@foxmail.com>
|
||||
<zhilizhao@tencent.com> <wantlamy@gmail.com>
|
||||
<modmaker@google.com> <modmaker-at-google.com@ffmpeg.org>
|
||||
<stebbins@jetheaddev.com> <jstebbins@jetheaddev.com>
|
||||
<barryjzhao@tencent.com> <mypopydev@gmail.com>
|
||||
|
||||
219
Changelog
219
Changelog
@@ -1,46 +1,185 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
- LEAD MCMP decoder
|
||||
|
||||
version 6.1:
|
||||
- libaribcaption decoder
|
||||
- Playdate video decoder and demuxer
|
||||
- Extend VAAPI support for libva-win32 on Windows
|
||||
- afireqsrc audio source filter
|
||||
- arls filter
|
||||
- ffmpeg CLI new option: -readrate_initial_burst
|
||||
- zoneplate video source filter
|
||||
- command support in the setpts and asetpts filters
|
||||
- Vulkan decode hwaccel, supporting H264, HEVC and AV1
|
||||
- color_vulkan filter
|
||||
- bwdif_vulkan filter
|
||||
- nlmeans_vulkan filter
|
||||
- RivaTuner video decoder
|
||||
- xfade_vulkan filter
|
||||
- vMix video decoder
|
||||
- Essential Video Coding parser, muxer and demuxer
|
||||
- Essential Video Coding frame merge bsf
|
||||
- bwdif_cuda filter
|
||||
- Microsoft RLE video encoder
|
||||
- Raw AC-4 muxer and demuxer
|
||||
- Raw VVC bitstream parser, muxer and demuxer
|
||||
- Bitstream filter for editing metadata in VVC streams
|
||||
- Bitstream filter for converting VVC from MP4 to Annex B
|
||||
- scale_vt filter for videotoolbox
|
||||
- transpose_vt filter for videotoolbox
|
||||
- support for the P_SKIP hinting to speed up libx264 encoding
|
||||
- Support HEVC,VP9,AV1 codec in enhanced flv format
|
||||
- apsnr and asisdr audio filters
|
||||
- OSQ demuxer and decoder
|
||||
- Support HEVC,VP9,AV1 codec fourcclist in enhanced rtmp protocol
|
||||
- CRI USM demuxer
|
||||
- ffmpeg CLI '-top' option deprecated in favor of the setfield filter
|
||||
- VAAPI AV1 encoder
|
||||
- ffprobe XML output schema changed to account for multiple
|
||||
variable-fields elements within the same parent element
|
||||
- ffprobe -output_format option added as an alias of -of
|
||||
version 6.0.1:
|
||||
avcodec/4xm: Check for cfrm exhaustion
|
||||
avformat/mov: Disallow FTYP after streams
|
||||
doc/html: fix styling issue with Texinfo 7.0
|
||||
doc/html: support texinfo 7.0
|
||||
Changelog: update
|
||||
avformat/lafdec: Check for 0 parameters
|
||||
avformat/lafdec: Check for 0 parameters
|
||||
avfilter/buffersink: fix order of operation with = and <0
|
||||
avfilter/framesync: fix order of operation with = and <0
|
||||
tools/target_dec_fuzzer: Adjust threshold for CSCD
|
||||
avcodec/dovi_rpu: Use 64 bit in get_us/se_coeff()
|
||||
avformat/mov: Check that is_still_picture_avif has no trak based streams
|
||||
avformat/matroskadec: Fix declaration-after-statement warnings
|
||||
Update for FFmpeg 6.0.1
|
||||
fftools/ffmpeg_mux_init: Restrict disabling automatic copying of metadata
|
||||
avformat/rtsp: Use rtsp_st->stream_index
|
||||
avformat/rtsp: Use rtsp_st->stream_index
|
||||
avutil/tx_template: fix integer ovberflwo in fft3()
|
||||
avcodec/jpeg2000dec: Check image offset
|
||||
avformat/mxfdec: Check klv offset
|
||||
libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined
|
||||
avcodec/h2645_parse: Avoid EAGAIN
|
||||
avcodec/xvididct: Make c* unsigned to avoid undefined overflows
|
||||
avcodec/bonk: Fix undefined overflow in predictor_calc_error()
|
||||
avformat/tmv: Check video chunk size
|
||||
avcodec/h264_parser: saturate dts a bit
|
||||
avformat/asfdec_f: Saturate presentation time in marker
|
||||
avformat/xwma: sanity check bits_per_coded_sample
|
||||
avformat/matroskadec: Check prebuffered_ns for overflow
|
||||
avformat/wavdec: Check left avio_tell for overflow
|
||||
avformat/tta: Better totalframes check
|
||||
avformat/rpl: Check for number_of_chunks overflow
|
||||
avformat/mov: compute absolute dts difference without overflow in mov_find_next_sample()
|
||||
avformat/jacosubdec: Check timeres
|
||||
avformat/jacosubdec: avoid signed integer overflows in get_shift()
|
||||
avformat/jacosubdec: Factorize code in get_shift() a bit
|
||||
avformat/sbgdec: Check for negative duration or un-representable end pts
|
||||
avcodec/escape124: Do not return random numbers
|
||||
avcodec/apedec: Fix an integer overflow in predictor_update_filter()
|
||||
tools/target_dec_fuzzer: Adjust wmapro threshold
|
||||
avcodec/wavarc: Allocate AV_INPUT_BUFFER_PADDING_SIZE
|
||||
avcodec/wavarc: Fix integer overflwo in do_stereo()
|
||||
avutil/tx_template: Fix some signed integer overflows in DECL_FFT5()
|
||||
avcodec/aacdec_template: Better avoidance of signed integer overflow in imdct_and_windowing_eld()
|
||||
tools/target_dec_fuzzer: Adjust threshold for MVHA
|
||||
avformat/avs: Check if return code is representable
|
||||
avcodec/flacdec: Fix integer overflow in "33bit" DECODER_SUBFRAME_FIXED_WIDE()
|
||||
avcodec/flacdec: Fix overflow in "33bit" decorrelate
|
||||
avcodec/lcldec: Make PNG filter addressing match the code afterwards
|
||||
avformat/westwood_vqa: Check chunk size
|
||||
avformat/sbgdec: Check for period overflow
|
||||
avformat/concatdec: Check in/outpoint for overflow
|
||||
avformat/mov: Check avif_info
|
||||
avformat/mxfdec: Remove this_partition
|
||||
avcodec/xvididct: Fix integer overflow in idct_row()
|
||||
avcodec/celp_math: avoid overflow in shift
|
||||
tools/target_dec_fuzzer: Adjust threshold for rtv1
|
||||
avformat/hls: reduce default max reload to 3
|
||||
avformat/format: Stop reading data at EOF during probing
|
||||
avcodec/bonk: Fix integer overflow in predictor_calc_error()
|
||||
avcodec/jpeg2000dec: jpeg2000 has its own lowres option
|
||||
avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
|
||||
avcodec/cscd: Fix "CamStudio Lossless Codec 1.0" gzip files
|
||||
avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of LZO files
|
||||
avcodec/mpeg4videodec: consider lowres in dest_pcm[]
|
||||
avcodec/hevcdec: Fix undefined memcpy()
|
||||
avcodec/mpeg4videodec: more unsigned in amv computation
|
||||
avcodec/tta: fix signed overflow in decorrelate
|
||||
avcodec/apedec: remove unused variable
|
||||
avcodec/apedec: Fix 48khz 24bit below insane level
|
||||
avcodec/apedec: Fix CRC for 24bps and bigendian
|
||||
avcodec/wavarc: Check that nb_samples is not negative
|
||||
avcodec/wavarc: Check shift
|
||||
avcodec/xvididct: Fix integer overflow in idct_row()
|
||||
avformat/avr: Check sample rate
|
||||
avformat/imf_cpl: Replace NULL content_title_utf8 by ""
|
||||
avformat/imf_cpl: xmlNodeListGetString() can return NULL
|
||||
avcodec/aacdec_template: Fix undefined signed interger operations
|
||||
avcodec/wavarc: Fix k limit
|
||||
avcodec/rka: Fix integer overflow in decode_filter()
|
||||
avformat/rka: bps < 8 is invalid
|
||||
avcodec/pcm: allow Changing parameters
|
||||
avutil/tx_template: extend to 2M
|
||||
avcodec/jpeg2000dec: Check for reduction factor and image offset
|
||||
avutil/softfloat: Basic documentation for av_sincos_sf()
|
||||
avutil/softfloat: fix av_sincos_sf()
|
||||
tools/target_dec_fuzzer: Adjust threshold for speex
|
||||
avcodec/utils: fix 2 integer overflows in get_audio_frame_duration()
|
||||
avcodec/hevcdec: Avoid null pointer dereferences in MC
|
||||
avcodec/takdsp: Fix integer overflows
|
||||
avcodec/mpegvideo_dec: consider interlaced lowres 4:2:0 chroma in edge emulation check better
|
||||
avcodec/rka: use unsigned for buf0 additions
|
||||
avcodec/rka: Avoid undefined left shift
|
||||
avcodec: Ignoring errors is only possible before the input end
|
||||
avformat/jpegxl_probe: Forward error codes
|
||||
avformat/jpegxl_probe: check length instead of blindly reading
|
||||
avformat/jpegxl_probe: Remove intermediate macro obfuscation around get_bits*()
|
||||
avcodec/noise_bsf: Check for wrapped frames
|
||||
avformat/oggparsetheora: clip duration within 64bit
|
||||
avcodec/rka: avoid undefined multiply in cmode==0
|
||||
avcodec/rka: use 64bit for srate_pad computation
|
||||
avcodec/bonk: Avoid undefined integer overflow in predictor_calc_error()
|
||||
avformat/wavdec: Check that smv block fits in available space
|
||||
avcodec/adpcm: Fix integer overflow in intermediate in ADPCM_XMD
|
||||
avcodec/dpcm: fix undefined interger overflow in wady
|
||||
avcodec/tiff: add a zero DNG_LINEARIZATION_TABLE check
|
||||
avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()
|
||||
avcodec/sonic: Fix two undefined integer overflows
|
||||
avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated
|
||||
avcodec/flacdec: Fix signed integre overflow
|
||||
avcodec/exr: Cleanup befor return
|
||||
avcodec/pngdec: Do not pass AVFrame into global header decode
|
||||
avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk()
|
||||
avcodec/wavarc: Check order before using it to write the list
|
||||
avcodec/bonk: decode multiple passes in intlist_read() at once
|
||||
avcodec/vorbisdec: Check codebook float values to be finite
|
||||
avcodec/g2meet: Replace fake allocation avoidance for framebuf
|
||||
avutil/tx_priv: Use unsigned in BF() to avoid signed overflows
|
||||
avcodec/lcldec: More space for rgb24
|
||||
avcodec/lcldec: Support 4:1:1 and 4:2:2 with odd width
|
||||
libavcodec/lcldec: width and height should not be unsigned
|
||||
avformat/imf: fix invalid resource handling
|
||||
avcodec/escape124: Check that blocks are allocated before use
|
||||
avcodec/rka: Fix signed integer overflow in decode_filter()
|
||||
avcodec/huffyuvdec: Fix undefined behavior with shift
|
||||
avcodec/j2kenc: Replace RGB24 special case by generic test
|
||||
avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bits
|
||||
avcodec/j2kenc: simplify pixel format setup
|
||||
avcodec/j2kenc: Fix funky bpno errors on decoding
|
||||
avcodec/j2kenc: remove misleading pred value
|
||||
avcodec/j2kenc: fix 5/3 DWT identifer
|
||||
avcodec/vp3: Check width to avoid assertion failure
|
||||
avcodec/g729postfilter: Limit shift in long term filter
|
||||
avcodec/wavarc: Fix several integer overflows
|
||||
avcodec/tests/snowenc: Fix 2nd test
|
||||
avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches
|
||||
avcodec/snowenc: Fix visual weight calculation
|
||||
avcodec/tests/snowenc: unbreak DWT tests
|
||||
avcodec/mpeg12dec: Check input size
|
||||
avcodec/escape124: Fix some return codes
|
||||
avcodec/escape124: fix signdness of end of input check
|
||||
Use https for repository links
|
||||
avcodec/nvdec_hevc: fail to initialize on unsupported profiles
|
||||
fftools/ffmpeg_enc: apply -top to individual encoded frames
|
||||
avcodec/on2avc: use correct fft sizes
|
||||
avcodec/on2avc: use the matching AVTX context for the 512 sized iMDCT
|
||||
examples: fix build of mux and resample_audio
|
||||
avcodec/nvenc: stop using deprecated rc modes with SDK 12.1
|
||||
configure: use non-deprecated nvenc GUID for conftest
|
||||
avcodec/x86/mathops: clip constants used with shift instructions within inline assembly
|
||||
avfilter/vsrc_ddagrab: calculate pointer position on rotated screens
|
||||
avfilter/vsrc_ddagrab: account for mouse-only frames during probing
|
||||
avcodec/aac_ac3_parser: add preprocessor checks for codec specific code
|
||||
avcodec/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
|
||||
Revert "lavc/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE"
|
||||
Revert "avcodec/nvenc: fix b-frame DTS behavior with fractional framerates"
|
||||
avcodec/vdpau_mpeg4: fix order of quant matrix coefficients
|
||||
avcodec/vdpau_mpeg12: fix order of quant matrix coefficients
|
||||
avcodec/nvdec_mpeg4: fix order of quant matrix coefficients
|
||||
avcodec/nvdec_mpeg2: fix order of quant matrix coefficients
|
||||
fftools/ffmpeg_filter: fix leak of AVIOContext in read_binary()
|
||||
fftools/ffmpeg: avoid possible invalid reads with short -tag values
|
||||
avcodec/mp_cmp: reject invalid comparison function values
|
||||
avcodec/aacpsy: clip global_quality within the psy_vbr_map array boundaries
|
||||
avutil/wchar_filename: propagate MultiByteToWideChar() and WideCharToMultiByte() failures
|
||||
avformat/concatf: check if any nodes were allocated
|
||||
avcodec/nvenc: fix b-frame DTS behavior with fractional framerates
|
||||
avcodec/vorbisdec: export skip_samples instead of dropping frames
|
||||
fftools/ffmpeg_mux_init: avoid invalid reads in forced keyframe parsing
|
||||
lavfi/vf_vpp_qsv: set the right timestamp for AVERROR_EOF
|
||||
avfilter/vf_untile: swap the chroma shift values used for plane offsets
|
||||
lavc/decode: stop mangling last_pkt_props->opaque
|
||||
avcodec/nvenc: avoid failing b_ref_mode check when unset
|
||||
lavu/vulkan: fix handle type for 32-bit targets
|
||||
vulkan: Fix win/i386 calling convention
|
||||
avfilter/graphparser: fix filter instance name when an id is provided
|
||||
avcodec/aacps_tablegen: fix build error after avutil bump
|
||||
avcodec/nvenc: fix potential NULL pointer dereference
|
||||
|
||||
|
||||
version 6.0:
|
||||
|
||||
12
MAINTAINERS
12
MAINTAINERS
@@ -181,7 +181,6 @@ Codecs:
|
||||
interplayvideo.c Mike Melanson
|
||||
jni*, ffjni* Matthieu Bouron
|
||||
jpeg2000* Nicolas Bertrand
|
||||
jpegxl* Leo Izen
|
||||
jvdec.c Peter Ross
|
||||
lcl*.c Roberto Togni, Reimar Doeffinger
|
||||
libcelt_dec.c Nicolas George
|
||||
@@ -211,7 +210,6 @@ Codecs:
|
||||
mqc* Nicolas Bertrand
|
||||
msmpeg4.c, msmpeg4data.h Michael Niedermayer
|
||||
msrle.c Mike Melanson
|
||||
msrleenc.c Tomas Härdin
|
||||
msvideo1.c Mike Melanson
|
||||
nuv.c Reimar Doeffinger
|
||||
nvdec*, nvenc* Timo Rothenpieler
|
||||
@@ -268,11 +266,11 @@ Codecs:
|
||||
Hardware acceleration:
|
||||
dxva2* Hendrik Leppkes, Laurent Aimar, Steve Lhomme
|
||||
d3d11va* Steve Lhomme
|
||||
mediacodec* Matthieu Bouron, Aman Gupta, Zhao Zhili
|
||||
mediacodec* Matthieu Bouron, Aman Gupta
|
||||
vaapi* Haihao Xiang
|
||||
vaapi_encode* Mark Thompson, Haihao Xiang
|
||||
vdpau* Philip Langdale, Carl Eugen Hoyos
|
||||
videotoolbox* Rick Kern, Aman Gupta, Zhao Zhili
|
||||
videotoolbox* Rick Kern, Aman Gupta
|
||||
|
||||
|
||||
libavdevice
|
||||
@@ -419,7 +417,6 @@ Muxers/Demuxers:
|
||||
dv.c Roman Shaposhnik
|
||||
electronicarts.c Peter Ross
|
||||
epafdec.c Paul B Mahol
|
||||
evc* Samsung (Dawid Kozinski)
|
||||
ffm* Baptiste Coudurier
|
||||
flic.c Mike Melanson
|
||||
flvdec.c Michael Niedermayer
|
||||
@@ -435,7 +432,7 @@ Muxers/Demuxers:
|
||||
ipmovie.c Mike Melanson
|
||||
ircam* Paul B Mahol
|
||||
iss.c Stefan Gehrer
|
||||
jpegxl* Leo Izen
|
||||
jpegxl_probe.* Leo Izen
|
||||
jvdec.c Peter Ross
|
||||
kvag.c Zane van Iperen
|
||||
libmodplug.c Clément Bœsch
|
||||
@@ -546,7 +543,6 @@ LoongArch Shiyou Yin
|
||||
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
|
||||
Amiga / PowerPC Colin Ward
|
||||
Linux / PowerPC Lauri Kasanen
|
||||
RISC-V Rémi Denis-Courmont
|
||||
Windows MinGW Alex Beregszaszi, Ramiro Polla
|
||||
Windows Cygwin Victor Paesa
|
||||
Windows MSVC Matthew Oliver, Hendrik Leppkes
|
||||
@@ -618,7 +614,7 @@ Haihao Xiang (haihao) 1F0C 31E8 B4FE F7A4 4DC1 DC99 E0F5 76D4 76FC 437F
|
||||
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
|
||||
Leo Izen (Traneptora) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A
|
||||
Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A
|
||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
|
||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||
|
||||
4
Makefile
4
Makefile
@@ -47,7 +47,7 @@ FF_DEP_LIBS := $(DEP_LIBS)
|
||||
FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
|
||||
|
||||
$(TOOLS): %$(EXESUF): %.o
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
|
||||
|
||||
target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
|
||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
||||
@@ -67,8 +67,6 @@ tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
|
||||
|
||||
tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
||||
tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
|
||||
tools/enc_recon_frame_test$(EXESUF): $(FF_DEP_LIBS)
|
||||
tools/enc_recon_frame_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
||||
tools/scale_slice_test$(EXESUF): $(FF_DEP_LIBS)
|
||||
tools/scale_slice_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
||||
tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
||||
|
||||
15
RELEASE_NOTES
Normal file
15
RELEASE_NOTES
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
┌────────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 6.0 "Von Neumann" │
|
||||
└────────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 6.0 "Von Neumann", about 6
|
||||
months after the release of FFmpeg 5.1.
|
||||
|
||||
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
|
||||
on the mailing-lists.
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
|
||||
#define COMPAT_ATOMICS_WIN32_STDATOMIC_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
* As most functions here are used without checking return values,
|
||||
* only implement return values as necessary. */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <time.h>
|
||||
@@ -65,14 +66,7 @@ typedef CONDITION_VARIABLE pthread_cond_t;
|
||||
#define PTHREAD_CANCEL_ENABLE 1
|
||||
#define PTHREAD_CANCEL_DISABLE 0
|
||||
|
||||
#if HAVE_WINRT
|
||||
#define THREADFUNC_RETTYPE DWORD
|
||||
#else
|
||||
#define THREADFUNC_RETTYPE unsigned
|
||||
#endif
|
||||
|
||||
static av_unused THREADFUNC_RETTYPE
|
||||
__stdcall attribute_align_arg win32thread_worker(void *arg)
|
||||
static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
|
||||
{
|
||||
pthread_t *h = (pthread_t*)arg;
|
||||
h->ret = h->func(h->arg);
|
||||
|
||||
179
doc/APIchanges
179
doc/APIchanges
@@ -2,185 +2,6 @@ The last version increases of all libraries were on 2023-02-09
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2023-11-08 - b82957a66a7 - lavu 58.32.100 - channel_layout.h
|
||||
Add AV_CH_LAYOUT_7POINT2POINT3 and AV_CHANNEL_LAYOUT_7POINT2POINT3.
|
||||
Add AV_CH_LAYOUT_9POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK.
|
||||
|
||||
2023-10-31 - 57c16323f26 - lavu 58.31.100 - pixdesc.h
|
||||
Add AV_PIX_FMT_FLAG_XYZ.
|
||||
|
||||
-------- 8< --------- FFmpeg 6.1 was cut here -------- 8< ---------
|
||||
|
||||
2023-10-27 - 52a97642604 - lavu 58.28.100 - channel_layout.h
|
||||
Add AV_CH_LAYOUT_3POINT1POINT2 and AV_CHANNEL_LAYOUT_3POINT1POINT2.
|
||||
Add AV_CH_LAYOUT_5POINT1POINT2_BACK and AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK.
|
||||
Add AV_CH_LAYOUT_5POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK.
|
||||
Add AV_CH_LAYOUT_7POINT1POINT2 and AV_CHANNEL_LAYOUT_7POINT1POINT2.
|
||||
Add AV_CH_LAYOUT_7POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK.
|
||||
|
||||
2023-10-06 - 804be7f9e3c - lavc 60.30.101 - avcodec.h
|
||||
AVCodecContext.coded_side_data may now be used during decoding, to be set
|
||||
by user before calling avcodec_open2() for initialization.
|
||||
|
||||
2023-10-06 - 5432d2aacad - lavc 60.15.100 - avformat.h
|
||||
Deprecate AVFormatContext.{nb_,}side_data, av_stream_add_side_data(),
|
||||
av_stream_new_side_data(), and av_stream_get_side_data(). Side data fields
|
||||
from AVFormatContext.codecpar should be used from now on.
|
||||
|
||||
2023-10-06 - 21d7cc6fa9a - lavc 60.30.100 - codec_par.h
|
||||
Added {nb_,}coded_side_data to AVCodecParameters.
|
||||
The AVCodecParameters helpers will copy it to and from its AVCodecContext
|
||||
namesake.
|
||||
|
||||
2023-10-06 - 74279227dd2 - lavc 60.29.100 - packet.h
|
||||
Added av_packet_side_data_new(), av_packet_side_data_add(),
|
||||
av_packet_side_data_get(), av_packet_side_data_remove, and
|
||||
av_packet_side_data_free().
|
||||
|
||||
2023-10-03 - ea14e8bc302 - lavc 60.28.100 - codec_par.h defs.h
|
||||
Move the definition of enum AVFieldOrder from codec_par.h to defs.h.
|
||||
|
||||
2023-10-03 - dd48e49d547 - lavf 60.14.100 - avformat.h
|
||||
Deprecate AVFMT_ALLOW_FLUSH without replacement. Users can always
|
||||
flush any muxer by sending a NULL packet.
|
||||
|
||||
2023-09-28 - 8e1ef7c38f6 - lavu 58.27.100 - pixfmt.h
|
||||
Add AV_PIX_FMT_GBRAP14BE, AV_PIX_FMT_GBRAP14LE pixel formats.
|
||||
|
||||
2023-09-28 - 05f8b2ca0f7 - lavu 58.26.100 - hwcontext_cuda.h
|
||||
Add AV_CUDA_USE_CURRENT_CONTEXT.
|
||||
|
||||
2023-09-19 - ba9cd06c763 - lavu 58.25.100 - avutil.h
|
||||
Make AV_TIME_BASE_Q compatible with C++.
|
||||
|
||||
2023-09-18 - 85e075587dc - lavf 60 - avformat.h
|
||||
Deprecate AVFMT_FLAG_SHORTEST without replacement.
|
||||
|
||||
2023-09-07 - 423b6a7e493 - lavu 58.24.100 - imgutils.h
|
||||
Add av_image_copy2(), a wrapper around the av_image_copy()
|
||||
to overcome limitations of automatic conversions.
|
||||
|
||||
2023-09-07 - 5094d1f429e - lavu 58.23.100 - fifo.h
|
||||
Constify the AVFifo pointees in av_fifo_peek() and av_fifo_peek_to_cb().
|
||||
|
||||
2023-09-07 - fa4bf5793a0 - lavu 58.22.100 - audio_fifo.h
|
||||
Constify some pointees in av_audio_fifo_write(), av_audio_fifo_read(),
|
||||
av_audio_fifo_peek() and av_audio_fifo_peek_at().
|
||||
|
||||
2023-09-07 - 9bf31f60960 - lavu 58.21.100 - samplefmt.h
|
||||
Constify some pointees in av_samples_copy() and av_samples_set_silence().
|
||||
|
||||
2023-09-07 - 41285890e03 - lavu 58.20.100 - imgutils.h
|
||||
Constify some pointees in av_image_copy(), av_image_copy_uc_from() and
|
||||
av_image_fill_black().
|
||||
|
||||
2023-09-07 - 2a68d945cd7 - lavf 60.12.100 - avio.h
|
||||
Constify the buffer pointees in the write_packet and write_data_type
|
||||
callbacks of AVIOContext on the next major bump.
|
||||
|
||||
2023-09-07 - 8238bc0b5e3 - lavc 60.26.100 - defs.h
|
||||
Add AV_PROFILE_* and AV_LEVEL_* replacements in defs.h for the
|
||||
defines from avcodec.h. The latter are deprecated.
|
||||
|
||||
2023-09-06 - b6627a57f41 - lavc 60.25.101 - avcodec.h
|
||||
AVCodecContext.rc_buffer_size may now be set by decoders.
|
||||
|
||||
2023-09-02 - 25ecc94d58f - lavu 58.19.100 - executor.h
|
||||
Add AVExecutor API
|
||||
|
||||
2023-09-01 - 139e54911c8 - lavc 60.25.100 - avfft.h
|
||||
The entire header will be deprecated and removed in two major bumps.
|
||||
For a replacement to av_dct, av_rdft, av_fft and av_mdct, use
|
||||
the new API from libavutil/tx.h.
|
||||
|
||||
2023-09-01 - 11e22730e1e - lavu 58.18.100 - tx.h
|
||||
Add AV_TX_REAL_TO_REAL and AV_TX_REAL_TO_IMAGINARY
|
||||
|
||||
2023-08-18 - ff094f5ebbd - lavu 58.17.100 - channel_layout.h
|
||||
All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older.
|
||||
|
||||
2023-08-08 - 5012b4ab4ca - lavu 58.15.100 - video_hint.h
|
||||
Add AVVideoHint API.
|
||||
|
||||
2023-08-08 - 5012b4ab4ca - lavc 60 - avcodec.h
|
||||
Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement.
|
||||
|
||||
2023-07-05 - d694c25b44c - lavu 58.14.100 - random_seed.h
|
||||
Add av_random_bytes()
|
||||
|
||||
2023-05-29 - 637afea88ed - lavc 60.16.100 - avcodec.h codec_id.h
|
||||
Add AV_CODEC_ID_EVC, FF_PROFILE_EVC_BASELINE, and FF_PROFILE_EVC_MAIN.
|
||||
|
||||
2023-05-29 - 75918016ab1 - lavu 58.12.100 - mathematics.h
|
||||
Add av_bessel_i0()
|
||||
|
||||
2023-05-29 - f3795e18574 - lavc 60.15.100 - avcodec.h
|
||||
Add AVHWAccel.update_thread_context, AVHWAccel.free_frame_priv,
|
||||
AVHWAccel.flush.
|
||||
|
||||
2023-05-29 - db1d0227812 - lavu 58.11.100 - hwcontext_vulkan.h
|
||||
Add AVVulkanDeviceContext.lock_queue, AVVulkanDeviceContext.unlock_queue,
|
||||
AVVulkanFramesContext.format, AVVulkanFramesContext.lock_frame,
|
||||
AVVulkanFramesContext.unlock_frame, AVVkFrame.queue_family.
|
||||
Deprecate AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY (use multiplane images instead).
|
||||
|
||||
2023-05-29 - bef86ba86cc - lavu 58.10.100 - pixfmt.h
|
||||
Add AV_PIX_FMT_P212BE, AV_PIX_FMT_P212LE, AV_PIX_FMT_P412BE,
|
||||
AV_PIX_FMT_P412LE.
|
||||
|
||||
2023-05-18 - 01d444c077e - lavu 58.8.100 - frame.h
|
||||
Add av_frame_replace().
|
||||
|
||||
2023-05-18 - 63767b79a57 - lavu 58 - frame.h
|
||||
Deprecate AVFrame.palette_has_changed without replacement.
|
||||
|
||||
2023-05-15 - 7d1d61cc5f5 - lavc 60 - avcodec.h
|
||||
Depreate AVCodecContext.ticks_per_frame in favor of
|
||||
AVCodecContext.framerate (encoding) and
|
||||
AV_CODEC_PROP_FIELDS (decoding).
|
||||
|
||||
2023-05-15 - 70433abf7fb - lavc 60.12.100 - codec_desc.h
|
||||
Add AV_CODEC_PROP_FIELDS.
|
||||
|
||||
2023-05-15 - 8b20d0dcb5c - lavc 60 - codec.h
|
||||
Depreate AV_CODEC_CAP_SUBFRAMES without replacement.
|
||||
|
||||
2023-05-07 - c2ae8e30b7f - lavc 60.11.100 - codec_par.h
|
||||
Add AVCodecParameters.framerate.
|
||||
|
||||
2023-05-04 - 0fc9c1f6828 - lavu 58.7.100 - frame.h
|
||||
Deprecate AVFrame.interlaced_frame, AVFrame.top_field_first, and
|
||||
AVFrame.key_frame.
|
||||
Add AV_FRAME_FLAG_INTERLACED, AV_FRAME_FLAG_TOP_FIELD_FIRST, and
|
||||
AV_FRAME_FLAG_KEY flags as replacement.
|
||||
|
||||
2023-04-10 - 4eaaa38d3df - lavu 58.6.100 - frame.h
|
||||
av_frame_get_plane_buffer() now accepts const AVFrame*.
|
||||
|
||||
2023-04-04 - 61b27b15fc9 - lavu 58.6.100 - hdr_dynamic_metadata.h
|
||||
Add AV_HDR_PLUS_MAX_PAYLOAD_SIZE.
|
||||
av_dynamic_hdr_plus_create_side_data() now accepts a user provided
|
||||
buffer.
|
||||
|
||||
2023-03-24 - 632c3499319 - lavfi 9.5.100 - avfilter.h
|
||||
Add AVFILTER_FLAG_HWDEVICE.
|
||||
|
||||
2023-03-21 - 0a3ce5f7384 - lavu 58.5.100 - hdr_dynamic_metadata.h
|
||||
Add av_dynamic_hdr_plus_from_t35() and av_dynamic_hdr_plus_to_t35()
|
||||
functions to convert between raw T.35 payloads containing dynamic
|
||||
HDR10+ metadata and their parsed representations as AVDynamicHDRPlus.
|
||||
|
||||
2023-03-17 - 3be46ee7672 - lavu 58.4.100 - hdr_dynamic_vivid_metadata.h
|
||||
Add two group of three spline params.
|
||||
Deprecate previous define which only supports one group of params.
|
||||
|
||||
2023-03-02 - 373ef1c4fae - lavc 60.6.100 - avcodec.h
|
||||
Add FF_PROFILE_EAC3_DDP_ATMOS, FF_PROFILE_TRUEHD_ATMOS,
|
||||
FF_PROFILE_DTS_HD_MA_X and FF_PROFILE_DTS_HD_MA_X_IMAX.
|
||||
|
||||
2023-02-25 - f4593775436 - lavc 60.5.100 - avcodec.h
|
||||
Add FF_PROFILE_HEVC_SCC.
|
||||
|
||||
-------- 8< --------- FFmpeg 6.0 was cut here -------- 8< ---------
|
||||
|
||||
2023-02-16 - 927042b409 - lavf 60.2.100 - avformat.h
|
||||
|
||||
@@ -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 =
|
||||
PROJECT_NUMBER = 6.0.1
|
||||
|
||||
# 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
|
||||
|
||||
@@ -19,7 +19,6 @@ MANPAGES3 = $(LIBRARIES-yes:%=doc/%.3)
|
||||
MANPAGES = $(MANPAGES1) $(MANPAGES3)
|
||||
PODPAGES = $(AVPROGS-yes:%=doc/%.pod) $(AVPROGS-yes:%=doc/%-all.pod) $(COMPONENTS-yes:%=doc/%.pod) $(LIBRARIES-yes:%=doc/%.pod)
|
||||
HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-yes:%=doc/%-all.html) $(COMPONENTS-yes:%=doc/%.html) $(LIBRARIES-yes:%=doc/%.html) \
|
||||
doc/community.html \
|
||||
doc/developer.html \
|
||||
doc/faq.html \
|
||||
doc/fate.html \
|
||||
|
||||
@@ -697,13 +697,10 @@ profiles are documented in the relevant encoder documentation.
|
||||
|
||||
@item level @var{integer} (@emph{encoding,audio,video})
|
||||
|
||||
Set the encoder level. This level depends on the specific codec, and
|
||||
might correspond to the profile level. It is set by default to
|
||||
@samp{unknown}.
|
||||
|
||||
Possible values:
|
||||
@table @samp
|
||||
@item unknown
|
||||
|
||||
@end table
|
||||
|
||||
@item lowres @var{integer} (@emph{decoding,audio,video})
|
||||
@@ -778,6 +775,7 @@ Possible values:
|
||||
@end table
|
||||
@item rc_max_vbv_use @var{float} (@emph{encoding,video})
|
||||
@item rc_min_vbv_use @var{float} (@emph{encoding,video})
|
||||
@item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
|
||||
|
||||
@item color_primaries @var{integer} (@emph{decoding/encoding,video})
|
||||
Possible values:
|
||||
@@ -892,11 +890,9 @@ Possible values:
|
||||
@table @samp
|
||||
@item tv
|
||||
@item mpeg
|
||||
@item limited
|
||||
MPEG (219*2^(n-8))
|
||||
@item pc
|
||||
@item jpeg
|
||||
@item full
|
||||
JPEG (2^n-1)
|
||||
@end table
|
||||
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
\input texinfo @c -*- texinfo -*-
|
||||
@documentencoding UTF-8
|
||||
|
||||
@settitle Community
|
||||
@titlepage
|
||||
@center @titlefont{Community}
|
||||
@end titlepage
|
||||
|
||||
@top
|
||||
|
||||
@contents
|
||||
|
||||
@anchor{Organisation}
|
||||
@chapter Organisation
|
||||
|
||||
The FFmpeg project is organized through a community working on global consensus.
|
||||
|
||||
Decisions are taken by the ensemble of active members, through voting and are aided by two committees.
|
||||
|
||||
@anchor{General Assembly}
|
||||
@chapter General Assembly
|
||||
|
||||
The ensemble of active members is called the General Assembly (GA).
|
||||
|
||||
The General Assembly is sovereign and legitimate for all its decisions regarding the FFmpeg project.
|
||||
|
||||
The General Assembly is made up of active contributors.
|
||||
|
||||
Contributors are considered "active contributors" if they have authored more than 20 patches in the last 36 months in the main FFmpeg repository, or if they have been voted in by the GA.
|
||||
|
||||
The list of active contributors is updated twice each year, on 1st January and 1st July, 0:00 UTC.
|
||||
|
||||
Additional members are added to the General Assembly through a vote after proposal by a member of the General Assembly. They are part of the GA for two years, after which they need a confirmation by the GA.
|
||||
|
||||
A script to generate the current members of the general assembly (minus members voted in) can be found in `tools/general_assembly.pl`.
|
||||
|
||||
@anchor{Voting}
|
||||
@chapter Voting
|
||||
|
||||
Voting is done using a ranked voting system, currently running on https://vote.ffmpeg.org/ .
|
||||
|
||||
Majority vote means more than 50% of the expressed ballots.
|
||||
|
||||
@anchor{Technical Committee}
|
||||
@chapter Technical Committee
|
||||
|
||||
The Technical Committee (TC) is here to arbitrate and make decisions when technical conflicts occur in the project. They will consider the merits of all the positions, judge them and make a decision.
|
||||
|
||||
The TC resolves technical conflicts but is not a technical steering committee.
|
||||
|
||||
Decisions by the TC are binding for all the contributors.
|
||||
|
||||
Decisions made by the TC can be re-opened after 1 year or by a majority vote of the General Assembly, requested by one of the member of the GA.
|
||||
|
||||
The TC is elected by the General Assembly for a duration of 1 year, and is composed of 5 members. Members can be re-elected if they wish. A majority vote in the General Assembly can trigger a new election of the TC.
|
||||
|
||||
The members of the TC can be elected from outside of the GA. Candidates for election can either be suggested or self-nominated.
|
||||
|
||||
The conflict resolution process is detailed in the resolution process document.
|
||||
|
||||
The TC can be contacted at <tc@@ffmpeg>.
|
||||
|
||||
@anchor{Resolution Process}
|
||||
@section Resolution Process
|
||||
|
||||
The Technical Committee (TC) is here to arbitrate and make decisions when technical conflicts occur in the project.
|
||||
|
||||
The TC main role is to resolve technical conflicts. It is therefore not a technical steering committee, but it is understood that some decisions might impact the future of the project.
|
||||
|
||||
@subsection Seizing
|
||||
|
||||
The TC can take possession of any technical matter that it sees fit.
|
||||
|
||||
To involve the TC in a matter, email tc@ or CC them on an ongoing discussion.
|
||||
|
||||
As members of TC are developers, they also can email tc@ to raise an issue.
|
||||
@subsection Announcement
|
||||
|
||||
The TC, once seized, must announce itself on the main mailing list, with a [TC] tag.
|
||||
|
||||
The TC has 2 modes of operation: a RFC one and an internal one.
|
||||
|
||||
If the TC thinks it needs the input from the larger community, the TC can call for a RFC. Else, it can decide by itself.
|
||||
|
||||
If the disagreement involves a member of the TC, that member should recuse themselves from the decision.
|
||||
|
||||
The decision to use a RFC process or an internal discussion is a discretionary decision of the TC.
|
||||
|
||||
The TC can also reject a seizure for a few reasons such as: the matter was not discussed enough previously; it lacks expertise to reach a beneficial decision on the matter; or the matter is too trivial.
|
||||
@subsection RFC call
|
||||
|
||||
In the RFC mode, one person from the TC posts on the mailing list the technical question and will request input from the community.
|
||||
|
||||
The mail will have the following specification:
|
||||
|
||||
a precise title
|
||||
a specific tag [TC RFC]
|
||||
a top-level email
|
||||
contain a precise question that does not exceed 100 words and that is answerable by developers
|
||||
may have an extra description, or a link to a previous discussion, if deemed necessary,
|
||||
contain a precise end date for the answers.
|
||||
|
||||
The answers from the community must be on the main mailing list and must have the following specification:
|
||||
|
||||
keep the tag and the title unchanged
|
||||
limited to 400 words
|
||||
a first-level, answering directly to the main email
|
||||
answering to the question.
|
||||
|
||||
Further replies to answers are permitted, as long as they conform to the community standards of politeness, they are limited to 100 words, and are not nested more than once. (max-depth=2)
|
||||
|
||||
After the end-date, mails on the thread will be ignored.
|
||||
|
||||
Violations of those rules will be escalated through the Community Committee.
|
||||
|
||||
After all the emails are in, the TC has 96 hours to give its final decision. Exceptionally, the TC can request an extra delay, that will be notified on the mailing list.
|
||||
@subsection Within TC
|
||||
|
||||
In the internal case, the TC has 96 hours to give its final decision. Exceptionally, the TC can request an extra delay.
|
||||
@subsection Decisions
|
||||
|
||||
The decisions from the TC will be sent on the mailing list, with the [TC] tag.
|
||||
|
||||
Internally, the TC should take decisions with a majority, or using ranked-choice voting.
|
||||
|
||||
The decision from the TC should be published with a summary of the reasons that lead to this decision.
|
||||
|
||||
The decisions from the TC are final, until the matters are reopened after no less than one year.
|
||||
|
||||
@anchor{Community Committee}
|
||||
@chapter Community Committee
|
||||
|
||||
The Community Committee (CC) is here to arbitrage and make decisions when inter-personal conflicts occur in the project. It will decide quickly and take actions, for the sake of the project.
|
||||
|
||||
The CC can remove privileges of offending members, including removal of commit access and temporary ban from the community.
|
||||
|
||||
Decisions made by the CC can be re-opened after 1 year or by a majority vote of the General Assembly. Indefinite bans from the community must be confirmed by the General Assembly, in a majority vote.
|
||||
|
||||
The CC is elected by the General Assembly for a duration of 1 year, and is composed of 5 members. Members can be re-elected if they wish. A majority vote in the General Assembly can trigger a new election of the CC.
|
||||
|
||||
The members of the CC can be elected from outside of the GA. Candidates for election can either be suggested or self-nominated.
|
||||
|
||||
The CC is governed by and responsible for enforcing the Code of Conduct.
|
||||
|
||||
The CC can be contacted at <cc@@ffmpeg>.
|
||||
|
||||
@anchor{Code of Conduct}
|
||||
@chapter Code of Conduct
|
||||
|
||||
Be friendly and respectful towards others and third parties.
|
||||
Treat others the way you yourself want to be treated.
|
||||
|
||||
Be considerate. Not everyone shares the same viewpoint and priorities as you do.
|
||||
Different opinions and interpretations help the project.
|
||||
Looking at issues from a different perspective assists development.
|
||||
|
||||
Do not assume malice for things that can be attributed to incompetence. Even if
|
||||
it is malice, it's rarely good to start with that as initial assumption.
|
||||
|
||||
Stay friendly even if someone acts contrarily. Everyone has a bad day
|
||||
once in a while.
|
||||
If you yourself have a bad day or are angry then try to take a break and reply
|
||||
once you are calm and without anger if you have to.
|
||||
|
||||
Try to help other team members and cooperate if you can.
|
||||
|
||||
The goal of software development is to create technical excellence, not for any
|
||||
individual to be better and "win" against the others. Large software projects
|
||||
are only possible and successful through teamwork.
|
||||
|
||||
If someone struggles do not put them down. Give them a helping hand
|
||||
instead and point them in the right direction.
|
||||
|
||||
Finally, keep in mind the immortal words of Bill and Ted,
|
||||
"Be excellent to each other."
|
||||
|
||||
@bye
|
||||
@@ -353,169 +353,6 @@ Enabled by default.
|
||||
|
||||
@end table
|
||||
|
||||
@section libaribcaption
|
||||
|
||||
Yet another ARIB STD-B24 caption decoder using external @dfn{libaribcaption}
|
||||
library.
|
||||
|
||||
Implements profiles A and C of the Japanse ARIB STD-B24 standard,
|
||||
Brazilian ABNT NBR 15606-1, and Philippines version of ISDB-T.
|
||||
|
||||
Requires the presence of the libaribcaption headers and library
|
||||
(@url{https://github.com/xqq/libaribcaption}) during configuration.
|
||||
You need to explicitly configure the build with @code{--enable-libaribcaption}.
|
||||
If both @dfn{libaribb24} and @dfn{libaribcaption} are enabled, @dfn{libaribcaption}
|
||||
decoder precedes.
|
||||
|
||||
@subsection libaribcaption Decoder Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item -sub_type @var{subtitle_type}
|
||||
Specifies the format of the decoded subtitles.
|
||||
|
||||
@table @samp
|
||||
@item bitmap
|
||||
Graphical image.
|
||||
@item ass
|
||||
ASS formatted text.
|
||||
@item text
|
||||
Simple text based output without formatting.
|
||||
@end table
|
||||
|
||||
The default is @dfn{ass} as same as @dfn{libaribb24} decoder.
|
||||
Some present players (e.g., @dfn{mpv}) expect ASS format for ARIB caption.
|
||||
|
||||
@item -caption_encoding @var{encoding_scheme}
|
||||
Specifies the encoding scheme of input subtitle text.
|
||||
|
||||
@table @samp
|
||||
@item auto
|
||||
Automatically detect text encoding (default).
|
||||
@item jis
|
||||
8bit-char JIS encoding defined in ARIB STD B24.
|
||||
This encoding used in Japan for ISDB captions.
|
||||
@item utf8
|
||||
UTF-8 encoding defined in ARIB STD B24.
|
||||
This encoding is used in Philippines for ISDB-T captions.
|
||||
@item latin
|
||||
Latin character encoding defined in ABNT NBR 15606-1.
|
||||
This encoding is used in South America for SBTVD / ISDB-Tb captions.
|
||||
@end table
|
||||
|
||||
@item -font @var{font_name[,font_name2,...]}
|
||||
Specify comma-separated list of font family names to be used for @dfn{bitmap}
|
||||
or @dfn{ass} type subtitle rendering.
|
||||
Only first font name is used for @dfn{ass} type subtitle.
|
||||
|
||||
If not specified, use internaly defined default font family.
|
||||
|
||||
@item -ass_single_rect @var{boolean}
|
||||
ARIB STD-B24 specifies that some captions may be displayed at different
|
||||
positions at a time (multi-rectangle subtitle).
|
||||
Since some players (e.g., old @dfn{mpv}) can't handle multiple ASS rectangles
|
||||
in a single AVSubtitle, or multiple ASS rectangles of indeterminate duration
|
||||
with the same start timestamp, this option can change the behavior so that
|
||||
all the texts are displayed in a single ASS rectangle.
|
||||
|
||||
The default is @var{false}.
|
||||
|
||||
If your player cannot handle AVSubtitles with multiple ASS rectangles properly,
|
||||
set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change
|
||||
default behavior at compilation.
|
||||
|
||||
@item -force_outline_text @var{boolean}
|
||||
Specify whether always render outline text for all characters regardless of
|
||||
the indication by charactor style.
|
||||
|
||||
The default is @var{false}.
|
||||
|
||||
@item -outline_width @var{number} (0.0 - 3.0)
|
||||
Specify width for outline text, in dots (relative).
|
||||
|
||||
The default is @var{1.5}.
|
||||
|
||||
@item -ignore_background @var{boolean}
|
||||
Specify whether to ignore background color rendering.
|
||||
|
||||
The default is @var{false}.
|
||||
|
||||
@item -ignore_ruby @var{boolean}
|
||||
Specify whether to ignore rendering for ruby-like (furigana) characters.
|
||||
|
||||
The default is @var{false}.
|
||||
|
||||
@item -replace_drcs @var{boolean}
|
||||
Specify whether to render replaced DRCS characters as Unicode characters.
|
||||
|
||||
The default is @var{true}.
|
||||
|
||||
@item -replace_msz_ascii @var{boolean}
|
||||
Specify whether to replace MSZ (Middle Size; half width) fullwidth
|
||||
alphanumerics with halfwidth alphanumerics.
|
||||
|
||||
The default is @var{true}.
|
||||
|
||||
@item -replace_msz_japanese @var{boolean}
|
||||
Specify whether to replace some MSZ (Middle Size; half width) fullwidth
|
||||
japanese special characters with halfwidth ones.
|
||||
|
||||
The default is @var{true}.
|
||||
|
||||
@item -replace_msz_glyph @var{boolean}
|
||||
Specify whether to replace MSZ (Middle Size; half width) characters
|
||||
with halfwidth glyphs if the fonts supports it.
|
||||
This option works under FreeType or DirectWrite renderer
|
||||
with Adobe-Japan1 compliant fonts.
|
||||
e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho,
|
||||
Yu Gothic, Yu Mincho, and Meiryo.
|
||||
|
||||
The default is @var{true}.
|
||||
|
||||
@item -canvas_size @var{image_size}
|
||||
Specify the resolution of the canvas to render subtitles to; usually, this
|
||||
should be frame size of input video.
|
||||
This only applies when @code{-subtitle_type} is set to @var{bitmap}.
|
||||
|
||||
The libaribcaption decoder assumes input frame size for bitmap rendering as below:
|
||||
@enumerate
|
||||
@item
|
||||
PROFILE_A : 1440 x 1080 with SAR (PAR) 4:3
|
||||
@item
|
||||
PROFILE_C : 320 x 180 with SAR (PAR) 1:1
|
||||
@end enumerate
|
||||
|
||||
If actual frame size of input video does not match above assumption,
|
||||
the rendered captions may be distorted.
|
||||
To make the captions undistorted, add @code{-canvas_size} option to specify
|
||||
actual input video size.
|
||||
|
||||
Note that the @code{-canvas_size} option is not required for video with
|
||||
different size but same aspect ratio.
|
||||
In such cases, the caption will be stretched or shrunk to actual video size
|
||||
if @code{-canvas_size} option is not specified.
|
||||
If @code{-canvas_size} option is specified with different size,
|
||||
the caption will be stretched or shrunk as specified size with calculated SAR.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection libaribcaption decoder usage examples
|
||||
|
||||
Display MPEG-TS file with ARIB subtitle by @code{ffplay} tool:
|
||||
@example
|
||||
ffplay -sub_type bitmap MPEG.TS
|
||||
@end example
|
||||
|
||||
Display MPEG-TS file with input frame size 1920x1080 by @code{ffplay} tool:
|
||||
@example
|
||||
ffplay -sub_type bitmap -canvas_size 1920x1080 MPEG.TS
|
||||
@end example
|
||||
|
||||
Embed ARIB subtitle in transcoded video:
|
||||
@example
|
||||
ffmpeg -sub_type bitmap -i src.m2t -filter_complex "[0:v][0:s]overlay" -vcodec h264 dest.mp4
|
||||
@end example
|
||||
|
||||
@section dvbsub
|
||||
|
||||
@subsection Options
|
||||
|
||||
@@ -307,15 +307,7 @@ stream which contains the alpha channel in addition to the ordinary video.
|
||||
|
||||
Interoperable Master Format demuxer.
|
||||
|
||||
This demuxer presents audio and video streams found in an IMF Composition, as
|
||||
specified in @url{https://doi.org/10.5594/SMPTE.ST2067-2.2020, SMPTE ST 2067-2}.
|
||||
|
||||
@example
|
||||
ffmpeg [-assetmaps <path of ASSETMAP1>,<path of ASSETMAP2>,...] -i <path of CPL> ...
|
||||
@end example
|
||||
|
||||
If @code{-assetmaps} is not specified, the demuxer looks for a file called
|
||||
@file{ASSETMAP.xml} in the same directory as the CPL.
|
||||
This demuxer presents audio and video streams found in an IMF Composition.
|
||||
|
||||
@section flv, live_flv, kux
|
||||
|
||||
@@ -779,13 +771,6 @@ cast to int32 are used to adjust onward dts.
|
||||
|
||||
Unit is the track time scale. Range is 0 to UINT_MAX. Default is @code{UINT_MAX - 48000*10} which allows upto
|
||||
a 10 second dts correction for 48 kHz audio streams while accommodating 99.9% of @code{uint32} range.
|
||||
|
||||
@item interleaved_read
|
||||
Interleave packets from multiple tracks at demuxer level. For badly interleaved files, this prevents playback issues
|
||||
caused by large gaps between packets in different tracks, as MOV/MP4 do not have packet placement requirements.
|
||||
However, this can cause excessive seeking on very badly interleaved files, due to seeking between tracks, so disabling
|
||||
it may prevent I/O issues, at the expense of playback.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Audible AAX
|
||||
|
||||
82
doc/dev_community/community.md
Normal file
82
doc/dev_community/community.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# FFmpeg project
|
||||
|
||||
## Organisation
|
||||
|
||||
The FFmpeg project is organized through a community working on global consensus.
|
||||
|
||||
Decisions are taken by the ensemble of active members, through voting and
|
||||
are aided by two committees.
|
||||
|
||||
## General Assembly
|
||||
|
||||
The ensemble of active members is called the General Assembly (GA).
|
||||
|
||||
The General Assembly is sovereign and legitimate for all its decisions
|
||||
regarding the FFmpeg project.
|
||||
|
||||
The General Assembly is made up of active contributors.
|
||||
|
||||
Contributors are considered "active contributors" if they have pushed more
|
||||
than 20 patches in the last 36 months in the main FFmpeg repository, or
|
||||
if they have been voted in by the GA.
|
||||
|
||||
Additional members are added to the General Assembly through a vote after
|
||||
proposal by a member of the General Assembly.
|
||||
They are part of the GA for two years, after which they need a confirmation by
|
||||
the GA.
|
||||
|
||||
A script to generate the current members of the general assembly (minus members
|
||||
voted in) can be found in `tools/general_assembly.pl`.
|
||||
|
||||
## Voting
|
||||
|
||||
Voting is done using a ranked voting system, currently running on https://vote.ffmpeg.org/ .
|
||||
|
||||
Majority vote means more than 50% of the expressed ballots.
|
||||
|
||||
## Technical Committee
|
||||
|
||||
The Technical Committee (TC) is here to arbitrate and make decisions when
|
||||
technical conflicts occur in the project.
|
||||
They will consider the merits of all the positions, judge them and make a
|
||||
decision.
|
||||
|
||||
The TC resolves technical conflicts but is not a technical steering committee.
|
||||
|
||||
Decisions by the TC are binding for all the contributors.
|
||||
|
||||
Decisions made by the TC can be re-opened after 1 year or by a majority vote
|
||||
of the General Assembly, requested by one of the member of the GA.
|
||||
|
||||
The TC is elected by the General Assembly for a duration of 1 year, and
|
||||
is composed of 5 members.
|
||||
Members can be re-elected if they wish. A majority vote in the General Assembly
|
||||
can trigger a new election of the TC.
|
||||
|
||||
The members of the TC can be elected from outside of the GA.
|
||||
Candidates for election can either be suggested or self-nominated.
|
||||
|
||||
The conflict resolution process is detailed in the [resolution process](resolution_process.md) document.
|
||||
|
||||
## Community committee
|
||||
|
||||
The Community Committee (CC) is here to arbitrage and make decisions when
|
||||
inter-personal conflicts occur in the project. It will decide quickly and
|
||||
take actions, for the sake of the project.
|
||||
|
||||
The CC can remove privileges of offending members, including removal of
|
||||
commit access and temporary ban from the community.
|
||||
|
||||
Decisions made by the CC can be re-opened after 1 year or by a majority vote
|
||||
of the General Assembly. Indefinite bans from the community must be confirmed
|
||||
by the General Assembly, in a majority vote.
|
||||
|
||||
The CC is elected by the General Assembly for a duration of 1 year, and is
|
||||
composed of 5 members.
|
||||
Members can be re-elected if they wish. A majority vote in the General Assembly
|
||||
can trigger a new election of the CC.
|
||||
|
||||
The members of the CC can be elected from outside of the GA.
|
||||
Candidates for election can either be suggested or self-nominated.
|
||||
|
||||
The CC is governed by and responsible for enforcing the Code of Conduct.
|
||||
91
doc/dev_community/resolution_process.md
Normal file
91
doc/dev_community/resolution_process.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Technical Committee
|
||||
|
||||
_This document only makes sense with the rules from [the community document](community)_.
|
||||
|
||||
The Technical Committee (**TC**) is here to arbitrate and make decisions when
|
||||
technical conflicts occur in the project.
|
||||
|
||||
The TC main role is to resolve technical conflicts.
|
||||
It is therefore not a technical steering committee, but it is understood that
|
||||
some decisions might impact the future of the project.
|
||||
|
||||
# Process
|
||||
|
||||
## Seizing
|
||||
|
||||
The TC can take possession of any technical matter that it sees fit.
|
||||
|
||||
To involve the TC in a matter, email tc@ or CC them on an ongoing discussion.
|
||||
|
||||
As members of TC are developers, they also can email tc@ to raise an issue.
|
||||
|
||||
## Announcement
|
||||
|
||||
The TC, once seized, must announce itself on the main mailing list, with a _[TC]_ tag.
|
||||
|
||||
The TC has 2 modes of operation: a RFC one and an internal one.
|
||||
|
||||
If the TC thinks it needs the input from the larger community, the TC can call
|
||||
for a RFC. Else, it can decide by itself.
|
||||
|
||||
If the disagreement involves a member of the TC, that member should recuse
|
||||
themselves from the decision.
|
||||
|
||||
The decision to use a RFC process or an internal discussion is a discretionary
|
||||
decision of the TC.
|
||||
|
||||
The TC can also reject a seizure for a few reasons such as:
|
||||
the matter was not discussed enough previously; it lacks expertise to reach a
|
||||
beneficial decision on the matter; or the matter is too trivial.
|
||||
|
||||
### RFC call
|
||||
|
||||
In the RFC mode, one person from the TC posts on the mailing list the
|
||||
technical question and will request input from the community.
|
||||
|
||||
The mail will have the following specification:
|
||||
* a precise title
|
||||
* a specific tag [TC RFC]
|
||||
* a top-level email
|
||||
* contain a precise question that does not exceed 100 words and that is answerable by developers
|
||||
* may have an extra description, or a link to a previous discussion, if deemed necessary,
|
||||
* contain a precise end date for the answers.
|
||||
|
||||
The answers from the community must be on the main mailing list and must have
|
||||
the following specification:
|
||||
* keep the tag and the title unchanged
|
||||
* limited to 400 words
|
||||
* a first-level, answering directly to the main email
|
||||
* answering to the question.
|
||||
|
||||
Further replies to answers are permitted, as long as they conform to the
|
||||
community standards of politeness, they are limited to 100 words, and are not
|
||||
nested more than once. (max-depth=2)
|
||||
|
||||
After the end-date, mails on the thread will be ignored.
|
||||
|
||||
Violations of those rules will be escalated through the Community Committee.
|
||||
|
||||
After all the emails are in, the TC has 96 hours to give its final decision.
|
||||
Exceptionally, the TC can request an extra delay, that will be notified on the
|
||||
mailing list.
|
||||
|
||||
### Within TC
|
||||
|
||||
In the internal case, the TC has 96 hours to give its final decision.
|
||||
Exceptionally, the TC can request an extra delay.
|
||||
|
||||
|
||||
## Decisions
|
||||
|
||||
The decisions from the TC will be sent on the mailing list, with the _[TC]_ tag.
|
||||
|
||||
Internally, the TC should take decisions with a majority, or using
|
||||
ranked-choice voting.
|
||||
|
||||
The decision from the TC should be published with a summary of the reasons that
|
||||
lead to this decision.
|
||||
|
||||
The decisions from the TC are final, until the matters are reopened after
|
||||
no less than one year.
|
||||
|
||||
@@ -24,10 +24,6 @@ generated from the headers
|
||||
the examples under @file{doc/examples}
|
||||
@end itemize
|
||||
|
||||
For more detailed legal information about the use of FFmpeg in
|
||||
external programs read the @file{LICENSE} file in the source tree and
|
||||
consult @url{https://ffmpeg.org/legal.html}.
|
||||
|
||||
If you modify FFmpeg code for your own use case, you are highly encouraged to
|
||||
@emph{submit your changes back to us}, using this document as a guide. There are
|
||||
both pragmatic and ideological reasons to do so:
|
||||
@@ -44,6 +40,12 @@ By supporting the project you find useful you ensure it continues to be
|
||||
maintained and developed.
|
||||
@end itemize
|
||||
|
||||
For more detailed legal information about the use of FFmpeg in
|
||||
external programs read the @file{LICENSE} file in the source tree and
|
||||
consult @url{https://ffmpeg.org/legal.html}.
|
||||
|
||||
@section Contributing code
|
||||
|
||||
All proposed code changes should be submitted for review to
|
||||
@url{mailto:ffmpeg-devel@@ffmpeg.org, the development mailing list}, as
|
||||
described in more detail in the @ref{Submitting patches} chapter. The code
|
||||
@@ -54,9 +56,9 @@ and should try to fix issues their commit causes.
|
||||
@anchor{Coding Rules}
|
||||
@chapter Coding Rules
|
||||
|
||||
@section Language
|
||||
@section C language features
|
||||
|
||||
FFmpeg is mainly programmed in the ISO C99 language, extended with:
|
||||
FFmpeg is programmed in the ISO C99 language, extended with:
|
||||
@itemize @bullet
|
||||
@item
|
||||
Atomic operations from C11 @file{stdatomic.h}. They are emulated on
|
||||
@@ -81,44 +83,6 @@ complex numbers;
|
||||
mixed statements and declarations.
|
||||
@end itemize
|
||||
|
||||
@subsection SIMD/DSP
|
||||
@anchor{SIMD/DSP}
|
||||
|
||||
As modern compilers are unable to generate efficient SIMD or other
|
||||
performance-critical DSP code from plain C, handwritten assembly is used.
|
||||
Usually such code is isolated in a separate function. Then the standard approach
|
||||
is writing multiple versions of this function – a plain C one that works
|
||||
everywhere and may also be useful for debugging, and potentially multiple
|
||||
architecture-specific optimized implementations. Initialization code then
|
||||
chooses the best available version at runtime and loads it into a function
|
||||
pointer; the function in question is then always called through this pointer.
|
||||
|
||||
The specific syntax used for writing assembly is:
|
||||
@itemize @bullet
|
||||
@item
|
||||
NASM on x86;
|
||||
|
||||
@item
|
||||
GAS on ARM.
|
||||
@end itemize
|
||||
|
||||
A unit testing framework for assembly called @code{checkasm} lives under
|
||||
@file{tests/checkasm}. All new assembly should come with @code{checkasm} tests;
|
||||
adding tests for existing assembly that lacks them is also strongly encouraged.
|
||||
|
||||
@subsection Other languages
|
||||
|
||||
Other languages than C may be used in special cases:
|
||||
@itemize @bullet
|
||||
@item
|
||||
Compiler intrinsics or inline assembly when the code in question cannot be
|
||||
written in the standard way described in the @ref{SIMD/DSP} section. This
|
||||
typically applies to code that needs to be inlined.
|
||||
|
||||
@item
|
||||
Objective-C where required for interacting with macOS-specific interfaces.
|
||||
@end itemize
|
||||
|
||||
@section Code formatting conventions
|
||||
|
||||
There are the following guidelines regarding the indentation in files:
|
||||
@@ -215,7 +179,6 @@ int myfunc(int my_parameter)
|
||||
...
|
||||
@end example
|
||||
|
||||
@anchor{Naming conventions}
|
||||
@section Naming conventions
|
||||
|
||||
Names of functions, variables, and struct members must be lowercase, using
|
||||
@@ -274,6 +237,10 @@ symbols. If in doubt, just avoid names starting with @code{_} altogether.
|
||||
@section Miscellaneous conventions
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
fprintf and printf are forbidden in libavformat and libavcodec,
|
||||
please use av_log() instead.
|
||||
|
||||
@item
|
||||
Casts should be used only when necessary. Unneeded parentheses
|
||||
should also be avoided if they don't make the code easier to understand.
|
||||
@@ -282,42 +249,6 @@ should also be avoided if they don't make the code easier to understand.
|
||||
@anchor{Development Policy}
|
||||
@chapter Development Policy
|
||||
|
||||
@section Code behaviour
|
||||
|
||||
@subheading Correctness
|
||||
The code must be valid. It must not crash, abort, access invalid pointers, leak
|
||||
memory, cause data races or signed integer overflow, or otherwise cause
|
||||
undefined behaviour. Error codes should be checked and, when applicable,
|
||||
forwarded to the caller.
|
||||
|
||||
@subheading Thread- and library-safety
|
||||
Our libraries may be called by multiple independent callers in the same process.
|
||||
These calls may happen from any number of threads and the different call sites
|
||||
may not be aware of each other - e.g. a user program may be calling our
|
||||
libraries directly, and use one or more libraries that also call our libraries.
|
||||
The code must behave correctly under such conditions.
|
||||
|
||||
@subheading Robustness
|
||||
The code must treat as untrusted any bytestream received from a caller or read
|
||||
from a file, network, etc. It must not misbehave when arbitrary data is sent to
|
||||
it - typically it should print an error message and return
|
||||
@code{AVERROR_INVALIDDATA} on encountering invalid input data.
|
||||
|
||||
@subheading Memory allocation
|
||||
The code must use the @code{av_malloc()} family of functions from
|
||||
@file{libavutil/mem.h} to perform all memory allocation, except in special cases
|
||||
(e.g. when interacting with an external library that requires a specific
|
||||
allocator to be used).
|
||||
|
||||
All allocations should be checked and @code{AVERROR(ENOMEM)} returned on
|
||||
failure. A common mistake is that error paths leak memory - make sure that does
|
||||
not happen.
|
||||
|
||||
@subheading stdio
|
||||
Our libraries must not access the stdio streams stdin/stdout/stderr directly
|
||||
(e.g. via @code{printf()} family of functions), as that is not library-safe. For
|
||||
logging, use @code{av_log()}.
|
||||
|
||||
@section Patches/Committing
|
||||
@subheading Licenses for patches must be compatible with FFmpeg.
|
||||
Contributions should be licensed under the
|
||||
@@ -340,24 +271,13 @@ missing samples or an implementation with a small subset of features.
|
||||
Always check the mailing list for any reviewers with issues and test
|
||||
FATE before you push.
|
||||
|
||||
@subheading Commit messages
|
||||
Commit messages are highly important tools for informing other developers on
|
||||
what a given change does and why. Every commit must always have a properly
|
||||
filled out commit message with the following format:
|
||||
@example
|
||||
area changed: short 1 line description
|
||||
|
||||
details describing what and why and giving references.
|
||||
@end example
|
||||
|
||||
If the commit addresses a known bug on our bug tracker or other external issue
|
||||
(e.g. CVE), the commit message should include the relevant bug ID(s) or other
|
||||
external identifiers. Note that this should be done in addition to a proper
|
||||
explanation and not instead of it. Comments such as "fixed!" or "Changed it."
|
||||
are not acceptable.
|
||||
|
||||
When applying patches that have been discussed at length on the mailing list,
|
||||
reference the thread in the commit message.
|
||||
@subheading Keep the main commit message short with an extended description below.
|
||||
The commit message should have a short first line in the form of
|
||||
a @samp{topic: short description} as a header, separated by a newline
|
||||
from the body consisting of an explanation of why the change is necessary.
|
||||
If the commit fixes a known bug on the bug tracker, the commit message
|
||||
should include its bug ID. Referring to the issue on the bug tracker does
|
||||
not exempt you from writing an excerpt of the bug in the commit message.
|
||||
|
||||
@subheading Testing must be adequate but not excessive.
|
||||
If it works for you, others, and passes FATE then it should be OK to commit
|
||||
@@ -376,6 +296,15 @@ later on.
|
||||
Also if you have doubts about splitting or not splitting, do not hesitate to
|
||||
ask/discuss it on the developer mailing list.
|
||||
|
||||
@subheading Ask before you change the build system (configure, etc).
|
||||
Do not commit changes to the build system (Makefiles, configure script)
|
||||
which change behavior, defaults etc, without asking first. The same
|
||||
applies to compiler warning fixes, trivial looking fixes and to code
|
||||
maintained by other developers. We usually have a reason for doing things
|
||||
the way we do. Send your changes as patches to the ffmpeg-devel mailing
|
||||
list, and if the code maintainers say OK, you may commit. This does not
|
||||
apply to files you wrote and/or maintain.
|
||||
|
||||
@subheading Cosmetic changes should be kept in separate patches.
|
||||
We refuse source indentation and other cosmetic changes if they are mixed
|
||||
with functional changes, such commits will be rejected and removed. Every
|
||||
@@ -390,12 +319,28 @@ NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
|
||||
then either do NOT change the indentation of the inner part within (do not
|
||||
move it to the right)! or do so in a separate commit
|
||||
|
||||
@subheading Commit messages should always be filled out properly.
|
||||
Always fill out the commit log message. Describe in a few lines what you
|
||||
changed and why. You can refer to mailing list postings if you fix a
|
||||
particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
|
||||
Recommended format:
|
||||
|
||||
@example
|
||||
area changed: Short 1 line description
|
||||
|
||||
details describing what and why and giving references.
|
||||
@end example
|
||||
|
||||
@subheading Credit the author of the patch.
|
||||
Make sure the author of the commit is set correctly. (see git commit --author)
|
||||
If you apply a patch, send an
|
||||
answer to ffmpeg-devel (or wherever you got the patch from) saying that
|
||||
you applied the patch.
|
||||
|
||||
@subheading Complex patches should refer to discussion surrounding them.
|
||||
When applying patches that have been discussed (at length) on the mailing
|
||||
list, reference the thread in the log message.
|
||||
|
||||
@subheading Always wait long enough before pushing changes
|
||||
Do NOT commit to code actively maintained by others without permission.
|
||||
Send a patch to ffmpeg-devel. If no one answers within a reasonable
|
||||
@@ -404,6 +349,22 @@ time-frame (12h for build failures and security fixes, 3 days small changes,
|
||||
Also note, the maintainer can simply ask for more time to review!
|
||||
|
||||
@section Code
|
||||
@subheading API/ABI changes should be discussed before they are made.
|
||||
Do not change behavior of the programs (renaming options etc) or public
|
||||
API or ABI without first discussing it on the ffmpeg-devel mailing list.
|
||||
Do not remove widely used functionality or features (redundant code can be removed).
|
||||
|
||||
@subheading Remember to check if you need to bump versions for libav*.
|
||||
Depending on the change, you may need to change the version integer.
|
||||
Incrementing the first component means no backward compatibility to
|
||||
previous versions (e.g. removal of a function from the public API).
|
||||
Incrementing the second component means backward compatible change
|
||||
(e.g. addition of a function to the public API or extension of an
|
||||
existing data structure).
|
||||
Incrementing the third component means a noteworthy binary compatible
|
||||
change (e.g. encoder bug fix that matters for the decoder). The third
|
||||
component always starts at 100 to distinguish FFmpeg from Libav.
|
||||
|
||||
@subheading Warnings for correct code may be disabled if there is no other option.
|
||||
Compiler warnings indicate potential bugs or code with bad style. If a type of
|
||||
warning always points to correct and clean code, that warning should
|
||||
@@ -413,150 +374,10 @@ If it is a bug, the bug has to be fixed. If it is not, the code should
|
||||
be changed to not generate a warning unless that causes a slowdown
|
||||
or obfuscates the code.
|
||||
|
||||
@section Library public interfaces
|
||||
Every library in FFmpeg provides a set of public APIs in its installed headers,
|
||||
which are those listed in the variable @code{HEADERS} in that library's
|
||||
@file{Makefile}. All identifiers defined in those headers (except for those
|
||||
explicitly documented otherwise), and corresponding symbols exported from
|
||||
compiled shared or static libraries are considered public interfaces and must
|
||||
comply with the API and ABI compatibility rules described in this section.
|
||||
|
||||
Public APIs must be backward compatible within a given major version. I.e. any
|
||||
valid user code that compiles and works with a given library version must still
|
||||
compile and work with any later version, as long as the major version number is
|
||||
unchanged. "Valid user code" here means code that is calling our APIs in a
|
||||
documented and/or intended manner and is not relying on any undefined behavior.
|
||||
Incrementing the major version may break backward compatibility, but only to the
|
||||
extent described in @ref{Major version bumps}.
|
||||
|
||||
We also guarantee backward ABI compatibility for shared and static libraries.
|
||||
I.e. it should be possible to replace a shared or static build of our library
|
||||
with a build of any later version (re-linking the user binary in the static
|
||||
case) without breaking any valid user binaries, as long as the major version
|
||||
number remains unchanged.
|
||||
|
||||
@subsection Adding new interfaces
|
||||
Any new public identifiers in installed headers are considered new API - this
|
||||
includes new functions, structs, macros, enum values, typedefs, new fields in
|
||||
existing structs, new installed headers, etc. Consider the following
|
||||
guidelines when adding new APIs.
|
||||
|
||||
@subsubheading Motivation
|
||||
While new APIs can be added relatively easily, changing or removing them is much
|
||||
harder due to abovementioned compatibility requirements. You should then
|
||||
consider carefully whether the functionality you are adding really needs to be
|
||||
exposed to our callers as new public API.
|
||||
|
||||
Your new API should have at least one well-established use case outside of the
|
||||
library that cannot be easily achieved with existing APIs. Every library in
|
||||
FFmpeg also has a defined scope - your new API must fit within it.
|
||||
|
||||
@subsubheading Replacing existing APIs
|
||||
If your new API is replacing an existing one, it should be strictly superior to
|
||||
it, so that the advantages of using the new API outweight the cost to the
|
||||
callers of changing their code. After adding the new API you should then
|
||||
deprecate the old one and schedule it for removal, as described in
|
||||
@ref{Removing interfaces}.
|
||||
|
||||
If you deem an existing API deficient and want to fix it, the preferred approach
|
||||
in most cases is to add a differently-named replacement and deprecate the
|
||||
existing API rather than modify it. It is important to make the changes visible
|
||||
to our callers (e.g. through compile- or run-time deprecation warnings) and make
|
||||
it clear how to transition to the new API (e.g. in the Doxygen documentation or
|
||||
on the wiki).
|
||||
|
||||
@subsubheading API design
|
||||
The FFmpeg libraries are used by a variety of callers to perform a wide range of
|
||||
multimedia-related processing tasks. You should therefore - within reason - try
|
||||
to design your new API for the broadest feasible set of use cases and avoid
|
||||
unnecessarily limiting it to a specific type of callers (e.g. just media
|
||||
playback or just transcoding).
|
||||
|
||||
@subsubheading Consistency
|
||||
Check whether similar APIs already exist in FFmpeg. If they do, try to model
|
||||
your new addition on them to achieve better overall consistency.
|
||||
|
||||
The naming of your new identifiers should follow the @ref{Naming conventions}
|
||||
and be aligned with other similar APIs, if applicable.
|
||||
|
||||
@subsubheading Extensibility
|
||||
You should also consider how your API might be extended in the future in a
|
||||
backward-compatible way. If you are adding a new struct @code{AVFoo}, the
|
||||
standard approach is requiring the caller to always allocate it through a
|
||||
constructor function, typically named @code{av_foo_alloc()}. This way new fields
|
||||
may be added to the end of the struct without breaking ABI compatibility.
|
||||
Typically you will also want a destructor - @code{av_foo_free(AVFoo**)} that
|
||||
frees the indirectly supplied object (and its contents, if applicable) and
|
||||
writes @code{NULL} to the supplied pointer, thus eliminating the potential
|
||||
dangling pointer in the caller's memory.
|
||||
|
||||
If you are adding new functions, consider whether it might be desirable to tweak
|
||||
their behavior in the future - you may want to add a flags argument, even though
|
||||
it would be unused initially.
|
||||
|
||||
@subsubheading Documentation
|
||||
All new APIs must be documented as Doxygen-formatted comments above the
|
||||
identifiers you add to the public headers. You should also briefly mention the
|
||||
change in @file{doc/APIchanges}.
|
||||
|
||||
@subsubheading Bump the version
|
||||
Backward-incompatible API or ABI changes require incrementing (bumping) the
|
||||
major version number, as described in @ref{Major version bumps}. Major
|
||||
bumps are significant events that happen on a schedule - so if your change
|
||||
strictly requires one you should add it under @code{#if} preprocesor guards that
|
||||
disable it until the next major bump happens.
|
||||
|
||||
New APIs that can be added without breaking API or ABI compatibility require
|
||||
bumping the minor version number.
|
||||
|
||||
Incrementing the third (micro) version component means a noteworthy binary
|
||||
compatible change (e.g. encoder bug fix that matters for the decoder). The third
|
||||
component always starts at 100 to distinguish FFmpeg from Libav.
|
||||
|
||||
@anchor{Removing interfaces}
|
||||
@subsection Removing interfaces
|
||||
Due to abovementioned compatibility guarantees, removing APIs is an involved
|
||||
process that should only be undertaken with good reason. Typically a deficient,
|
||||
restrictive, or otherwise inadequate API is replaced by a superior one, though
|
||||
it does at times happen that we remove an API without any replacement (e.g. when
|
||||
the feature it provides is deemed not worth the maintenance effort, out of scope
|
||||
of the project, fundamentally flawed, etc.).
|
||||
|
||||
The removal has two steps - first the API is deprecated and scheduled for
|
||||
removal, but remains present and functional. The second step is actually
|
||||
removing the API - this is described in @ref{Major version bumps}.
|
||||
|
||||
To deprecate an API you should signal to our users that they should stop using
|
||||
it. E.g. if you intend to remove struct members or functions, you should mark
|
||||
them with @code{attribute_deprecated}. When this cannot be done, it may be
|
||||
possible to detect the use of the deprecated API at runtime and print a warning
|
||||
(though take care not to print it too often). You should also document the
|
||||
deprecation (and the replacement, if applicable) in the relevant Doxygen
|
||||
documentation block.
|
||||
|
||||
Finally, you should define a deprecation guard along the lines of
|
||||
@code{#define FF_API_<FOO> (LIBAVBAR_VERSION_MAJOR < XX)} (where XX is the major
|
||||
version in which the API will be removed) in @file{libavbar/version_major.h}
|
||||
(@file{version.h} in case of @code{libavutil}). Then wrap all uses of the
|
||||
deprecated API in @code{#if FF_API_<FOO> .... #endif}, so that the code will
|
||||
automatically get disabled once the major version reaches XX. You can also use
|
||||
@code{FF_DISABLE_DEPRECATION_WARNINGS} and @code{FF_ENABLE_DEPRECATION_WARNINGS}
|
||||
to suppress compiler deprecation warnings inside these guards. You should test
|
||||
that the code compiles and works with the guard macro evaluating to both true
|
||||
and false.
|
||||
|
||||
@anchor{Major version bumps}
|
||||
@subsection Major version bumps
|
||||
A major version bump signifies an API and/or ABI compatibility break. To reduce
|
||||
the negative effects on our callers, who are required to adapt their code,
|
||||
backward-incompatible changes during a major bump should be limited to:
|
||||
@itemize @bullet
|
||||
@item
|
||||
Removing previously deprecated APIs.
|
||||
|
||||
@item
|
||||
Performing ABI- but not API-breaking changes, like reordering struct contents.
|
||||
@end itemize
|
||||
@subheading Check untrusted input properly.
|
||||
Never write to unallocated memory, never write over the end of arrays,
|
||||
always check values read from some untrusted source before using them
|
||||
as array index or other risky things.
|
||||
|
||||
@section Documentation/Other
|
||||
@subheading Subscribe to the ffmpeg-devel mailing list.
|
||||
@@ -600,6 +421,35 @@ finding a new maintainer and also don't forget to update the @file{MAINTAINERS}
|
||||
|
||||
We think our rules are not too hard. If you have comments, contact us.
|
||||
|
||||
@chapter Code of conduct
|
||||
|
||||
Be friendly and respectful towards others and third parties.
|
||||
Treat others the way you yourself want to be treated.
|
||||
|
||||
Be considerate. Not everyone shares the same viewpoint and priorities as you do.
|
||||
Different opinions and interpretations help the project.
|
||||
Looking at issues from a different perspective assists development.
|
||||
|
||||
Do not assume malice for things that can be attributed to incompetence. Even if
|
||||
it is malice, it's rarely good to start with that as initial assumption.
|
||||
|
||||
Stay friendly even if someone acts contrarily. Everyone has a bad day
|
||||
once in a while.
|
||||
If you yourself have a bad day or are angry then try to take a break and reply
|
||||
once you are calm and without anger if you have to.
|
||||
|
||||
Try to help other team members and cooperate if you can.
|
||||
|
||||
The goal of software development is to create technical excellence, not for any
|
||||
individual to be better and "win" against the others. Large software projects
|
||||
are only possible and successful through teamwork.
|
||||
|
||||
If someone struggles do not put them down. Give them a helping hand
|
||||
instead and point them in the right direction.
|
||||
|
||||
Finally, keep in mind the immortal words of Bill and Ted,
|
||||
"Be excellent to each other."
|
||||
|
||||
@anchor{Submitting patches}
|
||||
@chapter Submitting patches
|
||||
|
||||
@@ -816,14 +666,16 @@ Lines with similar content should be aligned vertically when doing so
|
||||
improves readability.
|
||||
|
||||
@item
|
||||
Consider adding a regression test for your code. All new modules
|
||||
should be covered by tests. That includes demuxers, muxers, decoders, encoders
|
||||
filters, bitstream filters, parsers. If its not possible to do that, add
|
||||
an explanation why to your patchset, its ok to not test if theres a reason.
|
||||
Consider adding a regression test for your code.
|
||||
|
||||
@item
|
||||
If you added YASM code please check that things still work with --disable-yasm.
|
||||
|
||||
@item
|
||||
Make sure you check the return values of function and return appropriate
|
||||
error codes. Especially memory allocation functions like @code{av_malloc()}
|
||||
are notoriously left unchecked, which is a serious problem.
|
||||
|
||||
@item
|
||||
Test your code with valgrind and or Address Sanitizer to ensure it's free
|
||||
of leaks, out of array accesses, etc.
|
||||
@@ -873,8 +725,6 @@ accordingly].
|
||||
|
||||
@section Adding files to the fate-suite dataset
|
||||
|
||||
If you need a sample uploaded send a mail to samples-request.
|
||||
|
||||
When there is no muxer or encoder available to generate test media for a
|
||||
specific test then the media has to be included in the fate-suite.
|
||||
First please make sure that the sample file is as small as possible to test the
|
||||
|
||||
@@ -789,11 +789,6 @@ about 80-96 kbps/channel
|
||||
@end table
|
||||
|
||||
Default value is 0.
|
||||
|
||||
@item frame_length
|
||||
Set the audio frame length in samples. Default value is the internal
|
||||
default of the library. Refer to the library's documentation for information
|
||||
about supported values.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@@ -864,13 +859,6 @@ Enable the encoder to use ABR when set to 1. The @command{lame}
|
||||
@option{--abr} sets the target bitrate, while this options only
|
||||
tells FFmpeg to use ABR still relies on @option{b} to set bitrate.
|
||||
|
||||
@item copyright (@emph{-c})
|
||||
Set MPEG audio copyright flag when set to 1. The default value is 0
|
||||
(disabled).
|
||||
|
||||
@item original (@emph{-o})
|
||||
Set MPEG audio original flag when set to 1. The default value is 1
|
||||
(enabled).
|
||||
@end table
|
||||
|
||||
@section libopencore-amrnb
|
||||
@@ -977,17 +965,14 @@ Favor improved speech intelligibility.
|
||||
@item audio
|
||||
Favor faithfulness to the input (the default).
|
||||
@item lowdelay
|
||||
Restrict to only the lowest delay modes by disabling voice-optimized
|
||||
modes.
|
||||
Restrict to only the lowest delay modes.
|
||||
@end table
|
||||
|
||||
@item cutoff (N.A.)
|
||||
Set cutoff bandwidth in Hz. The argument must be exactly one of the
|
||||
following: 4000, 6000, 8000, 12000, or 20000, corresponding to
|
||||
narrowband, mediumband, wideband, super wideband, and fullband
|
||||
respectively. The default is 0 (cutoff disabled). Note that libopus
|
||||
forces a wideband cutoff for bitrates < 15 kbps, unless CELT-only
|
||||
(@option{application} set to @samp{lowdelay}) mode is used.
|
||||
respectively. The default is 0 (cutoff disabled).
|
||||
|
||||
@item mapping_family (@emph{mapping_family})
|
||||
Set channel mapping family to be used by the encoder. The default value of -1
|
||||
@@ -2449,20 +2434,6 @@ Quantizer curve compression factor
|
||||
@item refs (@emph{ref})
|
||||
Number of reference frames each P-frame can use. The range is from @var{0-16}.
|
||||
|
||||
@item level (@emph{level})
|
||||
Set the @code{x264_param_t.i_level_idc} value in case the value is
|
||||
positive, it is ignored otherwise.
|
||||
|
||||
This value can be set using the @code{AVCodecContext} API (e.g. by
|
||||
setting the @code{AVCodecContext} value directly), and is specified as
|
||||
an integer mapped on a corresponding level (e.g. the value 31 maps
|
||||
to H.264 level IDC "3.1", as defined in the @code{x264_levels}
|
||||
table). It is ignored when set to a non positive value.
|
||||
|
||||
Alternatively it can be set as a private option, overriding the value
|
||||
set in @code{AVCodecContext}, and in this case must be specified as
|
||||
the level IDC identifier (e.g. "3.1"), as defined by H.264 Annex A.
|
||||
|
||||
@item sc_threshold (@emph{scenecut})
|
||||
Sets the threshold for the scene change detection.
|
||||
|
||||
@@ -2755,10 +2726,6 @@ Only the mpeg2 and h264 decoders provide these. Default is 1 (on).
|
||||
@item udu_sei @var{boolean}
|
||||
Import user data unregistered SEI if available into output. Default is 0 (off).
|
||||
|
||||
@item mb_info @var{boolean}
|
||||
Set mb_info data through AVFrameSideData, only useful when used from the
|
||||
API. Default is 0 (off).
|
||||
|
||||
@item x264-params (N.A.)
|
||||
Override the x264 configuration using a :-separated list of key=value
|
||||
parameters.
|
||||
@@ -2979,24 +2946,27 @@ Place global headers in extradata instead of every keyframe.
|
||||
|
||||
@item trellis
|
||||
|
||||
@item me_quality
|
||||
Set motion estimation quality level. Possible values in decreasing order of
|
||||
@item me_method
|
||||
Set motion estimation method. Possible values in decreasing order of
|
||||
speed and increasing order of quality:
|
||||
|
||||
@table @samp
|
||||
@item 0
|
||||
@item zero
|
||||
Use no motion estimation (default).
|
||||
|
||||
@item 1, 2
|
||||
@item phods
|
||||
@item x1
|
||||
@item log
|
||||
Enable advanced diamond zonal search for 16x16 blocks and half-pixel
|
||||
refinement for 16x16 blocks.
|
||||
refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
|
||||
@samp{phods}.
|
||||
|
||||
@item 3, 4
|
||||
@item epzs
|
||||
Enable all of the things described above, plus advanced diamond zonal
|
||||
search for 8x8 blocks and half-pixel refinement for 8x8 blocks, also
|
||||
enable motion estimation on chroma planes for P and B-frames.
|
||||
search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
|
||||
estimation on chroma planes.
|
||||
|
||||
@item 5, 6
|
||||
@item full
|
||||
Enable all of the things described above, plus extended 16x16 and 8x8
|
||||
blocks search.
|
||||
@end table
|
||||
@@ -3079,20 +3049,6 @@ Video encoders can take input in either of nv12 or yuv420p form
|
||||
(some encoders support both, some support only either - in practice,
|
||||
nv12 is the safer choice, especially among HW encoders).
|
||||
|
||||
@section Microsoft RLE
|
||||
|
||||
Microsoft RLE aka MSRLE encoder.
|
||||
Only 8-bit palette mode supported.
|
||||
Compatible with Windows 3.1 and Windows 95.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item g @var{integer}
|
||||
Keyframe interval.
|
||||
A keyframe is inserted at least every @code{-g} frames, sometimes sooner.
|
||||
@end table
|
||||
|
||||
@section mpeg2
|
||||
|
||||
MPEG-2 video encoder.
|
||||
@@ -3232,8 +3188,8 @@ recommended value) and do not set a size constraint.
|
||||
|
||||
@section QSV Encoders
|
||||
|
||||
The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG,
|
||||
VP9, AV1)
|
||||
The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG
|
||||
and VP9)
|
||||
|
||||
@subsection Ratecontrol Method
|
||||
The ratecontrol method is selected as follows:
|
||||
@@ -3388,7 +3344,7 @@ Supported in h264_qsv.
|
||||
Change these value to reset qsv codec's max/min qp configuration.
|
||||
|
||||
@item @var{low_delay_brc}
|
||||
Supported in h264_qsv, hevc_qsv and av1_qsv.
|
||||
Supported in h264_qsv and hevc_qsv.
|
||||
Change this value to reset qsv codec's low_delay_brc configuration.
|
||||
|
||||
@item @var{framerate}
|
||||
@@ -4009,20 +3965,6 @@ Average variable bitrate.
|
||||
Each encoder also has its own specific options:
|
||||
@table @option
|
||||
|
||||
@item av1_vaapi
|
||||
@option{profile} sets the value of @emph{seq_profile}.
|
||||
@option{tier} sets the value of @emph{seq_tier}.
|
||||
@option{level} sets the value of @emph{seq_level_idx}.
|
||||
|
||||
@table @option
|
||||
@item tiles
|
||||
Set the number of tiles to encode the input video with, as columns x rows.
|
||||
(default is auto, which means use minimal tile column/row number).
|
||||
@item tile_groups
|
||||
Set tile groups number. All the tiles will be distributed as evenly as possible to
|
||||
each tile group. (default is 1).
|
||||
@end table
|
||||
|
||||
@item h264_vaapi
|
||||
@option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s.
|
||||
@option{level} sets the value of @emph{level_idc}.
|
||||
|
||||
@@ -78,9 +78,9 @@ static int output_video_frame(AVFrame *frame)
|
||||
|
||||
/* copy decoded frame to destination buffer:
|
||||
* this is required since rawvideo expects non aligned data */
|
||||
av_image_copy2(video_dst_data, video_dst_linesize,
|
||||
frame->data, frame->linesize,
|
||||
pix_fmt, width, height);
|
||||
av_image_copy(video_dst_data, video_dst_linesize,
|
||||
(const uint8_t **)(frame->data), frame->linesize,
|
||||
pix_fmt, width, height);
|
||||
|
||||
/* write to rawvideo file */
|
||||
fwrite(video_dst_data[0], 1, video_dst_bufsize, video_dst_file);
|
||||
|
||||
@@ -379,27 +379,27 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
|
||||
/**************************************************************/
|
||||
/* video output */
|
||||
|
||||
static AVFrame *alloc_frame(enum AVPixelFormat pix_fmt, int width, int height)
|
||||
static AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height)
|
||||
{
|
||||
AVFrame *frame;
|
||||
AVFrame *picture;
|
||||
int ret;
|
||||
|
||||
frame = av_frame_alloc();
|
||||
if (!frame)
|
||||
picture = av_frame_alloc();
|
||||
if (!picture)
|
||||
return NULL;
|
||||
|
||||
frame->format = pix_fmt;
|
||||
frame->width = width;
|
||||
frame->height = height;
|
||||
picture->format = pix_fmt;
|
||||
picture->width = width;
|
||||
picture->height = height;
|
||||
|
||||
/* allocate the buffers for the frame data */
|
||||
ret = av_frame_get_buffer(frame, 0);
|
||||
ret = av_frame_get_buffer(picture, 0);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Could not allocate frame data.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return frame;
|
||||
return picture;
|
||||
}
|
||||
|
||||
static void open_video(AVFormatContext *oc, const AVCodec *codec,
|
||||
@@ -420,7 +420,7 @@ static void open_video(AVFormatContext *oc, const AVCodec *codec,
|
||||
}
|
||||
|
||||
/* allocate and init a re-usable frame */
|
||||
ost->frame = alloc_frame(c->pix_fmt, c->width, c->height);
|
||||
ost->frame = alloc_picture(c->pix_fmt, c->width, c->height);
|
||||
if (!ost->frame) {
|
||||
fprintf(stderr, "Could not allocate video frame\n");
|
||||
exit(1);
|
||||
@@ -431,9 +431,9 @@ static void open_video(AVFormatContext *oc, const AVCodec *codec,
|
||||
* output format. */
|
||||
ost->tmp_frame = NULL;
|
||||
if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
|
||||
ost->tmp_frame = alloc_frame(AV_PIX_FMT_YUV420P, c->width, c->height);
|
||||
ost->tmp_frame = alloc_picture(AV_PIX_FMT_YUV420P, c->width, c->height);
|
||||
if (!ost->tmp_frame) {
|
||||
fprintf(stderr, "Could not allocate temporary video frame\n");
|
||||
fprintf(stderr, "Could not allocate temporary picture\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ static int dynamic_set_parameter(AVCodecContext *avctx)
|
||||
if (current_setting_number < setting_number &&
|
||||
frame_number == dynamic_setting[current_setting_number].frame_number) {
|
||||
AVDictionaryEntry *e = NULL;
|
||||
ret = str_to_dict(dynamic_setting[current_setting_number++].optstr, &opts);
|
||||
ret = str_to_dict(dynamic_setting[current_setting_number].optstr, &opts);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "The dynamic parameter is wrong\n");
|
||||
goto fail;
|
||||
|
||||
@@ -97,11 +97,6 @@ static int open_input_file(const char *filename)
|
||||
"for stream #%u\n", i);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Inform the decoder about the timebase for the packet timestamps.
|
||||
* This is highly recommended, but not mandatory. */
|
||||
codec_ctx->pkt_timebase = stream->time_base;
|
||||
|
||||
/* Reencode video & audio and remux subtitles etc. */
|
||||
if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO
|
||||
|| codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
@@ -271,7 +266,7 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
|
||||
snprintf(args, sizeof(args),
|
||||
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
|
||||
dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
|
||||
dec_ctx->pkt_timebase.num, dec_ctx->pkt_timebase.den,
|
||||
dec_ctx->time_base.num, dec_ctx->time_base.den,
|
||||
dec_ctx->sample_aspect_ratio.num,
|
||||
dec_ctx->sample_aspect_ratio.den);
|
||||
|
||||
@@ -311,7 +306,7 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
|
||||
av_channel_layout_describe(&dec_ctx->ch_layout, buf, sizeof(buf));
|
||||
snprintf(args, sizeof(args),
|
||||
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=%s",
|
||||
dec_ctx->pkt_timebase.num, dec_ctx->pkt_timebase.den, dec_ctx->sample_rate,
|
||||
dec_ctx->time_base.num, dec_ctx->time_base.den, dec_ctx->sample_rate,
|
||||
av_get_sample_fmt_name(dec_ctx->sample_fmt),
|
||||
buf);
|
||||
ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
|
||||
@@ -441,10 +436,6 @@ static int encode_write_frame(unsigned int stream_index, int flush)
|
||||
/* encode filtered frame */
|
||||
av_packet_unref(enc_pkt);
|
||||
|
||||
if (filt_frame && filt_frame->pts != AV_NOPTS_VALUE)
|
||||
filt_frame->pts = av_rescale_q(filt_frame->pts, filt_frame->time_base,
|
||||
stream->enc_ctx->time_base);
|
||||
|
||||
ret = avcodec_send_frame(stream->enc_ctx, filt_frame);
|
||||
|
||||
if (ret < 0)
|
||||
@@ -499,7 +490,6 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index)
|
||||
break;
|
||||
}
|
||||
|
||||
filter->filtered_frame->time_base = av_buffersink_get_time_base(filter->buffersink_ctx);;
|
||||
filter->filtered_frame->pict_type = AV_PICTURE_TYPE_NONE;
|
||||
ret = encode_write_frame(stream_index, 0);
|
||||
av_frame_unref(filter->filtered_frame);
|
||||
@@ -554,6 +544,9 @@ int main(int argc, char **argv)
|
||||
|
||||
av_log(NULL, AV_LOG_DEBUG, "Going to reencode&filter the frame\n");
|
||||
|
||||
av_packet_rescale_ts(packet,
|
||||
ifmt_ctx->streams[stream_index]->time_base,
|
||||
stream->dec_ctx->time_base);
|
||||
ret = avcodec_send_packet(stream->dec_ctx, packet);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Decoding failed\n");
|
||||
@@ -585,38 +578,11 @@ int main(int argc, char **argv)
|
||||
av_packet_unref(packet);
|
||||
}
|
||||
|
||||
/* flush decoders, filters and encoders */
|
||||
/* flush filters and encoders */
|
||||
for (i = 0; i < ifmt_ctx->nb_streams; i++) {
|
||||
StreamContext *stream;
|
||||
|
||||
/* flush filter */
|
||||
if (!filter_ctx[i].filter_graph)
|
||||
continue;
|
||||
|
||||
stream = &stream_ctx[i];
|
||||
|
||||
av_log(NULL, AV_LOG_INFO, "Flushing stream %u decoder\n", i);
|
||||
|
||||
/* flush decoder */
|
||||
ret = avcodec_send_packet(stream->dec_ctx, NULL);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Flushing decoding failed\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
while (ret >= 0) {
|
||||
ret = avcodec_receive_frame(stream->dec_ctx, stream->dec_frame);
|
||||
if (ret == AVERROR_EOF)
|
||||
break;
|
||||
else if (ret < 0)
|
||||
goto end;
|
||||
|
||||
stream->dec_frame->pts = stream->dec_frame->best_effort_timestamp;
|
||||
ret = filter_encode_write_frame(stream->dec_frame, i);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* flush filter */
|
||||
ret = filter_encode_write_frame(NULL, i);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Flushing filter failed\n");
|
||||
|
||||
@@ -447,17 +447,26 @@ static int init_converted_samples(uint8_t ***converted_input_samples,
|
||||
int error;
|
||||
|
||||
/* Allocate as many pointers as there are audio channels.
|
||||
* Each pointer will point to the audio samples of the corresponding
|
||||
* Each pointer will later point to the audio samples of the corresponding
|
||||
* channels (although it may be NULL for interleaved formats).
|
||||
* Allocate memory for the samples of all channels in one consecutive
|
||||
*/
|
||||
if (!(*converted_input_samples = calloc(output_codec_context->ch_layout.nb_channels,
|
||||
sizeof(**converted_input_samples)))) {
|
||||
fprintf(stderr, "Could not allocate converted input sample pointers\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
/* Allocate memory for the samples of all channels in one consecutive
|
||||
* block for convenience. */
|
||||
if ((error = av_samples_alloc_array_and_samples(converted_input_samples, NULL,
|
||||
if ((error = av_samples_alloc(*converted_input_samples, NULL,
|
||||
output_codec_context->ch_layout.nb_channels,
|
||||
frame_size,
|
||||
output_codec_context->sample_fmt, 0)) < 0) {
|
||||
fprintf(stderr,
|
||||
"Could not allocate converted input samples (error '%s')\n",
|
||||
av_err2str(error));
|
||||
av_freep(&(*converted_input_samples)[0]);
|
||||
free(*converted_input_samples);
|
||||
return error;
|
||||
}
|
||||
return 0;
|
||||
@@ -589,9 +598,10 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (converted_input_samples)
|
||||
if (converted_input_samples) {
|
||||
av_freep(&converted_input_samples[0]);
|
||||
av_freep(&converted_input_samples);
|
||||
free(converted_input_samples);
|
||||
}
|
||||
av_frame_free(&input_frame);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -223,14 +223,6 @@ meaning only while running the regression tests.
|
||||
Specify how many threads to use while running regression tests, it is
|
||||
quite useful to detect thread-related regressions.
|
||||
|
||||
This variable may be set to the string "random", optionally followed by a
|
||||
number, like "random99", This will cause each test to use a random number of
|
||||
threads. If a number is specified, it is used as a maximum number of threads,
|
||||
otherwise 16 is the maximum.
|
||||
|
||||
In case a test fails, the thread count used for it will be written into the
|
||||
errfile.
|
||||
|
||||
@item THREAD_TYPE
|
||||
Specify which threading strategy test, either @samp{slice} or @samp{frame},
|
||||
by default @samp{slice+frame}
|
||||
|
||||
241
doc/ffmpeg.texi
241
doc/ffmpeg.texi
@@ -17,9 +17,9 @@ ffmpeg [@var{global_options}] @{[@var{input_file_options}] -i @file{input_url}@}
|
||||
@chapter Description
|
||||
@c man begin DESCRIPTION
|
||||
|
||||
@command{ffmpeg} is a universal media converter. It can read a wide variety of
|
||||
inputs - including live grabbing/recording devices - filter, and transcode them
|
||||
into a plethora of output formats.
|
||||
@command{ffmpeg} is a very fast video and audio converter that can also grab from
|
||||
a live audio/video source. It can also convert between arbitrary sample
|
||||
rates and resize video on the fly with a high quality polyphase filter.
|
||||
|
||||
@command{ffmpeg} reads from an arbitrary number of input "files" (which can be regular
|
||||
files, pipes, network streams, grabbing devices, etc.), specified by the
|
||||
@@ -49,32 +49,24 @@ Do not mix input and output files -- first specify all input files, then all
|
||||
output files. Also do not mix options which belong to different files. All
|
||||
options apply ONLY to the next input or output file and are reset between files.
|
||||
|
||||
Some simple examples follow.
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Convert an input media file to a different format, by re-encoding media streams:
|
||||
To set the video bitrate of the output file to 64 kbit/s:
|
||||
@example
|
||||
ffmpeg -i input.avi output.mp4
|
||||
ffmpeg -i input.avi -b:v 64k -bufsize 64k output.avi
|
||||
@end example
|
||||
|
||||
@item
|
||||
Set the video bitrate of the output file to 64 kbit/s:
|
||||
To force the frame rate of the output file to 24 fps:
|
||||
@example
|
||||
ffmpeg -i input.avi -b:v 64k -bufsize 64k output.mp4
|
||||
ffmpeg -i input.avi -r 24 output.avi
|
||||
@end example
|
||||
|
||||
@item
|
||||
Force the frame rate of the output file to 24 fps:
|
||||
To force the frame rate of the input file (valid for raw formats only)
|
||||
to 1 fps and the frame rate of the output file to 24 fps:
|
||||
@example
|
||||
ffmpeg -i input.avi -r 24 output.mp4
|
||||
@end example
|
||||
|
||||
@item
|
||||
Force the frame rate of the input file (valid for raw formats only) to 1 fps and
|
||||
the frame rate of the output file to 24 fps:
|
||||
@example
|
||||
ffmpeg -r 1 -i input.m2v -r 24 output.mp4
|
||||
ffmpeg -r 1 -i input.m2v -r 24 output.avi
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@@ -777,7 +769,6 @@ syntax.
|
||||
See the @ref{filter_complex_option,,-filter_complex option} if you
|
||||
want to create filtergraphs with multiple inputs and/or outputs.
|
||||
|
||||
@anchor{filter_script option}
|
||||
@item -filter_script[:@var{stream_specifier}] @var{filename} (@emph{output,per-stream})
|
||||
This option is similar to @option{-filter}, the only difference is that its
|
||||
argument is the name of the file from which a filtergraph description is to be
|
||||
@@ -1023,12 +1014,7 @@ If @var{pix_fmt} is a single @code{+}, ffmpeg selects the same pixel format
|
||||
as the input (or graph output) and automatic conversions are disabled.
|
||||
|
||||
@item -sws_flags @var{flags} (@emph{input/output})
|
||||
Set default flags for the libswscale library. These flags are used by
|
||||
automatically inserted @code{scale} filters and those within simple
|
||||
filtergraphs, if not overridden within the filtergraph definition.
|
||||
|
||||
See the @ref{scaler_options,,ffmpeg-scaler manual,ffmpeg-scaler} for a list
|
||||
of scaler options.
|
||||
Set SwScaler flags.
|
||||
|
||||
@item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream})
|
||||
Rate control override for specific intervals, formatted as "int,int,int"
|
||||
@@ -1039,27 +1025,33 @@ factor if negative.
|
||||
@item -psnr
|
||||
Calculate PSNR of compressed frames. This option is deprecated, pass the
|
||||
PSNR flag to the encoder instead, using @code{-flags +psnr}.
|
||||
|
||||
@item -vstats
|
||||
Dump video coding statistics to @file{vstats_HHMMSS.log}. See the
|
||||
@ref{vstats_file_format,,vstats file format} section for the format description.
|
||||
|
||||
Dump video coding statistics to @file{vstats_HHMMSS.log}.
|
||||
@item -vstats_file @var{file}
|
||||
Dump video coding statistics to @var{file}. See the
|
||||
@ref{vstats_file_format,,vstats file format} section for the format description.
|
||||
|
||||
Dump video coding statistics to @var{file}.
|
||||
@item -vstats_version @var{file}
|
||||
Specify which version of the vstats format to use. Default is @code{2}. See the
|
||||
@ref{vstats_file_format,,vstats file format} section for the format description.
|
||||
Specifies which version of the vstats format to use. Default is 2.
|
||||
|
||||
version = 1 :
|
||||
|
||||
@code{frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s}
|
||||
|
||||
version > 1:
|
||||
|
||||
@code{out= %2d st= %2d frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s}
|
||||
@item -top[:@var{stream_specifier}] @var{n} (@emph{output,per-stream})
|
||||
top=1/bottom=0/auto=-1 field first
|
||||
@item -vtag @var{fourcc/tag} (@emph{output})
|
||||
Force video tag/fourcc. This is an alias for @code{-tag:v}.
|
||||
@item -qphist (@emph{global})
|
||||
Show QP histogram
|
||||
@item -vbsf @var{bitstream_filter}
|
||||
Deprecated see -bsf
|
||||
|
||||
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
|
||||
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
|
||||
@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream})
|
||||
@item -force_key_frames[:@var{stream_specifier}] source_no_drop (@emph{output,per-stream})
|
||||
|
||||
@var{force_key_frames} can take arguments of the following form:
|
||||
|
||||
@@ -1120,6 +1112,10 @@ starting from second 13:
|
||||
@item source
|
||||
If the argument is @code{source}, ffmpeg will force a key frame if
|
||||
the current frame being encoded is marked as a key frame in its source.
|
||||
|
||||
@item source_no_drop
|
||||
If the argument is @code{source_no_drop}, ffmpeg will force a key frame if
|
||||
the current frame being encoded is marked as a key frame in its source.
|
||||
In cases where this particular source frame has to be dropped,
|
||||
enforce the next available frame to become a key frame instead.
|
||||
|
||||
@@ -1167,10 +1163,9 @@ Choose the first device and use the primary device context.
|
||||
@var{device} is the number of the Direct3D 11 display adapter.
|
||||
|
||||
@item vaapi
|
||||
@var{device} is either an X11 display name, a DRM render node or a DirectX adapter index.
|
||||
@var{device} is either an X11 display name or a DRM render node.
|
||||
If not specified, it will attempt to open the default X11 display (@emph{$DISPLAY})
|
||||
and then the first DRM render node (@emph{/dev/dri/renderD128}), or the default
|
||||
DirectX adapter on Windows.
|
||||
and then the first DRM render node (@emph{/dev/dri/renderD128}).
|
||||
|
||||
@item vdpau
|
||||
@var{device} is an X11 display name.
|
||||
@@ -1706,9 +1701,6 @@ it may cause packet loss.
|
||||
It is useful for when flow speed of output packets is important, such as live streaming.
|
||||
@item -re (@emph{input})
|
||||
Read input at native frame rate. This is equivalent to setting @code{-readrate 1}.
|
||||
@item -readrate_initial_burst @var{seconds}
|
||||
Set an initial read burst time, in seconds, after which @option{-re/-readrate}
|
||||
will be enforced.
|
||||
@item -vsync @var{parameter} (@emph{global})
|
||||
@itemx -fps_mode[:@var{stream_specifier}] @var{parameter} (@emph{output,per-stream})
|
||||
Set video sync method / framerate mode. vsync is applied to all output video streams
|
||||
@@ -1750,6 +1742,12 @@ The default is -1.1. One possible usecase is to avoid framedrops in case
|
||||
of noisy timestamps or to increase frame drop precision in case of exact
|
||||
timestamps.
|
||||
|
||||
@item -adrift_threshold @var{time}
|
||||
Set the minimum difference between timestamps and audio data (in seconds) to trigger
|
||||
adding/dropping samples to make it match the timestamps. This option effectively is
|
||||
a threshold to select between hard (add/drop) and soft (squeeze/stretch) compensation.
|
||||
@code{-async} must be set to a positive value.
|
||||
|
||||
@item -apad @var{parameters} (@emph{output,per-stream})
|
||||
Pad the output audio stream(s). This is the same as applying @code{-af apad}.
|
||||
Argument is a string of filter parameters composed the same as with the @code{apad} filter.
|
||||
@@ -1796,7 +1794,8 @@ Try to make the choice automatically, in order to generate a sane output.
|
||||
Default value is -1.
|
||||
|
||||
@item -enc_time_base[:@var{stream_specifier}] @var{timebase} (@emph{output,per-stream})
|
||||
Set the encoder timebase. @var{timebase} can assume one of the following values:
|
||||
Set the encoder timebase. @var{timebase} is a floating point number,
|
||||
and can assume one of the following values:
|
||||
|
||||
@table @option
|
||||
@item 0
|
||||
@@ -1804,17 +1803,16 @@ Assign a default value according to the media type.
|
||||
|
||||
For video - use 1/framerate, for audio - use 1/samplerate.
|
||||
|
||||
@item demux
|
||||
Use the timebase from the demuxer.
|
||||
@item -1
|
||||
Use the input stream timebase when possible.
|
||||
|
||||
@item filter
|
||||
Use the timebase from the filtergraph.
|
||||
If an input stream is not available, the default timebase will be used.
|
||||
|
||||
@item a positive number
|
||||
@item >0
|
||||
Use the provided number as the timebase.
|
||||
|
||||
This field can be provided as a ratio of two integers (e.g. 1:24, 1:48000)
|
||||
or as a decimal number (e.g. 0.04166, 2.0833e-5)
|
||||
or as a floating point number (e.g. 0.04166, 2.0833e-5)
|
||||
@end table
|
||||
|
||||
Default value is 0.
|
||||
@@ -1839,38 +1837,12 @@ results, but increase memory use and latency.
|
||||
|
||||
The default value is 10 seconds.
|
||||
|
||||
@item -dts_delta_threshold @var{threshold}
|
||||
Timestamp discontinuity delta threshold, expressed as a decimal number
|
||||
of seconds.
|
||||
|
||||
The timestamp discontinuity correction enabled by this option is only
|
||||
applied to input formats accepting timestamp discontinuity (for which
|
||||
the @code{AV_FMT_DISCONT} flag is enabled), e.g. MPEG-TS and HLS, and
|
||||
is automatically disabled when employing the @code{-copy_ts} option
|
||||
(unless wrapping is detected).
|
||||
|
||||
If a timestamp discontinuity is detected whose absolute value is
|
||||
greater than @var{threshold}, ffmpeg will remove the discontinuity by
|
||||
decreasing/increasing the current DTS and PTS by the corresponding
|
||||
delta value.
|
||||
|
||||
The default value is 10.
|
||||
|
||||
@item -dts_error_threshold @var{threshold}
|
||||
Timestamp error delta threshold, expressed as a decimal number of
|
||||
seconds.
|
||||
|
||||
The timestamp correction enabled by this option is only applied to
|
||||
input formats not accepting timestamp discontinuity (for which the
|
||||
@code{AV_FMT_DISCONT} flag is not enabled).
|
||||
|
||||
If a timestamp discontinuity is detected whose absolute value is
|
||||
greater than @var{threshold}, ffmpeg will drop the PTS/DTS timestamp
|
||||
value.
|
||||
|
||||
The default value is @code{3600*30} (30 hours), which is arbitrarily
|
||||
picked and quite conservative.
|
||||
|
||||
@item -dts_delta_threshold
|
||||
Timestamp discontinuity delta threshold.
|
||||
@item -dts_error_threshold @var{seconds}
|
||||
Timestamp error delta threshold. This threshold use to discard crazy/damaged
|
||||
timestamps and the default is 30 hours which is arbitrarily picked and quite
|
||||
conservative.
|
||||
@item -muxdelay @var{seconds} (@emph{output})
|
||||
Set the maximum demux-decode delay.
|
||||
@item -muxpreload @var{seconds} (@emph{output})
|
||||
@@ -1888,19 +1860,9 @@ ffmpeg -i inurl -streamid 0:33 -streamid 1:36 out.ts
|
||||
@end example
|
||||
|
||||
@item -bsf[:@var{stream_specifier}] @var{bitstream_filters} (@emph{output,per-stream})
|
||||
Apply bitstream filters to matching streams.
|
||||
|
||||
@var{bitstream_filters} is a comma-separated list of bitstream filter
|
||||
specifications. The specified bitstream filters are applied to coded packets in
|
||||
the order they are written in. Each bitstream filter specification is of the
|
||||
form
|
||||
@example
|
||||
@var{filter}[=@var{optname0}=@var{optval0}:@var{optname1}=@var{optval1}:...]
|
||||
@end example
|
||||
Any of the ',=:' characters that are to be a part of an option value need to be
|
||||
escaped with a backslash.
|
||||
|
||||
Use the @code{-bsfs} option to get the list of bitstream filters.
|
||||
Set bitstream filters for matching streams. @var{bitstream_filters} is
|
||||
a comma-separated list of bitstream filters. Use the @code{-bsfs} option
|
||||
to get the list of bitstream filters.
|
||||
@example
|
||||
ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264
|
||||
@end example
|
||||
@@ -1991,7 +1953,6 @@ The default is the number of available CPUs.
|
||||
Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
|
||||
outputs. Equivalent to @option{-filter_complex}.
|
||||
|
||||
@anchor{filter_complex_script option}
|
||||
@item -filter_complex_script @var{filename} (@emph{global})
|
||||
This option is similar to @option{-filter_complex}, the only difference is that
|
||||
its argument is the name of the file from which a complex filtergraph
|
||||
@@ -2100,7 +2061,6 @@ encoder/muxer, it does not change the stream to conform to this value. Setting
|
||||
values that do not match the stream properties may result in encoding failures
|
||||
or invalid output files.
|
||||
|
||||
@anchor{stats_enc_options}
|
||||
@item -stats_enc_pre[:@var{stream_specifier}] @var{path} (@emph{output,per-stream})
|
||||
@item -stats_enc_post[:@var{stream_specifier}] @var{path} (@emph{output,per-stream})
|
||||
@item -stats_mux_pre[:@var{stream_specifier}] @var{path} (@emph{output,per-stream})
|
||||
@@ -2148,8 +2108,8 @@ Input frame number. Index of the input frame (i.e. output by a decoder) that
|
||||
corresponds to this output frame or packet. -1 if unavailable.
|
||||
|
||||
@item tb
|
||||
Timebase in which this frame/packet's timestamps are expressed, as a rational
|
||||
number @var{num/den}. Note that encoder and muxer may use different timebases.
|
||||
Encoder timebase, as a rational number @var{num/den}. Note that this may be
|
||||
different from the timebase used by the muxer.
|
||||
|
||||
@item tbi
|
||||
Timebase for @var{ptsi}, as a rational number @var{num/den}. Available when
|
||||
@@ -2172,39 +2132,31 @@ Presentation time of the frame or packet, as a decimal number. Equal to
|
||||
Presentation time of the input frame (see @var{ni}), as a decimal number. Equal
|
||||
to @var{ptsi} multiplied by @var{tbi}. Printed as inf when not available.
|
||||
|
||||
@item dts (@emph{packet})
|
||||
@item dts
|
||||
Decoding timestamp of the packet, as an integer. Should be multiplied by the
|
||||
timebase to compute presentation time.
|
||||
timebase to compute presentation time. Post-encoding only.
|
||||
|
||||
@item dt (@emph{packet})
|
||||
@item dt
|
||||
Decoding time of the frame or packet, as a decimal number. Equal to
|
||||
@var{dts} multiplied by @var{tb}.
|
||||
|
||||
@item sn (@emph{frame,audio})
|
||||
Number of audio samples sent to the encoder so far.
|
||||
@item sn
|
||||
Number of audio samples sent to the encoder so far. Audio and pre-encoding only.
|
||||
|
||||
@item samp (@emph{frame,audio})
|
||||
Number of audio samples in the frame.
|
||||
@item samp
|
||||
Number of audio samples in the frame. Audio and pre-encoding only.
|
||||
|
||||
@item size (@emph{packet})
|
||||
Size of the encoded packet in bytes.
|
||||
@item size
|
||||
Size of the encoded packet in bytes. Post-encoding only.
|
||||
|
||||
@item br (@emph{packet})
|
||||
@item br
|
||||
Current bitrate in bits per second. Post-encoding only.
|
||||
|
||||
@item abr (@emph{packet})
|
||||
@item abr
|
||||
Average bitrate for the whole stream so far, in bits per second, -1 if it cannot
|
||||
be determined at this point. Post-encoding only.
|
||||
@end table
|
||||
|
||||
Directives tagged with @emph{packet} may only be used with
|
||||
@option{-stats_enc_post_fmt} and @option{-stats_mux_pre_fmt}.
|
||||
|
||||
Directives tagged with @emph{frame} may only be used with
|
||||
@option{-stats_enc_pre_fmt}.
|
||||
|
||||
Directives tagged with @emph{audio} may only be used with audio streams.
|
||||
|
||||
The default format strings are:
|
||||
@table @option
|
||||
@item pre-encoding
|
||||
@@ -2276,63 +2228,6 @@ search for the file @file{libvpx-1080p.avpreset}.
|
||||
If no such file is found, then ffmpeg will search for a file named
|
||||
@var{arg}.avpreset in the same directories.
|
||||
|
||||
@anchor{vstats_file_format}
|
||||
@section vstats file format
|
||||
The @code{-vstats} and @code{-vstats_file} options enable generation of a file
|
||||
containing statistics about the generated video outputs.
|
||||
|
||||
The @code{-vstats_version} option controls the format version of the generated
|
||||
file.
|
||||
|
||||
With version @code{1} the format is:
|
||||
@example
|
||||
frame= @var{FRAME} q= @var{FRAME_QUALITY} PSNR= @var{PSNR} f_size= @var{FRAME_SIZE} s_size= @var{STREAM_SIZE}kB time= @var{TIMESTAMP} br= @var{BITRATE}kbits/s avg_br= @var{AVERAGE_BITRATE}kbits/s
|
||||
@end example
|
||||
|
||||
With version @code{2} the format is:
|
||||
@example
|
||||
out= @var{OUT_FILE_INDEX} st= @var{OUT_FILE_STREAM_INDEX} frame= @var{FRAME_NUMBER} q= @var{FRAME_QUALITY}f PSNR= @var{PSNR} f_size= @var{FRAME_SIZE} s_size= @var{STREAM_SIZE}kB time= @var{TIMESTAMP} br= @var{BITRATE}kbits/s avg_br= @var{AVERAGE_BITRATE}kbits/s
|
||||
@end example
|
||||
|
||||
The value corresponding to each key is described below:
|
||||
@table @option
|
||||
@item avg_br
|
||||
average bitrate expressed in Kbits/s
|
||||
|
||||
@item br
|
||||
bitrate expressed in Kbits/s
|
||||
|
||||
@item frame
|
||||
number of encoded frame
|
||||
|
||||
@item out
|
||||
out file index
|
||||
|
||||
@item PSNR
|
||||
Peak Signal to Noise Ratio
|
||||
|
||||
@item q
|
||||
quality of the frame
|
||||
|
||||
@item f_size
|
||||
encoded packet size expressed as number of bytes
|
||||
|
||||
@item s_size
|
||||
stream size expressed in KiB
|
||||
|
||||
@item st
|
||||
out file stream index
|
||||
|
||||
@item time
|
||||
time of the packet
|
||||
|
||||
@item type
|
||||
picture type
|
||||
@end table
|
||||
|
||||
See also the @ref{stats_enc_options,,-stats_enc options} for an alternative way
|
||||
to show encoding statistics.
|
||||
|
||||
@c man end OPTIONS
|
||||
|
||||
@chapter Examples
|
||||
@@ -2596,7 +2491,7 @@ ffmpeg-devices(1), ffmpeg-protocols(1), ffmpeg-filters(1)
|
||||
@ignore
|
||||
|
||||
@setfilename ffmpeg
|
||||
@settitle ffmpeg media converter
|
||||
@settitle ffmpeg video converter
|
||||
|
||||
@end ignore
|
||||
|
||||
|
||||
@@ -196,18 +196,6 @@ will produce a thread pool with this many threads available for parallel
|
||||
processing. The default is 0 which means that the thread count will be
|
||||
determined by the number of available CPUs.
|
||||
|
||||
@item -enable_vulkan
|
||||
Use vulkan renderer rather than SDL builtin renderer. Depends on libplacebo.
|
||||
|
||||
@item -vulkan_params
|
||||
|
||||
Vulkan configuration using a list of @var{key}=@var{value} pairs separated by
|
||||
":".
|
||||
|
||||
@item -hwaccel
|
||||
Use HW accelerated decoding. Enable this option will enable vulkan renderer
|
||||
automatically.
|
||||
|
||||
@end table
|
||||
|
||||
@section While playing
|
||||
|
||||
@@ -41,7 +41,7 @@ ffprobe will show it.
|
||||
|
||||
ffprobe output is designed to be easily parsable by a textual filter,
|
||||
and consists of one or more sections of a form defined by the selected
|
||||
writer, which is specified by the @option{output_format} option.
|
||||
writer, which is specified by the @option{print_format} option.
|
||||
|
||||
Sections may contain other nested sections, and are identified by a
|
||||
name (which may be shared by other sections), and an unique
|
||||
@@ -83,7 +83,7 @@ Use sexagesimal format HH:MM:SS.MICROSECONDS for time values.
|
||||
Prettify the format of the displayed values, it corresponds to the
|
||||
options "-unit -prefix -byte_binary_prefix -sexagesimal".
|
||||
|
||||
@item -output_format, -of, -print_format @var{writer_name}[=@var{writer_options}]
|
||||
@item -of, -print_format @var{writer_name}[=@var{writer_options}]
|
||||
Set the output printing format.
|
||||
|
||||
@var{writer_name} specifies the name of the writer, and
|
||||
@@ -91,7 +91,7 @@ Set the output printing format.
|
||||
|
||||
For example for printing the output in JSON format, specify:
|
||||
@example
|
||||
-output_format json
|
||||
-print_format json
|
||||
@end example
|
||||
|
||||
For more details on the available output printing formats, see the
|
||||
|
||||
702
doc/ffprobe.xsd
702
doc/ffprobe.xsd
@@ -1,409 +1,389 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.ffmpeg.org/schema/ffprobe"
|
||||
xmlns:ffprobe="http://www.ffmpeg.org/schema/ffprobe">
|
||||
targetNamespace="http://www.ffmpeg.org/schema/ffprobe"
|
||||
xmlns:ffprobe="http://www.ffmpeg.org/schema/ffprobe">
|
||||
|
||||
<xsd:element name="ffprobe" type="ffprobe:ffprobeType"/>
|
||||
<xsd:element name="ffprobe" type="ffprobe:ffprobeType"/>
|
||||
|
||||
<xsd:complexType name="ffprobeType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="program_version" type="ffprobe:programVersionType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="library_versions" type="ffprobe:libraryVersionsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="pixel_formats" type="ffprobe:pixelFormatsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="packets" type="ffprobe:packetsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="frames" type="ffprobe:framesType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="packets_and_frames" type="ffprobe:packetsAndFramesType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="programs" type="ffprobe:programsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="chapters" type="ffprobe:chaptersType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="format" type="ffprobe:formatType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="error" type="ffprobe:errorType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="ffprobeType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="program_version" type="ffprobe:programVersionType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="library_versions" type="ffprobe:libraryVersionsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="pixel_formats" type="ffprobe:pixelFormatsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="packets" type="ffprobe:packetsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="frames" type="ffprobe:framesType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="packets_and_frames" type="ffprobe:packetsAndFramesType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="programs" type="ffprobe:programsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="chapters" type="ffprobe:chaptersType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="format" type="ffprobe:formatType" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="error" type="ffprobe:errorType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="packetsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="packet" type="ffprobe:packetType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="packetsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="packet" type="ffprobe:packetType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="framesType">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="frame" type="ffprobe:frameType"/>
|
||||
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="framesType">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="frame" type="ffprobe:frameType"/>
|
||||
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="packetsAndFramesType">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="packet" type="ffprobe:packetType"/>
|
||||
<xsd:element name="frame" type="ffprobe:frameType"/>
|
||||
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="packetsAndFramesType">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="packet" type="ffprobe:packetType"/>
|
||||
<xsd:element name="frame" type="ffprobe:frameType"/>
|
||||
<xsd:element name="subtitle" type="ffprobe:subtitleType"/>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="tagsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="packetType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:complexType name="packetType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="codec_type" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="stream_index" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="pts" type="xsd:long" />
|
||||
<xsd:attribute name="pts_time" type="xsd:float" />
|
||||
<xsd:attribute name="dts" type="xsd:long" />
|
||||
<xsd:attribute name="dts_time" type="xsd:float" />
|
||||
<xsd:attribute name="duration" type="xsd:long" />
|
||||
<xsd:attribute name="duration_time" type="xsd:float" />
|
||||
<xsd:attribute name="size" type="xsd:long" use="required" />
|
||||
<xsd:attribute name="pos" type="xsd:long" />
|
||||
<xsd:attribute name="flags" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="data" type="xsd:string" />
|
||||
<xsd:attribute name="data_hash" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:attribute name="codec_type" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="stream_index" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="pts" type="xsd:long" />
|
||||
<xsd:attribute name="pts_time" type="xsd:float" />
|
||||
<xsd:attribute name="dts" type="xsd:long" />
|
||||
<xsd:attribute name="dts_time" type="xsd:float" />
|
||||
<xsd:attribute name="duration" type="xsd:long" />
|
||||
<xsd:attribute name="duration_time" type="xsd:float" />
|
||||
<xsd:attribute name="size" type="xsd:long" use="required" />
|
||||
<xsd:attribute name="pos" type="xsd:long" />
|
||||
<xsd:attribute name="flags" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="data" type="xsd:string" />
|
||||
<xsd:attribute name="data_hash" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="packetSideDataListType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="side_data" type="ffprobe:packetSideDataType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="packetSideDataType">
|
||||
<xsd:attribute name="side_data_type" type="xsd:string"/>
|
||||
<xsd:attribute name="side_data_size" type="xsd:int" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="packetSideDataListType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="side_data" type="ffprobe:packetSideDataType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="frameType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element name="logs" type="ffprobe:logsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="side_data_list" type="ffprobe:frameSideDataListType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:complexType name="packetSideDataType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="side_datum" type="ffprobe:packetSideDatumType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="media_type" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="stream_index" type="xsd:int" />
|
||||
<xsd:attribute name="key_frame" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="pts" type="xsd:long" />
|
||||
<xsd:attribute name="pts_time" type="xsd:float"/>
|
||||
<xsd:attribute name="pkt_dts" type="xsd:long" />
|
||||
<xsd:attribute name="pkt_dts_time" type="xsd:float"/>
|
||||
<xsd:attribute name="best_effort_timestamp" type="xsd:long" />
|
||||
<xsd:attribute name="best_effort_timestamp_time" type="xsd:float" />
|
||||
<xsd:attribute name="pkt_duration" type="xsd:long" />
|
||||
<xsd:attribute name="pkt_duration_time" type="xsd:float"/>
|
||||
<xsd:attribute name="duration" type="xsd:long" />
|
||||
<xsd:attribute name="duration_time" type="xsd:float"/>
|
||||
<xsd:attribute name="pkt_pos" type="xsd:long" />
|
||||
<xsd:attribute name="pkt_size" type="xsd:int" />
|
||||
|
||||
<xsd:attribute name="type" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
<!-- audio attributes -->
|
||||
<xsd:attribute name="sample_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="nb_samples" type="xsd:long" />
|
||||
<xsd:attribute name="channels" type="xsd:int" />
|
||||
<xsd:attribute name="channel_layout" type="xsd:string"/>
|
||||
|
||||
<xsd:complexType name="packetSideDatumType">
|
||||
<xsd:attribute name="key" type="xsd:string"/>
|
||||
<xsd:attribute name="value" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
<!-- video attributes -->
|
||||
<xsd:attribute name="width" type="xsd:long" />
|
||||
<xsd:attribute name="height" type="xsd:long" />
|
||||
<xsd:attribute name="pix_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
|
||||
<xsd:attribute name="pict_type" type="xsd:string"/>
|
||||
<xsd:attribute name="coded_picture_number" type="xsd:long" />
|
||||
<xsd:attribute name="display_picture_number" type="xsd:long" />
|
||||
<xsd:attribute name="interlaced_frame" type="xsd:int" />
|
||||
<xsd:attribute name="top_field_first" type="xsd:int" />
|
||||
<xsd:attribute name="repeat_pict" type="xsd:int" />
|
||||
<xsd:attribute name="color_range" type="xsd:string"/>
|
||||
<xsd:attribute name="color_space" type="xsd:string"/>
|
||||
<xsd:attribute name="color_primaries" type="xsd:string"/>
|
||||
<xsd:attribute name="color_transfer" type="xsd:string"/>
|
||||
<xsd:attribute name="chroma_location" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="frameType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="logs" type="ffprobe:logsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="side_data_list" type="ffprobe:frameSideDataListType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:complexType name="logsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="log" type="ffprobe:logType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="logType">
|
||||
<xsd:attribute name="context" type="xsd:string"/>
|
||||
<xsd:attribute name="level" type="xsd:int" />
|
||||
<xsd:attribute name="category" type="xsd:int" />
|
||||
<xsd:attribute name="parent_context" type="xsd:string"/>
|
||||
<xsd:attribute name="parent_category" type="xsd:int" />
|
||||
<xsd:attribute name="message" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:attribute name="media_type" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="stream_index" type="xsd:int" />
|
||||
<xsd:attribute name="key_frame" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="pts" type="xsd:long" />
|
||||
<xsd:attribute name="pts_time" type="xsd:float"/>
|
||||
<xsd:attribute name="pkt_dts" type="xsd:long" />
|
||||
<xsd:attribute name="pkt_dts_time" type="xsd:float"/>
|
||||
<xsd:attribute name="best_effort_timestamp" type="xsd:long" />
|
||||
<xsd:attribute name="best_effort_timestamp_time" type="xsd:float" />
|
||||
<xsd:attribute name="pkt_duration" type="xsd:long" />
|
||||
<xsd:attribute name="pkt_duration_time" type="xsd:float"/>
|
||||
<xsd:attribute name="duration" type="xsd:long" />
|
||||
<xsd:attribute name="duration_time" type="xsd:float"/>
|
||||
<xsd:attribute name="pkt_pos" type="xsd:long" />
|
||||
<xsd:attribute name="pkt_size" type="xsd:int" />
|
||||
<xsd:complexType name="frameSideDataListType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="side_data" type="ffprobe:frameSideDataType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="frameSideDataType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="timecodes" type="ffprobe:frameSideDataTimecodeList" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
|
||||
<!-- audio attributes -->
|
||||
<xsd:attribute name="sample_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="nb_samples" type="xsd:long" />
|
||||
<xsd:attribute name="channels" type="xsd:int" />
|
||||
<xsd:attribute name="channel_layout" type="xsd:string"/>
|
||||
<xsd:attribute name="side_data_type" type="xsd:string"/>
|
||||
<xsd:attribute name="side_data_size" type="xsd:int" />
|
||||
<xsd:attribute name="timecode" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<!-- video attributes -->
|
||||
<xsd:attribute name="width" type="xsd:long" />
|
||||
<xsd:attribute name="height" type="xsd:long" />
|
||||
<xsd:attribute name="crop_top" type="xsd:long" />
|
||||
<xsd:attribute name="crop_bottom" type="xsd:long" />
|
||||
<xsd:attribute name="crop_left" type="xsd:long" />
|
||||
<xsd:attribute name="crop_right" type="xsd:long" />
|
||||
<xsd:attribute name="pix_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
|
||||
<xsd:attribute name="pict_type" type="xsd:string"/>
|
||||
<xsd:attribute name="coded_picture_number" type="xsd:long" />
|
||||
<xsd:attribute name="display_picture_number" type="xsd:long" />
|
||||
<xsd:attribute name="interlaced_frame" type="xsd:int" />
|
||||
<xsd:attribute name="top_field_first" type="xsd:int" />
|
||||
<xsd:attribute name="repeat_pict" type="xsd:int" />
|
||||
<xsd:attribute name="color_range" type="xsd:string"/>
|
||||
<xsd:attribute name="color_space" type="xsd:string"/>
|
||||
<xsd:attribute name="color_primaries" type="xsd:string"/>
|
||||
<xsd:attribute name="color_transfer" type="xsd:string"/>
|
||||
<xsd:attribute name="chroma_location" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="frameSideDataTimecodeList">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="timecode" type="ffprobe:frameSideDataTimecodeType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="logsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="log" type="ffprobe:logType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="logType">
|
||||
<xsd:attribute name="context" type="xsd:string"/>
|
||||
<xsd:attribute name="level" type="xsd:int" />
|
||||
<xsd:attribute name="category" type="xsd:int" />
|
||||
<xsd:attribute name="parent_context" type="xsd:string"/>
|
||||
<xsd:attribute name="parent_category" type="xsd:int" />
|
||||
<xsd:attribute name="message" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="frameSideDataTimecodeType">
|
||||
<xsd:attribute name="value" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="frameSideDataListType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="side_data" type="ffprobe:frameSideDataType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="frameSideDataType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="timecodes" type="ffprobe:frameSideDataTimecodeList" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:complexType name="subtitleType">
|
||||
<xsd:attribute name="media_type" type="xsd:string" fixed="subtitle" use="required"/>
|
||||
<xsd:attribute name="pts" type="xsd:long" />
|
||||
<xsd:attribute name="pts_time" type="xsd:float"/>
|
||||
<xsd:attribute name="format" type="xsd:int" />
|
||||
<xsd:attribute name="start_display_time" type="xsd:int" />
|
||||
<xsd:attribute name="end_display_time" type="xsd:int" />
|
||||
<xsd:attribute name="num_rects" type="xsd:int" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:attribute name="side_data_type" type="xsd:string"/>
|
||||
<xsd:attribute name="side_data_size" type="xsd:int" />
|
||||
<xsd:attribute name="timecode" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="streamsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="stream" type="ffprobe:streamType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="frameSideDataTimecodeList">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="timecode" type="ffprobe:frameSideDataTimecodeType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="programsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="program" type="ffprobe:programType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="frameSideDataTimecodeType">
|
||||
<xsd:attribute name="value" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="streamDispositionType">
|
||||
<xsd:attribute name="default" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="dub" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="original" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="comment" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="lyrics" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="karaoke" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="forced" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="hearing_impaired" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="visual_impaired" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="clean_effects" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="attached_pic" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="timed_thumbnails" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="captions" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="descriptions" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="metadata" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="dependent" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="still_image" type="xsd:int" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="subtitleType">
|
||||
<xsd:attribute name="media_type" type="xsd:string" fixed="subtitle" use="required"/>
|
||||
<xsd:attribute name="pts" type="xsd:long" />
|
||||
<xsd:attribute name="pts_time" type="xsd:float"/>
|
||||
<xsd:attribute name="format" type="xsd:int" />
|
||||
<xsd:attribute name="start_display_time" type="xsd:int" />
|
||||
<xsd:attribute name="end_display_time" type="xsd:int" />
|
||||
<xsd:attribute name="num_rects" type="xsd:int" />
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="streamType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="disposition" type="ffprobe:streamDispositionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:complexType name="streamsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="stream" type="ffprobe:streamType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="index" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="codec_name" type="xsd:string" />
|
||||
<xsd:attribute name="codec_long_name" type="xsd:string" />
|
||||
<xsd:attribute name="profile" type="xsd:string" />
|
||||
<xsd:attribute name="codec_type" type="xsd:string" />
|
||||
<xsd:attribute name="codec_tag" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="codec_tag_string" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="extradata" type="xsd:string" />
|
||||
<xsd:attribute name="extradata_size" type="xsd:int" />
|
||||
<xsd:attribute name="extradata_hash" type="xsd:string" />
|
||||
|
||||
<xsd:complexType name="programsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="program" type="ffprobe:programType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<!-- video attributes -->
|
||||
<xsd:attribute name="width" type="xsd:int"/>
|
||||
<xsd:attribute name="height" type="xsd:int"/>
|
||||
<xsd:attribute name="coded_width" type="xsd:int"/>
|
||||
<xsd:attribute name="coded_height" type="xsd:int"/>
|
||||
<xsd:attribute name="closed_captions" type="xsd:boolean"/>
|
||||
<xsd:attribute name="film_grain" type="xsd:boolean"/>
|
||||
<xsd:attribute name="has_b_frames" type="xsd:int"/>
|
||||
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
|
||||
<xsd:attribute name="display_aspect_ratio" type="xsd:string"/>
|
||||
<xsd:attribute name="pix_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="level" type="xsd:int"/>
|
||||
<xsd:attribute name="color_range" type="xsd:string"/>
|
||||
<xsd:attribute name="color_space" type="xsd:string"/>
|
||||
<xsd:attribute name="color_transfer" type="xsd:string"/>
|
||||
<xsd:attribute name="color_primaries" type="xsd:string"/>
|
||||
<xsd:attribute name="chroma_location" type="xsd:string"/>
|
||||
<xsd:attribute name="field_order" type="xsd:string"/>
|
||||
<xsd:attribute name="refs" type="xsd:int"/>
|
||||
|
||||
<xsd:complexType name="streamDispositionType">
|
||||
<xsd:attribute name="default" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="dub" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="original" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="comment" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="lyrics" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="karaoke" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="forced" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="hearing_impaired" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="visual_impaired" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="clean_effects" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="attached_pic" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="timed_thumbnails" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="non_diegetic" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="captions" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="descriptions" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="metadata" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="dependent" type="xsd:int" use="required" />
|
||||
<xsd:attribute name="still_image" type="xsd:int" use="required" />
|
||||
</xsd:complexType>
|
||||
<!-- audio attributes -->
|
||||
<xsd:attribute name="sample_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="sample_rate" type="xsd:int"/>
|
||||
<xsd:attribute name="channels" type="xsd:int"/>
|
||||
<xsd:attribute name="channel_layout" type="xsd:string"/>
|
||||
<xsd:attribute name="bits_per_sample" type="xsd:int"/>
|
||||
<xsd:attribute name="initial_padding" type="xsd:int"/>
|
||||
|
||||
<xsd:complexType name="streamType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="disposition" type="ffprobe:streamDispositionType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="side_data_list" type="ffprobe:packetSideDataListType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:string"/>
|
||||
<xsd:attribute name="r_frame_rate" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="avg_frame_rate" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="start_pts" type="xsd:long"/>
|
||||
<xsd:attribute name="start_time" type="xsd:float"/>
|
||||
<xsd:attribute name="duration_ts" type="xsd:long"/>
|
||||
<xsd:attribute name="duration" type="xsd:float"/>
|
||||
<xsd:attribute name="bit_rate" type="xsd:int"/>
|
||||
<xsd:attribute name="max_bit_rate" type="xsd:int"/>
|
||||
<xsd:attribute name="bits_per_raw_sample" type="xsd:int"/>
|
||||
<xsd:attribute name="nb_frames" type="xsd:int"/>
|
||||
<xsd:attribute name="nb_read_frames" type="xsd:int"/>
|
||||
<xsd:attribute name="nb_read_packets" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:attribute name="index" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="codec_name" type="xsd:string" />
|
||||
<xsd:attribute name="codec_long_name" type="xsd:string" />
|
||||
<xsd:attribute name="profile" type="xsd:string" />
|
||||
<xsd:attribute name="codec_type" type="xsd:string" />
|
||||
<xsd:attribute name="codec_tag" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="codec_tag_string" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="extradata" type="xsd:string" />
|
||||
<xsd:attribute name="extradata_size" type="xsd:int" />
|
||||
<xsd:attribute name="extradata_hash" type="xsd:string" />
|
||||
<xsd:complexType name="programType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
|
||||
<!-- video attributes -->
|
||||
<xsd:attribute name="width" type="xsd:int"/>
|
||||
<xsd:attribute name="height" type="xsd:int"/>
|
||||
<xsd:attribute name="coded_width" type="xsd:int"/>
|
||||
<xsd:attribute name="coded_height" type="xsd:int"/>
|
||||
<xsd:attribute name="closed_captions" type="xsd:boolean"/>
|
||||
<xsd:attribute name="film_grain" type="xsd:boolean"/>
|
||||
<xsd:attribute name="has_b_frames" type="xsd:int"/>
|
||||
<xsd:attribute name="sample_aspect_ratio" type="xsd:string"/>
|
||||
<xsd:attribute name="display_aspect_ratio" type="xsd:string"/>
|
||||
<xsd:attribute name="pix_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="level" type="xsd:int"/>
|
||||
<xsd:attribute name="color_range" type="xsd:string"/>
|
||||
<xsd:attribute name="color_space" type="xsd:string"/>
|
||||
<xsd:attribute name="color_transfer" type="xsd:string"/>
|
||||
<xsd:attribute name="color_primaries" type="xsd:string"/>
|
||||
<xsd:attribute name="chroma_location" type="xsd:string"/>
|
||||
<xsd:attribute name="field_order" type="xsd:string"/>
|
||||
<xsd:attribute name="refs" type="xsd:int"/>
|
||||
<xsd:attribute name="program_id" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="program_num" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="pmt_pid" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="pcr_pid" type="xsd:int" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<!-- audio attributes -->
|
||||
<xsd:attribute name="sample_fmt" type="xsd:string"/>
|
||||
<xsd:attribute name="sample_rate" type="xsd:int"/>
|
||||
<xsd:attribute name="channels" type="xsd:int"/>
|
||||
<xsd:attribute name="channel_layout" type="xsd:string"/>
|
||||
<xsd:attribute name="bits_per_sample" type="xsd:int"/>
|
||||
<xsd:attribute name="initial_padding" type="xsd:int"/>
|
||||
<xsd:complexType name="formatType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:attribute name="id" type="xsd:string"/>
|
||||
<xsd:attribute name="r_frame_rate" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="avg_frame_rate" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="start_pts" type="xsd:long"/>
|
||||
<xsd:attribute name="start_time" type="xsd:float"/>
|
||||
<xsd:attribute name="duration_ts" type="xsd:long"/>
|
||||
<xsd:attribute name="duration" type="xsd:float"/>
|
||||
<xsd:attribute name="bit_rate" type="xsd:int"/>
|
||||
<xsd:attribute name="max_bit_rate" type="xsd:int"/>
|
||||
<xsd:attribute name="bits_per_raw_sample" type="xsd:int"/>
|
||||
<xsd:attribute name="nb_frames" type="xsd:int"/>
|
||||
<xsd:attribute name="nb_read_frames" type="xsd:int"/>
|
||||
<xsd:attribute name="nb_read_packets" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="filename" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="nb_programs" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="format_name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="format_long_name" type="xsd:string"/>
|
||||
<xsd:attribute name="start_time" type="xsd:float"/>
|
||||
<xsd:attribute name="duration" type="xsd:float"/>
|
||||
<xsd:attribute name="size" type="xsd:long"/>
|
||||
<xsd:attribute name="bit_rate" type="xsd:long"/>
|
||||
<xsd:attribute name="probe_score" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="programType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:complexType name="tagType">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="value" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:attribute name="program_id" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="program_num" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="pmt_pid" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="pcr_pid" type="xsd:int" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="errorType">
|
||||
<xsd:attribute name="code" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="string" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="formatType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:complexType name="programVersionType">
|
||||
<xsd:attribute name="version" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="copyright" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="build_date" type="xsd:string"/>
|
||||
<xsd:attribute name="build_time" type="xsd:string"/>
|
||||
<xsd:attribute name="compiler_ident" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="configuration" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:attribute name="filename" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="nb_streams" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="nb_programs" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="format_name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="format_long_name" type="xsd:string"/>
|
||||
<xsd:attribute name="start_time" type="xsd:float"/>
|
||||
<xsd:attribute name="duration" type="xsd:float"/>
|
||||
<xsd:attribute name="size" type="xsd:long"/>
|
||||
<xsd:attribute name="bit_rate" type="xsd:long"/>
|
||||
<xsd:attribute name="probe_score" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="chaptersType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="chapter" type="ffprobe:chapterType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="tagType">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="value" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="chapterType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:complexType name="errorType">
|
||||
<xsd:attribute name="code" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="string" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="id" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="start" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="start_time" type="xsd:float"/>
|
||||
<xsd:attribute name="end" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="end_time" type="xsd:float" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="programVersionType">
|
||||
<xsd:attribute name="version" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="copyright" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="build_date" type="xsd:string"/>
|
||||
<xsd:attribute name="build_time" type="xsd:string"/>
|
||||
<xsd:attribute name="compiler_ident" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="configuration" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="libraryVersionType">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="major" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="minor" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="micro" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="version" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="ident" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="chaptersType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="chapter" type="ffprobe:chapterType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="libraryVersionsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="library_version" type="ffprobe:libraryVersionType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="chapterType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="tags" type="ffprobe:tagsType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:complexType name="pixelFormatFlagsType">
|
||||
<xsd:attribute name="big_endian" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="palette" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="bitstream" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="hwaccel" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="planar" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="rgb" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="alpha" type="xsd:int" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:attribute name="id" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="time_base" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="start" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="start_time" type="xsd:float"/>
|
||||
<xsd:attribute name="end" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="end_time" type="xsd:float" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="pixelFormatComponentType">
|
||||
<xsd:attribute name="index" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="bit_depth" type="xsd:int" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="libraryVersionType">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="major" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="minor" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="micro" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="version" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="ident" type="xsd:string" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="pixelFormatComponentsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="component" type="ffprobe:pixelFormatComponentType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="libraryVersionsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="library_version" type="ffprobe:libraryVersionType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="pixelFormatType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="flags" type="ffprobe:pixelFormatFlagsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="components" type="ffprobe:pixelFormatComponentsType" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:complexType name="pixelFormatFlagsType">
|
||||
<xsd:attribute name="big_endian" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="palette" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="bitstream" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="hwaccel" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="planar" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="rgb" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="alpha" type="xsd:int" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="nb_components" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="log2_chroma_w" type="xsd:int"/>
|
||||
<xsd:attribute name="log2_chroma_h" type="xsd:int"/>
|
||||
<xsd:attribute name="bits_per_pixel" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="pixelFormatComponentType">
|
||||
<xsd:attribute name="index" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="bit_depth" type="xsd:int" use="required"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="pixelFormatComponentsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="component" type="ffprobe:pixelFormatComponentType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="pixelFormatType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="flags" type="ffprobe:pixelFormatFlagsType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="components" type="ffprobe:pixelFormatComponentsType" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="nb_components" type="xsd:int" use="required"/>
|
||||
<xsd:attribute name="log2_chroma_w" type="xsd:int"/>
|
||||
<xsd:attribute name="log2_chroma_h" type="xsd:int"/>
|
||||
<xsd:attribute name="bits_per_pixel" type="xsd:int"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="pixelFormatsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="pixel_format" type="ffprobe:pixelFormatType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="pixelFormatsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="pixel_format" type="ffprobe:pixelFormatType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
|
||||
1691
doc/filters.texi
1691
doc/filters.texi
File diff suppressed because it is too large
Load Diff
@@ -615,7 +615,6 @@ library:
|
||||
@item raw video @tab X @tab X
|
||||
@item raw id RoQ @tab X @tab
|
||||
@item raw OBU @tab X @tab X
|
||||
@item raw OSQ @tab @tab X
|
||||
@item raw SBC @tab X @tab X
|
||||
@item raw Shorten @tab @tab X
|
||||
@item raw TAK @tab @tab X
|
||||
@@ -997,7 +996,6 @@ following image formats are supported:
|
||||
@item Lagarith @tab @tab X
|
||||
@item LCL (LossLess Codec Library) MSZH @tab @tab X
|
||||
@item LCL (LossLess Codec Library) ZLIB @tab E @tab E
|
||||
@item LEAD MCMP @tab @tab X
|
||||
@item LOCO @tab @tab X
|
||||
@item LucasArts SANM/Smush @tab @tab X
|
||||
@tab Used in LucasArts games / SMUSH animations.
|
||||
@@ -1008,7 +1006,7 @@ following image formats are supported:
|
||||
@tab Also known as Microsoft Screen 3.
|
||||
@item Microsoft Expression Encoder Screen @tab @tab X
|
||||
@tab Also known as Microsoft Titanium Screen 2.
|
||||
@item Microsoft RLE @tab X @tab X
|
||||
@item Microsoft RLE @tab @tab X
|
||||
@item Microsoft Screen 1 @tab @tab X
|
||||
@tab Also known as Windows Media Video V7 Screen.
|
||||
@item Microsoft Screen 2 @tab @tab X
|
||||
@@ -1068,8 +1066,6 @@ following image formats are supported:
|
||||
@item RealVideo 4.0 @tab @tab X
|
||||
@item Renderware TXD (TeXture Dictionary) @tab @tab X
|
||||
@tab Texture dictionaries used by the Renderware Engine.
|
||||
@item RivaTuner Video @tab @tab X
|
||||
@tab fourcc: 'RTV1'
|
||||
@item RL2 video @tab @tab X
|
||||
@tab used in some games by Entertainment Software Partners
|
||||
@item ScreenPressor @tab @tab X
|
||||
@@ -1106,8 +1102,6 @@ following image formats are supported:
|
||||
@item v408 QuickTime uncompressed 4:4:4:4 @tab X @tab X
|
||||
@item v410 QuickTime uncompressed 4:4:4 10-bit @tab X @tab X
|
||||
@item VBLE Lossless Codec @tab @tab X
|
||||
@item vMix Video @tab @tab X
|
||||
@tab fourcc: 'VMX1'
|
||||
@item VMware Screen Codec / VMware Video @tab @tab X
|
||||
@tab Codec used in videos captured by VMware.
|
||||
@item Westwood Studios VQA (Vector Quantized Animation) video @tab @tab X
|
||||
@@ -1300,7 +1294,6 @@ following image formats are supported:
|
||||
@item On2 AVC (Audio for Video Codec) @tab @tab X
|
||||
@item Opus @tab E @tab X
|
||||
@tab encoding supported through external library libopus
|
||||
@item OSQ (Original Sound Quality) @tab @tab X
|
||||
@item PCM A-law @tab X @tab X
|
||||
@item PCM mu-law @tab X @tab X
|
||||
@item PCM Archimedes VIDC @tab X @tab X
|
||||
|
||||
@@ -991,8 +991,9 @@ This input device reads data from the open output pads of a libavfilter
|
||||
filtergraph.
|
||||
|
||||
For each filtergraph open output, the input device will create a
|
||||
corresponding stream which is mapped to the generated output.
|
||||
The filtergraph is specified through the option @option{graph}.
|
||||
corresponding stream which is mapped to the generated output. Currently
|
||||
only video data is supported. The filtergraph is specified through the
|
||||
option @option{graph}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ recommended.
|
||||
Avoid sending the same message to multiple mailing lists.
|
||||
|
||||
@item
|
||||
Please follow our @url{https://ffmpeg.org/community.html#Code-of-conduct, Code of Conduct}.
|
||||
Please follow our @url{https://ffmpeg.org/developer.html#Code-of-conduct, Code of Conduct}.
|
||||
@end itemize
|
||||
|
||||
@chapter Help
|
||||
|
||||
@@ -48,6 +48,11 @@ Files that have MIPS copyright notice in them:
|
||||
float_dsp_mips.c
|
||||
libm_mips.h
|
||||
softfloat_tables.h
|
||||
* libavcodec/
|
||||
fft_fixed_32.c
|
||||
fft_init_table.c
|
||||
fft_table.h
|
||||
mdct_fixed_32.c
|
||||
* libavcodec/mips/
|
||||
aacdec_fixed.c
|
||||
aacsbr_fixed.c
|
||||
@@ -65,6 +70,9 @@ Files that have MIPS copyright notice in them:
|
||||
compute_antialias_float.h
|
||||
lsp_mips.h
|
||||
dsputil_mips.c
|
||||
fft_mips.c
|
||||
fft_table.h
|
||||
fft_init_table.c
|
||||
fmtconvert_mips.c
|
||||
iirfilter_mips.c
|
||||
mpegaudiodsp_mips_fixed.c
|
||||
|
||||
@@ -55,7 +55,8 @@ speed gain at this point but it should work.
|
||||
|
||||
If there are inter-frame dependencies, so the codec calls
|
||||
ff_thread_report/await_progress(), set FF_CODEC_CAP_ALLOCATE_PROGRESS in
|
||||
FFCodec.caps_internal and use ff_thread_get_buffer() to allocate frames.
|
||||
AVCodec.caps_internal and use ff_thread_get_buffer() to allocate frames. The
|
||||
frames must then be freed with ff_thread_release_buffer().
|
||||
Otherwise decode directly into the user-supplied frames.
|
||||
|
||||
Call ff_thread_report_progress() after some part of the current picture has decoded.
|
||||
|
||||
100
doc/muxers.texi
100
doc/muxers.texi
@@ -1325,7 +1325,7 @@ Use persistent HTTP connections. Applicable only for HTTP output.
|
||||
@item timeout
|
||||
Set timeout for socket I/O operations. Applicable only for HTTP output.
|
||||
|
||||
@item ignore_io_errors
|
||||
@item -ignore_io_errors
|
||||
Ignore IO errors during open, write and delete. Useful for long-duration runs with network output.
|
||||
|
||||
@item headers
|
||||
@@ -1468,7 +1468,7 @@ ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S.jpg"
|
||||
|
||||
You can set the file name with current frame's PTS:
|
||||
@example
|
||||
ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg
|
||||
ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg"
|
||||
@end example
|
||||
|
||||
A more complex example is to publish contents of your desktop directly to a
|
||||
@@ -1630,10 +1630,8 @@ MOV/MP4/ISMV (Smooth Streaming) muxer.
|
||||
The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4
|
||||
file has all the metadata about all packets stored in one location
|
||||
(written at the end of the file, it can be moved to the start for
|
||||
better playback by adding @code{+faststart} to the @code{-movflags}, or
|
||||
using the @command{qt-faststart} tool).
|
||||
|
||||
A fragmented
|
||||
better playback by adding @var{faststart} to the @var{movflags}, or
|
||||
using the @command{qt-faststart} tool). A fragmented
|
||||
file consists of a number of fragments, where packets and metadata
|
||||
about these packets are stored together. Writing a fragmented
|
||||
file has the advantage that the file is decodable even if the
|
||||
@@ -1643,34 +1641,40 @@ very long files (since writing normal MOV/MP4 files stores info about
|
||||
every single packet in memory until the file is closed). The downside
|
||||
is that it is less compatible with other applications.
|
||||
|
||||
Fragmentation is enabled by setting one of the options that define
|
||||
how to cut the file into fragments: @code{-frag_duration}, @code{-frag_size},
|
||||
@code{-min_frag_duration}, @code{-movflags +frag_keyframe} and
|
||||
@code{-movflags +frag_custom}. If more than one condition is specified,
|
||||
fragments are cut when one of the specified conditions is fulfilled. The
|
||||
exception to this is @code{-min_frag_duration}, which has to be fulfilled for
|
||||
any of the other conditions to apply.
|
||||
|
||||
@subsection Options
|
||||
|
||||
Fragmentation is enabled by setting one of the AVOptions that define
|
||||
how to cut the file into fragments:
|
||||
|
||||
@table @option
|
||||
@item frag_duration @var{duration}
|
||||
Create fragments that are @var{duration} microseconds long.
|
||||
@item frag_size @var{size}
|
||||
Create fragments that contain up to @var{size} bytes of payload data.
|
||||
@item min_frag_duration @var{duration}
|
||||
Don't create fragments that are shorter than @var{duration} microseconds long.
|
||||
@item movflags @var{flags}
|
||||
Set various muxing switches. The following flags can be used:
|
||||
@table @samp
|
||||
@item frag_keyframe
|
||||
@item -moov_size @var{bytes}
|
||||
Reserves space for the moov atom at the beginning of the file instead of placing the
|
||||
moov atom at the end. If the space reserved is insufficient, muxing will fail.
|
||||
@item -movflags frag_keyframe
|
||||
Start a new fragment at each video keyframe.
|
||||
@item frag_custom
|
||||
@item -frag_duration @var{duration}
|
||||
Create fragments that are @var{duration} microseconds long.
|
||||
@item -frag_size @var{size}
|
||||
Create fragments that contain up to @var{size} bytes of payload data.
|
||||
@item -movflags frag_custom
|
||||
Allow the caller to manually choose when to cut fragments, by
|
||||
calling @code{av_write_frame(ctx, NULL)} to write a fragment with
|
||||
the packets written so far. (This is only useful with other
|
||||
applications integrating libavformat, not from @command{ffmpeg}.)
|
||||
@item empty_moov
|
||||
@item -min_frag_duration @var{duration}
|
||||
Don't create fragments that are shorter than @var{duration} microseconds long.
|
||||
@end table
|
||||
|
||||
If more than one condition is specified, fragments are cut when
|
||||
one of the specified conditions is fulfilled. The exception to this is
|
||||
@code{-min_frag_duration}, which has to be fulfilled for any of the other
|
||||
conditions to apply.
|
||||
|
||||
Additionally, the way the output file is written can be adjusted
|
||||
through a few other options:
|
||||
|
||||
@table @option
|
||||
@item -movflags empty_moov
|
||||
Write an initial moov atom directly at the start of the file, without
|
||||
describing any samples in it. Generally, an mdat/moov pair is written
|
||||
at the start of the file, as a normal MOV/MP4 file, containing only
|
||||
@@ -1679,40 +1683,43 @@ mdat atom, and the moov atom only describes the tracks but has
|
||||
a zero duration.
|
||||
|
||||
This option is implicitly set when writing ismv (Smooth Streaming) files.
|
||||
@item separate_moof
|
||||
@item -movflags separate_moof
|
||||
Write a separate moof (movie fragment) atom for each track. Normally,
|
||||
packets for all tracks are written in a moof atom (which is slightly
|
||||
more efficient), but with this option set, the muxer writes one moof/mdat
|
||||
pair for each track, making it easier to separate tracks.
|
||||
|
||||
This option is implicitly set when writing ismv (Smooth Streaming) files.
|
||||
@item skip_sidx
|
||||
@item -movflags skip_sidx
|
||||
Skip writing of sidx atom. When bitrate overhead due to sidx atom is high,
|
||||
this option could be used for cases where sidx atom is not mandatory.
|
||||
When global_sidx flag is enabled, this option will be ignored.
|
||||
@item faststart
|
||||
@item -movflags faststart
|
||||
Run a second pass moving the index (moov atom) to the beginning of the file.
|
||||
This operation can take a while, and will not work in various situations such
|
||||
as fragmented output, thus it is not enabled by default.
|
||||
@item rtphint
|
||||
@item -movflags rtphint
|
||||
Add RTP hinting tracks to the output file.
|
||||
@item disable_chpl
|
||||
@item -movflags disable_chpl
|
||||
Disable Nero chapter markers (chpl atom). Normally, both Nero chapters
|
||||
and a QuickTime chapter track are written to the file. With this option
|
||||
set, only the QuickTime chapter track will be written. Nero chapters can
|
||||
cause failures when the file is reprocessed with certain tagging programs, like
|
||||
mp3Tag 2.61a and iTunes 11.3, most likely other versions are affected as well.
|
||||
@item omit_tfhd_offset
|
||||
@item -movflags omit_tfhd_offset
|
||||
Do not write any absolute base_data_offset in tfhd atoms. This avoids
|
||||
tying fragments to absolute byte positions in the file/streams.
|
||||
@item default_base_moof
|
||||
@item -movflags default_base_moof
|
||||
Similarly to the omit_tfhd_offset, this flag avoids writing the
|
||||
absolute base_data_offset field in tfhd atoms, but does so by using
|
||||
the new default-base-is-moof flag instead. This flag is new from
|
||||
14496-12:2012. This may make the fragments easier to parse in certain
|
||||
circumstances (avoiding basing track fragment location calculations
|
||||
on the implicit end of the previous track fragment).
|
||||
@item negative_cts_offsets
|
||||
@item -write_tmcd
|
||||
Specify @code{on} to force writing a timecode track, @code{off} to disable it
|
||||
and @code{auto} to write a timecode track only for mov and mp4 output (default).
|
||||
@item -movflags negative_cts_offsets
|
||||
Enables utilization of version 1 of the CTTS box, in which the CTS offsets can
|
||||
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
|
||||
@@ -1720,24 +1727,15 @@ B-frames. Additionally, eases conformance with the DASH-IF interoperability
|
||||
guidelines.
|
||||
|
||||
This option is implicitly set when writing ismv (Smooth Streaming) files.
|
||||
@end table
|
||||
|
||||
@item moov_size @var{bytes}
|
||||
Reserves space for the moov atom at the beginning of the file instead of placing the
|
||||
moov atom at the end. If the space reserved is insufficient, muxing will fail.
|
||||
|
||||
@item write_tmcd
|
||||
Specify @code{on} to force writing a timecode track, @code{off} to disable it
|
||||
and @code{auto} to write a timecode track only for mov and mp4 output (default).
|
||||
|
||||
@item write_btrt @var{bool}
|
||||
@item -write_btrt @var{bool}
|
||||
Force or disable writing bitrate box inside stsd box of a track.
|
||||
The box contains decoding buffer size (in bytes), maximum bitrate and
|
||||
average bitrate for the track. The box will be skipped if none of these values
|
||||
can be computed.
|
||||
Default is @code{-1} or @code{auto}, which will write the box only in MP4 mode.
|
||||
|
||||
@item write_prft
|
||||
@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
|
||||
@@ -1748,15 +1746,15 @@ 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}.
|
||||
|
||||
@item empty_hdlr_name @var{bool}
|
||||
@item -empty_hdlr_name @var{bool}
|
||||
Enable to skip writing the name inside a @code{hdlr} box.
|
||||
Default is @code{false}.
|
||||
|
||||
@item movie_timescale @var{scale}
|
||||
@item -movie_timescale @var{scale}
|
||||
Set the timescale written in the movie header box (@code{mvhd}).
|
||||
Range is 1 to INT_MAX. Default is 1000.
|
||||
|
||||
@item video_track_timescale @var{scale}
|
||||
@item -video_track_timescale @var{scale}
|
||||
Set the timescale used for video tracks. Range is 0 to INT_MAX.
|
||||
If set to @code{0}, the timescale is automatically set based on
|
||||
the native stream time base. Default is 0.
|
||||
@@ -2122,12 +2120,6 @@ DTS Coherent Acoustics (DCA) audio.
|
||||
|
||||
Dolby Digital Plus, also known as Enhanced AC-3, audio.
|
||||
|
||||
@subsection evc
|
||||
|
||||
MPEG-5 Essential Video Coding (EVC) / EVC / MPEG-5 Part 1 EVC video.
|
||||
|
||||
Extensions: evc
|
||||
|
||||
@subsection g722
|
||||
|
||||
ITU-T G.722 audio.
|
||||
|
||||
@@ -235,11 +235,6 @@ Enable SMPTE Level A mode on the used output.
|
||||
Must be @samp{unset}, @samp{true} or @samp{false}.
|
||||
Defaults to @option{unset}.
|
||||
|
||||
@item vanc_queue_size
|
||||
Sets maximum output buffer size in bytes for VANC data. If the buffering reaches this value,
|
||||
outgoing VANC data will be dropped.
|
||||
Defaults to @samp{1048576}.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@@ -426,18 +421,13 @@ For more information about SDL, check:
|
||||
|
||||
@table @option
|
||||
|
||||
@item window_borderless
|
||||
Set SDL window border off.
|
||||
Default value is 0 (enable window border).
|
||||
@item window_title
|
||||
Set the SDL window title, if not specified default to the filename
|
||||
specified for the output device.
|
||||
|
||||
@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).
|
||||
|
||||
@item window_fullscreen
|
||||
Set fullscreen mode when non-zero value is provided.
|
||||
Default value is zero.
|
||||
@item icon_title
|
||||
Set the name of the iconified SDL window, if not specified it is set
|
||||
to the same value of @var{window_title}.
|
||||
|
||||
@item window_size
|
||||
Set the SDL window size, can be a string of the form
|
||||
@@ -445,13 +435,18 @@ 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_title
|
||||
Set the SDL window title, if not specified default to the filename
|
||||
specified for the output device.
|
||||
|
||||
@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
|
||||
|
||||
@@ -92,6 +92,9 @@ For information about compiling FFmpeg on OS/2 see
|
||||
|
||||
@chapter Windows
|
||||
|
||||
To get help and instructions for building FFmpeg under Windows, check out
|
||||
the FFmpeg Windows Help Forum at @url{http://ffmpeg.zeranoe.com/forum/}.
|
||||
|
||||
@section Native Windows compilation using MinGW or MinGW-w64
|
||||
|
||||
FFmpeg can be built to run natively on Windows using the MinGW-w64
|
||||
|
||||
@@ -896,13 +896,6 @@ be named, by prefixing the type with 'N' and specifying the name before
|
||||
the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
|
||||
times to construct arbitrary AMF sequences.
|
||||
|
||||
@item rtmp_enhanced_codecs
|
||||
Specify the list of codecs the client advertises to support in an
|
||||
enhanced RTMP stream. This option should be set to a comma separated
|
||||
list of fourcc values, like @code{hvc1,av01,vp09} for multiple codecs
|
||||
or @code{hvc1} for only one codec. The specified list will be presented
|
||||
in the "fourCcLive" property of the Connect Command Message.
|
||||
|
||||
@item rtmp_flashver
|
||||
Version of the Flash plugin used to run the SWF player. The default
|
||||
is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
|
||||
@@ -1889,12 +1882,6 @@ The list of supported options follows.
|
||||
Listen for an incoming connection. 0 disables listen, 1 enables listen in
|
||||
single client mode, 2 enables listen in multi-client mode. Default value is 0.
|
||||
|
||||
@item local_addr=@var{addr}
|
||||
Local IP address of a network interface used for tcp socket connect.
|
||||
|
||||
@item local_port=@var{port}
|
||||
Local port used for tcp socket connect.
|
||||
|
||||
@item timeout=@var{microseconds}
|
||||
Set raise error timeout, expressed in microseconds.
|
||||
|
||||
|
||||
@@ -695,8 +695,6 @@ FL+FR+FC+LFE+SL+SR
|
||||
FL+FR+FC+BC+SL+SR
|
||||
@item 6.0(front)
|
||||
FL+FR+FLC+FRC+SL+SR
|
||||
@item 3.1.2
|
||||
FL+FR+FC+LFE+TFL+TFR
|
||||
@item hexagonal
|
||||
FL+FR+FC+BL+BR+BC
|
||||
@item 6.1
|
||||
@@ -715,22 +713,12 @@ FL+FR+FC+LFE+BL+BR+SL+SR
|
||||
FL+FR+FC+LFE+BL+BR+FLC+FRC
|
||||
@item 7.1(wide-side)
|
||||
FL+FR+FC+LFE+FLC+FRC+SL+SR
|
||||
@item 5.1.2
|
||||
@item 7.1(top)
|
||||
FL+FR+FC+LFE+BL+BR+TFL+TFR
|
||||
@item octagonal
|
||||
FL+FR+FC+BL+BR+BC+SL+SR
|
||||
@item cube
|
||||
FL+FR+BL+BR+TFL+TFR+TBL+TBR
|
||||
@item 5.1.4
|
||||
FL+FR+FC+LFE+BL+BR+TFL+TFR+TBL+TBR
|
||||
@item 7.1.2
|
||||
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR
|
||||
@item 7.1.4
|
||||
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR+TBL+TBR
|
||||
@item 7.2.3
|
||||
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR+TBC+LFE2
|
||||
@item 9.1.4
|
||||
FL+FR+FC+LFE+BL+BR+FLC+FRC+SL+SR+TFL+TFR+TBL+TBR
|
||||
@item hexadecagonal
|
||||
FL+FR+FC+BL+BR+BC+SL+SR+WL+WR+TBL+TBR+TBC+TFC+TFL+TFR
|
||||
@item downmix
|
||||
|
||||
@@ -130,7 +130,7 @@ $(BIN2CEXE): ffbuild/bin2c_host.o
|
||||
ifdef CONFIG_PTX_COMPRESSION
|
||||
%.ptx.gz: TAG = GZIP
|
||||
%.ptx.gz: %.ptx
|
||||
$(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
|
||||
$(M)gzip -c9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
|
||||
|
||||
%.ptx.c: %.ptx.gz $(BIN2CEXE)
|
||||
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
|
||||
@@ -10,9 +10,7 @@ ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
|
||||
ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
|
||||
|
||||
OBJS-ffmpeg += \
|
||||
fftools/ffmpeg_dec.o \
|
||||
fftools/ffmpeg_demux.o \
|
||||
fftools/ffmpeg_enc.o \
|
||||
fftools/ffmpeg_filter.o \
|
||||
fftools/ffmpeg_hw.o \
|
||||
fftools/ffmpeg_mux.o \
|
||||
@@ -22,8 +20,6 @@ OBJS-ffmpeg += \
|
||||
fftools/sync_queue.o \
|
||||
fftools/thread_queue.o \
|
||||
|
||||
OBJS-ffplay += fftools/ffplay_renderer.o
|
||||
|
||||
define DOFFTOOL
|
||||
OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes)
|
||||
ifdef HAVE_GNU_WINDRES
|
||||
|
||||
@@ -83,8 +83,29 @@ void init_dynload(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
int parse_number(const char *context, const char *numstr, int type,
|
||||
double min, double max, double *dst)
|
||||
static void (*program_exit)(int ret);
|
||||
|
||||
void register_exit(void (*cb)(int ret))
|
||||
{
|
||||
program_exit = cb;
|
||||
}
|
||||
|
||||
void report_and_exit(int ret)
|
||||
{
|
||||
av_log(NULL, AV_LOG_FATAL, "%s\n", av_err2str(ret));
|
||||
exit_program(AVUNERROR(ret));
|
||||
}
|
||||
|
||||
void exit_program(int ret)
|
||||
{
|
||||
if (program_exit)
|
||||
program_exit(ret);
|
||||
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
double parse_number_or_die(const char *context, const char *numstr, int type,
|
||||
double min, double max)
|
||||
{
|
||||
char *tail;
|
||||
const char *error;
|
||||
@@ -97,13 +118,23 @@ int parse_number(const char *context, const char *numstr, int type,
|
||||
error = "Expected int64 for %s but found %s\n";
|
||||
else if (type == OPT_INT && (int)d != d)
|
||||
error = "Expected int for %s but found %s\n";
|
||||
else {
|
||||
*dst = d;
|
||||
return 0;
|
||||
}
|
||||
|
||||
else
|
||||
return d;
|
||||
av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t parse_time_or_die(const char *context, const char *timestr,
|
||||
int is_duration)
|
||||
{
|
||||
int64_t us;
|
||||
if (av_parse_time(&us, timestr, is_duration) < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid %s specification for %s: %s\n",
|
||||
is_duration ? "duration" : "date", context, timestr);
|
||||
exit_program(1);
|
||||
}
|
||||
return us;
|
||||
}
|
||||
|
||||
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
|
||||
@@ -231,8 +262,6 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
|
||||
void *dst = po->flags & (OPT_OFFSET | OPT_SPEC) ?
|
||||
(uint8_t *)optctx + po->u.off : po->u.dst_ptr;
|
||||
int *dstcount;
|
||||
double num;
|
||||
int ret;
|
||||
|
||||
if (po->flags & OPT_SPEC) {
|
||||
SpecifierOpt **so = dst;
|
||||
@@ -240,10 +269,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
|
||||
char *str;
|
||||
|
||||
dstcount = (int *)(so + 1);
|
||||
ret = grow_array((void**)so, sizeof(**so), dstcount, *dstcount + 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1);
|
||||
str = av_strdup(p ? p + 1 : "");
|
||||
if (!str)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -259,36 +285,15 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
|
||||
return AVERROR(ENOMEM);
|
||||
*(char **)dst = str;
|
||||
} else if (po->flags & OPT_BOOL || po->flags & OPT_INT) {
|
||||
ret = parse_number(opt, arg, OPT_INT64, INT_MIN, INT_MAX, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*(int *)dst = num;
|
||||
*(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
|
||||
} else if (po->flags & OPT_INT64) {
|
||||
ret = parse_number(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*(int64_t *)dst = num;
|
||||
*(int64_t *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
|
||||
} else if (po->flags & OPT_TIME) {
|
||||
ret = av_parse_time(dst, arg, 1);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid duration for option %s: %s\n",
|
||||
opt, arg);
|
||||
return ret;
|
||||
}
|
||||
*(int64_t *)dst = parse_time_or_die(opt, arg, 1);
|
||||
} else if (po->flags & OPT_FLOAT) {
|
||||
ret = parse_number(opt, arg, OPT_FLOAT, -INFINITY, INFINITY, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*(float *)dst = num;
|
||||
*(float *)dst = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
|
||||
} else if (po->flags & OPT_DOUBLE) {
|
||||
ret = parse_number(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*(double *)dst = num;
|
||||
*(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY);
|
||||
} else if (po->u.func_arg) {
|
||||
int ret = po->u.func_arg(optctx, opt, arg);
|
||||
if (ret < 0) {
|
||||
@@ -299,7 +304,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
|
||||
}
|
||||
}
|
||||
if (po->flags & OPT_EXIT)
|
||||
return AVERROR_EXIT;
|
||||
exit_program(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -343,8 +348,8 @@ int parse_option(void *optctx, const char *opt, const char *arg,
|
||||
return !!(po->flags & HAS_ARG);
|
||||
}
|
||||
|
||||
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
|
||||
int (*parse_arg_function)(void *, const char*))
|
||||
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
|
||||
void (*parse_arg_function)(void *, const char*))
|
||||
{
|
||||
const char *opt;
|
||||
int optindex, handleoptions = 1, ret;
|
||||
@@ -365,18 +370,13 @@ int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
|
||||
opt++;
|
||||
|
||||
if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0)
|
||||
return ret;
|
||||
exit_program(1);
|
||||
optindex += ret;
|
||||
} else {
|
||||
if (parse_arg_function) {
|
||||
ret = parse_arg_function(optctx, opt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (parse_arg_function)
|
||||
parse_arg_function(optctx, opt);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_optgroup(void *optctx, OptionGroup *g)
|
||||
@@ -605,17 +605,13 @@ static int match_group_separator(const OptionGroupDef *groups, int nb_groups,
|
||||
* @param group_idx which group definition should this group belong to
|
||||
* @param arg argument of the group delimiting option
|
||||
*/
|
||||
static int finish_group(OptionParseContext *octx, int group_idx,
|
||||
const char *arg)
|
||||
static void finish_group(OptionParseContext *octx, int group_idx,
|
||||
const char *arg)
|
||||
{
|
||||
OptionGroupList *l = &octx->groups[group_idx];
|
||||
OptionGroup *g;
|
||||
int ret;
|
||||
|
||||
ret = GROW_ARRAY(l->groups, l->nb_groups);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
GROW_ARRAY(l->groups, l->nb_groups);
|
||||
g = &l->groups[l->nb_groups - 1];
|
||||
|
||||
*g = octx->cur_group;
|
||||
@@ -632,51 +628,41 @@ static int finish_group(OptionParseContext *octx, int group_idx,
|
||||
swr_opts = NULL;
|
||||
|
||||
memset(&octx->cur_group, 0, sizeof(octx->cur_group));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add an option instance to currently parsed group.
|
||||
*/
|
||||
static int add_opt(OptionParseContext *octx, const OptionDef *opt,
|
||||
const char *key, const char *val)
|
||||
static void add_opt(OptionParseContext *octx, const OptionDef *opt,
|
||||
const char *key, const char *val)
|
||||
{
|
||||
int global = !(opt->flags & (OPT_PERFILE | OPT_SPEC | OPT_OFFSET));
|
||||
OptionGroup *g = global ? &octx->global_opts : &octx->cur_group;
|
||||
int ret;
|
||||
|
||||
ret = GROW_ARRAY(g->opts, g->nb_opts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
GROW_ARRAY(g->opts, g->nb_opts);
|
||||
g->opts[g->nb_opts - 1].opt = opt;
|
||||
g->opts[g->nb_opts - 1].key = key;
|
||||
g->opts[g->nb_opts - 1].val = val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_parse_context(OptionParseContext *octx,
|
||||
const OptionGroupDef *groups, int nb_groups)
|
||||
static void init_parse_context(OptionParseContext *octx,
|
||||
const OptionGroupDef *groups, int nb_groups)
|
||||
{
|
||||
static const OptionGroupDef global_group = { "global" };
|
||||
int i;
|
||||
|
||||
memset(octx, 0, sizeof(*octx));
|
||||
|
||||
octx->groups = av_calloc(nb_groups, sizeof(*octx->groups));
|
||||
if (!octx->groups)
|
||||
return AVERROR(ENOMEM);
|
||||
octx->nb_groups = nb_groups;
|
||||
octx->groups = av_calloc(octx->nb_groups, sizeof(*octx->groups));
|
||||
if (!octx->groups)
|
||||
report_and_exit(AVERROR(ENOMEM));
|
||||
|
||||
for (i = 0; i < octx->nb_groups; i++)
|
||||
octx->groups[i].group_def = &groups[i];
|
||||
|
||||
octx->global_opts.group_def = &global_group;
|
||||
octx->global_opts.arg = "";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uninit_parse_context(OptionParseContext *octx)
|
||||
@@ -708,17 +694,13 @@ int split_commandline(OptionParseContext *octx, int argc, char *argv[],
|
||||
const OptionDef *options,
|
||||
const OptionGroupDef *groups, int nb_groups)
|
||||
{
|
||||
int ret;
|
||||
int optindex = 1;
|
||||
int dashdash = -2;
|
||||
|
||||
/* perform system-dependent conversions for arguments list */
|
||||
prepare_app_arguments(&argc, &argv);
|
||||
|
||||
ret = init_parse_context(octx, groups, nb_groups);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
init_parse_context(octx, groups, nb_groups);
|
||||
av_log(NULL, AV_LOG_DEBUG, "Splitting the commandline.\n");
|
||||
|
||||
while (optindex < argc) {
|
||||
@@ -734,10 +716,7 @@ int split_commandline(OptionParseContext *octx, int argc, char *argv[],
|
||||
}
|
||||
/* unnamed group separators, e.g. output filename */
|
||||
if (opt[0] != '-' || !opt[1] || dashdash+1 == optindex) {
|
||||
ret = finish_group(octx, 0, opt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
finish_group(octx, 0, opt);
|
||||
av_log(NULL, AV_LOG_DEBUG, " matched as %s.\n", groups[0].name);
|
||||
continue;
|
||||
}
|
||||
@@ -755,10 +734,7 @@ do { \
|
||||
/* named group separators, e.g. -i */
|
||||
if ((ret = match_group_separator(groups, nb_groups, opt)) >= 0) {
|
||||
GET_ARG(arg);
|
||||
ret = finish_group(octx, ret, arg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
finish_group(octx, ret, arg);
|
||||
av_log(NULL, AV_LOG_DEBUG, " matched as %s with argument '%s'.\n",
|
||||
groups[ret].name, arg);
|
||||
continue;
|
||||
@@ -776,10 +752,7 @@ do { \
|
||||
arg = "1";
|
||||
}
|
||||
|
||||
ret = add_opt(octx, po, opt, arg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
add_opt(octx, po, opt, arg);
|
||||
av_log(NULL, AV_LOG_DEBUG, " matched as option '%s' (%s) with "
|
||||
"argument '%s'.\n", po->name, po->help, arg);
|
||||
continue;
|
||||
@@ -804,10 +777,7 @@ do { \
|
||||
if (opt[0] == 'n' && opt[1] == 'o' &&
|
||||
(po = find_option(options, opt + 2)) &&
|
||||
po->name && po->flags & OPT_BOOL) {
|
||||
ret = add_opt(octx, po, opt, "0");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
add_opt(octx, po, opt, "0");
|
||||
av_log(NULL, AV_LOG_DEBUG, " matched as option '%s' (%s) with "
|
||||
"argument 0.\n", po->name, po->help);
|
||||
continue;
|
||||
@@ -922,9 +892,8 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id,
|
||||
AVFormatContext *s, AVStream *st, const AVCodec *codec,
|
||||
AVDictionary **dst)
|
||||
AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
|
||||
AVFormatContext *s, AVStream *st, const AVCodec *codec)
|
||||
{
|
||||
AVDictionary *ret = NULL;
|
||||
const AVDictionaryEntry *t = NULL;
|
||||
@@ -957,16 +926,12 @@ int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id,
|
||||
char *p = strchr(t->key, ':');
|
||||
|
||||
/* check stream specification in opt name */
|
||||
if (p) {
|
||||
int err = check_stream_specifier(s, st, p + 1);
|
||||
if (err < 0) {
|
||||
av_dict_free(&ret);
|
||||
return err;
|
||||
} else if (!err)
|
||||
continue;
|
||||
|
||||
*p = 0;
|
||||
}
|
||||
if (p)
|
||||
switch (check_stream_specifier(s, st, p + 1)) {
|
||||
case 1: *p = 0; break;
|
||||
case 0: continue;
|
||||
default: exit_program(1);
|
||||
}
|
||||
|
||||
if (av_opt_find(&cc, t->key, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ) ||
|
||||
!codec ||
|
||||
@@ -982,58 +947,41 @@ int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id,
|
||||
if (p)
|
||||
*p = ':';
|
||||
}
|
||||
|
||||
*dst = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setup_find_stream_info_opts(AVFormatContext *s,
|
||||
AVDictionary *codec_opts,
|
||||
AVDictionary ***dst)
|
||||
{
|
||||
int ret;
|
||||
AVDictionary **opts;
|
||||
|
||||
*dst = NULL;
|
||||
|
||||
if (!s->nb_streams)
|
||||
return 0;
|
||||
|
||||
opts = av_calloc(s->nb_streams, sizeof(*opts));
|
||||
if (!opts)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (int i = 0; i < s->nb_streams; i++) {
|
||||
ret = filter_codec_opts(codec_opts, s->streams[i]->codecpar->codec_id,
|
||||
s, s->streams[i], NULL, &opts[i]);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
*dst = opts;
|
||||
return 0;
|
||||
fail:
|
||||
for (int i = 0; i < s->nb_streams; i++)
|
||||
av_dict_free(&opts[i]);
|
||||
av_freep(&opts);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int grow_array(void **array, int elem_size, int *size, int new_size)
|
||||
AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
|
||||
AVDictionary *codec_opts)
|
||||
{
|
||||
int i;
|
||||
AVDictionary **opts;
|
||||
|
||||
if (!s->nb_streams)
|
||||
return NULL;
|
||||
opts = av_calloc(s->nb_streams, sizeof(*opts));
|
||||
if (!opts)
|
||||
report_and_exit(AVERROR(ENOMEM));
|
||||
for (i = 0; i < s->nb_streams; i++)
|
||||
opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codecpar->codec_id,
|
||||
s, s->streams[i], NULL);
|
||||
return opts;
|
||||
}
|
||||
|
||||
void *grow_array(void *array, int elem_size, int *size, int new_size)
|
||||
{
|
||||
if (new_size >= INT_MAX / elem_size) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
|
||||
return AVERROR(ERANGE);
|
||||
exit_program(1);
|
||||
}
|
||||
if (*size < new_size) {
|
||||
uint8_t *tmp = av_realloc_array(*array, new_size, elem_size);
|
||||
uint8_t *tmp = av_realloc_array(array, new_size, elem_size);
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
report_and_exit(AVERROR(ENOMEM));
|
||||
memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
|
||||
*size = new_size;
|
||||
*array = tmp;
|
||||
return 0;
|
||||
return tmp;
|
||||
}
|
||||
return 0;
|
||||
return array;
|
||||
}
|
||||
|
||||
void *allocate_array_elem(void *ptr, size_t elem_size, int *nb_elems)
|
||||
@@ -1042,11 +990,11 @@ void *allocate_array_elem(void *ptr, size_t elem_size, int *nb_elems)
|
||||
|
||||
if (!(new_elem = av_mallocz(elem_size)) ||
|
||||
av_dynarray_add_nofree(ptr, nb_elems, new_elem) < 0)
|
||||
return NULL;
|
||||
report_and_exit(AVERROR(ENOMEM));
|
||||
return new_elem;
|
||||
}
|
||||
|
||||
double get_rotation(const int32_t *displaymatrix)
|
||||
double get_rotation(int32_t *displaymatrix)
|
||||
{
|
||||
double theta = 0;
|
||||
if (displaymatrix)
|
||||
|
||||
@@ -49,6 +49,27 @@ extern AVDictionary *swr_opts;
|
||||
extern AVDictionary *format_opts, *codec_opts;
|
||||
extern int hide_banner;
|
||||
|
||||
/**
|
||||
* Register a program-specific cleanup routine.
|
||||
*/
|
||||
void register_exit(void (*cb)(int ret));
|
||||
|
||||
/**
|
||||
* Reports an error corresponding to the provided
|
||||
* AVERROR code and calls exit_program() with the
|
||||
* corresponding POSIX error code.
|
||||
* @note ret must be an AVERROR-value of a POSIX error code
|
||||
* (i.e. AVERROR(EFOO) and not AVERROR_FOO).
|
||||
* library functions can return both, so call this only
|
||||
* with AVERROR(EFOO) of your own.
|
||||
*/
|
||||
void report_and_exit(int ret) av_noreturn;
|
||||
|
||||
/**
|
||||
* Wraps exit with a program-specific cleanup routine.
|
||||
*/
|
||||
void exit_program(int ret) av_noreturn;
|
||||
|
||||
/**
|
||||
* Initialize dynamic library loading
|
||||
*/
|
||||
@@ -79,6 +100,8 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Parse a string and return its corresponding value as a double.
|
||||
* Exit from the application if the string cannot be correctly
|
||||
* parsed or the corresponding value is invalid.
|
||||
*
|
||||
* @param context the context of the value to be set (e.g. the
|
||||
* corresponding command line option name)
|
||||
@@ -88,8 +111,25 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg);
|
||||
* @param min the minimum valid accepted value
|
||||
* @param max the maximum valid accepted value
|
||||
*/
|
||||
int parse_number(const char *context, const char *numstr, int type,
|
||||
double min, double max, double *dst);
|
||||
double parse_number_or_die(const char *context, const char *numstr, int type,
|
||||
double min, double max);
|
||||
|
||||
/**
|
||||
* Parse a string specifying a time and return its corresponding
|
||||
* value as a number of microseconds. Exit from the application if
|
||||
* the string cannot be correctly parsed.
|
||||
*
|
||||
* @param context the context of the value to be set (e.g. the
|
||||
* corresponding command line option name)
|
||||
* @param timestr the string to be parsed
|
||||
* @param is_duration a flag which tells how to interpret timestr, if
|
||||
* not zero timestr is interpreted as a duration, otherwise as a
|
||||
* date
|
||||
*
|
||||
* @see av_parse_time()
|
||||
*/
|
||||
int64_t parse_time_or_die(const char *context, const char *timestr,
|
||||
int is_duration);
|
||||
|
||||
typedef struct SpecifierOpt {
|
||||
char *specifier; /**< stream/chapter/program/... specifier */
|
||||
@@ -173,8 +213,8 @@ void show_help_default(const char *opt, const char *arg);
|
||||
* argument without a leading option name flag. NULL if such arguments do
|
||||
* not have to be processed.
|
||||
*/
|
||||
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
|
||||
int (* parse_arg_function)(void *optctx, const char*));
|
||||
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
|
||||
void (* parse_arg_function)(void *optctx, const char*));
|
||||
|
||||
/**
|
||||
* Parse one given option.
|
||||
@@ -312,12 +352,10 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
|
||||
* @param st A stream from s for which the options should be filtered.
|
||||
* @param codec The particular codec for which the options should be filtered.
|
||||
* If null, the default one is looked up according to the codec id.
|
||||
* @param dst a pointer to the created dictionary
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
* @return a pointer to the created dictionary
|
||||
*/
|
||||
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id,
|
||||
AVFormatContext *s, AVStream *st, const AVCodec *codec,
|
||||
AVDictionary **dst);
|
||||
AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
|
||||
AVFormatContext *s, AVStream *st, const AVCodec *codec);
|
||||
|
||||
/**
|
||||
* Setup AVCodecContext options for avformat_find_stream_info().
|
||||
@@ -326,10 +364,12 @@ int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id,
|
||||
* contained in s.
|
||||
* Each dictionary will contain the options from codec_opts which can
|
||||
* be applied to the corresponding stream codec context.
|
||||
*
|
||||
* @return pointer to the created array of dictionaries.
|
||||
* Calls exit() on failure.
|
||||
*/
|
||||
int setup_find_stream_info_opts(AVFormatContext *s,
|
||||
AVDictionary *codec_opts,
|
||||
AVDictionary ***dst);
|
||||
AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
|
||||
AVDictionary *codec_opts);
|
||||
|
||||
/**
|
||||
* Print an error message to stderr, indicating filename and a human
|
||||
@@ -378,31 +418,35 @@ FILE *get_preset_file(char *filename, size_t filename_size,
|
||||
|
||||
/**
|
||||
* Realloc array to hold new_size elements of elem_size.
|
||||
* Calls exit() on failure.
|
||||
*
|
||||
* @param array pointer to the array to reallocate, will be updated
|
||||
* with a new pointer on success
|
||||
* @param array array to reallocate
|
||||
* @param elem_size size in bytes of each element
|
||||
* @param size new element count will be written here
|
||||
* @param new_size number of elements to place in reallocated array
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
* @return reallocated array
|
||||
*/
|
||||
int grow_array(void **array, int elem_size, int *size, int new_size);
|
||||
void *grow_array(void *array, int elem_size, int *size, int new_size);
|
||||
|
||||
/**
|
||||
* Atomically add a new element to an array of pointers, i.e. allocate
|
||||
* a new entry, reallocate the array of pointers and make the new last
|
||||
* member of this array point to the newly allocated buffer.
|
||||
* Calls exit() on failure.
|
||||
*
|
||||
* @param array array of pointers to reallocate
|
||||
* @param elem_size size of the new element to allocate
|
||||
* @param nb_elems pointer to the number of elements of the array array;
|
||||
* *nb_elems will be incremented by one by this function.
|
||||
* @return pointer to the newly allocated entry or NULL on failure
|
||||
* @return pointer to the newly allocated entry
|
||||
*/
|
||||
void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
|
||||
|
||||
#define GROW_ARRAY(array, nb_elems)\
|
||||
grow_array((void**)&array, sizeof(*array), &nb_elems, nb_elems + 1)
|
||||
array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1)
|
||||
|
||||
#define ALLOC_ARRAY_ELEM(array, nb_elems)\
|
||||
allocate_array_elem(&array, sizeof(*array[0]), &nb_elems)
|
||||
|
||||
#define GET_PIX_FMT_NAME(pix_fmt)\
|
||||
const char *name = av_get_pix_fmt_name(pix_fmt);
|
||||
@@ -417,6 +461,6 @@ void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
|
||||
char name[16];\
|
||||
snprintf(name, sizeof(name), "%d", rate);
|
||||
|
||||
double get_rotation(const int32_t *displaymatrix);
|
||||
double get_rotation(int32_t *displaymatrix);
|
||||
|
||||
#endif /* FFTOOLS_CMDUTILS_H */
|
||||
|
||||
3367
fftools/ffmpeg.c
3367
fftools/ffmpeg.c
File diff suppressed because it is too large
Load Diff
392
fftools/ffmpeg.h
392
fftools/ffmpeg.h
@@ -54,11 +54,6 @@
|
||||
#define FFMPEG_OPT_MAP_CHANNEL 1
|
||||
#define FFMPEG_OPT_MAP_SYNC 1
|
||||
#define FFMPEG_ROTATION_METADATA 1
|
||||
#define FFMPEG_OPT_QPHIST 1
|
||||
#define FFMPEG_OPT_ADRIFT_THRESHOLD 1
|
||||
#define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
|
||||
#define FFMPEG_OPT_TOP 1
|
||||
#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
|
||||
|
||||
enum VideoSyncMethod {
|
||||
VSYNC_AUTO = -1,
|
||||
@@ -69,10 +64,7 @@ enum VideoSyncMethod {
|
||||
VSYNC_DROP,
|
||||
};
|
||||
|
||||
enum EncTimeBase {
|
||||
ENC_TIME_BASE_DEMUX = -1,
|
||||
ENC_TIME_BASE_FILTER = -2,
|
||||
};
|
||||
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
|
||||
|
||||
enum HWAccelID {
|
||||
HWACCEL_NONE = 0,
|
||||
@@ -101,12 +93,6 @@ typedef struct {
|
||||
} AudioChannelMap;
|
||||
#endif
|
||||
|
||||
typedef struct DemuxPktData {
|
||||
// estimated dts in AV_TIME_BASE_Q,
|
||||
// to be used when real dts is missing
|
||||
int64_t dts_est;
|
||||
} DemuxPktData;
|
||||
|
||||
typedef struct OptionsContext {
|
||||
OptionGroup *g;
|
||||
|
||||
@@ -138,7 +124,6 @@ typedef struct OptionsContext {
|
||||
int loop;
|
||||
int rate_emu;
|
||||
float readrate;
|
||||
double readrate_initial_burst;
|
||||
int accurate_seek;
|
||||
int thread_queue_size;
|
||||
int input_sync_ref;
|
||||
@@ -183,8 +168,9 @@ typedef struct OptionsContext {
|
||||
int subtitle_disable;
|
||||
int data_disable;
|
||||
|
||||
// keys are stream indices
|
||||
AVDictionary *streamid;
|
||||
/* indexed by output file stream index */
|
||||
int *streamid_map;
|
||||
int nb_streamid_map;
|
||||
|
||||
SpecifierOpt *metadata;
|
||||
int nb_metadata;
|
||||
@@ -220,10 +206,8 @@ typedef struct OptionsContext {
|
||||
int nb_inter_matrices;
|
||||
SpecifierOpt *chroma_intra_matrices;
|
||||
int nb_chroma_intra_matrices;
|
||||
#if FFMPEG_OPT_TOP
|
||||
SpecifierOpt *top_field_first;
|
||||
int nb_top_field_first;
|
||||
#endif
|
||||
SpecifierOpt *metadata_map;
|
||||
int nb_metadata_map;
|
||||
SpecifierOpt *presets;
|
||||
@@ -285,33 +269,62 @@ typedef struct OptionsContext {
|
||||
} OptionsContext;
|
||||
|
||||
typedef struct InputFilter {
|
||||
AVFilterContext *filter;
|
||||
struct InputStream *ist;
|
||||
struct FilterGraph *graph;
|
||||
uint8_t *name;
|
||||
enum AVMediaType type; // AVMEDIA_TYPE_SUBTITLE for sub2video
|
||||
|
||||
AVFifo *frame_queue;
|
||||
|
||||
// parameters configured for this input
|
||||
int format;
|
||||
|
||||
int width, height;
|
||||
AVRational sample_aspect_ratio;
|
||||
|
||||
int sample_rate;
|
||||
AVChannelLayout ch_layout;
|
||||
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
int32_t *displaymatrix;
|
||||
|
||||
int eof;
|
||||
} InputFilter;
|
||||
|
||||
typedef struct OutputFilter {
|
||||
AVFilterContext *filter;
|
||||
struct OutputStream *ost;
|
||||
struct FilterGraph *graph;
|
||||
uint8_t *name;
|
||||
|
||||
/* for filters that are not yet bound to an output stream,
|
||||
* this stores the output linklabel, if any */
|
||||
uint8_t *linklabel;
|
||||
|
||||
/* temporary storage until stream maps are processed */
|
||||
AVFilterInOut *out_tmp;
|
||||
enum AVMediaType type;
|
||||
|
||||
/* pts of the last frame received from this filter, in AV_TIME_BASE_Q */
|
||||
int64_t last_pts;
|
||||
/* desired output stream properties */
|
||||
int width, height;
|
||||
AVRational frame_rate;
|
||||
int format;
|
||||
int sample_rate;
|
||||
AVChannelLayout ch_layout;
|
||||
|
||||
uint64_t nb_frames_dup;
|
||||
uint64_t nb_frames_drop;
|
||||
// those are only set if no format is specified and the encoder gives us multiple options
|
||||
// They point directly to the relevant lists of the encoder.
|
||||
const int *formats;
|
||||
const AVChannelLayout *ch_layouts;
|
||||
const int *sample_rates;
|
||||
} OutputFilter;
|
||||
|
||||
typedef struct FilterGraph {
|
||||
const AVClass *class;
|
||||
int index;
|
||||
const char *graph_desc;
|
||||
|
||||
AVFilterGraph *graph;
|
||||
int reconfiguration;
|
||||
// true when the filtergraph contains only meta filters
|
||||
// that do not modify the frame data
|
||||
int is_meta;
|
||||
|
||||
InputFilter **inputs;
|
||||
int nb_inputs;
|
||||
@@ -319,20 +332,17 @@ typedef struct FilterGraph {
|
||||
int nb_outputs;
|
||||
} FilterGraph;
|
||||
|
||||
typedef struct Decoder Decoder;
|
||||
|
||||
typedef struct InputStream {
|
||||
const AVClass *class;
|
||||
|
||||
int file_index;
|
||||
int index;
|
||||
|
||||
AVStream *st;
|
||||
int discard; /* true if stream data should be discarded */
|
||||
int user_set_discard;
|
||||
int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */
|
||||
#define DECODING_FOR_OST 1
|
||||
#define DECODING_FOR_FILTER 2
|
||||
int processing_needed; /* non zero if the packets must be processed */
|
||||
// should attach FrameData as opaque_ref after decoding
|
||||
int want_frame_data;
|
||||
|
||||
/**
|
||||
* Codec parameters - to be used by the decoding/streamcopy code.
|
||||
@@ -340,25 +350,65 @@ typedef struct InputStream {
|
||||
* concurrently by the demuxing thread.
|
||||
*/
|
||||
AVCodecParameters *par;
|
||||
Decoder *decoder;
|
||||
AVCodecContext *dec_ctx;
|
||||
const AVCodec *dec;
|
||||
const AVCodecDescriptor *codec_desc;
|
||||
AVFrame *decoded_frame;
|
||||
AVPacket *pkt;
|
||||
|
||||
AVRational framerate_guessed;
|
||||
|
||||
int64_t prev_pkt_pts;
|
||||
int64_t start; /* time when read started */
|
||||
/* predicted dts of the next packet read for this stream or (when there are
|
||||
* several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */
|
||||
int64_t next_dts;
|
||||
int64_t first_dts; ///< dts of the first packet read for this stream (in AV_TIME_BASE units)
|
||||
int64_t dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units)
|
||||
|
||||
int64_t next_pts; ///< synthetic pts for the next decode frame (in AV_TIME_BASE units)
|
||||
int64_t pts; ///< current pts of the decoded frame (in AV_TIME_BASE units)
|
||||
int wrap_correction_done;
|
||||
|
||||
// the value of AVCodecParserContext.repeat_pict from the AVStream parser
|
||||
// for the last packet returned from ifile_get_packet()
|
||||
// -1 if unknown
|
||||
// FIXME: this is a hack, the avstream parser should not be used
|
||||
int last_pkt_repeat_pict;
|
||||
|
||||
int64_t filter_in_rescale_delta_last;
|
||||
|
||||
int64_t min_pts; /* pts with the smallest value in a current stream */
|
||||
int64_t max_pts; /* pts with the higher value in a current stream */
|
||||
|
||||
// when forcing constant input framerate through -r,
|
||||
// this contains the pts that will be given to the next decoded frame
|
||||
int64_t cfr_next_pts;
|
||||
|
||||
int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */
|
||||
|
||||
double ts_scale;
|
||||
int saw_first_ts;
|
||||
AVDictionary *decoder_opts;
|
||||
AVRational framerate; /* framerate forced with -r */
|
||||
#if FFMPEG_OPT_TOP
|
||||
int top_field_first;
|
||||
#endif
|
||||
int guess_layout_max;
|
||||
|
||||
int autorotate;
|
||||
|
||||
int fix_sub_duration;
|
||||
struct { /* previous decoded subtitle and related variables */
|
||||
int got_output;
|
||||
int ret;
|
||||
AVSubtitle subtitle;
|
||||
} prev_sub;
|
||||
|
||||
struct sub2video {
|
||||
int64_t last_pts;
|
||||
int64_t end_pts;
|
||||
AVFifo *sub_queue; ///< queue of AVSubtitle* before filter init
|
||||
AVFrame *frame;
|
||||
int w, h;
|
||||
unsigned int initialize; ///< marks if sub2video_update should force an initialization
|
||||
} sub2video;
|
||||
|
||||
/* decoded data from this stream goes into all those filters
|
||||
@@ -366,14 +416,6 @@ typedef struct InputStream {
|
||||
InputFilter **filters;
|
||||
int nb_filters;
|
||||
|
||||
/*
|
||||
* Output targets that do not go through lavfi, i.e. subtitles or
|
||||
* streamcopy. Those two cases are distinguished by the OutputStream
|
||||
* having an encoder or not.
|
||||
*/
|
||||
struct OutputStream **outputs;
|
||||
int nb_outputs;
|
||||
|
||||
int reinit_filters;
|
||||
|
||||
/* hwaccel options */
|
||||
@@ -382,21 +424,32 @@ typedef struct InputStream {
|
||||
char *hwaccel_device;
|
||||
enum AVPixelFormat hwaccel_output_format;
|
||||
|
||||
int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
|
||||
enum AVPixelFormat hwaccel_pix_fmt;
|
||||
|
||||
/* stats */
|
||||
// combined size of all the packets read
|
||||
uint64_t data_size;
|
||||
/* number of packets successfully read for this stream */
|
||||
uint64_t nb_packets;
|
||||
// number of frames/samples retrieved from the decoder
|
||||
uint64_t frames_decoded;
|
||||
uint64_t samples_decoded;
|
||||
uint64_t decode_errors;
|
||||
|
||||
int64_t *dts_buffer;
|
||||
int nb_dts_buffer;
|
||||
|
||||
int got_output;
|
||||
} InputStream;
|
||||
|
||||
typedef struct LastFrameDuration {
|
||||
int stream_idx;
|
||||
int64_t duration;
|
||||
} LastFrameDuration;
|
||||
|
||||
typedef struct InputFile {
|
||||
const AVClass *class;
|
||||
|
||||
int index;
|
||||
|
||||
// input format has no timestamps
|
||||
int format_nots;
|
||||
|
||||
AVFormatContext *ctx;
|
||||
int eof_reached; /* true if eof reached */
|
||||
int eagain; /* true if last read attempt returned EAGAIN */
|
||||
@@ -407,6 +460,11 @@ typedef struct InputFile {
|
||||
*/
|
||||
int64_t start_time_effective;
|
||||
int64_t ts_offset;
|
||||
/**
|
||||
* Extra timestamp offset added by discontinuity handling.
|
||||
*/
|
||||
int64_t ts_offset_discont;
|
||||
int64_t last_ts;
|
||||
int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
|
||||
int64_t recording_time;
|
||||
|
||||
@@ -416,13 +474,14 @@ typedef struct InputFile {
|
||||
InputStream **streams;
|
||||
int nb_streams;
|
||||
|
||||
int rate_emu;
|
||||
float readrate;
|
||||
int accurate_seek;
|
||||
|
||||
/* when looping the input file, this queue is used by decoders to report
|
||||
* the last frame timestamp back to the demuxer thread */
|
||||
AVThreadMessageQueue *audio_ts_queue;
|
||||
int audio_ts_queue_size;
|
||||
* the last frame duration back to the demuxer thread */
|
||||
AVThreadMessageQueue *audio_duration_queue;
|
||||
int audio_duration_queue_size;
|
||||
} InputFile;
|
||||
|
||||
enum forced_keyframes_const {
|
||||
@@ -481,9 +540,7 @@ typedef enum {
|
||||
|
||||
enum {
|
||||
KF_FORCE_SOURCE = 1,
|
||||
#if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP
|
||||
KF_FORCE_SOURCE_NO_DROP = 2,
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct KeyframeForceCtx {
|
||||
@@ -502,35 +559,44 @@ typedef struct KeyframeForceCtx {
|
||||
int dropped_keyframe;
|
||||
} KeyframeForceCtx;
|
||||
|
||||
typedef struct Encoder Encoder;
|
||||
|
||||
typedef struct OutputStream {
|
||||
const AVClass *class;
|
||||
|
||||
enum AVMediaType type;
|
||||
|
||||
int file_index; /* file index */
|
||||
int index; /* stream index in the output file */
|
||||
|
||||
/**
|
||||
* Codec parameters for packets submitted to the muxer (i.e. before
|
||||
* bitstream filtering, if any).
|
||||
*/
|
||||
AVCodecParameters *par_in;
|
||||
|
||||
/* input stream that is the source for this output stream;
|
||||
* may be NULL for streams with no well-defined source, e.g.
|
||||
* attachments or outputs from complex filtergraphs */
|
||||
InputStream *ist;
|
||||
|
||||
AVStream *st; /* stream in the output file */
|
||||
/* number of frames emitted by the video-encoding sync code */
|
||||
int64_t vsync_frame_number;
|
||||
/* predicted pts of the next frame to be encoded
|
||||
* audio/video encoding only */
|
||||
int64_t next_pts;
|
||||
/* dts of the last packet sent to the muxing queue, in AV_TIME_BASE_Q */
|
||||
int64_t last_mux_dts;
|
||||
/* pts of the last frame received from the filters, in AV_TIME_BASE_Q */
|
||||
int64_t last_filter_pts;
|
||||
|
||||
// timestamp from which the streamcopied streams should start,
|
||||
// in AV_TIME_BASE_Q;
|
||||
// everything before it should be discarded
|
||||
int64_t ts_copy_start;
|
||||
|
||||
// the timebase of the packets sent to the muxer
|
||||
AVRational mux_timebase;
|
||||
AVRational enc_timebase;
|
||||
|
||||
Encoder *enc;
|
||||
AVCodecContext *enc_ctx;
|
||||
AVFrame *filtered_frame;
|
||||
AVFrame *last_frame;
|
||||
AVFrame *sq_frame;
|
||||
AVPacket *pkt;
|
||||
int64_t last_dropped;
|
||||
int64_t last_nb0_frames[3];
|
||||
|
||||
/* video only */
|
||||
AVRational frame_rate;
|
||||
@@ -538,9 +604,7 @@ typedef struct OutputStream {
|
||||
enum VideoSyncMethod vsync_method;
|
||||
int is_cfr;
|
||||
int force_fps;
|
||||
#if FFMPEG_OPT_TOP
|
||||
int top_field_first;
|
||||
#endif
|
||||
#if FFMPEG_ROTATION_METADATA
|
||||
int rotate_overridden;
|
||||
#endif
|
||||
@@ -565,6 +629,9 @@ typedef struct OutputStream {
|
||||
FILE *logfile;
|
||||
|
||||
OutputFilter *filter;
|
||||
char *avfilter;
|
||||
char *filters; ///< filtergraph associated to the -filter option
|
||||
char *filters_script; ///< filtergraph script associated to the -filter_script option
|
||||
|
||||
AVDictionary *encoder_opts;
|
||||
AVDictionary *sws_dict;
|
||||
@@ -578,20 +645,37 @@ typedef struct OutputStream {
|
||||
// parameters are set in the AVStream.
|
||||
int initialized;
|
||||
|
||||
int inputs_done;
|
||||
|
||||
const char *attachment_filename;
|
||||
int streamcopy_started;
|
||||
int copy_initial_nonkeyframes;
|
||||
int copy_prior_start;
|
||||
|
||||
int keep_pix_fmt;
|
||||
|
||||
/* stats */
|
||||
// combined size of all the packets sent to the muxer
|
||||
uint64_t data_size_mux;
|
||||
// combined size of all the packets received from the encoder
|
||||
uint64_t data_size_enc;
|
||||
// number of packets send to the muxer
|
||||
atomic_uint_least64_t packets_written;
|
||||
// number of frames/samples sent to the encoder
|
||||
uint64_t frames_encoded;
|
||||
uint64_t samples_encoded;
|
||||
// number of packets received from the encoder
|
||||
uint64_t packets_encoded;
|
||||
|
||||
/* packet quality factor */
|
||||
int quality;
|
||||
|
||||
/* packet picture type */
|
||||
int pict_type;
|
||||
|
||||
/* frame encode sum of squared error values */
|
||||
int64_t error[4];
|
||||
|
||||
int sq_idx_encode;
|
||||
int sq_idx_mux;
|
||||
|
||||
@@ -625,21 +709,6 @@ typedef struct OutputFile {
|
||||
int bitexact;
|
||||
} OutputFile;
|
||||
|
||||
// optionally attached as opaque_ref to decoded AVFrames
|
||||
typedef struct FrameData {
|
||||
// properties that come from the decoder
|
||||
struct {
|
||||
uint64_t frame_num;
|
||||
|
||||
int64_t pts;
|
||||
AVRational tb;
|
||||
} dec;
|
||||
|
||||
AVRational frame_rate_filter;
|
||||
|
||||
int bits_per_raw_sample;
|
||||
} FrameData;
|
||||
|
||||
extern InputFile **input_files;
|
||||
extern int nb_input_files;
|
||||
|
||||
@@ -652,6 +721,7 @@ extern int nb_filtergraphs;
|
||||
extern char *vstats_filename;
|
||||
extern char *sdp_filename;
|
||||
|
||||
extern float audio_drift_threshold;
|
||||
extern float dts_delta_threshold;
|
||||
extern float dts_error_threshold;
|
||||
|
||||
@@ -669,6 +739,7 @@ extern int exit_on_error;
|
||||
extern int abort_on_flags;
|
||||
extern int print_stats;
|
||||
extern int64_t stats_period;
|
||||
extern int qp_hist;
|
||||
extern int stdin_interaction;
|
||||
extern AVIOContext *progress_avio;
|
||||
extern float max_error_rate;
|
||||
@@ -684,14 +755,13 @@ extern const OptionDef options[];
|
||||
extern HWDevice *filter_hw_device;
|
||||
|
||||
extern unsigned nb_output_dumped;
|
||||
extern int main_return_code;
|
||||
|
||||
extern int ignore_unknown_streams;
|
||||
extern int copy_unknown_streams;
|
||||
|
||||
extern int recast_media;
|
||||
|
||||
extern FILE *vstats_file;
|
||||
|
||||
#if FFMPEG_OPT_PSNR
|
||||
extern int do_psnr;
|
||||
#endif
|
||||
@@ -702,73 +772,24 @@ void term_exit(void);
|
||||
void show_usage(void);
|
||||
|
||||
void remove_avoptions(AVDictionary **a, AVDictionary *b);
|
||||
int check_avoptions(AVDictionary *m);
|
||||
void assert_avoptions(AVDictionary *m);
|
||||
|
||||
int assert_file_overwrite(const char *filename);
|
||||
void assert_file_overwrite(const char *filename);
|
||||
char *file_read(const char *filename);
|
||||
AVDictionary *strip_specifiers(const AVDictionary *dict);
|
||||
int find_codec(void *logctx, const char *name,
|
||||
enum AVMediaType type, int encoder, const AVCodec **codec);
|
||||
const AVCodec *find_codec_or_die(void *logctx, const char *name,
|
||||
enum AVMediaType type, int encoder);
|
||||
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
|
||||
|
||||
int check_filter_outputs(void);
|
||||
int filtergraph_is_simple(const FilterGraph *fg);
|
||||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
|
||||
char *graph_desc);
|
||||
int configure_filtergraph(FilterGraph *fg);
|
||||
void check_filter_outputs(void);
|
||||
int filtergraph_is_simple(FilterGraph *fg);
|
||||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost);
|
||||
int init_complex_filtergraph(FilterGraph *fg);
|
||||
|
||||
int copy_av_subtitle(AVSubtitle *dst, const AVSubtitle *src);
|
||||
int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy);
|
||||
void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub);
|
||||
|
||||
/**
|
||||
* Get our axiliary frame data attached to the frame, allocating it
|
||||
* if needed.
|
||||
*/
|
||||
FrameData *frame_data(AVFrame *frame);
|
||||
|
||||
int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference);
|
||||
int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb);
|
||||
int ifilter_sub2video(InputFilter *ifilter, const AVFrame *frame);
|
||||
void ifilter_sub2video_heartbeat(InputFilter *ifilter, int64_t pts, AVRational tb);
|
||||
|
||||
/**
|
||||
* Set up fallback filtering parameters from a decoder context. They will only
|
||||
* be used if no frames are ever sent on this input, otherwise the actual
|
||||
* parameters are taken from the frame.
|
||||
*/
|
||||
int ifilter_parameters_from_dec(InputFilter *ifilter, const AVCodecContext *dec);
|
||||
|
||||
int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost);
|
||||
|
||||
/**
|
||||
* Create a new filtergraph in the global filtergraph list.
|
||||
*
|
||||
* @param graph_desc Graph description; an av_malloc()ed string, filtergraph
|
||||
* takes ownership of it.
|
||||
*/
|
||||
int fg_create(FilterGraph **pfg, char *graph_desc);
|
||||
|
||||
void fg_free(FilterGraph **pfg);
|
||||
|
||||
/**
|
||||
* Perform a step of transcoding for the specified filter graph.
|
||||
*
|
||||
* @param[in] graph filter graph to consider
|
||||
* @param[out] best_ist input stream where a frame would allow to continue
|
||||
* @return 0 for success, <0 for error
|
||||
*/
|
||||
int fg_transcode_step(FilterGraph *graph, InputStream **best_ist);
|
||||
|
||||
void fg_send_command(FilterGraph *fg, double time, const char *target,
|
||||
const char *command, const char *arg, int all_filters);
|
||||
|
||||
/**
|
||||
* Get and encode new output from specified filtergraph, without causing
|
||||
* activity.
|
||||
*
|
||||
* @return 0 for success, <0 for severe errors
|
||||
*/
|
||||
int reap_filters(FilterGraph *fg, int flush);
|
||||
int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame);
|
||||
|
||||
int ffmpeg_parse_options(int argc, char **argv);
|
||||
|
||||
@@ -777,43 +798,14 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
|
||||
uint64_t frame_num);
|
||||
|
||||
HWDevice *hw_device_get_by_name(const char *name);
|
||||
HWDevice *hw_device_get_by_type(enum AVHWDeviceType type);
|
||||
int hw_device_init_from_string(const char *arg, HWDevice **dev);
|
||||
int hw_device_init_from_type(enum AVHWDeviceType type,
|
||||
const char *device,
|
||||
HWDevice **dev_out);
|
||||
void hw_device_free_all(void);
|
||||
|
||||
/**
|
||||
* Get a hardware device to be used with this filtergraph.
|
||||
* The returned reference is owned by the callee, the caller
|
||||
* must ref it explicitly for long-term use.
|
||||
*/
|
||||
AVBufferRef *hw_device_for_filter(void);
|
||||
int hw_device_setup_for_decode(InputStream *ist);
|
||||
int hw_device_setup_for_encode(OutputStream *ost);
|
||||
int hw_device_setup_for_filter(FilterGraph *fg);
|
||||
|
||||
int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input);
|
||||
|
||||
int dec_open(InputStream *ist);
|
||||
void dec_free(Decoder **pdec);
|
||||
|
||||
/**
|
||||
* Submit a packet for decoding
|
||||
*
|
||||
* When pkt==NULL and no_eof=0, there will be no more input. Flush decoders and
|
||||
* mark all downstreams as finished.
|
||||
*
|
||||
* When pkt==NULL and no_eof=1, the stream was reset (e.g. after a seek). Flush
|
||||
* decoders and await further input.
|
||||
*/
|
||||
int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof);
|
||||
|
||||
int enc_alloc(Encoder **penc, const AVCodec *codec);
|
||||
void enc_free(Encoder **penc);
|
||||
|
||||
int enc_open(OutputStream *ost, const AVFrame *frame);
|
||||
int enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub);
|
||||
int enc_frame(OutputStream *ost, AVFrame *frame);
|
||||
int enc_flush(void);
|
||||
int hwaccel_decode_init(AVCodecContext *avctx);
|
||||
|
||||
/*
|
||||
* Initialize muxing state for the given stream, should be called
|
||||
@@ -824,17 +816,22 @@ int enc_flush(void);
|
||||
int of_stream_init(OutputFile *of, OutputStream *ost);
|
||||
int of_write_trailer(OutputFile *of);
|
||||
int of_open(const OptionsContext *o, const char *filename);
|
||||
void of_free(OutputFile **pof);
|
||||
void of_close(OutputFile **pof);
|
||||
|
||||
void of_enc_stats_close(void);
|
||||
|
||||
int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* @param dts predicted packet dts in AV_TIME_BASE_Q
|
||||
/*
|
||||
* Send a single packet to the output, applying any bitstream filters
|
||||
* associated with the output stream. This may result in any number
|
||||
* of packets actually being written, depending on what bitstream
|
||||
* filters are applied. The supplied packet is consumed and will be
|
||||
* blank (as if newly-allocated) when this function returns.
|
||||
*
|
||||
* If eof is set, instead indicate EOF to all bitstream filters and
|
||||
* therefore flush any delayed packets to the output. A blank packet
|
||||
* must be supplied in this case.
|
||||
*/
|
||||
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts);
|
||||
|
||||
void of_output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof);
|
||||
int64_t of_filesize(OutputFile *of);
|
||||
|
||||
int ifile_open(const OptionsContext *o, const char *filename);
|
||||
@@ -852,27 +849,10 @@ void ifile_close(InputFile **f);
|
||||
*/
|
||||
int ifile_get_packet(InputFile *f, AVPacket **pkt);
|
||||
|
||||
int ist_output_add(InputStream *ist, OutputStream *ost);
|
||||
int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple);
|
||||
|
||||
/**
|
||||
* Find an unused input stream of given type.
|
||||
*/
|
||||
InputStream *ist_find_unused(enum AVMediaType type);
|
||||
|
||||
/* iterate over all input streams in all input files;
|
||||
* pass NULL to start iteration */
|
||||
InputStream *ist_iter(InputStream *prev);
|
||||
|
||||
/* iterate over all output streams in all output files;
|
||||
* pass NULL to start iteration */
|
||||
OutputStream *ost_iter(OutputStream *prev);
|
||||
|
||||
void close_output_stream(OutputStream *ost);
|
||||
int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt);
|
||||
int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts);
|
||||
void update_benchmark(const char *fmt, ...);
|
||||
|
||||
#define SPECIFIER_OPT_FMT_str "%s"
|
||||
#define SPECIFIER_OPT_FMT_i "%i"
|
||||
#define SPECIFIER_OPT_FMT_i64 "%"PRId64
|
||||
@@ -901,7 +881,7 @@ void update_benchmark(const char *fmt, ...);
|
||||
so = &o->name[_i];\
|
||||
_matches++;\
|
||||
} else if (_ret < 0)\
|
||||
return _ret;\
|
||||
exit_program(1);\
|
||||
}\
|
||||
if (_matches > 1)\
|
||||
WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
|
||||
@@ -920,8 +900,6 @@ void update_benchmark(const char *fmt, ...);
|
||||
extern const char * const opt_name_codec_names[];
|
||||
extern const char * const opt_name_codec_tags[];
|
||||
extern const char * const opt_name_frame_rates[];
|
||||
#if FFMPEG_OPT_TOP
|
||||
extern const char * const opt_name_top_field_first[];
|
||||
#endif
|
||||
|
||||
#endif /* FFTOOLS_FFMPEG_H */
|
||||
|
||||
1140
fftools/ffmpeg_dec.c
1140
fftools/ffmpeg_dec.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,888 +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 <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ffmpeg.h"
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/display.h"
|
||||
#include "libavutil/eval.h"
|
||||
#include "libavutil/frame.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/rational.h"
|
||||
#include "libavutil/timestamp.h"
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
struct Encoder {
|
||||
AVFrame *sq_frame;
|
||||
|
||||
// packet for receiving encoded output
|
||||
AVPacket *pkt;
|
||||
|
||||
// combined size of all the packets received from the encoder
|
||||
uint64_t data_size;
|
||||
|
||||
// number of packets received from the encoder
|
||||
uint64_t packets_encoded;
|
||||
|
||||
int opened;
|
||||
};
|
||||
|
||||
void enc_free(Encoder **penc)
|
||||
{
|
||||
Encoder *enc = *penc;
|
||||
|
||||
if (!enc)
|
||||
return;
|
||||
|
||||
av_frame_free(&enc->sq_frame);
|
||||
|
||||
av_packet_free(&enc->pkt);
|
||||
|
||||
av_freep(penc);
|
||||
}
|
||||
|
||||
int enc_alloc(Encoder **penc, const AVCodec *codec)
|
||||
{
|
||||
Encoder *enc;
|
||||
|
||||
*penc = NULL;
|
||||
|
||||
enc = av_mallocz(sizeof(*enc));
|
||||
if (!enc)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
enc->pkt = av_packet_alloc();
|
||||
if (!enc->pkt)
|
||||
goto fail;
|
||||
|
||||
*penc = enc;
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
enc_free(&enc);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
static int hw_device_setup_for_encode(OutputStream *ost, AVBufferRef *frames_ref)
|
||||
{
|
||||
const AVCodecHWConfig *config;
|
||||
HWDevice *dev = NULL;
|
||||
int i;
|
||||
|
||||
if (frames_ref &&
|
||||
((AVHWFramesContext*)frames_ref->data)->format ==
|
||||
ost->enc_ctx->pix_fmt) {
|
||||
// Matching format, will try to use hw_frames_ctx.
|
||||
} else {
|
||||
frames_ref = NULL;
|
||||
}
|
||||
|
||||
for (i = 0;; i++) {
|
||||
config = avcodec_get_hw_config(ost->enc_ctx->codec, i);
|
||||
if (!config)
|
||||
break;
|
||||
|
||||
if (frames_ref &&
|
||||
config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX &&
|
||||
(config->pix_fmt == AV_PIX_FMT_NONE ||
|
||||
config->pix_fmt == ost->enc_ctx->pix_fmt)) {
|
||||
av_log(ost->enc_ctx, AV_LOG_VERBOSE, "Using input "
|
||||
"frames context (format %s) with %s encoder.\n",
|
||||
av_get_pix_fmt_name(ost->enc_ctx->pix_fmt),
|
||||
ost->enc_ctx->codec->name);
|
||||
ost->enc_ctx->hw_frames_ctx = av_buffer_ref(frames_ref);
|
||||
if (!ost->enc_ctx->hw_frames_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!dev &&
|
||||
config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)
|
||||
dev = hw_device_get_by_type(config->device_type);
|
||||
}
|
||||
|
||||
if (dev) {
|
||||
av_log(ost->enc_ctx, AV_LOG_VERBOSE, "Using device %s "
|
||||
"(type %s) with %s encoder.\n", dev->name,
|
||||
av_hwdevice_get_type_name(dev->type), ost->enc_ctx->codec->name);
|
||||
ost->enc_ctx->hw_device_ctx = av_buffer_ref(dev->device_ref);
|
||||
if (!ost->enc_ctx->hw_device_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
} else {
|
||||
// No device required, or no device available.
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_encoder_id(OutputFile *of, OutputStream *ost)
|
||||
{
|
||||
const char *cname = ost->enc_ctx->codec->name;
|
||||
uint8_t *encoder_string;
|
||||
int encoder_string_len;
|
||||
|
||||
if (av_dict_get(ost->st->metadata, "encoder", NULL, 0))
|
||||
return 0;
|
||||
|
||||
encoder_string_len = sizeof(LIBAVCODEC_IDENT) + strlen(cname) + 2;
|
||||
encoder_string = av_mallocz(encoder_string_len);
|
||||
if (!encoder_string)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (!of->bitexact && !ost->bitexact)
|
||||
av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len);
|
||||
else
|
||||
av_strlcpy(encoder_string, "Lavc ", encoder_string_len);
|
||||
av_strlcat(encoder_string, cname, encoder_string_len);
|
||||
av_dict_set(&ost->st->metadata, "encoder", encoder_string,
|
||||
AV_DICT_DONT_STRDUP_VAL | AV_DICT_DONT_OVERWRITE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int enc_open(OutputStream *ost, const AVFrame *frame)
|
||||
{
|
||||
InputStream *ist = ost->ist;
|
||||
Encoder *e = ost->enc;
|
||||
AVCodecContext *enc_ctx = ost->enc_ctx;
|
||||
AVCodecContext *dec_ctx = NULL;
|
||||
const AVCodec *enc = enc_ctx->codec;
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
FrameData *fd;
|
||||
int ret;
|
||||
|
||||
if (e->opened)
|
||||
return 0;
|
||||
|
||||
// frame is always non-NULL for audio and video
|
||||
av_assert0(frame || (enc->type != AVMEDIA_TYPE_VIDEO && enc->type != AVMEDIA_TYPE_AUDIO));
|
||||
|
||||
if (frame) {
|
||||
av_assert0(frame->opaque_ref);
|
||||
fd = (FrameData*)frame->opaque_ref->data;
|
||||
}
|
||||
|
||||
ret = set_encoder_id(output_files[ost->file_index], ost);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ist) {
|
||||
dec_ctx = ist->dec_ctx;
|
||||
}
|
||||
|
||||
// the timebase is chosen by filtering code
|
||||
if (ost->type == AVMEDIA_TYPE_AUDIO || ost->type == AVMEDIA_TYPE_VIDEO) {
|
||||
enc_ctx->time_base = frame->time_base;
|
||||
enc_ctx->framerate = fd->frame_rate_filter;
|
||||
ost->st->avg_frame_rate = fd->frame_rate_filter;
|
||||
}
|
||||
|
||||
switch (enc_ctx->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
enc_ctx->sample_fmt = frame->format;
|
||||
enc_ctx->sample_rate = frame->sample_rate;
|
||||
ret = av_channel_layout_copy(&enc_ctx->ch_layout, &frame->ch_layout);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ost->bits_per_raw_sample)
|
||||
enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
|
||||
else
|
||||
enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample,
|
||||
av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3);
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_VIDEO: {
|
||||
enc_ctx->width = frame->width;
|
||||
enc_ctx->height = frame->height;
|
||||
enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio =
|
||||
ost->frame_aspect_ratio.num ? // overridden by the -aspect cli option
|
||||
av_mul_q(ost->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) :
|
||||
frame->sample_aspect_ratio;
|
||||
|
||||
enc_ctx->pix_fmt = frame->format;
|
||||
|
||||
if (ost->bits_per_raw_sample)
|
||||
enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
|
||||
else
|
||||
enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample,
|
||||
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
|
||||
|
||||
enc_ctx->color_range = frame->color_range;
|
||||
enc_ctx->color_primaries = frame->color_primaries;
|
||||
enc_ctx->color_trc = frame->color_trc;
|
||||
enc_ctx->colorspace = frame->colorspace;
|
||||
enc_ctx->chroma_sample_location = frame->chroma_location;
|
||||
|
||||
if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) ||
|
||||
(frame->flags & AV_FRAME_FLAG_INTERLACED)
|
||||
#if FFMPEG_OPT_TOP
|
||||
|| ost->top_field_first >= 0
|
||||
#endif
|
||||
) {
|
||||
int top_field_first =
|
||||
#if FFMPEG_OPT_TOP
|
||||
ost->top_field_first >= 0 ?
|
||||
ost->top_field_first :
|
||||
#endif
|
||||
!!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
|
||||
|
||||
if (enc->id == AV_CODEC_ID_MJPEG)
|
||||
enc_ctx->field_order = top_field_first ? AV_FIELD_TT : AV_FIELD_BB;
|
||||
else
|
||||
enc_ctx->field_order = top_field_first ? AV_FIELD_TB : AV_FIELD_BT;
|
||||
} else
|
||||
enc_ctx->field_order = AV_FIELD_PROGRESSIVE;
|
||||
|
||||
break;
|
||||
}
|
||||
case AVMEDIA_TYPE_SUBTITLE:
|
||||
if (ost->enc_timebase.num)
|
||||
av_log(ost, AV_LOG_WARNING,
|
||||
"-enc_time_base not supported for subtitles, ignoring\n");
|
||||
enc_ctx->time_base = AV_TIME_BASE_Q;
|
||||
|
||||
if (!enc_ctx->width) {
|
||||
enc_ctx->width = ost->ist->par->width;
|
||||
enc_ctx->height = ost->ist->par->height;
|
||||
}
|
||||
if (dec_ctx && dec_ctx->subtitle_header) {
|
||||
/* ASS code assumes this buffer is null terminated so add extra byte. */
|
||||
enc_ctx->subtitle_header = av_mallocz(dec_ctx->subtitle_header_size + 1);
|
||||
if (!enc_ctx->subtitle_header)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(enc_ctx->subtitle_header, dec_ctx->subtitle_header,
|
||||
dec_ctx->subtitle_header_size);
|
||||
enc_ctx->subtitle_header_size = dec_ctx->subtitle_header_size;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
av_assert0(0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ost->bitexact)
|
||||
enc_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
|
||||
|
||||
if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
|
||||
av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
|
||||
|
||||
if (enc->capabilities & AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE) {
|
||||
ret = av_dict_set(&ost->encoder_opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
av_dict_set(&ost->encoder_opts, "flags", "+frame_duration", AV_DICT_MULTIKEY);
|
||||
|
||||
ret = hw_device_setup_for_encode(ost, frame ? frame->hw_frames_ctx : NULL);
|
||||
if (ret < 0) {
|
||||
av_log(ost, AV_LOG_ERROR,
|
||||
"Encoding hardware device setup failed: %s\n", av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = avcodec_open2(ost->enc_ctx, enc, &ost->encoder_opts)) < 0) {
|
||||
if (ret != AVERROR_EXPERIMENTAL)
|
||||
av_log(ost, AV_LOG_ERROR, "Error while opening encoder - maybe "
|
||||
"incorrect parameters such as bit_rate, rate, width or height.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
e->opened = 1;
|
||||
|
||||
if (ost->sq_idx_encode >= 0) {
|
||||
e->sq_frame = av_frame_alloc();
|
||||
if (!e->sq_frame)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (ost->enc_ctx->frame_size) {
|
||||
av_assert0(ost->sq_idx_encode >= 0);
|
||||
sq_frame_samples(output_files[ost->file_index]->sq_encode,
|
||||
ost->sq_idx_encode, ost->enc_ctx->frame_size);
|
||||
}
|
||||
|
||||
ret = check_avoptions(ost->encoder_opts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000 &&
|
||||
ost->enc_ctx->codec_id != AV_CODEC_ID_CODEC2 /* don't complain about 700 bit/s modes */)
|
||||
av_log(ost, AV_LOG_WARNING, "The bitrate parameter is set too low."
|
||||
" It takes bits/s as argument, not kbits/s\n");
|
||||
|
||||
ret = avcodec_parameters_from_context(ost->par_in, ost->enc_ctx);
|
||||
if (ret < 0) {
|
||||
av_log(ost, AV_LOG_FATAL,
|
||||
"Error initializing the output stream codec context.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add global input side data. For now this is naive, and copies it
|
||||
* from the input stream's global side data. All side data should
|
||||
* really be funneled over AVFrame and libavfilter, then added back to
|
||||
* packet side data, and then potentially using the first packet for
|
||||
* global side data.
|
||||
*/
|
||||
if (ist) {
|
||||
int i;
|
||||
for (i = 0; i < ist->st->codecpar->nb_coded_side_data; i++) {
|
||||
AVPacketSideData *sd_src = &ist->st->codecpar->coded_side_data[i];
|
||||
if (sd_src->type != AV_PKT_DATA_CPB_PROPERTIES) {
|
||||
AVPacketSideData *sd_dst = av_packet_side_data_new(&ost->par_in->coded_side_data,
|
||||
&ost->par_in->nb_coded_side_data,
|
||||
sd_src->type, sd_src->size, 0);
|
||||
if (!sd_dst)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(sd_dst->data, sd_src->data, sd_src->size);
|
||||
if (ist->autorotate && sd_src->type == AV_PKT_DATA_DISPLAYMATRIX)
|
||||
av_display_rotation_set((int32_t *)sd_dst->data, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// copy timebase while removing common factors
|
||||
if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0)
|
||||
ost->st->time_base = av_add_q(ost->enc_ctx->time_base, (AVRational){0, 1});
|
||||
|
||||
ret = of_stream_init(of, ost);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_recording_time(OutputStream *ost, int64_t ts, AVRational tb)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
|
||||
if (of->recording_time != INT64_MAX &&
|
||||
av_compare_ts(ts, tb, of->recording_time, AV_TIME_BASE_Q) >= 0) {
|
||||
close_output_stream(ost);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub)
|
||||
{
|
||||
Encoder *e = ost->enc;
|
||||
int subtitle_out_max_size = 1024 * 1024;
|
||||
int subtitle_out_size, nb, i, ret;
|
||||
AVCodecContext *enc;
|
||||
AVPacket *pkt = e->pkt;
|
||||
int64_t pts;
|
||||
|
||||
if (sub->pts == AV_NOPTS_VALUE) {
|
||||
av_log(ost, AV_LOG_ERROR, "Subtitle packets must have a pts\n");
|
||||
return exit_on_error ? AVERROR(EINVAL) : 0;
|
||||
}
|
||||
if (ost->finished ||
|
||||
(of->start_time != AV_NOPTS_VALUE && sub->pts < of->start_time))
|
||||
return 0;
|
||||
|
||||
enc = ost->enc_ctx;
|
||||
|
||||
/* Note: DVB subtitle need one packet to draw them and one other
|
||||
packet to clear them */
|
||||
/* XXX: signal it in the codec context ? */
|
||||
if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE)
|
||||
nb = 2;
|
||||
else if (enc->codec_id == AV_CODEC_ID_ASS)
|
||||
nb = FFMAX(sub->num_rects, 1);
|
||||
else
|
||||
nb = 1;
|
||||
|
||||
/* shift timestamp to honor -ss and make check_recording_time() work with -t */
|
||||
pts = sub->pts;
|
||||
if (output_files[ost->file_index]->start_time != AV_NOPTS_VALUE)
|
||||
pts -= output_files[ost->file_index]->start_time;
|
||||
for (i = 0; i < nb; i++) {
|
||||
AVSubtitle local_sub = *sub;
|
||||
|
||||
if (!check_recording_time(ost, pts, AV_TIME_BASE_Q))
|
||||
return 0;
|
||||
|
||||
ret = av_new_packet(pkt, subtitle_out_max_size);
|
||||
if (ret < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
local_sub.pts = pts;
|
||||
// start_display_time is required to be 0
|
||||
local_sub.pts += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, AV_TIME_BASE_Q);
|
||||
local_sub.end_display_time -= sub->start_display_time;
|
||||
local_sub.start_display_time = 0;
|
||||
|
||||
if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE && i == 1)
|
||||
local_sub.num_rects = 0;
|
||||
else if (enc->codec_id == AV_CODEC_ID_ASS && sub->num_rects > 0) {
|
||||
local_sub.num_rects = 1;
|
||||
local_sub.rects += i;
|
||||
}
|
||||
|
||||
ost->frames_encoded++;
|
||||
|
||||
subtitle_out_size = avcodec_encode_subtitle(enc, pkt->data, pkt->size, &local_sub);
|
||||
if (subtitle_out_size < 0) {
|
||||
av_log(ost, AV_LOG_FATAL, "Subtitle encoding failed\n");
|
||||
return subtitle_out_size;
|
||||
}
|
||||
|
||||
av_shrink_packet(pkt, subtitle_out_size);
|
||||
pkt->time_base = AV_TIME_BASE_Q;
|
||||
pkt->pts = sub->pts;
|
||||
pkt->duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, pkt->time_base);
|
||||
if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
|
||||
/* XXX: the pts correction is handled here. Maybe handling
|
||||
it in the codec would be better */
|
||||
if (i == 0)
|
||||
pkt->pts += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, pkt->time_base);
|
||||
else
|
||||
pkt->pts += av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, pkt->time_base);
|
||||
}
|
||||
pkt->dts = pkt->pts;
|
||||
|
||||
ret = of_output_packet(of, ost, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void enc_stats_write(OutputStream *ost, EncStats *es,
|
||||
const AVFrame *frame, const AVPacket *pkt,
|
||||
uint64_t frame_num)
|
||||
{
|
||||
Encoder *e = ost->enc;
|
||||
AVIOContext *io = es->io;
|
||||
AVRational tb = frame ? frame->time_base : pkt->time_base;
|
||||
int64_t pts = frame ? frame->pts : pkt->pts;
|
||||
|
||||
AVRational tbi = (AVRational){ 0, 1};
|
||||
int64_t ptsi = INT64_MAX;
|
||||
|
||||
const FrameData *fd;
|
||||
|
||||
if ((frame && frame->opaque_ref) || (pkt && pkt->opaque_ref)) {
|
||||
fd = (const FrameData*)(frame ? frame->opaque_ref->data : pkt->opaque_ref->data);
|
||||
tbi = fd->dec.tb;
|
||||
ptsi = fd->dec.pts;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < es->nb_components; i++) {
|
||||
const EncStatsComponent *c = &es->components[i];
|
||||
|
||||
switch (c->type) {
|
||||
case ENC_STATS_LITERAL: avio_write (io, c->str, c->str_len); continue;
|
||||
case ENC_STATS_FILE_IDX: avio_printf(io, "%d", ost->file_index); continue;
|
||||
case ENC_STATS_STREAM_IDX: avio_printf(io, "%d", ost->index); continue;
|
||||
case ENC_STATS_TIMEBASE: avio_printf(io, "%d/%d", tb.num, tb.den); continue;
|
||||
case ENC_STATS_TIMEBASE_IN: avio_printf(io, "%d/%d", tbi.num, tbi.den); continue;
|
||||
case ENC_STATS_PTS: avio_printf(io, "%"PRId64, pts); continue;
|
||||
case ENC_STATS_PTS_IN: avio_printf(io, "%"PRId64, ptsi); continue;
|
||||
case ENC_STATS_PTS_TIME: avio_printf(io, "%g", pts * av_q2d(tb)); continue;
|
||||
case ENC_STATS_PTS_TIME_IN: avio_printf(io, "%g", ptsi == INT64_MAX ?
|
||||
INFINITY : ptsi * av_q2d(tbi)); continue;
|
||||
case ENC_STATS_FRAME_NUM: avio_printf(io, "%"PRIu64, frame_num); continue;
|
||||
case ENC_STATS_FRAME_NUM_IN: avio_printf(io, "%"PRIu64, fd ? fd->dec.frame_num : -1); continue;
|
||||
}
|
||||
|
||||
if (frame) {
|
||||
switch (c->type) {
|
||||
case ENC_STATS_SAMPLE_NUM: avio_printf(io, "%"PRIu64, ost->samples_encoded); continue;
|
||||
case ENC_STATS_NB_SAMPLES: avio_printf(io, "%d", frame->nb_samples); continue;
|
||||
default: av_assert0(0);
|
||||
}
|
||||
} else {
|
||||
switch (c->type) {
|
||||
case ENC_STATS_DTS: avio_printf(io, "%"PRId64, pkt->dts); continue;
|
||||
case ENC_STATS_DTS_TIME: avio_printf(io, "%g", pkt->dts * av_q2d(tb)); continue;
|
||||
case ENC_STATS_PKT_SIZE: avio_printf(io, "%d", pkt->size); continue;
|
||||
case ENC_STATS_BITRATE: {
|
||||
double duration = FFMAX(pkt->duration, 1) * av_q2d(tb);
|
||||
avio_printf(io, "%g", 8.0 * pkt->size / duration);
|
||||
continue;
|
||||
}
|
||||
case ENC_STATS_AVG_BITRATE: {
|
||||
double duration = pkt->dts * av_q2d(tb);
|
||||
avio_printf(io, "%g", duration > 0 ? 8.0 * e->data_size / duration : -1.);
|
||||
continue;
|
||||
}
|
||||
default: av_assert0(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
avio_w8(io, '\n');
|
||||
avio_flush(io);
|
||||
}
|
||||
|
||||
static inline double psnr(double d)
|
||||
{
|
||||
return -10.0 * log10(d);
|
||||
}
|
||||
|
||||
static int update_video_stats(OutputStream *ost, const AVPacket *pkt, int write_vstats)
|
||||
{
|
||||
Encoder *e = ost->enc;
|
||||
const uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS,
|
||||
NULL);
|
||||
AVCodecContext *enc = ost->enc_ctx;
|
||||
enum AVPictureType pict_type;
|
||||
int64_t frame_number;
|
||||
double ti1, bitrate, avg_bitrate;
|
||||
double psnr_val = -1;
|
||||
|
||||
ost->quality = sd ? AV_RL32(sd) : -1;
|
||||
pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE;
|
||||
|
||||
if ((enc->flags & AV_CODEC_FLAG_PSNR) && sd && sd[5]) {
|
||||
// FIXME the scaling assumes 8bit
|
||||
double error = AV_RL64(sd + 8) / (enc->width * enc->height * 255.0 * 255.0);
|
||||
if (error >= 0 && error <= 1)
|
||||
psnr_val = psnr(error);
|
||||
}
|
||||
|
||||
if (!write_vstats)
|
||||
return 0;
|
||||
|
||||
/* this is executed just the first time update_video_stats is called */
|
||||
if (!vstats_file) {
|
||||
vstats_file = fopen(vstats_filename, "w");
|
||||
if (!vstats_file) {
|
||||
perror("fopen");
|
||||
return AVERROR(errno);
|
||||
}
|
||||
}
|
||||
|
||||
frame_number = e->packets_encoded;
|
||||
if (vstats_version <= 1) {
|
||||
fprintf(vstats_file, "frame= %5"PRId64" q= %2.1f ", frame_number,
|
||||
ost->quality / (float)FF_QP2LAMBDA);
|
||||
} else {
|
||||
fprintf(vstats_file, "out= %2d st= %2d frame= %5"PRId64" q= %2.1f ", ost->file_index, ost->index, frame_number,
|
||||
ost->quality / (float)FF_QP2LAMBDA);
|
||||
}
|
||||
|
||||
if (psnr_val >= 0)
|
||||
fprintf(vstats_file, "PSNR= %6.2f ", psnr_val);
|
||||
|
||||
fprintf(vstats_file,"f_size= %6d ", pkt->size);
|
||||
/* compute pts value */
|
||||
ti1 = pkt->dts * av_q2d(pkt->time_base);
|
||||
if (ti1 < 0.01)
|
||||
ti1 = 0.01;
|
||||
|
||||
bitrate = (pkt->size * 8) / av_q2d(enc->time_base) / 1000.0;
|
||||
avg_bitrate = (double)(e->data_size * 8) / ti1 / 1000.0;
|
||||
fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
|
||||
(double)e->data_size / 1024, ti1, bitrate, avg_bitrate);
|
||||
fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(pict_type));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
|
||||
{
|
||||
Encoder *e = ost->enc;
|
||||
AVCodecContext *enc = ost->enc_ctx;
|
||||
AVPacket *pkt = e->pkt;
|
||||
const char *type_desc = av_get_media_type_string(enc->codec_type);
|
||||
const char *action = frame ? "encode" : "flush";
|
||||
int ret;
|
||||
|
||||
if (frame) {
|
||||
if (ost->enc_stats_pre.io)
|
||||
enc_stats_write(ost, &ost->enc_stats_pre, frame, NULL,
|
||||
ost->frames_encoded);
|
||||
|
||||
ost->frames_encoded++;
|
||||
ost->samples_encoded += frame->nb_samples;
|
||||
|
||||
if (debug_ts) {
|
||||
av_log(ost, AV_LOG_INFO, "encoder <- type:%s "
|
||||
"frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
|
||||
type_desc,
|
||||
av_ts2str(frame->pts), av_ts2timestr(frame->pts, &enc->time_base),
|
||||
enc->time_base.num, enc->time_base.den);
|
||||
}
|
||||
|
||||
if (frame->sample_aspect_ratio.num && !ost->frame_aspect_ratio.num)
|
||||
enc->sample_aspect_ratio = frame->sample_aspect_ratio;
|
||||
}
|
||||
|
||||
update_benchmark(NULL);
|
||||
|
||||
ret = avcodec_send_frame(enc, frame);
|
||||
if (ret < 0 && !(ret == AVERROR_EOF && !frame)) {
|
||||
av_log(ost, AV_LOG_ERROR, "Error submitting %s frame to the encoder\n",
|
||||
type_desc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
av_packet_unref(pkt);
|
||||
|
||||
ret = avcodec_receive_packet(enc, pkt);
|
||||
update_benchmark("%s_%s %d.%d", action, type_desc,
|
||||
ost->file_index, ost->index);
|
||||
|
||||
pkt->time_base = enc->time_base;
|
||||
|
||||
/* if two pass, output log on success and EOF */
|
||||
if ((ret >= 0 || ret == AVERROR_EOF) && ost->logfile && enc->stats_out)
|
||||
fprintf(ost->logfile, "%s", enc->stats_out);
|
||||
|
||||
if (ret == AVERROR(EAGAIN)) {
|
||||
av_assert0(frame); // should never happen during flushing
|
||||
return 0;
|
||||
} else if (ret == AVERROR_EOF) {
|
||||
ret = of_output_packet(of, ost, NULL);
|
||||
return ret < 0 ? ret : AVERROR_EOF;
|
||||
} else if (ret < 0) {
|
||||
av_log(ost, AV_LOG_ERROR, "%s encoding failed\n", type_desc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
ret = update_video_stats(ost, pkt, !!vstats_filename);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (ost->enc_stats_post.io)
|
||||
enc_stats_write(ost, &ost->enc_stats_post, NULL, pkt,
|
||||
e->packets_encoded);
|
||||
|
||||
if (debug_ts) {
|
||||
av_log(ost, AV_LOG_INFO, "encoder -> type:%s "
|
||||
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s "
|
||||
"duration:%s duration_time:%s\n",
|
||||
type_desc,
|
||||
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &enc->time_base),
|
||||
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &enc->time_base),
|
||||
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &enc->time_base));
|
||||
}
|
||||
|
||||
if ((ret = trigger_fix_sub_duration_heartbeat(ost, pkt)) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Subtitle heartbeat logic failed in %s! (%s)\n",
|
||||
__func__, av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
e->data_size += pkt->size;
|
||||
|
||||
e->packets_encoded++;
|
||||
|
||||
ret = of_output_packet(of, ost, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
av_assert0(0);
|
||||
}
|
||||
|
||||
static int submit_encode_frame(OutputFile *of, OutputStream *ost,
|
||||
AVFrame *frame)
|
||||
{
|
||||
Encoder *e = ost->enc;
|
||||
int ret;
|
||||
|
||||
if (ost->sq_idx_encode < 0)
|
||||
return encode_frame(of, ost, frame);
|
||||
|
||||
if (frame) {
|
||||
ret = av_frame_ref(e->sq_frame, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
frame = e->sq_frame;
|
||||
}
|
||||
|
||||
ret = sq_send(of->sq_encode, ost->sq_idx_encode,
|
||||
SQFRAME(frame));
|
||||
if (ret < 0) {
|
||||
if (frame)
|
||||
av_frame_unref(frame);
|
||||
if (ret != AVERROR_EOF)
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
AVFrame *enc_frame = e->sq_frame;
|
||||
|
||||
ret = sq_receive(of->sq_encode, ost->sq_idx_encode,
|
||||
SQFRAME(enc_frame));
|
||||
if (ret == AVERROR_EOF) {
|
||||
enc_frame = NULL;
|
||||
} else if (ret < 0) {
|
||||
return (ret == AVERROR(EAGAIN)) ? 0 : ret;
|
||||
}
|
||||
|
||||
ret = encode_frame(of, ost, enc_frame);
|
||||
if (enc_frame)
|
||||
av_frame_unref(enc_frame);
|
||||
if (ret < 0) {
|
||||
if (ret == AVERROR_EOF)
|
||||
close_output_stream(ost);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int do_audio_out(OutputFile *of, OutputStream *ost,
|
||||
AVFrame *frame)
|
||||
{
|
||||
AVCodecContext *enc = ost->enc_ctx;
|
||||
int ret;
|
||||
|
||||
if (!(enc->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) &&
|
||||
enc->ch_layout.nb_channels != frame->ch_layout.nb_channels) {
|
||||
av_log(ost, AV_LOG_ERROR,
|
||||
"Audio channel count changed and encoder does not support parameter changes\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!check_recording_time(ost, frame->pts, frame->time_base))
|
||||
return 0;
|
||||
|
||||
ret = submit_encode_frame(of, ost, frame);
|
||||
return (ret < 0 && ret != AVERROR_EOF) ? ret : 0;
|
||||
}
|
||||
|
||||
static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf,
|
||||
AVRational tb, const AVFrame *in_picture)
|
||||
{
|
||||
double pts_time;
|
||||
|
||||
if (kf->ref_pts == AV_NOPTS_VALUE)
|
||||
kf->ref_pts = in_picture->pts;
|
||||
|
||||
pts_time = (in_picture->pts - kf->ref_pts) * av_q2d(tb);
|
||||
if (kf->index < kf->nb_pts &&
|
||||
av_compare_ts(in_picture->pts, tb, kf->pts[kf->index], AV_TIME_BASE_Q) >= 0) {
|
||||
kf->index++;
|
||||
goto force_keyframe;
|
||||
} else if (kf->pexpr) {
|
||||
double res;
|
||||
kf->expr_const_values[FKF_T] = pts_time;
|
||||
res = av_expr_eval(kf->pexpr,
|
||||
kf->expr_const_values, NULL);
|
||||
av_log(logctx, AV_LOG_TRACE,
|
||||
"force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n",
|
||||
kf->expr_const_values[FKF_N],
|
||||
kf->expr_const_values[FKF_N_FORCED],
|
||||
kf->expr_const_values[FKF_PREV_FORCED_N],
|
||||
kf->expr_const_values[FKF_T],
|
||||
kf->expr_const_values[FKF_PREV_FORCED_T],
|
||||
res);
|
||||
|
||||
kf->expr_const_values[FKF_N] += 1;
|
||||
|
||||
if (res) {
|
||||
kf->expr_const_values[FKF_PREV_FORCED_N] = kf->expr_const_values[FKF_N] - 1;
|
||||
kf->expr_const_values[FKF_PREV_FORCED_T] = kf->expr_const_values[FKF_T];
|
||||
kf->expr_const_values[FKF_N_FORCED] += 1;
|
||||
goto force_keyframe;
|
||||
}
|
||||
} else if (kf->type == KF_FORCE_SOURCE && (in_picture->flags & AV_FRAME_FLAG_KEY)) {
|
||||
goto force_keyframe;
|
||||
}
|
||||
|
||||
return AV_PICTURE_TYPE_NONE;
|
||||
|
||||
force_keyframe:
|
||||
av_log(logctx, AV_LOG_DEBUG, "Forced keyframe at time %f\n", pts_time);
|
||||
return AV_PICTURE_TYPE_I;
|
||||
}
|
||||
|
||||
/* May modify/reset frame */
|
||||
static int do_video_out(OutputFile *of, OutputStream *ost, AVFrame *in_picture)
|
||||
{
|
||||
int ret;
|
||||
AVCodecContext *enc = ost->enc_ctx;
|
||||
|
||||
if (!check_recording_time(ost, in_picture->pts, ost->enc_ctx->time_base))
|
||||
return 0;
|
||||
|
||||
in_picture->quality = enc->global_quality;
|
||||
in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture);
|
||||
|
||||
#if FFMPEG_OPT_TOP
|
||||
if (ost->top_field_first >= 0) {
|
||||
in_picture->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
|
||||
in_picture->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * (!!ost->top_field_first);
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = submit_encode_frame(of, ost, in_picture);
|
||||
return (ret == AVERROR_EOF) ? 0 : ret;
|
||||
}
|
||||
|
||||
int enc_frame(OutputStream *ost, AVFrame *frame)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
int ret;
|
||||
|
||||
ret = enc_open(ost, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO ?
|
||||
do_video_out(of, ost, frame) : do_audio_out(of, ost, frame);
|
||||
}
|
||||
|
||||
int enc_flush(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
if (ost->sq_idx_encode >= 0)
|
||||
sq_send(of->sq_encode, ost->sq_idx_encode, SQFRAME(NULL));
|
||||
}
|
||||
|
||||
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
|
||||
Encoder *e = ost->enc;
|
||||
AVCodecContext *enc = ost->enc_ctx;
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
|
||||
if (!enc || !e->opened ||
|
||||
(enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO))
|
||||
continue;
|
||||
|
||||
ret = submit_encode_frame(of, ost, NULL);
|
||||
if (ret != AVERROR_EOF)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@
|
||||
static int nb_hw_devices;
|
||||
static HWDevice **hw_devices;
|
||||
|
||||
HWDevice *hw_device_get_by_type(enum AVHWDeviceType type)
|
||||
static HWDevice *hw_device_get_by_type(enum AVHWDeviceType type)
|
||||
{
|
||||
HWDevice *found = NULL;
|
||||
int i;
|
||||
@@ -242,9 +242,9 @@ fail:
|
||||
goto done;
|
||||
}
|
||||
|
||||
int hw_device_init_from_type(enum AVHWDeviceType type,
|
||||
const char *device,
|
||||
HWDevice **dev_out)
|
||||
static int hw_device_init_from_type(enum AVHWDeviceType type,
|
||||
const char *device,
|
||||
HWDevice **dev_out)
|
||||
{
|
||||
AVBufferRef *device_ref = NULL;
|
||||
HWDevice *dev;
|
||||
@@ -297,7 +297,207 @@ void hw_device_free_all(void)
|
||||
nb_hw_devices = 0;
|
||||
}
|
||||
|
||||
int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
|
||||
static HWDevice *hw_device_match_by_codec(const AVCodec *codec)
|
||||
{
|
||||
const AVCodecHWConfig *config;
|
||||
HWDevice *dev;
|
||||
int i;
|
||||
for (i = 0;; i++) {
|
||||
config = avcodec_get_hw_config(codec, i);
|
||||
if (!config)
|
||||
return NULL;
|
||||
if (!(config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX))
|
||||
continue;
|
||||
dev = hw_device_get_by_type(config->device_type);
|
||||
if (dev)
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
|
||||
int hw_device_setup_for_decode(InputStream *ist)
|
||||
{
|
||||
const AVCodecHWConfig *config;
|
||||
enum AVHWDeviceType type;
|
||||
HWDevice *dev = NULL;
|
||||
int err, auto_device = 0;
|
||||
|
||||
if (ist->hwaccel_device) {
|
||||
dev = hw_device_get_by_name(ist->hwaccel_device);
|
||||
if (!dev) {
|
||||
if (ist->hwaccel_id == HWACCEL_AUTO) {
|
||||
auto_device = 1;
|
||||
} else if (ist->hwaccel_id == HWACCEL_GENERIC) {
|
||||
type = ist->hwaccel_device_type;
|
||||
err = hw_device_init_from_type(type, ist->hwaccel_device,
|
||||
&dev);
|
||||
} else {
|
||||
// This will be dealt with by API-specific initialisation
|
||||
// (using hwaccel_device), so nothing further needed here.
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (ist->hwaccel_id == HWACCEL_AUTO) {
|
||||
ist->hwaccel_device_type = dev->type;
|
||||
} else if (ist->hwaccel_device_type != dev->type) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid hwaccel device "
|
||||
"specified for decoder: device %s of type %s is not "
|
||||
"usable with hwaccel %s.\n", dev->name,
|
||||
av_hwdevice_get_type_name(dev->type),
|
||||
av_hwdevice_get_type_name(ist->hwaccel_device_type));
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ist->hwaccel_id == HWACCEL_AUTO) {
|
||||
auto_device = 1;
|
||||
} else if (ist->hwaccel_id == HWACCEL_GENERIC) {
|
||||
type = ist->hwaccel_device_type;
|
||||
dev = hw_device_get_by_type(type);
|
||||
|
||||
// When "-qsv_device device" is used, an internal QSV device named
|
||||
// as "__qsv_device" is created. Another QSV device is created too
|
||||
// if "-init_hw_device qsv=name:device" is used. There are 2 QSV devices
|
||||
// if both "-qsv_device device" and "-init_hw_device qsv=name:device"
|
||||
// are used, hw_device_get_by_type(AV_HWDEVICE_TYPE_QSV) returns NULL.
|
||||
// To keep back-compatibility with the removed ad-hoc libmfx setup code,
|
||||
// call hw_device_get_by_name("__qsv_device") to select the internal QSV
|
||||
// device.
|
||||
if (!dev && type == AV_HWDEVICE_TYPE_QSV)
|
||||
dev = hw_device_get_by_name("__qsv_device");
|
||||
|
||||
if (!dev)
|
||||
err = hw_device_init_from_type(type, NULL, &dev);
|
||||
} else {
|
||||
dev = hw_device_match_by_codec(ist->dec);
|
||||
if (!dev) {
|
||||
// No device for this codec, but not using generic hwaccel
|
||||
// and therefore may well not need one - ignore.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (auto_device) {
|
||||
int i;
|
||||
if (!avcodec_get_hw_config(ist->dec, 0)) {
|
||||
// Decoder does not support any hardware devices.
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; !dev; i++) {
|
||||
config = avcodec_get_hw_config(ist->dec, i);
|
||||
if (!config)
|
||||
break;
|
||||
type = config->device_type;
|
||||
dev = hw_device_get_by_type(type);
|
||||
if (dev) {
|
||||
av_log(NULL, AV_LOG_INFO, "Using auto "
|
||||
"hwaccel type %s with existing device %s.\n",
|
||||
av_hwdevice_get_type_name(type), dev->name);
|
||||
}
|
||||
}
|
||||
for (i = 0; !dev; i++) {
|
||||
config = avcodec_get_hw_config(ist->dec, i);
|
||||
if (!config)
|
||||
break;
|
||||
type = config->device_type;
|
||||
// Try to make a new device of this type.
|
||||
err = hw_device_init_from_type(type, ist->hwaccel_device,
|
||||
&dev);
|
||||
if (err < 0) {
|
||||
// Can't make a device of this type.
|
||||
continue;
|
||||
}
|
||||
if (ist->hwaccel_device) {
|
||||
av_log(NULL, AV_LOG_INFO, "Using auto "
|
||||
"hwaccel type %s with new device created "
|
||||
"from %s.\n", av_hwdevice_get_type_name(type),
|
||||
ist->hwaccel_device);
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_INFO, "Using auto "
|
||||
"hwaccel type %s with new default device.\n",
|
||||
av_hwdevice_get_type_name(type));
|
||||
}
|
||||
}
|
||||
if (dev) {
|
||||
ist->hwaccel_device_type = type;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_INFO, "Auto hwaccel "
|
||||
"disabled: no device found.\n");
|
||||
ist->hwaccel_id = HWACCEL_NONE;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dev) {
|
||||
av_log(NULL, AV_LOG_ERROR, "No device available "
|
||||
"for decoder: device type %s needed for codec %s.\n",
|
||||
av_hwdevice_get_type_name(type), ist->dec->name);
|
||||
return err;
|
||||
}
|
||||
|
||||
ist->dec_ctx->hw_device_ctx = av_buffer_ref(dev->device_ref);
|
||||
if (!ist->dec_ctx->hw_device_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hw_device_setup_for_encode(OutputStream *ost)
|
||||
{
|
||||
const AVCodecHWConfig *config;
|
||||
HWDevice *dev = NULL;
|
||||
AVBufferRef *frames_ref = NULL;
|
||||
int i;
|
||||
|
||||
if (ost->filter) {
|
||||
frames_ref = av_buffersink_get_hw_frames_ctx(ost->filter->filter);
|
||||
if (frames_ref &&
|
||||
((AVHWFramesContext*)frames_ref->data)->format ==
|
||||
ost->enc_ctx->pix_fmt) {
|
||||
// Matching format, will try to use hw_frames_ctx.
|
||||
} else {
|
||||
frames_ref = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0;; i++) {
|
||||
config = avcodec_get_hw_config(ost->enc_ctx->codec, i);
|
||||
if (!config)
|
||||
break;
|
||||
|
||||
if (frames_ref &&
|
||||
config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX &&
|
||||
(config->pix_fmt == AV_PIX_FMT_NONE ||
|
||||
config->pix_fmt == ost->enc_ctx->pix_fmt)) {
|
||||
av_log(ost->enc_ctx, AV_LOG_VERBOSE, "Using input "
|
||||
"frames context (format %s) with %s encoder.\n",
|
||||
av_get_pix_fmt_name(ost->enc_ctx->pix_fmt),
|
||||
ost->enc_ctx->codec->name);
|
||||
ost->enc_ctx->hw_frames_ctx = av_buffer_ref(frames_ref);
|
||||
if (!ost->enc_ctx->hw_frames_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!dev &&
|
||||
config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)
|
||||
dev = hw_device_get_by_type(config->device_type);
|
||||
}
|
||||
|
||||
if (dev) {
|
||||
av_log(ost->enc_ctx, AV_LOG_VERBOSE, "Using device %s "
|
||||
"(type %s) with %s encoder.\n", dev->name,
|
||||
av_hwdevice_get_type_name(dev->type), ost->enc_ctx->codec->name);
|
||||
ost->enc_ctx->hw_device_ctx = av_buffer_ref(dev->device_ref);
|
||||
if (!ost->enc_ctx->hw_device_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
} else {
|
||||
// No device required, or no device available.
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
AVFrame *output = NULL;
|
||||
@@ -339,14 +539,26 @@ fail:
|
||||
return err;
|
||||
}
|
||||
|
||||
AVBufferRef *hw_device_for_filter(void)
|
||||
int hwaccel_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
|
||||
ist->hwaccel_retrieve_data = &hwaccel_retrieve_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hw_device_setup_for_filter(FilterGraph *fg)
|
||||
{
|
||||
HWDevice *dev;
|
||||
int i;
|
||||
|
||||
// Pick the last hardware device if the user doesn't pick the device for
|
||||
// filters explicitly with the filter_hw_device option.
|
||||
if (filter_hw_device)
|
||||
return filter_hw_device->device_ref;
|
||||
dev = filter_hw_device;
|
||||
else if (nb_hw_devices > 0) {
|
||||
HWDevice *dev = hw_devices[nb_hw_devices - 1];
|
||||
dev = hw_devices[nb_hw_devices - 1];
|
||||
|
||||
if (nb_hw_devices > 1)
|
||||
av_log(NULL, AV_LOG_WARNING, "There are %d hardware devices. device "
|
||||
@@ -355,9 +567,17 @@ AVBufferRef *hw_device_for_filter(void)
|
||||
"%s is not usable for filters.\n",
|
||||
nb_hw_devices, dev->name,
|
||||
av_hwdevice_get_type_name(dev->type), dev->name);
|
||||
} else
|
||||
dev = NULL;
|
||||
|
||||
return dev->device_ref;
|
||||
if (dev) {
|
||||
for (i = 0; i < fg->graph->nb_filters; i++) {
|
||||
fg->graph->filters[i]->hw_device_ctx =
|
||||
av_buffer_ref(dev->device_ref);
|
||||
if (!fg->graph->filters[i]->hw_device_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "ffmpeg.h"
|
||||
#include "ffmpeg_mux.h"
|
||||
#include "ffmpeg_utils.h"
|
||||
#include "objpool.h"
|
||||
#include "sync_queue.h"
|
||||
#include "thread_queue.h"
|
||||
@@ -63,6 +62,7 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
|
||||
{
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
AVFormatContext *s = mux->fc;
|
||||
AVStream *st = ost->st;
|
||||
int64_t fs;
|
||||
uint64_t frame_num;
|
||||
int ret;
|
||||
@@ -74,26 +74,19 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ost->type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP)
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP)
|
||||
pkt->pts = pkt->dts = AV_NOPTS_VALUE;
|
||||
|
||||
// rescale timestamps to the stream timebase
|
||||
if (ost->type == AVMEDIA_TYPE_AUDIO && !ost->enc) {
|
||||
// use av_rescale_delta() for streamcopying audio, to preserve
|
||||
// accuracy with coarse input timebases
|
||||
int duration = av_get_audio_frame_duration2(ost->st->codecpar, pkt->size);
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (ost->frame_rate.num && ost->is_cfr) {
|
||||
if (pkt->duration > 0)
|
||||
av_log(ost, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n");
|
||||
pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
|
||||
pkt->time_base);
|
||||
}
|
||||
}
|
||||
|
||||
if (!duration)
|
||||
duration = ost->st->codecpar->frame_size;
|
||||
|
||||
pkt->dts = av_rescale_delta(pkt->time_base, pkt->dts,
|
||||
(AVRational){1, ost->st->codecpar->sample_rate}, duration,
|
||||
&ms->ts_rescale_delta_last, ost->st->time_base);
|
||||
pkt->pts = pkt->dts;
|
||||
|
||||
pkt->duration = av_rescale_q(pkt->duration, pkt->time_base, ost->st->time_base);
|
||||
} else
|
||||
av_packet_rescale_ts(pkt, pkt->time_base, ost->st->time_base);
|
||||
av_packet_rescale_ts(pkt, pkt->time_base, ost->st->time_base);
|
||||
pkt->time_base = ost->st->time_base;
|
||||
|
||||
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
|
||||
@@ -108,15 +101,15 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
|
||||
- FFMIN3(pkt->pts, pkt->dts, ms->last_mux_dts + 1)
|
||||
- FFMAX3(pkt->pts, pkt->dts, ms->last_mux_dts + 1);
|
||||
}
|
||||
if ((ost->type == AVMEDIA_TYPE_AUDIO || ost->type == AVMEDIA_TYPE_VIDEO || ost->type == AVMEDIA_TYPE_SUBTITLE) &&
|
||||
if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) &&
|
||||
pkt->dts != AV_NOPTS_VALUE &&
|
||||
ms->last_mux_dts != AV_NOPTS_VALUE) {
|
||||
int64_t max = ms->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT);
|
||||
if (pkt->dts < max) {
|
||||
int loglevel = max - pkt->dts > 2 || ost->type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG;
|
||||
int loglevel = max - pkt->dts > 2 || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG;
|
||||
if (exit_on_error)
|
||||
loglevel = AV_LOG_ERROR;
|
||||
av_log(s, loglevel, "Non-monotonic DTS in output stream "
|
||||
av_log(s, loglevel, "Non-monotonous DTS in output stream "
|
||||
"%d:%d; previous: %"PRId64", current: %"PRId64"; ",
|
||||
ost->file_index, ost->st->index, ms->last_mux_dts, pkt->dts);
|
||||
if (exit_on_error) {
|
||||
@@ -135,7 +128,7 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
|
||||
}
|
||||
ms->last_mux_dts = pkt->dts;
|
||||
|
||||
ms->data_size_mux += pkt->size;
|
||||
ost->data_size_mux += pkt->size;
|
||||
frame_num = atomic_fetch_add(&ost->packets_written, 1);
|
||||
|
||||
pkt->stream_index = ost->index;
|
||||
@@ -143,7 +136,7 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
|
||||
if (debug_ts) {
|
||||
av_log(ost, AV_LOG_INFO, "muxer <- type:%s "
|
||||
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n",
|
||||
av_get_media_type_string(ost->type),
|
||||
av_get_media_type_string(st->codecpar->codec_type),
|
||||
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base),
|
||||
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base),
|
||||
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ost->st->time_base),
|
||||
@@ -156,9 +149,7 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
|
||||
|
||||
ret = av_interleaved_write_frame(s, pkt);
|
||||
if (ret < 0) {
|
||||
av_log(ost, AV_LOG_ERROR,
|
||||
"Error submitting a packet to the muxer: %s\n",
|
||||
av_err2str(ret));
|
||||
print_error("av_interleaved_write_frame()", ret);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -183,14 +174,8 @@ static int sync_queue_process(Muxer *mux, OutputStream *ost, AVPacket *pkt, int
|
||||
|
||||
while (1) {
|
||||
ret = sq_receive(mux->sq_mux, -1, SQPKT(mux->sq_pkt));
|
||||
if (ret < 0) {
|
||||
/* n.b.: We forward EOF from the sync queue, terminating muxing.
|
||||
* This assumes that if a muxing sync queue is present, then all
|
||||
* the streams use it. That is true currently, but may change in
|
||||
* the future, then this code needs to be revisited.
|
||||
*/
|
||||
return ret == AVERROR(EAGAIN) ? 0 : ret;
|
||||
}
|
||||
if (ret < 0)
|
||||
return (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) ? 0 : ret;
|
||||
|
||||
ret = write_packet(mux, of->streams[ret],
|
||||
mux->sq_pkt);
|
||||
@@ -239,15 +224,9 @@ static void *muxer_thread(void *arg)
|
||||
ost = of->streams[stream_idx];
|
||||
ret = sync_queue_process(mux, ost, ret < 0 ? NULL : pkt, &stream_eof);
|
||||
av_packet_unref(pkt);
|
||||
if (ret == AVERROR_EOF) {
|
||||
if (stream_eof) {
|
||||
tq_receive_finish(mux->tq, stream_idx);
|
||||
} else {
|
||||
av_log(mux, AV_LOG_VERBOSE, "Muxer returned EOF\n");
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
} else if (ret < 0) {
|
||||
if (ret == AVERROR_EOF && stream_eof)
|
||||
tq_receive_finish(mux->tq, stream_idx);
|
||||
else if (ret < 0) {
|
||||
av_log(mux, AV_LOG_ERROR, "Error muxing a packet\n");
|
||||
break;
|
||||
}
|
||||
@@ -286,7 +265,7 @@ finish:
|
||||
return ret == AVERROR_EOF ? 0 : ret;
|
||||
}
|
||||
|
||||
static int queue_packet(OutputStream *ost, AVPacket *pkt)
|
||||
static int queue_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
|
||||
{
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
AVPacket *tmp_pkt = NULL;
|
||||
@@ -336,7 +315,7 @@ static int submit_packet(Muxer *mux, AVPacket *pkt, OutputStream *ost)
|
||||
return thread_submit_packet(mux, ost, pkt);
|
||||
} else {
|
||||
/* the muxer is not initialized yet, buffer the packet */
|
||||
ret = queue_packet(ost, pkt);
|
||||
ret = queue_packet(mux, ost, pkt);
|
||||
if (ret < 0) {
|
||||
if (pkt)
|
||||
av_packet_unref(pkt);
|
||||
@@ -347,33 +326,30 @@ static int submit_packet(Muxer *mux, AVPacket *pkt, OutputStream *ost)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||
void of_output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof)
|
||||
{
|
||||
Muxer *mux = mux_from_of(of);
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
const char *err_msg;
|
||||
int ret = 0;
|
||||
|
||||
if (pkt && pkt->dts != AV_NOPTS_VALUE)
|
||||
if (!eof && pkt->dts != AV_NOPTS_VALUE)
|
||||
ost->last_mux_dts = av_rescale_q(pkt->dts, pkt->time_base, AV_TIME_BASE_Q);
|
||||
|
||||
/* apply the output bitstream filters */
|
||||
if (ms->bsf_ctx) {
|
||||
int bsf_eof = 0;
|
||||
|
||||
if (pkt)
|
||||
av_packet_rescale_ts(pkt, pkt->time_base, ms->bsf_ctx->time_base_in);
|
||||
|
||||
ret = av_bsf_send_packet(ms->bsf_ctx, pkt);
|
||||
ret = av_bsf_send_packet(ms->bsf_ctx, eof ? NULL : pkt);
|
||||
if (ret < 0) {
|
||||
err_msg = "submitting a packet for bitstream filtering";
|
||||
goto fail;
|
||||
}
|
||||
|
||||
while (!bsf_eof) {
|
||||
ret = av_bsf_receive_packet(ms->bsf_ctx, ms->bsf_pkt);
|
||||
ret = av_bsf_receive_packet(ms->bsf_ctx, pkt);
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
return 0;
|
||||
return;
|
||||
else if (ret == AVERROR_EOF)
|
||||
bsf_eof = 1;
|
||||
else if (ret < 0) {
|
||||
@@ -381,96 +357,26 @@ int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!bsf_eof)
|
||||
ms->bsf_pkt->time_base = ms->bsf_ctx->time_base_out;
|
||||
|
||||
ret = submit_packet(mux, bsf_eof ? NULL : ms->bsf_pkt, ost);
|
||||
ret = submit_packet(mux, bsf_eof ? NULL : pkt, ost);
|
||||
if (ret < 0)
|
||||
goto mux_fail;
|
||||
}
|
||||
} else {
|
||||
ret = submit_packet(mux, pkt, ost);
|
||||
ret = submit_packet(mux, eof ? NULL : pkt, ost);
|
||||
if (ret < 0)
|
||||
goto mux_fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return;
|
||||
|
||||
mux_fail:
|
||||
err_msg = "submitting a packet to the muxer";
|
||||
|
||||
fail:
|
||||
av_log(ost, AV_LOG_ERROR, "Error %s\n", err_msg);
|
||||
return exit_on_error ? ret : 0;
|
||||
}
|
||||
if (exit_on_error)
|
||||
exit_program(1);
|
||||
|
||||
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
|
||||
int64_t ts_offset;
|
||||
AVPacket *opkt = ms->pkt;
|
||||
int ret;
|
||||
|
||||
av_packet_unref(opkt);
|
||||
|
||||
if (of->recording_time != INT64_MAX &&
|
||||
dts >= of->recording_time + start_time)
|
||||
pkt = NULL;
|
||||
|
||||
// EOF: flush output bitstream filters.
|
||||
if (!pkt)
|
||||
return of_output_packet(of, ost, NULL);
|
||||
|
||||
if (!ms->streamcopy_started && !(pkt->flags & AV_PKT_FLAG_KEY) &&
|
||||
!ms->copy_initial_nonkeyframes)
|
||||
return 0;
|
||||
|
||||
if (!ms->streamcopy_started) {
|
||||
if (!ms->copy_prior_start &&
|
||||
(pkt->pts == AV_NOPTS_VALUE ?
|
||||
dts < ms->ts_copy_start :
|
||||
pkt->pts < av_rescale_q(ms->ts_copy_start, AV_TIME_BASE_Q, pkt->time_base)))
|
||||
return 0;
|
||||
|
||||
if (of->start_time != AV_NOPTS_VALUE && dts < of->start_time)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = av_packet_ref(opkt, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ts_offset = av_rescale_q(start_time, AV_TIME_BASE_Q, opkt->time_base);
|
||||
|
||||
if (pkt->pts != AV_NOPTS_VALUE)
|
||||
opkt->pts -= ts_offset;
|
||||
|
||||
if (pkt->dts == AV_NOPTS_VALUE) {
|
||||
opkt->dts = av_rescale_q(dts, AV_TIME_BASE_Q, opkt->time_base);
|
||||
} else if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
opkt->pts = opkt->dts - ts_offset;
|
||||
}
|
||||
opkt->dts -= ts_offset;
|
||||
|
||||
{
|
||||
int ret = trigger_fix_sub_duration_heartbeat(ost, pkt);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Subtitle heartbeat logic failed in %s! (%s)\n",
|
||||
__func__, av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = of_output_packet(of, ost, opkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ms->streamcopy_started = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int thread_stop(Muxer *mux)
|
||||
@@ -490,6 +396,11 @@ static int thread_stop(Muxer *mux)
|
||||
return (int)(intptr_t)ret;
|
||||
}
|
||||
|
||||
static void pkt_move(void *dst, void *src)
|
||||
{
|
||||
av_packet_move_ref(dst, src);
|
||||
}
|
||||
|
||||
static int thread_start(Muxer *mux)
|
||||
{
|
||||
AVFormatContext *fc = mux->fc;
|
||||
@@ -518,6 +429,10 @@ static int thread_start(Muxer *mux)
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
AVPacket *pkt;
|
||||
|
||||
/* try to improve muxing time_base (only possible if nothing has been written yet) */
|
||||
if (!av_fifo_can_read(ms->muxing_queue))
|
||||
ost->mux_timebase = ost->st->time_base;
|
||||
|
||||
while (av_fifo_read(ms->muxing_queue, &pkt, 1) >= 0) {
|
||||
ret = thread_submit_packet(mux, ost, pkt);
|
||||
if (pkt) {
|
||||
@@ -642,9 +557,9 @@ static int bsf_init(MuxStream *ms)
|
||||
int ret;
|
||||
|
||||
if (!ctx)
|
||||
return avcodec_parameters_copy(ost->st->codecpar, ost->par_in);
|
||||
return 0;
|
||||
|
||||
ret = avcodec_parameters_copy(ctx->par_in, ost->par_in);
|
||||
ret = avcodec_parameters_copy(ctx->par_in, ost->st->codecpar);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -662,10 +577,6 @@ static int bsf_init(MuxStream *ms)
|
||||
return ret;
|
||||
ost->st->time_base = ctx->time_base_out;
|
||||
|
||||
ms->bsf_pkt = av_packet_alloc();
|
||||
if (!ms->bsf_pkt)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -675,6 +586,9 @@ int of_stream_init(OutputFile *of, OutputStream *ost)
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
int ret;
|
||||
|
||||
if (ost->sq_idx_mux >= 0)
|
||||
sq_set_tb(mux->sq_mux, ost->sq_idx_mux, ost->mux_timebase);
|
||||
|
||||
/* initialize bitstream filters for the output stream
|
||||
* needs to be done here, because the codec id for streamcopy is not
|
||||
* known until now */
|
||||
@@ -682,126 +596,16 @@ int of_stream_init(OutputFile *of, OutputStream *ost)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ms->stream_duration) {
|
||||
ost->st->duration = av_rescale_q(ms->stream_duration, ms->stream_duration_tb,
|
||||
ost->st->time_base);
|
||||
}
|
||||
|
||||
ost->initialized = 1;
|
||||
|
||||
return mux_check_init(mux);
|
||||
}
|
||||
|
||||
static int check_written(OutputFile *of)
|
||||
{
|
||||
int64_t total_packets_written = 0;
|
||||
int pass1_used = 1;
|
||||
int ret = 0;
|
||||
|
||||
for (int i = 0; i < of->nb_streams; i++) {
|
||||
OutputStream *ost = of->streams[i];
|
||||
uint64_t packets_written = atomic_load(&ost->packets_written);
|
||||
|
||||
total_packets_written += packets_written;
|
||||
|
||||
if (ost->enc_ctx &&
|
||||
(ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2))
|
||||
!= AV_CODEC_FLAG_PASS1)
|
||||
pass1_used = 0;
|
||||
|
||||
if (!packets_written &&
|
||||
(abort_on_flags & ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM)) {
|
||||
av_log(ost, AV_LOG_FATAL, "Empty output stream\n");
|
||||
ret = err_merge(ret, AVERROR(EINVAL));
|
||||
}
|
||||
}
|
||||
|
||||
if (!total_packets_written) {
|
||||
int level = AV_LOG_WARNING;
|
||||
|
||||
if (abort_on_flags & ABORT_ON_FLAG_EMPTY_OUTPUT) {
|
||||
ret = err_merge(ret, AVERROR(EINVAL));
|
||||
level = AV_LOG_FATAL;
|
||||
}
|
||||
|
||||
av_log(of, level, "Output file is empty, nothing was encoded%s\n",
|
||||
pass1_used ? "" : "(check -ss / -t / -frames parameters if used)");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void mux_final_stats(Muxer *mux)
|
||||
{
|
||||
OutputFile *of = &mux->of;
|
||||
uint64_t total_packets = 0, total_size = 0;
|
||||
uint64_t video_size = 0, audio_size = 0, subtitle_size = 0,
|
||||
extra_size = 0, other_size = 0;
|
||||
|
||||
uint8_t overhead[16] = "unknown";
|
||||
int64_t file_size = of_filesize(of);
|
||||
|
||||
av_log(of, AV_LOG_VERBOSE, "Output file #%d (%s):\n",
|
||||
of->index, of->url);
|
||||
|
||||
for (int j = 0; j < of->nb_streams; j++) {
|
||||
OutputStream *ost = of->streams[j];
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
const AVCodecParameters *par = ost->st->codecpar;
|
||||
const enum AVMediaType type = par->codec_type;
|
||||
const uint64_t s = ms->data_size_mux;
|
||||
|
||||
switch (type) {
|
||||
case AVMEDIA_TYPE_VIDEO: video_size += s; break;
|
||||
case AVMEDIA_TYPE_AUDIO: audio_size += s; break;
|
||||
case AVMEDIA_TYPE_SUBTITLE: subtitle_size += s; break;
|
||||
default: other_size += s; break;
|
||||
}
|
||||
|
||||
extra_size += par->extradata_size;
|
||||
total_size += s;
|
||||
total_packets += atomic_load(&ost->packets_written);
|
||||
|
||||
av_log(of, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ",
|
||||
of->index, j, av_get_media_type_string(type));
|
||||
if (ost->enc) {
|
||||
av_log(of, AV_LOG_VERBOSE, "%"PRIu64" frames encoded",
|
||||
ost->frames_encoded);
|
||||
if (type == AVMEDIA_TYPE_AUDIO)
|
||||
av_log(of, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ost->samples_encoded);
|
||||
av_log(of, AV_LOG_VERBOSE, "; ");
|
||||
}
|
||||
|
||||
av_log(of, AV_LOG_VERBOSE, "%"PRIu64" packets muxed (%"PRIu64" bytes); ",
|
||||
atomic_load(&ost->packets_written), s);
|
||||
|
||||
av_log(of, AV_LOG_VERBOSE, "\n");
|
||||
}
|
||||
|
||||
av_log(of, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) muxed\n",
|
||||
total_packets, total_size);
|
||||
|
||||
if (total_size && file_size > 0 && file_size >= total_size) {
|
||||
snprintf(overhead, sizeof(overhead), "%f%%",
|
||||
100.0 * (file_size - total_size) / total_size);
|
||||
}
|
||||
|
||||
av_log(of, AV_LOG_INFO,
|
||||
"video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB "
|
||||
"global headers:%1.0fkB muxing overhead: %s\n",
|
||||
video_size / 1024.0,
|
||||
audio_size / 1024.0,
|
||||
subtitle_size / 1024.0,
|
||||
other_size / 1024.0,
|
||||
extra_size / 1024.0,
|
||||
overhead);
|
||||
}
|
||||
|
||||
int of_write_trailer(OutputFile *of)
|
||||
{
|
||||
Muxer *mux = mux_from_of(of);
|
||||
AVFormatContext *fc = mux->fc;
|
||||
int ret, mux_result = 0;
|
||||
int ret;
|
||||
|
||||
if (!mux->tq) {
|
||||
av_log(mux, AV_LOG_ERROR,
|
||||
@@ -810,12 +614,14 @@ int of_write_trailer(OutputFile *of)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
mux_result = thread_stop(mux);
|
||||
ret = thread_stop(mux);
|
||||
if (ret < 0)
|
||||
main_return_code = ret;
|
||||
|
||||
ret = av_write_trailer(fc);
|
||||
if (ret < 0) {
|
||||
av_log(mux, AV_LOG_ERROR, "Error writing trailer: %s\n", av_err2str(ret));
|
||||
mux_result = err_merge(mux_result, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
mux->last_filesize = filesize(fc->pb);
|
||||
@@ -824,17 +630,11 @@ int of_write_trailer(OutputFile *of)
|
||||
ret = avio_closep(&fc->pb);
|
||||
if (ret < 0) {
|
||||
av_log(mux, AV_LOG_ERROR, "Error closing file: %s\n", av_err2str(ret));
|
||||
mux_result = err_merge(mux_result, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
mux_final_stats(mux);
|
||||
|
||||
// check whether anything was actually written
|
||||
ret = check_written(of);
|
||||
mux_result = err_merge(mux_result, ret);
|
||||
|
||||
return mux_result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ost_free(OutputStream **post)
|
||||
@@ -846,8 +646,6 @@ static void ost_free(OutputStream **post)
|
||||
return;
|
||||
ms = ms_from_ost(ost);
|
||||
|
||||
enc_free(&ost->enc);
|
||||
|
||||
if (ost->logfile) {
|
||||
if (fclose(ost->logfile))
|
||||
av_log(ms, AV_LOG_ERROR,
|
||||
@@ -863,17 +661,18 @@ static void ost_free(OutputStream **post)
|
||||
av_fifo_freep2(&ms->muxing_queue);
|
||||
}
|
||||
|
||||
avcodec_parameters_free(&ost->par_in);
|
||||
|
||||
av_bsf_free(&ms->bsf_ctx);
|
||||
av_packet_free(&ms->bsf_pkt);
|
||||
|
||||
av_packet_free(&ms->pkt);
|
||||
av_frame_free(&ost->filtered_frame);
|
||||
av_frame_free(&ost->sq_frame);
|
||||
av_frame_free(&ost->last_frame);
|
||||
av_packet_free(&ost->pkt);
|
||||
av_dict_free(&ost->encoder_opts);
|
||||
|
||||
av_freep(&ost->kf.pts);
|
||||
av_expr_free(ost->kf.pexpr);
|
||||
|
||||
av_freep(&ost->avfilter);
|
||||
av_freep(&ost->logfile_prefix);
|
||||
av_freep(&ost->apad);
|
||||
|
||||
@@ -918,7 +717,7 @@ static void fc_close(AVFormatContext **pfc)
|
||||
*pfc = NULL;
|
||||
}
|
||||
|
||||
void of_free(OutputFile **pof)
|
||||
void of_close(OutputFile **pof)
|
||||
{
|
||||
OutputFile *of = *pof;
|
||||
Muxer *mux;
|
||||
|
||||
@@ -44,9 +44,6 @@ typedef struct MuxStream {
|
||||
AVFifo *muxing_queue;
|
||||
|
||||
AVBSFContext *bsf_ctx;
|
||||
AVPacket *bsf_pkt;
|
||||
|
||||
AVPacket *pkt;
|
||||
|
||||
EncStats stats;
|
||||
|
||||
@@ -63,27 +60,9 @@ typedef struct MuxStream {
|
||||
/* Threshold after which max_muxing_queue_size will be in effect */
|
||||
size_t muxing_queue_data_threshold;
|
||||
|
||||
// timestamp from which the streamcopied streams should start,
|
||||
// in AV_TIME_BASE_Q;
|
||||
// everything before it should be discarded
|
||||
int64_t ts_copy_start;
|
||||
|
||||
/* dts of the last packet sent to the muxer, in the stream timebase
|
||||
* used for making up missing dts values */
|
||||
int64_t last_mux_dts;
|
||||
|
||||
int64_t stream_duration;
|
||||
AVRational stream_duration_tb;
|
||||
|
||||
// state for av_rescale_delta() call for audio in write_packet()
|
||||
int64_t ts_rescale_delta_last;
|
||||
|
||||
// combined size of all the packets sent to the muxer
|
||||
uint64_t data_size_mux;
|
||||
|
||||
int copy_initial_nonkeyframes;
|
||||
int copy_prior_start;
|
||||
int streamcopy_started;
|
||||
} MuxStream;
|
||||
|
||||
typedef struct Muxer {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,9 +56,7 @@
|
||||
const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
|
||||
const char *const opt_name_frame_rates[] = {"r", NULL};
|
||||
const char *const opt_name_codec_tags[] = {"tag", "atag", "vtag", "stag", NULL};
|
||||
#if FFMPEG_OPT_TOP
|
||||
const char *const opt_name_top_field_first[] = {"top", NULL};
|
||||
#endif
|
||||
|
||||
HWDevice *filter_hw_device;
|
||||
|
||||
@@ -82,6 +80,7 @@ int debug_ts = 0;
|
||||
int exit_on_error = 0;
|
||||
int abort_on_flags = 0;
|
||||
int print_stats = -1;
|
||||
int qp_hist = 0;
|
||||
int stdin_interaction = 1;
|
||||
float max_error_rate = 2.0/3;
|
||||
char *filter_nbthreads;
|
||||
@@ -130,9 +129,8 @@ static void uninit_options(OptionsContext *o)
|
||||
#if FFMPEG_OPT_MAP_CHANNEL
|
||||
av_freep(&o->audio_channel_maps);
|
||||
#endif
|
||||
av_freep(&o->streamid_map);
|
||||
av_freep(&o->attachments);
|
||||
|
||||
av_dict_free(&o->streamid);
|
||||
}
|
||||
|
||||
static void init_options(OptionsContext *o)
|
||||
@@ -192,18 +190,11 @@ int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_id
|
||||
else if (!is_global && !av_strcasecmp(arg, "auto")) *vsync_var = VSYNC_AUTO;
|
||||
else if (!is_global) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid value %s specified for fps_mode of #%d:%d.\n", arg, file_idx, st_idx);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (is_global && *vsync_var == VSYNC_AUTO) {
|
||||
int ret;
|
||||
double num;
|
||||
|
||||
ret = parse_number("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
video_sync_method = num;
|
||||
video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR);
|
||||
av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated,"
|
||||
" use a string argument as described in the manual.\n");
|
||||
}
|
||||
@@ -259,12 +250,12 @@ static int apply_sync_offsets(void)
|
||||
if (self->input_sync_ref == -1 || self->input_sync_ref == i) continue;
|
||||
if (self->input_sync_ref >= nb_input_files || self->input_sync_ref < -1) {
|
||||
av_log(NULL, AV_LOG_FATAL, "-isync for input %d references non-existent input %d.\n", i, self->input_sync_ref);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (copy_ts && !start_at_zero) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Use of -isync requires that start_at_zero be set if copyts is set.\n");
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
ref = input_files[self->input_sync_ref];
|
||||
@@ -328,10 +319,7 @@ static int opt_abort_on(void *optctx, const char *opt, const char *arg)
|
||||
|
||||
static int opt_stats_period(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
int64_t user_stats_period;
|
||||
int ret = av_parse_time(&user_stats_period, arg, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
int64_t user_stats_period = parse_time_or_die(opt, arg, 1);
|
||||
|
||||
if (user_stats_period <= 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "stats_period %s must be positive.\n", arg);
|
||||
@@ -373,7 +361,9 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
OptionsContext *o = optctx;
|
||||
StreamMap *m = NULL;
|
||||
int i, negative = 0, file_idx, disabled = 0;
|
||||
int ret;
|
||||
#if FFMPEG_OPT_MAP_SYNC
|
||||
char *sync;
|
||||
#endif
|
||||
char *map, *p;
|
||||
char *allow_unused;
|
||||
|
||||
@@ -386,14 +376,10 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
#if FFMPEG_OPT_MAP_SYNC
|
||||
{
|
||||
/* parse sync stream first, just pick first matching stream */
|
||||
char *sync = strchr(map, ',');
|
||||
|
||||
if (sync) {
|
||||
*sync = 0;
|
||||
av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
|
||||
}
|
||||
/* parse sync stream first, just pick first matching stream */
|
||||
if (sync = strchr(map, ',')) {
|
||||
*sync = 0;
|
||||
av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -401,17 +387,12 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
if (map[0] == '[') {
|
||||
/* this mapping refers to lavfi output */
|
||||
const char *c = map + 1;
|
||||
|
||||
ret = GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
|
||||
m = &o->stream_maps[o->nb_stream_maps - 1];
|
||||
m->linklabel = av_get_token(&c, "]");
|
||||
if (!m->linklabel) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid output link label: %s.\n", map);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
} else {
|
||||
if (allow_unused = strchr(map, '?'))
|
||||
@@ -419,8 +400,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
file_idx = strtol(map, &p, 0);
|
||||
if (file_idx >= nb_input_files || file_idx < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
if (negative)
|
||||
/* disable some already defined maps */
|
||||
@@ -441,10 +421,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
disabled = 1;
|
||||
continue;
|
||||
}
|
||||
ret = GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
|
||||
m = &o->stream_maps[o->nb_stream_maps - 1];
|
||||
|
||||
m->file_index = file_idx;
|
||||
@@ -458,28 +435,22 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
} else if (disabled) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches disabled streams.\n"
|
||||
"To ignore this, add a trailing '?' to the map.\n", arg);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n"
|
||||
"To ignore this, add a trailing '?' to the map.\n", arg);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
fail:
|
||||
|
||||
av_freep(&map);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_attach(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
OptionsContext *o = optctx;
|
||||
int ret = GROW_ARRAY(o->attachments, o->nb_attachments);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
GROW_ARRAY(o->attachments, o->nb_attachments);
|
||||
o->attachments[o->nb_attachments - 1] = arg;
|
||||
return 0;
|
||||
}
|
||||
@@ -488,7 +459,7 @@ static int opt_attach(void *optctx, const char *opt, const char *arg)
|
||||
static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
OptionsContext *o = optctx;
|
||||
int n, ret;
|
||||
int n;
|
||||
AVStream *st;
|
||||
AudioChannelMap *m;
|
||||
char *allow_unused;
|
||||
@@ -503,10 +474,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||
if (!mapchan)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
|
||||
GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps);
|
||||
m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1];
|
||||
|
||||
/* muted channel syntax */
|
||||
@@ -527,7 +495,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||
if (n != 3 && n != 5) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: "
|
||||
"[file.stream.channel|-1][:syncfile:syncstream]\n");
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (n != 5) // only file.stream.channel specified
|
||||
@@ -537,19 +505,19 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||
if (m->file_idx < 0 || m->file_idx >= nb_input_files) {
|
||||
av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n",
|
||||
m->file_idx);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
if (m->stream_idx < 0 ||
|
||||
m->stream_idx >= input_files[m->file_idx]->nb_streams) {
|
||||
av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n",
|
||||
m->file_idx, m->stream_idx);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
st = input_files[m->file_idx]->ctx->streams[m->stream_idx];
|
||||
if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
|
||||
av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n",
|
||||
m->file_idx, m->stream_idx);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
/* allow trailing ? to map_channel */
|
||||
if (allow_unused = strchr(mapchan, '?'))
|
||||
@@ -563,17 +531,12 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||
av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n"
|
||||
"To ignore this, add a trailing '?' to the map_channel.\n",
|
||||
m->file_idx, m->stream_idx, m->channel_idx);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
av_free(mapchan);
|
||||
return ret;
|
||||
fail:
|
||||
ret = AVERROR(EINVAL);
|
||||
goto end;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -625,7 +588,7 @@ static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
|
||||
AV_HWDEVICE_TYPE_NONE)
|
||||
printf("%s\n", av_hwdevice_get_type_name(type));
|
||||
printf("\n");
|
||||
return AVERROR_EXIT;
|
||||
exit_program(0);
|
||||
} else {
|
||||
return hw_device_init_from_string(arg, NULL);
|
||||
}
|
||||
@@ -649,16 +612,8 @@ static int opt_recording_timestamp(void *optctx, const char *opt, const char *ar
|
||||
{
|
||||
OptionsContext *o = optctx;
|
||||
char buf[128];
|
||||
int64_t recording_timestamp;
|
||||
int ret;
|
||||
struct tm time;
|
||||
|
||||
ret = av_parse_time(&recording_timestamp, arg, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
recording_timestamp /= 1e6;
|
||||
time = *gmtime((time_t*)&recording_timestamp);
|
||||
int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6;
|
||||
struct tm time = *gmtime((time_t*)&recording_timestamp);
|
||||
if (!strftime(buf, sizeof(buf), "creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
|
||||
return -1;
|
||||
parse_option(o, "metadata", buf, options);
|
||||
@@ -668,8 +623,8 @@ static int opt_recording_timestamp(void *optctx, const char *opt, const char *ar
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find_codec(void *logctx, const char *name,
|
||||
enum AVMediaType type, int encoder, const AVCodec **pcodec)
|
||||
const AVCodec *find_codec_or_die(void *logctx, const char *name,
|
||||
enum AVMediaType type, int encoder)
|
||||
{
|
||||
const AVCodecDescriptor *desc;
|
||||
const char *codec_string = encoder ? "encoder" : "decoder";
|
||||
@@ -689,25 +644,22 @@ int find_codec(void *logctx, const char *name,
|
||||
|
||||
if (!codec) {
|
||||
av_log(logctx, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
|
||||
return encoder ? AVERROR_ENCODER_NOT_FOUND :
|
||||
AVERROR_DECODER_NOT_FOUND;
|
||||
exit_program(1);
|
||||
}
|
||||
if (codec->type != type && !recast_media) {
|
||||
av_log(logctx, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
*pcodec = codec;
|
||||
return 0;;
|
||||
return codec;
|
||||
}
|
||||
|
||||
int assert_file_overwrite(const char *filename)
|
||||
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");
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (!file_overwrite) {
|
||||
@@ -719,13 +671,13 @@ int assert_file_overwrite(const char *filename)
|
||||
signal(SIGINT, SIG_DFL);
|
||||
if (!read_yesno()) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Not overwriting - exiting\n");
|
||||
return AVERROR_EXIT;
|
||||
exit_program(1);
|
||||
}
|
||||
term_init();
|
||||
}
|
||||
else {
|
||||
av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename);
|
||||
return AVERROR_EXIT;
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -738,12 +690,10 @@ int assert_file_overwrite(const char *filename)
|
||||
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");
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* read file contents into a string */
|
||||
@@ -776,6 +726,7 @@ char *file_read(const char *filename)
|
||||
static int opt_streamid(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
OptionsContext *o = optctx;
|
||||
int idx;
|
||||
char *p;
|
||||
char idx_str[16];
|
||||
|
||||
@@ -785,11 +736,13 @@ static int opt_streamid(void *optctx, const char *opt, const char *arg)
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
|
||||
arg, opt);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
*p++ = '\0';
|
||||
|
||||
return av_dict_set(&o->streamid, idx_str, p, 0);
|
||||
idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
|
||||
o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
|
||||
o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_complex_filters(void)
|
||||
@@ -850,7 +803,7 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
||||
av_log(NULL, AV_LOG_FATAL, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
|
||||
av_log(NULL, AV_LOG_FATAL, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
|
||||
av_log(NULL, AV_LOG_FATAL, "or set a framerate with \"-r xxx\".\n");
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (!strcmp(arg, "vcd")) {
|
||||
@@ -962,7 +915,7 @@ static int opt_vstats(void *optctx, const char *opt, const char *arg)
|
||||
|
||||
if (!today) { // maybe tomorrow
|
||||
av_log(NULL, AV_LOG_FATAL, "Unable to get current time: %s\n", strerror(errno));
|
||||
return AVERROR(errno);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
|
||||
@@ -1014,7 +967,6 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
FILE *f=NULL;
|
||||
char filename[1000], line[1000], tmp_line[1000];
|
||||
const char *codec_name = NULL;
|
||||
int ret = 0;
|
||||
|
||||
tmp_line[0] = *opt;
|
||||
tmp_line[1] = 0;
|
||||
@@ -1025,7 +977,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
av_log(NULL, AV_LOG_FATAL, "Please use -preset <speed> -qp 0\n");
|
||||
}else
|
||||
av_log(NULL, AV_LOG_FATAL, "File for preset '%s' not found\n", arg);
|
||||
return AVERROR(ENOENT);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
@@ -1037,8 +989,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
if (!av_strtok(key, "=", &value) ||
|
||||
!av_strtok(value, "\r\n", &endptr)) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: Invalid syntax: '%s'\n", filename, line);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
av_log(NULL, AV_LOG_DEBUG, "ffpreset[%s]: set '%s' = '%s'\n", filename, key, value);
|
||||
|
||||
@@ -1049,15 +1000,13 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
|
||||
else if (opt_default_new(o, key, value) < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n",
|
||||
filename, line, key, value);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
fclose(f);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_old2new(void *optctx, const char *opt, const char *arg)
|
||||
@@ -1132,7 +1081,8 @@ static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
|
||||
static int opt_vsync(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_WARNING, "-vsync is deprecated. Use -fps_mode\n");
|
||||
return parse_and_set_vsync(arg, &video_sync_method, -1, -1, 1);
|
||||
parse_and_set_vsync(arg, &video_sync_method, -1, -1, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_timecode(void *optctx, const char *opt, const char *arg)
|
||||
@@ -1157,20 +1107,28 @@ static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
|
||||
|
||||
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
char *graph_desc = av_strdup(arg);
|
||||
if (!graph_desc)
|
||||
FilterGraph *fg = ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs);
|
||||
|
||||
fg->index = nb_filtergraphs - 1;
|
||||
fg->graph_desc = av_strdup(arg);
|
||||
if (!fg->graph_desc)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
return fg_create(NULL, graph_desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
FilterGraph *fg;
|
||||
char *graph_desc = file_read(arg);
|
||||
if (!graph_desc)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
return fg_create(NULL, graph_desc);
|
||||
fg = ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs);
|
||||
fg->index = nb_filtergraphs - 1;
|
||||
fg->graph_desc = graph_desc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void show_help_default(const char *opt, const char *arg)
|
||||
@@ -1299,7 +1257,6 @@ static int open_files(OptionGroupList *l, const char *inout,
|
||||
int ffmpeg_parse_options(int argc, char **argv)
|
||||
{
|
||||
OptionParseContext octx;
|
||||
const char *errmsg = NULL;
|
||||
int ret;
|
||||
|
||||
memset(&octx, 0, sizeof(octx));
|
||||
@@ -1308,14 +1265,14 @@ int ffmpeg_parse_options(int argc, char **argv)
|
||||
ret = split_commandline(&octx, argc, argv, options, groups,
|
||||
FF_ARRAY_ELEMS(groups));
|
||||
if (ret < 0) {
|
||||
errmsg = "splitting the argument list";
|
||||
av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: ");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* apply global options */
|
||||
ret = parse_optgroup(NULL, &octx.global_opts);
|
||||
if (ret < 0) {
|
||||
errmsg = "parsing global options";
|
||||
av_log(NULL, AV_LOG_FATAL, "Error parsing global options: ");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -1325,39 +1282,34 @@ int ffmpeg_parse_options(int argc, char **argv)
|
||||
/* open input files */
|
||||
ret = open_files(&octx.groups[GROUP_INFILE], "input", ifile_open);
|
||||
if (ret < 0) {
|
||||
errmsg = "opening input files";
|
||||
av_log(NULL, AV_LOG_FATAL, "Error opening input files: ");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* create the complex filtergraphs */
|
||||
ret = init_complex_filters();
|
||||
if (ret < 0) {
|
||||
errmsg = "initializing complex filters";
|
||||
av_log(NULL, AV_LOG_FATAL, "Error initializing complex filters.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* open output files */
|
||||
ret = open_files(&octx.groups[GROUP_OUTFILE], "output", of_open);
|
||||
if (ret < 0) {
|
||||
errmsg = "opening output files";
|
||||
av_log(NULL, AV_LOG_FATAL, "Error opening output files: ");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
correct_input_start_times();
|
||||
|
||||
ret = apply_sync_offsets();
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
apply_sync_offsets();
|
||||
|
||||
ret = check_filter_outputs();
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
check_filter_outputs();
|
||||
|
||||
fail:
|
||||
uninit_parse_context(&octx);
|
||||
if (ret < 0 && ret != AVERROR_EXIT) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Error %s: %s\n",
|
||||
errmsg ? errmsg : "", av_err2str(ret));
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s\n", av_err2str(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1382,15 +1334,8 @@ static int opt_progress(void *optctx, const char *opt, const char *arg)
|
||||
int opt_timelimit(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
#if HAVE_SETRLIMIT
|
||||
int ret;
|
||||
double lim;
|
||||
struct rlimit rl;
|
||||
|
||||
ret = parse_number(opt, arg, OPT_INT64, 0, INT_MAX, &lim);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
rl = (struct rlimit){ lim, lim + 1 };
|
||||
int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
|
||||
struct rlimit rl = { lim, lim + 1 };
|
||||
if (setrlimit(RLIMIT_CPU, &rl))
|
||||
perror("setrlimit");
|
||||
#else
|
||||
@@ -1399,22 +1344,6 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if FFMPEG_OPT_QPHIST
|
||||
static int opt_qphist(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_WARNING, "Option -%s is deprecated and has no effect\n", opt);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FFMPEG_OPT_ADRIFT_THRESHOLD
|
||||
static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_WARNING, "Option -%s is deprecated and has no effect\n", opt);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define OFFSET(x) offsetof(OptionsContext, x)
|
||||
const OptionDef options[] = {
|
||||
/* main options */
|
||||
@@ -1514,9 +1443,6 @@ const OptionDef options[] = {
|
||||
{ "readrate", HAS_ARG | OPT_FLOAT | OPT_OFFSET |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate) },
|
||||
"read input at specified rate", "speed" },
|
||||
{ "readrate_initial_burst", HAS_ARG | OPT_DOUBLE | OPT_OFFSET |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate_initial_burst) },
|
||||
"The initial amount of input to burst read before imposing any readrate", "seconds" },
|
||||
{ "target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_target },
|
||||
"specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
|
||||
"with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
|
||||
@@ -1524,10 +1450,8 @@ const OptionDef options[] = {
|
||||
"set video sync method globally; deprecated, use -fps_mode", "" },
|
||||
{ "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold },
|
||||
"frame drop threshold", "" },
|
||||
#if FFMPEG_OPT_ADRIFT_THRESHOLD
|
||||
{ "adrift_threshold", HAS_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold },
|
||||
"deprecated, does nothing", "threshold" },
|
||||
#endif
|
||||
{ "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &audio_drift_threshold },
|
||||
"audio drift threshold", "threshold" },
|
||||
{ "copyts", OPT_BOOL | OPT_EXPERT, { ©_ts },
|
||||
"copy timestamps" },
|
||||
{ "start_at_zero", OPT_BOOL | OPT_EXPERT, { &start_at_zero },
|
||||
@@ -1697,18 +1621,14 @@ const OptionDef options[] = {
|
||||
{ "chroma_intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
|
||||
OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) },
|
||||
"specify intra matrix coeffs", "matrix" },
|
||||
#if FFMPEG_OPT_TOP
|
||||
{ "top", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_INT| OPT_SPEC |
|
||||
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) },
|
||||
"deprecated, use the setfield video filter", "" },
|
||||
#endif
|
||||
"top=1/bottom=0/auto=-1 field first", "" },
|
||||
{ "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
|
||||
OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_old2new },
|
||||
"force video tag/fourcc", "fourcc/tag" },
|
||||
#if FFMPEG_OPT_QPHIST
|
||||
{ "qphist", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_qphist },
|
||||
"deprecated, does nothing" },
|
||||
#endif
|
||||
{ "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist },
|
||||
"show QP histogram" },
|
||||
{ "fps_mode", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT |
|
||||
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) },
|
||||
"set framerate mode for matching video streams; overrides vsync" },
|
||||
@@ -1838,7 +1758,7 @@ const OptionDef options[] = {
|
||||
|
||||
#if CONFIG_VAAPI
|
||||
{ "vaapi_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vaapi_device },
|
||||
"set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)", "device" },
|
||||
"set VAAPI hardware device (DRM path or X11 display name)", "device" },
|
||||
#endif
|
||||
|
||||
#if CONFIG_QSV
|
||||
|
||||
@@ -1,56 +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
|
||||
*/
|
||||
|
||||
#ifndef FFTOOLS_FFMPEG_UTILS_H
|
||||
#define FFTOOLS_FFMPEG_UTILS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/frame.h"
|
||||
#include "libavutil/rational.h"
|
||||
|
||||
#include "libavcodec/packet.h"
|
||||
|
||||
typedef struct Timestamp {
|
||||
int64_t ts;
|
||||
AVRational tb;
|
||||
} Timestamp;
|
||||
|
||||
/**
|
||||
* Merge two return codes - return one of the error codes if at least one of
|
||||
* them was negative, 0 otherwise.
|
||||
* Currently just picks the first one, eventually we might want to do something
|
||||
* more sophisticated, like sorting them by priority.
|
||||
*/
|
||||
static inline int err_merge(int err0, int err1)
|
||||
{
|
||||
return (err0 < 0) ? err0 : FFMIN(err1, 0);
|
||||
}
|
||||
|
||||
static inline void pkt_move(void *dst, void *src)
|
||||
{
|
||||
av_packet_move_ref(dst, src);
|
||||
}
|
||||
|
||||
static inline void frame_move(void *dst, void *src)
|
||||
{
|
||||
av_frame_move_ref(dst, src);
|
||||
}
|
||||
|
||||
#endif // FFTOOLS_FFMPEG_UTILS_H
|
||||
346
fftools/ffplay.c
346
fftools/ffplay.c
@@ -47,18 +47,19 @@
|
||||
#include "libavdevice/avdevice.h"
|
||||
#include "libswscale/swscale.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/tx.h"
|
||||
#include "libavcodec/avfft.h"
|
||||
#include "libswresample/swresample.h"
|
||||
|
||||
#include "libavfilter/avfilter.h"
|
||||
#include "libavfilter/buffersink.h"
|
||||
#include "libavfilter/buffersrc.h"
|
||||
#if CONFIG_AVFILTER
|
||||
# include "libavfilter/avfilter.h"
|
||||
# include "libavfilter/buffersink.h"
|
||||
# include "libavfilter/buffersrc.h"
|
||||
#endif
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_thread.h>
|
||||
|
||||
#include "cmdutils.h"
|
||||
#include "ffplay_renderer.h"
|
||||
#include "opt_common.h"
|
||||
|
||||
const char program_name[] = "ffplay";
|
||||
@@ -108,6 +109,8 @@ const int program_birth_year = 2003;
|
||||
|
||||
#define USE_ONEPASS_SUBTITLE_RENDER 1
|
||||
|
||||
static unsigned sws_flags = SWS_BICUBIC;
|
||||
|
||||
typedef struct MyAVPacketList {
|
||||
AVPacket *pkt;
|
||||
int serial;
|
||||
@@ -147,10 +150,6 @@ typedef struct Clock {
|
||||
int *queue_serial; /* pointer to the current packet queue serial, used for obsolete clock detection */
|
||||
} Clock;
|
||||
|
||||
typedef struct FrameData {
|
||||
int64_t pkt_pos;
|
||||
} FrameData;
|
||||
|
||||
/* Common struct for handling all types of decoded data and allocated render buffers. */
|
||||
typedef struct Frame {
|
||||
AVFrame *frame;
|
||||
@@ -251,7 +250,9 @@ typedef struct VideoState {
|
||||
int audio_volume;
|
||||
int muted;
|
||||
struct AudioParams audio_src;
|
||||
#if CONFIG_AVFILTER
|
||||
struct AudioParams audio_filter_src;
|
||||
#endif
|
||||
struct AudioParams audio_tgt;
|
||||
struct SwrContext *swr_ctx;
|
||||
int frame_drops_early;
|
||||
@@ -263,11 +264,9 @@ typedef struct VideoState {
|
||||
int16_t sample_array[SAMPLE_ARRAY_SIZE];
|
||||
int sample_array_index;
|
||||
int last_i_start;
|
||||
AVTXContext *rdft;
|
||||
av_tx_fn rdft_fn;
|
||||
RDFTContext *rdft;
|
||||
int rdft_bits;
|
||||
float *real_data;
|
||||
AVComplexFloat *rdft_data;
|
||||
FFTSample *rdft_data;
|
||||
int xpos;
|
||||
double last_vis_time;
|
||||
SDL_Texture *vis_texture;
|
||||
@@ -285,6 +284,7 @@ typedef struct VideoState {
|
||||
AVStream *video_st;
|
||||
PacketQueue videoq;
|
||||
double max_frame_duration; // maximum duration of a frame - above this, we consider the jump a timestamp discontinuity
|
||||
struct SwsContext *img_convert_ctx;
|
||||
struct SwsContext *sub_convert_ctx;
|
||||
int eof;
|
||||
|
||||
@@ -292,12 +292,14 @@ typedef struct VideoState {
|
||||
int width, height, xleft, ytop;
|
||||
int step;
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
int vfilter_idx;
|
||||
AVFilterContext *in_video_filter; // the first filter in the video chain
|
||||
AVFilterContext *out_video_filter; // the last filter in the video chain
|
||||
AVFilterContext *in_audio_filter; // the first filter in the audio chain
|
||||
AVFilterContext *out_audio_filter; // the last filter in the audio chain
|
||||
AVFilterGraph *agraph; // audio filter graph
|
||||
#endif
|
||||
|
||||
int last_video_stream, last_audio_stream, last_subtitle_stream;
|
||||
|
||||
@@ -345,15 +347,14 @@ static const char *video_codec_name;
|
||||
double rdftspeed = 0.02;
|
||||
static int64_t cursor_last_shown;
|
||||
static int cursor_hidden = 0;
|
||||
#if CONFIG_AVFILTER
|
||||
static const char **vfilters_list = NULL;
|
||||
static int nb_vfilters = 0;
|
||||
static char *afilters = NULL;
|
||||
#endif
|
||||
static int autorotate = 1;
|
||||
static int find_stream_info = 1;
|
||||
static int filter_nbthreads = 0;
|
||||
static int enable_vulkan = 0;
|
||||
static char *vulkan_params = NULL;
|
||||
static const char *hwaccel = NULL;
|
||||
|
||||
/* current context */
|
||||
static int is_full_screen;
|
||||
@@ -366,8 +367,6 @@ static SDL_Renderer *renderer;
|
||||
static SDL_RendererInfo renderer_info = {0};
|
||||
static SDL_AudioDeviceID audio_dev;
|
||||
|
||||
static VkRenderer *vk_renderer;
|
||||
|
||||
static const struct TextureFormatEntry {
|
||||
enum AVPixelFormat format;
|
||||
int texture_fmt;
|
||||
@@ -394,15 +393,14 @@ static const struct TextureFormatEntry {
|
||||
{ AV_PIX_FMT_NONE, SDL_PIXELFORMAT_UNKNOWN },
|
||||
};
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
static int opt_add_vfilter(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
int ret = GROW_ARRAY(vfilters_list, nb_vfilters);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
GROW_ARRAY(vfilters_list, nb_vfilters);
|
||||
vfilters_list[nb_vfilters - 1] = arg;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline
|
||||
int cmp_audio_fmts(enum AVSampleFormat fmt1, int64_t channel_count1,
|
||||
@@ -655,16 +653,6 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
|
||||
}
|
||||
av_packet_unref(d->pkt);
|
||||
} else {
|
||||
if (d->pkt->buf && !d->pkt->opaque_ref) {
|
||||
FrameData *fd;
|
||||
|
||||
d->pkt->opaque_ref = av_buffer_allocz(sizeof(*fd));
|
||||
if (!d->pkt->opaque_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
fd = (FrameData*)d->pkt->opaque_ref->data;
|
||||
fd->pkt_pos = d->pkt->pos;
|
||||
}
|
||||
|
||||
if (avcodec_send_packet(d->avctx, d->pkt) == AVERROR(EAGAIN)) {
|
||||
av_log(d->avctx, AV_LOG_ERROR, "Receive_frame and send_packet both returned EAGAIN, which is an API violation.\n");
|
||||
d->packet_pending = 1;
|
||||
@@ -707,7 +695,7 @@ static int frame_queue_init(FrameQueue *f, PacketQueue *pktq, int max_size, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void frame_queue_destroy(FrameQueue *f)
|
||||
static void frame_queue_destory(FrameQueue *f)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < f->max_size; i++) {
|
||||
@@ -903,8 +891,7 @@ static void get_sdl_pix_fmt_and_blendmode(int format, Uint32 *sdl_pix_fmt, SDL_B
|
||||
}
|
||||
}
|
||||
|
||||
static int upload_texture(SDL_Texture **tex, AVFrame *frame)
|
||||
{
|
||||
static int upload_texture(SDL_Texture **tex, AVFrame *frame, struct SwsContext **img_convert_ctx) {
|
||||
int ret = 0;
|
||||
Uint32 sdl_pix_fmt;
|
||||
SDL_BlendMode sdl_blendmode;
|
||||
@@ -912,6 +899,24 @@ static int upload_texture(SDL_Texture **tex, AVFrame *frame)
|
||||
if (realloc_texture(tex, sdl_pix_fmt == SDL_PIXELFORMAT_UNKNOWN ? SDL_PIXELFORMAT_ARGB8888 : sdl_pix_fmt, frame->width, frame->height, sdl_blendmode, 0) < 0)
|
||||
return -1;
|
||||
switch (sdl_pix_fmt) {
|
||||
case SDL_PIXELFORMAT_UNKNOWN:
|
||||
/* This should only happen if we are not using avfilter... */
|
||||
*img_convert_ctx = sws_getCachedContext(*img_convert_ctx,
|
||||
frame->width, frame->height, frame->format, frame->width, frame->height,
|
||||
AV_PIX_FMT_BGRA, sws_flags, NULL, NULL, NULL);
|
||||
if (*img_convert_ctx != NULL) {
|
||||
uint8_t *pixels[4];
|
||||
int pitch[4];
|
||||
if (!SDL_LockTexture(*tex, NULL, (void **)pixels, pitch)) {
|
||||
sws_scale(*img_convert_ctx, (const uint8_t * const *)frame->data, frame->linesize,
|
||||
0, frame->height, pixels, pitch);
|
||||
SDL_UnlockTexture(*tex);
|
||||
}
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n");
|
||||
ret = -1;
|
||||
}
|
||||
break;
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
if (frame->linesize[0] > 0 && frame->linesize[1] > 0 && frame->linesize[2] > 0) {
|
||||
ret = SDL_UpdateYUVTexture(*tex, NULL, frame->data[0], frame->linesize[0],
|
||||
@@ -960,11 +965,6 @@ static void video_image_display(VideoState *is)
|
||||
SDL_Rect rect;
|
||||
|
||||
vp = frame_queue_peek_last(&is->pictq);
|
||||
if (vk_renderer) {
|
||||
vk_renderer_display(vk_renderer, vp->frame);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is->subtitle_st) {
|
||||
if (frame_queue_nb_remaining(&is->subpq) > 0) {
|
||||
sp = frame_queue_peek(&is->subpq);
|
||||
@@ -1014,7 +1014,7 @@ static void video_image_display(VideoState *is)
|
||||
set_sdl_yuv_conversion_mode(vp->frame);
|
||||
|
||||
if (!vp->uploaded) {
|
||||
if (upload_texture(&is->vid_texture, vp->frame) < 0) {
|
||||
if (upload_texture(&is->vid_texture, vp->frame, &is->img_convert_ctx) < 0) {
|
||||
set_sdl_yuv_conversion_mode(NULL);
|
||||
return;
|
||||
}
|
||||
@@ -1133,7 +1133,6 @@ static void video_audio_display(VideoState *s)
|
||||
fill_rectangle(s->xleft, y, s->width, 1);
|
||||
}
|
||||
} else {
|
||||
int err = 0;
|
||||
if (realloc_texture(&s->vis_texture, SDL_PIXELFORMAT_ARGB8888, s->width, s->height, SDL_BLENDMODE_NONE, 1) < 0)
|
||||
return;
|
||||
|
||||
@@ -1141,39 +1140,31 @@ static void video_audio_display(VideoState *s)
|
||||
s->xpos = 0;
|
||||
nb_display_channels= FFMIN(nb_display_channels, 2);
|
||||
if (rdft_bits != s->rdft_bits) {
|
||||
const float rdft_scale = 1.0;
|
||||
av_tx_uninit(&s->rdft);
|
||||
av_freep(&s->real_data);
|
||||
av_freep(&s->rdft_data);
|
||||
av_rdft_end(s->rdft);
|
||||
av_free(s->rdft_data);
|
||||
s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
|
||||
s->rdft_bits = rdft_bits;
|
||||
s->real_data = av_malloc_array(nb_freq, 4 *sizeof(*s->real_data));
|
||||
s->rdft_data = av_malloc_array(nb_freq + 1, 2 *sizeof(*s->rdft_data));
|
||||
err = av_tx_init(&s->rdft, &s->rdft_fn, AV_TX_FLOAT_RDFT,
|
||||
0, 1 << rdft_bits, &rdft_scale, 0);
|
||||
s->rdft_data = av_malloc_array(nb_freq, 4 *sizeof(*s->rdft_data));
|
||||
}
|
||||
if (err < 0 || !s->rdft_data) {
|
||||
if (!s->rdft || !s->rdft_data){
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to allocate buffers for RDFT, switching to waves display\n");
|
||||
s->show_mode = SHOW_MODE_WAVES;
|
||||
} else {
|
||||
float *data_in[2];
|
||||
AVComplexFloat *data[2];
|
||||
FFTSample *data[2];
|
||||
SDL_Rect rect = {.x = s->xpos, .y = 0, .w = 1, .h = s->height};
|
||||
uint32_t *pixels;
|
||||
int pitch;
|
||||
for (ch = 0; ch < nb_display_channels; ch++) {
|
||||
data_in[ch] = s->real_data + 2 * nb_freq * ch;
|
||||
data[ch] = s->rdft_data + nb_freq * ch;
|
||||
data[ch] = s->rdft_data + 2 * nb_freq * ch;
|
||||
i = i_start + ch;
|
||||
for (x = 0; x < 2 * nb_freq; x++) {
|
||||
double w = (x-nb_freq) * (1.0 / nb_freq);
|
||||
data_in[ch][x] = s->sample_array[i] * (1.0 - w * w);
|
||||
data[ch][x] = s->sample_array[i] * (1.0 - w * w);
|
||||
i += channels;
|
||||
if (i >= SAMPLE_ARRAY_SIZE)
|
||||
i -= SAMPLE_ARRAY_SIZE;
|
||||
}
|
||||
s->rdft_fn(s->rdft, data[ch], data_in[ch], sizeof(float));
|
||||
data[ch][0].im = data[ch][nb_freq].re;
|
||||
data[ch][nb_freq].re = 0;
|
||||
av_rdft_calc(s->rdft, data[ch]);
|
||||
}
|
||||
/* Least efficient way to do this, we should of course
|
||||
* directly access it but it is more than fast enough. */
|
||||
@@ -1182,8 +1173,8 @@ static void video_audio_display(VideoState *s)
|
||||
pixels += pitch * s->height;
|
||||
for (y = 0; y < s->height; y++) {
|
||||
double w = 1 / sqrt(nb_freq);
|
||||
int a = sqrt(w * sqrt(data[0][y].re * data[0][y].re + data[0][y].im * data[0][y].im));
|
||||
int b = (nb_display_channels == 2 ) ? sqrt(w * hypot(data[1][y].re, data[1][y].im))
|
||||
int a = sqrt(w * sqrt(data[0][2 * y + 0] * data[0][2 * y + 0] + data[0][2 * y + 1] * data[0][2 * y + 1]));
|
||||
int b = (nb_display_channels == 2 ) ? sqrt(w * hypot(data[1][2 * y + 0], data[1][2 * y + 1]))
|
||||
: a;
|
||||
a = FFMIN(a, 255);
|
||||
b = FFMIN(b, 255);
|
||||
@@ -1219,8 +1210,7 @@ static void stream_component_close(VideoState *is, int stream_index)
|
||||
is->audio_buf = NULL;
|
||||
|
||||
if (is->rdft) {
|
||||
av_tx_uninit(&is->rdft);
|
||||
av_freep(&is->real_data);
|
||||
av_rdft_end(is->rdft);
|
||||
av_freep(&is->rdft_data);
|
||||
is->rdft = NULL;
|
||||
is->rdft_bits = 0;
|
||||
@@ -1278,10 +1268,11 @@ static void stream_close(VideoState *is)
|
||||
packet_queue_destroy(&is->subtitleq);
|
||||
|
||||
/* free all pictures */
|
||||
frame_queue_destroy(&is->pictq);
|
||||
frame_queue_destroy(&is->sampq);
|
||||
frame_queue_destroy(&is->subpq);
|
||||
frame_queue_destory(&is->pictq);
|
||||
frame_queue_destory(&is->sampq);
|
||||
frame_queue_destory(&is->subpq);
|
||||
SDL_DestroyCond(is->continue_read_thread);
|
||||
sws_freeContext(is->img_convert_ctx);
|
||||
sws_freeContext(is->sub_convert_ctx);
|
||||
av_free(is->filename);
|
||||
if (is->vis_texture)
|
||||
@@ -1300,12 +1291,12 @@ static void do_exit(VideoState *is)
|
||||
}
|
||||
if (renderer)
|
||||
SDL_DestroyRenderer(renderer);
|
||||
if (vk_renderer)
|
||||
vk_renderer_destroy(vk_renderer);
|
||||
if (window)
|
||||
SDL_DestroyWindow(window);
|
||||
uninit_opts();
|
||||
#if CONFIG_AVFILTER
|
||||
av_freep(&vfilters_list);
|
||||
#endif
|
||||
avformat_network_deinit();
|
||||
if (show_status)
|
||||
printf("\n");
|
||||
@@ -1562,8 +1553,7 @@ static double vp_duration(VideoState *is, Frame *vp, Frame *nextvp) {
|
||||
}
|
||||
}
|
||||
|
||||
static void update_video_pts(VideoState *is, double pts, int serial)
|
||||
{
|
||||
static void update_video_pts(VideoState *is, double pts, int64_t pos, int serial) {
|
||||
/* update current video pts */
|
||||
set_clock(&is->vidclk, pts, serial);
|
||||
sync_clock_to_slave(&is->extclk, &is->vidclk);
|
||||
@@ -1628,7 +1618,7 @@ retry:
|
||||
|
||||
SDL_LockMutex(is->pictq.mutex);
|
||||
if (!isnan(vp->pts))
|
||||
update_video_pts(is, vp->pts, vp->serial);
|
||||
update_video_pts(is, vp->pts, vp->pos, vp->serial);
|
||||
SDL_UnlockMutex(is->pictq.mutex);
|
||||
|
||||
if (frame_queue_nb_remaining(&is->pictq) > 1) {
|
||||
@@ -1803,6 +1793,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame)
|
||||
return got_picture;
|
||||
}
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
static int configure_filtergraph(AVFilterGraph *graph, const char *filtergraph,
|
||||
AVFilterContext *source_ctx, AVFilterContext *sink_ctx)
|
||||
{
|
||||
@@ -1929,13 +1920,8 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
|
||||
if (sd)
|
||||
displaymatrix = (int32_t *)sd->data;
|
||||
if (!displaymatrix) {
|
||||
const AVPacketSideData *sd = av_packet_side_data_get(is->video_st->codecpar->coded_side_data,
|
||||
is->video_st->codecpar->nb_coded_side_data,
|
||||
AV_PKT_DATA_DISPLAYMATRIX);
|
||||
if (sd)
|
||||
displaymatrix = (int32_t *)sd->data;
|
||||
}
|
||||
if (!displaymatrix)
|
||||
displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
|
||||
theta = get_rotation(displaymatrix);
|
||||
|
||||
if (fabs(theta - 90) < 1.0) {
|
||||
@@ -2035,14 +2021,17 @@ end:
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_AVFILTER */
|
||||
|
||||
static int audio_thread(void *arg)
|
||||
{
|
||||
VideoState *is = arg;
|
||||
AVFrame *frame = av_frame_alloc();
|
||||
Frame *af;
|
||||
#if CONFIG_AVFILTER
|
||||
int last_serial = -1;
|
||||
int reconfigure;
|
||||
#endif
|
||||
int got_frame = 0;
|
||||
AVRational tb;
|
||||
int ret = 0;
|
||||
@@ -2057,6 +2046,7 @@ static int audio_thread(void *arg)
|
||||
if (got_frame) {
|
||||
tb = (AVRational){1, frame->sample_rate};
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
reconfigure =
|
||||
cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.ch_layout.nb_channels,
|
||||
frame->format, frame->ch_layout.nb_channels) ||
|
||||
@@ -2088,28 +2078,32 @@ static int audio_thread(void *arg)
|
||||
goto the_end;
|
||||
|
||||
while ((ret = av_buffersink_get_frame_flags(is->out_audio_filter, frame, 0)) >= 0) {
|
||||
FrameData *fd = frame->opaque_ref ? (FrameData*)frame->opaque_ref->data : NULL;
|
||||
tb = av_buffersink_get_time_base(is->out_audio_filter);
|
||||
#endif
|
||||
if (!(af = frame_queue_peek_writable(&is->sampq)))
|
||||
goto the_end;
|
||||
|
||||
af->pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb);
|
||||
af->pos = fd ? fd->pkt_pos : -1;
|
||||
af->pos = frame->pkt_pos;
|
||||
af->serial = is->auddec.pkt_serial;
|
||||
af->duration = av_q2d((AVRational){frame->nb_samples, frame->sample_rate});
|
||||
|
||||
av_frame_move_ref(af->frame, frame);
|
||||
frame_queue_push(&is->sampq);
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
if (is->audioq.serial != is->auddec.pkt_serial)
|
||||
break;
|
||||
}
|
||||
if (ret == AVERROR_EOF)
|
||||
is->auddec.finished = is->auddec.pkt_serial;
|
||||
#endif
|
||||
}
|
||||
} while (ret >= 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF);
|
||||
the_end:
|
||||
#if CONFIG_AVFILTER
|
||||
avfilter_graph_free(&is->agraph);
|
||||
#endif
|
||||
av_frame_free(&frame);
|
||||
return ret;
|
||||
}
|
||||
@@ -2135,6 +2129,7 @@ static int video_thread(void *arg)
|
||||
AVRational tb = is->video_st->time_base;
|
||||
AVRational frame_rate = av_guess_frame_rate(is->ic, is->video_st, NULL);
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
AVFilterGraph *graph = NULL;
|
||||
AVFilterContext *filt_out = NULL, *filt_in = NULL;
|
||||
int last_w = 0;
|
||||
@@ -2142,6 +2137,7 @@ static int video_thread(void *arg)
|
||||
enum AVPixelFormat last_format = -2;
|
||||
int last_serial = -1;
|
||||
int last_vfilter_idx = 0;
|
||||
#endif
|
||||
|
||||
if (!frame)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -2153,6 +2149,7 @@ static int video_thread(void *arg)
|
||||
if (!ret)
|
||||
continue;
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
if ( last_w != frame->width
|
||||
|| last_h != frame->height
|
||||
|| last_format != frame->format
|
||||
@@ -2193,8 +2190,6 @@ static int video_thread(void *arg)
|
||||
goto the_end;
|
||||
|
||||
while (ret >= 0) {
|
||||
FrameData *fd;
|
||||
|
||||
is->frame_last_returned_time = av_gettime_relative() / 1000000.0;
|
||||
|
||||
ret = av_buffersink_get_frame_flags(filt_out, frame, 0);
|
||||
@@ -2205,25 +2200,28 @@ static int video_thread(void *arg)
|
||||
break;
|
||||
}
|
||||
|
||||
fd = frame->opaque_ref ? (FrameData*)frame->opaque_ref->data : NULL;
|
||||
|
||||
is->frame_last_filter_delay = av_gettime_relative() / 1000000.0 - is->frame_last_returned_time;
|
||||
if (fabs(is->frame_last_filter_delay) > AV_NOSYNC_THRESHOLD / 10.0)
|
||||
is->frame_last_filter_delay = 0;
|
||||
tb = av_buffersink_get_time_base(filt_out);
|
||||
#endif
|
||||
duration = (frame_rate.num && frame_rate.den ? av_q2d((AVRational){frame_rate.den, frame_rate.num}) : 0);
|
||||
pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb);
|
||||
ret = queue_picture(is, frame, pts, duration, fd ? fd->pkt_pos : -1, is->viddec.pkt_serial);
|
||||
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
|
||||
|
||||
if (ret < 0)
|
||||
goto the_end;
|
||||
}
|
||||
the_end:
|
||||
#if CONFIG_AVFILTER
|
||||
avfilter_graph_free(&graph);
|
||||
#endif
|
||||
av_frame_free(&frame);
|
||||
return 0;
|
||||
}
|
||||
@@ -2559,37 +2557,6 @@ static int audio_open(void *opaque, AVChannelLayout *wanted_channel_layout, int
|
||||
return spec.size;
|
||||
}
|
||||
|
||||
static int create_hwaccel(AVBufferRef **device_ctx)
|
||||
{
|
||||
enum AVHWDeviceType type;
|
||||
int ret;
|
||||
AVBufferRef *vk_dev;
|
||||
|
||||
*device_ctx = NULL;
|
||||
|
||||
if (!hwaccel)
|
||||
return 0;
|
||||
|
||||
type = av_hwdevice_find_type_by_name(hwaccel);
|
||||
if (type == AV_HWDEVICE_TYPE_NONE)
|
||||
return AVERROR(ENOTSUP);
|
||||
|
||||
ret = vk_renderer_get_hw_dev(vk_renderer, &vk_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = av_hwdevice_ctx_create_derived(device_ctx, type, vk_dev, 0);
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
if (ret != AVERROR(ENOSYS))
|
||||
return ret;
|
||||
|
||||
av_log(NULL, AV_LOG_WARNING, "Derive %s from vulkan not supported.\n", hwaccel);
|
||||
ret = av_hwdevice_ctx_create(device_ctx, type, NULL, NULL, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* open a given stream. Return 0 if OK */
|
||||
static int stream_component_open(VideoState *is, int stream_index)
|
||||
{
|
||||
@@ -2645,24 +2612,11 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
if (fast)
|
||||
avctx->flags2 |= AV_CODEC_FLAG2_FAST;
|
||||
|
||||
ret = filter_codec_opts(codec_opts, avctx->codec_id, ic,
|
||||
ic->streams[stream_index], codec, &opts);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, ic->streams[stream_index], codec);
|
||||
if (!av_dict_get(opts, "threads", NULL, 0))
|
||||
av_dict_set(&opts, "threads", "auto", 0);
|
||||
if (stream_lowres)
|
||||
av_dict_set_int(&opts, "lowres", stream_lowres, 0);
|
||||
|
||||
av_dict_set(&opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
|
||||
|
||||
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
ret = create_hwaccel(&avctx->hw_device_ctx);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
@@ -2676,6 +2630,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
|
||||
switch (avctx->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
#if CONFIG_AVFILTER
|
||||
{
|
||||
AVFilterContext *sink;
|
||||
|
||||
@@ -2692,6 +2647,12 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
#else
|
||||
sample_rate = avctx->sample_rate;
|
||||
ret = av_channel_layout_copy(&ch_layout, &avctx->ch_layout);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
/* prepare audio output */
|
||||
if ((ret = audio_open(is, &ch_layout, sample_rate, &is->audio_tgt)) < 0)
|
||||
@@ -2713,7 +2674,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
|
||||
if ((ret = decoder_init(&is->auddec, avctx, &is->audioq, is->continue_read_thread)) < 0)
|
||||
goto fail;
|
||||
if (is->ic->iformat->flags & AVFMT_NOTIMESTAMPS) {
|
||||
if ((is->ic->iformat->flags & (AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK)) && !is->ic->iformat->read_seek) {
|
||||
is->auddec.start_pts = is->audio_st->start_time;
|
||||
is->auddec.start_pts_tb = is->audio_st->time_base;
|
||||
}
|
||||
@@ -2844,17 +2805,11 @@ static int read_thread(void *arg)
|
||||
if (genpts)
|
||||
ic->flags |= AVFMT_FLAG_GENPTS;
|
||||
|
||||
if (find_stream_info) {
|
||||
AVDictionary **opts;
|
||||
int orig_nb_streams = ic->nb_streams;
|
||||
av_format_inject_global_side_data(ic);
|
||||
|
||||
err = setup_find_stream_info_opts(ic, codec_opts, &opts);
|
||||
if (err < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Error setting up avformat_find_stream_info() options\n");
|
||||
ret = err;
|
||||
goto fail;
|
||||
}
|
||||
if (find_stream_info) {
|
||||
AVDictionary **opts = setup_find_stream_info_opts(ic, codec_opts);
|
||||
int orig_nb_streams = ic->nb_streams;
|
||||
|
||||
err = avformat_find_stream_info(ic, opts);
|
||||
|
||||
@@ -3371,6 +3326,7 @@ static void event_loop(VideoState *cur_stream)
|
||||
stream_cycle_channel(cur_stream, AVMEDIA_TYPE_SUBTITLE);
|
||||
break;
|
||||
case SDLK_w:
|
||||
#if CONFIG_AVFILTER
|
||||
if (cur_stream->show_mode == SHOW_MODE_VIDEO && cur_stream->vfilter_idx < nb_vfilters - 1) {
|
||||
if (++cur_stream->vfilter_idx >= nb_vfilters)
|
||||
cur_stream->vfilter_idx = 0;
|
||||
@@ -3378,6 +3334,9 @@ static void event_loop(VideoState *cur_stream)
|
||||
cur_stream->vfilter_idx = 0;
|
||||
toggle_audio_display(cur_stream);
|
||||
}
|
||||
#else
|
||||
toggle_audio_display(cur_stream);
|
||||
#endif
|
||||
break;
|
||||
case SDLK_PAGEUP:
|
||||
if (cur_stream->ic->nb_chapters <= 1) {
|
||||
@@ -3497,8 +3456,6 @@ static void event_loop(VideoState *cur_stream)
|
||||
SDL_DestroyTexture(cur_stream->vis_texture);
|
||||
cur_stream->vis_texture = NULL;
|
||||
}
|
||||
if (vk_renderer)
|
||||
vk_renderer_resize(vk_renderer, screen_width, screen_height);
|
||||
case SDL_WINDOWEVENT_EXPOSED:
|
||||
cur_stream->force_refresh = 1;
|
||||
}
|
||||
@@ -3515,23 +3472,13 @@ static void event_loop(VideoState *cur_stream)
|
||||
|
||||
static int opt_width(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
double num;
|
||||
int ret = parse_number(opt, arg, OPT_INT64, 1, INT_MAX, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
screen_width = num;
|
||||
screen_width = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_height(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
double num;
|
||||
int ret = parse_number(opt, arg, OPT_INT64, 1, INT_MAX, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
screen_height = num;
|
||||
screen_height = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3560,35 +3507,38 @@ static int opt_sync(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_seek(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
start_time = parse_time_or_die(opt, arg, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_duration(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
duration = parse_time_or_die(opt, arg, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_show_mode(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
show_mode = !strcmp(arg, "video") ? SHOW_MODE_VIDEO :
|
||||
!strcmp(arg, "waves") ? SHOW_MODE_WAVES :
|
||||
!strcmp(arg, "rdft" ) ? SHOW_MODE_RDFT : SHOW_MODE_NONE;
|
||||
|
||||
if (show_mode == SHOW_MODE_NONE) {
|
||||
double num;
|
||||
int ret = parse_number(opt, arg, OPT_INT, 0, SHOW_MODE_NB-1, &num);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
show_mode = num;
|
||||
}
|
||||
!strcmp(arg, "rdft" ) ? SHOW_MODE_RDFT :
|
||||
parse_number_or_die(opt, arg, OPT_INT, 0, SHOW_MODE_NB-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_input_file(void *optctx, const char *filename)
|
||||
static void opt_input_file(void *optctx, const char *filename)
|
||||
{
|
||||
if (input_filename) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
||||
filename, input_filename);
|
||||
return AVERROR(EINVAL);
|
||||
exit(1);
|
||||
}
|
||||
if (!strcmp(filename, "-"))
|
||||
filename = "fd:";
|
||||
input_filename = filename;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_codec(void *optctx, const char *opt, const char *arg)
|
||||
@@ -3626,8 +3576,8 @@ static const OptionDef options[] = {
|
||||
{ "ast", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_specifier" },
|
||||
{ "vst", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_specifier" },
|
||||
{ "sst", OPT_STRING | HAS_ARG | OPT_EXPERT, { &wanted_stream_spec[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_specifier" },
|
||||
{ "ss", HAS_ARG | OPT_TIME, { &start_time }, "seek to a given position in seconds", "pos" },
|
||||
{ "t", HAS_ARG | OPT_TIME, { &duration }, "play \"duration\" seconds of audio/video", "duration" },
|
||||
{ "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" },
|
||||
@@ -3650,8 +3600,10 @@ static const OptionDef options[] = {
|
||||
{ "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" },
|
||||
#endif
|
||||
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
|
||||
{ "showmode", HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
|
||||
{ "i", OPT_BOOL, { &dummy}, "read specified file", "input_file"},
|
||||
@@ -3663,9 +3615,6 @@ static const OptionDef options[] = {
|
||||
{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
|
||||
"read and decode the streams to fill missing information with heuristics" },
|
||||
{ "filter_threads", HAS_ARG | OPT_INT | OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" },
|
||||
{ "enable_vulkan", OPT_BOOL, { &enable_vulkan }, "enable vulkan renderer" },
|
||||
{ "vulkan_params", HAS_ARG | OPT_STRING | OPT_EXPERT, { &vulkan_params }, "vulkan configuration using a list of key=value pairs separated by ':'" },
|
||||
{ "hwaccel", HAS_ARG | OPT_STRING | OPT_EXPERT, { &hwaccel }, "use HW accelerated decoding" },
|
||||
{ NULL, },
|
||||
};
|
||||
|
||||
@@ -3685,7 +3634,11 @@ void show_help_default(const char *opt, const char *arg)
|
||||
printf("\n");
|
||||
show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);
|
||||
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
|
||||
#if !CONFIG_AVFILTER
|
||||
show_help_children(sws_get_class(), AV_OPT_FLAG_ENCODING_PARAM);
|
||||
#else
|
||||
show_help_children(avfilter_get_class(), AV_OPT_FLAG_FILTERING_PARAM);
|
||||
#endif
|
||||
printf("\nWhile playing:\n"
|
||||
"q, ESC quit\n"
|
||||
"f toggle full screen\n"
|
||||
@@ -3710,7 +3663,7 @@ void show_help_default(const char *opt, const char *arg)
|
||||
/* Called from the main */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int flags, ret;
|
||||
int flags;
|
||||
VideoState *is;
|
||||
|
||||
init_dynload();
|
||||
@@ -3729,9 +3682,7 @@ int main(int argc, char **argv)
|
||||
|
||||
show_banner(argc, argv, options);
|
||||
|
||||
ret = parse_options(NULL, argc, argv, options, opt_input_file);
|
||||
if (ret < 0)
|
||||
exit(ret == AVERROR_EXIT ? 0 : 1);
|
||||
parse_options(NULL, argc, argv, options, opt_input_file);
|
||||
|
||||
if (!input_filename) {
|
||||
show_usage();
|
||||
@@ -3780,40 +3731,9 @@ int main(int argc, char **argv)
|
||||
#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
|
||||
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
|
||||
#endif
|
||||
if (hwaccel && !enable_vulkan) {
|
||||
av_log(NULL, AV_LOG_INFO, "Enable vulkan renderer to support hwaccel %s\n", hwaccel);
|
||||
enable_vulkan = 1;
|
||||
}
|
||||
if (enable_vulkan) {
|
||||
vk_renderer = vk_get_renderer();
|
||||
if (vk_renderer) {
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 6)
|
||||
flags |= SDL_WINDOW_VULKAN;
|
||||
#endif
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_WARNING, "Doesn't support vulkan renderer, fallback to SDL renderer\n");
|
||||
enable_vulkan = 0;
|
||||
}
|
||||
}
|
||||
window = SDL_CreateWindow(program_name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, default_width, default_height, flags);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
if (!window) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Failed to create window: %s", SDL_GetError());
|
||||
do_exit(NULL);
|
||||
}
|
||||
|
||||
if (vk_renderer) {
|
||||
AVDictionary *dict = NULL;
|
||||
|
||||
if (vulkan_params)
|
||||
av_dict_parse_string(&dict, vulkan_params, "=", ":", 0);
|
||||
ret = vk_renderer_create(vk_renderer, window, dict);
|
||||
av_dict_free(&dict);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Failed to create vulkan renderer, %s\n", av_err2str(ret));
|
||||
do_exit(NULL);
|
||||
}
|
||||
} else {
|
||||
if (window) {
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
if (!renderer) {
|
||||
av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer: %s\n", SDL_GetError());
|
||||
@@ -3823,10 +3743,10 @@ int main(int argc, char **argv)
|
||||
if (!SDL_GetRendererInfo(renderer, &renderer_info))
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", renderer_info.name);
|
||||
}
|
||||
if (!renderer || !renderer_info.num_texture_formats) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Failed to create window or renderer: %s", SDL_GetError());
|
||||
do_exit(NULL);
|
||||
}
|
||||
}
|
||||
if (!window || !renderer || !renderer_info.num_texture_formats) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Failed to create window or renderer: %s", SDL_GetError());
|
||||
do_exit(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,824 +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
|
||||
*/
|
||||
|
||||
#define VK_NO_PROTOTYPES
|
||||
#define VK_ENABLE_BETA_EXTENSIONS
|
||||
|
||||
#include "config.h"
|
||||
#include "ffplay_renderer.h"
|
||||
|
||||
#if (SDL_VERSION_ATLEAST(2, 0, 6) && CONFIG_LIBPLACEBO)
|
||||
/* Get PL_API_VER */
|
||||
#include <libplacebo/config.h>
|
||||
#define HAVE_VULKAN_RENDERER (PL_API_VER >= 278)
|
||||
#else
|
||||
#define HAVE_VULKAN_RENDERER 0
|
||||
#endif
|
||||
|
||||
#if HAVE_VULKAN_RENDERER
|
||||
|
||||
#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
#define VK_USE_PLATFORM_WIN32_KHR
|
||||
#endif
|
||||
|
||||
#include <libplacebo/vulkan.h>
|
||||
#include <libplacebo/utils/frame_queue.h>
|
||||
#include <libplacebo/utils/libav.h>
|
||||
#include <SDL_vulkan.h>
|
||||
|
||||
#include "libavutil/bprint.h"
|
||||
|
||||
#endif
|
||||
|
||||
struct VkRenderer {
|
||||
const AVClass *class;
|
||||
|
||||
int (*create)(VkRenderer *renderer, SDL_Window *window, AVDictionary *dict);
|
||||
|
||||
int (*get_hw_dev)(VkRenderer *renderer, AVBufferRef **dev);
|
||||
|
||||
int (*display)(VkRenderer *renderer, AVFrame *frame);
|
||||
|
||||
int (*resize)(VkRenderer *renderer, int width, int height);
|
||||
|
||||
void (*destroy)(VkRenderer *renderer);
|
||||
};
|
||||
|
||||
#if HAVE_VULKAN_RENDERER
|
||||
|
||||
typedef struct RendererContext {
|
||||
VkRenderer api;
|
||||
|
||||
// Can be NULL when vulkan instance is created by avutil
|
||||
pl_vk_inst placebo_instance;
|
||||
pl_vulkan placebo_vulkan;
|
||||
pl_swapchain swapchain;
|
||||
VkSurfaceKHR vk_surface;
|
||||
pl_renderer renderer;
|
||||
pl_tex tex[4];
|
||||
|
||||
pl_log vk_log;
|
||||
|
||||
AVBufferRef *hw_device_ref;
|
||||
AVBufferRef *hw_frame_ref;
|
||||
enum AVPixelFormat *transfer_formats;
|
||||
AVHWFramesConstraints *constraints;
|
||||
|
||||
PFN_vkGetInstanceProcAddr get_proc_addr;
|
||||
// This field is a copy from pl_vk_inst->instance or hw_device_ref instance.
|
||||
VkInstance inst;
|
||||
|
||||
AVFrame *vk_frame;
|
||||
} RendererContext;
|
||||
|
||||
static void vk_log_cb(void *log_priv, enum pl_log_level level,
|
||||
const char *msg)
|
||||
{
|
||||
static const int level_map[] = {
|
||||
AV_LOG_QUIET,
|
||||
AV_LOG_FATAL,
|
||||
AV_LOG_ERROR,
|
||||
AV_LOG_WARNING,
|
||||
AV_LOG_INFO,
|
||||
AV_LOG_DEBUG,
|
||||
AV_LOG_TRACE,
|
||||
};
|
||||
|
||||
if (level > 0 && level < FF_ARRAY_ELEMS(level_map))
|
||||
av_log(log_priv, level_map[level], "%s\n", msg);
|
||||
}
|
||||
|
||||
// Should keep sync with optional_device_exts inside hwcontext_vulkan.c
|
||||
static const char *optional_device_exts[] = {
|
||||
/* Misc or required by other extensions */
|
||||
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME,
|
||||
VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME,
|
||||
VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME,
|
||||
VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME,
|
||||
VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME,
|
||||
VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME,
|
||||
VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME,
|
||||
|
||||
/* Imports/exports */
|
||||
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
|
||||
VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME,
|
||||
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME,
|
||||
VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
|
||||
VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME,
|
||||
#ifdef _WIN32
|
||||
VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
|
||||
VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME,
|
||||
#endif
|
||||
|
||||
/* Video encoding/decoding */
|
||||
VK_KHR_VIDEO_QUEUE_EXTENSION_NAME,
|
||||
VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME,
|
||||
VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME,
|
||||
VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME,
|
||||
"VK_MESA_video_decode_av1",
|
||||
};
|
||||
|
||||
static inline int enable_debug(AVDictionary *opt)
|
||||
{
|
||||
AVDictionaryEntry *entry = av_dict_get(opt, "debug", NULL, 0);
|
||||
int debug = entry && strtol(entry->value, NULL, 10);
|
||||
return debug;
|
||||
}
|
||||
|
||||
static void hwctx_lock_queue(void *priv, uint32_t qf, uint32_t qidx)
|
||||
{
|
||||
AVHWDeviceContext *avhwctx = priv;
|
||||
const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
|
||||
hwctx->lock_queue(avhwctx, qf, qidx);
|
||||
}
|
||||
|
||||
static void hwctx_unlock_queue(void *priv, uint32_t qf, uint32_t qidx)
|
||||
{
|
||||
AVHWDeviceContext *avhwctx = priv;
|
||||
const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
|
||||
hwctx->unlock_queue(avhwctx, qf, qidx);
|
||||
}
|
||||
|
||||
static int add_instance_extension(const char **ext, unsigned num_ext,
|
||||
const AVDictionary *opt,
|
||||
AVDictionary **dict)
|
||||
{
|
||||
const char *inst_ext_key = "instance_extensions";
|
||||
AVDictionaryEntry *entry;
|
||||
AVBPrint buf;
|
||||
char *ext_list = NULL;
|
||||
int ret;
|
||||
|
||||
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
for (int i = 0; i < num_ext; i++) {
|
||||
if (i)
|
||||
av_bprintf(&buf, "+%s", ext[i]);
|
||||
else
|
||||
av_bprintf(&buf, "%s", ext[i]);
|
||||
}
|
||||
|
||||
entry = av_dict_get(opt, inst_ext_key, NULL, 0);
|
||||
if (entry && entry->value && entry->value[0]) {
|
||||
if (num_ext)
|
||||
av_bprintf(&buf, "+");
|
||||
av_bprintf(&buf, "%s", entry->value);
|
||||
}
|
||||
|
||||
ret = av_bprint_finalize(&buf, &ext_list);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return av_dict_set(dict, inst_ext_key, ext_list, AV_DICT_DONT_STRDUP_VAL);
|
||||
}
|
||||
|
||||
static int add_device_extension(const AVDictionary *opt,
|
||||
AVDictionary **dict)
|
||||
{
|
||||
const char *dev_ext_key = "device_extensions";
|
||||
AVDictionaryEntry *entry;
|
||||
AVBPrint buf;
|
||||
char *ext_list = NULL;
|
||||
int ret;
|
||||
|
||||
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
av_bprintf(&buf, "%s", VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
for (int i = 0; i < pl_vulkan_num_recommended_extensions; i++)
|
||||
av_bprintf(&buf, "+%s", pl_vulkan_recommended_extensions[i]);
|
||||
|
||||
entry = av_dict_get(opt, dev_ext_key, NULL, 0);
|
||||
if (entry && entry->value && entry->value[0])
|
||||
av_bprintf(&buf, "+%s", entry->value);
|
||||
|
||||
ret = av_bprint_finalize(&buf, &ext_list);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return av_dict_set(dict, dev_ext_key, ext_list, AV_DICT_DONT_STRDUP_VAL);
|
||||
}
|
||||
|
||||
static int create_vk_by_hwcontext(VkRenderer *renderer,
|
||||
const char **ext, unsigned num_ext,
|
||||
const AVDictionary *opt)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
AVHWDeviceContext *dev;
|
||||
AVVulkanDeviceContext *hwctx;
|
||||
AVDictionary *dict = NULL;
|
||||
int ret;
|
||||
|
||||
ret = add_instance_extension(ext, num_ext, opt, &dict);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = add_device_extension(opt, &dict);
|
||||
if (ret) {
|
||||
av_dict_free(&dict);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = av_hwdevice_ctx_create(&ctx->hw_device_ref, AV_HWDEVICE_TYPE_VULKAN,
|
||||
NULL, dict, 0);
|
||||
av_dict_free(&dict);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dev = (AVHWDeviceContext *) ctx->hw_device_ref->data;
|
||||
hwctx = dev->hwctx;
|
||||
|
||||
// There is no way to pass SDL GetInstanceProcAddr to hwdevice.
|
||||
// Check the result and return error if they don't match.
|
||||
if (hwctx->get_proc_addr != SDL_Vulkan_GetVkGetInstanceProcAddr()) {
|
||||
av_log(renderer, AV_LOG_ERROR,
|
||||
"hwdevice and SDL use different get_proc_addr. "
|
||||
"Try -vulkan_params create_by_placebo=1\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
ctx->get_proc_addr = hwctx->get_proc_addr;
|
||||
ctx->inst = hwctx->inst;
|
||||
ctx->placebo_vulkan = pl_vulkan_import(ctx->vk_log,
|
||||
pl_vulkan_import_params(
|
||||
.instance = hwctx->inst,
|
||||
.get_proc_addr = hwctx->get_proc_addr,
|
||||
.phys_device = hwctx->phys_dev,
|
||||
.device = hwctx->act_dev,
|
||||
.extensions = hwctx->enabled_dev_extensions,
|
||||
.num_extensions = hwctx->nb_enabled_dev_extensions,
|
||||
.features = &hwctx->device_features,
|
||||
.lock_queue = hwctx_lock_queue,
|
||||
.unlock_queue = hwctx_unlock_queue,
|
||||
.queue_ctx = dev,
|
||||
.queue_graphics = {
|
||||
.index = hwctx->queue_family_index,
|
||||
.count = hwctx->nb_graphics_queues,
|
||||
},
|
||||
.queue_compute = {
|
||||
.index = hwctx->queue_family_comp_index,
|
||||
.count = hwctx->nb_comp_queues,
|
||||
},
|
||||
.queue_transfer = {
|
||||
.index = hwctx->queue_family_tx_index,
|
||||
.count = hwctx->nb_tx_queues,
|
||||
},
|
||||
));
|
||||
if (!ctx->placebo_vulkan)
|
||||
return AVERROR_EXTERNAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void placebo_lock_queue(struct AVHWDeviceContext *dev_ctx,
|
||||
uint32_t queue_family, uint32_t index)
|
||||
{
|
||||
RendererContext *ctx = dev_ctx->user_opaque;
|
||||
pl_vulkan vk = ctx->placebo_vulkan;
|
||||
vk->lock_queue(vk, queue_family, index);
|
||||
}
|
||||
|
||||
static void placebo_unlock_queue(struct AVHWDeviceContext *dev_ctx,
|
||||
uint32_t queue_family,
|
||||
uint32_t index)
|
||||
{
|
||||
RendererContext *ctx = dev_ctx->user_opaque;
|
||||
pl_vulkan vk = ctx->placebo_vulkan;
|
||||
vk->unlock_queue(vk, queue_family, index);
|
||||
}
|
||||
|
||||
static int get_decode_queue(VkRenderer *renderer, int *index, int *count)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
VkQueueFamilyProperties *queue_family_prop = NULL;
|
||||
uint32_t num_queue_family_prop = 0;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties get_queue_family_prop;
|
||||
PFN_vkGetInstanceProcAddr get_proc_addr = ctx->get_proc_addr;
|
||||
|
||||
*index = -1;
|
||||
*count = 0;
|
||||
get_queue_family_prop = (PFN_vkGetPhysicalDeviceQueueFamilyProperties)
|
||||
get_proc_addr(ctx->placebo_instance->instance,
|
||||
"vkGetPhysicalDeviceQueueFamilyProperties");
|
||||
get_queue_family_prop(ctx->placebo_vulkan->phys_device,
|
||||
&num_queue_family_prop, NULL);
|
||||
if (!num_queue_family_prop)
|
||||
return AVERROR_EXTERNAL;
|
||||
|
||||
queue_family_prop = av_calloc(num_queue_family_prop,
|
||||
sizeof(*queue_family_prop));
|
||||
if (!queue_family_prop)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
get_queue_family_prop(ctx->placebo_vulkan->phys_device,
|
||||
&num_queue_family_prop,
|
||||
queue_family_prop);
|
||||
|
||||
for (int i = 0; i < num_queue_family_prop; i++) {
|
||||
if (queue_family_prop[i].queueFlags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) {
|
||||
*index = i;
|
||||
*count = queue_family_prop[i].queueCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
av_free(queue_family_prop);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int create_vk_by_placebo(VkRenderer *renderer,
|
||||
const char **ext, unsigned num_ext,
|
||||
const AVDictionary *opt)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
AVHWDeviceContext *device_ctx;
|
||||
AVVulkanDeviceContext *vk_dev_ctx;
|
||||
int decode_index;
|
||||
int decode_count;
|
||||
int ret;
|
||||
|
||||
ctx->get_proc_addr = SDL_Vulkan_GetVkGetInstanceProcAddr();
|
||||
|
||||
ctx->placebo_instance = pl_vk_inst_create(ctx->vk_log, pl_vk_inst_params(
|
||||
.get_proc_addr = ctx->get_proc_addr,
|
||||
.debug = enable_debug(opt),
|
||||
.extensions = ext,
|
||||
.num_extensions = num_ext
|
||||
));
|
||||
if (!ctx->placebo_instance) {
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
ctx->inst = ctx->placebo_instance->instance;
|
||||
|
||||
ctx->placebo_vulkan = pl_vulkan_create(ctx->vk_log, pl_vulkan_params(
|
||||
.instance = ctx->placebo_instance->instance,
|
||||
.get_proc_addr = ctx->placebo_instance->get_proc_addr,
|
||||
.surface = ctx->vk_surface,
|
||||
.allow_software = false,
|
||||
.opt_extensions = optional_device_exts,
|
||||
.num_opt_extensions = FF_ARRAY_ELEMS(optional_device_exts),
|
||||
.extra_queues = VK_QUEUE_VIDEO_DECODE_BIT_KHR,
|
||||
));
|
||||
if (!ctx->placebo_vulkan)
|
||||
return AVERROR_EXTERNAL;
|
||||
ctx->hw_device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VULKAN);
|
||||
if (!ctx->hw_device_ref) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
device_ctx = (AVHWDeviceContext *) ctx->hw_device_ref->data;
|
||||
device_ctx->user_opaque = ctx;
|
||||
|
||||
vk_dev_ctx = device_ctx->hwctx;
|
||||
vk_dev_ctx->lock_queue = placebo_lock_queue,
|
||||
vk_dev_ctx->unlock_queue = placebo_unlock_queue;
|
||||
|
||||
vk_dev_ctx->get_proc_addr = ctx->placebo_instance->get_proc_addr;
|
||||
|
||||
vk_dev_ctx->inst = ctx->placebo_instance->instance;
|
||||
vk_dev_ctx->phys_dev = ctx->placebo_vulkan->phys_device;
|
||||
vk_dev_ctx->act_dev = ctx->placebo_vulkan->device;
|
||||
|
||||
vk_dev_ctx->device_features = *ctx->placebo_vulkan->features;
|
||||
|
||||
vk_dev_ctx->enabled_inst_extensions = ctx->placebo_instance->extensions;
|
||||
vk_dev_ctx->nb_enabled_inst_extensions = ctx->placebo_instance->num_extensions;
|
||||
|
||||
vk_dev_ctx->enabled_dev_extensions = ctx->placebo_vulkan->extensions;
|
||||
vk_dev_ctx->nb_enabled_dev_extensions = ctx->placebo_vulkan->num_extensions;
|
||||
|
||||
vk_dev_ctx->queue_family_index = ctx->placebo_vulkan->queue_graphics.index;
|
||||
vk_dev_ctx->nb_graphics_queues = ctx->placebo_vulkan->queue_graphics.count;
|
||||
|
||||
vk_dev_ctx->queue_family_tx_index = ctx->placebo_vulkan->queue_transfer.index;
|
||||
vk_dev_ctx->nb_tx_queues = ctx->placebo_vulkan->queue_transfer.count;
|
||||
|
||||
vk_dev_ctx->queue_family_comp_index = ctx->placebo_vulkan->queue_compute.index;
|
||||
vk_dev_ctx->nb_comp_queues = ctx->placebo_vulkan->queue_compute.count;
|
||||
|
||||
ret = get_decode_queue(renderer, &decode_index, &decode_count);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
vk_dev_ctx->queue_family_decode_index = decode_index;
|
||||
vk_dev_ctx->nb_decode_queues = decode_count;
|
||||
|
||||
ret = av_hwdevice_ctx_init(ctx->hw_device_ref);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int create(VkRenderer *renderer, SDL_Window *window, AVDictionary *opt)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned num_ext = 0;
|
||||
const char **ext = NULL;
|
||||
int w, h;
|
||||
struct pl_log_params vk_log_params = {
|
||||
.log_cb = vk_log_cb,
|
||||
.log_level = PL_LOG_DEBUG,
|
||||
.log_priv = renderer,
|
||||
};
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
AVDictionaryEntry *entry;
|
||||
|
||||
ctx->vk_log = pl_log_create(PL_API_VER, &vk_log_params);
|
||||
|
||||
if (!SDL_Vulkan_GetInstanceExtensions(window, &num_ext, NULL)) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Failed to get vulkan extensions: %s\n",
|
||||
SDL_GetError());
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
ext = av_calloc(num_ext, sizeof(*ext));
|
||||
if (!ext) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto out;
|
||||
}
|
||||
|
||||
SDL_Vulkan_GetInstanceExtensions(window, &num_ext, ext);
|
||||
|
||||
entry = av_dict_get(opt, "create_by_placebo", NULL, 0);
|
||||
if (entry && strtol(entry->value, NULL, 10))
|
||||
ret = create_vk_by_placebo(renderer, ext, num_ext, opt);
|
||||
else
|
||||
ret = create_vk_by_hwcontext(renderer, ext, num_ext, opt);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
if (!SDL_Vulkan_CreateSurface(window, ctx->inst, &ctx->vk_surface)) {
|
||||
ret = AVERROR_EXTERNAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ctx->swapchain = pl_vulkan_create_swapchain(
|
||||
ctx->placebo_vulkan,
|
||||
pl_vulkan_swapchain_params(
|
||||
.surface = ctx->vk_surface,
|
||||
.present_mode = VK_PRESENT_MODE_FIFO_KHR));
|
||||
if (!ctx->swapchain) {
|
||||
ret = AVERROR_EXTERNAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
SDL_Vulkan_GetDrawableSize(window, &w, &h);
|
||||
pl_swapchain_resize(ctx->swapchain, &w, &h);
|
||||
|
||||
ctx->renderer = pl_renderer_create(ctx->vk_log, ctx->placebo_vulkan->gpu);
|
||||
if (!ctx->renderer) {
|
||||
ret = AVERROR_EXTERNAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ctx->vk_frame = av_frame_alloc();
|
||||
if (!ctx->vk_frame) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
av_free(ext);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int get_hw_dev(VkRenderer *renderer, AVBufferRef **dev)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
|
||||
*dev = ctx->hw_device_ref;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int create_hw_frame(VkRenderer *renderer, AVFrame *frame)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
AVHWFramesContext *src_hw_frame = (AVHWFramesContext *)
|
||||
frame->hw_frames_ctx->data;
|
||||
AVHWFramesContext *hw_frame;
|
||||
AVVulkanFramesContext *vk_frame_ctx;
|
||||
int ret;
|
||||
|
||||
if (ctx->hw_frame_ref) {
|
||||
hw_frame = (AVHWFramesContext *) ctx->hw_frame_ref->data;
|
||||
|
||||
if (hw_frame->width == frame->width &&
|
||||
hw_frame->height == frame->height &&
|
||||
hw_frame->sw_format == src_hw_frame->sw_format)
|
||||
return 0;
|
||||
|
||||
av_buffer_unref(&ctx->hw_frame_ref);
|
||||
}
|
||||
|
||||
if (!ctx->constraints) {
|
||||
ctx->constraints = av_hwdevice_get_hwframe_constraints(
|
||||
ctx->hw_device_ref, NULL);
|
||||
if (!ctx->constraints)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
// Check constraints and skip create hwframe. Don't take it as error since
|
||||
// we can fallback to memory copy from GPU to CPU.
|
||||
if ((ctx->constraints->max_width &&
|
||||
ctx->constraints->max_width < frame->width) ||
|
||||
(ctx->constraints->max_height &&
|
||||
ctx->constraints->max_height < frame->height) ||
|
||||
(ctx->constraints->min_width &&
|
||||
ctx->constraints->min_width > frame->width) ||
|
||||
(ctx->constraints->min_height &&
|
||||
ctx->constraints->min_height > frame->height))
|
||||
return 0;
|
||||
|
||||
if (ctx->constraints->valid_sw_formats) {
|
||||
enum AVPixelFormat *sw_formats = ctx->constraints->valid_sw_formats;
|
||||
while (*sw_formats != AV_PIX_FMT_NONE) {
|
||||
if (*sw_formats == src_hw_frame->sw_format)
|
||||
break;
|
||||
sw_formats++;
|
||||
}
|
||||
if (*sw_formats == AV_PIX_FMT_NONE)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ctx->hw_frame_ref = av_hwframe_ctx_alloc(ctx->hw_device_ref);
|
||||
if (!ctx->hw_frame_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
hw_frame = (AVHWFramesContext *) ctx->hw_frame_ref->data;
|
||||
hw_frame->format = AV_PIX_FMT_VULKAN;
|
||||
hw_frame->sw_format = src_hw_frame->sw_format;
|
||||
hw_frame->width = frame->width;
|
||||
hw_frame->height = frame->height;
|
||||
|
||||
if (frame->format == AV_PIX_FMT_CUDA) {
|
||||
vk_frame_ctx = hw_frame->hwctx;
|
||||
vk_frame_ctx->flags = AV_VK_FRAME_FLAG_DISABLE_MULTIPLANE;
|
||||
}
|
||||
|
||||
ret = av_hwframe_ctx_init(ctx->hw_frame_ref);
|
||||
if (ret < 0) {
|
||||
av_log(renderer, AV_LOG_ERROR, "Create hwframe context failed, %s\n",
|
||||
av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
av_hwframe_transfer_get_formats(ctx->hw_frame_ref,
|
||||
AV_HWFRAME_TRANSFER_DIRECTION_TO,
|
||||
&ctx->transfer_formats, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int check_hw_transfer(RendererContext *ctx, AVFrame *frame)
|
||||
{
|
||||
if (!ctx->hw_frame_ref || !ctx->transfer_formats)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; ctx->transfer_formats[i] != AV_PIX_FMT_NONE; i++)
|
||||
if (ctx->transfer_formats[i] == frame->format)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int move_to_output_frame(RendererContext *ctx, AVFrame *frame)
|
||||
{
|
||||
int ret = av_frame_copy_props(ctx->vk_frame, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
av_frame_unref(frame);
|
||||
av_frame_move_ref(frame, ctx->vk_frame);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int map_frame(VkRenderer *renderer, AVFrame *frame, int use_hw_frame)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
int ret;
|
||||
|
||||
if (use_hw_frame && !ctx->hw_frame_ref)
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
// Try map data first
|
||||
av_frame_unref(ctx->vk_frame);
|
||||
if (use_hw_frame) {
|
||||
ctx->vk_frame->hw_frames_ctx = av_buffer_ref(ctx->hw_frame_ref);
|
||||
ctx->vk_frame->format = AV_PIX_FMT_VULKAN;
|
||||
}
|
||||
ret = av_hwframe_map(ctx->vk_frame, frame, 0);
|
||||
if (!ret)
|
||||
return move_to_output_frame(ctx, frame);
|
||||
|
||||
if (ret != AVERROR(ENOSYS))
|
||||
av_log(NULL, AV_LOG_FATAL, "Map frame failed: %s\n", av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int transfer_frame(VkRenderer *renderer, AVFrame *frame, int use_hw_frame)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
int ret;
|
||||
|
||||
if (use_hw_frame && !check_hw_transfer(ctx, frame))
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
av_frame_unref(ctx->vk_frame);
|
||||
if (use_hw_frame)
|
||||
av_hwframe_get_buffer(ctx->hw_frame_ref, ctx->vk_frame, 0);
|
||||
ret = av_hwframe_transfer_data(ctx->vk_frame, frame, 1);
|
||||
if (!ret)
|
||||
return move_to_output_frame(ctx, frame);
|
||||
|
||||
if (ret != AVERROR(ENOSYS))
|
||||
av_log(NULL, AV_LOG_FATAL, "Transfer frame failed: %s\n",
|
||||
av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int convert_frame(VkRenderer *renderer, AVFrame *frame)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!frame->hw_frames_ctx)
|
||||
return 0;
|
||||
|
||||
if (frame->format == AV_PIX_FMT_VULKAN)
|
||||
return 0;
|
||||
|
||||
ret = create_hw_frame(renderer, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
for (int use_hw = 1; use_hw >=0; use_hw--) {
|
||||
ret = map_frame(renderer, frame, use_hw);
|
||||
if (!ret)
|
||||
return 0;
|
||||
if (ret != AVERROR(ENOSYS))
|
||||
return ret;
|
||||
|
||||
ret = transfer_frame(renderer, frame, use_hw);
|
||||
if (!ret)
|
||||
return 0;
|
||||
if (ret != AVERROR(ENOSYS))
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int display(VkRenderer *renderer, AVFrame *frame)
|
||||
{
|
||||
struct pl_swapchain_frame swap_frame = {0};
|
||||
struct pl_frame pl_frame = {0};
|
||||
struct pl_frame target = {0};
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
int ret = 0;
|
||||
|
||||
ret = convert_frame(renderer, frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!pl_map_avframe_ex(ctx->placebo_vulkan->gpu, &pl_frame, pl_avframe_params(
|
||||
.frame = frame,
|
||||
.tex = ctx->tex))) {
|
||||
av_log(NULL, AV_LOG_ERROR, "pl_map_avframe_ex failed\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
if (!pl_swapchain_start_frame(ctx->swapchain, &swap_frame)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "start frame failed\n");
|
||||
ret = AVERROR_EXTERNAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
pl_frame_from_swapchain(&target, &swap_frame);
|
||||
if (!pl_render_image(ctx->renderer, &pl_frame, &target,
|
||||
&pl_render_default_params)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "pl_render_image failed\n");
|
||||
ret = AVERROR_EXTERNAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!pl_swapchain_submit_frame(ctx->swapchain)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "pl_swapchain_submit_frame failed\n");
|
||||
ret = AVERROR_EXTERNAL;
|
||||
goto out;
|
||||
}
|
||||
pl_swapchain_swap_buffers(ctx->swapchain);
|
||||
|
||||
out:
|
||||
pl_unmap_avframe(ctx->placebo_vulkan->gpu, &pl_frame);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int resize(VkRenderer *renderer, int width, int height)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
|
||||
if (!pl_swapchain_resize(ctx->swapchain, &width, &height))
|
||||
return AVERROR_EXTERNAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void destroy(VkRenderer *renderer)
|
||||
{
|
||||
RendererContext *ctx = (RendererContext *) renderer;
|
||||
PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
|
||||
|
||||
av_frame_free(&ctx->vk_frame);
|
||||
av_freep(&ctx->transfer_formats);
|
||||
av_hwframe_constraints_free(&ctx->constraints);
|
||||
av_buffer_unref(&ctx->hw_frame_ref);
|
||||
|
||||
if (ctx->placebo_vulkan) {
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(ctx->tex); i++)
|
||||
pl_tex_destroy(ctx->placebo_vulkan->gpu, &ctx->tex[i]);
|
||||
pl_renderer_destroy(&ctx->renderer);
|
||||
pl_swapchain_destroy(&ctx->swapchain);
|
||||
pl_vulkan_destroy(&ctx->placebo_vulkan);
|
||||
}
|
||||
|
||||
if (ctx->vk_surface) {
|
||||
vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)
|
||||
ctx->get_proc_addr(ctx->inst, "vkDestroySurfaceKHR");
|
||||
vkDestroySurfaceKHR(ctx->inst, ctx->vk_surface, NULL);
|
||||
ctx->vk_surface = NULL;
|
||||
}
|
||||
|
||||
av_buffer_unref(&ctx->hw_device_ref);
|
||||
pl_vk_inst_destroy(&ctx->placebo_instance);
|
||||
|
||||
pl_log_destroy(&ctx->vk_log);
|
||||
}
|
||||
|
||||
static const AVClass vulkan_renderer_class = {
|
||||
.class_name = "Vulkan Renderer",
|
||||
.item_name = av_default_item_name,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
VkRenderer *vk_get_renderer(void)
|
||||
{
|
||||
RendererContext *ctx = av_mallocz(sizeof(*ctx));
|
||||
VkRenderer *renderer;
|
||||
|
||||
if (!ctx)
|
||||
return NULL;
|
||||
|
||||
renderer = &ctx->api;
|
||||
renderer->class = &vulkan_renderer_class;
|
||||
renderer->get_hw_dev = get_hw_dev;
|
||||
renderer->create = create;
|
||||
renderer->display = display;
|
||||
renderer->resize = resize;
|
||||
renderer->destroy = destroy;
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
VkRenderer *vk_get_renderer(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int vk_renderer_create(VkRenderer *renderer, SDL_Window *window,
|
||||
AVDictionary *opt)
|
||||
{
|
||||
return renderer->create(renderer, window, opt);
|
||||
}
|
||||
|
||||
int vk_renderer_get_hw_dev(VkRenderer *renderer, AVBufferRef **dev)
|
||||
{
|
||||
return renderer->get_hw_dev(renderer, dev);
|
||||
}
|
||||
|
||||
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame)
|
||||
{
|
||||
return renderer->display(renderer, frame);
|
||||
}
|
||||
|
||||
int vk_renderer_resize(VkRenderer *renderer, int width, int height)
|
||||
{
|
||||
return renderer->resize(renderer, width, height);
|
||||
}
|
||||
|
||||
void vk_renderer_destroy(VkRenderer *renderer)
|
||||
{
|
||||
renderer->destroy(renderer);
|
||||
}
|
||||
@@ -1,41 +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
|
||||
*/
|
||||
|
||||
#ifndef FFTOOLS_FFPLAY_RENDERER_H
|
||||
#define FFTOOLS_FFPLAY_RENDERER_H
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "libavutil/frame.h"
|
||||
|
||||
typedef struct VkRenderer VkRenderer;
|
||||
|
||||
VkRenderer *vk_get_renderer(void);
|
||||
|
||||
int vk_renderer_create(VkRenderer *renderer, SDL_Window *window,
|
||||
AVDictionary *opt);
|
||||
|
||||
int vk_renderer_get_hw_dev(VkRenderer *renderer, AVBufferRef **dev);
|
||||
|
||||
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame);
|
||||
|
||||
int vk_renderer_resize(VkRenderer *renderer, int width, int height);
|
||||
|
||||
void vk_renderer_destroy(VkRenderer *renderer);
|
||||
|
||||
#endif /* FFTOOLS_FFPLAY_RENDERER_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -291,6 +291,8 @@ static void print_codec(const AVCodec *c)
|
||||
printf("delay ");
|
||||
if (c->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME)
|
||||
printf("small ");
|
||||
if (c->capabilities & AV_CODEC_CAP_SUBFRAMES)
|
||||
printf("subframes ");
|
||||
if (c->capabilities & AV_CODEC_CAP_EXPERIMENTAL)
|
||||
printf("exp ");
|
||||
if (c->capabilities & AV_CODEC_CAP_CHANNEL_CONF)
|
||||
@@ -615,10 +617,10 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder)
|
||||
void *iter = NULL;
|
||||
const AVCodec *codec;
|
||||
|
||||
printf(" (%s:", encoder ? "encoders" : "decoders");
|
||||
printf(" (%s: ", encoder ? "encoders" : "decoders");
|
||||
|
||||
while ((codec = next_codec_for_id(id, &iter, encoder)))
|
||||
printf(" %s", codec->name);
|
||||
printf("%s ", codec->name);
|
||||
|
||||
printf(")");
|
||||
}
|
||||
@@ -632,7 +634,7 @@ static int compare_codec_desc(const void *a, const void *b)
|
||||
strcmp((*da)->name, (*db)->name);
|
||||
}
|
||||
|
||||
static int get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
|
||||
static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
|
||||
{
|
||||
const AVCodecDescriptor *desc = NULL;
|
||||
const AVCodecDescriptor **codecs;
|
||||
@@ -641,7 +643,7 @@ static int get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
|
||||
while ((desc = avcodec_descriptor_next(desc)))
|
||||
nb_codecs++;
|
||||
if (!(codecs = av_calloc(nb_codecs, sizeof(*codecs))))
|
||||
return AVERROR(ENOMEM);
|
||||
report_and_exit(AVERROR(ENOMEM));
|
||||
desc = NULL;
|
||||
while ((desc = avcodec_descriptor_next(desc)))
|
||||
codecs[i++] = desc;
|
||||
@@ -666,11 +668,7 @@ static char get_media_type_char(enum AVMediaType type)
|
||||
int show_codecs(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
const AVCodecDescriptor **codecs;
|
||||
unsigned i;
|
||||
int nb_codecs = get_codecs_sorted(&codecs);
|
||||
|
||||
if (nb_codecs < 0)
|
||||
return nb_codecs;
|
||||
unsigned i, nb_codecs = get_codecs_sorted(&codecs);
|
||||
|
||||
printf("Codecs:\n"
|
||||
" D..... = Decoding supported\n"
|
||||
@@ -692,13 +690,14 @@ int show_codecs(void *optctx, const char *opt, const char *arg)
|
||||
if (strstr(desc->name, "_deprecated"))
|
||||
continue;
|
||||
|
||||
printf(" %c%c%c%c%c%c",
|
||||
avcodec_find_decoder(desc->id) ? 'D' : '.',
|
||||
avcodec_find_encoder(desc->id) ? 'E' : '.',
|
||||
get_media_type_char(desc->type),
|
||||
(desc->props & AV_CODEC_PROP_INTRA_ONLY) ? 'I' : '.',
|
||||
(desc->props & AV_CODEC_PROP_LOSSY) ? 'L' : '.',
|
||||
(desc->props & AV_CODEC_PROP_LOSSLESS) ? 'S' : '.');
|
||||
printf(" ");
|
||||
printf(avcodec_find_decoder(desc->id) ? "D" : ".");
|
||||
printf(avcodec_find_encoder(desc->id) ? "E" : ".");
|
||||
|
||||
printf("%c", get_media_type_char(desc->type));
|
||||
printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
|
||||
printf((desc->props & AV_CODEC_PROP_LOSSY) ? "L" : ".");
|
||||
printf((desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : ".");
|
||||
|
||||
printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
|
||||
|
||||
@@ -746,13 +745,12 @@ static void print_codecs(int encoder)
|
||||
void *iter = NULL;
|
||||
|
||||
while ((codec = next_codec_for_id(desc->id, &iter, encoder))) {
|
||||
printf(" %c%c%c%c%c%c",
|
||||
get_media_type_char(desc->type),
|
||||
(codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) ? 'F' : '.',
|
||||
(codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) ? 'S' : '.',
|
||||
(codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) ? 'X' : '.',
|
||||
(codec->capabilities & AV_CODEC_CAP_DRAW_HORIZ_BAND) ? 'B' : '.',
|
||||
(codec->capabilities & AV_CODEC_CAP_DR1) ? 'D' : '.');
|
||||
printf(" %c", get_media_type_char(desc->type));
|
||||
printf((codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) ? "F" : ".");
|
||||
printf((codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) ? "S" : ".");
|
||||
printf((codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) ? "X" : ".");
|
||||
printf((codec->capabilities & AV_CODEC_CAP_DRAW_HORIZ_BAND)?"B" : ".");
|
||||
printf((codec->capabilities & AV_CODEC_CAP_DR1) ? "D" : ".");
|
||||
|
||||
printf(" %-20s %s", codec->name, codec->long_name ? codec->long_name : "");
|
||||
if (strcmp(codec->name, desc->name))
|
||||
@@ -1163,10 +1161,7 @@ int init_report(const char *env, FILE **file)
|
||||
report_file_level = strtol(val, &tail, 10);
|
||||
if (*tail) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n");
|
||||
av_free(key);
|
||||
av_free(val);
|
||||
av_free(filename_template);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
envlevel = 1;
|
||||
} else {
|
||||
@@ -1226,7 +1221,7 @@ int opt_max_alloc(void *optctx, const char *opt, const char *arg)
|
||||
max = strtol(arg, &tail, 10);
|
||||
if (*tail) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid max_alloc \"%s\".\n", arg);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
av_max_alloc(max);
|
||||
return 0;
|
||||
@@ -1300,7 +1295,7 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
|
||||
"Possible levels are numbers or:\n", arg);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
|
||||
av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", log_levels[i].name);
|
||||
return AVERROR(EINVAL);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
@@ -20,59 +20,18 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/fifo.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
#include "libavutil/timestamp.h"
|
||||
|
||||
#include "objpool.h"
|
||||
#include "sync_queue.h"
|
||||
|
||||
/*
|
||||
* How this works:
|
||||
* --------------
|
||||
* time: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||
* -------------------------------------------------------------------
|
||||
* | | | | | | | | | | | | | |
|
||||
* | ┌───┐┌────────┐┌───┐┌─────────────┐
|
||||
* stream 0| │d=1││ d=2 ││d=1││ d=3 │
|
||||
* | └───┘└────────┘└───┘└─────────────┘
|
||||
* ┌───┐ ┌───────────────────────┐
|
||||
* stream 1│d=1│ │ d=5 │
|
||||
* └───┘ └───────────────────────┘
|
||||
* | ┌───┐┌───┐┌───┐┌───┐
|
||||
* stream 2| │d=1││d=1││d=1││d=1│ <- stream 2 is the head stream of the queue
|
||||
* | └───┘└───┘└───┘└───┘
|
||||
* ^ ^
|
||||
* [stream 2 tail] [stream 2 head]
|
||||
*
|
||||
* We have N streams (N=3 in the diagram), each stream is a FIFO. The *tail* of
|
||||
* each FIFO is the frame with smallest end time, the *head* is the frame with
|
||||
* the largest end time. Frames submitted to the queue with sq_send() are placed
|
||||
* after the head, frames returned to the caller with sq_receive() are taken
|
||||
* from the tail.
|
||||
*
|
||||
* The head stream of the whole queue (SyncQueue.head_stream) is the limiting
|
||||
* stream with the *smallest* head timestamp, i.e. the stream whose source lags
|
||||
* furthest behind all other streams. It determines which frames can be output
|
||||
* from the queue.
|
||||
*
|
||||
* In the diagram, the head stream is 2, because it head time is t=5, while
|
||||
* streams 0 and 1 end at t=8 and t=9 respectively. All frames that _end_ at
|
||||
* or before t=5 can be output, i.e. the first 3 frames from stream 0, first
|
||||
* frame from stream 1, and all 4 frames from stream 2.
|
||||
*/
|
||||
|
||||
typedef struct SyncQueueStream {
|
||||
AVFifo *fifo;
|
||||
AVRational tb;
|
||||
|
||||
/* number of audio samples in fifo */
|
||||
uint64_t samples_queued;
|
||||
/* stream head: largest timestamp seen */
|
||||
int64_t head_ts;
|
||||
int limiting;
|
||||
@@ -80,16 +39,12 @@ typedef struct SyncQueueStream {
|
||||
int finished;
|
||||
|
||||
uint64_t frames_sent;
|
||||
uint64_t samples_sent;
|
||||
uint64_t frames_max;
|
||||
int frame_samples;
|
||||
} SyncQueueStream;
|
||||
|
||||
struct SyncQueue {
|
||||
enum SyncQueueType type;
|
||||
|
||||
void *logctx;
|
||||
|
||||
/* no more frames will be sent for any stream */
|
||||
int finished;
|
||||
/* sync head: the stream with the _smallest_ head timestamp
|
||||
@@ -106,10 +61,6 @@ struct SyncQueue {
|
||||
|
||||
// pool of preallocated frames to avoid constant allocations
|
||||
ObjPool *pool;
|
||||
|
||||
int have_limiting;
|
||||
|
||||
uintptr_t align_mask;
|
||||
};
|
||||
|
||||
static void frame_move(const SyncQueue *sq, SyncQueueFrame dst,
|
||||
@@ -121,62 +72,22 @@ static void frame_move(const SyncQueue *sq, SyncQueueFrame dst,
|
||||
av_frame_move_ref(dst.f, src.f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the end timestamp of a frame. If nb_samples is provided, consider
|
||||
* the frame to have this number of audio samples, otherwise use frame duration.
|
||||
*/
|
||||
static int64_t frame_end(const SyncQueue *sq, SyncQueueFrame frame, int nb_samples)
|
||||
static int64_t frame_ts(const SyncQueue *sq, SyncQueueFrame frame)
|
||||
{
|
||||
if (nb_samples) {
|
||||
int64_t d = av_rescale_q(nb_samples, (AVRational){ 1, frame.f->sample_rate},
|
||||
frame.f->time_base);
|
||||
return frame.f->pts + d;
|
||||
}
|
||||
|
||||
return (sq->type == SYNC_QUEUE_PACKETS) ?
|
||||
frame.p->pts + frame.p->duration :
|
||||
frame.f->pts + frame.f->duration;
|
||||
}
|
||||
|
||||
static int frame_samples(const SyncQueue *sq, SyncQueueFrame frame)
|
||||
{
|
||||
return (sq->type == SYNC_QUEUE_PACKETS) ? 0 : frame.f->nb_samples;
|
||||
}
|
||||
|
||||
static int frame_null(const SyncQueue *sq, SyncQueueFrame frame)
|
||||
{
|
||||
return (sq->type == SYNC_QUEUE_PACKETS) ? (frame.p == NULL) : (frame.f == NULL);
|
||||
}
|
||||
|
||||
static void tb_update(const SyncQueue *sq, SyncQueueStream *st,
|
||||
const SyncQueueFrame frame)
|
||||
{
|
||||
AVRational tb = (sq->type == SYNC_QUEUE_PACKETS) ?
|
||||
frame.p->time_base : frame.f->time_base;
|
||||
|
||||
av_assert0(tb.num > 0 && tb.den > 0);
|
||||
|
||||
if (tb.num == st->tb.num && tb.den == st->tb.den)
|
||||
return;
|
||||
|
||||
// timebase should not change after the first frame
|
||||
av_assert0(!av_fifo_can_read(st->fifo));
|
||||
|
||||
if (st->head_ts != AV_NOPTS_VALUE)
|
||||
st->head_ts = av_rescale_q(st->head_ts, st->tb, tb);
|
||||
|
||||
st->tb = tb;
|
||||
}
|
||||
|
||||
static void finish_stream(SyncQueue *sq, unsigned int stream_idx)
|
||||
{
|
||||
SyncQueueStream *st = &sq->streams[stream_idx];
|
||||
|
||||
if (!st->finished)
|
||||
av_log(sq->logctx, AV_LOG_DEBUG,
|
||||
"sq: finish %u; head ts %s\n", stream_idx,
|
||||
av_ts2timestr(st->head_ts, &st->tb));
|
||||
|
||||
st->finished = 1;
|
||||
|
||||
if (st->limiting && st->head_ts != AV_NOPTS_VALUE) {
|
||||
@@ -194,14 +105,8 @@ static void finish_stream(SyncQueue *sq, unsigned int stream_idx)
|
||||
for (unsigned int i = 0; i < sq->nb_streams; i++) {
|
||||
SyncQueueStream *st1 = &sq->streams[i];
|
||||
if (st != st1 && st1->head_ts != AV_NOPTS_VALUE &&
|
||||
av_compare_ts(st->head_ts, st->tb, st1->head_ts, st1->tb) <= 0) {
|
||||
if (!st1->finished)
|
||||
av_log(sq->logctx, AV_LOG_DEBUG,
|
||||
"sq: finish secondary %u; head ts %s\n", i,
|
||||
av_ts2timestr(st1->head_ts, &st1->tb));
|
||||
|
||||
av_compare_ts(st->head_ts, st->tb, st1->head_ts, st1->tb) <= 0)
|
||||
st1->finished = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,32 +116,21 @@ static void finish_stream(SyncQueue *sq, unsigned int stream_idx)
|
||||
return;
|
||||
}
|
||||
sq->finished = 1;
|
||||
|
||||
av_log(sq->logctx, AV_LOG_DEBUG, "sq: finish queue\n");
|
||||
}
|
||||
|
||||
static void queue_head_update(SyncQueue *sq)
|
||||
{
|
||||
av_assert0(sq->have_limiting);
|
||||
|
||||
if (sq->head_stream < 0) {
|
||||
unsigned first_limiting = UINT_MAX;
|
||||
|
||||
/* wait for one timestamp in each stream before determining
|
||||
* the queue head */
|
||||
for (unsigned int i = 0; i < sq->nb_streams; i++) {
|
||||
SyncQueueStream *st = &sq->streams[i];
|
||||
if (!st->limiting)
|
||||
continue;
|
||||
if (st->head_ts == AV_NOPTS_VALUE)
|
||||
if (st->limiting && st->head_ts == AV_NOPTS_VALUE)
|
||||
return;
|
||||
if (first_limiting == UINT_MAX)
|
||||
first_limiting = i;
|
||||
}
|
||||
|
||||
// placeholder value, correct one will be found below
|
||||
av_assert0(first_limiting < UINT_MAX);
|
||||
sq->head_stream = first_limiting;
|
||||
sq->head_stream = 0;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < sq->nb_streams; i++) {
|
||||
@@ -309,7 +203,7 @@ static int overflow_heartbeat(SyncQueue *sq, int stream_idx)
|
||||
/* get the chosen stream's tail timestamp */
|
||||
for (size_t i = 0; tail_ts == AV_NOPTS_VALUE &&
|
||||
av_fifo_peek(st->fifo, &frame, 1, i) >= 0; i++)
|
||||
tail_ts = frame_end(sq, frame, 0);
|
||||
tail_ts = frame_ts(sq, frame);
|
||||
|
||||
/* overflow triggers when the tail is over specified duration behind the head */
|
||||
if (tail_ts == AV_NOPTS_VALUE || tail_ts >= st->head_ts ||
|
||||
@@ -331,9 +225,6 @@ static int overflow_heartbeat(SyncQueue *sq, int stream_idx)
|
||||
if (st1->head_ts != AV_NOPTS_VALUE)
|
||||
ts = FFMAX(st1->head_ts + 1, ts);
|
||||
|
||||
av_log(sq->logctx, AV_LOG_DEBUG, "sq: %u overflow heardbeat %s -> %s\n",
|
||||
i, av_ts2timestr(st1->head_ts, &st1->tb), av_ts2timestr(ts, &st1->tb));
|
||||
|
||||
stream_update_ts(sq, i, ts);
|
||||
}
|
||||
|
||||
@@ -345,39 +236,27 @@ int sq_send(SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame)
|
||||
SyncQueueStream *st;
|
||||
SyncQueueFrame dst;
|
||||
int64_t ts;
|
||||
int ret, nb_samples;
|
||||
int ret;
|
||||
|
||||
av_assert0(stream_idx < sq->nb_streams);
|
||||
st = &sq->streams[stream_idx];
|
||||
|
||||
av_assert0(st->tb.num > 0 && st->tb.den > 0);
|
||||
|
||||
if (frame_null(sq, frame)) {
|
||||
av_log(sq->logctx, AV_LOG_DEBUG, "sq: %u EOF\n", stream_idx);
|
||||
finish_stream(sq, stream_idx);
|
||||
return 0;
|
||||
}
|
||||
if (st->finished)
|
||||
return AVERROR_EOF;
|
||||
|
||||
tb_update(sq, st, frame);
|
||||
|
||||
ret = objpool_get(sq->pool, (void**)&dst);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
frame_move(sq, dst, frame);
|
||||
|
||||
nb_samples = frame_samples(sq, dst);
|
||||
// make sure frame duration is consistent with sample count
|
||||
if (nb_samples) {
|
||||
av_assert0(dst.f->sample_rate > 0);
|
||||
dst.f->duration = av_rescale_q(nb_samples, (AVRational){ 1, dst.f->sample_rate },
|
||||
dst.f->time_base);
|
||||
}
|
||||
|
||||
ts = frame_end(sq, dst, 0);
|
||||
|
||||
av_log(sq->logctx, AV_LOG_DEBUG, "sq: send %u ts %s\n", stream_idx,
|
||||
av_ts2timestr(ts, &st->tb));
|
||||
ts = frame_ts(sq, dst);
|
||||
|
||||
ret = av_fifo_write(st->fifo, &dst, 1);
|
||||
if (ret < 0) {
|
||||
@@ -388,139 +267,13 @@ int sq_send(SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame)
|
||||
|
||||
stream_update_ts(sq, stream_idx, ts);
|
||||
|
||||
st->samples_queued += nb_samples;
|
||||
st->samples_sent += nb_samples;
|
||||
|
||||
if (st->frame_samples)
|
||||
st->frames_sent = st->samples_sent / st->frame_samples;
|
||||
else
|
||||
st->frames_sent++;
|
||||
|
||||
if (st->frames_sent >= st->frames_max) {
|
||||
av_log(sq->logctx, AV_LOG_DEBUG, "sq: %u frames_max %"PRIu64" reached\n",
|
||||
stream_idx, st->frames_max);
|
||||
|
||||
st->frames_sent++;
|
||||
if (st->frames_sent >= st->frames_max)
|
||||
finish_stream(sq, stream_idx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void offset_audio(AVFrame *f, int nb_samples)
|
||||
{
|
||||
const int planar = av_sample_fmt_is_planar(f->format);
|
||||
const int planes = planar ? f->ch_layout.nb_channels : 1;
|
||||
const int bps = av_get_bytes_per_sample(f->format);
|
||||
const int offset = nb_samples * bps * (planar ? 1 : f->ch_layout.nb_channels);
|
||||
|
||||
av_assert0(bps > 0);
|
||||
av_assert0(nb_samples < f->nb_samples);
|
||||
|
||||
for (int i = 0; i < planes; i++) {
|
||||
f->extended_data[i] += offset;
|
||||
if (i < FF_ARRAY_ELEMS(f->data))
|
||||
f->data[i] = f->extended_data[i];
|
||||
}
|
||||
f->linesize[0] -= offset;
|
||||
f->nb_samples -= nb_samples;
|
||||
f->duration = av_rescale_q(f->nb_samples, (AVRational){ 1, f->sample_rate },
|
||||
f->time_base);
|
||||
f->pts += av_rescale_q(nb_samples, (AVRational){ 1, f->sample_rate },
|
||||
f->time_base);
|
||||
}
|
||||
|
||||
static int frame_is_aligned(const SyncQueue *sq, const AVFrame *frame)
|
||||
{
|
||||
// only checks linesize[0], so only works for audio
|
||||
av_assert0(frame->nb_samples > 0);
|
||||
av_assert0(sq->align_mask);
|
||||
|
||||
// only check data[0], because we always offset all data pointers
|
||||
// by the same offset, so if one is aligned, all are
|
||||
if (!((uintptr_t)frame->data[0] & sq->align_mask) &&
|
||||
!(frame->linesize[0] & sq->align_mask) &&
|
||||
frame->linesize[0] > sq->align_mask)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int receive_samples(SyncQueue *sq, SyncQueueStream *st,
|
||||
AVFrame *dst, int nb_samples)
|
||||
{
|
||||
SyncQueueFrame src;
|
||||
int ret;
|
||||
|
||||
av_assert0(st->samples_queued >= nb_samples);
|
||||
|
||||
ret = av_fifo_peek(st->fifo, &src, 1, 0);
|
||||
av_assert0(ret >= 0);
|
||||
|
||||
// peeked frame has enough samples and its data is aligned
|
||||
// -> we can just make a reference and limit its sample count
|
||||
if (src.f->nb_samples > nb_samples && frame_is_aligned(sq, src.f)) {
|
||||
ret = av_frame_ref(dst, src.f);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dst->nb_samples = nb_samples;
|
||||
offset_audio(src.f, nb_samples);
|
||||
st->samples_queued -= nb_samples;
|
||||
|
||||
goto finish;
|
||||
}
|
||||
|
||||
// otherwise allocate a new frame and copy the data
|
||||
ret = av_channel_layout_copy(&dst->ch_layout, &src.f->ch_layout);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dst->format = src.f->format;
|
||||
dst->nb_samples = nb_samples;
|
||||
|
||||
ret = av_frame_get_buffer(dst, 0);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
ret = av_frame_copy_props(dst, src.f);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
dst->nb_samples = 0;
|
||||
while (dst->nb_samples < nb_samples) {
|
||||
int to_copy;
|
||||
|
||||
ret = av_fifo_peek(st->fifo, &src, 1, 0);
|
||||
av_assert0(ret >= 0);
|
||||
|
||||
to_copy = FFMIN(nb_samples - dst->nb_samples, src.f->nb_samples);
|
||||
|
||||
av_samples_copy(dst->extended_data, src.f->extended_data, dst->nb_samples,
|
||||
0, to_copy, dst->ch_layout.nb_channels, dst->format);
|
||||
|
||||
if (to_copy < src.f->nb_samples)
|
||||
offset_audio(src.f, to_copy);
|
||||
else {
|
||||
av_frame_unref(src.f);
|
||||
objpool_release(sq->pool, (void**)&src);
|
||||
av_fifo_drain2(st->fifo, 1);
|
||||
}
|
||||
st->samples_queued -= to_copy;
|
||||
|
||||
dst->nb_samples += to_copy;
|
||||
}
|
||||
|
||||
finish:
|
||||
dst->duration = av_rescale_q(nb_samples, (AVRational){ 1, dst->sample_rate },
|
||||
dst->time_base);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_frame_unref(dst);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int receive_for_stream(SyncQueue *sq, unsigned int stream_idx,
|
||||
SyncQueueFrame frame)
|
||||
{
|
||||
@@ -531,18 +284,13 @@ static int receive_for_stream(SyncQueue *sq, unsigned int stream_idx,
|
||||
av_assert0(stream_idx < sq->nb_streams);
|
||||
st = &sq->streams[stream_idx];
|
||||
|
||||
if (av_fifo_can_read(st->fifo) &&
|
||||
(st->frame_samples <= st->samples_queued || st->finished)) {
|
||||
int nb_samples = st->frame_samples;
|
||||
if (av_fifo_can_read(st->fifo)) {
|
||||
SyncQueueFrame peek;
|
||||
int64_t ts;
|
||||
int cmp = 1;
|
||||
|
||||
if (st->finished)
|
||||
nb_samples = FFMIN(nb_samples, st->samples_queued);
|
||||
|
||||
av_fifo_peek(st->fifo, &peek, 1, 0);
|
||||
ts = frame_end(sq, peek, nb_samples);
|
||||
ts = frame_ts(sq, peek);
|
||||
|
||||
/* check if this stream's tail timestamp does not overtake
|
||||
* the overall queue head */
|
||||
@@ -551,28 +299,11 @@ static int receive_for_stream(SyncQueue *sq, unsigned int stream_idx,
|
||||
|
||||
/* We can release frames that do not end after the queue head.
|
||||
* Frames with no timestamps are just passed through with no conditions.
|
||||
* Frames are also passed through when there are no limiting streams.
|
||||
*/
|
||||
if (cmp <= 0 || ts == AV_NOPTS_VALUE || !sq->have_limiting) {
|
||||
if (nb_samples &&
|
||||
(nb_samples != peek.f->nb_samples || !frame_is_aligned(sq, peek.f))) {
|
||||
int ret = receive_samples(sq, st, frame.f, nb_samples);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
frame_move(sq, frame, peek);
|
||||
objpool_release(sq->pool, (void**)&peek);
|
||||
av_fifo_drain2(st->fifo, 1);
|
||||
av_assert0(st->samples_queued >= frame_samples(sq, frame));
|
||||
st->samples_queued -= frame_samples(sq, frame);
|
||||
}
|
||||
|
||||
av_log(sq->logctx, AV_LOG_DEBUG,
|
||||
"sq: receive %u ts %s queue head %d ts %s\n", stream_idx,
|
||||
av_ts2timestr(frame_end(sq, frame, 0), &st->tb),
|
||||
sq->head_stream,
|
||||
st_head ? av_ts2timestr(st_head->head_ts, &st_head->tb) : "N/A");
|
||||
|
||||
if (cmp <= 0 || ts == AV_NOPTS_VALUE) {
|
||||
frame_move(sq, frame, peek);
|
||||
objpool_release(sq->pool, (void**)&peek);
|
||||
av_fifo_drain2(st->fifo, 1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -641,11 +372,24 @@ int sq_add_stream(SyncQueue *sq, int limiting)
|
||||
st->frames_max = UINT64_MAX;
|
||||
st->limiting = limiting;
|
||||
|
||||
sq->have_limiting |= limiting;
|
||||
|
||||
return sq->nb_streams++;
|
||||
}
|
||||
|
||||
void sq_set_tb(SyncQueue *sq, unsigned int stream_idx, AVRational tb)
|
||||
{
|
||||
SyncQueueStream *st;
|
||||
|
||||
av_assert0(stream_idx < sq->nb_streams);
|
||||
st = &sq->streams[stream_idx];
|
||||
|
||||
av_assert0(!av_fifo_can_read(st->fifo));
|
||||
|
||||
if (st->head_ts != AV_NOPTS_VALUE)
|
||||
st->head_ts = av_rescale_q(st->head_ts, st->tb, tb);
|
||||
|
||||
st->tb = tb;
|
||||
}
|
||||
|
||||
void sq_limit_frames(SyncQueue *sq, unsigned int stream_idx, uint64_t frames)
|
||||
{
|
||||
SyncQueueStream *st;
|
||||
@@ -658,21 +402,7 @@ void sq_limit_frames(SyncQueue *sq, unsigned int stream_idx, uint64_t frames)
|
||||
finish_stream(sq, stream_idx);
|
||||
}
|
||||
|
||||
void sq_frame_samples(SyncQueue *sq, unsigned int stream_idx,
|
||||
int frame_samples)
|
||||
{
|
||||
SyncQueueStream *st;
|
||||
|
||||
av_assert0(sq->type == SYNC_QUEUE_FRAMES);
|
||||
av_assert0(stream_idx < sq->nb_streams);
|
||||
st = &sq->streams[stream_idx];
|
||||
|
||||
st->frame_samples = frame_samples;
|
||||
|
||||
sq->align_mask = av_cpu_max_align() - 1;
|
||||
}
|
||||
|
||||
SyncQueue *sq_alloc(enum SyncQueueType type, int64_t buf_size_us, void *logctx)
|
||||
SyncQueue *sq_alloc(enum SyncQueueType type, int64_t buf_size_us)
|
||||
{
|
||||
SyncQueue *sq = av_mallocz(sizeof(*sq));
|
||||
|
||||
@@ -681,7 +411,6 @@ SyncQueue *sq_alloc(enum SyncQueueType type, int64_t buf_size_us, void *logctx)
|
||||
|
||||
sq->type = type;
|
||||
sq->buf_size_us = buf_size_us;
|
||||
sq->logctx = logctx;
|
||||
|
||||
sq->head_stream = -1;
|
||||
sq->head_finished_stream = -1;
|
||||
|
||||
@@ -38,11 +38,6 @@ typedef union SyncQueueFrame {
|
||||
#define SQFRAME(frame) ((SyncQueueFrame){ .f = (frame) })
|
||||
#define SQPKT(pkt) ((SyncQueueFrame){ .p = (pkt) })
|
||||
|
||||
/**
|
||||
* A sync queue provides timestamp synchronization between multiple streams.
|
||||
* Some of these streams are marked as "limiting", then the queue ensures no
|
||||
* stream gets ahead of any of the limiting streams.
|
||||
*/
|
||||
typedef struct SyncQueue SyncQueue;
|
||||
|
||||
/**
|
||||
@@ -50,7 +45,7 @@ typedef struct SyncQueue SyncQueue;
|
||||
*
|
||||
* @param buf_size_us maximum duration that will be buffered in microseconds
|
||||
*/
|
||||
SyncQueue *sq_alloc(enum SyncQueueType type, int64_t buf_size_us, void *logctx);
|
||||
SyncQueue *sq_alloc(enum SyncQueueType type, int64_t buf_size_us);
|
||||
void sq_free(SyncQueue **sq);
|
||||
|
||||
/**
|
||||
@@ -64,6 +59,12 @@ void sq_free(SyncQueue **sq);
|
||||
*/
|
||||
int sq_add_stream(SyncQueue *sq, int limiting);
|
||||
|
||||
/**
|
||||
* Set the timebase for the stream with index stream_idx. Should be called
|
||||
* before sending any frames for this stream.
|
||||
*/
|
||||
void sq_set_tb(SyncQueue *sq, unsigned int stream_idx, AVRational tb);
|
||||
|
||||
/**
|
||||
* Limit the number of output frames for stream with index stream_idx
|
||||
* to max_frames.
|
||||
@@ -71,16 +72,6 @@ int sq_add_stream(SyncQueue *sq, int limiting);
|
||||
void sq_limit_frames(SyncQueue *sq, unsigned int stream_idx,
|
||||
uint64_t max_frames);
|
||||
|
||||
/**
|
||||
* Set a constant output audio frame size, in samples. Can only be used with
|
||||
* SYNC_QUEUE_FRAMES queues and audio streams.
|
||||
*
|
||||
* All output frames will have exactly frame_samples audio samples, except
|
||||
* possibly for the last one, which may have fewer.
|
||||
*/
|
||||
void sq_frame_samples(SyncQueue *sq, unsigned int stream_idx,
|
||||
int frame_samples);
|
||||
|
||||
/**
|
||||
* Submit a frame for the stream with index stream_idx.
|
||||
*
|
||||
|
||||
@@ -164,12 +164,7 @@ static int receive_locked(ThreadQueue *tq, int *stream_idx,
|
||||
FifoElem elem;
|
||||
unsigned int nb_finished = 0;
|
||||
|
||||
while (av_fifo_read(tq->fifo, &elem, 1) >= 0) {
|
||||
if (tq->finished[elem.stream_idx] & FINISHED_RECV) {
|
||||
objpool_release(tq->obj_pool, &elem.obj);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (av_fifo_read(tq->fifo, &elem, 1) >= 0) {
|
||||
tq->obj_move(data, elem.obj);
|
||||
objpool_release(tq->obj_pool, &elem.obj);
|
||||
*stream_idx = elem.stream_idx;
|
||||
@@ -177,7 +172,7 @@ static int receive_locked(ThreadQueue *tq, int *stream_idx,
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < tq->nb_streams; i++) {
|
||||
if (!tq->finished[i])
|
||||
if (!(tq->finished[i] & FINISHED_SEND))
|
||||
continue;
|
||||
|
||||
/* return EOF to the consumer at most once for each stream */
|
||||
@@ -202,14 +197,7 @@ int tq_receive(ThreadQueue *tq, int *stream_idx, void *data)
|
||||
pthread_mutex_lock(&tq->lock);
|
||||
|
||||
while (1) {
|
||||
size_t can_read = av_fifo_can_read(tq->fifo);
|
||||
|
||||
ret = receive_locked(tq, stream_idx, data);
|
||||
|
||||
// signal other threads if the fifo state changed
|
||||
if (can_read != av_fifo_can_read(tq->fifo))
|
||||
pthread_cond_broadcast(&tq->cond);
|
||||
|
||||
if (ret == AVERROR(EAGAIN)) {
|
||||
pthread_cond_wait(&tq->cond, &tq->lock);
|
||||
continue;
|
||||
@@ -218,6 +206,9 @@ int tq_receive(ThreadQueue *tq, int *stream_idx, void *data)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
pthread_cond_broadcast(&tq->cond);
|
||||
|
||||
pthread_mutex_unlock(&tq->lock);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -65,7 +65,7 @@ static int zero12v_decode_frame(AVCodecContext *avctx, AVFrame *pic,
|
||||
return ret;
|
||||
|
||||
pic->pict_type = AV_PICTURE_TYPE_I;
|
||||
pic->flags |= AV_FRAME_FLAG_KEY;
|
||||
pic->key_frame = 1;
|
||||
|
||||
line_end = avpkt->data + stride;
|
||||
for (line = 0; line < avctx->height; line++) {
|
||||
|
||||
@@ -125,7 +125,7 @@ static const uint8_t dequant_table[64] = {
|
||||
20, 35, 34, 32, 31, 22, 15, 8,
|
||||
};
|
||||
|
||||
static VLCElem block_type_vlc[2][4][32];
|
||||
static VLC block_type_vlc[2][4];
|
||||
|
||||
|
||||
typedef struct CFrameBuffer {
|
||||
@@ -250,15 +250,17 @@ static void idct(int16_t block[64])
|
||||
|
||||
static av_cold void init_vlcs(void)
|
||||
{
|
||||
static VLCElem table[2][4][32];
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
ff_vlc_init_table_sparse(block_type_vlc[i][j], FF_ARRAY_ELEMS(block_type_vlc[i][j]),
|
||||
BLOCK_TYPE_VLC_BITS, 7,
|
||||
&block_type_tab[i][j][0][1], 2, 1,
|
||||
&block_type_tab[i][j][0][0], 2, 1,
|
||||
NULL, 0, 0, 0);
|
||||
block_type_vlc[i][j].table = table[i][j];
|
||||
block_type_vlc[i][j].table_allocated = 32;
|
||||
init_vlc(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7,
|
||||
&block_type_tab[i][j][0][1], 2, 1,
|
||||
&block_type_tab[i][j][0][0], 2, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,7 +357,7 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
|
||||
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],
|
||||
code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index].table,
|
||||
BLOCK_TYPE_VLC_BITS, 1);
|
||||
av_assert0(code >= 0 && code <= 6);
|
||||
|
||||
@@ -704,8 +706,8 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
|
||||
len_tab[j] = len;
|
||||
}
|
||||
|
||||
ff_vlc_free(&f->pre_vlc);
|
||||
if (vlc_init(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
|
||||
ff_free_vlc(&f->pre_vlc);
|
||||
if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
|
||||
bits_tab, 4, 4, 0))
|
||||
return NULL;
|
||||
|
||||
@@ -957,10 +959,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (picture->pict_type == AV_PICTURE_TYPE_I)
|
||||
picture->flags |= AV_FRAME_FLAG_KEY;
|
||||
else
|
||||
picture->flags &= ~AV_FRAME_FLAG_KEY;
|
||||
picture->key_frame = picture->pict_type == AV_PICTURE_TYPE_I;
|
||||
|
||||
av_image_copy_plane(picture->data[0], picture->linesize[0],
|
||||
(const uint8_t*)f->frame_buffer, avctx->width * 2,
|
||||
@@ -985,7 +984,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
||||
av_freep(&f->cfrm[i].data);
|
||||
f->cfrm[i].allocated_size = 0;
|
||||
}
|
||||
ff_vlc_free(&f->pre_vlc);
|
||||
ff_free_vlc(&f->pre_vlc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,23 +26,27 @@
|
||||
* http://www.pcisys.net/~melanson/codecs/
|
||||
*
|
||||
* Supports: PAL8 (RGB 8bpp, paletted)
|
||||
* : GBRP (RGB 24bpp)
|
||||
* : GBRAP (RGB 32bpp, 4th plane is alpha)
|
||||
* : BGR24 (RGB 24bpp) (can also output it as RGB32)
|
||||
* : RGB32 (RGB 32bpp, 4th plane is alpha)
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/bswap.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "avcodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "decode.h"
|
||||
|
||||
|
||||
static const enum AVPixelFormat pixfmt_rgb24[] = {
|
||||
AV_PIX_FMT_BGR24, AV_PIX_FMT_0RGB32, AV_PIX_FMT_NONE };
|
||||
|
||||
typedef struct EightBpsContext {
|
||||
AVCodecContext *avctx;
|
||||
|
||||
uint8_t planes;
|
||||
uint8_t planemap[4];
|
||||
unsigned char planes;
|
||||
unsigned char planemap[4];
|
||||
|
||||
uint32_t pal[256];
|
||||
} EightBpsContext;
|
||||
@@ -53,14 +57,15 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
EightBpsContext * const c = avctx->priv_data;
|
||||
const uint8_t *encoded = buf;
|
||||
uint8_t *pixptr, *pixptr_end;
|
||||
const unsigned char *encoded = buf;
|
||||
unsigned char *pixptr, *pixptr_end;
|
||||
unsigned int height = avctx->height; // Real image height
|
||||
unsigned int dlen, p, row;
|
||||
const uint8_t *lp, *dp, *ep;
|
||||
uint8_t count;
|
||||
const uint8_t *planemap = c->planemap;
|
||||
unsigned int planes = c->planes;
|
||||
const unsigned char *lp, *dp, *ep;
|
||||
unsigned char count;
|
||||
unsigned int px_inc;
|
||||
unsigned int planes = c->planes;
|
||||
unsigned char *planemap = c->planemap;
|
||||
int ret;
|
||||
|
||||
if (buf_size < planes * height * 2)
|
||||
@@ -74,18 +79,19 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
/* Set data pointer after line lengths */
|
||||
dp = encoded + planes * (height << 1);
|
||||
|
||||
px_inc = planes + (avctx->pix_fmt == AV_PIX_FMT_0RGB32);
|
||||
|
||||
for (p = 0; p < planes; p++) {
|
||||
const int pi = planemap[p];
|
||||
/* Lines length pointer for this plane */
|
||||
lp = encoded + p * (height << 1);
|
||||
|
||||
/* Decode a plane */
|
||||
for (row = 0; row < height; row++) {
|
||||
pixptr = frame->data[pi] + row * frame->linesize[pi];
|
||||
pixptr_end = pixptr + frame->linesize[pi];
|
||||
pixptr = frame->data[0] + row * frame->linesize[0] + planemap[p];
|
||||
pixptr_end = pixptr + frame->linesize[0];
|
||||
if (ep - lp < row * 2 + 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
dlen = AV_RB16(lp + row * 2);
|
||||
dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2));
|
||||
/* Decode a row of this plane */
|
||||
while (dlen > 0) {
|
||||
if (ep - dp <= 1)
|
||||
@@ -93,19 +99,22 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
if ((count = *dp++) <= 127) {
|
||||
count++;
|
||||
dlen -= count + 1;
|
||||
if (pixptr_end - pixptr < count)
|
||||
if (pixptr_end - pixptr < count * px_inc)
|
||||
break;
|
||||
if (ep - dp < count)
|
||||
return AVERROR_INVALIDDATA;
|
||||
memcpy(pixptr, dp, count);
|
||||
pixptr += count;
|
||||
dp += count;
|
||||
while (count--) {
|
||||
*pixptr = *dp++;
|
||||
pixptr += px_inc;
|
||||
}
|
||||
} else {
|
||||
count = 257 - count;
|
||||
if (pixptr_end - pixptr < count)
|
||||
if (pixptr_end - pixptr < count * px_inc)
|
||||
break;
|
||||
memset(pixptr, dp[0], count);
|
||||
pixptr += count;
|
||||
while (count--) {
|
||||
*pixptr = *dp;
|
||||
pixptr += px_inc;
|
||||
}
|
||||
dp++;
|
||||
dlen -= 2;
|
||||
}
|
||||
@@ -114,16 +123,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
}
|
||||
|
||||
if (avctx->bits_per_coded_sample <= 8) {
|
||||
#if FF_API_PALETTE_HAS_CHANGED
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
frame->palette_has_changed =
|
||||
#endif
|
||||
ff_copy_palette(c->pal, avpkt, avctx);
|
||||
#if FF_API_PALETTE_HAS_CHANGED
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
frame->palette_has_changed = ff_copy_palette(c->pal, avpkt, avctx);
|
||||
|
||||
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
|
||||
memcpy (frame->data[1], c->pal, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
*got_frame = 1;
|
||||
@@ -145,15 +147,16 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
c->planemap[0] = 0; // 1st plane is palette indexes
|
||||
break;
|
||||
case 24:
|
||||
avctx->pix_fmt = AV_PIX_FMT_GBRP;
|
||||
avctx->pix_fmt = ff_get_format(avctx, pixfmt_rgb24);
|
||||
c->planes = 3;
|
||||
c->planemap[0] = 2; // 1st plane is red
|
||||
c->planemap[1] = 0; // 2nd plane is green
|
||||
c->planemap[2] = 1; // 3rd plane is blue
|
||||
c->planemap[1] = 1; // 2nd plane is green
|
||||
c->planemap[2] = 0; // 3rd plane is blue
|
||||
break;
|
||||
case 32:
|
||||
avctx->pix_fmt = AV_PIX_FMT_GBRAP;
|
||||
avctx->pix_fmt = AV_PIX_FMT_RGB32;
|
||||
c->planes = 4;
|
||||
/* handle planemap setup later for decoding rgb24 data as rbg32 */
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n",
|
||||
@@ -161,11 +164,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_GBRAP) {
|
||||
c->planemap[0] = 2; // 1st plane is red
|
||||
c->planemap[1] = 0; // 2nd plane is green
|
||||
c->planemap[2] = 1; // 3rd plane is blue
|
||||
c->planemap[3] = 3; // 4th plane is alpha
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_RGB32) {
|
||||
c->planemap[0] = HAVE_BIGENDIAN ? 1 : 2; // 1st plane is red
|
||||
c->planemap[1] = HAVE_BIGENDIAN ? 2 : 1; // 2nd plane is green
|
||||
c->planemap[2] = HAVE_BIGENDIAN ? 3 : 0; // 3rd plane is blue
|
||||
c->planemap[3] = HAVE_BIGENDIAN ? 0 : 3; // 4th plane is alpha
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ OBJS = ac3_parser.o \
|
||||
allcodecs.o \
|
||||
avcodec.o \
|
||||
avdct.o \
|
||||
avfft.o \
|
||||
avpacket.o \
|
||||
bitstream.o \
|
||||
bitstream_filters.o \
|
||||
@@ -56,7 +55,6 @@ OBJS = ac3_parser.o \
|
||||
profiles.o \
|
||||
qsv_api.o \
|
||||
raw.o \
|
||||
refstruct.o \
|
||||
utils.o \
|
||||
version.o \
|
||||
vlc.o \
|
||||
@@ -78,20 +76,21 @@ OBJS-$(CONFIG_CBS) += cbs.o cbs_bsf.o
|
||||
OBJS-$(CONFIG_CBS_AV1) += cbs_av1.o
|
||||
OBJS-$(CONFIG_CBS_H264) += cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H265) += cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_H266) += cbs_h2645.o cbs_sei.o h2645_parse.o
|
||||
OBJS-$(CONFIG_CBS_JPEG) += cbs_jpeg.o
|
||||
OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o
|
||||
OBJS-$(CONFIG_CBS_VP8) += cbs_vp8.o vp8data.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_DEFLATE_WRAPPER) += zlib_wrapper.o
|
||||
OBJS-$(CONFIG_DOVI_RPU) += dovi_rpu.o
|
||||
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
|
||||
OBJS-$(CONFIG_EVCPARSE) += evc_parse.o evc_ps.o
|
||||
OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o
|
||||
OBJS-$(CONFIG_FAANDCT) += faandct.o
|
||||
OBJS-$(CONFIG_FAANIDCT) += faanidct.o
|
||||
OBJS-$(CONFIG_FDCTDSP) += fdctdsp.o jfdctfst.o jfdctint.o
|
||||
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o
|
||||
OBJS-$(CONFIG_FFT) += avfft.o fft_float.o fft_fixed_32.o \
|
||||
fft_init_table.o $(FFT-OBJS-yes)
|
||||
OBJS-$(CONFIG_FMTCONVERT) += fmtconvert.o
|
||||
OBJS-$(CONFIG_GOLOMB) += golomb.o
|
||||
OBJS-$(CONFIG_H263DSP) += h263dsp.o
|
||||
@@ -105,7 +104,7 @@ OBJS-$(CONFIG_H264_SEI) += h264_sei.o h2645_sei.o
|
||||
OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o hevc_ps.o hevc_data.o \
|
||||
h2645data.o h2645_parse.o h2645_vui.o
|
||||
OBJS-$(CONFIG_HEVC_SEI) += hevc_sei.o h2645_sei.o \
|
||||
dynamic_hdr_vivid.o
|
||||
dynamic_hdr10_plus.o dynamic_hdr_vivid.o
|
||||
OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
|
||||
OBJS-$(CONFIG_HUFFMAN) += huffman.o
|
||||
OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o
|
||||
@@ -124,6 +123,7 @@ OBJS-$(CONFIG_LLVIDENCDSP) += lossless_videoencdsp.o
|
||||
OBJS-$(CONFIG_LPC) += lpc.o
|
||||
OBJS-$(CONFIG_LSP) += lsp.o
|
||||
OBJS-$(CONFIG_LZF) += lzf.o
|
||||
OBJS-$(CONFIG_MDCT) += mdct_float.o mdct_fixed_32.o
|
||||
OBJS-$(CONFIG_ME_CMP) += me_cmp.o
|
||||
OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.o mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
|
||||
OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
|
||||
@@ -132,8 +132,7 @@ OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodec_common.o \
|
||||
OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
|
||||
mpegaudiodsp_data.o \
|
||||
mpegaudiodsp_fixed.o \
|
||||
mpegaudiodsp_float.o \
|
||||
dct32_fixed.o dct32_float.o
|
||||
mpegaudiodsp_float.o
|
||||
OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o
|
||||
OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o rl.o \
|
||||
@@ -155,6 +154,7 @@ OBJS-$(CONFIG_QSV) += qsv.o
|
||||
OBJS-$(CONFIG_QSVDEC) += qsvdec.o
|
||||
OBJS-$(CONFIG_QSVENC) += qsvenc.o
|
||||
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
|
||||
OBJS-$(CONFIG_RDFT) += rdft.o
|
||||
OBJS-$(CONFIG_RV34DSP) += rv34dsp.o
|
||||
OBJS-$(CONFIG_SINEWIN) += sinewin.o
|
||||
OBJS-$(CONFIG_SNAPPY) += snappy.o
|
||||
@@ -177,12 +177,10 @@ OBJS-$(CONFIG_WMV2DSP) += wmv2dsp.o
|
||||
OBJS-$(CONFIG_ZERO12V_DECODER) += 012v.o
|
||||
OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
|
||||
OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o
|
||||
OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aacdec_common.o aactab.o \
|
||||
aacsbr.o aacps_common.o aacps_float.o \
|
||||
OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps_common.o aacps_float.o \
|
||||
kbdwin.o \
|
||||
sbrdsp.o aacpsdsp_float.o cbrt_data.o
|
||||
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aacdec_common.o aactab.o \
|
||||
aacsbr_fixed.o aacps_common.o aacps_fixed.o \
|
||||
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_common.o aacps_fixed.o \
|
||||
kbdwin.o \
|
||||
sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
|
||||
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
|
||||
@@ -255,10 +253,8 @@ OBJS-$(CONFIG_AURA2_DECODER) += aura.o
|
||||
OBJS-$(CONFIG_AV1_DECODER) += av1dec.o
|
||||
OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_AV1_MEDIACODEC_ENCODER) += mediacodecenc.o
|
||||
OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o
|
||||
OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o
|
||||
OBJS-$(CONFIG_AV1_VAAPI_ENCODER) += vaapi_encode_av1.o av1_levels.o
|
||||
OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o
|
||||
OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o
|
||||
OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o
|
||||
@@ -473,14 +469,13 @@ OBJS-$(CONFIG_JACOSUB_DECODER) += jacosubdec.o ass.o
|
||||
OBJS-$(CONFIG_JPEG2000_ENCODER) += j2kenc.o mqcenc.o mqc.o jpeg2000.o \
|
||||
jpeg2000dwt.o
|
||||
OBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dec.o jpeg2000.o jpeg2000dsp.o \
|
||||
jpeg2000dwt.o mqcdec.o mqc.o jpeg2000htdec.o
|
||||
jpeg2000dwt.o mqcdec.o mqc.o
|
||||
OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o
|
||||
OBJS-$(CONFIG_JPEGLS_ENCODER) += jpeglsenc.o jpegls.o
|
||||
OBJS-$(CONFIG_JV_DECODER) += jvdec.o
|
||||
OBJS-$(CONFIG_KGV1_DECODER) += kgv1dec.o
|
||||
OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o
|
||||
OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o
|
||||
OBJS-$(CONFIG_LEAD_DECODER) += leaddec.o jpegquanttables.o
|
||||
OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc_common.o
|
||||
OBJS-$(CONFIG_LOCO_DECODER) += loco.o
|
||||
OBJS-$(CONFIG_LSCR_DECODER) += lscrdec.o png.o pngdec.o pngdsp.o
|
||||
@@ -547,7 +542,6 @@ OBJS-$(CONFIG_MPEG4_DECODER) += mpeg4videodsp.o xvididct.o
|
||||
OBJS-$(CONFIG_MPEG4_ENCODER) += mpeg4videoenc.o
|
||||
OBJS-$(CONFIG_MPEG4_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_MPEG4_MEDIACODEC_ENCODER) += mediacodecenc.o
|
||||
OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o
|
||||
OBJS-$(CONFIG_MPEG4_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
||||
OBJS-$(CONFIG_MPEG4_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
|
||||
@@ -556,7 +550,6 @@ OBJS-$(CONFIG_MSA1_DECODER) += mss3.o
|
||||
OBJS-$(CONFIG_MSCC_DECODER) += mscc.o
|
||||
OBJS-$(CONFIG_MSNSIREN_DECODER) += siren.o
|
||||
OBJS-$(CONFIG_MSP2_DECODER) += msp2dec.o
|
||||
OBJS-$(CONFIG_MSRLE_ENCODER) += msrleenc.o
|
||||
OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
|
||||
OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o
|
||||
OBJS-$(CONFIG_MSS2_DECODER) += mss2.o mss12.o mss2dsp.o wmv2data.o
|
||||
@@ -581,7 +574,6 @@ OBJS-$(CONFIG_OPUS_DECODER) += opusdec.o opusdec_celt.o opus_celt.o \
|
||||
opusdsp.o opus_parse.o opus_rc.o
|
||||
OBJS-$(CONFIG_OPUS_ENCODER) += opusenc.o opusenc_psy.o opus_celt.o \
|
||||
opus_pvq.o opus_rc.o opustab.o
|
||||
OBJS-$(CONFIG_OSQ_DECODER) += osq.o
|
||||
OBJS-$(CONFIG_PAF_AUDIO_DECODER) += pafaudio.o
|
||||
OBJS-$(CONFIG_PAF_VIDEO_DECODER) += pafvideo.o
|
||||
OBJS-$(CONFIG_PAM_DECODER) += pnmdec.o pnm.o
|
||||
@@ -590,7 +582,6 @@ OBJS-$(CONFIG_PBM_DECODER) += pnmdec.o pnm.o
|
||||
OBJS-$(CONFIG_PBM_ENCODER) += pnmenc.o
|
||||
OBJS-$(CONFIG_PCX_DECODER) += pcx.o
|
||||
OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o
|
||||
OBJS-$(CONFIG_PDV_DECODER) += pdvdec.o
|
||||
OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o
|
||||
OBJS-$(CONFIG_PFM_ENCODER) += pnmenc.o
|
||||
OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o
|
||||
@@ -649,7 +640,6 @@ OBJS-$(CONFIG_ROQ_DPCM_ENCODER) += roqaudioenc.o
|
||||
OBJS-$(CONFIG_RPZA_DECODER) += rpza.o
|
||||
OBJS-$(CONFIG_RPZA_ENCODER) += rpzaenc.o
|
||||
OBJS-$(CONFIG_RSCC_DECODER) += rscc.o
|
||||
OBJS-$(CONFIG_RTV1_DECODER) += rtv1.o
|
||||
OBJS-$(CONFIG_RV10_DECODER) += rv10.o
|
||||
OBJS-$(CONFIG_RV10_ENCODER) += rv10enc.o
|
||||
OBJS-$(CONFIG_RV20_DECODER) += rv10.o
|
||||
@@ -759,7 +749,6 @@ OBJS-$(CONFIG_VC2_ENCODER) += vc2enc.o vc2enc_dwt.o diractab.o
|
||||
OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o
|
||||
OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdaudio.o
|
||||
OBJS-$(CONFIG_VMDVIDEO_DECODER) += vmdvideo.o
|
||||
OBJS-$(CONFIG_VMIX_DECODER) += vmixdec.o
|
||||
OBJS-$(CONFIG_VMNC_DECODER) += vmnc.o
|
||||
OBJS-$(CONFIG_VNULL_DECODER) += null.o
|
||||
OBJS-$(CONFIG_VNULL_ENCODER) += null.o
|
||||
@@ -771,11 +760,10 @@ OBJS-$(CONFIG_VP3_DECODER) += vp3.o jpegquanttables.o
|
||||
OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
|
||||
vp6dsp.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp8data.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp8data.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP7_DECODER) += vp8.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vpx_rac.o
|
||||
OBJS-$(CONFIG_VP8_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_VP8_MEDIACODEC_ENCODER) += mediacodecenc.o
|
||||
OBJS-$(CONFIG_VP8_QSV_DECODER) += qsvdec.o
|
||||
OBJS-$(CONFIG_VP8_RKMPP_DECODER) += rkmppdec.o
|
||||
OBJS-$(CONFIG_VP8_VAAPI_ENCODER) += vaapi_encode_vp8.o
|
||||
@@ -786,7 +774,6 @@ OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9data.o vp9dsp.o vp9lpf.o vp9r
|
||||
vp9dsp_8bpp.o vp9dsp_10bpp.o vp9dsp_12bpp.o
|
||||
OBJS-$(CONFIG_VP9_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_VP9_MEDIACODEC_ENCODER) += mediacodecenc.o
|
||||
OBJS-$(CONFIG_VP9_RKMPP_DECODER) += rkmppdec.o
|
||||
OBJS-$(CONFIG_VP9_VAAPI_ENCODER) += vaapi_encode_vp9.o
|
||||
OBJS-$(CONFIG_VP9_QSV_ENCODER) += qsvenc_vp9.o
|
||||
@@ -990,14 +977,12 @@ OBJS-$(CONFIG_NVDEC) += nvdec.o
|
||||
OBJS-$(CONFIG_VAAPI) += vaapi_decode.o
|
||||
OBJS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.o
|
||||
OBJS-$(CONFIG_VDPAU) += vdpau.o
|
||||
OBJS-$(CONFIG_VULKAN) += vulkan.o vulkan_video.o
|
||||
|
||||
OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL) += dxva2_av1.o
|
||||
OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o
|
||||
OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o
|
||||
OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
|
||||
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
|
||||
OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_av1.o
|
||||
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
|
||||
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
|
||||
OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
|
||||
@@ -1007,14 +992,12 @@ OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec.o
|
||||
OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
|
||||
OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o
|
||||
OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
|
||||
OBJS-$(CONFIG_H264_VULKAN_HWACCEL) += vulkan_decode.o vulkan_h264.o
|
||||
OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o
|
||||
OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o
|
||||
OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec.o
|
||||
OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o
|
||||
OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o h265_profile_level.o
|
||||
OBJS-$(CONFIG_HEVC_VULKAN_HWACCEL) += vulkan_decode.o vulkan_hevc.o
|
||||
OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL) += nvdec_mjpeg.o
|
||||
OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL) += vaapi_mjpeg.o
|
||||
OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL) += nvdec_mpeg12.o
|
||||
@@ -1059,8 +1042,6 @@ STLIBOBJS-$(CONFIG_AVFORMAT) += to_upper4.o
|
||||
STLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o
|
||||
STLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o
|
||||
STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o
|
||||
STLIBOBJS-$(CONFIG_IMAGE_JPEGXL_PIPE_DEMUXER) += jpegxl_parse.o
|
||||
STLIBOBJS-$(CONFIG_JPEGXL_ANIM_DEMUXER) += jpegxl_parse.o
|
||||
STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o
|
||||
STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o
|
||||
STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o
|
||||
@@ -1098,11 +1079,10 @@ OBJS-$(CONFIG_PCM_MULAW_AT_ENCODER) += audiotoolboxenc.o
|
||||
OBJS-$(CONFIG_LIBAOM_AV1_DECODER) += libaomdec.o libaom.o
|
||||
OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o libaom.o
|
||||
OBJS-$(CONFIG_LIBARIBB24_DECODER) += libaribb24.o ass.o
|
||||
OBJS-$(CONFIG_LIBARIBCAPTION_DECODER) += libaribcaption.o ass.o
|
||||
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
|
||||
OBJS-$(CONFIG_LIBCODEC2_DECODER) += libcodec2.o
|
||||
OBJS-$(CONFIG_LIBCODEC2_ENCODER) += libcodec2.o
|
||||
OBJS-$(CONFIG_LIBDAV1D_DECODER) += libdav1d.o av1_parse.o
|
||||
OBJS-$(CONFIG_LIBDAV1D_DECODER) += libdav1d.o
|
||||
OBJS-$(CONFIG_LIBDAVS2_DECODER) += libdavs2.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
|
||||
@@ -1121,6 +1101,7 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o
|
||||
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
|
||||
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
|
||||
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
|
||||
OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
|
||||
vorbis_data.o
|
||||
@@ -1140,8 +1121,8 @@ OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o
|
||||
OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o
|
||||
OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o
|
||||
OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o
|
||||
OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o libvpx.o
|
||||
OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o libvpx.o
|
||||
OBJS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.o libwebpenc.o
|
||||
OBJS-$(CONFIG_LIBWEBP_ANIM_ENCODER) += libwebpenc_common.o libwebpenc_animencoder.o
|
||||
OBJS-$(CONFIG_LIBX262_ENCODER) += libx264.o
|
||||
@@ -1159,7 +1140,7 @@ OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \
|
||||
ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o
|
||||
OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o
|
||||
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o av1_parse.o
|
||||
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o
|
||||
OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o
|
||||
OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o
|
||||
OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
|
||||
@@ -1176,7 +1157,6 @@ OBJS-$(CONFIG_DVAUDIO_PARSER) += dvaudio_parser.o
|
||||
OBJS-$(CONFIG_DVBSUB_PARSER) += dvbsub_parser.o
|
||||
OBJS-$(CONFIG_DVD_NAV_PARSER) += dvd_nav_parser.o
|
||||
OBJS-$(CONFIG_DVDSUB_PARSER) += dvdsub_parser.o
|
||||
OBJS-$(CONFIG_EVC_PARSER) += evc_parser.o
|
||||
OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o
|
||||
OBJS-$(CONFIG_FTR_PARSER) += ftr_parser.o
|
||||
OBJS-$(CONFIG_G723_1_PARSER) += g723_1_parser.o
|
||||
@@ -1190,7 +1170,6 @@ OBJS-$(CONFIG_HEVC_PARSER) += hevc_parser.o hevc_data.o
|
||||
OBJS-$(CONFIG_HDR_PARSER) += hdr_parser.o
|
||||
OBJS-$(CONFIG_IPU_PARSER) += ipu_parser.o
|
||||
OBJS-$(CONFIG_JPEG2000_PARSER) += jpeg2000_parser.o
|
||||
OBJS-$(CONFIG_JPEGXL_PARSER) += jpegxl_parser.o jpegxl_parse.o
|
||||
OBJS-$(CONFIG_MISC4_PARSER) += misc4_parser.o
|
||||
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
|
||||
OBJS-$(CONFIG_MLP_PARSER) += mlp_parse.o mlp_parser.o mlp.o
|
||||
@@ -1205,7 +1184,8 @@ OBJS-$(CONFIG_OPUS_PARSER) += opus_parser.o opus_parse.o \
|
||||
OBJS-$(CONFIG_PNG_PARSER) += png_parser.o
|
||||
OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o
|
||||
OBJS-$(CONFIG_QOI_PARSER) += qoi_parser.o
|
||||
OBJS-$(CONFIG_RV34_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_SBC_PARSER) += sbc_parser.o
|
||||
OBJS-$(CONFIG_SIPR_PARSER) += sipr_parser.o
|
||||
OBJS-$(CONFIG_TAK_PARSER) += tak_parser.o tak.o
|
||||
@@ -1214,7 +1194,6 @@ OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \
|
||||
OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o
|
||||
OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o
|
||||
OBJS-$(CONFIG_VP9_PARSER) += vp9_parser.o
|
||||
OBJS-$(CONFIG_VVC_PARSER) += vvc_parser.o
|
||||
OBJS-$(CONFIG_WEBP_PARSER) += webp_parser.o
|
||||
OBJS-$(CONFIG_XBM_PARSER) += xbm_parser.o
|
||||
OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o
|
||||
@@ -1266,9 +1245,6 @@ 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
|
||||
OBJS-$(CONFIG_VVC_METADATA_BSF) += h266_metadata_bsf.o
|
||||
OBJS-$(CONFIG_VVC_MP4TOANNEXB_BSF) += vvc_mp4toannexb_bsf.o
|
||||
OBJS-$(CONFIG_EVC_FRAME_MERGE_BSF) += evc_frame_merge_bsf.o
|
||||
|
||||
# thread libraries
|
||||
OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
|
||||
@@ -1288,7 +1264,6 @@ SKIPHEADERS += %_tablegen.h \
|
||||
aacenc_quantization.h \
|
||||
aacenc_quantization_misc.h \
|
||||
bitstream_template.h \
|
||||
vulkan_video_codec_av1std.h \
|
||||
$(ARCH)/vpx_arith.h \
|
||||
|
||||
SKIPHEADERS-$(CONFIG_AMF) += amfenc.h
|
||||
@@ -1310,7 +1285,6 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
|
||||
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
|
||||
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h
|
||||
SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
|
||||
SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
|
||||
|
||||
@@ -1324,8 +1298,9 @@ TESTPROGS = avcodec \
|
||||
jpeg2000dwt \
|
||||
mathops \
|
||||
|
||||
TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels
|
||||
TESTPROGS-$(CONFIG_CABAC) += cabac
|
||||
TESTPROGS-$(CONFIG_DCT) += avfft
|
||||
TESTPROGS-$(CONFIG_FFT) += fft fft-fixed32
|
||||
TESTPROGS-$(CONFIG_GOLOMB) += golomb
|
||||
TESTPROGS-$(CONFIG_IDCTDSP) += dct
|
||||
TESTPROGS-$(CONFIG_IIRFILTER) += iirfilter
|
||||
@@ -1345,6 +1320,7 @@ HOSTPROGS = aacps_tablegen \
|
||||
aacps_fixed_tablegen \
|
||||
cbrt_tablegen \
|
||||
cbrt_fixed_tablegen \
|
||||
cos_tablegen \
|
||||
dv_tablegen \
|
||||
motionpixels_tablegen \
|
||||
mpegaudio_tablegen \
|
||||
@@ -1359,6 +1335,12 @@ CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
|
||||
$(SUBDIR)tests/dct$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
|
||||
$(SUBDIR)dv_tablegen$(HOSTEXESUF): $(SUBDIR)dvdata_host.o
|
||||
|
||||
TRIG_TABLES = cos cos_fixed sin
|
||||
TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
|
||||
|
||||
$(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)cos_tablegen$(HOSTEXESUF)
|
||||
$(M)./$< $* > $@
|
||||
|
||||
ifdef CONFIG_SMALL
|
||||
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
|
||||
else
|
||||
|
||||
@@ -564,8 +564,8 @@ const FFCodec ff_aac_decoder = {
|
||||
},
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
|
||||
.p.ch_layouts = ff_aac_ch_layout,
|
||||
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
|
||||
.p.ch_layouts = aac_ch_layout,
|
||||
.flush = flush,
|
||||
.p.priv_class = &aac_decoder_class,
|
||||
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
@@ -590,8 +590,8 @@ const FFCodec ff_aac_latm_decoder = {
|
||||
},
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
|
||||
.p.ch_layouts = ff_aac_ch_layout,
|
||||
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
|
||||
.p.ch_layouts = aac_ch_layout,
|
||||
.flush = flush,
|
||||
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
};
|
||||
|
||||
@@ -1,324 +0,0 @@
|
||||
/*
|
||||
* Common code and tables of the AAC fixed- and floating-point decoders
|
||||
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Common code and tables of the AAC fixed- and floating-point decoders
|
||||
*/
|
||||
|
||||
#include "aac.h"
|
||||
#include "aacdectab.h"
|
||||
#include "aacps.h"
|
||||
#include "aactab.h"
|
||||
#include "vlc.h"
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/thread.h"
|
||||
|
||||
const int8_t ff_tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
|
||||
|
||||
const uint8_t ff_aac_channel_layout_map[16][16][3] = {
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
|
||||
{ { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{ { 0, } },
|
||||
{ { 0, } },
|
||||
{ { 0, } },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{
|
||||
{ TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC,
|
||||
{ TYPE_CPE, 0, AAC_CHANNEL_FRONT }, // CPE1 = FLc and FRc,
|
||||
{ TYPE_CPE, 1, AAC_CHANNEL_FRONT }, // CPE2 = FL and FR,
|
||||
{ TYPE_CPE, 2, AAC_CHANNEL_BACK }, // CPE3 = SiL and SiR,
|
||||
{ TYPE_CPE, 3, AAC_CHANNEL_BACK }, // CPE4 = BL and BR,
|
||||
{ TYPE_SCE, 1, AAC_CHANNEL_BACK }, // SCE2 = BC,
|
||||
{ TYPE_LFE, 0, AAC_CHANNEL_LFE }, // LFE1 = LFE1,
|
||||
{ TYPE_LFE, 1, AAC_CHANNEL_LFE }, // LFE2 = LFE2,
|
||||
{ TYPE_SCE, 2, AAC_CHANNEL_FRONT }, // SCE3 = TpFC,
|
||||
{ TYPE_CPE, 4, AAC_CHANNEL_FRONT }, // CPE5 = TpFL and TpFR,
|
||||
{ TYPE_CPE, 5, AAC_CHANNEL_SIDE }, // CPE6 = TpSiL and TpSiR,
|
||||
{ TYPE_SCE, 3, AAC_CHANNEL_SIDE }, // SCE4 = TpC,
|
||||
{ TYPE_CPE, 6, AAC_CHANNEL_BACK }, // CPE7 = TpBL and TpBR,
|
||||
{ TYPE_SCE, 4, AAC_CHANNEL_BACK }, // SCE5 = TpBC,
|
||||
{ TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
|
||||
{ TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
|
||||
},
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
|
||||
{ { 0, } },
|
||||
};
|
||||
|
||||
const int16_t ff_aac_channel_map[3][4][6] = {
|
||||
{
|
||||
{ AV_CHAN_FRONT_CENTER, AV_CHAN_FRONT_LEFT_OF_CENTER, AV_CHAN_FRONT_RIGHT_OF_CENTER, AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_NONE },
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, AV_CHAN_BACK_CENTER },
|
||||
{ AV_CHAN_LOW_FREQUENCY, AV_CHAN_LOW_FREQUENCY_2, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
},
|
||||
{
|
||||
{ AV_CHAN_TOP_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, AV_CHAN_NONE },
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_CENTER},
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT, AV_CHAN_TOP_BACK_CENTER},
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE},
|
||||
},
|
||||
{
|
||||
{ AV_CHAN_BOTTOM_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_BOTTOM_FRONT_LEFT, AV_CHAN_BOTTOM_FRONT_RIGHT, AV_CHAN_NONE },
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
},
|
||||
};
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
const uint64_t ff_aac_channel_layout[] = {
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_5POINT0_BACK,
|
||||
AV_CH_LAYOUT_5POINT1_BACK,
|
||||
AV_CH_LAYOUT_7POINT1_WIDE_BACK,
|
||||
AV_CH_LAYOUT_6POINT1_BACK,
|
||||
AV_CH_LAYOUT_7POINT1,
|
||||
AV_CH_LAYOUT_22POINT2,
|
||||
AV_CH_LAYOUT_7POINT1_TOP_BACK,
|
||||
0,
|
||||
};
|
||||
#endif
|
||||
|
||||
const AVChannelLayout ff_aac_ch_layout[] = {
|
||||
AV_CHANNEL_LAYOUT_MONO,
|
||||
AV_CHANNEL_LAYOUT_STEREO,
|
||||
AV_CHANNEL_LAYOUT_SURROUND,
|
||||
AV_CHANNEL_LAYOUT_4POINT0,
|
||||
AV_CHANNEL_LAYOUT_5POINT0_BACK,
|
||||
AV_CHANNEL_LAYOUT_5POINT1_BACK,
|
||||
AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
|
||||
AV_CHANNEL_LAYOUT_6POINT1_BACK,
|
||||
AV_CHANNEL_LAYOUT_7POINT1,
|
||||
AV_CHANNEL_LAYOUT_22POINT2,
|
||||
AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK,
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
VLCElem ff_vlc_scalefactors[352];
|
||||
const VLCElem *ff_vlc_spectral[11];
|
||||
|
||||
/// Huffman tables for SBR
|
||||
|
||||
static const uint8_t sbr_huffman_tab[][2] = {
|
||||
/* t_huffman_env_1_5dB - 121 entries */
|
||||
{ 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 62, 4 },
|
||||
{ 57, 4 }, { 63, 5 }, { 56, 5 }, { 64, 6 }, { 55, 6 },
|
||||
{ 65, 7 }, { 54, 7 }, { 66, 8 }, { 53, 8 }, { 67, 9 },
|
||||
{ 52, 9 }, { 51, 10 }, { 68, 10 }, { 50, 11 }, { 69, 12 },
|
||||
{ 49, 12 }, { 70, 13 }, { 48, 13 }, { 47, 13 }, { 71, 14 },
|
||||
{ 46, 14 }, { 72, 14 }, { 45, 14 }, { 44, 15 }, { 73, 15 },
|
||||
{ 41, 16 }, { 42, 16 }, { 43, 16 }, { 74, 16 }, { 36, 16 },
|
||||
{ 40, 16 }, { 76, 16 }, { 34, 17 }, { 39, 17 }, { 75, 17 },
|
||||
{ 37, 17 }, { 35, 18 }, { 38, 18 }, { 0, 18 }, { 1, 18 },
|
||||
{ 2, 18 }, { 3, 18 }, { 4, 18 }, { 5, 18 }, { 6, 19 },
|
||||
{ 7, 19 }, { 8, 19 }, { 9, 19 }, { 10, 19 }, { 11, 19 },
|
||||
{ 12, 19 }, { 13, 19 }, { 14, 19 }, { 15, 19 }, { 16, 19 },
|
||||
{ 17, 19 }, { 18, 19 }, { 19, 19 }, { 20, 19 }, { 21, 19 },
|
||||
{ 22, 19 }, { 23, 19 }, { 24, 19 }, { 25, 19 }, { 26, 19 },
|
||||
{ 27, 19 }, { 28, 19 }, { 29, 19 }, { 30, 19 }, { 31, 19 },
|
||||
{ 32, 19 }, { 33, 19 }, { 77, 19 }, { 78, 19 }, { 79, 19 },
|
||||
{ 80, 19 }, { 81, 19 }, { 82, 19 }, { 83, 19 }, { 84, 19 },
|
||||
{ 85, 19 }, { 86, 19 }, { 87, 19 }, { 88, 19 }, { 89, 19 },
|
||||
{ 90, 19 }, { 91, 19 }, { 92, 19 }, { 93, 19 }, { 94, 19 },
|
||||
{ 95, 19 }, { 96, 19 }, { 97, 19 }, { 98, 19 }, { 99, 19 },
|
||||
{ 100, 19 }, { 101, 19 }, { 102, 19 }, { 103, 19 }, { 104, 19 },
|
||||
{ 105, 19 }, { 106, 19 }, { 107, 19 }, { 108, 19 }, { 109, 19 },
|
||||
{ 110, 19 }, { 111, 19 }, { 112, 19 }, { 113, 19 }, { 114, 19 },
|
||||
{ 115, 19 }, { 116, 19 }, { 117, 19 }, { 118, 19 }, { 119, 19 },
|
||||
{ 120, 19 },
|
||||
/* f_huffman_env_1_5dB - 121 entries */
|
||||
{ 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 57, 4 },
|
||||
{ 62, 4 }, { 56, 5 }, { 63, 5 }, { 55, 6 }, { 64, 6 },
|
||||
{ 54, 7 }, { 65, 8 }, { 53, 8 }, { 66, 8 }, { 52, 9 },
|
||||
{ 67, 9 }, { 51, 9 }, { 68, 10 }, { 50, 10 }, { 69, 11 },
|
||||
{ 49, 11 }, { 70, 11 }, { 71, 11 }, { 48, 12 }, { 72, 12 },
|
||||
{ 47, 12 }, { 73, 12 }, { 74, 13 }, { 46, 13 }, { 45, 13 },
|
||||
{ 75, 13 }, { 76, 14 }, { 77, 14 }, { 44, 14 }, { 43, 15 },
|
||||
{ 42, 15 }, { 41, 16 }, { 78, 16 }, { 79, 16 }, { 40, 16 },
|
||||
{ 39, 16 }, { 80, 17 }, { 81, 17 }, { 36, 17 }, { 37, 17 },
|
||||
{ 38, 17 }, { 34, 17 }, { 32, 18 }, { 82, 18 }, { 83, 18 },
|
||||
{ 85, 18 }, { 19, 18 }, { 35, 18 }, { 86, 18 }, { 87, 18 },
|
||||
{ 30, 18 }, { 33, 18 }, { 84, 18 }, { 88, 18 }, { 104, 18 },
|
||||
{ 9, 19 }, { 14, 19 }, { 16, 19 }, { 17, 19 }, { 23, 19 },
|
||||
{ 27, 19 }, { 29, 19 }, { 31, 19 }, { 90, 19 }, { 97, 19 },
|
||||
{ 102, 19 }, { 107, 19 }, { 108, 19 }, { 0, 19 }, { 1, 19 },
|
||||
{ 2, 20 }, { 3, 20 }, { 4, 20 }, { 5, 20 }, { 6, 20 },
|
||||
{ 7, 20 }, { 8, 20 }, { 10, 20 }, { 11, 20 }, { 12, 20 },
|
||||
{ 13, 20 }, { 15, 20 }, { 18, 20 }, { 20, 20 }, { 21, 20 },
|
||||
{ 22, 20 }, { 24, 20 }, { 25, 20 }, { 26, 20 }, { 28, 20 },
|
||||
{ 89, 20 }, { 91, 20 }, { 92, 20 }, { 93, 20 }, { 94, 20 },
|
||||
{ 95, 20 }, { 96, 20 }, { 98, 20 }, { 99, 20 }, { 100, 20 },
|
||||
{ 101, 20 }, { 103, 20 }, { 105, 20 }, { 106, 20 }, { 109, 20 },
|
||||
{ 110, 20 }, { 111, 20 }, { 112, 20 }, { 113, 20 }, { 114, 20 },
|
||||
{ 115, 20 }, { 116, 20 }, { 117, 20 }, { 118, 20 }, { 119, 20 },
|
||||
{ 120, 20 },
|
||||
/* t_huffman_env_bal_1_5dB - 49 entries */
|
||||
{ 24, 1 }, { 25, 2 }, { 23, 3 }, { 26, 4 }, { 22, 5 },
|
||||
{ 27, 6 }, { 21, 7 }, { 28, 8 }, { 20, 9 }, { 19, 11 },
|
||||
{ 29, 11 }, { 18, 12 }, { 30, 12 }, { 31, 15 }, { 17, 16 },
|
||||
{ 32, 16 }, { 0, 16 }, { 1, 16 }, { 2, 16 }, { 3, 16 },
|
||||
{ 4, 16 }, { 5, 16 }, { 6, 16 }, { 7, 16 }, { 8, 16 },
|
||||
{ 9, 16 }, { 10, 16 }, { 11, 16 }, { 12, 16 }, { 13, 16 },
|
||||
{ 14, 16 }, { 15, 16 }, { 16, 16 }, { 33, 16 }, { 34, 16 },
|
||||
{ 35, 16 }, { 36, 16 }, { 37, 16 }, { 38, 16 }, { 39, 17 },
|
||||
{ 40, 17 }, { 41, 17 }, { 42, 17 }, { 43, 17 }, { 44, 17 },
|
||||
{ 45, 17 }, { 46, 17 }, { 47, 17 }, { 48, 17 },
|
||||
/* f_huffman_env_bal_1_5dB - 49 entries */
|
||||
{ 24, 1 }, { 23, 2 }, { 25, 3 }, { 22, 4 }, { 26, 5 },
|
||||
{ 27, 6 }, { 21, 7 }, { 20, 8 }, { 28, 9 }, { 19, 11 },
|
||||
{ 29, 11 }, { 18, 11 }, { 30, 12 }, { 17, 14 }, { 31, 15 },
|
||||
{ 32, 16 }, { 15, 16 }, { 16, 17 }, { 0, 18 }, { 1, 18 },
|
||||
{ 2, 18 }, { 3, 18 }, { 4, 18 }, { 5, 18 }, { 6, 18 },
|
||||
{ 7, 18 }, { 8, 18 }, { 9, 18 }, { 10, 18 }, { 11, 18 },
|
||||
{ 12, 18 }, { 13, 18 }, { 14, 18 }, { 33, 18 }, { 34, 18 },
|
||||
{ 35, 18 }, { 36, 18 }, { 37, 18 }, { 38, 18 }, { 39, 18 },
|
||||
{ 40, 18 }, { 41, 18 }, { 42, 18 }, { 43, 18 }, { 44, 18 },
|
||||
{ 45, 18 }, { 46, 18 }, { 47, 19 }, { 48, 19 },
|
||||
/* t_huffman_env_3_0dB - 63 entries */
|
||||
{ 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
|
||||
{ 28, 6 }, { 34, 7 }, { 27, 8 }, { 35, 9 }, { 26, 11 },
|
||||
{ 36, 11 }, { 25, 12 }, { 24, 13 }, { 37, 13 }, { 23, 14 },
|
||||
{ 38, 14 }, { 22, 14 }, { 21, 14 }, { 39, 14 }, { 40, 15 },
|
||||
{ 41, 16 }, { 18, 16 }, { 20, 16 }, { 19, 16 }, { 17, 17 },
|
||||
{ 42, 17 }, { 43, 18 }, { 0, 18 }, { 1, 18 }, { 2, 19 },
|
||||
{ 3, 19 }, { 4, 19 }, { 5, 19 }, { 6, 19 }, { 7, 19 },
|
||||
{ 8, 19 }, { 9, 19 }, { 10, 19 }, { 11, 19 }, { 12, 19 },
|
||||
{ 13, 19 }, { 14, 19 }, { 15, 19 }, { 16, 19 }, { 44, 19 },
|
||||
{ 45, 19 }, { 46, 19 }, { 47, 19 }, { 48, 19 }, { 49, 19 },
|
||||
{ 50, 19 }, { 51, 19 }, { 52, 19 }, { 53, 19 }, { 54, 19 },
|
||||
{ 55, 19 }, { 56, 19 }, { 57, 19 }, { 58, 19 }, { 59, 19 },
|
||||
{ 60, 19 }, { 61, 19 }, { 62, 19 },
|
||||
/* f_huffman_env_3_0dB - 63 entries */
|
||||
{ 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
|
||||
{ 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 9 }, { 26, 9 },
|
||||
{ 36, 10 }, { 25, 10 }, { 37, 11 }, { 24, 11 }, { 38, 12 },
|
||||
{ 23, 12 }, { 39, 13 }, { 40, 14 }, { 22, 14 }, { 21, 15 },
|
||||
{ 41, 15 }, { 42, 15 }, { 20, 16 }, { 19, 16 }, { 43, 16 },
|
||||
{ 44, 16 }, { 18, 17 }, { 16, 17 }, { 45, 17 }, { 46, 17 },
|
||||
{ 17, 18 }, { 49, 18 }, { 13, 18 }, { 7, 18 }, { 12, 18 },
|
||||
{ 47, 18 }, { 48, 18 }, { 9, 19 }, { 10, 19 }, { 15, 19 },
|
||||
{ 51, 19 }, { 52, 19 }, { 53, 19 }, { 56, 19 }, { 8, 19 },
|
||||
{ 11, 19 }, { 55, 19 }, { 0, 20 }, { 1, 20 }, { 2, 20 },
|
||||
{ 3, 20 }, { 4, 20 }, { 5, 20 }, { 6, 20 }, { 14, 20 },
|
||||
{ 50, 20 }, { 54, 20 }, { 57, 20 }, { 58, 20 }, { 59, 20 },
|
||||
{ 60, 20 }, { 61, 20 }, { 62, 20 },
|
||||
/* t_huffman_env_bal_3_0dB - 25 entries */
|
||||
{ 12, 1 }, { 13, 2 }, { 11, 3 }, { 10, 4 }, { 14, 5 },
|
||||
{ 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 12 },
|
||||
{ 0, 13 }, { 1, 13 }, { 2, 13 }, { 3, 13 }, { 4, 13 },
|
||||
{ 5, 13 }, { 6, 13 }, { 17, 13 }, { 18, 13 }, { 19, 13 },
|
||||
{ 20, 13 }, { 21, 13 }, { 22, 13 }, { 23, 14 }, { 24, 14 },
|
||||
/* f_huffman_env_bal_3_0dB - 25 entries */
|
||||
{ 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 4 }, { 14, 5 },
|
||||
{ 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 11 },
|
||||
{ 17, 12 }, { 18, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
|
||||
{ 3, 13 }, { 4, 13 }, { 5, 14 }, { 6, 14 }, { 19, 14 },
|
||||
{ 20, 14 }, { 21, 14 }, { 22, 14 }, { 23, 14 }, { 24, 14 },
|
||||
/* t_huffman_noise_3_0dB - 63 entries */
|
||||
{ 31, 1 }, { 32, 2 }, { 30, 3 }, { 29, 4 }, { 33, 5 },
|
||||
{ 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 10 }, { 26, 11 },
|
||||
{ 36, 13 }, { 42, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
|
||||
{ 3, 13 }, { 4, 13 }, { 5, 13 }, { 6, 13 }, { 7, 13 },
|
||||
{ 8, 13 }, { 9, 13 }, { 10, 13 }, { 11, 13 }, { 12, 13 },
|
||||
{ 13, 13 }, { 14, 13 }, { 15, 13 }, { 16, 13 }, { 17, 13 },
|
||||
{ 18, 13 }, { 19, 13 }, { 20, 13 }, { 21, 13 }, { 22, 13 },
|
||||
{ 23, 13 }, { 24, 13 }, { 25, 13 }, { 37, 13 }, { 38, 13 },
|
||||
{ 39, 13 }, { 40, 13 }, { 41, 13 }, { 43, 13 }, { 44, 13 },
|
||||
{ 45, 13 }, { 46, 13 }, { 47, 13 }, { 48, 13 }, { 49, 13 },
|
||||
{ 50, 13 }, { 51, 13 }, { 52, 13 }, { 53, 13 }, { 54, 13 },
|
||||
{ 55, 13 }, { 56, 13 }, { 57, 13 }, { 58, 13 }, { 59, 13 },
|
||||
{ 60, 13 }, { 61, 14 }, { 62, 14 },
|
||||
/* t_huffman_noise_bal_3_0dB - 25 entries */
|
||||
{ 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 5 }, { 14, 6 },
|
||||
{ 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 }, { 4, 8 },
|
||||
{ 5, 8 }, { 6, 8 }, { 7, 8 }, { 8, 8 }, { 9, 8 },
|
||||
{ 15, 8 }, { 16, 8 }, { 17, 8 }, { 18, 8 }, { 19, 8 },
|
||||
{ 20, 8 }, { 21, 8 }, { 22, 8 }, { 23, 8 }, { 24, 8 },
|
||||
};
|
||||
|
||||
static const uint8_t sbr_huffman_nb_codes[] = {
|
||||
121, 121, 49, 49, 63, 63, 25, 25, 63, 25
|
||||
};
|
||||
|
||||
static const int8_t sbr_vlc_offsets[10] = {
|
||||
-60, -60, -24, -24, -31, -31, -12, -12, -31, -12
|
||||
};
|
||||
|
||||
const VLCElem *ff_aac_sbr_vlc[10];
|
||||
|
||||
static av_cold void aacdec_common_init(void)
|
||||
{
|
||||
static VLCElem vlc_buf[(304 + 270 + 550 + 300 + 328 +
|
||||
294 + 306 + 268 + 510 + 366 + 462) +
|
||||
(1098 + 1092 + 768 + 1026 + 1058 +
|
||||
1052 + 544 + 544 + 592 + 512)];
|
||||
VLCInitState state = VLC_INIT_STATE(vlc_buf);
|
||||
const uint8_t (*tab)[2] = sbr_huffman_tab;
|
||||
|
||||
for (unsigned i = 0; i < 11; i++) {
|
||||
#define TAB_WRAP_SIZE(name) name[i], sizeof(name[i][0]), sizeof(name[i][0])
|
||||
ff_vlc_spectral[i] =
|
||||
ff_vlc_init_tables_sparse(&state, 8, ff_aac_spectral_sizes[i],
|
||||
TAB_WRAP_SIZE(ff_aac_spectral_bits),
|
||||
TAB_WRAP_SIZE(ff_aac_spectral_codes),
|
||||
TAB_WRAP_SIZE(ff_aac_codebook_vector_idx),
|
||||
0);
|
||||
}
|
||||
|
||||
VLC_INIT_STATIC_TABLE(ff_vlc_scalefactors, 7,
|
||||
FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
|
||||
ff_aac_scalefactor_bits,
|
||||
sizeof(ff_aac_scalefactor_bits[0]),
|
||||
sizeof(ff_aac_scalefactor_bits[0]),
|
||||
ff_aac_scalefactor_code,
|
||||
sizeof(ff_aac_scalefactor_code[0]),
|
||||
sizeof(ff_aac_scalefactor_code[0]), 0);
|
||||
|
||||
// SBR VLC table initialization
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(ff_aac_sbr_vlc); i++) {
|
||||
ff_aac_sbr_vlc[i] =
|
||||
ff_vlc_init_tables_from_lengths(&state, 9, sbr_huffman_nb_codes[i],
|
||||
&tab[0][1], 2,
|
||||
&tab[0][0], 2, 1,
|
||||
sbr_vlc_offsets[i], 0);
|
||||
tab += sbr_huffman_nb_codes[i];
|
||||
}
|
||||
|
||||
ff_ps_init_common();
|
||||
}
|
||||
|
||||
av_cold void ff_aacdec_common_init_once(void)
|
||||
{
|
||||
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||
ff_thread_once(&init_static_once, aacdec_common_init);
|
||||
}
|
||||
@@ -465,8 +465,8 @@ const FFCodec ff_aac_fixed_decoder = {
|
||||
},
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
|
||||
.p.ch_layouts = ff_aac_ch_layout,
|
||||
CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
|
||||
.p.ch_layouts = aac_ch_layout,
|
||||
.p.priv_class = &aac_decoder_class,
|
||||
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
.flush = flush,
|
||||
|
||||
@@ -94,6 +94,9 @@
|
||||
#include "decode.h"
|
||||
#include "internal.h"
|
||||
|
||||
static VLC vlc_scalefactors;
|
||||
static VLC vlc_spectral[11];
|
||||
|
||||
static int output_configure(AACContext *ac,
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
|
||||
enum OCStatus oc_type, int get_new_frame);
|
||||
@@ -280,10 +283,10 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
|
||||
|
||||
if (pos == AAC_CHANNEL_LFE) {
|
||||
while (nb_channels) {
|
||||
if (ff_aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE)
|
||||
if (aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE)
|
||||
return -1;
|
||||
e2c_vec[i] = (struct elem_to_channel) {
|
||||
.av_position = 1ULL << ff_aac_channel_map[layer][pos - 1][j],
|
||||
.av_position = 1ULL << aac_channel_map[layer][pos - 1][j],
|
||||
.syn_ele = layout_map[i][0],
|
||||
.elem_id = layout_map[i][1],
|
||||
.aac_position = pos
|
||||
@@ -299,12 +302,12 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
|
||||
}
|
||||
|
||||
while (nb_channels & 1) {
|
||||
if (ff_aac_channel_map[layer][pos - 1][0] == AV_CHAN_NONE)
|
||||
if (aac_channel_map[layer][pos - 1][0] == AV_CHAN_NONE)
|
||||
return -1;
|
||||
if (ff_aac_channel_map[layer][pos - 1][0] == AV_CHAN_UNUSED)
|
||||
if (aac_channel_map[layer][pos - 1][0] == AV_CHAN_UNUSED)
|
||||
break;
|
||||
e2c_vec[i] = (struct elem_to_channel) {
|
||||
.av_position = 1ULL << ff_aac_channel_map[layer][pos - 1][0],
|
||||
.av_position = 1ULL << aac_channel_map[layer][pos - 1][0],
|
||||
.syn_ele = layout_map[i][0],
|
||||
.elem_id = layout_map[i][1],
|
||||
.aac_position = pos
|
||||
@@ -316,21 +319,21 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
|
||||
|
||||
j = (pos != AAC_CHANNEL_SIDE) && nb_channels <= 3 ? 3 : 1;
|
||||
while (nb_channels >= 2) {
|
||||
if (ff_aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE ||
|
||||
ff_aac_channel_map[layer][pos - 1][j+1] == AV_CHAN_NONE)
|
||||
if (aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE ||
|
||||
aac_channel_map[layer][pos - 1][j+1] == AV_CHAN_NONE)
|
||||
return -1;
|
||||
i += assign_pair(e2c_vec, layout_map, i,
|
||||
1ULL << ff_aac_channel_map[layer][pos - 1][j],
|
||||
1ULL << ff_aac_channel_map[layer][pos - 1][j+1],
|
||||
1ULL << aac_channel_map[layer][pos - 1][j],
|
||||
1ULL << aac_channel_map[layer][pos - 1][j+1],
|
||||
pos, layout);
|
||||
j += 2;
|
||||
nb_channels -= 2;
|
||||
}
|
||||
while (nb_channels & 1) {
|
||||
if (ff_aac_channel_map[layer][pos - 1][5] == AV_CHAN_NONE)
|
||||
if (aac_channel_map[layer][pos - 1][5] == AV_CHAN_NONE)
|
||||
return -1;
|
||||
e2c_vec[i] = (struct elem_to_channel) {
|
||||
.av_position = 1ULL << ff_aac_channel_map[layer][pos - 1][5],
|
||||
.av_position = 1ULL << aac_channel_map[layer][pos - 1][5],
|
||||
.syn_ele = layout_map[i][0],
|
||||
.elem_id = layout_map[i][1],
|
||||
.aac_position = pos
|
||||
@@ -549,8 +552,8 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
|
||||
channel_config);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
*tags = ff_tags_per_config[channel_config];
|
||||
memcpy(layout_map, ff_aac_channel_layout_map[channel_config - 1],
|
||||
*tags = tags_per_config[channel_config];
|
||||
memcpy(layout_map, aac_channel_layout_map[channel_config - 1],
|
||||
*tags * sizeof(*layout_map));
|
||||
|
||||
/*
|
||||
@@ -658,7 +661,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
* SCE[0] CPE[0] CPE[1] LFE[0].
|
||||
* If we seem to have encountered such a stream, transfer
|
||||
* the LFE[0] element to the SCE[1]'s mapping */
|
||||
if (ac->tags_mapped == ff_tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
|
||||
if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
|
||||
if (!ac->warned_remapping_once && (type != TYPE_LFE || elem_id != 0)) {
|
||||
av_log(ac->avctx, AV_LOG_WARNING,
|
||||
"This stream seems to incorrectly report its last channel as %s[%d], mapping to LFE[0]\n",
|
||||
@@ -680,7 +683,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
* SCE[0] CPE[0] SCE[1].
|
||||
* If we seem to have encountered such a stream, transfer
|
||||
* the SCE[1] element to the LFE[0]'s mapping */
|
||||
if (ac->tags_mapped == ff_tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
|
||||
if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
|
||||
if (!ac->warned_remapping_once && (type != TYPE_SCE || elem_id != 1)) {
|
||||
av_log(ac->avctx, AV_LOG_WARNING,
|
||||
"This stream seems to incorrectly report its last channel as %s[%d], mapping to SCE[1]\n",
|
||||
@@ -1125,13 +1128,39 @@ static void aacdec_init(AACContext *ac);
|
||||
|
||||
static av_cold void aac_static_table_init(void)
|
||||
{
|
||||
static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 +
|
||||
294 + 306 + 268 + 510 + 366 + 462];
|
||||
for (unsigned i = 0, offset = 0; i < 11; i++) {
|
||||
vlc_spectral[i].table = &vlc_buf[offset];
|
||||
vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
|
||||
ff_init_vlc_sparse(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i],
|
||||
ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]),
|
||||
sizeof(ff_aac_spectral_bits[i][0]),
|
||||
ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]),
|
||||
sizeof(ff_aac_spectral_codes[i][0]),
|
||||
ff_aac_codebook_vector_idx[i], sizeof(ff_aac_codebook_vector_idx[i][0]),
|
||||
sizeof(ff_aac_codebook_vector_idx[i][0]),
|
||||
INIT_VLC_STATIC_OVERLONG);
|
||||
offset += vlc_spectral[i].table_size;
|
||||
}
|
||||
|
||||
AAC_RENAME(ff_aac_sbr_init)();
|
||||
|
||||
ff_aacdec_common_init_once();
|
||||
ff_aac_tableinit();
|
||||
|
||||
INIT_VLC_STATIC(&vlc_scalefactors, 7,
|
||||
FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
|
||||
ff_aac_scalefactor_bits,
|
||||
sizeof(ff_aac_scalefactor_bits[0]),
|
||||
sizeof(ff_aac_scalefactor_bits[0]),
|
||||
ff_aac_scalefactor_code,
|
||||
sizeof(ff_aac_scalefactor_code[0]),
|
||||
sizeof(ff_aac_scalefactor_code[0]),
|
||||
352);
|
||||
|
||||
// window initialization
|
||||
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
|
||||
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
|
||||
|
||||
#if !USE_FIXED
|
||||
AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960);
|
||||
@@ -1139,8 +1168,8 @@ static av_cold void aac_static_table_init(void)
|
||||
AAC_RENAME(ff_init_ff_sine_windows)(9);
|
||||
ff_aac_float_common_init();
|
||||
#else
|
||||
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
|
||||
AAC_RENAME(avpriv_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
|
||||
AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
|
||||
init_sine_windows_fixed();
|
||||
#endif
|
||||
|
||||
@@ -1497,7 +1526,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
|
||||
} else if ((band_type[idx] == INTENSITY_BT) ||
|
||||
(band_type[idx] == INTENSITY_BT2)) {
|
||||
for (; i < run_end; i++, idx++) {
|
||||
offset[2] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
|
||||
offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
|
||||
clipped_offset = av_clip(offset[2], -155, 100);
|
||||
if (offset[2] != clipped_offset) {
|
||||
avpriv_request_sample(ac->avctx,
|
||||
@@ -1516,7 +1545,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
|
||||
if (noise_flag-- > 0)
|
||||
offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE;
|
||||
else
|
||||
offset[1] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
|
||||
offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
|
||||
clipped_offset = av_clip(offset[1], -100, 155);
|
||||
if (offset[1] != clipped_offset) {
|
||||
avpriv_request_sample(ac->avctx,
|
||||
@@ -1532,7 +1561,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
|
||||
}
|
||||
} else {
|
||||
for (; i < run_end; i++, idx++) {
|
||||
offset[0] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
|
||||
offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
|
||||
if (offset[0] > 255U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Scalefactor (%d) out of range.\n", offset[0]);
|
||||
@@ -1705,7 +1734,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
|
||||
#if !USE_FIXED
|
||||
const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
|
||||
#endif /* !USE_FIXED */
|
||||
const VLCElem *vlc_tab = ff_vlc_spectral[cbt_m1];
|
||||
const VLCElem *vlc_tab = vlc_spectral[cbt_m1].table;
|
||||
OPEN_READER(re, gb);
|
||||
|
||||
switch (cbt_m1 >> 1) {
|
||||
@@ -2279,7 +2308,7 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
||||
INTFLOAT gain_cache = FIXR10(1.);
|
||||
if (c) {
|
||||
cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
|
||||
gain = cge ? get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - 60: 0;
|
||||
gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
|
||||
gain_cache = GET_GAIN(scale, gain);
|
||||
#if USE_FIXED
|
||||
if ((abs(gain_cache)-1024) >> 3 > 30)
|
||||
@@ -2293,7 +2322,7 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
|
||||
for (sfb = 0; sfb < sce->ics.max_sfb; sfb++, idx++) {
|
||||
if (sce->band_type[idx] != ZERO_BT) {
|
||||
if (!cge) {
|
||||
int t = get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - 60;
|
||||
int t = get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
||||
if (t) {
|
||||
int s = 1;
|
||||
t = gain += t;
|
||||
@@ -2457,12 +2486,12 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
|
||||
ac->avctx->ch_layout.nb_channels == 1) {
|
||||
ac->oc[1].m4ac.sbr = 1;
|
||||
ac->oc[1].m4ac.ps = 1;
|
||||
ac->avctx->profile = AV_PROFILE_AAC_HE_V2;
|
||||
ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
|
||||
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
|
||||
ac->oc[1].status, 1);
|
||||
} else {
|
||||
ac->oc[1].m4ac.sbr = 1;
|
||||
ac->avctx->profile = AV_PROFILE_AAC_HE;
|
||||
ac->avctx->profile = FF_PROFILE_AAC_HE;
|
||||
}
|
||||
res = AAC_RENAME(ff_decode_sbr_extension)(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
|
||||
if (ac->oc[1].m4ac.ps == 1 && !ac->warned_he_aac_mono) {
|
||||
@@ -3051,7 +3080,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||
if ((err = frame_configure_elements(avctx)) < 0)
|
||||
return err;
|
||||
|
||||
// The AV_PROFILE_AAC_* defines are all object_type - 1
|
||||
// The FF_PROFILE_AAC_* defines are all object_type - 1
|
||||
// This may lead to an undefined profile being signaled
|
||||
ac->avctx->profile = aot - 1;
|
||||
|
||||
@@ -3062,9 +3091,9 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||
chan_config);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (i = 0; i < ff_tags_per_config[chan_config]; i++) {
|
||||
const int elem_type = ff_aac_channel_layout_map[chan_config-1][i][0];
|
||||
const int elem_id = ff_aac_channel_layout_map[chan_config-1][i][1];
|
||||
for (i = 0; i < tags_per_config[chan_config]; i++) {
|
||||
const int elem_type = aac_channel_layout_map[chan_config-1][i][0];
|
||||
const int elem_id = aac_channel_layout_map[chan_config-1][i][1];
|
||||
if (!(che=get_che(ac, elem_type, elem_id))) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"channel element %d.%d is not allocated\n",
|
||||
@@ -3134,7 +3163,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
|
||||
if ((err = frame_configure_elements(avctx)) < 0)
|
||||
goto fail;
|
||||
|
||||
// The AV_PROFILE_AAC_* defines are all object_type - 1
|
||||
// The FF_PROFILE_AAC_* defines are all object_type - 1
|
||||
// This may lead to an undefined profile being signaled
|
||||
ac->avctx->profile = ac->oc[1].m4ac.object_type - 1;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* AAC decoder data
|
||||
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
||||
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
@@ -28,32 +30,99 @@
|
||||
#ifndef AVCODEC_AACDECTAB_H
|
||||
#define AVCODEC_AACDECTAB_H
|
||||
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "aac.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "vlc.h"
|
||||
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
|
||||
|
||||
#include "libavutil/attributes_internal.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
static const uint8_t aac_channel_layout_map[16][16][3] = {
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
|
||||
{ { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{ { 0, } },
|
||||
{ { 0, } },
|
||||
{ { 0, } },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
|
||||
{
|
||||
{ TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC,
|
||||
{ TYPE_CPE, 0, AAC_CHANNEL_FRONT }, // CPE1 = FLc and FRc,
|
||||
{ TYPE_CPE, 1, AAC_CHANNEL_FRONT }, // CPE2 = FL and FR,
|
||||
{ TYPE_CPE, 2, AAC_CHANNEL_BACK }, // CPE3 = SiL and SiR,
|
||||
{ TYPE_CPE, 3, AAC_CHANNEL_BACK }, // CPE4 = BL and BR,
|
||||
{ TYPE_SCE, 1, AAC_CHANNEL_BACK }, // SCE2 = BC,
|
||||
{ TYPE_LFE, 0, AAC_CHANNEL_LFE }, // LFE1 = LFE1,
|
||||
{ TYPE_LFE, 1, AAC_CHANNEL_LFE }, // LFE2 = LFE2,
|
||||
{ TYPE_SCE, 2, AAC_CHANNEL_FRONT }, // SCE3 = TpFC,
|
||||
{ TYPE_CPE, 4, AAC_CHANNEL_FRONT }, // CPE5 = TpFL and TpFR,
|
||||
{ TYPE_CPE, 5, AAC_CHANNEL_SIDE }, // CPE6 = TpSiL and TpSiR,
|
||||
{ TYPE_SCE, 3, AAC_CHANNEL_SIDE }, // SCE4 = TpC,
|
||||
{ TYPE_CPE, 6, AAC_CHANNEL_BACK }, // CPE7 = TpBL and TpBR,
|
||||
{ TYPE_SCE, 4, AAC_CHANNEL_BACK }, // SCE5 = TpBC,
|
||||
{ TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
|
||||
{ TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
|
||||
},
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
|
||||
{ { 0, } },
|
||||
};
|
||||
|
||||
FF_VISIBILITY_PUSH_HIDDEN
|
||||
void ff_aacdec_common_init_once(void);
|
||||
|
||||
extern const VLCElem *ff_aac_sbr_vlc[10];
|
||||
|
||||
extern VLCElem ff_vlc_scalefactors[];
|
||||
extern const VLCElem *ff_vlc_spectral[11];
|
||||
|
||||
extern const int8_t ff_tags_per_config[16];
|
||||
|
||||
extern const uint8_t ff_aac_channel_layout_map[16][16][3];
|
||||
|
||||
extern const int16_t ff_aac_channel_map[3][4][6];
|
||||
static const int16_t aac_channel_map[3][4][6] = {
|
||||
{
|
||||
{ AV_CHAN_FRONT_CENTER, AV_CHAN_FRONT_LEFT_OF_CENTER, AV_CHAN_FRONT_RIGHT_OF_CENTER, AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_NONE },
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, AV_CHAN_BACK_CENTER },
|
||||
{ AV_CHAN_LOW_FREQUENCY, AV_CHAN_LOW_FREQUENCY_2, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
},
|
||||
{
|
||||
{ AV_CHAN_TOP_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, AV_CHAN_NONE },
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_CENTER},
|
||||
{ AV_CHAN_UNUSED, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT, AV_CHAN_TOP_BACK_CENTER},
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE},
|
||||
},
|
||||
{
|
||||
{ AV_CHAN_BOTTOM_FRONT_CENTER, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_BOTTOM_FRONT_LEFT, AV_CHAN_BOTTOM_FRONT_RIGHT, AV_CHAN_NONE },
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
{ AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE, AV_CHAN_NONE },
|
||||
},
|
||||
};
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
extern const uint64_t ff_aac_channel_layout[];
|
||||
static const uint64_t aac_channel_layout[] = {
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_5POINT0_BACK,
|
||||
AV_CH_LAYOUT_5POINT1_BACK,
|
||||
AV_CH_LAYOUT_7POINT1_WIDE_BACK,
|
||||
AV_CH_LAYOUT_6POINT1_BACK,
|
||||
AV_CH_LAYOUT_7POINT1,
|
||||
AV_CH_LAYOUT_22POINT2,
|
||||
AV_CH_LAYOUT_7POINT1_TOP_BACK,
|
||||
0,
|
||||
};
|
||||
#endif
|
||||
|
||||
extern const AVChannelLayout ff_aac_ch_layout[];
|
||||
FF_VISIBILITY_POP_HIDDEN
|
||||
static const AVChannelLayout aac_ch_layout[] = {
|
||||
AV_CHANNEL_LAYOUT_MONO,
|
||||
AV_CHANNEL_LAYOUT_STEREO,
|
||||
AV_CHANNEL_LAYOUT_SURROUND,
|
||||
AV_CHANNEL_LAYOUT_4POINT0,
|
||||
AV_CHANNEL_LAYOUT_5POINT0_BACK,
|
||||
AV_CHANNEL_LAYOUT_5POINT1_BACK,
|
||||
AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
|
||||
AV_CHANNEL_LAYOUT_6POINT1_BACK,
|
||||
AV_CHANNEL_LAYOUT_7POINT1,
|
||||
AV_CHANNEL_LAYOUT_22POINT2,
|
||||
AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK,
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_AACDECTAB_H */
|
||||
|
||||
@@ -1106,18 +1106,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
too_many_bits = FFMIN(too_many_bits, 6144 * s->channels - 3);
|
||||
too_few_bits = FFMIN(FFMAX(rate_bits - rate_bits/4, target_bits), too_many_bits);
|
||||
|
||||
/* When strict bit-rate control is demanded */
|
||||
if (avctx->bit_rate_tolerance == 0) {
|
||||
if (rate_bits < frame_bits) {
|
||||
float ratio = ((float)rate_bits) / frame_bits;
|
||||
s->lambda *= FFMIN(0.9f, ratio);
|
||||
continue;
|
||||
}
|
||||
/* reset lambda when solution is found */
|
||||
s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;
|
||||
break;
|
||||
}
|
||||
|
||||
/* When using ABR, be strict (but only for increasing) */
|
||||
too_few_bits = too_few_bits - too_few_bits/8;
|
||||
too_many_bits = too_many_bits + too_many_bits/2;
|
||||
@@ -1210,6 +1198,9 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
|
||||
if (!s->fdsp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
// window init
|
||||
ff_aac_float_common_init();
|
||||
|
||||
if ((ret = av_tx_init(&s->mdct1024, &s->mdct1024_fn, AV_TX_FLOAT_MDCT, 0,
|
||||
1024, &scale, 0)) < 0)
|
||||
return ret;
|
||||
@@ -1304,13 +1295,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
avctx->bit_rate);
|
||||
|
||||
/* Profile and option setting */
|
||||
avctx->profile = avctx->profile == AV_PROFILE_UNKNOWN ? AV_PROFILE_AAC_LOW :
|
||||
avctx->profile = avctx->profile == FF_PROFILE_UNKNOWN ? FF_PROFILE_AAC_LOW :
|
||||
avctx->profile;
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(aacenc_profiles); i++)
|
||||
if (avctx->profile == aacenc_profiles[i])
|
||||
break;
|
||||
if (avctx->profile == AV_PROFILE_MPEG2_AAC_LOW) {
|
||||
avctx->profile = AV_PROFILE_AAC_LOW;
|
||||
if (avctx->profile == FF_PROFILE_MPEG2_AAC_LOW) {
|
||||
avctx->profile = FF_PROFILE_AAC_LOW;
|
||||
ERROR_IF(s->options.pred,
|
||||
"Main prediction unavailable in the \"mpeg2_aac_low\" profile\n");
|
||||
ERROR_IF(s->options.ltp,
|
||||
@@ -1318,22 +1309,22 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
WARN_IF(s->options.pns,
|
||||
"PNS unavailable in the \"mpeg2_aac_low\" profile, turning off\n");
|
||||
s->options.pns = 0;
|
||||
} else if (avctx->profile == AV_PROFILE_AAC_LTP) {
|
||||
} else if (avctx->profile == FF_PROFILE_AAC_LTP) {
|
||||
s->options.ltp = 1;
|
||||
ERROR_IF(s->options.pred,
|
||||
"Main prediction unavailable in the \"aac_ltp\" profile\n");
|
||||
} else if (avctx->profile == AV_PROFILE_AAC_MAIN) {
|
||||
} else if (avctx->profile == FF_PROFILE_AAC_MAIN) {
|
||||
s->options.pred = 1;
|
||||
ERROR_IF(s->options.ltp,
|
||||
"LTP prediction unavailable in the \"aac_main\" profile\n");
|
||||
} else if (s->options.ltp) {
|
||||
avctx->profile = AV_PROFILE_AAC_LTP;
|
||||
avctx->profile = FF_PROFILE_AAC_LTP;
|
||||
WARN_IF(1,
|
||||
"Chainging profile to \"aac_ltp\"\n");
|
||||
ERROR_IF(s->options.pred,
|
||||
"Main prediction unavailable in the \"aac_ltp\" profile\n");
|
||||
} else if (s->options.pred) {
|
||||
avctx->profile = AV_PROFILE_AAC_MAIN;
|
||||
avctx->profile = FF_PROFILE_AAC_MAIN;
|
||||
WARN_IF(1,
|
||||
"Chainging profile to \"aac_main\"\n");
|
||||
ERROR_IF(s->options.ltp,
|
||||
@@ -1356,9 +1347,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
if (s->channels > 3)
|
||||
s->options.mid_side = 0;
|
||||
|
||||
// Initialize static tables
|
||||
ff_aac_float_common_init();
|
||||
|
||||
if ((ret = dsp_init(avctx, s)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1393,6 +1381,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
#endif
|
||||
|
||||
ff_af_queue_init(avctx, &s->afq);
|
||||
ff_aac_tableinit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ void ff_aac_encode_ltp_info(AACEncContext *s, SingleChannelElement *sce,
|
||||
{
|
||||
int i;
|
||||
IndividualChannelStream *ics = &sce->ics;
|
||||
if (s->profile != AV_PROFILE_AAC_LTP || !ics->predictor_present)
|
||||
if (s->profile != FF_PROFILE_AAC_LTP || !ics->predictor_present)
|
||||
return;
|
||||
if (common_window)
|
||||
put_bits(&s->pb, 1, 0);
|
||||
@@ -119,7 +119,7 @@ void ff_aac_update_ltp(AACEncContext *s, SingleChannelElement *sce)
|
||||
float *pred_signal = &sce->ltp_state[0];
|
||||
const float *samples = &s->planar_samples[s->cur_channel][1024];
|
||||
|
||||
if (s->profile != AV_PROFILE_AAC_LTP)
|
||||
if (s->profile != FF_PROFILE_AAC_LTP)
|
||||
return;
|
||||
|
||||
/* Calculate lag */
|
||||
|
||||
@@ -335,7 +335,7 @@ void ff_aac_encode_main_pred(AACEncContext *s, SingleChannelElement *sce)
|
||||
IndividualChannelStream *ics = &sce->ics;
|
||||
const int pmax = FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]);
|
||||
|
||||
if (s->profile != AV_PROFILE_AAC_MAIN ||
|
||||
if (s->profile != FF_PROFILE_AAC_MAIN ||
|
||||
!ics->predictor_present)
|
||||
return;
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
|
||||
const int c_bits = is8 ? TNS_Q_BITS_IS8 == 4 : TNS_Q_BITS == 4;
|
||||
const int sfb_start = av_clip(tns_min_sfb[is8][s->samplerate_index], 0, mmm);
|
||||
const int sfb_end = av_clip(sce->ics.num_swb, 0, mmm);
|
||||
const int order = is8 ? 7 : s->profile == AV_PROFILE_AAC_LOW ? 12 : TNS_MAX_ORDER;
|
||||
const int order = is8 ? 7 : s->profile == FF_PROFILE_AAC_LOW ? 12 : TNS_MAX_ORDER;
|
||||
const int slant = sce->ics.window_sequence[0] == LONG_STOP_SEQUENCE ? 1 :
|
||||
sce->ics.window_sequence[0] == LONG_START_SEQUENCE ? 0 : 2;
|
||||
const int sfb_len = sfb_end - sfb_start;
|
||||
|
||||
@@ -124,10 +124,10 @@ static const unsigned char aac_maxval_cb[] = {
|
||||
};
|
||||
|
||||
static const int aacenc_profiles[] = {
|
||||
AV_PROFILE_AAC_MAIN,
|
||||
AV_PROFILE_AAC_LOW,
|
||||
AV_PROFILE_AAC_LTP,
|
||||
AV_PROFILE_MPEG2_AAC_LOW,
|
||||
FF_PROFILE_AAC_MAIN,
|
||||
FF_PROFILE_AAC_LOW,
|
||||
FF_PROFILE_AAC_LTP,
|
||||
FF_PROFILE_MPEG2_AAC_LOW,
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_AACENCTAB_H */
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "avcodec.h"
|
||||
#include "aacps.h"
|
||||
#if USE_FIXED
|
||||
#include "aacps_fixed_tablegen.h"
|
||||
@@ -716,7 +717,7 @@ static void stereo_processing(PSContext *ps, INTFLOAT (*l)[32][2], INTFLOAT (*r)
|
||||
}
|
||||
}
|
||||
|
||||
int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
|
||||
int AAC_RENAME(ff_ps_apply)(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
|
||||
{
|
||||
INTFLOAT (*Lbuf)[32][2] = ps->Lbuf;
|
||||
INTFLOAT (*Rbuf)[32][2] = ps->Rbuf;
|
||||
@@ -739,6 +740,7 @@ int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][
|
||||
|
||||
av_cold void AAC_RENAME(ff_ps_init)(void) {
|
||||
ps_tableinit();
|
||||
ff_ps_init_common();
|
||||
}
|
||||
|
||||
av_cold void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "libavutil/mem_internal.h"
|
||||
|
||||
#include "aacpsdsp.h"
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
#define PS_MAX_NUM_ENV 5
|
||||
@@ -94,8 +95,8 @@ extern const int8_t ff_k_to_i_34[];
|
||||
void ff_ps_init_common(void);
|
||||
void AAC_RENAME(ff_ps_init)(void);
|
||||
void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps);
|
||||
int ff_ps_read_data(void *logctx, GetBitContext *gb,
|
||||
int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb,
|
||||
PSCommonContext *ps, int bits_left);
|
||||
int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top);
|
||||
int AAC_RENAME(ff_ps_apply)(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top);
|
||||
|
||||
#endif /* AVCODEC_AACPS_H */
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/thread.h"
|
||||
#include "aacps.h"
|
||||
#include "get_bits.h"
|
||||
#include "aacpsdata.c"
|
||||
@@ -58,31 +59,31 @@ static const int huff_iid[] = {
|
||||
huff_iid_dt1,
|
||||
};
|
||||
|
||||
static const VLCElem *vlc_ps[10];
|
||||
static VLC vlc_ps[10];
|
||||
|
||||
#define READ_PAR_DATA(PAR, MASK, ERR_CONDITION, NB_BITS, MAX_DEPTH) \
|
||||
#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION, NB_BITS, MAX_DEPTH) \
|
||||
/** \
|
||||
* Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \
|
||||
* Inter-channel Phase Difference/Overall Phase Difference parameters from the \
|
||||
* bitstream. \
|
||||
* \
|
||||
* @param logctx a context for logging \
|
||||
* @param avctx contains the current codec context \
|
||||
* @param gb pointer to the input bitstream \
|
||||
* @param ps pointer to the Parametric Stereo context \
|
||||
* @param PAR pointer to the parameter to be read \
|
||||
* @param e envelope to decode \
|
||||
* @param dt 1: time delta-coded, 0: frequency delta-coded \
|
||||
*/ \
|
||||
static int read_ ## PAR ## _data(void *logctx, GetBitContext *gb, PSCommonContext *ps, \
|
||||
static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCommonContext *ps, \
|
||||
int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \
|
||||
{ \
|
||||
int b, num = ps->nr_ ## PAR ## _par; \
|
||||
const VLCElem *vlc_table = vlc_ps[table_idx]; \
|
||||
const VLCElem *vlc_table = vlc_ps[table_idx].table; \
|
||||
if (dt) { \
|
||||
int e_prev = e ? e - 1 : ps->num_env_old - 1; \
|
||||
e_prev = FFMAX(e_prev, 0); \
|
||||
for (b = 0; b < num; b++) { \
|
||||
int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH); \
|
||||
int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH) - OFFSET; \
|
||||
if (MASK) val &= MASK; \
|
||||
PAR[e][b] = val; \
|
||||
if (ERR_CONDITION) \
|
||||
@@ -91,7 +92,7 @@ static int read_ ## PAR ## _data(void *logctx, GetBitContext *gb, PSCommonContex
|
||||
} else { \
|
||||
int val = 0; \
|
||||
for (b = 0; b < num; b++) { \
|
||||
val += get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH); \
|
||||
val += get_vlc2(gb, vlc_table, NB_BITS, MAX_DEPTH) - OFFSET; \
|
||||
if (MASK) val &= MASK; \
|
||||
PAR[e][b] = val; \
|
||||
if (ERR_CONDITION) \
|
||||
@@ -100,13 +101,13 @@ static int read_ ## PAR ## _data(void *logctx, GetBitContext *gb, PSCommonContex
|
||||
} \
|
||||
return 0; \
|
||||
err: \
|
||||
av_log(logctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \
|
||||
av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \
|
||||
return AVERROR_INVALIDDATA; \
|
||||
}
|
||||
|
||||
READ_PAR_DATA(iid, 0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant, 9, 3)
|
||||
READ_PAR_DATA(icc, 0, ps->icc_par[e][b] > 7U, 9, 2)
|
||||
READ_PAR_DATA(ipdopd, 0x07, 0, 5, 1)
|
||||
READ_PAR_DATA(iid, huff_offset[table_idx], 0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant, 9, 3)
|
||||
READ_PAR_DATA(icc, huff_offset[table_idx], 0, ps->icc_par[e][b] > 7U, 9, 2)
|
||||
READ_PAR_DATA(ipdopd, 0, 0x07, 0, 5, 1)
|
||||
|
||||
static int ps_read_extension_data(GetBitContext *gb, PSCommonContext *ps,
|
||||
int ps_extension_id)
|
||||
@@ -130,7 +131,7 @@ static int ps_read_extension_data(GetBitContext *gb, PSCommonContext *ps,
|
||||
return get_bits_count(gb) - count;
|
||||
}
|
||||
|
||||
int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host,
|
||||
PSCommonContext *ps, int bits_left)
|
||||
{
|
||||
int e;
|
||||
@@ -145,7 +146,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
if (ps->enable_iid) {
|
||||
int iid_mode = get_bits(gb, 3);
|
||||
if (iid_mode > 5) {
|
||||
av_log(logctx, AV_LOG_ERROR, "iid_mode %d is reserved.\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "iid_mode %d is reserved.\n",
|
||||
iid_mode);
|
||||
goto err;
|
||||
}
|
||||
@@ -157,7 +158,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
if (ps->enable_icc) {
|
||||
ps->icc_mode = get_bits(gb, 3);
|
||||
if (ps->icc_mode > 5) {
|
||||
av_log(logctx, AV_LOG_ERROR, "icc_mode %d is reserved.\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "icc_mode %d is reserved.\n",
|
||||
ps->icc_mode);
|
||||
goto err;
|
||||
}
|
||||
@@ -175,7 +176,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
for (e = 1; e <= ps->num_env; e++) {
|
||||
ps->border_position[e] = get_bits(gb, 5);
|
||||
if (ps->border_position[e] < ps->border_position[e-1]) {
|
||||
av_log(logctx, AV_LOG_ERROR, "border_position non monotone.\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "border_position non monotone.\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +187,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
if (ps->enable_iid) {
|
||||
for (e = 0; e < ps->num_env; e++) {
|
||||
int dt = get_bits1(gb);
|
||||
if (read_iid_data(logctx, gb, ps, ps->iid_par, huff_iid[2*dt+ps->iid_quant], e, dt))
|
||||
if (read_iid_data(avctx, gb, ps, ps->iid_par, huff_iid[2*dt+ps->iid_quant], e, dt))
|
||||
goto err;
|
||||
}
|
||||
} else
|
||||
@@ -195,7 +196,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
if (ps->enable_icc)
|
||||
for (e = 0; e < ps->num_env; e++) {
|
||||
int dt = get_bits1(gb);
|
||||
if (read_icc_data(logctx, gb, ps, ps->icc_par, dt ? huff_icc_dt : huff_icc_df, e, dt))
|
||||
if (read_icc_data(avctx, gb, ps, ps->icc_par, dt ? huff_icc_dt : huff_icc_df, e, dt))
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
@@ -212,7 +213,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
cnt -= 2 + ps_read_extension_data(gb, ps, ps_extension_id);
|
||||
}
|
||||
if (cnt < 0) {
|
||||
av_log(logctx, AV_LOG_ERROR, "ps extension overflow %d\n", cnt);
|
||||
av_log(avctx, AV_LOG_ERROR, "ps extension overflow %d\n", cnt);
|
||||
goto err;
|
||||
}
|
||||
skip_bits(gb, cnt);
|
||||
@@ -240,7 +241,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
if (ps->enable_iid){
|
||||
for (b = 0; b < ps->nr_iid_par; b++) {
|
||||
if (FFABS(ps->iid_par[ps->num_env][b]) > 7 + 8 * ps->iid_quant) {
|
||||
av_log(logctx, AV_LOG_ERROR, "iid_par invalid\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "iid_par invalid\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -248,7 +249,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
if (ps->enable_icc){
|
||||
for (b = 0; b < ps->nr_iid_par; b++) {
|
||||
if (ps->icc_par[ps->num_env][b] > 7U) {
|
||||
av_log(logctx, AV_LOG_ERROR, "icc_par invalid\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "icc_par invalid\n");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -277,7 +278,7 @@ int ff_ps_read_data(void *logctx, GetBitContext *gb_host,
|
||||
skip_bits_long(gb_host, bits_consumed);
|
||||
return bits_consumed;
|
||||
}
|
||||
av_log(logctx, AV_LOG_ERROR, "Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed);
|
||||
av_log(avctx, AV_LOG_ERROR, "Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed);
|
||||
err:
|
||||
ps->start = 0;
|
||||
skip_bits_long(gb_host, bits_left);
|
||||
@@ -288,19 +289,48 @@ err:
|
||||
return bits_left;
|
||||
}
|
||||
|
||||
#define PS_INIT_VLC_STATIC(num, nb_bits, size) \
|
||||
INIT_VLC_STATIC(&vlc_ps[num], nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
|
||||
ps_tmp[num].ps_bits, 1, 1, \
|
||||
ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \
|
||||
size);
|
||||
|
||||
#define PS_VLC_ROW(name) \
|
||||
{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
|
||||
|
||||
static av_cold void ps_init_common(void)
|
||||
{
|
||||
// Syntax initialization
|
||||
static const struct {
|
||||
const void *ps_codes, *ps_bits;
|
||||
const unsigned int table_size, elem_size;
|
||||
} ps_tmp[] = {
|
||||
PS_VLC_ROW(huff_iid_df1),
|
||||
PS_VLC_ROW(huff_iid_dt1),
|
||||
PS_VLC_ROW(huff_iid_df0),
|
||||
PS_VLC_ROW(huff_iid_dt0),
|
||||
PS_VLC_ROW(huff_icc_df),
|
||||
PS_VLC_ROW(huff_icc_dt),
|
||||
PS_VLC_ROW(huff_ipd_df),
|
||||
PS_VLC_ROW(huff_ipd_dt),
|
||||
PS_VLC_ROW(huff_opd_df),
|
||||
PS_VLC_ROW(huff_opd_dt),
|
||||
};
|
||||
|
||||
PS_INIT_VLC_STATIC(0, 9, 1544);
|
||||
PS_INIT_VLC_STATIC(1, 9, 832);
|
||||
PS_INIT_VLC_STATIC(2, 9, 1024);
|
||||
PS_INIT_VLC_STATIC(3, 9, 1036);
|
||||
PS_INIT_VLC_STATIC(4, 9, 544);
|
||||
PS_INIT_VLC_STATIC(5, 9, 544);
|
||||
PS_INIT_VLC_STATIC(6, 5, 32);
|
||||
PS_INIT_VLC_STATIC(7, 5, 32);
|
||||
PS_INIT_VLC_STATIC(8, 5, 32);
|
||||
PS_INIT_VLC_STATIC(9, 5, 32);
|
||||
}
|
||||
|
||||
av_cold void ff_ps_init_common(void)
|
||||
{
|
||||
static VLCElem vlc_buf[(1544 + 832 + 1024 + 1036) +
|
||||
(544 + 544) + (32 + 32 + 32 + 32)];
|
||||
VLCInitState state = VLC_INIT_STATE(vlc_buf);
|
||||
const uint8_t (*tab)[2] = aacps_huff_tabs;
|
||||
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(vlc_ps); i++) {
|
||||
vlc_ps[i] =
|
||||
ff_vlc_init_tables_from_lengths(&state, i <= 5 ? 9 : 5, huff_sizes[i],
|
||||
&tab[0][1], 2,
|
||||
&tab[0][0], 2, 1,
|
||||
huff_offset[i], 0);
|
||||
tab += huff_sizes[i];
|
||||
}
|
||||
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||
ff_thread_once(&init_static_once, ps_init_common);
|
||||
}
|
||||
|
||||
@@ -19,79 +19,124 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
static const uint8_t huff_iid_df1_bits[] = {
|
||||
18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 18, 17, 17, 16, 16, 15, 14, 14,
|
||||
13, 12, 12, 11, 10, 10, 8, 7, 6, 5, 4, 3, 1, 3, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16, 17, 17, 18, 17, 18, 18,
|
||||
18, 18, 18, 18, 18, 18, 18,
|
||||
};
|
||||
|
||||
static const uint8_t huff_sizes[] = { 61, 61, 29, 29, 15, 15, 8, 8, 8, 8 };
|
||||
static const uint32_t huff_iid_df1_codes[] = {
|
||||
0x01FEB4, 0x01FEB5, 0x01FD76, 0x01FD77, 0x01FD74, 0x01FD75, 0x01FE8A,
|
||||
0x01FE8B, 0x01FE88, 0x00FE80, 0x01FEB6, 0x00FE82, 0x00FEB8, 0x007F42,
|
||||
0x007FAE, 0x003FAF, 0x001FD1, 0x001FE9, 0x000FE9, 0x0007EA, 0x0007FB,
|
||||
0x0003FB, 0x0001FB, 0x0001FF, 0x00007C, 0x00003C, 0x00001C, 0x00000C,
|
||||
0x000000, 0x000001, 0x000001, 0x000002, 0x000001, 0x00000D, 0x00001D,
|
||||
0x00003D, 0x00007D, 0x0000FC, 0x0001FC, 0x0003FC, 0x0003F4, 0x0007EB,
|
||||
0x000FEA, 0x001FEA, 0x001FD6, 0x003FD0, 0x007FAF, 0x007F43, 0x00FEB9,
|
||||
0x00FE83, 0x01FEB7, 0x00FE81, 0x01FE89, 0x01FE8E, 0x01FE8F, 0x01FE8C,
|
||||
0x01FE8D, 0x01FEB2, 0x01FEB3, 0x01FEB0, 0x01FEB1,
|
||||
};
|
||||
|
||||
static const uint8_t aacps_huff_tabs[][2] = {
|
||||
/* huff_iid_df1 - 61 entries */
|
||||
{ 28, 4 }, { 32, 4 }, { 29, 3 }, { 31, 3 }, { 27, 5 },
|
||||
{ 33, 5 }, { 26, 6 }, { 34, 6 }, { 25, 7 }, { 35, 7 },
|
||||
{ 24, 8 }, { 36, 8 }, { 37, 9 }, { 40, 11 }, { 19, 12 },
|
||||
{ 41, 12 }, { 22, 10 }, { 38, 10 }, { 9, 17 }, { 51, 17 },
|
||||
{ 11, 17 }, { 49, 17 }, { 13, 16 }, { 47, 16 }, { 16, 14 },
|
||||
{ 18, 13 }, { 42, 13 }, { 44, 14 }, { 12, 17 }, { 48, 17 },
|
||||
{ 4, 18 }, { 5, 18 }, { 2, 18 }, { 3, 18 }, { 15, 15 },
|
||||
{ 21, 11 }, { 39, 11 }, { 45, 15 }, { 8, 18 }, { 52, 18 },
|
||||
{ 6, 18 }, { 7, 18 }, { 55, 18 }, { 56, 18 }, { 53, 18 },
|
||||
{ 54, 18 }, { 17, 14 }, { 43, 14 }, { 59, 18 }, { 60, 18 },
|
||||
{ 57, 18 }, { 58, 18 }, { 0, 18 }, { 1, 18 }, { 10, 18 },
|
||||
{ 50, 18 }, { 14, 16 }, { 46, 16 }, { 20, 12 }, { 23, 10 },
|
||||
{ 30, 1 },
|
||||
/* huff_iid_dt1 - 61 entries */
|
||||
{ 31, 2 }, { 26, 7 }, { 34, 7 }, { 27, 6 }, { 33, 6 },
|
||||
{ 35, 8 }, { 24, 9 }, { 36, 9 }, { 39, 11 }, { 41, 12 },
|
||||
{ 9, 15 }, { 10, 15 }, { 48, 15 }, { 49, 15 }, { 17, 13 },
|
||||
{ 23, 10 }, { 37, 10 }, { 43, 13 }, { 11, 15 }, { 12, 15 },
|
||||
{ 4, 16 }, { 56, 16 }, { 2, 16 }, { 3, 16 }, { 59, 16 },
|
||||
{ 60, 16 }, { 57, 16 }, { 58, 16 }, { 0, 16 }, { 1, 16 },
|
||||
{ 5, 16 }, { 55, 16 }, { 6, 16 }, { 54, 16 }, { 13, 15 },
|
||||
{ 15, 14 }, { 20, 12 }, { 40, 12 }, { 22, 11 }, { 38, 11 },
|
||||
{ 45, 14 }, { 47, 15 }, { 7, 16 }, { 53, 16 }, { 18, 13 },
|
||||
{ 42, 13 }, { 16, 14 }, { 44, 14 }, { 8, 16 }, { 52, 16 },
|
||||
{ 14, 15 }, { 46, 15 }, { 50, 16 }, { 51, 16 }, { 19, 13 },
|
||||
{ 21, 12 }, { 25, 9 }, { 28, 5 }, { 32, 5 }, { 29, 3 },
|
||||
{ 30, 1 },
|
||||
/* huff_iid_df0 - 29 entries */
|
||||
{ 14, 1 }, { 15, 3 }, { 13, 3 }, { 16, 4 }, { 12, 4 },
|
||||
{ 17, 5 }, { 11, 5 }, { 10, 6 }, { 18, 6 }, { 19, 6 },
|
||||
{ 9, 7 }, { 20, 8 }, { 8, 9 }, { 7, 10 }, { 21, 11 },
|
||||
{ 22, 13 }, { 6, 13 }, { 23, 14 }, { 24, 14 }, { 5, 15 },
|
||||
{ 25, 15 }, { 4, 16 }, { 3, 17 }, { 0, 17 }, { 1, 17 },
|
||||
{ 2, 17 }, { 26, 17 }, { 27, 18 }, { 28, 18 },
|
||||
/* huff_iid_dt0 - 29 entries */
|
||||
{ 14, 1 }, { 13, 2 }, { 15, 3 }, { 12, 4 }, { 16, 5 },
|
||||
{ 11, 6 }, { 17, 7 }, { 10, 8 }, { 18, 9 }, { 9, 10 },
|
||||
{ 19, 11 }, { 8, 12 }, { 20, 13 }, { 21, 14 }, { 7, 15 },
|
||||
{ 22, 17 }, { 6, 17 }, { 23, 19 }, { 0, 19 }, { 1, 19 },
|
||||
{ 2, 19 }, { 3, 20 }, { 4, 20 }, { 5, 20 }, { 24, 20 },
|
||||
{ 25, 20 }, { 26, 20 }, { 27, 20 }, { 28, 20 },
|
||||
/* huff_icc_df - 15 entries */
|
||||
{ 7, 1 }, { 8, 2 }, { 6, 3 }, { 9, 4 }, { 5, 5 },
|
||||
{ 10, 6 }, { 4, 7 }, { 11, 8 }, { 12, 9 }, { 3, 10 },
|
||||
{ 13, 11 }, { 2, 12 }, { 14, 13 }, { 1, 14 }, { 0, 14 },
|
||||
/* huff_icc_dt - 15 entries */
|
||||
{ 7, 1 }, { 8, 2 }, { 6, 3 }, { 9, 4 }, { 5, 5 },
|
||||
{ 10, 6 }, { 4, 7 }, { 11, 8 }, { 3, 9 }, { 12, 10 },
|
||||
{ 2, 11 }, { 13, 12 }, { 1, 13 }, { 0, 14 }, { 14, 14 },
|
||||
/* huff_ipd_df - 8 entries */
|
||||
{ 1, 3 }, { 4, 4 }, { 5, 4 }, { 3, 4 }, { 6, 4 },
|
||||
{ 2, 4 }, { 7, 4 }, { 0, 1 },
|
||||
/* huff_ipd_dt - 8 entries */
|
||||
{ 5, 4 }, { 4, 5 }, { 3, 5 }, { 2, 4 }, { 6, 4 },
|
||||
{ 1, 3 }, { 7, 3 }, { 0, 1 },
|
||||
/* huff_opd_df - 8 entries */
|
||||
{ 7, 3 }, { 1, 3 }, { 3, 4 }, { 6, 4 }, { 2, 4 },
|
||||
{ 5, 5 }, { 4, 5 }, { 0, 1 },
|
||||
/* huff_opd_dt - 8 entries */
|
||||
{ 5, 4 }, { 2, 4 }, { 6, 4 }, { 4, 5 }, { 3, 5 },
|
||||
{ 1, 3 }, { 7, 3 }, { 0, 1 },
|
||||
static const uint8_t huff_iid_dt1_bits[] = {
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 13,
|
||||
13, 13, 12, 12, 11, 10, 9, 9, 7, 6, 5, 3, 1, 2, 5, 6, 7, 8,
|
||||
9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16,
|
||||
};
|
||||
|
||||
static const uint16_t huff_iid_dt1_codes[] = {
|
||||
0x004ED4, 0x004ED5, 0x004ECE, 0x004ECF, 0x004ECC, 0x004ED6, 0x004ED8,
|
||||
0x004F46, 0x004F60, 0x002718, 0x002719, 0x002764, 0x002765, 0x00276D,
|
||||
0x0027B1, 0x0013B7, 0x0013D6, 0x0009C7, 0x0009E9, 0x0009ED, 0x0004EE,
|
||||
0x0004F7, 0x000278, 0x000139, 0x00009A, 0x00009F, 0x000020, 0x000011,
|
||||
0x00000A, 0x000003, 0x000001, 0x000000, 0x00000B, 0x000012, 0x000021,
|
||||
0x00004C, 0x00009B, 0x00013A, 0x000279, 0x000270, 0x0004EF, 0x0004E2,
|
||||
0x0009EA, 0x0009D8, 0x0013D7, 0x0013D0, 0x0027B2, 0x0027A2, 0x00271A,
|
||||
0x00271B, 0x004F66, 0x004F67, 0x004F61, 0x004F47, 0x004ED9, 0x004ED7,
|
||||
0x004ECD, 0x004ED2, 0x004ED3, 0x004ED0, 0x004ED1,
|
||||
};
|
||||
|
||||
static const uint8_t huff_iid_df0_bits[] = {
|
||||
17, 17, 17, 17, 16, 15, 13, 10, 9, 7, 6, 5, 4, 3, 1, 3, 4, 5,
|
||||
6, 6, 8, 11, 13, 14, 14, 15, 17, 18, 18,
|
||||
};
|
||||
|
||||
static const uint32_t huff_iid_df0_codes[] = {
|
||||
0x01FFFB, 0x01FFFC, 0x01FFFD, 0x01FFFA, 0x00FFFC, 0x007FFC, 0x001FFD,
|
||||
0x0003FE, 0x0001FE, 0x00007E, 0x00003C, 0x00001D, 0x00000D, 0x000005,
|
||||
0x000000, 0x000004, 0x00000C, 0x00001C, 0x00003D, 0x00003E, 0x0000FE,
|
||||
0x0007FE, 0x001FFC, 0x003FFC, 0x003FFD, 0x007FFD, 0x01FFFE, 0x03FFFE,
|
||||
0x03FFFF,
|
||||
};
|
||||
|
||||
static const uint8_t huff_iid_dt0_bits[] = {
|
||||
19, 19, 19, 20, 20, 20, 17, 15, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7,
|
||||
9, 11, 13, 14, 17, 19, 20, 20, 20, 20, 20,
|
||||
};
|
||||
|
||||
static const uint32_t huff_iid_dt0_codes[] = {
|
||||
0x07FFF9, 0x07FFFA, 0x07FFFB, 0x0FFFF8, 0x0FFFF9, 0x0FFFFA, 0x01FFFD,
|
||||
0x007FFE, 0x000FFE, 0x0003FE, 0x0000FE, 0x00003E, 0x00000E, 0x000002,
|
||||
0x000000, 0x000006, 0x00001E, 0x00007E, 0x0001FE, 0x0007FE, 0x001FFE,
|
||||
0x003FFE, 0x01FFFC, 0x07FFF8, 0x0FFFFB, 0x0FFFFC, 0x0FFFFD, 0x0FFFFE,
|
||||
0x0FFFFF,
|
||||
};
|
||||
|
||||
static const uint8_t huff_icc_df_bits[] = {
|
||||
14, 14, 12, 10, 7, 5, 3, 1, 2, 4, 6, 8, 9, 11, 13,
|
||||
};
|
||||
|
||||
static const uint16_t huff_icc_df_codes[] = {
|
||||
0x3FFF, 0x3FFE, 0x0FFE, 0x03FE, 0x007E, 0x001E, 0x0006, 0x0000,
|
||||
0x0002, 0x000E, 0x003E, 0x00FE, 0x01FE, 0x07FE, 0x1FFE,
|
||||
};
|
||||
|
||||
static const uint8_t huff_icc_dt_bits[] = {
|
||||
14, 13, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12, 14,
|
||||
};
|
||||
|
||||
static const uint16_t huff_icc_dt_codes[] = {
|
||||
0x3FFE, 0x1FFE, 0x07FE, 0x01FE, 0x007E, 0x001E, 0x0006, 0x0000,
|
||||
0x0002, 0x000E, 0x003E, 0x00FE, 0x03FE, 0x0FFE, 0x3FFF,
|
||||
};
|
||||
|
||||
static const uint8_t huff_ipd_df_bits[] = {
|
||||
1, 3, 4, 4, 4, 4, 4, 4,
|
||||
};
|
||||
|
||||
static const uint8_t huff_ipd_df_codes[] = {
|
||||
0x01, 0x00, 0x06, 0x04, 0x02, 0x03, 0x05, 0x07,
|
||||
};
|
||||
|
||||
static const uint8_t huff_ipd_dt_bits[] = {
|
||||
1, 3, 4, 5, 5, 4, 4, 3,
|
||||
};
|
||||
|
||||
static const uint8_t huff_ipd_dt_codes[] = {
|
||||
0x01, 0x02, 0x02, 0x03, 0x02, 0x00, 0x03, 0x03,
|
||||
};
|
||||
|
||||
static const uint8_t huff_opd_df_bits[] = {
|
||||
1, 3, 4, 4, 5, 5, 4, 3,
|
||||
};
|
||||
|
||||
static const uint8_t huff_opd_df_codes[] = {
|
||||
0x01, 0x01, 0x06, 0x04, 0x0F, 0x0E, 0x05, 0x00,
|
||||
};
|
||||
|
||||
static const uint8_t huff_opd_dt_bits[] = {
|
||||
1, 3, 4, 5, 5, 4, 4, 3,
|
||||
};
|
||||
|
||||
static const uint8_t huff_opd_dt_codes[] = {
|
||||
0x01, 0x02, 0x01, 0x07, 0x06, 0x00, 0x02, 0x03,
|
||||
};
|
||||
|
||||
static const int8_t huff_offset[] = {
|
||||
-30, -30,
|
||||
-14, -14,
|
||||
-7, -7,
|
||||
30, 30,
|
||||
14, 14,
|
||||
7, 7,
|
||||
0, 0,
|
||||
0, 0,
|
||||
};
|
||||
|
||||
@@ -26,25 +26,24 @@
|
||||
#include "libavutil/attributes.h"
|
||||
#include "aacpsdsp.h"
|
||||
|
||||
static void ps_add_squares_c(INTFLOAT *av_restrict dst,
|
||||
const INTFLOAT (*src)[2], int n)
|
||||
static void ps_add_squares_c(INTFLOAT *dst, const INTFLOAT (*src)[2], int n)
|
||||
{
|
||||
for (int i = 0; i < n; i++)
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
dst[i] += (UINTFLOAT)AAC_MADD28(src[i][0], src[i][0], src[i][1], src[i][1]);
|
||||
}
|
||||
|
||||
static void ps_mul_pair_single_c(INTFLOAT (*av_restrict dst)[2],
|
||||
INTFLOAT (*src0)[2], INTFLOAT *src1,
|
||||
static void ps_mul_pair_single_c(INTFLOAT (*dst)[2], INTFLOAT (*src0)[2], INTFLOAT *src1,
|
||||
int n)
|
||||
{
|
||||
for (int i = 0; i < n; i++) {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][0] = AAC_MUL16(src0[i][0], src1[i]);
|
||||
dst[i][1] = AAC_MUL16(src0[i][1], src1[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void ps_hybrid_analysis_c(INTFLOAT (*av_restrict out)[2],
|
||||
INTFLOAT (*in)[2],
|
||||
static void ps_hybrid_analysis_c(INTFLOAT (*out)[2], INTFLOAT (*in)[2],
|
||||
const INTFLOAT (*filter)[8][2],
|
||||
ptrdiff_t stride, int n)
|
||||
{
|
||||
@@ -77,12 +76,13 @@ static void ps_hybrid_analysis_c(INTFLOAT (*av_restrict out)[2],
|
||||
}
|
||||
}
|
||||
|
||||
static void ps_hybrid_analysis_ileave_c(INTFLOAT (*av_restrict out)[32][2],
|
||||
INTFLOAT L[2][38][64],
|
||||
int i, int len)
|
||||
static void ps_hybrid_analysis_ileave_c(INTFLOAT (*out)[32][2], INTFLOAT L[2][38][64],
|
||||
int i, int len)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (; i < 64; i++) {
|
||||
for (int j = 0; j < len; j++) {
|
||||
for (j = 0; j < len; j++) {
|
||||
out[i][j][0] = L[0][j][i];
|
||||
out[i][j][1] = L[1][j][i];
|
||||
}
|
||||
@@ -90,11 +90,13 @@ static void ps_hybrid_analysis_ileave_c(INTFLOAT (*av_restrict out)[32][2],
|
||||
}
|
||||
|
||||
static void ps_hybrid_synthesis_deint_c(INTFLOAT out[2][38][64],
|
||||
INTFLOAT (*av_restrict in)[32][2],
|
||||
int i, int len)
|
||||
INTFLOAT (*in)[32][2],
|
||||
int i, int len)
|
||||
{
|
||||
int n;
|
||||
|
||||
for (; i < 64; i++) {
|
||||
for (int n = 0; n < len; n++) {
|
||||
for (n = 0; n < len; n++) {
|
||||
out[0][n][i] = in[i][n][0];
|
||||
out[1][n][i] = in[i][n][1];
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "libavutil/ffmath.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "aac.h"
|
||||
#include "aactab.h"
|
||||
#include "psymodel.h"
|
||||
|
||||
/***********************************
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "mips/aacsbr_mips.h"
|
||||
#endif /* ARCH_MIPS */
|
||||
|
||||
static VLC vlc_sbr[10];
|
||||
static void aacsbr_func_ptr_init(AACSBRContext *c);
|
||||
|
||||
static void make_bands(int16_t* bands, int start, int stop, int num_bands)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#define AVCODEC_AACSBR_H
|
||||
|
||||
#include "get_bits.h"
|
||||
#include "aac_defines.h"
|
||||
#include "aac.h"
|
||||
#include "sbr.h"
|
||||
|
||||
#define ENVELOPE_ADJUSTMENT_OFFSET 2
|
||||
@@ -66,6 +66,18 @@ enum {
|
||||
EXTENSION_ID_PS = 2,
|
||||
};
|
||||
|
||||
static const int8_t vlc_sbr_lav[10] =
|
||||
{ 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
|
||||
|
||||
#define SBR_INIT_VLC_STATIC(num, size) \
|
||||
INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
|
||||
sbr_tmp[num].sbr_bits , 1, 1, \
|
||||
sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
|
||||
size)
|
||||
|
||||
#define SBR_VLC_ROW(name) \
|
||||
{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
|
||||
|
||||
/** Initialize SBR. */
|
||||
void AAC_RENAME(ff_aac_sbr_init)(void);
|
||||
/** Initialize one SBR context. */
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
static VLC vlc_sbr[10];
|
||||
static void aacsbr_func_ptr_init(AACSBRContext *c);
|
||||
static const int CONST_LN2 = Q31(0.6931471806/256); // ln(2)/256
|
||||
static const int CONST_RECIP_LN2 = Q31(0.7213475204); // 0.5/ln(2)
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
* @author Zoran Basaric ( zoran.basaric@imgtec.com )
|
||||
*/
|
||||
|
||||
#include "aacdectab.h"
|
||||
#include "libavutil/qsort.h"
|
||||
|
||||
static av_cold void aacsbr_tableinit(void)
|
||||
@@ -45,6 +44,34 @@ static av_cold void aacsbr_tableinit(void)
|
||||
|
||||
av_cold void AAC_RENAME(ff_aac_sbr_init)(void)
|
||||
{
|
||||
static const struct {
|
||||
const void *sbr_codes, *sbr_bits;
|
||||
const unsigned int table_size, elem_size;
|
||||
} sbr_tmp[] = {
|
||||
SBR_VLC_ROW(t_huffman_env_1_5dB),
|
||||
SBR_VLC_ROW(f_huffman_env_1_5dB),
|
||||
SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
|
||||
SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
|
||||
SBR_VLC_ROW(t_huffman_env_3_0dB),
|
||||
SBR_VLC_ROW(f_huffman_env_3_0dB),
|
||||
SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
|
||||
SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
|
||||
SBR_VLC_ROW(t_huffman_noise_3_0dB),
|
||||
SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
|
||||
};
|
||||
|
||||
// SBR VLC table initialization
|
||||
SBR_INIT_VLC_STATIC(0, 1098);
|
||||
SBR_INIT_VLC_STATIC(1, 1092);
|
||||
SBR_INIT_VLC_STATIC(2, 768);
|
||||
SBR_INIT_VLC_STATIC(3, 1026);
|
||||
SBR_INIT_VLC_STATIC(4, 1058);
|
||||
SBR_INIT_VLC_STATIC(5, 1052);
|
||||
SBR_INIT_VLC_STATIC(6, 544);
|
||||
SBR_INIT_VLC_STATIC(7, 544);
|
||||
SBR_INIT_VLC_STATIC(8, 592);
|
||||
SBR_INIT_VLC_STATIC(9, 512);
|
||||
|
||||
aacsbr_tableinit();
|
||||
|
||||
AAC_RENAME(ff_ps_init)();
|
||||
@@ -804,28 +831,37 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
|
||||
int bits;
|
||||
int i, j, k;
|
||||
const VLCElem *t_huff, *f_huff;
|
||||
int t_lav, f_lav;
|
||||
const int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
|
||||
const int odd = sbr->n[1] & 1;
|
||||
|
||||
if (sbr->bs_coupling && ch) {
|
||||
if (ch_data->bs_amp_res) {
|
||||
bits = 5;
|
||||
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_3_0DB];
|
||||
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB];
|
||||
t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table;
|
||||
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB];
|
||||
f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
|
||||
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
|
||||
} else {
|
||||
bits = 6;
|
||||
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_1_5DB];
|
||||
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_1_5DB];
|
||||
t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table;
|
||||
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB];
|
||||
f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table;
|
||||
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB];
|
||||
}
|
||||
} else {
|
||||
if (ch_data->bs_amp_res) {
|
||||
bits = 6;
|
||||
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_3_0DB];
|
||||
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB];
|
||||
t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table;
|
||||
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB];
|
||||
f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
|
||||
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
|
||||
} else {
|
||||
bits = 7;
|
||||
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_1_5DB];
|
||||
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_1_5DB];
|
||||
t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table;
|
||||
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB];
|
||||
f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table;
|
||||
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,7 +870,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
|
||||
// bs_freq_res[0] == bs_freq_res[bs_num_env] from prev frame
|
||||
if (ch_data->bs_freq_res[i + 1] == ch_data->bs_freq_res[i]) {
|
||||
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][j] + delta * get_vlc2(gb, t_huff, 9, 3);
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][j] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
|
||||
if (ch_data->env_facs_q[i + 1][j] > 127U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -843,7 +879,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
|
||||
} else if (ch_data->bs_freq_res[i + 1]) {
|
||||
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
|
||||
k = (j + odd) >> 1; // find k such that f_tablelow[k] <= f_tablehigh[j] < f_tablelow[k + 1]
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * get_vlc2(gb, t_huff, 9, 3);
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
|
||||
if (ch_data->env_facs_q[i + 1][j] > 127U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -852,7 +888,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
|
||||
} else {
|
||||
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
|
||||
k = j ? 2*j - odd : 0; // find k such that f_tablehigh[k] == f_tablelow[j]
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * get_vlc2(gb, t_huff, 9, 3);
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
|
||||
if (ch_data->env_facs_q[i + 1][j] > 127U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -862,7 +898,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
|
||||
} else {
|
||||
ch_data->env_facs_q[i + 1][0] = delta * get_bits(gb, bits); // bs_env_start_value_balance
|
||||
for (j = 1; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i + 1][j - 1] + delta * get_vlc2(gb, f_huff, 9, 3);
|
||||
ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
|
||||
if (ch_data->env_facs_q[i + 1][j] > 127U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "env_facs_q %d is invalid\n", ch_data->env_facs_q[i + 1][j]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -883,20 +919,25 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
|
||||
{
|
||||
int i, j;
|
||||
const VLCElem *t_huff, *f_huff;
|
||||
int t_lav, f_lav;
|
||||
int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
|
||||
|
||||
if (sbr->bs_coupling && ch) {
|
||||
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_BAL_3_0DB];
|
||||
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB];
|
||||
t_huff = vlc_sbr[T_HUFFMAN_NOISE_BAL_3_0DB].table;
|
||||
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_BAL_3_0DB];
|
||||
f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
|
||||
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
|
||||
} else {
|
||||
t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_3_0DB];
|
||||
f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB];
|
||||
t_huff = vlc_sbr[T_HUFFMAN_NOISE_3_0DB].table;
|
||||
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_3_0DB];
|
||||
f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
|
||||
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
|
||||
}
|
||||
|
||||
for (i = 0; i < ch_data->bs_num_noise; i++) {
|
||||
if (ch_data->bs_df_noise[i]) {
|
||||
for (j = 0; j < sbr->n_q; j++) {
|
||||
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i][j] + delta * get_vlc2(gb, t_huff, 9, 2);
|
||||
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i][j] + delta * (get_vlc2(gb, t_huff, 9, 2) - t_lav);
|
||||
if (ch_data->noise_facs_q[i + 1][j] > 30U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -905,7 +946,7 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
|
||||
} else {
|
||||
ch_data->noise_facs_q[i + 1][0] = delta * get_bits(gb, 5); // bs_noise_start_value_balance or bs_noise_start_value_level
|
||||
for (j = 1; j < sbr->n_q; j++) {
|
||||
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i + 1][j - 1] + delta * get_vlc2(gb, f_huff, 9, 3);
|
||||
ch_data->noise_facs_q[i + 1][j] = ch_data->noise_facs_q[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
|
||||
if (ch_data->noise_facs_q[i + 1][j] > 30U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "noise_facs_q %d is invalid\n", ch_data->noise_facs_q[i + 1][j]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -932,7 +973,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
|
||||
*num_bits_left = 0;
|
||||
} else {
|
||||
*num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps.common, *num_bits_left);
|
||||
ac->avctx->profile = AV_PROFILE_AAC_HE_V2;
|
||||
ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
|
||||
// ensure the warning is not printed if PS extension is present
|
||||
ac->warned_he_aac_mono = 1;
|
||||
}
|
||||
@@ -1528,7 +1569,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int
|
||||
|
||||
if (ac->oc[1].m4ac.ps == 1) {
|
||||
if (sbr->ps.common.start) {
|
||||
AAC_RENAME(ff_ps_apply)(&sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
|
||||
AAC_RENAME(ff_ps_apply)(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
|
||||
} else {
|
||||
memcpy(sbr->X[1], sbr->X[0], sizeof(sbr->X[0]));
|
||||
}
|
||||
|
||||
@@ -29,9 +29,236 @@
|
||||
#define AVCODEC_AACSBRDATA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "libavutil/attributes_internal.h"
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "aac_defines.h"
|
||||
|
||||
///< Huffman tables for SBR
|
||||
|
||||
static const uint8_t t_huffman_env_1_5dB_bits[121] = {
|
||||
18, 18, 18, 18, 18, 18, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 17, 18, 16, 17, 18, 17,
|
||||
16, 16, 16, 16, 15, 14, 14, 13,
|
||||
13, 12, 11, 10, 9, 8, 7, 6,
|
||||
5, 4, 3, 2, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10, 12, 13, 14,
|
||||
14, 15, 16, 17, 16, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19,
|
||||
};
|
||||
|
||||
static const uint32_t t_huffman_env_1_5dB_codes[121] = {
|
||||
0x3ffd6, 0x3ffd7, 0x3ffd8, 0x3ffd9, 0x3ffda, 0x3ffdb, 0x7ffb8, 0x7ffb9,
|
||||
0x7ffba, 0x7ffbb, 0x7ffbc, 0x7ffbd, 0x7ffbe, 0x7ffbf, 0x7ffc0, 0x7ffc1,
|
||||
0x7ffc2, 0x7ffc3, 0x7ffc4, 0x7ffc5, 0x7ffc6, 0x7ffc7, 0x7ffc8, 0x7ffc9,
|
||||
0x7ffca, 0x7ffcb, 0x7ffcc, 0x7ffcd, 0x7ffce, 0x7ffcf, 0x7ffd0, 0x7ffd1,
|
||||
0x7ffd2, 0x7ffd3, 0x1ffe6, 0x3ffd4, 0x0fff0, 0x1ffe9, 0x3ffd5, 0x1ffe7,
|
||||
0x0fff1, 0x0ffec, 0x0ffed, 0x0ffee, 0x07ff4, 0x03ff9, 0x03ff7, 0x01ffa,
|
||||
0x01ff9, 0x00ffb, 0x007fc, 0x003fc, 0x001fd, 0x000fd, 0x0007d, 0x0003d,
|
||||
0x0001d, 0x0000d, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000c, 0x0001c,
|
||||
0x0003c, 0x0007c, 0x000fc, 0x001fc, 0x003fd, 0x00ffa, 0x01ff8, 0x03ff6,
|
||||
0x03ff8, 0x07ff5, 0x0ffef, 0x1ffe8, 0x0fff2, 0x7ffd4, 0x7ffd5, 0x7ffd6,
|
||||
0x7ffd7, 0x7ffd8, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde,
|
||||
0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6,
|
||||
0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x7ffed, 0x7ffee,
|
||||
0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6,
|
||||
0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe,
|
||||
0x7ffff,
|
||||
};
|
||||
|
||||
static const uint8_t f_huffman_env_1_5dB_bits[121] = {
|
||||
19, 19, 20, 20, 20, 20, 20, 20,
|
||||
20, 19, 20, 20, 20, 20, 19, 20,
|
||||
19, 19, 20, 18, 20, 20, 20, 19,
|
||||
20, 20, 20, 19, 20, 19, 18, 19,
|
||||
18, 18, 17, 18, 17, 17, 17, 16,
|
||||
16, 16, 15, 15, 14, 13, 13, 12,
|
||||
12, 11, 10, 9, 9, 8, 7, 6,
|
||||
5, 4, 3, 2, 2, 3, 4, 5,
|
||||
6, 8, 8, 9, 10, 11, 11, 11,
|
||||
12, 12, 13, 13, 14, 14, 16, 16,
|
||||
17, 17, 18, 18, 18, 18, 18, 18,
|
||||
18, 20, 19, 20, 20, 20, 20, 20,
|
||||
20, 19, 20, 20, 20, 20, 19, 20,
|
||||
18, 20, 20, 19, 19, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20,
|
||||
};
|
||||
|
||||
static const uint32_t f_huffman_env_1_5dB_codes[121] = {
|
||||
0x7ffe7, 0x7ffe8, 0xfffd2, 0xfffd3, 0xfffd4, 0xfffd5, 0xfffd6, 0xfffd7,
|
||||
0xfffd8, 0x7ffda, 0xfffd9, 0xfffda, 0xfffdb, 0xfffdc, 0x7ffdb, 0xfffdd,
|
||||
0x7ffdc, 0x7ffdd, 0xfffde, 0x3ffe4, 0xfffdf, 0xfffe0, 0xfffe1, 0x7ffde,
|
||||
0xfffe2, 0xfffe3, 0xfffe4, 0x7ffdf, 0xfffe5, 0x7ffe0, 0x3ffe8, 0x7ffe1,
|
||||
0x3ffe0, 0x3ffe9, 0x1ffef, 0x3ffe5, 0x1ffec, 0x1ffed, 0x1ffee, 0x0fff4,
|
||||
0x0fff3, 0x0fff0, 0x07ff7, 0x07ff6, 0x03ffa, 0x01ffa, 0x01ff9, 0x00ffa,
|
||||
0x00ff8, 0x007f9, 0x003fb, 0x001fc, 0x001fa, 0x000fb, 0x0007c, 0x0003c,
|
||||
0x0001c, 0x0000c, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000d, 0x0001d,
|
||||
0x0003d, 0x000fa, 0x000fc, 0x001fb, 0x003fa, 0x007f8, 0x007fa, 0x007fb,
|
||||
0x00ff9, 0x00ffb, 0x01ff8, 0x01ffb, 0x03ff8, 0x03ff9, 0x0fff1, 0x0fff2,
|
||||
0x1ffea, 0x1ffeb, 0x3ffe1, 0x3ffe2, 0x3ffea, 0x3ffe3, 0x3ffe6, 0x3ffe7,
|
||||
0x3ffeb, 0xfffe6, 0x7ffe2, 0xfffe7, 0xfffe8, 0xfffe9, 0xfffea, 0xfffeb,
|
||||
0xfffec, 0x7ffe3, 0xfffed, 0xfffee, 0xfffef, 0xffff0, 0x7ffe4, 0xffff1,
|
||||
0x3ffec, 0xffff2, 0xffff3, 0x7ffe5, 0x7ffe6, 0xffff4, 0xffff5, 0xffff6,
|
||||
0xffff7, 0xffff8, 0xffff9, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe,
|
||||
0xfffff,
|
||||
};
|
||||
|
||||
static const uint8_t t_huffman_env_bal_1_5dB_bits[49] = {
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 12, 11, 9, 7, 5, 3,
|
||||
1, 2, 4, 6, 8, 11, 12, 15,
|
||||
16, 16, 16, 16, 16, 16, 16, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17,
|
||||
17,
|
||||
};
|
||||
|
||||
static const uint32_t t_huffman_env_bal_1_5dB_codes[49] = {
|
||||
0x0ffe4, 0x0ffe5, 0x0ffe6, 0x0ffe7, 0x0ffe8, 0x0ffe9, 0x0ffea, 0x0ffeb,
|
||||
0x0ffec, 0x0ffed, 0x0ffee, 0x0ffef, 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3,
|
||||
0x0fff4, 0x0ffe2, 0x00ffc, 0x007fc, 0x001fe, 0x0007e, 0x0001e, 0x00006,
|
||||
0x00000, 0x00002, 0x0000e, 0x0003e, 0x000fe, 0x007fd, 0x00ffd, 0x07ff0,
|
||||
0x0ffe3, 0x0fff5, 0x0fff6, 0x0fff7, 0x0fff8, 0x0fff9, 0x0fffa, 0x1fff6,
|
||||
0x1fff7, 0x1fff8, 0x1fff9, 0x1fffa, 0x1fffb, 0x1fffc, 0x1fffd, 0x1fffe,
|
||||
0x1ffff,
|
||||
};
|
||||
|
||||
static const uint8_t f_huffman_env_bal_1_5dB_bits[49] = {
|
||||
18, 18, 18, 18, 18, 18, 18, 18,
|
||||
18, 18, 18, 18, 18, 18, 18, 16,
|
||||
17, 14, 11, 11, 8, 7, 4, 2,
|
||||
1, 3, 5, 6, 9, 11, 12, 15,
|
||||
16, 18, 18, 18, 18, 18, 18, 18,
|
||||
18, 18, 18, 18, 18, 18, 18, 19,
|
||||
19,
|
||||
};
|
||||
|
||||
static const uint32_t f_huffman_env_bal_1_5dB_codes[49] = {
|
||||
0x3ffe2, 0x3ffe3, 0x3ffe4, 0x3ffe5, 0x3ffe6, 0x3ffe7, 0x3ffe8, 0x3ffe9,
|
||||
0x3ffea, 0x3ffeb, 0x3ffec, 0x3ffed, 0x3ffee, 0x3ffef, 0x3fff0, 0x0fff7,
|
||||
0x1fff0, 0x03ffc, 0x007fe, 0x007fc, 0x000fe, 0x0007e, 0x0000e, 0x00002,
|
||||
0x00000, 0x00006, 0x0001e, 0x0003e, 0x001fe, 0x007fd, 0x00ffe, 0x07ffa,
|
||||
0x0fff6, 0x3fff1, 0x3fff2, 0x3fff3, 0x3fff4, 0x3fff5, 0x3fff6, 0x3fff7,
|
||||
0x3fff8, 0x3fff9, 0x3fffa, 0x3fffb, 0x3fffc, 0x3fffd, 0x3fffe, 0x7fffe,
|
||||
0x7ffff,
|
||||
};
|
||||
|
||||
static const uint8_t t_huffman_env_3_0dB_bits[63] = {
|
||||
18, 18, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 17, 16, 16, 16, 14, 14, 14,
|
||||
13, 12, 11, 8, 6, 4, 2, 1,
|
||||
3, 5, 7, 9, 11, 13, 14, 14,
|
||||
15, 16, 17, 18, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 19,
|
||||
};
|
||||
|
||||
static const uint32_t t_huffman_env_3_0dB_codes[63] = {
|
||||
0x3ffed, 0x3ffee, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3,
|
||||
0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb,
|
||||
0x7ffec, 0x1fff4, 0x0fff7, 0x0fff9, 0x0fff8, 0x03ffb, 0x03ffa, 0x03ff8,
|
||||
0x01ffa, 0x00ffc, 0x007fc, 0x000fe, 0x0003e, 0x0000e, 0x00002, 0x00000,
|
||||
0x00006, 0x0001e, 0x0007e, 0x001fe, 0x007fd, 0x01ffb, 0x03ff9, 0x03ffc,
|
||||
0x07ffa, 0x0fff6, 0x1fff5, 0x3ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0,
|
||||
0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8,
|
||||
0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff,
|
||||
};
|
||||
|
||||
static const uint8_t f_huffman_env_3_0dB_bits[63] = {
|
||||
20, 20, 20, 20, 20, 20, 20, 18,
|
||||
19, 19, 19, 19, 18, 18, 20, 19,
|
||||
17, 18, 17, 16, 16, 15, 14, 12,
|
||||
11, 10, 9, 8, 6, 4, 2, 1,
|
||||
3, 5, 8, 9, 10, 11, 12, 13,
|
||||
14, 15, 15, 16, 16, 17, 17, 18,
|
||||
18, 18, 20, 19, 19, 19, 20, 19,
|
||||
19, 20, 20, 20, 20, 20, 20,
|
||||
};
|
||||
|
||||
static const uint32_t f_huffman_env_3_0dB_codes[63] = {
|
||||
0xffff0, 0xffff1, 0xffff2, 0xffff3, 0xffff4, 0xffff5, 0xffff6, 0x3fff3,
|
||||
0x7fff5, 0x7ffee, 0x7ffef, 0x7fff6, 0x3fff4, 0x3fff2, 0xffff7, 0x7fff0,
|
||||
0x1fff5, 0x3fff0, 0x1fff4, 0x0fff7, 0x0fff6, 0x07ff8, 0x03ffb, 0x00ffd,
|
||||
0x007fd, 0x003fd, 0x001fd, 0x000fd, 0x0003e, 0x0000e, 0x00002, 0x00000,
|
||||
0x00006, 0x0001e, 0x000fc, 0x001fc, 0x003fc, 0x007fc, 0x00ffc, 0x01ffc,
|
||||
0x03ffa, 0x07ff9, 0x07ffa, 0x0fff8, 0x0fff9, 0x1fff6, 0x1fff7, 0x3fff5,
|
||||
0x3fff6, 0x3fff1, 0xffff8, 0x7fff1, 0x7fff2, 0x7fff3, 0xffff9, 0x7fff7,
|
||||
0x7fff4, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff,
|
||||
};
|
||||
|
||||
static const uint8_t t_huffman_env_bal_3_0dB_bits[25] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 12,
|
||||
8, 7, 4, 3, 1, 2, 5, 6,
|
||||
9, 13, 13, 13, 13, 13, 13, 14,
|
||||
14,
|
||||
};
|
||||
|
||||
static const uint16_t t_huffman_env_bal_3_0dB_codes[25] = {
|
||||
0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x0ff8,
|
||||
0x00fe, 0x007e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x003e,
|
||||
0x01fe, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe,
|
||||
0x3fff,
|
||||
};
|
||||
|
||||
static const uint8_t f_huffman_env_bal_3_0dB_bits[25] = {
|
||||
13, 13, 13, 13, 13, 14, 14, 11,
|
||||
8, 7, 4, 2, 1, 3, 5, 6,
|
||||
9, 12, 13, 14, 14, 14, 14, 14,
|
||||
14,
|
||||
};
|
||||
|
||||
static const uint16_t f_huffman_env_bal_3_0dB_codes[25] = {
|
||||
0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x3ff8, 0x3ff9, 0x07fc,
|
||||
0x00fe, 0x007e, 0x000e, 0x0002, 0x0000, 0x0006, 0x001e, 0x003e,
|
||||
0x01fe, 0x0ffa, 0x1ff6, 0x3ffa, 0x3ffb, 0x3ffc, 0x3ffd, 0x3ffe,
|
||||
0x3fff,
|
||||
};
|
||||
|
||||
static const uint8_t t_huffman_noise_3_0dB_bits[63] = {
|
||||
13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 11, 8, 6, 4, 3, 1,
|
||||
2, 5, 8, 10, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 14, 14,
|
||||
};
|
||||
|
||||
static const uint16_t t_huffman_noise_3_0dB_codes[63] = {
|
||||
0x1fce, 0x1fcf, 0x1fd0, 0x1fd1, 0x1fd2, 0x1fd3, 0x1fd4, 0x1fd5,
|
||||
0x1fd6, 0x1fd7, 0x1fd8, 0x1fd9, 0x1fda, 0x1fdb, 0x1fdc, 0x1fdd,
|
||||
0x1fde, 0x1fdf, 0x1fe0, 0x1fe1, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe5,
|
||||
0x1fe6, 0x1fe7, 0x07f2, 0x00fd, 0x003e, 0x000e, 0x0006, 0x0000,
|
||||
0x0002, 0x001e, 0x00fc, 0x03f8, 0x1fcc, 0x1fe8, 0x1fe9, 0x1fea,
|
||||
0x1feb, 0x1fec, 0x1fcd, 0x1fed, 0x1fee, 0x1fef, 0x1ff0, 0x1ff1,
|
||||
0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x1ff9,
|
||||
0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff,
|
||||
};
|
||||
|
||||
static const uint8_t t_huffman_noise_bal_3_0dB_bits[25] = {
|
||||
8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 5, 2, 1, 3, 6, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8,
|
||||
};
|
||||
|
||||
static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = {
|
||||
0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
|
||||
0xf4, 0xf5, 0x1c, 0x02, 0x00, 0x06, 0x3a, 0xf6,
|
||||
0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
|
||||
0xff,
|
||||
};
|
||||
|
||||
static const int8_t sbr_offset[6][16] = {
|
||||
{-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, // fs_sbr = 16000 Hz
|
||||
{-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13}, // fs_sbr = 22050 Hz
|
||||
@@ -41,6 +268,271 @@ static const int8_t sbr_offset[6][16] = {
|
||||
{-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24}, // 64000 Hz < fs_sbr
|
||||
};
|
||||
|
||||
/* First eight entries repeated at end to simplify SIMD implementations. */
|
||||
const attribute_visibility_hidden DECLARE_ALIGNED(16, INTFLOAT, AAC_RENAME(ff_sbr_noise_table))[][2] = {
|
||||
{Q31(-0.99948153278296f), Q31(-0.59483417516607f)}, {Q31( 0.97113454393991f), Q31(-0.67528515225647f)},
|
||||
{Q31( 0.14130051758487f), Q31(-0.95090983575689f)}, {Q31(-0.47005496701697f), Q31(-0.37340549728647f)},
|
||||
{Q31( 0.80705063769351f), Q31( 0.29653668284408f)}, {Q31(-0.38981478896926f), Q31( 0.89572605717087f)},
|
||||
{Q31(-0.01053049862020f), Q31(-0.66959058036166f)}, {Q31(-0.91266367957293f), Q31(-0.11522938140034f)},
|
||||
{Q31( 0.54840422910309f), Q31( 0.75221367176302f)}, {Q31( 0.40009252867955f), Q31(-0.98929400334421f)},
|
||||
{Q31(-0.99867974711855f), Q31(-0.88147068645358f)}, {Q31(-0.95531076805040f), Q31( 0.90908757154593f)},
|
||||
{Q31(-0.45725933317144f), Q31(-0.56716323646760f)}, {Q31(-0.72929675029275f), Q31(-0.98008272727324f)},
|
||||
{Q31( 0.75622801399036f), Q31( 0.20950329995549f)}, {Q31( 0.07069442601050f), Q31(-0.78247898470706f)},
|
||||
{Q31( 0.74496252926055f), Q31(-0.91169004445807f)}, {Q31(-0.96440182703856f), Q31(-0.94739918296622f)},
|
||||
{Q31( 0.30424629369539f), Q31(-0.49438267012479f)}, {Q31( 0.66565033746925f), Q31( 0.64652935542491f)},
|
||||
{Q31( 0.91697008020594f), Q31( 0.17514097332009f)}, {Q31(-0.70774918760427f), Q31( 0.52548653416543f)},
|
||||
{Q31(-0.70051415345560f), Q31(-0.45340028808763f)}, {Q31(-0.99496513054797f), Q31(-0.90071908066973f)},
|
||||
{Q31( 0.98164490790123f), Q31(-0.77463155528697f)}, {Q31(-0.54671580548181f), Q31(-0.02570928536004f)},
|
||||
{Q31(-0.01689629065389f), Q31( 0.00287506445732f)}, {Q31(-0.86110349531986f), Q31( 0.42548583726477f)},
|
||||
{Q31(-0.98892980586032f), Q31(-0.87881132267556f)}, {Q31( 0.51756627678691f), Q31( 0.66926784710139f)},
|
||||
{Q31(-0.99635026409640f), Q31(-0.58107730574765f)}, {Q31(-0.99969370862163f), Q31( 0.98369989360250f)},
|
||||
{Q31( 0.55266258627194f), Q31( 0.59449057465591f)}, {Q31( 0.34581177741673f), Q31( 0.94879421061866f)},
|
||||
{Q31( 0.62664209577999f), Q31(-0.74402970906471f)}, {Q31(-0.77149701404973f), Q31(-0.33883658042801f)},
|
||||
{Q31(-0.91592244254432f), Q31( 0.03687901376713f)}, {Q31(-0.76285492357887f), Q31(-0.91371867919124f)},
|
||||
{Q31( 0.79788337195331f), Q31(-0.93180971199849f)}, {Q31( 0.54473080610200f), Q31(-0.11919206037186f)},
|
||||
{Q31(-0.85639281671058f), Q31( 0.42429854760451f)}, {Q31(-0.92882402971423f), Q31( 0.27871809078609f)},
|
||||
{Q31(-0.11708371046774f), Q31(-0.99800843444966f)}, {Q31( 0.21356749817493f), Q31(-0.90716295627033f)},
|
||||
{Q31(-0.76191692573909f), Q31( 0.99768118356265f)}, {Q31( 0.98111043100884f), Q31(-0.95854459734407f)},
|
||||
{Q31(-0.85913269895572f), Q31( 0.95766566168880f)}, {Q31(-0.93307242253692f), Q31( 0.49431757696466f)},
|
||||
{Q31( 0.30485754879632f), Q31(-0.70540034357529f)}, {Q31( 0.85289650925190f), Q31( 0.46766131791044f)},
|
||||
{Q31( 0.91328082618125f), Q31(-0.99839597361769f)}, {Q31(-0.05890199924154f), Q31( 0.70741827819497f)},
|
||||
{Q31( 0.28398686150148f), Q31( 0.34633555702188f)}, {Q31( 0.95258164539612f), Q31(-0.54893416026939f)},
|
||||
{Q31(-0.78566324168507f), Q31(-0.75568541079691f)}, {Q31(-0.95789495447877f), Q31(-0.20423194696966f)},
|
||||
{Q31( 0.82411158711197f), Q31( 0.96654618432562f)}, {Q31(-0.65185446735885f), Q31(-0.88734990773289f)},
|
||||
{Q31(-0.93643603134666f), Q31( 0.99870790442385f)}, {Q31( 0.91427159529618f), Q31(-0.98290505544444f)},
|
||||
{Q31(-0.70395684036886f), Q31( 0.58796798221039f)}, {Q31( 0.00563771969365f), Q31( 0.61768196727244f)},
|
||||
{Q31( 0.89065051931895f), Q31( 0.52783352697585f)}, {Q31(-0.68683707712762f), Q31( 0.80806944710339f)},
|
||||
{Q31( 0.72165342518718f), Q31(-0.69259857349564f)}, {Q31(-0.62928247730667f), Q31( 0.13627037407335f)},
|
||||
{Q31( 0.29938434065514f), Q31(-0.46051329682246f)}, {Q31(-0.91781958879280f), Q31(-0.74012716684186f)},
|
||||
{Q31( 0.99298717043688f), Q31( 0.40816610075661f)}, {Q31( 0.82368298622748f), Q31(-0.74036047190173f)},
|
||||
{Q31(-0.98512833386833f), Q31(-0.99972330709594f)}, {Q31(-0.95915368242257f), Q31(-0.99237800466040f)},
|
||||
{Q31(-0.21411126572790f), Q31(-0.93424819052545f)}, {Q31(-0.68821476106884f), Q31(-0.26892306315457f)},
|
||||
{Q31( 0.91851997982317f), Q31( 0.09358228901785f)}, {Q31(-0.96062769559127f), Q31( 0.36099095133739f)},
|
||||
{Q31( 0.51646184922287f), Q31(-0.71373332873917f)}, {Q31( 0.61130721139669f), Q31( 0.46950141175917f)},
|
||||
{Q31( 0.47336129371299f), Q31(-0.27333178296162f)}, {Q31( 0.90998308703519f), Q31( 0.96715662938132f)},
|
||||
{Q31( 0.44844799194357f), Q31( 0.99211574628306f)}, {Q31( 0.66614891079092f), Q31( 0.96590176169121f)},
|
||||
{Q31( 0.74922239129237f), Q31(-0.89879858826087f)}, {Q31(-0.99571588506485f), Q31( 0.52785521494349f)},
|
||||
{Q31( 0.97401082477563f), Q31(-0.16855870075190f)}, {Q31( 0.72683747733879f), Q31(-0.48060774432251f)},
|
||||
{Q31( 0.95432193457128f), Q31( 0.68849603408441f)}, {Q31(-0.72962208425191f), Q31(-0.76608443420917f)},
|
||||
{Q31(-0.85359479233537f), Q31( 0.88738125901579f)}, {Q31(-0.81412430338535f), Q31(-0.97480768049637f)},
|
||||
{Q31(-0.87930772356786f), Q31( 0.74748307690436f)}, {Q31(-0.71573331064977f), Q31(-0.98570608178923f)},
|
||||
{Q31( 0.83524300028228f), Q31( 0.83702537075163f)}, {Q31(-0.48086065601423f), Q31(-0.98848504923531f)},
|
||||
{Q31( 0.97139128574778f), Q31( 0.80093621198236f)}, {Q31( 0.51992825347895f), Q31( 0.80247631400510f)},
|
||||
{Q31(-0.00848591195325f), Q31(-0.76670128000486f)}, {Q31(-0.70294374303036f), Q31( 0.55359910445577f)},
|
||||
{Q31(-0.95894428168140f), Q31(-0.43265504344783f)}, {Q31( 0.97079252950321f), Q31( 0.09325857238682f)},
|
||||
{Q31(-0.92404293670797f), Q31( 0.85507704027855f)}, {Q31(-0.69506469500450f), Q31( 0.98633412625459f)},
|
||||
{Q31( 0.26559203620024f), Q31( 0.73314307966524f)}, {Q31( 0.28038443336943f), Q31( 0.14537913654427f)},
|
||||
{Q31(-0.74138124825523f), Q31( 0.99310339807762f)}, {Q31(-0.01752795995444f), Q31(-0.82616635284178f)},
|
||||
{Q31(-0.55126773094930f), Q31(-0.98898543862153f)}, {Q31( 0.97960898850996f), Q31(-0.94021446752851f)},
|
||||
{Q31(-0.99196309146936f), Q31( 0.67019017358456f)}, {Q31(-0.67684928085260f), Q31( 0.12631491649378f)},
|
||||
{Q31( 0.09140039465500f), Q31(-0.20537731453108f)}, {Q31(-0.71658965751996f), Q31(-0.97788200391224f)},
|
||||
{Q31( 0.81014640078925f), Q31( 0.53722648362443f)}, {Q31( 0.40616991671205f), Q31(-0.26469008598449f)},
|
||||
{Q31(-0.67680188682972f), Q31( 0.94502052337695f)}, {Q31( 0.86849774348749f), Q31(-0.18333598647899f)},
|
||||
{Q31(-0.99500381284851f), Q31(-0.02634122068550f)}, {Q31( 0.84329189340667f), Q31( 0.10406957462213f)},
|
||||
{Q31(-0.09215968531446f), Q31( 0.69540012101253f)}, {Q31( 0.99956173327206f), Q31(-0.12358542001404f)},
|
||||
{Q31(-0.79732779473535f), Q31(-0.91582524736159f)}, {Q31( 0.96349973642406f), Q31( 0.96640458041000f)},
|
||||
{Q31(-0.79942778496547f), Q31( 0.64323902822857f)}, {Q31(-0.11566039853896f), Q31( 0.28587846253726f)},
|
||||
{Q31(-0.39922954514662f), Q31( 0.94129601616966f)}, {Q31( 0.99089197565987f), Q31(-0.92062625581587f)},
|
||||
{Q31( 0.28631285179909f), Q31(-0.91035047143603f)}, {Q31(-0.83302725605608f), Q31(-0.67330410892084f)},
|
||||
{Q31( 0.95404443402072f), Q31( 0.49162765398743f)}, {Q31(-0.06449863579434f), Q31( 0.03250560813135f)},
|
||||
{Q31(-0.99575054486311f), Q31( 0.42389784469507f)}, {Q31(-0.65501142790847f), Q31( 0.82546114655624f)},
|
||||
{Q31(-0.81254441908887f), Q31(-0.51627234660629f)}, {Q31(-0.99646369485481f), Q31( 0.84490533520752f)},
|
||||
{Q31( 0.00287840603348f), Q31( 0.64768261158166f)}, {Q31( 0.70176989408455f), Q31(-0.20453028573322f)},
|
||||
{Q31( 0.96361882270190f), Q31( 0.40706967140989f)}, {Q31(-0.68883758192426f), Q31( 0.91338958840772f)},
|
||||
{Q31(-0.34875585502238f), Q31( 0.71472290693300f)}, {Q31( 0.91980081243087f), Q31( 0.66507455644919f)},
|
||||
{Q31(-0.99009048343881f), Q31( 0.85868021604848f)}, {Q31( 0.68865791458395f), Q31( 0.55660316809678f)},
|
||||
{Q31(-0.99484402129368f), Q31(-0.20052559254934f)}, {Q31( 0.94214511408023f), Q31(-0.99696425367461f)},
|
||||
{Q31(-0.67414626793544f), Q31( 0.49548221180078f)}, {Q31(-0.47339353684664f), Q31(-0.85904328834047f)},
|
||||
{Q31( 0.14323651387360f), Q31(-0.94145598222488f)}, {Q31(-0.29268293575672f), Q31( 0.05759224927952f)},
|
||||
{Q31( 0.43793861458754f), Q31(-0.78904969892724f)}, {Q31(-0.36345126374441f), Q31( 0.64874435357162f)},
|
||||
{Q31(-0.08750604656825f), Q31( 0.97686944362527f)}, {Q31(-0.96495267812511f), Q31(-0.53960305946511f)},
|
||||
{Q31( 0.55526940659947f), Q31( 0.78891523734774f)}, {Q31( 0.73538215752630f), Q31( 0.96452072373404f)},
|
||||
{Q31(-0.30889773919437f), Q31(-0.80664389776860f)}, {Q31( 0.03574995626194f), Q31(-0.97325616900959f)},
|
||||
{Q31( 0.98720684660488f), Q31( 0.48409133691962f)}, {Q31(-0.81689296271203f), Q31(-0.90827703628298f)},
|
||||
{Q31( 0.67866860118215f), Q31( 0.81284503870856f)}, {Q31(-0.15808569732583f), Q31( 0.85279555024382f)},
|
||||
{Q31( 0.80723395114371f), Q31(-0.24717418514605f)}, {Q31( 0.47788757329038f), Q31(-0.46333147839295f)},
|
||||
{Q31( 0.96367554763201f), Q31( 0.38486749303242f)}, {Q31(-0.99143875716818f), Q31(-0.24945277239809f)},
|
||||
{Q31( 0.83081876925833f), Q31(-0.94780851414763f)}, {Q31(-0.58753191905341f), Q31( 0.01290772389163f)},
|
||||
{Q31( 0.95538108220960f), Q31(-0.85557052096538f)}, {Q31(-0.96490920476211f), Q31(-0.64020970923102f)},
|
||||
{Q31(-0.97327101028521f), Q31( 0.12378128133110f)}, {Q31( 0.91400366022124f), Q31( 0.57972471346930f)},
|
||||
{Q31(-0.99925837363824f), Q31( 0.71084847864067f)}, {Q31(-0.86875903507313f), Q31(-0.20291699203564f)},
|
||||
{Q31(-0.26240034795124f), Q31(-0.68264554369108f)}, {Q31(-0.24664412953388f), Q31(-0.87642273115183f)},
|
||||
{Q31( 0.02416275806869f), Q31( 0.27192914288905f)}, {Q31( 0.82068619590515f), Q31(-0.85087787994476f)},
|
||||
{Q31( 0.88547373760759f), Q31(-0.89636802901469f)}, {Q31(-0.18173078152226f), Q31(-0.26152145156800f)},
|
||||
{Q31( 0.09355476558534f), Q31( 0.54845123045604f)}, {Q31(-0.54668414224090f), Q31( 0.95980774020221f)},
|
||||
{Q31( 0.37050990604091f), Q31(-0.59910140383171f)}, {Q31(-0.70373594262891f), Q31( 0.91227665827081f)},
|
||||
{Q31(-0.34600785879594f), Q31(-0.99441426144200f)}, {Q31(-0.68774481731008f), Q31(-0.30238837956299f)},
|
||||
{Q31(-0.26843291251234f), Q31( 0.83115668004362f)}, {Q31( 0.49072334613242f), Q31(-0.45359708737775f)},
|
||||
{Q31( 0.38975993093975f), Q31( 0.95515358099121f)}, {Q31(-0.97757125224150f), Q31( 0.05305894580606f)},
|
||||
{Q31(-0.17325552859616f), Q31(-0.92770672250494f)}, {Q31( 0.99948035025744f), Q31( 0.58285545563426f)},
|
||||
{Q31(-0.64946246527458f), Q31( 0.68645507104960f)}, {Q31(-0.12016920576437f), Q31(-0.57147322153312f)},
|
||||
{Q31(-0.58947456517751f), Q31(-0.34847132454388f)}, {Q31(-0.41815140454465f), Q31( 0.16276422358861f)},
|
||||
{Q31( 0.99885650204884f), Q31( 0.11136095490444f)}, {Q31(-0.56649614128386f), Q31(-0.90494866361587f)},
|
||||
{Q31( 0.94138021032330f), Q31( 0.35281916733018f)}, {Q31(-0.75725076534641f), Q31( 0.53650549640587f)},
|
||||
{Q31( 0.20541973692630f), Q31(-0.94435144369918f)}, {Q31( 0.99980371023351f), Q31( 0.79835913565599f)},
|
||||
{Q31( 0.29078277605775f), Q31( 0.35393777921520f)}, {Q31(-0.62858772103030f), Q31( 0.38765693387102f)},
|
||||
{Q31( 0.43440904467688f), Q31(-0.98546330463232f)}, {Q31(-0.98298583762390f), Q31( 0.21021524625209f)},
|
||||
{Q31( 0.19513029146934f), Q31(-0.94239832251867f)}, {Q31(-0.95476662400101f), Q31( 0.98364554179143f)},
|
||||
{Q31( 0.93379635304810f), Q31(-0.70881994583682f)}, {Q31(-0.85235410573336f), Q31(-0.08342347966410f)},
|
||||
{Q31(-0.86425093011245f), Q31(-0.45795025029466f)}, {Q31( 0.38879779059045f), Q31( 0.97274429344593f)},
|
||||
{Q31( 0.92045124735495f), Q31(-0.62433652524220f)}, {Q31( 0.89162532251878f), Q31( 0.54950955570563f)},
|
||||
{Q31(-0.36834336949252f), Q31( 0.96458298020975f)}, {Q31( 0.93891760988045f), Q31(-0.89968353740388f)},
|
||||
{Q31( 0.99267657565094f), Q31(-0.03757034316958f)}, {Q31(-0.94063471614176f), Q31( 0.41332338538963f)},
|
||||
{Q31( 0.99740224117019f), Q31(-0.16830494996370f)}, {Q31(-0.35899413170555f), Q31(-0.46633226649613f)},
|
||||
{Q31( 0.05237237274947f), Q31(-0.25640361602661f)}, {Q31( 0.36703583957424f), Q31(-0.38653265641875f)},
|
||||
{Q31( 0.91653180367913f), Q31(-0.30587628726597f)}, {Q31( 0.69000803499316f), Q31( 0.90952171386132f)},
|
||||
{Q31(-0.38658751133527f), Q31( 0.99501571208985f)}, {Q31(-0.29250814029851f), Q31( 0.37444994344615f)},
|
||||
{Q31(-0.60182204677608f), Q31( 0.86779651036123f)}, {Q31(-0.97418588163217f), Q31( 0.96468523666475f)},
|
||||
{Q31( 0.88461574003963f), Q31( 0.57508405276414f)}, {Q31( 0.05198933055162f), Q31( 0.21269661669964f)},
|
||||
{Q31(-0.53499621979720f), Q31( 0.97241553731237f)}, {Q31(-0.49429560226497f), Q31( 0.98183865291903f)},
|
||||
{Q31(-0.98935142339139f), Q31(-0.40249159006933f)}, {Q31(-0.98081380091130f), Q31(-0.72856895534041f)},
|
||||
{Q31(-0.27338148835532f), Q31( 0.99950922447209f)}, {Q31( 0.06310802338302f), Q31(-0.54539587529618f)},
|
||||
{Q31(-0.20461677199539f), Q31(-0.14209977628489f)}, {Q31( 0.66223843141647f), Q31( 0.72528579940326f)},
|
||||
{Q31(-0.84764345483665f), Q31( 0.02372316801261f)}, {Q31(-0.89039863483811f), Q31( 0.88866581484602f)},
|
||||
{Q31( 0.95903308477986f), Q31( 0.76744927173873f)}, {Q31( 0.73504123909879f), Q31(-0.03747203173192f)},
|
||||
{Q31(-0.31744434966056f), Q31(-0.36834111883652f)}, {Q31(-0.34110827591623f), Q31( 0.40211222807691f)},
|
||||
{Q31( 0.47803883714199f), Q31(-0.39423219786288f)}, {Q31( 0.98299195879514f), Q31( 0.01989791390047f)},
|
||||
{Q31(-0.30963073129751f), Q31(-0.18076720599336f)}, {Q31( 0.99992588229018f), Q31(-0.26281872094289f)},
|
||||
{Q31(-0.93149731080767f), Q31(-0.98313162570490f)}, {Q31( 0.99923472302773f), Q31(-0.80142993767554f)},
|
||||
{Q31(-0.26024169633417f), Q31(-0.75999759855752f)}, {Q31(-0.35712514743563f), Q31( 0.19298963768574f)},
|
||||
{Q31(-0.99899084509530f), Q31( 0.74645156992493f)}, {Q31( 0.86557171579452f), Q31( 0.55593866696299f)},
|
||||
{Q31( 0.33408042438752f), Q31( 0.86185953874709f)}, {Q31( 0.99010736374716f), Q31( 0.04602397576623f)},
|
||||
{Q31(-0.66694269691195f), Q31(-0.91643611810148f)}, {Q31( 0.64016792079480f), Q31( 0.15649530836856f)},
|
||||
{Q31( 0.99570534804836f), Q31( 0.45844586038111f)}, {Q31(-0.63431466947340f), Q31( 0.21079116459234f)},
|
||||
{Q31(-0.07706847005931f), Q31(-0.89581437101329f)}, {Q31( 0.98590090577724f), Q31( 0.88241721133981f)},
|
||||
{Q31( 0.80099335254678f), Q31(-0.36851896710853f)}, {Q31( 0.78368131392666f), Q31( 0.45506999802597f)},
|
||||
{Q31( 0.08707806671691f), Q31( 0.80938994918745f)}, {Q31(-0.86811883080712f), Q31( 0.39347308654705f)},
|
||||
{Q31(-0.39466529740375f), Q31(-0.66809432114456f)}, {Q31( 0.97875325649683f), Q31(-0.72467840967746f)},
|
||||
{Q31(-0.95038560288864f), Q31( 0.89563219587625f)}, {Q31( 0.17005239424212f), Q31( 0.54683053962658f)},
|
||||
{Q31(-0.76910792026848f), Q31(-0.96226617549298f)}, {Q31( 0.99743281016846f), Q31( 0.42697157037567f)},
|
||||
{Q31( 0.95437383549973f), Q31( 0.97002324109952f)}, {Q31( 0.99578905365569f), Q31(-0.54106826257356f)},
|
||||
{Q31( 0.28058259829990f), Q31(-0.85361420634036f)}, {Q31( 0.85256524470573f), Q31(-0.64567607735589f)},
|
||||
{Q31(-0.50608540105128f), Q31(-0.65846015480300f)}, {Q31(-0.97210735183243f), Q31(-0.23095213067791f)},
|
||||
{Q31( 0.95424048234441f), Q31(-0.99240147091219f)}, {Q31(-0.96926570524023f), Q31( 0.73775654896574f)},
|
||||
{Q31( 0.30872163214726f), Q31( 0.41514960556126f)}, {Q31(-0.24523839572639f), Q31( 0.63206633394807f)},
|
||||
{Q31(-0.33813265086024f), Q31(-0.38661779441897f)}, {Q31(-0.05826828420146f), Q31(-0.06940774188029f)},
|
||||
{Q31(-0.22898461455054f), Q31( 0.97054853316316f)}, {Q31(-0.18509915019881f), Q31( 0.47565762892084f)},
|
||||
{Q31(-0.10488238045009f), Q31(-0.87769947402394f)}, {Q31(-0.71886586182037f), Q31( 0.78030982480538f)},
|
||||
{Q31( 0.99793873738654f), Q31( 0.90041310491497f)}, {Q31( 0.57563307626120f), Q31(-0.91034337352097f)},
|
||||
{Q31( 0.28909646383717f), Q31( 0.96307783970534f)}, {Q31( 0.42188998312520f), Q31( 0.48148651230437f)},
|
||||
{Q31( 0.93335049681047f), Q31(-0.43537023883588f)}, {Q31(-0.97087374418267f), Q31( 0.86636445711364f)},
|
||||
{Q31( 0.36722871286923f), Q31( 0.65291654172961f)}, {Q31(-0.81093025665696f), Q31( 0.08778370229363f)},
|
||||
{Q31(-0.26240603062237f), Q31(-0.92774095379098f)}, {Q31( 0.83996497984604f), Q31( 0.55839849139647f)},
|
||||
{Q31(-0.99909615720225f), Q31(-0.96024605713970f)}, {Q31( 0.74649464155061f), Q31( 0.12144893606462f)},
|
||||
{Q31(-0.74774595569805f), Q31(-0.26898062008959f)}, {Q31( 0.95781667469567f), Q31(-0.79047927052628f)},
|
||||
{Q31( 0.95472308713099f), Q31(-0.08588776019550f)}, {Q31( 0.48708332746299f), Q31( 0.99999041579432f)},
|
||||
{Q31( 0.46332038247497f), Q31( 0.10964126185063f)}, {Q31(-0.76497004940162f), Q31( 0.89210929242238f)},
|
||||
{Q31( 0.57397389364339f), Q31( 0.35289703373760f)}, {Q31( 0.75374316974495f), Q31( 0.96705214651335f)},
|
||||
{Q31(-0.59174397685714f), Q31(-0.89405370422752f)}, {Q31( 0.75087906691890f), Q31(-0.29612672982396f)},
|
||||
{Q31(-0.98607857336230f), Q31( 0.25034911730023f)}, {Q31(-0.40761056640505f), Q31(-0.90045573444695f)},
|
||||
{Q31( 0.66929266740477f), Q31( 0.98629493401748f)}, {Q31(-0.97463695257310f), Q31(-0.00190223301301f)},
|
||||
{Q31( 0.90145509409859f), Q31( 0.99781390365446f)}, {Q31(-0.87259289048043f), Q31( 0.99233587353666f)},
|
||||
{Q31(-0.91529461447692f), Q31(-0.15698707534206f)}, {Q31(-0.03305738840705f), Q31(-0.37205262859764f)},
|
||||
{Q31( 0.07223051368337f), Q31(-0.88805001733626f)}, {Q31( 0.99498012188353f), Q31( 0.97094358113387f)},
|
||||
{Q31(-0.74904939500519f), Q31( 0.99985483641521f)}, {Q31( 0.04585228574211f), Q31( 0.99812337444082f)},
|
||||
{Q31(-0.89054954257993f), Q31(-0.31791913188064f)}, {Q31(-0.83782144651251f), Q31( 0.97637632547466f)},
|
||||
{Q31( 0.33454804933804f), Q31(-0.86231516800408f)}, {Q31(-0.99707579362824f), Q31( 0.93237990079441f)},
|
||||
{Q31(-0.22827527843994f), Q31( 0.18874759397997f)}, {Q31( 0.67248046289143f), Q31(-0.03646211390569f)},
|
||||
{Q31(-0.05146538187944f), Q31(-0.92599700120679f)}, {Q31( 0.99947295749905f), Q31( 0.93625229707912f)},
|
||||
{Q31( 0.66951124390363f), Q31( 0.98905825623893f)}, {Q31(-0.99602956559179f), Q31(-0.44654715757688f)},
|
||||
{Q31( 0.82104905483590f), Q31( 0.99540741724928f)}, {Q31( 0.99186510988782f), Q31( 0.72023001312947f)},
|
||||
{Q31(-0.65284592392918f), Q31( 0.52186723253637f)}, {Q31( 0.93885443798188f), Q31(-0.74895312615259f)},
|
||||
{Q31( 0.96735248738388f), Q31( 0.90891816978629f)}, {Q31(-0.22225968841114f), Q31( 0.57124029781228f)},
|
||||
{Q31(-0.44132783753414f), Q31(-0.92688840659280f)}, {Q31(-0.85694974219574f), Q31( 0.88844532719844f)},
|
||||
{Q31( 0.91783042091762f), Q31(-0.46356892383970f)}, {Q31( 0.72556974415690f), Q31(-0.99899555770747f)},
|
||||
{Q31(-0.99711581834508f), Q31( 0.58211560180426f)}, {Q31( 0.77638976371966f), Q31( 0.94321834873819f)},
|
||||
{Q31( 0.07717324253925f), Q31( 0.58638399856595f)}, {Q31(-0.56049829194163f), Q31( 0.82522301569036f)},
|
||||
{Q31( 0.98398893639988f), Q31( 0.39467440420569f)}, {Q31( 0.47546946844938f), Q31( 0.68613044836811f)},
|
||||
{Q31( 0.65675089314631f), Q31( 0.18331637134880f)}, {Q31( 0.03273375457980f), Q31(-0.74933109564108f)},
|
||||
{Q31(-0.38684144784738f), Q31( 0.51337349030406f)}, {Q31(-0.97346267944545f), Q31(-0.96549364384098f)},
|
||||
{Q31(-0.53282156061942f), Q31(-0.91423265091354f)}, {Q31( 0.99817310731176f), Q31( 0.61133572482148f)},
|
||||
{Q31(-0.50254500772635f), Q31(-0.88829338134294f)}, {Q31( 0.01995873238855f), Q31( 0.85223515096765f)},
|
||||
{Q31( 0.99930381973804f), Q31( 0.94578896296649f)}, {Q31( 0.82907767600783f), Q31(-0.06323442598128f)},
|
||||
{Q31(-0.58660709669728f), Q31( 0.96840773806582f)}, {Q31(-0.17573736667267f), Q31(-0.48166920859485f)},
|
||||
{Q31( 0.83434292401346f), Q31(-0.13023450646997f)}, {Q31( 0.05946491307025f), Q31( 0.20511047074866f)},
|
||||
{Q31( 0.81505484574602f), Q31(-0.94685947861369f)}, {Q31(-0.44976380954860f), Q31( 0.40894572671545f)},
|
||||
{Q31(-0.89746474625671f), Q31( 0.99846578838537f)}, {Q31( 0.39677256130792f), Q31(-0.74854668609359f)},
|
||||
{Q31(-0.07588948563079f), Q31( 0.74096214084170f)}, {Q31( 0.76343198951445f), Q31( 0.41746629422634f)},
|
||||
{Q31(-0.74490104699626f), Q31( 0.94725911744610f)}, {Q31( 0.64880119792759f), Q31( 0.41336660830571f)},
|
||||
{Q31( 0.62319537462542f), Q31(-0.93098313552599f)}, {Q31( 0.42215817594807f), Q31(-0.07712787385208f)},
|
||||
{Q31( 0.02704554141885f), Q31(-0.05417518053666f)}, {Q31( 0.80001773566818f), Q31( 0.91542195141039f)},
|
||||
{Q31(-0.79351832348816f), Q31(-0.36208897989136f)}, {Q31( 0.63872359151636f), Q31( 0.08128252493444f)},
|
||||
{Q31( 0.52890520960295f), Q31( 0.60048872455592f)}, {Q31( 0.74238552914587f), Q31( 0.04491915291044f)},
|
||||
{Q31( 0.99096131449250f), Q31(-0.19451182854402f)}, {Q31(-0.80412329643109f), Q31(-0.88513818199457f)},
|
||||
{Q31(-0.64612616129736f), Q31( 0.72198674804544f)}, {Q31( 0.11657770663191f), Q31(-0.83662833815041f)},
|
||||
{Q31(-0.95053182488101f), Q31(-0.96939905138082f)}, {Q31(-0.62228872928622f), Q31( 0.82767262846661f)},
|
||||
{Q31( 0.03004475787316f), Q31(-0.99738896333384f)}, {Q31(-0.97987214341034f), Q31( 0.36526129686425f)},
|
||||
{Q31(-0.99986980746200f), Q31(-0.36021610299715f)}, {Q31( 0.89110648599879f), Q31(-0.97894250343044f)},
|
||||
{Q31( 0.10407960510582f), Q31( 0.77357793811619f)}, {Q31( 0.95964737821728f), Q31(-0.35435818285502f)},
|
||||
{Q31( 0.50843233159162f), Q31( 0.96107691266205f)}, {Q31( 0.17006334670615f), Q31(-0.76854025314829f)},
|
||||
{Q31( 0.25872675063360f), Q31( 0.99893303933816f)}, {Q31(-0.01115998681937f), Q31( 0.98496019742444f)},
|
||||
{Q31(-0.79598702973261f), Q31( 0.97138411318894f)}, {Q31(-0.99264708948101f), Q31(-0.99542822402536f)},
|
||||
{Q31(-0.99829663752818f), Q31( 0.01877138824311f)}, {Q31(-0.70801016548184f), Q31( 0.33680685948117f)},
|
||||
{Q31(-0.70467057786826f), Q31( 0.93272777501857f)}, {Q31( 0.99846021905254f), Q31(-0.98725746254433f)},
|
||||
{Q31(-0.63364968534650f), Q31(-0.16473594423746f)}, {Q31(-0.16258217500792f), Q31(-0.95939125400802f)},
|
||||
{Q31(-0.43645594360633f), Q31(-0.94805030113284f)}, {Q31(-0.99848471702976f), Q31( 0.96245166923809f)},
|
||||
{Q31(-0.16796458968998f), Q31(-0.98987511890470f)}, {Q31(-0.87979225745213f), Q31(-0.71725725041680f)},
|
||||
{Q31( 0.44183099021786f), Q31(-0.93568974498761f)}, {Q31( 0.93310180125532f), Q31(-0.99913308068246f)},
|
||||
{Q31(-0.93941931782002f), Q31(-0.56409379640356f)}, {Q31(-0.88590003188677f), Q31( 0.47624600491382f)},
|
||||
{Q31( 0.99971463703691f), Q31(-0.83889954253462f)}, {Q31(-0.75376385639978f), Q31( 0.00814643438625f)},
|
||||
{Q31( 0.93887685615875f), Q31(-0.11284528204636f)}, {Q31( 0.85126435782309f), Q31( 0.52349251543547f)},
|
||||
{Q31( 0.39701421446381f), Q31( 0.81779634174316f)}, {Q31(-0.37024464187437f), Q31(-0.87071656222959f)},
|
||||
{Q31(-0.36024828242896f), Q31( 0.34655735648287f)}, {Q31(-0.93388812549209f), Q31(-0.84476541096429f)},
|
||||
{Q31(-0.65298804552119f), Q31(-0.18439575450921f)}, {Q31( 0.11960319006843f), Q31( 0.99899346780168f)},
|
||||
{Q31( 0.94292565553160f), Q31( 0.83163906518293f)}, {Q31( 0.75081145286948f), Q31(-0.35533223142265f)},
|
||||
{Q31( 0.56721979748394f), Q31(-0.24076836414499f)}, {Q31( 0.46857766746029f), Q31(-0.30140233457198f)},
|
||||
{Q31( 0.97312313923635f), Q31(-0.99548191630031f)}, {Q31(-0.38299976567017f), Q31( 0.98516909715427f)},
|
||||
{Q31( 0.41025800019463f), Q31( 0.02116736935734f)}, {Q31( 0.09638062008048f), Q31( 0.04411984381457f)},
|
||||
{Q31(-0.85283249275397f), Q31( 0.91475563922421f)}, {Q31( 0.88866808958124f), Q31(-0.99735267083226f)},
|
||||
{Q31(-0.48202429536989f), Q31(-0.96805608884164f)}, {Q31( 0.27572582416567f), Q31( 0.58634753335832f)},
|
||||
{Q31(-0.65889129659168f), Q31( 0.58835634138583f)}, {Q31( 0.98838086953732f), Q31( 0.99994349600236f)},
|
||||
{Q31(-0.20651349620689f), Q31( 0.54593044066355f)}, {Q31(-0.62126416356920f), Q31(-0.59893681700392f)},
|
||||
{Q31( 0.20320105410437f), Q31(-0.86879180355289f)}, {Q31(-0.97790548600584f), Q31( 0.96290806999242f)},
|
||||
{Q31( 0.11112534735126f), Q31( 0.21484763313301f)}, {Q31(-0.41368337314182f), Q31( 0.28216837680365f)},
|
||||
{Q31( 0.24133038992960f), Q31( 0.51294362630238f)}, {Q31(-0.66393410674885f), Q31(-0.08249679629081f)},
|
||||
{Q31(-0.53697829178752f), Q31(-0.97649903936228f)}, {Q31(-0.97224737889348f), Q31( 0.22081333579837f)},
|
||||
{Q31( 0.87392477144549f), Q31(-0.12796173740361f)}, {Q31( 0.19050361015753f), Q31( 0.01602615387195f)},
|
||||
{Q31(-0.46353441212724f), Q31(-0.95249041539006f)}, {Q31(-0.07064096339021f), Q31(-0.94479803205886f)},
|
||||
{Q31(-0.92444085484466f), Q31(-0.10457590187436f)}, {Q31(-0.83822593578728f), Q31(-0.01695043208885f)},
|
||||
{Q31( 0.75214681811150f), Q31(-0.99955681042665f)}, {Q31(-0.42102998829339f), Q31( 0.99720941999394f)},
|
||||
{Q31(-0.72094786237696f), Q31(-0.35008961934255f)}, {Q31( 0.78843311019251f), Q31( 0.52851398958271f)},
|
||||
{Q31( 0.97394027897442f), Q31(-0.26695944086561f)}, {Q31( 0.99206463477946f), Q31(-0.57010120849429f)},
|
||||
{Q31( 0.76789609461795f), Q31(-0.76519356730966f)}, {Q31(-0.82002421836409f), Q31(-0.73530179553767f)},
|
||||
{Q31( 0.81924990025724f), Q31( 0.99698425250579f)}, {Q31(-0.26719850873357f), Q31( 0.68903369776193f)},
|
||||
{Q31(-0.43311260380975f), Q31( 0.85321815947490f)}, {Q31( 0.99194979673836f), Q31( 0.91876249766422f)},
|
||||
{Q31(-0.80692001248487f), Q31(-0.32627540663214f)}, {Q31( 0.43080003649976f), Q31(-0.21919095636638f)},
|
||||
{Q31( 0.67709491937357f), Q31(-0.95478075822906f)}, {Q31( 0.56151770568316f), Q31(-0.70693811747778f)},
|
||||
{Q31( 0.10831862810749f), Q31(-0.08628837174592f)}, {Q31( 0.91229417540436f), Q31(-0.65987351408410f)},
|
||||
{Q31(-0.48972893932274f), Q31( 0.56289246362686f)}, {Q31(-0.89033658689697f), Q31(-0.71656563987082f)},
|
||||
{Q31( 0.65269447475094f), Q31( 0.65916004833932f)}, {Q31( 0.67439478141121f), Q31(-0.81684380846796f)},
|
||||
{Q31(-0.47770832416973f), Q31(-0.16789556203025f)}, {Q31(-0.99715979260878f), Q31(-0.93565784007648f)},
|
||||
{Q31(-0.90889593602546f), Q31( 0.62034397054380f)}, {Q31(-0.06618622548177f), Q31(-0.23812217221359f)},
|
||||
{Q31( 0.99430266919728f), Q31( 0.18812555317553f)}, {Q31( 0.97686402381843f), Q31(-0.28664534366620f)},
|
||||
{Q31( 0.94813650221268f), Q31(-0.97506640027128f)}, {Q31(-0.95434497492853f), Q31(-0.79607978501983f)},
|
||||
{Q31(-0.49104783137150f), Q31( 0.32895214359663f)}, {Q31( 0.99881175120751f), Q31( 0.88993983831354f)},
|
||||
{Q31( 0.50449166760303f), Q31(-0.85995072408434f)}, {Q31( 0.47162891065108f), Q31(-0.18680204049569f)},
|
||||
{Q31(-0.62081581361840f), Q31( 0.75000676218956f)}, {Q31(-0.43867015250812f), Q31( 0.99998069244322f)},
|
||||
{Q31( 0.98630563232075f), Q31(-0.53578899600662f)}, {Q31(-0.61510362277374f), Q31(-0.89515019899997f)},
|
||||
{Q31(-0.03841517601843f), Q31(-0.69888815681179f)}, {Q31(-0.30102157304644f), Q31(-0.07667808922205f)},
|
||||
{Q31( 0.41881284182683f), Q31( 0.02188098922282f)}, {Q31(-0.86135454941237f), Q31( 0.98947480909359f)},
|
||||
{Q31( 0.67226861393788f), Q31(-0.13494389011014f)}, {Q31(-0.70737398842068f), Q31(-0.76547349325992f)},
|
||||
{Q31( 0.94044946687963f), Q31( 0.09026201157416f)}, {Q31(-0.82386352534327f), Q31( 0.08924768823676f)},
|
||||
{Q31(-0.32070666698656f), Q31( 0.50143421908753f)}, {Q31( 0.57593163224487f), Q31(-0.98966422921509f)},
|
||||
{Q31(-0.36326018419965f), Q31( 0.07440243123228f)}, {Q31( 0.99979044674350f), Q31(-0.14130287347405f)},
|
||||
{Q31(-0.92366023326932f), Q31(-0.97979298068180f)}, {Q31(-0.44607178518598f), Q31(-0.54233252016394f)},
|
||||
{Q31( 0.44226800932956f), Q31( 0.71326756742752f)}, {Q31( 0.03671907158312f), Q31( 0.63606389366675f)},
|
||||
{Q31( 0.52175424682195f), Q31(-0.85396826735705f)}, {Q31(-0.94701139690956f), Q31(-0.01826348194255f)},
|
||||
{Q31(-0.98759606946049f), Q31( 0.82288714303073f)}, {Q31( 0.87434794743625f), Q31( 0.89399495655433f)},
|
||||
{Q31(-0.93412041758744f), Q31( 0.41374052024363f)}, {Q31( 0.96063943315511f), Q31( 0.93116709541280f)},
|
||||
{Q31( 0.97534253457837f), Q31( 0.86150930812689f)}, {Q31( 0.99642466504163f), Q31( 0.70190043427512f)},
|
||||
{Q31(-0.94705089665984f), Q31(-0.29580042814306f)}, {Q31( 0.91599807087376f), Q31(-0.98147830385781f)},
|
||||
// Start of duplicated table
|
||||
{Q31(-0.99948153278296f), Q31(-0.59483417516607f)}, {Q31( 0.97113454393991f), Q31(-0.67528515225647f)},
|
||||
{Q31( 0.14130051758487f), Q31(-0.95090983575689f)}, {Q31(-0.47005496701697f), Q31(-0.37340549728647f)},
|
||||
{Q31( 0.80705063769351f), Q31( 0.29653668284408f)}, {Q31(-0.38981478896926f), Q31( 0.89572605717087f)},
|
||||
{Q31(-0.01053049862020f), Q31(-0.66959058036166f)}, {Q31(-0.91266367957293f), Q31(-0.11522938140034f)},
|
||||
};
|
||||
|
||||
///< window coefficients for analysis/synthesis QMF banks
|
||||
static DECLARE_ALIGNED(32, INTFLOAT, sbr_qmf_window_ds)[320];
|
||||
/* This table contains redundancy: It is symmetric about the entry #320
|
||||
|
||||
@@ -27,75 +27,29 @@
|
||||
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "config_components.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "libavutil/thread.h"
|
||||
#include "aac.h"
|
||||
#include "aactab.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
float ff_aac_pow2sf_tab[428];
|
||||
float ff_aac_pow34sf_tab[428];
|
||||
|
||||
#if CONFIG_AAC_ENCODER || CONFIG_AAC_DECODER
|
||||
#include "kbdwin.h"
|
||||
#include "sinewin.h"
|
||||
|
||||
float ff_aac_pow2sf_tab[428];
|
||||
float ff_aac_pow34sf_tab[428];
|
||||
|
||||
DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024];
|
||||
DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128];
|
||||
|
||||
static av_cold void aac_tableinit(void)
|
||||
{
|
||||
/* 2^(i/16) for 0 <= i <= 15 */
|
||||
static const float exp2_lut[] = {
|
||||
1.00000000000000000000,
|
||||
1.04427378242741384032,
|
||||
1.09050773266525765921,
|
||||
1.13878863475669165370,
|
||||
1.18920711500272106672,
|
||||
1.24185781207348404859,
|
||||
1.29683955465100966593,
|
||||
1.35425554693689272830,
|
||||
1.41421356237309504880,
|
||||
1.47682614593949931139,
|
||||
1.54221082540794082361,
|
||||
1.61049033194925430818,
|
||||
1.68179283050742908606,
|
||||
1.75625216037329948311,
|
||||
1.83400808640934246349,
|
||||
1.91520656139714729387,
|
||||
};
|
||||
float t1 = 8.8817841970012523233890533447265625e-16; // 2^(-50)
|
||||
float t2 = 3.63797880709171295166015625e-12; // 2^(-38)
|
||||
int t1_inc_cur, t2_inc_cur;
|
||||
int t1_inc_prev = 0;
|
||||
int t2_inc_prev = 8;
|
||||
|
||||
for (int i = 0; i < 428; i++) {
|
||||
t1_inc_cur = 4 * (i % 4);
|
||||
t2_inc_cur = (8 + 3*i) % 16;
|
||||
if (t1_inc_cur < t1_inc_prev)
|
||||
t1 *= 2;
|
||||
if (t2_inc_cur < t2_inc_prev)
|
||||
t2 *= 2;
|
||||
// A much more efficient and accurate way of doing:
|
||||
// ff_aac_pow2sf_tab[i] = pow(2, (i - POW_SF2_ZERO) / 4.0);
|
||||
// ff_aac_pow34sf_tab[i] = pow(ff_aac_pow2sf_tab[i], 3.0/4.0);
|
||||
ff_aac_pow2sf_tab[i] = t1 * exp2_lut[t1_inc_cur];
|
||||
ff_aac_pow34sf_tab[i] = t2 * exp2_lut[t2_inc_cur];
|
||||
t1_inc_prev = t1_inc_cur;
|
||||
t2_inc_prev = t2_inc_cur;
|
||||
}
|
||||
}
|
||||
|
||||
static av_cold void aac_float_common_init(void)
|
||||
{
|
||||
aac_tableinit();
|
||||
|
||||
avpriv_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
|
||||
avpriv_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
|
||||
ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
|
||||
ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
|
||||
ff_init_ff_sine_windows(10);
|
||||
ff_init_ff_sine_windows(7);
|
||||
}
|
||||
@@ -1331,7 +1285,14 @@ static const uint16_t swb_offset_960_48[] =
|
||||
672, 704, 736, 768, 800, 832, 864, 896, 928, 960
|
||||
};
|
||||
|
||||
#define swb_offset_960_32 swb_offset_960_48
|
||||
static const uint16_t swb_offset_960_32[] =
|
||||
{
|
||||
0, 4, 8, 12, 16, 20, 24, 28, 32, 36,
|
||||
40, 48, 56, 64, 72, 80, 88, 96, 108, 120,
|
||||
132, 144, 160, 176, 196, 216, 240, 264, 292, 320,
|
||||
352, 384, 416, 448, 480, 512, 544, 576, 608, 640,
|
||||
672, 704, 736, 768, 800, 832, 864, 896, 928, 960
|
||||
};
|
||||
|
||||
static const uint16_t swb_offset_960_24[] =
|
||||
{
|
||||
@@ -3338,3 +3299,53 @@ const DECLARE_ALIGNED(32, int, ff_aac_eld_window_480_fixed)[1800] = {
|
||||
0xffecff1c, 0xffed391e, 0xffed740c, 0xffedafb1,
|
||||
0xffedebe1, 0xffee287d, 0xffee654e, 0xffeea23f,
|
||||
};
|
||||
|
||||
static void aac_tableinit(void)
|
||||
{
|
||||
/* 2^(i/16) for 0 <= i <= 15 */
|
||||
static const float exp2_lut[] = {
|
||||
1.00000000000000000000,
|
||||
1.04427378242741384032,
|
||||
1.09050773266525765921,
|
||||
1.13878863475669165370,
|
||||
1.18920711500272106672,
|
||||
1.24185781207348404859,
|
||||
1.29683955465100966593,
|
||||
1.35425554693689272830,
|
||||
1.41421356237309504880,
|
||||
1.47682614593949931139,
|
||||
1.54221082540794082361,
|
||||
1.61049033194925430818,
|
||||
1.68179283050742908606,
|
||||
1.75625216037329948311,
|
||||
1.83400808640934246349,
|
||||
1.91520656139714729387,
|
||||
};
|
||||
float t1 = 8.8817841970012523233890533447265625e-16; // 2^(-50)
|
||||
float t2 = 3.63797880709171295166015625e-12; // 2^(-38)
|
||||
int t1_inc_cur, t2_inc_cur;
|
||||
int t1_inc_prev = 0;
|
||||
int t2_inc_prev = 8;
|
||||
|
||||
for (int i = 0; i < 428; i++) {
|
||||
t1_inc_cur = 4 * (i % 4);
|
||||
t2_inc_cur = (8 + 3*i) % 16;
|
||||
if (t1_inc_cur < t1_inc_prev)
|
||||
t1 *= 2;
|
||||
if (t2_inc_cur < t2_inc_prev)
|
||||
t2 *= 2;
|
||||
// A much more efficient and accurate way of doing:
|
||||
// ff_aac_pow2sf_tab[i] = pow(2, (i - POW_SF2_ZERO) / 4.0);
|
||||
// ff_aac_pow34sf_tab[i] = pow(ff_aac_pow2sf_tab[i], 3.0/4.0);
|
||||
ff_aac_pow2sf_tab[i] = t1 * exp2_lut[t1_inc_cur];
|
||||
ff_aac_pow34sf_tab[i] = t2 * exp2_lut[t2_inc_cur];
|
||||
t1_inc_prev = t1_inc_cur;
|
||||
t2_inc_prev = t2_inc_cur;
|
||||
}
|
||||
}
|
||||
|
||||
void ff_aac_tableinit(void)
|
||||
{
|
||||
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||
ff_thread_once(&init_static_once, aac_tableinit);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define AVCODEC_AACTAB_H
|
||||
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "aac_defines.h"
|
||||
#include "aac.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
extern float ff_aac_pow2sf_tab[428];
|
||||
extern float ff_aac_pow34sf_tab[428];
|
||||
|
||||
void ff_aac_tableinit(void);
|
||||
|
||||
/* @name ltp_coef
|
||||
* Table of the LTP coefficients
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# subsystems
|
||||
OBJS-$(CONFIG_FFT) += aarch64/fft_init_aarch64.o
|
||||
OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_init.o
|
||||
OBJS-$(CONFIG_H264CHROMA) += aarch64/h264chroma_init_aarch64.o
|
||||
OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_init_aarch64.o
|
||||
@@ -35,6 +36,7 @@ ARMV8-OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp.o
|
||||
|
||||
# subsystems
|
||||
NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/sbrdsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_FFT) += aarch64/fft_neon.o
|
||||
NEON-OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_neon.o
|
||||
NEON-OBJS-$(CONFIG_H264CHROMA) += aarch64/h264cmc_neon.o
|
||||
NEON-OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_neon.o \
|
||||
@@ -45,6 +47,7 @@ NEON-OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_neon.o \
|
||||
NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_neon.o \
|
||||
aarch64/simple_idct_neon.o
|
||||
NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o
|
||||
NEON-OBJS-$(CONFIG_ME_CMP) += aarch64/me_cmp_neon.o
|
||||
NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_PIXBLOCKDSP) += aarch64/pixblockdsp_neon.o
|
||||
@@ -62,9 +65,7 @@ NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o \
|
||||
aarch64/vp9lpf_neon.o \
|
||||
aarch64/vp9mc_16bpp_neon.o \
|
||||
aarch64/vp9mc_neon.o
|
||||
NEON-OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_deblock_neon.o \
|
||||
aarch64/hevcdsp_idct_neon.o \
|
||||
NEON-OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_idct_neon.o \
|
||||
aarch64/hevcdsp_init_aarch64.o \
|
||||
aarch64/hevcdsp_qpel_neon.o \
|
||||
aarch64/hevcdsp_epel_neon.o \
|
||||
aarch64/hevcdsp_sao_neon.o
|
||||
|
||||
@@ -19,130 +19,130 @@
|
||||
#include "libavutil/aarch64/asm.S"
|
||||
|
||||
function ff_ps_add_squares_neon, export=1
|
||||
1: ld1 {v0.4s,v1.4s}, [x1], #32
|
||||
fmul v0.4s, v0.4s, v0.4s
|
||||
fmul v1.4s, v1.4s, v1.4s
|
||||
faddp v2.4s, v0.4s, v1.4s
|
||||
ld1 {v3.4s}, [x0]
|
||||
fadd v3.4s, v3.4s, v2.4s
|
||||
st1 {v3.4s}, [x0], #16
|
||||
subs w2, w2, #4
|
||||
b.gt 1b
|
||||
1: ld1 {v0.4S,v1.4S}, [x1], #32
|
||||
fmul v0.4S, v0.4S, v0.4S
|
||||
fmul v1.4S, v1.4S, v1.4S
|
||||
faddp v2.4S, v0.4S, v1.4S
|
||||
ld1 {v3.4S}, [x0]
|
||||
fadd v3.4S, v3.4S, v2.4S
|
||||
st1 {v3.4S}, [x0], #16
|
||||
subs w2, w2, #4
|
||||
b.gt 1b
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_ps_mul_pair_single_neon, export=1
|
||||
1: ld1 {v0.4s,v1.4s}, [x1], #32
|
||||
ld1 {v2.4s}, [x2], #16
|
||||
zip1 v3.4s, v2.4s, v2.4s
|
||||
zip2 v4.4s, v2.4s, v2.4s
|
||||
fmul v0.4s, v0.4s, v3.4s
|
||||
fmul v1.4s, v1.4s, v4.4s
|
||||
st1 {v0.4s,v1.4s}, [x0], #32
|
||||
subs w3, w3, #4
|
||||
b.gt 1b
|
||||
1: ld1 {v0.4S,v1.4S}, [x1], #32
|
||||
ld1 {v2.4S}, [x2], #16
|
||||
zip1 v3.4S, v2.4S, v2.4S
|
||||
zip2 v4.4S, v2.4S, v2.4S
|
||||
fmul v0.4S, v0.4S, v3.4S
|
||||
fmul v1.4S, v1.4S, v4.4S
|
||||
st1 {v0.4S,v1.4S}, [x0], #32
|
||||
subs w3, w3, #4
|
||||
b.gt 1b
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_ps_stereo_interpolate_neon, export=1
|
||||
ld1 {v0.4s}, [x2]
|
||||
ld1 {v1.4s}, [x3]
|
||||
zip1 v4.4s, v0.4s, v0.4s
|
||||
zip2 v5.4s, v0.4s, v0.4s
|
||||
zip1 v6.4s, v1.4s, v1.4s
|
||||
zip2 v7.4s, v1.4s, v1.4s
|
||||
1: ld1 {v2.2s}, [x0]
|
||||
ld1 {v3.2s}, [x1]
|
||||
fadd v4.4s, v4.4s, v6.4s
|
||||
fadd v5.4s, v5.4s, v7.4s
|
||||
mov v2.d[1], v2.d[0]
|
||||
mov v3.d[1], v3.d[0]
|
||||
fmul v2.4s, v2.4s, v4.4s
|
||||
fmla v2.4s, v3.4s, v5.4s
|
||||
st1 {v2.d}[0], [x0], #8
|
||||
st1 {v2.d}[1], [x1], #8
|
||||
subs w4, w4, #1
|
||||
b.gt 1b
|
||||
ld1 {v0.4S}, [x2]
|
||||
ld1 {v1.4S}, [x3]
|
||||
zip1 v4.4S, v0.4S, v0.4S
|
||||
zip2 v5.4S, v0.4S, v0.4S
|
||||
zip1 v6.4S, v1.4S, v1.4S
|
||||
zip2 v7.4S, v1.4S, v1.4S
|
||||
1: ld1 {v2.2S}, [x0]
|
||||
ld1 {v3.2S}, [x1]
|
||||
fadd v4.4S, v4.4S, v6.4S
|
||||
fadd v5.4S, v5.4S, v7.4S
|
||||
mov v2.D[1], v2.D[0]
|
||||
mov v3.D[1], v3.D[0]
|
||||
fmul v2.4S, v2.4S, v4.4S
|
||||
fmla v2.4S, v3.4S, v5.4S
|
||||
st1 {v2.D}[0], [x0], #8
|
||||
st1 {v2.D}[1], [x1], #8
|
||||
subs w4, w4, #1
|
||||
b.gt 1b
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_ps_stereo_interpolate_ipdopd_neon, export=1
|
||||
ld1 {v0.4s,v1.4s}, [x2]
|
||||
ld1 {v6.4s,v7.4s}, [x3]
|
||||
fneg v2.4s, v1.4s
|
||||
fneg v3.4s, v7.4s
|
||||
zip1 v16.4s, v0.4s, v0.4s
|
||||
zip2 v17.4s, v0.4s, v0.4s
|
||||
zip1 v18.4s, v2.4s, v1.4s
|
||||
zip2 v19.4s, v2.4s, v1.4s
|
||||
zip1 v20.4s, v6.4s, v6.4s
|
||||
zip2 v21.4s, v6.4s, v6.4s
|
||||
zip1 v22.4s, v3.4s, v7.4s
|
||||
zip2 v23.4s, v3.4s, v7.4s
|
||||
1: ld1 {v2.2s}, [x0]
|
||||
ld1 {v3.2s}, [x1]
|
||||
fadd v16.4s, v16.4s, v20.4s
|
||||
fadd v17.4s, v17.4s, v21.4s
|
||||
mov v2.d[1], v2.d[0]
|
||||
mov v3.d[1], v3.d[0]
|
||||
fmul v4.4s, v2.4s, v16.4s
|
||||
fmla v4.4s, v3.4s, v17.4s
|
||||
fadd v18.4s, v18.4s, v22.4s
|
||||
fadd v19.4s, v19.4s, v23.4s
|
||||
ext v2.16b, v2.16b, v2.16b, #4
|
||||
ext v3.16b, v3.16b, v3.16b, #4
|
||||
fmla v4.4s, v2.4s, v18.4s
|
||||
fmla v4.4s, v3.4s, v19.4s
|
||||
st1 {v4.d}[0], [x0], #8
|
||||
st1 {v4.d}[1], [x1], #8
|
||||
subs w4, w4, #1
|
||||
b.gt 1b
|
||||
ld1 {v0.4S,v1.4S}, [x2]
|
||||
ld1 {v6.4S,v7.4S}, [x3]
|
||||
fneg v2.4S, v1.4S
|
||||
fneg v3.4S, v7.4S
|
||||
zip1 v16.4S, v0.4S, v0.4S
|
||||
zip2 v17.4S, v0.4S, v0.4S
|
||||
zip1 v18.4S, v2.4S, v1.4S
|
||||
zip2 v19.4S, v2.4S, v1.4S
|
||||
zip1 v20.4S, v6.4S, v6.4S
|
||||
zip2 v21.4S, v6.4S, v6.4S
|
||||
zip1 v22.4S, v3.4S, v7.4S
|
||||
zip2 v23.4S, v3.4S, v7.4S
|
||||
1: ld1 {v2.2S}, [x0]
|
||||
ld1 {v3.2S}, [x1]
|
||||
fadd v16.4S, v16.4S, v20.4S
|
||||
fadd v17.4S, v17.4S, v21.4S
|
||||
mov v2.D[1], v2.D[0]
|
||||
mov v3.D[1], v3.D[0]
|
||||
fmul v4.4S, v2.4S, v16.4S
|
||||
fmla v4.4S, v3.4S, v17.4S
|
||||
fadd v18.4S, v18.4S, v22.4S
|
||||
fadd v19.4S, v19.4S, v23.4S
|
||||
ext v2.16B, v2.16B, v2.16B, #4
|
||||
ext v3.16B, v3.16B, v3.16B, #4
|
||||
fmla v4.4S, v2.4S, v18.4S
|
||||
fmla v4.4S, v3.4S, v19.4S
|
||||
st1 {v4.D}[0], [x0], #8
|
||||
st1 {v4.D}[1], [x1], #8
|
||||
subs w4, w4, #1
|
||||
b.gt 1b
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_ps_hybrid_analysis_neon, export=1
|
||||
lsl x3, x3, #3
|
||||
ld2 {v0.4s,v1.4s}, [x1], #32
|
||||
ld2 {v2.2s,v3.2s}, [x1], #16
|
||||
ld1 {v24.2s}, [x1], #8
|
||||
ld2 {v4.2s,v5.2s}, [x1], #16
|
||||
ld2 {v6.4s,v7.4s}, [x1]
|
||||
rev64 v6.4s, v6.4s
|
||||
rev64 v7.4s, v7.4s
|
||||
ext v6.16b, v6.16b, v6.16b, #8
|
||||
ext v7.16b, v7.16b, v7.16b, #8
|
||||
rev64 v4.2s, v4.2s
|
||||
rev64 v5.2s, v5.2s
|
||||
mov v2.d[1], v3.d[0]
|
||||
mov v4.d[1], v5.d[0]
|
||||
mov v5.d[1], v2.d[0]
|
||||
mov v3.d[1], v4.d[0]
|
||||
fadd v16.4s, v0.4s, v6.4s
|
||||
fadd v17.4s, v1.4s, v7.4s
|
||||
fsub v18.4s, v1.4s, v7.4s
|
||||
fsub v19.4s, v0.4s, v6.4s
|
||||
fadd v22.4s, v2.4s, v4.4s
|
||||
fsub v23.4s, v5.4s, v3.4s
|
||||
trn1 v20.2d, v22.2d, v23.2d // {re4+re8, re5+re7, im8-im4, im7-im5}
|
||||
trn2 v21.2d, v22.2d, v23.2d // {im4+im8, im5+im7, re4-re8, re5-re7}
|
||||
1: ld2 {v2.4s,v3.4s}, [x2], #32
|
||||
ld2 {v4.2s,v5.2s}, [x2], #16
|
||||
ld1 {v6.2s}, [x2], #8
|
||||
add x2, x2, #8
|
||||
mov v4.d[1], v5.d[0]
|
||||
mov v6.s[1], v6.s[0]
|
||||
fmul v6.2s, v6.2s, v24.2s
|
||||
fmul v0.4s, v2.4s, v16.4s
|
||||
fmul v1.4s, v2.4s, v17.4s
|
||||
fmls v0.4s, v3.4s, v18.4s
|
||||
fmla v1.4s, v3.4s, v19.4s
|
||||
fmla v0.4s, v4.4s, v20.4s
|
||||
fmla v1.4s, v4.4s, v21.4s
|
||||
faddp v0.4s, v0.4s, v1.4s
|
||||
faddp v0.4s, v0.4s, v0.4s
|
||||
fadd v0.2s, v0.2s, v6.2s
|
||||
st1 {v0.2s}, [x0], x3
|
||||
subs w4, w4, #1
|
||||
b.gt 1b
|
||||
lsl x3, x3, #3
|
||||
ld2 {v0.4S,v1.4S}, [x1], #32
|
||||
ld2 {v2.2S,v3.2S}, [x1], #16
|
||||
ld1 {v24.2S}, [x1], #8
|
||||
ld2 {v4.2S,v5.2S}, [x1], #16
|
||||
ld2 {v6.4S,v7.4S}, [x1]
|
||||
rev64 v6.4S, v6.4S
|
||||
rev64 v7.4S, v7.4S
|
||||
ext v6.16B, v6.16B, v6.16B, #8
|
||||
ext v7.16B, v7.16B, v7.16B, #8
|
||||
rev64 v4.2S, v4.2S
|
||||
rev64 v5.2S, v5.2S
|
||||
mov v2.D[1], v3.D[0]
|
||||
mov v4.D[1], v5.D[0]
|
||||
mov v5.D[1], v2.D[0]
|
||||
mov v3.D[1], v4.D[0]
|
||||
fadd v16.4S, v0.4S, v6.4S
|
||||
fadd v17.4S, v1.4S, v7.4S
|
||||
fsub v18.4S, v1.4S, v7.4S
|
||||
fsub v19.4S, v0.4S, v6.4S
|
||||
fadd v22.4S, v2.4S, v4.4S
|
||||
fsub v23.4S, v5.4S, v3.4S
|
||||
trn1 v20.2D, v22.2D, v23.2D // {re4+re8, re5+re7, im8-im4, im7-im5}
|
||||
trn2 v21.2D, v22.2D, v23.2D // {im4+im8, im5+im7, re4-re8, re5-re7}
|
||||
1: ld2 {v2.4S,v3.4S}, [x2], #32
|
||||
ld2 {v4.2S,v5.2S}, [x2], #16
|
||||
ld1 {v6.2S}, [x2], #8
|
||||
add x2, x2, #8
|
||||
mov v4.D[1], v5.D[0]
|
||||
mov v6.S[1], v6.S[0]
|
||||
fmul v6.2S, v6.2S, v24.2S
|
||||
fmul v0.4S, v2.4S, v16.4S
|
||||
fmul v1.4S, v2.4S, v17.4S
|
||||
fmls v0.4S, v3.4S, v18.4S
|
||||
fmla v1.4S, v3.4S, v19.4S
|
||||
fmla v0.4S, v4.4S, v20.4S
|
||||
fmla v1.4S, v4.4S, v21.4S
|
||||
faddp v0.4S, v0.4S, v1.4S
|
||||
faddp v0.4S, v0.4S, v0.4S
|
||||
fadd v0.2S, v0.2S, v6.2S
|
||||
st1 {v0.2S}, [x0], x3
|
||||
subs w4, w4, #1
|
||||
b.gt 1b
|
||||
ret
|
||||
endfunc
|
||||
|
||||
25
libavcodec/aarch64/asm-offsets.h
Normal file
25
libavcodec/aarch64/asm-offsets.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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_AARCH64_ASM_OFFSETS_H
|
||||
#define AVCODEC_AARCH64_ASM_OFFSETS_H
|
||||
|
||||
/* FFTContext */
|
||||
#define IMDCT_HALF 0x48
|
||||
|
||||
#endif /* AVCODEC_AARCH64_ASM_OFFSETS_H */
|
||||
52
libavcodec/aarch64/fft_init_aarch64.c
Normal file
52
libavcodec/aarch64/fft_init_aarch64.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Mans Rullgard <mans@mansr.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 "config.h"
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/aarch64/cpu.h"
|
||||
|
||||
#include "libavcodec/fft.h"
|
||||
|
||||
void ff_fft_permute_neon(FFTContext *s, FFTComplex *z);
|
||||
void ff_fft_calc_neon(FFTContext *s, FFTComplex *z);
|
||||
|
||||
void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
|
||||
av_cold void ff_fft_init_aarch64(FFTContext *s)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_neon(cpu_flags)) {
|
||||
if (s->nbits < 17) {
|
||||
s->fft_permute = ff_fft_permute_neon;
|
||||
s->fft_calc = ff_fft_calc_neon;
|
||||
}
|
||||
#if CONFIG_MDCT
|
||||
s->imdct_calc = ff_imdct_calc_neon;
|
||||
s->imdct_half = ff_imdct_half_neon;
|
||||
s->mdct_calc = ff_mdct_calc_neon;
|
||||
s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
447
libavcodec/aarch64/fft_neon.S
Normal file
447
libavcodec/aarch64/fft_neon.S
Normal file
@@ -0,0 +1,447 @@
|
||||
/*
|
||||
* ARM NEON optimised FFT
|
||||
*
|
||||
* Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
|
||||
* Copyright (c) 2009 Naotoshi Nojiri
|
||||
* Copyright (c) 2014 Janne Grunau <janne-libav@jannau.net>
|
||||
*
|
||||
* This algorithm (though not any of the implementation details) is
|
||||
* based on libdjbfft by D. J. Bernstein.
|
||||
*
|
||||
* 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/aarch64/asm.S"
|
||||
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
|
||||
.macro transpose d0, d1, s0, s1
|
||||
trn1 \d0, \s0, \s1
|
||||
trn2 \d1, \s0, \s1
|
||||
.endm
|
||||
|
||||
|
||||
function fft4_neon
|
||||
AARCH64_VALID_JUMP_TARGET
|
||||
ld1 {v0.2s,v1.2s,v2.2s,v3.2s}, [x0]
|
||||
|
||||
fadd v4.2s, v0.2s, v1.2s // r0+r1,i0+i1
|
||||
fsub v6.2s, v0.2s, v1.2s // r0-r1,i0-i1
|
||||
|
||||
ext v16.8b, v2.8b, v3.8b, #4
|
||||
ext v17.8b, v3.8b, v2.8b, #4
|
||||
|
||||
fadd v5.2s, v2.2s, v3.2s // i2+i3,r2+r3
|
||||
fsub v7.2s, v16.2s, v17.2s // r3-r2,i2-i3
|
||||
|
||||
fadd v0.2s, v4.2s, v5.2s
|
||||
fsub v2.2s, v4.2s, v5.2s
|
||||
fadd v1.2s, v6.2s, v7.2s
|
||||
fsub v3.2s, v6.2s, v7.2s
|
||||
|
||||
st1 {v0.2s,v1.2s,v2.2s,v3.2s}, [x0]
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function fft8_neon
|
||||
AARCH64_VALID_JUMP_TARGET
|
||||
mov x1, x0
|
||||
ld1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x0], #32
|
||||
ld1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0]
|
||||
ext v22.8b, v2.8b, v3.8b, #4
|
||||
ext v23.8b, v3.8b, v2.8b, #4
|
||||
fadd v4.2s, v16.2s, v17.2s // r4+r5,i4+i5
|
||||
fadd v5.2s, v18.2s, v19.2s // r6+r7,i6+i7
|
||||
fsub v17.2s, v16.2s, v17.2s // r4-r5,i4-i5
|
||||
fsub v19.2s, v18.2s, v19.2s // r6-r7,i6-i7
|
||||
rev64 v27.2s, v28.2s // ???
|
||||
fadd v20.2s, v0.2s, v1.2s // r0+r1,i0+i1
|
||||
fadd v21.2s, v2.2s, v3.2s // r2+r3,i2+i3
|
||||
fmul v26.2s, v17.2s, v28.2s // -a2r*w,a2i*w
|
||||
ext v6.8b, v4.8b, v5.8b, #4
|
||||
ext v7.8b, v5.8b, v4.8b, #4
|
||||
fmul v27.2s, v19.2s, v27.2s // a3r*w,-a3i*w
|
||||
fsub v23.2s, v22.2s, v23.2s // i2-i3,r3-r2
|
||||
fsub v22.2s, v0.2s, v1.2s // r0-r1,i0-i1
|
||||
fmul v24.2s, v17.2s, v28.s[1] // a2r*w,a2i*w
|
||||
fmul v25.2s, v19.2s, v28.s[1] // a3r*w,a3i*w
|
||||
fadd v0.2s, v20.2s, v21.2s
|
||||
fsub v2.2s, v20.2s, v21.2s
|
||||
fadd v1.2s, v22.2s, v23.2s
|
||||
rev64 v26.2s, v26.2s
|
||||
rev64 v27.2s, v27.2s
|
||||
fsub v3.2s, v22.2s, v23.2s
|
||||
fsub v6.2s, v6.2s, v7.2s
|
||||
fadd v24.2s, v24.2s, v26.2s // a2r+a2i,a2i-a2r t1,t2
|
||||
fadd v25.2s, v25.2s, v27.2s // a3r-a3i,a3i+a3r t5,t6
|
||||
fadd v7.2s, v4.2s, v5.2s
|
||||
fsub v18.2s, v2.2s, v6.2s
|
||||
ext v26.8b, v24.8b, v25.8b, #4
|
||||
ext v27.8b, v25.8b, v24.8b, #4
|
||||
fadd v2.2s, v2.2s, v6.2s
|
||||
fsub v16.2s, v0.2s, v7.2s
|
||||
fadd v5.2s, v25.2s, v24.2s
|
||||
fsub v4.2s, v26.2s, v27.2s
|
||||
fadd v0.2s, v0.2s, v7.2s
|
||||
fsub v17.2s, v1.2s, v5.2s
|
||||
fsub v19.2s, v3.2s, v4.2s
|
||||
fadd v3.2s, v3.2s, v4.2s
|
||||
fadd v1.2s, v1.2s, v5.2s
|
||||
|
||||
st1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0]
|
||||
st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x1]
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function fft16_neon
|
||||
AARCH64_VALID_JUMP_TARGET
|
||||
mov x1, x0
|
||||
ld1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x0], #32
|
||||
ld1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0], #32
|
||||
ext v22.8b, v2.8b, v3.8b, #4
|
||||
ext v23.8b, v3.8b, v2.8b, #4
|
||||
fadd v4.2s, v16.2s, v17.2s // r4+r5,i4+i5
|
||||
fadd v5.2s, v18.2s, v19.2s // r6+r7,i6+i7
|
||||
fsub v17.2s, v16.2s, v17.2s // r4-r5,i4-i5
|
||||
fsub v19.2s, v18.2s, v19.2s // r6-r7,i6-i7
|
||||
rev64 v27.2s, v28.2s // ???
|
||||
fadd v20.2s, v0.2s, v1.2s // r0+r1,i0+i1
|
||||
fadd v21.2s, v2.2s, v3.2s // r2+r3,i2+i3
|
||||
fmul v26.2s, v17.2s, v28.2s // -a2r*w,a2i*w
|
||||
ext v6.8b, v4.8b, v5.8b, #4
|
||||
ext v7.8b, v5.8b, v4.8b, #4
|
||||
fmul v27.2s, v19.2s, v27.2s // a3r*w,-a3i*w
|
||||
fsub v23.2s, v22.2s, v23.2s // i2-i3,r3-r2
|
||||
fsub v22.2s, v0.2s, v1.2s // r0-r1,i0-i1
|
||||
fmul v24.2s, v17.2s, v28.s[1] // a2r*w,a2i*w
|
||||
fmul v25.2s, v19.2s, v28.s[1] // a3r*w,a3i*w
|
||||
fadd v0.2s, v20.2s, v21.2s
|
||||
fsub v2.2s, v20.2s, v21.2s
|
||||
fadd v1.2s, v22.2s, v23.2s
|
||||
rev64 v26.2s, v26.2s
|
||||
rev64 v27.2s, v27.2s
|
||||
fsub v3.2s, v22.2s, v23.2s
|
||||
fsub v6.2s, v6.2s, v7.2s
|
||||
fadd v24.2s, v24.2s, v26.2s // a2r+a2i,a2i-a2r t1,t2
|
||||
fadd v25.2s, v25.2s, v27.2s // a3r-a3i,a3i+a3r t5,t6
|
||||
fadd v7.2s, v4.2s, v5.2s
|
||||
fsub v18.2s, v2.2s, v6.2s
|
||||
ld1 {v20.4s,v21.4s}, [x0], #32
|
||||
ld1 {v22.4s,v23.4s}, [x0], #32
|
||||
ext v26.8b, v24.8b, v25.8b, #4
|
||||
ext v27.8b, v25.8b, v24.8b, #4
|
||||
fadd v2.2s, v2.2s, v6.2s
|
||||
fsub v16.2s, v0.2s, v7.2s
|
||||
fadd v5.2s, v25.2s, v24.2s
|
||||
fsub v4.2s, v26.2s, v27.2s
|
||||
transpose v24.2d, v25.2d, v20.2d, v22.2d
|
||||
transpose v26.2d, v27.2d, v21.2d, v23.2d
|
||||
fadd v0.2s, v0.2s, v7.2s
|
||||
fsub v17.2s, v1.2s, v5.2s
|
||||
fsub v19.2s, v3.2s, v4.2s
|
||||
fadd v3.2s, v3.2s, v4.2s
|
||||
fadd v1.2s, v1.2s, v5.2s
|
||||
ext v20.16b, v21.16b, v21.16b, #4
|
||||
ext v21.16b, v23.16b, v23.16b, #4
|
||||
|
||||
zip1 v0.2d, v0.2d, v1.2d // {z[0], z[1]}
|
||||
zip1 v1.2d, v2.2d, v3.2d // {z[2], z[3]}
|
||||
zip1 v2.2d, v16.2d, v17.2d // {z[o1], z[o1+1]}
|
||||
zip1 v3.2d, v18.2d, v19.2d // {z[o1+2],z[o1+3]}
|
||||
|
||||
// 2 x fft4
|
||||
transpose v22.2d, v23.2d, v20.2d, v21.2d
|
||||
|
||||
fadd v4.4s, v24.4s, v25.4s
|
||||
fadd v5.4s, v26.4s, v27.4s
|
||||
fsub v6.4s, v24.4s, v25.4s
|
||||
fsub v7.4s, v22.4s, v23.4s
|
||||
|
||||
ld1 {v23.4s}, [x14]
|
||||
|
||||
fadd v24.4s, v4.4s, v5.4s // {z[o2+0],z[o2+1]}
|
||||
fsub v26.4s, v4.4s, v5.4s // {z[o2+2],z[o2+3]}
|
||||
fadd v25.4s, v6.4s, v7.4s // {z[o3+0],z[o3+1]}
|
||||
fsub v27.4s, v6.4s, v7.4s // {z[o3+2],z[o3+3]}
|
||||
|
||||
//fft_pass_neon_16
|
||||
rev64 v7.4s, v25.4s
|
||||
fmul v25.4s, v25.4s, v23.s[1]
|
||||
fmul v7.4s, v7.4s, v29.4s
|
||||
fmla v25.4s, v7.4s, v23.s[3] // {t1a,t2a,t5a,t6a}
|
||||
|
||||
zip1 v20.4s, v24.4s, v25.4s
|
||||
zip2 v21.4s, v24.4s, v25.4s
|
||||
fneg v22.4s, v20.4s
|
||||
fadd v4.4s, v21.4s, v20.4s
|
||||
fsub v6.4s, v20.4s, v21.4s // just the second half
|
||||
fadd v5.4s, v21.4s, v22.4s // just the first half
|
||||
|
||||
tbl v4.16b, {v4.16b}, v30.16b // trans4_float
|
||||
tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float
|
||||
|
||||
fsub v20.4s, v0.4s, v4.4s // {z[o2],z[o2+1]}
|
||||
fadd v16.4s, v0.4s, v4.4s // {z[0], z[1]}
|
||||
fsub v22.4s, v2.4s, v5.4s // {z[o3],z[o3+1]}
|
||||
fadd v18.4s, v2.4s, v5.4s // {z[o1],z[o1+1]}
|
||||
|
||||
//second half
|
||||
rev64 v6.4s, v26.4s
|
||||
fmul v26.4s, v26.4s, v23.s[2]
|
||||
rev64 v7.4s, v27.4s
|
||||
fmul v27.4s, v27.4s, v23.s[3]
|
||||
fmul v6.4s, v6.4s, v29.4s
|
||||
fmul v7.4s, v7.4s, v29.4s
|
||||
fmla v26.4s, v6.4s, v23.s[2] // {t1,t2,t5,t6}
|
||||
fmla v27.4s, v7.4s, v23.s[1] // {t1a,t2a,t5a,t6a}
|
||||
|
||||
zip1 v24.4s, v26.4s, v27.4s
|
||||
zip2 v25.4s, v26.4s, v27.4s
|
||||
fneg v26.4s, v24.4s
|
||||
fadd v4.4s, v25.4s, v24.4s
|
||||
fsub v6.4s, v24.4s, v25.4s // just the second half
|
||||
fadd v5.4s, v25.4s, v26.4s // just the first half
|
||||
|
||||
tbl v4.16b, {v4.16b}, v30.16b // trans4_float
|
||||
tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float
|
||||
|
||||
fadd v17.4s, v1.4s, v4.4s // {z[2], z[3]}
|
||||
fsub v21.4s, v1.4s, v4.4s // {z[o2+2],z[o2+3]}
|
||||
fadd v19.4s, v3.4s, v5.4s // {z[o1+2],z[o1+3]}
|
||||
fsub v23.4s, v3.4s, v5.4s // {z[o3+2],z[o3+3]}
|
||||
|
||||
st1 {v16.4s,v17.4s}, [x1], #32
|
||||
st1 {v18.4s,v19.4s}, [x1], #32
|
||||
st1 {v20.4s,v21.4s}, [x1], #32
|
||||
st1 {v22.4s,v23.4s}, [x1], #32
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
||||
|
||||
const trans4_float, align=4
|
||||
.byte 0, 1, 2, 3
|
||||
.byte 8, 9, 10, 11
|
||||
.byte 4, 5, 6, 7
|
||||
.byte 12, 13, 14, 15
|
||||
endconst
|
||||
|
||||
const trans8_float, align=4
|
||||
.byte 24, 25, 26, 27
|
||||
.byte 0, 1, 2, 3
|
||||
.byte 28, 29, 30, 31
|
||||
.byte 4, 5, 6, 7
|
||||
endconst
|
||||
|
||||
function fft_pass_neon
|
||||
sub x6, x2, #1 // n - 1, loop counter
|
||||
lsl x5, x2, #3 // 2 * n * sizeof FFTSample
|
||||
lsl x1, x2, #4 // 2 * n * sizeof FFTComplex
|
||||
add x5, x4, x5 // wim
|
||||
add x3, x1, x2, lsl #5 // 4 * n * sizeof FFTComplex
|
||||
add x2, x0, x2, lsl #5 // &z[o2]
|
||||
add x3, x0, x3 // &z[o3]
|
||||
add x1, x0, x1 // &z[o1]
|
||||
ld1 {v20.4s},[x2] // {z[o2],z[o2+1]}
|
||||
ld1 {v22.4s},[x3] // {z[o3],z[o3+1]}
|
||||
ld1 {v4.2s}, [x4], #8 // {wre[0],wre[1]}
|
||||
trn2 v25.2d, v20.2d, v22.2d
|
||||
sub x5, x5, #4 // wim--
|
||||
trn1 v24.2d, v20.2d, v22.2d
|
||||
ld1 {v5.s}[0], [x5], x7 // d5[0] = wim[-1]
|
||||
rev64 v7.4s, v25.4s
|
||||
fmul v25.4s, v25.4s, v4.s[1]
|
||||
ld1 {v16.4s}, [x0] // {z[0],z[1]}
|
||||
fmul v7.4s, v7.4s, v29.4s
|
||||
ld1 {v17.4s}, [x1] // {z[o1],z[o1+1]}
|
||||
prfm pldl1keep, [x2, #16]
|
||||
prfm pldl1keep, [x3, #16]
|
||||
fmla v25.4s, v7.4s, v5.s[0] // {t1a,t2a,t5a,t6a}
|
||||
prfm pldl1keep, [x0, #16]
|
||||
prfm pldl1keep, [x1, #16]
|
||||
|
||||
zip1 v20.4s, v24.4s, v25.4s
|
||||
zip2 v21.4s, v24.4s, v25.4s
|
||||
fneg v22.4s, v20.4s
|
||||
fadd v4.4s, v21.4s, v20.4s
|
||||
fsub v6.4s, v20.4s, v21.4s // just the second half
|
||||
fadd v5.4s, v21.4s, v22.4s // just the first half
|
||||
|
||||
tbl v4.16b, {v4.16b}, v30.16b // trans4_float
|
||||
tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float
|
||||
|
||||
fadd v20.4s, v16.4s, v4.4s
|
||||
fsub v22.4s, v16.4s, v4.4s
|
||||
fadd v21.4s, v17.4s, v5.4s
|
||||
st1 {v20.4s}, [x0], #16 // {z[0], z[1]}
|
||||
fsub v23.4s, v17.4s, v5.4s
|
||||
|
||||
st1 {v21.4s}, [x1], #16 // {z[o1],z[o1+1]}
|
||||
st1 {v22.4s}, [x2], #16 // {z[o2],z[o2+1]}
|
||||
st1 {v23.4s}, [x3], #16 // {z[o3],z[o3+1]}
|
||||
1:
|
||||
ld1 {v20.4s},[x2] // {z[o2],z[o2+1]}
|
||||
ld1 {v22.4s},[x3] // {z[o3],z[o3+1]}
|
||||
ld1 {v4.2s}, [x4], #8 // {wre[0],wre[1]}
|
||||
transpose v26.2d, v27.2d, v20.2d, v22.2d
|
||||
ld1 {v5.2s}, [x5], x7 // {wim[-1],wim[0]}
|
||||
rev64 v6.4s, v26.4s
|
||||
fmul v26.4s, v26.4s, v4.s[0]
|
||||
rev64 v7.4s, v27.4s
|
||||
fmul v27.4s, v27.4s, v4.s[1]
|
||||
fmul v6.4s, v6.4s, v29.4s
|
||||
fmul v7.4s, v7.4s, v29.4s
|
||||
ld1 {v16.4s},[x0] // {z[0],z[1]}
|
||||
fmla v26.4s, v6.4s, v5.s[1] // {t1,t2,t5,t6}
|
||||
fmla v27.4s, v7.4s, v5.s[0] // {t1a,t2a,t5a,t6a}
|
||||
ld1 {v17.4s},[x1] // {z[o1],z[o1+1]}
|
||||
|
||||
subs x6, x6, #1 // n--
|
||||
|
||||
zip1 v20.4s, v26.4s, v27.4s
|
||||
zip2 v21.4s, v26.4s, v27.4s
|
||||
fneg v22.4s, v20.4s
|
||||
fadd v4.4s, v21.4s, v20.4s
|
||||
fsub v6.4s, v20.4s, v21.4s // just the second half
|
||||
fadd v5.4s, v21.4s, v22.4s // just the first half
|
||||
|
||||
tbl v4.16b, {v4.16b}, v30.16b // trans4_float
|
||||
tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float
|
||||
|
||||
fadd v20.4s, v16.4s, v4.4s
|
||||
fsub v22.4s, v16.4s, v4.4s
|
||||
fadd v21.4s, v17.4s, v5.4s
|
||||
st1 {v20.4s}, [x0], #16 // {z[0], z[1]}
|
||||
fsub v23.4s, v17.4s, v5.4s
|
||||
|
||||
st1 {v21.4s}, [x1], #16 // {z[o1],z[o1+1]}
|
||||
st1 {v22.4s}, [x2], #16 // {z[o2],z[o2+1]}
|
||||
st1 {v23.4s}, [x3], #16 // {z[o3],z[o3+1]}
|
||||
b.ne 1b
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
||||
.macro def_fft n, n2, n4
|
||||
function fft\n\()_neon, align=6
|
||||
AARCH64_VALID_JUMP_TARGET
|
||||
AARCH64_SIGN_LINK_REGISTER
|
||||
stp x28, x30, [sp, #-16]!
|
||||
add x28, x0, #\n4*2*8
|
||||
bl fft\n2\()_neon
|
||||
mov x0, x28
|
||||
bl fft\n4\()_neon
|
||||
add x0, x28, #\n4*1*8
|
||||
bl fft\n4\()_neon
|
||||
sub x0, x28, #\n4*2*8
|
||||
ldp x28, x30, [sp], #16
|
||||
AARCH64_VALIDATE_LINK_REGISTER
|
||||
movrel x4, X(ff_cos_\n)
|
||||
mov x2, #\n4>>1
|
||||
b fft_pass_neon
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
def_fft 32, 16, 8
|
||||
def_fft 64, 32, 16
|
||||
def_fft 128, 64, 32
|
||||
def_fft 256, 128, 64
|
||||
def_fft 512, 256, 128
|
||||
def_fft 1024, 512, 256
|
||||
def_fft 2048, 1024, 512
|
||||
def_fft 4096, 2048, 1024
|
||||
def_fft 8192, 4096, 2048
|
||||
def_fft 16384, 8192, 4096
|
||||
def_fft 32768, 16384, 8192
|
||||
def_fft 65536, 32768, 16384
|
||||
|
||||
function ff_fft_calc_neon, export=1
|
||||
prfm pldl1keep, [x1]
|
||||
movrel x10, trans4_float
|
||||
ldr w2, [x0]
|
||||
movrel x11, trans8_float
|
||||
sub w2, w2, #2
|
||||
movrel x3, fft_tab_neon
|
||||
ld1 {v30.16b}, [x10]
|
||||
mov x7, #-8
|
||||
movrel x12, pmmp
|
||||
ldr x3, [x3, x2, lsl #3]
|
||||
movrel x13, mppm
|
||||
movrel x14, X(ff_cos_16)
|
||||
ld1 {v31.16b}, [x11]
|
||||
mov x0, x1
|
||||
ld1 {v29.4s}, [x12] // pmmp
|
||||
ld1 {v28.4s}, [x13]
|
||||
br x3
|
||||
endfunc
|
||||
|
||||
function ff_fft_permute_neon, export=1
|
||||
mov x6, #1
|
||||
ldr w2, [x0] // nbits
|
||||
ldr x3, [x0, #16] // tmp_buf
|
||||
ldr x0, [x0, #8] // revtab
|
||||
lsl x6, x6, x2
|
||||
mov x2, x6
|
||||
1:
|
||||
ld1 {v0.2s,v1.2s}, [x1], #16
|
||||
ldr w4, [x0], #4
|
||||
uxth w5, w4
|
||||
lsr w4, w4, #16
|
||||
add x5, x3, x5, lsl #3
|
||||
add x4, x3, x4, lsl #3
|
||||
st1 {v0.2s}, [x5]
|
||||
st1 {v1.2s}, [x4]
|
||||
subs x6, x6, #2
|
||||
b.gt 1b
|
||||
|
||||
sub x1, x1, x2, lsl #3
|
||||
1:
|
||||
ld1 {v0.4s,v1.4s}, [x3], #32
|
||||
st1 {v0.4s,v1.4s}, [x1], #32
|
||||
subs x2, x2, #4
|
||||
b.gt 1b
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
||||
const fft_tab_neon, relocate=1
|
||||
.quad fft4_neon
|
||||
.quad fft8_neon
|
||||
.quad fft16_neon
|
||||
.quad fft32_neon
|
||||
.quad fft64_neon
|
||||
.quad fft128_neon
|
||||
.quad fft256_neon
|
||||
.quad fft512_neon
|
||||
.quad fft1024_neon
|
||||
.quad fft2048_neon
|
||||
.quad fft4096_neon
|
||||
.quad fft8192_neon
|
||||
.quad fft16384_neon
|
||||
.quad fft32768_neon
|
||||
.quad fft65536_neon
|
||||
endconst
|
||||
|
||||
const pmmp, align=4
|
||||
.float +1.0, -1.0, -1.0, +1.0
|
||||
endconst
|
||||
|
||||
const mppm, align=4
|
||||
.float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
|
||||
endconst
|
||||
@@ -38,11 +38,11 @@ function ff_\type\()_\codec\()_chroma_mc8_neon, export=1
|
||||
lsl w9, w9, #3
|
||||
lsl w10, w10, #1
|
||||
add w9, w9, w10
|
||||
add x6, x6, w9, uxtw
|
||||
ld1r {v22.8h}, [x6]
|
||||
add x6, x6, w9, UXTW
|
||||
ld1r {v22.8H}, [x6]
|
||||
.endif
|
||||
.ifc \codec,vc1
|
||||
movi v22.8h, #28
|
||||
movi v22.8H, #28
|
||||
.endif
|
||||
mul w7, w4, w5
|
||||
lsl w14, w5, #3
|
||||
@@ -55,139 +55,139 @@ function ff_\type\()_\codec\()_chroma_mc8_neon, export=1
|
||||
add w4, w4, #64
|
||||
b.eq 2f
|
||||
|
||||
dup v0.8b, w4
|
||||
dup v1.8b, w12
|
||||
ld1 {v4.8b, v5.8b}, [x1], x2
|
||||
dup v2.8b, w6
|
||||
dup v3.8b, w7
|
||||
ext v5.8b, v4.8b, v5.8b, #1
|
||||
1: ld1 {v6.8b, v7.8b}, [x1], x2
|
||||
umull v16.8h, v4.8b, v0.8b
|
||||
umlal v16.8h, v5.8b, v1.8b
|
||||
ext v7.8b, v6.8b, v7.8b, #1
|
||||
ld1 {v4.8b, v5.8b}, [x1], x2
|
||||
umlal v16.8h, v6.8b, v2.8b
|
||||
dup v0.8B, w4
|
||||
dup v1.8B, w12
|
||||
ld1 {v4.8B, v5.8B}, [x1], x2
|
||||
dup v2.8B, w6
|
||||
dup v3.8B, w7
|
||||
ext v5.8B, v4.8B, v5.8B, #1
|
||||
1: ld1 {v6.8B, v7.8B}, [x1], x2
|
||||
umull v16.8H, v4.8B, v0.8B
|
||||
umlal v16.8H, v5.8B, v1.8B
|
||||
ext v7.8B, v6.8B, v7.8B, #1
|
||||
ld1 {v4.8B, v5.8B}, [x1], x2
|
||||
umlal v16.8H, v6.8B, v2.8B
|
||||
prfm pldl1strm, [x1]
|
||||
ext v5.8b, v4.8b, v5.8b, #1
|
||||
umlal v16.8h, v7.8b, v3.8b
|
||||
umull v17.8h, v6.8b, v0.8b
|
||||
ext v5.8B, v4.8B, v5.8B, #1
|
||||
umlal v16.8H, v7.8B, v3.8B
|
||||
umull v17.8H, v6.8B, v0.8B
|
||||
subs w3, w3, #2
|
||||
umlal v17.8h, v7.8b, v1.8b
|
||||
umlal v17.8h, v4.8b, v2.8b
|
||||
umlal v17.8h, v5.8b, v3.8b
|
||||
umlal v17.8H, v7.8B, v1.8B
|
||||
umlal v17.8H, v4.8B, v2.8B
|
||||
umlal v17.8H, v5.8B, v3.8B
|
||||
prfm pldl1strm, [x1, x2]
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v16.8h, #6
|
||||
rshrn v17.8b, v17.8h, #6
|
||||
rshrn v16.8B, v16.8H, #6
|
||||
rshrn v17.8B, v17.8H, #6
|
||||
.else
|
||||
add v16.8h, v16.8h, v22.8h
|
||||
add v17.8h, v17.8h, v22.8h
|
||||
shrn v16.8b, v16.8h, #6
|
||||
shrn v17.8b, v17.8h, #6
|
||||
add v16.8H, v16.8H, v22.8H
|
||||
add v17.8H, v17.8H, v22.8H
|
||||
shrn v16.8B, v16.8H, #6
|
||||
shrn v17.8B, v17.8H, #6
|
||||
.endif
|
||||
.ifc \type,avg
|
||||
ld1 {v20.8b}, [x8], x2
|
||||
ld1 {v21.8b}, [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
urhadd v17.8b, v17.8b, v21.8b
|
||||
ld1 {v20.8B}, [x8], x2
|
||||
ld1 {v21.8B}, [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
urhadd v17.8B, v17.8B, v21.8B
|
||||
.endif
|
||||
st1 {v16.8b}, [x0], x2
|
||||
st1 {v17.8b}, [x0], x2
|
||||
st1 {v16.8B}, [x0], x2
|
||||
st1 {v17.8B}, [x0], x2
|
||||
b.gt 1b
|
||||
ret
|
||||
|
||||
2: adds w12, w12, w6
|
||||
dup v0.8b, w4
|
||||
dup v0.8B, w4
|
||||
b.eq 5f
|
||||
tst w6, w6
|
||||
dup v1.8b, w12
|
||||
dup v1.8B, w12
|
||||
b.eq 4f
|
||||
|
||||
ld1 {v4.8b}, [x1], x2
|
||||
3: ld1 {v6.8b}, [x1], x2
|
||||
umull v16.8h, v4.8b, v0.8b
|
||||
umlal v16.8h, v6.8b, v1.8b
|
||||
ld1 {v4.8b}, [x1], x2
|
||||
umull v17.8h, v6.8b, v0.8b
|
||||
umlal v17.8h, v4.8b, v1.8b
|
||||
ld1 {v4.8B}, [x1], x2
|
||||
3: ld1 {v6.8B}, [x1], x2
|
||||
umull v16.8H, v4.8B, v0.8B
|
||||
umlal v16.8H, v6.8B, v1.8B
|
||||
ld1 {v4.8B}, [x1], x2
|
||||
umull v17.8H, v6.8B, v0.8B
|
||||
umlal v17.8H, v4.8B, v1.8B
|
||||
prfm pldl1strm, [x1]
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v16.8h, #6
|
||||
rshrn v17.8b, v17.8h, #6
|
||||
rshrn v16.8B, v16.8H, #6
|
||||
rshrn v17.8B, v17.8H, #6
|
||||
.else
|
||||
add v16.8h, v16.8h, v22.8h
|
||||
add v17.8h, v17.8h, v22.8h
|
||||
shrn v16.8b, v16.8h, #6
|
||||
shrn v17.8b, v17.8h, #6
|
||||
add v16.8H, v16.8H, v22.8H
|
||||
add v17.8H, v17.8H, v22.8H
|
||||
shrn v16.8B, v16.8H, #6
|
||||
shrn v17.8B, v17.8H, #6
|
||||
.endif
|
||||
prfm pldl1strm, [x1, x2]
|
||||
.ifc \type,avg
|
||||
ld1 {v20.8b}, [x8], x2
|
||||
ld1 {v21.8b}, [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
urhadd v17.8b, v17.8b, v21.8b
|
||||
ld1 {v20.8B}, [x8], x2
|
||||
ld1 {v21.8B}, [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
urhadd v17.8B, v17.8B, v21.8B
|
||||
.endif
|
||||
subs w3, w3, #2
|
||||
st1 {v16.8b}, [x0], x2
|
||||
st1 {v17.8b}, [x0], x2
|
||||
st1 {v16.8B}, [x0], x2
|
||||
st1 {v17.8B}, [x0], x2
|
||||
b.gt 3b
|
||||
ret
|
||||
|
||||
4: ld1 {v4.8b, v5.8b}, [x1], x2
|
||||
ld1 {v6.8b, v7.8b}, [x1], x2
|
||||
ext v5.8b, v4.8b, v5.8b, #1
|
||||
ext v7.8b, v6.8b, v7.8b, #1
|
||||
4: ld1 {v4.8B, v5.8B}, [x1], x2
|
||||
ld1 {v6.8B, v7.8B}, [x1], x2
|
||||
ext v5.8B, v4.8B, v5.8B, #1
|
||||
ext v7.8B, v6.8B, v7.8B, #1
|
||||
prfm pldl1strm, [x1]
|
||||
subs w3, w3, #2
|
||||
umull v16.8h, v4.8b, v0.8b
|
||||
umlal v16.8h, v5.8b, v1.8b
|
||||
umull v17.8h, v6.8b, v0.8b
|
||||
umlal v17.8h, v7.8b, v1.8b
|
||||
umull v16.8H, v4.8B, v0.8B
|
||||
umlal v16.8H, v5.8B, v1.8B
|
||||
umull v17.8H, v6.8B, v0.8B
|
||||
umlal v17.8H, v7.8B, v1.8B
|
||||
prfm pldl1strm, [x1, x2]
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v16.8h, #6
|
||||
rshrn v17.8b, v17.8h, #6
|
||||
rshrn v16.8B, v16.8H, #6
|
||||
rshrn v17.8B, v17.8H, #6
|
||||
.else
|
||||
add v16.8h, v16.8h, v22.8h
|
||||
add v17.8h, v17.8h, v22.8h
|
||||
shrn v16.8b, v16.8h, #6
|
||||
shrn v17.8b, v17.8h, #6
|
||||
add v16.8H, v16.8H, v22.8H
|
||||
add v17.8H, v17.8H, v22.8H
|
||||
shrn v16.8B, v16.8H, #6
|
||||
shrn v17.8B, v17.8H, #6
|
||||
.endif
|
||||
.ifc \type,avg
|
||||
ld1 {v20.8b}, [x8], x2
|
||||
ld1 {v21.8b}, [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
urhadd v17.8b, v17.8b, v21.8b
|
||||
ld1 {v20.8B}, [x8], x2
|
||||
ld1 {v21.8B}, [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
urhadd v17.8B, v17.8B, v21.8B
|
||||
.endif
|
||||
st1 {v16.8b}, [x0], x2
|
||||
st1 {v17.8b}, [x0], x2
|
||||
st1 {v16.8B}, [x0], x2
|
||||
st1 {v17.8B}, [x0], x2
|
||||
b.gt 4b
|
||||
ret
|
||||
|
||||
5: ld1 {v4.8b}, [x1], x2
|
||||
ld1 {v5.8b}, [x1], x2
|
||||
5: ld1 {v4.8B}, [x1], x2
|
||||
ld1 {v5.8B}, [x1], x2
|
||||
prfm pldl1strm, [x1]
|
||||
subs w3, w3, #2
|
||||
umull v16.8h, v4.8b, v0.8b
|
||||
umull v17.8h, v5.8b, v0.8b
|
||||
umull v16.8H, v4.8B, v0.8B
|
||||
umull v17.8H, v5.8B, v0.8B
|
||||
prfm pldl1strm, [x1, x2]
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v16.8h, #6
|
||||
rshrn v17.8b, v17.8h, #6
|
||||
rshrn v16.8B, v16.8H, #6
|
||||
rshrn v17.8B, v17.8H, #6
|
||||
.else
|
||||
add v16.8h, v16.8h, v22.8h
|
||||
add v17.8h, v17.8h, v22.8h
|
||||
shrn v16.8b, v16.8h, #6
|
||||
shrn v17.8b, v17.8h, #6
|
||||
add v16.8H, v16.8H, v22.8H
|
||||
add v17.8H, v17.8H, v22.8H
|
||||
shrn v16.8B, v16.8H, #6
|
||||
shrn v17.8B, v17.8H, #6
|
||||
.endif
|
||||
.ifc \type,avg
|
||||
ld1 {v20.8b}, [x8], x2
|
||||
ld1 {v21.8b}, [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
urhadd v17.8b, v17.8b, v21.8b
|
||||
ld1 {v20.8B}, [x8], x2
|
||||
ld1 {v21.8B}, [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
urhadd v17.8B, v17.8B, v21.8B
|
||||
.endif
|
||||
st1 {v16.8b}, [x0], x2
|
||||
st1 {v17.8b}, [x0], x2
|
||||
st1 {v16.8B}, [x0], x2
|
||||
st1 {v17.8B}, [x0], x2
|
||||
b.gt 5b
|
||||
ret
|
||||
endfunc
|
||||
@@ -208,11 +208,11 @@ function ff_\type\()_\codec\()_chroma_mc4_neon, export=1
|
||||
lsl w9, w9, #3
|
||||
lsl w10, w10, #1
|
||||
add w9, w9, w10
|
||||
add x6, x6, w9, uxtw
|
||||
ld1r {v22.8h}, [x6]
|
||||
add x6, x6, w9, UXTW
|
||||
ld1r {v22.8H}, [x6]
|
||||
.endif
|
||||
.ifc \codec,vc1
|
||||
movi v22.8h, #28
|
||||
movi v22.8H, #28
|
||||
.endif
|
||||
mul w7, w4, w5
|
||||
lsl w14, w5, #3
|
||||
@@ -225,133 +225,133 @@ function ff_\type\()_\codec\()_chroma_mc4_neon, export=1
|
||||
add w4, w4, #64
|
||||
b.eq 2f
|
||||
|
||||
dup v24.8b, w4
|
||||
dup v25.8b, w12
|
||||
ld1 {v4.8b}, [x1], x2
|
||||
dup v26.8b, w6
|
||||
dup v27.8b, w7
|
||||
ext v5.8b, v4.8b, v5.8b, #1
|
||||
trn1 v0.2s, v24.2s, v25.2s
|
||||
trn1 v2.2s, v26.2s, v27.2s
|
||||
trn1 v4.2s, v4.2s, v5.2s
|
||||
1: ld1 {v6.8b}, [x1], x2
|
||||
ext v7.8b, v6.8b, v7.8b, #1
|
||||
trn1 v6.2s, v6.2s, v7.2s
|
||||
umull v18.8h, v4.8b, v0.8b
|
||||
umlal v18.8h, v6.8b, v2.8b
|
||||
ld1 {v4.8b}, [x1], x2
|
||||
ext v5.8b, v4.8b, v5.8b, #1
|
||||
trn1 v4.2s, v4.2s, v5.2s
|
||||
dup v24.8B, w4
|
||||
dup v25.8B, w12
|
||||
ld1 {v4.8B}, [x1], x2
|
||||
dup v26.8B, w6
|
||||
dup v27.8B, w7
|
||||
ext v5.8B, v4.8B, v5.8B, #1
|
||||
trn1 v0.2S, v24.2S, v25.2S
|
||||
trn1 v2.2S, v26.2S, v27.2S
|
||||
trn1 v4.2S, v4.2S, v5.2S
|
||||
1: ld1 {v6.8B}, [x1], x2
|
||||
ext v7.8B, v6.8B, v7.8B, #1
|
||||
trn1 v6.2S, v6.2S, v7.2S
|
||||
umull v18.8H, v4.8B, v0.8B
|
||||
umlal v18.8H, v6.8B, v2.8B
|
||||
ld1 {v4.8B}, [x1], x2
|
||||
ext v5.8B, v4.8B, v5.8B, #1
|
||||
trn1 v4.2S, v4.2S, v5.2S
|
||||
prfm pldl1strm, [x1]
|
||||
umull v19.8h, v6.8b, v0.8b
|
||||
umlal v19.8h, v4.8b, v2.8b
|
||||
trn1 v30.2d, v18.2d, v19.2d
|
||||
trn2 v31.2d, v18.2d, v19.2d
|
||||
add v18.8h, v30.8h, v31.8h
|
||||
umull v19.8H, v6.8B, v0.8B
|
||||
umlal v19.8H, v4.8B, v2.8B
|
||||
trn1 v30.2D, v18.2D, v19.2D
|
||||
trn2 v31.2D, v18.2D, v19.2D
|
||||
add v18.8H, v30.8H, v31.8H
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v18.8h, #6
|
||||
rshrn v16.8B, v18.8H, #6
|
||||
.else
|
||||
add v18.8h, v18.8h, v22.8h
|
||||
shrn v16.8b, v18.8h, #6
|
||||
add v18.8H, v18.8H, v22.8H
|
||||
shrn v16.8B, v18.8H, #6
|
||||
.endif
|
||||
subs w3, w3, #2
|
||||
prfm pldl1strm, [x1, x2]
|
||||
.ifc \type,avg
|
||||
ld1 {v20.s}[0], [x8], x2
|
||||
ld1 {v20.s}[1], [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
ld1 {v20.S}[0], [x8], x2
|
||||
ld1 {v20.S}[1], [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
.endif
|
||||
st1 {v16.s}[0], [x0], x2
|
||||
st1 {v16.s}[1], [x0], x2
|
||||
st1 {v16.S}[0], [x0], x2
|
||||
st1 {v16.S}[1], [x0], x2
|
||||
b.gt 1b
|
||||
ret
|
||||
|
||||
2: adds w12, w12, w6
|
||||
dup v30.8b, w4
|
||||
dup v30.8B, w4
|
||||
b.eq 5f
|
||||
tst w6, w6
|
||||
dup v31.8b, w12
|
||||
trn1 v0.2s, v30.2s, v31.2s
|
||||
trn2 v1.2s, v30.2s, v31.2s
|
||||
dup v31.8B, w12
|
||||
trn1 v0.2S, v30.2S, v31.2S
|
||||
trn2 v1.2S, v30.2S, v31.2S
|
||||
b.eq 4f
|
||||
|
||||
ext v1.8b, v0.8b, v1.8b, #4
|
||||
ld1 {v4.s}[0], [x1], x2
|
||||
3: ld1 {v4.s}[1], [x1], x2
|
||||
umull v18.8h, v4.8b, v0.8b
|
||||
ld1 {v4.s}[0], [x1], x2
|
||||
umull v19.8h, v4.8b, v1.8b
|
||||
trn1 v30.2d, v18.2d, v19.2d
|
||||
trn2 v31.2d, v18.2d, v19.2d
|
||||
add v18.8h, v30.8h, v31.8h
|
||||
ext v1.8B, v0.8B, v1.8B, #4
|
||||
ld1 {v4.S}[0], [x1], x2
|
||||
3: ld1 {v4.S}[1], [x1], x2
|
||||
umull v18.8H, v4.8B, v0.8B
|
||||
ld1 {v4.S}[0], [x1], x2
|
||||
umull v19.8H, v4.8B, v1.8B
|
||||
trn1 v30.2D, v18.2D, v19.2D
|
||||
trn2 v31.2D, v18.2D, v19.2D
|
||||
add v18.8H, v30.8H, v31.8H
|
||||
prfm pldl1strm, [x1]
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v18.8h, #6
|
||||
rshrn v16.8B, v18.8H, #6
|
||||
.else
|
||||
add v18.8h, v18.8h, v22.8h
|
||||
shrn v16.8b, v18.8h, #6
|
||||
add v18.8H, v18.8H, v22.8H
|
||||
shrn v16.8B, v18.8H, #6
|
||||
.endif
|
||||
.ifc \type,avg
|
||||
ld1 {v20.s}[0], [x8], x2
|
||||
ld1 {v20.s}[1], [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
ld1 {v20.S}[0], [x8], x2
|
||||
ld1 {v20.S}[1], [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
.endif
|
||||
subs w3, w3, #2
|
||||
prfm pldl1strm, [x1, x2]
|
||||
st1 {v16.s}[0], [x0], x2
|
||||
st1 {v16.s}[1], [x0], x2
|
||||
st1 {v16.S}[0], [x0], x2
|
||||
st1 {v16.S}[1], [x0], x2
|
||||
b.gt 3b
|
||||
ret
|
||||
|
||||
4: ld1 {v4.8b}, [x1], x2
|
||||
ld1 {v6.8b}, [x1], x2
|
||||
ext v5.8b, v4.8b, v5.8b, #1
|
||||
ext v7.8b, v6.8b, v7.8b, #1
|
||||
trn1 v4.2s, v4.2s, v5.2s
|
||||
trn1 v6.2s, v6.2s, v7.2s
|
||||
umull v18.8h, v4.8b, v0.8b
|
||||
umull v19.8h, v6.8b, v0.8b
|
||||
4: ld1 {v4.8B}, [x1], x2
|
||||
ld1 {v6.8B}, [x1], x2
|
||||
ext v5.8B, v4.8B, v5.8B, #1
|
||||
ext v7.8B, v6.8B, v7.8B, #1
|
||||
trn1 v4.2S, v4.2S, v5.2S
|
||||
trn1 v6.2S, v6.2S, v7.2S
|
||||
umull v18.8H, v4.8B, v0.8B
|
||||
umull v19.8H, v6.8B, v0.8B
|
||||
subs w3, w3, #2
|
||||
trn1 v30.2d, v18.2d, v19.2d
|
||||
trn2 v31.2d, v18.2d, v19.2d
|
||||
add v18.8h, v30.8h, v31.8h
|
||||
trn1 v30.2D, v18.2D, v19.2D
|
||||
trn2 v31.2D, v18.2D, v19.2D
|
||||
add v18.8H, v30.8H, v31.8H
|
||||
prfm pldl1strm, [x1]
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v18.8h, #6
|
||||
rshrn v16.8B, v18.8H, #6
|
||||
.else
|
||||
add v18.8h, v18.8h, v22.8h
|
||||
shrn v16.8b, v18.8h, #6
|
||||
add v18.8H, v18.8H, v22.8H
|
||||
shrn v16.8B, v18.8H, #6
|
||||
.endif
|
||||
.ifc \type,avg
|
||||
ld1 {v20.s}[0], [x8], x2
|
||||
ld1 {v20.s}[1], [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
ld1 {v20.S}[0], [x8], x2
|
||||
ld1 {v20.S}[1], [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
.endif
|
||||
prfm pldl1strm, [x1]
|
||||
st1 {v16.s}[0], [x0], x2
|
||||
st1 {v16.s}[1], [x0], x2
|
||||
st1 {v16.S}[0], [x0], x2
|
||||
st1 {v16.S}[1], [x0], x2
|
||||
b.gt 4b
|
||||
ret
|
||||
|
||||
5: ld1 {v4.s}[0], [x1], x2
|
||||
ld1 {v4.s}[1], [x1], x2
|
||||
umull v18.8h, v4.8b, v30.8b
|
||||
5: ld1 {v4.S}[0], [x1], x2
|
||||
ld1 {v4.S}[1], [x1], x2
|
||||
umull v18.8H, v4.8B, v30.8B
|
||||
subs w3, w3, #2
|
||||
prfm pldl1strm, [x1]
|
||||
.ifc \codec,h264
|
||||
rshrn v16.8b, v18.8h, #6
|
||||
rshrn v16.8B, v18.8H, #6
|
||||
.else
|
||||
add v18.8h, v18.8h, v22.8h
|
||||
shrn v16.8b, v18.8h, #6
|
||||
add v18.8H, v18.8H, v22.8H
|
||||
shrn v16.8B, v18.8H, #6
|
||||
.endif
|
||||
.ifc \type,avg
|
||||
ld1 {v20.s}[0], [x8], x2
|
||||
ld1 {v20.s}[1], [x8], x2
|
||||
urhadd v16.8b, v16.8b, v20.8b
|
||||
ld1 {v20.S}[0], [x8], x2
|
||||
ld1 {v20.S}[1], [x8], x2
|
||||
urhadd v16.8B, v16.8B, v20.8B
|
||||
.endif
|
||||
prfm pldl1strm, [x1]
|
||||
st1 {v16.s}[0], [x0], x2
|
||||
st1 {v16.s}[1], [x0], x2
|
||||
st1 {v16.S}[0], [x0], x2
|
||||
st1 {v16.S}[1], [x0], x2
|
||||
b.gt 5b
|
||||
ret
|
||||
endfunc
|
||||
@@ -372,51 +372,51 @@ function ff_\type\()_h264_chroma_mc2_neon, export=1
|
||||
sub w4, w7, w13
|
||||
sub w4, w4, w14
|
||||
add w4, w4, #64
|
||||
dup v0.8b, w4
|
||||
dup v2.8b, w12
|
||||
dup v1.8b, w6
|
||||
dup v3.8b, w7
|
||||
trn1 v0.4h, v0.4h, v2.4h
|
||||
trn1 v1.4h, v1.4h, v3.4h
|
||||
dup v0.8B, w4
|
||||
dup v2.8B, w12
|
||||
dup v1.8B, w6
|
||||
dup v3.8B, w7
|
||||
trn1 v0.4H, v0.4H, v2.4H
|
||||
trn1 v1.4H, v1.4H, v3.4H
|
||||
1:
|
||||
ld1 {v4.s}[0], [x1], x2
|
||||
ld1 {v4.s}[1], [x1], x2
|
||||
rev64 v5.2s, v4.2s
|
||||
ld1 {v5.s}[1], [x1]
|
||||
ext v6.8b, v4.8b, v5.8b, #1
|
||||
ext v7.8b, v5.8b, v4.8b, #1
|
||||
trn1 v4.4h, v4.4h, v6.4h
|
||||
trn1 v5.4h, v5.4h, v7.4h
|
||||
umull v16.8h, v4.8b, v0.8b
|
||||
umlal v16.8h, v5.8b, v1.8b
|
||||
ld1 {v4.S}[0], [x1], x2
|
||||
ld1 {v4.S}[1], [x1], x2
|
||||
rev64 v5.2S, v4.2S
|
||||
ld1 {v5.S}[1], [x1]
|
||||
ext v6.8B, v4.8B, v5.8B, #1
|
||||
ext v7.8B, v5.8B, v4.8B, #1
|
||||
trn1 v4.4H, v4.4H, v6.4H
|
||||
trn1 v5.4H, v5.4H, v7.4H
|
||||
umull v16.8H, v4.8B, v0.8B
|
||||
umlal v16.8H, v5.8B, v1.8B
|
||||
.ifc \type,avg
|
||||
ld1 {v18.h}[0], [x0], x2
|
||||
ld1 {v18.h}[2], [x0]
|
||||
ld1 {v18.H}[0], [x0], x2
|
||||
ld1 {v18.H}[2], [x0]
|
||||
sub x0, x0, x2
|
||||
.endif
|
||||
rev64 v17.4s, v16.4s
|
||||
add v16.8h, v16.8h, v17.8h
|
||||
rshrn v16.8b, v16.8h, #6
|
||||
rev64 v17.4S, v16.4S
|
||||
add v16.8H, v16.8H, v17.8H
|
||||
rshrn v16.8B, v16.8H, #6
|
||||
.ifc \type,avg
|
||||
urhadd v16.8b, v16.8b, v18.8b
|
||||
urhadd v16.8B, v16.8B, v18.8B
|
||||
.endif
|
||||
st1 {v16.h}[0], [x0], x2
|
||||
st1 {v16.h}[2], [x0], x2
|
||||
st1 {v16.H}[0], [x0], x2
|
||||
st1 {v16.H}[2], [x0], x2
|
||||
subs w3, w3, #2
|
||||
b.gt 1b
|
||||
ret
|
||||
|
||||
2:
|
||||
ld1 {v16.h}[0], [x1], x2
|
||||
ld1 {v16.h}[1], [x1], x2
|
||||
ld1 {v16.H}[0], [x1], x2
|
||||
ld1 {v16.H}[1], [x1], x2
|
||||
.ifc \type,avg
|
||||
ld1 {v18.h}[0], [x0], x2
|
||||
ld1 {v18.h}[1], [x0]
|
||||
ld1 {v18.H}[0], [x0], x2
|
||||
ld1 {v18.H}[1], [x0]
|
||||
sub x0, x0, x2
|
||||
urhadd v16.8b, v16.8b, v18.8b
|
||||
urhadd v16.8B, v16.8B, v18.8B
|
||||
.endif
|
||||
st1 {v16.h}[0], [x0], x2
|
||||
st1 {v16.h}[1], [x0], x2
|
||||
st1 {v16.H}[0], [x0], x2
|
||||
st1 {v16.H}[1], [x0], x2
|
||||
subs w3, w3, #2
|
||||
b.gt 2b
|
||||
ret
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
cmp w2, #0
|
||||
ldr w6, [x4]
|
||||
ccmp w3, #0, #0, ne
|
||||
mov v24.s[0], w6
|
||||
mov v24.S[0], w6
|
||||
and w8, w6, w6, lsl #16
|
||||
b.eq 1f
|
||||
ands w8, w8, w8, lsl #8
|
||||
@@ -38,95 +38,95 @@
|
||||
.endm
|
||||
|
||||
.macro h264_loop_filter_luma
|
||||
dup v22.16b, w2 // alpha
|
||||
uxtl v24.8h, v24.8b
|
||||
uabd v21.16b, v16.16b, v0.16b // abs(p0 - q0)
|
||||
uxtl v24.4s, v24.4h
|
||||
uabd v28.16b, v18.16b, v16.16b // abs(p1 - p0)
|
||||
sli v24.8h, v24.8h, #8
|
||||
uabd v30.16b, v2.16b, v0.16b // abs(q1 - q0)
|
||||
sli v24.4s, v24.4s, #16
|
||||
cmhi v21.16b, v22.16b, v21.16b // < alpha
|
||||
dup v22.16b, w3 // beta
|
||||
cmlt v23.16b, v24.16b, #0
|
||||
cmhi v28.16b, v22.16b, v28.16b // < beta
|
||||
cmhi v30.16b, v22.16b, v30.16b // < beta
|
||||
bic v21.16b, v21.16b, v23.16b
|
||||
uabd v17.16b, v20.16b, v16.16b // abs(p2 - p0)
|
||||
and v21.16b, v21.16b, v28.16b
|
||||
uabd v19.16b, v4.16b, v0.16b // abs(q2 - q0)
|
||||
and v21.16b, v21.16b, v30.16b // < beta
|
||||
dup v22.16B, w2 // alpha
|
||||
uxtl v24.8H, v24.8B
|
||||
uabd v21.16B, v16.16B, v0.16B // abs(p0 - q0)
|
||||
uxtl v24.4S, v24.4H
|
||||
uabd v28.16B, v18.16B, v16.16B // abs(p1 - p0)
|
||||
sli v24.8H, v24.8H, #8
|
||||
uabd v30.16B, v2.16B, v0.16B // abs(q1 - q0)
|
||||
sli v24.4S, v24.4S, #16
|
||||
cmhi v21.16B, v22.16B, v21.16B // < alpha
|
||||
dup v22.16B, w3 // beta
|
||||
cmlt v23.16B, v24.16B, #0
|
||||
cmhi v28.16B, v22.16B, v28.16B // < beta
|
||||
cmhi v30.16B, v22.16B, v30.16B // < beta
|
||||
bic v21.16B, v21.16B, v23.16B
|
||||
uabd v17.16B, v20.16B, v16.16B // abs(p2 - p0)
|
||||
and v21.16B, v21.16B, v28.16B
|
||||
uabd v19.16B, v4.16B, v0.16B // abs(q2 - q0)
|
||||
and v21.16B, v21.16B, v30.16B // < beta
|
||||
shrn v30.8b, v21.8h, #4
|
||||
mov x7, v30.d[0]
|
||||
cmhi v17.16b, v22.16b, v17.16b // < beta
|
||||
cmhi v19.16b, v22.16b, v19.16b // < beta
|
||||
cmhi v17.16B, v22.16B, v17.16B // < beta
|
||||
cmhi v19.16B, v22.16B, v19.16B // < beta
|
||||
cbz x7, 9f
|
||||
and v17.16b, v17.16b, v21.16b
|
||||
and v19.16b, v19.16b, v21.16b
|
||||
and v24.16b, v24.16b, v21.16b
|
||||
urhadd v28.16b, v16.16b, v0.16b
|
||||
sub v21.16b, v24.16b, v17.16b
|
||||
uqadd v23.16b, v18.16b, v24.16b
|
||||
uhadd v20.16b, v20.16b, v28.16b
|
||||
sub v21.16b, v21.16b, v19.16b
|
||||
uhadd v28.16b, v4.16b, v28.16b
|
||||
umin v23.16b, v23.16b, v20.16b
|
||||
uqsub v22.16b, v18.16b, v24.16b
|
||||
uqadd v4.16b, v2.16b, v24.16b
|
||||
umax v23.16b, v23.16b, v22.16b
|
||||
uqsub v22.16b, v2.16b, v24.16b
|
||||
umin v28.16b, v4.16b, v28.16b
|
||||
uxtl v4.8h, v0.8b
|
||||
umax v28.16b, v28.16b, v22.16b
|
||||
uxtl2 v20.8h, v0.16b
|
||||
usubw v4.8h, v4.8h, v16.8b
|
||||
usubw2 v20.8h, v20.8h, v16.16b
|
||||
shl v4.8h, v4.8h, #2
|
||||
shl v20.8h, v20.8h, #2
|
||||
uaddw v4.8h, v4.8h, v18.8b
|
||||
uaddw2 v20.8h, v20.8h, v18.16b
|
||||
usubw v4.8h, v4.8h, v2.8b
|
||||
usubw2 v20.8h, v20.8h, v2.16b
|
||||
rshrn v4.8b, v4.8h, #3
|
||||
rshrn2 v4.16b, v20.8h, #3
|
||||
bsl v17.16b, v23.16b, v18.16b
|
||||
bsl v19.16b, v28.16b, v2.16b
|
||||
neg v23.16b, v21.16b
|
||||
uxtl v28.8h, v16.8b
|
||||
smin v4.16b, v4.16b, v21.16b
|
||||
uxtl2 v21.8h, v16.16b
|
||||
smax v4.16b, v4.16b, v23.16b
|
||||
uxtl v22.8h, v0.8b
|
||||
uxtl2 v24.8h, v0.16b
|
||||
saddw v28.8h, v28.8h, v4.8b
|
||||
saddw2 v21.8h, v21.8h, v4.16b
|
||||
ssubw v22.8h, v22.8h, v4.8b
|
||||
ssubw2 v24.8h, v24.8h, v4.16b
|
||||
sqxtun v16.8b, v28.8h
|
||||
sqxtun2 v16.16b, v21.8h
|
||||
sqxtun v0.8b, v22.8h
|
||||
sqxtun2 v0.16b, v24.8h
|
||||
and v17.16B, v17.16B, v21.16B
|
||||
and v19.16B, v19.16B, v21.16B
|
||||
and v24.16B, v24.16B, v21.16B
|
||||
urhadd v28.16B, v16.16B, v0.16B
|
||||
sub v21.16B, v24.16B, v17.16B
|
||||
uqadd v23.16B, v18.16B, v24.16B
|
||||
uhadd v20.16B, v20.16B, v28.16B
|
||||
sub v21.16B, v21.16B, v19.16B
|
||||
uhadd v28.16B, v4.16B, v28.16B
|
||||
umin v23.16B, v23.16B, v20.16B
|
||||
uqsub v22.16B, v18.16B, v24.16B
|
||||
uqadd v4.16B, v2.16B, v24.16B
|
||||
umax v23.16B, v23.16B, v22.16B
|
||||
uqsub v22.16B, v2.16B, v24.16B
|
||||
umin v28.16B, v4.16B, v28.16B
|
||||
uxtl v4.8H, v0.8B
|
||||
umax v28.16B, v28.16B, v22.16B
|
||||
uxtl2 v20.8H, v0.16B
|
||||
usubw v4.8H, v4.8H, v16.8B
|
||||
usubw2 v20.8H, v20.8H, v16.16B
|
||||
shl v4.8H, v4.8H, #2
|
||||
shl v20.8H, v20.8H, #2
|
||||
uaddw v4.8H, v4.8H, v18.8B
|
||||
uaddw2 v20.8H, v20.8H, v18.16B
|
||||
usubw v4.8H, v4.8H, v2.8B
|
||||
usubw2 v20.8H, v20.8H, v2.16B
|
||||
rshrn v4.8B, v4.8H, #3
|
||||
rshrn2 v4.16B, v20.8H, #3
|
||||
bsl v17.16B, v23.16B, v18.16B
|
||||
bsl v19.16B, v28.16B, v2.16B
|
||||
neg v23.16B, v21.16B
|
||||
uxtl v28.8H, v16.8B
|
||||
smin v4.16B, v4.16B, v21.16B
|
||||
uxtl2 v21.8H, v16.16B
|
||||
smax v4.16B, v4.16B, v23.16B
|
||||
uxtl v22.8H, v0.8B
|
||||
uxtl2 v24.8H, v0.16B
|
||||
saddw v28.8H, v28.8H, v4.8B
|
||||
saddw2 v21.8H, v21.8H, v4.16B
|
||||
ssubw v22.8H, v22.8H, v4.8B
|
||||
ssubw2 v24.8H, v24.8H, v4.16B
|
||||
sqxtun v16.8B, v28.8H
|
||||
sqxtun2 v16.16B, v21.8H
|
||||
sqxtun v0.8B, v22.8H
|
||||
sqxtun2 v0.16B, v24.8H
|
||||
.endm
|
||||
|
||||
function ff_h264_v_loop_filter_luma_neon, export=1
|
||||
h264_loop_filter_start
|
||||
|
||||
ld1 {v0.16b}, [x0], x1
|
||||
ld1 {v2.16b}, [x0], x1
|
||||
ld1 {v4.16b}, [x0], x1
|
||||
ld1 {v0.16B}, [x0], x1
|
||||
ld1 {v2.16B}, [x0], x1
|
||||
ld1 {v4.16B}, [x0], x1
|
||||
sub x0, x0, x1, lsl #2
|
||||
sub x0, x0, x1, lsl #1
|
||||
ld1 {v20.16b}, [x0], x1
|
||||
ld1 {v18.16b}, [x0], x1
|
||||
ld1 {v16.16b}, [x0], x1
|
||||
ld1 {v20.16B}, [x0], x1
|
||||
ld1 {v18.16B}, [x0], x1
|
||||
ld1 {v16.16B}, [x0], x1
|
||||
|
||||
h264_loop_filter_luma
|
||||
|
||||
sub x0, x0, x1, lsl #1
|
||||
st1 {v17.16b}, [x0], x1
|
||||
st1 {v16.16b}, [x0], x1
|
||||
st1 {v0.16b}, [x0], x1
|
||||
st1 {v19.16b}, [x0]
|
||||
st1 {v17.16B}, [x0], x1
|
||||
st1 {v16.16B}, [x0], x1
|
||||
st1 {v0.16B}, [x0], x1
|
||||
st1 {v19.16B}, [x0]
|
||||
9:
|
||||
ret
|
||||
endfunc
|
||||
@@ -135,22 +135,22 @@ function ff_h264_h_loop_filter_luma_neon, export=1
|
||||
h264_loop_filter_start
|
||||
|
||||
sub x0, x0, #4
|
||||
ld1 {v6.8b}, [x0], x1
|
||||
ld1 {v20.8b}, [x0], x1
|
||||
ld1 {v18.8b}, [x0], x1
|
||||
ld1 {v16.8b}, [x0], x1
|
||||
ld1 {v0.8b}, [x0], x1
|
||||
ld1 {v2.8b}, [x0], x1
|
||||
ld1 {v4.8b}, [x0], x1
|
||||
ld1 {v26.8b}, [x0], x1
|
||||
ld1 {v6.d}[1], [x0], x1
|
||||
ld1 {v20.d}[1], [x0], x1
|
||||
ld1 {v18.d}[1], [x0], x1
|
||||
ld1 {v16.d}[1], [x0], x1
|
||||
ld1 {v0.d}[1], [x0], x1
|
||||
ld1 {v2.d}[1], [x0], x1
|
||||
ld1 {v4.d}[1], [x0], x1
|
||||
ld1 {v26.d}[1], [x0], x1
|
||||
ld1 {v6.8B}, [x0], x1
|
||||
ld1 {v20.8B}, [x0], x1
|
||||
ld1 {v18.8B}, [x0], x1
|
||||
ld1 {v16.8B}, [x0], x1
|
||||
ld1 {v0.8B}, [x0], x1
|
||||
ld1 {v2.8B}, [x0], x1
|
||||
ld1 {v4.8B}, [x0], x1
|
||||
ld1 {v26.8B}, [x0], x1
|
||||
ld1 {v6.D}[1], [x0], x1
|
||||
ld1 {v20.D}[1], [x0], x1
|
||||
ld1 {v18.D}[1], [x0], x1
|
||||
ld1 {v16.D}[1], [x0], x1
|
||||
ld1 {v0.D}[1], [x0], x1
|
||||
ld1 {v2.D}[1], [x0], x1
|
||||
ld1 {v4.D}[1], [x0], x1
|
||||
ld1 {v26.D}[1], [x0], x1
|
||||
|
||||
transpose_8x16B v6, v20, v18, v16, v0, v2, v4, v26, v21, v23
|
||||
|
||||
@@ -160,22 +160,22 @@ function ff_h264_h_loop_filter_luma_neon, export=1
|
||||
|
||||
sub x0, x0, x1, lsl #4
|
||||
add x0, x0, #2
|
||||
st1 {v17.s}[0], [x0], x1
|
||||
st1 {v16.s}[0], [x0], x1
|
||||
st1 {v0.s}[0], [x0], x1
|
||||
st1 {v19.s}[0], [x0], x1
|
||||
st1 {v17.s}[1], [x0], x1
|
||||
st1 {v16.s}[1], [x0], x1
|
||||
st1 {v0.s}[1], [x0], x1
|
||||
st1 {v19.s}[1], [x0], x1
|
||||
st1 {v17.s}[2], [x0], x1
|
||||
st1 {v16.s}[2], [x0], x1
|
||||
st1 {v0.s}[2], [x0], x1
|
||||
st1 {v19.s}[2], [x0], x1
|
||||
st1 {v17.s}[3], [x0], x1
|
||||
st1 {v16.s}[3], [x0], x1
|
||||
st1 {v0.s}[3], [x0], x1
|
||||
st1 {v19.s}[3], [x0], x1
|
||||
st1 {v17.S}[0], [x0], x1
|
||||
st1 {v16.S}[0], [x0], x1
|
||||
st1 {v0.S}[0], [x0], x1
|
||||
st1 {v19.S}[0], [x0], x1
|
||||
st1 {v17.S}[1], [x0], x1
|
||||
st1 {v16.S}[1], [x0], x1
|
||||
st1 {v0.S}[1], [x0], x1
|
||||
st1 {v19.S}[1], [x0], x1
|
||||
st1 {v17.S}[2], [x0], x1
|
||||
st1 {v16.S}[2], [x0], x1
|
||||
st1 {v0.S}[2], [x0], x1
|
||||
st1 {v19.S}[2], [x0], x1
|
||||
st1 {v17.S}[3], [x0], x1
|
||||
st1 {v16.S}[3], [x0], x1
|
||||
st1 {v0.S}[3], [x0], x1
|
||||
st1 {v19.S}[3], [x0], x1
|
||||
9:
|
||||
ret
|
||||
endfunc
|
||||
@@ -377,52 +377,52 @@ function ff_h264_h_loop_filter_luma_intra_neon, export=1
|
||||
endfunc
|
||||
|
||||
.macro h264_loop_filter_chroma
|
||||
dup v22.8b, w2 // alpha
|
||||
dup v23.8b, w3 // beta
|
||||
uxtl v24.8h, v24.8b
|
||||
uabd v26.8b, v16.8b, v0.8b // abs(p0 - q0)
|
||||
uabd v28.8b, v18.8b, v16.8b // abs(p1 - p0)
|
||||
uabd v30.8b, v2.8b, v0.8b // abs(q1 - q0)
|
||||
cmhi v26.8b, v22.8b, v26.8b // < alpha
|
||||
cmhi v28.8b, v23.8b, v28.8b // < beta
|
||||
cmhi v30.8b, v23.8b, v30.8b // < beta
|
||||
uxtl v4.8h, v0.8b
|
||||
and v26.8b, v26.8b, v28.8b
|
||||
usubw v4.8h, v4.8h, v16.8b
|
||||
and v26.8b, v26.8b, v30.8b
|
||||
shl v4.8h, v4.8h, #2
|
||||
dup v22.8B, w2 // alpha
|
||||
dup v23.8B, w3 // beta
|
||||
uxtl v24.8H, v24.8B
|
||||
uabd v26.8B, v16.8B, v0.8B // abs(p0 - q0)
|
||||
uabd v28.8B, v18.8B, v16.8B // abs(p1 - p0)
|
||||
uabd v30.8B, v2.8B, v0.8B // abs(q1 - q0)
|
||||
cmhi v26.8B, v22.8B, v26.8B // < alpha
|
||||
cmhi v28.8B, v23.8B, v28.8B // < beta
|
||||
cmhi v30.8B, v23.8B, v30.8B // < beta
|
||||
uxtl v4.8H, v0.8B
|
||||
and v26.8B, v26.8B, v28.8B
|
||||
usubw v4.8H, v4.8H, v16.8B
|
||||
and v26.8B, v26.8B, v30.8B
|
||||
shl v4.8H, v4.8H, #2
|
||||
mov x8, v26.d[0]
|
||||
sli v24.8h, v24.8h, #8
|
||||
uaddw v4.8h, v4.8h, v18.8b
|
||||
sli v24.8H, v24.8H, #8
|
||||
uaddw v4.8H, v4.8H, v18.8B
|
||||
cbz x8, 9f
|
||||
usubw v4.8h, v4.8h, v2.8b
|
||||
rshrn v4.8b, v4.8h, #3
|
||||
smin v4.8b, v4.8b, v24.8b
|
||||
neg v25.8b, v24.8b
|
||||
smax v4.8b, v4.8b, v25.8b
|
||||
uxtl v22.8h, v0.8b
|
||||
and v4.8b, v4.8b, v26.8b
|
||||
uxtl v28.8h, v16.8b
|
||||
saddw v28.8h, v28.8h, v4.8b
|
||||
ssubw v22.8h, v22.8h, v4.8b
|
||||
sqxtun v16.8b, v28.8h
|
||||
sqxtun v0.8b, v22.8h
|
||||
usubw v4.8H, v4.8H, v2.8B
|
||||
rshrn v4.8B, v4.8H, #3
|
||||
smin v4.8B, v4.8B, v24.8B
|
||||
neg v25.8B, v24.8B
|
||||
smax v4.8B, v4.8B, v25.8B
|
||||
uxtl v22.8H, v0.8B
|
||||
and v4.8B, v4.8B, v26.8B
|
||||
uxtl v28.8H, v16.8B
|
||||
saddw v28.8H, v28.8H, v4.8B
|
||||
ssubw v22.8H, v22.8H, v4.8B
|
||||
sqxtun v16.8B, v28.8H
|
||||
sqxtun v0.8B, v22.8H
|
||||
.endm
|
||||
|
||||
function ff_h264_v_loop_filter_chroma_neon, export=1
|
||||
h264_loop_filter_start
|
||||
|
||||
sub x0, x0, x1, lsl #1
|
||||
ld1 {v18.8b}, [x0], x1
|
||||
ld1 {v16.8b}, [x0], x1
|
||||
ld1 {v0.8b}, [x0], x1
|
||||
ld1 {v2.8b}, [x0]
|
||||
ld1 {v18.8B}, [x0], x1
|
||||
ld1 {v16.8B}, [x0], x1
|
||||
ld1 {v0.8B}, [x0], x1
|
||||
ld1 {v2.8B}, [x0]
|
||||
|
||||
h264_loop_filter_chroma
|
||||
|
||||
sub x0, x0, x1, lsl #1
|
||||
st1 {v16.8b}, [x0], x1
|
||||
st1 {v0.8b}, [x0], x1
|
||||
st1 {v16.8B}, [x0], x1
|
||||
st1 {v0.8B}, [x0], x1
|
||||
9:
|
||||
ret
|
||||
endfunc
|
||||
@@ -432,14 +432,14 @@ function ff_h264_h_loop_filter_chroma_neon, export=1
|
||||
|
||||
sub x0, x0, #2
|
||||
h_loop_filter_chroma420:
|
||||
ld1 {v18.s}[0], [x0], x1
|
||||
ld1 {v16.s}[0], [x0], x1
|
||||
ld1 {v0.s}[0], [x0], x1
|
||||
ld1 {v2.s}[0], [x0], x1
|
||||
ld1 {v18.s}[1], [x0], x1
|
||||
ld1 {v16.s}[1], [x0], x1
|
||||
ld1 {v0.s}[1], [x0], x1
|
||||
ld1 {v2.s}[1], [x0], x1
|
||||
ld1 {v18.S}[0], [x0], x1
|
||||
ld1 {v16.S}[0], [x0], x1
|
||||
ld1 {v0.S}[0], [x0], x1
|
||||
ld1 {v2.S}[0], [x0], x1
|
||||
ld1 {v18.S}[1], [x0], x1
|
||||
ld1 {v16.S}[1], [x0], x1
|
||||
ld1 {v0.S}[1], [x0], x1
|
||||
ld1 {v2.S}[1], [x0], x1
|
||||
|
||||
transpose_4x8B v18, v16, v0, v2, v28, v29, v30, v31
|
||||
|
||||
@@ -448,14 +448,14 @@ h_loop_filter_chroma420:
|
||||
transpose_4x8B v18, v16, v0, v2, v28, v29, v30, v31
|
||||
|
||||
sub x0, x0, x1, lsl #3
|
||||
st1 {v18.s}[0], [x0], x1
|
||||
st1 {v16.s}[0], [x0], x1
|
||||
st1 {v0.s}[0], [x0], x1
|
||||
st1 {v2.s}[0], [x0], x1
|
||||
st1 {v18.s}[1], [x0], x1
|
||||
st1 {v16.s}[1], [x0], x1
|
||||
st1 {v0.s}[1], [x0], x1
|
||||
st1 {v2.s}[1], [x0], x1
|
||||
st1 {v18.S}[0], [x0], x1
|
||||
st1 {v16.S}[0], [x0], x1
|
||||
st1 {v0.S}[0], [x0], x1
|
||||
st1 {v2.S}[0], [x0], x1
|
||||
st1 {v18.S}[1], [x0], x1
|
||||
st1 {v16.S}[1], [x0], x1
|
||||
st1 {v0.S}[1], [x0], x1
|
||||
st1 {v2.S}[1], [x0], x1
|
||||
9:
|
||||
ret
|
||||
endfunc
|
||||
@@ -526,7 +526,7 @@ function ff_h264_h_loop_filter_chroma_mbaff_intra_neon, export=1
|
||||
ld1 {v17.8b}, [x4], x1
|
||||
ld1 {v19.8b}, [x4], x1
|
||||
|
||||
transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29
|
||||
transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29
|
||||
|
||||
h264_loop_filter_chroma_intra
|
||||
|
||||
@@ -554,7 +554,7 @@ h_loop_filter_chroma420_intra:
|
||||
ld1 {v17.s}[1], [x4], x1
|
||||
ld1 {v19.s}[1], [x4], x1
|
||||
|
||||
transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29
|
||||
transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29
|
||||
|
||||
h264_loop_filter_chroma_intra
|
||||
|
||||
@@ -584,102 +584,102 @@ function ff_h264_h_loop_filter_chroma422_intra_neon, export=1
|
||||
endfunc
|
||||
|
||||
.macro biweight_16 macs, macd
|
||||
dup v0.16b, w5
|
||||
dup v1.16b, w6
|
||||
mov v4.16b, v16.16b
|
||||
mov v6.16b, v16.16b
|
||||
dup v0.16B, w5
|
||||
dup v1.16B, w6
|
||||
mov v4.16B, v16.16B
|
||||
mov v6.16B, v16.16B
|
||||
1: subs w3, w3, #2
|
||||
ld1 {v20.16b}, [x0], x2
|
||||
\macd v4.8h, v0.8b, v20.8b
|
||||
ld1 {v20.16B}, [x0], x2
|
||||
\macd v4.8H, v0.8B, v20.8B
|
||||
\macd\()2 v6.8H, v0.16B, v20.16B
|
||||
ld1 {v22.16b}, [x1], x2
|
||||
\macs v4.8h, v1.8b, v22.8b
|
||||
ld1 {v22.16B}, [x1], x2
|
||||
\macs v4.8H, v1.8B, v22.8B
|
||||
\macs\()2 v6.8H, v1.16B, v22.16B
|
||||
mov v24.16b, v16.16b
|
||||
ld1 {v28.16b}, [x0], x2
|
||||
mov v26.16b, v16.16b
|
||||
\macd v24.8h, v0.8b, v28.8b
|
||||
mov v24.16B, v16.16B
|
||||
ld1 {v28.16B}, [x0], x2
|
||||
mov v26.16B, v16.16B
|
||||
\macd v24.8H, v0.8B, v28.8B
|
||||
\macd\()2 v26.8H, v0.16B, v28.16B
|
||||
ld1 {v30.16b}, [x1], x2
|
||||
\macs v24.8h, v1.8b, v30.8b
|
||||
ld1 {v30.16B}, [x1], x2
|
||||
\macs v24.8H, v1.8B, v30.8B
|
||||
\macs\()2 v26.8H, v1.16B, v30.16B
|
||||
sshl v4.8h, v4.8h, v18.8h
|
||||
sshl v6.8h, v6.8h, v18.8h
|
||||
sqxtun v4.8b, v4.8h
|
||||
sqxtun2 v4.16b, v6.8h
|
||||
sshl v24.8h, v24.8h, v18.8h
|
||||
sshl v26.8h, v26.8h, v18.8h
|
||||
sqxtun v24.8b, v24.8h
|
||||
sqxtun2 v24.16b, v26.8h
|
||||
mov v6.16b, v16.16b
|
||||
st1 {v4.16b}, [x7], x2
|
||||
mov v4.16b, v16.16b
|
||||
st1 {v24.16b}, [x7], x2
|
||||
sshl v4.8H, v4.8H, v18.8H
|
||||
sshl v6.8H, v6.8H, v18.8H
|
||||
sqxtun v4.8B, v4.8H
|
||||
sqxtun2 v4.16B, v6.8H
|
||||
sshl v24.8H, v24.8H, v18.8H
|
||||
sshl v26.8H, v26.8H, v18.8H
|
||||
sqxtun v24.8B, v24.8H
|
||||
sqxtun2 v24.16B, v26.8H
|
||||
mov v6.16B, v16.16B
|
||||
st1 {v4.16B}, [x7], x2
|
||||
mov v4.16B, v16.16B
|
||||
st1 {v24.16B}, [x7], x2
|
||||
b.ne 1b
|
||||
ret
|
||||
.endm
|
||||
|
||||
.macro biweight_8 macs, macd
|
||||
dup v0.8b, w5
|
||||
dup v1.8b, w6
|
||||
mov v2.16b, v16.16b
|
||||
mov v20.16b, v16.16b
|
||||
dup v0.8B, w5
|
||||
dup v1.8B, w6
|
||||
mov v2.16B, v16.16B
|
||||
mov v20.16B, v16.16B
|
||||
1: subs w3, w3, #2
|
||||
ld1 {v4.8b}, [x0], x2
|
||||
\macd v2.8h, v0.8b, v4.8b
|
||||
ld1 {v5.8b}, [x1], x2
|
||||
\macs v2.8h, v1.8b, v5.8b
|
||||
ld1 {v6.8b}, [x0], x2
|
||||
\macd v20.8h, v0.8b, v6.8b
|
||||
ld1 {v7.8b}, [x1], x2
|
||||
\macs v20.8h, v1.8b, v7.8b
|
||||
sshl v2.8h, v2.8h, v18.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
sshl v20.8h, v20.8h, v18.8h
|
||||
sqxtun v4.8b, v20.8h
|
||||
mov v20.16b, v16.16b
|
||||
st1 {v2.8b}, [x7], x2
|
||||
mov v2.16b, v16.16b
|
||||
st1 {v4.8b}, [x7], x2
|
||||
ld1 {v4.8B}, [x0], x2
|
||||
\macd v2.8H, v0.8B, v4.8B
|
||||
ld1 {v5.8B}, [x1], x2
|
||||
\macs v2.8H, v1.8B, v5.8B
|
||||
ld1 {v6.8B}, [x0], x2
|
||||
\macd v20.8H, v0.8B, v6.8B
|
||||
ld1 {v7.8B}, [x1], x2
|
||||
\macs v20.8H, v1.8B, v7.8B
|
||||
sshl v2.8H, v2.8H, v18.8H
|
||||
sqxtun v2.8B, v2.8H
|
||||
sshl v20.8H, v20.8H, v18.8H
|
||||
sqxtun v4.8B, v20.8H
|
||||
mov v20.16B, v16.16B
|
||||
st1 {v2.8B}, [x7], x2
|
||||
mov v2.16B, v16.16B
|
||||
st1 {v4.8B}, [x7], x2
|
||||
b.ne 1b
|
||||
ret
|
||||
.endm
|
||||
|
||||
.macro biweight_4 macs, macd
|
||||
dup v0.8b, w5
|
||||
dup v1.8b, w6
|
||||
mov v2.16b, v16.16b
|
||||
mov v20.16b,v16.16b
|
||||
dup v0.8B, w5
|
||||
dup v1.8B, w6
|
||||
mov v2.16B, v16.16B
|
||||
mov v20.16B,v16.16B
|
||||
1: subs w3, w3, #4
|
||||
ld1 {v4.s}[0], [x0], x2
|
||||
ld1 {v4.s}[1], [x0], x2
|
||||
\macd v2.8h, v0.8b, v4.8b
|
||||
ld1 {v5.s}[0], [x1], x2
|
||||
ld1 {v5.s}[1], [x1], x2
|
||||
\macs v2.8h, v1.8b, v5.8b
|
||||
ld1 {v4.S}[0], [x0], x2
|
||||
ld1 {v4.S}[1], [x0], x2
|
||||
\macd v2.8H, v0.8B, v4.8B
|
||||
ld1 {v5.S}[0], [x1], x2
|
||||
ld1 {v5.S}[1], [x1], x2
|
||||
\macs v2.8H, v1.8B, v5.8B
|
||||
b.lt 2f
|
||||
ld1 {v6.s}[0], [x0], x2
|
||||
ld1 {v6.s}[1], [x0], x2
|
||||
\macd v20.8h, v0.8b, v6.8b
|
||||
ld1 {v7.s}[0], [x1], x2
|
||||
ld1 {v7.s}[1], [x1], x2
|
||||
\macs v20.8h, v1.8b, v7.8b
|
||||
sshl v2.8h, v2.8h, v18.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
sshl v20.8h, v20.8h, v18.8h
|
||||
sqxtun v4.8b, v20.8h
|
||||
mov v20.16b, v16.16b
|
||||
st1 {v2.s}[0], [x7], x2
|
||||
st1 {v2.s}[1], [x7], x2
|
||||
mov v2.16b, v16.16b
|
||||
st1 {v4.s}[0], [x7], x2
|
||||
st1 {v4.s}[1], [x7], x2
|
||||
ld1 {v6.S}[0], [x0], x2
|
||||
ld1 {v6.S}[1], [x0], x2
|
||||
\macd v20.8H, v0.8B, v6.8B
|
||||
ld1 {v7.S}[0], [x1], x2
|
||||
ld1 {v7.S}[1], [x1], x2
|
||||
\macs v20.8H, v1.8B, v7.8B
|
||||
sshl v2.8H, v2.8H, v18.8H
|
||||
sqxtun v2.8B, v2.8H
|
||||
sshl v20.8H, v20.8H, v18.8H
|
||||
sqxtun v4.8B, v20.8H
|
||||
mov v20.16B, v16.16B
|
||||
st1 {v2.S}[0], [x7], x2
|
||||
st1 {v2.S}[1], [x7], x2
|
||||
mov v2.16B, v16.16B
|
||||
st1 {v4.S}[0], [x7], x2
|
||||
st1 {v4.S}[1], [x7], x2
|
||||
b.ne 1b
|
||||
ret
|
||||
2: sshl v2.8h, v2.8h, v18.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
st1 {v2.s}[0], [x7], x2
|
||||
st1 {v2.s}[1], [x7], x2
|
||||
2: sshl v2.8H, v2.8H, v18.8H
|
||||
sqxtun v2.8B, v2.8H
|
||||
st1 {v2.S}[0], [x7], x2
|
||||
st1 {v2.S}[1], [x7], x2
|
||||
ret
|
||||
.endm
|
||||
|
||||
@@ -689,10 +689,10 @@ function ff_biweight_h264_pixels_\w\()_neon, export=1
|
||||
add w7, w7, #1
|
||||
eor w8, w8, w6, lsr #30
|
||||
orr w7, w7, #1
|
||||
dup v18.8h, w4
|
||||
dup v18.8H, w4
|
||||
lsl w7, w7, w4
|
||||
not v18.16b, v18.16b
|
||||
dup v16.8h, w7
|
||||
not v18.16B, v18.16B
|
||||
dup v16.8H, w7
|
||||
mov x7, x0
|
||||
cbz w8, 10f
|
||||
subs w8, w8, #1
|
||||
@@ -716,78 +716,78 @@ endfunc
|
||||
biweight_func 4
|
||||
|
||||
.macro weight_16 add
|
||||
dup v0.16b, w4
|
||||
dup v0.16B, w4
|
||||
1: subs w2, w2, #2
|
||||
ld1 {v20.16b}, [x0], x1
|
||||
umull v4.8h, v0.8b, v20.8b
|
||||
umull2 v6.8h, v0.16b, v20.16b
|
||||
ld1 {v28.16b}, [x0], x1
|
||||
umull v24.8h, v0.8b, v28.8b
|
||||
umull2 v26.8h, v0.16b, v28.16b
|
||||
\add v4.8h, v16.8h, v4.8h
|
||||
srshl v4.8h, v4.8h, v18.8h
|
||||
\add v6.8h, v16.8h, v6.8h
|
||||
srshl v6.8h, v6.8h, v18.8h
|
||||
sqxtun v4.8b, v4.8h
|
||||
sqxtun2 v4.16b, v6.8h
|
||||
\add v24.8h, v16.8h, v24.8h
|
||||
srshl v24.8h, v24.8h, v18.8h
|
||||
\add v26.8h, v16.8h, v26.8h
|
||||
srshl v26.8h, v26.8h, v18.8h
|
||||
sqxtun v24.8b, v24.8h
|
||||
sqxtun2 v24.16b, v26.8h
|
||||
st1 {v4.16b}, [x5], x1
|
||||
st1 {v24.16b}, [x5], x1
|
||||
ld1 {v20.16B}, [x0], x1
|
||||
umull v4.8H, v0.8B, v20.8B
|
||||
umull2 v6.8H, v0.16B, v20.16B
|
||||
ld1 {v28.16B}, [x0], x1
|
||||
umull v24.8H, v0.8B, v28.8B
|
||||
umull2 v26.8H, v0.16B, v28.16B
|
||||
\add v4.8H, v16.8H, v4.8H
|
||||
srshl v4.8H, v4.8H, v18.8H
|
||||
\add v6.8H, v16.8H, v6.8H
|
||||
srshl v6.8H, v6.8H, v18.8H
|
||||
sqxtun v4.8B, v4.8H
|
||||
sqxtun2 v4.16B, v6.8H
|
||||
\add v24.8H, v16.8H, v24.8H
|
||||
srshl v24.8H, v24.8H, v18.8H
|
||||
\add v26.8H, v16.8H, v26.8H
|
||||
srshl v26.8H, v26.8H, v18.8H
|
||||
sqxtun v24.8B, v24.8H
|
||||
sqxtun2 v24.16B, v26.8H
|
||||
st1 {v4.16B}, [x5], x1
|
||||
st1 {v24.16B}, [x5], x1
|
||||
b.ne 1b
|
||||
ret
|
||||
.endm
|
||||
|
||||
.macro weight_8 add
|
||||
dup v0.8b, w4
|
||||
dup v0.8B, w4
|
||||
1: subs w2, w2, #2
|
||||
ld1 {v4.8b}, [x0], x1
|
||||
umull v2.8h, v0.8b, v4.8b
|
||||
ld1 {v6.8b}, [x0], x1
|
||||
umull v20.8h, v0.8b, v6.8b
|
||||
\add v2.8h, v16.8h, v2.8h
|
||||
srshl v2.8h, v2.8h, v18.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
\add v20.8h, v16.8h, v20.8h
|
||||
srshl v20.8h, v20.8h, v18.8h
|
||||
sqxtun v4.8b, v20.8h
|
||||
st1 {v2.8b}, [x5], x1
|
||||
st1 {v4.8b}, [x5], x1
|
||||
ld1 {v4.8B}, [x0], x1
|
||||
umull v2.8H, v0.8B, v4.8B
|
||||
ld1 {v6.8B}, [x0], x1
|
||||
umull v20.8H, v0.8B, v6.8B
|
||||
\add v2.8H, v16.8H, v2.8H
|
||||
srshl v2.8H, v2.8H, v18.8H
|
||||
sqxtun v2.8B, v2.8H
|
||||
\add v20.8H, v16.8H, v20.8H
|
||||
srshl v20.8H, v20.8H, v18.8H
|
||||
sqxtun v4.8B, v20.8H
|
||||
st1 {v2.8B}, [x5], x1
|
||||
st1 {v4.8B}, [x5], x1
|
||||
b.ne 1b
|
||||
ret
|
||||
.endm
|
||||
|
||||
.macro weight_4 add
|
||||
dup v0.8b, w4
|
||||
dup v0.8B, w4
|
||||
1: subs w2, w2, #4
|
||||
ld1 {v4.s}[0], [x0], x1
|
||||
ld1 {v4.s}[1], [x0], x1
|
||||
umull v2.8h, v0.8b, v4.8b
|
||||
ld1 {v4.S}[0], [x0], x1
|
||||
ld1 {v4.S}[1], [x0], x1
|
||||
umull v2.8H, v0.8B, v4.8B
|
||||
b.lt 2f
|
||||
ld1 {v6.s}[0], [x0], x1
|
||||
ld1 {v6.s}[1], [x0], x1
|
||||
umull v20.8h, v0.8b, v6.8b
|
||||
\add v2.8h, v16.8h, v2.8h
|
||||
srshl v2.8h, v2.8h, v18.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
\add v20.8h, v16.8h, v20.8h
|
||||
srshl v20.8h, v20.8h, v18.8h
|
||||
sqxtun v4.8b, v20.8h
|
||||
st1 {v2.s}[0], [x5], x1
|
||||
st1 {v2.s}[1], [x5], x1
|
||||
st1 {v4.s}[0], [x5], x1
|
||||
st1 {v4.s}[1], [x5], x1
|
||||
ld1 {v6.S}[0], [x0], x1
|
||||
ld1 {v6.S}[1], [x0], x1
|
||||
umull v20.8H, v0.8B, v6.8B
|
||||
\add v2.8H, v16.8H, v2.8H
|
||||
srshl v2.8H, v2.8H, v18.8H
|
||||
sqxtun v2.8B, v2.8H
|
||||
\add v20.8H, v16.8H, v20.8H
|
||||
srshl v20.8H, v20.8h, v18.8H
|
||||
sqxtun v4.8B, v20.8H
|
||||
st1 {v2.S}[0], [x5], x1
|
||||
st1 {v2.S}[1], [x5], x1
|
||||
st1 {v4.S}[0], [x5], x1
|
||||
st1 {v4.S}[1], [x5], x1
|
||||
b.ne 1b
|
||||
ret
|
||||
2: \add v2.8h, v16.8h, v2.8h
|
||||
srshl v2.8h, v2.8h, v18.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
st1 {v2.s}[0], [x5], x1
|
||||
st1 {v2.s}[1], [x5], x1
|
||||
2: \add v2.8H, v16.8H, v2.8H
|
||||
srshl v2.8H, v2.8H, v18.8H
|
||||
sqxtun v2.8B, v2.8H
|
||||
st1 {v2.S}[0], [x5], x1
|
||||
st1 {v2.S}[1], [x5], x1
|
||||
ret
|
||||
.endm
|
||||
|
||||
@@ -796,18 +796,18 @@ function ff_weight_h264_pixels_\w\()_neon, export=1
|
||||
cmp w3, #1
|
||||
mov w6, #1
|
||||
lsl w5, w5, w3
|
||||
dup v16.8h, w5
|
||||
dup v16.8H, w5
|
||||
mov x5, x0
|
||||
b.le 20f
|
||||
sub w6, w6, w3
|
||||
dup v18.8h, w6
|
||||
dup v18.8H, w6
|
||||
cmp w4, #0
|
||||
b.lt 10f
|
||||
weight_\w shadd
|
||||
10: neg w4, w4
|
||||
weight_\w shsub
|
||||
20: neg w6, w3
|
||||
dup v18.8h, w6
|
||||
dup v18.8H, w6
|
||||
cmp w4, #0
|
||||
b.lt 10f
|
||||
weight_\w add
|
||||
@@ -825,7 +825,7 @@ endfunc
|
||||
ldr w6, [x4]
|
||||
ccmp w3, #0, #0, ne
|
||||
lsl w2, w2, #2
|
||||
mov v24.s[0], w6
|
||||
mov v24.S[0], w6
|
||||
lsl w3, w3, #2
|
||||
and w8, w6, w6, lsl #16
|
||||
b.eq 1f
|
||||
@@ -1017,7 +1017,7 @@ function ff_h264_h_loop_filter_chroma_mbaff_intra_neon_10, export=1
|
||||
ld1 {v16.8h}, [x4], x1
|
||||
ld1 {v19.8h}, [x9], x1
|
||||
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
|
||||
h264_loop_filter_chroma_intra_10
|
||||
|
||||
@@ -1045,7 +1045,7 @@ h_loop_filter_chroma420_intra_10:
|
||||
ld1 {v19.4h}, [x4], x1
|
||||
ld1 {v19.d}[1], [x9], x1
|
||||
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
|
||||
h264_loop_filter_chroma_intra_10
|
||||
|
||||
|
||||
@@ -25,54 +25,54 @@
|
||||
function ff_h264_idct_add_neon, export=1
|
||||
.L_ff_h264_idct_add_neon:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
ld1 {v0.4h, v1.4h, v2.4h, v3.4h}, [x1]
|
||||
ld1 {v0.4H, v1.4H, v2.4H, v3.4H}, [x1]
|
||||
sxtw x2, w2
|
||||
movi v30.8h, #0
|
||||
movi v30.8H, #0
|
||||
|
||||
add v4.4h, v0.4h, v2.4h
|
||||
sshr v16.4h, v1.4h, #1
|
||||
st1 {v30.8h}, [x1], #16
|
||||
sshr v17.4h, v3.4h, #1
|
||||
st1 {v30.8h}, [x1], #16
|
||||
sub v5.4h, v0.4h, v2.4h
|
||||
sub v6.4h, v16.4h, v3.4h
|
||||
add v7.4h, v1.4h, v17.4h
|
||||
add v0.4h, v4.4h, v7.4h
|
||||
add v1.4h, v5.4h, v6.4h
|
||||
sub v2.4h, v5.4h, v6.4h
|
||||
sub v3.4h, v4.4h, v7.4h
|
||||
add v4.4H, v0.4H, v2.4H
|
||||
sshr v16.4H, v1.4H, #1
|
||||
st1 {v30.8H}, [x1], #16
|
||||
sshr v17.4H, v3.4H, #1
|
||||
st1 {v30.8H}, [x1], #16
|
||||
sub v5.4H, v0.4H, v2.4H
|
||||
sub v6.4H, v16.4H, v3.4H
|
||||
add v7.4H, v1.4H, v17.4H
|
||||
add v0.4H, v4.4H, v7.4H
|
||||
add v1.4H, v5.4H, v6.4H
|
||||
sub v2.4H, v5.4H, v6.4H
|
||||
sub v3.4H, v4.4H, v7.4H
|
||||
|
||||
transpose_4x4H v0, v1, v2, v3, v4, v5, v6, v7
|
||||
|
||||
add v4.4h, v0.4h, v2.4h
|
||||
ld1 {v18.s}[0], [x0], x2
|
||||
sshr v16.4h, v3.4h, #1
|
||||
sshr v17.4h, v1.4h, #1
|
||||
ld1 {v18.s}[1], [x0], x2
|
||||
sub v5.4h, v0.4h, v2.4h
|
||||
ld1 {v19.s}[1], [x0], x2
|
||||
add v6.4h, v16.4h, v1.4h
|
||||
ins v4.d[1], v5.d[0]
|
||||
sub v7.4h, v17.4h, v3.4h
|
||||
ld1 {v19.s}[0], [x0], x2
|
||||
ins v6.d[1], v7.d[0]
|
||||
add v4.4H, v0.4H, v2.4H
|
||||
ld1 {v18.S}[0], [x0], x2
|
||||
sshr v16.4H, v3.4H, #1
|
||||
sshr v17.4H, v1.4H, #1
|
||||
ld1 {v18.S}[1], [x0], x2
|
||||
sub v5.4H, v0.4H, v2.4H
|
||||
ld1 {v19.S}[1], [x0], x2
|
||||
add v6.4H, v16.4H, v1.4H
|
||||
ins v4.D[1], v5.D[0]
|
||||
sub v7.4H, v17.4H, v3.4H
|
||||
ld1 {v19.S}[0], [x0], x2
|
||||
ins v6.D[1], v7.D[0]
|
||||
sub x0, x0, x2, lsl #2
|
||||
add v0.8h, v4.8h, v6.8h
|
||||
sub v1.8h, v4.8h, v6.8h
|
||||
add v0.8H, v4.8H, v6.8H
|
||||
sub v1.8H, v4.8H, v6.8H
|
||||
|
||||
srshr v0.8h, v0.8h, #6
|
||||
srshr v1.8h, v1.8h, #6
|
||||
srshr v0.8H, v0.8H, #6
|
||||
srshr v1.8H, v1.8H, #6
|
||||
|
||||
uaddw v0.8h, v0.8h, v18.8b
|
||||
uaddw v1.8h, v1.8h, v19.8b
|
||||
uaddw v0.8H, v0.8H, v18.8B
|
||||
uaddw v1.8H, v1.8H, v19.8B
|
||||
|
||||
sqxtun v0.8b, v0.8h
|
||||
sqxtun v1.8b, v1.8h
|
||||
sqxtun v0.8B, v0.8H
|
||||
sqxtun v1.8B, v1.8H
|
||||
|
||||
st1 {v0.s}[0], [x0], x2
|
||||
st1 {v0.s}[1], [x0], x2
|
||||
st1 {v1.s}[1], [x0], x2
|
||||
st1 {v1.s}[0], [x0], x2
|
||||
st1 {v0.S}[0], [x0], x2
|
||||
st1 {v0.S}[1], [x0], x2
|
||||
st1 {v1.S}[1], [x0], x2
|
||||
st1 {v1.S}[0], [x0], x2
|
||||
|
||||
sub x1, x1, #32
|
||||
ret
|
||||
@@ -83,22 +83,22 @@ function ff_h264_idct_dc_add_neon, export=1
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
sxtw x2, w2
|
||||
mov w3, #0
|
||||
ld1r {v2.8h}, [x1]
|
||||
ld1r {v2.8H}, [x1]
|
||||
strh w3, [x1]
|
||||
srshr v2.8h, v2.8h, #6
|
||||
ld1 {v0.s}[0], [x0], x2
|
||||
ld1 {v0.s}[1], [x0], x2
|
||||
uaddw v3.8h, v2.8h, v0.8b
|
||||
ld1 {v1.s}[0], [x0], x2
|
||||
ld1 {v1.s}[1], [x0], x2
|
||||
uaddw v4.8h, v2.8h, v1.8b
|
||||
sqxtun v0.8b, v3.8h
|
||||
sqxtun v1.8b, v4.8h
|
||||
srshr v2.8H, v2.8H, #6
|
||||
ld1 {v0.S}[0], [x0], x2
|
||||
ld1 {v0.S}[1], [x0], x2
|
||||
uaddw v3.8H, v2.8H, v0.8B
|
||||
ld1 {v1.S}[0], [x0], x2
|
||||
ld1 {v1.S}[1], [x0], x2
|
||||
uaddw v4.8H, v2.8H, v1.8B
|
||||
sqxtun v0.8B, v3.8H
|
||||
sqxtun v1.8B, v4.8H
|
||||
sub x0, x0, x2, lsl #2
|
||||
st1 {v0.s}[0], [x0], x2
|
||||
st1 {v0.s}[1], [x0], x2
|
||||
st1 {v1.s}[0], [x0], x2
|
||||
st1 {v1.s}[1], [x0], x2
|
||||
st1 {v0.S}[0], [x0], x2
|
||||
st1 {v0.S}[1], [x0], x2
|
||||
st1 {v1.S}[0], [x0], x2
|
||||
st1 {v1.S}[1], [x0], x2
|
||||
ret
|
||||
endfunc
|
||||
|
||||
@@ -194,71 +194,71 @@ endfunc
|
||||
.if \pass == 0
|
||||
va .req v18
|
||||
vb .req v30
|
||||
sshr v18.8h, v26.8h, #1
|
||||
add v16.8h, v24.8h, v28.8h
|
||||
ld1 {v30.8h, v31.8h}, [x1]
|
||||
st1 {v19.8h}, [x1], #16
|
||||
st1 {v19.8h}, [x1], #16
|
||||
sub v17.8h, v24.8h, v28.8h
|
||||
sshr v19.8h, v30.8h, #1
|
||||
sub v18.8h, v18.8h, v30.8h
|
||||
add v19.8h, v19.8h, v26.8h
|
||||
sshr v18.8H, v26.8H, #1
|
||||
add v16.8H, v24.8H, v28.8H
|
||||
ld1 {v30.8H, v31.8H}, [x1]
|
||||
st1 {v19.8H}, [x1], #16
|
||||
st1 {v19.8H}, [x1], #16
|
||||
sub v17.8H, v24.8H, v28.8H
|
||||
sshr v19.8H, v30.8H, #1
|
||||
sub v18.8H, v18.8H, v30.8H
|
||||
add v19.8H, v19.8H, v26.8H
|
||||
.else
|
||||
va .req v30
|
||||
vb .req v18
|
||||
sshr v30.8h, v26.8h, #1
|
||||
sshr v19.8h, v18.8h, #1
|
||||
add v16.8h, v24.8h, v28.8h
|
||||
sub v17.8h, v24.8h, v28.8h
|
||||
sub v30.8h, v30.8h, v18.8h
|
||||
add v19.8h, v19.8h, v26.8h
|
||||
sshr v30.8H, v26.8H, #1
|
||||
sshr v19.8H, v18.8H, #1
|
||||
add v16.8H, v24.8H, v28.8H
|
||||
sub v17.8H, v24.8H, v28.8H
|
||||
sub v30.8H, v30.8H, v18.8H
|
||||
add v19.8H, v19.8H, v26.8H
|
||||
.endif
|
||||
add v26.8h, v17.8h, va.8h
|
||||
sub v28.8h, v17.8h, va.8h
|
||||
add v24.8h, v16.8h, v19.8h
|
||||
sub vb.8h, v16.8h, v19.8h
|
||||
sub v16.8h, v29.8h, v27.8h
|
||||
add v17.8h, v31.8h, v25.8h
|
||||
sub va.8h, v31.8h, v25.8h
|
||||
add v19.8h, v29.8h, v27.8h
|
||||
sub v16.8h, v16.8h, v31.8h
|
||||
sub v17.8h, v17.8h, v27.8h
|
||||
add va.8h, va.8h, v29.8h
|
||||
add v19.8h, v19.8h, v25.8h
|
||||
sshr v25.8h, v25.8h, #1
|
||||
sshr v27.8h, v27.8h, #1
|
||||
sshr v29.8h, v29.8h, #1
|
||||
sshr v31.8h, v31.8h, #1
|
||||
sub v16.8h, v16.8h, v31.8h
|
||||
sub v17.8h, v17.8h, v27.8h
|
||||
add va.8h, va.8h, v29.8h
|
||||
add v19.8h, v19.8h, v25.8h
|
||||
sshr v25.8h, v16.8h, #2
|
||||
sshr v27.8h, v17.8h, #2
|
||||
sshr v29.8h, va.8h, #2
|
||||
sshr v31.8h, v19.8h, #2
|
||||
sub v19.8h, v19.8h, v25.8h
|
||||
sub va.8h, v27.8h, va.8h
|
||||
add v17.8h, v17.8h, v29.8h
|
||||
add v16.8h, v16.8h, v31.8h
|
||||
add v26.8H, v17.8H, va.8H
|
||||
sub v28.8H, v17.8H, va.8H
|
||||
add v24.8H, v16.8H, v19.8H
|
||||
sub vb.8H, v16.8H, v19.8H
|
||||
sub v16.8H, v29.8H, v27.8H
|
||||
add v17.8H, v31.8H, v25.8H
|
||||
sub va.8H, v31.8H, v25.8H
|
||||
add v19.8H, v29.8H, v27.8H
|
||||
sub v16.8H, v16.8H, v31.8H
|
||||
sub v17.8H, v17.8H, v27.8H
|
||||
add va.8H, va.8H, v29.8H
|
||||
add v19.8H, v19.8H, v25.8H
|
||||
sshr v25.8H, v25.8H, #1
|
||||
sshr v27.8H, v27.8H, #1
|
||||
sshr v29.8H, v29.8H, #1
|
||||
sshr v31.8H, v31.8H, #1
|
||||
sub v16.8H, v16.8H, v31.8H
|
||||
sub v17.8H, v17.8H, v27.8H
|
||||
add va.8H, va.8H, v29.8H
|
||||
add v19.8H, v19.8H, v25.8H
|
||||
sshr v25.8H, v16.8H, #2
|
||||
sshr v27.8H, v17.8H, #2
|
||||
sshr v29.8H, va.8H, #2
|
||||
sshr v31.8H, v19.8H, #2
|
||||
sub v19.8H, v19.8H, v25.8H
|
||||
sub va.8H, v27.8H, va.8H
|
||||
add v17.8H, v17.8H, v29.8H
|
||||
add v16.8H, v16.8H, v31.8H
|
||||
.if \pass == 0
|
||||
sub v31.8h, v24.8h, v19.8h
|
||||
add v24.8h, v24.8h, v19.8h
|
||||
add v25.8h, v26.8h, v18.8h
|
||||
sub v18.8h, v26.8h, v18.8h
|
||||
add v26.8h, v28.8h, v17.8h
|
||||
add v27.8h, v30.8h, v16.8h
|
||||
sub v29.8h, v28.8h, v17.8h
|
||||
sub v28.8h, v30.8h, v16.8h
|
||||
sub v31.8H, v24.8H, v19.8H
|
||||
add v24.8H, v24.8H, v19.8H
|
||||
add v25.8H, v26.8H, v18.8H
|
||||
sub v18.8H, v26.8H, v18.8H
|
||||
add v26.8H, v28.8H, v17.8H
|
||||
add v27.8H, v30.8H, v16.8H
|
||||
sub v29.8H, v28.8H, v17.8H
|
||||
sub v28.8H, v30.8H, v16.8H
|
||||
.else
|
||||
sub v31.8h, v24.8h, v19.8h
|
||||
add v24.8h, v24.8h, v19.8h
|
||||
add v25.8h, v26.8h, v30.8h
|
||||
sub v30.8h, v26.8h, v30.8h
|
||||
add v26.8h, v28.8h, v17.8h
|
||||
sub v29.8h, v28.8h, v17.8h
|
||||
add v27.8h, v18.8h, v16.8h
|
||||
sub v28.8h, v18.8h, v16.8h
|
||||
sub v31.8H, v24.8H, v19.8H
|
||||
add v24.8H, v24.8H, v19.8H
|
||||
add v25.8H, v26.8H, v30.8H
|
||||
sub v30.8H, v26.8H, v30.8H
|
||||
add v26.8H, v28.8H, v17.8H
|
||||
sub v29.8H, v28.8H, v17.8H
|
||||
add v27.8H, v18.8H, v16.8H
|
||||
sub v28.8H, v18.8H, v16.8H
|
||||
.endif
|
||||
.unreq va
|
||||
.unreq vb
|
||||
@@ -267,63 +267,63 @@ endfunc
|
||||
function ff_h264_idct8_add_neon, export=1
|
||||
.L_ff_h264_idct8_add_neon:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
movi v19.8h, #0
|
||||
movi v19.8H, #0
|
||||
sxtw x2, w2
|
||||
ld1 {v24.8h, v25.8h}, [x1]
|
||||
st1 {v19.8h}, [x1], #16
|
||||
st1 {v19.8h}, [x1], #16
|
||||
ld1 {v26.8h, v27.8h}, [x1]
|
||||
st1 {v19.8h}, [x1], #16
|
||||
st1 {v19.8h}, [x1], #16
|
||||
ld1 {v28.8h, v29.8h}, [x1]
|
||||
st1 {v19.8h}, [x1], #16
|
||||
st1 {v19.8h}, [x1], #16
|
||||
ld1 {v24.8H, v25.8H}, [x1]
|
||||
st1 {v19.8H}, [x1], #16
|
||||
st1 {v19.8H}, [x1], #16
|
||||
ld1 {v26.8H, v27.8H}, [x1]
|
||||
st1 {v19.8H}, [x1], #16
|
||||
st1 {v19.8H}, [x1], #16
|
||||
ld1 {v28.8H, v29.8H}, [x1]
|
||||
st1 {v19.8H}, [x1], #16
|
||||
st1 {v19.8H}, [x1], #16
|
||||
|
||||
idct8x8_cols 0
|
||||
transpose_8x8H v24, v25, v26, v27, v28, v29, v18, v31, v6, v7
|
||||
idct8x8_cols 1
|
||||
|
||||
mov x3, x0
|
||||
srshr v24.8h, v24.8h, #6
|
||||
ld1 {v0.8b}, [x0], x2
|
||||
srshr v25.8h, v25.8h, #6
|
||||
ld1 {v1.8b}, [x0], x2
|
||||
srshr v26.8h, v26.8h, #6
|
||||
ld1 {v2.8b}, [x0], x2
|
||||
srshr v27.8h, v27.8h, #6
|
||||
ld1 {v3.8b}, [x0], x2
|
||||
srshr v28.8h, v28.8h, #6
|
||||
ld1 {v4.8b}, [x0], x2
|
||||
srshr v29.8h, v29.8h, #6
|
||||
ld1 {v5.8b}, [x0], x2
|
||||
srshr v30.8h, v30.8h, #6
|
||||
ld1 {v6.8b}, [x0], x2
|
||||
srshr v31.8h, v31.8h, #6
|
||||
ld1 {v7.8b}, [x0], x2
|
||||
uaddw v24.8h, v24.8h, v0.8b
|
||||
uaddw v25.8h, v25.8h, v1.8b
|
||||
uaddw v26.8h, v26.8h, v2.8b
|
||||
sqxtun v0.8b, v24.8h
|
||||
uaddw v27.8h, v27.8h, v3.8b
|
||||
sqxtun v1.8b, v25.8h
|
||||
uaddw v28.8h, v28.8h, v4.8b
|
||||
sqxtun v2.8b, v26.8h
|
||||
st1 {v0.8b}, [x3], x2
|
||||
uaddw v29.8h, v29.8h, v5.8b
|
||||
sqxtun v3.8b, v27.8h
|
||||
st1 {v1.8b}, [x3], x2
|
||||
uaddw v30.8h, v30.8h, v6.8b
|
||||
sqxtun v4.8b, v28.8h
|
||||
st1 {v2.8b}, [x3], x2
|
||||
uaddw v31.8h, v31.8h, v7.8b
|
||||
sqxtun v5.8b, v29.8h
|
||||
st1 {v3.8b}, [x3], x2
|
||||
sqxtun v6.8b, v30.8h
|
||||
sqxtun v7.8b, v31.8h
|
||||
st1 {v4.8b}, [x3], x2
|
||||
st1 {v5.8b}, [x3], x2
|
||||
st1 {v6.8b}, [x3], x2
|
||||
st1 {v7.8b}, [x3], x2
|
||||
srshr v24.8H, v24.8H, #6
|
||||
ld1 {v0.8B}, [x0], x2
|
||||
srshr v25.8H, v25.8H, #6
|
||||
ld1 {v1.8B}, [x0], x2
|
||||
srshr v26.8H, v26.8H, #6
|
||||
ld1 {v2.8B}, [x0], x2
|
||||
srshr v27.8H, v27.8H, #6
|
||||
ld1 {v3.8B}, [x0], x2
|
||||
srshr v28.8H, v28.8H, #6
|
||||
ld1 {v4.8B}, [x0], x2
|
||||
srshr v29.8H, v29.8H, #6
|
||||
ld1 {v5.8B}, [x0], x2
|
||||
srshr v30.8H, v30.8H, #6
|
||||
ld1 {v6.8B}, [x0], x2
|
||||
srshr v31.8H, v31.8H, #6
|
||||
ld1 {v7.8B}, [x0], x2
|
||||
uaddw v24.8H, v24.8H, v0.8B
|
||||
uaddw v25.8H, v25.8H, v1.8B
|
||||
uaddw v26.8H, v26.8H, v2.8B
|
||||
sqxtun v0.8B, v24.8H
|
||||
uaddw v27.8H, v27.8H, v3.8B
|
||||
sqxtun v1.8B, v25.8H
|
||||
uaddw v28.8H, v28.8H, v4.8B
|
||||
sqxtun v2.8B, v26.8H
|
||||
st1 {v0.8B}, [x3], x2
|
||||
uaddw v29.8H, v29.8H, v5.8B
|
||||
sqxtun v3.8B, v27.8H
|
||||
st1 {v1.8B}, [x3], x2
|
||||
uaddw v30.8H, v30.8H, v6.8B
|
||||
sqxtun v4.8B, v28.8H
|
||||
st1 {v2.8B}, [x3], x2
|
||||
uaddw v31.8H, v31.8H, v7.8B
|
||||
sqxtun v5.8B, v29.8H
|
||||
st1 {v3.8B}, [x3], x2
|
||||
sqxtun v6.8B, v30.8H
|
||||
sqxtun v7.8B, v31.8H
|
||||
st1 {v4.8B}, [x3], x2
|
||||
st1 {v5.8B}, [x3], x2
|
||||
st1 {v6.8B}, [x3], x2
|
||||
st1 {v7.8B}, [x3], x2
|
||||
|
||||
sub x1, x1, #128
|
||||
ret
|
||||
@@ -334,42 +334,42 @@ function ff_h264_idct8_dc_add_neon, export=1
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
mov w3, #0
|
||||
sxtw x2, w2
|
||||
ld1r {v31.8h}, [x1]
|
||||
ld1r {v31.8H}, [x1]
|
||||
strh w3, [x1]
|
||||
ld1 {v0.8b}, [x0], x2
|
||||
srshr v31.8h, v31.8h, #6
|
||||
ld1 {v1.8b}, [x0], x2
|
||||
ld1 {v2.8b}, [x0], x2
|
||||
uaddw v24.8h, v31.8h, v0.8b
|
||||
ld1 {v3.8b}, [x0], x2
|
||||
uaddw v25.8h, v31.8h, v1.8b
|
||||
ld1 {v4.8b}, [x0], x2
|
||||
uaddw v26.8h, v31.8h, v2.8b
|
||||
ld1 {v5.8b}, [x0], x2
|
||||
uaddw v27.8h, v31.8h, v3.8b
|
||||
ld1 {v6.8b}, [x0], x2
|
||||
uaddw v28.8h, v31.8h, v4.8b
|
||||
ld1 {v7.8b}, [x0], x2
|
||||
uaddw v29.8h, v31.8h, v5.8b
|
||||
uaddw v30.8h, v31.8h, v6.8b
|
||||
uaddw v31.8h, v31.8h, v7.8b
|
||||
sqxtun v0.8b, v24.8h
|
||||
sqxtun v1.8b, v25.8h
|
||||
sqxtun v2.8b, v26.8h
|
||||
sqxtun v3.8b, v27.8h
|
||||
ld1 {v0.8B}, [x0], x2
|
||||
srshr v31.8H, v31.8H, #6
|
||||
ld1 {v1.8B}, [x0], x2
|
||||
ld1 {v2.8B}, [x0], x2
|
||||
uaddw v24.8H, v31.8H, v0.8B
|
||||
ld1 {v3.8B}, [x0], x2
|
||||
uaddw v25.8H, v31.8H, v1.8B
|
||||
ld1 {v4.8B}, [x0], x2
|
||||
uaddw v26.8H, v31.8H, v2.8B
|
||||
ld1 {v5.8B}, [x0], x2
|
||||
uaddw v27.8H, v31.8H, v3.8B
|
||||
ld1 {v6.8B}, [x0], x2
|
||||
uaddw v28.8H, v31.8H, v4.8B
|
||||
ld1 {v7.8B}, [x0], x2
|
||||
uaddw v29.8H, v31.8H, v5.8B
|
||||
uaddw v30.8H, v31.8H, v6.8B
|
||||
uaddw v31.8H, v31.8H, v7.8B
|
||||
sqxtun v0.8B, v24.8H
|
||||
sqxtun v1.8B, v25.8H
|
||||
sqxtun v2.8B, v26.8H
|
||||
sqxtun v3.8B, v27.8H
|
||||
sub x0, x0, x2, lsl #3
|
||||
st1 {v0.8b}, [x0], x2
|
||||
sqxtun v4.8b, v28.8h
|
||||
st1 {v1.8b}, [x0], x2
|
||||
sqxtun v5.8b, v29.8h
|
||||
st1 {v2.8b}, [x0], x2
|
||||
sqxtun v6.8b, v30.8h
|
||||
st1 {v3.8b}, [x0], x2
|
||||
sqxtun v7.8b, v31.8h
|
||||
st1 {v4.8b}, [x0], x2
|
||||
st1 {v5.8b}, [x0], x2
|
||||
st1 {v6.8b}, [x0], x2
|
||||
st1 {v7.8b}, [x0], x2
|
||||
st1 {v0.8B}, [x0], x2
|
||||
sqxtun v4.8B, v28.8H
|
||||
st1 {v1.8B}, [x0], x2
|
||||
sqxtun v5.8B, v29.8H
|
||||
st1 {v2.8B}, [x0], x2
|
||||
sqxtun v6.8B, v30.8H
|
||||
st1 {v3.8B}, [x0], x2
|
||||
sqxtun v7.8B, v31.8H
|
||||
st1 {v4.8B}, [x0], x2
|
||||
st1 {v5.8B}, [x0], x2
|
||||
st1 {v6.8B}, [x0], x2
|
||||
st1 {v7.8B}, [x0], x2
|
||||
ret
|
||||
endfunc
|
||||
|
||||
@@ -385,7 +385,7 @@ function ff_h264_idct8_add4_neon, export=1
|
||||
movrel x14, .L_ff_h264_idct8_add_neon
|
||||
1: ldrb w9, [x7], #4
|
||||
ldrsw x0, [x5], #16
|
||||
ldrb w9, [x4, w9, uxtw]
|
||||
ldrb w9, [x4, w9, UXTW]
|
||||
subs w9, w9, #1
|
||||
b.lt 2f
|
||||
ldrsh w11, [x1]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user