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
Container Registry
Model registry
Operate
Environments
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
Xiph.Org
Opus
Commits
6c24524b
Commit
6c24524b
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Added a DCT in time direction when multiple MDCTs are used within the same
frame.
parent
46014ca4
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/celt.c
+47
-23
47 additions, 23 deletions
libcelt/celt.c
with
47 additions
and
23 deletions
libcelt/celt.c
+
47
−
23
View file @
6c24524b
...
...
@@ -130,30 +130,48 @@ void celt_encoder_destroy(CELTEncoder *st)
celt_free
(
st
);
}
static
void
haar1
(
float
*
X
,
int
N
)
static
void
haar1
(
float
*
X
,
int
N
,
int
stride
)
{
int
i
;
for
(
i
=
0
;
i
<
N
;
i
+=
2
)
int
i
,
k
;
for
(
k
=
0
;
k
<
stride
;
k
++
)
{
float
a
,
b
;
a
=
X
[
i
];
b
=
X
[
i
+
1
];
X
[
i
]
=
.
707107
f
*
(
a
+
b
);
X
[
i
+
1
]
=
.
707107
f
*
(
a
-
b
);
for
(
i
=
k
;
i
<
N
*
stride
;
i
+=
2
*
stride
)
{
float
a
,
b
;
a
=
X
[
i
];
b
=
X
[
i
+
stride
];
X
[
i
]
=
.
707107
f
*
(
a
+
b
);
X
[
i
+
stride
]
=
.
707107
f
*
(
a
-
b
);
}
}
}
static
void
inv_haar1
(
float
*
X
,
int
N
)
static
void
time_dct
(
float
*
X
,
int
N
,
int
B
,
int
stride
)
{
int
i
;
for
(
i
=
0
;
i
<
N
;
i
+=
2
)
switch
(
B
)
{
float
a
,
b
;
a
=
X
[
i
];
b
=
X
[
i
+
1
];
X
[
i
]
=
.
707107
f
*
(
a
+
b
);
X
[
i
+
1
]
=
.
707107
f
*
(
a
-
b
);
}
case
1
:
break
;
case
2
:
haar1
(
X
,
B
*
N
,
stride
);
break
;
default:
celt_warning
(
"time_dct not defined for B > 2"
);
};
}
static
void
time_idct
(
float
*
X
,
int
N
,
int
B
,
int
stride
)
{
switch
(
B
)
{
case
1
:
break
;
case
2
:
haar1
(
X
,
B
*
N
,
stride
);
break
;
default:
celt_warning
(
"time_dct not defined for B > 2"
);
};
}
static
void
compute_mdcts
(
mdct_lookup
*
mdct_lookup
,
float
*
window
,
float
*
in
,
float
*
out
,
int
N
,
int
B
,
int
C
)
...
...
@@ -260,10 +278,13 @@ int celt_encode(CELTEncoder *st, short *pcm)
printf ("\n");*/
if
(
C
==
2
)
{
haar1
(
X
,
B
*
N
);
haar1
(
P
,
B
*
N
);
haar1
(
X
,
B
*
N
*
C
,
1
);
haar1
(
P
,
B
*
N
*
C
,
1
);
}
time_dct
(
X
,
N
,
B
,
C
);
time_dct
(
P
,
N
,
B
,
C
);
/* Band normalisation */
compute_band_energies
(
st
->
mode
,
X
,
bandE
);
normalise_bands
(
st
->
mode
,
X
,
bandE
);
...
...
@@ -312,9 +333,10 @@ int celt_encode(CELTEncoder *st, short *pcm)
/* Synthesis */
denormalise_bands
(
st
->
mode
,
X
,
bandE
);
time_idct
(
X
,
N
,
B
,
C
);
if
(
C
==
2
)
inv_
haar1
(
X
,
B
*
N
);
haar1
(
X
,
B
*
N
*
C
,
1
);
CELT_MOVE
(
st
->
out_mem
,
st
->
out_mem
+
C
*
B
*
N
,
C
*
(
MAX_PERIOD
-
B
*
N
));
/* Compute inverse MDCTs */
compute_inv_mdcts
(
&
st
->
mdct_lookup
,
st
->
window
,
X
,
st
->
out_mem
,
st
->
mdct_overlap
,
N
,
B
,
C
);
...
...
@@ -502,7 +524,8 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
compute_mdcts
(
&
st
->
mdct_lookup
,
st
->
window
,
st
->
out_mem
+
pitch_index
*
C
,
P
,
N
,
B
,
C
);
if
(
C
==
2
)
haar1
(
P
,
B
*
N
);
haar1
(
P
,
B
*
N
*
C
,
1
);
time_dct
(
P
,
N
,
B
,
C
);
{
float
bandEp
[
st
->
mode
->
nbEBands
];
...
...
@@ -525,8 +548,9 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
/* Synthesis */
denormalise_bands
(
st
->
mode
,
X
,
bandE
);
time_idct
(
X
,
N
,
B
,
C
);
if
(
C
==
2
)
inv_
haar1
(
X
,
B
*
N
);
haar1
(
X
,
B
*
N
*
C
,
1
);
CELT_MOVE
(
st
->
out_mem
,
st
->
out_mem
+
C
*
B
*
N
,
C
*
(
MAX_PERIOD
-
B
*
N
));
/* Compute inverse MDCTs */
...
...
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