Merge pull request #286 from mstorsjo/remove-hw-decode
Remove stub interfaces for hw decoding
This commit is contained in:
commit
e61578785b
@ -97,13 +97,10 @@ typedef enum {
|
||||
DECODER_OPTION_END_OF_STREAM, /* Indicate bitstream of the final frame to be decoded */
|
||||
DECODER_OPTION_VCL_NAL, //feedback whether or not have VCL NAL in current AU for application layer
|
||||
DECODER_OPTION_TEMPORAL_ID, //feedback temporal id for application layer
|
||||
DECODER_OPTION_MODE, // indicates the decoding mode
|
||||
DECODER_OPTION_OUTPUT_PROPERTY,
|
||||
DECODER_OPTION_FRAME_NUM, //feedback current decoded frame number
|
||||
DECODER_OPTION_IDR_PIC_ID, // feedback current frame belong to which IDR period
|
||||
DECODER_OPTION_LTR_MARKING_FLAG, // feedback wether current frame mark a LTR
|
||||
DECODER_OPTION_LTR_MARKED_FRAME_NUM, // feedback frame num marked by current Frame
|
||||
DECODER_OPTION_DEVICE_INFO,
|
||||
|
||||
} DECODER_OPTION;
|
||||
typedef enum { //feedback that whether or not have VCL NAL in current AU
|
||||
|
@ -160,32 +160,6 @@ typedef struct {
|
||||
int iSkipFrameStep; //how many frames to skip
|
||||
} SRateThresholds, *PRateThresholds;
|
||||
|
||||
/*new interface*/
|
||||
typedef struct WelsDeviceInfo {
|
||||
int bSupport; /* a logic flag provided by decoder which indicates whether GPU decoder can work based on the following device info. */
|
||||
char Vendor[128]; // vendor name
|
||||
char Device[128]; // device name
|
||||
char Driver[128]; // driver version
|
||||
char DriverDate[128]; // driver release date
|
||||
} Device_Info;
|
||||
|
||||
typedef enum TagBufferProperty {
|
||||
BUFFER_HOST = 0, // host memory
|
||||
BUFFER_DEVICE = 1, // device memory including surface and shared handle
|
||||
// for DXVA: shared handle
|
||||
// for VDA : iosurface
|
||||
|
||||
//SURFACE_DEVICE , // surface
|
||||
//SHARED_HANDLE // shared handle
|
||||
} EBufferProperty;
|
||||
|
||||
typedef enum TagDecodeMode {
|
||||
AUTO_MODE = 0, // decided by decoder itself, dynamic mode switch, delayed switch
|
||||
SW_MODE = 1, // decoded by CPU, instant switch
|
||||
GPU_MODE = 2, // decoded by GPU, instant switch
|
||||
SWITCH_MODE = 3 // switch to the other mode, forced mode switch, delayed switch
|
||||
} EDecodeMode;
|
||||
|
||||
typedef struct TagSysMemBuffer {
|
||||
int iWidth; //width of decoded pic for display
|
||||
int iHeight; //height of decoded pic for display
|
||||
@ -193,24 +167,10 @@ typedef struct TagSysMemBuffer {
|
||||
int iStride[2]; //stride of 2 component
|
||||
} SSysMEMBuffer;
|
||||
|
||||
typedef struct TagVideoMemBuffer {
|
||||
int iSurfaceWidth; // used for surface create
|
||||
int iSurfaceHeight;
|
||||
int D3Dformat; //type is "D3DFORMAT"
|
||||
int D3DPool; // type is "D3DPOOL";
|
||||
int iLeftTopX;
|
||||
int iLeftTopY;
|
||||
int iRightBottomX;
|
||||
int iRightBottomY;
|
||||
} SVideoMemBuffer;
|
||||
|
||||
typedef struct TagBufferInfo {
|
||||
EBufferProperty eBufferProperty; //0: host memory; 1: device memory;
|
||||
int iBufferStatus; // 0: one frame data is not ready; 1: one frame data is ready
|
||||
EDecodeMode eWorkMode; //indicate what the real working mode in decoder
|
||||
union {
|
||||
SSysMEMBuffer sSystemBuffer;
|
||||
SVideoMemBuffer sVideoBuffer;
|
||||
} UsrData;
|
||||
} SBufferInfo;
|
||||
|
||||
|
@ -57,7 +57,6 @@ typedef struct {
|
||||
#define SAFE_RELEASE(p) if(p) { (p)->Release(); (p) = NULL; }
|
||||
#define SAFE_FREE(p) if(p) { free (p); (p) = NULL; }
|
||||
|
||||
HRESULT Dump2YUV (void* pDst[3], void* pSurface, int iWidth, int iHeight, int iStride[2]);
|
||||
HRESULT Dump2Surface (void* pDst[3], void* pSurface, int iWidth, int iHeight, int iStride[2]);
|
||||
HRESULT InitWindow (HWND* hWnd);
|
||||
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
||||
@ -122,7 +121,7 @@ HRESULT CD3D9Utils::Process (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
|
||||
return hResult;
|
||||
|
||||
BOOL bWindowed = pFp ? FALSE : TRUE;
|
||||
BOOL bNeedD3D9 = ! (!bWindowed && pInfo->eBufferProperty == BUFFER_HOST);
|
||||
BOOL bNeedD3D9 = ! (!bWindowed);
|
||||
if (!m_bInitDone)
|
||||
m_bInitDone = !bNeedD3D9;
|
||||
|
||||
@ -147,14 +146,11 @@ HRESULT CD3D9Utils::Process (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
|
||||
|
||||
HRESULT CD3D9Utils::Render (void* pDst[3], SBufferInfo* pInfo) {
|
||||
HRESULT hResult = E_FAIL;
|
||||
EBufferProperty eBufferProperty = pInfo->eBufferProperty;
|
||||
|
||||
if (eBufferProperty == BUFFER_HOST) {
|
||||
hResult = InitResource (NULL, pInfo);
|
||||
if (SUCCEEDED (hResult))
|
||||
hResult = Dump2Surface (pDst, m_lpD3D9RawSurfaceShare, pInfo->UsrData.sSystemBuffer.iWidth,
|
||||
pInfo->UsrData.sSystemBuffer.iHeight, pInfo->UsrData.sSystemBuffer.iStride);
|
||||
}
|
||||
|
||||
if (SUCCEEDED (hResult)) {
|
||||
IDirect3DSurface9* pBackBuffer = NULL;
|
||||
@ -168,7 +164,6 @@ HRESULT CD3D9Utils::Render (void* pDst[3], SBufferInfo* pInfo) {
|
||||
|
||||
HRESULT CD3D9Utils::Dump (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
|
||||
HRESULT hResult = E_FAIL;
|
||||
EBufferProperty eBufferProperty = pInfo->eBufferProperty;
|
||||
int iStride[2];
|
||||
int iWidth;
|
||||
int iHeight;
|
||||
@ -223,12 +218,10 @@ HRESULT CD3D9Utils::InitResource (void* pSharedHandle, SBufferInfo* pInfo) {
|
||||
m_d3dpp.hDeviceWindow = m_hWnd;
|
||||
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
hResult = m_lpD3D9->CreateDevice (uiAdapter, D3DDevType, NULL, dwBehaviorFlags, &m_d3dpp, &m_lpD3D9Device);
|
||||
if (pInfo->eBufferProperty == BUFFER_HOST) {
|
||||
iWidth = pInfo->UsrData.sSystemBuffer.iWidth;
|
||||
iHeight = pInfo->UsrData.sSystemBuffer.iHeight;
|
||||
D3Dformat = (D3DFORMAT)NV12_FORMAT;
|
||||
D3Dpool = (D3DPOOL)D3DPOOL_DEFAULT;
|
||||
}
|
||||
|
||||
hResult = m_lpD3D9Device->CreateOffscreenPlainSurface (iWidth, iHeight, (D3DFORMAT)D3Dformat, (D3DPOOL)D3Dpool,
|
||||
&m_lpD3D9RawSurfaceShare, NULL);
|
||||
@ -297,7 +290,7 @@ HRESULT CD3D9ExUtils::Process (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
|
||||
return hResult;
|
||||
|
||||
BOOL bWindowed = pFp ? FALSE : TRUE;
|
||||
BOOL bNeedD3D9 = ! (!bWindowed && pInfo->eBufferProperty == BUFFER_HOST);
|
||||
BOOL bNeedD3D9 = ! (!bWindowed);
|
||||
if (!m_bInitDone)
|
||||
m_bInitDone = !bNeedD3D9;
|
||||
|
||||
@ -322,17 +315,11 @@ HRESULT CD3D9ExUtils::Process (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
|
||||
|
||||
HRESULT CD3D9ExUtils::Render (void* pDst[3], SBufferInfo* pInfo) {
|
||||
HRESULT hResult = E_FAIL;
|
||||
EBufferProperty eBufferProperty = pInfo->eBufferProperty;
|
||||
|
||||
if (eBufferProperty == BUFFER_HOST) {
|
||||
hResult = InitResource (NULL, pInfo);
|
||||
if (SUCCEEDED (hResult))
|
||||
hResult = Dump2Surface (pDst, m_lpD3D9RawSurfaceShare, pInfo->UsrData.sSystemBuffer.iWidth,
|
||||
pInfo->UsrData.sSystemBuffer.iHeight, pInfo->UsrData.sSystemBuffer.iStride);
|
||||
} else if (eBufferProperty == BUFFER_DEVICE) {
|
||||
VOID* pSharedHandle = pDst[0];
|
||||
hResult = InitResource (pSharedHandle, pInfo);
|
||||
}
|
||||
|
||||
if (SUCCEEDED (hResult)) {
|
||||
IDirect3DSurface9* pBackBuffer = NULL;
|
||||
@ -346,34 +333,14 @@ HRESULT CD3D9ExUtils::Render (void* pDst[3], SBufferInfo* pInfo) {
|
||||
|
||||
HRESULT CD3D9ExUtils::Dump (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
|
||||
HRESULT hResult = E_FAIL;
|
||||
EBufferProperty eBufferProperty = pInfo->eBufferProperty;
|
||||
int iStride[2];
|
||||
int iWidth;
|
||||
int iHeight;
|
||||
|
||||
if (eBufferProperty != BUFFER_HOST) {
|
||||
iWidth = pInfo->UsrData.sVideoBuffer.iSurfaceWidth;
|
||||
iHeight = pInfo->UsrData.sVideoBuffer.iSurfaceHeight;
|
||||
iStride[0] = iWidth;
|
||||
iStride[1] = iWidth / 2;
|
||||
|
||||
if (m_pDumpYUV == NULL) {
|
||||
m_pDumpYUV = (unsigned char*)malloc (iWidth * iHeight * 3 / 2 * sizeof (unsigned char));
|
||||
}
|
||||
|
||||
if (m_pDumpYUV) {
|
||||
void* pSurface = pDst[1];
|
||||
pDst[0] = m_pDumpYUV;
|
||||
pDst[1] = m_pDumpYUV + iHeight * iStride[0] * sizeof (unsigned char);
|
||||
pDst[2] = m_pDumpYUV + iHeight * iStride[0] * 5 / 4 * sizeof (unsigned char);
|
||||
hResult = Dump2YUV (pDst, pSurface, iWidth, iHeight, iStride);
|
||||
}
|
||||
} else {
|
||||
iWidth = pInfo->UsrData.sSystemBuffer.iWidth;
|
||||
iHeight = pInfo->UsrData.sSystemBuffer.iHeight;
|
||||
iStride[0] = pInfo->UsrData.sSystemBuffer.iStride[0];
|
||||
iStride[1] = pInfo->UsrData.sSystemBuffer.iStride[1];
|
||||
}
|
||||
|
||||
if (pDst[0] && pDst[1] && pDst[2])
|
||||
Write2File (pFp, (unsigned char**)pDst, iStride, iWidth, iHeight);
|
||||
@ -419,17 +386,10 @@ HRESULT CD3D9ExUtils::InitResource (void* pSharedHandle, SBufferInfo* pInfo) {
|
||||
m_d3dpp.hDeviceWindow = m_hWnd;
|
||||
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
hResult = m_lpD3D9->CreateDeviceEx (uiAdapter, D3DDevType, NULL, dwBehaviorFlags, &m_d3dpp, NULL, &m_lpD3D9Device);
|
||||
if (pInfo->eBufferProperty == BUFFER_HOST) {
|
||||
iWidth = pInfo->UsrData.sSystemBuffer.iWidth;
|
||||
iHeight = pInfo->UsrData.sSystemBuffer.iHeight;
|
||||
D3Dformat = (D3DFORMAT)NV12_FORMAT;
|
||||
D3Dpool = (D3DPOOL)D3DPOOL_DEFAULT;
|
||||
} else {
|
||||
iWidth = pInfo->UsrData.sVideoBuffer.iSurfaceWidth;
|
||||
iHeight = pInfo->UsrData.sVideoBuffer.iSurfaceHeight;
|
||||
D3Dformat = (D3DFORMAT)pInfo->UsrData.sVideoBuffer.D3Dformat;
|
||||
D3Dpool = (D3DPOOL)pInfo->UsrData.sVideoBuffer.D3DPool;
|
||||
}
|
||||
hResult = m_lpD3D9Device->CreateOffscreenPlainSurface (iWidth, iHeight, (D3DFORMAT)D3Dformat, (D3DPOOL)D3Dpool,
|
||||
&m_lpD3D9RawSurfaceShare, &pSharedHandle);
|
||||
}
|
||||
@ -441,40 +401,6 @@ HRESULT CD3D9ExUtils::InitResource (void* pSharedHandle, SBufferInfo* pInfo) {
|
||||
}
|
||||
|
||||
|
||||
HRESULT Dump2YUV (void* pDst[3], void* pSurface, int iWidth, int iHeight, int iStride[2]) {
|
||||
HRESULT hResult = E_FAIL;
|
||||
|
||||
if (!pDst[0] || !pDst[1] || !pDst[2] || !pSurface)
|
||||
return hResult;
|
||||
|
||||
IDirect3DSurface9* pSurfaceData = (IDirect3DSurface9*)pSurface;
|
||||
D3DLOCKED_RECT sD3DLockedRect = {0};
|
||||
hResult = pSurfaceData->LockRect (&sD3DLockedRect, NULL, 0);
|
||||
|
||||
unsigned char* pInY = (unsigned char*)sD3DLockedRect.pBits;
|
||||
unsigned char* pOutY = (unsigned char*)pDst[0];
|
||||
int iInStride = sD3DLockedRect.Pitch;
|
||||
int iOutStride = iStride[0];
|
||||
|
||||
for (int j = 0; j < iHeight; j++)
|
||||
memcpy (pOutY + j * iOutStride, pInY + j * iInStride, iWidth); //confirmed_safe_unsafe_usage
|
||||
|
||||
unsigned char* pOutV = (unsigned char*)pDst[1];
|
||||
unsigned char* pOutU = (unsigned char*)pDst[2];
|
||||
unsigned char* pInC = pInY + iInStride * iHeight;
|
||||
iOutStride = iStride[1];
|
||||
for (int i = 0; i < iHeight / 2; i++) {
|
||||
for (int j = 0; j < iWidth; j += 2) {
|
||||
pOutV[i * iOutStride + j / 2] = pInC[i * iInStride + j ];
|
||||
pOutU[i * iOutStride + j / 2] = pInC[i * iInStride + j + 1];
|
||||
}
|
||||
}
|
||||
|
||||
pSurfaceData->UnlockRect();
|
||||
|
||||
return hResult;
|
||||
}
|
||||
|
||||
HRESULT Dump2Surface (void* pDst[3], void* pSurface, int iWidth, int iHeight, int iStride[2]) {
|
||||
HRESULT hResult = E_FAIL;
|
||||
|
||||
|
@ -81,9 +81,6 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
|
||||
int32_t iColorFormat = videoFormatInternal;
|
||||
static int32_t iFrameNum = 0;
|
||||
|
||||
EDecodeMode eDecoderMode = SW_MODE;
|
||||
EBufferProperty eOutputProperty = BUFFER_DEVICE;
|
||||
|
||||
CUtils cOutputModule;
|
||||
double dElapsed = 0;
|
||||
|
||||
@ -150,16 +147,6 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
|
||||
goto label_exit;
|
||||
}
|
||||
|
||||
if (pDecoder->SetOption (DECODER_OPTION_MODE, &eDecoderMode)) {
|
||||
fprintf (stderr, "SetOption() failed, opt_id : %d ..\n", DECODER_OPTION_MODE);
|
||||
goto label_exit;
|
||||
}
|
||||
|
||||
// set the output buffer property
|
||||
if (pYuvFile) {
|
||||
pDecoder->SetOption (DECODER_OPTION_OUTPUT_PROPERTY, &eOutputProperty);
|
||||
}
|
||||
|
||||
#if defined ( STICK_STREAM_SIZE )
|
||||
FILE* fpTrack = fopen ("3.len", "rb");
|
||||
|
||||
@ -205,10 +192,6 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
|
||||
pDecoder->GetOption (DECODER_OPTION_VCL_NAL, &iFeedbackVclNalInAu);
|
||||
int32_t iFeedbackTidInAu;
|
||||
pDecoder->GetOption (DECODER_OPTION_TEMPORAL_ID, &iFeedbackTidInAu);
|
||||
int32_t iSetMode;
|
||||
pDecoder->GetOption (DECODER_OPTION_MODE, &iSetMode);
|
||||
int32_t iDeviceInfo;
|
||||
pDecoder->GetOption (DECODER_OPTION_DEVICE_INFO, &iDeviceInfo);
|
||||
//~end for
|
||||
|
||||
iStart = WelsTime();
|
||||
@ -229,13 +212,8 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
|
||||
if (sDstBufInfo.iBufferStatus == 1) {
|
||||
iFrameNum++;
|
||||
cOutputModule.Process ((void**)pDst, &sDstBufInfo, pYuvFile);
|
||||
if (sDstBufInfo.eBufferProperty == BUFFER_HOST) {
|
||||
iWidth = sDstBufInfo.UsrData.sSystemBuffer.iWidth;
|
||||
iHeight = sDstBufInfo.UsrData.sSystemBuffer.iHeight;
|
||||
} else {
|
||||
iWidth = sDstBufInfo.UsrData.sVideoBuffer.iSurfaceWidth;
|
||||
iHeight = sDstBufInfo.UsrData.sVideoBuffer.iSurfaceHeight;
|
||||
}
|
||||
iWidth = sDstBufInfo.UsrData.sSystemBuffer.iWidth;
|
||||
iHeight = sDstBufInfo.UsrData.sSystemBuffer.iHeight;
|
||||
|
||||
if (pOptionFile != NULL) {
|
||||
if (iWidth != iLastWidth && iHeight != iLastHeight) {
|
||||
@ -268,13 +246,8 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
|
||||
|
||||
if (sDstBufInfo.iBufferStatus == 1) {
|
||||
cOutputModule.Process ((void**)pDst, &sDstBufInfo, pYuvFile);
|
||||
if (sDstBufInfo.eBufferProperty == BUFFER_HOST) {
|
||||
iWidth = sDstBufInfo.UsrData.sSystemBuffer.iWidth;
|
||||
iHeight = sDstBufInfo.UsrData.sSystemBuffer.iHeight;
|
||||
} else {
|
||||
iWidth = sDstBufInfo.UsrData.sVideoBuffer.iSurfaceWidth;
|
||||
iHeight = sDstBufInfo.UsrData.sVideoBuffer.iSurfaceHeight;
|
||||
}
|
||||
iWidth = sDstBufInfo.UsrData.sSystemBuffer.iWidth;
|
||||
iHeight = sDstBufInfo.UsrData.sSystemBuffer.iHeight;
|
||||
|
||||
if (pOptionFile != NULL) {
|
||||
/* Anyway, we need write in case of final frame decoding */
|
||||
|
@ -173,10 +173,6 @@ typedef struct TagWelsDecoderContext {
|
||||
// Configuration
|
||||
SDecodingParam* pParam;
|
||||
uint32_t uiCpuFlag; // CPU compatibility detected
|
||||
int32_t iDecoderMode; // indicate decoder running mode
|
||||
int32_t iSetMode; // indicate decoder mode set from upper layer, this is read-only for decoder internal
|
||||
int32_t iDecoderOutputProperty; // indicate the output buffer property
|
||||
int32_t iModeSwitchType; // 1: optimal decision; 2: forced switch to the other mode; 0: no switch
|
||||
|
||||
int32_t iOutputColorFormat; // color space format to be outputed
|
||||
VIDEO_BITSTREAM_TYPE eVideoType; //indicate the type of video to decide whether or not to do qp_delta error detection.
|
||||
|
@ -64,8 +64,6 @@ extern void WelsLog (void* pPtr, int32_t iLevel, const char* kpFmt, ...) __attri
|
||||
extern void WelsLog (void* pPtr, int32_t iLevel, const char* kpFmt, ...);
|
||||
#endif
|
||||
|
||||
#define DECODER_MODE_NAME(a) ((a == SW_MODE)?"SW_MODE":((a == GPU_MODE)?"GPU_MODE":((a == AUTO_MODE)?"AUTO_MODE":"SWITCH_MODE")))
|
||||
#define OUTPUT_PROPERTY_NAME(a) ((a == 0)?"system_memory":"video_memory")
|
||||
#define BUFFER_STATUS_NAME(a) ((a == 0)?"unvalid":"valid")
|
||||
|
||||
|
||||
|
@ -402,12 +402,6 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, void* pTraceHandle, PWelsLogC
|
||||
// open decoder
|
||||
WelsOpenDecoder (pCtx);
|
||||
|
||||
// decode mode setting
|
||||
pCtx->iDecoderMode = SW_MODE;
|
||||
pCtx->iSetMode = AUTO_MODE;
|
||||
pCtx->iDecoderOutputProperty = BUFFER_HOST;
|
||||
pCtx->iModeSwitchType = 0; // 0: do not do mode switch
|
||||
|
||||
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
@ -76,9 +76,6 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
||||
"DecodeFrameConstruction()::::output good I frame, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d.\n",
|
||||
kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset,
|
||||
pCtx->sFrameCrop.iBottomOffset);
|
||||
WelsLog (pCtx, WELS_LOG_INFO, "After decoding, set_mode:[%s], eWorkMode:[%s], eBufferProperty:[%s]\n",
|
||||
DECODER_MODE_NAME (pCtx->iSetMode), DECODER_MODE_NAME (pCtx->iDecoderMode),
|
||||
OUTPUT_PROPERTY_NAME (pDstInfo->eBufferProperty));
|
||||
}
|
||||
|
||||
//////output:::normal path
|
||||
@ -99,7 +96,6 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
|
||||
ppDst[0] = ppDst[0] + pCtx->sFrameCrop.iTopOffset * 2 * pPic->iLinesize[0] + pCtx->sFrameCrop.iLeftOffset * 2;
|
||||
ppDst[1] = ppDst[1] + pCtx->sFrameCrop.iTopOffset * pPic->iLinesize[1] + pCtx->sFrameCrop.iLeftOffset;
|
||||
ppDst[2] = ppDst[2] + pCtx->sFrameCrop.iTopOffset * pPic->iLinesize[1] + pCtx->sFrameCrop.iLeftOffset;
|
||||
pDstInfo->eBufferProperty = BUFFER_HOST;
|
||||
pDstInfo->iBufferStatus = 1;
|
||||
|
||||
return 0;
|
||||
@ -935,7 +931,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
|
||||
return ERR_INFO_OUT_OF_MEMORY;
|
||||
|
||||
memset (pDq, 0, sizeof (SDqLayer));
|
||||
if (pCtx->iDecoderMode == SW_MODE) {
|
||||
|
||||
do {
|
||||
const int32_t kiHshift = iPlaneIdx ? 1 : 0;
|
||||
@ -1015,7 +1010,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
|
||||
(NULL == pCtx->sMb.pInterPredictionDoneFlag[i])
|
||||
)
|
||||
)
|
||||
} // end of if(pCtx->iDecoderMode == SW_MODE)
|
||||
|
||||
pCtx->pDqLayersList[i] = pDq;
|
||||
++ i;
|
||||
@ -1580,8 +1574,6 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI
|
||||
}
|
||||
|
||||
|
||||
pDstInfo->eBufferProperty = (EBufferProperty)pCtx->iDecoderOutputProperty;
|
||||
|
||||
iErr = DecodeCurrentAccessUnit (pCtx, ppDst, iStride, &iWidth, &iHeight, pDstInfo);
|
||||
|
||||
WelsDecodeAccessUnitEnd (pCtx);
|
||||
|
@ -81,7 +81,6 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const
|
||||
|
||||
iLumaSize = iPicWidth * iPicHeight;
|
||||
iChromaSize = iPicChromaWidth * iPicChromaHeight;
|
||||
if (pCtx->iDecoderMode == SW_MODE) {
|
||||
pPic->pBuffer[0] = static_cast<uint8_t*> (WelsMalloc (iLumaSize /* luma */
|
||||
+ (iChromaSize << 1) /* Cb,Cr */, "_pic->buffer[0]"));
|
||||
|
||||
@ -93,7 +92,6 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const
|
||||
pPic->pData[0] = pPic->pBuffer[0] + (1 + pPic->iLinesize[0]) * PADDING_LENGTH;
|
||||
pPic->pData[1] = pPic->pBuffer[1] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[1]) * PADDING_LENGTH) >> 1);
|
||||
pPic->pData[2] = pPic->pBuffer[2] + /*WELS_ALIGN*/ (((1 + pPic->iLinesize[2]) * PADDING_LENGTH) >> 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -259,32 +259,6 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
|
||||
m_pDecContext->bEndOfStreamFlag = iVal ? true : false;
|
||||
|
||||
return cmResultSuccess;
|
||||
} else if (eOptID == DECODER_OPTION_MODE) {
|
||||
if (pOption == NULL)
|
||||
return cmInitParaError;
|
||||
|
||||
iVal = * ((int*)pOption);
|
||||
|
||||
m_pDecContext->iSetMode = iVal;
|
||||
if (iVal == SW_MODE) {
|
||||
m_pDecContext->iDecoderOutputProperty = BUFFER_HOST;
|
||||
} else {
|
||||
#if !defined(__APPLE__)
|
||||
m_pDecContext->iDecoderOutputProperty = BUFFER_DEVICE;
|
||||
#else
|
||||
m_pDecContext->iDecoderOutputProperty = BUFFER_HOST;//BUFFER_HOST;//BUFFER_DEVICE;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return cmResultSuccess;
|
||||
} else if (eOptID == DECODER_OPTION_OUTPUT_PROPERTY) {
|
||||
if (pOption == NULL)
|
||||
return cmInitParaError;
|
||||
|
||||
iVal = * ((int*)pOption);
|
||||
if (m_pDecContext->iSetMode != SW_MODE)
|
||||
m_pDecContext->iDecoderOutputProperty = iVal;
|
||||
}
|
||||
|
||||
|
||||
@ -339,19 +313,6 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) {
|
||||
iVal = m_pDecContext->iFeedbackTidInAu;
|
||||
* ((int*)pOption) = iVal;
|
||||
return cmResultSuccess;
|
||||
} else if (DECODER_OPTION_MODE == eOptID) {
|
||||
if (pOption == NULL)
|
||||
return cmInitParaError;
|
||||
|
||||
iVal = m_pDecContext->iSetMode;
|
||||
|
||||
* ((int*)pOption) = iVal;
|
||||
return cmResultSuccess;
|
||||
} else if (DECODER_OPTION_DEVICE_INFO == eOptID) {
|
||||
if (pOption == NULL)
|
||||
return cmInitParaError;
|
||||
|
||||
return cmResultSuccess;
|
||||
}
|
||||
|
||||
return cmInitParaError;
|
||||
@ -390,7 +351,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
|
||||
m_pDecContext->iErrorCode = dsErrorFree; //initialize at the starting of AU decoding.
|
||||
m_pDecContext->iFeedbackVclNalInAu = FEEDBACK_UNKNOWN_NAL; //initialize
|
||||
memset (pDstInfo, 0, sizeof (SBufferInfo));
|
||||
pDstInfo->eBufferProperty = (EBufferProperty)m_pDecContext->iDecoderOutputProperty;
|
||||
|
||||
#ifdef LONG_TERM_REF
|
||||
m_pDecContext->bReferenceLostAtT0Flag = false; //initialize for LTR
|
||||
@ -406,8 +366,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
|
||||
pDstInfo); //iErrorCode has been modified in this function
|
||||
XMMREG_PROTECT_LOAD(CWelsH264Decoder);
|
||||
|
||||
pDstInfo->eWorkMode = (EDecodeMode)m_pDecContext->iDecoderMode;
|
||||
|
||||
if (m_pDecContext->iErrorCode) {
|
||||
ENalUnitType eNalType =
|
||||
NAL_UNIT_UNSPEC_0; //for NBR, IDR frames are expected to decode as followed if error decoding an IDR currently
|
||||
@ -447,7 +405,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame (const unsigned char* kpSrc,
|
||||
DstInfo.UsrData.sSystemBuffer.iStride[1] = pStride[1];
|
||||
DstInfo.UsrData.sSystemBuffer.iWidth = iWidth;
|
||||
DstInfo.UsrData.sSystemBuffer.iHeight = iHeight;
|
||||
DstInfo.eBufferProperty = BUFFER_HOST;
|
||||
|
||||
eDecState = DecodeFrame2 (kpSrc, kiSrcLen, (void**)ppDst, &DstInfo);
|
||||
if (eDecState == dsErrorFree) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user