shithub: openh264

Download patch

ref: 9a9f92bcfea3e64fbec524d66e96bdd321294bb7
parent: 292d2511e2f91ffc00a1b9addf0876a0bcad271e
author: Martin Storsjö <[email protected]>
date: Tue Oct 28 10:35:43 EDT 2014

Don't stash the cabac state into the SBitStringAux buffer

This fixes crashes on some platforms, and fixes valgrind
errors.

--- a/codec/encoder/core/src/set_mb_syn_cavlc.cpp
+++ b/codec/encoder/core/src/set_mb_syn_cavlc.cpp
@@ -216,13 +216,13 @@
   return pDss->iMbSkipRunStack;
 }
 void StashMBStatusCabac (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice, int32_t iMbSkipRun) {
-  SCabacCtx* pCtx = (SCabacCtx*)pBuffer;
+  SCabacCtx* pCtx = &pSlice->sCabacCtx;
   memcpy (&pDss->sStoredCabac, pCtx, sizeof (SCabacCtx));
   pDss->uiLastMbQp =  pSlice->uiLastMbQp;
   pDss->iMbSkipRunStack = iMbSkipRun;
 }
 int32_t StashPopMBStatusCabac (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice) {
-  SCabacCtx* pCtx = (SCabacCtx*)pBuffer;
+  SCabacCtx* pCtx = &pSlice->sCabacCtx;
   memcpy (pCtx, &pDss->sStoredCabac, sizeof (SCabacCtx));
   pSlice->uiLastMbQp = pDss->uiLastMbQp;
   return pDss->iMbSkipRunStack;