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
66ecf18e
Commit
66ecf18e
authored
Dec 09, 2007
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cosmetics: rename ac3 tables
Originally committed as revision 11193 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
59e6f60a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
55 deletions
+55
-55
ac3.c
libavcodec/ac3.c
+5
-5
ac3_parser.c
libavcodec/ac3_parser.c
+7
-7
ac3dec.c
libavcodec/ac3dec.c
+6
-6
ac3enc.c
libavcodec/ac3enc.c
+9
-9
ac3tab.c
libavcodec/ac3tab.c
+14
-14
ac3tab.h
libavcodec/ac3tab.h
+14
-14
No files found.
libavcodec/ac3.c
View file @
66ecf18e
...
...
@@ -72,7 +72,7 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
for
(
i
=
j
;
i
<
end1
;
i
++
)
{
/* logadd */
int
adr
=
FFMIN
(
FFABS
(
v
-
psd
[
j
])
>>
1
,
255
);
v
=
FFMAX
(
v
,
psd
[
j
])
+
ff_ac3_l
a
tab
[
adr
];
v
=
FFMAX
(
v
,
psd
[
j
])
+
ff_ac3_l
og_add_
tab
[
adr
];
j
++
;
}
bndpsd
[
k
]
=
v
;
...
...
@@ -149,7 +149,7 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *bndpsd,
if
(
tmp
>
0
)
{
excite
[
bin
]
+=
tmp
>>
2
;
}
mask
[
bin
]
=
FFMAX
(
ff_ac3_h
th
[
bin
>>
s
->
halfratecod
][
s
->
fscod
],
excite
[
bin
]);
mask
[
bin
]
=
FFMAX
(
ff_ac3_h
earing_threshold_tab
[
bin
>>
s
->
halfratecod
][
s
->
fscod
],
excite
[
bin
]);
}
/* delta bit allocation */
...
...
@@ -187,10 +187,10 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
j
=
masktab
[
start
];
do
{
v
=
(
FFMAX
(
mask
[
j
]
-
snroffset
-
floor
,
0
)
&
0x1FE0
)
+
floor
;
end1
=
FFMIN
(
bndtab
[
j
]
+
ff_ac3_
bndsz
[
j
],
end
);
end1
=
FFMIN
(
bndtab
[
j
]
+
ff_ac3_
critical_band_size_tab
[
j
],
end
);
for
(
k
=
i
;
k
<
end1
;
k
++
)
{
address
=
av_clip
((
psd
[
i
]
-
v
)
>>
5
,
0
,
63
);
bap
[
i
]
=
ff_ac3_baptab
[
address
];
bap
[
i
]
=
ff_ac3_bap
_
tab
[
address
];
i
++
;
}
}
while
(
end
>
bndtab
[
j
++
]);
...
...
@@ -231,7 +231,7 @@ void ac3_common_init(void)
l
=
0
;
for
(
i
=
0
;
i
<
50
;
i
++
)
{
bndtab
[
i
]
=
l
;
v
=
ff_ac3_
bndsz
[
i
];
v
=
ff_ac3_
critical_band_size_tab
[
i
];
for
(
j
=
0
;
j
<
v
;
j
++
)
masktab
[
k
++
]
=
i
;
l
+=
v
;
}
...
...
libavcodec/ac3_parser.c
View file @
66ecf18e
...
...
@@ -76,10 +76,10 @@ int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr)
hdr
->
lfeon
=
get_bits1
(
&
gbc
);
hdr
->
halfratecod
=
FFMAX
(
hdr
->
bsid
,
8
)
-
8
;
hdr
->
sample_rate
=
ff_ac3_
freqs
[
hdr
->
fscod
]
>>
hdr
->
halfratecod
;
hdr
->
bit_rate
=
(
ff_ac3_bitratetab
[
hdr
->
frmsizecod
>>
1
]
*
1000
)
>>
hdr
->
halfratecod
;
hdr
->
channels
=
ff_ac3_channels
[
hdr
->
acmod
]
+
hdr
->
lfeon
;
hdr
->
frame_size
=
ff_ac3_frame_size
s
[
hdr
->
frmsizecod
][
hdr
->
fscod
]
*
2
;
hdr
->
sample_rate
=
ff_ac3_
sample_rate_tab
[
hdr
->
fscod
]
>>
hdr
->
halfratecod
;
hdr
->
bit_rate
=
(
ff_ac3_bitrate
_
tab
[
hdr
->
frmsizecod
>>
1
]
*
1000
)
>>
hdr
->
halfratecod
;
hdr
->
channels
=
ff_ac3_channels
_tab
[
hdr
->
acmod
]
+
hdr
->
lfeon
;
hdr
->
frame_size
=
ff_ac3_frame_size
_tab
[
hdr
->
frmsizecod
][
hdr
->
fscod
]
*
2
;
return
0
;
}
...
...
@@ -125,11 +125,11 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
if
(
fscod2
==
3
)
return
0
;
*
sample_rate
=
ff_ac3_
freqs
[
fscod2
]
/
2
;
*
sample_rate
=
ff_ac3_
sample_rate_tab
[
fscod2
]
/
2
;
}
else
{
numblkscod
=
get_bits
(
&
bits
,
2
);
*
sample_rate
=
ff_ac3_
freqs
[
fscod
];
*
sample_rate
=
ff_ac3_
sample_rate_tab
[
fscod
];
}
acmod
=
get_bits
(
&
bits
,
3
);
...
...
@@ -137,7 +137,7 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
*
samples
=
eac3_blocks
[
numblkscod
]
*
256
;
*
bit_rate
=
frmsiz
*
(
*
sample_rate
)
*
16
/
(
*
samples
);
*
channels
=
ff_ac3_channels
[
acmod
]
+
lfeon
;
*
channels
=
ff_ac3_channels
_tab
[
acmod
]
+
lfeon
;
return
frmsiz
*
2
;
}
...
...
libavcodec/ac3dec.c
View file @
66ecf18e
...
...
@@ -947,11 +947,11 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
/* bit allocation information */
if
(
get_bits1
(
gb
))
{
ctx
->
bit_alloc_params
.
sdecay
=
ff_
sdecay
tab
[
get_bits
(
gb
,
2
)]
>>
ctx
->
bit_alloc_params
.
halfratecod
;
ctx
->
bit_alloc_params
.
fdecay
=
ff_
fdecay
tab
[
get_bits
(
gb
,
2
)]
>>
ctx
->
bit_alloc_params
.
halfratecod
;
ctx
->
bit_alloc_params
.
sgain
=
ff_
sgain
tab
[
get_bits
(
gb
,
2
)];
ctx
->
bit_alloc_params
.
dbknee
=
ff_
dbknee
tab
[
get_bits
(
gb
,
2
)];
ctx
->
bit_alloc_params
.
floor
=
ff_
floor
tab
[
get_bits
(
gb
,
3
)];
ctx
->
bit_alloc_params
.
sdecay
=
ff_
ac3_slow_decay_
tab
[
get_bits
(
gb
,
2
)]
>>
ctx
->
bit_alloc_params
.
halfratecod
;
ctx
->
bit_alloc_params
.
fdecay
=
ff_
ac3_fast_decay_
tab
[
get_bits
(
gb
,
2
)]
>>
ctx
->
bit_alloc_params
.
halfratecod
;
ctx
->
bit_alloc_params
.
sgain
=
ff_
ac3_slow_gain_
tab
[
get_bits
(
gb
,
2
)];
ctx
->
bit_alloc_params
.
dbknee
=
ff_
ac3_db_per_bit_
tab
[
get_bits
(
gb
,
2
)];
ctx
->
bit_alloc_params
.
floor
=
ff_
ac3_floor_
tab
[
get_bits
(
gb
,
3
)];
for
(
ch
=!
ctx
->
cplinu
;
ch
<=
ctx
->
nchans
;
ch
++
)
{
bit_alloc_stages
[
ch
]
=
FFMAX
(
bit_alloc_stages
[
ch
],
2
);
}
...
...
@@ -963,7 +963,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
csnr
=
(
get_bits
(
gb
,
6
)
-
15
)
<<
4
;
for
(
ch
=
!
ctx
->
cplinu
;
ch
<=
ctx
->
nchans
;
ch
++
)
{
/* snr offset and fast gain */
ctx
->
snroffst
[
ch
]
=
(
csnr
+
get_bits
(
gb
,
4
))
<<
2
;
ctx
->
fgain
[
ch
]
=
ff_
fgain
tab
[
get_bits
(
gb
,
3
)];
ctx
->
fgain
[
ch
]
=
ff_
ac3_fast_gain_
tab
[
get_bits
(
gb
,
3
)];
}
memset
(
bit_alloc_stages
,
3
,
AC3_MAX_CHANNELS
);
}
...
...
libavcodec/ac3enc.c
View file @
66ecf18e
...
...
@@ -451,7 +451,7 @@ static void bit_alloc_masking(AC3EncodeContext *s,
psd
[
blk
][
ch
],
bndpsd
[
blk
][
ch
]);
ff_ac3_bit_alloc_calc_mask
(
&
s
->
bit_alloc
,
bndpsd
[
blk
][
ch
],
0
,
s
->
nb_coefs
[
ch
],
ff_
fgain
tab
[
s
->
fgaincod
[
ch
]],
ff_
ac3_fast_gain_
tab
[
s
->
fgaincod
[
ch
]],
ch
==
s
->
lfe_channel
,
DBA_NONE
,
0
,
NULL
,
NULL
,
NULL
,
mask
[
blk
][
ch
]);
...
...
@@ -519,11 +519,11 @@ static int compute_bit_allocation(AC3EncodeContext *s,
/* compute real values */
s
->
bit_alloc
.
fscod
=
s
->
fscod
;
s
->
bit_alloc
.
halfratecod
=
s
->
halfratecod
;
s
->
bit_alloc
.
sdecay
=
ff_
sdecay
tab
[
s
->
sdecaycod
]
>>
s
->
halfratecod
;
s
->
bit_alloc
.
fdecay
=
ff_
fdecay
tab
[
s
->
fdecaycod
]
>>
s
->
halfratecod
;
s
->
bit_alloc
.
sgain
=
ff_
sgain
tab
[
s
->
sgaincod
];
s
->
bit_alloc
.
dbknee
=
ff_
dbknee
tab
[
s
->
dbkneecod
];
s
->
bit_alloc
.
floor
=
ff_
floor
tab
[
s
->
floorcod
];
s
->
bit_alloc
.
sdecay
=
ff_
ac3_slow_decay_
tab
[
s
->
sdecaycod
]
>>
s
->
halfratecod
;
s
->
bit_alloc
.
fdecay
=
ff_
ac3_fast_decay_
tab
[
s
->
fdecaycod
]
>>
s
->
halfratecod
;
s
->
bit_alloc
.
sgain
=
ff_
ac3_slow_gain_
tab
[
s
->
sgaincod
];
s
->
bit_alloc
.
dbknee
=
ff_
ac3_db_per_bit_
tab
[
s
->
dbkneecod
];
s
->
bit_alloc
.
floor
=
ff_
ac3_floor_
tab
[
s
->
floorcod
];
/* header size */
frame_bits
+=
65
;
...
...
@@ -657,7 +657,7 @@ static int AC3_encode_init(AVCodecContext *avctx)
/* frequency */
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
j
=
0
;
j
<
3
;
j
++
)
if
((
ff_ac3_
freqs
[
j
]
>>
i
)
==
freq
)
if
((
ff_ac3_
sample_rate_tab
[
j
]
>>
i
)
==
freq
)
goto
found
;
}
return
-
1
;
...
...
@@ -671,14 +671,14 @@ static int AC3_encode_init(AVCodecContext *avctx)
/* bitrate & frame size */
bitrate
/=
1000
;
for
(
i
=
0
;
i
<
19
;
i
++
)
{
if
((
ff_ac3_bitratetab
[
i
]
>>
s
->
halfratecod
)
==
bitrate
)
if
((
ff_ac3_bitrate
_
tab
[
i
]
>>
s
->
halfratecod
)
==
bitrate
)
break
;
}
if
(
i
==
19
)
return
-
1
;
s
->
bit_rate
=
bitrate
;
s
->
frmsizecod
=
i
<<
1
;
s
->
frame_size_min
=
ff_ac3_frame_size
s
[
s
->
frmsizecod
][
s
->
fscod
];
s
->
frame_size_min
=
ff_ac3_frame_size
_tab
[
s
->
frmsizecod
][
s
->
fscod
];
s
->
bits_written
=
0
;
s
->
samples_written
=
0
;
s
->
frame_size
=
s
->
frame_size_min
;
...
...
libavcodec/ac3tab.c
View file @
66ecf18e
...
...
@@ -30,7 +30,7 @@
* Possible frame sizes.
* from ATSC A/52 Table 5.18 Frame Size Code Table.
*/
const
uint16_t
ff_ac3_frame_size
s
[
38
][
3
]
=
{
const
uint16_t
ff_ac3_frame_size
_tab
[
38
][
3
]
=
{
{
64
,
69
,
96
},
{
64
,
70
,
96
},
{
80
,
87
,
120
},
...
...
@@ -75,15 +75,15 @@ const uint16_t ff_ac3_frame_sizes[38][3] = {
* Maps audio coding mode (acmod) to number of full-bandwidth channels.
* from ATSC A/52 Table 5.8 Audio Coding Mode
*/
const
uint8_t
ff_ac3_channels
[
8
]
=
{
const
uint8_t
ff_ac3_channels
_tab
[
8
]
=
{
2
,
1
,
2
,
3
,
3
,
4
,
4
,
5
};
/* possible frequencies */
const
uint16_t
ff_ac3_
freqs
[
3
]
=
{
48000
,
44100
,
32000
};
const
uint16_t
ff_ac3_
sample_rate_tab
[
3
]
=
{
48000
,
44100
,
32000
};
/* possible bitrates */
const
uint16_t
ff_ac3_bitratetab
[
19
]
=
{
const
uint16_t
ff_ac3_bitrate
_
tab
[
19
]
=
{
32
,
40
,
48
,
56
,
64
,
80
,
96
,
112
,
128
,
160
,
192
,
224
,
256
,
320
,
384
,
448
,
512
,
576
,
640
};
...
...
@@ -126,7 +126,7 @@ const int16_t ff_ac3_window[256] = {
32767
,
32767
,
32767
,
32767
,
32767
,
32767
,
32767
,
32767
,
};
const
uint8_t
ff_ac3_l
a
tab
[
260
]
=
{
const
uint8_t
ff_ac3_l
og_add_
tab
[
260
]
=
{
0x40
,
0x3f
,
0x3e
,
0x3d
,
0x3c
,
0x3b
,
0x3a
,
0x39
,
0x38
,
0x37
,
0x36
,
0x35
,
0x34
,
0x34
,
0x33
,
0x32
,
0x31
,
0x30
,
0x2f
,
0x2f
,
0x2e
,
0x2d
,
0x2c
,
0x2c
,
0x2b
,
0x2a
,
0x29
,
0x29
,
0x28
,
0x27
,
...
...
@@ -155,7 +155,7 @@ const uint8_t ff_ac3_latab[260]= {
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
};
const
uint16_t
ff_ac3_h
th
[
50
][
3
]
=
{
const
uint16_t
ff_ac3_h
earing_threshold_tab
[
50
][
3
]
=
{
{
0x04d0
,
0x04f0
,
0x0580
},
{
0x04d0
,
0x04f0
,
0x0580
},
{
0x0440
,
0x0460
,
0x04b0
},
...
...
@@ -208,7 +208,7 @@ const uint16_t ff_ac3_hth[50][3]= {
{
0x0840
,
0x0840
,
0x04e0
},
};
const
uint8_t
ff_ac3_baptab
[
64
]
=
{
const
uint8_t
ff_ac3_bap
_
tab
[
64
]
=
{
0
,
1
,
1
,
1
,
1
,
1
,
2
,
2
,
3
,
3
,
3
,
4
,
4
,
5
,
5
,
6
,
6
,
6
,
6
,
7
,
7
,
7
,
7
,
8
,
8
,
8
,
8
,
9
,
9
,
9
,
...
...
@@ -218,31 +218,31 @@ const uint8_t ff_ac3_baptab[64]= {
15
,
15
,
15
,
15
,
};
const
uint8_t
ff_
sdecay
tab
[
4
]
=
{
const
uint8_t
ff_
ac3_slow_decay_
tab
[
4
]
=
{
0x0f
,
0x11
,
0x13
,
0x15
,
};
const
uint8_t
ff_
fdecay
tab
[
4
]
=
{
const
uint8_t
ff_
ac3_fast_decay_
tab
[
4
]
=
{
0x3f
,
0x53
,
0x67
,
0x7b
,
};
const
uint16_t
ff_
sgain
tab
[
4
]
=
{
const
uint16_t
ff_
ac3_slow_gain_
tab
[
4
]
=
{
0x540
,
0x4d8
,
0x478
,
0x410
,
};
const
uint16_t
ff_
dbknee
tab
[
4
]
=
{
const
uint16_t
ff_
ac3_db_per_bit_
tab
[
4
]
=
{
0x000
,
0x700
,
0x900
,
0xb00
,
};
const
int16_t
ff_
floor
tab
[
8
]
=
{
const
int16_t
ff_
ac3_floor_
tab
[
8
]
=
{
0x2f0
,
0x2b0
,
0x270
,
0x230
,
0x1f0
,
0x170
,
0x0f0
,
0xf800
,
};
const
uint16_t
ff_
fgain
tab
[
8
]
=
{
const
uint16_t
ff_
ac3_fast_gain_
tab
[
8
]
=
{
0x080
,
0x100
,
0x180
,
0x200
,
0x280
,
0x300
,
0x380
,
0x400
,
};
const
uint8_t
ff_ac3_
bndsz
[
50
]
=
{
const
uint8_t
ff_ac3_
critical_band_size_tab
[
50
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
6
,
6
,
6
,
6
,
6
,
6
,
12
,
12
,
12
,
12
,
24
,
24
,
24
,
24
,
24
...
...
libavcodec/ac3tab.h
View file @
66ecf18e
...
...
@@ -24,20 +24,20 @@
#include "common.h"
extern
const
uint16_t
ff_ac3_frame_size
s
[
38
][
3
];
extern
const
uint8_t
ff_ac3_channels
[
8
];
extern
const
uint16_t
ff_ac3_
freqs
[
3
];
extern
const
uint16_t
ff_ac3_bitratetab
[
19
];
extern
const
uint16_t
ff_ac3_frame_size
_tab
[
38
][
3
];
extern
const
uint8_t
ff_ac3_channels
_tab
[
8
];
extern
const
uint16_t
ff_ac3_
sample_rate_tab
[
3
];
extern
const
uint16_t
ff_ac3_bitrate
_
tab
[
19
];
extern
const
int16_t
ff_ac3_window
[
256
];
extern
const
uint8_t
ff_ac3_l
a
tab
[
260
];
extern
const
uint16_t
ff_ac3_h
th
[
50
][
3
];
extern
const
uint8_t
ff_ac3_baptab
[
64
];
extern
const
uint8_t
ff_
sdecay
tab
[
4
];
extern
const
uint8_t
ff_
fdecay
tab
[
4
];
extern
const
uint16_t
ff_
sgain
tab
[
4
];
extern
const
uint16_t
ff_
dbknee
tab
[
4
];
extern
const
int16_t
ff_
floor
tab
[
8
];
extern
const
uint16_t
ff_
fgain
tab
[
8
];
extern
const
uint8_t
ff_ac3_
bndsz
[
50
];
extern
const
uint8_t
ff_ac3_l
og_add_
tab
[
260
];
extern
const
uint16_t
ff_ac3_h
earing_threshold_tab
[
50
][
3
];
extern
const
uint8_t
ff_ac3_bap
_
tab
[
64
];
extern
const
uint8_t
ff_
ac3_slow_decay_
tab
[
4
];
extern
const
uint8_t
ff_
ac3_fast_decay_
tab
[
4
];
extern
const
uint16_t
ff_
ac3_slow_gain_
tab
[
4
];
extern
const
uint16_t
ff_
ac3_db_per_bit_
tab
[
4
];
extern
const
int16_t
ff_
ac3_floor_
tab
[
8
];
extern
const
uint16_t
ff_
ac3_fast_gain_
tab
[
8
];
extern
const
uint8_t
ff_ac3_
critical_band_size_tab
[
50
];
#endif
/* FFMPEG_AC3TAB_H */
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