Commit e913a1bb authored by bayers's avatar bayers
Browse files

better handling of limiter results

parent 6c3779fe
Loading
Loading
Loading
Loading
+37 −13
Original line number Diff line number Diff line
@@ -189,6 +189,11 @@ h1 {
  margin-top: 1em;
  margin-bottom: 1em;
}
h2 {
  text-align: center;
  margin-top: 1em;
  margin-bottom: 1em;
}
</style>
"""

@@ -228,6 +233,8 @@ class IvasModeAnalyzer(IvasModeCollector):
        self.analyze_encoder = True
        self.analyze_decoder = True
        self.html_table = None
        self.encoder_cmdline_options = None
        self.decoder_cmdline_options = None

    def ls_modes(self):
        """ """
@@ -273,7 +280,10 @@ class IvasModeAnalyzer(IvasModeCollector):
                        oc = os.path.splitext(f)[1][1:]
                        f = os.path.splitext(os.path.splitext(f)[0])[0]
                        item, suffices = f.split("".join(["_", mode]))
                        if item not in self.available_logs[mode]["items"]:
                        if (
                                item not in self.available_logs[mode]["items"]
                                and oc in self.flat_mode_list[mode]['cmd']['dec']
                        ):
                            self.available_logs[mode]["items"].update(
                                {item: {"enc": False, "dec": [oc]}}
                            )
@@ -283,11 +293,15 @@ class IvasModeAnalyzer(IvasModeCollector):
                                oc
                                not in self.available_logs[mode]["items"][item]["dec"]
                                and oc != "proc"
                                and oc in self.flat_mode_list[mode]['cmd']['dec']
                            ):
                                self.available_logs[mode]["items"][item]["dec"].append(
                                    oc
                                )
                        if oc not in self.available_logs[mode]["oc_list"]:
                        if (
                                oc not in self.available_logs[mode]["oc_list"]
                                and oc in self.flat_mode_list[mode]['cmd']['dec']
                        ):
                            self.available_logs[mode]["oc_list"].append(oc)

    @staticmethod
@@ -1137,7 +1151,8 @@ class IvasModeAnalyzer(IvasModeCollector):
        tbl_cell = "<td>{}</td>"
        tbl_cell_pass = "<td class=\"pass\">{}</td>"
        tbl_cell_fail = "<td class=\"fail\">{}</td>"
        tbl_row = "<tr>\n{}\n</td>"
        tbl_row = "\n<tr>\n{}\n</tr>\n"
        table_tmpl = "<table>\n{}\n</table>"
        # write decoder command line
        upload_location = os.environ.get("UPLOAD_LOCATION", None)
        if upload_location is not None:
@@ -1149,7 +1164,13 @@ class IvasModeAnalyzer(IvasModeCollector):
            upload_location_logs = self.dir + "/logs"
            upload_location_fer = None

        bs_processing_html=""
        info_html_tmpl = "\n<h2>Additional information</h2>\n{}\n<h2>Results</h2>\n"

        info_table = list()
        if self.decoder_cmdline_options is not None:
            cmdlineoptions = " ".join(self.decoder_cmdline_options)
            info_table.append(tbl_row.format("\n".join([tbl_cell.format("Additional Decoder command line options:"),
                                         tbl_cell.format(cmdlineoptions)])))
        if self.global_bitstream_processing is not None:
            for processing in self.global_bitstream_processing["proc_chain"]:
                if "-fer" in processing:
@@ -1164,7 +1185,8 @@ class IvasModeAnalyzer(IvasModeCollector):
                        )
                    else:
                        fer_file_link = os.path.basename(fer_file)
                    bs_processing_html += f"FER file: {fer_file_link}\n"
                    info_table.append(tbl_row.format("\n".join([tbl_cell.format("FER file:"),
                                                 tbl_cell.format(fer_file_link)])))
                elif "networkSimulator_g192" in processing:
                    # fer file is the 1st argument in the processing command
                    jbm_file = processing[1]
@@ -1177,8 +1199,11 @@ class IvasModeAnalyzer(IvasModeCollector):
                        )
                    else:
                        jbm_file_link = os.path.basename(jbm_file)
                    bs_processing_html += f"JBM file: {jbm_file_link}\n"
                    info_table.append(tbl_row.format("\n".join([tbl_cell.format("JBM file:"),
                                                 tbl_cell.format(jbm_file_link)])))

        if info_table:
            info_html=info_html_tmpl.format(table_tmpl.format("\n".join(info_table)))
        limiter_table = self.get_limiter_table()
        columns = ["Mode", "Item"]
        html_table=list()
@@ -1203,19 +1228,18 @@ class IvasModeAnalyzer(IvasModeCollector):
                    row_html.append(
                        tbl_cell_pass.format(LIMITER_RESULTS[limiter_keys[col_idx]]["number_format"].format(value)))
            if row_fail is True:
                html_table.append("\n".join(row_html))
                html_table.append(tbl_row.format("\n".join(row_html)))
        # assemble page
        page_tmpl = "{}\n<html>\n<head>\n{}\n<title>{}</title>\n{}\n</head><body>\n{}</body>\n</html>"
        table_tmpl = "<table>\n{}\n</table>"
        title_tmpl = "Limiter report"
        title_tmpl = "Limiter report ({})"
        fname_tmpl = "{}_{}.html"
        body_tmpl = "<h1>{} report on revision {}</h1>{}\n{}"
        body_tmpl = "<h1>{} report ({}) on revision {}</h1>{}\n{}"

        table = table_tmpl.format("\n".join(html_table))
        title = title_tmpl.format()
        body = body_tmpl.format("Limiter", revision, table,bs_processing_html)
        title = title_tmpl.format(" ".join(basefilename.split("_")))
        body = body_tmpl.format("Limiter", " ".join(basefilename.split("_")), revision, info_html, table)
        page = page_tmpl.format(HTML_DOCTYPE, HTML_META, title, HTML_STYLE, body)
        fname = fname_tmpl.format(basefilename, "limiter")
        fname = fname_tmpl.format("limiter", basefilename)
        with open(fname, "w") as f:
            for line in page:
                f.write(line)