[MPlayer-dev-eng] [PATCH] color SPU - Part 5/2
- Date: Wed, 28 May 2008 20:47:52 +0200
- From: Ötvös Attila <dc@xxxxxxxxx>
- Subject: [MPlayer-dev-eng] [PATCH] color SPU - Part 5/2
Hi All!
02-colorspu-mga_common.patch
02-colorspu-osd-draw.patch,
02-colorspu-osd_template.patch,
02-colorspu-vo_dfbmga.patch,
02-colorspu-vo_directfb2.patch,
02-colorspu-vo_directx.patch,
02-colorspu-vo_macosx.patch,
02-colorspu-vo_sdl.patch,
02-colorspu-vosub_vidix.patch,
02-colorspu-vo_xv.patch,
02-colorspu-vo_yuv4mpeg.patch:
draw code to U, V, R, G and B planes
02-colorspu-vo_x11.patch,
03-colorspu-format.patch:
query SPU format code (VFCTRL_GET_OSD_FORMAT)
Best regards!
Attila
--- libvo/osd.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/osd.c 2008-05-27 18:12:40.000000000 +0200
@@ -11,6 +11,7 @@
#include <inttypes.h>
#include "cpudetect.h"
#include "mangle.h"
+#include "video_out.h"
#ifdef ARCH_X86
#define CAN_COMPILE_X86_ASM
@@ -299,6 +300,8 @@
void vo_draw_alpha_rgb15(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
int y;
+switch (dp) {
+ case DEST_PLANES_Y:
for(y=0;y<h;y++){
register unsigned short *dst = (unsigned short*) dstbase;
register int x;
@@ -327,10 +330,67 @@
dstbase+=dststride;
}
return;
+ case DEST_PLANES_RB:
+ for(y=0;y<h;y++){
+ register unsigned short *dst = (unsigned short*) dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x]){
+ unsigned char r=dst[x]&0x1F;
+ unsigned char g=(dst[x]>>5)&0x1F;
+ unsigned char b=(dst[x]>>10)&0x1F;
+ r=(((r*srca[x])>>5)+src[x])>>3;
+ dst[x]=(b<<10)|(g<<5)|r;
+ }
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_G:
+ for(y=0;y<h;y++){
+ register unsigned short *dst = (unsigned short*) dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x]){
+ unsigned char r=dst[x]&0x1F;
+ unsigned char g=(dst[x]>>5)&0x1F;
+ unsigned char b=(dst[x]>>10)&0x1F;
+ g=(((g*srca[x])>>5)+src[x])>>3;
+ dst[x]=(b<<10)|(g<<5)|r;
+ }
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_BR:
+ for(y=0;y<h;y++){
+ register unsigned short *dst = (unsigned short*) dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x]){
+ unsigned char r=dst[x]&0x1F;
+ unsigned char g=(dst[x]>>5)&0x1F;
+ unsigned char b=(dst[x]>>10)&0x1F;
+ b=(((b*srca[x])>>5)+src[x])>>3;
+ dst[x]=(b<<10)|(g<<5)|r;
+ }
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ }
}
void vo_draw_alpha_rgb16(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
int y;
+switch (dp) {
+ case DEST_PLANES_Y:
for(y=0;y<h;y++){
register unsigned short *dst = (unsigned short*) dstbase;
register int x;
@@ -358,5 +418,60 @@
dstbase+=dststride;
}
return;
+ case DEST_PLANES_RB:
+ for(y=0;y<h;y++){
+ register unsigned short *dst = (unsigned short*) dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x]){
+ unsigned char r=dst[x]&0x1F;
+ unsigned char b=(dst[x]>>11)&0x1F;
+ unsigned char g=(dst[x]>>5)&0x3F;
+ r=(((r*srca[x])>>5)+src[x])>>3;
+ dst[x]=(b<<11)|(g<<5)|r;
+ }
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_G:
+ for(y=0;y<h;y++){
+ register unsigned short *dst = (unsigned short*) dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x]){
+ unsigned char r=dst[x]&0x1F;
+ unsigned char g=(dst[x]>>5)&0x3F;
+ unsigned char b=(dst[x]>>11)&0x1F;
+ g=(((g*srca[x])>>6)+src[x])>>2;
+ dst[x]=(b<<11)|(g<<5)|r;
+ }
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_BR:
+ for(y=0;y<h;y++){
+ register unsigned short *dst = (unsigned short*) dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x]){
+ unsigned char r=dst[x]&0x1F;
+ unsigned char g=(dst[x]>>5)&0x3F;
+ unsigned char b=(dst[x]>>11)&0x1F;
+ b=(((b*srca[x])>>5)+src[x])>>3;
+ dst[x]=(b<<11)|(g<<5)|r;
+ }
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ }
}
--- libvo/mga_common.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/mga_common.c 2008-05-27 18:36:10.000000000 +0200
@@ -32,14 +32,48 @@
case MGA_VID_FORMAT_YV12:
case MGA_VID_FORMAT_IYUV:
case MGA_VID_FORMAT_I420:
+ switch (dp) {
+ case DEST_PLANES_Y :
vo_draw_alpha_yv12(w,h,dp,src,srca,stride,vid_data+bespitch*y0+x0,bespitch);
break;
+ case DEST_PLANES_U :
+ dest = vid_data + bespitch*mga_vid_config.src_height +
+ bespitch/2 * y0/2 + x0/2;
+ if(mga_vid_config.format==MGA_VID_FORMAT_YV12)
+ dest += bespitch/2*mga_vid_config.src_height / 2;
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,dest,bespitch/2);
+ break;
+ case DEST_PLANES_V :
+ dest = vid_data + bespitch*mga_vid_config.src_height +
+ bespitch/2 * y0/2 + x0/2;
+ if(mga_vid_config.format!=MGA_VID_FORMAT_YV12)
+ dest += bespitch/2*mga_vid_config.src_height / 2;
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,dest,bespitch/2);
+ break;
+ }
+ break;
case MGA_VID_FORMAT_YUY2:
+ switch (dp) {
+ case DEST_PLANES_Y :
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,vid_data+2*(bespitch*y0+x0),2*bespitch);
break;
+ case DEST_PLANES_YUYV :
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ vid_data+2*(bespitch*y0+x0),2*bespitch);
+ break;
+ }
+ break;
case MGA_VID_FORMAT_UYVY:
+ switch (dp) {
+ case DEST_PLANES_Y :
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,vid_data+2*(bespitch*y0+x0)+1,2*bespitch);
break;
+ case DEST_PLANES_YUYV :
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ vid_data+2*(bespitch*y0+x0)+1,2*bespitch);
+ break;
+ }
+ break;
}
}
--- libvo/osd_template.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/osd_template.c 2008-05-27 19:30:27.000000000 +0200
@@ -195,6 +195,8 @@
static inline void RENAME(vo_draw_alpha_rgb24)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
int y;
+switch (dp) {
+ case DEST_PLANES_Y:
#ifdef HAVE_MMX
asm volatile(
"pxor %%mm7, %%mm7\n\t"
@@ -299,6 +301,49 @@
asm volatile(EMMS:::"memory");
#endif
return;
+ case DEST_PLANES_RB:
+ for(y=0;y<h;y++){
+ register unsigned char *dst = dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x])
+ dst[0]=((dst[0]*srca[x])>>8)+src[x];
+ dst+=3; // 24bpp
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_G:
+ for(y=0;y<h;y++){
+ register unsigned char *dst = dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x])
+ dst[1]=((dst[1]*srca[x])>>8)+src[x];
+ dst+=3; // 24bpp
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_BR:
+ for(y=0;y<h;y++){
+ register unsigned char *dst = dstbase;
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x])
+ dst[2]=((dst[2]*srca[x])>>8)+src[x];
+ dst+=3; // 24bpp
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ }
}
static inline void RENAME(vo_draw_alpha_rgb32)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
@@ -306,6 +351,8 @@
#ifdef WORDS_BIGENDIAN
dstbase++;
#endif
+switch (dp) {
+ case DEST_PLANES_Y:
#ifdef HAVE_MMX
#ifdef HAVE_3DNOW
asm volatile(
@@ -464,4 +511,41 @@
asm volatile(EMMS:::"memory");
#endif
return;
+ case DEST_PLANES_RB:
+ for(y=0;y<h;y++){
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x])
+ dstbase[4*x+0]=(((dstbase[4*x+0]*srca[x])>>8)+src[x])&0xff;
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_G:
+ for(y=0;y<h;y++){
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x])
+ dstbase[4*x+1]=(((dstbase[4*x+1]*srca[x])>>8)+src[x])&0xff;
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ case DEST_PLANES_BR:
+ for(y=0;y<h;y++){
+ register int x;
+ for(x=0;x<w;x++){
+ if(srca[x])
+ dstbase[4*x+2]=(((dstbase[4*x+2]*srca[x])>>8)+src[x])&0xff;
+ }
+ src+=srcstride;
+ srca+=srcstride;
+ dstbase+=dststride;
+ }
+ return;
+ }
}
--- libvo/vo_directx.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/vo_directx.c 2008-05-27 18:50:32.000000000 +0200
@@ -155,14 +155,58 @@
case IMGFMT_I420 :
case IMGFMT_IYUV :
case IMGFMT_YVU9 :
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yv12(w,h,dp,src,srca,stride,((uint8_t *) image) + dstride*y0 + x0,dstride);
break;
+ case DEST_PLANES_U:
+ if(image_format == IMGFMT_YV12)
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) image) + image_height*dstride +
+ uvstride*y0 + x0,uvstride);
+ else
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) image) + image_height*dstride +
+ uvstride*(image_height/2) +
+ uvstride*y0 + x0,uvstride);
+ break;
+ case DEST_PLANES_V:
+ if(image_format == IMGFMT_YV12)
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) image) + image_height*dstride +
+ uvstride*(image_height/2) +
+ uvstride*y0 + x0,uvstride);
+ else
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) image) + image_height*dstride +
+ uvstride*y0 + x0,uvstride);
+ break;
+ }
+ break;
case IMGFMT_YUY2 :
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) image)+ dstride*y0 + 2*x0 ,dstride);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) image)+ dstride*y0 + 2*x0,
+ dstride);
+ break;
+ }
+ break;
case IMGFMT_UYVY :
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,src,dp,srca,stride,((uint8_t *) image) + dstride*y0 + 2*x0 + 1,dstride);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) image)+ dstride*y0 + 2*x0,
+ dstride);
+ break;
+ }
+ break;
case IMGFMT_RGB15:
case IMGFMT_BGR15:
vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,((uint8_t *) image)+dstride*y0+2*x0,dstride);
--- libvo/vo_directfb2.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/vo_directfb2.c 2008-05-27 19:13:50.000000000 +0200
@@ -1493,17 +1493,63 @@
break;
case DSPF_YUY2:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0,pitch);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) dst) +
+ pitch*y0 + 2*x0,pitch);
+ break;
+ }
+ break;
case DSPF_UYVY:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0 + 1,pitch);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) dst) +
+ pitch*y0 + 2*x0,pitch);
+ break;
+ }
+ break;
case DSPF_I420:
case DSPF_YV12:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yv12(w,h,dp,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 1*x0,pitch);
break;
+ case DEST_PLANES_U:
+ if (pixel_format==DSPF_YV12)
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) dst) +
+ pitch*height/4 +
+ pitch*y0 + 1*x0,pitch);
+ else
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) dst) +
+ pitch*height/2 + pitch*y0 +
+ 1*x0,pitch);
+ break;
+ case DEST_PLANES_V:
+ if (pixel_format==DSPF_YV12)
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) dst) +
+ pitch*height/2 + pitch*y0 +
+ 1*x0,pitch);
+ else
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) dst) +
+ pitch*height/4 +
+ pitch*y0 + 1*x0,pitch);
+ break;
+ }
+ break;
}
unlock();
--- libvo/vo_macosx.m 2008-05-27 17:55:56.000000000 +0200
+++ libvo/vo_macosx.m 2008-05-27 18:21:07.000000000 +0200
@@ -91,8 +91,15 @@
vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,image_data+4*(y0*image_width+x0),4*image_width);
break;
case IMGFMT_YUY2:
+ switch(dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,image_data + (x0 + y0 * image_width) * 2,image_width*2);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,image_data + (x0 + y0 * image_width) * 2,image_width*2);
+ break;
+ }
+ break;
}
}
--- libvo/vosub_vidix.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/vosub_vidix.c 2008-05-27 18:18:37.000000000 +0200
@@ -261,17 +261,49 @@
case IMGFMT_IF09:
case IMGFMT_Y8:
case IMGFMT_Y800:
+ switch (dp) {
+ case DEST_PLANES_Y:
bespitch = (vidix_play.src.w + apitch) & (~apitch);
vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch);
break;
+ case DEST_PLANES_U:
+ lvo_mem = vidix_mem + vidix_play.offsets[next_frame] +
+ vidix_play.offset.u;
+ lvo_mem += dstrides.u*y0/2 + x0;
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem,dstrides.u/2);
+ break;
+ case DEST_PLANES_V:
+ lvo_mem = vidix_mem + vidix_play.offsets[next_frame] +
+ vidix_play.offset.v;
+ lvo_mem += dstrides.v*y0/2 + x0;
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem,dstrides.v/2);
+ break;
+ }
+ break;
case IMGFMT_YUY2:
bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+x0,
+ bespitch);
+ break;
+ }
+ break;
case IMGFMT_UYVY:
bespitch = (vidix_play.src.w*2 + apitch) & (~apitch);
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+x0,
+ bespitch);
+ break;
+ }
+ break;
case IMGFMT_RGB32:
case IMGFMT_BGR32:
bespitch = (vidix_play.src.w*4 + apitch) & (~apitch);
--- libvo/vo_dfbmga.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/vo_dfbmga.c 2008-05-27 19:24:12.000000000 +0200
@@ -1006,25 +1006,69 @@
pitch );
break;
case DSPF_YUY2:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2( w, h, dp, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + 2 * x0,
pitch );
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12( w, h, dp, src, srca, stride,
+ ((uint8_t *) dst) + pitch * y0 + 2 * x0,
+ pitch );
+ break;
+ }
+ break;
case DSPF_UYVY:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2( w, h, dp, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + 2 * x0 + 1,
pitch );
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12( w, h, dp, src, srca, stride,
+ ((uint8_t *) dst) + pitch * y0 + 2 * x0,
+ pitch );
+ break;
+ }
+ break;
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
case DSPF_NV12:
case DSPF_NV21:
#endif
case DSPF_I420:
case DSPF_YV12:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yv12( w, h, dp, src, srca, stride,
((uint8_t *) dst) + pitch * y0 + x0,
pitch );
break;
+ case DEST_PLANES_U:
+ if (subframe_format==DSPF_YV12)
+ vo_draw_alpha_yv12( w, h, dp, src, srca, stride,
+ ((uint8_t *) dst) + pitch * y0 + x0 +
+ pitch * in_height, pitch );
+ else
+ vo_draw_alpha_yv12( w, h, dp, src, srca, stride,
+ ((uint8_t *) dst) + pitch * y0 + x0 +
+ pitch * (in_height+in_height/2),
+ pitch );
+ break;
+ case DEST_PLANES_V:
+ if (subframe_format==DSPF_YV12)
+ vo_draw_alpha_yv12( w, h, dp, src, srca, stride,
+ ((uint8_t *) dst) + pitch * y0 + x0 +
+ pitch * (in_height+in_height/2),
+ pitch );
+ else
+ vo_draw_alpha_yv12( w, h, dp, src, srca, stride,
+ ((uint8_t *) dst) + pitch * y0 + x0 +
+ pitch * in_height, pitch );
+ break;
+ }
+ break;
}
subframe->Unlock( subframe );
--- libvo/vo_sdl.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/vo_sdl.c 2008-05-27 18:33:36.000000000 +0200
@@ -281,17 +281,69 @@
case IMGFMT_YV12:
case IMGFMT_I420:
case IMGFMT_IYUV:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yv12(w,h,dp,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]);
break;
+ case DEST_PLANES_U:
+ SDL_OVR_LOCK(-1)
+ if (priv->format==IMGFMT_YV12)
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) (priv->overlay->pixels[1]))+
+ priv->overlay->pitches[1]*y0+x0,
+ priv->overlay->pitches[1]);
+ else
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) (priv->overlay->pixels[2]))+
+ priv->overlay->pitches[2]*y0+x0,
+ priv->overlay->pitches[2]);
+ SDL_OVR_UNLOCK
+ break;
+ case DEST_PLANES_V:
+ SDL_OVR_LOCK(-1)
+ if (priv->format==IMGFMT_YV12)
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) (priv->overlay->pixels[2]))+
+ priv->overlay->pitches[2]*y0+x0,
+ priv->overlay->pitches[2]);
+ else
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) (priv->overlay->pixels[1]))+
+ priv->overlay->pitches[1]*y0+x0,
+ priv->overlay->pitches[1]);
+ SDL_OVR_UNLOCK
+ break;
+ }
+ break;
case IMGFMT_YUY2:
case IMGFMT_YVYU:
x0 *= 2;
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) *(priv->overlay->pixels))+
+ priv->overlay->pitches[0]*y0+x0,
+ priv->overlay->pitches[0]);
+ break;
+ }
+ break;
case IMGFMT_UYVY:
x0 *= 2;
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]);
break;
+ case DEST_PLANES_YUYV:
+ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,
+ ((uint8_t *) *(priv->overlay->pixels))+
+ priv->overlay->pitches[0]*y0+x0,
+ priv->overlay->pitches[0]);
+ break;
+ }
+ break;
default:
if(priv->dblit) {
--- libvo/vo_x11.c 2008-05-27 18:08:33.000000000 +0200
+++ libvo/vo_x11.c 2008-05-27 18:09:07.000000000 +0200
@@ -796,6 +796,9 @@
case VOCTRL_UPDATE_SCREENINFO:
update_xinerama_info();
return VO_TRUE;
+ case VOCTRL_GET_OSD_FORMAT:
+ *(uint32_t *)data=out_format;
+ return VO_TRUE;
}
return VO_NOTIMPL;
}
--- libvo/vo_yuv4mpeg.c 2008-05-28 19:37:26.000000000 +0200
+++ libvo/vo_yuv4mpeg.c 2008-05-27 18:40:31.000000000 +0200
@@ -186,9 +186,25 @@
switch (using_format)
{
case IMGFMT_YV12:
+ switch (dp) {
+ case DEST_PLANES_Y:
vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
image + y0 * image_width + x0, image_width);
break;
+ case DEST_PLANES_U:
+ if (image_u)
+ vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
+ image_u + y0 * image_width + x0,
+ image_width);
+ break;
+ case DEST_PLANES_V:
+ if (image_v)
+ vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
+ image_v + y0 * image_width + x0,
+ image_width);
+ break;
+ }
+ break;
case IMGFMT_BGR|24:
case IMGFMT_RGB|24:
--- libmpcodecs/vf_vo.c 2008-05-25 14:36:37.000000000 +0200
+++ libmpcodecs/vf_vo.c 2008-05-27 19:39:50.000000000 +0200
@@ -28,6 +28,7 @@
ass_renderer_t* ass_priv;
int prev_visibility;
#endif
+ unsigned int outfmt;
};
#define video_out (vf->priv->vo)
@@ -65,6 +66,8 @@
if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt))
return 0;
+ vf->priv->outfmt=outfmt;
+
#ifdef USE_ASS
if (vf->priv->ass_priv)
ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED));
@@ -149,6 +152,13 @@
*(double *)data = vf->priv->pts;
return CONTROL_TRUE;
}
+ case VFCTRL_GET_OSD_FORMAT:
+ {
+ if(video_out->control(VOCTRL_GET_OSD_FORMAT,data) == VO_TRUE)
+ return CONTROL_TRUE;
+ *(unsigned int*)data = vf->priv->outfmt;
+ return CONTROL_TRUE;
+ }
}
// return video_out->control(request,data);
return CONTROL_UNKNOWN;
--- libmpcodecs/vf.h 2008-03-26 18:41:04.000000000 +0100
+++ libmpcodecs/vf.h 2008-05-27 19:31:55.000000000 +0200
@@ -86,6 +86,7 @@
#define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
#define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
#define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
+#define VFCTRL_GET_OSD_FORMAT 20 /* Query format to color osd */
#include "vfcap.h"
--- libmpcodecs/vf_expand.c 2008-05-27 17:55:56.000000000 +0200
+++ libmpcodecs/vf_expand.c 2008-05-27 19:40:52.000000000 +0200
@@ -415,6 +415,14 @@
switch(request){
case VFCTRL_DRAW_OSD:
if(vf->priv->osd) return CONTROL_TRUE;
+ break;
+ case VFCTRL_GET_OSD_FORMAT:
+ if(!vf->priv->osd)
+ break;
+ if(!vf->dmpi)
+ return CONTROL_FALSE;
+ *(unsigned int*)data=vf->dmpi->imgfmt;
+ return CONTROL_TRUE;
}
#endif
return vf_next_control(vf,request,data);
--- libvo/vo_xv.c 2008-05-27 17:55:56.000000000 +0200
+++ libvo/vo_xv.c 2008-05-27 18:41:48.000000000 +0200
@@ -101,36 +101,80 @@
unsigned char *src, unsigned char *srca,
int stride)
{
+ switch (dp) {
+ case DEST_PLANES_U:
+ x0 += image_width/2 * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
+ vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
+ xvimage[current_buf]->data +
+ xvimage[current_buf]->offsets[1] +
+ xvimage[current_buf]->pitches[1] * y0 + x0,
+ xvimage[current_buf]->pitches[1]);
+ break;
+ case DEST_PLANES_V:
+ x0 += image_width/2 * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
+ vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
+ xvimage[current_buf]->data +
+ xvimage[current_buf]->offsets[2] +
+ xvimage[current_buf]->pitches[2] * y0 + x0,
+ xvimage[current_buf]->pitches[2]);
+ break;
+ case DEST_PLANES_Y:
x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
xvimage[current_buf]->data +
xvimage[current_buf]->offsets[0] +
xvimage[current_buf]->pitches[0] * y0 + x0,
xvimage[current_buf]->pitches[0]);
+ break;
+ }
}
static void draw_alpha_yuy2(int x0, int y0, int w, int h, int dp,
unsigned char *src, unsigned char *srca,
int stride)
{
+ switch (dp) {
+ case DEST_PLANES_Y:
x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
vo_draw_alpha_yuy2(w, h, dp, src, srca, stride,
xvimage[current_buf]->data +
xvimage[current_buf]->offsets[0] +
xvimage[current_buf]->pitches[0] * y0 + 2 * x0,
xvimage[current_buf]->pitches[0]);
+ break;
+ case DEST_PLANES_YUYV:
+ x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
+ vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
+ xvimage[current_buf]->data +
+ xvimage[current_buf]->offsets[0] +
+ xvimage[current_buf]->pitches[0] * y0 + 2 * x0,
+ xvimage[current_buf]->pitches[0]);
+ break;
+ }
}
static void draw_alpha_uyvy(int x0, int y0, int w, int h, int dp,
unsigned char *src, unsigned char *srca,
int stride)
{
+ switch (dp) {
+ case DEST_PLANES_Y:
x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
vo_draw_alpha_yuy2(w, h, dp, src, srca, stride,
xvimage[current_buf]->data +
xvimage[current_buf]->offsets[0] +
xvimage[current_buf]->pitches[0] * y0 + 2 * x0 + 1,
xvimage[current_buf]->pitches[0]);
+ break;
+ case DEST_PLANES_YUYV:
+ x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
+ vo_draw_alpha_yv12(w, h, dp, src, srca, stride,
+ xvimage[current_buf]->data +
+ xvimage[current_buf]->offsets[0] +
+ xvimage[current_buf]->pitches[0] * y0 + 2 * x0,
+ xvimage[current_buf]->pitches[0]);
+ break;
+ }
}
static void draw_alpha_null(int x0, int y0, int w, int h, int dp,
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng