From 6bd5b458d9889f092abe9b582bd531ed08a8dc51 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 18 May 2023 18:23:00 +0200 Subject: [PATCH] rv34: make coefficient data public for the upcoming encoder --- nihav-realmedia/src/codecs/rv34codes.rs | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/nihav-realmedia/src/codecs/rv34codes.rs b/nihav-realmedia/src/codecs/rv34codes.rs index 1436a41..c5181fa 100644 --- a/nihav-realmedia/src/codecs/rv34codes.rs +++ b/nihav-realmedia/src/codecs/rv34codes.rs @@ -19,14 +19,14 @@ struct FullSet { coeffs: Codebook, } -struct RV34CodeReader { - lengths: Vec, - codes: Vec, - syms: Vec, +pub struct RV34CodeReader { + pub lengths: Vec, + pub codes: Vec, + pub syms: Vec, } impl RV34CodeReader { - fn new(data: &'static [u8]) -> Self { + pub fn new(data: &'static [u8]) -> Self { let len = data.len(); let mut lengths: Vec = Vec::with_capacity(len); let mut codes: Vec = Vec::with_capacity(len); @@ -61,10 +61,10 @@ impl CodebookDescReader for RV34CodeReader { fn len (&mut self) -> usize { self.lengths.len() } } -struct RV34CBPCodeReader { - lengths: Vec, - codes: Vec, - syms: Vec, +pub struct RV34CBPCodeReader { + pub lengths: Vec, + pub codes: Vec, + pub syms: Vec, } const RV34_CBP_SYMS: [u8; 16] = [ @@ -73,7 +73,7 @@ const RV34_CBP_SYMS: [u8; 16] = [ ]; impl RV34CBPCodeReader { - fn new(data: &'static [u8]) -> Self { + pub fn new(data: &'static [u8]) -> Self { let len = data.len(); let mut lengths: Vec = Vec::with_capacity(len); let mut codes: Vec = Vec::with_capacity(len); @@ -361,11 +361,11 @@ impl RV34Codes { } } -const RV34_SET_IDX_INTRA: [usize; 31] = [ +pub const RV34_SET_IDX_INTRA: [usize; 31] = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0 ]; -const RV34_SET_IDX_INTER: [usize; 31] = [ +pub const RV34_SET_IDX_INTER: [usize; 31] = [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 ]; @@ -392,7 +392,7 @@ const RV34_MODULO_THREE_TABLE: [u8; 108] = [ 0xE0, 0xE1, 0xE2, 0xE4, 0xE5, 0xE6, 0xE8, 0xE9, 0xEA, ]; -const RV34_INTRA_CBPPAT: &[[[u8; 1296]; 2]; 5] = &[ +pub const RV34_INTRA_CBPPAT: &[[[u8; 1296]; 2]; 5] = &[ [ [ 8, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10, 6, @@ -1226,7 +1226,7 @@ const RV34_INTRA_CBPPAT: &[[[u8; 1296]; 2]; 5] = &[ ], ]; -const RV34_INTRA_CBP: &[[[u8; 16]; 8]; 5] = &[ +pub const RV34_INTRA_CBP: &[[[u8; 16]; 8]; 5] = &[ [ [ 0, 3, 3, 4, 3, 5, 5, 5, 2, 5, 4, 6, 4, 6, 6, 6, ], [ 0, 2, 3, 4, 2, 5, 6, 7, 3, 6, 5, 7, 4, 7, 8, 8, ], @@ -1275,7 +1275,7 @@ const RV34_INTRA_CBP: &[[[u8; 16]; 8]; 5] = &[ ], ]; -const RV34_INTRA_FIRSTPAT: &[[[u8; 864]; 4]; 5] = &[ +pub const RV34_INTRA_FIRSTPAT: &[[[u8; 864]; 4]; 5] = &[ [ [ 0, 10, 5, 10, 7, 12, 9, 11, 8, 13, 9, 12, 10, 13, 11, 12, @@ -2389,7 +2389,7 @@ const RV34_INTRA_FIRSTPAT: &[[[u8; 864]; 4]; 5] = &[ ], ]; -const RV34_INTRA_SECONDPAT: &[[[u8; 108]; 2]; 5] = &[ +pub const RV34_INTRA_SECONDPAT: &[[[u8; 108]; 2]; 5] = &[ [ [ 0, 5, 10, 3, 6, 10, 7, 8, 9, 4, 6, 10, 6, 7, 9, 8, @@ -2483,7 +2483,7 @@ const RV34_INTRA_SECONDPAT: &[[[u8; 108]; 2]; 5] = &[ ], ]; -const RV34_INTRA_THIRDPAT: &[[[u8; 108]; 2]; 5] = &[ +pub const RV34_INTRA_THIRDPAT: &[[[u8; 108]; 2]; 5] = &[ [ [ 0, 5, 10, 3, 6, 10, 7, 8, 10, 4, 7, 10, 6, 7, 10, 8, @@ -2577,7 +2577,7 @@ const RV34_INTRA_THIRDPAT: &[[[u8; 108]; 2]; 5] = &[ ], ]; -const RV34_INTRA_COEFFS: &[[u8; 32]; 5] = &[ +pub const RV34_INTRA_COEFFS: &[[u8; 32]; 5] = &[ [ 1, 3, 3, 4, 4, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 13, 14, 15, 15, @@ -2596,7 +2596,7 @@ const RV34_INTRA_COEFFS: &[[u8; 32]; 5] = &[ ] ]; -const RV34_INTER_CBPPAT: &[[u8; 1296]; 7] = &[ +pub const RV34_INTER_CBPPAT: &[[u8; 1296]; 7] = &[ [ 7, 9, 9, 8, 9, 8, 9, 8, 9, 9, 8, 8, 8, 8, 8, 4, 7, 10, 11, 10, 11, 10, 12, 10, 12, 11, 11, 10, 11, 10, 10, 7, @@ -3173,7 +3173,7 @@ const RV34_INTER_CBPPAT: &[[u8; 1296]; 7] = &[ 10, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14, ]]; -const RV34_INTER_CBP: &[[[u8; 16]; 4]; 7] = &[ +pub const RV34_INTER_CBP: &[[[u8; 16]; 4]; 7] = &[ [ [ 0, 6, 6, 3, 6, 4, 5, 3, 6, 5, 4, 3, 3, 4, 4, 3 ], [ 0, 6, 6, 4, 6, 4, 5, 3, 6, 5, 4, 3, 4, 4, 4, 2 ], @@ -3211,7 +3211,7 @@ const RV34_INTER_CBP: &[[[u8; 16]; 4]; 7] = &[ [ 0, 4, 4, 3, 5, 4, 5, 4, 5, 5, 4, 4, 3, 4, 4, 3 ] ]]; -const RV34_INTER_FIRSTPAT: &[[[u8; 864]; 2]; 7] = &[ +pub const RV34_INTER_FIRSTPAT: &[[[u8; 864]; 2]; 7] = &[ [ [ 0, 7, 5, 7, 5, 7, 6, 6, 7, 10, 7, 9, 8, 9, 8, 7, @@ -3999,7 +3999,7 @@ const RV34_INTER_FIRSTPAT: &[[[u8; 864]; 2]; 7] = &[ ], ]; -const RV34_INTER_SECONDPAT: &[[[u8; 108]; 2]; 7] = &[ +pub const RV34_INTER_SECONDPAT: &[[[u8; 108]; 2]; 7] = &[ [ [ 0, 4, 8, 3, 6, 8, 6, 7, 8, 4, 6, 8, 6, 7, 8, 7, @@ -4129,7 +4129,7 @@ const RV34_INTER_SECONDPAT: &[[[u8; 108]; 2]; 7] = &[ ], ]; -const RV34_INTER_THIRDPAT: &[[[u8; 108]; 2]; 7] = &[ +pub const RV34_INTER_THIRDPAT: &[[[u8; 108]; 2]; 7] = &[ [ [ 0, 5, 8, 3, 6, 9, 6, 7, 9, 4, 6, 9, 6, 7, 9, 8, @@ -4259,7 +4259,7 @@ const RV34_INTER_THIRDPAT: &[[[u8; 108]; 2]; 7] = &[ ], ]; -const RV34_INTER_COEFFS: &[[u8; 32]; 7] = &[ +pub const RV34_INTER_COEFFS: &[[u8; 32]; 7] = &[ [ 1, 2, 4, 4, 5, 5, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 11, 11, 11, 13, 14, 15, 16, 16, -- 2.39.5