<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.Stylwiadomocie-mail17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=PL link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi guys,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>I would like to kindly ask for help with warning message called from sws_scale.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I am using this code (simplified to show the issue) to convert from </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#A000A0'>AV_PIX_FMT_GRAY8 </span><span lang=EN-US>to </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#A000A0'>AV_PIX_FMT_YUV420P:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#A000A0'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue'>void</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue'>Encoder</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>::</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#880000'>Encode</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>(</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue'>uint8_t</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> *</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>image_data</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#880000'>av_frame_make_writable</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>(</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>frame</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue'>const</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue'>int</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>linesize</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>[1] = { </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>context</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>-></span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>width</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> };<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#880000'>sws_scale</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>(</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>sws_context</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>, &</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>image_data</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>, </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>linesize</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>, 0, </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>context</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>-></span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>height</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>, </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>frame</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>-></span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>data</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>, </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>frame</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>-></span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:navy'>linesize</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'>);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'> </span><span style='font-size:9.5pt;font-family:Consolas;color:black'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'>I understand that the issue is due to wrong alignment of one of the parameters passed to sws_scale but after reading sources<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'>I don’t understand how it even supposed to work with parameters that I am passing.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='color:black'>sws_scale expects parameter srcSlice which is “the array containing the pointers to the planes of the source slice”. <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='color:black'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='color:black'>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.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='color:black'>There are no pointers in the array but bytes representing an image.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'>I am confused, could anyone help?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>