Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.5 KiB

  1. // $Header: G:/SwDev/WDM/Video/bt848/rcs/Pscolspc.cpp 1.4 1998/04/29 22:43:35 tomz Exp $
  2. extern "C" {
  3. #ifndef _STREAM_H
  4. #include "strmini.h"
  5. #endif
  6. }
  7. #include "pscolspc.h"
  8. /* Method: PsColorSpace::SetColorFormat
  9. * Purpose: Sets BtPisces color space converter to the given color
  10. * Input: eaColor: enum of type ColFmt
  11. * Output: None
  12. * Note: No error checking is done ( enum is checked by the compiler during compile
  13. * The function writes to the XXXX register
  14. */
  15. BOOL VerifyColorFormat( ColFmt val )
  16. {
  17. // [WRK] - use constants here for valid formats
  18. switch( val ) {
  19. case 0:
  20. case 1:
  21. case 2:
  22. case 3:
  23. case 4:
  24. case 5:
  25. case 6:
  26. case 7:
  27. case 8:
  28. case 9:
  29. case 0xe:
  30. return( TRUE );
  31. default:
  32. DebugOut((0, "Caught bad write to ColorFormat (0x%x)\n", val));
  33. return( FALSE );
  34. }
  35. }
  36. void PsColorSpace::SetColorFormat( ColFmt eColor )
  37. {
  38. // save for later use...
  39. ColorSpace::SetColorFormat( eColor );
  40. ByteSwap_ = 0;
  41. switch ( eColor ) {
  42. case CF_YUV9:
  43. eColor = CF_PL_411;
  44. break;
  45. case CF_YUV12:
  46. case CF_I420:
  47. eColor = CF_PL_422;
  48. break;
  49. case CF_UYVY:
  50. eColor = CF_YUY2;
  51. ByteSwap_ = 1;
  52. break;
  53. }
  54. // set the hardware
  55. if ( VerifyColorFormat(eColor) ) {
  56. Format_ = eColor;
  57. } else {
  58. Format_ = 7;
  59. DebugOut((0, "Forcing invalid color format to 0x%x\n", Format_));
  60. }
  61. }