PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/exynos/multimedia/utils/csc/exynos4/csc_fimc.cpp

https://bitbucket.org/cyanogenmod/android_hardware_samsung
C++ | 134 lines | 51 code | 17 blank | 66 comment | 6 complexity | 384ab339787a6b8a3ce015f1d881828a MD5 | raw file
  1. /*
  2. * Copyright (C) 2009 The Android Open Source Project
  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. /*
  17. * @file csc_fimc.cpp
  18. *
  19. * @brief csc_fimc use fimc1 to color space convertion
  20. *
  21. * @author ShinWon Lee (shinwon.lee@samsung.com)
  22. *
  23. * @version 1.0
  24. *
  25. * @history
  26. * 2011.11.01 : Create
  27. */
  28. #include <utils/Log.h>
  29. #include <dlfcn.h>
  30. #include "SEC_OMX_Def.h"
  31. #include "csc_fimc.h"
  32. #include "HardwareConverter.h"
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /*
  37. * create and open fimc handle
  38. *
  39. * @return
  40. * fimc handle
  41. */
  42. void *csc_fimc_open()
  43. {
  44. HardwareConverter *hw_converter = NULL;
  45. hw_converter = new HardwareConverter;
  46. if (hw_converter->bHWconvert_flag == 0) {
  47. delete hw_converter;
  48. hw_converter = NULL;
  49. ALOGE("%s LINE = %d HardwareConverter failed", __func__, __LINE__);
  50. }
  51. return (void *)hw_converter;
  52. }
  53. /*
  54. * close and destroy fimc handle
  55. *
  56. * @param handle
  57. * fimc handle[in]
  58. *
  59. * @return
  60. * pass or fail
  61. */
  62. CSC_FIMC_ERROR_CODE csc_fimc_close(void *handle)
  63. {
  64. HardwareConverter *hw_converter = (HardwareConverter *)handle;
  65. if (hw_converter != NULL)
  66. delete hw_converter;
  67. return CSC_FIMC_RET_OK;
  68. }
  69. /*
  70. * convert color space nv12t to omxformat
  71. *
  72. * @param handle
  73. * fimc handle[in]
  74. *
  75. * @param dst_addr
  76. * y,u,v address of dst_addr[out]
  77. *
  78. * @param src_addr
  79. * y,uv address of src_addr.Format is nv12t[in]
  80. *
  81. * @param width
  82. * width of dst image[in]
  83. *
  84. * @param height
  85. * height of dst image[in]
  86. *
  87. * @param omxformat
  88. * omxformat of dst image[in]
  89. *
  90. * @return
  91. * pass or fail
  92. */
  93. CSC_FIMC_ERROR_CODE csc_fimc_convert_nv12t(
  94. void *handle,
  95. void **dst_addr,
  96. void **src_addr,
  97. unsigned int width,
  98. unsigned int height,
  99. OMX_COLOR_FORMATTYPE omxformat)
  100. {
  101. CSC_FIMC_ERROR_CODE ret = CSC_FIMC_RET_OK;
  102. HardwareConverter *hw_converter = (HardwareConverter *)handle;
  103. if (hw_converter == NULL) {
  104. ret = CSC_FIMC_RET_FAIL;
  105. goto EXIT;
  106. }
  107. hw_converter->convert(
  108. (void *)src_addr, (void *)dst_addr,
  109. (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatNV12TPhysicalAddress,
  110. width, height, omxformat);
  111. ret = CSC_FIMC_RET_OK;
  112. EXIT:
  113. return ret;
  114. }
  115. #ifdef __cplusplus
  116. }
  117. #endif