Commit 3a2b42e6 authored by Monty's avatar Monty
Browse files

Some minor setup code rearrangement/cleanup toward 5.1/7.1 additions


svn path=/trunk/vorbis/; revision=16894
parent 95f5495e
......@@ -7,7 +7,7 @@
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<!-- html -->
<meta name="src" content="Vorbis_I_spec.tex">
<meta name="date" content="2010-01-25 21:28:00">
<meta name="date" content="2010-02-03 17:32:00">
<link rel="stylesheet" type="text/css" href="Vorbis_I_spec.css">
</head><body
>
......@@ -24,7 +24,7 @@
class="cmr-17">Xiph.org Foundation</span></div>
<br />
<div class="date" ><span
class="cmr-17">January 25, 2010</span></div>
class="cmr-17">February 3, 2010</span></div>
</div>
<h3 class="likesectionHead"><a
id="x1-1000"></a>Contents</h3>
......
This diff is collapsed.
......@@ -27,8 +27,6 @@ typedef struct highlevel_encode_setup {
int set_in_stone;
double base_setting;
double long_setting;
double short_setting;
double impulse_noisetune;
int managed;
......
......@@ -165,7 +165,7 @@ static const vorbis_info_floor1 _floor[10]={
{{1,2,3,4}},
4,{0,128, 33,8,16,70},
60,30,500, 1.,18., -1
60,30,500, 1.,18., 128
},
/* 256 x 4 */
{
......@@ -173,7 +173,7 @@ static const vorbis_info_floor1 _floor[10]={
{{1,2,3,4}},
4,{0,256, 66,16,32,140},
60,30,500, 1.,18., -1
60,30,500, 1.,18., 256
},
/* 128 x 7 */
{
......@@ -181,7 +181,7 @@ static const vorbis_info_floor1 _floor[10]={
{{-1,2,3,4},{-1,5,6,7}},
4,{0,128, 14,4,58, 2,8,28,90},
60,30,500, 1.,18., -1
60,30,500, 1.,18., 128
},
/* 256 x 7 */
{
......@@ -189,7 +189,7 @@ static const vorbis_info_floor1 _floor[10]={
{{-1,2,3,4},{-1,5,6,7}},
4,{0,256, 28,8,116, 4,16,56,180},
60,30,500, 1.,18., -1
60,30,500, 1.,18., 256
},
/* 128 x 11 */
{
......@@ -198,7 +198,7 @@ static const vorbis_info_floor1 _floor[10]={
2,{0,128, 8,33, 4,16,70, 2,6,12, 23,46,90},
60,30,500, 1,18., -1
60,30,500, 1,18., 128
},
/* 128 x 17 */
{
......@@ -206,7 +206,7 @@ static const vorbis_info_floor1 _floor[10]={
{{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
2,{0,128, 12,46, 4,8,16, 23,33,70, 2,6,10, 14,19,28, 39,58,90},
60,30,500, 1,18., -1
60,30,500, 1,18., 128
},
/* 256 x 4 (low bitrate version) */
{
......@@ -214,7 +214,7 @@ static const vorbis_info_floor1 _floor[10]={
{{1,2,3,4}},
4,{0,256, 66,16,32,140},
60,30,500, 1.,18., -1
60,30,500, 1.,18., 256
},
/* 1024 x 27 */
{
......@@ -223,7 +223,7 @@ static const vorbis_info_floor1 _floor[10]={
2,{0,1024, 93,23,372, 6,46,186,750, 14,33,65, 130,260,556,
3,10,18,28, 39,55,79,111, 158,220,312, 464,650,850},
60,30,500, 3,18., -1 /* lowpass */
60,30,500, 3,18., 1024
},
/* 2048 x 27 */
{
......@@ -232,7 +232,7 @@ static const vorbis_info_floor1 _floor[10]={
2,{0,2048, 186,46,744, 12,92,372,1500, 28,66,130, 260,520,1112,
6,20,36,56, 78,110,158,222, 316,440,624, 928,1300,1700},
60,30,500, 3,18., -1 /* lowpass */
60,30,500, 3,18., 2048
},
/* 512 x 17 */
{
......@@ -241,7 +241,7 @@ static const vorbis_info_floor1 _floor[10]={
2,{0,512, 46,186, 16,33,65, 93,130,278,
7,23,39, 55,79,110, 156,232,360},
60,30,500, 1,18., -1 /* lowpass! */
60,30,500, 1,18., 512
},
};
......@@ -21,8 +21,11 @@ static const int blocksize_11[2]={
512,512
};
static const int _floor_mapping_11[2]={
6,6,
static const int _floor_mapping_11a[]={
6,6
};
static const int *_floor_mapping_11[]={
_floor_mapping_11a
};
static const double rate_mapping_11[3]={
......@@ -82,8 +85,8 @@ static const ve_setup_data_template ve_setup_11_stereo={
_floor_books,
_floor,
1,
_floor_mapping_11,
NULL,
_mapres_template_8_stereo
};
......@@ -133,8 +136,8 @@ static const ve_setup_data_template ve_setup_11_uncoupled={
_floor_books,
_floor,
1,
_floor_mapping_11,
NULL,
_mapres_template_8_uncoupled
};
......@@ -25,12 +25,16 @@ static const int blocksize_16_long[3]={
1024,1024,1024
};
static const int _floor_mapping_16_short[3]={
static const int _floor_mapping_16a[]={
9,3,3
};
static const int _floor_mapping_16[3]={
static const int _floor_mapping_16b[]={
9,9,9
};
static const int *_floor_mapping_16[]={
_floor_mapping_16a,
_floor_mapping_16b
};
static const double rate_mapping_16[4]={
12000.,20000.,44000.,86000.
......@@ -91,7 +95,7 @@ static const ve_setup_data_template ve_setup_16_stereo={
_floor_books,
_floor,
_floor_mapping_16_short,
2,
_floor_mapping_16,
_mapres_template_16_stereo
......@@ -142,7 +146,7 @@ static const ve_setup_data_template ve_setup_16_uncoupled={
_floor_books,
_floor,
_floor_mapping_16_short,
2,
_floor_mapping_16,
_mapres_template_16_uncoupled
......
......@@ -70,7 +70,7 @@ static const ve_setup_data_template ve_setup_22_stereo={
_floor_books,
_floor,
_floor_mapping_16_short,
2,
_floor_mapping_16,
_mapres_template_16_stereo
......@@ -121,7 +121,7 @@ static const ve_setup_data_template ve_setup_22_uncoupled={
_floor_books,
_floor,
_floor_mapping_16_short,
2,
_floor_mapping_16,
_mapres_template_16_uncoupled
......
......@@ -74,8 +74,8 @@ static const ve_setup_data_template ve_setup_32_stereo={
_floor_books,
_floor,
_floor_short_mapping_44,
_floor_long_mapping_44,
2,
_floor_mapping_44,
_mapres_template_44_stereo
};
......@@ -125,8 +125,8 @@ static const ve_setup_data_template ve_setup_32_uncoupled={
_floor_books,
_floor,
_floor_short_mapping_44,
_floor_long_mapping_44,
2,
_floor_mapping_44,
_mapres_template_44_uncoupled
};
......@@ -47,13 +47,19 @@ static const double _global_mapping_44[12]={
0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
};
static const int _floor_short_mapping_44[11]={
static const int _floor_mapping_44a[11]={
1,0,0,2,2,4,5,5,5,5,5
};
static const int _floor_long_mapping_44[11]={
static const int _floor_mapping_44b[11]={
8,7,7,7,7,7,7,7,7,7,7
};
static const int *_floor_mapping_44[]={
_floor_mapping_44a,
_floor_mapping_44b,
};
static const ve_setup_data_template ve_setup_44_stereo={
11,
rate_mapping_44_stereo,
......@@ -99,8 +105,8 @@ static const ve_setup_data_template ve_setup_44_stereo={
_floor_books,
_floor,
_floor_short_mapping_44,
_floor_long_mapping_44,
2,
_floor_mapping_44,
_mapres_template_44_stereo
};
......@@ -67,8 +67,8 @@ static const ve_setup_data_template ve_setup_44_uncoupled={
_floor_books,
_floor,
_floor_short_mapping_44,
_floor_long_mapping_44,
2,
_floor_mapping_44,
_mapres_template_44_uncoupled
};
......@@ -22,8 +22,12 @@ static const int blocksize_8[2]={
512,512
};
static const int _floor_mapping_8[2]={
6,6,
static const int _floor_mapping_8a[]={
6,6
};
static const int *_floor_mapping_8[]={
_floor_mapping_8a
};
static const double rate_mapping_8[3]={
......@@ -87,8 +91,8 @@ static const ve_setup_data_template ve_setup_8_stereo={
_floor_books,
_floor,
1,
_floor_mapping_8,
NULL,
_mapres_template_8_stereo
};
......@@ -138,8 +142,8 @@ static const ve_setup_data_template ve_setup_8_uncoupled={
_floor_books,
_floor,
1,
_floor_mapping_8,
NULL,
_mapres_template_8_uncoupled
};
......@@ -65,8 +65,8 @@ static const ve_setup_data_template ve_setup_X_stereo={
_floor_books,
_floor,
_floor_short_mapping_44,
_floor_long_mapping_44,
2,
_floor_mapping_44,
_mapres_template_44_stereo
};
......@@ -116,8 +116,8 @@ static const ve_setup_data_template ve_setup_X_uncoupled={
_floor_books,
_floor,
_floor_short_mapping_44,
_floor_long_mapping_44,
2,
_floor_mapping_44,
_mapres_template_44_uncoupled
};
......@@ -167,8 +167,8 @@ static const ve_setup_data_template ve_setup_XX_stereo={
_floor_books,
_floor,
1,
_floor_mapping_8,
NULL,
_mapres_template_8_stereo
};
......@@ -218,8 +218,8 @@ static const ve_setup_data_template ve_setup_XX_uncoupled={
_floor_books,
_floor,
1,
_floor_mapping_8,
NULL,
_mapres_template_8_uncoupled
};
......@@ -931,7 +931,7 @@ static void couple_lossless(float A, float B,
int test1=fabs(*qA)>fabs(*qB);
test1-= fabs(*qA)<fabs(*qB);
if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
//if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
if(test1==1){
*qB=(*qA>0.f?*qA-*qB:*qB-*qA);
}else{
......@@ -1148,7 +1148,6 @@ void _vp_couple(int blobno,
if(nonzero[vi->coupling_mag[i]] ||
nonzero[vi->coupling_ang[i]]){
float *rM=res[vi->coupling_mag[i]];
float *rA=res[vi->coupling_ang[i]];
float *qM=rM+n;
......@@ -1159,7 +1158,6 @@ void _vp_couple(int blobno,
float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
int pointlimit=limit;
nonzero[vi->coupling_mag[i]]=1;
nonzero[vi->coupling_ang[i]]=1;
......@@ -1178,7 +1176,6 @@ void _vp_couple(int blobno,
if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
(fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){
precomputed_couple_point(mag_memo[i][l],
floorM[l],floorA[l],
qM+l,qA+l);
......@@ -1196,7 +1193,7 @@ void _vp_couple(int blobno,
if(p->vi->normal_point_p){
for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
int l=mag_sort[i][j+k];
if(l<sliding_lowpass && l>=pointlimit && rint(qM[l])==0.f){
if(l<sliding_lowpass && l>=limit && rint(qM[l])==0.f){
qM[l]=unitnorm(qM[l]);
acc-=1.f;
}
......
......@@ -134,8 +134,8 @@ typedef struct {
const static_codebook *const *const *const floor_books;
const vorbis_info_floor1 *floor_params;
const int *floor_short_mapping;
const int *floor_long_mapping;
const int floor_mappings;
const int **floor_mapping_list;
const vorbis_mapping_template *maps;
} ve_setup_data_template;
......@@ -196,7 +196,7 @@ static int vorbis_encode_toplevel_setup(vorbis_info *vi,int ch,long rate){
return(OV_EINVAL);
}
static void vorbis_encode_floor_setup(vorbis_info *vi,double s,int block,
static void vorbis_encode_floor_setup(vorbis_info *vi,int s,
const static_codebook *const *const *const books,
const vorbis_info_floor1 *in,
const int *x){
......@@ -205,8 +205,6 @@ static void vorbis_encode_floor_setup(vorbis_info *vi,double s,int block,
codec_setup_info *ci=vi->codec_setup;
memcpy(f,in+x[is],sizeof(*f));
/* fill in the lowpass field, even if it's temporary */
f->n=ci->blocksizes[block]>>1;
/* books */
{
......@@ -554,12 +552,20 @@ static void vorbis_encode_residue_setup(vorbis_info *vi,
/* this res may by limited by the maximum pointlimit of the mode,
not the lowpass. the floor is always lowpass limited. */
if(res->limit_type){
switch(res->limit_type){
case 1: /* point stereo limited */
if(ci->hi.managed)
freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS-1]*1000.;
else
freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS/2]*1000.;
if(freq>nyq)freq=nyq;
break;
case 2: /* LFE channel; lowpass at ~ 250Hz */
freq=250;
break;
default:
/* already set */
break;
}
/* in the residue, we're constrained, physically, by partition
......@@ -572,6 +578,7 @@ static void vorbis_encode_residue_setup(vorbis_info *vi,
else
r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */
r->grouping;
if(r->end==0)r->end=r->grouping; /* LFE channel */
}
}
......@@ -672,7 +679,7 @@ static void get_setup_template(vorbis_info *vi,
/* the final setup call */
int vorbis_encode_setup_init(vorbis_info *vi){
int i0=0,singleblock=0;
int i,i0=0,singleblock=0;
codec_setup_info *ci=vi->codec_setup;
ve_setup_data_template *setup=NULL;
highlevel_encode_setup *hi=&ci->hi;
......@@ -705,16 +712,12 @@ int vorbis_encode_setup_init(vorbis_info *vi){
if(ci->blocksizes[0]==ci->blocksizes[1])singleblock=1;
/* floor setup; choose proper floor params. Allocated on the floor
stack in order; if we alloc only long floor, it's 0 */
vorbis_encode_floor_setup(vi,hi->short_setting,0,
setup->floor_books,
setup->floor_params,
setup->floor_short_mapping);
if(!singleblock)
vorbis_encode_floor_setup(vi,hi->long_setting,1,
stack in order; if we alloc only a single long floor, it's 0 */
for(i=0;i<setup->floor_mappings;i++)
vorbis_encode_floor_setup(vi,hi->base_setting,
setup->floor_books,
setup->floor_params,
setup->floor_long_mapping);
setup->floor_mapping_list[i]);
/* setup of [mostly] short block detection and stereo*/
vorbis_encode_global_psych_setup(vi,hi->trigger_setting,
......@@ -723,23 +726,23 @@ int vorbis_encode_setup_init(vorbis_info *vi){
vorbis_encode_global_stereo(vi,hi,setup->stereo_modes);
/* basic psych setup and noise normalization */
vorbis_encode_psyset_setup(vi,hi->short_setting,
vorbis_encode_psyset_setup(vi,hi->base_setting,
setup->psy_noise_normal_start[0],
setup->psy_noise_normal_partition[0],
setup->psy_noise_normal_thresh,
0);
vorbis_encode_psyset_setup(vi,hi->short_setting,
vorbis_encode_psyset_setup(vi,hi->base_setting,
setup->psy_noise_normal_start[0],
setup->psy_noise_normal_partition[0],
setup->psy_noise_normal_thresh,
1);
if(!singleblock){
vorbis_encode_psyset_setup(vi,hi->long_setting,
vorbis_encode_psyset_setup(vi,hi->base_setting,
setup->psy_noise_normal_start[1],
setup->psy_noise_normal_partition[1],
setup->psy_noise_normal_thresh,
2);
vorbis_encode_psyset_setup(vi,hi->long_setting,
vorbis_encode_psyset_setup(vi,hi->base_setting,
setup->psy_noise_normal_start[1],
setup->psy_noise_normal_partition[1],
setup->psy_noise_normal_thresh,
......@@ -870,9 +873,6 @@ static int vorbis_encode_setup_setting(vorbis_info *vi,
is=hi->base_setting;
ds=hi->base_setting-is;
hi->short_setting=hi->base_setting;
hi->long_setting=hi->base_setting;
hi->managed=0;
hi->impulse_block_p=1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment