some optimizations, added support for KSP-AVC