Case Studies
Specialization
Electronic products design / Markets / Device for Video Recording in JPEG2000

Device for Video Recording in JPEG2000

CustomerThe device prototype on the basis of Analog Devices BF533 EZ-Kit Lite (Blackfin architecture) under Linux OS (uClinux-dist)

Developer and manufacturer of midget systems for digital recording of audio and video information.

Objective

The customer set a task to develop a video recording device designed to digitize received PAL/NTSC video signal, compress it, store it and transmit audio/video data received from the source of analog audio and video signals.

General structure of the device:

Device general structure

It is necessary to provide a long time autonomous work with device control and data extraction via low-speed radio channel.

Solution

We performed research and development work (R&D) to explore characteristics of ADV202 hardware codec in video image compressing, develop software and a device prototype for video recording in JPEG2000 format on the basis of ADV202 BF-Expander debugging kit.

Concept

We chose Motion JPEG2000 as the algorithm for compressing video data, as it has the following advantages:

  • High level and quality of compression, noise immunity;
  • Wavelet technology allows changing image resolution with minimal efforts;
  • Absence of frame-to-frame connection allows selecting separate frames from video steam without any processing.

We created a working device prototype on the basis of Analog Devices BF533 EZ-Kit Lite (Blackfin architecture) under Linux OS (uClinux-dist).

The prototype allows video recording in Motion JPEG2000 format to USB Flash drive.

We developed and implemented a control protocol for video recorder with the following capabilities:

  • Setting the quality of recorded video stream (D1, QCIF, CIF);
  • Setting recording parameters (resolution, brightness, contrast, color, video standard, compression level);
  • Managing file archive (previewing the contents, downloading and uploading files, deleting files, archive cleanup);
  • Searching and selecting recorded video fragments by specified parameters from video archive;
  • Broadcasting by low-speed channel both in real-time mode and from video archive with the specified resolution, frame rate and fragment length;
  • Power control (sleep and resume).

Structurally, the prototype consists of three components:

Software

We used uClinux-dist Linux distribution as the basis of controlling software; it is supplied in source codes for further assembly oriented to embedded systems. uClinux-dist allows creating different build profiles, easily integrating new components and configuring the building of third-party components in detail.

During the project we used Free/Open Source BSP, officially recommended by Analog Devices.

During the development process we had to make the following modifications:

  • U-Boot loader was cutted down to minimize loading time;
  • usbnet stack was ported from the main branch of Linux kernel and adapted to Blackfin architecture to support D-Link DUB-E100 USB-Ethernet adapter.

To support hardware compression of JPEG2000 we developed ADV202 driver, representing v4l2 interface (Video for Linux Two), which allows user application to capture compressed JPEG2000 stream, adjust brightness, saturation and contrast parameters via ADV7183B ADC video driver. The firmware for ADV202 was downloaded via standard firmware loader, provided by Linux kernel.

We developed a program module, which saves frames received from ADV202 to a video stream. Moreover, special information is written to metadata fields of JPEG2000 frame. The received data is saved as files in AVI container.

The format of saved files allows viewing them by standard Windows XP tools (if necessary decoders are installed). To preview service information for a viewed video file we developed a special DirectShow video filter.

The video archive of the video recorder represents a USB Flash drive with FAT32 file system containing a set of AVI files. If the drive runs out of space, file with the oldest record time is deleted and new file is saved instead of it.

Video in Motion JPEG 2000 format doesn't have frame-to-frame connections, which allowed us to implement the function of retrieving from the archive frames with a user-defined sequence.

Device operating general structure

The controlling layer is implemented as single-flow server application using FSM (finite state machine) technology.

From technical solutions we should especially note network support over USB in debugging firmware variants and emulation of additional RS-232 port via SPORT which allowed significantly simplifying debugging process.

Hardware support package for BF533 doesn't have program tools for controlling work with memory. Nevertheless, we managed to cover 64% of code by local tests mainly due to the fact that vivi driver (Virtual Video Capture Board) partially emulates video device on i386.

Drawbacks

  • During R&D work we found a few problems with the standard BSP for BF533 (in particular, USB driver does not fully support wakeup/resume after suspend).
  • ADV202 video codec emits too much heat which can make the usage of end product not very comfortable when carried by an individual. We suggest using AD212 video codec, which, according to the documentation, emits 30% less heat.
  • ADV202 video codec contains a great number of implementation errors documented by the manufacturer (in particular, there are image artifacts, problems with recording non-interlaced images). We recommend switching to AD212 video codec.

Benefits

  • Compact firmware - full system takes only 1.5 Mb and together with U-Boot loader fits into 2Mb.
  • Support of advanced JPEG2000 format with wavelet technology, which allows changing image resolution with minimal processor load, making snapshots of any video fragment. It is characterized by a high level and quality of compression and noise immunity.
  • Advanced architecture of controlling software, which the most effectively utilizes platform productivity.
  • Wide application of standard FOSS (free and open software) components, such as uClinux-dist, ffmpeg and Linux kernel, allowed significantly decreasing development time.

Technologies Embedded Linux, Motion JPEG2000, Blackfin, FSM (finite state machine), v4l2
Programming languages C, bash
Development tools GCC, GNU make, cunit, uClinux-dist, ffmpeg
Project management tools DotProject, Mantis, SVN
Efforts 163 man-days
Duration 4 months

Download PDF - 95Kb