From 55f2a7511b6c4ad3da160bf4e695bd804fbe671f Mon Sep 17 00:00:00 2001 From: Yannis Guyon Date: Thu, 31 Oct 2024 13:47:27 +0000 Subject: [PATCH] Codec-Compare version 0.2.6 (#16) --- CHANGELOG.md | 6 ++++- assets/demo_batch_other_codec_settingA.json | 4 +++ package.json | 2 +- src/codec_compare.ts | 2 +- src/common_field.ts | 27 ++++++++++----------- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ad53b..49652f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ # Changelog +## v0.2.6 + +- Fix cross-batch source asset filtering by tag. + ## v0.2.5 - Add support for cross-batch individual source asset filtering. -- Add support for cross-batch batch source asset filtering by tag. +- Add support for cross-batch source asset filtering by tag. - Add button to set the batch as the reference batch in the batch info panel. - Add link to view only two batches in the batch info panel. diff --git a/assets/demo_batch_other_codec_settingA.json b/assets/demo_batch_other_codec_settingA.json index a1b8498..3786a53 100644 --- a/assets/demo_batch_other_codec_settingA.json +++ b/assets/demo_batch_other_codec_settingA.json @@ -4,6 +4,8 @@ { "codec": "Name of the codec used to generate this data" }, { "version": "Version of the codec used to generate this data" }, { "time": "Timestamp of when this data was generated" }, + { "source_data_set": "The origin of the images used as input" }, + { "source_tags": "Input image tags" }, { "original_path": "The path to the original image" }, { "encoded_path": "The path to the encoded image" }, { "decoded_path": "The path to the decoded image" }, @@ -15,6 +17,8 @@ "other_codec", "0.1.2", "2023-05-16T16:15:24.174529673Z", + "https://testimages.org/sampling/", + "fruits=d040000018&with text=0d88068002", "/rainbow.png", "/rainbow_q50.webp", "/rainbow_q50.webp", diff --git a/package.json b/package.json index 168b28c..3e8b2f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codec_compare", - "version": "0.2.5", + "version": "0.2.6", "description": "Codec performance comparison tool", "publisher": "Google LLC", "author": "Yannis Guyon", diff --git a/src/codec_compare.ts b/src/codec_compare.ts index f3d6c63..05ad057 100644 --- a/src/codec_compare.ts +++ b/src/codec_compare.ts @@ -208,7 +208,7 @@ export class CodecCompare extends LitElement {

- Codec Compare beta version 0.2.5
+ Codec Compare beta version 0.2.6
Sources on GitHub diff --git a/src/common_field.ts b/src/common_field.ts index 10a1252..0868525 100644 --- a/src/common_field.ts +++ b/src/common_field.ts @@ -101,7 +101,8 @@ export function createCommonFields(batches: Batch[]): CommonField[] { function sourceTagsFromBatchesAndAssetNames( batches: Batch[], assetNames: string[]): Map> { - const sourceTags = new Map>(); + const tagToAssetNames = new Map>(); + const tagToBitmask = new Map(); for (const batch of batches) { const constant = @@ -117,24 +118,22 @@ function sourceTagsFromBatchesAndAssetNames( const tag = tagAndBitmaskSplit[0]; const bitmask = tagAndBitmaskSplit[1]; - const taggedAssetNames = new Set(); - if (!applyBitmaskToStringArray(assetNames, bitmask, taggedAssetNames)) { - // Mismatch between the asset names and a bitmask. - return new Map>(); - } - - const oldTaggedAssetNames = sourceTags.get(tag); - if (oldTaggedAssetNames !== undefined) { - if (oldTaggedAssetNames !== taggedAssetNames) { - // Mismatch between batches about the meaning of a tag. + const otherBitmask = tagToBitmask.get(tag); + if (otherBitmask === undefined) { + const taggedAssetNames = new Set(); + if (!applyBitmaskToStringArray(assetNames, bitmask, taggedAssetNames)) { + // Mismatch between the asset names and a bitmask. return new Map>(); } - } else { - sourceTags.set(tag, taggedAssetNames); + tagToAssetNames.set(tag, taggedAssetNames); + tagToBitmask.set(tag, bitmask); + } else if (otherBitmask !== bitmask) { + // Mismatch between batches about the meaning of a tag. + return new Map>(); } } } - return sourceTags; + return tagToAssetNames; } /**