deinterlace.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #ifndef __DEINTERLACE__
  2. #define __DEINTERLACE__
  3. #if defined(CONFIG_AM_DEINTERLACE_SD_ONLY)
  4. #define MAX_CANVAS_WIDTH 720
  5. #define MAX_CANVAS_HEIGHT 576
  6. #else
  7. #define MAX_CANVAS_WIDTH 1920
  8. #define MAX_CANVAS_HEIGHT 1088
  9. #endif
  10. #define DI_BUF_NUM 6
  11. typedef struct DI_MIF_TYPE {
  12. unsigned short luma_x_start0;
  13. unsigned short luma_x_end0;
  14. unsigned short luma_y_start0;
  15. unsigned short luma_y_end0;
  16. unsigned short chroma_x_start0;
  17. unsigned short chroma_x_end0;
  18. unsigned short chroma_y_start0;
  19. unsigned short chroma_y_end0;
  20. unsigned set_separate_en : 1; // 1 : y cb cr seperated canvas. 0 : one canvas.
  21. unsigned src_field_mode : 1; // 1 frame . 0 field.
  22. unsigned video_mode : 1; // 1 : 4:4:4. 0 : 4:2:2
  23. unsigned output_field_num : 1; // 0 top field 1 bottom field.
  24. unsigned burst_size_y : 2;
  25. unsigned burst_size_cb : 2;
  26. unsigned burst_size_cr : 2;
  27. unsigned canvas0_addr0 : 8;
  28. unsigned canvas0_addr1 : 8;
  29. unsigned canvas0_addr2 : 8;
  30. } DI_MIF_t;
  31. typedef struct DI_SIM_MIF_TYPE {
  32. unsigned short start_x;
  33. unsigned short end_x;
  34. unsigned short start_y;
  35. unsigned short end_y;
  36. unsigned short canvas_num;
  37. } DI_SIM_MIF_t;
  38. void disable_deinterlace(void);
  39. void disable_pre_deinterlace(void);
  40. void disable_post_deinterlace(void);
  41. int get_deinterlace_mode(void);
  42. void set_deinterlace_mode(int mode);
  43. #if defined(CONFIG_ARCH_MESON2)
  44. int get_noise_reduction_level(void);
  45. void set_noise_reduction_level(int level);
  46. #endif
  47. int get_di_pre_recycle_buf(void);
  48. const vframe_provider_t * get_vfp(void);
  49. vframe_t *peek_di_out_buf(void);
  50. void inc_field_counter(void);
  51. void set_post_di_mem(int mode);
  52. void initial_di_prepost(int hsize_pre, int vsize_pre, int hsize_post, int vsize_post, int hold_line);
  53. void initial_di_pre(int hsize_pre, int vsize_pre, int hold_line);
  54. void initial_di_post(int hsize_post, int vsize_post, int hold_line);
  55. void enable_di_mode_check(
  56. int win0_start_x, int win0_end_x, int win0_start_y, int win0_end_y,
  57. int win1_start_x, int win1_end_x, int win1_start_y, int win1_end_y,
  58. int win2_start_x, int win2_end_x, int win2_start_y, int win2_end_y,
  59. int win3_start_x, int win3_end_x, int win3_start_y, int win3_end_y,
  60. int win4_start_x, int win4_end_x, int win4_start_y, int win4_end_y,
  61. int win0_32lvl, int win1_32lvl, int win2_32lvl, int win3_32lvl, int win4_32lvl,
  62. int win0_22lvl, int win1_22lvl, int win2_22lvl, int win3_22lvl, int win4_22lvl,
  63. int field_32lvl, int field_22lvl
  64. );
  65. void enable_di_prepost_full(
  66. DI_MIF_t *di_inp_mif,
  67. DI_MIF_t *di_mem_mif,
  68. DI_MIF_t *di_buf0_mif,
  69. DI_MIF_t *di_buf1_mif,
  70. DI_MIF_t *di_chan2_mif,
  71. DI_SIM_MIF_t *di_nrwr_mif,
  72. DI_SIM_MIF_t *di_diwr_mif,
  73. DI_SIM_MIF_t *di_mtnwr_mif,
  74. DI_SIM_MIF_t *di_mtncrd_mif,
  75. DI_SIM_MIF_t *di_mtnprd_mif,
  76. int nr_en, int mtn_en, int pd32_check_en, int pd22_check_en, int hist_check_en,
  77. int ei_en, int blend_en, int blend_mtn_en, int blend_mode, int di_vpp_en, int di_ddr_en,
  78. #if defined(CONFIG_ARCH_MESON)
  79. #elif defined(CONFIG_ARCH_MESON2)
  80. int nr_hfilt_en, int nr_hfilt_mb_en, int mtn_modify_en,
  81. int blend_mtn_filt_en, int blend_data_filt_en, int post_mb_en,
  82. #endif
  83. int post_field_num, int pre_field_num, int prepost_link, int hold_line
  84. );
  85. void set_di_inp_fmt_more(
  86. int hfmt_en,
  87. int hz_yc_ratio, //2bit
  88. int hz_ini_phase, //4bit
  89. int vfmt_en,
  90. int vt_yc_ratio, //2bit
  91. int vt_ini_phase, //4bit
  92. int y_length,
  93. int c_length,
  94. int hz_rpt //1bit
  95. );
  96. void set_di_inp_mif(DI_MIF_t * mif, int urgent, int hold_line);
  97. void set_di_mem_fmt_more(
  98. int hfmt_en,
  99. int hz_yc_ratio, //2bit
  100. int hz_ini_phase, //4bit
  101. int vfmt_en,
  102. int vt_yc_ratio, //2bit
  103. int vt_ini_phase, //4bit
  104. int y_length,
  105. int c_length,
  106. int hz_rpt //1bit
  107. );
  108. void set_di_mem_mif(DI_MIF_t * mif, int urgent, int hold_line);
  109. void set_di_if1_fmt_more(
  110. int hfmt_en,
  111. int hz_yc_ratio, //2bit
  112. int hz_ini_phase, //4bit
  113. int vfmt_en,
  114. int vt_yc_ratio, //2bit
  115. int vt_ini_phase, //4bit
  116. int y_length,
  117. int c_length,
  118. int hz_rpt //1bit
  119. );
  120. void set_di_if1_mif(DI_MIF_t * mif, int urgent, int hold_line);
  121. void set_di_chan2_mif(DI_MIF_t *mif, int urgent, int hold_line);
  122. void set_di_if0_mif(DI_MIF_t *mif, int urgent, int hold_line);
  123. void enable_di_pre(
  124. DI_MIF_t *di_inp_mif,
  125. DI_MIF_t *di_mem_mif,
  126. DI_MIF_t *di_chan2_mif,
  127. DI_SIM_MIF_t *di_nrwr_mif,
  128. DI_SIM_MIF_t *di_mtnwr_mif,
  129. int nr_en, int mtn_en, int pd32_check_en, int pd22_check_en, int hist_check_en,
  130. #if defined(CONFIG_ARCH_MESON)
  131. #elif defined(CONFIG_ARCH_MESON2)
  132. int nr_hfilt_en, int nr_hfilt_mb_en, int mtn_modify_en,
  133. #endif
  134. int pre_field_num, int pre_viu_link, int hold_line
  135. );
  136. void enable_di_post(
  137. DI_MIF_t *di_buf0_mif,
  138. DI_MIF_t *di_buf1_mif,
  139. DI_SIM_MIF_t *di_diwr_mif,
  140. DI_SIM_MIF_t *di_mtncrd_mif,
  141. DI_SIM_MIF_t *di_mtnprd_mif,
  142. int ei_en, int blend_en, int blend_mtn_en, int blend_mode, int di_vpp_en, int di_ddr_en,
  143. #if defined(CONFIG_ARCH_MESON)
  144. #elif defined(CONFIG_ARCH_MESON2)
  145. int blend_mtn_filt_en, int blend_data_filt_en, int post_mb_en,
  146. #endif
  147. int post_field_num, int hold_line
  148. );
  149. void enable_region_blend(
  150. int reg0_en, int reg0_start_x, int reg0_end_x, int reg0_start_y, int reg0_end_y, int reg0_mode,
  151. int reg1_en, int reg1_start_x, int reg1_end_x, int reg1_start_y, int reg1_end_y, int reg1_mode,
  152. int reg2_en, int reg2_start_x, int reg2_end_x, int reg2_start_y, int reg2_end_y, int reg2_mode,
  153. int reg3_en, int reg3_start_x, int reg3_end_x, int reg3_start_y, int reg3_end_y, int reg3_mode
  154. );
  155. void set_vdin_par(int flag, vframe_t *buf);
  156. void di_pre_process(void);
  157. void run_deinterlace(unsigned zoom_start_x_lines, unsigned zoom_end_x_lines, unsigned zoom_start_y_lines, unsigned zoom_end_y_lines,
  158. unsigned type, int mode, int hold_line);
  159. void deinterlace_init(void);
  160. #endif