| 1352 | } |
| 1353 | |
| 1354 | int32_t ExtendLayerBuffer (sWelsEncCtx* pCtx, |
| 1355 | const int32_t kiMaxSliceNumOld, |
| 1356 | const int32_t kiMaxSliceNumNew) { |
| 1357 | CMemoryAlign* pMA = pCtx->pMemAlign; |
| 1358 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; |
| 1359 | SSlice** ppSlice = NULL; |
| 1360 | int32_t* pFirstMbIdxOfSlice = NULL; |
| 1361 | int32_t* pCountMbNumInSlice = NULL; |
| 1362 | |
| 1363 | // update for ppsliceInlayer |
| 1364 | ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * kiMaxSliceNumNew, "ppSliceInLayer"); |
| 1365 | if (NULL == ppSlice) { |
| 1366 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: ppSlice is NULL"); |
| 1367 | return ENC_RETURN_MEMALLOCERR; |
| 1368 | } |
| 1369 | pMA->WelsFree (pCurLayer->ppSliceInLayer, "ppSliceInLayer"); |
| 1370 | pCurLayer->ppSliceInLayer = ppSlice; |
| 1371 | |
| 1372 | // update for pFirstMbIdxInSlice |
| 1373 | pFirstMbIdxOfSlice = (int32_t*)pMA->WelsMallocz (sizeof (int32_t*) * kiMaxSliceNumNew, "pFirstMbIdxOfSlice"); |
| 1374 | if (NULL == pFirstMbIdxOfSlice) { |
| 1375 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: pFirstMbIdxOfSlice is NULL"); |
| 1376 | return ENC_RETURN_MEMALLOCERR; |
| 1377 | } |
| 1378 | memset (pFirstMbIdxOfSlice, 0, sizeof (int32_t) * kiMaxSliceNumNew); |
| 1379 | memcpy (pFirstMbIdxOfSlice, pCurLayer->pFirstMbIdxOfSlice, sizeof (int32_t) * kiMaxSliceNumOld); |
| 1380 | pMA->WelsFree (pCurLayer->pFirstMbIdxOfSlice, "pFirstMbIdxOfSlice"); |
| 1381 | pCurLayer->pFirstMbIdxOfSlice = pFirstMbIdxOfSlice; |
| 1382 | |
| 1383 | // update for pCountMbNumInSlice |
| 1384 | pCountMbNumInSlice = (int32_t*)pMA->WelsMallocz (sizeof (int32_t*) * kiMaxSliceNumNew, "pCountMbNumInSlice"); |
| 1385 | if (NULL == pCountMbNumInSlice) { |
| 1386 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: pCountMbNumInSlice is NULL"); |
| 1387 | return ENC_RETURN_MEMALLOCERR; |
| 1388 | } |
| 1389 | memset (pCountMbNumInSlice, 0, sizeof (int32_t) * kiMaxSliceNumNew); |
| 1390 | memcpy (pCountMbNumInSlice, pCurLayer->pCountMbNumInSlice, sizeof (int32_t) * kiMaxSliceNumOld); |
| 1391 | pMA->WelsFree (pCurLayer->pCountMbNumInSlice, "pCountMbNumInSlice"); |
| 1392 | pCurLayer->pCountMbNumInSlice = pCountMbNumInSlice; |
| 1393 | |
| 1394 | return ENC_RETURN_SUCCESS; |
| 1395 | } |
| 1396 | |
| 1397 | int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { |
| 1398 |
no test coverage detected