<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 10, 2014, at 4:28 PM, J Decker <<a href="mailto:d3ck0r@gmail.com">d3ck0r@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><span style="white-space:pre">I would think you would just use 'sws_getContext' and 'sws_scale'</span><div><span style="white-space:pre">worked good for me... </span></div></div></blockquote><div><br></div>Thank you for the pointer.  May I have a little more info regarding how you used <span style="white-space: pre; ">sws_getContext()?  I found its API definition as follows:</span></div><div><br></div><div><span style="white-space: pre;">struct SwsContext * <span class="Apple-tab-span" style="white-space: pre; ">      </span>sws_getContext (int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)</span><br><div><br></div><div>and it allocates and returns a <span style="white-space: pre; ">struct</span><span style="white-space: pre; "> </span><span style="white-space: pre; ">SwsContext*.</span></div><div><span style="white-space: pre; "><br></span></div><div>In my case I am not modifying anything in my filter, why is this function good for me? (I am assuming this performs some kind of transformation because there's a source and destination).  Also in the returned SwsContext struct, I see there are 4 members:</div><div><br></div><div>int <span class="Apple-tab-span" style="white-space: pre; "> </span>lumXInc</div><div>int <span class="Apple-tab-span" style="white-space:pre">     </span>chrXInc<br>int <span class="Apple-tab-span" style="white-space:pre">  </span>lumYInc<br>int <span class="Apple-tab-span" style="white-space:pre">  </span>chrYInc<br><br></div><div>perhaps this is where I can get the luminance?  In that case, does it mean I have to perform some kind of transformation before even able to get the Context?</div><div><br></div><div><br></div><div>Thank you for in advance for clarification.</div><div><br></div><div><br></div><br><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 10, 2014 at 4:18 PM, Ricky Huang <span dir="ltr"><<a href="mailto:rhuang.work@gmail.com" target="_blank">rhuang.work@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Hello all,<div><br></div><div>I am writing code that extracts the luminance component of an input video using my own custom filter in libavfilter - specifically I am extracting it from "PIX_FMT_YUV420P" a video and I am wondering how to go about doing so.  According to the pixfmt.h header: </div>
<div><blockquote type="cite"><br></blockquote><blockquote type="cite">PIX_FMT_YUV420P,   ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)</blockquote><br></div><div>I am not sure how to interpret that.  Assuming I am doing this in my draw_slice() function. It has the definition of:</div>
<div></div><blockquote type="cite"><div><br></div><div>static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)</div></blockquote><div><br></div><div>I know I can get to the input data plane by:</div><div>
</div><blockquote type="cite"><div><br></div><div>AVFilterBufferRef *cur_pic = link->cur_buf;</div><div>uint8_t *data = cur_pic->data[0];</div></blockquote><br><div>But there are multiple "planes" in the data.  Does data[0], data[1], data[2] correspond to each of the Y, U, V channels?</div>
<div><br></div><div>Also, once I am able to point my pointer at the correct coordinate, how should I interpret the extracted result (float, int, etc)?</div><div><br></div><div><br></div><div>Thank you in advance.</div></div>
<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>
<br></blockquote></div><br></div>
_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>http://ffmpeg.org/mailman/listinfo/libav-user<br></blockquote></div><br></body></html>