summaryrefslogtreecommitdiffstats
path: root/spudec.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-07-24 21:34:13 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:14:45 +0200
commit4533ea0d55bd03905f2741b93912d58a9c7ffd0c (patch)
tree143cce1c572517f75cca95c5273e951ba90d0288 /spudec.c
parentaf62b02a637faaaf0633f4d4a8bf06aa36e95baa (diff)
downloadmpv-4533ea0d55bd03905f2741b93912d58a9c7ffd0c.tar.bz2
mpv-4533ea0d55bd03905f2741b93912d58a9c7ffd0c.tar.xz
spudec: Slightly simplify dvd subtitle RLE decoding
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31790 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'spudec.c')
-rw-r--r--spudec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/spudec.c b/spudec.c
index 904fb69126..6ac30c32c7 100644
--- a/spudec.c
+++ b/spudec.c
@@ -267,6 +267,7 @@ static void spudec_process_data(spudec_handle_t *this, packet_t *packet)
{
uint16_t pal[4];
unsigned int i, x, y;
+ uint8_t *dst;
this->scaled_frame_width = 0;
this->scaled_frame_height = 0;
@@ -298,6 +299,7 @@ static void spudec_process_data(spudec_handle_t *this, packet_t *packet)
i = packet->current_nibble[1];
x = 0;
y = 0;
+ dst = this->pal_image;
while (packet->current_nibble[0] < i
&& packet->current_nibble[1] / 2 < packet->control_start
&& y < this->height) {
@@ -317,17 +319,17 @@ static void spudec_process_data(spudec_handle_t *this, packet_t *packet)
}
color = 3 - (rle & 0x3);
len = rle >> 2;
- if (len > this->width - x || len == 0)
- len = this->width - x;
- memset(this->pal_image + y * this->stride + x, color, len);
x += len;
- if (x >= this->width) {
+ if (len == 0 || x >= this->width) {
+ len += this->width - x;
next_line(packet);
x = 0;
++y;
}
+ memset(dst, color, len);
+ dst += len;
}
- pal2gray_alpha(pal, this->pal_image, this->stride,
+ pal2gray_alpha(pal, this->pal_image, this->width,
this->image, this->aimage, this->stride,
this->width, this->height);
spudec_cut_image(this);