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
5d1007f7
Commit
5d1007f7
authored
Oct 19, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atrac3: initialize static tables in AVCodec.init_static_data()
parent
78edce3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
26 deletions
+27
-26
atrac3.c
libavcodec/atrac3.c
+27
-26
No files found.
libavcodec/atrac3.c
View file @
5d1007f7
...
...
@@ -117,6 +117,7 @@ typedef struct ATRAC3Context {
}
ATRAC3Context
;
static
DECLARE_ALIGNED
(
32
,
float
,
mdct_window
)[
MDCT_SIZE
];
static
VLC_TYPE
atrac3_vlc_table
[
4096
][
2
];
static
VLC
spectral_coeff_tab
[
7
];
static
float
gain_tab1
[
16
];
static
float
gain_tab2
[
31
];
...
...
@@ -838,14 +839,37 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
return
avctx
->
block_align
;
}
static
void
atrac3_init_static_data
(
AVCodec
*
codec
)
{
int
i
;
init_atrac3_window
();
ff_atrac_generate_tables
();
/* Initialize the VLC tables. */
for
(
i
=
0
;
i
<
7
;
i
++
)
{
spectral_coeff_tab
[
i
].
table
=
&
atrac3_vlc_table
[
atrac3_vlc_offs
[
i
]];
spectral_coeff_tab
[
i
].
table_allocated
=
atrac3_vlc_offs
[
i
+
1
]
-
atrac3_vlc_offs
[
i
];
init_vlc
(
&
spectral_coeff_tab
[
i
],
9
,
huff_tab_sizes
[
i
],
huff_bits
[
i
],
1
,
1
,
huff_codes
[
i
],
1
,
1
,
INIT_VLC_USE_NEW_STATIC
);
}
/* Generate gain tables */
for
(
i
=
0
;
i
<
16
;
i
++
)
gain_tab1
[
i
]
=
powf
(
2
.
0
,
(
4
-
i
));
for
(
i
=
-
15
;
i
<
16
;
i
++
)
gain_tab2
[
i
+
15
]
=
powf
(
2
.
0
,
i
*
-
0
.
125
);
}
static
av_cold
int
atrac3_decode_init
(
AVCodecContext
*
avctx
)
{
int
i
,
ret
;
int
version
,
delay
,
samples_per_frame
,
frame_factor
;
const
uint8_t
*
edata_ptr
=
avctx
->
extradata
;
ATRAC3Context
*
q
=
avctx
->
priv_data
;
static
VLC_TYPE
atrac3_vlc_table
[
4096
][
2
];
static
int
vlcs_initialized
=
0
;
/* Take data from the AVCodecContext (RM container). */
q
->
sample_rate
=
avctx
->
sample_rate
;
...
...
@@ -935,20 +959,6 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
if
(
q
->
decoded_bytes_buffer
==
NULL
)
return
AVERROR
(
ENOMEM
);
/* Initialize the VLC tables. */
if
(
!
vlcs_initialized
)
{
for
(
i
=
0
;
i
<
7
;
i
++
)
{
spectral_coeff_tab
[
i
].
table
=
&
atrac3_vlc_table
[
atrac3_vlc_offs
[
i
]];
spectral_coeff_tab
[
i
].
table_allocated
=
atrac3_vlc_offs
[
i
+
1
]
-
atrac3_vlc_offs
[
i
];
init_vlc
(
&
spectral_coeff_tab
[
i
],
9
,
huff_tab_sizes
[
i
],
huff_bits
[
i
],
1
,
1
,
huff_codes
[
i
],
1
,
1
,
INIT_VLC_USE_NEW_STATIC
);
}
vlcs_initialized
=
1
;
}
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLTP
;
/* initialize the MDCT transform */
...
...
@@ -958,16 +968,6 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
return
ret
;
}
init_atrac3_window
();
ff_atrac_generate_tables
();
/* Generate gain tables */
for
(
i
=
0
;
i
<
16
;
i
++
)
gain_tab1
[
i
]
=
powf
(
2
.
0
,
(
4
-
i
));
for
(
i
=
-
15
;
i
<
16
;
i
++
)
gain_tab2
[
i
+
15
]
=
powf
(
2
.
0
,
i
*
-
0
.
125
);
/* init the joint-stereo decoding data */
q
->
weighting_delay
[
0
]
=
0
;
q
->
weighting_delay
[
1
]
=
7
;
...
...
@@ -1003,6 +1003,7 @@ AVCodec ff_atrac3_decoder = {
.
id
=
AV_CODEC_ID_ATRAC3
,
.
priv_data_size
=
sizeof
(
ATRAC3Context
),
.
init
=
atrac3_decode_init
,
.
init_static_data
=
atrac3_init_static_data
,
.
close
=
atrac3_decode_close
,
.
decode
=
atrac3_decode_frame
,
.
capabilities
=
CODEC_CAP_SUBFRAMES
|
CODEC_CAP_DR1
,
...
...
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