MCPcopy Create free account
hub / github.com/cisco/openh264 / InitSliceBoundaryInfo

Function InitSliceBoundaryInfo

codec/encoder/core/src/svc_encode_slice.cpp:833–879  ·  view source on GitHub ↗

Initialize slice's boundary info)

Source from the content-addressed store, hash-verified

831
832//Initialize slice's boundary info)
833int32_t InitSliceBoundaryInfo (SDqLayer* pCurLayer,
834 SSliceArgument* pSliceArgument,
835 const int32_t kiSliceNumInFrame) {
836 const int32_t* kpSlicesAssignList = (int32_t*) & (pSliceArgument->uiSliceMbNum[0]);
837 const int32_t kiMBWidth = pCurLayer->iMbWidth;
838 const int32_t kiMBHeight = pCurLayer->iMbHeight;
839 const int32_t kiCountNumMbInFrame = kiMBWidth * kiMBHeight;
840 int32_t iSliceIdx = 0;
841 int32_t iFirstMBInSlice = 0;
842 int32_t iMbNumInSlice = 0;
843
844 for (; iSliceIdx < kiSliceNumInFrame; iSliceIdx++) {
845 if (SM_SINGLE_SLICE == pSliceArgument->uiSliceMode) {
846 iFirstMBInSlice = 0;
847 iMbNumInSlice = kiCountNumMbInFrame;
848
849 } else if ((SM_RASTER_SLICE == pSliceArgument->uiSliceMode) && (0 == pSliceArgument->uiSliceMbNum[0])) {
850 iFirstMBInSlice = iSliceIdx * kiMBWidth;
851 iMbNumInSlice = kiMBWidth;
852 } else if (SM_RASTER_SLICE == pSliceArgument->uiSliceMode ||
853 SM_FIXEDSLCNUM_SLICE == pSliceArgument->uiSliceMode) {
854 int32_t iMbIdx = 0;
855 for (int i = 0; i < iSliceIdx; i++) {
856 iMbIdx += kpSlicesAssignList[i];
857 }
858
859 if (iMbIdx >= kiCountNumMbInFrame) {
860 return ENC_RETURN_UNEXPECTED;
861 }
862
863 iFirstMBInSlice = iMbIdx;
864 iMbNumInSlice = kpSlicesAssignList[iSliceIdx];
865
866 } else if (SM_SIZELIMITED_SLICE == pSliceArgument->uiSliceMode) {
867 iFirstMBInSlice = 0;
868 iMbNumInSlice = kiCountNumMbInFrame;
869
870 } else { // any else uiSliceMode?
871 assert (0);
872 }
873
874 pCurLayer->pCountMbNumInSlice[iSliceIdx] = iMbNumInSlice;
875 pCurLayer->pFirstMbIdxOfSlice[iSliceIdx] = iFirstMBInSlice;
876 }
877
878 return ENC_RETURN_SUCCESS;
879}
880
881int32_t SetSliceBoundaryInfo (SDqLayer* pCurLayer, SSlice* pSlice, const int32_t kiSliceIdx) {
882 if (NULL == pCurLayer || NULL == pSlice ||

Callers 1

InitSliceInLayerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected