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>
17 #include <media/v4l2-fh.h>
18 #include <media/v4l2-ctrls.h>
20 #define S5P_JPEG_M2M_NAME "s5p-jpeg"
22 /* JPEG compression quality setting */
23 #define S5P_JPEG_COMPR_QUAL_BEST 0
24 #define S5P_JPEG_COMPR_QUAL_WORST 3
26 /* JPEG RGB to YCbCr conversion matrix coefficients */
27 #define S5P_JPEG_COEF11 0x4d
28 #define S5P_JPEG_COEF12 0x97
29 #define S5P_JPEG_COEF13 0x1e
30 #define S5P_JPEG_COEF21 0x2c
31 #define S5P_JPEG_COEF22 0x57
32 #define S5P_JPEG_COEF23 0x83
33 #define S5P_JPEG_COEF31 0x83
34 #define S5P_JPEG_COEF32 0x6e
35 #define S5P_JPEG_COEF33 0x13
37 /* a selection of JPEG markers */
45 /* Flags that indicate a format can be used for capture/output */
46 #define MEM2MEM_CAPTURE (1 << 0)
47 #define MEM2MEM_OUTPUT (1 << 1)
50 * struct s5p_jpeg - JPEG IP abstraction
51 * @lock: the mutex protecting this structure
52 * @slock: spinlock protecting the device contexts
53 * @v4l2_dev: v4l2 device for mem2mem mode
54 * @vfd_encoder: video device node for encoder mem2mem mode
55 * @vfd_decoder: video device node for decoder mem2mem mode
56 * @m2m_dev: v4l2 mem2mem device data
57 * @ioarea: JPEG IP memory region
58 * @regs: JPEG IP registers mapping
61 * @dev: JPEG IP struct device
62 * @alloc_ctx: videobuf2 memory allocator's context
66 struct spinlock slock;
68 struct v4l2_device v4l2_dev;
69 struct video_device *vfd_encoder;
70 struct video_device *vfd_decoder;
71 struct v4l2_m2m_dev *m2m_dev;
73 struct resource *ioarea;
82 * struct jpeg_fmt - driver's internal color format data
83 * @name: format descritpion
84 * @fourcc: the fourcc code, 0 if not applicable
85 * @depth: number of bits per pixel
86 * @colplanes: number of color planes (1 for packed formats)
87 * @h_align: horizontal alignment order (align to 2^h_align)
88 * @v_align: vertical alignment order (align to 2^v_align)
89 * @types: types of queue this format is applicable to
102 * s5p_jpeg_q_data - parameters of one queue
103 * @fmt: driver-specific format of this queue
106 * @size: image buffer size in bytes
108 struct s5p_jpeg_q_data {
109 struct s5p_jpeg_fmt *fmt;
116 * s5p_jpeg_ctx - the device context data
117 * @jpeg: JPEG IP device for this context
118 * @mode: compression (encode) operation or decompression (decode)
119 * @compr_quality: destination image quality in compression (encode) mode
120 * @m2m_ctx: mem2mem device context
121 * @out_q: source (output) queue information
122 * @cap_fmt: destination (capture) queue queue information
123 * @hdr_parsed: set if header has been parsed during decompression
124 * @ctrl_handler: controls handler
126 struct s5p_jpeg_ctx {
127 struct s5p_jpeg *jpeg;
129 unsigned short compr_quality;
130 unsigned short restart_interval;
131 unsigned short subsampling;
132 struct v4l2_m2m_ctx *m2m_ctx;
133 struct s5p_jpeg_q_data out_q;
134 struct s5p_jpeg_q_data cap_q;
137 struct v4l2_ctrl_handler ctrl_handler;
141 * s5p_jpeg_buffer - description of memory containing input JPEG data
143 * @curr: current position in the buffer
144 * @data: pointer to the data
146 struct s5p_jpeg_buffer {
152 #endif /* JPEG_CORE_H */