frameencoder: use CHECKED_MALLOC in getStreamHeaders()
common: rename CONFIRM macro to CHECK

The logic of the macro is:  if (expr) fail
So CONFIRM is highly misleading
common: prevent an API race hazard

The public API should be thread-safe for a given encoder or param object (they
are distinct data structures).  However x265 has a small number of global vars
that are configured on first use and must be the same for all encoders in the
same process (max CTU size and pixel bit-depth).  Using an atomic compare-and-
swap here prevents simultaneous encoder creations from violating those rules.
lowres intra fixes
RateControl : Bug fix when previous estimated frame cost is zero
Merge with stable