Extract arithmetic decoder to own file

I extracted the arithmetic decoder to its own file to avoid the code duplication in jpx and jbig2.
Because I modified the interface of the arithmetic decoder in #3542, I now updated the usage of the coder in jpx.js accordingly.

I guess I will have to update this PR once #4425 lands, but until then, I'm happy to hear some comments on this. 

I also wonder why I get the following lint warning when `new ArithmeticDecoder()` is called.
`src/core/jbig2.js: line 42, col 25, 'ArithmeticDecoder' is not defined.`