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
35780760
Commit
35780760
authored
14 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Separates stereo_band_mix() into the intensity and MS stereo cases
parent
90e7fdd7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcelt/bands.c
+25
-19
25 additions, 19 deletions
libcelt/bands.c
with
25 additions
and
19 deletions
libcelt/bands.c
+
25
−
19
View file @
35780760
...
...
@@ -212,35 +212,41 @@ void denormalise_bands(const CELTMode *m, const celt_norm * restrict X, celt_sig
}
}
static
void
stereo_band_mix
(
const
CELTMode
*
m
,
celt_norm
*
X
,
celt_norm
*
Y
,
const
celt_ener
*
bank
,
int
stereo_mode
,
int
bandID
,
int
dir
,
int
N
)
static
void
intensity_stereo
(
const
CELTMode
*
m
,
celt_norm
*
X
,
celt_norm
*
Y
,
const
celt_ener
*
bank
,
int
bandID
,
int
N
)
{
int
i
=
bandID
;
int
j
;
celt_word16
a1
,
a2
;
if
(
stereo_mode
==
0
)
{
/* Do mid-side when not doing intensity stereo */
a1
=
QCONST16
(.
70711
f
,
14
);
a2
=
dir
*
QCONST16
(.
70711
f
,
14
);
}
else
{
celt_word16
left
,
right
;
celt_word16
norm
;
celt_word16
left
,
right
;
celt_word16
norm
;
#ifdef FIXED_POINT
int
shift
=
celt_zlog2
(
MAX32
(
bank
[
i
],
bank
[
i
+
m
->
nbEBands
]))
-
13
;
int
shift
=
celt_zlog2
(
MAX32
(
bank
[
i
],
bank
[
i
+
m
->
nbEBands
]))
-
13
;
#endif
left
=
VSHR32
(
bank
[
i
],
shift
);
right
=
VSHR32
(
bank
[
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
=
dir
*
DIV32_16
(
SHL32
(
EXTEND32
(
right
),
14
),
norm
);
}
left
=
VSHR32
(
bank
[
i
],
shift
);
right
=
VSHR32
(
bank
[
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
);
for
(
j
=
0
;
j
<
N
;
j
++
)
{
celt_norm
r
,
l
;
l
=
X
[
j
];
r
=
Y
[
j
];
X
[
j
]
=
MULT16_16_Q14
(
a1
,
l
)
+
MULT16_16_Q14
(
a2
,
r
);
Y
[
j
]
=
MULT16_16_Q14
(
a1
,
r
)
-
MULT16_16_Q14
(
a2
,
l
);
/* Side is not encoded, no need to calculate */
}
}
static
void
stereo_split
(
celt_norm
*
X
,
celt_norm
*
Y
,
int
N
)
{
int
j
;
for
(
j
=
0
;
j
<
N
;
j
++
)
{
celt_norm
r
,
l
;
l
=
MULT16_16_Q15
(
QCONST16
(.
70711
f
,
15
),
X
[
j
]);
r
=
MULT16_16_Q15
(
QCONST16
(.
70711
f
,
15
),
Y
[
j
]);
X
[
j
]
=
l
+
r
;
Y
[
j
]
=
r
-
l
;
}
}
...
...
@@ -602,7 +608,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
if
(
encode
)
{
if
(
stereo
)
stereo_
band_mix
(
m
,
X
,
Y
,
bandE
,
0
,
i
,
1
,
N
);
stereo_
split
(
X
,
Y
,
N
);
mid
=
vector_norm
(
X
,
N
);
side
=
vector_norm
(
Y
,
N
);
...
...
@@ -672,7 +678,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
itheta
=
(
celt_int32
)
itheta
*
16384
/
qn
;
}
else
{
if
(
stereo
&&
encode
)
stereo_band_mix
(
m
,
X
,
Y
,
bandE
,
1
,
i
,
1
,
N
);
intensity_stereo
(
m
,
X
,
Y
,
bandE
,
i
,
N
);
}
if
(
itheta
==
0
)
...
...
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