optimize palette ordering
optimize palette ordering

We compact the palette by weighted distance, favoring the green channel.

Average gain on paletted file is ~0.5%, with gain up to 6-7% on some favorable cases.
Encoding speed is unaffected.

Disabled for alpha (or any single-channel input)

Also: always use quality=20 for EncodePalette() since it
doesn't make any real difference.

Change-Id: I19fb14316a366f139a941b45aef5663a33c905e1

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