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
0e4dbe29
Commit
0e4dbe29
authored
Jun 21, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ac3enc: avoid masking output in asym_quant() by using signed values for
quantized mantissas.
parent
2702a6f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
ac3enc.c
libavcodec/ac3enc.c
+11
-11
ac3enc.h
libavcodec/ac3enc.h
+1
-1
No files found.
libavcodec/ac3enc.c
View file @
0e4dbe29
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
#include "eac3enc.h"
#include "eac3enc.h"
typedef
struct
AC3Mant
{
typedef
struct
AC3Mant
{
u
int16_t
*
qmant1_ptr
,
*
qmant2_ptr
,
*
qmant4_ptr
;
///< mantissa pointers for bap=1,2,4
int16_t
*
qmant1_ptr
,
*
qmant2_ptr
,
*
qmant4_ptr
;
///< mantissa pointers for bap=1,2,4
int
mant1_cnt
,
mant2_cnt
,
mant4_cnt
;
///< mantissa counts for bap=1,2,4
int
mant1_cnt
,
mant2_cnt
,
mant4_cnt
;
///< mantissa counts for bap=1,2,4
}
AC3Mant
;
}
AC3Mant
;
...
@@ -1136,7 +1136,7 @@ static inline int asym_quant(int c, int e, int qbits)
...
@@ -1136,7 +1136,7 @@ static inline int asym_quant(int c, int e, int qbits)
if
(
v
>=
m
)
if
(
v
>=
m
)
v
=
m
-
1
;
v
=
m
-
1
;
av_assert2
(
v
>=
-
m
);
av_assert2
(
v
>=
-
m
);
return
v
&
((
1
<<
qbits
)
-
1
)
;
return
v
;
}
}
...
@@ -1145,7 +1145,7 @@ static inline int asym_quant(int c, int e, int qbits)
...
@@ -1145,7 +1145,7 @@ static inline int asym_quant(int c, int e, int qbits)
*/
*/
static
void
quantize_mantissas_blk_ch
(
AC3Mant
*
s
,
int32_t
*
fixed_coef
,
static
void
quantize_mantissas_blk_ch
(
AC3Mant
*
s
,
int32_t
*
fixed_coef
,
uint8_t
*
exp
,
uint8_t
*
bap
,
uint8_t
*
exp
,
uint8_t
*
bap
,
u
int16_t
*
qmant
,
int
start_freq
,
int16_t
*
qmant
,
int
start_freq
,
int
end_freq
)
int
end_freq
)
{
{
int
i
;
int
i
;
...
@@ -1497,14 +1497,14 @@ static void output_audio_block(AC3EncodeContext *s, int blk)
...
@@ -1497,14 +1497,14 @@ static void output_audio_block(AC3EncodeContext *s, int blk)
q
=
block
->
qmant
[
ch
][
i
];
q
=
block
->
qmant
[
ch
][
i
];
b
=
s
->
ref_bap
[
ch
][
blk
][
i
];
b
=
s
->
ref_bap
[
ch
][
blk
][
i
];
switch
(
b
)
{
switch
(
b
)
{
case
0
:
break
;
case
0
:
break
;
case
1
:
if
(
q
!=
128
)
put_bits
(
&
s
->
pb
,
5
,
q
);
break
;
case
1
:
if
(
q
!=
128
)
put_bits
(
&
s
->
pb
,
5
,
q
);
break
;
case
2
:
if
(
q
!=
128
)
put_bits
(
&
s
->
pb
,
7
,
q
);
break
;
case
2
:
if
(
q
!=
128
)
put_bits
(
&
s
->
pb
,
7
,
q
);
break
;
case
3
:
put_bits
(
&
s
->
pb
,
3
,
q
);
break
;
case
3
:
put_
s
bits
(
&
s
->
pb
,
3
,
q
);
break
;
case
4
:
if
(
q
!=
128
)
put_bits
(
&
s
->
pb
,
7
,
q
);
break
;
case
4
:
if
(
q
!=
128
)
put_bits
(
&
s
->
pb
,
7
,
q
);
break
;
case
14
:
put_bits
(
&
s
->
pb
,
14
,
q
);
break
;
case
14
:
put_
s
bits
(
&
s
->
pb
,
14
,
q
);
break
;
case
15
:
put_bits
(
&
s
->
pb
,
16
,
q
);
break
;
case
15
:
put_
s
bits
(
&
s
->
pb
,
16
,
q
);
break
;
default:
put_bits
(
&
s
->
pb
,
b
-
1
,
q
);
break
;
default:
put_
s
bits
(
&
s
->
pb
,
b
-
1
,
q
);
break
;
}
}
}
}
if
(
ch
==
CPL_CH
)
if
(
ch
==
CPL_CH
)
...
...
libavcodec/ac3enc.h
View file @
0e4dbe29
...
@@ -212,7 +212,7 @@ typedef struct AC3EncodeContext {
...
@@ -212,7 +212,7 @@ typedef struct AC3EncodeContext {
int16_t
*
psd_buffer
;
int16_t
*
psd_buffer
;
int16_t
*
band_psd_buffer
;
int16_t
*
band_psd_buffer
;
int16_t
*
mask_buffer
;
int16_t
*
mask_buffer
;
u
int16_t
*
qmant_buffer
;
int16_t
*
qmant_buffer
;
uint8_t
*
cpl_coord_exp_buffer
;
uint8_t
*
cpl_coord_exp_buffer
;
uint8_t
*
cpl_coord_mant_buffer
;
uint8_t
*
cpl_coord_mant_buffer
;
...
...
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