Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
fb4ac46d
Commit
fb4ac46d
authored
Apr 12, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/elbg: Use av_malloc(z)_array()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
46375e9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
elbg.c
libavcodec/elbg.c
+8
-8
No files found.
libavcodec/elbg.c
View file @
fb4ac46d
...
...
@@ -343,7 +343,7 @@ void avpriv_init_elbg(int *points, int dim, int numpoints, int *codebook,
if
(
numpoints
>
24
*
numCB
)
{
/* ELBG is very costly for a big number of points. So if we have a lot
of them, get a good initial codebook to save on iterations */
int
*
temp_points
=
av_malloc
(
dim
*
(
numpoints
/
8
)
*
sizeof
(
int
));
int
*
temp_points
=
av_malloc
_array
(
dim
,
(
numpoints
/
8
)
*
sizeof
(
int
));
for
(
i
=
0
;
i
<
numpoints
/
8
;
i
++
)
{
k
=
(
i
*
BIG_PRIME
)
%
numpoints
;
memcpy
(
temp_points
+
i
*
dim
,
points
+
k
*
dim
,
dim
*
sizeof
(
int
));
...
...
@@ -369,9 +369,9 @@ void avpriv_do_elbg(int *points, int dim, int numpoints, int *codebook,
elbg_data
elbg_d
;
elbg_data
*
elbg
=
&
elbg_d
;
int
i
,
j
,
k
,
last_error
,
steps
=
0
;
int
*
dist_cb
=
av_malloc
(
numpoints
*
sizeof
(
int
));
int
*
size_part
=
av_malloc
(
numCB
*
sizeof
(
int
));
cell
*
list_buffer
=
av_malloc
(
numpoints
*
sizeof
(
cell
));
int
*
dist_cb
=
av_malloc
_array
(
numpoints
,
sizeof
(
int
));
int
*
size_part
=
av_malloc
_array
(
numCB
,
sizeof
(
int
));
cell
*
list_buffer
=
av_malloc
_array
(
numpoints
,
sizeof
(
cell
));
cell
*
free_cells
;
int
best_dist
,
best_idx
=
0
;
...
...
@@ -379,12 +379,12 @@ void avpriv_do_elbg(int *points, int dim, int numpoints, int *codebook,
elbg
->
dim
=
dim
;
elbg
->
numCB
=
numCB
;
elbg
->
codebook
=
codebook
;
elbg
->
cells
=
av_malloc
(
numCB
*
sizeof
(
cell
*
));
elbg
->
utility
=
av_malloc
(
numCB
*
sizeof
(
int
));
elbg
->
cells
=
av_malloc
_array
(
numCB
,
sizeof
(
cell
*
));
elbg
->
utility
=
av_malloc
_array
(
numCB
,
sizeof
(
int
));
elbg
->
nearest_cb
=
closest_cb
;
elbg
->
points
=
points
;
elbg
->
utility_inc
=
av_malloc
(
numCB
*
sizeof
(
*
elbg
->
utility_inc
));
elbg
->
scratchbuf
=
av_malloc
(
5
*
dim
*
sizeof
(
int
));
elbg
->
utility_inc
=
av_malloc
_array
(
numCB
,
sizeof
(
*
elbg
->
utility_inc
));
elbg
->
scratchbuf
=
av_malloc
_array
(
5
*
dim
,
sizeof
(
int
));
elbg
->
rand_state
=
rand_state
;
...
...
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