1 /*! 2 * \copy 3 * Copyright (c) 2009-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 * \file mv_pred.h 33 * 34 * \brief Get MV predictor and update motion vector of mb cache 35 * 36 * \date 05/22/2009 Created 37 * 38 ************************************************************************************* 39 */ 40 41 #ifndef WELS_MV_PRED_H__ 42 #define WELS_MV_PRED_H__ 43 44 45 #include "svc_enc_macroblock.h" 46 #include "mb_cache.h" 47 48 namespace WelsEnc { 49 /*! 50 * \brief update pMv and uiRefIndex cache for current MB, only for P_16x16 (SKIP inclusive) 51 * \param 52 * \param 53 */ 54 55 /*! 56 * \brief update pMv and uiRefIndex cache for current MB and pMbCache, only for P_16x16 (SKIP inclusive) 57 * \param 58 * \param 59 */ 60 void UpdateP16x16MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int8_t kiRef, SMVUnitXY* pMv); //for encoder 61 62 /*! 63 * \brief update pMv and uiRefIndex cache for current MB and pMbCache, only for P_16x8 64 * \param 65 * \param 66 */ 67 void UpdateP16x8MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef, 68 SMVUnitXY* pMv); 69 70 /*! 71 * \brief update pMv and uiRefIndex cache for current MB and pMbCache, only for P_8x16 72 * \param 73 * \param 74 */ 75 void update_P8x16_motion_info (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef, 76 SMVUnitXY* pMv); 77 78 /*! 79 * \brief update pMv and uiRefIndex cache for current MB and pMbCache, only for P_8x8 80 * \param 81 * \param 82 */ 83 void UpdateP8x8MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef, 84 SMVUnitXY* pMv); 85 86 /*! 87 * \brief update pMv and uiRefIndex cache for current MB and pMbCache, only for P_4x4 88 * \param 89 * \param 90 */ 91 void UpdateP4x4MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef, 92 SMVUnitXY* pMv); 93 94 /*! 95 * \brief update pMv and uiRefIndex cache for current MB and pMbCache, only for P_8x4 96 * \param 97 * \param 98 */ 99 void UpdateP8x4MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef, 100 SMVUnitXY* pMv); 101 102 /*! 103 * \brief update pMv and uiRefIndex cache for current MB and pMbCache, only for P_4x8 104 * \param 105 * \param 106 */ 107 void UpdateP4x8MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPartIdx, const int8_t kiRef, 108 SMVUnitXY* pMv); 109 110 /*! 111 * \brief get the motion predictor for 4*4 or 8*8 or 16*16 block 112 * \param 113 * \param output mvp_x and mvp_y 114 */ 115 void PredMv (const SMVComponentUnit* kpMvComp, int8_t iPartIdx, int8_t iPartW, int32_t iRef, SMVUnitXY* sMvp); 116 117 118 /*! 119 * \brief get the motion predictor for SKIP MB 120 * \param 121 * \param output mvp_x and mvp_y 122 */ 123 void PredSkipMv (SMbCache* pMbCache, SMVUnitXY* sMvp); 124 125 126 /*! 127 * \brief get the motion predictor for inter16x8 MB 128 * \param 129 * \param output mvp_x and mvp_y 130 */ 131 void PredInter16x8Mv (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* sMvp); 132 133 134 /*! 135 * \brief get the motion predictor for inter8x16 MB 136 * \param 137 * \param output mvp_x and mvp_y 138 */ 139 void PredInter8x16Mv (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* sMvp); 140 141 //=========================update motion info(MV and ref_idx) into Mb_cache========================== 142 /*! 143 * \brief only update pMv cache for current MB, only for P_16x16 144 * \param 145 * \param 146 */ 147 //void update_p16x16_motion2cache(SMbCache* pMbCache, int8_t pRef, SMVUnitXY* pMv); 148 149 /*! 150 * \brief only update pMv cache for current MB, only for P_16x8 151 * \param 152 * \param 153 */ 154 void UpdateP16x8Motion2Cache (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* pMv); 155 156 /*! 157 * \brief only update pMv cache for current MB, only for P_8x16 158 * \param 159 * \param 160 */ 161 void UpdateP8x16Motion2Cache (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* pMv); 162 163 /*! 164 * \brief only update pMv cache for current MB, only for P_8x8 165 * \param 166 * \param 167 */ 168 void UpdateP8x8Motion2Cache (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* pMv); 169 170 /*! 171 * \brief only update pMv cache for current MB, only for P_4x4 172 * \param 173 * \param 174 */ 175 void UpdateP4x4Motion2Cache (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* pMv); 176 177 /*! 178 * \brief only update pMv cache for current MB, only for P_8x4 179 * \param 180 * \param 181 */ 182 void UpdateP8x4Motion2Cache (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* pMv); 183 184 /*! 185 * \brief only update pMv cache for current MB, only for P_4x8 186 * \param 187 * \param 188 */ 189 void UpdateP4x8Motion2Cache (SMbCache* pMbCache, int32_t iPartIdx, int8_t iRef, SMVUnitXY* pMv); 190 } 191 #endif//WELS_MV_PRED_H__ 192