shithub: openh264

Download patch

ref: 10bc74b35cb16328c8a62a4e58a2a8c6f6cb1ff3
parent: 3c2caa4a52fdbc480ae9c41cd1081bd6627822aa
parent: 3c2b160fe55efa6d8db4d9fd839cbc7b8fe2bf2e
author: huili2 <huili2@cisco.com>
date: Thu Jan 12 04:07:42 EST 2017

Merge pull request #2643 from huili2/remove_spslate_logic_for_scaling_list

remove sps late than pps logic for scaling_list

--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -447,7 +447,6 @@
   uint16_t (*pDequant_coeff8x8[6])[64];//64 residual coeff ,with 6 kinds of residual type, 52 qp level
   int iDequantCoeffPpsid;//When a new pps actived, reinitialised the scaling list value
   bool bDequantCoeff4x4Init;
-  bool bSpsLatePps;
   bool bUseScalingList;
   CMemoryAlign*     pMemAlign;
 } SWelsDecoderContext, *PWelsDecoderContext;
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -1420,9 +1420,10 @@
         WELS_READ_VERIFY (ParseScalingList (&pCtx->sSpsBuffer[pPps->iSpsId], pBsAux, 1, pPps->bTransform8x8ModeFlag,
                                             pPps->bPicScalingListPresentFlag, pPps->iScalingList4x4, pPps->iScalingList8x8));
       } else {
-        pCtx->bSpsLatePps = true;
-        WELS_READ_VERIFY (ParseScalingList (NULL, pBsAux, 1, pPps->bTransform8x8ModeFlag, pPps->bPicScalingListPresentFlag,
-                                            pPps->iScalingList4x4, pPps->iScalingList8x8));
+        WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
+                 "ParsePps(): sps_id (%d) does not exist for scaling_list. This PPS (%d) is marked as invalid.", pPps->iSpsId,
+                 pPps->iPpsId);
+        return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_SPS_ID);
       }
     }
     WELS_READ_VERIFY (BsGetSe (pBsAux, &iCode)); //second_chroma_qp_index_offset
@@ -1665,13 +1666,10 @@
   const uint8_t* defaultScaling[4];
 
   if (!bPPS) { //sps scaling_list
-    if (pSps != NULL) {
-      uiScalingListNum = (pSps->uiChromaFormatIdc != 3) ? 8 : 12;
-      bInit = bPPS && pSps->bSeqScalingMatrixPresentFlag;
-    } else
-      uiScalingListNum = 12;
+    uiScalingListNum = (pSps->uiChromaFormatIdc != 3) ? 8 : 12;
   } else { //pps scaling_list
     uiScalingListNum = 6 + (int32_t) kbTrans8x8ModeFlag * ((pSps->uiChromaFormatIdc != 3) ? 2 : 6);
+    bInit = pSps->bSeqScalingMatrixPresentFlag;
   }
 
 //Init default_scaling_list value for sps or pps
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -1112,25 +1112,6 @@
 
     if (!pCtx->bDequantCoeff4x4Init || (pCtx->iDequantCoeffPpsid != pCtx->pPps->iPpsId)) {
       int i, q, x, y;
-      // Rewrite pps scaling list for scalingList present flag=0
-      if (pCtx->bSpsLatePps) {
-        for (i = 0; i < 12; i++) {
-          //if (!pCtx->pSps->bSeqScalingListPresentFlag[i]) {
-          if (!pCtx->pPps->bPicScalingListPresentFlag[i]) {
-            if (i < 6) {
-              if (i == 0 || i == 3)
-                memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pSps->iScalingList4x4[i], 16 * sizeof (uint8_t));
-              else
-                memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pPps->iScalingList4x4[i - 1], 16 * sizeof (uint8_t));
-            } else {
-              if (i == 6 || i == 7)
-                memcpy (pCtx->pPps->iScalingList8x8[ i - 6 ], pCtx->pSps->iScalingList8x8[ i - 6 ], 64 * sizeof (uint8_t));
-              else
-                memcpy (pCtx->pPps->iScalingList8x8[ i - 6 ], pCtx->pPps->iScalingList8x8[i - 8], 64 * sizeof (uint8_t));
-            }
-          }
-        }
-      }
       //Init dequant coeff value for different QP
       for (i = 0; i < 6; i++) {
         pCtx->pDequant_coeff4x4[i] = pCtx->pDequant_coeff_buffer4x4[i];
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -312,7 +312,6 @@
   pCtx->bAvcBasedFlag             = true;
   pCtx->pPreviousDecodedPictureInDpb = NULL;
   pCtx->sDecoderStatistics.iAvgLumaQp = -1;
-  pCtx->bSpsLatePps = false;
   pCtx->bUseScalingList = false;
   pCtx->iSpsErrorIgnored = 0;
   pCtx->iSubSpsErrorIgnored = 0;