Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
f4e61cd1
Commit
f4e61cd1
authored
May 30, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more trivial optimizations
Originally committed as revision 4326 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
568d4b81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
vorbis.c
libavcodec/vorbis.c
+27
-27
No files found.
libavcodec/vorbis.c
View file @
f4e61cd1
...
@@ -37,7 +37,8 @@
...
@@ -37,7 +37,8 @@
#define AV_DEBUG(...)
#define AV_DEBUG(...)
#endif
#endif
#undef NDEBUG
#include <assert.h>
/* Helper functions */
/* Helper functions */
...
@@ -1099,10 +1100,11 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1099,10 +1100,11 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
AV_DEBUG
(
"Classword: %d
\n
"
,
temp
);
AV_DEBUG
(
"Classword: %d
\n
"
,
temp
);
assert
(
vr
->
classifications
>
1
&&
vr
->
classifications
<
256
&&
temp
<=
65536
);
//needed for inverse[]
for
(
i
=
0
;
i
<
c_p_c
;
++
i
)
{
for
(
i
=
0
;
i
<
c_p_c
;
++
i
)
{
uint_fast32_t
temp2
;
uint_fast32_t
temp2
;
temp2
=
temp
/
vr
->
classifications
;
temp2
=
(((
uint_fast64_t
)
temp
)
*
inverse
[
vr
->
classifications
])
>>
32
;
classifs
[
j_times_ptns_to_read
+
partition_count
+
c_p_c
-
1
-
i
]
=
temp
-
temp2
*
vr
->
classifications
;
classifs
[
j_times_ptns_to_read
+
partition_count
+
c_p_c
-
1
-
i
]
=
temp
-
temp2
*
vr
->
classifications
;
temp
=
temp2
;
temp
=
temp2
;
}
}
...
@@ -1120,41 +1122,40 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1120,41 +1122,40 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
if
(
vqbook
>=
0
)
{
if
(
vqbook
>=
0
)
{
uint_fast16_t
coffs
;
uint_fast16_t
coffs
;
uint_fast16_t
step
=
vr
->
partition_size
/
vc
->
codebooks
[
vqbook
].
dimensions
;
vorbis_codebook
codebook
=
vc
->
codebooks
[
vqbook
];
if
(
vr
->
type
==
0
)
{
if
(
vr
->
type
==
0
)
{
uint_fast16_t
step
=
vr
->
partition_size
/
vc
->
codebooks
[
vqbook
].
dimensions
;
voffs
=
voffset
+
j
*
vlen
;
voffs
=
voffset
+
j
*
vlen
;
for
(
k
=
0
;
k
<
step
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vqbook
].
vlc
.
table
,
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
V_NB_BITS
,
3
)
*
vc
->
codebooks
[
vqbook
].
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
)
{
for
(
l
=
0
;
l
<
vc
->
codebooks
[
vqbook
].
dimensions
;
++
l
)
{
vec
[
voffs
+
k
+
l
*
step
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
+
k
+
l
*
step
]
+=
vc
->
codebooks
[
vqbook
].
codevectors
[
coffs
+
l
];
// FPMATH
}
}
}
}
}
}
else
if
(
vr
->
type
==
1
)
{
else
if
(
vr
->
type
==
1
)
{
voffs
=
voffset
+
j
*
vlen
;
voffs
=
voffset
+
j
*
vlen
;
for
(
k
=
0
;
k
<
vr
->
partition_size
/
vc
->
codebooks
[
vqbook
].
dimensions
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vqbook
].
vlc
.
table
,
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
V_NB_BITS
,
3
)
*
vc
->
codebooks
[
vqbook
].
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
,
++
voffs
)
{
for
(
l
=
0
;
l
<
vc
->
codebooks
[
vqbook
].
dimensions
;
++
l
,
++
voffs
)
{
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
]
+=
vc
->
codebooks
[
vqbook
].
codevectors
[
coffs
+
l
];
// FPMATH
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d
\n
"
,
pass
,
voffs
,
vec
[
voffs
],
vc
->
codebooks
[
vqbook
]
.
codevectors
[
coffs
+
l
],
coffs
);
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d
\n
"
,
pass
,
voffs
,
vec
[
voffs
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
);
}
}
}
}
}
}
else
if
(
vr
->
type
==
2
&&
ch
==
2
)
{
// most frequent case optimized
else
if
(
vr
->
type
==
2
&&
ch
==
2
&&
(
voffset
&
1
)
==
0
&&
(
codebook
.
dimensions
&
1
)
==
0
)
{
// most frequent case optimized
voffs
=
voffset
;
voffs
=
voffset
>>
1
;
for
(
k
=
0
;
k
<
vr
->
partition_size
/
vc
->
codebooks
[
vqbook
].
dimensions
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vqbook
].
vlc
.
table
,
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
V_NB_BITS
,
3
)
*
vc
->
codebooks
[
vqbook
].
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
l
+=
2
,
voffs
++
)
{
for
(
l
=
0
;
l
<
vc
->
codebooks
[
vqbook
].
dimensions
;
++
l
,
++
voffs
)
{
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
(
voffs
>>
1
)
+
((
voffs
&
1
)
?
vlen
:
0
)]
+=
vc
->
codebooks
[
vqbook
].
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
+
vlen
]
+=
codebook
.
codevectors
[
coffs
+
l
+
1
];
// FPMATH
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
vc
->
codebooks
[
vqbook
]
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
}
}
}
}
...
@@ -1162,13 +1163,12 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1162,13 +1163,12 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
else
if
(
vr
->
type
==
2
)
{
else
if
(
vr
->
type
==
2
)
{
voffs
=
voffset
;
voffs
=
voffset
;
for
(
k
=
0
;
k
<
vr
->
partition_size
/
vc
->
codebooks
[
vqbook
].
dimensions
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vqbook
].
vlc
.
table
,
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
V_NB_BITS
,
3
)
*
vc
->
codebooks
[
vqbook
].
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
,
++
voffs
)
{
for
(
l
=
0
;
l
<
vc
->
codebooks
[
vqbook
].
dimensions
;
++
l
,
++
voffs
)
{
vec
[
voffs
/
ch
+
(
voffs
%
ch
)
*
vlen
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH FIXME use if and counter instead of / and %
vec
[
voffs
/
ch
+
(
voffs
%
ch
)
*
vlen
]
+=
vc
->
codebooks
[
vqbook
].
codevectors
[
coffs
+
l
];
// FPMATH FIXME use if and counter instead of / and %
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
vc
->
codebooks
[
vqbook
]
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
AV_DEBUG
(
" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d
\n
"
,
pass
,
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
,
vec
[
voffset
/
ch
+
(
voffs
%
ch
)
*
vlen
],
codebook
.
codevectors
[
coffs
+
l
],
coffs
,
l
);
}
}
}
}
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment