diff --git a/.circleci/config.yml b/.circleci/config.yml index 518e1bb575..c9620e7228 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -123,6 +123,28 @@ jobs: - run: | echo "Build SRS C++98(ANSI), no FFmpeg-fit" && cd trunk && ./configure --cxx11=off --cxx14=off --ffmpeg-fit=off && make + build-cross-build-armv7: + docker: + - image: ossrs/srs:ubuntu16 + steps: + - checkout + - run: | + echo "Cross build SRS for armv7" && + cd trunk && + ./configure --cross-build --cc=arm-linux-gnueabihf-gcc --cxx=arm-linux-gnueabihf-g++ \ + --ar=arm-linux-gnueabihf-ar --ld=arm-linux-gnueabihf-ld --randlib=arm-linux-gnueabihf-randlib && + make + build-cross-build-aarch64: + docker: + - image: ossrs/srs:ubuntu16 + steps: + - checkout + - run: | + echo "Cross build SRS for aarch64" && + cd trunk && + ./configure --cross-build --cc=aarch64-linux-gnu-gcc --cxx=aarch64-linux-gnu-g++ \ + --ar=aarch64-linux-gnu-ar --ld=aarch64-linux-gnu-ld --randlib=aarch64-linux-gnu-randlib && + make workflows: version: 2 build_and_test: @@ -142,3 +164,5 @@ workflows: - build-u20-baseline - build-u20-srt - build-c7-ansi-noff + - build-cross-build-armv7 + - build-cross-build-aarch64 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef2d6692f..c2020689b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2021-06-22, Squash: Support ARM platform. 5.0.5 * v5.0, 2021-06-16, Change [GB28181](https://github.com/ossrs/srs/issues/1500) to [feature/gb28181](https://github.com/ossrs/srs/tree/feature/gb28181). 5.0.4 * v5.0, 2021-05-31, Use [SPDX-License-Identifier: MIT](https://spdx.dev/ids/). 5.0.3 * v5.0, 2021-05-19, ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 @@ -16,6 +17,10 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-06-21, Fix [#2413](https://github.com/ossrs/srs/issues/2413), fix RTMP to RTC bug 4.0.130 +* v4.0, 2021-06-20, Guess where FFmpeg is. 4.0.129 +* v4.0, 2021-06-20, Fix [#1685](https://github.com/ossrs/srs/issues/1685), support RTC cross-build for armv7/armv8(aarch64). 4.0.128 +* v4.0, 2021-06-17, Fix [#2214](https://github.com/ossrs/srs/issues/2214), remove detection for gmc and gmp. * v4.0, 2021-06-16, Change [GB28181](https://github.com/ossrs/srs/issues/1500) to [feature/gb28181](https://github.com/ossrs/srs/tree/feature/gb28181). 4.0.127 * v4.0, 2021-06-01, Support --shared-ffmpeg to link with *.so for LGPL license. 4.0.126 * v4.0, 2021-06-01, Support --shared-srt to link with *.so for MPL license. 4.0.125 diff --git a/README.md b/README.md index b3d4dea6cf..cc2c49675d 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ ![](http://ossrs.net/gif/v1/sls.gif?site=github.com&path=/srs/develop) [![](https://circleci.com/gh/ossrs/srs/tree/develop.svg?style=svg&circle-token=1ef1d5b5b0cde6c8c282ed856a18199f9e8f85a9)](https://circleci.com/gh/ossrs/srs/tree/develop) [![](https://codecov.io/gh/ossrs/srs/branch/develop/graph/badge.svg)](https://codecov.io/gh/ossrs/srs/branch/develop) -[![](https://cloud.githubusercontent.com/assets/2777660/22814959/c51cbe72-ef92-11e6-81cc-32b657b285d5.png)](https://github.com/ossrs/srs/wiki/v1_CN_Contact#wechat) +[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/wechat-badge.png)](../../wikis/Contact#wechat) +[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/bbs.png)](http://bbs.ossrs.net) SRS/4.0,[Leo][release4],是一个简单高效的实时视频服务器,支持RTMP/WebRTC/HLS/HTTP-FLV/SRT。 diff --git a/trunk/3rdparty/copy_to_gits.sh b/trunk/3rdparty/copy_to_gits.sh deleted file mode 100755 index d92d3a2ba7..0000000000 --- a/trunk/3rdparty/copy_to_gits.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -if [[ ! -d signaling ]]; then - cd 3rdparty -fi -if [[ ! -d signaling ]]; then - echo "no 3rdparty" - exit -1 -fi -if [[ ! -d ~/git/signaling ]]; then - echo "no signaling" - exit -1 -fi - -echo "Copy signaling" -cp -R signaling/* ~/git/signaling/ && (cd ~/git/signaling && git st) - -echo "Copy httpx-static" -cp -R httpx-static/* ~/git/go-oryx/httpx-static/ && (cd ~/git/go-oryx && git st) - -echo "Copy srs-bench" -cp -R srs-bench/* ~/git/srs-bench/ && (cd ~/git/srs-bench && git st) diff --git a/trunk/3rdparty/ffmpeg-4-fit/LICENSE.md b/trunk/3rdparty/ffmpeg-4-fit/LICENSE.md index 613070e1b6..ba65b059c5 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/LICENSE.md +++ b/trunk/3rdparty/ffmpeg-4-fit/LICENSE.md @@ -21,11 +21,10 @@ Specifically, the GPL parts of FFmpeg are: - `compat/solaris/make_sunver.pl` - `doc/t2h.pm` - `doc/texi2pod.pl` - - `libswresample/tests/swresample.c` + - `libswresample/swresample-test.c` - `tests/checkasm/*` - `tests/tiny_ssim.c` - the following filters in libavfilter: - - `signature_lookup.c` - `vf_blackframe.c` - `vf_boxblur.c` - `vf_colormatrix.c` @@ -35,13 +34,13 @@ Specifically, the GPL parts of FFmpeg are: - `vf_eq.c` - `vf_find_rect.c` - `vf_fspp.c` + - `vf_geq.c` - `vf_histeq.c` - `vf_hqdn3d.c` + - `vf_interlace.c` - `vf_kerndeint.c` - - `vf_lensfun.c` (GPL version 3 or later) - `vf_mcdeint.c` - `vf_mpdecimate.c` - - `vf_nnedi.c` - `vf_owdenoise.c` - `vf_perspective.c` - `vf_phase.c` @@ -50,14 +49,12 @@ Specifically, the GPL parts of FFmpeg are: - `vf_pullup.c` - `vf_repeatfields.c` - `vf_sab.c` - - `vf_signature.c` - `vf_smartblur.c` - `vf_spp.c` - `vf_stereo3d.c` - `vf_super2xsai.c` - `vf_tinterlace.c` - `vf_uspp.c` - - `vf_vaguedenoiser.c` - `vsrc_mptestsrc.c` Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then @@ -83,47 +80,41 @@ affect the licensing of binaries resulting from the combination. ### Compatible libraries -The following libraries are under GPL version 2: -- avisynth +The following libraries are under GPL: - frei0r - libcdio -- libdavs2 - librubberband - libvidstab - libx264 - libx265 - libxavs -- libxavs2 - libxvid When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by passing `--enable-gpl` to configure. -The following libraries are under LGPL version 3: -- gmp -- libaribb24 -- liblensfun - -When combining them with FFmpeg, use the configure option `--enable-version3` to -upgrade FFmpeg to the LGPL v3. - -The VMAF, mbedTLS, RK MPI, OpenCORE and VisualOn libraries are under the Apache License -2.0. That license is incompatible with the LGPL v2.1 and the GPL v2, but not with +The OpenCORE and VisualOn libraries are under the Apache License 2.0. That +license is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of those licenses. So to combine these libraries with FFmpeg, the license version needs to be upgraded by passing `--enable-version3` to configure. -The smbclient library is under the GPL v3, to combine it with FFmpeg, -the options `--enable-gpl` and `--enable-version3` have to be passed to -configure to upgrade FFmpeg to the GPL v3. - ### Incompatible libraries There are certain libraries you can combine with FFmpeg whose licenses are not compatible with the GPL and/or the LGPL. If you wish to enable these libraries, even in circumstances that their license may be incompatible, pass -`--enable-nonfree` to configure. This will cause the resulting binary to be +`--enable-nonfree` to configure. But note that if you enable any of these +libraries the resulting binary will be under a complex license mix that is +more restrictive than the LGPL and that may result in additional obligations. +It is possible that these restrictions cause the resulting binary to be unredistributable. The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which are incompatible with the GPLv2 and v3. To the best of our knowledge, they are compatible with the LGPL. + +The NVENC library, while its header file is licensed under the compatible MIT +license, requires a proprietary binary blob at run time, and is deemed to be +incompatible with the GPL. We are not certain if it is compatible with the +LGPL, but we require `--enable-nonfree` even with LGPL configurations in case +it is not. diff --git a/trunk/3rdparty/ffmpeg-4-fit/Makefile b/trunk/3rdparty/ffmpeg-4-fit/Makefile index 8bf04c169d..33ddc2a510 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/Makefile +++ b/trunk/3rdparty/ffmpeg-4-fit/Makefile @@ -49,9 +49,6 @@ $(TOOLS): %$(EXESUF): %.o target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) -tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS) - $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) - tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS) tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS) tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS) @@ -133,7 +130,7 @@ uninstall-data: clean:: $(RM) $(CLEANSUFFIXES) - $(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES)) $(addprefix compat/*/*/,$(CLEANSUFFIXES)) + $(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES)) $(RM) -r coverage-html $(RM) -rf coverage.info coverage.info.in lcov @@ -147,14 +144,15 @@ distclean:: clean ifeq ($(SRC_LINK),src) $(RM) src endif + $(RM) -rf doc/examples/pc-uninstalled config: $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) -build: all alltools testprogs -check: all alltools testprogs fate +build: all alltools examples testprogs +check: all alltools examples testprogs fate -$(sort $(OUTDIRS)): +$(sort $(OBJDIRS)): $(Q)mkdir -p $@ # Dummy rule to stop make trying to rebuild removed or renamed headers diff --git a/trunk/3rdparty/ffmpeg-4-fit/configure b/trunk/3rdparty/ffmpeg-4-fit/configure index b950783be3..c9666891af 100755 --- a/trunk/3rdparty/ffmpeg-4-fit/configure +++ b/trunk/3rdparty/ffmpeg-4-fit/configure @@ -218,7 +218,6 @@ External library support: --enable-jni enable JNI support [no] --enable-ladspa enable LADSPA audio filtering [no] --enable-libaom enable AV1 video encoding/decoding via libaom [no] - --enable-libaribb24 enable ARIB text and caption decoding via libaribb24 [no] --enable-libass enable libass subtitles rendering, needed for subtitles and ass filter [no] --enable-libbluray enable BluRay reading using libbluray [no] @@ -227,7 +226,6 @@ External library support: --enable-libcelt enable CELT decoding via libcelt [no] --enable-libcdio enable audio CD grabbing with libcdio [no] --enable-libcodec2 enable codec2 en/decoding using libcodec2 [no] - --enable-libdav1d enable AV1 decoding via libdav1d [no] --enable-libdavs2 enable AVS2 decoding via libdavs2 [no] --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 and libraw1394 [no] @@ -298,6 +296,7 @@ External library support: --enable-lv2 enable LV2 audio filtering [no] --disable-lzma disable lzma [autodetect] --enable-decklink enable Blackmagic DeckLink I/O support [no] + --enable-libndi_newtek enable Newteck NDI I/O support [no] --enable-mbedtls enable mbedTLS, needed for https support if openssl, gnutls or libtls is not used [no] --enable-mediacodec enable Android MediaCodec support [no] @@ -307,7 +306,6 @@ External library support: --enable-opengl enable OpenGL rendering [no] --enable-openssl enable openssl, needed for https support if gnutls, libtls or mbedtls is not used [no] - --enable-pocketsphinx enable PocketSphinx, needed for asr filter [no] --disable-sndio disable sndio support [autodetect] --disable-schannel disable SChannel SSP, needed for TLS support on Windows if openssl and gnutls are not used [autodetect] @@ -321,8 +319,7 @@ External library support: The following libraries provide various hardware acceleration features: --disable-amf disable AMF video encoding code [autodetect] --disable-audiotoolbox disable Apple AudioToolbox code [autodetect] - --enable-cuda-nvcc enable Nvidia CUDA compiler [no] - --disable-cuda-llvm disable CUDA compilation using clang [autodetect] + --enable-cuda-sdk enable CUDA features that require the CUDA SDK [no] --disable-cuvid disable Nvidia CUVID support [autodetect] --disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect] --disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect] @@ -371,7 +368,7 @@ Toolchain options: --cxx=CXX use C compiler CXX [$cxx_default] --objcc=OCC use ObjC compiler OCC [$cc_default] --dep-cc=DEPCC use dependency generator DEPCC [$cc_default] - --nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default] + --nvcc=NVCC use Nvidia CUDA compiler NVCC [$nvcc_default] --ld=LD use linker LD [$ld_default] --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default] --pkg-config-flags=FLAGS pass additional flags to pkgconf [] @@ -382,7 +379,7 @@ Toolchain options: --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host --host-ld=HOSTLD use host linker HOSTLD --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host - --host-extralibs=HLIBS use libs HLIBS when linking for host + --host-libs=HLIBS use libs HLIBS when linking for host --host-os=OS compiler host OS [$target_os] --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS] @@ -442,7 +439,6 @@ Optimization options (experts only): --disable-mipsdsp disable MIPS DSP ASE R1 optimizations --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations --disable-msa disable MSA optimizations - --disable-msa2 disable MSA2 optimizations --disable-mipsfpu disable floating point MIPS optimizations --disable-mmi disable Loongson SIMD optimizations --disable-fast-unaligned consider unaligned accesses slow @@ -476,7 +472,7 @@ Developer options (useful when working on FFmpeg itself): --random-seed=VALUE seed value for --enable/disable-random --disable-valgrind-backtrace do not print a backtrace under Valgrind (only applies to --disable-optimizations builds) - --enable-ossfuzz Enable building fuzzer tool + --enable-osfuzz Enable building fuzzer tool --libfuzzer=PATH path to libfuzzer --ignore-tests=TESTS comma-separated list (without "fate-" prefix in the name) of tests whose result is ignored @@ -505,13 +501,9 @@ log(){ } log_file(){ - log BEGIN "$1" - log_file_i=1 - while IFS= read -r log_file_line; do - printf '%5d\t%s\n' "$log_file_i" "$log_file_line" - log_file_i=$(($log_file_i+1)) - done < "$1" >> "$logfile" - log END "$1" + log BEGIN $1 + pr -n -t $1 >> $logfile + log END $1 } warn(){ @@ -655,12 +647,6 @@ request(){ done } -warn_if_gets_disabled(){ - for var in $*; do - WARN_IF_GETS_DISABLED_LIST="$WARN_IF_GETS_DISABLED_LIST $var" - done -} - enable(){ set_all yes $* } @@ -669,14 +655,6 @@ disable(){ set_all no $* } -disable_with_reason(){ - disable $1 - eval "${1}_disable_reason=\"$2\"" - if requested $1; then - die "ERROR: $1 requested, but $2" - fi -} - enable_weak(){ set_weak yes $* } @@ -805,10 +783,10 @@ check_deps(){ [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; } [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; } - enabled_all $dep_all || { disable_with_reason $cfg "not all dependencies are satisfied: $dep_all"; } - enabled_any $dep_any || { disable_with_reason $cfg "not any dependency is satisfied: $dep_any"; } - disabled_all $dep_con || { disable_with_reason $cfg "some conflicting dependencies are unsatisfied: $dep_con"; } - disabled_any $dep_sel && { disable_with_reason $cfg "some selected dependency is unsatisfied: $dep_sel"; } + enabled_all $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; } + enabled_any $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; } + disabled_all $dep_con || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some conflicting dependencies are unsatisfied: $dep_con"; } + disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; } enabled $cfg && enable_deep_weak $dep_sel $dep_sgs @@ -1007,10 +985,6 @@ hostcc_o(){ eval printf '%s\\n' $HOSTCC_O } -nvcc_o(){ - eval printf '%s\\n' $NVCC_O -} - test_cc(){ log test_cc "$@" cat > $TMPC @@ -1032,29 +1006,6 @@ test_objcc(){ test_cmd $objcc -Werror=missing-prototypes $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPM } -test_nvcc(){ - log test_nvcc "$@" - cat > $TMPCU - log_file $TMPCU - tmpcu_=$TMPCU - tmpo_=$TMPO - [ -x "$(command -v cygpath)" ] && tmpcu_=$(cygpath -m $tmpcu_) && tmpo_=$(cygpath -m $tmpo_) - test_cmd $nvcc $nvccflags "$@" $NVCC_C $(nvcc_o $tmpo_) $tmpcu_ -} - -check_nvcc() { - log check_nvcc "$@" - name=$1 - shift 1 - disabled $name && return - disable $name - test_nvcc "$@" < $TMPC @@ -1723,6 +1674,7 @@ EXTERNAL_LIBRARY_GPL_LIST=" EXTERNAL_LIBRARY_NONFREE_LIST=" decklink + libndi_newtek libfdk_aac openssl libtls @@ -1730,7 +1682,6 @@ EXTERNAL_LIBRARY_NONFREE_LIST=" EXTERNAL_LIBRARY_VERSION3_LIST=" gmp - libaribb24 liblensfun libopencore_amrnb libopencore_amrwb @@ -1761,7 +1712,6 @@ EXTERNAL_LIBRARY_LIST=" libcaca libcelt libcodec2 - libdav1d libdc1394 libdrm libflite @@ -1810,7 +1760,6 @@ EXTERNAL_LIBRARY_LIST=" mediacodec openal opengl - pocketsphinx vapoursynth " @@ -1819,7 +1768,6 @@ HWACCEL_AUTODETECT_LIBRARY_LIST=" audiotoolbox crystalhd cuda - cuda_llvm cuvid d3d11va dxva2 @@ -1840,7 +1788,6 @@ EXTRALIBS_LIST=" " HWACCEL_LIBRARY_NONFREE_LIST=" - cuda_nvcc cuda_sdk libnpp " @@ -2006,7 +1953,6 @@ ARCH_EXT_LIST_MIPS=" mipsdsp mipsdspr2 msa - msa2 " ARCH_EXT_LIST_LOONGSON=" @@ -2267,7 +2213,6 @@ TOOLCHAIN_FEATURES=" TYPES_LIST=" kCMVideoCodecType_HEVC - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange socklen_t struct_addrinfo struct_group_source_req @@ -2390,7 +2335,6 @@ CONFIG_EXTRA=" rtpdec rtpenc_chain rv34dsp - scene_sad sinewin snappy srtp @@ -2489,7 +2433,6 @@ CMDLINE_SET=" tempprefix toolchain valgrind - windres x86asmexe " @@ -2535,7 +2478,6 @@ mipsdsp_deps="mips" mipsdspr2_deps="mips" mmi_deps="mips" msa_deps="mipsfpu" -msa2_deps="msa" cpunop_deps="i686" x86_64_select="i686" @@ -2595,8 +2537,8 @@ threads_if_any="$THREADS_LIST" # subsystems cbs_av1_select="cbs" -cbs_h264_select="cbs" -cbs_h265_select="cbs" +cbs_h264_select="cbs golomb" +cbs_h265_select="cbs golomb" cbs_jpeg_select="cbs" cbs_mpeg2_select="cbs" cbs_vp9_select="cbs" @@ -2717,7 +2659,6 @@ hap_encoder_select="texturedspenc" hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp" huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp" huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" -hymt_decoder_select="huffyuv_decoder" iac_decoder_select="imc_decoder" imc_decoder_select="bswapdsp fft mdct sinewin" indeo3_decoder_select="hpeldsp" @@ -2728,7 +2669,6 @@ jpegls_decoder_select="mjpeg_decoder" jv_decoder_select="blockdsp" lagarith_decoder_select="llviddsp" ljpeg_encoder_select="idctdsp jpegtables mpegvideoenc" -lscr_decoder_deps="zlib" magicyuv_decoder_select="llviddsp" magicyuv_encoder_select="llvidencdsp" mdec_decoder_select="blockdsp idctdsp mpegvideo" @@ -2738,7 +2678,7 @@ mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables" mjpeg_encoder_select="jpegtables mpegvideoenc" mjpegb_decoder_select="mjpeg_decoder" mlp_decoder_select="mlp_parser" -mlp_encoder_select="lpc audio_frame_queue" +mlp_encoder_select="lpc" motionpixels_decoder_select="bswapdsp" mp1_decoder_select="mpegaudio" mp1float_decoder_select="mpegaudio" @@ -2820,7 +2760,7 @@ thp_decoder_select="mjpeg_decoder" tiff_decoder_suggest="zlib lzma" tiff_encoder_suggest="zlib" truehd_decoder_select="mlp_parser" -truehd_encoder_select="lpc audio_frame_queue" +truehd_encoder_select="lpc" truemotion2_decoder_select="bswapdsp" truespeech_decoder_select="bswapdsp" tscc_decoder_deps="zlib" @@ -2834,7 +2774,6 @@ vc1image_decoder_select="vc1_decoder" vorbis_decoder_select="mdct" vorbis_encoder_select="audio_frame_queue mdct" vp3_decoder_select="hpeldsp vp3dsp videodsp" -vp4_decoder_select="vp3_decoder" vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp" vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp" vp6a_decoder_select="vp6_decoder" @@ -2993,10 +2932,8 @@ v4l2_m2m_deps="linux_videodev2_h sem_timedwait" hwupload_cuda_filter_deps="ffnvcodec" scale_npp_filter_deps="ffnvcodec libnpp" -scale_cuda_filter_deps="ffnvcodec" -scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm" -thumbnail_cuda_filter_deps="ffnvcodec" -thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm" +scale_cuda_filter_deps="cuda_sdk" +thumbnail_cuda_filter_deps="cuda_sdk" transpose_npp_filter_deps="ffnvcodec libnpp" amf_deps_any="libdl LoadLibrary" @@ -3096,7 +3033,6 @@ vc1_parser_select="vc1dsp" # bitstream_filters aac_adtstoasc_bsf_select="adts_header" -av1_frame_split_bsf_select="cbs_av1" av1_metadata_bsf_select="cbs_av1" eac3_core_bsf_select="ac3_parser" filter_units_bsf_select="cbs" @@ -3152,11 +3088,9 @@ hevc_videotoolbox_encoder_select="videotoolbox_encoder" libaom_av1_decoder_deps="libaom" libaom_av1_encoder_deps="libaom" libaom_av1_encoder_select="extract_extradata_bsf" -libaribb24_decoder_deps="libaribb24" libcelt_decoder_deps="libcelt" libcodec2_decoder_deps="libcodec2" libcodec2_encoder_deps="libcodec2" -libdav1d_decoder_deps="libdav1d" libdavs2_decoder_deps="libdavs2" libfdk_aac_decoder_deps="libfdk_aac" libfdk_aac_encoder_deps="libfdk_aac" @@ -3317,6 +3251,10 @@ decklink_indev_extralibs="-lstdc++" decklink_outdev_deps="decklink threads" decklink_outdev_suggest="libklvanc" decklink_outdev_extralibs="-lstdc++" +libndi_newtek_indev_deps="libndi_newtek" +libndi_newtek_indev_extralibs="-lndi" +libndi_newtek_outdev_deps="libndi_newtek" +libndi_newtek_outdev_extralibs="-lndi" dshow_indev_deps="IBaseFilter" dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" fbdev_indev_deps="linux_fb_h" @@ -3418,7 +3356,6 @@ afir_filter_deps="avcodec" afir_filter_select="fft" amovie_filter_deps="avcodec avformat" aresample_filter_deps="swresample" -asr_filter_deps="pocketsphinx" ass_filter_deps="libass" atempo_filter_deps="avcodec" atempo_filter_select="rdft" @@ -3430,7 +3367,6 @@ bm3d_filter_select="dct" boxblur_filter_deps="gpl" boxblur_opencl_filter_deps="opencl gpl" bs2b_filter_deps="libbs2b" -colorkey_opencl_filter_deps="opencl" colormatrix_filter_deps="gpl" convolution_opencl_filter_deps="opencl" convolve_filter_deps="avcodec" @@ -3447,7 +3383,6 @@ deinterlace_qsv_filter_deps="libmfx" deinterlace_vaapi_filter_deps="vaapi" delogo_filter_deps="gpl" denoise_vaapi_filter_deps="vaapi" -derain_filter_select="dnn" deshake_filter_select="pixelutils" dilation_opencl_filter_deps="opencl" drawtext_filter_deps="libfreetype" @@ -3463,8 +3398,7 @@ find_rect_filter_deps="avcodec avformat gpl" firequalizer_filter_deps="avcodec" firequalizer_filter_select="rdft" flite_filter_deps="libflite" -framerate_filter_select="scene_sad" -freezedetect_filter_select="scene_sad" +framerate_filter_select="pixelutils" frei0r_filter_deps="frei0r libdl" frei0r_src_filter_deps="frei0r libdl" fspp_filter_deps="gpl" @@ -3480,10 +3414,8 @@ mcdeint_filter_deps="avcodec gpl" movie_filter_deps="avcodec avformat" mpdecimate_filter_deps="gpl" mpdecimate_filter_select="pixelutils" -minterpolate_filter_select="scene_sad" mptestsrc_filter_deps="gpl" negate_filter_deps="lut_filter" -nlmeans_opencl_filter_deps="opencl" nnedi_filter_deps="gpl" ocr_filter_deps="libtesseract" ocv_filter_deps="libopencv" @@ -3510,7 +3442,7 @@ sab_filter_deps="gpl swscale" scale2ref_filter_deps="swscale" scale_filter_deps="swscale" scale_qsv_filter_deps="libmfx" -select_filter_select="scene_sad" +select_filter_select="pixelutils" sharpness_vaapi_filter_deps="vaapi" showcqt_filter_deps="avcodec avformat swscale" showcqt_filter_suggest="libfontconfig libfreetype" @@ -3541,8 +3473,6 @@ tinterlace_merge_test_deps="tinterlace_filter" tinterlace_pad_test_deps="tinterlace_filter" tonemap_filter_deps="const_nan" tonemap_opencl_filter_deps="opencl const_nan" -transpose_opencl_filter_deps="opencl" -transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" unsharp_opencl_filter_deps="opencl" uspp_filter_deps="gpl avcodec" vaguedenoiser_filter_deps="gpl" @@ -3555,8 +3485,7 @@ zscale_filter_deps="libzimg const_nan" scale_vaapi_filter_deps="vaapi" vpp_qsv_filter_deps="libmfx" vpp_qsv_filter_select="qsvvpp" -yadif_cuda_filter_deps="ffnvcodec" -yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm" +yadif_cuda_filter_deps="cuda_sdk" # examples avio_dir_cmd_deps="avformat avutil" @@ -3607,15 +3536,15 @@ swresample_suggest="libm libsoxr" swscale_deps="avutil" swscale_suggest="libm" -avcodec_extralibs="pthreads_extralibs iconv_extralibs dxva2_extralibs" +avcodec_extralibs="pthreads_extralibs iconv_extralibs" avfilter_extralibs="pthreads_extralibs" avutil_extralibs="d3d11va_extralibs nanosleep_extralibs pthreads_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs" # programs ffmpeg_deps="avcodec avfilter avformat" ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter - hflip_filter null_filter - transpose_filter trim_filter vflip_filter" + null_filter + trim_filter" ffmpeg_suggest="ole32 psapi shell32" ffplay_deps="avcodec avformat swscale swresample sdl2" ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter" @@ -3660,6 +3589,8 @@ version_script='--version-script' objformat="elf32" x86asmexe_default="nasm" windres_default="windres" +nvcc_default="nvcc" +nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2" striptype="direct" # OS @@ -3670,7 +3601,6 @@ host_os=$target_os_default if test "$target_os_default" = aix; then arch_default=$(uname -p) strip_default="strip -X32_64" - nm_default="nm -g -X32_64" else arch_default=$(uname -m) fi @@ -3761,8 +3691,6 @@ mkdir -p ffbuild # find source path if test -f configure; then source_path=. -elif test -f src/configure; then - source_path=src else source_path=$(cd $(dirname "$0"); pwd) case "$source_path" in @@ -3789,7 +3717,8 @@ find_things_extern(){ find_filters_extern(){ file=$source_path/$1 - sed -n 's/^extern AVFilter ff_[avfsinkrc]\{2,5\}_\([[:alnum:]_]\{1,\}\);/\1_filter/p' $file + #sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file + sed -E -n "s/^extern AVFilter ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\2_filter/p" $file } FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c) @@ -3853,22 +3782,8 @@ die_unknown(){ } print_in_columns() { - tr ' ' '\n' | sort | tr '\r\n' ' ' | awk -v col_width=24 -v width="$ncols" ' - { - num_cols = width > col_width ? int(width / col_width) : 1; - num_rows = int((NF + num_cols-1) / num_cols); - y = x = 1; - for (y = 1; y <= num_rows; y++) { - i = y; - for (x = 1; x <= num_cols; x++) { - if (i <= NF) { - line = sprintf("%s%-" col_width "s", line, $i); - } - i = i + num_rows; - } - print line; line = ""; - } - }' | sed 's/ *$//' + cols=$(expr $ncols / 24) + cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t } show_list() { @@ -3954,7 +3869,6 @@ for opt do name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing} list=$(filter "$name" $list) [ "$list" = "" ] && warn "Option $opt did not match anything" - test $action = enable && warn_if_gets_disabled $list $action $list ;; --enable-yasm|--disable-yasm) @@ -4148,22 +4062,22 @@ case "$toolchain" in # behaviour if the regexp was unable to match anything, since this # successfully parses the version number of existing supported # versions that require the converter (MSVC 2010 and 2012). - cl_major_ver=$(cl.exe 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p') + cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p') if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then - cc_default="cl.exe" - cxx_default="cl.exe" + cc_default="cl" + cxx_default="cl" else die "Unsupported MSVC version (2013 or newer required)" fi ld_default="$source_path/compat/windows/mslink" - nm_default="dumpbin.exe -symbols" - ar_default="lib.exe" + nm_default="dumpbin -symbols" + ar_default="lib" case "$arch" in aarch64|arm64) - as_default="armasm64.exe" + as_default="armasm64" ;; arm*) - as_default="armasm.exe" + as_default="armasm" ;; esac target_os_default="win32" @@ -4207,11 +4121,6 @@ if test -n "$cross_prefix"; then enable cross_compile fi -set_default target_os -if test "$target_os" = android; then - cc_default="clang" -fi - ar_default="${cross_prefix}${ar_default}" cc_default="${cross_prefix}${cc_default}" cxx_default="${cross_prefix}${cxx_default}" @@ -4227,22 +4136,8 @@ windres_default="${cross_prefix}${windres_default}" sysinclude_default="${sysroot}/usr/include" -if enabled cuda_sdk; then - warn "Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead." - enable cuda_nvcc -fi - -if enabled cuda_nvcc; then - nvcc_default="nvcc" - nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2" -else - nvcc_default="clang" - nvccflags_default="--cuda-gpu-arch=sm_30 -O2" - NVCC_C="" -fi - set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \ - target_exec x86asmexe nvcc + target_exec target_os x86asmexe nvcc enabled cross_compile || host_cc_default=$cc set_default host_cc @@ -4309,7 +4204,6 @@ tmpfile TMPCPP .cpp tmpfile TMPE $EXESUF tmpfile TMPH .h tmpfile TMPM .m -tmpfile TMPCU .cu tmpfile TMPO .o tmpfile TMPS .S tmpfile TMPSH .sh @@ -4947,6 +4841,7 @@ elif enabled mips; then enable fast_cmov enable fast_unaligned disable aligned_stack + disable mipsfpu disable mipsdsp disable mipsdspr2 # When gcc version less than 5.3.0, add -fno-expensive-optimizations flag. @@ -5241,7 +5136,6 @@ case $target_os in echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile nm_default='nm -P -g' - striptype="" version_script='-M' VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)' ;; @@ -5395,6 +5289,7 @@ case $target_os in network_extralibs="-lsocket" objformat="coff" enable dos_paths + add_cppflags -U__STRICT_ANSI__ ;; linux) enable section_data_rel_ro @@ -5465,7 +5360,7 @@ link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX) mkdir "$link_dest" $ln_s "$link_dest" "$link_name" touch "$link_dest/test_file" -if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then +if [ "$source_path" != "." ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then # create link to source path [ -e src ] && rm src $ln_s "$source_path" src @@ -5507,7 +5402,6 @@ probe_libc(){ add_${pfx}cppflags -D__printf__=__gnu_printf__ test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" && add_${pfx}cppflags -D_WIN32_WINNT=0x0600 - add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" || test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then eval ${pfx}libc_type=mingw32 @@ -5521,7 +5415,6 @@ probe_libc(){ add_${pfx}cppflags -D_WIN32_WINNT=0x0600 eval test \$${pfx_no_}cc_type = "gcc" && add_${pfx}cppflags -D__printf__=__gnu_printf__ - add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then eval ${pfx}libc_type=msvcrt if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then @@ -5565,11 +5458,6 @@ EOF elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then eval ${pfx}libc_type=solaris add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 - elif test_${pfx}cpp_condition sys/version.h "defined __DJGPP__"; then - eval ${pfx}libc_type=djgpp - add_cppflags -U__STRICT_ANSI__ - add_cflags "-include $source_path/compat/djgpp/math.h" - add_compat djgpp/math.o fi test_${pfx}cc < @@ -5777,7 +5665,6 @@ elif enabled mips; then enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_headers msa.h || disable msa enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp' enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2' - enabled msa && enabled msa2 && check_inline_asm_flags msa2 '"nxbits.any.b $w0, $w0"' '-mmsa2' && check_headers msa2.h || disable msa2 if enabled bigendian && enabled msa; then disable msa @@ -6068,7 +5955,6 @@ enabled avfoundation && { enabled videotoolbox && { check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString "-framework CoreServices" check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia" - check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo" } check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss @@ -6079,31 +5965,20 @@ check_type "windows.h d3d11.h" "ID3D11VideoDecoder" check_type "windows.h d3d11.h" "ID3D11VideoContext" check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 -check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" - -if [ -z "$nvccflags" ]; then - nvccflags=$nvccflags_default -fi - -if enabled x86_64 || enabled ppc64 || enabled aarch64; then - nvccflags="$nvccflags -m64" -else - nvccflags="$nvccflags -m32" -fi +check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC" +check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth +check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC" +check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" +check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" +check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" -if enabled cuda_nvcc; then - nvccflags="$nvccflags -ptx" -else - nvccflags="$nvccflags -S -nocudalib -nocudainc --cuda-device-only -include ${source_link}/compat/cuda/cuda_runtime.h" - check_nvcc cuda_llvm -fi +check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" if ! disabled ffnvcodec; then - ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" - check_pkg_config ffnvcodec "ffnvcodec >= 9.0.18.0" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 8.2.15.8 ffnvcodec < 8.3" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.9 ffnvcodec < 8.2" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 8.0.14.9 ffnvcodec < 8.1" "$ffnv_hdr_list" "" + check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.2" \ + "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" "" || \ + check_pkg_config ffnvcodec "ffnvcodec >= 8.0.14.2 ffnvcodec < 8.1" \ + "ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" "" fi check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)" @@ -6173,19 +6048,17 @@ for func in $COMPLEX_FUNCS; do done # these are off by default, so fail if requested and not available -enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } +enabled cuda_sdk && require cuda_sdk cuda.h cuCtxCreate -lcuda enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { require_headers DeckLinkAPI.h && { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a090500" || die "ERROR: Decklink API version must be >= 10.9.5."; } } -enabled frei0r && require_headers "frei0r.h dlfcn.h" +enabled libndi_newtek && require_headers Processing.NDI.Lib.h +enabled frei0r && require_headers frei0r.h enabled gmp && require gmp gmp.h mpz_export -lgmp enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init enabled jni && { [ $target_os = "android" ] && check_headers jni.h && enabled pthreads || die "ERROR: jni not found"; } -enabled ladspa && require_headers "ladspa.h dlfcn.h" +enabled ladspa && require_headers ladspa.h enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_codec.h aom_codec_version -enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new || - { enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } || - 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 @@ -6196,8 +6069,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2 -enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.2.1" "dav1d/dav1d.h" dav1d_version -enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open +enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.5.115" davs2.h davs2_decoder_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || @@ -6280,11 +6152,13 @@ enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h enabled libvpx && { enabled libvpx_vp8_decoder && { check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx || - check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp8_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" + check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp8_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" || + die "ERROR: libvpx decoder version must be >=1.4.0"; } enabled libvpx_vp8_encoder && { check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx || - check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp8_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" + check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp8_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" || + die "ERROR: libvpx encoder version must be >=1.4.0"; } enabled libvpx_vp9_decoder && { check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx || @@ -6311,7 +6185,7 @@ enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && require_cpp_condition libx265 x265.h "X265_BUILD >= 68" enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs" -enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get +enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.2.77" "stdint.h xavs2.h" xavs2_api_get enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version enabled libzmq && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new @@ -6359,7 +6233,6 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } -enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create && { enabled libdrm || @@ -6523,14 +6396,6 @@ if enabled vaapi; then fi check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" - - check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC" - check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth - check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags - check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC" - check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" - check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" - check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" fi if enabled_all opencl libdrm ; then @@ -6541,12 +6406,9 @@ if enabled_all opencl libdrm ; then fi if enabled_all opencl vaapi ; then - if enabled opencl_drm_beignet ; then - enable opencl_vaapi_beignet - else - check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && - enable opencl_vaapi_intel_media - fi + enabled opencl_drm_beignet && enable opencl_vaapi_beignet + check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && + enable opencl_vaapi_intel_media fi if enabled_all opencl dxva2 ; then @@ -6575,14 +6437,6 @@ if enabled x86; then disable ffnvcodec cuvid nvdec nvenc ;; esac -elif enabled ppc64 && ! enabled bigendian; then - case $target_os in - linux) - ;; - *) - disable ffnvcodec cuvid nvdec nvenc - ;; - esac else disable ffnvcodec cuvid nvdec nvenc fi @@ -6646,7 +6500,6 @@ check_disable_warning -Wno-format-zero-length check_disable_warning -Wno-pointer-sign check_disable_warning -Wno-unused-const-variable check_disable_warning -Wno-bool-operation -check_disable_warning -Wno-char-subscripts check_disable_warning_headers(){ warning_flag=-W${1#-Wno-} @@ -6662,7 +6515,7 @@ EOF # add some linker flags check_ldflags -Wl,--warn-common -check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample +check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic @@ -6734,6 +6587,16 @@ if [ -z "$optflags" ]; then fi fi +if [ -z "$nvccflags" ]; then + nvccflags=$nvccflags_default +fi + +if enabled x86_64 || enabled ppc64 || enabled aarch64; then + nvccflags="$nvccflags -m64" +else + nvccflags="$nvccflags -m32" +fi + check_optflags(){ check_cflags "$@" enabled lto && check_ldflags "$@" @@ -6919,17 +6782,10 @@ check_deps $CONFIG_LIST \ enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86" enabled avresample && warn "Building with deprecated library libavresample" -case $target_os in -haiku) +if test $target_os = "haiku"; then disable memalign disable posix_memalign - ;; -*-dos|freedos|opendos) - if test_cpp_condition sys/version.h "defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ == 5"; then - disable memalign - fi - ;; -esac +fi flatten_extralibs(){ nested_entries= @@ -7155,7 +7011,6 @@ if enabled mips; then echo "MIPS DSP R1 enabled ${mipsdsp-no}" echo "MIPS DSP R2 enabled ${mipsdspr2-no}" echo "MIPS MSA enabled ${msa-no}" - echo "MIPS MSA2 enabled ${msa2-no}" echo "LOONGSON MMI enabled ${mmi-no}" fi if enabled ppc; then @@ -7218,15 +7073,6 @@ echo "License: $license" fi # test "$quiet" != "yes" -if test -n "$WARN_IF_GETS_DISABLED_LIST"; then - for cfg in $WARN_IF_GETS_DISABLED_LIST; do - if disabled $cfg; then - varname=${cfg}_disable_reason - eval "warn \"Disabled $cfg because \$$varname\"" - fi - done -fi - if test -n "$WARNINGS"; then printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color" enabled fatal_warnings && exit 1 @@ -7243,7 +7089,7 @@ echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFI enabled stripping || strip="echo skipping strip" enabled stripping || striptype="" -config_files="$TMPH ffbuild/config.mak" +config_files="$TMPH ffbuild/config.mak doc/config.texi" cat > ffbuild/config.mak < $TMPH <> $TMPH + +mkdir -p doc +mkdir -p tests +mkdir -p tests/api +echo "@c auto-generated by configure - do not modify! " > doc/config.texi + print_config ARCH_ "$config_files" $ARCH_LIST print_config HAVE_ "$config_files" $HAVE_LIST print_config CONFIG_ "$config_files" $CONFIG_LIST \ diff --git a/trunk/3rdparty/ffmpeg-4-fit/ffbuild/common.mak b/trunk/3rdparty/ffmpeg-4-fit/ffbuild/common.mak index 7355508ea0..eb41b05ee6 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/ffbuild/common.mak +++ b/trunk/3rdparty/ffmpeg-4-fit/ffbuild/common.mak @@ -38,6 +38,7 @@ OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS) ASFLAGS := $(CPPFLAGS) $(ASFLAGS) CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) X86ASMFLAGS += $(IFLAGS:%=%/) -I$($@ -%.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h +%.ptx: %.cu $(COMPILE_NVCC) %.ptx.c: %.ptx @@ -160,7 +161,7 @@ $(SLIBOBJS): | $(sort $(dir $(SLIBOBJS))) $(TESTOBJS): | $(sort $(dir $(TESTOBJS))) $(TOOLOBJS): | tools -OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS)) +OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS)) CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.pc *.ptx *.ptx.c *.ver *.version *$(DEFAULT_X86ASMD).asm *~ LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/Makefile index 3cd73fbcc6..3e41497e34 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/Makefile +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/Makefile @@ -173,7 +173,6 @@ OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o kbd 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 -OBJS-$(CONFIG_AGM_DECODER) += agm.o OBJS-$(CONFIG_AIC_DECODER) += aic.o OBJS-$(CONFIG_ALAC_DECODER) += alac.o alac_data.o alacdsp.o OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o alac_data.o @@ -199,7 +198,6 @@ OBJS-$(CONFIG_APTX_HD_DECODER) += aptx.o OBJS-$(CONFIG_APTX_HD_ENCODER) += aptx.o OBJS-$(CONFIG_APNG_DECODER) += png.o pngdec.o pngdsp.o OBJS-$(CONFIG_APNG_ENCODER) += png.o pngenc.o -OBJS-$(CONFIG_ARBC_DECODER) += arbc.o OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o OBJS-$(CONFIG_SSA_ENCODER) += assenc.o ass.o OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o @@ -364,7 +362,6 @@ OBJS-$(CONFIG_H264_V4L2M2M_DECODER) += v4l2_m2m_dec.o OBJS-$(CONFIG_H264_V4L2M2M_ENCODER) += v4l2_m2m_enc.o OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o hap.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 @@ -386,7 +383,6 @@ OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \ OBJS-$(CONFIG_HQX_DECODER) += hqx.o hqxvlc.o hqxdsp.o canopus.o OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o -OBJS-$(CONFIG_HYMT_DECODER) += huffyuv.o huffyuvdec.o OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o OBJS-$(CONFIG_IDF_DECODER) += bintext.o cga_data.o OBJS-$(CONFIG_IFF_ILBM_DECODER) += iff.o @@ -413,7 +409,6 @@ OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc_common.o OBJS-$(CONFIG_LOCO_DECODER) += loco.o -OBJS-$(CONFIG_LSCR_DECODER) += png.o pngdec.o pngdsp.o OBJS-$(CONFIG_M101_DECODER) += m101.o OBJS-$(CONFIG_MACE3_DECODER) += mace.o OBJS-$(CONFIG_MACE6_DECODER) += mace.o @@ -497,8 +492,7 @@ OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o OBJS-$(CONFIG_ON2AVC_DECODER) += on2avc.o on2avcdata.o OBJS-$(CONFIG_OPUS_DECODER) += opusdec.o opus.o opus_celt.o opus_rc.o \ - opus_pvq.o opus_silk.o opustab.o vorbis_data.o \ - opusdsp.o + opus_pvq.o opus_silk.o opustab.o vorbis_data.o OBJS-$(CONFIG_OPUS_ENCODER) += opusenc.o opus.o opus_rc.o opustab.o opus_pvq.o \ opusenc_psy.o OBJS-$(CONFIG_PAF_AUDIO_DECODER) += pafaudio.o @@ -743,7 +737,6 @@ OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm-dvd.o -OBJS-$(CONFIG_PCM_DVD_ENCODER) += pcm-dvdenc.o OBJS-$(CONFIG_PCM_F16LE_DECODER) += pcm.o OBJS-$(CONFIG_PCM_F24LE_DECODER) += pcm.o OBJS-$(CONFIG_PCM_F32BE_DECODER) += pcm.o @@ -809,7 +802,6 @@ OBJS-$(CONFIG_ADPCM_4XM_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_ADX_DECODER) += adxdec.o adx.o OBJS-$(CONFIG_ADPCM_ADX_ENCODER) += adxenc.o adx.o OBJS-$(CONFIG_ADPCM_AFC_DECODER) += adpcm.o adpcm_data.o -OBJS-$(CONFIG_ADPCM_AGM_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_AICA_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_CT_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_DTK_DECODER) += adpcm.o adpcm_data.o @@ -961,11 +953,9 @@ OBJS-$(CONFIG_PCM_ALAW_AT_ENCODER) += audiotoolboxenc.o OBJS-$(CONFIG_PCM_MULAW_AT_ENCODER) += audiotoolboxenc.o OBJS-$(CONFIG_LIBAOM_AV1_DECODER) += libaomdec.o OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o -OBJS-$(CONFIG_LIBARIBB24_DECODER) += libaribb24.o ass.o OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o OBJS-$(CONFIG_LIBCODEC2_DECODER) += libcodec2.o codec2utils.o OBJS-$(CONFIG_LIBCODEC2_ENCODER) += libcodec2.o codec2utils.o -OBJS-$(CONFIG_LIBDAV1D_DECODER) += libdav1d.o OBJS-$(CONFIG_LIBDAVS2_DECODER) += libdavs2.o OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o @@ -1033,16 +1023,14 @@ OBJS-$(CONFIG_DVD_NAV_PARSER) += dvd_nav_parser.o OBJS-$(CONFIG_DVDSUB_PARSER) += dvdsub_parser.o OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o \ vorbis_data.o -OBJS-$(CONFIG_G723_1_PARSER) += g723_1_parser.o OBJS-$(CONFIG_G729_PARSER) += g729_parser.o -OBJS-$(CONFIG_GIF_PARSER) += gif_parser.o OBJS-$(CONFIG_GSM_PARSER) += gsm_parser.o OBJS-$(CONFIG_H261_PARSER) += h261_parser.o OBJS-$(CONFIG_H263_PARSER) += h263_parser.o OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264_sei.o h264data.o OBJS-$(CONFIG_HEVC_PARSER) += hevc_parser.o hevc_data.o OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o -OBJS-$(CONFIG_MLP_PARSER) += mlp_parse.o mlp_parser.o mlp.o +OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \ mpeg4videodec.o mpeg4video.o \ ituh263dec.o h263dec.o h263data.o @@ -1069,7 +1057,6 @@ OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o # bitstream filters OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o mpeg4audio.o OBJS-$(CONFIG_AV1_METADATA_BSF) += av1_metadata_bsf.o -OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF) += av1_frame_split_bsf.o OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o @@ -1081,7 +1068,7 @@ OBJS-$(CONFIG_H264_METADATA_BSF) += h264_metadata_bsf.o h264_levels.o OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o OBJS-$(CONFIG_H264_REDUNDANT_PPS_BSF) += h264_redundant_pps_bsf.o OBJS-$(CONFIG_HAPQA_EXTRACT_BSF) += hapqa_extract_bsf.o hap.o -OBJS-$(CONFIG_HEVC_METADATA_BSF) += h265_metadata_bsf.o h265_profile_level.o +OBJS-$(CONFIG_HEVC_METADATA_BSF) += h265_metadata_bsf.o OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF) += hevc_mp4toannexb_bsf.o OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o OBJS-$(CONFIG_MJPEG2JPEG_BSF) += mjpeg2jpeg_bsf.o @@ -1093,11 +1080,9 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \ OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o OBJS-$(CONFIG_NULL_BSF) += null_bsf.o -OBJS-$(CONFIG_PRORES_METADATA_BSF) += prores_metadata_bsf.o OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o OBJS-$(CONFIG_TRACE_HEADERS_BSF) += trace_headers_bsf.o -OBJS-$(CONFIG_TRUEHD_CORE_BSF) += truehd_core_bsf.o mlp_parse.o mlp.o OBJS-$(CONFIG_VP9_METADATA_BSF) += vp9_metadata_bsf.o OBJS-$(CONFIG_VP9_RAW_REORDER_BSF) += vp9_raw_reorder_bsf.o OBJS-$(CONFIG_VP9_SUPERFRAME_BSF) += vp9_superframe_bsf.o @@ -1161,7 +1146,6 @@ TESTPROGS-$(CONFIG_IIRFILTER) += iirfilter TESTPROGS-$(HAVE_MMX) += motion TESTPROGS-$(CONFIG_MPEGVIDEO) += mpeg12framerate TESTPROGS-$(CONFIG_H264_METADATA_BSF) += h264_levels -TESTPROGS-$(CONFIG_HEVC_METADATA_BSF) += h265_levels TESTPROGS-$(CONFIG_RANGECODER) += rangecoder TESTPROGS-$(CONFIG_SNOW_ENCODER) += snowenc diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aac.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aac.h index c2b9c980cb..05bc95385f 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aac.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aac.h @@ -368,7 +368,7 @@ struct AACContext { INTFLOAT *in, IndividualChannelStream *ics); void (*update_ltp)(AACContext *ac, SingleChannelElement *sce); void (*vector_pow43)(int *coefs, int len); - void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context); + void (*subband_scale)(int *dst, int *src, int scale, int offset, int len); }; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec.c index c606ad40a9..cc97ff4389 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec.c @@ -247,12 +247,14 @@ static void apply_independent_coupling(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index) { + int i; const float gain = cce->coup.gain[index][0]; const float *src = cce->ch[0].ret; float *dest = target->ret; const int len = 1024 << (ac->oc[1].m4ac.sbr == 1); - ac->fdsp->vector_fmac_scalar(dest, src, gain, len); + for (i = 0; i < len; i++) + dest[i] += gain * src[i]; } #include "aacdec_template.c" @@ -409,6 +411,8 @@ static int read_stream_mux_config(struct LATMContext *latmctx, } else { int esc; do { + if (get_bits_left(gb) < 9) + return AVERROR_INVALIDDATA; esc = get_bits(gb, 1); skip_bits(gb, 8); } while (esc); @@ -559,7 +563,7 @@ AVCodec ff_aac_decoder = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, .capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .channel_layouts = aac_channel_layout, .flush = flush, .priv_class = &aac_decoder_class, @@ -584,7 +588,7 @@ AVCodec ff_aac_latm_decoder = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, .capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .channel_layouts = aac_channel_layout, .flush = flush, .profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles), diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_fixed.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_fixed.c index 1d0142fdb0..411d96d5a6 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_fixed.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_fixed.c @@ -162,7 +162,7 @@ static void vector_pow43(int *coefs, int len) } } -static void subband_scale(int *dst, int *src, int scale, int offset, int len, void *log_context) +static void subband_scale(int *dst, int *src, int scale, int offset, int len) { int ssign = scale < 0 ? -1 : 1; int s = FFABS(scale); @@ -189,7 +189,7 @@ static void subband_scale(int *dst, int *src, int scale, int offset, int len, vo dst[i] = out * (unsigned)ssign; } } else { - av_log(log_context, AV_LOG_ERROR, "Overflow in subband_scale()\n"); + av_log(NULL, AV_LOG_ERROR, "Overflow in subband_scale()\n"); } } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_template.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_template.c index 28765c768d..921ba76cd7 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_template.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacdec_template.c @@ -1157,6 +1157,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) AACContext *ac = avctx->priv_data; int ret; + if (avctx->sample_rate > 96000) + return AVERROR_INVALIDDATA; + ret = ff_thread_once(&aac_table_init, &aac_static_table_init); if (ret != 0) return AVERROR_UNKNOWN; @@ -1926,7 +1929,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024], if (cbt_m1 < NOISE_BT - 1) { for (group = 0; group < (int)g_len; group++, cfo+=128) { ac->vector_pow43(cfo, off_len); - ac->subband_scale(cfo, cfo, sf[idx], 34, off_len, ac->avctx); + ac->subband_scale(cfo, cfo, sf[idx], 34, off_len); } } } @@ -2157,7 +2160,7 @@ static void apply_intensity_stereo(AACContext *ac, coef0 + group * 128 + offsets[i], scale, 23, - offsets[i + 1] - offsets[i] ,ac->avctx); + offsets[i + 1] - offsets[i]); #else ac->fdsp->vector_fmul_scalar(coef1 + group * 128 + offsets[i], coef0 + group * 128 + offsets[i], @@ -2659,7 +2662,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) ac->mdct.imdct_half(&ac->mdct, buf, in); #if USE_FIXED for (i=0; i<1024; i++) - buf[i] = (buf[i] + 4) >> 3; + buf[i] = (buf[i] + 4LL) >> 3; #endif /* USE_FIXED */ } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacenc_ltp.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacenc_ltp.c index f77f0b6a72..674a2a0680 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacenc_ltp.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacenc_ltp.c @@ -144,7 +144,7 @@ void ff_aac_adjust_common_ltp(AACEncContext *s, ChannelElement *cpe) int sum = sce0->ics.ltp.used[sfb] + sce1->ics.ltp.used[sfb]; if (sum != 2) { sce0->ics.ltp.used[sfb] = 0; - } else { + } else if (sum == 2) { count++; } } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacps.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacps.c index d5dca64b0f..acfdfa6f0c 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacps.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aacps.c @@ -118,7 +118,7 @@ static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCon return 0; \ err: \ av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \ - return AVERROR_INVALIDDATA; \ + return -1; \ } READ_PAR_DATA(iid, huff_offset[table_idx], 0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant) @@ -414,33 +414,33 @@ static void hybrid_synthesis(PSDSPContext *dsp, INTFLOAT out[2][38][64], memset(out[0][n], 0, 5*sizeof(out[0][n][0])); memset(out[1][n], 0, 5*sizeof(out[1][n][0])); for (i = 0; i < 12; i++) { - out[0][n][0] += in[ i][n][0]; - out[1][n][0] += in[ i][n][1]; + out[0][n][0] += (UINTFLOAT)in[ i][n][0]; + out[1][n][0] += (UINTFLOAT)in[ i][n][1]; } for (i = 0; i < 8; i++) { - out[0][n][1] += in[12+i][n][0]; - out[1][n][1] += in[12+i][n][1]; + out[0][n][1] += (UINTFLOAT)in[12+i][n][0]; + out[1][n][1] += (UINTFLOAT)in[12+i][n][1]; } for (i = 0; i < 4; i++) { - out[0][n][2] += in[20+i][n][0]; - out[1][n][2] += in[20+i][n][1]; - out[0][n][3] += in[24+i][n][0]; - out[1][n][3] += in[24+i][n][1]; - out[0][n][4] += in[28+i][n][0]; - out[1][n][4] += in[28+i][n][1]; + out[0][n][2] += (UINTFLOAT)in[20+i][n][0]; + out[1][n][2] += (UINTFLOAT)in[20+i][n][1]; + out[0][n][3] += (UINTFLOAT)in[24+i][n][0]; + out[1][n][3] += (UINTFLOAT)in[24+i][n][1]; + out[0][n][4] += (UINTFLOAT)in[28+i][n][0]; + out[1][n][4] += (UINTFLOAT)in[28+i][n][1]; } } dsp->hybrid_synthesis_deint(out, in + 27, 5, len); } else { for (n = 0; n < len; n++) { - out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] + - in[3][n][0] + in[4][n][0] + in[5][n][0]; - out[1][n][0] = in[0][n][1] + in[1][n][1] + in[2][n][1] + - in[3][n][1] + in[4][n][1] + in[5][n][1]; - out[0][n][1] = in[6][n][0] + in[7][n][0]; - out[1][n][1] = in[6][n][1] + in[7][n][1]; - out[0][n][2] = in[8][n][0] + in[9][n][0]; - out[1][n][2] = in[8][n][1] + in[9][n][1]; + out[0][n][0] = (UINTFLOAT)in[0][n][0] + in[1][n][0] + in[2][n][0] + + (UINTFLOAT)in[3][n][0] + in[4][n][0] + in[5][n][0]; + out[1][n][0] = (UINTFLOAT)in[0][n][1] + in[1][n][1] + in[2][n][1] + + (UINTFLOAT)in[3][n][1] + in[4][n][1] + in[5][n][1]; + out[0][n][1] = (UINTFLOAT)in[6][n][0] + in[7][n][0]; + out[1][n][1] = (UINTFLOAT)in[6][n][1] + in[7][n][1]; + out[0][n][2] = (UINTFLOAT)in[8][n][0] + in[9][n][0]; + out[1][n][2] = (UINTFLOAT)in[8][n][1] + in[9][n][1]; } dsp->hybrid_synthesis_deint(out, in + 7, 3, len); } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/Makefile index 00f93bf59f..72080c2dbb 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/Makefile +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/Makefile @@ -9,13 +9,11 @@ OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_init_aarch64.o OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_init.o OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o -OBJS-$(CONFIG_VP8DSP) += aarch64/vp8dsp_init_aarch64.o # decoders/encoders OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_init_aarch64.o \ aarch64/sbrdsp_init_aarch64.o OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_init.o -OBJS-$(CONFIG_OPUS_DECODER) += aarch64/opusdsp_init.o OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_init_aarch64.o OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_init.o @@ -45,12 +43,10 @@ NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_init_aarch64.o \ aarch64/simple_idct_neon.o NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o -NEON-OBJS-$(CONFIG_VP8DSP) += aarch64/vp8dsp_neon.o # decoders/encoders NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_neon.o NEON-OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_neon.o -NEON-OBJS-$(CONFIG_OPUS_DECODER) += aarch64/opusdsp_neon.o NEON-OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_neon.o NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o \ aarch64/vp9itxfm_neon.o \ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/asm-offsets.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/asm-offsets.h index fc38eed298..e05c5ad2e4 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/asm-offsets.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/asm-offsets.h @@ -19,6 +19,14 @@ #ifndef AVCODEC_AARCH64_ASM_OFFSETS_H #define AVCODEC_AARCH64_ASM_OFFSETS_H +/* CeltIMDCTContext */ +#define CELT_EXPTAB 0x20 +#define CELT_FFT_N 0x00 +#define CELT_LEN2 0x04 +#define CELT_LEN4 (CELT_LEN2 + 0x4) // loaded as pair +#define CELT_TMP 0x10 +#define CELT_TWIDDLE (CELT_TMP + 0x8) // loaded as pair + /* FFTContext */ #define IMDCT_HALF 0x48 diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/h264dsp_init_aarch64.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/h264dsp_init_aarch64.c index d5baccf235..eb2014e24d 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/h264dsp_init_aarch64.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/aarch64/h264dsp_init_aarch64.c @@ -25,28 +25,14 @@ #include "libavutil/aarch64/cpu.h" #include "libavcodec/h264dsp.h" -void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, +void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0); -void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, +void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0); -void ff_h264_v_loop_filter_luma_intra_neon(uint8_t *pix, ptrdiff_t stride, int alpha, - int beta); -void ff_h264_h_loop_filter_luma_intra_neon(uint8_t *pix, ptrdiff_t stride, int alpha, - int beta); -void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, +void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0); -void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, +void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0); -void ff_h264_h_loop_filter_chroma422_neon(uint8_t *pix, ptrdiff_t stride, int alpha, - int beta, int8_t *tc0); -void ff_h264_v_loop_filter_chroma_intra_neon(uint8_t *pix, ptrdiff_t stride, - int alpha, int beta); -void ff_h264_h_loop_filter_chroma_intra_neon(uint8_t *pix, ptrdiff_t stride, - int alpha, int beta); -void ff_h264_h_loop_filter_chroma422_intra_neon(uint8_t *pix, ptrdiff_t stride, - int alpha, int beta); -void ff_h264_h_loop_filter_chroma_mbaff_intra_neon(uint8_t *pix, ptrdiff_t stride, - int alpha, int beta); void ff_weight_h264_pixels_16_neon(uint8_t *dst, ptrdiff_t stride, int height, int log2_den, int weight, int offset); @@ -91,22 +77,9 @@ av_cold void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth, if (have_neon(cpu_flags) && bit_depth == 8) { c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; - c->h264_v_loop_filter_luma_intra= ff_h264_v_loop_filter_luma_intra_neon; - c->h264_h_loop_filter_luma_intra= ff_h264_h_loop_filter_luma_intra_neon; - c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; - c->h264_v_loop_filter_chroma_intra = ff_h264_v_loop_filter_chroma_intra_neon; - - if (chroma_format_idc <= 1) { - c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; - c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma_intra_neon; - c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_mbaff_intra_neon; - } else { - c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma422_neon; - c->h264_h_loop_filter_chroma_mbaff = ff_h264_h_loop_filter_chroma_neon; - c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma422_intra_neon; - c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_intra_neon; - } + if (chroma_format_idc <= 1) + c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec.c index eaa327a3ee..43b22b7654 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec.c @@ -452,7 +452,7 @@ static int decode_exponents(AC3DecodeContext *s, prevexp += dexp[i] - 2; if (prevexp > 24U) { av_log(s->avctx, AV_LOG_ERROR, "exponent %d is out-of-range\n", prevexp); - return AVERROR_INVALIDDATA; + return -1; } switch (group_size) { case 4: dexps[j++] = prevexp; @@ -1467,8 +1467,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int buf_size, full_buf_size = avpkt->size; AC3DecodeContext *s = avctx->priv_data; int blk, ch, err, offset, ret; - int i; - int skip = 0, got_independent_frame = 0; + int got_independent_frame = 0; const uint8_t *channel_map; uint8_t extended_channel_map[EAC3_MAX_CHANNELS]; const SHORTFLOAT *output[AC3_MAX_CHANNELS]; @@ -1478,23 +1477,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, s->superframe_size = 0; buf_size = full_buf_size; - for (i = 1; i < buf_size; i += 2) { - if (buf[i] == 0x77 || buf[i] == 0x0B) { - if ((buf[i] ^ buf[i-1]) == (0x77 ^ 0x0B)) { - i--; - break; - } else if ((buf[i] ^ buf[i+1]) == (0x77 ^ 0x0B)) { - break; - } - } - } - if (i >= buf_size) - return AVERROR_INVALIDDATA; - if (i > 10) - return i; - buf += i; - buf_size -= i; - /* copy input buffer to decoder context to avoid reading past the end of the buffer, which can be caused by a damaged input stream. */ if (buf_size >= 2 && AV_RB16(buf) == 0x770B) { @@ -1655,11 +1637,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, AC3HeaderInfo hdr; int err; - if (buf_size - s->frame_size <= 16) { - skip = buf_size - s->frame_size; - goto skip; - } - if ((ret = init_get_bits8(&s->gbc, buf + s->frame_size, buf_size - s->frame_size)) < 0) return ret; @@ -1680,7 +1657,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, } } } -skip: frame->decode_error_flags = err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0; @@ -1820,9 +1796,9 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, *got_frame_ptr = 1; if (!s->superframe_size) - return FFMIN(full_buf_size, s->frame_size + skip); + return FFMIN(full_buf_size, s->frame_size); - return FFMIN(full_buf_size, s->superframe_size + skip); + return FFMIN(full_buf_size, s->superframe_size); } /** diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec_fixed.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec_fixed.c index bd66175d50..1e1edc8964 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec_fixed.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/ac3dec_fixed.c @@ -107,29 +107,30 @@ static void scale_coefs ( } } else { shift = -shift; + mul <<= shift; for (i=0; inum_blocks; blk++) { @@ -1800,7 +1800,7 @@ static int validate_float_option(float v, const float *v_list, int v_list_size) break; } if (i == v_list_size) - return AVERROR(EINVAL); + return -1; return i; } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/allcodecs.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/allcodecs.c index d2f9a39ce5..1b8144a2b7 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/allcodecs.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/allcodecs.c @@ -35,14 +35,12 @@ extern AVCodec ff_aasc_decoder; extern AVCodec ff_aic_decoder; extern AVCodec ff_alias_pix_encoder; extern AVCodec ff_alias_pix_decoder; -extern AVCodec ff_agm_decoder; extern AVCodec ff_amv_encoder; extern AVCodec ff_amv_decoder; extern AVCodec ff_anm_decoder; extern AVCodec ff_ansi_decoder; extern AVCodec ff_apng_encoder; extern AVCodec ff_apng_decoder; -extern AVCodec ff_arbc_decoder; extern AVCodec ff_asv1_encoder; extern AVCodec ff_asv1_decoder; extern AVCodec ff_asv2_encoder; @@ -154,7 +152,6 @@ extern AVCodec ff_hq_hqa_decoder; extern AVCodec ff_hqx_decoder; extern AVCodec ff_huffyuv_encoder; extern AVCodec ff_huffyuv_decoder; -extern AVCodec ff_hymt_decoder; extern AVCodec ff_idcin_decoder; extern AVCodec ff_iff_ilbm_decoder; extern AVCodec ff_imm4_decoder; @@ -173,7 +170,6 @@ extern AVCodec ff_kmvc_decoder; extern AVCodec ff_lagarith_decoder; extern AVCodec ff_ljpeg_encoder; extern AVCodec ff_loco_decoder; -extern AVCodec ff_lscr_decoder; extern AVCodec ff_m101_decoder; extern AVCodec ff_magicyuv_encoder; extern AVCodec ff_magicyuv_decoder; @@ -330,7 +326,6 @@ extern AVCodec ff_vcr1_decoder; extern AVCodec ff_vmdvideo_decoder; extern AVCodec ff_vmnc_decoder; extern AVCodec ff_vp3_decoder; -extern AVCodec ff_vp4_decoder; extern AVCodec ff_vp5_decoder; extern AVCodec ff_vp6_decoder; extern AVCodec ff_vp6a_decoder; @@ -428,7 +423,6 @@ extern AVCodec ff_g723_1_decoder; extern AVCodec ff_g729_decoder; extern AVCodec ff_gsm_decoder; extern AVCodec ff_gsm_ms_decoder; -extern AVCodec ff_hcom_decoder; extern AVCodec ff_iac_decoder; extern AVCodec ff_ilbc_decoder; extern AVCodec ff_imc_decoder; @@ -500,7 +494,6 @@ extern AVCodec ff_xma2_decoder; extern AVCodec ff_pcm_alaw_encoder; extern AVCodec ff_pcm_alaw_decoder; extern AVCodec ff_pcm_bluray_decoder; -extern AVCodec ff_pcm_dvd_encoder; extern AVCodec ff_pcm_dvd_decoder; extern AVCodec ff_pcm_f16le_decoder; extern AVCodec ff_pcm_f24le_decoder; @@ -576,7 +569,6 @@ extern AVCodec ff_adpcm_4xm_decoder; extern AVCodec ff_adpcm_adx_encoder; extern AVCodec ff_adpcm_adx_decoder; extern AVCodec ff_adpcm_afc_decoder; -extern AVCodec ff_adpcm_agm_decoder; extern AVCodec ff_adpcm_aica_decoder; extern AVCodec ff_adpcm_ct_decoder; extern AVCodec ff_adpcm_dtk_decoder; @@ -681,11 +673,9 @@ extern AVCodec ff_qdmc_at_decoder; extern AVCodec ff_qdm2_at_decoder; extern AVCodec ff_libaom_av1_decoder; extern AVCodec ff_libaom_av1_encoder; -extern AVCodec ff_libaribb24_decoder; extern AVCodec ff_libcelt_decoder; extern AVCodec ff_libcodec2_encoder; extern AVCodec ff_libcodec2_decoder; -extern AVCodec ff_libdav1d_decoder; extern AVCodec ff_libdavs2_decoder; extern AVCodec ff_libfdk_aac_encoder; extern AVCodec ff_libfdk_aac_decoder; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/Makefile new file mode 100644 index 0000000000..e656011c3c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/Makefile @@ -0,0 +1,154 @@ +ARCH_HEADERS = mathops.h + +# subsystems +OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \ + arm/ac3dsp_arm.o +OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_arm.o +OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_arm.o +OBJS-$(CONFIG_FFT) += arm/fft_init_arm.o \ + arm/fft_fixed_init_arm.o +OBJS-$(CONFIG_FLACDSP) += arm/flacdsp_init_arm.o \ + arm/flacdsp_arm.o +OBJS-$(CONFIG_FMTCONVERT) += arm/fmtconvert_init_arm.o +OBJS-$(CONFIG_G722DSP) += arm/g722dsp_init_arm.o +OBJS-$(CONFIG_H264CHROMA) += arm/h264chroma_init_arm.o +OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o +OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o +OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_init_arm.o +OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_arm.o \ + arm/hpeldsp_arm.o +OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_arm.o \ + arm/idctdsp_arm.o \ + arm/jrevdct_arm.o \ + arm/simple_idct_arm.o +OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_init_arm.o +OBJS-$(CONFIG_ME_CMP) += arm/me_cmp_init_arm.o +OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o +OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o +OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_init_arm.o +OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o +OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_init_arm.o +OBJS-$(CONFIG_RDFT) += arm/rdft_init_arm.o +OBJS-$(CONFIG_RV34DSP) += arm/rv34dsp_init_arm.o +OBJS-$(CONFIG_VC1DSP) += arm/vc1dsp_init_arm.o +OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_arm.o +OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_init_arm.o +OBJS-$(CONFIG_VP8DSP) += arm/vp8dsp_init_arm.o + +# decoders/encoders +OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_init_arm.o \ + arm/sbrdsp_init_arm.o +OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_init_arm.o +OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_arm.o +OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o +OBJS-$(CONFIG_RV40_DECODER) += arm/rv40dsp_init_arm.o +OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_init_arm.o +OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o +OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_init_arm.o +OBJS-$(CONFIG_VP9_DECODER) += arm/vp9dsp_init_10bpp_arm.o \ + arm/vp9dsp_init_12bpp_arm.o \ + arm/vp9dsp_init_arm.o + + +# ARMv5 optimizations +# subsystems +ARMV5TE-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv5te.o \ + arm/simple_idct_armv5te.o +ARMV5TE-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_armv5te.o \ + arm/mpegvideo_armv5te_s.o +ARMV5TE-OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_armv5te.o \ + arm/videodsp_armv5te.o + +# decoders/encoders +ARMV5TE-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv5te.o + + +# ARMv6 optimizations +# subsystems +ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o +ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ + arm/hpeldsp_armv6.o +ARMV6-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv6.o \ + arm/idctdsp_armv6.o \ + arm/simple_idct_armv6.o +ARMV6-OBJS-$(CONFIG_ME_CMP) += arm/me_cmp_armv6.o +ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o +ARMV6-OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_armv6.o +ARMV6-OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_armv6.o +ARMV6-OBJS-$(CONFIG_STARTCODE) += arm/startcode_armv6.o +ARMV6-OBJS-$(CONFIG_VP8DSP) += arm/vp8_armv6.o \ + arm/vp8dsp_init_armv6.o \ + arm/vp8dsp_armv6.o + +# decoders/encoders +ARMV6-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv6.o +ARMV6-OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_armv6.o + + +# VFP optimizations + +# subsystems +VFP-OBJS-$(CONFIG_FFT) += arm/fft_vfp.o +VFP-OBJS-$(CONFIG_FMTCONVERT) += arm/fmtconvert_vfp.o +VFP-OBJS-$(CONFIG_MDCT) += arm/mdct_vfp.o + +# decoders/encoders +VFP-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_vfp.o + + +# NEON optimizations + +# subsystems +NEON-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_neon.o +NEON-OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_neon.o \ + arm/audiodsp_neon.o \ + arm/int_neon.o +NEON-OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_neon.o \ + arm/blockdsp_neon.o +NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ + arm/fft_fixed_neon.o +NEON-OBJS-$(CONFIG_FMTCONVERT) += arm/fmtconvert_neon.o +NEON-OBJS-$(CONFIG_G722DSP) += arm/g722dsp_neon.o +NEON-OBJS-$(CONFIG_H264CHROMA) += arm/h264cmc_neon.o +NEON-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_neon.o \ + arm/h264idct_neon.o +NEON-OBJS-$(CONFIG_H264PRED) += arm/h264pred_neon.o +NEON-OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_neon.o \ + arm/hpeldsp_neon.o +NEON-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_neon.o \ + arm/hpeldsp_neon.o +NEON-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_neon.o \ + arm/idctdsp_neon.o \ + arm/simple_idct_neon.o +NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ + arm/mdct_fixed_neon.o +NEON-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_neon.o +NEON-OBJS-$(CONFIG_RDFT) += arm/rdft_neon.o +NEON-OBJS-$(CONFIG_VC1DSP) += arm/vc1dsp_init_neon.o \ + arm/vc1dsp_neon.o +NEON-OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_neon.o +NEON-OBJS-$(CONFIG_VP8DSP) += arm/vp8dsp_init_neon.o \ + arm/vp8dsp_neon.o + +# decoders/encoders +NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_neon.o \ + arm/sbrdsp_neon.o +NEON-OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_neon.o +NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_neon.o +NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ + arm/hevcdsp_deblock_neon.o \ + arm/hevcdsp_idct_neon.o \ + arm/hevcdsp_qpel_neon.o \ + arm/hevcdsp_sao_neon.o +NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o +NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ + arm/rv40dsp_neon.o +NEON-OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_neon.o +NEON-OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_neon.o +NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_neon.o +NEON-OBJS-$(CONFIG_VP9_DECODER) += arm/vp9itxfm_16bpp_neon.o \ + arm/vp9itxfm_neon.o \ + arm/vp9lpf_16bpp_neon.o \ + arm/vp9lpf_neon.o \ + arm/vp9mc_16bpp_neon.o \ + arm/vp9mc_neon.o diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/aac.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/aac.h new file mode 100644 index 0000000000..cafa881fc7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/aac.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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_ARM_AAC_H +#define AVCODEC_ARM_AAC_H + +#include "config.h" + +#if HAVE_NEON_INLINE + +#define VMUL2 VMUL2 +static inline float *VMUL2(float *dst, const float *v, unsigned idx, + const float *scale) +{ + unsigned v0, v1; + __asm__ ("ubfx %0, %6, #0, #4 \n\t" + "ubfx %1, %6, #4, #4 \n\t" + "ldr %0, [%5, %0, lsl #2] \n\t" + "ldr %1, [%5, %1, lsl #2] \n\t" + "vld1.32 {d1[]}, [%7,:32] \n\t" + "vmov d0, %0, %1 \n\t" + "vmul.f32 d0, d0, d1 \n\t" + "vst1.32 {d0}, [%2,:64]! \n\t" + : "=&r"(v0), "=&r"(v1), "+r"(dst), "=m"(dst[0]), "=m"(dst[1]) + : "r"(v), "r"(idx), "r"(scale) + : "d0", "d1"); + return dst; +} + +#define VMUL4 VMUL4 +static inline float *VMUL4(float *dst, const float *v, unsigned idx, + const float *scale) +{ + unsigned v0, v1, v2, v3; + __asm__ ("ubfx %0, %10, #0, #2 \n\t" + "ubfx %1, %10, #2, #2 \n\t" + "ldr %0, [%9, %0, lsl #2] \n\t" + "ubfx %2, %10, #4, #2 \n\t" + "ldr %1, [%9, %1, lsl #2] \n\t" + "ubfx %3, %10, #6, #2 \n\t" + "ldr %2, [%9, %2, lsl #2] \n\t" + "vmov d0, %0, %1 \n\t" + "ldr %3, [%9, %3, lsl #2] \n\t" + "vld1.32 {d2[],d3[]},[%11,:32] \n\t" + "vmov d1, %2, %3 \n\t" + "vmul.f32 q0, q0, q1 \n\t" + "vst1.32 {q0}, [%4,:128]! \n\t" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), + "=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3]) + : "r"(v), "r"(idx), "r"(scale) + : "d0", "d1", "d2", "d3"); + return dst; +} + +#define VMUL2S VMUL2S +static inline float *VMUL2S(float *dst, const float *v, unsigned idx, + unsigned sign, const float *scale) +{ + unsigned v0, v1, v2, v3; + __asm__ ("ubfx %0, %8, #0, #4 \n\t" + "ubfx %1, %8, #4, #4 \n\t" + "ldr %0, [%7, %0, lsl #2] \n\t" + "lsl %2, %10, #30 \n\t" + "ldr %1, [%7, %1, lsl #2] \n\t" + "lsl %3, %10, #31 \n\t" + "vmov d0, %0, %1 \n\t" + "bic %2, %2, #1<<30 \n\t" + "vld1.32 {d1[]}, [%9,:32] \n\t" + "vmov d2, %2, %3 \n\t" + "veor d0, d0, d2 \n\t" + "vmul.f32 d0, d0, d1 \n\t" + "vst1.32 {d0}, [%4,:64]! \n\t" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), + "=m"(dst[0]), "=m"(dst[1]) + : "r"(v), "r"(idx), "r"(scale), "r"(sign) + : "d0", "d1", "d2"); + return dst; +} + +#define VMUL4S VMUL4S +static inline float *VMUL4S(float *dst, const float *v, unsigned idx, + unsigned sign, const float *scale) +{ + unsigned v0, v1, v2, v3, nz; + __asm__ ("vld1.32 {d2[],d3[]},[%13,:32] \n\t" + "ubfx %0, %12, #0, #2 \n\t" + "ubfx %1, %12, #2, #2 \n\t" + "ldr %0, [%11,%0, lsl #2] \n\t" + "ubfx %2, %12, #4, #2 \n\t" + "ldr %1, [%11,%1, lsl #2] \n\t" + "ubfx %3, %12, #6, #2 \n\t" + "ldr %2, [%11,%2, lsl #2] \n\t" + "vmov d0, %0, %1 \n\t" + "ldr %3, [%11,%3, lsl #2] \n\t" + "lsr %6, %12, #12 \n\t" + "rbit %6, %6 \n\t" + "vmov d1, %2, %3 \n\t" + "lsls %6, %6, #1 \n\t" + "and %0, %5, #1<<31 \n\t" + "it cs \n\t" + "lslcs %5, %5, #1 \n\t" + "lsls %6, %6, #1 \n\t" + "and %1, %5, #1<<31 \n\t" + "it cs \n\t" + "lslcs %5, %5, #1 \n\t" + "lsls %6, %6, #1 \n\t" + "and %2, %5, #1<<31 \n\t" + "it cs \n\t" + "lslcs %5, %5, #1 \n\t" + "vmov d4, %0, %1 \n\t" + "and %3, %5, #1<<31 \n\t" + "vmov d5, %2, %3 \n\t" + "veor q0, q0, q2 \n\t" + "vmul.f32 q0, q0, q1 \n\t" + "vst1.32 {q0}, [%4,:128]! \n\t" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), + "+r"(sign), "=r"(nz), + "=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3]) + : "r"(v), "r"(idx), "r"(scale) + : "cc", "d0", "d1", "d2", "d3", "d4", "d5"); + return dst; +} + +#endif /* HAVE_NEON_INLINE */ + +#endif /* AVCODEC_ARM_AAC_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/aacpsdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/aacpsdsp_init_arm.c new file mode 100644 index 0000000000..6eb979ed1d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/aacpsdsp_init_arm.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/aacpsdsp.h" + +void ff_ps_add_squares_neon(float *dst, const float (*src)[2], int n); +void ff_ps_mul_pair_single_neon(float (*dst)[2], float (*src0)[2], + float *src1, int n); +void ff_ps_hybrid_analysis_neon(float (*out)[2], float (*in)[2], + const float (*filter)[8][2], + ptrdiff_t stride, int n); +void ff_ps_hybrid_analysis_ileave_neon(float (*out)[32][2], float L[2][38][64], + int i, int len); +void ff_ps_hybrid_synthesis_deint_neon(float out[2][38][64], float (*in)[32][2], + int i, int len); +void ff_ps_decorrelate_neon(float (*out)[2], float (*delay)[2], + float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2], + const float phi_fract[2], float (*Q_fract)[2], + const float *transient_gain, float g_decay_slope, + int len); +void ff_ps_stereo_interpolate_neon(float (*l)[2], float (*r)[2], + float h[2][4], float h_step[2][4], + int len); + +av_cold void ff_psdsp_init_arm(PSDSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->add_squares = ff_ps_add_squares_neon; + s->mul_pair_single = ff_ps_mul_pair_single_neon; + s->hybrid_synthesis_deint = ff_ps_hybrid_synthesis_deint_neon; + s->hybrid_analysis = ff_ps_hybrid_analysis_neon; + s->stereo_interpolate[0] = ff_ps_stereo_interpolate_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/ac3dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/ac3dsp_init_arm.c new file mode 100644 index 0000000000..a3c32ff407 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/ac3dsp_init_arm.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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 + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/ac3dsp.h" +#include "config.h" + +void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs); +int ff_ac3_max_msb_abs_int16_neon(const int16_t *src, int len); +void ff_ac3_lshift_int16_neon(int16_t *src, unsigned len, unsigned shift); +void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift); +void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len); +void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs); +void ff_apply_window_int16_neon(int16_t *dst, const int16_t *src, + const int16_t *window, unsigned n); +void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4], + const int32_t *coef0, + const int32_t *coef1, + int len); +void ff_ac3_sum_square_butterfly_float_neon(float sum[4], + const float *coef0, + const float *coef1, + int len); + +void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd, + int start, int end, + int snr_offset, int floor, + const uint8_t *bap_tab, uint8_t *bap); + +void ff_ac3_update_bap_counts_arm(uint16_t mant_cnt[16], uint8_t *bap, int len); + +av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact) +{ + int cpu_flags = av_get_cpu_flags(); + + c->update_bap_counts = ff_ac3_update_bap_counts_arm; + + if (have_armv6(cpu_flags)) { + c->bit_alloc_calc_bap = ff_ac3_bit_alloc_calc_bap_armv6; + } + + if (have_neon(cpu_flags)) { + c->ac3_exponent_min = ff_ac3_exponent_min_neon; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon; + c->ac3_lshift_int16 = ff_ac3_lshift_int16_neon; + c->ac3_rshift_int32 = ff_ac3_rshift_int32_neon; + c->float_to_fixed24 = ff_float_to_fixed24_neon; + c->extract_exponents = ff_ac3_extract_exponents_neon; + c->apply_window_int16 = ff_apply_window_int16_neon; + c->sum_square_butterfly_int32 = ff_ac3_sum_square_butterfly_int32_neon; + c->sum_square_butterfly_float = ff_ac3_sum_square_butterfly_float_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/Makefile new file mode 100644 index 0000000000..e656011c3c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/Makefile @@ -0,0 +1,154 @@ +ARCH_HEADERS = mathops.h + +# subsystems +OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \ + arm/ac3dsp_arm.o +OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_arm.o +OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_arm.o +OBJS-$(CONFIG_FFT) += arm/fft_init_arm.o \ + arm/fft_fixed_init_arm.o +OBJS-$(CONFIG_FLACDSP) += arm/flacdsp_init_arm.o \ + arm/flacdsp_arm.o +OBJS-$(CONFIG_FMTCONVERT) += arm/fmtconvert_init_arm.o +OBJS-$(CONFIG_G722DSP) += arm/g722dsp_init_arm.o +OBJS-$(CONFIG_H264CHROMA) += arm/h264chroma_init_arm.o +OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o +OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o +OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_init_arm.o +OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_arm.o \ + arm/hpeldsp_arm.o +OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_arm.o \ + arm/idctdsp_arm.o \ + arm/jrevdct_arm.o \ + arm/simple_idct_arm.o +OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_init_arm.o +OBJS-$(CONFIG_ME_CMP) += arm/me_cmp_init_arm.o +OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o +OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o +OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_init_arm.o +OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o +OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_init_arm.o +OBJS-$(CONFIG_RDFT) += arm/rdft_init_arm.o +OBJS-$(CONFIG_RV34DSP) += arm/rv34dsp_init_arm.o +OBJS-$(CONFIG_VC1DSP) += arm/vc1dsp_init_arm.o +OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_arm.o +OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_init_arm.o +OBJS-$(CONFIG_VP8DSP) += arm/vp8dsp_init_arm.o + +# decoders/encoders +OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_init_arm.o \ + arm/sbrdsp_init_arm.o +OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_init_arm.o +OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_arm.o +OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o +OBJS-$(CONFIG_RV40_DECODER) += arm/rv40dsp_init_arm.o +OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_init_arm.o +OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o +OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_init_arm.o +OBJS-$(CONFIG_VP9_DECODER) += arm/vp9dsp_init_10bpp_arm.o \ + arm/vp9dsp_init_12bpp_arm.o \ + arm/vp9dsp_init_arm.o + + +# ARMv5 optimizations +# subsystems +ARMV5TE-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv5te.o \ + arm/simple_idct_armv5te.o +ARMV5TE-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_armv5te.o \ + arm/mpegvideo_armv5te_s.o +ARMV5TE-OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_armv5te.o \ + arm/videodsp_armv5te.o + +# decoders/encoders +ARMV5TE-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv5te.o + + +# ARMv6 optimizations +# subsystems +ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o +ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ + arm/hpeldsp_armv6.o +ARMV6-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv6.o \ + arm/idctdsp_armv6.o \ + arm/simple_idct_armv6.o +ARMV6-OBJS-$(CONFIG_ME_CMP) += arm/me_cmp_armv6.o +ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o +ARMV6-OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_armv6.o +ARMV6-OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_armv6.o +ARMV6-OBJS-$(CONFIG_STARTCODE) += arm/startcode_armv6.o +ARMV6-OBJS-$(CONFIG_VP8DSP) += arm/vp8_armv6.o \ + arm/vp8dsp_init_armv6.o \ + arm/vp8dsp_armv6.o + +# decoders/encoders +ARMV6-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv6.o +ARMV6-OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_armv6.o + + +# VFP optimizations + +# subsystems +VFP-OBJS-$(CONFIG_FFT) += arm/fft_vfp.o +VFP-OBJS-$(CONFIG_FMTCONVERT) += arm/fmtconvert_vfp.o +VFP-OBJS-$(CONFIG_MDCT) += arm/mdct_vfp.o + +# decoders/encoders +VFP-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_vfp.o + + +# NEON optimizations + +# subsystems +NEON-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_neon.o +NEON-OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_neon.o \ + arm/audiodsp_neon.o \ + arm/int_neon.o +NEON-OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_neon.o \ + arm/blockdsp_neon.o +NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ + arm/fft_fixed_neon.o +NEON-OBJS-$(CONFIG_FMTCONVERT) += arm/fmtconvert_neon.o +NEON-OBJS-$(CONFIG_G722DSP) += arm/g722dsp_neon.o +NEON-OBJS-$(CONFIG_H264CHROMA) += arm/h264cmc_neon.o +NEON-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_neon.o \ + arm/h264idct_neon.o +NEON-OBJS-$(CONFIG_H264PRED) += arm/h264pred_neon.o +NEON-OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_neon.o \ + arm/hpeldsp_neon.o +NEON-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_neon.o \ + arm/hpeldsp_neon.o +NEON-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_neon.o \ + arm/idctdsp_neon.o \ + arm/simple_idct_neon.o +NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ + arm/mdct_fixed_neon.o +NEON-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_neon.o +NEON-OBJS-$(CONFIG_RDFT) += arm/rdft_neon.o +NEON-OBJS-$(CONFIG_VC1DSP) += arm/vc1dsp_init_neon.o \ + arm/vc1dsp_neon.o +NEON-OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_neon.o +NEON-OBJS-$(CONFIG_VP8DSP) += arm/vp8dsp_init_neon.o \ + arm/vp8dsp_neon.o + +# decoders/encoders +NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_neon.o \ + arm/sbrdsp_neon.o +NEON-OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_neon.o +NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_neon.o +NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ + arm/hevcdsp_deblock_neon.o \ + arm/hevcdsp_idct_neon.o \ + arm/hevcdsp_qpel_neon.o \ + arm/hevcdsp_sao_neon.o +NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o +NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ + arm/rv40dsp_neon.o +NEON-OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_neon.o +NEON-OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_neon.o +NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_neon.o +NEON-OBJS-$(CONFIG_VP9_DECODER) += arm/vp9itxfm_16bpp_neon.o \ + arm/vp9itxfm_neon.o \ + arm/vp9lpf_16bpp_neon.o \ + arm/vp9lpf_neon.o \ + arm/vp9mc_16bpp_neon.o \ + arm/vp9mc_neon.o diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/aac.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/aac.h new file mode 100644 index 0000000000..cafa881fc7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/aac.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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_ARM_AAC_H +#define AVCODEC_ARM_AAC_H + +#include "config.h" + +#if HAVE_NEON_INLINE + +#define VMUL2 VMUL2 +static inline float *VMUL2(float *dst, const float *v, unsigned idx, + const float *scale) +{ + unsigned v0, v1; + __asm__ ("ubfx %0, %6, #0, #4 \n\t" + "ubfx %1, %6, #4, #4 \n\t" + "ldr %0, [%5, %0, lsl #2] \n\t" + "ldr %1, [%5, %1, lsl #2] \n\t" + "vld1.32 {d1[]}, [%7,:32] \n\t" + "vmov d0, %0, %1 \n\t" + "vmul.f32 d0, d0, d1 \n\t" + "vst1.32 {d0}, [%2,:64]! \n\t" + : "=&r"(v0), "=&r"(v1), "+r"(dst), "=m"(dst[0]), "=m"(dst[1]) + : "r"(v), "r"(idx), "r"(scale) + : "d0", "d1"); + return dst; +} + +#define VMUL4 VMUL4 +static inline float *VMUL4(float *dst, const float *v, unsigned idx, + const float *scale) +{ + unsigned v0, v1, v2, v3; + __asm__ ("ubfx %0, %10, #0, #2 \n\t" + "ubfx %1, %10, #2, #2 \n\t" + "ldr %0, [%9, %0, lsl #2] \n\t" + "ubfx %2, %10, #4, #2 \n\t" + "ldr %1, [%9, %1, lsl #2] \n\t" + "ubfx %3, %10, #6, #2 \n\t" + "ldr %2, [%9, %2, lsl #2] \n\t" + "vmov d0, %0, %1 \n\t" + "ldr %3, [%9, %3, lsl #2] \n\t" + "vld1.32 {d2[],d3[]},[%11,:32] \n\t" + "vmov d1, %2, %3 \n\t" + "vmul.f32 q0, q0, q1 \n\t" + "vst1.32 {q0}, [%4,:128]! \n\t" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), + "=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3]) + : "r"(v), "r"(idx), "r"(scale) + : "d0", "d1", "d2", "d3"); + return dst; +} + +#define VMUL2S VMUL2S +static inline float *VMUL2S(float *dst, const float *v, unsigned idx, + unsigned sign, const float *scale) +{ + unsigned v0, v1, v2, v3; + __asm__ ("ubfx %0, %8, #0, #4 \n\t" + "ubfx %1, %8, #4, #4 \n\t" + "ldr %0, [%7, %0, lsl #2] \n\t" + "lsl %2, %10, #30 \n\t" + "ldr %1, [%7, %1, lsl #2] \n\t" + "lsl %3, %10, #31 \n\t" + "vmov d0, %0, %1 \n\t" + "bic %2, %2, #1<<30 \n\t" + "vld1.32 {d1[]}, [%9,:32] \n\t" + "vmov d2, %2, %3 \n\t" + "veor d0, d0, d2 \n\t" + "vmul.f32 d0, d0, d1 \n\t" + "vst1.32 {d0}, [%4,:64]! \n\t" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), + "=m"(dst[0]), "=m"(dst[1]) + : "r"(v), "r"(idx), "r"(scale), "r"(sign) + : "d0", "d1", "d2"); + return dst; +} + +#define VMUL4S VMUL4S +static inline float *VMUL4S(float *dst, const float *v, unsigned idx, + unsigned sign, const float *scale) +{ + unsigned v0, v1, v2, v3, nz; + __asm__ ("vld1.32 {d2[],d3[]},[%13,:32] \n\t" + "ubfx %0, %12, #0, #2 \n\t" + "ubfx %1, %12, #2, #2 \n\t" + "ldr %0, [%11,%0, lsl #2] \n\t" + "ubfx %2, %12, #4, #2 \n\t" + "ldr %1, [%11,%1, lsl #2] \n\t" + "ubfx %3, %12, #6, #2 \n\t" + "ldr %2, [%11,%2, lsl #2] \n\t" + "vmov d0, %0, %1 \n\t" + "ldr %3, [%11,%3, lsl #2] \n\t" + "lsr %6, %12, #12 \n\t" + "rbit %6, %6 \n\t" + "vmov d1, %2, %3 \n\t" + "lsls %6, %6, #1 \n\t" + "and %0, %5, #1<<31 \n\t" + "it cs \n\t" + "lslcs %5, %5, #1 \n\t" + "lsls %6, %6, #1 \n\t" + "and %1, %5, #1<<31 \n\t" + "it cs \n\t" + "lslcs %5, %5, #1 \n\t" + "lsls %6, %6, #1 \n\t" + "and %2, %5, #1<<31 \n\t" + "it cs \n\t" + "lslcs %5, %5, #1 \n\t" + "vmov d4, %0, %1 \n\t" + "and %3, %5, #1<<31 \n\t" + "vmov d5, %2, %3 \n\t" + "veor q0, q0, q2 \n\t" + "vmul.f32 q0, q0, q1 \n\t" + "vst1.32 {q0}, [%4,:128]! \n\t" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst), + "+r"(sign), "=r"(nz), + "=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3]) + : "r"(v), "r"(idx), "r"(scale) + : "cc", "d0", "d1", "d2", "d3", "d4", "d5"); + return dst; +} + +#endif /* HAVE_NEON_INLINE */ + +#endif /* AVCODEC_ARM_AAC_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/aacpsdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/aacpsdsp_init_arm.c new file mode 100644 index 0000000000..6eb979ed1d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/aacpsdsp_init_arm.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/aacpsdsp.h" + +void ff_ps_add_squares_neon(float *dst, const float (*src)[2], int n); +void ff_ps_mul_pair_single_neon(float (*dst)[2], float (*src0)[2], + float *src1, int n); +void ff_ps_hybrid_analysis_neon(float (*out)[2], float (*in)[2], + const float (*filter)[8][2], + ptrdiff_t stride, int n); +void ff_ps_hybrid_analysis_ileave_neon(float (*out)[32][2], float L[2][38][64], + int i, int len); +void ff_ps_hybrid_synthesis_deint_neon(float out[2][38][64], float (*in)[32][2], + int i, int len); +void ff_ps_decorrelate_neon(float (*out)[2], float (*delay)[2], + float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2], + const float phi_fract[2], float (*Q_fract)[2], + const float *transient_gain, float g_decay_slope, + int len); +void ff_ps_stereo_interpolate_neon(float (*l)[2], float (*r)[2], + float h[2][4], float h_step[2][4], + int len); + +av_cold void ff_psdsp_init_arm(PSDSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->add_squares = ff_ps_add_squares_neon; + s->mul_pair_single = ff_ps_mul_pair_single_neon; + s->hybrid_synthesis_deint = ff_ps_hybrid_synthesis_deint_neon; + s->hybrid_analysis = ff_ps_hybrid_analysis_neon; + s->stereo_interpolate[0] = ff_ps_stereo_interpolate_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/ac3dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/ac3dsp_init_arm.c new file mode 100644 index 0000000000..a3c32ff407 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/ac3dsp_init_arm.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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 + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/ac3dsp.h" +#include "config.h" + +void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs); +int ff_ac3_max_msb_abs_int16_neon(const int16_t *src, int len); +void ff_ac3_lshift_int16_neon(int16_t *src, unsigned len, unsigned shift); +void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift); +void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len); +void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs); +void ff_apply_window_int16_neon(int16_t *dst, const int16_t *src, + const int16_t *window, unsigned n); +void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4], + const int32_t *coef0, + const int32_t *coef1, + int len); +void ff_ac3_sum_square_butterfly_float_neon(float sum[4], + const float *coef0, + const float *coef1, + int len); + +void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd, + int start, int end, + int snr_offset, int floor, + const uint8_t *bap_tab, uint8_t *bap); + +void ff_ac3_update_bap_counts_arm(uint16_t mant_cnt[16], uint8_t *bap, int len); + +av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact) +{ + int cpu_flags = av_get_cpu_flags(); + + c->update_bap_counts = ff_ac3_update_bap_counts_arm; + + if (have_armv6(cpu_flags)) { + c->bit_alloc_calc_bap = ff_ac3_bit_alloc_calc_bap_armv6; + } + + if (have_neon(cpu_flags)) { + c->ac3_exponent_min = ff_ac3_exponent_min_neon; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon; + c->ac3_lshift_int16 = ff_ac3_lshift_int16_neon; + c->ac3_rshift_int32 = ff_ac3_rshift_int32_neon; + c->float_to_fixed24 = ff_float_to_fixed24_neon; + c->extract_exponents = ff_ac3_extract_exponents_neon; + c->apply_window_int16 = ff_apply_window_int16_neon; + c->sum_square_butterfly_int32 = ff_ac3_sum_square_butterfly_int32_neon; + c->sum_square_butterfly_float = ff_ac3_sum_square_butterfly_float_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/asm-offsets.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/asm-offsets.h new file mode 100644 index 0000000000..a2174b0a08 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/asm-offsets.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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_ARM_ASM_OFFSETS_H +#define AVCODEC_ARM_ASM_OFFSETS_H + +/* MpegEncContext */ +#define Y_DC_SCALE 0x04 +#define C_DC_SCALE 0x08 +#define AC_PRED 0x0c +#define BLOCK_LAST_INDEX 0x10 +#define H263_AIC 0x40 +#define INTER_SCANTAB_RASTER_END 0x88 + +#endif /* AVCODEC_ARM_ASM_OFFSETS_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_arm.h new file mode 100644 index 0000000000..213660dae7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_AUDIODSP_ARM_H +#define AVCODEC_ARM_AUDIODSP_ARM_H + +#include "libavcodec/audiodsp.h" + +void ff_audiodsp_init_neon(AudioDSPContext *c); + +#endif /* AVCODEC_ARM_AUDIODSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_init_arm.c new file mode 100644 index 0000000000..74aa52a4ef --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_init_arm.c @@ -0,0 +1,33 @@ +/* + * ARM optimized audio functions + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/audiodsp.h" +#include "audiodsp_arm.h" + +av_cold void ff_audiodsp_init_arm(AudioDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + ff_audiodsp_init_neon(c); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_init_neon.c new file mode 100644 index 0000000000..6902db86b4 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/audiodsp_init_neon.c @@ -0,0 +1,40 @@ +/* + * ARM NEON optimised audio functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/audiodsp.h" +#include "audiodsp_arm.h" + +void ff_vector_clipf_neon(float *dst, const float *src, int len, float min, float max); +void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min, + int32_t max, unsigned int len); + +int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int len); + +av_cold void ff_audiodsp_init_neon(AudioDSPContext *c) +{ + c->vector_clip_int32 = ff_vector_clip_int32_neon; + c->vector_clipf = ff_vector_clipf_neon; + + c->scalarproduct_int16 = ff_scalarproduct_int16_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_arm.h new file mode 100644 index 0000000000..59ebeb8466 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_BLOCKDSP_ARM_H +#define AVCODEC_ARM_BLOCKDSP_ARM_H + +#include "libavcodec/blockdsp.h" + +void ff_blockdsp_init_neon(BlockDSPContext *c); + +#endif /* AVCODEC_ARM_BLOCKDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_init_arm.c new file mode 100644 index 0000000000..2080d5253f --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_init_arm.c @@ -0,0 +1,33 @@ +/* + * ARM optimized block operations + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/blockdsp.h" +#include "blockdsp_arm.h" + +av_cold void ff_blockdsp_init_arm(BlockDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + ff_blockdsp_init_neon(c); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_init_neon.c new file mode 100644 index 0000000000..0600bc6e50 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/blockdsp_init_neon.c @@ -0,0 +1,35 @@ +/* + * ARM NEON optimised block operations + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/blockdsp.h" +#include "blockdsp_arm.h" + +void ff_clear_block_neon(int16_t *block); +void ff_clear_blocks_neon(int16_t *blocks); + +av_cold void ff_blockdsp_init_neon(BlockDSPContext *c) +{ + c->clear_block = ff_clear_block_neon; + c->clear_blocks = ff_clear_blocks_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/cabac.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/cabac.h new file mode 100644 index 0000000000..fdbf86b45e --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/cabac.h @@ -0,0 +1,108 @@ +/* + * 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_ARM_CABAC_H +#define AVCODEC_ARM_CABAC_H + +#include "config.h" +#if HAVE_ARMV6T2_INLINE + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavcodec/cabac.h" + +#define get_cabac_inline get_cabac_inline_arm +static av_always_inline int get_cabac_inline_arm(CABACContext *c, + uint8_t *const state) +{ + int bit; + void *reg_b, *reg_c, *tmp; + + __asm__ volatile( + "ldrb %[bit] , [%[state]] \n\t" + "add %[r_b] , %[tables] , %[lps_off] \n\t" + "mov %[tmp] , %[range] \n\t" + "and %[range] , %[range] , #0xC0 \n\t" + "add %[r_b] , %[r_b] , %[bit] \n\t" + "ldrb %[range] , [%[r_b], %[range], lsl #1] \n\t" + "add %[r_b] , %[tables] , %[norm_off] \n\t" + "sub %[r_c] , %[tmp] , %[range] \n\t" + "lsl %[tmp] , %[r_c] , #17 \n\t" + "cmp %[tmp] , %[low] \n\t" + "it gt \n\t" + "movgt %[range] , %[r_c] \n\t" + "itt cc \n\t" + "mvncc %[bit] , %[bit] \n\t" + "subcc %[low] , %[low] , %[tmp] \n\t" + "add %[r_c] , %[tables] , %[mlps_off] \n\t" + "ldrb %[tmp] , [%[r_b], %[range]] \n\t" + "ldrb %[r_b] , [%[r_c], %[bit]] \n\t" + "lsl %[low] , %[low] , %[tmp] \n\t" + "lsl %[range] , %[range] , %[tmp] \n\t" + "uxth %[r_c] , %[low] \n\t" + "strb %[r_b] , [%[state]] \n\t" + "tst %[r_c] , %[r_c] \n\t" + "bne 2f \n\t" + "ldr %[r_c] , [%[c], %[byte]] \n\t" +#if UNCHECKED_BITSTREAM_READER + "ldrh %[tmp] , [%[r_c]] \n\t" + "add %[r_c] , %[r_c] , #2 \n\t" + "str %[r_c] , [%[c], %[byte]] \n\t" +#else + "ldr %[r_b] , [%[c], %[end]] \n\t" + "ldrh %[tmp] , [%[r_c]] \n\t" + "cmp %[r_c] , %[r_b] \n\t" + "itt lt \n\t" + "addlt %[r_c] , %[r_c] , #2 \n\t" + "strlt %[r_c] , [%[c], %[byte]] \n\t" +#endif + "sub %[r_c] , %[low] , #1 \n\t" + "add %[r_b] , %[tables] , %[norm_off] \n\t" + "eor %[r_c] , %[low] , %[r_c] \n\t" + "rev %[tmp] , %[tmp] \n\t" + "lsr %[r_c] , %[r_c] , #15 \n\t" + "lsr %[tmp] , %[tmp] , #15 \n\t" + "ldrb %[r_c] , [%[r_b], %[r_c]] \n\t" + "movw %[r_b] , #0xFFFF \n\t" + "sub %[tmp] , %[tmp] , %[r_b] \n\t" + "rsb %[r_c] , %[r_c] , #7 \n\t" + "lsl %[tmp] , %[tmp] , %[r_c] \n\t" + "add %[low] , %[low] , %[tmp] \n\t" + "2: \n\t" + : [bit]"=&r"(bit), + [low]"+&r"(c->low), + [range]"+&r"(c->range), + [r_b]"=&r"(reg_b), + [r_c]"=&r"(reg_c), + [tmp]"=&r"(tmp) + : [c]"r"(c), + [state]"r"(state), + [tables]"r"(ff_h264_cabac_tables), + [byte]"M"(offsetof(CABACContext, bytestream)), + [end]"M"(offsetof(CABACContext, bytestream_end)), + [norm_off]"I"(H264_NORM_SHIFT_OFFSET), + [lps_off]"I"(H264_LPS_RANGE_OFFSET), + [mlps_off]"I"(H264_MLPS_STATE_OFFSET + 128) + : "memory", "cc" + ); + + return bit & 1; +} +#endif /* HAVE_ARMV6T2_INLINE */ + +#endif /* AVCODEC_ARM_CABAC_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/dca.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/dca.h new file mode 100644 index 0000000000..ae4b730a8a --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/dca.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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_ARM_DCA_H +#define AVCODEC_ARM_DCA_H + +#include + +#include "config.h" +#include "libavcodec/mathops.h" + +#if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4) && !CONFIG_THUMB + +#define decode_blockcodes decode_blockcodes +static inline int decode_blockcodes(int code1, int code2, int levels, + int32_t *values) +{ + int32_t v0, v1, v2, v3, v4, v5; + + __asm__ ("smmul %0, %6, %10 \n" + "smmul %3, %7, %10 \n" + "smlabb %6, %0, %9, %6 \n" + "smlabb %7, %3, %9, %7 \n" + "smmul %1, %0, %10 \n" + "smmul %4, %3, %10 \n" + "sub %6, %6, %8, lsr #1 \n" + "sub %7, %7, %8, lsr #1 \n" + "smlabb %0, %1, %9, %0 \n" + "smlabb %3, %4, %9, %3 \n" + "smmul %2, %1, %10 \n" + "smmul %5, %4, %10 \n" + "str %6, [%11, #0] \n" + "str %7, [%11, #16] \n" + "sub %0, %0, %8, lsr #1 \n" + "sub %3, %3, %8, lsr #1 \n" + "smlabb %1, %2, %9, %1 \n" + "smlabb %4, %5, %9, %4 \n" + "smmul %6, %2, %10 \n" + "smmul %7, %5, %10 \n" + "str %0, [%11, #4] \n" + "str %3, [%11, #20] \n" + "sub %1, %1, %8, lsr #1 \n" + "sub %4, %4, %8, lsr #1 \n" + "smlabb %2, %6, %9, %2 \n" + "smlabb %5, %7, %9, %5 \n" + "str %1, [%11, #8] \n" + "str %4, [%11, #24] \n" + "sub %2, %2, %8, lsr #1 \n" + "sub %5, %5, %8, lsr #1 \n" + "str %2, [%11, #12] \n" + "str %5, [%11, #28] \n" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), + "=&r"(v3), "=&r"(v4), "=&r"(v5), + "+&r"(code1), "+&r"(code2) + : "r"(levels - 1), "r"(-levels), + "r"(ff_inverse[levels]), "r"(values) + : "memory"); + + return code1 | code2; +} + +#endif + +#endif /* AVCODEC_ARM_DCA_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fft_fixed_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fft_fixed_init_arm.c new file mode 100644 index 0000000000..11226d65ff --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fft_fixed_init_arm.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#define FFT_FLOAT 0 +#include "libavcodec/fft.h" + +void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z); +void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i); +void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i); + +av_cold void ff_fft_fixed_init_arm(FFTContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; +#if CONFIG_FFT + s->fft_calc = ff_fft_fixed_calc_neon; +#endif + +#if CONFIG_MDCT + if (!s->inverse && s->nbits >= 3) { + s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; + s->mdct_calc = ff_mdct_fixed_calc_neon; + s->mdct_calcw = ff_mdct_fixed_calcw_neon; + } +#endif + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fft_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fft_init_arm.c new file mode 100644 index 0000000000..331bd65e5c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fft_init_arm.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/fft.h" + +void ff_fft_calc_vfp(FFTContext *s, FFTComplex *z); + +void ff_fft_permute_neon(FFTContext *s, FFTComplex *z); +void ff_fft_calc_neon(FFTContext *s, FFTComplex *z); + +void ff_imdct_half_vfp(FFTContext *s, FFTSample *output, const FFTSample *input); + +void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); + +av_cold void ff_fft_init_arm(FFTContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_vfp_vm(cpu_flags)) { + s->fft_calc = ff_fft_calc_vfp; +#if CONFIG_MDCT + s->imdct_half = ff_imdct_half_vfp; +#endif + } + + if (have_neon(cpu_flags)) { +#if CONFIG_FFT + s->fft_permute = ff_fft_permute_neon; + s->fft_calc = ff_fft_calc_neon; +#endif +#if CONFIG_MDCT + s->imdct_calc = ff_imdct_calc_neon; + s->imdct_half = ff_imdct_half_neon; + s->mdct_calc = ff_mdct_calc_neon; + s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; +#endif + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/flacdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/flacdsp_init_arm.c new file mode 100644 index 0000000000..564e3dc79b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/flacdsp_init_arm.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * 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 "libavcodec/flacdsp.h" +#include "config.h" + +void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order, + int qlevel, int len); + +av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, + int bps) +{ + if (CONFIG_FLAC_DECODER) + c->lpc16 = ff_flac_lpc_16_arm; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fmtconvert_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fmtconvert_init_arm.c new file mode 100644 index 0000000000..e88255d619 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/fmtconvert_init_arm.c @@ -0,0 +1,53 @@ +/* + * ARM optimized Format Conversion Utils + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/fmtconvert.h" + +void ff_int32_to_float_fmul_array8_neon(FmtConvertContext *c, float *dst, + const int32_t *src, const float *mul, + int len); +void ff_int32_to_float_fmul_scalar_neon(float *dst, const int32_t *src, + float mul, int len); + +void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src, + float mul, int len); +void ff_int32_to_float_fmul_array8_vfp(FmtConvertContext *c, float *dst, + const int32_t *src, const float *mul, + int len); + +av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_vfp_vm(cpu_flags)) { + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp; + c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_vfp; + } + + if (have_neon(cpu_flags)) { + c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_neon; + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/g722dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/g722dsp_init_arm.c new file mode 100644 index 0000000000..c0e5d8b989 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/g722dsp_init_arm.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2015 Peter Meerwald + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/g722dsp.h" + +extern void ff_g722_apply_qmf_neon(const int16_t *prev_samples, int xout[2]); + +av_cold void ff_g722dsp_init_arm(G722DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + dsp->apply_qmf = ff_g722_apply_qmf_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264chroma_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264chroma_init_arm.c new file mode 100644 index 0000000000..aae804b621 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264chroma_init_arm.c @@ -0,0 +1,57 @@ +/* + * ARM NEON optimised H.264 chroma functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264chroma.h" + +void ff_put_h264_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_h264_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_h264_chroma_mc2_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +void ff_avg_h264_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_h264_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_h264_chroma_mc2_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +av_cold void ff_h264chroma_init_arm(H264ChromaContext *c, int bit_depth) +{ + const int high_bit_depth = bit_depth > 8; + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags) && !high_bit_depth) { + c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon; + c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon; + c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon; + + c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_neon; + c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_neon; + c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264dsp_init_arm.c new file mode 100644 index 0000000000..90144d0da2 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264dsp_init_arm.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264dsp.h" +#include "libavcodec/arm/startcode.h" + +void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); + +void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); +void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); +void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); + +void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); +void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); +void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); + +void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); +void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); +void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); + +void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); + +static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc) +{ +#if HAVE_NEON + if (bit_depth == 8) { + c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; + c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; + c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; + if(chroma_format_idc == 1){ + c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; + } + + c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; + c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon; + c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon; + + c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; + c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; + c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; + + c->h264_idct_add = ff_h264_idct_add_neon; + c->h264_idct_dc_add = ff_h264_idct_dc_add_neon; + c->h264_idct_add16 = ff_h264_idct_add16_neon; + c->h264_idct_add16intra = ff_h264_idct_add16intra_neon; + if (chroma_format_idc <= 1) + c->h264_idct_add8 = ff_h264_idct_add8_neon; + c->h264_idct8_add = ff_h264_idct8_add_neon; + c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon; + c->h264_idct8_add4 = ff_h264_idct8_add4_neon; + } +#endif // HAVE_NEON +} + +av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc) +{ + int cpu_flags = av_get_cpu_flags(); + +#if HAVE_ARMV6 + if (have_setend(cpu_flags)) + c->startcode_find_candidate = ff_startcode_find_candidate_armv6; +#endif + if (have_neon(cpu_flags)) + h264dsp_init_neon(c, bit_depth, chroma_format_idc); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264pred_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264pred_init_arm.c new file mode 100644 index 0000000000..cc324d7dca --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264pred_init_arm.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/h264pred.h" + +void ff_pred16x16_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_top_dc_neon(uint8_t *src, ptrdiff_t stride); + +void ff_pred8x8_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_top_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l0t_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0lt_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l00_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0l0_dc_neon(uint8_t *src, ptrdiff_t stride); + +static av_cold void h264_pred_init_neon(H264PredContext *h, int codec_id, + const int bit_depth, + const int chroma_format_idc) +{ +#if HAVE_NEON + const int high_depth = bit_depth > 8; + + if (high_depth) + return; + + if (chroma_format_idc <= 1) { + h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon; + h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon; + if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon; + h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon; + if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && + codec_id != AV_CODEC_ID_VP8) { + h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon; + h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon; + h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon; + h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] = ff_pred8x8_l0t_dc_neon; + h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] = ff_pred8x8_0lt_dc_neon; + h->pred8x8[ALZHEIMER_DC_L00_PRED8x8] = ff_pred8x8_l00_dc_neon; + h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8] = ff_pred8x8_0l0_dc_neon; + } + } + + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_neon; + h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vert_neon; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_hor_neon; + h->pred16x16[LEFT_DC_PRED8x8] = ff_pred16x16_left_dc_neon; + h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon; + h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_neon; + if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && + codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon; +#endif // HAVE_NEON +} + +av_cold void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, + int bit_depth, const int chroma_format_idc) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + h264_pred_init_neon(h, codec_id, bit_depth, chroma_format_idc); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264qpel_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264qpel_init_arm.c new file mode 100644 index 0000000000..71237be359 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/h264qpel_init_arm.c @@ -0,0 +1,171 @@ +/* + * ARM NEON optimised DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264qpel.h" + +void ff_put_h264_qpel16_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +void ff_put_h264_qpel8_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +void ff_avg_h264_qpel16_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +void ff_avg_h264_qpel8_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +av_cold void ff_h264qpel_init_arm(H264QpelContext *c, int bit_depth) +{ + const int high_bit_depth = bit_depth > 8; + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags) && !high_bit_depth) { + c->put_h264_qpel_pixels_tab[0][ 0] = ff_put_h264_qpel16_mc00_neon; + c->put_h264_qpel_pixels_tab[0][ 1] = ff_put_h264_qpel16_mc10_neon; + c->put_h264_qpel_pixels_tab[0][ 2] = ff_put_h264_qpel16_mc20_neon; + c->put_h264_qpel_pixels_tab[0][ 3] = ff_put_h264_qpel16_mc30_neon; + c->put_h264_qpel_pixels_tab[0][ 4] = ff_put_h264_qpel16_mc01_neon; + c->put_h264_qpel_pixels_tab[0][ 5] = ff_put_h264_qpel16_mc11_neon; + c->put_h264_qpel_pixels_tab[0][ 6] = ff_put_h264_qpel16_mc21_neon; + c->put_h264_qpel_pixels_tab[0][ 7] = ff_put_h264_qpel16_mc31_neon; + c->put_h264_qpel_pixels_tab[0][ 8] = ff_put_h264_qpel16_mc02_neon; + c->put_h264_qpel_pixels_tab[0][ 9] = ff_put_h264_qpel16_mc12_neon; + c->put_h264_qpel_pixels_tab[0][10] = ff_put_h264_qpel16_mc22_neon; + c->put_h264_qpel_pixels_tab[0][11] = ff_put_h264_qpel16_mc32_neon; + c->put_h264_qpel_pixels_tab[0][12] = ff_put_h264_qpel16_mc03_neon; + c->put_h264_qpel_pixels_tab[0][13] = ff_put_h264_qpel16_mc13_neon; + c->put_h264_qpel_pixels_tab[0][14] = ff_put_h264_qpel16_mc23_neon; + c->put_h264_qpel_pixels_tab[0][15] = ff_put_h264_qpel16_mc33_neon; + + c->put_h264_qpel_pixels_tab[1][ 0] = ff_put_h264_qpel8_mc00_neon; + c->put_h264_qpel_pixels_tab[1][ 1] = ff_put_h264_qpel8_mc10_neon; + c->put_h264_qpel_pixels_tab[1][ 2] = ff_put_h264_qpel8_mc20_neon; + c->put_h264_qpel_pixels_tab[1][ 3] = ff_put_h264_qpel8_mc30_neon; + c->put_h264_qpel_pixels_tab[1][ 4] = ff_put_h264_qpel8_mc01_neon; + c->put_h264_qpel_pixels_tab[1][ 5] = ff_put_h264_qpel8_mc11_neon; + c->put_h264_qpel_pixels_tab[1][ 6] = ff_put_h264_qpel8_mc21_neon; + c->put_h264_qpel_pixels_tab[1][ 7] = ff_put_h264_qpel8_mc31_neon; + c->put_h264_qpel_pixels_tab[1][ 8] = ff_put_h264_qpel8_mc02_neon; + c->put_h264_qpel_pixels_tab[1][ 9] = ff_put_h264_qpel8_mc12_neon; + c->put_h264_qpel_pixels_tab[1][10] = ff_put_h264_qpel8_mc22_neon; + c->put_h264_qpel_pixels_tab[1][11] = ff_put_h264_qpel8_mc32_neon; + c->put_h264_qpel_pixels_tab[1][12] = ff_put_h264_qpel8_mc03_neon; + c->put_h264_qpel_pixels_tab[1][13] = ff_put_h264_qpel8_mc13_neon; + c->put_h264_qpel_pixels_tab[1][14] = ff_put_h264_qpel8_mc23_neon; + c->put_h264_qpel_pixels_tab[1][15] = ff_put_h264_qpel8_mc33_neon; + + c->avg_h264_qpel_pixels_tab[0][ 0] = ff_avg_h264_qpel16_mc00_neon; + c->avg_h264_qpel_pixels_tab[0][ 1] = ff_avg_h264_qpel16_mc10_neon; + c->avg_h264_qpel_pixels_tab[0][ 2] = ff_avg_h264_qpel16_mc20_neon; + c->avg_h264_qpel_pixels_tab[0][ 3] = ff_avg_h264_qpel16_mc30_neon; + c->avg_h264_qpel_pixels_tab[0][ 4] = ff_avg_h264_qpel16_mc01_neon; + c->avg_h264_qpel_pixels_tab[0][ 5] = ff_avg_h264_qpel16_mc11_neon; + c->avg_h264_qpel_pixels_tab[0][ 6] = ff_avg_h264_qpel16_mc21_neon; + c->avg_h264_qpel_pixels_tab[0][ 7] = ff_avg_h264_qpel16_mc31_neon; + c->avg_h264_qpel_pixels_tab[0][ 8] = ff_avg_h264_qpel16_mc02_neon; + c->avg_h264_qpel_pixels_tab[0][ 9] = ff_avg_h264_qpel16_mc12_neon; + c->avg_h264_qpel_pixels_tab[0][10] = ff_avg_h264_qpel16_mc22_neon; + c->avg_h264_qpel_pixels_tab[0][11] = ff_avg_h264_qpel16_mc32_neon; + c->avg_h264_qpel_pixels_tab[0][12] = ff_avg_h264_qpel16_mc03_neon; + c->avg_h264_qpel_pixels_tab[0][13] = ff_avg_h264_qpel16_mc13_neon; + c->avg_h264_qpel_pixels_tab[0][14] = ff_avg_h264_qpel16_mc23_neon; + c->avg_h264_qpel_pixels_tab[0][15] = ff_avg_h264_qpel16_mc33_neon; + + c->avg_h264_qpel_pixels_tab[1][ 0] = ff_avg_h264_qpel8_mc00_neon; + c->avg_h264_qpel_pixels_tab[1][ 1] = ff_avg_h264_qpel8_mc10_neon; + c->avg_h264_qpel_pixels_tab[1][ 2] = ff_avg_h264_qpel8_mc20_neon; + c->avg_h264_qpel_pixels_tab[1][ 3] = ff_avg_h264_qpel8_mc30_neon; + c->avg_h264_qpel_pixels_tab[1][ 4] = ff_avg_h264_qpel8_mc01_neon; + c->avg_h264_qpel_pixels_tab[1][ 5] = ff_avg_h264_qpel8_mc11_neon; + c->avg_h264_qpel_pixels_tab[1][ 6] = ff_avg_h264_qpel8_mc21_neon; + c->avg_h264_qpel_pixels_tab[1][ 7] = ff_avg_h264_qpel8_mc31_neon; + c->avg_h264_qpel_pixels_tab[1][ 8] = ff_avg_h264_qpel8_mc02_neon; + c->avg_h264_qpel_pixels_tab[1][ 9] = ff_avg_h264_qpel8_mc12_neon; + c->avg_h264_qpel_pixels_tab[1][10] = ff_avg_h264_qpel8_mc22_neon; + c->avg_h264_qpel_pixels_tab[1][11] = ff_avg_h264_qpel8_mc32_neon; + c->avg_h264_qpel_pixels_tab[1][12] = ff_avg_h264_qpel8_mc03_neon; + c->avg_h264_qpel_pixels_tab[1][13] = ff_avg_h264_qpel8_mc13_neon; + c->avg_h264_qpel_pixels_tab[1][14] = ff_avg_h264_qpel8_mc23_neon; + c->avg_h264_qpel_pixels_tab[1][15] = ff_avg_h264_qpel8_mc33_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_arm.h new file mode 100644 index 0000000000..47cdfa574d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_HEVCDSP_ARM_H +#define AVCODEC_ARM_HEVCDSP_ARM_H + +#include "libavcodec/hevcdsp.h" + +void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth); + +#endif /* AVCODEC_ARM_HEVCDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_init_arm.c new file mode 100644 index 0000000000..e8fa1f79ac --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_init_arm.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014 Seppo Tomperi + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/hevcdsp.h" +#include "hevcdsp_arm.h" + +av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + ff_hevc_dsp_init_neon(c, bit_depth); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_init_neon.c new file mode 100644 index 0000000000..201a088dac --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hevcdsp_init_neon.c @@ -0,0 +1,320 @@ +/* + * Copyright (c) 2014 Seppo Tomperi + * + * 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/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/hevcdsp.h" +#include "libavcodec/avcodec.h" +#include "hevcdsp_arm.h" + +void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, + ptrdiff_t stride_dst, ptrdiff_t stride_src, + int16_t *sao_offset_val, int sao_left_class, + int width, int height); +void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, + int eo, int width, int height); + +void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_h_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_32x32_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_32x32_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_transform_luma_4x4_neon_8(int16_t *coeffs); + +#define PUT_PIXELS(name) \ + void name(int16_t *dst, uint8_t *src, \ + ptrdiff_t srcstride, int height, \ + intptr_t mx, intptr_t my, int width) +PUT_PIXELS(ff_hevc_put_pixels_w2_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w4_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w6_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w8_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w12_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w16_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w24_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); +#undef PUT_PIXELS + +static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int height, int width); +static void (*put_hevc_qpel_uw_neon[4][4])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, + int width, int height, int16_t* src2, ptrdiff_t src2stride); +void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width); +void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width); +void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int16_t *src2, + int height, intptr_t mx, intptr_t my, int width); +#define QPEL_FUNC(name) \ + void name(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, \ + int height, int width) + +QPEL_FUNC(ff_hevc_put_qpel_v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_v3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1v3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2v3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3v3_neon_8); +#undef QPEL_FUNC + +#define QPEL_FUNC_UW_PIX(name) \ + void name(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, \ + int height, intptr_t mx, intptr_t my, int width); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w4_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w8_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w16_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w24_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w32_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w48_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w64_neon_8); +#undef QPEL_FUNC_UW_PIX + +#define QPEL_FUNC_UW(name) \ + void name(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, \ + int width, int height, int16_t* src2, ptrdiff_t src2stride); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_pixels_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1v3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8); +#undef QPEL_FUNC_UW + +void ff_hevc_sao_band_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height, int16_t *offset_table); + +void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, + ptrdiff_t stride_dst, ptrdiff_t stride_src, + int16_t *sao_offset_val, int sao_left_class, + int width, int height) { + uint8_t *dst = _dst; + uint8_t *src = _src; + int16_t offset_table[32] = {0}; + int k; + + for (k = 0; k < 4; k++) { + offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; + } + + ff_hevc_sao_band_filter_neon_8(dst, src, stride_dst, stride_src, width, height, offset_table); +} + +void ff_hevc_sao_edge_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height, + int a_stride, int b_stride, int16_t *sao_offset_val, uint8_t *edge_idx); + +void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, + int eo, int width, int height) { + static uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; + static const int8_t pos[4][2][2] = { + { { -1, 0 }, { 1, 0 } }, // horizontal + { { 0, -1 }, { 0, 1 } }, // vertical + { { -1, -1 }, { 1, 1 } }, // 45 degree + { { 1, -1 }, { -1, 1 } }, // 135 degree + }; + uint8_t *dst = _dst; + uint8_t *src = _src; + int a_stride, b_stride; + ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); + + a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; + b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; + + ff_hevc_sao_edge_filter_neon_8(dst, src, stride_dst, stride_src, width, height, a_stride, b_stride, sao_offset_val, edge_idx); +} + +void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width) { + + put_hevc_qpel_neon[my][mx](dst, MAX_PB_SIZE, src, srcstride, height, width); +} + +void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width) { + + put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, NULL, 0); +} + +void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int16_t *src2, + int height, intptr_t mx, intptr_t my, int width) { + put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE); +} + +av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth) +{ + if (bit_depth == 8) { + int x; + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_neon; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_neon; + c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_neon; + c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_neon; + c->sao_band_filter[0] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[1] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[2] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[3] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[4] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_edge_filter[0] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[1] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[2] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[3] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[4] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->add_residual[0] = ff_hevc_add_residual_4x4_8_neon; + c->add_residual[1] = ff_hevc_add_residual_8x8_8_neon; + c->add_residual[2] = ff_hevc_add_residual_16x16_8_neon; + c->add_residual[3] = ff_hevc_add_residual_32x32_8_neon; + c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon; + 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->idct[0] = ff_hevc_idct_4x4_8_neon; + c->idct[1] = ff_hevc_idct_8x8_8_neon; + c->idct[2] = ff_hevc_idct_16x16_8_neon; + c->idct[3] = ff_hevc_idct_32x32_8_neon; + c->transform_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; + put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; + put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; + put_hevc_qpel_neon[3][0] = ff_hevc_put_qpel_v3_neon_8; + put_hevc_qpel_neon[0][1] = ff_hevc_put_qpel_h1_neon_8; + put_hevc_qpel_neon[0][2] = ff_hevc_put_qpel_h2_neon_8; + put_hevc_qpel_neon[0][3] = ff_hevc_put_qpel_h3_neon_8; + put_hevc_qpel_neon[1][1] = ff_hevc_put_qpel_h1v1_neon_8; + put_hevc_qpel_neon[1][2] = ff_hevc_put_qpel_h2v1_neon_8; + put_hevc_qpel_neon[1][3] = ff_hevc_put_qpel_h3v1_neon_8; + put_hevc_qpel_neon[2][1] = ff_hevc_put_qpel_h1v2_neon_8; + put_hevc_qpel_neon[2][2] = ff_hevc_put_qpel_h2v2_neon_8; + put_hevc_qpel_neon[2][3] = ff_hevc_put_qpel_h3v2_neon_8; + put_hevc_qpel_neon[3][1] = ff_hevc_put_qpel_h1v3_neon_8; + put_hevc_qpel_neon[3][2] = ff_hevc_put_qpel_h2v3_neon_8; + put_hevc_qpel_neon[3][3] = ff_hevc_put_qpel_h3v3_neon_8; + put_hevc_qpel_uw_neon[1][0] = ff_hevc_put_qpel_uw_v1_neon_8; + put_hevc_qpel_uw_neon[2][0] = ff_hevc_put_qpel_uw_v2_neon_8; + put_hevc_qpel_uw_neon[3][0] = ff_hevc_put_qpel_uw_v3_neon_8; + put_hevc_qpel_uw_neon[0][1] = ff_hevc_put_qpel_uw_h1_neon_8; + put_hevc_qpel_uw_neon[0][2] = ff_hevc_put_qpel_uw_h2_neon_8; + put_hevc_qpel_uw_neon[0][3] = ff_hevc_put_qpel_uw_h3_neon_8; + put_hevc_qpel_uw_neon[1][1] = ff_hevc_put_qpel_uw_h1v1_neon_8; + put_hevc_qpel_uw_neon[1][2] = ff_hevc_put_qpel_uw_h2v1_neon_8; + put_hevc_qpel_uw_neon[1][3] = ff_hevc_put_qpel_uw_h3v1_neon_8; + put_hevc_qpel_uw_neon[2][1] = ff_hevc_put_qpel_uw_h1v2_neon_8; + put_hevc_qpel_uw_neon[2][2] = ff_hevc_put_qpel_uw_h2v2_neon_8; + put_hevc_qpel_uw_neon[2][3] = ff_hevc_put_qpel_uw_h3v2_neon_8; + 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++) { + 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; + c->put_hevc_qpel_uni[x][1][0] = ff_hevc_put_qpel_uni_neon_wrapper; + c->put_hevc_qpel_uni[x][0][1] = ff_hevc_put_qpel_uni_neon_wrapper; + c->put_hevc_qpel_uni[x][1][1] = ff_hevc_put_qpel_uni_neon_wrapper; + c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; + c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; + c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; + } + c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; + c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; + c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; + c->put_hevc_qpel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; + c->put_hevc_qpel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; + c->put_hevc_qpel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; + c->put_hevc_qpel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; + c->put_hevc_qpel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; + c->put_hevc_qpel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; + c->put_hevc_qpel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; + + c->put_hevc_qpel_uni[1][0][0] = ff_hevc_put_qpel_uw_pixels_w4_neon_8; + c->put_hevc_qpel_uni[3][0][0] = ff_hevc_put_qpel_uw_pixels_w8_neon_8; + c->put_hevc_qpel_uni[5][0][0] = ff_hevc_put_qpel_uw_pixels_w16_neon_8; + c->put_hevc_qpel_uni[6][0][0] = ff_hevc_put_qpel_uw_pixels_w24_neon_8; + c->put_hevc_qpel_uni[7][0][0] = ff_hevc_put_qpel_uw_pixels_w32_neon_8; + c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8; + c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8; + } + + if (bit_depth == 10) { + c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon; + c->add_residual[1] = ff_hevc_add_residual_8x8_10_neon; + c->add_residual[2] = ff_hevc_add_residual_16x16_10_neon; + c->add_residual[3] = ff_hevc_add_residual_32x32_10_neon; + + c->idct_dc[0] = ff_hevc_idct_4x4_dc_10_neon; + c->idct_dc[1] = ff_hevc_idct_8x8_dc_10_neon; + c->idct_dc[2] = ff_hevc_idct_16x16_dc_10_neon; + c->idct_dc[3] = ff_hevc_idct_32x32_dc_10_neon; + + c->idct[0] = ff_hevc_idct_4x4_10_neon; + c->idct[1] = ff_hevc_idct_8x8_10_neon; + c->idct[2] = ff_hevc_idct_16x16_10_neon; + c->idct[3] = ff_hevc_idct_32x32_10_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_arm.h new file mode 100644 index 0000000000..5f3c7741c1 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_arm.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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_ARM_HPELDSP_ARM_H +#define AVCODEC_ARM_HPELDSP_ARM_H + +#include "libavcodec/hpeldsp.h" + +void ff_hpeldsp_init_armv6(HpelDSPContext *c, int flags); +void ff_hpeldsp_init_neon(HpelDSPContext *c, int flags); + +#endif /* AVCODEC_ARM_HPELDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_arm.c new file mode 100644 index 0000000000..1977b1379b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_arm.c @@ -0,0 +1,71 @@ +/* + * ARM-optimized halfpel functions + * Copyright (c) 2001 Lionel Ulmer + * + * 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/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/pixels.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +void ff_put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +void ff_put_pixels16_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +CALL_2X_PIXELS(ff_put_pixels16_x2_arm, ff_put_pixels8_x2_arm, 8) +CALL_2X_PIXELS(ff_put_pixels16_y2_arm, ff_put_pixels8_y2_arm, 8) +CALL_2X_PIXELS(ff_put_pixels16_xy2_arm, ff_put_pixels8_xy2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_x2_arm, ff_put_no_rnd_pixels8_x2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm, ff_put_no_rnd_pixels8_y2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8) + +av_cold void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags) +{ + int cpu_flags = av_get_cpu_flags(); + + c->put_pixels_tab[0][0] = ff_put_pixels16_arm; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm; + c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_arm; + c->put_pixels_tab[1][0] = ff_put_pixels8_arm; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_arm; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_arm; + c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_arm; + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_arm; + c->put_no_rnd_pixels_tab[0][1] = ff_put_no_rnd_pixels16_x2_arm; + c->put_no_rnd_pixels_tab[0][2] = ff_put_no_rnd_pixels16_y2_arm; + c->put_no_rnd_pixels_tab[0][3] = ff_put_no_rnd_pixels16_xy2_arm; + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_arm; + c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_arm; + c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_arm; + c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm; + + if (have_armv6(cpu_flags)) + ff_hpeldsp_init_armv6(c, flags); + if (have_neon(cpu_flags)) + ff_hpeldsp_init_neon(c, flags); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_armv6.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_armv6.c new file mode 100644 index 0000000000..967a8e0427 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_armv6.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels16_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels16_x2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels16_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels8_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels8_x2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels8_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +av_cold void ff_hpeldsp_init_armv6(HpelDSPContext *c, int flags) +{ + c->put_pixels_tab[0][0] = ff_put_pixels16_armv6; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_armv6; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_armv6; +/* c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_armv6; */ + c->put_pixels_tab[1][0] = ff_put_pixels8_armv6; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_armv6; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_armv6; +/* c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_armv6; */ + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_armv6; + c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_armv6; + c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_armv6; +/* c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_armv6; */ + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_armv6; + c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_armv6; + c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_armv6; +/* c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_armv6; */ + + c->avg_pixels_tab[0][0] = ff_avg_pixels16_armv6; + c->avg_pixels_tab[1][0] = ff_avg_pixels8_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_neon.c new file mode 100644 index 0000000000..d9feadd1dd --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/hpeldsp_init_neon.c @@ -0,0 +1,88 @@ +/* + * ARM NEON optimised DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels16_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels16_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); + +av_cold void ff_hpeldsp_init_neon(HpelDSPContext *c, int flags) +{ + c->put_pixels_tab[0][0] = ff_put_pixels16_neon; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_neon; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_neon; + c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_neon; + c->put_pixels_tab[1][0] = ff_put_pixels8_neon; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_neon; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_neon; + c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_neon; + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_neon; + c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_neon; + c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_neon; + c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_neon; + c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_neon; + + c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon; + c->avg_pixels_tab[0][1] = ff_avg_pixels16_x2_neon; + c->avg_pixels_tab[0][2] = ff_avg_pixels16_y2_neon; + c->avg_pixels_tab[0][3] = ff_avg_pixels16_xy2_neon; + c->avg_pixels_tab[1][0] = ff_avg_pixels8_neon; + c->avg_pixels_tab[1][1] = ff_avg_pixels8_x2_neon; + c->avg_pixels_tab[1][2] = ff_avg_pixels8_y2_neon; + c->avg_pixels_tab[1][3] = ff_avg_pixels8_xy2_neon; + + c->avg_no_rnd_pixels_tab[0] = ff_avg_pixels16_neon; + c->avg_no_rnd_pixels_tab[1] = ff_avg_pixels16_x2_no_rnd_neon; + c->avg_no_rnd_pixels_tab[2] = ff_avg_pixels16_y2_no_rnd_neon; + c->avg_no_rnd_pixels_tab[3] = ff_avg_pixels16_xy2_no_rnd_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idct.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idct.h new file mode 100644 index 0000000000..6c79a69c5f --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idct.h @@ -0,0 +1,41 @@ +/* + * 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_ARM_IDCT_H +#define AVCODEC_ARM_IDCT_H + +#include +#include + +void ff_j_rev_dct_arm(int16_t *data); + +void ff_simple_idct_arm(int16_t *data); + +void ff_simple_idct_armv5te(int16_t *data); +void ff_simple_idct_put_armv5te(uint8_t *dest, ptrdiff_t line_size, int16_t *data); +void ff_simple_idct_add_armv5te(uint8_t *dest, ptrdiff_t line_size, int16_t *data); + +void ff_simple_idct_armv6(int16_t *data); +void ff_simple_idct_put_armv6(uint8_t *dest, ptrdiff_t line_size, int16_t *data); +void ff_simple_idct_add_armv6(uint8_t *dest, ptrdiff_t line_size, int16_t *data); + +void ff_simple_idct_neon(int16_t *data); +void ff_simple_idct_put_neon(uint8_t *dest, ptrdiff_t line_size, int16_t *data); +void ff_simple_idct_add_neon(uint8_t *dest, ptrdiff_t line_size, int16_t *data); + +#endif /* AVCODEC_ARM_IDCT_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_arm.h new file mode 100644 index 0000000000..d7bc5cd02a --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_arm.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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_ARM_IDCTDSP_ARM_H +#define AVCODEC_ARM_IDCTDSP_ARM_H + +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" + +void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); +void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); +void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); + +#endif /* AVCODEC_ARM_IDCTDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_arm.c new file mode 100644 index 0000000000..ebc90e4b49 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_arm.c @@ -0,0 +1,94 @@ +/* + * ARM-optimized IDCT functions + * Copyright (c) 2001 Lionel Ulmer + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest, + ptrdiff_t line_size); + +/* XXX: those functions should be suppressed ASAP when all IDCTs are + * converted */ +static void j_rev_dct_arm_put(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_j_rev_dct_arm(block); + ff_put_pixels_clamped_c(block, dest, line_size); +} + +static void j_rev_dct_arm_add(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_j_rev_dct_arm(block); + ff_add_pixels_clamped_arm(block, dest, line_size); +} + +static void simple_idct_arm_put(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_simple_idct_arm(block); + ff_put_pixels_clamped_c(block, dest, line_size); +} + +static void simple_idct_arm_add(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_simple_idct_arm(block); + ff_add_pixels_clamped_arm(block, dest, line_size); +} + +av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + + if (!avctx->lowres && !high_bit_depth) { + if ((avctx->idct_algo == FF_IDCT_AUTO && !(avctx->flags & AV_CODEC_FLAG_BITEXACT)) || + avctx->idct_algo == FF_IDCT_ARM) { + c->idct_put = j_rev_dct_arm_put; + c->idct_add = j_rev_dct_arm_add; + c->idct = ff_j_rev_dct_arm; + c->perm_type = FF_IDCT_PERM_LIBMPEG2; + } else if (avctx->idct_algo == FF_IDCT_SIMPLEARM) { + c->idct_put = simple_idct_arm_put; + c->idct_add = simple_idct_arm_add; + c->idct = ff_simple_idct_arm; + c->perm_type = FF_IDCT_PERM_NONE; + } + } + + c->add_pixels_clamped = ff_add_pixels_clamped_arm; + + if (have_armv5te(cpu_flags)) + ff_idctdsp_init_armv5te(c, avctx, high_bit_depth); + if (have_armv6(cpu_flags)) + ff_idctdsp_init_armv6(c, avctx, high_bit_depth); + if (have_neon(cpu_flags)) + ff_idctdsp_init_neon(c, avctx, high_bit_depth); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_armv5te.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_armv5te.c new file mode 100644 index 0000000000..3d881e1f18 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_armv5te.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +av_cold void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + if (!avctx->lowres && !high_bit_depth && + (avctx->idct_algo == FF_IDCT_AUTO || + avctx->idct_algo == FF_IDCT_SIMPLEAUTO || + avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { + c->idct_put = ff_simple_idct_put_armv5te; + c->idct_add = ff_simple_idct_add_armv5te; + c->idct = ff_simple_idct_armv5te; + c->perm_type = FF_IDCT_PERM_NONE; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_armv6.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_armv6.c new file mode 100644 index 0000000000..edf3070e15 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_armv6.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +void ff_add_pixels_clamped_armv6(const int16_t *block, uint8_t *pixels, + ptrdiff_t line_size); + +av_cold void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + if (!avctx->lowres && !high_bit_depth) { + if ((avctx->idct_algo == FF_IDCT_AUTO && !(avctx->flags & AV_CODEC_FLAG_BITEXACT)) || + avctx->idct_algo == FF_IDCT_SIMPLEARMV6) { + c->idct_put = ff_simple_idct_put_armv6; + c->idct_add = ff_simple_idct_add_armv6; + c->idct = ff_simple_idct_armv6; + c->perm_type = FF_IDCT_PERM_LIBMPEG2; + } + } + c->add_pixels_clamped = ff_add_pixels_clamped_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_neon.c new file mode 100644 index 0000000000..b70c5b0d44 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/idctdsp_init_neon.c @@ -0,0 +1,51 @@ +/* + * ARM-NEON-optimized IDCT functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); +void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); +void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); + +av_cold void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + if (!avctx->lowres && !high_bit_depth) { + if (avctx->idct_algo == FF_IDCT_AUTO || + avctx->idct_algo == FF_IDCT_SIMPLEAUTO || + avctx->idct_algo == FF_IDCT_SIMPLENEON) { + c->idct_put = ff_simple_idct_put_neon; + c->idct_add = ff_simple_idct_add_neon; + c->idct = ff_simple_idct_neon; + c->perm_type = FF_IDCT_PERM_PARTTRANS; + } + } + + c->add_pixels_clamped = ff_add_pixels_clamped_neon; + c->put_pixels_clamped = ff_put_pixels_clamped_neon; + c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/lossless_audiodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/lossless_audiodsp_init_arm.c new file mode 100644 index 0000000000..981a39aff9 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/lossless_audiodsp_init_arm.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/lossless_audiodsp.h" + +int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2, + const int16_t *v3, int len, int mul); + +av_cold void ff_llauddsp_init_arm(LLAudDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mathops.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mathops.h new file mode 100644 index 0000000000..dc57c5571c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mathops.h @@ -0,0 +1,108 @@ +/* + * simple math operations + * Copyright (c) 2006 Michael Niedermayer et al + * + * 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_ARM_MATHOPS_H +#define AVCODEC_ARM_MATHOPS_H + +#include +#include "config.h" +#include "libavutil/common.h" + +#if HAVE_INLINE_ASM + +#if HAVE_ARMV6_INLINE +#define MULH MULH +static inline av_const int MULH(int a, int b) +{ + int r; + __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); + return r; +} + +#define FASTDIV FASTDIV +static av_always_inline av_const int FASTDIV(int a, int b) +{ + int r; + __asm__ ("cmp %2, #2 \n\t" + "ldr %0, [%3, %2, lsl #2] \n\t" + "ite le \n\t" + "lsrle %0, %1, #1 \n\t" + "smmulgt %0, %0, %1 \n\t" + : "=&r"(r) : "r"(a), "r"(b), "r"(ff_inverse) : "cc"); + return r; +} + +#else /* HAVE_ARMV6_INLINE */ + +#define FASTDIV FASTDIV +static av_always_inline av_const int FASTDIV(int a, int b) +{ + int r, t; + __asm__ ("umull %1, %0, %2, %3" + : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b])); + return r; +} +#endif + +#define MLS64(d, a, b) MAC64(d, -(a), b) + +#if HAVE_ARMV5TE_INLINE + +/* signed 16x16 -> 32 multiply add accumulate */ +# define MAC16(rt, ra, rb) \ + __asm__ ("smlabb %0, %1, %2, %0" : "+r"(rt) : "r"(ra), "r"(rb)); + +/* signed 16x16 -> 32 multiply */ +# define MUL16 MUL16 +static inline av_const int MUL16(int ra, int rb) +{ + int rt; + __asm__ ("smulbb %0, %1, %2" : "=r"(rt) : "r"(ra), "r"(rb)); + return rt; +} + +#endif + +#define mid_pred mid_pred +static inline av_const int mid_pred(int a, int b, int c) +{ + int m; + __asm__ ( + "mov %0, %2 \n\t" + "cmp %1, %2 \n\t" + "itt gt \n\t" + "movgt %0, %1 \n\t" + "movgt %1, %2 \n\t" + "cmp %1, %3 \n\t" + "it le \n\t" + "movle %1, %3 \n\t" + "cmp %0, %1 \n\t" + "it gt \n\t" + "movgt %0, %1 \n\t" + : "=&r"(m), "+r"(a) + : "r"(b), "r"(c) + : "cc"); + return m; +} + +#endif /* HAVE_INLINE_ASM */ + +#endif /* AVCODEC_ARM_MATHOPS_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/me_cmp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/me_cmp_init_arm.c new file mode 100644 index 0000000000..03870a2bfa --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/me_cmp_init_arm.c @@ -0,0 +1,57 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/me_cmp.h" +#include "libavcodec/mpegvideo.h" + +int ff_pix_abs16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); +int ff_pix_abs16_x2_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); +int ff_pix_abs16_y2_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); + +int ff_pix_abs8_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); + +int ff_sse16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); + +av_cold void ff_me_cmp_init_arm(MECmpContext *c, AVCodecContext *avctx) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + c->pix_abs[0][0] = ff_pix_abs16_armv6; + c->pix_abs[0][1] = ff_pix_abs16_x2_armv6; + c->pix_abs[0][2] = ff_pix_abs16_y2_armv6; + + c->pix_abs[1][0] = ff_pix_abs8_armv6; + + c->sad[0] = ff_pix_abs16_armv6; + c->sad[1] = ff_pix_abs8_armv6; + + c->sse[0] = ff_sse16_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mlpdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mlpdsp_init_arm.c new file mode 100644 index 0000000000..34a5f61e1d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mlpdsp_init_arm.c @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2014 RISC OS Open Ltd + * Author: Ben Avison + * + * 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 + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/mlpdsp.h" + +void ff_mlp_filter_channel_arm(int32_t *state, const int32_t *coeff, + int firorder, int iirorder, + unsigned int filter_shift, int32_t mask, + int blocksize, int32_t *sample_buffer); +void ff_mlp_rematrix_channel_arm(int32_t *samples, + const int32_t *coeffs, + const uint8_t *bypassed_lsbs, + const int8_t *noise_buffer, + int index, + unsigned int dest_ch, + uint16_t blockpos, + unsigned int maxchan, + int matrix_noise_shift, + int access_unit_size_pow2, + int32_t mask); + +#define DECLARE_PACK(order,channels,shift) \ + int32_t ff_mlp_pack_output_##order##order_##channels##ch_##shift##shift_armv6(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int); +#define ENUMERATE_PACK(order,channels,shift) \ + ff_mlp_pack_output_##order##order_##channels##ch_##shift##shift_armv6, +#define PACK_CHANNELS(macro,order,channels) \ + macro(order,channels,0) \ + macro(order,channels,1) \ + macro(order,channels,2) \ + macro(order,channels,3) \ + macro(order,channels,4) \ + macro(order,channels,5) \ + macro(order,channels,mixed) +#define PACK_ORDER(macro,order) \ + PACK_CHANNELS(macro,order,2) \ + PACK_CHANNELS(macro,order,6) \ + PACK_CHANNELS(macro,order,8) +#define PACK_ALL(macro) \ + PACK_ORDER(macro,outof) \ + PACK_ORDER(macro,in) +PACK_ALL(DECLARE_PACK) + +#define ff_mlp_pack_output_outoforder_2ch_mixedshift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_mixedshift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_mixedshift_armv6 0 +#if CONFIG_THUMB +#define ff_mlp_pack_output_outoforder_2ch_0shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_1shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_2shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_3shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_4shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_5shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_0shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_1shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_2shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_3shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_4shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_5shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_0shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_1shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_2shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_3shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_4shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_5shift_armv6 0 +#endif + +static int32_t (*mlp_select_pack_output_armv6(uint8_t *ch_assign, + int8_t *output_shift, + uint8_t max_matrix_channel, + int is32))(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int) +{ + int ch_index; + int shift = output_shift[0] < 0 || output_shift[0] > 5 ? 6 : output_shift[0]; + int inorder = 1; + static int32_t (*const routine[2*3*7])(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int) = { + PACK_ALL(ENUMERATE_PACK) + }; + int i; + + if (!is32) // don't support 16-bit output (it's not used by TrueHD) + return ff_mlp_pack_output; + + switch (max_matrix_channel) { + case 1: + ch_index = 0; + break; + case 5: + ch_index = 1; + break; + case 7: + ch_index = 2; + break; + default: + return ff_mlp_pack_output; + } + + for (i = 0; i <= max_matrix_channel; i++) { + if (shift != 6 && output_shift[i] != shift) + shift = 6; // indicate mixed shifts + if (ch_assign[i] != i) + inorder = 0; + } +#if CONFIG_THUMB + if (!inorder) + return ff_mlp_pack_output; // can't currently handle an order array except in ARM mode +#else + if (shift == 6 && !inorder) + return ff_mlp_pack_output; // can't currently handle both an order array and a shift array +#endif + + return routine[(inorder*3+ch_index)*7+shift]; +} + +av_cold void ff_mlpdsp_init_arm(MLPDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv5te(cpu_flags)) { + c->mlp_filter_channel = ff_mlp_filter_channel_arm; + c->mlp_rematrix_channel = ff_mlp_rematrix_channel_arm; + } + if (have_armv6(cpu_flags)) + c->mlp_select_pack_output = mlp_select_pack_output_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegaudiodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegaudiodsp_init_arm.c new file mode 100644 index 0000000000..d87bd27ad8 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegaudiodsp_init_arm.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/mpegaudiodsp.h" +#include "config.h" + +void ff_mpadsp_apply_window_fixed_armv6(int32_t *synth_buf, int32_t *window, + int *dither, int16_t *out, ptrdiff_t incr); + +av_cold void ff_mpadsp_init_arm(MPADSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + s->apply_window_fixed = ff_mpadsp_apply_window_fixed_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_arm.c new file mode 100644 index 0000000000..918be16d03 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_arm.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2002 Michael Niedermayer + * + * 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/internal.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/mpegvideo.h" +#include "mpegvideo_arm.h" +#include "asm-offsets.h" + +#if HAVE_NEON +AV_CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE); +AV_CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE); +AV_CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED); +AV_CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX); +AV_CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end, + INTER_SCANTAB_RASTER_END); +AV_CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC); +#endif + +void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block, + int n, int qscale); +void ff_dct_unquantize_h263_intra_neon(MpegEncContext *s, int16_t *block, + int n, int qscale); + +av_cold void ff_mpv_common_init_arm(MpegEncContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv5te(cpu_flags)) + ff_mpv_common_init_armv5te(s); + + if (have_neon(cpu_flags)) { + s->dct_unquantize_h263_intra = ff_dct_unquantize_h263_intra_neon; + s->dct_unquantize_h263_inter = ff_dct_unquantize_h263_inter_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_arm.h new file mode 100644 index 0000000000..709ae6b247 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_MPEGVIDEO_ARM_H +#define AVCODEC_ARM_MPEGVIDEO_ARM_H + +#include "libavcodec/mpegvideo.h" + +void ff_mpv_common_init_armv5te(MpegEncContext *s); + +#endif /* AVCODEC_ARM_MPEGVIDEO_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_armv5te.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_armv5te.c new file mode 100644 index 0000000000..e20bb4c645 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideo_armv5te.c @@ -0,0 +1,102 @@ +/* + * Optimization of some functions from mpegvideo.c for armv5te + * Copyright (c) 2007 Siarhei Siamashka + * + * 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/attributes.h" +#include "libavutil/avassert.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/mpegvideo.h" +#include "mpegvideo_arm.h" + +void ff_dct_unquantize_h263_armv5te(int16_t *block, int qmul, int qadd, int count); + +#ifdef ENABLE_ARM_TESTS +/** + * H.263 dequantizer supplementary function, it is performance critical and needs to + * have optimized implementations for each architecture. Is also used as a reference + * implementation in regression tests + */ +static inline void dct_unquantize_h263_helper_c(int16_t *block, int qmul, int qadd, int count) +{ + int i, level; + for (i = 0; i < count; i++) { + level = block[i]; + if (level) { + if (level < 0) { + level = level * qmul - qadd; + } else { + level = level * qmul + qadd; + } + block[i] = level; + } + } +} +#endif + +static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s, + int16_t *block, int n, int qscale) +{ + int level, qmul, qadd; + int nCoeffs; + + av_assert2(s->block_last_index[n]>=0); + + qmul = qscale << 1; + + if (!s->h263_aic) { + if (n < 4) + level = block[0] * s->y_dc_scale; + else + level = block[0] * s->c_dc_scale; + qadd = (qscale - 1) | 1; + }else{ + qadd = 0; + level = block[0]; + } + if(s->ac_pred) + nCoeffs=63; + else + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); + block[0] = level; +} + +static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s, + int16_t *block, int n, int qscale) +{ + int qmul, qadd; + int nCoeffs; + + av_assert2(s->block_last_index[n]>=0); + + qadd = (qscale - 1) | 1; + qmul = qscale << 1; + + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); +} + +av_cold void ff_mpv_common_init_armv5te(MpegEncContext *s) +{ + s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te; + s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideoencdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideoencdsp_init_arm.c new file mode 100644 index 0000000000..4bfe835684 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/mpegvideoencdsp_init_arm.c @@ -0,0 +1,38 @@ +/* + * 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 + +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/mpegvideoencdsp.h" + +int ff_pix_norm1_armv6(uint8_t *pix, int line_size); +int ff_pix_sum_armv6(uint8_t *pix, int line_size); + +av_cold void ff_mpegvideoencdsp_init_arm(MpegvideoEncDSPContext *c, + AVCodecContext *avctx) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + c->pix_norm1 = ff_pix_norm1_armv6; + c->pix_sum = ff_pix_sum_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/neontest.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/neontest.c new file mode 100644 index 0000000000..f9c0dbf12e --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/neontest.c @@ -0,0 +1,99 @@ +/* + * check NEON registers for clobbers + * Copyright (c) 2013 Martin Storsjo + * + * 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 "libavcodec/avcodec.h" +#include "libavutil/arm/neontest.h" + +wrap(avcodec_open2(AVCodecContext *avctx, + const AVCodec *codec, + AVDictionary **options)) +{ + testneonclobbers(avcodec_open2, avctx, codec, options); +} + +wrap(avcodec_decode_audio4(AVCodecContext *avctx, + AVFrame *frame, + int *got_frame_ptr, + AVPacket *avpkt)) +{ + testneonclobbers(avcodec_decode_audio4, avctx, frame, + got_frame_ptr, avpkt); +} + +wrap(avcodec_decode_video2(AVCodecContext *avctx, + AVFrame *picture, + int *got_picture_ptr, + AVPacket *avpkt)) +{ + testneonclobbers(avcodec_decode_video2, avctx, picture, + got_picture_ptr, avpkt); +} + +wrap(avcodec_decode_subtitle2(AVCodecContext *avctx, + AVSubtitle *sub, + int *got_sub_ptr, + AVPacket *avpkt)) +{ + testneonclobbers(avcodec_decode_subtitle2, avctx, sub, + got_sub_ptr, avpkt); +} + +wrap(avcodec_encode_audio2(AVCodecContext *avctx, + AVPacket *avpkt, + const AVFrame *frame, + int *got_packet_ptr)) +{ + testneonclobbers(avcodec_encode_audio2, avctx, avpkt, frame, + got_packet_ptr); +} + +wrap(avcodec_encode_subtitle(AVCodecContext *avctx, + uint8_t *buf, int buf_size, + const AVSubtitle *sub)) +{ + testneonclobbers(avcodec_encode_subtitle, avctx, buf, buf_size, sub); +} + +wrap(avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr)) +{ + testneonclobbers(avcodec_encode_video2, avctx, avpkt, frame, got_packet_ptr); +} + +wrap(avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)) +{ + testneonclobbers(avcodec_send_packet, avctx, avpkt); +} + +wrap(avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)) +{ + testneonclobbers(avcodec_receive_packet, avctx, avpkt); +} + +wrap(avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)) +{ + testneonclobbers(avcodec_send_frame, avctx, frame); +} + +wrap(avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)) +{ + testneonclobbers(avcodec_receive_frame, avctx, frame); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/pixblockdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/pixblockdsp_init_arm.c new file mode 100644 index 0000000000..59d2b49381 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/pixblockdsp_init_arm.c @@ -0,0 +1,43 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/pixblockdsp.h" + +void ff_get_pixels_armv6(int16_t *block, const uint8_t *pixels, + ptrdiff_t stride); +void ff_diff_pixels_armv6(int16_t *block, const uint8_t *s1, + const uint8_t *s2, ptrdiff_t stride); + +av_cold void ff_pixblockdsp_init_arm(PixblockDSPContext *c, + AVCodecContext *avctx, + unsigned high_bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + if (!high_bit_depth) + c->get_pixels = ff_get_pixels_armv6; + c->diff_pixels = ff_diff_pixels_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rdft_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rdft_init_arm.c new file mode 100644 index 0000000000..1c5d8beb61 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rdft_init_arm.c @@ -0,0 +1,33 @@ +/* + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/rdft.h" + +void ff_rdft_calc_neon(struct RDFTContext *s, FFTSample *z); + +av_cold void ff_rdft_init_arm(RDFTContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + s->rdft_calc = ff_rdft_calc_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rv34dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rv34dsp_init_arm.c new file mode 100644 index 0000000000..8bfe90b3d3 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rv34dsp_init_arm.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2011 Janne Grunau + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/rv34dsp.h" +#include "libavutil/arm/cpu.h" + +void ff_rv34_inv_transform_noround_neon(int16_t *block); + +void ff_rv34_inv_transform_noround_dc_neon(int16_t *block); + +void ff_rv34_idct_add_neon(uint8_t *dst, ptrdiff_t stride, int16_t *block); +void ff_rv34_idct_dc_add_neon(uint8_t *dst, ptrdiff_t stride, int dc); + +av_cold void ff_rv34dsp_init_arm(RV34DSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->rv34_inv_transform = ff_rv34_inv_transform_noround_neon; + c->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon; + + c->rv34_idct_add = ff_rv34_idct_add_neon; + c->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rv40dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rv40dsp_init_arm.c new file mode 100644 index 0000000000..c24854d1cd --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/rv40dsp_init_arm.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2011 Janne Grunau + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/rv34dsp.h" +#include "libavutil/arm/cpu.h" + +#define DECL_QPEL3(type, w, pos) \ +void ff_ ## type ## _rv40_qpel ## w ## _mc ## pos ## _neon(uint8_t *dst, \ + const uint8_t *src, \ + ptrdiff_t stride) + +#define DECL_QPEL2(w, pos) \ + DECL_QPEL3(put, w, pos); \ + DECL_QPEL3(avg, w, pos) + +#define DECL_QPEL_XY(x, y) \ + DECL_QPEL2(16, x ## y); \ + DECL_QPEL2(8, x ## y) + +#define DECL_QPEL_Y(y) \ + DECL_QPEL_XY(0, y); \ + DECL_QPEL_XY(1, y); \ + DECL_QPEL_XY(2, y); \ + DECL_QPEL_XY(3, y); \ + +DECL_QPEL_Y(0); +DECL_QPEL_Y(1); +DECL_QPEL_Y(2); +DECL_QPEL_Y(3); + +void ff_put_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int); +void ff_put_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int); + +void ff_avg_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int); +void ff_avg_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int); + +void ff_rv40_weight_func_16_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t); +void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t); + +int ff_rv40_h_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride, + int beta, int beta2, int edge, + int *p1, int *q1); +int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride, + int beta, int beta2, int edge, + int *p1, int *q1); + +void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1, + int filter_q1, int alpha, int beta, + int lim_p0q0, int lim_q1, int lim_p1); +void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1, + int filter_q1, int alpha, int beta, + int lim_p0q0, int lim_q1, int lim_p1); + +static av_cold void rv40dsp_init_neon(RV34DSPContext *c) +{ + c->put_pixels_tab[0][ 1] = ff_put_rv40_qpel16_mc10_neon; + c->put_pixels_tab[0][ 3] = ff_put_rv40_qpel16_mc30_neon; + c->put_pixels_tab[0][ 4] = ff_put_rv40_qpel16_mc01_neon; + c->put_pixels_tab[0][ 5] = ff_put_rv40_qpel16_mc11_neon; + c->put_pixels_tab[0][ 6] = ff_put_rv40_qpel16_mc21_neon; + c->put_pixels_tab[0][ 7] = ff_put_rv40_qpel16_mc31_neon; + c->put_pixels_tab[0][ 9] = ff_put_rv40_qpel16_mc12_neon; + c->put_pixels_tab[0][10] = ff_put_rv40_qpel16_mc22_neon; + c->put_pixels_tab[0][11] = ff_put_rv40_qpel16_mc32_neon; + c->put_pixels_tab[0][12] = ff_put_rv40_qpel16_mc03_neon; + c->put_pixels_tab[0][13] = ff_put_rv40_qpel16_mc13_neon; + c->put_pixels_tab[0][14] = ff_put_rv40_qpel16_mc23_neon; + c->put_pixels_tab[0][15] = ff_put_rv40_qpel16_mc33_neon; + c->avg_pixels_tab[0][ 1] = ff_avg_rv40_qpel16_mc10_neon; + c->avg_pixels_tab[0][ 3] = ff_avg_rv40_qpel16_mc30_neon; + c->avg_pixels_tab[0][ 4] = ff_avg_rv40_qpel16_mc01_neon; + c->avg_pixels_tab[0][ 5] = ff_avg_rv40_qpel16_mc11_neon; + c->avg_pixels_tab[0][ 6] = ff_avg_rv40_qpel16_mc21_neon; + c->avg_pixels_tab[0][ 7] = ff_avg_rv40_qpel16_mc31_neon; + c->avg_pixels_tab[0][ 9] = ff_avg_rv40_qpel16_mc12_neon; + c->avg_pixels_tab[0][10] = ff_avg_rv40_qpel16_mc22_neon; + c->avg_pixels_tab[0][11] = ff_avg_rv40_qpel16_mc32_neon; + c->avg_pixels_tab[0][12] = ff_avg_rv40_qpel16_mc03_neon; + c->avg_pixels_tab[0][13] = ff_avg_rv40_qpel16_mc13_neon; + c->avg_pixels_tab[0][14] = ff_avg_rv40_qpel16_mc23_neon; + c->avg_pixels_tab[0][15] = ff_avg_rv40_qpel16_mc33_neon; + c->put_pixels_tab[1][ 1] = ff_put_rv40_qpel8_mc10_neon; + c->put_pixels_tab[1][ 3] = ff_put_rv40_qpel8_mc30_neon; + c->put_pixels_tab[1][ 4] = ff_put_rv40_qpel8_mc01_neon; + c->put_pixels_tab[1][ 5] = ff_put_rv40_qpel8_mc11_neon; + c->put_pixels_tab[1][ 6] = ff_put_rv40_qpel8_mc21_neon; + c->put_pixels_tab[1][ 7] = ff_put_rv40_qpel8_mc31_neon; + c->put_pixels_tab[1][ 9] = ff_put_rv40_qpel8_mc12_neon; + c->put_pixels_tab[1][10] = ff_put_rv40_qpel8_mc22_neon; + c->put_pixels_tab[1][11] = ff_put_rv40_qpel8_mc32_neon; + c->put_pixels_tab[1][12] = ff_put_rv40_qpel8_mc03_neon; + c->put_pixels_tab[1][13] = ff_put_rv40_qpel8_mc13_neon; + c->put_pixels_tab[1][14] = ff_put_rv40_qpel8_mc23_neon; + c->put_pixels_tab[1][15] = ff_put_rv40_qpel8_mc33_neon; + c->avg_pixels_tab[1][ 1] = ff_avg_rv40_qpel8_mc10_neon; + c->avg_pixels_tab[1][ 3] = ff_avg_rv40_qpel8_mc30_neon; + c->avg_pixels_tab[1][ 4] = ff_avg_rv40_qpel8_mc01_neon; + c->avg_pixels_tab[1][ 5] = ff_avg_rv40_qpel8_mc11_neon; + c->avg_pixels_tab[1][ 6] = ff_avg_rv40_qpel8_mc21_neon; + c->avg_pixels_tab[1][ 7] = ff_avg_rv40_qpel8_mc31_neon; + c->avg_pixels_tab[1][ 9] = ff_avg_rv40_qpel8_mc12_neon; + c->avg_pixels_tab[1][10] = ff_avg_rv40_qpel8_mc22_neon; + c->avg_pixels_tab[1][11] = ff_avg_rv40_qpel8_mc32_neon; + c->avg_pixels_tab[1][12] = ff_avg_rv40_qpel8_mc03_neon; + c->avg_pixels_tab[1][13] = ff_avg_rv40_qpel8_mc13_neon; + c->avg_pixels_tab[1][14] = ff_avg_rv40_qpel8_mc23_neon; + c->avg_pixels_tab[1][15] = ff_avg_rv40_qpel8_mc33_neon; + + c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_neon; + c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_neon; + c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_neon; + c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_neon; + + c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_16_neon; + c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_8_neon; + + c->rv40_loop_filter_strength[0] = ff_rv40_h_loop_filter_strength_neon; + c->rv40_loop_filter_strength[1] = ff_rv40_v_loop_filter_strength_neon; + c->rv40_weak_loop_filter[0] = ff_rv40_h_weak_loop_filter_neon; + c->rv40_weak_loop_filter[1] = ff_rv40_v_weak_loop_filter_neon; +} + +av_cold void ff_rv40dsp_init_arm(RV34DSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + rv40dsp_init_neon(c); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/sbcdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/sbcdsp_init_arm.c new file mode 100644 index 0000000000..6bf7e729ef --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/sbcdsp_init_arm.c @@ -0,0 +1,105 @@ +/* + * Bluetooth low-complexity, subband codec (SBC) + * + * Copyright (C) 2017 Aurelien Jacobs + * Copyright (C) 2008-2010 Nokia Corporation + * Copyright (C) 2004-2010 Marcel Holtmann + * Copyright (C) 2004-2005 Henryk Ploetz + * Copyright (C) 2005-2006 Brad Midgley + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * SBC ARMv6 optimization for some basic "building bricks" + */ + +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/sbcdsp.h" + +void ff_sbc_analyze_4_armv6(const int16_t *in, int32_t *out, const int16_t *consts); +void ff_sbc_analyze_8_armv6(const int16_t *in, int32_t *out, const int16_t *consts); + +void ff_sbc_analyze_4_neon(const int16_t *in, int32_t *out, const int16_t *consts); +void ff_sbc_analyze_8_neon(const int16_t *in, int32_t *out, const int16_t *consts); +void ff_sbc_calc_scalefactors_neon(int32_t sb_sample_f[16][2][8], + uint32_t scale_factor[2][8], + int blocks, int channels, int subbands); +int ff_sbc_calc_scalefactors_j_neon(int32_t sb_sample_f[16][2][8], + uint32_t scale_factor[2][8], + int blocks, int subbands); +int ff_sbc_enc_process_input_4s_neon(int position, const uint8_t *pcm, + int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); +int ff_sbc_enc_process_input_8s_neon(int position, const uint8_t *pcm, + int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); + +DECLARE_ALIGNED(SBC_ALIGN, int32_t, ff_sbcdsp_joint_bits_mask)[8] = { + 8, 4, 2, 1, 128, 64, 32, 16 +}; + +#if HAVE_BIGENDIAN +#define PERM(a, b, c, d) { \ + (a * 2) + 1, (a * 2) + 0, \ + (b * 2) + 1, (b * 2) + 0, \ + (c * 2) + 1, (c * 2) + 0, \ + (d * 2) + 1, (d * 2) + 0 \ + } +#else +#define PERM(a, b, c, d) { \ + (a * 2) + 0, (a * 2) + 1, \ + (b * 2) + 0, (b * 2) + 1, \ + (c * 2) + 0, (c * 2) + 1, \ + (d * 2) + 0, (d * 2) + 1 \ + } +#endif + +DECLARE_ALIGNED(SBC_ALIGN, uint8_t, ff_sbc_input_perm_4)[2][8] = { + PERM(7, 3, 6, 4), + PERM(0, 2, 1, 5) +}; + +DECLARE_ALIGNED(SBC_ALIGN, uint8_t, ff_sbc_input_perm_8)[4][8] = { + PERM(15, 7, 14, 8), + PERM(13, 9, 12, 10), + PERM(11, 3, 6, 0), + PERM( 5, 1, 4, 2) +}; + +av_cold void ff_sbcdsp_init_arm(SBCDSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + s->sbc_analyze_4 = ff_sbc_analyze_4_armv6; + s->sbc_analyze_8 = ff_sbc_analyze_8_armv6; + } + + if (have_neon(cpu_flags)) { + s->sbc_analyze_4 = ff_sbc_analyze_4_neon; + s->sbc_analyze_8 = ff_sbc_analyze_8_neon; + s->sbc_calc_scalefactors = ff_sbc_calc_scalefactors_neon; + s->sbc_calc_scalefactors_j = ff_sbc_calc_scalefactors_j_neon; + if (s->increment != 1) { + s->sbc_enc_process_input_4s = ff_sbc_enc_process_input_4s_neon; + s->sbc_enc_process_input_8s = ff_sbc_enc_process_input_8s_neon; + } + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/sbrdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/sbrdsp_init_arm.c new file mode 100644 index 0000000000..4fb69f922b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/sbrdsp_init_arm.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/sbrdsp.h" + +void ff_sbr_sum64x5_neon(float *z); +float ff_sbr_sum_square_neon(float (*x)[2], int n); +void ff_sbr_neg_odd_64_neon(float *x); +void ff_sbr_qmf_pre_shuffle_neon(float *z); +void ff_sbr_qmf_post_shuffle_neon(float W[32][2], const float *z); +void ff_sbr_qmf_deint_neg_neon(float *v, const float *src); +void ff_sbr_qmf_deint_bfly_neon(float *v, const float *src0, const float *src1); +void ff_sbr_hf_g_filt_neon(float (*Y)[2], const float (*X_high)[40][2], + const float *g_filt, int m_max, intptr_t ixh); +void ff_sbr_hf_gen_neon(float (*X_high)[2], const float (*X_low)[2], + const float alpha0[2], const float alpha1[2], + float bw, int start, int end); +void ff_sbr_autocorrelate_neon(const float x[40][2], float phi[3][2][2]); + +void ff_sbr_hf_apply_noise_0_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_1_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_2_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_3_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); + +av_cold void ff_sbrdsp_init_arm(SBRDSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->sum64x5 = ff_sbr_sum64x5_neon; + s->sum_square = ff_sbr_sum_square_neon; + s->neg_odd_64 = ff_sbr_neg_odd_64_neon; + s->qmf_pre_shuffle = ff_sbr_qmf_pre_shuffle_neon; + s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_neon; + s->qmf_deint_neg = ff_sbr_qmf_deint_neg_neon; + s->qmf_deint_bfly = ff_sbr_qmf_deint_bfly_neon; + s->hf_g_filt = ff_sbr_hf_g_filt_neon; + s->hf_gen = ff_sbr_hf_gen_neon; + s->autocorrelate = ff_sbr_autocorrelate_neon; + s->hf_apply_noise[0] = ff_sbr_hf_apply_noise_0_neon; + s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_neon; + s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_neon; + s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/startcode.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/startcode.h new file mode 100644 index 0000000000..cf25d9d4df --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/startcode.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_STARTCODE_H +#define AVCODEC_ARM_STARTCODE_H + +#include + +int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size); + +#endif /* AVCODEC_ARM_STARTCODE_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/synth_filter_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/synth_filter_init_arm.c new file mode 100644 index 0000000000..ea0ce148d4 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/synth_filter_init_arm.c @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavcodec/fft.h" +#include "libavcodec/synth_filter.h" + +void ff_synth_filter_float_vfp(FFTContext *imdct, + float *synth_buf_ptr, int *synth_buf_offset, + float synth_buf2[32], const float window[512], + float out[32], const float in[32], + float scale); + +void ff_synth_filter_float_neon(FFTContext *imdct, + float *synth_buf_ptr, int *synth_buf_offset, + float synth_buf2[32], const float window[512], + float out[32], const float in[32], + float scale); + +av_cold void ff_synth_filter_init_arm(SynthFilterContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_vfp_vm(cpu_flags)) + s->synth_filter_float = ff_synth_filter_float_vfp; + if (have_neon(cpu_flags)) + s->synth_filter_float = ff_synth_filter_float_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp.h new file mode 100644 index 0000000000..cd01ac5384 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_VC1DSP_H +#define AVCODEC_ARM_VC1DSP_H + +#include "libavcodec/vc1dsp.h" + +void ff_vc1dsp_init_neon(VC1DSPContext *dsp); + +#endif /* AVCODEC_ARM_VC1DSP_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp_init_arm.c new file mode 100644 index 0000000000..5f2c759048 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp_init_arm.c @@ -0,0 +1,37 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/arm/startcode.h" +#include "libavcodec/vc1dsp.h" +#include "vc1dsp.h" + +av_cold void ff_vc1dsp_init_arm(VC1DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + +#if HAVE_ARMV6 + if (have_setend(cpu_flags)) + dsp->startcode_find_candidate = ff_startcode_find_candidate_armv6; +#endif + if (have_neon(cpu_flags)) + ff_vc1dsp_init_neon(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp_init_neon.c new file mode 100644 index 0000000000..2cca784f5a --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vc1dsp_init_neon.c @@ -0,0 +1,119 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vc1dsp.h" +#include "vc1dsp.h" + +void ff_vc1_inv_trans_8x8_neon(int16_t *block); +void ff_vc1_inv_trans_4x8_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_8x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_4x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); + +void ff_vc1_inv_trans_8x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_4x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_8x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_4x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); + +void ff_put_pixels8x8_neon(uint8_t *block, const uint8_t *pixels, + ptrdiff_t line_size, int rnd); + +#define DECL_PUT(X, Y) \ +void ff_put_vc1_mspel_mc##X##Y##_neon(uint8_t *dst, const uint8_t *src, \ + ptrdiff_t stride, int rnd); \ +static void ff_put_vc1_mspel_mc##X##Y##_16_neon(uint8_t *dst, const uint8_t *src, \ + ptrdiff_t stride, int rnd) \ +{ \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \ + dst += 8*stride; src += 8*stride; \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \ +} + +DECL_PUT(1, 0) +DECL_PUT(2, 0) +DECL_PUT(3, 0) + +DECL_PUT(0, 1) +DECL_PUT(0, 2) +DECL_PUT(0, 3) + +DECL_PUT(1, 1) +DECL_PUT(1, 2) +DECL_PUT(1, 3) + +DECL_PUT(2, 1) +DECL_PUT(2, 2) +DECL_PUT(2, 3) + +DECL_PUT(3, 1) +DECL_PUT(3, 2) +DECL_PUT(3, 3) + +void ff_put_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +#define FN_ASSIGN(X, Y) \ + dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_16_neon; \ + dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_neon + +av_cold void ff_vc1dsp_init_neon(VC1DSPContext *dsp) +{ + dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_neon; + dsp->vc1_inv_trans_4x8 = ff_vc1_inv_trans_4x8_neon; + dsp->vc1_inv_trans_8x4 = ff_vc1_inv_trans_8x4_neon; + dsp->vc1_inv_trans_4x4 = ff_vc1_inv_trans_4x4_neon; + dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_neon; + dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_neon; + dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_neon; + dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_neon; + + dsp->put_vc1_mspel_pixels_tab[1][ 0] = ff_put_pixels8x8_neon; + FN_ASSIGN(1, 0); + FN_ASSIGN(2, 0); + FN_ASSIGN(3, 0); + + FN_ASSIGN(0, 1); + FN_ASSIGN(1, 1); + FN_ASSIGN(2, 1); + FN_ASSIGN(3, 1); + + FN_ASSIGN(0, 2); + FN_ASSIGN(1, 2); + FN_ASSIGN(2, 2); + FN_ASSIGN(3, 2); + + FN_ASSIGN(0, 3); + FN_ASSIGN(1, 3); + FN_ASSIGN(2, 3); + FN_ASSIGN(3, 3); + + dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_neon; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_neon; + dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = ff_put_vc1_chroma_mc4_neon; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = ff_avg_vc1_chroma_mc4_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_arm.h new file mode 100644 index 0000000000..112cbb86c7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_arm.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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_ARM_VIDEODSP_ARM_H +#define AVCODEC_ARM_VIDEODSP_ARM_H + +#include "libavcodec/avcodec.h" +#include "libavcodec/videodsp.h" + +void ff_videodsp_init_armv5te(VideoDSPContext* ctx, int bpc); + +#endif /* AVCODEC_ARM_VIDEODSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_init_arm.c new file mode 100644 index 0000000000..a89abb25d5 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_init_arm.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2012 Ronald S. Bultje + * + * 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/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/videodsp.h" +#include "videodsp_arm.h" + +av_cold void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc) +{ + int cpu_flags = av_get_cpu_flags(); + if (have_armv5te(cpu_flags)) ff_videodsp_init_armv5te(ctx, bpc); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_init_armv5te.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_init_armv5te.c new file mode 100644 index 0000000000..1ea1f3438d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/videodsp_init_armv5te.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Ronald S. Bultje + * + * 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/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/videodsp.h" +#include "videodsp_arm.h" + +void ff_prefetch_arm(uint8_t *mem, ptrdiff_t stride, int h); + +av_cold void ff_videodsp_init_armv5te(VideoDSPContext *ctx, int bpc) +{ +#if HAVE_ARMV5TE_EXTERNAL + ctx->prefetch = ff_prefetch_arm; +#endif +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vorbisdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vorbisdsp_init_arm.c new file mode 100644 index 0000000000..f4b3d80ef6 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vorbisdsp_init_arm.c @@ -0,0 +1,37 @@ +/* + * ARM NEON optimised DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vorbisdsp.h" + +void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, + intptr_t blocksize); + +av_cold void ff_vorbisdsp_init_arm(VorbisDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp3dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp3dsp_init_arm.c new file mode 100644 index 0000000000..65ea53fe0f --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp3dsp_init_arm.c @@ -0,0 +1,44 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp3dsp.h" + +void ff_vp3_idct_put_neon(uint8_t *dest, ptrdiff_t stride, int16_t *data); +void ff_vp3_idct_add_neon(uint8_t *dest, ptrdiff_t stride, int16_t *data); +void ff_vp3_idct_dc_add_neon(uint8_t *dest, ptrdiff_t stride, int16_t *data); + +void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *); +void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *); + +av_cold void ff_vp3dsp_init_arm(VP3DSPContext *c, int flags) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->idct_put = ff_vp3_idct_put_neon; + c->idct_add = ff_vp3_idct_add_neon; + c->idct_dc_add = ff_vp3_idct_dc_add_neon; + c->v_loop_filter = ff_vp3_v_loop_filter_neon; + c->h_loop_filter = ff_vp3_h_loop_filter_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp56_arith.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp56_arith.h new file mode 100644 index 0000000000..feb1247916 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp56_arith.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2010 Mans Rullgard + * + * 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_ARM_VP56_ARITH_H +#define AVCODEC_ARM_VP56_ARITH_H + +#if CONFIG_THUMB +# define A(x) +# define T(x) x +#else +# define A(x) x +# define T(x) +#endif + +#if CONFIG_THUMB || defined __clang__ +# define L(x) +# define U(x) x +#else +# define L(x) x +# define U(x) +#endif + +#if HAVE_ARMV6_INLINE + +#define vp56_rac_get_prob vp56_rac_get_prob_armv6 +static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned bit; + + __asm__ ("adds %3, %3, %0 \n" + "itt cs \n" + "cmpcs %7, %4 \n" + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + T("itttt cs \n") + "rev16cs %2, %2 \n" + T("lslcs %2, %2, %3 \n") + T("orrcs %1, %1, %2 \n") + A("orrcs %1, %1, %2, lsl %3 \n") + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "cmp %1, %0, lsl #16 \n" + "ittte ge \n" + "subge %1, %1, %0, lsl #16 \n" + "subge %0, %5, %0 \n" + "movge %2, #1 \n" + "movlt %2, #0 \n" + : "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), + "0"(shift), "1"(code_word) + : "cc"); + + return bit; +} + +#define vp56_rac_get_prob_branchy vp56_rac_get_prob_branchy_armv6 +static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned low; + unsigned tmp; + + __asm__ ("adds %3, %3, %0 \n" + "itt cs \n" + "cmpcs %7, %4 \n" + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + T("itttt cs \n") + "rev16cs %2, %2 \n" + T("lslcs %2, %2, %3 \n") + T("orrcs %1, %1, %2 \n") + A("orrcs %1, %1, %2, lsl %3 \n") + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "lsl %2, %0, #16 \n" + : "=&r"(low), "+&r"(code_word), "=&r"(tmp), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift) + : "cc"); + + if (code_word >= tmp) { + c->high = high - low; + c->code_word = code_word - tmp; + return 1; + } + + c->high = low; + c->code_word = code_word; + return 0; +} + +#endif + +#endif /* AVCODEC_ARM_VP56_ARITH_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp6dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp6dsp_init_arm.c new file mode 100644 index 0000000000..a59d61278c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp6dsp_init_arm.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/vp56dsp.h" + +void ff_vp6_edge_filter_hor_neon(uint8_t *yuv, ptrdiff_t stride, int t); +void ff_vp6_edge_filter_ver_neon(uint8_t *yuv, ptrdiff_t stride, int t); + +av_cold void ff_vp6dsp_init_arm(VP56DSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->edge_filter_hor = ff_vp6_edge_filter_hor_neon; + s->edge_filter_ver = ff_vp6_edge_filter_ver_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8.h new file mode 100644 index 0000000000..965342d93b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8.h @@ -0,0 +1,35 @@ +/* + * 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_ARM_VP8_H +#define AVCODEC_ARM_VP8_H + +#include + +#include "config.h" +#include "libavcodec/vp56.h" +#include "libavcodec/vp8.h" + +#if HAVE_ARMV6_EXTERNAL +#define vp8_decode_block_coeffs_internal ff_decode_block_coeffs_armv6 +int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, int16_t block[16], + uint8_t probs[8][3][NUM_DCT_TOKENS-1], + int i, uint8_t *token_prob, int16_t qmul[2]); +#endif + +#endif /* AVCODEC_ARM_VP8_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp.h new file mode 100644 index 0000000000..7281d0bfb1 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp.h @@ -0,0 +1,80 @@ +/* + * 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_ARM_VP8DSP_H +#define AVCODEC_ARM_VP8DSP_H + +#include "libavcodec/vp8dsp.h" + +void ff_vp78dsp_init_armv6(VP8DSPContext *dsp); +void ff_vp78dsp_init_neon(VP8DSPContext *dsp); +void ff_vp8dsp_init_armv6(VP8DSPContext *dsp); +void ff_vp8dsp_init_neon(VP8DSPContext *dsp); + +#define VP8_LF_Y(hv, inner, opt) \ + void ff_vp8_##hv##_loop_filter16##inner##_##opt(uint8_t *dst, \ + ptrdiff_t stride, \ + int flim_E, int flim_I, \ + int hev_thresh) + +#define VP8_LF_UV(hv, inner, opt) \ + void ff_vp8_##hv##_loop_filter8uv##inner##_##opt(uint8_t *dstU, \ + uint8_t *dstV, \ + ptrdiff_t stride, \ + int flim_E, int flim_I, \ + int hev_thresh) + +#define VP8_LF_SIMPLE(hv, opt) \ + void ff_vp8_##hv##_loop_filter16_simple_##opt(uint8_t *dst, \ + ptrdiff_t stride, \ + int flim) + +#define VP8_LF_HV(inner, opt) \ + VP8_LF_Y(h, inner, opt); \ + VP8_LF_Y(v, inner, opt); \ + VP8_LF_UV(h, inner, opt); \ + VP8_LF_UV(v, inner, opt) + +#define VP8_LF(opt) \ + VP8_LF_HV(, opt); \ + VP8_LF_HV(_inner, opt); \ + VP8_LF_SIMPLE(h, opt); \ + VP8_LF_SIMPLE(v, opt) + +#define VP8_MC(n, opt) \ + void ff_put_vp8_##n##_##opt(uint8_t *dst, ptrdiff_t dststride, \ + uint8_t *src, ptrdiff_t srcstride, \ + int h, int x, int y) + +#define VP8_EPEL(w, opt) \ + VP8_MC(pixels ## w, opt); \ + VP8_MC(epel ## w ## _h4, opt); \ + VP8_MC(epel ## w ## _h6, opt); \ + VP8_MC(epel ## w ## _v4, opt); \ + VP8_MC(epel ## w ## _h4v4, opt); \ + VP8_MC(epel ## w ## _h6v4, opt); \ + VP8_MC(epel ## w ## _v6, opt); \ + VP8_MC(epel ## w ## _h4v6, opt); \ + VP8_MC(epel ## w ## _h6v6, opt) + +#define VP8_BILIN(w, opt) \ + VP8_MC(bilin ## w ## _h, opt); \ + VP8_MC(bilin ## w ## _v, opt); \ + VP8_MC(bilin ## w ## _hv, opt) + +#endif /* AVCODEC_ARM_VP8DSP_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_arm.c new file mode 100644 index 0000000000..8b801766d7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_arm.c @@ -0,0 +1,44 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +av_cold void ff_vp78dsp_init_arm(VP8DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) + ff_vp78dsp_init_armv6(dsp); + if (have_neon(cpu_flags)) + ff_vp78dsp_init_neon(dsp); +} + +av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) + ff_vp8dsp_init_armv6(dsp); + if (have_neon(cpu_flags)) + ff_vp8dsp_init_neon(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_armv6.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_armv6.c new file mode 100644 index 0000000000..a5bcd733e0 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_armv6.c @@ -0,0 +1,123 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +void ff_vp8_luma_dc_wht_armv6(int16_t block[4][4][16], int16_t dc[16]); +void ff_vp8_luma_dc_wht_dc_armv6(int16_t block[4][4][16], int16_t dc[16]); + +void ff_vp8_idct_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4y_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4uv_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); + +VP8_LF(armv6); + +VP8_EPEL(16, armv6); +VP8_EPEL(8, armv6); +VP8_EPEL(4, armv6); + +VP8_BILIN(16, armv6); +VP8_BILIN(8, armv6); +VP8_BILIN(4, armv6); + +av_cold void ff_vp78dsp_init_armv6(VP8DSPContext *dsp) +{ + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6; + + dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6; + + dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6; +} + +av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp) +{ + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6; + dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; + + dsp->vp8_idct_add = ff_vp8_idct_add_armv6; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_neon.c new file mode 100644 index 0000000000..53f1f23380 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp8dsp_init_neon.c @@ -0,0 +1,119 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +void ff_vp8_luma_dc_wht_neon(int16_t block[4][4][16], int16_t dc[16]); + +void ff_vp8_idct_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); + +VP8_LF(neon); + +VP8_EPEL(16, neon); +VP8_EPEL(8, neon); +VP8_EPEL(4, neon); + +VP8_BILIN(16, neon); +VP8_BILIN(8, neon); +VP8_BILIN(4, neon); + +av_cold void ff_vp78dsp_init_neon(VP8DSPContext *dsp) +{ + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; +} + +av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp) +{ + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; + + dsp->vp8_idct_add = ff_vp8_idct_add_neon; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init.h new file mode 100644 index 0000000000..0dc1c2dc20 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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_ARM_VP9DSP_INIT_H +#define AVCODEC_ARM_VP9DSP_INIT_H + +#include "libavcodec/vp9dsp.h" + +void ff_vp9dsp_init_10bpp_arm(VP9DSPContext *dsp); +void ff_vp9dsp_init_12bpp_arm(VP9DSPContext *dsp); + +#endif /* AVCODEC_ARM_VP9DSP_INIT_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_10bpp_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_10bpp_arm.c new file mode 100644 index 0000000000..b8cb293b20 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_10bpp_arm.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define BPP 10 +#define INIT_FUNC ff_vp9dsp_init_10bpp_arm +#include "vp9dsp_init_16bpp_arm_template.c" diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_12bpp_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_12bpp_arm.c new file mode 100644 index 0000000000..fa65eb260b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_12bpp_arm.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define BPP 12 +#define INIT_FUNC ff_vp9dsp_init_12bpp_arm +#include "vp9dsp_init_16bpp_arm_template.c" diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_16bpp_arm_template.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_16bpp_arm_template.c new file mode 100644 index 0000000000..1b0007859d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_16bpp_arm_template.c @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavutil/arm/cpu.h" +#include "vp9dsp_init.h" + +#define declare_fpel(type, sz, suffix) \ +void ff_vp9_##type##sz##suffix##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define decl_mc_func(op, filter, dir, sz, bpp) \ +void ff_vp9_##op##_##filter##sz##_##dir##_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define define_8tap_2d_fn(op, filter, sz, bpp) \ +static void op##_##filter##sz##_hv_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, \ + ptrdiff_t src_stride, \ + int h, int mx, int my) \ +{ \ + LOCAL_ALIGNED_16(uint8_t, temp, [((1 + (sz < 64)) * sz + 8) * sz * 2]); \ + /* We only need h + 7 lines, but the horizontal filter assumes an \ + * even number of rows, so filter h + 8 lines here. */ \ + ff_vp9_put_##filter##sz##_h_##bpp##_neon(temp, 2 * sz, \ + src - 3 * src_stride, src_stride, \ + h + 8, mx, 0); \ + ff_vp9_##op##_##filter##sz##_v_##bpp##_neon(dst, dst_stride, \ + temp + 3 * 2 * sz, 2 * sz, \ + h, 0, my); \ +} + +#define decl_filter_funcs(op, dir, sz, bpp) \ + decl_mc_func(op, regular, dir, sz, bpp); \ + decl_mc_func(op, sharp, dir, sz, bpp); \ + decl_mc_func(op, smooth, dir, sz, bpp) + +#define decl_mc_funcs(sz, bpp) \ + decl_filter_funcs(put, h, sz, bpp); \ + decl_filter_funcs(avg, h, sz, bpp); \ + decl_filter_funcs(put, v, sz, bpp); \ + decl_filter_funcs(avg, v, sz, bpp); \ + decl_filter_funcs(put, hv, sz, bpp); \ + decl_filter_funcs(avg, hv, sz, bpp) + +declare_fpel(copy, 128, ); +declare_fpel(copy, 64, ); +declare_fpel(copy, 32, ); +declare_fpel(copy, 16, ); +declare_fpel(copy, 8, ); +declare_fpel(avg, 64, _16); +declare_fpel(avg, 32, _16); +declare_fpel(avg, 16, _16); +declare_fpel(avg, 8, _16); +declare_fpel(avg, 4, _16); + +decl_mc_funcs(64, BPP); +decl_mc_funcs(32, BPP); +decl_mc_funcs(16, BPP); +decl_mc_funcs(8, BPP); +decl_mc_funcs(4, BPP); + +#define define_8tap_2d_funcs(sz, bpp) \ + define_8tap_2d_fn(put, regular, sz, bpp) \ + define_8tap_2d_fn(put, sharp, sz, bpp) \ + define_8tap_2d_fn(put, smooth, sz, bpp) \ + define_8tap_2d_fn(avg, regular, sz, bpp) \ + define_8tap_2d_fn(avg, sharp, sz, bpp) \ + define_8tap_2d_fn(avg, smooth, sz, bpp) + +define_8tap_2d_funcs(64, BPP) +define_8tap_2d_funcs(32, BPP) +define_8tap_2d_funcs(16, BPP) +define_8tap_2d_funcs(8, BPP) +define_8tap_2d_funcs(4, BPP) + + +static av_cold void vp9dsp_mc_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_fpel(idx1, idx2, sz, type, suffix) \ + dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##suffix##_neon + +#define init_copy_avg(idx, sz1, sz2) \ + init_fpel(idx, 0, sz2, copy, ); \ + init_fpel(idx, 1, sz1, avg, _16) + +#define init_mc_func(idx1, idx2, op, filter, fname, dir, mx, my, sz, pfx, bpp) \ + dsp->mc[idx1][filter][idx2][mx][my] = pfx##op##_##fname##sz##_##dir##_##bpp##_neon + +#define init_mc_funcs(idx, dir, mx, my, sz, pfx, bpp) \ + init_mc_func(idx, 0, put, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp) + +#define init_mc_funcs_dirs(idx, sz, bpp) \ + init_mc_funcs(idx, h, 1, 0, sz, ff_vp9_, bpp); \ + init_mc_funcs(idx, v, 0, 1, sz, ff_vp9_, bpp); \ + init_mc_funcs(idx, hv, 1, 1, sz, , bpp) + + init_copy_avg(0, 64, 128); + init_copy_avg(1, 32, 64); + init_copy_avg(2, 16, 32); + init_copy_avg(3, 8, 16); + init_copy_avg(4, 4, 8); + + init_mc_funcs_dirs(0, 64, BPP); + init_mc_funcs_dirs(1, 32, BPP); + init_mc_funcs_dirs(2, 16, BPP); + init_mc_funcs_dirs(3, 8, BPP); + init_mc_funcs_dirs(4, 4, BPP); + } +} + +#define define_itxfm2(type_a, type_b, sz, bpp) \ +void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_##bpp##_neon(uint8_t *_dst, \ + ptrdiff_t stride, \ + int16_t *_block, int eob) +#define define_itxfm(type_a, type_b, sz, bpp) define_itxfm2(type_a, type_b, sz, bpp) + +#define define_itxfm_funcs(sz, bpp) \ + define_itxfm(idct, idct, sz, bpp); \ + define_itxfm(iadst, idct, sz, bpp); \ + define_itxfm(idct, iadst, sz, bpp); \ + define_itxfm(iadst, iadst, sz, bpp) + +define_itxfm_funcs(4, BPP); +define_itxfm_funcs(8, BPP); +define_itxfm_funcs(16, BPP); +define_itxfm(idct, idct, 32, BPP); +define_itxfm(iwht, iwht, 4, BPP); + + +static av_cold void vp9dsp_itxfm_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_itxfm2(tx, sz, bpp) \ + dsp->itxfm_add[tx][DCT_DCT] = ff_vp9_idct_idct_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][DCT_ADST] = ff_vp9_iadst_idct_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][ADST_DCT] = ff_vp9_idct_iadst_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_##bpp##_neon +#define init_itxfm(tx, sz, bpp) init_itxfm2(tx, sz, bpp) + +#define init_idct2(tx, nm, bpp) \ + dsp->itxfm_add[tx][DCT_DCT] = \ + dsp->itxfm_add[tx][ADST_DCT] = \ + dsp->itxfm_add[tx][DCT_ADST] = \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_##bpp##_neon +#define init_idct(tx, nm, bpp) init_idct2(tx, nm, bpp) + + init_itxfm(TX_4X4, 4x4, BPP); + init_itxfm(TX_8X8, 8x8, BPP); + init_itxfm(TX_16X16, 16x16, BPP); + init_idct(TX_32X32, idct_idct_32x32, BPP); + init_idct(4, iwht_iwht_4x4, BPP); + } +} + +#define define_loop_filter(dir, wd, size, bpp) \ +void ff_vp9_loop_filter_##dir##_##wd##_##size##_##bpp##_neon(uint8_t *dst, ptrdiff_t stride, int E, int I, int H) + +#define define_loop_filters(wd, size, bpp) \ + define_loop_filter(h, wd, size, bpp); \ + define_loop_filter(v, wd, size, bpp) + +define_loop_filters(4, 8, BPP); +define_loop_filters(8, 8, BPP); +define_loop_filters(16, 8, BPP); + +define_loop_filters(16, 16, BPP); + +define_loop_filters(44, 16, BPP); +define_loop_filters(48, 16, BPP); +define_loop_filters(84, 16, BPP); +define_loop_filters(88, 16, BPP); + +static av_cold void vp9dsp_loopfilter_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_lpf_func_8(idx1, idx2, dir, wd, bpp) \ + dsp->loop_filter_8[idx1][idx2] = ff_vp9_loop_filter_##dir##_##wd##_8_##bpp##_neon + +#define init_lpf_func_16(idx, dir, bpp) \ + dsp->loop_filter_16[idx] = ff_vp9_loop_filter_##dir##_16_16_##bpp##_neon + +#define init_lpf_func_mix2(idx1, idx2, idx3, dir, wd, bpp) \ + dsp->loop_filter_mix2[idx1][idx2][idx3] = ff_vp9_loop_filter_##dir##_##wd##_16_##bpp##_neon + +#define init_lpf_funcs_8_wd(idx, wd, bpp) \ + init_lpf_func_8(idx, 0, h, wd, bpp); \ + init_lpf_func_8(idx, 1, v, wd, bpp) + +#define init_lpf_funcs_16(bpp) \ + init_lpf_func_16(0, h, bpp); \ + init_lpf_func_16(1, v, bpp) + +#define init_lpf_funcs_mix2_wd(idx1, idx2, wd, bpp) \ + init_lpf_func_mix2(idx1, idx2, 0, h, wd, bpp); \ + init_lpf_func_mix2(idx1, idx2, 1, v, wd, bpp) + +#define init_lpf_funcs_8(bpp) \ + init_lpf_funcs_8_wd(0, 4, bpp); \ + init_lpf_funcs_8_wd(1, 8, bpp); \ + init_lpf_funcs_8_wd(2, 16, bpp) + +#define init_lpf_funcs_mix2(bpp) \ + init_lpf_funcs_mix2_wd(0, 0, 44, bpp); \ + init_lpf_funcs_mix2_wd(0, 1, 48, bpp); \ + init_lpf_funcs_mix2_wd(1, 0, 84, bpp); \ + init_lpf_funcs_mix2_wd(1, 1, 88, bpp) + + init_lpf_funcs_8(BPP); + init_lpf_funcs_16(BPP); + init_lpf_funcs_mix2(BPP); + } +} + +av_cold void INIT_FUNC(VP9DSPContext *dsp) +{ + vp9dsp_mc_init_arm(dsp); + vp9dsp_loopfilter_init_arm(dsp); + vp9dsp_itxfm_init_arm(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_arm.c new file mode 100644 index 0000000000..cb7f48d5ca --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/arm/vp9dsp_init_arm.c @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2016 Google Inc. + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp9dsp.h" +#include "vp9dsp_init.h" + +#define declare_fpel(type, sz) \ +void ff_vp9_##type##sz##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define declare_copy_avg(sz) \ + declare_fpel(copy, sz); \ + declare_fpel(avg , sz) + +#define decl_mc_func(op, filter, dir, sz) \ +void ff_vp9_##op##_##filter##sz##_##dir##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define define_8tap_2d_fn(op, filter, sz) \ +static void op##_##filter##sz##_hv_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) \ +{ \ + LOCAL_ALIGNED_16(uint8_t, temp, [((1 + (sz < 64)) * sz + 8) * sz]); \ + /* We only need h + 7 lines, but the horizontal filter assumes an \ + * even number of rows, so filter h + 8 lines here. */ \ + ff_vp9_put_##filter##sz##_h_neon(temp, sz, \ + src - 3 * src_stride, src_stride, \ + h + 8, mx, 0); \ + ff_vp9_##op##_##filter##sz##_v_neon(dst, dst_stride, \ + temp + 3 * sz, sz, \ + h, 0, my); \ +} + +#define decl_filter_funcs(op, dir, sz) \ + decl_mc_func(op, regular, dir, sz); \ + decl_mc_func(op, sharp, dir, sz); \ + decl_mc_func(op, smooth, dir, sz) + +#define decl_mc_funcs(sz) \ + decl_filter_funcs(put, h, sz); \ + decl_filter_funcs(avg, h, sz); \ + decl_filter_funcs(put, v, sz); \ + decl_filter_funcs(avg, v, sz); \ + decl_filter_funcs(put, hv, sz); \ + decl_filter_funcs(avg, hv, sz) + +declare_copy_avg(64); +declare_copy_avg(32); +declare_copy_avg(16); +declare_copy_avg(8); +declare_copy_avg(4); + +decl_mc_funcs(64); +decl_mc_funcs(32); +decl_mc_funcs(16); +decl_mc_funcs(8); +decl_mc_funcs(4); + +#define define_8tap_2d_funcs(sz) \ + define_8tap_2d_fn(put, regular, sz) \ + define_8tap_2d_fn(put, sharp, sz) \ + define_8tap_2d_fn(put, smooth, sz) \ + define_8tap_2d_fn(avg, regular, sz) \ + define_8tap_2d_fn(avg, sharp, sz) \ + define_8tap_2d_fn(avg, smooth, sz) + +define_8tap_2d_funcs(64) +define_8tap_2d_funcs(32) +define_8tap_2d_funcs(16) +define_8tap_2d_funcs(8) +define_8tap_2d_funcs(4) + + +static av_cold void vp9dsp_mc_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_fpel(idx1, idx2, sz, type) \ + dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_neon + +#define init_copy_avg(idx, sz) \ + init_fpel(idx, 0, sz, copy); \ + init_fpel(idx, 1, sz, avg) + +#define init_mc_func(idx1, idx2, op, filter, fname, dir, mx, my, sz, pfx) \ + dsp->mc[idx1][filter][idx2][mx][my] = pfx##op##_##fname##sz##_##dir##_neon + +#define init_mc_funcs(idx, dir, mx, my, sz, pfx) \ + init_mc_func(idx, 0, put, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx) + +#define init_mc_funcs_dirs(idx, sz) \ + init_mc_funcs(idx, h, 1, 0, sz, ff_vp9_); \ + init_mc_funcs(idx, v, 0, 1, sz, ff_vp9_); \ + init_mc_funcs(idx, hv, 1, 1, sz,) + + init_copy_avg(0, 64); + init_copy_avg(1, 32); + init_copy_avg(2, 16); + init_copy_avg(3, 8); + init_copy_avg(4, 4); + + init_mc_funcs_dirs(0, 64); + init_mc_funcs_dirs(1, 32); + init_mc_funcs_dirs(2, 16); + init_mc_funcs_dirs(3, 8); + init_mc_funcs_dirs(4, 4); + } +} + +#define define_itxfm(type_a, type_b, sz) \ +void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_neon(uint8_t *_dst, \ + ptrdiff_t stride, \ + int16_t *_block, int eob) + +#define define_itxfm_funcs(sz) \ + define_itxfm(idct, idct, sz); \ + define_itxfm(iadst, idct, sz); \ + define_itxfm(idct, iadst, sz); \ + define_itxfm(iadst, iadst, sz) + +define_itxfm_funcs(4); +define_itxfm_funcs(8); +define_itxfm_funcs(16); +define_itxfm(idct, idct, 32); +define_itxfm(iwht, iwht, 4); + + +static av_cold void vp9dsp_itxfm_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_itxfm(tx, sz) \ + dsp->itxfm_add[tx][DCT_DCT] = ff_vp9_idct_idct_##sz##_add_neon; \ + dsp->itxfm_add[tx][DCT_ADST] = ff_vp9_iadst_idct_##sz##_add_neon; \ + dsp->itxfm_add[tx][ADST_DCT] = ff_vp9_idct_iadst_##sz##_add_neon; \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_neon + +#define init_idct(tx, nm) \ + dsp->itxfm_add[tx][DCT_DCT] = \ + dsp->itxfm_add[tx][ADST_DCT] = \ + dsp->itxfm_add[tx][DCT_ADST] = \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_neon + + init_itxfm(TX_4X4, 4x4); + init_itxfm(TX_8X8, 8x8); + init_itxfm(TX_16X16, 16x16); + init_idct(TX_32X32, idct_idct_32x32); + init_idct(4, iwht_iwht_4x4); + } +} + +#define define_loop_filter(dir, wd, size) \ +void ff_vp9_loop_filter_##dir##_##wd##_##size##_neon(uint8_t *dst, ptrdiff_t stride, int E, int I, int H) + +#define define_loop_filters(wd, size) \ + define_loop_filter(h, wd, size); \ + define_loop_filter(v, wd, size) + +define_loop_filters(4, 8); +define_loop_filters(8, 8); +define_loop_filters(16, 8); +define_loop_filters(16, 16); + +define_loop_filters(44, 16); + +#define lf_mix_fn(dir, wd1, wd2, stridea) \ +static void loop_filter_##dir##_##wd1##wd2##_16_neon(uint8_t *dst, \ + ptrdiff_t stride, \ + int E, int I, int H) \ +{ \ + ff_vp9_loop_filter_##dir##_##wd1##_8_neon(dst, stride, E & 0xff, I & 0xff, H & 0xff); \ + ff_vp9_loop_filter_##dir##_##wd2##_8_neon(dst + 8 * stridea, stride, E >> 8, I >> 8, H >> 8); \ +} + +#define lf_mix_fns(wd1, wd2) \ + lf_mix_fn(h, wd1, wd2, stride) \ + lf_mix_fn(v, wd1, wd2, sizeof(uint8_t)) + +lf_mix_fns(4, 8) +lf_mix_fns(8, 4) +lf_mix_fns(8, 8) + +static av_cold void vp9dsp_loopfilter_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + dsp->loop_filter_8[0][1] = ff_vp9_loop_filter_v_4_8_neon; + dsp->loop_filter_8[0][0] = ff_vp9_loop_filter_h_4_8_neon; + dsp->loop_filter_8[1][1] = ff_vp9_loop_filter_v_8_8_neon; + dsp->loop_filter_8[1][0] = ff_vp9_loop_filter_h_8_8_neon; + dsp->loop_filter_8[2][1] = ff_vp9_loop_filter_v_16_8_neon; + dsp->loop_filter_8[2][0] = ff_vp9_loop_filter_h_16_8_neon; + + dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_neon; + dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_neon; + + dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_neon; + dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_neon; + dsp->loop_filter_mix2[0][1][0] = loop_filter_h_48_16_neon; + dsp->loop_filter_mix2[0][1][1] = loop_filter_v_48_16_neon; + dsp->loop_filter_mix2[1][0][0] = loop_filter_h_84_16_neon; + dsp->loop_filter_mix2[1][0][1] = loop_filter_v_84_16_neon; + dsp->loop_filter_mix2[1][1][0] = loop_filter_h_88_16_neon; + dsp->loop_filter_mix2[1][1][1] = loop_filter_v_88_16_neon; + } +} + +av_cold void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp) +{ + if (bpp == 10) { + ff_vp9dsp_init_10bpp_arm(dsp); + return; + } else if (bpp == 12) { + ff_vp9dsp_init_12bpp_arm(dsp); + return; + } else if (bpp != 8) + return; + + vp9dsp_mc_init_arm(dsp); + vp9dsp_loopfilter_init_arm(dsp); + vp9dsp_itxfm_init_arm(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/asm-offsets.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/asm-offsets.h new file mode 100644 index 0000000000..a2174b0a08 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/asm-offsets.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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_ARM_ASM_OFFSETS_H +#define AVCODEC_ARM_ASM_OFFSETS_H + +/* MpegEncContext */ +#define Y_DC_SCALE 0x04 +#define C_DC_SCALE 0x08 +#define AC_PRED 0x0c +#define BLOCK_LAST_INDEX 0x10 +#define H263_AIC 0x40 +#define INTER_SCANTAB_RASTER_END 0x88 + +#endif /* AVCODEC_ARM_ASM_OFFSETS_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_arm.h new file mode 100644 index 0000000000..213660dae7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_AUDIODSP_ARM_H +#define AVCODEC_ARM_AUDIODSP_ARM_H + +#include "libavcodec/audiodsp.h" + +void ff_audiodsp_init_neon(AudioDSPContext *c); + +#endif /* AVCODEC_ARM_AUDIODSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_init_arm.c new file mode 100644 index 0000000000..74aa52a4ef --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_init_arm.c @@ -0,0 +1,33 @@ +/* + * ARM optimized audio functions + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/audiodsp.h" +#include "audiodsp_arm.h" + +av_cold void ff_audiodsp_init_arm(AudioDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + ff_audiodsp_init_neon(c); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_init_neon.c new file mode 100644 index 0000000000..6902db86b4 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/audiodsp_init_neon.c @@ -0,0 +1,40 @@ +/* + * ARM NEON optimised audio functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/audiodsp.h" +#include "audiodsp_arm.h" + +void ff_vector_clipf_neon(float *dst, const float *src, int len, float min, float max); +void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min, + int32_t max, unsigned int len); + +int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int len); + +av_cold void ff_audiodsp_init_neon(AudioDSPContext *c) +{ + c->vector_clip_int32 = ff_vector_clip_int32_neon; + c->vector_clipf = ff_vector_clipf_neon; + + c->scalarproduct_int16 = ff_scalarproduct_int16_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_arm.h new file mode 100644 index 0000000000..59ebeb8466 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_BLOCKDSP_ARM_H +#define AVCODEC_ARM_BLOCKDSP_ARM_H + +#include "libavcodec/blockdsp.h" + +void ff_blockdsp_init_neon(BlockDSPContext *c); + +#endif /* AVCODEC_ARM_BLOCKDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_init_arm.c new file mode 100644 index 0000000000..2080d5253f --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_init_arm.c @@ -0,0 +1,33 @@ +/* + * ARM optimized block operations + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/blockdsp.h" +#include "blockdsp_arm.h" + +av_cold void ff_blockdsp_init_arm(BlockDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + ff_blockdsp_init_neon(c); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_init_neon.c new file mode 100644 index 0000000000..0600bc6e50 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/blockdsp_init_neon.c @@ -0,0 +1,35 @@ +/* + * ARM NEON optimised block operations + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/blockdsp.h" +#include "blockdsp_arm.h" + +void ff_clear_block_neon(int16_t *block); +void ff_clear_blocks_neon(int16_t *blocks); + +av_cold void ff_blockdsp_init_neon(BlockDSPContext *c) +{ + c->clear_block = ff_clear_block_neon; + c->clear_blocks = ff_clear_blocks_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/cabac.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/cabac.h new file mode 100644 index 0000000000..fdbf86b45e --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/cabac.h @@ -0,0 +1,108 @@ +/* + * 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_ARM_CABAC_H +#define AVCODEC_ARM_CABAC_H + +#include "config.h" +#if HAVE_ARMV6T2_INLINE + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavcodec/cabac.h" + +#define get_cabac_inline get_cabac_inline_arm +static av_always_inline int get_cabac_inline_arm(CABACContext *c, + uint8_t *const state) +{ + int bit; + void *reg_b, *reg_c, *tmp; + + __asm__ volatile( + "ldrb %[bit] , [%[state]] \n\t" + "add %[r_b] , %[tables] , %[lps_off] \n\t" + "mov %[tmp] , %[range] \n\t" + "and %[range] , %[range] , #0xC0 \n\t" + "add %[r_b] , %[r_b] , %[bit] \n\t" + "ldrb %[range] , [%[r_b], %[range], lsl #1] \n\t" + "add %[r_b] , %[tables] , %[norm_off] \n\t" + "sub %[r_c] , %[tmp] , %[range] \n\t" + "lsl %[tmp] , %[r_c] , #17 \n\t" + "cmp %[tmp] , %[low] \n\t" + "it gt \n\t" + "movgt %[range] , %[r_c] \n\t" + "itt cc \n\t" + "mvncc %[bit] , %[bit] \n\t" + "subcc %[low] , %[low] , %[tmp] \n\t" + "add %[r_c] , %[tables] , %[mlps_off] \n\t" + "ldrb %[tmp] , [%[r_b], %[range]] \n\t" + "ldrb %[r_b] , [%[r_c], %[bit]] \n\t" + "lsl %[low] , %[low] , %[tmp] \n\t" + "lsl %[range] , %[range] , %[tmp] \n\t" + "uxth %[r_c] , %[low] \n\t" + "strb %[r_b] , [%[state]] \n\t" + "tst %[r_c] , %[r_c] \n\t" + "bne 2f \n\t" + "ldr %[r_c] , [%[c], %[byte]] \n\t" +#if UNCHECKED_BITSTREAM_READER + "ldrh %[tmp] , [%[r_c]] \n\t" + "add %[r_c] , %[r_c] , #2 \n\t" + "str %[r_c] , [%[c], %[byte]] \n\t" +#else + "ldr %[r_b] , [%[c], %[end]] \n\t" + "ldrh %[tmp] , [%[r_c]] \n\t" + "cmp %[r_c] , %[r_b] \n\t" + "itt lt \n\t" + "addlt %[r_c] , %[r_c] , #2 \n\t" + "strlt %[r_c] , [%[c], %[byte]] \n\t" +#endif + "sub %[r_c] , %[low] , #1 \n\t" + "add %[r_b] , %[tables] , %[norm_off] \n\t" + "eor %[r_c] , %[low] , %[r_c] \n\t" + "rev %[tmp] , %[tmp] \n\t" + "lsr %[r_c] , %[r_c] , #15 \n\t" + "lsr %[tmp] , %[tmp] , #15 \n\t" + "ldrb %[r_c] , [%[r_b], %[r_c]] \n\t" + "movw %[r_b] , #0xFFFF \n\t" + "sub %[tmp] , %[tmp] , %[r_b] \n\t" + "rsb %[r_c] , %[r_c] , #7 \n\t" + "lsl %[tmp] , %[tmp] , %[r_c] \n\t" + "add %[low] , %[low] , %[tmp] \n\t" + "2: \n\t" + : [bit]"=&r"(bit), + [low]"+&r"(c->low), + [range]"+&r"(c->range), + [r_b]"=&r"(reg_b), + [r_c]"=&r"(reg_c), + [tmp]"=&r"(tmp) + : [c]"r"(c), + [state]"r"(state), + [tables]"r"(ff_h264_cabac_tables), + [byte]"M"(offsetof(CABACContext, bytestream)), + [end]"M"(offsetof(CABACContext, bytestream_end)), + [norm_off]"I"(H264_NORM_SHIFT_OFFSET), + [lps_off]"I"(H264_LPS_RANGE_OFFSET), + [mlps_off]"I"(H264_MLPS_STATE_OFFSET + 128) + : "memory", "cc" + ); + + return bit & 1; +} +#endif /* HAVE_ARMV6T2_INLINE */ + +#endif /* AVCODEC_ARM_CABAC_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/dca.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/dca.h new file mode 100644 index 0000000000..ae4b730a8a --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/dca.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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_ARM_DCA_H +#define AVCODEC_ARM_DCA_H + +#include + +#include "config.h" +#include "libavcodec/mathops.h" + +#if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4) && !CONFIG_THUMB + +#define decode_blockcodes decode_blockcodes +static inline int decode_blockcodes(int code1, int code2, int levels, + int32_t *values) +{ + int32_t v0, v1, v2, v3, v4, v5; + + __asm__ ("smmul %0, %6, %10 \n" + "smmul %3, %7, %10 \n" + "smlabb %6, %0, %9, %6 \n" + "smlabb %7, %3, %9, %7 \n" + "smmul %1, %0, %10 \n" + "smmul %4, %3, %10 \n" + "sub %6, %6, %8, lsr #1 \n" + "sub %7, %7, %8, lsr #1 \n" + "smlabb %0, %1, %9, %0 \n" + "smlabb %3, %4, %9, %3 \n" + "smmul %2, %1, %10 \n" + "smmul %5, %4, %10 \n" + "str %6, [%11, #0] \n" + "str %7, [%11, #16] \n" + "sub %0, %0, %8, lsr #1 \n" + "sub %3, %3, %8, lsr #1 \n" + "smlabb %1, %2, %9, %1 \n" + "smlabb %4, %5, %9, %4 \n" + "smmul %6, %2, %10 \n" + "smmul %7, %5, %10 \n" + "str %0, [%11, #4] \n" + "str %3, [%11, #20] \n" + "sub %1, %1, %8, lsr #1 \n" + "sub %4, %4, %8, lsr #1 \n" + "smlabb %2, %6, %9, %2 \n" + "smlabb %5, %7, %9, %5 \n" + "str %1, [%11, #8] \n" + "str %4, [%11, #24] \n" + "sub %2, %2, %8, lsr #1 \n" + "sub %5, %5, %8, lsr #1 \n" + "str %2, [%11, #12] \n" + "str %5, [%11, #28] \n" + : "=&r"(v0), "=&r"(v1), "=&r"(v2), + "=&r"(v3), "=&r"(v4), "=&r"(v5), + "+&r"(code1), "+&r"(code2) + : "r"(levels - 1), "r"(-levels), + "r"(ff_inverse[levels]), "r"(values) + : "memory"); + + return code1 | code2; +} + +#endif + +#endif /* AVCODEC_ARM_DCA_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fft_fixed_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fft_fixed_init_arm.c new file mode 100644 index 0000000000..11226d65ff --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fft_fixed_init_arm.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#define FFT_FLOAT 0 +#include "libavcodec/fft.h" + +void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z); +void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i); +void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i); + +av_cold void ff_fft_fixed_init_arm(FFTContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; +#if CONFIG_FFT + s->fft_calc = ff_fft_fixed_calc_neon; +#endif + +#if CONFIG_MDCT + if (!s->inverse && s->nbits >= 3) { + s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; + s->mdct_calc = ff_mdct_fixed_calc_neon; + s->mdct_calcw = ff_mdct_fixed_calcw_neon; + } +#endif + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fft_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fft_init_arm.c new file mode 100644 index 0000000000..331bd65e5c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fft_init_arm.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/fft.h" + +void ff_fft_calc_vfp(FFTContext *s, FFTComplex *z); + +void ff_fft_permute_neon(FFTContext *s, FFTComplex *z); +void ff_fft_calc_neon(FFTContext *s, FFTComplex *z); + +void ff_imdct_half_vfp(FFTContext *s, FFTSample *output, const FFTSample *input); + +void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); + +av_cold void ff_fft_init_arm(FFTContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_vfp_vm(cpu_flags)) { + s->fft_calc = ff_fft_calc_vfp; +#if CONFIG_MDCT + s->imdct_half = ff_imdct_half_vfp; +#endif + } + + if (have_neon(cpu_flags)) { +#if CONFIG_FFT + s->fft_permute = ff_fft_permute_neon; + s->fft_calc = ff_fft_calc_neon; +#endif +#if CONFIG_MDCT + s->imdct_calc = ff_imdct_calc_neon; + s->imdct_half = ff_imdct_half_neon; + s->mdct_calc = ff_mdct_calc_neon; + s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; +#endif + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/flacdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/flacdsp_init_arm.c new file mode 100644 index 0000000000..564e3dc79b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/flacdsp_init_arm.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * 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 "libavcodec/flacdsp.h" +#include "config.h" + +void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order, + int qlevel, int len); + +av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, + int bps) +{ + if (CONFIG_FLAC_DECODER) + c->lpc16 = ff_flac_lpc_16_arm; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fmtconvert_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fmtconvert_init_arm.c new file mode 100644 index 0000000000..e88255d619 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/fmtconvert_init_arm.c @@ -0,0 +1,53 @@ +/* + * ARM optimized Format Conversion Utils + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/fmtconvert.h" + +void ff_int32_to_float_fmul_array8_neon(FmtConvertContext *c, float *dst, + const int32_t *src, const float *mul, + int len); +void ff_int32_to_float_fmul_scalar_neon(float *dst, const int32_t *src, + float mul, int len); + +void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src, + float mul, int len); +void ff_int32_to_float_fmul_array8_vfp(FmtConvertContext *c, float *dst, + const int32_t *src, const float *mul, + int len); + +av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_vfp_vm(cpu_flags)) { + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp; + c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_vfp; + } + + if (have_neon(cpu_flags)) { + c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_neon; + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/g722dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/g722dsp_init_arm.c new file mode 100644 index 0000000000..c0e5d8b989 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/g722dsp_init_arm.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2015 Peter Meerwald + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/g722dsp.h" + +extern void ff_g722_apply_qmf_neon(const int16_t *prev_samples, int xout[2]); + +av_cold void ff_g722dsp_init_arm(G722DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + dsp->apply_qmf = ff_g722_apply_qmf_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264chroma_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264chroma_init_arm.c new file mode 100644 index 0000000000..aae804b621 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264chroma_init_arm.c @@ -0,0 +1,57 @@ +/* + * ARM NEON optimised H.264 chroma functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264chroma.h" + +void ff_put_h264_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_h264_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_h264_chroma_mc2_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +void ff_avg_h264_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_h264_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_h264_chroma_mc2_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +av_cold void ff_h264chroma_init_arm(H264ChromaContext *c, int bit_depth) +{ + const int high_bit_depth = bit_depth > 8; + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags) && !high_bit_depth) { + c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon; + c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon; + c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon; + + c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_neon; + c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_neon; + c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264dsp_init_arm.c new file mode 100644 index 0000000000..90144d0da2 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264dsp_init_arm.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264dsp.h" +#include "libavcodec/arm/startcode.h" + +void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha, + int beta, int8_t *tc0); + +void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); +void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); +void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); + +void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); +void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); +void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); + +void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); +void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); +void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); + +void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[6*8]); + +static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc) +{ +#if HAVE_NEON + if (bit_depth == 8) { + c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; + c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; + c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; + if(chroma_format_idc == 1){ + c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; + } + + c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; + c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon; + c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon; + + c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; + c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; + c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; + + c->h264_idct_add = ff_h264_idct_add_neon; + c->h264_idct_dc_add = ff_h264_idct_dc_add_neon; + c->h264_idct_add16 = ff_h264_idct_add16_neon; + c->h264_idct_add16intra = ff_h264_idct_add16intra_neon; + if (chroma_format_idc <= 1) + c->h264_idct_add8 = ff_h264_idct_add8_neon; + c->h264_idct8_add = ff_h264_idct8_add_neon; + c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon; + c->h264_idct8_add4 = ff_h264_idct8_add4_neon; + } +#endif // HAVE_NEON +} + +av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc) +{ + int cpu_flags = av_get_cpu_flags(); + +#if HAVE_ARMV6 + if (have_setend(cpu_flags)) + c->startcode_find_candidate = ff_startcode_find_candidate_armv6; +#endif + if (have_neon(cpu_flags)) + h264dsp_init_neon(c, bit_depth, chroma_format_idc); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264pred_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264pred_init_arm.c new file mode 100644 index 0000000000..cc324d7dca --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264pred_init_arm.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/h264pred.h" + +void ff_pred16x16_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_top_dc_neon(uint8_t *src, ptrdiff_t stride); + +void ff_pred8x8_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_top_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l0t_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0lt_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l00_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0l0_dc_neon(uint8_t *src, ptrdiff_t stride); + +static av_cold void h264_pred_init_neon(H264PredContext *h, int codec_id, + const int bit_depth, + const int chroma_format_idc) +{ +#if HAVE_NEON + const int high_depth = bit_depth > 8; + + if (high_depth) + return; + + if (chroma_format_idc <= 1) { + h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon; + h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon; + if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon; + h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon; + if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && + codec_id != AV_CODEC_ID_VP8) { + h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon; + h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon; + h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon; + h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] = ff_pred8x8_l0t_dc_neon; + h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] = ff_pred8x8_0lt_dc_neon; + h->pred8x8[ALZHEIMER_DC_L00_PRED8x8] = ff_pred8x8_l00_dc_neon; + h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8] = ff_pred8x8_0l0_dc_neon; + } + } + + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_neon; + h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vert_neon; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_hor_neon; + h->pred16x16[LEFT_DC_PRED8x8] = ff_pred16x16_left_dc_neon; + h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon; + h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_neon; + if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && + codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon; +#endif // HAVE_NEON +} + +av_cold void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, + int bit_depth, const int chroma_format_idc) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + h264_pred_init_neon(h, codec_id, bit_depth, chroma_format_idc); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264qpel_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264qpel_init_arm.c new file mode 100644 index 0000000000..71237be359 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/h264qpel_init_arm.c @@ -0,0 +1,171 @@ +/* + * ARM NEON optimised DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264qpel.h" + +void ff_put_h264_qpel16_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel16_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +void ff_put_h264_qpel8_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_put_h264_qpel8_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +void ff_avg_h264_qpel16_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel16_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +void ff_avg_h264_qpel8_mc00_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc10_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc20_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc30_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc01_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc11_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc21_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc31_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc02_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc12_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc22_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc32_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc03_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc13_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc23_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); +void ff_avg_h264_qpel8_mc33_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride); + +av_cold void ff_h264qpel_init_arm(H264QpelContext *c, int bit_depth) +{ + const int high_bit_depth = bit_depth > 8; + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags) && !high_bit_depth) { + c->put_h264_qpel_pixels_tab[0][ 0] = ff_put_h264_qpel16_mc00_neon; + c->put_h264_qpel_pixels_tab[0][ 1] = ff_put_h264_qpel16_mc10_neon; + c->put_h264_qpel_pixels_tab[0][ 2] = ff_put_h264_qpel16_mc20_neon; + c->put_h264_qpel_pixels_tab[0][ 3] = ff_put_h264_qpel16_mc30_neon; + c->put_h264_qpel_pixels_tab[0][ 4] = ff_put_h264_qpel16_mc01_neon; + c->put_h264_qpel_pixels_tab[0][ 5] = ff_put_h264_qpel16_mc11_neon; + c->put_h264_qpel_pixels_tab[0][ 6] = ff_put_h264_qpel16_mc21_neon; + c->put_h264_qpel_pixels_tab[0][ 7] = ff_put_h264_qpel16_mc31_neon; + c->put_h264_qpel_pixels_tab[0][ 8] = ff_put_h264_qpel16_mc02_neon; + c->put_h264_qpel_pixels_tab[0][ 9] = ff_put_h264_qpel16_mc12_neon; + c->put_h264_qpel_pixels_tab[0][10] = ff_put_h264_qpel16_mc22_neon; + c->put_h264_qpel_pixels_tab[0][11] = ff_put_h264_qpel16_mc32_neon; + c->put_h264_qpel_pixels_tab[0][12] = ff_put_h264_qpel16_mc03_neon; + c->put_h264_qpel_pixels_tab[0][13] = ff_put_h264_qpel16_mc13_neon; + c->put_h264_qpel_pixels_tab[0][14] = ff_put_h264_qpel16_mc23_neon; + c->put_h264_qpel_pixels_tab[0][15] = ff_put_h264_qpel16_mc33_neon; + + c->put_h264_qpel_pixels_tab[1][ 0] = ff_put_h264_qpel8_mc00_neon; + c->put_h264_qpel_pixels_tab[1][ 1] = ff_put_h264_qpel8_mc10_neon; + c->put_h264_qpel_pixels_tab[1][ 2] = ff_put_h264_qpel8_mc20_neon; + c->put_h264_qpel_pixels_tab[1][ 3] = ff_put_h264_qpel8_mc30_neon; + c->put_h264_qpel_pixels_tab[1][ 4] = ff_put_h264_qpel8_mc01_neon; + c->put_h264_qpel_pixels_tab[1][ 5] = ff_put_h264_qpel8_mc11_neon; + c->put_h264_qpel_pixels_tab[1][ 6] = ff_put_h264_qpel8_mc21_neon; + c->put_h264_qpel_pixels_tab[1][ 7] = ff_put_h264_qpel8_mc31_neon; + c->put_h264_qpel_pixels_tab[1][ 8] = ff_put_h264_qpel8_mc02_neon; + c->put_h264_qpel_pixels_tab[1][ 9] = ff_put_h264_qpel8_mc12_neon; + c->put_h264_qpel_pixels_tab[1][10] = ff_put_h264_qpel8_mc22_neon; + c->put_h264_qpel_pixels_tab[1][11] = ff_put_h264_qpel8_mc32_neon; + c->put_h264_qpel_pixels_tab[1][12] = ff_put_h264_qpel8_mc03_neon; + c->put_h264_qpel_pixels_tab[1][13] = ff_put_h264_qpel8_mc13_neon; + c->put_h264_qpel_pixels_tab[1][14] = ff_put_h264_qpel8_mc23_neon; + c->put_h264_qpel_pixels_tab[1][15] = ff_put_h264_qpel8_mc33_neon; + + c->avg_h264_qpel_pixels_tab[0][ 0] = ff_avg_h264_qpel16_mc00_neon; + c->avg_h264_qpel_pixels_tab[0][ 1] = ff_avg_h264_qpel16_mc10_neon; + c->avg_h264_qpel_pixels_tab[0][ 2] = ff_avg_h264_qpel16_mc20_neon; + c->avg_h264_qpel_pixels_tab[0][ 3] = ff_avg_h264_qpel16_mc30_neon; + c->avg_h264_qpel_pixels_tab[0][ 4] = ff_avg_h264_qpel16_mc01_neon; + c->avg_h264_qpel_pixels_tab[0][ 5] = ff_avg_h264_qpel16_mc11_neon; + c->avg_h264_qpel_pixels_tab[0][ 6] = ff_avg_h264_qpel16_mc21_neon; + c->avg_h264_qpel_pixels_tab[0][ 7] = ff_avg_h264_qpel16_mc31_neon; + c->avg_h264_qpel_pixels_tab[0][ 8] = ff_avg_h264_qpel16_mc02_neon; + c->avg_h264_qpel_pixels_tab[0][ 9] = ff_avg_h264_qpel16_mc12_neon; + c->avg_h264_qpel_pixels_tab[0][10] = ff_avg_h264_qpel16_mc22_neon; + c->avg_h264_qpel_pixels_tab[0][11] = ff_avg_h264_qpel16_mc32_neon; + c->avg_h264_qpel_pixels_tab[0][12] = ff_avg_h264_qpel16_mc03_neon; + c->avg_h264_qpel_pixels_tab[0][13] = ff_avg_h264_qpel16_mc13_neon; + c->avg_h264_qpel_pixels_tab[0][14] = ff_avg_h264_qpel16_mc23_neon; + c->avg_h264_qpel_pixels_tab[0][15] = ff_avg_h264_qpel16_mc33_neon; + + c->avg_h264_qpel_pixels_tab[1][ 0] = ff_avg_h264_qpel8_mc00_neon; + c->avg_h264_qpel_pixels_tab[1][ 1] = ff_avg_h264_qpel8_mc10_neon; + c->avg_h264_qpel_pixels_tab[1][ 2] = ff_avg_h264_qpel8_mc20_neon; + c->avg_h264_qpel_pixels_tab[1][ 3] = ff_avg_h264_qpel8_mc30_neon; + c->avg_h264_qpel_pixels_tab[1][ 4] = ff_avg_h264_qpel8_mc01_neon; + c->avg_h264_qpel_pixels_tab[1][ 5] = ff_avg_h264_qpel8_mc11_neon; + c->avg_h264_qpel_pixels_tab[1][ 6] = ff_avg_h264_qpel8_mc21_neon; + c->avg_h264_qpel_pixels_tab[1][ 7] = ff_avg_h264_qpel8_mc31_neon; + c->avg_h264_qpel_pixels_tab[1][ 8] = ff_avg_h264_qpel8_mc02_neon; + c->avg_h264_qpel_pixels_tab[1][ 9] = ff_avg_h264_qpel8_mc12_neon; + c->avg_h264_qpel_pixels_tab[1][10] = ff_avg_h264_qpel8_mc22_neon; + c->avg_h264_qpel_pixels_tab[1][11] = ff_avg_h264_qpel8_mc32_neon; + c->avg_h264_qpel_pixels_tab[1][12] = ff_avg_h264_qpel8_mc03_neon; + c->avg_h264_qpel_pixels_tab[1][13] = ff_avg_h264_qpel8_mc13_neon; + c->avg_h264_qpel_pixels_tab[1][14] = ff_avg_h264_qpel8_mc23_neon; + c->avg_h264_qpel_pixels_tab[1][15] = ff_avg_h264_qpel8_mc33_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_arm.h new file mode 100644 index 0000000000..47cdfa574d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_HEVCDSP_ARM_H +#define AVCODEC_ARM_HEVCDSP_ARM_H + +#include "libavcodec/hevcdsp.h" + +void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth); + +#endif /* AVCODEC_ARM_HEVCDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_init_arm.c new file mode 100644 index 0000000000..e8fa1f79ac --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_init_arm.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014 Seppo Tomperi + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/hevcdsp.h" +#include "hevcdsp_arm.h" + +av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + ff_hevc_dsp_init_neon(c, bit_depth); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_init_neon.c new file mode 100644 index 0000000000..201a088dac --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hevcdsp_init_neon.c @@ -0,0 +1,320 @@ +/* + * Copyright (c) 2014 Seppo Tomperi + * + * 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/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/hevcdsp.h" +#include "libavcodec/avcodec.h" +#include "hevcdsp_arm.h" + +void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, + ptrdiff_t stride_dst, ptrdiff_t stride_src, + int16_t *sao_offset_val, int sao_left_class, + int width, int height); +void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, + int eo, int width, int height); + +void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_h_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q); +void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_32x32_8_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_idct_32x32_10_neon(int16_t *coeffs, int col_limit); +void ff_hevc_transform_luma_4x4_neon_8(int16_t *coeffs); + +#define PUT_PIXELS(name) \ + void name(int16_t *dst, uint8_t *src, \ + ptrdiff_t srcstride, int height, \ + intptr_t mx, intptr_t my, int width) +PUT_PIXELS(ff_hevc_put_pixels_w2_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w4_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w6_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w8_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w12_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w16_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w24_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); +PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); +#undef PUT_PIXELS + +static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int height, int width); +static void (*put_hevc_qpel_uw_neon[4][4])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, + int width, int height, int16_t* src2, ptrdiff_t src2stride); +void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width); +void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width); +void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int16_t *src2, + int height, intptr_t mx, intptr_t my, int width); +#define QPEL_FUNC(name) \ + void name(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, \ + int height, int width) + +QPEL_FUNC(ff_hevc_put_qpel_v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_v3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h1v3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h2v3_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3v1_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3v2_neon_8); +QPEL_FUNC(ff_hevc_put_qpel_h3v3_neon_8); +#undef QPEL_FUNC + +#define QPEL_FUNC_UW_PIX(name) \ + void name(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, \ + int height, intptr_t mx, intptr_t my, int width); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w4_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w8_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w16_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w24_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w32_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w48_neon_8); +QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w64_neon_8); +#undef QPEL_FUNC_UW_PIX + +#define QPEL_FUNC_UW(name) \ + void name(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, \ + int width, int height, int16_t* src2, ptrdiff_t src2stride); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_pixels_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h1v3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h2v3_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v1_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8); +QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8); +#undef QPEL_FUNC_UW + +void ff_hevc_sao_band_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height, int16_t *offset_table); + +void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, + ptrdiff_t stride_dst, ptrdiff_t stride_src, + int16_t *sao_offset_val, int sao_left_class, + int width, int height) { + uint8_t *dst = _dst; + uint8_t *src = _src; + int16_t offset_table[32] = {0}; + int k; + + for (k = 0; k < 4; k++) { + offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; + } + + ff_hevc_sao_band_filter_neon_8(dst, src, stride_dst, stride_src, width, height, offset_table); +} + +void ff_hevc_sao_edge_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height, + int a_stride, int b_stride, int16_t *sao_offset_val, uint8_t *edge_idx); + +void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, + int eo, int width, int height) { + static uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; + static const int8_t pos[4][2][2] = { + { { -1, 0 }, { 1, 0 } }, // horizontal + { { 0, -1 }, { 0, 1 } }, // vertical + { { -1, -1 }, { 1, 1 } }, // 45 degree + { { 1, -1 }, { -1, 1 } }, // 135 degree + }; + uint8_t *dst = _dst; + uint8_t *src = _src; + int a_stride, b_stride; + ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); + + a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; + b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; + + ff_hevc_sao_edge_filter_neon_8(dst, src, stride_dst, stride_src, width, height, a_stride, b_stride, sao_offset_val, edge_idx); +} + +void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width) { + + put_hevc_qpel_neon[my][mx](dst, MAX_PB_SIZE, src, srcstride, height, width); +} + +void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width) { + + put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, NULL, 0); +} + +void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, + int16_t *src2, + int height, intptr_t mx, intptr_t my, int width) { + put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE); +} + +av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth) +{ + if (bit_depth == 8) { + int x; + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_neon; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_neon; + c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_neon; + c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_neon; + c->sao_band_filter[0] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[1] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[2] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[3] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_band_filter[4] = ff_hevc_sao_band_filter_neon_8_wrapper; + c->sao_edge_filter[0] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[1] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[2] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[3] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->sao_edge_filter[4] = ff_hevc_sao_edge_filter_neon_8_wrapper; + c->add_residual[0] = ff_hevc_add_residual_4x4_8_neon; + c->add_residual[1] = ff_hevc_add_residual_8x8_8_neon; + c->add_residual[2] = ff_hevc_add_residual_16x16_8_neon; + c->add_residual[3] = ff_hevc_add_residual_32x32_8_neon; + c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon; + 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->idct[0] = ff_hevc_idct_4x4_8_neon; + c->idct[1] = ff_hevc_idct_8x8_8_neon; + c->idct[2] = ff_hevc_idct_16x16_8_neon; + c->idct[3] = ff_hevc_idct_32x32_8_neon; + c->transform_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; + put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; + put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; + put_hevc_qpel_neon[3][0] = ff_hevc_put_qpel_v3_neon_8; + put_hevc_qpel_neon[0][1] = ff_hevc_put_qpel_h1_neon_8; + put_hevc_qpel_neon[0][2] = ff_hevc_put_qpel_h2_neon_8; + put_hevc_qpel_neon[0][3] = ff_hevc_put_qpel_h3_neon_8; + put_hevc_qpel_neon[1][1] = ff_hevc_put_qpel_h1v1_neon_8; + put_hevc_qpel_neon[1][2] = ff_hevc_put_qpel_h2v1_neon_8; + put_hevc_qpel_neon[1][3] = ff_hevc_put_qpel_h3v1_neon_8; + put_hevc_qpel_neon[2][1] = ff_hevc_put_qpel_h1v2_neon_8; + put_hevc_qpel_neon[2][2] = ff_hevc_put_qpel_h2v2_neon_8; + put_hevc_qpel_neon[2][3] = ff_hevc_put_qpel_h3v2_neon_8; + put_hevc_qpel_neon[3][1] = ff_hevc_put_qpel_h1v3_neon_8; + put_hevc_qpel_neon[3][2] = ff_hevc_put_qpel_h2v3_neon_8; + put_hevc_qpel_neon[3][3] = ff_hevc_put_qpel_h3v3_neon_8; + put_hevc_qpel_uw_neon[1][0] = ff_hevc_put_qpel_uw_v1_neon_8; + put_hevc_qpel_uw_neon[2][0] = ff_hevc_put_qpel_uw_v2_neon_8; + put_hevc_qpel_uw_neon[3][0] = ff_hevc_put_qpel_uw_v3_neon_8; + put_hevc_qpel_uw_neon[0][1] = ff_hevc_put_qpel_uw_h1_neon_8; + put_hevc_qpel_uw_neon[0][2] = ff_hevc_put_qpel_uw_h2_neon_8; + put_hevc_qpel_uw_neon[0][3] = ff_hevc_put_qpel_uw_h3_neon_8; + put_hevc_qpel_uw_neon[1][1] = ff_hevc_put_qpel_uw_h1v1_neon_8; + put_hevc_qpel_uw_neon[1][2] = ff_hevc_put_qpel_uw_h2v1_neon_8; + put_hevc_qpel_uw_neon[1][3] = ff_hevc_put_qpel_uw_h3v1_neon_8; + put_hevc_qpel_uw_neon[2][1] = ff_hevc_put_qpel_uw_h1v2_neon_8; + put_hevc_qpel_uw_neon[2][2] = ff_hevc_put_qpel_uw_h2v2_neon_8; + put_hevc_qpel_uw_neon[2][3] = ff_hevc_put_qpel_uw_h3v2_neon_8; + 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++) { + 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; + c->put_hevc_qpel_uni[x][1][0] = ff_hevc_put_qpel_uni_neon_wrapper; + c->put_hevc_qpel_uni[x][0][1] = ff_hevc_put_qpel_uni_neon_wrapper; + c->put_hevc_qpel_uni[x][1][1] = ff_hevc_put_qpel_uni_neon_wrapper; + c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; + c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; + c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; + } + c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; + c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; + c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; + c->put_hevc_qpel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; + c->put_hevc_qpel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; + c->put_hevc_qpel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; + c->put_hevc_qpel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; + c->put_hevc_qpel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; + c->put_hevc_qpel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; + c->put_hevc_qpel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; + + c->put_hevc_qpel_uni[1][0][0] = ff_hevc_put_qpel_uw_pixels_w4_neon_8; + c->put_hevc_qpel_uni[3][0][0] = ff_hevc_put_qpel_uw_pixels_w8_neon_8; + c->put_hevc_qpel_uni[5][0][0] = ff_hevc_put_qpel_uw_pixels_w16_neon_8; + c->put_hevc_qpel_uni[6][0][0] = ff_hevc_put_qpel_uw_pixels_w24_neon_8; + c->put_hevc_qpel_uni[7][0][0] = ff_hevc_put_qpel_uw_pixels_w32_neon_8; + c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8; + c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8; + } + + if (bit_depth == 10) { + c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon; + c->add_residual[1] = ff_hevc_add_residual_8x8_10_neon; + c->add_residual[2] = ff_hevc_add_residual_16x16_10_neon; + c->add_residual[3] = ff_hevc_add_residual_32x32_10_neon; + + c->idct_dc[0] = ff_hevc_idct_4x4_dc_10_neon; + c->idct_dc[1] = ff_hevc_idct_8x8_dc_10_neon; + c->idct_dc[2] = ff_hevc_idct_16x16_dc_10_neon; + c->idct_dc[3] = ff_hevc_idct_32x32_dc_10_neon; + + c->idct[0] = ff_hevc_idct_4x4_10_neon; + c->idct[1] = ff_hevc_idct_8x8_10_neon; + c->idct[2] = ff_hevc_idct_16x16_10_neon; + c->idct[3] = ff_hevc_idct_32x32_10_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_arm.h new file mode 100644 index 0000000000..5f3c7741c1 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_arm.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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_ARM_HPELDSP_ARM_H +#define AVCODEC_ARM_HPELDSP_ARM_H + +#include "libavcodec/hpeldsp.h" + +void ff_hpeldsp_init_armv6(HpelDSPContext *c, int flags); +void ff_hpeldsp_init_neon(HpelDSPContext *c, int flags); + +#endif /* AVCODEC_ARM_HPELDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_arm.c new file mode 100644 index 0000000000..1977b1379b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_arm.c @@ -0,0 +1,71 @@ +/* + * ARM-optimized halfpel functions + * Copyright (c) 2001 Lionel Ulmer + * + * 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/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/pixels.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +void ff_put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +void ff_put_pixels16_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +CALL_2X_PIXELS(ff_put_pixels16_x2_arm, ff_put_pixels8_x2_arm, 8) +CALL_2X_PIXELS(ff_put_pixels16_y2_arm, ff_put_pixels8_y2_arm, 8) +CALL_2X_PIXELS(ff_put_pixels16_xy2_arm, ff_put_pixels8_xy2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_x2_arm, ff_put_no_rnd_pixels8_x2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm, ff_put_no_rnd_pixels8_y2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8) + +av_cold void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags) +{ + int cpu_flags = av_get_cpu_flags(); + + c->put_pixels_tab[0][0] = ff_put_pixels16_arm; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm; + c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_arm; + c->put_pixels_tab[1][0] = ff_put_pixels8_arm; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_arm; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_arm; + c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_arm; + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_arm; + c->put_no_rnd_pixels_tab[0][1] = ff_put_no_rnd_pixels16_x2_arm; + c->put_no_rnd_pixels_tab[0][2] = ff_put_no_rnd_pixels16_y2_arm; + c->put_no_rnd_pixels_tab[0][3] = ff_put_no_rnd_pixels16_xy2_arm; + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_arm; + c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_arm; + c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_arm; + c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm; + + if (have_armv6(cpu_flags)) + ff_hpeldsp_init_armv6(c, flags); + if (have_neon(cpu_flags)) + ff_hpeldsp_init_neon(c, flags); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_armv6.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_armv6.c new file mode 100644 index 0000000000..967a8e0427 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_armv6.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels16_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels16_x2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels16_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels8_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels8_x2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels8_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +av_cold void ff_hpeldsp_init_armv6(HpelDSPContext *c, int flags) +{ + c->put_pixels_tab[0][0] = ff_put_pixels16_armv6; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_armv6; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_armv6; +/* c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_armv6; */ + c->put_pixels_tab[1][0] = ff_put_pixels8_armv6; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_armv6; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_armv6; +/* c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_armv6; */ + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_armv6; + c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_armv6; + c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_armv6; +/* c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_armv6; */ + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_armv6; + c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_armv6; + c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_armv6; +/* c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_armv6; */ + + c->avg_pixels_tab[0][0] = ff_avg_pixels16_armv6; + c->avg_pixels_tab[1][0] = ff_avg_pixels8_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_neon.c new file mode 100644 index 0000000000..d9feadd1dd --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/hpeldsp_init_neon.c @@ -0,0 +1,88 @@ +/* + * ARM NEON optimised DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels16_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels16_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); + +av_cold void ff_hpeldsp_init_neon(HpelDSPContext *c, int flags) +{ + c->put_pixels_tab[0][0] = ff_put_pixels16_neon; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_neon; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_neon; + c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_neon; + c->put_pixels_tab[1][0] = ff_put_pixels8_neon; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_neon; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_neon; + c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_neon; + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_neon; + c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_neon; + c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_neon; + c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_neon; + c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_neon; + + c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon; + c->avg_pixels_tab[0][1] = ff_avg_pixels16_x2_neon; + c->avg_pixels_tab[0][2] = ff_avg_pixels16_y2_neon; + c->avg_pixels_tab[0][3] = ff_avg_pixels16_xy2_neon; + c->avg_pixels_tab[1][0] = ff_avg_pixels8_neon; + c->avg_pixels_tab[1][1] = ff_avg_pixels8_x2_neon; + c->avg_pixels_tab[1][2] = ff_avg_pixels8_y2_neon; + c->avg_pixels_tab[1][3] = ff_avg_pixels8_xy2_neon; + + c->avg_no_rnd_pixels_tab[0] = ff_avg_pixels16_neon; + c->avg_no_rnd_pixels_tab[1] = ff_avg_pixels16_x2_no_rnd_neon; + c->avg_no_rnd_pixels_tab[2] = ff_avg_pixels16_y2_no_rnd_neon; + c->avg_no_rnd_pixels_tab[3] = ff_avg_pixels16_xy2_no_rnd_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idct.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idct.h new file mode 100644 index 0000000000..6c79a69c5f --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idct.h @@ -0,0 +1,41 @@ +/* + * 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_ARM_IDCT_H +#define AVCODEC_ARM_IDCT_H + +#include +#include + +void ff_j_rev_dct_arm(int16_t *data); + +void ff_simple_idct_arm(int16_t *data); + +void ff_simple_idct_armv5te(int16_t *data); +void ff_simple_idct_put_armv5te(uint8_t *dest, ptrdiff_t line_size, int16_t *data); +void ff_simple_idct_add_armv5te(uint8_t *dest, ptrdiff_t line_size, int16_t *data); + +void ff_simple_idct_armv6(int16_t *data); +void ff_simple_idct_put_armv6(uint8_t *dest, ptrdiff_t line_size, int16_t *data); +void ff_simple_idct_add_armv6(uint8_t *dest, ptrdiff_t line_size, int16_t *data); + +void ff_simple_idct_neon(int16_t *data); +void ff_simple_idct_put_neon(uint8_t *dest, ptrdiff_t line_size, int16_t *data); +void ff_simple_idct_add_neon(uint8_t *dest, ptrdiff_t line_size, int16_t *data); + +#endif /* AVCODEC_ARM_IDCT_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_arm.h new file mode 100644 index 0000000000..d7bc5cd02a --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_arm.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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_ARM_IDCTDSP_ARM_H +#define AVCODEC_ARM_IDCTDSP_ARM_H + +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" + +void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); +void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); +void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth); + +#endif /* AVCODEC_ARM_IDCTDSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_arm.c new file mode 100644 index 0000000000..ebc90e4b49 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_arm.c @@ -0,0 +1,94 @@ +/* + * ARM-optimized IDCT functions + * Copyright (c) 2001 Lionel Ulmer + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest, + ptrdiff_t line_size); + +/* XXX: those functions should be suppressed ASAP when all IDCTs are + * converted */ +static void j_rev_dct_arm_put(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_j_rev_dct_arm(block); + ff_put_pixels_clamped_c(block, dest, line_size); +} + +static void j_rev_dct_arm_add(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_j_rev_dct_arm(block); + ff_add_pixels_clamped_arm(block, dest, line_size); +} + +static void simple_idct_arm_put(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_simple_idct_arm(block); + ff_put_pixels_clamped_c(block, dest, line_size); +} + +static void simple_idct_arm_add(uint8_t *dest, ptrdiff_t line_size, + int16_t *block) +{ + ff_simple_idct_arm(block); + ff_add_pixels_clamped_arm(block, dest, line_size); +} + +av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + + if (!avctx->lowres && !high_bit_depth) { + if ((avctx->idct_algo == FF_IDCT_AUTO && !(avctx->flags & AV_CODEC_FLAG_BITEXACT)) || + avctx->idct_algo == FF_IDCT_ARM) { + c->idct_put = j_rev_dct_arm_put; + c->idct_add = j_rev_dct_arm_add; + c->idct = ff_j_rev_dct_arm; + c->perm_type = FF_IDCT_PERM_LIBMPEG2; + } else if (avctx->idct_algo == FF_IDCT_SIMPLEARM) { + c->idct_put = simple_idct_arm_put; + c->idct_add = simple_idct_arm_add; + c->idct = ff_simple_idct_arm; + c->perm_type = FF_IDCT_PERM_NONE; + } + } + + c->add_pixels_clamped = ff_add_pixels_clamped_arm; + + if (have_armv5te(cpu_flags)) + ff_idctdsp_init_armv5te(c, avctx, high_bit_depth); + if (have_armv6(cpu_flags)) + ff_idctdsp_init_armv6(c, avctx, high_bit_depth); + if (have_neon(cpu_flags)) + ff_idctdsp_init_neon(c, avctx, high_bit_depth); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_armv5te.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_armv5te.c new file mode 100644 index 0000000000..3d881e1f18 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_armv5te.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +av_cold void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + if (!avctx->lowres && !high_bit_depth && + (avctx->idct_algo == FF_IDCT_AUTO || + avctx->idct_algo == FF_IDCT_SIMPLEAUTO || + avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { + c->idct_put = ff_simple_idct_put_armv5te; + c->idct_add = ff_simple_idct_add_armv5te; + c->idct = ff_simple_idct_armv5te; + c->perm_type = FF_IDCT_PERM_NONE; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_armv6.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_armv6.c new file mode 100644 index 0000000000..edf3070e15 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_armv6.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +void ff_add_pixels_clamped_armv6(const int16_t *block, uint8_t *pixels, + ptrdiff_t line_size); + +av_cold void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + if (!avctx->lowres && !high_bit_depth) { + if ((avctx->idct_algo == FF_IDCT_AUTO && !(avctx->flags & AV_CODEC_FLAG_BITEXACT)) || + avctx->idct_algo == FF_IDCT_SIMPLEARMV6) { + c->idct_put = ff_simple_idct_put_armv6; + c->idct_add = ff_simple_idct_add_armv6; + c->idct = ff_simple_idct_armv6; + c->perm_type = FF_IDCT_PERM_LIBMPEG2; + } + } + c->add_pixels_clamped = ff_add_pixels_clamped_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_neon.c new file mode 100644 index 0000000000..b70c5b0d44 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/idctdsp_init_neon.c @@ -0,0 +1,51 @@ +/* + * ARM-NEON-optimized IDCT functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/idctdsp.h" +#include "idct.h" +#include "idctdsp_arm.h" + +void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); +void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); +void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); + +av_cold void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) +{ + if (!avctx->lowres && !high_bit_depth) { + if (avctx->idct_algo == FF_IDCT_AUTO || + avctx->idct_algo == FF_IDCT_SIMPLEAUTO || + avctx->idct_algo == FF_IDCT_SIMPLENEON) { + c->idct_put = ff_simple_idct_put_neon; + c->idct_add = ff_simple_idct_add_neon; + c->idct = ff_simple_idct_neon; + c->perm_type = FF_IDCT_PERM_PARTTRANS; + } + } + + c->add_pixels_clamped = ff_add_pixels_clamped_neon; + c->put_pixels_clamped = ff_put_pixels_clamped_neon; + c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/lossless_audiodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/lossless_audiodsp_init_arm.c new file mode 100644 index 0000000000..981a39aff9 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/lossless_audiodsp_init_arm.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/lossless_audiodsp.h" + +int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2, + const int16_t *v3, int len, int mul); + +av_cold void ff_llauddsp_init_arm(LLAudDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mathops.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mathops.h new file mode 100644 index 0000000000..dc57c5571c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mathops.h @@ -0,0 +1,108 @@ +/* + * simple math operations + * Copyright (c) 2006 Michael Niedermayer et al + * + * 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_ARM_MATHOPS_H +#define AVCODEC_ARM_MATHOPS_H + +#include +#include "config.h" +#include "libavutil/common.h" + +#if HAVE_INLINE_ASM + +#if HAVE_ARMV6_INLINE +#define MULH MULH +static inline av_const int MULH(int a, int b) +{ + int r; + __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); + return r; +} + +#define FASTDIV FASTDIV +static av_always_inline av_const int FASTDIV(int a, int b) +{ + int r; + __asm__ ("cmp %2, #2 \n\t" + "ldr %0, [%3, %2, lsl #2] \n\t" + "ite le \n\t" + "lsrle %0, %1, #1 \n\t" + "smmulgt %0, %0, %1 \n\t" + : "=&r"(r) : "r"(a), "r"(b), "r"(ff_inverse) : "cc"); + return r; +} + +#else /* HAVE_ARMV6_INLINE */ + +#define FASTDIV FASTDIV +static av_always_inline av_const int FASTDIV(int a, int b) +{ + int r, t; + __asm__ ("umull %1, %0, %2, %3" + : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b])); + return r; +} +#endif + +#define MLS64(d, a, b) MAC64(d, -(a), b) + +#if HAVE_ARMV5TE_INLINE + +/* signed 16x16 -> 32 multiply add accumulate */ +# define MAC16(rt, ra, rb) \ + __asm__ ("smlabb %0, %1, %2, %0" : "+r"(rt) : "r"(ra), "r"(rb)); + +/* signed 16x16 -> 32 multiply */ +# define MUL16 MUL16 +static inline av_const int MUL16(int ra, int rb) +{ + int rt; + __asm__ ("smulbb %0, %1, %2" : "=r"(rt) : "r"(ra), "r"(rb)); + return rt; +} + +#endif + +#define mid_pred mid_pred +static inline av_const int mid_pred(int a, int b, int c) +{ + int m; + __asm__ ( + "mov %0, %2 \n\t" + "cmp %1, %2 \n\t" + "itt gt \n\t" + "movgt %0, %1 \n\t" + "movgt %1, %2 \n\t" + "cmp %1, %3 \n\t" + "it le \n\t" + "movle %1, %3 \n\t" + "cmp %0, %1 \n\t" + "it gt \n\t" + "movgt %0, %1 \n\t" + : "=&r"(m), "+r"(a) + : "r"(b), "r"(c) + : "cc"); + return m; +} + +#endif /* HAVE_INLINE_ASM */ + +#endif /* AVCODEC_ARM_MATHOPS_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/me_cmp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/me_cmp_init_arm.c new file mode 100644 index 0000000000..03870a2bfa --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/me_cmp_init_arm.c @@ -0,0 +1,57 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/me_cmp.h" +#include "libavcodec/mpegvideo.h" + +int ff_pix_abs16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); +int ff_pix_abs16_x2_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); +int ff_pix_abs16_y2_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); + +int ff_pix_abs8_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); + +int ff_sse16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); + +av_cold void ff_me_cmp_init_arm(MECmpContext *c, AVCodecContext *avctx) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + c->pix_abs[0][0] = ff_pix_abs16_armv6; + c->pix_abs[0][1] = ff_pix_abs16_x2_armv6; + c->pix_abs[0][2] = ff_pix_abs16_y2_armv6; + + c->pix_abs[1][0] = ff_pix_abs8_armv6; + + c->sad[0] = ff_pix_abs16_armv6; + c->sad[1] = ff_pix_abs8_armv6; + + c->sse[0] = ff_sse16_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mlpdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mlpdsp_init_arm.c new file mode 100644 index 0000000000..34a5f61e1d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mlpdsp_init_arm.c @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2014 RISC OS Open Ltd + * Author: Ben Avison + * + * 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 + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/mlpdsp.h" + +void ff_mlp_filter_channel_arm(int32_t *state, const int32_t *coeff, + int firorder, int iirorder, + unsigned int filter_shift, int32_t mask, + int blocksize, int32_t *sample_buffer); +void ff_mlp_rematrix_channel_arm(int32_t *samples, + const int32_t *coeffs, + const uint8_t *bypassed_lsbs, + const int8_t *noise_buffer, + int index, + unsigned int dest_ch, + uint16_t blockpos, + unsigned int maxchan, + int matrix_noise_shift, + int access_unit_size_pow2, + int32_t mask); + +#define DECLARE_PACK(order,channels,shift) \ + int32_t ff_mlp_pack_output_##order##order_##channels##ch_##shift##shift_armv6(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int); +#define ENUMERATE_PACK(order,channels,shift) \ + ff_mlp_pack_output_##order##order_##channels##ch_##shift##shift_armv6, +#define PACK_CHANNELS(macro,order,channels) \ + macro(order,channels,0) \ + macro(order,channels,1) \ + macro(order,channels,2) \ + macro(order,channels,3) \ + macro(order,channels,4) \ + macro(order,channels,5) \ + macro(order,channels,mixed) +#define PACK_ORDER(macro,order) \ + PACK_CHANNELS(macro,order,2) \ + PACK_CHANNELS(macro,order,6) \ + PACK_CHANNELS(macro,order,8) +#define PACK_ALL(macro) \ + PACK_ORDER(macro,outof) \ + PACK_ORDER(macro,in) +PACK_ALL(DECLARE_PACK) + +#define ff_mlp_pack_output_outoforder_2ch_mixedshift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_mixedshift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_mixedshift_armv6 0 +#if CONFIG_THUMB +#define ff_mlp_pack_output_outoforder_2ch_0shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_1shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_2shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_3shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_4shift_armv6 0 +#define ff_mlp_pack_output_outoforder_2ch_5shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_0shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_1shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_2shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_3shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_4shift_armv6 0 +#define ff_mlp_pack_output_outoforder_6ch_5shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_0shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_1shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_2shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_3shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_4shift_armv6 0 +#define ff_mlp_pack_output_outoforder_8ch_5shift_armv6 0 +#endif + +static int32_t (*mlp_select_pack_output_armv6(uint8_t *ch_assign, + int8_t *output_shift, + uint8_t max_matrix_channel, + int is32))(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int) +{ + int ch_index; + int shift = output_shift[0] < 0 || output_shift[0] > 5 ? 6 : output_shift[0]; + int inorder = 1; + static int32_t (*const routine[2*3*7])(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int) = { + PACK_ALL(ENUMERATE_PACK) + }; + int i; + + if (!is32) // don't support 16-bit output (it's not used by TrueHD) + return ff_mlp_pack_output; + + switch (max_matrix_channel) { + case 1: + ch_index = 0; + break; + case 5: + ch_index = 1; + break; + case 7: + ch_index = 2; + break; + default: + return ff_mlp_pack_output; + } + + for (i = 0; i <= max_matrix_channel; i++) { + if (shift != 6 && output_shift[i] != shift) + shift = 6; // indicate mixed shifts + if (ch_assign[i] != i) + inorder = 0; + } +#if CONFIG_THUMB + if (!inorder) + return ff_mlp_pack_output; // can't currently handle an order array except in ARM mode +#else + if (shift == 6 && !inorder) + return ff_mlp_pack_output; // can't currently handle both an order array and a shift array +#endif + + return routine[(inorder*3+ch_index)*7+shift]; +} + +av_cold void ff_mlpdsp_init_arm(MLPDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv5te(cpu_flags)) { + c->mlp_filter_channel = ff_mlp_filter_channel_arm; + c->mlp_rematrix_channel = ff_mlp_rematrix_channel_arm; + } + if (have_armv6(cpu_flags)) + c->mlp_select_pack_output = mlp_select_pack_output_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegaudiodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegaudiodsp_init_arm.c new file mode 100644 index 0000000000..d87bd27ad8 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegaudiodsp_init_arm.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/mpegaudiodsp.h" +#include "config.h" + +void ff_mpadsp_apply_window_fixed_armv6(int32_t *synth_buf, int32_t *window, + int *dither, int16_t *out, ptrdiff_t incr); + +av_cold void ff_mpadsp_init_arm(MPADSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + s->apply_window_fixed = ff_mpadsp_apply_window_fixed_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_arm.c new file mode 100644 index 0000000000..918be16d03 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_arm.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2002 Michael Niedermayer + * + * 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/internal.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/mpegvideo.h" +#include "mpegvideo_arm.h" +#include "asm-offsets.h" + +#if HAVE_NEON +AV_CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE); +AV_CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE); +AV_CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED); +AV_CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX); +AV_CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end, + INTER_SCANTAB_RASTER_END); +AV_CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC); +#endif + +void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block, + int n, int qscale); +void ff_dct_unquantize_h263_intra_neon(MpegEncContext *s, int16_t *block, + int n, int qscale); + +av_cold void ff_mpv_common_init_arm(MpegEncContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv5te(cpu_flags)) + ff_mpv_common_init_armv5te(s); + + if (have_neon(cpu_flags)) { + s->dct_unquantize_h263_intra = ff_dct_unquantize_h263_intra_neon; + s->dct_unquantize_h263_inter = ff_dct_unquantize_h263_inter_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_arm.h new file mode 100644 index 0000000000..709ae6b247 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_arm.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_MPEGVIDEO_ARM_H +#define AVCODEC_ARM_MPEGVIDEO_ARM_H + +#include "libavcodec/mpegvideo.h" + +void ff_mpv_common_init_armv5te(MpegEncContext *s); + +#endif /* AVCODEC_ARM_MPEGVIDEO_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_armv5te.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_armv5te.c new file mode 100644 index 0000000000..e20bb4c645 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideo_armv5te.c @@ -0,0 +1,102 @@ +/* + * Optimization of some functions from mpegvideo.c for armv5te + * Copyright (c) 2007 Siarhei Siamashka + * + * 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/attributes.h" +#include "libavutil/avassert.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/mpegvideo.h" +#include "mpegvideo_arm.h" + +void ff_dct_unquantize_h263_armv5te(int16_t *block, int qmul, int qadd, int count); + +#ifdef ENABLE_ARM_TESTS +/** + * H.263 dequantizer supplementary function, it is performance critical and needs to + * have optimized implementations for each architecture. Is also used as a reference + * implementation in regression tests + */ +static inline void dct_unquantize_h263_helper_c(int16_t *block, int qmul, int qadd, int count) +{ + int i, level; + for (i = 0; i < count; i++) { + level = block[i]; + if (level) { + if (level < 0) { + level = level * qmul - qadd; + } else { + level = level * qmul + qadd; + } + block[i] = level; + } + } +} +#endif + +static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s, + int16_t *block, int n, int qscale) +{ + int level, qmul, qadd; + int nCoeffs; + + av_assert2(s->block_last_index[n]>=0); + + qmul = qscale << 1; + + if (!s->h263_aic) { + if (n < 4) + level = block[0] * s->y_dc_scale; + else + level = block[0] * s->c_dc_scale; + qadd = (qscale - 1) | 1; + }else{ + qadd = 0; + level = block[0]; + } + if(s->ac_pred) + nCoeffs=63; + else + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); + block[0] = level; +} + +static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s, + int16_t *block, int n, int qscale) +{ + int qmul, qadd; + int nCoeffs; + + av_assert2(s->block_last_index[n]>=0); + + qadd = (qscale - 1) | 1; + qmul = qscale << 1; + + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); +} + +av_cold void ff_mpv_common_init_armv5te(MpegEncContext *s) +{ + s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te; + s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideoencdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideoencdsp_init_arm.c new file mode 100644 index 0000000000..4bfe835684 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/mpegvideoencdsp_init_arm.c @@ -0,0 +1,38 @@ +/* + * 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 + +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/mpegvideoencdsp.h" + +int ff_pix_norm1_armv6(uint8_t *pix, int line_size); +int ff_pix_sum_armv6(uint8_t *pix, int line_size); + +av_cold void ff_mpegvideoencdsp_init_arm(MpegvideoEncDSPContext *c, + AVCodecContext *avctx) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + c->pix_norm1 = ff_pix_norm1_armv6; + c->pix_sum = ff_pix_sum_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/neontest.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/neontest.c new file mode 100644 index 0000000000..f9c0dbf12e --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/neontest.c @@ -0,0 +1,99 @@ +/* + * check NEON registers for clobbers + * Copyright (c) 2013 Martin Storsjo + * + * 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 "libavcodec/avcodec.h" +#include "libavutil/arm/neontest.h" + +wrap(avcodec_open2(AVCodecContext *avctx, + const AVCodec *codec, + AVDictionary **options)) +{ + testneonclobbers(avcodec_open2, avctx, codec, options); +} + +wrap(avcodec_decode_audio4(AVCodecContext *avctx, + AVFrame *frame, + int *got_frame_ptr, + AVPacket *avpkt)) +{ + testneonclobbers(avcodec_decode_audio4, avctx, frame, + got_frame_ptr, avpkt); +} + +wrap(avcodec_decode_video2(AVCodecContext *avctx, + AVFrame *picture, + int *got_picture_ptr, + AVPacket *avpkt)) +{ + testneonclobbers(avcodec_decode_video2, avctx, picture, + got_picture_ptr, avpkt); +} + +wrap(avcodec_decode_subtitle2(AVCodecContext *avctx, + AVSubtitle *sub, + int *got_sub_ptr, + AVPacket *avpkt)) +{ + testneonclobbers(avcodec_decode_subtitle2, avctx, sub, + got_sub_ptr, avpkt); +} + +wrap(avcodec_encode_audio2(AVCodecContext *avctx, + AVPacket *avpkt, + const AVFrame *frame, + int *got_packet_ptr)) +{ + testneonclobbers(avcodec_encode_audio2, avctx, avpkt, frame, + got_packet_ptr); +} + +wrap(avcodec_encode_subtitle(AVCodecContext *avctx, + uint8_t *buf, int buf_size, + const AVSubtitle *sub)) +{ + testneonclobbers(avcodec_encode_subtitle, avctx, buf, buf_size, sub); +} + +wrap(avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr)) +{ + testneonclobbers(avcodec_encode_video2, avctx, avpkt, frame, got_packet_ptr); +} + +wrap(avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)) +{ + testneonclobbers(avcodec_send_packet, avctx, avpkt); +} + +wrap(avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)) +{ + testneonclobbers(avcodec_receive_packet, avctx, avpkt); +} + +wrap(avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)) +{ + testneonclobbers(avcodec_send_frame, avctx, frame); +} + +wrap(avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)) +{ + testneonclobbers(avcodec_receive_frame, avctx, frame); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/pixblockdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/pixblockdsp_init_arm.c new file mode 100644 index 0000000000..59d2b49381 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/pixblockdsp_init_arm.c @@ -0,0 +1,43 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/pixblockdsp.h" + +void ff_get_pixels_armv6(int16_t *block, const uint8_t *pixels, + ptrdiff_t stride); +void ff_diff_pixels_armv6(int16_t *block, const uint8_t *s1, + const uint8_t *s2, ptrdiff_t stride); + +av_cold void ff_pixblockdsp_init_arm(PixblockDSPContext *c, + AVCodecContext *avctx, + unsigned high_bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + if (!high_bit_depth) + c->get_pixels = ff_get_pixels_armv6; + c->diff_pixels = ff_diff_pixels_armv6; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rdft_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rdft_init_arm.c new file mode 100644 index 0000000000..1c5d8beb61 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rdft_init_arm.c @@ -0,0 +1,33 @@ +/* + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/rdft.h" + +void ff_rdft_calc_neon(struct RDFTContext *s, FFTSample *z); + +av_cold void ff_rdft_init_arm(RDFTContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + s->rdft_calc = ff_rdft_calc_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rv34dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rv34dsp_init_arm.c new file mode 100644 index 0000000000..8bfe90b3d3 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rv34dsp_init_arm.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2011 Janne Grunau + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/rv34dsp.h" +#include "libavutil/arm/cpu.h" + +void ff_rv34_inv_transform_noround_neon(int16_t *block); + +void ff_rv34_inv_transform_noround_dc_neon(int16_t *block); + +void ff_rv34_idct_add_neon(uint8_t *dst, ptrdiff_t stride, int16_t *block); +void ff_rv34_idct_dc_add_neon(uint8_t *dst, ptrdiff_t stride, int dc); + +av_cold void ff_rv34dsp_init_arm(RV34DSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->rv34_inv_transform = ff_rv34_inv_transform_noround_neon; + c->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon; + + c->rv34_idct_add = ff_rv34_idct_add_neon; + c->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rv40dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rv40dsp_init_arm.c new file mode 100644 index 0000000000..c24854d1cd --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/rv40dsp_init_arm.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2011 Janne Grunau + * + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/rv34dsp.h" +#include "libavutil/arm/cpu.h" + +#define DECL_QPEL3(type, w, pos) \ +void ff_ ## type ## _rv40_qpel ## w ## _mc ## pos ## _neon(uint8_t *dst, \ + const uint8_t *src, \ + ptrdiff_t stride) + +#define DECL_QPEL2(w, pos) \ + DECL_QPEL3(put, w, pos); \ + DECL_QPEL3(avg, w, pos) + +#define DECL_QPEL_XY(x, y) \ + DECL_QPEL2(16, x ## y); \ + DECL_QPEL2(8, x ## y) + +#define DECL_QPEL_Y(y) \ + DECL_QPEL_XY(0, y); \ + DECL_QPEL_XY(1, y); \ + DECL_QPEL_XY(2, y); \ + DECL_QPEL_XY(3, y); \ + +DECL_QPEL_Y(0); +DECL_QPEL_Y(1); +DECL_QPEL_Y(2); +DECL_QPEL_Y(3); + +void ff_put_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int); +void ff_put_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int); + +void ff_avg_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int); +void ff_avg_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int); + +void ff_rv40_weight_func_16_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t); +void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t); + +int ff_rv40_h_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride, + int beta, int beta2, int edge, + int *p1, int *q1); +int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride, + int beta, int beta2, int edge, + int *p1, int *q1); + +void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1, + int filter_q1, int alpha, int beta, + int lim_p0q0, int lim_q1, int lim_p1); +void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1, + int filter_q1, int alpha, int beta, + int lim_p0q0, int lim_q1, int lim_p1); + +static av_cold void rv40dsp_init_neon(RV34DSPContext *c) +{ + c->put_pixels_tab[0][ 1] = ff_put_rv40_qpel16_mc10_neon; + c->put_pixels_tab[0][ 3] = ff_put_rv40_qpel16_mc30_neon; + c->put_pixels_tab[0][ 4] = ff_put_rv40_qpel16_mc01_neon; + c->put_pixels_tab[0][ 5] = ff_put_rv40_qpel16_mc11_neon; + c->put_pixels_tab[0][ 6] = ff_put_rv40_qpel16_mc21_neon; + c->put_pixels_tab[0][ 7] = ff_put_rv40_qpel16_mc31_neon; + c->put_pixels_tab[0][ 9] = ff_put_rv40_qpel16_mc12_neon; + c->put_pixels_tab[0][10] = ff_put_rv40_qpel16_mc22_neon; + c->put_pixels_tab[0][11] = ff_put_rv40_qpel16_mc32_neon; + c->put_pixels_tab[0][12] = ff_put_rv40_qpel16_mc03_neon; + c->put_pixels_tab[0][13] = ff_put_rv40_qpel16_mc13_neon; + c->put_pixels_tab[0][14] = ff_put_rv40_qpel16_mc23_neon; + c->put_pixels_tab[0][15] = ff_put_rv40_qpel16_mc33_neon; + c->avg_pixels_tab[0][ 1] = ff_avg_rv40_qpel16_mc10_neon; + c->avg_pixels_tab[0][ 3] = ff_avg_rv40_qpel16_mc30_neon; + c->avg_pixels_tab[0][ 4] = ff_avg_rv40_qpel16_mc01_neon; + c->avg_pixels_tab[0][ 5] = ff_avg_rv40_qpel16_mc11_neon; + c->avg_pixels_tab[0][ 6] = ff_avg_rv40_qpel16_mc21_neon; + c->avg_pixels_tab[0][ 7] = ff_avg_rv40_qpel16_mc31_neon; + c->avg_pixels_tab[0][ 9] = ff_avg_rv40_qpel16_mc12_neon; + c->avg_pixels_tab[0][10] = ff_avg_rv40_qpel16_mc22_neon; + c->avg_pixels_tab[0][11] = ff_avg_rv40_qpel16_mc32_neon; + c->avg_pixels_tab[0][12] = ff_avg_rv40_qpel16_mc03_neon; + c->avg_pixels_tab[0][13] = ff_avg_rv40_qpel16_mc13_neon; + c->avg_pixels_tab[0][14] = ff_avg_rv40_qpel16_mc23_neon; + c->avg_pixels_tab[0][15] = ff_avg_rv40_qpel16_mc33_neon; + c->put_pixels_tab[1][ 1] = ff_put_rv40_qpel8_mc10_neon; + c->put_pixels_tab[1][ 3] = ff_put_rv40_qpel8_mc30_neon; + c->put_pixels_tab[1][ 4] = ff_put_rv40_qpel8_mc01_neon; + c->put_pixels_tab[1][ 5] = ff_put_rv40_qpel8_mc11_neon; + c->put_pixels_tab[1][ 6] = ff_put_rv40_qpel8_mc21_neon; + c->put_pixels_tab[1][ 7] = ff_put_rv40_qpel8_mc31_neon; + c->put_pixels_tab[1][ 9] = ff_put_rv40_qpel8_mc12_neon; + c->put_pixels_tab[1][10] = ff_put_rv40_qpel8_mc22_neon; + c->put_pixels_tab[1][11] = ff_put_rv40_qpel8_mc32_neon; + c->put_pixels_tab[1][12] = ff_put_rv40_qpel8_mc03_neon; + c->put_pixels_tab[1][13] = ff_put_rv40_qpel8_mc13_neon; + c->put_pixels_tab[1][14] = ff_put_rv40_qpel8_mc23_neon; + c->put_pixels_tab[1][15] = ff_put_rv40_qpel8_mc33_neon; + c->avg_pixels_tab[1][ 1] = ff_avg_rv40_qpel8_mc10_neon; + c->avg_pixels_tab[1][ 3] = ff_avg_rv40_qpel8_mc30_neon; + c->avg_pixels_tab[1][ 4] = ff_avg_rv40_qpel8_mc01_neon; + c->avg_pixels_tab[1][ 5] = ff_avg_rv40_qpel8_mc11_neon; + c->avg_pixels_tab[1][ 6] = ff_avg_rv40_qpel8_mc21_neon; + c->avg_pixels_tab[1][ 7] = ff_avg_rv40_qpel8_mc31_neon; + c->avg_pixels_tab[1][ 9] = ff_avg_rv40_qpel8_mc12_neon; + c->avg_pixels_tab[1][10] = ff_avg_rv40_qpel8_mc22_neon; + c->avg_pixels_tab[1][11] = ff_avg_rv40_qpel8_mc32_neon; + c->avg_pixels_tab[1][12] = ff_avg_rv40_qpel8_mc03_neon; + c->avg_pixels_tab[1][13] = ff_avg_rv40_qpel8_mc13_neon; + c->avg_pixels_tab[1][14] = ff_avg_rv40_qpel8_mc23_neon; + c->avg_pixels_tab[1][15] = ff_avg_rv40_qpel8_mc33_neon; + + c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_neon; + c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_neon; + c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_neon; + c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_neon; + + c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_16_neon; + c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_8_neon; + + c->rv40_loop_filter_strength[0] = ff_rv40_h_loop_filter_strength_neon; + c->rv40_loop_filter_strength[1] = ff_rv40_v_loop_filter_strength_neon; + c->rv40_weak_loop_filter[0] = ff_rv40_h_weak_loop_filter_neon; + c->rv40_weak_loop_filter[1] = ff_rv40_v_weak_loop_filter_neon; +} + +av_cold void ff_rv40dsp_init_arm(RV34DSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + rv40dsp_init_neon(c); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/sbcdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/sbcdsp_init_arm.c new file mode 100644 index 0000000000..6bf7e729ef --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/sbcdsp_init_arm.c @@ -0,0 +1,105 @@ +/* + * Bluetooth low-complexity, subband codec (SBC) + * + * Copyright (C) 2017 Aurelien Jacobs + * Copyright (C) 2008-2010 Nokia Corporation + * Copyright (C) 2004-2010 Marcel Holtmann + * Copyright (C) 2004-2005 Henryk Ploetz + * Copyright (C) 2005-2006 Brad Midgley + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * SBC ARMv6 optimization for some basic "building bricks" + */ + +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/sbcdsp.h" + +void ff_sbc_analyze_4_armv6(const int16_t *in, int32_t *out, const int16_t *consts); +void ff_sbc_analyze_8_armv6(const int16_t *in, int32_t *out, const int16_t *consts); + +void ff_sbc_analyze_4_neon(const int16_t *in, int32_t *out, const int16_t *consts); +void ff_sbc_analyze_8_neon(const int16_t *in, int32_t *out, const int16_t *consts); +void ff_sbc_calc_scalefactors_neon(int32_t sb_sample_f[16][2][8], + uint32_t scale_factor[2][8], + int blocks, int channels, int subbands); +int ff_sbc_calc_scalefactors_j_neon(int32_t sb_sample_f[16][2][8], + uint32_t scale_factor[2][8], + int blocks, int subbands); +int ff_sbc_enc_process_input_4s_neon(int position, const uint8_t *pcm, + int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); +int ff_sbc_enc_process_input_8s_neon(int position, const uint8_t *pcm, + int16_t X[2][SBC_X_BUFFER_SIZE], + int nsamples, int nchannels); + +DECLARE_ALIGNED(SBC_ALIGN, int32_t, ff_sbcdsp_joint_bits_mask)[8] = { + 8, 4, 2, 1, 128, 64, 32, 16 +}; + +#if HAVE_BIGENDIAN +#define PERM(a, b, c, d) { \ + (a * 2) + 1, (a * 2) + 0, \ + (b * 2) + 1, (b * 2) + 0, \ + (c * 2) + 1, (c * 2) + 0, \ + (d * 2) + 1, (d * 2) + 0 \ + } +#else +#define PERM(a, b, c, d) { \ + (a * 2) + 0, (a * 2) + 1, \ + (b * 2) + 0, (b * 2) + 1, \ + (c * 2) + 0, (c * 2) + 1, \ + (d * 2) + 0, (d * 2) + 1 \ + } +#endif + +DECLARE_ALIGNED(SBC_ALIGN, uint8_t, ff_sbc_input_perm_4)[2][8] = { + PERM(7, 3, 6, 4), + PERM(0, 2, 1, 5) +}; + +DECLARE_ALIGNED(SBC_ALIGN, uint8_t, ff_sbc_input_perm_8)[4][8] = { + PERM(15, 7, 14, 8), + PERM(13, 9, 12, 10), + PERM(11, 3, 6, 0), + PERM( 5, 1, 4, 2) +}; + +av_cold void ff_sbcdsp_init_arm(SBCDSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) { + s->sbc_analyze_4 = ff_sbc_analyze_4_armv6; + s->sbc_analyze_8 = ff_sbc_analyze_8_armv6; + } + + if (have_neon(cpu_flags)) { + s->sbc_analyze_4 = ff_sbc_analyze_4_neon; + s->sbc_analyze_8 = ff_sbc_analyze_8_neon; + s->sbc_calc_scalefactors = ff_sbc_calc_scalefactors_neon; + s->sbc_calc_scalefactors_j = ff_sbc_calc_scalefactors_j_neon; + if (s->increment != 1) { + s->sbc_enc_process_input_4s = ff_sbc_enc_process_input_4s_neon; + s->sbc_enc_process_input_8s = ff_sbc_enc_process_input_8s_neon; + } + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/sbrdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/sbrdsp_init_arm.c new file mode 100644 index 0000000000..4fb69f922b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/sbrdsp_init_arm.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2012 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/sbrdsp.h" + +void ff_sbr_sum64x5_neon(float *z); +float ff_sbr_sum_square_neon(float (*x)[2], int n); +void ff_sbr_neg_odd_64_neon(float *x); +void ff_sbr_qmf_pre_shuffle_neon(float *z); +void ff_sbr_qmf_post_shuffle_neon(float W[32][2], const float *z); +void ff_sbr_qmf_deint_neg_neon(float *v, const float *src); +void ff_sbr_qmf_deint_bfly_neon(float *v, const float *src0, const float *src1); +void ff_sbr_hf_g_filt_neon(float (*Y)[2], const float (*X_high)[40][2], + const float *g_filt, int m_max, intptr_t ixh); +void ff_sbr_hf_gen_neon(float (*X_high)[2], const float (*X_low)[2], + const float alpha0[2], const float alpha1[2], + float bw, int start, int end); +void ff_sbr_autocorrelate_neon(const float x[40][2], float phi[3][2][2]); + +void ff_sbr_hf_apply_noise_0_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_1_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_2_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_3_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); + +av_cold void ff_sbrdsp_init_arm(SBRDSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->sum64x5 = ff_sbr_sum64x5_neon; + s->sum_square = ff_sbr_sum_square_neon; + s->neg_odd_64 = ff_sbr_neg_odd_64_neon; + s->qmf_pre_shuffle = ff_sbr_qmf_pre_shuffle_neon; + s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_neon; + s->qmf_deint_neg = ff_sbr_qmf_deint_neg_neon; + s->qmf_deint_bfly = ff_sbr_qmf_deint_bfly_neon; + s->hf_g_filt = ff_sbr_hf_g_filt_neon; + s->hf_gen = ff_sbr_hf_gen_neon; + s->autocorrelate = ff_sbr_autocorrelate_neon; + s->hf_apply_noise[0] = ff_sbr_hf_apply_noise_0_neon; + s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_neon; + s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_neon; + s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/startcode.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/startcode.h new file mode 100644 index 0000000000..cf25d9d4df --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/startcode.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_STARTCODE_H +#define AVCODEC_ARM_STARTCODE_H + +#include + +int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size); + +#endif /* AVCODEC_ARM_STARTCODE_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/synth_filter_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/synth_filter_init_arm.c new file mode 100644 index 0000000000..ea0ce148d4 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/synth_filter_init_arm.c @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavcodec/fft.h" +#include "libavcodec/synth_filter.h" + +void ff_synth_filter_float_vfp(FFTContext *imdct, + float *synth_buf_ptr, int *synth_buf_offset, + float synth_buf2[32], const float window[512], + float out[32], const float in[32], + float scale); + +void ff_synth_filter_float_neon(FFTContext *imdct, + float *synth_buf_ptr, int *synth_buf_offset, + float synth_buf2[32], const float window[512], + float out[32], const float in[32], + float scale); + +av_cold void ff_synth_filter_init_arm(SynthFilterContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_vfp_vm(cpu_flags)) + s->synth_filter_float = ff_synth_filter_float_vfp; + if (have_neon(cpu_flags)) + s->synth_filter_float = ff_synth_filter_float_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp.h new file mode 100644 index 0000000000..cd01ac5384 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp.h @@ -0,0 +1,26 @@ +/* + * 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_ARM_VC1DSP_H +#define AVCODEC_ARM_VC1DSP_H + +#include "libavcodec/vc1dsp.h" + +void ff_vc1dsp_init_neon(VC1DSPContext *dsp); + +#endif /* AVCODEC_ARM_VC1DSP_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp_init_arm.c new file mode 100644 index 0000000000..5f2c759048 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp_init_arm.c @@ -0,0 +1,37 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/arm/startcode.h" +#include "libavcodec/vc1dsp.h" +#include "vc1dsp.h" + +av_cold void ff_vc1dsp_init_arm(VC1DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + +#if HAVE_ARMV6 + if (have_setend(cpu_flags)) + dsp->startcode_find_candidate = ff_startcode_find_candidate_armv6; +#endif + if (have_neon(cpu_flags)) + ff_vc1dsp_init_neon(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp_init_neon.c new file mode 100644 index 0000000000..2cca784f5a --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vc1dsp_init_neon.c @@ -0,0 +1,119 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vc1dsp.h" +#include "vc1dsp.h" + +void ff_vc1_inv_trans_8x8_neon(int16_t *block); +void ff_vc1_inv_trans_4x8_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_8x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_4x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); + +void ff_vc1_inv_trans_8x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_4x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_8x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); +void ff_vc1_inv_trans_4x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); + +void ff_put_pixels8x8_neon(uint8_t *block, const uint8_t *pixels, + ptrdiff_t line_size, int rnd); + +#define DECL_PUT(X, Y) \ +void ff_put_vc1_mspel_mc##X##Y##_neon(uint8_t *dst, const uint8_t *src, \ + ptrdiff_t stride, int rnd); \ +static void ff_put_vc1_mspel_mc##X##Y##_16_neon(uint8_t *dst, const uint8_t *src, \ + ptrdiff_t stride, int rnd) \ +{ \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \ + dst += 8*stride; src += 8*stride; \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \ +} + +DECL_PUT(1, 0) +DECL_PUT(2, 0) +DECL_PUT(3, 0) + +DECL_PUT(0, 1) +DECL_PUT(0, 2) +DECL_PUT(0, 3) + +DECL_PUT(1, 1) +DECL_PUT(1, 2) +DECL_PUT(1, 3) + +DECL_PUT(2, 1) +DECL_PUT(2, 2) +DECL_PUT(2, 3) + +DECL_PUT(3, 1) +DECL_PUT(3, 2) +DECL_PUT(3, 3) + +void ff_put_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +#define FN_ASSIGN(X, Y) \ + dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_16_neon; \ + dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_neon + +av_cold void ff_vc1dsp_init_neon(VC1DSPContext *dsp) +{ + dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_neon; + dsp->vc1_inv_trans_4x8 = ff_vc1_inv_trans_4x8_neon; + dsp->vc1_inv_trans_8x4 = ff_vc1_inv_trans_8x4_neon; + dsp->vc1_inv_trans_4x4 = ff_vc1_inv_trans_4x4_neon; + dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_neon; + dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_neon; + dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_neon; + dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_neon; + + dsp->put_vc1_mspel_pixels_tab[1][ 0] = ff_put_pixels8x8_neon; + FN_ASSIGN(1, 0); + FN_ASSIGN(2, 0); + FN_ASSIGN(3, 0); + + FN_ASSIGN(0, 1); + FN_ASSIGN(1, 1); + FN_ASSIGN(2, 1); + FN_ASSIGN(3, 1); + + FN_ASSIGN(0, 2); + FN_ASSIGN(1, 2); + FN_ASSIGN(2, 2); + FN_ASSIGN(3, 2); + + FN_ASSIGN(0, 3); + FN_ASSIGN(1, 3); + FN_ASSIGN(2, 3); + FN_ASSIGN(3, 3); + + dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_neon; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_neon; + dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = ff_put_vc1_chroma_mc4_neon; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = ff_avg_vc1_chroma_mc4_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_arm.h new file mode 100644 index 0000000000..112cbb86c7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_arm.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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_ARM_VIDEODSP_ARM_H +#define AVCODEC_ARM_VIDEODSP_ARM_H + +#include "libavcodec/avcodec.h" +#include "libavcodec/videodsp.h" + +void ff_videodsp_init_armv5te(VideoDSPContext* ctx, int bpc); + +#endif /* AVCODEC_ARM_VIDEODSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_init_arm.c new file mode 100644 index 0000000000..a89abb25d5 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_init_arm.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2012 Ronald S. Bultje + * + * 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/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/videodsp.h" +#include "videodsp_arm.h" + +av_cold void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc) +{ + int cpu_flags = av_get_cpu_flags(); + if (have_armv5te(cpu_flags)) ff_videodsp_init_armv5te(ctx, bpc); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_init_armv5te.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_init_armv5te.c new file mode 100644 index 0000000000..1ea1f3438d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/videodsp_init_armv5te.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Ronald S. Bultje + * + * 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/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/videodsp.h" +#include "videodsp_arm.h" + +void ff_prefetch_arm(uint8_t *mem, ptrdiff_t stride, int h); + +av_cold void ff_videodsp_init_armv5te(VideoDSPContext *ctx, int bpc) +{ +#if HAVE_ARMV5TE_EXTERNAL + ctx->prefetch = ff_prefetch_arm; +#endif +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vorbisdsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vorbisdsp_init_arm.c new file mode 100644 index 0000000000..f4b3d80ef6 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vorbisdsp_init_arm.c @@ -0,0 +1,37 @@ +/* + * ARM NEON optimised DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vorbisdsp.h" + +void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, + intptr_t blocksize); + +av_cold void ff_vorbisdsp_init_arm(VorbisDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp3dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp3dsp_init_arm.c new file mode 100644 index 0000000000..65ea53fe0f --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp3dsp_init_arm.c @@ -0,0 +1,44 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp3dsp.h" + +void ff_vp3_idct_put_neon(uint8_t *dest, ptrdiff_t stride, int16_t *data); +void ff_vp3_idct_add_neon(uint8_t *dest, ptrdiff_t stride, int16_t *data); +void ff_vp3_idct_dc_add_neon(uint8_t *dest, ptrdiff_t stride, int16_t *data); + +void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *); +void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *); + +av_cold void ff_vp3dsp_init_arm(VP3DSPContext *c, int flags) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->idct_put = ff_vp3_idct_put_neon; + c->idct_add = ff_vp3_idct_add_neon; + c->idct_dc_add = ff_vp3_idct_dc_add_neon; + c->v_loop_filter = ff_vp3_v_loop_filter_neon; + c->h_loop_filter = ff_vp3_h_loop_filter_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp56_arith.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp56_arith.h new file mode 100644 index 0000000000..feb1247916 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp56_arith.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2010 Mans Rullgard + * + * 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_ARM_VP56_ARITH_H +#define AVCODEC_ARM_VP56_ARITH_H + +#if CONFIG_THUMB +# define A(x) +# define T(x) x +#else +# define A(x) x +# define T(x) +#endif + +#if CONFIG_THUMB || defined __clang__ +# define L(x) +# define U(x) x +#else +# define L(x) x +# define U(x) +#endif + +#if HAVE_ARMV6_INLINE + +#define vp56_rac_get_prob vp56_rac_get_prob_armv6 +static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned bit; + + __asm__ ("adds %3, %3, %0 \n" + "itt cs \n" + "cmpcs %7, %4 \n" + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + T("itttt cs \n") + "rev16cs %2, %2 \n" + T("lslcs %2, %2, %3 \n") + T("orrcs %1, %1, %2 \n") + A("orrcs %1, %1, %2, lsl %3 \n") + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "cmp %1, %0, lsl #16 \n" + "ittte ge \n" + "subge %1, %1, %0, lsl #16 \n" + "subge %0, %5, %0 \n" + "movge %2, #1 \n" + "movlt %2, #0 \n" + : "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), + "0"(shift), "1"(code_word) + : "cc"); + + return bit; +} + +#define vp56_rac_get_prob_branchy vp56_rac_get_prob_branchy_armv6 +static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned low; + unsigned tmp; + + __asm__ ("adds %3, %3, %0 \n" + "itt cs \n" + "cmpcs %7, %4 \n" + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + T("itttt cs \n") + "rev16cs %2, %2 \n" + T("lslcs %2, %2, %3 \n") + T("orrcs %1, %1, %2 \n") + A("orrcs %1, %1, %2, lsl %3 \n") + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "lsl %2, %0, #16 \n" + : "=&r"(low), "+&r"(code_word), "=&r"(tmp), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift) + : "cc"); + + if (code_word >= tmp) { + c->high = high - low; + c->code_word = code_word - tmp; + return 1; + } + + c->high = low; + c->code_word = code_word; + return 0; +} + +#endif + +#endif /* AVCODEC_ARM_VP56_ARITH_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp6dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp6dsp_init_arm.c new file mode 100644 index 0000000000..a59d61278c --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp6dsp_init_arm.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" + +#include "libavcodec/vp56dsp.h" + +void ff_vp6_edge_filter_hor_neon(uint8_t *yuv, ptrdiff_t stride, int t); +void ff_vp6_edge_filter_ver_neon(uint8_t *yuv, ptrdiff_t stride, int t); + +av_cold void ff_vp6dsp_init_arm(VP56DSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->edge_filter_hor = ff_vp6_edge_filter_hor_neon; + s->edge_filter_ver = ff_vp6_edge_filter_ver_neon; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8.h new file mode 100644 index 0000000000..965342d93b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8.h @@ -0,0 +1,35 @@ +/* + * 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_ARM_VP8_H +#define AVCODEC_ARM_VP8_H + +#include + +#include "config.h" +#include "libavcodec/vp56.h" +#include "libavcodec/vp8.h" + +#if HAVE_ARMV6_EXTERNAL +#define vp8_decode_block_coeffs_internal ff_decode_block_coeffs_armv6 +int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, int16_t block[16], + uint8_t probs[8][3][NUM_DCT_TOKENS-1], + int i, uint8_t *token_prob, int16_t qmul[2]); +#endif + +#endif /* AVCODEC_ARM_VP8_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp.h new file mode 100644 index 0000000000..7281d0bfb1 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp.h @@ -0,0 +1,80 @@ +/* + * 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_ARM_VP8DSP_H +#define AVCODEC_ARM_VP8DSP_H + +#include "libavcodec/vp8dsp.h" + +void ff_vp78dsp_init_armv6(VP8DSPContext *dsp); +void ff_vp78dsp_init_neon(VP8DSPContext *dsp); +void ff_vp8dsp_init_armv6(VP8DSPContext *dsp); +void ff_vp8dsp_init_neon(VP8DSPContext *dsp); + +#define VP8_LF_Y(hv, inner, opt) \ + void ff_vp8_##hv##_loop_filter16##inner##_##opt(uint8_t *dst, \ + ptrdiff_t stride, \ + int flim_E, int flim_I, \ + int hev_thresh) + +#define VP8_LF_UV(hv, inner, opt) \ + void ff_vp8_##hv##_loop_filter8uv##inner##_##opt(uint8_t *dstU, \ + uint8_t *dstV, \ + ptrdiff_t stride, \ + int flim_E, int flim_I, \ + int hev_thresh) + +#define VP8_LF_SIMPLE(hv, opt) \ + void ff_vp8_##hv##_loop_filter16_simple_##opt(uint8_t *dst, \ + ptrdiff_t stride, \ + int flim) + +#define VP8_LF_HV(inner, opt) \ + VP8_LF_Y(h, inner, opt); \ + VP8_LF_Y(v, inner, opt); \ + VP8_LF_UV(h, inner, opt); \ + VP8_LF_UV(v, inner, opt) + +#define VP8_LF(opt) \ + VP8_LF_HV(, opt); \ + VP8_LF_HV(_inner, opt); \ + VP8_LF_SIMPLE(h, opt); \ + VP8_LF_SIMPLE(v, opt) + +#define VP8_MC(n, opt) \ + void ff_put_vp8_##n##_##opt(uint8_t *dst, ptrdiff_t dststride, \ + uint8_t *src, ptrdiff_t srcstride, \ + int h, int x, int y) + +#define VP8_EPEL(w, opt) \ + VP8_MC(pixels ## w, opt); \ + VP8_MC(epel ## w ## _h4, opt); \ + VP8_MC(epel ## w ## _h6, opt); \ + VP8_MC(epel ## w ## _v4, opt); \ + VP8_MC(epel ## w ## _h4v4, opt); \ + VP8_MC(epel ## w ## _h6v4, opt); \ + VP8_MC(epel ## w ## _v6, opt); \ + VP8_MC(epel ## w ## _h4v6, opt); \ + VP8_MC(epel ## w ## _h6v6, opt) + +#define VP8_BILIN(w, opt) \ + VP8_MC(bilin ## w ## _h, opt); \ + VP8_MC(bilin ## w ## _v, opt); \ + VP8_MC(bilin ## w ## _hv, opt) + +#endif /* AVCODEC_ARM_VP8DSP_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_arm.c new file mode 100644 index 0000000000..8b801766d7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_arm.c @@ -0,0 +1,44 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +av_cold void ff_vp78dsp_init_arm(VP8DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) + ff_vp78dsp_init_armv6(dsp); + if (have_neon(cpu_flags)) + ff_vp78dsp_init_neon(dsp); +} + +av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) + ff_vp8dsp_init_armv6(dsp); + if (have_neon(cpu_flags)) + ff_vp8dsp_init_neon(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_armv6.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_armv6.c new file mode 100644 index 0000000000..a5bcd733e0 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_armv6.c @@ -0,0 +1,123 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +void ff_vp8_luma_dc_wht_armv6(int16_t block[4][4][16], int16_t dc[16]); +void ff_vp8_luma_dc_wht_dc_armv6(int16_t block[4][4][16], int16_t dc[16]); + +void ff_vp8_idct_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4y_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4uv_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); + +VP8_LF(armv6); + +VP8_EPEL(16, armv6); +VP8_EPEL(8, armv6); +VP8_EPEL(4, armv6); + +VP8_BILIN(16, armv6); +VP8_BILIN(8, armv6); +VP8_BILIN(4, armv6); + +av_cold void ff_vp78dsp_init_armv6(VP8DSPContext *dsp) +{ + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6; + + dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6; + + dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6; +} + +av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp) +{ + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6; + dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; + + dsp->vp8_idct_add = ff_vp8_idct_add_armv6; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_neon.c new file mode 100644 index 0000000000..53f1f23380 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp8dsp_init_neon.c @@ -0,0 +1,119 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +void ff_vp8_luma_dc_wht_neon(int16_t block[4][4][16], int16_t dc[16]); + +void ff_vp8_idct_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); + +VP8_LF(neon); + +VP8_EPEL(16, neon); +VP8_EPEL(8, neon); +VP8_EPEL(4, neon); + +VP8_BILIN(16, neon); +VP8_BILIN(8, neon); +VP8_BILIN(4, neon); + +av_cold void ff_vp78dsp_init_neon(VP8DSPContext *dsp) +{ + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; +} + +av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp) +{ + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; + + dsp->vp8_idct_add = ff_vp8_idct_add_neon; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init.h new file mode 100644 index 0000000000..0dc1c2dc20 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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_ARM_VP9DSP_INIT_H +#define AVCODEC_ARM_VP9DSP_INIT_H + +#include "libavcodec/vp9dsp.h" + +void ff_vp9dsp_init_10bpp_arm(VP9DSPContext *dsp); +void ff_vp9dsp_init_12bpp_arm(VP9DSPContext *dsp); + +#endif /* AVCODEC_ARM_VP9DSP_INIT_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_10bpp_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_10bpp_arm.c new file mode 100644 index 0000000000..b8cb293b20 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_10bpp_arm.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define BPP 10 +#define INIT_FUNC ff_vp9dsp_init_10bpp_arm +#include "vp9dsp_init_16bpp_arm_template.c" diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_12bpp_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_12bpp_arm.c new file mode 100644 index 0000000000..fa65eb260b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_12bpp_arm.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define BPP 12 +#define INIT_FUNC ff_vp9dsp_init_12bpp_arm +#include "vp9dsp_init_16bpp_arm_template.c" diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c new file mode 100644 index 0000000000..1b0007859d --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavutil/arm/cpu.h" +#include "vp9dsp_init.h" + +#define declare_fpel(type, sz, suffix) \ +void ff_vp9_##type##sz##suffix##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define decl_mc_func(op, filter, dir, sz, bpp) \ +void ff_vp9_##op##_##filter##sz##_##dir##_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define define_8tap_2d_fn(op, filter, sz, bpp) \ +static void op##_##filter##sz##_hv_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, \ + ptrdiff_t src_stride, \ + int h, int mx, int my) \ +{ \ + LOCAL_ALIGNED_16(uint8_t, temp, [((1 + (sz < 64)) * sz + 8) * sz * 2]); \ + /* We only need h + 7 lines, but the horizontal filter assumes an \ + * even number of rows, so filter h + 8 lines here. */ \ + ff_vp9_put_##filter##sz##_h_##bpp##_neon(temp, 2 * sz, \ + src - 3 * src_stride, src_stride, \ + h + 8, mx, 0); \ + ff_vp9_##op##_##filter##sz##_v_##bpp##_neon(dst, dst_stride, \ + temp + 3 * 2 * sz, 2 * sz, \ + h, 0, my); \ +} + +#define decl_filter_funcs(op, dir, sz, bpp) \ + decl_mc_func(op, regular, dir, sz, bpp); \ + decl_mc_func(op, sharp, dir, sz, bpp); \ + decl_mc_func(op, smooth, dir, sz, bpp) + +#define decl_mc_funcs(sz, bpp) \ + decl_filter_funcs(put, h, sz, bpp); \ + decl_filter_funcs(avg, h, sz, bpp); \ + decl_filter_funcs(put, v, sz, bpp); \ + decl_filter_funcs(avg, v, sz, bpp); \ + decl_filter_funcs(put, hv, sz, bpp); \ + decl_filter_funcs(avg, hv, sz, bpp) + +declare_fpel(copy, 128, ); +declare_fpel(copy, 64, ); +declare_fpel(copy, 32, ); +declare_fpel(copy, 16, ); +declare_fpel(copy, 8, ); +declare_fpel(avg, 64, _16); +declare_fpel(avg, 32, _16); +declare_fpel(avg, 16, _16); +declare_fpel(avg, 8, _16); +declare_fpel(avg, 4, _16); + +decl_mc_funcs(64, BPP); +decl_mc_funcs(32, BPP); +decl_mc_funcs(16, BPP); +decl_mc_funcs(8, BPP); +decl_mc_funcs(4, BPP); + +#define define_8tap_2d_funcs(sz, bpp) \ + define_8tap_2d_fn(put, regular, sz, bpp) \ + define_8tap_2d_fn(put, sharp, sz, bpp) \ + define_8tap_2d_fn(put, smooth, sz, bpp) \ + define_8tap_2d_fn(avg, regular, sz, bpp) \ + define_8tap_2d_fn(avg, sharp, sz, bpp) \ + define_8tap_2d_fn(avg, smooth, sz, bpp) + +define_8tap_2d_funcs(64, BPP) +define_8tap_2d_funcs(32, BPP) +define_8tap_2d_funcs(16, BPP) +define_8tap_2d_funcs(8, BPP) +define_8tap_2d_funcs(4, BPP) + + +static av_cold void vp9dsp_mc_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_fpel(idx1, idx2, sz, type, suffix) \ + dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##suffix##_neon + +#define init_copy_avg(idx, sz1, sz2) \ + init_fpel(idx, 0, sz2, copy, ); \ + init_fpel(idx, 1, sz1, avg, _16) + +#define init_mc_func(idx1, idx2, op, filter, fname, dir, mx, my, sz, pfx, bpp) \ + dsp->mc[idx1][filter][idx2][mx][my] = pfx##op##_##fname##sz##_##dir##_##bpp##_neon + +#define init_mc_funcs(idx, dir, mx, my, sz, pfx, bpp) \ + init_mc_func(idx, 0, put, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp) + +#define init_mc_funcs_dirs(idx, sz, bpp) \ + init_mc_funcs(idx, h, 1, 0, sz, ff_vp9_, bpp); \ + init_mc_funcs(idx, v, 0, 1, sz, ff_vp9_, bpp); \ + init_mc_funcs(idx, hv, 1, 1, sz, , bpp) + + init_copy_avg(0, 64, 128); + init_copy_avg(1, 32, 64); + init_copy_avg(2, 16, 32); + init_copy_avg(3, 8, 16); + init_copy_avg(4, 4, 8); + + init_mc_funcs_dirs(0, 64, BPP); + init_mc_funcs_dirs(1, 32, BPP); + init_mc_funcs_dirs(2, 16, BPP); + init_mc_funcs_dirs(3, 8, BPP); + init_mc_funcs_dirs(4, 4, BPP); + } +} + +#define define_itxfm2(type_a, type_b, sz, bpp) \ +void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_##bpp##_neon(uint8_t *_dst, \ + ptrdiff_t stride, \ + int16_t *_block, int eob) +#define define_itxfm(type_a, type_b, sz, bpp) define_itxfm2(type_a, type_b, sz, bpp) + +#define define_itxfm_funcs(sz, bpp) \ + define_itxfm(idct, idct, sz, bpp); \ + define_itxfm(iadst, idct, sz, bpp); \ + define_itxfm(idct, iadst, sz, bpp); \ + define_itxfm(iadst, iadst, sz, bpp) + +define_itxfm_funcs(4, BPP); +define_itxfm_funcs(8, BPP); +define_itxfm_funcs(16, BPP); +define_itxfm(idct, idct, 32, BPP); +define_itxfm(iwht, iwht, 4, BPP); + + +static av_cold void vp9dsp_itxfm_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_itxfm2(tx, sz, bpp) \ + dsp->itxfm_add[tx][DCT_DCT] = ff_vp9_idct_idct_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][DCT_ADST] = ff_vp9_iadst_idct_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][ADST_DCT] = ff_vp9_idct_iadst_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_##bpp##_neon +#define init_itxfm(tx, sz, bpp) init_itxfm2(tx, sz, bpp) + +#define init_idct2(tx, nm, bpp) \ + dsp->itxfm_add[tx][DCT_DCT] = \ + dsp->itxfm_add[tx][ADST_DCT] = \ + dsp->itxfm_add[tx][DCT_ADST] = \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_##bpp##_neon +#define init_idct(tx, nm, bpp) init_idct2(tx, nm, bpp) + + init_itxfm(TX_4X4, 4x4, BPP); + init_itxfm(TX_8X8, 8x8, BPP); + init_itxfm(TX_16X16, 16x16, BPP); + init_idct(TX_32X32, idct_idct_32x32, BPP); + init_idct(4, iwht_iwht_4x4, BPP); + } +} + +#define define_loop_filter(dir, wd, size, bpp) \ +void ff_vp9_loop_filter_##dir##_##wd##_##size##_##bpp##_neon(uint8_t *dst, ptrdiff_t stride, int E, int I, int H) + +#define define_loop_filters(wd, size, bpp) \ + define_loop_filter(h, wd, size, bpp); \ + define_loop_filter(v, wd, size, bpp) + +define_loop_filters(4, 8, BPP); +define_loop_filters(8, 8, BPP); +define_loop_filters(16, 8, BPP); + +define_loop_filters(16, 16, BPP); + +define_loop_filters(44, 16, BPP); +define_loop_filters(48, 16, BPP); +define_loop_filters(84, 16, BPP); +define_loop_filters(88, 16, BPP); + +static av_cold void vp9dsp_loopfilter_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_lpf_func_8(idx1, idx2, dir, wd, bpp) \ + dsp->loop_filter_8[idx1][idx2] = ff_vp9_loop_filter_##dir##_##wd##_8_##bpp##_neon + +#define init_lpf_func_16(idx, dir, bpp) \ + dsp->loop_filter_16[idx] = ff_vp9_loop_filter_##dir##_16_16_##bpp##_neon + +#define init_lpf_func_mix2(idx1, idx2, idx3, dir, wd, bpp) \ + dsp->loop_filter_mix2[idx1][idx2][idx3] = ff_vp9_loop_filter_##dir##_##wd##_16_##bpp##_neon + +#define init_lpf_funcs_8_wd(idx, wd, bpp) \ + init_lpf_func_8(idx, 0, h, wd, bpp); \ + init_lpf_func_8(idx, 1, v, wd, bpp) + +#define init_lpf_funcs_16(bpp) \ + init_lpf_func_16(0, h, bpp); \ + init_lpf_func_16(1, v, bpp) + +#define init_lpf_funcs_mix2_wd(idx1, idx2, wd, bpp) \ + init_lpf_func_mix2(idx1, idx2, 0, h, wd, bpp); \ + init_lpf_func_mix2(idx1, idx2, 1, v, wd, bpp) + +#define init_lpf_funcs_8(bpp) \ + init_lpf_funcs_8_wd(0, 4, bpp); \ + init_lpf_funcs_8_wd(1, 8, bpp); \ + init_lpf_funcs_8_wd(2, 16, bpp) + +#define init_lpf_funcs_mix2(bpp) \ + init_lpf_funcs_mix2_wd(0, 0, 44, bpp); \ + init_lpf_funcs_mix2_wd(0, 1, 48, bpp); \ + init_lpf_funcs_mix2_wd(1, 0, 84, bpp); \ + init_lpf_funcs_mix2_wd(1, 1, 88, bpp) + + init_lpf_funcs_8(BPP); + init_lpf_funcs_16(BPP); + init_lpf_funcs_mix2(BPP); + } +} + +av_cold void INIT_FUNC(VP9DSPContext *dsp) +{ + vp9dsp_mc_init_arm(dsp); + vp9dsp_loopfilter_init_arm(dsp); + vp9dsp_itxfm_init_arm(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_arm.c new file mode 100644 index 0000000000..cb7f48d5ca --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/arm/vp9dsp_init_arm.c @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2016 Google Inc. + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp9dsp.h" +#include "vp9dsp_init.h" + +#define declare_fpel(type, sz) \ +void ff_vp9_##type##sz##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define declare_copy_avg(sz) \ + declare_fpel(copy, sz); \ + declare_fpel(avg , sz) + +#define decl_mc_func(op, filter, dir, sz) \ +void ff_vp9_##op##_##filter##sz##_##dir##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define define_8tap_2d_fn(op, filter, sz) \ +static void op##_##filter##sz##_hv_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) \ +{ \ + LOCAL_ALIGNED_16(uint8_t, temp, [((1 + (sz < 64)) * sz + 8) * sz]); \ + /* We only need h + 7 lines, but the horizontal filter assumes an \ + * even number of rows, so filter h + 8 lines here. */ \ + ff_vp9_put_##filter##sz##_h_neon(temp, sz, \ + src - 3 * src_stride, src_stride, \ + h + 8, mx, 0); \ + ff_vp9_##op##_##filter##sz##_v_neon(dst, dst_stride, \ + temp + 3 * sz, sz, \ + h, 0, my); \ +} + +#define decl_filter_funcs(op, dir, sz) \ + decl_mc_func(op, regular, dir, sz); \ + decl_mc_func(op, sharp, dir, sz); \ + decl_mc_func(op, smooth, dir, sz) + +#define decl_mc_funcs(sz) \ + decl_filter_funcs(put, h, sz); \ + decl_filter_funcs(avg, h, sz); \ + decl_filter_funcs(put, v, sz); \ + decl_filter_funcs(avg, v, sz); \ + decl_filter_funcs(put, hv, sz); \ + decl_filter_funcs(avg, hv, sz) + +declare_copy_avg(64); +declare_copy_avg(32); +declare_copy_avg(16); +declare_copy_avg(8); +declare_copy_avg(4); + +decl_mc_funcs(64); +decl_mc_funcs(32); +decl_mc_funcs(16); +decl_mc_funcs(8); +decl_mc_funcs(4); + +#define define_8tap_2d_funcs(sz) \ + define_8tap_2d_fn(put, regular, sz) \ + define_8tap_2d_fn(put, sharp, sz) \ + define_8tap_2d_fn(put, smooth, sz) \ + define_8tap_2d_fn(avg, regular, sz) \ + define_8tap_2d_fn(avg, sharp, sz) \ + define_8tap_2d_fn(avg, smooth, sz) + +define_8tap_2d_funcs(64) +define_8tap_2d_funcs(32) +define_8tap_2d_funcs(16) +define_8tap_2d_funcs(8) +define_8tap_2d_funcs(4) + + +static av_cold void vp9dsp_mc_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_fpel(idx1, idx2, sz, type) \ + dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_neon + +#define init_copy_avg(idx, sz) \ + init_fpel(idx, 0, sz, copy); \ + init_fpel(idx, 1, sz, avg) + +#define init_mc_func(idx1, idx2, op, filter, fname, dir, mx, my, sz, pfx) \ + dsp->mc[idx1][filter][idx2][mx][my] = pfx##op##_##fname##sz##_##dir##_neon + +#define init_mc_funcs(idx, dir, mx, my, sz, pfx) \ + init_mc_func(idx, 0, put, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx) + +#define init_mc_funcs_dirs(idx, sz) \ + init_mc_funcs(idx, h, 1, 0, sz, ff_vp9_); \ + init_mc_funcs(idx, v, 0, 1, sz, ff_vp9_); \ + init_mc_funcs(idx, hv, 1, 1, sz,) + + init_copy_avg(0, 64); + init_copy_avg(1, 32); + init_copy_avg(2, 16); + init_copy_avg(3, 8); + init_copy_avg(4, 4); + + init_mc_funcs_dirs(0, 64); + init_mc_funcs_dirs(1, 32); + init_mc_funcs_dirs(2, 16); + init_mc_funcs_dirs(3, 8); + init_mc_funcs_dirs(4, 4); + } +} + +#define define_itxfm(type_a, type_b, sz) \ +void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_neon(uint8_t *_dst, \ + ptrdiff_t stride, \ + int16_t *_block, int eob) + +#define define_itxfm_funcs(sz) \ + define_itxfm(idct, idct, sz); \ + define_itxfm(iadst, idct, sz); \ + define_itxfm(idct, iadst, sz); \ + define_itxfm(iadst, iadst, sz) + +define_itxfm_funcs(4); +define_itxfm_funcs(8); +define_itxfm_funcs(16); +define_itxfm(idct, idct, 32); +define_itxfm(iwht, iwht, 4); + + +static av_cold void vp9dsp_itxfm_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_itxfm(tx, sz) \ + dsp->itxfm_add[tx][DCT_DCT] = ff_vp9_idct_idct_##sz##_add_neon; \ + dsp->itxfm_add[tx][DCT_ADST] = ff_vp9_iadst_idct_##sz##_add_neon; \ + dsp->itxfm_add[tx][ADST_DCT] = ff_vp9_idct_iadst_##sz##_add_neon; \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_neon + +#define init_idct(tx, nm) \ + dsp->itxfm_add[tx][DCT_DCT] = \ + dsp->itxfm_add[tx][ADST_DCT] = \ + dsp->itxfm_add[tx][DCT_ADST] = \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_neon + + init_itxfm(TX_4X4, 4x4); + init_itxfm(TX_8X8, 8x8); + init_itxfm(TX_16X16, 16x16); + init_idct(TX_32X32, idct_idct_32x32); + init_idct(4, iwht_iwht_4x4); + } +} + +#define define_loop_filter(dir, wd, size) \ +void ff_vp9_loop_filter_##dir##_##wd##_##size##_neon(uint8_t *dst, ptrdiff_t stride, int E, int I, int H) + +#define define_loop_filters(wd, size) \ + define_loop_filter(h, wd, size); \ + define_loop_filter(v, wd, size) + +define_loop_filters(4, 8); +define_loop_filters(8, 8); +define_loop_filters(16, 8); +define_loop_filters(16, 16); + +define_loop_filters(44, 16); + +#define lf_mix_fn(dir, wd1, wd2, stridea) \ +static void loop_filter_##dir##_##wd1##wd2##_16_neon(uint8_t *dst, \ + ptrdiff_t stride, \ + int E, int I, int H) \ +{ \ + ff_vp9_loop_filter_##dir##_##wd1##_8_neon(dst, stride, E & 0xff, I & 0xff, H & 0xff); \ + ff_vp9_loop_filter_##dir##_##wd2##_8_neon(dst + 8 * stridea, stride, E >> 8, I >> 8, H >> 8); \ +} + +#define lf_mix_fns(wd1, wd2) \ + lf_mix_fn(h, wd1, wd2, stride) \ + lf_mix_fn(v, wd1, wd2, sizeof(uint8_t)) + +lf_mix_fns(4, 8) +lf_mix_fns(8, 4) +lf_mix_fns(8, 8) + +static av_cold void vp9dsp_loopfilter_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + dsp->loop_filter_8[0][1] = ff_vp9_loop_filter_v_4_8_neon; + dsp->loop_filter_8[0][0] = ff_vp9_loop_filter_h_4_8_neon; + dsp->loop_filter_8[1][1] = ff_vp9_loop_filter_v_8_8_neon; + dsp->loop_filter_8[1][0] = ff_vp9_loop_filter_h_8_8_neon; + dsp->loop_filter_8[2][1] = ff_vp9_loop_filter_v_16_8_neon; + dsp->loop_filter_8[2][0] = ff_vp9_loop_filter_h_16_8_neon; + + dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_neon; + dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_neon; + + dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_neon; + dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_neon; + dsp->loop_filter_mix2[0][1][0] = loop_filter_h_48_16_neon; + dsp->loop_filter_mix2[0][1][1] = loop_filter_v_48_16_neon; + dsp->loop_filter_mix2[1][0][0] = loop_filter_h_84_16_neon; + dsp->loop_filter_mix2[1][0][1] = loop_filter_v_84_16_neon; + dsp->loop_filter_mix2[1][1][0] = loop_filter_h_88_16_neon; + dsp->loop_filter_mix2[1][1][1] = loop_filter_v_88_16_neon; + } +} + +av_cold void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp) +{ + if (bpp == 10) { + ff_vp9dsp_init_10bpp_arm(dsp); + return; + } else if (bpp == 12) { + ff_vp9dsp_init_12bpp_arm(dsp); + return; + } else if (bpp != 8) + return; + + vp9dsp_mc_init_arm(dsp); + vp9dsp_loopfilter_init_arm(dsp); + vp9dsp_itxfm_init_arm(dsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avcodec.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avcodec.h index d234271c5b..bee2234575 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avcodec.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avcodec.h @@ -452,11 +452,6 @@ enum AVCodecID { AV_CODEC_ID_MWSC, AV_CODEC_ID_WCMV, AV_CODEC_ID_RASC, - AV_CODEC_ID_HYMT, - AV_CODEC_ID_ARBC, - AV_CODEC_ID_AGM, - AV_CODEC_ID_LSCR, - AV_CODEC_ID_VP4, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -541,7 +536,6 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_AICA, AV_CODEC_ID_ADPCM_IMA_DAT4, AV_CODEC_ID_ADPCM_MTAF, - AV_CODEC_ID_ADPCM_AGM, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -651,7 +645,6 @@ enum AVCodecID { AV_CODEC_ID_APTX_HD, AV_CODEC_ID_SBC, AV_CODEC_ID_ATRAC9, - AV_CODEC_ID_HCOM, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -681,7 +674,6 @@ enum AVCodecID { AV_CODEC_ID_ASS, AV_CODEC_ID_HDMV_TEXT_SUBTITLE, AV_CODEC_ID_TTML, - AV_CODEC_ID_ARIB_CAPTION, /* other specific kind of codecs (generally used for attachments) */ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. @@ -860,11 +852,6 @@ typedef struct RcOverride{ * Use qpel MC. */ #define AV_CODEC_FLAG_QPEL (1 << 4) -/** - * Don't output frames whose parameters differ from first - * decoded frame in stream. - */ -#define AV_CODEC_FLAG_DROPCHANGED (1 << 5) /** * Use internal 2pass ratecontrol in first pass mode. */ @@ -1084,13 +1071,6 @@ typedef struct RcOverride{ */ #define AV_CODEC_CAP_HYBRID (1 << 19) -/** - * This codec takes the reordered_opaque field from input AVFrames - * and returns it in the corresponding field in AVCodecContext after - * encoding. - */ -#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20) - /** * Pan Scan area. * This specifies the area which should be displayed. @@ -1130,29 +1110,17 @@ typedef struct AVCPBProperties { * Maximum bitrate of the stream, in bits per second. * Zero if unknown or unspecified. */ -#if FF_API_UNSANITIZED_BITRATES int max_bitrate; -#else - int64_t max_bitrate; -#endif /** * Minimum bitrate of the stream, in bits per second. * Zero if unknown or unspecified. */ -#if FF_API_UNSANITIZED_BITRATES int min_bitrate; -#else - int64_t min_bitrate; -#endif /** * Average bitrate of the stream, in bits per second. * Zero if unknown or unspecified. */ -#if FF_API_UNSANITIZED_BITRATES int avg_bitrate; -#else - int64_t avg_bitrate; -#endif /** * The size of the buffer to which the ratecontrol is applied, in bits. @@ -2057,19 +2025,15 @@ typedef struct AVCodecContext { /** * custom intra quantization matrix - * Must be allocated with the av_malloc() family of functions, and will be freed in - * avcodec_free_context(). - * - encoding: Set/allocated by user, freed by libavcodec. Can be NULL. - * - decoding: Set/allocated/freed by libavcodec. + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. */ uint16_t *intra_matrix; /** * custom inter quantization matrix - * Must be allocated with the av_malloc() family of functions, and will be freed in - * avcodec_free_context(). - * - encoding: Set/allocated by user, freed by libavcodec. Can be NULL. - * - decoding: Set/allocated/freed by libavcodec. + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. */ uint16_t *inter_matrix; @@ -2713,10 +2677,7 @@ typedef struct AVCodecContext { /** * opaque 64-bit number (generally a PTS) that will be reordered and * output in AVFrame.reordered_opaque - * - encoding: Set by libavcodec to the reordered_opaque of the input - * frame corresponding to the last returned packet. Only - * supported by encoders with the - * AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability. + * - encoding: unused * - decoding: Set by user. */ int64_t reordered_opaque; @@ -3000,16 +2961,6 @@ typedef struct AVCodecContext { #define FF_PROFILE_SBC_MSBC 1 -#define FF_PROFILE_PRORES_PROXY 0 -#define FF_PROFILE_PRORES_LT 1 -#define FF_PROFILE_PRORES_STANDARD 2 -#define FF_PROFILE_PRORES_HQ 3 -#define FF_PROFILE_PRORES_4444 4 -#define FF_PROFILE_PRORES_XQ 5 - -#define FF_PROFILE_ARIB_PROFILE_A 0 -#define FF_PROFILE_ARIB_PROFILE_C 1 - /** * level * - encoding: Set by user. @@ -3362,14 +3313,6 @@ typedef struct AVCodecContext { * used as reference pictures). */ int extra_hw_frames; - - /** - * The percentage of damaged samples to discard a frame. - * - * - decoding: set by user - * - encoding: unused - */ - int discard_damaged_percentage; } AVCodecContext; #if FF_API_CODEC_GET_SET @@ -4422,7 +4365,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by); * Initialize a reference-counted packet from av_malloc()ed data. * * @param pkt packet to be initialized. This function will set the data, size, - * and buf fields, all others are left untouched. + * buf and destruct fields, all others are left untouched. * @param data Data allocated by av_malloc() to be used as packet data. If this * function returns successfully, the data is owned by the underlying AVBuffer. * The caller may not access the data through other means. @@ -4928,9 +4871,6 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); * AVERROR_EOF: the decoder has been fully flushed, and there will be * no more output frames * AVERROR(EINVAL): codec not opened, or it is an encoder - * AVERROR_INPUT_CHANGED: current decoded frame has changed parameters - * with respect to first decoded frame. Applicable - * when flag AV_CODEC_FLAG_DROPCHANGED is set. * other negative values: legitimate decoding errors */ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avdct.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avdct.c index 47e5f7134e..7c761cf39a 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avdct.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avdct.c @@ -100,7 +100,7 @@ int avcodec_dct_init(AVDCT *dsp) #if CONFIG_IDCTDSP { - IDCTDSPContext idsp; + IDCTDSPContext idsp = {0}; ff_idctdsp_init(&idsp, avctx); COPY(idsp, idct); COPY(idsp, idct_permutation); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avpacket.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avpacket.c index 2b20067211..e160ad3033 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avpacket.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/avpacket.c @@ -112,7 +112,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by) av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); if ((unsigned)grow_by > INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE)) - return AVERROR(ENOMEM); + return -1; new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE; if (pkt->buf) { @@ -124,7 +124,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by) } else { data_offset = pkt->data - pkt->buf->data; if (data_offset > INT_MAX - new_size) - return AVERROR(ENOMEM); + return -1; } if (new_size + data_offset > pkt->buf->size) { @@ -522,12 +522,11 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size) int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict) { - const uint8_t *end; + const uint8_t *end = data + size; int ret = 0; if (!dict || !data || !size) return ret; - end = data + size; if (size && end[-1]) return AVERROR_INVALIDDATA; while (data < end) { @@ -617,7 +616,6 @@ int av_packet_ref(AVPacket *dst, const AVPacket *src) ret = packet_alloc(&dst->buf, src->size); if (ret < 0) goto fail; - av_assert1(!src->size || src->data); if (src->size) memcpy(dst->buf->data, src->data, src->size); @@ -670,7 +668,6 @@ int av_packet_make_refcounted(AVPacket *pkt) ret = packet_alloc(&pkt->buf, pkt->size); if (ret < 0) return ret; - av_assert1(!pkt->size || pkt->data); if (pkt->size) memcpy(pkt->buf->data, pkt->data, pkt->size); @@ -690,7 +687,6 @@ int av_packet_make_writable(AVPacket *pkt) ret = packet_alloc(&buf, pkt->size); if (ret < 0) return ret; - av_assert1(!pkt->size || pkt->data); if (pkt->size) memcpy(buf->data, pkt->data, pkt->size); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/bitstream.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/bitstream.c index be8a0f634d..de3acf0838 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/bitstream.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/bitstream.c @@ -162,9 +162,9 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, uint32_t code; volatile VLC_TYPE (* volatile table)[2]; // the double volatile is needed to prevent an internal compiler error in gcc 4.2 - table_size = 1 << table_nb_bits; if (table_nb_bits > 30) - return AVERROR(EINVAL); + return -1; + table_size = 1 << table_nb_bits; table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); if (table_index < 0) @@ -311,7 +311,7 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes, av_log(NULL, AV_LOG_ERROR, "Too long VLC (%d) in init_vlc\n", buf[j].bits);\ if (!(flags & INIT_VLC_USE_NEW_STATIC)) \ av_free(buf); \ - return AVERROR(EINVAL); \ + return -1; \ } \ GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size); \ if (buf[j].code >= (1LL<internal->buffer_pkt); + if (ctx->internal) + av_packet_free(&ctx->internal->buffer_pkt); av_freep(&ctx->internal); av_freep(&ctx->priv_data); @@ -350,15 +351,6 @@ static int bsf_list_filter(AVBSFContext *bsf, AVPacket *out) return ret; } -static void bsf_list_flush(AVBSFContext *bsf) -{ - BSFListContext *lst = bsf->priv_data; - - for (int i = 0; i < lst->nb_bsfs; i++) - av_bsf_flush(lst->bsfs[i]); - lst->idx = lst->flushed_idx = 0; -} - static void bsf_list_close(AVBSFContext *bsf) { BSFListContext *lst = bsf->priv_data; @@ -407,7 +399,6 @@ const AVBitStreamFilter ff_list_bsf = { .priv_class = &bsf_list_class, .init = bsf_list_init, .filter = bsf_list_filter, - .flush = bsf_list_flush, .close = bsf_list_close, }; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/codec_desc.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/codec_desc.c index 4d033c20ff..1a159f7e13 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/codec_desc.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/codec_desc.c @@ -81,7 +81,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("Motion JPEG"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, .mime_types= MT("image/jpeg"), - .profiles = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles), }, { .id = AV_CODEC_ID_MJPEGB, @@ -723,7 +722,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .id = AV_CODEC_ID_GIF, .type = AVMEDIA_TYPE_VIDEO, .name = "gif", - .long_name = NULL_IF_CONFIG_SMALL("CompuServe GIF (Graphics Interchange Format)"), + .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"), .props = AV_CODEC_PROP_LOSSLESS, .mime_types= MT("image/gif"), }, @@ -1078,7 +1077,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .name = "prores", .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - .profiles = NULL_IF_CONFIG_SMALL(ff_prores_profiles), }, { .id = AV_CODEC_ID_JV, @@ -1691,41 +1689,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("RemotelyAnywhere Screen Capture"), .props = AV_CODEC_PROP_LOSSY, }, - { - .id = AV_CODEC_ID_HYMT, - .type = AVMEDIA_TYPE_VIDEO, - .name = "hymt", - .long_name = NULL_IF_CONFIG_SMALL("HuffYUV MT"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ARBC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "arbc", - .long_name = NULL_IF_CONFIG_SMALL("Gryphon's Anim Compressor"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AGM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "agm", - .long_name = NULL_IF_CONFIG_SMALL("Amuse Graphics Movie"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_LSCR, - .type = AVMEDIA_TYPE_VIDEO, - .name = "lscr", - .long_name = NULL_IF_CONFIG_SMALL("LEAD Screen Capture"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VP4, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp4", - .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), - .props = AV_CODEC_PROP_LOSSY, - }, /* various PCM "codecs" */ { @@ -2269,13 +2232,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("ADPCM MTAF"), .props = AV_CODEC_PROP_LOSSY, }, - { - .id = AV_CODEC_ID_ADPCM_AGM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_agm", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM AmuseGraphics Movie AGM"), - .props = AV_CODEC_PROP_LOSSY, - }, /* AMR */ { @@ -2978,13 +2934,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("ATRAC9 (Adaptive TRansform Acoustic Coding 9)"), .props = AV_CODEC_PROP_LOSSY, }, - { - .id = AV_CODEC_ID_HCOM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "hcom", - .long_name = NULL_IF_CONFIG_SMALL("HCOM Audio"), - .props = AV_CODEC_PROP_LOSSY, - }, /* subtitle codecs */ { @@ -3161,14 +3110,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("Timed Text Markup Language"), .props = AV_CODEC_PROP_TEXT_SUB, }, - { - .id = AV_CODEC_ID_ARIB_CAPTION, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "arib_caption", - .long_name = NULL_IF_CONFIG_SMALL("ARIB STD-B24 caption"), - .props = AV_CODEC_PROP_TEXT_SUB, - .profiles = NULL_IF_CONFIG_SMALL(ff_arib_caption_profiles), - }, + /* other kind of codecs and pseudo-codecs */ { diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/decode.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/decode.c index 6c31166ec2..c89c77c43a 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/decode.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/decode.c @@ -740,7 +740,7 @@ static int apply_cropping(AVCodecContext *avctx, AVFrame *frame) int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) { AVCodecInternal *avci = avctx->internal; - int ret, changed; + int ret; av_frame_unref(frame); @@ -765,51 +765,6 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr avctx->frame_number++; - if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) { - - if (avctx->frame_number == 1) { - avci->initial_format = frame->format; - switch(avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - avci->initial_width = frame->width; - avci->initial_height = frame->height; - break; - case AVMEDIA_TYPE_AUDIO: - avci->initial_sample_rate = frame->sample_rate ? frame->sample_rate : - avctx->sample_rate; - avci->initial_channels = frame->channels; - avci->initial_channel_layout = frame->channel_layout; - break; - } - } - - if (avctx->frame_number > 1) { - changed = avci->initial_format != frame->format; - - switch(avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - changed |= avci->initial_width != frame->width || - avci->initial_height != frame->height; - break; - case AVMEDIA_TYPE_AUDIO: - changed |= avci->initial_sample_rate != frame->sample_rate || - avci->initial_sample_rate != avctx->sample_rate || - avci->initial_channels != frame->channels || - avci->initial_channel_layout != frame->channel_layout; - break; - } - - if (changed) { - avci->changed_frames_dropped++; - av_log(avctx, AV_LOG_INFO, "dropped changed frame #%d pts %"PRId64 - " drop count: %d \n", - avctx->frame_number, frame->pts, - avci->changed_frames_dropped); - av_frame_unref(frame); - return AVERROR_INPUT_CHANGED; - } - } - } return 0; } @@ -1423,7 +1378,6 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) if (i == n) { av_log(avctx, AV_LOG_ERROR, "Invalid return from get_format(): " "%s not in possible list.\n", desc->name); - ret = AV_PIX_FMT_NONE; break; } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/dirac_arith.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/dirac_arith.h index 79526a7ca3..24a7ca390e 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/dirac_arith.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/dirac_arith.h @@ -81,8 +81,6 @@ typedef struct { const uint8_t *bytestream_end; uint16_t contexts[DIRAC_CTX_COUNT]; - int error; - int overread; } DiracArith; extern const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT]; @@ -120,9 +118,6 @@ static inline void refill(DiracArith *c) new |= 0xff00; c->bytestream = c->bytestream_end; - c->overread ++; - if (c->overread > 4) - c->error = AVERROR_INVALIDDATA; } c->low += new << counter; @@ -178,7 +173,6 @@ static inline int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_c while (!dirac_get_arith_bit(c, follow_ctx)) { if (ret >= 0x40000000) { av_log(NULL, AV_LOG_ERROR, "dirac_get_arith_uint overflow\n"); - c->error = AVERROR_INVALIDDATA; return -1; } ret <<= 1; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/error_resilience.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/error_resilience.c index ca2287198b..35d0c609e5 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/error_resilience.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/error_resilience.c @@ -1121,8 +1121,6 @@ void ff_er_frame_end(ERContext *s) av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors in %c frame\n", dc_error, ac_error, mv_error, av_get_picture_type_char(s->cur_pic.f->pict_type)); - s->cur_pic.f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; - is_intra_likely = is_intra_more_likely(s); /* set unknown mb-type to most likely */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/fft_template.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/fft_template.c index 20a62e4290..762c014bc8 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/fft_template.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/fft_template.c @@ -261,41 +261,17 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) if (s->fft_permutation == FF_FFT_PERM_AVX) { fft_perm_avx(s); } else { -#define PROCESS_FFT_PERM_SWAP_LSBS(num) do {\ - for(i = 0; i < n; i++) {\ - int k;\ - j = i;\ - j = (j & ~3) | ((j >> 1) & 1) | ((j << 1) & 2);\ - k = -split_radix_permutation(i, n, s->inverse) & (n - 1);\ - s->revtab##num[k] = j;\ - } \ -} while(0); - -#define PROCESS_FFT_PERM_DEFAULT(num) do {\ - for(i = 0; i < n; i++) {\ - int k;\ - j = i;\ - k = -split_radix_permutation(i, n, s->inverse) & (n - 1);\ - s->revtab##num[k] = j;\ - } \ -} while(0); - -#define SPLIT_RADIX_PERMUTATION(num) do { \ - if (s->fft_permutation == FF_FFT_PERM_SWAP_LSBS) {\ - PROCESS_FFT_PERM_SWAP_LSBS(num) \ - } else {\ - PROCESS_FFT_PERM_DEFAULT(num) \ - }\ -} while(0); - - if (s->revtab) - SPLIT_RADIX_PERMUTATION() - if (s->revtab32) - SPLIT_RADIX_PERMUTATION(32) - -#undef PROCESS_FFT_PERM_DEFAULT -#undef PROCESS_FFT_PERM_SWAP_LSBS -#undef SPLIT_RADIX_PERMUTATION + for(i=0; ifft_permutation == FF_FFT_PERM_SWAP_LSBS) + j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); + k = -split_radix_permutation(i, n, s->inverse) & (n-1); + if (s->revtab) + s->revtab[k] = j; + if (s->revtab32) + s->revtab32[k] = j; + } } return 0; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/get_bits.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/get_bits.h index c4ab607744..26a5b3e54f 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/get_bits.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/get_bits.h @@ -226,32 +226,34 @@ static inline int get_bits_count(const GetBitContext *s) } #if CACHED_BITSTREAM_READER -static inline void refill_32(GetBitContext *s, int is_le) +static inline void refill_32(GetBitContext *s) { #if !UNCHECKED_BITSTREAM_READER if (s->index >> 3 >= s->buffer_end - s->buffer) return; #endif - if (is_le) +#ifdef BITSTREAM_READER_LE s->cache = (uint64_t)AV_RL32(s->buffer + (s->index >> 3)) << s->bits_left | s->cache; - else +#else s->cache = s->cache | (uint64_t)AV_RB32(s->buffer + (s->index >> 3)) << (32 - s->bits_left); +#endif s->index += 32; s->bits_left += 32; } -static inline void refill_64(GetBitContext *s, int is_le) +static inline void refill_64(GetBitContext *s) { #if !UNCHECKED_BITSTREAM_READER if (s->index >> 3 >= s->buffer_end - s->buffer) return; #endif - if (is_le) +#ifdef BITSTREAM_READER_LE s->cache = AV_RL64(s->buffer + (s->index >> 3)); - else +#else s->cache = AV_RB64(s->buffer + (s->index >> 3)); +#endif s->index += 64; s->bits_left = 64; } @@ -378,16 +380,12 @@ static inline int get_sbits(GetBitContext *s, int n) */ static inline unsigned int get_bits(GetBitContext *s, int n) { - register unsigned int tmp; + register int tmp; #if CACHED_BITSTREAM_READER av_assert2(n>0 && n<=32); if (n > s->bits_left) { -#ifdef BITSTREAM_READER_LE - refill_32(s, 1); -#else - refill_32(s, 0); -#endif + refill_32(s); if (s->bits_left < 32) s->bits_left = n; } @@ -405,7 +403,6 @@ static inline unsigned int get_bits(GetBitContext *s, int n) LAST_SKIP_BITS(re, s, n); CLOSE_READER(re, s); #endif - av_assert2(tmp < UINT64_C(1) << n); return tmp; } @@ -422,7 +419,7 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n) #if CACHED_BITSTREAM_READER av_assert2(n>0 && n<=32); if (n > s->bits_left) { - refill_32(s, 1); + refill_32(s); if (s->bits_left < 32) s->bits_left = n; } @@ -445,14 +442,10 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n) */ static inline unsigned int show_bits(GetBitContext *s, int n) { - register unsigned int tmp; + register int tmp; #if CACHED_BITSTREAM_READER if (n > s->bits_left) -#ifdef BITSTREAM_READER_LE - refill_32(s, 1); -#else - refill_32(s, 0); -#endif + refill_32(s); tmp = show_val(s, n); #else @@ -480,11 +473,7 @@ static inline void skip_bits(GetBitContext *s, int n) n -= skip; s->index += skip; } -#ifdef BITSTREAM_READER_LE - refill_64(s, 1); -#else - refill_64(s, 0); -#endif + refill_64(s); if (n) skip_remaining(s, n); } @@ -499,11 +488,7 @@ static inline unsigned int get_bits1(GetBitContext *s) { #if CACHED_BITSTREAM_READER if (!s->bits_left) -#ifdef BITSTREAM_READER_LE - refill_64(s, 1); -#else - refill_64(s, 0); -#endif + refill_64(s); #ifdef BITSTREAM_READER_LE return get_val(s, 1, 1); @@ -619,8 +604,16 @@ static inline int check_marker(void *logctx, GetBitContext *s, const char *msg) return bit; } -static inline int init_get_bits_xe(GetBitContext *s, const uint8_t *buffer, - int bit_size, int is_le) +/** + * Initialize GetBitContext. + * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes + * larger than the actual read bits because some optimized bitstream + * readers read 32 or 64 bit at once and could read over the end + * @param bit_size the size of the buffer in bits + * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. + */ +static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, + int bit_size) { int buffer_size; int ret = 0; @@ -640,32 +633,12 @@ static inline int init_get_bits_xe(GetBitContext *s, const uint8_t *buffer, s->index = 0; #if CACHED_BITSTREAM_READER - s->cache = 0; - s->bits_left = 0; - refill_64(s, is_le); + refill_64(s); #endif return ret; } -/** - * Initialize GetBitContext. - * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes - * larger than the actual read bits because some optimized bitstream - * readers read 32 or 64 bit at once and could read over the end - * @param bit_size the size of the buffer in bits - * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. - */ -static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, - int bit_size) -{ -#ifdef BITSTREAM_READER_LE - return init_get_bits_xe(s, buffer, bit_size, 1); -#else - return init_get_bits_xe(s, buffer, bit_size, 0); -#endif -} - /** * Initialize GetBitContext. * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes @@ -682,14 +655,6 @@ static inline int init_get_bits8(GetBitContext *s, const uint8_t *buffer, return init_get_bits(s, buffer, byte_size * 8); } -static inline int init_get_bits8_le(GetBitContext *s, const uint8_t *buffer, - int byte_size) -{ - if (byte_size > INT_MAX / 8 || byte_size < 0) - byte_size = -1; - return init_get_bits_xe(s, buffer, byte_size * 8, 1); -} - static inline const uint8_t *align_get_bits(GetBitContext *s) { int n = -get_bits_count(s) & 7; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/golomb.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/golomb.h index 5cdfa0945d..6b11e48793 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/golomb.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/golomb.h @@ -478,19 +478,15 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, return buf; } else { int i; - for (i = 0; i + MIN_CACHE_BITS <= limit && SHOW_UBITS(re, gb, MIN_CACHE_BITS) == 0; i += MIN_CACHE_BITS) { + for (i = 0; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) { if (gb->size_in_bits <= re_index) { CLOSE_READER(re, gb); return -1; } - LAST_SKIP_BITS(re, gb, MIN_CACHE_BITS); + LAST_SKIP_BITS(re, gb, 1); UPDATE_CACHE(re, gb); } - for (; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) { - SKIP_BITS(re, gb, 1); - } - LAST_SKIP_BITS(re, gb, 1); - UPDATE_CACHE(re, gb); + SKIP_BITS(re, gb, 1); if (i < limit - 1) { if (k) { diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/internal.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/internal.h index 5096ffa1d9..0c2133f092 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/internal.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/internal.h @@ -218,14 +218,6 @@ typedef struct AVCodecInternal { /* to prevent infinite loop on errors when draining */ int nb_draining_errors; - - /* used when avctx flag AV_CODEC_FLAG_DROPCHANGED is set */ - int changed_frames_dropped; - int initial_format; - int initial_width, initial_height; - int initial_sample_rate; - int initial_channels; - uint64_t initial_channel_layout; } AVCodecInternal; struct AVCodecDefault { @@ -412,18 +404,6 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len, */ int64_t ff_guess_coded_bitrate(AVCodecContext *avctx); -/** - * Check if a value is in the list. If not, return the default value - * - * @param ctx Context for the log msg - * @param val_name Name of the checked value, for log msg - * @param array_valid_values Array of valid int, ended with INT_MAX - * @param default_value Value return if checked value is not in the array - * @return Value or default_value. - */ -int ff_int_from_list_or_default(void *ctx, const char * val_name, int val, - const int * array_valid_values, int default_value); - #if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec) # define av_export_avcodec __declspec(dllimport) #else diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusdec.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusdec.c index 1724a49906..2a97811d18 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusdec.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusdec.c @@ -63,8 +63,6 @@ static av_cold int libopus_decode_init(AVCodecContext *avc) avc->sample_rate = 48000; avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ? AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16; - avc->channel_layout = avc->channels > 8 ? 0 : - ff_vorbis_channel_layouts[avc->channels - 1]; if (avc->extradata_size >= OPUS_HEAD_SIZE) { opus->pre_skip = AV_RL16(avc->extradata + 10); @@ -88,14 +86,35 @@ static av_cold int libopus_decode_init(AVCodecContext *avc) mapping = mapping_arr; } - if (avc->channels > 2 && avc->channels <= 8) { - const uint8_t *vorbis_offset = ff_vorbis_channel_layout_offsets[avc->channels - 1]; - int ch; - - /* Remap channels from Vorbis order to ffmpeg order */ - for (ch = 0; ch < avc->channels; ch++) - mapping_arr[ch] = mapping[vorbis_offset[ch]]; - mapping = mapping_arr; + if (channel_map == 1) { + avc->channel_layout = avc->channels > 8 ? 0 : + ff_vorbis_channel_layouts[avc->channels - 1]; + if (avc->channels > 2 && avc->channels <= 8) { + const uint8_t *vorbis_offset = ff_vorbis_channel_layout_offsets[avc->channels - 1]; + int ch; + + /* Remap channels from Vorbis order to ffmpeg order */ + for (ch = 0; ch < avc->channels; ch++) + mapping_arr[ch] = mapping[vorbis_offset[ch]]; + mapping = mapping_arr; + } + } else if (channel_map == 2) { + int ambisonic_order = ff_sqrt(avc->channels) - 1; + if (avc->channels != (ambisonic_order + 1) * (ambisonic_order + 1) && + avc->channels != (ambisonic_order + 1) * (ambisonic_order + 1) + 2) { + av_log(avc, AV_LOG_ERROR, + "Channel mapping 2 is only specified for channel counts" + " which can be written as (n + 1)^2 or (n + 2)^2 + 2" + " for nonnegative integer n\n"); + return AVERROR_INVALIDDATA; + } + if (avc->channels > 227) { + av_log(avc, AV_LOG_ERROR, "Too many channels\n"); + return AVERROR_INVALIDDATA; + } + avc->channel_layout = 0; + } else { + avc->channel_layout = 0; } opus->dec = opus_multistream_decoder_create(avc->sample_rate, avc->channels, diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusenc.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusenc.c index 7c025a66d7..13017ac323 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusenc.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/libopusenc.c @@ -503,7 +503,6 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, // Check if subtraction resulted in an overflow if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) { av_packet_unref(avpkt); - av_free(avpkt); return AVERROR(EINVAL); } if (discard_padding > 0) { @@ -512,7 +511,6 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt, 10); if(!side_data) { av_packet_unref(avpkt); - av_free(avpkt); return AVERROR(ENOMEM); } AV_WL32(side_data + 4, discard_padding); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mediacodec_wrapper.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mediacodec_wrapper.h index b106ff315a..f0de16d669 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mediacodec_wrapper.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mediacodec_wrapper.h @@ -26,8 +26,6 @@ #include #include -#include "avcodec.h" - /** * The following API around MediaCodec and MediaFormat is based on the * NDK one provided by Google since Android 5.0. diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/motion_est.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/motion_est.c index 759eea479d..8b5ce2117a 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/motion_est.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/motion_est.c @@ -633,7 +633,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) if(P[i][1] > (c->ymax<ymax<p_mv_table, (1<<16)>>shift, 1); + dmin4 = epzs_motion_search4(s, &mx4, &my4, P, block, block, s->p_mv_table, (1<<16)>>shift); dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h); @@ -795,7 +795,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index, P_MV1[0]= mx; //FIXME not correct if block != field_select P_MV1[1]= my / 2; - dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1, 0); + dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1); dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpeg4audio.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpeg4audio.c index 219714752f..2dbd972eaf 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpeg4audio.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpeg4audio.c @@ -93,6 +93,10 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, c->chan_config = get_bits(gb, 4); if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) c->channels = ff_mpeg4audio_channels[c->chan_config]; + else { + av_log(NULL, AV_LOG_ERROR, "Invalid chan_config %d\n", c->chan_config); + return AVERROR_INVALIDDATA; + } c->sbr = -1; c->ps = -1; if (c->object_type == AOT_SBR || (c->object_type == AOT_PS && diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.c index dbb6ab9b39..d4d3bea649 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.c @@ -538,8 +538,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, s->avctx->width = s1->avctx->width; s->avctx->height = s1->avctx->height; - s->quarter_sample = s1->quarter_sample; - s->coded_picture_number = s1->coded_picture_number; s->picture_number = s1->picture_number; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.h index e1ff5f97dc..bbc6b5646a 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/mpegvideo.h @@ -455,7 +455,6 @@ typedef struct MpegEncContext { /* MPEG-2-specific - I wished not to have to support this mess. */ int progressive_sequence; int mpeg_f_code[2][2]; - int a53_cc; // picture structure defines are loaded from mpegutils.h int picture_structure; @@ -664,7 +663,6 @@ FF_MPV_OPT_CMP_FUNC, \ {"ps", "RTP payload size in bytes", FF_MPV_OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \ {"mepc", "Motion estimation bitrate penalty compensation (1.0 = 256)", FF_MPV_OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \ {"mepre", "pre motion estimation", FF_MPV_OFFSET(me_pre), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \ -{"a53cc", "Use A53 Closed Captions (if available)", FF_MPV_OFFSET(a53_cc), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FF_MPV_OPT_FLAGS }, \ extern const AVOption ff_mpv_generic_options[]; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options.c index 35e8ac9313..41b60521cc 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options.c @@ -347,3 +347,172 @@ const AVClass *avcodec_get_subtitle_rect_class(void) { return &av_subtitle_rect_class; } + +#ifdef TEST +static int dummy_init(AVCodecContext *ctx) +{ + //TODO: this code should set every possible pointer that could be set by codec and is not an option; + ctx->extradata_size = 8; + ctx->extradata = av_malloc(ctx->extradata_size); + return 0; +} + +static int dummy_close(AVCodecContext *ctx) +{ + av_freep(&ctx->extradata); + ctx->extradata_size = 0; + return 0; +} + +static int dummy_encode(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) +{ + return AVERROR(ENOSYS); +} + +typedef struct Dummy12Context { + AVClass *av_class; + int num; + char* str; +} Dummy12Context; + +typedef struct Dummy3Context { + void *fake_av_class; + int num; + char* str; +} Dummy3Context; + +#define OFFSET(x) offsetof(Dummy12Context, x) +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM +static const AVOption dummy_options[] = { + { "str", "set str", OFFSET(str), AV_OPT_TYPE_STRING, { .str = "i'm src default value" }, 0, 0, VE}, + { "num", "set num", OFFSET(num), AV_OPT_TYPE_INT, { .i64 = 1500100900 }, 0, INT_MAX, VE}, + { NULL }, +}; + +static const AVClass dummy_v1_class = { + .class_name = "dummy_v1_class", + .item_name = av_default_item_name, + .option = dummy_options, + .version = LIBAVUTIL_VERSION_INT, +}; + +static const AVClass dummy_v2_class = { + .class_name = "dummy_v2_class", + .item_name = av_default_item_name, + .option = dummy_options, + .version = LIBAVUTIL_VERSION_INT, +}; + +/* codec with options */ +static AVCodec dummy_v1_encoder = { + .name = "dummy_v1_codec", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_NONE - 1, + .encode2 = dummy_encode, + .init = dummy_init, + .close = dummy_close, + .priv_class = &dummy_v1_class, + .priv_data_size = sizeof(Dummy12Context), +}; + +/* codec with options, different class */ +static AVCodec dummy_v2_encoder = { + .name = "dummy_v2_codec", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_NONE - 2, + .encode2 = dummy_encode, + .init = dummy_init, + .close = dummy_close, + .priv_class = &dummy_v2_class, + .priv_data_size = sizeof(Dummy12Context), +}; + +/* codec with priv data, but no class */ +static AVCodec dummy_v3_encoder = { + .name = "dummy_v3_codec", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_NONE - 3, + .encode2 = dummy_encode, + .init = dummy_init, + .close = dummy_close, + .priv_data_size = sizeof(Dummy3Context), +}; + +/* codec without priv data */ +static AVCodec dummy_v4_encoder = { + .name = "dummy_v4_codec", + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_NONE - 4, + .encode2 = dummy_encode, + .init = dummy_init, + .close = dummy_close, +}; + +static void test_copy_print_codec(const AVCodecContext *ctx) +{ + printf("%-14s: %dx%d prv: %s", + ctx->codec ? ctx->codec->name : "NULL", + ctx->width, ctx->height, + ctx->priv_data ? "set" : "null"); + if (ctx->codec && ctx->codec->priv_class && ctx->codec->priv_data_size) { + int64_t i64; + char *str = NULL; + av_opt_get_int(ctx->priv_data, "num", 0, &i64); + av_opt_get(ctx->priv_data, "str", 0, (uint8_t**)&str); + printf(" opts: %"PRId64" %s", i64, str); + av_free(str); + } + printf("\n"); +} + +static void test_copy(const AVCodec *c1, const AVCodec *c2) +{ + AVCodecContext *ctx1, *ctx2; + printf("%s -> %s\nclosed:\n", c1 ? c1->name : "NULL", c2 ? c2->name : "NULL"); + ctx1 = avcodec_alloc_context3(c1); + ctx2 = avcodec_alloc_context3(c2); + ctx1->width = ctx1->height = 128; + if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) { + av_opt_set(ctx2->priv_data, "num", "667", 0); + av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0); + } + avcodec_copy_context(ctx2, ctx1); + test_copy_print_codec(ctx1); + test_copy_print_codec(ctx2); + if (ctx1->codec) { + printf("opened:\n"); + avcodec_open2(ctx1, ctx1->codec, NULL); + if (ctx2->codec && ctx2->codec->priv_class && ctx2->codec->priv_data_size) { + av_opt_set(ctx2->priv_data, "num", "667", 0); + av_opt_set(ctx2->priv_data, "str", "i'm dest value before copy", 0); + } + avcodec_copy_context(ctx2, ctx1); + test_copy_print_codec(ctx1); + test_copy_print_codec(ctx2); + avcodec_close(ctx1); + } + avcodec_free_context(&ctx1); + avcodec_free_context(&ctx2); +} + +int main(void) +{ + AVCodec *dummy_codec[] = { + &dummy_v1_encoder, + &dummy_v2_encoder, + &dummy_v3_encoder, + &dummy_v4_encoder, + NULL, + }; + int i, j; + + for (i = 0; dummy_codec[i]; i++) + avcodec_register(dummy_codec[i]); + + printf("testing avcodec_copy_context()\n"); + for (i = 0; i < FF_ARRAY_ELEMS(dummy_codec); i++) + for (j = 0; j < FF_ARRAY_ELEMS(dummy_codec); j++) + test_copy(dummy_codec[i], dummy_codec[j]); + return 0; +} +#endif diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options_table.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options_table.h index 4a266eca16..099261e168 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options_table.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/options_table.h @@ -67,8 +67,6 @@ static const AVOption avcodec_options[] = { {"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"}, {"cgop", "closed GOP", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"}, {"output_corrupt", "Output even potentially corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_OUTPUT_CORRUPT }, INT_MIN, INT_MAX, V|D, "flags"}, -{"drop_changed", "Drop frames whose parameters differ from first decoded frame", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_DROPCHANGED }, INT_MIN, INT_MAX, A|V|D, "flags"}, -{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"}, {"fast", "allow non-spec-compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"}, {"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"}, {"ignorecrop", "ignore cropping information from sps", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_IGNORE_CROP }, INT_MIN, INT_MAX, V|D, "flags2"}, @@ -219,11 +217,34 @@ static const AVOption avcodec_options[] = { {"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"}, {"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|A|D, "debug"}, {"nomc", "skip motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_NOMC }, INT_MIN, INT_MAX, V|A|D, "debug"}, +{"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"ildctcmp", "interlaced DCT compare function", OFFSET(ildct_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #if FF_API_PRIVATE_OPT {"preme", "pre motion estimation", OFFSET(pre_me), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif +{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"sad", "sum of absolute differences, fast", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"sse", "sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"satd", "sum of absolute Hadamard transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SATD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"dct", "sum of absolute DCT transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_PSNR }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"bit", "number of bits needed for the block", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_BIT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"rd", "rate distortion optimal, slow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_RD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"zero", "0", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_ZERO }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"vsad", "sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"vsse", "sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"nsse", "noise preserving sum of squared differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +#if CONFIG_SNOW_ENCODER +{"w53", "5/3 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"w97", "9/7 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +#endif +{"dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_CHROMA }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"msad", "sum of absolute differences, median predicted", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_MEDIAN_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"subq", "sub-pel motion estimation quality", OFFSET(me_subpel_quality), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E}, {"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, @@ -250,6 +271,7 @@ static const AVOption avcodec_options[] = { {"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif {"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"}, {"threads", "set the number of threads", OFFSET(thread_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, V|A|E|D, "threads"}, {"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"}, {"dc", "intra_dc_precision", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.i64 = 0 }, -8, 16, V|E}, @@ -288,29 +310,6 @@ static const AVOption avcodec_options[] = { {"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, #endif -{"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"ildctcmp", "interlaced DCT compare function", OFFSET(ildct_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sad", "sum of absolute differences, fast", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sse", "sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"satd", "sum of absolute Hadamard transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SATD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"dct", "sum of absolute DCT transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_PSNR }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"bit", "number of bits needed for the block", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_BIT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"rd", "rate distortion optimal, slow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_RD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"zero", "0", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_ZERO }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsad", "sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsse", "sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"nsse", "noise preserving sum of squared differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -#if CONFIG_SNOW_ENCODER -{"w53", "5/3 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"w97", "9/7 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -#endif -{"dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_CHROMA }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"msad", "sum of absolute differences, median predicted", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_MEDIAN_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"mblmin", "minimum macroblock Lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E}, {"mblmax", "maximum macroblock Lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E}, #if FF_API_PRIVATE_OPT @@ -480,7 +479,6 @@ static const AVOption avcodec_options[] = { {"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, {"extra_hw_frames", "Number of extra hardware frames to allocate for the user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, V|D }, -{"discard_damaged_percentage", "Percentage of damaged samples to discard a frame", OFFSET(discard_damaged_percentage), AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 100, V|D }, {NULL}, }; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.c index f74278a7e3..aa827b604c 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.c @@ -31,7 +31,6 @@ #include "opus_celt.h" #include "opustab.h" -#include "internal.h" #include "vorbis.h" static const uint16_t opus_frame_duration[32] = { @@ -327,8 +326,6 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx, } avctx->delay = AV_RL16(extradata + 10); - if (avctx->internal) - avctx->internal->skip_samples = avctx->delay; channels = avctx->extradata ? extradata[9] : (avctx->channels == 1) ? 1 : 2; if (!channels) { diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.h index 63ecd0aff7..edbaab5ce7 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus.h @@ -112,7 +112,7 @@ typedef struct OpusStreamContext { DECLARE_ALIGNED(32, float, celt_buf)[2][960]; float *celt_output[2]; - DECLARE_ALIGNED(32, float, redundancy_buf)[2][960]; + float redundancy_buf[2][960]; float *redundancy_output[2]; /* data buffers for the final output data */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.c index 4655172b09..115dd8c63e 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.c @@ -202,10 +202,40 @@ static void celt_postfilter_apply_transition(CeltBlock *block, float *data) } } +static void celt_postfilter_apply(CeltBlock *block, float *data, int len) +{ + const int T = block->pf_period; + float g0, g1, g2; + float x0, x1, x2, x3, x4; + int i; + + if (block->pf_gains[0] == 0.0 || len <= 0) + return; + + g0 = block->pf_gains[0]; + g1 = block->pf_gains[1]; + g2 = block->pf_gains[2]; + + x4 = data[-T - 2]; + x3 = data[-T - 1]; + x2 = data[-T]; + x1 = data[-T + 1]; + + for (i = 0; i < len; i++) { + x0 = data[i - T + 2]; + data[i] += g0 * x2 + + g1 * (x1 + x3) + + g2 * (x0 + x4); + x4 = x3; + x3 = x2; + x2 = x1; + x1 = x0; + } +} + static void celt_postfilter(CeltFrame *f, CeltBlock *block) { int len = f->blocksize * f->blocks; - const int filter_len = len - 2 * CELT_OVERLAP; celt_postfilter_apply_transition(block, block->buf + 1024); @@ -217,11 +247,8 @@ static void celt_postfilter(CeltFrame *f, CeltBlock *block) if (len > CELT_OVERLAP) { celt_postfilter_apply_transition(block, block->buf + 1024 + CELT_OVERLAP); - - if (block->pf_gains[0] > FLT_EPSILON && filter_len > 0) - f->opusdsp.postfilter(block->buf + 1024 + 2 * CELT_OVERLAP, - block->pf_period, block->pf_gains, - filter_len); + celt_postfilter_apply(block, block->buf + 1024 + 2 * CELT_OVERLAP, + len - 2 * CELT_OVERLAP); block->pf_period_old = block->pf_period; memcpy(block->pf_gains_old, block->pf_gains, sizeof(block->pf_gains)); @@ -435,6 +462,7 @@ int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc, /* transform and output for each output channel */ for (i = 0; i < f->output_channels; i++) { CeltBlock *block = &f->block[i]; + float m = block->emph_coeff; /* iMDCT and overlap-add */ for (j = 0; j < f->blocks; j++) { @@ -452,10 +480,14 @@ int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc, /* postfilter */ celt_postfilter(f, block); - /* deemphasis */ - block->emph_coeff = f->opusdsp.deemphasis(output[i], - &block->buf[1024 - frame_size], - block->emph_coeff, frame_size); + /* deemphasis and output scaling */ + for (j = 0; j < frame_size; j++) { + const float tmp = block->buf[1024 - frame_size + j] + m; + m = tmp * CELT_EMPH_COEFF; + output[i][j] = tmp; + } + + block->emph_coeff = m; } if (channels == 1) @@ -564,7 +596,6 @@ int ff_celt_init(AVCodecContext *avctx, CeltFrame **f, int output_channels, goto fail; } - ff_opus_dsp_init(&frm->opusdsp); ff_celt_flush(frm); *f = frm; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.h index 7c1c5316b9..9289a1867a 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_celt.h @@ -28,7 +28,6 @@ #include "opus.h" #include "opus_pvq.h" -#include "opusdsp.h" #include "mdct15.h" #include "libavutil/float_dsp.h" @@ -41,6 +40,7 @@ #define CELT_NORM_SCALE 16384 #define CELT_QTHETA_OFFSET 4 #define CELT_QTHETA_OFFSET_TWOPHASE 16 +#define CELT_EMPH_COEFF 0.85000610f #define CELT_POSTFILTER_MINPERIOD 15 #define CELT_ENERGY_SILENCE (-28.0f) @@ -96,7 +96,6 @@ struct CeltFrame { AVFloatDSPContext *dsp; CeltBlock block[2]; CeltPVQ *pvq; - OpusDSP opusdsp; int channels; int output_channels; int apply_phase_inv; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.c index 9c21d67298..0dbf14184d 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.c @@ -903,8 +903,8 @@ int av_cold ff_celt_pvq_init(CeltPVQ **pvq, int encode) s->pvq_search = ppp_pvq_search_c; s->quant_band = encode ? pvq_encode_band : pvq_decode_band; - if (CONFIG_OPUS_ENCODER && ARCH_X86) - ff_celt_pvq_init_x86(s); + if (ARCH_X86) + ff_opus_dsp_init_x86(s); *pvq = s; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.h index 52f9a4e6d4..e2f01a01b5 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_pvq.h @@ -40,7 +40,7 @@ struct CeltPVQ { QUANT_FN(*quant_band); }; -void ff_celt_pvq_init_x86(struct CeltPVQ *s); +void ff_opus_dsp_init_x86(struct CeltPVQ *s); int ff_celt_pvq_init(struct CeltPVQ **pvq, int encode); void ff_celt_pvq_uninit(struct CeltPVQ **pvq); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_rc.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_rc.c index c432eb90c9..3972bb0b02 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_rc.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opus_rc.c @@ -167,7 +167,7 @@ void ff_opus_rc_put_raw(OpusRangeCoder *rc, uint32_t val, uint32_t count) rc->rb.cachelen = (rc->rb.cachelen + to_write) % 32; if (!rc->rb.cachelen && count) { - AV_WB32((uint8_t *)rc->rb.position, rc->rb.cacheval); + AV_WB32(rc->rb.position, rc->rb.cacheval); rc->rb.bytes += 4; rc->rb.position -= 4; rc->rb.cachelen = count - to_write; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opusenc.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opusenc.c index 3c08ebcf69..578785f4b4 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opusenc.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/opusenc.c @@ -543,7 +543,7 @@ static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame)); } else { ff_opus_psy_signal_eof(&s->psyctx); - if (!s->afq.remaining_samples || !avctx->frame_number) + if (!s->afq.remaining_samples) return 0; /* We've been flushed and there's nothing left to encode */ } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/parsers.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/parsers.c index 33a71de8a0..f01cad4c84 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/parsers.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/parsers.c @@ -40,9 +40,7 @@ extern AVCodecParser ff_dvbsub_parser; extern AVCodecParser ff_dvdsub_parser; extern AVCodecParser ff_dvd_nav_parser; extern AVCodecParser ff_flac_parser; -extern AVCodecParser ff_g723_1_parser; extern AVCodecParser ff_g729_parser; -extern AVCodecParser ff_gif_parser; extern AVCodecParser ff_gsm_parser; extern AVCodecParser ff_h261_parser; extern AVCodecParser ff_h263_parser; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.c index eaf0d68d32..c31399f83e 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.c @@ -151,29 +151,4 @@ const AVProfile ff_sbc_profiles[] = { { FF_PROFILE_UNKNOWN }, }; -const AVProfile ff_prores_profiles[] = { - { FF_PROFILE_PRORES_PROXY, "Proxy" }, - { FF_PROFILE_PRORES_LT, "LT" }, - { FF_PROFILE_PRORES_STANDARD, "Standard" }, - { FF_PROFILE_PRORES_HQ, "HQ" }, - { FF_PROFILE_PRORES_4444, "4444" }, - { FF_PROFILE_PRORES_XQ, "XQ" }, - { FF_PROFILE_UNKNOWN } -}; - -const AVProfile ff_mjpeg_profiles[] = { - { FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT, "Baseline" }, - { FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT, "Sequential" }, - { FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT, "Progressive" }, - { FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS, "Lossless" }, - { FF_PROFILE_MJPEG_JPEG_LS, "JPEG LS" }, - { FF_PROFILE_UNKNOWN } -}; - -const AVProfile ff_arib_caption_profiles[] = { - { FF_PROFILE_ARIB_PROFILE_A, "Profile A" }, - { FF_PROFILE_ARIB_PROFILE_C, "Profile C" }, - { FF_PROFILE_UNKNOWN } -}; - #endif /* !CONFIG_SMALL */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.h index a53b67e7f2..9d7e211e15 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/profiles.h @@ -33,8 +33,5 @@ extern const AVProfile ff_vc1_profiles[]; extern const AVProfile ff_vp9_profiles[]; extern const AVProfile ff_av1_profiles[]; extern const AVProfile ff_sbc_profiles[]; -extern const AVProfile ff_prores_profiles[]; -extern const AVProfile ff_mjpeg_profiles[]; -extern const AVProfile ff_arib_caption_profiles[]; #endif /* AVCODEC_PROFILES_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/raw.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/raw.c index b6fb91c1c6..d731c087d1 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/raw.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/raw.c @@ -177,10 +177,6 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = { { AV_PIX_FMT_YUVA422P10BE, MKTAG(10 , 10 , '4', 'Y') }, { AV_PIX_FMT_YUVA444P10LE, MKTAG('Y', '4', 0 , 10 ) }, { AV_PIX_FMT_YUVA444P10BE, MKTAG(10 , 0 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P12LE, MKTAG('Y', '4', 10 , 12 ) }, - { AV_PIX_FMT_YUVA422P12BE, MKTAG(12 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P12LE, MKTAG('Y', '4', 0 , 12 ) }, - { AV_PIX_FMT_YUVA444P12BE, MKTAG(12 , 0 , '4', 'Y') }, { AV_PIX_FMT_YUVA420P16LE, MKTAG('Y', '4', 11 , 16 ) }, { AV_PIX_FMT_YUVA420P16BE, MKTAG(16 , 11 , '4', 'Y') }, { AV_PIX_FMT_YUVA422P16LE, MKTAG('Y', '4', 10 , 16 ) }, diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/utils.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/utils.c index a6a646636d..cba04a2f59 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/utils.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/utils.c @@ -214,8 +214,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, case AV_PIX_FMT_YUVA422P9BE: case AV_PIX_FMT_YUVA422P10LE: case AV_PIX_FMT_YUVA422P10BE: - case AV_PIX_FMT_YUVA422P12LE: - case AV_PIX_FMT_YUVA422P12BE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA422P16BE: case AV_PIX_FMT_YUV440P10LE: @@ -236,8 +234,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, case AV_PIX_FMT_YUVA444P9BE: case AV_PIX_FMT_YUVA444P10LE: case AV_PIX_FMT_YUVA444P10BE: - case AV_PIX_FMT_YUVA444P12LE: - case AV_PIX_FMT_YUVA444P12BE: case AV_PIX_FMT_YUVA444P16LE: case AV_PIX_FMT_YUVA444P16BE: case AV_PIX_FMT_GBRP9LE: @@ -412,7 +408,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, void ff_color_frame(AVFrame *frame, const int c[4]) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); - int p, y, x; + int p, y; av_assert0(desc->flags & AV_PIX_FMT_FLAG_PLANAR); @@ -421,13 +417,19 @@ void ff_color_frame(AVFrame *frame, const int c[4]) int is_chroma = p == 1 || p == 2; int bytes = is_chroma ? AV_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width; int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height; - for (y = 0; y < height; y++) { - if (desc->comp[0].depth >= 9) { - for (x = 0; xcomp[0].depth >= 9) { + ((uint16_t*)dst)[0] = c[p]; + av_memcpy_backptr(dst + 2, 2, bytes - 2); dst += frame->linesize[p]; + for (y = 1; y < height; y++) { + memcpy(dst, frame->data[p], 2*bytes); + dst += frame->linesize[p]; + } + } else { + for (y = 0; y < height; y++) { + memset(dst, c[p], bytes); + dst += frame->linesize[p]; + } } } } @@ -678,8 +680,18 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); - if (avctx->channels > FF_SANE_NB_CHANNELS) { - av_log(avctx, AV_LOG_ERROR, "Too many channels: %d\n", avctx->channels); + if (avctx->channels > FF_SANE_NB_CHANNELS || avctx->channels < 0) { + av_log(avctx, AV_LOG_ERROR, "Too many or invalid channels: %d\n", avctx->channels); + ret = AVERROR(EINVAL); + goto free_and_end; + } + if (avctx->sample_rate < 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", avctx->sample_rate); + ret = AVERROR(EINVAL); + goto free_and_end; + } + if (avctx->block_align < 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid block align: %d\n", avctx->block_align); ret = AVERROR(EINVAL); goto free_and_end; } @@ -1029,6 +1041,9 @@ FF_ENABLE_DEPRECATION_WARNINGS (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP))) avctx->codec->close(avctx); + if (HAVE_THREADS && avctx->internal->thread_ctx) + ff_thread_free(avctx); + if (codec->priv_class && codec->priv_data_size) av_opt_free(avctx->priv_data); av_opt_free(avctx); @@ -1409,8 +1424,10 @@ const char *avcodec_profile_name(enum AVCodecID codec_id, int profile) unsigned avcodec_version(void) { +// av_assert0(AV_CODEC_ID_V410==164); av_assert0(AV_CODEC_ID_PCM_S8_PLANAR==65563); av_assert0(AV_CODEC_ID_ADPCM_G722==69660); +// av_assert0(AV_CODEC_ID_BMV_AUDIO==86071); av_assert0(AV_CODEC_ID_SRT==94216); av_assert0(LIBAVCODEC_VERSION_MICRO >= 100); @@ -1605,6 +1622,8 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, return 256 * (frame_bytes / 64); if (id == AV_CODEC_ID_RA_144) return 160 * (frame_bytes / 20); + if (id == AV_CODEC_ID_G723_1) + return 240 * (frame_bytes / 24); if (bps > 0) { /* calc from frame_bytes and bits_per_coded_sample */ @@ -2213,22 +2232,3 @@ int64_t ff_guess_coded_bitrate(AVCodecContext *avctx) return bitrate; } - -int ff_int_from_list_or_default(void *ctx, const char * val_name, int val, - const int * array_valid_values, int default_value) -{ - int i = 0, ref_val; - - while (1) { - ref_val = array_valid_values[i]; - if (ref_val == INT_MAX) - break; - if (val == ref_val) - return val; - i++; - } - /* val is not a valid value */ - av_log(ctx, AV_LOG_DEBUG, - "%s %d are not supported. Set to default value : %d\n", val_name, val, default_value); - return default_value; -} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/version.h b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/version.h index 3331d47300..782ba978b3 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/version.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 54 +#define LIBAVCODEC_VERSION_MINOR 35 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -132,9 +132,6 @@ #ifndef FF_API_NEXT #define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59) #endif -#ifndef FF_API_UNSANITIZED_BITRATES -#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59) -#endif #endif /* AVCODEC_VERSION_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/Makefile index 194135dafb..2350c8bbee 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/Makefile +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/Makefile @@ -53,11 +53,10 @@ OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp.o OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o x86/synth_filter_init.o OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc_init.o OBJS-$(CONFIG_EXR_DECODER) += x86/exrdsp_init.o -OBJS-$(CONFIG_OPUS_DECODER) += x86/opusdsp_init.o -OBJS-$(CONFIG_OPUS_ENCODER) += x86/celt_pvq_init.o +OBJS-$(CONFIG_OPUS_DECODER) += x86/opus_dsp_init.o +OBJS-$(CONFIG_OPUS_ENCODER) += x86/opus_dsp_init.o OBJS-$(CONFIG_HEVC_DECODER) += x86/hevcdsp_init.o OBJS-$(CONFIG_JPEG2000_DECODER) += x86/jpeg2000dsp_init.o -OBJS-$(CONFIG_LSCR_DECODER) += x86/pngdsp_init.o OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp_init.o OBJS-$(CONFIG_MPEG4_DECODER) += x86/xvididct_init.o OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.o @@ -128,8 +127,7 @@ X86ASM-OBJS-$(CONFIG_MDCT15) += x86/mdct15.o X86ASM-OBJS-$(CONFIG_ME_CMP) += x86/me_cmp.o X86ASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36.o X86ASM-OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoencdsp.o -X86ASM-OBJS-$(CONFIG_OPUS_DECODER) += x86/opusdsp.o -X86ASM-OBJS-$(CONFIG_OPUS_ENCODER) += x86/celt_pvq_search.o +X86ASM-OBJS-$(CONFIG_OPUS_ENCODER) += x86/opus_pvq_search.o X86ASM-OBJS-$(CONFIG_PIXBLOCKDSP) += x86/pixblockdsp.o X86ASM-OBJS-$(CONFIG_QPELDSP) += x86/qpeldsp.o \ x86/fpel.o \ @@ -169,7 +167,6 @@ X86ASM-OBJS-$(CONFIG_HEVC_DECODER) += x86/hevc_add_res.o \ x86/hevc_sao.o \ x86/hevc_sao_10bit.o X86ASM-OBJS-$(CONFIG_JPEG2000_DECODER) += x86/jpeg2000dsp.o -X86ASM-OBJS-$(CONFIG_LSCR_DECODER) += x86/pngdsp.o X86ASM-OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o X86ASM-OBJS-$(CONFIG_MPEG4_DECODER) += x86/xvididct.o X86ASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/h264dsp_init.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/h264dsp_init.c index 08eb7ead44..39f65c151f 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/h264dsp_init.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/h264dsp_init.c @@ -101,13 +101,13 @@ void ff_h264_loop_filter_strength_mmxext(int16_t bS[2][4][4], uint8_t nnz[40], #define LF_FUNC(DIR, TYPE, DEPTH, OPT) \ void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT(uint8_t *pix, \ - ptrdiff_t stride, \ + int stride, \ int alpha, \ int beta, \ int8_t *tc0); #define LF_IFUNC(DIR, TYPE, DEPTH, OPT) \ void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT(uint8_t *pix, \ - ptrdiff_t stride, \ + int stride, \ int alpha, \ int beta); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/proresdsp_init.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/proresdsp_init.c index bde79ab8c0..8ca4d4d9b3 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/proresdsp_init.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/proresdsp_init.c @@ -35,16 +35,14 @@ av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx) #if ARCH_X86_64 int cpu_flags = av_get_cpu_flags(); - if (avctx->bits_per_raw_sample == 10){ - if (EXTERNAL_SSE2(cpu_flags)) { - dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; - dsp->idct_put = ff_prores_idct_put_10_sse2; - } + if (EXTERNAL_SSE2(cpu_flags)) { + dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; + dsp->idct_put = ff_prores_idct_put_10_sse2; + } - if (EXTERNAL_AVX(cpu_flags)) { - dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; - dsp->idct_put = ff_prores_idct_put_10_avx; - } + if (EXTERNAL_AVX(cpu_flags)) { + dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; + dsp->idct_put = ff_prores_idct_put_10_avx; } #endif /* ARCH_X86_64 */ } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/v210-init.c b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/v210-init.c index cb9a6cbd6a..d64dbca1a8 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/v210-init.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavcodec/x86/v210-init.c @@ -21,11 +21,9 @@ extern void ff_v210_planar_unpack_unaligned_ssse3(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); extern void ff_v210_planar_unpack_unaligned_avx(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); -extern void ff_v210_planar_unpack_unaligned_avx2(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); extern void ff_v210_planar_unpack_aligned_ssse3(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); extern void ff_v210_planar_unpack_aligned_avx(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); -extern void ff_v210_planar_unpack_aligned_avx2(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); av_cold void ff_v210_x86_init(V210DecContext *s) { @@ -38,9 +36,6 @@ av_cold void ff_v210_x86_init(V210DecContext *s) if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX) s->unpack_frame = ff_v210_planar_unpack_aligned_avx; - - if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2) - s->unpack_frame = ff_v210_planar_unpack_aligned_avx2; } else { if (cpu_flags & AV_CPU_FLAG_SSSE3) @@ -48,9 +43,6 @@ av_cold void ff_v210_x86_init(V210DecContext *s) if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX) s->unpack_frame = ff_v210_planar_unpack_unaligned_avx; - - if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2) - s->unpack_frame = ff_v210_planar_unpack_unaligned_avx2; } #endif } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavdevice/alldevices.c b/trunk/3rdparty/ffmpeg-4-fit/libavdevice/alldevices.c index 8633433254..adde749ce1 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavdevice/alldevices.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavdevice/alldevices.c @@ -32,6 +32,8 @@ extern AVInputFormat ff_bktr_demuxer; extern AVOutputFormat ff_caca_muxer; extern AVInputFormat ff_decklink_demuxer; extern AVOutputFormat ff_decklink_muxer; +extern AVInputFormat ff_libndi_newtek_demuxer; +extern AVOutputFormat ff_libndi_newtek_muxer; extern AVInputFormat ff_dshow_demuxer; extern AVInputFormat ff_fbdev_demuxer; extern AVOutputFormat ff_fbdev_muxer; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavfilter/allfilters.c b/trunk/3rdparty/ffmpeg-4-fit/libavfilter/allfilters.c index 04a3df7d56..c40c7e3a3c 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavfilter/allfilters.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavfilter/allfilters.c @@ -55,7 +55,6 @@ extern AVFilter ff_af_ametadata; extern AVFilter ff_af_amix; extern AVFilter ff_af_amultiply; extern AVFilter ff_af_anequalizer; -extern AVFilter ff_af_anlmdn; extern AVFilter ff_af_anull; extern AVFilter ff_af_apad; extern AVFilter ff_af_aperms; @@ -72,9 +71,7 @@ extern AVFilter ff_af_asetrate; extern AVFilter ff_af_asettb; extern AVFilter ff_af_ashowinfo; extern AVFilter ff_af_asidedata; -extern AVFilter ff_af_asoftclip; extern AVFilter ff_af_asplit; -extern AVFilter ff_af_asr; extern AVFilter ff_af_astats; extern AVFilter ff_af_astreamselect; extern AVFilter ff_af_atempo; @@ -93,7 +90,6 @@ extern AVFilter ff_af_compensationdelay; extern AVFilter ff_af_crossfeed; extern AVFilter ff_af_crystalizer; extern AVFilter ff_af_dcshift; -extern AVFilter ff_af_deesser; extern AVFilter ff_af_drmeter; extern AVFilter ff_af_dynaudnorm; extern AVFilter ff_af_earwax; @@ -162,14 +158,11 @@ extern AVFilter ff_vf_boxblur_opencl; extern AVFilter ff_vf_bwdif; extern AVFilter ff_vf_chromahold; extern AVFilter ff_vf_chromakey; -extern AVFilter ff_vf_chromashift; extern AVFilter ff_vf_ciescope; extern AVFilter ff_vf_codecview; extern AVFilter ff_vf_colorbalance; extern AVFilter ff_vf_colorchannelmixer; extern AVFilter ff_vf_colorkey; -extern AVFilter ff_vf_colorkey_opencl; -extern AVFilter ff_vf_colorhold; extern AVFilter ff_vf_colorlevels; extern AVFilter ff_vf_colormatrix; extern AVFilter ff_vf_colorspace; @@ -189,7 +182,6 @@ extern AVFilter ff_vf_deband; extern AVFilter ff_vf_deblock; extern AVFilter ff_vf_decimate; extern AVFilter ff_vf_deconvolve; -extern AVFilter ff_vf_dedot; extern AVFilter ff_vf_deflate; extern AVFilter ff_vf_deflicker; extern AVFilter ff_vf_deinterlace_qsv; @@ -197,7 +189,6 @@ extern AVFilter ff_vf_deinterlace_vaapi; extern AVFilter ff_vf_dejudder; extern AVFilter ff_vf_delogo; extern AVFilter ff_vf_denoise_vaapi; -extern AVFilter ff_vf_derain; extern AVFilter ff_vf_deshake; extern AVFilter ff_vf_despill; extern AVFilter ff_vf_detelecine; @@ -231,7 +222,6 @@ extern AVFilter ff_vf_fps; extern AVFilter ff_vf_framepack; extern AVFilter ff_vf_framerate; extern AVFilter ff_vf_framestep; -extern AVFilter ff_vf_freezedetect; extern AVFilter ff_vf_frei0r; extern AVFilter ff_vf_fspp; extern AVFilter ff_vf_gblur; @@ -258,7 +248,6 @@ extern AVFilter ff_vf_inflate; extern AVFilter ff_vf_interlace; extern AVFilter ff_vf_interleave; extern AVFilter ff_vf_kerndeint; -extern AVFilter ff_vf_lagfun; extern AVFilter ff_vf_lenscorrection; extern AVFilter ff_vf_lensfun; extern AVFilter ff_vf_libvmaf; @@ -273,7 +262,6 @@ extern AVFilter ff_vf_lutrgb; extern AVFilter ff_vf_lutyuv; extern AVFilter ff_vf_maskedclamp; extern AVFilter ff_vf_maskedmerge; -extern AVFilter ff_vf_maskfun; extern AVFilter ff_vf_mcdeint; extern AVFilter ff_vf_mergeplanes; extern AVFilter ff_vf_mestimate; @@ -284,7 +272,6 @@ extern AVFilter ff_vf_mix; extern AVFilter ff_vf_mpdecimate; extern AVFilter ff_vf_negate; extern AVFilter ff_vf_nlmeans; -extern AVFilter ff_vf_nlmeans_opencl; extern AVFilter ff_vf_nnedi; extern AVFilter ff_vf_noformat; extern AVFilter ff_vf_noise; @@ -325,7 +312,6 @@ extern AVFilter ff_vf_removegrain; extern AVFilter ff_vf_removelogo; extern AVFilter ff_vf_repeatfields; extern AVFilter ff_vf_reverse; -extern AVFilter ff_vf_rgbashift; extern AVFilter ff_vf_roberts; extern AVFilter ff_vf_roberts_opencl; extern AVFilter ff_vf_rotate; @@ -379,11 +365,8 @@ extern AVFilter ff_vf_tlut2; extern AVFilter ff_vf_tmix; extern AVFilter ff_vf_tonemap; extern AVFilter ff_vf_tonemap_opencl; -extern AVFilter ff_vf_tpad; extern AVFilter ff_vf_transpose; extern AVFilter ff_vf_transpose_npp; -extern AVFilter ff_vf_transpose_opencl; -extern AVFilter ff_vf_transpose_vaapi; extern AVFilter ff_vf_trim; extern AVFilter ff_vf_unpremultiply; extern AVFilter ff_vf_unsharp; @@ -404,7 +387,6 @@ extern AVFilter ff_vf_w3fdif; extern AVFilter ff_vf_waveform; extern AVFilter ff_vf_weave; extern AVFilter ff_vf_xbr; -extern AVFilter ff_vf_xmedian; extern AVFilter ff_vf_xstack; extern AVFilter ff_vf_yadif; extern AVFilter ff_vf_yadif_cuda; @@ -445,7 +427,6 @@ extern AVFilter ff_avf_avectorscope; extern AVFilter ff_avf_concat; extern AVFilter ff_avf_showcqt; extern AVFilter ff_avf_showfreqs; -extern AVFilter ff_avf_showspatial; extern AVFilter ff_avf_showspectrum; extern AVFilter ff_avf_showspectrumpic; extern AVFilter ff_avf_showvolume; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavfilter/version.h b/trunk/3rdparty/ffmpeg-4-fit/libavfilter/version.h index cc5b23b70b..9f0a9966eb 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavfilter/version.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavfilter/version.h @@ -30,9 +30,8 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 7 -#define LIBAVFILTER_VERSION_MINOR 57 -#define LIBAVFILTER_VERSION_MICRO 100 - +#define LIBAVFILTER_VERSION_MINOR 40 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavformat/allformats.c b/trunk/3rdparty/ffmpeg-4-fit/libavformat/allformats.c index cd00834807..498077e1de 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavformat/allformats.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavformat/allformats.c @@ -110,7 +110,6 @@ extern AVInputFormat ff_daud_demuxer; extern AVOutputFormat ff_daud_muxer; extern AVInputFormat ff_dcstr_demuxer; extern AVInputFormat ff_dfa_demuxer; -extern AVInputFormat ff_dhav_demuxer; extern AVInputFormat ff_dirac_demuxer; extern AVOutputFormat ff_dirac_muxer; extern AVInputFormat ff_dnxhd_demuxer; @@ -176,7 +175,6 @@ extern AVOutputFormat ff_h263_muxer; extern AVInputFormat ff_h264_demuxer; extern AVOutputFormat ff_h264_muxer; extern AVOutputFormat ff_hash_muxer; -extern AVInputFormat ff_hcom_demuxer; extern AVOutputFormat ff_hds_muxer; extern AVInputFormat ff_hevc_demuxer; extern AVOutputFormat ff_hevc_muxer; @@ -188,7 +186,6 @@ extern AVOutputFormat ff_ico_muxer; extern AVInputFormat ff_idcin_demuxer; extern AVInputFormat ff_idf_demuxer; extern AVInputFormat ff_iff_demuxer; -extern AVInputFormat ff_ifv_demuxer; extern AVInputFormat ff_ilbc_demuxer; extern AVOutputFormat ff_ilbc_muxer; extern AVInputFormat ff_image2_demuxer; @@ -211,7 +208,6 @@ extern AVInputFormat ff_ivr_demuxer; extern AVInputFormat ff_jacosub_demuxer; extern AVOutputFormat ff_jacosub_muxer; extern AVInputFormat ff_jv_demuxer; -extern AVInputFormat ff_kux_demuxer; extern AVOutputFormat ff_latm_muxer; extern AVInputFormat ff_lmlm4_demuxer; extern AVInputFormat ff_loas_demuxer; @@ -425,7 +421,6 @@ extern AVInputFormat ff_vc1_demuxer; extern AVOutputFormat ff_vc1_muxer; extern AVInputFormat ff_vc1t_demuxer; extern AVOutputFormat ff_vc1t_muxer; -extern AVInputFormat ff_vividas_demuxer; extern AVInputFormat ff_vivo_demuxer; extern AVInputFormat ff_vmd_demuxer; extern AVInputFormat ff_vobsub_demuxer; @@ -467,7 +462,6 @@ extern AVInputFormat ff_image_bmp_pipe_demuxer; extern AVInputFormat ff_image_dds_pipe_demuxer; extern AVInputFormat ff_image_dpx_pipe_demuxer; extern AVInputFormat ff_image_exr_pipe_demuxer; -extern AVInputFormat ff_image_gif_pipe_demuxer; extern AVInputFormat ff_image_j2k_pipe_demuxer; extern AVInputFormat ff_image_jpeg_pipe_demuxer; extern AVInputFormat ff_image_jpegls_pipe_demuxer; @@ -585,11 +579,7 @@ AVInputFormat *av_iformat_next(const AVInputFormat *f) ff_thread_once(&av_format_next_init, av_format_init_next); if (f) -#if FF_API_AVIOFORMAT return f->next; -#else - return (AVInputFormat *) f->next; -#endif else { void *opaque = NULL; return (AVInputFormat *)av_demuxer_iterate(&opaque); @@ -601,11 +591,7 @@ AVOutputFormat *av_oformat_next(const AVOutputFormat *f) ff_thread_once(&av_format_next_init, av_format_init_next); if (f) -#if FF_API_AVIOFORMAT return f->next; -#else - return (AVOutputFormat *) f->next; -#endif else { void *opaque = NULL; return (AVOutputFormat *)av_muxer_iterate(&opaque); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/Makefile new file mode 100644 index 0000000000..352d1a8c13 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/Makefile @@ -0,0 +1,7 @@ +OBJS += arm/audio_convert_init.o \ + arm/resample_init.o + +OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o + +NEON-OBJS += arm/audio_convert_neon.o \ + arm/resample_neon.o diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/asm-offsets.h b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/asm-offsets.h new file mode 100644 index 0000000000..4d3d116dc0 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/asm-offsets.h @@ -0,0 +1,29 @@ +/* + * 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 AVRESAMPLE_ARM_ASM_OFFSETS_H +#define AVRESAMPLE_ARM_ASM_OFFSETS_H + +/* struct ResampleContext */ +#define FILTER_BANK 0x08 +#define FILTER_LENGTH 0x0c +#define SRC_INCR 0x20 +#define PHASE_SHIFT 0x28 +#define PHASE_MASK (PHASE_SHIFT + 0x04) + +#endif /* AVRESAMPLE_ARM_ASM_OFFSETS_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/audio_convert_init.c b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/audio_convert_init.c new file mode 100644 index 0000000000..3d19a0e0e5 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/audio_convert_init.c @@ -0,0 +1,49 @@ +/* + * 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 + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavutil/samplefmt.h" +#include "libavresample/audio_convert.h" + +void ff_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len); +void ff_conv_fltp_to_s16_neon(int16_t *dst, float *const *src, + int len, int channels); +void ff_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src, + int len, int channels); + +av_cold void ff_audio_convert_init_arm(AudioConvert *ac) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, + 0, 16, 8, "NEON", + ff_conv_flt_to_s16_neon); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, + 0, 16, 8, "NEON", + ff_conv_fltp_to_s16_neon); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, + 2, 16, 8, "NEON", + ff_conv_fltp_to_s16_2ch_neon); + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/neontest.c b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/neontest.c new file mode 100644 index 0000000000..22afedbc60 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/neontest.c @@ -0,0 +1,31 @@ +/* + * check NEON registers for clobbers + * Copyright (c) 2013 Martin Storsjo + * + * 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 "libavresample/avresample.h" +#include "libavutil/arm/neontest.h" + +wrap(avresample_convert(AVAudioResampleContext *avr, uint8_t **output, + int out_plane_size, int out_samples, uint8_t **input, + int in_plane_size, int in_samples)) +{ + testneonclobbers(avresample_convert, avr, output, out_plane_size, + out_samples, input, in_plane_size, in_samples); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/resample_init.c b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/resample_init.c new file mode 100644 index 0000000000..10af09cb91 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavresample/arm/arm/resample_init.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014 Peter Meerwald + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavutil/internal.h" +#include "libavutil/samplefmt.h" + +#include "libavresample/resample.h" + +#include "asm-offsets.h" + +AV_CHECK_OFFSET(struct ResampleContext, filter_bank, FILTER_BANK); +AV_CHECK_OFFSET(struct ResampleContext, filter_length, FILTER_LENGTH); +AV_CHECK_OFFSET(struct ResampleContext, src_incr, SRC_INCR); +AV_CHECK_OFFSET(struct ResampleContext, phase_shift, PHASE_SHIFT); +AV_CHECK_OFFSET(struct ResampleContext, phase_mask, PHASE_MASK); + +void ff_resample_one_flt_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); +void ff_resample_one_s16_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); +void ff_resample_one_s32_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); + +void ff_resample_linear_flt_neon(struct ResampleContext *c, void *dst0, + int dst_index, const void *src0, + unsigned int index, int frac); + +av_cold void ff_audio_resample_init_arm(ResampleContext *c, + enum AVSampleFormat sample_fmt) +{ + int cpu_flags = av_get_cpu_flags(); + if (have_neon(cpu_flags)) { + switch (sample_fmt) { + case AV_SAMPLE_FMT_FLTP: + if (c->linear) + c->resample_one = ff_resample_linear_flt_neon; + else + c->resample_one = ff_resample_one_flt_neon; + break; + case AV_SAMPLE_FMT_S16P: + if (!c->linear) + c->resample_one = ff_resample_one_s16_neon; + break; + case AV_SAMPLE_FMT_S32P: + if (!c->linear) + c->resample_one = ff_resample_one_s32_neon; + break; + } + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavutil/Makefile index 8a7a44e4b5..9ed24cfc82 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/Makefile +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/Makefile @@ -31,7 +31,6 @@ HEADERS = adler32.h \ file.h \ frame.h \ hash.h \ - hdr_dynamic_metadata.h \ hmac.h \ hwcontext.h \ hwcontext_cuda.h \ @@ -79,7 +78,6 @@ HEADERS = adler32.h \ version.h \ xtea.h \ tea.h \ - tx.h \ HEADERS-$(CONFIG_LZO) += lzo.h @@ -96,7 +94,6 @@ OBJS = adler32.o \ aes_ctr.o \ audio_fifo.o \ avstring.o \ - avsscanf.o \ base64.o \ blowfish.o \ bprint.o \ @@ -121,7 +118,6 @@ OBJS = adler32.o \ fixed_dsp.o \ frame.o \ hash.o \ - hdr_dynamic_metadata.o \ hmac.o \ hwcontext.o \ imgutils.o \ @@ -160,7 +156,6 @@ OBJS = adler32.o \ xga_font_data.o \ xtea.o \ tea.o \ - tx.o \ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o OBJS-$(CONFIG_D3D11VA) += hwcontext_d3d11va.o @@ -180,8 +175,7 @@ OBJS += $(COMPAT_OBJS:%=../compat/%) SLIBOBJS-$(HAVE_GNU_WINDRES) += avutilres.o SKIPHEADERS-$(HAVE_CUDA_H) += hwcontext_cuda.h -SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h \ - cuda_check.h +SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h SKIPHEADERS-$(CONFIG_D3D11VA) += hwcontext_d3d11va.h SKIPHEADERS-$(CONFIG_DXVA2) += hwcontext_dxva2.h SKIPHEADERS-$(CONFIG_QSV) += hwcontext_qsv.h diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/Makefile new file mode 100644 index 0000000000..5da44b0542 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/Makefile @@ -0,0 +1,8 @@ +OBJS += arm/cpu.o \ + arm/float_dsp_init_arm.o \ + +VFP-OBJS += arm/float_dsp_init_vfp.o \ + arm/float_dsp_vfp.o \ + +NEON-OBJS += arm/float_dsp_init_neon.o \ + arm/float_dsp_neon.o \ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/bswap.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/bswap.h new file mode 100644 index 0000000000..611ff0ad5b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/bswap.h @@ -0,0 +1,67 @@ +/* + * 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 AVUTIL_ARM_BSWAP_H +#define AVUTIL_ARM_BSWAP_H + +#include +#include "config.h" +#include "libavutil/attributes.h" + +#ifdef __ARMCC_VERSION + +#if HAVE_ARMV6 +#define av_bswap32 av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ + return __rev(x); +} +#endif /* HAVE_ARMV6 */ + +#elif HAVE_INLINE_ASM + +#if HAVE_ARMV6_INLINE +#define av_bswap16 av_bswap16 +static av_always_inline av_const unsigned av_bswap16(unsigned x) +{ + __asm__("rev16 %0, %0" : "+r"(x)); + return x; +} +#endif + +#if AV_GCC_VERSION_AT_MOST(4,4) +#define av_bswap32 av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ +#if HAVE_ARMV6_INLINE + __asm__("rev %0, %0" : "+r"(x)); +#else + uint32_t t; + __asm__ ("eor %1, %0, %0, ror #16 \n\t" + "bic %1, %1, #0xFF0000 \n\t" + "mov %0, %0, ror #8 \n\t" + "eor %0, %0, %1, lsr #8 \n\t" + : "+r"(x), "=&r"(t)); +#endif /* HAVE_ARMV6_INLINE */ + return x; +} +#endif /* AV_GCC_VERSION_AT_MOST(4,4) */ + +#endif /* __ARMCC_VERSION */ + +#endif /* AVUTIL_ARM_BSWAP_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/cpu.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/cpu.c new file mode 100644 index 0000000000..81e85e2525 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/cpu.c @@ -0,0 +1,170 @@ +/* + * 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/cpu.h" +#include "libavutil/cpu_internal.h" +#include "config.h" + +#define CORE_FLAG(f) \ + (AV_CPU_FLAG_ ## f * (HAVE_ ## f ## _EXTERNAL || HAVE_ ## f ## _INLINE)) + +#define CORE_CPU_FLAGS \ + (CORE_FLAG(ARMV5TE) | \ + CORE_FLAG(ARMV6) | \ + CORE_FLAG(ARMV6T2) | \ + CORE_FLAG(VFP) | \ + CORE_FLAG(VFPV3) | \ + CORE_FLAG(NEON)) + +#if defined __linux__ || defined __ANDROID__ + +#include +#include +#include +#include "libavutil/avstring.h" + +#define AT_HWCAP 16 + +/* Relevant HWCAP values from kernel headers */ +#define HWCAP_VFP (1 << 6) +#define HWCAP_EDSP (1 << 7) +#define HWCAP_THUMBEE (1 << 11) +#define HWCAP_NEON (1 << 12) +#define HWCAP_VFPv3 (1 << 13) +#define HWCAP_TLS (1 << 15) + +static int get_hwcap(uint32_t *hwcap) +{ + struct { uint32_t a_type; uint32_t a_val; } auxv; + FILE *f = fopen("/proc/self/auxv", "r"); + int err = -1; + + if (!f) + return -1; + + while (fread(&auxv, sizeof(auxv), 1, f) > 0) { + if (auxv.a_type == AT_HWCAP) { + *hwcap = auxv.a_val; + err = 0; + break; + } + } + + fclose(f); + return err; +} + +static int get_cpuinfo(uint32_t *hwcap) +{ + FILE *f = fopen("/proc/cpuinfo", "r"); + char buf[200]; + + if (!f) + return -1; + + *hwcap = 0; + while (fgets(buf, sizeof(buf), f)) { + if (av_strstart(buf, "Features", NULL)) { + if (strstr(buf, " edsp ")) + *hwcap |= HWCAP_EDSP; + if (strstr(buf, " tls ")) + *hwcap |= HWCAP_TLS; + if (strstr(buf, " thumbee ")) + *hwcap |= HWCAP_THUMBEE; + if (strstr(buf, " vfp ")) + *hwcap |= HWCAP_VFP; + if (strstr(buf, " vfpv3 ")) + *hwcap |= HWCAP_VFPv3; + if (strstr(buf, " neon ") || strstr(buf, " asimd ")) + *hwcap |= HWCAP_NEON; + if (strstr(buf, " fp ")) // Listed on 64 bit ARMv8 kernels + *hwcap |= HWCAP_VFP | HWCAP_VFPv3; + break; + } + } + fclose(f); + return 0; +} + +int ff_get_cpu_flags_arm(void) +{ + int flags = CORE_CPU_FLAGS; + uint32_t hwcap; + + if (get_hwcap(&hwcap) < 0) + if (get_cpuinfo(&hwcap) < 0) + return flags; + +#define check_cap(cap, flag) do { \ + if (hwcap & HWCAP_ ## cap) \ + flags |= AV_CPU_FLAG_ ## flag; \ + } while (0) + + /* No flags explicitly indicate v6 or v6T2 so check others which + imply support. */ + check_cap(EDSP, ARMV5TE); + check_cap(TLS, ARMV6); + check_cap(THUMBEE, ARMV6T2); + check_cap(VFP, VFP); + check_cap(VFPv3, VFPV3); + check_cap(NEON, NEON); + + /* The v6 checks above are not reliable so let higher flags + trickle down. */ + if (flags & (AV_CPU_FLAG_VFPV3 | AV_CPU_FLAG_NEON)) + flags |= AV_CPU_FLAG_ARMV6T2; + else if (flags & (AV_CPU_FLAG_ARMV6T2 | AV_CPU_FLAG_ARMV6)) + /* Some functions use the 'setend' instruction which is deprecated on ARMv8 + * and serializing on some ARMv7 cores. This ensures such functions + * are only enabled on ARMv6. */ + flags |= AV_CPU_FLAG_SETEND; + + if (flags & AV_CPU_FLAG_ARMV6T2) + flags |= AV_CPU_FLAG_ARMV6; + + /* set the virtual VFPv2 vector mode flag */ + if ((flags & AV_CPU_FLAG_VFP) && !(flags & (AV_CPU_FLAG_VFPV3 | AV_CPU_FLAG_NEON))) + flags |= AV_CPU_FLAG_VFP_VM; + + return flags; +} + +#else + +int ff_get_cpu_flags_arm(void) +{ + return AV_CPU_FLAG_ARMV5TE * HAVE_ARMV5TE | + AV_CPU_FLAG_ARMV6 * HAVE_ARMV6 | + AV_CPU_FLAG_ARMV6T2 * HAVE_ARMV6T2 | + AV_CPU_FLAG_VFP * HAVE_VFP | + AV_CPU_FLAG_VFPV3 * HAVE_VFPV3 | + AV_CPU_FLAG_NEON * HAVE_NEON | + AV_CPU_FLAG_SETEND * !(HAVE_NEON | HAVE_VFPV3); +} + +#endif + +size_t ff_get_cpu_max_align_arm(void) +{ + int flags = av_get_cpu_flags(); + + if (flags & AV_CPU_FLAG_NEON) + return 16; + + return 8; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/cpu.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/cpu.h new file mode 100644 index 0000000000..1d6cc65dc4 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/cpu.h @@ -0,0 +1,38 @@ +/* + * 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 AVUTIL_ARM_CPU_H +#define AVUTIL_ARM_CPU_H + +#include "libavutil/cpu.h" +#include "libavutil/cpu_internal.h" + +#define have_armv5te(flags) CPUEXT(flags, ARMV5TE) +#define have_armv6(flags) CPUEXT(flags, ARMV6) +#define have_armv6t2(flags) CPUEXT(flags, ARMV6T2) +#define have_vfp(flags) CPUEXT(flags, VFP) +#define have_vfpv3(flags) CPUEXT(flags, VFPV3) +#define have_neon(flags) CPUEXT(flags, NEON) +#define have_setend(flags) CPUEXT(flags, SETEND) + +/* some functions use the VFPv2 vector mode which is deprecated in ARMv7-A + * and might trap on such CPU depending on the OS configuration */ +#define have_vfp_vm(flags) \ + (HAVE_VFP && ((flags) & AV_CPU_FLAG_VFP_VM)) + +#endif /* AVUTIL_ARM_CPU_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_arm.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_arm.h new file mode 100644 index 0000000000..fe311cc0d2 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_arm.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 AVUTIL_ARM_FLOAT_DSP_ARM_H +#define AVUTIL_ARM_FLOAT_DSP_ARM_H + +#include "libavutil/float_dsp.h" + +void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp, int cpu_flags); +void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp); + +#endif /* AVUTIL_ARM_FLOAT_DSP_ARM_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_arm.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_arm.c new file mode 100644 index 0000000000..678762862e --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_arm.c @@ -0,0 +1,32 @@ +/* + * 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/attributes.h" +#include "libavutil/float_dsp.h" +#include "cpu.h" +#include "float_dsp_arm.h" + +av_cold void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_vfp(cpu_flags)) + ff_float_dsp_init_vfp(fdsp, cpu_flags); + if (have_neon(cpu_flags)) + ff_float_dsp_init_neon(fdsp); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_neon.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_neon.c new file mode 100644 index 0000000000..689aa77c7b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_neon.c @@ -0,0 +1,59 @@ +/* + * ARM NEON optimised Float DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/float_dsp.h" +#include "float_dsp_arm.h" + +void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len); + +void ff_vector_fmac_scalar_neon(float *dst, const float *src, float mul, + int len); + +void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul, + int len); + +void ff_vector_fmul_window_neon(float *dst, const float *src0, + const float *src1, const float *win, int len); + +void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1, + const float *src2, int len); + +void ff_vector_fmul_reverse_neon(float *dst, const float *src0, + const float *src1, int len); + +void ff_butterflies_float_neon(float *v1, float *v2, int len); + +float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len); + +av_cold void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp) +{ + fdsp->vector_fmul = ff_vector_fmul_neon; + fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_neon; + fdsp->vector_fmul_scalar = ff_vector_fmul_scalar_neon; + fdsp->vector_fmul_window = ff_vector_fmul_window_neon; + fdsp->vector_fmul_add = ff_vector_fmul_add_neon; + fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_neon; + fdsp->butterflies_float = ff_butterflies_float_neon; + fdsp->scalarproduct_float = ff_scalarproduct_float_neon; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_vfp.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_vfp.c new file mode 100644 index 0000000000..05873e7e37 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/float_dsp_init_vfp.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2008 Siarhei Siamashka + * + * 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/attributes.h" +#include "libavutil/float_dsp.h" +#include "cpu.h" +#include "float_dsp_arm.h" + +void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1, + int len); + +void ff_vector_fmul_window_vfp(float *dst, const float *src0, + const float *src1, const float *win, int len); + +void ff_vector_fmul_reverse_vfp(float *dst, const float *src0, + const float *src1, int len); + +void ff_butterflies_float_vfp(float *av_restrict v1, float *av_restrict v2, int len); + +av_cold void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp, int cpu_flags) +{ + if (have_vfp_vm(cpu_flags)) { + fdsp->vector_fmul = ff_vector_fmul_vfp; + fdsp->vector_fmul_window = ff_vector_fmul_window_vfp; + } + fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_vfp; + if (have_vfp_vm(cpu_flags)) + fdsp->butterflies_float = ff_butterflies_float_vfp; +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/intmath.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/intmath.h new file mode 100644 index 0000000000..5311a7d52b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/intmath.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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 AVUTIL_ARM_INTMATH_H +#define AVUTIL_ARM_INTMATH_H + +#include + +#include "config.h" +#include "libavutil/attributes.h" + +#if HAVE_INLINE_ASM + +#if HAVE_ARMV6_INLINE + +#define av_clip_uint8 av_clip_uint8_arm +static av_always_inline av_const int av_clip_uint8_arm(int a) +{ + int x; + __asm__ ("usat %0, #8, %1" : "=r"(x) : "r"(a)); + return x; +} + +#define av_clip_int8 av_clip_int8_arm +static av_always_inline av_const int av_clip_int8_arm(int a) +{ + int x; + __asm__ ("ssat %0, #8, %1" : "=r"(x) : "r"(a)); + return x; +} + +#define av_clip_uint16 av_clip_uint16_arm +static av_always_inline av_const int av_clip_uint16_arm(int a) +{ + int x; + __asm__ ("usat %0, #16, %1" : "=r"(x) : "r"(a)); + return x; +} + +#define av_clip_int16 av_clip_int16_arm +static av_always_inline av_const int av_clip_int16_arm(int a) +{ + int x; + __asm__ ("ssat %0, #16, %1" : "=r"(x) : "r"(a)); + return x; +} + +#define av_clip_intp2 av_clip_intp2_arm +static av_always_inline av_const int av_clip_intp2_arm(int a, int p) +{ + unsigned x; + __asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1)); + return x; +} + +#define av_clip_uintp2 av_clip_uintp2_arm +static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) +{ + unsigned x; + __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)); + return x; +} + +#define av_sat_add32 av_sat_add32_arm +static av_always_inline int av_sat_add32_arm(int a, int b) +{ + int r; + __asm__ ("qadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); + return r; +} + +#define av_sat_dadd32 av_sat_dadd32_arm +static av_always_inline int av_sat_dadd32_arm(int a, int b) +{ + int r; + __asm__ ("qdadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); + return r; +} + +#define av_sat_sub32 av_sat_sub32_arm +static av_always_inline int av_sat_sub32_arm(int a, int b) +{ + int r; + __asm__ ("qsub %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); + return r; +} + +#define av_sat_dsub32 av_sat_dsub32_arm +static av_always_inline int av_sat_dsub32_arm(int a, int b) +{ + int r; + __asm__ ("qdsub %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); + return r; +} + +#endif /* HAVE_ARMV6_INLINE */ + +#if HAVE_ASM_MOD_Q + +#define av_clipl_int32 av_clipl_int32_arm +static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a) +{ + int x, y; + __asm__ ("adds %1, %R2, %Q2, lsr #31 \n\t" + "itet ne \n\t" + "mvnne %1, #1<<31 \n\t" + "moveq %0, %Q2 \n\t" + "eorne %0, %1, %R2, asr #31 \n\t" + : "=r"(x), "=&r"(y) : "r"(a) : "cc"); + return x; +} + +#endif /* HAVE_ASM_MOD_Q */ + +#endif /* HAVE_INLINE_ASM */ + +#endif /* AVUTIL_ARM_INTMATH_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/intreadwrite.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/intreadwrite.h new file mode 100644 index 0000000000..60fc860cbb --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/intreadwrite.h @@ -0,0 +1,91 @@ +/* + * 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 AVUTIL_ARM_INTREADWRITE_H +#define AVUTIL_ARM_INTREADWRITE_H + +#include +#include "config.h" +#include "libavutil/attributes.h" + +#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM && AV_GCC_VERSION_AT_MOST(4,6) + +#define AV_RN16 AV_RN16 +static av_always_inline unsigned AV_RN16(const void *p) +{ + const uint8_t *q = p; + unsigned v; +#if AV_GCC_VERSION_AT_MOST(4,5) + __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)q)); +#elif defined __thumb__ + __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1])); +#else + __asm__ ("ldrh %0, %1" : "=r"(v) : "Uq"(q[0]), "m"(q[1])); +#endif + return v; +} + +#define AV_WN16 AV_WN16 +static av_always_inline void AV_WN16(void *p, uint16_t v) +{ + __asm__ ("strh %1, %0" : "=m"(*(uint16_t *)p) : "r"(v)); +} + +#define AV_RN32 AV_RN32 +static av_always_inline uint32_t AV_RN32(const void *p) +{ + const struct __attribute__((packed)) { uint32_t v; } *q = p; + uint32_t v; + __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*q)); + return v; +} + +#define AV_WN32 AV_WN32 +static av_always_inline void AV_WN32(void *p, uint32_t v) +{ + __asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v)); +} + +#if HAVE_ASM_MOD_Q + +#define AV_RN64 AV_RN64 +static av_always_inline uint64_t AV_RN64(const void *p) +{ + const struct __attribute__((packed)) { uint32_t v; } *q = p; + uint64_t v; + __asm__ ("ldr %Q0, %1 \n\t" + "ldr %R0, %2 \n\t" + : "=&r"(v) + : "m"(q[0]), "m"(q[1])); + return v; +} + +#define AV_WN64 AV_WN64 +static av_always_inline void AV_WN64(void *p, uint64_t v) +{ + __asm__ ("str %Q2, %0 \n\t" + "str %R2, %1 \n\t" + : "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1)) + : "r"(v)); +} + +#endif /* HAVE_ASM_MOD_Q */ + +#endif /* HAVE_INLINE_ASM */ + +#endif /* AVUTIL_ARM_INTREADWRITE_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/neontest.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/neontest.h new file mode 100644 index 0000000000..d75ab8380b --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/neontest.h @@ -0,0 +1,67 @@ +/* + * check NEON registers for clobbering + * Copyright (c) 2008 Ramiro Polla + * Copyright (c) 2013 Martin Storsjo + * + * 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 AVUTIL_ARM_NEONTEST_H +#define AVUTIL_ARM_NEONTEST_H + +#include +#include +#include +#include +#include + +#include "libavutil/bswap.h" + +#define storeneonregs(mem) \ + __asm__ volatile( \ + "vstm %0, {d8-d15}\n\t" \ + :: "r"(mem) : "memory") + +#define testneonclobbers(func, ctx, ...) \ + uint64_t neon[2][8]; \ + int ret; \ + storeneonregs(neon[0]); \ + ret = __real_ ## func(ctx, __VA_ARGS__); \ + storeneonregs(neon[1]); \ + if (memcmp(neon[0], neon[1], sizeof(neon[0]))) { \ + int i; \ + av_log(ctx, AV_LOG_ERROR, \ + "NEON REGS CLOBBERED IN %s!\n", #func); \ + for (i = 0; i < 8; i ++) \ + if (neon[0][i] != neon[1][i]) { \ + av_log(ctx, AV_LOG_ERROR, \ + "d%-2d = %016"PRIx64"\n", \ + 8 + i, av_bswap64(neon[0][i])); \ + av_log(ctx, AV_LOG_ERROR, \ + " -> %016"PRIx64"\n", \ + av_bswap64(neon[1][i])); \ + } \ + abort(); \ + } \ + return ret + +#define wrap(func) \ +int __real_ ## func; \ +int __wrap_ ## func; \ +int __wrap_ ## func + +#endif /* AVUTIL_ARM_NEONTEST_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/timer.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/timer.h new file mode 100644 index 0000000000..5e8bc8edd0 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/arm/arm/timer.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 AVUTIL_ARM_TIMER_H +#define AVUTIL_ARM_TIMER_H + +#include +#include "config.h" + +#if HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__) + +#define AV_READ_TIME read_time + +static inline uint64_t read_time(void) +{ + unsigned cc; + __asm__ volatile ("mrc p15, 0, %0, c9, c13, 0" : "=r"(cc)); + return cc; +} + +#endif /* HAVE_INLINE_ASM && __ARM_ARCH_7A__ */ + +#endif /* AVUTIL_ARM_TIMER_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/avstring.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/avstring.h index 37dd4e2da0..04d2695640 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/avstring.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/avstring.h @@ -400,12 +400,6 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, */ int av_match_list(const char *name, const char *list, char separator); -/** - * See libc sscanf manual for more information. - * Locale-independent sscanf implementation. - */ -int av_sscanf(const char *string, const char *format, ...); - /** * @} */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/colorspace.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/colorspace.h index ef6f6107d6..d0be8cb99a 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/colorspace.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/colorspace.h @@ -119,32 +119,4 @@ static inline int C_JPEG_TO_CCIR(int y) { (((FIX(0.50000) * r1 - FIX(0.41869) * g1 - \ FIX(0.08131) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128) -// Conversion macros for 8-bit RGB to YUV -// Derived from ITU-R BT.709-6 (06/2015) Item 3.5 -// https://www.itu.int/rec/R-REC-BT.709-6-201506-I/en - -#define RGB_TO_Y_BT709(r, g, b) \ -((FIX(0.21260*219.0/255.0) * (r) + FIX(0.71520*219.0/255.0) * (g) + \ - FIX(0.07220*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) - -#define RGB_TO_U_BT709(r1, g1, b1, shift)\ -(((- FIX(0.11457*224.0/255.0) * r1 - FIX(0.38543*224.0/255.0) * g1 + \ - FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) - -#define RGB_TO_V_BT709(r1, g1, b1, shift)\ -(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.45415*224.0/255.0) * g1 - \ - FIX(0.04585*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) - -#define RGB_TO_Y_BT709_FULL(r, g, b) \ -(FFMIN((FIX(0.21260) * (r) + FIX(0.71520) * (g) + \ - FIX(0.07220) * (b) + (ONE_HALF)) >> SCALEBITS, 255)) - -#define RGB_TO_U_BT709_FULL(r1, g1, b1)\ -(((- FIX(0.11457) * r1 - FIX(0.38543) * g1 + \ - FIX(0.50000) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128) - -#define RGB_TO_V_BT709_FULL(r1, g1, b1)\ -(((FIX(0.50000) * r1 - FIX(0.45415) * g1 - \ - FIX(0.04585) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128) - #endif /* AVUTIL_COLORSPACE_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/common.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/common.h index 8db0291170..bad43e426e 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/common.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/common.h @@ -331,7 +331,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double */ static av_always_inline av_const int av_ceil_log2_c(int x) { - return av_log2((x - 1) << 1); + return av_log2((x - 1U) << 1); } /** diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/dynarray.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/dynarray.h index 3a7e146422..034a9fedfe 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/dynarray.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/dynarray.h @@ -23,7 +23,7 @@ #include "mem.h" /** - * Add an element to a dynamic array. + * Add an element of to a dynamic array. * * The array is reallocated when its number of elements reaches powers of 2. * Therefore, the amortized cost of adding an element is constant. diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/encryption_info.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/encryption_info.c index 812c704776..dd3fa71a44 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/encryption_info.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/encryption_info.c @@ -331,8 +331,10 @@ uint8_t *av_encryption_init_info_add_side_data(const AVEncryptionInitInfo *info, memcpy(cur_buffer, cur_info->key_ids[i], cur_info->key_id_size); cur_buffer += cur_info->key_id_size; } - memcpy(cur_buffer, cur_info->data, cur_info->data_size); - cur_buffer += cur_info->data_size; + if (cur_info->data_size > 0) { + memcpy(cur_buffer, cur_info->data, cur_info->data_size); + cur_buffer += cur_info->data_size; + } } return buffer; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/file_open.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/file_open.c index cc302f2f76..a8da283583 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/file_open.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/file_open.c @@ -138,7 +138,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l #else snprintf(*filename, len, "/tmp/%sXXXXXX", prefix); fd = mkstemp(*filename); -#if defined(_WIN32) || defined (__ANDROID__) || defined(__DJGPP__) +#if defined(_WIN32) || defined (__ANDROID__) if (fd < 0) { snprintf(*filename, len, "./%sXXXXXX", prefix); fd = mkstemp(*filename); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.c index dcf1fc3d17..9b3fb13e68 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.c @@ -840,8 +840,6 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type) case AV_FRAME_DATA_QP_TABLE_PROPERTIES: return "QP table properties"; case AV_FRAME_DATA_QP_TABLE_DATA: return "QP table data"; #endif - case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)"; - case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest"; } return NULL; } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.h index 5d3231e7bb..e2a292980f 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/frame.h @@ -166,19 +166,6 @@ enum AVFrameSideDataType { * function in libavutil/timecode.c. */ AV_FRAME_DATA_S12M_TIMECODE, - - /** - * HDR dynamic metadata associated with a video frame. The payload is - * an AVDynamicHDRPlus type and contains information for color - * volume transform - application 4 of SMPTE 2094-40:2016 standard. - */ - AV_FRAME_DATA_DYNAMIC_HDR_PLUS, - - /** - * Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of - * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size. - */ - AV_FRAME_DATA_REGIONS_OF_INTEREST, }; enum AVActiveFormatDescription { @@ -206,62 +193,6 @@ typedef struct AVFrameSideData { AVBufferRef *buf; } AVFrameSideData; -/** - * Structure describing a single Region Of Interest. - * - * When multiple regions are defined in a single side-data block, they - * should be ordered from most to least important - some encoders are only - * capable of supporting a limited number of distinct regions, so will have - * to truncate the list. - * - * When overlapping regions are defined, the first region containing a given - * area of the frame applies. - */ -typedef struct AVRegionOfInterest { - /** - * Must be set to the size of this data structure (that is, - * sizeof(AVRegionOfInterest)). - */ - uint32_t self_size; - /** - * Distance in pixels from the top edge of the frame to the top and - * bottom edges and from the left edge of the frame to the left and - * right edges of the rectangle defining this region of interest. - * - * The constraints on a region are encoder dependent, so the region - * actually affected may be slightly larger for alignment or other - * reasons. - */ - int top; - int bottom; - int left; - int right; - /** - * Quantisation offset. - * - * Must be in the range -1 to +1. A value of zero indicates no quality - * change. A negative value asks for better quality (less quantisation), - * while a positive value asks for worse quality (greater quantisation). - * - * The range is calibrated so that the extreme values indicate the - * largest possible offset - if the rest of the frame is encoded with the - * worst possible quality, an offset of -1 indicates that this region - * should be encoded with the best possible quality anyway. Intermediate - * values are then interpolated in some codec-dependent way. - * - * For example, in 10-bit H.264 the quantisation parameter varies between - * -12 and 51. A typical qoffset value of -1/10 therefore indicates that - * this region should be encoded with a QP around one-tenth of the full - * range better than the rest of the frame. So, if most of the frame - * were to be encoded with a QP of around 30, this region would get a QP - * of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3). - * An extreme value of -1 would indicate that this region should be - * encoded with the best possible quality regardless of the treatment of - * the rest of the frame - that is, should be encoded at a QP of -12. - */ - AVRational qoffset; -} AVRegionOfInterest; - /** * This structure describes decoded (raw) audio or video data. * @@ -458,6 +389,7 @@ typedef struct AVFrame { * that time, * the decoder reorders values as needed and sets AVFrame.reordered_opaque * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts */ int64_t reordered_opaque; @@ -590,8 +522,6 @@ typedef struct AVFrame { int decode_error_flags; #define FF_DECODE_ERROR_INVALID_BITSTREAM 1 #define FF_DECODE_ERROR_MISSING_REFERENCE 2 -#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4 -#define FF_DECODE_ERROR_DECODE_SLICES 8 /** * number of audio channels, only used for audio. diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_cuda.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_cuda.c index cca39e9fc7..3b1d53e799 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_cuda.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_cuda.c @@ -21,7 +21,6 @@ #include "hwcontext.h" #include "hwcontext_internal.h" #include "hwcontext_cuda_internal.h" -#include "cuda_check.h" #include "mem.h" #include "pixdesc.h" #include "pixfmt.h" @@ -44,8 +43,6 @@ static const enum AVPixelFormat supported_formats[] = { AV_PIX_FMT_0BGR32, }; -#define CHECK_CU(x) FF_CUDA_CHECK_DL(device_ctx, cu, x) - static int cuda_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints) @@ -73,48 +70,48 @@ static int cuda_frames_get_constraints(AVHWDeviceContext *ctx, static void cuda_buffer_free(void *opaque, uint8_t *data) { - AVHWFramesContext *ctx = opaque; - AVHWDeviceContext *device_ctx = ctx->device_ctx; - AVCUDADeviceContext *hwctx = device_ctx->hwctx; - CudaFunctions *cu = hwctx->internal->cuda_dl; + AVHWFramesContext *ctx = opaque; + AVCUDADeviceContext *hwctx = ctx->device_ctx->hwctx; + CudaFunctions *cu = hwctx->internal->cuda_dl; CUcontext dummy; - CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx)); + cu->cuCtxPushCurrent(hwctx->cuda_ctx); - CHECK_CU(cu->cuMemFree((CUdeviceptr)data)); + cu->cuMemFree((CUdeviceptr)data); - CHECK_CU(cu->cuCtxPopCurrent(&dummy)); + cu->cuCtxPopCurrent(&dummy); } static AVBufferRef *cuda_pool_alloc(void *opaque, int size) { - AVHWFramesContext *ctx = opaque; - AVHWDeviceContext *device_ctx = ctx->device_ctx; - AVCUDADeviceContext *hwctx = device_ctx->hwctx; - CudaFunctions *cu = hwctx->internal->cuda_dl; + AVHWFramesContext *ctx = opaque; + AVCUDADeviceContext *hwctx = ctx->device_ctx->hwctx; + CudaFunctions *cu = hwctx->internal->cuda_dl; AVBufferRef *ret = NULL; CUcontext dummy = NULL; CUdeviceptr data; - int err; + CUresult err; - err = CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx)); - if (err < 0) + err = cu->cuCtxPushCurrent(hwctx->cuda_ctx); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Error setting current CUDA context\n"); return NULL; + } - err = CHECK_CU(cu->cuMemAlloc(&data, size)); - if (err < 0) + err = cu->cuMemAlloc(&data, size); + if (err != CUDA_SUCCESS) goto fail; ret = av_buffer_create((uint8_t*)data, size, cuda_buffer_free, ctx, 0); if (!ret) { - CHECK_CU(cu->cuMemFree(data)); + cu->cuMemFree(data); goto fail; } fail: - CHECK_CU(cu->cuCtxPopCurrent(&dummy)); + cu->cuCtxPopCurrent(&dummy); return ret; } @@ -197,17 +194,17 @@ static int cuda_transfer_get_formats(AVHWFramesContext *ctx, static int cuda_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - CUDAFramesContext *priv = ctx->internal->priv; - AVHWDeviceContext *device_ctx = ctx->device_ctx; - AVCUDADeviceContext *hwctx = device_ctx->hwctx; - CudaFunctions *cu = hwctx->internal->cuda_dl; + CUDAFramesContext *priv = ctx->internal->priv; + AVCUDADeviceContext *device_hwctx = ctx->device_ctx->hwctx; + CudaFunctions *cu = device_hwctx->internal->cuda_dl; CUcontext dummy; - int i, ret; + CUresult err; + int i; - ret = CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx)); - if (ret < 0) - return ret; + err = cu->cuCtxPushCurrent(device_hwctx->cuda_ctx); + if (err != CUDA_SUCCESS) + return AVERROR_UNKNOWN; for (i = 0; i < FF_ARRAY_ELEMS(src->data) && src->data[i]; i++) { CUDA_MEMCPY2D cpy = { @@ -221,17 +218,20 @@ static int cuda_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, .Height = src->height >> (i ? priv->shift_height : 0), }; - ret = CHECK_CU(cu->cuMemcpy2DAsync(&cpy, hwctx->stream)); - if (ret < 0) - goto exit; + err = cu->cuMemcpy2DAsync(&cpy, device_hwctx->stream); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Error transferring the data from the CUDA frame\n"); + return AVERROR_UNKNOWN; + } } - ret = CHECK_CU(cu->cuStreamSynchronize(hwctx->stream)); - if (ret < 0) - goto exit; + err = cu->cuStreamSynchronize(device_hwctx->stream); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Error synchronizing CUDA stream\n"); + return AVERROR_UNKNOWN; + } -exit: - CHECK_CU(cu->cuCtxPopCurrent(&dummy)); + cu->cuCtxPopCurrent(&dummy); return 0; } @@ -239,17 +239,17 @@ static int cuda_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, static int cuda_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - CUDAFramesContext *priv = ctx->internal->priv; - AVHWDeviceContext *device_ctx = ctx->device_ctx; - AVCUDADeviceContext *hwctx = device_ctx->hwctx; - CudaFunctions *cu = hwctx->internal->cuda_dl; + CUDAFramesContext *priv = ctx->internal->priv; + AVCUDADeviceContext *device_hwctx = ctx->device_ctx->hwctx; + CudaFunctions *cu = device_hwctx->internal->cuda_dl; CUcontext dummy; - int i, ret; + CUresult err; + int i; - ret = CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx)); - if (ret < 0) - return ret; + err = cu->cuCtxPushCurrent(device_hwctx->cuda_ctx); + if (err != CUDA_SUCCESS) + return AVERROR_UNKNOWN; for (i = 0; i < FF_ARRAY_ELEMS(src->data) && src->data[i]; i++) { CUDA_MEMCPY2D cpy = { @@ -263,25 +263,31 @@ static int cuda_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, .Height = src->height >> (i ? priv->shift_height : 0), }; - ret = CHECK_CU(cu->cuMemcpy2DAsync(&cpy, hwctx->stream)); - if (ret < 0) - goto exit; + err = cu->cuMemcpy2DAsync(&cpy, device_hwctx->stream); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Error transferring the data to the CUDA frame\n"); + return AVERROR_UNKNOWN; + } } -exit: - CHECK_CU(cu->cuCtxPopCurrent(&dummy)); + err = cu->cuStreamSynchronize(device_hwctx->stream); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Error synchronizing CUDA stream\n"); + return AVERROR_UNKNOWN; + } + + cu->cuCtxPopCurrent(&dummy); return 0; } -static void cuda_device_uninit(AVHWDeviceContext *device_ctx) +static void cuda_device_uninit(AVHWDeviceContext *ctx) { - AVCUDADeviceContext *hwctx = device_ctx->hwctx; + AVCUDADeviceContext *hwctx = ctx->hwctx; if (hwctx->internal) { - CudaFunctions *cu = hwctx->internal->cuda_dl; if (hwctx->internal->is_allocated && hwctx->cuda_ctx) { - CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx)); + hwctx->internal->cuda_dl->cuCtxDestroy(hwctx->cuda_ctx); hwctx->cuda_ctx = NULL; } cuda_free_functions(&hwctx->internal->cuda_dl); @@ -316,47 +322,53 @@ static int cuda_device_init(AVHWDeviceContext *ctx) return ret; } -static int cuda_device_create(AVHWDeviceContext *device_ctx, - const char *device, +static int cuda_device_create(AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags) { - AVCUDADeviceContext *hwctx = device_ctx->hwctx; + AVCUDADeviceContext *hwctx = ctx->hwctx; CudaFunctions *cu; CUdevice cu_device; CUcontext dummy; - int ret, device_idx = 0; + CUresult err; + int device_idx = 0; if (device) device_idx = strtol(device, NULL, 0); - if (cuda_device_init(device_ctx) < 0) + if (cuda_device_init(ctx) < 0) goto error; cu = hwctx->internal->cuda_dl; - ret = CHECK_CU(cu->cuInit(0)); - if (ret < 0) + err = cu->cuInit(0); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Could not initialize the CUDA driver API\n"); goto error; + } - ret = CHECK_CU(cu->cuDeviceGet(&cu_device, device_idx)); - if (ret < 0) + err = cu->cuDeviceGet(&cu_device, device_idx); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Could not get the device number %d\n", device_idx); goto error; + } - ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, cu_device)); - if (ret < 0) + err = cu->cuCtxCreate(&hwctx->cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, cu_device); + if (err != CUDA_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Error creating a CUDA context\n"); goto error; + } // Setting stream to NULL will make functions automatically use the default CUstream hwctx->stream = NULL; - CHECK_CU(cu->cuCtxPopCurrent(&dummy)); + cu->cuCtxPopCurrent(&dummy); hwctx->internal->is_allocated = 1; return 0; error: - cuda_device_uninit(device_ctx); + cuda_device_uninit(ctx); return AVERROR_UNKNOWN; } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_d3d11va.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_d3d11va.c index 6670c47579..41330f0ae6 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_d3d11va.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_d3d11va.c @@ -410,7 +410,7 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, fill_texture_ptrs(map_data, map_linesize, ctx, &desc, &map); - av_image_copy(dst->data, dst->linesize, (const uint8_t **)map_data, map_linesize, + av_image_copy(dst->data, dst->linesize, map_data, map_linesize, ctx->sw_format, w, h); ID3D11DeviceContext_Unmap(device_hwctx->device_context, staging, 0); @@ -422,7 +422,7 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, fill_texture_ptrs(map_data, map_linesize, ctx, &desc, &map); - av_image_copy(map_data, map_linesize, (const uint8_t **)src->data, src->linesize, + av_image_copy(map_data, map_linesize, src->data, src->linesize, ctx->sw_format, w, h); ID3D11DeviceContext_Unmap(device_hwctx->device_context, staging, 0); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_dxva2.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_dxva2.c index 64366cea89..4585f323bb 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_dxva2.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_dxva2.c @@ -348,7 +348,7 @@ static int dxva2_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, if (ret < 0) goto fail; - av_image_copy(map->data, map->linesize, (const uint8_t **)src->data, src->linesize, + av_image_copy(map->data, map->linesize, src->data, src->linesize, ctx->sw_format, src->width, src->height); fail: @@ -379,7 +379,7 @@ static int dxva2_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, dst_linesize[i] = dst->linesize[i]; src_linesize[i] = map->linesize[i]; } - av_image_copy_uc_from(dst->data, dst_linesize, (const uint8_t **)map->data, src_linesize, + av_image_copy_uc_from(dst->data, dst_linesize, map->data, src_linesize, ctx->sw_format, src->width, src->height); fail: av_frame_free(&map); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_opencl.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_opencl.c index 41fdfe96f1..728877553f 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_opencl.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_opencl.c @@ -50,7 +50,7 @@ #include #endif #include -#include +#include #include "hwcontext_vaapi.h" #endif @@ -500,9 +500,6 @@ static int opencl_device_create_internal(AVHWDeviceContext *hwdev, *device_name_src = NULL; int err, found, p, d; - av_assert0(selector->enumerate_platforms && - selector->enumerate_devices); - err = selector->enumerate_platforms(hwdev, &nb_platforms, &platforms, selector->context); if (err) @@ -534,9 +531,9 @@ static int opencl_device_create_internal(AVHWDeviceContext *hwdev, continue; } - err = selector->enumerate_devices(hwdev, platforms[p], platform_name, - &nb_devices, &devices, - selector->context); + err = opencl_enumerate_devices(hwdev, platforms[p], platform_name, + &nb_devices, &devices, + selector->context); if (err < 0) continue; @@ -1419,9 +1416,8 @@ static int opencl_get_plane_format(enum AVPixelFormat pixfmt, // from the same component. if (step && comp->step != step) return AVERROR(EINVAL); - + order = order * 10 + c + 1; depth = comp->depth; - order = order * 10 + comp->offset / ((depth + 7) / 8) + 1; step = comp->step; alpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA && c == desc->nb_components - 1); @@ -1457,10 +1453,14 @@ static int opencl_get_plane_format(enum AVPixelFormat pixfmt, case order: image_format->image_channel_order = type; break; switch (order) { CHANNEL_ORDER(1, CL_R); + CHANNEL_ORDER(2, CL_R); + CHANNEL_ORDER(3, CL_R); + CHANNEL_ORDER(4, CL_R); CHANNEL_ORDER(12, CL_RG); + CHANNEL_ORDER(23, CL_RG); CHANNEL_ORDER(1234, CL_RGBA); - CHANNEL_ORDER(2341, CL_ARGB); CHANNEL_ORDER(3214, CL_BGRA); + CHANNEL_ORDER(4123, CL_ARGB); #ifdef CL_ABGR CHANNEL_ORDER(4321, CL_ABGR); #endif @@ -1726,13 +1726,10 @@ static void opencl_frames_uninit(AVHWFramesContext *hwfc) av_freep(&priv->mapped_frames); #endif - if (priv->command_queue) { - cle = clReleaseCommandQueue(priv->command_queue); - if (cle != CL_SUCCESS) { - av_log(hwfc, AV_LOG_ERROR, "Failed to release frame " - "command queue: %d.\n", cle); - } - priv->command_queue = NULL; + cle = clReleaseCommandQueue(priv->command_queue); + if (cle != CL_SUCCESS) { + av_log(hwfc, AV_LOG_ERROR, "Failed to release frame " + "command queue: %d.\n", cle); } } diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_qsv.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_qsv.c index 59e4ed9157..814ce215ce 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_qsv.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_qsv.c @@ -389,7 +389,7 @@ static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, !(req->Type & (MFX_MEMTYPE_FROM_VPPIN | MFX_MEMTYPE_FROM_VPPOUT)) || !(req->Type & MFX_MEMTYPE_EXTERNAL_FRAME)) return MFX_ERR_UNSUPPORTED; - if (i->Width > i1->Width || i->Height > i1->Height || + if (i->Width != i1->Width || i->Height != i1->Height || i->FourCC != i1->FourCC || i->ChromaFormat != i1->ChromaFormat) { av_log(ctx, AV_LOG_ERROR, "Mismatching surface properties in an " "allocation request: %dx%d %d %d vs %dx%d %d %d\n", @@ -863,8 +863,7 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, mfxStatus err; int ret = 0; /* make a copy if the input is not padded as libmfx requires */ - AVFrame tmp_frame; - const AVFrame *src_frame; + AVFrame tmp_frame, *src_frame; int realigned = 0; @@ -892,7 +891,8 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, if (ret < 0) return ret; - if (src->height & 15 || src->linesize[0] & 15) { + + if (src->height & 16 || src->linesize[0] & 16) { realigned = 1; memset(&tmp_frame, 0, sizeof(tmp_frame)); tmp_frame.format = src->format; @@ -1206,7 +1206,6 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, QSVDevicePriv *priv; enum AVHWDeviceType child_device_type; AVHWDeviceContext *child_device; - AVDictionary *child_device_opts; AVDictionaryEntry *e; mfxIMPL impl; @@ -1221,17 +1220,9 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, e = av_dict_get(opts, "child_device", NULL, 0); - child_device_opts = NULL; - if (CONFIG_VAAPI) { + if (CONFIG_VAAPI) child_device_type = AV_HWDEVICE_TYPE_VAAPI; - // libmfx does not actually implement VAAPI properly, rather it - // depends on the specific behaviour of a matching iHD driver when - // used on recent Intel hardware. Set options to the VAAPI device - // creation so that we should pick a usable setup by default if - // possible, even when multiple devices and drivers are available. - av_dict_set(&child_device_opts, "kernel_driver", "i915", 0); - av_dict_set(&child_device_opts, "driver", "iHD", 0); - } else if (CONFIG_DXVA2) + else if (CONFIG_DXVA2) child_device_type = AV_HWDEVICE_TYPE_DXVA2; else { av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n"); @@ -1239,7 +1230,7 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, } ret = av_hwdevice_ctx_create(&priv->child_device_ctx, child_device_type, - e ? e->value : NULL, child_device_opts, 0); + e ? e->value : NULL, NULL, 0); if (ret < 0) return ret; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vaapi.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vaapi.c index cf117640f2..8624369bb9 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vaapi.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vaapi.c @@ -27,7 +27,6 @@ #if CONFIG_LIBDRM # include -# include # include # ifndef DRM_FORMAT_MOD_INVALID # define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1) @@ -1470,8 +1469,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, { VAAPIDevicePriv *priv; VADisplay display = NULL; - const AVDictionaryEntry *ent; - int try_drm, try_x11, try_all; priv = av_mallocz(sizeof(*priv)); if (!priv) @@ -1482,95 +1479,8 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, ctx->user_opaque = priv; ctx->free = vaapi_device_free; - ent = av_dict_get(opts, "connection_type", NULL, 0); - if (ent) { - try_all = try_drm = try_x11 = 0; - if (!strcmp(ent->value, "drm")) { - try_drm = 1; - } else if (!strcmp(ent->value, "x11")) { - try_x11 = 1; - } else { - av_log(ctx, AV_LOG_ERROR, "Invalid connection type %s.\n", - ent->value); - return AVERROR(EINVAL); - } - } else { - try_all = 1; - try_drm = HAVE_VAAPI_DRM; - try_x11 = HAVE_VAAPI_X11; - } - -#if HAVE_VAAPI_DRM - while (!display && try_drm) { - // If the device is specified, try to open it as a DRM device node. - // If not, look for a usable render node, possibly restricted to those - // using a specified kernel driver. - int loglevel = try_all ? AV_LOG_VERBOSE : AV_LOG_ERROR; - if (device) { - priv->drm_fd = open(device, O_RDWR); - if (priv->drm_fd < 0) { - av_log(ctx, loglevel, "Failed to open %s as " - "DRM device node.\n", device); - break; - } - } else { - char path[64]; - int n, max_devices = 8; -#if CONFIG_LIBDRM - const AVDictionaryEntry *kernel_driver; - kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0); -#endif - for (n = 0; n < max_devices; n++) { - snprintf(path, sizeof(path), - "/dev/dri/renderD%d", 128 + n); - priv->drm_fd = open(path, O_RDWR); - if (priv->drm_fd < 0) { - av_log(ctx, AV_LOG_VERBOSE, "Cannot open " - "DRM render node for device %d.\n", n); - break; - } -#if CONFIG_LIBDRM - if (kernel_driver) { - drmVersion *info; - info = drmGetVersion(priv->drm_fd); - if (strcmp(kernel_driver->value, info->name)) { - av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d " - "with non-matching kernel driver (%s).\n", - n, info->name); - drmFreeVersion(info); - close(priv->drm_fd); - priv->drm_fd = -1; - continue; - } - av_log(ctx, AV_LOG_VERBOSE, "Trying to use " - "DRM render node for device %d, " - "with matching kernel driver (%s).\n", - n, info->name); - drmFreeVersion(info); - } else -#endif - { - av_log(ctx, AV_LOG_VERBOSE, "Trying to use " - "DRM render node for device %d.\n", n); - } - break; - } - if (n >= max_devices) - break; - } - - display = vaGetDisplayDRM(priv->drm_fd); - if (!display) { - av_log(ctx, AV_LOG_VERBOSE, "Cannot open a VA display " - "from DRM device %s.\n", device); - return AVERROR_EXTERNAL; - } - break; - } -#endif - #if HAVE_VAAPI_X11 - if (!display && try_x11) { + if (!display && !(device && device[0] == '/')) { // Try to open the device as an X11 display. priv->x11_display = XOpenDisplay(device); if (!priv->x11_display) { @@ -1590,31 +1500,34 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, } #endif +#if HAVE_VAAPI_DRM if (!display) { - if (device) - av_log(ctx, AV_LOG_ERROR, "No VA display found for " - "device %s.\n", device); - else - av_log(ctx, AV_LOG_ERROR, "No VA display found for " - "any default device.\n"); - return AVERROR(EINVAL); - } + // Try to open the device as a DRM path. + // Default to using the first render node if the user did not + // supply a path. + const char *path = device ? device : "/dev/dri/renderD128"; + priv->drm_fd = open(path, O_RDWR); + if (priv->drm_fd < 0) { + av_log(ctx, AV_LOG_VERBOSE, "Cannot open DRM device %s.\n", + path); + } else { + display = vaGetDisplayDRM(priv->drm_fd); + if (!display) { + av_log(ctx, AV_LOG_ERROR, "Cannot open a VA display " + "from DRM device %s.\n", path); + return AVERROR_UNKNOWN; + } - ent = av_dict_get(opts, "driver", NULL, 0); - if (ent) { -#if VA_CHECK_VERSION(0, 38, 0) - VAStatus vas; - vas = vaSetDriverName(display, ent->value); - if (vas != VA_STATUS_SUCCESS) { - av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to " - "%s: %d (%s).\n", ent->value, vas, vaErrorStr(vas)); - vaTerminate(display); - return AVERROR_EXTERNAL; + av_log(ctx, AV_LOG_VERBOSE, "Opened VA display via " + "DRM device %s.\n", path); } -#else - av_log(ctx, AV_LOG_WARNING, "Driver name setting is not " - "supported with this VAAPI version.\n"); + } #endif + + if (!display) { + av_log(ctx, AV_LOG_ERROR, "No VA display found for " + "device: %s.\n", device ? device : ""); + return AVERROR(EINVAL); } return vaapi_device_connect(ctx, display); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vdpau.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vdpau.c index 6b8c1d5f76..c11c3cfdab 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vdpau.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_vdpau.c @@ -73,10 +73,8 @@ static const VDPAUPixFmtMap pix_fmts_422[] = { }; static const VDPAUPixFmtMap pix_fmts_444[] = { -#ifdef VDP_YCBCR_FORMAT_Y_U_V_444 - { VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P }, -#endif - { 0, AV_PIX_FMT_NONE, }, + { VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV444P }, + { 0, AV_PIX_FMT_NONE, }, }; static const struct { @@ -351,11 +349,7 @@ static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, return AVERROR(EINVAL); } - if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) -#ifdef VDP_YCBCR_FORMAT_Y_U_V_444 - || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444) -#endif - ) + if (vdpau_format == VDP_YCBCR_FORMAT_YV12) FFSWAP(void*, data[1], data[2]); err = priv->get_data(surf, vdpau_format, data, linesize); @@ -406,11 +400,7 @@ static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, return AVERROR(EINVAL); } - if ((vdpau_format == VDP_YCBCR_FORMAT_YV12) -#ifdef VDP_YCBCR_FORMAT_Y_U_V_444 - || (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444) -#endif - ) + if (vdpau_format == VDP_YCBCR_FORMAT_YV12) FFSWAP(const void*, data[1], data[2]); err = priv->put_data(surf, vdpau_format, data, linesize); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_videotoolbox.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_videotoolbox.c index 6eac2c0774..cc00f1f2f2 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_videotoolbox.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/hwcontext_videotoolbox.c @@ -42,9 +42,6 @@ static const struct { #ifdef kCFCoreFoundationVersionNumber10_7 { kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, AV_PIX_FMT_NV12 }, #endif -#if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE - { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange, AV_PIX_FMT_P010 }, -#endif }; enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt) diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/imgutils.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/imgutils.c index c733cb5cf5..afc73e2def 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/imgutils.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/imgutils.c @@ -311,8 +311,8 @@ static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize, { if (!dst || !src) return; - av_assert0(FFABS(src_linesize) >= bytewidth); - av_assert0(FFABS(dst_linesize) >= bytewidth); + av_assert0(abs(src_linesize) >= bytewidth); + av_assert0(abs(dst_linesize) >= bytewidth); for (;height > 0; height--) { memcpy(dst, src, bytewidth); dst += dst_linesize; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/internal.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/internal.h index 4acbcf56cb..06bd561e82 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/internal.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/internal.h @@ -52,7 +52,7 @@ #endif #ifndef emms_c -# define emms_c() do {} while(0) +# define emms_c() while(0) #endif #ifndef attribute_align_arg diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/intreadwrite.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/intreadwrite.h index 4c8413a536..67c763b135 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/intreadwrite.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/intreadwrite.h @@ -542,21 +542,6 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; # define AV_WN64A(p, v) AV_WNA(64, p, v) #endif -#if AV_HAVE_BIGENDIAN -# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p)) -# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v)) -#else -# define AV_RLA(s, p) AV_RN##s##A(p) -# define AV_WLA(s, p, v) AV_WN##s##A(p, v) -#endif - -#ifndef AV_RL64A -# define AV_RL64A(p) AV_RLA(64, p) -#endif -#ifndef AV_WL64A -# define AV_WL64A(p, v) AV_WLA(64, p, v) -#endif - /* * The AV_COPYxxU macros are suitable for copying data to/from unaligned * memory locations. diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/lfg.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/lfg.h index 03f779ad8a..2b669205d1 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/lfg.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/lfg.h @@ -24,6 +24,12 @@ #include +/** + * Context structure for the Lagged Fibonacci PRNG. + * The exact layout, types and content of this struct may change and should + * not be accessed directly. Only its sizeof() is guranteed to stay the same + * to allow easy instanciation. + */ typedef struct AVLFG { unsigned int state[64]; int index; @@ -45,8 +51,9 @@ int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length); * it may be good enough and faster for your specific use case. */ static inline unsigned int av_lfg_get(AVLFG *c){ - c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; - return c->state[c->index++ & 63]; + unsigned a = c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; + c->index += 1U; + return a; } /** @@ -57,7 +64,9 @@ static inline unsigned int av_lfg_get(AVLFG *c){ static inline unsigned int av_mlfg_get(AVLFG *c){ unsigned int a= c->state[(c->index-55) & 63]; unsigned int b= c->state[(c->index-24) & 63]; - return c->state[c->index++ & 63] = 2*a*b+a+b; + a = c->state[c->index & 63] = 2*a*b+a+b; + c->index += 1U; + return a; } /** diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/mem.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/mem.h index 5fb1a02dd9..b5c637ecf3 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/mem.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/mem.h @@ -363,10 +363,10 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size); * @endcode * * @param[in,out] ptr Already allocated buffer, or `NULL` - * @param[in,out] size Pointer to the size of buffer `ptr`. `*size` is - * updated to the new allocated size, in particular 0 - * in case of failure. - * @param[in] min_size Desired minimal size of buffer `ptr` + * @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is + * changed to `min_size` in case of success or 0 in + * case of failure + * @param[in] min_size New size of buffer `ptr` * @return `ptr` if the buffer is large enough, a pointer to newly reallocated * buffer if the buffer was not large enough, or `NULL` in case of * error @@ -397,10 +397,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); * @param[in,out] ptr Pointer to pointer to an already allocated buffer. * `*ptr` will be overwritten with pointer to new * buffer on success or `NULL` on failure - * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is - * updated to the new allocated size, in particular 0 - * in case of failure. - * @param[in] min_size Desired minimal size of buffer `*ptr` + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is + * changed to `min_size` in case of success or 0 in + * case of failure + * @param[in] min_size New size of buffer `*ptr` * @see av_realloc() * @see av_fast_mallocz() */ @@ -418,10 +418,10 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); * @param[in,out] ptr Pointer to pointer to an already allocated buffer. * `*ptr` will be overwritten with pointer to new * buffer on success or `NULL` on failure - * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is - * updated to the new allocated size, in particular 0 - * in case of failure. - * @param[in] min_size Desired minimal size of buffer `*ptr` + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is + * changed to `min_size` in case of success or 0 in + * case of failure + * @param[in] min_size New size of buffer `*ptr` * @see av_fast_malloc() */ void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size); diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/parseutils.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/parseutils.c index 167e822648..59bec6cc9d 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/parseutils.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/parseutils.c @@ -504,7 +504,7 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt) switch(c) { case 'H': case 'J': - val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, c == 'H' ? 2 : 4); + val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2); if (val == -1) return NULL; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixdesc.c b/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixdesc.c index b97b0665b0..1c36577289 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixdesc.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixdesc.c @@ -2268,82 +2268,6 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .flags = AV_PIX_FMT_FLAG_FLOAT, .alias = "yf32le", }, - [AV_PIX_FMT_YUVA422P12BE] = { - .name = "yuva422p12be", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ - { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ - { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ - { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P12LE] = { - .name = "yuva422p12le", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ - { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ - { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ - { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P12BE] = { - .name = "yuva444p12be", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ - { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ - { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ - { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P12LE] = { - .name = "yuva444p12le", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */ - { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */ - { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */ - { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_NV24] = { - .name = "nv24", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */ - { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */ - { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_NV42] = { - .name = "nv42", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */ - { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */ - { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, }; #if FF_API_PLUS1_MINUS1 FF_ENABLE_DEPRECATION_WARNINGS diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixfmt.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixfmt.h index 8b54c9415b..6815f8dc7b 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixfmt.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/pixfmt.h @@ -340,14 +340,6 @@ enum AVPixelFormat { AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian - AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian - AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian - AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian - AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian - - AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) - AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped - AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -424,8 +416,6 @@ enum AVPixelFormat { #define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) #define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) #define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) -#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE) -#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE) #define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) #define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) #define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/time_internal.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/time_internal.h index d0f007ab1c..612a75a041 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/time_internal.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/time_internal.h @@ -23,7 +23,7 @@ #include "config.h" #if !HAVE_GMTIME_R && !defined(gmtime_r) -static inline struct tm *ff_gmtime_r(const time_t* clock, struct tm *result) +static inline struct tm *gmtime_r(const time_t* clock, struct tm *result) { struct tm *ptr = gmtime(clock); if (!ptr) @@ -31,11 +31,10 @@ static inline struct tm *ff_gmtime_r(const time_t* clock, struct tm *result) *result = *ptr; return result; } -#define gmtime_r ff_gmtime_r #endif #if !HAVE_LOCALTIME_R && !defined(localtime_r) -static inline struct tm *ff_localtime_r(const time_t* clock, struct tm *result) +static inline struct tm *localtime_r(const time_t* clock, struct tm *result) { struct tm *ptr = localtime(clock); if (!ptr) @@ -43,7 +42,6 @@ static inline struct tm *ff_localtime_r(const time_t* clock, struct tm *result) *result = *ptr; return result; } -#define localtime_r ff_localtime_r #endif #endif /* AVUTIL_TIME_INTERNAL_H */ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libavutil/version.h b/trunk/3rdparty/ffmpeg-4-fit/libavutil/version.h index 24ca8ab7db..8f6da6ae42 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libavutil/version.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 31 +#define LIBAVUTIL_VERSION_MINOR 22 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/Makefile new file mode 100644 index 0000000000..53ab4626f4 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/Makefile @@ -0,0 +1,8 @@ +OBJS += arm/audio_convert_init.o \ + arm/resample_init.o + + +OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o + +NEON-OBJS += arm/audio_convert_neon.o \ + arm/resample.o diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/audio_convert_init.c b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/audio_convert_init.c new file mode 100644 index 0000000000..ec9e62ede7 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/audio_convert_init.c @@ -0,0 +1,67 @@ +/* + * This file is part of libswresample. + * + * libswresample 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. + * + * libswresample 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 libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavutil/samplefmt.h" +#include "libswresample/swresample_internal.h" +#include "libswresample/audioconvert.h" + +void swri_oldapi_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len); +void swri_oldapi_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src, int len, int channels); +void swri_oldapi_conv_fltp_to_s16_nch_neon(int16_t *dst, float *const *src, int len, int channels); + +static void conv_flt_to_s16_neon(uint8_t **dst, const uint8_t **src, int len){ + swri_oldapi_conv_flt_to_s16_neon((int16_t*)*dst, (const float*)*src, len); +} + +static void conv_fltp_to_s16_2ch_neon(uint8_t **dst, const uint8_t **src, int len){ + swri_oldapi_conv_fltp_to_s16_2ch_neon((int16_t*)*dst, (float *const*)src, len, 2); +} + +static void conv_fltp_to_s16_nch_neon(uint8_t **dst, const uint8_t **src, int len){ + int channels; + for(channels=3; channelssimd_f= NULL; + + if (have_neon(cpu_flags)) { + if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP) + ac->simd_f = conv_flt_to_s16_neon; + if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP && channels == 2) + ac->simd_f = conv_fltp_to_s16_2ch_neon; + if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP && channels > 2) + ac->simd_f = conv_fltp_to_s16_nch_neon; + if(ac->simd_f) + ac->in_simd_align_mask = ac->out_simd_align_mask = 15; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/neontest.c b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/neontest.c new file mode 100644 index 0000000000..2abbbc2367 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/neontest.c @@ -0,0 +1,29 @@ +/* + * check NEON registers for clobbers + * Copyright (c) 2013 Martin Storsjo + * + * 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 "libswresample/swresample.h" +#include "libavutil/arm/neontest.h" + +wrap(swr_convert(struct SwrContext *s, uint8_t **out, int out_count, + const uint8_t **in , int in_count)) +{ + testneonclobbers(swr_convert, s, out, out_count, in, in_count); +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/resample_init.c b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/resample_init.c new file mode 100644 index 0000000000..09b9766ff3 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libswresample/arm/arm/resample_init.c @@ -0,0 +1,120 @@ +/* + * Audio resampling + * + * Copyright (c) 2004-2012 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/cpu.h" +#include "libavutil/avassert.h" + +#include "libavutil/arm/cpu.h" +#include "libswresample/resample.h" + +#define DECLARE_RESAMPLE_COMMON_TEMPLATE(TYPE, DELEM, FELEM, FELEM2, OUT) \ + \ +void ff_resample_common_apply_filter_x4_##TYPE##_neon(FELEM2 *acc, const DELEM *src, \ + const FELEM *filter, int length); \ + \ +void ff_resample_common_apply_filter_x8_##TYPE##_neon(FELEM2 *acc, const DELEM *src, \ + const FELEM *filter, int length); \ + \ +static int ff_resample_common_##TYPE##_neon(ResampleContext *c, void *dest, const void *source, \ + int n, int update_ctx) \ +{ \ + DELEM *dst = dest; \ + const DELEM *src = source; \ + int dst_index; \ + int index = c->index; \ + int frac = c->frac; \ + int sample_index = 0; \ + int x4_aligned_filter_length = c->filter_length & ~3; \ + int x8_aligned_filter_length = c->filter_length & ~7; \ + \ + while (index >= c->phase_count) { \ + sample_index++; \ + index -= c->phase_count; \ + } \ + \ + for (dst_index = 0; dst_index < n; dst_index++) { \ + FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; \ + \ + FELEM2 val = 0; \ + int i = 0; \ + if (x8_aligned_filter_length >= 8) { \ + ff_resample_common_apply_filter_x8_##TYPE##_neon(&val, &src[sample_index], \ + filter, x8_aligned_filter_length); \ + i += x8_aligned_filter_length; \ + \ + } else if (x4_aligned_filter_length >= 4) { \ + ff_resample_common_apply_filter_x4_##TYPE##_neon(&val, &src[sample_index], \ + filter, x4_aligned_filter_length); \ + i += x4_aligned_filter_length; \ + } \ + for (; i < c->filter_length; i++) { \ + val += src[sample_index + i] * (FELEM2)filter[i]; \ + } \ + OUT(dst[dst_index], val); \ + \ + frac += c->dst_incr_mod; \ + index += c->dst_incr_div; \ + if (frac >= c->src_incr) { \ + frac -= c->src_incr; \ + index++; \ + } \ + \ + while (index >= c->phase_count) { \ + sample_index++; \ + index -= c->phase_count; \ + } \ + } \ + \ + if (update_ctx) { \ + c->frac = frac; \ + c->index = index; \ + } \ + \ + return sample_index; \ +} \ + +#define OUT(d, v) d = v +DECLARE_RESAMPLE_COMMON_TEMPLATE(float, float, float, float, OUT) +#undef OUT + +#define OUT(d, v) (v) = ((v) + (1<<(14)))>>15; (d) = av_clip_int16(v) +DECLARE_RESAMPLE_COMMON_TEMPLATE(s16, int16_t, int16_t, int32_t, OUT) +#undef OUT + +av_cold void swri_resample_dsp_arm_init(ResampleContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (!have_neon(cpu_flags)) + return; + + switch(c->format) { + case AV_SAMPLE_FMT_FLTP: + c->dsp.resample_common = ff_resample_common_float_neon; + break; + case AV_SAMPLE_FMT_S16P: + c->dsp.resample_common = ff_resample_common_s16_neon; + break; + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswresample/swresample.c b/trunk/3rdparty/ffmpeg-4-fit/libswresample/swresample.c index 1ac5ef9a30..6d28e6a798 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libswresample/swresample.c +++ b/trunk/3rdparty/ffmpeg-4-fit/libswresample/swresample.c @@ -164,14 +164,6 @@ av_cold int swr_init(struct SwrContext *s){ return AVERROR(EINVAL); } - if(s-> in_sample_rate <= 0){ - av_log(s, AV_LOG_ERROR, "Requested input sample rate %d is invalid\n", s->in_sample_rate); - return AVERROR(EINVAL); - } - if(s->out_sample_rate <= 0){ - av_log(s, AV_LOG_ERROR, "Requested output sample rate %d is invalid\n", s->out_sample_rate); - return AVERROR(EINVAL); - } s->out.ch_count = s-> user_out_ch_count; s-> in.ch_count = s-> user_in_ch_count; s->used_ch_count = s->user_used_ch_count; diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswresample/version.h b/trunk/3rdparty/ffmpeg-4-fit/libswresample/version.h index a0b361bc1f..8555d550d9 100644 --- a/trunk/3rdparty/ffmpeg-4-fit/libswresample/version.h +++ b/trunk/3rdparty/ffmpeg-4-fit/libswresample/version.h @@ -29,7 +29,7 @@ #include "libavutil/avutil.h" #define LIBSWRESAMPLE_VERSION_MAJOR 3 -#define LIBSWRESAMPLE_VERSION_MINOR 5 +#define LIBSWRESAMPLE_VERSION_MINOR 3 #define LIBSWRESAMPLE_VERSION_MICRO 100 #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/Makefile b/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/Makefile new file mode 100644 index 0000000000..792da6b715 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/Makefile @@ -0,0 +1,8 @@ +OBJS += arm/swscale.o \ + arm/swscale_unscaled.o \ + +NEON-OBJS += arm/rgb2yuv_neon_32.o +NEON-OBJS += arm/rgb2yuv_neon_16.o +NEON-OBJS += arm/hscale.o \ + arm/output.o \ + arm/yuv2rgb_neon.o \ diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/swscale.c b/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/swscale.c new file mode 100644 index 0000000000..1ec360fe24 --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/swscale.c @@ -0,0 +1,44 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libswscale/swscale.h" +#include "libswscale/swscale_internal.h" +#include "libavutil/arm/cpu.h" + +void ff_hscale_8_to_15_neon(SwsContext *c, int16_t *dst, int dstW, + const uint8_t *src, const int16_t *filter, + const int32_t *filterPos, int filterSize); + +void ff_yuv2planeX_8_neon(const int16_t *filter, int filterSize, + const int16_t **src, uint8_t *dest, int dstW, + const uint8_t *dither, int offset); + +av_cold void ff_sws_init_swscale_arm(SwsContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + if (c->srcBpc == 8 && c->dstBpc <= 14) { + c->hyScale = c->hcScale = ff_hscale_8_to_15_neon; + } + if (c->dstBpc == 8) { + c->yuv2planeX = ff_yuv2planeX_8_neon; + } + } +} diff --git a/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/swscale_unscaled.c b/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/swscale_unscaled.c new file mode 100644 index 0000000000..e41f294eac --- /dev/null +++ b/trunk/3rdparty/ffmpeg-4-fit/libswscale/arm/arm/swscale_unscaled.c @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2013 Xiaolei Yu + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libswscale/swscale.h" +#include "libswscale/swscale_internal.h" +#include "libavutil/arm/cpu.h" + +#if HAVE_AS_DN_DIRECTIVE +extern void rgbx_to_nv12_neon_32(const uint8_t *src, uint8_t *y, uint8_t *chroma, + int width, int height, + int y_stride, int c_stride, int src_stride, + int32_t coeff_tbl[9]); + +extern void rgbx_to_nv12_neon_16(const uint8_t *src, uint8_t *y, uint8_t *chroma, + int width, int height, + int y_stride, int c_stride, int src_stride, + int32_t coeff_tbl[9]); + +static int rgbx_to_nv12_neon_32_wrapper(SwsContext *context, const uint8_t *src[], + int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *dst[], int dstStride[]) { + + rgbx_to_nv12_neon_32(src[0] + srcSliceY * srcStride[0], + dst[0] + srcSliceY * dstStride[0], + dst[1] + (srcSliceY / 2) * dstStride[1], + context->srcW, srcSliceH, + dstStride[0], dstStride[1], srcStride[0], + context->input_rgb2yuv_table); + + return 0; +} + +static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *src[], + int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *dst[], int dstStride[]) { + + rgbx_to_nv12_neon_16(src[0] + srcSliceY * srcStride[0], + dst[0] + srcSliceY * dstStride[0], + dst[1] + (srcSliceY / 2) * dstStride[1], + context->srcW, srcSliceH, + dstStride[0], dstStride[1], srcStride[0], + context->input_rgb2yuv_table); + + return 0; +} + +#define YUV_TO_RGB_TABLE \ + c->yuv2rgb_v2r_coeff, \ + c->yuv2rgb_u2g_coeff, \ + c->yuv2rgb_v2g_coeff, \ + c->yuv2rgb_u2b_coeff, \ + +#define DECLARE_FF_YUVX_TO_RGBX_FUNCS(ifmt, ofmt) \ +int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \ + uint8_t *dst, int linesize, \ + const uint8_t *srcY, int linesizeY, \ + const uint8_t *srcU, int linesizeU, \ + const uint8_t *srcV, int linesizeV, \ + const int16_t *table, \ + int y_offset, \ + int y_coeff); \ + \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ + int srcStride[], int srcSliceY, int srcSliceH, \ + uint8_t *dst[], int dstStride[]) { \ + const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \ + \ + ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ + dst[0] + srcSliceY * dstStride[0], dstStride[0], \ + src[0], srcStride[0], \ + src[1], srcStride[1], \ + src[2], srcStride[2], \ + yuv2rgb_table, \ + c->yuv2rgb_y_offset >> 6, \ + c->yuv2rgb_y_coeff); \ + \ + return 0; \ +} \ + +#define DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuvx) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, argb) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, rgba) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, abgr) \ +DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, bgra) \ + +DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuv420p) +DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuv422p) + +#define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt) \ +int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \ + uint8_t *dst, int linesize, \ + const uint8_t *srcY, int linesizeY, \ + const uint8_t *srcC, int linesizeC, \ + const int16_t *table, \ + int y_offset, \ + int y_coeff); \ + \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ + int srcStride[], int srcSliceY, int srcSliceH, \ + uint8_t *dst[], int dstStride[]) { \ + const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \ + \ + ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ + dst[0] + srcSliceY * dstStride[0], dstStride[0], \ + src[0], srcStride[0], src[1], srcStride[1], \ + yuv2rgb_table, \ + c->yuv2rgb_y_offset >> 6, \ + c->yuv2rgb_y_coeff); \ + \ + return 0; \ +} \ + +#define DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, argb) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, rgba) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, abgr) \ +DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra) \ + +DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv12) +DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nv21) + +/* We need a 16 pixel width alignment. This constraint can easily be removed + * for input reading but for the output which is 4-bytes per pixel (RGBA) the + * assembly might be writing as much as 4*15=60 extra bytes at the end of the + * line, which won't fit the 32-bytes buffer alignment. */ +#define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \ + if (c->srcFormat == AV_PIX_FMT_##IFMT \ + && c->dstFormat == AV_PIX_FMT_##OFMT \ + && !(c->srcH & 1) \ + && !(c->srcW & 15) \ + && !accurate_rnd) { \ + c->swscale = ifmt##_to_##ofmt##_neon_wrapper; \ + } \ +} while (0) + +#define SET_FF_NVX_TO_ALL_RGBX_FUNC(nvx, NVX, accurate_rnd) do { \ + SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, argb, ARGB, accurate_rnd); \ + SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, rgba, RGBA, accurate_rnd); \ + SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, abgr, ABGR, accurate_rnd); \ + SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, bgra, BGRA, accurate_rnd); \ +} while (0) + +static void get_unscaled_swscale_neon(SwsContext *c) { + int accurate_rnd = c->flags & SWS_ACCURATE_RND; + if (c->srcFormat == AV_PIX_FMT_RGBA + && c->dstFormat == AV_PIX_FMT_NV12 + && (c->srcW >= 16)) { + c->swscale = accurate_rnd ? rgbx_to_nv12_neon_32_wrapper + : rgbx_to_nv12_neon_16_wrapper; + } + + SET_FF_NVX_TO_ALL_RGBX_FUNC(nv12, NV12, accurate_rnd); + SET_FF_NVX_TO_ALL_RGBX_FUNC(nv21, NV21, accurate_rnd); + SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv420p, YUV420P, accurate_rnd); + SET_FF_NVX_TO_ALL_RGBX_FUNC(yuv422p, YUV422P, accurate_rnd); +} + +void ff_get_unscaled_swscale_arm(SwsContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + if (have_neon(cpu_flags)) + get_unscaled_swscale_neon(c); +} +#else +void ff_get_unscaled_swscale_arm(SwsContext *c) +{ +} +#endif diff --git a/trunk/3rdparty/libsrtp-2-fit/config_in.h b/trunk/3rdparty/libsrtp-2-fit/config_in.h index 31e6ffe385..3ca64f1e43 100644 --- a/trunk/3rdparty/libsrtp-2-fit/config_in.h +++ b/trunk/3rdparty/libsrtp-2-fit/config_in.h @@ -138,9 +138,6 @@ /* Define this to use OpenSSL crypto. */ #undef OPENSSL -/* Define this if OPENSSL_cleanse is broken. */ -#undef OPENSSL_CLEANSE_BROKEN - /* Define this to use OpenSSL KDF for SRTP. */ #undef OPENSSL_KDF diff --git a/trunk/3rdparty/libsrtp-2-fit/configure b/trunk/3rdparty/libsrtp-2-fit/configure index 93c9840e8d..7cb1398cc2 100755 --- a/trunk/3rdparty/libsrtp-2-fit/configure +++ b/trunk/3rdparty/libsrtp-2-fit/configure @@ -5897,60 +5897,6 @@ $as_echo "#define OPENSSL 1" >>confdefs.h USE_EXTERNAL_CRYPTO=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OPENSSL_cleanse is broken" >&5 -$as_echo_n "checking if OPENSSL_cleanse is broken... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - -int -main () -{ - - #define BUFFER_SIZE (16) - char buffer[BUFFER_SIZE]; - int i; - for (i = 0; i < BUFFER_SIZE; i++) { - buffer[i] = i & 0xff; - } - OPENSSL_cleanse(buffer, BUFFER_SIZE); - for (i = 0; i < BUFFER_SIZE; i++) { - if (buffer[i]) { - printf("Buffer contents not zero at position %d (is %d)\n", i, - buffer[i]); - return 1; - } - } - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - openssl_cleanse_broken=no -else - - openssl_cleanse_broken=yes - -$as_echo "#define OPENSSL_CLEANSE_BROKEN 1" >>confdefs.h - - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $openssl_cleanse_broken" >&5 -$as_echo "$openssl_cleanse_broken" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to leverage OpenSSL KDF algorithm" >&5 $as_echo_n "checking whether to leverage OpenSSL KDF algorithm... " >&6; } # Check whether --enable-openssl-kdf was given. diff --git a/trunk/3rdparty/libsrtp-2-fit/configure.ac b/trunk/3rdparty/libsrtp-2-fit/configure.ac index fc312bbdc2..2207a9c708 100644 --- a/trunk/3rdparty/libsrtp-2-fit/configure.ac +++ b/trunk/3rdparty/libsrtp-2-fit/configure.ac @@ -263,31 +263,6 @@ if test "$enable_openssl" = "yes"; then HMAC_OBJS=crypto/hash/hmac_ossl.o AC_SUBST([USE_EXTERNAL_CRYPTO], [1]) - AC_MSG_CHECKING([if OPENSSL_cleanse is broken]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([ - #include - #include - ], [ - #define BUFFER_SIZE (16) - char buffer[[BUFFER_SIZE]]; - int i; - for (i = 0; i < BUFFER_SIZE; i++) { - buffer[[i]] = i & 0xff; - } - OPENSSL_cleanse(buffer, BUFFER_SIZE); - for (i = 0; i < BUFFER_SIZE; i++) { - if (buffer[[i]]) { - printf("Buffer contents not zero at position %d (is %d)\n", i, - buffer[[i]]); - return 1; - } - } - ])], [openssl_cleanse_broken=no], [ - openssl_cleanse_broken=yes - AC_DEFINE([OPENSSL_CLEANSE_BROKEN], [1], [Define this if OPENSSL_cleanse is broken.]) - ]) - AC_MSG_RESULT([$openssl_cleanse_broken]) - AC_MSG_CHECKING([whether to leverage OpenSSL KDF algorithm]) AC_ARG_ENABLE([openssl-kdf], [AS_HELP_STRING([--enable-openssl-kdf], [Use OpenSSL KDF algorithm])], diff --git a/trunk/3rdparty/libsrtp-2-fit/crypto/math/datatypes.c b/trunk/3rdparty/libsrtp-2-fit/crypto/math/datatypes.c index 001584c1bf..8a342e2af2 100644 --- a/trunk/3rdparty/libsrtp-2-fit/crypto/math/datatypes.c +++ b/trunk/3rdparty/libsrtp-2-fit/crypto/math/datatypes.c @@ -436,7 +436,7 @@ void srtp_cleanse(void *s, size_t len) void octet_string_set_to_zero(void *s, size_t len) { -#if defined(OPENSSL) && !defined(OPENSSL_CLEANSE_BROKEN) +#ifdef OPENSSL OPENSSL_cleanse(s, len); #else srtp_cleanse(s, len); diff --git a/trunk/3rdparty/libsrtp-2-fit/crypto/test/datatypes_driver.c b/trunk/3rdparty/libsrtp-2-fit/crypto/test/datatypes_driver.c index 96379befe1..2f78903eb8 100644 --- a/trunk/3rdparty/libsrtp-2-fit/crypto/test/datatypes_driver.c +++ b/trunk/3rdparty/libsrtp-2-fit/crypto/test/datatypes_driver.c @@ -60,8 +60,6 @@ void print_string(char *s); void test_bswap(void); -void test_set_to_zero(void); - int main(void) { /* @@ -137,7 +135,6 @@ int main(void) printf(" } \n"); test_bswap(); - test_set_to_zero(); return 0; } @@ -231,26 +228,3 @@ void test_bswap(void) printf("bswapped octet string: %s\n", octet_string_hex_string((uint8_t *)&y, 8)); } - -void test_set_to_zero(void) -{ -#define BUFFER_SIZE (16) - uint8_t buffer[BUFFER_SIZE]; - size_t i; - - for (i = 0; i < BUFFER_SIZE; i++) { - buffer[i] = i & 0xff; - } - printf("Buffer before: %s\n", octet_string_hex_string(buffer, BUFFER_SIZE)); - octet_string_set_to_zero(buffer, BUFFER_SIZE); - printf("Buffer after: %s\n", octet_string_hex_string(buffer, BUFFER_SIZE)); - for (i = 0; i < BUFFER_SIZE; i++) { - if (buffer[i]) { - fprintf(stderr, - "Buffer contents not zero at position %zu (is %d)\n", i, - buffer[i]); - abort(); - } - } -#undef BUFFER_SIZE -} diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index b773488e38..d259115f25 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -376,7 +376,7 @@ fi # state-threads ##################################################################################### # check the cross build flag file, if flag changed, need to rebuild the st. -_ST_MAKE=linux-debug && _ST_LD=${SRS_TOOL_LD} && _ST_OBJ="LINUX_`uname -r`_DBG" +_ST_MAKE=linux-debug && _ST_OBJ="LINUX_`uname -r`_DBG" # Always alloc on heap, @see https://github.com/ossrs/srs/issues/509#issuecomment-719931676 _ST_EXTRA_CFLAGS="-DMALLOC_STACK" # For valgrind to detect memory issues. @@ -385,7 +385,7 @@ if [[ $SRS_VALGRIND == YES ]]; then fi # for osx, use darwin for st, donot use epoll. if [[ $SRS_OSX == YES ]]; then - _ST_MAKE=darwin-debug && _ST_LD=${SRS_TOOL_CC} && _ST_OBJ="DARWIN_`uname -r`_DBG" + _ST_MAKE=darwin-debug && _ST_OBJ="DARWIN_`uname -r`_DBG" fi # Whether enable debug stats. if [[ $SRS_DEBUG_STATS == YES ]]; then @@ -403,7 +403,7 @@ else fi # The final args to make st. _ST_MAKE_ARGS="${_ST_MAKE} STATIC_ONLY=${_ST_STATIC_ONLY}" -_ST_MAKE_ARGS="${_ST_MAKE_ARGS} CC=${SRS_TOOL_CC} AR=${SRS_TOOL_AR} LD=${_ST_LD} RANDLIB=${SRS_TOOL_RANDLIB}" +_ST_MAKE_ARGS="${_ST_MAKE_ARGS} CC=${SRS_TOOL_CC} AR=${SRS_TOOL_AR} LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB}" # Patched ST from https://github.com/ossrs/state-threads/tree/srs if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/st-srs/${_ST_OBJ}/libst.a ]]; then echo "The state-threads is ok."; @@ -528,7 +528,9 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then OPENSSL_CONFIG="./config" # https://stackoverflow.com/questions/15539062/cross-compiling-of-openssl-for-linux-arm-v5te-linux-gnueabi-toolchain if [[ $SRS_CROSS_BUILD == YES ]]; then - OPENSSL_CONFIG="./Configure linux-armv4" + OPENSSL_CONFIG="./Configure linux-generic32" + if [[ $SRS_CROSS_BUILD_ARMV7 == YES ]]; then OPENSSL_CONFIG="./Configure linux-armv4"; fi + if [[ $SRS_CROSS_BUILD_AARCH64 == YES ]]; then OPENSSL_CONFIG="./Configure linux-aarch64"; fi elif [[ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib/libssl.a ]]; then # Try to use exists libraries. if [[ -f /usr/local/ssl/lib/libssl.a && $SRS_SSL_LOCAL == NO ]]; then @@ -597,11 +599,16 @@ fi ##################################################################################### # srtp ##################################################################################### -SRTP_CONFIG="echo SRTP without openssl(ASM) optimization" && SRTP_OPTIONS="" +SRTP_OPTIONS="" # If use ASM for SRTP, we enable openssl(with ASM). if [[ $SRS_SRTP_ASM == YES ]]; then - echo "SRTP with openssl(ASM) optimization" && - SRTP_CONFIG="export PKG_CONFIG_PATH=../openssl/lib/pkgconfig" && SRTP_OPTIONS="--enable-openssl" + SRTP_OPTIONS="--enable-openssl" + SRTP_CONFIGURE="env PKG_CONFIG_PATH=$(cd ${SRS_OBJS}/${SRS_PLATFORM} && pwd)/openssl/lib/pkgconfig ./configure" +else + SRTP_CONFIGURE="./configure" +fi +if [[ $SRS_CROSS_BUILD == YES ]]; then + SRTP_OPTIONS="$SRTP_OPTIONS --host=$SRS_CROSS_BUILD_HOST" fi # Patched ST from https://github.com/ossrs/state-threads/tree/srs if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/_release/lib/libsrtp2.a ]]; then @@ -611,7 +618,7 @@ else ( rm -rf ${SRS_OBJS}/srtp2 && cd ${SRS_OBJS}/${SRS_PLATFORM} && rm -rf libsrtp-2-fit && cp -R ../../3rdparty/libsrtp-2-fit . && cd libsrtp-2-fit && - ${SRTP_CONFIG} && ./configure ${SRTP_OPTIONS} --prefix=`pwd`/_release && + $SRTP_CONFIGURE ${SRTP_OPTIONS} --prefix=`pwd`/_release && make ${SRS_JOBS} && make install && cd .. && rm -rf srtp2 && ln -sf libsrtp-2-fit/_release srtp2 ) @@ -626,10 +633,11 @@ if [ ! -f ${SRS_OBJS}/srtp2/lib/libsrtp2.a ]; then echo "Build libsrtp-2-fit sta ##################################################################################### # libopus, for WebRTC to transcode AAC with Opus. ##################################################################################### -if [[ $SRS_RTC == YES ]]; then +# For cross build, we use opus of FFmpeg, so we don't build the libopus. +if [[ $SRS_RTC == YES && $SRS_CROSS_BUILD == NO ]]; then # Only build static libraries if no shared FFmpeg. if [[ $SRS_SHARED_FFMPEG == NO ]]; then - OPUS_OPTIONS="--disable-shared" + OPUS_OPTIONS="--disable-shared --disable-doc" fi if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/opus-1.3.1/_release/lib/libopus.a ]]; then echo "The opus-1.3.1 is ok."; @@ -638,7 +646,8 @@ if [[ $SRS_RTC == YES ]]; then ( rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/opus-1.3.1 && cd ${SRS_OBJS}/${SRS_PLATFORM} && tar xf ../../3rdparty/opus-1.3.1.tar.gz && cd opus-1.3.1 && - ./configure --prefix=`pwd`/_release --enable-static $OPUS_OPTIONS && make ${SRS_JOBS} && make install + ./configure --prefix=`pwd`/_release --enable-static $OPUS_OPTIONS && + make ${SRS_JOBS} && make install && cd .. && rm -rf opus && ln -sf opus-1.3.1/_release opus ) fi @@ -655,19 +664,32 @@ fi ##################################################################################### if [[ $SRS_FFMPEG_FIT == YES ]]; then FFMPEG_OPTIONS="" + if [[ $SRS_CROSS_BUILD == YES ]]; then + FFMPEG_CONFIGURE=./configure + else + FFMPEG_CONFIGURE="env PKG_CONFIG_PATH=$(cd ${SRS_OBJS}/${SRS_PLATFORM} && pwd)/opus/lib/pkgconfig ./configure" + fi # If disable nasm, disable all ASMs. - if [[ $SRS_NASM == NO ]]; then + nasm -v >/dev/null 2>&1 && NASM_BIN_OK=YES + if [[ $NASM_BIN_OK != YES || $SRS_NASM == NO || $SRS_CROSS_BUILD == YES ]]; then FFMPEG_OPTIONS="--disable-asm --disable-x86asm --disable-inline-asm" fi - # If no nasm, we disable the x86asm. - nasm -v >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - FFMPEG_OPTIONS="--disable-x86asm" - fi # Only build static libraries if no shared FFmpeg. if [[ $SRS_SHARED_FFMPEG == YES ]]; then FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-shared" fi + # For cross-build. + if [[ $SRS_CROSS_BUILD == YES ]]; then + FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-cross-compile --target-os=linux" + if [[ $SRS_CROSS_BUILD_ARMV7 ]]; then FFMPEG_OPTIONS="$FFMPEG_OPTIONS --arch=arm"; fi + if [[ $SRS_CROSS_BUILD_AARCH64 ]]; then FFMPEG_OPTIONS="$FFMPEG_OPTIONS --arch=aarch64"; fi + FFMPEG_OPTIONS="$FFMPEG_OPTIONS --cross-prefix=$SRS_CROSS_BUILD_PREFIX" + FFMPEG_OPTIONS="$FFMPEG_OPTIONS --cc=${SRS_TOOL_CC} --cxx=${SRS_TOOL_CXX} --ar=${SRS_TOOL_AR} --ld=${SRS_TOOL_LD}" + FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-decoder=opus --enable-encoder=opus" + else + FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-decoder=libopus --enable-encoder=libopus --enable-libopus" + fi if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/_release/lib/libavcodec.a ]]; then echo "The ffmpeg-4-fit is ok."; @@ -677,20 +699,24 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit && mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit && # Create a hidden directory .src cd ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit && cp -R ../../../3rdparty/ffmpeg-4-fit/* . && - # For libopus and other codecs. - ABS_OBJS=$(cd .. && pwd) && # Build source code. - PKG_CONFIG_PATH=$ABS_OBJS/opus/lib/pkgconfig ./configure \ - --prefix=`pwd`/_release \ - --pkg-config-flags="--static" --extra-libs="-lpthread" --extra-libs="-lm" ${FFMPEG_OPTIONS} \ + $FFMPEG_CONFIGURE \ + --prefix=`pwd`/_release --pkg-config=pkg-config ${FFMPEG_OPTIONS} \ + --disable-everything --pkg-config-flags="--static" --extra-libs="-lpthread" --extra-libs="-lm" \ --disable-programs --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages \ --disable-avdevice --disable-avformat --disable-swscale --disable-postproc --disable-avfilter --disable-network \ --disable-dct --disable-dwt --disable-error-resilience --disable-lsp --disable-lzo --disable-faan --disable-pixelutils \ - --disable-hwaccels --disable-devices --disable-audiotoolbox --disable-videotoolbox --disable-cuda-llvm --disable-cuvid \ + --disable-hwaccels --disable-devices --disable-audiotoolbox --disable-videotoolbox --disable-cuvid \ --disable-d3d11va --disable-dxva2 --disable-ffnvcodec --disable-nvdec --disable-nvenc --disable-v4l2-m2m --disable-vaapi \ --disable-vdpau --disable-appkit --disable-coreimage --disable-avfoundation --disable-securetransport --disable-iconv \ --disable-lzma --disable-sdl2 --disable-everything --enable-decoder=aac --enable-decoder=aac_fixed --enable-decoder=aac_latm \ - --enable-decoder=libopus --enable-encoder=aac --enable-encoder=opus --enable-encoder=libopus --enable-libopus && + --enable-encoder=aac && + # See https://www.laoyuyu.me/2019/05/23/android/clang_compile_ffmpeg/ + if [[ $SRS_CROSS_BUILD == YES ]]; then + sed -i -e 's/#define getenv(x) NULL/\/\*#define getenv(x) NULL\*\//g' config.h && + sed -i -e 's/#define HAVE_GMTIME_R 0/#define HAVE_GMTIME_R 1/g' config.h && + sed -i -e 's/#define HAVE_LOCALTIME_R 0/#define HAVE_LOCALTIME_R 1/g' config.h + fi && make ${SRS_JOBS} && make install && cd .. && rm -rf ffmpeg && ln -sf ffmpeg-4-fit/_release ffmpeg ) @@ -706,10 +732,13 @@ fi ##################################################################################### # live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2. ##################################################################################### +# Guess whether the ffmpeg is. +SYSTEMP_FFMPEG_BIN=/usr/local/bin/ffmpeg +if [[ ! -f $SYSTEMP_FFMPEG_BIN ]]; then SYSTEMP_FFMPEG_BIN=/usr/local/ffmpeg/bin/ffmpeg; fi # Always link the ffmpeg tools if exists. -if [[ -f /usr/local/bin/ffmpeg && ! -f ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg ]]; then +if [[ -f $SYSTEMP_FFMPEG_BIN && ! -f ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg ]]; then mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin && - ln -sf /usr/local/bin/ffmpeg ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg && + ln -sf $SYSTEMP_FFMPEG_BIN ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg && (cd ${SRS_OBJS} && rm -rf ffmpeg && ln -sf ${SRS_PLATFORM}/ffmpeg) fi if [ $SRS_FFMPEG_TOOL = YES ]; then diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 8bf8106f76..00025bf73e 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -5,7 +5,7 @@ help=no # feature options SRS_HDS=NO SRS_SRT=NO -SRS_RTC=RESERVED +SRS_RTC=YES SRS_CXX11=YES SRS_CXX14=NO SRS_NGINX=NO @@ -77,6 +77,13 @@ SRS_GPROF=NO # Performance test: gprof SRS_X86_X64=NO # For x86_64 servers SRS_OSX=NO #For osx/macOS PC. SRS_CROSS_BUILD=NO #For cross build, for example, on Ubuntu. +# For cross build, whether armv7 or armv8(aarch64). +SRS_CROSS_BUILD_ARMV7=NO +SRS_CROSS_BUILD_AARCH64=NO +# For cross build, the host, for example(libsrtp), --host=aarch64-linux-gnu +SRS_CROSS_BUILD_HOST= +# For cross build, the cross prefix, for example(FFmpeg), --cross-prefix=aarch64-linux-gnu- +SRS_CROSS_BUILD_PREFIX= # ##################################################################################### # Toolchain for cross-build on Ubuntu for ARM or MIPS. @@ -196,6 +203,11 @@ function parse_user_option() { echo "Error: The $option is not supported yet"; exit 1 fi + if [[ $option == '--arm' || $option == '--mips' || $option == '--with-arm-ubuntu12' || $option == '--with-mips-ubuntu12' ]]; then + echo "Error: Removed misleading option $option, please read https://github.com/ossrs/srs/wiki/v4_CN_SrsLinuxArm#ubuntu-cross-build-srs" + exit -1 + fi + # Parse options to variables. case "$option" in -h) help=yes ;; @@ -315,14 +327,6 @@ function parse_user_option() { # Alias for --arm, cross build. --cross-build) SRS_CROSS_BUILD=YES ;; - --arm) SRS_CROSS_BUILD=YES ;; - --mips) SRS_CROSS_BUILD=YES ;; - --with-arm-ubuntu12) SRS_CROSS_BUILD=YES ;; - --without-arm-ubuntu12) SRS_CROSS_BUILD=NO ;; - --arm-ubuntu12) SRS_CROSS_BUILD=$(switch2value $value) ;; - --with-mips-ubuntu12) SRS_CROSS_BUILD=YES ;; - --without-mips-ubuntu12) SRS_CROSS_BUILD=NO ;; - --mips-ubuntu12) SRS_CROSS_BUILD=$(switch2value $value) ;; # Deprecated, might be removed in future. --with-nginx) SRS_NGINX=YES ;; @@ -388,9 +392,16 @@ function apply_auto_options() { SRS_X86_X64=YES; opt="--x86-x64 $opt"; fi - # Setup the default values if not set. - if [[ $SRS_RTC == RESERVED ]]; then - SRS_RTC=YES; if [[ $SRS_CROSS_BUILD == YES ]]; then SRS_RTC=NO; fi + if [[ $SRS_CROSS_BUILD == YES ]]; then + SRS_CROSS_BUILD_HOST=$(echo $SRS_TOOL_CC|awk -F '-gcc' '{print $1}') + SRS_CROSS_BUILD_PREFIX="${SRS_CROSS_BUILD_HOST}-" + echo $SRS_TOOL_CC| grep arm >/dev/null 2>&1 && SRS_CROSS_BUILD_ARMV7=YES + echo $SRS_TOOL_CC| grep aarch64 >/dev/null 2>&1 && SRS_CROSS_BUILD_AARCH64=YES + echo "For cross build, host: $SRS_CROSS_BUILD_HOST, prefix: $SRS_CROSS_BUILD_PREFIX, armv7: $SRS_CROSS_BUILD_ARMV7, aarch64: $SRS_CROSS_BUILD_AARCH64" + fi + + if [[ $SRS_OSX == YES ]]; then + SRS_TOOL_LD=$SRS_TOOL_CC fi # The SRT code in SRS requires c++11, although we build libsrt without c++11. diff --git a/trunk/auto/setup_variables.sh b/trunk/auto/setup_variables.sh index 23440a001f..cf9b1a98b6 100755 --- a/trunk/auto/setup_variables.sh +++ b/trunk/auto/setup_variables.sh @@ -17,7 +17,11 @@ else SRS_PLATFORM="${SRS_PLATFORM}-${GCC_VERSION}" fi # Use isolate cache for different SRS version. -SRS_PLATFORM="${SRS_PLATFORM}-SRS5" +SRS_PLATFORM="${SRS_PLATFORM}-SRS5-$(uname -m)" + +if [[ $SRS_CROSS_BUILD == YES ]]; then + SRS_PLATFORM="${SRS_PLATFORM}-CROSSBUILD-$(echo $SRS_TOOL_CC|awk -F - '{print $1}')" +fi echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS_DIR: ${SRS_OBJS_DIR}, SRS_OBJS: ${SRS_OBJS}, SRS_PLATFORM: ${SRS_PLATFORM}" diff --git a/trunk/configure b/trunk/configure index 5c67641c88..0eb2e2bc03 100755 --- a/trunk/configure +++ b/trunk/configure @@ -115,7 +115,6 @@ cat << END >> ${SRS_OBJS}/${SRS_MAKEFILE} GCC = ${SRS_TOOL_CC} CXX = ${SRS_TOOL_CXX} AR = ${SRS_TOOL_AR} -ARFLAGS = -rs LINK = ${SRS_TOOL_CXX} CXXFLAGS = ${CXXFLAGS} @@ -142,7 +141,9 @@ fi # FFMPEG for WebRTC transcoding, such as aac to opus. if [[ $SRS_FFMPEG_FIT == YES ]]; then LibFfmpegRoot="${SRS_OBJS_DIR}/ffmpeg/include"; LibFfmpegFile="${SRS_OBJS_DIR}/ffmpeg/lib/libavcodec.a ${SRS_OBJS_DIR}/ffmpeg/lib/libswresample.a ${SRS_OBJS_DIR}/ffmpeg/lib/libavutil.a" - LibFfmpegRoot="${LibFfmpegRoot} ${SRS_OBJS_DIR}/opus/include"; LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS_DIR}/opus/lib/libopus.a" + if [[ $SRS_CROSS_BUILD == NO ]]; then + LibFfmpegRoot="${LibFfmpegRoot} ${SRS_OBJS_DIR}/opus/include"; LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS_DIR}/opus/lib/libopus.a" + fi if [[ $SRS_SHARED_FFMPEG == YES ]]; then LibFfmpegFile="-L${SRS_OBJS_DIR}/ffmpeg/lib -lavcodec -lswresample -lavutil -L${SRS_OBJS_DIR}/opus/lib -lopus"; fi fi @@ -456,6 +457,13 @@ cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE} .PHONY: clean_srs clean_modules clean_openssl clean_srtp2 clean_opus clean_ffmpeg clean_st .PHONY: st ffmpeg +GCC = ${SRS_TOOL_CC} +CXX = ${SRS_TOOL_CXX} +AR = ${SRS_TOOL_AR} +LINK = ${SRS_TOOL_LD} +RANDLIB = ${SRS_TOOL_RANDLIB} +CXXFLAGS = ${CXXFLAGS} + # install prefix. SRS_PREFIX=${SRS_PREFIX} __REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX) @@ -534,7 +542,7 @@ clean_st: st: (cd ${SRS_OBJS_DIR} && rm -f srs srs_utest) (cd ${SRS_OBJS_DIR}/${SRS_PLATFORM}/st-srs && \$(MAKE) clean) - (cd ${SRS_OBJS_DIR}/${SRS_PLATFORM}/st-srs && env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \$(MAKE) ${_ST_MAKE_ARGS}) + (cd ${SRS_OBJS_DIR}/${SRS_PLATFORM}/st-srs && env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \$(MAKE) ${_ST_MAKE_ARGS} CC=\$(GCC) AR=\$(AR) LD=\$(LINK) RANDLIB=\$(RANDLIB)) @echo "Please rebuild srs by: rm -f objs/srs && make" ffmpeg: diff --git a/trunk/research/console/en_index.html b/trunk/research/console/en_index.html index 9c0c28169e..6c16c7d68c 100644 --- a/trunk/research/console/en_index.html +++ b/trunk/research/console/en_index.html @@ -20,7 +20,7 @@ - +