Skip to content

Commit 3437550

Browse files
authored
Codec-Compare version 0.2.3 (#13)
1 parent ce7ac0e commit 3437550

15 files changed

Lines changed: 146 additions & 37 deletions

CHANGELOG.md

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

3+
## v0.2.3
4+
5+
- No longer limit JPEG XL input quality range to [75:99] by default (introduced
6+
at v0.2.1). Expect custom bpp or quality filters to be defined in the presets
7+
instead.
8+
- Add lazy row loading setting for more reactive table panels.
9+
- Add animation frame count support.
10+
- Fade unused images in the gallery tab.
11+
- Hide matched pairs in the graph by default if there are more than two
12+
experiments.
13+
314
## v0.2.2
415

516
- Add DSSIM distortion metric recognition.

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.2.2",
3+
"version": "0.2.3",
44
"description": "Codec performance comparison tool",
55
"publisher": "Google LLC",
66
"author": "Yannis Guyon",

readme_preview.png

-18 KB
Loading

src/codec_compare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export class CodecCompare extends LitElement {
207207
</p>
208208
209209
<p id="credits">
210-
Codec Compare beta version 0.2.2<br>
210+
Codec Compare beta version 0.2.3<br>
211211
<a href="https://github.com/webmproject/codec-compare">
212212
Sources on GitHub
213213
</a>

src/entry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export enum FieldId {
3636
DECODED_IMAGE_NAME,
3737
WIDTH, // Number of pixel columns in SOURCE_IMAGE_NAME.
3838
HEIGHT, // Number of pixel rows in SOURCE_IMAGE_NAME.
39+
FRAME_COUNT, // Number of frames in SOURCE_IMAGE_NAME.
3940
EFFORT, // Encoding setting.
4041
QUALITY, // Encoding setting.
4142
PSNR, // Difference between original and decoded images.
@@ -93,6 +94,7 @@ const NAME_TO_FIELD_ID = new Map<string, FieldId>([
9394
['decoded image name', FieldId.DECODED_IMAGE_NAME],
9495
['width', FieldId.WIDTH],
9596
['height', FieldId.HEIGHT],
97+
['frame count', FieldId.FRAME_COUNT],
9698
['effort', FieldId.EFFORT],
9799
['quality', FieldId.QUALITY],
98100
['psnr', FieldId.PSNR],

src/entry_loader.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ function jsonToBatch(
210210
batch.fields.findIndex(field => field.id === FieldId.WIDTH);
211211
const heightFieldIndex =
212212
batch.fields.findIndex(field => field.id === FieldId.HEIGHT);
213+
const frameCountFieldIndex =
214+
batch.fields.findIndex(field => field.id === FieldId.FRAME_COUNT);
213215
const encodedSizeFieldIndex =
214216
batch.fields.findIndex(field => field.id === FieldId.ENCODED_SIZE);
215217
if (widthFieldIndex !== -1 && heightFieldIndex !== -1 &&
@@ -222,9 +224,13 @@ function jsonToBatch(
222224
batch.fields.push(field);
223225
uniqueValuesSets.push(new Set<string>());
224226
for (const row of batch.rows) {
225-
const bpp = (row[encodedSizeFieldIndex] as number) * 8 /
227+
let bpp = (row[encodedSizeFieldIndex] as number) * 8 /
226228
((row[widthFieldIndex] as number) *
227229
(row[heightFieldIndex] as number));
230+
if (frameCountFieldIndex !== -1 &&
231+
batch.fields[frameCountFieldIndex].isInteger) {
232+
bpp /= (row[frameCountFieldIndex] as number);
233+
}
228234
row.push(bpp);
229235
field.addValue(String(bpp), uniqueValuesSets[fieldIndex]);
230236
}

src/events.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ export enum EventType {
4545

4646
// The state changed and the UI needs to reflect them.
4747
MATCHED_DATA_POINTS_CHANGED = 'MATCHED_DATA_POINTS_CHANGED',
48+
49+
// Some setting was toggled.
50+
SETTINGS_CHANGED = 'SETTINGS_CHANGED',
4851
}
4952

5053
/**
@@ -63,6 +66,7 @@ declare global {
6366
REFERENCE_CHANGED: Event;
6467
MATCHER_OR_METRIC_CHANGED: Event;
6568
MATCHED_DATA_POINTS_CHANGED: Event;
69+
SETTINGS_CHANGED: Event;
6670
}
6771
}
6872

src/filter.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class FieldFilter {
3636
}
3737
}
3838

39-
/** Arbitrarily enables some filters (focusing on lossy image comparison). */
39+
/** Arbitrarily enables some filters. */
4040
export function enableDefaultFilters(batch: Batch, filters: FieldFilter[]) {
4141
// Pick the highest (usually meaning slowest) effort for best compression
4242
// results.
@@ -50,21 +50,6 @@ export function enableDefaultFilters(batch: Batch, filters: FieldFilter[]) {
5050
effortFilter.rangeStart = effortFilter.rangeEnd;
5151
}
5252
}
53-
54-
// Restrict JPEG XL to a "reasonable" encoder quality setting range.
55-
if (batch.codec.toLowerCase() === 'jxl' ||
56-
batch.codec.toLowerCase() === 'jpegxl') {
57-
const qualityIndex =
58-
batch.fields.findIndex((field: Field) => field.id === FieldId.QUALITY);
59-
if (qualityIndex !== -1) {
60-
const qualityField = batch.fields[qualityIndex];
61-
if (qualityField.isInteger && qualityField.uniqueValuesArray.length > 1) {
62-
filters[qualityIndex].enabled = true;
63-
filters[qualityIndex].rangeStart =
64-
Math.max(filters[qualityIndex].rangeStart, 75);
65-
}
66-
}
67-
}
6853
}
6954

7055
function rowPassesFilter(

src/filtered_images_ui.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {customElement, property} from 'lit/decorators.js';
2121

2222
import {BatchSelection} from './batch_selection';
2323
import {Entry} from './entry';
24+
import {dispatch, EventType} from './events';
2425
import {State} from './state';
2526

2627
/** Component displaying filtered images in a table. */
@@ -44,6 +45,24 @@ export class FilteredImagesUi extends LitElement {
4445

4546
override render() {
4647
const batch = this.batchSelection.batch;
48+
let rows = batch.rows;
49+
let truncatedRows = html``;
50+
if (!this.state.showAllRows && rows.length > 100) {
51+
const onDisplayHiddenRow = () => {
52+
this.state.showAllRows = true;
53+
dispatch(EventType.SETTINGS_CHANGED);
54+
this.requestUpdate();
55+
};
56+
truncatedRows = html`
57+
<tr>
58+
<td @click=${onDisplayHiddenRow}
59+
colspan=${batch.fields.length} class="hiddenRow">
60+
${rows.length - 100} hidden rows. Click to expand.
61+
</td>
62+
</tr>`;
63+
rows = rows.slice(0, 100);
64+
}
65+
4766
return html`
4867
<div class="horizontalFlex">
4968
<div id="imageChip">
@@ -71,7 +90,8 @@ export class FilteredImagesUi extends LitElement {
7190
(field) => html`<th title="${field.description}">${
7291
field.displayName}</th>`)}
7392
</tr>
74-
${batch.rows.map((row, rowIndex) => this.renderRow(row, rowIndex))}
93+
${rows.map((row, rowIndex) => this.renderRow(row, rowIndex))}
94+
${truncatedRows}
7595
</table>
7696
</div>`;
7797
}
@@ -151,6 +171,15 @@ export class FilteredImagesUi extends LitElement {
151171
color: grey;
152172
}
153173
174+
.hiddenRow {
175+
color: grey;
176+
font-style: italic;
177+
text-align: center;
178+
}
179+
.hiddenRow:hover {
180+
cursor: pointer;
181+
}
182+
154183
a {
155184
text-decoration: none;
156185
}

src/gallery_ui.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export class GalleryUi extends LitElement {
6565
if (asset.sourcePath !== undefined) {
6666
// Use a link to open the image in a new tab.
6767
return html`
68-
<a href="${asset.sourcePath}" target="_blank" title="${title}">
68+
<a href="${asset.sourcePath}" target="_blank" title="${title}"
69+
class="${asset.count == 0 ? 'unused' : ''}">
6970
<img src="${asset.previewPath}" class="constrainedSize"
7071
alt="${asset.sourceName}">
7172
<span class="countBubble">${asset.count}</span>
@@ -194,6 +195,10 @@ export class GalleryUi extends LitElement {
194195
font-size: 16px;
195196
}
196197
198+
.unused {
199+
opacity: 0.2;
200+
}
201+
197202
.countBubble {
198203
position: absolute;
199204
top: 5px;

0 commit comments

Comments
 (0)