home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / lib / site-packages / OpenGL / raw / GL / APPLE / ycbcr_422.py < prev   
Encoding:
Python Source  |  2008-12-07  |  3.0 KB  |  60 lines

  1. '''OpenGL extension APPLE.ycbcr_422
  2.  
  3. Overview (from the spec)
  4.     
  5.     This extension provides a method for GL to read, store and optionally
  6.     process textures that are defined in Y'CbCr 422 video formats.  This
  7.     extension supports the two common Y'CbCr 422 video formats (known by
  8.     QuickTime FourCC as '2vuy' and 'yuvs'). These formats represent one of the
  9.     most common 16 bit Y'CbCr formats in both standard and reverse byte
  10.     ordering. From a client stand point these can be assumed to be decoded
  11.     immediately (even though the implementation is free to optimize the data
  12.     storage and keep it in the native format) and otherwise function as any
  13.     other texture format.  The texture command <internalformat> parameter
  14.     normally be should be specified as RGB, since Y'CbCr is just a form of RGB
  15.     data.  This extension can be supported with either hardware or software
  16.     decoding and it is up to the specific implementation to determine which is
  17.     used.
  18.     
  19.     A new <format> is added, YCBCR_422_APPLE.  Additionally, to handle the
  20.     difference in pixel size and byte ordering for 422 video, the pixel storage
  21.     operations treat YCBCR_422_APPLE as a 2 component format using
  22.     the UNSIGNED_SHORT_8_8_APPLE or UNSIGNED_SHORT_8_8_REV_APPLE <type>.
  23.     
  24.     The '2vuy' or k2vuyPixelFormat pixel format is an 8-bit 4:2:2 Component
  25.     Y'CbCr format. Each 16 bit pixel is represented by an unsigned eight bit
  26.     luminance component and two unsigned eight bit chroma components. Each pair
  27.     of pixels shares a common set of chroma values. The components are ordered
  28.     in memory; Cb, Y0, Cr, Y1. The luminance components have a range of [16,
  29.     235], while the chroma value has a range of [16, 240]. This is consistent
  30.     with the CCIR601 spec. This format is fairly prevalent on both Mac and Win32
  31.     platforms. The equivalent Microsoft fourCC is OUYVYâ•’.  This format is
  32.     supported with the UNSIGNED_SHORT_8_8_REV_APPLE type for pixel storage
  33.     operations.
  34.     
  35.     The 'yuvs' or kYUVSPixelFormat is an 8-bit 4:2:2 Component Y'CbCr format.
  36.     Identical to the k2vuyPixelFormat except each 16 bit word has been byte
  37.     swapped. This results in a component ordering of; Y0, Cb, Y1, Cr. This is
  38.     most prevalent yuv 4:2:2 format on both Mac and Win32 platforms. The
  39.     equivalent Microsoft fourCC is 'YUY2'.  This format is supported with the
  40.     UNSIGNED_SHORT_8_8_APPLE type for pixel storage operations.
  41.  
  42. The official definition of this extension is available here:
  43.     http://oss.sgi.com/projects/ogl-sample/registry/APPLE/ycbcr_422.txt
  44.  
  45. Automatically generated by the get_gl_extensions script, do not edit!
  46. '''
  47. from OpenGL import platform, constants, constant, arrays
  48. from OpenGL import extensions
  49. from OpenGL.GL import glget
  50. import ctypes
  51. EXTENSION_NAME = 'GL_APPLE_ycbcr_422'
  52. GL_YCBCR_422_APPLE = constant.Constant( 'GL_YCBCR_422_APPLE', 0x85B9 )
  53. GL_UNSIGNED_SHORT_8_8_APPLE = constant.Constant( 'GL_UNSIGNED_SHORT_8_8_APPLE', 0x85BA )
  54. GL_UNSIGNED_SHORT_8_8_REV_APPLE = constant.Constant( 'GL_UNSIGNED_SHORT_8_8_REV_APPLE', 0x85BB )
  55.  
  56.  
  57. def glInitYcbcr422APPLE():
  58.     '''Return boolean indicating whether this extension is available'''
  59.     return extensions.hasGLExtension( EXTENSION_NAME )
  60.