comparison vorbis_enc.c @ 3892:4fb6be21be4b libavcodec

Original Commit: r93 | ods15 | 2006-09-30 22:02:21 +0300 (Sat, 30 Sep 2006) | 2 lines update to change made in vorbis.h/vorbis_data.c
author ods15
date Mon, 02 Oct 2006 06:09:02 +0000
parents 50e912426a32
children 7c51248a63d3
comparison
equal deleted inserted replaced
3891:50e912426a32 3892:4fb6be21be4b
21 * Native Vorbis encoder. 21 * Native Vorbis encoder.
22 * @author Oded Shimon <ods15@ods15.dyndns.org> 22 * @author Oded Shimon <ods15@ods15.dyndns.org>
23 */ 23 */
24 24
25 #include "avcodec.h" 25 #include "avcodec.h"
26 26 #include "dsputil.h"
27 #define BITSTREAM_H // don't include this
28 typedef int VLC;
29 typedef int GetBitContext;
30 #include "vorbis.h" 27 #include "vorbis.h"
31 28
32 #undef NDEBUG 29 #undef NDEBUG
33 #include <assert.h> 30 #include <assert.h>
34 31
521 venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2); 518 venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
522 venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1])); 519 venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]));
523 venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2); 520 venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
524 venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2); 521 venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
525 522
526 { 523 venc->win[0] = ff_vorbis_vwin[venc->blocksize[0] - 6];
527 const float *vwin[8]={ vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 }; 524 venc->win[1] = ff_vorbis_vwin[venc->blocksize[1] - 6];
528 venc->win[0] = vwin[venc->blocksize[0] - 6];
529 venc->win[1] = vwin[venc->blocksize[1] - 6];
530 }
531 525
532 ff_mdct_init(&venc->mdct[0], venc->blocksize[0], 0); 526 ff_mdct_init(&venc->mdct[0], venc->blocksize[0], 0);
533 ff_mdct_init(&venc->mdct[1], venc->blocksize[1], 0); 527 ff_mdct_init(&venc->mdct[1], venc->blocksize[1], 0);
534 } 528 }
535 529
794 int position = fc->list[fc->list[i].sort].x; 788 int position = fc->list[fc->list[i].sort].x;
795 float average = get_floor_average(fc, coeffs, i); 789 float average = get_floor_average(fc, coeffs, i);
796 int j; 790 int j;
797 791
798 average /= pow(average, 0.5) / tot_average * pow(0.8, position/200.); // MAGIC! 792 average /= pow(average, 0.5) / tot_average * pow(0.8, position/200.); // MAGIC!
799 for (j = 0; j < range - 1; j++) if (floor1_inverse_db_table[j * fc->multiplier] > average) break; 793 for (j = 0; j < range - 1; j++) if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average) break;
800 posts[fc->list[i].sort] = j; 794 posts[fc->list[i].sort] = j;
801 } 795 }
802 } 796 }
803 797
804 static int render_point(int x0, int y0, int x1, int y1, int x) { 798 static int render_point(int x0, int y0, int x1, int y1, int x) {
816 int sy; 810 int sy;
817 if (dy < 0) sy = base - 1; 811 if (dy < 0) sy = base - 1;
818 else sy = base + 1; 812 else sy = base + 1;
819 ady = ady - FFMAX(base, -base) * adx; 813 ady = ady - FFMAX(base, -base) * adx;
820 if (x >= n) return; 814 if (x >= n) return;
821 buf[x] = floor1_inverse_db_table[y]; 815 buf[x] = ff_vorbis_floor1_inverse_db_table[y];
822 for (x = x0 + 1; x < x1; x++) { 816 for (x = x0 + 1; x < x1; x++) {
823 if (x >= n) return; 817 if (x >= n) return;
824 err += ady; 818 err += ady;
825 if (err >= adx) { 819 if (err >= adx) {
826 err -= adx; 820 err -= adx;
827 y += sy; 821 y += sy;
828 } else { 822 } else {
829 y += base; 823 y += base;
830 } 824 }
831 buf[x] = floor1_inverse_db_table[y]; 825 buf[x] = ff_vorbis_floor1_inverse_db_table[y];
832 } 826 }
833 } 827 }
834 828
835 static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, int * posts, float * floor, int samples) { 829 static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, int * posts, float * floor, int samples) {
836 int range = 255 / fc->multiplier + 1; 830 int range = 255 / fc->multiplier + 1;