hv_drv_OsdCommon.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @file hv_drv_OsdFont.c
  3. * @brief Osd Driver common c file.
  4. * @details This file provides the following functions: \n
  5. * (1) resource size getter functions \n
  6. * (5) all kinds of string getter functions \n
  7. *
  8. * @author HiView SoC Software Team
  9. * @version 1.0.0
  10. * @date 2022-08-31
  11. * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
  12. * @par History:
  13. * <table>
  14. * <tr><th>Author <th>Date <th>Change Description
  15. * <tr><td>OSD Group <td>2022-08-31 <td>create
  16. * </table>
  17. */
  18. #include "hv_drv_Osd.h"
  19. const CHAR8* Hv_Drv_OsdCommon_GetPixelFormatStr(OsdPixelFormat enFormat)
  20. {
  21. static const CHAR8 * const s_apPixelFormatStrings[] =
  22. {"RGBA8888", "RGBA4444", "RGB565", "A8", "A4", "RGB888"};
  23. return s_apPixelFormatStrings[enFormat];
  24. }
  25. const CHAR8 *Hv_Drv_OsdCommon_GetTextAlignTypeStr(UCHAR8 ucAlignType)
  26. {
  27. static const CHAR8 * const s_apAlignStrings[] =
  28. {"Left-Aligned", "Center-Aligned", "Right-Aligned"};
  29. return s_apAlignStrings[ucAlignType];
  30. }
  31. const CHAR8 *Hv_Drv_OsdCommon_GetResourceSizeStr(OsdResourceSize enSize)
  32. {
  33. UCHAR8 ucWidth = 0;
  34. UCHAR8 ucHeight = 0;
  35. static CHAR8 s_acUserDefinedString[8];
  36. Hv_Drv_OsdResource_GetSize(enSize, &ucWidth, &ucHeight);
  37. HV_SPRINTF(s_acUserDefinedString, "%dX%d", ucWidth, ucHeight);
  38. return s_acUserDefinedString;
  39. }
  40. const CHAR8 *Hv_Drv_OsdCommon_GetResourceTypeStr(OsdResourceType enType)
  41. {
  42. static const CHAR8 * const s_apResourceTypeStrings[] = {"1bit", "2bit", "4bit", "6bit", "8bit"};
  43. return s_apResourceTypeStrings[enType];
  44. }
  45. const CHAR8 *Hv_Drv_OsdCommon_GetSRAMChangeTypeStr(OsdSRAMChangeType enType)
  46. {
  47. static const CHAR8 * const s_apSRAMChangeTypeStrings[] = {"None", "Partial", "Full"};
  48. return s_apSRAMChangeTypeStrings[enType];
  49. }
  50. const CHAR8 *Hv_Drv_OsdCommon_GetBlendingStageStr(OsdBlendingStage enStage)
  51. {
  52. static const CHAR8 * const s_apBlendingStageStrings[] = {
  53. "rectgroup", "rectgroup-font", "win01", "win23", "win0123",
  54. "winrect", "winall", "winall-graphic", "hsblend"
  55. };
  56. return s_apBlendingStageStrings[enStage];
  57. }
  58. USHORT16 Hv_Drv_OsdCommon_GetResourceBytes(OsdResourceSize enSize, OsdResourceType enType)
  59. {
  60. UCHAR8 ucWidth = 0;
  61. UCHAR8 ucHeight = 0;
  62. UCHAR8 ucBits = 0;
  63. USHORT16 usBytes = 0;
  64. Hv_Drv_OsdResource_GetSize(enSize, &ucWidth, &ucHeight);
  65. ucBits = Hv_Drv_OsdResource_GetBits(enType);
  66. usBytes = ((USHORT16)ucWidth * ucHeight * ucBits) >> 3;
  67. return usBytes;
  68. }
  69. UCHAR8 Hv_Drv_OsdCommon_GetPixelBits(OsdPixelFormat enFormat)
  70. {
  71. return Hv_Cal_Osd_GetPixelBits(enFormat);
  72. }