Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
89e50c74
Commit
89e50c74
authored
Jan 12, 2004
by
Rocky Bernstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First attempt at YUY2. Sort of works.
Y2RV16 less embarrassingly wrong.
parent
44e1dd99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
285 additions
and
54 deletions
+285
-54
modules/codec/ogt/render.c
modules/codec/ogt/render.c
+285
-54
No files found.
modules/codec/ogt/render.c
View file @
89e50c74
/*****************************************************************************
/*****************************************************************************
* render.c : Philips OGT (SVCD Subtitle) renderer
* render.c : Philips OGT (SVCD Subtitle) renderer
*****************************************************************************
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* Copyright (C) 2003
, 2004
VideoLAN
* $Id: render.c,v 1.
9 2004/01/03 17:19:41
rocky Exp $
* $Id: render.c,v 1.
10 2004/01/12 04:03:19
rocky Exp $
*
*
* Author: Rocky Bernstein
* Author: Rocky Bernstein
* based on code from:
* based on code from:
...
@@ -51,8 +51,12 @@
...
@@ -51,8 +51,12 @@
*****************************************************************************/
*****************************************************************************/
static
void
RenderI420
(
vout_thread_t
*
,
picture_t
*
,
const
subpicture_t
*
,
static
void
RenderI420
(
vout_thread_t
*
,
picture_t
*
,
const
subpicture_t
*
,
vlc_bool_t
);
vlc_bool_t
);
static
void
RenderYUY2
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
);
static
void
RenderRV16
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
static
void
RenderRV16
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
);
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
);
static
void
RenderRV32
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
);
/*****************************************************************************
/*****************************************************************************
* RenderSPU: draw an SPU on a picture
* RenderSPU: draw an SPU on a picture
...
@@ -90,12 +94,17 @@ void VCDSubRender( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -90,12 +94,17 @@ void VCDSubRender( vout_thread_t *p_vout, picture_t *p_pic,
/* RV32 target, scaling */
/* RV32 target, scaling */
case
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
):
msg_Err
(
p_vout
,
"RV24/VF32 not implimented yet"
);
RenderRV32
(
p_vout
,
p_pic
,
p_spu
,
p_spu
->
p_sys
->
b_crop
);
break
;
break
;
/* NVidia overlay, no scaling */
/* NVidia overlay, no scaling */
case
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
):
case
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
):
msg_Err
(
p_vout
,
"YUV2 not implimented yet"
);
RenderYUY2
(
p_vout
,
p_pic
,
p_spu
,
p_spu
->
p_sys
->
b_crop
);
break
;
/* Used in ASCII art */
case
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'2'
):
msg_Err
(
p_vout
,
"RGB2 not implimented yet"
);
break
;
break
;
default:
default:
...
@@ -106,6 +115,16 @@ void VCDSubRender( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -106,6 +115,16 @@ void VCDSubRender( vout_thread_t *p_vout, picture_t *p_pic,
/* Following functions are local */
/* Following functions are local */
/*
YV12 format:
All Y samples are found first in memory as an array of bytes
(possibly with a larger stride for memory alignment), followed
immediately by all Cr (=U) samples (with half the stride of the Y
lines, and half the number of lines), then followed immediately by
all Cb (=V) samples in a similar fashion.
*/
static
void
RenderI420
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
static
void
RenderI420
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
)
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
)
{
{
...
@@ -123,7 +142,7 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -123,7 +142,7 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
struct
subpicture_sys_t
*
p_sys
=
p_spu
->
p_sys
;
struct
subpicture_sys_t
*
p_sys
=
p_spu
->
p_sys
;
dbg_print
(
(
DECODE_DBG_CALL
|
DECODE_DBG_RENDER
),
dbg_print
(
(
DECODE_DBG_CALL
|
DECODE_DBG_RENDER
),
"spu width x height: (%dx%d),
x-y
(%d,%d), yuv pitch (%d,%d,%d)"
,
"spu width x height: (%dx%d),
(x,y)=
(%d,%d), yuv pitch (%d,%d,%d)"
,
p_spu
->
i_width
,
p_spu
->
i_height
,
p_spu
->
i_x
,
p_spu
->
i_y
,
p_spu
->
i_width
,
p_spu
->
i_height
,
p_spu
->
i_x
,
p_spu
->
i_y
,
p_pic
->
Y_PITCH
,
p_pic
->
U_PITCH
,
p_pic
->
V_PITCH
);
p_pic
->
Y_PITCH
,
p_pic
->
U_PITCH
,
p_pic
->
V_PITCH
);
...
@@ -259,67 +278,233 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -259,67 +278,233 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
}
}
}
}
#define Y2RV16(val) ((uint16_t) (0x111 * (uint16_t) ( (val) >> 4 )))
/*
YUY2 Format:
Data is found in memory as an array of bytess in which the first
byte contains the first sample of Y, the second byte contains the
first sample of Cb (=U), the third byte contains the second sample
of Y, the fourth byte contains the first sample of Cr (=V); and so
on. If data is addressed as an array of two little-endian WORD type
variables, the first WORD contains Y0 in the least significant bits
and Cb in the most significant bits, and the second WORD contains Y1
in the least significant bits and Cr in the most significant bits.
*/
static
void
RenderYUY2
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
)
{
/* Common variables */
uint8_t
*
p_pixel_base
;
ogt_yuvt_t
*
p_source
;
int
i_x
,
i_y
;
vlc_bool_t
even_scanline
=
VLC_FALSE
;
/* Crop-specific */
int
i_x_start
,
i_y_start
,
i_x_end
,
i_y_end
;
/* int i=0; */
struct
subpicture_sys_t
*
p_sys
=
p_spu
->
p_sys
;
dbg_print
(
(
DECODE_DBG_CALL
|
DECODE_DBG_RENDER
),
"spu width x height: (%dx%d), (x,y)=(%d,%d), pitch: %d"
,
p_spu
->
i_width
,
p_spu
->
i_height
,
p_spu
->
i_x
,
p_spu
->
i_y
,
p_pic
->
p
->
i_pitch
);
p_pixel_base
=
p_pic
->
p
->
p_pixels
+
+
(
p_spu
->
i_y
+
p_spu
->
i_height
)
*
p_pic
->
p
->
i_pitch
+
(
p_spu
->
i_x
+
p_spu
->
i_width
);
i_x_start
=
p_sys
->
i_x_start
;
i_y_start
=
p_sys
->
i_y_start
*
p_pic
->
p
->
i_pitch
;
i_x_end
=
p_sys
->
i_x_end
;
i_y_end
=
p_sys
->
i_y_end
*
p_pic
->
p
->
i_pitch
;
p_source
=
(
ogt_yuvt_t
*
)
p_sys
->
p_data
;
/* Draw until we reach the bottom of the subtitle */
for
(
i_y
=
0
;
i_y
<
p_spu
->
i_height
*
p_pic
->
p
->
i_pitch
;
i_y
+=
p_pic
->
p
->
i_pitch
)
{
uint8_t
*
p_pixel_base_y
=
p_pixel_base
+
i_y
;
even_scanline
=
!
even_scanline
;
/* printf("+++begin line: %d,\n", i++); */
/* Draw until we reach the end of the line */
for
(
i_x
=
0
;
i_x
<
p_spu
->
i_width
;
i_x
++
,
p_source
++
)
{
if
(
b_crop
&&
(
i_x
<
i_x_start
||
i_x
>
i_x_end
||
i_y
<
i_y_start
||
i_y
>
i_y_end
)
)
{
continue
;
}
/* printf( "t: %x, y: %x, u: %x, v: %x\n",
p_source->s.t, p_source->y, p_source->u, p_source->v ); */
switch
(
p_source
->
s
.
t
)
{
case
0x00
:
/* Completely transparent. Don't change pixel. */
break
;
case
MAX_ALPHA
:
{
/* Completely opaque. Completely overwrite underlying
pixel with subtitle pixel. */
/* This is the location that's going to get changed.*/
uint8_t
*
p_pixel
=
p_pixel_base_y
+
i_x
;
/* draw a pixel */
/* Y */
*
p_pixel
++
=
p_source
->
plane
[
Y_PLANE
];
if
(
even_scanline
)
{
*
p_pixel
++
=
p_source
->
plane
[
U_PLANE
];
*
p_pixel
++
=
p_source
->
plane
[
Y_PLANE
];
*
p_pixel
++
=
p_source
->
plane
[
V_PLANE
];
}
break
;
}
default:
{
/* Blend in underlying pixel subtitle pixel. */
/* This is the location that's going to get changed.*/
uint8_t
*
p_pixel
=
p_pixel_base_y
+
i_x
;
/* This is the weighted part of the subtitle. The
color plane is 8 bits and transparancy is 4 bits so
when multiplied we get up to 12 bits.
*/
uint16_t
i_sub_color_Y
=
(
uint16_t
)
(
p_source
->
plane
[
Y_PLANE
]
*
(
uint16_t
)
(
p_source
->
s
.
t
)
);
/* This is the weighted part of the underlying pixel.
For the same reasons above, the result is up to 12
bits. However since the transparancies are
inverses, the sum of i_sub_color and i_pixel_color
will not exceed 12 bits.
*/
uint16_t
i_pixel_color_Y
=
(
uint16_t
)
(
*
p_pixel
*
(
uint16_t
)
(
MAX_ALPHA
-
p_source
->
s
.
t
)
)
;
/* Scale the 12-bit result back down to 8 bits. A
precise scaling after adding the two components,
would divide by one less than a power of 2. However
to simplify and speed things we use a power of
2. This means the boundaries (either all
transparent and all opaque) aren't handled properly.
But we deal with them in special cases above. */
*
p_pixel
++
=
(
i_sub_color_Y
+
i_pixel_color_Y
)
>>
4
;
if
(
even_scanline
)
{
uint16_t
i_sub_color_U
=
(
uint16_t
)
(
p_source
->
plane
[
U_PLANE
]
*
(
uint16_t
)
(
p_source
->
s
.
t
)
);
uint16_t
i_sub_color_V
=
(
uint16_t
)
(
p_source
->
plane
[
V_PLANE
]
*
(
uint16_t
)
(
p_source
->
s
.
t
)
);
uint16_t
i_pixel_color_U
=
(
uint16_t
)
(
*
(
p_pixel
+
1
)
*
(
uint16_t
)
(
MAX_ALPHA
-
p_source
->
s
.
t
)
)
;
uint16_t
i_pixel_color_V
=
(
uint16_t
)
(
*
(
p_pixel
+
3
)
*
(
uint16_t
)
(
MAX_ALPHA
-
p_source
->
s
.
t
)
)
;
*
p_pixel
++
=
(
i_sub_color_U
+
i_pixel_color_U
)
>>
4
;
*
p_pixel
++
=
(
i_sub_color_Y
+
i_pixel_color_Y
)
>>
4
;
*
p_pixel
++
=
(
i_sub_color_V
+
i_pixel_color_V
)
>>
4
;
}
break
;
}
}
}
}
}
#define Y2RV16(val) ((uint16_t) (0x1111 * ( (uint16_t) (val) >> 4 )))
static
void
RenderRV16
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
static
void
RenderRV16
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
)
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
)
{
{
/* Common variables */
/* Common variables */
uint8_t
*
p_pixel_base
_Y
;
uint8_t
*
p_pixel_base
;
ogt_yuvt_t
*
p_src_start
=
(
ogt_yuvt_t
*
)
p_spu
->
p_sys
->
p_data
;
ogt_yuvt_t
*
p_src_start
=
(
ogt_yuvt_t
*
)
p_spu
->
p_sys
->
p_data
;
ogt_yuvt_t
*
p_src_end
=
&
p_src_start
[
p_spu
->
i_height
*
p_spu
->
i_width
];
ogt_yuvt_t
*
p_src_end
=
&
p_src_start
[
p_spu
->
i_height
*
p_spu
->
i_width
];
int
i_x
,
i_y
;
int
i_x
,
i_y
;
int
i_x_src
,
i_y_src
;
/* RGB-specific */
/* RGB-specific */
int
i_xscale
,
i_yscale
,
i_width
,
i_height
,
i_ytmp
,
i_y
real
,
i_y
next
;
int
i_xscale
,
i_yscale
,
i_width
,
i_height
,
i_ytmp
,
i_ynext
;
/* Crop-specific */
/* Crop-specific */
int
i_x_start
,
i_y_start
,
i_x_end
,
i_y_end
;
int
i_x_start
,
i_y_start
,
i_x_end
,
i_y_end
;
struct
subpicture_sys_t
*
p_sys
=
p_spu
->
p_sys
;
struct
subpicture_sys_t
*
p_sys
=
p_spu
->
p_sys
;
dbg_print
(
(
DECODE_DBG_CALL
|
DECODE_DBG_RENDER
),
"spu width: %d, height %d, scaled (%d, %d)"
,
p_spu
->
i_width
,
p_spu
->
i_height
,
p_vout
->
output
.
i_width
,
p_vout
->
output
.
i_height
);
i_xscale
=
(
p_vout
->
output
.
i_width
<<
6
)
/
p_vout
->
render
.
i_width
;
i_xscale
=
(
p_vout
->
output
.
i_width
<<
6
)
/
p_vout
->
render
.
i_width
;
i_yscale
=
(
p_vout
->
output
.
i_height
<<
6
)
/
p_vout
->
render
.
i_height
;
i_yscale
=
(
p_vout
->
output
.
i_height
<<
6
)
/
p_vout
->
render
.
i_height
;
dbg_print
(
(
DECODE_DBG_CALL
|
DECODE_DBG_RENDER
),
"spu: %dx%d, scaled: %dx%d, vout render: %dx%d, scale %dx%d"
,
p_spu
->
i_width
,
p_spu
->
i_height
,
p_vout
->
output
.
i_width
,
p_vout
->
output
.
i_height
,
p_vout
->
render
.
i_width
,
p_vout
->
render
.
i_height
,
i_xscale
,
i_yscale
);
i_width
=
p_spu
->
i_width
*
i_xscale
;
i_width
=
p_spu
->
i_width
*
i_xscale
;
i_height
=
p_spu
->
i_height
*
i_yscale
;
i_height
=
p_spu
->
i_height
*
i_yscale
;
p_pixel_base_Y
=
p_pic
->
p
->
p_pixels
+
(
i_width
>>
6
)
*
2
/* Set where we will start blending subtitle from using
/* Add the picture coordinates and the SPU coordinates */
the picture coordinates subtitle offsets
+
(
(
p_spu
->
i_x
*
i_xscale
)
>>
6
)
*
2
*/
p_pixel_base
=
p_pic
->
p
->
p_pixels
+
(
(
p_spu
->
i_x
*
i_xscale
)
>>
6
)
*
2
+
(
(
p_spu
->
i_y
*
i_yscale
)
>>
6
)
*
p_pic
->
p
->
i_pitch
;
+
(
(
p_spu
->
i_y
*
i_yscale
)
>>
6
)
*
p_pic
->
p
->
i_pitch
;
i_x_start
=
i_
width
-
i_xscale
*
p_spu
->
p_sys
->
i_x_end
;
i_x_start
=
i_
xscale
*
p_spu
->
p_sys
->
i_x_start
;
i_y_start
=
i_yscale
*
p_spu
->
p_sys
->
i_y_start
;
i_y_start
=
i_yscale
*
p_spu
->
p_sys
->
i_y_start
;
i_x_end
=
i_width
-
i_xscale
*
p_spu
->
p_sys
->
i_x_start
;
i_x_end
=
i_xscale
*
p_spu
->
p_sys
->
i_x_end
;
i_y_end
=
i_yscale
*
p_spu
->
p_sys
->
i_y_end
;
i_y_end
=
i_yscale
*
p_spu
->
p_sys
->
i_y_end
;
/* Draw until we reach the bottom of the subtitle */
/* Draw until we reach the bottom of the subtitle */
for
(
i_y
=
0
;
i_y
<
i_height
;
)
i_y
=
0
;
for
(
i_y_src
=
0
;
i_y_src
<
p_spu
->
i_height
;
i_y_src
++
)
{
{
int
i_y_src
=
(
i_y
/
i_yscale
)
*
p_spu
->
i_width
;
uint8_t
*
p_pixel_base_y
;
i_ytmp
=
i_y
>>
6
;
i_ytmp
=
i_y
>>
6
;
i_y
+=
i_yscale
;
i_y
+=
i_yscale
;
p_pixel_base_y
=
p_pixel_base
+
(
i_ytmp
*
p_pic
->
p
->
i_pitch
);
i_x
=
0
;
/* Check whether we need to draw one line or more than one */
/* Check whether we need to draw one line or more than one */
if
(
i_ytmp
+
1
>=
(
i_y
>>
6
)
)
if
(
i_ytmp
+
1
>=
(
i_y
>>
6
)
)
{
{
/* Just one line : we precalculate i_y >> 6 */
i_yreal
=
p_pic
->
p
->
i_pitch
*
i_ytmp
;
/* Draw until we reach the end of the line */
/* Draw until we reach the end of the line */
for
(
i_x
=
i_width
;
i_x
;
i_x
--
)
for
(
i_x
_src
=
0
;
i_x_src
<
p_spu
->
i_width
;
i_x_src
++
)
{
{
ogt_yuvt_t
*
p_source
;
ogt_yuvt_t
*
p_source
;
i_x
+=
(
1
<<
6
);
if
(
b_crop
if
(
b_crop
&&
(
i_x
<
i_x_start
||
i_x
>
i_x_end
&&
(
i_x
<
i_x_start
||
i_x
>
i_x_end
||
i_y
<
i_y_start
||
i_y
>
i_y_end
)
)
||
i_y
<
i_y_start
||
i_y
>
i_y_end
)
)
...
@@ -327,11 +512,11 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -327,11 +512,11 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
continue
;
continue
;
}
}
p_source
=
&
p_src_start
[
i_y_src
+
((
i_width
-
i_x
)
/
i_xscale
)
];
p_source
=
&
p_src_start
[
i_y_src
+
i_x_src
];
if
(
p_source
>=
p_src_end
)
{
if
(
p_source
>=
p_src_end
)
{
msg_Err
(
p_vout
,
"Trying to access beyond subtitle %d
x
%d %d"
,
msg_Err
(
p_vout
,
"Trying to access beyond subtitle %d
x
%d %d"
,
(
i_width
-
i_x
)
/
i_xscale
,
i_y
/
i_yscale
,
i_height
);
i_x
,
i_y
/
i_yscale
,
i_height
);
return
;
return
;
}
}
...
@@ -341,14 +526,26 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -341,14 +526,26 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
/* Completely transparent. Don't change pixel. */
/* Completely transparent. Don't change pixel. */
break
;
break
;
default:
case
MAX_ALPHA
:
case
MAX_ALPHA
:
{
{
/* Completely opaque. Completely overwrite underlying
pixel with subtitle pixel. */
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
]);
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
]);
uint8_t
*
p_pixel
=
p_pixel_base_Y
+
i_yreal
;
*
p_pixel
=
i_colprecomp
;
/* This is the location that's going to get changed.
*/
uint8_t
*
p_dest
=
p_pixel_base_y
+
2
*
(
i_x
>>
6
);
#if 1
memset
(
p_dest
,
i_colprecomp
,
2
*
i_xscale
);
#else
memset
(
p_dest
,
0xFFFF
,
2
*
i_xscale
);
#endif
break
;
break
;
}
}
#if FINISHED
default:
default:
{
{
/* Blend in underlying pixel subtitle pixel. */
/* Blend in underlying pixel subtitle pixel. */
...
@@ -358,29 +555,33 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -358,29 +555,33 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
be completely transparent and is not correct, but
be completely transparent and is not correct, but
that's handled in a special case above anyway. */
that's handled in a special case above anyway. */
uint8_t
*
p_pixel
=
p_pixel_base
_Y
+
i_yreal
;
uint8_t
*
p_pixel
=
p_pixel_base
+
2
*
(
i_x
>>
6
)
;
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
])
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
])
*
(
(
uint16_t
)
(
p_source
->
s
.
t
+
1
)
);
*
(
(
uint16_t
)
(
p_source
->
s
.
t
+
1
)
);
uint16_t
i_destalpha
=
MAX_ALPHA
-
p_source
->
s
.
t
;
uint16_t
i_destalpha
=
MAX_ALPHA
-
p_source
->
s
.
t
;
p_pixel
=
p_pixel_base_Y
+
i_yreal
;
*
p_pixel
++
=
(
i_colprecomp
+
*
p_pixel
=
(
i_colprecomp
+
(
uint16_t
)
(
*
p_pixel
)
*
i_destalpha
)
(
uint16_t
)
(
*
p_pixel
)
*
i_destalpha
)
>>
ALPHA_SCALEDOWN
;
*
p_pixel
=
(
i_colprecomp
+
(
uint16_t
)
(
*
p_pixel
)
*
i_destalpha
)
>>
ALPHA_SCALEDOWN
;
>>
ALPHA_SCALEDOWN
;
break
;
break
;
}
}
#endif
}
}
}
}
}
}
else
else
{
{
i_yreal
=
p_pic
->
p
->
i_pitch
*
i_ytmp
;
i_ynext
=
p_pic
->
p
->
i_pitch
*
i_y
>>
6
;
i_ynext
=
p_pic
->
p
->
i_pitch
*
i_y
>>
6
;
/* Draw until we reach the end of the line */
/* Draw until we reach the end of the line */
for
(
i_x
=
i_width
;
i_x
;
i_x
--
)
for
(
i_x
_src
=
0
;
i_x_src
<
p_spu
->
i_width
;
i_x_src
++
)
{
{
ogt_yuvt_t
*
p_source
;
ogt_yuvt_t
*
p_source
;
i_x
+=
(
1
<<
6
);
if
(
b_crop
if
(
b_crop
&&
(
i_x
<
i_x_start
||
i_x
>
i_x_end
&&
(
i_x
<
i_x_start
||
i_x
>
i_x_end
||
i_y
<
i_y_start
||
i_y
>
i_y_end
)
)
||
i_y
<
i_y_start
||
i_y
>
i_y_end
)
)
...
@@ -388,11 +589,11 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -388,11 +589,11 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
continue
;
continue
;
}
}
p_source
=
&
p_src_start
[
i_y_src
+
((
i_width
-
i_x
)
/
i_xscale
)
];
p_source
=
&
p_src_start
[
i_y_src
+
i_x_src
];
if
(
p_source
>=
p_src_end
)
{
if
(
p_source
>=
p_src_end
)
{
msg_Err
(
p_vout
,
"Trying to access beyond subtitle %d
x
%d %d"
,
msg_Err
(
p_vout
,
"Trying to access beyond subtitle %d
x
%d %d"
,
(
i_width
-
i_x
)
/
i_xscale
,
i_y
/
i_yscale
,
i_height
);
i_x
,
i_y
/
i_yscale
,
i_height
);
return
;
return
;
}
}
...
@@ -402,19 +603,31 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -402,19 +603,31 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
/* Completely transparent. Don't change pixel. */
/* Completely transparent. Don't change pixel. */
break
;
break
;
case
MAX_ALPHA
:
default:
for
(
i_ytmp
=
i_yreal
;
i_ytmp
<
i_ynext
;
case
MAX_ALPHA
:
i_ytmp
+=
p_pic
->
p
->
i_pitch
)
{
/* Completely opaque. Completely overwrite underlying
pixel with subtitle pixel. */
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
]);
uint8_t
*
p_pixel_base_x
=
p_pixel_base
+
2
*
(
i_x
>>
6
);
printf
(
"++multiline
\n
"
);
for
(
;
i_ytmp
<
i_ynext
;
i_ytmp
+=
p_pic
->
p
->
i_pitch
)
{
{
uint8_t
*
p_pixel
=
p_pixel_base_Y
+
i_ytmp
;
/* This is the location that's going to get changed. */
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
]);
uint8_t
*
p_dest
=
p_pixel_base_x
+
i_ytmp
;
*
p_pixel
=
i_colprecomp
;
#if 1
memset
(
p_dest
,
i_colprecomp
,
2
*
i_xscale
);
#else
memset
(
p_dest
,
0xFFFF
,
2
*
i_xscale
);
#endif
}
}
break
;
break
;
}
#ifdef FINISHED
default:
default:
for
(
i_ytmp
=
i_yreal
;
i_ytmp
<
i_ynext
;
for
(
;
i_ytmp
<
i_ynext
;
y_ytmp
+=
p_pic
->
p
->
i_pitch
)
i_ytmp
+=
p_pic
->
p
->
i_pitch
)
{
{
/* Blend in underlying pixel subtitle pixel. */
/* Blend in underlying pixel subtitle pixel. */
...
@@ -423,7 +636,7 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -423,7 +636,7 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
be completely transparent and is not correct, but
be completely transparent and is not correct, but
that's handled in a special case above anyway. */
that's handled in a special case above anyway. */
uint8_t
*
p_pixel
=
p_pixel_base
_Y
+
i_ytmp
;
uint8_t
*
p_pixel
=
p_pixel_base
+
i_ytmp
;
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
])
uint16_t
i_colprecomp
=
Y2RV16
(
p_source
->
plane
[
Y_PLANE
])
*
(
(
uint16_t
)
(
p_source
->
s
.
t
+
1
)
);
*
(
(
uint16_t
)
(
p_source
->
s
.
t
+
1
)
);
uint16_t
i_destalpha
=
MAX_ALPHA
-
p_source
->
s
.
t
;
uint16_t
i_destalpha
=
MAX_ALPHA
-
p_source
->
s
.
t
;
...
@@ -433,9 +646,27 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -433,9 +646,27 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
>>
ALPHA_SCALEDOWN
;
>>
ALPHA_SCALEDOWN
;
}
}
break
;
break
;
}
#endif
}
}
}
}
}
}
}
}
}
#define Y2RV32(val) ((uint32_t) (0x11111111 * ( (uint32_t) (val) >> 4 )))
static
void
RenderRV32
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_spu
,
vlc_bool_t
b_crop
)
{
/* Common variables */
msg_Err
(
p_vout
,
"RV32 not implemented yet"
);
}
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
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