In order to know how many calories some food sample contains, you need to know exactly how much of that sample is protein, fat, and carbohydrate. This PDF from UCLA gives a breakdown of the calories per gram of those components:
- Carbohydrate = 4 calories per gram
- Protein = 4 calories per gram
- Alcohol = 7 calories per gram
- Fat = 9 calories per gram
Once you know what these are, the math is fairly straightforward; just multiply each and then add. If there are 5 grams of carbs, then totals calories from carbs equals 5 x 4 = 20; if 6 grams of protein, then 4 x 6 = 24; and so on.
Starch is a carbohydrate. But for your other example of "meat
", you'd need to know the breakdown of that particular meat, so you couldn't just say X amount of meat has y amount of protein, z amount of carbohydrate, and z amount of fat. Each meat is different. That said, the breakdown of each kind of meat (i.e. chicken, lean beef, pork, etc.) is probably close enough that you could get a ballpark figure for whatever kind of meat you're interested in.