Merge branch 'master' of https://git.ffmpeg.org/ffmpeg
This commit is contained in:
commit
8d36418bbe
|
@ -19,6 +19,9 @@
|
|||
*.swp
|
||||
*.ver
|
||||
*.version
|
||||
*.metal.air
|
||||
*.metallib
|
||||
*.metallib.c
|
||||
*.ptx
|
||||
*.ptx.c
|
||||
*.ptx.gz
|
||||
|
|
19
Changelog
19
Changelog
|
@ -2,6 +2,9 @@ Entries are sorted chronologically from oldest to youngest within each release,
|
|||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
|
||||
version 5.0:
|
||||
- ADPCM IMA Westwood encoder
|
||||
- Westwood AUD muxer
|
||||
- ADPCM IMA Acorn Replay decoder
|
||||
|
@ -29,6 +32,22 @@ version <next>:
|
|||
- limitdiff video filter
|
||||
- xcorrelate video filter
|
||||
- varblur video filter
|
||||
- huesaturation video filter
|
||||
- colorspectrum source video filter
|
||||
- RTP packetizer for uncompressed video (RFC 4175)
|
||||
- bitpacked encoder
|
||||
- VideoToolbox VP9 hwaccel
|
||||
- VideoToolbox ProRes hwaccel
|
||||
- support loongarch.
|
||||
- aspectralstats audio filter
|
||||
- adynamicsmooth audio filter
|
||||
- libplacebo filter
|
||||
- vflip_vulkan, hflip_vulkan and flip_vulkan filters
|
||||
- adynamicequalizer audio filter
|
||||
- yadif_videotoolbox filter
|
||||
- VideoToolbox ProRes encoder
|
||||
- anlmf audio filter
|
||||
- IMF demuxer (experimental)
|
||||
|
||||
|
||||
version 4.4:
|
||||
|
|
|
@ -226,7 +226,7 @@ Codecs:
|
|||
ptx.c Ivo van Poorten
|
||||
qcelp* Reynaldo H. Verdejo Pinochet
|
||||
qdm2.c, qdm2data.h Roberto Togni
|
||||
qsv* Mark Thompson, Zhong Li
|
||||
qsv* Mark Thompson, Zhong Li, Haihao Xiang
|
||||
qtrle.c Mike Melanson
|
||||
ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
|
||||
resample2.c Michael Niedermayer
|
||||
|
@ -274,8 +274,8 @@ Hardware acceleration:
|
|||
dxva2* Hendrik Leppkes, Laurent Aimar, Steve Lhomme
|
||||
d3d11va* Steve Lhomme
|
||||
mediacodec* Matthieu Bouron, Aman Gupta
|
||||
vaapi* Gwenole Beauchesne
|
||||
vaapi_encode* Mark Thompson
|
||||
vaapi* Haihao Xiang
|
||||
vaapi_encode* Mark Thompson, Haihao Xiang
|
||||
vdpau* Philip Langdale, Carl Eugen Hoyos
|
||||
videotoolbox* Rick Kern, Aman Gupta
|
||||
|
||||
|
@ -611,6 +611,7 @@ Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
|
|||
FFmpeg release signing key FCF9 86EA 15E6 E293 A564 4F10 B432 2F04 D676 58D8
|
||||
Ganesh Ajjanagadde C96A 848E 97C3 CEA2 AB72 5CE4 45F9 6A2D 3C36 FB1B
|
||||
Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4
|
||||
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
|
||||
|
|
4
Makefile
4
Makefile
|
@ -13,6 +13,7 @@ vpath %.v $(SRC_PATH)
|
|||
vpath %.texi $(SRC_PATH)
|
||||
vpath %.cu $(SRC_PATH)
|
||||
vpath %.ptx $(SRC_PATH)
|
||||
vpath %.metal $(SRC_PATH)
|
||||
vpath %/fate_config.sh.template $(SRC_PATH)
|
||||
|
||||
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
|
||||
|
@ -89,7 +90,8 @@ SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
|||
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
|
||||
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
|
||||
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
||||
MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
|
||||
MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \
|
||||
STLIBOBJS HOSTOBJS TESTOBJS
|
||||
|
||||
define RESET
|
||||
$(1) :=
|
||||
|
|
|
@ -262,6 +262,7 @@ External library support:
|
|||
--enable-librsvg enable SVG rasterization via librsvg [no]
|
||||
--enable-librubberband enable rubberband needed for rubberband filter [no]
|
||||
--enable-librtmp enable RTMP[E] support via librtmp [no]
|
||||
--enable-libshaderc enable GLSL->SPIRV compilation via libshaderc [no]
|
||||
--enable-libshine enable fixed-point MP3 encoding via libshine [no]
|
||||
--enable-libsmbclient enable Samba protocol via libsmbclient [no]
|
||||
--enable-libsnappy enable Snappy compression, needed for hap encoding [no]
|
||||
|
@ -297,7 +298,7 @@ External library support:
|
|||
--enable-libxvid enable Xvid encoding via xvidcore,
|
||||
native MPEG-4/Xvid encoder exists [no]
|
||||
--enable-libxml2 enable XML parsing using the C library libxml2, needed
|
||||
for dash demuxing support [no]
|
||||
for dash and imf demuxing support [no]
|
||||
--enable-libzimg enable z.lib, needed for zscale filter [no]
|
||||
--enable-libzmq enable message passing via libzmq [no]
|
||||
--enable-libzvbi enable teletext support via libzvbi [no]
|
||||
|
@ -308,6 +309,7 @@ External library support:
|
|||
if openssl, gnutls or libtls is not used [no]
|
||||
--enable-mediacodec enable Android MediaCodec support [no]
|
||||
--enable-mediafoundation enable encoding via MediaFoundation [auto]
|
||||
--disable-metal disable Apple Metal framework [autodetect]
|
||||
--enable-libmysofa enable libmysofa, needed for sofalizer filter [no]
|
||||
--enable-openal enable OpenAL 1.1 capture support [no]
|
||||
--enable-opencl enable OpenCL processing [no]
|
||||
|
@ -322,7 +324,7 @@ External library support:
|
|||
--disable-securetransport disable Secure Transport, needed for TLS support
|
||||
on OSX if openssl and gnutls are not used [autodetect]
|
||||
--enable-vapoursynth enable VapourSynth demuxer [no]
|
||||
--enable-vulkan enable Vulkan code [no]
|
||||
--disable-vulkan disable Vulkan code [autodetect]
|
||||
--disable-xlib disable xlib [autodetect]
|
||||
--disable-zlib disable zlib [autodetect]
|
||||
|
||||
|
@ -381,6 +383,8 @@ Toolchain options:
|
|||
--dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
|
||||
--nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default]
|
||||
--ld=LD use linker LD [$ld_default]
|
||||
--metalcc=METALCC use metal compiler METALCC [$metalcc_default]
|
||||
--metallib=METALLIB use metal linker METALLIB [$metallib_default]
|
||||
--pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
|
||||
--pkg-config-flags=FLAGS pass additional flags to pkgconf []
|
||||
--ranlib=RANLIB use ranlib RANLIB [$ranlib_default]
|
||||
|
@ -451,7 +455,9 @@ Optimization options (experts only):
|
|||
--disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
|
||||
--disable-msa disable MSA optimizations
|
||||
--disable-mipsfpu disable floating point MIPS optimizations
|
||||
--disable-mmi disable Loongson SIMD optimizations
|
||||
--disable-mmi disable Loongson MMI optimizations
|
||||
--disable-lsx disable Loongson LSX optimizations
|
||||
--disable-lasx disable Loongson LASX optimizations
|
||||
--disable-fast-unaligned consider unaligned accesses slow
|
||||
|
||||
Developer options (useful when working on FFmpeg itself):
|
||||
|
@ -1466,10 +1472,12 @@ test_pkg_config_cpp(){
|
|||
test_cmd $pkg_config --exists --print-errors $pkg_version || return
|
||||
pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
|
||||
pkg_incdir=$($pkg_config --variable=includedir $pkg_config_flags $pkg)
|
||||
pkg_incflags=$($pkg_config --cflags-only-I $pkg_config_flags $pkg)
|
||||
test_cpp_condition "$pkg_incdir/$headers" "$cond" "$@" &&
|
||||
enable $name &&
|
||||
set_sanitized "${name}_cflags" $pkg_cflags &&
|
||||
set_sanitized "${name}_incdir" $pkg_incdir
|
||||
set_sanitized "${name}_incdir" $pkg_incdir &&
|
||||
set_sanitized "${name}_incflags" $pkg_incflags
|
||||
}
|
||||
|
||||
check_pkg_config(){
|
||||
|
@ -1486,6 +1494,13 @@ check_pkg_config_cpp(){
|
|||
eval add_cflags \$${name}_cflags
|
||||
}
|
||||
|
||||
check_pkg_config_header_only(){
|
||||
log check_pkg_config_cpp "$@"
|
||||
name="$1"
|
||||
test_pkg_config_cpp "$@" &&
|
||||
eval add_cflags \$${name}_incflags
|
||||
}
|
||||
|
||||
test_exec(){
|
||||
test_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
|
||||
}
|
||||
|
@ -1743,6 +1758,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST="
|
|||
libxcb_xfixes
|
||||
lzma
|
||||
mediafoundation
|
||||
metal
|
||||
schannel
|
||||
sdl2
|
||||
securetransport
|
||||
|
@ -1827,12 +1843,14 @@ EXTERNAL_LIBRARY_LIST="
|
|||
libopenmpt
|
||||
libopenvino
|
||||
libopus
|
||||
libplacebo
|
||||
libpulse
|
||||
librabbitmq
|
||||
librav1e
|
||||
librist
|
||||
librsvg
|
||||
librtmp
|
||||
libshaderc
|
||||
libshine
|
||||
libsmbclient
|
||||
libsnappy
|
||||
|
@ -1879,6 +1897,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
|
|||
vaapi
|
||||
vdpau
|
||||
videotoolbox
|
||||
vulkan
|
||||
v4l2_m2m
|
||||
xvmc
|
||||
"
|
||||
|
@ -1901,7 +1920,6 @@ HWACCEL_LIBRARY_LIST="
|
|||
mmal
|
||||
omx
|
||||
opencl
|
||||
vulkan
|
||||
"
|
||||
|
||||
DOCUMENT_LIST="
|
||||
|
@ -2020,12 +2038,16 @@ ARCH_LIST="
|
|||
avr32_uc
|
||||
bfin
|
||||
ia64
|
||||
loongarch
|
||||
loongarch32
|
||||
loongarch64
|
||||
m68k
|
||||
mips
|
||||
mips64
|
||||
parisc
|
||||
ppc
|
||||
ppc64
|
||||
riscv
|
||||
s390
|
||||
sh4
|
||||
sparc
|
||||
|
@ -2065,6 +2087,8 @@ ARCH_EXT_LIST_LOONGSON="
|
|||
loongson2
|
||||
loongson3
|
||||
mmi
|
||||
lsx
|
||||
lasx
|
||||
"
|
||||
|
||||
ARCH_EXT_LIST_X86_SIMD="
|
||||
|
@ -2324,10 +2348,21 @@ TOOLCHAIN_FEATURES="
|
|||
TYPES_LIST="
|
||||
kCMVideoCodecType_HEVC
|
||||
kCMVideoCodecType_HEVCWithAlpha
|
||||
kCMVideoCodecType_VP9
|
||||
kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
|
||||
kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange
|
||||
kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange
|
||||
kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange
|
||||
kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange
|
||||
kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange
|
||||
kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange
|
||||
kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
|
||||
kCVImageBufferTransferFunction_ITU_R_2100_HLG
|
||||
kCVImageBufferTransferFunction_Linear
|
||||
kCVImageBufferYCbCrMatrix_ITU_R_2020
|
||||
kCVImageBufferColorPrimaries_ITU_R_2020
|
||||
kCVImageBufferTransferFunction_ITU_R_2020
|
||||
kCVImageBufferTransferFunction_SMPTE_ST_428_1
|
||||
socklen_t
|
||||
struct_addrinfo
|
||||
struct_group_source_req
|
||||
|
@ -2399,6 +2434,7 @@ CONFIG_EXTRA="
|
|||
cbs_vp9
|
||||
dirac_parse
|
||||
dnn
|
||||
dovi_rpu
|
||||
dvprofile
|
||||
exif
|
||||
faandct
|
||||
|
@ -2440,7 +2476,9 @@ CONFIG_EXTRA="
|
|||
mpegaudio
|
||||
mpegaudiodsp
|
||||
mpegaudioheader
|
||||
mpeg4audio
|
||||
mpegvideo
|
||||
mpegvideodec
|
||||
mpegvideoenc
|
||||
mss34dsp
|
||||
pixblockdsp
|
||||
|
@ -2533,6 +2571,8 @@ CMDLINE_SET="
|
|||
ln_s
|
||||
logfile
|
||||
malloc_prefix
|
||||
metalcc
|
||||
metallib
|
||||
nm
|
||||
optflags
|
||||
nvcc
|
||||
|
@ -2590,6 +2630,10 @@ power8_deps="vsx"
|
|||
|
||||
loongson2_deps="mips"
|
||||
loongson3_deps="mips"
|
||||
mmi_deps_any="loongson2 loongson3"
|
||||
lsx_deps="loongarch"
|
||||
lasx_deps="lsx"
|
||||
|
||||
mips32r2_deps="mips"
|
||||
mips32r5_deps="mips"
|
||||
mips32r6_deps="mips"
|
||||
|
@ -2598,7 +2642,6 @@ mips64r6_deps="mips"
|
|||
mipsfpu_deps="mips"
|
||||
mipsdsp_deps="mips"
|
||||
mipsdspr2_deps="mips"
|
||||
mmi_deps_any="loongson2 loongson3"
|
||||
msa_deps="mipsfpu"
|
||||
|
||||
cpunop_deps="i686"
|
||||
|
@ -2636,7 +2679,7 @@ for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
|
|||
done
|
||||
|
||||
aligned_stack_if_any="aarch64 ppc x86"
|
||||
fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
|
||||
fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 riscv64 sparc64 x86_64"
|
||||
fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
|
||||
fast_unaligned_if_any="aarch64 ppc x86"
|
||||
simd_align_16_if_any="altivec neon sse"
|
||||
|
@ -2666,6 +2709,7 @@ cbs_mpeg2_select="cbs"
|
|||
cbs_vp9_select="cbs"
|
||||
dct_select="rdft"
|
||||
dirac_parse_select="golomb"
|
||||
dovi_rpu_select="golomb"
|
||||
dnn_suggest="libtensorflow libopenvino"
|
||||
dnn_deps="avformat swscale"
|
||||
error_resilience_select="me_cmp"
|
||||
|
@ -2677,20 +2721,22 @@ h264dsp_select="startcode"
|
|||
hevcparse_select="atsc_a53 golomb"
|
||||
frame_thread_encoder_deps="encoders threads"
|
||||
intrax8_select="blockdsp idctdsp"
|
||||
iso_media_select="mpeg4audio"
|
||||
mdct_select="fft"
|
||||
mdct15_select="fft"
|
||||
me_cmp_select="fdctdsp idctdsp pixblockdsp"
|
||||
mpeg_er_select="error_resilience"
|
||||
mpegaudio_select="mpegaudiodsp mpegaudioheader"
|
||||
mpegaudiodsp_select="dct"
|
||||
mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
|
||||
mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp videodsp"
|
||||
mpegvideodec_select="mpegvideo mpeg_er"
|
||||
mpegvideoenc_select="aandcttables me_cmp mpegvideo pixblockdsp qpeldsp"
|
||||
vc1dsp_select="h264chroma qpeldsp startcode"
|
||||
rdft_select="fft"
|
||||
|
||||
# decoders / encoders
|
||||
aac_decoder_select="adts_header mdct15 mdct sinewin"
|
||||
aac_fixed_decoder_select="adts_header mdct"
|
||||
aac_decoder_select="adts_header mdct15 mdct mpeg4audio sinewin"
|
||||
aac_fixed_decoder_select="adts_header mdct mpeg4audio"
|
||||
aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
|
||||
aac_latm_decoder_select="aac_decoder aac_latm_parser"
|
||||
ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
|
||||
|
@ -2702,7 +2748,7 @@ adpcm_g722_decoder_select="g722dsp"
|
|||
adpcm_g722_encoder_select="g722dsp"
|
||||
aic_decoder_select="golomb idctdsp"
|
||||
alac_encoder_select="lpc"
|
||||
als_decoder_select="bswapdsp"
|
||||
als_decoder_select="bswapdsp mpeg4audio"
|
||||
amrnb_decoder_select="lsp"
|
||||
amrwb_decoder_select="lsp"
|
||||
amv_decoder_select="sp5x_decoder exif"
|
||||
|
@ -2772,9 +2818,9 @@ fraps_decoder_select="bswapdsp huffman"
|
|||
g2m_decoder_deps="zlib"
|
||||
g2m_decoder_select="blockdsp idctdsp jpegtables"
|
||||
g729_decoder_select="audiodsp"
|
||||
h261_decoder_select="mpegvideo"
|
||||
h261_decoder_select="mpegvideodec"
|
||||
h261_encoder_select="mpegvideoenc"
|
||||
h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
|
||||
h263_decoder_select="h263_parser h263dsp mpegvideodec qpeldsp"
|
||||
h263_encoder_select="h263dsp mpegvideoenc"
|
||||
h263i_decoder_select="h263_decoder"
|
||||
h263p_decoder_select="h263_decoder"
|
||||
|
@ -2784,7 +2830,7 @@ h264_decoder_suggest="error_resilience"
|
|||
hap_decoder_select="snappy texturedsp"
|
||||
hap_encoder_deps="libsnappy"
|
||||
hap_encoder_select="texturedspenc"
|
||||
hevc_decoder_select="atsc_a53 bswapdsp cabac golomb hevcparse videodsp"
|
||||
hevc_decoder_select="atsc_a53 bswapdsp cabac dovi_rpu golomb hevcparse videodsp"
|
||||
huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
|
||||
huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
|
||||
hymt_decoder_select="huffyuv_decoder"
|
||||
|
@ -2796,7 +2842,7 @@ indeo3_decoder_select="hpeldsp"
|
|||
indeo4_decoder_select="ividsp"
|
||||
indeo5_decoder_select="ividsp"
|
||||
interplay_video_decoder_select="hpeldsp"
|
||||
ipu_decoder_select="mpegvideo"
|
||||
ipu_decoder_select="mpegvideodec"
|
||||
jpegls_decoder_select="mjpeg_decoder"
|
||||
jv_decoder_select="blockdsp"
|
||||
lagarith_decoder_select="llviddsp"
|
||||
|
@ -2822,14 +2868,14 @@ mp3_decoder_select="mpegaudio"
|
|||
mp3adu_decoder_select="mpegaudio"
|
||||
mp3adufloat_decoder_select="mpegaudio"
|
||||
mp3float_decoder_select="mpegaudio"
|
||||
mp3on4_decoder_select="mpegaudio"
|
||||
mp3on4float_decoder_select="mpegaudio"
|
||||
mp3on4_decoder_select="mpegaudio mpeg4audio"
|
||||
mp3on4float_decoder_select="mpegaudio mpeg4audio"
|
||||
mpc7_decoder_select="bswapdsp mpegaudiodsp"
|
||||
mpc8_decoder_select="mpegaudiodsp"
|
||||
mpegvideo_decoder_select="mpegvideo"
|
||||
mpeg1video_decoder_select="mpegvideo"
|
||||
mpegvideo_decoder_select="mpegvideodec"
|
||||
mpeg1video_decoder_select="mpegvideodec"
|
||||
mpeg1video_encoder_select="mpegvideoenc h263dsp"
|
||||
mpeg2video_decoder_select="mpegvideo"
|
||||
mpeg2video_decoder_select="mpegvideodec"
|
||||
mpeg2video_encoder_select="mpegvideoenc h263dsp"
|
||||
mpeg4_decoder_select="h263_decoder mpeg4video_parser"
|
||||
mpeg4_encoder_select="h263_encoder"
|
||||
|
@ -2840,7 +2886,7 @@ msmpeg4v2_decoder_select="h263_decoder"
|
|||
msmpeg4v2_encoder_select="h263_encoder"
|
||||
msmpeg4v3_decoder_select="h263_decoder"
|
||||
msmpeg4v3_encoder_select="h263_encoder"
|
||||
mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
|
||||
mss2_decoder_select="mpegvideodec qpeldsp vc1_decoder"
|
||||
mts2_decoder_select="jpegtables mss34dsp"
|
||||
mv30_decoder_select="aandcttables blockdsp"
|
||||
mvha_decoder_deps="zlib"
|
||||
|
@ -2873,8 +2919,8 @@ rv10_decoder_select="h263_decoder"
|
|||
rv10_encoder_select="h263_encoder"
|
||||
rv20_decoder_select="h263_decoder"
|
||||
rv20_encoder_select="h263_encoder"
|
||||
rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
|
||||
rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
|
||||
rv30_decoder_select="golomb h264pred h264qpel mpegvideodec rv34dsp"
|
||||
rv40_decoder_select="golomb h264pred h264qpel mpegvideodec rv34dsp"
|
||||
screenpresso_decoder_deps="zlib"
|
||||
shorten_decoder_select="bswapdsp"
|
||||
sipr_decoder_select="lsp"
|
||||
|
@ -2910,7 +2956,7 @@ txd_decoder_select="texturedsp"
|
|||
utvideo_decoder_select="bswapdsp llviddsp"
|
||||
utvideo_encoder_select="bswapdsp huffman llvidencdsp"
|
||||
vble_decoder_select="llviddsp"
|
||||
vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
|
||||
vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideodec vc1dsp"
|
||||
vc1image_decoder_select="vc1_decoder"
|
||||
vorbis_decoder_select="mdct"
|
||||
vorbis_encoder_select="audio_frame_queue mdct"
|
||||
|
@ -3041,6 +3087,8 @@ mpeg4_vdpau_hwaccel_deps="vdpau"
|
|||
mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
|
||||
mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
|
||||
mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
|
||||
prores_videotoolbox_hwaccel_deps="videotoolbox"
|
||||
prores_videotoolbox_hwaccel_select="prores_decoder"
|
||||
vc1_d3d11va_hwaccel_deps="d3d11va"
|
||||
vc1_d3d11va_hwaccel_select="vc1_decoder"
|
||||
vc1_d3d11va2_hwaccel_deps="d3d11va"
|
||||
|
@ -3069,6 +3117,8 @@ vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
|
|||
vp9_vaapi_hwaccel_select="vp9_decoder"
|
||||
vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9"
|
||||
vp9_vdpau_hwaccel_select="vp9_decoder"
|
||||
vp9_videotoolbox_hwaccel_deps="videotoolbox"
|
||||
vp9_videotoolbox_hwaccel_select="vp9_decoder"
|
||||
wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
|
||||
wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
|
||||
wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
|
||||
|
@ -3090,6 +3140,7 @@ v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
|
|||
|
||||
hwupload_cuda_filter_deps="ffnvcodec"
|
||||
scale_npp_filter_deps="ffnvcodec libnpp"
|
||||
scale2ref_npp_filter_deps="ffnvcodec libnpp"
|
||||
scale_cuda_filter_deps="ffnvcodec"
|
||||
scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
|
||||
thumbnail_cuda_filter_deps="ffnvcodec"
|
||||
|
@ -3195,17 +3246,17 @@ wmv3_crystalhd_decoder_select="crystalhd"
|
|||
av1_qsv_decoder_select="qsvdec"
|
||||
|
||||
# parsers
|
||||
aac_parser_select="adts_header"
|
||||
aac_parser_select="adts_header mpeg4audio"
|
||||
av1_parser_select="cbs_av1"
|
||||
h264_parser_select="atsc_a53 golomb h264dsp h264parse"
|
||||
hevc_parser_select="hevcparse"
|
||||
mpegaudio_parser_select="mpegaudioheader"
|
||||
mpegvideo_parser_select="mpegvideo"
|
||||
mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
|
||||
mpeg4video_parser_select="h263dsp mpegvideodec qpeldsp"
|
||||
vc1_parser_select="vc1dsp"
|
||||
|
||||
# bitstream_filters
|
||||
aac_adtstoasc_bsf_select="adts_header"
|
||||
aac_adtstoasc_bsf_select="adts_header mpeg4audio"
|
||||
av1_frame_merge_bsf_select="cbs_av1"
|
||||
av1_frame_split_bsf_select="cbs_av1"
|
||||
av1_metadata_bsf_select="cbs_av1"
|
||||
|
@ -3261,6 +3312,8 @@ h264_videotoolbox_encoder_deps="pthreads"
|
|||
h264_videotoolbox_encoder_select="atsc_a53 videotoolbox_encoder"
|
||||
hevc_videotoolbox_encoder_deps="pthreads"
|
||||
hevc_videotoolbox_encoder_select="atsc_a53 videotoolbox_encoder"
|
||||
prores_videotoolbox_encoder_deps="pthreads"
|
||||
prores_videotoolbox_encoder_select="videotoolbox_encoder"
|
||||
libaom_av1_decoder_deps="libaom"
|
||||
libaom_av1_encoder_deps="libaom"
|
||||
libaom_av1_encoder_select="extract_extradata_bsf"
|
||||
|
@ -3302,7 +3355,7 @@ librav1e_encoder_deps="librav1e"
|
|||
librav1e_encoder_select="extract_extradata_bsf"
|
||||
librsvg_decoder_deps="librsvg"
|
||||
libshine_encoder_deps="libshine"
|
||||
libshine_encoder_select="audio_frame_queue"
|
||||
libshine_encoder_select="audio_frame_queue mpegaudioheader"
|
||||
libspeex_decoder_deps="libspeex"
|
||||
libspeex_encoder_deps="libspeex"
|
||||
libspeex_encoder_select="audio_frame_queue"
|
||||
|
@ -3338,7 +3391,9 @@ videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrame
|
|||
# demuxers / muxers
|
||||
ac3_demuxer_select="ac3_parser"
|
||||
act_demuxer_select="riffdec"
|
||||
adts_muxer_select="mpeg4audio"
|
||||
aiff_muxer_select="iso_media"
|
||||
amv_muxer_select="riffenc"
|
||||
asf_demuxer_select="riffdec"
|
||||
asf_o_demuxer_select="riffdec"
|
||||
asf_muxer_select="riffenc"
|
||||
|
@ -3363,18 +3418,21 @@ flac_demuxer_select="flac_parser"
|
|||
flv_muxer_select="aac_adtstoasc_bsf"
|
||||
gxf_muxer_select="pcm_rechunk_bsf"
|
||||
hds_muxer_select="flv_muxer"
|
||||
hls_demuxer_select="adts_header ac3_parser"
|
||||
hls_muxer_select="mpegts_muxer"
|
||||
hls_muxer_suggest="gcrypt openssl"
|
||||
image2_alias_pix_demuxer_select="image2_demuxer"
|
||||
image2_brender_pix_demuxer_select="image2_demuxer"
|
||||
imf_demuxer_deps="libxml2"
|
||||
imf_demuxer_select="mxf_demuxer"
|
||||
ipod_muxer_select="mov_muxer"
|
||||
ismv_muxer_select="mov_muxer"
|
||||
ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
|
||||
latm_muxer_select="aac_adtstoasc_bsf"
|
||||
latm_muxer_select="aac_adtstoasc_bsf mpeg4audio"
|
||||
matroska_audio_muxer_select="matroska_muxer"
|
||||
matroska_demuxer_select="riffdec"
|
||||
matroska_demuxer_suggest="bzlib lzo zlib"
|
||||
matroska_muxer_select="riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
|
||||
matroska_muxer_select="mpeg4audio riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
|
||||
mlp_demuxer_select="mlp_parser"
|
||||
mmf_muxer_select="riffenc"
|
||||
mov_demuxer_select="iso_media riffdec"
|
||||
|
@ -3386,7 +3444,7 @@ mp4_muxer_select="mov_muxer"
|
|||
mpegts_demuxer_select="iso_media"
|
||||
mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf hevc_mp4toannexb_bsf"
|
||||
mpegtsraw_demuxer_select="mpegts_demuxer"
|
||||
mxf_muxer_select="golomb pcm_rechunk_bsf"
|
||||
mxf_muxer_select="pcm_rechunk_bsf"
|
||||
mxf_d10_muxer_select="mxf_muxer"
|
||||
mxf_opatom_muxer_select="mxf_muxer"
|
||||
nut_muxer_select="riffenc"
|
||||
|
@ -3399,9 +3457,8 @@ ogv_muxer_select="ogg_muxer"
|
|||
opus_muxer_select="ogg_muxer"
|
||||
psp_muxer_select="mov_muxer"
|
||||
rtp_demuxer_select="sdp_demuxer"
|
||||
rtp_muxer_select="golomb jpegtables"
|
||||
rtp_mpegts_muxer_select="mpegts_muxer rtp_muxer"
|
||||
rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
|
||||
rtpdec_select="asf_demuxer mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
|
||||
rtsp_demuxer_select="http_protocol rtpdec"
|
||||
rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
|
||||
sap_demuxer_select="sdp_demuxer"
|
||||
|
@ -3422,7 +3479,6 @@ w64_muxer_select="wav_muxer"
|
|||
wav_demuxer_select="riffdec"
|
||||
wav_muxer_select="riffenc"
|
||||
webm_chunk_muxer_select="webm_muxer"
|
||||
webm_muxer_select="riffenc"
|
||||
webm_dash_manifest_demuxer_select="matroska_demuxer"
|
||||
wtv_demuxer_select="mpegts_demuxer riffdec"
|
||||
wtv_muxer_select="mpegts_muxer riffenc"
|
||||
|
@ -3444,6 +3500,7 @@ caca_outdev_deps="libcaca"
|
|||
decklink_deps_any="libdl LoadLibrary"
|
||||
decklink_indev_deps="decklink threads"
|
||||
decklink_indev_extralibs="-lstdc++"
|
||||
decklink_indev_suggest="libzvbi"
|
||||
decklink_outdev_deps="decklink threads"
|
||||
decklink_outdev_suggest="libklvanc"
|
||||
decklink_outdev_extralibs="-lstdc++"
|
||||
|
@ -3557,15 +3614,16 @@ ass_filter_deps="libass"
|
|||
atempo_filter_deps="avcodec"
|
||||
atempo_filter_select="rdft"
|
||||
avgblur_opencl_filter_deps="opencl"
|
||||
avgblur_vulkan_filter_deps="vulkan_lib libglslang"
|
||||
avgblur_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
azmq_filter_deps="libzmq"
|
||||
blackframe_filter_deps="gpl"
|
||||
blend_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
bm3d_filter_deps="avcodec"
|
||||
bm3d_filter_select="dct"
|
||||
boxblur_filter_deps="gpl"
|
||||
boxblur_opencl_filter_deps="opencl gpl"
|
||||
bs2b_filter_deps="libbs2b"
|
||||
chromaber_vulkan_filter_deps="vulkan_lib libglslang"
|
||||
chromaber_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
colorkey_opencl_filter_deps="opencl"
|
||||
colormatrix_filter_deps="gpl"
|
||||
convolution_opencl_filter_deps="opencl"
|
||||
|
@ -3598,6 +3656,7 @@ fftdnoiz_filter_select="fft"
|
|||
find_rect_filter_deps="avcodec avformat gpl"
|
||||
firequalizer_filter_deps="avcodec"
|
||||
firequalizer_filter_select="rdft"
|
||||
flip_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
flite_filter_deps="libflite"
|
||||
framerate_filter_select="scene_sad"
|
||||
freezedetect_filter_select="scene_sad"
|
||||
|
@ -3605,12 +3664,15 @@ frei0r_deps_any="libdl LoadLibrary"
|
|||
frei0r_filter_deps="frei0r"
|
||||
frei0r_src_filter_deps="frei0r"
|
||||
fspp_filter_deps="gpl"
|
||||
gblur_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
hflip_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
histeq_filter_deps="gpl"
|
||||
hqdn3d_filter_deps="gpl"
|
||||
interlace_filter_deps="gpl"
|
||||
kerndeint_filter_deps="gpl"
|
||||
ladspa_filter_deps="ladspa libdl"
|
||||
lensfun_filter_deps="liblensfun version3"
|
||||
libplacebo_filter_deps="libplacebo vulkan"
|
||||
lv2_filter_deps="lv2"
|
||||
mcdeint_filter_deps="avcodec gpl"
|
||||
metadata_filter_deps="avformat"
|
||||
|
@ -3628,7 +3690,7 @@ openclsrc_filter_deps="opencl"
|
|||
overlay_opencl_filter_deps="opencl"
|
||||
overlay_qsv_filter_deps="libmfx"
|
||||
overlay_qsv_filter_select="qsvvpp"
|
||||
overlay_vulkan_filter_deps="vulkan_lib libglslang"
|
||||
overlay_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
owdenoise_filter_deps="gpl"
|
||||
pad_opencl_filter_deps="opencl"
|
||||
pan_filter_deps="swresample"
|
||||
|
@ -3681,9 +3743,11 @@ tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping"
|
|||
tonemap_opencl_filter_deps="opencl const_nan"
|
||||
transpose_opencl_filter_deps="opencl"
|
||||
transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
|
||||
transpose_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
unsharp_opencl_filter_deps="opencl"
|
||||
uspp_filter_deps="gpl avcodec"
|
||||
vaguedenoiser_filter_deps="gpl"
|
||||
vflip_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
vidstabdetect_filter_deps="libvidstab"
|
||||
vidstabtransform_filter_deps="libvidstab"
|
||||
libvmaf_filter_deps="libvmaf pthreads"
|
||||
|
@ -3691,12 +3755,13 @@ zmq_filter_deps="libzmq"
|
|||
zoompan_filter_deps="swscale"
|
||||
zscale_filter_deps="libzimg const_nan"
|
||||
scale_vaapi_filter_deps="vaapi"
|
||||
scale_vulkan_filter_deps="vulkan_lib libglslang"
|
||||
scale_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
vpp_qsv_filter_deps="libmfx"
|
||||
vpp_qsv_filter_select="qsvvpp"
|
||||
xfade_opencl_filter_deps="opencl"
|
||||
yadif_cuda_filter_deps="ffnvcodec"
|
||||
yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
|
||||
yadif_videotoolbox_filter_deps="metal corevideo videotoolbox"
|
||||
|
||||
# examples
|
||||
avio_list_dir_deps="avformat avutil"
|
||||
|
@ -3789,6 +3854,8 @@ host_cc_default="gcc"
|
|||
doxygen_default="doxygen"
|
||||
install="install"
|
||||
ln_s_default="ln -s -f"
|
||||
metalcc_default="xcrun -sdk macosx metal"
|
||||
metallib_default="xcrun -sdk macosx metallib"
|
||||
nm_default="nm -g"
|
||||
pkg_config_default=pkg-config
|
||||
ranlib_default="ranlib"
|
||||
|
@ -4389,7 +4456,7 @@ if enabled cuda_nvcc; then
|
|||
fi
|
||||
|
||||
set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
|
||||
target_exec x86asmexe
|
||||
target_exec x86asmexe metalcc metallib
|
||||
enabled cross_compile || host_cc_default=$cc
|
||||
set_default host_cc
|
||||
|
||||
|
@ -4925,6 +4992,9 @@ case "$arch" in
|
|||
arm*|iPad*|iPhone*)
|
||||
arch="arm"
|
||||
;;
|
||||
loongarch*)
|
||||
arch="loongarch"
|
||||
;;
|
||||
mips*|IP*)
|
||||
case "$arch" in
|
||||
*el)
|
||||
|
@ -4944,6 +5014,9 @@ case "$arch" in
|
|||
"Power Macintosh"|ppc*|powerpc*)
|
||||
arch="ppc"
|
||||
;;
|
||||
riscv*)
|
||||
arch="riscv"
|
||||
;;
|
||||
s390|s390x)
|
||||
arch="s390"
|
||||
;;
|
||||
|
@ -5069,6 +5142,18 @@ elif enabled bfin; then
|
|||
|
||||
cpuflags="-mcpu=$cpu"
|
||||
|
||||
elif enabled loongarch; then
|
||||
|
||||
enable local_aligned
|
||||
enable simd_align_32
|
||||
enable fast_64bit
|
||||
enable fast_clz
|
||||
enable fast_unaligned
|
||||
case $cpu in
|
||||
la464)
|
||||
cpuflags="-march=$cpu"
|
||||
;;
|
||||
esac
|
||||
elif enabled mips; then
|
||||
|
||||
if [ "$cpu" != "generic" ]; then
|
||||
|
@ -5325,6 +5410,11 @@ case "$arch" in
|
|||
aarch64|alpha|ia64)
|
||||
enabled shared && enable_weak pic
|
||||
;;
|
||||
loongarch)
|
||||
check_64bit loongarch32 loongarch64
|
||||
enabled loongarch64 && disable loongarch32
|
||||
enabled shared && enable_weak pic
|
||||
;;
|
||||
mips)
|
||||
check_64bit mips mips64 '_MIPS_SIM > 1'
|
||||
enabled shared && enable_weak pic
|
||||
|
@ -5337,6 +5427,10 @@ case "$arch" in
|
|||
check_64bit ppc ppc64
|
||||
enabled shared && enable_weak pic
|
||||
;;
|
||||
riscv)
|
||||
check_64bit riscv32 riscv64
|
||||
enabled shared && enable_weak pic
|
||||
;;
|
||||
s390)
|
||||
check_64bit s390 s390x
|
||||
enabled shared && enable_weak pic
|
||||
|
@ -6068,6 +6162,9 @@ EOF
|
|||
;;
|
||||
esac
|
||||
|
||||
elif enabled loongarch; then
|
||||
enabled lsx && check_inline_asm lsx '"vadd.b $vr0, $vr1, $vr2"' '-mlsx' && append LSXFLAGS '-mlsx'
|
||||
enabled lasx && check_inline_asm lasx '"xvadd.b $xr0, $xr1, $xr2"' '-mlasx' && append LASXFLAGS '-mlasx'
|
||||
fi
|
||||
|
||||
check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
|
||||
|
@ -6244,6 +6341,7 @@ enabled appkit && check_apple_framework AppKit
|
|||
enabled audiotoolbox && check_apple_framework AudioToolbox
|
||||
enabled avfoundation && check_apple_framework AVFoundation
|
||||
enabled coreimage && check_apple_framework CoreImage
|
||||
enabled metal && check_apple_framework Metal
|
||||
enabled videotoolbox && check_apple_framework VideoToolbox
|
||||
|
||||
check_apple_framework CoreFoundation
|
||||
|
@ -6260,12 +6358,25 @@ enabled videotoolbox && {
|
|||
check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString "-framework CoreServices"
|
||||
check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia"
|
||||
check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVCWithAlpha "-framework CoreMedia"
|
||||
check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_VP9 "-framework CoreMedia"
|
||||
check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferYCbCrMatrix_ITU_R_2020 "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferColorPrimaries_ITU_R_2020 "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2020 "-framework CoreVideo"
|
||||
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_428_1 "-framework CoreVideo"
|
||||
}
|
||||
|
||||
enabled metal && test_cmd $metalcc -v || disable metal
|
||||
|
||||
check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
|
||||
|
||||
check_type "windows.h dxva.h" "DXVA_PicParams_AV1" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
|
||||
|
@ -6306,6 +6417,10 @@ if ! disabled ffnvcodec; then
|
|||
check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.11 ffnvcodec < 8.2" "$ffnv_hdr_list" ""
|
||||
fi
|
||||
|
||||
if enabled_all libglslang libshaderc; then
|
||||
die "ERROR: libshaderc and libglslang are mutually exclusive, if in doubt, disable libglslang"
|
||||
fi
|
||||
|
||||
check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
|
||||
|
||||
if ! disabled w32threads && ! enabled pthreads; then
|
||||
|
@ -6401,7 +6516,7 @@ enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "ar
|
|||
die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; }
|
||||
enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
|
||||
enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
|
||||
enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init
|
||||
enabled libass && require_pkg_config libass "libass >= 0.11.0" ass/ass.h ass_library_init
|
||||
enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open
|
||||
enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
|
||||
enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
|
||||
|
@ -6422,7 +6537,12 @@ enabled fontconfig && enable libfontconfig
|
|||
enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
|
||||
enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
|
||||
enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
|
||||
enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
|
||||
enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
|
||||
-lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
|
||||
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
|
||||
require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
|
||||
-lglslang -lOSDependent -lHLSL -lOGLCompiler \
|
||||
-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
|
||||
enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
|
||||
require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
|
||||
enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
|
||||
|
@ -6470,6 +6590,7 @@ enabled libopus && {
|
|||
require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create
|
||||
}
|
||||
}
|
||||
enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.0" libplacebo/vulkan.h pl_vulkan_create
|
||||
enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
|
||||
enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
|
||||
enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new
|
||||
|
@ -6477,6 +6598,7 @@ enabled librist && require_pkg_config librist "librist >= 0.2" librist
|
|||
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
|
||||
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
|
||||
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
|
||||
enabled libshaderc && require_pkg_config spirv_compiler "shaderc >= 2019.1" shaderc/shaderc.h shaderc_compiler_initialize
|
||||
enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
|
||||
enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
|
||||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
|
||||
|
@ -6709,7 +6831,8 @@ enabled alsa && { check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimesta
|
|||
enabled libjack &&
|
||||
require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
|
||||
|
||||
enabled sndio && check_lib sndio sndio.h sio_open -lsndio
|
||||
enabled sndio && { check_pkg_config sndio sndio "sndio.h" sio_open ||
|
||||
check_lib sndio sndio.h sio_open -lsndio; }
|
||||
|
||||
if enabled libcdio; then
|
||||
check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
|
||||
|
@ -6806,10 +6929,8 @@ enabled vdpau &&
|
|||
enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
|
||||
|
||||
if enabled vulkan; then
|
||||
require_pkg_config_cpp vulkan "vulkan >= 1.1.97" "vulkan/vulkan.h" "defined VK_VERSION_1_1" ||
|
||||
require_cpp_condition vulkan "vulkan/vulkan.h" "defined VK_VERSION_1_1"
|
||||
# vulkan_lib should be removed once glslang filters are updated
|
||||
check_pkg_config vulkan_lib "vulkan >= 1.1.97" "vulkan/vulkan.h" vkCreateInstance
|
||||
check_pkg_config_header_only vulkan "vulkan >= 1.2.189" "vulkan/vulkan.h" "defined VK_VERSION_1_2" ||
|
||||
check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_3) || (defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 189)"
|
||||
fi
|
||||
|
||||
if enabled x86; then
|
||||
|
@ -6869,7 +6990,6 @@ check_cflags -Wwrite-strings
|
|||
check_cflags -Wtype-limits
|
||||
check_cflags -Wundef
|
||||
check_cflags -Wmissing-prototypes
|
||||
check_cflags -Wno-pointer-to-int-cast
|
||||
check_cflags -Wstrict-prototypes
|
||||
check_cflags -Wempty-body
|
||||
|
||||
|
@ -7399,6 +7519,10 @@ if enabled ppc; then
|
|||
echo "PPC 4xx optimizations ${ppc4xx-no}"
|
||||
echo "dcbzl available ${dcbzl-no}"
|
||||
fi
|
||||
if enabled loongarch; then
|
||||
echo "LSX enabled ${lsx-no}"
|
||||
echo "LASX enabled ${lasx-no}"
|
||||
fi
|
||||
echo "debug symbols ${debug-no}"
|
||||
echo "strip symbols ${stripping-no}"
|
||||
echo "optimize for size ${small-no}"
|
||||
|
@ -7521,6 +7645,8 @@ ARFLAGS=$arflags
|
|||
AR_O=$ar_o
|
||||
AR_CMD=$ar
|
||||
NM_CMD=$nm
|
||||
METALCC=$metalcc
|
||||
METALLIB=$metallib
|
||||
RANLIB=$ranlib
|
||||
STRIP=$strip
|
||||
STRIPTYPE=$striptype
|
||||
|
@ -7530,7 +7656,7 @@ LN_S=$ln_s
|
|||
CPPFLAGS=$CPPFLAGS
|
||||
CFLAGS=$CFLAGS
|
||||
CXXFLAGS=$CXXFLAGS
|
||||
OBJCFLAGS=$OBJCFLAGS
|
||||
OBJCCFLAGS=$OBJCFLAGS
|
||||
ASFLAGS=$ASFLAGS
|
||||
NVCCFLAGS=$nvccflags
|
||||
AS_C=$AS_C
|
||||
|
@ -7560,6 +7686,8 @@ ASMSTRIPFLAGS=$ASMSTRIPFLAGS
|
|||
X86ASMFLAGS=$X86ASMFLAGS
|
||||
MSAFLAGS=$MSAFLAGS
|
||||
MMIFLAGS=$MMIFLAGS
|
||||
LSXFLAGS=$LSXFLAGS
|
||||
LASXFLAGS=$LASXFLAGS
|
||||
BUILDSUF=$build_suffix
|
||||
PROGSSUF=$progs_suffix
|
||||
FULLNAME=$FULLNAME
|
||||
|
@ -7578,6 +7706,8 @@ ASDEP_FLAGS=$ASDEP_FLAGS
|
|||
X86ASMDEP=$X86ASMDEP
|
||||
X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
|
||||
CC_DEPFLAGS=$CC_DEPFLAGS
|
||||
CXX_DEPFLAGS=$CXX_DEPFLAGS
|
||||
OBJCC_DEPFLAGS=$OBJC_DEPFLAGS
|
||||
AS_DEPFLAGS=$AS_DEPFLAGS
|
||||
X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
|
||||
HOSTCC=$host_cc
|
||||
|
@ -7633,7 +7763,7 @@ cat > $TMPH <<EOF
|
|||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2021
|
||||
#define CONFIG_THIS_YEAR 2022
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
|
104
doc/APIchanges
104
doc/APIchanges
|
@ -14,28 +14,88 @@ libavutil: 2021-04-27
|
|||
|
||||
API changes, most recent first:
|
||||
|
||||
2021-09-21 - xxxxxxxxxx - lavu 57.7.100 - pixfmt.h
|
||||
2022-01-04 - 78dc21b123e - lavu 57.16.100 - frame.h
|
||||
Add AV_FRAME_DATA_DOVI_METADATA.
|
||||
|
||||
2022-01-03 - 70f318e6b6c - lavf 59.13.100 - avformat.h
|
||||
Add AVFMT_EXPERIMENTAL flag.
|
||||
|
||||
2021-12-22 - b7e1ec7bda9 - lavu 57.13.100 - hwcontext_videotoolbox.h
|
||||
Add av_vt_pixbuf_set_attachments
|
||||
|
||||
2021-12-22 - 69bd95dcd8d - lavu 57.13.100 - hwcontext_videotoolbox.h
|
||||
Add av_map_videotoolbox_chroma_loc_from_av
|
||||
Add av_map_videotoolbox_color_matrix_from_av
|
||||
Add av_map_videotoolbox_color_primaries_from_av
|
||||
Add av_map_videotoolbox_color_trc_from_av
|
||||
|
||||
2021-12-21 - ffbab99f2c2 - lavu 57.12.100 - cpu.h
|
||||
Add AV_CPU_FLAG_SLOW_GATHER.
|
||||
|
||||
2021-12-20 - 278068dc60d - lavu 57.11.101 - display.h
|
||||
Modified the documentation of av_display_rotation_set()
|
||||
to match its longstanding actual behaviour of treating
|
||||
the angle as directed clockwise.
|
||||
|
||||
2021-12-12 - 64834bb86a1 - lavf 59.10.100 - avformat.h
|
||||
Add AVFormatContext io_close2 which returns an int
|
||||
|
||||
2021-12-10 - f45cbb775e4 - lavu 57.11.100 - hwcontext_vulkan.h
|
||||
Add AVVkFrame.offset and AVVulkanFramesContext.flags.
|
||||
|
||||
2021-12-04 - b9c928a486f - lavfi 8.19.100 - avfilter.h
|
||||
Add AVFILTER_FLAG_METADATA_ONLY.
|
||||
|
||||
2021-12-03 - b236ef0a594 - lavu 57.10.100 - frame.h
|
||||
Add AVFrame.time_base
|
||||
|
||||
2021-11-22 - b2cd1fb2ec6 - lavu 57.9.100 - pixfmt.h
|
||||
Add AV_PIX_FMT_P210, AV_PIX_FMT_P410, AV_PIX_FMT_P216, and AV_PIX_FMT_P416.
|
||||
|
||||
2021-11-17 - 54e65aa38ab - lavf 57.9.100 - frame.h
|
||||
Add AV_FRAME_DATA_DOVI_RPU_BUFFER.
|
||||
|
||||
2021-11-16 - ed75a08d36c - lavf 59.9.100 - avformat.h
|
||||
Add av_stream_get_class(). Schedule adding AVStream.av_class at libavformat
|
||||
major version 60.
|
||||
Add av_disposition_to_string() and av_disposition_from_string().
|
||||
Add "disposition" AVOption to AVStream's class.
|
||||
|
||||
2021-11-12 - 8478d60d5b5 - lavu 57.8.100 - hwcontext_vulkan.h
|
||||
Added AVVkFrame.sem_value, AVVulkanDeviceContext.queue_family_encode_index,
|
||||
nb_encode_queues, queue_family_decode_index, and nb_decode_queues.
|
||||
|
||||
2021-10-18 - 682bafdb125 - lavf 59.8.100 - avio.h
|
||||
Introduce public bytes_{read,written} statistic fields to AVIOContext.
|
||||
|
||||
2021-10-13 - a5622ed16f8 - lavf 59.7.100 - avio.h
|
||||
Deprecate AVIOContext.written. Originally added as a private entry in
|
||||
commit 3f75e5116b900f1428aa13041fc7d6301bf1988a, its grouping with
|
||||
the comment noting its private state was missed during merging of the field
|
||||
from Libav (most likely due to an already existing field in between).
|
||||
|
||||
2021-09-21 - 0760d9153c3 - lavu 57.7.100 - pixfmt.h
|
||||
Add AV_PIX_FMT_X2BGR10.
|
||||
|
||||
2021-09-20 - xxxxxxxxxx - lavu 57.6.100 - mem.h
|
||||
2021-09-20 - 8d5de914d31 - lavu 57.6.100 - mem.h
|
||||
Deprecate av_mallocz_array() as it is identical to av_calloc().
|
||||
|
||||
2021-09-20 - xxxxxxxxxx - lavc 59.9.100 - avcodec.h
|
||||
2021-09-20 - 176b8d785bf - lavc 59.9.100 - avcodec.h
|
||||
Deprecate AVCodecContext.sub_text_format and the corresponding
|
||||
AVOptions. It is unused since the last major bump.
|
||||
|
||||
2021-09-20 - xxxxxxxxxx - lavc 59.8.100 - avcodec.h codec.h
|
||||
2021-09-20 - dd846bc4a91 - lavc 59.8.100 - avcodec.h codec.h
|
||||
Deprecate AV_CODEC_FLAG_TRUNCATED and AV_CODEC_CAP_TRUNCATED,
|
||||
as they are redundant with parsers.
|
||||
|
||||
2021-09-17 - xxxxxxxxxx - lavu 57.5.101 - buffer.h
|
||||
2021-09-17 - ccfdef79b13 - lavu 57.5.101 - buffer.h
|
||||
Constified the input parameters in av_buffer_replace(), av_buffer_ref(),
|
||||
and av_buffer_pool_buffer_get_opaque().
|
||||
|
||||
2021-09-08 - xxxxxxxxxx - lavu 57.5.100 - hwcontext_d3d11va.h
|
||||
2021-09-08 - 4f78711f9c2 - lavu 57.5.100 - hwcontext_d3d11va.h
|
||||
Add AVD3D11VAFramesContext.texture_infos
|
||||
|
||||
2021-09-06 - xxxxxxxxxx - lsws 6.1.100 - swscale.h
|
||||
2021-09-06 - 42cd64c1826 - lsws 6.1.100 - swscale.h
|
||||
Add AVFrame-based scaling API:
|
||||
- sws_scale_frame()
|
||||
- sws_frame_start()
|
||||
|
@ -44,54 +104,54 @@ API changes, most recent first:
|
|||
- sws_receive_slice()
|
||||
- sws_receive_slice_alignment()
|
||||
|
||||
2021-09-02 - xxxxxxxxxx - lavc 59.7.100 - avcodec.h
|
||||
2021-09-02 - cbf111059d2 - lavc 59.7.100 - avcodec.h
|
||||
Incremented the number of elements of AVCodecParser.codec_ids to seven.
|
||||
|
||||
2021-08-24 - xxxxxxxxxx - lavc 59.6.100 - avcodec.h
|
||||
2021-08-24 - 590a7e02f04 - lavc 59.6.100 - avcodec.h
|
||||
Add FF_CODEC_PROPERTY_FILM_GRAIN
|
||||
|
||||
2021-08-20 - xxxxxxxxxx - lavfi 8.3.100 - avfilter.H
|
||||
2021-08-20 - 7c5f998196d - lavfi 8.3.100 - avfilter.H
|
||||
Add avfilter_filter_pad_count() as a replacement for avfilter_pad_count().
|
||||
Deprecate avfilter_pad_count().
|
||||
|
||||
2021-08-17 - xxxxxxxxxx - lavu 57.4.101 - opt.h
|
||||
2021-08-17 - 8c53b145993 - lavu 57.4.101 - opt.h
|
||||
av_opt_copy() now guarantees that allocated src and dst options
|
||||
don't alias each other even on error.
|
||||
|
||||
2021-08-14 - xxxxxxxxxx - lavu 57.4.100 - imgutils.h
|
||||
2021-08-14 - d5de9965ef6 - lavu 57.4.100 - imgutils.h
|
||||
Add av_image_copy_plane_uc_from()
|
||||
|
||||
2021-08-02 - xxxxxxxxxx - lavc 59.4.100 - packet.h
|
||||
2021-08-02 - a1a0fddfd05 - lavc 59.4.100 - packet.h
|
||||
Add AVPacket.opaque, AVPacket.opaque_ref, AVPacket.time_base.
|
||||
|
||||
2021-07-23 - xxxxxxxxxx - lavu 57.3.100 - common.h macros.h
|
||||
2021-07-23 - 2dd8acbe800 - lavu 57.3.100 - common.h macros.h
|
||||
Move several macros (AV_NE, FFDIFFSIGN, FFMAX, FFMAX3, FFMIN, FFMIN3,
|
||||
FFSWAP, FF_ARRAY_ELEMS, MKTAG, MKBETAG) from common.h to macros.h.
|
||||
|
||||
2021-07-22 - xxxxxxxxxx - lavu 57.2.100 - film_grain_params.h
|
||||
2021-07-22 - e3b5ff17c2e - lavu 57.2.100 - film_grain_params.h
|
||||
Add AV_FILM_GRAIN_PARAMS_H274, AVFilmGrainH274Params
|
||||
|
||||
2021-07-19 - xxxxxxxxxx - lavu 57.1.100 - cpu.h
|
||||
2021-07-19 - c1bf56a526f - lavu 57.1.100 - cpu.h
|
||||
Add av_cpu_force_count()
|
||||
|
||||
2021-06-17 - xxxxxxxxxx - lavc 59.2.100 - packet.h
|
||||
2021-06-17 - aca923b3653 - lavc 59.2.100 - packet.h
|
||||
Add AV_PKT_DATA_DYNAMIC_HDR10_PLUS
|
||||
|
||||
2021-06-09 - xxxxxxxxxx - lavf 59.3.100 - avformat.h
|
||||
2021-06-09 - 2cccab96f6f - lavf 59.3.100 - avformat.h
|
||||
Add pts_wrap_bits to AVStream
|
||||
|
||||
2021-xx-xx - xxxxxxxxxx - lavc 59.1.100 - avcodec.h codec.h
|
||||
2021-06-10 - 7c9763070d9 - lavc 59.1.100 - avcodec.h codec.h
|
||||
Move av_get_profile_name() from avcodec.h to codec.h.
|
||||
|
||||
2021-xx-xx - xxxxxxxxxx - lavc 59.1.100 - avcodec.h codec_par.h
|
||||
2021-06-10 - bb3648e6766 - lavc 59.1.100 - avcodec.h codec_par.h
|
||||
Move av_get_audio_frame_duration2() from avcodec.h to codec_par.h.
|
||||
|
||||
2021-xx-xx - xxxxxxxxxx - lavc 59.1.100 - avcodec.h codec_id.h
|
||||
2021-06-10 - 881db34f6a0 - lavc 59.1.100 - avcodec.h codec_id.h
|
||||
Move av_get_bits_per_sample(), av_get_exact_bits_per_sample(),
|
||||
avcodec_profile_name(), and av_get_pcm_codec() from avcodec.h
|
||||
to codec_id.h.
|
||||
|
||||
2021-xx-xx - xxxxxxxxxx - lavc 59.1.100 - avcodec.h defs.h
|
||||
2021-06-10 - ff0a96046d8 - lavc 59.1.100 - avcodec.h defs.h
|
||||
Add new installed header defs.h. The following definitions are moved
|
||||
into it from avcodec.h:
|
||||
- AVDiscard
|
||||
|
|
|
@ -81,7 +81,7 @@ Top-left position.
|
|||
@end table
|
||||
|
||||
@item tick_rate
|
||||
Set the tick rate (@emph{num_units_in_display_tick / time_scale}) in
|
||||
Set the tick rate (@emph{time_scale / num_units_in_display_tick}) in
|
||||
the timing info in the sequence header.
|
||||
@item num_ticks_per_picture
|
||||
Set the number of ticks in each picture, to indicate that the stream
|
||||
|
@ -244,7 +244,7 @@ Set the chroma sample location in the stream (see H.264 section
|
|||
E.2.1 and figure E-1).
|
||||
|
||||
@item tick_rate
|
||||
Set the tick rate (num_units_in_tick / time_scale) in the VUI
|
||||
Set the tick rate (time_scale / num_units_in_tick) in the VUI
|
||||
parameters. This is the smallest time unit representable in the
|
||||
stream, and in many cases represents the field rate of the stream
|
||||
(double the frame rate).
|
||||
|
@ -352,8 +352,8 @@ Set the chroma sample location in the stream (see H.265 section
|
|||
E.3.1 and figure E.1).
|
||||
|
||||
@item tick_rate
|
||||
Set the tick rate in the VPS and VUI parameters (num_units_in_tick /
|
||||
time_scale). Combined with @option{num_ticks_poc_diff_one}, this can
|
||||
Set the tick rate in the VPS and VUI parameters (time_scale /
|
||||
num_units_in_tick). Combined with @option{num_ticks_poc_diff_one}, this can
|
||||
set a constant framerate in the stream. Note that it is likely to be
|
||||
overridden by container parameters when the stream is in a container.
|
||||
|
||||
|
|
|
@ -126,6 +126,48 @@ Set amount of frame threads to use during decoding. The default value is 0 (auto
|
|||
|
||||
@end table
|
||||
|
||||
@section QSV Decoders
|
||||
|
||||
The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
|
||||
JPEG/MJPEG, VP8, VP9, AV1).
|
||||
|
||||
@subsection Common Options
|
||||
|
||||
The following options are supported by all qsv decoders.
|
||||
|
||||
@table @option
|
||||
|
||||
@item @var{async_depth}
|
||||
Internal parallelization depth, the higher the value the higher the latency.
|
||||
|
||||
@item @var{gpu_copy}
|
||||
A GPU-accelerated copy between video and system memory
|
||||
@table @samp
|
||||
@item default
|
||||
@item on
|
||||
@item off
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@subsection HEVC Options
|
||||
Extra options for hevc_qsv.
|
||||
|
||||
@table @option
|
||||
|
||||
@item @var{load_plugin}
|
||||
A user plugin to load in an internal session
|
||||
@table @samp
|
||||
@item none
|
||||
@item hevc_sw
|
||||
@item hevc_hw
|
||||
@end table
|
||||
|
||||
@item @var{load_plugins}
|
||||
A :-separate list of hexadecimal plugin UIDs to load in an internal session
|
||||
|
||||
@end table
|
||||
|
||||
@c man end VIDEO DECODERS
|
||||
|
||||
@chapter Audio Decoders
|
||||
|
|
|
@ -25,6 +25,13 @@ Audible Format 2, 3, and 4 demuxer.
|
|||
|
||||
This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
|
||||
|
||||
@section aac
|
||||
|
||||
Raw Audio Data Transport Stream AAC demuxer.
|
||||
|
||||
This demuxer is used to demux an ADTS input containing a single AAC stream
|
||||
alongwith any ID3v1/2 or APE tags in it.
|
||||
|
||||
@section apng
|
||||
|
||||
Animated Portable Network Graphics demuxer.
|
||||
|
@ -267,6 +274,12 @@ which streams to actually receive.
|
|||
Each stream mirrors the @code{id} and @code{bandwidth} properties from the
|
||||
@code{<Representation>} as metadata keys named "id" and "variant_bitrate" respectively.
|
||||
|
||||
@section imf
|
||||
|
||||
Interoperable Master Format demuxer.
|
||||
|
||||
This demuxer presents audio and video streams found in an IMF Composition.
|
||||
|
||||
@section flv, live_flv, kux
|
||||
|
||||
Adobe Flash Video Format demuxer.
|
||||
|
@ -691,7 +704,7 @@ Don't use mfra box to set timestamps
|
|||
|
||||
@item use_tfdt
|
||||
For fragmented input, set fragment's starting timestamp to @code{baseMediaDecodeTime} from the @code{tfdt} box.
|
||||
Default is disabled, which will preferentially use the @code{earliest_presentation_time} from the @code{sidx} box.
|
||||
Default is enabled, which will prefer to use the @code{tfdt} box to set DTS. Disable to use the @code{earliest_presentation_time} from the @code{sidx} box.
|
||||
In either case, the timestamp from the @code{mfra} box will be used if it's available and @code{use_mfra_for} is
|
||||
set to pts or dts.
|
||||
|
||||
|
@ -713,6 +726,15 @@ specify.
|
|||
|
||||
@item decryption_key
|
||||
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
|
||||
@item max_stts_delta
|
||||
Very high sample deltas written in a trak's stts box may occasionally be intended but usually they are written in
|
||||
error or used to store a negative value for dts correction when treated as signed 32-bit integers. This option lets
|
||||
the user set an upper limit, beyond which the delta is clamped to 1. Values greater than the limit if negative when
|
||||
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.
|
||||
@end table
|
||||
|
||||
@subsection Audible AAX
|
||||
|
|
|
@ -494,6 +494,22 @@ patch is inline or attached per mail.
|
|||
You can check @url{https://patchwork.ffmpeg.org}, if your patch does not show up, its mime type
|
||||
likely was wrong.
|
||||
|
||||
@subheading Sending patches from email clients
|
||||
Using @code{git send-email} might not be desirable for everyone. The
|
||||
following trick allows to send patches via email clients in a safe
|
||||
way. It has been tested with Outlook and Thunderbird (with X-Unsent
|
||||
extension) and might work with other applications.
|
||||
|
||||
Create your patch like this:
|
||||
|
||||
@verbatim
|
||||
git format-patch -s -o "outputfolder" --add-header "X-Unsent: 1" --suffix .eml --to ffmpeg-devel@ffmpeg.org -1 1a2b3c4d
|
||||
@end verbatim
|
||||
|
||||
Now you'll just need to open the eml file with the email application
|
||||
and execute 'Send'.
|
||||
|
||||
@subheading Reviews
|
||||
Your patch will be reviewed on the mailing list. You will likely be asked
|
||||
to make some changes and are expected to send in an improved version that
|
||||
incorporates the requests from the review. This process may go through
|
||||
|
|
|
@ -2660,6 +2660,9 @@ ffmpeg -i foo.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
|
|||
Import closed captions (which must be ATSC compatible format) into output.
|
||||
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 x264-params (N.A.)
|
||||
Override the x264 configuration using a :-separated list of key=value
|
||||
parameters.
|
||||
|
@ -2741,6 +2744,9 @@ Quantizer curve compression factor
|
|||
Normally, when forcing a I-frame type, the encoder can select any type
|
||||
of I-frame. This option forces it to choose an IDR-frame.
|
||||
|
||||
@item udu_sei @var{boolean}
|
||||
Import user data unregistered SEI if available into output. Default is 0 (off).
|
||||
|
||||
@item x265-params
|
||||
Set x265 options using a list of @var{key}=@var{value} couples separated
|
||||
by ":". See @command{x265 --help} for a list of options.
|
||||
|
@ -3117,12 +3123,13 @@ Setting a higher @option{bits_per_mb} limit will improve the speed.
|
|||
For the fastest encoding speed set the @option{qscale} parameter (4 is the
|
||||
recommended value) and do not set a size constraint.
|
||||
|
||||
@section QSV encoders
|
||||
@section QSV Encoders
|
||||
|
||||
The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG and VP9)
|
||||
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:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
When @option{global_quality} is specified, a quality-based mode is used.
|
||||
|
@ -3170,6 +3177,7 @@ Note that depending on your system, a different mode than the one you specified
|
|||
may be selected by the encoder. Set the verbosity level to @var{verbose} or
|
||||
higher to see the actual settings used by the QSV runtime.
|
||||
|
||||
@subsection Global Options -> MSDK Options
|
||||
Additional libavcodec global options are mapped to MSDK options as follows:
|
||||
|
||||
@itemize
|
||||
|
@ -3206,6 +3214,251 @@ encoder use CAVLC instead of CABAC.
|
|||
|
||||
@end itemize
|
||||
|
||||
@subsection Common Options
|
||||
Following options are used by all qsv encoders.
|
||||
|
||||
@table @option
|
||||
@item @var{async_depth}
|
||||
Specifies how many asynchronous operations an application performs
|
||||
before the application explicitly synchronizes the result. If zero,
|
||||
the value is not specified.
|
||||
|
||||
@item @var{avbr_accuracy}
|
||||
Accuracy of the AVBR ratecontrol (unit of tenth of percent).
|
||||
|
||||
@item @var{avbr_convergence}
|
||||
Convergence of the AVBR ratecontrol (unit of 100 frames)
|
||||
|
||||
The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
|
||||
average variable bitrate control (AVBR) algorithm.
|
||||
The algorithm focuses on overall encoding quality while meeting the specified
|
||||
bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
|
||||
after a @var{avbr_Convergence} period. This method does not follow HRD and the
|
||||
instant bitrate is not capped or padded.
|
||||
|
||||
@item @var{preset}
|
||||
This option itemizes a range of choices from veryfast (best speed) to veryslow
|
||||
(best quality).
|
||||
@table @samp
|
||||
@item veryfast
|
||||
@item faster
|
||||
@item fast
|
||||
@item medium
|
||||
@item slow
|
||||
@item slower
|
||||
@item veryslow
|
||||
@end table
|
||||
|
||||
@item @var{forced_idr}
|
||||
Forcing I frames as IDR frames.
|
||||
|
||||
@item @var{low_power}
|
||||
For encoders set this flag to ON to reduce power consumption and GPU usage.
|
||||
@end table
|
||||
|
||||
@subsection H264 options
|
||||
These options are used by h264_qsv
|
||||
|
||||
@table @option
|
||||
@item @var{extbrc}
|
||||
Extended bitrate control.
|
||||
|
||||
@item @var{recovery_point_sei}
|
||||
Set this flag to insert the recovery point SEI message at the beginning of every
|
||||
intra refresh cycle.
|
||||
|
||||
@item @var{rdo}
|
||||
Enable rate distortion optimization.
|
||||
|
||||
@item @var{max_frame_size}
|
||||
Maximum encoded frame size in bytes.
|
||||
|
||||
@item @var{max_slice_size}
|
||||
Maximum encoded slice size in bytes.
|
||||
|
||||
@item @var{bitrate_limit}
|
||||
Toggle bitrate limitations.
|
||||
Modifies bitrate to be in the range imposed by the QSV encoder. Setting this
|
||||
flag off may lead to violation of HRD conformance. Mind that specifying bitrate
|
||||
below the QSV encoder range might significantly affect quality. If on this
|
||||
option takes effect in non CQP modes: if bitrate is not in the range imposed
|
||||
by the QSV encoder, it will be changed to be in the range.
|
||||
|
||||
@item @var{mbbrc}
|
||||
Setting this flag enables macroblock level bitrate control that generally
|
||||
improves subjective visual quality. Enabling this flag may have negative impact
|
||||
on performance and objective visual quality metric.
|
||||
|
||||
@item @var{adaptive_i}
|
||||
This flag controls insertion of I frames by the QSV encoder. Turn ON this flag
|
||||
to allow changing of frame type from P and B to I.
|
||||
|
||||
@item @var{adaptive_b}
|
||||
This flag controls changing of frame type from B to P.
|
||||
|
||||
@item @var{b_strategy}
|
||||
This option controls usage of B frames as reference.
|
||||
|
||||
@item @var{cavlc}
|
||||
If set, CAVLC is used; if unset, CABAC is used for encoding.
|
||||
|
||||
@item @var{vcm}
|
||||
Video conferencing mode, please see ratecontrol method.
|
||||
|
||||
@item @var{idr_interval}
|
||||
Distance (in I-frames) between IDR frames.
|
||||
|
||||
@item @var{pic_timing_sei}
|
||||
Insert picture timing SEI with pic_struct_syntax element.
|
||||
|
||||
@item @var{single_sei_nal_unit}
|
||||
Put all the SEI messages into one NALU.
|
||||
|
||||
@item @var{max_dec_frame_buffering}
|
||||
Maximum number of frames buffered in the DPB.
|
||||
|
||||
@item @var{look_ahead}
|
||||
Use VBR algorithm with look ahead.
|
||||
|
||||
@item @var{look_ahead_depth}
|
||||
Depth of look ahead in number frames.
|
||||
|
||||
@item @var{look_ahead_downsampling}
|
||||
Downscaling factor for the frames saved for the lookahead analysis.
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item auto
|
||||
@item off
|
||||
@item 2x
|
||||
@item 4x
|
||||
@end table
|
||||
|
||||
@item @var{int_ref_type}
|
||||
Specifies intra refresh type. The major goal of intra refresh is improvement of
|
||||
error resilience without significant impact on encoded bitstream size caused by
|
||||
I frames. The SDK encoder achieves this by encoding part of each frame in
|
||||
refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means
|
||||
vertical refresh, by column of MBs.
|
||||
|
||||
@item @var{int_ref_cycle_size}
|
||||
Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are
|
||||
invalid values.
|
||||
|
||||
@item @var{int_ref_qp_delta}
|
||||
Specifies QP difference for inserted intra MBs. This is signed value in
|
||||
[-51, 51] range if target encoding bit-depth for luma samples is 8 and this
|
||||
range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
|
||||
|
||||
@item @var{profile}
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item baseline
|
||||
@item main
|
||||
@item high
|
||||
@end table
|
||||
|
||||
@item @var{a53cc}
|
||||
Use A53 Closed Captions (if available).
|
||||
|
||||
@item @var{aud}
|
||||
Insert the Access Unit Delimiter NAL.
|
||||
|
||||
@item @var{mfmode}
|
||||
Multi-Frame Mode.
|
||||
@table @samp
|
||||
@item off
|
||||
@item auto
|
||||
@end table
|
||||
|
||||
@item @var{repeat_pps}
|
||||
Repeat pps for every frame.
|
||||
@end table
|
||||
|
||||
@subsection HEVC Options
|
||||
These options are used by hevc_qsv
|
||||
|
||||
@table @option
|
||||
@item @var{extbrc}
|
||||
Extended bitrate control.
|
||||
|
||||
@item @var{recovery_point_sei}
|
||||
Set this flag to insert the recovery point SEI message at the beginning of every
|
||||
intra refresh cycle.
|
||||
|
||||
@item @var{rdo}
|
||||
Enable rate distortion optimization.
|
||||
|
||||
@item @var{idr_interval}
|
||||
Distance (in I-frames) between IDR frames.
|
||||
@table @samp
|
||||
@item begin_only
|
||||
Output an IDR-frame only at the beginning of the stream.
|
||||
@end table
|
||||
|
||||
@item @var{load_plugin}
|
||||
A user plugin to load in an internal session.
|
||||
@table @samp
|
||||
@item none
|
||||
@item hevc_sw
|
||||
@item hevc_hw
|
||||
@end table
|
||||
|
||||
@item @var{load_plugins}
|
||||
A :-separate list of hexadecimal plugin UIDs to load in
|
||||
an internal session.
|
||||
|
||||
@item @var{look_ahead_depth}
|
||||
Depth of look ahead in number frames, available when extbrc option is enabled.
|
||||
|
||||
@item @var{profile}
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item main
|
||||
@item main10
|
||||
@item mainsp
|
||||
@item rext
|
||||
@end table
|
||||
|
||||
@item @var{gpb}
|
||||
1: GPB (generalized P/B frame)
|
||||
|
||||
0: regular P frame.
|
||||
|
||||
@item @var{tile_cols}
|
||||
Number of columns for tiled encoding.
|
||||
|
||||
@item @var{tile_rows}
|
||||
Number of rows for tiled encoding.
|
||||
|
||||
@item @var{aud}
|
||||
Insert the Access Unit Delimiter NAL.
|
||||
@end table
|
||||
|
||||
@subsection MPEG2 Options
|
||||
These options are used by mpeg2_qsv
|
||||
@table @option
|
||||
@item @var{profile}
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item simple
|
||||
@item main
|
||||
@item high
|
||||
@end table
|
||||
@end table
|
||||
|
||||
@subsection VP9 Options
|
||||
These options are used by vp9_qsv
|
||||
@table @option
|
||||
@item @var{profile}
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item profile0
|
||||
@item profile1
|
||||
@item profile2
|
||||
@item profile3
|
||||
@end table
|
||||
@end table
|
||||
|
||||
@section snow
|
||||
|
||||
@subsection Options
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
int main (int argc, char **argv)
|
||||
{
|
||||
AVFormatContext *fmt_ctx = NULL;
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
const AVDictionaryEntry *tag = NULL;
|
||||
int ret;
|
||||
|
||||
if (argc != 2) {
|
||||
|
|
|
@ -560,27 +560,22 @@ ffmpeg -i INPUT -metadata:s:a:0 language=eng OUTPUT
|
|||
@item -disposition[:stream_specifier] @var{value} (@emph{output,per-stream})
|
||||
Sets the disposition for a stream.
|
||||
|
||||
This option overrides the disposition copied from the input stream. It is also
|
||||
possible to delete the disposition by setting it to 0.
|
||||
By default, the disposition is copied from the input stream, unless the output
|
||||
stream this option applies to is fed by a complex filtergraph - in that case the
|
||||
disposition is unset by default.
|
||||
|
||||
The following dispositions are recognized:
|
||||
@table @option
|
||||
@item default
|
||||
@item dub
|
||||
@item original
|
||||
@item comment
|
||||
@item lyrics
|
||||
@item karaoke
|
||||
@item forced
|
||||
@item hearing_impaired
|
||||
@item visual_impaired
|
||||
@item clean_effects
|
||||
@item attached_pic
|
||||
@item captions
|
||||
@item descriptions
|
||||
@item dependent
|
||||
@item metadata
|
||||
@end table
|
||||
@var{value} is a sequence of items separated by '+' or '-'. The first item may
|
||||
also be prefixed with '+' or '-', in which case this option modifies the default
|
||||
value. Otherwise (the first item is not prefixed) this options overrides the
|
||||
default value. A '+' prefix adds the given disposition, '-' removes it. It is
|
||||
also possible to clear the disposition by setting it to 0.
|
||||
|
||||
If no @code{-disposition} options were specified for an output file, ffmpeg will
|
||||
automatically set the 'default' disposition on the first stream of each type,
|
||||
when there are multiple streams of this type in the output file and no stream of
|
||||
that type is already marked as default.
|
||||
|
||||
The @code{-dispositions} option lists the known dispositions.
|
||||
|
||||
For example, to make the second audio stream the default stream:
|
||||
@example
|
||||
|
@ -1101,6 +1096,21 @@ device type:
|
|||
@item cuda
|
||||
@var{device} is the number of the CUDA device.
|
||||
|
||||
The following options are recognized:
|
||||
@table @option
|
||||
@item primary_ctx
|
||||
If set to 1, uses the primary device context instead of creating a new one.
|
||||
@end table
|
||||
|
||||
Examples:
|
||||
@table @emph
|
||||
@item -init_hw_device cuda:1
|
||||
Choose the second device on the system.
|
||||
|
||||
@item -init_hw_device cuda:0,primary_ctx=1
|
||||
Choose the first device and use the primary device context.
|
||||
@end table
|
||||
|
||||
@item dxva2
|
||||
@var{device} is the number of the Direct3D 9 display adapter.
|
||||
|
||||
|
@ -1610,23 +1620,25 @@ It is useful for when flow speed of output packets is important, such as live st
|
|||
Read input at native frame rate. This is equivalent to setting @code{-readrate 1}.
|
||||
@item -vsync @var{parameter}
|
||||
Video sync method.
|
||||
For compatibility reasons old values can be specified as numbers.
|
||||
Newly added values will have to be specified as strings always.
|
||||
|
||||
For compatibility reasons some of the values can be specified as numbers (shown
|
||||
in parentheses in the following table). This is deprecated and will stop working
|
||||
in the future.
|
||||
|
||||
@table @option
|
||||
@item 0, passthrough
|
||||
@item passthrough (0)
|
||||
Each frame is passed with its timestamp from the demuxer to the muxer.
|
||||
@item 1, cfr
|
||||
@item cfr (1)
|
||||
Frames will be duplicated and dropped to achieve exactly the requested
|
||||
constant frame rate.
|
||||
@item 2, vfr
|
||||
@item vfr (2)
|
||||
Frames are passed through with their timestamp or dropped so as to
|
||||
prevent 2 frames from having the same timestamp.
|
||||
@item drop
|
||||
As passthrough but destroys all timestamps, making the muxer generate
|
||||
fresh timestamps based on frame-rate.
|
||||
@item -1, auto
|
||||
Chooses between 1 and 2 depending on muxer capabilities. This is the
|
||||
@item auto (-1)
|
||||
Chooses between cfr and vfr depending on muxer capabilities. This is the
|
||||
default method.
|
||||
@end table
|
||||
|
||||
|
@ -1950,6 +1962,13 @@ filter (scale, aresample) in the graph.
|
|||
On by default, to explicitly disable it you need to specify
|
||||
@code{-noauto_conversion_filters}.
|
||||
|
||||
@item -bits_per_raw_sample[:@var{stream_specifier}] @var{value} (@emph{output,per-stream})
|
||||
Declare the number of bits per raw sample in the given output stream to be
|
||||
@var{value}. Note that this option sets the information provided to the
|
||||
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.
|
||||
|
||||
@end table
|
||||
|
||||
@section Preset files
|
||||
|
|
|
@ -215,6 +215,7 @@
|
|||
<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" />
|
||||
|
||||
<!-- video attributes -->
|
||||
|
|
|
@ -167,6 +167,9 @@ Show available sample formats.
|
|||
@item -layouts
|
||||
Show channel names and standard channel layouts.
|
||||
|
||||
@item -dispositions
|
||||
Show stream dispositions.
|
||||
|
||||
@item -colors
|
||||
Show recognized color names.
|
||||
|
||||
|
|
471
doc/filters.texi
471
doc/filters.texi
|
@ -843,6 +843,102 @@ Compute derivative/integral of audio stream.
|
|||
|
||||
Applying both filters one after another produces original audio.
|
||||
|
||||
@section adynamicequalizer
|
||||
|
||||
Apply dynamic equalization to input audio stream.
|
||||
|
||||
A description of the accepted options follows.
|
||||
|
||||
@table @option
|
||||
@item threshold
|
||||
Set the detection threshold used to trigger equalization.
|
||||
Threshold detection is using bandpass filter.
|
||||
Default value is 0. Allowed range is from 0 to 100.
|
||||
|
||||
@item dfrequency
|
||||
Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
|
||||
Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
|
||||
|
||||
@item dqfactor
|
||||
Set the detection resonance factor for bandpass filter used to trigger equalization.
|
||||
Default value is 1. Allowed range is from 0.001 to 1000.
|
||||
|
||||
@item tfrequency
|
||||
Set the target frequency of equalization filter.
|
||||
Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
|
||||
|
||||
@item tqfactor
|
||||
Set the target resonance factor for target equalization filter.
|
||||
Default value is 1. Allowed range is from 0.001 to 1000.
|
||||
|
||||
@item attack
|
||||
Set the amount of milliseconds the signal from detection has to rise above
|
||||
the detection threshold before equalization starts.
|
||||
Default is 20. Allowed range is between 1 and 2000.
|
||||
|
||||
@item release
|
||||
Set the amount of milliseconds the signal from detection has to fall below the
|
||||
detection threshold before equalization ends.
|
||||
Default is 200. Allowed range is between 1 and 2000.
|
||||
|
||||
@item knee
|
||||
Curve the sharp knee around the detection threshold to calculate
|
||||
equalization gain more softly.
|
||||
Default is 1. Allowed range is between 0 and 8.
|
||||
|
||||
@item ratio
|
||||
Set the ratio by which the equalization gain is raised.
|
||||
Default is 1. Allowed range is between 1 and 20.
|
||||
|
||||
@item makeup
|
||||
Set the makeup offset in dB by which the equalization gain is raised.
|
||||
Default is 0. Allowed range is between 0 and 30.
|
||||
|
||||
@item range
|
||||
Set the max allowed cut/boost amount in dB. Default is 0.
|
||||
Allowed range is from 0 to 200.
|
||||
|
||||
@item slew
|
||||
Set the slew factor. Default is 1. Allowed range is from 1 to 200.
|
||||
|
||||
@item mode
|
||||
Set the mode of filter operation, can be one of the following:
|
||||
|
||||
@table @samp
|
||||
@item listen
|
||||
Output only isolated bandpass signal.
|
||||
@item cut
|
||||
Cut frequencies above detection threshold.
|
||||
@item boost
|
||||
Boost frequencies bellow detection threshold.
|
||||
@end table
|
||||
Default mode is @samp{cut}.
|
||||
@end table
|
||||
|
||||
@subsection Commands
|
||||
|
||||
This filter supports the all above options as @ref{commands}.
|
||||
|
||||
@section adynamicsmooth
|
||||
|
||||
Apply dynamic smoothing to input audio stream.
|
||||
|
||||
A description of the accepted options follows.
|
||||
|
||||
@table @option
|
||||
@item sensitivity
|
||||
Set an amount of sensitivity to frequency fluctations. Default is 2.
|
||||
Allowed range is from 0 to 1e+06.
|
||||
|
||||
@item basefreq
|
||||
Set a base frequency for smoothing. Default value is 22050.
|
||||
Allowed range is from 2 to 1e+06.
|
||||
@end table
|
||||
|
||||
@subsection Commands
|
||||
|
||||
This filter supports the all above options as @ref{commands}.
|
||||
|
||||
@section aecho
|
||||
|
||||
Apply echoing to the input audio.
|
||||
|
@ -1885,6 +1981,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -2204,8 +2301,8 @@ Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @
|
|||
|
||||
This filter supports the all above options as @ref{commands}.
|
||||
|
||||
@section anlms
|
||||
Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
|
||||
@section anlmf, anlms
|
||||
Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
|
||||
|
||||
This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
|
||||
relate to producing the least mean square of the error signal (difference between the desired,
|
||||
|
@ -2291,12 +2388,12 @@ with @option{pad_len}.
|
|||
@item pad_dur
|
||||
Specify the duration of samples of silence to add. See
|
||||
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
|
||||
for the accepted syntax. Used only if set to non-zero value.
|
||||
for the accepted syntax. Used only if set to non-negative value.
|
||||
|
||||
@item whole_dur
|
||||
Specify the minimum total duration in the output audio stream. See
|
||||
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
|
||||
for the accepted syntax. Used only if set to non-zero value. If the value is longer than
|
||||
for the accepted syntax. Used only if set to non-negative value. If the value is longer than
|
||||
the input audio length, silence is added to the end, until the value is reached.
|
||||
This option is mutually exclusive with @option{pad_dur}
|
||||
@end table
|
||||
|
@ -2305,6 +2402,9 @@ If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
|
|||
nor @option{whole_dur} option is set, the filter will add silence to the end of
|
||||
the input stream indefinitely.
|
||||
|
||||
Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
|
||||
@option{whole_dur} also caused the filter to add silence indefinitely.
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
|
@ -2691,6 +2791,69 @@ Set oversampling factor.
|
|||
|
||||
This filter supports the all above options as @ref{commands}.
|
||||
|
||||
@section aspectralstats
|
||||
|
||||
Display frequency domain statistical information about the audio channels.
|
||||
Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
|
||||
|
||||
It accepts the following option:
|
||||
@table @option
|
||||
@item win_size
|
||||
Set the window length in samples. Default value is 2048.
|
||||
Allowed range is from 32 to 65536.
|
||||
|
||||
@item win_func
|
||||
Set window function.
|
||||
|
||||
It accepts the following values:
|
||||
@table @samp
|
||||
@item rect
|
||||
@item bartlett
|
||||
@item hann, hanning
|
||||
@item hamming
|
||||
@item blackman
|
||||
@item welch
|
||||
@item flattop
|
||||
@item bharris
|
||||
@item bnuttall
|
||||
@item bhann
|
||||
@item sine
|
||||
@item nuttall
|
||||
@item lanczos
|
||||
@item gauss
|
||||
@item tukey
|
||||
@item dolph
|
||||
@item cauchy
|
||||
@item parzen
|
||||
@item poisson
|
||||
@item bohman
|
||||
@end table
|
||||
Default is @code{hann}.
|
||||
|
||||
@item overlap
|
||||
Set window overlap. Allowed range is from @code{0}
|
||||
to @code{1}. Default value is @code{0.5}.
|
||||
|
||||
@end table
|
||||
|
||||
A list of each metadata key follows:
|
||||
|
||||
@table @option
|
||||
@item mean
|
||||
@item variance
|
||||
@item centroid
|
||||
@item spread
|
||||
@item skewness
|
||||
@item kurtosis
|
||||
@item entropy
|
||||
@item flatness
|
||||
@item crest
|
||||
@item flux
|
||||
@item slope
|
||||
@item decrease
|
||||
@item rolloff
|
||||
@end table
|
||||
|
||||
@section asr
|
||||
Automatic Speech Recognition
|
||||
|
||||
|
@ -2799,16 +2962,17 @@ this @code{lavfi.astats.Overall.Peak_count}.
|
|||
For description what each key means read below.
|
||||
|
||||
@item reset
|
||||
Set number of frame after which stats are going to be recalculated.
|
||||
Set the number of frames over which cumulative stats are calculated before
|
||||
being reset
|
||||
Default is disabled.
|
||||
|
||||
@item measure_perchannel
|
||||
Select the entries which need to be measured per channel. The metadata keys can
|
||||
Select the parameters which are measured per channel. The metadata keys can
|
||||
be used as flags, default is @option{all} which measures everything.
|
||||
@option{none} disables all per channel measurement.
|
||||
|
||||
@item measure_overall
|
||||
Select the entries which need to be measured overall. The metadata keys can
|
||||
Select the parameters which are measured overall. The metadata keys can
|
||||
be used as flags, default is @option{all} which measures everything.
|
||||
@option{none} disables all overall measurement.
|
||||
|
||||
|
@ -3246,6 +3410,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -3333,6 +3498,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -3430,6 +3596,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -3512,6 +3679,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -4262,6 +4430,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -4763,6 +4932,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -5113,6 +5283,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -6337,6 +6508,7 @@ Set transform type of IIR filter.
|
|||
@item dii
|
||||
@item tdii
|
||||
@item latt
|
||||
@item svf
|
||||
@end table
|
||||
|
||||
@item precision, r
|
||||
|
@ -8048,7 +8220,7 @@ Set threshold for averaging chrominance values.
|
|||
Sum of absolute difference of Y, U and V pixel components of current
|
||||
pixel and neighbour pixels lower than this threshold will be used in
|
||||
averaging. Luma component is left unchanged and is copied to output.
|
||||
Default value is 30. Allowed range is from 1 to 5000.
|
||||
Default value is 30. Allowed range is from 1 to 200.
|
||||
|
||||
@item sizew
|
||||
Set horizontal radius of rectangle used for averaging.
|
||||
|
@ -8072,19 +8244,19 @@ Mostly useful to speed-up filtering.
|
|||
Set Y threshold for averaging chrominance values.
|
||||
Set finer control for max allowed difference between Y components
|
||||
of current pixel and neigbour pixels.
|
||||
Default value is 5000. Allowed range is from 1 to 5000.
|
||||
Default value is 200. Allowed range is from 1 to 200.
|
||||
|
||||
@item threu
|
||||
Set U threshold for averaging chrominance values.
|
||||
Set finer control for max allowed difference between U components
|
||||
of current pixel and neigbour pixels.
|
||||
Default value is 5000. Allowed range is from 1 to 5000.
|
||||
Default value is 200. Allowed range is from 1 to 200.
|
||||
|
||||
@item threv
|
||||
Set V threshold for averaging chrominance values.
|
||||
Set finer control for max allowed difference between V components
|
||||
of current pixel and neigbour pixels.
|
||||
Default value is 5000. Allowed range is from 1 to 5000.
|
||||
Default value is 200. Allowed range is from 1 to 200.
|
||||
|
||||
@item distance
|
||||
Set distance type used in calculations.
|
||||
|
@ -8493,25 +8665,31 @@ This filter supports the all above options as @ref{commands}.
|
|||
|
||||
@section colorkey
|
||||
RGB colorspace color keying.
|
||||
This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
|
||||
which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
|
||||
the similarity radius depends on the value of the blend option.
|
||||
|
||||
The filter accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item color
|
||||
The color which will be replaced with transparency.
|
||||
Set the color for which alpha will be set to 0 (full transparency).
|
||||
See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
|
||||
Default is @code{black}.
|
||||
|
||||
@item similarity
|
||||
Similarity percentage with the key color.
|
||||
|
||||
0.01 matches only the exact key color, while 1.0 matches everything.
|
||||
Set the radius from the key color within which other colors also have full transparency.
|
||||
The computed distance is related to the unit fractional distance in 3D space between the RGB values
|
||||
of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
|
||||
around the exact key color, while 1.0 matches everything.
|
||||
Default is @code{0.01}.
|
||||
|
||||
@item blend
|
||||
Blend percentage.
|
||||
|
||||
0.0 makes pixels either fully transparent, or not transparent at all.
|
||||
|
||||
Higher values result in semi-transparent pixels, with a higher transparency
|
||||
the more similar the pixels color is to the key color.
|
||||
Set how the alpha value for pixels that fall outside the similarity radius is computed.
|
||||
0.0 makes pixels either fully transparent or fully opaque.
|
||||
Higher values result in semi-transparent pixels, with greater transparency
|
||||
the more similar the pixel color is to the key color.
|
||||
Range is 0.0 to 1.0. Default is @code{0.0}.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
@ -11711,6 +11889,18 @@ Allowed range is from 1 to 15.
|
|||
Specify the search radius for best edge matching. Default value is 2.
|
||||
Allowed range is from 0 to 15.
|
||||
|
||||
@item ecost
|
||||
Specify the edge cost for edge matching. Default value is 0.03125.
|
||||
Allowed range is from 0 to 1.
|
||||
|
||||
@item mcost
|
||||
Specify the middle cost for edge matching. Default value is 0.5.
|
||||
Allowed range is from 0 to 1.
|
||||
|
||||
@item dcost
|
||||
Specify the distance cost for edge matching. Default value is 0.5.
|
||||
Allowed range is from 0 to 1.
|
||||
|
||||
@item interp
|
||||
Specify the interpolation used. Default is 4-point interpolation. It accepts one
|
||||
of the following values:
|
||||
|
@ -13515,6 +13705,9 @@ It accepts the following values:
|
|||
@item coloronblack
|
||||
@item coloronwhite
|
||||
@item colorongray
|
||||
@item blackoncolor
|
||||
@item whiteoncolor
|
||||
@item grayoncolor
|
||||
@end table
|
||||
Default is @code{whiteonblack}.
|
||||
@end table
|
||||
|
@ -13732,15 +13925,15 @@ The filter accepts the following options:
|
|||
|
||||
@table @option
|
||||
@item hue
|
||||
Set the hue value which will be used if color difference calculation.
|
||||
Set the hue value which will be used in color difference calculation.
|
||||
Allowed range is from -360 to 360. Default value is 0.
|
||||
|
||||
@item sat
|
||||
Set the saturation value which will be used if color difference calculation.
|
||||
Set the saturation value which will be used in color difference calculation.
|
||||
Allowed range is from -1 to 1. Default value is 0.
|
||||
|
||||
@item val
|
||||
Set the value which will be used if color difference calculation.
|
||||
Set the value which will be used in color difference calculation.
|
||||
Allowed range is from -1 to 1. Default value is 0.
|
||||
|
||||
@item similarity
|
||||
|
@ -13770,15 +13963,15 @@ The filter accepts the following options:
|
|||
|
||||
@table @option
|
||||
@item hue
|
||||
Set the hue value which will be used if color difference calculation.
|
||||
Set the hue value which will be used in color difference calculation.
|
||||
Allowed range is from -360 to 360. Default value is 0.
|
||||
|
||||
@item sat
|
||||
Set the saturation value which will be used if color difference calculation.
|
||||
Set the saturation value which will be used in color difference calculation.
|
||||
Allowed range is from -1 to 1. Default value is 0.
|
||||
|
||||
@item val
|
||||
Set the value which will be used if color difference calculation.
|
||||
Set the value which will be used in color difference calculation.
|
||||
Allowed range is from -1 to 1. Default value is 0.
|
||||
|
||||
@item similarity
|
||||
|
@ -13905,6 +14098,62 @@ If the specified expression is not valid, it is kept at its current
|
|||
value.
|
||||
@end table
|
||||
|
||||
@section huesaturation
|
||||
Apply hue-saturation-intensity adjustments to input video stream.
|
||||
|
||||
This filter operates in RGB colorspace.
|
||||
|
||||
This filter accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item hue
|
||||
Set the hue shift in degrees to apply. Default is 0.
|
||||
Allowed range is from -180 to 180.
|
||||
|
||||
@item saturation
|
||||
Set the saturation shift. Default is 0.
|
||||
Allowed range is from -1 to 1.
|
||||
|
||||
@item intensity
|
||||
Set the intensity shift. Default is 0.
|
||||
Allowed range is from -1 to 1.
|
||||
|
||||
@item colors
|
||||
Set which primary and complementary colors are going to be adjusted.
|
||||
This options is set by providing one or multiple values.
|
||||
This can select multiple colors at once. By default all colors are selected.
|
||||
@table @samp
|
||||
@item r
|
||||
Adjust reds.
|
||||
@item y
|
||||
Adjust yellows.
|
||||
@item g
|
||||
Adjust greens.
|
||||
@item c
|
||||
Adjust cyans.
|
||||
@item b
|
||||
Adjust blues.
|
||||
@item m
|
||||
Adjust magentas.
|
||||
@item a
|
||||
Adjust all colors.
|
||||
@end table
|
||||
|
||||
@item strength
|
||||
Set strength of filtering. Allowed range is from 0 to 100.
|
||||
Default value is 1.
|
||||
|
||||
@item rw, gw, bw
|
||||
Set weight for each RGB component. Allowed range is from 0 to 1.
|
||||
By default is set to 0.333, 0.334, 0.333.
|
||||
Those options are used in saturation and lightess processing.
|
||||
|
||||
@item lightness
|
||||
Set preserving lightness, by default is disabled.
|
||||
Adjusting hues can change lightness from original RGB triplet,
|
||||
with this option enabled lightness is kept at same value.
|
||||
@end table
|
||||
|
||||
@section hysteresis
|
||||
|
||||
Grow first stream into second stream by connecting components.
|
||||
|
@ -15551,6 +15800,19 @@ Negate (invert) the input video.
|
|||
It accepts the following option:
|
||||
|
||||
@table @option
|
||||
@item components
|
||||
Set components to negate.
|
||||
|
||||
Available values for components are:
|
||||
@table @samp
|
||||
@item y
|
||||
@item u
|
||||
@item v
|
||||
@item a
|
||||
@item r
|
||||
@item g
|
||||
@item b
|
||||
@end table
|
||||
|
||||
@item negate_alpha
|
||||
With value 1, it negates the alpha component, if present. Default value is 0.
|
||||
|
@ -18422,6 +18684,7 @@ scale_cuda=passthrough=0
|
|||
@end example
|
||||
@end itemize
|
||||
|
||||
@anchor{scale_npp}
|
||||
@section scale_npp
|
||||
|
||||
Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
|
||||
|
@ -18498,6 +18761,61 @@ This option can be handy if you need to have a video fit within or exceed
|
|||
a defined resolution using @option{force_original_aspect_ratio} but also have
|
||||
encoder restrictions on width or height divisibility.
|
||||
|
||||
@item eval
|
||||
Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
|
||||
|
||||
@table @samp
|
||||
@item init
|
||||
Only evaluate expressions once during the filter initialization or when a command is processed.
|
||||
|
||||
@item frame
|
||||
Evaluate expressions for each incoming frame.
|
||||
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
The values of the @option{w} and @option{h} options are expressions
|
||||
containing the following constants:
|
||||
|
||||
@table @var
|
||||
@item in_w
|
||||
@item in_h
|
||||
The input width and height
|
||||
|
||||
@item iw
|
||||
@item ih
|
||||
These are the same as @var{in_w} and @var{in_h}.
|
||||
|
||||
@item out_w
|
||||
@item out_h
|
||||
The output (scaled) width and height
|
||||
|
||||
@item ow
|
||||
@item oh
|
||||
These are the same as @var{out_w} and @var{out_h}
|
||||
|
||||
@item a
|
||||
The same as @var{iw} / @var{ih}
|
||||
|
||||
@item sar
|
||||
input sample aspect ratio
|
||||
|
||||
@item dar
|
||||
The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
|
||||
|
||||
@item n
|
||||
The (sequential) number of the input frame, starting from 0.
|
||||
Only available with @code{eval=frame}.
|
||||
|
||||
@item t
|
||||
The presentation timestamp of the input frame, expressed as a number of
|
||||
seconds. Only available with @code{eval=frame}.
|
||||
|
||||
@item pos
|
||||
The position (byte offset) of the frame in the input stream, or NaN if
|
||||
this information is unavailable and/or meaningless (for example in case of synthetic video).
|
||||
Only available with @code{eval=frame}.
|
||||
@end table
|
||||
|
||||
@section scale2ref
|
||||
|
@ -18573,6 +18891,61 @@ If the specified expression is not valid, it is kept at its current
|
|||
value.
|
||||
@end table
|
||||
|
||||
@section scale2ref_npp
|
||||
|
||||
Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
|
||||
video, based on a reference video.
|
||||
|
||||
See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
|
||||
but uses the reference video instead of the main input as basis. scale2ref_npp
|
||||
also supports the following additional constants for the @option{w} and
|
||||
@option{h} options:
|
||||
|
||||
@table @var
|
||||
@item main_w
|
||||
@item main_h
|
||||
The main input video's width and height
|
||||
|
||||
@item main_a
|
||||
The same as @var{main_w} / @var{main_h}
|
||||
|
||||
@item main_sar
|
||||
The main input video's sample aspect ratio
|
||||
|
||||
@item main_dar, mdar
|
||||
The main input video's display aspect ratio. Calculated from
|
||||
@code{(main_w / main_h) * main_sar}.
|
||||
|
||||
@item main_n
|
||||
The (sequential) number of the main input frame, starting from 0.
|
||||
Only available with @code{eval=frame}.
|
||||
|
||||
@item main_t
|
||||
The presentation timestamp of the main input frame, expressed as a number of
|
||||
seconds. Only available with @code{eval=frame}.
|
||||
|
||||
@item main_pos
|
||||
The position (byte offset) of the frame in the main input stream, or NaN if
|
||||
this information is unavailable and/or meaningless (for example in case of synthetic video).
|
||||
Only available with @code{eval=frame}.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
@itemize
|
||||
@item
|
||||
Scale a subtitle stream (b) to match the main video (a) in size before overlaying
|
||||
@example
|
||||
'scale2ref_npp[b][a];[a][b]overlay_cuda'
|
||||
@end example
|
||||
|
||||
@item
|
||||
Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
|
||||
@example
|
||||
[logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@section scharr
|
||||
Apply scharr operator to input video stream.
|
||||
|
||||
|
@ -21610,6 +21983,11 @@ Set if input video is transposed. Boolean value, by default disabled.
|
|||
@item out_trans
|
||||
Set if output video needs to be transposed. Boolean value, by default disabled.
|
||||
|
||||
@item h_offset
|
||||
@item v_offset
|
||||
Set output horizontal/vertical off-axis offset. Default is set to 0.
|
||||
Allowed range is from -1 to 1.
|
||||
|
||||
@item alpha_mask
|
||||
Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
|
||||
|
||||
|
@ -21706,20 +22084,25 @@ Default is universal.
|
|||
|
||||
@section varblur
|
||||
Apply variable blur filter by using 2nd video stream to set blur radius.
|
||||
The 2nd stream must have the same dimensions.
|
||||
|
||||
This filter accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item min_r
|
||||
Set min allowed radius. By default is 0. Allowed range is from 0 to 254.
|
||||
Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
|
||||
@item max_r
|
||||
Set max allowed radius. By default is 8. Allowed range is from 1 to 255.
|
||||
Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
|
||||
@item planes
|
||||
Set which planes to process. By default all are used.
|
||||
Set which planes to process. By default, all are used.
|
||||
@end table
|
||||
|
||||
The @code{varblur} filter also supports the @ref{framesync} options.
|
||||
|
||||
@subsection Commands
|
||||
|
||||
This filter supports all the above options as @ref{commands}.
|
||||
|
||||
@section vectorscope
|
||||
|
||||
Display 2 color component values in the two dimensional graph (which is called
|
||||
|
@ -22683,6 +23066,7 @@ Default transition effect is fade.
|
|||
|
||||
@item duration
|
||||
Set cross fade duration in seconds.
|
||||
Range is 0 to 60 seconds.
|
||||
Default duration is 1 second.
|
||||
|
||||
@item offset
|
||||
|
@ -25043,6 +25427,7 @@ ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_c
|
|||
@anchor{allrgb}
|
||||
@anchor{allyuv}
|
||||
@anchor{color}
|
||||
@anchor{colorspectrum}
|
||||
@anchor{haldclutsrc}
|
||||
@anchor{nullsrc}
|
||||
@anchor{pal75bars}
|
||||
|
@ -25053,7 +25438,7 @@ ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_c
|
|||
@anchor{testsrc}
|
||||
@anchor{testsrc2}
|
||||
@anchor{yuvtestsrc}
|
||||
@section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
|
||||
@section allrgb, allyuv, color, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
|
||||
|
||||
The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
|
||||
|
||||
|
@ -25061,6 +25446,8 @@ The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
|
|||
|
||||
The @code{color} source provides an uniformly colored input.
|
||||
|
||||
The @code{colorspectrum} source provides a color spectrum input.
|
||||
|
||||
The @code{haldclutsrc} source provides an identity Hald CLUT. See also
|
||||
@ref{haldclut} filter.
|
||||
|
||||
|
@ -25152,6 +25539,16 @@ Set the number of decimals to show in the timestamp, only available in the
|
|||
The displayed timestamp value will correspond to the original
|
||||
timestamp value multiplied by the power of 10 of the specified
|
||||
value. Default value is 0.
|
||||
|
||||
@item type
|
||||
Set the type of the color spectrum, only available in the
|
||||
@code{colorspectrum} source. Can be one of the following:
|
||||
|
||||
@table @samp
|
||||
@item black
|
||||
@item white
|
||||
@item all
|
||||
@end table
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
@ -28156,6 +28553,18 @@ changed, so it will generate non monotonically increasing timestamps.
|
|||
Specifies the time difference between frames above which the point is
|
||||
considered a timestamp discontinuity which is removed by adjusting the later
|
||||
timestamps.
|
||||
|
||||
@item dec_threads
|
||||
Specifies the number of threads for decoding
|
||||
|
||||
@item format_opts
|
||||
Specify format options for the opened file. Format options can be specified
|
||||
as a list of @var{key}=@var{value} pairs separated by ':'. The following example
|
||||
shows how to add protocol_whitelist and protocol_blacklist options:
|
||||
@example
|
||||
ffplay -f lavfi
|
||||
"movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
|
||||
@end example
|
||||
@end table
|
||||
|
||||
It allows overlaying a second video on top of the main input of
|
||||
|
|
|
@ -625,6 +625,12 @@ Save the currently used video capture filter device and its
|
|||
parameters (if the filter supports it) to a file.
|
||||
If a file with the same name exists it will be overwritten.
|
||||
|
||||
@item use_video_device_timestamps
|
||||
If set to @option{false}, the timestamp for video frames will be
|
||||
derived from the wallclock instead of the timestamp provided by
|
||||
the capture device. This allows working around devices that
|
||||
provide unreliable timestamps.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
|
|
@ -362,12 +362,13 @@ Ignore IO errors during open and write. Useful for long-duration runs with netwo
|
|||
|
||||
@item lhls @var{lhls}
|
||||
Enable Low-latency HLS(LHLS). Adds #EXT-X-PREFETCH tag with current segment's URI.
|
||||
Apple doesn't have an official spec for LHLS. Meanwhile hls.js player folks are
|
||||
trying to standardize a open LHLS spec. The draft spec is available in https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
|
||||
This option will also try to comply with the above open spec, till Apple's spec officially supports it.
|
||||
Applicable only when @var{streaming} and @var{hls_playlist} options are enabled.
|
||||
hls.js player folks are trying to standardize an open LHLS spec. The draft spec is available in https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
|
||||
This option tries to comply with the above open spec.
|
||||
It enables @var{streaming} and @var{hls_playlist} options automatically.
|
||||
This is an experimental feature.
|
||||
|
||||
Note: This is not Apple's version LHLS. See @url{https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis}
|
||||
|
||||
@item ldash @var{ldash}
|
||||
Enable Low-latency Dash by constraining the presence and values of some elements.
|
||||
|
||||
|
@ -798,6 +799,7 @@ were recently referenced in the playlist. Default value is 1, meaning segments o
|
|||
Set output format options using a :-separated list of key=value
|
||||
parameters. Values containing @code{:} special characters must be
|
||||
escaped.
|
||||
@code{hls_ts_options} is deprecated, use hls_segment_options instead of it..
|
||||
|
||||
@item hls_start_number_source
|
||||
Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to the specified source.
|
||||
|
@ -918,6 +920,10 @@ This example will create a directory hierarchy 2016/02/15 (if any of them do not
|
|||
produce the playlist, @file{out.m3u8}, and segment files:
|
||||
@file{2016/02/15/file-20160215-1455569023.ts}, @file{2016/02/15/file-20160215-1455569024.ts}, etc.
|
||||
|
||||
@item hls_segment_options @var{options_list}
|
||||
Set output format options using a :-separated list of key=value
|
||||
parameters. Values containing @code{:} special characters must be
|
||||
escaped.
|
||||
|
||||
@item hls_key_info_file @var{key_info_file}
|
||||
Use the information in @var{key_info_file} for segment encryption. The first
|
||||
|
@ -1561,6 +1567,15 @@ A safe size for most use cases should be about 50kB per hour of video.
|
|||
|
||||
Note that cues are only written if the output is seekable and this option will
|
||||
have no effect if it is not.
|
||||
|
||||
@item cues_to_front
|
||||
If set, the muxer will write the index at the beginning of the file
|
||||
by shifting the main data if necessary. This can be combined with
|
||||
reserve_index_space in which case the data is only shifted if
|
||||
the initially reserved space turns out to be insufficient.
|
||||
|
||||
This option is ignored if the output is unseekable.
|
||||
|
||||
@item default_mode
|
||||
This option controls how the FlagDefault of the output tracks will be set.
|
||||
It influences which tracks players should play by default. The default mode
|
||||
|
|
|
@ -1087,6 +1087,10 @@ set to 1) or to a default remote address (if set to 0).
|
|||
@item localport=@var{n}
|
||||
Set the local RTP port to @var{n}.
|
||||
|
||||
@item localaddr=@var{addr}
|
||||
Local IP address of a network interface used for sending packets or joining
|
||||
multicast groups.
|
||||
|
||||
@item timeout=@var{n}
|
||||
Set timeout (in microseconds) of socket I/O operations to @var{n}.
|
||||
|
||||
|
|
20
doc/t2h.pm
20
doc/t2h.pm
|
@ -126,8 +126,16 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
|
|||
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
|
||||
}
|
||||
|
||||
# determine if texinfo is at least version 6.8
|
||||
my $program_version_num = version->declare(get_conf('PACKAGE_VERSION'))->numify;
|
||||
my $program_version_6_8 = $program_version_num >= 6.008000;
|
||||
|
||||
# print the TOC where @contents is used
|
||||
if ($program_version_6_8) {
|
||||
set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
|
||||
} else {
|
||||
set_from_init_file('INLINE_CONTENTS', 1);
|
||||
}
|
||||
|
||||
# make chapters <h2>
|
||||
set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
|
||||
|
@ -184,7 +192,11 @@ EOT
|
|||
|
||||
return $head1 . $head_title . $head2 . $head_title . $head3;
|
||||
}
|
||||
if ($program_version_6_8) {
|
||||
texinfo_register_formatting_function('format_begin_file', \&ffmpeg_begin_file);
|
||||
} else {
|
||||
texinfo_register_formatting_function('begin_file', \&ffmpeg_begin_file);
|
||||
}
|
||||
|
||||
sub ffmpeg_program_string($)
|
||||
{
|
||||
|
@ -201,7 +213,11 @@ sub ffmpeg_program_string($)
|
|||
$self->gdt('This document was generated automatically.'));
|
||||
}
|
||||
}
|
||||
if ($program_version_6_8) {
|
||||
texinfo_register_formatting_function('format_program_string', \&ffmpeg_program_string);
|
||||
} else {
|
||||
texinfo_register_formatting_function('program_string', \&ffmpeg_program_string);
|
||||
}
|
||||
|
||||
# Customized file ending
|
||||
sub ffmpeg_end_file($)
|
||||
|
@ -220,7 +236,11 @@ EOT
|
|||
EOT
|
||||
return $program_text . $footer;
|
||||
}
|
||||
if ($program_version_6_8) {
|
||||
texinfo_register_formatting_function('format_end_file', \&ffmpeg_end_file);
|
||||
} else {
|
||||
texinfo_register_formatting_function('end_file', \&ffmpeg_end_file);
|
||||
}
|
||||
|
||||
# Dummy title command
|
||||
# Ignore title. Title is handled through ffmpeg_begin_file().
|
||||
|
|
|
@ -9,6 +9,8 @@ OBJS-$(HAVE_MIPSDSP) += $(MIPSDSP-OBJS) $(MIPSDSP-OBJS-yes)
|
|||
OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS) $(MIPSDSPR2-OBJS-yes)
|
||||
OBJS-$(HAVE_MSA) += $(MSA-OBJS) $(MSA-OBJS-yes)
|
||||
OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes)
|
||||
OBJS-$(HAVE_LSX) += $(LSX-OBJS) $(LSX-OBJS-yes)
|
||||
OBJS-$(HAVE_LASX) += $(LASX-OBJS) $(LASX-OBJS-yes)
|
||||
|
||||
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
|
||||
OBJS-$(HAVE_VSX) += $(VSX-OBJS) $(VSX-OBJS-yes)
|
||||
|
|
|
@ -59,6 +59,8 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
|
|||
COMPILE_NVCC = $(call COMPILE,NVCC)
|
||||
COMPILE_MMI = $(call COMPILE,CC,MMIFLAGS)
|
||||
COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
|
||||
COMPILE_LSX = $(call COMPILE,CC,LSXFLAGS)
|
||||
COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
|
||||
|
||||
%_mmi.o: %_mmi.c
|
||||
$(COMPILE_MMI)
|
||||
|
@ -66,6 +68,12 @@ COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
|
|||
%_msa.o: %_msa.c
|
||||
$(COMPILE_MSA)
|
||||
|
||||
%_lsx.o: %_lsx.c
|
||||
$(COMPILE_LSX)
|
||||
|
||||
%_lasx.o: %_lasx.c
|
||||
$(COMPILE_LASX)
|
||||
|
||||
%.o: %.c
|
||||
$(COMPILE_C)
|
||||
|
||||
|
@ -104,6 +112,15 @@ COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
|
|||
$(BIN2CEXE): ffbuild/bin2c_host.o
|
||||
$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS)
|
||||
|
||||
%.metal.air: %.metal
|
||||
$(METALCC) $< -o $@
|
||||
|
||||
%.metallib: %.metal.air
|
||||
$(METALLIB) --split-module-without-linking $< -o $@
|
||||
|
||||
%.metallib.c: %.metallib $(BIN2CEXE)
|
||||
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
|
||||
|
||||
%.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h
|
||||
$(COMPILE_NVCC)
|
||||
|
||||
|
@ -140,6 +157,8 @@ include $(SRC_PATH)/ffbuild/arch.mak
|
|||
|
||||
OBJS += $(OBJS-yes)
|
||||
SLIBOBJS += $(SLIBOBJS-yes)
|
||||
SHLIBOBJS += $(SHLIBOBJS-yes)
|
||||
STLIBOBJS += $(STLIBOBJS-yes)
|
||||
FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS)
|
||||
TESTPROGS += $(TESTPROGS-yes)
|
||||
|
||||
|
@ -148,6 +167,8 @@ FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(foreach lib,EXTRALIBS-$(NAME) $(FFLIBS:%=
|
|||
|
||||
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
|
||||
SLIBOBJS := $(sort $(SLIBOBJS:%=$(SUBDIR)%))
|
||||
SHLIBOBJS := $(sort $(SHLIBOBJS:%=$(SUBDIR)%))
|
||||
STLIBOBJS := $(sort $(STLIBOBJS:%=$(SUBDIR)%))
|
||||
TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o)
|
||||
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)tests/%$(EXESUF))
|
||||
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
|
||||
|
@ -183,10 +204,12 @@ $(OBJS): | $(sort $(dir $(OBJS)))
|
|||
$(HOBJS): | $(sort $(dir $(HOBJS)))
|
||||
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
|
||||
$(SLIBOBJS): | $(sort $(dir $(SLIBOBJS)))
|
||||
$(SHLIBOBJS): | $(sort $(dir $(SHLIBOBJS)))
|
||||
$(STLIBOBJS): | $(sort $(dir $(STLIBOBJS)))
|
||||
$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
|
||||
$(TOOLOBJS): | tools
|
||||
|
||||
OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS))
|
||||
OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(SHLIBOBJS) $(STLIBOBJS) $(TESTOBJS))
|
||||
|
||||
CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.pc *.ptx *.ptx.gz *.ptx.c *.ver *.version *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb
|
||||
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
||||
|
@ -198,4 +221,4 @@ endef
|
|||
|
||||
$(eval $(RULES))
|
||||
|
||||
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d)
|
||||
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SHLIBOBJS:.o=.d) $(STLIBOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d)
|
||||
|
|
|
@ -14,10 +14,26 @@ INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
|
|||
all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) $(SUBDIR)lib$(FULLNAME).pc
|
||||
all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
|
||||
|
||||
LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
|
||||
LIBOBJS := $(OBJS) $(SHLIBOBJS) $(STLIBOBJS) $(SUBDIR)%.h.o $(TESTOBJS)
|
||||
$(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
|
||||
|
||||
$(SUBDIR)$(LIBNAME): $(OBJS)
|
||||
ifdef CONFIG_SHARED
|
||||
# In case both shared libs and static libs are enabled, it can happen
|
||||
# that a user might want to link e.g. libavformat statically, but
|
||||
# libavcodec and the other libs dynamically. In this case
|
||||
# libavformat won't be able to access libavcodec's internal symbols,
|
||||
# so that they have to be duplicated into the archive just like
|
||||
# for purely shared builds.
|
||||
# Test programs are always statically linked against their library
|
||||
# to be able to access their library's internals, even with shared builds.
|
||||
# Yet linking against dependend libraries still uses dynamic linking.
|
||||
# This means that we are in the scenario described above.
|
||||
# In case only static libs are used, the linker will only use
|
||||
# one of these copies; this depends on the duplicated object files
|
||||
# containing exactly the same symbols.
|
||||
OBJS += $(SHLIBOBJS)
|
||||
endif
|
||||
$(SUBDIR)$(LIBNAME): $(OBJS) $(STLIBOBJS)
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $(AR_O) $^
|
||||
$(RANLIB) $@
|
||||
|
@ -48,7 +64,7 @@ $(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
|
|||
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
|
||||
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
|
||||
|
||||
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
|
||||
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
|
||||
$(SLIB_CREATE_DEF_CMD)
|
||||
$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
|
||||
$(SLIB_EXTRA_CMD)
|
||||
|
|
|
@ -10,10 +10,6 @@ ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
|
|||
ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
|
||||
|
||||
OBJS-ffmpeg += fftools/ffmpeg_opt.o fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o
|
||||
ifndef CONFIG_VIDEOTOOLBOX
|
||||
OBJS-ffmpeg-$(CONFIG_VDA) += fftools/ffmpeg_videotoolbox.o
|
||||
endif
|
||||
OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += fftools/ffmpeg_videotoolbox.o
|
||||
|
||||
define DOFFTOOL
|
||||
OBJS-$(1) += fftools/cmdutils.o fftools/$(1).o $(OBJS-$(1)-yes)
|
||||
|
|
|
@ -1770,7 +1770,7 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
|
|||
"..H.. = Hardware accelerated format\n"
|
||||
"...P. = Paletted format\n"
|
||||
"....B = Bitstream format\n"
|
||||
"FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL\n"
|
||||
"FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS\n"
|
||||
"-----\n");
|
||||
|
||||
#if !CONFIG_SWSCALE
|
||||
|
@ -1780,7 +1780,7 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
|
|||
|
||||
while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
|
||||
enum AVPixelFormat av_unused pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
|
||||
printf("%c%c%c%c%c %-16s %d %2d\n",
|
||||
printf("%c%c%c%c%c %-16s %d %3d %d",
|
||||
sws_isSupportedInput (pix_fmt) ? 'I' : '.',
|
||||
sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
|
||||
pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL ? 'H' : '.',
|
||||
|
@ -1788,7 +1788,12 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
|
|||
pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
|
||||
pix_desc->name,
|
||||
pix_desc->nb_components,
|
||||
av_get_bits_per_pixel(pix_desc));
|
||||
av_get_bits_per_pixel(pix_desc),
|
||||
pix_desc->comp[0].depth);
|
||||
|
||||
for (unsigned i = 1; i < pix_desc->nb_components; i++)
|
||||
printf("-%d", pix_desc->comp[i].depth);
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1831,6 +1836,16 @@ int show_sample_fmts(void *optctx, const char *opt, const char *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int show_dispositions(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
for (int i = 0; i < 32; i++) {
|
||||
const char *str = av_disposition_to_string(1U << i);
|
||||
if (str)
|
||||
printf("%s\n", str);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void show_help_codec(const char *name, int encoder)
|
||||
{
|
||||
const AVCodecDescriptor *desc;
|
||||
|
@ -2122,7 +2137,7 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
|
|||
AVFormatContext *s, AVStream *st, const AVCodec *codec)
|
||||
{
|
||||
AVDictionary *ret = NULL;
|
||||
AVDictionaryEntry *t = NULL;
|
||||
const AVDictionaryEntry *t = NULL;
|
||||
int flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM
|
||||
: AV_OPT_FLAG_DECODING_PARAM;
|
||||
char prefix = 0;
|
||||
|
@ -2188,7 +2203,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
|
|||
if (!opts) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Could not alloc memory for stream options.\n");
|
||||
return NULL;
|
||||
exit_program(1);
|
||||
}
|
||||
for (i = 0; i < s->nb_streams; i++)
|
||||
opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codecpar->codec_id,
|
||||
|
@ -2215,6 +2230,18 @@ void *grow_array(void *array, int elem_size, int *size, int new_size)
|
|||
return array;
|
||||
}
|
||||
|
||||
void *allocate_array_elem(void *ptr, size_t elem_size, int *nb_elems)
|
||||
{
|
||||
void *new_elem;
|
||||
|
||||
if (!(new_elem = av_mallocz(elem_size)) ||
|
||||
av_dynarray_add_nofree(ptr, nb_elems, new_elem) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
return new_elem;
|
||||
}
|
||||
|
||||
double get_rotation(int32_t *displaymatrix)
|
||||
{
|
||||
double theta = 0;
|
||||
|
@ -2233,9 +2260,29 @@ double get_rotation(int32_t *displaymatrix)
|
|||
}
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
static void print_device_list(const AVDeviceInfoList *device_list)
|
||||
{
|
||||
// print devices
|
||||
for (int i = 0; i < device_list->nb_devices; i++) {
|
||||
const AVDeviceInfo *device = device_list->devices[i];
|
||||
printf("%c %s [%s] (", device_list->default_device == i ? '*' : ' ',
|
||||
device->device_name, device->device_description);
|
||||
if (device->nb_media_types > 0) {
|
||||
for (int j = 0; j < device->nb_media_types; ++j) {
|
||||
const char* media_type = av_get_media_type_string(device->media_types[j]);
|
||||
if (j > 0)
|
||||
printf(", ");
|
||||
printf("%s", media_type ? media_type : "unknown");
|
||||
}
|
||||
} else {
|
||||
printf("none");
|
||||
}
|
||||
printf(")\n");
|
||||
}
|
||||
}
|
||||
static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts)
|
||||
{
|
||||
int ret, i;
|
||||
int ret;
|
||||
AVDeviceInfoList *device_list = NULL;
|
||||
|
||||
if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category))
|
||||
|
@ -2247,10 +2294,7 @@ static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < device_list->nb_devices; i++) {
|
||||
printf("%c %s [%s]\n", device_list->default_device == i ? '*' : ' ',
|
||||
device_list->devices[i]->device_name, device_list->devices[i]->device_description);
|
||||
}
|
||||
print_device_list(device_list);
|
||||
|
||||
fail:
|
||||
avdevice_free_list_devices(&device_list);
|
||||
|
@ -2259,7 +2303,7 @@ static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts)
|
|||
|
||||
static int print_device_sinks(const AVOutputFormat *fmt, AVDictionary *opts)
|
||||
{
|
||||
int ret, i;
|
||||
int ret;
|
||||
AVDeviceInfoList *device_list = NULL;
|
||||
|
||||
if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category))
|
||||
|
@ -2271,10 +2315,7 @@ static int print_device_sinks(const AVOutputFormat *fmt, AVDictionary *opts)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < device_list->nb_devices; i++) {
|
||||
printf("%c %s [%s]\n", device_list->default_device == i ? '*' : ' ',
|
||||
device_list->devices[i]->device_name, device_list->devices[i]->device_description);
|
||||
}
|
||||
print_device_list(device_list);
|
||||
|
||||
fail:
|
||||
avdevice_free_list_devices(&device_list);
|
||||
|
|
|
@ -241,6 +241,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
|
|||
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
|
||||
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
|
||||
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
|
||||
{ "dispositions", OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
|
||||
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
|
||||
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
||||
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
||||
|
@ -432,8 +433,8 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
|
|||
* 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, NULL if it
|
||||
* cannot be created
|
||||
* @return pointer to the created array of dictionaries.
|
||||
* Calls exit() on failure.
|
||||
*/
|
||||
AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
|
||||
AVDictionary *codec_opts);
|
||||
|
@ -580,6 +581,11 @@ int show_layouts(void *optctx, const char *opt, const char *arg);
|
|||
*/
|
||||
int show_sample_fmts(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all supported stream dispositions.
|
||||
*/
|
||||
int show_dispositions(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the color names and values recognized
|
||||
* by the program.
|
||||
|
@ -625,11 +631,28 @@ FILE *get_preset_file(char *filename, size_t filename_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
|
||||
*/
|
||||
void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
|
||||
|
||||
#define media_type_string av_get_media_type_string
|
||||
|
||||
#define GROW_ARRAY(array, nb_elems)\
|
||||
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);
|
||||
|
||||
|
|
307
fftools/ffmpeg.c
307
fftools/ffmpeg.c
|
@ -557,9 +557,6 @@ static void ffmpeg_cleanup(int ret)
|
|||
|
||||
avfilter_inout_free(&ofilter->out_tmp);
|
||||
av_freep(&ofilter->name);
|
||||
av_freep(&ofilter->formats);
|
||||
av_freep(&ofilter->channel_layouts);
|
||||
av_freep(&ofilter->sample_rates);
|
||||
av_freep(&fg->outputs[j]);
|
||||
}
|
||||
av_freep(&fg->outputs);
|
||||
|
@ -635,7 +632,6 @@ static void ffmpeg_cleanup(int ret)
|
|||
InputStream *ist = input_streams[i];
|
||||
|
||||
av_frame_free(&ist->decoded_frame);
|
||||
av_frame_free(&ist->filter_frame);
|
||||
av_packet_free(&ist->pkt);
|
||||
av_dict_free(&ist->decoder_opts);
|
||||
avsubtitle_free(&ist->prev_sub.subtitle);
|
||||
|
@ -679,7 +675,7 @@ static void ffmpeg_cleanup(int ret)
|
|||
|
||||
void remove_avoptions(AVDictionary **a, AVDictionary *b)
|
||||
{
|
||||
AVDictionaryEntry *t = NULL;
|
||||
const AVDictionaryEntry *t = NULL;
|
||||
|
||||
while ((t = av_dict_get(b, "", t, AV_DICT_IGNORE_SUFFIX))) {
|
||||
av_dict_set(a, t->key, NULL, AV_DICT_MATCH_CASE);
|
||||
|
@ -688,7 +684,7 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b)
|
|||
|
||||
void assert_avoptions(AVDictionary *m)
|
||||
{
|
||||
AVDictionaryEntry *t;
|
||||
const AVDictionaryEntry *t;
|
||||
if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key);
|
||||
exit_program(1);
|
||||
|
@ -756,14 +752,13 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
|
|||
AVPacket *tmp_pkt;
|
||||
/* the muxer is not initialized yet, buffer the packet */
|
||||
if (!av_fifo_space(ost->muxing_queue)) {
|
||||
size_t cur_size = av_fifo_size(ost->muxing_queue);
|
||||
unsigned int are_we_over_size =
|
||||
(ost->muxing_queue_data_size + pkt->size) > ost->muxing_queue_data_threshold;
|
||||
int new_size = are_we_over_size ?
|
||||
FFMIN(2 * av_fifo_size(ost->muxing_queue),
|
||||
ost->max_muxing_queue_size) :
|
||||
2 * av_fifo_size(ost->muxing_queue);
|
||||
size_t limit = are_we_over_size ? ost->max_muxing_queue_size : INT_MAX;
|
||||
size_t new_size = FFMIN(2 * cur_size, limit);
|
||||
|
||||
if (new_size <= av_fifo_size(ost->muxing_queue)) {
|
||||
if (new_size <= cur_size) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Too many packets buffered for output stream %d:%d.\n",
|
||||
ost->file_index, ost->st->index);
|
||||
|
@ -878,10 +873,11 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
|
|||
static void close_output_stream(OutputStream *ost)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
AVRational time_base = ost->stream_copy ? ost->mux_timebase : ost->enc_ctx->time_base;
|
||||
|
||||
ost->finished |= ENCODER_FINISHED;
|
||||
if (of->shortest) {
|
||||
int64_t end = av_rescale_q(ost->sync_opts - ost->first_pts, ost->enc_ctx->time_base, AV_TIME_BASE_Q);
|
||||
int64_t end = av_rescale_q(ost->sync_opts - ost->first_pts, time_base, AV_TIME_BASE_Q);
|
||||
of->recording_time = FFMIN(of->recording_time, end);
|
||||
}
|
||||
}
|
||||
|
@ -1151,11 +1147,12 @@ static void do_subtitle_out(OutputFile *of,
|
|||
}
|
||||
}
|
||||
|
||||
/* May modify/reset next_picture */
|
||||
static void do_video_out(OutputFile *of,
|
||||
OutputStream *ost,
|
||||
AVFrame *next_picture)
|
||||
{
|
||||
int ret, format_video_sync;
|
||||
int ret;
|
||||
AVPacket *pkt = ost->pkt;
|
||||
AVCodecContext *enc = ost->enc_ctx;
|
||||
AVRational frame_rate;
|
||||
|
@ -1202,28 +1199,10 @@ static void do_video_out(OutputFile *of,
|
|||
nb0_frames = 0; // tracks the number of times the PREVIOUS frame should be duplicated, mostly for variable framerate (VFR)
|
||||
nb_frames = 1;
|
||||
|
||||
format_video_sync = video_sync_method;
|
||||
if (format_video_sync == VSYNC_AUTO) {
|
||||
if(!strcmp(of->ctx->oformat->name, "avi")) {
|
||||
format_video_sync = VSYNC_VFR;
|
||||
} else
|
||||
format_video_sync = (of->ctx->oformat->flags & AVFMT_VARIABLE_FPS) ? ((of->ctx->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : VSYNC_CFR;
|
||||
if ( ist
|
||||
&& format_video_sync == VSYNC_CFR
|
||||
&& input_files[ist->file_index]->ctx->nb_streams == 1
|
||||
&& input_files[ist->file_index]->input_ts_offset == 0) {
|
||||
format_video_sync = VSYNC_VSCFR;
|
||||
}
|
||||
if (format_video_sync == VSYNC_CFR && copy_ts) {
|
||||
format_video_sync = VSYNC_VSCFR;
|
||||
}
|
||||
}
|
||||
ost->is_cfr = (format_video_sync == VSYNC_CFR || format_video_sync == VSYNC_VSCFR);
|
||||
|
||||
if (delta0 < 0 &&
|
||||
delta > 0 &&
|
||||
format_video_sync != VSYNC_PASSTHROUGH &&
|
||||
format_video_sync != VSYNC_DROP) {
|
||||
ost->vsync_method != VSYNC_PASSTHROUGH &&
|
||||
ost->vsync_method != VSYNC_DROP) {
|
||||
if (delta0 < -0.6) {
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0);
|
||||
} else
|
||||
|
@ -1233,7 +1212,7 @@ static void do_video_out(OutputFile *of,
|
|||
delta0 = 0;
|
||||
}
|
||||
|
||||
switch (format_video_sync) {
|
||||
switch (ost->vsync_method) {
|
||||
case VSYNC_VSCFR:
|
||||
if (ost->frame_number == 0 && delta0 >= 0.5) {
|
||||
av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0));
|
||||
|
@ -1304,7 +1283,7 @@ static void do_video_out(OutputFile *of,
|
|||
int forced_keyframe = 0;
|
||||
double pts_time;
|
||||
|
||||
if (i < nb0_frames && ost->last_frame) {
|
||||
if (i < nb0_frames && ost->last_frame->buf[0]) {
|
||||
in_picture = ost->last_frame;
|
||||
} else
|
||||
in_picture = next_picture;
|
||||
|
@ -1432,13 +1411,9 @@ static void do_video_out(OutputFile *of,
|
|||
do_video_stats(ost, frame_size);
|
||||
}
|
||||
|
||||
if (!ost->last_frame)
|
||||
ost->last_frame = av_frame_alloc();
|
||||
av_frame_unref(ost->last_frame);
|
||||
if (next_picture && ost->last_frame)
|
||||
av_frame_ref(ost->last_frame, next_picture);
|
||||
else
|
||||
av_frame_free(&ost->last_frame);
|
||||
if (next_picture)
|
||||
av_frame_move_ref(ost->last_frame, next_picture);
|
||||
|
||||
return;
|
||||
error:
|
||||
|
@ -1497,13 +1472,13 @@ static void do_video_stats(OutputStream *ost, int frame_size)
|
|||
static void finish_output_stream(OutputStream *ost)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
int i;
|
||||
AVRational time_base = ost->stream_copy ? ost->mux_timebase : ost->enc_ctx->time_base;
|
||||
|
||||
ost->finished = ENCODER_FINISHED | MUXER_FINISHED;
|
||||
|
||||
if (of->shortest) {
|
||||
for (i = 0; i < of->ctx->nb_streams; i++)
|
||||
output_streams[of->ost_index + i]->finished = ENCODER_FINISHED | MUXER_FINISHED;
|
||||
int64_t end = av_rescale_q(ost->sync_opts - ost->first_pts, time_base, AV_TIME_BASE_Q);
|
||||
of->recording_time = FFMIN(of->recording_time, end);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1542,9 +1517,6 @@ static int reap_filters(int flush)
|
|||
if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_AUDIO)
|
||||
init_output_stream_wrapper(ost, NULL, 1);
|
||||
|
||||
if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
filtered_frame = ost->filtered_frame;
|
||||
|
||||
while (1) {
|
||||
|
@ -2168,10 +2140,6 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
|||
}
|
||||
}
|
||||
|
||||
/* force the input stream PTS */
|
||||
if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
ost->sync_opts++;
|
||||
|
||||
if (av_packet_ref(opkt, pkt) < 0)
|
||||
exit_program(1);
|
||||
|
||||
|
@ -2195,6 +2163,8 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
|||
|
||||
opkt->duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->mux_timebase);
|
||||
|
||||
ost->sync_opts += opkt->duration;
|
||||
|
||||
output_packet(of, opkt, ost, 0);
|
||||
}
|
||||
|
||||
|
@ -2248,11 +2218,15 @@ static int ifilter_has_all_input_formats(FilterGraph *fg)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
||||
static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference)
|
||||
{
|
||||
FilterGraph *fg = ifilter->graph;
|
||||
AVFrameSideData *sd;
|
||||
int need_reinit, ret, i;
|
||||
int need_reinit, ret;
|
||||
int buffersrc_flags = AV_BUFFERSRC_FLAG_PUSH;
|
||||
|
||||
if (keep_reference)
|
||||
buffersrc_flags |= AV_BUFFERSRC_FLAG_KEEP_REF;
|
||||
|
||||
/* determine if the parameters for this input changed */
|
||||
need_reinit = ifilter->format != frame->format;
|
||||
|
@ -2290,12 +2264,10 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
|||
|
||||
/* (re)init the graph if possible, otherwise buffer the frame and return */
|
||||
if (need_reinit || !fg->graph) {
|
||||
for (i = 0; i < fg->nb_inputs; i++) {
|
||||
if (!ifilter_has_all_input_formats(fg)) {
|
||||
AVFrame *tmp = av_frame_clone(frame);
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
av_frame_unref(frame);
|
||||
|
||||
if (!av_fifo_space(ifilter->frame_queue)) {
|
||||
ret = av_fifo_realloc2(ifilter->frame_queue, 2 * av_fifo_size(ifilter->frame_queue));
|
||||
|
@ -2307,7 +2279,6 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
|||
av_fifo_generic_write(ifilter->frame_queue, &tmp, sizeof(tmp), NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ret = reap_filters(1);
|
||||
if (ret < 0 && ret != AVERROR_EOF) {
|
||||
|
@ -2322,7 +2293,7 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
|||
}
|
||||
}
|
||||
|
||||
ret = av_buffersrc_add_frame_flags(ifilter->filter, frame, AV_BUFFERSRC_FLAG_PUSH);
|
||||
ret = av_buffersrc_add_frame_flags(ifilter->filter, frame, buffersrc_flags);
|
||||
if (ret < 0) {
|
||||
if (ret != AVERROR_EOF)
|
||||
av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
|
||||
|
@ -2385,18 +2356,10 @@ static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacke
|
|||
static int send_frame_to_filters(InputStream *ist, AVFrame *decoded_frame)
|
||||
{
|
||||
int i, ret;
|
||||
AVFrame *f;
|
||||
|
||||
av_assert1(ist->nb_filters > 0); /* ensure ret is initialized */
|
||||
for (i = 0; i < ist->nb_filters; i++) {
|
||||
if (i < ist->nb_filters - 1) {
|
||||
f = ist->filter_frame;
|
||||
ret = av_frame_ref(f, decoded_frame);
|
||||
if (ret < 0)
|
||||
break;
|
||||
} else
|
||||
f = decoded_frame;
|
||||
ret = ifilter_send_frame(ist->filters[i], f);
|
||||
ret = ifilter_send_frame(ist->filters[i], decoded_frame, i < ist->nb_filters - 1);
|
||||
if (ret == AVERROR_EOF)
|
||||
ret = 0; /* ignore */
|
||||
if (ret < 0) {
|
||||
|
@ -2411,17 +2374,11 @@ static int send_frame_to_filters(InputStream *ist, AVFrame *decoded_frame)
|
|||
static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output,
|
||||
int *decode_failed)
|
||||
{
|
||||
AVFrame *decoded_frame;
|
||||
AVFrame *decoded_frame = ist->decoded_frame;
|
||||
AVCodecContext *avctx = ist->dec_ctx;
|
||||
int ret, err = 0;
|
||||
AVRational decoded_frame_tb;
|
||||
|
||||
if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))
|
||||
return AVERROR(ENOMEM);
|
||||
if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))
|
||||
return AVERROR(ENOMEM);
|
||||
decoded_frame = ist->decoded_frame;
|
||||
|
||||
update_benchmark(NULL);
|
||||
ret = decode(avctx, decoded_frame, got_output, pkt);
|
||||
update_benchmark("decode_audio %d.%d", ist->file_index, ist->st->index);
|
||||
|
@ -2458,6 +2415,11 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output,
|
|||
decoded_frame->pts = ist->dts;
|
||||
decoded_frame_tb = AV_TIME_BASE_Q;
|
||||
}
|
||||
if (pkt && pkt->duration && ist->prev_pkt_pts != AV_NOPTS_VALUE &&
|
||||
pkt->pts != AV_NOPTS_VALUE && pkt->pts - ist->prev_pkt_pts > pkt->duration)
|
||||
ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE;
|
||||
if (pkt)
|
||||
ist->prev_pkt_pts = pkt->pts;
|
||||
if (decoded_frame->pts != AV_NOPTS_VALUE)
|
||||
decoded_frame->pts = av_rescale_delta(decoded_frame_tb, decoded_frame->pts,
|
||||
(AVRational){1, avctx->sample_rate}, decoded_frame->nb_samples, &ist->filter_in_rescale_delta_last,
|
||||
|
@ -2465,7 +2427,6 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output,
|
|||
ist->nb_samples = decoded_frame->nb_samples;
|
||||
err = send_frame_to_filters(ist, decoded_frame);
|
||||
|
||||
av_frame_unref(ist->filter_frame);
|
||||
av_frame_unref(decoded_frame);
|
||||
return err < 0 ? err : ret;
|
||||
}
|
||||
|
@ -2473,7 +2434,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output,
|
|||
static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *duration_pts, int eof,
|
||||
int *decode_failed)
|
||||
{
|
||||
AVFrame *decoded_frame;
|
||||
AVFrame *decoded_frame = ist->decoded_frame;
|
||||
int i, ret = 0, err = 0;
|
||||
int64_t best_effort_timestamp;
|
||||
int64_t dts = AV_NOPTS_VALUE;
|
||||
|
@ -2484,11 +2445,6 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_
|
|||
if (!eof && pkt && pkt->size == 0)
|
||||
return 0;
|
||||
|
||||
if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))
|
||||
return AVERROR(ENOMEM);
|
||||
if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))
|
||||
return AVERROR(ENOMEM);
|
||||
decoded_frame = ist->decoded_frame;
|
||||
if (ist->dts != AV_NOPTS_VALUE)
|
||||
dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ist->st->time_base);
|
||||
if (pkt) {
|
||||
|
@ -2596,7 +2552,6 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_
|
|||
err = send_frame_to_filters(ist, decoded_frame);
|
||||
|
||||
fail:
|
||||
av_frame_unref(ist->filter_frame);
|
||||
av_frame_unref(decoded_frame);
|
||||
return err < 0 ? err : ret;
|
||||
}
|
||||
|
@ -2880,17 +2835,17 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
|||
return !eof_reached;
|
||||
}
|
||||
|
||||
static void print_sdp(void)
|
||||
static int print_sdp(void)
|
||||
{
|
||||
char sdp[16384];
|
||||
int i;
|
||||
int j;
|
||||
int j, ret;
|
||||
AVIOContext *sdp_pb;
|
||||
AVFormatContext **avc;
|
||||
|
||||
for (i = 0; i < nb_output_files; i++) {
|
||||
if (!output_files[i]->header_written)
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
avc = av_malloc_array(nb_output_files, sizeof(*avc));
|
||||
|
@ -2903,26 +2858,34 @@ static void print_sdp(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (!j)
|
||||
if (!j) {
|
||||
av_log(NULL, AV_LOG_ERROR, "No output streams in the SDP.\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
av_sdp_create(avc, j, sdp, sizeof(sdp));
|
||||
ret = av_sdp_create(avc, j, sdp, sizeof(sdp));
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
if (!sdp_filename) {
|
||||
printf("SDP:\n%s\n", sdp);
|
||||
fflush(stdout);
|
||||
} else {
|
||||
if (avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL) < 0) {
|
||||
ret = avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename);
|
||||
} else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
avio_print(sdp_pb, sdp);
|
||||
avio_closep(&sdp_pb);
|
||||
av_freep(&sdp_filename);
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
av_freep(&avc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
|
||||
|
@ -2952,12 +2915,7 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (config) {
|
||||
if (config->device_type != ist->hwaccel_device_type) {
|
||||
// Different hwaccel offered, ignore.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (config && config->device_type == ist->hwaccel_device_type) {
|
||||
ret = hwaccel_decode_init(s);
|
||||
if (ret < 0) {
|
||||
if (ist->hwaccel_id == HWACCEL_GENERIC) {
|
||||
|
@ -2970,55 +2928,13 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
|
|||
}
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
const HWAccel *hwaccel = NULL;
|
||||
int i;
|
||||
for (i = 0; hwaccels[i].name; i++) {
|
||||
if (hwaccels[i].pix_fmt == *p) {
|
||||
hwaccel = &hwaccels[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hwaccel) {
|
||||
// No hwaccel supporting this pixfmt.
|
||||
continue;
|
||||
}
|
||||
if (hwaccel->id != ist->hwaccel_id) {
|
||||
// Does not match requested hwaccel.
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = hwaccel->init(s);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"%s hwaccel requested for input stream #%d:%d, "
|
||||
"but cannot be initialized.\n", hwaccel->name,
|
||||
ist->file_index, ist->st->index);
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ist->hw_frames_ctx) {
|
||||
s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);
|
||||
if (!s->hw_frames_ctx)
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
ist->hwaccel_pix_fmt = *p;
|
||||
break;
|
||||
}
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
static int get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
|
||||
if (ist->hwaccel_get_buffer && frame->format == ist->hwaccel_pix_fmt)
|
||||
return ist->hwaccel_get_buffer(s, frame, flags);
|
||||
|
||||
return avcodec_default_get_buffer2(s, frame, flags);
|
||||
return *p;
|
||||
}
|
||||
|
||||
static int init_input_stream(int ist_index, char *error, int error_len)
|
||||
|
@ -3036,7 +2952,6 @@ static int init_input_stream(int ist_index, char *error, int error_len)
|
|||
|
||||
ist->dec_ctx->opaque = ist;
|
||||
ist->dec_ctx->get_format = get_format;
|
||||
ist->dec_ctx->get_buffer2 = get_buffer;
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 60
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
ist->dec_ctx->thread_safe_callbacks = 1;
|
||||
|
@ -3110,8 +3025,6 @@ static int check_init_output_file(OutputFile *of, int file_index)
|
|||
return 0;
|
||||
}
|
||||
|
||||
of->ctx->interrupt_callback = int_cb;
|
||||
|
||||
ret = avformat_write_header(of->ctx, &of->opts);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
|
@ -3126,8 +3039,13 @@ static int check_init_output_file(OutputFile *of, int file_index)
|
|||
av_dump_format(of->ctx, file_index, of->ctx->url, 1);
|
||||
nb_output_dumped++;
|
||||
|
||||
if (sdp_filename || want_sdp)
|
||||
print_sdp();
|
||||
if (sdp_filename || want_sdp) {
|
||||
ret = print_sdp();
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error writing the SDP.\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* flush the muxing queues */
|
||||
for (i = 0; i < of->ctx->nb_streams; i++) {
|
||||
|
@ -3244,9 +3162,6 @@ static int init_output_stream_streamcopy(OutputStream *ost)
|
|||
if (ost->st->duration <= 0 && ist->st->duration > 0)
|
||||
ost->st->duration = av_rescale_q(ist->st->duration, ist->st->time_base, ost->st->time_base);
|
||||
|
||||
// copy disposition
|
||||
ost->st->disposition = ist->st->disposition;
|
||||
|
||||
if (ist->st->nb_side_data) {
|
||||
for (i = 0; i < ist->st->nb_side_data; i++) {
|
||||
const AVPacketSideData *sd_src = &ist->st->side_data[i];
|
||||
|
@ -3302,7 +3217,7 @@ static int init_output_stream_streamcopy(OutputStream *ost)
|
|||
|
||||
static void set_encoder_id(OutputFile *of, OutputStream *ost)
|
||||
{
|
||||
AVDictionaryEntry *e;
|
||||
const AVDictionaryEntry *e;
|
||||
|
||||
uint8_t *encoder_string;
|
||||
int encoder_string_len;
|
||||
|
@ -3434,40 +3349,17 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
|
|||
AVCodecContext *enc_ctx = ost->enc_ctx;
|
||||
AVCodecContext *dec_ctx = NULL;
|
||||
AVFormatContext *oc = output_files[ost->file_index]->ctx;
|
||||
int j, ret;
|
||||
int ret;
|
||||
|
||||
set_encoder_id(output_files[ost->file_index], ost);
|
||||
|
||||
// Muxers use AV_PKT_DATA_DISPLAYMATRIX to signal rotation. On the other
|
||||
// hand, the legacy API makes demuxers set "rotate" metadata entries,
|
||||
// which have to be filtered out to prevent leaking them to output files.
|
||||
av_dict_set(&ost->st->metadata, "rotate", NULL, 0);
|
||||
|
||||
if (ist) {
|
||||
ost->st->disposition = ist->st->disposition;
|
||||
|
||||
dec_ctx = ist->dec_ctx;
|
||||
|
||||
enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location;
|
||||
} else {
|
||||
for (j = 0; j < oc->nb_streams; j++) {
|
||||
AVStream *st = oc->streams[j];
|
||||
if (st != ost->st && st->codecpar->codec_type == ost->st->codecpar->codec_type)
|
||||
break;
|
||||
}
|
||||
if (j == oc->nb_streams)
|
||||
if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ||
|
||||
ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
ost->st->disposition = AV_DISPOSITION_DEFAULT;
|
||||
}
|
||||
|
||||
if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (!ost->frame_rate.num)
|
||||
ost->frame_rate = av_buffersink_get_frame_rate(ost->filter->filter);
|
||||
if (ist && !ost->frame_rate.num)
|
||||
ost->frame_rate = ist->framerate;
|
||||
if (ist && !ost->frame_rate.num)
|
||||
ost->frame_rate = ist->st->r_frame_rate;
|
||||
if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) {
|
||||
ost->frame_rate = (AVRational){25, 1};
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
|
@ -3497,13 +3389,16 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
|
|||
switch (enc_ctx->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
enc_ctx->sample_fmt = av_buffersink_get_format(ost->filter->filter);
|
||||
if (dec_ctx)
|
||||
enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
|
||||
av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3);
|
||||
enc_ctx->sample_rate = av_buffersink_get_sample_rate(ost->filter->filter);
|
||||
enc_ctx->channel_layout = av_buffersink_get_channel_layout(ost->filter->filter);
|
||||
enc_ctx->channels = av_buffersink_get_channels(ost->filter->filter);
|
||||
|
||||
if (ost->bits_per_raw_sample)
|
||||
enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
|
||||
else if (dec_ctx && ost->filter->graph->is_meta)
|
||||
enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
|
||||
av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3);
|
||||
|
||||
init_encoder_time_base(ost, av_make_q(1, enc_ctx->sample_rate));
|
||||
break;
|
||||
|
||||
|
@ -3526,7 +3421,10 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
|
|||
av_buffersink_get_sample_aspect_ratio(ost->filter->filter);
|
||||
|
||||
enc_ctx->pix_fmt = av_buffersink_get_format(ost->filter->filter);
|
||||
if (dec_ctx)
|
||||
|
||||
if (ost->bits_per_raw_sample)
|
||||
enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
|
||||
else if (dec_ctx && ost->filter->graph->is_meta)
|
||||
enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
|
||||
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
|
||||
|
||||
|
@ -3542,13 +3440,6 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
|
|||
|
||||
ost->st->avg_frame_rate = ost->frame_rate;
|
||||
|
||||
if (!dec_ctx ||
|
||||
enc_ctx->width != dec_ctx->width ||
|
||||
enc_ctx->height != dec_ctx->height ||
|
||||
enc_ctx->pix_fmt != dec_ctx->pix_fmt) {
|
||||
enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
|
||||
}
|
||||
|
||||
// Field order: autodetection
|
||||
if (frame) {
|
||||
if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) &&
|
||||
|
@ -3739,40 +3630,6 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
|
|||
return ret;
|
||||
}
|
||||
|
||||
// parse user provided disposition, and update stream values
|
||||
if (ost->disposition) {
|
||||
static const AVOption opts[] = {
|
||||
{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
|
||||
{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEFAULT }, .unit = "flags" },
|
||||
{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DUB }, .unit = "flags" },
|
||||
{ "original" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ORIGINAL }, .unit = "flags" },
|
||||
{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_COMMENT }, .unit = "flags" },
|
||||
{ "lyrics" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_LYRICS }, .unit = "flags" },
|
||||
{ "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_KARAOKE }, .unit = "flags" },
|
||||
{ "forced" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_FORCED }, .unit = "flags" },
|
||||
{ "hearing_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_HEARING_IMPAIRED }, .unit = "flags" },
|
||||
{ "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_VISUAL_IMPAIRED }, .unit = "flags" },
|
||||
{ "clean_effects" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CLEAN_EFFECTS }, .unit = "flags" },
|
||||
{ "attached_pic" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ATTACHED_PIC }, .unit = "flags" },
|
||||
{ "captions" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CAPTIONS }, .unit = "flags" },
|
||||
{ "descriptions" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DESCRIPTIONS }, .unit = "flags" },
|
||||
{ "dependent" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEPENDENT }, .unit = "flags" },
|
||||
{ "metadata" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_METADATA }, .unit = "flags" },
|
||||
{ NULL },
|
||||
};
|
||||
static const AVClass class = {
|
||||
.class_name = "",
|
||||
.item_name = av_default_item_name,
|
||||
.option = opts,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
const AVClass *pclass = &class;
|
||||
|
||||
ret = av_opt_eval_flags(&pclass, &opts[0], ost->disposition, &ost->st->disposition);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* initialize bitstream filters for the output stream
|
||||
* needs to be done here, because the codec id for streamcopy is not
|
||||
* known until now */
|
||||
|
@ -4144,8 +4001,10 @@ static int check_keyboard_interaction(int64_t cur_time)
|
|||
last_time = cur_time;
|
||||
}else
|
||||
key = -1;
|
||||
if (key == 'q')
|
||||
if (key == 'q') {
|
||||
av_log(NULL, AV_LOG_INFO, "\n\n[q] command received. Exiting.\n\n");
|
||||
return AVERROR_EXIT;
|
||||
}
|
||||
if (key == '+') av_log_set_level(av_log_get_level()+10);
|
||||
if (key == '-') av_log_set_level(av_log_get_level()-10);
|
||||
if (key == 's') qp_hist ^= 1;
|
||||
|
@ -5008,7 +4867,7 @@ static int transcode(void)
|
|||
|
||||
term_exit();
|
||||
|
||||
/* write the trailer if needed and close file */
|
||||
/* write the trailer if needed */
|
||||
for (i = 0; i < nb_output_files; i++) {
|
||||
os = output_files[i]->ctx;
|
||||
if (!output_files[i]->header_written) {
|
||||
|
@ -5028,6 +4887,18 @@ static int transcode(void)
|
|||
/* dump report by using the first video and audio streams */
|
||||
print_report(1, timer_start, av_gettime_relative());
|
||||
|
||||
/* close the output files */
|
||||
for (i = 0; i < nb_output_files; i++) {
|
||||
os = output_files[i]->ctx;
|
||||
if (os && os->oformat && !(os->oformat->flags & AVFMT_NOFILE)) {
|
||||
if ((ret = avio_closep(&os->pb)) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error closing file %s: %s\n", os->url, av_err2str(ret));
|
||||
if (exit_on_error)
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* close each encoder */
|
||||
for (i = 0; i < nb_output_streams; i++) {
|
||||
ost = output_streams[i];
|
||||
|
|
|
@ -47,12 +47,14 @@
|
|||
|
||||
#include "libswresample/swresample.h"
|
||||
|
||||
#define VSYNC_AUTO -1
|
||||
#define VSYNC_PASSTHROUGH 0
|
||||
#define VSYNC_CFR 1
|
||||
#define VSYNC_VFR 2
|
||||
#define VSYNC_VSCFR 0xfe
|
||||
#define VSYNC_DROP 0xff
|
||||
enum VideoSyncMethod {
|
||||
VSYNC_AUTO = -1,
|
||||
VSYNC_PASSTHROUGH,
|
||||
VSYNC_CFR,
|
||||
VSYNC_VFR,
|
||||
VSYNC_VSCFR,
|
||||
VSYNC_DROP,
|
||||
};
|
||||
|
||||
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
|
||||
|
||||
|
@ -60,16 +62,8 @@ enum HWAccelID {
|
|||
HWACCEL_NONE = 0,
|
||||
HWACCEL_AUTO,
|
||||
HWACCEL_GENERIC,
|
||||
HWACCEL_VIDEOTOOLBOX,
|
||||
};
|
||||
|
||||
typedef struct HWAccel {
|
||||
const char *name;
|
||||
int (*init)(AVCodecContext *s);
|
||||
enum HWAccelID id;
|
||||
enum AVPixelFormat pix_fmt;
|
||||
} HWAccel;
|
||||
|
||||
typedef struct HWDevice {
|
||||
const char *name;
|
||||
enum AVHWDeviceType type;
|
||||
|
@ -236,6 +230,8 @@ typedef struct OptionsContext {
|
|||
int nb_enc_time_bases;
|
||||
SpecifierOpt *autoscale;
|
||||
int nb_autoscale;
|
||||
SpecifierOpt *bits_per_raw_sample;
|
||||
int nb_bits_per_raw_sample;
|
||||
} OptionsContext;
|
||||
|
||||
typedef struct InputFilter {
|
||||
|
@ -281,9 +277,10 @@ typedef struct OutputFilter {
|
|||
uint64_t channel_layout;
|
||||
|
||||
// those are only set if no format is specified and the encoder gives us multiple options
|
||||
int *formats;
|
||||
uint64_t *channel_layouts;
|
||||
int *sample_rates;
|
||||
// They point directly to the relevant lists of the encoder.
|
||||
const int *formats;
|
||||
const uint64_t *channel_layouts;
|
||||
const int *sample_rates;
|
||||
} OutputFilter;
|
||||
|
||||
typedef struct FilterGraph {
|
||||
|
@ -292,6 +289,9 @@ typedef struct FilterGraph {
|
|||
|
||||
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;
|
||||
|
@ -311,9 +311,9 @@ typedef struct InputStream {
|
|||
AVCodecContext *dec_ctx;
|
||||
const AVCodec *dec;
|
||||
AVFrame *decoded_frame;
|
||||
AVFrame *filter_frame; /* a ref of decoded_frame, to be sent to filters */
|
||||
AVPacket *pkt;
|
||||
|
||||
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) */
|
||||
|
@ -377,11 +377,9 @@ typedef struct InputStream {
|
|||
/* hwaccel context */
|
||||
void *hwaccel_ctx;
|
||||
void (*hwaccel_uninit)(AVCodecContext *s);
|
||||
int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags);
|
||||
int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
|
||||
enum AVPixelFormat hwaccel_pix_fmt;
|
||||
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
|
||||
/* stats */
|
||||
// combined size of all the packets read
|
||||
|
@ -487,11 +485,13 @@ typedef struct OutputStream {
|
|||
/* video only */
|
||||
AVRational frame_rate;
|
||||
AVRational max_frame_rate;
|
||||
enum VideoSyncMethod vsync_method;
|
||||
int is_cfr;
|
||||
int force_fps;
|
||||
int top_field_first;
|
||||
int rotate_overridden;
|
||||
int autoscale;
|
||||
int bits_per_raw_sample;
|
||||
double rotate_override_value;
|
||||
|
||||
AVRational frame_aspect_ratio;
|
||||
|
@ -608,7 +608,7 @@ extern float dts_error_threshold;
|
|||
|
||||
extern int audio_volume;
|
||||
extern int audio_sync_method;
|
||||
extern int video_sync_method;
|
||||
extern enum VideoSyncMethod video_sync_method;
|
||||
extern float frame_drop_threshold;
|
||||
extern int do_benchmark;
|
||||
extern int do_benchmark_all;
|
||||
|
@ -628,7 +628,6 @@ extern int stdin_interaction;
|
|||
extern int frame_bits_per_raw_sample;
|
||||
extern AVIOContext *progress_avio;
|
||||
extern float max_error_rate;
|
||||
extern char *videotoolbox_pixfmt;
|
||||
|
||||
extern char *filter_nbthreads;
|
||||
extern int filter_complex_nbthreads;
|
||||
|
@ -638,7 +637,6 @@ extern int auto_conversion_filters;
|
|||
extern const AVIOInterruptCB int_cb;
|
||||
|
||||
extern const OptionDef options[];
|
||||
extern const HWAccel hwaccels[];
|
||||
#if CONFIG_QSV
|
||||
extern char *qsv_device;
|
||||
#endif
|
||||
|
|
|
@ -83,10 +83,13 @@ static enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx
|
|||
return target;
|
||||
}
|
||||
|
||||
static char *choose_pix_fmts(OutputFilter *ofilter)
|
||||
/* May return NULL (no pixel format found), a static string or a string
|
||||
* backed by the bprint. Nothing has been written to the AVBPrint in case
|
||||
* NULL is returned. The AVBPrint provided should be clean. */
|
||||
static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint)
|
||||
{
|
||||
OutputStream *ost = ofilter->ost;
|
||||
AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
|
||||
const AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
|
||||
if (strict_dict)
|
||||
// used by choose_pixel_fmt() and below
|
||||
av_opt_set(ost->enc_ctx, "strict", strict_dict->value, 0);
|
||||
|
@ -96,18 +99,12 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
|
|||
AVFILTER_AUTO_CONVERT_NONE);
|
||||
if (ost->enc_ctx->pix_fmt == AV_PIX_FMT_NONE)
|
||||
return NULL;
|
||||
return av_strdup(av_get_pix_fmt_name(ost->enc_ctx->pix_fmt));
|
||||
return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt);
|
||||
}
|
||||
if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
|
||||
return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt)));
|
||||
return av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt));
|
||||
} else if (ost->enc && ost->enc->pix_fmts) {
|
||||
const enum AVPixelFormat *p;
|
||||
AVIOContext *s = NULL;
|
||||
uint8_t *ret;
|
||||
int len;
|
||||
|
||||
if (avio_open_dyn_buf(&s) < 0)
|
||||
exit_program(1);
|
||||
|
||||
p = ost->enc->pix_fmts;
|
||||
if (ost->enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
|
||||
|
@ -116,11 +113,11 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
|
|||
|
||||
for (; *p != AV_PIX_FMT_NONE; p++) {
|
||||
const char *name = av_get_pix_fmt_name(*p);
|
||||
avio_printf(s, "%s|", name);
|
||||
av_bprintf(bprint, "%s%c", name, p[1] == AV_PIX_FMT_NONE ? '\0' : '|');
|
||||
}
|
||||
len = avio_close_dyn_buf(s, &ret);
|
||||
ret[len - 1] = 0;
|
||||
return ret;
|
||||
if (!av_bprint_is_complete(bprint))
|
||||
exit_program(1);
|
||||
return bprint->str;
|
||||
} else
|
||||
return NULL;
|
||||
}
|
||||
|
@ -162,33 +159,31 @@ DEF_CHOOSE_FORMAT(channel_layouts, uint64_t, channel_layout, channel_layouts, 0,
|
|||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
||||
{
|
||||
FilterGraph *fg = av_mallocz(sizeof(*fg));
|
||||
OutputFilter *ofilter;
|
||||
InputFilter *ifilter;
|
||||
|
||||
if (!fg)
|
||||
exit_program(1);
|
||||
fg->index = nb_filtergraphs;
|
||||
|
||||
GROW_ARRAY(fg->outputs, fg->nb_outputs);
|
||||
if (!(fg->outputs[0] = av_mallocz(sizeof(*fg->outputs[0]))))
|
||||
exit_program(1);
|
||||
fg->outputs[0]->ost = ost;
|
||||
fg->outputs[0]->graph = fg;
|
||||
fg->outputs[0]->format = -1;
|
||||
ofilter = ALLOC_ARRAY_ELEM(fg->outputs, fg->nb_outputs);
|
||||
ofilter->ost = ost;
|
||||
ofilter->graph = fg;
|
||||
ofilter->format = -1;
|
||||
|
||||
ost->filter = fg->outputs[0];
|
||||
ost->filter = ofilter;
|
||||
|
||||
GROW_ARRAY(fg->inputs, fg->nb_inputs);
|
||||
if (!(fg->inputs[0] = av_mallocz(sizeof(*fg->inputs[0]))))
|
||||
exit_program(1);
|
||||
fg->inputs[0]->ist = ist;
|
||||
fg->inputs[0]->graph = fg;
|
||||
fg->inputs[0]->format = -1;
|
||||
ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs);
|
||||
ifilter->ist = ist;
|
||||
ifilter->graph = fg;
|
||||
ifilter->format = -1;
|
||||
|
||||
fg->inputs[0]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
|
||||
if (!fg->inputs[0]->frame_queue)
|
||||
ifilter->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
|
||||
if (!ifilter->frame_queue)
|
||||
exit_program(1);
|
||||
|
||||
GROW_ARRAY(ist->filters, ist->nb_filters);
|
||||
ist->filters[ist->nb_filters - 1] = fg->inputs[0];
|
||||
ist->filters[ist->nb_filters - 1] = ifilter;
|
||||
|
||||
GROW_ARRAY(filtergraphs, nb_filtergraphs);
|
||||
filtergraphs[nb_filtergraphs - 1] = fg;
|
||||
|
@ -201,17 +196,15 @@ static char *describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int in)
|
|||
AVFilterContext *ctx = inout->filter_ctx;
|
||||
AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads;
|
||||
int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs;
|
||||
AVIOContext *pb;
|
||||
uint8_t *res = NULL;
|
||||
char *res;
|
||||
|
||||
if (avio_open_dyn_buf(&pb) < 0)
|
||||
exit_program(1);
|
||||
|
||||
avio_printf(pb, "%s", ctx->filter->name);
|
||||
if (nb_pads > 1)
|
||||
avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));
|
||||
avio_w8(pb, 0);
|
||||
avio_close_dyn_buf(pb, &res);
|
||||
res = av_strdup(ctx->filter->name);
|
||||
else
|
||||
res = av_asprintf("%s:%s", ctx->filter->name,
|
||||
avfilter_pad_get_name(pads, inout->pad_idx));
|
||||
if (!res)
|
||||
exit_program(1);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -219,6 +212,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
|
|||
{
|
||||
InputStream *ist = NULL;
|
||||
enum AVMediaType type = avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx);
|
||||
InputFilter *ifilter;
|
||||
int i;
|
||||
|
||||
// TODO: support other filter types
|
||||
|
@ -285,21 +279,19 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
|
|||
ist->decoding_needed |= DECODING_FOR_FILTER;
|
||||
ist->st->discard = AVDISCARD_NONE;
|
||||
|
||||
GROW_ARRAY(fg->inputs, fg->nb_inputs);
|
||||
if (!(fg->inputs[fg->nb_inputs - 1] = av_mallocz(sizeof(*fg->inputs[0]))))
|
||||
exit_program(1);
|
||||
fg->inputs[fg->nb_inputs - 1]->ist = ist;
|
||||
fg->inputs[fg->nb_inputs - 1]->graph = fg;
|
||||
fg->inputs[fg->nb_inputs - 1]->format = -1;
|
||||
fg->inputs[fg->nb_inputs - 1]->type = ist->st->codecpar->codec_type;
|
||||
fg->inputs[fg->nb_inputs - 1]->name = describe_filter_link(fg, in, 1);
|
||||
ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs);
|
||||
ifilter->ist = ist;
|
||||
ifilter->graph = fg;
|
||||
ifilter->format = -1;
|
||||
ifilter->type = ist->st->codecpar->codec_type;
|
||||
ifilter->name = describe_filter_link(fg, in, 1);
|
||||
|
||||
fg->inputs[fg->nb_inputs - 1]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
|
||||
if (!fg->inputs[fg->nb_inputs - 1]->frame_queue)
|
||||
ifilter->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
|
||||
if (!ifilter->frame_queue)
|
||||
exit_program(1);
|
||||
|
||||
GROW_ARRAY(ist->filters, ist->nb_filters);
|
||||
ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1];
|
||||
ist->filters[ist->nb_filters - 1] = ifilter;
|
||||
}
|
||||
|
||||
int init_complex_filtergraph(FilterGraph *fg)
|
||||
|
@ -323,18 +315,15 @@ int init_complex_filtergraph(FilterGraph *fg)
|
|||
init_input_filter(fg, cur);
|
||||
|
||||
for (cur = outputs; cur;) {
|
||||
GROW_ARRAY(fg->outputs, fg->nb_outputs);
|
||||
fg->outputs[fg->nb_outputs - 1] = av_mallocz(sizeof(*fg->outputs[0]));
|
||||
if (!fg->outputs[fg->nb_outputs - 1])
|
||||
exit_program(1);
|
||||
OutputFilter *const ofilter = ALLOC_ARRAY_ELEM(fg->outputs, fg->nb_outputs);
|
||||
|
||||
fg->outputs[fg->nb_outputs - 1]->graph = fg;
|
||||
fg->outputs[fg->nb_outputs - 1]->out_tmp = cur;
|
||||
fg->outputs[fg->nb_outputs - 1]->type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
|
||||
ofilter->graph = fg;
|
||||
ofilter->out_tmp = cur;
|
||||
ofilter->type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
|
||||
cur->pad_idx);
|
||||
fg->outputs[fg->nb_outputs - 1]->name = describe_filter_link(fg, cur, 0);
|
||||
ofilter->name = describe_filter_link(fg, cur, 0);
|
||||
cur = cur->next;
|
||||
fg->outputs[fg->nb_outputs - 1]->out_tmp->next = NULL;
|
||||
ofilter->out_tmp->next = NULL;
|
||||
}
|
||||
|
||||
fail:
|
||||
|
@ -418,12 +407,13 @@ static int insert_filter(AVFilterContext **last_filter, int *pad_idx,
|
|||
|
||||
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
|
||||
{
|
||||
char *pix_fmts;
|
||||
OutputStream *ost = ofilter->ost;
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
AVFilterContext *last_filter = out->filter_ctx;
|
||||
AVBPrint bprint;
|
||||
int pad_idx = out->pad_idx;
|
||||
int ret;
|
||||
const char *pix_fmts;
|
||||
char name[255];
|
||||
|
||||
snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
|
||||
|
@ -437,7 +427,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
|
|||
if ((ofilter->width || ofilter->height) && ofilter->ost->autoscale) {
|
||||
char args[255];
|
||||
AVFilterContext *filter;
|
||||
AVDictionaryEntry *e = NULL;
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
|
||||
snprintf(args, sizeof(args), "%d:%d",
|
||||
ofilter->width, ofilter->height);
|
||||
|
@ -459,13 +449,14 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
|
|||
pad_idx = 0;
|
||||
}
|
||||
|
||||
if ((pix_fmts = choose_pix_fmts(ofilter))) {
|
||||
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
if ((pix_fmts = choose_pix_fmts(ofilter, &bprint))) {
|
||||
AVFilterContext *filter;
|
||||
|
||||
ret = avfilter_graph_create_filter(&filter,
|
||||
avfilter_get_by_name("format"),
|
||||
"format", pix_fmts, NULL, fg->graph);
|
||||
av_freep(&pix_fmts);
|
||||
av_bprint_finalize(&bprint, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
|
||||
|
@ -770,12 +761,8 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
|||
theta = get_rotation(displaymatrix);
|
||||
|
||||
if (fabs(theta - 90) < 1.0) {
|
||||
if (displaymatrix[3] > 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose", "clock");
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose",
|
||||
displaymatrix[3] > 0 ? "cclock_flip" : "clock");
|
||||
} else if (fabs(theta - 180) < 1.0) {
|
||||
if (displaymatrix[0] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
|
@ -786,12 +773,8 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
|||
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
|
||||
}
|
||||
} else if (fabs(theta - 270) < 1.0) {
|
||||
if (displaymatrix[3] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose", "cclock");
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose",
|
||||
displaymatrix[3] < 0 ? "clock_flip" : "cclock");
|
||||
} else if (fabs(theta) > 1.0) {
|
||||
char rotate_buf[64];
|
||||
snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta);
|
||||
|
@ -805,23 +788,6 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (do_deinterlace) {
|
||||
AVFilterContext *yadif;
|
||||
|
||||
snprintf(name, sizeof(name), "deinterlace_in_%d_%d",
|
||||
ist->file_index, ist->st->index);
|
||||
if ((ret = avfilter_graph_create_filter(&yadif,
|
||||
avfilter_get_by_name("yadif"),
|
||||
name, "", NULL,
|
||||
fg->graph)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = avfilter_link(last_filter, 0, yadif, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
last_filter = yadif;
|
||||
}
|
||||
|
||||
snprintf(name, sizeof(name), "trim_in_%d_%d",
|
||||
ist->file_index, ist->st->index);
|
||||
if (copy_ts) {
|
||||
|
@ -980,6 +946,30 @@ static void cleanup_filtergraph(FilterGraph *fg)
|
|||
avfilter_graph_free(&fg->graph);
|
||||
}
|
||||
|
||||
static int filter_is_buffersrc(const AVFilterContext *f)
|
||||
{
|
||||
return f->nb_inputs == 0 &&
|
||||
(!strcmp(f->filter->name, "buffersrc") ||
|
||||
!strcmp(f->filter->name, "abuffersrc"));
|
||||
}
|
||||
|
||||
static int graph_is_meta(AVFilterGraph *graph)
|
||||
{
|
||||
for (unsigned i = 0; i < graph->nb_filters; i++) {
|
||||
const AVFilterContext *f = graph->filters[i];
|
||||
|
||||
/* in addition to filters flagged as meta, also
|
||||
* disregard sinks and buffersources (but not other sources,
|
||||
* since they introduce data we are not aware of)
|
||||
*/
|
||||
if (!((f->filter->flags & AVFILTER_FLAG_METADATA_ONLY) ||
|
||||
f->nb_outputs == 0 ||
|
||||
filter_is_buffersrc(f)))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int configure_filtergraph(FilterGraph *fg)
|
||||
{
|
||||
AVFilterInOut *inputs, *outputs, *cur;
|
||||
|
@ -994,7 +984,7 @@ int configure_filtergraph(FilterGraph *fg)
|
|||
if (simple) {
|
||||
OutputStream *ost = fg->outputs[0]->ost;
|
||||
char args[512];
|
||||
AVDictionaryEntry *e = NULL;
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
|
||||
if (filter_nbthreads) {
|
||||
ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
|
||||
|
@ -1080,6 +1070,8 @@ int configure_filtergraph(FilterGraph *fg)
|
|||
if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
|
||||
goto fail;
|
||||
|
||||
fg->is_meta = graph_is_meta(fg->graph);
|
||||
|
||||
/* limit the lists of allowed formats to the ones selected, to
|
||||
* make sure they stay the same if the filtergraph is reconfigured later */
|
||||
for (i = 0; i < fg->nb_outputs; i++) {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/fifo.h"
|
||||
|
@ -83,7 +84,7 @@ static const char *const opt_name_inter_matrices[] = {"inter_matrix",
|
|||
static const char *const opt_name_chroma_intra_matrices[] = {"chroma_intra_matrix", NULL};
|
||||
static const char *const opt_name_top_field_first[] = {"top", NULL};
|
||||
static const char *const opt_name_presets[] = {"pre", "apre", "vpre", "spre", NULL};
|
||||
static const char *const opt_name_copy_initial_nonkeyframes[] = {"copyinkfr", NULL};
|
||||
static const char *const opt_name_copy_initial_nonkeyframes[] = {"copyinkf", NULL};
|
||||
static const char *const opt_name_copy_prior_start[] = {"copypriorss", NULL};
|
||||
static const char *const opt_name_filters[] = {"filter", "af", "vf", NULL};
|
||||
static const char *const opt_name_filter_scripts[] = {"filter_script", NULL};
|
||||
|
@ -100,6 +101,7 @@ static const char *const opt_name_discard[] = {"discard", NULL
|
|||
static const char *const opt_name_disposition[] = {"disposition", NULL};
|
||||
static const char *const opt_name_time_bases[] = {"time_base", NULL};
|
||||
static const char *const opt_name_enc_time_bases[] = {"enc_time_base", NULL};
|
||||
static const char *const opt_name_bits_per_raw_sample[] = {"bits_per_raw_sample", NULL};
|
||||
|
||||
#define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\
|
||||
{\
|
||||
|
@ -138,12 +140,6 @@ static const char *const opt_name_enc_time_bases[] = {"enc_time_base"
|
|||
}\
|
||||
}
|
||||
|
||||
const HWAccel hwaccels[] = {
|
||||
#if CONFIG_VIDEOTOOLBOX
|
||||
{ "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, AV_PIX_FMT_VIDEOTOOLBOX },
|
||||
#endif
|
||||
{ 0 },
|
||||
};
|
||||
HWDevice *filter_hw_device;
|
||||
|
||||
char *vstats_filename;
|
||||
|
@ -155,9 +151,8 @@ float dts_error_threshold = 3600*30;
|
|||
|
||||
int audio_volume = 256;
|
||||
int audio_sync_method = 0;
|
||||
int video_sync_method = VSYNC_AUTO;
|
||||
enum VideoSyncMethod video_sync_method = VSYNC_AUTO;
|
||||
float frame_drop_threshold = 0;
|
||||
int do_deinterlace = 0;
|
||||
int do_benchmark = 0;
|
||||
int do_benchmark_all = 0;
|
||||
int do_hex_dump = 0;
|
||||
|
@ -171,7 +166,6 @@ int abort_on_flags = 0;
|
|||
int print_stats = -1;
|
||||
int qp_hist = 0;
|
||||
int stdin_interaction = 1;
|
||||
int frame_bits_per_raw_sample = 0;
|
||||
float max_error_rate = 2.0/3;
|
||||
char *filter_nbthreads;
|
||||
int filter_complex_nbthreads = 0;
|
||||
|
@ -180,11 +174,9 @@ int auto_conversion_filters = 1;
|
|||
int64_t stats_period = 500000;
|
||||
|
||||
|
||||
static int intra_only = 0;
|
||||
static int file_overwrite = 0;
|
||||
static int no_file_overwrite = 0;
|
||||
static int do_psnr = 0;
|
||||
static int input_sync;
|
||||
static int input_stream_potentially_available = 0;
|
||||
static int ignore_unknown_streams = 0;
|
||||
static int copy_unknown_streams = 0;
|
||||
|
@ -253,7 +245,7 @@ static int show_hwaccels(void *optctx, const char *opt, const char *arg)
|
|||
/* return a copy of the input with the stream specifiers removed from the keys */
|
||||
static AVDictionary *strip_specifiers(AVDictionary *dict)
|
||||
{
|
||||
AVDictionaryEntry *e = NULL;
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
AVDictionary *ret = NULL;
|
||||
|
||||
while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
|
||||
|
@ -309,27 +301,6 @@ static int opt_stats_period(void *optctx, const char *opt, const char *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int opt_sameq(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_ERROR, "Option '%s' was removed. "
|
||||
"If you are looking for an option to preserve the quality (which is not "
|
||||
"what -%s was for), use -qscale 0 or an equivalent quality factor option.\n",
|
||||
opt, opt);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
static int opt_video_channel(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -channel.\n");
|
||||
return opt_default(optctx, "channel", arg);
|
||||
}
|
||||
|
||||
static int opt_video_standard(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -standard.\n");
|
||||
return opt_default(optctx, "standard", arg);
|
||||
}
|
||||
|
||||
static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
OptionsContext *o = optctx;
|
||||
|
@ -890,6 +861,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
|||
}
|
||||
|
||||
ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE;
|
||||
ist->prev_pkt_pts = AV_NOPTS_VALUE;
|
||||
|
||||
ist->dec_ctx = avcodec_alloc_context3(ist->dec);
|
||||
if (!ist->dec_ctx) {
|
||||
|
@ -903,6 +875,10 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
|||
exit_program(1);
|
||||
}
|
||||
|
||||
ist->decoded_frame = av_frame_alloc();
|
||||
if (!ist->decoded_frame)
|
||||
exit_program(1);
|
||||
|
||||
ist->pkt = av_packet_alloc();
|
||||
if (!ist->pkt)
|
||||
exit_program(1);
|
||||
|
@ -965,22 +941,11 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
|||
else if (!strcmp(hwaccel, "auto"))
|
||||
ist->hwaccel_id = HWACCEL_AUTO;
|
||||
else {
|
||||
enum AVHWDeviceType type;
|
||||
int i;
|
||||
for (i = 0; hwaccels[i].name; i++) {
|
||||
if (!strcmp(hwaccels[i].name, hwaccel)) {
|
||||
ist->hwaccel_id = hwaccels[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ist->hwaccel_id) {
|
||||
type = av_hwdevice_find_type_by_name(hwaccel);
|
||||
enum AVHWDeviceType type = av_hwdevice_find_type_by_name(hwaccel);
|
||||
if (type != AV_HWDEVICE_TYPE_NONE) {
|
||||
ist->hwaccel_id = HWACCEL_GENERIC;
|
||||
ist->hwaccel_device_type = type;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ist->hwaccel_id) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Unrecognized hwaccel: %s.\n",
|
||||
|
@ -1088,7 +1053,7 @@ static void dump_attachment(AVStream *st, const char *filename)
|
|||
{
|
||||
int ret;
|
||||
AVIOContext *out = NULL;
|
||||
AVDictionaryEntry *e;
|
||||
const AVDictionaryEntry *e;
|
||||
|
||||
if (!st->codecpar->extradata_size) {
|
||||
av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n",
|
||||
|
@ -1124,7 +1089,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
|||
int err, i, ret;
|
||||
int64_t timestamp;
|
||||
AVDictionary *unused_opts = NULL;
|
||||
AVDictionaryEntry *e = NULL;
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
char * video_codec_name = NULL;
|
||||
char * audio_codec_name = NULL;
|
||||
char *subtitle_codec_name = NULL;
|
||||
|
@ -1316,11 +1281,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
|||
/* dump the file content */
|
||||
av_dump_format(ic, nb_input_files, filename, 0);
|
||||
|
||||
GROW_ARRAY(input_files, nb_input_files);
|
||||
f = av_mallocz(sizeof(*f));
|
||||
if (!f)
|
||||
exit_program(1);
|
||||
input_files[nb_input_files - 1] = f;
|
||||
f = ALLOC_ARRAY_ELEM(input_files, nb_input_files);
|
||||
|
||||
f->ctx = ic;
|
||||
f->ist_index = nb_input_streams - ic->nb_streams;
|
||||
|
@ -1406,23 +1367,18 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t *get_line(AVIOContext *s)
|
||||
static char *get_line(AVIOContext *s, AVBPrint *bprint)
|
||||
{
|
||||
AVIOContext *line;
|
||||
uint8_t *buf;
|
||||
char c;
|
||||
|
||||
if (avio_open_dyn_buf(&line) < 0) {
|
||||
while ((c = avio_r8(s)) && c != '\n')
|
||||
av_bprint_chars(bprint, c, 1);
|
||||
|
||||
if (!av_bprint_is_complete(bprint)) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Could not alloc buffer for reading preset.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
while ((c = avio_r8(s)) && c != '\n')
|
||||
avio_w8(line, c);
|
||||
avio_w8(line, 0);
|
||||
avio_close_dyn_buf(line, &buf);
|
||||
|
||||
return buf;
|
||||
return bprint->str;
|
||||
}
|
||||
|
||||
static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
|
||||
|
@ -1535,6 +1491,10 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
|||
exit_program(1);
|
||||
}
|
||||
|
||||
ost->filtered_frame = av_frame_alloc();
|
||||
if (!ost->filtered_frame)
|
||||
exit_program(1);
|
||||
|
||||
ost->pkt = av_packet_alloc();
|
||||
if (!ost->pkt)
|
||||
exit_program(1);
|
||||
|
@ -1549,20 +1509,21 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
|||
ost->autoscale = 1;
|
||||
MATCH_PER_STREAM_OPT(autoscale, i, ost->autoscale, oc, st);
|
||||
if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) {
|
||||
AVBPrint bprint;
|
||||
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
do {
|
||||
buf = get_line(s);
|
||||
if (!buf[0] || buf[0] == '#') {
|
||||
av_free(buf);
|
||||
av_bprint_clear(&bprint);
|
||||
buf = get_line(s, &bprint);
|
||||
if (!buf[0] || buf[0] == '#')
|
||||
continue;
|
||||
}
|
||||
if (!(arg = strchr(buf, '='))) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
*arg++ = 0;
|
||||
av_dict_set(&ost->encoder_opts, buf, arg, AV_DICT_DONT_OVERWRITE);
|
||||
av_free(buf);
|
||||
} while (!s->eof_reached);
|
||||
av_bprint_finalize(&bprint, NULL);
|
||||
avio_closep(&s);
|
||||
}
|
||||
if (ret) {
|
||||
|
@ -1643,6 +1604,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
|||
|
||||
ost->max_muxing_queue_size = 1024;
|
||||
MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
|
||||
ost->max_muxing_queue_size = FFMIN(ost->max_muxing_queue_size, INT_MAX / sizeof(ost->pkt));
|
||||
ost->max_muxing_queue_size *= sizeof(ost->pkt);
|
||||
|
||||
ost->muxing_queue_data_size = 0;
|
||||
|
@ -1650,6 +1612,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
|||
ost->muxing_queue_data_threshold = 50*1024*1024;
|
||||
MATCH_PER_STREAM_OPT(muxing_queue_data_threshold, i, ost->muxing_queue_data_threshold, oc, st);
|
||||
|
||||
MATCH_PER_STREAM_OPT(bits_per_raw_sample, i, ost->bits_per_raw_sample,
|
||||
oc, st);
|
||||
|
||||
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
|
@ -1692,29 +1657,26 @@ static void parse_matrix_coeffs(uint16_t *dest, const char *str)
|
|||
}
|
||||
|
||||
/* read file contents into a string */
|
||||
static uint8_t *read_file(const char *filename)
|
||||
static char *read_file(const char *filename)
|
||||
{
|
||||
AVIOContext *pb = NULL;
|
||||
AVIOContext *dyn_buf = NULL;
|
||||
int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
|
||||
uint8_t buf[1024], *str;
|
||||
AVBPrint bprint;
|
||||
char *str;
|
||||
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error opening file %s.\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = avio_open_dyn_buf(&dyn_buf);
|
||||
if (ret < 0) {
|
||||
av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
ret = avio_read_to_bprint(pb, &bprint, SIZE_MAX);
|
||||
avio_closep(&pb);
|
||||
if (ret < 0) {
|
||||
av_bprint_finalize(&bprint, NULL);
|
||||
return NULL;
|
||||
}
|
||||
while ((ret = avio_read(pb, buf, sizeof(buf))) > 0)
|
||||
avio_write(dyn_buf, buf, ret);
|
||||
avio_w8(dyn_buf, 0);
|
||||
avio_closep(&pb);
|
||||
|
||||
ret = avio_close_dyn_buf(dyn_buf, &str);
|
||||
ret = av_bprint_finalize(&bprint, &str);
|
||||
if (ret < 0)
|
||||
return NULL;
|
||||
return str;
|
||||
|
@ -1784,7 +1746,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
|||
|
||||
if ((frame_rate || max_frame_rate) &&
|
||||
video_sync_method == VSYNC_PASSTHROUGH)
|
||||
av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r/-fpsmax can produce invalid output files\n");
|
||||
av_log(NULL, AV_LOG_ERROR, "Using -vsync passthrough and -r/-fpsmax can produce invalid output files\n");
|
||||
|
||||
MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st);
|
||||
if (frame_aspect_ratio) {
|
||||
|
@ -1815,7 +1777,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
|||
exit_program(1);
|
||||
}
|
||||
|
||||
video_enc->bits_per_raw_sample = frame_bits_per_raw_sample;
|
||||
MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st);
|
||||
if (frame_pix_fmt && *frame_pix_fmt == '+') {
|
||||
ost->keep_pix_fmt = 1;
|
||||
|
@ -1828,8 +1789,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
|||
}
|
||||
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
|
||||
|
||||
if (intra_only)
|
||||
video_enc->gop_size = 0;
|
||||
MATCH_PER_STREAM_OPT(intra_matrices, str, intra_matrix, oc, st);
|
||||
if (intra_matrix) {
|
||||
if (!(video_enc->intra_matrix = av_mallocz(sizeof(*video_enc->intra_matrix) * 64))) {
|
||||
|
@ -1951,10 +1910,38 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
|||
ost->top_field_first = -1;
|
||||
MATCH_PER_STREAM_OPT(top_field_first, i, ost->top_field_first, oc, st);
|
||||
|
||||
ost->vsync_method = video_sync_method;
|
||||
if (ost->vsync_method == VSYNC_AUTO) {
|
||||
if (!strcmp(oc->oformat->name, "avi")) {
|
||||
ost->vsync_method = VSYNC_VFR;
|
||||
} else {
|
||||
ost->vsync_method = (oc->oformat->flags & AVFMT_VARIABLE_FPS) ?
|
||||
((oc->oformat->flags & AVFMT_NOTIMESTAMPS) ?
|
||||
VSYNC_PASSTHROUGH : VSYNC_VFR) :
|
||||
VSYNC_CFR;
|
||||
}
|
||||
|
||||
if (ost->source_index >= 0 && ost->vsync_method == VSYNC_CFR) {
|
||||
const InputStream *ist = input_streams[ost->source_index];
|
||||
const InputFile *ifile = input_files[ist->file_index];
|
||||
|
||||
if (ifile->nb_streams == 1 && ifile->input_ts_offset == 0)
|
||||
ost->vsync_method = VSYNC_VSCFR;
|
||||
}
|
||||
|
||||
if (ost->vsync_method == VSYNC_CFR && copy_ts) {
|
||||
ost->vsync_method = VSYNC_VSCFR;
|
||||
}
|
||||
}
|
||||
ost->is_cfr = (ost->vsync_method == VSYNC_CFR || ost->vsync_method == VSYNC_VSCFR);
|
||||
|
||||
ost->avfilter = get_ost_filters(o, oc, ost);
|
||||
if (!ost->avfilter)
|
||||
exit_program(1);
|
||||
|
||||
ost->last_frame = av_frame_alloc();
|
||||
if (!ost->last_frame)
|
||||
exit_program(1);
|
||||
} else {
|
||||
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st);
|
||||
}
|
||||
|
@ -2165,6 +2152,72 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int set_dispositions(OutputFile *of)
|
||||
{
|
||||
int nb_streams[AVMEDIA_TYPE_NB] = { 0 };
|
||||
int have_default[AVMEDIA_TYPE_NB] = { 0 };
|
||||
int have_manual = 0;
|
||||
|
||||
// first, copy the input dispositions
|
||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
|
||||
nb_streams[ost->st->codecpar->codec_type]++;
|
||||
|
||||
have_manual |= !!ost->disposition;
|
||||
|
||||
if (ost->source_index >= 0) {
|
||||
ost->st->disposition = input_streams[ost->source_index]->st->disposition;
|
||||
|
||||
if (ost->st->disposition & AV_DISPOSITION_DEFAULT)
|
||||
have_default[ost->st->codecpar->codec_type] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (have_manual) {
|
||||
// process manually set dispositions - they override the above copy
|
||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
int ret;
|
||||
|
||||
if (!ost->disposition)
|
||||
continue;
|
||||
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 60
|
||||
ret = av_opt_set(ost->st, "disposition", ost->disposition, 0);
|
||||
#else
|
||||
{
|
||||
const AVClass *class = av_stream_get_class();
|
||||
const AVOption *o = av_opt_find(&class, "disposition", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ);
|
||||
|
||||
av_assert0(o);
|
||||
ret = av_opt_eval_flags(&class, o, ost->disposition, &ost->st->disposition);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
// For each media type with more than one stream, find a suitable stream to
|
||||
// mark as default, unless one is already marked default.
|
||||
// "Suitable" means the first of that type, skipping attached pictures.
|
||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
enum AVMediaType type = ost->st->codecpar->codec_type;
|
||||
|
||||
if (nb_streams[type] < 2 || have_default[type] ||
|
||||
ost->st->disposition & AV_DISPOSITION_ATTACHED_PIC)
|
||||
continue;
|
||||
|
||||
ost->st->disposition |= AV_DISPOSITION_DEFAULT;
|
||||
have_default[type] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void init_output_filter(OutputFilter *ofilter, OptionsContext *o,
|
||||
AVFormatContext *oc)
|
||||
{
|
||||
|
@ -2179,7 +2232,6 @@ static void init_output_filter(OutputFilter *ofilter, OptionsContext *o,
|
|||
exit_program(1);
|
||||
}
|
||||
|
||||
ost->source_index = -1;
|
||||
ost->filter = ofilter;
|
||||
|
||||
ofilter->ost = ost;
|
||||
|
@ -2260,7 +2312,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
|||
OutputStream *ost;
|
||||
InputStream *ist;
|
||||
AVDictionary *unused_opts = NULL;
|
||||
AVDictionaryEntry *e = NULL;
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
|
||||
if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) {
|
||||
o->stop_time = INT64_MAX;
|
||||
|
@ -2277,11 +2329,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
|||
}
|
||||
}
|
||||
|
||||
GROW_ARRAY(output_files, nb_output_files);
|
||||
of = av_mallocz(sizeof(*of));
|
||||
if (!of)
|
||||
exit_program(1);
|
||||
output_files[nb_output_files - 1] = of;
|
||||
of = ALLOC_ARRAY_ELEM(output_files, nb_output_files);
|
||||
|
||||
of->ost_index = nb_output_streams;
|
||||
of->recording_time = o->recording_time;
|
||||
|
@ -2629,7 +2677,6 @@ loop_end:
|
|||
/* set the filter output constraints */
|
||||
if (ost->filter) {
|
||||
OutputFilter *f = ost->filter;
|
||||
int count;
|
||||
switch (ost->enc_ctx->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
f->frame_rate = ost->frame_rate;
|
||||
|
@ -2637,51 +2684,25 @@ loop_end:
|
|||
f->height = ost->enc_ctx->height;
|
||||
if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
|
||||
f->format = ost->enc_ctx->pix_fmt;
|
||||
} else if (ost->enc->pix_fmts) {
|
||||
count = 0;
|
||||
while (ost->enc->pix_fmts[count] != AV_PIX_FMT_NONE)
|
||||
count++;
|
||||
f->formats = av_calloc(count + 1, sizeof(*f->formats));
|
||||
if (!f->formats)
|
||||
exit_program(1);
|
||||
memcpy(f->formats, ost->enc->pix_fmts, (count + 1) * sizeof(*f->formats));
|
||||
} else {
|
||||
f->formats = ost->enc->pix_fmts;
|
||||
}
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
if (ost->enc_ctx->sample_fmt != AV_SAMPLE_FMT_NONE) {
|
||||
f->format = ost->enc_ctx->sample_fmt;
|
||||
} else if (ost->enc->sample_fmts) {
|
||||
count = 0;
|
||||
while (ost->enc->sample_fmts[count] != AV_SAMPLE_FMT_NONE)
|
||||
count++;
|
||||
f->formats = av_calloc(count + 1, sizeof(*f->formats));
|
||||
if (!f->formats)
|
||||
exit_program(1);
|
||||
memcpy(f->formats, ost->enc->sample_fmts, (count + 1) * sizeof(*f->formats));
|
||||
} else {
|
||||
f->formats = ost->enc->sample_fmts;
|
||||
}
|
||||
if (ost->enc_ctx->sample_rate) {
|
||||
f->sample_rate = ost->enc_ctx->sample_rate;
|
||||
} else if (ost->enc->supported_samplerates) {
|
||||
count = 0;
|
||||
while (ost->enc->supported_samplerates[count])
|
||||
count++;
|
||||
f->sample_rates = av_calloc(count + 1, sizeof(*f->sample_rates));
|
||||
if (!f->sample_rates)
|
||||
exit_program(1);
|
||||
memcpy(f->sample_rates, ost->enc->supported_samplerates,
|
||||
(count + 1) * sizeof(*f->sample_rates));
|
||||
} else {
|
||||
f->sample_rates = ost->enc->supported_samplerates;
|
||||
}
|
||||
if (ost->enc_ctx->channels) {
|
||||
f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels);
|
||||
} else if (ost->enc->channel_layouts) {
|
||||
count = 0;
|
||||
while (ost->enc->channel_layouts[count])
|
||||
count++;
|
||||
f->channel_layouts = av_calloc(count + 1, sizeof(*f->channel_layouts));
|
||||
if (!f->channel_layouts)
|
||||
exit_program(1);
|
||||
memcpy(f->channel_layouts, ost->enc->channel_layouts,
|
||||
(count + 1) * sizeof(*f->channel_layouts));
|
||||
} else {
|
||||
f->channel_layouts = ost->enc->channel_layouts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2926,6 +2947,12 @@ loop_end:
|
|||
}
|
||||
}
|
||||
|
||||
err = set_dispositions(of);
|
||||
if (err < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Error setting output stream dispositions\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3257,8 +3284,11 @@ static int opt_vsync(void *optctx, const char *opt, const char *arg)
|
|||
else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH;
|
||||
else if (!av_strcasecmp(arg, "drop")) video_sync_method = VSYNC_DROP;
|
||||
|
||||
if (video_sync_method == VSYNC_AUTO)
|
||||
if (video_sync_method == VSYNC_AUTO) {
|
||||
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");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3320,12 +3350,12 @@ 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)
|
||||
{
|
||||
GROW_ARRAY(filtergraphs, nb_filtergraphs);
|
||||
if (!(filtergraphs[nb_filtergraphs - 1] = av_mallocz(sizeof(*filtergraphs[0]))))
|
||||
return AVERROR(ENOMEM);
|
||||
filtergraphs[nb_filtergraphs - 1]->index = nb_filtergraphs - 1;
|
||||
filtergraphs[nb_filtergraphs - 1]->graph_desc = av_strdup(arg);
|
||||
if (!filtergraphs[nb_filtergraphs - 1]->graph_desc)
|
||||
FilterGraph *fg;
|
||||
ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs);
|
||||
fg = filtergraphs[nb_filtergraphs - 1];
|
||||
fg->index = nb_filtergraphs - 1;
|
||||
fg->graph_desc = av_strdup(arg);
|
||||
if (!fg->graph_desc)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
input_stream_potentially_available = 1;
|
||||
|
@ -3335,15 +3365,14 @@ static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
|
|||
|
||||
static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
uint8_t *graph_desc = read_file(arg);
|
||||
FilterGraph *fg;
|
||||
char *graph_desc = read_file(arg);
|
||||
if (!graph_desc)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
GROW_ARRAY(filtergraphs, nb_filtergraphs);
|
||||
if (!(filtergraphs[nb_filtergraphs - 1] = av_mallocz(sizeof(*filtergraphs[0]))))
|
||||
return AVERROR(ENOMEM);
|
||||
filtergraphs[nb_filtergraphs - 1]->index = nb_filtergraphs - 1;
|
||||
filtergraphs[nb_filtergraphs - 1]->graph_desc = graph_desc;
|
||||
fg = ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs);
|
||||
fg->index = nb_filtergraphs - 1;
|
||||
fg->graph_desc = graph_desc;
|
||||
|
||||
input_stream_potentially_available = 1;
|
||||
|
||||
|
@ -3739,6 +3768,9 @@ const OptionDef options[] = {
|
|||
"set the maximum number of queued packets from the demuxer" },
|
||||
{ "find_stream_info", OPT_BOOL | OPT_PERFILE | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
|
||||
"read and decode the streams to fill missing information with heuristics" },
|
||||
{ "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
|
||||
{ .off = OFFSET(bits_per_raw_sample) },
|
||||
"set the number of bits per raw sample", "number" },
|
||||
|
||||
/* video options */
|
||||
{ "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames },
|
||||
|
@ -3758,10 +3790,6 @@ const OptionDef options[] = {
|
|||
{ "pix_fmt", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
|
||||
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_pix_fmts) },
|
||||
"set pixel format", "format" },
|
||||
{ "bits_per_raw_sample", OPT_VIDEO | OPT_INT | HAS_ARG, { &frame_bits_per_raw_sample },
|
||||
"set the number of bits per raw sample", "number" },
|
||||
{ "intra", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &intra_only },
|
||||
"deprecated use -g 1" },
|
||||
{ "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(video_disable) },
|
||||
"disable video" },
|
||||
{ "rc_override", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
|
||||
|
@ -3770,10 +3798,6 @@ const OptionDef options[] = {
|
|||
{ "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT |
|
||||
OPT_OUTPUT, { .func_arg = opt_video_codec },
|
||||
"force video codec ('copy' to copy stream)", "codec" },
|
||||
{ "sameq", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_sameq },
|
||||
"Removed" },
|
||||
{ "same_quant", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_sameq },
|
||||
"Removed" },
|
||||
{ "timecode", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_timecode },
|
||||
"set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
|
||||
{ "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT | OPT_OUTPUT, { .off = OFFSET(pass) },
|
||||
|
@ -3781,8 +3805,6 @@ const OptionDef options[] = {
|
|||
{ "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC |
|
||||
OPT_OUTPUT, { .off = OFFSET(passlogfiles) },
|
||||
"select two pass log file name prefix", "prefix" },
|
||||
{ "deinterlace", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_deinterlace },
|
||||
"this option is deprecated, use the yadif filter instead" },
|
||||
{ "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr },
|
||||
"calculate PSNR of compressed frames" },
|
||||
{ "vstats", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_vstats },
|
||||
|
@ -3832,9 +3854,6 @@ const OptionDef options[] = {
|
|||
{ "hwaccel_output_format", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
|
||||
OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) },
|
||||
"select output format used with HW accelerated decoding", "format" },
|
||||
#if CONFIG_VIDEOTOOLBOX
|
||||
{ "videotoolbox_pixfmt", HAS_ARG | OPT_STRING | OPT_EXPERT, { &videotoolbox_pixfmt}, "" },
|
||||
#endif
|
||||
{ "hwaccels", OPT_EXIT, { .func_arg = show_hwaccels },
|
||||
"show available HW acceleration methods" },
|
||||
{ "autorotate", HAS_ARG | OPT_BOOL | OPT_SPEC |
|
||||
|
@ -3888,13 +3907,6 @@ const OptionDef options[] = {
|
|||
{ "canvas_size", OPT_SUBTITLE | HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT, { .off = OFFSET(canvas_sizes) },
|
||||
"set canvas size (WxH or abbreviation)", "size" },
|
||||
|
||||
/* grab options */
|
||||
{ "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_video_channel },
|
||||
"deprecated, use -channel", "channel" },
|
||||
{ "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_video_standard },
|
||||
"deprecated, use -standard", "standard" },
|
||||
{ "isync", OPT_BOOL | OPT_EXPERT, { &input_sync }, "this option is deprecated and does nothing", "" },
|
||||
|
||||
/* muxer options */
|
||||
{ "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_max_delay) },
|
||||
"set the maximum demux-decode delay", "seconds" },
|
||||
|
|
|
@ -1,177 +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 "config.h"
|
||||
|
||||
#if HAVE_UTGETOSTYPEFROMSTRING
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavcodec/videotoolbox.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "ffmpeg.h"
|
||||
|
||||
typedef struct VTContext {
|
||||
AVFrame *tmp_frame;
|
||||
int log_once;
|
||||
} VTContext;
|
||||
|
||||
char *videotoolbox_pixfmt;
|
||||
|
||||
static int videotoolbox_retrieve_data(AVCodecContext *s, AVFrame *frame)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
VTContext *vt = ist->hwaccel_ctx;
|
||||
CVPixelBufferRef pixbuf = (CVPixelBufferRef)frame->data[3];
|
||||
OSType pixel_format = CVPixelBufferGetPixelFormatType(pixbuf);
|
||||
CVReturn err;
|
||||
uint8_t *data[4] = { 0 };
|
||||
int linesize[4] = { 0 };
|
||||
int planes, ret, i;
|
||||
|
||||
if (frame->format == ist->hwaccel_output_format) {
|
||||
av_log_once(s, AV_LOG_INFO, AV_LOG_TRACE, &vt->log_once,
|
||||
"There is no video filter for videotoolbox pix_fmt now, remove the "
|
||||
"-hwaccel_output_format option if video filter doesn't work\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_frame_unref(vt->tmp_frame);
|
||||
|
||||
switch (pixel_format) {
|
||||
case kCVPixelFormatType_420YpCbCr8Planar: vt->tmp_frame->format = AV_PIX_FMT_YUV420P; break;
|
||||
case kCVPixelFormatType_422YpCbCr8: vt->tmp_frame->format = AV_PIX_FMT_UYVY422; break;
|
||||
case kCVPixelFormatType_32BGRA: vt->tmp_frame->format = AV_PIX_FMT_BGRA; break;
|
||||
#ifdef kCFCoreFoundationVersionNumber10_7
|
||||
case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
|
||||
case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange: vt->tmp_frame->format = AV_PIX_FMT_NV12; break;
|
||||
#endif
|
||||
#if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
|
||||
case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange:
|
||||
case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange: vt->tmp_frame->format = AV_PIX_FMT_P010; break;
|
||||
#endif
|
||||
default:
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"%s: Unsupported pixel format: %s\n",
|
||||
av_fourcc2str(s->codec_tag), videotoolbox_pixfmt);
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
vt->tmp_frame->width = frame->width;
|
||||
vt->tmp_frame->height = frame->height;
|
||||
ret = av_frame_get_buffer(vt->tmp_frame, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
err = CVPixelBufferLockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
|
||||
if (err != kCVReturnSuccess) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error locking the pixel buffer.\n");
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
if (CVPixelBufferIsPlanar(pixbuf)) {
|
||||
|
||||
planes = CVPixelBufferGetPlaneCount(pixbuf);
|
||||
for (i = 0; i < planes; i++) {
|
||||
data[i] = CVPixelBufferGetBaseAddressOfPlane(pixbuf, i);
|
||||
linesize[i] = CVPixelBufferGetBytesPerRowOfPlane(pixbuf, i);
|
||||
}
|
||||
} else {
|
||||
data[0] = CVPixelBufferGetBaseAddress(pixbuf);
|
||||
linesize[0] = CVPixelBufferGetBytesPerRow(pixbuf);
|
||||
}
|
||||
|
||||
av_image_copy(vt->tmp_frame->data, vt->tmp_frame->linesize,
|
||||
(const uint8_t **)data, linesize, vt->tmp_frame->format,
|
||||
frame->width, frame->height);
|
||||
|
||||
ret = av_frame_copy_props(vt->tmp_frame, frame);
|
||||
CVPixelBufferUnlockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
av_frame_unref(frame);
|
||||
av_frame_move_ref(frame, vt->tmp_frame);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void videotoolbox_uninit(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
VTContext *vt = ist->hwaccel_ctx;
|
||||
|
||||
ist->hwaccel_uninit = NULL;
|
||||
ist->hwaccel_retrieve_data = NULL;
|
||||
|
||||
av_frame_free(&vt->tmp_frame);
|
||||
|
||||
av_videotoolbox_default_free(s);
|
||||
av_freep(&ist->hwaccel_ctx);
|
||||
}
|
||||
|
||||
int videotoolbox_init(AVCodecContext *s)
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
|
||||
int ret = 0;
|
||||
VTContext *vt;
|
||||
|
||||
vt = av_mallocz(sizeof(*vt));
|
||||
if (!vt)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ist->hwaccel_ctx = vt;
|
||||
ist->hwaccel_uninit = videotoolbox_uninit;
|
||||
ist->hwaccel_retrieve_data = videotoolbox_retrieve_data;
|
||||
|
||||
vt->tmp_frame = av_frame_alloc();
|
||||
if (!vt->tmp_frame) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// TODO: reindent
|
||||
if (!videotoolbox_pixfmt) {
|
||||
ret = av_videotoolbox_default_init(s);
|
||||
} else {
|
||||
AVVideotoolboxContext *vtctx = av_videotoolbox_alloc_context();
|
||||
CFStringRef pixfmt_str = CFStringCreateWithCString(kCFAllocatorDefault,
|
||||
videotoolbox_pixfmt,
|
||||
kCFStringEncodingUTF8);
|
||||
#if HAVE_UTGETOSTYPEFROMSTRING
|
||||
vtctx->cv_pix_fmt_type = UTGetOSTypeFromString(pixfmt_str);
|
||||
#else
|
||||
av_log(s, loglevel, "UTGetOSTypeFromString() is not available "
|
||||
"on this platform, %s pixel format can not be honored from "
|
||||
"the command line\n", videotoolbox_pixfmt);
|
||||
#endif
|
||||
ret = av_videotoolbox_default_init2(s, vtctx);
|
||||
CFRelease(pixfmt_str);
|
||||
}
|
||||
if (ret < 0) {
|
||||
av_log(NULL, loglevel, "Error creating Videotoolbox decoder.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
videotoolbox_uninit(s);
|
||||
return ret;
|
||||
}
|
|
@ -1856,7 +1856,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
|||
AVFilterContext *filt_src = NULL, *filt_out = NULL, *last_filter = NULL;
|
||||
AVCodecParameters *codecpar = is->video_st->codecpar;
|
||||
AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
|
||||
AVDictionaryEntry *e = NULL;
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
int nb_pix_fmts = 0;
|
||||
int i, j;
|
||||
|
||||
|
@ -1960,7 +1960,7 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
|||
int channels[2] = { 0, -1 };
|
||||
AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
|
||||
char aresample_swr_opts[512] = "";
|
||||
AVDictionaryEntry *e = NULL;
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
char asrc_args[256];
|
||||
int ret;
|
||||
|
||||
|
@ -2575,7 +2575,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
|||
const AVCodec *codec;
|
||||
const char *forced_codec_name = NULL;
|
||||
AVDictionary *opts = NULL;
|
||||
AVDictionaryEntry *t = NULL;
|
||||
const AVDictionaryEntry *t = NULL;
|
||||
int sample_rate, nb_channels;
|
||||
int64_t channel_layout;
|
||||
int ret = 0;
|
||||
|
@ -2760,7 +2760,7 @@ static int read_thread(void *arg)
|
|||
AVPacket *pkt = NULL;
|
||||
int64_t stream_start_time;
|
||||
int pkt_in_play_range = 0;
|
||||
AVDictionaryEntry *t;
|
||||
const AVDictionaryEntry *t;
|
||||
SDL_mutex *wait_mutex = SDL_CreateMutex();
|
||||
int scan_all_pmts_set = 0;
|
||||
int64_t pkt_ts;
|
||||
|
@ -3746,6 +3746,10 @@ int main(int argc, char **argv)
|
|||
flags |= SDL_WINDOW_BORDERLESS;
|
||||
else
|
||||
flags |= SDL_WINDOW_RESIZABLE;
|
||||
|
||||
#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
|
||||
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
|
||||
#endif
|
||||
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) {
|
||||
|
|
|
@ -175,6 +175,10 @@ typedef enum {
|
|||
SECTION_ID_FRAME_SIDE_DATA,
|
||||
SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST,
|
||||
SECTION_ID_FRAME_SIDE_DATA_TIMECODE,
|
||||
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST,
|
||||
SECTION_ID_FRAME_SIDE_DATA_COMPONENT,
|
||||
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST,
|
||||
SECTION_ID_FRAME_SIDE_DATA_PIECE,
|
||||
SECTION_ID_FRAME_LOG,
|
||||
SECTION_ID_FRAME_LOGS,
|
||||
SECTION_ID_LIBRARY_VERSION,
|
||||
|
@ -219,9 +223,13 @@ static struct section sections[] = {
|
|||
[SECTION_ID_FRAME] = { SECTION_ID_FRAME, "frame", 0, { SECTION_ID_FRAME_TAGS, SECTION_ID_FRAME_SIDE_DATA_LIST, SECTION_ID_FRAME_LOGS, -1 } },
|
||||
[SECTION_ID_FRAME_TAGS] = { SECTION_ID_FRAME_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "frame_tags" },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_LIST] ={ SECTION_ID_FRAME_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "frame_side_data_list" },
|
||||
[SECTION_ID_FRAME_SIDE_DATA] = { SECTION_ID_FRAME_SIDE_DATA, "side_data", 0, { SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA] = { SECTION_ID_FRAME_SIDE_DATA, "side_data", 0, { SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST] = { SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, "timecodes", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_TIMECODE, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_TIMECODE] = { SECTION_ID_FRAME_SIDE_DATA_TIMECODE, "timecode", 0, { -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_COMPONENT] = { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", 0, { SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] = { SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_PIECE] = { SECTION_ID_FRAME_SIDE_DATA_PIECE, "section", 0, { -1 } },
|
||||
[SECTION_ID_FRAME_LOGS] = { SECTION_ID_FRAME_LOGS, "logs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_LOG, -1 } },
|
||||
[SECTION_ID_FRAME_LOG] = { SECTION_ID_FRAME_LOG, "log", 0, { -1 }, },
|
||||
[SECTION_ID_LIBRARY_VERSIONS] = { SECTION_ID_LIBRARY_VERSIONS, "library_versions", SECTION_FLAG_IS_ARRAY, { SECTION_ID_LIBRARY_VERSION, -1 } },
|
||||
|
@ -580,7 +588,7 @@ static int writer_open(WriterContext **wctx, const Writer *writer, const char *a
|
|||
/* convert options to dictionary */
|
||||
if (args) {
|
||||
AVDictionary *opts = NULL;
|
||||
AVDictionaryEntry *opt = NULL;
|
||||
const AVDictionaryEntry *opt = NULL;
|
||||
|
||||
if ((ret = av_dict_parse_string(&opts, args, "=", ":", 0)) < 0) {
|
||||
av_log(*wctx, AV_LOG_ERROR, "Failed to parse option string '%s' provided to writer context\n", args);
|
||||
|
@ -1151,8 +1159,10 @@ static void compact_print_section_header(WriterContext *wctx)
|
|||
if (parent_section && compact->has_nested_elems[wctx->level-1] &&
|
||||
(section->flags & SECTION_FLAG_IS_ARRAY)) {
|
||||
compact->terminate_line[wctx->level-1] = 0;
|
||||
printf("\n");
|
||||
}
|
||||
if (parent_section && !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)) &&
|
||||
wctx->level && wctx->nb_item[wctx->level-1])
|
||||
printf("%c", compact->item_sep);
|
||||
if (compact->print_section &&
|
||||
!(section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)))
|
||||
printf("%s%c", section->name, compact->item_sep);
|
||||
|
@ -1807,6 +1817,16 @@ static void writer_register_all(void)
|
|||
writer_print_string(w, k, pbuf.str, 0); \
|
||||
} while (0)
|
||||
|
||||
#define print_list_fmt(k, f, n, ...) do { \
|
||||
av_bprint_clear(&pbuf); \
|
||||
for (int idx = 0; idx < n; idx++) { \
|
||||
if (idx > 0) \
|
||||
av_bprint_chars(&pbuf, ' ', 1); \
|
||||
av_bprintf(&pbuf, f, __VA_ARGS__); \
|
||||
} \
|
||||
writer_print_string(w, k, pbuf.str, 0); \
|
||||
} while (0)
|
||||
|
||||
#define print_int(k, v) writer_print_integer(w, k, v)
|
||||
#define print_q(k, v, s) writer_print_rational(w, k, v, s)
|
||||
#define print_str(k, v) writer_print_string(w, k, v, 0)
|
||||
|
@ -1836,7 +1856,7 @@ static void writer_register_all(void)
|
|||
|
||||
static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
|
||||
{
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
const AVDictionaryEntry *tag = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (!tags)
|
||||
|
@ -1852,6 +1872,153 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void print_dovi_metadata(WriterContext *w, const AVDOVIMetadata *dovi)
|
||||
{
|
||||
if (!dovi)
|
||||
return;
|
||||
|
||||
{
|
||||
const AVDOVIRpuDataHeader *hdr = av_dovi_get_header(dovi);
|
||||
const AVDOVIDataMapping *mapping = av_dovi_get_mapping(dovi);
|
||||
const AVDOVIColorMetadata *color = av_dovi_get_color(dovi);
|
||||
AVBPrint pbuf;
|
||||
|
||||
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
|
||||
// header
|
||||
print_int("rpu_type", hdr->rpu_type);
|
||||
print_int("rpu_format", hdr->rpu_format);
|
||||
print_int("vdr_rpu_profile", hdr->vdr_rpu_profile);
|
||||
print_int("vdr_rpu_level", hdr->vdr_rpu_level);
|
||||
print_int("chroma_resampling_explicit_filter_flag",
|
||||
hdr->chroma_resampling_explicit_filter_flag);
|
||||
print_int("coef_data_type", hdr->coef_data_type);
|
||||
print_int("coef_log2_denom", hdr->coef_log2_denom);
|
||||
print_int("vdr_rpu_normalized_idc", hdr->vdr_rpu_normalized_idc);
|
||||
print_int("bl_video_full_range_flag", hdr->bl_video_full_range_flag);
|
||||
print_int("bl_bit_depth", hdr->bl_bit_depth);
|
||||
print_int("el_bit_depth", hdr->el_bit_depth);
|
||||
print_int("vdr_bit_depth", hdr->vdr_bit_depth);
|
||||
print_int("spatial_resampling_filter_flag",
|
||||
hdr->spatial_resampling_filter_flag);
|
||||
print_int("el_spatial_resampling_filter_flag",
|
||||
hdr->el_spatial_resampling_filter_flag);
|
||||
print_int("disable_residual_flag", hdr->disable_residual_flag);
|
||||
|
||||
// data mapping values
|
||||
print_int("vdr_rpu_id", mapping->vdr_rpu_id);
|
||||
print_int("mapping_color_space", mapping->mapping_color_space);
|
||||
print_int("mapping_chroma_format_idc",
|
||||
mapping->mapping_chroma_format_idc);
|
||||
|
||||
print_int("nlq_method_idc", mapping->nlq_method_idc);
|
||||
switch (mapping->nlq_method_idc) {
|
||||
case AV_DOVI_NLQ_NONE:
|
||||
print_str("nlq_method_idc_name", "none");
|
||||
break;
|
||||
case AV_DOVI_NLQ_LINEAR_DZ:
|
||||
print_str("nlq_method_idc_name", "linear_dz");
|
||||
break;
|
||||
default:
|
||||
print_str("nlq_method_idc_name", "unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
print_int("num_x_partitions", mapping->num_x_partitions);
|
||||
print_int("num_y_partitions", mapping->num_y_partitions);
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST);
|
||||
|
||||
for (int c = 0; c < 3; c++) {
|
||||
const AVDOVIReshapingCurve *curve = &mapping->curves[c];
|
||||
writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
|
||||
|
||||
print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, curve->pivots[idx]);
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST);
|
||||
for (int i = 0; i < curve->num_pivots - 1; i++) {
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_FRAME_SIDE_DATA_PIECE);
|
||||
print_int("mapping_idc", curve->mapping_idc[i]);
|
||||
switch (curve->mapping_idc[i]) {
|
||||
case AV_DOVI_MAPPING_POLYNOMIAL:
|
||||
print_str("mapping_idc_name", "polynomial");
|
||||
print_int("poly_order", curve->poly_order[i]);
|
||||
print_list_fmt("poly_coef", "%"PRIi64,
|
||||
curve->poly_order[i] + 1,
|
||||
curve->poly_coef[i][idx]);
|
||||
break;
|
||||
case AV_DOVI_MAPPING_MMR:
|
||||
print_str("mapping_idc_name", "mmr");
|
||||
print_int("mmr_order", curve->mmr_order[i]);
|
||||
print_int("mmr_constant", curve->mmr_constant[i]);
|
||||
print_list_fmt("mmr_coef", "%"PRIi64,
|
||||
curve->mmr_order[i] * 7,
|
||||
curve->mmr_coef[i][0][idx]);
|
||||
break;
|
||||
default:
|
||||
print_str("mapping_idc_name", "unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
// SECTION_ID_FRAME_SIDE_DATA_PIECE
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
// SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
|
||||
writer_print_section_footer(w);
|
||||
|
||||
if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
|
||||
const AVDOVINLQParams *nlq = &mapping->nlq[c];
|
||||
print_int("nlq_offset", nlq->nlq_offset);
|
||||
print_int("vdr_in_max", nlq->vdr_in_max);
|
||||
|
||||
switch (mapping->nlq_method_idc) {
|
||||
case AV_DOVI_NLQ_LINEAR_DZ:
|
||||
print_int("linear_deadzone_slope", nlq->linear_deadzone_slope);
|
||||
print_int("linear_deadzone_threshold", nlq->linear_deadzone_threshold);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// SECTION_ID_FRAME_SIDE_DATA_COMPONENT
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
||||
// SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
|
||||
writer_print_section_footer(w);
|
||||
|
||||
// color metadata
|
||||
print_int("dm_metadata_id", color->dm_metadata_id);
|
||||
print_int("scene_refresh_flag", color->scene_refresh_flag);
|
||||
print_list_fmt("ycc_to_rgb_matrix", "%d/%d",
|
||||
FF_ARRAY_ELEMS(color->ycc_to_rgb_matrix),
|
||||
color->ycc_to_rgb_matrix[idx].num,
|
||||
color->ycc_to_rgb_matrix[idx].den);
|
||||
print_list_fmt("ycc_to_rgb_offset", "%d/%d",
|
||||
FF_ARRAY_ELEMS(color->ycc_to_rgb_offset),
|
||||
color->ycc_to_rgb_offset[idx].num,
|
||||
color->ycc_to_rgb_offset[idx].den);
|
||||
print_list_fmt("rgb_to_lms_matrix", "%d/%d",
|
||||
FF_ARRAY_ELEMS(color->rgb_to_lms_matrix),
|
||||
color->rgb_to_lms_matrix[idx].num,
|
||||
color->rgb_to_lms_matrix[idx].den);
|
||||
print_int("signal_eotf", color->signal_eotf);
|
||||
print_int("signal_eotf_param0", color->signal_eotf_param0);
|
||||
print_int("signal_eotf_param1", color->signal_eotf_param1);
|
||||
print_int("signal_eotf_param2", color->signal_eotf_param2);
|
||||
print_int("signal_bit_depth", color->signal_bit_depth);
|
||||
print_int("signal_color_space", color->signal_color_space);
|
||||
print_int("signal_chroma_format", color->signal_chroma_format);
|
||||
print_int("signal_full_range_flag", color->signal_full_range_flag);
|
||||
print_int("source_min_pq", color->source_min_pq);
|
||||
print_int("source_max_pq", color->source_max_pq);
|
||||
print_int("source_diagonal", color->source_diagonal);
|
||||
|
||||
av_bprint_finalize(&pbuf, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_dynamic_hdr10_plus(WriterContext *w, const AVDynamicHDRPlus *metadata)
|
||||
{
|
||||
if (!metadata)
|
||||
|
@ -2364,10 +2531,12 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
|||
print_int("max_content", metadata->MaxCLL);
|
||||
print_int("max_average", metadata->MaxFALL);
|
||||
} else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) {
|
||||
AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE);
|
||||
const AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE);
|
||||
if (tag)
|
||||
print_str(tag->key, tag->value);
|
||||
print_int("size", sd->size);
|
||||
} else if (sd->type == AV_FRAME_DATA_DOVI_METADATA) {
|
||||
print_dovi_metadata(w, (const AVDOVIMetadata *)sd->data);
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
|
@ -2769,6 +2938,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
|||
par->extradata_size);
|
||||
|
||||
if (par->extradata_size > 0) {
|
||||
print_int("extradata_size", par->extradata_size);
|
||||
writer_print_data_hash(w, "extradata_hash", par->extradata,
|
||||
par->extradata_size);
|
||||
}
|
||||
|
@ -2957,7 +3127,7 @@ static int open_input_file(InputFile *ifile, const char *filename,
|
|||
{
|
||||
int err, i;
|
||||
AVFormatContext *fmt_ctx = NULL;
|
||||
AVDictionaryEntry *t = NULL;
|
||||
const AVDictionaryEntry *t = NULL;
|
||||
int scan_all_pmts_set = 0;
|
||||
|
||||
fmt_ctx = avformat_alloc_context();
|
||||
|
|
|
@ -60,7 +60,7 @@ OBJS = ac3_parser.o \
|
|||
# subsystems
|
||||
OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o
|
||||
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o
|
||||
OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio_sample_rates.o
|
||||
OBJS-$(CONFIG_AMF) += amfenc.o
|
||||
OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o
|
||||
OBJS-$(CONFIG_ATSC_A53) += atsc_a53.o
|
||||
|
@ -77,6 +77,7 @@ OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o
|
|||
OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
|
||||
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
|
||||
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
|
||||
OBJS-$(CONFIG_DOVI_RPU) += dovi_rpu.o
|
||||
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
|
||||
OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o
|
||||
OBJS-$(CONFIG_FAANDCT) += faandct.o
|
||||
|
@ -117,20 +118,23 @@ 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
|
||||
OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodec_common.o
|
||||
OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodec_common.o \
|
||||
mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
|
||||
mpegaudiodsp_data.o \
|
||||
mpegaudiodsp_fixed.o \
|
||||
mpegaudiodsp_float.o
|
||||
OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiodata.o
|
||||
OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o
|
||||
OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \
|
||||
mpegvideo_motion.o mpegutils.o \
|
||||
mpegvideodata.o mpegpicture.o
|
||||
mpegvideo_motion.o \
|
||||
mpegvideodata.o mpegpicture.o \
|
||||
to_upper4.o
|
||||
OBJS-$(CONFIG_MPEGVIDEODEC) += mpegvideo_dec.o mpegutils.o
|
||||
OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
|
||||
motion_est.o ratecontrol.o \
|
||||
mpegvideoencdsp.o
|
||||
OBJS-$(CONFIG_MSS34DSP) += mss34dsp.o
|
||||
OBJS-$(CONFIG_NVENC) += nvenc.o
|
||||
OBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
|
||||
OBJS-$(CONFIG_QPELDSP) += qpeldsp.o
|
||||
OBJS-$(CONFIG_QSV) += qsv.o
|
||||
|
@ -139,7 +143,6 @@ OBJS-$(CONFIG_QSVENC) += qsvenc.o
|
|||
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
|
||||
OBJS-$(CONFIG_RDFT) += rdft.o
|
||||
OBJS-$(CONFIG_RV34DSP) += rv34dsp.o
|
||||
OBJS-$(CONFIG_SHARED) += log2_tab.o reverse.o
|
||||
OBJS-$(CONFIG_SINEWIN) += sinewin.o
|
||||
OBJS-$(CONFIG_SNAPPY) += snappy.o
|
||||
OBJS-$(CONFIG_STARTCODE) += startcode.o
|
||||
|
@ -161,10 +164,10 @@ 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 aactab.o aacsbr.o aacps_common.o aacps_float.o \
|
||||
mpeg4audio.o kbdwin.o \
|
||||
kbdwin.o \
|
||||
sbrdsp.o aacpsdsp_float.o cbrt_data.o
|
||||
OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_common.o aacps_fixed.o \
|
||||
mpeg4audio.o kbdwin.o \
|
||||
kbdwin.o \
|
||||
sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
|
||||
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
|
||||
aacpsy.o aactab.o \
|
||||
|
@ -172,11 +175,14 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \
|
|||
aacenc_tns.o \
|
||||
aacenc_ltp.o \
|
||||
aacenc_pred.o \
|
||||
psymodel.o mpeg4audio.o kbdwin.o
|
||||
psymodel.o kbdwin.o \
|
||||
mpeg4audio_sample_rates.o
|
||||
OBJS-$(CONFIG_AAC_MF_ENCODER) += mfenc.o mf_utils.o
|
||||
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o \
|
||||
kbdwin.o ac3tab.o ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o \
|
||||
kbdwin.o ac3tab.o ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
|
||||
ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o kbdwin.o
|
||||
|
@ -188,7 +194,7 @@ OBJS-$(CONFIG_ALAC_DECODER) += alac.o alac_data.o alacdsp.o
|
|||
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o alac_data.o
|
||||
OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o
|
||||
OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o
|
||||
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o
|
||||
OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \
|
||||
celp_math.o acelp_filters.o \
|
||||
acelp_vectors.o \
|
||||
|
@ -243,7 +249,8 @@ OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o
|
|||
OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER) += binkaudio.o
|
||||
OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER) += binkaudio.o
|
||||
OBJS-$(CONFIG_BINTEXT_DECODER) += bintext.o cga_data.o
|
||||
OBJS-$(CONFIG_BITPACKED_DECODER) += bitpacked.o
|
||||
OBJS-$(CONFIG_BITPACKED_DECODER) += bitpacked_dec.o
|
||||
OBJS-$(CONFIG_BITPACKED_ENCODER) += bitpacked_enc.o
|
||||
OBJS-$(CONFIG_BMP_DECODER) += bmp.o msrledec.o
|
||||
OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o
|
||||
OBJS-$(CONFIG_BMV_AUDIO_DECODER) += bmvaudio.o
|
||||
|
@ -273,7 +280,8 @@ OBJS-$(CONFIG_CSCD_DECODER) += cscd.o
|
|||
OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o
|
||||
OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadata.o dcahuff.o \
|
||||
dca_core.o dca_exss.o dca_xll.o dca_lbr.o \
|
||||
dcadsp.o dcadct.o synth_filter.o
|
||||
dcadsp.o dcadct.o dca_sample_rate_tab.o \
|
||||
synth_filter.o
|
||||
OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dcadata.o dcahuff.o \
|
||||
dcaadpcm.o
|
||||
OBJS-$(CONFIG_DDS_DECODER) += dds.o
|
||||
|
@ -374,7 +382,7 @@ OBJS-$(CONFIG_H264_CUVID_DECODER) += cuviddec.o
|
|||
OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_H264_MF_ENCODER) += mfenc.o mf_utils.o
|
||||
OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o
|
||||
OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o
|
||||
OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o nvenc.o
|
||||
OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o
|
||||
OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec.o
|
||||
OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o
|
||||
|
@ -389,12 +397,13 @@ OBJS-$(CONFIG_HCA_DECODER) += hcadec.o
|
|||
OBJS-$(CONFIG_HCOM_DECODER) += hcom.o
|
||||
OBJS-$(CONFIG_HEVC_DECODER) += hevcdec.o hevc_mvs.o \
|
||||
hevc_cabac.o hevc_refs.o hevcpred.o \
|
||||
hevcdsp.o hevc_filter.o hevc_data.o
|
||||
hevcdsp.o hevc_filter.o hevc_data.o \
|
||||
h274.o
|
||||
OBJS-$(CONFIG_HEVC_AMF_ENCODER) += amfenc_hevc.o
|
||||
OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuviddec.o
|
||||
OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o
|
||||
OBJS-$(CONFIG_HEVC_MF_ENCODER) += mfenc.o mf_utils.o
|
||||
OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o
|
||||
OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o nvenc.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_DECODER) += qsvdec.o
|
||||
OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o \
|
||||
hevc_data.o
|
||||
|
@ -402,6 +411,7 @@ OBJS-$(CONFIG_HEVC_RKMPP_DECODER) += rkmppdec.o
|
|||
OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o h265_profile_level.o
|
||||
OBJS-$(CONFIG_HEVC_V4L2M2M_DECODER) += v4l2_m2m_dec.o
|
||||
OBJS-$(CONFIG_HEVC_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
|
||||
OBJS-$(CONFIG_HEVC_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
|
||||
OBJS-$(CONFIG_HNM4_VIDEO_DECODER) += hnm4video.o
|
||||
OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
|
||||
canopus.o
|
||||
|
@ -467,17 +477,19 @@ OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec_fixed.o
|
|||
OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o
|
||||
OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec_fixed.o
|
||||
OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc_float.o mpegaudio.o \
|
||||
mpegaudiodata.o mpegaudiodsp_data.o
|
||||
mpegaudiodata.o mpegaudiodsp_data.o \
|
||||
mpegaudiotabs.o
|
||||
OBJS-$(CONFIG_MP2FIXED_ENCODER) += mpegaudioenc_fixed.o mpegaudio.o \
|
||||
mpegaudiodata.o mpegaudiodsp_data.o
|
||||
mpegaudiodata.o mpegaudiodsp_data.o \
|
||||
mpegaudiotabs.o
|
||||
OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o
|
||||
OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o
|
||||
OBJS-$(CONFIG_MP3_MF_ENCODER) += mfenc.o mf_utils.o
|
||||
OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec_fixed.o
|
||||
OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o
|
||||
OBJS-$(CONFIG_MP3FLOAT_DECODER) += mpegaudiodec_float.o
|
||||
OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec_fixed.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec_fixed.o
|
||||
OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o
|
||||
OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o
|
||||
OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
|
||||
|
@ -563,6 +575,7 @@ OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o proresdsp.o proresdata.o
|
|||
OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o
|
||||
OBJS-$(CONFIG_PRORES_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
|
||||
OBJS-$(CONFIG_PROSUMER_DECODER) += prosumer.o
|
||||
OBJS-$(CONFIG_PSD_DECODER) += psd.o
|
||||
OBJS-$(CONFIG_PTX_DECODER) += ptx.o
|
||||
|
@ -875,6 +888,7 @@ OBJS-$(CONFIG_ADPCM_G726LE_DECODER) += g726.o
|
|||
OBJS-$(CONFIG_ADPCM_G726LE_ENCODER) += g726.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_ACORN_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_AMV_ENCODER) += adpcmenc.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_ALP_DECODER) += adpcm.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_ALP_ENCODER) += adpcmenc.o adpcm_data.o
|
||||
OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o
|
||||
|
@ -975,25 +989,30 @@ OBJS-$(CONFIG_VP9_DXVA2_HWACCEL) += dxva2_vp9.o
|
|||
OBJS-$(CONFIG_VP9_NVDEC_HWACCEL) += nvdec_vp9.o
|
||||
OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o
|
||||
OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o
|
||||
OBJS-$(CONFIG_VP9_VIDEOTOOLBOX_HWACCEL) += videotoolbox_vp9.o
|
||||
OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o
|
||||
|
||||
# libavformat dependencies
|
||||
OBJS-$(CONFIG_ISO_MEDIA) += mpeg4audio.o mpegaudiodata.o
|
||||
# Objects duplicated from other libraries for shared builds
|
||||
SHLIBOBJS += log2_tab.o reverse.o
|
||||
|
||||
OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddata.o
|
||||
# General libavformat dependencies
|
||||
OBJS-$(CONFIG_FITS_DEMUXER) += fits.o
|
||||
OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += ac3tab.o
|
||||
OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_MXF_MUXER) += dnxhddata.o
|
||||
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
|
||||
OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o
|
||||
OBJS-$(CONFIG_SPDIF_MUXER) += dca.o
|
||||
OBJS-$(CONFIG_TAK_DEMUXER) += tak.o
|
||||
OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o
|
||||
|
||||
# libavformat dependencies for static builds
|
||||
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_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o
|
||||
STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o
|
||||
STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o
|
||||
STLIBOBJS-$(CONFIG_MP3_MUXER) += mpegaudiotabs.o
|
||||
STLIBOBJS-$(CONFIG_NUT_MUXER) += mpegaudiotabs.o
|
||||
STLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o
|
||||
STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o \
|
||||
mpeg4audio_sample_rates.o
|
||||
STLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o
|
||||
|
||||
# libavfilter dependencies
|
||||
OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
|
||||
|
@ -1076,9 +1095,9 @@ OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o
|
|||
|
||||
# parsers
|
||||
OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
|
||||
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
|
||||
mpeg4audio.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o
|
||||
OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \
|
||||
ac3_channel_layout_tab.o
|
||||
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
|
||||
OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o
|
||||
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o
|
||||
|
@ -1088,7 +1107,8 @@ OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
|
|||
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
|
||||
OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
|
||||
OBJS-$(CONFIG_CRI_PARSER) += cri_parser.o
|
||||
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o
|
||||
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o \
|
||||
dca_sample_rate_tab.o
|
||||
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
|
||||
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o dnxhddata.o
|
||||
OBJS-$(CONFIG_DOLBY_E_PARSER) += dolby_e_parser.o dolby_e_parse.o
|
||||
|
@ -1135,7 +1155,7 @@ OBJS-$(CONFIG_XBM_PARSER) += xbm_parser.o
|
|||
OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o
|
||||
|
||||
# bitstream filters
|
||||
OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o
|
||||
OBJS-$(CONFIG_AV1_METADATA_BSF) += av1_metadata_bsf.o
|
||||
OBJS-$(CONFIG_AV1_FRAME_MERGE_BSF) += av1_frame_merge_bsf.o
|
||||
OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF) += av1_frame_split_bsf.o
|
||||
|
@ -1158,7 +1178,7 @@ OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o
|
|||
OBJS-$(CONFIG_MPEG4_UNPACK_BFRAMES_BSF) += mpeg4_unpack_bframes_bsf.o
|
||||
OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o
|
||||
OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \
|
||||
mpegaudiodata.o
|
||||
mpegaudiotabs.o
|
||||
OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o
|
||||
OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o
|
||||
OBJS-$(CONFIG_NULL_BSF) += null_bsf.o
|
||||
|
|
|
@ -414,11 +414,10 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
|
|||
start = 0;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
int nz = 0;
|
||||
float uplim = 0.0f, energy = 0.0f;
|
||||
float uplim = 0.0f;
|
||||
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
|
||||
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
|
||||
uplim += band->threshold;
|
||||
energy += band->energy;
|
||||
if (band->energy <= band->threshold || band->threshold == 0.0f) {
|
||||
sce->zeroes[(w+w2)*16+g] = 1;
|
||||
continue;
|
||||
|
|
|
@ -998,7 +998,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
|||
|
||||
/* Samplerate */
|
||||
for (i = 0; i < 16; i++)
|
||||
if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
|
||||
if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i])
|
||||
break;
|
||||
s->samplerate_index = i;
|
||||
ERROR_IF(s->samplerate_index == 16 ||
|
||||
|
@ -1143,7 +1143,7 @@ const AVCodec ff_aac_encoder = {
|
|||
.encode2 = aac_encode_frame,
|
||||
.close = aac_encode_end,
|
||||
.defaults = aac_encode_defaults,
|
||||
.supported_samplerates = mpeg4audio_sample_rates,
|
||||
.supported_samplerates = ff_mpeg4audio_sample_rates,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
|
||||
|
|
|
@ -81,13 +81,6 @@ static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS] = {
|
|||
{ 2, 0, 1, 6, 7, 4, 5, 3 },
|
||||
};
|
||||
|
||||
/* duplicated from avpriv_mpeg4audio_sample_rates to avoid shared build
|
||||
* failures */
|
||||
static const int mpeg4audio_sample_rates[16] = {
|
||||
96000, 88200, 64000, 48000, 44100, 32000,
|
||||
24000, 22050, 16000, 12000, 11025, 8000, 7350
|
||||
};
|
||||
|
||||
/** bits needed to code codebook run value for long windows */
|
||||
static const uint8_t run_value_bits_long[64] = {
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
|
||||
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
|
||||
|
@ -58,6 +59,7 @@ function fft4_neon
|
|||
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]
|
||||
|
@ -108,6 +110,7 @@ function fft8_neon
|
|||
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
|
||||
|
@ -337,6 +340,7 @@ endfunc
|
|||
|
||||
.macro def_fft n, n2, n4
|
||||
function fft\n\()_neon, align=6
|
||||
AARCH64_VALID_JUMP_TARGET
|
||||
sub sp, sp, #16
|
||||
stp x28, x30, [sp]
|
||||
add x28, x0, #\n4*2*8
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
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]
|
||||
sxtw x2, w2
|
||||
movi v30.8H, #0
|
||||
|
@ -79,6 +80,7 @@ endfunc
|
|||
|
||||
function ff_h264_idct_dc_add_neon, export=1
|
||||
.L_ff_h264_idct_dc_add_neon:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
sxtw x2, w2
|
||||
mov w3, #0
|
||||
ld1r {v2.8H}, [x1]
|
||||
|
@ -266,6 +268,7 @@ endfunc
|
|||
|
||||
function ff_h264_idct8_add_neon, export=1
|
||||
.L_ff_h264_idct8_add_neon:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
movi v19.8H, #0
|
||||
sxtw x2, w2
|
||||
ld1 {v24.8H, v25.8H}, [x1]
|
||||
|
@ -330,6 +333,7 @@ endfunc
|
|||
|
||||
function ff_h264_idct8_dc_add_neon, export=1
|
||||
.L_ff_h264_idct8_dc_add_neon:
|
||||
AARCH64_VALID_CALL_TARGET
|
||||
mov w3, #0
|
||||
sxtw x2, w2
|
||||
ld1r {v31.8H}, [x1]
|
||||
|
|
|
@ -75,7 +75,11 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
|
|||
c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon;
|
||||
c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
|
||||
c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
|
||||
c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon;
|
||||
// This function is disabled, as it doesn't handle widths that aren't
|
||||
// an even multiple of 8 correctly. fate-hevc doesn't exercise that
|
||||
// for the current size, but if enabled for bigger sizes, the cases
|
||||
// of non-multiple of 8 seem to arise.
|
||||
// c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon;
|
||||
}
|
||||
if (bit_depth == 10) {
|
||||
c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon;
|
||||
|
|
|
@ -35,19 +35,16 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
|
|||
stp xzr, xzr, [sp, #32]
|
||||
stp xzr, xzr, [sp, #48]
|
||||
mov w8, #4
|
||||
0:
|
||||
ldrsh x9, [x4, x8, lsl #1] // x9 = sao_offset_val[k+1]
|
||||
0: ldrsh x9, [x4, x8, lsl #1] // sao_offset_val[k+1]
|
||||
subs w8, w8, #1
|
||||
add w10, w8, w5 // x10 = k + sao_left_class
|
||||
add w10, w8, w5 // k + sao_left_class
|
||||
and w10, w10, #0x1F
|
||||
strh w9, [sp, x10, lsl #1]
|
||||
bne 0b
|
||||
ld1 {v16.16b-v19.16b}, [sp], #64
|
||||
movi v20.8h, #1
|
||||
1: // beginning of line
|
||||
mov w8, w6
|
||||
2:
|
||||
// Simple layout for accessing 16bit values
|
||||
1: mov w8, w6 // beginning of line
|
||||
2: // Simple layout for accessing 16bit values
|
||||
// with 8bit LUT.
|
||||
//
|
||||
// 00 01 02 03 04 05 06 07
|
||||
|
@ -55,31 +52,19 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
|
|||
// |xDE#xAD|xCA#xFE|xBE#xEF|xFE#xED|....
|
||||
// +----------------------------------->
|
||||
// i-0 i-1 i-2 i-3
|
||||
// dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
|
||||
ld1 {v2.8b}, [x1]
|
||||
// load src[x]
|
||||
uxtl v0.8h, v2.8b
|
||||
// >> shift
|
||||
ushr v2.8h, v0.8h, #3 // BIT_DEPTH - 3
|
||||
// x2 (access lower short)
|
||||
ld1 {v2.8b}, [x1] // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
|
||||
uxtl v0.8h, v2.8b // load src[x]
|
||||
ushr v2.8h, v0.8h, #3 // >> BIT_DEPTH - 3
|
||||
shl v1.8h, v2.8h, #1 // low (x2, accessing short)
|
||||
// +1 access upper short
|
||||
add v3.8h, v1.8h, v20.8h
|
||||
// shift insert index to upper byte
|
||||
sli v1.8h, v3.8h, #8
|
||||
// table
|
||||
tbx v2.16b, {v16.16b-v19.16b}, v1.16b
|
||||
// src[x] + table
|
||||
add v1.8h, v0.8h, v2.8h
|
||||
// clip + narrow
|
||||
sqxtun v4.8b, v1.8h
|
||||
// store
|
||||
st1 {v4.8b}, [x0]
|
||||
// done 8 pixels
|
||||
subs w8, w8, #8
|
||||
add v3.8h, v1.8h, v20.8h // +1 access upper short
|
||||
sli v1.8h, v3.8h, #8 // shift insert index to upper byte
|
||||
tbx v2.16b, {v16.16b-v19.16b}, v1.16b // table
|
||||
add v1.8h, v0.8h, v2.8h // src[x] + table
|
||||
sqxtun v4.8b, v1.8h // clip + narrow
|
||||
st1 {v4.8b}, [x0] // store
|
||||
subs w8, w8, #8 // done 8 pixels
|
||||
bne 2b
|
||||
// finished line
|
||||
subs w7, w7, #1
|
||||
subs w7, w7, #1 // finished line, prep. new
|
||||
add x0, x0, x2 // dst += stride_dst
|
||||
add x1, x1, x3 // src += stride_src
|
||||
bne 1b
|
||||
|
|
|
@ -58,7 +58,7 @@ endconst
|
|||
.endm
|
||||
|
||||
.macro idct_end
|
||||
br x10
|
||||
ret x10
|
||||
.endm
|
||||
|
||||
.macro smull1 a, b, c
|
||||
|
|
|
@ -1040,7 +1040,7 @@ function \txfm\()16_1d_4x16_pass1_neon
|
|||
.irp i, 16, 20, 24, 28, 17, 21, 25, 29, 18, 22, 26, 30, 19, 23, 27, 31
|
||||
store \i, x0, #16
|
||||
.endr
|
||||
br x14
|
||||
ret x14
|
||||
1:
|
||||
// Special case: For the last input column (x1 == 12),
|
||||
// which would be stored as the last row in the temp buffer,
|
||||
|
@ -1068,7 +1068,7 @@ function \txfm\()16_1d_4x16_pass1_neon
|
|||
mov v29.16b, v17.16b
|
||||
mov v30.16b, v18.16b
|
||||
mov v31.16b, v19.16b
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
// Read a vertical 4x16 slice out of a 16x16 matrix, do a transform on it,
|
||||
|
@ -1098,7 +1098,7 @@ function \txfm\()16_1d_4x16_pass2_neon
|
|||
load_add_store v16.4s, v17.4s, v18.4s, v19.4s, v20.4s, v21.4s, v22.4s, v23.4s
|
||||
load_add_store v24.4s, v25.4s, v26.4s, v27.4s, v28.4s, v29.4s, v30.4s, v31.4s
|
||||
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ function vp9_\txfm1\()_\txfm2\()_16x16_add_16_neon
|
|||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
.endif
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
|
||||
function ff_vp9_\txfm1\()_\txfm2\()_16x16_add_10_neon, export=1
|
||||
|
@ -1264,7 +1264,7 @@ function idct16_1d_4x16_pass1_quarter_neon
|
|||
st1 {v23.4s}, [x0], #16
|
||||
st1 {v27.4s}, [x0], #16
|
||||
st1 {v31.4s}, [x0], #16
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
function idct16_1d_4x16_pass2_quarter_neon
|
||||
|
@ -1286,7 +1286,7 @@ function idct16_1d_4x16_pass2_quarter_neon
|
|||
load_add_store v16.4s, v17.4s, v18.4s, v19.4s, v20.4s, v21.4s, v22.4s, v23.4s
|
||||
load_add_store v24.4s, v25.4s, v26.4s, v27.4s, v28.4s, v29.4s, v30.4s, v31.4s
|
||||
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
function idct16_1d_4x16_pass1_half_neon
|
||||
|
@ -1313,7 +1313,7 @@ function idct16_1d_4x16_pass1_half_neon
|
|||
.irp i, 16, 20, 24, 28, 17, 21, 25, 29, 18, 22, 26, 30, 19, 23, 27, 31
|
||||
store \i, x0, #16
|
||||
.endr
|
||||
br x14
|
||||
ret x14
|
||||
1:
|
||||
// Special case: For the second input column (r1 == 4),
|
||||
// which would be stored as the second row in the temp buffer,
|
||||
|
@ -1341,7 +1341,7 @@ function idct16_1d_4x16_pass1_half_neon
|
|||
mov v21.16b, v17.16b
|
||||
mov v22.16b, v18.16b
|
||||
mov v23.16b, v19.16b
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
function idct16_1d_4x16_pass2_half_neon
|
||||
|
@ -1364,7 +1364,7 @@ function idct16_1d_4x16_pass2_half_neon
|
|||
load_add_store v16.4s, v17.4s, v18.4s, v19.4s, v20.4s, v21.4s, v22.4s, v23.4s
|
||||
load_add_store v24.4s, v25.4s, v26.4s, v27.4s, v28.4s, v29.4s, v30.4s, v31.4s
|
||||
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
.macro idct16_partial size
|
||||
|
@ -1390,7 +1390,7 @@ function idct16x16_\size\()_add_16_neon
|
|||
|
||||
add sp, sp, #1024
|
||||
ldp d8, d9, [sp], 0x10
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -1729,7 +1729,7 @@ function idct32_1d_4x32_pass1\suffix\()_neon
|
|||
store_rev v29.4s, v25.4s, v21.4s, v17.4s, v29.16b, v25.16b
|
||||
store_rev v28.4s, v24.4s, v20.4s, v16.4s, v28.16b, v24.16b
|
||||
.purgem store_rev
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
// This is mostly the same as 4x32_pass1, but without the transpose,
|
||||
|
@ -1849,7 +1849,7 @@ function idct32_1d_4x32_pass2\suffix\()_neon
|
|||
load_acc_store v24.4s, v25.4s, v26.4s, v27.4s, 1
|
||||
load_acc_store v28.4s, v29.4s, v30.4s, v31.4s, 1
|
||||
.purgem load_acc_store
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ function vp9_idct_idct_32x32_add_16_neon
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d8, d9, [sp], 0x10
|
||||
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
|
||||
function ff_vp9_idct_idct_32x32_add_10_neon, export=1
|
||||
|
@ -2009,7 +2009,7 @@ function idct32x32_\size\()_add_16_neon
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d8, d9, [sp], 0x10
|
||||
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
|
|
@ -787,7 +787,7 @@ function \txfm\()16_1d_8x16_pass1_neon
|
|||
.irp i, 16, 24, 17, 25, 18, 26, 19, 27, 20, 28, 21, 29, 22, 30, 23, 31
|
||||
store \i, x0, #16
|
||||
.endr
|
||||
br x14
|
||||
ret x14
|
||||
1:
|
||||
// Special case: For the last input column (x1 == 8),
|
||||
// which would be stored as the last row in the temp buffer,
|
||||
|
@ -806,7 +806,7 @@ function \txfm\()16_1d_8x16_pass1_neon
|
|||
mov v29.16b, v21.16b
|
||||
mov v30.16b, v22.16b
|
||||
mov v31.16b, v23.16b
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
// Read a vertical 8x16 slice out of a 16x16 matrix, do a transform on it,
|
||||
|
@ -834,7 +834,7 @@ function \txfm\()16_1d_8x16_pass2_neon
|
|||
load_add_store v16.8h, v17.8h, v18.8h, v19.8h, v20.8h, v21.8h, v22.8h, v23.8h, v16.8b, v17.8b
|
||||
load_add_store v24.8h, v25.8h, v26.8h, v27.8h, v28.8h, v29.8h, v30.8h, v31.8h, v16.8b, v17.8b
|
||||
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -925,7 +925,7 @@ function ff_vp9_\txfm1\()_\txfm2\()_16x16_add_neon, export=1
|
|||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
.endif
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -960,7 +960,7 @@ function idct16_1d_8x16_pass1_quarter_neon
|
|||
.irp i, 24, 25, 26, 27
|
||||
store \i, x0, x9
|
||||
.endr
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
function idct16_1d_8x16_pass2_quarter_neon
|
||||
|
@ -978,7 +978,7 @@ function idct16_1d_8x16_pass2_quarter_neon
|
|||
load_add_store v16.8h, v17.8h, v18.8h, v19.8h, v20.8h, v21.8h, v22.8h, v23.8h, v16.8b, v17.8b
|
||||
load_add_store v24.8h, v25.8h, v26.8h, v27.8h, v28.8h, v29.8h, v30.8h, v31.8h, v16.8b, v17.8b
|
||||
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
function idct16_1d_8x16_pass1_half_neon
|
||||
|
@ -1003,7 +1003,7 @@ function idct16_1d_8x16_pass1_half_neon
|
|||
.irp i, 24, 25, 26, 27, 28, 29, 30, 31
|
||||
store \i, x0, x9
|
||||
.endr
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
function idct16_1d_8x16_pass2_half_neon
|
||||
|
@ -1021,7 +1021,7 @@ function idct16_1d_8x16_pass2_half_neon
|
|||
load_add_store v16.8h, v17.8h, v18.8h, v19.8h, v20.8h, v21.8h, v22.8h, v23.8h, v16.8b, v17.8b
|
||||
load_add_store v24.8h, v25.8h, v26.8h, v27.8h, v28.8h, v29.8h, v30.8h, v31.8h, v16.8b, v17.8b
|
||||
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
.macro idct16_partial size
|
||||
|
@ -1038,7 +1038,7 @@ function idct16x16_\size\()_add_neon
|
|||
.endr
|
||||
|
||||
add sp, sp, #512
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -1349,7 +1349,7 @@ function idct32_1d_8x32_pass1\suffix\()_neon
|
|||
store_rev v25.8h, v17.8h
|
||||
store_rev v24.8h, v16.8h
|
||||
.purgem store_rev
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
|
||||
// This is mostly the same as 8x32_pass1, but without the transpose,
|
||||
|
@ -1466,7 +1466,7 @@ function idct32_1d_8x32_pass2\suffix\()_neon
|
|||
load_acc_store v24.8h, v25.8h, v26.8h, v27.8h, 1
|
||||
load_acc_store v28.8h, v29.8h, v30.8h, v31.8h, 1
|
||||
.purgem load_acc_store
|
||||
br x14
|
||||
ret x14
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -1547,7 +1547,7 @@ function ff_vp9_idct_idct_32x32_add_neon, export=1
|
|||
ldp d8, d9, [sp], 0x10
|
||||
ldp d10, d11, [sp], 0x10
|
||||
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
|
||||
.macro idct32_partial size
|
||||
|
@ -1572,7 +1572,7 @@ function idct32x32_\size\()_add_neon
|
|||
ldp d8, d9, [sp], 0x10
|
||||
ldp d10, d11, [sp], 0x10
|
||||
|
||||
br x15
|
||||
ret x15
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
mov x12, v4.d[1]
|
||||
adds x11, x11, x12
|
||||
b.ne 1f
|
||||
br x10
|
||||
ret x10
|
||||
1:
|
||||
|
||||
.if \wd >= 8
|
||||
|
@ -193,7 +193,7 @@
|
|||
b.eq 6f
|
||||
.else
|
||||
b.ne 1f
|
||||
br x13
|
||||
ret x13
|
||||
1:
|
||||
.endif
|
||||
|
||||
|
@ -252,7 +252,7 @@
|
|||
b.ne 1f
|
||||
// If no pixels needed flat8in nor flat8out, jump to a
|
||||
// writeout of the inner 4 pixels
|
||||
br x14
|
||||
ret x14
|
||||
1:
|
||||
|
||||
mov x11, v7.d[0]
|
||||
|
@ -260,7 +260,7 @@
|
|||
adds x11, x11, x12
|
||||
b.ne 1f
|
||||
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
|
||||
br x15
|
||||
ret x15
|
||||
|
||||
1:
|
||||
// flat8out
|
||||
|
@ -434,7 +434,7 @@ function ff_\func\()_\bpp\()_neon, export=1
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
br x16
|
||||
ret x16
|
||||
.else
|
||||
b \func\()_16_neon
|
||||
.endif
|
||||
|
@ -474,7 +474,7 @@ function ff_\func\()_\suffix\()_\bpp\()_neon, export=1
|
|||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
.endif
|
||||
br x16
|
||||
ret x16
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -508,7 +508,7 @@ function ff_vp9_loop_filter_\dir\()_\wd1\()\wd2\()_16_\bpp\()_neon, export=1
|
|||
lsl w3, w14, #\bpp - 8
|
||||
lsl w4, w15, #\bpp - 8
|
||||
bl vp9_loop_filter_\dir\()_\wd2\()_8_16_neon
|
||||
br x16
|
||||
ret x16
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -541,7 +541,7 @@ function vp9_loop_filter_v_4_8_16_neon
|
|||
st1 {v25.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
bpp_frontends vp9_loop_filter_v_4_8
|
||||
|
@ -589,7 +589,7 @@ function vp9_loop_filter_h_4_8_16_neon
|
|||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, #4
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
bpp_frontends vp9_loop_filter_h_4_8
|
||||
|
@ -620,7 +620,7 @@ function vp9_loop_filter_v_8_8_16_neon
|
|||
sub x0, x0, x1, lsl #1
|
||||
sub x0, x0, x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
6:
|
||||
sub x9, x0, x1, lsl #1
|
||||
st1 {v22.8h}, [x9], x1
|
||||
|
@ -628,7 +628,7 @@ function vp9_loop_filter_v_8_8_16_neon
|
|||
st1 {v23.8h}, [x9], x1
|
||||
st1 {v25.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #1
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
bpp_frontends vp9_loop_filter_v_8_8
|
||||
|
@ -671,7 +671,7 @@ function vp9_loop_filter_h_8_8_16_neon
|
|||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, #8
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
6:
|
||||
// If we didn't need to do the flat8in part, we use the same writeback
|
||||
// as in loop_filter_h_4_8.
|
||||
|
@ -688,7 +688,7 @@ function vp9_loop_filter_h_8_8_16_neon
|
|||
st1 {v25.d}[1], [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, #4
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
bpp_frontends vp9_loop_filter_h_8_8
|
||||
|
@ -743,7 +743,7 @@ function vp9_loop_filter_v_16_8_16_neon
|
|||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
8:
|
||||
add x9, x9, x1, lsl #2
|
||||
// If we didn't do the flat8out part, the output is left in the
|
||||
|
@ -756,7 +756,7 @@ function vp9_loop_filter_v_16_8_16_neon
|
|||
st1 {v26.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #1
|
||||
sub x0, x0, x1
|
||||
br x10
|
||||
ret x10
|
||||
7:
|
||||
sub x9, x0, x1, lsl #1
|
||||
st1 {v22.8h}, [x9], x1
|
||||
|
@ -764,7 +764,7 @@ function vp9_loop_filter_v_16_8_16_neon
|
|||
st1 {v23.8h}, [x9], x1
|
||||
st1 {v25.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #1
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
bpp_frontends vp9_loop_filter_v_16_8, push=1
|
||||
|
@ -821,7 +821,7 @@ function vp9_loop_filter_h_16_8_16_neon
|
|||
st1 {v31.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
8:
|
||||
// The same writeback as in loop_filter_h_8_8
|
||||
sub x9, x0, #8
|
||||
|
@ -838,7 +838,7 @@ function vp9_loop_filter_h_16_8_16_neon
|
|||
st1 {v27.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, #8
|
||||
br x10
|
||||
ret x10
|
||||
7:
|
||||
// The same writeback as in loop_filter_h_4_8
|
||||
sub x9, x0, #4
|
||||
|
@ -854,7 +854,7 @@ function vp9_loop_filter_h_16_8_16_neon
|
|||
st1 {v25.d}[1], [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, #4
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
bpp_frontends vp9_loop_filter_h_16_8, push=1
|
||||
|
|
|
@ -399,7 +399,7 @@
|
|||
.endif
|
||||
// If no pixels needed flat8in nor flat8out, jump to a
|
||||
// writeout of the inner 4 pixels
|
||||
br x14
|
||||
ret x14
|
||||
1:
|
||||
|
||||
mov x5, v7.d[0]
|
||||
|
@ -411,7 +411,7 @@
|
|||
cbnz x5, 1f
|
||||
.endif
|
||||
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
|
||||
br x15
|
||||
ret x15
|
||||
|
||||
1:
|
||||
// flat8out
|
||||
|
@ -532,32 +532,32 @@ function vp9_loop_filter_4
|
|||
loop_filter 4, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
9:
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_4_16b_mix_44
|
||||
loop_filter 4, .16b, 44, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
9:
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_8
|
||||
loop_filter 8, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
6:
|
||||
br x13
|
||||
ret x13
|
||||
9:
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_8_16b_mix
|
||||
loop_filter 8, .16b, 88, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
6:
|
||||
br x13
|
||||
ret x13
|
||||
9:
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_16
|
||||
|
@ -568,7 +568,7 @@ function vp9_loop_filter_16
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_16_16b
|
||||
|
@ -579,7 +579,7 @@ function vp9_loop_filter_16_16b
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
.macro loop_filter_4
|
||||
|
@ -648,7 +648,7 @@ function ff_vp9_loop_filter_v_4_8_neon, export=1
|
|||
st1 {v23.8b}, [x9], x1
|
||||
st1 {v25.8b}, [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function ff_vp9_loop_filter_v_44_16_neon, export=1
|
||||
|
@ -672,7 +672,7 @@ function ff_vp9_loop_filter_v_44_16_neon, export=1
|
|||
st1 {v23.16b}, [x9], x1
|
||||
st1 {v25.16b}, [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function ff_vp9_loop_filter_h_4_8_neon, export=1
|
||||
|
@ -714,7 +714,7 @@ function ff_vp9_loop_filter_h_4_8_neon, export=1
|
|||
st1 {v25.s}[0], [x9], x1
|
||||
st1 {v25.s}[1], [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function ff_vp9_loop_filter_h_44_16_neon, export=1
|
||||
|
@ -766,7 +766,7 @@ function ff_vp9_loop_filter_h_44_16_neon, export=1
|
|||
st1 {v25.s}[1], [x9], x1
|
||||
st1 {v25.s}[3], [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function ff_vp9_loop_filter_v_8_8_neon, export=1
|
||||
|
@ -793,14 +793,14 @@ function ff_vp9_loop_filter_v_8_8_neon, export=1
|
|||
st1 {v23.8b}, [x9], x1
|
||||
st1 {v26.8b}, [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
6:
|
||||
sub x9, x0, x1, lsl #1
|
||||
st1 {v22.8b}, [x9], x1
|
||||
st1 {v24.8b}, [x0], x1
|
||||
st1 {v23.8b}, [x9], x1
|
||||
st1 {v25.8b}, [x0], x1
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
.macro mix_v_16 mix
|
||||
|
@ -828,14 +828,14 @@ function ff_vp9_loop_filter_v_\mix\()_16_neon, export=1
|
|||
st1 {v23.16b}, [x9], x1
|
||||
st1 {v26.16b}, [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
6:
|
||||
sub x9, x0, x1, lsl #1
|
||||
st1 {v22.16b}, [x9], x1
|
||||
st1 {v24.16b}, [x0], x1
|
||||
st1 {v23.16b}, [x9], x1
|
||||
st1 {v25.16b}, [x0], x1
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -876,7 +876,7 @@ function ff_vp9_loop_filter_h_8_8_neon, export=1
|
|||
st1 {v23.8b}, [x9], x1
|
||||
st1 {v27.8b}, [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
6:
|
||||
// If we didn't need to do the flat8in part, we use the same writeback
|
||||
// as in loop_filter_h_4_8.
|
||||
|
@ -891,7 +891,7 @@ function ff_vp9_loop_filter_h_8_8_neon, export=1
|
|||
st1 {v24.s}[1], [x0], x1
|
||||
st1 {v25.s}[0], [x9], x1
|
||||
st1 {v25.s}[1], [x0], x1
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
.macro mix_h_16 mix
|
||||
|
@ -942,7 +942,7 @@ function ff_vp9_loop_filter_h_\mix\()_16_neon, export=1
|
|||
st1 {v27.8b}, [x9], x1
|
||||
st1 {v27.d}[1], [x0], x1
|
||||
|
||||
br x10
|
||||
ret x10
|
||||
6:
|
||||
add x9, x9, #2
|
||||
add x0, x0, #2
|
||||
|
@ -963,7 +963,7 @@ function ff_vp9_loop_filter_h_\mix\()_16_neon, export=1
|
|||
st1 {v24.s}[3], [x0], x1
|
||||
st1 {v25.s}[1], [x9], x1
|
||||
st1 {v25.s}[3], [x0], x1
|
||||
br x10
|
||||
ret x10
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ function ff_vp9_loop_filter_v_16_8_neon, export=1
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
br x10
|
||||
ret x10
|
||||
8:
|
||||
add x9, x9, x1, lsl #2
|
||||
// If we didn't do the flat8out part, the output is left in the
|
||||
|
@ -1091,7 +1091,7 @@ function ff_vp9_loop_filter_v_16_16_neon, export=1
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
br x10
|
||||
ret x10
|
||||
8:
|
||||
add x9, x9, x1, lsl #2
|
||||
st1 {v21.16b}, [x9], x1
|
||||
|
@ -1168,7 +1168,7 @@ function ff_vp9_loop_filter_h_16_8_neon, export=1
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
br x10
|
||||
ret x10
|
||||
8:
|
||||
// The same writeback as in loop_filter_h_8_8
|
||||
sub x9, x0, #4
|
||||
|
@ -1287,7 +1287,7 @@ function ff_vp9_loop_filter_h_16_16_neon, export=1
|
|||
ldp d10, d11, [sp], 0x10
|
||||
ldp d12, d13, [sp], 0x10
|
||||
ldp d14, d15, [sp], 0x10
|
||||
br x10
|
||||
ret x10
|
||||
8:
|
||||
sub x9, x0, #4
|
||||
add x0, x9, x1, lsl #3
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* AC-3 channel layout table
|
||||
* copyright (c) 2001 Fabrice Bellard
|
||||
*
|
||||
* 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 "ac3_channel_layout_tab.h"
|
|
@ -1,4 +1,7 @@
|
|||
/*
|
||||
* AC-3 channel layout table
|
||||
* copyright (c) 2001 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
|
@ -16,37 +19,23 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVFILTER_GLSLANG_H
|
||||
#define AVFILTER_GLSLANG_H
|
||||
#ifndef AVCODEC_AC3_CHANNEL_LAYOUT_TAB_H
|
||||
#define AVCODEC_AC3_CHANNEL_LAYOUT_TAB_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "libavutil/channel_layout.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int glslang_init(void);
|
||||
void glslang_uninit(void);
|
||||
|
||||
typedef struct GLSlangResult {
|
||||
int rval;
|
||||
char *error_msg;
|
||||
|
||||
void *data; /* Shader data or NULL */
|
||||
size_t size;
|
||||
} GLSlangResult;
|
||||
|
||||
enum GLSlangStage {
|
||||
GLSLANG_VERTEX,
|
||||
GLSLANG_FRAGMENT,
|
||||
GLSLANG_COMPUTE,
|
||||
/**
|
||||
* Map audio coding mode (acmod) to channel layout mask.
|
||||
*/
|
||||
const uint16_t ff_ac3_channel_layout_tab[8] = {
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_2_1,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_2_2,
|
||||
AV_CH_LAYOUT_5POINT0
|
||||
};
|
||||
|
||||
/* Compile GLSL into a SPIRV stream, if possible */
|
||||
GLSlangResult *glslang_compile(const char *glsl, enum GLSlangStage stage);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AVFILTER_GLSLANG_H */
|
|
@ -141,7 +141,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
|||
(hdr->num_blocks * 256);
|
||||
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
|
||||
}
|
||||
hdr->channel_layout = avpriv_ac3_channel_layout_tab[hdr->channel_mode];
|
||||
hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
|
||||
if (hdr->lfe_on)
|
||||
hdr->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
|
|
|
@ -1616,7 +1616,7 @@ dependent_frame:
|
|||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->channels = s->out_channels;
|
||||
avctx->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
|
||||
avctx->channel_layout = ff_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
|
||||
if (s->output_mode & AC3_OUTPUT_LFEON)
|
||||
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
|
@ -1700,7 +1700,7 @@ skip:
|
|||
extended_channel_map[ch] = ch;
|
||||
|
||||
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
|
||||
uint64_t ich_layout = avpriv_ac3_channel_layout_tab[s->prev_output_mode & ~AC3_OUTPUT_LFEON];
|
||||
uint64_t ich_layout = ff_ac3_channel_layout_tab[s->prev_output_mode & ~AC3_OUTPUT_LFEON];
|
||||
int channel_map_size = ff_ac3_channels_tab[s->output_mode & ~AC3_OUTPUT_LFEON] + s->lfe_on;
|
||||
uint64_t channel_layout;
|
||||
int extend = 0;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "ac3dsp.h"
|
||||
#include "avcodec.h"
|
||||
#include "fft.h"
|
||||
#include "internal.h"
|
||||
#include "mathops.h"
|
||||
#include "me_cmp.h"
|
||||
#include "put_bits.h"
|
||||
|
|
|
@ -82,20 +82,6 @@ const uint8_t ff_ac3_channels_tab[8] = {
|
|||
2, 1, 2, 3, 3, 4, 4, 5
|
||||
};
|
||||
|
||||
/**
|
||||
* Map audio coding mode (acmod) to channel layout mask.
|
||||
*/
|
||||
const uint16_t avpriv_ac3_channel_layout_tab[8] = {
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_2_1,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_2_2,
|
||||
AV_CH_LAYOUT_5POINT0
|
||||
};
|
||||
|
||||
/**
|
||||
* Table to remap channels from AC-3 order to SMPTE order.
|
||||
* [channel_mode][lfe][ch]
|
||||
|
|
|
@ -24,13 +24,11 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/internal.h"
|
||||
#include "ac3.h"
|
||||
#include "internal.h"
|
||||
|
||||
extern const uint16_t ff_ac3_frame_size_tab[38][3];
|
||||
extern const uint8_t ff_ac3_channels_tab[8];
|
||||
extern av_export_avcodec const uint16_t avpriv_ac3_channel_layout_tab[8];
|
||||
extern const uint16_t ff_ac3_channel_layout_tab[8];
|
||||
extern const uint8_t ff_ac3_dec_channel_map[8][2][6];
|
||||
extern const int ff_ac3_sample_rate_tab[];
|
||||
extern const uint16_t ff_ac3_bitrate_tab[19];
|
||||
|
|
|
@ -40,7 +40,7 @@ int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
|
|||
crc_abs = get_bits1(gbc); /* protection_absent */
|
||||
aot = get_bits(gbc, 2); /* profile_objecttype */
|
||||
sr = get_bits(gbc, 4); /* sample_frequency_index */
|
||||
if (!avpriv_mpeg4audio_sample_rates[sr])
|
||||
if (!ff_mpeg4audio_sample_rates[sr])
|
||||
return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
|
||||
skip_bits1(gbc); /* private_bit */
|
||||
ch = get_bits(gbc, 3); /* channel_configuration */
|
||||
|
@ -63,7 +63,7 @@ int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
|
|||
hdr->crc_absent = crc_abs;
|
||||
hdr->num_aac_frames = rdb + 1;
|
||||
hdr->sampling_index = sr;
|
||||
hdr->sample_rate = avpriv_mpeg4audio_sample_rates[sr];
|
||||
hdr->sample_rate = ff_mpeg4audio_sample_rates[sr];
|
||||
hdr->samples = (rdb + 1) * 1024;
|
||||
hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples;
|
||||
hdr->frame_length = size;
|
||||
|
|
|
@ -34,7 +34,7 @@ static void decorrelate_stereo(int32_t *buffer[2], int nb_samples,
|
|||
a = buffer[0][i];
|
||||
b = buffer[1][i];
|
||||
|
||||
a -= (b * decorr_left_weight) >> decorr_shift;
|
||||
a -= (int)(b * (unsigned)decorr_left_weight) >> decorr_shift;
|
||||
b += a;
|
||||
|
||||
buffer[0][i] = b;
|
||||
|
|
|
@ -65,6 +65,7 @@ extern const AVCodec ff_bethsoftvid_decoder;
|
|||
extern const AVCodec ff_bfi_decoder;
|
||||
extern const AVCodec ff_bink_decoder;
|
||||
extern const AVCodec ff_bitpacked_decoder;
|
||||
extern const AVCodec ff_bitpacked_encoder;
|
||||
extern const AVCodec ff_bmp_encoder;
|
||||
extern const AVCodec ff_bmp_decoder;
|
||||
extern const AVCodec ff_bmv_video_decoder;
|
||||
|
@ -836,6 +837,7 @@ extern const AVCodec ff_mpeg4_cuvid_decoder;
|
|||
extern const AVCodec ff_mpeg4_mediacodec_decoder;
|
||||
extern const AVCodec ff_mpeg4_omx_encoder;
|
||||
extern const AVCodec ff_mpeg4_v4l2m2m_encoder;
|
||||
extern const AVCodec ff_prores_videotoolbox_encoder;
|
||||
extern const AVCodec ff_vc1_cuvid_decoder;
|
||||
extern const AVCodec ff_vp8_cuvid_decoder;
|
||||
extern const AVCodec ff_vp8_mediacodec_decoder;
|
||||
|
|
|
@ -102,7 +102,7 @@ typedef struct APEFilter {
|
|||
int16_t *historybuffer; ///< filter memory
|
||||
int16_t *delay; ///< filtered values
|
||||
|
||||
int avg;
|
||||
uint32_t avg;
|
||||
} APEFilter;
|
||||
|
||||
typedef struct APERice {
|
||||
|
@ -1088,13 +1088,13 @@ static av_always_inline int predictor_update_3930(APEPredictor *p,
|
|||
const int delayA)
|
||||
{
|
||||
int32_t predictionA, sign;
|
||||
int32_t d0, d1, d2, d3;
|
||||
uint32_t d0, d1, d2, d3;
|
||||
|
||||
p->buf[delayA] = p->lastA[filter];
|
||||
d0 = p->buf[delayA ];
|
||||
d1 = p->buf[delayA ] - p->buf[delayA - 1];
|
||||
d2 = p->buf[delayA - 1] - p->buf[delayA - 2];
|
||||
d3 = p->buf[delayA - 2] - p->buf[delayA - 3];
|
||||
d1 = p->buf[delayA ] - (unsigned)p->buf[delayA - 1];
|
||||
d2 = p->buf[delayA - 1] - (unsigned)p->buf[delayA - 2];
|
||||
d3 = p->buf[delayA - 2] - (unsigned)p->buf[delayA - 3];
|
||||
|
||||
predictionA = d0 * p->coeffsA[filter][0] +
|
||||
d1 * p->coeffsA[filter][1] +
|
||||
|
@ -1105,10 +1105,10 @@ static av_always_inline int predictor_update_3930(APEPredictor *p,
|
|||
p->filterA[filter] = p->lastA[filter] + ((int)(p->filterA[filter] * 31U) >> 5);
|
||||
|
||||
sign = APESIGN(decoded);
|
||||
p->coeffsA[filter][0] += ((d0 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][1] += ((d1 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][2] += ((d2 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][3] += ((d3 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][0] += (((int32_t)d0 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][1] += (((int32_t)d1 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][2] += (((int32_t)d2 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][3] += (((int32_t)d3 < 0) * 2 - 1) * sign;
|
||||
|
||||
return p->filterA[filter];
|
||||
}
|
||||
|
@ -1587,7 +1587,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
|||
for (ch = 0; ch < s->channels; ch++) {
|
||||
sample8 = (uint8_t *)frame->data[ch];
|
||||
for (i = 0; i < blockstodecode; i++)
|
||||
*sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;
|
||||
*sample8++ = (s->decoded[ch][i] + 0x80U) & 0xff;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
|
|
|
@ -270,7 +270,8 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth)
|
|||
put_hevc_qpel_uw_neon[3][1] = ff_hevc_put_qpel_uw_h1v3_neon_8;
|
||||
put_hevc_qpel_uw_neon[3][2] = ff_hevc_put_qpel_uw_h2v3_neon_8;
|
||||
put_hevc_qpel_uw_neon[3][3] = ff_hevc_put_qpel_uw_h3v3_neon_8;
|
||||
for (x = 0; x < 10; x++) {
|
||||
for (x = 3; x < 10; x++) {
|
||||
if (x == 4) continue;
|
||||
c->put_hevc_qpel[x][1][0] = ff_hevc_put_qpel_neon_wrapper;
|
||||
c->put_hevc_qpel[x][0][1] = ff_hevc_put_qpel_neon_wrapper;
|
||||
c->put_hevc_qpel[x][1][1] = ff_hevc_put_qpel_neon_wrapper;
|
||||
|
|
|
@ -237,7 +237,7 @@
|
|||
vld1.8 {d23}, [r2], r3
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #16
|
||||
mov r0, r6
|
||||
|
@ -280,7 +280,7 @@
|
|||
vld1.8 {d23}, [r2], r3
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #8
|
||||
mov r0, r6
|
||||
|
@ -310,7 +310,7 @@
|
|||
vld1.8 {d23}, [r2], r3
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #8
|
||||
mov r0, r6
|
||||
|
@ -377,7 +377,7 @@ endfunc
|
|||
vst1.16 {q7}, [r0], r1
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #16
|
||||
mov r0, r6
|
||||
|
@ -417,7 +417,7 @@ endfunc
|
|||
vst1.8 d0, [r0], r1
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #8
|
||||
mov r0, r6
|
||||
|
@ -446,7 +446,7 @@ endfunc
|
|||
vst1.8 d0, [r0], r1
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #8
|
||||
add r10, #16
|
||||
|
@ -533,7 +533,7 @@ endfunc
|
|||
\filterh q7
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #16
|
||||
mov r0, r6
|
||||
|
@ -594,7 +594,7 @@ endfunc
|
|||
\filterh q7
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #8
|
||||
mov r0, r6
|
||||
|
@ -641,7 +641,7 @@ endfunc
|
|||
\filterh q7
|
||||
bne 8b
|
||||
subs r5, #8
|
||||
ble 99f
|
||||
beq 99f
|
||||
mov r4, r12
|
||||
add r6, #8
|
||||
mov r0, r6
|
||||
|
|
|
@ -118,22 +118,22 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
|
|||
int readorder, int layer, const char *style,
|
||||
const char *speaker)
|
||||
{
|
||||
AVSubtitleRect **rects, *rect;
|
||||
char *ass_str;
|
||||
AVSubtitleRect **rects;
|
||||
|
||||
rects = av_realloc_array(sub->rects, sub->num_rects+1, sizeof(*sub->rects));
|
||||
if (!rects)
|
||||
return AVERROR(ENOMEM);
|
||||
sub->rects = rects;
|
||||
rects[sub->num_rects] = av_mallocz(sizeof(*rects[0]));
|
||||
if (!rects[sub->num_rects])
|
||||
rect = av_mallocz(sizeof(*rect));
|
||||
if (!rect)
|
||||
return AVERROR(ENOMEM);
|
||||
rects[sub->num_rects]->type = SUBTITLE_ASS;
|
||||
rects[sub->num_rects++] = rect;
|
||||
rect->type = SUBTITLE_ASS;
|
||||
ass_str = ff_ass_get_dialog(readorder, layer, style, speaker, dialog);
|
||||
if (!ass_str)
|
||||
return AVERROR(ENOMEM);
|
||||
rects[sub->num_rects]->ass = ass_str;
|
||||
sub->num_rects++;
|
||||
rect->ass = ass_str;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ int ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size)
|
|||
int ret, cc_count;
|
||||
|
||||
if (size < 3)
|
||||
return AVERROR(EINVAL);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = init_get_bits8(&gb, data, size);
|
||||
if (ret < 0)
|
||||
|
@ -95,12 +95,12 @@ int ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size)
|
|||
|
||||
/* 3 bytes per CC plus one byte marker_bits at the end */
|
||||
if (cc_count * 3 >= (get_bits_left(&gb) >> 3))
|
||||
return AVERROR(EINVAL);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
new_size = (old_size + cc_count * 3);
|
||||
|
||||
if (new_size > INT_MAX)
|
||||
return AVERROR(EINVAL);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* Allow merging of the cc data from two fields. */
|
||||
ret = av_buffer_realloc(pbuf, new_size);
|
||||
|
|
|
@ -194,7 +194,7 @@ static const AVOption av1_metadata_options[] = {
|
|||
{ "colocated", "Top-left chroma sample position", 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = AV1_CSP_COLOCATED }, .flags = FLAGS, .unit = "csp" },
|
||||
|
||||
{ "tick_rate", "Set display tick rate (num_units_in_display_tick / time_scale)",
|
||||
{ "tick_rate", "Set display tick rate (time_scale / num_units_in_display_tick)",
|
||||
OFFSET(tick_rate), AV_OPT_TYPE_RATIONAL,
|
||||
{ .dbl = 0.0 }, 0, UINT_MAX, FLAGS },
|
||||
{ "num_ticks_per_picture", "Set display ticks per picture for CFR streams",
|
||||
|
|
|
@ -585,16 +585,19 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s
|
|||
{
|
||||
int ret;
|
||||
|
||||
ret = ff_thread_ref_frame(&dst->tf, &src->tf);
|
||||
ret = av_buffer_replace(&dst->header_ref, src->header_ref);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dst->header_ref = av_buffer_ref(src->header_ref);
|
||||
if (!dst->header_ref)
|
||||
goto fail;
|
||||
|
||||
dst->raw_frame_header = src->raw_frame_header;
|
||||
|
||||
if (!src->tf.f->buf[0])
|
||||
return 0;
|
||||
|
||||
ret = ff_thread_ref_frame(&dst->tf, &src->tf);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
if (src->hwaccel_picture_private) {
|
||||
dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
|
||||
if (!dst->hwaccel_priv_buf)
|
||||
|
@ -800,12 +803,6 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
|
|||
return ret;
|
||||
}
|
||||
|
||||
f->header_ref = av_buffer_ref(s->header_ref);
|
||||
if (!f->header_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
f->raw_frame_header = s->raw_frame_header;
|
||||
|
||||
if ((ret = ff_thread_get_buffer(avctx, &f->tf, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -945,7 +942,6 @@ static int update_reference_list(AVCodecContext *avctx)
|
|||
|
||||
for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
|
||||
if (header->refresh_frame_flags & (1 << i)) {
|
||||
if (s->ref[i].tf.f->buf[0])
|
||||
av1_frame_unref(avctx, &s->ref[i]);
|
||||
if ((ret = av1_frame_ref(avctx, &s->ref[i], &s->cur_frame)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
|
@ -962,9 +958,28 @@ static int get_current_frame(AVCodecContext *avctx)
|
|||
AV1DecContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
if (s->cur_frame.tf.f->buf[0])
|
||||
av1_frame_unref(avctx, &s->cur_frame);
|
||||
|
||||
s->cur_frame.header_ref = av_buffer_ref(s->header_ref);
|
||||
if (!s->cur_frame.header_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
s->cur_frame.raw_frame_header = s->raw_frame_header;
|
||||
|
||||
ret = init_tile_data(s);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to init tile data.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((avctx->skip_frame >= AVDISCARD_NONINTRA &&
|
||||
(s->raw_frame_header->frame_type != AV1_FRAME_KEY &&
|
||||
s->raw_frame_header->frame_type != AV1_FRAME_INTRA_ONLY)) ||
|
||||
(avctx->skip_frame >= AVDISCARD_NONKEY &&
|
||||
s->raw_frame_header->frame_type != AV1_FRAME_KEY) ||
|
||||
avctx->skip_frame >= AVDISCARD_ALL)
|
||||
return 0;
|
||||
|
||||
ret = av1_frame_alloc(avctx, &s->cur_frame);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
|
@ -972,12 +987,6 @@ static int get_current_frame(AVCodecContext *avctx)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = init_tile_data(s);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to init tile data.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
global_motion_params(s);
|
||||
skip_mode_params(s);
|
||||
coded_lossless_param(s);
|
||||
|
@ -1077,7 +1086,6 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
|
|||
s->raw_frame_header = &obu->obu.frame_header;
|
||||
|
||||
if (s->raw_frame_header->show_existing_frame) {
|
||||
if (s->cur_frame.tf.f->buf[0])
|
||||
av1_frame_unref(avctx, &s->cur_frame);
|
||||
|
||||
ret = av1_frame_ref(avctx, &s->cur_frame,
|
||||
|
@ -1093,9 +1101,11 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (s->cur_frame.tf.f->buf[0]) {
|
||||
ret = set_output_frame(avctx, frame, pkt, got_frame);
|
||||
if (ret < 0)
|
||||
av_log(avctx, AV_LOG_ERROR, "Set output frame error.\n");
|
||||
}
|
||||
|
||||
s->raw_frame_header = NULL;
|
||||
|
||||
|
@ -1111,7 +1121,7 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
|
|||
s->cur_frame.spatial_id = header->spatial_id;
|
||||
s->cur_frame.temporal_id = header->temporal_id;
|
||||
|
||||
if (avctx->hwaccel) {
|
||||
if (avctx->hwaccel && s->cur_frame.tf.f->buf[0]) {
|
||||
ret = avctx->hwaccel->start_frame(avctx, unit->data,
|
||||
unit->data_size);
|
||||
if (ret < 0) {
|
||||
|
@ -1138,7 +1148,7 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
|
|||
if (ret < 0)
|
||||
goto end;
|
||||
|
||||
if (avctx->hwaccel) {
|
||||
if (avctx->hwaccel && s->cur_frame.tf.f->buf[0]) {
|
||||
ret = avctx->hwaccel->decode_slice(avctx,
|
||||
raw_tile_group->tile_data.data,
|
||||
raw_tile_group->tile_data.data_size);
|
||||
|
@ -1161,7 +1171,7 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
|
|||
}
|
||||
|
||||
if (raw_tile_group && (s->tile_num == raw_tile_group->tg_end + 1)) {
|
||||
if (avctx->hwaccel) {
|
||||
if (avctx->hwaccel && s->cur_frame.tf.f->buf[0]) {
|
||||
ret = avctx->hwaccel->end_frame(avctx);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "HW accel end frame fail.\n");
|
||||
|
@ -1175,7 +1185,7 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (s->raw_frame_header->show_frame) {
|
||||
if (s->raw_frame_header->show_frame && s->cur_frame.tf.f->buf[0]) {
|
||||
ret = set_output_frame(avctx, frame, pkt, got_frame);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Set output frame error\n");
|
||||
|
@ -1240,6 +1250,7 @@ const AVCodec ff_av1_decoder = {
|
|||
.flush = av1_decode_flush,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
|
||||
.priv_class = &av1_class,
|
||||
.bsfs = "av1_frame_split",
|
||||
.hw_configs = (const AVCodecHWConfigInternal *const []) {
|
||||
#if CONFIG_AV1_DXVA2_HWACCEL
|
||||
HWACCEL_DXVA2(av1),
|
||||
|
|
|
@ -181,11 +181,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
|||
avci->buffer_frame = av_frame_alloc();
|
||||
avci->buffer_pkt = av_packet_alloc();
|
||||
avci->es.in_frame = av_frame_alloc();
|
||||
avci->ds.in_pkt = av_packet_alloc();
|
||||
avci->in_pkt = av_packet_alloc();
|
||||
avci->last_pkt_props = av_packet_alloc();
|
||||
avci->pkt_props = av_fifo_alloc(sizeof(*avci->last_pkt_props));
|
||||
if (!avci->buffer_frame || !avci->buffer_pkt ||
|
||||
!avci->es.in_frame || !avci->ds.in_pkt ||
|
||||
!avci->es.in_frame || !avci->in_pkt ||
|
||||
!avci->last_pkt_props || !avci->pkt_props) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto free_and_end;
|
||||
|
@ -408,7 +408,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
|
|||
av_fifo_reset(avci->pkt_props);
|
||||
|
||||
av_frame_unref(avci->es.in_frame);
|
||||
av_packet_unref(avci->ds.in_pkt);
|
||||
av_packet_unref(avci->in_pkt);
|
||||
|
||||
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
|
||||
ff_thread_flush(avctx);
|
||||
|
@ -473,7 +473,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
|
|||
}
|
||||
av_packet_free(&avci->last_pkt_props);
|
||||
|
||||
av_packet_free(&avci->ds.in_pkt);
|
||||
av_packet_free(&avci->in_pkt);
|
||||
av_frame_free(&avci->es.in_frame);
|
||||
|
||||
av_buffer_unref(&avci->pool);
|
||||
|
|
|
@ -2384,8 +2384,6 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
|
|||
* avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
|
||||
* retrieving a codec.
|
||||
*
|
||||
* @warning This function is not thread safe!
|
||||
*
|
||||
* @note Always call this function before using decoding routines (such as
|
||||
* @ref avcodec_receive_frame()).
|
||||
*
|
||||
|
|
|
@ -142,7 +142,14 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
|||
|
||||
if (new_size + data_offset > pkt->buf->size ||
|
||||
!av_buffer_is_writable(pkt->buf)) {
|
||||
int ret = av_buffer_realloc(&pkt->buf, new_size + data_offset);
|
||||
int ret;
|
||||
|
||||
// allocate slightly more than requested to avoid excessive
|
||||
// reallocations
|
||||
if (new_size + data_offset < INT_MAX - new_size/16)
|
||||
new_size += new_size/16;
|
||||
|
||||
ret = av_buffer_realloc(&pkt->buf, new_size + data_offset);
|
||||
if (ret < 0) {
|
||||
pkt->data = old_data;
|
||||
return ret;
|
||||
|
@ -528,13 +535,12 @@ void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
|
|||
pkt->duration = av_rescale_q(pkt->duration, src_tb, dst_tb);
|
||||
}
|
||||
|
||||
int avpriv_packet_list_put(PacketList **packet_buffer,
|
||||
PacketList **plast_pktl,
|
||||
int avpriv_packet_list_put(PacketList *packet_buffer,
|
||||
AVPacket *pkt,
|
||||
int (*copy)(AVPacket *dst, const AVPacket *src),
|
||||
int flags)
|
||||
{
|
||||
PacketList *pktl = av_malloc(sizeof(PacketList));
|
||||
PacketListEntry *pktl = av_malloc(sizeof(*pktl));
|
||||
int ret;
|
||||
|
||||
if (!pktl)
|
||||
|
@ -558,44 +564,41 @@ int avpriv_packet_list_put(PacketList **packet_buffer,
|
|||
|
||||
pktl->next = NULL;
|
||||
|
||||
if (*packet_buffer)
|
||||
(*plast_pktl)->next = pktl;
|
||||
if (packet_buffer->head)
|
||||
packet_buffer->tail->next = pktl;
|
||||
else
|
||||
*packet_buffer = pktl;
|
||||
packet_buffer->head = pktl;
|
||||
|
||||
/* Add the packet in the buffered packet list. */
|
||||
*plast_pktl = pktl;
|
||||
packet_buffer->tail = pktl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int avpriv_packet_list_get(PacketList **pkt_buffer,
|
||||
PacketList **pkt_buffer_end,
|
||||
int avpriv_packet_list_get(PacketList *pkt_buffer,
|
||||
AVPacket *pkt)
|
||||
{
|
||||
PacketList *pktl;
|
||||
if (!*pkt_buffer)
|
||||
PacketListEntry *pktl = pkt_buffer->head;
|
||||
if (!pktl)
|
||||
return AVERROR(EAGAIN);
|
||||
pktl = *pkt_buffer;
|
||||
*pkt = pktl->pkt;
|
||||
*pkt_buffer = pktl->next;
|
||||
if (!pktl->next)
|
||||
*pkt_buffer_end = NULL;
|
||||
pkt_buffer->head = pktl->next;
|
||||
if (!pkt_buffer->head)
|
||||
pkt_buffer->tail = NULL;
|
||||
av_freep(&pktl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end)
|
||||
void avpriv_packet_list_free(PacketList *pkt_buf)
|
||||
{
|
||||
PacketList *tmp = *pkt_buf;
|
||||
PacketListEntry *tmp = pkt_buf->head;
|
||||
|
||||
while (tmp) {
|
||||
PacketList *pktl = tmp;
|
||||
PacketListEntry *pktl = tmp;
|
||||
tmp = pktl->next;
|
||||
av_packet_unref(&pktl->pkt);
|
||||
av_freep(&pktl);
|
||||
}
|
||||
*pkt_buf = NULL;
|
||||
*pkt_buf_end = NULL;
|
||||
pkt_buf->head = pkt_buf->tail = NULL;
|
||||
}
|
||||
|
||||
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
|
||||
|
|
|
@ -140,9 +140,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
s->pkt = av_packet_alloc();
|
||||
if (!s->pkt)
|
||||
return AVERROR(ENOMEM);
|
||||
s->pkt = avctx->internal->in_pkt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -277,8 +275,6 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
|||
else if (CONFIG_BINKAUDIO_DCT_DECODER)
|
||||
ff_dct_end(&s->trans.dct);
|
||||
|
||||
av_packet_free(&s->pkt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -337,6 +333,15 @@ fail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void decode_flush(AVCodecContext *avctx)
|
||||
{
|
||||
BinkAudioContext *const s = avctx->priv_data;
|
||||
|
||||
/* s->pkt coincides with avctx->internal->in_pkt
|
||||
* and is unreferenced generically when flushing. */
|
||||
s->first = 1;
|
||||
}
|
||||
|
||||
const AVCodec ff_binkaudio_rdft_decoder = {
|
||||
.name = "binkaudio_rdft",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)"),
|
||||
|
@ -344,9 +349,10 @@ const AVCodec ff_binkaudio_rdft_decoder = {
|
|||
.id = AV_CODEC_ID_BINKAUDIO_RDFT,
|
||||
.priv_data_size = sizeof(BinkAudioContext),
|
||||
.init = decode_init,
|
||||
.flush = decode_flush,
|
||||
.close = decode_end,
|
||||
.receive_frame = binkaudio_receive_frame,
|
||||
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
||||
|
@ -357,8 +363,9 @@ const AVCodec ff_binkaudio_dct_decoder = {
|
|||
.id = AV_CODEC_ID_BINKAUDIO_DCT,
|
||||
.priv_data_size = sizeof(BinkAudioContext),
|
||||
.init = decode_init,
|
||||
.flush = decode_flush,
|
||||
.close = decode_end,
|
||||
.receive_frame = binkaudio_receive_frame,
|
||||
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "internal.h"
|
||||
#include "get_bits.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "thread.h"
|
||||
|
||||
struct BitpackedContext {
|
||||
int (*decode)(AVCodecContext *avctx, AVFrame *frame,
|
||||
|
@ -64,11 +65,12 @@ static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame,
|
|||
{
|
||||
uint64_t frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20;
|
||||
uint64_t packet_size = (uint64_t)avpkt->size * 8;
|
||||
ThreadFrame tframe = { .f = frame };
|
||||
GetBitContext bc;
|
||||
uint16_t *y, *u, *v;
|
||||
int ret, i, j;
|
||||
|
||||
ret = ff_get_buffer(avctx, frame, 0);
|
||||
ret = ff_thread_get_buffer(avctx, &tframe, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -129,13 +131,13 @@ static int bitpacked_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
|||
AVFrame *frame = data;
|
||||
int res;
|
||||
|
||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
frame->key_frame = 1;
|
||||
|
||||
res = bc->decode(avctx, frame, avpkt);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
frame->key_frame = 1;
|
||||
|
||||
*got_frame = 1;
|
||||
return buf_size;
|
||||
|
||||
|
@ -149,7 +151,7 @@ const AVCodec ff_bitpacked_decoder = {
|
|||
.priv_data_size = sizeof(struct BitpackedContext),
|
||||
.init = bitpacked_init_decoder,
|
||||
.decode = bitpacked_decode,
|
||||
.capabilities = AV_CODEC_CAP_EXPERIMENTAL,
|
||||
.capabilities = AV_CODEC_CAP_FRAME_THREADS,
|
||||
.codec_tags = (const uint32_t []){
|
||||
MKTAG('U', 'Y', 'V', 'Y'),
|
||||
FF_CODEC_TAGS_END,
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* bitpacked encoder
|
||||
*
|
||||
* Copyright (c) 2021 Limin Wang
|
||||
*
|
||||
* 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 "avcodec.h"
|
||||
#include "encode.h"
|
||||
#include "internal.h"
|
||||
#include "put_bits.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
|
||||
struct BitpackedContext {
|
||||
int (*encode)(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame);
|
||||
};
|
||||
|
||||
static int encode_yuv422p10(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame)
|
||||
{
|
||||
const int buf_size = avctx->height * avctx->width * avctx->bits_per_coded_sample / 8;
|
||||
int ret;
|
||||
uint8_t *dst;
|
||||
const uint16_t *y;
|
||||
const uint16_t *u;
|
||||
const uint16_t *v;
|
||||
PutBitContext pb;
|
||||
|
||||
ret = ff_get_encode_buffer(avctx, pkt, buf_size, 0);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
|
||||
return ret;
|
||||
}
|
||||
dst = pkt->data;
|
||||
|
||||
init_put_bits(&pb, dst, buf_size);
|
||||
|
||||
for (int i = 0; i < avctx->height; i++) {
|
||||
y = (uint16_t*)(frame->data[0] + i * frame->linesize[0]);
|
||||
u = (uint16_t*)(frame->data[1] + i * frame->linesize[1]);
|
||||
v = (uint16_t*)(frame->data[2] + i * frame->linesize[2]);
|
||||
|
||||
for (int j = 0; j < avctx->width; j += 2) {
|
||||
/* u, y0, v, y1 */
|
||||
put_bits(&pb, 10, av_clip_uintp2(*u++, 10));
|
||||
put_bits(&pb, 10, av_clip_uintp2(*y++, 10));
|
||||
put_bits(&pb, 10, av_clip_uintp2(*v++, 10));
|
||||
put_bits(&pb, 10, av_clip_uintp2(*y++, 10));
|
||||
}
|
||||
}
|
||||
flush_put_bits(&pb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static av_cold int encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
struct BitpackedContext *s = avctx->priv_data;
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
|
||||
if (avctx->width & 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "bitpacked needs even width\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
|
||||
avctx->bit_rate = ff_guess_coded_bitrate(avctx);
|
||||
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
|
||||
s->encode = encode_yuv422p10;
|
||||
else
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
const AVFrame *frame, int *got_packet)
|
||||
{
|
||||
struct BitpackedContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
ret = s->encode(avctx, pkt, frame);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*got_packet = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const AVCodec ff_bitpacked_encoder = {
|
||||
.name = "bitpacked",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Bitpacked"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_BITPACKED,
|
||||
.priv_data_size = sizeof(struct BitpackedContext),
|
||||
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
|
||||
.init = encode_init,
|
||||
.encode2 = encode_frame,
|
||||
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P10,
|
||||
AV_PIX_FMT_NONE },
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
|
@ -142,21 +142,16 @@ typedef struct VLCcode {
|
|||
uint32_t code;
|
||||
} VLCcode;
|
||||
|
||||
static int vlc_common_init(VLC *vlc_arg, int nb_bits, int nb_codes,
|
||||
VLC **vlc, VLC *localvlc, VLCcode **buf,
|
||||
int flags)
|
||||
static int vlc_common_init(VLC *vlc, int nb_bits, int nb_codes,
|
||||
VLCcode **buf, int flags)
|
||||
{
|
||||
*vlc = vlc_arg;
|
||||
(*vlc)->bits = nb_bits;
|
||||
vlc->bits = nb_bits;
|
||||
vlc->table_size = 0;
|
||||
if (flags & INIT_VLC_USE_NEW_STATIC) {
|
||||
av_assert0(nb_codes <= LOCALBUF_ELEMS);
|
||||
*localvlc = *vlc_arg;
|
||||
*vlc = localvlc;
|
||||
(*vlc)->table_size = 0;
|
||||
} else {
|
||||
(*vlc)->table = NULL;
|
||||
(*vlc)->table_allocated = 0;
|
||||
(*vlc)->table_size = 0;
|
||||
vlc->table = NULL;
|
||||
vlc->table_allocated = 0;
|
||||
}
|
||||
if (nb_codes > LOCALBUF_ELEMS) {
|
||||
*buf = av_malloc_array(nb_codes, sizeof(VLCcode));
|
||||
|
@ -191,8 +186,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
|||
{
|
||||
int table_size, table_index, index, code_prefix, symbol, subtable_bits;
|
||||
int i, j, k, n, nb, inc;
|
||||
VLC_TYPE (*table)[2];
|
||||
uint32_t code;
|
||||
volatile VLC_TYPE (* volatile table)[2]; // the double volatile is needed to prevent an internal compiler error in gcc 4.2
|
||||
|
||||
if (table_nb_bits > 30)
|
||||
return AVERROR(EINVAL);
|
||||
|
@ -201,7 +196,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
|||
ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
|
||||
if (table_index < 0)
|
||||
return table_index;
|
||||
table = (volatile VLC_TYPE (*)[2])&vlc->table[table_index];
|
||||
table = &vlc->table[table_index];
|
||||
|
||||
/* first pass: map codes and compute auxiliary table sizes */
|
||||
for (i = 0; i < nb_codes; i++) {
|
||||
|
@ -257,7 +252,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
|||
if (index < 0)
|
||||
return index;
|
||||
/* note: realloc has been done, so reload tables */
|
||||
table = (volatile VLC_TYPE (*)[2])&vlc->table[table_index];
|
||||
table = &vlc->table[table_index];
|
||||
table[j][0] = index; //code
|
||||
if (table[j][0] != index) {
|
||||
avpriv_request_sample(NULL, "strange codes");
|
||||
|
@ -276,7 +271,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
|||
}
|
||||
|
||||
static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes,
|
||||
int flags, VLC *vlc_arg, VLCcode localbuf[LOCALBUF_ELEMS])
|
||||
int flags, VLCcode localbuf[LOCALBUF_ELEMS])
|
||||
{
|
||||
int ret = build_table(vlc, nb_bits, nb_codes, codes, flags);
|
||||
|
||||
|
@ -285,7 +280,6 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes,
|
|||
!(flags & (INIT_VLC_STATIC_OVERLONG & ~INIT_VLC_USE_NEW_STATIC)))
|
||||
av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated);
|
||||
av_assert0(ret >= 0);
|
||||
*vlc_arg = *vlc;
|
||||
} else {
|
||||
if (codes != localbuf)
|
||||
av_free(codes);
|
||||
|
@ -320,7 +314,7 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes,
|
|||
'wrap' and 'size' make it possible to use any memory configuration and types
|
||||
(byte/word/long) to store the 'bits', 'codes', and 'symbols' tables.
|
||||
*/
|
||||
int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes,
|
||||
int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
const void *bits, int bits_wrap, int bits_size,
|
||||
const void *codes, int codes_wrap, int codes_size,
|
||||
const void *symbols, int symbols_wrap, int symbols_size,
|
||||
|
@ -328,10 +322,8 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes,
|
|||
{
|
||||
VLCcode localbuf[LOCALBUF_ELEMS], *buf = localbuf;
|
||||
int i, j, ret;
|
||||
VLC localvlc, *vlc;
|
||||
|
||||
ret = vlc_common_init(vlc_arg, nb_bits, nb_codes, &vlc, &localvlc,
|
||||
&buf, flags);
|
||||
ret = vlc_common_init(vlc, nb_bits, nb_codes, &buf, flags);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -375,21 +367,19 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes,
|
|||
nb_codes = j;
|
||||
|
||||
return vlc_common_end(vlc, nb_bits, nb_codes, buf,
|
||||
flags, vlc_arg, localbuf);
|
||||
flags, localbuf);
|
||||
}
|
||||
|
||||
int ff_init_vlc_from_lengths(VLC *vlc_arg, int nb_bits, int nb_codes,
|
||||
int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes,
|
||||
const int8_t *lens, int lens_wrap,
|
||||
const void *symbols, int symbols_wrap, int symbols_size,
|
||||
int offset, int flags, void *logctx)
|
||||
{
|
||||
VLCcode localbuf[LOCALBUF_ELEMS], *buf = localbuf;
|
||||
VLC localvlc, *vlc;
|
||||
uint64_t code;
|
||||
int ret, j, len_max = FFMIN(32, 3 * nb_bits);
|
||||
|
||||
ret = vlc_common_init(vlc_arg, nb_bits, nb_codes, &vlc, &localvlc,
|
||||
&buf, flags);
|
||||
ret = vlc_common_init(vlc, nb_bits, nb_codes, &buf, flags);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -420,8 +410,7 @@ int ff_init_vlc_from_lengths(VLC *vlc_arg, int nb_bits, int nb_codes,
|
|||
goto fail;
|
||||
}
|
||||
}
|
||||
return vlc_common_end(vlc, nb_bits, j, buf,
|
||||
flags, vlc_arg, localbuf);
|
||||
return vlc_common_end(vlc, nb_bits, j, buf, flags, localbuf);
|
||||
fail:
|
||||
if (buf != localbuf)
|
||||
av_free(buf);
|
||||
|
|
|
@ -49,6 +49,9 @@
|
|||
#if ARCH_MIPS
|
||||
# include "mips/cabac.h"
|
||||
#endif
|
||||
#if ARCH_LOONGARCH64
|
||||
# include "loongarch/cabac.h"
|
||||
#endif
|
||||
|
||||
static const uint8_t * const ff_h264_norm_shift = ff_h264_cabac_tables + H264_NORM_SHIFT_OFFSET;
|
||||
static const uint8_t * const ff_h264_lps_range = ff_h264_cabac_tables + H264_LPS_RANGE_OFFSET;
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct CDGraphicsContext {
|
|||
AVFrame *frame;
|
||||
int hscroll;
|
||||
int vscroll;
|
||||
int transparency;
|
||||
uint8_t alpha[CDG_PALETTE_SIZE];
|
||||
int cleared;
|
||||
} CDGraphicsContext;
|
||||
|
||||
|
@ -79,7 +79,9 @@ static av_cold int cdg_decode_init(AVCodecContext *avctx)
|
|||
cc->frame = av_frame_alloc();
|
||||
if (!cc->frame)
|
||||
return AVERROR(ENOMEM);
|
||||
cc->transparency = -1;
|
||||
|
||||
for (int i = 0; i < CDG_PALETTE_SIZE; i++)
|
||||
cc->alpha[i] = 0xFFU;
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
return ff_set_dimensions(avctx, CDG_FULL_WIDTH, CDG_FULL_HEIGHT);
|
||||
|
@ -120,9 +122,7 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
|
|||
r = ((color >> 8) & 0x000F) * 17;
|
||||
g = ((color >> 4) & 0x000F) * 17;
|
||||
b = ((color ) & 0x000F) * 17;
|
||||
palette[i + array_offset] = 0xFFU << 24 | r << 16 | g << 8 | b;
|
||||
if (cc->transparency >= 0)
|
||||
palette[cc->transparency] &= 0xFFFFFF;
|
||||
palette[i + array_offset] = (uint32_t)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
cc->frame->palette_has_changed = 1;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
|
|||
|
||||
/// find the difference and save the offset for cdg_tile_block usage
|
||||
hinc = h_off - cc->hscroll;
|
||||
vinc = v_off - cc->vscroll;
|
||||
vinc = cc->vscroll - v_off;
|
||||
cc->hscroll = h_off;
|
||||
cc->vscroll = v_off;
|
||||
|
||||
|
@ -346,7 +346,8 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
|||
return ret;
|
||||
break;
|
||||
case CDG_INST_TRANSPARENT_COL:
|
||||
cc->transparency = cdg_data[0] & 0xF;
|
||||
for (int i = 0; i < CDG_PALETTE_SIZE; i++)
|
||||
cc->alpha[i] = 255 - ((cdg_data[i] & 0x3f) << 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -705,7 +705,6 @@ static int quantize(CinepakEncContext *s, int h, uint8_t *data[4],
|
|||
int entry_size = s->pix_fmt == AV_PIX_FMT_RGB24 ? 6 : 4;
|
||||
int *codebook = v1mode ? info->v1_codebook : info->v4_codebook;
|
||||
int size = v1mode ? info->v1_size : info->v4_size;
|
||||
int64_t total_error = 0;
|
||||
uint8_t vq_pict_buf[(MB_AREA * 3) / 2];
|
||||
uint8_t *sub_data[4], *vq_data[4];
|
||||
int sub_linesize[4], vq_linesize[4];
|
||||
|
@ -795,7 +794,6 @@ static int quantize(CinepakEncContext *s, int h, uint8_t *data[4],
|
|||
|
||||
mb->v1_error = compute_mb_distortion(s, sub_data, sub_linesize,
|
||||
vq_data, vq_linesize);
|
||||
total_error += mb->v1_error;
|
||||
} else {
|
||||
for (k = 0; k < 4; k++)
|
||||
mb->v4_vector[k] = s->codebook_closest[i + k];
|
||||
|
@ -805,7 +803,6 @@ static int quantize(CinepakEncContext *s, int h, uint8_t *data[4],
|
|||
|
||||
mb->v4_error = compute_mb_distortion(s, sub_data, sub_linesize,
|
||||
vq_data, vq_linesize);
|
||||
total_error += mb->v4_error;
|
||||
}
|
||||
i += v1mode ? 1 : 4;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,9 @@ typedef struct OpaqueList {
|
|||
typedef struct {
|
||||
AVClass *av_class;
|
||||
AVCodecContext *avctx;
|
||||
/* This packet coincides with AVCodecInternal.in_pkt
|
||||
* and is not owned by us. */
|
||||
AVPacket *pkt;
|
||||
HANDLE dev;
|
||||
|
||||
uint8_t is_70012;
|
||||
|
@ -328,6 +331,7 @@ static av_cold int init(AVCodecContext *avctx)
|
|||
/* Initialize the library */
|
||||
priv = avctx->priv_data;
|
||||
priv->avctx = avctx;
|
||||
priv->pkt = avctx->internal->in_pkt;
|
||||
priv->draining = 0;
|
||||
|
||||
subtype = id2subtype(priv, avctx->codec->id);
|
||||
|
@ -703,19 +707,19 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
|||
BC_DTS_STATUS decoder_status = { 0, };
|
||||
CopyRet rec_ret;
|
||||
CHDContext *priv = avctx->priv_data;
|
||||
AVPacket *const pkt = priv->pkt;
|
||||
HANDLE dev = priv->dev;
|
||||
int got_frame = 0;
|
||||
int ret = 0;
|
||||
AVPacket pkt = {0};
|
||||
|
||||
av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: receive_frame\n");
|
||||
|
||||
ret = ff_decode_get_packet(avctx, &pkt);
|
||||
ret = ff_decode_get_packet(avctx, pkt);
|
||||
if (ret < 0 && ret != AVERROR_EOF) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (pkt.size > DtsTxFreeSize(dev)) {
|
||||
while (pkt->size > DtsTxFreeSize(dev)) {
|
||||
/*
|
||||
* Block until there is space in the buffer for the next packet.
|
||||
* We assume that the hardware will make forward progress at this
|
||||
|
@ -724,8 +728,8 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
|||
av_log(avctx, AV_LOG_TRACE, "CrystalHD: Waiting for space in input buffer\n");
|
||||
}
|
||||
|
||||
ret = crystalhd_decode_packet(avctx, &pkt);
|
||||
av_packet_unref(&pkt);
|
||||
ret = crystalhd_decode_packet(avctx, pkt);
|
||||
av_packet_unref(pkt);
|
||||
// crystalhd_is_buffer_full() should avoid this.
|
||||
if (ret == AVERROR(EAGAIN)) {
|
||||
ret = AVERROR_EXTERNAL;
|
||||
|
|
|
@ -53,6 +53,10 @@ typedef struct CuvidContext
|
|||
CUvideodecoder cudecoder;
|
||||
CUvideoparser cuparser;
|
||||
|
||||
/* This packet coincides with AVCodecInternal.in_pkt
|
||||
* and is not owned by us. */
|
||||
AVPacket *pkt;
|
||||
|
||||
char *cu_gpu;
|
||||
int nb_surfaces;
|
||||
int drop_second_field;
|
||||
|
@ -466,12 +470,12 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame)
|
|||
}
|
||||
|
||||
if (!cuvid_is_buffer_full(avctx)) {
|
||||
AVPacket pkt = {0};
|
||||
ret = ff_decode_get_packet(avctx, &pkt);
|
||||
AVPacket *const pkt = ctx->pkt;
|
||||
ret = ff_decode_get_packet(avctx, pkt);
|
||||
if (ret < 0 && ret != AVERROR_EOF)
|
||||
return ret;
|
||||
ret = cuvid_decode_packet(avctx, &pkt);
|
||||
av_packet_unref(&pkt);
|
||||
ret = cuvid_decode_packet(avctx, pkt);
|
||||
av_packet_unref(pkt);
|
||||
// cuvid_is_buffer_full() should avoid this.
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
ret = AVERROR_EXTERNAL;
|
||||
|
@ -797,6 +801,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
|
|||
if (probe_desc && probe_desc->nb_components)
|
||||
probed_bit_depth = probe_desc->comp[0].depth;
|
||||
|
||||
ctx->pkt = avctx->internal->in_pkt;
|
||||
// Accelerated transcoding scenarios with 'ffmpeg' require that the
|
||||
// pix_fmt be set to AV_PIX_FMT_CUDA early. The sw_pix_fmt, and the
|
||||
// pix_fmt for non-accelerated transcoding, do not need to be correct
|
||||
|
|
|
@ -33,11 +33,6 @@
|
|||
#include "get_bits.h"
|
||||
#include "put_bits.h"
|
||||
|
||||
const uint32_t avpriv_dca_sample_rates[16] = {
|
||||
0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
|
||||
12000, 24000, 48000, 96000, 192000
|
||||
};
|
||||
|
||||
const uint32_t ff_dca_sampling_freqs[16] = {
|
||||
8000, 16000, 32000, 64000, 128000, 22050, 44100, 88200,
|
||||
176400, 352800, 12000, 24000, 48000, 96000, 192000, 384000,
|
||||
|
@ -112,7 +107,7 @@ int ff_dca_parse_core_frame_header(DCACoreFrameHeader *h, GetBitContext *gb)
|
|||
return DCA_PARSE_ERROR_AMODE;
|
||||
|
||||
h->sr_code = get_bits(gb, 4);
|
||||
if (!avpriv_dca_sample_rates[h->sr_code])
|
||||
if (!ff_dca_sample_rates[h->sr_code])
|
||||
return DCA_PARSE_ERROR_SAMPLE_RATE;
|
||||
|
||||
h->br_code = get_bits(gb, 5);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
#include "get_bits.h"
|
||||
#include "internal.h"
|
||||
|
||||
#define DCA_CORE_FRAME_HEADER_SIZE 18
|
||||
|
||||
|
@ -195,8 +194,7 @@ enum DCADownMixType {
|
|||
DCA_DMIX_TYPE_COUNT
|
||||
};
|
||||
|
||||
extern av_export_avcodec const uint32_t avpriv_dca_sample_rates[16];
|
||||
|
||||
extern const uint32_t ff_dca_sample_rates[16];
|
||||
extern const uint32_t ff_dca_sampling_freqs[16];
|
||||
extern const uint8_t ff_dca_freq_ranges[16];
|
||||
extern const uint8_t ff_dca_bits_per_sample[8];
|
||||
|
|
|
@ -129,7 +129,7 @@ static int parse_frame_header(DCACoreDecoder *s)
|
|||
s->npcmblocks = h.npcmblocks;
|
||||
s->frame_size = h.frame_size;
|
||||
s->audio_mode = h.audio_mode;
|
||||
s->sample_rate = avpriv_dca_sample_rates[h.sr_code];
|
||||
s->sample_rate = ff_dca_sample_rates[h.sr_code];
|
||||
s->bit_rate = ff_dca_bit_rates[h.br_code];
|
||||
s->drc_present = h.drc_present;
|
||||
s->ts_present = h.ts_present;
|
||||
|
|
|
@ -267,7 +267,7 @@ static int dca_parse_params(DCAParseContext *pc1, const uint8_t *buf,
|
|||
return AVERROR_INVALIDDATA;
|
||||
|
||||
*duration = h.npcmblocks * DCA_PCMBLOCK_SAMPLES;
|
||||
*sample_rate = avpriv_dca_sample_rates[h.sr_code];
|
||||
*sample_rate = ff_dca_sample_rates[h.sr_code];
|
||||
if (*profile != FF_PROFILE_UNKNOWN)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* DCA sample rates
|
||||
* Copyright (C) 2004 Gildas Bazin
|
||||
* Copyright (C) 2004 Benjamin Zores
|
||||
* Copyright (C) 2006 Benjamin Larsson
|
||||
* Copyright (C) 2007 Konstantin Shishkov
|
||||
*
|
||||
* 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 "dca_sample_rate_tab.h"
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* DCA sample rates
|
||||
* Copyright (C) 2004 Gildas Bazin
|
||||
* Copyright (C) 2004 Benjamin Zores
|
||||
* Copyright (C) 2006 Benjamin Larssonb
|
||||
* Copyright (C) 2007 Konstantin Shishkov
|
||||
*
|
||||
* 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_DCA_SAMPLE_RATE_TAB_H
|
||||
#define AVCODEC_DCA_SAMPLE_RATE_TAB_H
|
||||
#include <stdint.h>
|
||||
|
||||
const uint32_t ff_dca_sample_rates[16] = {
|
||||
0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
|
||||
12000, 24000, 48000, 96000, 192000
|
||||
};
|
||||
#endif
|
|
@ -296,8 +296,7 @@ static int64_t guess_correct_pts(AVCodecContext *ctx,
|
|||
static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, int64_t *discarded_samples)
|
||||
{
|
||||
AVCodecInternal *avci = avctx->internal;
|
||||
DecodeSimpleContext *ds = &avci->ds;
|
||||
AVPacket *pkt = ds->in_pkt;
|
||||
AVPacket *const pkt = avci->in_pkt;
|
||||
int got_frame, actual_got_frame;
|
||||
int ret;
|
||||
|
||||
|
@ -835,8 +834,14 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
|||
sub->pts = av_rescale_q(avpkt->pts,
|
||||
avctx->pkt_timebase, AV_TIME_BASE_Q);
|
||||
ret = avctx->codec->decode(avctx, sub, got_sub_ptr, pkt);
|
||||
av_assert1((ret >= 0) >= !!*got_sub_ptr &&
|
||||
!!*got_sub_ptr >= !!sub->num_rects);
|
||||
if (pkt == avci->buffer_pkt) // did we recode?
|
||||
av_packet_unref(avci->buffer_pkt);
|
||||
if (ret < 0) {
|
||||
*got_sub_ptr = 0;
|
||||
avsubtitle_free(sub);
|
||||
return ret;
|
||||
}
|
||||
av_assert1(!sub->num_rects || *got_sub_ptr);
|
||||
|
||||
if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
|
||||
avctx->pkt_timebase.num) {
|
||||
|
@ -857,16 +862,13 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
|||
"Invalid UTF-8 in decoded subtitles text; "
|
||||
"maybe missing -sub_charenc option\n");
|
||||
avsubtitle_free(sub);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
break;
|
||||
*got_sub_ptr = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
if (*got_sub_ptr)
|
||||
avctx->frame_number++;
|
||||
|
||||
if (pkt == avci->buffer_pkt) // did we recode?
|
||||
av_packet_unref(avci->buffer_pkt);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -1105,12 +1107,10 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
|
|||
avctx->sw_pix_fmt = fmt[n - 1];
|
||||
}
|
||||
|
||||
choices = av_malloc_array(n + 1, sizeof(*choices));
|
||||
choices = av_memdup(fmt, (n + 1) * sizeof(*choices));
|
||||
if (!choices)
|
||||
return AV_PIX_FMT_NONE;
|
||||
|
||||
memcpy(choices, fmt, (n + 1) * sizeof(*choices));
|
||||
|
||||
for (;;) {
|
||||
// Remove the previous hwaccel, if there was one.
|
||||
hwaccel_uninit(avctx);
|
||||
|
|
|
@ -73,9 +73,9 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
|
|||
if (cid <= 0)
|
||||
continue;
|
||||
|
||||
remaining = avpriv_dnxhd_get_frame_size(cid);
|
||||
remaining = ff_dnxhd_get_frame_size(cid);
|
||||
if (remaining <= 0) {
|
||||
remaining = avpriv_dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
|
||||
remaining = ff_dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
|
||||
if (remaining <= 0)
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1083,7 +1083,7 @@ const CIDEntry *ff_dnxhd_get_cid_table(int cid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int avpriv_dnxhd_get_frame_size(int cid)
|
||||
int ff_dnxhd_get_frame_size(int cid)
|
||||
{
|
||||
const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
|
||||
if (!entry)
|
||||
|
@ -1091,7 +1091,7 @@ int avpriv_dnxhd_get_frame_size(int cid)
|
|||
return entry->frame_size;
|
||||
}
|
||||
|
||||
int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h)
|
||||
int ff_dnxhd_get_hr_frame_size(int cid, int w, int h)
|
||||
{
|
||||
const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
|
||||
int result;
|
||||
|
@ -1105,14 +1105,6 @@ int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h)
|
|||
return FFMAX(result, 8192);
|
||||
}
|
||||
|
||||
int avpriv_dnxhd_get_interlaced(int cid)
|
||||
{
|
||||
const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
|
||||
if (!entry)
|
||||
return -1;
|
||||
return entry->flags & DNXHD_INTERLACED ? 1 : 0;
|
||||
}
|
||||
|
||||
static int dnxhd_find_hr_cid(AVCodecContext *avctx)
|
||||
{
|
||||
switch (avctx->profile) {
|
||||
|
|
|
@ -88,8 +88,7 @@ static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf
|
|||
return ff_dnxhd_check_header_prefix(prefix);
|
||||
}
|
||||
|
||||
int avpriv_dnxhd_get_frame_size(int cid);
|
||||
int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h);
|
||||
int avpriv_dnxhd_get_interlaced(int cid);
|
||||
int ff_dnxhd_get_frame_size(int cid);
|
||||
int ff_dnxhd_get_hr_frame_size(int cid, int w, int h);
|
||||
|
||||
#endif /* AVCODEC_DNXHDDATA_H */
|
||||
|
|
|
@ -463,7 +463,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
|
|||
ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width;
|
||||
|
||||
if (ctx->cid_table->frame_size == DNXHD_VARIABLE) {
|
||||
ctx->frame_size = avpriv_dnxhd_get_hr_frame_size(ctx->cid,
|
||||
ctx->frame_size = ff_dnxhd_get_hr_frame_size(ctx->cid,
|
||||
avctx->width, avctx->height);
|
||||
av_assert0(ctx->frame_size >= 0);
|
||||
ctx->coding_unit_size = ctx->frame_size;
|
||||
|
|
|
@ -0,0 +1,449 @@
|
|||
/*
|
||||
* Dolby Vision RPU decoder
|
||||
*
|
||||
* Copyright (C) 2021 Jan Ekström
|
||||
* Copyright (C) 2021 Niklas Haas
|
||||
*
|
||||
* 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/buffer.h"
|
||||
|
||||
#include "dovi_rpu.h"
|
||||
#include "golomb.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
enum {
|
||||
RPU_COEFF_FIXED = 0,
|
||||
RPU_COEFF_FLOAT = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Private contents of vdr_ref.
|
||||
*/
|
||||
typedef struct DOVIVdrRef {
|
||||
AVDOVIDataMapping mapping;
|
||||
AVDOVIColorMetadata color;
|
||||
} DOVIVdrRef;
|
||||
|
||||
void ff_dovi_ctx_unref(DOVIContext *s)
|
||||
{
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr_ref); i++)
|
||||
av_buffer_unref(&s->vdr_ref[i]);
|
||||
|
||||
*s = (DOVIContext) {
|
||||
.logctx = s->logctx,
|
||||
};
|
||||
}
|
||||
|
||||
void ff_dovi_ctx_flush(DOVIContext *s)
|
||||
{
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr_ref); i++)
|
||||
av_buffer_unref(&s->vdr_ref[i]);
|
||||
|
||||
*s = (DOVIContext) {
|
||||
.logctx = s->logctx,
|
||||
.dv_profile = s->dv_profile,
|
||||
};
|
||||
}
|
||||
|
||||
int ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0)
|
||||
{
|
||||
int ret;
|
||||
s->logctx = s0->logctx;
|
||||
s->mapping = s0->mapping;
|
||||
s->color = s0->color;
|
||||
s->dv_profile = s0->dv_profile;
|
||||
for (int i = 0; i < DOVI_MAX_DM_ID; i++) {
|
||||
if ((ret = av_buffer_replace(&s->vdr_ref[i], s0->vdr_ref[i])) < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
ff_dovi_ctx_unref(s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ff_dovi_update_cfg(DOVIContext *s, const AVDOVIDecoderConfigurationRecord *cfg)
|
||||
{
|
||||
if (!cfg)
|
||||
return;
|
||||
|
||||
s->dv_profile = cfg->dv_profile;
|
||||
}
|
||||
|
||||
int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame)
|
||||
{
|
||||
AVFrameSideData *sd;
|
||||
AVBufferRef *buf;
|
||||
AVDOVIMetadata *dovi;
|
||||
size_t dovi_size;
|
||||
|
||||
if (!s->mapping || !s->color)
|
||||
return 0; /* incomplete dovi metadata */
|
||||
|
||||
dovi = av_dovi_metadata_alloc(&dovi_size);
|
||||
if (!dovi)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
buf = av_buffer_create((uint8_t *) dovi, dovi_size, NULL, NULL, 0);
|
||||
if (!buf) {
|
||||
av_free(dovi);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_DOVI_METADATA, buf);
|
||||
if (!sd) {
|
||||
av_buffer_unref(&buf);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
/* Copy only the parts of these structs known to us at compiler-time. */
|
||||
#define COPY(t, a, b, last) memcpy(a, b, offsetof(t, last) + sizeof((b)->last))
|
||||
COPY(AVDOVIRpuDataHeader, av_dovi_get_header(dovi), &s->header, disable_residual_flag);
|
||||
COPY(AVDOVIDataMapping, av_dovi_get_mapping(dovi), s->mapping, nlq[2].linear_deadzone_threshold);
|
||||
COPY(AVDOVIColorMetadata, av_dovi_get_color(dovi), s->color, source_diagonal);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int guess_profile(const AVDOVIRpuDataHeader *hdr)
|
||||
{
|
||||
switch (hdr->vdr_rpu_profile) {
|
||||
case 0:
|
||||
if (hdr->bl_video_full_range_flag)
|
||||
return 5;
|
||||
break;
|
||||
case 1:
|
||||
if (hdr->el_spatial_resampling_filter_flag && !hdr->disable_residual_flag) {
|
||||
if (hdr->vdr_bit_depth == 12) {
|
||||
return 7;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; /* unknown */
|
||||
}
|
||||
|
||||
static inline uint64_t get_ue_coef(GetBitContext *gb, const AVDOVIRpuDataHeader *hdr)
|
||||
{
|
||||
uint64_t ipart;
|
||||
union { uint32_t u32; float f32; } fpart;
|
||||
|
||||
switch (hdr->coef_data_type) {
|
||||
case RPU_COEFF_FIXED:
|
||||
ipart = get_ue_golomb_long(gb);
|
||||
fpart.u32 = get_bits_long(gb, hdr->coef_log2_denom);
|
||||
return (ipart << hdr->coef_log2_denom) + fpart.u32;
|
||||
|
||||
case RPU_COEFF_FLOAT:
|
||||
fpart.u32 = get_bits_long(gb, 32);
|
||||
return fpart.f32 * (1 << hdr->coef_log2_denom);
|
||||
}
|
||||
|
||||
return 0; /* unreachable */
|
||||
}
|
||||
|
||||
static inline int64_t get_se_coef(GetBitContext *gb, const AVDOVIRpuDataHeader *hdr)
|
||||
{
|
||||
int64_t ipart;
|
||||
union { uint32_t u32; float f32; } fpart;
|
||||
|
||||
switch (hdr->coef_data_type) {
|
||||
case RPU_COEFF_FIXED:
|
||||
ipart = get_se_golomb_long(gb);
|
||||
fpart.u32 = get_bits_long(gb, hdr->coef_log2_denom);
|
||||
return (ipart << hdr->coef_log2_denom) + fpart.u32;
|
||||
|
||||
case RPU_COEFF_FLOAT:
|
||||
fpart.u32 = get_bits_long(gb, 32);
|
||||
return fpart.f32 * (1 << hdr->coef_log2_denom);
|
||||
}
|
||||
|
||||
return 0; /* unreachable */
|
||||
}
|
||||
|
||||
#define VALIDATE(VAR, MIN, MAX) \
|
||||
do { \
|
||||
if (VAR < MIN || VAR > MAX) { \
|
||||
av_log(s->logctx, AV_LOG_ERROR, "RPU validation failed: " \
|
||||
#MIN" <= "#VAR" = %d <= "#MAX"\n", (int) VAR); \
|
||||
goto fail; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size)
|
||||
{
|
||||
AVDOVIRpuDataHeader *hdr = &s->header;
|
||||
GetBitContext *gb = &(GetBitContext){0};
|
||||
DOVIVdrRef *vdr;
|
||||
int ret;
|
||||
|
||||
uint8_t nal_prefix;
|
||||
uint8_t rpu_type;
|
||||
uint8_t vdr_seq_info_present;
|
||||
uint8_t vdr_dm_metadata_present;
|
||||
uint8_t use_prev_vdr_rpu;
|
||||
uint8_t use_nlq;
|
||||
uint8_t profile;
|
||||
if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0)
|
||||
return ret;
|
||||
|
||||
/* RPU header, common values */
|
||||
nal_prefix = get_bits(gb, 8);
|
||||
VALIDATE(nal_prefix, 25, 25);
|
||||
rpu_type = get_bits(gb, 6);
|
||||
if (rpu_type != 2) {
|
||||
av_log(s->logctx, AV_LOG_WARNING, "Unrecognized RPU type "
|
||||
"%"PRIu8", ignoring\n", rpu_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hdr->rpu_type = rpu_type;
|
||||
hdr->rpu_format = get_bits(gb, 11);
|
||||
|
||||
/* Values specific to RPU type 2 */
|
||||
hdr->vdr_rpu_profile = get_bits(gb, 4);
|
||||
hdr->vdr_rpu_level = get_bits(gb, 4);
|
||||
|
||||
vdr_seq_info_present = get_bits1(gb);
|
||||
if (vdr_seq_info_present) {
|
||||
hdr->chroma_resampling_explicit_filter_flag = get_bits1(gb);
|
||||
hdr->coef_data_type = get_bits(gb, 2);
|
||||
VALIDATE(hdr->coef_data_type, RPU_COEFF_FIXED, RPU_COEFF_FLOAT);
|
||||
switch (hdr->coef_data_type) {
|
||||
case RPU_COEFF_FIXED:
|
||||
hdr->coef_log2_denom = get_ue_golomb(gb);
|
||||
VALIDATE(hdr->coef_log2_denom, 13, 32);
|
||||
break;
|
||||
case RPU_COEFF_FLOAT:
|
||||
hdr->coef_log2_denom = 32; /* arbitrary, choose maximum precision */
|
||||
break;
|
||||
}
|
||||
|
||||
hdr->vdr_rpu_normalized_idc = get_bits(gb, 2);
|
||||
hdr->bl_video_full_range_flag = get_bits1(gb);
|
||||
|
||||
if ((hdr->rpu_format & 0x700) == 0) {
|
||||
int bl_bit_depth_minus8 = get_ue_golomb_31(gb);
|
||||
int el_bit_depth_minus8 = get_ue_golomb_31(gb);
|
||||
int vdr_bit_depth_minus8 = get_ue_golomb_31(gb);
|
||||
VALIDATE(bl_bit_depth_minus8, 0, 8);
|
||||
VALIDATE(el_bit_depth_minus8, 0, 8);
|
||||
VALIDATE(vdr_bit_depth_minus8, 0, 8);
|
||||
hdr->bl_bit_depth = bl_bit_depth_minus8 + 8;
|
||||
hdr->el_bit_depth = el_bit_depth_minus8 + 8;
|
||||
hdr->vdr_bit_depth = vdr_bit_depth_minus8 + 8;
|
||||
hdr->spatial_resampling_filter_flag = get_bits1(gb);
|
||||
skip_bits(gb, 3); /* reserved_zero_3bits */
|
||||
hdr->el_spatial_resampling_filter_flag = get_bits1(gb);
|
||||
hdr->disable_residual_flag = get_bits1(gb);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hdr->bl_bit_depth) {
|
||||
av_log(s->logctx, AV_LOG_ERROR, "Missing RPU VDR sequence info?\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vdr_dm_metadata_present = get_bits1(gb);
|
||||
use_prev_vdr_rpu = get_bits1(gb);
|
||||
use_nlq = (hdr->rpu_format & 0x700) == 0 && !hdr->disable_residual_flag;
|
||||
|
||||
profile = s->dv_profile ? s->dv_profile : guess_profile(hdr);
|
||||
if (profile == 5 && use_nlq) {
|
||||
av_log(s->logctx, AV_LOG_ERROR, "Profile 5 RPUs should not use NLQ\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (use_prev_vdr_rpu) {
|
||||
int prev_vdr_rpu_id = get_ue_golomb_31(gb);
|
||||
VALIDATE(prev_vdr_rpu_id, 0, DOVI_MAX_DM_ID);
|
||||
if (!s->vdr_ref[prev_vdr_rpu_id]) {
|
||||
av_log(s->logctx, AV_LOG_ERROR, "Unknown previous RPU ID: %u\n",
|
||||
prev_vdr_rpu_id);
|
||||
goto fail;
|
||||
}
|
||||
vdr = (DOVIVdrRef *) s->vdr_ref[prev_vdr_rpu_id]->data;
|
||||
s->mapping = &vdr->mapping;
|
||||
} else {
|
||||
int vdr_rpu_id = get_ue_golomb_31(gb);
|
||||
VALIDATE(vdr_rpu_id, 0, DOVI_MAX_DM_ID);
|
||||
if (!s->vdr_ref[vdr_rpu_id]) {
|
||||
s->vdr_ref[vdr_rpu_id] = av_buffer_allocz(sizeof(DOVIVdrRef));
|
||||
if (!s->vdr_ref[vdr_rpu_id])
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
vdr = (DOVIVdrRef *) s->vdr_ref[vdr_rpu_id]->data;
|
||||
s->mapping = &vdr->mapping;
|
||||
|
||||
vdr->mapping.vdr_rpu_id = vdr_rpu_id;
|
||||
vdr->mapping.mapping_color_space = get_ue_golomb_31(gb);
|
||||
vdr->mapping.mapping_chroma_format_idc = get_ue_golomb_31(gb);
|
||||
|
||||
for (int c = 0; c < 3; c++) {
|
||||
AVDOVIReshapingCurve *curve = &vdr->mapping.curves[c];
|
||||
int num_pivots_minus_2 = get_ue_golomb_31(gb);
|
||||
int pivot = 0;
|
||||
|
||||
VALIDATE(num_pivots_minus_2, 0, AV_DOVI_MAX_PIECES - 1);
|
||||
curve->num_pivots = num_pivots_minus_2 + 2;
|
||||
for (int i = 0; i < curve->num_pivots; i++) {
|
||||
pivot += get_bits(gb, hdr->bl_bit_depth);
|
||||
curve->pivots[i] = av_clip_uint16(pivot);
|
||||
}
|
||||
}
|
||||
|
||||
if (use_nlq) {
|
||||
vdr->mapping.nlq_method_idc = get_bits(gb, 3);
|
||||
/**
|
||||
* The patent mentions another legal value, NLQ_MU_LAW, but it's
|
||||
* not documented anywhere how to parse or apply that type of NLQ.
|
||||
*/
|
||||
VALIDATE(vdr->mapping.nlq_method_idc, 0, AV_DOVI_NLQ_LINEAR_DZ);
|
||||
} else {
|
||||
vdr->mapping.nlq_method_idc = AV_DOVI_NLQ_NONE;
|
||||
}
|
||||
|
||||
vdr->mapping.num_x_partitions = get_ue_golomb_long(gb) + 1;
|
||||
vdr->mapping.num_y_partitions = get_ue_golomb_long(gb) + 1;
|
||||
/* End of rpu_data_header(), start of vdr_rpu_data_payload() */
|
||||
|
||||
for (int c = 0; c < 3; c++) {
|
||||
AVDOVIReshapingCurve *curve = &vdr->mapping.curves[c];
|
||||
for (int i = 0; i < curve->num_pivots - 1; i++) {
|
||||
int mapping_idc = get_ue_golomb_31(gb);
|
||||
VALIDATE(mapping_idc, 0, 1);
|
||||
curve->mapping_idc[i] = mapping_idc;
|
||||
switch (mapping_idc) {
|
||||
case AV_DOVI_MAPPING_POLYNOMIAL: {
|
||||
int poly_order_minus1 = get_ue_golomb_31(gb);
|
||||
VALIDATE(poly_order_minus1, 0, 1);
|
||||
curve->poly_order[i] = poly_order_minus1 + 1;
|
||||
if (poly_order_minus1 == 0) {
|
||||
int linear_interp_flag = get_bits1(gb);
|
||||
if (linear_interp_flag) {
|
||||
/* lack of documentation/samples */
|
||||
avpriv_request_sample(s->logctx, "Dolby Vision "
|
||||
"linear interpolation");
|
||||
ff_dovi_ctx_unref(s);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
}
|
||||
for (int k = 0; k <= curve->poly_order[i]; k++)
|
||||
curve->poly_coef[i][k] = get_se_coef(gb, hdr);
|
||||
break;
|
||||
}
|
||||
case AV_DOVI_MAPPING_MMR: {
|
||||
int mmr_order_minus1 = get_bits(gb, 2);
|
||||
VALIDATE(mmr_order_minus1, 0, 2);
|
||||
curve->mmr_order[i] = mmr_order_minus1 + 1;
|
||||
curve->mmr_constant[i] = get_se_coef(gb, hdr);
|
||||
for (int j = 0; j < curve->mmr_order[i]; j++) {
|
||||
for (int k = 0; k < 7; k++)
|
||||
curve->mmr_coef[i][j][k] = get_se_coef(gb, hdr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (use_nlq) {
|
||||
for (int c = 0; c < 3; c++) {
|
||||
AVDOVINLQParams *nlq = &vdr->mapping.nlq[c];
|
||||
nlq->nlq_offset = get_bits(gb, hdr->el_bit_depth);
|
||||
nlq->vdr_in_max = get_ue_coef(gb, hdr);
|
||||
switch (vdr->mapping.nlq_method_idc) {
|
||||
case AV_DOVI_NLQ_LINEAR_DZ:
|
||||
nlq->linear_deadzone_slope = get_ue_coef(gb, hdr);
|
||||
nlq->linear_deadzone_threshold = get_ue_coef(gb, hdr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vdr_dm_metadata_present) {
|
||||
AVDOVIColorMetadata *color;
|
||||
int affected_dm_id = get_ue_golomb_31(gb);
|
||||
int current_dm_id = get_ue_golomb_31(gb);
|
||||
VALIDATE(affected_dm_id, 0, DOVI_MAX_DM_ID);
|
||||
VALIDATE(current_dm_id, 0, DOVI_MAX_DM_ID);
|
||||
if (!s->vdr_ref[affected_dm_id]) {
|
||||
s->vdr_ref[affected_dm_id] = av_buffer_allocz(sizeof(DOVIVdrRef));
|
||||
if (!s->vdr_ref[affected_dm_id])
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (!s->vdr_ref[current_dm_id]) {
|
||||
av_log(s->logctx, AV_LOG_ERROR, "Unknown previous RPU DM ID: %u\n",
|
||||
current_dm_id);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Update current pointer based on current_dm_id */
|
||||
vdr = (DOVIVdrRef *) s->vdr_ref[current_dm_id]->data;
|
||||
s->color = &vdr->color;
|
||||
|
||||
/* Update values of affected_dm_id */
|
||||
vdr = (DOVIVdrRef *) s->vdr_ref[affected_dm_id]->data;
|
||||
color = &vdr->color;
|
||||
color->dm_metadata_id = affected_dm_id;
|
||||
color->scene_refresh_flag = get_ue_golomb_31(gb);
|
||||
for (int i = 0; i < 9; i++)
|
||||
color->ycc_to_rgb_matrix[i] = av_make_q(get_sbits(gb, 16), 1 << 13);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int denom = profile == 4 ? (1 << 30) : (1 << 28);
|
||||
unsigned offset = get_bits_long(gb, 32);
|
||||
if (offset > INT_MAX) {
|
||||
/* Ensure the result fits inside AVRational */
|
||||
offset >>= 1;
|
||||
denom >>= 1;
|
||||
}
|
||||
color->ycc_to_rgb_offset[i] = av_make_q(offset, denom);
|
||||
}
|
||||
for (int i = 0; i < 9; i++)
|
||||
color->rgb_to_lms_matrix[i] = av_make_q(get_sbits(gb, 16), 1 << 14);
|
||||
|
||||
color->signal_eotf = get_bits(gb, 16);
|
||||
color->signal_eotf_param0 = get_bits(gb, 16);
|
||||
color->signal_eotf_param1 = get_bits(gb, 16);
|
||||
color->signal_eotf_param2 = get_bits_long(gb, 32);
|
||||
color->signal_bit_depth = get_bits(gb, 5);
|
||||
VALIDATE(color->signal_bit_depth, 8, 16);
|
||||
color->signal_color_space = get_bits(gb, 2);
|
||||
color->signal_chroma_format = get_bits(gb, 2);
|
||||
color->signal_full_range_flag = get_bits(gb, 2);
|
||||
color->source_min_pq = get_bits(gb, 12);
|
||||
color->source_max_pq = get_bits(gb, 12);
|
||||
color->source_diagonal = get_bits(gb, 10);
|
||||
}
|
||||
|
||||
/* FIXME: verify CRC32, requires implementation of AV_CRC_32_MPEG_2 */
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
ff_dovi_ctx_unref(s); /* don't leak potentially invalid state */
|
||||
return AVERROR(EINVAL);
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Dolby Vision RPU decoder
|
||||
*
|
||||
* Copyright (C) 2021 Jan Ekström
|
||||
* Copyright (C) 2021 Niklas Haas
|
||||
*
|
||||
* 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_DOVI_RPU_H
|
||||
#define AVCODEC_DOVI_RPU_H
|
||||
|
||||
#include "libavutil/dovi_meta.h"
|
||||
#include "libavutil/frame.h"
|
||||
|
||||
#define DOVI_MAX_DM_ID 15
|
||||
typedef struct DOVIContext {
|
||||
void *logctx;
|
||||
|
||||
/**
|
||||
* Currently active RPU data header, updates on every dovi_rpu_parse().
|
||||
*/
|
||||
AVDOVIRpuDataHeader header;
|
||||
|
||||
/**
|
||||
* Currently active data mappings, or NULL. Points into memory owned by the
|
||||
* corresponding rpu/vdr_ref, which becomes invalid on the next call to
|
||||
* dovi_rpu_parse.
|
||||
*/
|
||||
const AVDOVIDataMapping *mapping;
|
||||
const AVDOVIColorMetadata *color;
|
||||
|
||||
/**
|
||||
* Private fields internal to dovi_rpu.c
|
||||
*/
|
||||
AVBufferRef *vdr_ref[DOVI_MAX_DM_ID+1];
|
||||
uint8_t dv_profile;
|
||||
|
||||
} DOVIContext;
|
||||
|
||||
int ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0);
|
||||
|
||||
/**
|
||||
* Completely reset a DOVIContext, preserving only logctx.
|
||||
*/
|
||||
void ff_dovi_ctx_unref(DOVIContext *s);
|
||||
|
||||
/**
|
||||
* Partially reset the internal state. Resets per-frame state while preserving
|
||||
* fields parsed from the configuration record.
|
||||
*/
|
||||
void ff_dovi_ctx_flush(DOVIContext *s);
|
||||
|
||||
/**
|
||||
* Read the contents of an AVDOVIDecoderConfigurationRecord (usually provided
|
||||
* by stream side data) and update internal state accordingly.
|
||||
*/
|
||||
void ff_dovi_update_cfg(DOVIContext *s, const AVDOVIDecoderConfigurationRecord *cfg);
|
||||
|
||||
/**
|
||||
* Parse the contents of a Dovi RPU NAL and update the parsed values in the
|
||||
* DOVIContext struct.
|
||||
*
|
||||
* Returns 0 or an error code.
|
||||
*/
|
||||
int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size);
|
||||
|
||||
/**
|
||||
* Attach the decoded AVDOVIMetadata as side data to an AVFrame.
|
||||
*/
|
||||
int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame);
|
||||
|
||||
#endif /* AVCODEC_DOVI_RPU_H */
|
|
@ -823,14 +823,12 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
|
|||
}
|
||||
memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(*clut_table));
|
||||
|
||||
rect->data[0] = av_malloc(region->buf_size);
|
||||
rect->data[0] = av_memdup(region->pbuf, region->buf_size);
|
||||
if (!rect->data[0]) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
memcpy(rect->data[0], region->pbuf, region->buf_size);
|
||||
|
||||
if ((clut == &default_clut && ctx->compute_clut < 0) || ctx->compute_clut == 1) {
|
||||
if (!region->has_computed_clut) {
|
||||
compute_default_clut(ctx, region->computed_clut, rect, rect->w, rect->h);
|
||||
|
@ -1074,12 +1072,10 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx,
|
|||
clut = get_clut(ctx, clut_id);
|
||||
|
||||
if (!clut) {
|
||||
clut = av_malloc(sizeof(*clut));
|
||||
clut = av_memdup(&default_clut, sizeof(*clut));
|
||||
if (!clut)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
memcpy(clut, &default_clut, sizeof(*clut));
|
||||
|
||||
clut->id = clut_id;
|
||||
clut->version = -1;
|
||||
|
||||
|
@ -1719,8 +1715,6 @@ static int dvbsub_decode(AVCodecContext *avctx,
|
|||
|
||||
end:
|
||||
if (ret < 0) {
|
||||
*got_sub_ptr = 0;
|
||||
avsubtitle_free(sub);
|
||||
return ret;
|
||||
} else {
|
||||
if (ctx->compute_edt == 1)
|
||||
|
|
|
@ -399,8 +399,8 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
|
|||
int retried = 0;
|
||||
int sta;
|
||||
|
||||
av_assert1((((int) mb_bit_buffer) & 7) == 0);
|
||||
av_assert1((((int) vs_bit_buffer) & 7) == 0);
|
||||
av_assert1((((uintptr_t) mb_bit_buffer) & 7) == 0);
|
||||
av_assert1((((uintptr_t) vs_bit_buffer) & 7) == 0);
|
||||
|
||||
retry:
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
* Tables taken directly from the E-AC-3 spec.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "eac3_data.h"
|
||||
#include "ac3.h"
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "idctdsp.h"
|
||||
#include "internal.h"
|
||||
#include "mpeg12.h"
|
||||
#include "mpeg12data.h"
|
||||
|
||||
typedef struct TqiContext {
|
||||
AVCodecContext *avctx;
|
||||
|
|
|
@ -247,11 +247,8 @@ end:
|
|||
if (ret < 0 || !got_packet)
|
||||
av_packet_unref(avpkt);
|
||||
|
||||
if (frame) {
|
||||
if (!ret)
|
||||
avctx->frame_number++;
|
||||
if (frame)
|
||||
av_frame_unref(frame);
|
||||
}
|
||||
|
||||
if (got_packet)
|
||||
// Encoders must always return ref-counted buffers.
|
||||
|
@ -366,7 +363,7 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame
|
|||
if (avci->draining)
|
||||
return AVERROR_EOF;
|
||||
|
||||
if (avci->buffer_frame->data[0])
|
||||
if (avci->buffer_frame->buf[0])
|
||||
return AVERROR(EAGAIN);
|
||||
|
||||
if (!frame) {
|
||||
|
@ -383,6 +380,8 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame
|
|||
return ret;
|
||||
}
|
||||
|
||||
avctx->frame_number++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -476,8 +476,6 @@ static void guess_mv(ERContext *s)
|
|||
none_left = 1;
|
||||
changed = 1;
|
||||
for (pass = 0; (changed || pass < 2) && pass < 10; pass++) {
|
||||
int score_sum = 0;
|
||||
|
||||
changed = 0;
|
||||
for (blocklist_index = 0; blocklist_index < blocklist_length; blocklist_index++) {
|
||||
const int mb_x = blocklist[blocklist_index][0];
|
||||
|
@ -668,7 +666,6 @@ skip_mean_and_median:
|
|||
best_pred = j;
|
||||
}
|
||||
}
|
||||
score_sum += best_score;
|
||||
s->mv[0][0][0] = mv_predictor[best_pred][0];
|
||||
s->mv[0][0][1] = mv_predictor[best_pred][1];
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ av_cold int ff_ffv1_common_init(AVCodecContext *avctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
|
||||
av_cold int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1Context *fs)
|
||||
{
|
||||
int j, i;
|
||||
|
||||
|
@ -170,7 +170,7 @@ int ff_ffv1_allocate_initial_states(FFV1Context *f)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ff_ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs)
|
||||
void ff_ffv1_clear_slice_state(const FFV1Context *f, FFV1Context *fs)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
|
|
@ -139,11 +139,11 @@ typedef struct FFV1Context {
|
|||
} FFV1Context;
|
||||
|
||||
int ff_ffv1_common_init(AVCodecContext *avctx);
|
||||
int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs);
|
||||
int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1Context *fs);
|
||||
int ff_ffv1_init_slices_state(FFV1Context *f);
|
||||
int ff_ffv1_init_slice_contexts(FFV1Context *f);
|
||||
int ff_ffv1_allocate_initial_states(FFV1Context *f);
|
||||
void ff_ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs);
|
||||
void ff_ffv1_clear_slice_state(const FFV1Context *f, FFV1Context *fs);
|
||||
int ff_ffv1_close(AVCodecContext *avctx);
|
||||
|
||||
static av_always_inline int fold(int diff, int bits)
|
||||
|
|
|
@ -161,7 +161,7 @@ static int decode_plane(FFV1Context *s, uint8_t *src,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
|
||||
static int decode_slice_header(const FFV1Context *f, FFV1Context *fs)
|
||||
{
|
||||
RangeCoder *c = &fs->c;
|
||||
uint8_t state[CONTEXT_SIZE];
|
||||
|
@ -924,7 +924,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
|||
fs->c.bytestream_end = buf_p + v;
|
||||
|
||||
fs->avctx = avctx;
|
||||
fs->cur = p;
|
||||
}
|
||||
|
||||
avctx->execute(avctx,
|
||||
|
@ -965,11 +964,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
|||
}
|
||||
ff_thread_report_progress(&f->picture, INT_MAX, 0);
|
||||
|
||||
f->picture_number++;
|
||||
|
||||
if (f->last_picture.f)
|
||||
ff_thread_release_buffer(avctx, &f->last_picture);
|
||||
f->cur = NULL;
|
||||
if ((ret = av_frame_ref(data, f->picture.f)) < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -978,7 +974,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
|||
return buf_size;
|
||||
}
|
||||
|
||||
static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsrc)
|
||||
static void copy_fields(FFV1Context *fsdst, const FFV1Context *fssrc,
|
||||
const FFV1Context *fsrc)
|
||||
{
|
||||
fsdst->version = fsrc->version;
|
||||
fsdst->micro_version = fsrc->micro_version;
|
||||
|
@ -995,7 +992,6 @@ static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsr
|
|||
fsdst->slice_damaged = fssrc->slice_damaged;
|
||||
fsdst->key_frame_ok = fsrc->key_frame_ok;
|
||||
|
||||
fsdst->bits_per_raw_sample = fsrc->bits_per_raw_sample;
|
||||
fsdst->packed_at_lsb = fsrc->packed_at_lsb;
|
||||
fsdst->slice_count = fsrc->slice_count;
|
||||
if (fsrc->version<3){
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
#include "encode.h"
|
||||
#include "internal.h"
|
||||
#include "put_bits.h"
|
||||
#include "put_golomb.h"
|
||||
#include "rangecoder.h"
|
||||
#include "golomb.h"
|
||||
#include "mathops.h"
|
||||
#include "ffv1.h"
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/crc.h"
|
||||
#include "libavutil/fifo.h"
|
||||
#include "bytestream.h"
|
||||
#include "parser.h"
|
||||
#include "flac.h"
|
||||
|
@ -55,6 +54,15 @@
|
|||
|
||||
/** largest possible size of flac header */
|
||||
#define MAX_FRAME_HEADER_SIZE 16
|
||||
#define MAX_FRAME_VERIFY_SIZE (MAX_FRAME_HEADER_SIZE + 1)
|
||||
|
||||
typedef struct FifoBuffer {
|
||||
uint8_t *buffer;
|
||||
uint8_t *end;
|
||||
uint8_t *rptr;
|
||||
uint8_t *wptr;
|
||||
int empty;
|
||||
} FifoBuffer;
|
||||
|
||||
typedef struct FLACHeaderMarker {
|
||||
int offset; /**< byte offset from start of FLACParseContext->buffer */
|
||||
|
@ -83,7 +91,7 @@ typedef struct FLACParseContext {
|
|||
int nb_headers_buffered; /**< number of headers that are buffered */
|
||||
int best_header_valid; /**< flag set when the parser returns junk;
|
||||
if set return best_header next time */
|
||||
AVFifoBuffer *fifo_buf; /**< buffer to store all data until headers
|
||||
FifoBuffer fifo_buf; /**< buffer to store all data until headers
|
||||
can be verified */
|
||||
int end_padded; /**< specifies if fifo_buf's end is padded */
|
||||
uint8_t *wrap_buf; /**< general fifo read buffer when wrapped */
|
||||
|
@ -99,7 +107,7 @@ static int frame_header_is_valid(AVCodecContext *avctx, const uint8_t *buf,
|
|||
uint8_t subframe_type;
|
||||
|
||||
// header plus one byte from first subframe
|
||||
init_get_bits(&gb, buf, MAX_FRAME_HEADER_SIZE * 8 + 8);
|
||||
init_get_bits(&gb, buf, MAX_FRAME_VERIFY_SIZE * 8);
|
||||
if (ff_flac_decode_frame_header(avctx, &gb, fi, 127)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -126,6 +134,18 @@ static int frame_header_is_valid(AVCodecContext *avctx, const uint8_t *buf,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static size_t flac_fifo_size(const FifoBuffer *f)
|
||||
{
|
||||
if (f->wptr <= f->rptr && !f->empty)
|
||||
return (f->wptr - f->buffer) + (f->end - f->rptr);
|
||||
return f->wptr - f->rptr;
|
||||
}
|
||||
|
||||
static size_t flac_fifo_space(const FifoBuffer *f)
|
||||
{
|
||||
return f->end - f->buffer - flac_fifo_size(f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-destructive fast fifo pointer fetching
|
||||
* Returns a pointer from the specified offset.
|
||||
|
@ -142,7 +162,7 @@ static int frame_header_is_valid(AVCodecContext *avctx, const uint8_t *buf,
|
|||
static uint8_t *flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len,
|
||||
uint8_t **wrap_buf, int *allocated_size)
|
||||
{
|
||||
AVFifoBuffer *f = fpc->fifo_buf;
|
||||
FifoBuffer *f = &fpc->fifo_buf;
|
||||
uint8_t *start = f->rptr + offset;
|
||||
uint8_t *tmp_buf;
|
||||
|
||||
|
@ -179,9 +199,8 @@ static uint8_t *flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len,
|
|||
* A second call to flac_fifo_read (with new offset and len) should be called
|
||||
* to get the post-wrap buf if the returned len is less than the requested.
|
||||
**/
|
||||
static uint8_t *flac_fifo_read(FLACParseContext *fpc, int offset, int *len)
|
||||
static uint8_t *flac_fifo_read(FifoBuffer *f, int offset, int *len)
|
||||
{
|
||||
AVFifoBuffer *f = fpc->fifo_buf;
|
||||
uint8_t *start = f->rptr + offset;
|
||||
|
||||
if (start >= f->end)
|
||||
|
@ -190,13 +209,115 @@ static uint8_t *flac_fifo_read(FLACParseContext *fpc, int offset, int *len)
|
|||
return start;
|
||||
}
|
||||
|
||||
static int flac_fifo_grow(FifoBuffer *f, size_t inc)
|
||||
{
|
||||
size_t size_old = f->end - f->buffer;
|
||||
size_t offset_r = f->rptr - f->buffer;
|
||||
size_t offset_w = f->wptr - f->buffer;
|
||||
size_t size_new;
|
||||
|
||||
uint8_t *tmp;
|
||||
|
||||
if (size_old > SIZE_MAX - inc)
|
||||
return AVERROR(EINVAL);
|
||||
size_new = size_old + inc;
|
||||
|
||||
tmp = av_realloc(f->buffer, size_new);
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
// move the data from the beginning of the ring buffer
|
||||
// to the newly allocated space
|
||||
if (offset_w <= offset_r && !f->empty) {
|
||||
const size_t copy = FFMIN(inc, offset_w);
|
||||
memcpy(tmp + size_old, tmp, copy);
|
||||
if (copy < offset_w) {
|
||||
memmove(tmp, tmp + copy, offset_w - copy);
|
||||
offset_w -= copy;
|
||||
} else
|
||||
offset_w = size_old + copy;
|
||||
}
|
||||
|
||||
f->buffer = tmp;
|
||||
f->end = f->buffer + size_new;
|
||||
f->rptr = f->buffer + offset_r;
|
||||
f->wptr = f->buffer + offset_w;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int flac_fifo_write(FifoBuffer *f, const uint8_t *src, size_t size)
|
||||
{
|
||||
uint8_t *wptr;
|
||||
|
||||
if (flac_fifo_space(f) < size) {
|
||||
int ret = flac_fifo_grow(f, FFMAX(flac_fifo_size(f), size));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (size)
|
||||
f->empty = 0;
|
||||
|
||||
wptr = f->wptr;
|
||||
do {
|
||||
size_t len = FFMIN(f->end - wptr, size);
|
||||
memcpy(wptr, src, len);
|
||||
src += len;
|
||||
wptr += len;
|
||||
if (wptr >= f->end)
|
||||
wptr = f->buffer;
|
||||
size -= len;
|
||||
} while (size > 0);
|
||||
|
||||
f->wptr = wptr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void flac_fifo_drain(FifoBuffer *f, size_t size)
|
||||
{
|
||||
size_t size_cur = flac_fifo_size(f);
|
||||
|
||||
av_assert0(size_cur >= size);
|
||||
if (size_cur == size)
|
||||
f->empty = 1;
|
||||
|
||||
f->rptr += size;
|
||||
if (f->rptr >= f->end)
|
||||
f->rptr -= f->end - f->buffer;
|
||||
}
|
||||
|
||||
static int flac_fifo_alloc(FifoBuffer *f, size_t size)
|
||||
{
|
||||
memset(f, 0, sizeof(*f));
|
||||
|
||||
f->buffer = av_realloc(NULL, size);
|
||||
if (!f->buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
f->wptr = f->buffer;
|
||||
f->rptr = f->buffer;
|
||||
f->end = f->buffer + size;
|
||||
|
||||
f->empty = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void flac_fifo_free(FifoBuffer *f)
|
||||
{
|
||||
av_freep(&f->buffer);
|
||||
memset(f, 0, sizeof(*f));
|
||||
}
|
||||
|
||||
static int find_headers_search_validate(FLACParseContext *fpc, int offset)
|
||||
{
|
||||
FLACFrameInfo fi;
|
||||
uint8_t *header_buf;
|
||||
int size = 0;
|
||||
header_buf = flac_fifo_read_wrap(fpc, offset,
|
||||
MAX_FRAME_HEADER_SIZE,
|
||||
MAX_FRAME_VERIFY_SIZE + AV_INPUT_BUFFER_PADDING_SIZE,
|
||||
&fpc->wrap_buf,
|
||||
&fpc->wrap_buf_allocated_size);
|
||||
if (frame_header_is_valid(fpc->avctx, header_buf, &fi)) {
|
||||
|
@ -262,9 +383,9 @@ static int find_new_headers(FLACParseContext *fpc, int search_start)
|
|||
fpc->nb_headers_found = 0;
|
||||
|
||||
/* Search for a new header of at most 16 bytes. */
|
||||
search_end = av_fifo_size(fpc->fifo_buf) - (MAX_FRAME_HEADER_SIZE - 1);
|
||||
search_end = flac_fifo_size(&fpc->fifo_buf) - (MAX_FRAME_HEADER_SIZE - 1);
|
||||
read_len = search_end - search_start + 1;
|
||||
buf = flac_fifo_read(fpc, search_start, &read_len);
|
||||
buf = flac_fifo_read(&fpc->fifo_buf, search_start, &read_len);
|
||||
size = find_headers_search(fpc, buf, read_len, search_start);
|
||||
search_start += read_len - 1;
|
||||
|
||||
|
@ -276,7 +397,7 @@ static int find_new_headers(FLACParseContext *fpc, int search_start)
|
|||
/* search_start + 1 is the post-wrap offset in the fifo. */
|
||||
read_len = search_end - (search_start + 1) + 1;
|
||||
|
||||
buf = flac_fifo_read(fpc, search_start + 1, &read_len);
|
||||
buf = flac_fifo_read(&fpc->fifo_buf, search_start + 1, &read_len);
|
||||
wrap[1] = buf[0];
|
||||
|
||||
if ((AV_RB16(wrap) & 0xFFFE) == 0xFFF8) {
|
||||
|
@ -405,12 +526,12 @@ static int check_header_mismatch(FLACParseContext *fpc,
|
|||
}
|
||||
|
||||
read_len = end->offset - start->offset;
|
||||
buf = flac_fifo_read(fpc, start->offset, &read_len);
|
||||
buf = flac_fifo_read(&fpc->fifo_buf, start->offset, &read_len);
|
||||
crc = av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf, read_len);
|
||||
read_len = (end->offset - start->offset) - read_len;
|
||||
|
||||
if (read_len) {
|
||||
buf = flac_fifo_read(fpc, end->offset - read_len, &read_len);
|
||||
buf = flac_fifo_read(&fpc->fifo_buf, end->offset - read_len, &read_len);
|
||||
crc = av_crc(av_crc_get_table(AV_CRC_16_ANSI), crc, buf, read_len);
|
||||
}
|
||||
}
|
||||
|
@ -499,7 +620,7 @@ static int get_best_header(FLACParseContext *fpc, const uint8_t **poutbuf,
|
|||
FLACHeaderMarker *header = fpc->best_header;
|
||||
FLACHeaderMarker *child = header->best_child;
|
||||
if (!child) {
|
||||
*poutbuf_size = av_fifo_size(fpc->fifo_buf) - header->offset;
|
||||
*poutbuf_size = flac_fifo_size(&fpc->fifo_buf) - header->offset;
|
||||
} else {
|
||||
*poutbuf_size = child->offset - header->offset;
|
||||
|
||||
|
@ -518,7 +639,6 @@ static int get_best_header(FLACParseContext *fpc, const uint8_t **poutbuf,
|
|||
&fpc->wrap_buf,
|
||||
&fpc->wrap_buf_allocated_size);
|
||||
|
||||
|
||||
if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS) {
|
||||
if (header->fi.is_var_size)
|
||||
fpc->pc->pts = header->fi.frame_or_sample_num;
|
||||
|
@ -533,7 +653,7 @@ static int get_best_header(FLACParseContext *fpc, const uint8_t **poutbuf,
|
|||
/* Return the negative overread index so the client can compute pos.
|
||||
This should be the amount overread to the beginning of the child */
|
||||
if (child)
|
||||
return child->offset - av_fifo_size(fpc->fifo_buf);
|
||||
return child->offset - flac_fifo_size(&fpc->fifo_buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -585,7 +705,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
|||
fpc->nb_headers_buffered--;
|
||||
}
|
||||
/* Release returned data from ring buffer. */
|
||||
av_fifo_drain(fpc->fifo_buf, best_child->offset);
|
||||
flac_fifo_drain(&fpc->fifo_buf, best_child->offset);
|
||||
|
||||
/* Fix the offset for the headers remaining to match the new buffer. */
|
||||
for (curr = best_child->next; curr; curr = curr->next)
|
||||
|
@ -619,7 +739,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
|||
while ((buf_size && read_end < buf + buf_size &&
|
||||
fpc->nb_headers_buffered < FLAC_MIN_HEADERS)
|
||||
|| (!buf_size && !fpc->end_padded)) {
|
||||
int start_offset;
|
||||
int start_offset, ret;
|
||||
|
||||
/* Pad the end once if EOF, to check the final region for headers. */
|
||||
if (!buf_size) {
|
||||
|
@ -633,8 +753,8 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
|||
nb_desired * FLAC_AVG_FRAME_SIZE);
|
||||
}
|
||||
|
||||
if (!av_fifo_space(fpc->fifo_buf) &&
|
||||
av_fifo_size(fpc->fifo_buf) / FLAC_AVG_FRAME_SIZE >
|
||||
if (!flac_fifo_space(&fpc->fifo_buf) &&
|
||||
flac_fifo_size(&fpc->fifo_buf) / FLAC_AVG_FRAME_SIZE >
|
||||
fpc->nb_headers_buffered * 20) {
|
||||
/* There is less than one valid flac header buffered for 20 headers
|
||||
* buffered. Therefore the fifo is most likely filled with invalid
|
||||
|
@ -643,24 +763,20 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
|||
}
|
||||
|
||||
/* Fill the buffer. */
|
||||
if ( av_fifo_space(fpc->fifo_buf) < read_end - read_start
|
||||
&& av_fifo_realloc2(fpc->fifo_buf, (read_end - read_start) + 2*av_fifo_size(fpc->fifo_buf)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"couldn't reallocate buffer of size %"PTRDIFF_SPECIFIER"\n",
|
||||
(read_end - read_start) + av_fifo_size(fpc->fifo_buf));
|
||||
if (buf_size) {
|
||||
ret = flac_fifo_write(&fpc->fifo_buf, read_start,
|
||||
read_end - read_start);
|
||||
} else {
|
||||
int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };
|
||||
ret = flac_fifo_write(&fpc->fifo_buf, pad, sizeof(pad));
|
||||
}
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error buffering data\n");
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
if (buf_size) {
|
||||
av_fifo_generic_write(fpc->fifo_buf, (void*) read_start,
|
||||
read_end - read_start, NULL);
|
||||
} else {
|
||||
int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };
|
||||
av_fifo_generic_write(fpc->fifo_buf, pad, sizeof(pad), NULL);
|
||||
}
|
||||
|
||||
/* Tag headers and update sequences. */
|
||||
start_offset = av_fifo_size(fpc->fifo_buf) -
|
||||
start_offset = flac_fifo_size(&fpc->fifo_buf) -
|
||||
((read_end - read_start) + (MAX_FRAME_HEADER_SIZE - 1));
|
||||
start_offset = FFMAX(0, start_offset);
|
||||
nb_headers = find_new_headers(fpc, start_offset);
|
||||
|
@ -688,14 +804,15 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
|||
|
||||
/* restore the state pre-padding */
|
||||
if (fpc->end_padded) {
|
||||
int warp = fpc->fifo_buf->wptr - fpc->fifo_buf->buffer < MAX_FRAME_HEADER_SIZE;
|
||||
int empty = flac_fifo_size(&fpc->fifo_buf) == MAX_FRAME_HEADER_SIZE;
|
||||
int warp = fpc->fifo_buf.wptr - fpc->fifo_buf.buffer < MAX_FRAME_HEADER_SIZE;
|
||||
/* HACK: drain the tail of the fifo */
|
||||
fpc->fifo_buf->wptr -= MAX_FRAME_HEADER_SIZE;
|
||||
fpc->fifo_buf->wndx -= MAX_FRAME_HEADER_SIZE;
|
||||
fpc->fifo_buf.wptr -= MAX_FRAME_HEADER_SIZE;
|
||||
if (warp) {
|
||||
fpc->fifo_buf->wptr += fpc->fifo_buf->end -
|
||||
fpc->fifo_buf->buffer;
|
||||
fpc->fifo_buf.wptr += fpc->fifo_buf.end -
|
||||
fpc->fifo_buf.buffer;
|
||||
}
|
||||
fpc->fifo_buf.empty = empty;
|
||||
read_start = read_end = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -726,7 +843,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
|||
&fpc->wrap_buf,
|
||||
&fpc->wrap_buf_allocated_size);
|
||||
return buf_size ? (read_end - buf) : (fpc->best_header->offset -
|
||||
av_fifo_size(fpc->fifo_buf));
|
||||
flac_fifo_size(&fpc->fifo_buf));
|
||||
}
|
||||
if (!buf_size)
|
||||
return get_best_header(fpc, poutbuf, poutbuf_size);
|
||||
|
@ -741,11 +858,13 @@ handle_error:
|
|||
static av_cold int flac_parse_init(AVCodecParserContext *c)
|
||||
{
|
||||
FLACParseContext *fpc = c->priv_data;
|
||||
int ret;
|
||||
|
||||
fpc->pc = c;
|
||||
/* There will generally be FLAC_MIN_HEADERS buffered in the fifo before
|
||||
it drains. This is allocated early to avoid slow reallocation. */
|
||||
fpc->fifo_buf = av_fifo_alloc_array(FLAC_MIN_HEADERS + 3, FLAC_AVG_FRAME_SIZE);
|
||||
if (!fpc->fifo_buf) {
|
||||
ret = flac_fifo_alloc(&fpc->fifo_buf, (FLAC_MIN_HEADERS + 3) * FLAC_AVG_FRAME_SIZE);
|
||||
if (ret < 0) {
|
||||
av_log(fpc->avctx, AV_LOG_ERROR,
|
||||
"couldn't allocate fifo_buf\n");
|
||||
return AVERROR(ENOMEM);
|
||||
|
@ -764,7 +883,7 @@ static void flac_parse_close(AVCodecParserContext *c)
|
|||
curr = temp;
|
||||
}
|
||||
fpc->headers = NULL;
|
||||
av_fifo_freep(&fpc->fifo_buf);
|
||||
flac_fifo_free(&fpc->fifo_buf);
|
||||
av_freep(&fpc->wrap_buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "bswapdsp.h"
|
||||
#include "encode.h"
|
||||
#include "put_bits.h"
|
||||
#include "golomb.h"
|
||||
#include "put_golomb.h"
|
||||
#include "internal.h"
|
||||
#include "lpc.h"
|
||||
#include "flac.h"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue