sws_getContext用法实例

简介:
struct SwsContext*    sws_getContext  (int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
Returns an SwsContext to be used in  sws_scale  .

Params: 
srcW, srcH, srcFormat : source width, height, and pix format
dstW, dstH, dstFormat : destination width, height, and pix format
flags : Method of scaling to use. Choices are SWS_FAST_BILINEAR, SWS_BILINEAR, SWS_BICUBIC, SWS_X, SWS_POINT, SWS_AREA, SWS_BICUBLIN, SWS_GAUSS, SWS_SINC, SWS_LANCZOS, SWS_SPLINE. Other flags include CPU capability flags: SWS_CPU_CAPS_MMX, SWS_CPU_CAPS_MMX2, SWS_CPU_CAPS_3DNOW, SWS_CPU_CAPS_ALTIVEC. Other flags include (currently not completely implemented) SWS_FULL_CHR_H_INT, SWS_FULL_CHR_H_INP, and SWS_DIRECT_BGR. Finally we have SWS_ACCURATE_RND and perhaps the most useful for beginners, SWS_PRINT_INFO. I have no idea what most of these do. Maybe email me?
srcFilter, dstFilter : SwsFilter for source and destination. SwsFilter involves chroma/luminsence filtering. A value of NULL sets these to the default.
param : should be a pointer to an int[2] buffer with coefficients. Not documented. Looks like it's used to alter the default scaling algorithms slightly. A value of NULL sets this to the default. Experts only!



使用方法如下:
#define W 96
#define H 96
struct SwsContext *sws;
sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUV420P, 2, NULL, NULL, NULL);

用途:
sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);
目录
相关文章
|
3月前
|
图形学
小功能⭐️Unity中Texture2D、Sprite、Texture、RenderTexture、image、byte的转换
小功能⭐️Unity中Texture2D、Sprite、Texture、RenderTexture、image、byte的转换
|
3月前
|
算法 API 图形学
【Qt 学习笔记】QWidget的geometry属性及window frame的影响
【Qt 学习笔记】QWidget的geometry属性及window frame的影响
172 2
|
6月前
|
前端开发 算法 计算机视觉
用canvas消除锯齿的方式
用canvas消除锯齿的方式
246 0
swr_convert和sws_scale转换时会拷贝哪些值
swr_convert和sws_scale转换时会拷贝哪些值
132 0
|
存储 编解码 缓存
sws_getContext和sws_scale分析
sws_getContext和sws_scale分析
185 0
sws_getContext和sws_scale分析
|
程序员 iOS开发
frame 和 bounds的区别
frame 和 bounds的区别
137 0
frame 和 bounds的区别