[Ffmpeg-devel] [PATCH] C93 demuxer and decoder (GSoC qualification task)
Anssi Hannula
anssi.hannula
Fri Apr 6 12:36:22 CEST 2007
Michael Niedermayer wrote:
> Hi
Hi!
> On Thu, Apr 05, 2007 at 11:39:35PM +0300, Anssi Hannula wrote:
>> Michael Niedermayer wrote:
>>> On Thu, Apr 05, 2007 at 10:36:15PM +0300, Anssi Hannula wrote:
> [...]
>> + case C93_8X8_2COLOR:
>> + cols[0] = *buf++;
>> + cols[1] = *buf++;
>> + for (j = 0; j < 8; j++) {
>> + for (i = 0; i < 8; i++) {
>> + out[(y+j)*stride+x+i] = cols[(buf[0] >> i) & 1];
>> + }
>> + buf++;
>> + }
>> + break;
>> +
>> + case C93_4X4_2COLOR:
>> + for (y_off = 0; y_off < 8; y_off += 4) {
>> + for (x_off = 0; x_off < 8; x_off += 4) {
>> + colbit = 0;
>> + cols[0] = *buf++;
>> + cols[1] = *buf++;
>> + colmask = bytestream_get_le16(&buf);
>> + for (j = 0; j < 4; j++) {
>> + for (i = 0; i < 4; i++) {
>> + out[(y+y_off+j)*stride+x+x_off+i] =
>> + cols[(colmask >> colbit++) & 1];
>> + }
>> + }
>> + }
>> + }
>> + break;
>> +
>> + case C93_4X4_4COLOR_GRP:
>> + for (y_off = 0; y_off < 8; y_off += 4) {
>> + for (x_off = 0; x_off < 8; x_off += 4) {
>> + colbit = 0;
>> + bytestream_get_buffer(&buf, cols, 4);
>> + colmask = bytestream_get_le16(&buf);
>> + for (j = 0; j < 4; j++) {
>> + int curcols[2];
>> + curcols[0] = j & 2 ? cols[3] : cols[0];
>> + for (i = 0; i < 4; i++) {
>> + curcols[1] = i & 2 ? cols[2] : cols[1];
>> + out[(y+y_off+j)*stride+x+x_off+i] =
>> + curcols[(colmask >> colbit++) & 1];
>> + }
>> + }
>> + }
>> + }
>> + break;
>> +
>> + case C93_4X4_4COLOR:
>> + for (y_off = 0; y_off < 8; y_off += 4) {
>> + for (x_off = 0; x_off < 8; x_off += 4) {
>> + colbit = 0;
>> + bytestream_get_buffer(&buf, cols, 4);
>> + colmask = bytestream_get_le32(&buf);
>> + for (j = 0; j < 4; j++) {
>> + for (i = 0; i < 4; i++) {
>> + out[(y+y_off+j)*stride+x+x_off+i] =
>> + cols[(colmask >> colbit) & 3];
>> + colbit += 2;
>> + }
>> + }
>
> the 2/4 color block draw code seems to occur 4 times, maybe that could be
> simplfied?
Yes, not very straight-forwardly, though. Anyway, in the attached patch
the 3 4x4 color block cases are moved to a single function.
--
Anssi Hannula
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-c93_5.diff
Type: text/x-patch
Size: 19029 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070406/822cd6af/attachment.bin>
More information about the ffmpeg-devel
mailing list