bitcost: fix bitcost() function, broken 13 months ago by 07015bbe306b

when bitcost() was first introduced, we had two competing table formats for the
s_bitsizes[] array. Eventually the x264 style array won out, but this function
was not updated.

This bug was almost harmless, bitcost() could still evaluate differences in bit
costs correctly, but the upshift caused read bound exceptions when the motion
vectors became close to the HEVC max of 4k.
bitcost: increase size of cost arrays, for pessimal situations

MVD is MV minus MVP. MV could be BC_MAX_MV and MVP could be -BC_MAX_MV
Merge with stable
rest: better document that -I N -i N does not disable scenecut detection
bitcost: nits
rc: instrument all error conditions in initPass2()

it's not helpful to abort the encode with no hint as to why
rc: nits
param: log multi-pass state
refine partition size related

- reorder LumaPartitions to simplify partitionFromLog2Size()
- remove unused
qtLayer in reverse order
cli: nit
cli: call x265_param_apply_profile() after applying file-reader params

the Y4M headers could change param->internalCsp, so applying the profile before
the reader makes changes allows bugs. The CLI was allowing an encode of:

x265 foo_422.y4m o.bin --profile main

Even though --profile main was trying to enforce 4:2:0; the color space change
happened afterward the profile was enforced and thus invalidated the specified
profile. After this fix the encode properly fails with:

x265 [error]: Unsupported color space (2) on input
aborted at input frame 1, output frame 0
level: move all profile set/determine logic into one file, fixes for MSP
nits
encoder: fix uninitialized variable use reported by valgrind

m_conformanceWindow was not initialized at all; and this
was causing uninitialized values to be written to the SPS if padding was
necessary.

Remove unnecessary m_defaultDisplayWindow in the process
encoder: remove redundant m_pad array
rc: fix crashes in vbv with 2 pass
rest: better document configuration options of --vbv-init