1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

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@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-12 03:56:03 +01:00
parent fcd5df5904
commit e99faf28d5

View File

@@ -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);
}