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
da227603
Commit
da227603
authored
Apr 25, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vima: generate predict_table once, and share it with all decoders
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
77570a39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
vima.c
libavcodec/vima.c
+11
-11
No files found.
libavcodec/vima.c
View file @
da227603
...
...
@@ -25,9 +25,8 @@
#include "internal.h"
#include "adpcm_data.h"
typedef
struct
{
uint16_t
predict_table
[
5786
*
2
];
}
VimaContext
;
static
int
predict_table_init
=
0
;
static
uint16_t
predict_table
[
5786
*
2
];
static
const
uint8_t
size_table
[]
=
{
...
...
@@ -103,8 +102,12 @@ static const int8_t* const step_index_tables[] =
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
{
VimaContext
*
vima
=
avctx
->
priv_data
;
int
start_pos
;
int
start_pos
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
if
(
predict_table_init
)
return
0
;
for
(
start_pos
=
0
;
start_pos
<
64
;
start_pos
++
)
{
unsigned
int
dest_pos
,
table_pos
;
...
...
@@ -120,11 +123,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
put
+=
table_value
;
table_value
>>=
1
;
}
vima
->
predict_table
[
dest_pos
]
=
put
;
predict_table
[
dest_pos
]
=
put
;
}
}
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
predict_table_init
=
1
;
return
0
;
}
...
...
@@ -133,7 +135,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int
*
got_frame_ptr
,
AVPacket
*
pkt
)
{
GetBitContext
gb
;
VimaContext
*
vima
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
int16_t
pcm_data
[
2
];
uint32_t
samples
;
...
...
@@ -200,7 +201,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
predict_index
=
(
lookup
<<
(
7
-
lookup_size
))
|
(
step_index
<<
6
);
predict_index
=
av_clip
(
predict_index
,
0
,
5785
);
diff
=
vima
->
predict_table
[
predict_index
];
diff
=
predict_table
[
predict_index
];
if
(
lookup
)
diff
+=
ff_adpcm_step_table
[
step_index
]
>>
(
lookup_size
-
1
);
if
(
highbit
)
...
...
@@ -225,7 +226,6 @@ AVCodec ff_vima_decoder = {
.
name
=
"vima"
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
id
=
AV_CODEC_ID_VIMA
,
.
priv_data_size
=
sizeof
(
VimaContext
),
.
init
=
decode_init
,
.
decode
=
decode_frame
,
.
capabilities
=
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