HTC made a controversial decision last year to abandon the megapixel race and aim at technical superiority rather than marketing. This year the company made an even more unexpected step by keeping the same sensor (but dropping the optical image stabilization) and introducing a second camera.
We'll get back to what it's for in a moment, let's first list the camera basics. The HTC One (M8) has a 1/3" sensor with 4MP resolution (it's now at least a year old), f/2.0 aperture and a dual-LED flash. It's a two-tone flash dubbed Smart Flash, which is brighter and should produce more accurate white balance in photos.
The Samsung Galaxy S5 uses a brand new sensor called ISOCELL, developed by Samsung itself. It's big too - 1/2.6", almost as big as Nokia's 1/2.5" sensors (Lumia 1520, Icon and 930). It's a 16:9 widescreen sensor with 16MP resolution behind an f/2.2 aperture. Samsung claims ISOCELL improves dynamic range in good lighting conditions and reduces noise in poor light.
Both Samsung and HTC have enabled a number of special features for their respective flagships (and as usual, Samsung threw in the kitchen sink).
The headlining feature of the One (M8) and the reason behind its dual-camera setup is the ability to do depth calculations. This enables effects like shallow depth of field (characteristic of a DSLR with a large sensor) and effects that make the foreground objects pop (with an effect applied to the background, i.e. a sketch, a blur or one of several other options).
Samsung has a depth of field effect too, but it's more limited. The Galaxy S5 takes two photos instead of just one (but is quick doing it, so it doesn't get in the way of your shooting much) and uses them for calculations. You can only focus on the foreground, background or bring everything into focus.
The HTC One (M8) on the other hand can apply the effect to any photo you've taken and it can refocus on any point of the image. Better yet, the resulting depth of field is much shallower than what the Galaxy S5 achieves. With selective focus, the rule of thumb is the shallower, the better.
That said, HTC's second camera only removes the need to snap a second photo but doesn't do much for accuracy. Both phones mess up the calculations in places and with HTC pushing the effect strength higher, the places where the calculations are wrong are more obvious than in Galaxy S5 photos.
That said, the Galaxy seems to make fewer mistakes, there are a few places where the background blur in the One (M8) photos cuts off unexpectedly with an in-focus area becoming quite noticeable in a sea of blur.
Again, the second camera of the HTC One (M8) means the phone only needs to take one photo, making it suitable for applying this refocus effect to moving objects. A fast moving object will be a problem for the Galaxy S5, but for static objects it produces the better-looking images.
HTC also put a 5MP camera on the front - that's right, the front-facing camera has a higher resolution than the main camera. Still, that's great news for people who take a lot of selfies.
HTC's other premium feature on the One (M8) camera is the return of Zoe. Zoe snaps short videos alongside still photos and later assembles them into Highlights - short slideshows of photos and videos you've taken at a certain place on a given day.
Unlike its initial incarnation, Zoe now lets you control the length of these videos (it used to be fixed at 3s). As we mentioned in the previous chapter, you can collaborate with friends to create a combined Zoe too.
While Samsung doesn't have a direct answer to Zoe, it does have Virtual tours. They are similar to panoramas, except you don't have to stay in one place - you can move around relatively freely, stopping every couple of steps to take as many photos as you like and move on. The Galaxy S5 will stitch them into a video-like presentation, complete with a minimap that tracks your movements.
Winner: Samsung Galaxy S5. Samsung put a wider array of features on its new flagship, covering most of what the HTC One (M8) can do.
Zoe is nice but can't carry the M8 alone and despite having a whole second camera to help it the shallow depth of focus feature is not clearly better than Samsung's. It will work better for moving objects, but other than that the Galaxy S5 results looked cleaner.