amve.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. /*
  2. * Video Enhancement
  3. *
  4. * Author: Lin Xu <lin.xu@amlogic.com>
  5. * Bobby Yang <bo.yang@amlogic.com>
  6. *
  7. * Copyright (C) 2010 Amlogic Inc.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <mach/am_regs.h>
  14. #include "linux/amports/vframe.h"
  15. #include "linux/amports/ve.h"
  16. #include "ve_regs.h"
  17. #include "amve.h"
  18. static unsigned char ve_dnlp_tgt[64], ve_dnlp_rt;
  19. static ulong ve_dnlp_lpf[64], ve_dnlp_reg[16];
  20. static ulong ve_benh_inv[32][2] = { // [0]: inv_10_0, [1]: inv_11
  21. {2047, 1}, {2047, 1}, { 0, 1}, {1365, 0}, {1024, 0}, { 819, 0}, { 683, 0}, { 585, 0},
  22. { 512, 0}, { 455, 0}, { 410, 0}, { 372, 0}, { 341, 0}, { 315, 0}, { 293, 0}, { 273, 0},
  23. { 256, 0}, { 241, 0}, { 228, 0}, { 216, 0}, { 205, 0}, { 195, 0}, { 186, 0}, { 178, 0},
  24. { 171, 0}, { 164, 0}, { 158, 0}, { 152, 0}, { 146, 0}, { 141, 0}, { 137, 0}, { 132, 0},
  25. };
  26. static ulong ve_reg_limit(ulong val, ulong wid)
  27. {
  28. if (val < (1 << wid)) {
  29. return(val);
  30. } else {
  31. return((1 << wid) - 1);
  32. }
  33. }
  34. // ***************************************************************************
  35. // *** VPP_FIQ-oriented functions *********************************************
  36. // ***************************************************************************
  37. static void ve_dnlp_calculate_tgt(vframe_t *vf) // target (starting point) of a new seg is upon the total partition of the previous segs, so:
  38. // tgt[0] is always 0 & no need calculation
  39. // tgt[1] is calculated upon gamma[0]
  40. // tgt[2] is calculated upon gamma[0~1]
  41. // tgt[3] is calculated upon gamma[0~2]
  42. // ...
  43. // tgt[63] is calculated upon gamma[0~62], understood that gamma[63] will never be used
  44. {
  45. struct vframe_prop_s *p = &vf->prop;
  46. ulong i = 0, flag = 0, sum = 0, tgt = 0, gain = 8 + 3 + ((p->hist.pixel_sum) >> 30), pixs = (p->hist.pixel_sum) & 0x3fffffff;
  47. for (i = 1; i < 64; i++) {
  48. if (!flag) {
  49. sum += p->hist.gamma[i - 1]; // sum of gamma[0] ~ gamma[i-1]
  50. tgt = (sum << gain) / pixs; // mapping to total 256 luminance
  51. if (tgt < 255) {
  52. ve_dnlp_tgt[i] = (unsigned char) tgt;
  53. } else {
  54. ve_dnlp_tgt[i] = 255;
  55. flag = 1;
  56. }
  57. } else {
  58. ve_dnlp_tgt[i] = 255;
  59. }
  60. }
  61. }
  62. static void ve_dnlp_calculate_lpf(void) // lpf[0] is always 0 & no need calculation
  63. {
  64. ulong i = 0;
  65. for (i = 1; i < 64; i++) {
  66. ve_dnlp_lpf[i] = ve_dnlp_lpf[i] - (ve_dnlp_lpf[i] >> ve_dnlp_rt) + ve_dnlp_tgt[i];
  67. }
  68. }
  69. static void ve_dnlp_calculate_reg(void)
  70. {
  71. ulong i = 0;
  72. for (i = 0; i < 16; i++) {
  73. ve_dnlp_reg[i] = ve_dnlp_lpf[ i << 2 ] >> ve_dnlp_rt ;
  74. ve_dnlp_reg[i] |= (ve_dnlp_lpf[(i << 2) + 1] >> ve_dnlp_rt) << 8;
  75. ve_dnlp_reg[i] |= (ve_dnlp_lpf[(i << 2) + 2] >> ve_dnlp_rt) << 16;
  76. ve_dnlp_reg[i] |= (ve_dnlp_lpf[(i << 2) + 3] >> ve_dnlp_rt) << 24;
  77. }
  78. }
  79. static void ve_dnlp_load_reg(void)
  80. {
  81. WRITE_CBUS_REG(VPP_DNLP_CTRL_00, ve_dnlp_reg[0]);
  82. WRITE_CBUS_REG(VPP_DNLP_CTRL_01, ve_dnlp_reg[1]);
  83. WRITE_CBUS_REG(VPP_DNLP_CTRL_02, ve_dnlp_reg[2]);
  84. WRITE_CBUS_REG(VPP_DNLP_CTRL_03, ve_dnlp_reg[3]);
  85. WRITE_CBUS_REG(VPP_DNLP_CTRL_04, ve_dnlp_reg[4]);
  86. WRITE_CBUS_REG(VPP_DNLP_CTRL_05, ve_dnlp_reg[5]);
  87. WRITE_CBUS_REG(VPP_DNLP_CTRL_06, ve_dnlp_reg[6]);
  88. WRITE_CBUS_REG(VPP_DNLP_CTRL_07, ve_dnlp_reg[7]);
  89. WRITE_CBUS_REG(VPP_DNLP_CTRL_08, ve_dnlp_reg[8]);
  90. WRITE_CBUS_REG(VPP_DNLP_CTRL_09, ve_dnlp_reg[9]);
  91. WRITE_CBUS_REG(VPP_DNLP_CTRL_10, ve_dnlp_reg[10]);
  92. WRITE_CBUS_REG(VPP_DNLP_CTRL_11, ve_dnlp_reg[11]);
  93. WRITE_CBUS_REG(VPP_DNLP_CTRL_12, ve_dnlp_reg[12]);
  94. WRITE_CBUS_REG(VPP_DNLP_CTRL_13, ve_dnlp_reg[13]);
  95. WRITE_CBUS_REG(VPP_DNLP_CTRL_14, ve_dnlp_reg[14]);
  96. WRITE_CBUS_REG(VPP_DNLP_CTRL_15, ve_dnlp_reg[15]);
  97. }
  98. void ve_on_vs(vframe_t *vf)
  99. {
  100. if (ve_dnlp_rt == VE_DNLP_RT_FREEZE) {
  101. return;
  102. }
  103. // calculate dnlp target data
  104. ve_dnlp_calculate_tgt(vf);
  105. // calculate dnlp low-pass-filter data
  106. ve_dnlp_calculate_lpf();
  107. // calculate dnlp reg data
  108. ve_dnlp_calculate_reg();
  109. // load dnlp reg data
  110. ve_dnlp_load_reg();
  111. }
  112. // ***************************************************************************
  113. // *** IOCTL-oriented functions *********************************************
  114. // ***************************************************************************
  115. void ve_set_bext(struct ve_bext_s *p)
  116. {
  117. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL, ve_reg_limit(p->en , BEXT_EN_WID), BEXT_EN_BIT , BEXT_EN_WID);
  118. WRITE_CBUS_REG_BITS(VPP_BLACKEXT_CTRL , ve_reg_limit(p->start , BEXT_START_WID), BEXT_START_BIT , BEXT_START_WID);
  119. WRITE_CBUS_REG_BITS(VPP_BLACKEXT_CTRL , ve_reg_limit(p->slope1, BEXT_SLOPE1_WID), BEXT_SLOPE1_BIT, BEXT_SLOPE1_WID);
  120. WRITE_CBUS_REG_BITS(VPP_BLACKEXT_CTRL , ve_reg_limit(p->midpt , BEXT_MIDPT_WID), BEXT_MIDPT_BIT , BEXT_MIDPT_WID);
  121. WRITE_CBUS_REG_BITS(VPP_BLACKEXT_CTRL , ve_reg_limit(p->slope2, BEXT_SLOPE2_WID), BEXT_SLOPE2_BIT, BEXT_SLOPE2_WID);
  122. }
  123. void ve_set_dnlp(struct ve_dnlp_s *p)
  124. {
  125. ulong i = 0;
  126. ve_dnlp_rt = p->rt;
  127. if (!(p->en)) {
  128. ve_dnlp_rt = VE_DNLP_RT_FREEZE;
  129. }
  130. if (!(ve_dnlp_rt == VE_DNLP_RT_FREEZE)) {
  131. for (i = 0; i < 64; i++) {
  132. ve_dnlp_lpf[i] = (ulong)(p->gamma[i]) << (ulong)ve_dnlp_rt;
  133. }
  134. }
  135. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL, ve_reg_limit(p->en , DNLP_EN_WID), DNLP_EN_BIT , DNLP_EN_WID);
  136. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_00 , ve_reg_limit(p->gamma[0], DNLP_GAMMA00_WID), DNLP_GAMMA00_BIT, DNLP_GAMMA00_WID);
  137. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_00 , ve_reg_limit(p->gamma[1], DNLP_GAMMA01_WID), DNLP_GAMMA01_BIT, DNLP_GAMMA01_WID);
  138. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_00 , ve_reg_limit(p->gamma[2], DNLP_GAMMA02_WID), DNLP_GAMMA02_BIT, DNLP_GAMMA02_WID);
  139. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_00 , ve_reg_limit(p->gamma[3], DNLP_GAMMA03_WID), DNLP_GAMMA03_BIT, DNLP_GAMMA03_WID);
  140. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_01 , ve_reg_limit(p->gamma[4], DNLP_GAMMA04_WID), DNLP_GAMMA04_BIT, DNLP_GAMMA04_WID);
  141. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_01 , ve_reg_limit(p->gamma[5], DNLP_GAMMA05_WID), DNLP_GAMMA05_BIT, DNLP_GAMMA05_WID);
  142. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_01 , ve_reg_limit(p->gamma[6], DNLP_GAMMA06_WID), DNLP_GAMMA06_BIT, DNLP_GAMMA06_WID);
  143. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_01 , ve_reg_limit(p->gamma[7], DNLP_GAMMA07_WID), DNLP_GAMMA07_BIT, DNLP_GAMMA07_WID);
  144. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_02 , ve_reg_limit(p->gamma[8], DNLP_GAMMA08_WID), DNLP_GAMMA08_BIT, DNLP_GAMMA08_WID);
  145. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_02 , ve_reg_limit(p->gamma[9], DNLP_GAMMA09_WID), DNLP_GAMMA09_BIT, DNLP_GAMMA09_WID);
  146. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_02 , ve_reg_limit(p->gamma[10], DNLP_GAMMA10_WID), DNLP_GAMMA10_BIT, DNLP_GAMMA10_WID);
  147. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_02 , ve_reg_limit(p->gamma[11], DNLP_GAMMA11_WID), DNLP_GAMMA11_BIT, DNLP_GAMMA11_WID);
  148. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_03 , ve_reg_limit(p->gamma[12], DNLP_GAMMA12_WID), DNLP_GAMMA12_BIT, DNLP_GAMMA12_WID);
  149. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_03 , ve_reg_limit(p->gamma[13], DNLP_GAMMA13_WID), DNLP_GAMMA13_BIT, DNLP_GAMMA13_WID);
  150. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_03 , ve_reg_limit(p->gamma[14], DNLP_GAMMA14_WID), DNLP_GAMMA14_BIT, DNLP_GAMMA14_WID);
  151. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_03 , ve_reg_limit(p->gamma[15], DNLP_GAMMA15_WID), DNLP_GAMMA15_BIT, DNLP_GAMMA15_WID);
  152. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_04 , ve_reg_limit(p->gamma[16], DNLP_GAMMA16_WID), DNLP_GAMMA16_BIT, DNLP_GAMMA16_WID);
  153. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_04 , ve_reg_limit(p->gamma[17], DNLP_GAMMA17_WID), DNLP_GAMMA17_BIT, DNLP_GAMMA17_WID);
  154. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_04 , ve_reg_limit(p->gamma[18], DNLP_GAMMA18_WID), DNLP_GAMMA18_BIT, DNLP_GAMMA18_WID);
  155. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_04 , ve_reg_limit(p->gamma[19], DNLP_GAMMA19_WID), DNLP_GAMMA19_BIT, DNLP_GAMMA19_WID);
  156. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_05 , ve_reg_limit(p->gamma[20], DNLP_GAMMA20_WID), DNLP_GAMMA20_BIT, DNLP_GAMMA20_WID);
  157. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_05 , ve_reg_limit(p->gamma[21], DNLP_GAMMA21_WID), DNLP_GAMMA21_BIT, DNLP_GAMMA21_WID);
  158. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_05 , ve_reg_limit(p->gamma[22], DNLP_GAMMA22_WID), DNLP_GAMMA22_BIT, DNLP_GAMMA22_WID);
  159. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_05 , ve_reg_limit(p->gamma[23], DNLP_GAMMA23_WID), DNLP_GAMMA23_BIT, DNLP_GAMMA23_WID);
  160. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_06 , ve_reg_limit(p->gamma[24], DNLP_GAMMA24_WID), DNLP_GAMMA24_BIT, DNLP_GAMMA24_WID);
  161. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_06 , ve_reg_limit(p->gamma[25], DNLP_GAMMA25_WID), DNLP_GAMMA25_BIT, DNLP_GAMMA25_WID);
  162. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_06 , ve_reg_limit(p->gamma[26], DNLP_GAMMA26_WID), DNLP_GAMMA26_BIT, DNLP_GAMMA26_WID);
  163. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_06 , ve_reg_limit(p->gamma[27], DNLP_GAMMA27_WID), DNLP_GAMMA27_BIT, DNLP_GAMMA27_WID);
  164. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_07 , ve_reg_limit(p->gamma[28], DNLP_GAMMA28_WID), DNLP_GAMMA28_BIT, DNLP_GAMMA28_WID);
  165. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_07 , ve_reg_limit(p->gamma[29], DNLP_GAMMA29_WID), DNLP_GAMMA29_BIT, DNLP_GAMMA29_WID);
  166. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_07 , ve_reg_limit(p->gamma[30], DNLP_GAMMA30_WID), DNLP_GAMMA30_BIT, DNLP_GAMMA30_WID);
  167. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_07 , ve_reg_limit(p->gamma[31], DNLP_GAMMA31_WID), DNLP_GAMMA31_BIT, DNLP_GAMMA31_WID);
  168. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_08 , ve_reg_limit(p->gamma[32], DNLP_GAMMA32_WID), DNLP_GAMMA32_BIT, DNLP_GAMMA32_WID);
  169. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_08 , ve_reg_limit(p->gamma[33], DNLP_GAMMA33_WID), DNLP_GAMMA33_BIT, DNLP_GAMMA33_WID);
  170. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_08 , ve_reg_limit(p->gamma[34], DNLP_GAMMA34_WID), DNLP_GAMMA34_BIT, DNLP_GAMMA34_WID);
  171. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_08 , ve_reg_limit(p->gamma[35], DNLP_GAMMA35_WID), DNLP_GAMMA35_BIT, DNLP_GAMMA35_WID);
  172. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_09 , ve_reg_limit(p->gamma[36], DNLP_GAMMA36_WID), DNLP_GAMMA36_BIT, DNLP_GAMMA36_WID);
  173. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_09 , ve_reg_limit(p->gamma[37], DNLP_GAMMA37_WID), DNLP_GAMMA37_BIT, DNLP_GAMMA37_WID);
  174. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_09 , ve_reg_limit(p->gamma[38], DNLP_GAMMA38_WID), DNLP_GAMMA38_BIT, DNLP_GAMMA38_WID);
  175. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_09 , ve_reg_limit(p->gamma[39], DNLP_GAMMA39_WID), DNLP_GAMMA39_BIT, DNLP_GAMMA39_WID);
  176. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_10 , ve_reg_limit(p->gamma[40], DNLP_GAMMA40_WID), DNLP_GAMMA40_BIT, DNLP_GAMMA40_WID);
  177. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_10 , ve_reg_limit(p->gamma[41], DNLP_GAMMA41_WID), DNLP_GAMMA41_BIT, DNLP_GAMMA41_WID);
  178. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_10 , ve_reg_limit(p->gamma[42], DNLP_GAMMA42_WID), DNLP_GAMMA42_BIT, DNLP_GAMMA42_WID);
  179. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_10 , ve_reg_limit(p->gamma[43], DNLP_GAMMA43_WID), DNLP_GAMMA43_BIT, DNLP_GAMMA43_WID);
  180. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_11 , ve_reg_limit(p->gamma[44], DNLP_GAMMA44_WID), DNLP_GAMMA44_BIT, DNLP_GAMMA44_WID);
  181. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_11 , ve_reg_limit(p->gamma[45], DNLP_GAMMA45_WID), DNLP_GAMMA45_BIT, DNLP_GAMMA45_WID);
  182. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_11 , ve_reg_limit(p->gamma[46], DNLP_GAMMA46_WID), DNLP_GAMMA46_BIT, DNLP_GAMMA46_WID);
  183. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_11 , ve_reg_limit(p->gamma[47], DNLP_GAMMA47_WID), DNLP_GAMMA47_BIT, DNLP_GAMMA47_WID);
  184. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_12 , ve_reg_limit(p->gamma[48], DNLP_GAMMA48_WID), DNLP_GAMMA48_BIT, DNLP_GAMMA48_WID);
  185. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_12 , ve_reg_limit(p->gamma[49], DNLP_GAMMA49_WID), DNLP_GAMMA49_BIT, DNLP_GAMMA49_WID);
  186. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_12 , ve_reg_limit(p->gamma[50], DNLP_GAMMA50_WID), DNLP_GAMMA50_BIT, DNLP_GAMMA50_WID);
  187. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_12 , ve_reg_limit(p->gamma[51], DNLP_GAMMA51_WID), DNLP_GAMMA51_BIT, DNLP_GAMMA51_WID);
  188. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_13 , ve_reg_limit(p->gamma[52], DNLP_GAMMA52_WID), DNLP_GAMMA52_BIT, DNLP_GAMMA52_WID);
  189. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_13 , ve_reg_limit(p->gamma[53], DNLP_GAMMA53_WID), DNLP_GAMMA53_BIT, DNLP_GAMMA53_WID);
  190. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_13 , ve_reg_limit(p->gamma[54], DNLP_GAMMA54_WID), DNLP_GAMMA54_BIT, DNLP_GAMMA54_WID);
  191. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_13 , ve_reg_limit(p->gamma[55], DNLP_GAMMA55_WID), DNLP_GAMMA55_BIT, DNLP_GAMMA55_WID);
  192. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_14 , ve_reg_limit(p->gamma[56], DNLP_GAMMA56_WID), DNLP_GAMMA56_BIT, DNLP_GAMMA56_WID);
  193. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_14 , ve_reg_limit(p->gamma[57], DNLP_GAMMA57_WID), DNLP_GAMMA57_BIT, DNLP_GAMMA57_WID);
  194. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_14 , ve_reg_limit(p->gamma[58], DNLP_GAMMA58_WID), DNLP_GAMMA58_BIT, DNLP_GAMMA58_WID);
  195. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_14 , ve_reg_limit(p->gamma[59], DNLP_GAMMA59_WID), DNLP_GAMMA59_BIT, DNLP_GAMMA59_WID);
  196. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_15 , ve_reg_limit(p->gamma[60], DNLP_GAMMA60_WID), DNLP_GAMMA60_BIT, DNLP_GAMMA60_WID);
  197. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_15 , ve_reg_limit(p->gamma[61], DNLP_GAMMA61_WID), DNLP_GAMMA61_BIT, DNLP_GAMMA61_WID);
  198. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_15 , ve_reg_limit(p->gamma[62], DNLP_GAMMA62_WID), DNLP_GAMMA62_BIT, DNLP_GAMMA62_WID);
  199. WRITE_CBUS_REG_BITS(VPP_DNLP_CTRL_15 , ve_reg_limit(p->gamma[63], DNLP_GAMMA63_WID), DNLP_GAMMA63_BIT, DNLP_GAMMA63_WID);
  200. }
  201. void ve_set_hsvs(struct ve_hsvs_s *p)
  202. {
  203. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL, ve_reg_limit(p->en , HSVS_EN_WID), HSVS_EN_BIT , HSVS_EN_WID);
  204. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->peak_gain_h1 , PEAK_GAIN_H1_WID), PEAK_GAIN_H1_BIT , PEAK_GAIN_H1_WID);
  205. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->peak_gain_h2 , PEAK_GAIN_H2_WID), PEAK_GAIN_H2_BIT , PEAK_GAIN_H2_WID);
  206. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->peak_gain_h3 , PEAK_GAIN_H3_WID), PEAK_GAIN_H3_BIT , PEAK_GAIN_H3_WID);
  207. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->peak_gain_h4 , PEAK_GAIN_H4_WID), PEAK_GAIN_H4_BIT , PEAK_GAIN_H4_WID);
  208. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->peak_gain_h5 , PEAK_GAIN_H5_WID), PEAK_GAIN_H5_BIT , PEAK_GAIN_H5_WID);
  209. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->peak_gain_v1 , PEAK_GAIN_V1_WID), PEAK_GAIN_V1_BIT , PEAK_GAIN_V1_WID);
  210. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->peak_gain_v2 , PEAK_GAIN_V2_WID), PEAK_GAIN_V2_BIT , PEAK_GAIN_V2_WID);
  211. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->peak_gain_v3 , PEAK_GAIN_V3_WID), PEAK_GAIN_V3_BIT , PEAK_GAIN_V3_WID);
  212. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->peak_gain_v4 , PEAK_GAIN_V4_WID), PEAK_GAIN_V4_BIT , PEAK_GAIN_V4_WID);
  213. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->peak_gain_v5 , PEAK_GAIN_V5_WID), PEAK_GAIN_V5_BIT , PEAK_GAIN_V5_WID);
  214. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->peak_gain_v6 , PEAK_GAIN_V6_WID), PEAK_GAIN_V6_BIT , PEAK_GAIN_V6_WID);
  215. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_1 , ve_reg_limit(p->hpeak_slope1 , HPEAK_SLOPE1_WID), HPEAK_SLOPE1_BIT , HPEAK_SLOPE1_WID);
  216. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_1 , ve_reg_limit(p->hpeak_slope2 , HPEAK_SLOPE2_WID), HPEAK_SLOPE2_BIT , HPEAK_SLOPE2_WID);
  217. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_1 , ve_reg_limit(p->hpeak_thr1 , HPEAK_THR1_WID), HPEAK_THR1_BIT , HPEAK_THR1_WID);
  218. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_2 , ve_reg_limit(p->hpeak_thr2 , HPEAK_THR2_WID), HPEAK_THR2_BIT , HPEAK_THR2_WID);
  219. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_2 , ve_reg_limit(p->hpeak_nlp_cor_thr , HPEAK_NLP_COR_THR_WID), HPEAK_NLP_COR_THR_BIT , HPEAK_NLP_COR_THR_WID);
  220. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_2 , ve_reg_limit(p->hpeak_nlp_gain_pos, HPEAK_NLP_GAIN_POS_WID), HPEAK_NLP_GAIN_POS_BIT, HPEAK_NLP_GAIN_POS_WID);
  221. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_2 , ve_reg_limit(p->hpeak_nlp_gain_neg, HPEAK_NLP_GAIN_NEG_WID), HPEAK_NLP_GAIN_NEG_BIT, HPEAK_NLP_GAIN_NEG_WID);
  222. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_1 , ve_reg_limit(p->vpeak_slope1 , VPEAK_SLOPE1_WID), VPEAK_SLOPE1_BIT , VPEAK_SLOPE1_WID);
  223. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_1 , ve_reg_limit(p->vpeak_slope2 , VPEAK_SLOPE2_WID), VPEAK_SLOPE2_BIT , VPEAK_SLOPE2_WID);
  224. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_3 , ve_reg_limit(p->vpeak_thr1 , VPEAK_THR1_WID), VPEAK_THR1_BIT , VPEAK_THR1_WID);
  225. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_4 , ve_reg_limit(p->vpeak_thr2 , VPEAK_THR2_WID), VPEAK_THR2_BIT , VPEAK_THR2_WID);
  226. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_4 , ve_reg_limit(p->vpeak_nlp_cor_thr , VPEAK_NLP_COR_THR_WID), VPEAK_NLP_COR_THR_BIT , VPEAK_NLP_COR_THR_WID);
  227. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_4 , ve_reg_limit(p->vpeak_nlp_gain_pos, VPEAK_NLP_GAIN_POS_WID), VPEAK_NLP_GAIN_POS_BIT, VPEAK_NLP_GAIN_POS_WID);
  228. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_4 , ve_reg_limit(p->vpeak_nlp_gain_neg, VPEAK_NLP_GAIN_NEG_WID), VPEAK_NLP_GAIN_NEG_BIT, VPEAK_NLP_GAIN_NEG_WID);
  229. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_3 , ve_reg_limit(p->speak_slope1 , SPEAK_SLOPE1_WID), SPEAK_SLOPE1_BIT , SPEAK_SLOPE1_WID);
  230. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_3 , ve_reg_limit(p->speak_slope2 , SPEAK_SLOPE2_WID), SPEAK_SLOPE2_BIT , SPEAK_SLOPE2_WID);
  231. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_3 , ve_reg_limit(p->speak_thr1 , SPEAK_THR1_WID), SPEAK_THR1_BIT , SPEAK_THR1_WID);
  232. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_5 , ve_reg_limit(p->speak_thr2 , SPEAK_THR2_WID), SPEAK_THR2_BIT , SPEAK_THR2_WID);
  233. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_5 , ve_reg_limit(p->speak_nlp_cor_thr , SPEAK_NLP_COR_THR_WID), SPEAK_NLP_COR_THR_BIT , SPEAK_NLP_COR_THR_WID);
  234. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_5 , ve_reg_limit(p->speak_nlp_gain_pos, SPEAK_NLP_GAIN_POS_WID), SPEAK_NLP_GAIN_POS_BIT, SPEAK_NLP_GAIN_POS_WID);
  235. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_5 , ve_reg_limit(p->speak_nlp_gain_neg, SPEAK_NLP_GAIN_NEG_WID), SPEAK_NLP_GAIN_NEG_BIT, SPEAK_NLP_GAIN_NEG_WID);
  236. WRITE_CBUS_REG_BITS(VPP_PEAKING_NLP_3 , ve_reg_limit(p->peak_cor_gain , PEAK_COR_GAIN_WID), PEAK_COR_GAIN_BIT , PEAK_COR_GAIN_WID);
  237. WRITE_CBUS_REG_BITS(VPP_SHARP_LIMIT , ve_reg_limit(p->peak_cor_thr_l , PEAK_COR_THR_L_WID), PEAK_COR_THR_L_BIT , PEAK_COR_THR_L_WID);
  238. WRITE_CBUS_REG_BITS(VPP_SHARP_LIMIT , ve_reg_limit(p->peak_cor_thr_h , PEAK_COR_THR_H_WID), PEAK_COR_THR_H_BIT , PEAK_COR_THR_H_WID);
  239. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->vlti_step , VLTI_STEP_WID), VLTI_STEP_BIT , VLTI_STEP_WID);
  240. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->vlti_step2 , VLTI_STEP2_WID), VLTI_STEP2_BIT , VLTI_STEP2_WID);
  241. WRITE_CBUS_REG_BITS(VPP_VLTI_CTRL , ve_reg_limit(p->vlti_thr , VLTI_THR_WID), VLTI_THR_BIT , VLTI_THR_WID);
  242. WRITE_CBUS_REG_BITS(VPP_VLTI_CTRL , ve_reg_limit(p->vlti_gain_pos , VLTI_GAIN_POS_WID), VLTI_GAIN_POS_BIT , VLTI_GAIN_POS_WID);
  243. WRITE_CBUS_REG_BITS(VPP_VLTI_CTRL , ve_reg_limit(p->vlti_gain_neg , VLTI_GAIN_NEG_WID), VLTI_GAIN_NEG_BIT , VLTI_GAIN_NEG_WID);
  244. WRITE_CBUS_REG_BITS(VPP_VLTI_CTRL , ve_reg_limit(p->vlti_blend_factor , VLTI_BLEND_FACTOR_WID), VLTI_BLEND_FACTOR_BIT , VLTI_BLEND_FACTOR_WID);
  245. WRITE_CBUS_REG_BITS(VPP_PEAKING_HGAIN , ve_reg_limit(p->hlti_step , HLTI_STEP_WID), HLTI_STEP_BIT , HLTI_STEP_WID);
  246. WRITE_CBUS_REG_BITS(VPP_HLTI_CTRL , ve_reg_limit(p->hlti_thr , HLTI_THR_WID), HLTI_THR_BIT , HLTI_THR_WID);
  247. WRITE_CBUS_REG_BITS(VPP_HLTI_CTRL , ve_reg_limit(p->hlti_gain_pos , HLTI_GAIN_POS_WID), HLTI_GAIN_POS_BIT , HLTI_GAIN_POS_WID);
  248. WRITE_CBUS_REG_BITS(VPP_HLTI_CTRL , ve_reg_limit(p->hlti_gain_neg , HLTI_GAIN_NEG_WID), HLTI_GAIN_NEG_BIT , HLTI_GAIN_NEG_WID);
  249. WRITE_CBUS_REG_BITS(VPP_HLTI_CTRL , ve_reg_limit(p->hlti_blend_factor , HLTI_BLEND_FACTOR_WID), HLTI_BLEND_FACTOR_BIT , HLTI_BLEND_FACTOR_WID);
  250. WRITE_CBUS_REG_BITS(VPP_SHARP_LIMIT , ve_reg_limit(p->vlimit_coef_h , VLIMIT_COEF_H_WID), VLIMIT_COEF_H_BIT , VLIMIT_COEF_H_WID);
  251. WRITE_CBUS_REG_BITS(VPP_SHARP_LIMIT , ve_reg_limit(p->vlimit_coef_l , VLIMIT_COEF_L_WID), VLIMIT_COEF_L_BIT , VLIMIT_COEF_L_WID);
  252. WRITE_CBUS_REG_BITS(VPP_SHARP_LIMIT , ve_reg_limit(p->hlimit_coef_h , HLIMIT_COEF_H_WID), HLIMIT_COEF_H_BIT , HLIMIT_COEF_H_WID);
  253. WRITE_CBUS_REG_BITS(VPP_SHARP_LIMIT , ve_reg_limit(p->hlimit_coef_l , HLIMIT_COEF_L_WID), HLIMIT_COEF_L_BIT , HLIMIT_COEF_L_WID);
  254. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->cti_444_422_en , CTI_C444TO422_EN_WID), CTI_C444TO422_EN_BIT , CTI_C444TO422_EN_WID);
  255. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->cti_422_444_en , CTI_C422TO444_EN_WID), CTI_C422TO444_EN_BIT , CTI_C422TO444_EN_WID);
  256. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->cti_blend_factor , CTI_BLEND_FACTOR_WID), CTI_BLEND_FACTOR_BIT , CTI_BLEND_FACTOR_WID);
  257. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->vcti_buf_en , VCTI_BUF_EN_WID), VCTI_BUF_EN_BIT , VCTI_BUF_EN_WID);
  258. WRITE_CBUS_REG_BITS(VPP_PEAKING_VGAIN , ve_reg_limit(p->vcti_buf_mode_c5l , VCTI_BUF_MODE_C5L_WID), VCTI_BUF_MODE_C5L_BIT , VCTI_BUF_MODE_C5L_WID);
  259. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->vcti_filter , VCTI_FILTER_WID), VCTI_FILTER_BIT , VCTI_FILTER_WID);
  260. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->hcti_step , HCTI_STEP_WID), HCTI_STEP_BIT , HCTI_STEP_WID);
  261. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->hcti_step2 , HCTI_STEP2_WID), HCTI_STEP2_BIT , HCTI_STEP2_WID);
  262. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->hcti_thr , HCTI_THR_WID), HCTI_THR_BIT , HCTI_THR_WID);
  263. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->hcti_gain , HCTI_GAIN_WID), HCTI_GAIN_BIT , HCTI_GAIN_WID);
  264. WRITE_CBUS_REG_BITS(VPP_CTI_CTRL , ve_reg_limit(p->hcti_mode_median , HCTI_MODE_MEDIAN_WID), HCTI_MODE_MEDIAN_BIT , HCTI_MODE_MEDIAN_WID);
  265. }
  266. void ve_set_ccor(struct ve_ccor_s *p)
  267. {
  268. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL, ve_reg_limit(p->en , CCOR_EN_WID), CCOR_EN_BIT , CCOR_EN_WID);
  269. WRITE_CBUS_REG_BITS(VPP_CCORING_CTRL , ve_reg_limit(p->slope, CCOR_SLOPE_WID), CCOR_SLOPE_BIT, CCOR_SLOPE_WID);
  270. WRITE_CBUS_REG_BITS(VPP_CCORING_CTRL , ve_reg_limit(p->thr , CCOR_THR_WID), CCOR_THR_BIT , CCOR_THR_WID);
  271. }
  272. void ve_set_benh(struct ve_benh_s *p)
  273. {
  274. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL, ve_reg_limit(p->en , BENH_EN_WID) , BENH_EN_BIT , BENH_EN_WID);
  275. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_reg_limit(p->cb_inc , BENH_CB_INC_WID) , BENH_CB_INC_BIT , BENH_CB_INC_WID);
  276. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_reg_limit(p->cr_inc , BENH_CR_INC_WID) , BENH_CR_INC_BIT , BENH_CR_INC_WID);
  277. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_reg_limit(p->gain_cr , BENH_GAIN_CR_WID) , BENH_GAIN_CR_BIT , BENH_GAIN_CR_WID);
  278. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_reg_limit(p->gain_cb4cr , BENH_GAIN_CB4CR_WID) , BENH_GAIN_CB4CR_BIT , BENH_GAIN_CB4CR_WID);
  279. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_reg_limit(p->luma_h , BENH_LUMA_H_WID) , BENH_LUMA_H_BIT , BENH_LUMA_H_WID);
  280. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_2, ve_reg_limit(p->err_crp , BENH_ERR_CRP_WID) , BENH_ERR_CRP_BIT , BENH_ERR_CRP_WID);
  281. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_2, ve_reg_limit(p->err_crn , BENH_ERR_CRN_WID) , BENH_ERR_CRN_BIT , BENH_ERR_CRN_WID);
  282. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_3, ve_reg_limit(p->err_cbp , BENH_ERR_CBP_WID) , BENH_ERR_CBP_BIT , BENH_ERR_CBP_WID);
  283. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_3, ve_reg_limit(p->err_cbn , BENH_ERR_CBN_WID) , BENH_ERR_CBN_BIT , BENH_ERR_CBN_WID);
  284. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_benh_inv[ve_reg_limit(p->err_crp, BENH_ERR_CRP_WID)][1], BENH_ERR_CRP_INV_H_BIT, BENH_ERR_CRP_INV_H_WID);
  285. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_benh_inv[ve_reg_limit(p->err_crn, BENH_ERR_CRN_WID)][1], BENH_ERR_CRN_INV_H_BIT, BENH_ERR_CRN_INV_H_WID);
  286. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_benh_inv[ve_reg_limit(p->err_cbp, BENH_ERR_CBP_WID)][1], BENH_ERR_CBP_INV_H_BIT, BENH_ERR_CBP_INV_H_WID);
  287. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_1, ve_benh_inv[ve_reg_limit(p->err_cbn, BENH_ERR_CBN_WID)][1], BENH_ERR_CBN_INV_H_BIT, BENH_ERR_CBN_INV_H_WID);
  288. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_2, ve_benh_inv[ve_reg_limit(p->err_crp, BENH_ERR_CRP_WID)][0], BENH_ERR_CRP_INV_L_BIT, BENH_ERR_CRP_INV_L_WID);
  289. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_2, ve_benh_inv[ve_reg_limit(p->err_crn, BENH_ERR_CRN_WID)][0], BENH_ERR_CRN_INV_L_BIT, BENH_ERR_CRN_INV_L_WID);
  290. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_3, ve_benh_inv[ve_reg_limit(p->err_cbp, BENH_ERR_CBP_WID)][0], BENH_ERR_CBP_INV_L_BIT, BENH_ERR_CBP_INV_L_WID);
  291. WRITE_CBUS_REG_BITS(VPP_BLUE_STRETCH_3, ve_benh_inv[ve_reg_limit(p->err_cbn, BENH_ERR_CBN_WID)][0], BENH_ERR_CBN_INV_L_BIT, BENH_ERR_CBN_INV_L_WID);
  292. }
  293. void ve_set_demo(struct ve_demo_s *p)
  294. {
  295. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL , ve_reg_limit(p->bext, DEMO_BEXT_WID), DEMO_BEXT_BIT, DEMO_BEXT_WID);
  296. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL , ve_reg_limit(p->dnlp, DEMO_DNLP_WID), DEMO_DNLP_BIT, DEMO_DNLP_WID);
  297. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL , ve_reg_limit(p->hsvs, DEMO_HSVS_WID), DEMO_HSVS_BIT, DEMO_HSVS_WID);
  298. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL , ve_reg_limit(p->ccor, DEMO_CCOR_WID), DEMO_CCOR_BIT, DEMO_CCOR_WID);
  299. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL , ve_reg_limit(p->benh, DEMO_BENH_WID), DEMO_BENH_BIT, DEMO_BENH_WID);
  300. WRITE_CBUS_REG_BITS(VPP_VE_ENABLE_CTRL , ve_reg_limit(p->pos , VE_DEMO_POS_WID), VE_DEMO_POS_BIT, VE_DEMO_POS_WID);
  301. WRITE_CBUS_REG_BITS(VPP_VE_DEMO_LEFT_SCREEN_WIDTH, ve_reg_limit(p->wid , DEMO_WID_WID), DEMO_WID_BIT , DEMO_WID_WID);
  302. }
  303. void ve_set_regs(struct ve_regs_s *p)
  304. {
  305. if (!(p->mode)) { // read
  306. switch (p->port) {
  307. case 0: // direct access
  308. p->val = READ_CBUS_REG_BITS(p->reg, p->bit, p->wid);
  309. break;
  310. case 1: // reserved
  311. break;
  312. case 2: // reserved
  313. break;
  314. case 3: // reserved
  315. break;
  316. default: // NA
  317. break;
  318. }
  319. } else { // write
  320. switch (p->port) {
  321. case 0: // direct access
  322. WRITE_CBUS_REG_BITS(p->reg, ve_reg_limit(p->val, p->wid), p->bit, p->wid);
  323. break;
  324. case 1: // reserved
  325. break;
  326. case 2: // reserved
  327. break;
  328. case 3: // reserved
  329. break;
  330. default: // NA
  331. break;
  332. }
  333. }
  334. }