pydicom.pixels.utils.expand_ybr422

pydicom.pixels.utils.expand_ybr422(src: ByteString, bits_allocated: int) bytes[source]

Return YBR_FULL_422 data expanded to YBR_FULL.

Uncompressed datasets with a (0028,0004) Photometric Interpretation of "YBR_FULL_422" are subsampled in the horizontal direction by halving the number of Cb and Cr pixels (i.e. there are two Y pixels for every Cb and Cr pixel). This function expands the YBR_FULL_422 data to remove the subsampling and the output is therefore YBR_FULL.

Parameters:
  • src (bytes or bytearray) – The YBR_FULL_422 pixel data to be expanded.

  • bits_allocated (int) – The number of bits used to store each pixel, as given by (0028,0100) Bits Allocated.

Returns:

The expanded data (as YBR_FULL).

Return type:

bytes