comparison vorbis_enc.c @ 3825:9983437a00a1 libavcodec

Original Commit: r19 | ods15 | 2006-09-22 12:54:18 +0300 (Fri, 22 Sep 2006) | 2 lines floor generation
author ods15
date Mon, 02 Oct 2006 05:55:47 +0000
parents 61d312116e71
children c583e895f980
comparison
equal deleted inserted replaced
3824:61d312116e71 3825:9983437a00a1
162 162
163 } 163 }
164 164
165 static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) { 165 static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) {
166 codebook_t * cb; 166 codebook_t * cb;
167 floor_t * fc;
167 int i, book; 168 int i, book;
168 169
169 venc->channels = avccontext->channels; 170 venc->channels = avccontext->channels;
170 venc->sample_rate = avccontext->sample_rate; 171 venc->sample_rate = avccontext->sample_rate;
171 venc->blocksize[0] = venc->blocksize[1] = 8; 172 venc->blocksize[0] = venc->blocksize[1] = 8;
213 cb->quantlist = av_malloc(sizeof(int) * cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries)); 214 cb->quantlist = av_malloc(sizeof(int) * cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries));
214 for (i = 0; i < cb->nentries; i++) cb->quantlist[i] = i; 215 for (i = 0; i < cb->nentries; i++) cb->quantlist[i] = i;
215 ready_codebook(cb); 216 ready_codebook(cb);
216 } 217 }
217 218
219 venc->nfloors = 1;
220 venc->floors = av_malloc(sizeof(floor_t) * venc->nfloors);
221 fc = &venc->floors[0];
222
223 fc->partitions = 1;
224 fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);
225 for (i = 0; i < fc->partitions; i++) fc->partition_to_class = 0;
226 fc->nclasses = 1;
227 fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses);
228 for (i = 0; i < fc->nclasses; i++) {
229 floor_class_t * c = &fc->classes[i];
230 int j, books;
231 c->dim = 1;
232 c->subclass = 0;
233 c->masterbook = 0;
234 books = (1 << c->subclass);
235 c->books = av_malloc(sizeof(int) * books);
236 for (j = 0; j < books; j++) c->books[j] = 0;
237 }
238 fc->multiplier = 1;
239 fc->rangebits = venc->blocksize[0];
240
241 fc->values = 2;
242 for (i = 0; i < fc->partitions; i++)
243 fc->values += fc->classes[fc->partition_to_class[i]].dim;
244
245 fc->list = av_malloc(sizeof(*fc->list) * fc->values);
246 fc->list[0].x = 0;
247 fc->list[1].x = 1 << fc->rangebits;
248 for (i = 2; i < fc->values; i++) fc->list[i].x = i * 5;
218 } 249 }
219 250
220 static inline int ilog(unsigned int a) { 251 static inline int ilog(unsigned int a) {
221 int i; 252 int i;
222 for (i = 0; a >> i; i++); 253 for (i = 0; a >> i; i++);