Add internal threading (via avs+ threading API)

Active when frame-level threading is not used
Remove some useless code.

Also replace BYTE with uint8_t because it's cool.