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
979c8de5
Commit
979c8de5
authored
Nov 04, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sipr: use a function pointer to select the decode_frame function
parent
3468ff10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
15 deletions
+20
-15
sipr.c
libavcodec/sipr.c
+6
-5
sipr.h
libavcodec/sipr.h
+14
-10
No files found.
libavcodec/sipr.c
View file @
979c8de5
...
...
@@ -492,8 +492,12 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Mode: %s
\n
"
,
modes
[
ctx
->
mode
].
mode_name
);
if
(
ctx
->
mode
==
MODE_16k
)
if
(
ctx
->
mode
==
MODE_16k
)
{
ff_sipr_init_16k
(
ctx
);
ctx
->
decode_frame
=
ff_sipr_decode_frame_16k
;
}
else
{
ctx
->
decode_frame
=
decode_frame
;
}
for
(
i
=
0
;
i
<
LP_FILTER_ORDER
;
i
++
)
ctx
->
lsp_history
[
i
]
=
cos
((
i
+
1
)
*
M_PI
/
(
LP_FILTER_ORDER
+
1
));
...
...
@@ -541,10 +545,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap,
for
(
i
=
0
;
i
<
mode_par
->
frames_per_packet
;
i
++
)
{
decode_parameters
(
&
parm
,
&
gb
,
mode_par
);
if
(
ctx
->
mode
==
MODE_16k
)
ff_sipr_decode_frame_16k
(
ctx
,
&
parm
,
data
);
else
decode_frame
(
ctx
,
&
parm
,
data
);
ctx
->
decode_frame
(
ctx
,
&
parm
,
data
);
data
+=
subframe_size
*
mode_par
->
subframe_count
;
}
...
...
libavcodec/sipr.h
View file @
979c8de5
...
...
@@ -53,8 +53,18 @@ typedef enum {
MODE_COUNT
}
SiprMode
;
typedef
struct
{
typedef
struct
SiprParameters
{
int
ma_pred_switch
;
///< switched moving average predictor
int
vq_indexes
[
5
];
int
pitch_delay
[
5
];
///< pitch delay
int
gp_index
[
5
];
///< adaptive-codebook gain indexes
int16_t
fc_indexes
[
5
][
10
];
///< fixed-codebook indexes
int
gc_index
[
5
];
///< fixed-codebook gain indexes
}
SiprParameters
;
typedef
struct
SiprContext
{
AVCodecContext
*
avctx
;
AVFrame
frame
;
SiprMode
mode
;
...
...
@@ -85,16 +95,10 @@ typedef struct {
float
mem_preemph
[
LP_FILTER_ORDER_16k
];
float
synth
[
LP_FILTER_ORDER_16k
];
double
lsp_history_16k
[
16
];
}
SiprContext
;
typedef
struct
{
int
ma_pred_switch
;
///< switched moving average predictor
int
vq_indexes
[
5
];
int
pitch_delay
[
5
];
///< pitch delay
int
gp_index
[
5
];
///< adaptive-codebook gain indexes
int16_t
fc_indexes
[
5
][
10
];
///< fixed-codebook indexes
int
gc_index
[
5
];
///< fixed-codebook gain indexes
}
SiprParameters
;
void
(
*
decode_frame
)(
struct
SiprContext
*
ctx
,
SiprParameters
*
params
,
float
*
out_data
);
}
SiprContext
;
extern
const
float
ff_pow_0_5
[
16
];
...
...
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