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
5a408f91
Commit
5a408f91
authored
May 30, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decrease V_NB_BITS if possible
Originally committed as revision 4327 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
f4e61cd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
vorbis.c
libavcodec/vorbis.c
+14
-10
vorbis.h
libavcodec/vorbis.h
+1
-0
No files found.
libavcodec/vorbis.c
View file @
5a408f91
...
@@ -30,7 +30,8 @@
...
@@ -30,7 +30,8 @@
#include "vorbis.h"
#include "vorbis.h"
#define V_NB_BITS 11
#define V_NB_BITS 8
#define V_NB_BITS2 11
#define V_MAX_VLCS (1<<16)
#define V_MAX_VLCS (1<<16)
#ifndef V_DEBUG
#ifndef V_DEBUG
...
@@ -361,9 +362,12 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
...
@@ -361,9 +362,12 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
for
(
t
=
0
;
t
<
entries
;
++
t
)
for
(
t
=
0
;
t
<
entries
;
++
t
)
if
(
tmp_vlc_bits
[
t
]
>=
codebook_setup
->
maxdepth
)
codebook_setup
->
maxdepth
=
tmp_vlc_bits
[
t
];
if
(
tmp_vlc_bits
[
t
]
>=
codebook_setup
->
maxdepth
)
codebook_setup
->
maxdepth
=
tmp_vlc_bits
[
t
];
codebook_setup
->
maxdepth
=
(
codebook_setup
->
maxdepth
+
V_NB_BITS
-
1
)
/
V_NB_BITS
;
if
(
codebook_setup
->
maxdepth
>
3
*
V_NB_BITS
)
codebook_setup
->
nb_bits
=
V_NB_BITS2
;
else
codebook_setup
->
nb_bits
=
V_NB_BITS
;
if
(
init_vlc
(
&
codebook_setup
->
vlc
,
V_NB_BITS
,
entries
,
tmp_vlc_bits
,
sizeof
(
*
tmp_vlc_bits
),
sizeof
(
*
tmp_vlc_bits
),
tmp_vlc_codes
,
sizeof
(
*
tmp_vlc_codes
),
sizeof
(
*
tmp_vlc_codes
),
INIT_VLC_LE
))
{
codebook_setup
->
maxdepth
=
(
codebook_setup
->
maxdepth
+
codebook_setup
->
nb_bits
-
1
)
/
codebook_setup
->
nb_bits
;
if
(
init_vlc
(
&
codebook_setup
->
vlc
,
codebook_setup
->
nb_bits
,
entries
,
tmp_vlc_bits
,
sizeof
(
*
tmp_vlc_bits
),
sizeof
(
*
tmp_vlc_bits
),
tmp_vlc_codes
,
sizeof
(
*
tmp_vlc_codes
),
sizeof
(
*
tmp_vlc_codes
),
INIT_VLC_LE
))
{
av_log
(
vc
->
avccontext
,
AV_LOG_ERROR
,
" Error generating vlc tables.
\n
"
);
av_log
(
vc
->
avccontext
,
AV_LOG_ERROR
,
" Error generating vlc tables.
\n
"
);
goto
error
;
goto
error
;
}
}
...
@@ -899,7 +903,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor *vf, f
...
@@ -899,7 +903,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor *vf, f
if
(
cbits
)
{
// this reads all subclasses for this partition's class
if
(
cbits
)
{
// this reads all subclasses for this partition's class
cval
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vf
->
class_masterbook
[
class_
]].
vlc
.
table
,
cval
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vf
->
class_masterbook
[
class_
]].
vlc
.
table
,
V_NB_BITS
,
3
);
vc
->
codebooks
[
vf
->
class_masterbook
[
class_
]].
nb_bits
,
3
);
}
}
for
(
j
=
0
;
j
<
cdim
;
++
j
)
{
for
(
j
=
0
;
j
<
cdim
;
++
j
)
{
...
@@ -910,7 +914,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor *vf, f
...
@@ -910,7 +914,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor *vf, f
cval
=
cval
>>
cbits
;
cval
=
cval
>>
cbits
;
if
(
book
>
0
)
{
if
(
book
>
0
)
{
floor1_Y
[
offset
+
j
]
=
get_vlc2
(
gb
,
vc
->
codebooks
[
book
].
vlc
.
table
,
floor1_Y
[
offset
+
j
]
=
get_vlc2
(
gb
,
vc
->
codebooks
[
book
].
vlc
.
table
,
V_NB_BITS
,
3
);
vc
->
codebooks
[
book
].
nb_bits
,
3
);
}
else
{
}
else
{
floor1_Y
[
offset
+
j
]
=
0
;
floor1_Y
[
offset
+
j
]
=
0
;
}
}
...
@@ -1096,7 +1100,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1096,7 +1100,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
for
(
j_times_ptns_to_read
=
0
,
j
=
0
;
j
<
ch_used
;
++
j
)
{
for
(
j_times_ptns_to_read
=
0
,
j
=
0
;
j
<
ch_used
;
++
j
)
{
if
(
!
do_not_decode
[
j
])
{
if
(
!
do_not_decode
[
j
])
{
uint_fast32_t
temp
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vr
->
classbook
].
vlc
.
table
,
uint_fast32_t
temp
=
get_vlc2
(
gb
,
vc
->
codebooks
[
vr
->
classbook
].
vlc
.
table
,
V_NB_BITS
,
3
);
vc
->
codebooks
[
vr
->
classbook
].
nb_bits
,
3
);
AV_DEBUG
(
"Classword: %d
\n
"
,
temp
);
AV_DEBUG
(
"Classword: %d
\n
"
,
temp
);
...
@@ -1129,7 +1133,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1129,7 +1133,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
voffs
=
voffset
+
j
*
vlen
;
voffs
=
voffset
+
j
*
vlen
;
for
(
k
=
0
;
k
<
step
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
codebook
.
nb_bits
,
3
)
*
codebook
.
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
)
{
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
)
{
vec
[
voffs
+
k
+
l
*
step
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
+
k
+
l
*
step
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
}
}
...
@@ -1138,7 +1142,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1138,7 +1142,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
else
if
(
vr
->
type
==
1
)
{
else
if
(
vr
->
type
==
1
)
{
voffs
=
voffset
+
j
*
vlen
;
voffs
=
voffset
+
j
*
vlen
;
for
(
k
=
0
;
k
<
step
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
codebook
.
nb_bits
,
3
)
*
codebook
.
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
,
++
voffs
)
{
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
,
++
voffs
)
{
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
...
@@ -1150,7 +1154,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1150,7 +1154,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
voffs
=
voffset
>>
1
;
voffs
=
voffset
>>
1
;
for
(
k
=
0
;
k
<
step
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
codebook
.
nb_bits
,
3
)
*
codebook
.
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
l
+=
2
,
voffs
++
)
{
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
l
+=
2
,
voffs
++
)
{
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH
vec
[
voffs
+
vlen
]
+=
codebook
.
codevectors
[
coffs
+
l
+
1
];
// FPMATH
vec
[
voffs
+
vlen
]
+=
codebook
.
codevectors
[
coffs
+
l
+
1
];
// FPMATH
...
@@ -1164,7 +1168,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
...
@@ -1164,7 +1168,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa
voffs
=
voffset
;
voffs
=
voffset
;
for
(
k
=
0
;
k
<
step
;
++
k
)
{
for
(
k
=
0
;
k
<
step
;
++
k
)
{
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
V_NB_BITS
,
3
)
*
codebook
.
dimensions
;
coffs
=
get_vlc2
(
gb
,
codebook
.
vlc
.
table
,
codebook
.
nb_bits
,
3
)
*
codebook
.
dimensions
;
for
(
l
=
0
;
l
<
codebook
.
dimensions
;
++
l
,
++
voffs
)
{
for
(
l
=
0
;
l
<
codebook
.
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
]
+=
codebook
.
codevectors
[
coffs
+
l
];
// FPMATH FIXME use if and counter instead of / and %
...
...
libavcodec/vorbis.h
View file @
5a408f91
...
@@ -9,6 +9,7 @@ typedef struct {
...
@@ -9,6 +9,7 @@ typedef struct {
uint_fast8_t
maxdepth
;
uint_fast8_t
maxdepth
;
VLC
vlc
;
VLC
vlc
;
float
*
codevectors
;
float
*
codevectors
;
unsigned
int
nb_bits
;
}
vorbis_codebook
;
}
vorbis_codebook
;
typedef
struct
{
typedef
struct
{
...
...
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