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.
The libshcodecs source archive contains:
- src/libshcodecs: the libshcodecs shared library
- src/examples: various examples of simple uses of libshcodecs
- src/tools: commandline tools
The source archive is available via git at github.com/pedwo/libshcodecs:
git clone git://github.com/pedwo/libshcodecs.git
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.
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:
Attach file: libshcodecs-1.6.0.tar.gz 148DL [Info] libshcodecs-1.4.0.tar.gz 135DL [Info] libshcodecs-1.3.1.tar.gz 93DL [Info] libshcodecs-1.3.0.tar.gz 93DL [Info] libshcodecs-1.2.0.tar.gz 106DL [Info] libshcodecs-1.1.1.tar.gz 189DL [Info] libshcodecs-1.1.0.tar.gz 97DL [Info] libshcodecs-0.9.9.tar.gz 104DL [Info]