h264encapi_ext.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Abstract : H264 Encoder Extended API (just for testing)
  17. --
  18. ------------------------------------------------------------------------------*/
  19. #include "h264encapi.h"
  20. #include "h264encapi_ext.h"
  21. #include "H264Instance.h"
  22. H264EncRet H264EncSetFilter(H264EncInst inst, const H264EncFilter * pEncCfg)
  23. {
  24. h264Instance_s *pEncInst = (h264Instance_s *) inst;
  25. if(pEncInst->picParameterSet.deblockingFilterControlPresent == ENCHW_NO)
  26. return H264ENC_INVALID_STATUS;
  27. pEncInst->slice.disableDeblocking = pEncCfg->disableDeblocking;
  28. #if 0
  29. if(pEncCfg->disableDeblocking != 1)
  30. {
  31. pEncInst->slice.filterOffsetA = pEncCfg->filterOffsetA;
  32. pEncInst->slice.filterOffsetB = pEncCfg->filterOffsetB;
  33. }
  34. else
  35. {
  36. pEncInst->slice.filterOffsetA = 0;
  37. pEncInst->slice.filterOffsetB = 0;
  38. }
  39. #else
  40. pEncInst->slice.filterOffsetA = pEncCfg->filterOffsetA;
  41. pEncInst->slice.filterOffsetB = pEncCfg->filterOffsetB;
  42. #endif
  43. return H264ENC_OK;
  44. }
  45. H264EncRet H264EncGetFilter(H264EncInst inst, H264EncFilter * pEncCfg)
  46. {
  47. h264Instance_s *pEncInst = (h264Instance_s *) inst;
  48. pEncCfg->disableDeblocking = pEncInst->slice.disableDeblocking;
  49. pEncCfg->filterOffsetA = pEncInst->slice.filterOffsetA;
  50. pEncCfg->filterOffsetB = pEncInst->slice.filterOffsetB;
  51. return H264ENC_OK;
  52. }
  53. H264EncRet H264EncSetChromaQpIndexOffset(H264EncInst inst, i32 offset)
  54. {
  55. h264Instance_s *pEncInst = (h264Instance_s *) inst;
  56. ASSERT(inst != NULL);
  57. if(offset < -12 || offset > 12)
  58. {
  59. return H264ENC_INVALID_ARGUMENT;
  60. }
  61. /* Check status, only INIT is allowed */
  62. if(pEncInst->encStatus != H264ENCSTAT_INIT)
  63. {
  64. return H264ENC_INVALID_STATUS;
  65. }
  66. pEncInst->picParameterSet.chromaQpIndexOffset = offset;
  67. return H264ENC_OK;
  68. }
  69. H264EncRet H264EncSetHwBurstSize(H264EncInst inst, u32 burst)
  70. {
  71. h264Instance_s *pEncInst = (h264Instance_s *) inst;
  72. ASSERT(inst != NULL);
  73. ASSERT(burst < 64);
  74. pEncInst->asic.regs.asicCfgReg &= ~(63 << 8);
  75. pEncInst->asic.regs.asicCfgReg |= ((burst & (63)) << 8);
  76. return H264ENC_OK;
  77. }
  78. H264EncRet H264EncSetHwBurstType(H264EncInst inst, u32 bursttype)
  79. {
  80. h264Instance_s *pEncInst = (h264Instance_s *) inst;
  81. ASSERT(inst != NULL);
  82. pEncInst->asic.regs.asicCfgReg &= ~(1 << 6);
  83. pEncInst->asic.regs.asicCfgReg |= ((bursttype & (1)) << 6);
  84. return H264ENC_OK;
  85. }