TEncSearch: init best AMVP candidate to zero.
Merge with stable
added asm primitives for 10bpp sad functions
asm: 8bpp and 10bpp code for idct8x8 module
TEncCu: initialize variables, handle malloc failures more cleanly

--HG--
extra : amend_source : 99b203389a8c422a695b0e7fc760c24c81485308
TEncSearch: mvpIdx shares storage with mergeIdx, do not set for merge CUs
TEncCU: set dqpflag as true in the CU encoder if aqmode enabled
vbv: set DQP as true if VBV is enabled (and AQ disabled).

Unless this is set, the different QP's for each CU wont be encoded. This worked thankfully
until now, since VBV was always used at high quality (AQ on) settings.
encoder: Adding a TODO comment on the final goal.
compress/TEncCU: no reason why mode decision should reset the dqp flags.
encode: avoid repetitive statements; no logic change
optimize: rewrite TComTrQuant::xGetICRate
optimize: rewrite TComTrQuant::xGetICRateCost
optimize: improvement TComTrQuant::getSigCtxInc, avoid shift by mask
optimize: rewrite TEncSbac::xWriteCoefRemainExGolomb
TComSlice: nits
Merge with stable
TEncCU: cleanup
TEncCU: fix previous bad patch import
threading: introduce ThreadSafeInteger class

This class uses a condition variable to implement a producer/consumer access
protocol with a single writer and multiple readers for safe multi-core
synchronization

--HG--
extra : rebase_source : b0984c3733391c6dce81fabb2143316532030f45