1 // Copyright 2017 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FPDFAPI_PAGE_CPDF_SAMPLEDFUNC_H_ 8 #define CORE_FPDFAPI_PAGE_CPDF_SAMPLEDFUNC_H_ 9 10 #include <vector> 11 12 #include "core/fpdfapi/page/cpdf_function.h" 13 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 14 #include "core/fxcrt/retain_ptr.h" 15 16 class CPDF_SampledFunc : public CPDF_Function { 17 public: 18 struct SampleEncodeInfo { 19 float encode_max; 20 float encode_min; 21 uint32_t sizes; 22 }; 23 24 struct SampleDecodeInfo { 25 float decode_max; 26 float decode_min; 27 }; 28 29 CPDF_SampledFunc(); 30 ~CPDF_SampledFunc() override; 31 32 // CPDF_Function 33 bool v_Init(CPDF_Object* pObj) override; 34 bool v_Call(float* inputs, float* results) const override; 35 GetEncodeInfo()36 const std::vector<SampleEncodeInfo>& GetEncodeInfo() const { 37 return m_EncodeInfo; 38 } GetBitsPerSample()39 uint32_t GetBitsPerSample() const { return m_nBitsPerSample; } GetSampleStream()40 RetainPtr<CPDF_StreamAcc> GetSampleStream() const { return m_pSampleStream; } 41 42 private: 43 std::vector<SampleEncodeInfo> m_EncodeInfo; 44 std::vector<SampleDecodeInfo> m_DecodeInfo; 45 uint32_t m_nBitsPerSample; 46 uint32_t m_SampleMax; 47 RetainPtr<CPDF_StreamAcc> m_pSampleStream; 48 }; 49 50 #endif // CORE_FPDFAPI_PAGE_CPDF_SAMPLEDFUNC_H_ 51