00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <stdio.h>
00020 #include <stdlib.h>
00021 #include <string.h>
00022
00023 #include "config.h"
00024 #include "mp_msg.h"
00025
00026 #include "mp_image.h"
00027 #include "vf.h"
00028
00029 struct vf_priv_s {
00030 int interleave;
00031 int height;
00032 int width;
00033 int stridefactor;
00034 };
00035
00036
00037
00038 static int config(struct vf_instance *vf,
00039 int width, int height, int d_width, int d_height,
00040 unsigned int flags, unsigned int outfmt){
00041 int pixel_stride= (width+15)&~15;
00042
00043 #if 0
00044 if(mpi->flags&MP_IMGFLAG_PLANAR)
00045 pixel_stride= mpi->stride[0];
00046 else
00047 pixel_stride= 8*mpi->stride[0] / mpi->bpp;
00048
00049 #endif
00050
00051 if(vf->priv->interleave){
00052 vf->priv->height= 2*height;
00053 vf->priv->width= width - (pixel_stride/2);
00054 vf->priv->stridefactor=1;
00055 }else{
00056 vf->priv->height= height/2;
00057 vf->priv->width= width + pixel_stride;
00058 vf->priv->stridefactor=4;
00059 }
00060
00061
00062 return vf_next_config(vf, vf->priv->width, vf->priv->height,
00063 (d_width*vf->priv->stridefactor)>>1, 2*d_height/vf->priv->stridefactor, flags, outfmt);
00064 }
00065
00066 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
00067 if(mpi->flags&MP_IMGFLAG_DIRECT){
00068
00069 return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts);
00070 }
00071
00072 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
00073 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
00074 vf->priv->width, vf->priv->height);
00075
00076
00077 vf->dmpi->planes[0]=mpi->planes[0];
00078 vf->dmpi->stride[0]=(mpi->stride[0]*vf->priv->stridefactor)>>1;
00079 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
00080 vf->dmpi->planes[1]=mpi->planes[1];
00081 vf->dmpi->stride[1]=(mpi->stride[1]*vf->priv->stridefactor)>>1;
00082 vf->dmpi->planes[2]=mpi->planes[2];
00083 vf->dmpi->stride[2]=(mpi->stride[2]*vf->priv->stridefactor)>>1;
00084 } else
00085 vf->dmpi->planes[1]=mpi->planes[1];
00086
00087 return vf_next_put_image(vf,vf->dmpi, pts);
00088 }
00089
00090
00091
00092 static void uninit(struct vf_instance *vf)
00093 {
00094 free(vf->priv);
00095 }
00096
00097 static int vf_open(vf_instance_t *vf, char *args){
00098 vf->config=config;
00099 vf->put_image=put_image;
00100 vf->uninit=uninit;
00101 vf->default_reqs=VFCAP_ACCEPT_STRIDE;
00102 vf->priv=calloc(1, sizeof(struct vf_priv_s));
00103 vf->priv->interleave= args && (*args == 'i');
00104 return 1;
00105 }
00106
00107 const vf_info_t vf_info_fil = {
00108 "fast (de)interleaver",
00109 "fil",
00110 "Michael Niedermayer",
00111 "",
00112 vf_open,
00113 NULL
00114 };
00115
00116