def lf_batch_idx(grid, i: int, j: int):
    """Compute the index of a scpecific frame in the flattened light field.

    Args:
        grid (Tuple): The shape of the light field grid
        i: The index in the first grid dimension
        j: The index in the second grid dimension

    Returns:
        The index in a flattened light field.
    """
    return i * grid[1] + j