o3dgcSC3DMCEncodeParams.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. Copyright (c) 2013 Khaled Mammou - Advanced Micro Devices, Inc.
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #pragma once
  20. #ifndef O3DGC_SC3DMC_ENCODE_PARAMS_H
  21. #define O3DGC_SC3DMC_ENCODE_PARAMS_H
  22. #include "o3dgcCommon.h"
  23. namespace o3dgc
  24. {
  25. class SC3DMCEncodeParams
  26. {
  27. public:
  28. //! Constructor.
  29. SC3DMCEncodeParams(void)
  30. {
  31. memset(this, 0, sizeof(SC3DMCEncodeParams));
  32. m_encodeMode = O3DGC_SC3DMC_ENCODE_MODE_TFAN;
  33. m_streamTypeMode = O3DGC_STREAM_TYPE_ASCII;
  34. m_coordQuantBits = 14;
  35. m_normalQuantBits = 8;
  36. m_coordPredMode = O3DGC_SC3DMC_PARALLELOGRAM_PREDICTION;
  37. m_normalPredMode = O3DGC_SC3DMC_SURF_NORMALS_PREDICTION;
  38. for(unsigned long a = 0; a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES; ++a)
  39. {
  40. m_floatAttributePredMode[a] = O3DGC_SC3DMC_DIFFERENTIAL_PREDICTION;
  41. }
  42. for(unsigned long a = 0; a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES; ++a)
  43. {
  44. m_intAttributePredMode[a] = O3DGC_SC3DMC_NO_PREDICTION;
  45. }
  46. };
  47. O3DGCStreamType GetStreamType() const { return m_streamTypeMode;}
  48. O3DGCSC3DMCEncodingMode GetEncodeMode() const { return m_encodeMode;}
  49. unsigned long GetNumFloatAttributes() const { return m_numFloatAttributes;}
  50. unsigned long GetNumIntAttributes() const { return m_numIntAttributes;}
  51. unsigned long GetCoordQuantBits() const { return m_coordQuantBits;}
  52. unsigned long GetNormalQuantBits() const { return m_normalQuantBits;}
  53. unsigned long GetFloatAttributeQuantBits(unsigned long a) const
  54. {
  55. assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
  56. return m_floatAttributeQuantBits[a];
  57. }
  58. O3DGCSC3DMCPredictionMode GetCoordPredMode() const { return m_coordPredMode; }
  59. O3DGCSC3DMCPredictionMode GetNormalPredMode() const { return m_normalPredMode; }
  60. O3DGCSC3DMCPredictionMode GetFloatAttributePredMode(unsigned long a) const
  61. {
  62. assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
  63. return m_floatAttributePredMode[a];
  64. }
  65. O3DGCSC3DMCPredictionMode GetIntAttributePredMode(unsigned long a) const
  66. {
  67. assert(a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
  68. return m_intAttributePredMode[a];
  69. }
  70. O3DGCSC3DMCPredictionMode & GetCoordPredMode() { return m_coordPredMode; }
  71. O3DGCSC3DMCPredictionMode & GetNormalPredMode() { return m_normalPredMode; }
  72. O3DGCSC3DMCPredictionMode & GetFloatAttributePredMode(unsigned long a)
  73. {
  74. assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
  75. return m_floatAttributePredMode[a];
  76. }
  77. O3DGCSC3DMCPredictionMode & GetIntAttributePredMode(unsigned long a)
  78. {
  79. assert(a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
  80. return m_intAttributePredMode[a];
  81. }
  82. void SetStreamType(O3DGCStreamType streamTypeMode) { m_streamTypeMode = streamTypeMode;}
  83. void SetEncodeMode(O3DGCSC3DMCEncodingMode encodeMode) { m_encodeMode = encodeMode;}
  84. void SetNumFloatAttributes(unsigned long numFloatAttributes)
  85. {
  86. assert(numFloatAttributes < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
  87. m_numFloatAttributes = numFloatAttributes;
  88. }
  89. void SetNumIntAttributes (unsigned long numIntAttributes)
  90. {
  91. assert(numIntAttributes < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
  92. m_numIntAttributes = numIntAttributes;
  93. }
  94. void SetCoordQuantBits (unsigned int coordQuantBits ) { m_coordQuantBits = coordQuantBits ; }
  95. void SetNormalQuantBits (unsigned int normalQuantBits ) { m_normalQuantBits = normalQuantBits ; }
  96. void SetFloatAttributeQuantBits(unsigned long a, unsigned long q)
  97. {
  98. assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
  99. m_floatAttributeQuantBits[a] = q;
  100. }
  101. void SetCoordPredMode (O3DGCSC3DMCPredictionMode coordPredMode ) { m_coordPredMode = coordPredMode ; }
  102. void SetNormalPredMode (O3DGCSC3DMCPredictionMode normalPredMode ) { m_normalPredMode = normalPredMode ; }
  103. void SetFloatAttributePredMode(unsigned long a, O3DGCSC3DMCPredictionMode p)
  104. {
  105. assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
  106. m_floatAttributePredMode[a] = p;
  107. }
  108. void SetIntAttributePredMode(unsigned long a, O3DGCSC3DMCPredictionMode p)
  109. {
  110. assert(a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
  111. m_intAttributePredMode[a] = p;
  112. }
  113. private:
  114. unsigned long m_numFloatAttributes;
  115. unsigned long m_numIntAttributes;
  116. unsigned long m_coordQuantBits;
  117. unsigned long m_normalQuantBits;
  118. unsigned long m_floatAttributeQuantBits[O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES];
  119. O3DGCSC3DMCPredictionMode m_coordPredMode;
  120. O3DGCSC3DMCPredictionMode m_normalPredMode;
  121. O3DGCSC3DMCPredictionMode m_floatAttributePredMode[O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES];
  122. O3DGCSC3DMCPredictionMode m_intAttributePredMode [O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES];
  123. O3DGCStreamType m_streamTypeMode;
  124. O3DGCSC3DMCEncodingMode m_encodeMode;
  125. };
  126. }
  127. #endif // O3DGC_SC3DMC_ENCODE_PARAMS_H