annotate libmpcodecs/vf_yuy2.c @ 20332:f8ecbac45430

fixed sync tag
author kraymer
date Sat, 21 Oct 2006 18:38:58 +0000
parents 8579acff875e
children f8d4f8eff72b
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
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 10993
diff changeset
6 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 10993
diff changeset
7 #include "mp_msg.h"
18004
bcd805923554 Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents: 17906
diff changeset
8 #include "help_mp.h"
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
9
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
10 #include "img_format.h"
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
11 #include "mp_image.h"
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
12 #include "vf.h"
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
13
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 10993
diff changeset
14 #include "libvo/fastmemcpy.h"
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents: 18004
diff changeset
15 #include "libswscale/rgb2rgb.h"
10993
alex
parents: 9934
diff changeset
16 #include "vf_scale.h"
5539
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 //===========================================================================//
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
19
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
20 static int config(struct vf_instance_s* vf,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
21 int width, int height, int d_width, int d_height,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
22 unsigned int flags, unsigned int outfmt){
10993
alex
parents: 9934
diff changeset
23
alex
parents: 9934
diff changeset
24 sws_rgb2rgb_init(get_sws_cpuflags());
5539
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 if(vf_next_query_format(vf,IMGFMT_YUY2)<=0){
18004
bcd805923554 Part2 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu with LOTS of modifications by me
reynaldo
parents: 17906
diff changeset
27 mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YUY2");
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
28 return 0;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
29 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
30
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
31 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
32 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
33
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
34 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
35 mp_image_t *dmpi;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
36
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
37 // hope we'll get DR buffer:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
38 dmpi=vf_get_image(vf->next,IMGFMT_YUY2,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
39 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
40 mpi->w, mpi->h);
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
41
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
42 if(mpi->imgfmt==IMGFMT_422P)
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
43 yuv422ptoyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
44 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
45 else
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
46 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
47 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
48
9934
89da8ec89558 vf_clone_mpi_attributes()
michael
parents: 9593
diff changeset
49 vf_clone_mpi_attributes(dmpi, mpi);
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
50
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
51 return vf_next_put_image(vf,dmpi, pts);
5539
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
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
54 //===========================================================================//
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
55
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
56 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
57 switch(fmt){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
58 case IMGFMT_YV12:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
59 case IMGFMT_I420:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
60 case IMGFMT_IYUV:
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
61 case IMGFMT_422P:
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5539
diff changeset
62 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
63 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
64 return 0;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
65 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
66
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
67 static int open(vf_instance_t *vf, char* args){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
68 vf->config=config;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
69 vf->put_image=put_image;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
70 vf->query_format=query_format;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
71 return 1;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
72 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
73
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
74 vf_info_t vf_info_yuy2 = {
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
75 "fast YV12/Y422p -> YUY2 conversion",
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
76 "yuy2",
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
77 "A'rpi",
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
78 "",
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 7368
diff changeset
79 open,
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 7368
diff changeset
80 NULL
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
81 };
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
82
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
83 //===========================================================================//