From 2a9035a571685ba2c71ae76756d76db3b6152973 Mon Sep 17 00:00:00 2001 From: Sijia Chen Date: Wed, 8 Apr 2015 14:16:26 +0800 Subject: [PATCH] add a clip to avoid warning on gcc4.8.2 https://github.com/cisco/openh264/issues/1858 --- codec/encoder/core/src/svc_encode_slice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codec/encoder/core/src/svc_encode_slice.cpp b/codec/encoder/core/src/svc_encode_slice.cpp index 52ed85c1..ea90b202 100644 --- a/codec/encoder/core/src/svc_encode_slice.cpp +++ b/codec/encoder/core/src/svc_encode_slice.cpp @@ -260,7 +260,7 @@ void WelsSliceHeaderWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCur if (P_SLICE == pSliceHeader->eSliceType) { BsWriteOneBit (pBs, pSliceHeader->bNumRefIdxActiveOverrideFlag); if (pSliceHeader->bNumRefIdxActiveOverrideFlag) { - BsWriteUE (pBs, pSliceHeader->uiNumRefIdxL0Active - 1); + BsWriteUE (pBs, WELS_CLIP3(pSliceHeader->uiNumRefIdxL0Active - 1, 0, MAX_REF_PIC_COUNT)); } } @@ -328,7 +328,7 @@ void WelsSliceHeaderExtWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* p if (P_SLICE == pSliceHeader->eSliceType) { BsWriteOneBit (pBs, pSliceHeader->bNumRefIdxActiveOverrideFlag); if (pSliceHeader->bNumRefIdxActiveOverrideFlag) { - BsWriteUE (pBs, pSliceHeader->uiNumRefIdxL0Active - 1); + BsWriteUE (pBs, WELS_CLIP3(pSliceHeader->uiNumRefIdxL0Active - 1, 0, MAX_REF_PIC_COUNT)); } }