comparison libass/ass_bitmap.c @ 19955:2792de2ca069

Cosmetics. Change indentation of block of code to make it consistent with the rest of the file.
author eugeni
date Sat, 23 Sep 2006 17:54:24 +0000
parents 66d444e5ec8d
children 5f268ded7f6a
comparison
equal deleted inserted replaced
19954:f3f751f50ccf 19955:2792de2ca069
24 static const unsigned base = 256; 24 static const unsigned base = 256;
25 static const double blur_radius = 1.5; 25 static const double blur_radius = 1.5;
26 26
27 static int generate_tables(ass_synth_priv_t* priv, double radius) 27 static int generate_tables(ass_synth_priv_t* priv, double radius)
28 { 28 {
29 double A = log(1.0/base)/(radius*radius*2); 29 double A = log(1.0/base)/(radius*radius*2);
30 int mx, i; 30 int mx, i;
31 double volume_diff, volume_factor = 0; 31 double volume_diff, volume_factor = 0;
32 unsigned volume; 32 unsigned volume;
33 33
34 priv->g_r = ceil(radius); 34 priv->g_r = ceil(radius);
35 priv->g_w = 2*priv->g_r+1; 35 priv->g_w = 2*priv->g_r+1;
36 36
37 if (priv->g_r) { 37 if (priv->g_r) {
38 priv->g = malloc(priv->g_w * sizeof(unsigned)); 38 priv->g = malloc(priv->g_w * sizeof(unsigned));
39 priv->gt2 = malloc(256 * priv->g_w * sizeof(unsigned)); 39 priv->gt2 = malloc(256 * priv->g_w * sizeof(unsigned));
40 if (priv->g==NULL || priv->gt2==NULL) { 40 if (priv->g==NULL || priv->gt2==NULL) {
41 return -1; 41 return -1;
42 } 42 }
43 } 43 }
44 44
45 if (priv->g_r) { 45 if (priv->g_r) {
46 // gaussian curve with volume = 256 46 // gaussian curve with volume = 256
47 for (volume_diff=10000000; volume_diff>0.0000001; volume_diff*=0.5){ 47 for (volume_diff=10000000; volume_diff>0.0000001; volume_diff*=0.5){
48 volume_factor+= volume_diff; 48 volume_factor+= volume_diff;
49 volume=0; 49 volume=0;
50 for (i = 0; i<priv->g_w; ++i) { 50 for (i = 0; i<priv->g_w; ++i) {
51 priv->g[i] = (unsigned)(exp(A * (i-priv->g_r)*(i-priv->g_r)) * volume_factor + .5); 51 priv->g[i] = (unsigned)(exp(A * (i-priv->g_r)*(i-priv->g_r)) * volume_factor + .5);
52 volume+= priv->g[i]; 52 volume+= priv->g[i];
53 } 53 }
54 if(volume>256) volume_factor-= volume_diff; 54 if(volume>256) volume_factor-= volume_diff;
55 } 55 }
56 volume=0; 56 volume=0;
57 for (i = 0; i<priv->g_w; ++i) { 57 for (i = 0; i<priv->g_w; ++i) {
58 priv->g[i] = (unsigned)(exp(A * (i-priv->g_r)*(i-priv->g_r)) * volume_factor + .5); 58 priv->g[i] = (unsigned)(exp(A * (i-priv->g_r)*(i-priv->g_r)) * volume_factor + .5);
59 volume+= priv->g[i]; 59 volume+= priv->g[i];
60 } 60 }
61 61
62 // gauss table: 62 // gauss table:
63 for(mx=0;mx<priv->g_w;mx++){ 63 for(mx=0;mx<priv->g_w;mx++){
64 for(i=0;i<256;i++){ 64 for(i=0;i<256;i++){
65 priv->gt2[mx+i*priv->g_w] = i*priv->g[mx]; 65 priv->gt2[mx+i*priv->g_w] = i*priv->g[mx];
66 } 66 }
67 } 67 }
68 } 68 }
69 69
70 return 0; 70 return 0;
71 } 71 }
72 72
73 static void resize_tmp(ass_synth_priv_t* priv, int w, int h) 73 static void resize_tmp(ass_synth_priv_t* priv, int w, int h)
74 { 74 {
75 if (priv->tmp_w >= w && priv->tmp_h >= h) 75 if (priv->tmp_w >= w && priv->tmp_h >= h)