Kega Video
(Redirected from KGV1)
Jump to navigation
Jump to search
- FourCC: KGV1
- Sample: http://samples.mplayerhq.hu/V-codecs/kgv1/
Codec used for capturing videos in some Sega emulator called Kega.
It produces output in RGB555 and coding is LZ-like.
Frame starts with two bytes which code real dimensions as multiple of 8 minus 1 block (i.e. width = (src[0] + 1) * 8;
, same for height), the rest is coded data.
Coded data consists of 16-bit LSB control words with possible extensions:
111x xxyy yyyy yyyy
- copy(y+3)
pixels from positive offsetoffsets[x]
in the previous frame. Ifoffsets[x]
is not yet defined for this frame, read 24-bit LSB word after this code word. Naturally, this is possible only in interframes. The offset may wrap around the frame, depending on the current output position.110y yyyy yyyy yyyy
- read run length value minus four from next byte (i.e.run = get_byte() + 4
) and copy pixels from negative offsety+1
(e.g. offset 0 means RLE, offset 1 means repeating last two pixels, etc.)101y yyyy yyyy yyyy
- same as above but always copy 3 pixels from given offset100y yyyy yyyy yyyy
- same as above but always copy 2 pixels from given offset0ppp pppp pppp pppp
-p
is pixel value, simply output it.
Implementing decoder is left as an exercise for reader.