ratecontrol: avoid reads past the end of chroma buffers

--HG--
branch : stable
sbac: move global tables into x265 namespace

--HG--
branch : stable
extra : source : 1d2d60f4eb81882fa0f3ba6c4e7aa9a220968f7a