Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Traud
Opus
Commits
45018cbf
Commit
45018cbf
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Doing stereo mixing adaptively based on amplitude difference.
parent
a2482ace
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libcelt/bands.c
+29
-0
29 additions, 0 deletions
libcelt/bands.c
libcelt/bands.h
+2
-0
2 additions, 0 deletions
libcelt/bands.h
libcelt/celt.c
+15
-6
15 additions, 6 deletions
libcelt/celt.c
with
46 additions
and
6 deletions
libcelt/bands.c
+
29
−
0
View file @
45018cbf
...
@@ -298,3 +298,32 @@ void unquant_bands(const CELTMode *m, float *X, float *P, ec_dec *dec)
...
@@ -298,3 +298,32 @@ void unquant_bands(const CELTMode *m, float *X, float *P, ec_dec *dec)
for
(
i
=
B
*
eBands
[
m
->
nbEBands
];
i
<
B
*
eBands
[
m
->
nbEBands
+
1
];
i
++
)
for
(
i
=
B
*
eBands
[
m
->
nbEBands
];
i
<
B
*
eBands
[
m
->
nbEBands
+
1
];
i
++
)
X
[
i
]
=
0
;
X
[
i
]
=
0
;
}
}
void
stereo_mix
(
const
CELTMode
*
m
,
float
*
X
,
float
*
bank
,
int
dir
)
{
int
i
,
B
,
C
;
const
int
*
eBands
=
m
->
eBands
;
B
=
m
->
nbMdctBlocks
;
C
=
m
->
nbChannels
;
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
int
j
;
float
left
,
right
;
float
a1
,
a2
;
left
=
bank
[
i
*
C
];
right
=
bank
[
i
*
C
+
1
];
a1
=
left
/
sqrt
(.
01
+
left
*
left
+
right
*
right
);
a2
=
dir
*
right
/
sqrt
(.
01
+
left
*
left
+
right
*
right
);
for
(
j
=
B
*
eBands
[
i
];
j
<
B
*
eBands
[
i
+
1
];
j
++
)
{
float
r
,
l
;
l
=
X
[
j
*
C
];
r
=
X
[
j
*
C
+
1
];
X
[
j
*
C
]
=
a1
*
l
+
a2
*
r
;
X
[
j
*
C
+
1
]
=
a1
*
r
-
a2
*
l
;
}
}
for
(
i
=
B
*
C
*
eBands
[
m
->
nbEBands
];
i
<
B
*
C
*
eBands
[
m
->
nbEBands
+
1
];
i
++
)
X
[
i
]
=
0
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
libcelt/bands.h
+
2
−
0
View file @
45018cbf
...
@@ -89,4 +89,6 @@ void quant_bands(const CELTMode *m, float *X, float *P, float *W, ec_enc *enc);
...
@@ -89,4 +89,6 @@ void quant_bands(const CELTMode *m, float *X, float *P, float *W, ec_enc *enc);
*/
*/
void
unquant_bands
(
const
CELTMode
*
m
,
float
*
X
,
float
*
P
,
ec_dec
*
dec
);
void
unquant_bands
(
const
CELTMode
*
m
,
float
*
X
,
float
*
P
,
ec_dec
*
dec
);
void
stereo_mix
(
const
CELTMode
*
m
,
float
*
X
,
float
*
bank
,
int
dir
);
#endif
/* BANDS_H */
#endif
/* BANDS_H */
This diff is collapsed.
Click to expand it.
libcelt/celt.c
+
15
−
6
View file @
45018cbf
...
@@ -309,16 +309,22 @@ int celt_encode(CELTEncoder *st, short *pcm)
...
@@ -309,16 +309,22 @@ int celt_encode(CELTEncoder *st, short *pcm)
normalise_bands
(
st
->
mode
,
P
,
bandEp
);
normalise_bands
(
st
->
mode
,
P
,
bandEp
);
}
}
quant_energy
(
st
->
mode
,
bandE
,
st
->
oldBandE
,
&
st
->
enc
);
if
(
C
==
2
)
if
(
C
==
2
)
{
{
haar1
(
X
,
B
*
N
*
C
,
1
);
stereo_mix
(
st
->
mode
,
X
,
bandE
,
1
);
haar1
(
P
,
B
*
N
*
C
,
1
);
stereo_mix
(
st
->
mode
,
P
,
bandE
,
1
);
//haar1(X, B*N*C, 1);
//haar1(P, B*N*C, 1);
}
}
/* Simulates intensity stereo */
//for (i=30;i<N*B;i++)
// X[i*C+1] = P[i*C+1] = 0;
/* Get a tiny bit more frequency resolution and prevent unstable energy when quantising */
/* Get a tiny bit more frequency resolution and prevent unstable energy when quantising */
time_dct
(
X
,
N
,
B
,
C
);
time_dct
(
X
,
N
,
B
,
C
);
time_dct
(
P
,
N
,
B
,
C
);
time_dct
(
P
,
N
,
B
,
C
);
quant_energy
(
st
->
mode
,
bandE
,
st
->
oldBandE
,
&
st
->
enc
);
/* Pitch prediction */
/* Pitch prediction */
compute_pitch_gain
(
st
->
mode
,
X
,
P
,
gains
,
bandE
);
compute_pitch_gain
(
st
->
mode
,
X
,
P
,
gains
,
bandE
);
...
@@ -339,7 +345,8 @@ int celt_encode(CELTEncoder *st, short *pcm)
...
@@ -339,7 +345,8 @@ int celt_encode(CELTEncoder *st, short *pcm)
time_idct
(
X
,
N
,
B
,
C
);
time_idct
(
X
,
N
,
B
,
C
);
if
(
C
==
2
)
if
(
C
==
2
)
haar1
(
X
,
B
*
N
*
C
,
1
);
//haar1(X, B*N*C, 1);
stereo_mix
(
st
->
mode
,
X
,
bandE
,
-
1
);
renormalise_bands
(
st
->
mode
,
X
);
renormalise_bands
(
st
->
mode
,
X
);
/* Synthesis */
/* Synthesis */
...
@@ -549,7 +556,8 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
...
@@ -549,7 +556,8 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
}
}
if
(
C
==
2
)
if
(
C
==
2
)
haar1
(
P
,
B
*
N
*
C
,
1
);
//haar1(P, B*N*C, 1);
stereo_mix
(
st
->
mode
,
P
,
bandE
,
1
);
time_dct
(
P
,
N
,
B
,
C
);
time_dct
(
P
,
N
,
B
,
C
);
/* Get the pitch gains */
/* Get the pitch gains */
...
@@ -563,7 +571,8 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
...
@@ -563,7 +571,8 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
time_idct
(
X
,
N
,
B
,
C
);
time_idct
(
X
,
N
,
B
,
C
);
if
(
C
==
2
)
if
(
C
==
2
)
haar1
(
X
,
B
*
N
*
C
,
1
);
//haar1(X, B*N*C, 1);
stereo_mix
(
st
->
mode
,
X
,
bandE
,
-
1
);
renormalise_bands
(
st
->
mode
,
X
);
renormalise_bands
(
st
->
mode
,
X
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment