所属模块:webrtc_jpeg
1、接口路径:webrtc\trunk\src\common_video\jpeg\main\interface\jpeg.h
2、特点
底层调用三方库:jpeglib
支持的未压缩图像格式:I420
3、使用方法:
将jpeglib封装成 JpegDecoder和JpegEncoder 两个类使用
JpegEncoder目前只支持输出到文件(SetFileName(const WebRtc_Word8* fileName))
4、该模块接口支持的功能有限,可根据需求重新封装jpeglib
- class JpegEncoder
- {
- public:
- JpegEncoder();
- ~JpegEncoder();
- // SetFileName
- // Input:
- // - fileName - Pointer to input vector (should be less than 256) to which the
- // compressed file will be written to
- // Output:
- // - 0 : OK
- // - (-1) : Error
- WebRtc_Word32 SetFileName(const WebRtc_Word8* fileName);
- // Encode an I420 image. The encoded image is saved to a file
- //
- // Input:
- // - inputImage : Image to be encoded
- //
- // Output:
- // - 0 : OK
- // - (-1) : Error
- WebRtc_Word32 Encode(const RawImage& inputImage);
- private:
- jpeg_compress_struct* _cinfo;
- WebRtc_Word8 _fileName[256];
- };
- class JpegDecoder
- {
- public:
- JpegDecoder();
- ~JpegDecoder();
- // Decodes a JPEG-stream
- // Supports 1 image component. 3 interleaved image components,
- // YCbCr sub-sampling 4:4:4, 4:2:2, 4:2:0.
- //
- // Input:
- // - inputImage : encoded image to be decoded.
- // - outputImage : RawImage to store decoded output
- //
- // Output:
- // - 0 : OK
- // - (-1) : Error
- WebRtc_Word32 Decode(const EncodedImage& inputImage,
- RawImage& outputImage);
- private:
- jpeg_decompress_struct* _cinfo;
- };