[Libav-user] sws_scale - "Warning: data is not aligned!" when using opencv::Mat

Wodzu brucedickinson at wp.pl
Fri Dec 28 13:38:59 EET 2018


> How do you allocate image_data.

image_data is a pointer that comes from opencv::Mat::data. It is from another library called opencv.
It contains grayscale bitmap information. Each byte in the array is one pixel in range 0..255.
That is why I wrote that I don't understand how does sws_scale even work, because according to sws_scale documentation, srcSlice parameter (which is image_data) should contain pointers, but it does not contain pointers, just bytes.

> how do you allocate frame?

AVFrame *frame_ = av_frame_alloc();

I've checked frame->data pointers and they are aligned properly.

> What is the stride in your example?

linesize[1] = { context->width } = 1280
frame->linesize = {1280, 640, 640, 0, 0, 0, 0, 0}

Best regards,

Wodzu



More information about the Libav-user mailing list