Browse code

brace placement and linebreak cosmetics

Originally committed as revision 20070 to svn://svn.ffmpeg.org/ffmpeg/trunk

Diego Biurrun authored on 2009/09/29 06:13:47
Showing 5 changed files
... ...
@@ -32,7 +32,9 @@
32 32
 
33 33
 /* Helper functions */
34 34
 
35
-unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) {   // x^(1/n)
35
+// x^(1/n)
36
+unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n)
37
+{
36 38
     unsigned int ret=0, i, j;
37 39
 
38 40
     do {
... ...
@@ -48,7 +50,8 @@ unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) {   // x^(1/n)
48 48
 // the two bits[p] > 32 checks should be redundant, all calling code should
49 49
 // already ensure that, but since it allows overwriting the stack it seems
50 50
 // reasonable to check redundantly.
51
-int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num) {
51
+int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num)
52
+{
52 53
     uint_fast32_t exit_at_level[33]={404,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
53 54
         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
54 55
 
... ...
@@ -67,16 +70,14 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num) {
67 67
 
68 68
     codes[p]=0;
69 69
     if (bits[p] > 32) return 1;
70
-    for(i=0;i<bits[p];++i) {
70
+    for(i=0;i<bits[p];++i)
71 71
         exit_at_level[i+1]=1<<i;
72
-    }
73 72
 
74 73
 #ifdef V_DEBUG
75 74
     av_log(NULL, AV_LOG_INFO, " %d. of %d code len %d code %d - ", p, num, bits[p], codes[p]);
76 75
     init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]);
77
-    for(i=0;i<bits[p];++i) {
76
+    for(i=0;i<bits[p];++i)
78 77
         av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0");
79
-    }
80 78
     av_log(NULL, AV_LOG_INFO, "\n");
81 79
 #endif
82 80
 
... ...
@@ -86,24 +87,21 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num) {
86 86
         if (bits[p] > 32) return 1;
87 87
         if (bits[p]==0) continue;
88 88
         // find corresponding exit(node which the tree can grow further from)
89
-        for(i=bits[p];i>0;--i) {
89
+        for(i=bits[p];i>0;--i)
90 90
             if (exit_at_level[i]) break;
91
-        }
92 91
         if (!i) return 1; // overspecified tree
93 92
         code=exit_at_level[i];
94 93
         exit_at_level[i]=0;
95 94
         // construct code (append 0s to end) and introduce new exits
96
-        for(j=i+1;j<=bits[p];++j) {
95
+        for(j=i+1;j<=bits[p];++j)
97 96
             exit_at_level[j]=code+(1<<(j-1));
98
-        }
99 97
         codes[p]=code;
100 98
 
101 99
 #ifdef V_DEBUG
102 100
         av_log(NULL, AV_LOG_INFO, " %d. code len %d code %d - ", p, bits[p], codes[p]);
103 101
         init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]);
104
-        for(i=0;i<bits[p];++i) {
102
+        for(i=0;i<bits[p];++i)
105 103
             av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0");
106
-        }
107 104
         av_log(NULL, AV_LOG_INFO, "\n");
108 105
 #endif
109 106
 
... ...
@@ -116,7 +114,8 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num) {
116 116
     return 0;
117 117
 }
118 118
 
119
-void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values) {
119
+void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values)
120
+{
120 121
     int i;
121 122
     list[0].sort = 0;
122 123
     list[1].sort = 1;
... ...
@@ -146,7 +145,10 @@ void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values) {
146 146
     }
147 147
 }
148 148
 
149
-static inline void render_line_unrolled(intptr_t x, intptr_t y, int x1, intptr_t sy, int ady, int adx, float * buf) {
149
+static inline void render_line_unrolled(intptr_t x, intptr_t y, int x1,
150
+                                        intptr_t sy, int ady, int adx,
151
+                                        float * buf)
152
+{
150 153
     int err = -adx;
151 154
     x -= x1-1;
152 155
     buf += x1-1;
... ...
@@ -166,7 +168,8 @@ static inline void render_line_unrolled(intptr_t x, intptr_t y, int x1, intptr_t
166 166
     }
167 167
 }
168 168
 
169
-static void render_line(int x0, int y0, int x1, int y1, float * buf) {
169
+static void render_line(int x0, int y0, int x1, int y1, float * buf)
170
+{
170 171
     int dy = y1 - y0;
171 172
     int adx = x1 - x0;
172 173
     int ady = FFABS(dy);
... ...
@@ -192,7 +195,10 @@ static void render_line(int x0, int y0, int x1, int y1, float * buf) {
192 192
     }
193 193
 }
194 194
 
195
-void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values, uint_fast16_t * y_list, int * flag, int multiplier, float * out, int samples) {
195
+void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
196
+                                  uint_fast16_t * y_list, int * flag,
197
+                                  int multiplier, float * out, int samples)
198
+{
196 199
     int lx, ly, i;
197 200
     lx = 0;
198 201
     ly = y_list[0] * multiplier;
... ...
@@ -36,7 +36,9 @@ typedef struct {
36 36
 void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values);
37 37
 unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
38 38
 int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num);
39
-void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values, uint_fast16_t * y_list, int * flag, int multiplier, float * out, int samples);
39
+void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
40
+                                  uint_fast16_t * y_list, int * flag,
41
+                                  int multiplier, float * out, int samples);
40 42
 
41 43
 #define ilog(i) av_log2(2*(i))
42 44
 
... ...
@@ -2152,5 +2152,8 @@ const float ff_vorbis_floor1_inverse_db_table[256]={
2152 2152
   0.82788260F, 0.88168307F, 0.9389798F, 1.F,
2153 2153
 };
2154 2154
 
2155
-const float * const ff_vorbis_vwin[8] = { vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 };
2155
+const float * const ff_vorbis_vwin[8] = {
2156
+      vwin64,  vwin128,  vwin256,  vwin512,
2157
+    vwin1024, vwin2048, vwin4096, vwin8192
2158
+};
2156 2159
 
... ...
@@ -65,10 +65,8 @@ uint_fast8_t (* vorbis_floor_decode_func)
65 65
 typedef struct {
66 66
     uint_fast8_t floor_type;
67 67
     vorbis_floor_decode_func decode;
68
-    union vorbis_floor_u
69
-    {
70
-        struct vorbis_floor0_s
71
-        {
68
+    union vorbis_floor_u {
69
+        struct vorbis_floor0_s {
72 70
             uint_fast8_t order;
73 71
             uint_fast16_t rate;
74 72
             uint_fast16_t bark_map_size;
... ...
@@ -80,8 +78,7 @@ typedef struct {
80 80
             uint_fast8_t * book_list;
81 81
             float * lsp;
82 82
         } t0;
83
-        struct vorbis_floor1_s
84
-        {
83
+        struct vorbis_floor1_s {
85 84
             uint_fast8_t partitions;
86 85
             uint_fast8_t maximum_class;
87 86
             uint_fast8_t partition_class[32];
... ...
@@ -163,17 +160,20 @@ typedef struct vorbis_context_s {
163 163
 #define BARK(x) \
164 164
     (13.1f*atan(0.00074f*(x))+2.24f*atan(1.85e-8f*(x)*(x))+1e-4f*(x))
165 165
 
166
-static float vorbisfloat2float(uint_fast32_t val) {
166
+static float vorbisfloat2float(uint_fast32_t val)
167
+{
167 168
     double mant=val&0x1fffff;
168 169
     long exp=(val&0x7fe00000L)>>21;
169
-    if (val&0x80000000) mant=-mant;
170
+    if (val&0x80000000)
171
+        mant=-mant;
170 172
     return ldexp(mant, exp - 20 - 768);
171 173
 }
172 174
 
173 175
 
174 176
 // Free all allocated memory -----------------------------------------
175 177
 
176
-static void vorbis_free(vorbis_context *vc) {
178
+static void vorbis_free(vorbis_context *vc)
179
+{
177 180
     int_fast16_t i;
178 181
 
179 182
     av_freep(&vc->channel_residues);
... ...
@@ -198,8 +198,7 @@ static void vorbis_free(vorbis_context *vc) {
198 198
             av_free(vc->floors[i].data.t0.map[1]);
199 199
             av_free(vc->floors[i].data.t0.book_list);
200 200
             av_free(vc->floors[i].data.t0.lsp);
201
-        }
202
-        else {
201
+        } else {
203 202
             av_free(vc->floors[i].data.t1.list);
204 203
         }
205 204
     }
... ...
@@ -217,7 +216,8 @@ static void vorbis_free(vorbis_context *vc) {
217 217
 
218 218
 // Process codebooks part
219 219
 
220
-static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
220
+static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
221
+{
221 222
     uint_fast16_t cb;
222 223
     uint8_t *tmp_vlc_bits;
223 224
     uint32_t *tmp_vlc_codes;
... ...
@@ -275,16 +275,15 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
275 275
                     if (flag) {
276 276
                         tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
277 277
                         ++used_entries;
278
-                    }
279
-                    else tmp_vlc_bits[ce]=0;
278
+                    } else
279
+                        tmp_vlc_bits[ce]=0;
280 280
                 }
281 281
             } else {
282 282
                 AV_DEBUG(" not sparse \n");
283 283
 
284 284
                 used_entries=entries;
285
-                for(ce=0;ce<entries;++ce) {
285
+                for(ce=0;ce<entries;++ce)
286 286
                     tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
287
-                }
288 287
             }
289 288
         } else {
290 289
             uint_fast16_t current_entry=0;
... ...
@@ -302,9 +301,9 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
302 302
 
303 303
                 AV_DEBUG(" number: %d \n", number);
304 304
 
305
-                for(i=current_entry;i<number+current_entry;++i) {
306
-                    if (i<used_entries) tmp_vlc_bits[i]=current_length;
307
-                }
305
+                for(i=current_entry;i<number+current_entry;++i)
306
+                    if (i<used_entries)
307
+                        tmp_vlc_bits[i]=current_length;
308 308
 
309 309
                 current_entry+=number;
310 310
             }
... ...
@@ -356,18 +355,16 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
356 356
                     for(k=0;k<dim;++k) {
357 357
                         uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values;
358 358
                         codebook_setup->codevectors[j*dim+k]=codebook_multiplicands[multiplicand_offset]*codebook_delta_value+codebook_minimum_value+last;
359
-                        if (codebook_sequence_p) {
359
+                        if (codebook_sequence_p)
360 360
                             last=codebook_setup->codevectors[j*dim+k];
361
-                        }
362 361
                         lookup_offset/=codebook_lookup_values;
363 362
                     }
364 363
                     tmp_vlc_bits[j]=tmp_vlc_bits[i];
365 364
 
366 365
 #ifdef V_DEBUG
367 366
                     av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %d, vector: ", j);
368
-                    for(k=0;k<dim;++k) {
367
+                    for(k=0;k<dim;++k)
369 368
                         av_log(vc->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j*dim+k]);
370
-                    }
371 369
                     av_log(vc->avccontext, AV_LOG_INFO, "\n");
372 370
 #endif
373 371
 
... ...
@@ -379,8 +376,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
379 379
                 goto error;
380 380
             }
381 381
             entries=used_entries;
382
-        }
383
-        else if (codebook_setup->lookup_type>=2) {
382
+        } else if (codebook_setup->lookup_type>=2) {
384 383
             av_log(vc->avccontext, AV_LOG_ERROR, "Codebook lookup type not supported. \n");
385 384
             goto error;
386 385
         }
... ...
@@ -392,10 +388,13 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
392 392
         }
393 393
         codebook_setup->maxdepth=0;
394 394
         for(t=0;t<entries;++t)
395
-            if (tmp_vlc_bits[t]>=codebook_setup->maxdepth) codebook_setup->maxdepth=tmp_vlc_bits[t];
395
+            if (tmp_vlc_bits[t]>=codebook_setup->maxdepth)
396
+                codebook_setup->maxdepth=tmp_vlc_bits[t];
396 397
 
397
-        if(codebook_setup->maxdepth > 3*V_NB_BITS) codebook_setup->nb_bits=V_NB_BITS2;
398
-        else                                       codebook_setup->nb_bits=V_NB_BITS;
398
+        if(codebook_setup->maxdepth > 3*V_NB_BITS)
399
+            codebook_setup->nb_bits=V_NB_BITS2;
400
+        else
401
+            codebook_setup->nb_bits=V_NB_BITS;
399 402
 
400 403
         codebook_setup->maxdepth=(codebook_setup->maxdepth+codebook_setup->nb_bits-1)/codebook_setup->nb_bits;
401 404
 
... ...
@@ -418,7 +417,8 @@ error:
418 418
 
419 419
 // Process time domain transforms part (unused in Vorbis I)
420 420
 
421
-static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc) {
421
+static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc)
422
+{
422 423
     GetBitContext *gb=&vc->gb;
423 424
     uint_fast8_t i;
424 425
     uint_fast8_t vorbis_time_count=get_bits(gb, 6)+1;
... ...
@@ -443,7 +443,8 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc,
443 443
 static void create_map( vorbis_context * vc, uint_fast8_t floor_number );
444 444
 static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc,
445 445
                                          vorbis_floor_data *vfu, float *vec);
446
-static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
446
+static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
447
+{
447 448
     GetBitContext *gb=&vc->gb;
448 449
     uint_fast16_t i,j,k;
449 450
 
... ...
@@ -471,7 +472,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
471 471
 
472 472
             for(j=0;j<floor_setup->data.t1.partitions;++j) {
473 473
                 floor_setup->data.t1.partition_class[j]=get_bits(gb, 4);
474
-                if (floor_setup->data.t1.partition_class[j]>maximum_class) maximum_class=floor_setup->data.t1.partition_class[j];
474
+                if (floor_setup->data.t1.partition_class[j]>maximum_class)
475
+                    maximum_class=floor_setup->data.t1.partition_class[j];
475 476
 
476 477
                 AV_DEBUG(" %d. floor %d partition class %d \n", i, j, floor_setup->data.t1.partition_class[j]);
477 478
 
... ...
@@ -513,9 +515,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
513 513
             floor_setup->data.t1.multiplier=get_bits(gb, 2)+1;
514 514
             floor_setup->data.t1.x_list_dim=2;
515 515
 
516
-            for(j=0;j<floor_setup->data.t1.partitions;++j) {
516
+            for(j=0;j<floor_setup->data.t1.partitions;++j)
517 517
                 floor_setup->data.t1.x_list_dim+=floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]];
518
-            }
519 518
 
520 519
             floor_setup->data.t1.list=av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(vorbis_floor1_entry));
521 520
 
... ...
@@ -534,8 +535,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
534 534
 
535 535
 // Precalculate order of x coordinates - needed for decode
536 536
             ff_vorbis_ready_floor1_list(floor_setup->data.t1.list, floor_setup->data.t1.x_list_dim);
537
-        }
538
-        else if(floor_setup->floor_type==0) {
537
+        } else if(floor_setup->floor_type==0) {
539 538
             uint_fast8_t max_codebook_dim=0;
540 539
 
541 540
             floor_setup->decode=vorbis_floor0_decode;
... ...
@@ -557,7 +557,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
557 557
             /* allocate mem for booklist */
558 558
             floor_setup->data.t0.book_list=
559 559
                 av_malloc(floor_setup->data.t0.num_books);
560
-            if(!floor_setup->data.t0.book_list) { return -1; }
560
+            if(!floor_setup->data.t0.book_list)
561
+                return -1;
561 562
             /* read book indexes */
562 563
             {
563 564
                 int idx;
... ...
@@ -581,7 +582,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
581 581
                 floor_setup->data.t0.lsp=
582 582
                     av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim)
583 583
                               * sizeof(float));
584
-                if(!floor_setup->data.t0.lsp) { return -1; }
584
+                if(!floor_setup->data.t0.lsp)
585
+                    return -1;
585 586
             }
586 587
 
587 588
 #ifdef V_DEBUG /* debug output parsed headers */
... ...
@@ -606,8 +608,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
606 606
               }
607 607
             }
608 608
 #endif
609
-        }
610
-        else {
609
+        } else {
611 610
             av_log(vc->avccontext, AV_LOG_ERROR, "Invalid floor type!\n");
612 611
             return -1;
613 612
         }
... ...
@@ -617,7 +618,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
617 617
 
618 618
 // Process residues part
619 619
 
620
-static int vorbis_parse_setup_hdr_residues(vorbis_context *vc){
620
+static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
621
+{
621 622
     GetBitContext *gb=&vc->gb;
622 623
     uint_fast8_t i, j, k;
623 624
 
... ...
@@ -660,9 +662,8 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc){
660 660
         for(j=0;j<res_setup->classifications;++j) {
661 661
             high_bits=0;
662 662
             low_bits=get_bits(gb, 3);
663
-            if (get_bits1(gb)) {
663
+            if (get_bits1(gb))
664 664
                 high_bits=get_bits(gb, 5);
665
-            }
666 665
             cascade[j]=(high_bits<<3)+low_bits;
667 666
 
668 667
             AV_DEBUG("     %d class casscade depth: %d \n", j, ilog(cascade[j]));
... ...
@@ -681,9 +682,8 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc){
681 681
 
682 682
                     AV_DEBUG("     %d class casscade depth %d book: %d \n", j, k, res_setup->books[j][k]);
683 683
 
684
-                    if (k>res_setup->maxpass) {
684
+                    if (k>res_setup->maxpass)
685 685
                         res_setup->maxpass=k;
686
-                    }
687 686
                 } else {
688 687
                     res_setup->books[j][k]=-1;
689 688
                 }
... ...
@@ -695,7 +695,8 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc){
695 695
 
696 696
 // Process mappings part
697 697
 
698
-static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) {
698
+static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
699
+{
699 700
     GetBitContext *gb=&vc->gb;
700 701
     uint_fast8_t i, j;
701 702
 
... ...
@@ -784,8 +785,7 @@ static void create_map( vorbis_context * vc, uint_fast8_t floor_number )
784 784
     int_fast32_t * map;
785 785
     int_fast32_t n; //TODO: could theoretically be smaller?
786 786
 
787
-    for (blockflag=0;blockflag<2;++blockflag)
788
-    {
787
+    for (blockflag=0;blockflag<2;++blockflag) {
789 788
     n=vc->blocksize[blockflag]/2;
790 789
     floors[floor_number].data.t0.map[blockflag]=
791 790
         av_malloc((n+1) * sizeof(int_fast32_t)); // n+sentinel
... ...
@@ -797,9 +797,8 @@ static void create_map( vorbis_context * vc, uint_fast8_t floor_number )
797 797
         map[idx]=floor( BARK((vf->rate*idx)/(2.0f*n)) *
798 798
                               ((vf->bark_map_size)/
799 799
                                BARK(vf->rate/2.0f )) );
800
-        if (vf->bark_map_size-1 < map[idx]) {
800
+        if (vf->bark_map_size-1 < map[idx])
801 801
             map[idx]=vf->bark_map_size-1;
802
-        }
803 802
     }
804 803
     map[n]=-1;
805 804
     vf->map_size[blockflag]=n;
... ...
@@ -813,7 +812,8 @@ static void create_map( vorbis_context * vc, uint_fast8_t floor_number )
813 813
 #   endif
814 814
 }
815 815
 
816
-static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) {
816
+static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
817
+{
817 818
     GetBitContext *gb=&vc->gb;
818 819
     uint_fast8_t i;
819 820
 
... ...
@@ -841,7 +841,8 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) {
841 841
 
842 842
 // Process the whole setup header using the functions above
843 843
 
844
-static int vorbis_parse_setup_hdr(vorbis_context *vc) {
844
+static int vorbis_parse_setup_hdr(vorbis_context *vc)
845
+{
845 846
     GetBitContext *gb=&vc->gb;
846 847
 
847 848
     if ((get_bits(gb, 8)!='v') || (get_bits(gb, 8)!='o') ||
... ...
@@ -885,7 +886,8 @@ static int vorbis_parse_setup_hdr(vorbis_context *vc) {
885 885
 
886 886
 // Process the identification header
887 887
 
888
-static int vorbis_parse_id_hdr(vorbis_context *vc){
888
+static int vorbis_parse_id_hdr(vorbis_context *vc)
889
+{
889 890
     GetBitContext *gb=&vc->gb;
890 891
     uint_fast8_t bl0, bl1;
891 892
 
... ...
@@ -956,7 +958,8 @@ static int vorbis_parse_id_hdr(vorbis_context *vc){
956 956
 
957 957
 // Process the extradata using the functions above (identification header, setup header)
958 958
 
959
-static av_cold int vorbis_decode_init(AVCodecContext *avccontext) {
959
+static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
960
+{
960 961
     vorbis_context *vc = avccontext->priv_data ;
961 962
     uint8_t *headers = avccontext->extradata;
962 963
     int headers_len=avccontext->extradata_size;
... ...
@@ -1024,7 +1027,8 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext) {
1024 1024
 // Read and decode floor
1025 1025
 
1026 1026
 static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc,
1027
-                                         vorbis_floor_data *vfu, float *vec) {
1027
+                                         vorbis_floor_data *vfu, float *vec)
1028
+{
1028 1029
     vorbis_floor0 * vf=&vfu->t0;
1029 1030
     float * lsp=vf->lsp;
1030 1031
     uint_fast32_t amplitude;
... ...
@@ -1061,9 +1065,8 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc,
1061 1061
                              codebook.dimensions;
1062 1062
             AV_DEBUG( "floor0 dec: vector offset: %d\n", vec_off );
1063 1063
             /* copy each vector component and add last to it */
1064
-            for (idx=0; idx<codebook.dimensions; ++idx) {
1064
+            for (idx=0; idx<codebook.dimensions; ++idx)
1065 1065
                 lsp[lsp_len+idx]=codebook.codevectors[vec_off+idx]+last;
1066
-            }
1067 1066
             last=lsp[lsp_len+idx-1]; /* set last to last vector component */
1068 1067
 
1069 1068
             lsp_len += codebook.dimensions;
... ...
@@ -1083,7 +1086,8 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc,
1083 1083
             int order=vf->order;
1084 1084
             float wstep=M_PI/vf->bark_map_size;
1085 1085
 
1086
-            for(i=0;i<order;i++) { lsp[i]=2.0f*cos(lsp[i]); }
1086
+            for(i=0;i<order;i++)
1087
+                lsp[i]=2.0f*cos(lsp[i]);
1087 1088
 
1088 1089
             AV_DEBUG("floor0 synth: map_size=%d; m=%d; wstep=%f\n",
1089 1090
                      vf->map_size, order, wstep);
... ...
@@ -1103,8 +1107,7 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc,
1103 1103
                 if(j==order) { // even order
1104 1104
                     p *= p*(2.0f-two_cos_w);
1105 1105
                     q *= q*(2.0f+two_cos_w);
1106
-                }
1107
-                else { // odd order
1106
+                } else { // odd order
1108 1107
                     q *= two_cos_w-lsp[j]; // one more time for q
1109 1108
 
1110 1109
                     /* final step and square */
... ...
@@ -1122,11 +1125,12 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc,
1122 1122
                 }
1123 1123
 
1124 1124
                 /* fill vector */
1125
-                do { vec[i]=q; ++i; }while(vf->map[blockflag][i]==iter_cond);
1125
+                do {
1126
+                    vec[i]=q; ++i;
1127
+                } while (vf->map[blockflag][i]==iter_cond);
1126 1128
             }
1127 1129
         }
1128
-    }
1129
-    else {
1130
+    } else {
1130 1131
         /* this channel is unused */
1131 1132
         return 1;
1132 1133
     }
... ...
@@ -1136,7 +1140,9 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc,
1136 1136
     return 0;
1137 1137
 }
1138 1138
 
1139
-static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec) {
1139
+static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc,
1140
+                                         vorbis_floor_data *vfu, float *vec)
1141
+{
1140 1142
     vorbis_floor1 * vf=&vfu->t1;
1141 1143
     GetBitContext *gb=&vc->gb;
1142 1144
     uint_fast16_t range_v[4]={ 256, 128, 86, 64 };
... ...
@@ -1175,10 +1181,9 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *
1175 1175
 
1176 1176
         AV_DEBUG("Cbits %d \n", cbits);
1177 1177
 
1178
-        if (cbits) { // this reads all subclasses for this partition's class
1178
+        if (cbits) // this reads all subclasses for this partition's class
1179 1179
             cval=get_vlc2(gb, vc->codebooks[vf->class_masterbook[class_]].vlc.table,
1180 1180
             vc->codebooks[vf->class_masterbook[class_]].nb_bits, 3);
1181
-        }
1182 1181
 
1183 1182
         for(j=0;j<cdim;++j) {
1184 1183
             book=vf->subclass_books[class_][cval & csub];
... ...
@@ -1267,7 +1272,14 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *
1267 1267
 
1268 1268
 // Read and decode residue
1269 1269
 
1270
-static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, vorbis_residue *vr, uint_fast8_t ch, uint_fast8_t *do_not_decode, float *vec, uint_fast16_t vlen, int vr_type) {
1270
+static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
1271
+                                                           vorbis_residue *vr,
1272
+                                                           uint_fast8_t ch,
1273
+                                                           uint_fast8_t *do_not_decode,
1274
+                                                           float *vec,
1275
+                                                           uint_fast16_t
1276
+                                                           vlen, int vr_type)
1277
+{
1271 1278
     GetBitContext *gb=&vc->gb;
1272 1279
     uint_fast8_t c_p_c=vc->codebooks[vr->classbook].dimensions;
1273 1280
     uint_fast16_t n_to_read=vr->end-vr->begin;
... ...
@@ -1279,10 +1291,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, v
1279 1279
     uint_fast16_t k;
1280 1280
 
1281 1281
     if (vr_type==2) {
1282
-        for(j=1;j<ch;++j) {
1282
+        for(j=1;j<ch;++j)
1283 1283
                 do_not_decode[0]&=do_not_decode[j];  // FIXME - clobbering input
1284
-        }
1285
-        if (do_not_decode[0]) return 0;
1284
+        if (do_not_decode[0])
1285
+            return 0;
1286 1286
         ch_used=1;
1287 1287
     } else {
1288 1288
         ch_used=ch;
... ...
@@ -1311,9 +1323,8 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, v
1311 1311
                             uint_fast32_t temp2;
1312 1312
 
1313 1313
                             temp2=(((uint_fast64_t)temp) * inverse_class)>>32;
1314
-                            if (partition_count+c_p_c-1-i < ptns_to_read) {
1314
+                            if (partition_count+c_p_c-1-i < ptns_to_read)
1315 1315
                                 classifs[j_times_ptns_to_read+partition_count+c_p_c-1-i]=temp-temp2*vr->classifications;
1316
-                            }
1317 1316
                             temp=temp2;
1318 1317
                         }
1319 1318
                     }
... ...
@@ -1340,12 +1351,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, v
1340 1340
                                 voffs=voffset+j*vlen;
1341 1341
                                 for(k=0;k<step;++k) {
1342 1342
                                     coffs=get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
1343
-                                    for(l=0;l<dim;++l) {
1343
+                                    for(l=0;l<dim;++l)
1344 1344
                                         vec[voffs+k+l*step]+=codebook.codevectors[coffs+l];  // FPMATH
1345
-                                    }
1346 1345
                                 }
1347
-                            }
1348
-                            else if (vr_type==1) {
1346
+                            } else if (vr_type==1) {
1349 1347
                                 voffs=voffset+j*vlen;
1350 1348
                                 for(k=0;k<step;++k) {
1351 1349
                                     coffs=get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
... ...
@@ -1355,8 +1364,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, v
1355 1355
                                         AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d  \n", pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs);
1356 1356
                                     }
1357 1357
                                 }
1358
-                            }
1359
-                            else if (vr_type==2 && ch==2 && (voffset&1)==0 && (dim&1)==0) { // most frequent case optimized
1358
+                            } else if (vr_type==2 && ch==2 && (voffset&1)==0 && (dim&1)==0) { // most frequent case optimized
1360 1359
                                 voffs=voffset>>1;
1361 1360
 
1362 1361
                                 if(dim==2) {
... ...
@@ -1384,8 +1392,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, v
1384 1384
                                     }
1385 1385
                                 }
1386 1386
 
1387
-                            }
1388
-                            else if (vr_type==2) {
1387
+                            } else if (vr_type==2) {
1389 1388
                                 voffs=voffset;
1390 1389
 
1391 1390
                                 for(k=0;k<step;++k) {
... ...
@@ -1409,7 +1416,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, v
1409 1409
     return 0;
1410 1410
 }
1411 1411
 
1412
-static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fast8_t ch, uint_fast8_t *do_not_decode, float *vec, uint_fast16_t vlen)
1412
+static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
1413
+                                        uint_fast8_t ch,
1414
+                                        uint_fast8_t *do_not_decode,
1415
+                                        float *vec, uint_fast16_t vlen)
1413 1416
 {
1414 1417
     if (vr->type==2)
1415 1418
         return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 2);
... ...
@@ -1426,8 +1436,7 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
1426 1426
 void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
1427 1427
 {
1428 1428
     int i;
1429
-    for(i=0; i<blocksize; i++)
1430
-    {
1429
+    for(i=0; i<blocksize; i++) {
1431 1430
         if (mag[i]>0.0) {
1432 1431
             if (ang[i]>0.0) {
1433 1432
                 ang[i]=mag[i]-ang[i];
... ...
@@ -1448,7 +1457,8 @@ void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
1448 1448
     }
1449 1449
 }
1450 1450
 
1451
-static void copy_normalize(float *dst, float *src, int len, int exp_bias, float add_bias)
1451
+static void copy_normalize(float *dst, float *src, int len, int exp_bias,
1452
+                           float add_bias)
1452 1453
 {
1453 1454
     int i;
1454 1455
     if(exp_bias) {
... ...
@@ -1461,7 +1471,8 @@ static void copy_normalize(float *dst, float *src, int len, int exp_bias, float
1461 1461
 
1462 1462
 // Decode the audio packet using the functions above
1463 1463
 
1464
-static int vorbis_parse_audio_packet(vorbis_context *vc) {
1464
+static int vorbis_parse_audio_packet(vorbis_context *vc)
1465
+{
1465 1466
     GetBitContext *gb=&vc->gb;
1466 1467
 
1467 1468
     uint_fast8_t previous_window=vc->previous_window;
... ...
@@ -1500,9 +1511,8 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) {
1500 1500
 
1501 1501
     blockflag=vc->modes[mode_number].blockflag;
1502 1502
     blocksize=vc->blocksize[blockflag];
1503
-    if (blockflag) {
1503
+    if (blockflag)
1504 1504
         skip_bits(gb, 2); // previous_window, next_window
1505
-    }
1506 1505
 
1507 1506
     memset(ch_res_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); //FIXME can this be removed ?
1508 1507
     memset(ch_floor_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); //FIXME can this be removed ?
... ...
@@ -1616,9 +1626,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
1616 1616
 
1617 1617
     int_fast16_t len;
1618 1618
 
1619
-    if(!buf_size){
1619
+    if(!buf_size)
1620 1620
         return 0;
1621
-    }
1622 1621
 
1623 1622
     AV_DEBUG("packet length %d \n", buf_size);
1624 1623
 
... ...
@@ -1649,7 +1658,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
1649 1649
 
1650 1650
 // Close decoder
1651 1651
 
1652
-static av_cold int vorbis_decode_close(AVCodecContext *avccontext) {
1652
+static av_cold int vorbis_decode_close(AVCodecContext *avccontext)
1653
+{
1653 1654
     vorbis_context *vc = avccontext->priv_data;
1654 1655
 
1655 1656
     vorbis_free(vc);
... ...
@@ -125,20 +125,26 @@ typedef struct {
125 125
     int64_t sample_count;
126 126
 } vorbis_enc_context;
127 127
 
128
-static inline void put_codeword(PutBitContext * pb, vorbis_enc_codebook * cb, int entry) {
128
+static inline void put_codeword(PutBitContext * pb, vorbis_enc_codebook * cb,
129
+                                int entry)
130
+{
129 131
     assert(entry >= 0);
130 132
     assert(entry < cb->nentries);
131 133
     assert(cb->lens[entry]);
132 134
     put_bits(pb, cb->lens[entry], cb->codewords[entry]);
133 135
 }
134 136
 
135
-static int cb_lookup_vals(int lookup, int dimentions, int entries) {
136
-    if      (lookup == 1) return ff_vorbis_nth_root(entries, dimentions);
137
-    else if (lookup == 2) return dimentions * entries;
137
+static int cb_lookup_vals(int lookup, int dimentions, int entries)
138
+{
139
+    if (lookup == 1)
140
+        return ff_vorbis_nth_root(entries, dimentions);
141
+    else if (lookup == 2)
142
+        return dimentions * entries;
138 143
     return 0;
139 144
 }
140 145
 
141
-static void ready_codebook(vorbis_enc_codebook * cb) {
146
+static void ready_codebook(vorbis_enc_codebook * cb)
147
+{
142 148
     int i;
143 149
 
144 150
     ff_vorbis_len2vlc(cb->lens, cb->codewords, cb->nentries);
... ...
@@ -171,7 +177,8 @@ static void ready_codebook(vorbis_enc_codebook * cb) {
171 171
     }
172 172
 }
173 173
 
174
-static void ready_residue(vorbis_enc_residue * rc, vorbis_enc_context * venc) {
174
+static void ready_residue(vorbis_enc_residue * rc, vorbis_enc_context * venc)
175
+{
175 176
     int i;
176 177
     assert(rc->type == 2);
177 178
     rc->maxes = av_mallocz(sizeof(float[2]) * rc->classifications);
... ...
@@ -179,15 +186,18 @@ static void ready_residue(vorbis_enc_residue * rc, vorbis_enc_context * venc) {
179 179
         int j;
180 180
         vorbis_enc_codebook * cb;
181 181
         for (j = 0; j < 8; j++)
182
-            if (rc->books[i][j] != -1) break;
183
-        if (j == 8) continue; // zero
182
+            if (rc->books[i][j] != -1)
183
+                break;
184
+        if (j == 8)
185
+            continue; // zero
184 186
         cb = &venc->codebooks[rc->books[i][j]];
185 187
         assert(cb->ndimentions >= 2);
186 188
         assert(cb->lookup);
187 189
 
188 190
         for (j = 0; j < cb->nentries; j++) {
189 191
             float a;
190
-            if (!cb->lens[j]) continue;
192
+            if (!cb->lens[j])
193
+                continue;
191 194
             a = fabs(cb->dimentions[j * cb->ndimentions]);
192 195
             if (a > rc->maxes[i][0])
193 196
                 rc->maxes[i][0] = a;
... ...
@@ -203,7 +213,9 @@ static void ready_residue(vorbis_enc_residue * rc, vorbis_enc_context * venc) {
203 203
     }
204 204
 }
205 205
 
206
-static void create_vorbis_context(vorbis_enc_context * venc, AVCodecContext * avccontext) {
206
+static void create_vorbis_context(vorbis_enc_context * venc,
207
+                                  AVCodecContext * avccontext)
208
+{
207 209
     vorbis_enc_floor * fc;
208 210
     vorbis_enc_residue * rc;
209 211
     vorbis_enc_mapping * mc;
... ...
@@ -363,17 +375,22 @@ static void create_vorbis_context(vorbis_enc_context * venc, AVCodecContext * av
363 363
     ff_mdct_init(&venc->mdct[1], venc->log2_blocksize[1], 0, 1.0);
364 364
 }
365 365
 
366
-static void put_float(PutBitContext * pb, float f) {
366
+static void put_float(PutBitContext * pb, float f)
367
+{
367 368
     int exp, mant;
368 369
     uint32_t res = 0;
369 370
     mant = (int)ldexp(frexp(f, &exp), 20);
370 371
     exp += 788 - 20;
371
-    if (mant < 0) { res |= (1 << 31); mant = -mant; }
372
+    if (mant < 0) {
373
+        res |= (1 << 31);
374
+        mant = -mant;
375
+    }
372 376
     res |= mant | (exp << 21);
373 377
     put_bits(pb, 32, res);
374 378
 }
375 379
 
376
-static void put_codebook_header(PutBitContext * pb, vorbis_enc_codebook * cb) {
380
+static void put_codebook_header(PutBitContext * pb, vorbis_enc_codebook * cb)
381
+{
377 382
     int i;
378 383
     int ordered = 0;
379 384
 
... ...
@@ -382,7 +399,8 @@ static void put_codebook_header(PutBitContext * pb, vorbis_enc_codebook * cb) {
382 382
     put_bits(pb, 24, cb->nentries);
383 383
 
384 384
     for (i = 1; i < cb->nentries; i++)
385
-        if (cb->lens[i] < cb->lens[i-1]) break;
385
+        if (cb->lens[i] < cb->lens[i-1])
386
+            break;
386 387
     if (i == cb->nentries)
387 388
         ordered = 1;
388 389
 
... ...
@@ -394,7 +412,8 @@ static void put_codebook_header(PutBitContext * pb, vorbis_enc_codebook * cb) {
394 394
         while (i < cb->nentries) {
395 395
             int j;
396 396
             for (j = 0; j+i < cb->nentries; j++)
397
-                if (cb->lens[j+i] != len) break;
397
+                if (cb->lens[j+i] != len)
398
+                    break;
398 399
             put_bits(pb, ilog(cb->nentries - i), j);
399 400
             i += j;
400 401
             len++;
... ...
@@ -402,14 +421,17 @@ static void put_codebook_header(PutBitContext * pb, vorbis_enc_codebook * cb) {
402 402
     } else {
403 403
         int sparse = 0;
404 404
         for (i = 0; i < cb->nentries; i++)
405
-            if (!cb->lens[i]) break;
405
+            if (!cb->lens[i])
406
+                break;
406 407
         if (i != cb->nentries)
407 408
             sparse = 1;
408 409
         put_bits(pb, 1, sparse);
409 410
 
410 411
         for (i = 0; i < cb->nentries; i++) {
411
-            if (sparse) put_bits(pb, 1, !!cb->lens[i]);
412
-            if (cb->lens[i]) put_bits(pb, 5, cb->lens[i] - 1);
412
+            if (sparse)
413
+                put_bits(pb, 1, !!cb->lens[i]);
414
+            if (cb->lens[i])
415
+                put_bits(pb, 5, cb->lens[i] - 1);
413 416
         }
414 417
     }
415 418
 
... ...
@@ -432,7 +454,8 @@ static void put_codebook_header(PutBitContext * pb, vorbis_enc_codebook * cb) {
432 432
     }
433 433
 }
434 434
 
435
-static void put_floor_header(PutBitContext * pb, vorbis_enc_floor * fc) {
435
+static void put_floor_header(PutBitContext * pb, vorbis_enc_floor * fc)
436
+{
436 437
     int i;
437 438
 
438 439
     put_bits(pb, 16, 1); // type, only floor1 is supported
... ...
@@ -464,7 +487,8 @@ static void put_floor_header(PutBitContext * pb, vorbis_enc_floor * fc) {
464 464
         put_bits(pb, fc->rangebits, fc->list[i].x);
465 465
 }
466 466
 
467
-static void put_residue_header(PutBitContext * pb, vorbis_enc_residue * rc) {
467
+static void put_residue_header(PutBitContext * pb, vorbis_enc_residue * rc)
468
+{
468 469
     int i;
469 470
 
470 471
     put_bits(pb, 16, rc->type);
... ...
@@ -495,7 +519,8 @@ static void put_residue_header(PutBitContext * pb, vorbis_enc_residue * rc) {
495 495
     }
496 496
 }
497 497
 
498
-static int put_main_header(vorbis_enc_context * venc, uint8_t ** out) {
498
+static int put_main_header(vorbis_enc_context * venc, uint8_t ** out)
499
+{
499 500
     int i;
500 501
     PutBitContext pb;
501 502
     uint8_t buffer[50000] = {0}, * p = buffer;
... ...
@@ -624,7 +649,8 @@ static int put_main_header(vorbis_enc_context * venc, uint8_t ** out) {
624 624
     return p - *out;
625 625
 }
626 626
 
627
-static float get_floor_average(vorbis_enc_floor * fc, float * coeffs, int i) {
627
+static float get_floor_average(vorbis_enc_floor * fc, float * coeffs, int i)
628
+{
628 629
     int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x;
629 630
     int end   = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x;
630 631
     int j;
... ...
@@ -635,7 +661,9 @@ static float get_floor_average(vorbis_enc_floor * fc, float * coeffs, int i) {
635 635
     return average / (end - begin);
636 636
 }
637 637
 
638
-static void floor_fit(vorbis_enc_context * venc, vorbis_enc_floor * fc, float * coeffs, uint_fast16_t * posts, int samples) {
638
+static void floor_fit(vorbis_enc_context * venc, vorbis_enc_floor * fc,
639
+                      float * coeffs, uint_fast16_t * posts, int samples)
640
+{
639 641
     int range = 255 / fc->multiplier + 1;
640 642
     int i;
641 643
     float tot_average = 0.;
... ...
@@ -654,16 +682,21 @@ static void floor_fit(vorbis_enc_context * venc, vorbis_enc_floor * fc, float *
654 654
 
655 655
         average *= pow(tot_average / average, 0.5) * pow(1.25, position/200.); // MAGIC!
656 656
         for (j = 0; j < range - 1; j++)
657
-            if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average) break;
657
+            if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average)
658
+                break;
658 659
         posts[fc->list[i].sort] = j;
659 660
     }
660 661
 }
661 662
 
662
-static int render_point(int x0, int y0, int x1, int y1, int x) {
663
+static int render_point(int x0, int y0, int x1, int y1, int x)
664
+{
663 665
     return y0 +  (x - x0) * (y1 - y0) / (x1 - x0);
664 666
 }
665 667
 
666
-static void floor_encode(vorbis_enc_context * venc, vorbis_enc_floor * fc, PutBitContext * pb, uint_fast16_t * posts, float * floor, int samples) {
668
+static void floor_encode(vorbis_enc_context * venc, vorbis_enc_floor * fc,
669
+                         PutBitContext * pb, uint_fast16_t * posts,
670
+                         float * floor, int samples)
671
+{
667 672
     int range = 255 / fc->multiplier + 1;
668 673
     int coded[fc->values]; // first 2 values are unused
669 674
     int i, counter;
... ...
@@ -686,8 +719,10 @@ static void floor_encode(vorbis_enc_context * venc, vorbis_enc_floor * fc, PutBi
686 686
             coded[i] = 0; // must be used later as flag!
687 687
             continue;
688 688
         } else {
689
-            if (!coded[fc->list[i].low ]) coded[fc->list[i].low ] = -1;
690
-            if (!coded[fc->list[i].high]) coded[fc->list[i].high] = -1;
689
+            if (!coded[fc->list[i].low ])
690
+                coded[fc->list[i].low ] = -1;
691
+            if (!coded[fc->list[i].high])
692
+                coded[fc->list[i].high] = -1;
691 693
         }
692 694
         if (posts[i] > predicted) {
693 695
             if (posts[i] - predicted > room)
... ...
@@ -716,7 +751,8 @@ static void floor_encode(vorbis_enc_context * venc, vorbis_enc_floor * fc, PutBi
716 716
                     if (c->books[l] != -1)
717 717
                         maxval = venc->codebooks[c->books[l]].nentries;
718 718
                     // coded could be -1, but this still works, cause that is 0
719
-                    if (coded[counter + k] < maxval) break;
719
+                    if (coded[counter + k] < maxval)
720
+                        break;
720 721
                 }
721 722
                 assert(l != csub);
722 723
                 cval |= l << cshift;
... ...
@@ -728,8 +764,10 @@ static void floor_encode(vorbis_enc_context * venc, vorbis_enc_floor * fc, PutBi
728 728
             int book = c->books[cval & (csub-1)];
729 729
             int entry = coded[counter++];
730 730
             cval >>= c->subclass;
731
-            if (book == -1) continue;
732
-            if (entry == -1) entry = 0;
731
+            if (book == -1)
732
+                continue;
733
+            if (entry == -1)
734
+                entry = 0;
733 735
             put_codeword(pb, &venc->codebooks[book], entry);
734 736
         }
735 737
     }
... ...
@@ -737,14 +775,16 @@ static void floor_encode(vorbis_enc_context * venc, vorbis_enc_floor * fc, PutBi
737 737
     ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded, fc->multiplier, floor, samples);
738 738
 }
739 739
 
740
-static float * put_vector(vorbis_enc_codebook * book, PutBitContext * pb, float * num) {
740
+static float * put_vector(vorbis_enc_codebook * book, PutBitContext * pb, float * num)
741
+{
741 742
     int i, entry = -1;
742 743
     float distance = FLT_MAX;
743 744
     assert(book->dimentions);
744 745
     for (i = 0; i < book->nentries; i++) {
745 746
         float * vec = book->dimentions + i * book->ndimentions, d = book->pow2[i];
746 747
         int j;
747
-        if (!book->lens[i]) continue;
748
+        if (!book->lens[i])
749
+            continue;
748 750
         for (j = 0; j < book->ndimentions; j++)
749 751
             d -= vec[j] * num[j];
750 752
         if (distance > d) {
... ...
@@ -756,7 +796,10 @@ static float * put_vector(vorbis_enc_codebook * book, PutBitContext * pb, float
756 756
     return &book->dimentions[entry * book->ndimentions];
757 757
 }
758 758
 
759
-static void residue_encode(vorbis_enc_context * venc, vorbis_enc_residue * rc, PutBitContext * pb, float * coeffs, int samples, int real_ch) {
759
+static void residue_encode(vorbis_enc_context * venc, vorbis_enc_residue * rc,
760
+                           PutBitContext * pb, float * coeffs, int samples,
761
+                           int real_ch)
762
+{
760 763
     int pass, i, j, p, k;
761 764
     int psize = rc->partition_size;
762 765
     int partitions = (rc->end - rc->begin) / psize;
... ...
@@ -774,9 +817,9 @@ static void residue_encode(vorbis_enc_context * venc, vorbis_enc_residue * rc, P
774 774
             max2 = FFMAX(max2, fabs(coeffs[samples + k / real_ch]));
775 775
         }
776 776
 
777
-        for (i = 0; i < rc->classifications - 1; i++) {
778
-            if (max1 < rc->maxes[i][0] && max2 < rc->maxes[i][1]) break;
779
-        }
777
+        for (i = 0; i < rc->classifications - 1; i++)
778
+            if (max1 < rc->maxes[i][0] && max2 < rc->maxes[i][1])
779
+                break;
780 780
         classes[0][p] = i;
781 781
     }
782 782
 
... ...
@@ -798,7 +841,8 @@ static void residue_encode(vorbis_enc_context * venc, vorbis_enc_residue * rc, P
798 798
                     int nbook = rc->books[classes[j][p]][pass];
799 799
                     vorbis_enc_codebook * book = &venc->codebooks[nbook];
800 800
                     float * buf = coeffs + samples*j + rc->begin + p*psize;
801
-                    if (nbook == -1) continue;
801
+                    if (nbook == -1)
802
+                        continue;
802 803
 
803 804
                     assert(rc->type == 0 || rc->type == 2);
804 805
                     assert(!(psize % book->ndimentions));
... ...
@@ -841,7 +885,9 @@ static void residue_encode(vorbis_enc_context * venc, vorbis_enc_residue * rc, P
841 841
     }
842 842
 }
843 843
 
844
-static int apply_window_and_mdct(vorbis_enc_context * venc, signed short * audio, int samples) {
844
+static int apply_window_and_mdct(vorbis_enc_context * venc,
845
+                                 signed short * audio, int samples)
846
+{
845 847
     int i, j, channel;
846 848
     const float * win = venc->win[0];
847 849
     int window_len = 1 << (venc->log2_blocksize[0] - 1);
... ...
@@ -850,15 +896,12 @@ static int apply_window_and_mdct(vorbis_enc_context * venc, signed short * audio
850 850
 
851 851
     if (!venc->have_saved && !samples) return 0;
852 852
 
853
-    if (venc->have_saved) {
854
-        for (channel = 0; channel < venc->channels; channel++) {
853
+    if (venc->have_saved)
854
+        for (channel = 0; channel < venc->channels; channel++)
855 855
             memcpy(venc->samples + channel*window_len*2, venc->saved + channel*window_len, sizeof(float)*window_len);
856
-        }
857
-    } else {
858
-        for (channel = 0; channel < venc->channels; channel++) {
856
+    else
857
+        for (channel = 0; channel < venc->channels; channel++)
859 858
             memset(venc->samples + channel*window_len*2, 0, sizeof(float)*window_len);
860
-        }
861
-    }
862 859
 
863 860
     if (samples) {
864 861
         for (channel = 0; channel < venc->channels; channel++) {
... ...
@@ -868,14 +911,12 @@ static int apply_window_and_mdct(vorbis_enc_context * venc, signed short * audio
868 868
                 offset[i] = -audio[j] / 32768. / n * win[window_len - i - 1]; //FIXME find out why the sign has to be fliped
869 869
         }
870 870
     } else {
871
-        for (channel = 0; channel < venc->channels; channel++) {
871
+        for (channel = 0; channel < venc->channels; channel++)
872 872
             memset(venc->samples + channel*window_len*2 + window_len, 0, sizeof(float)*window_len);
873
-        }
874 873
     }
875 874
 
876
-    for (channel = 0; channel < venc->channels; channel++) {
875
+    for (channel = 0; channel < venc->channels; channel++)
877 876
         ff_mdct_calc(&venc->mdct[0], venc->coeffs + channel*window_len, venc->samples + channel*window_len*2);
878
-    }
879 877
 
880 878
     if (samples) {
881 879
         for (channel = 0; channel < venc->channels; channel++) {
... ...
@@ -928,7 +969,8 @@ static int vorbis_encode_frame(AVCodecContext * avccontext, unsigned char * pack
928 928
     PutBitContext pb;
929 929
     int i;
930 930
 
931
-    if (!apply_window_and_mdct(venc, audio, samples)) return 0;
931
+    if (!apply_window_and_mdct(venc, audio, samples))
932
+        return 0;
932 933
     samples = 1 << (venc->log2_blocksize[0] - 1);
933 934
 
934 935
     init_put_bits(&pb, packets, buf_size);
... ...
@@ -951,9 +993,8 @@ static int vorbis_encode_frame(AVCodecContext * avccontext, unsigned char * pack
951 951
         floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
952 952
     }
953 953
 
954
-    for (i = 0; i < venc->channels * samples; i++) {
954
+    for (i = 0; i < venc->channels * samples; i++)
955 955
         venc->coeffs[i] /= venc->floor[i];
956
-    }
957 956
 
958 957
     for (i = 0; i < mapping->coupling_steps; i++) {
959 958
         float * mag = venc->coeffs + mapping->magnitude[i] * samples;
... ...
@@ -962,8 +1003,10 @@ static int vorbis_encode_frame(AVCodecContext * avccontext, unsigned char * pack
962 962
         for (j = 0; j < samples; j++) {
963 963
             float a = ang[j];
964 964
             ang[j] -= mag[j];
965
-            if (mag[j] > 0) ang[j] = -ang[j];
966
-            if (ang[j] < 0) mag[j] = a;
965
+            if (mag[j] > 0)
966
+                ang[j] = -ang[j];
967
+            if (ang[j] < 0)
968
+                mag[j] = a;
967 969
         }
968 970
     }
969 971