Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
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
->
picture
.
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
->
picture
.
Y_PIXELS
;
csri_frame
.
strides
[
0
]
=
p_spu_region
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
Y_PIXELS
;
i_pitch
=
p_spu_region
->
picture
.
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
->
picture
.
p
[
0
].
i_visible_lines
*
p_region
->
picture
.
p
[
0
].
i_pitch
;
int
i_iterator
=
p_region
->
picture
.
p
[
0
].
i_visible_lines
*
3
/
4
*
p_region
->
picture
.
p
[
0
].
i_pitch
+
p_region
->
picture
.
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
->
picture
.
p
[
0
].
p_pixels
[
i
];
u
=
p_region
->
picture
.
p
[
1
].
p_pixels
[
i
];
v
=
p_region
->
picture
.
p
[
2
].
p_pixels
[
i
];
a
=
p_region
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
p
[
0
].
i_pitch
;
n
++
)
for
(
n
=
0
;
n
<
p_region
->
p_
picture
->
p
[
0
].
i_pitch
;
n
++
)
{
int
i_offset
=
p
*
p_region
->
picture
.
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
->
picture
.
p
[
0
].
p_pixels
[
i_offset
];
u
=
(
int
)
p_region
->
picture
.
p
[
1
].
p_pixels
[
i_offset
];
v
=
(
int
)
p_region
->
picture
.
p
[
2
].
p_pixels
[
i_offset
];
a
=
(
int
)
p_region
->
picture
.
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
->
picture
.
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
->
picture
.
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
picture
.
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
->
picture
.
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
picture
.
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
->
picture
.
p
->
i_pitch
;
uint8_t
*
p_data
=
&
p_region
->
picture
.
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
->
picture
.
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
->
picture
.
p
->
p_pixels
;
i_pitch
=
p_spu
->
p_region
->
picture
.
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
->
picture
.
Y_PIXELS
[
y
*
p_region
->
picture
.
Y_PITCH
+
x
]
!=
i_y
||
p_region
->
picture
.
U_PIXELS
[
y
*
p_region
->
picture
.
U_PITCH
+
x
]
!=
i_u
||
p_region
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
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_
picture
,
&
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
->
picture
.
Y_PIXELS
;
i_pitch
=
p_region
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
picture
.
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
->
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_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
->
picture
.
A_PIXELS
;
int
i_pitch
=
p_region
->
picture
.
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
->
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_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
->
picture
.
Y_PIXELS
;
p_u
=
p_region
->
picture
.
U_PIXELS
;
p_v
=
p_region
->
picture
.
V_PIXELS
;
p_a
=
p_region
->
picture
.
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
->
picture
.
Y_PITCH
;
i_u_pitch
=
p_region
->
picture
.
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
->
picture
.
Y_PIXELS
;