diff options
-rw-r--r-- | spuencoder.c | 11 | ||||
-rw-r--r-- | spuencoder.h | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/spuencoder.c b/spuencoder.c index 7295e62..79c76fe 100644 --- a/spuencoder.c +++ b/spuencoder.c @@ -75,6 +75,12 @@ void cSpuEncoder::encode(cBitmap *bmap, int top, int left) // prepare datastructures memset(&spu, 0, sizeof(spu)); + // get needed informations about used colors + colors = bitmap->Colors(numColors); + + dsyslog("[dxr3-spuencoder] num colors %d", num); + + // generate and upload color palette generateColorPalette(); } @@ -102,12 +108,9 @@ void cSpuEncoder::generateColorPalette() // be able to convert color to yuv and set // wanted opacity vales later on. - int num; - const tColor *colors = bitmap->Colors(num); - memset(&palcolors, 0, sizeof(palcolors)); - for (int i = 0; i < num; i++) { + for (int i = 0; i < numColors; i++) { // separate AA and RRGGBB values opacity[i] = (colors[i] & 0xff000000) >> 24; palcolors[i] = Tools::Rgb2YCrCb(colors[i] & 0x00ffffff); diff --git a/spuencoder.h b/spuencoder.h index 3ee8fa1..e370612 100644 --- a/spuencoder.h +++ b/spuencoder.h @@ -46,6 +46,8 @@ private: uint32_t ncnt; // nibble count int32_t written; // how much data are written + int numColors; // len of tColor array of current bitmap + const tColor* colors; // pointer to tColor array from current bitmap tColor opacity[16]; tColor palcolors[16]; |