shithub: openh264

Download patch

ref: d81f3d5037b7bf1e638377738e1b91803c4ea706
parent: b9d34ff07bda20d6c5cefa1f867d9d8cce536562
parent: 49c24646a94f60cb9214836d1b246a695eb8f4de
author: volvet <qizh@cisco.com>
date: Tue Feb 11 05:32:58 EST 2014

Merge pull request #279 from sijchen/sad_fix2

fix the range of SAD

--- a/codec/encoder/core/inc/svc_motion_estimate.h
+++ b/codec/encoder/core/inc/svc_motion_estimate.h
@@ -50,15 +50,15 @@
 #define	BASE_MV_MB_NMB	((2*(MV_RANGE+ITERATIVE_TIMES)/MB_WIDTH_LUMA)-1)
 
 union SadPredISatdUnit {
-uint16_t	uiSadPred;
-uint16_t	uiSatd;    //reuse the sad_pred as a temp satd pData
+uint32_t	uiSadPred;
+uint32_t	uiSatd;    //reuse the sad_pred as a temp satd pData
 };
 typedef struct TagWelsME {
 /* input */
 uint16_t*					pMvdCost;
 union SadPredISatdUnit	uSadPredISatd; //reuse the sad_pred as a temp pData
-uint16_t					uiSadCost;  //used by ME and RC
-uint16_t					uiSatdCost; /* satd + lm * nbits */
+uint32_t					uiSadCost;  //used by ME and RC //max SAD should be max_delta*size+lambda*mvdsize = 255*256+91*33*2 = 65280 + 6006 = 71286 > (2^16)-1 = 65535
+uint32_t					uiSatdCost; /* satd + lm * nbits */
 uint8_t						uiPixel;   /* PIXEL_WxH */
 uint8_t						uiReserved;