]> git.sesse.net Git - vlc/blob - modules/video_filter/filter_picture.h
Use var_Inherit* instead of var_CreateGet*.
[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 /* FIXME: do all of these really have square pixels? */
25 #define CASE_PLANAR_YUV_SQUARE              \
26         case VLC_CODEC_I420:   \
27         case VLC_CODEC_J420:   \
28         case VLC_CODEC_YV12:   \
29         case VLC_CODEC_I411:   \
30         case VLC_CODEC_I410:   \
31         case VLC_CODEC_I444:   \
32         case VLC_CODEC_J444:   \
33         case VLC_CODEC_YUVA:
34
35 #define CASE_PLANAR_YUV_NONSQUARE           \
36         case VLC_CODEC_I422:   \
37         case VLC_CODEC_J422:
38
39 #define CASE_PLANAR_YUV                     \
40         CASE_PLANAR_YUV_SQUARE              \
41         CASE_PLANAR_YUV_NONSQUARE           \
42
43 #define CASE_PACKED_YUV_422                 \
44         case VLC_CODEC_UYVY:   \
45         case VLC_CODEC_CYUV:   \
46         case VLC_CODEC_YUYV:   \
47         case VLC_CODEC_YVYU:
48
49 static inline int GetPackedYuvOffsets( vlc_fourcc_t i_chroma,
50     int *i_y_offset, int *i_u_offset, int *i_v_offset )
51 {
52     switch( i_chroma )
53     {
54         case VLC_CODEC_UYVY:
55         case VLC_CODEC_CYUV: /* <-- FIXME: reverted, whatever that means */
56             /* UYVY */
57             *i_y_offset = 1;
58             *i_u_offset = 0;
59             *i_v_offset = 2;
60             return VLC_SUCCESS;
61         case VLC_CODEC_YUYV:
62             /* YUYV */
63             *i_y_offset = 0;
64             *i_u_offset = 1;
65             *i_v_offset = 3;
66             return VLC_SUCCESS;
67         case VLC_CODEC_YVYU:
68             /* YVYU */
69             *i_y_offset = 0;
70             *i_u_offset = 3;
71             *i_v_offset = 1;
72             return VLC_SUCCESS;
73         default:
74             return VLC_EGENERIC;
75     }
76 }
77
78 /*****************************************************************************
79  *
80  *****************************************************************************/
81 static inline picture_t *CopyInfoAndRelease( picture_t *p_outpic, picture_t *p_inpic )
82 {
83     picture_CopyProperties( p_outpic, p_inpic );
84
85     picture_Release( p_inpic );
86
87     return p_outpic;
88 }