comparison vorbis_enc.c @ 3901:e255692302f0 libavcodec

Original Commit: r102 | ods15 | 2006-10-01 17:58:38 +0200 (Sun, 01 Oct 2006) | 2 lines remove ready_floor()
author ods15
date Mon, 02 Oct 2006 06:09:22 +0000
parents 2c1a4cce567b
children bd0cb21d956d
comparison
equal deleted inserted replaced
3900:2c1a4cce567b 3901:e255692302f0
48 int masterbook; 48 int masterbook;
49 int * books; 49 int * books;
50 } floor_class_t; 50 } floor_class_t;
51 51
52 typedef struct { 52 typedef struct {
53 int x;
54 int low;
55 int high;
56 int sort;
57 } floor_entry_t;
58
59 typedef struct {
60 int partitions; 53 int partitions;
61 int * partition_to_class; 54 int * partition_to_class;
62 int nclasses; 55 int nclasses;
63 floor_class_t * classes; 56 floor_class_t * classes;
64 int multiplier; 57 int multiplier;
65 int rangebits; 58 int rangebits;
66 int values; 59 int values;
67 floor_entry_t * list; 60 floor1_entry_t * list;
68 } floor_t; 61 } floor_t;
69 62
70 typedef struct { 63 typedef struct {
71 int type; 64 int type;
72 int begin; 65 int begin;
672 } 665 }
673 } 666 }
674 667
675 } 668 }
676 669
677 static void ready_floor(floor_t * fc) {
678 int i;
679 fc->list[0].sort = 0;
680 fc->list[1].sort = 1;
681 for (i = 2; i < fc->values; i++) {
682 int j;
683 fc->list[i].low = 0;
684 fc->list[i].high = 1;
685 fc->list[i].sort = i;
686 for (j = 2; j < i; j++) {
687 int tmp = fc->list[j].x;
688 if (tmp < fc->list[i].x) {
689 if (tmp > fc->list[fc->list[i].low].x) fc->list[i].low = j;
690 } else {
691 if (tmp < fc->list[fc->list[i].high].x) fc->list[i].high = j;
692 }
693 }
694 }
695 for (i = 0; i < fc->values - 1; i++) {
696 int j;
697 for (j = i + 1; j < fc->values; j++) {
698 if (fc->list[fc->list[i].sort].x > fc->list[fc->list[j].sort].x) {
699 int tmp = fc->list[i].sort;
700 fc->list[i].sort = fc->list[j].sort;
701 fc->list[j].sort = tmp;
702 }
703 }
704 }
705 }
706
707 static void ready_residue(residue_t * rc, venc_context_t * venc) { 670 static void ready_residue(residue_t * rc, venc_context_t * venc) {
708 int i; 671 int i;
709 assert(rc->type == 2); 672 assert(rc->type == 2);
710 rc->maxes = av_mallocz(sizeof(float[2]) * rc->classifications); 673 rc->maxes = av_mallocz(sizeof(float[2]) * rc->classifications);
711 for (i = 0; i < rc->classifications; i++) { 674 for (i = 0; i < rc->classifications; i++) {
814 777
815 fc->values = 2; 778 fc->values = 2;
816 for (i = 0; i < fc->partitions; i++) 779 for (i = 0; i < fc->partitions; i++)
817 fc->values += fc->classes[fc->partition_to_class[i]].dim; 780 fc->values += fc->classes[fc->partition_to_class[i]].dim;
818 781
819 fc->list = av_malloc(sizeof(floor_entry_t) * fc->values); 782 fc->list = av_malloc(sizeof(floor1_entry_t) * fc->values);
820 fc->list[0].x = 0; 783 fc->list[0].x = 0;
821 fc->list[1].x = 1 << fc->rangebits; 784 fc->list[1].x = 1 << fc->rangebits;
822 for (i = 2; i < fc->values; i++) { 785 for (i = 2; i < fc->values; i++) {
823 static const int a[] = { 786 static const int a[] = {
824 93, 23,372, 6, 46,186,750, 14, 33, 65, 787 93, 23,372, 6, 46,186,750, 14, 33, 65,
825 130,260,556, 3, 10, 18, 28, 39, 55, 79, 788 130,260,556, 3, 10, 18, 28, 39, 55, 79,
826 111,158,220,312,464,650,850 789 111,158,220,312,464,650,850
827 }; 790 };
828 fc->list[i].x = a[i - 2]; 791 fc->list[i].x = a[i - 2];
829 } 792 }
830 ready_floor(fc); 793 ff_vorbis_ready_floor1_list(fc->list, fc->values);
831 794
832 venc->nresidues = 1; 795 venc->nresidues = 1;
833 venc->residues = av_malloc(sizeof(residue_t) * venc->nresidues); 796 venc->residues = av_malloc(sizeof(residue_t) * venc->nresidues);
834 797
835 // single residue 798 // single residue