[MPlayer-cvslog] r32790 - in trunk/libmpcodecs: vf.c vf_scale.c

cehoyos subversion at mplayerhq.hu
Sat Jan 15 21:40:18 CET 2011


Author: cehoyos
Date: Sat Jan 15 21:40:18 2011
New Revision: 32790

Log:
Remove tabs from two additional files that will be used in
the libmpcodecs wrapper for libavfilter.

Modified:
   trunk/libmpcodecs/vf.c
   trunk/libmpcodecs/vf_scale.c

Modified: trunk/libmpcodecs/vf.c
==============================================================================
--- trunk/libmpcodecs/vf.c	Fri Jan 14 23:10:21 2011	(r32789)
+++ trunk/libmpcodecs/vf.c	Sat Jan 15 21:40:18 2011	(r32790)
@@ -228,28 +228,28 @@ const m_obj_list_t vf_obj_list = {
 void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h){
     int y;
     if(mpi->flags&MP_IMGFLAG_PLANAR){
-	y0&=~1;h+=h&1;
-	if(x0==0 && w==mpi->width){
-	    // full width clear:
-	    memset(mpi->planes[0]+mpi->stride[0]*y0,0,mpi->stride[0]*h);
-	    memset(mpi->planes[1]+mpi->stride[1]*(y0>>mpi->chroma_y_shift),128,mpi->stride[1]*(h>>mpi->chroma_y_shift));
-	    memset(mpi->planes[2]+mpi->stride[2]*(y0>>mpi->chroma_y_shift),128,mpi->stride[2]*(h>>mpi->chroma_y_shift));
-	} else
-	for(y=y0;y<y0+h;y+=2){
-	    memset(mpi->planes[0]+x0+mpi->stride[0]*y,0,w);
-	    memset(mpi->planes[0]+x0+mpi->stride[0]*(y+1),0,w);
-	    memset(mpi->planes[1]+(x0>>mpi->chroma_x_shift)+mpi->stride[1]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift));
-	    memset(mpi->planes[2]+(x0>>mpi->chroma_x_shift)+mpi->stride[2]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift));
-	}
-	return;
+        y0&=~1;h+=h&1;
+        if(x0==0 && w==mpi->width){
+            // full width clear:
+            memset(mpi->planes[0]+mpi->stride[0]*y0,0,mpi->stride[0]*h);
+            memset(mpi->planes[1]+mpi->stride[1]*(y0>>mpi->chroma_y_shift),128,mpi->stride[1]*(h>>mpi->chroma_y_shift));
+            memset(mpi->planes[2]+mpi->stride[2]*(y0>>mpi->chroma_y_shift),128,mpi->stride[2]*(h>>mpi->chroma_y_shift));
+        } else
+        for(y=y0;y<y0+h;y+=2){
+            memset(mpi->planes[0]+x0+mpi->stride[0]*y,0,w);
+            memset(mpi->planes[0]+x0+mpi->stride[0]*(y+1),0,w);
+            memset(mpi->planes[1]+(x0>>mpi->chroma_x_shift)+mpi->stride[1]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift));
+            memset(mpi->planes[2]+(x0>>mpi->chroma_x_shift)+mpi->stride[2]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift));
+        }
+        return;
     }
     // packed:
     for(y=y0;y<y0+h;y++){
-	unsigned char* dst=mpi->planes[0]+mpi->stride[0]*y+(mpi->bpp>>3)*x0;
-	if(mpi->flags&MP_IMGFLAG_YUV){
-	    unsigned int* p=(unsigned int*) dst;
-	    int size=(mpi->bpp>>3)*w/4;
-	    int i;
+        unsigned char* dst=mpi->planes[0]+mpi->stride[0]*y+(mpi->bpp>>3)*x0;
+        if(mpi->flags&MP_IMGFLAG_YUV){
+            unsigned int* p=(unsigned int*) dst;
+            int size=(mpi->bpp>>3)*w/4;
+            int i;
 #if HAVE_BIGENDIAN
 #define CLEAR_PACKEDYUV_PATTERN 0x00800080
 #define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x80008000
@@ -257,15 +257,15 @@ void vf_mpi_clear(mp_image_t* mpi,int x0
 #define CLEAR_PACKEDYUV_PATTERN 0x80008000
 #define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x00800080
 #endif
-	    if(mpi->flags&MP_IMGFLAG_SWAPPED){
-	        for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN_SWAPPED;
-		for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN_SWAPPED;
-	    } else {
-	        for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN;
-		for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN;
-	    }
-	} else
-	    memset(dst,0,(mpi->bpp>>3)*w);
+            if(mpi->flags&MP_IMGFLAG_SWAPPED){
+                for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN_SWAPPED;
+                for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN_SWAPPED;
+            } else {
+                for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN;
+                for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN;
+            }
+        } else
+            memset(dst,0,(mpi->bpp>>3)*w);
     }
 }
 
@@ -337,31 +337,31 @@ mp_image_t* vf_get_image(vf_instance_t* 
     mpi->type=mp_imgtype;
     mpi->w=vf->w; mpi->h=vf->h;
     // keep buffer allocation status & color flags only:
-//    mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT);
+//  mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT);
     mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS;
     // accept restrictions, draw_slice and palette flags only:
     mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_RGB_PALETTE);
     if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
     if(mpi->width!=w2 || mpi->height!=h){
-//	printf("vf.c: MPI parameters changed!  %dx%d -> %dx%d   \n", mpi->width,mpi->height,w2,h);
-	if(mpi->flags&MP_IMGFLAG_ALLOCATED){
-	    if(mpi->width<w2 || mpi->height<h){
-		// need to re-allocate buffer memory:
-		av_free(mpi->planes[0]);
-		mpi->flags&=~MP_IMGFLAG_ALLOCATED;
-		mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n");
-	    }
-//	} else {
-	} {
-	    mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift;
-	    mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) - 1)>>mpi->chroma_y_shift;
-	}
+//      printf("vf.c: MPI parameters changed!  %dx%d -> %dx%d   \n", mpi->width,mpi->height,w2,h);
+        if(mpi->flags&MP_IMGFLAG_ALLOCATED){
+            if(mpi->width<w2 || mpi->height<h){
+                // need to re-allocate buffer memory:
+                av_free(mpi->planes[0]);
+                mpi->flags&=~MP_IMGFLAG_ALLOCATED;
+                mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n");
+            }
+//      } else {
+        } {
+            mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift;
+            mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) - 1)>>mpi->chroma_y_shift;
+        }
     }
     if(!mpi->bpp) mp_image_setfmt(mpi,outfmt);
     if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){
 
-	// check libvo first!
-	if(vf->get_image) vf->get_image(vf,mpi);
+        // check libvo first!
+        if(vf->get_image) vf->get_image(vf,mpi);
 
         if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
           // non-direct and not yet allocated image. allocate it!
@@ -371,54 +371,54 @@ mp_image_t* vf_get_image(vf_instance_t* 
               return NULL;
           }
 
-	  // check if codec prefer aligned stride:
-	  if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){
-	      int align=(mpi->flags&MP_IMGFLAG_PLANAR &&
-	                 mpi->flags&MP_IMGFLAG_YUV) ?
-			 (8<<mpi->chroma_x_shift)-1 : 15; // -- maybe FIXME
-	      w2=((w+align)&(~align));
-	      if(mpi->width!=w2){
-	          // we have to change width... check if we CAN co it:
-		  int flags=vf->query_format(vf,outfmt); // should not fail
-		  if(!(flags&3)) mp_msg(MSGT_DECVIDEO,MSGL_WARN,"??? vf_get_image{vf->query_format(outfmt)} failed!\n");
-//		  printf("query -> 0x%X    \n",flags);
-		  if(flags&VFCAP_ACCEPT_STRIDE){
-	              mpi->width=w2;
-		      mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift;
-		  }
-	      }
-	  }
+          // check if codec prefer aligned stride:
+          if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){
+              int align=(mpi->flags&MP_IMGFLAG_PLANAR &&
+                         mpi->flags&MP_IMGFLAG_YUV) ?
+                         (8<<mpi->chroma_x_shift)-1 : 15; // -- maybe FIXME
+              w2=((w+align)&(~align));
+              if(mpi->width!=w2){
+                  // we have to change width... check if we CAN co it:
+                  int flags=vf->query_format(vf,outfmt); // should not fail
+                  if(!(flags&3)) mp_msg(MSGT_DECVIDEO,MSGL_WARN,"??? vf_get_image{vf->query_format(outfmt)} failed!\n");
+//                  printf("query -> 0x%X    \n",flags);
+                  if(flags&VFCAP_ACCEPT_STRIDE){
+                      mpi->width=w2;
+                      mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift;
+                  }
+              }
+          }
 
-	  mp_image_alloc_planes(mpi);
-//	  printf("clearing img!\n");
-	  vf_mpi_clear(mpi,0,0,mpi->width,mpi->height);
+          mp_image_alloc_planes(mpi);
+//        printf("clearing img!\n");
+          vf_mpi_clear(mpi,0,0,mpi->width,mpi->height);
         }
     }
     if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)
-	if(vf->start_slice) vf->start_slice(vf,mpi);
+        if(vf->start_slice) vf->start_slice(vf,mpi);
     if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){
-	    mp_msg(MSGT_DECVIDEO,MSGL_V,"*** [%s] %s%s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n",
-		  vf->info->name,
-		  (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting":
-	          ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"),
-	          (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)?" (slices)":"",
-	          mpi->width,mpi->height,mpi->bpp,
-		  (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"),
-		  (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed",
-	          mpi->bpp*mpi->width*mpi->height/8);
-	    mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"(imgfmt: %x, planes: %p,%p,%p strides: %d,%d,%d, chroma: %dx%d, shift: h:%d,v:%d)\n",
-		mpi->imgfmt, mpi->planes[0], mpi->planes[1], mpi->planes[2],
-		mpi->stride[0], mpi->stride[1], mpi->stride[2],
-		mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift);
-	    mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED;
+            mp_msg(MSGT_DECVIDEO,MSGL_V,"*** [%s] %s%s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n",
+                  vf->info->name,
+                  (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting":
+                  ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"),
+                  (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)?" (slices)":"",
+                  mpi->width,mpi->height,mpi->bpp,
+                  (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"),
+                  (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed",
+                  mpi->bpp*mpi->width*mpi->height/8);
+            mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"(imgfmt: %x, planes: %p,%p,%p strides: %d,%d,%d, chroma: %dx%d, shift: h:%d,v:%d)\n",
+                mpi->imgfmt, mpi->planes[0], mpi->planes[1], mpi->planes[2],
+                mpi->stride[0], mpi->stride[1], mpi->stride[2],
+                mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift);
+            mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED;
     }
 
   mpi->qscale = NULL;
   }
   mpi->usage_count++;
-//    printf("\rVF_MPI: %p %p %p %d %d %d    \n",
-//	mpi->planes[0],mpi->planes[1],mpi->planes[2],
-//	mpi->stride[0],mpi->stride[1],mpi->stride[2]);
+//  printf("\rVF_MPI: %p %p %p %d %d %d    \n",
+//      mpi->planes[0],mpi->planes[1],mpi->planes[2],
+//      mpi->stride[0],mpi->stride[1],mpi->stride[2]);
   return mpi;
 }
 
@@ -434,11 +434,11 @@ vf_instance_t* vf_open_plugin(const vf_i
     vf_instance_t* vf;
     int i;
     for(i=0;;i++){
-	if(!filter_list[i]){
-	    mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotFindVideoFilter,name);
-	    return NULL; // no such filter!
-	}
-	if(!strcmp(filter_list[i]->name,name)) break;
+        if(!filter_list[i]){
+            mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotFindVideoFilter,name);
+            return NULL; // no such filter!
+        }
+        if(!strcmp(filter_list[i]->name,name)) break;
     }
     vf=malloc(sizeof(vf_instance_t));
     memset(vf,0,sizeof(vf_instance_t));
@@ -455,14 +455,14 @@ vf_instance_t* vf_open_plugin(const vf_i
       void* vf_priv = m_struct_alloc(st);
       int n;
       for(n = 0 ; args && args[2*n] ; n++)
-	m_struct_set(st,vf_priv,args[2*n],args[2*n+1]);
+        m_struct_set(st,vf_priv,args[2*n],args[2*n+1]);
       vf->priv = vf_priv;
       args = NULL;
     } else // Otherwise we should have the '_oldargs_'
       if(args && !strcmp(args[0],"_oldargs_"))
-	args = (char**)args[1];
+        args = (char**)args[1];
       else
-	args = NULL;
+        args = NULL;
     if(vf->info->vf_open(vf,(char*)args)>0) return vf; // Success!
     free(vf);
     mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotOpenVideoFilter,name);
@@ -480,16 +480,16 @@ vf_instance_t* vf_open_filter(vf_instanc
       char* p = str;
       p += sprintf(str,"%s",name);
       for(i = 0 ; args && args[2*i] ; i++)
-	p += sprintf(p," %s=%s",args[2*i],args[2*i+1]);
+        p += sprintf(p," %s=%s",args[2*i],args[2*i+1]);
       mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter "[%s]\n",str);
     }
   } else if(strcmp(name,"vo")) {
     if(args && strcmp(args[0],"_oldargs_") == 0)
       mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter
-	     "[%s=%s]\n", name,args[1]);
+             "[%s=%s]\n", name,args[1]);
     else
       mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter
-	     "[%s]\n", name);
+             "[%s]\n", name);
   }
   return vf_open_plugin(filter_list,next,name,args);
 }
@@ -522,11 +522,11 @@ unsigned int vf_match_csp(vf_instance_t*
     unsigned int best=0;
     int ret;
     if((p=list)) while(*p){
-	ret=vf->query_format(vf,*p);
-	mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
-	if(ret&2){ best=*p; break;} // no conversion -> bingo!
-	if(ret&1 && !best) best=*p; // best with conversion
-	++p;
+        ret=vf->query_format(vf,*p);
+        mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
+        if(ret&2){ best=*p; break;} // no conversion -> bingo!
+        if(ret&1 && !best) best=*p; // best with conversion
+        ++p;
     }
     if(best) return best; // bingo, they have common csp!
     // ok, then try with scale:
@@ -537,11 +537,11 @@ unsigned int vf_match_csp(vf_instance_t*
     if(preferred && vf->query_format(vf,preferred)) best=preferred; else
     // try the list again, now with "scaler" :
     if((p=list)) while(*p){
-	ret=vf->query_format(vf,*p);
-	mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
-	if(ret&2){ best=*p; break;} // no conversion -> bingo!
-	if(ret&1 && !best) best=*p; // best with conversion
-	++p;
+        ret=vf->query_format(vf,*p);
+        mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
+        if(ret&2){ best=*p; break;} // no conversion -> bingo!
+        if(ret&1 && !best) best=*p; // best with conversion
+        ++p;
     }
     if(best) *vfp=vf; // else uninit vf  !FIXME!
     return best;
@@ -552,8 +552,8 @@ void vf_clone_mpi_attributes(mp_image_t*
     dst->fields = src->fields;
     dst->qscale_type= src->qscale_type;
     if(dst->width == src->width && dst->height == src->height){
-	dst->qstride= src->qstride;
-	dst->qscale= src->qscale;
+        dst->qstride= src->qstride;
+        dst->qscale= src->qscale;
     }
 }
 
@@ -570,26 +570,26 @@ void vf_queue_frame(vf_instance_t *vf, i
 int vf_output_queued_frame(vf_instance_t *vf)
 {
     while (1) {
-	int ret;
-	vf_instance_t *current;
-	vf_instance_t *last=NULL;
-	int (*tmp)(vf_instance_t *);
-	for (current = vf; current; current = current->next)
-	    if (current->continue_buffered_image)
-		last = current;
-	if (!last)
-	    return 0;
-	tmp = last->continue_buffered_image;
-	last->continue_buffered_image = NULL;
-	ret = tmp(last);
-	if (ret > 0) {
-	    vf->control(vf, VFCTRL_DRAW_OSD, NULL);
+        int ret;
+        vf_instance_t *current;
+        vf_instance_t *last=NULL;
+        int (*tmp)(vf_instance_t *);
+        for (current = vf; current; current = current->next)
+            if (current->continue_buffered_image)
+                last = current;
+        if (!last)
+            return 0;
+        tmp = last->continue_buffered_image;
+        last->continue_buffered_image = NULL;
+        ret = tmp(last);
+        if (ret > 0) {
+            vf->control(vf, VFCTRL_DRAW_OSD, NULL);
 #ifdef CONFIG_ASS
-	    vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
+            vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
 #endif
-	}
-	if (ret)
-	    return ret;
+        }
+        if (ret)
+            return ret;
     }
 }
 
@@ -607,14 +607,14 @@ int vf_output_queued_frame(vf_instance_t
  *
 */
 int vf_config_wrapper(struct vf_instance *vf,
-		    int width, int height, int d_width, int d_height,
-		    unsigned int flags, unsigned int outfmt)
+                    int width, int height, int d_width, int d_height,
+                    unsigned int flags, unsigned int outfmt)
 {
     int r;
     if ((vf->default_caps&VFCAP_CONSTANT) && vf->fmt.have_configured) {
         if ((vf->fmt.orig_width != width)
-	    || (vf->fmt.orig_height != height)
-	    || (vf->fmt.orig_fmt != outfmt)) {
+            || (vf->fmt.orig_height != height)
+            || (vf->fmt.orig_fmt != outfmt)) {
             mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_ResolutionDoesntMatch);
             return 0;
         }
@@ -631,31 +631,31 @@ int vf_config_wrapper(struct vf_instance
 
 int vf_next_config(struct vf_instance *vf,
         int width, int height, int d_width, int d_height,
-	unsigned int voflags, unsigned int outfmt){
+        unsigned int voflags, unsigned int outfmt){
     int miss;
     int flags=vf->next->query_format(vf->next,outfmt);
     if(!flags){
-	// hmm. colorspace mismatch!!!
-	// let's insert the 'scale' filter, it does the job for us:
-	vf_instance_t* vf2;
-	if(vf->next->info==&vf_info_scale) return 0; // scale->scale
-	vf2=vf_open_filter(vf->next,"scale",NULL);
-	if(!vf2) return 0; // shouldn't happen!
-	vf->next=vf2;
-	flags=vf->next->query_format(vf->next,outfmt);
-	if(!flags){
-	    mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CannotFindColorspace);
-	    return 0; // FAIL
-	}
+        // hmm. colorspace mismatch!!!
+        // let's insert the 'scale' filter, it does the job for us:
+        vf_instance_t* vf2;
+        if(vf->next->info==&vf_info_scale) return 0; // scale->scale
+        vf2=vf_open_filter(vf->next,"scale",NULL);
+        if(!vf2) return 0; // shouldn't happen!
+        vf->next=vf2;
+        flags=vf->next->query_format(vf->next,outfmt);
+        if(!flags){
+            mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CannotFindColorspace);
+            return 0; // FAIL
+        }
     }
     mp_msg(MSGT_VFILTER,MSGL_V,"REQ: flags=0x%X  req=0x%X  \n",flags,vf->default_reqs);
     miss=vf->default_reqs - (flags&vf->default_reqs);
     if(miss&VFCAP_ACCEPT_STRIDE){
-	// vf requires stride support but vf->next doesn't support it!
-	// let's insert the 'expand' filter, it does the job for us:
-	vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL);
-	if(!vf2) return 0; // shouldn't happen!
-	vf->next=vf2;
+        // vf requires stride support but vf->next doesn't support it!
+        // let's insert the 'expand' filter, it does the job for us:
+        vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL);
+        if(!vf2) return 0; // shouldn't happen!
+        vf->next=vf2;
     }
     vf->next->w = width; vf->next->h = height;
     return vf_config_wrapper(vf->next,width,height,d_width,d_height,voflags,outfmt);
@@ -685,24 +685,24 @@ int vf_next_put_image(struct vf_instance
 
 void vf_next_draw_slice(struct vf_instance *vf,unsigned char** src, int * stride,int w, int h, int x, int y){
     if (vf->next->draw_slice) {
-	vf->next->draw_slice(vf->next,src,stride,w,h,x,y);
-	return;
+        vf->next->draw_slice(vf->next,src,stride,w,h,x,y);
+        return;
     }
     if (!vf->dmpi) {
-	mp_msg(MSGT_VFILTER,MSGL_ERR,"draw_slice: dmpi not stored by vf_%s\n", vf->info->name);
-	return;
+        mp_msg(MSGT_VFILTER,MSGL_ERR,"draw_slice: dmpi not stored by vf_%s\n", vf->info->name);
+        return;
     }
     if (!(vf->dmpi->flags & MP_IMGFLAG_PLANAR)) {
-	memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+vf->dmpi->bpp/8*x,
-	    src[0], vf->dmpi->bpp/8*w, h, vf->dmpi->stride[0], stride[0]);
-	return;
+        memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+vf->dmpi->bpp/8*x,
+            src[0], vf->dmpi->bpp/8*w, h, vf->dmpi->stride[0], stride[0]);
+        return;
     }
     memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+x, src[0],
-	w, h, vf->dmpi->stride[0], stride[0]);
+        w, h, vf->dmpi->stride[0], stride[0]);
     memcpy_pic(vf->dmpi->planes[1]+(y>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[1]+(x>>vf->dmpi->chroma_x_shift),
-	src[1], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[1], stride[1]);
+        src[1], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[1], stride[1]);
     memcpy_pic(vf->dmpi->planes[2]+(y>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[2]+(x>>vf->dmpi->chroma_x_shift),
-	src[2], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[2], stride[2]);
+        src[2], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[2], stride[2]);
 }
 
 //============================================================================
@@ -737,8 +737,8 @@ void vf_uninit_filter(vf_instance_t* vf)
 
 void vf_uninit_filter_chain(vf_instance_t* vf){
     while(vf){
-	vf_instance_t* next=vf->next;
-	vf_uninit_filter(vf);
-	vf=next;
+        vf_instance_t* next=vf->next;
+        vf_uninit_filter(vf);
+        vf=next;
     }
 }

Modified: trunk/libmpcodecs/vf_scale.c
==============================================================================
--- trunk/libmpcodecs/vf_scale.c	Fri Jan 14 23:10:21 2011	(r32789)
+++ trunk/libmpcodecs/vf_scale.c	Sat Jan 15 21:40:18 2011	(r32790)
@@ -154,12 +154,12 @@ static unsigned int find_best_out(vf_ins
             break;
         ret = vf_next_query_format(vf, format);
 
-	mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3);
-	if(ret&VFCAP_CSP_SUPPORTED_BY_HW){
+        mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3);
+        if(ret&VFCAP_CSP_SUPPORTED_BY_HW){
             best=format; // no conversion -> bingo!
             break;
         }
-	if(ret&VFCAP_CSP_SUPPORTED && !best)
+        if(ret&VFCAP_CSP_SUPPORTED && !best)
             best=format; // best with conversion
     }
     return best;
@@ -167,7 +167,7 @@ static unsigned int find_best_out(vf_ins
 
 static int config(struct vf_instance *vf,
         int width, int height, int d_width, int d_height,
-	unsigned int flags, unsigned int outfmt){
+        unsigned int flags, unsigned int outfmt){
     unsigned int best=find_best_out(vf, outfmt);
     int vo_flags;
     int int_sws_flags=0;
@@ -177,8 +177,8 @@ static int config(struct vf_instance *vf
     enum PixelFormat dfmt, sfmt;
 
     if(!best){
-	mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n");
-	return 0;
+        mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n");
+        return 0;
     }
     sfmt = imgfmt2pixfmt(outfmt);
     if (outfmt == IMGFMT_RGB8 || outfmt == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8;
@@ -192,20 +192,20 @@ static int config(struct vf_instance *vf
     // - we're after postproc
     // - user didn't set w:h
     if(!(vo_flags&VFCAP_POSTPROC) && (flags&4) &&
-	    vf->priv->w<0 && vf->priv->h<0){	// -zoom
-	int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1;
-	if(d_width<width || d_height<height){
-	    // downscale!
-	    if(vo_flags&VFCAP_HWSCALE_DOWN) x=0;
-	} else {
-	    // upscale:
-	    if(vo_flags&VFCAP_HWSCALE_UP) x=0;
-	}
-	if(x){
-	    // user wants sw scaling! (-zoom)
-	    vf->priv->w=d_width;
-	    vf->priv->h=d_height;
-	}
+            vf->priv->w<0 && vf->priv->h<0){        // -zoom
+        int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1;
+        if(d_width<width || d_height<height){
+            // downscale!
+            if(vo_flags&VFCAP_HWSCALE_DOWN) x=0;
+        } else {
+            // upscale:
+            if(vo_flags&VFCAP_HWSCALE_UP) x=0;
+        }
+        if(x){
+            // user wants sw scaling! (-zoom)
+            vf->priv->w=d_width;
+            vf->priv->h=d_height;
+        }
     }
 
     if(vf->priv->noup){
@@ -260,20 +260,20 @@ static int config(struct vf_instance *vf
 
     // calculate the missing parameters:
     switch(best) {
-    case IMGFMT_YV12:		/* YV12 needs w & h rounded to 2 */
+    case IMGFMT_YV12:                /* YV12 needs w & h rounded to 2 */
     case IMGFMT_I420:
     case IMGFMT_IYUV:
     case IMGFMT_NV12:
     case IMGFMT_NV21:
       vf->priv->h = (vf->priv->h + 1) & ~1;
-    case IMGFMT_YUY2:		/* YUY2 needs w rounded to 2 */
+    case IMGFMT_YUY2:                /* YUY2 needs w rounded to 2 */
     case IMGFMT_UYVY:
       vf->priv->w = (vf->priv->w + 1) & ~1;
     }
 
     mp_msg(MSGT_VFILTER,MSGL_DBG2,"SwScale: scaling %dx%d %s to %dx%d %s  \n",
-	width,height,vo_format_name(outfmt),
-	vf->priv->w,vf->priv->h,vo_format_name(best));
+        width,height,vo_format_name(outfmt),
+        vf->priv->w,vf->priv->h,vo_format_name(best));
 
     // free old ctx:
     if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
@@ -284,21 +284,21 @@ static int config(struct vf_instance *vf
     int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT;
     int_sws_flags|= vf->priv->accurate_rnd * SWS_ACCURATE_RND;
     vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced,
-	    sfmt,
-		  vf->priv->w, vf->priv->h >> vf->priv->interlaced,
-	    dfmt,
-	    int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
+            sfmt,
+                  vf->priv->w, vf->priv->h >> vf->priv->interlaced,
+            dfmt,
+            int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
     if(vf->priv->interlaced){
         vf->priv->ctx2=sws_getContext(width, height >> 1,
-	    sfmt,
-		  vf->priv->w, vf->priv->h >> 1,
-	    dfmt,
-	    int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
+            sfmt,
+                  vf->priv->w, vf->priv->h >> 1,
+            dfmt,
+            int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
     }
     if(!vf->priv->ctx){
-	// error...
-	mp_msg(MSGT_VFILTER,MSGL_WARN,"Couldn't init SwScaler for this setup\n");
-	return 0;
+        // error...
+        mp_msg(MSGT_VFILTER,MSGL_WARN,"Couldn't init SwScaler for this setup\n");
+        return 0;
     }
     vf->priv->fmt=best;
 
@@ -307,70 +307,70 @@ static int config(struct vf_instance *vf
     switch(best){
     case IMGFMT_RGB8: {
       /* set 332 palette for 8 bpp */
-	vf->priv->palette=malloc(4*256);
-	for(i=0; i<256; i++){
-	    vf->priv->palette[4*i+0]=4*(i>>6)*21;
-	    vf->priv->palette[4*i+1]=4*((i>>3)&7)*9;
-	    vf->priv->palette[4*i+2]=4*((i&7)&7)*9;
+        vf->priv->palette=malloc(4*256);
+        for(i=0; i<256; i++){
+            vf->priv->palette[4*i+0]=4*(i>>6)*21;
+            vf->priv->palette[4*i+1]=4*((i>>3)&7)*9;
+            vf->priv->palette[4*i+2]=4*((i&7)&7)*9;
             vf->priv->palette[4*i+3]=0;
-	}
-	break; }
+        }
+        break; }
     case IMGFMT_BGR8: {
       /* set 332 palette for 8 bpp */
-	vf->priv->palette=malloc(4*256);
-	for(i=0; i<256; i++){
-	    vf->priv->palette[4*i+0]=4*(i&3)*21;
-	    vf->priv->palette[4*i+1]=4*((i>>2)&7)*9;
-	    vf->priv->palette[4*i+2]=4*((i>>5)&7)*9;
+        vf->priv->palette=malloc(4*256);
+        for(i=0; i<256; i++){
+            vf->priv->palette[4*i+0]=4*(i&3)*21;
+            vf->priv->palette[4*i+1]=4*((i>>2)&7)*9;
+            vf->priv->palette[4*i+2]=4*((i>>5)&7)*9;
             vf->priv->palette[4*i+3]=0;
-	}
-	break; }
+        }
+        break; }
     case IMGFMT_BGR4:
     case IMGFMT_BG4B: {
-	vf->priv->palette=malloc(4*16);
-	for(i=0; i<16; i++){
-	    vf->priv->palette[4*i+0]=4*(i&1)*63;
-	    vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
-	    vf->priv->palette[4*i+2]=4*((i>>3)&1)*63;
+        vf->priv->palette=malloc(4*16);
+        for(i=0; i<16; i++){
+            vf->priv->palette[4*i+0]=4*(i&1)*63;
+            vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
+            vf->priv->palette[4*i+2]=4*((i>>3)&1)*63;
             vf->priv->palette[4*i+3]=0;
-	}
-	break; }
+        }
+        break; }
     case IMGFMT_RGB4:
     case IMGFMT_RG4B: {
-	vf->priv->palette=malloc(4*16);
-	for(i=0; i<16; i++){
-	    vf->priv->palette[4*i+0]=4*(i>>3)*63;
-	    vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
-	    vf->priv->palette[4*i+2]=4*((i&1)&1)*63;
+        vf->priv->palette=malloc(4*16);
+        for(i=0; i<16; i++){
+            vf->priv->palette[4*i+0]=4*(i>>3)*63;
+            vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
+            vf->priv->palette[4*i+2]=4*((i&1)&1)*63;
             vf->priv->palette[4*i+3]=0;
-	}
-	break; }
+        }
+        break; }
     }
 
     if(!opt_screen_size_x && !opt_screen_size_y && !(screen_size_xy >= 0.001)){
-	// Compute new d_width and d_height, preserving aspect
-	// while ensuring that both are >= output size in pixels.
-	if (vf->priv->h * d_width > vf->priv->w * d_height) {
-		d_width = vf->priv->h * d_width / d_height;
-		d_height = vf->priv->h;
-	} else {
-		d_height = vf->priv->w * d_height / d_width;
-		d_width = vf->priv->w;
-	}
-	//d_width=d_width*vf->priv->w/width;
-	//d_height=d_height*vf->priv->h/height;
+        // Compute new d_width and d_height, preserving aspect
+        // while ensuring that both are >= output size in pixels.
+        if (vf->priv->h * d_width > vf->priv->w * d_height) {
+                d_width = vf->priv->h * d_width / d_height;
+                d_height = vf->priv->h;
+        } else {
+                d_height = vf->priv->w * d_height / d_width;
+                d_width = vf->priv->w;
+        }
+        //d_width=d_width*vf->priv->w/width;
+        //d_height=d_height*vf->priv->h/height;
     }
     return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best);
 }
 
 static void start_slice(struct vf_instance *vf, mp_image_t *mpi){
-//    printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
+//  printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
     if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen
     // they want slices!!! allocate the buffer.
     mpi->priv=vf->dmpi=vf_get_image(vf->next,vf->priv->fmt,
-//	mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK),
-	MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
-	vf->priv->w, vf->priv->h);
+//      mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK),
+        MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
+        vf->priv->w, vf->priv->h);
 }
 
 static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES],
@@ -407,32 +407,32 @@ static void draw_slice(struct vf_instanc
         unsigned char** src, int* stride, int w,int h, int x, int y){
     mp_image_t *dmpi=vf->dmpi;
     if(!dmpi){
-	mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image?)\n");
-	return;
+        mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image?)\n");
+        return;
     }
-//    printf("vf_scale::draw_slice() y=%d h=%d\n",y,h);
+//  printf("vf_scale::draw_slice() y=%d h=%d\n",y,h);
     scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced);
 }
 
 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
     mp_image_t *dmpi=mpi->priv;
 
-//    printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
-//	dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
+//  printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
+//      dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
 
   if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){
 
     // hope we'll get DR buffer:
     dmpi=vf_get_image(vf->next,vf->priv->fmt,
-	MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
-	vf->priv->w, vf->priv->h);
+        MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
+        vf->priv->w, vf->priv->h);
 
       scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride, vf->priv->interlaced);
   }
 
     if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){
-	// just conversion, no scaling -> keep postprocessing data
-	// this way we can apply pp filter to non-yv12 source using scaler
+        // just conversion, no scaling -> keep postprocessing data
+        // this way we can apply pp filter to non-yv12 source using scaler
         vf_clone_mpi_attributes(dmpi, mpi);
     }
 
@@ -451,50 +451,50 @@ static int control(struct vf_instance *v
   if(vf->priv->ctx)
     switch(request){
     case VFCTRL_GET_EQUALIZER:
-	r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
-	if(r<0) break;
+        r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
+        if(r<0) break;
 
-	eq = data;
-	if (!strcmp(eq->item,"brightness")) {
-		eq->value =  ((brightness*100) + (1<<15))>>16;
-	}
-	else if (!strcmp(eq->item,"contrast")) {
-		eq->value = (((contrast  *100) + (1<<15))>>16) - 100;
-	}
-	else if (!strcmp(eq->item,"saturation")) {
-		eq->value = (((saturation*100) + (1<<15))>>16) - 100;
-	}
-	else
-		break;
-	return CONTROL_TRUE;
+        eq = data;
+        if (!strcmp(eq->item,"brightness")) {
+                eq->value =  ((brightness*100) + (1<<15))>>16;
+        }
+        else if (!strcmp(eq->item,"contrast")) {
+                eq->value = (((contrast  *100) + (1<<15))>>16) - 100;
+        }
+        else if (!strcmp(eq->item,"saturation")) {
+                eq->value = (((saturation*100) + (1<<15))>>16) - 100;
+        }
+        else
+                break;
+        return CONTROL_TRUE;
     case VFCTRL_SET_EQUALIZER:
-	r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
-	if(r<0) break;
+        r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
+        if(r<0) break;
 //printf("set %f %f %f\n", brightness/(float)(1<<16), contrast/(float)(1<<16), saturation/(float)(1<<16));
-	eq = data;
+        eq = data;
 
-	if (!strcmp(eq->item,"brightness")) {
-		brightness = (( eq->value     <<16) + 50)/100;
-	}
-	else if (!strcmp(eq->item,"contrast")) {
-		contrast   = (((eq->value+100)<<16) + 50)/100;
-	}
-	else if (!strcmp(eq->item,"saturation")) {
-		saturation = (((eq->value+100)<<16) + 50)/100;
-	}
-	else
-		break;
+        if (!strcmp(eq->item,"brightness")) {
+                brightness = (( eq->value     <<16) + 50)/100;
+        }
+        else if (!strcmp(eq->item,"contrast")) {
+                contrast   = (((eq->value+100)<<16) + 50)/100;
+        }
+        else if (!strcmp(eq->item,"saturation")) {
+                saturation = (((eq->value+100)<<16) + 50)/100;
+        }
+        else
+                break;
 
-	r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
-	if(r<0) break;
-	if(vf->priv->ctx2){
+        r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
+        if(r<0) break;
+        if(vf->priv->ctx2){
             r= sws_setColorspaceDetails(vf->priv->ctx2, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
             if(r<0) break;
         }
 
-	return CONTROL_TRUE;
+        return CONTROL_TRUE;
     default:
-	break;
+        break;
     }
 
     return vf_next_control(vf,request,data);
@@ -506,17 +506,17 @@ static int control(struct vf_instance *v
 
 static int query_format(struct vf_instance *vf, unsigned int fmt){
     if (!IMGFMT_IS_HWACCEL(fmt) && imgfmt2pixfmt(fmt) != PIX_FMT_NONE) {
-	unsigned int best=find_best_out(vf, fmt);
-	int flags;
-	if(!best) return 0;	 // no matching out-fmt
-	flags=vf_next_query_format(vf,best);
-	if(!(flags&(VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW))) return 0; // huh?
-	if(fmt!=best) flags&=~VFCAP_CSP_SUPPORTED_BY_HW;
-	// do not allow scaling, if we are before the PP fliter!
-	if(!(flags&VFCAP_POSTPROC)) flags|=VFCAP_SWSCALE;
-	return flags;
+        unsigned int best=find_best_out(vf, fmt);
+        int flags;
+        if(!best) return 0;         // no matching out-fmt
+        flags=vf_next_query_format(vf,best);
+        if(!(flags&(VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW))) return 0; // huh?
+        if(fmt!=best) flags&=~VFCAP_CSP_SUPPORTED_BY_HW;
+        // do not allow scaling, if we are before the PP fliter!
+        if(!(flags&VFCAP_POSTPROC)) flags|=VFCAP_SWSCALE;
+        return flags;
     }
-    return 0;	// nomatching in-fmt
+    return 0;        // nomatching in-fmt
 }
 
 static void uninit(struct vf_instance *vf){
@@ -557,67 +557,67 @@ float sws_lum_sharpen= 0.0;
 int get_sws_cpuflags(void){
     return
           (gCpuCaps.hasMMX   ? SWS_CPU_CAPS_MMX   : 0)
-	| (gCpuCaps.hasMMX2  ? SWS_CPU_CAPS_MMX2  : 0)
-	| (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0)
+        | (gCpuCaps.hasMMX2  ? SWS_CPU_CAPS_MMX2  : 0)
+        | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0)
         | (gCpuCaps.hasAltiVec ? SWS_CPU_CAPS_ALTIVEC : 0);
 }
 
 void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)
 {
-	static int firstTime=1;
-	*flags=0;
+        static int firstTime=1;
+        *flags=0;
 
 #if ARCH_X86
-	if(gCpuCaps.hasMMX)
-		__asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
+        if(gCpuCaps.hasMMX)
+                __asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
 #endif
-	if(firstTime)
-	{
-		firstTime=0;
-		*flags= SWS_PRINT_INFO;
-	}
-	else if( mp_msg_test(MSGT_VFILTER,MSGL_DBG2) ) *flags= SWS_PRINT_INFO;
+        if(firstTime)
+        {
+                firstTime=0;
+                *flags= SWS_PRINT_INFO;
+        }
+        else if( mp_msg_test(MSGT_VFILTER,MSGL_DBG2) ) *flags= SWS_PRINT_INFO;
 
-	if(src_filter) sws_freeFilter(src_filter);
+        if(src_filter) sws_freeFilter(src_filter);
 
-	src_filter= sws_getDefaultFilter(
-		sws_lum_gblur, sws_chr_gblur,
-		sws_lum_sharpen, sws_chr_sharpen,
-		sws_chr_hshift, sws_chr_vshift, verbose>1);
+        src_filter= sws_getDefaultFilter(
+                sws_lum_gblur, sws_chr_gblur,
+                sws_lum_sharpen, sws_chr_sharpen,
+                sws_chr_hshift, sws_chr_vshift, verbose>1);
 
-	switch(sws_flags)
-	{
-		case 0: *flags|= SWS_FAST_BILINEAR; break;
-		case 1: *flags|= SWS_BILINEAR; break;
-		case 2: *flags|= SWS_BICUBIC; break;
-		case 3: *flags|= SWS_X; break;
-		case 4: *flags|= SWS_POINT; break;
-		case 5: *flags|= SWS_AREA; break;
-		case 6: *flags|= SWS_BICUBLIN; break;
-		case 7: *flags|= SWS_GAUSS; break;
-		case 8: *flags|= SWS_SINC; break;
-		case 9: *flags|= SWS_LANCZOS; break;
-		case 10:*flags|= SWS_SPLINE; break;
-		default:*flags|= SWS_BILINEAR; break;
-	}
+        switch(sws_flags)
+        {
+                case 0: *flags|= SWS_FAST_BILINEAR; break;
+                case 1: *flags|= SWS_BILINEAR; break;
+                case 2: *flags|= SWS_BICUBIC; break;
+                case 3: *flags|= SWS_X; break;
+                case 4: *flags|= SWS_POINT; break;
+                case 5: *flags|= SWS_AREA; break;
+                case 6: *flags|= SWS_BICUBLIN; break;
+                case 7: *flags|= SWS_GAUSS; break;
+                case 8: *flags|= SWS_SINC; break;
+                case 9: *flags|= SWS_LANCZOS; break;
+                case 10:*flags|= SWS_SPLINE; break;
+                default:*flags|= SWS_BILINEAR; break;
+        }
 
-	*srcFilterParam= src_filter;
-	*dstFilterParam= NULL;
+        *srcFilterParam= src_filter;
+        *dstFilterParam= NULL;
 }
 
 // will use sws_flags & src_filter (from cmd line)
 struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat)
 {
-	int flags;
-	SwsFilter *dstFilterParam, *srcFilterParam;
-	enum PixelFormat dfmt, sfmt;
+        int flags;
+        SwsFilter *dstFilterParam, *srcFilterParam;
+        enum PixelFormat dfmt, sfmt;
 
-	dfmt = imgfmt2pixfmt(dstFormat);
-	sfmt = imgfmt2pixfmt(srcFormat);
-	if (srcFormat == IMGFMT_RGB8 || srcFormat == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8;
-	sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam);
+        dfmt = imgfmt2pixfmt(dstFormat);
+        sfmt = imgfmt2pixfmt(srcFormat);
+        if (srcFormat == IMGFMT_RGB8 || srcFormat == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8;
+        sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam);
 
-	return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL);
+        return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL);
 }
 
 /// An example of presets usage


More information about the MPlayer-cvslog mailing list