WP 01133 Ip Camera
WP 01133 Ip Camera
Introduction
In the video surveillance marketplace, the need for higher quality video, higher
resolution, and more flexibility and features is driving the change from analog to
digital cameras. By definition, high-definition (HD) video must be digital, so the
adoption of HD standards is symbiotic with the move to digital sensors. The higher
frame rates and resolution supported by HD video standards require newer
compression techniques, such as H.264, which in turn require greater processing
power in the camera.
The need to extract maximum image content in a wide range of lighting conditions
(high and low light, high contrast) has led to digital cameras adopting a new class of
WDR sensors, which require dynamic range compression within the camera, again in
the digital domain. A further benefit of the digital data path in the camera is the
possibility of performing “analytics” processing within the camera.
Avalon-MM Control/Status
Copyright © 2010 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera
logo, and specific device designations are trademarks and/or service marks of Altera Corporation in the U.S. and other
countries. All other words and logos identified as trademarks and/or service marks are the property of Altera Corporation or
their respective owners. Altera products are protected under numerous U.S. and foreign patents and pending applications,
101 Innovation Drive maskwork rights, and copyrights. Altera warrants performance of its semiconductor products to current specifications in
accordance with Altera's standard warranty, but reserves the right to make changes to any products and services at any time
San Jose, CA 95134 without notice. Altera assumes no responsibility or liability arising out of the application or use of any information, product, or
service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest
www.altera.com version of device specifications before relying on any published information and before placing orders for products or services.
Feedback Subscribe
Page 2 IP Surveillance Camera Reference Design
Figure 2 shows the hardware platform for the reference design, based around the
Cyclone III EP3C120 development board. Pixel data from Aptina’s WDR sensor is fed
into the Image Sensor Pipeline (ISP) from Apical. The output data is YUV4:2:0 format
and written to a frame buffer in the external DDR2 SDRAM using components from
Altera’s Video and Image Processing (VIP) suite. Video data then is encoded in H.264
format using a core from EyeLytics, and supporting (in this application)
baseline/main profile level 3 for streaming via Ethernet to be viewed on a remote
host. A Scatter-Gather Direct Memory Access (SGDMA) controller supports Altera’s
Triple-Speed Ethernet (TSE) MegaCore® function for streaming the encoded video to a
remote client over Ethernet.
Figure 2. IP Surveillance Camera Reference Design Hardware
Building an IP Surveillance Camera System with a Low-Cost FPGA June 2010 Altera Corporation
IP Surveillance Camera Reference Design Page 3
'
()
WDR Correction !"
Correction
RGB
#$
'%
Bayer Data 8 bit
WDR %
Bayer *"*
Bayer &
"
10-bit +'
Up to +,7$
150 MPix/sec
Hardware Pipeline
Compared to the unprocessed image in Figure 4 (top), the image in Figure 4 (bottom)
shows how the Iridix core allows the maximum detail to be extracted from a high-
contrast scene. In particular, the dark areas are revealed without corresponding
overexposure in the bright areas.
Figure 4. Effect of Apical’s ISP on High-Contrast Scenes
June 2010 Altera Corporation Building an IP Surveillance Camera System with a Low-Cost FPGA
Page 4 IP Surveillance Camera Reference Design
The output of the ISP is available as an option from the reference design through a
Bitec DVI output board connected to the second HSMC connector on the Cyclone
EP3C120 development board (shown on the left of the hardware shown in Figure 2).
YUV YUV Y
Clocked Color Color
RGB RGB 4:2:2 Chroma 4:2:0
Video Space Plane
From ISP Resampler C
Input Converter Seperator
To Frame
Buffer
The sensor frame rate of 720p60 is converted to 720p30 before H.264 encoding by
skipping alternate frames of video, in the frame buffer writer, by not writing them to
the frame buffer.
Video Compression
The H.264 Encoder (Figure 6) used in this design is an IP core available from
EyeLytics that has been optimized for surveillance applications. This core contains
many surveillance features, including multichannel support, constant quality rate
control, intra-/intermodes, QPEL, context-adaptive binary arithmetic coding
(CABAC)/context-adaptive variable-length coding (CAVLC), and a low gate count.
The core supports both main and baseline profiles.
Building an IP Surveillance Camera System with a Low-Cost FPGA June 2010 Altera Corporation
Tool Flow Page 5
H.264
Motion Encoder
Compensation
MB Info Compressed
Intra CABAC Video to
Collector
Prediction Frame Buffer
1 A number of standard Avalon components, such as clock crossing bridges, timers and
parallel I/Os, are used to complete the system. For the sake of simplification, these are
not shown in Figure 6.
Tool Flow
The IP Surveillance Camera Reference Design is implemented as a complete system
on a chip (SOC) using Altera’s SOPC Builder tool. Using SOPC Builder, the designer
specifies the system components in a GUI, and SOPC Builder generates the
interconnect logic automatically. SOPC Builder generates HDL files that define all
components of the system, and a top-level HDL file then connects all the components
together. The IP Surveillance Camera Reference Design is generated in Verilog HDL,
but SOPC Builder can generate both Verilog HDL or VHDL.
June 2010 Altera Corporation Building an IP Surveillance Camera System with a Low-Cost FPGA
Page 6 Software Applications
The ISP and the H.264 encoder are available as SOPC Builder components with
Avalon-MM interfaces, allowing them to be easily integrated into a system with
standard peripherals available from Altera, as well as third-party IP and the
designer’s own components.
SOPC Builder is included in Altera’s Quartus® II development software, which
provides a complete, multiplatform design environment that easily adapts to specific
design needs. Quartus II software includes solutions for all phases of FPGA and
CPLD design:
■ Design entry
■ Synthesis
■ Place and route
■ Timing analysis
■ Simulation
■ Programming and configuration
Software development is performed using Altera’s Nios® II Embedded Design Suite.
A board support package (BSP) is generated including all the necessary device
drivers, based on the components that were included in the SOPC Builder design.
Software Applications
A Nios II embedded processor is used for programming the various registers within
the different modules as well as for running the RTP stack to stream the compressed
video. Working with the Ethernet MAC module to control the ISP, the embedded
processor runs the uC/OS-II real time kernel from Micrium, NicheStack and RTP
stack from InterNiche Technologies, and a video-streaming application and a web-
server application from Altera’s reference deisgn . The processor also handles auto
exposure and auto white balance control of the ISP.
The video-streaming application responds to interrupts from the H.264 encoder and
reloads various buffer pointers. Reloading allows it to prepare for the next video
frame to be encoded and for the just encoded frame to be passed to the RTP stack for
onward transmission via Ethernet.
The web-server application allows simple control of the ISP to switch the sensor
between normal and WDR mode and to enable and disable Iridix. This control allows
the benefits of the ISP to be shown in real time. The web-server application also allows
configuration of the encoder, including bitrate, quality, and selecting between CABAC
and CAVLC.
Host Software
A host PC running VLC media player (or similar) is used to view the streamed video
output of the IP Surveillance Camera Reference Design. As shown in Figure 7, the
only required connection between the host and the EP3C120 development kit is an
Ethernet cable.
Building an IP Surveillance Camera System with a Low-Cost FPGA June 2010 Altera Corporation
Performance Page 7
Ethernet
Performance
Performance metrics of the IP Surveillance Camera Reference Design comprise speed,
latency, power consumption, and resource utilization numbers.
Speed
When implemented on a Cyclone III EP3C120I7 development board, the reference
design runs with a DDR clock frequency of 150 MHz, sufficient to compress frames of
720p30 video using a H.264 baseline or main profile. The Avalon-MM bus fabric runs
at 75 MHz, and the H.264 encoder core runs at 150 MHz. The DDR2 memory
controller, Avalon-MM bus fabric, and H.264 core are connected through synchronous
half rate bridges to minimize latency between the clock domains.
The Nios II processor and TSE are clocked at 125 MHz. The Nios II processor is
implemented as the Nios II/F (fast) version with an 8-Kbyte instruction cache,
8-Kbyte data cache, and floating point support.
Latency
The latency from the sensor input to the ISP to the output of the H.264 encoder is less
than two frames, and comes about from the double buffering of the image data. A
new input frame is always being written to memory while the previous frame is being
encoded.
Power Consumption
The total power consumption of the reference design including all of the ancilliary
blocks and I/O is 2.7 W. Table 1 shows the power consumption for each of the major
blocks used in the reference design. The remaining 700mW are consumed by the
Avalon bus fabric, color space conversion, and I/Os ancillary to the reference design.
Table 1. Power Consumption in Blocks
Block Power Consumption (mW)
H.264 944
ISP 578
DDR2 311
Nios II CPU 88
TSE MAC 83
June 2010 Altera Corporation Building an IP Surveillance Camera System with a Low-Cost FPGA
Page 8 Flexibility
Resource Utilization
When implemented in a Cyclone EP3C120, the resource utilization for the complete
reference design is:
■ 107K logic elements (LEs) (90% device utilization)
■ 410 M9K embedded memories (95% device utilization)
■ 140 embedded multiplier 9-bit elements (24% device utilization)
Table 2 lists specific block resource utilizations.
Table 2. Specific Resource Utilization
Block LE Usage M9K Usage
Apical ISP 41K 127
EyeLytics H.264 core 35K 225
Remaining system (e.g., Nios II core, DDR2 Controller, TSE, etc.) 31K 58
Flexibility
An FPGA-based architecture is completely flexible and customizable, while at the
same time offering the peace of mind that comes from using a standard, well-
understood silicon platform. This flexibility allows the system architecture to be
enhanced and modified to suit different system requirements. Increasing camera
resolution or adding custom video processing or a video analytics engine is easy
because the design is implemented with standard HDL. Furthermore, it is possible to
deploy upgrades remotely over the Ethernet. For example, a new FPGA
programming file can be sent to the Nios II embedded processor, which then writes
the file to flash memory, thus reconfiguring the system or changing the sensor or ISP
settings.
Integrating the complete IP Surveillance Camera Reference Design onto a single
FPGA results in a reduction of chip count and saving of PCB real estate. The reduction
in I/O connections by not requiring communication with external devices reduces
dynamic power consumption, thus easing any thermal management issues. Multiple
camera personalities can be supported with a single system design, using different
FPGA images for each personality (e.g., resolution, frame rate, compression options).
Vertical migration allows devices of different logic density to be used within the same
package footprint.
Building an IP Surveillance Camera System with a Low-Cost FPGA June 2010 Altera Corporation
Conclusion Page 9
Since the design can be targeted to any Altera FPGA, adopting an open design allows
the designer to target the newest FPGA, thus receiving the higher performance and
lower cost/power ratios as newer FPGA families are introduced.
Conclusion
The challenges facing the designers of state- of-the-art IP surveillance systems are
addressed by Altera with its Cyclone III and Cyclone IV family of low-cost FPGAs.
With the IP Surveillance Camera Reference Design, Altera and its partners provide a
complete solution, from image capture to IP encapsulation, using a range of
MegaCore functions integrated with Altera’s SOPC Builder tool to provide a scalable
solution and rapid time to market.
Further Information
■ Video Surveillance:
www.altera.com/surveillance
■ Video: “Easily Support WDR CMOS Image Sensor Processing with Low-Cost
FPGAs”:
www.altera.com/education/webcasts/videos/videos-image-processing-fpgas.html
■ Request a demonstration or evaluation of the IP Surveillance Camera Reference
Design:
mailto:[email protected]
■ Video and Image Processing (VIP) Suite MegaCore Functions:
www.altera.com/products/ip/dsp/image_video_processing/m-alt-vipsuite.html
■ Triple Speed Ethernet (TSE) IP Core Resource Center:
www.altera.com/support/ip/interface-protocols/ips-inp-tse.html
■ DDR and DDR2 SDRAM High-Performance II Controller MegaCore Functions:
www.altera.com/products/ip/iup/memory/m-alt-hpddr2.html
■ Nios II Embedded Design Suite:
www.altera.com/support/ip/processors/nios2/tools/ni2-development_tools.html
■ EyeLytics Inc:
www.eyelytics.com
■ Apical Limited
www.apical-imaging.com
■ Aptina Imaging:
www.aptina.com
■ Bitec:
www.bitec.ltd.uk
■ Micrium:
www.micrium.com
■ InterNiche Technologies:
www.iniche.com
■ VLC Media Player:
www.videolan.org/vlc
June 2010 Altera Corporation Building an IP Surveillance Camera System with a Low-Cost FPGA
Page 10 Acknowledgements
Acknowledgements
■ Andrew Crosland, Member of Technical Staff, Embedded System Solutions Group,
Altera Corporation
■ Judd Heape, Sr. Strategic Marketing Manager, Industrial and Automotive Business
Unit, Altera Corporation
■ Mankit Lo, CEO/CTO, EyeLytics Inc.
■ Slava Chesnokov, CTO, Apical Limited
Building an IP Surveillance Camera System with a Low-Cost FPGA June 2010 Altera Corporation