summaryrefslogtreecommitdiff
path: root/include/linux/mxc_pf.h
blob: 6d38642eef1273de0a0b89e1185eeefc246f685c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * Copyright 2005-2009 Freescale Semiconductor, Inc. All Rights Reserved.
 */

/*
 * The code contained herein is licensed under the GNU Lesser General
 * Public License.  You may obtain a copy of the GNU Lesser General
 * Public License Version 2.1 or later at the following locations:
 *
 * http://www.opensource.org/licenses/lgpl-license.html
 * http://www.gnu.org/copyleft/lgpl.html
 */

/*!
 * @defgroup MXC_PF MPEG4/H.264 Post Filter Driver
 */
/*!
 * @file arch-mxc/mxc_pf.h
 *
 * @brief MXC IPU MPEG4/H.264 Post-filtering driver
 *
 * User-level API for IPU Hardware MPEG4/H.264 Post-filtering.
 *
 * @ingroup MXC_PF
 */
#ifndef __INCLUDED_MXC_PF_H__
#define __INCLUDED_MXC_PF_H__

#define PF_MAX_BUFFER_CNT       17

#define PF_WAIT_Y	0x0001
#define PF_WAIT_U	0x0002
#define PF_WAIT_V	0x0004
#define PF_WAIT_ALL	(PF_WAIT_Y|PF_WAIT_U|PF_WAIT_V)

/*!
 * Structure for Post Filter initialization parameters.
 */
typedef struct {
	uint16_t pf_mode;	/*!< Post filter operation mode */
	uint16_t width;		/*!< Width of frame in pixels */
	uint16_t height;	/*!< Height of frame in pixels */
	uint16_t stride;	/*!< Stride of Y plane in pixels. Stride for U and V planes is half Y stride */
	uint32_t qp_size;
	unsigned long qp_paddr;
} pf_init_params;

/*!
 * Structure for Post Filter buffer request parameters.
 */
typedef struct {
	int count;		/*!< Number of buffers requested */
	__u32 req_size;
} pf_reqbufs_params;

/*!
 * Structure for Post Filter buffer request parameters.
 */
typedef struct {
	int index;
	int size;		/*!< Size of buffer allocated */
	__u32 offset;		/*!< Buffer offset in driver memory. Set by QUERYBUF */
	__u32 y_offset;		/*!< Optional starting relative offset of Y data
				   from beginning of buffer. Set to 0 to use default
				   calculated based on height and stride */
	__u32 u_offset;		/*!< Optional starting relative offset of U data
				   from beginning of buffer. Set to 0 to use default
				   calculated based on height and stride */
	__u32 v_offset;		/*!< Optional starting relative offset of V data
				   from beginning of buffer. Set to 0 to use default
				   calculated based on height and stride */
} pf_buf;

/*!
 * Structure for Post Filter start parameters.
 */
typedef struct {
	pf_buf in;		/*!< Input buffer address and offsets */
	pf_buf out;		/*!< Output buffer address and offsets */
	int qp_buf;
	int wait;
	uint32_t h264_pause_row;	/*!< Row to pause at for H.264 mode. 0 to disable pause */
} pf_start_params;

/*! @name User Client Ioctl Interface */
/*! @{ */

/*!
 * IOCTL to Initialize the Post Filter.
 */
#define PF_IOCTL_INIT           _IOW('F',0x0, pf_init_params)

/*!
 * IOCTL to Uninitialize the Post Filter.
 */
#define PF_IOCTL_UNINIT         _IO('F',0x1)

/*!
 * IOCTL to set the buffer mode and allocate buffers if driver allocated.
 */
#define PF_IOCTL_REQBUFS        _IOWR('F',0x2, pf_reqbufs_params)

/*!
 * IOCTL to set the buffer mode and allocate buffers if driver allocated.
 */
#define PF_IOCTL_QUERYBUF       _IOR('F',0x2, pf_buf)

/*!
 * IOCTL to start post filtering on a frame of data. This ioctl may block until
 * processing is done or return immediately.
 */
#define PF_IOCTL_START          _IOWR('F',0x3, pf_start_params)

/*!
 * IOCTL to resume post-filtering after an intra frame pause in H.264 mode.
 */
#define PF_IOCTL_RESUME         _IOW('F',0x4, int)

/*!
 * IOCTL to wait for post-filtering to complete.
 */
#define PF_IOCTL_WAIT           _IOW('F',0x5, int)
/*! @} */

#endif				/* __INCLUDED_MXC_PF_H__ */