summaryrefslogtreecommitdiff
path: root/libavcodec/vp9dsp.c
Commit message (Collapse)AuthorAge
* all: Replace if (ARCH_FOO) checks by #if ARCH_FOOAndreas Rheinhardt2022-06-15
| | | | | | | | | | | | | | | | | | This is more spec-compliant because it does not rely on dead-code elimination by the compiler. Especially MSVC has problems with this, as can be seen in https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html or https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html This commit does not eliminate every instance where we rely on dead code elimination: It only tackles branching to the initialization of arch-specific dsp code, not e.g. all uses of CONFIG_ and HAVE_ checks. But maybe it is already enough to compile FFmpeg with MSVC with whole-programm-optimizations enabled (if one does not disable too many components). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-24
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: [loongarch] Optimize vp9_mc/intra with LSX.Hao Chen2021-12-23
| | | | | | | | | ffmpeg -i ../10_vp9_1080p_30fps_3Mbps.webm -f rawvideo -y /dev/null -an before:170fps after :294fps Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bumpAnton Khirnov2021-01-01
| | | | They are not properly namespaced and not intended for public use.
* vp9: re-split the decoder/format/dsp interface header files.Ronald S. Bultje2017-03-28
| | | | | The advantage here is that the internal software decoder interface is not exposed to the DSP functions or the hardware accelerations.
* lavc/vp9: split into vp9{block,data,mvs}Clément Bœsch2017-03-27
| | | | This is following Libav layout to ease merges.
* aarch64: vp9: Add NEON optimizations of VP9 MC functionsMartin Storsjö2016-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This work is sponsored by, and copyright, Google. These are ported from the ARM version; it is essentially a 1:1 port with no extra added features, but with some hand tuning (especially for the plain copy/avg functions). The ARM version isn't very register starved to begin with, so there's not much to be gained from having more spare registers here - we only avoid having to clobber callee-saved registers. Examples of runtimes vs the 32 bit version, on a Cortex A53: ARM AArch64 vp9_avg4_neon: 27.2 23.7 vp9_avg8_neon: 56.5 54.7 vp9_avg16_neon: 169.9 167.4 vp9_avg32_neon: 585.8 585.2 vp9_avg64_neon: 2460.3 2294.7 vp9_avg_8tap_smooth_4h_neon: 132.7 125.2 vp9_avg_8tap_smooth_4hv_neon: 478.8 442.0 vp9_avg_8tap_smooth_4v_neon: 126.0 93.7 vp9_avg_8tap_smooth_8h_neon: 241.7 234.2 vp9_avg_8tap_smooth_8hv_neon: 690.9 646.5 vp9_avg_8tap_smooth_8v_neon: 245.0 205.5 vp9_avg_8tap_smooth_64h_neon: 11273.2 11280.1 vp9_avg_8tap_smooth_64hv_neon: 22980.6 22184.1 vp9_avg_8tap_smooth_64v_neon: 11549.7 10781.1 vp9_put4_neon: 18.0 17.2 vp9_put8_neon: 40.2 37.7 vp9_put16_neon: 97.4 99.5 vp9_put32_neon/armv8: 346.0 307.4 vp9_put64_neon/armv8: 1319.0 1107.5 vp9_put_8tap_smooth_4h_neon: 126.7 118.2 vp9_put_8tap_smooth_4hv_neon: 465.7 434.0 vp9_put_8tap_smooth_4v_neon: 113.0 86.5 vp9_put_8tap_smooth_8h_neon: 229.7 221.6 vp9_put_8tap_smooth_8hv_neon: 658.9 621.3 vp9_put_8tap_smooth_8v_neon: 215.0 187.5 vp9_put_8tap_smooth_64h_neon: 10636.7 10627.8 vp9_put_8tap_smooth_64hv_neon: 21076.8 21026.9 vp9_put_8tap_smooth_64v_neon: 9635.0 9632.4 These are generally about as fast as the corresponding ARM routines on the same CPU (at least on the A53), in most cases marginally faster. The speedup vs C code is pretty much the same as for the 32 bit case; on the A53 it's around 6-13x for ther larger 8tap filters. The exact speedup varies a little, since the C versions generally don't end up exactly as slow/fast as on 32 bit. This is an adapted cherry-pick from libav commit 383d96aa2229f644d9bd77b821ed3a309da5e9fc. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* arm: vp9: Add NEON optimizations of VP9 MC functionsMartin Storsjö2016-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This work is sponsored by, and copyright, Google. The filter coefficients are signed values, where the product of the multiplication with one individual filter coefficient doesn't overflow a 16 bit signed value (the largest filter coefficient is 127). But when the products are accumulated, the resulting sum can overflow the 16 bit signed range. Instead of accumulating in 32 bit, we accumulate the largest product (either index 3 or 4) last with a saturated addition. (The VP8 MC asm does something similar, but slightly simpler, by accumulating each half of the filter separately. In the VP9 MC filters, each half of the filter can also overflow though, so the largest component has to be handled individually.) Examples of relative speedup compared to the C version, from checkasm: Cortex A7 A8 A9 A53 vp9_avg4_neon: 1.71 1.15 1.42 1.49 vp9_avg8_neon: 2.51 3.63 3.14 2.58 vp9_avg16_neon: 2.95 6.76 3.01 2.84 vp9_avg32_neon: 3.29 6.64 2.85 3.00 vp9_avg64_neon: 3.47 6.67 3.14 2.80 vp9_avg_8tap_smooth_4h_neon: 3.22 4.73 2.76 4.67 vp9_avg_8tap_smooth_4hv_neon: 3.67 4.76 3.28 4.71 vp9_avg_8tap_smooth_4v_neon: 5.52 7.60 4.60 6.31 vp9_avg_8tap_smooth_8h_neon: 6.22 9.04 5.12 9.32 vp9_avg_8tap_smooth_8hv_neon: 6.38 8.21 5.72 8.17 vp9_avg_8tap_smooth_8v_neon: 9.22 12.66 8.15 11.10 vp9_avg_8tap_smooth_64h_neon: 7.02 10.23 5.54 11.58 vp9_avg_8tap_smooth_64hv_neon: 6.76 9.46 5.93 9.40 vp9_avg_8tap_smooth_64v_neon: 10.76 14.13 9.46 13.37 vp9_put4_neon: 1.11 1.47 1.00 1.21 vp9_put8_neon: 1.23 2.17 1.94 1.48 vp9_put16_neon: 1.63 4.02 1.73 1.97 vp9_put32_neon: 1.56 4.92 2.00 1.96 vp9_put64_neon: 2.10 5.28 2.03 2.35 vp9_put_8tap_smooth_4h_neon: 3.11 4.35 2.63 4.35 vp9_put_8tap_smooth_4hv_neon: 3.67 4.69 3.25 4.71 vp9_put_8tap_smooth_4v_neon: 5.45 7.27 4.49 6.52 vp9_put_8tap_smooth_8h_neon: 5.97 8.18 4.81 8.56 vp9_put_8tap_smooth_8hv_neon: 6.39 7.90 5.64 8.15 vp9_put_8tap_smooth_8v_neon: 9.03 11.84 8.07 11.51 vp9_put_8tap_smooth_64h_neon: 6.78 9.48 4.88 10.89 vp9_put_8tap_smooth_64hv_neon: 6.99 8.87 5.94 9.56 vp9_put_8tap_smooth_64v_neon: 10.69 13.30 9.43 14.34 For the larger 8tap filters, the speedup vs C code is around 5-14x. This is significantly faster than libvpx's implementation of the same functions, at least when comparing the put_8tap_smooth_64 functions (compared to vpx_convolve8_horiz_neon and vpx_convolve8_vert_neon from libvpx). Absolute runtimes from checkasm: Cortex A7 A8 A9 A53 vp9_put_8tap_smooth_64h_neon: 20150.3 14489.4 19733.6 10863.7 libvpx vpx_convolve8_horiz_neon: 52623.3 19736.4 21907.7 25027.7 vp9_put_8tap_smooth_64v_neon: 14455.0 12303.9 13746.4 9628.9 libvpx vpx_convolve8_vert_neon: 42090.0 17706.2 17659.9 16941.2 Thus, on the A9, the horizontal filter is only marginally faster than libvpx, while our version is significantly faster on the other cores, and the vertical filter is significantly faster on all cores. The difference is especially large on the A7. The libvpx implementation does the accumulation in 32 bit, which probably explains most of the differences. This is an adapted cherry-pick from libav commits ffbd1d2b0002576ef0d976a41ff959c635373fdc, 392caa65df3efa8b2d48a80f08a6af4892c61c08, 557c1675cf0e803b2fee43b4c8b58433842c84d0 and 11623217e3c9b859daee544e31acdd0821b61039. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* vp9dsp: Deduplicate the subpel filtersMartin Storsjö2016-11-15
| | | | | | | | | Make them aligned, to allow efficient access to them from simd. This is an adapted cherry-pick from libav commit a4cfcddcb0f76e837d5abc06840c2b26c0e8aefc. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* vp9: fix overflow in 8x8 topleft 32x32 idct ssse3 version.Ronald S. Bultje2015-09-10
| | | | | | | | | Also disable the mmx/iwht optimization when the bitexact flag is set. With synthetically coded coefficients (i.e. these that lead to a residual well outside the [-255,255] range), our optimizations will overflow. It doesn't make sense to fix the overflows, since they can only occur on synthetic input, not on real fwht-generated input. Thus, add a bitexact flag that disables this optimization.
* avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for VP9 MC functionsShivraj Patil2015-07-16
| | | | | | | | This patch adds MSA (MIPS-SIMD-Arch) optimizations for VP9 MC functions in new file vp9_mc_msa.c Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com> Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp9dsp: Replace assert by av_assert0()Michael Niedermayer2015-05-07
| | | | | Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* vp9: add keyframe profile 2/3 support.Ronald S. Bultje2015-05-06
|
* vp9: add support for resolution changes in inter frames.Ronald S. Bultje2015-04-23
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* vp9/x86: invert hu_ipred left array ordering.Ronald S. Bultje2014-12-19
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/vp9: fix () in macrosMichael Niedermayer2014-06-18
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* vp9: invert order in l[] intra prediction array.Ronald S. Bultje2014-02-09
| | | | | | The directional intra predictors either don't care about order (dc, h, dc_left, tm), or they prefer inverted order (vr, dr, hd). This allows more efficient SIMD implementations.
* avcodec/vp9dsp: remove unused stride parameter in loop_filter().Clément Bœsch2013-11-23
| | | | The stride argument is passed either as stridea or strideb.
* avcodec/vp9dsp: pass dconly bit as macro argument.Clément Bœsch2013-11-22
|
* avcodec/vp9dsp: add DC only versions for idct/idct.Clément Bœsch2013-11-22
| | | | | | | | | | | | before: ./ffmpeg -v 0 -nostats -i ~/samples/vp9/etv.webm -f null - 16.29s user 0.02s system 99% cpu 16.323 total ./ffmpeg -v 0 -nostats -i ~/samples/vp9/etv.webm -f null - 16.32s user 0.01s system 99% cpu 16.351 total ./ffmpeg -v 0 -nostats -i ~/samples/vp9/etv.webm -f null - 16.27s user 0.05s system 99% cpu 16.335 total after: ./ffmpeg -v 0 -nostats -i ~/samples/vp9/etv.webm -f null - 15.22s user 0.03s system 99% cpu 15.257 total ./ffmpeg -v 0 -nostats -i ~/samples/vp9/etv.webm -f null - 15.20s user 0.02s system 99% cpu 15.237 total ./ffmpeg -v 0 -nostats -i ~/samples/vp9/etv.webm -f null - 15.19s user 0.02s system 99% cpu 15.227 total
* avcodec/vp9dsp: fix overwrite by 1 in vert_left pred.Ronald S. Bultje2013-10-20
| | | | | | | | | | | The memset following the memcpy was silencing the problem since re-writing that same byte. Fixes CID1108597, CID1108598, (16x16) CID1108599, CID1108600, (8x8) CID1108601, CID1108602 (32x32) Signed-off-by: Clément Bœsch <u@pkh.me>
* VP9 MC (ssse3) optimizations.Ronald S. Bultje2013-10-02
| | | | Decoding time of ped1080p.webm goes from 20.7sec to 11.3sec.
* Native VP9 decoder.Ronald S. Bultje2013-10-02
Authors: Ronald S. Bultje <rsbultje gmail com>, Clement Boesch <u pkh me>