(
width: number,
height: number,
renderedPixels: Uint8Array,
groundTruthPixels: Uint8Array,
maskPixels?: Uint8Array
)
| 167 | }; |
| 168 | |
| 169 | const runCase = async ( |
| 170 | width: number, |
| 171 | height: number, |
| 172 | renderedPixels: Uint8Array, |
| 173 | groundTruthPixels: Uint8Array, |
| 174 | maskPixels?: Uint8Array |
| 175 | ): Promise<BrowserPsnrMetric> => { |
| 176 | const renderedTexture = device.createTexture({ |
| 177 | size: { width, height }, |
| 178 | format: 'rgba8unorm', |
| 179 | usage: textureUsageCopyDst | textureUsageTextureBinding, |
| 180 | }); |
| 181 | const groundTruthTexture = device.createTexture({ |
| 182 | size: { width, height }, |
| 183 | format: 'rgba8unorm', |
| 184 | usage: textureUsageCopyDst | textureUsageTextureBinding, |
| 185 | }); |
| 186 | const maskTexture = maskPixels |
| 187 | ? device.createTexture({ |
| 188 | size: { width, height }, |
| 189 | format: 'rgba8unorm', |
| 190 | usage: textureUsageCopyDst | textureUsageTextureBinding, |
| 191 | }) |
| 192 | : undefined; |
| 193 | try { |
| 194 | uploadTexture(renderedTexture, width, height, renderedPixels); |
| 195 | uploadTexture(groundTruthTexture, width, height, groundTruthPixels); |
| 196 | if (maskTexture && maskPixels) { |
| 197 | uploadTexture(maskTexture, width, height, maskPixels); |
| 198 | } |
| 199 | return await computePsnrFromRgbaTexturesWebGpu({ |
| 200 | device: trackedDevice, |
| 201 | renderedTexture, |
| 202 | groundTruthTexture, |
| 203 | ...(maskTexture ? { maskTexture } : {}), |
| 204 | width, |
| 205 | height, |
| 206 | }); |
| 207 | } finally { |
| 208 | maskTexture?.destroy(); |
| 209 | renderedTexture.destroy(); |
| 210 | groundTruthTexture.destroy(); |
| 211 | } |
| 212 | }; |
| 213 | |
| 214 | const runTiledParityCase = async (): Promise<{ |
| 215 | full: BrowserPsnrMetric; |
no test coverage detected