code: def ref_color_twist(img, H, S, brightness, contrast, out_dtype):
      inp_dtype = img.dtype
      angle = math.radians(H)
      s, c = math.sin(angle), math.cos(angle)
      # Rotate the color components by angle and scale by S.
      # The fun part is that it doesn't really matter that much which
      hmat = np.array(
          [[1, 0, 0], [0, c * S, s * S], [0, -s * S, c * S]]
      )
  
      m = np.matmul(yiq2rgb, np.matmul(hmat, rgb2yiq))
  
      num_pixels = np.prod(img.shape[:-1])
      pixels = img.reshape([num_pixels, img.shape[-1]])
      pixels = np.matmul(pixels, m.transpose())
  
      if np.issubdtype(inp_dtype, np.floating):
          grey = 0.5
      else:
          grey = 128
      pixels = ((pixels - grey) * contrast + grey) * brightness
      img = pixels.reshape(img.shape)
  
      return convert_sat(img, out_dtype)
  
file_path: DALI/dali/test/python/operator_1/test_color_twist.py
imports: import math
  import numpy
  import nvidia.dali.fn
  import nvidia.dali.types
  import random
  from nvidia.dali import pipeline_def
  from sequences_test_utils import ArgCb, video_suite_helper
  from test_utils import RandomDataIterator
label_desc: Use image node_id 4 for calling a global function with example usage: ref_color_twist(img, H, S, brightness, contrast, out_dtype) and returns: convert_sat