| 40 | |
| 41 | |
| 42 | def bounding_box(h, w, pixel_aspect_ratio=1.0): |
| 43 | # Adjusted dimensions |
| 44 | w_adj = w |
| 45 | h_adj = h * pixel_aspect_ratio |
| 46 | |
| 47 | # Adjusted aspect ratio |
| 48 | ar_adj = w_adj / h_adj |
| 49 | |
| 50 | # Determine bounding box based on the adjusted aspect ratio |
| 51 | y_min, y_max, x_min, x_max = -1.0, 1.0, -1.0, 1.0 |
| 52 | if ar_adj > 1: |
| 53 | y_min, y_max = -1 / ar_adj, 1 / ar_adj |
| 54 | elif ar_adj < 1: |
| 55 | x_min, x_max = -ar_adj, ar_adj |
| 56 | |
| 57 | return y_min, y_max, x_min, x_max |
| 58 | |
| 59 | |
| 60 | def make_axial_pos(h, w, pixel_aspect_ratio=1.0, align_corners=False, dtype=None, device=None): |