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
656fe7ec
Commit
656fe7ec
authored
May 04, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale/utils: use FF_ALLOC(Z)_ARRAY_OR_GOTO() and av_malloc(z)_array()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
beecfa81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
utils.c
libswscale/utils.c
+13
-13
No files found.
libswscale/utils.c
View file @
656fe7ec
...
@@ -312,13 +312,13 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -312,13 +312,13 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
emms_c
();
// FIXME should not be required but IS (even for non-MMX versions)
emms_c
();
// FIXME should not be required but IS (even for non-MMX versions)
// NOTE: the +3 is for the MMX(+1) / SSE(+3) scaler which reads over the end
// NOTE: the +3 is for the MMX(+1) / SSE(+3) scaler which reads over the end
FF_ALLOC_
OR_GOTO
(
NULL
,
*
filterPos
,
(
dstW
+
3
)
*
sizeof
(
**
filterPos
),
fail
);
FF_ALLOC_
ARRAY_OR_GOTO
(
NULL
,
*
filterPos
,
(
dstW
+
3
),
sizeof
(
**
filterPos
),
fail
);
if
(
FFABS
(
xInc
-
0x10000
)
<
10
&&
srcPos
==
dstPos
)
{
// unscaled
if
(
FFABS
(
xInc
-
0x10000
)
<
10
&&
srcPos
==
dstPos
)
{
// unscaled
int
i
;
int
i
;
filterSize
=
1
;
filterSize
=
1
;
FF_ALLOCZ_OR_GOTO
(
NULL
,
filter
,
FF_ALLOCZ_
ARRAY_
OR_GOTO
(
NULL
,
filter
,
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
dstW
,
sizeof
(
*
filter
)
*
filterSize
,
fail
);
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
filter
[
i
*
filterSize
]
=
fone
;
filter
[
i
*
filterSize
]
=
fone
;
...
@@ -328,8 +328,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -328,8 +328,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
int
i
;
int
i
;
int64_t
xDstInSrc
;
int64_t
xDstInSrc
;
filterSize
=
1
;
filterSize
=
1
;
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
FF_ALLOC_
ARRAY_
OR_GOTO
(
NULL
,
filter
,
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
dstW
,
sizeof
(
*
filter
)
*
filterSize
,
fail
);
xDstInSrc
=
((
dstPos
*
(
int64_t
)
xInc
)
>>
8
)
-
((
srcPos
*
0x8000LL
)
>>
7
);
xDstInSrc
=
((
dstPos
*
(
int64_t
)
xInc
)
>>
8
)
-
((
srcPos
*
0x8000LL
)
>>
7
);
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
...
@@ -344,8 +344,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -344,8 +344,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
int
i
;
int
i
;
int64_t
xDstInSrc
;
int64_t
xDstInSrc
;
filterSize
=
2
;
filterSize
=
2
;
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
FF_ALLOC_
ARRAY_
OR_GOTO
(
NULL
,
filter
,
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
dstW
,
sizeof
(
*
filter
)
*
filterSize
,
fail
);
xDstInSrc
=
((
dstPos
*
(
int64_t
)
xInc
)
>>
8
)
-
((
srcPos
*
0x8000LL
)
>>
7
);
xDstInSrc
=
((
dstPos
*
(
int64_t
)
xInc
)
>>
8
)
-
((
srcPos
*
0x8000LL
)
>>
7
);
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
...
@@ -385,8 +385,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -385,8 +385,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
filterSize
=
FFMIN
(
filterSize
,
srcW
-
2
);
filterSize
=
FFMIN
(
filterSize
,
srcW
-
2
);
filterSize
=
FFMAX
(
filterSize
,
1
);
filterSize
=
FFMAX
(
filterSize
,
1
);
FF_ALLOC_OR_GOTO
(
NULL
,
filter
,
FF_ALLOC_
ARRAY_
OR_GOTO
(
NULL
,
filter
,
dstW
*
sizeof
(
*
filter
)
*
filterSize
,
fail
);
dstW
,
sizeof
(
*
filter
)
*
filterSize
,
fail
);
xDstInSrc
=
((
dstPos
*
(
int64_t
)
xInc
)
>>
7
)
-
((
srcPos
*
0x10000LL
)
>>
7
);
xDstInSrc
=
((
dstPos
*
(
int64_t
)
xInc
)
>>
7
)
-
((
srcPos
*
0x10000LL
)
>>
7
);
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
...
@@ -493,7 +493,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -493,7 +493,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
if
(
dstFilter
)
if
(
dstFilter
)
filter2Size
+=
dstFilter
->
length
-
1
;
filter2Size
+=
dstFilter
->
length
-
1
;
av_assert0
(
filter2Size
>
0
);
av_assert0
(
filter2Size
>
0
);
FF_ALLOCZ_
OR_GOTO
(
NULL
,
filter2
,
filter2Size
*
dstW
*
sizeof
(
*
filter2
),
fail
);
FF_ALLOCZ_
ARRAY_OR_GOTO
(
NULL
,
filter2
,
dstW
,
filter2Size
*
sizeof
(
*
filter2
),
fail
);
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
j
,
k
;
int
j
,
k
;
...
@@ -577,7 +577,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -577,7 +577,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
av_assert0
(
minFilterSize
>
0
);
av_assert0
(
minFilterSize
>
0
);
filterSize
=
(
minFilterSize
+
(
filterAlign
-
1
))
&
(
~
(
filterAlign
-
1
));
filterSize
=
(
minFilterSize
+
(
filterAlign
-
1
))
&
(
~
(
filterAlign
-
1
));
av_assert0
(
filterSize
>
0
);
av_assert0
(
filterSize
>
0
);
filter
=
av_malloc
(
filterSize
*
dstW
*
sizeof
(
*
filter
));
filter
=
av_malloc
_array
(
dstW
,
filterSize
*
sizeof
(
*
filter
));
if
(
!
filter
)
if
(
!
filter
)
goto
fail
;
goto
fail
;
if
(
filterSize
>=
MAX_FILTER_SIZE
*
16
/
if
(
filterSize
>=
MAX_FILTER_SIZE
*
16
/
...
@@ -635,8 +635,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
...
@@ -635,8 +635,8 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
// Note the +1 is for the MMX scaler which reads over the end
// Note the +1 is for the MMX scaler which reads over the end
/* align at 16 for AltiVec (needed by hScale_altivec_real) */
/* align at 16 for AltiVec (needed by hScale_altivec_real) */
FF_ALLOCZ_OR_GOTO
(
NULL
,
*
outFilter
,
FF_ALLOCZ_
ARRAY_
OR_GOTO
(
NULL
,
*
outFilter
,
*
outFilterSize
*
(
dstW
+
3
)
*
sizeof
(
int16_t
),
fail
);
(
dstW
+
3
),
*
outFilterSize
*
sizeof
(
int16_t
),
fail
);
/* normalize & store in outFilter */
/* normalize & store in outFilter */
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
...
...
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