<!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.4 --> <h1>frame_byteio.h</h1><a href="a00187.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: frame_byteio.h,v 1.6 2007/11/16 04:50:47 asuraparaju Exp $ $Name: Dirac_0_9_1 $</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 frame_byteio_h</span> <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define frame_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="a00208.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="a00203.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="a00222.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="a00167.html">libdirac_common/common.h</a>></span> <span class="comment">// FrameType 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="a00074.html">00060</a> <span class="keyword">class </span><a class="code" href="a00074.html" title="A compressed frame in Dirac bytestream format.">FrameByteIO</a> : <span class="keyword">public</span> <a class="code" href="a00111.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="a00074.html#e1de1ac8e67d597e957f6ddf34966ee7" title="Constructor.">FrameByteIO</a>(<a class="code" href="a00078.html" title="Parameters for initialising frame class objects.">FrameParams</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="a00074.html#e1de1ac8e67d597e957f6ddf34966ee7" title="Constructor.">FrameByteIO</a>(<a class="code" href="a00078.html" title="Parameters for initialising frame class objects.">FrameParams</a>& frame_params, <a name="l00079"></a>00079 <span class="keyword">const</span> <a class="code" href="a00111.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="a00074.html#006913117d800027e2d2ec65c80693ad" title="Destructor.">~FrameByteIO</a>(); <a name="l00085"></a>00085 <a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="a00074.html#be98e0ab8c6120061abfa2b710e7e28c" title="Gathers byte stats on the frame data.">CollateByteStats</a>(<a class="code" href="a00052.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="a00074.html#72c20b5ee48b29d5f9d7a27373d2f69d" 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="a00074.html#1b1ed33a945479200a0499d5e46c2cca" title="Outputs frame 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="a00074.html#b1b90bbdecf3338a2dd0645a036095fb" 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="a00074.html#3a4912389170516a1dcd02b90e18389b" 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="a00074.html#2b1ea1918425504010de9de509dda4c7">00111</a> <a class="code" href="a00226.html#fa886465a1d19ed90cf29a1100040afc">ParseUnitType</a> <a class="code" href="a00074.html#2b1ea1918425504010de9de509dda4c7" title="Gets parse-unit type.">GetType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00226.html#fa886465a1d19ed90cf29a1100040afca521ac28a076cd440878d2169f609c79">PU_FRAME</a>;} <a name="l00112"></a>00112 <a name="l00116"></a><a class="code" href="a00074.html#d8dcd2bb3b30f02b41b2a21331b299e3">00116</a> <span class="keywordtype">int</span> <a class="code" href="a00074.html#d8dcd2bb3b30f02b41b2a21331b299e3" title="Returns true is frame in Reference frame.">IsRef</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="a00111.html#6d8fe0975e4934d7b6fa2f27ffba79fc" title="Get parse code.">GetParseCode</a>()&0x0C)==0x0C;} <a name="l00117"></a>00117 <a name="l00121"></a><a class="code" href="a00074.html#10c4dc293c05a68d2992a59db25df9b7">00121</a> <span class="keywordtype">int</span> <a class="code" href="a00074.html#10c4dc293c05a68d2992a59db25df9b7" title="Returns true is frame in Non-Reference frame.">IsNonRef</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="a00111.html#6d8fe0975e4934d7b6fa2f27ffba79fc" title="Get parse code.">GetParseCode</a>()&0x0C)==0x08;} <a name="l00122"></a>00122 <a name="l00126"></a><a class="code" href="a00074.html#b2dbb65ef92797775740fc64252fff0e">00126</a> <span class="keywordtype">int</span> <a class="code" href="a00074.html#b2dbb65ef92797775740fc64252fff0e" title="Gets parse-unit type.">NumRefs</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="a00111.html#6d8fe0975e4934d7b6fa2f27ffba79fc" title="Get parse code.">GetParseCode</a>()&0x03);} <a name="l00127"></a>00127 <a name="l00131"></a><a class="code" href="a00074.html#09c6d3b2ec213c2080165301360a885b">00131</a> <span class="keywordtype">bool</span> <a class="code" href="a00074.html#09c6d3b2ec213c2080165301360a885b" title="Returns true is frame is Intra frame.">IsIntra</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00111.html#b14750bd735d199159c6566d87bfbda6" title="Returns true is parse unit is Picture data.">IsPicture</a>() && (<a class="code" href="a00074.html#b2dbb65ef92797775740fc64252fff0e" title="Gets parse-unit type.">NumRefs</a>()==0) ; } <a name="l00132"></a>00132 <a name="l00136"></a><a class="code" href="a00074.html#072c49e731a6063f6d566ccac860304a">00136</a> <span class="keywordtype">bool</span> <a class="code" href="a00074.html#072c49e731a6063f6d566ccac860304a" title="Returns true is frame is Inter frame.">IsInter</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00111.html#b14750bd735d199159c6566d87bfbda6" title="Returns true is parse unit is Picture data.">IsPicture</a>() && (<a class="code" href="a00074.html#b2dbb65ef92797775740fc64252fff0e" 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="a00074.html#4ed0ec671f1df41b298c9dd99c2083ac">00141</a> <span class="keywordtype">void</span> <a class="code" href="a00074.html#4ed0ec671f1df41b298c9dd99c2083ac">SetMvData</a>(<a class="code" href="a00102.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">MvDataByteIO</a> *mv_data) {<a class="code" href="a00074.html#25e5bdbd7b0037b5636299c5ffdd2577" 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="a00074.html#aa05becaa43479455b5799701382f034">00146</a> <span class="keywordtype">void</span> <a class="code" href="a00074.html#aa05becaa43479455b5799701382f034">SetTransformData</a>(<a class="code" href="a00138.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">TransformByteIO</a> *transform_data) {<a class="code" href="a00074.html#ce703ca238f4e21e7448141d29c7ae65" 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="a00074.html#a6c37c40d54a2149bfdd291c222dbfe6" title="Calculates parse-code based on frame 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="a00074.html#e39d82e329ed6e470264155c2ad4fd03" title="Reads reference-frame data.">InputReferencePictures</a>(); <a name="l00163"></a>00163 <a name="l00167"></a>00167 <span class="keywordtype">void</span> <a class="code" href="a00074.html#8cd1ee591c819a9bab0f4b21016c3412" 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="a00074.html#65281beffe13c9a5feabbf33942b350b" title="Calculates frame-type (eg INTRA/INTER) of frame.">SetFrameType</a>(); <a name="l00173"></a>00173 <a name="l00177"></a>00177 <span class="keywordtype">void</span> <a class="code" href="a00074.html#a3128b370b8d9be7717fdc93ec1012a5" title="Calculates reference-type of frame.">SetReferenceType</a>(); <a name="l00178"></a>00178 <a name="l00182"></a>00182 <span class="keywordtype">void</span> <a class="code" href="a00074.html#92219d5018d25286d3a00a0bdbdfe7a5" title="Sets the entropy coding flag in the frame parameters.">SetEntropyCodingFlag</a>(); <a name="l00183"></a>00183 <a name="l00187"></a><a class="code" href="a00074.html#9bcc979188e36fc69fe12ff3097c035f">00187</a> <a class="code" href="a00078.html" title="Parameters for initialising frame class objects.">FrameParams</a>& <a class="code" href="a00074.html#9bcc979188e36fc69fe12ff3097c035f" title="Frame parameters.">m_frame_params</a>; <a name="l00188"></a>00188 <a name="l00192"></a><a class="code" href="a00074.html#e9b09f32de56e122d752b500abddda42">00192</a> <span class="keywordtype">int</span> <a class="code" href="a00074.html#e9b09f32de56e122d752b500abddda42" title="Frame number.">m_frame_num</a>; <a name="l00193"></a>00193 <a name="l00197"></a><a class="code" href="a00074.html#25e5bdbd7b0037b5636299c5ffdd2577">00197</a> <a class="code" href="a00102.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">MvDataByteIO</a> * <a class="code" href="a00074.html#25e5bdbd7b0037b5636299c5ffdd2577" title="MV data.">m_mv_data</a>; <a name="l00198"></a>00198 <a name="l00202"></a><a class="code" href="a00074.html#ce703ca238f4e21e7448141d29c7ae65">00202</a> <a class="code" href="a00138.html" title="Represents compressed sequence-parameter data used in an AccessUnit.">TransformByteIO</a> * <a class="code" href="a00074.html#ce703ca238f4e21e7448141d29c7ae65" 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><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>