[FFmpeg-cvslog] avcodec/vc2enc: Avoid excessive inlining
Andreas Rheinhardt
git at videolan.org
Wed Mar 12 18:07:09 EET 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Mar 12 03:56:03 2025 +0100| [e99faf28d586209256d00618a6049f04b4dd3d74] | committer: Andreas Rheinhardt
avcodec/vc2enc: Avoid excessive inlining
There is no reason to inline put_vc2_ue_uint() everywhere;
only one call site is actually hot: The one in encode_subband()
(which accounts for 35735040 of 35739495 calls to said function
in a FATE run). Uninline all the others.
Reviewed-by: Lynne <dev at lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e99faf28d586209256d00618a6049f04b4dd3d74
---
libavcodec/vc2enc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index 1fe973f4cd..d05df64911 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -204,7 +204,7 @@ static av_cold void vc2_init_static_data(void)
}
}
-static av_always_inline void put_vc2_ue_uint(PutBitContext *pb, uint32_t val)
+static av_always_inline void put_vc2_ue_uint_inline(PutBitContext *pb, uint32_t val)
{
uint64_t pbits = 1;
int bits = 1;
@@ -222,6 +222,11 @@ static av_always_inline void put_vc2_ue_uint(PutBitContext *pb, uint32_t val)
put_bits63(pb, bits, pbits);
}
+static av_noinline void put_vc2_ue_uint(PutBitContext *pb, uint32_t val)
+{
+ put_vc2_ue_uint_inline(pb, val);
+}
+
static av_always_inline int count_vc2_ue_uint(uint32_t val)
{
return 2 * av_log2(val + 1) + 1;
@@ -545,7 +550,7 @@ static void encode_subband(const VC2EncContext *s, PutBitContext *pb,
for (y = top; y < bottom; y++) {
for (x = left; x < right; x++) {
uint32_t c_abs = QUANT(FFABS(coeff[x]), q_m, q_a, q_s);
- put_vc2_ue_uint(pb, c_abs);
+ put_vc2_ue_uint_inline(pb, c_abs);
if (c_abs)
put_bits(pb, 1, coeff[x] < 0);
}
More information about the ffmpeg-cvslog
mailing list