[Libav-user] sws_scale - "Warning: data is not aligned!" when using opencv::Mat
Wodzu
brucedickinson at wp.pl
Sat Dec 22 16:33:49 EET 2018
Hi guys,
I would like to kindly ask for help with warning message called from
sws_scale.
I am using this code (simplified to show the issue) to convert from
AV_PIX_FMT_GRAY8 to AV_PIX_FMT_YUV420P:
void Encoder::Encode(uint8_t *image_data)
{
av_frame_make_writable(frame);
const int linesize[1] = { context->width };
sws_scale(sws_context, &image_data, linesize, 0, context->height,
frame->data, frame->linesize);
}
I am encoding a series of images to h264, everything works fine but
sws_scale shows me the warning and I would like to get rid of it.
I understand that the issue is due to wrong alignment of one of the
parameters passed to sws_scale but after reading sources
I don't understand how it even supposed to work with parameters that I am
passing.
sws_scale expects parameter srcSlice which is "the array containing the
pointers to the planes of the source slice".
However, what I am passing is the image data itself, not pointers in the
array. So this should not even work, but it works which I don't get it.
There are no pointers in the array but bytes representing an image.
I see where the check is being made (in swscale which is called by
sws_scale) but I don't have the debug version to output all the
addresses to see which one is wrong. From what I've checked obviously wrong
is image_data[0], image_data[1], image_data[2] because there are no pointers
there.
I am confused, could anyone help?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181222/5dc6cbea/attachment.html>
More information about the Libav-user
mailing list