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
52fca28c
Commit
52fca28c
authored
Aug 25, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/vorbisenc: use av_malloc(z)_array()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
beaf86bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
vorbisenc.c
libavcodec/vorbisenc.c
+13
-13
No files found.
libavcodec/vorbisenc.c
View file @
52fca28c
...
...
@@ -170,8 +170,8 @@ static int ready_codebook(vorbis_enc_codebook *cb)
cb
->
pow2
=
cb
->
dimensions
=
NULL
;
}
else
{
int
vals
=
cb_lookup_vals
(
cb
->
lookup
,
cb
->
ndimensions
,
cb
->
nentries
);
cb
->
dimensions
=
av_malloc
(
sizeof
(
float
)
*
cb
->
nentries
*
cb
->
ndimensions
);
cb
->
pow2
=
av_mallocz
(
sizeof
(
float
)
*
cb
->
nentries
);
cb
->
dimensions
=
av_malloc
_array
(
cb
->
nentries
,
sizeof
(
float
)
*
cb
->
ndimensions
);
cb
->
pow2
=
av_mallocz
_array
(
cb
->
nentries
,
sizeof
(
float
)
);
if
(
!
cb
->
dimensions
||
!
cb
->
pow2
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
cb
->
nentries
;
i
++
)
{
...
...
@@ -201,7 +201,7 @@ static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
{
int
i
;
av_assert0
(
rc
->
type
==
2
);
rc
->
maxes
=
av_mallocz
(
sizeof
(
float
[
2
])
*
rc
->
classifications
);
rc
->
maxes
=
av_mallocz
_array
(
rc
->
classifications
,
sizeof
(
float
[
2
])
);
if
(
!
rc
->
maxes
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
rc
->
classifications
;
i
++
)
{
...
...
@@ -266,8 +266,8 @@ static int create_vorbis_context(vorbis_enc_context *venc,
cb
->
lookup
=
cvectors
[
book
].
lookup
;
cb
->
seq_p
=
0
;
cb
->
lens
=
av_malloc
(
sizeof
(
uint8_t
)
*
cb
->
nentries
);
cb
->
codewords
=
av_malloc
(
sizeof
(
uint32_t
)
*
cb
->
nentries
);
cb
->
lens
=
av_malloc
_array
(
cb
->
nentries
,
sizeof
(
uint8_t
)
);
cb
->
codewords
=
av_malloc
_array
(
cb
->
nentries
,
sizeof
(
uint32_t
)
);
if
(
!
cb
->
lens
||
!
cb
->
codewords
)
return
AVERROR
(
ENOMEM
);
memcpy
(
cb
->
lens
,
cvectors
[
book
].
clens
,
cvectors
[
book
].
len
);
...
...
@@ -275,7 +275,7 @@ static int create_vorbis_context(vorbis_enc_context *venc,
if
(
cb
->
lookup
)
{
vals
=
cb_lookup_vals
(
cb
->
lookup
,
cb
->
ndimensions
,
cb
->
nentries
);
cb
->
quantlist
=
av_malloc
(
sizeof
(
int
)
*
vals
);
cb
->
quantlist
=
av_malloc
_array
(
vals
,
sizeof
(
int
)
);
if
(
!
cb
->
quantlist
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
vals
;
i
++
)
...
...
@@ -305,7 +305,7 @@ static int create_vorbis_context(vorbis_enc_context *venc,
fc
->
nclasses
=
FFMAX
(
fc
->
nclasses
,
fc
->
partition_to_class
[
i
]);
}
fc
->
nclasses
++
;
fc
->
classes
=
av_malloc
(
sizeof
(
vorbis_enc_floor_class
)
*
fc
->
nclasses
);
fc
->
classes
=
av_malloc
_array
(
fc
->
nclasses
,
sizeof
(
vorbis_enc_floor_class
)
);
if
(
!
fc
->
classes
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
fc
->
nclasses
;
i
++
)
{
...
...
@@ -315,7 +315,7 @@ static int create_vorbis_context(vorbis_enc_context *venc,
c
->
subclass
=
floor_classes
[
i
].
subclass
;
c
->
masterbook
=
floor_classes
[
i
].
masterbook
;
books
=
(
1
<<
c
->
subclass
);
c
->
books
=
av_malloc
(
sizeof
(
int
)
*
books
);
c
->
books
=
av_malloc
_array
(
books
,
sizeof
(
int
)
);
if
(
!
c
->
books
)
return
AVERROR
(
ENOMEM
);
for
(
j
=
0
;
j
<
books
;
j
++
)
...
...
@@ -328,7 +328,7 @@ static int create_vorbis_context(vorbis_enc_context *venc,
for
(
i
=
0
;
i
<
fc
->
partitions
;
i
++
)
fc
->
values
+=
fc
->
classes
[
fc
->
partition_to_class
[
i
]].
dim
;
fc
->
list
=
av_malloc
(
sizeof
(
vorbis_floor1_entry
)
*
fc
->
values
);
fc
->
list
=
av_malloc
_array
(
fc
->
values
,
sizeof
(
vorbis_floor1_entry
)
);
if
(
!
fc
->
list
)
return
AVERROR
(
ENOMEM
);
fc
->
list
[
0
].
x
=
0
;
...
...
@@ -419,10 +419,10 @@ static int create_vorbis_context(vorbis_enc_context *venc,
venc
->
modes
[
0
].
mapping
=
0
;
venc
->
have_saved
=
0
;
venc
->
saved
=
av_malloc
(
sizeof
(
float
)
*
venc
->
channels
*
(
1
<<
venc
->
log2_blocksize
[
1
])
/
2
);
venc
->
samples
=
av_malloc
(
sizeof
(
float
)
*
venc
->
channels
*
(
1
<<
venc
->
log2_blocksize
[
1
]));
venc
->
floor
=
av_malloc
(
sizeof
(
float
)
*
venc
->
channels
*
(
1
<<
venc
->
log2_blocksize
[
1
])
/
2
);
venc
->
coeffs
=
av_malloc
(
sizeof
(
float
)
*
venc
->
channels
*
(
1
<<
venc
->
log2_blocksize
[
1
])
/
2
);
venc
->
saved
=
av_malloc
_array
(
sizeof
(
float
)
*
venc
->
channels
,
(
1
<<
venc
->
log2_blocksize
[
1
])
/
2
);
venc
->
samples
=
av_malloc
_array
(
sizeof
(
float
)
*
venc
->
channels
,
(
1
<<
venc
->
log2_blocksize
[
1
]));
venc
->
floor
=
av_malloc
_array
(
sizeof
(
float
)
*
venc
->
channels
,
(
1
<<
venc
->
log2_blocksize
[
1
])
/
2
);
venc
->
coeffs
=
av_malloc
_array
(
sizeof
(
float
)
*
venc
->
channels
,
(
1
<<
venc
->
log2_blocksize
[
1
])
/
2
);
if
(
!
venc
->
saved
||
!
venc
->
samples
||
!
venc
->
floor
||
!
venc
->
coeffs
)
return
AVERROR
(
ENOMEM
);
...
...
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