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
fa6be04b
Commit
fa6be04b
authored
Sep 14, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ra288: use a more descriptive calculation for output data size
parent
f10524d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
ra288.c
libavcodec/ra288.c
+10
-5
No files found.
libavcodec/ra288.c
View file @
fa6be04b
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#define MAX_BACKWARD_FILTER_LEN 40
#define MAX_BACKWARD_FILTER_LEN 40
#define MAX_BACKWARD_FILTER_NONREC 35
#define MAX_BACKWARD_FILTER_NONREC 35
#define RA288_BLOCK_SIZE 5
#define RA288_BLOCKS_PER_FRAME 32
typedef
struct
{
typedef
struct
{
float
sp_lpc
[
36
];
///< LPC coefficients for speech data (spec: A)
float
sp_lpc
[
36
];
///< LPC coefficients for speech data (spec: A)
float
gain_lpc
[
10
];
///< LPC coefficients for gain (spec: GB)
float
gain_lpc
[
10
];
///< LPC coefficients for gain (spec: GB)
...
@@ -165,7 +168,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -165,7 +168,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
float
*
out
=
data
;
float
*
out
=
data
;
int
i
,
j
;
int
i
,
j
,
out_size
;
RA288Context
*
ractx
=
avctx
->
priv_data
;
RA288Context
*
ractx
=
avctx
->
priv_data
;
GetBitContext
gb
;
GetBitContext
gb
;
...
@@ -176,18 +179,20 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -176,18 +179,20 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
return
0
;
return
0
;
}
}
if
(
*
data_size
<
32
*
5
*
4
)
out_size
=
RA288_BLOCK_SIZE
*
RA288_BLOCKS_PER_FRAME
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
if
(
*
data_size
<
out_size
)
return
-
1
;
return
-
1
;
init_get_bits
(
&
gb
,
buf
,
avctx
->
block_align
*
8
);
init_get_bits
(
&
gb
,
buf
,
avctx
->
block_align
*
8
);
for
(
i
=
0
;
i
<
32
;
i
++
)
{
for
(
i
=
0
;
i
<
RA288_BLOCKS_PER_FRAME
;
i
++
)
{
float
gain
=
amptable
[
get_bits
(
&
gb
,
3
)];
float
gain
=
amptable
[
get_bits
(
&
gb
,
3
)];
int
cb_coef
=
get_bits
(
&
gb
,
6
+
(
i
&
1
));
int
cb_coef
=
get_bits
(
&
gb
,
6
+
(
i
&
1
));
decode
(
ractx
,
gain
,
cb_coef
);
decode
(
ractx
,
gain
,
cb_coef
);
for
(
j
=
0
;
j
<
5
;
j
++
)
for
(
j
=
0
;
j
<
RA288_BLOCK_SIZE
;
j
++
)
*
(
out
++
)
=
ractx
->
sp_hist
[
70
+
36
+
j
];
*
(
out
++
)
=
ractx
->
sp_hist
[
70
+
36
+
j
];
if
((
i
&
7
)
==
3
)
{
if
((
i
&
7
)
==
3
)
{
...
@@ -199,7 +204,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -199,7 +204,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
}
}
}
}
*
data_size
=
(
char
*
)
out
-
(
char
*
)
data
;
*
data_size
=
out_size
;
return
avctx
->
block_align
;
return
avctx
->
block_align
;
}
}
...
...
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