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
dff9b7eb
Commit
dff9b7eb
authored
16 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Another bunch of do-while() loops
parent
d7291d24
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
libcelt/bands.c
+14
-6
14 additions, 6 deletions
libcelt/bands.c
libcelt/vq.c
+2
-3
2 additions, 3 deletions
libcelt/vq.c
with
16 additions
and
9 deletions
libcelt/bands.c
+
14
−
6
View file @
dff9b7eb
...
...
@@ -93,13 +93,19 @@ void compute_band_energies(const CELTMode *m, const celt_sig_t *X, celt_ener_t *
int
j
;
celt_word32_t
maxval
=
0
;
celt_word32_t
sum
=
0
;
for
(
j
=
eBands
[
i
];
j
<
eBands
[
i
+
1
];
j
++
)
maxval
=
MAX32
(
maxval
,
ABS32
(
X
[
j
*
C
+
c
]));
j
=
eBands
[
i
];
do
{
maxval
=
MAX32
(
maxval
,
X
[
j
*
C
+
c
]);
maxval
=
MAX32
(
maxval
,
-
X
[
j
*
C
+
c
]);
}
while
(
++
j
<
eBands
[
i
+
1
]);
if
(
maxval
>
0
)
{
int
shift
=
celt_ilog2
(
maxval
)
-
10
;
for
(
j
=
eBands
[
i
];
j
<
eBands
[
i
+
1
];
j
++
)
sum
+=
MULT16_16
(
EXTRACT16
(
VSHR32
(
X
[
j
*
C
+
c
],
shift
)),
EXTRACT16
(
VSHR32
(
X
[
j
*
C
+
c
],
shift
)));
j
=
eBands
[
i
];
do
{
sum
+=
MULT16_16
(
EXTRACT16
(
VSHR32
(
X
[
j
*
C
+
c
],
shift
)),
EXTRACT16
(
VSHR32
(
X
[
j
*
C
+
c
],
shift
)));
}
while
(
++
j
<
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 */
bank
[
i
*
C
+
c
]
=
EPSILON
+
VSHR32
(
EXTEND32
(
celt_sqrt
(
sum
)),
-
shift
);
...
...
@@ -127,8 +133,9 @@ void normalise_bands(const CELTMode *m, const celt_sig_t * restrict freq, celt_n
shift
=
celt_zlog2
(
bank
[
i
*
C
+
c
])
-
13
;
E
=
VSHR32
(
bank
[
i
*
C
+
c
],
shift
);
g
=
EXTRACT16
(
celt_rcp
(
SHR32
(
MULT16_16
(
E
,
sqrtC_1
[
C
-
1
]),
11
)));
for
(
j
=
eBands
[
i
];
j
<
eBands
[
i
+
1
];
j
++
)
j
=
eBands
[
i
];
do
{
X
[
j
*
C
+
c
]
=
MULT16_16_Q15
(
VSHR32
(
freq
[
j
*
C
+
c
],
shift
-
1
),
g
);
}
while
(
++
j
<
eBands
[
i
+
1
]);
}
while
(
++
i
<
m
->
nbEBands
);
}
for
(
i
=
C
*
eBands
[
m
->
nbEBands
];
i
<
C
*
eBands
[
m
->
nbEBands
+
1
];
i
++
)
...
...
@@ -220,8 +227,9 @@ void denormalise_bands(const CELTMode *m, const celt_norm_t * restrict X, celt_s
{
int
j
;
celt_word32_t
g
=
MULT16_32_Q13
(
sqrtC_1
[
C
-
1
],
bank
[
i
*
C
+
c
]);
for
(
j
=
eBands
[
i
];
j
<
eBands
[
i
+
1
];
j
++
)
j
=
eBands
[
i
];
do
{
freq
[
j
*
C
+
c
]
=
MULT16_32_Q15
(
X
[
j
*
C
+
c
],
g
);
}
while
(
++
j
<
eBands
[
i
+
1
]);
}
}
for
(
i
=
C
*
eBands
[
m
->
nbEBands
];
i
<
C
*
eBands
[
m
->
nbEBands
+
1
];
i
++
)
...
...
This diff is collapsed.
Click to expand it.
libcelt/vq.c
+
2
−
3
View file @
dff9b7eb
...
...
@@ -117,8 +117,7 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t *
N_1
=
512
/
N
;
sum
=
0
;
for
(
j
=
0
;
j
<
N
;
j
++
)
{
j
=
0
;
do
{
if
(
X
[
j
]
>
0
)
signx
[
j
]
=
1
;
else
...
...
@@ -126,7 +125,7 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, const celt_norm_t *
iy
[
j
]
=
0
;
y
[
j
]
=
0
;
sum
=
MAC16_16
(
sum
,
P
[
j
],
P
[
j
]);
}
}
while
(
++
j
<
N
);
Rpp
=
ROUND16
(
sum
,
NORM_SHIFT
);
celt_assert2
(
Rpp
<=
NORM_SCALING
,
"Rpp should never have a norm greater than unity"
);
...
...
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