1
0
Fork 0
Commit Graph

7 Commits

Author SHA1 Message Date
Rémi Denis-Courmont 910d281b21 lavc/h263dsp: R-V V {h,v}_loop_filter
Since the horizontal and vertical filters are identical except for a
transposition, this uses a common subprocedure with an ad-hoc ABI.
To preserve return-address stack prediction, a link register has to be
used (c.f. the "Control Transfer Instructions" from the
RISC-V ISA Manual). The alternate/temporary link register T0 is used
here, so that the normal RA is preserved (something Arm cannot do!).

To load the strength value based on `qscale`, the shortest possible
and PIC-compatible sequence is used: AUIPC; ADD; LBU. The classic
LLA; ADD; LBU sequence would add one more instruction since LLA is a
convenience alias for AUIPC; ADDI. To ensure that this trick works,
relocation relaxation is disabled.

To implement the two signed divisions by a power of two toward zero:
 (x / (1 << SHIFT))
the code relies on the small range of integers involved, computing:
 (x + (x >> (16 - SHIFT))) >> SHIFT
rather than the more general:
 (x + ((x >> (16 - 1)) & ((1 << SHIFT) - 1))) >> SHIFT
Thus one ANDI instruction is avoided.

T-Head C908:
h263dsp.h_loop_filter_c:       228.2
h263dsp.h_loop_filter_rvv_i32: 144.0
h263dsp.v_loop_filter_c:       242.7
h263dsp.v_loop_filter_rvv_i32: 114.0
(C is probably worse in real use due to less predictible branches.)
2024-05-22 19:15:39 +03:00
Andreas Rheinhardt 40e6575aa3 all: Replace if (ARCH_FOO) checks by #if ARCH_FOO
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>
2022-06-15 04:56:37 +02:00
Shivraj Patil 63eaf529bc avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for H263 lpf functions
This patch adds MSA (MIPS-SIMD-Arch) optimizations for H263 lpf functions in new file h263dsp_msa.c

Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 13:50:14 +02:00
Michael Niedermayer e93523a06f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h263dsp: K&R formatting cosmetics

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-08 18:02:50 +01:00
Michael Niedermayer a30f7918b5 Merge commit '0338c396987c82b41d322630ea9712fe5f9561d6'
* commit '0338c396987c82b41d322630ea9712fe5f9561d6':
  dsputil: Split off H.263 bits into their own H263DSPContext

Conflicts:
	configure
	libavcodec/mpegvideo.h
	libavcodec/mpegvideo_enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-08 17:42:56 +01:00
Diego Biurrun cb56c3961b h263dsp: K&R formatting cosmetics
Also remove array element numbering comments.
2013-11-08 12:41:24 +01:00
Diego Biurrun 0338c39698 dsputil: Split off H.263 bits into their own H263DSPContext 2013-11-08 12:40:47 +01:00