annotate libmpcodecs/vf_yuy2.c @ 7529:c276bfb414fb

removed obsolete/unused audio|video_fm|codec, has_audio|video
author arpi
date Sat, 28 Sep 2002 18:45:47 +0000
parents a894e99c1e51
children e9a2af584986
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
1 #include <stdio.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
2 #include <stdlib.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
3 #include <string.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
4 #include <inttypes.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
5
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
6 #include "../config.h"
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
7 #include "../mp_msg.h"
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
8
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
9 #include "img_format.h"
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
10 #include "mp_image.h"
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
11 #include "vf.h"
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
12
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
13 #include "../libvo/fastmemcpy.h"
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
14 #include "../postproc/rgb2rgb.h"
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
15
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
16 //===========================================================================//
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
17
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
18 static int config(struct vf_instance_s* vf,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
19 int width, int height, int d_width, int d_height,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
20 unsigned int flags, unsigned int outfmt){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
21
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
22 if(vf_next_query_format(vf,IMGFMT_YUY2)<=0){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
23 printf("yuy2 not supported by next filter/vo :(\n");
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
24 return 0;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
25 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
26
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
27 return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YUY2);
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
28 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
29
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7342
diff changeset
30 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
31 mp_image_t *dmpi;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
32
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
33 // hope we'll get DR buffer:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
34 dmpi=vf_get_image(vf->next,IMGFMT_YUY2,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
35 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
36 mpi->w, mpi->h);
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
37
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
38 if(mpi->imgfmt==IMGFMT_422P)
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
39 yuv422ptoyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
40 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
41 else
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
42 yv12toyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
43 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
44
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
45 dmpi->qscale=mpi->qscale;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
46 dmpi->qstride=mpi->qstride;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
47
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7342
diff changeset
48 return vf_next_put_image(vf,dmpi);
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
49 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
50
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
51 //===========================================================================//
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
52
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
53 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
54 switch(fmt){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
55 case IMGFMT_YV12:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
56 case IMGFMT_I420:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
57 case IMGFMT_IYUV:
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
58 case IMGFMT_422P:
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5539
diff changeset
59 return vf_next_query_format(vf,IMGFMT_YUY2) & (~VFCAP_CSP_SUPPORTED_BY_HW);
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
60 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
61 return 0;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
62 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
63
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
64 static int open(vf_instance_t *vf, char* args){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
65 vf->config=config;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
66 vf->put_image=put_image;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
67 vf->query_format=query_format;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
68 return 1;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
69 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
70
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
71 vf_info_t vf_info_yuy2 = {
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
72 "fast YV12/Y422p -> YUY2 conversion",
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
73 "yuy2",
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
74 "A'rpi",
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
75 "",
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
76 open
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
77 };
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
78
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
79 //===========================================================================//