Default Quality of camera between Stock Vs AOSP

I have had my G2 since last october.
I am a bit of serial flasher, mostly I have been flashing AOSP based roms but that changed as I was using more of the camera and was quite disappointed with the results I am getting.

I finally flashed Cloudy G3 (lg stock based) and I am noticing better quality pictures, at least I think they are.

My question is,

Would AOSP based rom never have the quality of the stock rom when it comes to picture quality?
What determines the quality of the camera? Kernel? Algorithm?

Any input would be appreciated