report.c
来自「the newest JM software by h.264 JVT offi」· C语言 代码 · 共 1,204 行 · 第 1/5 页
C
1,204 行
if (params->SearchMode == UM_HEX)
fprintf(stdout, " Motion Estimation Scheme : HEX\n");
else if (params->SearchMode == UM_HEX_SIMPLE)
fprintf(stdout, " Motion Estimation Scheme : SHEX\n");
else if (params->SearchMode == EPZS)
{
fprintf(stdout, " Motion Estimation Scheme : EPZS\n");
EPZSOutputStats(params, stdout, 0);
}
else if (params->SearchMode == FAST_FULL_SEARCH)
fprintf(stdout, " Motion Estimation Scheme : Fast Full Search\n");
else
fprintf(stdout, " Motion Estimation Scheme : Full Search\n");
if (params->full_search == 2)
fprintf(stdout," Search range restrictions : none\n");
else if (params->full_search == 1)
fprintf(stdout," Search range restrictions : older reference frames\n");
else
fprintf(stdout," Search range restrictions : smaller blocks and older reference frames\n");
if (params->rdopt)
fprintf(stdout," RD-optimized mode decision : used\n");
else
fprintf(stdout," RD-optimized mode decision : not used\n");
switch(params->partition_mode)
{
case PAR_DP_1:
fprintf(stdout," Data Partitioning Mode : 1 partition \n");
break;
case PAR_DP_3:
fprintf(stdout," Data Partitioning Mode : 3 partitions \n");
break;
default:
fprintf(stdout," Data Partitioning Mode : not supported\n");
break;
}
switch(params->of_mode)
{
case PAR_OF_ANNEXB:
fprintf(stdout," Output File Format : H.264/AVC Annex B Byte Stream Format \n");
break;
case PAR_OF_RTP:
fprintf(stdout," Output File Format : RTP Packet File Format \n");
break;
default:
fprintf(stdout," Output File Format : not supported\n");
break;
}
}
switch (params->Verbose)
{
case 0:
default:
printf("-------------------------------------------------------------------------------\n");
printf("\nEncoding. Please Wait.\n\n");
break;
case 1:
printf("-------------------------------------------------------------------------------\n");
printf("Frame Bit/pic QP SnrY SnrU SnrV Time(ms) MET(ms) Frm/Fld Ref \n");
printf("-------------------------------------------------------------------------------\n");
break;
case 2:
if (params->Distortion[SSIM] == 1)
{
printf("------------------------------------------------------------------------------------------------------------------------\n");
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");
printf("------------------------------------------------------------------------------------------------------------------------\n");
}
else
{
printf("------------------------------------------------------------------------------------------------\n");
printf("Frame Bit/pic WP QP QL SnrY SnrU SnrV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
printf("------------------------------------------------------------------------------------------------\n");
}
break;
case 3:
if (params->Distortion[SSIM] == 1)
{
printf("-----------------------------------------------------------------------------------------------------------------------------\n");
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");
printf("-----------------------------------------------------------------------------------------------------------------------------\n");
}
else
{
printf("-----------------------------------------------------------------------------------------------------\n");
printf("Frame Bit/pic NVB WP QP QL SnrY SnrU SnrV Time(ms) MET(ms) Frm/Fld I D L0 L1 RDP Ref\n");
printf("-----------------------------------------------------------------------------------------------------\n");
}
break;
}
}
/*!
************************************************************************
* \brief
* Report mode distribution of the sequence to log_mode.dat
************************************************************************
*/
void report_log_mode(InputParameters *params, StatParameters *stats, int64 bit_use[NUM_SLICE_TYPES][2])
{
FILE *p_stat; //!< status file for the last encoding session
int i;
char name[40];
#ifndef WIN32
time_t now;
struct tm *l_time;
char string[1000];
#else
char timebuf[128];
#endif
if ((p_stat = fopen("log_mode.dat", "r")) == 0) // check if file exists
{
if ((p_stat = fopen("log_mode.dat", "a")) == NULL) // append new statistic at the end
{
snprintf(errortext, ET_SIZE, "Error open file %s \n", "log_mode.dat");
error(errortext, 500);
}
else // Create header for new log file
{
fprintf(p_stat, " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
fprintf(p_stat,"| Encoder statistics. This file is generated during first encoding session, new sessions will be appended |\n");
fprintf(p_stat, " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
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");
fprintf(p_stat, " ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n");
}
}
else
{
fclose (p_stat);
if ((p_stat = fopen("log_mode.dat", "a")) == NULL) // File exists, just open for appending
{
snprintf(errortext, ET_SIZE, "Error open file %s \n", "log_mode.dat");
error(errortext, 500);
}
}
//report
fprintf(p_stat, "|%4s/%s", VERSION, EXT_VERSION);
#ifdef WIN32
_strdate( timebuf );
fprintf(p_stat, "| %1.5s |", timebuf);
_strtime( timebuf);
fprintf(p_stat, " % 1.5s |", timebuf);
#else
now = time ((time_t *) NULL); // Get the system time and put it into 'now' as 'calender time'
time (&now);
l_time = localtime (&now);
strftime (string, sizeof string, "%d-%b-%Y", l_time);
fprintf(p_stat, "| %1.5s |", string );
strftime (string, sizeof string, "%H:%M:%S", l_time);
fprintf(p_stat, " %1.5s |", string);
#endif
for (i=0;i<30;i++)
name[i]=params->input_file1.fname[i + imax(0,(int) (strlen(params->input_file1.fname)- 30))]; // write last part of path, max 30 chars
fprintf(p_stat, "%30.30s|", name);
fprintf(p_stat, "%3d |", img->qp);
//report modes
//I-Modes
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[I_SLICE][I4MB ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[I_SLICE][I8MB ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[I_SLICE][I16MB]);
//chroma intra mode
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->intra_chroma_mode[0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->intra_chroma_mode[1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->intra_chroma_mode[2]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->intra_chroma_mode[3]);
//P-Modes
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][I4MB ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][I8MB ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][I16MB]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][0 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][1 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][2 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][3 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][1][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][1][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][2][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][2][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][3][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][3][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][P8x8 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][4 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][4][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[P_SLICE][4][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][5 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][6 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[P_SLICE][7 ]);
//B-Modes
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][I4MB ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][I8MB ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][I16MB]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][0 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][1 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][2 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][3 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][0][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][0][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][1][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][1][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][2][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][2][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][3][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][3][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][P8x8]);
fprintf(p_stat, " %d|", (stats->b8_mode_0_use [B_SLICE][0]+stats->b8_mode_0_use [B_SLICE][1]));
fprintf(p_stat, " %5d|", stats->b8_mode_0_use [B_SLICE][0]);
fprintf(p_stat, " %5d|", stats->b8_mode_0_use [B_SLICE][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][4 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][4][0]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use_transform[B_SLICE][4][1]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][5 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][6 ]);
fprintf(p_stat, " %5" FORMAT_OFF_T "|", stats->mode_use[B_SLICE][7 ]);
fprintf(p_stat, "\n");
fclose(p_stat);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?