]> git.sesse.net Git - vlc/blob - modules/video_filter/filter_picture.h
Some more filter work:
[vlc] / modules / video_filter / filter_picture.h
1 /*****************************************************************************
2  * filter_picture.h: Common picture functions for filters
3  *****************************************************************************
4  * Copyright (C) 2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Antoine Cellerier <dionoea at videolan dot org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #define CASE_PACKED_YUV_422                 \
25         case VLC_FOURCC('I','U','Y','V'):   \
26         case VLC_FOURCC('U','Y','V','Y'):   \
27         case VLC_FOURCC('U','Y','N','V'):   \
28         case VLC_FOURCC('Y','4','2','2'):   \
29         case VLC_FOURCC('c','y','u','v'):   \
30         case VLC_FOURCC('Y','U','Y','2'):   \
31         case VLC_FOURCC('Y','U','N','V'):   \
32         case VLC_FOURCC('Y','V','Y','U'):
33
34 static inline int GetPackedYuvOffsets( vlc_fourcc_t i_chroma,
35     int *i_y_offset, int *i_u_offset, int *i_v_offset )
36 {
37     switch( i_chroma )
38     {
39         case VLC_FOURCC('I','U','Y','V'): /* <-- FIXME: interlaced */
40         case VLC_FOURCC('U','Y','V','Y'):
41         case VLC_FOURCC('U','Y','N','V'):
42         case VLC_FOURCC('Y','4','2','2'):
43         case VLC_FOURCC('c','y','u','v'): /* <-- FIXME: reverted, whatever that means */
44             /* UYVY */
45             *i_y_offset = 1;
46             *i_u_offset = 0;
47             *i_v_offset = 2;
48             return VLC_SUCCESS;
49         case VLC_FOURCC('Y','U','Y','2'):
50         case VLC_FOURCC('Y','U','N','V'):
51             /* YUYV */
52             *i_y_offset = 0;
53             *i_u_offset = 1;
54             *i_v_offset = 3;
55             return VLC_SUCCESS;
56         case VLC_FOURCC('Y','V','Y','U'):
57             /* YVYU */
58             *i_y_offset = 0;
59             *i_u_offset = 3;
60             *i_v_offset = 1;
61             return VLC_SUCCESS;
62         default:
63             return VLC_EGENERIC;
64     }
65 }