shithub: openh264

Download patch

ref: dee5400485f5946b835e05b9a6de65ab5cfd766e
parent: 3d5990500b272515a0f72ce58ed98372825bfa33
parent: e9e4d0a073d57def9c2c0146fe87511cb2a2ba32
author: dongzha <[email protected]>
date: Thu May 15 11:02:17 EDT 2014

Merge pull request #847 from mstorsjo/remove-write-nal-length

Remove unnecessary writing of nal length in the decoder

--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -52,7 +52,6 @@
 #include "decode_slice.h"
 #include "error_concealment.h"
 #include "mem_align.h"
-#include "ls_defines.h"
 
 namespace WelsDec {
 
@@ -60,10 +59,6 @@
 
 extern void FreePicture (PPicture pPic);
 
-inline void GetValueOf4Bytes (uint8_t* pDstNal, int32_t iDdstIdx) {
-  ST32 (pDstNal, iDdstIdx);
-}
-
 static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiSize,
                               const int32_t kiPicWidth, const int32_t kiPicHeight) {
   PPicBuff pPicBuf = NULL;
@@ -447,7 +442,7 @@
 
     //copy raw data from source buffer (application) to raw data buffer (codec inside)
     //0x03 removal and extract all of NAL Unit from current raw data
-    pDstNal = pRawData->pCurPos + 4; //4-bytes used to write the length of current NAL rbsp
+    pDstNal = pRawData->pCurPos;
 
     while (iSrcConsumed < iSrcLength) {
       if ((2 + iSrcConsumed < iSrcLength) &&
@@ -459,7 +454,6 @@
           iSrcIdx	+= 3;
           iSrcConsumed += 3;
         } else {
-          GetValueOf4Bytes (pDstNal - 4, iDstIdx);  //pDstNal-4 (non-aligned by 4) in Solaris10(SPARC). Given value by byte.
 
           iConsumedBytes = 0;
           pNalPayload	= ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
@@ -515,7 +509,6 @@
     }
 
     //last NAL decoding
-    GetValueOf4Bytes (pDstNal - 4, iDstIdx); //pDstNal-4 (non-aligned by 4) in Solaris10(SPARC). Given value by byte.
 
     iConsumedBytes = 0;
     pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);