Skip to content

Commit

Permalink
Deduplicate struct Dav1dTaskContext_scratch and its previously unna…
Browse files Browse the repository at this point in the history
…med inner types to `src/internal.rs` (#105)

Now that type is deduplicated, it can be easily `#[repr(align(64))]`ed
like in the C source:
https://github.com/memorysafety/rav1d/blob/1b882647c4d16f94efcce81a7111503db3c491d9/src/internal.h#L406-L444
  • Loading branch information
kkysen authored Apr 12, 2023
2 parents 0ac039c + de202a4 commit 85a4f5e
Show file tree
Hide file tree
Showing 16 changed files with 195 additions and 795 deletions.
62 changes: 9 additions & 53 deletions src/cdef_apply_tmpl_16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,61 +445,17 @@ use crate::src::levels::Filter2d;



#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap_emu_edge,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_levels_pal,
pub ac: [int16_t; 1024],
pub pal_idx: [uint8_t; 8192],
pub pal: [[uint16_t; 8]; 3],
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_interintra_edge,
}
use crate::src::internal::Dav1dTaskContext_scratch_interintra_edge;
use crate::src::internal::Dav1dTaskContext_scratch;










#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_levels_pal {
pub levels: [uint8_t; 1088],
pub c2rust_unnamed: Dav1dTaskContext_scratch_pal,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_pal {
pub pal_order: [[uint8_t; 8]; 64],
pub pal_ctx: [uint8_t; 64],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_lap_emu_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_emu_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_emu_edge {
pub emu_edge_8bpc: [uint8_t; 84160],
pub emu_edge_16bpc: [uint16_t; 84160],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_lap {
pub lap_8bpc: [uint8_t; 4096],
pub lap_16bpc: [uint16_t; 4096],
pub c2rust_unnamed: Dav1dTaskContext_scratch_compinter_seg_mask,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_compinter_seg_mask {
pub compinter: [[int16_t; 16384]; 2],
pub seg_mask: [uint8_t; 16384],
}
use crate::src::internal::Dav1dTaskContext_cf;
use crate::src::refmvs::refmvs_tile;

Expand Down
62 changes: 9 additions & 53 deletions src/cdef_apply_tmpl_8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,61 +446,17 @@ use crate::src::levels::Filter2d;



#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap_emu_edge,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_levels_pal,
pub ac: [int16_t; 1024],
pub pal_idx: [uint8_t; 8192],
pub pal: [[uint16_t; 8]; 3],
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_interintra_edge,
}
use crate::src::internal::Dav1dTaskContext_scratch_interintra_edge;
use crate::src::internal::Dav1dTaskContext_scratch;










#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_levels_pal {
pub levels: [uint8_t; 1088],
pub c2rust_unnamed: Dav1dTaskContext_scratch_pal,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_pal {
pub pal_order: [[uint8_t; 8]; 64],
pub pal_ctx: [uint8_t; 64],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_lap_emu_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_emu_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_emu_edge {
pub emu_edge_8bpc: [uint8_t; 84160],
pub emu_edge_16bpc: [uint16_t; 84160],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_lap {
pub lap_8bpc: [uint8_t; 4096],
pub lap_16bpc: [uint16_t; 4096],
pub c2rust_unnamed: Dav1dTaskContext_scratch_compinter_seg_mask,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_compinter_seg_mask {
pub compinter: [[int16_t; 16384]; 2],
pub seg_mask: [uint8_t; 16384],
}
use crate::src::internal::Dav1dTaskContext_cf;
use crate::src::refmvs::refmvs_tile;

Expand Down
62 changes: 9 additions & 53 deletions src/cdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,61 +456,17 @@ use crate::src::levels::Filter2d;



#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap_emu_edge,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_levels_pal,
pub ac: [int16_t; 1024],
pub pal_idx: [uint8_t; 8192],
pub pal: [[uint16_t; 8]; 3],
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_interintra_edge,
}
use crate::src::internal::Dav1dTaskContext_scratch_interintra_edge;
use crate::src::internal::Dav1dTaskContext_scratch;










#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_levels_pal {
pub levels: [uint8_t; 1088],
pub c2rust_unnamed: Dav1dTaskContext_scratch_pal,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_pal {
pub pal_order: [[uint8_t; 8]; 64],
pub pal_ctx: [uint8_t; 64],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_lap_emu_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_emu_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_emu_edge {
pub emu_edge_8bpc: [uint8_t; 84160],
pub emu_edge_16bpc: [uint16_t; 84160],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_lap {
pub lap_8bpc: [uint8_t; 4096],
pub lap_16bpc: [uint16_t; 4096],
pub c2rust_unnamed: Dav1dTaskContext_scratch_compinter_seg_mask,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_compinter_seg_mask {
pub compinter: [[int16_t; 16384]; 2],
pub seg_mask: [uint8_t; 16384],
}
use crate::src::internal::Dav1dTaskContext_cf;
use crate::src::refmvs::refmvs_tile;

Expand Down
62 changes: 9 additions & 53 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,61 +807,17 @@ use crate::src::levels::FILTER_2D_BILINEAR;



#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap_emu_edge,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_levels_pal,
pub ac: [int16_t; 1024],
pub pal_idx: [uint8_t; 8192],
pub pal: [[uint16_t; 8]; 3],
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_interintra_edge,
}
use crate::src::internal::Dav1dTaskContext_scratch_interintra_edge;
use crate::src::internal::Dav1dTaskContext_scratch;










#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_levels_pal {
pub levels: [uint8_t; 1088],
pub c2rust_unnamed: Dav1dTaskContext_scratch_pal,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_pal {
pub pal_order: [[uint8_t; 8]; 64],
pub pal_ctx: [uint8_t; 64],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_lap_emu_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_emu_edge,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_emu_edge {
pub emu_edge_8bpc: [uint8_t; 84160],
pub emu_edge_16bpc: [uint16_t; 84160],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_lap {
pub lap_8bpc: [uint8_t; 4096],
pub lap_16bpc: [uint16_t; 4096],
pub c2rust_unnamed: Dav1dTaskContext_scratch_compinter_seg_mask,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_compinter_seg_mask {
pub compinter: [[int16_t; 16384]; 2],
pub seg_mask: [uint8_t; 16384],
}
use crate::src::internal::Dav1dTaskContext_cf;
use crate::src::refmvs::refmvs_tile;

Expand Down
60 changes: 60 additions & 0 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,49 @@ pub union Dav1dTaskContext_cf {
pub cf_16bpc: [int32_t; 1024],
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_compinter_seg_mask {
pub compinter: [[int16_t; 16384]; 2],
pub seg_mask: [uint8_t; 16384],
}

#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_lap {
pub lap_8bpc: [uint8_t; 4096],
pub lap_16bpc: [uint16_t; 4096],
pub c2rust_unnamed: Dav1dTaskContext_scratch_compinter_seg_mask,
}

#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_emu_edge {
pub emu_edge_8bpc: [uint8_t; 84160],
pub emu_edge_16bpc: [uint16_t; 84160],
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_lap_emu_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_emu_edge,
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_pal {
pub pal_order: [[uint8_t; 8]; 64],
pub pal_ctx: [uint8_t; 64],
}

#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch_levels_pal {
pub levels: [uint8_t; 1088],
pub c2rust_unnamed: Dav1dTaskContext_scratch_pal,
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_interintra_edge_8 {
Expand All @@ -215,6 +258,23 @@ pub union Dav1dTaskContext_scratch_interintra_edge {
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_interintra_edge_16,
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge {
pub c2rust_unnamed: Dav1dTaskContext_scratch_levels_pal,
pub ac: [int16_t; 1024],
pub pal_idx: [uint8_t; 8192],
pub pal: [[uint16_t; 8]; 3],
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_interintra_edge,
}

#[derive(Copy, Clone)]
#[repr(C)]
pub union Dav1dTaskContext_scratch {
pub c2rust_unnamed: Dav1dTaskContext_scratch_lap_emu_edge,
pub c2rust_unnamed_0: Dav1dTaskContext_scratch_levels_pal_ac_interintra_edge,
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct Dav1dTaskContext_frame_thread {
Expand Down
Loading

0 comments on commit 85a4f5e

Please sign in to comment.