mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 23:43:00 +02:00
libeplayer3: initial attempt to unbreak ass/ssa subtitles
This commit is contained in:
@@ -100,7 +100,6 @@ static int reset()
|
||||
|
||||
static int writeData(void* _call)
|
||||
{
|
||||
unsigned char a;
|
||||
int res = 0;
|
||||
|
||||
WriterFBCallData_t* call = (WriterFBCallData_t*) _call;
|
||||
@@ -121,51 +120,53 @@ static int writeData(void* _call)
|
||||
|
||||
if (call->data != NULL)
|
||||
{
|
||||
unsigned int opacity = 255 - ((unsigned int)_a(call->color));
|
||||
unsigned int a = (unsigned int)_a(call->color);
|
||||
unsigned int r = (unsigned int)_r(call->color);
|
||||
unsigned int g = (unsigned int)_g(call->color);
|
||||
unsigned int b = (unsigned int) _b(call->color);
|
||||
unsigned int b = (unsigned int)_b(call->color);
|
||||
unsigned int opacity = 255 - a;
|
||||
int src_stride = call->Stride;
|
||||
int dst_stride = call->destStride;
|
||||
int dst_delta = dst_stride - call->Width*4;
|
||||
unsigned int x,y;
|
||||
const unsigned char *src = call->data;
|
||||
unsigned char *dst = call->destination + (call->y * dst_stride + call->x * 4);
|
||||
#if 1 // !HAVE_SPARK_HARDWARE
|
||||
unsigned int k;
|
||||
#else
|
||||
unsigned int k,ck,t;
|
||||
#endif
|
||||
|
||||
fb_printf(100, "x %d\n", call->x);
|
||||
fb_printf(100, "y %d\n", call->y);
|
||||
fb_printf(100, "width %d\n", call->Width);
|
||||
fb_printf(100, "height %d\n", call->Height);
|
||||
fb_printf(100, "stride %d\n", call->Stride);
|
||||
fb_printf(100, "color %d\n", call->color);
|
||||
fb_printf(100, "color 0x%.8x\n", call->color);
|
||||
fb_printf(100, "data %p\n", call->data);
|
||||
fb_printf(100, "dest %p\n", call->destination);
|
||||
fb_printf(100, "dest.stride %d\n", call->destStride);
|
||||
|
||||
fb_printf(100, "r 0x%hhx, g 0x%hhx, b 0x%hhx, a 0x%hhx, opacity %d\n", r, g, b, a, opacity);
|
||||
fb_printf(100, "r 0x%hhx, g 0x%hhx, b 0x%hhx, a 0x%hhx, opacity 0x%hhx\n", r, g, b, a, opacity);
|
||||
|
||||
for (y=0;y<call->Height;y++)
|
||||
{
|
||||
for (x = 0; x < call->Width; x++)
|
||||
{
|
||||
k = ((unsigned)src[x]) * opacity / 255;
|
||||
ck = 255 - k;
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
*dst++ = 0;
|
||||
t = *dst;
|
||||
*dst++ = (k*r + ck*t) / 255;
|
||||
t = *dst;
|
||||
*dst++ = (k*b + ck*t) / 255;
|
||||
t = *dst;
|
||||
*dst++ = (k*g + ck*t) / 255;
|
||||
k = ((unsigned)src[x]) * opacity / 256;
|
||||
#if 1 // HAVE_SPARK_HARDWARE
|
||||
*dst++ = b;
|
||||
*dst++ = g;
|
||||
*dst++ = r;
|
||||
*dst++ = k;
|
||||
#else
|
||||
ck = 255 - k;
|
||||
t = *dst;
|
||||
*dst++ = (k*b + ck*t) / 255;
|
||||
*dst++ = (k*b + ck*t) / 256;
|
||||
t = *dst;
|
||||
*dst++ = (k*g + ck*t) / 255;
|
||||
*dst++ = (k*g + ck*t) / 256;
|
||||
t = *dst;
|
||||
*dst++ = (k*r + ck*t) / 255;
|
||||
*dst++ = (k*r + ck*t) / 256;
|
||||
*dst++ = 0;
|
||||
#endif
|
||||
}
|
||||
@@ -179,7 +180,7 @@ static int writeData(void* _call)
|
||||
for (y = 0; y < call->Height; y++)
|
||||
memset(call->destination + ((call->y + y) * call->destStride) + call->x * 4, 0, call->Width * 4);
|
||||
}
|
||||
|
||||
|
||||
fb_printf(100, "< %d\n", res);
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user