typo fixes
[mplayer/greg.git] / libmpcodecs / vf_yuy2.c
blob8310a53efc7d3d47063cdd013418fdd6de969eb8
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <inttypes.h>
6 #include "config.h"
7 #include "mp_msg.h"
8 #include "help_mp.h"
10 #include "img_format.h"
11 #include "mp_image.h"
12 #include "vf.h"
14 #include "libvo/fastmemcpy.h"
15 #include "postproc/rgb2rgb.h"
16 #include "vf_scale.h"
18 //===========================================================================//
20 static int config(struct vf_instance_s* vf,
21 int width, int height, int d_width, int d_height,
22 unsigned int flags, unsigned int outfmt){
24 sws_rgb2rgb_init(get_sws_cpuflags());
26 if(vf_next_query_format(vf,IMGFMT_YUY2)<=0){
27 mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YUY2");
28 return 0;
31 return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YUY2);
34 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
35 mp_image_t *dmpi;
37 // hope we'll get DR buffer:
38 dmpi=vf_get_image(vf->next,IMGFMT_YUY2,
39 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
40 mpi->w, mpi->h);
42 if(mpi->imgfmt==IMGFMT_422P)
43 yuv422ptoyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
44 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
45 else
46 yv12toyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
47 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
49 vf_clone_mpi_attributes(dmpi, mpi);
51 return vf_next_put_image(vf,dmpi, pts);
54 //===========================================================================//
56 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
57 switch(fmt){
58 case IMGFMT_YV12:
59 case IMGFMT_I420:
60 case IMGFMT_IYUV:
61 case IMGFMT_422P:
62 return vf_next_query_format(vf,IMGFMT_YUY2) & (~VFCAP_CSP_SUPPORTED_BY_HW);
64 return 0;
67 static int open(vf_instance_t *vf, char* args){
68 vf->config=config;
69 vf->put_image=put_image;
70 vf->query_format=query_format;
71 return 1;
74 vf_info_t vf_info_yuy2 = {
75 "fast YV12/Y422p -> YUY2 conversion",
76 "yuy2",
77 "A'rpi",
78 "",
79 open,
80 NULL
83 //===========================================================================//