19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: status.c,v 1.1.2.2 2003-08-07 13:25:16 syskin Exp $ |
* $Id: status.c,v 1.1.2.3 2004-01-22 14:43:39 syskin Exp $ |
23 |
* |
* |
24 |
*****************************************************************************/ |
*****************************************************************************/ |
25 |
|
|
34 |
|
|
35 |
#define CLR_BG 0 |
#define CLR_BG 0 |
36 |
#define CLR_FG 1 |
#define CLR_FG 1 |
37 |
#define CLR_QUANT 2 |
#define CLR_QUANT_I 2 |
38 |
|
#define CLR_QUANT_P 3 |
39 |
|
#define CLR_QUANT_B 4 |
40 |
|
|
41 |
static void set_bic(RGBQUAD * rgb, int index, int r, int g, int b) |
static void set_bic(RGBQUAD * rgb, int index, int r, int g, int b) |
42 |
{ |
{ |
60 |
|
|
61 |
if (s->count[0]>0) { |
if (s->count[0]>0) { |
62 |
for (i=0; i<31; i++) { |
for (i=0; i<31; i++) { |
63 |
unsigned int j_height = (s->height-s->tm.tmHeight)*s->quant[i]/s->max_quant_frames; |
/* i-vops */ |
64 |
if (j_height==0 && s->quant[i]>0) j_height=1; |
unsigned int j_height = (s->height-s->tm.tmHeight)*s->quant[0][i]/s->max_quant_frames; |
65 |
|
if (j_height==0 && s->quant[1][i]>0) j_height=1; |
66 |
|
|
67 |
for(j=0; j < j_height; j++) { |
for(j=0; j < j_height; j++) { |
68 |
memset(s->buffer + (s->tm.tmHeight+j)*s->stride + i*s->width31 + 1, |
memset(s->buffer + (s->tm.tmHeight+j)*s->stride + i*s->width31 + 1, |
69 |
CLR_QUANT, s->width31-1); |
CLR_QUANT_I, s->width31-1); |
70 |
|
} |
71 |
|
/* p/s-vops */ |
72 |
|
j_height += (s->height-s->tm.tmHeight)*s->quant[1][i]/s->max_quant_frames; |
73 |
|
if (j_height==0 && s->quant[1][i]>0) j_height=1; |
74 |
|
|
75 |
|
for(; j < j_height; j++) { |
76 |
|
memset(s->buffer + (s->tm.tmHeight+j)*s->stride + i*s->width31 + 1, |
77 |
|
CLR_QUANT_P, s->width31-1); |
78 |
|
} |
79 |
|
/* b-vops */ |
80 |
|
j_height += (s->height-s->tm.tmHeight)*s->quant[2][i]/s->max_quant_frames; |
81 |
|
if (j_height==0 && s->quant[2][i]>0) j_height=1; |
82 |
|
|
83 |
|
for(; j < j_height; j++) { |
84 |
|
memset(s->buffer + (s->tm.tmHeight+j)*s->stride + i*s->width31 + 1, |
85 |
|
CLR_QUANT_B, s->width31-1); |
86 |
} |
} |
87 |
} |
} |
88 |
} |
} |
134 |
|
|
135 |
set_bic(s->bi->bmiColors, CLR_BG, 0, 0, 0); |
set_bic(s->bi->bmiColors, CLR_BG, 0, 0, 0); |
136 |
set_bic(s->bi->bmiColors, CLR_FG, 128, 128, 128); |
set_bic(s->bi->bmiColors, CLR_FG, 128, 128, 128); |
137 |
set_bic(s->bi->bmiColors, CLR_QUANT, 0, 255, 0); |
set_bic(s->bi->bmiColors, CLR_QUANT_I, 255, 0, 0); |
138 |
|
set_bic(s->bi->bmiColors, CLR_QUANT_P, 0, 0, 255); |
139 |
|
set_bic(s->bi->bmiColors, CLR_QUANT_B, 0, 192, 0); |
140 |
|
|
141 |
SelectObject(s->hDc, GetStockObject(SYSTEM_FONT)); |
SelectObject(s->hDc, GetStockObject(SYSTEM_FONT)); |
142 |
SetBkColor(s->hDc, *(DWORD*)&s->bi->bmiColors[CLR_BG]); |
SetBkColor(s->hDc, *(DWORD*)&s->bi->bmiColors[CLR_BG]); |
220 |
SetDlgItemInt(hDlg, IDC_STATUS_L_TOT, s->tot_length[0]/1024, FALSE); |
SetDlgItemInt(hDlg, IDC_STATUS_L_TOT, s->tot_length[0]/1024, FALSE); |
221 |
|
|
222 |
if (s->count[0]>0) { |
if (s->count[0]>0) { |
223 |
unsigned int kbits = 8*s->tot_length[0]/1000; |
uint64_t kbits = 8*s->tot_length[0]/1000; |
224 |
double secs = (double)s->count[0]/s->fps; |
double secs = (double)s->count[0]/s->fps; |
225 |
SetDlgItemInt(hDlg, IDC_STATUS_KBPS, (int)(kbits/secs), FALSE); |
SetDlgItemInt(hDlg, IDC_STATUS_KBPS, (int)(kbits/secs), FALSE); |
226 |
}else{ |
}else{ |
279 |
for (i=0; i<4; i++) { |
for (i=0; i<4; i++) { |
280 |
s->count[i] = 0; |
s->count[i] = 0; |
281 |
s->min_quant[i] = s->max_quant[i] = 0; |
s->min_quant[i] = s->max_quant[i] = 0; |
282 |
s->min_length[i] = s->max_length[i] = s->tot_length[i] = 0; |
s->min_length[i] = s->max_length[i] = 0; |
283 |
|
s->tot_length[i] = 0; |
284 |
} |
} |
285 |
|
|
286 |
s->hDlg = CreateDialogParam(g_hInst, |
s->hDlg = CreateDialogParam(g_hInst, |
304 |
if (s->min_quant[type]==0 || quant<s->min_quant[type]) s->min_quant[type] = quant; |
if (s->min_quant[type]==0 || quant<s->min_quant[type]) s->min_quant[type] = quant; |
305 |
if (s->max_quant[type]==0|| quant>s->max_quant[type]) s->max_quant[type] = quant; |
if (s->max_quant[type]==0|| quant>s->max_quant[type]) s->max_quant[type] = quant; |
306 |
|
|
307 |
s->quant[quant-1]++; |
s->quant[type-1][quant-1]++; |
308 |
if (s->quant[quant-1]>s->max_quant_frames) |
if (s->quant[0][quant-1] + s->quant[1][quant-1] + s->quant[2][quant-1] > s->max_quant_frames) |
309 |
s->max_quant_frames = s->quant[quant-1]; |
s->max_quant_frames = s->quant[0][quant-1] + s->quant[1][quant-1] + s->quant[2][quant-1]; |
310 |
|
|
311 |
if (s->min_length[0]==0 || length<s->min_length[0]) s->min_length[0] = length; |
if (s->min_length[0]==0 || length<s->min_length[0]) s->min_length[0] = length; |
312 |
if (s->max_length[0]==0 || length>s->max_length[0]) s->max_length[0] = length; |
if (s->max_length[0]==0 || length>s->max_length[0]) s->max_length[0] = length; |