comparison vorbis_enc.c @ 3912:f56e6d3a1d6e libavcodec

Original Commit: r113 | ods15 | 2006-10-01 21:35:47 +0200 (Sun, 01 Oct 2006) | 2 lines some more static consts
author ods15
date Mon, 02 Oct 2006 06:09:49 +0000
parents a1b41e814052
children f2204277a928
comparison
equal deleted inserted replaced
3911:a1b41e814052 3912:f56e6d3a1d6e
699 rc->maxes[i][0] += 0.8; 699 rc->maxes[i][0] += 0.8;
700 rc->maxes[i][1] += 0.8; 700 rc->maxes[i][1] += 0.8;
701 } 701 }
702 } 702 }
703 703
704 static const struct {
705 int dim;
706 int subclass;
707 int masterbook;
708 const int * nbooks;
709 } floor_classes[] = {
710 { 3, 0, 0, (const int[]){ 4 } },
711 { 4, 1, 0, (const int[]){ 5, 6 } },
712 { 3, 1, 1, (const int[]){ 7, 8 } },
713 { 4, 2, 2, (const int[]){ -1, 9, 10, 11 } },
714 { 3, 2, 3, (const int[]){ -1, 12, 13, 14 } },
715 };
716
704 static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) { 717 static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) {
705 floor_t * fc; 718 floor_t * fc;
706 residue_t * rc; 719 residue_t * rc;
707 mapping_t * mc; 720 mapping_t * mc;
708 int i, book; 721 int i, book;
749 fc = &venc->floors[0]; 762 fc = &venc->floors[0];
750 fc->partitions = 8; 763 fc->partitions = 8;
751 fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions); 764 fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);
752 fc->nclasses = 0; 765 fc->nclasses = 0;
753 for (i = 0; i < fc->partitions; i++) { 766 for (i = 0; i < fc->partitions; i++) {
754 int a[] = {0,1,2,2,3,3,4,4}; 767 static const int a[] = {0,1,2,2,3,3,4,4};
755 fc->partition_to_class[i] = a[i]; 768 fc->partition_to_class[i] = a[i];
756 fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[i]); 769 fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[i]);
757 } 770 }
758 fc->nclasses++; 771 fc->nclasses++;
759 fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses); 772 fc->classes = av_malloc(sizeof(floor_class_t) * fc->nclasses);
760 for (i = 0; i < fc->nclasses; i++) { 773 for (i = 0; i < fc->nclasses; i++) {
761 floor_class_t * c = &fc->classes[i]; 774 floor_class_t * c = &fc->classes[i];
762 int j, books; 775 int j, books;
763 int dim[] = {3,4,3,4,3}; 776 c->dim = floor_classes[i].dim;
764 int subclass[] = {0,1,1,2,2}; 777 c->subclass = floor_classes[i].subclass;
765 int masterbook[] = {0/*none*/,0,1,2,3}; 778 c->masterbook = floor_classes[i].masterbook;
766 int * nbooks[] = {
767 (int[]){ 4 },
768 (int[]){ 5, 6 },
769 (int[]){ 7, 8 },
770 (int[]){ -1, 9, 10, 11 },
771 (int[]){ -1, 12, 13, 14 },
772 };
773 c->dim = dim[i];
774 c->subclass = subclass[i];
775 c->masterbook = masterbook[i];
776 books = (1 << c->subclass); 779 books = (1 << c->subclass);
777 c->books = av_malloc(sizeof(int) * books); 780 c->books = av_malloc(sizeof(int) * books);
778 for (j = 0; j < books; j++) c->books[j] = nbooks[i][j]; 781 for (j = 0; j < books; j++) c->books[j] = floor_classes[i].nbooks[j];
779 } 782 }
780 fc->multiplier = 2; 783 fc->multiplier = 2;
781 fc->rangebits = venc->blocksize[0] - 1; 784 fc->rangebits = venc->blocksize[0] - 1;
782 785
783 fc->values = 2; 786 fc->values = 2;