source: SHVCSoftware/trunk/source/Lib/TLibCommon/TComPicYuv.h @ 1163

Last change on this file since 1163 was 906, checked in by seregin, 10 years ago

merge SHM-dev

  • Property svn:eol-style set to native
File size: 8.9 KB
RevLine 
[313]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 *
[595]6 * Copyright (c) 2010-2014, ITU/ISO/IEC
[313]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 ITU/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/** \file     TComPicYuv.h
35    \brief    picture YUV buffer class (header)
36*/
37
38#ifndef __TCOMPICYUV__
39#define __TCOMPICYUV__
40
41#include <stdio.h>
42#include "CommonDef.h"
43#include "TComRom.h"
[815]44#if SVC_EXTENSION
[313]45#include "TComSlice.h"
46#endif
47//! \ingroup TLibCommon
48//! \{
49
50// ====================================================================================================================
51// Class definition
52// ====================================================================================================================
53
54/// picture YUV buffer class
55class TComPicYuv
56{
57private:
58 
59  // ------------------------------------------------------------------------------------------------
60  //  YUV buffer
61  // ------------------------------------------------------------------------------------------------
62 
63  Pel*  m_apiPicBufY;           ///< Buffer (including margin)
64  Pel*  m_apiPicBufU;
65  Pel*  m_apiPicBufV;
66 
67  Pel*  m_piPicOrgY;            ///< m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
68  Pel*  m_piPicOrgU;
69  Pel*  m_piPicOrgV;
70 
71  // ------------------------------------------------------------------------------------------------
72  //  Parameter for general YUV buffer usage
73  // ------------------------------------------------------------------------------------------------
74 
75  Int   m_iPicWidth;            ///< Width of picture
76  Int   m_iPicHeight;           ///< Height of picture
77 
78  Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
79  Int   m_iCuHeight;            ///< Height of Coding Unit (CU)
80  Int*  m_cuOffsetY;
81  Int*  m_cuOffsetC;
82  Int*  m_buOffsetY;
83  Int*  m_buOffsetC;
84 
85  Int   m_iLumaMarginX;
86  Int   m_iLumaMarginY;
87  Int   m_iChromaMarginX;
88  Int   m_iChromaMarginY;
89 
[595]90  Bool  m_bIsBorderExtended;
91
92#if SVC_EXTENSION
93#if AUXILIARY_PICTURES
94  ChromaFormat m_chromaFormatIDC; ////< Chroma Format
95#endif
[313]96  Window  m_conformanceWindow;
97#if M0040_ADAPTIVE_RESOLUTION_CHANGE
98  Bool    m_isReconstructed;
99#endif
[595]100#endif //SVC_EXTENSION
[313]101 
102protected:
103  Void  xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY);
104 
105public:
106  TComPicYuv         ();
107  virtual ~TComPicYuv();
108 
109  // ------------------------------------------------------------------------------------------------
110  //  Memory management
111  // ------------------------------------------------------------------------------------------------
[815]112#if SVC_EXTENSION
[906]113#if R0156_CONF_WINDOW_IN_REP_FORMAT
[494]114#if AUXILIARY_PICTURES
[906]115  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow = NULL);
116#else
117  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow = NULL);
118#endif
119#else
120#if AUXILIARY_PICTURES
[494]121  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
122#else
[313]123  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
[815]124#endif
[906]125#endif
[313]126#else
127  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
[815]128#endif //SVC_EXTENSION
[313]129 
130  Void  destroy     ();
131 
132  Void  createLuma  ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uhMaxCUDepth );
133  Void  destroyLuma ();
134 
135  // ------------------------------------------------------------------------------------------------
136  //  Get information of picture
137  // ------------------------------------------------------------------------------------------------
138 
139  Int   getWidth    ()     { return  m_iPicWidth;    }
140  Int   getHeight   ()     { return  m_iPicHeight;   }
141
142  Int   getStride   ()     { return (m_iPicWidth     ) + (m_iLumaMarginX  <<1); }
143  Int   getCStride  ()     { return (m_iPicWidth >> 1) + (m_iChromaMarginX<<1); }
144 
145  Int   getLumaMargin   () { return m_iLumaMarginX;  }
146  Int   getChromaMargin () { return m_iChromaMarginX;}
147 
148  // ------------------------------------------------------------------------------------------------
149  //  Access function for picture buffer
150  // ------------------------------------------------------------------------------------------------
151 
152  //  Access starting position of picture buffer with margin
153  Pel*  getBufY     ()     { return  m_apiPicBufY;   }
154  Pel*  getBufU     ()     { return  m_apiPicBufU;   }
155  Pel*  getBufV     ()     { return  m_apiPicBufV;   }
156 
157  //  Access starting position of original picture
158  Pel*  getLumaAddr ()     { return  m_piPicOrgY;    }
159  Pel*  getCbAddr   ()     { return  m_piPicOrgU;    }
160  Pel*  getCrAddr   ()     { return  m_piPicOrgV;    }
161 
162  //  Access starting position of original picture for specific coding unit (CU) or partition unit (PU)
163  Pel*  getLumaAddr ( Int iCuAddr ) { return m_piPicOrgY + m_cuOffsetY[ iCuAddr ]; }
164  Pel*  getCbAddr   ( Int iCuAddr ) { return m_piPicOrgU + m_cuOffsetC[ iCuAddr ]; }
165  Pel*  getCrAddr   ( Int iCuAddr ) { return m_piPicOrgV + m_cuOffsetC[ iCuAddr ]; }
166  Pel*  getLumaAddr ( Int iCuAddr, Int uiAbsZorderIdx ) { return m_piPicOrgY + m_cuOffsetY[iCuAddr] + m_buOffsetY[g_auiZscanToRaster[uiAbsZorderIdx]]; }
167  Pel*  getCbAddr   ( Int iCuAddr, Int uiAbsZorderIdx ) { return m_piPicOrgU + m_cuOffsetC[iCuAddr] + m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]]; }
168  Pel*  getCrAddr   ( Int iCuAddr, Int uiAbsZorderIdx ) { return m_piPicOrgV + m_cuOffsetC[iCuAddr] + m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]]; }
169 
170  // ------------------------------------------------------------------------------------------------
171  //  Miscellaneous
172  // ------------------------------------------------------------------------------------------------
173 
174  //  Copy function to picture
175  Void  copyToPic       ( TComPicYuv*  pcPicYuvDst );
176  Void  copyToPicLuma   ( TComPicYuv*  pcPicYuvDst );
177  Void  copyToPicCb     ( TComPicYuv*  pcPicYuvDst );
178  Void  copyToPicCr     ( TComPicYuv*  pcPicYuvDst );
179 
180  //  Extend function of picture buffer
181  Void  extendPicBorder      ();
182 
183  //  Dump picture
184  Void  dump (Char* pFileName, Bool bAdd = false);
185
[595]186  // Set border extension flag
187  Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
188 
189#if SVC_EXTENSION
190  Void   setHeight   ( Int iPicHeight )     { m_iPicHeight = iPicHeight; }
191  Window& getConformanceWindow()                           { return  m_conformanceWindow;             }
192  Void    setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; }
[313]193#if M0040_ADAPTIVE_RESOLUTION_CHANGE
194  Void  setReconstructed(Bool x) { m_isReconstructed = x;    }
195  Bool  isReconstructed()        { return m_isReconstructed; }
196#endif
[494]197#if AUXILIARY_PICTURES
[595]198  ChromaFormat  getChromaFormat   ()                     const { return m_chromaFormatIDC; }
[494]199  Void convertToMonochrome();
200#endif
[906]201#endif //SVC_EXTENSION
[815]202  Void dump( Char* pFileName, Bool bAdd, Int bitDepth );
[494]203
[313]204};// END CLASS DEFINITION TComPicYuv
205
206void calcChecksum(TComPicYuv& pic, UChar digest[3][16]);
207void calcCRC(TComPicYuv& pic, UChar digest[3][16]);
208void calcMD5(TComPicYuv& pic, UChar digest[3][16]);
209//! \}
210
211#endif // __TCOMPICYUV__
Note: See TracBrowser for help on using the repository browser.