Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
fd474910
Commit
fd474910
authored
Jan 23, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/codec/dvbsub.c: full 4 and 8 bits RLE encodings.
parent
a66cfc28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
122 additions
and
2 deletions
+122
-2
modules/codec/dvbsub.c
modules/codec/dvbsub.c
+122
-2
No files found.
modules/codec/dvbsub.c
View file @
fd474910
...
...
@@ -1646,6 +1646,9 @@ static void encode_pixel_line_2bp( encoder_t *p_enc, bs_t *s,
static
void
encode_pixel_line_4bp
(
encoder_t
*
p_enc
,
bs_t
*
s
,
subpicture_region_t
*
p_region
,
int
i_line
);
static
void
encode_pixel_line_8bp
(
encoder_t
*
p_enc
,
bs_t
*
s
,
subpicture_region_t
*
p_region
,
int
i_line
);
static
void
encode_pixel_data
(
encoder_t
*
p_enc
,
bs_t
*
s
,
subpicture_region_t
*
p_region
,
vlc_bool_t
b_top
)
...
...
@@ -1671,6 +1674,11 @@ static void encode_pixel_data( encoder_t *p_enc, bs_t *s,
encode_pixel_line_4bp
(
p_enc
,
s
,
p_region
,
i_line
);
break
;
case
256
:
bs_write
(
s
,
8
,
0x12
);
/* 8 bit/pixel code string */
encode_pixel_line_8bp
(
p_enc
,
s
,
p_region
,
i_line
);
break
;
default:
msg_Err
(
p_enc
,
"subpicture palette (%i) not handled"
,
p_region
->
fmt
.
p_palette
->
i_entries
);
...
...
@@ -1784,13 +1792,13 @@ static void encode_pixel_line_4bp( encoder_t *p_enc, bs_t *s,
for
(
i
=
0
;
i
<=
p_region
->
fmt
.
i_visible_width
;
i
++
)
{
if
(
i
!=
p_region
->
fmt
.
i_visible_width
&&
p_data
[
i
]
==
i_last_pixel
&&
i_length
!=
1
)
p_data
[
i
]
==
i_last_pixel
&&
i_length
!=
280
)
{
i_length
++
;
continue
;
}
if
(
i_length
==
1
)
if
(
i_length
==
1
||
(
i_length
==
3
&&
i_last_pixel
)
||
i_length
==
8
)
{
/* 4bit/pixel code */
if
(
i_last_pixel
)
bs_write
(
s
,
4
,
i_last_pixel
);
...
...
@@ -1801,6 +1809,58 @@ static void encode_pixel_line_4bp( encoder_t *p_enc, bs_t *s,
bs_write
(
s
,
1
,
1
);
bs_write
(
s
,
2
,
0
);
/* pseudo color 0 */
}
i_length
--
;
}
if
(
i_length
==
2
)
{
if
(
i_last_pixel
)
{
bs_write
(
s
,
4
,
i_last_pixel
);
bs_write
(
s
,
4
,
i_last_pixel
);
}
else
{
bs_write
(
s
,
4
,
0
);
bs_write
(
s
,
1
,
1
);
bs_write
(
s
,
1
,
1
);
bs_write
(
s
,
2
,
1
);
/* 2 * pseudo color 0 */
}
}
else
if
(
!
i_last_pixel
&&
i_length
>=
3
&&
i_length
<=
9
)
{
bs_write
(
s
,
4
,
0
);
bs_write
(
s
,
1
,
0
);
bs_write
(
s
,
3
,
i_length
-
2
);
/* (i_length - 2) * color 0 */
}
else
if
(
i_length
>
2
)
{
bs_write
(
s
,
4
,
0
);
bs_write
(
s
,
1
,
1
);
if
(
i_length
<=
7
)
{
bs_write
(
s
,
1
,
0
);
bs_write
(
s
,
2
,
i_length
-
4
);
bs_write
(
s
,
4
,
i_last_pixel
);
}
else
{
bs_write
(
s
,
1
,
1
);
if
(
i_length
<=
24
)
{
bs_write
(
s
,
2
,
2
);
bs_write
(
s
,
4
,
i_length
-
9
);
bs_write
(
s
,
4
,
i_last_pixel
);
}
else
{
bs_write
(
s
,
2
,
3
);
bs_write
(
s
,
8
,
i_length
-
25
);
bs_write
(
s
,
4
,
i_last_pixel
);
}
}
}
if
(
i
==
p_region
->
fmt
.
i_visible_width
)
break
;
...
...
@@ -1815,3 +1875,63 @@ static void encode_pixel_line_4bp( encoder_t *p_enc, bs_t *s,
/* Stuffing */
bs_align_0
(
s
);
}
static
void
encode_pixel_line_8bp
(
encoder_t
*
p_enc
,
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_last_pixel
=
p_data
[
0
];
for
(
i
=
0
;
i
<=
p_region
->
fmt
.
i_visible_width
;
i
++
)
{
if
(
i
!=
p_region
->
fmt
.
i_visible_width
&&
p_data
[
i
]
==
i_last_pixel
&&
i_length
!=
127
)
{
i_length
++
;
continue
;
}
if
(
i_length
==
1
&&
i_last_pixel
)
{
/* 8bit/pixel code */
bs_write
(
s
,
8
,
i_last_pixel
);
}
else
if
(
i_length
==
2
&&
i_last_pixel
)
{
/* 8bit/pixel code */
bs_write
(
s
,
8
,
i_last_pixel
);
bs_write
(
s
,
8
,
i_last_pixel
);
}
else
if
(
i_length
<=
127
)
{
bs_write
(
s
,
8
,
0
);
if
(
!
i_last_pixel
)
{
bs_write
(
s
,
1
,
0
);
bs_write
(
s
,
7
,
i_length
);
/* pseudo color 0 */
}
else
{
bs_write
(
s
,
1
,
1
);
bs_write
(
s
,
7
,
i_length
);
bs_write
(
s
,
8
,
i_last_pixel
);
}
}
if
(
i
==
p_region
->
fmt
.
i_visible_width
)
break
;
i_last_pixel
=
p_data
[
i
];
i_length
=
1
;
}
/* Stop */
bs_write
(
s
,
8
,
0
);
bs_write
(
s
,
8
,
0
);
/* Stuffing */
bs_align_0
(
s
);
}
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