Skip to content

Commit

Permalink
Expirimenting with const tables (probably doesn't make a difference)
Browse files Browse the repository at this point in the history
  • Loading branch information
rinon committed Jun 25, 2024
1 parent 6498810 commit 24ced58
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
3 changes: 2 additions & 1 deletion src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::include::stdint::*;
use ::libc;
use crate::src::msac::MsacContext;
use crate::src::cdf::{CdfContext, CdfMvComponent, CdfMvContext};
use crate::src::tables::dav1d_txfm_dimensions;
extern "C" {
fn memcpy(
_: *mut libc::c_void,
Expand Down Expand Up @@ -64,7 +65,6 @@ extern "C" {
static dav1d_al_part_ctx: [[[uint8_t; 10]; 5]; 2];
static dav1d_block_sizes: [[[uint8_t; 2]; 10]; 5];
static dav1d_block_dimensions: [[uint8_t; 4]; 22];
static dav1d_txfm_dimensions: [TxfmInfo; 19];
static dav1d_max_txfm_size_for_bs: [[uint8_t; 4]; 22];
static dav1d_comp_inter_pred_modes: [[uint8_t; 2]; 8];
static dav1d_partition_type_count: [uint8_t; 5];
Expand Down Expand Up @@ -4485,6 +4485,7 @@ unsafe fn DEBUG_BLOCK_INFO(
&& (*t).bx >= 8 && (*t).bx < 12
// true
}
#[no_mangle]
unsafe extern "C" fn decode_b(
t: *mut Dav1dTaskContext,
bl: BlockLevel,
Expand Down
2 changes: 1 addition & 1 deletion src/lf_mask.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::include::stddef::*;
use crate::include::stdint::*;
use ::libc;
use crate::src::tables::dav1d_txfm_dimensions;
extern "C" {
fn memcpy(
_: *mut libc::c_void,
Expand All @@ -13,7 +14,6 @@ extern "C" {
_: libc::c_ulong,
) -> *mut libc::c_void;
static dav1d_block_dimensions: [[uint8_t; 4]; 22];
static dav1d_txfm_dimensions: [TxfmInfo; 19];
}

use crate::src::ctx::alias64;
Expand Down
4 changes: 2 additions & 2 deletions src/recon_tmpl_16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use ::libc;
use crate::src::cdf::CdfContext;
use crate::src::msac::MsacContext;
use crate::{stdout};
use crate::src::tables::dav1d_txfm_dimensions;
use crate::src::scan::dav1d_scans;
extern "C" {
fn memcpy(
_: *mut libc::c_void,
Expand All @@ -20,7 +22,6 @@ extern "C" {
fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
fn llabs(_: libc::c_longlong) -> libc::c_longlong;
static dav1d_block_dimensions: [[uint8_t; 4]; 22];
static dav1d_txfm_dimensions: [TxfmInfo; 19];
static dav1d_txtp_from_uvmode: [uint8_t; 14];
static dav1d_tx_types_per_set: [uint8_t; 40];
static dav1d_filter_mode_to_y_mode: [uint8_t; 5];
Expand Down Expand Up @@ -100,7 +101,6 @@ extern "C" {
dst: *const *mut pixel,
sby: libc::c_int,
);
static dav1d_scans: [*const uint16_t; 19];
static mut dav1d_wedge_masks: [[[[*const uint8_t; 16]; 2]; 3]; 22];
static mut dav1d_ii_masks: [[[*const uint8_t; 4]; 3]; 22];
}
Expand Down
4 changes: 2 additions & 2 deletions src/recon_tmpl_8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use ::libc;
use crate::src::cdf::CdfContext;
use crate::src::msac::MsacContext;
use crate::{stdout};
use crate::src::tables::dav1d_txfm_dimensions;
use crate::src::scan::dav1d_scans;
extern "C" {
fn memcpy(
_: *mut libc::c_void,
Expand All @@ -20,7 +22,6 @@ extern "C" {
fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
fn llabs(_: libc::c_longlong) -> libc::c_longlong;
static dav1d_block_dimensions: [[uint8_t; 4]; 22];
static dav1d_txfm_dimensions: [TxfmInfo; 19];
static dav1d_txtp_from_uvmode: [uint8_t; 14];
static dav1d_tx_types_per_set: [uint8_t; 40];
static dav1d_filter_mode_to_y_mode: [uint8_t; 5];
Expand Down Expand Up @@ -99,7 +100,6 @@ extern "C" {
dst: *const *mut pixel,
sby: libc::c_int,
);
static dav1d_scans: [*const uint16_t; 19];
static mut dav1d_wedge_masks: [[[[*const uint8_t; 16]; 2]; 3]; 22];
static mut dav1d_ii_masks: [[[*const uint8_t; 4]; 3]; 22];
}
Expand Down
31 changes: 15 additions & 16 deletions src/scan.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::include::stdint::*;
use ::libc;

static mut scan_4x4: [uint16_t; 16] = [
const scan_4x4: [uint16_t; 16] = [
0 as libc::c_int as uint16_t,
4 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand All @@ -19,7 +19,7 @@ static mut scan_4x4: [uint16_t; 16] = [
11 as libc::c_int as uint16_t,
15 as libc::c_int as uint16_t,
];
static mut scan_4x8: [uint16_t; 32] = [
const scan_4x8: [uint16_t; 32] = [
0 as libc::c_int as uint16_t,
8 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -53,7 +53,7 @@ static mut scan_4x8: [uint16_t; 32] = [
23 as libc::c_int as uint16_t,
31 as libc::c_int as uint16_t,
];
static mut scan_4x16: [uint16_t; 64] = [
const scan_4x16: [uint16_t; 64] = [
0 as libc::c_int as uint16_t,
16 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -119,7 +119,7 @@ static mut scan_4x16: [uint16_t; 64] = [
47 as libc::c_int as uint16_t,
63 as libc::c_int as uint16_t,
];
static mut scan_8x4: [uint16_t; 32] = [
const scan_8x4: [uint16_t; 32] = [
0 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
4 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -153,7 +153,7 @@ static mut scan_8x4: [uint16_t; 32] = [
30 as libc::c_int as uint16_t,
31 as libc::c_int as uint16_t,
];
static mut scan_8x8: [uint16_t; 64] = [
const scan_8x8: [uint16_t; 64] = [
0 as libc::c_int as uint16_t,
8 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -219,7 +219,7 @@ static mut scan_8x8: [uint16_t; 64] = [
55 as libc::c_int as uint16_t,
63 as libc::c_int as uint16_t,
];
static mut scan_8x16: [uint16_t; 128] = [
const scan_8x16: [uint16_t; 128] = [
0 as libc::c_int as uint16_t,
16 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -349,7 +349,7 @@ static mut scan_8x16: [uint16_t; 128] = [
111 as libc::c_int as uint16_t,
127 as libc::c_int as uint16_t,
];
static mut scan_8x32: [uint16_t; 256] = [
const scan_8x32: [uint16_t; 256] = [
0 as libc::c_int as uint16_t,
32 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -607,7 +607,7 @@ static mut scan_8x32: [uint16_t; 256] = [
223 as libc::c_int as uint16_t,
255 as libc::c_int as uint16_t,
];
static mut scan_16x4: [uint16_t; 64] = [
const scan_16x4: [uint16_t; 64] = [
0 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
4 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -673,7 +673,7 @@ static mut scan_16x4: [uint16_t; 64] = [
62 as libc::c_int as uint16_t,
63 as libc::c_int as uint16_t,
];
static mut scan_16x8: [uint16_t; 128] = [
const scan_16x8: [uint16_t; 128] = [
0 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
8 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -803,7 +803,7 @@ static mut scan_16x8: [uint16_t; 128] = [
126 as libc::c_int as uint16_t,
127 as libc::c_int as uint16_t,
];
static mut scan_16x16: [uint16_t; 256] = [
const scan_16x16: [uint16_t; 256] = [
0 as libc::c_int as uint16_t,
16 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -1061,7 +1061,7 @@ static mut scan_16x16: [uint16_t; 256] = [
239 as libc::c_int as uint16_t,
255 as libc::c_int as uint16_t,
];
static mut scan_16x32: [uint16_t; 512] = [
const scan_16x32: [uint16_t; 512] = [
0 as libc::c_int as uint16_t,
32 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -1575,7 +1575,7 @@ static mut scan_16x32: [uint16_t; 512] = [
479 as libc::c_int as uint16_t,
511 as libc::c_int as uint16_t,
];
static mut scan_32x8: [uint16_t; 256] = [
const scan_32x8: [uint16_t; 256] = [
0 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
8 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -1833,7 +1833,7 @@ static mut scan_32x8: [uint16_t; 256] = [
254 as libc::c_int as uint16_t,
255 as libc::c_int as uint16_t,
];
static mut scan_32x16: [uint16_t; 512] = [
const scan_32x16: [uint16_t; 512] = [
0 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
16 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -2347,7 +2347,7 @@ static mut scan_32x16: [uint16_t; 512] = [
510 as libc::c_int as uint16_t,
511 as libc::c_int as uint16_t,
];
static mut scan_32x32: [uint16_t; 1024] = [
const scan_32x32: [uint16_t; 1024] = [
0 as libc::c_int as uint16_t,
32 as libc::c_int as uint16_t,
1 as libc::c_int as uint16_t,
Expand Down Expand Up @@ -3373,8 +3373,7 @@ static mut scan_32x32: [uint16_t; 1024] = [
991 as libc::c_int as uint16_t,
1023 as libc::c_int as uint16_t,
];
#[no_mangle]
pub static mut dav1d_scans: [*const uint16_t; 19] = unsafe {
pub const dav1d_scans: [*const uint16_t; 19] = unsafe {
[
scan_4x4.as_ptr(),
scan_8x8.as_ptr(),
Expand Down
3 changes: 1 addition & 2 deletions src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ pub static mut dav1d_block_dimensions: [[uint8_t; 4]; 22] = [
0 as libc::c_int as uint8_t,
],
];
#[no_mangle]
pub static mut dav1d_txfm_dimensions: [TxfmInfo; 19] = [
pub const dav1d_txfm_dimensions: [TxfmInfo; 19] = [
{
let mut init = TxfmInfo {
w: 1 as libc::c_int as uint8_t,
Expand Down

0 comments on commit 24ced58

Please sign in to comment.