vidstabcommon.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. - Description : Video stabilization common stuff for standalone and pipeline
  17. -
  18. ------------------------------------------------------------------------------*/
  19. #include "basetype.h"
  20. #include "vidstabcommon.h"
  21. /*------------------------------------------------------------------------------
  22. Function name : VSReadStabData
  23. Description :
  24. Return type : void
  25. Argument : const u32 * regMirror
  26. Argument : HWStabData * hwStabData
  27. ------------------------------------------------------------------------------*/
  28. void VSReadStabData(const u32 * regMirror, HWStabData * hwStabData)
  29. {
  30. i32 i;
  31. u32 *matrix;
  32. const u32 *reg;
  33. hwStabData->rMotionMin = (regMirror[40] & ((1 << 24) - 1));
  34. hwStabData->rMotionSum = regMirror[41];
  35. if (hwStabData->rMotionSum*8 > hwStabData->rMotionSum)
  36. hwStabData->rMotionSum *= 8;
  37. else
  38. hwStabData->rMotionSum = 0xFFFFFFFF;
  39. hwStabData->rGmvX = ((i32) (regMirror[42]) >> 26);
  40. hwStabData->rGmvY = ((i32) (regMirror[43]) >> 26);
  41. #ifdef TRACE_VIDEOSTAB_INTERNAL
  42. DEBUG_PRINT(("%8d %6d %4d %4d", hwStabData->rMotionSum,
  43. hwStabData->rMotionMin, hwStabData->rGmvX, hwStabData->rGmvY));
  44. #endif
  45. matrix = hwStabData->rMatrixVal;
  46. reg = &regMirror[42];
  47. for(i = 9; i > 0; i--)
  48. {
  49. *matrix++ = (*reg++) & ((1 << 24) - 1);
  50. #ifdef TRACE_VIDEOSTAB_INTERNAL
  51. DEBUG_PRINT((" %6d", matrix[-1]));
  52. #endif
  53. }
  54. #ifdef TRACE_VIDEOSTAB_INTERNAL
  55. DEBUG_PRINT(("\n"));
  56. #endif
  57. }