Browse Source

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>
Andreas Rheinhardt 8 months ago
parent
commit
e99faf28d5
1 changed files with 7 additions and 2 deletions
  1. 7 2
      libavcodec/vc2enc.c

+ 7 - 2
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);
         }