void ass_synth_blur(ASS_SynthPriv *priv_blur, int opaque_box, int be, double blur_radius, Bitmap *bm_g, Bitmap *bm_o) { if(blur_radius > 0.0 || be){ if (bm_o && !resize_tmp(priv_blur, bm_o->w, bm_o->h)) return; if ((!bm_o || opaque_box) && !resize_tmp(priv_blur, bm_g->w, bm_g->h)) return; } // Apply box blur (multiple passes, if requested) if (be) { uint16_t* tmp = priv_blur->tmp; if (bm_o) { unsigned passes = be; unsigned w = bm_o->w; unsigned h = bm_o->h; unsigned stride = bm_o->stride; unsigned char *buf = bm_o->buffer; if(w && h){ while(passes--){ memset(tmp, 0, stride * 2); if(w < 16){ be_blur_c(buf, w, h, stride, tmp); }else{ priv_blur->be_blur_func(buf, w, h, stride, tmp); } } } } if (!bm_o || opaque_box) { unsigned passes = be; unsigned w = bm_g->w; unsigned h = bm_g->h; unsigned stride = bm_g->stride; unsigned char *buf = bm_g->buffer; if(w && h){ while(passes--){ memset(tmp, 0, stride * 2); priv_blur->be_blur_func(buf, w, h, stride, tmp); } } } } // Apply gaussian blur if (blur_radius > 0.0 && generate_tables(priv_blur, blur_radius)) { if (bm_o) ass_gauss_blur(bm_o->buffer, priv_blur->tmp, bm_o->w, bm_o->h, bm_o->stride, priv_blur->gt2, priv_blur->g_r, priv_blur->g_w); if (!bm_o || opaque_box) ass_gauss_blur(bm_g->buffer, priv_blur->tmp, bm_g->w, bm_g->h, bm_g->stride, priv_blur->gt2, priv_blur->g_r, priv_blur->g_w); } }
ASS_SynthPriv *ass_synth_init(double radius) { ASS_SynthPriv *priv = calloc(1, sizeof(ASS_SynthPriv)); if (!priv || !generate_tables(priv, radius)) { free(priv); return NULL; } #if (defined(__i386__) || defined(__x86_64__)) && CONFIG_ASM int avx2 = has_avx2(); #ifdef __x86_64__ priv->be_blur_func = avx2 ? ass_be_blur_avx2 : ass_be_blur_sse2; #else priv->be_blur_func = be_blur_c; #endif #else priv->be_blur_func = be_blur_c; #endif return priv; }
int main(void) { static ULONG flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX | FCF_MENU | FCF_SHELLPOSITION | FCF_ACCELTABLE | FCF_TASKLIST; hab = WinInitialize(0L); hmq = WinCreateMsgQueue (hab,0L); WinRegisterClass (hab, (PSZ) szProgName, (PFNWP) ClientWndProc, CS_SIZEREDRAW|CS_CLIPCHILDREN,0L); hwndMain = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flFrameFlags, szClientClass, "Drift Warpspeed", WS_VISIBLE, 0L,ID_RESOURCE, (PHWND) &hwndClient); // generate gonio tables generate_tables(); idTimer = WinStartTimer(hab,hwndClient,ID_TIMER,31); while (WinGetMsg(hab,&qmsg,NULLHANDLE,0,0)) { WinDispatchMsg(hab,&qmsg); } save_hiscores(); if (saveonexit) save_settings(); free_all(); free_demo(); WinStopTimer(hab,hwndClient,idTimer); //WinDestroyWindow(hwndMain); WinDestroyMsgQueue(hmq); WinTerminate(hab); return (0); }
int main () { int i; for ( i = 0; i < 256; ++i ) { SBOX2[i] = SBOX[i] << 1; if ( SBOX[i] >= 128 ) { SBOX2[i] ^= CONX; } SBOX3[i] = SBOX2[i] ^ SBOX[i]; } generate_tables(); print_tables(); return 0; }
ASS_SynthPriv *ass_synth_init(double radius) { ASS_SynthPriv *priv = calloc(1, sizeof(ASS_SynthPriv)); generate_tables(priv, radius); return priv; }