<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><br><br><div>> From: bruce@spearmorgan.com<br>> Date: Mon, 14 Oct 2013 15:47:05 -0700<br>> To: libav-user@ffmpeg.org<br>> Subject: Re: [Libav-user] Applied pad on the decoded frame<br>> <br>> On Oct 14, 2013, at 4:46 AM, Dolevo Jay <cmst@live.com> wrote:<br>> <br>> > I have encoder and decoder application in separate projects. I use x264 to encode the incoming frames and use libav to decode them. If the frame has a specific resolution like 1366 x 768, the decode frame contains extra black border at the right side of the frame. I have debugged it and realized that the av_pic.linesize[0] is 50 more than the linesize during the encoding. <br>> > Here is the code:<br>> > <br>> > lengthDec = avcodec_decode_video2(c1, av_pic, &pic, &pkt);<br>> > if (pic)<br>> > {<br>> > avpicture_fill((AVPicture *)rgbFrame, RGBimg, PIX_FMT_RGB32, w, h);<br>> > sws_scale(ctx, av_pic->data, av_pic->linesize, 0, h, rgbFrame->data, rgbFrame->linesize);<br>> > }<br>> > <br>> > So, in this code, I decode the packet and convert the decoded data into the rgb. <br>> > Why does the avcodec_decode_video2 returns a padded linesize?<br>> > Could anyone tell me how I can eliminate the black border?<br>> <br>> The actual encoded data has padding, added to make encoding and decoding more efficient. The returned frame has the padding still, since it's more efficient again - just decoding into a buffer without having to copy all the lines.<br>> <br>> That's very standard. Expect to see that in almost all codecs and frame sizes.<br>> <br>> You need to use the viewable width, not the linesize when scaling.<br>> <br>> Bruce<br>> _______________________________________________<br>> Libav-user mailing list<br>> Libav-user@ffmpeg.org<br>> http://ffmpeg.org/mailman/listinfo/libav-user<br><br><br>Thanks for your reply. I have described the problem in detail with some pictures here: <a href="http://forum.doom9.org/showthread.php?t=169036" target="_blank">http://forum.doom9.org/showthread.php?t=169036</a><br>It is really strange that it produces no black part (bar) when I set the width = width+1 when calling <span style=" color:#000000;">sws_getContext. Could it be a bug in swscale since I do no scaling?<br><br>Thanks a lot.<br></span></div> </div></body>
</html>