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
5d6a990c
Commit
5d6a990c
authored
Nov 09, 2013
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegaudioenc: Remove broken integer-only quantization code path
parent
08303d77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
39 deletions
+5
-39
mpegaudioenc.c
libavcodec/mpegaudioenc.c
+5
-34
mpegaudiotab.h
libavcodec/mpegaudiotab.h
+0
-5
No files found.
libavcodec/mpegaudioenc.c
View file @
5d6a990c
...
...
@@ -35,6 +35,8 @@
#include "mpegaudio.h"
#include "mpegaudiodsp.h"
#include "mpegaudiodata.h"
#include "mpegaudiotab.h"
/* currently, cannot change these constants (need to modify
quantization stage) */
...
...
@@ -61,12 +63,6 @@ typedef struct MpegAudioContext {
const
unsigned
char
*
alloc_table
;
}
MpegAudioContext
;
/* define it to use floats in quantization (I don't like floats !) */
#define USE_FLOATS
#include "mpegaudiodata.h"
#include "mpegaudiotab.h"
static
av_cold
int
MPA_encode_init
(
AVCodecContext
*
avctx
)
{
MpegAudioContext
*
s
=
avctx
->
priv_data
;
...
...
@@ -152,13 +148,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
if
(
v
<=
0
)
v
=
1
;
scale_factor_table
[
i
]
=
v
;
#ifdef USE_FLOATS
scale_factor_inv_table
[
i
]
=
pow
(
2
.
0
,
-
(
3
-
i
)
/
3
.
0
)
/
(
float
)(
1
<<
20
);
#else
#define P 15
scale_factor_shift
[
i
]
=
21
-
P
-
(
i
/
3
);
scale_factor_mult
[
i
]
=
(
1
<<
P
)
*
pow
(
2
.
0
,
(
i
%
3
)
/
3
.
0
);
#endif
}
for
(
i
=
0
;
i
<
128
;
i
++
)
{
v
=
i
-
64
;
...
...
@@ -672,30 +662,11 @@ static void encode_frame(MpegAudioContext *s,
qindex
=
s
->
alloc_table
[
j
+
b
];
steps
=
ff_mpa_quant_steps
[
qindex
];
for
(
m
=
0
;
m
<
3
;
m
++
)
{
float
a
;
sample
=
s
->
sb_samples
[
ch
][
k
][
l
+
m
][
i
];
/* divide by scale factor */
#ifdef USE_FLOATS
{
float
a
;
a
=
(
float
)
sample
*
scale_factor_inv_table
[
s
->
scale_factors
[
ch
][
i
][
k
]];
q
[
m
]
=
(
int
)((
a
+
1
.
0
)
*
steps
*
0
.
5
);
}
#else
{
int
q1
,
e
,
shift
,
mult
;
e
=
s
->
scale_factors
[
ch
][
i
][
k
];
shift
=
scale_factor_shift
[
e
];
mult
=
scale_factor_mult
[
e
];
/* normalize to P bits */
if
(
shift
<
0
)
q1
=
sample
<<
(
-
shift
);
else
q1
=
sample
>>
shift
;
q1
=
(
q1
*
mult
)
>>
P
;
q
[
m
]
=
((
q1
+
(
1
<<
P
))
*
steps
)
>>
(
P
+
1
);
}
#endif
a
=
(
float
)
sample
*
scale_factor_inv_table
[
s
->
scale_factors
[
ch
][
i
][
k
]];
q
[
m
]
=
(
int
)((
a
+
1
.
0
)
*
steps
*
0
.
5
);
if
(
q
[
m
]
>=
steps
)
q
[
m
]
=
steps
-
1
;
assert
(
q
[
m
]
>=
0
&&
q
[
m
]
<
steps
);
...
...
libavcodec/mpegaudiotab.h
View file @
5d6a990c
...
...
@@ -82,12 +82,7 @@ static const int bitinv32[32] = {
static
int16_t
filter_bank
[
512
];
static
int
scale_factor_table
[
64
];
#ifdef USE_FLOATS
static
float
scale_factor_inv_table
[
64
];
#else
static
int8_t
scale_factor_shift
[
64
];
static
unsigned
short
scale_factor_mult
[
64
];
#endif
static
unsigned
char
scale_diff_table
[
128
];
/* total number of bits per allocation group */
...
...
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