---
I did a simple performance test for this, as suggested on IRC and got

WITHOUT
real    2m57.078s
user    4m16.308s
sys 0m31.410s

WITH
real    2m56.643s
user    4m16.052s
sys 0m31.714s

Plus I think code is more readable. I think there might be quite a few places 
that could receive the same treatment.

Cheers,
    Vittorio

 libavcodec/mpeg12enc.c |   14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 0ede7c4..a69d9b6 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -439,15 +439,13 @@ static inline void put_mb_modes(MpegEncContext *s, int n, 
int bits, int has_mv,
     }
 }
 
-static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
-                                                      int16_t block[6][64],
-                                                      int motion_x, int 
motion_y,
-                                                      int mb_block_count)
+void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[6][64], int motion_x, 
int motion_y)
 {
     int i, cbp;
     const int mb_x = s->mb_x;
     const int mb_y = s->mb_y;
     const int first_mb = mb_x == s->resync_mb_x && mb_y == s->resync_mb_y;
+    const int mb_block_count = s->chroma_format == CHROMA_420 ? 6 : 8;
 
     /* compute cbp */
     cbp = 0;
@@ -671,14 +669,6 @@ static av_always_inline void 
mpeg1_encode_mb_internal(MpegEncContext *s,
     }
 }
 
-void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[6][64], int motion_x, 
int motion_y)
-{
-    if (s->chroma_format == CHROMA_420)
-        mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 6);
-    else
-        mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 8);
-}
-
 // RAL: Parameter added: f_or_b_code
 static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code)
 {
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to