Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 16, 2012
@multimediamike Alpha support
Add support for unpacking codebooks with alpha channel information.
Since dreamroq currently only supports outputting to a non-alpha RGB565
colorspace, the alpha information is currently disregarded.
837820d
@multimediamike Add a proper credits section; add Josh Pearson b471130
Showing with 19 additions and 3 deletions.
  1. +7 −1 README
  2. +12 −2 dreamroqlib.c
View
8 README
@@ -1,4 +1,4 @@
-Dreamroq by Mike Melanson (mike -at- multimedia.cx)
+Dreamroq Library
Introduction
============
@@ -93,3 +93,9 @@ Notably absent is some proper initialization and teardown mechanism.
Currently, the first call to the render callback initializes the PVR buffers
but they are never explicitly freed.
+
+Credits
+=======
+Library originally written by Mike Melanson (mike -at- multimedia.cx)
+
+Audio support added by Josh "PH3NOM" Pearson (ph3nom.dcmc@gmail.com)
View
14 dreamroqlib.c
@@ -44,6 +44,7 @@ typedef struct
int mb_width;
int mb_height;
int mb_count;
+ int alpha;
int current_frame;
unsigned short *frame[2];
@@ -76,8 +77,12 @@ static int roq_unpack_quad_codebook(unsigned char *buf, int size, int arg,
if (!count4x4 && count2x2 * 6 < size)
count4x4 = ROQ_CODEBOOK_SIZE;
- /* size sanity check */
- if ((count2x2 * 6 + count4x4 * 4) != size)
+ /* size sanity check, taking alpha into account */
+ if (state->alpha && (count2x2 * 10 + count4x4 * 4) != size)
+ {
+ return ROQ_BAD_CODEBOOK;
+ }
+ if (!state->alpha && (count2x2 * 6 + count4x4 * 4) != size)
{
return ROQ_BAD_CODEBOOK;
}
@@ -87,7 +92,11 @@ static int roq_unpack_quad_codebook(unsigned char *buf, int size, int arg,
{
/* unpack the YUV components from the bytestream */
for (j = 0; j < 4; j++)
+ {
y[j] = *buf++;
+ if (state->alpha)
+ buf++;
+ }
u = *buf++;
v = *buf++;
@@ -456,6 +465,7 @@ int dreamroq_play(char *filename, int loop, render_callback render_cb,
if (initialized)
continue;
+ state.alpha = chunk_arg;
state.width = LE_16(&read_buffer[0]);
state.height = LE_16(&read_buffer[2]);
/* width and height each need to be divisible by 16 */

No commit comments for this range

Something went wrong with that request. Please try again.