Make the library work on big endian

These two patches make "make test" pass on big endian, assuming that WORDS_BIGENDIAN is defined while building.

There's some amount of duplication in the deblocking code between the encoder and decoder - many of these changes are almost identical in both of them. Unfortunately, even though the functions look quite similar, there's enough small differences that make merging them not quite trivial.