您的位置:首页 > 其它

WebRTC源码分析3_jpeg编解码

2013-09-06 12:12 344 查看
所属模块: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

[cpp] view
plaincopy

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;

};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: