Begin refactoring to help merge parts of rd inter.
Begin refactoring to help merge parts of rd inter.

Also refactor some RD code, remove some comments, and cosmetic changes.

Change-Id: I43806ae573ab5a5036602ac4425d750bbfa1e812

vasilvv/esvp8,mbebenita/aom,jmvalin/aom,Topopiccione/libvpx,shyamalschandra/libvpx,openpeer/libvpx_new,vasilvv/esvp8,mwgoldsmith/vpx,turbulenz/libvpx,goodleixiao/vpx,jacklicn/webm.libvpx,running770/libvpx,jacklicn/webm.libvpx,Laknot/libvpx,vasilvv/esvp8,WebRTC-Labs/libvpx,felipebetancur/libvpx,felipebetancur/libvpx,lyx2014/libvpx_c,thdav/aom,luctrudeau/aom,thdav/aom,Distrotech/libvpx,jmvalin/aom,ShiftMediaProject/libvpx,jacklicn/webm.libvpx,ittiamvpx/libvpx,jdm/libvpx,kim42083/webm.libvpx,mwgoldsmith/libvpx,liqianggao/libvpx,pcwalton/libvpx,VTCSecureLLC/libvpx,webmproject/libvpx,shareefalis/libvpx,zofuthan/libvpx,Distrotech/libvpx,Suvarna1488/webm.libvpx,matanbs/webm.libvpx,VTCSecureLLC/libvpx,shyamalschandra/libvpx,ShiftMediaProject/libvpx,jmvalin/aom,iniwf/webm.libvpx,kleopatra999/webm.libvpx,kim42083/webm.libvpx,altogother/webm.libvpx,stewnorriss/libvpx,shacklettbp/aom,Maria1099/webm.libvpx,gshORTON/webm.libvpx,jdm/libvpx,turbulenz/libvpx,jacklicn/webm.libvpx,ittiamvpx/libvpx,Acidburn0zzz/webm.libvpx,Acidburn0zzz/webm.libvpx,mbebenita/aom,zofuthan/libvpx,hsueceumd/test_hui,zofuthan/libvpx,smarter/aom,charup/https---github.com-webmproject-libvpx-,running770/libvpx,goodleixiao/vpx,cinema6/libvpx,altogother/webm.libvpx,gshORTON/webm.libvpx,thdav/aom,lyx2014/libvpx_c,matanbs/vp982,ittiamvpx/libvpx,luctrudeau/aom,matanbs/webm.libvpx,zofuthan/libvpx,vasilvv/esvp8,mbebenita/aom,turbulenz/libvpx,pcwalton/libvpx,lyx2014/libvpx_c,mwgoldsmith/vpx,reimaginemedia/webm.libvpx,hsueceumd/test_hui,ittiamvpx/libvpx-1,charup/https---github.com-webmproject-libvpx-,mwgoldsmith/libvpx,n4t/libvpx,abwiz0086/webm.libvpx,mwgoldsmith/libvpx,Suvarna1488/webm.libvpx,iniwf/webm.libvpx,hsueceumd/test_hui,ittiamvpx/libvpx,mbebenita/aom,GrokImageCompression/aom,kalli123/webm.libvpx,stewnorriss/libvpx,sanyaade-teachings/libvpx,kalli123/webm.libvpx,Distrotech/libvpx,gshORTON/webm.libvpx,Acidburn0zzz/webm.libvpx,reimaginemedia/webm.libvpx,openpeer/libvpx_new,abwiz0086/webm.libvpx,stewnorriss/libvpx,sanyaade-teachings/libvpx,kleopatra999/webm.libvpx,n4t/libvpx,shareefalis/libvpx,cinema6/libvpx,Maria1099/webm.libvpx,goodleixiao/vpx,lyx2014/libvpx_c,gshORTON/webm.libvpx,mbebenita/aom,matanbs/webm.libvpx,mwgoldsmith/vpx,matanbs/webm.libvpx,altogother/webm.libvpx,sanyaade-teachings/libvpx,jmvalin/aom,altogother/webm.libvpx,Acidburn0zzz/webm.libvpx,matanbs/vp982,running770/libvpx,Topopiccione/libvpx,Laknot/libvpx,luctrudeau/aom,kalli123/webm.libvpx,VTCSecureLLC/libvpx,matanbs/vp982,shacklettbp/aom,kalli123/webm.libvpx,WebRTC-Labs/libvpx,pcwalton/libvpx,cinema6/libvpx,pcwalton/libvpx,Maria1099/webm.libvpx,kleopatra999/webm.libvpx,goodleixiao/vpx,jacklicn/webm.libvpx,iniwf/webm.libvpx,jacklicn/webm.libvpx,kalli123/webm.libvpx,openpeer/libvpx_new,iniwf/webm.libvpx,reimaginemedia/webm.libvpx,smarter/aom,kalli123/webm.libvpx,kleopatra999/webm.libvpx,reimaginemedia/webm.libvpx,n4t/libvpx,jmvalin/aom,ittiamvpx/libvpx-1,shareefalis/libvpx,ShiftMediaProject/libvpx,mbebenita/aom,shareefalis/libvpx,luctrudeau/aom,iniwf/webm.libvpx,ittiamvpx/libvpx-1,turbulenz/libvpx,GrokImageCompression/aom,lyx2014/libvpx_c,shyamalschandra/libvpx,felipebetancur/libvpx,Suvarna1488/webm.libvpx,pcwalton/libvpx,felipebetancur/libvpx,abwiz0086/webm.libvpx,mwgoldsmith/vpx,GrokImageCompression/aom,ShiftMediaProject/libvpx,openpeer/libvpx_new,turbulenz/libvpx,shareefalis/libvpx,running770/libvpx,kim42083/webm.libvpx,kim42083/webm.libvpx,smarter/aom,matanbs/vp982,abwiz0086/webm.libvpx,lyx2014/libvpx_c,reimaginemedia/webm.libvpx,kim42083/webm.libvpx,webmproject/libvpx,jdm/libvpx,mwgoldsmith/vpx,liqianggao/libvpx,thdav/aom,mwgoldsmith/libvpx,cinema6/libvpx,altogother/webm.libvpx,luctrudeau/aom,gshORTON/webm.libvpx,mwgoldsmith/vpx,jmvalin/aom,vasilvv/esvp8,Suvarna1488/webm.libvpx,mbebenita/aom,matanbs/vp982,pcwalton/libvpx,matanbs/webm.libvpx,GrokImageCompression/aom,webmproject/libvpx,ittiamvpx/libvpx-1,webmproject/libvpx,mbebenita/aom,cinema6/libvpx,shacklettbp/aom,WebRTC-Labs/libvpx,turbulenz/libvpx,GrokImageCompression/aom,gshORTON/webm.libvpx,smarter/aom,matanbs/vp982,turbulenz/libvpx,turbulenz/libvpx,webmproject/libvpx,goodleixiao/vpx,running770/libvpx,hsueceumd/test_hui,felipebetancur/libvpx,charup/https---github.com-webmproject-libvpx-,shyamalschandra/libvpx,Maria1099/webm.libvpx,zofuthan/libvpx,ittiamvpx/libvpx,jdm/libvpx,VTCSecureLLC/libvpx,Laknot/libvpx,charup/https---github.com-webmproject-libvpx-,GrokImageCompression/aom,cinema6/libvpx,Laknot/libvpx,ShiftMediaProject/libvpx,VTCSecureLLC/libvpx,mwgoldsmith/libvpx,cinema6/libvpx,ittiamvpx/libvpx-1,shacklettbp/aom,stewnorriss/libvpx,shyamalschandra/libvpx,liqianggao/libvpx,altogother/webm.libvpx,hsueceumd/test_hui,thdav/aom,sanyaade-teachings/libvpx,vasilvv/esvp8,webmproject/libvpx,matanbs/vp982,Maria1099/webm.libvpx,reimaginemedia/webm.libvpx,ittiamvpx/libvpx,Topopiccione/libvpx,n4t/libvpx,Topopiccione/libvpx,WebRTC-Labs/libvpx,mbebenita/aom,smarter/aom,felipebetancur/libvpx,Topopiccione/libvpx,kleopatra999/webm.libvpx,n4t/libvpx,luctrudeau/aom,running770/libvpx,goodleixiao/vpx,stewnorriss/libvpx,vasilvv/esvp8,VTCSecureLLC/libvpx,shareefalis/libvpx,Suvarna1488/webm.libvpx,kim42083/webm.libvpx,openpeer/libvpx_new,Distrotech/libvpx,Suvarna1488/webm.libvpx,stewnorriss/libvpx,Distrotech/libvpx,liqianggao/libvpx,charup/https---github.com-webmproject-libvpx-,openpeer/libvpx_new,ittiamvpx/libvpx-1,charup/https---github.com-webmproject-libvpx-,Maria1099/webm.libvpx,abwiz0086/webm.libvpx,shacklettbp/aom,Acidburn0zzz/webm.libvpx,WebRTC-Labs/libvpx,smarter/aom,Acidburn0zzz/webm.libvpx,Topopiccione/libvpx,mwgoldsmith/libvpx,shyamalschandra/libvpx,jdm/libvpx,abwiz0086/webm.libvpx,matanbs/webm.libvpx,Laknot/libvpx,hsueceumd/test_hui,liqianggao/libvpx,Laknot/libvpx,turbulenz/libvpx,shacklettbp/aom,liqianggao/libvpx,Distrotech/libvpx,iniwf/webm.libvpx,sanyaade-teachings/libvpx,zofuthan/libvpx,thdav/aom,jdm/libvpx,kleopatra999/webm.libvpx