Skip to content

Commit 7d773ea

Browse files
authored
Replace cdf! macro with const fns (#3334)
1 parent d555dc8 commit 7d773ea

File tree

5 files changed

+4565
-4703
lines changed

5 files changed

+4565
-4703
lines changed

src/context/block_unit.rs

+44-43
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::mem::MaybeUninit;
1212
use super::*;
1313

1414
use crate::predict::PredictionMode;
15+
use crate::util::cdf;
1516

1617
pub const MAX_PLANES: usize = 3;
1718

@@ -555,55 +556,55 @@ pub struct NMVContext {
555556
// lv_map
556557
pub static default_nmv_context: NMVContext = {
557558
NMVContext {
558-
joints_cdf: cdf!(4096, 11264, 19328),
559+
joints_cdf: cdf([4096, 11264, 19328]),
559560
padding: [0; 12],
560561
comps: [
561562
NMVComponent {
562-
classes_cdf: cdf!(
563-
28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, 32762, 32767
564-
),
565-
class0_fp_cdf: [cdf!(16384, 24576, 26624), cdf!(12288, 21248, 24128)],
566-
fp_cdf: cdf!(8192, 17408, 21248),
567-
sign_cdf: cdf!(128 * 128),
568-
class0_hp_cdf: cdf!(160 * 128),
569-
hp_cdf: cdf!(128 * 128),
570-
class0_cdf: cdf!(216 * 128),
571-
bits_cdf: [
572-
cdf!(128 * 136),
573-
cdf!(128 * 140),
574-
cdf!(128 * 148),
575-
cdf!(128 * 160),
576-
cdf!(128 * 176),
577-
cdf!(128 * 192),
578-
cdf!(128 * 224),
579-
cdf!(128 * 234),
580-
cdf!(128 * 234),
581-
cdf!(128 * 240),
582-
],
563+
classes_cdf: cdf([
564+
28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, 32762, 32767,
565+
]),
566+
class0_fp_cdf: cdf_2d([[16384, 24576, 26624], [12288, 21248, 24128]]),
567+
fp_cdf: cdf([8192, 17408, 21248]),
568+
sign_cdf: cdf([128 * 128]),
569+
class0_hp_cdf: cdf([160 * 128]),
570+
hp_cdf: cdf([128 * 128]),
571+
class0_cdf: cdf([216 * 128]),
572+
bits_cdf: cdf_2d([
573+
[128 * 136],
574+
[128 * 140],
575+
[128 * 148],
576+
[128 * 160],
577+
[128 * 176],
578+
[128 * 192],
579+
[128 * 224],
580+
[128 * 234],
581+
[128 * 234],
582+
[128 * 240],
583+
]),
583584
padding: [0; 5],
584585
},
585586
NMVComponent {
586-
classes_cdf: cdf!(
587-
28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, 32762, 32767
588-
),
589-
class0_fp_cdf: [cdf!(16384, 24576, 26624), cdf!(12288, 21248, 24128)],
590-
fp_cdf: cdf!(8192, 17408, 21248),
591-
sign_cdf: cdf!(128 * 128),
592-
class0_hp_cdf: cdf!(160 * 128),
593-
hp_cdf: cdf!(128 * 128),
594-
class0_cdf: cdf!(216 * 128),
595-
bits_cdf: [
596-
cdf!(128 * 136),
597-
cdf!(128 * 140),
598-
cdf!(128 * 148),
599-
cdf!(128 * 160),
600-
cdf!(128 * 176),
601-
cdf!(128 * 192),
602-
cdf!(128 * 224),
603-
cdf!(128 * 234),
604-
cdf!(128 * 234),
605-
cdf!(128 * 240),
606-
],
587+
classes_cdf: cdf([
588+
28672, 30976, 31858, 32320, 32551, 32656, 32740, 32757, 32762, 32767,
589+
]),
590+
class0_fp_cdf: cdf_2d([[16384, 24576, 26624], [12288, 21248, 24128]]),
591+
fp_cdf: cdf([8192, 17408, 21248]),
592+
sign_cdf: cdf([128 * 128]),
593+
class0_hp_cdf: cdf([160 * 128]),
594+
hp_cdf: cdf([128 * 128]),
595+
class0_cdf: cdf([216 * 128]),
596+
bits_cdf: cdf_2d([
597+
[128 * 136],
598+
[128 * 140],
599+
[128 * 148],
600+
[128 * 160],
601+
[128 * 176],
602+
[128 * 192],
603+
[128 * 224],
604+
[128 * 234],
605+
[128 * 234],
606+
[128 * 240],
607+
]),
607608
padding: [0; 5],
608609
},
609610
],

0 commit comments

Comments
 (0)