diff options
author | Robin KAY <komadori@users.sourceforge.net> | 2004-03-16 00:32:22 +0000 |
---|---|---|
committer | Robin KAY <komadori@users.sourceforge.net> | 2004-03-16 00:32:22 +0000 |
commit | 9cf70773dbafda1c4003464e9f0b84f874ad3f06 (patch) | |
tree | 02abaabba6cc504306ce864464e1ec9b040d412c | |
parent | 1b9490fe861dcac0f58433ca33084658ae458675 (diff) | |
download | xine-lib-9cf70773dbafda1c4003464e9f0b84f874ad3f06.tar.gz xine-lib-9cf70773dbafda1c4003464e9f0b84f874ad3f06.tar.bz2 |
Fix overlay display in video_out_pgx32. Minor cosmetic changes to both PGX32 and PGX64 plugins.
CVS patchset: 6265
CVS date: 2004/03/16 00:32:22
-rw-r--r-- | src/video_out/video_out_pgx32.c | 76 | ||||
-rw-r--r-- | src/video_out/video_out_pgx64.c | 20 |
2 files changed, 75 insertions, 21 deletions
diff --git a/src/video_out/video_out_pgx32.c b/src/video_out/video_out_pgx32.c index f87894788..0c4f5eb36 100644 --- a/src/video_out/video_out_pgx32.c +++ b/src/video_out/video_out_pgx32.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_pgx32.c,v 1.2 2004/03/03 20:09:15 mroi Exp $ + * $Id: video_out_pgx32.c,v 1.3 2004/03/16 00:32:22 komadori Exp $ * * video_out_pgx32.c, Sun PGX32 output plugin for xine * @@ -246,7 +246,7 @@ static void pgx32_frame_proc_frame(vo_frame_t *frame_gen) y = *(yptr++); u = *(uptr++); v = *(vptr++); - *(dst++) = u | (y & 0xff00) | (v << 16) | ((y & 0x00ff) << 24); + *(dst++) = ((y & 0x00ff) << 24) | (v << 16) | (y & 0xff00) | u; } dst += (frame->pitch-frame->width)/2; } @@ -308,7 +308,7 @@ static void pgx32_frame_proc_slice(vo_frame_t *frame_gen, uint8_t **src) y = *(yptr++); u = *(uptr++); v = *(vptr++); - *(dst++) = u | (y & 0xff00) | (v << 16) | ((y & 0x00ff) << 24); + *(dst++) = ((y & 0x00ff) << 24) | (v << 16) | (y & 0xff00) | u; } dst += (frame->pitch-frame->width)/2; } @@ -519,22 +519,76 @@ static void pgx32_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->current = frame; } +#define blend(a, b, trans) (((a)*(trans) + (b)*(15-(trans))) / 15) + static void pgx32_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { /*pgx32_driver_t *this = (pgx32_driver_t *)(void *)this_gen;*/ pgx32_frame_t *frame = (pgx32_frame_t *)frame_gen; if (overlay->rle) { - switch (frame->format) { - case XINE_IMGFMT_YV12: { - blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches); - } - break; + int i, j, x, y, len, width; + int use_clip_palette; + uint16_t *dst; + clut_t clut; + uint8_t trans; + + dst = (uint16_t *)frame->packedbuf + (overlay->y * frame->pitch) + overlay->x; + + for (i=0, x=0, y=0; i<overlay->num_rle; i++) { + len = overlay->rle[i].len; + + while (len > 0) { + use_clip_palette = 0; + if (len > overlay->width) { + width = overlay->width; + len -= overlay->width; + } + else { + width = len; + len = 0; + } + + if ((y >= overlay->clip_top) && (y <= overlay->clip_bottom) && (x <= overlay->clip_right)) { + if ((x < overlay->clip_left) && (x + width - 1 >= overlay->clip_left)) { + width -= overlay->clip_left - x; + len += overlay->clip_left - x; + } + else if (x > overlay->clip_left) { + use_clip_palette = 1; + if (x + width - 1 > overlay->clip_right) { + width -= overlay->clip_right - x; + len += overlay->clip_right - x; + } + } + } - case XINE_IMGFMT_YUY2: { - blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0]); + if (use_clip_palette) { + clut = *(clut_t *)&overlay->clip_color[overlay->rle[i].color]; + trans = overlay->clip_trans[overlay->rle[i].color]; + } + else { + clut = *(clut_t *)&overlay->color[overlay->rle[i].color]; + trans = overlay->trans[overlay->rle[i].color]; + } + + for (j=0; j<width; j++) { + if ((overlay->x + x + j) & 1) { + *(dst-1) = (blend(clut.y, (*(dst-1) >> 8), trans) << 8) | blend(clut.cr, (*(dst-1) & 0xff), trans); + } + else { + *(dst+1) = (blend(clut.y, (*(dst+1) >> 8), trans) << 8) | blend(clut.cb, (*(dst+1) & 0xff), trans); + } + dst++; + } + + x += width; + if (x == overlay->width) { + x = 0; + y++; + dst += frame->pitch - overlay->width; + } } - break; } } } diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c index 640d14667..7de9fe733 100644 --- a/src/video_out/video_out_pgx64.c +++ b/src/video_out/video_out_pgx64.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_pgx64.c,v 1.53 2004/03/03 20:09:15 mroi Exp $ + * $Id: video_out_pgx64.c,v 1.54 2004/03/16 00:32:22 komadori Exp $ * * video_out_pgx64.c, Sun PGX64/PGX24 output plugin for xine * @@ -247,7 +247,7 @@ static void repaint_output_area(pgx64_driver_t *this) * Reset video memory allocator and release detained frames */ -static void vbase_reset(pgx64_driver_t * this) +static void vram_reset(pgx64_driver_t * this) { int i; @@ -263,7 +263,7 @@ static void vbase_reset(pgx64_driver_t * this) * Allocate a portion of video memory */ -static int vbase_alloc(pgx64_driver_t * this, int size) +static int vram_alloc(pgx64_driver_t * this, int size) { if (this->free_mark - size < this->free_bottom) { return -1; @@ -426,7 +426,7 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->vo_scale.force_redraw = 1; _x_vo_scale_compute_ideal_size(&this->vo_scale); - vbase_reset(this); + vram_reset(this); if (this->multibuf_en) { this->buf_mode = BUF_MODE_MULTI; } @@ -480,14 +480,14 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) if (frame->vo_frame.proc_slice != pgx64_frame_proc_slice) { for (i=0;i<frame->planes;i++) { - if ((frame->buffers[i] = vbase_alloc(this, frame->lengths[i])) < 0) { + if ((frame->buffers[i] = vram_alloc(this, frame->lengths[i])) < 0) { if (this->detained_frames < MAX_DETAINED_FRAMES) { this->detained[this->detained_frames++] = frame; return; } else { xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Warning: low video memory, multi-buffering disabled\n")); - vbase_reset(this); + vram_reset(this); this->buf_mode = BUF_MODE_NOT_MULTI; break; } @@ -512,7 +512,7 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) if (this->buf_mode == BUF_MODE_NOT_MULTI) { for (i=0;i<frame->planes;i++) { - if ((this->buffers[0][i] = vbase_alloc(this, frame->lengths[i])) < 0) { + if ((this->buffers[0][i] = vram_alloc(this, frame->lengths[i])) < 0) { xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Error: insuffucient video memory\n")); return; } @@ -523,7 +523,7 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->buf_mode = BUF_MODE_DOUBLE; for (i=0;i<frame->planes;i++) { - if ((this->buffers[1][i] = vbase_alloc(this, frame->lengths[i])) < 0) { + if ((this->buffers[1][i] = vram_alloc(this, frame->lengths[i])) < 0) { this->buf_mode = BUF_MODE_SINGLE; } else { @@ -625,10 +625,10 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen XLockDisplay(this->display); ovl->p = XCreatePixmap(this->display, this->drawable, ovl->width, ovl->height, this->depth); - for (i=0, x=0, y=0;i<overlay->num_rle;i++) { + for (i=0, x=0, y=0; i<overlay->num_rle; i++) { len = overlay->rle[i].len; - while (len > 0) { + while (len > 0) { use_clip_palette = 0; if (len > overlay->width) { width = overlay->width; |