假设我在内存中有一个NV12帧作为字节数组。我知道:
现在这就是我到目前为止:
SwsContext* context = sws_getContext(frameWidth, frameHeight, AV_PIX_FMT_NV12, frameWidth, frameHeight, AV_PIX_FMT_RGB32, 0, nullptr, nullptr, nullptr);
sws_scale(context,
所以我不知道sws_scale应该是什么参数:
任何帮助表示感谢。
答案 0 :(得分:3)
/// uint8_t * Y;
/// uint8_t * out;
// 2 planes for NV12: Y and interleaved UV
uint8_t * data[2] = {Y, Y + Stride * Height};
// Strides for Y and UV
// U and V have Stride/2 bytes per line;
// Thus, we have 2 * Stride/2 bytes per line in UV plane
int linesize[2] = {Stride, Stride};
uint8_t * outData[1] = {out}; // RGB have one plane
int outLinesize[1] = {frameWidth*4}; // RGB32 Stride
sws_scale(context, data, linesize, 0, Height, outData, outLinesize);