H264Mad.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 : MAD threshold calculation
  17. --
  18. ------------------------------------------------------------------------------*/
  19. #ifndef H264_MAD_H
  20. #define H264_MAD_H
  21. #include "enccommon.h"
  22. #define DSCY 32 /* n * 32 */
  23. #define I32_MAX 2147483647 /* 2 ^ 31 - 1 */
  24. #define DIV(a, b) (((a) + (SIGN(a) * (b)) / 2) / (b))
  25. #define MAD_TABLE_LEN 5
  26. typedef struct {
  27. i32 a1; /* model parameter, y = a1*x + a2 */
  28. i32 a2; /* model parameter */
  29. i32 th[MAD_TABLE_LEN]; /* mad threshold */
  30. i32 count[MAD_TABLE_LEN]; /* number of macroblocks under threshold */
  31. i32 pos; /* current position */
  32. i32 len; /* current lenght */
  33. i32 threshold; /* current frame threshold */
  34. i32 mbPerFrame; /* number of macroblocks per frame */
  35. } madTable_s;
  36. /*------------------------------------------------------------------------------
  37. Function prototypes
  38. ------------------------------------------------------------------------------*/
  39. void H264MadInit(madTable_s *mad, u32 mbPerFrame);
  40. void H264MadThreshold(madTable_s *madTable, u32 madCount);
  41. #endif