5-10% encoding speedup with faster trellis (-m 6)
5-10% encoding speedup with faster trellis (-m 6)

mostly by:
- storing a single rd-score instead of cost / distortion separately
- evaluating terminal cost only once
- getting some invariants out of the loops
- more consts behind fewer variables

Change-Id: I79451f3fd1143d6537200fb8b90d0ba252809f8c

abwiz0086/webm.libwebp,matanbs/webm.libwebp,ya7lelkom/libwebp,webmproject/libwebp,Suvarna1488/webm.libwebp,PKRoma/libwebp,imazen/libwebp,iniwf/webm.libwebp,Maria1099/webm.libwebp,zofuthan/libwebp,redengineer/libwebp,Suvarna1488/webm.libwebp,zofuthan/libwebp,ya7lelkom/libwebp,ttyangf/libwebp,abwiz0086/webm.libwebp,comoyo/gonzo-libwebp,kalli123/webm.libwebp,kim42083/webm.libwebp,imazen/libwebp,zofuthan/libwebp,appunite/libwebp,comoyo/gonzo-libwebp,Maria1099/webm.libwebp,webmproject/libwebp,Acidburn0zzz/webm.libwebp,gshORTON/webm.libwebp,redengineer/libwebp,redengineer/libwebp,iniwf/webm.libwebp,Aexyn/libwebp,matanbs/webm.libwebp,kim42083/webm.libwebp,webmproject/libwebp,PKRoma/libwebp,kalli123/webm.libwebp,yohunl/libwebp,Suvarna1488/webm.libwebp,keane83/BLE_IM,keane83/BLE_IM,yohunl/libwebp,imazen/libwebp,kleopatra999/webm.libwebp,gshORTON/webm.libwebp,ya7lelkom/libwebp,matanbs/webm.libwebp,kleopatra999/webm.libwebp,zofuthan/libwebp,appunite/libwebp,abwiz0086/webm.libwebp,appunite/libwebp,Acidburn0zzz/webm.libwebp,kalli123/webm.libwebp,kalli123/webm.libwebp,Aexyn/libwebp,appunite/libwebp,jiehu5114/libwebp,jiehu5114/libwebp,kleopatra999/webm.libwebp,jacklicn/libwebp,gshORTON/webm.libwebp,matanbs/webm.libwebp,reimaginemedia/webm.libwebp,appunite/libwebp,rxl194/libwebp,Maria1099/webm.libwebp,Acidburn0zzz/webm.libwebp,altogother/webm.libwebp,Maria1099/webm.libwebp,comoyo/gonzo-libwebp,Aexyn/libwebp,PKRoma/libwebp,ya7lelkom/libwebp,rxl194/libwebp,imazen/libwebp,kim42083/webm.libwebp,abwiz0086/webm.libwebp,kleopatra999/webm.libwebp,jiehu5114/libwebp,keane83/BLE_IM,ericmckean/webm.libwebp,kleopatra999/webm.libwebp,kim42083/webm.libwebp,abwiz0086/webm.libwebp,ericmckean/webm.libwebp,Acidburn0zzz/webm.libwebp,Suvarna1488/webm.libwebp,ericmckean/webm.libwebp,keane83/BLE_IM,jacklicn/libwebp,Suvarna1488/webm.libwebp,altogother/webm.libwebp,redengineer/libwebp,jiehu5114/libwebp,yohunl/libwebp,matanbs/webm.libwebp,ttyangf/libwebp,Maria1099/webm.libwebp,jacklicn/libwebp,gshORTON/webm.libwebp,reimaginemedia/webm.libwebp,ttyangf/libwebp,jiehu5114/libwebp,ericmckean/webm.libwebp,comoyo/gonzo-libwebp,reimaginemedia/webm.libwebp,ttyangf/libwebp,iniwf/webm.libwebp,ericmckean/webm.libwebp,comoyo/gonzo-libwebp,rxl194/libwebp,reimaginemedia/webm.libwebp,Acidburn0zzz/webm.libwebp,Aexyn/libwebp,PKRoma/libwebp,Aexyn/libwebp,keane83/BLE_IM,comoyo/gonzo-libwebp,ya7lelkom/libwebp,jacklicn/libwebp,imazen/libwebp,gshORTON/webm.libwebp,zofuthan/libwebp,PKRoma/libwebp,PKRoma/libwebp,ttyangf/libwebp,altogother/webm.libwebp,kim42083/webm.libwebp,reimaginemedia/webm.libwebp,yohunl/libwebp,rxl194/libwebp,webmproject/libwebp,iniwf/webm.libwebp,appunite/libwebp,jacklicn/libwebp,iniwf/webm.libwebp,altogother/webm.libwebp,redengineer/libwebp,webmproject/libwebp,yohunl/libwebp,altogother/webm.libwebp,kalli123/webm.libwebp,comoyo/gonzo-libwebp,rxl194/libwebp