encode.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //*@@@+++@@@@******************************************************************
  2. //
  3. // Copyright © Microsoft Corp.
  4. // All rights reserved.
  5. //
  6. // Redistribution and use in source and binary forms, with or without
  7. // modification, are permitted provided that the following conditions are met:
  8. //
  9. // • Redistributions of source code must retain the above copyright notice,
  10. // this list of conditions and the following disclaimer.
  11. // • Redistributions in binary form must reproduce the above copyright notice,
  12. // this list of conditions and the following disclaimer in the documentation
  13. // and/or other materials provided with the distribution.
  14. //
  15. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  19. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. // POSSIBILITY OF SUCH DAMAGE.
  26. //
  27. //*@@@---@@@@******************************************************************
  28. #ifndef WMI_ENCODE_H
  29. #define WMI_ENCODE_H
  30. #include "strcodec.h"
  31. /*************************************************************************
  32. struct / class definitions
  33. *************************************************************************/
  34. Int EncodeMacroblockDC(CWMImageStrCodec*, CCodingContext *, Int, Int);
  35. Int EncodeMacroblockLowpass(CWMImageStrCodec*, CCodingContext *, Int, Int);
  36. Int EncodeMacroblockHighpass(CWMImageStrCodec*, CCodingContext *, Int, Int);
  37. Int quantizeMacroblock(CWMImageStrCodec *);
  38. Void transformMacroblock(CWMImageStrCodec *);
  39. Void predMacroblockEnc(CWMImageStrCodec *);
  40. Void AdaptLowpassEnc(CCodingContext *pContext);
  41. Void AdaptHighpassEnc(CCodingContext *pContext);
  42. Void ResetCodingContextEnc(CCodingContext *pContext);
  43. Int AllocateCodingContextEnc(struct CWMImageStrCodec *pSC, Int iNumContexts, Int iTrimFlexBits);
  44. Void FreeCodingContextEnc(struct CWMImageStrCodec *pSC);
  45. Void predCBPEnc(CWMImageStrCodec *pSC, CCodingContext *pContext);
  46. /*************************************************************************
  47. Forward transform definitions
  48. *************************************************************************/
  49. /** 2-point pre filter for boundaries (only used in 420 UV DC subband) **/
  50. Void strPre2(PixelI *, PixelI *);
  51. /** 2x2 pre filter (only used in 420 UV DC subband) **/
  52. Void strPre2x2(PixelI *, PixelI *, PixelI *, PixelI *);
  53. /** 4-point pre filter for boundaries **/
  54. Void strPre4(PixelI *, PixelI *, PixelI *, PixelI *);
  55. /** data allocation in working buffer (first stage) **/
  56. /** Y, 444 U and V **/
  57. /** 0 1 2 3 **/
  58. /** 32 33 34 35 **/
  59. /** 64 65 66 67 **/
  60. /** 96 97 98 99 **/
  61. /** 420 U and V **/
  62. /** 0 2 4 6 **/
  63. /** 64 66 68 70 **/
  64. /** 128 130 132 134 **/
  65. /** 192 194 196 198 **/
  66. /** 4x4 foward DCT for first stage **/
  67. Void strDCT4x4FirstStage(PixelI *);
  68. Void strDCT4x4FirstStage420UV(PixelI *);
  69. Void strDCT4x4Stage1(PixelI*);
  70. /** 4x4 pre filter for first stage **/
  71. Void strPre4x4FirstStage(PixelI *);
  72. Void strPre4x4FirstStage420UV(PixelI *);
  73. Void strPre4x4Stage1Split(PixelI* p0, PixelI* p1, Int iOffset);
  74. Void strPre4x4Stage1(PixelI* p, Int iOffset);
  75. /** data allocation in working buffer (second stage)**/
  76. /** Y, 444 U and V **/
  77. /** 0 4 8 12 **/
  78. /** 128 132 136 140 **/
  79. /** 256 260 264 268 **/
  80. /** 384 388 392 396 **/
  81. /** 420 U and V **/
  82. /** 0 8 **/
  83. /** 256 264 **/
  84. /** 4x4 foward DCT for second stage **/
  85. Void strDCT4x4SecondStage(PixelI *);
  86. Void strNormalizeEnc(PixelI *, Bool);
  87. Void strDCT2x2dnEnc(PixelI *, PixelI *, PixelI *, PixelI *);
  88. /** 4x4 pre filter for second stage **/
  89. Void strPre4x4Stage2Split(PixelI* p0, PixelI* p1);
  90. #endif // ENCODE_H