changeset 1253:5642ebadf1b5 libavcodec

small optimize mpeg12.c/get_qscale patch by (BERO <bero at geocities dot co dot jp>) and the return idea by arpi
author michaelni
date Tue, 13 May 2003 23:38:51 +0000
parents 67ee8bab0f28
children 604661d34c68
files mpeg12.c
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg12.c	Tue May 13 13:38:09 2003 +0000
+++ b/mpeg12.c	Tue May 13 23:38:51 2003 +0000
@@ -852,16 +852,13 @@
 
 static inline int get_qscale(MpegEncContext *s)
 {
-    int qscale;
+    int qscale = get_bits(&s->gb, 5);
     if (s->mpeg2) {
         if (s->q_scale_type) {
-            qscale = non_linear_qscale[get_bits(&s->gb, 5)];
+            return non_linear_qscale[qscale];
         } else {
-            qscale = get_bits(&s->gb, 5) << 1;
+            return qscale << 1;
         }
-    } else {
-        /* for mpeg1, we use the generic unquant code */
-        qscale = get_bits(&s->gb, 5);
     }
     return qscale;
 }