Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
savoirfairelinux
jami-daemon
Commits
96614853
Commit
96614853
authored
11 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
video: refactor blit() code
parent
4e868771
Branches
Branches containing commit
Tags
2.2.1rc1
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
daemon/src/video/video_base.cpp
+14
-32
14 additions, 32 deletions
daemon/src/video/video_base.cpp
with
14 additions
and
32 deletions
daemon/src/video/video_base.cpp
+
14
−
32
View file @
96614853
...
@@ -158,38 +158,20 @@ int VideoFrame::blit(VideoFrame &src, int xoff, int yoff)
...
@@ -158,38 +158,20 @@ int VideoFrame::blit(VideoFrame &src, int xoff, int yoff)
return
-
1
;
return
-
1
;
}
}
uint8_t
*
src_data
,
*
dst_data
;
auto
copy_plane
=
[
&
]
(
unsigned
idx
)
{
ssize_t
dst_stride
;
const
unsigned
divisor
=
idx
==
0
?
1
:
2
;
ssize_t
dst_stride
=
frame_
->
linesize
[
idx
];
// Y
uint8_t
*
src_data
=
src_frame
->
data
[
idx
];
dst_stride
=
frame_
->
linesize
[
0
];
uint8_t
*
dst_data
=
frame_
->
data
[
idx
]
+
yoff
/
divisor
*
dst_stride
+
xoff
/
divisor
;
src_data
=
src_frame
->
data
[
0
];
for
(
unsigned
i
=
0
;
i
<
src_frame
->
height
/
divisor
;
i
++
)
{
dst_data
=
frame_
->
data
[
0
]
+
yoff
*
dst_stride
+
xoff
;
memcpy
(
dst_data
,
src_data
,
src_frame
->
linesize
[
idx
]);
for
(
int
i
=
0
;
i
<
src_frame
->
height
;
i
++
)
{
src_data
+=
src_frame
->
linesize
[
idx
];
memcpy
(
dst_data
,
src_data
,
src_frame
->
linesize
[
0
]);
src_data
+=
src_frame
->
linesize
[
0
];
dst_data
+=
dst_stride
;
}
// U
dst_stride
=
frame_
->
linesize
[
1
];
src_data
=
src_frame
->
data
[
1
];
dst_data
=
frame_
->
data
[
1
]
+
yoff
/
2
*
dst_stride
+
xoff
/
2
;
for
(
int
i
=
0
;
i
<
src_frame
->
height
/
2
;
i
++
)
{
memcpy
(
dst_data
,
src_data
,
src_frame
->
linesize
[
1
]);
src_data
+=
src_frame
->
linesize
[
1
];
dst_data
+=
dst_stride
;
dst_data
+=
dst_stride
;
}
}
};
// V
for
(
unsigned
plane
=
0
;
plane
<
3
;
++
plane
)
dst_stride
=
frame_
->
linesize
[
2
];
copy_plane
(
plane
);
src_data
=
src_frame
->
data
[
2
];
dst_data
=
frame_
->
data
[
2
]
+
yoff
/
2
*
dst_stride
+
xoff
/
2
;
for
(
int
i
=
0
;
i
<
src_frame
->
height
/
2
;
i
++
)
{
memcpy
(
dst_data
,
src_data
,
src_frame
->
linesize
[
2
]);
src_data
+=
src_frame
->
linesize
[
2
];
dst_data
+=
dst_stride
;
}
return
0
;
return
0
;
}
}
...
...
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