Overview anchor.png

libshcodecs is a library for controlling the SH-Mobile hardware video processing unit (VPU). It uses proprietary VPU Middleware shared libraries - please contact your local Renesas distributor for further information. The VPU supports MPEG-4 and H.264 encoding and decoding.

This library has been primarily developed and tested on the SH-MobileR2R (SH7724) device using the MS7724 development board.

Page Top
Download anchor.png

The libshcodecs source archive contains:

  • src/libshcodecs: the libshcodecs shared library
  • src/examples: various examples of simple uses of libshcodecs
  • src/tools: commandline tools
Page Top
Source anchor.png

The source archive is available via git at

git clone git://
Page Top
libshcodecs anchor.png

libshcodecs provides callback-based interfaces for encoding and decoding video streams.

To decode video data, an application provides a callback with the following prototype:

   int vpu4_decoded (SHCodecs_Decoder * decoder,
                     unsigned char * y_buf, int y_size,
                     unsigned char * c_buf, int c_size,
                     void * user_data);

and then supplies encoded video data to the function:

   shcodecs_decode (decoder, input_buffer, length);

The decoder will process the input buffer, and call the provided callback function each time a frame is decoded. The output is given in two bitplanes of YUV 4:2:0.

For a full decoder example, see src/tools/shcodecs-dec.c

To encode video data, an application provides both input and output callback functions:

   /* SHCodecs_Encoder_Input callback for acquiring an image */
   int get_input(SHCodecs_Encoder * encoder, void *user_data);
   /* SHCodecs_Encoder_Output callback for writing encoded data */
   int write_output(SHCodecs_Encoder * encoder,
                    unsigned char *data, int length, void *user_data);

and then run the encoder by:


The encoder will retrieve raw video as needed using the input callback, and will use the output callback you have provided whenever encoded video data is available.

For examples of encoding from file and camera, see src/tools/shcodecs-enc.c and src/tools/shcodecs-capenc.c.

Page Top
Kernel configuration anchor.png

libshveu uses the Linux kernel UIO support for the SH-Mobile VPU, which was added in 2.6.27.

The following kernel boot option reserves physically contiguous memory for VPU use:

Page Top
License anchor.png

This library is licensed under LGPL, see the file COPYING for details.

RSS of recent changes (RSS 2.0)
© 2013 Renesas Electronics Corporation. All rights reserved. [Privacy]