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
1c80f649
Commit
1c80f649
authored
13 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
All variables named "bank" renamed to "bandE" to avoid problems on SHARC
SHARK compiler treaks "bank" as a reserved keyword -- go figure.
parent
120800f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
celt/bands.c
+18
-18
18 additions, 18 deletions
celt/bands.c
celt/bands.h
+4
-4
4 additions, 4 deletions
celt/bands.h
with
22 additions
and
22 deletions
celt/bands.c
+
18
−
18
View file @
1c80f649
...
...
@@ -75,7 +75,7 @@ static int bitexact_log2tan(int isin,int icos)
#ifdef FIXED_POINT
/* Compute the amplitude (sqrt energy) in each of the bands */
void
compute_band_energies
(
const
CELTMode
*
m
,
const
celt_sig
*
X
,
celt_ener
*
ban
k
,
int
end
,
int
C
,
int
M
)
void
compute_band_energies
(
const
CELTMode
*
m
,
const
celt_sig
*
X
,
celt_ener
*
ban
dE
,
int
end
,
int
C
,
int
M
)
{
int
i
,
c
,
N
;
const
opus_int16
*
eBands
=
m
->
eBands
;
...
...
@@ -101,18 +101,18 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank
}
while
(
++
j
<
M
*
eBands
[
i
+
1
]);
/* We're adding one here to make damn sure we never end up with a pitch vector that's
larger than unity norm */
ban
k
[
i
+
c
*
m
->
nbEBands
]
=
EPSILON
+
VSHR32
(
EXTEND32
(
celt_sqrt
(
sum
)),
-
shift
);
ban
dE
[
i
+
c
*
m
->
nbEBands
]
=
EPSILON
+
VSHR32
(
EXTEND32
(
celt_sqrt
(
sum
)),
-
shift
);
}
else
{
ban
k
[
i
+
c
*
m
->
nbEBands
]
=
EPSILON
;
ban
dE
[
i
+
c
*
m
->
nbEBands
]
=
EPSILON
;
}
/*printf ("%f ", ban
k
[i+c*m->nbEBands]);*/
/*printf ("%f ", ban
dE
[i+c*m->nbEBands]);*/
}
}
while
(
++
c
<
C
);
/*printf ("\n");*/
}
/* Normalise each band such that the energy is one. */
void
normalise_bands
(
const
CELTMode
*
m
,
const
celt_sig
*
restrict
freq
,
celt_norm
*
restrict
X
,
const
celt_ener
*
ban
k
,
int
end
,
int
C
,
int
M
)
void
normalise_bands
(
const
CELTMode
*
m
,
const
celt_sig
*
restrict
freq
,
celt_norm
*
restrict
X
,
const
celt_ener
*
ban
dE
,
int
end
,
int
C
,
int
M
)
{
int
i
,
c
,
N
;
const
opus_int16
*
eBands
=
m
->
eBands
;
...
...
@@ -122,8 +122,8 @@ void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_nor
opus_val16
g
;
int
j
,
shift
;
opus_val16
E
;
shift
=
celt_zlog2
(
ban
k
[
i
+
c
*
m
->
nbEBands
])
-
13
;
E
=
VSHR32
(
ban
k
[
i
+
c
*
m
->
nbEBands
],
shift
);
shift
=
celt_zlog2
(
ban
dE
[
i
+
c
*
m
->
nbEBands
])
-
13
;
E
=
VSHR32
(
ban
dE
[
i
+
c
*
m
->
nbEBands
],
shift
);
g
=
EXTRACT16
(
celt_rcp
(
SHL32
(
E
,
3
)));
j
=
M
*
eBands
[
i
];
do
{
X
[
j
+
c
*
N
]
=
MULT16_16_Q15
(
VSHR32
(
freq
[
j
+
c
*
N
],
shift
-
1
),
g
);
...
...
@@ -134,7 +134,7 @@ void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_nor
#else
/* FIXED_POINT */
/* Compute the amplitude (sqrt energy) in each of the bands */
void
compute_band_energies
(
const
CELTMode
*
m
,
const
celt_sig
*
X
,
celt_ener
*
ban
k
,
int
end
,
int
C
,
int
M
)
void
compute_band_energies
(
const
CELTMode
*
m
,
const
celt_sig
*
X
,
celt_ener
*
ban
dE
,
int
end
,
int
C
,
int
M
)
{
int
i
,
c
,
N
;
const
opus_int16
*
eBands
=
m
->
eBands
;
...
...
@@ -146,15 +146,15 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank
opus_val32
sum
=
1e-27
f
;
for
(
j
=
M
*
eBands
[
i
];
j
<
M
*
eBands
[
i
+
1
];
j
++
)
sum
+=
X
[
j
+
c
*
N
]
*
X
[
j
+
c
*
N
];
ban
k
[
i
+
c
*
m
->
nbEBands
]
=
celt_sqrt
(
sum
);
/*printf ("%f ", ban
k
[i+c*m->nbEBands]);*/
ban
dE
[
i
+
c
*
m
->
nbEBands
]
=
celt_sqrt
(
sum
);
/*printf ("%f ", ban
dE
[i+c*m->nbEBands]);*/
}
}
while
(
++
c
<
C
);
/*printf ("\n");*/
}
/* Normalise each band such that the energy is one. */
void
normalise_bands
(
const
CELTMode
*
m
,
const
celt_sig
*
restrict
freq
,
celt_norm
*
restrict
X
,
const
celt_ener
*
ban
k
,
int
end
,
int
C
,
int
M
)
void
normalise_bands
(
const
CELTMode
*
m
,
const
celt_sig
*
restrict
freq
,
celt_norm
*
restrict
X
,
const
celt_ener
*
ban
dE
,
int
end
,
int
C
,
int
M
)
{
int
i
,
c
,
N
;
const
opus_int16
*
eBands
=
m
->
eBands
;
...
...
@@ -163,7 +163,7 @@ void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_nor
for
(
i
=
0
;
i
<
end
;
i
++
)
{
int
j
;
opus_val16
g
=
1
.
f
/
(
1e-27
f
+
ban
k
[
i
+
c
*
m
->
nbEBands
]);
opus_val16
g
=
1
.
f
/
(
1e-27
f
+
ban
dE
[
i
+
c
*
m
->
nbEBands
]);
for
(
j
=
M
*
eBands
[
i
];
j
<
M
*
eBands
[
i
+
1
];
j
++
)
X
[
j
+
c
*
N
]
=
freq
[
j
+
c
*
N
]
*
g
;
}
...
...
@@ -173,7 +173,7 @@ void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_nor
#endif
/* FIXED_POINT */
/* De-normalise the energy to produce the synthesis from the unit-energy bands */
void
denormalise_bands
(
const
CELTMode
*
m
,
const
celt_norm
*
restrict
X
,
celt_sig
*
restrict
freq
,
const
celt_ener
*
ban
k
,
int
end
,
int
C
,
int
M
)
void
denormalise_bands
(
const
CELTMode
*
m
,
const
celt_norm
*
restrict
X
,
celt_sig
*
restrict
freq
,
const
celt_ener
*
ban
dE
,
int
end
,
int
C
,
int
M
)
{
int
i
,
c
,
N
;
const
opus_int16
*
eBands
=
m
->
eBands
;
...
...
@@ -187,7 +187,7 @@ void denormalise_bands(const CELTMode *m, const celt_norm * restrict X, celt_sig
for
(
i
=
0
;
i
<
end
;
i
++
)
{
int
j
,
band_end
;
opus_val32
g
=
SHR32
(
ban
k
[
i
+
c
*
m
->
nbEBands
],
1
);
opus_val32
g
=
SHR32
(
ban
dE
[
i
+
c
*
m
->
nbEBands
],
1
);
j
=
M
*
eBands
[
i
];
band_end
=
M
*
eBands
[
i
+
1
];
do
{
...
...
@@ -291,7 +291,7 @@ void anti_collapse(const CELTMode *m, celt_norm *X_, unsigned char *collapse_mas
}
}
static
void
intensity_stereo
(
const
CELTMode
*
m
,
celt_norm
*
X
,
celt_norm
*
Y
,
const
celt_ener
*
ban
k
,
int
bandID
,
int
N
)
static
void
intensity_stereo
(
const
CELTMode
*
m
,
celt_norm
*
X
,
celt_norm
*
Y
,
const
celt_ener
*
ban
dE
,
int
bandID
,
int
N
)
{
int
i
=
bandID
;
int
j
;
...
...
@@ -299,10 +299,10 @@ static void intensity_stereo(const CELTMode *m, celt_norm *X, celt_norm *Y, cons
opus_val16
left
,
right
;
opus_val16
norm
;
#ifdef FIXED_POINT
int
shift
=
celt_zlog2
(
MAX32
(
ban
k
[
i
],
ban
k
[
i
+
m
->
nbEBands
]))
-
13
;
int
shift
=
celt_zlog2
(
MAX32
(
ban
dE
[
i
],
ban
dE
[
i
+
m
->
nbEBands
]))
-
13
;
#endif
left
=
VSHR32
(
ban
k
[
i
],
shift
);
right
=
VSHR32
(
ban
k
[
i
+
m
->
nbEBands
],
shift
);
left
=
VSHR32
(
ban
dE
[
i
],
shift
);
right
=
VSHR32
(
ban
dE
[
i
+
m
->
nbEBands
],
shift
);
norm
=
EPSILON
+
celt_sqrt
(
EPSILON
+
MULT16_16
(
left
,
left
)
+
MULT16_16
(
right
,
right
));
a1
=
DIV32_16
(
SHL32
(
EXTEND32
(
left
),
14
),
norm
);
a2
=
DIV32_16
(
SHL32
(
EXTEND32
(
right
),
14
),
norm
);
...
...
This diff is collapsed.
Click to expand it.
celt/bands.h
+
4
−
4
View file @
1c80f649
...
...
@@ -41,9 +41,9 @@
* @param X Spectrum
* @param bands Square root of the energy for each band (returned)
*/
void
compute_band_energies
(
const
CELTMode
*
m
,
const
celt_sig
*
X
,
celt_ener
*
band
s
,
int
end
,
int
C
,
int
M
);
void
compute_band_energies
(
const
CELTMode
*
m
,
const
celt_sig
*
X
,
celt_ener
*
band
E
,
int
end
,
int
C
,
int
M
);
/*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const opus_val16 *tonality, celt_ener *ban
k
);*/
/*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const opus_val16 *tonality, celt_ener *ban
dE
);*/
/** Normalise each band of X such that the energy in each band is
equal to 1
...
...
@@ -51,14 +51,14 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *band
* @param X Spectrum (returned normalised)
* @param bands Square root of the energy for each band
*/
void
normalise_bands
(
const
CELTMode
*
m
,
const
celt_sig
*
restrict
freq
,
celt_norm
*
restrict
X
,
const
celt_ener
*
band
s
,
int
end
,
int
C
,
int
M
);
void
normalise_bands
(
const
CELTMode
*
m
,
const
celt_sig
*
restrict
freq
,
celt_norm
*
restrict
X
,
const
celt_ener
*
band
E
,
int
end
,
int
C
,
int
M
);
/** Denormalise each band of X to restore full amplitude
* @param m Mode data
* @param X Spectrum (returned de-normalised)
* @param bands Square root of the energy for each band
*/
void
denormalise_bands
(
const
CELTMode
*
m
,
const
celt_norm
*
restrict
X
,
celt_sig
*
restrict
freq
,
const
celt_ener
*
band
s
,
int
end
,
int
C
,
int
M
);
void
denormalise_bands
(
const
CELTMode
*
m
,
const
celt_norm
*
restrict
X
,
celt_sig
*
restrict
freq
,
const
celt_ener
*
band
E
,
int
end
,
int
C
,
int
M
);
#define SPREAD_NONE (0)
#define SPREAD_LIGHT (1)
...
...
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