1 /*! 2 * \copy 3 * Copyright (c) 2013, Cisco Systems 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 * 31 */ 32 33 //picture.h - reconstruction picture/ reference picture/ residual picture are declared here 34 #ifndef WELS_PICTURE_H__ 35 #define WELS_PICTURE_H__ 36 37 #include "typedefs.h" 38 #include "as264_common.h" 39 #include "wels_common_basis.h" 40 41 namespace WelsEnc { 42 #define LIST_SIZE 0x10000 //(256*256) 43 typedef struct TagScreenBlockFeatureStorage { 44 //Input 45 uint16_t* pFeatureOfBlockPointer; // Pointer to pFeatureOfBlock 46 int32_t iIs16x16; //Feature block size 47 uint8_t uiFeatureStrategyIndex;// index of hash strategy 48 49 //Modify 50 uint32_t* pTimesOfFeatureValue; // times of every value in Feature 51 uint16_t** 52 pLocationOfFeature; // uint16_t *pLocationOfFeature[LIST_SIZE], pLocationOfFeature[i] saves all the location(x,y) whose Feature = i; 53 uint16_t* pLocationPointer; // buffer of position array 54 int32_t iActualListSize; // actual list size 55 uint32_t uiSadCostThreshold[BLOCK_SIZE_ALL]; 56 bool bRefBlockFeatureCalculated; // flag of whether pre-process is done 57 uint16_t **pFeatureValuePointerList;//uint16_t* pFeatureValuePointerList[WELS_MAX (LIST_SIZE_SUM_16x16, LIST_SIZE_MSE_16x16)] 58 } SScreenBlockFeatureStorage; //should be stored with RefPic, one for each frame 59 60 /* 61 * Reconstructed Picture definition 62 * It is used to express reference picture, also consequent reconstruction picture for output 63 */ 64 typedef struct TagPicture { 65 /************************************payload pData*********************************/ 66 uint8_t* pBuffer; // pointer to the first allocated byte, basical offset of pBuffer, dimension: 67 uint8_t* pData[3]; // pointer to picture planes respectively 68 int32_t iLineSize[3]; // iLineSize of picture planes respectively 69 70 // picture information 71 /*******************************from other standard syntax****************************/ 72 /*from pSps*/ 73 int32_t iWidthInPixel; // picture width in pixel 74 int32_t iHeightInPixel;// picture height in pixel 75 int32_t iPictureType; // got from sSliceHeader(): eSliceType 76 int32_t iFramePoc; // frame POC 77 78 float fFrameRate; // MOVE 79 int32_t iFrameNum; // frame number //for pRef pic management 80 81 uint32_t* uiRefMbType; // for iMbWidth*iMbHeight 82 uint8_t* pRefMbQp; // for iMbWidth*iMbHeight 83 84 int32_t* pMbSkipSad; //for iMbWidth*iMbHeight 85 86 SMVUnitXY* sMvList; 87 88 /*******************************sef_definition for misc use****************************/ 89 int32_t iMarkFrameNum; 90 int32_t iLongTermPicNum; 91 92 bool bUsedAsRef; //for pRef pic management 93 bool bIsLongRef; // long term reference frame flag //for pRef pic management 94 bool bIsSceneLTR; //long term reference & large scene change 95 uint8_t uiRecieveConfirmed; 96 uint8_t uiTemporalId; 97 uint8_t uiSpatialId; 98 int32_t iFrameAverageQp; 99 100 /*******************************for screen reference frames****************************/ 101 SScreenBlockFeatureStorage* pScreenBlockFeatureStorage; 102 103 /* 104 * set picture as unreferenced 105 */ SetUnrefTagPicture106 void SetUnref () { 107 iFramePoc = -1; 108 iFrameNum = -1; 109 uiTemporalId = 110 uiSpatialId = 111 iLongTermPicNum = -1; 112 bIsLongRef = false; 113 uiRecieveConfirmed = RECIEVE_FAILED; 114 iMarkFrameNum = -1; 115 bUsedAsRef = false; 116 117 if (NULL != pScreenBlockFeatureStorage) 118 pScreenBlockFeatureStorage->bRefBlockFeatureCalculated = false; 119 } 120 121 } SPicture; 122 123 /* 124 * Residual Picture 125 */ 126 //typedef struct Rs_Picture_s{ 127 // int16_t *pBuffer[4]; // base pBuffer 128 // int16_t *pData[4]; // pData pBuffer 129 // int32_t real_linesize[4];// actual iLineSize of picture planes respectively 130 // int32_t used_linesize[4];// iLineSize of picture planes respectively used currently 131 // int32_t planes; // planes of YUV 132 //}Rs_Picture_t; 133 134 } // end of namespace WelsEnc { 135 136 #endif//WELS_PICTURE_H__ 137 138