Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8c0c3d29
Commit
8c0c3d29
authored
Oct 29, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evr/mixer: Implement stream rectangle scaling.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2095a413
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
11 deletions
+51
-11
mixer.c
dlls/evr/mixer.c
+51
-11
No files found.
dlls/evr/mixer.c
View file @
8c0c3d29
...
...
@@ -1245,17 +1245,29 @@ static void video_mixer_scale_rect(RECT *rect, unsigned int width, unsigned int
}
}
static
void
video_mixer_normalize_rect
(
const
RECT
*
full
,
const
RECT
*
part
,
MFVideoNormalizedRect
*
ret
)
{
float
width
=
full
->
right
-
full
->
left
;
float
height
=
full
->
bottom
-
full
->
top
;
ret
->
left
=
(
part
->
left
-
full
->
left
)
/
width
;
ret
->
right
=
(
part
->
right
-
full
->
left
)
/
width
;
ret
->
bottom
=
(
part
->
bottom
-
full
->
top
)
/
height
;
ret
->
top
=
(
part
->
top
-
full
->
top
)
/
height
;
}
static
void
video_mixer_render
(
struct
video_mixer
*
mixer
,
IDirect3DSurface9
*
rt
)
{
DXVA2_VideoSample
samples
[
MAX_MIXER_INPUT_STREAMS
]
=
{{
0
}};
DXVA2_VideoProcessBltParams
params
=
{
0
};
MFVideoNormalizedRect
zoom_rect
;
MFVideoNormalizedRect
zoom_rect
,
norm
;
unsigned
int
i
,
sample_count
=
0
;
D3DSURFACE_DESC
desc
,
rt_desc
;
struct
input_stream
*
stream
;
D3DSURFACE_DESC
desc
;
HRESULT
hr
=
S_OK
;
unsigned
int
i
;
RECT
dst
;
IDirect3DSurface9_GetDesc
(
rt
,
&
desc
);
IDirect3DSurface9_GetDesc
(
rt
,
&
rt_
desc
);
if
(
FAILED
(
IMFAttributes_GetBlob
(
mixer
->
attributes
,
&
VIDEO_ZOOM_RECT
,
(
UINT8
*
)
&
zoom_rect
,
sizeof
(
zoom_rect
),
NULL
)))
...
...
@@ -1264,10 +1276,13 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt)
zoom_rect
.
right
=
zoom_rect
.
bottom
=
1
.
0
f
;
}
video_mixer_scale_rect
(
&
params
.
TargetRect
,
desc
.
Width
,
desc
.
Height
,
&
zoom_rect
);
SetRect
(
&
params
.
TargetRect
,
0
,
0
,
rt_desc
.
Width
,
rt_desc
.
Height
);
video_mixer_scale_rect
(
&
dst
,
rt_desc
.
Width
,
rt_desc
.
Height
,
&
zoom_rect
);
for
(
i
=
0
;
i
<
mixer
->
input_count
;
++
i
)
{
RECT
stream_dst
,
stream_vis
;
IDirect3DSurface9
*
surface
;
stream
=
mixer
->
zorder
[
i
];
...
...
@@ -1280,22 +1295,47 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt)
IDirect3DSurface9_GetDesc
(
surface
,
&
desc
);
samples
[
i
].
SampleFormat
.
SampleFormat
=
stream
->
id
==
0
?
DXVA2_SampleProgressiveFrame
:
DXVA2_SampleSubStream
;
samples
[
i
].
SrcSurface
=
surface
;
SetRect
(
&
samples
[
i
].
SrcRect
,
0
,
0
,
desc
.
Width
,
desc
.
Height
);
video_mixer_scale_rect
(
&
samples
[
i
].
DstRect
,
desc
.
Width
,
desc
.
Height
,
&
stream
->
rect
);
/* In order to compute source/destination rectangles for each stream:
* per-stream rectangle is used to get destination rectangle in target coordinates;
* destination per-stream rectangle is clipped with zoom rectangle, applied to target coordinates;
* visible rectangle is scaled back to get source area of the stream that would be visible;
* visible rectangle is scaled back to get destination area in target coordinates for given steam.
*/
video_mixer_scale_rect
(
&
stream_dst
,
rt_desc
.
Width
,
rt_desc
.
Height
,
&
stream
->
rect
);
/* Part of the stream that's visible after zooming. */
if
(
!
IntersectRect
(
&
stream_vis
,
&
stream_dst
,
&
dst
))
{
IDirect3DSurface9_Release
(
surface
);
continue
;
}
samples
[
sample_count
].
SampleFormat
.
SampleFormat
=
stream
->
id
==
0
?
DXVA2_SampleProgressiveFrame
:
DXVA2_SampleSubStream
;
samples
[
sample_count
].
SrcSurface
=
surface
;
video_mixer_normalize_rect
(
&
stream_dst
,
&
stream_vis
,
&
norm
);
video_mixer_scale_rect
(
&
samples
[
sample_count
].
SrcRect
,
desc
.
Width
,
desc
.
Height
,
&
norm
);
video_mixer_normalize_rect
(
&
dst
,
&
stream_vis
,
&
norm
);
video_mixer_scale_rect
(
&
samples
[
sample_count
].
DstRect
,
rt_desc
.
Width
,
rt_desc
.
Height
,
&
norm
);
sample_count
++
;
}
if
(
SUCCEEDED
(
hr
))
{
if
(
FAILED
(
hr
=
IDirectXVideoProcessor_VideoProcessBlt
(
mixer
->
processor
,
rt
,
&
params
,
samples
,
mixer
->
input
_count
,
NULL
)))
sample
_count
,
NULL
)))
{
WARN
(
"Failed to process samples, hr %#x.
\n
"
,
hr
);
}
}
for
(
i
=
0
;
i
<
mixer
->
input
_count
;
++
i
)
for
(
i
=
0
;
i
<
sample
_count
;
++
i
)
{
if
(
samples
[
i
].
SrcSurface
)
IDirect3DSurface9_Release
(
samples
[
i
].
SrcSurface
);
...
...
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