<div dir="ltr">I am demuxing and decoding a quicktime movie file using libav, the decoder always produces a frame in YUV420P, this frame has to go to the DeckLink's frame buffer which expects the format to be YUYV422. Now I need to convert to the desired pix format for which I am using sws_scale.<div><br></div><div>I was wondering whether is it possible to tell the decoder to decode in YUYV422 to save an additional conversion step? if not then is sws_scale the only option for the conversation. The conversion is happening but somehow the resulting frame has colours inverted (is the byte order changing during memcpy?).</div><div><br></div><p style="margin:0px;font-size:11px;font-family:Menlo">            //initializing destination buffer</p><p style="margin:0px;font-size:11px;font-family:Menlo">            ret = <span style="color:rgb(61,29,129)">av_image_alloc</span>(video_dst_data, video_dst_linesize,</p><p style="margin:0px;font-size:11px;font-family:Menlo">
</p><p style="margin:0px;font-size:11px;font-family:Menlo">                                 video_dec_ctx-><span style="color:rgb(112,61,170)">width</span>, video_dec_ctx-><span style="color:rgb(112,61,170)">height</span>, <span style="color:rgb(61,29,129)">AV_PIX_FMT_YUYV422</span>, <span style="color:rgb(39,42,216)">1</span>);</p><div><br></div><div>                      //initializing context</div><p style="margin:0px;font-size:11px;font-family:Menlo">            sws = <span style="color:rgb(61,29,129)">sws_getContext</span>(video_dec_ctx-><span style="color:rgb(112,61,170)">width</span>, video_dec_ctx-><span style="color:rgb(112,61,170)">height</span>, video_dec_ctx-><span style="color:rgb(112,61,170)">pix_fmt</span>, video_dec_ctx-><span style="color:rgb(112,61,170)">width</span>, video_dec_ctx-><span style="color:rgb(112,61,170)">height</span>,</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">                                  <span style="color:rgb(61,29,129)">AV_PIX_FMT_YUYV422</span>, <span style="color:rgb(120,73,42)">SWS_FAST_BILINEAR</span>, <span style="color:rgb(187,44,162)">NULL</span>, <span style="color:rgb(187,44,162)">NULL</span>, <span style="color:rgb(187,44,162)">NULL</span>);</p><p style="margin:0px;font-size:11px;font-family:Menlo"><br></p><div>                      //performing conversion, frame holds the decoded pixels from the decoder id dvvideo</div><p style="margin:0px;font-size:11px;font-family:Menlo">            <span style="color:rgb(187,44,162)">int</span> status = <span style="color:rgb(61,29,129)">sws_scale</span>(sws, frame-><span style="color:rgb(112,61,170)">data</span>, frame-><span style="color:rgb(112,61,170)">linesize</span>, <span style="color:rgb(39,42,216)">0</span>, frame-><span style="color:rgb(112,61,170)">height</span>, video_dst_data, video_dst_linesize);</p><div>                      </div><div><p style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:rgb(61,29,129)">            memcpy</span>((<span style="color:rgb(187,44,162)">char</span>*)<span style="color:rgb(49,89,93)">buffer</span>, video_dst_data[<span style="color:rgb(39,42,216)">0</span>], video_dst_linesize[<span style="color:rgb(39,42,216)">0</span>] * video_dec_ctx-><span style="color:rgb(112,61,170)">height</span>);</p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 23, 2015 at 9:04 PM, Carl Eugen Hoyos <span dir="ltr"><<a href="mailto:cehoyos@ag.or.at" target="_blank">cehoyos@ag.or.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Nisar Ahmed <nisar.med@...> writes:<br>
<br>
> Where is packed variant of planar YUV420P format,<br>
> I need packed version instead of planar while<br>
> demuxing when libav<br>
<br>
</span>Can you explain your usecase? I don't remember<br>
seeing packed yvu420.<br>
Note that demuxing does not produce pix_fmts...<br>
<br>
Carl Eugen<br>
<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</blockquote></div><br></div>