comparison vorbis.c @ 10310:d3644248015a libavcodec

some more linebreak and brace placement cosmetics
author diego
date Mon, 28 Sep 2009 21:46:22 +0000
parents d157ccc267e7
children 7bfcc66f807d
comparison
equal deleted inserted replaced
10309:d157ccc267e7 10310:d3644248015a
37 { 37 {
38 unsigned int ret=0, i, j; 38 unsigned int ret=0, i, j;
39 39
40 do { 40 do {
41 ++ret; 41 ++ret;
42 for(i=0,j=ret;i<n-1;i++) j*=ret; 42 for(i=0,j=ret;i<n-1;i++)
43 j*=ret;
43 } while (j<=x); 44 } while (j<=x);
44 45
45 return ret - 1; 46 return ret - 1;
46 } 47 }
47 48
60 61
61 #ifdef V_DEBUG 62 #ifdef V_DEBUG
62 GetBitContext gb; 63 GetBitContext gb;
63 #endif 64 #endif
64 65
65 for(p=0;(bits[p]==0) && (p<num);++p); 66 for(p=0;(bits[p]==0) && (p<num);++p)
67 ;
66 if (p==num) { 68 if (p==num) {
67 // av_log(vc->avccontext, AV_LOG_INFO, "An empty codebook. Heh?! \n"); 69 // av_log(vc->avccontext, AV_LOG_INFO, "An empty codebook. Heh?! \n");
68 return 0; 70 return 0;
69 } 71 }
70 72
71 codes[p]=0; 73 codes[p]=0;
72 if (bits[p] > 32) return 1; 74 if (bits[p] > 32)
75 return 1;
73 for(i=0;i<bits[p];++i) 76 for(i=0;i<bits[p];++i)
74 exit_at_level[i+1]=1<<i; 77 exit_at_level[i+1]=1<<i;
75 78
76 #ifdef V_DEBUG 79 #ifdef V_DEBUG
77 av_log(NULL, AV_LOG_INFO, " %d. of %d code len %d code %d - ", p, num, bits[p], codes[p]); 80 av_log(NULL, AV_LOG_INFO, " %d. of %d code len %d code %d - ", p, num, bits[p], codes[p]);
82 #endif 85 #endif
83 86
84 ++p; 87 ++p;
85 88
86 for(;p<num;++p) { 89 for(;p<num;++p) {
87 if (bits[p] > 32) return 1; 90 if (bits[p] > 32)
88 if (bits[p]==0) continue; 91 return 1;
92 if (bits[p]==0)
93 continue;
89 // find corresponding exit(node which the tree can grow further from) 94 // find corresponding exit(node which the tree can grow further from)
90 for(i=bits[p];i>0;--i) 95 for(i=bits[p];i>0;--i)
91 if (exit_at_level[i]) break; 96 if (exit_at_level[i])
92 if (!i) return 1; // overspecified tree 97 break;
98 if (!i) // overspecified tree
99 return 1;
93 code=exit_at_level[i]; 100 code=exit_at_level[i];
94 exit_at_level[i]=0; 101 exit_at_level[i]=0;
95 // construct code (append 0s to end) and introduce new exits 102 // construct code (append 0s to end) and introduce new exits
96 for(j=i+1;j<=bits[p];++j) 103 for(j=i+1;j<=bits[p];++j)
97 exit_at_level[j]=code+(1<<(j-1)); 104 exit_at_level[j]=code+(1<<(j-1));
107 114
108 } 115 }
109 116
110 //no exits should be left (underspecified tree - ie. unused valid vlcs - not allowed by SPEC) 117 //no exits should be left (underspecified tree - ie. unused valid vlcs - not allowed by SPEC)
111 for (p=1; p<33; p++) 118 for (p=1; p<33; p++)
112 if (exit_at_level[p]) return 1; 119 if (exit_at_level[p])
120 return 1;
113 121
114 return 0; 122 return 0;
115 } 123 }
116 124
117 void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values) 125 void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values)
125 list[i].high = 1; 133 list[i].high = 1;
126 list[i].sort = i; 134 list[i].sort = i;
127 for (j = 2; j < i; j++) { 135 for (j = 2; j < i; j++) {
128 int tmp = list[j].x; 136 int tmp = list[j].x;
129 if (tmp < list[i].x) { 137 if (tmp < list[i].x) {
130 if (tmp > list[list[i].low].x) list[i].low = j; 138 if (tmp > list[list[i].low].x)
139 list[i].low = j;
131 } else { 140 } else {
132 if (tmp < list[list[i].high].x) list[i].high = j; 141 if (tmp < list[list[i].high].x)
142 list[i].high = j;
133 } 143 }
134 } 144 }
135 } 145 }
136 for (i = 0; i < values - 1; i++) { 146 for (i = 0; i < values - 1; i++) {
137 int j; 147 int j;
210 if (lx < samples) 220 if (lx < samples)
211 render_line(lx, ly, FFMIN(x1,samples), y1, out); 221 render_line(lx, ly, FFMIN(x1,samples), y1, out);
212 lx = x1; 222 lx = x1;
213 ly = y1; 223 ly = y1;
214 } 224 }
215 if (lx >= samples) break; 225 if (lx >= samples)
216 } 226 break;
217 if (lx < samples) render_line(lx, ly, samples, ly, out); 227 }
218 } 228 if (lx < samples)
229 render_line(lx, ly, samples, ly, out);
230 }