shithub: openh264

Download patch

ref: c8761c08ae96d60e90dfe65fd40eccd32d378220
parent: 8962b7c98baa809867d23d301665b9c0e99db10b
author: volvet <qizh@cisco.com>
date: Thu Mar 13 06:43:20 EDT 2014

use large/medium/similar to define scene change result

--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -605,7 +605,7 @@
 bool CWelsPreProcess::DetectSceneChange (SPicture* pCurPicture, SPicture* pRefPicture) {
   bool bSceneChangeFlag = false;
   int32_t iMethodIdx = METHOD_SCENE_CHANGE_DETECTION;
-  SSceneChangeResult sSceneChangeDetectResult = {0};
+  SSceneChangeResult sSceneChangeDetectResult = { SIMILAR_SCENE };
   SPixMap sSrcPixMap = {0};
   SPixMap sRefPixMap = {0};
 
@@ -627,7 +627,7 @@
   int32_t iRet = m_pInterfaceVp->Process (iMethodIdx, &sSrcPixMap, &sRefPixMap);
   if (iRet == 0) {
     m_pInterfaceVp->Get (iMethodIdx, (void*)&sSceneChangeDetectResult);
-    bSceneChangeFlag = sSceneChangeDetectResult.bSceneChangeFlag ? true : false;
+    bSceneChangeFlag = (sSceneChangeDetectResult.eSceneChangeIdc != LARGE_CHANGED_SCENE) ? true : false;
   }
 
   return bSceneChangeFlag;
--- a/codec/processing/interface/IWelsVP.h
+++ b/codec/processing/interface/IWelsVP.h
@@ -136,15 +136,15 @@
 //  Algorithm parameters define
 //-----------------------------------------------------------------//
 
-typedef struct {
-  int bSceneChangeFlag; // 0:false ; 1:true
-} SSceneChangeResult;
-
 typedef enum {
-  SIMILAR_SCENE,      //similar scene
+  SIMILAR_SCENE,   //similar scene
   MEDIUM_CHANGED_SCENE,   //medium changed scene
-  LARGE_CHANGED_SCENE,   //large changed scene
+  LARGE_CHANGED_SCENE,    //large changed scene
 } ESceneChangeIdc;
+
+typedef struct {
+  ESceneChangeIdc eSceneChangeIdc; // 0:false ; 1:true
+} SSceneChangeResult;
 
 typedef struct {
   unsigned char* pCurY;					// Y data of current frame
--- a/codec/processing/src/scenechangedetection/SceneChangeDetection.cpp
+++ b/codec/processing/src/scenechangedetection/SceneChangeDetection.cpp
@@ -81,7 +81,7 @@
   iRefRowStride  = pRefPixMap->iStride[0] << 3;
   iCurRowStride  = pSrcPixMap->iStride[0] << 3;
 
-  m_sSceneChangeParam.bSceneChangeFlag = 0;
+  m_sSceneChangeParam.eSceneChangeIdc = SIMILAR_SCENE;
 
   for (int32_t j = 0; j < iBlock8x8Height; j ++) {
     pRefTmp	= pRefY;
@@ -101,7 +101,7 @@
   }
 
   if (iMotionBlockNum >= iSceneChangeThreshold) {
-    m_sSceneChangeParam.bSceneChangeFlag = 1;
+    m_sSceneChangeParam.eSceneChangeIdc = LARGE_CHANGED_SCENE;
   }
 
   eReturn = RET_SUCCESS;