shithub: openh264

Download patch

ref: 2a9035a571685ba2c71ae76756d76db3b6152973
parent: d718ad89f477fdea3defb6c2cd7e5567b89f3b6b
author: Sijia Chen <sijchen@cisco.com>
date: Wed Apr 8 10:16:26 EDT 2015

add a clip to avoid warning on gcc4.8.2
https://github.com/cisco/openh264/issues/1858

--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -260,7 +260,7 @@
   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 @@
   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));
     }
   }