Hi Janaka,<br><br>The type signature of memset is:<br> void *memset(void *s, int c, size_t n);<br><br>Notice that the second parameter is an int, not an int *. What your code does is treat the pointer value (which points somewhere into your stack) as if it were an integer, and then fill the memory with the value of the pointer (actually the value of the least significant byte of the pointer). So if you had an integer called temp at memory location 0xDEADBEEF, and you said<br>
<br>memset(s, &temp, n)<br><br>then you would be setting n bytes of s to 0xEF, rather than the value of temp.<br><br>In short: lose the '&' :)<br><br>Incidentally, this is why you should always compile with gcc's -Wall flag and read the warnings that come out - they would have told you that you were treating a pointer to an int as if it were an int. In fact, if you can get away with it, use -Werror too - that way this code would not compile at all.<br>
<br>Cheers,<br> -Shane<br><br><div class="gmail_quote">On Feb 17, 2008 5:17 PM, janaka priyadarshana <<a href="mailto:rpjanaka@gmail.com">rpjanaka@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
thanks very much for your help<br><br>So I already tried to remove the U & V components from the stream..<br><br>But unfortunately I was unable to do it successfully<br><br><b>what I did is.......</b><br><br>Changed some code segments in <span style="color: rgb(0, 102, 0);">theora_encode_YUVin() <span style="color: rgb(0, 0, 0);">which is in the</span> encoder_toplevel.c<br>
<br><br> for ( i = 0; i < yuv->uv_height; i++ ){<br> memcpy( LocalDataPtr, InputDataPtr, yuv->uv_width );<br> LocalDataPtr -= yuv->uv_width;<br> InputDataPtr += yuv->uv_stride;<br> }<br><br><br>
<font color="#000000">the above code segment is use to copy the U data into the </font></span><span style="color: rgb(0, 102, 0);">LocalDataPtr<br>
<br><font color="#000000">So i just avoid this input U component (copy the value zero into the </font></span><span style="color: rgb(0, 102, 0);"></span><span style="color: rgb(0, 102, 0);">LocalDataPtr ) <font color="#000000">as follow<br>
<br style="color: rgb(204, 0, 0);"><span style="color: rgb(204, 0, 0);">int temp = 0;</span><br></font></span><span style="color: rgb(0, 102, 0);"> for ( i = 0; i < yuv->uv_height; i++ ){<br> memset( LocalDataPtr, <span style="color: rgb(204, 0, 0);">&temp,</span> yuv->uv_width );<br>
LocalDataPtr -= yuv->uv_width;<br> InputDataPtr += yuv->uv_stride;<br> }</span><br><span style="color: rgb(0, 102, 0);"><br><font color="#000000">The same thing was done for the V component also<br><br>But
the result was differ from my expectations and at the same time the
result was differ from each other when I get encoded the same stream at
different time.<br>
<br>These videos looks like it is lay over a colored mist on top of the video.<br><br>I have attached two snapshots of the resulted video and the original video.<br><br><br><b>Please can I know that </b><br><br>what I have done is correct or not...?<br>
<br>if this way is not the correct way, please help me to do this...<br><br><br></font></span><br><div class="gmail_quote">On Feb 17, 2008 12:32 AM, Ralph Giles <<a href="mailto:giles@xiph.org" target="_blank">giles@xiph.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div><div><div>On 16-Feb-08, at 5:33 AM, janaka priyadarshana wrote:</div>
<br><blockquote type="cite"><b>If the above is true.....(</b>theora use YUV color space<b>)</b></blockquote><div><br></div></div><div>Yes, Theora always encodes video in a YUV colour space.</div><div><br><blockquote type="cite">
it is possible that get a gray scale video output by just considering only the Y component of the video (ignore the U and V components)</blockquote><div><br></div></div><div>Using just the Y plane is a reasonable way to convert a YUV image to a monochrome one.</div>
<div><br></div><div> -r</div></div><br></div></blockquote></div><br><br clear="all"><br>-- <br>-----------<br>Regards,<br><font color="#888888">Janaka Priyadarshana
</font><br>_______________________________________________<br>theora-dev mailing list<br><a href="mailto:theora-dev@xiph.org">theora-dev@xiph.org</a><br><a href="http://lists.xiph.org/mailman/listinfo/theora-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/theora-dev</a><br>
<br></blockquote></div><br>