| 346 | } |
| 347 | |
| 348 | void WelsSliceHeaderExtWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSlice, |
| 349 | IWelsParametersetStrategy* pParametersetStrategy) { |
| 350 | SWelsSPS* pSps = pCurLayer->sLayerInfo.pSpsP; |
| 351 | SWelsPPS* pPps = pCurLayer->sLayerInfo.pPpsP; |
| 352 | SSubsetSps* pSubSps = pCurLayer->sLayerInfo.pSubsetSpsP; |
| 353 | SSliceHeaderExt* pSliceHeadExt = &pSlice->sSliceHeaderExt; |
| 354 | SSliceHeader* pSliceHeader = &pSliceHeadExt->sSliceHeader; |
| 355 | SNalUnitHeaderExt* pNalHead = &pCurLayer->sLayerInfo.sNalHeaderExt; |
| 356 | |
| 357 | BsWriteUE (pBs, pSliceHeader->iFirstMbInSlice); |
| 358 | BsWriteUE (pBs, pSliceHeader->eSliceType); /* same type things */ |
| 359 | |
| 360 | BsWriteUE (pBs, pSliceHeader->pPps->iPpsId + |
| 361 | pParametersetStrategy->GetPpsIdOffset (pSliceHeader->pPps->iPpsId)); |
| 362 | |
| 363 | BsWriteBits (pBs, pSps->uiLog2MaxFrameNum, pSliceHeader->iFrameNum); |
| 364 | |
| 365 | if (pNalHead->bIdrFlag) { /* NAL IDR */ |
| 366 | BsWriteUE (pBs, pSliceHeader->uiIdrPicId); |
| 367 | } |
| 368 | |
| 369 | if (pSps->uiPocType == 0) { |
| 370 | BsWriteBits (pBs, pSps->iLog2MaxPocLsb, pSliceHeader->iPicOrderCntLsb); |
| 371 | } else if (pSps->uiPocType == 1) { |
| 372 | // TODO: implement. |
| 373 | assert (0); |
| 374 | } else { |
| 375 | // no-op for uiPocType == 2. |
| 376 | } |
| 377 | // { |
| 378 | if (P_SLICE == pSliceHeader->eSliceType) { |
| 379 | BsWriteOneBit (pBs, pSliceHeader->bNumRefIdxActiveOverrideFlag); |
| 380 | if (pSliceHeader->bNumRefIdxActiveOverrideFlag) { |
| 381 | BsWriteUE (pBs, WELS_CLIP3 (pSliceHeader->uiNumRefIdxL0Active - 1, 0, MAX_REF_PIC_COUNT)); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | if (!pNalHead->bIdrFlag) |
| 386 | WriteReferenceReorder (pBs, pSliceHeader); |
| 387 | |
| 388 | if (pNalHead->sNalUnitHeader.uiNalRefIdc) { |
| 389 | WriteRefPicMarking (pBs, pSliceHeader, pNalHead); |
| 390 | |
| 391 | if (!pSubSps->sSpsSvcExt.bSliceHeaderRestrictionFlag) { |
| 392 | BsWriteOneBit (pBs, pSliceHeadExt->bStoreRefBasePicFlag); |
| 393 | } |
| 394 | } |
| 395 | // } |
| 396 | |
| 397 | |
| 398 | if (pPps->bEntropyCodingModeFlag && pSliceHeader->eSliceType != I_SLICE) { |
| 399 | BsWriteUE (pBs, pSlice->iCabacInitIdc); |
| 400 | } |
| 401 | |
| 402 | BsWriteSE (pBs, pSliceHeader->iSliceQpDelta); /* pSlice qp delta */ |
| 403 | |
| 404 | if (pPps->bDeblockingFilterControlPresentFlag) { |
| 405 | BsWriteUE (pBs, pSliceHeader->uiDisableDeblockingFilterIdc); |
nothing calls this directly
no test coverage detected