History

fix for simulcast case when the frame rate of lower resolution is higher, and add test case

Sijia Chen committed 11 years ago

Commit 53c057a1 parent 5c301de5 files · +183 −25Browse files

Showing the changes to codec/encoder/core/src/encoder.cpp (1 of 5 files). Show all

Unified · Split

codec/encoder/core/src/encoder.cpp+38−12
@@ -226,6 +226,41 @@ int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, · 225 unmodified lines
226 return iReturn;226 return iReturn;
227}227}
228 228
229void UpdateFrameNum(sWelsEncCtx* pEncCtx) {
230 bool bNeedFrameNumIncreasing = false;
231 for (int32_t i=0; i<MAX_DEPENDENCY_LAYER; i++) {
232 if (NRI_PRI_LOWEST != pEncCtx->eLastNalPriority[i]) {
233 bNeedFrameNumIncreasing = true;
234 }
235 }
236 if (bNeedFrameNumIncreasing) {
237 if (pEncCtx->iFrameNum < (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1)
238 ++ pEncCtx->iFrameNum;
239 else
240 pEncCtx->iFrameNum = 0; // if iFrameNum overflow
241 }
242 for (int32_t i=0; i<MAX_DEPENDENCY_LAYER; i++) {
243 pEncCtx->eLastNalPriority[i] = NRI_PRI_LOWEST;
244 }
245}
246
247
248void LoadBackFrameNum(sWelsEncCtx* pEncCtx) {
249 bool bNeedFrameNumIncreasing = false;
250 for (int32_t i=0; i<MAX_DEPENDENCY_LAYER; i++) {
251 if (NRI_PRI_LOWEST != pEncCtx->eLastNalPriority[i]) {
252 bNeedFrameNumIncreasing = true;
253 }
254 }
255 if (bNeedFrameNumIncreasing) {
256 if (pEncCtx->iFrameNum != 0) {
257 pEncCtx->iFrameNum --;
258 } else {
259 pEncCtx->iFrameNum = (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1;
260 }
261 }
262}
263
229/*!264/*!
230 * \brief initialize frame coding265 * \brief initialize frame coding
231 */266 */
@@ -245,12 +280,8 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) { · 13 unmodified lines
245 else280 else
246 pEncCtx->iPOC = 0;281 pEncCtx->iPOC = 0;
247 282
248 if (pEncCtx->eLastNalPriority != 0) {283 UpdateFrameNum(pEncCtx);
249 if (pEncCtx->iFrameNum < (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1)284
250 ++ pEncCtx->iFrameNum;
251 else
252 pEncCtx->iFrameNum = 0; // if iFrameNum overflow
253 }
254 pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;285 pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
255 pEncCtx->eSliceType = P_SLICE;286 pEncCtx->eSliceType = P_SLICE;
256 pEncCtx->eNalPriority = NRI_PRI_HIGH;287 pEncCtx->eNalPriority = NRI_PRI_HIGH;
@@ -275,12 +306,7 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) { · 18 unmodified lines
275 else306 else
276 pEncCtx->iPOC = 0;307 pEncCtx->iPOC = 0;
277 308
278 if (pEncCtx->eLastNalPriority != 0) {309 UpdateFrameNum(pEncCtx);
279 if (pEncCtx->iFrameNum < (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1)
280 ++ pEncCtx->iFrameNum;
281 else
282 pEncCtx->iFrameNum = 0; // if iFrameNum overflow
283 }
284 310
285 pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;311 pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
286 pEncCtx->eSliceType = I_SLICE;312 pEncCtx->eSliceType = I_SLICE;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t