summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libspudec/spu.c3
-rw-r--r--src/video_out/alphablend.c48
-rw-r--r--src/video_out/video_out_xshm.c24
-rw-r--r--src/video_out/yuv2rgb.c223
-rw-r--r--src/video_out/yuv2rgb.h13
-rw-r--r--src/xine-engine/video_out.h5
6 files changed, 227 insertions, 89 deletions
diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c
index 780f4a24b..e25f62656 100644
--- a/src/libspudec/spu.c
+++ b/src/libspudec/spu.c
@@ -19,7 +19,7 @@
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
-* $Id: spu.c,v 1.14 2001/10/04 23:22:21 miguelfreitas Exp $
+* $Id: spu.c,v 1.15 2001/10/09 22:20:11 miguelfreitas Exp $
*
*****/
@@ -361,6 +361,7 @@ void spuDrawPicture (spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl)
}
ovl->num_rle = rle - ovl->rle;
+ ovl->rgb_clut = 0;
}
/* Heuristic to discover the colors used by the subtitles
diff --git a/src/video_out/alphablend.c b/src/video_out/alphablend.c
index f480c465c..a10c64a6d 100644
--- a/src/video_out/alphablend.c
+++ b/src/video_out/alphablend.c
@@ -78,7 +78,7 @@ static void mem_blend32(uint8_t *mem, uint8_t r, uint8_t g, uint8_t b,
}
-/*
+/*
* Some macros for fixed point arithmetic.
*
* The blend_rgb* routines perform rle image scaling using
@@ -107,13 +107,11 @@ rle_img_advance_line(rle_elem_t *rle, rle_elem_t *rle_limit, int w)
}
-/* TODO: RGB color clut, only b/w now */
void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl,
int img_width, int img_height,
int dst_width, int dst_height)
{
- uint8_t *my_trans;
- uint16_t my_clut[4];
+ uint8_t *trans;
clut_t* clut = (clut_t*) img_overl->color;
int src_width = img_overl->width;
@@ -131,11 +129,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl,
+ (img_overl->y * img_height / dst_height) * img_width
+ (img_overl->x * img_width / dst_width);
- for (x = 0; x < 4; x++) {
- uint16_t clr = clut[x].y >> 2;
- my_clut[x] = (clr & 0xfe) << 10 | clr << 5 | (clr >> 1);
- }
- my_trans = img_overl->trans;
+ trans = img_overl->trans;
for (y = dy = 0; y < src_height && rle < rle_limit;) {
int mask = !(img_overl->clip_top > y || img_overl->clip_bottom < y);
@@ -146,7 +140,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl,
uint16_t o;
clr = rle->color;
- o = my_trans[clr];
+ o = trans[clr];
if (o) if (img_overl->clip_left > x ||
img_overl->clip_right < x)
@@ -154,7 +148,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl,
x2_scaled = SCALED_TO_INT((x + rle->len) * x_scale);
if (o && mask) {
- mem_blend16(img_pix+x1_scaled, my_clut[clr], o, x2_scaled-x1_scaled);
+ mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled);
}
x1_scaled = x2_scaled;
@@ -179,13 +173,12 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl,
}
}
-/* TODO: RGB color clut, only b/w now */
void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl,
int img_width, int img_height,
int dst_width, int dst_height)
{
- clut_t *my_clut;
- uint8_t *my_trans;
+ clut_t* clut = (clut_t*) img_overl->color;
+ uint8_t *trans;
int src_width = img_overl->width;
int src_height = img_overl->height;
rle_elem_t *rle = img_overl->rle;
@@ -200,8 +193,7 @@ void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl,
img_pix = img + 3 * ( (img_overl->y * img_height / dst_height) * img_width
+ (img_overl->x * img_width / dst_width));
- my_clut = (clut_t*) img_overl->color;
- my_trans = img_overl->trans;
+ trans = img_overl->trans;
for (dy = y = 0; y < src_height && rle < rle_limit; ) {
int mask = !(img_overl->clip_top > y || img_overl->clip_bottom < y);
@@ -212,7 +204,7 @@ void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl,
uint16_t o;
clr = rle->color;
- o = my_trans[clr];
+ o = trans[clr];
if (o) if (img_overl->clip_left > x ||
img_overl->clip_right < x)
@@ -220,8 +212,9 @@ void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl,
x2_scaled = SCALED_TO_INT((x + rle->len) * x_scale);
if (o && mask) {
- uint8_t v = my_clut[clr].y;
- mem_blend24(img_pix + x1_scaled*3, v, v, v, o, x2_scaled-x1_scaled);
+ mem_blend24(img_pix + x1_scaled*3, clut[clr].cb,
+ clut[clr].cr, clut[clr].y,
+ o, x2_scaled-x1_scaled);
}
x1_scaled = x2_scaled;
@@ -246,13 +239,12 @@ void blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl,
}
}
-/* TODO: RGB color clut, only b/w now */
-void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl,
+void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl,
int img_width, int img_height,
int dst_width, int dst_height)
{
- clut_t *my_clut;
- uint8_t *my_trans;
+ clut_t* clut = (clut_t*) img_overl->color;
+ uint8_t *trans;
int src_width = img_overl->width;
int src_height = img_overl->height;
rle_elem_t *rle = img_overl->rle;
@@ -267,8 +259,7 @@ void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl,
img_pix = img + 4 * ( (img_overl->y * img_height / dst_height) * img_width
+ (img_overl->x * img_width / dst_width));
- my_clut = (clut_t*) img_overl->color;
- my_trans = img_overl->trans;
+ trans = img_overl->trans;
for (y = dy = 0; y < src_height && rle < rle_limit; ) {
int mask = !(img_overl->clip_top > y || img_overl->clip_bottom < y);
@@ -279,7 +270,7 @@ void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl,
uint16_t o;
clr = rle->color;
- o = my_trans[clr];
+ o = trans[clr];
if (o) if (img_overl->clip_left > x ||
img_overl->clip_right < x)
@@ -287,8 +278,9 @@ void blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl,
x2_scaled = SCALED_TO_INT((x + rle->len) * x_scale);
if (o && mask) {
- uint8_t v = my_clut[clr].y;
- mem_blend32(img_pix + x1_scaled*4, v, v, v, o, x2_scaled-x1_scaled);
+ mem_blend32(img_pix + x1_scaled*4, clut[clr].cb,
+ clut[clr].cr, clut[clr].y,
+ o, x2_scaled-x1_scaled);
}
x1_scaled = x2_scaled;
diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c
index 56aa1c4a0..b1fd058be 100644
--- a/src/video_out/video_out_xshm.c
+++ b/src/video_out/video_out_xshm.c
@@ -12,12 +12,12 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* 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_xshm.c,v 1.42 2001/10/09 09:50:22 jkeil Exp $
+ * $Id: video_out_xshm.c,v 1.43 2001/10/09 22:20:11 miguelfreitas Exp $
*
* video_out_xshm.c, X11 shared memory extension interface for xine
*
@@ -57,8 +57,8 @@
#include "monitor.h"
#include "utils.h"
#include "video_out_x11.h"
-#include "yuv2rgb.h"
#include "alphablend.h"
+#include "yuv2rgb.h"
uint32_t xine_debug;
@@ -709,15 +709,31 @@ static void xshm_update_frame_format (vo_driver_t *this_gen,
}
}
+static void xshm_overlay_clut_yuv2rgb(xshm_driver_t *this, vo_overlay_t *overlay)
+{
+ int i;
+ clut_t* clut = (clut_t*) overlay->color;
+
+ for (i = 0; i < 4; i++) {
+ *((uint32_t *)&clut[i]) =
+ this->yuv2rgb->yuv2rgb_single_pixel_fun(this->yuv2rgb,
+ clut[i].y, clut[i].cb, clut[i].cr);
+ }
+ overlay->rgb_clut++;
+}
+
static void xshm_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) {
xshm_driver_t *this = (xshm_driver_t *) this_gen;
xshm_frame_t *frame = (xshm_frame_t *) frame_gen;
/* Alpha Blend here */
if (overlay->rle) {
+ if( !overlay->rgb_clut )
+ xshm_overlay_clut_yuv2rgb(this,overlay);
+
switch(this->bpp) {
case 16:
- blend_rgb16( (uint8_t *)frame->image->data, overlay,
+ blend_rgb16( (uint8_t *)frame->image->data, overlay,
frame->rgb_width, frame->rgb_height,
this->delivered_width, this->delivered_height);
break;
diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c
index 2b04bc370..573989200 100644
--- a/src/video_out/yuv2rgb.c
+++ b/src/video_out/yuv2rgb.c
@@ -22,7 +22,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: yuv2rgb.c,v 1.23 2001/10/03 15:14:03 jkeil Exp $
+ * $Id: yuv2rgb.c,v 1.24 2001/10/09 22:20:11 miguelfreitas Exp $
*/
#include "config.h"
@@ -1221,7 +1221,7 @@ static void scale_line_4 (uint8_t *source, uint8_t *dest,
width --;
}
}
-
+
#define RGB(i) \
U = pu[i]; \
@@ -1589,7 +1589,7 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst,
while (--dst_height > 0 && dy < 32768) {
- memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3);
+ memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3);
dy += this->step_dy;
_dst += this->rgb_stride;
@@ -1975,7 +1975,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst,
this->dest_width >> 1, this->step_dx);
scale_line (_pv, this->v_buffer,
this->dest_width >> 1, this->step_dx);
- scale_line (_py, this->y_buffer,
+ scale_line (_py, this->y_buffer,
this->dest_width, this->step_dx);
dy = 0;
@@ -2025,7 +2025,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst,
dy -= 32768;
_py += this->y_stride;
- scale_line (_py, this->y_buffer,
+ scale_line (_py, this->y_buffer,
this->dest_width, this->step_dx);
if (height & 1) {
@@ -2238,7 +2238,7 @@ static void yuv2rgb_setup_tables (yuv2rgb_t *this, int mode, int swapped)
for (i = -197; i < 256+197; i++)
((uint16_t *)table_r)[i] = (table_Y[i+384] >> 3) << 10;
- for (i = -132; i < 256+132; i++)
+ for (i = -132; i < 256+132; i++)
((uint16_t *)table_g)[i] = (table_Y[i+384] >> 3) << 5;
for (i = -232; i < 256+232; i++)
@@ -2263,8 +2263,84 @@ static void yuv2rgb_setup_tables (yuv2rgb_t *this, int mode, int swapped)
}
}
+static uint32_t yuv2rgb_single_pixel_32 (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v)
+{
+ uint32_t * r, * g, * b;
+
+ r = this->table_rV[v];
+ g = (void *) (((uint8_t *)this->table_gU[u]) + this->table_gV[v]);
+ b = this->table_bU[u];
+
+ return r[y] + g[y] + b[y];
+}
+
+static uint32_t yuv2rgb_single_pixel_24_rgb (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v)
+{
+ uint8_t * r, * g, * b;
+
+ r = this->table_rV[v];
+ g = (void *) (((uint8_t *)this->table_gU[u]) + this->table_gV[v]);
+ b = this->table_bU[u];
+
+ return (uint32_t) r[y] +
+ ((uint32_t) g[y] << 8) +
+ ((uint32_t) b[y] << 16);
+}
+
+static uint32_t yuv2rgb_single_pixel_24_bgr (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v)
+{
+ uint8_t * r, * g, * b;
+
+ r = this->table_rV[v];
+ g = (void *) (((uint8_t *)this->table_gU[u]) + this->table_gV[v]);
+ b = this->table_bU[u];
+
+ return (uint32_t) b[y] +
+ ((uint32_t) g[y] << 8) +
+ ((uint32_t) r[y] << 16);
+}
+
+static uint32_t yuv2rgb_single_pixel_16 (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v)
+{
+ uint16_t * r, * g, * b;
+
+ r = this->table_rV[v];
+ g = (void *) (((uint8_t *)this->table_gU[u]) + this->table_gV[v]);
+ b = this->table_bU[u];
+
+ return r[y] + g[y] + b[y];
+}
+
+static uint32_t yuv2rgb_single_pixel_8 (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v)
+{
+ uint8_t * r, * g, * b;
+
+ r = this->table_rV[v];
+ g = (void *) (((uint8_t *)this->table_gU[u]) + this->table_gV[v]);
+ b = this->table_bU[u];
+
+ return r[y] + g[y] + b[y];
+}
+
+static uint32_t yuv2rgb_single_pixel_gray (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v)
+{
+ return y;
+}
+
+static uint32_t yuv2rgb_single_pixel_palette (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v)
+{
+ uint16_t * r, * g, * b;
+
+ r = this->table_rV[v];
+ g = (void *) (((uint8_t *)this->table_gU[u]) + this->table_gV[v]);
+ b = this->table_bU[u];
+
+ return this->fast_rgb[r[y] + g[y] + b[y]];
+}
+
+
static void yuv2rgb_c_init (yuv2rgb_t *this, int mode, int swapped)
-{
+{
switch (mode) {
case MODE_32_RGB:
case MODE_32_BGR:
@@ -2274,7 +2350,7 @@ static void yuv2rgb_c_init (yuv2rgb_t *this, int mode, int swapped)
case MODE_24_RGB:
case MODE_24_BGR:
this->yuv2rgb_fun =
- (mode==MODE_24_RGB && !swapped) || (mode==MODE_24_BGR && swapped)
+ (mode==MODE_24_RGB && !swapped) || (mode==MODE_24_BGR && swapped)
? yuv2rgb_c_24_rgb
: yuv2rgb_c_24_bgr;
break;
@@ -2306,6 +2382,48 @@ static void yuv2rgb_c_init (yuv2rgb_t *this, int mode, int swapped)
}
+static void yuv2rgb_single_pixel_init (yuv2rgb_t *this, int mode, int swapped)
+{
+ switch (mode) {
+ case MODE_32_RGB:
+ case MODE_32_BGR:
+ this->yuv2rgb_single_pixel_fun = yuv2rgb_single_pixel_32;
+ break;
+
+ case MODE_24_RGB:
+ case MODE_24_BGR:
+ this->yuv2rgb_single_pixel_fun =
+ (mode==MODE_24_RGB && !swapped) || (mode==MODE_24_BGR && swapped)
+ ? yuv2rgb_single_pixel_24_rgb
+ : yuv2rgb_single_pixel_24_bgr;
+ break;
+
+ case MODE_15_BGR:
+ case MODE_16_BGR:
+ case MODE_15_RGB:
+ case MODE_16_RGB:
+ this->yuv2rgb_single_pixel_fun = yuv2rgb_single_pixel_16;
+ break;
+
+ case MODE_8_RGB:
+ case MODE_8_BGR:
+ this->yuv2rgb_single_pixel_fun = yuv2rgb_single_pixel_8;
+ break;
+
+ case MODE_8_GRAY:
+ this->yuv2rgb_single_pixel_fun = yuv2rgb_single_pixel_gray;
+ break;
+
+ case MODE_PALETTE:
+ this->yuv2rgb_single_pixel_fun = yuv2rgb_single_pixel_palette;
+ break;
+
+ default:
+ fprintf (stderr, "mode %d not supported by yuv2rgb\n", mode);
+ exit (1);
+ }
+}
+
/*
* yuy2 stuff
@@ -2326,7 +2444,7 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
this->dest_width >> 1, this->step_dx);
scale_line_4 (_p+3, this->v_buffer,
this->dest_width >> 1, this->step_dx);
- scale_line_2 (_p, this->y_buffer,
+ scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
dy = 0;
@@ -2337,14 +2455,14 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
py_1 = this->y_buffer;
pu = this->u_buffer;
pv = this->v_buffer;
-
+
width = this->dest_width >> 3;
do {
RGB(0);
DST1(0);
-
+
RGB(1);
DST1(1);
@@ -2353,7 +2471,7 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
RGB(3);
DST1(3);
-
+
pu += 4;
pv += 4;
py_1 += 8;
@@ -2365,7 +2483,7 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
while (--height > 0 && dy < 32768) {
- memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4);
+ memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4);
dy += this->step_dy;
_dst += this->rgb_stride;
@@ -2403,7 +2521,7 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
this->dest_width >> 1, this->step_dx);
scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
-
+
dy = 0;
height = this->dest_height;
@@ -2427,19 +2545,19 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
RGB(3);
DST1RGB(3);
-
+
pu += 4;
pv += 4;
py_1 += 8;
dst_1 += 24;
} while (--width);
-
+
dy += this->step_dy;
_dst += this->rgb_stride;
while (--height > 0 && dy < 32768) {
-
- memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3);
+
+ memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3);
dy += this->step_dy;
_dst += this->rgb_stride;
@@ -2455,7 +2573,7 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
this->dest_width >> 1, this->step_dx);
scale_line_4 (_p+3, this->v_buffer,
this->dest_width >> 1, this->step_dx);
- scale_line_2 (_p, this->y_buffer,
+ scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
}
}
@@ -2477,7 +2595,7 @@ static void yuy22rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
this->dest_width >> 1, this->step_dx);
scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
-
+
dy = 0;
height = this->dest_height;
@@ -2498,7 +2616,7 @@ static void yuy22rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
RGB(2);
DST1BGR(2);
-
+
RGB(3);
DST1BGR(3);
@@ -2512,8 +2630,8 @@ static void yuy22rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
_dst += this->rgb_stride;
while (--height > 0 && dy < 32768) {
-
- memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3);
+
+ memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3);
dy += this->step_dy;
_dst += this->rgb_stride;
@@ -2524,12 +2642,12 @@ static void yuy22rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
dy -= 32768;
_p += this->y_stride*2;
-
+
scale_line_4 (_p+1, this->u_buffer,
this->dest_width >> 1, this->step_dx);
scale_line_4 (_p+3, this->v_buffer,
this->dest_width >> 1, this->step_dx);
- scale_line_2 (_p, this->y_buffer,
+ scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
}
}
@@ -2554,7 +2672,7 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
dy = 0;
height = this->dest_height;
-
+
for (;;) {
dst_1 = (uint16_t*)_dst;
py_1 = this->y_buffer;
@@ -2566,7 +2684,7 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
do {
RGB(0);
DST1(0);
-
+
RGB(1);
DST1(1);
@@ -2575,7 +2693,7 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
RGB(3);
DST1(3);
-
+
pu += 4;
pv += 4;
py_1 += 8;
@@ -2584,11 +2702,11 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
dy += this->step_dy;
_dst += this->rgb_stride;
-
+
while (--height > 0 && dy < 32768) {
memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2);
-
+
dy += this->step_dy;
_dst += this->rgb_stride;
}
@@ -2603,7 +2721,7 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
this->dest_width >> 1, this->step_dx);
scale_line_4 (_p+3, this->v_buffer,
this->dest_width >> 1, this->step_dx);
- scale_line_2 (_p, this->y_buffer,
+ scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
}
}
@@ -2623,7 +2741,7 @@ static void yuy22rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
this->dest_width >> 1, this->step_dx);
scale_line_4 (_p+3, this->v_buffer,
this->dest_width >> 1, this->step_dx);
- scale_line_2 (_p, this->y_buffer,
+ scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
dy = 0;
@@ -2643,13 +2761,13 @@ static void yuy22rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
RGB(1);
DST1(1);
-
+
RGB(2);
DST1(2);
RGB(3);
DST1(3);
-
+
pu += 4;
pv += 4;
py_1 += 8;
@@ -2688,7 +2806,7 @@ static void yuy22rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
int dy;
uint8_t * dst;
uint8_t * y;
-
+
if (this->do_scale) {
dy = 0;
height = this->dest_height;
@@ -2757,13 +2875,13 @@ static void yuy22rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
do {
RGB(0);
DST1CMAP(0);
-
+
RGB(1);
DST1CMAP(1);
-
+
RGB(2);
DST1CMAP(2);
-
+
RGB(3);
DST1CMAP(3);
@@ -2772,35 +2890,35 @@ static void yuy22rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p)
py_1 += 8;
dst_1 += 8;
} while (--width);
-
+
dy += this->step_dy;
_dst += this->rgb_stride;
-
+
while (--height > 0 && dy < 32768) {
-
- memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width);
-
+
+ memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width);
+
dy += this->step_dy;
_dst += this->rgb_stride;
}
-
+
if (height <= 0)
break;
dy -= 32768;
_p += this->y_stride*2;
-
+
scale_line_4 (_p+1, this->u_buffer,
this->dest_width >> 1, this->step_dx);
scale_line_4 (_p+3, this->v_buffer,
this->dest_width >> 1, this->step_dx);
- scale_line_2 (_p, this->y_buffer,
+ scale_line_2 (_p, this->y_buffer,
this->dest_width, this->step_dx);
}
}
static void yuy22rgb_c_init (yuv2rgb_t *this, int mode, int swapped)
-{
+{
switch (mode) {
case MODE_32_RGB:
case MODE_32_BGR:
@@ -2811,7 +2929,7 @@ static void yuy22rgb_c_init (yuv2rgb_t *this, int mode, int swapped)
case MODE_24_BGR:
this->yuy22rgb_fun =
(mode==MODE_24_RGB && !swapped) || (mode==MODE_24_BGR && swapped)
- ? yuy22rgb_c_24_rgb
+ ? yuy22rgb_c_24_rgb
: yuy22rgb_c_24_bgr;
break;
case MODE_15_BGR:
@@ -2859,7 +2977,7 @@ yuv2rgb_t *yuv2rgb_init (int mode, int swapped, uint8_t *colormap) {
/*
* auto-probe for the best yuv2rgb function
*/
-
+
this->yuv2rgb_fun = NULL;
#ifdef ARCH_X86
if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMXEXT)) {
@@ -2870,14 +2988,14 @@ yuv2rgb_t *yuv2rgb_init (int mode, int swapped, uint8_t *colormap) {
if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMX)) {
yuv2rgb_init_mmx (this, mode, swapped);
if (this->yuv2rgb_fun != NULL)
- printf ("yuv2rgb: using MMX for colorspace transform\n");
+ printf ("yuv2rgb: using MMX for colorspace transform\n");
}
#endif
#if HAVE_MLIB
if (this->yuv2rgb_fun == NULL) {
yuv2rgb_init_mlib (this, mode, swapped);
if (this->yuv2rgb_fun != NULL)
- printf ("yuv2rgb: using medialib for colorspace transform\n");
+ printf ("yuv2rgb: using medialib for colorspace transform\n");
}
#endif
if (this->yuv2rgb_fun == NULL) {
@@ -2885,6 +3003,8 @@ yuv2rgb_t *yuv2rgb_init (int mode, int swapped, uint8_t *colormap) {
yuv2rgb_c_init (this, mode, swapped);
}
+ yuv2rgb_single_pixel_init (this, mode, swapped);
+
/*
* auto-probe for the best yuy22rgb function
*/
@@ -2894,3 +3014,4 @@ yuv2rgb_t *yuv2rgb_init (int mode, int swapped, uint8_t *colormap) {
return this;
}
+
diff --git a/src/video_out/yuv2rgb.h b/src/video_out/yuv2rgb.h
index fc662aaf3..9502f100d 100644
--- a/src/video_out/yuv2rgb.h
+++ b/src/video_out/yuv2rgb.h
@@ -31,17 +31,24 @@ typedef struct yuv2rgb_s yuv2rgb_t;
struct yuv2rgb_s {
- /*
+ /*
* this is the function to call for the yuv2rgb and scaling process
*/
void (*yuv2rgb_fun) (yuv2rgb_t *this, uint8_t * image, uint8_t * py,
uint8_t * pu, uint8_t * pv) ;
- /*
+ /*
* this is the function to call for the yuy2->rgb and scaling process
*/
void (*yuy22rgb_fun) (yuv2rgb_t *this, uint8_t * image, uint8_t * p);
+ /*
+ * this is the function to call for the yuv2rgb for a single pixel
+ * (used for converting clut colors)
+ */
+ uint32_t (*yuv2rgb_single_pixel_fun) (yuv2rgb_t *this, uint8_t y,
+ uint8_t u, uint8_t v);
+
/* private stuff below */
uint32_t matrix_coefficients;
@@ -75,7 +82,7 @@ yuv2rgb_t *yuv2rgb_init (int mode, int swapped, uint8_t *colormap);
* set up yuv2rgb function, determine scaling parameters if necessary
* returns 0 on failure, 1 otherwise
*/
-int yuv2rgb_setup (yuv2rgb_t *this,
+int yuv2rgb_setup (yuv2rgb_t *this,
int source_width, int source_height,
int y_stride, int uv_stride,
int dest_width, int dest_height,
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index 48e85e56b..4e8bc1bee 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.h
@@ -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.h,v 1.22 2001/09/26 17:19:49 jkeil Exp $
+ * $Id: video_out.h,v 1.23 2001/10/09 22:20:11 miguelfreitas Exp $
*
*
* xine version of video_out.h
@@ -295,12 +295,13 @@ struct vo_overlay_s {
uint32_t color[4]; /* color lookup table */
uint8_t trans[4]; /* mixer key table */
+ int rgb_clut; /* true if clut was converted to rgb*/
int clip_top;
int clip_bottom;
int clip_left;
int clip_right;
-
+
};
/*