In recent years, with the rapid development of digital image processing technology, multimedia technology, embedded system software and hardware technology and the popularity of broadband networks, video surveillance has gradually approached people's lives. Compared with traditional analog monitoring, IP video surveillance overcomes the limitations of analog CCTV surveillance: First, digital video can transmit image data on a computer network (LAN or WAN), basically independent of distance, and the signal is not easily interfered. Secondly, digital video can be used to improve the image quality and stability. Secondly, digital video utilizes the existing computer interconnection network, eliminating the need for rewiring, and the installation is convenient and flexible. Finally, digital storage becomes possible, and the compressed video data can be directly stored, and the query is quick and easy. .
This article refers to the address: http://
At present, most of the network camera solutions adopt the combination of CPU+DSP, the CPU completes the functions of control and communication, and the DSP mainly performs the encoding processing of audio and video signals, but such schemes generally have higher costs. The ML86500-based network camera solution designed in this paper has the advantages of high compression ratio, low bandwidth consumption, high image quality and low cost.
2 system hardware design
2.1 Overall hardware plan
The overall scheme of the network camera hardware is shown in Figure 1.
The basic principle of the network camera is: CCD sensor converts light into electric charge, and outputs CVBS analog video signal to video decoding chip (TW9910); video decoding chip converts CVBS analog video signal analog-to-digital (A/D) into YUV 4:2 : 2 format digital signal, and output to video encoding chip - ML86500; ML86500 encodes and compresses video information to generate MPEG4 data stream; MPEG4 data stream is sent to remote client (PC) via RTP protocol, remotely The client decodes the restored video information for playback.
2.2 MPEG4 real-time encoder circuit
The ML86500 is a real-time MPEG4 image compression (encoding) processing single-chip product developed by OKI. The chip utilizes OKI's original algorithm and dedicated accelerator to achieve high image quality at low cost. The design goal is to target images such as surveillance cameras and network cameras. Monitoring equipment. Therefore, the video encoding chip in this network camera solution uses ML86500.
The internal principle of the ML86500 is shown in Figure 2.
Main technical indicators of ML86500:
Video encoding method: MPEG4 SP/ASP;
Supported video modes: f/s, PAL@25 f/s, VGA, QVGA;
Data format: luminance signal 8 b, chrominance signal 8 b (4:2:2);
Support for interlaced video (NTSC/PAL);
Transform the input frame rate;
Code stream coding mode: CBR/VBR;
External SDRAM interface;
Universal 8/16-bit host CPU interface;
Supply voltage: 3.3 V ± 0.3 V (IO), 1.5 V ± 0.15 V (CORE, PLL);
Package: 144-pin plastic LQFP.
See Figure 3 for the real-time encoder circuit of the ML86500.
The inner edge of the ML86500 is powered by a 1.5 V supply, and the PLL circuit is also powered by a 1.5 V supply. Considering that the PLL circuit can interfere with the core circuit, the PLL circuit is powered by a π-type low-pass filter to eliminate high-frequency interference.
The ML86500 uses a 27 MHz active crystal as the clock. Considering the 27 MHz active crystal to prevent system power supply interference, a π-type low-pass filter is designed for the power supply of a 27 MHz active crystal.
The ML86500 requires an external 32 b data bus width SDRAM as the data cache.
3 system software design
3.1 Software overall plan
See Figure 4 for the overall software solution.
In the overall design of the software, a layered modular design is adopted, and each layer is a weak coupling relationship, so that each functional module is independent, easy to develop and maintain, and the system has good portability. The Free OS API layer is added between the RTOS operating system and the application, which reduces the workload of software migration when the operating system changes.
The TCP/IP protocol stack is a dual protocol stack. It not only supports the existing IPv4 protocol, but also supports the next generation Internet Protocol IPv6. It provides HTTP Server functionality. Users may access IP-Camera through IE for media playback, viewing and setting parameters. Provide FTP function, which is convenient for users to transfer files and upgrade programs; provide SNTP function to ensure IP-Camera time can synchronize with standard time server; provide DDNS function, enable users to access IP-Camera through dynamic domain name; provide SIP function It enables IP-Camera to communicate with SIP phones, making video surveillance more convenient and flexible; media data transmission uses RTP protocol to ensure real-time image; file system supports FAT16 and FAT32 formats.
3.2 MPEG4 encoding start and stop process
The main function of MPEG4 encoding is to initialize the video decoding chip and video encoding chip according to the set parameters, start video encoding, and create MPEG4 TASK for reading video data stream and sending data.
The main function of MPEG4 encoding stop is to stop the video decoding chip and video encoding chip and stop MPEG4 TASK. The MPEG4 encoding start and stop flowchart is shown in Figure 5.
MPEG4 TASK is mainly used to read video data streams and send data. The main flow chart is shown in Figure 6. After MPEG4 TASK is running, it will wait for the semaphore and suspend itself. When the ML86500 generates a frame of data, an interrupt is generated. In the interrupt service routine, a signal is sent to the MPEG4 TASK, the MPEG4 TASK is re-run, and the MPEG4 video stream is read, and then the data is sent to the client through the network using the RTP protocol. ).
4 Conclusion
This program has been tested in practice, can support PAL/NTSC video signal input, support D1 (N 720*480/P system 720*576), VGA (640*480), QVGA (320*240), etc. Resolution output, network transmission bandwidth supports 20 kb / s ~ 6 Mb / s, low-cost to achieve high image quality, and good image real-time, can be widely used in warehouses, shopping malls, transportation, home and other video surveillance applications, Very competitive in the market.
Shenzhen Zpal Technology Co.,Ltd , https://www.zpalvapes.com