changeset 4627:3db7ee2ac7b0

bgr15 / bgr16 input support (with -zoom) stride % 8 == 0
author michael
date Sun, 10 Feb 2002 01:07:58 +0000
parents 6d6595dfc5a8
children 1504901deed8
files libvo/vo_x11.c
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Sun Feb 10 00:56:08 2002 +0000
+++ b/libvo/vo_x11.c	Sun Feb 10 01:07:58 2002 +0000
@@ -278,7 +278,8 @@
  XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
 
  if( flags&0x04 && (   format==IMGFMT_YV12 || format==IMGFMT_I420  || format==IMGFMT_IYUV 
-                    || format==IMGFMT_YUY2 || format==IMGFMT_BGR24 || format==IMGFMT_BGR32)) {
+                    || format==IMGFMT_YUY2 
+		    || format==IMGFMT_BGR15|| format==IMGFMT_BGR16 || format==IMGFMT_BGR24 || format==IMGFMT_BGR32)) {
      // software scale
      if(fullscreen){
          image_width=vo_screenwidth;
@@ -438,21 +439,23 @@
 static void Display_Image( XImage *myximage,uint8_t *ImageData )
 {
 #ifdef DISP
+  //  myximage->width is the stride and not the width if the sw scaler is used
+  int dstW= (swsContext) ? swsContext->dstW : myximage->width; 
 #ifdef HAVE_SHM
  if ( Shmem_Flag )
   {
    XShmPutImage( mDisplay,mywindow,mygc,myximage,
                  0,0,
-                 ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
-                 myximage->width,myximage->height,True );
+                 ( vo_dwidth - dstW ) / 2,( vo_dheight - myximage->height ) / 2,
+                 dstW,myximage->height,True );
   }
   else
 #endif
    {
     XPutImage( mDisplay,mywindow,mygc,myximage,
                0,0,
-               ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
-               myximage->width,myximage->height );
+               ( vo_dwidth - dstW ) / 2,( vo_dheight - myximage->height ) / 2,
+               dstW,myximage->height );
   }
 #endif
 }
@@ -475,7 +478,7 @@
     
   if(sws_flags==0) newW&= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed
   
-  if(image_width!=newW || image_height!=newH)
+  if(swsContext->dstW!=newW || image_height!=newH)
   {
     SwsContext *oldContext= swsContext;
     
@@ -483,8 +486,9 @@
     					 newW, newH, out_format);
     if(swsContext)
     {
-	image_width= newW;
+	image_width= (newW+7)&(~7);
 	image_height= newH;
+
 	freeMyXImage();
 	getMyXImage();
 	freeSwsContext(oldContext);
@@ -523,6 +527,8 @@
     {
       int stride[3]= {0,0,0};
       if     (swsContext->srcFormat==IMGFMT_YUY2)  stride[0]=swsContext->srcW*2;
+      else if(swsContext->srcFormat==IMGFMT_BGR15) stride[0]=swsContext->srcW*2;
+      else if(swsContext->srcFormat==IMGFMT_BGR16) stride[0]=swsContext->srcW*2;
       else if(swsContext->srcFormat==IMGFMT_BGR24) stride[0]=swsContext->srcW*3;
       else if(swsContext->srcFormat==IMGFMT_BGR32) stride[0]=swsContext->srcW*4;
       
@@ -593,6 +599,8 @@
 
  switch( format )
   {
+   case IMGFMT_BGR15:
+   case IMGFMT_BGR16:
    case IMGFMT_BGR24:
    case IMGFMT_BGR32:
    case IMGFMT_YUY2: