int video_decoder::swscale(const char* srcbuf, int ntype, int nsrcwidth, int nsrcheight, int ndstwidth, int ndstheight, unsigned char* dstbuf)
{
if (5 != ntype && 3 != ntype)
{
return -1;
}
if (!srcbuf || !dstbuf)
return -1;
AVPixelFormat srcpixfmt = AV_PIX_FMT_YUV420P;
AVPixelFormat dstpixfmt = AV_PIX_FMT_BGR32;
uint8_t* src_y = 0;
uint8_t* src_u = 0;
uint8_t* src_v = 0;
if (3 == ntype)
{
src_y = (uint8_t*)srcbuf;
src_v = (uint8_t*)srcbuf + nsrcwidth * nsrcheight;
src_u = (uint8_t*)srcbuf + nsrcwidth * nsrcheight + nsrcwidth * nsrcheight / 4;
}
else
{
src_y = (uint8_t*)srcbuf;
src_u = (uint8_t*)srcbuf + nsrcwidth * nsrcheight;
src_v = (uint8_t*)srcbuf + nsrcwidth * nsrcheight + nsrcwidth * nsrcheight / 4;
}
uint8_t* src[3] = {
H264解码之YUV格式转换及缩放
最新推荐文章于 2025-06-18 15:44:48 发布