annotate libmpcodecs/vf_yuy2.c @ 31063:55cd4161425a

Fix compilation with gcc 2.95.3 (with --disable-ass).
author cehoyos
date Wed, 28 Apr 2010 11:57:09 +0000
parents a972c1a4a012
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
17 */
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
18
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
19 #include <stdio.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
20 #include <stdlib.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
21 #include <string.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
22 #include <inttypes.h>
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
23
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 10993
diff changeset
24 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 10993
diff changeset
25 #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
26 #include "help_mp.h"
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
27
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
28 #include "img_format.h"
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5565
diff changeset
29 #include "mp_image.h"
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
30 #include "vf.h"
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
31
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents: 18004
diff changeset
32 #include "libswscale/rgb2rgb.h"
10993
alex
parents: 9934
diff changeset
33 #include "vf_scale.h"
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
34
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
35 //===========================================================================//
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
36
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
37 static int config(struct vf_instance *vf,
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
38 int width, int height, int d_width, int d_height,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
39 unsigned int flags, unsigned int outfmt){
10993
alex
parents: 9934
diff changeset
40
alex
parents: 9934
diff changeset
41 sws_rgb2rgb_init(get_sws_cpuflags());
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25221
diff changeset
42
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
43 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
44 mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YUY2");
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
45 return 0;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
46 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25221
diff changeset
47
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
48 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
49 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
50
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
51 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
52 mp_image_t *dmpi;
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 // hope we'll get DR buffer:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
55 dmpi=vf_get_image(vf->next,IMGFMT_YUY2,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
56 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
57 mpi->w, mpi->h);
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
58
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
59 if(mpi->imgfmt==IMGFMT_422P)
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
60 yuv422ptoyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
61 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
62 else
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
63 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
64 mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25221
diff changeset
65
9934
89da8ec89558 vf_clone_mpi_attributes()
michael
parents: 9593
diff changeset
66 vf_clone_mpi_attributes(dmpi, mpi);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25221
diff changeset
67
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
68 return vf_next_put_image(vf,dmpi, pts);
5539
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 //===========================================================================//
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
72
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
73 static int query_format(struct vf_instance *vf, unsigned int fmt){
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
74 switch(fmt){
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
75 case IMGFMT_YV12:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
76 case IMGFMT_I420:
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
77 case IMGFMT_IYUV:
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
78 case IMGFMT_422P:
5565
0b301fec999a capabilities support -> automatic insertion of scale, expand, pp
arpi
parents: 5539
diff changeset
79 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
80 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
81 return 0;
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
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
84 static int vf_open(vf_instance_t *vf, char *args){
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
85 vf->config=config;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
86 vf->put_image=put_image;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
87 vf->query_format=query_format;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
88 return 1;
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
89 }
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
90
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23373
diff changeset
91 const vf_info_t vf_info_yuy2 = {
7342
21d6837f5d95 yuv422planar->yuy2 support
arpi
parents: 5607
diff changeset
92 "fast YV12/Y422p -> YUY2 conversion",
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
93 "yuy2",
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
94 "A'rpi",
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
95 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
96 vf_open,
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 7368
diff changeset
97 NULL
5539
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
98 };
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
99
eefc339440bc 2 new simple filters: yuy2 and format
arpi
parents:
diff changeset
100 //===========================================================================//