source: 3DVCSoftware/branches/0.3-nokia/source/Lib/TLibCommon/TComPicYuv.h @ 193

Last change on this file since 193 was 5, checked in by hhi, 13 years ago

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 7.5 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2011, ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34
35
36/** \file     TComPicYuv.h
37    \brief    picture YUV buffer class (header)
38*/
39
40#ifndef __TCOMPICYUV__
41#define __TCOMPICYUV__
42
43#include <stdio.h>
44#include "CommonDef.h"
45
46// ====================================================================================================================
47// Class definition
48// ====================================================================================================================
49
50/// picture YUV buffer class
51class TComPicYuv
52{
53private:
54 
55  // ------------------------------------------------------------------------------------------------
56  //  YUV buffer
57  // ------------------------------------------------------------------------------------------------
58 
59  Pel*  m_apiPicBufY;           ///< Buffer (including margin)
60  Pel*  m_apiPicBufU;
61  Pel*  m_apiPicBufV;
62 
63  Pel*  m_piPicOrgY;            ///< m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
64  Pel*  m_piPicOrgU;
65  Pel*  m_piPicOrgV;
66 
67  // ------------------------------------------------------------------------------------------------
68  //  Parameter for general YUV buffer usage
69  // ------------------------------------------------------------------------------------------------
70 
71  Int   m_iPicWidth;            ///< Width of picture
72  Int   m_iPicHeight;           ///< Height of picture
73 
74  Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
75  Int   m_iCuHeight;            ///< Height of Coding Unit (CU)
76  UInt  m_uiMaxCuDepth;         ///< maximum coding unit depth
77  Int   m_iBaseUnitWidth;       ///< Width of Base Unit (with maximum depth or minimum size, m_iCuWidth >> Max. Depth)
78  Int   m_iBaseUnitHeight;      ///< Height of Base Unit (with maximum depth or minimum size, m_iCuHeight >> Max. Depth)
79  Int   m_iNumCuInWidth;
80 
81  Int   m_iLumaMarginX;
82  Int   m_iLumaMarginY;
83  Int   m_iChromaMarginX;
84  Int   m_iChromaMarginY;
85 
86  Bool  m_bIsBorderExtended;
87 
88protected:
89  Void  xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY);
90  Void  xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );
91 
92public:
93  TComPicYuv         ();
94  virtual ~TComPicYuv();
95 
96  // ------------------------------------------------------------------------------------------------
97  //  Memory management
98  // ------------------------------------------------------------------------------------------------
99 
100  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
101  Void  destroy     ();
102 
103  Void  createLuma  ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uhMaxCUDepth );
104  Void  destroyLuma ();
105 
106  // ------------------------------------------------------------------------------------------------
107  //  Get information of picture
108  // ------------------------------------------------------------------------------------------------
109 
110  Int   getWidth    ()     { return  m_iPicWidth;    }
111  Int   getHeight   ()     { return  m_iPicHeight;   }
112
113  UInt  getMaxCuWidth ()   { return  (UInt)m_iCuWidth;   }
114  UInt  getMaxCuHeight()   { return  (UInt)m_iCuHeight;  }
115  UInt  getMaxCuDepth ()   { return  m_uiMaxCuDepth;     }
116 
117  Int   getStride   ()     { return (m_iPicWidth     ) + (m_iLumaMarginX  <<1); }
118  Int   getCStride  ()     { return (m_iPicWidth >> 1) + (m_iChromaMarginX<<1); }
119 
120  Int   getLumaMargin   () { return m_iLumaMarginX;  }
121  Int   getChromaMargin () { return m_iChromaMarginX;}
122 
123  Void  getLumaMinMax( Int* pMin, Int* pMax );
124 
125  // ------------------------------------------------------------------------------------------------
126  //  Access function for picture buffer
127  // ------------------------------------------------------------------------------------------------
128 
129  //  Access starting position of picture buffer with margin
130  Pel*  getBufY     ()     { return  m_apiPicBufY;   }
131  Pel*  getBufU     ()     { return  m_apiPicBufU;   }
132  Pel*  getBufV     ()     { return  m_apiPicBufV;   }
133 
134  //  Access starting position of original picture
135  Pel*  getLumaAddr ()     { return  m_piPicOrgY;    }
136  Pel*  getCbAddr   ()     { return  m_piPicOrgU;    }
137  Pel*  getCrAddr   ()     { return  m_piPicOrgV;    }
138 
139  //  Access starting position of original picture for specific coding unit (CU) or partition unit (PU)
140  Pel*  getLumaAddr ( Int iCuAddr );
141  Pel*  getCbAddr   ( Int iCuAddr );
142  Pel*  getCrAddr   ( Int iCuAddr );
143  Pel*  getLumaAddr ( Int iCuAddr, Int uiAbsZorderIdx );
144  Pel*  getCbAddr   ( Int iCuAddr, Int uiAbsZorderIdx );
145  Pel*  getCrAddr   ( Int iCuAddr, Int uiAbsZorderIdx );
146 
147  // ------------------------------------------------------------------------------------------------
148  //  Miscellaneous
149  // ------------------------------------------------------------------------------------------------
150
151  // sample to block and block to sample conversion
152  Void  getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY );
153  Void  getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx );
154 
155  //  Copy function to picture
156  Void  copyToPic       ( TComPicYuv*  pcPicYuvDst );
157  Void  copyToPicLuma   ( TComPicYuv*  pcPicYuvDst );
158  Void  copyToPicCb     ( TComPicYuv*  pcPicYuvDst );
159  Void  copyToPicCr     ( TComPicYuv*  pcPicYuvDst );
160 
161  //  Extend function of picture buffer
162  Void  extendPicBorder      ();
163 
164  //  Dump picture
165  Void  dump (char* pFileName, Bool bAdd = false);
166 
167  // Set border extension flag
168  Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
169#if FIXED_ROUNDING_FRAME_MEMORY
170  Void  xFixedRoundingPic();
171#endif 
172
173  // Set Function
174  Void  setLumaTo    ( Pel pVal ); 
175  Void  setChromaTo  ( Pel pVal ); 
176
177};// END CLASS DEFINITION TComPicYuv
178
179void calcMD5(TComPicYuv& pic, unsigned char digest[16]);
180
181#endif // __TCOMPICYUV__
182
Note: See TracBrowser for help on using the repository browser.