diff options
Diffstat (limited to 'third_party/dav1d/src/cdf.c')
-rw-r--r-- | third_party/dav1d/src/cdf.c | 1378 |
1 files changed, 680 insertions, 698 deletions
diff --git a/third_party/dav1d/src/cdf.c b/third_party/dav1d/src/cdf.c index e0f2132e00..d9721dad46 100644 --- a/third_party/dav1d/src/cdf.c +++ b/third_party/dav1d/src/cdf.c @@ -65,631 +65,638 @@ #define CDF15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \ CDF1(a), CDF14(b,c,d,e,f,g,h,i,j,k,l,m,n,o) -static const CdfModeContext av1_default_cdf = { - .y_mode = { - { CDF12(22801, 23489, 24293, 24756, 25601, 26123, - 26606, 27418, 27945, 29228, 29685, 30349) }, - { CDF12(18673, 19845, 22631, 23318, 23950, 24649, - 25527, 27364, 28152, 29701, 29984, 30852) }, - { CDF12(19770, 20979, 23396, 23939, 24241, 24654, - 25136, 27073, 27830, 29360, 29730, 30659) }, - { CDF12(20155, 21301, 22838, 23178, 23261, 23533, - 23703, 24804, 25352, 26575, 27016, 28049) }, - }, .use_filter_intra = { - [BS_4x4] = { CDF1( 4621) }, - [BS_4x8] = { CDF1( 6743) }, - [BS_8x4] = { CDF1( 5893) }, - [BS_8x8] = { CDF1( 7866) }, - [BS_8x16] = { CDF1(12551) }, - [BS_16x8] = { CDF1( 9394) }, - [BS_16x16] = { CDF1(12408) }, - [BS_16x32] = { CDF1(14301) }, - [BS_32x16] = { CDF1(12756) }, - [BS_32x32] = { CDF1(22343) }, - [BS_32x64] = { CDF1(16384) }, - [BS_64x32] = { CDF1(16384) }, - [BS_64x64] = { CDF1(16384) }, - [BS_64x128] = { CDF1(16384) }, - [BS_128x64] = { CDF1(16384) }, - [BS_128x128] = { CDF1(16384) }, - [BS_4x16] = { CDF1(12770) }, - [BS_16x4] = { CDF1(10368) }, - [BS_8x32] = { CDF1(20229) }, - [BS_32x8] = { CDF1(18101) }, - [BS_16x64] = { CDF1(16384) }, - [BS_64x16] = { CDF1(16384) }, - }, .filter_intra = { - CDF4(8949, 12776, 17211, 29558), - }, .uv_mode = { - { - { CDF12(22631, 24152, 25378, 25661, 25986, 26520, - 27055, 27923, 28244, 30059, 30941, 31961) }, - { CDF12( 9513, 26881, 26973, 27046, 27118, 27664, - 27739, 27824, 28359, 29505, 29800, 31796) }, - { CDF12( 9845, 9915, 28663, 28704, 28757, 28780, - 29198, 29822, 29854, 30764, 31777, 32029) }, - { CDF12(13639, 13897, 14171, 25331, 25606, 25727, - 25953, 27148, 28577, 30612, 31355, 32493) }, - { CDF12( 9764, 9835, 9930, 9954, 25386, 27053, - 27958, 28148, 28243, 31101, 31744, 32363) }, - { CDF12(11825, 13589, 13677, 13720, 15048, 29213, - 29301, 29458, 29711, 31161, 31441, 32550) }, - { CDF12(14175, 14399, 16608, 16821, 17718, 17775, - 28551, 30200, 30245, 31837, 32342, 32667) }, - { CDF12(12885, 13038, 14978, 15590, 15673, 15748, - 16176, 29128, 29267, 30643, 31961, 32461) }, - { CDF12(12026, 13661, 13874, 15305, 15490, 15726, - 15995, 16273, 28443, 30388, 30767, 32416) }, - { CDF12(19052, 19840, 20579, 20916, 21150, 21467, - 21885, 22719, 23174, 28861, 30379, 32175) }, - { CDF12(18627, 19649, 20974, 21219, 21492, 21816, - 22199, 23119, 23527, 27053, 31397, 32148) }, - { CDF12(17026, 19004, 19997, 20339, 20586, 21103, - 21349, 21907, 22482, 25896, 26541, 31819) }, - { CDF12(12124, 13759, 14959, 14992, 15007, 15051, - 15078, 15166, 15255, 15753, 16039, 16606) }, - }, { - { CDF13(10407, 11208, 12900, 13181, 13823, 14175, 14899, - 15656, 15986, 20086, 20995, 22455, 24212) }, - { CDF13( 4532, 19780, 20057, 20215, 20428, 21071, 21199, - 21451, 22099, 24228, 24693, 27032, 29472) }, - { CDF13( 5273, 5379, 20177, 20270, 20385, 20439, 20949, - 21695, 21774, 23138, 24256, 24703, 26679) }, - { CDF13( 6740, 7167, 7662, 14152, 14536, 14785, 15034, - 16741, 18371, 21520, 22206, 23389, 24182) }, - { CDF13( 4987, 5368, 5928, 6068, 19114, 20315, 21857, - 22253, 22411, 24911, 25380, 26027, 26376) }, - { CDF13( 5370, 6889, 7247, 7393, 9498, 21114, 21402, - 21753, 21981, 24780, 25386, 26517, 27176) }, - { CDF13( 4816, 4961, 7204, 7326, 8765, 8930, 20169, - 20682, 20803, 23188, 23763, 24455, 24940) }, - { CDF13( 6608, 6740, 8529, 9049, 9257, 9356, 9735, - 18827, 19059, 22336, 23204, 23964, 24793) }, - { CDF13( 5998, 7419, 7781, 8933, 9255, 9549, 9753, - 10417, 18898, 22494, 23139, 24764, 25989) }, - { CDF13(10660, 11298, 12550, 12957, 13322, 13624, 14040, - 15004, 15534, 20714, 21789, 23443, 24861) }, - { CDF13(10522, 11530, 12552, 12963, 13378, 13779, 14245, - 15235, 15902, 20102, 22696, 23774, 25838) }, - { CDF13(10099, 10691, 12639, 13049, 13386, 13665, 14125, - 15163, 15636, 19676, 20474, 23519, 25208) }, - { CDF13( 3144, 5087, 7382, 7504, 7593, 7690, 7801, - 8064, 8232, 9248, 9875, 10521, 29048) }, - }, - }, .angle_delta = { - { CDF6( 2180, 5032, 7567, 22776, 26989, 30217) }, - { CDF6( 2301, 5608, 8801, 23487, 26974, 30330) }, - { CDF6( 3780, 11018, 13699, 19354, 23083, 31286) }, - { CDF6( 4581, 11226, 15147, 17138, 21834, 28397) }, - { CDF6( 1737, 10927, 14509, 19588, 22745, 28823) }, - { CDF6( 2664, 10176, 12485, 17650, 21600, 30495) }, - { CDF6( 2240, 11096, 15453, 20341, 22561, 28917) }, - { CDF6( 3605, 10428, 12459, 17676, 21244, 30655) }, - }, .filter = { - { - { CDF2(31935, 32720) }, { CDF2( 5568, 32719) }, - { CDF2( 422, 2938) }, { CDF2(28244, 32608) }, - { CDF2(31206, 31953) }, { CDF2( 4862, 32121) }, - { CDF2( 770, 1152) }, { CDF2(20889, 25637) }, - }, { - { CDF2(31910, 32724) }, { CDF2( 4120, 32712) }, - { CDF2( 305, 2247) }, { CDF2(27403, 32636) }, - { CDF2(31022, 32009) }, { CDF2( 2963, 32093) }, - { CDF2( 601, 943) }, { CDF2(14969, 21398) }, - }, - }, .newmv_mode = { - { CDF1(24035) }, { CDF1(16630) }, { CDF1(15339) }, - { CDF1( 8386) }, { CDF1(12222) }, { CDF1( 4676) }, - }, .globalmv_mode = { - { CDF1( 2175) }, { CDF1( 1054) }, - }, .refmv_mode = { - { CDF1(23974) }, { CDF1(24188) }, { CDF1(17848) }, - { CDF1(28622) }, { CDF1(24312) }, { CDF1(19923) }, - }, .drl_bit = { - { CDF1(13104) }, { CDF1(24560) }, { CDF1(18945) }, - }, .comp_inter_mode = { - { CDF7( 7760, 13823, 15808, 17641, 19156, 20666, 26891) }, - { CDF7(10730, 19452, 21145, 22749, 24039, 25131, 28724) }, - { CDF7(10664, 20221, 21588, 22906, 24295, 25387, 28436) }, - { CDF7(13298, 16984, 20471, 24182, 25067, 25736, 26422) }, - { CDF7(18904, 23325, 25242, 27432, 27898, 28258, 30758) }, - { CDF7(10725, 17454, 20124, 22820, 24195, 25168, 26046) }, - { CDF7(17125, 24273, 25814, 27492, 28214, 28704, 30592) }, - { CDF7(13046, 23214, 24505, 25942, 27435, 28442, 29330) }, - }, .intra = { - { CDF1( 806) }, { CDF1(16662) }, { CDF1(20186) }, - { CDF1(26538) }, - }, .comp = { - { CDF1(26828) }, { CDF1(24035) }, { CDF1(12031) }, - { CDF1(10640) }, { CDF1( 2901) }, - }, .comp_dir = { - { CDF1( 1198) }, { CDF1( 2070) }, { CDF1( 9166) }, - { CDF1( 7499) }, { CDF1(22475) }, - }, .jnt_comp = { - { CDF1(18244) }, { CDF1(12865) }, { CDF1( 7053) }, - { CDF1(13259) }, { CDF1( 9334) }, { CDF1( 4644) }, - }, .mask_comp = { - { CDF1(26607) }, { CDF1(22891) }, { CDF1(18840) }, - { CDF1(24594) }, { CDF1(19934) }, { CDF1(22674) }, - }, .wedge_comp = { - { CDF1(23431) }, { CDF1(13171) }, { CDF1(11470) }, - { CDF1( 9770) }, { CDF1( 9100) }, { CDF1( 8233) }, - { CDF1( 6172) }, { CDF1(11820) }, { CDF1( 7701) }, - }, .wedge_idx = { - { CDF15( 2438, 4440, 6599, 8663, 11005, 12874, 15751, 18094, - 20359, 22362, 24127, 25702, 27752, 29450, 31171) }, - { CDF15( 806, 3266, 6005, 6738, 7218, 7367, 7771, 14588, - 16323, 17367, 18452, 19422, 22839, 26127, 29629) }, - { CDF15( 2779, 3738, 4683, 7213, 7775, 8017, 8655, 14357, - 17939, 21332, 24520, 27470, 29456, 30529, 31656) }, - { CDF15( 1684, 3625, 5675, 7108, 9302, 11274, 14429, 17144, - 19163, 20961, 22884, 24471, 26719, 28714, 30877) }, - { CDF15( 1142, 3491, 6277, 7314, 8089, 8355, 9023, 13624, - 15369, 16730, 18114, 19313, 22521, 26012, 29550) }, - { CDF15( 2742, 4195, 5727, 8035, 8980, 9336, 10146, 14124, - 17270, 20533, 23434, 25972, 27944, 29570, 31416) }, - { CDF15( 1727, 3948, 6101, 7796, 9841, 12344, 15766, 18944, - 20638, 22038, 23963, 25311, 26988, 28766, 31012) }, - { CDF15( 154, 987, 1925, 2051, 2088, 2111, 2151, 23033, - 23703, 24284, 24985, 25684, 27259, 28883, 30911) }, - { CDF15( 1135, 1322, 1493, 2635, 2696, 2737, 2770, 21016, - 22935, 25057, 27251, 29173, 30089, 30960, 31933) }, - }, .interintra = { - { CDF1(16384) }, { CDF1(26887) }, { CDF1(27597) }, - { CDF1(30237) }, - }, .interintra_mode = { - { CDF3(8192, 16384, 24576) }, - { CDF3(1875, 11082, 27332) }, - { CDF3(2473, 9996, 26388) }, - { CDF3(4238, 11537, 25926) }, - }, .interintra_wedge = { - { CDF1(20036) }, { CDF1(24957) }, { CDF1(26704) }, - { CDF1(27530) }, { CDF1(29564) }, { CDF1(29444) }, - { CDF1(26872) }, - }, .ref = { - { { CDF1( 4897) }, { CDF1(16973) }, { CDF1(29744) } }, - { { CDF1( 1555) }, { CDF1(16751) }, { CDF1(30279) } }, - { { CDF1( 4236) }, { CDF1(19647) }, { CDF1(31194) } }, - { { CDF1( 8650) }, { CDF1(24773) }, { CDF1(31895) } }, - { { CDF1( 904) }, { CDF1(11014) }, { CDF1(26875) } }, - { { CDF1( 1444) }, { CDF1(15087) }, { CDF1(30304) } }, - }, .comp_fwd_ref = { - { { CDF1( 4946) }, { CDF1(19891) }, { CDF1(30731) } }, - { { CDF1( 9468) }, { CDF1(22441) }, { CDF1(31059) } }, - { { CDF1( 1503) }, { CDF1(15160) }, { CDF1(27544) } }, - }, .comp_bwd_ref = { - { { CDF1( 2235) }, { CDF1(17182) }, { CDF1(30606) } }, - { { CDF1( 1423) }, { CDF1(15175) }, { CDF1(30489) } }, - }, .comp_uni_ref = { - { { CDF1( 5284) }, { CDF1(23152) }, { CDF1(31774) } }, - { { CDF1( 3865) }, { CDF1(14173) }, { CDF1(25120) } }, - { { CDF1( 3128) }, { CDF1(15270) }, { CDF1(26710) } }, - }, .txsz = { - { - { CDF1(19968) }, { CDF1(19968) }, { CDF1(24320) }, - }, { - { CDF2(12272, 30172) }, { CDF2(12272, 30172) }, - { CDF2(18677, 30848) }, - }, { - { CDF2(12986, 15180) }, { CDF2(12986, 15180) }, - { CDF2(24302, 25602) }, - }, { - { CDF2( 5782, 11475) }, { CDF2( 5782, 11475) }, - { CDF2(16803, 22759) }, - }, - }, .txpart = { - { { CDF1(28581) }, { CDF1(23846) }, { CDF1(20847) } }, - { { CDF1(24315) }, { CDF1(18196) }, { CDF1(12133) } }, - { { CDF1(18791) }, { CDF1(10887) }, { CDF1(11005) } }, - { { CDF1(27179) }, { CDF1(20004) }, { CDF1(11281) } }, - { { CDF1(26549) }, { CDF1(19308) }, { CDF1(14224) } }, - { { CDF1(28015) }, { CDF1(21546) }, { CDF1(14400) } }, - { { CDF1(28165) }, { CDF1(22401) }, { CDF1(16088) } }, - }, .txtp_inter1 = { - { CDF15( 4458, 5560, 7695, 9709, 13330, 14789, 17537, 20266, - 21504, 22848, 23934, 25474, 27727, 28915, 30631) }, - { CDF15( 1645, 2573, 4778, 5711, 7807, 8622, 10522, 15357, - 17674, 20408, 22517, 25010, 27116, 28856, 30749) }, - }, .txtp_inter2 = { - CDF11( 770, 2421, 5225, 12907, 15819, 18927, - 21561, 24089, 26595, 28526, 30529) - }, .txtp_inter3 = { - { CDF1(16384) }, { CDF1( 4167) }, { CDF1( 1998) }, { CDF1( 748) }, - }, .txtp_intra1 = { - { - { CDF6( 1535, 8035, 9461, 12751, 23467, 27825) }, - { CDF6( 564, 3335, 9709, 10870, 18143, 28094) }, - { CDF6( 672, 3247, 3676, 11982, 19415, 23127) }, - { CDF6( 5279, 13885, 15487, 18044, 23527, 30252) }, - { CDF6( 4423, 6074, 7985, 10416, 25693, 29298) }, - { CDF6( 1486, 4241, 9460, 10662, 16456, 27694) }, - { CDF6( 439, 2838, 3522, 6737, 18058, 23754) }, - { CDF6( 1190, 4233, 4855, 11670, 20281, 24377) }, - { CDF6( 1045, 4312, 8647, 10159, 18644, 29335) }, - { CDF6( 202, 3734, 4747, 7298, 17127, 24016) }, - { CDF6( 447, 4312, 6819, 8884, 16010, 23858) }, - { CDF6( 277, 4369, 5255, 8905, 16465, 22271) }, - { CDF6( 3409, 5436, 10599, 15599, 19687, 24040) }, - }, { - { CDF6( 1870, 13742, 14530, 16498, 23770, 27698) }, - { CDF6( 326, 8796, 14632, 15079, 19272, 27486) }, - { CDF6( 484, 7576, 7712, 14443, 19159, 22591) }, - { CDF6( 1126, 15340, 15895, 17023, 20896, 30279) }, - { CDF6( 655, 4854, 5249, 5913, 22099, 27138) }, - { CDF6( 1299, 6458, 8885, 9290, 14851, 25497) }, - { CDF6( 311, 5295, 5552, 6885, 16107, 22672) }, - { CDF6( 883, 8059, 8270, 11258, 17289, 21549) }, - { CDF6( 741, 7580, 9318, 10345, 16688, 29046) }, - { CDF6( 110, 7406, 7915, 9195, 16041, 23329) }, - { CDF6( 363, 7974, 9357, 10673, 15629, 24474) }, - { CDF6( 153, 7647, 8112, 9936, 15307, 19996) }, - { CDF6( 3511, 6332, 11165, 15335, 19323, 23594) }, - }, - }, .txtp_intra2 = { - { - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - }, { - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - { CDF4( 6554, 13107, 19661, 26214) }, - }, { - { CDF4( 1127, 12814, 22772, 27483) }, - { CDF4( 145, 6761, 11980, 26667) }, - { CDF4( 362, 5887, 11678, 16725) }, - { CDF4( 385, 15213, 18587, 30693) }, - { CDF4( 25, 2914, 23134, 27903) }, - { CDF4( 60, 4470, 11749, 23991) }, - { CDF4( 37, 3332, 14511, 21448) }, - { CDF4( 157, 6320, 13036, 17439) }, - { CDF4( 119, 6719, 12906, 29396) }, - { CDF4( 47, 5537, 12576, 21499) }, - { CDF4( 269, 6076, 11258, 23115) }, - { CDF4( 83, 5615, 12001, 17228) }, - { CDF4( 1968, 5556, 12023, 18547) }, - }, - }, .skip = { - { CDF1(31671) }, { CDF1(16515) }, { CDF1( 4576) }, - }, .skip_mode = { - { CDF1(32621) }, { CDF1(20708) }, { CDF1( 8127) }, - }, .partition = { - { - // 128x128 -> 64x64 - { CDF7(27899, 28219, 28529, 32484, 32539, 32619, 32639) }, - { CDF7( 6607, 6990, 8268, 32060, 32219, 32338, 32371) }, - { CDF7( 5429, 6676, 7122, 32027, 32227, 32531, 32582) }, - { CDF7( 711, 966, 1172, 32448, 32538, 32617, 32664) }, - }, { - // 64x64 -> 32x32 - { CDF9(20137, 21547, 23078, 29566, 29837, - 30261, 30524, 30892, 31724) }, - { CDF9( 6732, 7490, 9497, 27944, 28250, - 28515, 28969, 29630, 30104) }, - { CDF9( 5945, 7663, 8348, 28683, 29117, - 29749, 30064, 30298, 32238) }, - { CDF9( 870, 1212, 1487, 31198, 31394, - 31574, 31743, 31881, 32332) }, - }, { - // 32x32 -> 16x16 - { CDF9(18462, 20920, 23124, 27647, 28227, - 29049, 29519, 30178, 31544) }, - { CDF9( 7689, 9060, 12056, 24992, 25660, - 26182, 26951, 28041, 29052) }, - { CDF9( 6015, 9009, 10062, 24544, 25409, - 26545, 27071, 27526, 32047) }, - { CDF9( 1394, 2208, 2796, 28614, 29061, - 29466, 29840, 30185, 31899) }, - }, { - // 16x16 -> 8x8 - { CDF9(15597, 20929, 24571, 26706, 27664, - 28821, 29601, 30571, 31902) }, - { CDF9( 7925, 11043, 16785, 22470, 23971, - 25043, 26651, 28701, 29834) }, - { CDF9( 5414, 13269, 15111, 20488, 22360, - 24500, 25537, 26336, 32117) }, - { CDF9( 2662, 6362, 8614, 20860, 23053, - 24778, 26436, 27829, 31171) }, - }, { - // 8x8 -> 4x4 only supports the four legacy partition types - { CDF3(19132, 25510, 30392) }, - { CDF3(13928, 19855, 28540) }, - { CDF3(12522, 23679, 28629) }, - { CDF3( 9896, 18783, 25853) }, - }, - }, .seg_pred = { - { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) }, - }, .seg_id = { - { CDF7( 5622, 7893, 16093, 18233, 27809, 28373, 32533) }, - { CDF7(14274, 18230, 22557, 24935, 29980, 30851, 32344) }, - { CDF7(27527, 28487, 28723, 28890, 32397, 32647, 32679) }, - }, .cfl_sign = { - CDF7( 1418, 2123, 13340, 18405, 26972, 28343, 32294) - }, .cfl_alpha = { - { CDF15( 7637, 20719, 31401, 32481, 32657, 32688, 32692, 32696, - 32700, 32704, 32708, 32712, 32716, 32720, 32724) }, - { CDF15(14365, 23603, 28135, 31168, 32167, 32395, 32487, 32573, - 32620, 32647, 32668, 32672, 32676, 32680, 32684) }, - { CDF15(11532, 22380, 28445, 31360, 32349, 32523, 32584, 32649, - 32673, 32677, 32681, 32685, 32689, 32693, 32697) }, - { CDF15(26990, 31402, 32282, 32571, 32692, 32696, 32700, 32704, - 32708, 32712, 32716, 32720, 32724, 32728, 32732) }, - { CDF15(17248, 26058, 28904, 30608, 31305, 31877, 32126, 32321, - 32394, 32464, 32516, 32560, 32576, 32593, 32622) }, - { CDF15(14738, 21678, 25779, 27901, 29024, 30302, 30980, 31843, - 32144, 32413, 32520, 32594, 32622, 32656, 32660) }, - }, .restore_wiener = { - CDF1(11570) - }, .restore_sgrproj = { - CDF1(16855) - }, .restore_switchable = { - CDF2( 9413, 22581) - }, .delta_q = { - CDF3(28160, 32120, 32677) - }, .delta_lf = { - { CDF3(28160, 32120, 32677) }, - { CDF3(28160, 32120, 32677) }, - { CDF3(28160, 32120, 32677) }, - { CDF3(28160, 32120, 32677) }, - { CDF3(28160, 32120, 32677) }, - }, .motion_mode = { - [BS_8x8] = { CDF2( 7651, 24760) }, - [BS_8x16] = { CDF2( 4738, 24765) }, - [BS_8x32] = { CDF2(28799, 31390) }, - [BS_16x8] = { CDF2( 5391, 25528) }, - [BS_16x16] = { CDF2(19419, 26810) }, - [BS_16x32] = { CDF2( 5123, 23606) }, - [BS_16x64] = { CDF2(28973, 31594) }, - [BS_32x8] = { CDF2(26431, 30774) }, - [BS_32x16] = { CDF2(11606, 24308) }, - [BS_32x32] = { CDF2(26260, 29116) }, - [BS_32x64] = { CDF2(20360, 28062) }, - [BS_64x16] = { CDF2(29742, 31203) }, - [BS_64x32] = { CDF2(21679, 26830) }, - [BS_64x64] = { CDF2(29516, 30701) }, - [BS_64x128] = { CDF2(28898, 30397) }, - [BS_128x64] = { CDF2(30878, 31335) }, - [BS_128x128] = { CDF2(32507, 32558) }, - }, .obmc = { - [BS_8x8] = { CDF1(10437) }, - [BS_8x16] = { CDF1( 9371) }, - [BS_8x32] = { CDF1(23664) }, - [BS_16x8] = { CDF1( 9301) }, - [BS_16x16] = { CDF1(17432) }, - [BS_16x32] = { CDF1(14423) }, - [BS_16x64] = { CDF1(24008) }, - [BS_32x8] = { CDF1(20901) }, - [BS_32x16] = { CDF1(15142) }, - [BS_32x32] = { CDF1(25817) }, - [BS_32x64] = { CDF1(22823) }, - [BS_64x16] = { CDF1(26879) }, - [BS_64x32] = { CDF1(22083) }, - [BS_64x64] = { CDF1(30128) }, - [BS_64x128] = { CDF1(31014) }, - [BS_128x64] = { CDF1(31560) }, - [BS_128x128] = { CDF1(32638) }, - }, .pal_y = { - { { CDF1(31676) }, { CDF1( 3419) }, { CDF1( 1261) } }, - { { CDF1(31912) }, { CDF1( 2859) }, { CDF1( 980) } }, - { { CDF1(31823) }, { CDF1( 3400) }, { CDF1( 781) } }, - { { CDF1(32030) }, { CDF1( 3561) }, { CDF1( 904) } }, - { { CDF1(32309) }, { CDF1( 7337) }, { CDF1( 1462) } }, - { { CDF1(32265) }, { CDF1( 4015) }, { CDF1( 1521) } }, - { { CDF1(32450) }, { CDF1( 7946) }, { CDF1( 129) } }, - }, .pal_sz = { - { - { CDF6( 7952, 13000, 18149, 21478, 25527, 29241) }, - { CDF6( 7139, 11421, 16195, 19544, 23666, 28073) }, - { CDF6( 7788, 12741, 17325, 20500, 24315, 28530) }, - { CDF6( 8271, 14064, 18246, 21564, 25071, 28533) }, - { CDF6(12725, 19180, 21863, 24839, 27535, 30120) }, - { CDF6( 9711, 14888, 16923, 21052, 25661, 27875) }, - { CDF6(14940, 20797, 21678, 24186, 27033, 28999) }, - }, { - { CDF6( 8713, 19979, 27128, 29609, 31331, 32272) }, - { CDF6( 5839, 15573, 23581, 26947, 29848, 31700) }, - { CDF6( 4426, 11260, 17999, 21483, 25863, 29430) }, - { CDF6( 3228, 9464, 14993, 18089, 22523, 27420) }, - { CDF6( 3768, 8886, 13091, 17852, 22495, 27207) }, - { CDF6( 2464, 8451, 12861, 21632, 25525, 28555) }, - { CDF6( 1269, 5435, 10433, 18963, 21700, 25865) }, - }, - }, .pal_uv = { - { CDF1(32461) }, { CDF1(21488) }, - }, .color_map = { - { /* y */ +typedef struct CdfDefaultContext { + CdfModeContext m; + struct { + CdfMvComponent comp; + ALIGN(uint16_t joint[N_MV_JOINTS], 8); + } mv; + ALIGN(uint16_t kfym[5][5][N_INTRA_PRED_MODES + 3], 32); +} CdfDefaultContext; + +static const CdfDefaultContext default_cdf = { + .m = { + .y_mode = { + { CDF12(22801, 23489, 24293, 24756, 25601, 26123, + 26606, 27418, 27945, 29228, 29685, 30349) }, + { CDF12(18673, 19845, 22631, 23318, 23950, 24649, + 25527, 27364, 28152, 29701, 29984, 30852) }, + { CDF12(19770, 20979, 23396, 23939, 24241, 24654, + 25136, 27073, 27830, 29360, 29730, 30659) }, + { CDF12(20155, 21301, 22838, 23178, 23261, 23533, + 23703, 24804, 25352, 26575, 27016, 28049) }, + }, .use_filter_intra = { + [BS_4x4] = { CDF1( 4621) }, + [BS_4x8] = { CDF1( 6743) }, + [BS_8x4] = { CDF1( 5893) }, + [BS_8x8] = { CDF1( 7866) }, + [BS_8x16] = { CDF1(12551) }, + [BS_16x8] = { CDF1( 9394) }, + [BS_16x16] = { CDF1(12408) }, + [BS_16x32] = { CDF1(14301) }, + [BS_32x16] = { CDF1(12756) }, + [BS_32x32] = { CDF1(22343) }, + [BS_32x64] = { CDF1(16384) }, + [BS_64x32] = { CDF1(16384) }, + [BS_64x64] = { CDF1(16384) }, + [BS_64x128] = { CDF1(16384) }, + [BS_128x64] = { CDF1(16384) }, + [BS_128x128] = { CDF1(16384) }, + [BS_4x16] = { CDF1(12770) }, + [BS_16x4] = { CDF1(10368) }, + [BS_8x32] = { CDF1(20229) }, + [BS_32x8] = { CDF1(18101) }, + [BS_16x64] = { CDF1(16384) }, + [BS_64x16] = { CDF1(16384) }, + }, .filter_intra = { + CDF4(8949, 12776, 17211, 29558), + }, .uv_mode = { { - { CDF1(28710) }, { CDF1(16384) }, { CDF1(10553) }, - { CDF1(27036) }, { CDF1(31603) }, + { CDF12(22631, 24152, 25378, 25661, 25986, 26520, + 27055, 27923, 28244, 30059, 30941, 31961) }, + { CDF12( 9513, 26881, 26973, 27046, 27118, 27664, + 27739, 27824, 28359, 29505, 29800, 31796) }, + { CDF12( 9845, 9915, 28663, 28704, 28757, 28780, + 29198, 29822, 29854, 30764, 31777, 32029) }, + { CDF12(13639, 13897, 14171, 25331, 25606, 25727, + 25953, 27148, 28577, 30612, 31355, 32493) }, + { CDF12( 9764, 9835, 9930, 9954, 25386, 27053, + 27958, 28148, 28243, 31101, 31744, 32363) }, + { CDF12(11825, 13589, 13677, 13720, 15048, 29213, + 29301, 29458, 29711, 31161, 31441, 32550) }, + { CDF12(14175, 14399, 16608, 16821, 17718, 17775, + 28551, 30200, 30245, 31837, 32342, 32667) }, + { CDF12(12885, 13038, 14978, 15590, 15673, 15748, + 16176, 29128, 29267, 30643, 31961, 32461) }, + { CDF12(12026, 13661, 13874, 15305, 15490, 15726, + 15995, 16273, 28443, 30388, 30767, 32416) }, + { CDF12(19052, 19840, 20579, 20916, 21150, 21467, + 21885, 22719, 23174, 28861, 30379, 32175) }, + { CDF12(18627, 19649, 20974, 21219, 21492, 21816, + 22199, 23119, 23527, 27053, 31397, 32148) }, + { CDF12(17026, 19004, 19997, 20339, 20586, 21103, + 21349, 21907, 22482, 25896, 26541, 31819) }, + { CDF12(12124, 13759, 14959, 14992, 15007, 15051, + 15078, 15166, 15255, 15753, 16039, 16606) }, }, { - { CDF2(27877, 30490) }, { CDF2(11532, 25697) }, - { CDF2( 6544, 30234) }, { CDF2(23018, 28072) }, - { CDF2(31915, 32385) }, + { CDF13(10407, 11208, 12900, 13181, 13823, 14175, 14899, + 15656, 15986, 20086, 20995, 22455, 24212) }, + { CDF13( 4532, 19780, 20057, 20215, 20428, 21071, 21199, + 21451, 22099, 24228, 24693, 27032, 29472) }, + { CDF13( 5273, 5379, 20177, 20270, 20385, 20439, 20949, + 21695, 21774, 23138, 24256, 24703, 26679) }, + { CDF13( 6740, 7167, 7662, 14152, 14536, 14785, 15034, + 16741, 18371, 21520, 22206, 23389, 24182) }, + { CDF13( 4987, 5368, 5928, 6068, 19114, 20315, 21857, + 22253, 22411, 24911, 25380, 26027, 26376) }, + { CDF13( 5370, 6889, 7247, 7393, 9498, 21114, 21402, + 21753, 21981, 24780, 25386, 26517, 27176) }, + { CDF13( 4816, 4961, 7204, 7326, 8765, 8930, 20169, + 20682, 20803, 23188, 23763, 24455, 24940) }, + { CDF13( 6608, 6740, 8529, 9049, 9257, 9356, 9735, + 18827, 19059, 22336, 23204, 23964, 24793) }, + { CDF13( 5998, 7419, 7781, 8933, 9255, 9549, 9753, + 10417, 18898, 22494, 23139, 24764, 25989) }, + { CDF13(10660, 11298, 12550, 12957, 13322, 13624, 14040, + 15004, 15534, 20714, 21789, 23443, 24861) }, + { CDF13(10522, 11530, 12552, 12963, 13378, 13779, 14245, + 15235, 15902, 20102, 22696, 23774, 25838) }, + { CDF13(10099, 10691, 12639, 13049, 13386, 13665, 14125, + 15163, 15636, 19676, 20474, 23519, 25208) }, + { CDF13( 3144, 5087, 7382, 7504, 7593, 7690, 7801, + 8064, 8232, 9248, 9875, 10521, 29048) }, + }, + }, .angle_delta = { + { CDF6( 2180, 5032, 7567, 22776, 26989, 30217) }, + { CDF6( 2301, 5608, 8801, 23487, 26974, 30330) }, + { CDF6( 3780, 11018, 13699, 19354, 23083, 31286) }, + { CDF6( 4581, 11226, 15147, 17138, 21834, 28397) }, + { CDF6( 1737, 10927, 14509, 19588, 22745, 28823) }, + { CDF6( 2664, 10176, 12485, 17650, 21600, 30495) }, + { CDF6( 2240, 11096, 15453, 20341, 22561, 28917) }, + { CDF6( 3605, 10428, 12459, 17676, 21244, 30655) }, + }, .filter = { + { + { CDF2(31935, 32720) }, { CDF2( 5568, 32719) }, + { CDF2( 422, 2938) }, { CDF2(28244, 32608) }, + { CDF2(31206, 31953) }, { CDF2( 4862, 32121) }, + { CDF2( 770, 1152) }, { CDF2(20889, 25637) }, }, { - { CDF3(25572, 28046, 30045) }, - { CDF3( 9478, 21590, 27256) }, - { CDF3( 7248, 26837, 29824) }, - { CDF3(19167, 24486, 28349) }, - { CDF3(31400, 31825, 32250) }, + { CDF2(31910, 32724) }, { CDF2( 4120, 32712) }, + { CDF2( 305, 2247) }, { CDF2(27403, 32636) }, + { CDF2(31022, 32009) }, { CDF2( 2963, 32093) }, + { CDF2( 601, 943) }, { CDF2(14969, 21398) }, + }, + }, .newmv_mode = { + { CDF1(24035) }, { CDF1(16630) }, { CDF1(15339) }, + { CDF1( 8386) }, { CDF1(12222) }, { CDF1( 4676) }, + }, .globalmv_mode = { + { CDF1( 2175) }, { CDF1( 1054) }, + }, .refmv_mode = { + { CDF1(23974) }, { CDF1(24188) }, { CDF1(17848) }, + { CDF1(28622) }, { CDF1(24312) }, { CDF1(19923) }, + }, .drl_bit = { + { CDF1(13104) }, { CDF1(24560) }, { CDF1(18945) }, + }, .comp_inter_mode = { + { CDF7( 7760, 13823, 15808, 17641, 19156, 20666, 26891) }, + { CDF7(10730, 19452, 21145, 22749, 24039, 25131, 28724) }, + { CDF7(10664, 20221, 21588, 22906, 24295, 25387, 28436) }, + { CDF7(13298, 16984, 20471, 24182, 25067, 25736, 26422) }, + { CDF7(18904, 23325, 25242, 27432, 27898, 28258, 30758) }, + { CDF7(10725, 17454, 20124, 22820, 24195, 25168, 26046) }, + { CDF7(17125, 24273, 25814, 27492, 28214, 28704, 30592) }, + { CDF7(13046, 23214, 24505, 25942, 27435, 28442, 29330) }, + }, .intra = { + { CDF1( 806) }, { CDF1(16662) }, { CDF1(20186) }, + { CDF1(26538) }, + }, .comp = { + { CDF1(26828) }, { CDF1(24035) }, { CDF1(12031) }, + { CDF1(10640) }, { CDF1( 2901) }, + }, .comp_dir = { + { CDF1( 1198) }, { CDF1( 2070) }, { CDF1( 9166) }, + { CDF1( 7499) }, { CDF1(22475) }, + }, .jnt_comp = { + { CDF1(18244) }, { CDF1(12865) }, { CDF1( 7053) }, + { CDF1(13259) }, { CDF1( 9334) }, { CDF1( 4644) }, + }, .mask_comp = { + { CDF1(26607) }, { CDF1(22891) }, { CDF1(18840) }, + { CDF1(24594) }, { CDF1(19934) }, { CDF1(22674) }, + }, .wedge_comp = { + { CDF1(23431) }, { CDF1(13171) }, { CDF1(11470) }, + { CDF1( 9770) }, { CDF1( 9100) }, { CDF1( 8233) }, + { CDF1( 6172) }, { CDF1(11820) }, { CDF1( 7701) }, + }, .wedge_idx = { + { CDF15( 2438, 4440, 6599, 8663, 11005, 12874, 15751, 18094, + 20359, 22362, 24127, 25702, 27752, 29450, 31171) }, + { CDF15( 806, 3266, 6005, 6738, 7218, 7367, 7771, 14588, + 16323, 17367, 18452, 19422, 22839, 26127, 29629) }, + { CDF15( 2779, 3738, 4683, 7213, 7775, 8017, 8655, 14357, + 17939, 21332, 24520, 27470, 29456, 30529, 31656) }, + { CDF15( 1684, 3625, 5675, 7108, 9302, 11274, 14429, 17144, + 19163, 20961, 22884, 24471, 26719, 28714, 30877) }, + { CDF15( 1142, 3491, 6277, 7314, 8089, 8355, 9023, 13624, + 15369, 16730, 18114, 19313, 22521, 26012, 29550) }, + { CDF15( 2742, 4195, 5727, 8035, 8980, 9336, 10146, 14124, + 17270, 20533, 23434, 25972, 27944, 29570, 31416) }, + { CDF15( 1727, 3948, 6101, 7796, 9841, 12344, 15766, 18944, + 20638, 22038, 23963, 25311, 26988, 28766, 31012) }, + { CDF15( 154, 987, 1925, 2051, 2088, 2111, 2151, 23033, + 23703, 24284, 24985, 25684, 27259, 28883, 30911) }, + { CDF15( 1135, 1322, 1493, 2635, 2696, 2737, 2770, 21016, + 22935, 25057, 27251, 29173, 30089, 30960, 31933) }, + }, .interintra = { + { CDF1(16384) }, { CDF1(26887) }, { CDF1(27597) }, + { CDF1(30237) }, + }, .interintra_mode = { + { CDF3(8192, 16384, 24576) }, + { CDF3(1875, 11082, 27332) }, + { CDF3(2473, 9996, 26388) }, + { CDF3(4238, 11537, 25926) }, + }, .interintra_wedge = { + { CDF1(20036) }, { CDF1(24957) }, { CDF1(26704) }, + { CDF1(27530) }, { CDF1(29564) }, { CDF1(29444) }, + { CDF1(26872) }, + }, .ref = { + { { CDF1( 4897) }, { CDF1(16973) }, { CDF1(29744) } }, + { { CDF1( 1555) }, { CDF1(16751) }, { CDF1(30279) } }, + { { CDF1( 4236) }, { CDF1(19647) }, { CDF1(31194) } }, + { { CDF1( 8650) }, { CDF1(24773) }, { CDF1(31895) } }, + { { CDF1( 904) }, { CDF1(11014) }, { CDF1(26875) } }, + { { CDF1( 1444) }, { CDF1(15087) }, { CDF1(30304) } }, + }, .comp_fwd_ref = { + { { CDF1( 4946) }, { CDF1(19891) }, { CDF1(30731) } }, + { { CDF1( 9468) }, { CDF1(22441) }, { CDF1(31059) } }, + { { CDF1( 1503) }, { CDF1(15160) }, { CDF1(27544) } }, + }, .comp_bwd_ref = { + { { CDF1( 2235) }, { CDF1(17182) }, { CDF1(30606) } }, + { { CDF1( 1423) }, { CDF1(15175) }, { CDF1(30489) } }, + }, .comp_uni_ref = { + { { CDF1( 5284) }, { CDF1(23152) }, { CDF1(31774) } }, + { { CDF1( 3865) }, { CDF1(14173) }, { CDF1(25120) } }, + { { CDF1( 3128) }, { CDF1(15270) }, { CDF1(26710) } }, + }, .txsz = { + { + { CDF1(19968) }, { CDF1(19968) }, { CDF1(24320) }, }, { - { CDF4(24779, 26955, 28576, 30282) }, - { CDF4( 8669, 20364, 24073, 28093) }, - { CDF4( 4255, 27565, 29377, 31067) }, - { CDF4(19864, 23674, 26716, 29530) }, - { CDF4(31646, 31893, 32147, 32426) }, + { CDF2(12272, 30172) }, { CDF2(12272, 30172) }, + { CDF2(18677, 30848) }, }, { - { CDF5(23132, 25407, 26970, 28435, 30073) }, - { CDF5( 7443, 17242, 20717, 24762, 27982) }, - { CDF5( 6300, 24862, 26944, 28784, 30671) }, - { CDF5(18916, 22895, 25267, 27435, 29652) }, - { CDF5(31270, 31550, 31808, 32059, 32353) }, + { CDF2(12986, 15180) }, { CDF2(12986, 15180) }, + { CDF2(24302, 25602) }, }, { - { CDF6(23105, 25199, 26464, 27684, 28931, 30318) }, - { CDF6( 6950, 15447, 18952, 22681, 25567, 28563) }, - { CDF6( 7560, 23474, 25490, 27203, 28921, 30708) }, - { CDF6(18544, 22373, 24457, 26195, 28119, 30045) }, - { CDF6(31198, 31451, 31670, 31882, 32123, 32391) }, + { CDF2( 5782, 11475) }, { CDF2( 5782, 11475) }, + { CDF2(16803, 22759) }, + }, + }, .txpart = { + { { CDF1(28581) }, { CDF1(23846) }, { CDF1(20847) } }, + { { CDF1(24315) }, { CDF1(18196) }, { CDF1(12133) } }, + { { CDF1(18791) }, { CDF1(10887) }, { CDF1(11005) } }, + { { CDF1(27179) }, { CDF1(20004) }, { CDF1(11281) } }, + { { CDF1(26549) }, { CDF1(19308) }, { CDF1(14224) } }, + { { CDF1(28015) }, { CDF1(21546) }, { CDF1(14400) } }, + { { CDF1(28165) }, { CDF1(22401) }, { CDF1(16088) } }, + }, .txtp_inter1 = { + { CDF15( 4458, 5560, 7695, 9709, 13330, 14789, 17537, 20266, + 21504, 22848, 23934, 25474, 27727, 28915, 30631) }, + { CDF15( 1645, 2573, 4778, 5711, 7807, 8622, 10522, 15357, + 17674, 20408, 22517, 25010, 27116, 28856, 30749) }, + }, .txtp_inter2 = { + CDF11( 770, 2421, 5225, 12907, 15819, 18927, + 21561, 24089, 26595, 28526, 30529) + }, .txtp_inter3 = { + { CDF1(16384) }, { CDF1( 4167) }, { CDF1( 1998) }, { CDF1( 748) }, + }, .txtp_intra1 = { + { + { CDF6( 1535, 8035, 9461, 12751, 23467, 27825) }, + { CDF6( 564, 3335, 9709, 10870, 18143, 28094) }, + { CDF6( 672, 3247, 3676, 11982, 19415, 23127) }, + { CDF6( 5279, 13885, 15487, 18044, 23527, 30252) }, + { CDF6( 4423, 6074, 7985, 10416, 25693, 29298) }, + { CDF6( 1486, 4241, 9460, 10662, 16456, 27694) }, + { CDF6( 439, 2838, 3522, 6737, 18058, 23754) }, + { CDF6( 1190, 4233, 4855, 11670, 20281, 24377) }, + { CDF6( 1045, 4312, 8647, 10159, 18644, 29335) }, + { CDF6( 202, 3734, 4747, 7298, 17127, 24016) }, + { CDF6( 447, 4312, 6819, 8884, 16010, 23858) }, + { CDF6( 277, 4369, 5255, 8905, 16465, 22271) }, + { CDF6( 3409, 5436, 10599, 15599, 19687, 24040) }, }, { - { CDF7(21689, 23883, 25163, 26352, 27506, 28827, 30195) }, - { CDF7( 6892, 15385, 17840, 21606, 24287, 26753, 29204) }, - { CDF7( 5651, 23182, 25042, 26518, 27982, 29392, 30900) }, - { CDF7(19349, 22578, 24418, 25994, 27524, 29031, 30448) }, - { CDF7(31028, 31270, 31504, 31705, 31927, 32153, 32392) }, + { CDF6( 1870, 13742, 14530, 16498, 23770, 27698) }, + { CDF6( 326, 8796, 14632, 15079, 19272, 27486) }, + { CDF6( 484, 7576, 7712, 14443, 19159, 22591) }, + { CDF6( 1126, 15340, 15895, 17023, 20896, 30279) }, + { CDF6( 655, 4854, 5249, 5913, 22099, 27138) }, + { CDF6( 1299, 6458, 8885, 9290, 14851, 25497) }, + { CDF6( 311, 5295, 5552, 6885, 16107, 22672) }, + { CDF6( 883, 8059, 8270, 11258, 17289, 21549) }, + { CDF6( 741, 7580, 9318, 10345, 16688, 29046) }, + { CDF6( 110, 7406, 7915, 9195, 16041, 23329) }, + { CDF6( 363, 7974, 9357, 10673, 15629, 24474) }, + { CDF6( 153, 7647, 8112, 9936, 15307, 19996) }, + { CDF6( 3511, 6332, 11165, 15335, 19323, 23594) }, }, - }, { /* uv */ + }, .txtp_intra2 = { { - { CDF1(29089) }, { CDF1(16384) }, { CDF1( 8713) }, - { CDF1(29257) }, { CDF1(31610) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + }, { + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, + { CDF4( 6554, 13107, 19661, 26214) }, }, { - { CDF2(25257, 29145) }, { CDF2(12287, 27293) }, - { CDF2( 7033, 27960) }, { CDF2(20145, 25405) }, - { CDF2(30608, 31639) }, + { CDF4( 1127, 12814, 22772, 27483) }, + { CDF4( 145, 6761, 11980, 26667) }, + { CDF4( 362, 5887, 11678, 16725) }, + { CDF4( 385, 15213, 18587, 30693) }, + { CDF4( 25, 2914, 23134, 27903) }, + { CDF4( 60, 4470, 11749, 23991) }, + { CDF4( 37, 3332, 14511, 21448) }, + { CDF4( 157, 6320, 13036, 17439) }, + { CDF4( 119, 6719, 12906, 29396) }, + { CDF4( 47, 5537, 12576, 21499) }, + { CDF4( 269, 6076, 11258, 23115) }, + { CDF4( 83, 5615, 12001, 17228) }, + { CDF4( 1968, 5556, 12023, 18547) }, + }, + }, .skip = { + { CDF1(31671) }, { CDF1(16515) }, { CDF1( 4576) }, + }, .skip_mode = { + { CDF1(32621) }, { CDF1(20708) }, { CDF1( 8127) }, + }, .partition = { + { + // 128x128 -> 64x64 + { CDF7(27899, 28219, 28529, 32484, 32539, 32619, 32639) }, + { CDF7( 6607, 6990, 8268, 32060, 32219, 32338, 32371) }, + { CDF7( 5429, 6676, 7122, 32027, 32227, 32531, 32582) }, + { CDF7( 711, 966, 1172, 32448, 32538, 32617, 32664) }, }, { - { CDF3(24210, 27175, 29903) }, - { CDF3( 9888, 22386, 27214) }, - { CDF3( 5901, 26053, 29293) }, - { CDF3(18318, 22152, 28333) }, - { CDF3(30459, 31136, 31926) }, + // 64x64 -> 32x32 + { CDF9(20137, 21547, 23078, 29566, 29837, + 30261, 30524, 30892, 31724) }, + { CDF9( 6732, 7490, 9497, 27944, 28250, + 28515, 28969, 29630, 30104) }, + { CDF9( 5945, 7663, 8348, 28683, 29117, + 29749, 30064, 30298, 32238) }, + { CDF9( 870, 1212, 1487, 31198, 31394, + 31574, 31743, 31881, 32332) }, }, { - { CDF4(22980, 25479, 27781, 29986) }, - { CDF4( 8413, 21408, 24859, 28874) }, - { CDF4( 2257, 29449, 30594, 31598) }, - { CDF4(19189, 21202, 25915, 28620) }, - { CDF4(31844, 32044, 32281, 32518) }, + // 32x32 -> 16x16 + { CDF9(18462, 20920, 23124, 27647, 28227, + 29049, 29519, 30178, 31544) }, + { CDF9( 7689, 9060, 12056, 24992, 25660, + 26182, 26951, 28041, 29052) }, + { CDF9( 6015, 9009, 10062, 24544, 25409, + 26545, 27071, 27526, 32047) }, + { CDF9( 1394, 2208, 2796, 28614, 29061, + 29466, 29840, 30185, 31899) }, }, { - { CDF5(22217, 24567, 26637, 28683, 30548) }, - { CDF5( 7307, 16406, 19636, 24632, 28424) }, - { CDF5( 4441, 25064, 26879, 28942, 30919) }, - { CDF5(17210, 20528, 23319, 26750, 29582) }, - { CDF5(30674, 30953, 31396, 31735, 32207) }, + // 16x16 -> 8x8 + { CDF9(15597, 20929, 24571, 26706, 27664, + 28821, 29601, 30571, 31902) }, + { CDF9( 7925, 11043, 16785, 22470, 23971, + 25043, 26651, 28701, 29834) }, + { CDF9( 5414, 13269, 15111, 20488, 22360, + 24500, 25537, 26336, 32117) }, + { CDF9( 2662, 6362, 8614, 20860, 23053, + 24778, 26436, 27829, 31171) }, }, { - { CDF6(21239, 23168, 25044, 26962, 28705, 30506) }, - { CDF6( 6545, 15012, 18004, 21817, 25503, 28701) }, - { CDF6( 3448, 26295, 27437, 28704, 30126, 31442) }, - { CDF6(15889, 18323, 21704, 24698, 26976, 29690) }, - { CDF6(30988, 31204, 31479, 31734, 31983, 32325) }, + // 8x8 -> 4x4 only supports the four legacy partition types + { CDF3(19132, 25510, 30392) }, + { CDF3(13928, 19855, 28540) }, + { CDF3(12522, 23679, 28629) }, + { CDF3( 9896, 18783, 25853) }, + }, + }, .seg_pred = { + { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) }, + }, .seg_id = { + { CDF7( 5622, 7893, 16093, 18233, 27809, 28373, 32533) }, + { CDF7(14274, 18230, 22557, 24935, 29980, 30851, 32344) }, + { CDF7(27527, 28487, 28723, 28890, 32397, 32647, 32679) }, + }, .cfl_sign = { + CDF7( 1418, 2123, 13340, 18405, 26972, 28343, 32294) + }, .cfl_alpha = { + { CDF15( 7637, 20719, 31401, 32481, 32657, 32688, 32692, 32696, + 32700, 32704, 32708, 32712, 32716, 32720, 32724) }, + { CDF15(14365, 23603, 28135, 31168, 32167, 32395, 32487, 32573, + 32620, 32647, 32668, 32672, 32676, 32680, 32684) }, + { CDF15(11532, 22380, 28445, 31360, 32349, 32523, 32584, 32649, + 32673, 32677, 32681, 32685, 32689, 32693, 32697) }, + { CDF15(26990, 31402, 32282, 32571, 32692, 32696, 32700, 32704, + 32708, 32712, 32716, 32720, 32724, 32728, 32732) }, + { CDF15(17248, 26058, 28904, 30608, 31305, 31877, 32126, 32321, + 32394, 32464, 32516, 32560, 32576, 32593, 32622) }, + { CDF15(14738, 21678, 25779, 27901, 29024, 30302, 30980, 31843, + 32144, 32413, 32520, 32594, 32622, 32656, 32660) }, + }, .restore_wiener = { + CDF1(11570) + }, .restore_sgrproj = { + CDF1(16855) + }, .restore_switchable = { + CDF2( 9413, 22581) + }, .delta_q = { + CDF3(28160, 32120, 32677) + }, .delta_lf = { + { CDF3(28160, 32120, 32677) }, + { CDF3(28160, 32120, 32677) }, + { CDF3(28160, 32120, 32677) }, + { CDF3(28160, 32120, 32677) }, + { CDF3(28160, 32120, 32677) }, + }, .motion_mode = { + [BS_8x8] = { CDF2( 7651, 24760) }, + [BS_8x16] = { CDF2( 4738, 24765) }, + [BS_8x32] = { CDF2(28799, 31390) }, + [BS_16x8] = { CDF2( 5391, 25528) }, + [BS_16x16] = { CDF2(19419, 26810) }, + [BS_16x32] = { CDF2( 5123, 23606) }, + [BS_16x64] = { CDF2(28973, 31594) }, + [BS_32x8] = { CDF2(26431, 30774) }, + [BS_32x16] = { CDF2(11606, 24308) }, + [BS_32x32] = { CDF2(26260, 29116) }, + [BS_32x64] = { CDF2(20360, 28062) }, + [BS_64x16] = { CDF2(29742, 31203) }, + [BS_64x32] = { CDF2(21679, 26830) }, + [BS_64x64] = { CDF2(29516, 30701) }, + [BS_64x128] = { CDF2(28898, 30397) }, + [BS_128x64] = { CDF2(30878, 31335) }, + [BS_128x128] = { CDF2(32507, 32558) }, + }, .obmc = { + [BS_8x8] = { CDF1(10437) }, + [BS_8x16] = { CDF1( 9371) }, + [BS_8x32] = { CDF1(23664) }, + [BS_16x8] = { CDF1( 9301) }, + [BS_16x16] = { CDF1(17432) }, + [BS_16x32] = { CDF1(14423) }, + [BS_16x64] = { CDF1(24008) }, + [BS_32x8] = { CDF1(20901) }, + [BS_32x16] = { CDF1(15142) }, + [BS_32x32] = { CDF1(25817) }, + [BS_32x64] = { CDF1(22823) }, + [BS_64x16] = { CDF1(26879) }, + [BS_64x32] = { CDF1(22083) }, + [BS_64x64] = { CDF1(30128) }, + [BS_64x128] = { CDF1(31014) }, + [BS_128x64] = { CDF1(31560) }, + [BS_128x128] = { CDF1(32638) }, + }, .pal_y = { + { { CDF1(31676) }, { CDF1( 3419) }, { CDF1( 1261) } }, + { { CDF1(31912) }, { CDF1( 2859) }, { CDF1( 980) } }, + { { CDF1(31823) }, { CDF1( 3400) }, { CDF1( 781) } }, + { { CDF1(32030) }, { CDF1( 3561) }, { CDF1( 904) } }, + { { CDF1(32309) }, { CDF1( 7337) }, { CDF1( 1462) } }, + { { CDF1(32265) }, { CDF1( 4015) }, { CDF1( 1521) } }, + { { CDF1(32450) }, { CDF1( 7946) }, { CDF1( 129) } }, + }, .pal_sz = { + { + { CDF6( 7952, 13000, 18149, 21478, 25527, 29241) }, + { CDF6( 7139, 11421, 16195, 19544, 23666, 28073) }, + { CDF6( 7788, 12741, 17325, 20500, 24315, 28530) }, + { CDF6( 8271, 14064, 18246, 21564, 25071, 28533) }, + { CDF6(12725, 19180, 21863, 24839, 27535, 30120) }, + { CDF6( 9711, 14888, 16923, 21052, 25661, 27875) }, + { CDF6(14940, 20797, 21678, 24186, 27033, 28999) }, }, { - { CDF7(21442, 23288, 24758, 26246, 27649, 28980, 30563) }, - { CDF7( 5863, 14933, 17552, 20668, 23683, 26411, 29273) }, - { CDF7( 3415, 25810, 26877, 27990, 29223, 30394, 31618) }, - { CDF7(17965, 20084, 22232, 23974, 26274, 28402, 30390) }, - { CDF7(31190, 31329, 31516, 31679, 31825, 32026, 32322) }, + { CDF6( 8713, 19979, 27128, 29609, 31331, 32272) }, + { CDF6( 5839, 15573, 23581, 26947, 29848, 31700) }, + { CDF6( 4426, 11260, 17999, 21483, 25863, 29430) }, + { CDF6( 3228, 9464, 14993, 18089, 22523, 27420) }, + { CDF6( 3768, 8886, 13091, 17852, 22495, 27207) }, + { CDF6( 2464, 8451, 12861, 21632, 25525, 28555) }, + { CDF6( 1269, 5435, 10433, 18963, 21700, 25865) }, + }, + }, .pal_uv = { + { CDF1(32461) }, { CDF1(21488) }, + }, .color_map = { + { /* y */ + { + { CDF1(28710) }, { CDF1(16384) }, { CDF1(10553) }, + { CDF1(27036) }, { CDF1(31603) }, + }, { + { CDF2(27877, 30490) }, { CDF2(11532, 25697) }, + { CDF2( 6544, 30234) }, { CDF2(23018, 28072) }, + { CDF2(31915, 32385) }, + }, { + { CDF3(25572, 28046, 30045) }, + { CDF3( 9478, 21590, 27256) }, + { CDF3( 7248, 26837, 29824) }, + { CDF3(19167, 24486, 28349) }, + { CDF3(31400, 31825, 32250) }, + }, { + { CDF4(24779, 26955, 28576, 30282) }, + { CDF4( 8669, 20364, 24073, 28093) }, + { CDF4( 4255, 27565, 29377, 31067) }, + { CDF4(19864, 23674, 26716, 29530) }, + { CDF4(31646, 31893, 32147, 32426) }, + }, { + { CDF5(23132, 25407, 26970, 28435, 30073) }, + { CDF5( 7443, 17242, 20717, 24762, 27982) }, + { CDF5( 6300, 24862, 26944, 28784, 30671) }, + { CDF5(18916, 22895, 25267, 27435, 29652) }, + { CDF5(31270, 31550, 31808, 32059, 32353) }, + }, { + { CDF6(23105, 25199, 26464, 27684, 28931, 30318) }, + { CDF6( 6950, 15447, 18952, 22681, 25567, 28563) }, + { CDF6( 7560, 23474, 25490, 27203, 28921, 30708) }, + { CDF6(18544, 22373, 24457, 26195, 28119, 30045) }, + { CDF6(31198, 31451, 31670, 31882, 32123, 32391) }, + }, { + { CDF7(21689, 23883, 25163, 26352, 27506, 28827, 30195) }, + { CDF7( 6892, 15385, 17840, 21606, 24287, 26753, 29204) }, + { CDF7( 5651, 23182, 25042, 26518, 27982, 29392, 30900) }, + { CDF7(19349, 22578, 24418, 25994, 27524, 29031, 30448) }, + { CDF7(31028, 31270, 31504, 31705, 31927, 32153, 32392) }, + }, + }, { /* uv */ + { + { CDF1(29089) }, { CDF1(16384) }, { CDF1( 8713) }, + { CDF1(29257) }, { CDF1(31610) }, + }, { + { CDF2(25257, 29145) }, { CDF2(12287, 27293) }, + { CDF2( 7033, 27960) }, { CDF2(20145, 25405) }, + { CDF2(30608, 31639) }, + }, { + { CDF3(24210, 27175, 29903) }, + { CDF3( 9888, 22386, 27214) }, + { CDF3( 5901, 26053, 29293) }, + { CDF3(18318, 22152, 28333) }, + { CDF3(30459, 31136, 31926) }, + }, { + { CDF4(22980, 25479, 27781, 29986) }, + { CDF4( 8413, 21408, 24859, 28874) }, + { CDF4( 2257, 29449, 30594, 31598) }, + { CDF4(19189, 21202, 25915, 28620) }, + { CDF4(31844, 32044, 32281, 32518) }, + }, { + { CDF5(22217, 24567, 26637, 28683, 30548) }, + { CDF5( 7307, 16406, 19636, 24632, 28424) }, + { CDF5( 4441, 25064, 26879, 28942, 30919) }, + { CDF5(17210, 20528, 23319, 26750, 29582) }, + { CDF5(30674, 30953, 31396, 31735, 32207) }, + }, { + { CDF6(21239, 23168, 25044, 26962, 28705, 30506) }, + { CDF6( 6545, 15012, 18004, 21817, 25503, 28701) }, + { CDF6( 3448, 26295, 27437, 28704, 30126, 31442) }, + { CDF6(15889, 18323, 21704, 24698, 26976, 29690) }, + { CDF6(30988, 31204, 31479, 31734, 31983, 32325) }, + }, { + { CDF7(21442, 23288, 24758, 26246, 27649, 28980, 30563) }, + { CDF7( 5863, 14933, 17552, 20668, 23683, 26411, 29273) }, + { CDF7( 3415, 25810, 26877, 27990, 29223, 30394, 31618) }, + { CDF7(17965, 20084, 22232, 23974, 26274, 28402, 30390) }, + { CDF7(31190, 31329, 31516, 31679, 31825, 32026, 32322) }, + }, }, + }, .intrabc = { + CDF1(30531) + }, + }, .mv = { + .comp = { + .classes = { + CDF10(28672, 30976, 31858, 32320, 32551, + 32656, 32740, 32757, 32762, 32767) + }, .class0 = { + CDF1(27648) + }, .classN = { + { CDF1(17408) }, { CDF1(17920) }, { CDF1(18944) }, + { CDF1(20480) }, { CDF1(22528) }, { CDF1(24576) }, + { CDF1(28672) }, { CDF1(29952) }, { CDF1(29952) }, + { CDF1(30720) }, + }, .class0_fp = { + { CDF3(16384, 24576, 26624) }, + { CDF3(12288, 21248, 24128) }, + }, .classN_fp = { + CDF3( 8192, 17408, 21248) + }, .class0_hp = { + CDF1(20480) + }, .classN_hp = { + CDF1(16384) + }, .sign = { + CDF1(16384) + }, + }, .joint = { + CDF3( 4096, 11264, 19328) + }, + }, .kfym = { + { + { CDF12(15588, 17027, 19338, 20218, 20682, 21110, + 21825, 23244, 24189, 28165, 29093, 30466) }, + { CDF12(12016, 18066, 19516, 20303, 20719, 21444, + 21888, 23032, 24434, 28658, 30172, 31409) }, + { CDF12(10052, 10771, 22296, 22788, 23055, 23239, + 24133, 25620, 26160, 29336, 29929, 31567) }, + { CDF12(14091, 15406, 16442, 18808, 19136, 19546, + 19998, 22096, 24746, 29585, 30958, 32462) }, + { CDF12(12122, 13265, 15603, 16501, 18609, 20033, + 22391, 25583, 26437, 30261, 31073, 32475) }, + }, { + { CDF12(10023, 19585, 20848, 21440, 21832, 22760, + 23089, 24023, 25381, 29014, 30482, 31436) }, + { CDF12( 5983, 24099, 24560, 24886, 25066, 25795, + 25913, 26423, 27610, 29905, 31276, 31794) }, + { CDF12( 7444, 12781, 20177, 20728, 21077, 21607, + 22170, 23405, 24469, 27915, 29090, 30492) }, + { CDF12( 8537, 14689, 15432, 17087, 17408, 18172, + 18408, 19825, 24649, 29153, 31096, 32210) }, + { CDF12( 7543, 14231, 15496, 16195, 17905, 20717, + 21984, 24516, 26001, 29675, 30981, 31994) }, + }, { + { CDF12(12613, 13591, 21383, 22004, 22312, 22577, + 23401, 25055, 25729, 29538, 30305, 32077) }, + { CDF12( 9687, 13470, 18506, 19230, 19604, 20147, + 20695, 22062, 23219, 27743, 29211, 30907) }, + { CDF12( 6183, 6505, 26024, 26252, 26366, 26434, + 27082, 28354, 28555, 30467, 30794, 32086) }, + { CDF12(10718, 11734, 14954, 17224, 17565, 17924, + 18561, 21523, 23878, 28975, 30287, 32252) }, + { CDF12( 9194, 9858, 16501, 17263, 18424, 19171, + 21563, 25961, 26561, 30072, 30737, 32463) }, + }, { + { CDF12(12602, 14399, 15488, 18381, 18778, 19315, + 19724, 21419, 25060, 29696, 30917, 32409) }, + { CDF12( 8203, 13821, 14524, 17105, 17439, 18131, + 18404, 19468, 25225, 29485, 31158, 32342) }, + { CDF12( 8451, 9731, 15004, 17643, 18012, 18425, + 19070, 21538, 24605, 29118, 30078, 32018) }, + { CDF12( 7714, 9048, 9516, 16667, 16817, 16994, + 17153, 18767, 26743, 30389, 31536, 32528) }, + { CDF12( 8843, 10280, 11496, 15317, 16652, 17943, + 19108, 22718, 25769, 29953, 30983, 32485) }, + }, { + { CDF12(12578, 13671, 15979, 16834, 19075, 20913, + 22989, 25449, 26219, 30214, 31150, 32477) }, + { CDF12( 9563, 13626, 15080, 15892, 17756, 20863, + 22207, 24236, 25380, 29653, 31143, 32277) }, + { CDF12( 8356, 8901, 17616, 18256, 19350, 20106, + 22598, 25947, 26466, 29900, 30523, 32261) }, + { CDF12(10835, 11815, 13124, 16042, 17018, 18039, + 18947, 22753, 24615, 29489, 30883, 32482) }, + { CDF12( 7618, 8288, 9859, 10509, 15386, 18657, + 22903, 28776, 29180, 31355, 31802, 32593) }, }, - }, .intrabc = { - CDF1(30531) - }, -}; - -static const CdfMvComponent default_mv_component_cdf = { - .classes = { - CDF10(28672, 30976, 31858, 32320, 32551, - 32656, 32740, 32757, 32762, 32767) - }, .class0 = { - CDF1(27648) - }, .classN = { - { CDF1(17408) }, { CDF1(17920) }, { CDF1(18944) }, - { CDF1(20480) }, { CDF1(22528) }, { CDF1(24576) }, - { CDF1(28672) }, { CDF1(29952) }, { CDF1(29952) }, - { CDF1(30720) }, - }, .class0_fp = { - { CDF3(16384, 24576, 26624) }, - { CDF3(12288, 21248, 24128) }, - }, .classN_fp = { - CDF3( 8192, 17408, 21248) - }, .class0_hp = { - CDF1(20480) - }, .classN_hp = { - CDF1(16384) - }, .sign = { - CDF1(16384) - }, -}; - -static const uint16_t ALIGN(default_mv_joint_cdf[N_MV_JOINTS], 8) = { - CDF3( 4096, 11264, 19328) -}; - -static const uint16_t ALIGN(default_kf_y_mode_cdf[5][5][N_INTRA_PRED_MODES + 3], 32) = { - { - { CDF12(15588, 17027, 19338, 20218, 20682, 21110, - 21825, 23244, 24189, 28165, 29093, 30466) }, - { CDF12(12016, 18066, 19516, 20303, 20719, 21444, - 21888, 23032, 24434, 28658, 30172, 31409) }, - { CDF12(10052, 10771, 22296, 22788, 23055, 23239, - 24133, 25620, 26160, 29336, 29929, 31567) }, - { CDF12(14091, 15406, 16442, 18808, 19136, 19546, - 19998, 22096, 24746, 29585, 30958, 32462) }, - { CDF12(12122, 13265, 15603, 16501, 18609, 20033, - 22391, 25583, 26437, 30261, 31073, 32475) }, - }, { - { CDF12(10023, 19585, 20848, 21440, 21832, 22760, - 23089, 24023, 25381, 29014, 30482, 31436) }, - { CDF12( 5983, 24099, 24560, 24886, 25066, 25795, - 25913, 26423, 27610, 29905, 31276, 31794) }, - { CDF12( 7444, 12781, 20177, 20728, 21077, 21607, - 22170, 23405, 24469, 27915, 29090, 30492) }, - { CDF12( 8537, 14689, 15432, 17087, 17408, 18172, - 18408, 19825, 24649, 29153, 31096, 32210) }, - { CDF12( 7543, 14231, 15496, 16195, 17905, 20717, - 21984, 24516, 26001, 29675, 30981, 31994) }, - }, { - { CDF12(12613, 13591, 21383, 22004, 22312, 22577, - 23401, 25055, 25729, 29538, 30305, 32077) }, - { CDF12( 9687, 13470, 18506, 19230, 19604, 20147, - 20695, 22062, 23219, 27743, 29211, 30907) }, - { CDF12( 6183, 6505, 26024, 26252, 26366, 26434, - 27082, 28354, 28555, 30467, 30794, 32086) }, - { CDF12(10718, 11734, 14954, 17224, 17565, 17924, - 18561, 21523, 23878, 28975, 30287, 32252) }, - { CDF12( 9194, 9858, 16501, 17263, 18424, 19171, - 21563, 25961, 26561, 30072, 30737, 32463) }, - }, { - { CDF12(12602, 14399, 15488, 18381, 18778, 19315, - 19724, 21419, 25060, 29696, 30917, 32409) }, - { CDF12( 8203, 13821, 14524, 17105, 17439, 18131, - 18404, 19468, 25225, 29485, 31158, 32342) }, - { CDF12( 8451, 9731, 15004, 17643, 18012, 18425, - 19070, 21538, 24605, 29118, 30078, 32018) }, - { CDF12( 7714, 9048, 9516, 16667, 16817, 16994, - 17153, 18767, 26743, 30389, 31536, 32528) }, - { CDF12( 8843, 10280, 11496, 15317, 16652, 17943, - 19108, 22718, 25769, 29953, 30983, 32485) }, - }, { - { CDF12(12578, 13671, 15979, 16834, 19075, 20913, - 22989, 25449, 26219, 30214, 31150, 32477) }, - { CDF12( 9563, 13626, 15080, 15892, 17756, 20863, - 22207, 24236, 25380, 29653, 31143, 32277) }, - { CDF12( 8356, 8901, 17616, 18256, 19350, 20106, - 22598, 25947, 26466, 29900, 30523, 32261) }, - { CDF12(10835, 11815, 13124, 16042, 17018, 18039, - 18947, 22753, 24615, 29489, 30883, 32482) }, - { CDF12( 7618, 8288, 9859, 10509, 15386, 18657, - 22903, 28776, 29180, 31355, 31802, 32593) }, }, }; -static const CdfCoefContext av1_default_coef_cdf[4] = { +static const CdfCoefContext default_coef_cdf[4] = { [0] = { .skip = { { @@ -3951,10 +3958,8 @@ void dav1d_cdf_thread_update(const Dav1dFrameHeader *const hdr, { #define update_cdf_1d(n1d, name) \ do { \ - memcpy(dst->name, src->name, sizeof(dst->name)); \ dst->name[n1d] = 0; \ } while (0) - #define update_cdf_2d(n1d, n2d, name) \ for (int j = 0; j < (n1d); j++) update_cdf_1d(n2d, name[j]) #define update_cdf_3d(n1d, n2d, n3d, name) \ @@ -3962,29 +3967,8 @@ void dav1d_cdf_thread_update(const Dav1dFrameHeader *const hdr, #define update_cdf_4d(n1d, n2d, n3d, n4d, name) \ for (int l = 0; l < (n1d); l++) update_cdf_3d(n2d, n3d, n4d, name[l]) -#define update_bit_0d(name) \ - do { \ - dst->name[0] = src->name[0]; \ - dst->name[1] = 0; \ - } while (0) - -#define update_bit_1d(n1d, name) \ - for (int i = 0; i < (n1d); i++) update_bit_0d(name[i]) -#define update_bit_2d(n1d, n2d, name) \ - for (int j = 0; j < (n1d); j++) update_bit_1d(n2d, name[j]) -#define update_bit_3d(n1d, n2d, n3d, name) \ - for (int k = 0; k < (n1d); k++) update_bit_2d(n2d, n3d, name[k]) + memcpy(dst, src, offsetof(CdfContext, m.intrabc)); - update_bit_1d(N_BS_SIZES, m.use_filter_intra); - update_cdf_1d(4, m.filter_intra); - update_cdf_3d(2, N_INTRA_PRED_MODES, N_UV_INTRA_PRED_MODES - 1 - !k, m.uv_mode); - update_cdf_2d(8, 6, m.angle_delta); - update_cdf_3d(N_TX_SIZES - 1, 3, imin(k + 1, 2), m.txsz); - update_cdf_3d(2, N_INTRA_PRED_MODES, 6, m.txtp_intra1); - update_cdf_3d(3, N_INTRA_PRED_MODES, 4, m.txtp_intra2); - update_bit_1d(3, m.skip); - update_cdf_3d(N_BL_LEVELS, 4, dav1d_partition_type_count[k], m.partition); - update_bit_2d(N_TX_SIZES, 13, coef.skip); update_cdf_3d(2, 2, 4, coef.eob_bin_16); update_cdf_3d(2, 2, 5, coef.eob_bin_32); update_cdf_3d(2, 2, 6, coef.eob_bin_64); @@ -3992,106 +3976,104 @@ void dav1d_cdf_thread_update(const Dav1dFrameHeader *const hdr, update_cdf_3d(2, 2, 8, coef.eob_bin_256); update_cdf_2d(2, 9, coef.eob_bin_512); update_cdf_2d(2, 10, coef.eob_bin_1024); - update_bit_3d(N_TX_SIZES, 2, 11 /*22*/, coef.eob_hi_bit); update_cdf_4d(N_TX_SIZES, 2, 4, 2, coef.eob_base_tok); update_cdf_4d(N_TX_SIZES, 2, 41 /*42*/, 3, coef.base_tok); - update_bit_2d(2, 3, coef.dc_sign); update_cdf_4d(4, 2, 21, 3, coef.br_tok); - update_cdf_2d(3, DAV1D_MAX_SEGMENTS - 1, m.seg_id); - update_cdf_1d(7, m.cfl_sign); + update_cdf_4d(N_TX_SIZES, 2, 11 /*22*/, 1, coef.eob_hi_bit); + update_cdf_3d(N_TX_SIZES, 13, 1, coef.skip); + update_cdf_3d(2, 3, 1, coef.dc_sign); + + update_cdf_3d(2, N_INTRA_PRED_MODES, N_UV_INTRA_PRED_MODES - 1 - !k, m.uv_mode); + update_cdf_2d(4, N_PARTITIONS - 3, m.partition[BL_128X128]); + for (int k = BL_64X64; k < BL_8X8; k++) + update_cdf_2d(4, N_PARTITIONS - 1, m.partition[k]); + update_cdf_2d(4, N_SUB8X8_PARTITIONS - 1, m.partition[BL_8X8]); update_cdf_2d(6, 15, m.cfl_alpha); - update_bit_0d(m.restore_wiener); - update_bit_0d(m.restore_sgrproj); - update_cdf_1d(2, m.restore_switchable); - update_cdf_1d(3, m.delta_q); - update_cdf_2d(5, 3, m.delta_lf); - update_bit_2d(7, 3, m.pal_y); - update_bit_1d(2, m.pal_uv); - update_cdf_3d(2, 7, 6, m.pal_sz); - update_cdf_4d(2, 7, 5, k + 1, m.color_map); - update_bit_2d(7, 3, m.txpart); update_cdf_2d(2, 15, m.txtp_inter1); update_cdf_1d(11, m.txtp_inter2); - update_bit_1d(4, m.txtp_inter3); - - if (IS_KEY_OR_INTRA(hdr)) { - update_bit_0d(m.intrabc); + update_cdf_3d(2, N_INTRA_PRED_MODES, 6, m.txtp_intra1); + update_cdf_3d(3, N_INTRA_PRED_MODES, 4, m.txtp_intra2); + update_cdf_1d(7, m.cfl_sign); + update_cdf_2d(8, 6, m.angle_delta); + update_cdf_1d(4, m.filter_intra); + update_cdf_2d(3, DAV1D_MAX_SEGMENTS - 1, m.seg_id); + update_cdf_3d(2, 7, 6, m.pal_sz); + update_cdf_4d(2, 7, 5, k + 1, m.color_map); + update_cdf_3d(N_TX_SIZES - 1, 3, imin(k + 1, 2), m.txsz); + update_cdf_1d(3, m.delta_q); + update_cdf_2d(5, 3, m.delta_lf); + update_cdf_1d(2, m.restore_switchable); + update_cdf_1d(1, m.restore_wiener); + update_cdf_1d(1, m.restore_sgrproj); + update_cdf_2d(4, 1, m.txtp_inter3); + update_cdf_2d(N_BS_SIZES, 1, m.use_filter_intra); + update_cdf_3d(7, 3, 1, m.txpart); + update_cdf_2d(3, 1, m.skip); + update_cdf_3d(7, 3, 1, m.pal_y); + update_cdf_2d(2, 1, m.pal_uv); - update_cdf_1d(N_MV_JOINTS - 1, dmv.joint); - for (int k = 0; k < 2; k++) { - update_cdf_1d(10, dmv.comp[k].classes); - update_bit_0d(dmv.comp[k].class0); - update_bit_1d(10, dmv.comp[k].classN); - update_bit_0d(dmv.comp[k].sign); - } + if (IS_KEY_OR_INTRA(hdr)) return; - } - update_bit_1d(3, m.skip_mode); + memcpy(dst->m.y_mode, src->m.y_mode, + offsetof(CdfContext, kfym) - offsetof(CdfContext, m.y_mode)); + update_cdf_2d(4, N_INTRA_PRED_MODES - 1, m.y_mode); - update_cdf_3d(2, 8, DAV1D_N_SWITCHABLE_FILTERS - 1, m.filter); - update_bit_1d(6, m.newmv_mode); - update_bit_1d(2, m.globalmv_mode); - update_bit_1d(6, m.refmv_mode); - update_bit_1d(3, m.drl_bit); - update_cdf_2d(8, N_COMP_INTER_PRED_MODES - 1, m.comp_inter_mode); - update_bit_1d(4, m.intra); - update_bit_1d(5, m.comp); - update_bit_1d(5, m.comp_dir); - update_bit_1d(6, m.jnt_comp); - update_bit_1d(6, m.mask_comp); - update_bit_1d(9, m.wedge_comp); update_cdf_2d(9, 15, m.wedge_idx); - update_bit_2d(6, 3, m.ref); - update_bit_2d(3, 3, m.comp_fwd_ref); - update_bit_2d(2, 3, m.comp_bwd_ref); - update_bit_2d(3, 3, m.comp_uni_ref); - update_bit_1d(3, m.seg_pred); - update_bit_1d(4, m.interintra); - update_bit_1d(7, m.interintra_wedge); + update_cdf_2d(8, N_COMP_INTER_PRED_MODES - 1, m.comp_inter_mode); + update_cdf_3d(2, 8, DAV1D_N_SWITCHABLE_FILTERS - 1, m.filter); update_cdf_2d(4, 3, m.interintra_mode); update_cdf_2d(N_BS_SIZES, 2, m.motion_mode); - update_bit_1d(N_BS_SIZES, m.obmc); + update_cdf_2d(3, 1, m.skip_mode); + update_cdf_2d(6, 1, m.newmv_mode); + update_cdf_2d(2, 1, m.globalmv_mode); + update_cdf_2d(6, 1, m.refmv_mode); + update_cdf_2d(3, 1, m.drl_bit); + update_cdf_2d(4, 1, m.intra); + update_cdf_2d(5, 1, m.comp); + update_cdf_2d(5, 1, m.comp_dir); + update_cdf_2d(6, 1, m.jnt_comp); + update_cdf_2d(6, 1, m.mask_comp); + update_cdf_2d(9, 1, m.wedge_comp); + update_cdf_3d(6, 3, 1, m.ref); + update_cdf_3d(3, 3, 1, m.comp_fwd_ref); + update_cdf_3d(2, 3, 1, m.comp_bwd_ref); + update_cdf_3d(3, 3, 1, m.comp_uni_ref); + update_cdf_2d(3, 1, m.seg_pred); + update_cdf_2d(4, 1, m.interintra); + update_cdf_2d(7, 1, m.interintra_wedge); + update_cdf_2d(N_BS_SIZES, 1, m.obmc); - update_cdf_1d(N_MV_JOINTS - 1, mv.joint); for (int k = 0; k < 2; k++) { update_cdf_1d(10, mv.comp[k].classes); - update_bit_0d(mv.comp[k].class0); - update_bit_1d(10, mv.comp[k].classN); + update_cdf_1d(1, mv.comp[k].sign); + update_cdf_1d(1, mv.comp[k].class0); update_cdf_2d(2, 3, mv.comp[k].class0_fp); + update_cdf_1d(1, mv.comp[k].class0_hp); + update_cdf_2d(10, 1, mv.comp[k].classN); update_cdf_1d(3, mv.comp[k].classN_fp); - update_bit_0d(mv.comp[k].class0_hp); - update_bit_0d(mv.comp[k].classN_hp); - update_bit_0d(mv.comp[k].sign); + update_cdf_1d(1, mv.comp[k].classN_hp); } + update_cdf_1d(N_MV_JOINTS - 1, mv.joint); } /* * CDF threading wrappers. */ -static inline int get_qcat_idx(const int q) { - if (q <= 20) return 0; - if (q <= 60) return 1; - if (q <= 120) return 2; - return 3; -} - -void dav1d_cdf_thread_init_static(CdfThreadContext *const cdf, const int qidx) { +void dav1d_cdf_thread_init_static(CdfThreadContext *const cdf, const unsigned qidx) { cdf->ref = NULL; - cdf->data.qcat = get_qcat_idx(qidx); + cdf->data.qcat = (qidx > 20) + (qidx > 60) + (qidx > 120); } void dav1d_cdf_thread_copy(CdfContext *const dst, const CdfThreadContext *const src) { if (src->ref) { memcpy(dst, src->data.cdf, sizeof(*dst)); } else { - dst->m = av1_default_cdf; - memcpy(dst->kfym, default_kf_y_mode_cdf, sizeof(default_kf_y_mode_cdf)); - dst->coef = av1_default_coef_cdf[src->data.qcat]; - memcpy(dst->mv.joint, default_mv_joint_cdf, sizeof(default_mv_joint_cdf)); - memcpy(dst->dmv.joint, default_mv_joint_cdf, sizeof(default_mv_joint_cdf)); - dst->mv.comp[0] = dst->mv.comp[1] = dst->dmv.comp[0] = dst->dmv.comp[1] = - default_mv_component_cdf; + dst->coef = default_coef_cdf[src->data.qcat]; + memcpy(&dst->m, &default_cdf.m, + offsetof(CdfDefaultContext, mv.joint)); + memcpy(&dst->mv.comp[1], &default_cdf.mv.comp, + sizeof(default_cdf) - offsetof(CdfDefaultContext, mv.comp)); } } |