History

encoder interface update step1

ruil2 committed 12 years ago

Commit 35fa4291 parent 3ff7e3d20 files · +598 −501Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+126−125
@@ -88,7 +88,7 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 87 unmodified lines
88 88
89 assert (pCfg != NULL);89 assert (pCfg != NULL);
90 90
91 for (i = 0; i < pCfg->iNumDependencyLayer; ++ i) {91 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
92 SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];92 SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];
93 if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn93 if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn
94 && fDlp->fInputFrameRate <= fEpsn)94 && fDlp->fInputFrameRate <= fEpsn)
@@ -109,7 +109,7 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 14 unmodified lines
109 }109 }
110 }110 }
111 111
112 for (i = 0; i < pCfg->iNumDependencyLayer; ++ i) {112 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
113 SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];113 SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];
114 if (fDlp->fInputFrameRate > fMaxFrameRate)114 if (fDlp->fInputFrameRate > fMaxFrameRate)
115 fMaxFrameRate = fDlp->fInputFrameRate;115 fMaxFrameRate = fDlp->fInputFrameRate;
@@ -120,7 +120,7 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) { · 4 unmodified lines
120 pCfg->fMaxFrameRate = fMaxFrameRate;120 pCfg->fMaxFrameRate = fMaxFrameRate;
121 }121 }
122 122
123 for (i = 0; i < pCfg->iNumDependencyLayer; ++ i) {123 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
124 SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];124 SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];
125 125
126 pLastSpatialParam = fDlp;126 pLastSpatialParam = fDlp;
@@ -142,19 +142,19 @@ int32_t ParamValidationExt (void* pParam) { · 15 unmodified lines
142 if (NULL == pCodingParam)142 if (NULL == pCodingParam)
143 return 1;143 return 1;
144 144
145 if (pCodingParam->iNumDependencyLayer < 1 || pCodingParam->iNumDependencyLayer > MAX_DEPENDENCY_LAYER) {145 if (pCodingParam->iSpatialLayerNum < 1 || pCodingParam->iSpatialLayerNum > MAX_DEPENDENCY_LAYER) {
146#if defined (_DEBUG)146#if defined (_DEBUG)
147 fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iNumDependencyLayer: %d!\n",147 fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iSpatialLayerNum: %d!\n",
148 pCodingParam->iNumDependencyLayer);148 pCodingParam->iSpatialLayerNum);
149#endif//#if _DEBUG149#endif//#if _DEBUG
150 150
151 return 1;151 return 1;
152 }152 }
153 153
154 if (pCodingParam->iNumTemporalLayer < 1 || pCodingParam->iNumTemporalLayer > MAX_TEMPORAL_LEVEL) {154 if (pCodingParam->iTemporalLayerNum < 1 || pCodingParam->iTemporalLayerNum > MAX_TEMPORAL_LEVEL) {
155#if defined (_DEBUG)155#if defined (_DEBUG)
156 fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iNumTemporalLayer: %d!\n",156 fprintf (stderr, "ParamValidationExt(), monitor invalid pCodingParam->iTemporalLayerNum: %d!\n",
157 pCodingParam->iNumTemporalLayer);157 pCodingParam->iTemporalLayerNum);
158#endif//#if _DEBUG158#endif//#if _DEBUG
159 return 1;159 return 1;
160 }160 }
@@ -201,7 +201,7 @@ int32_t ParamValidationExt (void* pParam) { · 40 unmodified lines
201 pCodingParam->bDeblockingParallelFlag = false;201 pCodingParam->bDeblockingParallelFlag = false;
202#endif//MT_ENABLED202#endif//MT_ENABLED
203 203
204 for (i = 0; i < pCodingParam->iNumDependencyLayer; ++ i) {204 for (i = 0; i < pCodingParam->iSpatialLayerNum; ++ i) {
205 SDLayerParam* fDlp = &pCodingParam->sDependencyLayers[i];205 SDLayerParam* fDlp = &pCodingParam->sDependencyLayers[i];
206 const int32_t kiPicWidth = fDlp->iFrameWidth;206 const int32_t kiPicWidth = fDlp->iFrameWidth;
207 const int32_t kiPicHeight = fDlp->iFrameHeight;207 const int32_t kiPicHeight = fDlp->iFrameHeight;
@@ -224,9 +224,9 @@ int32_t ParamValidationExt (void* pParam) { · 16 unmodified lines
224 return 1;224 return 1;
225 }225 }
226 226
227 if (fDlp->sMso.uiSliceMode >= SM_RESERVED) {227 if (fDlp->sSliceCfg.uiSliceMode >= SM_RESERVED) {
228#if defined (_DEBUG)228#if defined (_DEBUG)
229 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", fDlp->sMso.uiSliceMode);229 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n", fDlp->sSliceCfg.uiSliceMode);
230#endif//#if _DEBUG230#endif//#if _DEBUG
231 return 1;231 return 1;
232 }232 }
@@ -234,102 +234,102 @@ int32_t ParamValidationExt (void* pParam) { · 1 unmodified line
234 //check pSlice settings under multi-pSlice234 //check pSlice settings under multi-pSlice
235 if (kiPicWidth <= 16 && kiPicHeight <= 16) {235 if (kiPicWidth <= 16 && kiPicHeight <= 16) {
236 //only have one MB, set to single_slice236 //only have one MB, set to single_slice
237 fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE;237 fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
238 }238 }
239 switch (fDlp->sMso.uiSliceMode) {239 switch (fDlp->sSliceCfg.uiSliceMode) {
240 case SM_SINGLE_SLICE:240 case SM_SINGLE_SLICE:
241 fDlp->sMso.sSliceArgument.iSliceNum = 1;241 fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
242 fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0;242 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
243 fDlp->sMso.sSliceArgument.iSliceNum = 0;243 fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 0;
244 for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {244 for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {
245 fDlp->sMso.sSliceArgument.uiSliceMbNum[iIdx] = 0;245 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0;
246 }246 }
247 break;247 break;
248 case SM_FIXEDSLCNUM_SLICE: {248 case SM_FIXEDSLCNUM_SLICE: {
249 fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0;249 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
250 250
251 iMbWidth = (kiPicWidth + 15) >> 4;251 iMbWidth = (kiPicWidth + 15) >> 4;
252 iMbHeight = (kiPicHeight + 15) >> 4;252 iMbHeight = (kiPicHeight + 15) >> 4;
253 iMbNumInFrame = iMbWidth * iMbHeight;253 iMbNumInFrame = iMbWidth * iMbHeight;
254 iMaxSliceNum = MAX_SLICES_NUM;254 iMaxSliceNum = MAX_SLICES_NUM;
255 if (fDlp->sMso.sSliceArgument.iSliceNum <= 0255 if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0
256 || fDlp->sMso.sSliceArgument.iSliceNum > iMaxSliceNum) {256 || fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) {
257#if defined (_DEBUG)257#if defined (_DEBUG)
258 fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sMso.sSliceArgument.iSliceNum);258 fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sSliceCfg.sSliceArgument.uiSliceNum);
259#endif//#if _DEBUG259#endif//#if _DEBUG
260 return 1;260 return 1;
261 }261 }
262 if (fDlp->sMso.sSliceArgument.iSliceNum == 1) {262 if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) {
263#if defined (_DEBUG)263#if defined (_DEBUG)
264 fprintf (stderr,264 fprintf (stderr,
265 "ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!\n",265 "ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!\n",
266 fDlp->sMso.sSliceArgument.iSliceNum);266 fDlp->sSliceCfg.sSliceArgument.uiSliceNum);
267#endif//#if _DEBUG267#endif//#if _DEBUG
268 fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE;268 fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
269 break;269 break;
270 }270 }
271 if (pCodingParam->bEnableRc) { // multiple slices verify with gom271 if (pCodingParam->bEnableRc) { // multiple slices verify with gom
272 //check uiSliceNum272 //check uiSliceNum
273 GomValidCheckSliceNum (iMbWidth, iMbHeight, (int32_t*)&fDlp->sMso.sSliceArgument.iSliceNum);273 GomValidCheckSliceNum (iMbWidth, iMbHeight, (int32_t*)&fDlp->sSliceCfg.sSliceArgument.uiSliceNum);
274 assert (fDlp->sMso.sSliceArgument.iSliceNum > 1);274 assert (fDlp->sSliceCfg.sSliceArgument.uiSliceNum > 1);
275 //set uiSliceMbNum with current uiSliceNum275 //set uiSliceMbNum with current uiSliceNum
276 GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &fDlp->sMso.sSliceArgument);276 GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &fDlp->sSliceCfg.sSliceArgument);
277 } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame,277 } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame,
278 &fDlp->sMso.sSliceArgument)) { // verify interleave mode settings278 &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
279 //check uiSliceMbNum with current uiSliceNum279 //check uiSliceMbNum with current uiSliceNum
280#if defined (_DEBUG)280#if defined (_DEBUG)
281 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",281 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",
282 fDlp->sMso.sSliceArgument.uiSliceMbNum[0]);282 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
283#endif//#if _DEBUG283#endif//#if _DEBUG
284 return 1;284 return 1;
285 }285 }
286 // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting286 // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
287 if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {287 if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
288 fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE;288 fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
289 fDlp->sMso.sSliceArgument.iSliceNum = 1;289 fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
290 break;290 break;
291 }291 }
292 }292 }
293 break;293 break;
294 case SM_RASTER_SLICE: {294 case SM_RASTER_SLICE: {
295 fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0;295 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
296 296
297 iMbWidth = (kiPicWidth + 15) >> 4;297 iMbWidth = (kiPicWidth + 15) >> 4;
298 iMbHeight = (kiPicHeight + 15) >> 4;298 iMbHeight = (kiPicHeight + 15) >> 4;
299 iMbNumInFrame = iMbWidth * iMbHeight;299 iMbNumInFrame = iMbWidth * iMbHeight;
300 iMaxSliceNum = MAX_SLICES_NUM;300 iMaxSliceNum = MAX_SLICES_NUM;
301 if (fDlp->sMso.sSliceArgument.uiSliceMbNum[0] <= 0) {301 if (fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0] <= 0) {
302#if defined (_DEBUG)302#if defined (_DEBUG)
303 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",303 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",
304 fDlp->sMso.sSliceArgument.uiSliceMbNum[0]);304 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
305#endif//#if _DEBUG305#endif//#if _DEBUG
306 return 1;306 return 1;
307 }307 }
308 308
309 if (!CheckRasterMultiSliceSetting (iMbNumInFrame, &fDlp->sMso.sSliceArgument)) { // verify interleave mode settings309 if (!CheckRasterMultiSliceSetting (iMbNumInFrame, &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
310#if defined (_DEBUG)310#if defined (_DEBUG)
311 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",311 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",
312 fDlp->sMso.sSliceArgument.uiSliceMbNum[0]);312 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
313#endif//#if _DEBUG313#endif//#if _DEBUG
314 return 1;314 return 1;
315 }315 }
316 if (fDlp->sMso.sSliceArgument.iSliceNum <= 0316 if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0
317 || fDlp->sMso.sSliceArgument.iSliceNum > iMaxSliceNum) { // verify interleave mode settings317 || fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings
318#if defined (_DEBUG)318#if defined (_DEBUG)
319 fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n",319 fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!\n",
320 fDlp->sMso.sSliceArgument.iSliceNum);320 fDlp->sSliceCfg.sSliceArgument.uiSliceNum);
321#endif//#if _DEBUG321#endif//#if _DEBUG
322 return 1;322 return 1;
323 }323 }
324 if (fDlp->sMso.sSliceArgument.iSliceNum == 1) {324 if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) {
325#if defined (_DEBUG)325#if defined (_DEBUG)
326 fprintf (stderr, "ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!\n");326 fprintf (stderr, "ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!\n");
327#endif//#if _DEBUG327#endif//#if _DEBUG
328 fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE;328 fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
329 break;329 break;
330 }330 }
331#ifdef MT_ENABLED331#ifdef MT_ENABLED
332 if (pCodingParam->bEnableRc && fDlp->sMso.sSliceArgument.iSliceNum > 1) {332 if (pCodingParam->bEnableRc && fDlp->sSliceCfg.sSliceArgument.uiSliceNum > 1) {
333#if defined (_DEBUG)333#if defined (_DEBUG)
334 fprintf (stderr, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n");334 fprintf (stderr, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!\n");
335#endif//#if _DEBUG335#endif//#if _DEBUG
@@ -337,14 +337,14 @@ int32_t ParamValidationExt (void* pParam) { · 1 unmodified line
337#endif337#endif
338 // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting338 // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
339 if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {339 if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
340 fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE;340 fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
341 fDlp->sMso.sSliceArgument.iSliceNum = 1;341 fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
342 break;342 break;
343 }343 }
344 }344 }
345 break;345 break;
346 case SM_ROWMB_SLICE: {346 case SM_ROWMB_SLICE: {
347 fDlp->sMso.sSliceArgument.uiSliceSizeConstraint = 0;347 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
348 348
349 iMbWidth = (kiPicWidth + 15) >> 4;349 iMbWidth = (kiPicWidth + 15) >> 4;
350 iMbHeight = (kiPicHeight + 15) >> 4;350 iMbHeight = (kiPicHeight + 15) >> 4;
@@ -355,18 +355,18 @@ int32_t ParamValidationExt (void* pParam) { · 4 unmodified lines
355#endif//#if _DEBUG355#endif//#if _DEBUG
356 return 1;356 return 1;
357 }357 }
358 fDlp->sMso.sSliceArgument.iSliceNum = iMbHeight;358 fDlp->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight;
359 359
360 if (fDlp->sMso.sSliceArgument.iSliceNum <= 0) {360 if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0) {
361#if defined (_DEBUG)361#if defined (_DEBUG)
362 fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sMso.sSliceArgument.iSliceNum);362 fprintf (stderr, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sSliceCfg.sSliceArgument.uiSliceNum);
363#endif//#if _DEBUG363#endif//#if _DEBUG
364 return 1;364 return 1;
365 }365 }
366 if (!CheckRowMbMultiSliceSetting (iMbWidth, &fDlp->sMso.sSliceArgument)) { // verify interleave mode settings366 if (!CheckRowMbMultiSliceSetting (iMbWidth, &fDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
367#if defined (_DEBUG)367#if defined (_DEBUG)
368 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",368 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!\n",
369 fDlp->sMso.sSliceArgument.uiSliceMbNum[0]);369 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
370#endif//#if _DEBUG370#endif//#if _DEBUG
371 return 1;371 return 1;
372 }372 }
@@ -375,17 +375,17 @@ int32_t ParamValidationExt (void* pParam) { · 2 unmodified lines
375 case SM_DYN_SLICE: {375 case SM_DYN_SLICE: {
376 iMbWidth = (kiPicWidth + 15) >> 4;376 iMbWidth = (kiPicWidth + 15) >> 4;
377 iMbHeight = (kiPicHeight + 15) >> 4;377 iMbHeight = (kiPicHeight + 15) >> 4;
378 if (fDlp->sMso.sSliceArgument.uiSliceSizeConstraint <= 0) {378 if (fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint <= 0) {
379#if defined (_DEBUG)379#if defined (_DEBUG)
380 fprintf (stderr, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n",380 fprintf (stderr, "ParamValidationExt(), invalid iSliceSize (%d) settings!\n",
381 fDlp->sMso.sSliceArgument.uiSliceSizeConstraint);381 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint);
382#endif//#if _DEBUG382#endif//#if _DEBUG
383 return 1;383 return 1;
384 }384 }
385 // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting385 // considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
386 if (iMbWidth * iMbHeight <= MIN_NUM_MB_PER_SLICE) {386 if (iMbWidth * iMbHeight <= MIN_NUM_MB_PER_SLICE) {
387 fDlp->sMso.uiSliceMode = SM_SINGLE_SLICE;387 fDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
388 fDlp->sMso.sSliceArgument.iSliceNum = 1;388 fDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
389 break;389 break;
390 }390 }
391 }391 }
@@ -394,7 +394,7 @@ int32_t ParamValidationExt (void* pParam) { · 2 unmodified lines
394 394
395#if defined (_DEBUG)395#if defined (_DEBUG)
396 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n",396 fprintf (stderr, "ParamValidationExt(), invalid uiSliceMode (%d) settings!\n",
397 pCodingParam->sDependencyLayers[0].sMso.uiSliceMode);397 pCodingParam->sDependencyLayers[0].sSliceCfg.uiSliceMode);
398#endif//#if _DEBUG398#endif//#if _DEBUG
399 return 1;399 return 1;
400 400
@@ -411,7 +411,7 @@ void WelsEncoderApplyFrameRate(SWelsSvcCodingParam* pParam) · 10 unmodified lines
411{411{
412 SDLayerParam* pLayerParam;412 SDLayerParam* pLayerParam;
413 const float kfEpsn = 0.000001f;413 const float kfEpsn = 0.000001f;
414 const int32_t kiNumLayer = pParam->iNumDependencyLayer;414 const int32_t kiNumLayer = pParam->iSpatialLayerNum;
415 int32_t i;415 int32_t i;
416 const float kfMaxFrameRate = pParam->fMaxFrameRate;416 const float kfMaxFrameRate = pParam->fMaxFrameRate;
417 float fRatio;417 float fRatio;
@@ -439,7 +439,7 @@ void WelsEncoderApplyBitRate(SWelsSvcCodingParam* pParam) · 21 unmodified lines
439 //but it is also possible to fulfill the bitrate of lower layer first439 //but it is also possible to fulfill the bitrate of lower layer first
440 440
441 SDLayerParam* pLayerParam;441 SDLayerParam* pLayerParam;
442 const int32_t iNumLayers = pParam->iNumDependencyLayer;442 const int32_t iNumLayers = pParam->iSpatialLayerNum;
443 int32_t i, iOrigTotalBitrate=0;443 int32_t i, iOrigTotalBitrate=0;
444 //read old BR444 //read old BR
445 for (i=0;i<iNumLayers;i++) {445 for (i=0;i<iNumLayers;i++) {
@@ -474,7 +474,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 28 unmodified lines
474 if (NULL == pParam || NULL == ppCtx || NULL == *ppCtx)474 if (NULL == pParam || NULL == ppCtx || NULL == *ppCtx)
475 return 1;475 return 1;
476 476
477 iNumDependencyLayers = pParam->iNumDependencyLayer;477 iNumDependencyLayers = pParam->iSpatialLayerNum;
478 478
479 do {479 do {
480 SDLayerParam* pDLayer = &pParam->sDependencyLayers[iDIndex];480 SDLayerParam* pDLayer = &pParam->sDependencyLayers[iDIndex];
@@ -485,7 +485,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 4 unmodified lines
485 //Review this part and suggest no change, since the memory over-use485 //Review this part and suggest no change, since the memory over-use
486 //(1) counts little to the overall performance486 //(1) counts little to the overall performance
487 //(2) should not be critial even under mobile case487 //(2) should not be critial even under mobile case
488 if (SM_DYN_SLICE == pDLayer->sMso.uiSliceMode) {488 if (SM_DYN_SLICE == pDLayer->sSliceCfg.uiSliceMode) {
489 iCountNumNals += MAX_SLICES_NUM;489 iCountNumNals += MAX_SLICES_NUM;
490 // plus prefix NALs490 // plus prefix NALs
491 if (iDIndex == 0)491 if (iDIndex == 0)
@@ -497,10 +497,10 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 5 unmodified lines
497#else//!MT_ENABLED || !PACKING_ONE_SLICE_PER_LAYER497#else//!MT_ENABLED || !PACKING_ONE_SLICE_PER_LAYER
498 assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER);498 assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER);
499#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER499#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER
500 } else { /*if ( SM_SINGLE_SLICE != pDLayer->sMso.uiSliceMode )*/500 } else { /*if ( SM_SINGLE_SLICE != pDLayer->sSliceCfg.uiSliceMode )*/
501 const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iFrameWidth + 0x0f) >> 4,501 const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iFrameWidth + 0x0f) >> 4,
502 (pDLayer->iFrameHeight + 0x0f) >> 4,502 (pDLayer->iFrameHeight + 0x0f) >> 4,
503 &pDLayer->sMso);503 &pDLayer->sSliceCfg);
504 504
505 // NEED check iCountNals value in case multiple slices is used505 // NEED check iCountNals value in case multiple slices is used
506 iCountNumNals += kiNumOfSlice; // for pSlice VCL NALs506 iCountNumNals += kiNumOfSlice; // for pSlice VCL NALs
@@ -575,7 +575,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 68 unmodified lines
575 */575 */
576int32_t AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam) {576int32_t AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam) {
577 CMemoryAlign* pMa = pCtx->pMemAlign;577 CMemoryAlign* pMa = pCtx->pMemAlign;
578 const int32_t kiDlayerCount = pParam->iNumDependencyLayer;578 const int32_t kiDlayerCount = pParam->iSpatialLayerNum;
579 int32_t iDlayerIndex = 0;579 int32_t iDlayerIndex = 0;
580 580
581 // spatial pictures581 // spatial pictures
@@ -605,7 +605,7 @@ int32_t AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam) { · 23 unmodified lines
605void FreeSpatialPictures (sWelsEncCtx* pCtx) {605void FreeSpatialPictures (sWelsEncCtx* pCtx) {
606 CMemoryAlign* pMa = pCtx->pMemAlign;606 CMemoryAlign* pMa = pCtx->pMemAlign;
607 int32_t j = 0;607 int32_t j = 0;
608 while (j < pCtx->pSvcParam->iNumDependencyLayer) {608 while (j < pCtx->pSvcParam->iSpatialLayerNum) {
609 uint8_t i = 0;609 uint8_t i = 0;
610 uint8_t uiRefNumInTemporal = pCtx->uiSpatialPicNum[j];610 uint8_t uiRefNumInTemporal = pCtx->uiSpatialPicNum[j];
611 611
@@ -695,7 +695,7 @@ static void InitMbInfo (sWelsEncCtx* pEnc, SMB* pList, SDqLayer* pLayer, con · 83 unmodified lines
695 695
696 696
697int32_t InitMbListD (sWelsEncCtx** ppCtx) {697int32_t InitMbListD (sWelsEncCtx** ppCtx) {
698 int32_t iNumDlayer = (*ppCtx)->pSvcParam->iNumDependencyLayer;698 int32_t iNumDlayer = (*ppCtx)->pSvcParam->iSpatialLayerNum;
699 int32_t iMbSize[MAX_DEPENDENCY_LAYER] = { 0 };699 int32_t iMbSize[MAX_DEPENDENCY_LAYER] = { 0 };
700 int32_t iOverallMbNum = 0;700 int32_t iOverallMbNum = 0;
701 int32_t iMbWidth = 0;701 int32_t iMbWidth = 0;
@@ -811,7 +811,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 109 unmodified lines
811 811
812 pMa = (*ppCtx)->pMemAlign;812 pMa = (*ppCtx)->pMemAlign;
813 pParam = (*ppCtx)->pSvcParam;813 pParam = (*ppCtx)->pSvcParam;
814 iDlayerCount = pParam->iNumDependencyLayer;814 iDlayerCount = pParam->iSpatialLayerNum;
815 iNumRef = pParam->iNumRefFrame;815 iNumRef = pParam->iNumRefFrame;
816// highest_layers_in_temporal = 1 + WELS_MAX(pParam->iDecompStages, 1);816// highest_layers_in_temporal = 1 + WELS_MAX(pParam->iDecompStages, 1);
817 pStrideTab = (*ppCtx)->pStrideTab;817 pStrideTab = (*ppCtx)->pStrideTab;
@@ -859,7 +859,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 41 unmodified lines
859 const int32_t kiMbW = (pDlayer->iFrameWidth + 0x0f) >> 4;859 const int32_t kiMbW = (pDlayer->iFrameWidth + 0x0f) >> 4;
860 const int32_t kiMbH = (pDlayer->iFrameHeight + 0x0f) >> 4;860 const int32_t kiMbH = (pDlayer->iFrameHeight + 0x0f) >> 4;
861 int32_t iMaxSliceNum = 1;861 int32_t iMaxSliceNum = 1;
862 const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sMso);862 const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceCfg);
863 if (iMaxSliceNum < kiSliceNum)863 if (iMaxSliceNum < kiSliceNum)
864 iMaxSliceNum = kiSliceNum;864 iMaxSliceNum = kiSliceNum;
865 865
@@ -868,7 +868,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 2 unmodified lines
868 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer), FreeMemorySvc (ppCtx))868 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer), FreeMemorySvc (ppCtx))
869 869
870 // for dynamic slicing mode870 // for dynamic slicing mode
871 if (SM_DYN_SLICE == pDlayer->sMso.uiSliceMode) {871 if (SM_DYN_SLICE == pDlayer->sSliceCfg.uiSliceMode) {
872 const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t);872 const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t);
873 873
874 pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition");874 pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition");
@@ -885,7 +885,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 10 unmodified lines
885 pDqLayer->iMbWidth = kiMbW;885 pDqLayer->iMbWidth = kiMbW;
886 pDqLayer->iMbHeight = kiMbH;886 pDqLayer->iMbHeight = kiMbH;
887#ifndef MT_ENABLED887#ifndef MT_ENABLED
888 if (SM_DYN_SLICE == pDlayer->sMso.uiSliceMode) { //wmalloc pSliceInLayer888 if (SM_DYN_SLICE == pDlayer->sSliceCfg.uiSliceMode) { //wmalloc pSliceInLayer
889 SSlice* pSlice = NULL;889 SSlice* pSlice = NULL;
890 int32_t iSliceIdx = 0;890 int32_t iSliceIdx = 0;
891 //wmalloc AVERSLICENUM_CONSTANT of pDqLayer->sLayerInfo.pSliceInLayer,891 //wmalloc AVERSLICENUM_CONSTANT of pDqLayer->sLayerInfo.pSliceInLayer,
@@ -958,7 +958,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 66 unmodified lines
958 pDqLayer->bDeblockingParallelFlag = pParam->bDeblockingParallelFlag;958 pDqLayer->bDeblockingParallelFlag = pParam->bDeblockingParallelFlag;
959 959
960 //deblocking parameter adjustment960 //deblocking parameter adjustment
961 if (SM_SINGLE_SLICE == pDlayer->sMso.uiSliceMode) {961 if (SM_SINGLE_SLICE == pDlayer->sSliceCfg.uiSliceMode) {
962 //iLoopFilterDisableIdc: will be 0 or 1 under single_slice962 //iLoopFilterDisableIdc: will be 0 or 1 under single_slice
963 if (2 == pParam->iLoopFilterDisableIdc) {963 if (2 == pParam->iLoopFilterDisableIdc) {
964 pDqLayer->iLoopFilterDisableIdc = 0;964 pDqLayer->iLoopFilterDisableIdc = 0;
@@ -1037,7 +1037,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 72 unmodified lines
1037 false,1037 false,
1038 pSps->iMbWidth,1038 pSps->iMbWidth,
1039 pSps->iMbHeight,1039 pSps->iMbHeight,
1040 & (pDlayerParam->sMso),1040 & (pDlayerParam->sSliceCfg),
1041 pPps);1041 pPps);
1042 if (iResult) {1042 if (iResult) {
1043 WelsLog (*ppCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult);1043 WelsLog (*ppCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult);
@@ -1099,7 +1099,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 55 unmodified lines
1099 return 1;1099 return 1;
1100 (*ppCtx)->pStrideTab = pPtr;1100 (*ppCtx)->pStrideTab = pPtr;
1101 1101
1102 iCntTid = pParam->iNumTemporalLayer > 1 ? 2 : 1;1102 iCntTid = pParam->iTemporalLayerNum > 1 ? 2 : 1;
1103 1103
1104 iSpatialIdx = 0;1104 iSpatialIdx = 0;
1105 while (iSpatialIdx < kiNumSpatialLayers) {1105 while (iSpatialIdx < kiNumSpatialLayers) {
@@ -1335,7 +1335,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 229 unmodified lines
1335 int32_t iCountLayers = 0;1335 int32_t iCountLayers = 0;
1336 int32_t iResult = 0;1336 int32_t iResult = 0;
1337 float fCompressRatioThr = .5f;1337 float fCompressRatioThr = .5f;
1338 const int32_t kiNumDependencyLayers = pParam->iNumDependencyLayer;1338 const int32_t kiNumDependencyLayers = pParam->iSpatialLayerNum;
1339 const uint32_t kuiMvdInterTableSize = (kiNumDependencyLayers == 1 ? (1 + (648 << 1)) : (1 + (972 << 1)));1339 const uint32_t kuiMvdInterTableSize = (kiNumDependencyLayers == 1 ? (1 + (648 << 1)) : (1 + (972 << 1)));
1340 const uint32_t kuiMvdCacheAlginedSize = kuiMvdInterTableSize * sizeof (uint16_t);1340 const uint32_t kuiMvdCacheAlginedSize = kuiMvdInterTableSize * sizeof (uint16_t);
1341 int32_t iVclLayersBsSizeCount = 0;1341 int32_t iVclLayersBsSizeCount = 0;
@@ -1371,12 +1371,12 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 29 unmodified lines
1371 return 1;1371 return 1;
1372 }1372 }
1373 1373
1374 iNonVclLayersBsSizeCount = SSEI_BUFFER_SIZE + pParam->iNumDependencyLayer * SPS_BUFFER_SIZE +1374 iNonVclLayersBsSizeCount = SSEI_BUFFER_SIZE + pParam->iSpatialLayerNum * SPS_BUFFER_SIZE +
1375 (1 + pParam->iNumDependencyLayer) * PPS_BUFFER_SIZE;1375 (1 + pParam->iSpatialLayerNum) * PPS_BUFFER_SIZE;
1376 1376
1377 int32_t iLayerBsSize = 0;1377 int32_t iLayerBsSize = 0;
1378 iIndex = 0;1378 iIndex = 0;
1379 while (iIndex < pParam->iNumDependencyLayer) {1379 while (iIndex < pParam->iSpatialLayerNum) {
1380 SDLayerParam* fDlp = &pParam->sDependencyLayers[iIndex];1380 SDLayerParam* fDlp = &pParam->sDependencyLayers[iIndex];
1381 1381
1382 fCompressRatioThr = COMPRESS_RATIO_DECIDED_BY_RESOLUTION (fDlp->iFrameWidth, fDlp->iFrameHeight);1382 fCompressRatioThr = COMPRESS_RATIO_DECIDED_BY_RESOLUTION (fDlp->iFrameWidth, fDlp->iFrameHeight);
@@ -1664,16 +1664,17 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 281 unmodified lines
1664 // pDq layers list1664 // pDq layers list
1665 ilayer = 0;1665 ilayer = 0;
1666 if (NULL != pCtx->ppDqLayerList && pParam != NULL) {1666 if (NULL != pCtx->ppDqLayerList && pParam != NULL) {
1667 while (ilayer < pParam->iNumDependencyLayer) {1667 while (ilayer < pParam->iSpatialLayerNum) {
1668 SDqLayer* pDq = pCtx->ppDqLayerList[ilayer];1668 SDqLayer* pDq = pCtx->ppDqLayerList[ilayer];
1669 SDLayerParam* pDlp = &pCtx->pSvcParam->sDependencyLayers[ilayer];1669 SDLayerParam* pDlp = &pCtx->pSvcParam->sDependencyLayers[ilayer];
1670 const bool kbIsDynamicSlicing = (SM_DYN_SLICE == pDlp->sMso.uiSliceMode);1670
1671 const bool kbIsDynamicSlicing = (SM_DYN_SLICE == pDlp->sSliceCfg.uiSliceMode);
1671 1672
1672 // pDq layers1673 // pDq layers
1673 if (NULL != pDq) {1674 if (NULL != pDq) {
1674 if (NULL != pDq->sLayerInfo.pSliceInLayer) {1675 if (NULL != pDq->sLayerInfo.pSliceInLayer) {
1675 int32_t iSliceIdx = 0;1676 int32_t iSliceIdx = 0;
1676 int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sMso);1677 int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sSliceCfg);
1677 if (iSliceNum < 1)1678 if (iSliceNum < 1)
1678 iSliceNum = 1;1679 iSliceNum = 1;
1679 while (iSliceIdx < iSliceNum) {1680 while (iSliceIdx < iSliceNum) {
@@ -1707,7 +1708,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 27 unmodified lines
1707 // reference picture list extension1708 // reference picture list extension
1708 if (NULL != pCtx->ppRefPicListExt && pParam != NULL) {1709 if (NULL != pCtx->ppRefPicListExt && pParam != NULL) {
1709 ilayer = 0;1710 ilayer = 0;
1710 while (ilayer < pParam->iNumDependencyLayer) {1711 while (ilayer < pParam->iSpatialLayerNum) {
1711 SRefList* pRefList = pCtx->ppRefPicListExt[ilayer];1712 SRefList* pRefList = pCtx->ppRefPicListExt[ilayer];
1712 if (NULL != pRefList) {1713 if (NULL != pRefList) {
1713 int32_t iRef = 0;1714 int32_t iRef = 0;
@@ -1731,7 +1732,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 17 unmodified lines
1731 // pSlice context list1732 // pSlice context list
1732 if (NULL != pCtx->pSliceCtxList && pParam != NULL) {1733 if (NULL != pCtx->pSliceCtxList && pParam != NULL) {
1733 ilayer = 0;1734 ilayer = 0;
1734 while (ilayer < pParam->iNumDependencyLayer) {1735 while (ilayer < pParam->iSpatialLayerNum) {
1735 SSliceCtx* pSliceCtx = &pCtx->pSliceCtxList[ilayer];1736 SSliceCtx* pSliceCtx = &pCtx->pSliceCtxList[ilayer];
1736 if (NULL != pSliceCtx)1737 if (NULL != pSliceCtx)
1737 UninitSlicePEncCtx (pSliceCtx, pMa);1738 UninitSlicePEncCtx (pSliceCtx, pMa);
@@ -1817,12 +1818,12 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 79 unmodified lines
1817}1818}
1818 1819
1819int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCpuCores, int16_t* pMaxSliceCount) {1820int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCpuCores, int16_t* pMaxSliceCount) {
1820 int32_t iSpatialIdx = 0, iSpatialNum = pCodingParam->iNumDependencyLayer;1821 int32_t iSpatialIdx = 0, iSpatialNum = pCodingParam->iSpatialLayerNum;
1821 int16_t iMaxSliceCount = 0;1822 int16_t iMaxSliceCount = 0;
1822 1823
1823 do {1824 do {
1824 SDLayerParam* pDlp = &pCodingParam->sDependencyLayers[iSpatialIdx];1825 SDLayerParam* pDlp = &pCodingParam->sDependencyLayers[iSpatialIdx];
1825 SMulSliceOption* pMso = &pDlp->sMso;1826 SSliceConfig* pMso = &pDlp->sSliceCfg;
1826 SSliceArgument* pSlcArg = &pMso->sSliceArgument;1827 SSliceArgument* pSlcArg = &pMso->sSliceArgument;
1827 const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4;1828 const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4;
1828 const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4;1829 const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4;
@@ -1831,7 +1832,7 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 2 unmodified lines
1831#if defined(DYNAMIC_SLICE_ASSIGN)1832#if defined(DYNAMIC_SLICE_ASSIGN)
1832 int32_t iSliceNum = (SM_FIXEDSLCNUM_SLICE == pMso->uiSliceMode1833 int32_t iSliceNum = (SM_FIXEDSLCNUM_SLICE == pMso->uiSliceMode
1833 || SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores :1834 || SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores :
1834 pSlcArg->iSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()1835 pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()
1835#else//!DYNAMIC_SLICE_ASSIGN1836#else//!DYNAMIC_SLICE_ASSIGN
1836 int32_t iSliceNum = (SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores :1837 int32_t iSliceNum = (SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores :
1837 pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()1838 pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()
@@ -1843,7 +1844,7 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 5 unmodified lines
1843 // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode,1844 // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode,
1844 // uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode,1845 // uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode,
1845 // uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future1846 // uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future
1846 pSlcArg->iSliceNum = iSliceNum; // used fixed one1847 pSlcArg->uiSliceNum = iSliceNum; // used fixed one
1847 1848
1848 switch (pMso->uiSliceMode) {1849 switch (pMso->uiSliceMode) {
1849 case SM_DYN_SLICE:1850 case SM_DYN_SLICE:
@@ -2093,7 +2094,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 243 unmodified lines
2093#endif//ENABLE_TRACE_FILE2094#endif//ENABLE_TRACE_FILE
2094 2095
2095 pCodingParam->DetermineTemporalSettings();2096 pCodingParam->DetermineTemporalSettings();
2096 iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign, pCodingParam->iNumDependencyLayer);2097 iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign, pCodingParam->iSpatialLayerNum);
2097 if (iRet != 0) {2098 if (iRet != 0) {
2098 FreeMemorySvc (&pCtx);2099 FreeMemorySvc (&pCtx);
2099 return iRet;2100 return iRet;
@@ -2151,7 +2152,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 51 unmodified lines
2151void StatOverallEncodingExt (sWelsEncCtx* pCtx) {2152void StatOverallEncodingExt (sWelsEncCtx* pCtx) {
2152 int8_t i = 0;2153 int8_t i = 0;
2153 int8_t j = 0;2154 int8_t j = 0;
2154 for (i = 0; i < pCtx->pSvcParam->iNumDependencyLayer; i++) {2155 for (i = 0; i < pCtx->pSvcParam->iSpatialLayerNum; i++) {
2155 fprintf (stdout, "\nDependency layer : %d\n", i);2156 fprintf (stdout, "\nDependency layer : %d\n", i);
2156 fprintf (stdout, "Quality layer : %d\n", j);2157 fprintf (stdout, "Quality layer : %d\n", j);
2157 {2158 {
@@ -2563,8 +2564,8 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 405 unmodified lines
2563 2564
2564 pCurDq->pDecPic = pDecPic;2565 pCurDq->pDecPic = pDecPic;
2565 2566
2566 if (fDlp->sMso.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update2567 if (fDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update
2567 iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sMso);2568 iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceCfg);
2568 else2569 else
2569 iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx);2570 iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx);
2570 assert (iSliceCount > 0);2571 assert (iSliceCount > 0);
@@ -2644,7 +2645,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 73 unmodified lines
2644 2645
2645 if (P_SLICE == pCtx->eSliceType) {2646 if (P_SLICE == pCtx->eSliceType) {
2646 if (kbBaseAvail) {2647 if (kbBaseAvail) {
2647 if (pCtx->pSvcParam->iNumDependencyLayer == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)) { //2648 if (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)) { //
2648 pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad;2649 pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad;
2649 pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode;2650 pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode;
2650 pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa;2651 pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa;
@@ -2667,7 +2668,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 16 unmodified lines
2667 pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;2668 pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;
2668 } else {2669 } else {
2669 //case 3: pBase layer MD + encoding2670 //case 3: pBase layer MD + encoding
2670 if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iNumDependencyLayer) {2671 if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iSpatialLayerNum) {
2671 pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad;2672 pCtx->pFuncList->pfMotionSearch = WelsMotionEstimateSearchSad;
2672 pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode;2673 pCtx->pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode;
2673 pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa;2674 pCtx->pFuncList->pfIntraFineMd = WelsMdIntraFinePartitionVaa;
@@ -2690,7 +2691,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 16 unmodified lines
2690 pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;2691 pCtx->pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;
2691 }2692 }
2692 } else if (I_SLICE == pCtx->eSliceType) {2693 } else if (I_SLICE == pCtx->eSliceType) {
2693 if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iNumDependencyLayer) {2694 if (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1 == pCtx->pSvcParam->iSpatialLayerNum) {
2694 pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSad;2695 pCtx->pFuncList->sSampleDealingFuncs.pfMdCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSad;
2695 pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 =2696 pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3 =
2696 pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad;2697 pCtx->pFuncList->sSampleDealingFuncs.pfIntra16x16Combined3Sad;
@@ -3199,12 +3200,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 502 unmodified lines
3199 3200
3200 // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed3201 // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
3201 3202
3202 switch (param_d->sMso.uiSliceMode) {3203 switch (param_d->sSliceCfg.uiSliceMode) {
3203 case SM_FIXEDSLCNUM_SLICE: {3204 case SM_FIXEDSLCNUM_SLICE: {
3204#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN)3205#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN)
3205 if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&3206 if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&
3206 (pSvcParam->sDependencyLayers[iCurDid].sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE3207 (pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
3207 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iCurDid].sMso.sSliceArgument.iSliceNum)3208 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.sSliceArgument.uiSliceNum)
3208 )3209 )
3209 AdjustEnhanceLayer (pCtx, iCurDid);3210 AdjustEnhanceLayer (pCtx, iCurDid);
3210#endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN3211#endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN
@@ -3235,7 +3236,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 24 unmodified lines
3235 bAvcBased = (iCurDid == BASE_DEPENDENCY_ID);3236 bAvcBased = (iCurDid == BASE_DEPENDENCY_ID);
3236 pCtx->bNeedPrefixNalFlag = (bAvcBased &&3237 pCtx->bNeedPrefixNalFlag = (bAvcBased &&
3237 (pSvcParam->bPrefixNalAddingCtrl ||3238 (pSvcParam->bPrefixNalAddingCtrl ||
3238 (pSvcParam->iNumDependencyLayer > 1)));3239 (pSvcParam->iSpatialLayerNum > 1)));
3239 3240
3240 if (eFrameType == WELS_FRAME_TYPE_P) {3241 if (eFrameType == WELS_FRAME_TYPE_P) {
3241 eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT;3242 eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT;
@@ -3281,7 +3282,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 39 unmodified lines
3281 PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()3282 PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()
3282 3283
3283 iLayerSize = 0;3284 iLayerSize = 0;
3284 if (SM_SINGLE_SLICE == param_d->sMso.uiSliceMode) { // only one slice within a sQualityStat layer3285 if (SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
3285 int32_t iSliceSize = 0;3286 int32_t iSliceSize = 0;
3286 3287
3287 if (pCtx->bNeedPrefixNalFlag) {3288 if (pCtx->bNeedPrefixNalFlag) {
@@ -3310,9 +3311,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 22 unmodified lines
3310 }3311 }
3311 // for dynamic slicing single threading..3312 // for dynamic slicing single threading..
3312#ifndef MT_ENABLED3313#ifndef MT_ENABLED
3313 else if (SM_DYN_SLICE == param_d->sMso.uiSliceMode)3314 else if (SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode)
3314#else // MT_ENABLED3315#else // MT_ENABLED
3315 else if ((SM_DYN_SLICE == param_d->sMso.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1))3316 else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1))
3316#endif//MT_ENABLED3317#endif//MT_ENABLED
3317 {3318 {
3318 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame;3319 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame;
@@ -3322,7 +3323,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 3 unmodified lines
3322#if defined(MT_ENABLED)3323#if defined(MT_ENABLED)
3323 int err = 0;3324 int err = 0;
3324 // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE3325 // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE
3325 if ((SM_DYN_SLICE != param_d->sMso.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {3326 if ((SM_DYN_SLICE != param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
3326 iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);3327 iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
3327 if (iLayerNum +3328 if (iLayerNum +
3328#if defined(PACKING_ONE_SLICE_PER_LAYER)3329#if defined(PACKING_ONE_SLICE_PER_LAYER)
@@ -3333,7 +3334,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 4 unmodified lines
3333 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed3334 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed
3334 WelsLog (pCtx, WELS_LOG_ERROR,3335 WelsLog (pCtx, WELS_LOG_ERROR,
3335 "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!",3336 "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!",
3336 iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, param_d->sMso.uiSliceMode, iSliceCount);3337 iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, param_d->sSliceCfg.uiSliceMode, iSliceCount);
3337 return -1;3338 return -1;
3338 }3339 }
3339 if (iSliceCount <= 1) {3340 if (iSliceCount <= 1) {
@@ -3363,7 +3364,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 23 unmodified lines
3363 if (err) {3364 if (err) {
3364 WelsLog (pCtx, WELS_LOG_ERROR,3365 WelsLog (pCtx, WELS_LOG_ERROR,
3365 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",3366 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",
3366 err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sMso.uiSliceMode, pSvcParam->iMultipleThreadIdc);3367 err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
3367 return -1;3368 return -1;
3368 }3369 }
3369 3370
@@ -3422,7 +3423,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 52 unmodified lines
3422 if (err) {3423 if (err) {
3423 WelsLog (pCtx, WELS_LOG_ERROR,3424 WelsLog (pCtx, WELS_LOG_ERROR,
3424 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",3425 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",
3425 err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sMso.uiSliceMode, pSvcParam->iMultipleThreadIdc);3426 err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
3426 return -1;3427 return -1;
3427 }3428 }
3428 3429
@@ -3499,7 +3500,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 70 unmodified lines
3499 }3500 }
3500 }3501 }
3501 // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE3502 // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE
3502 else if ((SM_DYN_SLICE == param_d->sMso.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {3503 else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
3503 const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;3504 const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
3504#if defined(PACKING_ONE_SLICE_PER_LAYER)3505#if defined(PACKING_ONE_SLICE_PER_LAYER)
3505 ResetCountBsSizeInPartitions (pCtx->pSliceThreading->pCountBsSizeInPartition, kiPartitionCnt);3506 ResetCountBsSizeInPartitions (pCtx->pSliceThreading->pCountBsSizeInPartition, kiPartitionCnt);
@@ -3514,7 +3515,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 8 unmodified lines
3514 if (err) {3515 if (err) {
3515 WelsLog (pCtx, WELS_LOG_ERROR,3516 WelsLog (pCtx, WELS_LOG_ERROR,
3516 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",3517 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",
3517 err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sMso.uiSliceMode, pSvcParam->iMultipleThreadIdc);3518 err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
3518 return -1;3519 return -1;
3519 }3520 }
3520 3521
@@ -3604,7 +3605,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 83 unmodified lines
3604 3605
3605#ifdef ENABLE_FRAME_DUMP3606#ifdef ENABLE_FRAME_DUMP
3606 // Dump reconstruction picture for each sQualityStat layer3607 // Dump reconstruction picture for each sQualityStat layer
3607 if (iCurDid + 1 < pSvcParam->iNumDependencyLayer)3608 if (iCurDid + 1 < pSvcParam->iSpatialLayerNum)
3608 DumpDependencyRec (fsnr, &param_d->sRecFileName[0], iCurDid);3609 DumpDependencyRec (fsnr, &param_d->sRecFileName[0], iCurDid);
3609#endif//ENABLE_FRAME_DUMP3610#endif//ENABLE_FRAME_DUMP
3610 3611
@@ -3686,7 +3687,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 75 unmodified lines
3686#endif//STAT_OUTPUT3687#endif//STAT_OUTPUT
3687 3688
3688#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)3689#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)
3689 if (pSvcParam->iMultipleThreadIdc <= 1 || SM_SINGLE_SLICE == param_d->sMso.uiSliceMode) // sigle thread actually used3690 if (pSvcParam->iMultipleThreadIdc <= 1 || SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) // sigle thread actually used
3690#else3691#else
3691 if (1)3692 if (1)
3692#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER3693#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER
@@ -3725,8 +3726,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 32 unmodified lines
3725 }3726 }
3726 3727
3727#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE)3728#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE)
3728 if (param_d->sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE && pSvcParam->iMultipleThreadIdc > 1 &&3729 if (param_d->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE && pSvcParam->iMultipleThreadIdc > 1 &&
3729 pSvcParam->iMultipleThreadIdc >= param_d->sMso.sSliceArgument.iSliceNum) {3730 pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) {
3730 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,3731 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,
3731 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);3732 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);
3732#if defined(MT_DEBUG)3733#if defined(MT_DEBUG)
@@ -3737,7 +3738,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 4 unmodified lines
3737 3738
3738 ++ iSpatialIdx;3739 ++ iSpatialIdx;
3739 3740
3740 if (iCurDid + 1 < pSvcParam->iNumDependencyLayer) {3741 if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) {
3741 WelsSwapDqLayers (pCtx);3742 WelsSwapDqLayers (pCtx);
3742 }3743 }
3743 3744
@@ -3777,17 +3778,17 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 33 unmodified lines
3777 3778
3778#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN)3779#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN)
3779 if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID3780 if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID
3780 && pSvcParam->sDependencyLayers[0].sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE3781 && pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
3781 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sMso.sSliceArgument.iSliceNum3782 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum
3782 && pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sMso.uiSliceMode == SM_FIXEDSLCNUM_SLICE3783 && pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
3783 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum -3784 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum -
3784 1]].sMso.sSliceArgument.iSliceNum) {3785 1]].sSliceCfg.sSliceArgument.uiSliceNum) {
3785 AdjustBaseLayer (pCtx);3786 AdjustBaseLayer (pCtx);
3786 }3787 }
3787#endif//DYNAMIC_SLICE_ASSIGN3788#endif//DYNAMIC_SLICE_ASSIGN
3788 3789
3789#ifdef ENABLE_FRAME_DUMP3790#ifdef ENABLE_FRAME_DUMP
3790 DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iNumDependencyLayer -3791 DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iSpatialLayerNum -
3791 1].sRecFileName[0]); // pDecPic: final reconstruction output3792 1].sRecFileName[0]); // pDecPic: final reconstruction output
3792#endif//ENABLE_FRAME_DUMP3793#endif//ENABLE_FRAME_DUMP
3793 3794
@@ -3823,18 +3824,18 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 29 unmodified lines
3823 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */3824 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */
3824 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */3825 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
3825 bNeedReset = (pOldParam == NULL) ||3826 bNeedReset = (pOldParam == NULL) ||
3826 (pOldParam->iNumTemporalLayer != pNewParam->iNumTemporalLayer) ||3827 (pOldParam->iTemporalLayerNum != pNewParam->iTemporalLayerNum) ||
3827 (pOldParam->uiGopSize != pNewParam->uiGopSize) ||3828 (pOldParam->uiGopSize != pNewParam->uiGopSize) ||
3828 (pOldParam->iNumDependencyLayer != pNewParam->iNumDependencyLayer) ||3829 (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||
3829 (pOldParam->iDecompStages != pNewParam->iDecompStages) ||3830 (pOldParam->iDecompStages != pNewParam->iDecompStages) ||
3830 (pOldParam->iActualPicWidth != pNewParam->iActualPicWidth3831 (pOldParam->iPicWidth != pNewParam->iPicWidth
3831 || pOldParam->iActualPicHeight != pNewParam->iActualPicHeight) ||3832 || pOldParam->iPicHeight != pNewParam->iPicHeight) ||
3832 (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth3833 (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth
3833 || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||3834 || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||
3834 (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference);3835 (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference);
3835 if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer3836 if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer
3836 iIndexD = 0;3837 iIndexD = 0;
3837 assert (pOldParam->iNumDependencyLayer == pNewParam->iNumDependencyLayer);3838 assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);
3838 do {3839 do {
3839 const SDLayerParam* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD];3840 const SDLayerParam* kpOldDlp = &pOldParam->sDependencyLayers[iIndexD];
3840 const SDLayerParam* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD];3841 const SDLayerParam* kpNewDlp = &pNewParam->sDependencyLayers[iIndexD];
@@ -3850,8 +3851,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 9 unmodified lines
3850 break;3851 break;
3851 }3852 }
3852 3853
3853 if (kpOldDlp->sMso.uiSliceMode != kpNewDlp->sMso.uiSliceMode ||3854 if (kpOldDlp->sSliceCfg.uiSliceMode != kpNewDlp->sSliceCfg.uiSliceMode ||
3854 kpOldDlp->sMso.sSliceArgument.iSliceNum != kpNewDlp->sMso.sSliceArgument.iSliceNum) {3855 kpOldDlp->sSliceCfg.sSliceArgument.uiSliceNum != kpNewDlp->sSliceCfg.sSliceArgument.uiSliceNum) {
3855 bNeedReset = true;3856 bNeedReset = true;
3856 break;3857 break;
3857 }3858 }
@@ -3874,7 +3875,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 16 unmodified lines
3874 }3875 }
3875 3876
3876 ++ iIndexD;3877 ++ iIndexD;
3877 } while (iIndexD < pOldParam->iNumDependencyLayer);3878 } while (iIndexD < pOldParam->iSpatialLayerNum);
3878 }3879 }
3879 3880
3880 if (bNeedReset) {3881 if (bNeedReset) {
@@ -3929,7 +3930,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 48 unmodified lines
3929 3930
3930 /* int32_t term reference control */3931 /* int32_t term reference control */
3931 pOldParam->bEnableLongTermReference = pNewParam->bEnableLongTermReference;3932 pOldParam->bEnableLongTermReference = pNewParam->bEnableLongTermReference;
3932 pOldParam->uiLtrMarkPeriod = pNewParam->uiLtrMarkPeriod;3933 pOldParam->iLtrMarkPeriod = pNewParam->iLtrMarkPeriod;
3933 3934
3934 // keep below values unchanged as before3935 // keep below values unchanged as before
3935 pOldParam->bEnableSSEI = pNewParam->bEnableSSEI;3936 pOldParam->bEnableSSEI = pNewParam->bEnableSSEI;
@@ -3977,7 +3978,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 41 unmodified lines
3977 sizeof (pOldDlp->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage3978 sizeof (pOldDlp->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage
3978 3979
3979 ++ iIndexD;3980 ++ iIndexD;
3980 } while (iIndexD < pOldParam->iNumDependencyLayer);3981 } while (iIndexD < pOldParam->iSpatialLayerNum);
3981 }3982 }
3982 3983
3983 /* Any else initialization/reset for rate control here? */3984 /* Any else initialization/reset for rate control here? */

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