comparison libmpcodecs/vf_yuy2.c @ 5539:eefc339440bc

2 new simple filters: yuy2 and format
author arpi
date Tue, 09 Apr 2002 14:01:53 +0000
parents
children 0b301fec999a
comparison
equal deleted inserted replaced
5538:70725449c947 5539:eefc339440bc
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <inttypes.h>
5
6 #include "../config.h"
7 #include "../mp_msg.h"
8
9 #include "../libvo/img_format.h"
10 #include "../mp_image.h"
11 #include "vf.h"
12
13 #include "../libvo/fastmemcpy.h"
14 #include "../postproc/rgb2rgb.h"
15
16 //===========================================================================//
17
18 static int config(struct vf_instance_s* vf,
19 int width, int height, int d_width, int d_height,
20 unsigned int flags, unsigned int outfmt){
21
22 if(vf_next_query_format(vf,IMGFMT_YUY2)<=0){
23 printf("yuy2 not supported by next filter/vo :(\n");
24 return 0;
25 }
26
27 return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YUY2);
28 }
29
30 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
31 mp_image_t *dmpi;
32
33 // hope we'll get DR buffer:
34 dmpi=vf_get_image(vf->next,IMGFMT_YUY2,
35 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
36 mpi->w, mpi->h);
37
38 yv12toyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
39 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
40
41 dmpi->qscale=mpi->qscale;
42 dmpi->qstride=mpi->qstride;
43
44 vf_next_put_image(vf,dmpi);
45 }
46
47 //===========================================================================//
48
49 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
50 switch(fmt){
51 case IMGFMT_YV12:
52 case IMGFMT_I420:
53 case IMGFMT_IYUV:
54 return 3; //vf_next_query_format(vf,fmt);
55 }
56 return 0;
57 }
58
59 static int open(vf_instance_t *vf, char* args){
60 vf->config=config;
61 vf->put_image=put_image;
62 vf->query_format=query_format;
63 return 1;
64 }
65
66 vf_info_t vf_info_yuy2 = {
67 "fast YV12->YUY2 conversion",
68 "yuy2",
69 "A'rpi",
70 "",
71 open
72 };
73
74 //===========================================================================//