Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
0fd0d4fd
Commit
0fd0d4fd
authored
7 years ago
by
Diego Biurrun
Browse files
Options
Downloads
Patches
Plain Diff
swscale-test: const correctness
parent
8fd8f91e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libswscale/tests/swscale.c
+14
-10
14 additions, 10 deletions
libswscale/tests/swscale.c
with
14 additions
and
10 deletions
libswscale/tests/swscale.c
+
14
−
10
View file @
0fd0d4fd
...
...
@@ -54,8 +54,8 @@
(x) == AV_PIX_FMT_RGB32_1 || \
(x) == AV_PIX_FMT_YUVA420P)
static
uint64_t
getSSD
(
uint8_t
*
src1
,
uint8_t
*
src2
,
int
stride1
,
int
stride2
,
int
w
,
int
h
)
static
uint64_t
getSSD
(
const
uint8_t
*
const
src1
,
const
uint8_t
*
const
src2
,
int
stride1
,
int
stride2
,
int
w
,
int
h
)
{
int
x
,
y
;
uint64_t
ssd
=
0
;
...
...
@@ -79,7 +79,7 @@ struct Results {
// test by ref -> src -> dst -> out & compare out against ref
// ref & out are YV12
static
int
doTest
(
uint8_t
*
ref
[
4
],
int
refStride
[
4
],
int
w
,
int
h
,
static
int
doTest
(
const
uint8_t
*
const
ref
[
4
],
int
refStride
[
4
],
int
w
,
int
h
,
enum
AVPixelFormat
srcFormat
,
enum
AVPixelFormat
dstFormat
,
int
srcW
,
int
srcH
,
int
dstW
,
int
dstH
,
int
flags
,
struct
Results
*
r
)
...
...
@@ -89,7 +89,7 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
const
AVPixFmtDescriptor
*
desc_dst
=
av_pix_fmt_desc_get
(
dstFormat
);
static
enum
AVPixelFormat
cur_srcFormat
;
static
int
cur_srcW
,
cur_srcH
;
static
uint8_t
*
src
[
4
];
static
const
uint8_t
*
src
[
4
];
static
int
srcStride
[
4
];
uint8_t
*
dst
[
4
]
=
{
0
};
uint8_t
*
out
[
4
]
=
{
0
};
...
...
@@ -126,7 +126,8 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
res
=
-
1
;
goto
end
;
}
sws_scale
(
srcContext
,
ref
,
refStride
,
0
,
h
,
src
,
srcStride
);
sws_scale
(
srcContext
,
ref
,
refStride
,
0
,
h
,
(
uint8_t
*
const
*
)
src
,
srcStride
);
sws_freeContext
(
srcContext
);
cur_srcFormat
=
srcFormat
;
...
...
@@ -198,7 +199,8 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
res
=
-
1
;
goto
end
;
}
sws_scale
(
outContext
,
dst
,
dstStride
,
0
,
dstH
,
out
,
refStride
);
sws_scale
(
outContext
,
(
const
uint8_t
*
const
*
)
dst
,
dstStride
,
0
,
dstH
,
out
,
refStride
);
ssdY
=
getSSD
(
ref
[
0
],
out
[
0
],
refStride
[
0
],
refStride
[
0
],
w
,
h
);
if
(
hasChroma
(
srcFormat
)
&&
hasChroma
(
dstFormat
))
{
...
...
@@ -236,7 +238,8 @@ end:
return
res
;
}
static
void
selfTest
(
uint8_t
*
ref
[
4
],
int
refStride
[
4
],
int
w
,
int
h
,
static
void
selfTest
(
const
uint8_t
*
const
ref
[
4
],
int
refStride
[
4
],
int
w
,
int
h
,
enum
AVPixelFormat
srcFormat_in
,
enum
AVPixelFormat
dstFormat_in
)
{
...
...
@@ -286,7 +289,8 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h,
}
}
static
int
fileTest
(
uint8_t
*
ref
[
4
],
int
refStride
[
4
],
int
w
,
int
h
,
FILE
*
fp
,
static
int
fileTest
(
const
uint8_t
*
const
ref
[
4
],
int
refStride
[
4
],
int
w
,
int
h
,
FILE
*
fp
,
enum
AVPixelFormat
srcFormat_in
,
enum
AVPixelFormat
dstFormat_in
)
{
...
...
@@ -348,7 +352,7 @@ int main(int argc, char **argv)
const
uint8_t
*
rgb_src
[
4
]
=
{
rgb_data
,
NULL
,
NULL
,
NULL
};
int
rgb_stride
[
4
]
=
{
4
*
W
,
0
,
0
,
0
};
uint8_t
*
data
=
av_malloc
(
4
*
W
*
H
);
uint8_t
*
src
[
4
]
=
{
data
,
data
+
W
*
H
,
data
+
W
*
H
*
2
,
data
+
W
*
H
*
3
};
const
uint8_t
*
const
src
[
4
]
=
{
data
,
data
+
W
*
H
,
data
+
W
*
H
*
2
,
data
+
W
*
H
*
3
};
int
stride
[
4
]
=
{
W
,
W
,
W
,
W
};
int
x
,
y
;
struct
SwsContext
*
sws
;
...
...
@@ -367,7 +371,7 @@ int main(int argc, char **argv)
for
(
y
=
0
;
y
<
H
;
y
++
)
for
(
x
=
0
;
x
<
W
*
4
;
x
++
)
rgb_data
[
x
+
y
*
4
*
W
]
=
av_lfg_get
(
&
rand
);
sws_scale
(
sws
,
rgb_src
,
rgb_stride
,
0
,
H
,
src
,
stride
);
sws_scale
(
sws
,
rgb_src
,
rgb_stride
,
0
,
H
,
(
uint8_t
*
const
*
)
src
,
stride
);
sws_freeContext
(
sws
);
av_free
(
rgb_data
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment