【版权申明】未经博主同意,谢绝转载!(请尊重原创,博主保留追究权)
ffmpeg-struct SwsContext使用心得
1. struct SwsContext的简介
定义路径: ffmpeg/libswscale/swscale_internal.h
struct SwsContext结构体位于libswscale类库中, 该类库主要用于处理图片像素数据, 可以完成图片像素格式的转换, 图片的拉伸等工作.
2. struct SwsContext的使用
2.1 struct SwsContext初始化: sws_getContext()
/**
* Allocate and return an SwsContext. You need it to perform scaling/conversion operations using sws_scale().
*
* @param srcW the width of the source image
* @param srcH the height of the source image
* @param srcFormat the source image format
* @param dstW the width of the destination image
* @param dstH the height of the destination image
* @param dstFormat the destination image format
* @param flags specify which algorithm and options to use for rescaling
* @param param extra parameters to tune the used scaler
* For SWS_BICUBIC param[0] and [1] tune the shape of the basis
* function, param[0] tunes f(1) and param[1] f´(1)
* For SWS_GAUSS param[0] tunes the exponent and thus cutoff
* frequency
* For SWS_LANCZOS param[0] tunes the width of the window function
* @return a pointer to an allocated context, or NULL in case of error
* @note this function is to be removed after a saner alternative is
* written
*/
struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
int dstW, int dstH, enum AVPixelFormat dstFormat,

本文详细介绍了FFmpeg库中SwsContext结构体的使用方法,包括初始化、使用及释放过程。SwsContext用于处理图片像素数据,实现像素格式转换和图片拉伸等功能。文章提供了sws_getContext、sws_scale和sws_freeContext函数的参数说明及示例代码。
最低0.47元/天 解锁文章
4203

被折叠的 条评论
为什么被折叠?



