<!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_compress.h</h1><a href="a00215.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_compress.h,v 1.7 2008/08/14 02:30:50 asuraparaju 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): Thomas Davies (Original Author),</span> <a name="l00024"></a>00024 <span class="comment">* Scott R Ladd,</span> <a name="l00025"></a>00025 <span class="comment">* Anuradha Suraparaju</span> <a name="l00026"></a>00026 <span class="comment">* Andrew Kennedy</span> <a name="l00027"></a>00027 <span class="comment">*</span> <a name="l00028"></a>00028 <span class="comment">* Alternatively, the contents of this file may be used under the terms of</span> <a name="l00029"></a>00029 <span class="comment">* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser</span> <a name="l00030"></a>00030 <span class="comment">* Public License Version 2.1 (the "LGPL"), in which case the provisions of</span> <a name="l00031"></a>00031 <span class="comment">* the GPL or the LGPL are applicable instead of those above. If you wish to</span> <a name="l00032"></a>00032 <span class="comment">* allow use of your version of this file only under the terms of the either</span> <a name="l00033"></a>00033 <span class="comment">* the GPL or LGPL and not to allow others to use your version of this file</span> <a name="l00034"></a>00034 <span class="comment">* under the MPL, indicate your decision by deleting the provisions above</span> <a name="l00035"></a>00035 <span class="comment">* and replace them with the notice and other provisions required by the GPL</span> <a name="l00036"></a>00036 <span class="comment">* or LGPL. If you do not delete the provisions above, a recipient may use</span> <a name="l00037"></a>00037 <span class="comment">* your version of this file under the terms of any one of the MPL, the GPL</span> <a name="l00038"></a>00038 <span class="comment">* or the LGPL.</span> <a name="l00039"></a>00039 <span class="comment">* ***** END LICENSE BLOCK ***** */</span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="preprocessor">#ifndef _PICTURE_COMPRESS_H_</span> <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define _PICTURE_COMPRESS_H_</span> <a name="l00044"></a>00044 <span class="preprocessor"></span> <a name="l00045"></a>00045 <span class="preprocessor">#include <<a class="code" href="a00191.html">libdirac_encoder/enc_queue.h</a>></span> <a name="l00046"></a>00046 <span class="preprocessor">#include <<a class="code" href="a00171.html">libdirac_common/common.h</a>></span> <a name="l00047"></a>00047 <span class="preprocessor">#include <<a class="code" href="a00200.html">libdirac_common/motion.h</a>></span> <a name="l00048"></a>00048 <span class="preprocessor">#include <<a class="code" href="a00214.html">libdirac_byteio/picture_byteio.h</a>></span> <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="keyword">namespace </span>dirac <a name="l00051"></a>00051 { <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="keyword">class </span>MvData; <a name="l00054"></a>00054 <a name="l00056"></a>00056 <a name="l00061"></a><a class="code" href="a00111.html">00061</a> <span class="keyword">class </span><a class="code" href="a00111.html" title="Compress a single image picture.">PictureCompressor</a> <a name="l00062"></a>00062 { <a name="l00063"></a>00063 <span class="keyword">public</span>: <a name="l00065"></a>00065 <a name="l00071"></a>00071 <a class="code" href="a00111.html#8b3947de6f1d4d9f4a50a7d60cced6a4" title="Constructor.">PictureCompressor</a>( <a class="code" href="a00063.html" title="Parameters for the encoding process.">EncoderParams</a>& encp ); <a name="l00072"></a>00072 <a name="l00074"></a>00074 <a class="code" href="a00111.html#215adce095d5c4f3ca0fbc26587a326c" title="Destructor.">~PictureCompressor</a>( ); <a name="l00075"></a>00075 <a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="a00111.html#9f1c42d89395642a7b9c8f4f5cfb7248" title="Do pixel accurate motion estimate.">PixelME</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer , <span class="keywordtype">int</span> pnum ); <a name="l00078"></a>00078 <a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="a00111.html#bbe461f30a4112ce47108c37fb21827a" title="Calculate the complexity of a picture.">CalcComplexity</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum , <span class="keyword">const</span> <a class="code" href="a00096.html" title="Parameters for overlapped block motion compensation.">OLBParams</a>& olbparams ); <a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="a00111.html#70acab1af27ad0bd31bbb7b2bc6ad023">CalcComplexity2</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum ); <a name="l00082"></a>00082 <a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="a00111.html#498a1d115958e059d365cd27b64c3d3c" title="Normalise picture complexity with respect to others in the queue.">NormaliseComplexity</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum ); <a name="l00085"></a>00085 <a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="a00111.html#59ddc27ef3e0301cb262a0cbc41a9665" title="Do subpixel accurate motion vector refinement.">SubPixelME</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer , <span class="keywordtype">int</span> pnum ); <a name="l00088"></a>00088 <a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="a00111.html#7dbc9472d188089adb0245528fe07ed6" title="Do mode decision based on sub-pel vectors.">ModeDecisionME</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum ); <a name="l00091"></a>00091 <a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="a00111.html#91dbec7de2fbe6c9ed31aacf8efda171" title="Detect cuts in the current picture.">IntraModeAnalyse</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum ); <a name="l00094"></a>00094 <a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="a00111.html#c346a87bcbb886989658d770dbc7a03c" title="Does motion compensation on picture pnum (forward or backward).">MotionCompensate</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum, <a class="code" href="a00234.html#521776b4db3589284c5b7acb2b38a4b1" title="Addition or subtraction.">AddOrSub</a> dirn ); <a name="l00097"></a>00097 <a name="l00099"></a>00099 <span class="keywordtype">void</span> <a class="code" href="a00111.html#eaaba13e37301e86c376774514cc4853" title="Prefilter if required.">Prefilter</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum ); <a name="l00100"></a>00100 <a name="l00102"></a>00102 <span class="keywordtype">void</span> <a class="code" href="a00111.html#38629a34532fee4bd44f97b450c25718" title="Do the DWT on a given picture.">DoDWT</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer , <span class="keywordtype">int</span> pnum, <a class="code" href="a00234.html#c972efbebbe042dd142790f520369d9c" title="Forward or backward.">Direction</a> dirn ); <a name="l00103"></a>00103 <a name="l00105"></a>00105 <a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="a00111.html#90292b4e55c6c5c464ac4751afd14937" title="Compress a specific picture within a group of pictures (GOP).">CodeResidue</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_pbuffer , <span class="keywordtype">int</span> pnum , <a class="code" href="a00110.html" title="A compressed picture in Dirac bytestream format.">PictureByteIO</a>* pic_byteio); <a name="l00112"></a>00112 <a name="l00114"></a>00114 <span class="keywordtype">void</span> <a class="code" href="a00111.html#b6f02d08178188fb14c1e1072f6bf60f" title="Compresses the motion vector data.">CodeMVData</a>( <a class="code" href="a00065.html" title="Holds pictures both for reference and to overcome reordering delay.">EncQueue</a>& my_buffer, <span class="keywordtype">int</span> pnum, <a class="code" href="a00110.html" title="A compressed picture in Dirac bytestream format.">PictureByteIO</a>* pic_byteio); <a name="l00115"></a>00115 <a name="l00117"></a><a class="code" href="a00111.html#16febec2202ab08e8e7f7c28564b8296">00117</a> <span class="keywordtype">bool</span> <a class="code" href="a00111.html#16febec2202ab08e8e7f7c28564b8296" title="Returns true if the picture has been skipped rather than coded normally.">IsSkipped</a>(){ <span class="keywordflow">return</span> <a class="code" href="a00111.html#20306a613cf8d73f4a2e96d07f74e26d">m_skipped</a>; } <a name="l00118"></a>00118 <a name="l00120"></a><a class="code" href="a00111.html#33046271b460c09f2b8723f6ffa42cf6">00120</a> <span class="keywordtype">bool</span> <a class="code" href="a00111.html#33046271b460c09f2b8723f6ffa42cf6" title="Returns true if Motion estimation data is available.">IsMEDataAvail</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="a00111.html#e0a17ecb531bc5b8fda5f8a385b93974">m_medata_avail</a>; } <a name="l00121"></a>00121 <a name="l00123"></a>00123 <span class="keyword">const</span> <a class="code" href="a00082.html" title="Class for all the motion estimation data.">MEData</a>* <a class="code" href="a00111.html#a52aac2524e66563e600e00968e602d3" title="Returns the motion estimation data.">GetMEData</a>() <span class="keyword">const</span>; <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="keyword">private</span>: <a name="l00127"></a>00127 <a name="l00131"></a>00131 <a class="code" href="a00111.html#8b3947de6f1d4d9f4a50a7d60cced6a4" title="Constructor.">PictureCompressor</a>( <span class="keyword">const</span> <a class="code" href="a00111.html" title="Compress a single image picture.">PictureCompressor</a>& cpy ); <a name="l00132"></a>00132 <a name="l00134"></a>00134 <a name="l00138"></a>00138 <a class="code" href="a00111.html" title="Compress a single image picture.">PictureCompressor</a>& <a class="code" href="a00111.html#f91242ddaa1e63e5772822ab69ef3275" title="Assignment = is private and body-less.">operator=</a>(<span class="keyword">const</span> <a class="code" href="a00111.html" title="Compress a single image picture.">PictureCompressor</a>& rhs); <a name="l00139"></a>00139 <a name="l00141"></a>00141 <span class="keywordtype">void</span> <a class="code" href="a00111.html#7132a885dc4ae214ea4343e1271c18c6" title="Initialise the coefficient data array for holding wavelet coefficients.">InitCoeffData</a>( <a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a>& coeff_data, <span class="keyword">const</span> <span class="keywordtype">int</span> xl, <span class="keyword">const</span> <span class="keywordtype">int</span> yl ); <a name="l00142"></a>00142 <a name="l00144"></a>00144 <span class="keywordtype">float</span> <a class="code" href="a00111.html#3bf88ec470188382c7ff297971a45a7b" title="Returns the value lambda according to picture and component type.">GetCompLambda</a>( <span class="keyword">const</span> <a class="code" href="a00064.html">EncPicture</a>& my_picture, <a name="l00145"></a>00145 <span class="keyword">const</span> <a class="code" href="a00234.html#39dd89c4c7484412efd87d41548271cd" title="Types of picture component.">CompSort</a> csort ); <a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="keywordtype">void</span> <a class="code" href="a00111.html#f6d6b1bd1118819b5c55e2fe5c669be8">SelectQuantisers</a>( <a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a>& coeff_data , <a name="l00148"></a>00148 <a class="code" href="a00142.html" title="A class encapulating all the subbands produced by a transform.">SubbandList</a>& bands , <a name="l00149"></a>00149 <span class="keyword">const</span> <span class="keywordtype">float</span> lambda, <a name="l00150"></a>00150 <a class="code" href="a00097.html" title="A template class for one-dimensional arrays.">OneDArray<unsigned int></a>& est_counts, <a name="l00151"></a>00151 <span class="keyword">const</span> <a class="code" href="a00172.html#c01e150ebe1e8dee39d5431ab23e8ec5">CodeBlockMode</a> cb_mode, <a name="l00152"></a>00152 <span class="keyword">const</span> <a class="code" href="a00113.html" title="Parameters for initialising picture class objects.">PictureParams</a>& pp, <a name="l00153"></a>00153 <span class="keyword">const</span> <a class="code" href="a00234.html#39dd89c4c7484412efd87d41548271cd" title="Types of picture component.">CompSort</a> csort ); <a name="l00154"></a>00154 <a name="l00155"></a>00155 <span class="keywordtype">int</span> <a class="code" href="a00111.html#3541ee9cb995ea05531242eb38ecdd8a">SelectMultiQuants</a>( <a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a>& coeff_data , <a name="l00156"></a>00156 <a class="code" href="a00142.html" title="A class encapulating all the subbands produced by a transform.">SubbandList</a>& bands , <a name="l00157"></a>00157 <span class="keyword">const</span> <span class="keywordtype">int</span> band_num, <a name="l00158"></a>00158 <span class="keyword">const</span> <span class="keywordtype">float</span> lambda, <a name="l00159"></a>00159 <span class="keyword">const</span> <a class="code" href="a00113.html" title="Parameters for initialising picture class objects.">PictureParams</a>& pp, <a name="l00160"></a>00160 <span class="keyword">const</span> <a class="code" href="a00234.html#39dd89c4c7484412efd87d41548271cd" title="Types of picture component.">CompSort</a> csort ); <a name="l00161"></a>00161 <a name="l00162"></a>00162 <span class="keywordtype">void</span> <a class="code" href="a00111.html#8b8d1f213ecaa0eda419f1a38bb74d43">SetupCodeBlocks</a>( <a class="code" href="a00142.html" title="A class encapulating all the subbands produced by a transform.">SubbandList</a>& bands ); <a name="l00163"></a>00163 <a name="l00164"></a>00164 <a name="l00165"></a>00165 <span class="keywordtype">void</span> <a class="code" href="a00111.html#fe698d58221a92e294f21883e19b6918">AddSubAverage</a>(<a class="code" href="a00021.html" title="A class for wavelet coefficient data.">CoeffArray</a>& coeff_data,<span class="keywordtype">int</span> xl,<span class="keywordtype">int</span> yl,<a class="code" href="a00234.html#521776b4db3589284c5b7acb2b38a4b1" title="Addition or subtraction.">AddOrSub</a> dirn); <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="keyword">private</span>: <a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="comment">//member variables</span> <a name="l00170"></a>00170 <span class="comment">// a local copy of the encoder params</span> <a name="l00171"></a><a class="code" href="a00111.html#7960418de2ce182e128b93590ea8367d">00171</a> <a class="code" href="a00063.html" title="Parameters for the encoding process.">EncoderParams</a>& <a class="code" href="a00111.html#7960418de2ce182e128b93590ea8367d">m_encparams</a>; <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="comment">// True if the picture has been skipped, false otherwise</span> <a name="l00174"></a><a class="code" href="a00111.html#20306a613cf8d73f4a2e96d07f74e26d">00174</a> <span class="keywordtype">bool</span> <a class="code" href="a00111.html#20306a613cf8d73f4a2e96d07f74e26d">m_skipped</a>; <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="comment">// True if we use global motion vectors, false otherwise</span> <a name="l00177"></a><a class="code" href="a00111.html#357fda4dab5b073e9db18f16f63e4d87">00177</a> <span class="keywordtype">bool</span> <a class="code" href="a00111.html#357fda4dab5b073e9db18f16f63e4d87">m_use_global</a>; <a name="l00178"></a>00178 <a name="l00179"></a>00179 <span class="comment">// True if we use block motion vectors, false otherwise</span> <a name="l00180"></a><a class="code" href="a00111.html#ba7d5c0508a187778ad71f7989c99082">00180</a> <span class="keywordtype">bool</span> <a class="code" href="a00111.html#ba7d5c0508a187778ad71f7989c99082">m_use_block_mv</a>; <a name="l00181"></a>00181 <a name="l00182"></a>00182 <span class="comment">// Prediction mode to use if we only have global motion vectors</span> <a name="l00183"></a><a class="code" href="a00111.html#0d497d4723165913334764991c13459f">00183</a> <a class="code" href="a00234.html#b8a7aad3ab6de8cc3709dcacde946964" title="Prediction modes for blocks.">PredMode</a> <a class="code" href="a00111.html#0d497d4723165913334764991c13459f">m_global_pred_mode</a>; <a name="l00184"></a>00184 <a name="l00185"></a>00185 <span class="comment">// A pointer to the current picture motion vector data</span> <a name="l00186"></a><a class="code" href="a00111.html#7872bc1f5a9954776752b0162f132996">00186</a> <a class="code" href="a00082.html" title="Class for all the motion estimation data.">MEData</a>* <a class="code" href="a00111.html#7872bc1f5a9954776752b0162f132996">m_me_data</a>; <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="comment">// True if motion estimation data is available</span> <a name="l00189"></a><a class="code" href="a00111.html#e0a17ecb531bc5b8fda5f8a385b93974">00189</a> <span class="keywordtype">bool</span> <a class="code" href="a00111.html#e0a17ecb531bc5b8fda5f8a385b93974">m_medata_avail</a>; <a name="l00190"></a>00190 <a name="l00191"></a>00191 <span class="comment">// True if we have detected a cut</span> <a name="l00192"></a><a class="code" href="a00111.html#99eaf0694dbed346c9b6c1c68829985d">00192</a> <span class="keywordtype">bool</span> <a class="code" href="a00111.html#99eaf0694dbed346c9b6c1c68829985d">m_is_a_cut</a>; <a name="l00193"></a>00193 <a name="l00194"></a>00194 <span class="comment">// The original MV precision type</span> <a name="l00195"></a><a class="code" href="a00111.html#eb4b3da29c24de5f77c00a33021526c2">00195</a> <a class="code" href="a00172.html#73c509e14745c98e30772b6c4f8b6e1e">MVPrecisionType</a> <a class="code" href="a00111.html#eb4b3da29c24de5f77c00a33021526c2">m_orig_prec</a>; <a name="l00196"></a>00196 <a name="l00197"></a>00197 }; <a name="l00198"></a>00198 <a name="l00199"></a>00199 } <span class="comment">// namespace dirac</span> <a name="l00200"></a>00200 <a name="l00201"></a>00201 <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>