code: def _dxt1(data, width, height):
      # TODO implement this function as pixel format in decode.c
      ret = bytearray(4 * width * height)
  
      for y in range(0, height, 4):
          for x in range(0, width, 4):
              color0, color1, bits = struct.unpack("<HHI", data.read(8))
  
              r0, g0, b0 = _decode565(color0)
              r1, g1, b1 = _decode565(color1)
  
              # Decode this block into 4x4 pixels
              for j in range(4):
                  for i in range(4):
                      # get next control op and generate a pixel
                      control = bits & 3
                      bits = bits >> 2
                      if control == 0:
                          r, g, b = r0, g0, b0
                      elif control == 1:
                          r, g, b = r1, g1, b1
                      elif control == 2:
                          if color0 > color1:
                              r, g, b = (
                                  _c2a(r0, r1),
                                  _c2a(g0, g1),
                                  _c2a(b0, b1),
                              )
                          else:
                              r, g, b = (
                                  _c2b(r0, r1),
                                  _c2b(g0, g1),
                                  _c2b(b0, b1),
                              )
                      elif control == 3:
                          if color0 > color1:
                              r, g, b = (
                                  _c3(r0, r1),
                                  _c3(g0, g1),
                                  _c3(b0, b1),
                              )
                          else:
                              r, g, b = 0, 0, 0
  
                      idx = 4 * ((y + j) * width + x + i)
                      ret[idx : idx + 4] = struct.pack(
                          "4B", r, g, b, 255
                      )
  
      return bytes(ret)
  
imports: from __future__ import annotations
  import struct
  from io import BytesIO
  from PIL import Image, ImageFile
label_desc: Use image node_id 5 for calling a global function with example usage: _dxt1(data, width, height) and returns: bytes