Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
8f83ef4b
Commit
8f83ef4b
authored
Sep 20, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed subpicture_region_t->picture into a picture_t *
It will avoid useless picture copy.
parent
692cad3b
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
225 additions
and
229 deletions
+225
-229
include/vlc_vout.h
include/vlc_vout.h
+7
-2
modules/codec/csri.c
modules/codec/csri.c
+3
-3
modules/codec/cvdsub.c
modules/codec/cvdsub.c
+3
-3
modules/codec/dvbsub.c
modules/codec/dvbsub.c
+27
-27
modules/codec/kate.c
modules/codec/kate.c
+1
-1
modules/codec/libass.c
modules/codec/libass.c
+1
-1
modules/codec/spudec/parse.c
modules/codec/spudec/parse.c
+2
-2
modules/codec/subtitles/subsusf.c
modules/codec/subtitles/subsusf.c
+6
-5
modules/codec/svcdsub.c
modules/codec/svcdsub.c
+3
-3
modules/codec/zvbi.c
modules/codec/zvbi.c
+2
-2
modules/gui/fbosd.c
modules/gui/fbosd.c
+5
-6
modules/misc/freetype.c
modules/misc/freetype.c
+26
-37
modules/misc/quartztext.c
modules/misc/quartztext.c
+10
-15
modules/misc/svg.c
modules/misc/svg.c
+11
-16
modules/misc/win32text.c
modules/misc/win32text.c
+8
-14
modules/video_filter/dynamicoverlay/dynamicoverlay.c
modules/video_filter/dynamicoverlay/dynamicoverlay.c
+2
-1
modules/video_filter/logo.c
modules/video_filter/logo.c
+2
-1
modules/video_filter/mosaic.c
modules/video_filter/mosaic.c
+2
-2
modules/video_filter/osdmenu.c
modules/video_filter/osdmenu.c
+2
-1
modules/video_filter/remoteosd.c
modules/video_filter/remoteosd.c
+2
-1
modules/video_filter/rss.c
modules/video_filter/rss.c
+2
-1
src/osd/osd_widgets.c
src/osd/osd_widgets.c
+11
-11
src/video_output/vout_intf.c
src/video_output/vout_intf.c
+8
-2
src/video_output/vout_subpictures.c
src/video_output/vout_subpictures.c
+79
-72
No files found.
include/vlc_vout.h
View file @
8f83ef4b
...
...
@@ -289,6 +289,11 @@ struct picture_heap_t
* @{
*/
/**
* Video subtitle region spu core private
*/
typedef
struct
subpicture_region_private_t
subpicture_region_private_t
;
/**
* Video subtitle region
*
...
...
@@ -299,7 +304,7 @@ struct picture_heap_t
struct
subpicture_region_t
{
video_format_t
fmt
;
/**< format of the picture */
picture_t
picture
;
/**< picture comprising this region */
picture_t
*
p_picture
;
/**< picture comprising this region */
int
i_x
;
/**< position of region */
int
i_y
;
/**< position of region */
...
...
@@ -311,7 +316,7 @@ struct subpicture_region_t
text_style_t
*
p_style
;
/**< a description of the text style formatting */
subpicture_region_t
*
p_next
;
/**< next region in the list */
subpicture_region_
t
*
p_cache
;
/**< modified version of this region */
subpicture_region_
private_t
*
p_private
;
/**< modified version of this region */
};
/**
...
...
modules/codec/csri.c
View file @
8f83ef4b
...
...
@@ -305,14 +305,14 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
/* */
p_spu_region
->
i_align
=
SUBPICTURE_ALIGN_TOP
|
SUBPICTURE_ALIGN_LEFT
;
memset
(
p_spu_region
->
p
icture
.
Y_PIXELS
,
0x00
,
p_spu_region
->
picture
.
Y_PITCH
*
p_sys
->
fmt_cached
.
i_height
);
memset
(
p_spu_region
->
p
_picture
->
Y_PIXELS
,
0x00
,
p_spu_region
->
p_picture
->
Y_PITCH
*
p_sys
->
fmt_cached
.
i_height
);
/* */
//msg_Dbg( p_dec, "TS %lf", ts * 0.000001 );
memset
(
&
csri_frame
,
0
,
sizeof
(
csri_frame
)
);
csri_frame
.
pixfmt
=
CSRI_F_BGRA
;
csri_frame
.
planes
[
0
]
=
(
unsigned
char
*
)
p_spu_region
->
p
icture
.
Y_PIXELS
;
csri_frame
.
strides
[
0
]
=
p_spu_region
->
p
icture
.
Y_PITCH
;
csri_frame
.
planes
[
0
]
=
(
unsigned
char
*
)
p_spu_region
->
p
_picture
->
Y_PIXELS
;
csri_frame
.
strides
[
0
]
=
p_spu_region
->
p
_picture
->
Y_PITCH
;
csri_render
(
p_sys
->
p_instance
,
&
csri_frame
,
ts
*
0
.
000001
);
}
}
...
...
modules/codec/cvdsub.c
View file @
8f83ef4b
...
...
@@ -569,7 +569,7 @@ static void RenderImage( decoder_t *p_dec, block_t *p_data,
subpicture_region_t
*
p_region
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
uint8_t
*
p_dest
=
p_region
->
p
icture
.
Y_PIXELS
;
uint8_t
*
p_dest
=
p_region
->
p
_picture
->
Y_PIXELS
;
int
i_field
;
/* The subtitles are interlaced */
int
i_row
,
i_column
;
/* scanline row/column number */
uint8_t
i_color
,
i_count
;
...
...
@@ -591,7 +591,7 @@ static void RenderImage( decoder_t *p_dec, block_t *p_data,
/* Fill the rest of the line with next color */
i_color
=
bs_read
(
&
bs
,
4
);
memset
(
&
p_dest
[
i_row
*
p_region
->
p
icture
.
Y_PITCH
+
memset
(
&
p_dest
[
i_row
*
p_region
->
p
_picture
->
Y_PITCH
+
i_column
],
i_color
,
p_sys
->
i_width
-
i_column
);
i_column
=
p_sys
->
i_width
;
...
...
@@ -605,7 +605,7 @@ static void RenderImage( decoder_t *p_dec, block_t *p_data,
i_count
=
__MIN
(
i_count
,
p_sys
->
i_width
-
i_column
);
memset
(
&
p_dest
[
i_row
*
p_region
->
p
icture
.
Y_PITCH
+
memset
(
&
p_dest
[
i_row
*
p_region
->
p
_picture
->
Y_PITCH
+
i_column
],
i_color
,
i_count
);
i_column
+=
i_count
-
1
;
continue
;
...
...
modules/codec/dvbsub.c
View file @
8f83ef4b
...
...
@@ -1571,8 +1571,8 @@ static subpicture_t *render( decoder_t *p_dec )
}
p_src
=
p_region
->
p_pixbuf
;
p_dst
=
p_spu_region
->
p
icture
.
Y_PIXELS
;
i_pitch
=
p_spu_region
->
p
icture
.
Y_PITCH
;
p_dst
=
p_spu_region
->
p
_picture
->
Y_PIXELS
;
i_pitch
=
p_spu_region
->
p
_picture
->
Y_PITCH
;
/* Copy pixel buffer */
for
(
j
=
0
;
j
<
p_region
->
i_height
;
j
++
)
...
...
@@ -1710,11 +1710,11 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
#else
int
*
pi_delta
;
#endif
int
i_pixels
=
p_region
->
p
icture
.
p
[
0
].
i_visible_lines
*
p_region
->
p
icture
.
p
[
0
].
i_pitch
;
int
i_iterator
=
p_region
->
p
icture
.
p
[
0
].
i_visible_lines
*
3
/
4
*
p_region
->
p
icture
.
p
[
0
].
i_pitch
+
p_region
->
p
icture
.
p
[
0
].
i_pitch
*
1
/
3
;
int
i_pixels
=
p_region
->
p
_picture
->
p
[
0
].
i_visible_lines
*
p_region
->
p
_picture
->
p
[
0
].
i_pitch
;
int
i_iterator
=
p_region
->
p
_picture
->
p
[
0
].
i_visible_lines
*
3
/
4
*
p_region
->
p
_picture
->
p
[
0
].
i_pitch
+
p_region
->
p
_picture
->
p
[
0
].
i_pitch
*
1
/
3
;
int
i_tolerance
=
0
;
#ifdef DEBUG_DVBSUB
...
...
@@ -1754,10 +1754,10 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
for
(
i
=
0
;
i
<
i_pixels
;
)
{
uint8_t
y
,
u
,
v
,
a
;
y
=
p_region
->
p
icture
.
p
[
0
].
p_pixels
[
i
];
u
=
p_region
->
p
icture
.
p
[
1
].
p_pixels
[
i
];
v
=
p_region
->
p
icture
.
p
[
2
].
p_pixels
[
i
];
a
=
p_region
->
p
icture
.
p
[
3
].
p_pixels
[
i
];
y
=
p_region
->
p
_picture
->
p
[
0
].
p_pixels
[
i
];
u
=
p_region
->
p
_picture
->
p
[
1
].
p_pixels
[
i
];
v
=
p_region
->
p
_picture
->
p
[
2
].
p_pixels
[
i
];
a
=
p_region
->
p
_picture
->
p
[
3
].
p_pixels
[
i
];
for
(
j
=
0
;
j
<
p_fmt
->
p_palette
->
i_entries
;
j
++
)
{
if
(
abs
((
int
)
p_fmt
->
p_palette
->
palette
[
j
][
0
]
-
(
int
)
y
)
<=
i_tolerance
&&
...
...
@@ -1799,29 +1799,29 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
#endif
#ifndef RANDOM_DITHERING
pi_delta
=
malloc
(
(
p_region
->
p
icture
.
p
[
0
].
i_pitch
+
1
)
pi_delta
=
malloc
(
(
p_region
->
p
_picture
->
p
[
0
].
i_pitch
+
1
)
*
sizeof
(
int
)
*
4
);
for
(
i
=
0
;
i
<
(
p_region
->
p
icture
.
p
[
0
].
i_pitch
+
1
)
*
4
;
i
++
)
for
(
i
=
0
;
i
<
(
p_region
->
p
_picture
->
p
[
0
].
i_pitch
+
1
)
*
4
;
i
++
)
{
pi_delta
[
i
]
=
0
;
}
#endif
/* Fill image with our new colours */
for
(
p
=
0
;
p
<
p_region
->
p
icture
.
p
[
0
].
i_visible_lines
;
p
++
)
for
(
p
=
0
;
p
<
p_region
->
p
_picture
->
p
[
0
].
i_visible_lines
;
p
++
)
{
int
i_ydelta
=
0
,
i_udelta
=
0
,
i_vdelta
=
0
,
i_adelta
=
0
;
for
(
n
=
0
;
n
<
p_region
->
p
icture
.
p
[
0
].
i_pitch
;
n
++
)
for
(
n
=
0
;
n
<
p_region
->
p
_picture
->
p
[
0
].
i_pitch
;
n
++
)
{
int
i_offset
=
p
*
p_region
->
p
icture
.
p
[
0
].
i_pitch
+
n
;
int
i_offset
=
p
*
p_region
->
p
_picture
->
p
[
0
].
i_pitch
+
n
;
int
y
,
u
,
v
,
a
;
int
i_mindist
,
i_best
;
y
=
(
int
)
p_region
->
p
icture
.
p
[
0
].
p_pixels
[
i_offset
];
u
=
(
int
)
p_region
->
p
icture
.
p
[
1
].
p_pixels
[
i_offset
];
v
=
(
int
)
p_region
->
p
icture
.
p
[
2
].
p_pixels
[
i_offset
];
a
=
(
int
)
p_region
->
p
icture
.
p
[
3
].
p_pixels
[
i_offset
];
y
=
(
int
)
p_region
->
p
_picture
->
p
[
0
].
p_pixels
[
i_offset
];
u
=
(
int
)
p_region
->
p
_picture
->
p
[
1
].
p_pixels
[
i_offset
];
v
=
(
int
)
p_region
->
p
_picture
->
p
[
2
].
p_pixels
[
i_offset
];
a
=
(
int
)
p_region
->
p
_picture
->
p
[
3
].
p_pixels
[
i_offset
];
/* Add dithering compensation */
#ifdef RANDOM_DITHERING
...
...
@@ -1854,7 +1854,7 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
}
/* Set pixel to best color */
p_region
->
p
icture
.
p
[
0
].
p_pixels
[
i_offset
]
=
i_best
;
p_region
->
p
_picture
->
p
[
0
].
p_pixels
[
i_offset
]
=
i_best
;
/* Update dithering state */
#ifdef RANDOM_DITHERING
...
...
@@ -2364,8 +2364,8 @@ static void encode_pixel_line_2bp( bs_t *s, subpicture_region_t *p_region,
int
i_line
)
{
unsigned
int
i
,
i_length
=
0
;
int
i_pitch
=
p_region
->
p
icture
.
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
p
icture
.
p
->
p_pixels
[
i_pitch
*
i_line
];
int
i_pitch
=
p_region
->
p
_picture
->
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
p
_picture
->
p
->
p_pixels
[
i_pitch
*
i_line
];
int
i_last_pixel
=
p_data
[
0
];
for
(
i
=
0
;
i
<=
p_region
->
fmt
.
i_visible_width
;
i
++
)
...
...
@@ -2455,8 +2455,8 @@ static void encode_pixel_line_4bp( bs_t *s, subpicture_region_t *p_region,
int
i_line
)
{
unsigned
int
i
,
i_length
=
0
;
int
i_pitch
=
p_region
->
p
icture
.
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
p
icture
.
p
->
p_pixels
[
i_pitch
*
i_line
];
int
i_pitch
=
p_region
->
p
_picture
->
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
p
_picture
->
p
->
p_pixels
[
i_pitch
*
i_line
];
int
i_last_pixel
=
p_data
[
0
];
for
(
i
=
0
;
i
<=
p_region
->
fmt
.
i_visible_width
;
i
++
)
...
...
@@ -2553,8 +2553,8 @@ static void encode_pixel_line_8bp( bs_t *s, subpicture_region_t *p_region,
int
i_line
)
{
unsigned
int
i
,
i_length
=
0
;
int
i_pitch
=
p_region
->
p
icture
.
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
p
icture
.
p
->
p_pixels
[
i_pitch
*
i_line
];
int
i_pitch
=
p_region
->
p
_picture
->
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
p
_picture
->
p
->
p_pixels
[
i_pitch
*
i_line
];
int
i_last_pixel
=
p_data
[
0
];
for
(
i
=
0
;
i
<=
p_region
->
fmt
.
i_visible_width
;
i
++
)
...
...
modules/codec/kate.c
View file @
8f83ef4b
...
...
@@ -640,7 +640,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
CreateKatePalette
(
fmt
.
p_palette
,
ev
->
palette
);
/* create the bitmap */
CreateKateBitmap
(
&
p_bitmap_region
->
picture
,
ev
->
bitmap
);
CreateKateBitmap
(
p_bitmap_region
->
p_
picture
,
ev
->
bitmap
);
msg_Dbg
(
p_dec
,
"Created bitmap, %zux%zu, %zu colors
\n
"
,
ev
->
bitmap
->
width
,
ev
->
bitmap
->
height
,
ev
->
palette
->
ncolors
);
}
...
...
modules/codec/libass.c
View file @
8f83ef4b
...
...
@@ -569,7 +569,7 @@ static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region,
static
void
RegionDraw
(
subpicture_region_t
*
p_region
,
ass_image_t
*
p_img
)
{
const
plane_t
*
p
=
&
p_region
->
p
icture
.
p
[
0
];
const
plane_t
*
p
=
&
p_region
->
p
_picture
->
p
[
0
];
const
int
i_x
=
p_region
->
i_x
;
const
int
i_y
=
p_region
->
i_y
;
const
int
i_width
=
p_region
->
fmt
.
i_width
;
...
...
modules/codec/spudec/parse.c
View file @
8f83ef4b
...
...
@@ -676,8 +676,8 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
p_spu
->
p_region
->
i_x
=
p_spu_properties
->
i_x
;
p_spu
->
p_region
->
i_y
=
p_spu_properties
->
i_y
+
p_spu_data
->
i_y_top_offset
;
p_p
=
p_spu
->
p_region
->
p
icture
.
p
->
p_pixels
;
i_pitch
=
p_spu
->
p_region
->
p
icture
.
p
->
i_pitch
;
p_p
=
p_spu
->
p_region
->
p
_picture
->
p
->
p_pixels
;
i_pitch
=
p_spu
->
p_region
->
p
_picture
->
p
->
i_pitch
;
/* Build palette */
fmt
.
p_palette
->
i_entries
=
4
;
...
...
modules/codec/subtitles/subsusf.c
View file @
8f83ef4b
...
...
@@ -1208,7 +1208,8 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
return
NULL
;
}
assert
(
p_pic
->
format
.
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
)
);
picture_CopyPixels
(
&
p_region
->
picture
,
p_pic
);
/* FIXME the copy is probably not needed anymore */
picture_CopyPixels
(
p_region
->
p_picture
,
p_pic
);
/* This isn't the best way to do this - if you really want transparency, then
* you're much better off using an image type that supports it like PNG. The
...
...
@@ -1231,11 +1232,11 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
{
for
(
unsigned
int
x
=
0
;
x
<
p_region
->
fmt
.
i_width
;
x
++
)
{
if
(
p_region
->
p
icture
.
Y_PIXELS
[
y
*
p_region
->
picture
.
Y_PITCH
+
x
]
!=
i_y
||
p_region
->
p
icture
.
U_PIXELS
[
y
*
p_region
->
picture
.
U_PITCH
+
x
]
!=
i_u
||
p_region
->
p
icture
.
V_PIXELS
[
y
*
p_region
->
picture
.
V_PITCH
+
x
]
!=
i_v
)
if
(
p_region
->
p
_picture
->
Y_PIXELS
[
y
*
p_region
->
p_picture
->
Y_PITCH
+
x
]
!=
i_y
||
p_region
->
p
_picture
->
U_PIXELS
[
y
*
p_region
->
p_picture
->
U_PITCH
+
x
]
!=
i_u
||
p_region
->
p
_picture
->
V_PIXELS
[
y
*
p_region
->
p_picture
->
V_PITCH
+
x
]
!=
i_v
)
continue
;
p_region
->
p
icture
.
A_PIXELS
[
y
*
p_region
->
picture
.
A_PITCH
+
x
]
=
0
;
p_region
->
p
_picture
->
A_PIXELS
[
y
*
p_region
->
p_picture
->
A_PITCH
+
x
]
=
0
;
}
}
...
...
modules/codec/svcdsub.c
View file @
8f83ef4b
...
...
@@ -544,7 +544,7 @@ static void SVCDSubRenderImage( decoder_t *p_dec, block_t *p_data,
subpicture_region_t
*
p_region
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
uint8_t
*
p_dest
=
p_region
->
p
icture
.
Y_PIXELS
;
uint8_t
*
p_dest
=
p_region
->
p
_picture
->
Y_PIXELS
;
int
i_field
;
/* The subtitles are interlaced */
int
i_row
,
i_column
;
/* scanline row/column number */
uint8_t
i_color
,
i_count
;
...
...
@@ -563,13 +563,13 @@ static void SVCDSubRenderImage( decoder_t *p_dec, block_t *p_data,
if
(
i_color
==
0
&&
(
i_count
=
bs_read
(
&
bs
,
2
))
)
{
i_count
=
__MIN
(
i_count
,
p_sys
->
i_width
-
i_column
);
memset
(
&
p_dest
[
i_row
*
p_region
->
p
icture
.
Y_PITCH
+
memset
(
&
p_dest
[
i_row
*
p_region
->
p
_picture
->
Y_PITCH
+
i_column
],
0
,
i_count
+
1
);
i_column
+=
i_count
;
continue
;
}
p_dest
[
i_row
*
p_region
->
p
icture
.
Y_PITCH
+
i_column
]
=
i_color
;
p_dest
[
i_row
*
p_region
->
p
_picture
->
Y_PITCH
+
i_column
]
=
i_color
;
}
bs_align
(
&
bs
);
...
...
modules/codec/zvbi.c
View file @
8f83ef4b
...
...
@@ -418,12 +418,12 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
}
else
{
picture_t
*
p_pic
=
&
p_spu
->
p_region
->
picture
;
picture_t
*
p_pic
=
p_spu
->
p_region
->
p_
picture
;
/* ZVBI is stupid enough to assume pitch == width */
p_pic
->
p
->
i_pitch
=
4
*
fmt
.
i_width
;
vbi_draw_vt_page
(
&
p_page
,
ZVBI_PIXFMT_RGBA32
,
p_spu
->
p_region
->
p
icture
.
p
->
p_pixels
,
1
,
1
);
p_spu
->
p_region
->
p
_picture
->
p
->
p_pixels
,
1
,
1
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
memcpy
(
p_sys
->
nav_link
,
&
p_page
.
nav_link
,
sizeof
(
p_sys
->
nav_link
))
;
...
...
modules/gui/fbosd.c
View file @
8f83ef4b
...
...
@@ -883,23 +883,22 @@ static picture_t *RenderText( intf_thread_t *p_intf, const char *psz_string,
fmt_out
.
i_bits_per_pixel
=
32
;
vlc_memcpy
(
p_fmt
,
&
fmt_out
,
sizeof
(
video_format_t
)
);
/* FIXME not needed to copy the picture anymore no ? */
p_dest
=
AllocatePicture
(
VLC_OBJECT
(
p_intf
),
&
fmt_out
);
if
(
!
p_dest
)
{
if
(
p_region
->
picture
.
pf_release
)
p_region
->
picture
.
pf_release
(
&
p_region
->
picture
);
picture_Release
(
p_region
->
p_picture
);
free
(
p_region
->
psz_text
);
free
(
p_region
);
return
NULL
;
}
vout_CopyPicture
(
VLC_OBJECT
(
p_intf
),
p_dest
,
&
p_region
->
picture
);
vout_CopyPicture
(
VLC_OBJECT
(
p_intf
),
p_dest
,
p_region
->
p_
picture
);
#else
fmt_out
.
i_chroma
=
p_fmt
->
i_chroma
;
p_dest
=
ConvertImage
(
p_intf
,
&
p_region
->
picture
,
p_dest
=
ConvertImage
(
p_intf
,
&
p_region
->
p
_p
icture
,
&
p_region
->
fmt
,
&
fmt_out
);
#endif
if
(
p_region
->
picture
.
pf_release
)
p_region
->
picture
.
pf_release
(
&
p_region
->
picture
);
picture_Release
(
p_region
->
p_picture
);
free
(
p_region
->
psz_text
);
free
(
p_region
);
return
p_dest
;
...
...
modules/misc/freetype.c
View file @
8f83ef4b
...
...
@@ -662,7 +662,6 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
int
i
,
x
,
y
,
i_pitch
;
uint8_t
i_y
;
/* YUV values, derived from incoming RGB */
int8_t
i_u
,
i_v
;
subpicture_region_t
*
p_region_tmp
;
/* Create a new subpicture region */
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
...
...
@@ -675,16 +674,12 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
if
(
p_region
->
fmt
.
i_visible_height
>
0
)
fmt
.
i_visible_height
=
p_region
->
fmt
.
i_visible_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region_tmp
=
spu_CreateRegion
(
p_filter
,
&
fmt
);
if
(
!
p_region_tmp
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
return
VLC_EGENERIC
;
}
p_region
->
fmt
=
p_region_tmp
->
fmt
;
p_region
->
picture
=
p_region_tmp
->
picture
;
free
(
p_region_tmp
);
assert
(
!
p_region
->
p_picture
);
p_region
->
p_picture
=
picture_New
(
fmt
.
i_chroma
,
fmt
.
i_width
,
fmt
.
i_height
,
fmt
.
i_aspect
);
if
(
!
p_region
->
p_picture
)
return
VLC_EGENERIC
;
p_region
->
fmt
=
fmt
;
/* Calculate text color components */
i_y
=
(
uint8_t
)((
66
*
p_line
->
i_red
+
129
*
p_line
->
i_green
+
...
...
@@ -715,8 +710,8 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
(
int
)
fmt
.
p_palette
->
palette
[
i
][
3
]
*
(
255
-
p_line
->
i_alpha
)
/
255
;
}
p_dst
=
p_region
->
p
icture
.
Y_PIXELS
;
i_pitch
=
p_region
->
p
icture
.
Y_PITCH
;
p_dst
=
p_region
->
p
_picture
->
Y_PIXELS
;
i_pitch
=
p_region
->
p
_picture
->
Y_PITCH
;
/* Initialize the region pixels */
memset
(
p_dst
,
0
,
i_pitch
*
p_region
->
fmt
.
i_height
);
...
...
@@ -768,21 +763,21 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
/* Outlining (find something better than nearest neighbour filtering ?) */
if
(
1
)
{
uint8_t
*
p_dst
=
p_region
->
p
icture
.
Y_PIXELS
;
uint8_t
*
p_dst
=
p_region
->
p
_picture
->
Y_PIXELS
;
uint8_t
*
p_top
=
p_dst
;
/* Use 1st line as a cache */
uint8_t
left
,
current
;
for
(
y
=
1
;
y
<
(
int
)
fmt
.
i_height
-
1
;
y
++
)
{
if
(
y
>
1
)
memcpy
(
p_top
,
p_dst
,
fmt
.
i_width
);
p_dst
+=
p_region
->
p
icture
.
Y_PITCH
;
p_dst
+=
p_region
->
p
_picture
->
Y_PITCH
;
left
=
0
;
for
(
x
=
1
;
x
<
(
int
)
fmt
.
i_width
-
1
;
x
++
)
{
current
=
p_dst
[
x
];
p_dst
[
x
]
=
(
8
*
(
int
)
p_dst
[
x
]
+
left
+
p_dst
[
x
+
1
]
+
p_top
[
x
-
1
]
+
p_top
[
x
]
+
p_top
[
x
+
1
]
+
p_dst
[
x
-
1
+
p_region
->
p
icture
.
Y_PITCH
]
+
p_dst
[
x
+
p_region
->
picture
.
Y_PITCH
]
+
p_dst
[
x
+
1
+
p_region
->
picture
.
Y_PITCH
])
/
16
;
p_dst
[
x
-
1
+
p_region
->
p
_picture
->
Y_PITCH
]
+
p_dst
[
x
+
p_region
->
p_picture
->
Y_PITCH
]
+
p_dst
[
x
+
1
+
p_region
->
p_picture
->
Y_PITCH
])
/
16
;
left
=
current
;
}
}
...
...
@@ -803,11 +798,11 @@ static void UnderlineGlyphYUVA( int i_line_thickness, int i_line_offset, bool b_
int
i_pitch
;
uint8_t
*
p_dst_y
,
*
p_dst_u
,
*
p_dst_v
,
*
p_dst_a
;
p_dst_y
=
p_region
->
p
icture
.
Y_PIXELS
;
p_dst_u
=
p_region
->
p
icture
.
U_PIXELS
;
p_dst_v
=
p_region
->
p
icture
.
V_PIXELS
;
p_dst_a
=
p_region
->
p
icture
.
A_PIXELS
;
i_pitch
=
p_region
->
p
icture
.
A_PITCH
;
p_dst_y
=
p_region
->
p
_picture
->
Y_PIXELS
;
p_dst_u
=
p_region
->
p
_picture
->
U_PIXELS
;
p_dst_v
=
p_region
->
p
_picture
->
V_PIXELS
;
p_dst_a
=
p_region
->
p
_picture
->
A_PIXELS
;
i_pitch
=
p_region
->
p
_picture
->
A_PITCH
;
int
i_offset
=
(
p_this_glyph_pos
->
y
+
i_glyph_tmax
+
i_line_offset
+
3
)
*
i_pitch
+
p_this_glyph_pos
->
x
+
p_this_glyph
->
left
+
3
+
i_align_offset
;
...
...
@@ -866,8 +861,8 @@ static void UnderlineGlyphYUVA( int i_line_thickness, int i_line_offset, bool b_
static
void
DrawBlack
(
line_desc_t
*
p_line
,
int
i_width
,
subpicture_region_t
*
p_region
,
int
xoffset
,
int
yoffset
)
{
uint8_t
*
p_dst
=
p_region
->
p
icture
.
A_PIXELS
;
int
i_pitch
=
p_region
->
p
icture
.
A_PITCH
;
uint8_t
*
p_dst
=
p_region
->
p
_picture
->
A_PIXELS
;
int
i_pitch
=
p_region
->
p
_picture
->
A_PITCH
;
int
x
,
y
;
for
(
;
p_line
!=
NULL
;
p_line
=
p_line
->
p_next
)
...
...
@@ -930,7 +925,6 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region,
video_format_t
fmt
;
int
i
,
x
,
y
,
i_pitch
,
i_alpha
;
uint8_t
i_y
,
i_u
,
i_v
;
/* YUV values, derived from incoming RGB */
subpicture_region_t
*
p_region_tmp
;
if
(
i_width
==
0
||
i_height
==
0
)
return
VLC_SUCCESS
;
...
...
@@ -946,16 +940,11 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region,
if
(
p_region
->
fmt
.
i_visible_height
>
0
)
fmt
.
i_visible_height
=
p_region
->
fmt
.
i_visible_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region_tmp
=
spu_CreateRegion
(
p_filter
,
&
fmt
);
if
(
!
p_region_tmp
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
return
VLC_EGENERIC
;
}
p_region
->
fmt
=
p_region_tmp
->
fmt
;
p_region
->
picture
=
p_region_tmp
->
picture
;
free
(
p_region_tmp
);
p_region
->
p_picture
=
picture_New
(
fmt
.
i_chroma
,
fmt
.
i_width
,
fmt
.
i_height
,
fmt
.
i_aspect
);
if
(
!
p_region
->
p_picture
)
return
VLC_EGENERIC
;
p_region
->
fmt
=
fmt
;
/* Calculate text color components */
YUVFromRGB
(
(
p_line
->
i_red
<<
16
)
|
...
...
@@ -964,11 +953,11 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region,
&
i_y
,
&
i_u
,
&
i_v
);
i_alpha
=
p_line
->
i_alpha
;
p_dst_y
=
p_region
->
p
icture
.
Y_PIXELS
;
p_dst_u
=
p_region
->
p
icture
.
U_PIXELS
;
p_dst_v
=
p_region
->
p
icture
.
V_PIXELS
;
p_dst_a
=
p_region
->
p
icture
.
A_PIXELS
;
i_pitch
=
p_region
->
p
icture
.
A_PITCH
;
p_dst_y
=
p_region
->
p
_picture
->
Y_PIXELS
;
p_dst_u
=
p_region
->
p
_picture
->
U_PIXELS
;
p_dst_v
=
p_region
->
p
_picture
->
V_PIXELS
;
p_dst_a
=
p_region
->
p
_picture
->
A_PIXELS
;
i_pitch
=
p_region
->
p
_picture
->
A_PITCH
;
/* Initialize the region pixels */
if
(
p_filter
->
p_sys
->
i_effect
!=
EFFECT_BACKGROUND
)
...
...
modules/misc/quartztext.c
View file @
8f83ef4b
...
...
@@ -1321,7 +1321,6 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region, UniCha
video_format_t
fmt
;
int
x
,
y
,
i_offset
,
i_pitch
;
uint8_t
i_y
,
i_u
,
i_v
;
// YUV values, derived from incoming RGB
subpicture_region_t
*
p_region_tmp
;
// Create a new subpicture region
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
...
...
@@ -1330,21 +1329,17 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region, UniCha
fmt
.
i_width
=
fmt
.
i_visible_width
=
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
i_textblock_height
+
VERTICAL_MARGIN
*
2
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region_tmp
=
spu_CreateRegion
(
p_filter
,
&
fmt
);
if
(
!
p_region_tmp
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
p_region
->
p_picture
=
picture_New
(
fmt
.
i_chroma
,
fmt
.
i_width
,
fmt
.
i_height
,
fmt
.
i_aspect
);
if
(
!
p_region
->
p_picture
)
return
VLC_EGENERIC
;
}
p_region
->
fmt
=
p_region_tmp
->
fmt
;
p_region
->
picture
=
p_region_tmp
->
picture
;
free
(
p_region_tmp
);
p_dst_y
=
p_region
->
picture
.
Y_PIXELS
;
p_dst_u
=
p_region
->
picture
.
U_PIXELS
;
p_dst_v
=
p_region
->
picture
.
V_PIXELS
;
p_dst_a
=
p_region
->
picture
.
A_PIXELS
;
i_pitch
=
p_region
->
picture
.
A_PITCH
;
p_region
->
fmt
=
fmt
;
p_dst_y
=
p_region
->
p_picture
->
Y_PIXELS
;
p_dst_u
=
p_region
->
p_picture
->
U_PIXELS
;
p_dst_v
=
p_region
->
p_picture
->
V_PIXELS
;
p_dst_a
=
p_region
->
p_picture
->
A_PIXELS
;
i_pitch
=
p_region
->
p_picture
->
A_PITCH
;
i_offset
=
VERTICAL_MARGIN
*
i_pitch
;
for
(
y
=
0
;
y
<
i_textblock_height
;
y
++
)
...
...
modules/misc/svg.c
View file @
8f83ef4b
...
...
@@ -257,7 +257,6 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
int
channels_in
;
int
alpha
;
picture_t
*
p_pic
;
subpicture_region_t
*
p_region_tmp
;
if
(
p_filter
->
p_sys
->
i_width
!=
i_width
||
p_filter
->
p_sys
->
i_height
!=
i_height
)
...
...
@@ -284,31 +283,27 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
fmt
.
i_width
=
fmt
.
i_visible_width
=
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
i_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region_tmp
=
spu_CreateRegion
(
p_filter
,
&
fmt
);
if
(
!
p_region_tmp
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
p_region
->
p_picture
=
picture_New
(
fmt
.
i_chroma
,
fmt
.
i_width
,
fmt
.
i_height
,
fmt
.
i_aspect
);
if
(
!
p_region
->
p_picture
)
return
VLC_EGENERIC
;
}
p_region
->
fmt
=
p_region_tmp
->
fmt
;
p_region
->
picture
=
p_region_tmp
->
picture
;
free
(
p_region_tmp
);
p_region
->
fmt
=
fmt
;
p_region
->
i_x
=
p_region
->
i_y
=
0
;
p_y
=
p_region
->
p
icture
.
Y_PIXELS
;
p_u
=
p_region
->
p
icture
.
U_PIXELS
;
p_v
=
p_region
->
p
icture
.
V_PIXELS
;
p_a
=
p_region
->
p
icture
.
A_PIXELS
;
p_y
=
p_region
->
p
_picture
->
Y_PIXELS
;
p_u
=
p_region
->
p
_picture
->
U_PIXELS
;
p_v
=
p_region
->
p
_picture
->
V_PIXELS
;
p_a
=
p_region
->
p
_picture
->
A_PIXELS
;
i_pitch
=
p_region
->
p
icture
.
Y_PITCH
;
i_u_pitch
=
p_region
->
p
icture
.
U_PITCH
;
i_pitch
=
p_region
->
p
_picture
->
Y_PITCH
;
i_u_pitch
=
p_region
->
p
_picture
->
U_PITCH
;
/* Initialize the region pixels (only the alpha will be changed later) */
memset
(
p_y
,
0x00
,
i_pitch
*
p_region
->
fmt
.
i_height
);
memset
(
p_u
,
0x80
,
i_u_pitch
*
p_region
->
fmt
.
i_height
);
memset
(
p_v
,
0x80
,
i_u_pitch
*
p_region
->
fmt
.
i_height
);
p_pic
=
&
p_region
->
picture
;
p_pic
=
p_region
->
p_
picture
;
/* Copy the data */
...
...
modules/misc/win32text.c
View file @
8f83ef4b
...
...
@@ -217,7 +217,6 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
uint8_t
*
p_dst
;
video_format_t
fmt
;
int
i
,
i_pitch
;
subpicture_region_t
*
p_region_tmp
;
bool
b_outline
=
true
;
/* Create a new subpicture region */
...
...
@@ -226,12 +225,6 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
fmt
.
i_width
=
fmt
.
i_visible_width
=
i_width
+
(
b_outline
?
4
:
0
);
fmt
.
i_height
=
fmt
.
i_visible_height
=
i_height
+
(
b_outline
?
4
:
0
);
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region_tmp
=
spu_CreateRegion
(
p_filter
,
&
fmt
);
if
(
!
p_region_tmp
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
return
VLC_EGENERIC
;
}
/* Build palette */
fmt
.
p_palette
->
i_entries
=
16
;
...
...
@@ -243,17 +236,18 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
fmt
.
p_palette
->
palette
[
i
][
3
]
=
pi_gamma
[
i
];
}
p_region
->
fmt
=
p_region_tmp
->
fmt
;
p_region
->
picture
=
p_region_tmp
->
picture
;
free
(
p_region_tmp
);
p_region
->
p_picture
=
picture_New
(
fmt
.
i_chroma
,
fmt
.
i_width
,
fmt
.
i_height
,
fmt
.
i_aspect
);
if
(
!
p_region
->
p_picture
)
return
VLC_EGENERIC
;
p_region
->
fmt
=
fmt
;
p_dst
=
p_region
->
p
icture
.
Y_PIXELS
;
i_pitch
=
p_region
->
p
icture
.
Y_PITCH
;
p_dst
=
p_region
->
p
_picture
->
Y_PIXELS
;
i_pitch
=
p_region
->
p
_picture
->
Y_PITCH
;
if
(
b_outline
)
{
memset
(
p_dst
,
0
,
i_pitch
*
fmt
.
i_height
);
p_dst
+=
p_region
->
p
icture
.
Y_PITCH
*
2
+
2
;
p_dst
+=
p_region
->
p
_picture
->
Y_PITCH
*
2
+
2
;
}
for
(
i
=
0
;
i
<
i_height
;
i
++
)
...
...
@@ -270,7 +264,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
uint8_t
left
,
current
;
int
x
,
y
;
p_dst
=
p_region
->
p
icture
.
Y_PIXELS
;
p_dst
=
p_region
->
p
_picture
->
Y_PIXELS
;
for
(
y
=
1
;
y
<
(
int
)
fmt
.
i_height
-
1
;
y
++
)
{
...
...
modules/video_filter/dynamicoverlay/dynamicoverlay.c
View file @
8f83ef4b
...
...
@@ -365,7 +365,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
}
else
{
vout_CopyPicture
(
p_filter
,
&
p_region
->
picture
,
p_overlay
->
data
.
p_pic
);
/* FIXME the copy is probably not needed anymore */
vout_CopyPicture
(
p_filter
,
p_region
->
p_picture
,
p_overlay
->
data
.
p_pic
);
}
p_region
->
i_x
=
p_overlay
->
i_x
;
p_region
->
i_y
=
p_overlay
->
i_y
;
...
...
modules/video_filter/logo.c
View file @
8f83ef4b
...
...
@@ -873,7 +873,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
return
NULL
;
}
vout_CopyPicture
(
p_filter
,
&
p_region
->
picture
,
p_pic
);
/* FIXME the copy is probably not needed anymore */
vout_CopyPicture
(
p_filter
,
&
p_region
->
p_picture
,
p_pic
);
vlc_mutex_unlock
(
&
p_logo_list
->
lock
);
/* where to locate the logo: */
...
...
modules/video_filter/mosaic.c
View file @
8f83ef4b
...
...
@@ -642,9 +642,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
}
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt_out
);
/*
XXX That's a pity to do a copy, but it is needed for now
*/
/*
FIXME the copy is probably not needed anymore
*/
if
(
p_region
)
picture_Copy
(
&
p_region
->
picture
,
p_converted
);
picture_Copy
(
&
p_region
->
p
_p
icture
,
p_converted
);
if
(
!
p_sys
->
b_keep
)
picture_Release
(
p_converted
);
...
...
modules/video_filter/osdmenu.c
View file @
8f83ef4b
...
...
@@ -426,8 +426,9 @@ static subpicture_region_t *create_picture_region( filter_t *p_filter, subpictur
p_region
->
fmt
.
i_width
=
p_region
->
fmt
.
i_visible_width
=
0
;
p_region
->
fmt
.
i_height
=
p_region
->
fmt
.
i_visible_height
=
0
;
}
/* FIXME the copy is probably not needed anymore */
if
(
p_pic
)
vout_CopyPicture
(
p_filter
,
&
p_region
->
picture
,
p_pic
);
vout_CopyPicture
(
p_filter
,
p_region
->
p_
picture
,
p_pic
);
p_region
->
i_x
=
0
;
p_region
->
i_y
=
0
;
...
...
modules/video_filter/remoteosd.c
View file @
8f83ef4b
...
...
@@ -1171,7 +1171,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
return
NULL
;
}
vout_CopyPicture
(
p_filter
,
&
p_region
->
picture
,
p_pic
);
/* FIXME the copy is probably not needed anymore */
vout_CopyPicture
(
p_filter
,
p_region
->
p_picture
,
p_pic
);
p_sys
->
b_need_update
=
false
;
...
...
modules/video_filter/rss.c
View file @
8f83ef4b
...
...
@@ -557,7 +557,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
p_region
->
i_x
=
p_sys
->
i_xoff
;
p_region
->
i_y
=
p_sys
->
i_yoff
;
vout_CopyPicture
(
p_filter
,
&
p_region
->
picture
,
p_pic
);
/* FIXME the copy is probably not needed anymore */
vout_CopyPicture
(
p_filter
,
p_region
->
p_picture
,
p_pic
);
p_spu
->
p_region
->
p_next
=
p_region
;
}
...
...
src/osd/osd_widgets.c
View file @
8f83ef4b
...
...
@@ -52,8 +52,8 @@ static void DrawRect( subpicture_t *p_subpic, int i_x1, int i_y1,
int
i_x2
,
int
i_y2
,
short
fill
)
{
int
x
,
y
;
uint8_t
*
p_a
=
p_subpic
->
p_region
->
p
icture
.
A_PIXELS
;
int
i_pitch
=
p_subpic
->
p_region
->
p
icture
.
Y_PITCH
;
uint8_t
*
p_a
=
p_subpic
->
p_region
->
p
_picture
->
A_PIXELS
;
int
i_pitch
=
p_subpic
->
p_region
->
p
_picture
->
Y_PITCH
;
if
(
fill
==
STYLE_FILLED
)
{
...
...
@@ -88,8 +88,8 @@ static void DrawTriangle( subpicture_t *p_subpic, int i_x1, int i_y1,
int
i_x2
,
int
i_y2
,
short
fill
)
{
int
x
,
y
,
i_mid
,
h
;
uint8_t
*
p_a
=
p_subpic
->
p_region
->
p
icture
.
A_PIXELS
;
int
i_pitch
=
p_subpic
->
p_region
->
p
icture
.
Y_PITCH
;
uint8_t
*
p_a
=
p_subpic
->
p_region
->
p
_picture
->
A_PIXELS
;
int
i_pitch
=
p_subpic
->
p_region
->
p
_picture
->
Y_PITCH
;
i_mid
=
i_y1
+
(
(
i_y2
-
i_y1
)
>>
1
);
...
...
@@ -173,11 +173,11 @@ static int CreatePicture( spu_t *p_spu, subpicture_t *p_subpic,
p_subpic
->
p_region
->
i_x
=
i_x
;
p_subpic
->
p_region
->
i_y
=
i_y
;
p_y
=
p_subpic
->
p_region
->
p
icture
.
Y_PIXELS
;
p_u
=
p_subpic
->
p_region
->
p
icture
.
U_PIXELS
;
p_v
=
p_subpic
->
p_region
->
p
icture
.
V_PIXELS
;
p_a
=
p_subpic
->
p_region
->
p
icture
.
A_PIXELS
;
i_pitch
=
p_subpic
->
p_region
->
p
icture
.
Y_PITCH
;
p_y
=
p_subpic
->
p_region
->
p
_picture
->
Y_PIXELS
;
p_u
=
p_subpic
->
p_region
->
p
_picture
->
U_PIXELS
;
p_v
=
p_subpic
->
p_region
->
p
_picture
->
V_PIXELS
;
p_a
=
p_subpic
->
p_region
->
p
_picture
->
A_PIXELS
;
i_pitch
=
p_subpic
->
p_region
->
p
_picture
->
Y_PITCH
;
/* Initialize the region pixels (only the alpha will be changed later) */
memset
(
p_y
,
0xff
,
i_pitch
*
p_subpic
->
p_region
->
fmt
.
i_height
);
...
...
@@ -328,8 +328,8 @@ int osd_Icon( vlc_object_t *p_this, spu_t *p_spu,
STYLE_FILLED
);
if
(
i_type
==
OSD_MUTE_ICON
)
{
uint8_t
*
p_a
=
p_subpic
->
p_region
->
p
icture
.
A_PIXELS
;
int
i_pitch
=
p_subpic
->
p_region
->
p
icture
.
Y_PITCH
;
uint8_t
*
p_a
=
p_subpic
->
p_region
->
p
_picture
->
A_PIXELS
;
int
i_pitch
=
p_subpic
->
p_region
->
p
_picture
->
Y_PITCH
;
int
i
;
for
(
i
=
1
;
i
<
i_pitch
;
i
++
)
{
...
...
src/video_output/vout_intf.c
View file @
8f83ef4b
...
...
@@ -477,8 +477,14 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, image_handler_t *p_image, pic
p_subpic
->
p_region
=
spu_CreateRegion
(
p_vout
->
p_spu
,
&
fmt_out
);
if
(
p_subpic
->
p_region
)
vout_CopyPicture
(
p_image
->
p_parent
,
&
p_subpic
->
p_region
->
picture
,
p_pip
);
picture_Release
(
p_pip
);
{
picture_Release
(
p_subpic
->
p_region
->
p_picture
);
p_subpic
->
p_region
->
p_picture
=
p_pip
;
}
else
{
picture_Release
(
p_pip
);
}
spu_DisplaySubpicture
(
p_vout
->
p_spu
,
p_subpic
);
return
VLC_SUCCESS
;
...
...
src/video_output/vout_subpictures.c
View file @
8f83ef4b
...
...
@@ -70,6 +70,39 @@ struct filter_owner_sys_t
#define SCALE_UNIT (1000)
/* */
struct
subpicture_region_private_t
{
video_format_t
fmt
;
picture_t
*
p_picture
;
};
static
subpicture_region_private_t
*
SpuRegionPrivateCreate
(
video_format_t
*
p_fmt
)
{
subpicture_region_private_t
*
p_private
=
malloc
(
sizeof
(
*
p_private
)
);
if
(
!
p_private
)
return
NULL
;
p_private
->
fmt
=
*
p_fmt
;
if
(
p_fmt
->
p_palette
)
{
p_private
->
fmt
.
p_palette
=
malloc
(
sizeof
(
*
p_private
->
fmt
.
p_palette
)
);
if
(
p_private
->
fmt
.
p_palette
)
*
p_private
->
fmt
.
p_palette
=
*
p_fmt
->
p_palette
;
}
p_private
->
p_picture
=
NULL
;
return
p_private
;
}
static
void
SpuRegionPrivateDestroy
(
subpicture_region_private_t
*
p_private
)
{
if
(
p_private
->
p_picture
)
picture_Release
(
p_private
->
p_picture
);
free
(
p_private
->
fmt
.
p_palette
);
free
(
p_private
);
}
/* */
static
void
SpuRenderCreateAndLoadText
(
spu_t
*
p_spu
);
static
void
SpuRenderCreateAndLoadScale
(
spu_t
*
p_spu
);
...
...
@@ -215,19 +248,6 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach )
}
}
/* */
static
void
RegionPictureRelease
(
picture_t
*
p_picture
)
{
if
(
--
p_picture
->
i_refcount
>
0
)
return
;
assert
(
p_picture
->
i_refcount
==
0
);
free
(
p_picture
->
p_q
);
free
(
p_picture
->
p_data_orig
);
free
(
p_picture
->
p_sys
);
}
/**
* Create a subpicture region
*
...
...
@@ -250,26 +270,23 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
p_region
->
fmt
=
*
p_fmt
;
p_region
->
i_alpha
=
0xff
;
p_region
->
p_next
=
NULL
;
p_region
->
p_
cach
e
=
NULL
;
p_region
->
p_
privat
e
=
NULL
;
p_region
->
psz_text
=
NULL
;
p_region
->
p_style
=
NULL
;
p_region
->
p_picture
=
NULL
;
if
(
p_fmt
->
i_chroma
==
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
)
)
return
p_region
;
vout_AllocatePicture
(
p_this
,
&
p_region
->
picture
,
p_fmt
->
i_chroma
,
p_fmt
->
i_width
,
p_fmt
->
i_height
,
p_fmt
->
i_aspect
);
if
(
!
p_region
->
picture
.
i_planes
)
p_region
->
p_picture
=
picture_New
(
p_fmt
->
i_chroma
,
p_fmt
->
i_width
,
p_fmt
->
i_height
,
p_fmt
->
i_aspect
);
if
(
!
p_region
->
p_picture
)
{
free
(
p_fmt
->
p_palette
);
free
(
p_region
);
return
NULL
;
}
p_region
->
picture
.
i_refcount
=
1
;
p_region
->
picture
.
pf_release
=
RegionPictureRelease
;
return
p_region
;
}
...
...
@@ -284,11 +301,13 @@ void __spu_DestroyRegion( vlc_object_t *p_this, subpicture_region_t *p_region )
if
(
!
p_region
)
return
;
picture_Release
(
&
p_region
->
picture
);
if
(
p_region
->
p_private
)
SpuRegionPrivateDestroy
(
p_region
->
p_private
);
if
(
p_region
->
p_picture
)
picture_Release
(
p_region
->
p_picture
);
free
(
p_region
->
fmt
.
p_palette
);
if
(
p_region
->
p_cache
)
__spu_DestroyRegion
(
p_this
,
p_region
->
p_cache
);
free
(
p_region
->
psz_text
);
free
(
p_region
->
psz_html
);
...
...
@@ -902,6 +921,9 @@ static void SpuRenderRegion( spu_t *p_spu,
int
i_y_offset
;
filter_t
*
p_scale
;
video_format_t
*
p_region_fmt
;
picture_t
*
p_region_picture
;
vlc_assert_locked
(
&
p_spu
->
subpicture_lock
);
/* Invalidate area by default */
...
...
@@ -958,6 +980,7 @@ static void SpuRenderRegion( spu_t *p_spu,
i_x_offset
=
spu_scale_w
(
p_area
->
i_x
,
p_area
->
scale
);
i_y_offset
=
spu_scale_h
(
p_area
->
i_y
,
p_area
->
scale
);
/* */
if
(
b_force_palette
)
{
/* It looks so wrong I won't comment
...
...
@@ -968,12 +991,14 @@ static void SpuRenderRegion( spu_t *p_spu,
memcpy
(
p_region
->
fmt
.
p_palette
->
palette
,
p_spu
->
palette
,
4
*
sizeof
(
uint32_t
)
);
}
if
(
b_using_palette
)
p_scale
=
p_spu
->
p_scale_yuvp
;
else
p_scale
=
p_spu
->
p_scale
;
/* */
p_region_fmt
=
&
p_region
->
fmt
;
p_region_picture
=
p_region
->
p_picture
;
/* Scale from rendered size to destination size */
p_scale
=
b_using_palette
?
p_spu
->
p_scale_yuvp
:
p_spu
->
p_scale
;
if
(
p_scale
&&
(
scale_size
.
w
!=
SCALE_UNIT
||
scale_size
.
h
!=
SCALE_UNIT
||
b_force_palette
)
)
{
...
...
@@ -983,21 +1008,17 @@ static void SpuRenderRegion( spu_t *p_spu,
/* TODO when b_using_palette is true, we should first convert it to YUVA to allow
* a proper rescaling */
/* Destroy if cache is unusable */
if
(
p_region
->
p_cache
)
/* Destroy if cache is unusable
* FIXME do not always destroy the region it can sometimes be reused
* if same size and same palette if present */
if
(
p_region
->
p_private
)
{
if
(
p_region
->
p_cache
->
fmt
.
i_width
!=
i_dst_width
||
p_region
->
p_cache
->
fmt
.
i_height
!=
i_dst_height
||
b_force_palette
)
{
p_subpic
->
pf_destroy_region
(
VLC_OBJECT
(
p_spu
),
p_region
->
p_cache
);
p_region
->
p_cache
=
NULL
;
}
SpuRegionPrivateDestroy
(
p_region
->
p_private
);
p_region
->
p_private
=
NULL
;
}
/* Scale if needed into cache */
if
(
!
p_region
->
p_
cach
e
)
if
(
!
p_region
->
p_
privat
e
)
{
picture_t
*
p_pic
;
...
...
@@ -1012,52 +1033,33 @@ static void SpuRenderRegion( spu_t *p_spu,
p_scale
->
fmt_out
.
video
.
i_visible_height
=
spu_scale_h
(
p_region
->
fmt
.
i_visible_height
,
scale_size
);
p_region
->
p_cache
=
p_subpic
->
pf_create_region
(
VLC_OBJECT
(
p_spu
),
&
p_scale
->
fmt_out
.
video
);
p_region
->
p_private
=
SpuRegionPrivateCreate
(
&
p_scale
->
fmt_out
.
video
);
p_pic
=
NULL
;
if
(
p_scale
->
p_module
)
{
picture_Yield
(
&
p_region
->
picture
);
p_
pic
=
p_scale
->
pf_video_filter
(
p_scale
,
&
p_region
->
picture
);
picture_Yield
(
p_region
->
p_
picture
);
p_
region
->
p_private
->
p_picture
=
p_scale
->
pf_video_filter
(
p_scale
,
p_region
->
p_
picture
);
}
if
(
p_pic
)
{
picture_CopyPixels
(
&
p_region
->
p_cache
->
picture
,
p_pic
);
picture_Release
(
p_pic
);
if
(
p_region
->
p_cache
->
fmt
.
p_palette
)
*
p_region
->
p_cache
->
fmt
.
p_palette
=
*
p_region
->
fmt
.
p_palette
;
/* i_x/i_y of cached region should NOT be used. I set them to
* an invalid value to catch it (assert) */
p_region
->
p_cache
->
i_x
=
INT_MAX
;
p_region
->
p_cache
->
i_y
=
INT_MAX
;
p_region
->
p_cache
->
i_align
=
p_region
->
i_align
;
p_region
->
p_cache
->
i_alpha
=
p_region
->
i_alpha
;
}
else
if
(
!
p_region
->
p_private
->
p_picture
)
{
msg_Err
(
p_spu
,
"scaling failed (module not loaded)"
);
p_subpic
->
pf_destroy_region
(
VLC_OBJECT
(
p_spu
),
p_region
->
p_cache
);
p_region
->
p_cache
=
NULL
;
SpuRegionPrivateDestroy
(
p_region
->
p_private
);
p_region
->
p_private
=
NULL
;
}
}
/* And use the scaled picture */
if
(
p_region
->
p_
cach
e
)
if
(
p_region
->
p_
privat
e
)
{
p_region
=
p_region
->
p_cache
;
fmt_original
=
p_region
->
fmt
;
p_region
_fmt
=
&
p_region
->
p_private
->
fmt
;
p_region_picture
=
p_region
->
p_private
->
p_picture
;
}
}
/* Force cropping if requested */
if
(
b_force_crop
)
{
video_format_t
*
p_fmt
=
&
p_region
->
fmt
;
video_format_t
*
p_fmt
=
p_region_
fmt
;
int
i_crop_x
=
spu_scale_w
(
p_spu
->
i_crop_x
,
scale_size
);
int
i_crop_y
=
spu_scale_h
(
p_spu
->
i_crop_y
,
scale_size
);
int
i_crop_width
=
spu_scale_w
(
p_spu
->
i_crop_width
,
scale_size
);
...
...
@@ -1094,14 +1096,14 @@ static void SpuRenderRegion( spu_t *p_spu,
}
/* Update the blender */
SpuRenderUpdateBlend
(
p_spu
,
p_fmt
->
i_width
,
p_fmt
->
i_height
,
&
p_region
->
fmt
);
SpuRenderUpdateBlend
(
p_spu
,
p_fmt
->
i_width
,
p_fmt
->
i_height
,
p_region_
fmt
);
if
(
p_spu
->
p_blend
->
p_module
)
{
const
int
i_alpha
=
SpuRegionAlpha
(
p_subpic
,
p_region
);
p_spu
->
p_blend
->
pf_video_blend
(
p_spu
->
p_blend
,
p_pic_dst
,
&
p_region
->
picture
,
i_x_offset
,
i_y_offset
,
i_alpha
);
p_region_
picture
,
i_x_offset
,
i_y_offset
,
i_alpha
);
}
else
{
...
...
@@ -1118,8 +1120,13 @@ exit:
* pre-rendered state, so the next time through everything is
* calculated again.
*/
p_region
->
picture
.
pf_release
(
&
p_region
->
picture
);
memset
(
&
p_region
->
picture
,
0
,
sizeof
(
picture_t
)
);
picture_Release
(
p_region
->
p_picture
);
p_region
->
p_picture
=
NULL
;
if
(
p_region
->
p_private
)
{
SpuRegionPrivateDestroy
(
p_region
->
p_private
);
p_region
->
p_private
=
NULL
;
}
p_region
->
i_align
&=
~
SUBPICTURE_RENDERED
;
}
if
(
b_restore_format
)
...
...
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