<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Dirac Video Codec</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <h1 align="center" color="#606080"> Dirac - A Video Codec </h1> <p align="center"> Created by the <a href="http://www.bbc.co.uk">British Broadcasting Corporation</a>. </p> <hr> <!-- Generated by Doxygen 1.5.9 --> <h1>picture_byteio.h</h1><a href="a00214.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* ***** BEGIN LICENSE BLOCK *****</span> <a name="l00002"></a>00002 <span class="comment">*</span> <a name="l00003"></a>00003 <span class="comment">* $Id: picture_byteio.h,v 1.1 2008/01/31 11:25:15 tjdwave Exp $ $Name: Dirac_1_0_2 $</span> <a name="l00004"></a>00004 <span class="comment">*</span> <a name="l00005"></a>00005 <span class="comment">* Version: MPL 1.1/GPL 2.0/LGPL 2.1</span> <a name="l00006"></a>00006 <span class="comment">*</span> <a name="l00007"></a>00007 <span class="comment">* The contents of this file are subject to the Mozilla Public License</span> <a name="l00008"></a>00008 <span class="comment">* Version 1.1 (the "License"); you may not use this file except in compliance</span> <a name="l00009"></a>00009 <span class="comment">* with the License. You may obtain a copy of the License at</span> <a name="l00010"></a>00010 <span class="comment">* http://www.mozilla.org/MPL/</span> <a name="l00011"></a>00011 <span class="comment">*</span> <a name="l00012"></a>00012 <span class="comment">* Software distributed under the License is distributed on an "AS IS" basis,</span> <a name="l00013"></a>00013 <span class="comment">* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for</span> <a name="l00014"></a>00014 <span class="comment">* the specific language governing rights and limitations under the License.</span> <a name="l00015"></a>00015 <span class="comment">*</span> <a name="l00016"></a>00016 <span class="comment">* The Original Code is BBC Research and Development code.</span> <a name="l00017"></a>00017 <span class="comment">*</span> <a name="l00018"></a>00018 <span class="comment">* The Initial Developer of the Original Code is the British Broadcasting</span> <a name="l00019"></a>00019 <span class="comment">* Corporation.</span> <a name="l00020"></a>00020 <span class="comment">* Portions created by the Initial Developer are Copyright (C) 2004.</span> <a name="l00021"></a>00021 <span class="comment">* All Rights Reserved.</span> <a name="l00022"></a>00022 <span class="comment">*</span> <a name="l00023"></a>00023 <span class="comment">* Contributor(s): Andrew Kennedy (Original Author)</span> <a name="l00024"></a>00024 <span class="comment">* Anuradha Suraparaju</span> <a name="l00025"></a>00025 <span class="comment">*</span> <a name="l00026"></a>00026 <span class="comment">* Alternatively, the contents of this file may be used under the terms of</span> <a name="l00027"></a>00027 <span class="comment">* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser</span> <a name="l00028"></a>00028 <span class="comment">* Public License Version 2.1 (the "LGPL"), in which case the provisions of</span> <a name="l00029"></a>00029 <span class="comment">* the GPL or the LGPL are applicable instead of those above. If you wish to</span> <a name="l00030"></a>00030 <span class="comment">* allow use of your version of this file only under the terms of the either</span> <a name="l00031"></a>00031 <span class="comment">* the GPL or LGPL and not to allow others to use your version of this file</span> <a name="l00032"></a>00032 <span class="comment">* under the MPL, indicate your decision by deleting the provisions above</span> <a name="l00033"></a>00033 <span class="comment">* and replace them with the notice and other provisions required by the GPL</span> <a name="l00034"></a>00034 <span class="comment">* or LGPL. If you do not delete the provisions above, a recipient may use</span> <a name="l00035"></a>00035 <span class="comment">* your version of this file under the terms of any one of the MPL, the GPL</span> <a name="l00036"></a>00036 <span class="comment">* or the LGPL.</span> <a name="l00037"></a>00037 <span class="comment">* ***** END LICENSE BLOCK ***** */</span> <a name="l00038"></a>00038 <a name="l00042"></a>00042 <span class="preprocessor">#ifndef picture_byteio_h</span> <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define picture_byteio_h</span> <a name="l00044"></a>00044 <span class="preprocessor"></span> <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="comment">//LOCAL INCLUDES</span> <a name="l00047"></a>00047 <span class="preprocessor">#include <<a class="code" href="a00210.html">libdirac_byteio/parseunit_byteio.h</a>></span> <span class="comment">// Parent class</span> <a name="l00048"></a>00048 <span class="preprocessor">#include <<a class="code" href="a00205.html">libdirac_byteio/mvdata_byteio.h</a>></span> <span class="comment">// Contains mvdata streams</span> <a name="l00049"></a>00049 <span class="preprocessor">#include <<a class="code" href="a00230.html">libdirac_byteio/transform_byteio.h</a>></span> <span class="comment">// Transform header</span> <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="comment">// DIRAC includes</span> <a name="l00052"></a>00052 <span class="preprocessor">#include <<a class="code" href="a00171.html">libdirac_common/common.h</a>></span> <span class="comment">// PictureType etc</span> <a name="l00053"></a>00053 <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="keyword">namespace </span>dirac <a name="l00056"></a>00056 { <a name="l00060"></a><a class="code" href="a00110.html">00060</a> <span class="keyword">class </span><a class="code" href="a00110.html" title="A compressed picture in Dirac bytestream format.">PictureByteIO</a> : <span class="keyword">public</span> <a class="code" href="a00105.html" title="Represents a collection of data in a Dirac bytestream that can be parsed as a self-contained...">ParseUnitByteIO</a> <a name="l00061"></a>00061 { <a name="l00062"></a>00062 <span class="keyword">public</span>: <a name="l00063"></a>00063 <a name="l00069"></a>00069 <a class="code" href="a00110.html#ded0c5aec64c8c4f0197fff399ffbbf6" title="Constructor.">PictureByteIO</a>(<a class="code" href="a00113.html" title="Parameters for initialising picture class objects.">PictureParams</a>& frame_params, <a name="l00070"></a>00070 <span class="keywordtype">int</span> frame_num); <a name="l00071"></a>00071 <a name="l00072"></a>00072 <a name="l00078"></a>00078 <a class="code" href="a00110.html#ded0c5aec64c8c4f0197fff399ffbbf6" title="Constructor.">PictureByteIO</a>(<a class="code" href="a00113.html" title="Parameters for initialising picture class objects.">PictureParams</a>& frame_params, <a name="l00079"></a>00079 <span class="keyword">const</span> <a class="code" href="a00105.html" title="Represents a collection of data in a Dirac bytestream that can be parsed as a self-contained...">ParseUnitByteIO</a>& parseunit_byteio); <a name="l00080"></a>00080 <a name="l00084"></a>00084 <span class="keyword">virtual</span> <a class="code" href="a00110.html#af8b980fba582645d14114ed7d474a88" title="Destructor.">~PictureByteIO</a>(); <a name="l00085"></a>00085 <a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="a00110.html#6f02a5c3e1258dec9c0bbddb0e25261d" title="Gathers byte stats on the picture data.">CollateByteStats</a>(<a class="code" href="a00049.html" title="Class DiracByteStats - for collecting statistics on aspects of the Dirac byte-stream...">DiracByteStats</a>& dirac_byte_stats); <a name="l00091"></a>00091 <a name="l00095"></a>00095 <span class="keywordtype">bool</span> <a class="code" href="a00110.html#786a7c26086ad0790c2deda4a18eccf4" title="Inputs data from Dirac stream-format.">Input</a>(); <a name="l00096"></a>00096 <a name="l00100"></a>00100 <span class="keywordtype">void</span> <a class="code" href="a00110.html#70014350a972108c19fbf7faa0d60a26" title="Outputs picture values to Dirac stream-format.">Output</a>(); <a name="l00101"></a>00101 <a name="l00102"></a>00102 <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keyword">const</span> std::string <a class="code" href="a00110.html#37f755dbe495de8bdb338cdad3ff5da2" title="Gets string containing coded bytes.">GetBytes</a>(); <a name="l00105"></a>00105 <a name="l00106"></a>00106 <span class="keywordtype">int</span> <a class="code" href="a00110.html#2ab254941d52a0d84decc031cfe05b67" title="Gets size (in bytes).">GetSize</a>() <span class="keyword">const</span>; <a name="l00107"></a>00107 <a name="l00111"></a><a class="code" href="a00110.html#79e6312e3b6aa9a8f69eac16ad33b0c1">00111</a> <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afc">ParseUnitType</a> <a class="code" href="a00110.html#79e6312e3b6aa9a8f69eac16ad33b0c1" title="Gets parse-unit type.">GetType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00234.html#fa886465a1d19ed90cf29a1100040afca33fab0d42ec5cca1b69efbcd00e6c25">PU_PICTURE</a>;} <a name="l00112"></a>00112 <a name="l00116"></a><a class="code" href="a00110.html#e9861de2b635dd932ada061b73758db1">00116</a> <span class="keywordtype">int</span> <a class="code" href="a00110.html#e9861de2b635dd932ada061b73758db1" title="Returns true is picture in Reference picture.">IsRef</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="a00105.html#6d8fe0975e4934d7b6fa2f27ffba79fc" title="Get parse code.">GetParseCode</a>()&0x0C)==0x0C;} <a name="l00117"></a>00117 <a name="l00121"></a><a class="code" href="a00110.html#d839126a1597974a835ec5466a690e6b">00121</a> <span class="keywordtype">int</span> <a class="code" href="a00110.html#d839126a1597974a835ec5466a690e6b" title="Returns true is picture in Non-Reference picture.">IsNonRef</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="a00105.html#6d8fe0975e4934d7b6fa2f27ffba79fc" title="Get parse code.">GetParseCode</a>()&0x0C)==0x08;} <a name="l00122"></a>00122 <a name="l00126"></a><a class="code" href="a00110.html#a1ff13a8f6e52f60c46d9c461559e0ac">00126</a> <span class="keywordtype">int</span> <a class="code" href="a00110.html#a1ff13a8f6e52f60c46d9c461559e0ac" title="Gets parse-unit type.">NumRefs</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="a00105.html#6d8fe0975e4934d7b6fa2f27ffba79fc" title="Get parse code.">GetParseCode</a>()&0x03);} <a name="l00127"></a>00127 <a name="l00131"></a><a class="code" href="a00110.html#78abe287c0d50d99484430985f548802">00131</a> <span class="keywordtype">bool</span> <a class="code" href="a00110.html#78abe287c0d50d99484430985f548802" title="Returns true is picture is Intra picture.">IsIntra</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00105.html#b14750bd735d199159c6566d87bfbda6" title="Returns true is parse unit is Picture data.">IsPicture</a>() && (<a class="code" href="a00110.html#a1ff13a8f6e52f60c46d9c461559e0ac" title="Gets parse-unit type.">NumRefs</a>()==0) ; } <a name="l00132"></a>00132 <a name="l00136"></a><a class="code" href="a00110.html#cebab50d9410ad84512ea5231df33dfc">00136</a> <span class="keywordtype">bool</span> <a class="code" href="a00110.html#cebab50d9410ad84512ea5231df33dfc" title="Returns true is picture is Inter picture.">IsInter</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00105.html#b14750bd735d199159c6566d87bfbda6" title="Returns true is parse unit is Picture data.">IsPicture</a>() && (<a class="code" href="a00110.html#a1ff13a8f6e52f60c46d9c461559e0ac" title="Gets parse-unit type.">NumRefs</a>()>0) ; } <a name="l00137"></a>00137 <a name="l00138"></a>00138 <span class="comment">/***</span> <a name="l00139"></a>00139 <span class="comment"> * Sets the MVDataIO</span> <a name="l00140"></a>00140 <span class="comment"> */</span> <a name="l00141"></a><a class="code" href="a00110.html#8db3487aef0ed86b8bce6a189958aaa2">00141</a> <span class="keywordtype">void</span> <a class="code" href="a00110.html#8db3487aef0ed86b8bce6a189958aaa2">SetMvData</a>(<a class="code" href="a00094.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">MvDataByteIO</a> *mv_data) {<a class="code" href="a00110.html#22804681c20c28cd2f51158d78c91ac4" title="MV data.">m_mv_data</a> = mv_data; } <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="comment">/***</span> <a name="l00144"></a>00144 <span class="comment"> * Sets the TransformByteIo</span> <a name="l00145"></a>00145 <span class="comment"> */</span> <a name="l00146"></a><a class="code" href="a00110.html#33d683c236682f4167f690ffcb6072c1">00146</a> <span class="keywordtype">void</span> <a class="code" href="a00110.html#33d683c236682f4167f690ffcb6072c1">SetTransformData</a>(<a class="code" href="a00144.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">TransformByteIO</a> *transform_data) {<a class="code" href="a00110.html#25dcae1e94e26b4122261a076ebb2426" title="Transform data.">m_transform_data</a> = transform_data; } <a name="l00147"></a>00147 <a name="l00148"></a>00148 <span class="keyword">protected</span>: <a name="l00149"></a>00149 <a name="l00150"></a>00150 <a name="l00151"></a>00151 <span class="keyword">private</span>: <a name="l00152"></a>00152 <a name="l00157"></a>00157 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="a00110.html#019e36a260080a1f4826e904588b0a89" title="Calculates parse-code based on picture parameters.">CalcParseCode</a>() <span class="keyword">const</span>; <a name="l00158"></a>00158 <a name="l00162"></a>00162 <span class="keywordtype">void</span> <a class="code" href="a00110.html#b39972e6d1712ee17cc53f80eb032f63" title="Reads reference-picture data.">InputReferencePictures</a>(); <a name="l00163"></a>00163 <a name="l00167"></a>00167 <span class="keywordtype">void</span> <a class="code" href="a00110.html#0518eae7821b282af0d56a4e20fc817b" title="Reads retired picture number.">InputRetiredPicture</a>(); <a name="l00168"></a>00168 <a name="l00172"></a>00172 <span class="keywordtype">void</span> <a class="code" href="a00110.html#2589fd4c6867b13ae6fa18b6ac9c45f7" title="Calculates picture-type (eg INTRA/INTER) of picture.">SetPictureType</a>(); <a name="l00173"></a>00173 <a name="l00177"></a>00177 <span class="keywordtype">void</span> <a class="code" href="a00110.html#e7e06697780f0553cc13e79094f55abb" title="Calculates reference-type of picture.">SetReferenceType</a>(); <a name="l00178"></a>00178 <a name="l00182"></a>00182 <span class="keywordtype">void</span> <a class="code" href="a00110.html#df616b9bac7ac01be20b7cb625a96427" title="Sets the entropy coding flag in the picture parameters.">SetEntropyCodingFlag</a>(); <a name="l00183"></a>00183 <a name="l00187"></a><a class="code" href="a00110.html#0241936257bfa7be431ec537499964db">00187</a> <a class="code" href="a00113.html" title="Parameters for initialising picture class objects.">PictureParams</a>& <a class="code" href="a00110.html#0241936257bfa7be431ec537499964db" title="Picture parameters.">m_frame_params</a>; <a name="l00188"></a>00188 <a name="l00192"></a><a class="code" href="a00110.html#303b7695a3540bba69fac5b5235cb5df">00192</a> <span class="keywordtype">int</span> <a class="code" href="a00110.html#303b7695a3540bba69fac5b5235cb5df" title="Picture number.">m_frame_num</a>; <a name="l00193"></a>00193 <a name="l00197"></a><a class="code" href="a00110.html#22804681c20c28cd2f51158d78c91ac4">00197</a> <a class="code" href="a00094.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">MvDataByteIO</a> * <a class="code" href="a00110.html#22804681c20c28cd2f51158d78c91ac4" title="MV data.">m_mv_data</a>; <a name="l00198"></a>00198 <a name="l00202"></a><a class="code" href="a00110.html#25dcae1e94e26b4122261a076ebb2426">00202</a> <a class="code" href="a00144.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">TransformByteIO</a> * <a class="code" href="a00110.html#25dcae1e94e26b4122261a076ebb2426" title="Transform data.">m_transform_data</a>; <a name="l00203"></a>00203 <a name="l00204"></a>00204 }; <a name="l00205"></a>00205 <a name="l00206"></a>00206 } <span class="comment">// namespace dirac</span> <a name="l00207"></a>00207 <a name="l00208"></a>00208 <span class="preprocessor">#endif</span> </pre></div></div> <hr> <p align="center"><small> © 2004 British Broadcasting Corporation. Dirac code licensed under the <a href="http://www.mozilla.org/MPL/">Mozilla Public License (MPL) Version 1.1</a>.<br> HTML documentation generated by Dimitri van Heesch's excellent <a href="http://www.doxygen.org">Doxygen</a> tool. </small></p> </body> </html>