Skip to content

Commit 8e10868

Browse files
committed
added stripped down decoder library (no seeking support) and simplified player (no pause or seeking)
git-svn-id: svn://svn.icculus.org/twilight/trunk/dpvideo@2076 d7cf8633-e32d-0410-b094-e92efae38249
1 parent 85fff8f commit 8e10868

6 files changed

+879
-14
lines changed

dpvdecode.c

+15-3
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,22 @@ static int dpvdecode_convertpixels(dpvdecodestream_t *s, void *imagedata, int im
552552
for (y = 0;y < height;y++)
553553
{
554554
outrow = (void *)((unsigned char *)imagedata + y * imagebytesperrow);
555-
for (x = 0;x < width;x++)
555+
if (Rloss == 19 && Gloss == 10 && Bloss == 3 && Rshift == 11 && Gshift == 5 && Bshift == 0)
556556
{
557-
a = *in++;
558-
outrow[x] = (((a >> Rloss) & Rmask) << Rshift) | (((a >> Gloss) & Gmask) << Gshift) | (((a >> Bloss) & Bmask) << Bshift);
557+
// optimized
558+
for (x = 0;x < width;x++)
559+
{
560+
a = *in++;
561+
outrow[x] = ((a >> 8) & 0xF800) | ((a >> 5) & 0x07E0) | ((a >> 3) & 0x001F);
562+
}
563+
}
564+
else
565+
{
566+
for (x = 0;x < width;x++)
567+
{
568+
a = *in++;
569+
outrow[x] = (((a >> Rloss) & Rmask) << Rshift) | (((a >> Gloss) & Gmask) << Gshift) | (((a >> Bloss) & Bmask) << Bshift);
570+
}
559571
}
560572
}
561573
}

dpvdecode.h

-10
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ unsigned int dpvdecode_getsoundrate(void *stream);
4949
// returns the framerate of the stream
5050
double dpvdecode_getframerate(void *stream);
5151

52-
// returns a recommended sound buffer length (in samples)
53-
// for decoding a single frame of this stream
54-
unsigned int dpvdecode_getneededsoundbufferlength(void *stream);
55-
56-
// decodes a frame, both video and audio, to the supplied buffers
57-
// can produce many different possible errors
58-
// (such as too little space in supplied sound buffer)
59-
// (note: sound is 16bit stereo native-endian, left channel first)
60-
//int dpvdecode_frame(void *stream, int framenum, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow, short *sounddata, unsigned int soundbufferlength, unsigned int *soundlength);
61-
6252
// decodes a video frame to the supplied output pixels
6353
int dpvdecode_video(void *stream, int framenum, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow);
6454
// reads some sound

0 commit comments

Comments
 (0)