rd level: add functions to do residual encoding at depth 0 for best modes.

This function will be used for rd level 0.
rd level: modify mode-decision logic for rd level 0

In rd level 0, sa8d cost used for mode decision across depths. dct,quant is not done during mode-decision and no recon is generated. Hence Intra has to use original pixels as reference. Residual encoding is done at depth 0 and Intra prediction for the best mode will be done again with recon as reference.
white space nits
TEncSearch: fix gcc warning

remove unused variables and shadowed declarations