shithub: openh264

ref: 46ee46c1864e40aed477bdcde83c515448d1c03e
dir: /codec/console/enc/src/.welsenc.cpp.swp/

View raw version
b0VIM 7.44�=T��
�Cdanieltp510/tmp/openh264/codec/console/enc/src/welsenc.cpputf-8
3210#"! UtpwFxG�CGHX�	_�
WFh�lxqadw�����`�nk�
�
p
m
"
��J��j"�
�
H
%
"


�	�	�	�	�	�	�	g	`	E	*		���s$������}|feU0��������v[ZL7�����zfeQ<#"
������uL��������ZJH$#��	  }    return 1;    fprintf (stderr, "Unabled to open layer #%d configuration file: %s.\n", iLayer, cRdLayerCfg.GetFileName().c_str());  if (!cRdLayerCfg.ExistFile()) {int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt& pSvcParam, SFilesSet& sFileSet) {static int     g_LevelSetting = -1;}  g_iCtrlC = 1;static void    SigIntHandler (int a) {static int     g_iCtrlC = 0;/* Ctrl-C handler */} SFilesSet;  uint32_t uiFrameToBeCoded;  char   sRecFileName[MAX_DEPENDENCY_LAYER][MAX_FNAME_LEN];  string strLayerCfgFile[MAX_DEPENDENCY_LAYER];  string strSeqFile;    // for cmd lines  string strBsFile;typedef struct tagFilesSet {} SLayerPEncCtx;  SSliceConfig	sSliceCfg;  int32_t				iDLayerQp;typedef struct LayerpEncCtx_s { */ *	Layer Context/*using namespace WelsEnc;using namespace std;#include <iostream>#endif /* _WIN32 */#endif#define HAVE_PROCESS_AFFINITY#else /* defined(WINAPI_FAMILY) */#endif#define HAVE_PROCESS_AFFINITY#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)#include <winapifamily.h>#ifdef WINAPI_FAMILY#ifdef _WIN32#include "WelsThreadLib.h"#include "mt_defs.h"#include "wels_const.h"#include "macros.h"#include "extern.h"#include "codec_api.h"#include "codec_def.h"#endif//_MSC_VER#include <fcntl.h>  /* _O_BINARY */#include <io.h>     /* _setmode() */#ifdef _MSC_VER#include "typedefs.h"#include "read_config.h"#include "measure_time.h"//#define STICK_STREAM_SIZE#endif#define fprintf(a, ...) LOGI(__VA_ARGS__)#define printf(...) LOGI(__VA_ARGS__)#define LOGI(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)#define LOG_TAG "welsenc"#if defined (ANDROID_NDK)#define ONLY_ENC_FRAMES_NUM		INT_MAX // 2, INT_MAX	// type the num you try to encode here, 2, 10, etc#endif//ONLY_ENC_FRAMES_NUM#undef ONLY_ENC_FRAMES_NUM#ifdef ONLY_ENC_FRAMES_NUM#endif#include <android/log.h>#if defined (ANDROID_NDK)#include <stdarg.h>#include <signal.h>#include <assert.h>#include <string.h>#include <stdio.h>#define _CRT_SECURE_NO_WARNINGS */ * *     POSSIBILITY OF SUCH DAMAGE. *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * *          distribution. *          the documentation and/or other materials provided with the *          notice, this list of conditions and the following disclaimer in *        * Redistributions in binary form must reproduce the above copyright * *          notice, this list of conditions and the following disclaimer. *        * Redistributions of source code must retain the above copyright * *     are met: *     modification, are permitted provided that the following conditions *     Redistribution and use in source and binary forms, with or without * *     All rights reserved. *     Copyright (c)  2013, Cisco Systems * \copy/*!ad��x��������^D-����������P6�
�
�
�
A
%
������]&"!������fS)�
�
�
�
�
�
�
W
N
�	�	�	�	z	s	q	N	:	9	)	���K2+*����|mihVG<����k3����lXE?;:	�����}  return 1;  PrintHelp();  DestroySVCEncHandle (pSVCEncoder);exit:  return 0;  DestroySVCEncHandle (pSVCEncoder);  }    }        goto exit;      if (iRet > 0)      iRet = ProcessEncoding (pSVCEncoder, argc, argv, true);    } else {      }        goto exit;        cout << "You specified pCommand is invalid!!" << endl;      else {        PrintHelp();      } else if (argc == 2 && ! strcmp (argv[1], "-h"))          goto exit;        if (iRet != 0)        iRet = ProcessEncoding (pSVCEncoder, argc, argv, false);      if (argc > 2) {    if (!strstr (argv[1], ".cfg")) { // check configuration type (like .cfg?)  } else {    goto exit;  if (argc < 2) {  }    goto exit;    cout << "WelsCreateSVCEncoder() failed!!" << endl;  if (iRet) {  iRet = CreateSVCEncHandle (&pSVCEncoder);  signal (SIGINT, SigIntHandler);  /* Control-C handler */#endif  // LockToSingleCore();  // remove the LOCK_TO_SINGLE_CORE micro, user need to enable it with manual  _setmode (_fileno (stdout), _O_BINARY);  _setmode (_fileno (stdin), _O_BINARY);  /* thanks to Marcoss Morais <morais at dee.ufcg.edu.br> */#ifdef _MSC_VER  int iRet					= 0;  ISVCEncoder* pSVCEncoder	= NULL;{#endifint main (int argc, char** argv)#elseextern "C" int EncMain (int argc, char** argv)#if defined(ANDROID_NDK) || defined(APPLE_IOS) ****************************************************************************/ * main:/****************************************************************************}  }    WelsDestroySVCEncoder (pEncoder);  if (pEncoder) {void DestroySVCEncHandle (ISVCEncoder* pEncoder) {}  return ret;  ret = WelsCreateSVCEncoder (ppEncoder);  int32_t ret = 0;int32_t CreateSVCEncHandle (ISVCEncoder** ppEncoder) {}  return ;#endif  SetPriorityClass (hProcess, REALTIME_PRIORITY_CLASS);  // set high priority to avoid interrupts during test  }    SetProcessAffinityMask (hProcess, ProcessAffMask);    // Lock process to a single CPU core    }      ProcessAffMask = 1;    } else {      ProcessAffMask = 2;    if (ProcessAffMask & 2) {    // more than one CPU core available. Fix to only one:  if (ProcessAffMask > 1) {  GetProcessAffinityMask (hProcess, &ProcessAffMask, &SystemAffMask);  HANDLE hProcess = GetCurrentProcess();  ULONG_PTR ProcessAffMask = 0, SystemAffMask = 0;  //for 2005 compiler, change "DWORD" to "DWORD_PTR"#ifdef HAVE_PROCESS_AFFINITYvoid LockToSingleCore() {//  Merge from Heifei's Wonder.  Lock process to a single core}  return iRet;  }    pSrcPic = NULL;    delete pSrcPic;  if (pSrcPic) {  }    pYUV = NULL;    delete[] pYUV;  if (pYUV) {  }    pFileYUV = NULL;    fclose (pFileYUV);  if (pFileYUV != NULL) {  // Destruction memory introduced in this routine#endif  }    fpGolden = NULL;    fclose (fpGolden);  if (fpGolden) {#if defined (COMPARE_DATA)#endif  }adR�F�^C�����X@#�
�
j
0
��|7���F�
�
L

�	�	k	�������~t3���
��|����[#��O���V����        assert (uiSliceIdx < MAX_SLICES_NUM);        int uiSliceIdx = atoi (&kpString[kiSize]);        const char* kpString = strTag[0].c_str();      } else if (strTag[0].compare (0, kiSize, str_) == 0) {        sLayerCtx.sSliceCfg.sSliceArgument.uiSliceNum = atoi (strTag[1].c_str());      } else if (strTag[0].compare ("SliceNum") == 0) {        continue;        sLayerCtx.sSliceCfg.sSliceArgument.uiSliceSizeConstraint	= atoi (strTag[1].c_str());      } else if (strTag[0].compare ("SliceSize") == 0) { //SM_DYN_SLICE        sLayerCtx.sSliceCfg.uiSliceMode	= (SliceModeEnum)atoi (strTag[1].c_str());      } else if (strTag[0].compare ("SliceMode") == 0) {        sLayerCtx.iDLayerQp	= atoi (strTag[1].c_str());      } else if (strTag[0].compare ("InitialQP") == 0) {        }          }            return -1;                     pDLayer->iMaxSpatialBitrate, pDLayer->iSpatialBitrate);            fprintf (stderr, "Invalid max spatial(#%d) bitrate(%d) setting::: < layerBitrate(%d)!\n", iLayer,          if (pDLayer->iMaxSpatialBitrate > 0 && pDLayer->iMaxSpatialBitrate < pDLayer->iSpatialBitrate) {          }            return -1;            fprintf (stderr, "Invalid max spatial bitrate(%d) in dependency layer #%d.\n", pDLayer->iMaxSpatialBitrate, iLayer);          if (pDLayer->iMaxSpatialBitrate < 0) {        if (pSvcParam.iRCMode != RC_OFF_MODE) {        pDLayer->iMaxSpatialBitrate = 1000 * atoi (strTag[1].c_str());      } else if (strTag[0].compare ("MaxSpatialBitrate") == 0) {        }          iLeftTargetBitrate -= pDLayer->iSpatialBitrate;          }            return -1;                     pDLayer->iSpatialBitrate, iLeftTargetBitrate);            fprintf (stderr, "Invalid spatial(#%d) bitrate(%d) setting due to unavailable left(%d)!\n", iLayer,          if (pDLayer->iSpatialBitrate > iLeftTargetBitrate) {          }            return -1;            fprintf (stderr, "Invalid spatial bitrate(%d) in dependency layer #%d.\n", pDLayer->iSpatialBitrate, iLayer);          if (pDLayer->iSpatialBitrate <= 0) {        if (pSvcParam.iRCMode != RC_OFF_MODE) {        pDLayer->iSpatialBitrate	= 1000 * atoi (strTag[1].c_str());      } else if (strTag[0].compare ("SpatialBitrate") == 0) {        //					pDLayer->frext_mode	= (bool)atoi(strTag[1].c_str());      } else if (strTag[0].compare ("FRExt") == 0) {        pDLayer->uiProfileIdc	= (EProfileIdc)atoi (strTag[1].c_str());      } else if (strTag[0].compare ("ProfileIdc") == 0) {        strncpy (sFileSet.sRecFileName[iLayer], strTag[1].c_str(), kiLen);	// confirmed_safe_unsafe_usage        sFileSet.sRecFileName[iLayer][kiLen] = '\0';          return -1;        if (kiLen >= sizeof (sFileSet.sRecFileName[iLayer]))        const unsigned int kiLen = (unsigned int)strTag[1].length();      } else if (strTag[0].compare ("ReconFile") == 0) {        pDLayer->fFrameRate = (float)atof (strTag[1].c_str());      } else if (strTag[0].compare ("FrameRateOut") == 0) {        pDLayer->iVideoHeight	= atoi (strTag[1].c_str());      } else if (strTag[0].compare ("FrameHeight") == 0) {        pDLayer->iVideoWidth	= atoi (strTag[1].c_str());      if (strTag[0].compare ("FrameWidth") == 0) {        continue;      if (strTag[0].empty())    if (iLayerRd > 0) {    long iLayerRd = cRdLayerCfg.ReadLine (&strTag[0]);  while (!cRdLayerCfg.EndOfFile()) {  const int kiSize = (int)str_.size();  string str_ ("SlicesAssign");  string strTag[4];  memset (&sLayerCtx, 0, sizeof (SLayerPEncCtx));  SLayerPEncCtx sLayerCtx;  int iLeftTargetBitrate = (pSvcParam.iRCMode != RC_OFF_MODE) ? pSvcParam.iTargetBitrate : 0;  SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];ad]�G����b�=�
�
�
�
[
G
3


������V��c+�
�
�
i
A

�	�	C		��L��<��o!��7����O��_-��k;���      } else if (strTag[0].compare ("MultipleThreadIdc") == 0) {          pSvcParam.iLoopFilterBetaOffset	= 6;        else if (pSvcParam.iLoopFilterBetaOffset > 6)          pSvcParam.iLoopFilterBetaOffset	= -6;        if (pSvcParam.iLoopFilterBetaOffset < -6)        pSvcParam.iLoopFilterBetaOffset	= (int8_t)atoi (strTag[1].c_str());      } else if (strTag[0].compare ("LoopFilterBetaOffset") == 0) {          pSvcParam.iLoopFilterAlphaC0Offset	= 6;        else if (pSvcParam.iLoopFilterAlphaC0Offset > 6)          pSvcParam.iLoopFilterAlphaC0Offset	= -6;        if (pSvcParam.iLoopFilterAlphaC0Offset < -6)        pSvcParam.iLoopFilterAlphaC0Offset	= (int8_t)atoi (strTag[1].c_str());      } else if (strTag[0].compare ("LoopFilterAlphaC0Offset") == 0) {        }          break;          iRet = 1;          fprintf (stderr, "Invalid parameter in iLoopFilterDisableIdc: %d.\n", pSvcParam.iLoopFilterDisableIdc);        if (pSvcParam.iLoopFilterDisableIdc > 6 || pSvcParam.iLoopFilterDisableIdc < 0) {        pSvcParam.iLoopFilterDisableIdc	= (int8_t)atoi (strTag[1].c_str());      } else if (strTag[0].compare ("LoopFilterDisableIDC") == 0) {        pSvcParam.bEnableFrameCroppingFlag = (atoi (strTag[1].c_str()) != 0);      } else if (strTag[0].compare ("EnableFrameCropping") == 0) {        pSvcParam.bEnableSSEI	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableScalableSEI") == 0) {        pSvcParam.bEnableSpsPpsIdAddition	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableSpsPpsIDAddition") == 0) {        pSvcParam.uiMaxNalSize = atoi (strTag[1].c_str());      } else if (strTag[0].compare ("MaxNalSize") == 0) {        pSvcParam.uiIntraPeriod	= atoi (strTag[1].c_str());      } else if (strTag[0].compare ("IntraPeriod") == 0) {        pSvcParam.iTemporalLayerNum	= atoi (strTag[1].c_str());      } else if (strTag[0].compare ("TemporalLayerNum") == 0) {        sFileSet.uiFrameToBeCoded	= atoi (strTag[1].c_str());      } else if (strTag[0].compare ("FramesToBeEncoded") == 0) {        pSvcParam.fMaxFrameRate	= (float)atof (strTag[1].c_str());      } else if (strTag[0].compare ("MaxFrameRate") == 0) {        sFileSet.strBsFile	= strTag[1];      } else if (strTag[0].compare ("OutputFile") == 0) {          sFileSet.strSeqFile	= strTag[1];        if (strTag[1].length() > 0)      } else if (strTag[0].compare ("InputFile") == 0) {        pSrcPic->iPicHeight = atoi (strTag[1].c_str());      } else if (strTag[0].compare ("SourceHeight") == 0) {        pSrcPic->iPicWidth = atoi (strTag[1].c_str());      } else if (strTag[0].compare ("SourceWidth") == 0) {        pSvcParam.iUsageType = (EUsageType)atoi (strTag[1].c_str());      if (strTag[0].compare ("UsageType") == 0) {        continue;      if (strTag[0].empty())    if (iRd > 0) {    long iRd = cRdCfg.ReadLine (&strTag[0]);  while (!cRdCfg.EndOfFile()) {  int8_t iLayerCount = 0;  int32_t iRet = 0;  string strTag[4];int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSvcParam, SFilesSet& sFileSet) {}  return 0;          sizeof (sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum));	// confirmed_safe_unsafe_usage  memcpy (&pDLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[0],  memcpy (&pDLayer->sSliceCfg, &sLayerCtx.sSliceCfg, sizeof (SSliceConfig));	// confirmed_safe_unsafe_usage  pDLayer->sSliceCfg.uiSliceMode		= sLayerCtx.sSliceCfg.uiSliceMode;  pDLayer->iDLayerQp	= sLayerCtx.iDLayerQp;  }    }      }        sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx] = atoi (strTag[1].c_str());ad!IC�I��t>�
�
|
)
���U�G3)�
�
V

�	_		��6��R��Y��(����Y5���P���nf`\[��NJIH  }    pSvcParam.iSpatialLayerNum	= kiActualLayerNum;      kiActualLayerNum) {	// fixed number of dependency layer due to parameter error in settings  if (pSvcParam.iSpatialLayerNum >  const int8_t kiActualLayerNum = WELS_MIN (pSvcParam.iSpatialLayerNum, iLayerCount);  }    }      }        pSvcParam.bPrefixNalAddingCtrl	= ctrl_flag ? true : false;          ctrl_flag	= 0;        else if (ctrl_flag < 0)          ctrl_flag	= 1;        if (ctrl_flag > 1)        int ctrl_flag = atoi (strTag[1].c_str());      } else if (strTag[0].compare ("PrefixNALAddingCtrl") == 0) {        ++ iLayerCount;//				pSvcParam.sDependencyLayers[iLayerCount].uiDependencyId	= iLayerCount;          sFileSet.strLayerCfgFile[iLayerCount]	= strTag[1];        if (strTag[1].length() > 0)      } else if (strTag[0].compare ("LayerCfg") == 0) {        }          break;          iRet = 1;          fprintf (stderr, "Invalid parameter in iSpatialLayerNum: %d.\n", pSvcParam.iSpatialLayerNum);        if (pSvcParam.iSpatialLayerNum > MAX_DEPENDENCY_LAYER || pSvcParam.iSpatialLayerNum <= 0) {        pSvcParam.iSpatialLayerNum	= (int8_t)atoi (strTag[1].c_str());      } else if (strTag[0].compare ("NumLayers") == 0) {        pSvcParam.bIsLosslessLink	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("LosslessLink") == 0) {        pSvcParam.iLtrMarkPeriod	= (uint32_t)atoi (strTag[1].c_str());      } else if (strTag[0].compare ("LtrMarkPeriod") == 0) {        pSvcParam.iLTRRefNum = atoi (strTag[1].c_str());      } else if (strTag[0].compare ("LongTermReferenceNumber") == 0) {        pSvcParam.bEnableLongTermReference	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableLongTermReference") == 0) {        pSvcParam.bEnableFrameSkip	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableFrameSkip") == 0) {        pSvcParam.bEnableAdaptiveQuant	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableAdaptiveQuantization") == 0) {        pSvcParam.bEnableBackgroundDetection	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableBackgroundDetection") == 0) {        pSvcParam.bEnableSceneChangeDetect	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableSceneChangeDetection") == 0) {        pSvcParam.bEnableDenoise	= atoi (strTag[1].c_str()) ? true : false;      } else if (strTag[0].compare ("EnableDenoise") == 0) {        }          return 1;          fprintf (stderr, "Invalid max overall bitrate setting due to RC enabled. Check MaxOverallBitrate field please!\n");        if ((pSvcParam.iRCMode != RC_OFF_MODE) && pSvcParam.iMaxBitrate < 0) {        pSvcParam.iMaxBitrate	= 1000 * atoi (strTag[1].c_str());      } else if (strTag[0].compare ("MaxOverallBitrate") == 0) {        }          return 1;          fprintf (stderr, "Invalid target bitrate setting due to RC enabled. Check TargetBitrate field please!\n");        if ((pSvcParam.iRCMode != RC_OFF_MODE) && pSvcParam.iTargetBitrate <= 0) {        pSvcParam.iTargetBitrate	= 1000 * atoi (strTag[1].c_str());      } else if (strTag[0].compare ("TargetBitrate") == 0) {        pSvcParam.iRCMode	= (RC_MODES) atoi (strTag[1].c_str());      } else if (strTag[0].compare ("RCMode") == 0) {          pSvcParam.iMultipleThreadIdc = MAX_THREADS_NUM;        else if (pSvcParam.iMultipleThreadIdc > MAX_THREADS_NUM)          pSvcParam.iMultipleThreadIdc = 0;        if (pSvcParam.iMultipleThreadIdc < 0)        pSvcParam.iMultipleThreadIdc	= atoi (strTag[1].c_str());        // # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;ad6nG���H�����������Y(�
�
�
�
^
3

��+�^$�
�
U

�	&	��g�����a�~O�v5�`OML����rq\BA��onm      pSvcParam.iUsageType = (EUsageType)atoi (argv[n++]);    else if (!strcmp (pCommand, "-utype") && (n < argc))      sFileSet.strBsFile.assign (argv[n++]);    if (!strcmp (pCommand, "-bf") && (n < argc))    pCommand = argv[n++];  while (n < argc) {  string str_ ("SlicesAssign");  int n = 0;  SLayerPEncCtx sLayerCtx[3];  char* pCommand = NULL;int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamExt& pSvcParam, SFilesSet& sFileSet) {}  printf ("\n");  printf ("  -trace   (Level)\n");  printf ("  -slcmd   (Layer) (spatial layer slice mode): pls refer to layerX.cfg for details ( -slcnum: set target slice num; -slcsize: set target slice size constraint ) \n");  printf ("  -lmaxb     (Layer) (spatial layer max bitrate)\n");  printf ("  -ltarb	    (Layer) (spatial layer target bitrate)\n");  printf ("  -lqp		(Layer) (base quality layer qp : must work with -ldeltaqp or -lqparr)\n");  printf ("  -frout  	(Layer) (output frame rate)\n");  printf ("  -dh		(Layer) (output height)\n");  printf ("  -dw		(Layer) (output width)\n");  printf ("  -drec		(Layer) (reconstruction file);example: -drec 0 rec.yuv.  Setting the reconstruction file, this will only functioning when dumping reconstruction is enabled\n");  printf ("  -lconfig (Layer) (spatial layer configure file)\n");  printf ("  The options below are layer-based: (need to be set with layer id)\n");  printf ("  -numl   Number Of Layers: Must exist with layer_cfg file and the number of input layer_cfg file must equal to the value set by this command\n");  printf ("  -maxbrTotal  Overall max bitrate\n");  printf ("  -tarb	  Overall target bitrate\n");  printf ("  -rc	  rate control mode: 0-quality mode; 1-bitrate mode; 2-bitrate limited mode; -1-rc off \n");  printf ("  -betaOffset BetaOffset (-6..+6): valid range\n");  printf ("  -alphaOffset AlphaOffset(-6..+6): valid range \n");  printf ("  -deblockIdc Loop filter idc (0: on, 1: off, \n");  printf ("  -threadIdc 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads \n");  printf ("  -ltrnum Control the number of long term reference((1-4):screen LTR,(1-2):video LTR \n");  printf ("  -ltr    Control long term reference (default: 0)\n");  printf ("  -aq     Control adaptive quantization (default: 0)\n");  printf ("  -bgd    Control background detection (default: 0)\n");  printf ("  -scene  Control scene change detection (default: 0)\n");  printf ("  -denois Control denoising  (default: 0)\n");  printf ("  -spsid   Enable id adding in SPS/PPS per IDR \n");  printf ("  -nalsize the Maximum NAL size. which should be larger than the each layer slicesize when slice mode equals to SM_DYN_SLICE\n");  printf ("  -iper   Intra period (default: -1) : must be a power of 2 of GOP size (or -1)\n");  printf ("  -numtl  Temporal layer number (default: 1)\n");  printf ("  -frms   Number of total frames to be encoded\n");  printf ("  -sh     the source height\n");  printf ("  -sw     the source width\n");  printf ("  -org	  Original file, example: -org src.yuv\n");  printf ("  -bf     Bit Stream File\n");  printf ("\n Supported Options:\n");  printf (" Syntax: welsenc.exe welsenc.cfg [options]\n");  printf (" Syntax: welsenc.exe welsenc.cfg\n");  printf (" Syntax: welsenc.exe -h\n");  printf ("\n Wels SVC Encoder Usage:\n\n");void PrintHelp() {}  return iRet;  }    }      break;      iRet = 1;    if (-1 == ParseLayerConfig (cRdLayerCfg, iLayer, pSvcParam, sFileSet)) {    CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);  for (int8_t iLayer = 0; iLayer < kiActualLayerNum; ++ iLayer) {  assert (kiActualLayerNum <= MAX_DEPENDENCY_LAYER);ad/�X���V)(���|HG�
�
�
m
l
1

��{z@���xw@�
�
�
s
r
<
�	�	�	t	s	9	
			���^'&���n10����=<���gf(����B��H6.���N<
��      strncpy (sFileSet.sRecFileName[iLayer], argv[n++], iLen);	// confirmed_safe_unsafe_usage      sFileSet.sRecFileName[iLayer][iLen] = '\0';        return 1;      if (iLen >= sizeof (sFileSet.sRecFileName[iLayer]))      const unsigned int iLen = (int) strlen (argv[n]);      unsigned int	iLayer = atoi (argv[n++]);    } else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {      }        return 1;      if (-1 == ParseLayerConfig (cRdLayerCfg, iLayer, pSvcParam, sFileSet)) {      CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);      sFileSet.strLayerCfgFile[iLayer].assign (argv[n++]);      unsigned int	iLayer = atoi (argv[n++]);    } else if (!strcmp (pCommand, "-lconfig") && (n < argc)) {      pSvcParam.iSpatialLayerNum = atoi (argv[n++]);    else if (!strcmp (pCommand, "-numl") && (n < argc)) {      pSvcParam.iMaxBitrate = 1000 * atoi (argv[n++]);    else if (!strcmp (pCommand, "-maxbrTotal") && (n < argc))      pSvcParam.iTargetBitrate = 1000 * atoi (argv[n++]);    else if (!strcmp (pCommand, "-tarb") && (n < argc))      g_LevelSetting = atoi (argv[n++]);    else if (!strcmp (pCommand, "-trace") && (n < argc))      pSvcParam.iRCMode = static_cast<RC_MODES> (atoi (argv[n++]));    else if (!strcmp (pCommand, "-rc") && (n < argc))      pSvcParam.iLoopFilterBetaOffset = atoi (argv[n++]);    else if (!strcmp (pCommand, "-betaOffset") && (n < argc))      pSvcParam.iLoopFilterAlphaC0Offset = atoi (argv[n++]);    else if (!strcmp (pCommand, "-alphaOffset") && (n < argc))      pSvcParam.iLoopFilterDisableIdc = atoi (argv[n++]);    else if (!strcmp (pCommand, "-deblockIdc") && (n < argc))      pSvcParam.iMultipleThreadIdc = atoi (argv[n++]);    else if (!strcmp (pCommand, "-threadIdc") && (n < argc))      pSvcParam.iLtrMarkPeriod = atoi (argv[n++]);    else if (!strcmp (pCommand, "-ltrper") && (n < argc))      pSvcParam.iLTRRefNum = atoi (argv[n++]);    else if (!strcmp (pCommand, "-ltrnum") && (n < argc))      pSvcParam.bEnableLongTermReference = atoi (argv[n++]) ? true : false;    else if (!strcmp (pCommand, "-ltr") && (n < argc))      pSvcParam.bEnableFrameSkip = atoi (argv[n++]) ? true : false;    else if (!strcmp (pCommand, "-fs") && (n < argc))      pSvcParam.bEnableAdaptiveQuant = atoi (argv[n++]) ? true : false;    else if (!strcmp (pCommand, "-aq") && (n < argc))      pSvcParam.bEnableBackgroundDetection = atoi (argv[n++]) ? true : false;    else if (!strcmp (pCommand, "-bgd") && (n < argc))      pSvcParam.bEnableSceneChangeDetect = atoi (argv[n++]) ? true : false;    else if (!strcmp (pCommand, "-scene") && (n < argc))      pSvcParam.bEnableDenoise = atoi (argv[n++]) ? true : false;    else if (!strcmp (pCommand, "-denois") && (n < argc))      pSvcParam.bEnableSpsPpsIdAddition = atoi (argv[n++]) ? true : false;    else if (!strcmp (pCommand, "-spsid") && (n < argc))      pSvcParam.uiMaxNalSize = atoi (argv[n++]);    else if (!strcmp (pCommand, "-nalsize") && (n < argc))      pSvcParam.uiIntraPeriod = atoi (argv[n++]);    else if (!strcmp (pCommand, "-iper") && (n < argc))      pSvcParam.iTemporalLayerNum = atoi (argv[n++]);    else if (!strcmp (pCommand, "-numtl") && (n < argc))      sFileSet.uiFrameToBeCoded = atoi (argv[n++]);    else if (!strcmp (pCommand, "-frms") && (n < argc))      pSrcPic->iPicHeight = atoi (argv[n++]);    else if (!strcmp (pCommand, "-sh") && (n < argc))//source height      pSrcPic->iPicWidth = atoi (argv[n++]);    else if (!strcmp (pCommand, "-sw") && (n < argc))//source width      sFileSet.strSeqFile.assign (argv[n++]);    else if (!strcmp (pCommand, "-org") && (n < argc))adL�_��L��c2,+�
�
v
A
;
:
���;5���y1�
�
�
�
�
;
�	�	�	�	�	B	A			���{l^$���zk]%�����rD����c5���������W#���F��Z��  sParam.bEnableDenoise    = 0;    // denoise control  sParam.iSpatialLayerNum	= 4;	// layer number at spatial level  sParam.iTemporalLayerNum = 3;	// layer number at temporal level  sParam.iRCMode       = RC_QUALITY_MODE;       //  rc mode control  sParam.iMaxBitrate    = MAX_BIT_RATE;  sParam.iTargetBitrate = 2500000;		// target bitrate desired  sParam.iPicHeight	= 720;			// height of picture in samples  sParam.iPicWidth		= 1280;			// width of picture in samples  sParam.fMaxFrameRate	= 30.0f;		// input frame rate  sParam.iUsageType = CAMERA_VIDEO_REAL_TIME;  /* Test for temporal, spatial, SNR scalability */int FillSpecificParameters (SEncParamExt& sParam) {}  return 0;  }    }      pDLayer->sSliceCfg.sSliceArgument.uiSliceNum = atoi (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-slcnum") && (n + 1 < argc)) {    }      pDLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = atoi (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-slcsize") && (n + 1 < argc)) {    }      }        break;        pDLayer->sSliceCfg.uiSliceMode = SM_RESERVED;      default:        break;        pDLayer->sSliceCfg.uiSliceMode = SM_AUTO_SLICE;      case 5:        break;        pDLayer->sSliceCfg.uiSliceMode = SM_DYN_SLICE;      case 4:        break;        pDLayer->sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;      case 3:        break;        pDLayer->sSliceCfg.uiSliceMode = SM_RASTER_SLICE;      case 2:        break;        pDLayer->sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;      case 1:        break;        pDLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;      case 0:      switch (atoi (argv[n++])) {      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-slcmd") && (n + 1 < argc)) {    }      pDLayer->iMaxSpatialBitrate	= 1000 * atoi (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-lmaxb") && (n + 1 < argc)) {    }      pDLayer->iSpatialBitrate	= 1000 * atoi (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-ltarb") && (n + 1 < argc)) {    //sLayerCtx[iLayer].num_quality_layers = pDLayer->num_quality_layers = 1;    }      pDLayer->iDLayerQp = sLayerCtx[iLayer].iDLayerQp =  atoi (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-lqp") && (n + 1 < argc)) {    }      pDLayer->fFrameRate = (float)atof (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-frout") && (n + 1 < argc)) {    }      pDLayer->iVideoHeight =  atoi (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    else if (!strcmp (pCommand, "-dh") && (n + 1 < argc)) {    }      pDLayer->iVideoWidth =  atoi (argv[n++]);      SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];      unsigned int	iLayer = atoi (argv[n++]);    } else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {ad�W�m2���nK�
�
T

��CB0��t;�
�
a
`
N

�	�	Y		�10��a(��M���n1�������r_^G98#	�����lM5���|U<5������  CReadConfig cRdCfg;  // for configuration file  SFilesSet fs;#endif  FILE* fTrackStream = fopen ("coding_size.stream", "wb");;#if defined ( STICK_STREAM_SIZE )#endif  FILE* fpGolden = NULL;  //For getting the golden file handle#if defined(COMPARE_DATA)  FILE* pFpBs = NULL;  // Inactive with sink with output file handler  uint32_t iSourceWidth, iSourceHeight, kiPicResSize;  SSourcePicture* pSrcPic = NULL;  uint8_t* pYUV = NULL;  int32_t	iTotalFrameMax = -1;  int32_t iFrameIdx = 0;  int32_t iActualFrameEncodedCount = 0;  FILE* pFileYUV = NULL;  // Preparing encoding process  int64_t iStart = 0, iTotal = 0;  SEncParamExt sSvcParam;  SFrameBSInfo sFbi;    return 1;  if (pPtrEnc == NULL)  int iRet				= 0;int ProcessEncoding (ISVCEncoder* pPtrEnc, int argc, char** argv, bool bConfigFile) {}  return 0;  sParam.fMaxFrameRate = fMaxFr;  }      fMaxFr = sParam.sSpatialLayers[i].fFrameRate;    if (sParam.sSpatialLayers[i].fFrameRate > fMaxFr + EPSN)  for (int32_t i = sParam.iSpatialLayerNum - 2; i >= 0; -- i) {  float fMaxFr = sParam.sSpatialLayers[sParam.iSpatialLayerNum - 1].fFrameRate;  sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;  sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;  sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate     = MAX_BIT_RATE;  sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate		= 1500000;  sParam.sSpatialLayers[iIndexLayer].fFrameRate	= 30.0f;  sParam.sSpatialLayers[iIndexLayer].iVideoHeight	= 720;  sParam.sSpatialLayers[iIndexLayer].iVideoWidth	= 1280;  sParam.sSpatialLayers[iIndexLayer].uiProfileIdc	= PRO_SCALABLE_BASELINE;  ++ iIndexLayer;  sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;  sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;  sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate     = MAX_BIT_RATE;  sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate		= 512000;  sParam.sSpatialLayers[iIndexLayer].fFrameRate	= 30.0f;  sParam.sSpatialLayers[iIndexLayer].iVideoHeight	= 360;  sParam.sSpatialLayers[iIndexLayer].iVideoWidth	= 640;  sParam.sSpatialLayers[iIndexLayer].uiProfileIdc	= PRO_SCALABLE_BASELINE;  ++ iIndexLayer;  sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;  sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate     = MAX_BIT_RATE;  sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate		= 160000;  sParam.sSpatialLayers[iIndexLayer].fFrameRate	= 15.0f;  sParam.sSpatialLayers[iIndexLayer].iVideoHeight	= 180;  sParam.sSpatialLayers[iIndexLayer].iVideoWidth	= 320;  sParam.sSpatialLayers[iIndexLayer].uiProfileIdc	= PRO_SCALABLE_BASELINE;  ++ iIndexLayer;  sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;  sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate     = MAX_BIT_RATE;  sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate		= 64000;  sParam.sSpatialLayers[iIndexLayer].fFrameRate	= 7.5f;  sParam.sSpatialLayers[iIndexLayer].iVideoHeight	= 90;  sParam.sSpatialLayers[iIndexLayer].iVideoWidth	= 160;  sParam.sSpatialLayers[iIndexLayer].uiProfileIdc	= PRO_BASELINE;  int iIndexLayer = 0;  sParam.iComplexityMode = MEDIUM_COMPLEXITY;  sParam.bPrefixNalAddingCtrl = 0;  sParam.bEnableSpsPpsIdAddition = 1;  sParam.uiIntraPeriod		= 320;		// period of Intra frame  sParam.iLtrMarkPeriod = 30;  sParam.bEnableLongTermReference  = 0; // long term reference control  sParam.bEnableFrameSkip           = 1; // frame skipping  sParam.bEnableAdaptiveQuant       = 1; // adaptive quantization control  sParam.bEnableBackgroundDetection = 1; // background detection controladDh����SR,������gf*�
�
b
4
$


��tdHB>�����j$ �
�
�
v
u
P
:
,



�	�	�	�	o	%	�����A��XT�fe43���tp.���3������vS#
���zvu[4�  if ((fpGolden = fopen (argv[3], "rb")) == NULL) {  //For getting the golden file handle#if defined(COMPARE_DATA)  }    }      goto INSIDE_MEM_FREE;      iRet = 1;      fprintf (stderr, "Can not open file (%s) to write bitstream!\n", fs.strBsFile.c_str());    if (pFpBs == NULL) {    pFpBs = fopen (fs.strBsFile.c_str(), "wb");  if (fs.strBsFile.length() > 0) {  // Inactive with sink with output file handler  }    }      }        goto INSIDE_MEM_FREE;        iRet = 1;        fprintf (stderr, "SetOption ENCODER_OPTION_DUMP_FILE failed!\n");      if (cmResultSuccess != pPtrEnc->SetOption (ENCODER_OPTION_DUMP_FILE, &sDumpLayer)) {      sDumpLayer.pFileName = fs.sRecFileName[iLayer];      sDumpLayer.iLayer = iLayer;      SDumpLayer sDumpLayer;    if (fs.sRecFileName[iLayer][0] != 0) {  for (int iLayer = 0; iLayer < MAX_DEPENDENCY_LAYER; iLayer++) {  }    goto INSIDE_MEM_FREE;    iRet = 1;    fprintf (stderr, "SVC encoder Initialize failed\n");  if (cmResultSuccess != pPtrEnc->InitializeExt (&sSvcParam)) {	// SVC encoder initialization  iTotalFrameMax = (int32_t)fs.uiFrameToBeCoded;  sSvcParam.iPicHeight = (!sSvcParam.iPicHeight) ? iSourceHeight : sSvcParam.iPicHeight;  sSvcParam.iPicWidth = (!sSvcParam.iPicWidth) ? iSourceWidth : sSvcParam.iPicWidth;  //if target output resolution is not set, use the source size  }    sSvcParam.iPicHeight = WELS_MAX (sSvcParam.iPicHeight, pDLayer->iVideoHeight);    sSvcParam.iPicWidth = WELS_MAX (sSvcParam.iPicWidth, pDLayer->iVideoWidth);    SSpatialLayerConfig* pDLayer = &sSvcParam.sSpatialLayers[iLayer];  for (int iLayer = 0; iLayer < sSvcParam.iSpatialLayerNum; iLayer++) {  sSvcParam.iPicHeight = 0;  sSvcParam.iPicWidth = 0;  //update sSvcParam  pSrcPic->pData[2] = pSrcPic->pData[1] + (iSourceWidth * iSourceHeight >> 2);  pSrcPic->pData[1] = pSrcPic->pData[0] + (iSourceWidth * iSourceHeight);  pSrcPic->pData[0] = pYUV;  pSrcPic->iStride[1] = pSrcPic->iStride[2] = pSrcPic->iStride[0] >> 1;  pSrcPic->iStride[0] = iSourceWidth;  //update pSrcPic  }    goto INSIDE_MEM_FREE;    iRet = 1;  if (pYUV == NULL) {  pYUV = new uint8_t [kiPicResSize];  kiPicResSize = iSourceWidth * iSourceHeight * 3 >> 1;  iSourceHeight = pSrcPic->iPicHeight;  iSourceWidth = pSrcPic->iPicWidth;  //finish reading the configurations  }    pPtrEnc->SetOption (ENCODER_OPTION_TRACE_LEVEL, &g_LevelSetting);  if (g_LevelSetting >= 0) {  }    goto INSIDE_MEM_FREE;    iRet = 1;    printf ("parse pCommand line failed\n");  if (ParseCommandLine (argc - iParsedNum, argv + iParsedNum, pSrcPic, sSvcParam, fs) != 0) {  }    }      goto INSIDE_MEM_FREE;      iRet = 1;      fprintf (stderr, "parse svc parameter config file failed.\n");    if (iRet) {    iRet = ParseConfig (cRdCfg, pSrcPic, sSvcParam, fs);    }      goto INSIDE_MEM_FREE;      iRet = 1;               cRdCfg.GetFileName().c_str());      fprintf (stderr, "Specified file: %s not exist, maybe invalid path or parameter settting.\n",    if (!cRdCfg.ExistFile()) {    cRdCfg.Openf (argv[1]);    iParsedNum = 2;  if (bConfigFile) {  // if configure file exit, reading configure file firstly  pSrcPic->uiTimeStamp = 0;  pSrcPic->iColorFormat = videoFormatI420;  //fill default pSrcPic  }    goto INSIDE_MEM_FREE;    iRet = 1;  if (pSrcPic == NULL) {  pSrcPic = new SSourcePicture;  FillSpecificParameters (sSvcParam);  memset (&fs.sRecFileName[0][0], 0, sizeof (fs.sRecFileName));  pPtrEnc->GetDefaultParams (&sSvcParam);  memset (&sFbi, 0, sizeof (SFrameBSInfo));  int iParsedNum = 1;ad�l��~zsr@&���YSH�
�
�
�
�
�
�
;
����]PJ.�����l�
�
�
t
d
^
]
4


�	�	y	[	&		����B6�����K��l\N�����\8.����z7*������w���teQ?;���    fTrackStream = NULL;    fclose (fTrackStream);  if (fTrackStream) {#if defined (STICK_STREAM_SIZE)  }    pFpBs = NULL;    fclose (pFpBs);  if (pFpBs) {INSIDE_MEM_FREE:  }            iActualFrameEncodedCount, dElapsed, (iActualFrameEncodedCount * 1.0) / dElapsed);            sSvcParam.iPicWidth, sSvcParam.iPicHeight,    printf ("Width:		%d\nHeight:		%d\nFrames:		%d\nencode time:	%f sec\nFPS:		%f fps\n",    double dElapsed = iTotal / 1e6;  if (iActualFrameEncodedCount > 0) {  }    }      fprintf (stderr, "EncodeFrame(), ret: %d, frame index: %d.\n", iEncFrames, iFrameIdx);    } else {      ++ iActualFrameEncodedCount;	// excluding skipped frame time#endif//STICK_STREAM_SIZE      }        fwrite (&iFrameSize, 1, sizeof (int), fTrackStream);      if (fTrackStream) {#if defined (STICK_STREAM_SIZE)      }        ++ iLayer;        }          iFrameSize += iLayerSize;          fwrite (pLayerBsInfo->pBsBuf, 1, iLayerSize, pFpBs);	// write pure bit stream into file#endif          }            delete [] pUCArry;            fprintf (stderr, "frame%d/layer%d comparation completed!\n", iFrameIdx, iLayer);            }              }                break;                //fprintf(stderr, "%x - %x\n", pUCArry[w], pLayerBsInfo->pBsBuf[w]);                fprintf (stderr, "error @frame%d/layer%d/byte%d!!!!!!!!!!!!!!!!!!!!!!!!\n", iFrameIdx, iLayer, w);              if (pUCArry[w] != pLayerBsInfo->pBsBuf[w]) {            for (int w = 0; w < iLayerSize; w++) {            fread (pUCArry, 1, iLayerSize, fpGolden);            unsigned char* pUCArry = new unsigned char [iLayerSize];          {          //Comparing the result of encoder with golden pData#if defined(COMPARE_DATA)          } while (iNalIdx >= 0);            -- iNalIdx;            iLayerSize += pLayerBsInfo->pNalLengthInByte[iNalIdx];          do {          int iNalIdx = pLayerBsInfo->iNalCount - 1;          int iLayerSize = 0;        if (pLayerBsInfo != NULL) {        SLayerBSInfo* pLayerBsInfo = &sFbi.sLayerInfo[iLayer];      while (iLayer < sFbi.iLayerNum) {      int iFrameSize = 0;      int iLayer = 0;    if (iEncFrames == cmResultSuccess) {    }      continue;    if (videoFrameTypeSkip == sFbi.eFrameType) {    ++ iFrameIdx;    iTotal += WelsTime() - iStart;    int iEncFrames = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);    pSrcPic->uiTimeStamp = WELS_ROUND (iFrameIdx * (1000 / sSvcParam.fMaxFrameRate));    iStart	= WelsTime();    // To encoder this frame      break;    if (!bCanBeRead)    bCanBeRead = (fread (pYUV, 1, kiPicResSize, pFileYUV) == kiPicResSize);    bool bCanBeRead = false;#endif//ONLY_ENC_FRAMES_NUM    }      break;    if (iActualFrameEncodedCount >= ONLY_ENC_FRAMES_NUM) {    // Only encoded some limited frames here#ifdef ONLY_ENC_FRAMES_NUM                                        || (iFrameIdx < (int32_t)fs.uiFrameToBeCoded))) {  while (iFrameIdx < iTotalFrameMax && (((int32_t)fs.uiFrameToBeCoded <= 0)  iFrameIdx = 0;  }    goto INSIDE_MEM_FREE;    iRet = 1;             fs.strSeqFile.c_str());    fprintf (stderr, "Unable to open source sequence file (%s), check corresponding path!\n",  } else {    }      iTotalFrameMax = WELS_MAX ((int32_t) (i_size / kiPicResSize), iTotalFrameMax);      fseek (pFileYUV, 0, SEEK_SET);      int64_t i_size = ftell (pFileYUV);    if (!fseek (pFileYUV, 0, SEEK_END)) {  if (pFileYUV != NULL) {  pFileYUV = fopen (fs.strSeqFile.c_str(), "rb");#endif  }    goto INSIDE_MEM_FREE;    iRet = 1;    fprintf (stderr, "Unable to open golden sequence file, check corresponding path!\n");