encode: do fewer allocs per frame

Make coefficient arrays persist to avoid allocing/freeing them every frame.
state: fix memory leak
Add public API to test for header or keyframe packets.

Turns out we already had these functions implemented, just not
 exposed publicly.
However, I want the API to not use an ogg_packet structure to reduce
 our dependencies on libogg.
Also, the Daala keyframe flag is inverted from the Theora one (from
 which these functions were ported), and we currently treat 0-byte
 packets as "not a video data packet" instead of as implicit empty
 delta frames like Theora does.
encode: don't alloc tf and modes every frame
tools: fix warning