Mercurial > mplayer.hg
comparison libmpcodecs/vf_cropdetect.c @ 6118:f869ece65aab
ignore first 2 frames
author | arpi |
---|---|
date | Sat, 18 May 2002 17:35:12 +0000 |
parents | 0c33406d2a83 |
children | 242d1b98a15f |
comparison
equal
deleted
inserted
replaced
6117:0c33406d2a83 | 6118:f869ece65aab |
---|---|
14 #include "../postproc/rgb2rgb.h" | 14 #include "../postproc/rgb2rgb.h" |
15 | 15 |
16 struct vf_priv_s { | 16 struct vf_priv_s { |
17 int x1,y1,x2,y2; | 17 int x1,y1,x2,y2; |
18 int limit; | 18 int limit; |
19 int fno; | |
19 }; | 20 }; |
20 | 21 |
21 static int checkline(unsigned char* src,int stride,int len,int bpp){ | 22 static int checkline(unsigned char* src,int stride,int len,int bpp){ |
22 int total=0; | 23 int total=0; |
23 int div=len; | 24 int div=len; |
48 unsigned int flags, unsigned int outfmt){ | 49 unsigned int flags, unsigned int outfmt){ |
49 vf->priv->x1=width; | 50 vf->priv->x1=width; |
50 vf->priv->y1=height; | 51 vf->priv->y1=height; |
51 vf->priv->x2=0; | 52 vf->priv->x2=0; |
52 vf->priv->y2=0; | 53 vf->priv->y2=0; |
54 vf->priv->fno=0; | |
53 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); | 55 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
54 } | 56 } |
55 | 57 |
56 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ | 58 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
57 mp_image_t *dmpi; | 59 mp_image_t *dmpi; |
70 dmpi->stride[1]=mpi->stride[1]; | 72 dmpi->stride[1]=mpi->stride[1]; |
71 dmpi->stride[2]=mpi->stride[2]; | 73 dmpi->stride[2]=mpi->stride[2]; |
72 dmpi->width=mpi->width; | 74 dmpi->width=mpi->width; |
73 dmpi->height=mpi->height; | 75 dmpi->height=mpi->height; |
74 | 76 |
75 //static int checkline(unsigned char* src,int stride,int len,int bpp){ | 77 if(++vf->priv->fno>2){ // ignore first 2 frames - they may be empty |
76 | 78 |
77 for(y=0;y<vf->priv->y1;y++){ | 79 for(y=0;y<vf->priv->y1;y++){ |
78 if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){ | 80 if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){ |
79 vf->priv->y1=y; | 81 vf->priv->y1=y; |
80 break; | 82 break; |
109 vf->priv->x1,vf->priv->x2, | 111 vf->priv->x1,vf->priv->x2, |
110 vf->priv->y1,vf->priv->y2, | 112 vf->priv->y1,vf->priv->y2, |
111 (vf->priv->x2+1-x)&(~1),(vf->priv->y2+1-y)&(~1),x,y | 113 (vf->priv->x2+1-x)&(~1),(vf->priv->y2+1-y)&(~1),x,y |
112 ); | 114 ); |
113 | 115 |
116 } | |
117 | |
114 vf_next_put_image(vf,dmpi); | 118 vf_next_put_image(vf,dmpi); |
115 } | 119 } |
116 | 120 |
117 //===========================================================================// | 121 //===========================================================================// |
118 | 122 |