Instead of downloading all the data, you can use the Overpass API to do a selective extract based on a bounding box and certain properties (for example, a key-value search for certain properties).
What properties you choose to use is (of course) your choice - I assume you already have something you're using as the definition of a "building" based on the key-value pairs in the API output, since this is a bit qualitative (e.g. is a bus shelter a building?)
If you'd like to install that system locally, see http://wiki.openstreetmap.org/wiki/Overpass_API/versions