Convert tabs to spaces before comments
This commit is contained in:
@@ -60,7 +60,7 @@ typedef HANDLE WELS_EVENT;
|
|||||||
#define WELS_THREAD_ROUTINE_TYPE DWORD WINAPI
|
#define WELS_THREAD_ROUTINE_TYPE DWORD WINAPI
|
||||||
#define WELS_THREAD_ROUTINE_RETURN(rc) return (DWORD)rc;
|
#define WELS_THREAD_ROUTINE_RETURN(rc) return (DWORD)rc;
|
||||||
|
|
||||||
#else // NON-WINDOWS
|
#else // NON-WINDOWS
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ void WelsCopy4x4_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStr
|
|||||||
void WelsCopy8x4_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
void WelsCopy8x4_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
||||||
void WelsCopy4x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
void WelsCopy4x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
||||||
void WelsCopy8x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
void WelsCopy8x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
||||||
void WelsCopy8x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); //
|
void WelsCopy8x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); //
|
||||||
void WelsCopy16x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); //
|
void WelsCopy16x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); //
|
||||||
void WelsCopy16x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
void WelsCopy16x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|||||||
@@ -218,14 +218,14 @@ enum EMmcoCode {
|
|||||||
* Bit-stream auxiliary reading / writing
|
* Bit-stream auxiliary reading / writing
|
||||||
*/
|
*/
|
||||||
typedef struct TagBitStringAux {
|
typedef struct TagBitStringAux {
|
||||||
uint8_t* pStartBuf; // buffer to start position
|
uint8_t* pStartBuf; // buffer to start position
|
||||||
uint8_t* pEndBuf; // buffer + length
|
uint8_t* pEndBuf; // buffer + length
|
||||||
int32_t iBits; // count bits of overall bitstreaming input
|
int32_t iBits; // count bits of overall bitstreaming input
|
||||||
|
|
||||||
intX_t iIndex; //only for cavlc usage
|
intX_t iIndex; //only for cavlc usage
|
||||||
uint8_t* pCurBuf; // current reading position
|
uint8_t* pCurBuf; // current reading position
|
||||||
uint32_t uiCurBits;
|
uint32_t uiCurBits;
|
||||||
int32_t iLeftBits; // count number of available bits left ([1, 8]),
|
int32_t iLeftBits; // count number of available bits left ([1, 8]),
|
||||||
// need pointer to next byte start position in case 0 bit left then 8 instead
|
// need pointer to next byte start position in case 0 bit left then 8 instead
|
||||||
} SBitStringAux, *PBitStringAux;
|
} SBitStringAux, *PBitStringAux;
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ typedef struct TagNalUnitHeader {
|
|||||||
uint8_t uiForbiddenZeroBit;
|
uint8_t uiForbiddenZeroBit;
|
||||||
uint8_t uiNalRefIdc;
|
uint8_t uiNalRefIdc;
|
||||||
EWelsNalUnitType eNalUnitType;
|
EWelsNalUnitType eNalUnitType;
|
||||||
uint8_t uiReservedOneByte; // only padding usage
|
uint8_t uiReservedOneByte; // only padding usage
|
||||||
} SNalUnitHeader, *PNalUnitHeader;
|
} SNalUnitHeader, *PNalUnitHeader;
|
||||||
|
|
||||||
/* NAL Unit Header in scalable extension syntax, refer to Page 390 in JVT X201wcm */
|
/* NAL Unit Header in scalable extension syntax, refer to Page 390 in JVT X201wcm */
|
||||||
@@ -244,7 +244,7 @@ typedef struct TagNalUnitHeaderExt {
|
|||||||
// uint8_t reserved_one_bit;
|
// uint8_t reserved_one_bit;
|
||||||
bool bIdrFlag;
|
bool bIdrFlag;
|
||||||
uint8_t uiPriorityId;
|
uint8_t uiPriorityId;
|
||||||
int8_t iNoInterLayerPredFlag; // change as int8_t to support 3 values probably in encoder
|
int8_t iNoInterLayerPredFlag; // change as int8_t to support 3 values probably in encoder
|
||||||
uint8_t uiDependencyId;
|
uint8_t uiDependencyId;
|
||||||
|
|
||||||
uint8_t uiQualityId;
|
uint8_t uiQualityId;
|
||||||
|
|||||||
@@ -299,12 +299,12 @@ WELS_THREAD_ERROR_CODE WelsEventOpen (WELS_EVENT* p_event, const char* event_
|
|||||||
}
|
}
|
||||||
WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_name) {
|
WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_name) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
WELS_THREAD_ERROR_CODE err = sem_close (*event); // match with sem_open
|
WELS_THREAD_ERROR_CODE err = sem_close (*event); // match with sem_open
|
||||||
if (event_name)
|
if (event_name)
|
||||||
sem_unlink (event_name);
|
sem_unlink (event_name);
|
||||||
return err;
|
return err;
|
||||||
#else
|
#else
|
||||||
WELS_THREAD_ERROR_CODE err = sem_destroy (*event); // match with sem_init
|
WELS_THREAD_ERROR_CODE err = sem_destroy (*event); // match with sem_init
|
||||||
free (*event);
|
free (*event);
|
||||||
return err;
|
return err;
|
||||||
#endif
|
#endif
|
||||||
@@ -322,7 +322,7 @@ WELS_THREAD_ERROR_CODE WelsEventSignal (WELS_EVENT* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WELS_THREAD_ERROR_CODE WelsEventWait (WELS_EVENT* event) {
|
WELS_THREAD_ERROR_CODE WelsEventWait (WELS_EVENT* event) {
|
||||||
return sem_wait (*event); // blocking until signaled
|
return sem_wait (*event); // blocking until signaled
|
||||||
}
|
}
|
||||||
|
|
||||||
WELS_THREAD_ERROR_CODE WelsEventWaitWithTimeOut (WELS_EVENT* event, uint32_t dwMilliseconds) {
|
WELS_THREAD_ERROR_CODE WelsEventWaitWithTimeOut (WELS_EVENT* event, uint32_t dwMilliseconds) {
|
||||||
@@ -360,7 +360,7 @@ WELS_THREAD_ERROR_CODE WelsEventWaitWithTimeOut (WELS_EVENT* event, uint32_t
|
|||||||
WELS_THREAD_ERROR_CODE WelsMultipleEventsWaitSingleBlocking (uint32_t nCount,
|
WELS_THREAD_ERROR_CODE WelsMultipleEventsWaitSingleBlocking (uint32_t nCount,
|
||||||
WELS_EVENT* event_list, WELS_EVENT* master_event) {
|
WELS_EVENT* event_list, WELS_EVENT* master_event) {
|
||||||
uint32_t nIdx = 0;
|
uint32_t nIdx = 0;
|
||||||
uint32_t uiAccessTime = 2; // 2 us once
|
uint32_t uiAccessTime = 2; // 2 us once
|
||||||
|
|
||||||
if (nCount == 0)
|
if (nCount == 0)
|
||||||
return WELS_THREAD_ERROR_WAIT_FAILED;
|
return WELS_THREAD_ERROR_WAIT_FAILED;
|
||||||
@@ -378,7 +378,7 @@ WELS_THREAD_ERROR_CODE WelsMultipleEventsWaitSingleBlocking (uint32_t nCount,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
nIdx = 0; // access each event by order
|
nIdx = 0; // access each event by order
|
||||||
while (nIdx < nCount) {
|
while (nIdx < nCount) {
|
||||||
int32_t err = 0;
|
int32_t err = 0;
|
||||||
int32_t wait_count = 0;
|
int32_t wait_count = 0;
|
||||||
@@ -399,7 +399,7 @@ WELS_THREAD_ERROR_CODE WelsMultipleEventsWaitSingleBlocking (uint32_t nCount,
|
|||||||
// we do need access next event next time
|
// we do need access next event next time
|
||||||
++ nIdx;
|
++ nIdx;
|
||||||
}
|
}
|
||||||
usleep (1); // switch to working threads
|
usleep (1); // switch to working threads
|
||||||
if (master_event != NULL) {
|
if (master_event != NULL) {
|
||||||
// A master event was used and was signalled, but none of the events in the
|
// A master event was used and was signalled, but none of the events in the
|
||||||
// list was found to be signalled, thus wait a little more when rechecking
|
// list was found to be signalled, thus wait a little more when rechecking
|
||||||
@@ -423,7 +423,7 @@ WELS_THREAD_ERROR_CODE WelsMultipleEventsWaitAllBlocking (uint32_t nCount,
|
|||||||
return WELS_THREAD_ERROR_WAIT_FAILED;
|
return WELS_THREAD_ERROR_WAIT_FAILED;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
nIdx = 0; // access each event by order
|
nIdx = 0; // access each event by order
|
||||||
while (nIdx < nCount) {
|
while (nIdx < nCount) {
|
||||||
const uint32_t kuiBitwiseFlag = (1 << nIdx);
|
const uint32_t kuiBitwiseFlag = (1 << nIdx);
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
|
|||||||
uiCPU |= WELS_CPU_CMOV;
|
uiCPU |= WELS_CPU_CMOV;
|
||||||
}
|
}
|
||||||
if ((!strcmp ((const char*)chVendorName, CPU_Vendor_INTEL)) ||
|
if ((!strcmp ((const char*)chVendorName, CPU_Vendor_INTEL)) ||
|
||||||
(!strcmp ((const char*)chVendorName, CPU_Vendor_AMD))) { // confirmed_safe_unsafe_usage
|
(!strcmp ((const char*)chVendorName, CPU_Vendor_AMD))) { // confirmed_safe_unsafe_usage
|
||||||
if (uiFeatureD & 0x10000000) {
|
if (uiFeatureD & 0x10000000) {
|
||||||
/* Multi-Threading checking: contains of multiple logic processors */
|
/* Multi-Threading checking: contains of multiple logic processors */
|
||||||
uiCPU |= WELS_CPU_HTT;
|
uiCPU |= WELS_CPU_HTT;
|
||||||
@@ -165,7 +165,7 @@ uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
|
|||||||
WelsCPUId (0x80000000, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
WelsCPUId (0x80000000, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
||||||
|
|
||||||
if ((!strcmp ((const char*)chVendorName, CPU_Vendor_AMD))
|
if ((!strcmp ((const char*)chVendorName, CPU_Vendor_AMD))
|
||||||
&& (uiFeatureA >= 0x80000001)) { // confirmed_safe_unsafe_usage
|
&& (uiFeatureA >= 0x80000001)) { // confirmed_safe_unsafe_usage
|
||||||
WelsCPUId (0x80000001, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
WelsCPUId (0x80000001, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
||||||
if (uiFeatureD & 0x00400000) {
|
if (uiFeatureD & 0x00400000) {
|
||||||
uiCPU |= WELS_CPU_MMXEXT;
|
uiCPU |= WELS_CPU_MMXEXT;
|
||||||
@@ -175,7 +175,7 @@ uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp ((const char*)chVendorName, CPU_Vendor_INTEL)) { // confirmed_safe_unsafe_usage
|
if (!strcmp ((const char*)chVendorName, CPU_Vendor_INTEL)) { // confirmed_safe_unsafe_usage
|
||||||
int32_t family, model;
|
int32_t family, model;
|
||||||
|
|
||||||
WelsCPUId (1, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
WelsCPUId (1, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
||||||
@@ -189,11 +189,11 @@ uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
|
|||||||
|
|
||||||
// get cache line size
|
// get cache line size
|
||||||
if ((!strcmp ((const char*)chVendorName, CPU_Vendor_INTEL))
|
if ((!strcmp ((const char*)chVendorName, CPU_Vendor_INTEL))
|
||||||
|| ! (strcmp ((const char*)chVendorName, CPU_Vendor_CYRIX))) { // confirmed_safe_unsafe_usage
|
|| ! (strcmp ((const char*)chVendorName, CPU_Vendor_CYRIX))) { // confirmed_safe_unsafe_usage
|
||||||
WelsCPUId (1, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
WelsCPUId (1, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
|
||||||
|
|
||||||
CacheLineSize = (uiFeatureB & 0xff00) >>
|
CacheLineSize = (uiFeatureB & 0xff00) >>
|
||||||
5; // ((clflush_line_size >> 8) << 3), CLFLUSH_line_size * 8 = CacheLineSize_in_byte
|
5; // ((clflush_line_size >> 8) << 3), CLFLUSH_line_size * 8 = CacheLineSize_in_byte
|
||||||
|
|
||||||
if (CacheLineSize == 128) {
|
if (CacheLineSize == 128) {
|
||||||
uiCPU |= WELS_CPU_CACHELINE_128;
|
uiCPU |= WELS_CPU_CACHELINE_128;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
||||||
|
|
||||||
#if defined(_WIN32) && defined(_MSC_VER)
|
#if defined(_WIN32) && defined(_MSC_VER)
|
||||||
|
|
||||||
|
|||||||
@@ -56,23 +56,23 @@ void DeblockLumaEq4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_
|
|||||||
bool bDetaQ2Q0 = WELS_ABS (q2 - q0) < iBeta;
|
bool bDetaQ2Q0 = WELS_ABS (q2 - q0) < iBeta;
|
||||||
if (bDetaP2P0) {
|
if (bDetaP2P0) {
|
||||||
const int32_t p3 = pPix[-4 * iStrideX];
|
const int32_t p3 = pPix[-4 * iStrideX];
|
||||||
pPix[-iStrideX] = (p2 + (p1 << 1) + (p0 << 1) + (q0 << 1) + q1 + 4) >> 3; //p0
|
pPix[-iStrideX] = (p2 + (p1 << 1) + (p0 << 1) + (q0 << 1) + q1 + 4) >> 3; //p0
|
||||||
pPix[-2 * iStrideX] = (p2 + p1 + p0 + q0 + 2) >> 2; //p1
|
pPix[-2 * iStrideX] = (p2 + p1 + p0 + q0 + 2) >> 2; //p1
|
||||||
pPix[-3 * iStrideX] = ((p3 << 1) + p2 + (p2 << 1) + p1 + p0 + q0 + 4) >> 3;//p2
|
pPix[-3 * iStrideX] = ((p3 << 1) + p2 + (p2 << 1) + p1 + p0 + q0 + 4) >> 3; //p2
|
||||||
} else {
|
} else {
|
||||||
pPix[-1 * iStrideX] = ((p1 << 1) + p0 + q1 + 2) >> 2; //p0
|
pPix[-1 * iStrideX] = ((p1 << 1) + p0 + q1 + 2) >> 2; //p0
|
||||||
}
|
}
|
||||||
if (bDetaQ2Q0) {
|
if (bDetaQ2Q0) {
|
||||||
const int32_t q3 = pPix[3 * iStrideX];
|
const int32_t q3 = pPix[3 * iStrideX];
|
||||||
pPix[0] = (p1 + (p0 << 1) + (q0 << 1) + (q1 << 1) + q2 + 4) >> 3; //q0
|
pPix[0] = (p1 + (p0 << 1) + (q0 << 1) + (q1 << 1) + q2 + 4) >> 3; //q0
|
||||||
pPix[iStrideX] = (p0 + q0 + q1 + q2 + 2) >> 2; //q1
|
pPix[iStrideX] = (p0 + q0 + q1 + q2 + 2) >> 2; //q1
|
||||||
pPix[2 * iStrideX] = ((q3 << 1) + q2 + (q2 << 1) + q1 + q0 + p0 + 4) >> 3;//q2
|
pPix[2 * iStrideX] = ((q3 << 1) + q2 + (q2 << 1) + q1 + q0 + p0 + 4) >> 3; //q2
|
||||||
} else {
|
} else {
|
||||||
pPix[0] = ((q1 << 1) + q0 + p1 + 2) >> 2; //q0
|
pPix[0] = ((q1 << 1) + q0 + p1 + 2) >> 2; //q0
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pPix[-iStrideX] = ((p1 << 1) + p0 + q1 + 2) >> 2; //p0
|
pPix[-iStrideX] = ((p1 << 1) + p0 + q1 + 2) >> 2; //p0
|
||||||
pPix[ 0] = ((q1 << 1) + q0 + p1 + 2) >> 2; //q0
|
pPix[ 0] = ((q1 << 1) + q0 + p1 + 2) >> 2; //q0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pPix += iStrideY;
|
pPix += iStrideY;
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ static inline void ExpandPictureLuma_c (uint8_t* pDst, const int32_t kiStride, c
|
|||||||
uint8_t* pBottom = pDstLastLine + kiStrides;
|
uint8_t* pBottom = pDstLastLine + kiStrides;
|
||||||
|
|
||||||
// pad pTop and pBottom
|
// pad pTop and pBottom
|
||||||
memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
|
memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
|
||||||
memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
|
memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
// pad corners
|
// pad corners
|
||||||
memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
|
memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
|
||||||
@@ -91,8 +91,8 @@ static inline void ExpandPictureChroma_c (uint8_t* pDst, const int32_t kiStride,
|
|||||||
uint8_t* pBottom = pDstLastLine + kiStrides;
|
uint8_t* pBottom = pDstLastLine + kiStrides;
|
||||||
|
|
||||||
// pad pTop and pBottom
|
// pad pTop and pBottom
|
||||||
memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
|
memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
|
||||||
memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
|
memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
// pad corners
|
// pad corners
|
||||||
memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
|
memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
|
||||||
@@ -160,7 +160,7 @@ void ExpandReferencingPicture (uint8_t* pData[3], int32_t iWidth, int32_t iHeigh
|
|||||||
pExpLuma (pPicY, iStride[0], kiWidthY, kiHeightY);
|
pExpLuma (pPicY, iStride[0], kiWidthY, kiHeightY);
|
||||||
if (kiWidthUV >= 16) {
|
if (kiWidthUV >= 16) {
|
||||||
// fix coding picture size as 16x16
|
// fix coding picture size as 16x16
|
||||||
const bool kbChrAligned = /*(iWidthUV >= 16) && */ ((kiWidthUV & 0x0F) == 0); // chroma planes: (16+iWidthUV) & 15
|
const bool kbChrAligned = /*(iWidthUV >= 16) && */ ((kiWidthUV & 0x0F) == 0); // chroma planes: (16+iWidthUV) & 15
|
||||||
pExpChrom[kbChrAligned] (pPicCb, iStride[1], kiWidthUV, kiHeightUV);
|
pExpChrom[kbChrAligned] (pPicCb, iStride[1], kiWidthUV, kiHeightUV);
|
||||||
pExpChrom[kbChrAligned] (pPicCr, iStride[2], kiWidthUV, kiHeightUV);
|
pExpChrom[kbChrAligned] (pPicCr, iStride[2], kiWidthUV, kiHeightUV);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void WelsI16x16LumaPredV_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStrid
|
|||||||
void WelsI16x16LumaPredH_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
|
void WelsI16x16LumaPredH_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride) {
|
||||||
int32_t iStridex15 = (kiStride << 4) - kiStride;
|
int32_t iStridex15 = (kiStride << 4) - kiStride;
|
||||||
int32_t iPredStride = 16;
|
int32_t iPredStride = 16;
|
||||||
int32_t iPredStridex15 = 240; //(iPredStride<<4)-iPredStride;
|
int32_t iPredStridex15 = 240; //(iPredStride<<4)-iPredStride;
|
||||||
uint8_t i = 15;
|
uint8_t i = 15;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace WelsCommon {
|
|||||||
//iB = dx * (8 - dy);
|
//iB = dx * (8 - dy);
|
||||||
//iC = (8 - dx) * dy;
|
//iC = (8 - dx) * dy;
|
||||||
//iD = dx * dy
|
//iD = dx * dy
|
||||||
static const uint8_t g_kuiABCD[8][8][4] = { //g_kA[dy][dx], g_kB[dy][dx], g_kC[dy][dx], g_kD[dy][dx]
|
static const uint8_t g_kuiABCD[8][8][4] = { //g_kA[dy][dx], g_kB[dy][dx], g_kC[dy][dx], g_kD[dy][dx]
|
||||||
{
|
{
|
||||||
{64, 0, 0, 0}, {56, 8, 0, 0}, {48, 16, 0, 0}, {40, 24, 0, 0},
|
{64, 0, 0, 0}, {56, 8, 0, 0}, {48, 16, 0, 0}, {40, 24, 0, 0},
|
||||||
{32, 32, 0, 0}, {24, 40, 0, 0}, {16, 48, 0, 0}, {8, 56, 0, 0}
|
{32, 32, 0, 0}, {24, 40, 0, 0}, {16, 48, 0, 0}, {8, 56, 0, 0}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
||||||
#include "codec_app_def.h"
|
#include "codec_app_def.h"
|
||||||
float WelsCalcPsnr (const void* kpTarPic,
|
float WelsCalcPsnr (const void* kpTarPic,
|
||||||
const int32_t kiTarStride,
|
const int32_t kiTarStride,
|
||||||
@@ -112,7 +112,7 @@ float WelsCalcPsnr (const void* kpTarPic,
|
|||||||
if (NULL == pTar || NULL == pRef)
|
if (NULL == pTar || NULL == pRef)
|
||||||
return (-1.0f);
|
return (-1.0f);
|
||||||
|
|
||||||
for (y = 0; y < kiHeight; ++ y) { // OPTable !!
|
for (y = 0; y < kiHeight; ++ y) { // OPTable !!
|
||||||
for (x = 0; x < kiWidth; ++ x) {
|
for (x = 0; x < kiWidth; ++ x) {
|
||||||
const int32_t kiT = pTar[y * kiTarStride + x] - pRef[y * kiRefStride + x];
|
const int32_t kiT = pTar[y * kiTarStride + x] - pRef[y * kiRefStride + x];
|
||||||
iSqe += kiT * kiT;
|
iSqe += kiT * kiT;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
||||||
|
|
||||||
#include "welsCodecTrace.h"
|
#include "welsCodecTrace.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@@ -78,7 +78,7 @@ void welsCodecTrace::CodecTrace (const int32_t iLevel, const char* Str_Format, v
|
|||||||
}
|
}
|
||||||
|
|
||||||
char pBuf[MAX_LOG_SIZE] = {0};
|
char pBuf[MAX_LOG_SIZE] = {0};
|
||||||
WelsVsnprintf (pBuf, MAX_LOG_SIZE, Str_Format, vl); // confirmed_safe_unsafe_usage
|
WelsVsnprintf (pBuf, MAX_LOG_SIZE, Str_Format, vl); // confirmed_safe_unsafe_usage
|
||||||
if (m_fpTrace) {
|
if (m_fpTrace) {
|
||||||
m_fpTrace (m_pTraceCtx, iLevel, pBuf);
|
m_fpTrace (m_pTraceCtx, iLevel, pBuf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,5 +64,5 @@ class CReadConfig {
|
|||||||
unsigned int m_iLines;
|
unsigned int m_iLines;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // READ_CONFIG_H__
|
#endif // READ_CONFIG_H__
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ CReadConfig::CReadConfig (const char* kpConfigFileName)
|
|||||||
: m_pCfgFile (0)
|
: m_pCfgFile (0)
|
||||||
, m_strCfgFileName (kpConfigFileName)
|
, m_strCfgFileName (kpConfigFileName)
|
||||||
, m_iLines (0) {
|
, m_iLines (0) {
|
||||||
if (strlen (kpConfigFileName) > 0) { // confirmed_safe_unsafe_usage
|
if (strlen (kpConfigFileName) > 0) { // confirmed_safe_unsafe_usage
|
||||||
m_pCfgFile = fopen (kpConfigFileName, "r");
|
m_pCfgFile = fopen (kpConfigFileName, "r");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ CReadConfig::~CReadConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CReadConfig::Openf (const char* kpStrFile) {
|
void CReadConfig::Openf (const char* kpStrFile) {
|
||||||
if (kpStrFile != NULL && strlen (kpStrFile) > 0) { // confirmed_safe_unsafe_usage
|
if (kpStrFile != NULL && strlen (kpStrFile) > 0) { // confirmed_safe_unsafe_usage
|
||||||
m_strCfgFileName = kpStrFile;
|
m_strCfgFileName = kpStrFile;
|
||||||
m_pCfgFile = fopen (kpStrFile, "r");
|
m_pCfgFile = fopen (kpStrFile, "r");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ int g_iDecodedFrameNum = 0;
|
|||||||
#endif
|
#endif
|
||||||
//using namespace WelsDec;
|
//using namespace WelsDec;
|
||||||
|
|
||||||
//#define NO_DELAY_DECODING // For Demo interfaces test with no delay decoding
|
//#define NO_DELAY_DECODING // For Demo interfaces test with no delay decoding
|
||||||
|
|
||||||
void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, const char* kpOuputFileName,
|
void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, const char* kpOuputFileName,
|
||||||
int32_t& iWidth, int32_t& iHeight, const char* pOptionFileName, const char* pLengthFileName) {
|
int32_t& iWidth, int32_t& iHeight, const char* pOptionFileName, const char* pLengthFileName) {
|
||||||
@@ -129,7 +129,7 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
|
|||||||
if (pYuvFile == NULL) {
|
if (pYuvFile == NULL) {
|
||||||
fprintf (stderr, "Can not open yuv file to output result of decoding..\n");
|
fprintf (stderr, "Can not open yuv file to output result of decoding..\n");
|
||||||
// any options
|
// any options
|
||||||
//return; // can let decoder work in quiet mode, no writing any output
|
//return; // can let decoder work in quiet mode, no writing any output
|
||||||
} else
|
} else
|
||||||
fprintf (stderr, "Sequence output file name: %s..\n", kpOuputFileName);
|
fprintf (stderr, "Sequence output file name: %s..\n", kpOuputFileName);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt&
|
|||||||
if (kiLen >= sizeof (sFileSet.sRecFileName[iLayer]))
|
if (kiLen >= sizeof (sFileSet.sRecFileName[iLayer]))
|
||||||
return -1;
|
return -1;
|
||||||
sFileSet.sRecFileName[iLayer][kiLen] = '\0';
|
sFileSet.sRecFileName[iLayer][kiLen] = '\0';
|
||||||
strncpy (sFileSet.sRecFileName[iLayer], strTag[1].c_str(), kiLen); // confirmed_safe_unsafe_usage
|
strncpy (sFileSet.sRecFileName[iLayer], strTag[1].c_str(), kiLen); // confirmed_safe_unsafe_usage
|
||||||
} else if (strTag[0].compare ("ProfileIdc") == 0) {
|
} else if (strTag[0].compare ("ProfileIdc") == 0) {
|
||||||
pDLayer->uiProfileIdc = (EProfileIdc)atoi (strTag[1].c_str());
|
pDLayer->uiProfileIdc = (EProfileIdc)atoi (strTag[1].c_str());
|
||||||
} else if (strTag[0].compare ("FRExt") == 0) {
|
} else if (strTag[0].compare ("FRExt") == 0) {
|
||||||
@@ -200,9 +200,9 @@ int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt&
|
|||||||
pDLayer->iDLayerQp = sLayerCtx.iDLayerQp;
|
pDLayer->iDLayerQp = sLayerCtx.iDLayerQp;
|
||||||
pDLayer->sSliceCfg.uiSliceMode = sLayerCtx.sSliceCfg.uiSliceMode;
|
pDLayer->sSliceCfg.uiSliceMode = sLayerCtx.sSliceCfg.uiSliceMode;
|
||||||
|
|
||||||
memcpy (&pDLayer->sSliceCfg, &sLayerCtx.sSliceCfg, sizeof (SSliceConfig)); // confirmed_safe_unsafe_usage
|
memcpy (&pDLayer->sSliceCfg, &sLayerCtx.sSliceCfg, sizeof (SSliceConfig)); // confirmed_safe_unsafe_usage
|
||||||
memcpy (&pDLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[0],
|
memcpy (&pDLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[0],
|
||||||
sizeof (sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum)); // confirmed_safe_unsafe_usage
|
sizeof (sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum)); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
|
|||||||
if (iLen >= sizeof (sFileSet.sRecFileName[iLayer]))
|
if (iLen >= sizeof (sFileSet.sRecFileName[iLayer]))
|
||||||
return 1;
|
return 1;
|
||||||
sFileSet.sRecFileName[iLayer][iLen] = '\0';
|
sFileSet.sRecFileName[iLayer][iLen] = '\0';
|
||||||
strncpy (sFileSet.sRecFileName[iLayer], argv[n++], iLen); // confirmed_safe_unsafe_usage
|
strncpy (sFileSet.sRecFileName[iLayer], argv[n++], iLen); // confirmed_safe_unsafe_usage
|
||||||
} else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {
|
} else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {
|
||||||
unsigned int iLayer = atoi (argv[n++]);
|
unsigned int iLayer = atoi (argv[n++]);
|
||||||
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
||||||
@@ -794,7 +794,7 @@ int ProcessEncoding (ISVCEncoder* pPtrEnc, int argc, char** argv, bool bConfigFi
|
|||||||
|
|
||||||
iTotalFrameMax = (int32_t)fs.uiFrameToBeCoded;
|
iTotalFrameMax = (int32_t)fs.uiFrameToBeCoded;
|
||||||
|
|
||||||
if (cmResultSuccess != pPtrEnc->InitializeExt (&sSvcParam)) { // SVC encoder initialization
|
if (cmResultSuccess != pPtrEnc->InitializeExt (&sSvcParam)) { // SVC encoder initialization
|
||||||
fprintf (stderr, "SVC encoder Initialize failed\n");
|
fprintf (stderr, "SVC encoder Initialize failed\n");
|
||||||
iRet = 1;
|
iRet = 1;
|
||||||
goto INSIDE_MEM_FREE;
|
goto INSIDE_MEM_FREE;
|
||||||
@@ -900,7 +900,7 @@ int ProcessEncoding (ISVCEncoder* pPtrEnc, int argc, char** argv, bool bConfigFi
|
|||||||
delete [] pUCArry;
|
delete [] pUCArry;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
fwrite (pLayerBsInfo->pBsBuf, 1, iLayerSize, pFpBs); // write pure bit stream into file
|
fwrite (pLayerBsInfo->pBsBuf, 1, iLayerSize, pFpBs); // write pure bit stream into file
|
||||||
iFrameSize += iLayerSize;
|
iFrameSize += iLayerSize;
|
||||||
}
|
}
|
||||||
++ iLayer;
|
++ iLayer;
|
||||||
@@ -910,7 +910,7 @@ int ProcessEncoding (ISVCEncoder* pPtrEnc, int argc, char** argv, bool bConfigFi
|
|||||||
fwrite (&iFrameSize, 1, sizeof (int), fTrackStream);
|
fwrite (&iFrameSize, 1, sizeof (int), fTrackStream);
|
||||||
}
|
}
|
||||||
#endif//STICK_STREAM_SIZE
|
#endif//STICK_STREAM_SIZE
|
||||||
++ iActualFrameEncodedCount; // excluding skipped frame time
|
++ iActualFrameEncodedCount; // excluding skipped frame time
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "EncodeFrame(), ret: %d, frame index: %d.\n", iEncFrames, iFrameIdx);
|
fprintf (stderr, "EncodeFrame(), ret: %d, frame index: %d.\n", iEncFrames, iFrameIdx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ int32_t ParseScalingList(PSps pSps,PBitStringAux pBs,bool bPPS,bool *bScalingLis
|
|||||||
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ParseSei (void* pSei, PBitStringAux pBsAux); // reserved Sei_Msg type
|
int32_t ParseSei (void* pSei, PBitStringAux pBsAux); // reserved Sei_Msg type
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ bool bNewSeqBegin;
|
|||||||
int32_t iMbEcedNum;
|
int32_t iMbEcedNum;
|
||||||
int32_t iMbEcedPropNum;
|
int32_t iMbEcedPropNum;
|
||||||
int32_t iMbNum;
|
int32_t iMbNum;
|
||||||
} SPicture, *PPicture; // "Picture" declaration is comflict with Mac system
|
} SPicture, *PPicture; // "Picture" declaration is comflict with Mac system
|
||||||
|
|
||||||
} // namespace WelsDec
|
} // namespace WelsDec
|
||||||
|
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight, pSrcNal, kSrcNalLen);
|
iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight, pSrcNal, kSrcNalLen);
|
||||||
if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009
|
if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009
|
||||||
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
|
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
|
||||||
pCtx->iErrorCode |= dsNoParamSets;
|
pCtx->iErrorCode |= dsNoParamSets;
|
||||||
else
|
else
|
||||||
@@ -625,7 +625,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs, pSrcNal, kSrcNalLen);
|
iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs, pSrcNal, kSrcNalLen);
|
||||||
if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009
|
if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009
|
||||||
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
|
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
|
||||||
pCtx->iErrorCode |= dsNoParamSets;
|
pCtx->iErrorCode |= dsNoParamSets;
|
||||||
else
|
else
|
||||||
@@ -934,7 +934,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
|
|||||||
WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); // level_idc
|
WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); // level_idc
|
||||||
uiLevelIdc = uiCode;
|
uiLevelIdc = uiCode;
|
||||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id
|
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id
|
||||||
if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009
|
if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n");
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n");
|
||||||
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW);
|
return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW);
|
||||||
}
|
}
|
||||||
@@ -1451,7 +1451,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux,
|
|||||||
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
* \note Call it in case eNalUnitType is NAL_UNIT_SEI.
|
||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type
|
int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type
|
||||||
|
|
||||||
|
|
||||||
return ERR_NONE;
|
return ERR_NONE;
|
||||||
@@ -1470,7 +1470,7 @@ int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type
|
|||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
int32_t SetScalingListValue (uint8_t* pScalingList, int iScalingListNum, bool* bUseDefaultScalingMatrixFlag,
|
int32_t SetScalingListValue (uint8_t* pScalingList, int iScalingListNum, bool* bUseDefaultScalingMatrixFlag,
|
||||||
PBitStringAux pBsAux) { // reserved Sei_Msg type
|
PBitStringAux pBsAux) { // reserved Sei_Msg type
|
||||||
int iLastScale = 8;
|
int iLastScale = 8;
|
||||||
int iNextScale = 8;
|
int iNextScale = 8;
|
||||||
int iDeltaScale;
|
int iDeltaScale;
|
||||||
|
|||||||
@@ -921,7 +921,7 @@ void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFun
|
|||||||
} else {
|
} else {
|
||||||
++iNextMbXyIndex;
|
++iNextMbXyIndex;
|
||||||
}
|
}
|
||||||
if (-1 == iNextMbXyIndex || iNextMbXyIndex >= iTotalMbCount) { // slice group boundary or end of a frame
|
if (-1 == iNextMbXyIndex || iNextMbXyIndex >= iTotalMbCount) { // slice group boundary or end of a frame
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
|
|||||||
} else {
|
} else {
|
||||||
++iNextMbXyIndex;
|
++iNextMbXyIndex;
|
||||||
}
|
}
|
||||||
if (-1 == iNextMbXyIndex || iNextMbXyIndex >= iTotalMbTargetLayer) { // slice group boundary or end of a frame
|
if (-1 == iNextMbXyIndex || iNextMbXyIndex >= iTotalMbTargetLayer) { // slice group boundary or end of a frame
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pCurLayer->iMbX = iNextMbXyIndex % pCurLayer->iMbWidth;
|
pCurLayer->iMbX = iNextMbXyIndex % pCurLayer->iMbWidth;
|
||||||
@@ -155,8 +155,8 @@ int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLa
|
|||||||
int32_t iMbXy = pCurLayer->iMbXyIndex;
|
int32_t iMbXy = pCurLayer->iMbXyIndex;
|
||||||
int32_t i, iIndex, iOffset;
|
int32_t i, iIndex, iOffset;
|
||||||
|
|
||||||
WelsChromaDcIdct (pCurLayer->pScaledTCoeff[iMbXy] + 256); // 256 = 16*16
|
WelsChromaDcIdct (pCurLayer->pScaledTCoeff[iMbXy] + 256); // 256 = 16*16
|
||||||
WelsChromaDcIdct (pCurLayer->pScaledTCoeff[iMbXy] + 320); // 320 = 16*16 + 16*4
|
WelsChromaDcIdct (pCurLayer->pScaledTCoeff[iMbXy] + 320); // 320 = 16*16 + 16*4
|
||||||
|
|
||||||
if (pCurLayer->pTransformSize8x8Flag[iMbXy]) {
|
if (pCurLayer->pTransformSize8x8Flag[iMbXy]) {
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
@@ -227,7 +227,7 @@ void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pC
|
|||||||
const int32_t kiX1 = kiOffset + kiXOffset[2];
|
const int32_t kiX1 = kiOffset + kiXOffset[2];
|
||||||
const int32_t kiX2 = STRIDE + kiOffset;
|
const int32_t kiX2 = STRIDE + kiOffset;
|
||||||
const int32_t kiX3 = kiOffset + kiXOffset[3];
|
const int32_t kiX3 = kiOffset + kiXOffset[3];
|
||||||
const int32_t kiI4 = i << 2; // 4*i
|
const int32_t kiI4 = i << 2; // 4*i
|
||||||
const int32_t kiZ0 = pBlk[kiOffset] + pBlk[kiX1];
|
const int32_t kiZ0 = pBlk[kiOffset] + pBlk[kiX1];
|
||||||
const int32_t kiZ1 = pBlk[kiOffset] - pBlk[kiX1];
|
const int32_t kiZ1 = pBlk[kiOffset] - pBlk[kiX1];
|
||||||
const int32_t kiZ2 = pBlk[kiX2] - pBlk[kiX3];
|
const int32_t kiZ2 = pBlk[kiX2] - pBlk[kiX3];
|
||||||
@@ -1227,7 +1227,7 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal
|
|||||||
pCurLayer->iMbXyIndex = iNextMbXyIndex;
|
pCurLayer->iMbXyIndex = iNextMbXyIndex;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame
|
if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1564,7 +1564,7 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
|
|||||||
// check whether there is left bits to read next time in case multiple slices
|
// check whether there is left bits to read next time in case multiple slices
|
||||||
iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits);
|
iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits);
|
||||||
// sub 1, for stop bit
|
// sub 1, for stop bit
|
||||||
if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary
|
if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary
|
||||||
uiEosFlag = 1;
|
uiEosFlag = 1;
|
||||||
}
|
}
|
||||||
if (iUsedBits > (pBs->iBits -
|
if (iUsedBits > (pBs->iBits -
|
||||||
@@ -1987,7 +1987,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
|
|||||||
// check whether there is left bits to read next time in case multiple slices
|
// check whether there is left bits to read next time in case multiple slices
|
||||||
iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits);
|
iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits);
|
||||||
// sub 1, for stop bit
|
// sub 1, for stop bit
|
||||||
if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary
|
if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary
|
||||||
uiEosFlag = 1;
|
uiEosFlag = 1;
|
||||||
}
|
}
|
||||||
if (iUsedBits > (pBs->iBits -
|
if (iUsedBits > (pBs->iBits -
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ void DestroyPicBuff (PPicBuff* ppPicBuf) {
|
|||||||
*/
|
*/
|
||||||
void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
|
void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
|
||||||
int32_t iCpuCores = 1;
|
int32_t iCpuCores = 1;
|
||||||
memset (pCtx, 0, sizeof (SWelsDecoderContext)); // fill zero first
|
memset (pCtx, 0, sizeof (SWelsDecoderContext)); // fill zero first
|
||||||
pCtx->sLogCtx = *pLogCtx;
|
pCtx->sLogCtx = *pLogCtx;
|
||||||
|
|
||||||
pCtx->pArgDec = NULL;
|
pCtx->pArgDec = NULL;
|
||||||
@@ -369,14 +369,14 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const
|
|||||||
pCtx->iPicQueueNumber = iPicQueueSize;
|
pCtx->iPicQueueNumber = iPicQueueSize;
|
||||||
if (pCtx->pPicBuff[LIST_0] != NULL
|
if (pCtx->pPicBuff[LIST_0] != NULL
|
||||||
&& pCtx->pPicBuff[LIST_0]->iCapacity ==
|
&& pCtx->pPicBuff[LIST_0]->iCapacity ==
|
||||||
iPicQueueSize) // comparing current picture queue size requested and previous allocation picture queue
|
iPicQueueSize) // comparing current picture queue size requested and previous allocation picture queue
|
||||||
bNeedChangePicQueue = false;
|
bNeedChangePicQueue = false;
|
||||||
// HD based pic buffer need consider memory size consumed when switch from 720p to other lower size
|
// HD based pic buffer need consider memory size consumed when switch from 720p to other lower size
|
||||||
WELS_VERIFY_RETURN_IF (ERR_NONE, pCtx->bHaveGotMemory && (kiPicWidth == pCtx->iImgWidthInPixel
|
WELS_VERIFY_RETURN_IF (ERR_NONE, pCtx->bHaveGotMemory && (kiPicWidth == pCtx->iImgWidthInPixel
|
||||||
&& kiPicHeight == pCtx->iImgHeightInPixel) && (!bNeedChangePicQueue)) // have same scaled buffer
|
&& kiPicHeight == pCtx->iImgHeightInPixel) && (!bNeedChangePicQueue)) // have same scaled buffer
|
||||||
|
|
||||||
// sync update pRefList
|
// sync update pRefList
|
||||||
WelsResetRefPic (pCtx); // added to sync update ref list due to pictures are free
|
WelsResetRefPic (pCtx); // added to sync update ref list due to pictures are free
|
||||||
|
|
||||||
if (pCtx->bHaveGotMemory && (kiPicWidth == pCtx->iImgWidthInPixel && kiPicHeight == pCtx->iImgHeightInPixel)
|
if (pCtx->bHaveGotMemory && (kiPicWidth == pCtx->iImgWidthInPixel && kiPicHeight == pCtx->iImgHeightInPixel)
|
||||||
&& pCtx->pPicBuff[LIST_0] != NULL && pCtx->pPicBuff[LIST_0]->iCapacity != iPicQueueSize) {
|
&& pCtx->pPicBuff[LIST_0] != NULL && pCtx->pPicBuff[LIST_0]->iCapacity != iPicQueueSize) {
|
||||||
@@ -621,7 +621,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
int32_t iSrcIdx = 0; //the index of source bit-stream till now after parsing one or more NALs
|
int32_t iSrcIdx = 0; //the index of source bit-stream till now after parsing one or more NALs
|
||||||
int32_t iSrcConsumed = 0; // consumed bit count of source bs
|
int32_t iSrcConsumed = 0; // consumed bit count of source bs
|
||||||
int32_t iDstIdx = 0; //the size of current NAL after 0x03 removal and 00 00 01 removal
|
int32_t iDstIdx = 0; //the size of current NAL after 0x03 removal and 00 00 01 removal
|
||||||
int32_t iSrcLength = 0; //the total size of current AU or NAL
|
int32_t iSrcLength = 0; //the total size of current AU or NAL
|
||||||
int32_t iRet = 0;
|
int32_t iRet = 0;
|
||||||
int32_t iConsumedBytes = 0;
|
int32_t iConsumedBytes = 0;
|
||||||
int32_t iOffset = 0;
|
int32_t iOffset = 0;
|
||||||
@@ -820,7 +820,7 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi
|
|||||||
const int32_t kiPicWidth = kiMbWidth << 4;
|
const int32_t kiPicWidth = kiMbWidth << 4;
|
||||||
const int32_t kiPicHeight = kiMbHeight << 4;
|
const int32_t kiPicHeight = kiMbHeight << 4;
|
||||||
|
|
||||||
iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight); // common memory used
|
iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight); // common memory used
|
||||||
if (ERR_NONE != iErr) {
|
if (ERR_NONE != iErr) {
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
|
||||||
"SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure.");
|
"SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure.");
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
|||||||
#ifdef LONG_TERM_REF
|
#ifdef LONG_TERM_REF
|
||||||
pCtx->bParamSetsLostFlag = false;
|
pCtx->bParamSetsLostFlag = false;
|
||||||
#else
|
#else
|
||||||
pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010
|
pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010
|
||||||
#endif //LONG_TERM_REF
|
#endif //LONG_TERM_REF
|
||||||
if (pCtx->iTotalNumMbRec == kiTotalNumMbInCurLayer) {
|
if (pCtx->iTotalNumMbRec == kiTotalNumMbInCurLayer) {
|
||||||
pCtx->bPrintFrameErrorTraceFlag = true;
|
pCtx->bPrintFrameErrorTraceFlag = true;
|
||||||
@@ -354,7 +354,7 @@ int32_t ParseRefPicListReordering (PBitStringAux pBs, PSliceHeader pSh) {
|
|||||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //abs_diff_pic_num_minus1
|
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //abs_diff_pic_num_minus1
|
||||||
WELS_CHECK_SE_UPPER_ERROR_NOLOG (uiCode, (uint32_t) (1 << pSps->uiLog2MaxFrameNum), "abs_diff_pic_num_minus1",
|
WELS_CHECK_SE_UPPER_ERROR_NOLOG (uiCode, (uint32_t) (1 << pSps->uiLog2MaxFrameNum), "abs_diff_pic_num_minus1",
|
||||||
GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_REF_REORDERING));
|
GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_REF_REORDERING));
|
||||||
pRefPicListReordering->sReorderingSyn[iList][iIdx].uiAbsDiffPicNumMinus1 = uiCode; // uiAbsDiffPicNumMinus1
|
pRefPicListReordering->sReorderingSyn[iList][iIdx].uiAbsDiffPicNumMinus1 = uiCode; // uiAbsDiffPicNumMinus1
|
||||||
} else if (kuiIdc == 2) {
|
} else if (kuiIdc == 2) {
|
||||||
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_pic_num
|
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_pic_num
|
||||||
pRefPicListReordering->sReorderingSyn[iList][iIdx].uiLongTermPicNum = uiCode;
|
pRefPicListReordering->sReorderingSyn[iList][iIdx].uiLongTermPicNum = uiCode;
|
||||||
@@ -1186,7 +1186,7 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) {
|
|||||||
++ uiActualIdx;
|
++ uiActualIdx;
|
||||||
}
|
}
|
||||||
if (uiActualIdx ==
|
if (uiActualIdx ==
|
||||||
pCurAu->uiActualUnitsNum) { // no found IDR nal within incoming AU, need exit to avoid mosaic issue, 11/19/2009
|
pCurAu->uiActualUnitsNum) { // no found IDR nal within incoming AU, need exit to avoid mosaic issue, 11/19/2009
|
||||||
|
|
||||||
pCtx->sDecoderStatistics.uiIDRLostNum++;
|
pCtx->sDecoderStatistics.uiIDRLostNum++;
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
|
||||||
@@ -1215,7 +1215,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
|
|||||||
pCtx->sMb.iMbHeight = (kiMaxHeight + 15) >> 4;
|
pCtx->sMb.iMbHeight = (kiMaxHeight + 15) >> 4;
|
||||||
|
|
||||||
if (pCtx->bInitialDqLayersMem && kiMaxWidth <= pCtx->iPicWidthReq
|
if (pCtx->bInitialDqLayersMem && kiMaxWidth <= pCtx->iPicWidthReq
|
||||||
&& kiMaxHeight <= pCtx->iPicHeightReq) // have same dimension memory, skipped
|
&& kiMaxHeight <= pCtx->iPicHeightReq) // have same dimension memory, skipped
|
||||||
return ERR_NONE;
|
return ERR_NONE;
|
||||||
|
|
||||||
|
|
||||||
@@ -1270,7 +1270,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
|
|||||||
sizeof (
|
sizeof (
|
||||||
int8_t) * MB_PARTITION_SIZE, "pCtx->sMb.pSubMbType[]");
|
int8_t) * MB_PARTITION_SIZE, "pCtx->sMb.pSubMbType[]");
|
||||||
pCtx->sMb.pSliceIdc[i] = (int32_t*) WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t),
|
pCtx->sMb.pSliceIdc[i] = (int32_t*) WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t),
|
||||||
"pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010
|
"pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010
|
||||||
pCtx->sMb.pResidualPredFlag[i] = (int8_t*) WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t),
|
pCtx->sMb.pResidualPredFlag[i] = (int8_t*) WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t),
|
||||||
"pCtx->sMb.pResidualPredFlag[]");
|
"pCtx->sMb.pResidualPredFlag[]");
|
||||||
//pCtx->sMb.pMotionPredFlag[i] = (uint8_t *) WelsMallocz(pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof(uint8_t), "pCtx->sMb.pMotionPredFlag[]");
|
//pCtx->sMb.pMotionPredFlag[i] = (uint8_t *) WelsMallocz(pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof(uint8_t), "pCtx->sMb.pMotionPredFlag[]");
|
||||||
@@ -2146,7 +2146,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
|||||||
GetI4LumaIChromaAddrTable (pCtx->iDecBlockOffsetArray, pCtx->pDec->iLinesize[0], pCtx->pDec->iLinesize[1]);
|
GetI4LumaIChromaAddrTable (pCtx->iDecBlockOffsetArray, pCtx->pDec->iLinesize[0], pCtx->pDec->iLinesize[1]);
|
||||||
|
|
||||||
if (pNalCur->sNalHeaderExt.uiLayerDqId > kuiTargetLayerDqId) { // confirmed pNalCur will never be NULL
|
if (pNalCur->sNalHeaderExt.uiLayerDqId > kuiTargetLayerDqId) { // confirmed pNalCur will never be NULL
|
||||||
break; // Per formance it need not to decode the remaining bits any more due to given uiLayerDqId required, 9/2/2009
|
break; // Per formance it need not to decode the remaining bits any more due to given uiLayerDqId required, 9/2/2009
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (&pLayerInfo, 0, sizeof (SLayerInfo));
|
memset (&pLayerInfo, 0, sizeof (SLayerInfo));
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ static inline int32_t FmoGenerateSliceGroup (PFmo pFmo, const PPps kpPps, const
|
|||||||
pFmo->iCountMbNum = iNumMb;
|
pFmo->iCountMbNum = iNumMb;
|
||||||
|
|
||||||
if (kpPps->uiNumSliceGroups < 2 && iNumMb > 0) { // only one slice group, exactly it is single slice based
|
if (kpPps->uiNumSliceGroups < 2 && iNumMb > 0) { // only one slice group, exactly it is single slice based
|
||||||
memset (pFmo->pMbAllocMap, 0, iNumMb * sizeof (int8_t)); // for safe
|
memset (pFmo->pMbAllocMap, 0, iNumMb * sizeof (int8_t)); // for safe
|
||||||
|
|
||||||
pFmo->iSliceGroupCount = 1;
|
pFmo->iSliceGroupCount = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ int32_t WelsReorderRefList (PWelsDecoderContext pCtx) {
|
|||||||
&& (pSliceHeader->iSpsId != ppRefList[i]->iSpsId)) { //check;
|
&& (pSliceHeader->iSpsId != ppRefList[i]->iSpsId)) { //check;
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsReorderRefList()::::BASE LAYER::::iSpsId:%d, ref_sps_id:%d",
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsReorderRefList()::::BASE LAYER::::iSpsId:%d, ref_sps_id:%d",
|
||||||
pSliceHeader->iSpsId, ppRefList[i]->iSpsId);
|
pSliceHeader->iSpsId, ppRefList[i]->iSpsId);
|
||||||
pCtx->iErrorCode = dsNoParamSets; //cross-IDR reference frame selection, SHOULD request IDR.--
|
pCtx->iErrorCode = dsNoParamSets; //cross-IDR reference frame selection, SHOULD request IDR.--
|
||||||
return ERR_INFO_REFERENCE_PIC_LOST;
|
return ERR_INFO_REFERENCE_PIC_LOST;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
@@ -230,7 +230,7 @@ int32_t WelsReorderRefList (PWelsDecoderContext pCtx) {
|
|||||||
&& (pSliceHeader->iSpsId != ppRefList[i]->iSpsId)) { //check;
|
&& (pSliceHeader->iSpsId != ppRefList[i]->iSpsId)) { //check;
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsReorderRefList()::::BASE LAYER::::iSpsId:%d, ref_sps_id:%d",
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsReorderRefList()::::BASE LAYER::::iSpsId:%d, ref_sps_id:%d",
|
||||||
pSliceHeader->iSpsId, ppRefList[i]->iSpsId);
|
pSliceHeader->iSpsId, ppRefList[i]->iSpsId);
|
||||||
pCtx->iErrorCode = dsNoParamSets; //cross-IDR reference frame selection, SHOULD request IDR.--
|
pCtx->iErrorCode = dsNoParamSets; //cross-IDR reference frame selection, SHOULD request IDR.--
|
||||||
return ERR_INFO_REFERENCE_PIC_LOST;
|
return ERR_INFO_REFERENCE_PIC_LOST;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ int32_t ExpandNalUnitList (PAccessUnit* ppAu, const int32_t kiOrgSize, const int
|
|||||||
PAccessUnit pTmp = NULL;
|
PAccessUnit pTmp = NULL;
|
||||||
int32_t iIdx = 0;
|
int32_t iIdx = 0;
|
||||||
|
|
||||||
if (MemInitNalList (&pTmp, kiExpSize)) // request new list with expanding
|
if (MemInitNalList (&pTmp, kiExpSize)) // request new list with expanding
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -115,7 +115,7 @@ int32_t ExpandNalUnitList (PAccessUnit* ppAu, const int32_t kiOrgSize, const int
|
|||||||
pTmp->uiEndPos = (*ppAu)->uiEndPos;
|
pTmp->uiEndPos = (*ppAu)->uiEndPos;
|
||||||
pTmp->bCompletedAuFlag = (*ppAu)->bCompletedAuFlag;
|
pTmp->bCompletedAuFlag = (*ppAu)->bCompletedAuFlag;
|
||||||
|
|
||||||
MemFreeNalList (ppAu); // free old list
|
MemFreeNalList (ppAu); // free old list
|
||||||
*ppAu = pTmp;
|
*ppAu = pTmp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -130,16 +130,16 @@ PNalUnit MemGetNextNal (PAccessUnit* ppAu) {
|
|||||||
PAccessUnit pAu = *ppAu;
|
PAccessUnit pAu = *ppAu;
|
||||||
PNalUnit pNu = NULL;
|
PNalUnit pNu = NULL;
|
||||||
|
|
||||||
if (pAu->uiAvailUnitsNum >= pAu->uiCountUnitsNum) { // need expand list
|
if (pAu->uiAvailUnitsNum >= pAu->uiCountUnitsNum) { // need expand list
|
||||||
const uint32_t kuiExpandingSize = pAu->uiCountUnitsNum + (MAX_NAL_UNIT_NUM_IN_AU >> 1);
|
const uint32_t kuiExpandingSize = pAu->uiCountUnitsNum + (MAX_NAL_UNIT_NUM_IN_AU >> 1);
|
||||||
if (ExpandNalUnitList (ppAu, pAu->uiCountUnitsNum, kuiExpandingSize))
|
if (ExpandNalUnitList (ppAu, pAu->uiCountUnitsNum, kuiExpandingSize))
|
||||||
return NULL; // out of memory
|
return NULL; // out of memory
|
||||||
pAu = *ppAu;
|
pAu = *ppAu;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNu = pAu->pNalUnitsList[pAu->uiAvailUnitsNum++]; // ready for next nal position
|
pNu = pAu->pNalUnitsList[pAu->uiAvailUnitsNum++]; // ready for next nal position
|
||||||
|
|
||||||
memset (pNu, 0, sizeof (SNalUnit)); // Please do not remove this for cache intend!!
|
memset (pNu, 0, sizeof (SNalUnit)); // Please do not remove this for cache intend!!
|
||||||
|
|
||||||
return pNu;
|
return pNu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,8 +547,8 @@ int32_t RecChroma (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLeve
|
|||||||
uint8_t uiCbpC = pDqLayer->pCbp[iMBXY] >> 4;
|
uint8_t uiCbpC = pDqLayer->pCbp[iMBXY] >> 4;
|
||||||
|
|
||||||
if (1 == uiCbpC || 2 == uiCbpC) {
|
if (1 == uiCbpC || 2 == uiCbpC) {
|
||||||
WelsChromaDcIdct (pScoeffLevel + 256); // 256 = 16*16
|
WelsChromaDcIdct (pScoeffLevel + 256); // 256 = 16*16
|
||||||
WelsChromaDcIdct (pScoeffLevel + 320); // 256 = 16*16
|
WelsChromaDcIdct (pScoeffLevel + 320); // 256 = 16*16
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
int16_t* pRS = pScoeffLevel + 256 + (i << 6);
|
int16_t* pRS = pScoeffLevel + 256 + (i << 6);
|
||||||
uint8_t* pPred = pDqLayer->pPred[i + 1];
|
uint8_t* pPred = pDqLayer->pPred[i + 1];
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ extern "C" {
|
|||||||
#include "manage_dec_ref.h"
|
#include "manage_dec_ref.h"
|
||||||
}
|
}
|
||||||
#include "error_code.h"
|
#include "error_code.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like util for cross platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like util for cross platforms
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#if defined(_WIN32) /*&& defined(_DEBUG)*/
|
#if defined(_WIN32) /*&& defined(_DEBUG)*/
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
|
|||||||
m_pDecContext->bInstantDecFlag = false; //reset no-delay flag
|
m_pDecContext->bInstantDecFlag = false; //reset no-delay flag
|
||||||
if (m_pDecContext->iErrorCode) {
|
if (m_pDecContext->iErrorCode) {
|
||||||
EWelsNalUnitType eNalType =
|
EWelsNalUnitType eNalType =
|
||||||
NAL_UNIT_UNSPEC_0; //for NBR, IDR frames are expected to decode as followed if error decoding an IDR currently
|
NAL_UNIT_UNSPEC_0; //for NBR, IDR frames are expected to decode as followed if error decoding an IDR currently
|
||||||
|
|
||||||
eNalType = m_pDecContext->sCurNalHead.eNalUnitType;
|
eNalType = m_pDecContext->sCurNalHead.eNalUnitType;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ $(TargetPath)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Options for algorithm, usually change bitrate
|
* Options for algorithm, usually change bitrate
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#define DISABLE_FMO_FEATURE //
|
#define DISABLE_FMO_FEATURE //
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Options for optimization, not change bitrate
|
* Options for optimization, not change bitrate
|
||||||
@@ -59,7 +59,7 @@ $(TargetPath)
|
|||||||
#define SINGLE_REF_FRAME // need to disable it when use multi-reference
|
#define SINGLE_REF_FRAME // need to disable it when use multi-reference
|
||||||
|
|
||||||
|
|
||||||
#if defined(WELS_TESTBED) // for SGE testing
|
#if defined(WELS_TESTBED) // for SGE testing
|
||||||
#define ENABLE_FRAME_DUMP
|
#define ENABLE_FRAME_DUMP
|
||||||
|
|
||||||
#ifdef FRAME_INFO_OUTPUT
|
#ifdef FRAME_INFO_OUTPUT
|
||||||
@@ -68,7 +68,7 @@ $(TargetPath)
|
|||||||
#endif//WELS_TESTBED
|
#endif//WELS_TESTBED
|
||||||
|
|
||||||
|
|
||||||
#if defined(__UNITTEST__) // for unittest
|
#if defined(__UNITTEST__) // for unittest
|
||||||
#ifndef ENABLE_FRAME_DUMP
|
#ifndef ENABLE_FRAME_DUMP
|
||||||
#define ENABLE_FRAME_DUMP
|
#define ENABLE_FRAME_DUMP
|
||||||
#endif//ENABLE_FRAME_DUMP
|
#endif//ENABLE_FRAME_DUMP
|
||||||
@@ -80,7 +80,7 @@ $(TargetPath)
|
|||||||
//
|
//
|
||||||
//#define FRAME_INFO_OUTPUT
|
//#define FRAME_INFO_OUTPUT
|
||||||
//#define LAYER_INFO_OUTPUT
|
//#define LAYER_INFO_OUTPUT
|
||||||
//#define SLICE_INFO_OUTPUT // useful in multiple slice coding track
|
//#define SLICE_INFO_OUTPUT // useful in multiple slice coding track
|
||||||
//#define MB_TYPES_INFO_OUTPUT
|
//#define MB_TYPES_INFO_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ int32_t EncodeFrame (sWelsEncCtx* pEncCtx,
|
|||||||
/**********************************************************************************
|
/**********************************************************************************
|
||||||
* memzero Function
|
* memzero Function
|
||||||
***********************************************************************************/
|
***********************************************************************************/
|
||||||
void WelsSetMemZero_c (void* pDst, int32_t iSize); // confirmed_safe_unsafe_usage
|
void WelsSetMemZero_c (void* pDst, int32_t iSize); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
#include "crt_util_safe_x.h"
|
#include "crt_util_safe_x.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include "mt_defs.h" // for multiple threadin,
|
#include "mt_defs.h" // for multiple threadin,
|
||||||
#include "WelsThreadLib.h"
|
#include "WelsThreadLib.h"
|
||||||
|
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
|||||||
uiIntraPeriod = pCodingParam.uiIntraPeriod;// intra period (multiple of GOP size as desired)
|
uiIntraPeriod = pCodingParam.uiIntraPeriod;// intra period (multiple of GOP size as desired)
|
||||||
if (uiIntraPeriod == (uint32_t) (-1))
|
if (uiIntraPeriod == (uint32_t) (-1))
|
||||||
uiIntraPeriod = 0;
|
uiIntraPeriod = 0;
|
||||||
else if (uiIntraPeriod & (uiGopSize - 1)) // none multiple of GOP size
|
else if (uiIntraPeriod & (uiGopSize - 1)) // none multiple of GOP size
|
||||||
uiIntraPeriod = ((uiIntraPeriod + uiGopSize - 1) / uiGopSize) * uiGopSize;
|
uiIntraPeriod = ((uiIntraPeriod + uiGopSize - 1) / uiGopSize) * uiGopSize;
|
||||||
|
|
||||||
if (((pCodingParam.iNumRefFrame != AUTO_REF_PIC_COUNT)
|
if (((pCodingParam.iNumRefFrame != AUTO_REF_PIC_COUNT)
|
||||||
@@ -400,7 +400,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
|||||||
= pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceNum;
|
= pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceNum;
|
||||||
const int32_t kiLesserSliceNum = ((MAX_SLICES_NUM < MAX_SLICES_NUM_TMP) ? MAX_SLICES_NUM : MAX_SLICES_NUM_TMP);
|
const int32_t kiLesserSliceNum = ((MAX_SLICES_NUM < MAX_SLICES_NUM_TMP) ? MAX_SLICES_NUM : MAX_SLICES_NUM_TMP);
|
||||||
memcpy (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum,
|
memcpy (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum,
|
||||||
pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceMbNum, // confirmed_safe_unsafe_usage
|
pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceMbNum, // confirmed_safe_unsafe_usage
|
||||||
kiLesserSliceNum * sizeof (uint32_t)) ;
|
kiLesserSliceNum * sizeof (uint32_t)) ;
|
||||||
|
|
||||||
pSpatialLayer->iDLayerQp = pCodingParam.sSpatialLayers[iIdxSpatial].iDLayerQp;
|
pSpatialLayer->iDLayerQp = pCodingParam.sSpatialLayers[iIdxSpatial].iDLayerQp;
|
||||||
@@ -454,7 +454,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
|||||||
int8_t iMaxTemporalId = 0;
|
int8_t iMaxTemporalId = 0;
|
||||||
|
|
||||||
memset (pDlp->uiCodingIdx2TemporalId, INVALID_TEMPORAL_ID, sizeof (pDlp->uiCodingIdx2TemporalId));
|
memset (pDlp->uiCodingIdx2TemporalId, INVALID_TEMPORAL_ID, sizeof (pDlp->uiCodingIdx2TemporalId));
|
||||||
pSpatialLayer->uiProfileIdc = uiProfileIdc; // PRO_BASELINE, PRO_SCALABLE_BASELINE;
|
pSpatialLayer->uiProfileIdc = uiProfileIdc; // PRO_BASELINE, PRO_SCALABLE_BASELINE;
|
||||||
|
|
||||||
iNotCodedMask = (1 << (kuiLogFactorInOutRate + kuiLogFactorMaxInRate)) - 1;
|
iNotCodedMask = (1 << (kuiLogFactorInOutRate + kuiLogFactorMaxInRate)) - 1;
|
||||||
for (uint32_t uiFrameIdx = 0; uiFrameIdx <= uiGopSize; ++ uiFrameIdx) {
|
for (uint32_t uiFrameIdx = 0; uiFrameIdx <= uiGopSize; ++ uiFrameIdx) {
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ int32_t WelsPSliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice, const bool kbIsH
|
|||||||
int32_t WelsPSliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice, const bool kbIsHighestDlayerFlag);
|
int32_t WelsPSliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice, const bool kbIsHighestDlayerFlag);
|
||||||
|
|
||||||
//encapsulation func: store base rec, highest Dependency Layer(only one quality) rec, single layer rec
|
//encapsulation func: store base rec, highest Dependency Layer(only one quality) rec, single layer rec
|
||||||
int32_t WelsISliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice); // for intra non-dynamic slice
|
int32_t WelsISliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice); // for intra non-dynamic slice
|
||||||
int32_t WelsISliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice); // for intra dynamic slice
|
int32_t WelsISliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice); // for intra dynamic slice
|
||||||
|
|
||||||
int32_t WelsCodePSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice);
|
int32_t WelsCodePSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice);
|
||||||
int32_t WelsCodePOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice);
|
int32_t WelsCodePOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice);
|
||||||
@@ -94,9 +94,9 @@ void UpdateMbNeighbourInfoForNextSlice (SSliceCtx* pSliceCtx,
|
|||||||
void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
|
void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
|
||||||
int32_t iNextSliceFirstMbIdx, const int32_t kiLastMbIdxInPartition);
|
int32_t iNextSliceFirstMbIdx, const int32_t kiLastMbIdxInPartition);
|
||||||
int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pMd,
|
int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pMd,
|
||||||
const int32_t kiSliceFirstMbXY); // for inter non-dynamic slice
|
const int32_t kiSliceFirstMbXY); // for inter non-dynamic slice
|
||||||
int32_t WelsMdInterMbLoopOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pMd,
|
int32_t WelsMdInterMbLoopOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pMd,
|
||||||
const int32_t kiSliceFirstMbXY); // for inter dynamic slice
|
const int32_t kiSliceFirstMbXY); // for inter dynamic slice
|
||||||
|
|
||||||
|
|
||||||
bool DynSlcJudgeSliceBoundaryStepBack (void* pEncCtx, void* pSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
|
bool DynSlcJudgeSliceBoundaryStepBack (void* pEncCtx, void* pSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#ifndef WELS_CONST_H__
|
#ifndef WELS_CONST_H__
|
||||||
#define WELS_CONST_H__
|
#define WELS_CONST_H__
|
||||||
|
|
||||||
#include "as264_common.h" // to communicate with specific macros there, 3/18/2010
|
#include "as264_common.h" // to communicate with specific macros there, 3/18/2010
|
||||||
#include "codec_app_def.h"
|
#include "codec_app_def.h"
|
||||||
#include "wels_const_common.h"
|
#include "wels_const_common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -243,13 +243,13 @@ int32_t WelsWriteSpsSyntax (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_
|
|||||||
|
|
||||||
BsWriteBits (pLocalBitStringAux, 8, pSps->uiProfileIdc);
|
BsWriteBits (pLocalBitStringAux, 8, pSps->uiProfileIdc);
|
||||||
|
|
||||||
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet0Flag); // bConstraintSet0Flag
|
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet0Flag); // bConstraintSet0Flag
|
||||||
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet1Flag); // bConstraintSet1Flag
|
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet1Flag); // bConstraintSet1Flag
|
||||||
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet2Flag); // bConstraintSet2Flag
|
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet2Flag); // bConstraintSet2Flag
|
||||||
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet3Flag); // bConstraintSet3Flag
|
BsWriteOneBit (pLocalBitStringAux, pSps->bConstraintSet3Flag); // bConstraintSet3Flag
|
||||||
BsWriteBits (pLocalBitStringAux, 4, 0); // reserved_zero_4bits, equal to 0
|
BsWriteBits (pLocalBitStringAux, 4, 0); // reserved_zero_4bits, equal to 0
|
||||||
BsWriteBits (pLocalBitStringAux, 8, pSps->iLevelIdc); // iLevelIdc
|
BsWriteBits (pLocalBitStringAux, 8, pSps->iLevelIdc); // iLevelIdc
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->uiSpsId + pSpsIdDelta[pSps->uiSpsId]); // seq_parameter_set_id
|
BsWriteUE (pLocalBitStringAux, pSps->uiSpsId + pSpsIdDelta[pSps->uiSpsId]); // seq_parameter_set_id
|
||||||
|
|
||||||
if (PRO_SCALABLE_BASELINE == pSps->uiProfileIdc || PRO_SCALABLE_HIGH == pSps->uiProfileIdc ||
|
if (PRO_SCALABLE_BASELINE == pSps->uiProfileIdc || PRO_SCALABLE_HIGH == pSps->uiProfileIdc ||
|
||||||
PRO_HIGH == pSps->uiProfileIdc || PRO_HIGH10 == pSps->uiProfileIdc ||
|
PRO_HIGH == pSps->uiProfileIdc || PRO_HIGH10 == pSps->uiProfileIdc ||
|
||||||
@@ -262,26 +262,26 @@ int32_t WelsWriteSpsSyntax (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_
|
|||||||
BsWriteOneBit (pLocalBitStringAux, 0); //seq_scaling_matrix_present_flag
|
BsWriteOneBit (pLocalBitStringAux, 0); //seq_scaling_matrix_present_flag
|
||||||
}
|
}
|
||||||
|
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->uiLog2MaxFrameNum - 4); // log2_max_frame_num_minus4
|
BsWriteUE (pLocalBitStringAux, pSps->uiLog2MaxFrameNum - 4); // log2_max_frame_num_minus4
|
||||||
BsWriteUE (pLocalBitStringAux, 0/*pSps->uiPocType*/); // pic_order_cnt_type
|
BsWriteUE (pLocalBitStringAux, 0/*pSps->uiPocType*/); // pic_order_cnt_type
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->iLog2MaxPocLsb - 4); // log2_max_pic_order_cnt_lsb_minus4
|
BsWriteUE (pLocalBitStringAux, pSps->iLog2MaxPocLsb - 4); // log2_max_pic_order_cnt_lsb_minus4
|
||||||
|
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->iNumRefFrames); // max_num_ref_frames
|
BsWriteUE (pLocalBitStringAux, pSps->iNumRefFrames); // max_num_ref_frames
|
||||||
BsWriteOneBit (pLocalBitStringAux, pSps->bGapsInFrameNumValueAllowedFlag); //gaps_in_frame_numvalue_allowed_flag
|
BsWriteOneBit (pLocalBitStringAux, pSps->bGapsInFrameNumValueAllowedFlag); //gaps_in_frame_numvalue_allowed_flag
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->iMbWidth - 1); // pic_width_in_mbs_minus1
|
BsWriteUE (pLocalBitStringAux, pSps->iMbWidth - 1); // pic_width_in_mbs_minus1
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->iMbHeight - 1); // pic_height_in_map_units_minus1
|
BsWriteUE (pLocalBitStringAux, pSps->iMbHeight - 1); // pic_height_in_map_units_minus1
|
||||||
BsWriteOneBit (pLocalBitStringAux, true/*pSps->bFrameMbsOnlyFlag*/); // bFrameMbsOnlyFlag
|
BsWriteOneBit (pLocalBitStringAux, true/*pSps->bFrameMbsOnlyFlag*/); // bFrameMbsOnlyFlag
|
||||||
|
|
||||||
BsWriteOneBit (pLocalBitStringAux, 0/*pSps->bDirect8x8InferenceFlag*/); // direct_8x8_inference_flag
|
BsWriteOneBit (pLocalBitStringAux, 0/*pSps->bDirect8x8InferenceFlag*/); // direct_8x8_inference_flag
|
||||||
BsWriteOneBit (pLocalBitStringAux, pSps->bFrameCroppingFlag); // bFrameCroppingFlag
|
BsWriteOneBit (pLocalBitStringAux, pSps->bFrameCroppingFlag); // bFrameCroppingFlag
|
||||||
if (pSps->bFrameCroppingFlag) {
|
if (pSps->bFrameCroppingFlag) {
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropLeft); // frame_crop_left_offset
|
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropLeft); // frame_crop_left_offset
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropRight); // frame_crop_right_offset
|
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropRight); // frame_crop_right_offset
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropTop); // frame_crop_top_offset
|
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropTop); // frame_crop_top_offset
|
||||||
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropBottom); // frame_crop_bottom_offset
|
BsWriteUE (pLocalBitStringAux, pSps->sFrameCrop.iCropBottom); // frame_crop_bottom_offset
|
||||||
}
|
}
|
||||||
if (bBaseLayer) {
|
if (bBaseLayer) {
|
||||||
BsWriteOneBit (pLocalBitStringAux, true); // vui_parameters_present_flag
|
BsWriteOneBit (pLocalBitStringAux, true); // vui_parameters_present_flag
|
||||||
WelsWriteVUI (pSps, pBitStringAux);
|
WelsWriteVUI (pSps, pBitStringAux);
|
||||||
} else {
|
} else {
|
||||||
BsWriteOneBit (pLocalBitStringAux, false);
|
BsWriteOneBit (pLocalBitStringAux, false);
|
||||||
|
|||||||
@@ -172,8 +172,8 @@ void WelsIDctT4Rec_c (uint8_t* pRec, int32_t iStride, uint8_t* pPred, int32_t iP
|
|||||||
|
|
||||||
for (i = 0; i < 4; i ++) { //horizon
|
for (i = 0; i < 4; i ++) { //horizon
|
||||||
int32_t iIdx = i << 2;
|
int32_t iIdx = i << 2;
|
||||||
const int32_t kiHorSumU = pDct[iIdx] + pDct[iIdx + 2]; // add 0-2
|
const int32_t kiHorSumU = pDct[iIdx] + pDct[iIdx + 2]; // add 0-2
|
||||||
const int32_t kiHorDelU = pDct[iIdx] - pDct[iIdx + 2]; // sub 0-2
|
const int32_t kiHorDelU = pDct[iIdx] - pDct[iIdx + 2]; // sub 0-2
|
||||||
const int32_t kiHorSumD = pDct[iIdx + 1] + (pDct[iIdx + 3] >> 1);
|
const int32_t kiHorSumD = pDct[iIdx + 1] + (pDct[iIdx + 3] >> 1);
|
||||||
const int32_t kiHorDelD = (pDct[iIdx + 1] >> 1) - pDct[iIdx + 3];
|
const int32_t kiHorDelD = (pDct[iIdx + 1] >> 1) - pDct[iIdx + 3];
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include "svc_base_layer_md.h"
|
#include "svc_base_layer_md.h"
|
||||||
#include "svc_mode_decision.h"
|
#include "svc_mode_decision.h"
|
||||||
#include "set_mb_syn_cavlc.h"
|
#include "set_mb_syn_cavlc.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross_platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross_platforms
|
||||||
#include "slice_multi_threading.h"
|
#include "slice_multi_threading.h"
|
||||||
|
|
||||||
// global function pointers definition
|
// global function pointers definition
|
||||||
@@ -131,7 +131,7 @@ int32_t InitPic (const void* kpSrc, const int32_t kiColorspace, const int32_t ki
|
|||||||
pSrcPic->iColorFormat = kiColorspace | videoFormatVFlip;
|
pSrcPic->iColorFormat = kiColorspace | videoFormatVFlip;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 2; // any else?
|
return 2; // any else?
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -286,7 +286,7 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) {
|
|||||||
pEncCtx->eNalPriority = NRI_PRI_HIGHEST;
|
pEncCtx->eNalPriority = NRI_PRI_HIGHEST;
|
||||||
|
|
||||||
// rc_init_gop
|
// rc_init_gop
|
||||||
} else { // B pictures are not supported now, any else?
|
} else { // B pictures are not supported now, any else?
|
||||||
assert (0);
|
assert (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName
|
|||||||
if (NULL == pCurPicture || NULL == kpFileName || kiDid >= MAX_DEPENDENCY_LAYER)
|
if (NULL == pCurPicture || NULL == kpFileName || kiDid >= MAX_DEPENDENCY_LAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (strlen (kpFileName) > 0) // confirmed_safe_unsafe_usage
|
if (strlen (kpFileName) > 0) // confirmed_safe_unsafe_usage
|
||||||
pDumpRecFile = WelsFopen (kpFileName, openMode);
|
pDumpRecFile = WelsFopen (kpFileName, openMode);
|
||||||
else {
|
else {
|
||||||
char sDependencyRecFileName[16] = {0};
|
char sDependencyRecFileName[16] = {0};
|
||||||
@@ -407,7 +407,7 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName
|
|||||||
iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile);
|
iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile);
|
||||||
assert (iWrittenSize == kiLumaWidth);
|
assert (iWrittenSize == kiLumaWidth);
|
||||||
if (iWrittenSize < kiLumaWidth) {
|
if (iWrittenSize < kiLumaWidth) {
|
||||||
assert (0); // make no sense for us if writing failed
|
assert (0); // make no sense for us if writing failed
|
||||||
WelsFclose (pDumpRecFile);
|
WelsFclose (pDumpRecFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -420,7 +420,7 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName
|
|||||||
iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile);
|
iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile);
|
||||||
assert (iWrittenSize == kiChromaWidth);
|
assert (iWrittenSize == kiChromaWidth);
|
||||||
if (iWrittenSize < kiChromaWidth) {
|
if (iWrittenSize < kiChromaWidth) {
|
||||||
assert (0); // make no sense for us if writing failed
|
assert (0); // make no sense for us if writing failed
|
||||||
WelsFclose (pDumpRecFile);
|
WelsFclose (pDumpRecFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -474,7 +474,7 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t k
|
|||||||
iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile);
|
iWrittenSize = WelsFwrite (pSrc + j * kiStrideY, 1, kiLumaWidth, pDumpRecFile);
|
||||||
assert (iWrittenSize == kiLumaWidth);
|
assert (iWrittenSize == kiLumaWidth);
|
||||||
if (iWrittenSize < kiLumaWidth) {
|
if (iWrittenSize < kiLumaWidth) {
|
||||||
assert (0); // make no sense for us if writing failed
|
assert (0); // make no sense for us if writing failed
|
||||||
WelsFclose (pDumpRecFile);
|
WelsFclose (pDumpRecFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t k
|
|||||||
iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile);
|
iWrittenSize = WelsFwrite (pSrc + j * kiStrideUV, 1, kiChromaWidth, pDumpRecFile);
|
||||||
assert (iWrittenSize == kiChromaWidth);
|
assert (iWrittenSize == kiChromaWidth);
|
||||||
if (iWrittenSize < kiChromaWidth) {
|
if (iWrittenSize < kiChromaWidth) {
|
||||||
assert (0); // make no sense for us if writing failed
|
assert (0); // make no sense for us if writing failed
|
||||||
WelsFclose (pDumpRecFile);
|
WelsFclose (pDumpRecFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t k
|
|||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
/***********************************************************************************/
|
||||||
void WelsSetMemZero_c (void* pDst, int32_t iSize) { // confirmed_safe_unsafe_usage
|
void WelsSetMemZero_c (void* pDst, int32_t iSize) { // confirmed_safe_unsafe_usage
|
||||||
memset (pDst, 0, iSize);
|
memset (pDst, 0, iSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include "deblocking.h"
|
#include "deblocking.h"
|
||||||
#include "ref_list_mgr_svc.h"
|
#include "ref_list_mgr_svc.h"
|
||||||
#include "ls_defines.h"
|
#include "ls_defines.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
|
||||||
#include "slice_multi_threading.h"
|
#include "slice_multi_threading.h"
|
||||||
#include "measure_time.h"
|
#include "measure_time.h"
|
||||||
#include "svc_set_mb_syn.h"
|
#include "svc_set_mb_syn.h"
|
||||||
@@ -64,8 +64,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
|
|||||||
SLayerBSInfo* pLayerBsInfo,
|
SLayerBSInfo* pLayerBsInfo,
|
||||||
int32_t* pNalIdxInLayer,
|
int32_t* pNalIdxInLayer,
|
||||||
int32_t* pLayerSize,
|
int32_t* pLayerSize,
|
||||||
int32_t iFirstMbInPartition, // first mb inclusive in partition
|
int32_t iFirstMbInPartition, // first mb inclusive in partition
|
||||||
int32_t iEndMbInPartition, // end mb exclusive in partition
|
int32_t iEndMbInPartition, // end mb exclusive in partition
|
||||||
int32_t iStartSliceIdx
|
int32_t iStartSliceIdx
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
|||||||
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
|
if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
|
||||||
//check uiSliceNum and set uiSliceMbNum with current uiSliceNum
|
//check uiSliceNum and set uiSliceMbNum with current uiSliceNum
|
||||||
if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum)) {
|
if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum)) {
|
||||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||||
@@ -469,7 +469,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
|||||||
}
|
}
|
||||||
assert (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1);
|
assert (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1);
|
||||||
} else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame,
|
} else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame,
|
||||||
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||||
//check uiSliceMbNum with current uiSliceNum
|
//check uiSliceMbNum with current uiSliceNum
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||||
@@ -501,13 +501,13 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!CheckRasterMultiSliceSetting (iMbNumInFrame,
|
if (!CheckRasterMultiSliceSetting (iMbNumInFrame,
|
||||||
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||||
}
|
}
|
||||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0
|
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0
|
||||||
|| pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings
|
|| pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!",
|
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!",
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||||
@@ -548,7 +548,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
|||||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||||
}
|
}
|
||||||
if (!CheckRowMbMultiSliceSetting (iMbWidth,
|
if (!CheckRowMbMultiSliceSetting (iMbWidth,
|
||||||
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||||
@@ -1178,7 +1178,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fix issue in case single pSlice coding might be inclusive exist in variant spatial layer setting, also introducing multi-pSlice modes
|
// fix issue in case single pSlice coding might be inclusive exist in variant spatial layer setting, also introducing multi-pSlice modes
|
||||||
else { // only one pSlice
|
else { // only one pSlice
|
||||||
SSlice* pSlice = &pDqLayer->sLayerInfo.pSliceInLayer[0];
|
SSlice* pSlice = &pDqLayer->sLayerInfo.pSliceInLayer[0];
|
||||||
pSlice->uiSliceIdx = 0;
|
pSlice->uiSliceIdx = 0;
|
||||||
pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
|
pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
|
||||||
@@ -1410,8 +1410,8 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers
|
|||||||
uint8_t* pBaseDec = NULL, *pBaseEnc = NULL, *pBaseMbX = NULL, *pBaseMbY = NULL;
|
uint8_t* pBaseDec = NULL, *pBaseEnc = NULL, *pBaseMbX = NULL, *pBaseMbY = NULL;
|
||||||
struct {
|
struct {
|
||||||
int32_t iMbWidth;
|
int32_t iMbWidth;
|
||||||
int32_t iCountMbNum; // count number of SMB in each spatial
|
int32_t iCountMbNum; // count number of SMB in each spatial
|
||||||
int32_t iSizeAllMbAlignCache; // cache line size aligned in each spatial
|
int32_t iSizeAllMbAlignCache; // cache line size aligned in each spatial
|
||||||
} sMbSizeMap[MAX_DEPENDENCY_LAYER] = {{ 0 }};
|
} sMbSizeMap[MAX_DEPENDENCY_LAYER] = {{ 0 }};
|
||||||
int32_t iLineSizeY[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
|
int32_t iLineSizeY[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
|
||||||
int32_t iLineSizeUV[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
|
int32_t iLineSizeUV[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
|
||||||
@@ -1607,7 +1607,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < kiMbHeight) {
|
while (i < kiMbHeight) {
|
||||||
memcpy (pMbIndexX, pRowX, kiLineSize); // confirmed_safe_unsafe_usage
|
memcpy (pMbIndexX, pRowX, kiLineSize); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
pMbIndexX += kiMbWidth;
|
pMbIndexX += kiMbWidth;
|
||||||
++ i;
|
++ i;
|
||||||
@@ -1630,7 +1630,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers
|
|||||||
int16_t* pMbIndexY = pPtr->pMbIndexY[iSpatialIdx] + i * kiMbWidth;
|
int16_t* pMbIndexY = pPtr->pMbIndexY[iSpatialIdx] + i * kiMbWidth;
|
||||||
|
|
||||||
if (i < kiMbHeight) {
|
if (i < kiMbHeight) {
|
||||||
memcpy (pMbIndexY, pRowY, kiLineSize); // confirmed_safe_unsafe_usage
|
memcpy (pMbIndexY, pRowY, kiLineSize); // confirmed_safe_unsafe_usage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++ i;
|
++ i;
|
||||||
@@ -2205,7 +2205,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MEMORY_MONITOR)
|
#if defined(MEMORY_MONITOR)
|
||||||
assert (pMa->WelsGetMemoryUsage() == 0); // ensure all memory free well
|
assert (pMa->WelsGetMemoryUsage() == 0); // ensure all memory free well
|
||||||
#endif//MEMORY_MONITOR
|
#endif//MEMORY_MONITOR
|
||||||
|
|
||||||
if ((*ppCtx)->pMemAlign != NULL) {
|
if ((*ppCtx)->pMemAlign != NULL) {
|
||||||
@@ -2277,7 +2277,7 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar
|
|||||||
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
|
if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
|
||||||
//check uiSliceNum and set uiSliceMbNum with current uiSliceNum
|
//check uiSliceNum and set uiSliceMbNum with current uiSliceNum
|
||||||
if (!GomValidCheckSliceNum (kiMbWidth, kiMbHeight, &pDlp->sSliceCfg.sSliceArgument.uiSliceNum)) {
|
if (!GomValidCheckSliceNum (kiMbWidth, kiMbHeight, &pDlp->sSliceCfg.sSliceArgument.uiSliceNum)) {
|
||||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||||
@@ -2292,7 +2292,7 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar
|
|||||||
return ENC_RETURN_INVALIDINPUT;
|
return ENC_RETURN_INVALIDINPUT;
|
||||||
}
|
}
|
||||||
} else if (!CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame,
|
} else if (!CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame,
|
||||||
&pDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
&pDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||||
//check uiSliceMbNum with current uiSliceNum
|
//check uiSliceMbNum with current uiSliceNum
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||||
"InitSliceSettings(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",
|
"InitSliceSettings(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",
|
||||||
@@ -2400,7 +2400,7 @@ int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCoding
|
|||||||
uiCpuCores = pCodingParam->iMultipleThreadIdc;
|
uiCpuCores = pCodingParam->iMultipleThreadIdc;
|
||||||
else {
|
else {
|
||||||
if (uiCpuCores ==
|
if (uiCpuCores ==
|
||||||
0) // cpuid not supported or doesn't expose the number of cores, use high level system API as followed to detect number of pysical/logic processor
|
0) // cpuid not supported or doesn't expose the number of cores, use high level system API as followed to detect number of pysical/logic processor
|
||||||
uiCpuCores = DynamicDetectCpuCores();
|
uiCpuCores = DynamicDetectCpuCores();
|
||||||
// So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,
|
// So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,
|
||||||
// for client application here it is constrained by maximal to MAX_THREADS_NUM
|
// for client application here it is constrained by maximal to MAX_THREADS_NUM
|
||||||
@@ -2475,7 +2475,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar
|
|||||||
FreeMemorySvc (&pCtx);
|
FreeMemorySvc (&pCtx);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
memcpy (pCtx->pSvcParam, pCodingParam, sizeof (SWelsSvcCodingParam)); // confirmed_safe_unsafe_usage
|
memcpy (pCtx->pSvcParam, pCodingParam, sizeof (SWelsSvcCodingParam)); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
pCtx->pFuncList = (SWelsFuncPtrList*)pCtx->pMemAlign->WelsMalloc (sizeof (SWelsFuncPtrList), "SWelsFuncPtrList");
|
pCtx->pFuncList = (SWelsFuncPtrList*)pCtx->pMemAlign->WelsMalloc (sizeof (SWelsFuncPtrList), "SWelsFuncPtrList");
|
||||||
if (NULL == pCtx->pFuncList) {
|
if (NULL == pCtx->pFuncList) {
|
||||||
@@ -2639,7 +2639,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) {
|
|||||||
if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
|
if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
|
||||||
WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
|
WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
|
||||||
WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
|
WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
|
||||||
res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
|
res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
|
||||||
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..",
|
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..",
|
||||||
iThreadIdx,
|
iThreadIdx,
|
||||||
res);
|
res);
|
||||||
@@ -2844,7 +2844,7 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx,
|
|||||||
|
|
||||||
pCurDq->pDecPic = pDecPic;
|
pCurDq->pDecPic = pDecPic;
|
||||||
|
|
||||||
if (fDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update
|
if (fDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update
|
||||||
iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceCfg);
|
iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceCfg);
|
||||||
else
|
else
|
||||||
iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx);
|
iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx);
|
||||||
@@ -3146,7 +3146,7 @@ void ParasetIdAdditionIdAdjust (SParaSetOffsetVariable* sParaSetOffsetVariable,
|
|||||||
sParaSetOffsetVariable->iParaSetIdDelta[kiEncId] = uiNextIdInBs -
|
sParaSetOffsetVariable->iParaSetIdDelta[kiEncId] = uiNextIdInBs -
|
||||||
kiEncId; //for current parameter set, change its id_delta
|
kiEncId; //for current parameter set, change its id_delta
|
||||||
//write pso pData for next update:
|
//write pso pData for next update:
|
||||||
sParaSetOffsetVariable->bUsedParaSetIdInBs[uiNextIdInBs] = true; // update current used_id
|
sParaSetOffsetVariable->bUsedParaSetIdInBs[uiNextIdInBs] = true; // update current used_id
|
||||||
|
|
||||||
//prepare for next update:
|
//prepare for next update:
|
||||||
// find the next avaibable iId
|
// find the next avaibable iId
|
||||||
@@ -3716,7 +3716,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pSrcPic->uiTimeStamp);
|
pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pSrcPic->uiTimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
|
if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
|
||||||
++ pCtx->iCodingIndex;
|
++ pCtx->iCodingIndex;
|
||||||
pFbi->eFrameType = videoFrameTypeSkip;
|
pFbi->eFrameType = videoFrameTypeSkip;
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
||||||
@@ -3879,16 +3879,16 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
&& (pCtx->iNumRef0 > 0)) ? pCtx->pRefList0[0] : NULL,
|
&& (pCtx->iNumRef0 > 0)) ? pCtx->pRefList0[0] : NULL,
|
||||||
iCurDid, (pCtx->eSliceType == P_SLICE) && pSvcParam->bEnableBackgroundDetection);
|
iCurDid, (pCtx->eSliceType == P_SLICE) && pSvcParam->bEnableBackgroundDetection);
|
||||||
WelsUpdateRefSyntax (pCtx, pCtx->iPOC,
|
WelsUpdateRefSyntax (pCtx, pCtx->iPOC,
|
||||||
eFrameType); //get reordering syntax used for writing slice header and transmit to encoder.
|
eFrameType); //get reordering syntax used for writing slice header and transmit to encoder.
|
||||||
PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer
|
PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer
|
||||||
|
|
||||||
pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, pSrcPic->uiTimeStamp);
|
pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, pSrcPic->uiTimeStamp);
|
||||||
PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()
|
PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()
|
||||||
|
|
||||||
//TODO Complexity Calculation here for screen content
|
//TODO Complexity Calculation here for screen content
|
||||||
iLayerSize = 0;
|
iLayerSize = 0;
|
||||||
|
|
||||||
if (SM_SINGLE_SLICE == pParam->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
|
if (SM_SINGLE_SLICE == pParam->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
|
||||||
int32_t iSliceSize = 0;
|
int32_t iSliceSize = 0;
|
||||||
int32_t iPayloadSize = 0;
|
int32_t iPayloadSize = 0;
|
||||||
|
|
||||||
@@ -3948,7 +3948,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
return ENC_RETURN_UNEXPECTED;
|
return ENC_RETURN_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSvcParam->iCountThreadsNum >= iSliceCount) { //THREAD_FULLY_FIRE_MODE
|
if (pSvcParam->iCountThreadsNum >= iSliceCount) { //THREAD_FULLY_FIRE_MODE
|
||||||
#if defined(MT_DEBUG)
|
#if defined(MT_DEBUG)
|
||||||
int64_t t_bs_append = 0;
|
int64_t t_bs_append = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -3986,7 +3986,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
t_bs_append, pCtx->iCodingIndex, iCurDid, 0);
|
t_bs_append, pCtx->iCodingIndex, iCurDid, 0);
|
||||||
}
|
}
|
||||||
#endif//MT_DEBUG
|
#endif//MT_DEBUG
|
||||||
} else { //THREAD_PICK_UP_MODE
|
} else { //THREAD_PICK_UP_MODE
|
||||||
int32_t iNumThreadsRunning = 0;
|
int32_t iNumThreadsRunning = 0;
|
||||||
int32_t iNumThreadsScheduled = 0;
|
int32_t iNumThreadsScheduled = 0;
|
||||||
int32_t iIndexOfSliceToBeCoded = 0;
|
int32_t iIndexOfSliceToBeCoded = 0;
|
||||||
@@ -4026,7 +4026,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
WelsEventSignal (&pCtx->pSliceThreading->pThreadMasterEvent[iEventId]);
|
WelsEventSignal (&pCtx->pSliceThreading->pThreadMasterEvent[iEventId]);
|
||||||
|
|
||||||
++ iIndexOfSliceToBeCoded;
|
++ iIndexOfSliceToBeCoded;
|
||||||
} else { // no other slices left for coding
|
} else { // no other slices left for coding
|
||||||
-- iNumThreadsRunning;
|
-- iNumThreadsRunning;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4320,7 +4320,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
|
|
||||||
#ifdef ENABLE_FRAME_DUMP
|
#ifdef ENABLE_FRAME_DUMP
|
||||||
DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iSpatialLayerNum - 1].sRecFileName[0],
|
DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iSpatialLayerNum - 1].sRecFileName[0],
|
||||||
pSvcParam->iSpatialLayerNum - 1, pCtx->bRecFlag, pCtx->pCurDqLayer); // pDecPic: final reconstruction output
|
pSvcParam->iSpatialLayerNum - 1, pCtx->bRecFlag, pCtx->pCurDqLayer); // pDecPic: final reconstruction output
|
||||||
pCtx->bRecFlag = true;
|
pCtx->bRecFlag = true;
|
||||||
|
|
||||||
#endif//ENABLE_FRAME_DUMP
|
#endif//ENABLE_FRAME_DUMP
|
||||||
@@ -4431,7 +4431,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
|
|||||||
bNeedReset = true;
|
bNeedReset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer
|
if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer
|
||||||
iIndexD = 0;
|
iIndexD = 0;
|
||||||
assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);
|
assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);
|
||||||
do {
|
do {
|
||||||
@@ -4628,7 +4628,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
|
|||||||
pOldDlpInternal->iDecompositionStages = pNewDlpInternal->iDecompositionStages;
|
pOldDlpInternal->iDecompositionStages = pNewDlpInternal->iDecompositionStages;
|
||||||
|
|
||||||
memcpy (pOldDlpInternal->uiCodingIdx2TemporalId, pNewDlpInternal->uiCodingIdx2TemporalId,
|
memcpy (pOldDlpInternal->uiCodingIdx2TemporalId, pNewDlpInternal->uiCodingIdx2TemporalId,
|
||||||
sizeof (pOldDlpInternal->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage
|
sizeof (pOldDlpInternal->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
++ iIndexD;
|
++ iIndexD;
|
||||||
} while (iIndexD < pOldParam->iSpatialLayerNum);
|
} while (iIndexD < pOldParam->iSpatialLayerNum);
|
||||||
@@ -4829,8 +4829,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
|
|||||||
SLayerBSInfo* pLayerBsInfo,
|
SLayerBSInfo* pLayerBsInfo,
|
||||||
int32_t* pNalIdxInLayer,
|
int32_t* pNalIdxInLayer,
|
||||||
int32_t* pLayerSize,
|
int32_t* pLayerSize,
|
||||||
int32_t iFirstMbInPartition, // first mb inclusive in partition
|
int32_t iFirstMbInPartition, // first mb inclusive in partition
|
||||||
int32_t iEndMbInPartition, // end mb exclusive in partition
|
int32_t iEndMbInPartition, // end mb exclusive in partition
|
||||||
int32_t iStartSliceIdx
|
int32_t iStartSliceIdx
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@@ -4860,7 +4860,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
|
|||||||
int32_t iSliceSize = 0;
|
int32_t iSliceSize = 0;
|
||||||
int32_t iPayloadSize = 0;
|
int32_t iPayloadSize = 0;
|
||||||
|
|
||||||
if (iSliceIdx >= (pSliceCtx->iMaxSliceNumConstraint - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
|
if (iSliceIdx >= (pSliceCtx->iMaxSliceNumConstraint - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
|
||||||
if (pCtx->iActiveThreadsNum == 1) {
|
if (pCtx->iActiveThreadsNum == 1) {
|
||||||
//only single thread support re-alloc now
|
//only single thread support re-alloc now
|
||||||
if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {
|
if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {
|
||||||
@@ -4909,7 +4909,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
|
|||||||
#endif//SLICE_INFO_OUTPUT
|
#endif//SLICE_INFO_OUTPUT
|
||||||
|
|
||||||
++ iNalIdxInLayer;
|
++ iNalIdxInLayer;
|
||||||
iSliceIdx += kiSliceStep; //if uiSliceIdx is not continuous
|
iSliceIdx += kiSliceStep; //if uiSliceIdx is not continuous
|
||||||
iAnyMbLeftInPartition = iEndMbInPartition - (1 + pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId]);
|
iAnyMbLeftInPartition = iEndMbInPartition - (1 + pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void WelsI4x4LumaPredH_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride)
|
|||||||
const uint8_t kuiVec2[4] = {kuiHor2, kuiHor2, kuiHor2, kuiHor2};
|
const uint8_t kuiVec2[4] = {kuiHor2, kuiHor2, kuiHor2, kuiHor2};
|
||||||
const uint8_t kuiVec3[4] = {kuiHor3, kuiHor3, kuiHor3, kuiHor3};
|
const uint8_t kuiVec3[4] = {kuiHor3, kuiHor3, kuiHor3, kuiHor3};
|
||||||
const uint8_t kuiVec4[4] = {kuiHor4, kuiHor4, kuiHor4, kuiHor4};
|
const uint8_t kuiVec4[4] = {kuiHor4, kuiHor4, kuiHor4, kuiHor4};
|
||||||
ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
|
ENFORCE_STACK_ALIGN_1D (uint8_t, uiSrc, 16, 16) // TobeCont'd about assign opt as follows
|
||||||
ST32 (&uiSrc[0], LD32 (kuiVec1));
|
ST32 (&uiSrc[0], LD32 (kuiVec1));
|
||||||
ST32 (&uiSrc[4], LD32 (kuiVec2));
|
ST32 (&uiSrc[4], LD32 (kuiVec2));
|
||||||
ST32 (&uiSrc[8], LD32 (kuiVec3));
|
ST32 (&uiSrc[8], LD32 (kuiVec3));
|
||||||
@@ -419,7 +419,7 @@ void WelsIChromaPredH_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStride)
|
|||||||
uint8_t i = 7;
|
uint8_t i = 7;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const uint8_t kuiLeft = pRef[iStridex7 - 1]; // pLeft value
|
const uint8_t kuiLeft = pRef[iStridex7 - 1]; // pLeft value
|
||||||
uint64_t kuiSrc64 = (uint64_t) (0x0101010101010101ULL * kuiLeft);
|
uint64_t kuiSrc64 = (uint64_t) (0x0101010101010101ULL * kuiLeft);
|
||||||
ST64 (pPred + iI8x8Stridex7, kuiSrc64);
|
ST64 (pPred + iI8x8Stridex7, kuiSrc64);
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ void UpdateP16x16MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int8_t kiRef
|
|||||||
|
|
||||||
ST32 (pCurMb->pRefIndex, kuiRef32);
|
ST32 (pCurMb->pRefIndex, kuiRef32);
|
||||||
// update pMv range from 0~15
|
// update pMv range from 0~15
|
||||||
memcpy (pCurMb->sMv, uiMvBuf, sizeof (uiMvBuf)); // confirmed_safe_unsafe_usage
|
memcpy (pCurMb->sMv, uiMvBuf, sizeof (uiMvBuf)); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* blocks 0: 7~10, 1: 13~16, 2: 19~22, 3: 25~28
|
* blocks 0: 7~10, 1: 13~16, 2: 19~22, 3: 25~28
|
||||||
@@ -209,7 +209,7 @@ void UpdateP16x8MotionInfo (SMbCache* pMbCache, SMB* pCurMb, const int32_t kiPar
|
|||||||
const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
|
const uint16_t kuiRef16 = BUTTERFLY1x2 (kiRef);
|
||||||
|
|
||||||
ST16 (&pCurMb->pRefIndex[ (kiPartIdx >> 2)], kuiRef16);
|
ST16 (&pCurMb->pRefIndex[ (kiPartIdx >> 2)], kuiRef16);
|
||||||
memcpy (&pCurMb->sMv[kiScan4Idx], uiMvBuf, sizeof (uiMvBuf)); // confirmed_safe_unsafe_usage
|
memcpy (&pCurMb->sMv[kiScan4Idx], uiMvBuf, sizeof (uiMvBuf)); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* blocks 0: g_kuiCache30ScanIdx[iPartIdx]~g_kuiCache30ScanIdx[iPartIdx]+3, 1: g_kuiCache30ScanIdx[iPartIdx]+6~g_kuiCache30ScanIdx[iPartIdx]+9
|
* blocks 0: g_kuiCache30ScanIdx[iPartIdx]~g_kuiCache30ScanIdx[iPartIdx]+3, 1: g_kuiCache30ScanIdx[iPartIdx]+6~g_kuiCache30ScanIdx[iPartIdx]+9
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
*************************************************************************************
|
*************************************************************************************
|
||||||
*/
|
*/
|
||||||
#include "property.h"
|
#include "property.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross_platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross_platforms
|
||||||
namespace WelsEnc {
|
namespace WelsEnc {
|
||||||
#define WELS_CODE_NAME "Wels"
|
#define WELS_CODE_NAME "Wels"
|
||||||
#define WELS_LIB_NAME "Encoder"
|
#define WELS_LIB_NAME "Encoder"
|
||||||
@@ -64,11 +64,11 @@ int32_t GetCodeName (char* pBuf, int32_t iSize) {
|
|||||||
if (NULL == pBuf)
|
if (NULL == pBuf)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
iLen = (int32_t)strlen (WELS_CODE_NAME); // confirmed_safe_unsafe_usage
|
iLen = (int32_t)strlen (WELS_CODE_NAME); // confirmed_safe_unsafe_usage
|
||||||
if (iSize <= iLen)
|
if (iSize <= iLen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
WelsStrncpy (pBuf, iSize, WELS_CODE_NAME); // confirmed_safe_unsafe_usage
|
WelsStrncpy (pBuf, iSize, WELS_CODE_NAME); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
return iLen;
|
return iLen;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ int32_t GetLibName (char* pBuf, int32_t iSize) {
|
|||||||
if (iSize <= iLen)
|
if (iSize <= iLen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
WelsStrncpy (pBuf, iSize, WELS_LIB_NAME); // confirmed_safe_unsafe_usage
|
WelsStrncpy (pBuf, iSize, WELS_LIB_NAME); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
return iLen;
|
return iLen;
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ int32_t GetVerNum (char* pBuf, int32_t iSize) {
|
|||||||
if (iSize <= iLen)
|
if (iSize <= iLen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
WelsStrncpy (pBuf, iSize, WELS_VERSION_STR); // confirmed_safe_unsafe_usage
|
WelsStrncpy (pBuf, iSize, WELS_VERSION_STR); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
return iLen;
|
return iLen;
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ int32_t GetIdentInfo (char* pBuf, int32_t iSize) {
|
|||||||
if (iSize <= iLen)
|
if (iSize <= iLen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
WelsStrncpy (pBuf, iSize, WELS_IDENT); // confirmed_safe_unsafe_usage
|
WelsStrncpy (pBuf, iSize, WELS_IDENT); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
return iLen;
|
return iLen;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void RcInitSequenceParameter (sWelsEncCtx* pEncCtx) {
|
|||||||
pWelsSvcRc->iNumberMbFrame = iMbWidth * (pDLayerParam->iVideoHeight >> 4);
|
pWelsSvcRc->iNumberMbFrame = iMbWidth * (pDLayerParam->iVideoHeight >> 4);
|
||||||
pWelsSvcRc->iSliceNum = pSliceCtx->iSliceNumInFrame;
|
pWelsSvcRc->iSliceNum = pSliceCtx->iSliceNumInFrame;
|
||||||
|
|
||||||
pWelsSvcRc->iRcVaryPercentage = pEncCtx->pSvcParam->iBitsVaryPercentage; // % -- for temp
|
pWelsSvcRc->iRcVaryPercentage = pEncCtx->pSvcParam->iBitsVaryPercentage; // % -- for temp
|
||||||
pWelsSvcRc->iRcVaryRatio = pWelsSvcRc->iRcVaryPercentage;
|
pWelsSvcRc->iRcVaryRatio = pWelsSvcRc->iRcVaryPercentage;
|
||||||
|
|
||||||
pWelsSvcRc->iSkipBufferRatio = SKIP_RATIO;
|
pWelsSvcRc->iSkipBufferRatio = SKIP_RATIO;
|
||||||
@@ -665,13 +665,13 @@ void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) {
|
|||||||
} else {
|
} else {
|
||||||
//globe decision
|
//globe decision
|
||||||
iBitsRatio = 10000 * iLeftBits / (iTargetLeftBits + 1);
|
iBitsRatio = 10000 * iLeftBits / (iTargetLeftBits + 1);
|
||||||
if (iBitsRatio < 8409) //2^(-1.5/6)*10000
|
if (iBitsRatio < 8409) //2^(-1.5/6)*10000
|
||||||
pSOverRc->iCalculatedQpSlice += 2;
|
pSOverRc->iCalculatedQpSlice += 2;
|
||||||
else if (iBitsRatio < 9439) //2^(-0.5/6)*10000
|
else if (iBitsRatio < 9439) //2^(-0.5/6)*10000
|
||||||
pSOverRc->iCalculatedQpSlice += 1;
|
pSOverRc->iCalculatedQpSlice += 1;
|
||||||
else if (iBitsRatio > 10600) //2^(0.5/6)*10000
|
else if (iBitsRatio > 10600) //2^(0.5/6)*10000
|
||||||
pSOverRc->iCalculatedQpSlice -= 1;
|
pSOverRc->iCalculatedQpSlice -= 1;
|
||||||
else if (iBitsRatio > 11900) //2^(1.5/6)*10000
|
else if (iBitsRatio > 11900) //2^(1.5/6)*10000
|
||||||
pSOverRc->iCalculatedQpSlice -= 2;
|
pSOverRc->iCalculatedQpSlice -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,7 +884,7 @@ void RcVBufferCalculationPadding (sWelsEncCtx* pEncCtx) {
|
|||||||
|
|
||||||
if (pWelsSvcRc->iBufferFullnessPadding < kiBufferThreshold) {
|
if (pWelsSvcRc->iBufferFullnessPadding < kiBufferThreshold) {
|
||||||
pWelsSvcRc->iPaddingSize = -pWelsSvcRc->iBufferFullnessPadding;
|
pWelsSvcRc->iPaddingSize = -pWelsSvcRc->iBufferFullnessPadding;
|
||||||
pWelsSvcRc->iPaddingSize >>= 3; // /8
|
pWelsSvcRc->iPaddingSize >>= 3; // /8
|
||||||
pWelsSvcRc->iBufferFullnessPadding = 0;
|
pWelsSvcRc->iBufferFullnessPadding = 0;
|
||||||
} else
|
} else
|
||||||
pWelsSvcRc->iPaddingSize = 0;
|
pWelsSvcRc->iPaddingSize = 0;
|
||||||
@@ -996,7 +996,7 @@ void WelsRcPictureInitGom (sWelsEncCtx* pEncCtx, long long uiTimeStamp) {
|
|||||||
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
|
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
|
||||||
|
|
||||||
if (pEncCtx->eSliceType == I_SLICE) {
|
if (pEncCtx->eSliceType == I_SLICE) {
|
||||||
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
|
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
|
||||||
RcInitRefreshParameter (pEncCtx);
|
RcInitRefreshParameter (pEncCtx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1296,7 +1296,7 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp
|
|||||||
int32_t iLumaQp = pWelsSvcRc->iLastCalculatedQScale;
|
int32_t iLumaQp = pWelsSvcRc->iLastCalculatedQScale;
|
||||||
//decide one frame bits allocated
|
//decide one frame bits allocated
|
||||||
if (pEncCtx->eSliceType == I_SLICE) {
|
if (pEncCtx->eSliceType == I_SLICE) {
|
||||||
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
|
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
|
||||||
RcInitRefreshParameter (pEncCtx);
|
RcInitRefreshParameter (pEncCtx);
|
||||||
double dBpp = 0.05;
|
double dBpp = 0.05;
|
||||||
if ((pDLayerParam->fFrameRate > EPSN) && (pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight))
|
if ((pDLayerParam->fFrameRate > EPSN) && (pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight))
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void ResetLtrState (SLTRState* pLtr) {
|
|||||||
// LTR mark
|
// LTR mark
|
||||||
pLtr->iLTRMarkMode = LTR_DIRECT_MARK;
|
pLtr->iLTRMarkMode = LTR_DIRECT_MARK;
|
||||||
pLtr->iLTRMarkSuccessNum = 0; //successful marked num
|
pLtr->iLTRMarkSuccessNum = 0; //successful marked num
|
||||||
pLtr->bLTRMarkingFlag = false; //decide whether current frame marked as LTR
|
pLtr->bLTRMarkingFlag = false; //decide whether current frame marked as LTR
|
||||||
pLtr->bLTRMarkEnable = false; //when LTR is confirmed and the interval is no smaller than the marking period
|
pLtr->bLTRMarkEnable = false; //when LTR is confirmed and the interval is no smaller than the marking period
|
||||||
pLtr->iCurLtrIdx = 0;
|
pLtr->iCurLtrIdx = 0;
|
||||||
memset (&pLtr->iLastLtrIdx , 0 , sizeof (pLtr->iLastLtrIdx)) ;
|
memset (&pLtr->iLastLtrIdx , 0 , sizeof (pLtr->iLastLtrIdx)) ;
|
||||||
@@ -295,7 +295,7 @@ static inline void LTRMarkProcess (sWelsEncCtx* pCtx) {
|
|||||||
|
|
||||||
if (pRefList->uiLongRefCount > 0) {
|
if (pRefList->uiLongRefCount > 0) {
|
||||||
memmove (&pRefList->pLongRefList[1], &pRefList->pLongRefList[0],
|
memmove (&pRefList->pLongRefList[1], &pRefList->pLongRefList[0],
|
||||||
pRefList->uiLongRefCount * sizeof (SPicture*)); // confirmed_safe_unsafe_usage
|
pRefList->uiLongRefCount * sizeof (SPicture*)); // confirmed_safe_unsafe_usage
|
||||||
}
|
}
|
||||||
pLongRefList[0] = pShortRefList[i];
|
pLongRefList[0] = pShortRefList[i];
|
||||||
pRefList->uiLongRefCount++;
|
pRefList->uiLongRefCount++;
|
||||||
@@ -364,7 +364,7 @@ bool WelsUpdateRefList (sWelsEncCtx* pCtx) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (NULL != pCtx->pDecPic) {
|
if (NULL != pCtx->pDecPic) {
|
||||||
#if !defined(ENABLE_FRAME_DUMP) // to save complexity, 1/6/2009
|
#if !defined(ENABLE_FRAME_DUMP) // to save complexity, 1/6/2009
|
||||||
if ((pParamD->iHighestTemporalId == 0) || (kuiTid < pParamD->iHighestTemporalId))
|
if ((pParamD->iHighestTemporalId == 0) || (kuiTid < pParamD->iHighestTemporalId))
|
||||||
#endif// !ENABLE_FRAME_DUMP
|
#endif// !ENABLE_FRAME_DUMP
|
||||||
// Expanding picture for future reference
|
// Expanding picture for future reference
|
||||||
@@ -409,7 +409,7 @@ bool WelsUpdateRefList (sWelsEncCtx* pCtx) {
|
|||||||
DeleteSTRFromShortList (pCtx, 0);
|
DeleteSTRFromShortList (pCtx, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // in case IDR currently coding
|
} else { // in case IDR currently coding
|
||||||
if (pCtx->pSvcParam->bEnableLongTermReference) {
|
if (pCtx->pSvcParam->bEnableLongTermReference) {
|
||||||
LTRMarkProcess (pCtx);
|
LTRMarkProcess (pCtx);
|
||||||
|
|
||||||
@@ -594,7 +594,7 @@ bool WelsBuildRefList (sWelsEncCtx* pCtx, const int32_t iPOC, int32_t iBestLtrRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // safe for IDR
|
} else { // safe for IDR
|
||||||
WelsResetRefList (pCtx); //for IDR, SHOULD reset pRef list.
|
WelsResetRefList (pCtx); //for IDR, SHOULD reset pRef list.
|
||||||
ResetLtrState (&pCtx->pLtr[pCtx->uiDependencyId]); //SHOULD update it when IDR.
|
ResetLtrState (&pCtx->pLtr[pCtx->uiDependencyId]); //SHOULD update it when IDR.
|
||||||
for (int32_t k = 0; k < MAX_TEMPORAL_LEVEL; k++) {
|
for (int32_t k = 0; k < MAX_TEMPORAL_LEVEL; k++) {
|
||||||
@@ -725,7 +725,7 @@ bool WelsUpdateRefListScreen (sWelsEncCtx* pCtx) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (NULL != pCtx->pDecPic) {
|
if (NULL != pCtx->pDecPic) {
|
||||||
#if !defined(ENABLE_FRAME_DUMP) // to save complexity, 1/6/2009
|
#if !defined(ENABLE_FRAME_DUMP) // to save complexity, 1/6/2009
|
||||||
if ((pParamD->iHighestTemporalId == 0) || (kuiTid < pParamD->iHighestTemporalId))
|
if ((pParamD->iHighestTemporalId == 0) || (kuiTid < pParamD->iHighestTemporalId))
|
||||||
#endif// !ENABLE_FRAME_DUMP
|
#endif// !ENABLE_FRAME_DUMP
|
||||||
// Expanding picture for future reference
|
// Expanding picture for future reference
|
||||||
@@ -749,7 +749,7 @@ bool WelsUpdateRefListScreen (sWelsEncCtx* pCtx) {
|
|||||||
LTRMarkProcessScreen (pCtx);
|
LTRMarkProcessScreen (pCtx);
|
||||||
pLtr->bLTRMarkingFlag = false;
|
pLtr->bLTRMarkingFlag = false;
|
||||||
++pLtr->uiLtrMarkInterval;
|
++pLtr->uiLtrMarkInterval;
|
||||||
} else { // in case IDR currently coding
|
} else { // in case IDR currently coding
|
||||||
LTRMarkProcessScreen (pCtx);
|
LTRMarkProcessScreen (pCtx);
|
||||||
pLtr->iCurLtrIdx = 1;
|
pLtr->iCurLtrIdx = 1;
|
||||||
pLtr->iSceneLtrIdx = 1;
|
pLtr->iSceneLtrIdx = 1;
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ int32_t WelsSampleSatdIntra4x4Combined3_c (uint8_t* pDec, int32_t iDecStride, ui
|
|||||||
iBestCost = iCurCost;
|
iBestCost = iCurCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy (pDst, uiLocalBuffer[iBestMode], 16 * sizeof (uint8_t)); // confirmed_safe_unsafe_usage
|
memcpy (pDst, uiLocalBuffer[iBestMode], 16 * sizeof (uint8_t)); // confirmed_safe_unsafe_usage
|
||||||
*pBestMode = iBestMode;
|
*pBestMode = iBestMode;
|
||||||
|
|
||||||
return iBestCost;
|
return iBestCost;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
#include "svc_encode_slice.h"
|
#include "svc_encode_slice.h"
|
||||||
#include "deblocking.h"
|
#include "deblocking.h"
|
||||||
#include "svc_enc_golomb.h"
|
#include "svc_enc_golomb.h"
|
||||||
#include "crt_util_safe_x.h" // for safe crt like calls
|
#include "crt_util_safe_x.h" // for safe crt like calls
|
||||||
#include "rc.h"
|
#include "rc.h"
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
@@ -225,7 +225,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
|
|||||||
iMinimalMbNum = iNumMbInEachGom;
|
iMinimalMbNum = iNumMbInEachGom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kiCountSliceNum < 2 || (kiCountSliceNum & 0x01)) // we need suppose uiSliceNum is even for multiple threading
|
if (kiCountSliceNum < 2 || (kiCountSliceNum & 0x01)) // we need suppose uiSliceNum is even for multiple threading
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iMaximalMbNum = kiCountNumMb - (kiCountSliceNum - 1) * iMinimalMbNum;
|
iMaximalMbNum = kiCountNumMb - (kiCountSliceNum - 1) * iMinimalMbNum;
|
||||||
@@ -252,7 +252,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
|
|||||||
assert (iNumMbAssigning > 0);
|
assert (iNumMbAssigning > 0);
|
||||||
|
|
||||||
iMbNumLeft -= iNumMbAssigning;
|
iMbNumLeft -= iNumMbAssigning;
|
||||||
if (iMbNumLeft <= 0) { // error due to we can not support slice_skip now yet, do not adjust this time
|
if (iMbNumLeft <= 0) { // error due to we can not support slice_skip now yet, do not adjust this time
|
||||||
assert (0);
|
assert (0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -543,7 +543,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32
|
|||||||
assert (pSliceBs->bSliceCodedFlag);
|
assert (pSliceBs->bSliceCodedFlag);
|
||||||
#endif//MT_DEBUG_BS_WR
|
#endif//MT_DEBUG_BS_WR
|
||||||
|
|
||||||
memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage
|
memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage
|
||||||
pCtx->iPosBsBuffer += pSliceBs->uiBsPos;
|
pCtx->iPosBsBuffer += pSliceBs->uiBsPos;
|
||||||
|
|
||||||
iLayerSize += pSliceBs->uiBsPos;
|
iLayerSize += pSliceBs->uiBsPos;
|
||||||
@@ -575,7 +575,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32
|
|||||||
int32_t iNalIdx = 0;
|
int32_t iNalIdx = 0;
|
||||||
const int32_t iCountNal = pSliceBs->iNalIndex;
|
const int32_t iCountNal = pSliceBs->iNalIndex;
|
||||||
|
|
||||||
memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage
|
memmove (pCtx->pFrameBs + pCtx->iPosBsBuffer, pSliceBs->pBs, pSliceBs->uiBsPos); // confirmed_safe_unsafe_usage
|
||||||
pCtx->iPosBsBuffer += pSliceBs->uiBsPos;
|
pCtx->iPosBsBuffer += pSliceBs->uiBsPos;
|
||||||
|
|
||||||
iLayerSize += pSliceBs->uiBsPos;
|
iLayerSize += pSliceBs->uiBsPos;
|
||||||
@@ -714,7 +714,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
|||||||
iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount,
|
iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount,
|
||||||
&pEventsList[0],
|
&pEventsList[0],
|
||||||
&pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled
|
&pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled
|
||||||
if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited
|
if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited
|
||||||
SLayerBSInfo* pLbi = pPrivateData->pLayerBs;
|
SLayerBSInfo* pLbi = pPrivateData->pLayerBs;
|
||||||
const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;
|
const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;
|
||||||
const int32_t kiCurTid = pEncPEncCtx->uiTemporalId;
|
const int32_t kiCurTid = pEncPEncCtx->uiTemporalId;
|
||||||
@@ -822,7 +822,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
|||||||
#endif//MT_DEBUG_BS_WR
|
#endif//MT_DEBUG_BS_WR
|
||||||
|
|
||||||
WelsEventSignal (
|
WelsEventSignal (
|
||||||
&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice
|
&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice
|
||||||
WelsEventSignal (
|
WelsEventSignal (
|
||||||
&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent);
|
&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent);
|
||||||
} else { // for SM_DYN_SLICE parallelization
|
} else { // for SM_DYN_SLICE parallelization
|
||||||
@@ -925,10 +925,10 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
|||||||
iSliceIdx += kiSliceIdxStep;
|
iSliceIdx += kiSliceIdxStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uiThrdRet) // any exception??
|
if (uiThrdRet) // any exception??
|
||||||
break;
|
break;
|
||||||
|
|
||||||
WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice
|
WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice
|
||||||
WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent);
|
WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent);
|
||||||
}
|
}
|
||||||
} else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal
|
} else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal
|
||||||
@@ -940,7 +940,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
|||||||
pCurDq = pEncPEncCtx->pCurDqLayer;
|
pCurDq = pEncPEncCtx->pCurDqLayer;
|
||||||
UpdateMbListNeighborParallel (pCurDq->pSliceEncCtx, pCurDq->sMbDataP, iSliceIdx);
|
UpdateMbListNeighborParallel (pCurDq->pSliceEncCtx, pCurDq->sMbDataP, iSliceIdx);
|
||||||
WelsEventSignal (
|
WelsEventSignal (
|
||||||
&pEncPEncCtx->pSliceThreading->pFinUpdateMbListEvent[iEventIdx]); // mean finished update pMb list for this pSlice
|
&pEncPEncCtx->pSliceThreading->pFinUpdateMbListEvent[iEventIdx]); // mean finished update pMb list for this pSlice
|
||||||
} else { // WELS_THREAD_ERROR_WAIT_TIMEOUT, or WELS_THREAD_ERROR_WAIT_FAILED
|
} else { // WELS_THREAD_ERROR_WAIT_TIMEOUT, or WELS_THREAD_ERROR_WAIT_FAILED
|
||||||
WelsLog (& (pEncPEncCtx->sLogCtx), WELS_LOG_WARNING,
|
WelsLog (& (pEncPEncCtx->sLogCtx), WELS_LOG_WARNING,
|
||||||
"[MT] CodingSliceThreadProc(), waiting pReadySliceCodingEvent[%d] failed(%d) and thread%d terminated!", iEventIdx,
|
"[MT] CodingSliceThreadProc(), waiting pReadySliceCodingEvent[%d] failed(%d) and thread%d terminated!", iEventIdx,
|
||||||
@@ -1061,7 +1061,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) {
|
|||||||
&& pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sSpatialLayers[iCurDid -
|
&& pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sSpatialLayers[iCurDid -
|
||||||
1].sSliceCfg.sSliceArgument.uiSliceNum);
|
1].sSliceCfg.sSliceArgument.uiSliceNum);
|
||||||
|
|
||||||
if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation
|
if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation
|
||||||
// do not need adjust due to not different at both slices of consumed time
|
// do not need adjust due to not different at both slices of consumed time
|
||||||
iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[iCurDid - 1],
|
iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[iCurDid - 1],
|
||||||
pCtx->pCurDqLayer->pSliceEncCtx->iSliceNumInFrame);
|
pCtx->pCurDqLayer->pSliceEncCtx->iSliceNumInFrame);
|
||||||
@@ -1071,7 +1071,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) {
|
|||||||
pCtx->pSliceThreading->pSliceComplexRatio[iCurDid - 1],
|
pCtx->pSliceThreading->pSliceComplexRatio[iCurDid - 1],
|
||||||
iCurDid
|
iCurDid
|
||||||
);
|
);
|
||||||
} else { // use temporal layer for complexity estimation
|
} else { // use temporal layer for complexity estimation
|
||||||
// do not need adjust due to not different at both slices of consumed time
|
// do not need adjust due to not different at both slices of consumed time
|
||||||
iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[iCurDid],
|
iNeedAdj = NeedDynamicAdjust (pCtx->pSliceThreading->pSliceConsumeTime[iCurDid],
|
||||||
pCtx->pCurDqLayer->pSliceEncCtx->iSliceNumInFrame);
|
pCtx->pCurDqLayer->pSliceEncCtx->iSliceNumInFrame);
|
||||||
|
|||||||
@@ -1779,7 +1779,7 @@ void WelsMdInterSecondaryModesEnc (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SSlic
|
|||||||
void WelsMdIntraSecondaryModesEnc (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache) {
|
void WelsMdIntraSecondaryModesEnc (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb, SMbCache* pMbCache) {
|
||||||
SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
|
SWelsFuncPtrList* pFunc = pEncCtx->pFuncList;
|
||||||
//initial prediction memory for I_4x4
|
//initial prediction memory for I_4x4
|
||||||
pFunc->pfIntraFineMd (pEncCtx, pWelsMd, pCurMb, pMbCache); //WelsMdIntraFinePartitionVaa
|
pFunc->pfIntraFineMd (pEncCtx, pWelsMd, pCurMb, pMbCache); //WelsMdIntraFinePartitionVaa
|
||||||
|
|
||||||
//add pEnc&rec to MD--2010.3.15
|
//add pEnc&rec to MD--2010.3.15
|
||||||
if (IS_INTRA16x16 (pCurMb->uiMbType)) {
|
if (IS_INTRA16x16 (pCurMb->uiMbType)) {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ int32_t AssignMbMapMultipleSlices (SSliceCtx* pSliceSeg, const SSliceConfig* kpM
|
|||||||
pSliceSeg->pCountMbNumInSlice[iSliceIdx] = kiCountNumMbInFrame;
|
pSliceSeg->pCountMbNumInSlice[iSliceIdx] = kiCountNumMbInFrame;
|
||||||
iSliceIdx++;
|
iSliceIdx++;
|
||||||
} while (iSliceIdx < kiMaxSliceNum);
|
} while (iSliceIdx < kiMaxSliceNum);
|
||||||
} else { // any else uiSliceMode?
|
} else { // any else uiSliceMode?
|
||||||
assert (0);
|
assert (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,8 +239,8 @@ bool GomValidCheckSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, u
|
|||||||
while (true) {
|
while (true) {
|
||||||
if (kiCountNumMb < iGomSize * (int32_t) iSliceNum) {
|
if (kiCountNumMb < iGomSize * (int32_t) iSliceNum) {
|
||||||
-- iSliceNum;
|
-- iSliceNum;
|
||||||
iSliceNum = iSliceNum - (iSliceNum & 0x01); // verfiy even num for multiple slices case
|
iSliceNum = iSliceNum - (iSliceNum & 0x01); // verfiy even num for multiple slices case
|
||||||
if (iSliceNum < 2) // for safe
|
if (iSliceNum < 2) // for safe
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -598,7 +598,7 @@ int32_t WelsGetNextMbOfSlice (SSliceCtx* pSliceCtx, const int32_t kiMbXY) {
|
|||||||
return iNextMbIdx;
|
return iNextMbIdx;
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
} else
|
||||||
return -1; // reserved here for other multiple slice type
|
return -1; // reserved here for other multiple slice type
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return -1;
|
return -1;
|
||||||
@@ -680,7 +680,7 @@ int32_t DynamicAdjustSlicePEncCtxAll (SSliceCtx* pSliceCtx,
|
|||||||
++ iSliceIdx;
|
++ iSliceIdx;
|
||||||
}
|
}
|
||||||
if (iSameRunLenFlag) {
|
if (iSameRunLenFlag) {
|
||||||
return 1; // do not need adjust it due to same running length as before to save complexity
|
return 1; // do not need adjust it due to same running length as before to save complexity
|
||||||
}
|
}
|
||||||
|
|
||||||
iSliceIdx = 0;
|
iSliceIdx = 0;
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void WelsEncInterY (SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCache
|
|||||||
|
|
||||||
if (iSingleCtrMb < 6) { //from JVT-O079
|
if (iSingleCtrMb < 6) { //from JVT-O079
|
||||||
iNoneZeroCountMbDcAc = 0;
|
iNoneZeroCountMbDcAc = 0;
|
||||||
pfSetMemZeroSize64 (pRes, 768); // confirmed_safe_unsafe_usage
|
pfSetMemZeroSize64 (pRes, 768); // confirmed_safe_unsafe_usage
|
||||||
} else {
|
} else {
|
||||||
const uint8_t* kpNoneZeroCountIdx = g_kuiMbCountScan4Idx;
|
const uint8_t* kpNoneZeroCountIdx = g_kuiMbCountScan4Idx;
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
@@ -233,8 +233,8 @@ void WelsEncInterY (SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCache
|
|||||||
}
|
}
|
||||||
pfDequantizationFour4x4 (pRes, g_kuiDequantCoeff[uiQp]);
|
pfDequantizationFour4x4 (pRes, g_kuiDequantCoeff[uiQp]);
|
||||||
pCurMb->uiCbp |= 1 << i;
|
pCurMb->uiCbp |= 1 << i;
|
||||||
} else { // set zero for an 8x8 pBlock
|
} else { // set zero for an 8x8 pBlock
|
||||||
pfSetMemZeroSize64 (pRes, 128); // confirmed_safe_unsafe_usage
|
pfSetMemZeroSize64 (pRes, 128); // confirmed_safe_unsafe_usage
|
||||||
kpNoneZeroCountIdx += 4;
|
kpNoneZeroCountIdx += 4;
|
||||||
pBlock += 64;
|
pBlock += 64;
|
||||||
}
|
}
|
||||||
@@ -285,8 +285,8 @@ void WelsEncRecUV (SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCac
|
|||||||
}
|
}
|
||||||
pRes -= 64;
|
pRes -= 64;
|
||||||
|
|
||||||
if (iSingleCtr8x8 < 7) { //from JVT-O079
|
if (iSingleCtr8x8 < 7) { //from JVT-O079
|
||||||
pfSetMemZeroSize64 (pRes, 128); // confirmed_safe_unsafe_usage
|
pfSetMemZeroSize64 (pRes, 128); // confirmed_safe_unsafe_usage
|
||||||
ST16 (&pCurMb->pNonZeroCount[16 + uiNoneZeroCountOffset], 0);
|
ST16 (&pCurMb->pNonZeroCount[16 + uiNoneZeroCountOffset], 0);
|
||||||
ST16 (&pCurMb->pNonZeroCount[20 + uiNoneZeroCountOffset], 0);
|
ST16 (&pCurMb->pNonZeroCount[20 + uiNoneZeroCountOffset], 0);
|
||||||
} else {
|
} else {
|
||||||
@@ -339,7 +339,7 @@ bool WelsTryPYskip (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache) {
|
|||||||
pEncCtx->pFuncList->pfQuantizationFour4x4Max (pRes, pFF, pMF, (int16_t*)aMax);
|
pEncCtx->pFuncList->pfQuantizationFour4x4Max (pRes, pFF, pMF, (int16_t*)aMax);
|
||||||
|
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
if (aMax[j] > 1) return false; // iSingleCtrMb += 9, can't be P_SKIP
|
if (aMax[j] > 1) return false; // iSingleCtrMb += 9, can't be P_SKIP
|
||||||
else if (aMax[j] == 1) {
|
else if (aMax[j] == 1) {
|
||||||
pEncCtx->pFuncList->pfScan4x4 (pBlock, pRes); //
|
pEncCtx->pFuncList->pfScan4x4 (pBlock, pRes); //
|
||||||
iSingleCtrMb += pEncCtx->pFuncList->pfCalculateSingleCtr4x4 (pBlock);
|
iSingleCtrMb += pEncCtx->pFuncList->pfCalculateSingleCtr4x4 (pBlock);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ void WriteReferenceReorder (SBitStringAux* pBs, SSliceHeader* sSliceHeader) {
|
|||||||
uint8_t eSliceType = sSliceHeader->eSliceType % 5;
|
uint8_t eSliceType = sSliceHeader->eSliceType % 5;
|
||||||
int16_t n = 0;
|
int16_t n = 0;
|
||||||
|
|
||||||
if (I_SLICE != eSliceType && SI_SLICE != eSliceType) { // !I && !SI
|
if (I_SLICE != eSliceType && SI_SLICE != eSliceType) { // !I && !SI
|
||||||
BsWriteOneBit (pBs, true);
|
BsWriteOneBit (pBs, true);
|
||||||
// {
|
// {
|
||||||
uint16_t uiReorderingOfPicNumsIdc;
|
uint16_t uiReorderingOfPicNumsIdc;
|
||||||
@@ -598,7 +598,7 @@ TRY_REENCODING:
|
|||||||
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) { //islice
|
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) { //islice
|
||||||
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
||||||
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
||||||
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -620,7 +620,7 @@ TRY_REENCODING:
|
|||||||
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
|
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
|
||||||
pSliceCtx->pCountMbNumInSlice[kiSliceIdx] = iCurMbIdx - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId];
|
pSliceCtx->pCountMbNumInSlice[kiSliceIdx] = iCurMbIdx - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId];
|
||||||
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] =
|
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] =
|
||||||
iCurMbIdx; // update pLastCodedMbIdxOfPartition, finish coding, use iCurMbIdx directly
|
iCurMbIdx; // update pLastCodedMbIdxOfPartition, finish coding, use iCurMbIdx directly
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,7 +841,7 @@ void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSlic
|
|||||||
pNextSlice->bSliceHeaderExtFlag =
|
pNextSlice->bSliceHeaderExtFlag =
|
||||||
(NAL_UNIT_CODED_SLICE_EXT == pCurLayer->sLayerInfo.sNalHeaderExt.sNalUnitHeader.eNalUnitType);
|
(NAL_UNIT_CODED_SLICE_EXT == pCurLayer->sLayerInfo.sNalHeaderExt.sNalUnitHeader.eNalUnitType);
|
||||||
memcpy (&pNextSlice->sSliceHeaderExt, &pCurSlice->sSliceHeaderExt,
|
memcpy (&pNextSlice->sSliceHeaderExt, &pCurSlice->sSliceHeaderExt,
|
||||||
sizeof (SSliceHeaderExt)); // confirmed_safe_unsafe_usage
|
sizeof (SSliceHeaderExt)); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
pSliceCtx->pFirstMbInSlice[iNextSliceIdc] = iFirstMbIdxOfNextSlice;
|
pSliceCtx->pFirstMbInSlice[iNextSliceIdc] = iFirstMbIdxOfNextSlice;
|
||||||
WelsSetMemMultiplebytes_c (pSliceCtx->pOverallMbMap + iFirstMbIdxOfNextSlice, iNextSliceIdc,
|
WelsSetMemMultiplebytes_c (pSliceCtx->pOverallMbMap + iFirstMbIdxOfNextSlice, iNextSliceIdc,
|
||||||
@@ -1111,7 +1111,7 @@ TRY_REENCODING:
|
|||||||
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) {
|
if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) {
|
||||||
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);
|
||||||
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
|
||||||
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
|
||||||
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1134,7 +1134,7 @@ TRY_REENCODING:
|
|||||||
//whether all of MB in current pSlice encoded or not
|
//whether all of MB in current pSlice encoded or not
|
||||||
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
|
if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) {
|
||||||
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] =
|
pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] =
|
||||||
iCurMbIdx; // update pLastCodedMbIdxOfPartition, finish coding, use pCurMb_idx directly
|
iCurMbIdx; // update pLastCodedMbIdxOfPartition, finish coding, use pCurMb_idx directly
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ int32_t CWelsPreProcess::DownsamplePadding (SPicture* pSrc, SPicture* pDstPic,
|
|||||||
iSrcWidth, iSrcHeight);
|
iSrcWidth, iSrcHeight);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
memcpy (&sDstPicMap, &sSrcPixMap, sizeof (sDstPicMap)); // confirmed_safe_unsafe_usage
|
memcpy (&sDstPicMap, &sSrcPixMap, sizeof (sDstPicMap)); // confirmed_safe_unsafe_usage
|
||||||
}
|
}
|
||||||
|
|
||||||
// get rid of odd line
|
// get rid of odd line
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "crt_util_safe_x.h" // Safe CRT routines like util for cross platforms
|
#include "crt_util_safe_x.h" // Safe CRT routines like util for cross platforms
|
||||||
#include "ref_list_mgr_svc.h"
|
#include "ref_list_mgr_svc.h"
|
||||||
#include "codec_ver.h"
|
#include "codec_ver.h"
|
||||||
|
|
||||||
@@ -654,12 +654,12 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (eOptionId) {
|
switch (eOptionId) {
|
||||||
case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
|
case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");
|
"ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_DATAFORMAT: { // Input color space
|
case ENCODER_OPTION_DATAFORMAT: { // Input color space
|
||||||
int32_t iValue = * ((int32_t*)pOption);
|
int32_t iValue = * ((int32_t*)pOption);
|
||||||
int32_t iColorspace = iValue;
|
int32_t iColorspace = iValue;
|
||||||
if (iColorspace == 0) {
|
if (iColorspace == 0) {
|
||||||
@@ -689,7 +689,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
int32_t iTargetWidth = 0;
|
int32_t iTargetWidth = 0;
|
||||||
int32_t iTargetHeight = 0;
|
int32_t iTargetHeight = 0;
|
||||||
|
|
||||||
memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage
|
memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage
|
||||||
if (sConfig.ParamBaseTranscode (sEncodingParam)) {
|
if (sConfig.ParamBaseTranscode (sEncodingParam)) {
|
||||||
return cmInitParaError;
|
return cmInitParaError;
|
||||||
}
|
}
|
||||||
@@ -721,7 +721,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
int32_t iTargetWidth = 0;
|
int32_t iTargetWidth = 0;
|
||||||
int32_t iTargetHeight = 0;
|
int32_t iTargetHeight = 0;
|
||||||
|
|
||||||
memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
|
memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
|
||||||
TraceParamInfo (&sEncodingParam);
|
TraceParamInfo (&sEncodingParam);
|
||||||
#ifdef OUTPUT_BIT_STREAM
|
#ifdef OUTPUT_BIT_STREAM
|
||||||
if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=
|
if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=
|
||||||
@@ -731,7 +731,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
}
|
}
|
||||||
#endif//OUTPUT_BIT_STREAM
|
#endif//OUTPUT_BIT_STREAM
|
||||||
if (sEncodingParam.iSpatialLayerNum < 1
|
if (sEncodingParam.iSpatialLayerNum < 1
|
||||||
|| sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer
|
|| sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",
|
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",
|
||||||
sEncodingParam.iSpatialLayerNum);
|
sEncodingParam.iSpatialLayerNum);
|
||||||
@@ -782,7 +782,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
m_pEncContext->pSvcParam->fMaxFrameRate);
|
m_pEncContext->pSvcParam->fMaxFrameRate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_BITRATE: { // Target bit-rate
|
case ENCODER_OPTION_BITRATE: { // Target bit-rate
|
||||||
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
||||||
int32_t iBitrate = pInfo->iBitrate;
|
int32_t iBitrate = pInfo->iBitrate;
|
||||||
if (iBitrate <= 0) {
|
if (iBitrate <= 0) {
|
||||||
@@ -828,7 +828,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate
|
case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate
|
||||||
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
||||||
int32_t iBitrate = pInfo->iBitrate;
|
int32_t iBitrate = pInfo->iBitrate;
|
||||||
if (iBitrate <= 0) {
|
if (iBitrate <= 0) {
|
||||||
@@ -873,7 +873,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_RC_MODE: { // 0:quality mode;1:bit-rate mode;2:bitrate limited mode
|
case ENCODER_OPTION_RC_MODE: { // 0:quality mode;1:bit-rate mode;2:bitrate limited mode
|
||||||
int32_t iValue = * ((int32_t*)pOption);
|
int32_t iValue = * ((int32_t*)pOption);
|
||||||
m_pEncContext->pSvcParam->iRCMode = (RC_MODES) iValue;
|
m_pEncContext->pSvcParam->iRCMode = (RC_MODES) iValue;
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
@@ -881,7 +881,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
iValue);
|
iValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_PADDING_PADDING: { // 0:disable padding;1:padding
|
case ENCODER_PADDING_PADDING: { // 0:disable padding;1:padding
|
||||||
int32_t iValue = * ((int32_t*)pOption);
|
int32_t iValue = * ((int32_t*)pOption);
|
||||||
m_pEncContext->pSvcParam->iPaddingFlag = iValue;
|
m_pEncContext->pSvcParam->iPaddingFlag = iValue;
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
@@ -1106,45 +1106,45 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (eOptionId) {
|
switch (eOptionId) {
|
||||||
case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
|
case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");
|
"ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_DATAFORMAT: { // Input color space
|
case ENCODER_OPTION_DATAFORMAT: { // Input color space
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);
|
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);
|
||||||
* ((int32_t*)pOption) = m_iCspInternal;
|
* ((int32_t*)pOption) = m_iCspInternal;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_IDR_INTERVAL: { // IDR Interval
|
case ENCODER_OPTION_IDR_INTERVAL: { // IDR Interval
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_IDR_INTERVAL, uiIntraPeriod= %d",
|
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_IDR_INTERVAL, uiIntraPeriod= %d",
|
||||||
m_pEncContext->pSvcParam->uiIntraPeriod);
|
m_pEncContext->pSvcParam->uiIntraPeriod);
|
||||||
* ((int32_t*)pOption) = m_pEncContext->pSvcParam->uiIntraPeriod;
|
* ((int32_t*)pOption) = m_pEncContext->pSvcParam->uiIntraPeriod;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter
|
case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT");
|
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT");
|
||||||
memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
|
memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter
|
case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE");
|
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE");
|
||||||
m_pEncContext->pSvcParam->GetBaseParams ((SEncParamBase*) pOption);
|
m_pEncContext->pSvcParam->GetBaseParams ((SEncParamBase*) pOption);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate
|
case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_FRAME_RATE, fMaxFrameRate = %.6ff",
|
"CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_FRAME_RATE, fMaxFrameRate = %.6ff",
|
||||||
m_pEncContext->pSvcParam->fMaxFrameRate);
|
m_pEncContext->pSvcParam->fMaxFrameRate);
|
||||||
* ((float*)pOption) = m_pEncContext->pSvcParam->fMaxFrameRate;
|
* ((float*)pOption) = m_pEncContext->pSvcParam->fMaxFrameRate;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_BITRATE: { // Target bit-rate
|
case ENCODER_OPTION_BITRATE: { // Target bit-rate
|
||||||
|
|
||||||
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
||||||
if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
|
if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
|
||||||
@@ -1160,7 +1160,7 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
pInfo->iLayer, pInfo->iBitrate);
|
pInfo->iLayer, pInfo->iBitrate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate
|
case ENCODER_OPTION_MAX_BITRATE: { // Target bit-rate
|
||||||
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
|
||||||
if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
|
if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
|
||||||
&& (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3))
|
&& (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3))
|
||||||
@@ -1216,20 +1216,20 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) {
|
|||||||
char strFileName[256] = {0};
|
char strFileName[256] = {0};
|
||||||
const int32_t iDataLength = m_iMaxPicWidth * m_iMaxPicHeight;
|
const int32_t iDataLength = m_iMaxPicWidth * m_iMaxPicHeight;
|
||||||
|
|
||||||
WelsStrncpy (strFileName, 256, "pic_in_"); // confirmed_safe_unsafe_usage
|
WelsStrncpy (strFileName, 256, "pic_in_"); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
if (m_iMaxPicWidth == 640) {
|
if (m_iMaxPicWidth == 640) {
|
||||||
WelsStrcat (strFileName, 256, "360p."); // confirmed_safe_unsafe_usage
|
WelsStrcat (strFileName, 256, "360p."); // confirmed_safe_unsafe_usage
|
||||||
} else if (m_iMaxPicWidth == 320) {
|
} else if (m_iMaxPicWidth == 320) {
|
||||||
WelsStrcat (strFileName, 256, "180p."); // confirmed_safe_unsafe_usage
|
WelsStrcat (strFileName, 256, "180p."); // confirmed_safe_unsafe_usage
|
||||||
} else if (m_iMaxPicWidth == 160) {
|
} else if (m_iMaxPicWidth == 160) {
|
||||||
WelsStrcat (strFileName, 256, "90p."); // confirmed_safe_unsafe_usage
|
WelsStrcat (strFileName, 256, "90p."); // confirmed_safe_unsafe_usage
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_iCspInternal) {
|
switch (m_iCspInternal) {
|
||||||
case videoFormatI420:
|
case videoFormatI420:
|
||||||
case videoFormatYV12:
|
case videoFormatYV12:
|
||||||
WelsStrcat (strFileName, 256, "yuv"); // confirmed_safe_unsafe_usage
|
WelsStrcat (strFileName, 256, "yuv"); // confirmed_safe_unsafe_usage
|
||||||
pFile = WelsFopen (strFileName, "ab+");
|
pFile = WelsFopen (strFileName, "ab+");
|
||||||
// WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_I420, m_iCspInternal= 0x%x", m_iCspInternal);
|
// WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_I420, m_iCspInternal= 0x%x", m_iCspInternal);
|
||||||
if (NULL != pFile) {
|
if (NULL != pFile) {
|
||||||
@@ -1239,7 +1239,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case videoFormatRGB:
|
case videoFormatRGB:
|
||||||
WelsStrcat (strFileName, 256, "rgb"); // confirmed_safe_unsafe_usage
|
WelsStrcat (strFileName, 256, "rgb"); // confirmed_safe_unsafe_usage
|
||||||
pFile = WelsFopen (strFileName, "ab+");
|
pFile = WelsFopen (strFileName, "ab+");
|
||||||
if (NULL != pFile) {
|
if (NULL != pFile) {
|
||||||
fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile);
|
fwrite (pSrc, sizeof (uint8_t), iDataLength * 3, pFile);
|
||||||
@@ -1247,7 +1247,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) {
|
|||||||
fclose (pFile);
|
fclose (pFile);
|
||||||
}
|
}
|
||||||
case videoFormatBGR:
|
case videoFormatBGR:
|
||||||
WelsStrcat (strFileName, 256, "bgr"); // confirmed_safe_unsafe_usage
|
WelsStrcat (strFileName, 256, "bgr"); // confirmed_safe_unsafe_usage
|
||||||
pFile = WelsFopen (strFileName, "ab+");
|
pFile = WelsFopen (strFileName, "ab+");
|
||||||
// WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_BGR, m_iCspInternal= 0x%x", m_iCspInternal);
|
// WelsLog( &m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "WELS_CSP_BGR, m_iCspInternal= 0x%x", m_iCspInternal);
|
||||||
if (NULL != pFile) {
|
if (NULL != pFile) {
|
||||||
@@ -1257,7 +1257,7 @@ void CWelsH264SVCEncoder::DumpSrcPicture (const uint8_t* pSrc) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case videoFormatYUY2:
|
case videoFormatYUY2:
|
||||||
WelsStrcat (strFileName, 256, "yuy2"); // confirmed_safe_unsafe_usage
|
WelsStrcat (strFileName, 256, "yuy2"); // confirmed_safe_unsafe_usage
|
||||||
pFile = WelsFopen (strFileName, "ab+");
|
pFile = WelsFopen (strFileName, "ab+");
|
||||||
if (NULL != pFile) {
|
if (NULL != pFile) {
|
||||||
fwrite (pSrc, sizeof (uint8_t), (CALC_BI_STRIDE (m_iMaxPicWidth, 16)) * m_iMaxPicHeight, pFile);
|
fwrite (pSrc, sizeof (uint8_t), (CALC_BI_STRIDE (m_iMaxPicWidth, 16)) * m_iMaxPicHeight, pFile);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void* WelsRealloc (void* pPointer, uint32_t* pRealSize, const uint32_t kuiSize,
|
|||||||
const uint32_t kuiOldSize = *pRealSize;
|
const uint32_t kuiOldSize = *pRealSize;
|
||||||
uint32_t kuiNewSize = 0;
|
uint32_t kuiNewSize = 0;
|
||||||
void* pLocalPointer = NULL;
|
void* pLocalPointer = NULL;
|
||||||
if (kuiOldSize >= kuiSize) // large enough of original block, so do nothing
|
if (kuiOldSize >= kuiSize) // large enough of original block, so do nothing
|
||||||
return (pPointer);
|
return (pPointer);
|
||||||
|
|
||||||
// new request
|
// new request
|
||||||
@@ -111,7 +111,7 @@ void* WelsRealloc (void* pPointer, uint32_t* pRealSize, const uint32_t kuiSize,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL; // something wrong
|
return NULL; // something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
WELSVP_NAMESPACE_END
|
WELSVP_NAMESPACE_END
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ void CComplexityAnalysisScreen::GomComplexityAnalysisIntra (SPixMap* pSrc) {
|
|||||||
pTmpCur = pPtrY;
|
pTmpCur = pPtrY;
|
||||||
|
|
||||||
for (int32_t i = 0; i < iBlockWidth; i++) {
|
for (int32_t i = 0; i < iBlockWidth; i++) {
|
||||||
iBlockSadH = iBlockSadV = 0x7fffffff; // INT_MAX
|
iBlockSadH = iBlockSadV = 0x7fffffff; // INT_MAX
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
m_pIntraFunc[0] (iMemPredMb, pTmpCur, iStrideY);
|
m_pIntraFunc[0] (iMemPredMb, pTmpCur, iStrideY);
|
||||||
iBlockSadH = m_pSadFunc (pTmpCur, iStrideY, iMemPredMb, 16);
|
iBlockSadH = m_pSadFunc (pTmpCur, iStrideY, iMemPredMb, 16);
|
||||||
@@ -457,7 +457,7 @@ void CComplexityAnalysisScreen::GomComplexityAnalysisInter (SPixMap* pSrc, SPixM
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iBlockSadH = iBlockSadV = 0x7fffffff; // INT_MAX
|
iBlockSadH = iBlockSadV = 0x7fffffff; // INT_MAX
|
||||||
|
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
m_pIntraFunc[0] (iMemPredMb, pTmpCur, iStrideY);
|
m_pIntraFunc[0] (iMemPredMb, pTmpCur, iStrideY);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void BilateralLumaFilter8_c (uint8_t* pSample, int32_t iStride) {
|
|||||||
pCurLine = pSample - iStride - DENOISE_GRAY_RADIUS;
|
pCurLine = pSample - iStride - DENOISE_GRAY_RADIUS;
|
||||||
for (y = 0; y < 3; y++) {
|
for (y = 0; y < 3; y++) {
|
||||||
for (x = 0; x < 3; x++) {
|
for (x = 0; x < 3; x++) {
|
||||||
if (x == 1 && y == 1) continue; // except center point
|
if (x == 1 && y == 1) continue; // except center point
|
||||||
iCurSample = pCurLine[x];
|
iCurSample = pCurLine[x];
|
||||||
iCurWeight = WELS_ABS (iCurSample - iCenterSample);
|
iCurWeight = WELS_ABS (iCurSample - iCenterSample);
|
||||||
iGreyDiff = 32 - iCurWeight;
|
iGreyDiff = 32 - iCurWeight;
|
||||||
|
|||||||
@@ -819,7 +819,7 @@ void ExtractDidNal (SFrameBSInfo* pBsInfo, int& iSrcLen, std::vector<SLostSim>*
|
|||||||
} else {
|
} else {
|
||||||
iPrefix = 0;
|
iPrefix = 0;
|
||||||
}
|
}
|
||||||
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrcPtr + iPrefix)) & 0x1f); // eNalUnitType
|
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrcPtr + iPrefix)) & 0x1f); // eNalUnitType
|
||||||
bLost = (ToRemainDidNal ((pSrcPtr + iPrefix + 2), tmpSLostSim.eNalType, iTarDid)) ? false : true;
|
bLost = (ToRemainDidNal ((pSrcPtr + iPrefix + 2), tmpSLostSim.eNalType, iTarDid)) ? false : true;
|
||||||
tmpSLostSim.isLost = bLost;
|
tmpSLostSim.isLost = bLost;
|
||||||
p_SLostSim->push_back (tmpSLostSim);
|
p_SLostSim->push_back (tmpSLostSim);
|
||||||
@@ -852,7 +852,7 @@ int SimulateNALLoss (const unsigned char* pSrc, int& iSrcLen, std::vector<SLost
|
|||||||
for (i = 0; i < iSrcLen;) {
|
for (i = 0; i < iSrcLen;) {
|
||||||
if (pSrc[i] == 0 && pSrc[i + 1] == 0 && pSrc[i + 2] == 0 && pSrc[i + 3] == 1) {
|
if (pSrc[i] == 0 && pSrc[i + 1] == 0 && pSrc[i + 2] == 0 && pSrc[i + 3] == 1) {
|
||||||
if (i - iBufPos) {
|
if (i - iBufPos) {
|
||||||
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrc + iBufPos + ilastprefixlen)) & 0x1f); // eNalUnitType
|
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrc + iBufPos + ilastprefixlen)) & 0x1f); // eNalUnitType
|
||||||
bLost = iLossIdx < iLossCharLen ? (pLossChars[iLossIdx] == '1') : (rand() % 2 == 1);
|
bLost = iLossIdx < iLossCharLen ? (pLossChars[iLossIdx] == '1') : (rand() % 2 == 1);
|
||||||
bLost = (!bLossPara) && (IS_PARAM_SETS_NALS (tmpSLostSim.eNalType)) ? false : bLost;
|
bLost = (!bLossPara) && (IS_PARAM_SETS_NALS (tmpSLostSim.eNalType)) ? false : bLost;
|
||||||
iLossIdx++;
|
iLossIdx++;
|
||||||
@@ -871,7 +871,7 @@ int SimulateNALLoss (const unsigned char* pSrc, int& iSrcLen, std::vector<SLost
|
|||||||
i = i + 4;
|
i = i + 4;
|
||||||
} else if (pSrc[i] == 0 && pSrc[i + 1] == 0 && pSrc[i + 2] == 1) {
|
} else if (pSrc[i] == 0 && pSrc[i + 1] == 0 && pSrc[i + 2] == 1) {
|
||||||
if (i - iBufPos) {
|
if (i - iBufPos) {
|
||||||
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrc + iBufPos + ilastprefixlen)) & 0x1f); // eNalUnitType
|
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrc + iBufPos + ilastprefixlen)) & 0x1f); // eNalUnitType
|
||||||
bLost = iLossIdx < iLossCharLen ? (pLossChars[iLossIdx] == '1') : (rand() % 2 == 1);
|
bLost = iLossIdx < iLossCharLen ? (pLossChars[iLossIdx] == '1') : (rand() % 2 == 1);
|
||||||
bLost = (!bLossPara) && (IS_PARAM_SETS_NALS (tmpSLostSim.eNalType)) ? false : bLost;
|
bLost = (!bLossPara) && (IS_PARAM_SETS_NALS (tmpSLostSim.eNalType)) ? false : bLost;
|
||||||
iLossIdx++;
|
iLossIdx++;
|
||||||
@@ -893,7 +893,7 @@ int SimulateNALLoss (const unsigned char* pSrc, int& iSrcLen, std::vector<SLost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i - iBufPos) {
|
if (i - iBufPos) {
|
||||||
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrc + iBufPos + ilastprefixlen)) & 0x1f); // eNalUnitType
|
tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrc + iBufPos + ilastprefixlen)) & 0x1f); // eNalUnitType
|
||||||
bLost = iLossIdx < iLossCharLen ? (pLossChars[iLossIdx] == '1') : (rand() % 2 == 1);
|
bLost = iLossIdx < iLossCharLen ? (pLossChars[iLossIdx] == '1') : (rand() % 2 == 1);
|
||||||
bLost = (!bLossPara) && (IS_PARAM_SETS_NALS (tmpSLostSim.eNalType)) ? false : bLost;
|
bLost = (!bLossPara) && (IS_PARAM_SETS_NALS (tmpSLostSim.eNalType)) ? false : bLost;
|
||||||
iLossIdx++;
|
iLossIdx++;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ TEST (GetIntraPredictorTest, TestGetI4x4LumaPredDDL) {
|
|||||||
const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2;
|
const uint8_t kuiDDL4 = (2 + kuiT4 + kuiT6 + (kuiT5 << 1)) >> 2;
|
||||||
const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2;
|
const uint8_t kuiDDL5 = (2 + kuiT5 + kuiT7 + (kuiT6 << 1)) >> 2;
|
||||||
const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2;
|
const uint8_t kuiDDL6 = (2 + kuiT6 + kuiT7 + (kuiT7 << 1)) >> 2;
|
||||||
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
||||||
uiV[0] = kuiDDL0;
|
uiV[0] = kuiDDL0;
|
||||||
uiV[1] = uiV[4] = kuiDDL1;
|
uiV[1] = uiV[4] = kuiDDL1;
|
||||||
uiV[2] = uiV[5] = uiV[8] = kuiDDL2;
|
uiV[2] = uiV[5] = uiV[8] = kuiDDL2;
|
||||||
@@ -248,7 +248,7 @@ TEST (GetIntraPredictorTest, TestGetI4x4LumaPredVLTop) {
|
|||||||
|
|
||||||
pRef++;
|
pRef++;
|
||||||
|
|
||||||
uint8_t* pTopLeft = &pRef[-kiStride - 1]; // top-left
|
uint8_t* pTopLeft = &pRef[-kiStride - 1]; // top-left
|
||||||
|
|
||||||
const uint8_t kuiT0 = * (pTopLeft + 1);
|
const uint8_t kuiT0 = * (pTopLeft + 1);
|
||||||
const uint8_t kuiT1 = * (pTopLeft + 2);
|
const uint8_t kuiT1 = * (pTopLeft + 2);
|
||||||
@@ -295,7 +295,7 @@ TEST (GetIntraPredictorTest, TestGetI4x4LumaPredVR) {
|
|||||||
|
|
||||||
pRef += kiStride + 1;
|
pRef += kiStride + 1;
|
||||||
|
|
||||||
const uint8_t kuiLT = pRef[-kiStride - 1]; // top-left
|
const uint8_t kuiLT = pRef[-kiStride - 1]; // top-left
|
||||||
const uint8_t kuiL0 = pRef[-1];
|
const uint8_t kuiL0 = pRef[-1];
|
||||||
const uint8_t kuiL1 = pRef[kiStride - 1];
|
const uint8_t kuiL1 = pRef[kiStride - 1];
|
||||||
const uint8_t kuiL2 = pRef[kiStride2 - 1];
|
const uint8_t kuiL2 = pRef[kiStride2 - 1];
|
||||||
@@ -313,7 +313,7 @@ TEST (GetIntraPredictorTest, TestGetI4x4LumaPredVR) {
|
|||||||
const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2;
|
const uint8_t kuiVR7 = (2 + kuiT1 + (kuiT2 << 1) + kuiT3) >> 2;
|
||||||
const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2;
|
const uint8_t kuiVR8 = (2 + kuiLT + (kuiL0 << 1) + kuiL1) >> 2;
|
||||||
const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2;
|
const uint8_t kuiVR9 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2;
|
||||||
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
||||||
uiV[0] = uiV[9] = kuiVR0;
|
uiV[0] = uiV[9] = kuiVR0;
|
||||||
uiV[1] = uiV[10] = kuiVR1;
|
uiV[1] = uiV[10] = kuiVR1;
|
||||||
uiV[2] = uiV[11] = kuiVR2;
|
uiV[2] = uiV[11] = kuiVR2;
|
||||||
@@ -362,7 +362,7 @@ TEST (GetIntraPredictorTest, TestGetI4x4LumaPredHU) {
|
|||||||
const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
|
const uint8_t kuiHU3 = (kuiL12 + kuiL23) >> 2;
|
||||||
const uint8_t kuiHU4 = kuiL23 >> 1;
|
const uint8_t kuiHU4 = kuiL23 >> 1;
|
||||||
const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
|
const uint8_t kuiHU5 = (1 + kuiL23 + (kuiL3 << 1)) >> 2;
|
||||||
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
||||||
uiV[0] = kuiHU0;
|
uiV[0] = kuiHU0;
|
||||||
uiV[1] = kuiHU1;
|
uiV[1] = kuiHU1;
|
||||||
uiV[2] = uiV[4] = kuiHU2;
|
uiV[2] = uiV[4] = kuiHU2;
|
||||||
@@ -395,7 +395,7 @@ TEST (GetIntraPredictorTest, TestGetI4x4LumaPredHD) {
|
|||||||
|
|
||||||
pRef += kiStride + 1;
|
pRef += kiStride + 1;
|
||||||
|
|
||||||
const uint8_t kuiLT = pRef[-kiStride - 1]; // top-left
|
const uint8_t kuiLT = pRef[-kiStride - 1]; // top-left
|
||||||
const uint8_t kuiL0 = pRef[-1];
|
const uint8_t kuiL0 = pRef[-1];
|
||||||
const uint8_t kuiL1 = pRef[kiStride - 1];
|
const uint8_t kuiL1 = pRef[kiStride - 1];
|
||||||
const uint8_t kuiL2 = pRef[kiStride2 - 1];
|
const uint8_t kuiL2 = pRef[kiStride2 - 1];
|
||||||
@@ -413,7 +413,7 @@ TEST (GetIntraPredictorTest, TestGetI4x4LumaPredHD) {
|
|||||||
const uint8_t kuiHD7 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2;
|
const uint8_t kuiHD7 = (2 + kuiL0 + (kuiL1 << 1) + kuiL2) >> 2;
|
||||||
const uint8_t kuiHD8 = (1 + kuiL2 + kuiL3) >> 1;
|
const uint8_t kuiHD8 = (1 + kuiL2 + kuiL3) >> 1;
|
||||||
const uint8_t kuiHD9 = (2 + kuiL1 + (kuiL2 << 1) + kuiL3) >> 2;
|
const uint8_t kuiHD9 = (2 + kuiL1 + (kuiL2 << 1) + kuiL3) >> 2;
|
||||||
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
|
||||||
uiV[0] = uiV[6] = kuiHD0;
|
uiV[0] = uiV[6] = kuiHD0;
|
||||||
uiV[1] = uiV[7] = kuiHD1;
|
uiV[1] = uiV[7] = kuiHD1;
|
||||||
uiV[2] = kuiHD2;
|
uiV[2] = kuiHD2;
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ void MotionEstimateTest::DoLineTest (PLineFullSearchFunc func, bool vertical) {
|
|||||||
const int32_t iCurMeBlockQpelPixX = ((iCurMeBlockPixX) << 2);
|
const int32_t iCurMeBlockQpelPixX = ((iCurMeBlockPixX) << 2);
|
||||||
const int32_t iCurMeBlockPixY = sMe.iCurMeBlockPixY;
|
const int32_t iCurMeBlockPixY = sMe.iCurMeBlockPixY;
|
||||||
const int32_t iCurMeBlockQpelPixY = ((iCurMeBlockPixY) << 2);
|
const int32_t iCurMeBlockQpelPixY = ((iCurMeBlockPixY) << 2);
|
||||||
uint16_t* pMvdCostX = sMe.pMvdCost - iCurMeBlockQpelPixX - sMe.sMvp.iMvX; //do the offset here
|
uint16_t* pMvdCostX = sMe.pMvdCost - iCurMeBlockQpelPixX - sMe.sMvp.iMvX; //do the offset here
|
||||||
uint16_t* pMvdCostY = sMe.pMvdCost - iCurMeBlockQpelPixY - sMe.sMvp.iMvY;
|
uint16_t* pMvdCostY = sMe.pMvdCost - iCurMeBlockQpelPixY - sMe.sMvp.iMvY;
|
||||||
uint16_t* pMvdCost = vertical ? pMvdCostY : pMvdCostX;
|
uint16_t* pMvdCost = vertical ? pMvdCostY : pMvdCostX;
|
||||||
int iSize = vertical ? m_iHeight : m_iWidth;
|
int iSize = vertical ? m_iHeight : m_iWidth;
|
||||||
|
|||||||
Reference in New Issue
Block a user