Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
bc326075
Commit
bc326075
authored
Dec 27, 2003
by
Rocky Bernstein
Browse files
Scale bitmaps for 4:3 output
parent
a1c4ba2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/codec/ogt/ogt.h
View file @
bc326075
...
...
@@ -2,7 +2,7 @@
* ogt.h : Overlay Graphics Text (SVCD subtitles) decoder thread interface
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ogt.h,v 1.
4
2003/12/2
6
0
2
:4
7
:59 rocky Exp $
* $Id: ogt.h,v 1.
5
2003/12/2
7
0
1
:4
9
:59 rocky Exp $
*
* Author: Rocky Bernstein
* based on code from:
...
...
@@ -28,7 +28,8 @@
#define DECODE_DBG_CALL 2
/* all calls */
#define DECODE_DBG_PACKET 4
/* packet assembly info */
#define DECODE_DBG_IMAGE 8
/* image bitmaps */
#define DECODE_DBG_INFO 16
#define DECODE_DBG_TRANSFORM 16
/* bitmap transformations */
#define DECODE_DBG_INFO 32
#define DECODE_DEBUG 1
#if DECODE_DEBUG
...
...
modules/codec/ogt/parse.c
View file @
bc326075
...
...
@@ -2,7 +2,7 @@
* parse.c: Philips OGT (SVCD subtitle) packet parser
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: parse.c,v 1.
1
2003/12/2
6
01:
3
9:
23
rocky Exp $
* $Id: parse.c,v 1.
2
2003/12/2
7
01:
4
9:
59
rocky Exp $
*
* Authors: Rocky Bernstein
* based on code from:
...
...
@@ -240,43 +240,73 @@ ExtractField(uint8_t *p, unsigned int i_remaining)
return
(
(
*
p
>>
2
*
(
i_remaining
-
1
)
)
&
0x3
);
}
#ifdef FINISHED
/* Scales down (reduces size) of p_dest in the x direction as
determined through aspect ratio x_scale by y_scale. Scaling
is done in place. i_width, is updated to new
ratio.
is done in place.
p_spu->
i_width, is updated to new
width
The aspect ratio is assumed to be between 1 and
2
.
The aspect ratio is assumed to be between 1
/2
and
1
.
*/
static
void
ScaleX
(
uint8
_t
*
p_de
st
,
/*in out */
u_int16_t
*
i_width
,
u_int16_t
i_height
,
unsigned
int
scale_x
,
unsigned
int
scale_y
)
ScaleX
(
decoder
_t
*
p_de
c
,
subpicture_t
*
p_spu
,
unsigned
int
i_
scale_x
,
unsigned
int
i_
scale_y
)
{
int
i_row
,
i_col
;
uint8_t
*
p1
=
p_dest
;
uint8_t
*
p2
=
p_dest
+
PIXEL_SIZE
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
uint8_t
*
p_src1
=
p_spu
->
p_sys
->
p_data
;
uint8_t
*
p_src2
=
p_src1
+
PIXEL_SIZE
;
uint8_t
*
p_dst
=
p_src1
;
unsigned
int
i_new_width
=
(
p_spu
->
i_width
*
i_scale_x
)
/
i_scale_y
;
unsigned
int
used
=
0
;
/* Number of bytes used up in p_src1. */
dbg_print
(
(
DECODE_DBG_CALL
|
DECODE_DBG_TRANSFORM
)
,
"Old width: %d, new width: %d"
,
p_spu
->
i_width
,
i_new_width
);
unsigned
int
used
=
0
;
/* Number of bytes used up in p1. */
for
(
i_row
=
0
;
i_row
<=
p_spu
->
i_height
-
1
;
i_row
++
)
{
for
(
i_row
=
0
;
i_row
<
i_height
-
1
;
i_row
++
)
{
for
(
i_col
=
0
;
i_col
<=
(
*
i_width
)
-
2
;
i_col
++
)
{
if
(
used
!=
0
)
{
/* Discard the remaining piece of the colum of the previous line*/
used
=
0
;
p_src1
=
p_src2
;
p_src2
+=
PIXEL_SIZE
;
}
for
(
i_col
=
0
;
i_col
<=
p_spu
->
i_width
-
2
;
i_col
++
)
{
unsigned
int
i
;
unsigned
int
w1
=
scale_x
-
used
;
unsigned
int
w2
=
scale_y
-
w1
;
unsigned
int
w1
=
i_scale_x
-
used
;
unsigned
int
w2
=
i_scale_y
-
w1
;
used
=
w2
;
for
(
i
=
0
;
i
<
PIXEL_SIZE
;
i
++
)
{
*
p
1
=
(
(
*
p1
*
w1
)
+
(
*
p2
*
w2
)
)
/
scale_y
;
p1
++
;
p
2
++
;
*
p
_dst
=
(
(
*
p
_src
1
*
w1
)
+
(
*
p
_src
2
*
w2
)
)
/
i_
scale_y
;
p
_src
1
++
;
p
_src2
++
;
p_dst
++
;
}
if
(
scale_x
==
used
)
{
p1
=
p2
;
p2
+=
PIXEL_SIZE
;
if
(
i_scale_x
==
used
)
{
/* End of last pixel was end of p_src2. */
p_src1
=
p_src2
;
p_src2
+=
PIXEL_SIZE
;
i_col
++
;
used
=
0
;
}
}
}
/* *i_width = ((*i_width) * scale_y) / scale_x; */
p_spu
->
i_width
=
i_new_width
;
if
(
p_sys
&&
p_sys
->
i_debug
&
DECODE_DBG_TRANSFORM
)
{
ogt_yuvt_t
*
p_source
=
(
ogt_yuvt_t
*
)
p_spu
->
p_sys
->
p_data
;
for
(
i_row
=
0
;
i_row
<
p_spu
->
i_height
-
1
;
i_row
++
)
{
for
(
i_col
=
0
;
i_col
<
p_spu
->
i_width
-
1
;
i_col
++
)
{
printf
(
"%1x"
,
p_source
->
t
);
p_source
++
;
}
printf
(
"
\n
"
);
}
}
}
#endif
/*****************************************************************************
* ParseImage: parse the image part of the subtitle
...
...
@@ -395,14 +425,12 @@ ParseImage( decoder_t *p_dec, subpicture_t * p_spu )
}
}
#ifdef FINISHED
/* The video is automatically scaled. However subtitle bitmaps
assume a 1:1 aspect ratio. So we need to scale to compensate for
or undo the effects of video output scaling.
*/
/* FIXME do the right scaling depending on vout. It may not be 4:3 */
ScaleX
(
p_dest
,
&
(
p_sys
->
i_width
),
i_height
,
3
,
4
);
#endif
ScaleX
(
p_dec
,
p_spu
,
3
,
4
);
return
VLC_SUCCESS
;
}
...
...
modules/codec/ogt/render.c
View file @
bc326075
...
...
@@ -2,7 +2,7 @@
* render.c : Philips OGT (SVCD Subtitle) renderer
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: render.c,v 1.
1
2003/12/2
6
01:
3
9:
3
5 rocky Exp $
* $Id: render.c,v 1.
2
2003/12/2
7
01:
4
9:5
9
rocky Exp $
*
* Author: Rocky Bernstein
* based on code from:
...
...
@@ -55,9 +55,9 @@ void E_(RenderSPU)( vout_thread_t *p_vout, picture_t *p_pic,
const
subpicture_t
*
p_spu
)
{
#ifndef FINISHED
printf
(
"+++%x
\n
"
,
p_vout
->
output
.
i_chroma
);
#endif
/*
printf("+++%x\n", p_vout->output.i_chroma);
*/
switch
(
p_vout
->
output
.
i_chroma
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment