1 /* linux/drivers/media/video/s5p-jpeg/jpeg-core.h
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
16 #include <media/v4l2-device.h>
18 #define S5P_JPEG_M2M_NAME "s5p-jpeg"
20 /* JPEG compression quality setting */
21 #define S5P_JPEG_COMPR_QUAL_BEST 0
22 #define S5P_JPEG_COMPR_QUAL_WORST 3
24 /* JPEG RGB to YCbCr conversion matrix coefficients */
25 #define S5P_JPEG_COEF11 0x4d
26 #define S5P_JPEG_COEF12 0x97
27 #define S5P_JPEG_COEF13 0x1e
28 #define S5P_JPEG_COEF21 0x2c
29 #define S5P_JPEG_COEF22 0x57
30 #define S5P_JPEG_COEF23 0x83
31 #define S5P_JPEG_COEF31 0x83
32 #define S5P_JPEG_COEF32 0x6e
33 #define S5P_JPEG_COEF33 0x13
35 /* a selection of JPEG markers */
43 /* Flags that indicate a format can be used for capture/output */
44 #define MEM2MEM_CAPTURE (1 << 0)
45 #define MEM2MEM_OUTPUT (1 << 1)
48 * struct s5p_jpeg - JPEG IP abstraction
49 * @lock: the mutex protecting this structure
50 * @v4l2_dev: v4l2 device for mem2mem mode
51 * @vfd_encoder: video device node for encoder mem2mem mode
52 * @vfd_decoder: video device node for decoder mem2mem mode
53 * @m2m_dev: v4l2 mem2mem device data
54 * @ioarea: JPEG IP memory region
55 * @regs: JPEG IP registers mapping
58 * @dev: JPEG IP struct device
59 * @alloc_ctx: videobuf2 memory allocator's context
64 struct v4l2_device v4l2_dev
;
65 struct video_device
*vfd_encoder
;
66 struct video_device
*vfd_decoder
;
67 struct v4l2_m2m_dev
*m2m_dev
;
69 struct resource
*ioarea
;
78 * struct jpeg_fmt - driver's internal color format data
79 * @name: format descritpion
80 * @fourcc: the fourcc code, 0 if not applicable
81 * @depth: number of bits per pixel
82 * @colplanes: number of color planes (1 for packed formats)
83 * @h_align: horizontal alignment order (align to 2^h_align)
84 * @v_align: vertical alignment order (align to 2^v_align)
85 * @types: types of queue this format is applicable to
98 * s5p_jpeg_q_data - parameters of one queue
99 * @fmt: driver-specific format of this queue
102 * @size: image buffer size in bytes
104 struct s5p_jpeg_q_data
{
105 struct s5p_jpeg_fmt
*fmt
;
112 * s5p_jpeg_ctx - the device context data
113 * @jpeg: JPEG IP device for this context
114 * @mode: compression (encode) operation or decompression (decode)
115 * @compr_quality: destination image quality in compression (encode) mode
116 * @m2m_ctx: mem2mem device context
117 * @out_q: source (output) queue information
118 * @cap_fmt: destination (capture) queue queue information
119 * @hdr_parsed: set if header has been parsed during decompression
121 struct s5p_jpeg_ctx
{
122 struct s5p_jpeg
*jpeg
;
124 unsigned int compr_quality
;
125 struct v4l2_m2m_ctx
*m2m_ctx
;
126 struct s5p_jpeg_q_data out_q
;
127 struct s5p_jpeg_q_data cap_q
;
132 * s5p_jpeg_buffer - description of memory containing input JPEG data
134 * @curr: current position in the buffer
135 * @data: pointer to the data
137 struct s5p_jpeg_buffer
{
143 #endif /* JPEG_CORE_H */