Merge pull request #1809 from sijchen/savc51

[Encoder] fix a nal generation for simulcast avc
This commit is contained in:
ruil2 2015-02-11 14:08:08 +08:00
commit ab3b55ae9c
2 changed files with 12 additions and 2 deletions

View File

@ -355,6 +355,13 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
pCodingParam->eSpsPpsIdStrategy = INCREASING_ID;
}
if (pCodingParam->bSimulcastAVC && pCodingParam->bPrefixNalAddingCtrl) {
WelsLog (pLogCtx, WELS_LOG_INFO,
"ParamValidationExt(), bSimulcastAVC(%d) is not compatible with bPrefixNalAddingCtrl(%d) true, adjusted bPrefixNalAddingCtrl to false",
pCodingParam->eSpsPpsIdStrategy, pCodingParam->bSimulcastAVC);
pCodingParam->bPrefixNalAddingCtrl = false;
}
for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) {
SSpatialLayerConfig* pSpatialLayer = &pCodingParam->sSpatialLayers[i];
const int32_t kiPicWidth = pSpatialLayer->iVideoWidth;
@ -3689,9 +3696,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
iNalIdxInLayer = 0;
bAvcBased = ((pSvcParam->bSimulcastAVC) || (iCurDid == BASE_DEPENDENCY_ID));
pCtx->bNeedPrefixNalFlag = (bAvcBased &&
pCtx->bNeedPrefixNalFlag = ((!pSvcParam->bSimulcastAVC) && (bAvcBased &&
(pSvcParam->bPrefixNalAddingCtrl ||
(pSvcParam->iSpatialLayerNum > 1)));
(pSvcParam->iSpatialLayerNum > 1))));
if (eFrameType == videoFrameTypeP) {
eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT;

View File

@ -3210,6 +3210,9 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVC) {
for (int iLayer = 0; iLayer < info.iLayerNum; ++iLayer) {
iLayerLen = 0;
const SLayerBSInfo& layerInfo = info.sLayerInfo[iLayer];
const int kiFirstNalType = ((* (layerInfo.pBsBuf + 4)) & 0x1f);
ASSERT_TRUE ((kiFirstNalType == NAL_SPS) || (kiFirstNalType == NAL_PPS) || (kiFirstNalType == NAL_SLICE)
|| (kiFirstNalType == NAL_SLICE_IDR) || (kiFirstNalType == NAL_SEI));
for (int iNal = 0; iNal < layerInfo.iNalCount; ++iNal) {
iLayerLen += layerInfo.pNalLengthInByte[iNal];
}