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.

89 lines
3.2 KiB

  1. /* *************************************************************************
  2. ** INTEL Corporation Proprietary Information
  3. **
  4. ** This listing is supplied under the terms of a license
  5. ** agreement with INTEL Corporation and may not be copied
  6. ** nor disclosed except in accordance with the terms of
  7. ** that agreement.
  8. **
  9. ** Copyright (c) 1995 Intel Corporation.
  10. ** All Rights Reserved.
  11. **
  12. ** *************************************************************************
  13. */
  14. ////////////////////////////////////////////////////////////////////////////
  15. // $Header: S:\h26x\src\dec\dxap.h_v 1.2 27 Dec 1995 14:36:18 RMCKENZX $
  16. //
  17. // $Log: S:\h26x\src\dec\dxap.h_v $
  18. ;//
  19. ;// Rev 1.2 27 Dec 1995 14:36:18 RMCKENZX
  20. ;// Added copyright notice
  21. //
  22. // Rev 1.1 10 Nov 1995 14:45:10 CZHU
  23. //
  24. //
  25. // Rev 1.0 10 Nov 1995 13:56:14 CZHU
  26. // Initial revision.
  27. // ComputeDynamicClut8 Index and UV dither table
  28. #ifndef _AP_INC_
  29. #define _AP_INC_
  30. #define NCOL 256
  31. #define YSIZ 16
  32. #define YSTEP 16
  33. //#define USE_744
  34. extern U8 gUTable[];
  35. extern U8 gVTable[];
  36. /* table index is uvuvuvuvxyyyyyyy */
  37. #define UVSTEP 8
  38. #define YGAP 1
  39. //#define TBLIDX(y,u,v) (((v)>>3<<12) + ((u)>>3<<8) + (y))
  40. #define TBLIDX(y,u,v) ( ((gVTable[v] + gUTable[u]) <<8) + (y>>1))
  41. #if 1
  42. #define YFROM(R, G, B) (U32)((( 16843 * R) + ( 33030 * G) + ( 6423 * B) + 65536*16) /65536)
  43. #define UFROM(R, G, B) (U32)((( -9699 * R) + (-19071 * G) + ( 28770 * B) + 65536*128)/65536)
  44. #define VFROM(R, G, B) (U32)((( 28770 * R) + (-24117 * G) + ( -4653 * B) + 65536*128)/65536)
  45. #else
  46. #define YFROM(R, G, B) ( I32)(( 0.257 * R) + ( 0.504 * G) + ( 0.098 * B) + 16.)
  47. #define UFROM(R, G, B) ( I32)((-0.148 * R) + (-0.291 * G) + ( 0.439 * B) + 128.)
  48. #define VFROM(R, G, B) ( I32)(( 0.439 * R) + (-0.368 * G) + (-0.071 * B) + 128.)
  49. #endif
  50. #define CLAMP8(x) (U8)((x) > 255 ? 255 : ((x) < 0 ? 0 : (x)))
  51. /* parameters for generating the U and V dither magnitude and bias */
  52. #define MAG_NUM_NEAREST 6 /* # nearest neighbors to check */
  53. #define MAG_PAL_SAMPLES 32 /* # random palette samples to check */
  54. #define BIAS_PAL_SAMPLES 128 /* number of pseudo-random RGB samples to check */
  55. #define Y_DITHER_MIN 0
  56. #define Y_DITHER_MAX 14
  57. #define RANDOM(x) (int)((((long)(x)) * (long)rand())/(long)RAND_MAX)
  58. typedef struct { int palindex; long distance; } close_t;
  59. typedef struct { int y,u,v; } Color;
  60. /* squares[] is constant values are filled in at run time, so can be global */
  61. static U32 squares[512];
  62. static struct { U8 Udither, Vdither; } dither[4] = {{2, 1}, {1, 2}, {0, 3}, {3, 0}};
  63. ;/***************************************************************************/
  64. ;/* ComputeDymanicClut() computes the clut tables on the fly, based on the */
  65. ;/* current palette[]; */
  66. ;/* called from InitColorConvertor, when CLUTAP is selected */
  67. ;/***************************************************************************/
  68. LRESULT ComputeDynamicClutNew(unsigned char BIGG *table,
  69. unsigned char FAR *APalette,
  70. int APaletteSize);
  71. #endif