Get resolution for metadata dictionary.
(width: int, height: int)
| 351 | |
| 352 | |
| 353 | def get_screen_resolution_px_from_input(width: int, height: int) -> tuple[int, int]: |
| 354 | """Get resolution for metadata dictionary.""" |
| 355 | resolution_px = (width, height) |
| 356 | # halve the dimensions for super large image |
| 357 | if resolution_px[1] > 3000: |
| 358 | resolution_px = (resolution_px[0] // 2, resolution_px[1] // 2) |
| 359 | # for mp4 compatibility, enforce dimensions to even number, |
| 360 | # otherwise could not be played in browser |
| 361 | if resolution_px[0] % 2 != 0: |
| 362 | resolution_px = (resolution_px[0] + 1, resolution_px[1]) |
| 363 | if resolution_px[1] % 2 != 0: |
| 364 | resolution_px = (resolution_px[0], resolution_px[1] + 1) |
| 365 | return resolution_px |
| 366 | |
| 367 | |
| 368 | def _compute_depth_quantiles( |
no outgoing calls
no test coverage detected