Skip to content

Commit fd8b7a7

Browse files
authored
Codec-Compare version 0.1.9 (#2)
1 parent b2531e5 commit fd8b7a7

6 files changed

Lines changed: 33 additions & 5 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
package-lock.json

CHANGELOG.md

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

3+
## v0.1.9
4+
5+
- Use bits-per-pixel instead of bytes-per-pixel for the "bpp" metric.
6+
37
## v0.1.8
48

59
- Add matcher warning display capability.

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

src/codec_compare.ts

Lines changed: 1 addition & 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.8<br>
146+
Codec Compare beta version 0.1.9<br>
147147
<a href="https://github.com/webmproject/codec-compare">
148148
Sources on GitHub
149149
</a>

src/entry_loader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ function jsonToBatch(
215215
batch.fields.push(field);
216216
uniqueValuesSets.push(new Set<string>());
217217
for (const row of batch.rows) {
218-
const value = (row[encodedSizeFieldIndex] as number) /
218+
const bpp = (row[encodedSizeFieldIndex] as number) * 8 /
219219
((row[widthFieldIndex] as number) *
220220
(row[heightFieldIndex] as number));
221-
row.push(value);
222-
field.addValue(String(value), uniqueValuesSets[fieldIndex]);
221+
row.push(bpp);
222+
field.addValue(String(bpp), uniqueValuesSets[fieldIndex]);
223223
}
224224
processField(field, fieldIndex);
225225
}

src/entry_loader_test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,28 @@ describe('loadBatchJson', () => {
7676
expect(field.isInteger).toBeFalse();
7777
expect(field.uniqueValuesArray).not.toHaveSize(0);
7878
expect(field.rangeStart).toBeLessThan(field.rangeEnd);
79+
80+
// Make sure the computation is correct.
81+
const encodedSizeFieldIndex =
82+
batch.fields.findIndex((field) => field.id === FieldId.ENCODED_SIZE);
83+
const widthFieldIndex =
84+
batch.fields.findIndex((field) => field.id === FieldId.WIDTH);
85+
const heightFieldIndex =
86+
batch.fields.findIndex((field) => field.id === FieldId.HEIGHT);
87+
expect(encodedSizeFieldIndex).not.toBe(-1);
88+
expect(widthFieldIndex).not.toBe(-1);
89+
expect(heightFieldIndex).not.toBe(-1);
90+
if (encodedSizeFieldIndex !== -1 && widthFieldIndex !== -1 &&
91+
heightFieldIndex !== -1) {
92+
for (const row of batch.rows) {
93+
expect(row[bppFieldIndex])
94+
.toBeCloseTo(
95+
(row[encodedSizeFieldIndex] as number) * 8 /
96+
((row[widthFieldIndex] as number) *
97+
(row[heightFieldIndex] as number)),
98+
0.001);
99+
}
100+
}
79101
}
80102
});
81103

0 commit comments

Comments
 (0)