kalama_technology.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #include "perf_static_model.h"
  6. #define ENABLE_FINEBITRATE_SUBUHD60 0
  7. /*
  8. * Chipset Generation Technology: SW/FW overhead profiling
  9. * need update with new numbers
  10. */
  11. static u32 frequency_table_kalama[2][6] =
  12. {
  13. /* //make lowsvs_D1 as invalid; */
  14. {533, 444, 366, 338, 240, 0},
  15. {800, 666, 549, 507, 360, 0},
  16. };
  17. /*
  18. * TODO Move to kalama.c
  19. * TODO Replace hardcoded values with
  20. * ENCODER_VPP_TARGET_CLK_PER_MB_KALAMA in CPP file.
  21. */
  22. /* Tensilica cycles */
  23. #define DECODER_VPP_FW_OVERHEAD_KALAMA 66234
  24. /* Tensilica cycles; this is measured in Lahaina 1stage with FW profiling */
  25. #define DECODER_VPPVSP1STAGE_FW_OVERHEAD_KALAMA 93000
  26. #define DECODER_VSP_FW_OVERHEAD_KALAMA \
  27. DECODER_VPPVSP1STAGE_FW_OVERHEAD_KALAMA - DECODER_VPP_FW_OVERHEAD_KALAMA
  28. /* Tensilica cycles; encoder has ARP register */
  29. #define ENCODER_VPP_FW_OVERHEAD_KALAMA 48405
  30. #define ENCODER_VPPVSP1STAGE_FW_OVERHEAD_KALAMA \
  31. ENCODER_VPP_FW_OVERHEAD_KALAMA + DECODER_VSP_FW_OVERHEAD_KALAMA
  32. #define DECODER_SW_OVERHEAD_KALAMA 489583
  33. #define ENCODER_SW_OVERHEAD_KALAMA 489583
  34. /* Video IP Core Technology: pipefloor and pipe penlaty */
  35. static u32 encoder_vpp_target_clk_per_mb_kalama[2] = {320, 675};
  36. static u32 decoder_vpp_target_clk_per_mb_kalama = 200;
  37. /*
  38. * These pipe penalty numbers only applies to 4 pipe
  39. * For 2pipe and 1pipe, these numbers need recalibrate
  40. */
  41. static u32 pipe_penalty_kalama[3][3] =
  42. {
  43. /* NON AV1 */
  44. {1059, 1059, 1059},
  45. /* AV1 RECOMMENDED TILE 1080P_V2XH1, UHD_V2X2, 8KUHD_V8X2 */
  46. {1410, 1248, 1226},
  47. /* AV1 YOUTUBE/NETFLIX TILE 1080P_V4XH2_V4X1, UHD_V8X4_V8X1, 8KUHD_V8X8_V8X1 */
  48. {2039, 2464, 1191},
  49. };
  50. /*
  51. * Video IP Core Technology: bitrate constraint
  52. * HW limit bitrate table (these values are measured end to end fw/sw impacts are also considered)
  53. * TODO Can we convert to Cycles/MB? This will remove DIVISION.
  54. */
  55. static u32 bitrate_table_kalama_2stage_fp[5][10] =
  56. {
  57. /* h264 cavlc */
  58. {0, 220, 220, 220, 220, 220, 220, 220, 220, 220},
  59. /* h264 cabac */
  60. {0, 140, 150, 160, 175, 190, 190, 190, 190, 190},
  61. /* h265 */
  62. {90, 140, 160, 180, 190, 200, 200, 200, 200, 200},
  63. /* vp9 */
  64. {90, 90, 90, 90, 90, 90, 90, 90, 90, 90},
  65. /* av1 */
  66. {130, 130, 120, 120, 120, 120, 120, 120, 120, 120},
  67. };
  68. /* HW limit bitrate table (these values are measured end to end fw/sw impacts are also considered) */
  69. static u32 bitrate_table_kalama_1stage_fp[5][10] = /* 1-stage assume IPPP */
  70. {
  71. /* h264 cavlc */
  72. {0, 220, 220, 220, 220, 220, 220, 220, 220, 220},
  73. /* h264 cabac */
  74. {0, 110, 150, 150, 150, 150, 150, 150, 150, 150},
  75. /* h265 */
  76. {0, 140, 150, 150, 150, 150, 150, 150, 150, 150},
  77. /* vp9 */
  78. {0, 70, 70, 70, 70, 70, 70, 70, 70, 70},
  79. /* av1 */
  80. {0, 100, 100, 100, 100, 100, 100, 100, 100, 100},
  81. };
  82. /* rec pwc and power bitrate table */
  83. static u32 bitrate_table_kalama_rec_fp[5][10] =
  84. {
  85. /* rec. worst bitrate based on bitrate table */
  86. #if ENABLE_FINEBITRATE_SUBUHD60
  87. /* h264 cavlc */
  88. {0, 168, 150, 120, 100, 90, 50, 32, 20, 14},
  89. /* h264 cabac 8bit */
  90. {0, 134, 109, 84, 67, 56, 35, 23, 14, 10},
  91. /* h265 10bit assumption */
  92. {70, 140, 116, 92, 74, 62, 39, 25, 16, 11},
  93. /* vp9 (profiled content from youtube and nflx) */
  94. {70, 70, 65, 55, 45, 35, 20, 8, 6, 5},
  95. /* av1 (profiled content from youtube and nflx) */
  96. {100, 100, 85, 70, 55, 30, 15, 5, 5, 5},
  97. #else
  98. /* h264 cavlc */
  99. {0, 168, 150, 120, 100, 90, 90, 90, 90, 90},
  100. /* h264 cabac 8bit */
  101. {0, 134, 109, 84, 67, 56, 56, 56, 56, 56},
  102. /* h265 10bit assumption */
  103. {70, 140, 116, 92, 74, 62, 62, 62, 62, 62},
  104. /* vp9 */
  105. {70, 70, 65, 55, 45, 35, 35, 35, 35, 35},
  106. /* av1 */
  107. {100, 100, 85, 70, 55, 50, 50, 50, 50, 50},
  108. #endif
  109. };
  110. static u32 input_bitrate_fp = 0;
  111. /* 8KUHD60; UHD240; 1080p960 with B */
  112. static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240;
  113. /* 8KUHD60; UHD240; 1080p960 without B */
  114. static u32 fp_pixel_count_bar1 = 3840 * 2160 * 240;
  115. /* 1080p720 */
  116. static u32 fp_pixel_count_bar2 = 3840 * 2160 * 180;
  117. /* UHD120 */
  118. static u32 fp_pixel_count_bar3 = 3840 * 2160 * 120;
  119. /* UHD90 */
  120. static u32 fp_pixel_count_bar4 = 3840 * 2160 * 90;
  121. /* UHD60 */
  122. static u32 fp_pixel_count_bar5 = 3840 * 2160 * 60;
  123. /* UHD30; FHD120; HD240 */
  124. static u32 fp_pixel_count_bar6 = 3840 * 2160 * 30;
  125. /* FHD60 */
  126. static u32 fp_pixel_count_bar7 = 1920 * 1080 * 60;
  127. /* FHD30 */
  128. static u32 fp_pixel_count_bar8 = 1920 * 1080 * 30;
  129. /* HD30 */
  130. static u32 fp_pixel_count_bar9 = 1280 * 720 * 30;
  131. static u32 codec_encoder_gop_complexity_table_fp[8][3];
  132. static u32 codec_mbspersession_kalama;
  133. static u32 cr_table_basic_kalama[7][4] =
  134. {
  135. {1920, 1080, 20, 40},
  136. {3840, 2160, 42, 84},
  137. {4096, 2160, 44, 88},
  138. {4096, 2304, 48, 96},
  139. {1280, 720, 7, 14},
  140. {2560, 1440, 32, 64},
  141. {7680, 4320, 84, 168},
  142. };
  143. /* 100x */
  144. static u32 dpbopb_ubwc30_cr_table_cratio_kalama[7][12] =
  145. {
  146. {237, 399, 272, 137, 225, 158, 185, 259, 203, 138, 167, 152},
  147. {269, 404, 302, 202, 367, 238, 210, 299, 232, 134, 181, 149},
  148. {269, 404, 302, 202, 367, 238, 210, 299, 232, 134, 181, 149},
  149. {269, 404, 302, 202, 367, 238, 210, 299, 232, 134, 181, 149},
  150. {237, 399, 272, 137, 225, 158, 185, 259, 203, 138, 167, 152},
  151. {269, 404, 302, 202, 367, 238, 210, 299, 232, 134, 181, 149},
  152. {269, 404, 302, 202, 367, 238, 210, 299, 232, 134, 181, 149},
  153. };
  154. /* 100x */
  155. static u32 rpb_ubwc30_cr_table_cratio_kalama[7][12] =
  156. {
  157. {193, 294, 218, 135, 214, 155, 175, 241, 191, 139, 162, 149},
  158. {285, 406, 316, 207, 373, 243, 201, 280, 221, 139, 177, 152},
  159. {285, 406, 316, 207, 373, 243, 201, 280, 221, 139, 177, 152},
  160. {285, 406, 316, 207, 373, 243, 201, 280, 221, 139, 177, 152},
  161. {193, 294, 218, 135, 214, 155, 175, 241, 191, 139, 162, 149},
  162. {285, 406, 316, 207, 373, 243, 201, 280, 221, 139, 177, 152},
  163. {285, 406, 316, 207, 373, 243, 201, 280, 221, 139, 177, 152},
  164. };
  165. /* 100x */
  166. static u32 ipblossy_ubwc30_cr_table_cratio_kalama[7][12] =
  167. {
  168. {215, 215, 215, 174, 174, 174, 266, 266, 266, 231, 231, 231},
  169. {254, 254, 254, 219, 219, 219, 292, 292, 292, 249, 249, 249},
  170. {254, 254, 254, 219, 219, 219, 292, 292, 292, 249, 249, 249},
  171. {254, 254, 254, 219, 219, 219, 292, 292, 292, 249, 249, 249},
  172. {215, 215, 215, 174, 174, 174, 266, 266, 266, 231, 231, 231},
  173. {254, 254, 254, 219, 219, 219, 292, 292, 292, 249, 249, 249},
  174. {254, 254, 254, 219, 219, 219, 292, 292, 292, 249, 249, 249},
  175. };
  176. /* 100x */
  177. static u32 ipblossless_ubwc30_cr_table_cratio_kalama[7][12] =
  178. {
  179. {185, 215, 194, 147, 178, 159, 162, 181, 169, 138, 161, 146},
  180. {186, 217, 195, 151, 183, 161, 164, 182, 170, 140, 168, 148},
  181. {186, 217, 195, 151, 183, 161, 164, 182, 170, 140, 168, 148},
  182. {186, 217, 195, 151, 183, 161, 164, 182, 170, 140, 168, 148},
  183. {185, 215, 194, 147, 178, 159, 162, 181, 169, 138, 161, 146},
  184. {186, 217, 195, 151, 183, 161, 164, 182, 170, 140, 168, 148},
  185. {186, 217, 195, 151, 183, 161, 164, 182, 170, 140, 168, 148},
  186. };
  187. /* 100x */
  188. static u32 en_original_compression_factor_rgba_pwd_kalama = 243;
  189. /* 100x */
  190. static u32 en_original_compression_factor_rgba_avg_kalama = 454;
  191. static u32 av1_num_tiles_kalama[7][3] =
  192. {
  193. {2, 1, 1},
  194. {4, 2, 2},
  195. {4, 2, 2},
  196. {4, 2, 2},
  197. {1, 1, 1},
  198. {2, 1, 1},
  199. {16, 4, 4},
  200. };
  201. /* H I J K L M N O P
  202. * TotalW Total R Frequency Write Read
  203. * Name B b P B b P B b P
  204. * I3B4b1P 0.5 1.875 3 4 1 1 0 1 2 2 1
  205. * I1B2b1P 0.5 1.75 1 2 1 1 0 1 2 2 1
  206. * IbP 0.5 1.5 0 1 1 1 0 1 2 2 1
  207. * IPP 1 1 0 0 1 1 0 1 2 2 1
  208. * P 1 1 0 0 1 1 0 1 2 2 1
  209. * smallB 0 2 0 1 0 1 0 1 2 2 1
  210. * bigB 1 2 1 0 0 1 0 1 2 2 1
  211. *
  212. * Total W = SUMPRODUCT(H16:J16, K16 : M16) / SUM(H16:J16)
  213. * Total R = SUMPRODUCT(H16:J16, N16 : P16) / SUM(H16:J16)
  214. */
  215. /* 1000x */
  216. static u32 kalama_en_readfactor[7] = {1000, 1500, 1750, 1875, 1000, 2000, 2000};
  217. /* 1000x */
  218. static u32 kalama_en_writefactor[7] = {1000, 500, 500, 500, 1000, 0, 1000};
  219. static u32 kalama_en_frame_num_parallel = 1;