nal: refactor nal code, marshall packets directly into output buffer

This removes two malloc/free for every NAL unit and removes yet another set of
memcopies at the end of the each frame encode. We're now writing the escaped
NAL packets directly into the buffer handed back to the user.

We preserve the max size of this output buffer to prevent having to do any
reallocations once the encoder is running.
encoder: remove useless comment
api: introduce param variables for two-pass encodes
rc: define default setting and validations for 2 pass states
rc: add 2 pass states in RateControl
param: log rc states of m_param in x265_param2string
rc: initialize the 2 pass states in rc
remove reduce code since trHeight always equal to trWidth
static m_bLFCrossTileBoundary since all of LCU use same value
move m_blockingStrength to local
cu: nits
TComDataCU: refactor structure for better data locality
rc: disable MSVC warnings about using POSIX function names like unlink()
lambda: [CHANGES OUTPUT] Change the distortion weights applied to chroma.

Inside R-D, a single lambda is applied for both luma and chroma. To account for the different QPs,
(as defined by the standard) the chroma distortion was weighted by a factor proportional to the
difference in QPs. This patch eliminates the extra weighting given to the chroma distortion
(since it is visually less perceptible).
x265_encoder_encode: don't return 0 while flushing.
encoder: cleanup obsolete NAL data fields
encoder: remove redundant flush argument
bitstream: unify resetBits() and clear() methods

There's no point in having a virtual resetBits() method in the abstract class
and then not implemeent in the derived class but make a second method with
identical semantics.  What the heck?
move bitstream implementations into common
fix msvc build warnings