data_source_param.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*************************************************************************
  2. * Copyright (C) [2021] by Cambricon, Inc. All rights reserved
  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. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  15. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. * THE SOFTWARE.
  19. *************************************************************************/
  20. #ifndef MODULES_DATA_SOURCE_PARAM_HPP_
  21. #define MODULES_DATA_SOURCE_PARAM_HPP_
  22. namespace cnstream {
  23. /*!
  24. * @enum OutputType
  25. * @brief Enumeration variables describing the storage type of the output frame data of a module.
  26. */
  27. enum class OutputType {
  28. OUTPUT_CPU, /*!< CPU is the used storage type. */
  29. OUTPUT_MLU /*!< MLU is the used storage type. */
  30. };
  31. /*!
  32. * @enum DecoderType
  33. * @brief Enumeration variables describing the decoder type used in source module.
  34. */
  35. enum class DecoderType {
  36. DECODER_CPU, /*!< CPU decoder is used. */
  37. DECODER_MLU /*!< MLU decoder is used. */
  38. };
  39. /*!
  40. * @brief DataSourceParam is a structure for private usage.
  41. */
  42. struct DataSourceParam {
  43. OutputType output_type_ = OutputType::OUTPUT_CPU; /*!< The output type. The data is output to CPU or MLU. */
  44. size_t interval_ = 1; /*!< The interval of outputting one frame. It outputs one frame every n (interval_) frames. */
  45. DecoderType decoder_type_ = DecoderType::DECODER_CPU; /*!< The decoder type. */
  46. bool reuse_cndec_buf = false; /*!< Whether to enable the mechanism to reuse MLU codec's buffers by next modules. */
  47. int device_id_ = -1; /*!< The device ordinal. -1 is for CPU and >=0 is for MLU. */
  48. uint32_t input_buf_number_ = 2; /*!< Input buffer's number used by MLU codec. */
  49. uint32_t output_buf_number_ = 3; /*!< Output buffer's number used by MLU codec. */
  50. bool apply_stride_align_for_scaler_ = false; /*!< Whether to set outputs meet the Scaler alignment requirement. */
  51. };
  52. } // namespace cnstream
  53. #endif // MODULES_DATA_SOURCE_PARAM_HPP_