Hi, I personnally think the best format to use for high quality editing is the Open EXR (.exr) image sequence format. If you can't, use another 32 bit format (.hdr ). And if you can't, work with a 16 bit format (.tiff).
Open EXR is the format developped and used by Industrial Light and Magic, it supports and infinite amount of custom channels (like red, green, blue, alpha, motion vector, depth, etc.)
It is mostly used for CGI, because of its multichannel capabilities, but I think it's the best format to use for HD mastering and editing because it is a lossless, uncompressed format (if I'm not mistaken or its compression is transparent) and it takes a fairly low disk space for the quality it delivers.
The downside is that real-time preview in not possible without RAM (like most image sequences), and not every software accept EXR. But whatever you choose, you should make all your editing in 16 or 32-bit and keep that bit depth until you render your final video file.
If you work with those formats you won't have to trouble with compression and codecs anymore, until you make your final render. Meaning that you will always have a maximum of quality. Even if your original footage is 8 bit (like any footage from a camera), you should bring it in a 16 or 32 bit environment the minute you start your editing and, most of all, before you add your first filter/effect/transformation to your video footage.
(I forgot to say: as you start to work with 32 bit footage, you must learn how to work in linear workflow and how to correct your gamma with 0.455/1.8/2.2 conversions. Complicated a bit, but it worths the trouble. You may never encounter gamma problems if you only work with video footage (vs 3D), but it's good to know what to do if your footage appears way too contrasted or with colors washed out...)