Refactor jpg.js and include forceRGBoutput, correct style of image.js

This refactors getData to be more readable and extracts all the color
conversion algorithms to their own functions. The resulting code was then
cleaned up.
This also introduces a flag `forceRGBoutput` to getData, that allows to always
get the data as a `width * height * 3` bytes long RGB buffer
Move the colour conversion to jpg.js

Benchmarking shows that this improves performance for the invitation document
from https://github.com/mozilla/pdf.js/issues/3809 by 35%
Ensure that the viewer loads even if there are errors when the preferences are read
Merge pull request #4528 from bthorben/lessColorConversion

Less color conversion
Merge pull request #4693 from Snuffleupagus/preferences-reject

Ensure that the viewer loads even if there are errors when the preferences are read
Reduces memory used during testing
Merge pull request #4699 from yurydelendik/testmem

Reduces memory used during testing
Add a preference to set the sidebarView on load
Merge pull request #4669 from Snuffleupagus/sidebar-pref

Add a preference to set the sidebarView on load