[FFmpeg-cvslog] cook: simplify decouple_info()

Justin Ruggles git at videolan.org
Sun Oct 30 02:04:12 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Oct 26 20:59:14 2011 -0400| [c9c841e2314ab9812f4956441e91f90193fcac5e] | committer: Justin Ruggles

cook: simplify decouple_info()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9c841e2314ab9812f4956441e91f90193fcac5e
---

 libavcodec/cook.c |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 9577757..7157a8c 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -740,27 +740,24 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
  * @param decouple_tab      decoupling array
  *
  */
+static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)
+{
+    int i;
+    int vlc    = get_bits1(&q->gb);
+    int start  = cplband[p->js_subband_start];
+    int end    = cplband[p->subbands-1];
+    int length = end - start + 1;
 
-static void decouple_info(COOKContext *q, COOKSubpacket *p, int* decouple_tab){
-    int length, i;
-
-    if(get_bits1(&q->gb)) {
-        if(cplband[p->js_subband_start] > cplband[p->subbands-1]) return;
-
-        length = cplband[p->subbands-1] - cplband[p->js_subband_start] + 1;
-        for (i=0 ; i<length ; i++) {
-            decouple_tab[cplband[p->js_subband_start] + i] = get_vlc2(&q->gb, p->ccpl.table, p->ccpl.bits, 2);
-        }
+    if (start > end)
         return;
-    }
 
-    if(cplband[p->js_subband_start] > cplband[p->subbands-1]) return;
-
-    length = cplband[p->subbands-1] - cplband[p->js_subband_start] + 1;
-    for (i=0 ; i<length ; i++) {
-       decouple_tab[cplband[p->js_subband_start] + i] = get_bits(&q->gb, p->js_vlc_bits);
+    if (vlc) {
+        for (i = 0; i < length; i++)
+            decouple_tab[start + i] = get_vlc2(&q->gb, p->ccpl.table, p->ccpl.bits, 2);
+    } else {
+        for (i = 0; i < length; i++)
+            decouple_tab[start + i] = get_bits(&q->gb, p->js_vlc_bits);
     }
-    return;
 }
 
 /*



More information about the ffmpeg-cvslog mailing list