00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "contributors.h"
00014
00015 #include <time.h>
00016 #include <math.h>
00017
00018 #include "global.h"
00019 #include "context_ini.h"
00020 #include "explicit_gop.h"
00021 #include "filehandle.h"
00022 #include "fmo.h"
00023 #include "image.h"
00024 #include "intrarefresh.h"
00025 #include "leaky_bucket.h"
00026 #include "me_epzs.h"
00027 #include "me_epzs_int.h"
00028 #include "output.h"
00029 #include "parset.h"
00030 #include "report.h"
00031
00032 static const char DistortionType[3][20] = {"SAD", "SSE", "Hadamard SAD"};
00033
00034 void report_log_mode (ImageParameters *p_Img, InputParameters *p_Inp, StatParameters *p_Stats);
00035
00036
00037
00038
00039
00040
00041 void report_frame_statistic(ImageParameters *p_Img, InputParameters *p_Inp)
00042 {
00043 DistortionParams *p_Dist = p_Img->p_Dist;
00044 FILE *p_stat_frm = NULL;
00045 static int64 last_bit_ctr_n = 0;
00046 int i;
00047 char name[30];
00048 int bitcounter;
00049 StatParameters *cur_stats = &p_Img->enc_picture->stats;
00050
00051 #ifndef WIN32
00052 time_t now;
00053 struct tm *l_time;
00054 char string[1000];
00055 #else
00056 char timebuf[128];
00057 #endif
00058
00059
00060 if ((p_stat_frm = fopen("stat_frame.dat", "r")) == 0)
00061 {
00062 if ((p_stat_frm = fopen("stat_frame.dat", "a")) == NULL)
00063 {
00064 snprintf(errortext, ET_SIZE, "Error open file %s \n", "stat_frame.dat.dat");
00065 error(errortext, 500);
00066 }
00067 else
00068 {
00069 fprintf(p_stat_frm, " --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
00070 fprintf(p_stat_frm, "| Encoder statistics. This file is generated during first encoding session, new sessions will be appended |\n");
00071 fprintf(p_stat_frm, " --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
00072 }
00073 }
00074 else
00075 {
00076 fclose (p_stat_frm);
00077 if ((p_stat_frm = fopen("stat_frame.dat", "a")) == NULL)
00078 {
00079 snprintf(errortext, ET_SIZE, "Error open file %s \n", "stat_frame.dat.dat");
00080 error(errortext, 500);
00081 }
00082 }
00083
00084 if (p_Img->frame_statistic_start)
00085 {
00086 fprintf(p_stat_frm, "| ver | Date | Time | Sequence |Frm | QP |P/MbInt| Bits | SNRY | SNRU | SNRV | I4 | I8 | I16 | IC0 | IC1 | IC2 | IC3 | PI4 | PI8 | PI16 | P0 | P1 | P2 | P3 | P1*4*| P1*8*| P2*4*| P2*8*| P3*4*| P3*8*| P8 | P8:4 | P4*4*| P4*8*| P8:5 | P8:6 | P8:7 | BI4 | BI8 | BI16 | B0 | B1 | B2 | B3 | B0*4*| B0*8*| B1*4*| B1*8*| B2*4*| B2*8*| B3*4*| B3*8*| B8 | B8:0 |B80*4*|B80*8*| B8:4 | B4*4*| B4*8*| B8:5 | B8:6 | B8:7 |\n");
00087 fprintf(p_stat_frm, " ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ \n");
00088 }
00089
00090
00091 fprintf(p_stat_frm, "|%4s/%s", VERSION, EXT_VERSION);
00092
00093 #ifdef WIN32
00094 _strdate( timebuf );
00095 fprintf(p_stat_frm, "| %1.5s |", timebuf);
00096
00097 _strtime( timebuf);
00098 fprintf(p_stat_frm, " % 1.5s |", timebuf);
00099 #else
00100 now = time ((time_t *) NULL);
00101 time (&now);
00102 l_time = localtime (&now);
00103 strftime (string, sizeof string, "%d-%b-%Y", l_time);
00104 fprintf(p_stat_frm, "| %1.5s |", string );
00105
00106 strftime (string, sizeof string, "%H:%M:%S", l_time);
00107 fprintf(p_stat_frm, " %1.5s |", string);
00108 #endif
00109
00110 for (i=0;i<30;i++)
00111 name[i]=p_Inp->input_file1.fname[i + imax(0,(int) (strlen(p_Inp->input_file1.fname)- 30))];
00112
00113 fprintf(p_stat_frm, "%30.30s|", name);
00114 fprintf(p_stat_frm, "%3d |", p_Img->frame_no);
00115 fprintf(p_stat_frm, "%3d |", p_Img->qp);
00116 fprintf(p_stat_frm, " %d/%d |", p_Inp->PicInterlace, p_Inp->MbInterlace);
00117
00118
00119 if (p_Img->frm_number == 0 && p_Img->frame_num == 0)
00120 {
00121 bitcounter = (int) p_Img->p_Stats->bit_counter[I_SLICE];
00122 }
00123 else
00124 {
00125 bitcounter = (int) (p_Img->p_Stats->bit_ctr_n - last_bit_ctr_n);
00126 last_bit_ctr_n = p_Img->p_Stats->bit_ctr_n;
00127 }
00128
00129
00130 fprintf(p_stat_frm, " %9d|", bitcounter);
00131
00132
00133 fprintf(p_stat_frm, " %2.4f| %2.4f| %2.4f|", p_Dist->metric[PSNR].value[0], p_Dist->metric[PSNR].value[1], p_Dist->metric[PSNR].value[2]);
00134
00135
00136
00137 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[I_SLICE][I4MB ]);
00138 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[I_SLICE][I8MB ]);
00139 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[I_SLICE][I16MB]);
00140
00141
00142 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->intra_chroma_mode[0]);
00143 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->intra_chroma_mode[1]);
00144 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->intra_chroma_mode[2]);
00145 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->intra_chroma_mode[3]);
00146
00147
00148 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][I4MB ]);
00149 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][I8MB ]);
00150 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][I16MB]);
00151 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][0 ]);
00152
00153 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][1 ]);
00154 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][2 ]);
00155 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][3 ]);
00156
00157 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][1][0]);
00158 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][1][1]);
00159 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][2][0]);
00160 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][2][1]);
00161 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][3][0]);
00162 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][3][1]);
00163
00164 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][P8x8 ]);
00165 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][4 ]);
00166 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][4][0]);
00167 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[P_SLICE][4][1]);
00168 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][5 ]);
00169 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][6 ]);
00170 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[P_SLICE][7 ]);
00171
00172
00173 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][I4MB ]);
00174 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][I8MB ]);
00175 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][I16MB]);
00176 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][0 ]);
00177 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][1 ]);
00178 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][2 ]);
00179 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][3 ]);
00180 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][0][0]);
00181 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][0][1]);
00182 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][1][0]);
00183 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][1][1]);
00184 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][2][0]);
00185 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][2][1]);
00186 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][3][0]);
00187 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][3][1]);
00188
00189 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][P8x8]);
00190 fprintf(p_stat_frm, " %d|", (cur_stats->b8_mode_0_use [B_SLICE][0] + cur_stats->b8_mode_0_use [B_SLICE][1]));
00191 fprintf(p_stat_frm, " %5d|", cur_stats->b8_mode_0_use [B_SLICE][0]);
00192 fprintf(p_stat_frm, " %5d|", cur_stats->b8_mode_0_use [B_SLICE][1]);
00193 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][4 ]);
00194 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][4][0]);
00195 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use_transform[B_SLICE][4][1]);
00196 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][5 ]);
00197 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][6 ]);
00198 fprintf(p_stat_frm, " %5" FORMAT_OFF_T "|", cur_stats->mode_use[B_SLICE][7 ]);
00199
00200 fprintf(p_stat_frm, "\n");
00201
00202
00203 p_Img->frame_statistic_start = 0;
00204 fclose(p_stat_frm);
00205 }
00206
00207
00208 double report_slice_pred_stats(FILE *p_stat, StatParameters *p_Stats, int slice_type, double bit_use, char *slice_name)
00209 {
00210 fprintf(p_stat,"\n ---------------------|----------------|-----------------|");
00211 fprintf(p_stat,"\n %8s | Mode used | MotionInfo bits |", slice_name);
00212 fprintf(p_stat,"\n ---------------------|----------------|-----------------|");
00213 fprintf(p_stat,"\n Mode 0 (copy) | %5" FORMAT_OFF_T " | %8.2f |", p_Stats->mode_use[slice_type][0 ], (double)p_Stats->bit_use_mode[slice_type][0 ] / bit_use);
00214 fprintf(p_stat,"\n Mode 1 (16x16) | %5" FORMAT_OFF_T " | %8.2f |", p_Stats->mode_use[slice_type][1 ], (double)p_Stats->bit_use_mode[slice_type][1 ] / bit_use);
00215 fprintf(p_stat,"\n Mode 2 (16x8) | %5" FORMAT_OFF_T " | %8.2f |", p_Stats->mode_use[slice_type][2 ], (double)p_Stats->bit_use_mode[slice_type][2 ] / bit_use);
00216 fprintf(p_stat,"\n Mode 3 (8x16) | %5" FORMAT_OFF_T " | %8.2f |", p_Stats->mode_use[slice_type][3 ], (double)p_Stats->bit_use_mode[slice_type][3 ] / bit_use);
00217 fprintf(p_stat,"\n Mode 4 (8x8) | %5" FORMAT_OFF_T " | %8.2f |", p_Stats->mode_use[slice_type][P8x8], (double)p_Stats->bit_use_mode[slice_type][P8x8] / bit_use);
00218 fprintf(p_stat,"\n Mode 5 intra 4x4 | %5" FORMAT_OFF_T " |-----------------|", p_Stats->mode_use[slice_type][I4MB]);
00219 fprintf(p_stat,"\n Mode 6 intra 8x8 | %5" FORMAT_OFF_T " |", p_Stats->mode_use[slice_type][I8MB]);
00220 fprintf(p_stat,"\n Mode 7+ intra 16x16 | %5" FORMAT_OFF_T " |", p_Stats->mode_use[slice_type][I16MB]);
00221 fprintf(p_stat,"\n Mode intra IPCM | %5" FORMAT_OFF_T " |", p_Stats->mode_use[slice_type][IPCM ]);
00222
00223 return (double)(p_Stats->bit_use_mode[slice_type][0] + p_Stats->bit_use_mode[slice_type][1] + p_Stats->bit_use_mode[slice_type][2]
00224 + p_Stats->bit_use_mode[slice_type][3] + p_Stats->bit_use_mode[slice_type][P8x8]) / bit_use;
00225 }
00226
00227
00228
00229
00230
00231
00232
00233
00234 void report_stats_on_error(void)
00235 {
00236 p_Enc->p_Inp->no_frm_base = p_Enc->p_Img->frm_number;
00237 free_encoder_memory(p_Enc->p_Img, p_Enc->p_Inp);
00238 exit (-1);
00239 }
00240
00241
00242 void report_stats(ImageParameters *p_Img, InputParameters *p_Inp, StatParameters *p_Stats, int64 bit_use[NUM_SLICE_TYPES][2])
00243 {
00244 DistortionParams *p_Dist = p_Img->p_Dist;
00245 FILE *p_stat;
00246 double mean_motion_info_bit_use[NUM_SLICE_TYPES] = {0.0};
00247 int i;
00248
00249 if (strlen(p_Inp->StatsFile) == 0)
00250 strcpy (p_Inp->StatsFile,"stats.dat");
00251
00252 if ((p_stat = fopen(p_Inp->StatsFile, "wt")) == 0)
00253 {
00254 snprintf(errortext, ET_SIZE, "Error open file %s", p_Inp->StatsFile);
00255 error(errortext, 500);
00256 }
00257
00258 fprintf(p_stat," -------------------------------------------------------------- \n");
00259 fprintf(p_stat," This file contains statistics for the last encoded sequence \n");
00260 fprintf(p_stat," -------------------------------------------------------------- \n");
00261 fprintf(p_stat, " Sequence : %s\n", p_Inp->input_file1.fname);
00262
00263
00264 fprintf(p_stat, " No.of coded pictures : %4d\n", p_Stats->frame_counter);
00265 fprintf(p_stat, " Freq. for encoded bitstream : %4.0f\n", p_Inp->output.frame_rate);
00266
00267 fprintf(p_stat, " I Slice Bitrate(kb/s) : %6.2f\n", p_Stats->bitrate_st[I_SLICE] / 1000.0);
00268 fprintf(p_stat, " P Slice Bitrate(kb/s) : %6.2f\n", p_Stats->bitrate_st[P_SLICE] / 1000.0);
00269 fprintf(p_stat, " B Slice Bitrate(kb/s) : %6.2f\n", p_Stats->bitrate_st[B_SLICE] / 1000.0);
00270 fprintf(p_stat, " Total Bitrate(kb/s) : %6.2f\n", p_Stats->bitrate / 1000.0);
00271
00272 for (i = 0; i < 3; i++)
00273 {
00274 fprintf(p_stat," ME Level %1d Metric : %s\n", i, DistortionType[p_Inp->MEErrorMetric[i]]);
00275 }
00276 fprintf(p_stat," Mode Decision Metric : %s\n", DistortionType[p_Inp->ModeDecisionMetric]);
00277
00278 switch ( p_Inp->ChromaMEEnable )
00279 {
00280 case 1:
00281 fprintf(p_stat," ME for components : YCbCr\n");
00282 break;
00283 default:
00284 fprintf(p_stat," ME for components : Y\n");
00285 break;
00286 }
00287
00288 fprintf(p_stat, " Image format : %dx%d\n", p_Inp->output.width, p_Inp->output.height);
00289
00290 if (p_Inp->intra_upd)
00291 fprintf(p_stat," Error robustness : On\n");
00292 else
00293 fprintf(p_stat," Error robustness : Off\n");
00294
00295 fprintf(p_stat, " Search range : %d\n", p_Inp->search_range);
00296
00297 fprintf(p_stat, " Total number of references : %d\n", p_Inp->num_ref_frames);
00298 fprintf(p_stat, " References for P slices : %d\n", p_Inp->P_List0_refs ? p_Inp->P_List0_refs : p_Inp->num_ref_frames);
00299
00300 if (p_Stats->frame_ctr[B_SLICE]!=0)
00301 {
00302 fprintf(p_stat, " List0 refs for B slices : %d\n", p_Inp->B_List0_refs ? p_Inp->B_List0_refs : p_Inp->num_ref_frames);
00303 fprintf(p_stat, " List1 refs for B slices : %d\n", p_Inp->B_List1_refs ? p_Inp->B_List1_refs : p_Inp->num_ref_frames);
00304 }
00305
00306 fprintf(p_stat, " Profile/Level IDC : (%d,%d)\n", p_Inp->ProfileIDC, p_Inp->LevelIDC);
00307 if (p_Inp->symbol_mode == CAVLC)
00308 fprintf(p_stat, " Entropy coding method : CAVLC\n");
00309 else
00310 fprintf(p_stat, " Entropy coding method : CABAC\n");
00311
00312 if (p_Inp->MbInterlace)
00313 fprintf(p_stat, " MB Field Coding : On \n");
00314
00315 if (p_Inp->SearchMode == EPZS)
00316 EPZSOutputStats(p_Inp, p_stat, 1);
00317
00318 if (p_Inp->full_search == 2)
00319 fprintf(p_stat," Search range restrictions : none\n");
00320 else if (p_Inp->full_search == 1)
00321 fprintf(p_stat," Search range restrictions : older reference frames\n");
00322 else
00323 fprintf(p_stat," Search range restrictions : smaller blocks and older reference frames\n");
00324
00325 if (p_Inp->rdopt)
00326 fprintf(p_stat," RD-optimized mode decision : used\n");
00327 else
00328 fprintf(p_stat," RD-optimized mode decision : not used\n");
00329
00330 fprintf(p_stat,"\n ---------------------|----------------|---------------|");
00331 fprintf(p_stat,"\n Item | Intra | All frames |");
00332 fprintf(p_stat,"\n ---------------------|----------------|---------------|");
00333 fprintf(p_stat,"\n SNR Y(dB) |");
00334 fprintf(p_stat," %5.2f |", p_Dist->metric[PSNR].avslice[I_SLICE][0]);
00335 fprintf(p_stat," %5.2f |", p_Dist->metric[PSNR].average[0]);
00336 fprintf(p_stat,"\n SNR U/V (dB) |");
00337 fprintf(p_stat," %5.2f/%5.2f |", p_Dist->metric[PSNR].avslice[I_SLICE][1], p_Dist->metric[PSNR].avslice[I_SLICE][2]);
00338 fprintf(p_stat," %5.2f/%5.2f |", p_Dist->metric[PSNR].average[1], p_Dist->metric[PSNR].average[2]);
00339 fprintf(p_stat,"\n ---------------------|----------------|---------------|");
00340 fprintf(p_stat,"\n");
00341
00342 fprintf(p_stat,"\n ---------------------|----------------|---------------|---------------|");
00343 fprintf(p_stat,"\n SNR | I | P | B |");
00344 fprintf(p_stat,"\n ---------------------|----------------|---------------|---------------|");
00345 fprintf(p_stat,"\n SNR Y(dB) | %5.3f | %5.3f | %5.3f |",
00346 p_Dist->metric[PSNR].avslice[I_SLICE][0], p_Dist->metric[PSNR].avslice[P_SLICE][0], p_Dist->metric[PSNR].avslice[B_SLICE][0]);
00347 fprintf(p_stat,"\n SNR U(dB) | %5.3f | %5.3f | %5.3f |",
00348 p_Dist->metric[PSNR].avslice[I_SLICE][1], p_Dist->metric[PSNR].avslice[P_SLICE][1], p_Dist->metric[PSNR].avslice[B_SLICE][1]);
00349 fprintf(p_stat,"\n SNR V(dB) | %5.3f | %5.3f | %5.3f |",
00350 p_Dist->metric[PSNR].avslice[I_SLICE][2], p_Dist->metric[PSNR].avslice[P_SLICE][2], p_Dist->metric[PSNR].avslice[B_SLICE][2]);
00351 fprintf(p_stat,"\n ---------------------|----------------|---------------|---------------|");
00352 fprintf(p_stat,"\n");
00353
00354
00355 fprintf(p_stat,"\n ---------------------|----------------|---------------|---------------|");
00356 fprintf(p_stat,"\n Ave Quant | I | P | B |");
00357 fprintf(p_stat,"\n ---------------------|----------------|---------------|---------------|");
00358 fprintf(p_stat,"\n QP | %5.3f | %5.3f | %5.3f |",
00359 (float)p_Stats->quant[I_SLICE]/dmax(1.0,(float)p_Stats->num_macroblocks[I_SLICE]),
00360 (float)p_Stats->quant[P_SLICE]/dmax(1.0,(float)p_Stats->num_macroblocks[P_SLICE]),
00361 (float)p_Stats->quant[B_SLICE]/dmax(1.0,(float)p_Stats->num_macroblocks[B_SLICE]));
00362 fprintf(p_stat,"\n ---------------------|----------------|---------------|---------------|");
00363 fprintf(p_stat,"\n");
00364
00365
00366 fprintf(p_stat,"\n ---------------------|----------------|");
00367 fprintf(p_stat,"\n Intra | Mode used |");
00368 fprintf(p_stat,"\n ---------------------|----------------|");
00369 fprintf(p_stat,"\n Mode 0 intra 4x4 | %5" FORMAT_OFF_T " |", p_Stats->mode_use[I_SLICE][I4MB ]);
00370 fprintf(p_stat,"\n Mode 1 intra 8x8 | %5" FORMAT_OFF_T " |", p_Stats->mode_use[I_SLICE][I8MB ]);
00371 fprintf(p_stat,"\n Mode 2+ intra 16x16 | %5" FORMAT_OFF_T " |", p_Stats->mode_use[I_SLICE][I16MB]);
00372 fprintf(p_stat,"\n Mode intra IPCM | %5" FORMAT_OFF_T " |", p_Stats->mode_use[I_SLICE][IPCM ]);
00373
00374
00375 if (p_Stats->frame_ctr[P_SLICE]!=0)
00376 {
00377 mean_motion_info_bit_use[P_SLICE] = report_slice_pred_stats(p_stat, p_Stats, P_SLICE,(double) bit_use[P_SLICE][0], "P Slice ");
00378 }
00379
00380 if (p_Stats->frame_ctr[B_SLICE]!=0)
00381 {
00382 mean_motion_info_bit_use[B_SLICE] = report_slice_pred_stats(p_stat, p_Stats, B_SLICE,(double) bit_use[B_SLICE][0], "B Slice ");
00383 }
00384
00385 if (p_Stats->frame_ctr[SP_SLICE]!=0)
00386 {
00387 mean_motion_info_bit_use[SP_SLICE] = report_slice_pred_stats(p_stat, p_Stats, SP_SLICE,(double) bit_use[SP_SLICE][0], "SP Slice");
00388 }
00389
00390
00391 fprintf(p_stat,"\n ---------------------|----------------|");
00392 fprintf(p_stat,"\n");
00393
00394 fprintf(p_stat,"\n ---------------------|----------------|----------------|----------------|");
00395 fprintf(p_stat,"\n Bit usage: | Intra | Inter | B frame |");
00396 fprintf(p_stat,"\n ---------------------|----------------|----------------|----------------|");
00397
00398 fprintf(p_stat,"\n Header |");
00399 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_header[I_SLICE] / bit_use[I_SLICE][0]);
00400 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_header[P_SLICE] / bit_use[P_SLICE][0]);
00401 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_header[B_SLICE] / bit_use[B_SLICE][0]);
00402
00403 fprintf(p_stat,"\n Mode |");
00404 fprintf(p_stat," %10.2f |", (float)p_Stats->bit_use_mb_type[I_SLICE] / bit_use[I_SLICE][0]);
00405 fprintf(p_stat," %10.2f |", (float)p_Stats->bit_use_mb_type[P_SLICE] / bit_use[P_SLICE][0]);
00406 fprintf(p_stat," %10.2f |", (float)p_Stats->bit_use_mb_type[B_SLICE] / bit_use[B_SLICE][0]);
00407
00408 fprintf(p_stat,"\n Motion Info |");
00409 fprintf(p_stat," ./. |");
00410 fprintf(p_stat," %10.2f |", mean_motion_info_bit_use[P_SLICE]);
00411 fprintf(p_stat," %10.2f |", mean_motion_info_bit_use[B_SLICE]);
00412
00413 fprintf(p_stat,"\n CBP Y/C |");
00414 fprintf(p_stat," %10.2f |", (float) p_Stats->tmp_bit_use_cbp[I_SLICE] / bit_use[I_SLICE][0]);
00415 fprintf(p_stat," %10.2f |", (float) p_Stats->tmp_bit_use_cbp[P_SLICE] / bit_use[P_SLICE][0]);
00416 fprintf(p_stat," %10.2f |", (float) p_Stats->tmp_bit_use_cbp[B_SLICE] / bit_use[B_SLICE][0]);
00417
00418 fprintf(p_stat,"\n Coeffs. Y |");
00419 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[0][I_SLICE] / bit_use[I_SLICE][0]);
00420 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[0][P_SLICE] / bit_use[P_SLICE][0]);
00421 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[0][B_SLICE] / bit_use[B_SLICE][0]);
00422
00423 fprintf(p_stat,"\n Coeffs. C |");
00424 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeffC[I_SLICE] / bit_use[I_SLICE][0]);
00425 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeffC[P_SLICE] / bit_use[P_SLICE][0]);
00426 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeffC[B_SLICE] / bit_use[B_SLICE][0]);
00427
00428 fprintf(p_stat,"\n Coeffs. CB |");
00429 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[1][I_SLICE] / bit_use[I_SLICE][0]);
00430 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[1][P_SLICE] / bit_use[P_SLICE][0]);
00431 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[1][B_SLICE] / bit_use[B_SLICE][0]);
00432
00433 fprintf(p_stat,"\n Coeffs. CB |");
00434 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[2][I_SLICE] / bit_use[I_SLICE][0]);
00435 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[2][P_SLICE] / bit_use[P_SLICE][0]);
00436 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_coeff[2][B_SLICE] / bit_use[B_SLICE][0]);
00437
00438 fprintf(p_stat,"\n Delta quant |");
00439 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_delta_quant[I_SLICE] / bit_use[I_SLICE][0]);
00440 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_delta_quant[P_SLICE] / bit_use[P_SLICE][0]);
00441 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_delta_quant[B_SLICE] / bit_use[B_SLICE][0]);
00442
00443 fprintf(p_stat,"\n Stuffing Bits |");
00444 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_stuffingBits[I_SLICE] / bit_use[I_SLICE][0]);
00445 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_stuffingBits[P_SLICE] / bit_use[P_SLICE][0]);
00446 fprintf(p_stat," %10.2f |", (float) p_Stats->bit_use_stuffingBits[B_SLICE] / bit_use[B_SLICE][0]);
00447
00448 fprintf(p_stat,"\n ---------------------|----------------|----------------|----------------|");
00449 fprintf(p_stat,"\n average bits/frame |");
00450 fprintf(p_stat," %10.2f |", (float) bit_use[I_SLICE][1] / (float) bit_use[I_SLICE][0] );
00451 fprintf(p_stat," %10.2f |", (float) bit_use[P_SLICE][1] / (float) bit_use[P_SLICE][0] );
00452 fprintf(p_stat," %10.2f |", (float) bit_use[B_SLICE][1] / (float) bit_use[B_SLICE][0] );
00453 fprintf(p_stat,"\n ---------------------|----------------|----------------|----------------|");
00454 fprintf(p_stat,"\n");
00455
00456 fclose(p_stat);
00457 }
00458
00459
00460 void report_log(ImageParameters *p_Img, InputParameters *p_Inp, StatParameters *p_Stats)
00461 {
00462 DistortionParams *p_Dist = p_Img->p_Dist;
00463 FILE *p_log = p_Img->p_log;
00464 char name[40];
00465 int i;
00466 #ifndef WIN32
00467 time_t now;
00468 struct tm *l_time;
00469 char string[1000];
00470 #else
00471 char timebuf[128];
00472 #endif
00473
00474 if ((p_log = fopen("log.dat", "r")) == 0)
00475 {
00476 if ((p_log = fopen("log.dat", "a")) == NULL)
00477 {
00478 snprintf(errortext, ET_SIZE, "Error open file %s \n", "log.dat");
00479 error(errortext, 500);
00480 }
00481 else
00482 {
00483 fprintf(p_log," ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ \n");
00484 fprintf(p_log,"| Encoder statistics. This file is generated during first encoding session, new sessions will be appended |\n");
00485 fprintf(p_log," ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ \n");
00486 fprintf(p_log,"| ver | Date | Time | Sequence | #Img |P/MbInt| QPI| QPP| QPB| Format |Iperiod| #B | FMES | Hdmd | S.R |#Ref | Freq |Coding|RD-opt|Intra upd|8x8Tr| SNRY 1| SNRU 1| SNRV 1| SNRY N| SNRU N| SNRV N|#Bitr I|#Bitr P|#Bitr B|#Bitr IPB| Total Time | Me Time |\n");
00487 fprintf(p_log," ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ \n");
00488
00489 }
00490 }
00491 else
00492 {
00493 fclose (p_log);
00494 if ((p_log = fopen("log.dat", "a")) == NULL)
00495 {
00496 snprintf(errortext, ET_SIZE, "Error open file %s \n", "log.dat");
00497 error(errortext, 500);
00498 }
00499 }
00500 fprintf(p_log,"|%5s/%-5s", VERSION, EXT_VERSION);
00501
00502 #ifdef WIN32
00503 _strdate( timebuf );
00504 fprintf(p_log,"| %1.5s |", timebuf );
00505
00506 _strtime( timebuf);
00507 fprintf(p_log," % 1.5s |", timebuf);
00508 #else
00509 now = time ((time_t *) NULL);
00510 time (&now);
00511 l_time = localtime (&now);
00512 strftime (string, sizeof string, "%d-%b-%Y", l_time);
00513 fprintf(p_log,"| %1.5s |", string );
00514
00515 strftime (string, sizeof string, "%H:%M:%S", l_time);
00516 fprintf(p_log," %1.5s |", string );
00517 #endif
00518
00519 for (i=0; i < 40; i++)
00520 name[i] = p_Inp->input_file1.fname[i + imax(0, ((int) strlen(p_Inp->input_file1.fname)) - 40)];
00521 fprintf(p_log,"%40.40s|",name);
00522
00523 fprintf(p_log,"%5d | %d/%d |", p_Inp->no_frames, p_Inp->PicInterlace, p_Inp->MbInterlace);
00524 fprintf(p_log," %-3d| %-3d| %-3d|", p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE], p_Inp->qp[0][B_SLICE]);
00525
00526 fprintf(p_log,"%4dx%-4d|", p_Inp->output.width, p_Inp->output.height);
00527 fprintf(p_log," %3d |%3d |", p_Inp->intra_period, p_Stats->NumberBFrames);
00528
00529
00530 switch( p_Inp->SearchMode )
00531 {
00532 case UM_HEX:
00533 fprintf(p_log," HEX |");
00534 break;
00535 case UM_HEX_SIMPLE:
00536 fprintf(p_log," SHEX |");
00537 break;
00538 case EPZS:
00539 fprintf(p_log," EPZS |");
00540 break;
00541 case FAST_FULL_SEARCH:
00542 fprintf(p_log," FFS |");
00543 break;
00544 default:
00545 fprintf(p_log," FS |");
00546 break;
00547 }
00548
00549 fprintf(p_log," %1d%1d%1d |", p_Inp->MEErrorMetric[F_PEL], p_Inp->MEErrorMetric[H_PEL], p_Inp->MEErrorMetric[Q_PEL]);
00550
00551 fprintf(p_log," %3d | %2d |", p_Inp->search_range, p_Inp->num_ref_frames );
00552
00553 fprintf(p_log," %5.2f|", p_Img->framerate);
00554
00555 if (p_Inp->symbol_mode == CAVLC)
00556 fprintf(p_log," CAVLC|");
00557 else
00558 fprintf(p_log," CABAC|");
00559
00560 fprintf(p_log," %d |", p_Inp->rdopt);
00561
00562 if (p_Inp->intra_upd == 1)
00563 fprintf(p_log," ON |");
00564 else
00565 fprintf(p_log," OFF |");
00566
00567 fprintf(p_log," %d |", p_Inp->Transform8x8Mode);
00568
00569 fprintf(p_log,"%7.3f|%7.3f|%7.3f|",
00570 p_Dist->metric[PSNR].avslice[I_SLICE][0],
00571 p_Dist->metric[PSNR].avslice[I_SLICE][1],
00572 p_Dist->metric[PSNR].avslice[I_SLICE][2]);
00573 fprintf(p_log,"%7.3f|%7.3f|%7.3f|", p_Dist->metric[PSNR].average[0],p_Dist->metric[PSNR].average[1],p_Dist->metric[PSNR].average[2]);
00574
00575
00576
00577
00578
00579 fprintf(p_log,"%7.0f|%7.0f|%7.0f|%9.0f|", p_Stats->bitrate_st[I_SLICE],p_Stats->bitrate_st[P_SLICE],p_Stats->bitrate_st[B_SLICE], p_Stats->bitrate);
00580 fprintf(p_log," %12d | %12d |", (int)p_Img->tot_time,(int)p_Img->me_tot_time);
00581
00582
00583 fprintf(p_log,"\n");
00584
00585 fclose(p_log);
00586
00587 p_log = fopen("data.txt", "a");
00588
00589 if ((p_Stats->NumberBFrames != 0) && (p_Stats->frame_ctr[B_SLICE] != 0))
00590 {
00591 fprintf(p_log, "%3d %2d %2d %2.2f %2.2f %2.2f %5" FORMAT_OFF_T " "
00592 "%2.2f %2.2f %2.2f %5d "
00593 "%2.2f %2.2f %2.2f %5" FORMAT_OFF_T " %5" FORMAT_OFF_T " %.3f\n",
00594 p_Stats->frame_counter, p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE],
00595 p_Dist->metric[PSNR].avslice[I_SLICE][0],
00596 p_Dist->metric[PSNR].avslice[I_SLICE][1],
00597 p_Dist->metric[PSNR].avslice[I_SLICE][2],
00598 p_Stats->bit_counter[I_SLICE],
00599 0.0,
00600 0.0,
00601 0.0,
00602 0,
00603 p_Dist->metric[PSNR].average[0],
00604 p_Dist->metric[PSNR].average[1],
00605 p_Dist->metric[PSNR].average[2],
00606 (p_Stats->bit_counter[I_SLICE] + p_Stats->bit_ctr) / p_Stats->frame_counter,
00607 p_Stats->bit_counter[B_SLICE] / p_Stats->frame_ctr[B_SLICE],
00608 (double) 0.001 * p_Img->tot_time / (p_Stats->frame_counter));
00609 }
00610 else
00611 {
00612 if (p_Inp->no_frames != 0)
00613 fprintf(p_log, "%3d %2d %2d %2.2f %2.2f %2.2f %5" FORMAT_OFF_T " "
00614 "%2.2f %2.2f %2.2f %5d "
00615 "%2.2f %2.2f %2.2f %5" FORMAT_OFF_T " %5d %.3f\n",
00616 p_Stats->frame_counter, p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE],
00617 p_Dist->metric[PSNR].avslice[I_SLICE][0],
00618 p_Dist->metric[PSNR].avslice[I_SLICE][1],
00619 p_Dist->metric[PSNR].avslice[I_SLICE][2],
00620 p_Stats->bit_counter[I_SLICE],
00621 0.0,
00622 0.0,
00623 0.0,
00624 0,
00625 p_Dist->metric[PSNR].average[0],
00626 p_Dist->metric[PSNR].average[1],
00627 p_Dist->metric[PSNR].average[2],
00628 (p_Stats->bit_counter[I_SLICE] + p_Stats->bit_ctr)/ p_Stats->frame_counter,
00629 0,
00630 (double)0.001 * p_Img->tot_time / p_Stats->frame_counter);
00631 }
00632
00633 fclose(p_log);
00634 }
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649 void report( ImageParameters *p_Img, InputParameters *p_Inp, StatParameters *p_Stats)
00650 {
00651 DistortionParams *p_Dist = p_Img->p_Dist;
00652 int64 bit_use[NUM_SLICE_TYPES][2];
00653 int i,j;
00654 int64 total_bits;
00655
00656 bit_use[ I_SLICE][0] = p_Stats->frame_ctr[I_SLICE];
00657 bit_use[ P_SLICE][0] = imax(p_Stats->frame_ctr[P_SLICE ] + p_Stats->frame_ctr[SP_SLICE], 1);
00658 bit_use[ B_SLICE][0] = imax(p_Stats->frame_ctr[B_SLICE ], 1);
00659 bit_use[SP_SLICE][0] = imax(p_Stats->frame_ctr[SP_SLICE], 1);
00660
00661
00662 p_Img->tot_time = timenorm(p_Img->tot_time);
00663 p_Img->me_tot_time = timenorm(p_Img->me_tot_time);
00664
00665
00666
00667 for (j=0; j < NUM_SLICE_TYPES; j++)
00668 {
00669 bit_use[j][1] = 0;
00670 }
00671
00672 for (j=0; j < NUM_SLICE_TYPES; j++)
00673 {
00674 for(i=0; i < MAXMODE; i++)
00675 bit_use[j][1] += p_Stats->bit_use_mode[j][i];
00676
00677 bit_use[j][1] += p_Stats->bit_use_mb_type[j];
00678 bit_use[j][1] += p_Stats->bit_use_header[j];
00679 bit_use[j][1] += p_Stats->tmp_bit_use_cbp[j];
00680 bit_use[j][1] += p_Stats->bit_use_coeffC[j];
00681 bit_use[j][1] += p_Stats->bit_use_coeff[0][j];
00682 bit_use[j][1] += p_Stats->bit_use_coeff[1][j];
00683 bit_use[j][1] += p_Stats->bit_use_coeff[2][j];
00684 bit_use[j][1] += p_Stats->bit_use_delta_quant[j];
00685 bit_use[j][1] += p_Stats->bit_use_stuffingBits[j];
00686 }
00687
00688
00689 p_Stats->bitrate_st[ I_SLICE] = (p_Stats->bit_counter[ I_SLICE]) * (float) (p_Inp->output.frame_rate) / (float) (p_Stats->frame_counter);
00690 p_Stats->bitrate_st[ P_SLICE] = (p_Stats->bit_counter[ P_SLICE]) * (float) (p_Inp->output.frame_rate) / (float) (p_Stats->frame_counter);
00691 p_Stats->bitrate_st[ B_SLICE] = (p_Stats->bit_counter[ B_SLICE]) * (float) (p_Inp->output.frame_rate) / (float) (p_Stats->frame_counter);
00692 p_Stats->bitrate_st[SP_SLICE] = (p_Stats->bit_counter[SP_SLICE]) * (float) (p_Inp->output.frame_rate) / (float) (p_Stats->frame_counter);
00693
00694 switch (p_Inp->Verbose)
00695 {
00696 case 0:
00697 case 1:
00698 default:
00699 fprintf(stdout,"------------------ Average data all frames -----------------------------------\n\n");
00700 break;
00701 case 2:
00702 fprintf(stdout,"------------------------------------ Average data all frames ---------------------------------\n\n");
00703 break;
00704 case 3:
00705 fprintf(stdout,"--------------------------------------- Average data all frames -------------------------------------\n\n");
00706 break;
00707 }
00708
00709 if (p_Inp->Verbose != 0)
00710 {
00711 DistMetric *snr = &p_Dist->metric[PSNR ];
00712 DistMetric *sse = &p_Dist->metric[SSE ];
00713 DistMetric *snr_rgb = &p_Dist->metric[PSNR_RGB];
00714 DistMetric *sse_rgb = &p_Dist->metric[SSE_RGB ];
00715
00716 int impix = p_Inp->output.size_cmp[0];
00717 int impix_cr = p_Inp->output.size_cmp[1];
00718
00719 float csnr_y = psnr(p_Img->max_imgpel_value_comp_sq[0], impix , sse->average[0]);
00720 float csnr_u = psnr(p_Img->max_imgpel_value_comp_sq[1], impix_cr, sse->average[1]);
00721 float csnr_v = psnr(p_Img->max_imgpel_value_comp_sq[2], impix_cr, sse->average[2]);
00722
00723 fprintf(stdout, " Total encoding time for the seq. : %7.3f sec (%3.2f fps)\n", (float) p_Img->tot_time * 0.001, 1000.0 * (float) (p_Stats->frame_counter) / (float)p_Img->tot_time);
00724 fprintf(stdout, " Total ME time for sequence : %7.3f sec \n\n", (float)p_Img->me_tot_time * 0.001);
00725
00726 fprintf(stdout," Y { PSNR (dB), cSNR (dB), MSE } : { %7.3f, %7.3f, %9.5f }\n",
00727 snr->average[0], csnr_y, sse->average[0]/(float)impix);
00728 fprintf(stdout," U { PSNR (dB), cSNR (dB), MSE } : { %7.3f, %7.3f, %9.5f }\n",
00729 snr->average[1], csnr_u, sse->average[1]/(float)impix_cr);
00730 fprintf(stdout," V { PSNR (dB), cSNR (dB), MSE } : { %7.3f, %7.3f, %9.5f }\n",
00731 snr->average[2], csnr_v, sse->average[2]/(float)impix_cr);
00732
00733 if(p_Inp->DistortionYUVtoRGB == 1)
00734 {
00735 float csnr_r = psnr(p_Img->max_imgpel_value_comp_sq[0], impix, sse_rgb->average[0]);
00736 float csnr_g = psnr(p_Img->max_imgpel_value_comp_sq[1], impix, sse_rgb->average[1]);
00737 float csnr_b = psnr(p_Img->max_imgpel_value_comp_sq[2], impix, sse_rgb->average[2]);
00738
00739 fprintf(stdout," R { PSNR (dB), cSNR (dB), MSE } : { %7.3f, %7.3f, %9.5f }\n",
00740 snr_rgb->average[0], csnr_r, sse_rgb->average[0] / (float) impix);
00741 fprintf(stdout," G { PSNR (dB), cSNR (dB), MSE } : { %7.3f, %7.3f, %9.5f }\n",
00742 snr_rgb->average[1], csnr_g, sse_rgb->average[1] / (float) impix);
00743 fprintf(stdout," B { PSNR (dB), cSNR (dB), MSE } : { %7.3f, %7.3f, %9.5f }\n",
00744 snr_rgb->average[2], csnr_b, sse_rgb->average[2] / (float) impix);
00745 }
00746
00747 if (p_Inp->Distortion[SSIM] == 1)
00748 {
00749 if(p_Inp->DistortionYUVtoRGB == 1)
00750 {
00751 fprintf(stdout," SSIM {Y, R} : { %5.4f, %5.4f }\n", p_Dist->metric[SSIM].average[0], p_Dist->metric[SSIM_RGB].average[0]);
00752 fprintf(stdout," SSIM {U, G} : { %5.4f, %5.4f }\n", p_Dist->metric[SSIM].average[1], p_Dist->metric[SSIM_RGB].average[1]);
00753 fprintf(stdout," SSIM {V, B} : { %5.4f, %5.4f }\n", p_Dist->metric[SSIM].average[2], p_Dist->metric[SSIM_RGB].average[2]);
00754 }
00755 else
00756 {
00757 fprintf(stdout," Y SSIM : %5.4f\n", p_Dist->metric[SSIM].average[0]);
00758 fprintf(stdout," U SSIM : %5.4f\n", p_Dist->metric[SSIM].average[1]);
00759 fprintf(stdout," V SSIM : %5.4f\n", p_Dist->metric[SSIM].average[2]);
00760 }
00761 }
00762 if (p_Inp->Distortion[MS_SSIM] == 1)
00763 {
00764 if(p_Inp->DistortionYUVtoRGB == 1)
00765 {
00766 fprintf(stdout," MS-SSIM {Y, R} : { %5.4f, %5.4f }\n", p_Dist->metric[MS_SSIM].average[0], p_Dist->metric[MS_SSIM_RGB].average[0]);
00767 fprintf(stdout," MS-SSIM {U, G} : { %5.4f, %5.4f }\n", p_Dist->metric[MS_SSIM].average[1], p_Dist->metric[MS_SSIM_RGB].average[1]);
00768 fprintf(stdout," MS-SSIM {V, B} : { %5.4f, %5.4f }\n", p_Dist->metric[MS_SSIM].average[2], p_Dist->metric[MS_SSIM_RGB].average[2]);
00769 }
00770 else
00771 {
00772 fprintf(stdout," Y MS-SSIM : %5.4f\n", p_Dist->metric[MS_SSIM].average[0]);
00773 fprintf(stdout," U MS-SSIM : %5.4f\n", p_Dist->metric[MS_SSIM].average[1]);
00774 fprintf(stdout," V MS-SSIM : %5.4f\n", p_Dist->metric[MS_SSIM].average[2]);
00775 }
00776 }
00777 fprintf(stdout,"\n");
00778 }
00779 else
00780 fprintf(stdout, " Total encoding time for the seq. : %5.3f sec (%5.2f fps)\n\n", p_Img->tot_time * 0.001, 1000.0 * (p_Stats->frame_counter) / p_Img->tot_time);
00781
00782 total_bits = p_Stats->bit_ctr_parametersets;
00783 total_bits += p_Stats->bit_ctr_filler_data;
00784 for (i = 0; i < NUM_SLICE_TYPES; i++)
00785 total_bits += p_Stats->bit_counter[i];
00786
00787 if (p_Stats->frame_ctr[B_SLICE] != 0)
00788 {
00789 fprintf(stdout, " Total bits : %" FORMAT_OFF_T " (I %" FORMAT_OFF_T ", P %" FORMAT_OFF_T ", B %" FORMAT_OFF_T " NVB %d) \n",
00790 total_bits, p_Stats->bit_counter[I_SLICE], p_Stats->bit_counter[P_SLICE], p_Stats->bit_counter[B_SLICE], p_Stats->bit_ctr_parametersets);
00791 }
00792 else if (p_Inp->sp_periodicity == 0)
00793 {
00794 fprintf(stdout, " Total bits : %" FORMAT_OFF_T " (I %" FORMAT_OFF_T ", P %" FORMAT_OFF_T ", NVB %d) \n",
00795 total_bits, p_Stats->bit_counter[I_SLICE], p_Stats->bit_counter[P_SLICE], p_Stats->bit_ctr_parametersets);
00796 }
00797 else
00798 {
00799 fprintf(stdout, " Total bits : %" FORMAT_OFF_T " (I %" FORMAT_OFF_T ", P %" FORMAT_OFF_T ", NVB %d) \n",
00800 total_bits, p_Stats->bit_counter[I_SLICE], p_Stats->bit_counter[P_SLICE], p_Stats->bit_ctr_parametersets);
00801 }
00802
00803
00804 p_Stats->bitrate= ((float) total_bits * (float) p_Inp->output.frame_rate) / ((float) (p_Stats->frame_counter));
00805 fprintf(stdout, " Bit rate (kbit/s) @ %2.2f Hz : %5.2f\n", p_Inp->output.frame_rate, p_Stats->bitrate / 1000.0);
00806
00807 for (i = 0; i < 5; i++)
00808 p_Stats->bit_ctr_emulationprevention += p_Stats->bit_use_stuffingBits[i];
00809
00810 fprintf(stdout, " Bits to avoid Startcode Emulation : %" FORMAT_OFF_T " \n", p_Stats->bit_ctr_emulationprevention);
00811 fprintf(stdout, " Bits for parameter sets : %d \n", p_Stats->bit_ctr_parametersets);
00812 fprintf(stdout, " Bits for filler data : %" FORMAT_OFF_T " \n\n", p_Stats->bit_ctr_filler_data);
00813
00814 switch (p_Inp->Verbose)
00815 {
00816 case 0:
00817 case 1:
00818 default:
00819 fprintf(stdout,"-------------------------------------------------------------------------------\n");
00820 break;
00821 case 2:
00822 fprintf(stdout,"------------------------------------------------------------------------------------------------\n");
00823 break;
00824 case 3:
00825 fprintf(stdout,"-------------------------------------------------------------------------------------------------------\n");
00826 break;
00827 }
00828 fprintf(stdout,"Exit JM %s encoder ver %s ", JM, VERSION);
00829 fprintf(stdout,"\n");
00830
00831
00832 report_stats(p_Img, p_Inp, p_Stats, bit_use);
00833
00834
00835 report_log(p_Img, p_Inp, p_Stats);
00836
00837 if (p_Inp->ReportFrameStats)
00838 {
00839 if ((p_Img->p_log = fopen("stat_frame.dat", "a")) == NULL)
00840 {
00841 snprintf(errortext, ET_SIZE, "Error open file %s \n", "stat_frame.dat.dat");
00842
00843 }
00844 else
00845 {
00846 fprintf(p_Img->p_log," --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
00847 fclose(p_Img->p_log);
00848 }
00849 report_log_mode(p_Img, p_Inp, p_Stats);
00850 }
00851 }
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864 void information_init ( ImageParameters *p_Img, InputParameters *p_Inp, StatParameters *p_Stats)
00865 {
00866 int i;
00867 static char yuv_types[4][10] = {"YUV 4:0:0", "YUV 4:2:0", "YUV 4:2:2", "YUV 4:4:4"};
00868 switch (p_Inp->Verbose)
00869 {
00870 case 0:
00871 case 1:
00872 default:
00873 printf("------------------------------- JM %4.4s %7.7s -------------------------------\n", VERSION, EXT_VERSION);
00874 break;
00875 case 2:
00876 printf("--------------------------------------- JM %4.4s %7.7s ----------------------------------------\n", VERSION, EXT_VERSION);
00877 break;
00878 case 3:
00879 printf("------------------------------------------ JM %4.4s %7.7s ------------------------------------------\n", VERSION, EXT_VERSION);
00880 break;
00881 }
00882
00883 fprintf(stdout, " Input YUV file : %s \n", p_Inp->input_file1.fname);
00884
00885 fprintf(stdout, " Output H.264 bitstream : %s \n", p_Inp->outfile);
00886 if (p_Img->p_dec != -1)
00887 fprintf(stdout, " Output YUV file : %s \n", p_Inp->ReconFile);
00888 fprintf(stdout, " YUV Format : %s \n", &yuv_types[p_Img->yuv_format][0]);
00889 fprintf(stdout, " Frames to be encoded I-P/B : %d/%d\n", p_Inp->no_frm_base, (p_Inp->NumberBFrames * (p_Inp->no_frm_base - 1)));
00890 if (p_Inp->Verbose != 0)
00891 {
00892 fprintf(stdout, " Freq. for encoded bitstream : %3.2f\n", p_Inp->output.frame_rate);
00893 fprintf(stdout, " PicInterlace / MbInterlace : %d/%d\n", p_Inp->PicInterlace, p_Inp->MbInterlace);
00894 fprintf(stdout, " Transform8x8Mode : %d\n", p_Inp->Transform8x8Mode);
00895
00896 for (i=0; i<3; i++)
00897 {
00898 fprintf(stdout," ME Metric for Refinement Level %1d : %s\n", i, DistortionType[p_Inp->MEErrorMetric[i]]);
00899 }
00900 fprintf(stdout, " Mode Decision Metric : %s\n", DistortionType[p_Inp->ModeDecisionMetric]);
00901
00902 switch ( p_Inp->ChromaMEEnable )
00903 {
00904 case 1:
00905 fprintf(stdout," Motion Estimation for components : YCbCr\n");
00906 break;
00907 default:
00908 fprintf(stdout," Motion Estimation for components : Y\n");
00909 break;
00910 }
00911
00912 fprintf(stdout, " Image format : %dx%d (%dx%d)\n", p_Inp->output.width, p_Inp->output.height, p_Img->width,p_Img->height);
00913
00914 if (p_Inp->intra_upd)
00915 fprintf(stdout," Error robustness : On\n");
00916 else
00917 fprintf(stdout," Error robustness : Off\n");
00918 fprintf(stdout, " Search range : %d\n", p_Inp->search_range);
00919
00920 fprintf(stdout, " Total number of references : %d\n", p_Inp->num_ref_frames);
00921 fprintf(stdout, " References for P slices : %d\n", p_Inp->P_List0_refs ? p_Inp->P_List0_refs : p_Inp->num_ref_frames);
00922 fprintf(stdout, " References for B slices (L0, L1) : %d, %d\n",
00923 p_Inp->B_List0_refs ? p_Inp->B_List0_refs : p_Inp->num_ref_frames,
00924 p_Inp->B_List1_refs ? p_Inp->B_List1_refs : p_Inp->num_ref_frames);
00925
00926
00927 fprintf(stdout, " Sequence type :");
00928 if (p_Stats->NumberBFrames > 0 && p_Inp->HierarchicalCoding)
00929 {
00930 fprintf(stdout, " Hierarchy (QP: I %d, P %d, B %d) \n",
00931 p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE], p_Inp->qp[0][B_SLICE]);
00932 }
00933 else if (p_Stats->NumberBFrames > 0)
00934 {
00935 char seqtype[80];
00936 int i,j;
00937
00938 strcpy (seqtype,"I");
00939
00940 for (j=0; j < 2; j++)
00941 {
00942 for (i=0; i < p_Stats->NumberBFrames; i++)
00943 {
00944 if (p_Inp->BRefPictures)
00945 strncat(seqtype,"-RB", imax(0, (int) (79 - strlen(seqtype))));
00946 else
00947 strncat(seqtype,"-B", imax(0, (int) (79 - strlen(seqtype))));
00948 }
00949 strncat(seqtype,"-P", imax(0, (int) (79 - strlen(seqtype))));
00950 }
00951 if (p_Inp->BRefPictures)
00952 fprintf(stdout, " %s (QP: I %d, P %d, RB %d) \n", seqtype, p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE], iClip3(0, 51, p_Inp->qp[0][B_SLICE] + p_Inp->qpBRSOffset[0]));
00953 else
00954 fprintf(stdout, " %s (QP: I %d, P %d, B %d) \n", seqtype, p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE], p_Inp->qp[0][B_SLICE]);
00955 }
00956 else if (p_Stats->NumberBFrames == 0 && (p_Inp->intra_period == 1 || p_Inp->idr_period == 1))
00957 fprintf(stdout, " IIII (QP: I %d) \n", p_Inp->qp[0][I_SLICE]);
00958 else if (p_Stats->NumberBFrames == 0 && p_Inp->sp_periodicity == 0)
00959 fprintf(stdout, " IPPP (QP: I %d, P %d) \n", p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE]);
00960 else
00961 fprintf(stdout, " I-P-P-SP-P (QP: I %d, P %d, SP (%d, %d)) \n", p_Inp->qp[0][I_SLICE], p_Inp->qp[0][P_SLICE], p_Inp->qp[0][SP_SLICE], p_Inp->qpsp[0]);
00962
00963
00964 if (p_Inp->symbol_mode == CAVLC)
00965 fprintf(stdout," Entropy coding method : CAVLC\n");
00966 else
00967 fprintf(stdout," Entropy coding method : CABAC\n");
00968
00969 fprintf(stdout, " Profile/Level IDC : (%d,%d)\n", p_Inp->ProfileIDC, p_Inp->LevelIDC);
00970
00971 if (p_Inp->SearchMode == UM_HEX)
00972 fprintf(stdout, " Motion Estimation Scheme : HEX\n");
00973 else if (p_Inp->SearchMode == UM_HEX_SIMPLE)
00974 fprintf(stdout, " Motion Estimation Scheme : SHEX\n");
00975 else if (p_Inp->SearchMode == EPZS)
00976 {
00977 fprintf(stdout, " Motion Estimation Scheme : EPZS\n");
00978 EPZSOutputStats(p_Inp, stdout, 0);
00979 }
00980 else if (p_Inp->SearchMode == FAST_FULL_SEARCH)
00981 fprintf(stdout, " Motion Estimation Scheme : Fast Full Search\n");
00982 else
00983 fprintf(stdout, " Motion Estimation Scheme : Full Search\n");
00984
00985 if (p_Inp->full_search == 2)
00986 fprintf(stdout," Search range restrictions : none\n");
00987 else if (p_Inp->full_search == 1)
00988 fprintf(stdout," Search range restrictions : older reference frames\n");
00989 else
00990 fprintf(stdout," Search range restrictions : smaller blocks and older reference frames\n");
00991
00992 if (p_Inp->rdopt)
00993 fprintf(stdout," RD-optimized mode decision : used\n");
00994 else
00995 fprintf(stdout," RD-optimized mode decision : not used\n");
00996
00997 switch(p_Inp->partition_mode)
00998 {
00999 case PAR_DP_1:
01000 fprintf(stdout," Data Partitioning Mode : 1 partition \n");
01001 break;
01002 case PAR_DP_3:
01003 fprintf(stdout," Data Partitioning Mode : 3 partitions \n");
01004 break;
01005 default:
01006 fprintf(stdout," Data Partitioning Mode : not supported\n");
01007 break;
01008 }
01009
01010 switch(p_Inp->of_mode)
01011 {
01012 case PAR_OF_ANNEXB:
01013 fprintf(stdout," Output File Format : H.264/AVC Annex B Byte Stream Format \n");
01014 break;
01015 case PAR_OF_RTP:
01016 fprintf(stdout," Output File Format : RTP Packet File Format \n");
01017 break;
01018 default:
01019 fprintf(stdout," Output File Format : not supported\n");
01020 break;
01021 }
01022 }
01023
01024
01025 switch (p_Inp->Verbose)
01026 {
01027 case 0:
01028 default:
01029 printf("-------------------------------------------------------------------------------\n");
01030 printf("\nEncoding. Please Wait.\n\n");
01031 break;
01032 case 1:
01033 printf("-------------------------------------------------------------------------------\n");
01034 printf("Frame Bit/pic QP SnrY SnrU SnrV Time(ms) MET(ms) Frm/Fld Ref \n");
01035 printf("-------------------------------------------------------------------------------\n");
01036 break;
01037 case 2:
01038 if (p_Inp->Distortion[SSIM] == 1)
01039 {
01040 printf("------------------------------------------------------------------------------------------------------------------------\n");
01041 printf("Frame Bit/pic WP QP QL SnrY SnrU SnrV SsimY SsimU SsimV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
01042 printf("------------------------------------------------------------------------------------------------------------------------\n");
01043 }
01044 else
01045 {
01046 printf("------------------------------------------------------------------------------------------------\n");
01047 printf("Frame Bit/pic WP QP QL SnrY SnrU SnrV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
01048 printf("------------------------------------------------------------------------------------------------\n");
01049 }
01050 break;
01051 case 3:
01052 if (p_Inp->Distortion[SSIM] == 1)
01053 {
01054 printf("-----------------------------------------------------------------------------------------------------------------------------\n");
01055 printf("Frame Bit/pic NVB WP QP QL SnrY SnrU SnrV SsimY SsimU SsimV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
01056 printf("-----------------------------------------------------------------------------------------------------------------------------\n");
01057 }
01058 else
01059 {
01060 printf("-----------------------------------------------------------------------------------------------------\n");
01061 printf("Frame Bit/pic NVB WP QP QL SnrY SnrU SnrV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
01062 printf("-----------------------------------------------------------------------------------------------------\n");
01063 }
01064 break;
01065 case 4:
01066 if (p_Inp->Distortion[SSIM] == 1)
01067 {
01068 printf("----------------------------------------------------------------------------------------------------------------------------------------\n");
01069 printf("Frame Bit/pic Filler NVB WP QP QL SnrY SnrU SnrV SsimY SsimU SsimV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
01070 printf("----------------------------------------------------------------------------------------------------------------------------------------\n");
01071 }
01072 else
01073 {
01074 printf("----------------------------------------------------------------------------------------------------------------\n");
01075 printf("Frame Bit/pic Filler NVB WP QP QL SnrY SnrU SnrV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
01076 printf("----------------------------------------------------------------------------------------------------------------\n");
01077 }
01078 break;
01079 }
01080 }
01081
01082
01083
01084
01085
01086
01087
01088 void report_log_mode(ImageParameters *p_Img, InputParameters *p_Inp, StatParameters *p_Stats)
01089 {
01090 FILE *p_stat;
01091 int i;
01092 char name[40];
01093 #ifndef WIN32
01094 time_t now;
01095 struct tm *l_time;
01096 char string[1000];
01097 #else
01098 char timebuf[128];
01099 #endif
01100
01101 if ((p_stat = fopen("log_mode.dat", "r")) == 0)
01102 {
01103 if ((p_stat = fopen("log_mode.dat", "a")) == NULL)
01104 {
01105 snprintf(errortext, ET_SIZE, "Error open file %s \n", "log_mode.dat");
01106 error(errortext, 500);
01107 }
01108 else
01109 {
01110 fprintf(p_stat, " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
01111 fprintf(p_stat,"| Encoder statistics. This file is generated during first encoding session, new sessions will be appended |\n");
01112 fprintf(p_stat, " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
01113 fprintf(p_stat, "| ver | Date | Time | Sequence | QP | I4 | I8 | I16 | IC0 | IC1 | IC2 | IC3 | PI4 | PI8 | PI16 | P0 | P1 | P2 | P3 | P1*4*| P1*8*| P2*4*| P2*8*| P3*4*| P3*8*| P8 | P8:4 | P4*4*| P4*8*| P8:5 | P8:6 | P8:7 | BI4 | BI8 | BI16 | B0 | B1 | B2 | B3 | B0*4*| B0*8*| B1*4*| B1*8*| B2*4*| B2*8*| B3*4*| B3*8*| B8 | B8:0 |B80*4*|B80*8*| B8:4 | B4*4*| B4*8*| B8:5 | B8:6 | B8:7 |\n");
01114 fprintf(p_stat, " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
01115 }
01116 }
01117 else
01118 {
01119 fclose (p_stat);
01120 if ((p_stat = fopen("log_mode.dat", "a")) == NULL)
01121 {
01122 snprintf(errortext, ET_SIZE, "Error open file %s \n", "log_mode.dat");
01123 error(errortext, 500);
01124 }
01125 }
01126
01127
01128 fprintf(p_stat, "|%4s/%s", VERSION, EXT_VERSION);
01129
01130 #ifdef WIN32
01131 _strdate( timebuf );
01132 fprintf(p_stat, "| %1.5s |", timebuf);
01133
01134 _strtime( timebuf);
01135 fprintf(p_stat, " % 1.5s |", timebuf);
01136 #else
01137 now = time ((time_t *) NULL);
01138 time (&now);
01139 l_time = localtime (&now);
01140 strftime (string, sizeof string, "%d-%b-%Y", l_time);
01141 fprintf(p_stat, "| %1.5s |", string );
01142
01143 strftime (string, sizeof string, "%H:%M:%S", l_time);
01144 fprintf(p_stat, " %1.5s |", string);
01145 #endif
01146
01147 for (i=0;i<30;i++)
01148 name[i]=p_Inp->input_file1.fname[i + imax(0,(int) (strlen(p_Inp->input_file1.fname)- 30))];
01149
01150 fprintf(p_stat, "%30.30s|", name);
01151 fprintf(p_stat, "%3d |", p_Img->qp);
01152
01153
01154
01155 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[I_SLICE][I4MB ]);
01156 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[I_SLICE][I8MB ]);
01157 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[I_SLICE][I16MB]);
01158
01159
01160 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->intra_chroma_mode[0]);
01161 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->intra_chroma_mode[1]);
01162 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->intra_chroma_mode[2]);
01163 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->intra_chroma_mode[3]);
01164
01165
01166 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][I4MB ]);
01167 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][I8MB ]);
01168 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][I16MB]);
01169 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][0 ]);
01170
01171 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][1 ]);
01172 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][2 ]);
01173 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][3 ]);
01174
01175 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][1][0]);
01176 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][1][1]);
01177 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][2][0]);
01178 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][2][1]);
01179 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][3][0]);
01180 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][3][1]);
01181
01182 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][P8x8 ]);
01183 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][4 ]);
01184 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][4][0]);
01185 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[P_SLICE][4][1]);
01186 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][5 ]);
01187 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][6 ]);
01188 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[P_SLICE][7 ]);
01189
01190
01191 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][I4MB ]);
01192 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][I8MB ]);
01193 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][I16MB]);
01194 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][0 ]);
01195 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][1 ]);
01196 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][2 ]);
01197 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][3 ]);
01198 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][0][0]);
01199 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][0][1]);
01200 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][1][0]);
01201 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][1][1]);
01202 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][2][0]);
01203 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][2][1]);
01204 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][3][0]);
01205 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][3][1]);
01206
01207 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][P8x8]);
01208 fprintf(p_stat, " %d|", (p_Stats->b8_mode_0_use [B_SLICE][0]+p_Stats->b8_mode_0_use [B_SLICE][1]));
01209 fprintf(p_stat, " %5d|", p_Stats->b8_mode_0_use [B_SLICE][0]);
01210 fprintf(p_stat, " %5d|", p_Stats->b8_mode_0_use [B_SLICE][1]);
01211 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][4 ]);
01212 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][4][0]);
01213 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use_transform[B_SLICE][4][1]);
01214 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][5 ]);
01215 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][6 ]);
01216 fprintf(p_stat, " %5" FORMAT_OFF_T "|", p_Stats->mode_use[B_SLICE][7 ]);
01217
01218 fprintf(p_stat, "\n");
01219 fclose(p_stat);
01220 }
01221
01222