我从网络摄像头垂直翻转帧,我需要在同一步骤调整大小时翻转它们。 有人可以给我一个例子。这是我的代码
AVFrame* inpic = av_frame_alloc();
avpicture_fill((AVPicture*)inpic,
m_CurrentFrame.bits(),
AV_PIX_FMT_RGB32,
m_CurrentFrame.width(),
m_CurrentFrame.height());
AVFrame* m_resizedFrame = av_frame_alloc();
int num_bytes = avpicture_get_size(AV_PIX_FMT_YUV420P, m_szFrameSize.width(), m_szFrameSize.height());
uint8_t *m_resizedFrame_buffer = (uint8_t *)av_malloc(num_bytes*sizeof(uint8_t));
avpicture_fill((AVPicture*)m_resizedFrame, m_resizedFrame_buffer,
AV_PIX_FMT_YUV420P, m_szFrameSize.width(), m_szFrameSize.height());
SwsContext *resize = sws_getContext(m_CurrentFrame.width(),
m_CurrentFrame.height(),
AV_PIX_FMT_RGB32,
m_szFrameSize.width(),
m_szFrameSize.height(),
AV_PIX_FMT_YUV420P,
SWS_BICUBIC, NULL, NULL, NULL);
sws_scale(resize, inpic->data, inpic->linesize, 0,
m_CurrentFrame.height(),
m_resizedFrame->data,
m_resizedFrame->linesize);
//Do work with resized frame...
感谢。