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
45743239
Commit
45743239
authored
Feb 14, 2016
by
Timothy Gu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_blend: Reduce number of arguments for kernel function
parent
ee281b88
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
17 deletions
+17
-17
blend.h
libavfilter/blend.h
+1
-1
vf_blend.c
libavfilter/vf_blend.c
+14
-13
vf_blend.asm
libavfilter/x86/vf_blend.asm
+1
-2
vf_blend_init.c
libavfilter/x86/vf_blend_init.c
+1
-1
No files found.
libavfilter/blend.h
View file @
45743239
...
@@ -67,7 +67,7 @@ typedef struct FilterParams {
...
@@ -67,7 +67,7 @@ typedef struct FilterParams {
void
(
*
blend
)(
const
uint8_t
*
top
,
ptrdiff_t
top_linesize
,
void
(
*
blend
)(
const
uint8_t
*
top
,
ptrdiff_t
top_linesize
,
const
uint8_t
*
bottom
,
ptrdiff_t
bottom_linesize
,
const
uint8_t
*
bottom
,
ptrdiff_t
bottom_linesize
,
uint8_t
*
dst
,
ptrdiff_t
dst_linesize
,
uint8_t
*
dst
,
ptrdiff_t
dst_linesize
,
ptrdiff_t
width
,
ptrdiff_t
start
,
ptrdiff_t
end
,
ptrdiff_t
width
,
ptrdiff_t
height
,
struct
FilterParams
*
param
,
double
*
values
);
struct
FilterParams
*
param
,
double
*
values
);
}
FilterParams
;
}
FilterParams
;
...
...
libavfilter/vf_blend.c
View file @
45743239
...
@@ -122,11 +122,11 @@ AVFILTER_DEFINE_CLASS(blend);
...
@@ -122,11 +122,11 @@ AVFILTER_DEFINE_CLASS(blend);
static void blend_copy ## src(const uint8_t *top, ptrdiff_t top_linesize, \
static void blend_copy ## src(const uint8_t *top, ptrdiff_t top_linesize, \
const uint8_t *bottom, ptrdiff_t bottom_linesize,\
const uint8_t *bottom, ptrdiff_t bottom_linesize,\
uint8_t *dst, ptrdiff_t dst_linesize, \
uint8_t *dst, ptrdiff_t dst_linesize, \
ptrdiff_t width, ptrdiff_t
start, ptrdiff_t end,
\
ptrdiff_t width, ptrdiff_t
height,
\
FilterParams *param, double *values) \
FilterParams *param, double *values) \
{ \
{ \
av_image_copy_plane(dst, dst_linesize, src, src ## _linesize, \
av_image_copy_plane(dst, dst_linesize, src, src ## _linesize, \
width,
end - star
t); \
width,
heigh
t); \
}
}
COPY
(
top
)
COPY
(
top
)
...
@@ -137,13 +137,13 @@ COPY(bottom)
...
@@ -137,13 +137,13 @@ COPY(bottom)
static
void
blend_normal_8bit
(
const
uint8_t
*
top
,
ptrdiff_t
top_linesize
,
static
void
blend_normal_8bit
(
const
uint8_t
*
top
,
ptrdiff_t
top_linesize
,
const
uint8_t
*
bottom
,
ptrdiff_t
bottom_linesize
,
const
uint8_t
*
bottom
,
ptrdiff_t
bottom_linesize
,
uint8_t
*
dst
,
ptrdiff_t
dst_linesize
,
uint8_t
*
dst
,
ptrdiff_t
dst_linesize
,
ptrdiff_t
width
,
ptrdiff_t
start
,
ptrdiff_t
end
,
ptrdiff_t
width
,
ptrdiff_t
height
,
FilterParams
*
param
,
double
*
values
)
FilterParams
*
param
,
double
*
values
)
{
{
const
double
opacity
=
param
->
opacity
;
const
double
opacity
=
param
->
opacity
;
int
i
,
j
;
int
i
,
j
;
for
(
i
=
start
;
i
<
end
;
i
++
)
{
for
(
i
=
0
;
i
<
height
;
i
++
)
{
for
(
j
=
0
;
j
<
width
;
j
++
)
{
for
(
j
=
0
;
j
<
width
;
j
++
)
{
dst
[
j
]
=
top
[
j
]
*
opacity
+
bottom
[
j
]
*
(
1
.
-
opacity
);
dst
[
j
]
=
top
[
j
]
*
opacity
+
bottom
[
j
]
*
(
1
.
-
opacity
);
}
}
...
@@ -156,7 +156,7 @@ static void blend_normal_8bit(const uint8_t *top, ptrdiff_t top_linesize,
...
@@ -156,7 +156,7 @@ static void blend_normal_8bit(const uint8_t *top, ptrdiff_t top_linesize,
static
void
blend_normal_16bit
(
const
uint8_t
*
_top
,
ptrdiff_t
top_linesize
,
static
void
blend_normal_16bit
(
const
uint8_t
*
_top
,
ptrdiff_t
top_linesize
,
const
uint8_t
*
_bottom
,
ptrdiff_t
bottom_linesize
,
const
uint8_t
*
_bottom
,
ptrdiff_t
bottom_linesize
,
uint8_t
*
_dst
,
ptrdiff_t
dst_linesize
,
uint8_t
*
_dst
,
ptrdiff_t
dst_linesize
,
ptrdiff_t
width
,
ptrdiff_t
start
,
ptrdiff_t
end
,
ptrdiff_t
width
,
ptrdiff_t
height
,
FilterParams
*
param
,
double
*
values
)
FilterParams
*
param
,
double
*
values
)
{
{
const
uint16_t
*
top
=
(
uint16_t
*
)
_top
;
const
uint16_t
*
top
=
(
uint16_t
*
)
_top
;
...
@@ -168,7 +168,7 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
...
@@ -168,7 +168,7 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
top_linesize
/=
2
;
top_linesize
/=
2
;
bottom_linesize
/=
2
;
bottom_linesize
/=
2
;
for
(
i
=
start
;
i
<
end
;
i
++
)
{
for
(
i
=
0
;
i
<
height
;
i
++
)
{
for
(
j
=
0
;
j
<
width
;
j
++
)
{
for
(
j
=
0
;
j
<
width
;
j
++
)
{
dst
[
j
]
=
top
[
j
]
*
opacity
+
bottom
[
j
]
*
(
1
.
-
opacity
);
dst
[
j
]
=
top
[
j
]
*
opacity
+
bottom
[
j
]
*
(
1
.
-
opacity
);
}
}
...
@@ -182,13 +182,13 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
...
@@ -182,13 +182,13 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize, \
static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize, \
const uint8_t *bottom, ptrdiff_t bottom_linesize, \
const uint8_t *bottom, ptrdiff_t bottom_linesize, \
uint8_t *dst, ptrdiff_t dst_linesize, \
uint8_t *dst, ptrdiff_t dst_linesize, \
ptrdiff_t width, ptrdiff_t
start, ptrdiff_t end
, \
ptrdiff_t width, ptrdiff_t
height
, \
FilterParams *param, double *values) \
FilterParams *param, double *values) \
{ \
{ \
double opacity = param->opacity; \
double opacity = param->opacity; \
int i, j; \
int i, j; \
\
\
for (i =
start; i < end; i++) {
\
for (i =
0; i < height; i++) {
\
for (j = 0; j < width; j++) { \
for (j = 0; j < width; j++) { \
dst[j] = top[j] + ((expr) - top[j]) * opacity; \
dst[j] = top[j] + ((expr) - top[j]) * opacity; \
} \
} \
...
@@ -202,7 +202,7 @@ static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize,
...
@@ -202,7 +202,7 @@ static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize,
static void blend_## name##_16bit(const uint8_t *_top, ptrdiff_t top_linesize, \
static void blend_## name##_16bit(const uint8_t *_top, ptrdiff_t top_linesize, \
const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
uint8_t *_dst, ptrdiff_t dst_linesize, \
uint8_t *_dst, ptrdiff_t dst_linesize, \
ptrdiff_t width, ptrdiff_t
start, ptrdiff_t end,
\
ptrdiff_t width, ptrdiff_t
height,
\
FilterParams *param, double *values) \
FilterParams *param, double *values) \
{ \
{ \
const uint16_t *top = (uint16_t*)_top; \
const uint16_t *top = (uint16_t*)_top; \
...
@@ -214,7 +214,7 @@ static void blend_## name##_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
...
@@ -214,7 +214,7 @@ static void blend_## name##_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
top_linesize /= 2; \
top_linesize /= 2; \
bottom_linesize /= 2; \
bottom_linesize /= 2; \
\
\
for (i =
start; i < end; i++) {
\
for (i =
0; i < height; i++) {
\
for (j = 0; j < width; j++) { \
for (j = 0; j < width; j++) { \
dst[j] = top[j] + ((expr) - top[j]) * opacity; \
dst[j] = top[j] + ((expr) - top[j]) * opacity; \
} \
} \
...
@@ -306,7 +306,7 @@ DEFINE_BLEND16(linearlight,av_clip_uint16((B < 32768) ? B + 2 * A - 65535 : B +
...
@@ -306,7 +306,7 @@ DEFINE_BLEND16(linearlight,av_clip_uint16((B < 32768) ? B + 2 * A - 65535 : B +
static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize, \
static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize, \
const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
uint8_t *_dst, ptrdiff_t dst_linesize, \
uint8_t *_dst, ptrdiff_t dst_linesize, \
ptrdiff_t width, ptrdiff_t
start, ptrdiff_t end,
\
ptrdiff_t width, ptrdiff_t
height,
\
FilterParams *param, double *values) \
FilterParams *param, double *values) \
{ \
{ \
const type *top = (type*)_top; \
const type *top = (type*)_top; \
...
@@ -318,7 +318,7 @@ static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize,
...
@@ -318,7 +318,7 @@ static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize,
top_linesize /= div; \
top_linesize /= div; \
bottom_linesize /= div; \
bottom_linesize /= div; \
\
\
for (y =
start; y < end; y++) {
\
for (y =
0; y < height; y++) {
\
values[VAR_Y] = y; \
values[VAR_Y] = y; \
for (x = 0; x < width; x++) { \
for (x = 0; x < width; x++) { \
values[VAR_X] = x; \
values[VAR_X] = x; \
...
@@ -340,6 +340,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
...
@@ -340,6 +340,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
ThreadData
*
td
=
arg
;
ThreadData
*
td
=
arg
;
int
slice_start
=
(
td
->
h
*
jobnr
)
/
nb_jobs
;
int
slice_start
=
(
td
->
h
*
jobnr
)
/
nb_jobs
;
int
slice_end
=
(
td
->
h
*
(
jobnr
+
1
))
/
nb_jobs
;
int
slice_end
=
(
td
->
h
*
(
jobnr
+
1
))
/
nb_jobs
;
int
height
=
slice_end
-
slice_start
;
const
uint8_t
*
top
=
td
->
top
->
data
[
td
->
plane
];
const
uint8_t
*
top
=
td
->
top
->
data
[
td
->
plane
];
const
uint8_t
*
bottom
=
td
->
bottom
->
data
[
td
->
plane
];
const
uint8_t
*
bottom
=
td
->
bottom
->
data
[
td
->
plane
];
uint8_t
*
dst
=
td
->
dst
->
data
[
td
->
plane
];
uint8_t
*
dst
=
td
->
dst
->
data
[
td
->
plane
];
...
@@ -358,7 +359,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
...
@@ -358,7 +359,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
td
->
bottom
->
linesize
[
td
->
plane
],
td
->
bottom
->
linesize
[
td
->
plane
],
dst
+
slice_start
*
td
->
dst
->
linesize
[
td
->
plane
],
dst
+
slice_start
*
td
->
dst
->
linesize
[
td
->
plane
],
td
->
dst
->
linesize
[
td
->
plane
],
td
->
dst
->
linesize
[
td
->
plane
],
td
->
w
,
slice_start
,
slice_end
,
td
->
param
,
&
values
[
0
]);
td
->
w
,
height
,
td
->
param
,
&
values
[
0
]);
return
0
;
return
0
;
}
}
...
...
libavfilter/x86/vf_blend.asm
View file @
45743239
...
@@ -42,11 +42,10 @@ cglobal blend_%1, 5, 7, %2, top, top_linesize, bottom, bottom_linesize, dst, end
...
@@ -42,11 +42,10 @@ cglobal blend_%1, 5, 7, %2, top, top_linesize, bottom, bottom_linesize, dst, end
%define
dst_linesizeq
r5mp
%define
dst_linesizeq
r5mp
%define
widthq
r6mp
%define
widthq
r6mp
%endif
%endif
mov
endd
,
dword
r
8
m
mov
endd
,
dword
r
7
m
add
topq
,
widthq
add
topq
,
widthq
add
bottomq
,
widthq
add
bottomq
,
widthq
add
dstq
,
widthq
add
dstq
,
widthq
sub
endd
,
dword
r7m
; start
neg
widthq
neg
widthq
%endmacro
%endmacro
...
...
libavfilter/x86/vf_blend_init.c
View file @
45743239
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
void ff_blend_##name##_##opt(const uint8_t *top, ptrdiff_t top_linesize, \
void ff_blend_##name##_##opt(const uint8_t *top, ptrdiff_t top_linesize, \
const uint8_t *bottom, ptrdiff_t bottom_linesize, \
const uint8_t *bottom, ptrdiff_t bottom_linesize, \
uint8_t *dst, ptrdiff_t dst_linesize, \
uint8_t *dst, ptrdiff_t dst_linesize, \
ptrdiff_t width, ptrdiff_t
start, ptrdiff_t end,
\
ptrdiff_t width, ptrdiff_t
height,
\
struct FilterParams *param, double *values);
struct FilterParams *param, double *values);
BLEND_FUNC
(
addition
,
sse2
)
BLEND_FUNC
(
addition
,
sse2
)
...
...
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