Etc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright 2015 The Etc2Comp Authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. #include "EtcConfig.h"
  18. #include "EtcImage.h"
  19. #include "EtcColor.h"
  20. #include "EtcErrorMetric.h"
  21. #include <memory>
  22. #define ETCCOMP_MIN_EFFORT_LEVEL (0.0f)
  23. #define ETCCOMP_DEFAULT_EFFORT_LEVEL (40.0f)
  24. #define ETCCOMP_MAX_EFFORT_LEVEL (100.0f)
  25. namespace Etc
  26. {
  27. class Block4x4EncodingBits;
  28. struct RawImage
  29. {
  30. int uiExtendedWidth;
  31. int uiExtendedHeight;
  32. unsigned int uiEncodingBitsBytes;
  33. std::shared_ptr<unsigned char> paucEncodingBits;
  34. };
  35. // C-style inteface to the encoder
  36. void Encode(float *a_pafSourceRGBA,
  37. unsigned int a_uiSourceWidth,
  38. unsigned int a_uiSourceHeight,
  39. Image::Format a_format,
  40. ErrorMetric a_eErrMetric,
  41. float a_fEffort,
  42. unsigned int a_uiJobs,
  43. unsigned int a_uimaxJobs,
  44. unsigned char **a_ppaucEncodingBits,
  45. unsigned int *a_puiEncodingBitsBytes,
  46. unsigned int *a_puiExtendedWidth,
  47. unsigned int *a_puiExtendedHeight,
  48. int *a_piEncodingTime_ms, bool a_bVerboseOutput = false);
  49. void EncodeMipmaps(float *a_pafSourceRGBA,
  50. unsigned int a_uiSourceWidth,
  51. unsigned int a_uiSourceHeight,
  52. Image::Format a_format,
  53. ErrorMetric a_eErrMetric,
  54. float a_fEffort,
  55. unsigned int a_uiJobs,
  56. unsigned int a_uiMaxJobs,
  57. unsigned int a_uiMaxMipmaps,
  58. unsigned int a_uiMipFilterFlags,
  59. RawImage* a_pMipmaps,
  60. int *a_piEncodingTime_ms, bool a_bVerboseOutput = false);
  61. }