??xml version="1.0" encoding="utf-8" standalone="yes"?>午夜福利91久久福利,91精品国产高清久久久久久io,久久国产欧美日韩精品http://www.shnenglu.com/bangle/男儿当自?/description>zh-cnWed, 07 May 2025 18:27:44 GMTWed, 07 May 2025 18:27:44 GMT60UML基础知识http://www.shnenglu.com/bangle/archive/2011/04/27/145141.html黑色天黑色天Wed, 27 Apr 2011 06:24:00 GMThttp://www.shnenglu.com/bangle/archive/2011/04/27/145141.htmlhttp://www.shnenglu.com/bangle/comments/145141.htmlhttp://www.shnenglu.com/bangle/archive/2011/04/27/145141.html#Feedback0http://www.shnenglu.com/bangle/comments/commentRss/145141.htmlhttp://www.shnenglu.com/bangle/services/trackbacks/145141.html阅读全文

黑色天 2011-04-27 14:24 发表评论
]]>
lamda的简单实?/title><link>http://www.shnenglu.com/bangle/archive/2011/03/22/142527.html</link><dc:creator>黑色天</dc:creator><author>黑色天</author><pubDate>Tue, 22 Mar 2011 15:47:00 GMT</pubDate><guid>http://www.shnenglu.com/bangle/archive/2011/03/22/142527.html</guid><wfw:comment>http://www.shnenglu.com/bangle/comments/142527.html</wfw:comment><comments>http://www.shnenglu.com/bangle/archive/2011/03/22/142527.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/bangle/comments/commentRss/142527.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/bangle/services/trackbacks/142527.html</trackback:ping><description><![CDATA[所谓LambdaQ简单的说是快速的函数生?<br>在STL的算法中很多地方需要提供一个函数对象或仿函数如for_each<br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #000000;">for_each(v.begin(), v.end(), op());    </span><span style="color: #008000;">//</span><span style="color: #008000;">原格式如?br></span></div> 如果需要不用的法需要些不同的函数对象,但是引用了万能的lambda后效果就不同?效果如下<br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #000000;">for_each(v.begin(), v.end(), _1</span><span style="color: #000000;">=</span><span style="color: #000000;">2</span><span style="color: #000000;">);    </span><span style="color: #008000;">//</span><span style="color: #008000;">_1=2是一个仿函数,通过重蝲=实现<br></span></div> 需要的操作一目了Ӟ单分析下for_eachW三个参数需要的是一个函数或仿函敎ͼ所以_1=2必然产生的是一个仿函数,大致可以推出是重载了=实现的生仿函数Q那么真正的操作q需要一个封装,即需要两个类实现Q第一个类大致如下<br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #0000ff;">struct</span><span style="color: #000000;"> place_holder<br>{<br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">重蝲需要的法操作</span><span style="color: #008000;"><br></span><span style="color: #000000;">    template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename R</span><span style="color: #000000;">></span><span style="color: #000000;"><br>    op</span><span style="color: #000000;"><</span><span style="color: #000000;">R</span><span style="color: #000000;">></span><span style="color: #000000;"> </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">=</span><span style="color: #000000;">(R i)<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> op</span><span style="color: #000000;"><</span><span style="color: #000000;">R</span><span style="color: #000000;">></span><span style="color: #000000;">(i);<br>    }<br>};</span></div> 模板使得q个l构可以传入Mcd的参敎ͼ通过重蝲=操作内部q回了一个仿函数Q具体的操作׃下的仿函数实?br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #008000;">//</span><span style="color: #008000;">仿函敎ͼ即重载了()操作的类</span><span style="color: #008000;"><br></span><span style="color: #000000;">template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename T</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> op<br>{<br>    op(T i): _i(i) {}<br>    T </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">()(T </span><span style="color: #000000;">&</span><span style="color: #000000;">i)<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> _i;<br>    }<br>    T _i;<br>};</span></div> q个仿函数将传入的引用参数进行了赋值操作,实现了最l的操作.<br>以上的代码实?操作如果需要其他操作则重蝲相应的操作例?=<br>依次cL占位cd?=q过仿函数可以实?=的操作以下是完成的代?br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><span style="color: #008000;">//</span><span style="color: #008000;"> lambda.cpp : 定义控制台应用程序的入口炏V?br></span><span style="color: #008000;">//<br></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;">"</span><span style="color: #000000;">stdafx.h</span><span style="color: #000000;">"</span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">vector</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">algorithm</span><span style="color: #000000;">></span><span style="color: #000000;"><br><br></span><span style="color: #0000ff;">using</span><span style="color: #000000;"> </span><span style="color: #0000ff;">namespace</span><span style="color: #000000;"> std;<br><br></span><span style="color: #008000;">//</span><span style="color: #008000;">仿函敎ͼ即重载了()操作的类</span><span style="color: #008000;"><br></span><span style="color: #000000;">template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename T</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> op<br>{<br>    op(T i): _i(i) {}<br>    T </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">()(T </span><span style="color: #000000;">&</span><span style="color: #000000;">i)<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> _i;<br>    }<br>    T _i;<br>};<br>template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename T</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> op1<br>{<br>    op1(T i):_i(i){}<br>    T </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">()(T </span><span style="color: #000000;">&</span><span style="color: #000000;">i)<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> i </span><span style="color: #000000;">+</span><span style="color: #000000;"> _i;<br>    }<br>    T _i;<br>};<br><br></span><span style="color: #008000;">//</span><span style="color: #008000;">占位W?/span><span style="color: #008000;"><br></span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> place_holder<br>{<br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">重蝲需要的法操作</span><span style="color: #008000;"><br></span><span style="color: #000000;">    template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename R</span><span style="color: #000000;">></span><span style="color: #000000;"><br>    op</span><span style="color: #000000;"><</span><span style="color: #000000;">R</span><span style="color: #000000;">></span><span style="color: #000000;"> </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">=</span><span style="color: #000000;">(R i)<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> op</span><span style="color: #000000;"><</span><span style="color: #000000;">R</span><span style="color: #000000;">></span><span style="color: #000000;">(i);<br>    }<br>    template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename R</span><span style="color: #000000;">></span><span style="color: #000000;"><br>    op1</span><span style="color: #000000;"><</span><span style="color: #000000;">R</span><span style="color: #000000;">></span><span style="color: #000000;"> </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">+=</span><span style="color: #000000;">(R i)<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> op1</span><span style="color: #000000;"><</span><span style="color: #000000;">R</span><span style="color: #000000;">></span><span style="color: #000000;">(i);<br>    }<br>};<br><br>place_holder _1;<br><br></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> _tmain(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> argc, _TCHAR</span><span style="color: #000000;">*</span><span style="color: #000000;"> argv[])<br>{<br>    vector</span><span style="color: #000000;"><</span><span style="color: #0000ff;">int</span><span style="color: #000000;">></span><span style="color: #000000;"> v;<br>    v.push_back(</span><span style="color: #000000;">1</span><span style="color: #000000;">);<br>    v.push_back(</span><span style="color: #000000;">2</span><span style="color: #000000;">);<br>    v.push_back(</span><span style="color: #000000;">3</span><span style="color: #000000;">);<br><br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">for_each(v.begin(), v.end(), op());    </span><span style="color: #008000;">//</span><span style="color: #008000;">原格式如?/span><span style="color: #008000;"><br></span><span style="color: #000000;">    for_each(v.begin(), v.end(), _1</span><span style="color: #000000;">=</span><span style="color: #000000;">2</span><span style="color: #000000;">);    </span><span style="color: #008000;">//</span><span style="color: #008000;">_1=2是一个仿函数,通过重蝲=实现</span><span style="color: #008000;"><br></span><span style="color: #000000;"><br>    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">;<br>}</span></div> <br><br> <img src ="http://www.shnenglu.com/bangle/aggbug/142527.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/bangle/" target="_blank">黑色天</a> 2011-03-22 23:47 <a href="http://www.shnenglu.com/bangle/archive/2011/03/22/142527.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bind函数的简单实?/title><link>http://www.shnenglu.com/bangle/archive/2011/03/22/142526.html</link><dc:creator>黑色天</dc:creator><author>黑色天</author><pubDate>Tue, 22 Mar 2011 15:46:00 GMT</pubDate><guid>http://www.shnenglu.com/bangle/archive/2011/03/22/142526.html</guid><wfw:comment>http://www.shnenglu.com/bangle/comments/142526.html</wfw:comment><comments>http://www.shnenglu.com/bangle/archive/2011/03/22/142526.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/bangle/comments/commentRss/142526.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/bangle/services/trackbacks/142526.html</trackback:ping><description><![CDATA[<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#include </span><span style="color: #000000;">"</span><span style="color: #000000;">stdafx.h</span><span style="color: #000000;">"</span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">algorithm</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">iostream</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #0000ff;">string</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">vector</span><span style="color: #000000;">></span><span style="color: #000000;"><br><br></span><span style="color: #0000ff;">using</span><span style="color: #000000;"> </span><span style="color: #0000ff;">namespace</span><span style="color: #000000;"> std;<br><br></span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> Person<br>{<br>    Person(</span><span style="color: #0000ff;">const</span><span style="color: #000000;"> </span><span style="color: #0000ff;">string</span><span style="color: #000000;">&</span><span style="color: #000000;"> name)<br>        : name_(name)<br>    {}<br><br>    </span><span style="color: #0000ff;">string</span><span style="color: #000000;"> Name()<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> name_;<br>    }<br><br>    </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> SetName(</span><span style="color: #0000ff;">string</span><span style="color: #000000;"> name)<br>    {<br>        name_ </span><span style="color: #000000;">=</span><span style="color: #000000;"> name;<br>    }<br><br>    </span><span style="color: #0000ff;">string</span><span style="color: #000000;"> name_;<br>};<br><br>template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename R, typename T, typename Arg</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #0000ff;">class</span><span style="color: #000000;"> simple_binder<br>{<br></span><span style="color: #0000ff;">public</span><span style="color: #000000;">:<br>    </span><span style="color: #0000ff;">explicit</span><span style="color: #000000;"> simple_binder(R (T::</span><span style="color: #000000;">*</span><span style="color: #000000;">pfn)(Arg), </span><span style="color: #0000ff;">const</span><span style="color: #000000;"> Arg</span><span style="color: #000000;">&</span><span style="color: #000000;"> arg)<br>        : pfn_(pfn)<br>        , arg_(arg)<br>    {}<br><br>    R </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">()(T</span><span style="color: #000000;">&</span><span style="color: #000000;"> t)<br>    {<br>        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> (t.</span><span style="color: #000000;">*</span><span style="color: #000000;">pfn_)(arg_);<br>    }<br></span><span style="color: #0000ff;">private</span><span style="color: #000000;">:<br>    R (T::</span><span style="color: #000000;">*</span><span style="color: #000000;">pfn_)(Arg);<br>    Arg arg_;<br>};<br><br>template </span><span style="color: #000000;"><</span><span style="color: #000000;">typename R, typename T, typename Arg</span><span style="color: #000000;">></span><span style="color: #000000;"><br>simple_binder</span><span style="color: #000000;"><</span><span style="color: #000000;">R, T, Arg</span><span style="color: #000000;">></span><span style="color: #000000;"><br>simple_bind( R (T::</span><span style="color: #000000;">*</span><span style="color: #000000;">pfn)(Arg), </span><span style="color: #0000ff;">const</span><span style="color: #000000;"> Arg</span><span style="color: #000000;">&</span><span style="color: #000000;"> arg)<br>{<br>    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> simple_binder</span><span style="color: #000000;"><</span><span style="color: #000000;">R, T, Arg</span><span style="color: #000000;">></span><span style="color: #000000;">(pfn, arg);<br>}<br><br></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main()<br>{<br>    Person person(</span><span style="color: #000000;">"</span><span style="color: #000000;">Ralph</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br><br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">smimple_bind生成一个仿函数c,q个cL造时赋garg<br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">遇到(person)Ӟ调用q个仿函数类重蝲?)操作?br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">t.*pfn(arg)<br>    </span><span style="color: #008000;">//</span><span style="color: #008000;">又回归ؓ(f)一个函敎ͼ不过参数可以自己控制?娃哈?/span><span style="color: #008000;"><br></span><span style="color: #000000;">    simple_bind(</span><span style="color: #000000;">&</span><span style="color: #000000;">Person::SetName, </span><span style="color: #0000ff;">string</span><span style="color: #000000;">(</span><span style="color: #000000;">"</span><span style="color: #000000;">Martin</span><span style="color: #000000;">"</span><span style="color: #000000;">))(person);<br>    cout </span><span style="color: #000000;"><<</span><span style="color: #000000;"> person.Name() </span><span style="color: #000000;"><<</span><span style="color: #000000;"> endl;<br>}</span></div> <br><img src ="http://www.shnenglu.com/bangle/aggbug/142526.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/bangle/" target="_blank">黑色天</a> 2011-03-22 23:46 <a href="http://www.shnenglu.com/bangle/archive/2011/03/22/142526.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RGB、YUY2、YUYV、YVYU、UYVY与AYUVQ{Q?/title><link>http://www.shnenglu.com/bangle/archive/2009/07/07/89475.html</link><dc:creator>黑色天</dc:creator><author>黑色天</author><pubDate>Tue, 07 Jul 2009 10:19:00 GMT</pubDate><guid>http://www.shnenglu.com/bangle/archive/2009/07/07/89475.html</guid><wfw:comment>http://www.shnenglu.com/bangle/comments/89475.html</wfw:comment><comments>http://www.shnenglu.com/bangle/archive/2009/07/07/89475.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/bangle/comments/commentRss/89475.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/bangle/services/trackbacks/89475.html</trackback:ping><description><![CDATA[<p>计算机彩色显C器昄色彩的原理与彩色?sh)视ZP都是采用RQRedQ、GQGreenQ、BQBlueQ相加؜色的原理Q通过发射ZU不同强度的?sh)子束,使屏q内侧覆盖的U、绿、蓝光材料发光而生色彩。这U色彩的表示Ҏ(gu)UCؓ(f)RGB色彩I间表示Q它也是多媒体计机技术中用得最多的一U色彩空间表C方法)?br>Ҏ(gu)三基色原理,L一U色光F都可以用不同分量的R、G、B三色相加混合而成?br><br>F = r [ R ] + g [ G ] + b [ B ]<br><br>其中Qr、g、b分别Z参与混合的系数。当三基色分量都?Q最弱)时؜合ؓ(f)黑色光;而当三基色分量都为kQ最强)时؜合ؓ(f)白色光。调整r、g、b三个pL的|可以混合Z于黑色光和白色光之间的各U各L(fng)色光?br>那么YUV又从何而来呢?在现代彩色电(sh)视系l中Q通常采用三管彩色摄像机或彩色CCD摄像行摄像,然后把摄得的彩色囑փ信号l分艌Ӏ分别放大校正后得到RGBQ再l过矩阵变换?sh)\得到亮度信号Y和两个色差信号RQYQ即UQ、BQYQ即VQ,最后发送端亮度和色差三个信号分别q行~码Q用同一信道发送出厅R这U色彩的表示Ҏ(gu)是所谓的YUV色彩I间表示?br>采用YUV色彩I间的重要性是它的亮度信号Y和色度信号U、V是分ȝ。如果只有Y信号分量而没有U、V分量Q那么这栯C的囑փ是黑白灰度囑փ。彩色电(sh)视采用YUVI间正是Z用亮度信号Y解决彩色?sh)视Z黑白?sh)视机的兼容问题Q黑白?sh)视Z能接收彩色电(sh)视信受?br>YUV与RGB怺转换的公式如下(RGB取D围均?-255Q:(x)<br><br>Y = 0.299R + 0.587G + 0.114B<br>U = -0.147R - 0.289G + 0.436B<br>V = 0.615R - 0.515G - 0.100B<br><br>R = Y + 1.14V<br>G = Y - 0.39U - 0.58V<br>B = Y + 2.03U<br><br>在DirectShow中,常见的RGB格式有RGB1、RGB4、RGB8、RGB565、RGB555、RGB24、RGB32、ARGB32{;常见的YUV格式有YUY2、YUYV、YVYU、UYVY、AYUV、Y41P、Y411、Y211、IF09、IYUV、YV12、YVU9?YUV411、YUV420{。作频媒体类型的辅助说明cdQSubtypeQ,它们对应的GUID见表2.3?br><br>?.3 常见的RGB和YUV格式<br><br>GUID    格式描述<br>MEDIASUBTYPE_RGB1    2Ԍ每个像素?位表C,需要调色板<br>MEDIASUBTYPE_RGB4    16Ԍ每个像素?位表C,需要调色板<br>MEDIASUBTYPE_RGB8    256Ԍ每个像素?位表C,需要调色板<br>MEDIASUBTYPE_RGB565    每个像素?6位表C,RGB分量分别使用5位?位??br>MEDIASUBTYPE_RGB555    每个像素?6位表C,RGB分量都?位(剩下?位不用)<br>MEDIASUBTYPE_RGB24    每个像素?4位表C,RGB分量各??br>MEDIASUBTYPE_RGB32    每个像素?2位表C,RGB分量各?位(剩下?位不用)<br>MEDIASUBTYPE_ARGB32    每个像素?2位表C,RGB分量各?位(剩下?位用于表CAlpha通道|<br>MEDIASUBTYPE_YUY2    YUY2格式Q以4:2:2方式打包<br>MEDIASUBTYPE_YUYV    YUYV格式Q实际格式与YUY2相同Q?br>MEDIASUBTYPE_YVYU    YVYU格式Q以4:2:2方式打包<br>MEDIASUBTYPE_UYVY    UYVY格式Q以4:2:2方式打包<br>MEDIASUBTYPE_AYUV    带Alpha通道?:4:4 YUV格式<br>MEDIASUBTYPE_Y41P    Y41P格式Q以4:1:1方式打包<br>MEDIASUBTYPE_Y411    Y411格式Q实际格式与Y41P相同Q?br>MEDIASUBTYPE_Y211    Y211格式<br>MEDIASUBTYPE_IF09    IF09格式<br>MEDIASUBTYPE_IYUV    IYUV格式<br>MEDIASUBTYPE_YV12    YV12格式<br>MEDIASUBTYPE_YVU9    YVU9格式<br><br>下面分别介绍各种RGB格式?br><br>¨RGB1、RGB4、RGB8都是调色板类型的RGB格式Q在描述q些媒体cd的格式细节时Q通常?x)在BITMAPINFOHEADER数据l构后面跟着一个调色板Q定义一pd颜色Q。它们的囑փ数据q不是真正的颜色|而是当前像素颜色值在调色板中的烦引。以RGB1Q?色位图)ZQ比如它的调色板中定义的两种颜色gơؓ(f)0x000000Q黑Ԍ?xFFFFFFQ白ԌQ那么图像数?01101010111…Q每个像素用1位表C)表示对应各像素的颜色为:(x)黑黑白白黑白黑白黑白白白…?br><br>¨ RGB565使用16位表CZ个像素,q?6位中?位用于RQ?位用于GQ?位用于B。程序中通常使用一个字QWORDQ一个字{于两个字节Q来操作一个像素。当d一个像素后Q这个字的各个位意义如下Q?br>高字?nbsp;             低字?br>R R R R R G G G     G G G B B B B B<br>可以l合使用屏蔽字和UM操作来得到RGB各分量的|(x)<br><br>#define RGB565_MASK_RED    0xF800<br>#define RGB565_MASK_GREEN  0x07E0<br>#define RGB565_MASK_BLUE   0x001F<br>R = (wPixel & RGB565_MASK_RED) >> 11;   // 取D?-31<br>G = (wPixel & RGB565_MASK_GREEN) >> 5;  // 取D?-63<br>B =  wPixel & RGB565_MASK_BLUE;         // 取D?-31<br><br>¨ RGB555是另一U?6位的RGB格式QRGB分量都用5位表C(剩下?位不用)。用一个字d一个像素后Q这个字的各个位意义如下Q?br>高字?nbsp;            低字?br>X R R R R G G       G G G B B B B B       QX表示不用Q可以忽略)<br>可以l合使用屏蔽字和UM操作来得到RGB各分量的|(x)<br><br>#define RGB555_MASK_RED    0x7C00<br>#define RGB555_MASK_GREEN  0x03E0<br>#define RGB555_MASK_BLUE   0x001F<br>R = (wPixel & RGB555_MASK_RED) >> 10;   // 取D?-31<br>G = (wPixel & RGB555_MASK_GREEN) >> 5;  // 取D?-31<br>B =  wPixel & RGB555_MASK_BLUE;         // 取D?-31<br><br>¨ RGB24使用24位来表示一个像素,RGB分量都用8位表C,取D围ؓ(f)0-255。注意在内存中RGB各分量的排列序为:(x)BGR BGR BGR…。通常可以使用RGBTRIPLE数据l构来操作一个像素,它的定义为:(x)<br><br>typedef struct tagRGBTRIPLE { <br>BYTE rgbtBlue;    // 蓝色分量<br>BYTE rgbtGreen;   // l色分量<br>BYTE rgbtRed;     // U色分量<br>} RGBTRIPLE;<br><br>¨ RGB32使用32位来表示一个像素,RGB分量各用?位,剩下?位用作Alpha通道或者不用。(ARGB32是带Alpha通道?RGB32。)注意在内存中RGB各分量的排列序为:(x)BGRA BGRABGRA…。通常可以使用RGBQUAD数据l构来操作一个像素,它的定义为:(x)<br><br>typedef struct tagRGBQUAD {<br>BYTE    rgbBlue;      // 蓝色分量<br>BYTE    rgbGreen;     // l色分量<br>BYTE    rgbRed;       // U色分量<br>BYTE    rgbReserved;  // 保留字节Q用作Alpha通道或忽略)<br>} RGBQUAD;<br><br>下面介绍各种YUV格式。YUV格式通常有两大类Q打包(packedQ格式和q面QplanarQ格式。前者将YUV分量存放在同一个数l中Q通常是几个相?c)像素l成一个宏像素Qmacro-pixelQ;而后者用三个数l分开存放YUV三个分量Q就像是一个三l^面一栗表2.3中的YUY2?Y211都是打包格式Q而IF09到YVU9都是q面格式。(注意Q在介绍各种具体格式ӞYUV各分量都?x)带有下标,如Y0、U0、V0表示W一个像素的YUV分量QY1、U1、V1表示W二个像素的YUV分量Q以此类推。)<br><br>¨ YUY2Q和YUYVQ格式ؓ(f)每个像素保留Y分量Q而UV分量在水qx向上每两个像素采样一ơ。一个宏像素?个字节,实际表示2个像素。(4:2:2的意思ؓ(f)一个宏像素中有4个Y分量?个U分量?个V分量。)囑փ数据中YUV分量排列序如下Q?br>Y0 U0 Y1 V0    Y2 U2 Y3 V2 …<br><br>¨ YVYU格式跟YUY2cMQ只是图像数据中YUV分量的排列顺序有所不同Q?br>Y0 V0 Y1 U0    Y2 V2 Y3 U2 …<br><br>¨ UYVY格式跟YUY2cMQ只是图像数据中YUV分量的排列顺序有所不同Q?br>U0 Y0 V0 Y1    U2 Y2 V2 Y3 …<br><br>¨ AYUV格式带有一个Alpha通道Qƈ且ؓ(f)每个像素都提取YUV分量Q图像数据格式如下:(x)<br>A0 Y0 U0 V0    A1 Y1 U1 V1 …<br><br>¨ Y41PQ和Y411Q格式ؓ(f)每个像素保留Y分量Q而UV分量在水qx向上?个像素采样一ơ。一个宏像素?2个字节,实际表示8个像素。图像数据中YUV分量排列序如下Q?br>U0 Y0 V0 Y1    U4 Y2 V4 Y3    Y4 Y5 Y6 Y8 … <br><br>¨ Y211格式在水qx向上Y分量?个像素采样一ơ,而UV分量?个像素采样一ơ。一个宏像素?个字节,实际表示4个像素。图像数据中YUV分量排列序如下Q?br>Y0 U0 Y2 V0    Y4 U4 Y6 V4 …<br><br>¨ YVU9格式为每个像素都提取Y分量Q而在UV分量的提取时Q首先将囑փ分成若干? x 4的宏块,然后每个宏块提取一个U分量和一个V分量。图像数据存储时Q首先是整幅囑փ的Y分量数组Q然后就跟着U分量数组Q以及V分量数组。IF09格式与YVU9cM?br><br>¨ IYUV格式为每个像素都提取Y分量Q而在UV分量的提取时Q首先将囑փ分成若干? x 2的宏块,然后每个宏块提取一个U分量和一个V分量。YV12格式与IYUVcM?br><br>¨YUV411、YUV420格式多见于DV数据中,前者用于NTSCӞ后者用于PAL制。YUV411为每个像素都提取Y分量Q而UV分量在水qx向上?个像素采样一ơ。YUV420qV分量采样?Q而是跟YUV411相比Q在水^方向上提高一倍色差采样频率,在垂直方向上以U/V间隔的方式减一半色差采栗?br></p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">YUV转UYVY格式</span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> YUVtoUYVY(uint8_t </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">y_plane, uint8_t </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">u_plane, uint8_t </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">v_plane, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> y_stride, <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>                      </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> uv_stride, OUT uint8_t </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">pDstBuf, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> width, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> height)<br><img id=Codehighlighter1_164_490_Open_Image onclick="this.style.display='none'; Codehighlighter1_164_490_Open_Text.style.display='none'; Codehighlighter1_164_490_Closed_Image.style.display='inline'; Codehighlighter1_164_490_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_164_490_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_164_490_Closed_Text.style.display='none'; Codehighlighter1_164_490_Open_Image.style.display='inline'; Codehighlighter1_164_490_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_164_490_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_164_490_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_214_488_Open_Image onclick="this.style.display='none'; Codehighlighter1_214_488_Open_Text.style.display='none'; Codehighlighter1_214_488_Closed_Image.style.display='inline'; Codehighlighter1_214_488_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_214_488_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_214_488_Closed_Text.style.display='none'; Codehighlighter1_214_488_Open_Image.style.display='inline'; Codehighlighter1_214_488_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> row </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; row </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> height; row </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> row </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span id=Codehighlighter1_214_488_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_214_488_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_262_485_Open_Image onclick="this.style.display='none'; Codehighlighter1_262_485_Open_Text.style.display='none'; Codehighlighter1_262_485_Closed_Image.style.display='inline'; Codehighlighter1_262_485_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_262_485_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_262_485_Closed_Text.style.display='none'; Codehighlighter1_262_485_Open_Image.style.display='inline'; Codehighlighter1_262_485_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> col </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; col </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> width; col</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">col </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">) </span><span id=Codehighlighter1_262_485_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_262_485_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            pDstBuf[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> u_plane[row</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> uv_stride </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> col</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            pDstBuf[</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> y_plane[row </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> y_stride </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> col];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            pDstBuf[</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> v_plane[row</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> uv_stride </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> col</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            pDstBuf[</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> y_plane[row </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> y_stride </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> col </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            pDstBuf </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <img src ="http://www.shnenglu.com/bangle/aggbug/89475.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/bangle/" target="_blank">黑色天</a> 2009-07-07 18:19 <a href="http://www.shnenglu.com/bangle/archive/2009/07/07/89475.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RTPSession译(?http://www.shnenglu.com/bangle/archive/2009/06/26/88565.html黑色天黑色天Fri, 26 Jun 2009 05:13:00 GMThttp://www.shnenglu.com/bangle/archive/2009/06/26/88565.htmlhttp://www.shnenglu.com/bangle/comments/88565.htmlhttp://www.shnenglu.com/bangle/archive/2009/06/26/88565.html#Feedback0http://www.shnenglu.com/bangle/comments/commentRss/88565.htmlhttp://www.shnenglu.com/bangle/services/trackbacks/88565.htmlRTPSession
      对于大多数的RTP应用E序QRTPSessioncd能是JRTPLIB唯一使用的类。它能完全处理RTCP部䆾的数据包Q所以用户可以把_֊集中在真正的数据收发?br>      要知道RTPSessioncd多线E下q不是安全的Q因此,用户要通过某些锁同步机制来保证不会(x)出现在不同线E当中调用同一个RTPSession实例?br>      RTPSessioncL如下的接口?br>
      • RTPSession(RTPTransmitter::TransmissionProtocol proto = RTPTransmitter::IPv4UDPProto)
      使用protocd传输层创Z个PRTSession实例。如果proto使用用户自定义(user-definedQ传输层Q则相应的NewUserDefinedTransmitter()函数必须实现?span style="COLOR: rgb(255,153,0)">ps:q里默认p了,默认是IPV4|络?/span>

      • int Create(const RTPSessionParams &sessparams, const RTPTransmissionParams*transparams = 0)
      使用RTPSession参数sessparams和RTPTransmission参数transparams 真正创徏一个RTP?x)话。如果transparams 为NULLQ则使用默认的参数?span style="COLOR: rgb(255,153,0)">ps:RTPSessionParams 我们可能要设得比较多QRTPTransmissionParams参数只要设|其中的端口p了,端口一定要讑֯Q不然进行组播时Q这个进E将不接收数据。设|方式可以看example.cpp?br>
      • void Destroy()
      d一个会(x)话但不向其它l成员发送BYE包?span style="COLOR: rgb(255,153,0)">ps:我不推荐用这个函数除非是错误处理Q正常离开我们应该用ByeDestroy()?br>      
      • void BYEDestroy(const RTPTime &maxwaittime, const void *reason,size t reasonlength)
      发送一个BYE包ƈ且离开?x)话。在发送BYE包前{待maxwaittimeQ如果超Ӟ?x)不发送BYE包直接离开QBYE包会(x)包含你的d原因reason。相应的reasonlength表示reason长度?span style="COLOR: rgb(255,153,0)">ps:因ؓ(f)BYE包是一个RTCP包,RTCP不是要发发的,它的发送时间是Zq带宽通过计算得出来的Q那很有可能到了要发的时候以l超q了maxwaittime旉了,作者可能认一直保留个q会(x)话这么久没意义。当Ӟ我常常把maxwaittime讑־很大?br>
      • bool IsActive()
      看看q个RTPSession实例是否以经通过Create建立了真实的?x)话?br>
      • uint32 t GetLocalSSRC()
      q回我们的SSRC?span style="COLOR: rgb(255,153,0)">ps:至于什么是SSRCQ去看看RFC3550吧。我说过JRTPLIB只是RTP协议的包装,q没有做M应用的事情?/span>

      • int AddDestination(const RTPAddress &addr)
      d一个发送目标?span style="COLOR: rgb(255,153,0)">ps: 当然Q如果我们用组播,q里只用调用一ơ,把我们的l播地址写进厅R这Pq组的全部h都能收到你发的包。但是组播可因特|的上设|很烦。而且用组播测试也很烦Q组播必BIND一个端口,如果你想在同一台机器上q行两个软g实例来没试,你就?x)发现同一个端口BIND两次Q当Ӟ后面那次?x)失败,也就是说试不了Q要?找两台机器,或用虚拟?img src="http://www.cnitblog.com/CuteSoft_Client/CuteEditor/images/emdgust.gif" align=absMiddle border=0>Q,如果l播不满I我们p把组播变在单播,q时pq复调用q个函数把其它组成员的IP都加q来了。具体可以看看example3.cpp?br>
      • int DeleteDestination(const RTPAddress &addr)
      从发送地址列表中删除一下地址?br>
      • void ClearDestinations()
      清除发送地址列表?br>
      • bool SupportsMulticasting()
      q回JRTPLIB是否支持l播。ps:q里指JRTPLIB本nQ不是你的真实网l。编译JRTPLIB库时可能指定?br>.
      • int JoinMulticastGroup(const RTPAddress &addr)
      加入一个组播组addr?br>
      • int LeaveMulticastGroup(const RTPAddress &addr)
       d一个组播组addr?br>
      • void LeaveAllMulticastGroups()
      d所有组播组?span style="COLOR: rgb(255,153,0)">ps:我们可以同时加入多个l播l?

      • int SendPacket(const void *data, size t len)
      • int SendPacket(const void *data, size t len, uint8 t pt, bool mark,uint32 t timestampinc)
      • int SendPacketEx(const void *data, size t len, uint16 t hdrextID,const void *hdrextdata, size t numhdrextwords)
      • int SendPacketEx(const void *data, size t len, uint8 t pt, boolmark, uint32 t timestampinc, uint16 t hdrextID, const void *hdrextdata,size t numhdrextwords)
      上面?个函数都是发送数据包的,我想如果你没有看RTP协议Q我说了你也晕。如果你RTP协议看了Q再看看RTPSession.h的注识,你就懂了?/span>

      • int SetDefaultPayloadType(uint8 t pt)
      讑֮默认的RTP PayloadType为PT?span style="COLOR: rgb(255,153,0)">ps:和上面的W一个和W三个发送函数配套。至于应该设个什么数Q如果你看BAIDU上ؕ七八p的文章Q当然的p可能了。其实应该按RFC3551Q根据你要传输的媒体cd来设?/span>

      • int SetDefaultMark(bool m)
      q设RTP数据包的Mark标识?span style="COLOR: rgb(255,153,0)">ps:设ؓ(f)什么值好Q这个,呵呵Q连RFC3550也不能确定了。要看具体的RTP Payload规范QMPEG的,H263的都不一栗?br>      MPEG2 
   www.ietf.org/rfc/rfc2250.txt 
      MPEG4    
www.rfc-editor.org/rfc/rfc3016.txt 
      H263        www.ietf.org/rfc/rfc2190.txt
 

      • int SetDefaultTimestampIncrement(uint32 t timestampinc)
      讄默认的时间戳的增量?span style="COLOR: rgb(255,153,0)">ps:也是和上的第一和第三个函数配套的。每发一个RTP数据包timestamp׃(x)自动增加

      • int IncrementTimestamp(uint32 t inc)
      q个函数用来手工增加Timestamp。有时我q很好用Q例如,一个RTP数据包因为只含有静音数据Q我们没有发送,q是我们应手工增加Timestamp以便发下一个RTP数据包时它的Timestamp是正的?br>
      • int IncrementTimestampDefault()
      q个函数用于增加由SetDefaultTimestampIncrement讑֮的倹{有时候这很有用,例如Q一个RTP数据包因为只含有静音数据Q我们没有发送。这Ӟq个函数׃(x)被调用用来设|Timestamp以便下一个RTP包的Timestamp是正的?br>
      • int SetPreTransmissionDelay(const RTPTime &delay)
      This function allows you to inform the library about the delay between
sampling the first sample of a packet and sending the packet. This delay is
taken into account when calculating the relation between RTP timestamp
and wallclock time, used for inter-media synchronization.

      • RTPTransmissionInfo *GetTransmissionInfo()
      This function returns an instance of a subclass of RTPTransmissionInfo
which will give some additional information about the transmitter (a list
of local IP addresses for example). The user has to delete the returned
instance when it is no longer needed.
      
      • int Poll()
      If you’re not using the poll thread, this function must be called regularly
to process incoming data and to send RTCP data when necessary.
61

      • int WaitForIncomingData(const RTPTime &delay,bool *dataavailable= 0)
      Waits at most a time delay until incoming data has been detected. Only
works when you’re not using the poll thread. If dataavailable is not NULL,
it should be set to true if data was actually read and to false otherwise.

      • int AbortWait()
      If the previous function has been called, this one aborts the waiting. Only
works when you’re not using the poll thread.

      • RTPTime GetRTCPDelay()
      Returns the time interval after which an RTCP compound packet may have
to be sent. Only works when you’re not using the poll thread.

      • int BeginDataAccess()
      下面的函敎ͼ直到EndDataAccessQ要在BeginDataAccess 和EndDataAccess之间被调用,BeginDataAccess保轮询(pollQ线E不?x)在q期间访问source table 。EndDataAccess 调用完成后,轮询(pollQ线E会(x)得到锁而l访问?span style="COLOR: rgb(255,153,0)">ps:首先Q你里的source table中的每一个source表示参与?x)议中的每一个参与者的每一个独立的媒体。我们会(x)在下面用C们,但同ӞpollU程也会(x)轮询它们以正处理和RTCP有关的内宏V?br>  

      • bool GotoFirstSource()
      开始递归参与者的W一个流Q如果找CQ就q回tree,否则q回false?span style="COLOR: rgb(255,153,0)">psQ我们通过q个函数和下面的GotoNextSource遍历source table中的每一个source?br>      
      • bool GotoNextSource()
      讄当前的源QsourceQؓ(f)source table中的下一个源。如果已l到N了就q回false.
     
      • bool GotoPreviousSource()
      讄当前的源QsourceQؓ(f)source table中上一个源。如果已l到头部了就q回false.


      • bool GotoFirstSourceWithData()
      开始递归参与者中W一个有RTP数据的流Q如果找CQ就q回tree,否则q回false?span style="COLOR: rgb(255,153,0)">PSQ在接收数据是我们常用的是这套函敎ͼ因ؓ(f)如果没有数据要来都没用?br>
      • bool GotoNextSourceWithData()
      讄当前的源QsourceQؓ(f)source table中有RTP数据的下一个源。如果已l到N了就q回false.

      • bool GotoPreviousSourceWithData()
      讄当前的源QsourceQؓ(f)source table中有RTP数据的上一个源。如果已l到头部了就q回false.

      • RTPSourceData *GetCurrentSourceInfo()
      q回当前参与者的当前源(source)的RTPSourceData 实列?span style="COLOR: rgb(255,153,0)">psQ返回的q个RTPSourceData 是本进E从期它参与者的RTCP数据包中攉得到的信息,Ҏ(gu)们来说其实很有用Q只是作者的例程没有用上Q国内的|络也没有提到。在RFC3550中有关RTCP的东襉K在这了,看过RFC3550的h都知刎ͼ里头谈得最多的是RTCP。这个类我们以后?x)专门说?br>      
      
      • RTPSourceData *GetSourceInfo(uint32 t ssrc)
      q回由ssrc指定的RTPSourceData Q或都NULLQ当q个条目不存在)?span style="COLOR: rgb(255,153,0)">psQ这个函C很有用。因为GetCurrentSourceInfo只有在GotoFirstSource{上下文当中才能用。如果我们是在RTPSource子类的成员函CQ我们没有这个上下文Q就只能用这个函数?/span>
 
      • RTPPacket *GetNextPacket()
      得到当前参与者当前媒体流的下一个RTP数据包?br>
      • int EndDataAccess()
      L(fng)BeginDataAccess

      • int SetReceiveMode(RTPTransmitter::ReceiveMode m)
      Sets the receive mode to m, which can be one of the following:
      – RTPTransmitter::AcceptAll
            All incoming data is accepted, no matter where it originated from.
      – RTPTransmitter::AcceptSome
            Only data coming from specific sources will be accepted.
      – RTPTransmitter::IgnoreSome
            All incoming data is accepted, except for data coming from a specificset of sources.
        Note that when the receive mode is changed, the list of addressed to be ignored or accepted will be cleared.

      • int AddToIgnoreList(const RTPAddress &addr)
      Adds addr to the list of addresses to ignore.

      • int DeleteFromIgnoreList(const RTPAddress &addr)
      Deletes addr from the list of addresses to ignore.

      • void ClearIgnoreList()
      Clears the list of addresses to ignore.

      • int AddToAcceptList(const RTPAddress &addr)
      Adds addr to the list of addresses to accept.

      • int DeleteFromAcceptList(const RTPAddress &addr)
      Deletes addr from the list of addresses to accept.

      • void ClearAcceptList()
      Clears the list of addresses to accept.

      • int SetMaximumPacketSize(size t s)
      Sets the maximum allowed packet size to s.

      • int SetSessionBandwidth(double bw)
      Sets the session bandwidth to bw, which is specified in bytes per second.

      • int SetTimestampUnit(double u)
      Sets our own timestamp unit to u. The timestamp unit is defined as a time
interval divided by the number of samples in that interval: for 8000Hz
audio this would be 1.0/8000.0.

      • void SetNameInterval(int count)
      在处理source table中的sourcese后,RTCP packet builder(我们不用理这个内部的东西Q会(x)查是否有其它Qnon-CNAME)SDES目要发送。如果count为零或负敎ͼ则不发送,如果count为正敎ͼ则在sources table处理countơ后?x)把SDES name item加到当前RTCP包中?span style="COLOR: rgb(255,153,0)">ps: 其实每次处理sources table都会(x)伴随都SDES RTCP数据包的发送,在这个数据包当中CNAME是必ȝQ但其它的项目不是必ȝQ这函数确定了NAME目发送的频度Q如果ؓ(f)1Q则表不每个 SDES RTCP数据包都带着它,如果?则每两个SDES数据包就发送一ơNAME目Q下面的SetEMailInterval?SetLocationInterval、SetPhoneInterval、SetToolInterval、SetNoteInterval都是同一原理。关于这个ITEM的描qͼL(fng)RFC3550.老版本的JRTPLIB没有使用q套函数Q而是用EnableSendName(){函数?br>
      • void SetEMailInterval(int count)
      After all possible sources in the source table have been processed, the RTCP
packet builder will check if other (non-CNAME) SDES items need to be
sent. If count is zero or negative, nothing will happen. If count is positive,
an SDES e-mail item will be added after the sources in the source table
have been processed count times.

      • void SetLocationInterval(int count)
      After all possible sources in the source table have been processed, the RTCP
packet builder will check if other (non-CNAME) SDES items need to be
sent. If count is zero or negative, nothing will happen. If count is positive,
an SDES location item will be added after the sources in the source table
have been processed count times.

      • void SetPhoneInterval(int count)
      After all possible sources in the source table have been processed, the RTCP
packet builder will check if other (non-CNAME) SDES items need to be
sent. If count is zero or negative, nothing will happen. If count is positive,
an SDES phone item will be added after the sources in the source table
have been processed count times.

      • void SetToolInterval(int count)
      After all possible sources in the source table have been processed, the RTCP
packet builder will check if other (non-CNAME) SDES items need to be
sent. If count is zero or negative, nothing will happen. If count is positive,
an SDES tool item will be added after the sources in the source table have
been processed count times.

      • void SetNoteInterval(int count)
      After all possible sources in the source table have been processed, the RTCP
packet builder will check if other (non-CNAME) SDES items need to be
sent. If count is zero or negative, nothing will happen. If count is positive,
an SDES note item will be added after the sources in the source table have
been processed count times.

      • int SetLocalName(const void *s, size t len)
      讄NAME SDES目Q以遍会(x)议的其它人员看到你的名称。下同?br>     
      • int SetLocalEMail(const void *s, size t len)
      Sets the SDES e-mail item for the local participant to the value s with
length len.

      • int SetLocalLocation(const void *s, size t len)
Sets the SDES location item for the local participant to the value s with
length len.

      • int SetLocalPhone(const void *s, size t len)
      Sets the SDES phone item for the local participant to the value s with
length len.

      • int SetLocalTool(const void *s, size t len)
      Sets the SDES tool item for the local participant to the value s with length
len.
      
      • int SetLocalNote(const void *s, size t len)
Sets the SDES note item for the local participant to the value s with length
len.
In case you specified in the constructor that you want to use your own transmission
component, you should override the following function:
      • RTPTransmitter *NewUserDefinedTransmitter()
      The RTPTransmitter instance returned by this function will then be used to send
and receive RTP and RTCP packets. Note that when the session is destroyed,
this RTPTransmitter instance will be destroyed with a delete call.
By inheriting your own class from RTPSession and overriding one or more of the
functions below, certain events can be detected:

      • void OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime, const  RTPAddress *senderaddress)
      如果有RTPPacket数据包来刎ͼ?x)调用这个函数处理?span style="COLOR: rgb(255,153,0)">ps:q个函数在我们承RTPSessioncL很可能重载,q是获取RTP数据包除了上面所说的Ҏ(gu)以外的另外一U方法,q个Ҏ(gu)比较适合异步的情c默认这个是一个空虚函数。除了这个函C外,下面的几个函C?x)经帔R载?/span>

      • void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
      Is called when an incoming RTCP packet is about to be processed.

      • void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp)
      Is called when an SSRC collision was detected. The instance srcdat is the
one present in the table, the address senderaddress is the one that collided
with one of the addresses and isrtp indicates against which address
of srcdat the check failed.
      
      • void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8 t *cname, size t cnamelength)
      Is called when another CNAME was received than the one already present for source srcdat.

      • void OnNewSource(RTPSourceData *srcdat)
      当有一个新的条目加到source tableӞ调用q个函数?span style="COLOR: rgb(255,153,0)">ps: q也是一个比较重要的函数Q因意味着很有可能有一个新的与?x)者加入。但令我很不高兴的是Q这时候的RTPSourceData 里头的CNAME和NAME{字D都q是无效的,q不是RTCP的责任,因ؓ(f)在这个SDES RTCP数据包中所有的信息都以l有了(通过抓包证实了这一点)。我们的函数被调用后Q需要g时一?x)才能得到有兌个Source的CNAME和NAME {相关的信息。当Ӟ如果你不惌Y件死掉,不能在这个函C内以d的方式g时?br>
      • void OnRemoveSource(RTPSourceData *srcdat)
      当有一个条目从source table中移除时调用q个函数?span style="COLOR: rgb(255,153,0)">psQ这通常意味着有一个与?x)者离开了,和OnNewSource不一Pq时的CNAME和NAME{都是有效的。用q个函数要注意,我们?#8220;意味着两个?#8221; 因ؓ(f)“加入”的可能不是一个新的与?x)者,而是一个现有与?x)者的一个新的媒体流?#8220;d”的也可能不是一个与?x)者,而只是其中一个与?x)者的其中一个媒体流Q这两个函数只能l我们更C?x)者提供一个触发条件而已。当OnNewSource调用Ӟ我们要看看这个CNAME是不是以l在我们与会(x)者名单中Q如果不是,那就是一个新与会(x)者。同Ӟ如果OnRemoveSource被调用,则我们要看看q个CNAME的与?x)者还有没有其它的SourceQ如果没有了Q这个与?x)者才是真正离开。这么很ȝQ?那就对了Q那是现在的H323和SIP要做的事情-Q会(x)话管理?br>     
      • void OnTimeout(RTPSourceData *srcdat)
      Is called when participant srcdat is timed out.

      • void OnBYETimeout(RTPSourceData *srcdat)
      Is called when participant srcdat is timed after having sent a BYE packet.

      • void OnBYEPacket(RTPSourceData *srcdat)
      Is called when a BYE packet has been processed for source srcdat.

      • void OnAPPPacket(RTCPAPPPacket *apppacket, const RTPTime &receivetime,
const RTPAddress *senderaddress)
      In called when an RTCP APP packet apppacket has been received at time
receivetime from address senderaddress.

      • void OnUnknownPacketType(RTCPPacket *rtcppack, const RTPTime &receivetime,
const RTPAddress *senderaddress)
      Is called when an unknown RTCP packet type was detected.

      • void OnUnknownPacketFormat(RTCPPacket *rtcppack, const RTPTime &receivetime,
const RTPAddress *senderaddress)
      Is called when an unknown packet format for a known packet type was
detected.

      • void OnNoteTimeout(RTPSourceData *srcdat)
      Is called when the SDES NOTE item for source srcdat has been timed out.

      • void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack)
      Is called when an RTCP compound packet has just been sent. Useful to
inspect outgoing RTCP data.

      • void OnPollThreadError(int errcode)
      Is called when error errcode was detected in the poll thread.

      • void OnPollThreadStep()
      Is called each time the poll thread loops. This happens when incoming data
was detected or when its time to send an RTCP compound packet.

发送者报告(SR)

V| P| RC| PT=SR=200| LEN|


发送者SSRC Q已兌Q?/font>


NTP旉戻I?2位) SR_GetNTPTimestamp ()

 

NTP旉戻I?2位)


RTP旉?span class=Apple-tab-span style="WHITE-SPACE: pre"> SR_GetRTPTimestamp () 

 


发送者分l计数器 SR_GetPacketCountQ)

 


发送者字节计数器 SR_GetByteCount ()

 


...(下面是这个发送者所发送的接收者报告,在下面和RR一赯论)

 


附加信息Q?/font>

q个源是否有发送发送者报?/font>

SR_HasInfo ()

q个发送者报告接收的旉

SR_GetReceiveTime ()

以及以SR_Prev_开头的Q获得倒数W二个发送者报告的信息?/span>



接收者报告(RR)

V| P| RC| PT=SR=201| LEN|


 

SSRC1(W一个接收者报告块所兌的发送者) Q已兌Q?/span>

分组丢失?span class=Apple-tab-span style="WHITE-SPACE: pre">
| 丢失分组L|

扩展的最高序?/div>

间隔抖动

最新的发送者报告时间戳QLSR)

SR最新间隔(DLSR)

附加信息Q?/span>
q个源是否有发送接收者报?/span>
接收者报告接收时?/div>
以及以RR_Prev_开头的Q获得倒数W二个接收者报告的信息?/span>


黑色天 2009-06-26 13:13 发表评论
]]>
YUV格式详细解释与FFMPEG的关p?/title><link>http://www.shnenglu.com/bangle/archive/2009/06/08/87070.html</link><dc:creator>黑色天</dc:creator><author>黑色天</author><pubDate>Mon, 08 Jun 2009 07:23:00 GMT</pubDate><guid>http://www.shnenglu.com/bangle/archive/2009/06/08/87070.html</guid><wfw:comment>http://www.shnenglu.com/bangle/comments/87070.html</wfw:comment><comments>http://www.shnenglu.com/bangle/archive/2009/06/08/87070.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/bangle/comments/commentRss/87070.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/bangle/services/trackbacks/87070.html</trackback:ping><description><![CDATA[<div class="ma2sss6" id=art width="100%"> <p align=left><strong><span>YUV</span></strong><strong><span>主要的采h?/span></strong><strong><span> </span></strong></p> <p align=left><span>主要的采h式有</span><span>YCbCr 4:2:0</span><span>?/span><span>YCbCr 4:2:2</span><span>?/span><span>YCbCr 4:1:1</span><span>?/span><span> YCbCr 4:4:4</span><span>。其?/span><span>YCbCr 4:1:1 </span><span>比较常用Q其含义为:(x)每个点保存一?/span><span> 8bit </span><span>的亮度?/span><span>(</span><span>也就?/span><span>Y</span><span>?/span><span>), </span><span>?/span><span> 2x2 </span><span>个点保存一?/span><span> Cr </span><span>?/span><span>Cb </span><span>?/span><span>, </span><span>囑փ在肉g的感觉不?x)v太大的变化。所?/span><span>, </span><span>原来?/span><span> RGB(R,G,B </span><span>都是</span><span> 8bit unsigned) </span><span>模型</span><span>, 4 </span><span>个点需?/span><span> 8x3=24 bites</span><span>Q如下图W一个图Q?/span><span>. </span><span>而现在仅需?/span><span> 8+(8/4)+(8/4)=12bites, </span><span>q_每个点占</span><span>12bites(</span><span>如下囄二个?/span><span>)</span><span>。这样就把图像的数据压羃了一半?/span><span> </span></p> <p align=left><strong><span>    </span></strong><strong><span>上边仅给Z理论上的CZQ在实际数据存储中是有可能是不同的,下面l出几种具体的存储Ş式:(x)</span></strong><strong><span> </span></strong></p> <p align=left><span>Q?/span><span>1</span><span>Q?/span><span>    <strong>YUV 4:4:4</strong> </span></p> <p align=left><span>YUV</span><span>三个信道的抽L(fng)相同Q因此在生成的图像里Q每个象素的三个分量信息完整Q每个分量通常</span><span>8</span><span>比特Q,l过</span><span>8</span><span>比特量化之后Q未l压~的每个像素占用</span><span>3</span><span>个字节?/span><span> </span></p> <p align=left><span>下面的四个像素ؓ(f)</span><span>: [Y<sub>0</sub> U<sub>0</sub> V<sub>0</sub>] [Y<sub>1</sub> U<sub>1</sub> V<sub>1</sub>] [Y<sub>2</sub> U<sub>2</sub> V<sub>2</sub>] [Y<sub>3</sub> U<sub>3</sub> V<sub>3</sub>] </span></p> <p align=left><span>存放的码ؓ(f)<span>: Y<sub>0</sub> U<sub>0</sub> V<sub>0</sub> Y<sub>1</sub> U<sub>1</sub> V<sub>1</sub> Y<sub>2</sub> U<sub>2</sub> V<sub>2</sub> Y<sub>3</sub> U<sub>3</sub> V<sub>3</sub></span></span></p> <p align=left><strong><span>Q?span>2</span>Q?span>   YUV 4:2:2</span></span></strong></p> <p align=left><span>      </span><span>每个色差信道的抽L(fng)是亮度信道的一半,所以水qx向的色度抽样率只?span>4:4:4</span>的一半。对非压~的<span>8</span>比特量化的图像来_(d)每个׃个水qx向相?c)像素l成的宏像素需要占?span>4</span>字节内存?/span></p> <p align=left><span>下面的四个像素ؓ(f)</span><span>: [Y<sub>0</sub> U<sub>0</sub> V<sub>0</sub>] [Y<sub>1</sub> U<sub>1</sub> V<sub>1</sub>] [Y<sub>2</sub> U<sub>2</sub> V<sub>2</sub>] [Y<sub>3</sub> U<sub>3</sub> V<sub>3</sub>] </span></p> <p align=left><span>存放的码ؓ(f)<span>: Y<sub>0</sub> U<sub>0</sub> Y<sub>1</sub> V<sub>1</sub> Y<sub>2</sub> U<sub>2</sub> Y<sub>3</sub> V<sub>3</sub></span></span></p> <p align=left><span>映射出像素点为:(x)<span>[Y<sub>0</sub> U<sub>0</sub> V<sub>1</sub>] [Y<sub>1</sub> U<sub>0</sub> V<sub>1</sub>] [Y<sub>2</sub> U<sub>2</sub> V<sub>3</sub>] [Y<sub>3</sub> U<sub>2</sub> V<sub>3</sub>]<strong></strong></span></span></p> <p align=left><strong><span>Q?span>3</span>Q?span>   YUV 4:1:1</span></span></strong></p> <p align=left><span>4:1:1</span><span>的色度抽P是在水^方向上对色度q行<span>4:1</span>抽样。对于低端用户和消费cM品这仍然是可以接受的。对非压~的<span>8</span>比特量化的视频来_(d)每个?span>4</span>个水qx向相?c)像素l成的宏像素需要占?span>6</span>字节内存<strong></strong></span></p> <p align=left><span>下面的四个像素ؓ(f)</span><span>: [Y<sub>0</sub> U<sub>0</sub> V<sub>0</sub>] [Y<sub>1</sub> U<sub>1</sub> V<sub>1</sub>] [Y<sub>2</sub> U<sub>2</sub> V<sub>2</sub>] [Y<sub>3</sub> U<sub>3</sub> V<sub>3</sub>] </span></p> <p align=left><span>存放的码ؓ(f)<span>: Y<sub>0</sub> U<sub>0</sub> Y<sub>1</sub> Y<sub>2</sub> V<sub>2</sub> Y<sub>3</sub></span></span></p> <p align=left><span>映射出像素点为:(x)<span>[Y<sub>0</sub> U<sub>0</sub> V<sub>2</sub>] [Y<sub>1</sub> U<sub>0</sub> V<sub>2</sub>] [Y<sub>2</sub> U<sub>0</sub> V<sub>2</sub>] [Y<sub>3</sub> U<sub>0</sub> V<sub>2</sub>]</span></span></p> <p align=left><strong><span>Q?span>4</span>Q?span>YUV4:2:0</span></span></strong></p> <p align=left><span>     4:2:0</span><span>q不意味着只有<span>Y,Cb</span>而没?span>Cr</span>分量。它指得是对每行扫描U来_(d)只有一U色度分量以<span>2:1</span>的抽L(fng)存储。进行隔行扫描,盔R的扫描行存储不同的色度分量,也就是说Q如果一行是<span>4:2:0</span>的话Q下一行就?span>4:0:2</span>Q再下一行是<span>4:2:0...</span>以此cL。对每个色度分量来说Q水qx向和竖直方向的抽L(fng)都是<span>2:1</span>Q所以可以说色度的抽L(fng)?span>4:1</span>。对非压~的<span>8</span>比特量化的视频来_(d)每个?span>2x2</span>?span>2</span>?span>2</span>列相?c)像素l成的宏像素需要占?span>6</span>字节内存?/span></p> <p align=left><span>下面八个像素为:(x)<span>[Y<sub>0</sub> U<sub>0</sub> V<sub>0</sub>] [Y<sub>1</sub> U<sub>1</sub> V<sub>1</sub>] [Y<sub>2</sub> U<sub>2</sub> V<sub>2</sub>] [Y<sub>3</sub> U<sub>3</sub> V<sub>3</sub>]</span></span></p> <p align=left><span>                [Y<sub>5</sub> U<sub>5</sub> V<sub>5</sub>] [Y<sub>6</sub> U<sub>6</sub> V<sub>6</sub>] [Y<sub>7</sub>U<sub>7</sub> V<sub>7</sub>] [Y<sub>8</sub> U<sub>8</sub> V<sub>8</sub>]</span></p> <p align=left><span>存放的码ؓ(f)Q?span>Y<sub>0</sub> U<sub>0</sub> Y<sub>1</sub> Y<sub>2</sub> U<sub>2</sub> Y<sub>3</sub></span></span></p> <p align=left><sub><span>                     </span></sub><span>Y<sub>5 </sub>V<sub>5</sub> Y<sub>6</sub> Y<sub>7</sub> V<sub>7</sub> Y<sub>8</sub></span></p> <p align=left><span>映射出的像素点ؓ(f)Q?span>[Y<sub>0</sub> U<sub>0</sub> V<sub>5</sub>] [Y<sub>1</sub> U<sub>0</sub> V<sub>5</sub>] [Y<sub>2</sub> U<sub>2</sub> V<sub>7</sub>] [Y<sub>3</sub> U<sub>2</sub> V<sub>7</sub>]</span></span></p> <span>                  [Y<sub>5</sub> U<sub>0</sub> V<sub>5</sub>] [Y<sub>6</sub> U<sub>0</sub> V<sub>5</sub>] [Y<sub>7</sub>U<sub>2</sub> V<sub>7</sub>] [Y<sub>8</sub> U<sub>2</sub> V<sub>7</sub>]</span> <br><br> <p>对应AVPicture里面有data[4]和linesize[4]其中data是一个指向指针的指针Q二U、二l指针)Q也是指向视频数据~冲区的首地址Q而data[0]~data[3]是一U指针,可以用如下的图来表示Q?</p> <p>data -->xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br>        ^                ^              ^<br>        |                |              |<br>         data[0]      data[1]         data[2]<br></p> <p>比如_(d)当pix_fmt=PIX_FMT_YUV420PӞdata中的数据是按照YUV的格式存储的Q也是Q?</p> <pre>data -->YYYYYYYYYYYYYYUUUUUUUUUUUUUVVVVVVVVVVVV ^ ^ ^ | | | data[0] data[1] data[2] </pre> <p>linesize是指对应于每一行的大小Qؓ(f)什么需要这个变量,是因为在YUV格式和RGB格式Ӟ每行的大不一定等于图像的宽度Q对于RGB格式输出?只有一个通道(bgrbgrbgr......)可用Q即linesize[0],和data[0],so RGB24 : data[0] = packet rgb//bgrbgrbgr...... </p> <pre>linesize[0] = width*3 </pre> <p>其他的如data[1][2][3]与linesize[1][2][3]无Q何意? </p> <p>而对于YQ)格式输出Ӟ有三个通道可用Q即data[0][1][2],与linesize[0][1][2]Q而yuv格式对于q动估计Ӟ需要填充padding(right, bottom),故:(x) </p> <pre>linesize=width+padding size(16+16). ///////////////////////////////////////////////////////////////////////////////////////</pre> <pre><br>   case PIX_FMT_YUV420P:<br>   case PIX_FMT_YUVJ420P:<br>   case PIX_FMT_RGB555:<br>    if (PIC_DIRECTION_0 == m_dwFilpPicDirection)<br>    {<br>     m_pYuvFrame->data [0] += m_pYuvFrame->linesize[0] *  m_pVCodecContext->height;<br>     //因ؓ(f)是隔行扫描U与V只有高度的一?br>     m_pYuvFrame->data [1] += m_pYuvFrame->linesize[1] *  m_pVCodecContext->height/2;<br>     m_pYuvFrame->data [2] += m_pYuvFrame->linesize[2] *  m_pVCodecContext->height/2;<br>     m_pYuvFrame->linesize[0] = -m_pYuvFrame->linesize[0];<br>     m_pYuvFrame->linesize[1] = -m_pYuvFrame->linesize[1];<br>     m_pYuvFrame->linesize[2] = -m_pYuvFrame->linesize[2];<br>    }<br>    <br>    break;<br>   case PIX_FMT_YUVJ422P:<br>   case PIX_FMT_YUV422P:<br>   case PIX_FMT_YUYVJ422:<br>   case PIX_FMT_YUV411P:<br>   case PIX_FMT_YUYV422:  <br>    if (PIC_DIRECTION_0 == m_dwFilpPicDirection)<br>    {<br>     m_pYuvFrame->data [0] += m_pYuvFrame->linesize[0] *  m_pVCodecContext->height;<br>     m_pYuvFrame->data [1] += m_pYuvFrame->linesize[1] *  m_pVCodecContext->height;<br>     m_pYuvFrame->data [2] += m_pYuvFrame->linesize[2] *  m_pVCodecContext->height;<br>     m_pYuvFrame->linesize[0] = -m_pYuvFrame->linesize[0];<br>     m_pYuvFrame->linesize[1] = -m_pYuvFrame->linesize[1];<br>     m_pYuvFrame->linesize[2] = -m_pYuvFrame->linesize[2];<br>    }<br>    break;<br>   }<br>在FFMPEG中{换RGB旉侉K倒图像的方向法<br></pre> </div> <img src ="http://www.shnenglu.com/bangle/aggbug/87070.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/bangle/" target="_blank">黑色天</a> 2009-06-08 15:23 <a href="http://www.shnenglu.com/bangle/archive/2009/06/08/87070.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>点数运汇~指?/title><link>http://www.shnenglu.com/bangle/archive/2009/03/11/76200.html</link><dc:creator>黑色天</dc:creator><author>黑色天</author><pubDate>Wed, 11 Mar 2009 03:40:00 GMT</pubDate><guid>http://www.shnenglu.com/bangle/archive/2009/03/11/76200.html</guid><wfw:comment>http://www.shnenglu.com/bangle/comments/76200.html</wfw:comment><comments>http://www.shnenglu.com/bangle/archive/2009/03/11/76200.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/bangle/comments/commentRss/76200.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/bangle/services/trackbacks/76200.html</trackback:ping><description><![CDATA[     摘要:   <a href='http://www.shnenglu.com/bangle/archive/2009/03/11/76200.html'>阅读全文</a><img src ="http://www.shnenglu.com/bangle/aggbug/76200.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/bangle/" target="_blank">黑色天</a> 2009-03-11 11:40 <a href="http://www.shnenglu.com/bangle/archive/2009/03/11/76200.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>2?9http://www.shnenglu.com/bangle/archive/2009/02/19/74302.html黑色天黑色天Thu, 19 Feb 2009 07:56:00 GMThttp://www.shnenglu.com/bangle/archive/2009/02/19/74302.htmlhttp://www.shnenglu.com/bangle/comments/74302.htmlhttp://www.shnenglu.com/bangle/archive/2009/02/19/74302.html#Feedback0http://www.shnenglu.com/bangle/comments/commentRss/74302.htmlhttp://www.shnenglu.com/bangle/services/trackbacks/74302.html不经打击老天真,
自古英雄出炼狱,
从来富贵落凡,
醉生梦死谁成器,
破马长枪乾坤?

黑色天 2009-02-19 15:56 发表评论
]]>
汇编指o(h)与花指o(h)http://www.shnenglu.com/bangle/archive/2009/02/17/74023.html黑色天黑色天Tue, 17 Feb 2009 04:44:00 GMThttp://www.shnenglu.com/bangle/archive/2009/02/17/74023.htmlhttp://www.shnenglu.com/bangle/comments/74023.htmlhttp://www.shnenglu.com/bangle/archive/2009/02/17/74023.html#Feedback0http://www.shnenglu.com/bangle/comments/commentRss/74023.htmlhttp://www.shnenglu.com/bangle/services/trackbacks/74023.html阅读全文

黑色天 2009-02-17 12:44 发表评论
]]>
情h节也加班http://www.shnenglu.com/bangle/archive/2009/02/14/73784.html黑色天黑色天Sat, 14 Feb 2009 05:47:00 GMThttp://www.shnenglu.com/bangle/archive/2009/02/14/73784.htmlhttp://www.shnenglu.com/bangle/comments/73784.htmlhttp://www.shnenglu.com/bangle/archive/2009/02/14/73784.html#Feedback0http://www.shnenglu.com/bangle/comments/commentRss/73784.htmlhttp://www.shnenglu.com/bangle/services/trackbacks/73784.html阅读全文

黑色天 2009-02-14 13:47 发表评论
]]>
뾫Ʒþһ| 97þþƷһ| ŷСþþþþþ| ۺϾþþƷɫ| ɫ88þþþø߳ۺӰԺ| þù鶹91| պŷһþþþ| þۺϸþúݺ97ɫ| þþþӰԺС | ۺ˾þۺ| þøݾƷԴվ| ޾ƷƵþþ| Ʒһþ㽶߿ۿ | һձþþ| ޹˾Ʒ91þþ| ˾þAV| ˾ҹվھƷþþþþþþ | ɫ꼤þۺ| ͵ٸþþþþþþ| AëƬþþƷ| AVþþþò| þǿdŮվ| þþƷоƷ| ŷսþþþþþþ| þþWWWѾƷ| þԭƷ| þAV | Ʒþþ| ҹƷþþþþëƬ| þþþþþþ˳| þ¶Ʒ| þûƵ| þþþ?V| þ㽶߿ۿ| 99þ뾫Ʒϵ| ޾ƷþþþĻһڣ| þоƷ| þþþ߽ۺϳ | վþþ| ˾ƷþѶ| þþƷ77777|