shithub: openh264

Download patch

ref: 8c006e242d729961205b6e528e3f96bad5a67174
parent: 579a5bc6c255edfde90a3ea5e376fc59c7b2e49b
author: Jan Schmidt <jan@centricular.com>
date: Tue Feb 26 21:09:38 EST 2019

decode_slice: Rename ComputeColocated

Rename the ComputeColocated method to ComputeColocatedTemporalScaling
to make it clearer what it's doing, and add a comment about it.

Remove some obsolete comments

--- a/codec/decoder/core/inc/decode_slice.h
+++ b/codec/decoder/core/inc/decode_slice.h
@@ -68,7 +68,7 @@
 void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pCtx);
 int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer);
 void WelsChromaDcIdct (int16_t* pBlock);
-bool ComputeColocated (PWelsDecoderContext pCtx);
+bool ComputeColocatedTemporalScaling (PWelsDecoderContext pCtx);
 
 #ifdef __cplusplus
 extern "C" {
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -2855,7 +2855,11 @@
 void WelsBlockZero8x8_c (int16_t* pBlock, int32_t iStride) {
   WelsBlockInit (pBlock, 8, 8, iStride, 0);
 }
-bool ComputeColocated (PWelsDecoderContext pCtx) {
+
+// 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
+bool ComputeColocatedTemporalScaling (PWelsDecoderContext pCtx) {
   PDqLayer pCurLayer = pCtx->pCurDqLayer;
   PSlice pCurSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
   PSliceHeader pSliceHeader = &pCurSlice->sSliceHeaderExt.sSliceHeader;
@@ -2879,11 +2883,6 @@
       }
     }
   }
-  //Implement the following
-  //get Mv_colocated_L1
-  //and do calculation
-  //iMvp[LIST_0] = Mv_colocated_L1 * (POC(cur) - POC(L0))/POC(L1) - POC(L0))
-  //iMvp[LIST_1] = Mv_colocated_L1 * (POC(cur) - POC(L1))/POC(L1) - POC(L0))
   return true;
 }
 } // namespace WelsDec
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -2550,9 +2550,9 @@
             }
           }
         }
-        //calculate Colocated mv scaler factor for temporal direct prediction
+        //calculate Colocated mv scaling factor for temporal direct prediction
         if (pSh->eSliceType == B_SLICE && !pSh->iDirectSpatialMvPredFlag)
-          ComputeColocated (pCtx);
+          ComputeColocatedTemporalScaling (pCtx);
 
         iRet = WelsDecodeSlice (pCtx, bFreshSliceAvailable, pNalCur);