Professional Documents
Culture Documents
com)
Heungjun Kim(riverful.kim@samsung.com)
Samsung Electronics
AP : Application Processor
Camera interface : interface device which is syncing image data from
external camera device and gives some commands to them
Camera module : external camera device packaged with lens, sensor
and ISP on it
ISP : Image Signal Processor. Also supports lots of additional
functions
V4L2 : Video for Linux 2
Exposure control
- Aperture (Iris)
- Shutter
- ISO
Strobe support
- Various program
Lens control
- Focus
- Zoom
Exposure
Lens
Strobe
Aperture
Not supported
Shutter
ISO
Focus
Pan focus
Zoom
Digital zoom
Just LED light most of time
Exposure
Lens
Strobe
Aperture
Shutter
ISO
Focus
Zoom
ARM
Core
External
Camera
module
Peripheral2 (MMC)
Peripheral1(Display)
10
Camera interface
Command
interface
Resolution
handling
Data format
handling
(YUV/RAW/JPEG
)
Buffer
handling
I2C
RAW DATA
Camera module
Exposure
control
Lens
control
White
balance
control
Effect
control
Face
detect
Zoom
control
Strobe
control
.
.
.
11
DATA
ARM
core
Camera
Module
DATA
Camera
Interface
User
Application
M
e
m
o
r
y
COPY!
Frame buffer
OK
Cancel
12
User
Application
DATA
ARM
core
Camera
Module
DATA
Camera
Interface
M
e
m
o
r
y
D
M
A
COPY!
Save
as file
Frame buffer
Through DMA
OK
Cancel
13
Camera module
ARM
core
DATA
JPEG
PROCESS
MEMORY
DATA
RAW
DATA
PROCESS
DATA
Camera
Interface
User
Application
M
e
m
o
r
y
COPY!
Save as
JPEG file
14
DATA
ARM
core
Camera
Module
DATA
Camera
Interface
M
e
m
o
r
y
COPY!
RAW
DATA
Codec S/W
Save as
JPEG file
15
COPY!
DATA
ARM
core
Camera
Module
DATA
Camera
Interface
M
e
m
o
r
y
Frame buffer
User
Application
OK
Codec
S/W
Cancel
Save
as
COPY!
16
In Kernel
V4L2 (AKA Video For Linux 2)
- The second version of the Video For Linux API
- Kernel interface for analog radio and video capture and output drivers
In user space
Multimedia middleware
Gstreamer
- Pipelinebasedmultimedia frameworkwritten in theC programming languagewith
the type system based onGObject
OpenMAX
- Cross-platform set ofC-language programming interfaces that provides abstractions
for routines especially useful for audio, video, and still images
17
No way
18
19
V4L2
videobuf
videobufcore
V4l2dev
videobufsg-dma
V4l2ioctl
videodev
V4l2-device
V4l2-intdevice
(old)
V4l2subdev
(new)
Camera interface
V4L2 driver
Command
interface
Resolution
handling
Buffer
handling
Camera module
V4L2 driver
Exposure
control
Lens
control
White
balance
control
Effect
control
Face
detect
Zoom
control
Strobe
control
.
.
.
20
Application or
Middleware
Open device
VIDIOC_QUERYCAP
VIDIOC_S_INPUT
VIDIOC_QBUF
VIDIOC_REQBUF
VIDIOC_DQBUF
VIDIOC_QBUF
VIDIOC_QUERYBUF
VIDIOC_STREAMON
21
22
23
24
v4l2_exposure_auto_type {
V4L2_EXPOSURE_AUTO = 0,
V4L2_EXPOSURE_MANUAL = 1,
V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
V4L2_EXPOSURE_APERTURE_PRIORITY = 3,
+
/* Additional features for digital camera */
+
V4L2_EXPOSURE_ISO_PRIORITY =4,
};
#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
#define V4L2_CID_EXPOSURE_AUTO_PRIORITY
(V4L2_CID_CAMERA_CLASS_BASE+3)
. . .
+#define V4L2_CID_EXPOSURE_LOCK (V4L2_CID_CAMERA_CLASS_BASE+18)
25
+#define V4L2_CID_CAM_APERTURE(V4L2_CID_CAMERA_CLASS_BASE+19)
+#define V4L2_CID_CAM_SHUTTER (V4L2_CID_CAMERA_CLASS_BASE+20)
+#define V4L2_CID_CAM_ISO
(V4L2_CID_CAMERA_CLASS_BASE+21)
Supported aperture stages, shutter speed, and ISO speed could be different
between every different camera module products
staticconstchar*camera_iris_stages[]={
/*This modulesupports5Irisstages
*onit'sown butFnumberdepends
* howyoupackage Lensmodule
*/
"2.8, "4,"5.6, "8, "11,NULL
};
26
27
28
AF Macro
AF-S / AF-C
For compatibility
Focus control API should be defined
29
=
=
=
=
0,
1,
2,
3,
30
31
Object detection
Gee!
It recognized my face!
Hello everyone
32
What do we set?
- Detect mode
- Type of object
- How many objects to detect
- Triggered action
What do we get?
- How many objects are detected
- Detected objects type
- Detected objects coordinates
33
+#define V4L2_CAP_OBJ_RECOGNITION
0x10000000
- New IOCTL
+#define VIDIOC_S_RECOGNITION _IOWR ('V', 85, struct v4l2_detect)
+#define VIDIOC_G_RECOGNITION _IOR ('V', 86, struct v4l2_detect)
34
35
What do we set?
- Detect mode
- How many objects to detect
- Triggered action
What do we get?
- How many objects are detected
- Detected objects coordinates
37
+#define V4L2_CAP_OBJ_RECOGNITION
0x10000000
- New IOCTL
+#define VIDIOC_S_RECOGNITION _IOWR ('V', 85, struct v4l2_detect)
+#define VIDIOC_G_RECOGNITION _IOR ('V', 86, struct v4l2_detect)
38
40
41
Mega
camera
VGA
camera
Data
path
42
Working MCLK
Working resolution
(SYNC)
Working PCLK
43
VIDIOC_S_INPUT
44
45
Condition 2
Shared things
Camera power enable pin
Camera data pins
MCLK
Mega camera
VGA camera
Mega
Enable
VGA
Enable
Mega
Reset
VGA
Reset
CAM
POWER
MCLK
DATA PINS
CPU
Condition 3
Dedicated things
Camera enable pins
Camera reset pins
46
Cam
power off
STREAMON
Camera (A)
initialize
Start
preview
Camera (A)
enable pin off
Cam
power on
Switch to camera
STREAMOFF
(B)
Stop
preview
G_INPUT/
S_INPUT
Camera (B)
initialize
Start
preview
Camera interface
reset & setting
Stop preview
Stop DMA
Reset camera
interfaces current
setting
Make a proper
MCLK for
camera (B)
Setup resolution,
color-space, DMA
47
48
49
OR
Use a level shifter to block and ignore noise from camera module
OR
Change functionality of I2C pins while turning on camera module
50
All
-
51
52
- If the ISP driver use the kernel thread when it check response from
current lens status could make smooth preview on the LCD while
lens is on focusing.
53
55
56
Q&A
57
Thank you
58