o3dgcDynamicVector.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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_DYNAMIC_VECTOR_SET_H
  21. #define O3DGC_DYNAMIC_VECTOR_SET_H
  22. #include "o3dgcCommon.h"
  23. namespace o3dgc
  24. {
  25. class DynamicVector
  26. {
  27. public:
  28. //! Constructor.
  29. DynamicVector(void)
  30. {
  31. m_num = 0;
  32. m_dim = 0;
  33. m_stride = 0;
  34. m_max = 0;
  35. m_min = 0;
  36. m_vectors = 0;
  37. };
  38. //! Destructor.
  39. ~DynamicVector(void) {};
  40. unsigned long GetNVector() const { return m_num;}
  41. unsigned long GetDimVector() const { return m_dim;}
  42. unsigned long GetStride() const { return m_stride;}
  43. const Real * GetMin() const { return m_min;}
  44. const Real * GetMax() const { return m_max;}
  45. const Real * GetVectors() const { return m_vectors;}
  46. Real * GetVectors() { return m_vectors;}
  47. Real GetMin(unsigned long j) const { return m_min[j];}
  48. Real GetMax(unsigned long j) const { return m_max[j];}
  49. void SetNVector (unsigned long num ) { m_num = num ;}
  50. void SetDimVector (unsigned long dim ) { m_dim = dim ;}
  51. void SetStride (unsigned long stride ) { m_stride = stride ;}
  52. void SetMin (Real * const min ) { m_min = min ;}
  53. void SetMax (Real * const max ) { m_max = max ;}
  54. void SetMin (unsigned long j, Real min) { m_min[j] = min ;}
  55. void SetMax (unsigned long j, Real max) { m_max[j] = max ;}
  56. void SetVectors (Real * const vectors) { m_vectors = vectors ;}
  57. void ComputeMinMax(O3DGCSC3DMCQuantizationMode quantMode)
  58. {
  59. assert( m_max && m_min && m_vectors && m_stride && m_dim && m_num);
  60. ComputeVectorMinMax(m_vectors, m_num , m_dim, m_stride, m_min , m_max , quantMode);
  61. }
  62. private:
  63. unsigned long m_num;
  64. unsigned long m_dim;
  65. unsigned long m_stride;
  66. Real * m_max;
  67. Real * m_min;
  68. Real * m_vectors;
  69. };
  70. }
  71. #endif // O3DGC_DYNAMIC_VECTOR_SET_H