Skip to content

Commit cda96dc

Browse files
authored
Codec-Compare version 0.1.10 (#4)
1 parent fd8b7a7 commit cda96dc

5 files changed

Lines changed: 49 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v0.1.10
4+
5+
- Fix swapped data point display toggle setting when off by default.
6+
- Improve matches table presentation.
7+
38
## v0.1.9
49

510
- Use bits-per-pixel instead of bytes-per-pixel for the "bpp" metric.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ page can understand what is shown, but also useful to experts, by offering a
1515
convenient interactive user interface with matcher, metric and filter settings.
1616
The presented data should be easily reproducible and up-to-date.
1717

18+
In contrast to more traditional
19+
[comparative benchmarks](https://storage.googleapis.com/avif-comparison/index.html),
20+
Codec-Compare aims to aggregate statistics after comparing pairs of two
21+
similarly encoded images, to avoid some of the bias brought by comparing already
22+
aggregated metrics. Most absolute metrics heavily depend on the dimensions and
23+
content of the source image and may not reflect the strengths of a codec when
24+
averaged; relative metrics can bring another perspective, at the expense of a
25+
reduced data point count due to discarded unmatched encoded images.
26+
1827
Feel free to file an issue for any question, suggestion or bug report.
1928
Contributions are also welcome, see [CONTRIBUTING](CONTRIBUTING.md).
2029

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codec_compare",
3-
"version": "0.1.9",
3+
"version": "0.1.10",
44
"description": "Codec performance comparison tool",
55
"publisher": "Google LLC",
66
"author": "Yannis Guyon",

src/codec_compare.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class CodecCompare extends LitElement {
143143
</p>
144144
145145
<p id="credits">
146-
Codec Compare beta version 0.1.9<br>
146+
Codec Compare beta version 0.1.10<br>
147147
<a href="https://github.com/webmproject/codec-compare">
148148
Sources on GitHub
149149
</a>
@@ -191,6 +191,7 @@ export class CodecCompare extends LitElement {
191191
this.urlState.save(this.state);
192192
this.requestUpdate();
193193
});
194+
this.settingsUi.requestUpdate(); // Settings may have changed.
194195
// Trigger the computation of matches and stats.
195196
dispatch(EventType.REFERENCE_CHANGED);
196197

src/matches_table_ui.ts

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
import {css, html, LitElement} from 'lit';
1616
import {customElement, property} from 'lit/decorators.js';
17+
import {styleMap} from 'lit/directives/style-map.js';
1718

1819
import {BatchSelection} from './batch_selection';
19-
import {areFieldsComparable, Batch, Field} from './entry';
20+
import {areFieldsComparable, Batch, Field, FieldId} from './entry';
2021
import {dispatch, EventType} from './events';
2122
import {FieldMatcher, Match} from './matcher';
2223
import {FieldMetric, getRatio} from './metric';
@@ -47,20 +48,37 @@ export class MatchesTableUi extends LitElement {
4748
selection: Batch, selectionFieldIndex: number, selectionRowIndex: number,
4849
reference: Batch, referenceFieldIndex: number,
4950
referenceRowIndex: number) {
51+
const selectionField = selection.fields[selectionFieldIndex];
5052
const selectionValue =
5153
selection.rows[selectionRowIndex][selectionFieldIndex];
5254
const referenceValue =
5355
reference.rows[referenceRowIndex][referenceFieldIndex];
54-
if (selection.fields[selectionFieldIndex].isNumber &&
55-
reference.fields[referenceFieldIndex].isNumber) {
56+
if (selectionField.id === FieldId.EFFORT ||
57+
selectionField.id === FieldId.QUALITY) {
58+
const referenceStyle = {'color': reference.color};
59+
const selectionStyle = {'color': selection.color};
60+
return html`
61+
<td class="encodingSettingCell">
62+
<span style=${styleMap(referenceStyle)}>${referenceValue}</span>
63+
<span style=${styleMap(selectionStyle)}>${selectionValue}</span>
64+
</td>`;
65+
}
66+
67+
const referenceField = reference.fields[referenceFieldIndex];
68+
const isNumber = selectionField.isNumber && referenceField.isNumber;
69+
const cssClass = isNumber ? 'numberCell' : '';
70+
71+
if (isNumber && selectionField.id !== FieldId.WIDTH &&
72+
selectionField.id !== FieldId.HEIGHT) {
5673
const ratio =
5774
getRatio(selectionValue as number, referenceValue as number);
58-
return html`<td>${getRelativePercent(ratio)}</td>`;
75+
return html`<td class="${cssClass}">${getRelativePercent(ratio)}</td>`;
5976
}
6077
if (selectionValue === referenceValue) {
61-
return html`<td>${selectionValue}</td>`;
78+
return html`<td class="${cssClass}">${selectionValue}</td>`;
6279
}
63-
return html`<td>${selectionValue}${referenceValue}</td>`;
80+
return html`
81+
<td class="${cssClass}">${selectionValue}${referenceValue}</td>`;
6482
}
6583

6684
// Header rows (two needed because some cells use a rowspan)
@@ -201,7 +219,7 @@ export class MatchesTableUi extends LitElement {
201219
${metricIndices.map((metricIndex) => {
202220
const mean =
203221
this.batchSelection.stats[metricIndex].getMean(/*geometric=*/ false);
204-
return html`<td>${getRelativePercent(mean)}</td>`;
222+
return html`<td class="numberCell">${getRelativePercent(mean)}</td>`;
205223
})}
206224
<td colspan=${selectionSharedFieldIndices.length} class="missing">
207225
</td>
@@ -215,7 +233,7 @@ export class MatchesTableUi extends LitElement {
215233
${metricIndices.map((metricIndex) => {
216234
const mean =
217235
this.batchSelection.stats[metricIndex].getMean(/*geometric=*/ true);
218-
return html`<td>${getRelativePercent(mean)}</td>`;
236+
return html`<td class="numberCell">${getRelativePercent(mean)}</td>`;
219237
})}
220238
<td colspan=${selectionSharedFieldIndices.length} class="missing">
221239
</td>
@@ -258,6 +276,12 @@ export class MatchesTableUi extends LitElement {
258276
font-family: monospace;
259277
font-size: 10px;
260278
}
279+
.numberCell {
280+
text-align: right;
281+
}
282+
.encodingSettingCell {
283+
text-align: center;
284+
}
261285
262286
tr {
263287
background: var(--mdc-theme-background);

0 commit comments

Comments
 (0)