Compute the temporal-direct scaling factor that's common to all direct MBs in this slice, as per clause 8.4.1.2.3 of T-REC H.264 201704
| 3039 | // to all direct MBs in this slice, as per clause 8.4.1.2.3 |
| 3040 | // of T-REC H.264 201704 |
| 3041 | bool ComputeColocatedTemporalScaling (PWelsDecoderContext pCtx) { |
| 3042 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 3043 | PSlice pCurSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| 3044 | PSliceHeader pSliceHeader = &pCurSlice->sSliceHeaderExt.sSliceHeader; |
| 3045 | if (!pSliceHeader->iDirectSpatialMvPredFlag) { |
| 3046 | uint32_t uiRefCount = pSliceHeader->uiRefCount[LIST_0]; |
| 3047 | if (pCtx->sRefPic.pRefList[LIST_1][0] != NULL) { |
| 3048 | for (uint32_t i = 0; i < uiRefCount; ++i) { |
| 3049 | if (pCtx->sRefPic.pRefList[LIST_0][i] != NULL) { |
| 3050 | const int32_t poc0 = pCtx->sRefPic.pRefList[LIST_0][i]->iFramePoc; |
| 3051 | const int32_t poc1 = pCtx->sRefPic.pRefList[LIST_1][0]->iFramePoc; |
| 3052 | const int32_t poc = pSliceHeader->iPicOrderCntLsb; |
| 3053 | const int32_t td = WELS_CLIP3 (poc1 - poc0, -128, 127); |
| 3054 | if (td == 0) { |
| 3055 | pCurSlice->iMvScale[LIST_0][i] = 1 << 8; |
| 3056 | } else { |
| 3057 | int32_t tb = WELS_CLIP3 (poc - poc0, -128, 127); |
| 3058 | int32_t tx = (16384 + (abs (td) >> 1)) / td; |
| 3059 | pCurSlice->iMvScale[LIST_0][i] = WELS_CLIP3 ((tb * tx + 32) >> 6, -1024, 1023); |
| 3060 | } |
| 3061 | } |
| 3062 | } |
| 3063 | } |
| 3064 | } |
| 3065 | return true; |
| 3066 | } |
| 3067 | } // namespace WelsDec |
no outgoing calls
no test coverage detected