Update codec

Main changes:
- Revert codec creation.
- Update indexed management.
- Add generation of frame header.